From 0a1ae40ff4f655fb80227f7e8616be8f4e2484ef Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Tue, 9 Feb 2021 16:00:43 +0100 Subject: [PATCH] first tries for linkpicker --- .../pickers/linkPicker/areas/media.vue | 22 ++++ .../pickers/linkPicker/areas/pages.vue | 95 +++++++++++++++ .../pickers/linkPicker/linkpicker.vue | 21 +++- .../components/pickers/linkPicker/overlay.vue | 112 ++---------------- zero.Web.UI/App/config/zero.config.js | 13 +- zero.Web.UI/App/core/link-area.js | 12 ++ zero.Web.UI/App/core/link-area.js.map | 1 + zero.Web.UI/App/core/link-provider.js | 32 ----- zero.Web.UI/App/core/link-provider.js.map | 1 - zero.Web.UI/App/core/link-provider.ts | 37 ------ zero.Web.UI/App/core/plugin.zero.js | 14 ++- zero.Web.UI/app/core/plugin.ts | 10 -- zero.Web.UI/app/core/zero.ts | 5 - 13 files changed, 170 insertions(+), 205 deletions(-) create mode 100644 zero.Web.UI/App/components/pickers/linkPicker/areas/media.vue create mode 100644 zero.Web.UI/App/components/pickers/linkPicker/areas/pages.vue create mode 100644 zero.Web.UI/App/core/link-area.js create mode 100644 zero.Web.UI/App/core/link-area.js.map delete mode 100644 zero.Web.UI/App/core/link-provider.js delete mode 100644 zero.Web.UI/App/core/link-provider.js.map delete mode 100644 zero.Web.UI/App/core/link-provider.ts diff --git a/zero.Web.UI/App/components/pickers/linkPicker/areas/media.vue b/zero.Web.UI/App/components/pickers/linkPicker/areas/media.vue new file mode 100644 index 00000000..04ba0d72 --- /dev/null +++ b/zero.Web.UI/App/components/pickers/linkPicker/areas/media.vue @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/zero.Web.UI/App/components/pickers/linkPicker/areas/pages.vue b/zero.Web.UI/App/components/pickers/linkPicker/areas/pages.vue new file mode 100644 index 00000000..9687623b --- /dev/null +++ b/zero.Web.UI/App/components/pickers/linkPicker/areas/pages.vue @@ -0,0 +1,95 @@ + + + + + + \ No newline at end of file diff --git a/zero.Web.UI/App/components/pickers/linkPicker/linkpicker.vue b/zero.Web.UI/App/components/pickers/linkPicker/linkpicker.vue index 5ee340b2..4a1d83a3 100644 --- a/zero.Web.UI/App/components/pickers/linkPicker/linkpicker.vue +++ b/zero.Web.UI/App/components/pickers/linkPicker/linkpicker.vue @@ -7,7 +7,7 @@ --> - + @@ -130,6 +130,23 @@ }, + onPick(id) + { + this.pick(id).then(res => + { + if (this.limit > 1) + { + this.value.push(res); + this.onChange(this.value); + } + else + { + this.onChange(res); + } + }); + }, + + pick(id) { if (this.disabled) @@ -169,7 +186,7 @@ justify-content: space-between; align-items: center; - .ui-icon-button + .ui-icon-button { height: 24px; width: 24px; diff --git a/zero.Web.UI/App/components/pickers/linkPicker/overlay.vue b/zero.Web.UI/App/components/pickers/linkPicker/overlay.vue index e0d1d589..deea2fa6 100644 --- a/zero.Web.UI/App/components/pickers/linkPicker/overlay.vue +++ b/zero.Web.UI/App/components/pickers/linkPicker/overlay.vue @@ -5,6 +5,7 @@
@@ -32,31 +33,18 @@
- - - - -
- -
-
+
- - \ No newline at end of file diff --git a/zero.Web.UI/App/config/zero.config.js b/zero.Web.UI/App/config/zero.config.js index f76c148f..13cd7ae2 100644 --- a/zero.Web.UI/App/config/zero.config.js +++ b/zero.Web.UI/App/config/zero.config.js @@ -15,17 +15,6 @@ export default { }, linkPicker: { - areas: [ - { - alias: 'zero.pages', - name: '@zero.config.linkareas.pages', - display: 'tree' - }, - { - alias: 'zero.media', - name: '@zero.config.linkareas.media', - display: 'media' - } - ] + areas: [] } } \ No newline at end of file diff --git a/zero.Web.UI/App/core/link-area.js b/zero.Web.UI/App/core/link-area.js new file mode 100644 index 00000000..7eb3f1be --- /dev/null +++ b/zero.Web.UI/App/core/link-area.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var LinkArea = /** @class */ (function () { + function LinkArea(alias, label, component) { + this.alias = alias; + this.label = label; + this.component = component; + } + return LinkArea; +}()); +exports.default = LinkArea; +//# sourceMappingURL=link-area.js.map \ No newline at end of file diff --git a/zero.Web.UI/App/core/link-area.js.map b/zero.Web.UI/App/core/link-area.js.map new file mode 100644 index 00000000..f798868b --- /dev/null +++ b/zero.Web.UI/App/core/link-area.js.map @@ -0,0 +1 @@ +{"version":3,"file":"link-area.js","sourceRoot":"","sources":["link-area.ts"],"names":[],"mappings":";;AACA;IAME,kBAAY,KAAK,EAAE,KAAK,EAAE,SAAS;QAEjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IACH,eAAC;AAAD,CAAC,AAZD,IAYC;AAGD,kBAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/zero.Web.UI/App/core/link-provider.js b/zero.Web.UI/App/core/link-provider.js deleted file mode 100644 index 118407e4..00000000 --- a/zero.Web.UI/App/core/link-provider.js +++ /dev/null @@ -1,32 +0,0 @@ -//import MediaApi from 'zero/api/media.js'; -//import Strings from 'zero/helpers/strings.js'; -//import Localization from 'zero/helpers/localization.js'; -//class LinkProvider -//{ -// key; -// label; -// icon; -// autoclose = true; -// action = () => -// { -// console.warn(`[zero] A list action needs a "action" callback`); -// }; -// constructor(alias: string, name: string, type: string) -// { -// this.key = key; -// this.label = label; -// this.icon = icon; -// this.action = action; -// } -// /** -// * Calls the action -// * @returns {ListColumn} -// */ -// call(options) -// { -// console.info(options); -// this.action(options); -// } -//} -//export default ListAction; -//# sourceMappingURL=link-provider.js.map \ No newline at end of file diff --git a/zero.Web.UI/App/core/link-provider.js.map b/zero.Web.UI/App/core/link-provider.js.map deleted file mode 100644 index af4749f5..00000000 --- a/zero.Web.UI/App/core/link-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"link-provider.js","sourceRoot":"","sources":["link-provider.ts"],"names":[],"mappings":"AACA,2CAA2C;AAC3C,gDAAgD;AAChD,0DAA0D;AAE1D,oBAAoB;AACpB,GAAG;AACH,QAAQ;AACR,UAAU;AACV,SAAS;AACT,qBAAqB;AACrB,kBAAkB;AAClB,KAAK;AACL,qEAAqE;AACrE,MAAM;AAEN,0DAA0D;AAC1D,KAAK;AACL,qBAAqB;AACrB,yBAAyB;AACzB,uBAAuB;AACvB,2BAA2B;AAC3B,KAAK;AAEL,OAAO;AACP,uBAAuB;AACvB,4BAA4B;AAC5B,OAAO;AACP,iBAAiB;AACjB,KAAK;AACL,4BAA4B;AAC5B,2BAA2B;AAC3B,KAAK;AACL,GAAG;AAGH,4BAA4B"} \ No newline at end of file diff --git a/zero.Web.UI/App/core/link-provider.ts b/zero.Web.UI/App/core/link-provider.ts deleted file mode 100644 index 0ddde1e9..00000000 --- a/zero.Web.UI/App/core/link-provider.ts +++ /dev/null @@ -1,37 +0,0 @@ - -//import MediaApi from 'zero/api/media.js'; -//import Strings from 'zero/helpers/strings.js'; -//import Localization from 'zero/helpers/localization.js'; - -//class LinkProvider -//{ -// key; -// label; -// icon; -// autoclose = true; -// action = () => -// { -// console.warn(`[zero] A list action needs a "action" callback`); -// }; - -// constructor(alias: string, name: string, type: string) -// { -// this.key = key; -// this.label = label; -// this.icon = icon; -// this.action = action; -// } - -// /** -// * Calls the action -// * @returns {ListColumn} -// */ -// call(options) -// { -// console.info(options); -// this.action(options); -// } -//} - - -//export default ListAction; \ No newline at end of file diff --git a/zero.Web.UI/App/core/plugin.zero.js b/zero.Web.UI/App/core/plugin.zero.js index af7d7d3e..aec28db5 100644 --- a/zero.Web.UI/App/core/plugin.zero.js +++ b/zero.Web.UI/App/core/plugin.zero.js @@ -3,6 +3,8 @@ import Plugin from './plugin.ts'; import editors from '../renderers/editors/all.js'; import lists from '../renderers/lists/all.js'; import routes from './routes.js'; +import LinkAreaPages from '../components/pickers/linkPicker/areas/pages.vue'; +import LinkAreaMedia from '../components/pickers/linkPicker/areas/media.vue'; const plugin = new Plugin('zero'); @@ -17,7 +19,17 @@ plugin.addRoutes(routes); plugin.install = (vue, zero) => { - + zero.config.linkPicker.areas.push({ + alias: 'zero.pages', + name: '@zero.config.linkareas.pages', + component: LinkAreaPages + }); + + zero.config.linkPicker.areas.push({ + alias: 'zero.media', + name: '@zero.config.linkareas.media', + component: LinkAreaMedia + }); }; export default plugin; \ No newline at end of file diff --git a/zero.Web.UI/app/core/plugin.ts b/zero.Web.UI/app/core/plugin.ts index bc642dd9..94313dc2 100644 --- a/zero.Web.UI/app/core/plugin.ts +++ b/zero.Web.UI/app/core/plugin.ts @@ -7,7 +7,6 @@ class Plugin routes = []; editors = []; lists = []; - linkAreas = []; constructor(name) @@ -88,15 +87,6 @@ class Plugin { routes.forEach(route => this.addRoute(route)); } - - - /* - * Add a new link area - */ - addLinkArea(area) - { - this.linkAreas.push(area); - } }; export default Plugin; \ No newline at end of file diff --git a/zero.Web.UI/app/core/zero.ts b/zero.Web.UI/app/core/zero.ts index 553ceba4..63f77deb 100644 --- a/zero.Web.UI/app/core/zero.ts +++ b/zero.Web.UI/app/core/zero.ts @@ -2,14 +2,9 @@ // ref: // https://github.com/vuejs/vue-router/blob/dev/src/index.js -import Axios from 'axios'; import ZeroPlugin from './plugin.zero.js'; -import EventHub from '../services/eventhub.js'; import VueRouter from 'vue-router'; -import Vue from 'vue'; import plugins from './plugins.js'; -//import CommercePlugin from '../../../zero.Commerce/Plugins/zero.Commerce/plugin.js'; // TODO dynPath -//import TestPlugin from '../../../../Laola/Laola.Backoffice/Plugin/plugin.js'; // TODO dynPath import zeroConfig from '../config/zero.config.js'; import routerConfig from '../config/router.config.js'