From 9a7a2573ced192793e8d0c90d9ae09c3587a4ba4 Mon Sep 17 00:00:00 2001 From: vdpAdmin Date: Mon, 25 Oct 2021 14:18:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=8C=E6=AC=A1=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E7=BB=84=E4=BB=B6=E7=A4=BA=E4=BE=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/form-designer/designer.js | 26 +-- .../container-widget/container-wrapper.vue | 5 +- .../container-widget/grid-col-widget.vue | 12 +- .../form-widget/container-widget/index.js | 14 ++ .../container-widget/tab-widget.vue | 2 - .../container-widget/table-cell-widget.vue | 2 - .../form-widget/field-widget/fieldMixin.js | 3 +- .../field-widget/form-item-wrapper.vue | 2 +- .../field-widget/static-content-wrapper.vue | 8 +- .../form-designer/form-widget/index.vue | 3 +- src/components/form-designer/index.vue | 5 +- .../setting-panel/property-editor-factory.js | 173 ++++++++++++++++++ .../grid-col-offset-editor.vue | 24 +++ .../grid-col-pull-editor.vue | 24 +++ .../grid-col-push-editor.vue | 24 +++ .../event-handler/eventMixin.js | 9 +- .../field-switch/activeColor-editor.vue | 23 +++ .../field-switch/activeText-editor.vue | 4 +- .../field-switch/inactiveText-editor.vue | 23 +++ .../switch-defaultValue-editor.vue | 6 +- .../property-editor/name-editor.vue | 2 +- .../setting-panel/propertyRegister.js | 26 ++- .../form-designer/toolbar-panel/index.vue | 9 +- .../form-designer/widget-panel/index.vue | 24 ++- .../widget-panel/widgetsConfig.js | 61 ++++++ .../container-item/grid-col-item.vue | 5 +- .../form-render/container-item/index.js | 14 ++ .../form-render/container-item/tab-item.vue | 2 - .../container-item/table-cell-item.vue | 4 +- src/components/form-render/index.vue | 3 +- src/components/v-table/index.vue | 106 +++++++++++ src/extension/extension-helper.js | 23 +++ src/extension/extension-loader.js | 97 ++++++++++ src/extension/samples/alert/alert-widget.vue | 72 ++++++++ src/extension/samples/card/card-item.vue | 66 +++++++ src/extension/samples/card/card-widget.vue | 83 +++++++++ src/extension/samples/extension-schema.js | 34 ++++ src/icons/svg/alert.svg | 1 + src/icons/svg/card.svg | 1 + src/icons/svg/data-table.svg | 1 + src/lang/en-US.js | 10 +- src/lang/en-US_extension.js | 19 ++ src/lang/zh-CN.js | 8 +- src/lang/zh-CN_extension.js | 19 ++ src/main.js | 3 + src/utils/i18n.js | 11 +- 46 files changed, 1006 insertions(+), 90 deletions(-) create mode 100644 src/components/form-designer/setting-panel/property-editor-factory.js create mode 100644 src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue create mode 100644 src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue create mode 100644 src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue create mode 100644 src/components/form-designer/setting-panel/property-editor/field-switch/activeColor-editor.vue create mode 100644 src/components/form-designer/setting-panel/property-editor/field-switch/inactiveText-editor.vue create mode 100644 src/components/v-table/index.vue create mode 100644 src/extension/extension-helper.js create mode 100644 src/extension/extension-loader.js create mode 100644 src/extension/samples/alert/alert-widget.vue create mode 100644 src/extension/samples/card/card-item.vue create mode 100644 src/extension/samples/card/card-widget.vue create mode 100644 src/extension/samples/extension-schema.js create mode 100644 src/icons/svg/alert.svg create mode 100644 src/icons/svg/card.svg create mode 100644 src/icons/svg/data-table.svg diff --git a/src/components/form-designer/designer.js b/src/components/form-designer/designer.js index 900875e..1116ab6 100644 --- a/src/components/form-designer/designer.js +++ b/src/components/form-designer/designer.js @@ -7,8 +7,8 @@ */ import {deepClone, generateId, overwriteObj} from "@/utils/util" -import {advancedFields, basicFields, containers} from "@/components/form-designer/widget-panel/widgetsConfig.js"; -import {VARIANT_FORM_VERSION} from "@/utils/config"; +import {containers, advancedFields, basicFields, customFields} from "@/components/form-designer/widget-panel/widgetsConfig.js" +import {VARIANT_FORM_VERSION} from "@/utils/config" export function createDesigner(vueInstance) { let defaultFormConfig = { @@ -443,9 +443,10 @@ export function createDesigner(vueInstance) { }, getContainerByType(typeName) { + let allWidgets = [...containers, ...basicFields, ...advancedFields, ...customFields] let foundCon = null - containers.forEach(con => { - if (!!con.type && (con.type === typeName)) { + allWidgets.forEach(con => { + if (!!con.category && !!con.type && (con.type === typeName)) { foundCon = con } }) @@ -454,20 +455,11 @@ export function createDesigner(vueInstance) { }, getFieldWidgetByType(typeName) { + let allWidgets = [...containers, ...basicFields, ...advancedFields, ...customFields] let foundWidget = null - basicFields.forEach(bf => { - if (!!bf.type && (bf.type === typeName)) { - foundWidget = bf - } - }) - - if (!!foundWidget) { - return foundWidget - } - - advancedFields.forEach(af => { - if (!!af.type && (af.type === typeName)) { - foundWidget = af + allWidgets.forEach(widget => { + if (!!!widget.category && !!widget.type && (widget.type === typeName)) { + foundWidget = widget } }) diff --git a/src/components/form-designer/form-widget/container-widget/container-wrapper.vue b/src/components/form-designer/form-widget/container-widget/container-wrapper.vue index 40c5e08..9fc3bfd 100644 --- a/src/components/form-designer/form-widget/container-widget/container-wrapper.vue +++ b/src/components/form-designer/form-widget/container-widget/container-wrapper.vue @@ -30,7 +30,8 @@
- {{i18nt('designer.widgetLabel.' + widget.type)}} + {{i18n2t(`designer.widgetLabel.${widget.type}`, `extension.widgetLabel.${widget.type}`)}} +
@@ -79,7 +80,7 @@ position: absolute; top: -2px; //bottom: -24px; /* 拖拽手柄位于组件下方,有时无法正常拖动,原因未明?? */ - left: -6px; + left: -2px; height: 22px; line-height: 22px; background: $--color-primary; diff --git a/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue b/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue index 4c7b79a..288ebf7 100644 --- a/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue +++ b/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue @@ -1,5 +1,6 @@