@kp-ui/lowcode 2.15.0-beta.7 → 2.16.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.js +17 -15
- package/install.js.map +1 -1
- package/package.json +4 -7
- package/src/components/FormRender/FormContainer.vue.js +55 -0
- package/src/components/FormRender/FormContainer.vue.js.map +1 -0
- package/src/components/FormRender/FormContainer.vue2.js +5 -0
- package/src/components/FormRender/FormContainer.vue2.js.map +1 -0
- package/src/components/FormRender/index.vue.js +2 -2
- package/src/components/FormRender/index.vue2.js +28 -30
- package/src/components/FormRender/index.vue2.js.map +1 -1
- package/src/components/FormRender/useFormContext.js +116 -109
- package/src/components/FormRender/useFormContext.js.map +1 -1
- package/src/components/{designer.js → form-designer/designer.js} +76 -71
- package/src/components/form-designer/designer.js.map +1 -0
- package/src/components/form-designer/form-widget/RenderDesignerWigetList.vue.js +1 -1
- package/src/components/form-designer/form-widget/RenderDesignerWigetList.vue.js.map +1 -1
- package/src/components/form-designer/form-widget/container-widget/useTableWidget.js +143 -138
- package/src/components/form-designer/form-widget/container-widget/useTableWidget.js.map +1 -1
- package/src/components/form-designer/form-widget/container-widget/vf-box-widget.vue.js +2 -2
- package/src/components/form-designer/form-widget/container-widget/vf-box-widget.vue2.js +18 -19
- package/src/components/form-designer/form-widget/container-widget/vf-box-widget.vue2.js.map +1 -1
- package/src/components/form-designer/form-widget/container-widget/vf-dialog-widget.vue.js +2 -2
- package/src/components/form-designer/form-widget/container-widget/vf-dialog-widget.vue2.js +22 -16
- package/src/components/form-designer/form-widget/container-widget/vf-dialog-widget.vue2.js.map +1 -1
- package/src/components/form-designer/form-widget/field-widget/bpmn-editor-widget copy.vue.js +8 -0
- package/src/components/form-designer/form-widget/field-widget/bpmn-editor-widget copy.vue.js.map +1 -0
- package/src/components/form-designer/form-widget/field-widget/bpmn-editor-widget copy.vue2.js +58 -0
- package/src/components/form-designer/form-widget/field-widget/bpmn-editor-widget copy.vue2.js.map +1 -0
- package/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue.js +1 -1
- package/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue2.js +66 -54
- package/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue2.js.map +1 -1
- package/src/components/form-designer/form-widget/field-widget/index.js +1 -1
- package/src/components/form-designer/form-widget/field-widget/index.js.map +1 -1
- package/src/components/form-designer/form-widget/field-widget/rich-editor-widget.vue2.js.map +1 -1
- package/src/components/form-designer/form-widget/field-widget/useField.js +140 -140
- package/src/components/form-designer/form-widget/field-widget/useField.js.map +1 -1
- package/src/components/form-designer/form-widget/index.vue.js +2 -2
- package/src/components/form-designer/form-widget/index.vue2.js +56 -47
- package/src/components/form-designer/form-widget/index.vue2.js.map +1 -1
- package/src/components/form-designer/form-widget/useFormDesigner.js +34 -0
- package/src/components/form-designer/form-widget/useFormDesigner.js.map +1 -0
- package/src/components/form-designer/index.vue.js +77 -74
- package/src/components/form-designer/index.vue.js.map +1 -1
- package/src/components/form-designer/setting-panel/form-setting.vue.js +2 -2
- package/src/components/form-designer/setting-panel/form-setting.vue2.js +100 -126
- package/src/components/form-designer/setting-panel/form-setting.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/index.vue.js +1 -1
- package/src/components/form-designer/setting-panel/index.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/index.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/option-items-setting.vue.js +2 -2
- package/src/components/form-designer/setting-panel/option-items-setting.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/option-items-setting.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/boxModel-editor.vue.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/boxModel-editor.vue2.js +255 -201
- package/src/components/form-designer/setting-panel/property-editor/boxModel-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/button-list-editor.vue2.js +45 -39
- package/src/components/form-designer/setting-panel/property-editor/button-list-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-customClass-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-customClass-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-dsEnabled-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-dsEnabled-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-showButtonsColumn-editor.vue.js +2 -2
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-showButtonsColumn-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue.js +2 -2
- package/src/components/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-span-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-span-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellHeight-editor.vue.js +32 -0
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellHeight-editor.vue.js.map +1 -0
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellWidth-editor.vue.js +32 -0
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellWidth-editor.vue.js.map +1 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/cancelButtonLabel-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/height-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/left-editor.vue.js +5 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/left-editor.vue.js.map +1 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/left-editor.vue2.js +38 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/left-editor.vue2.js.map +1 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/top-editor.vue.js +5 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/top-editor.vue.js.map +1 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/top-editor.vue2.js +38 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/top-editor.vue2.js.map +1 -0
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/width-editor.vue2.js +10 -10
- package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/width-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/customClass-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/customClass-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onTableChange-editor.vue2.js +4 -4
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onTableChange-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/field-slider/range-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/field-slider/range-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/field-switch/switch-defaultValue-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/field-switch/switch-defaultValue-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/index.js +178 -176
- package/src/components/form-designer/setting-panel/property-editor/index.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/labelIconClass-editor.vue2.js +29 -18
- package/src/components/form-designer/setting-panel/property-editor/labelIconClass-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/multiple-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/optionItems-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/optionItems-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/rightSlotCss-editor.vue2.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/rightSlotCss-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/type-editor.vue2.js.map +1 -1
- package/src/components/form-designer/setting-panel/property-editor/useEditor.js +1 -1
- package/src/components/form-designer/setting-panel/property-editor/useEditor.js.map +1 -1
- package/src/components/form-designer/setting-panel/propertyRegister.js +12 -12
- package/src/components/form-designer/setting-panel/propertyRegister.js.map +1 -1
- package/src/components/form-designer/toolbar-panel/PreviewDialog.vue.js +1 -1
- package/src/components/form-designer/toolbar-panel/PreviewDialog.vue.js.map +1 -1
- package/src/components/form-designer/toolbar-panel/index.vue.js +2 -2
- package/src/components/form-designer/toolbar-panel/index.vue2.js +177 -137
- package/src/components/form-designer/toolbar-panel/index.vue2.js.map +1 -1
- package/src/components/form-designer/widget-panel/PanelItemDrag.vue.js +50 -0
- package/src/components/form-designer/widget-panel/PanelItemDrag.vue.js.map +1 -0
- package/src/components/form-designer/widget-panel/basicFields/input.js +4 -2
- package/src/components/form-designer/widget-panel/basicFields/input.js.map +1 -1
- package/src/components/form-designer/widget-panel/containers/vf-box.js +1 -4
- package/src/components/form-designer/widget-panel/containers/vf-box.js.map +1 -1
- package/src/components/form-designer/widget-panel/containers/vf-dialog.js +34 -10
- package/src/components/form-designer/widget-panel/containers/vf-dialog.js.map +1 -1
- package/src/components/form-designer/widget-panel/index.vue.js +2 -2
- package/src/components/form-designer/widget-panel/index.vue2.js +34 -74
- package/src/components/form-designer/widget-panel/index.vue2.js.map +1 -1
- package/src/components/form-render/container-items/data-table-widget.vue.js +3 -3
- package/src/components/form-render/container-items/data-table-widget.vue2.js +65 -64
- package/src/components/form-render/container-items/data-table-widget.vue2.js.map +1 -1
- package/src/components/form-render/dynamic-dialog.vue.js +79 -83
- package/src/components/form-render/dynamic-dialog.vue.js.map +1 -1
- package/src/components/public/ActionButtonListDialog.vue.js +2 -2
- package/src/components/public/ActionButtonListDialog.vue2.js +117 -96
- package/src/components/public/ActionButtonListDialog.vue2.js.map +1 -1
- package/src/components/public/ActionButtonListRender.vue.js +17 -15
- package/src/components/public/ActionButtonListRender.vue.js.map +1 -1
- package/src/components/public/ActionButtonListRender.vue2.js +48 -38
- package/src/components/public/ActionButtonListRender.vue2.js.map +1 -1
- package/src/components/public/ConfigView/CustomPageRender.vue.js +58 -0
- package/src/components/public/ConfigView/CustomPageRender.vue.js.map +1 -0
- package/src/components/public/ConfigView/CustomPageRender.vue2.js +5 -0
- package/src/components/public/ConfigView/CustomPageRender.vue2.js.map +1 -0
- package/src/components/public/CustomerModal/CustomerModal.vue2.js +63 -56
- package/src/components/public/CustomerModal/CustomerModal.vue2.js.map +1 -1
- package/src/constants/EditorTypeEnum.js +1 -1
- package/src/constants/EditorTypeEnum.js.map +1 -1
- package/src/constants/WidgetTypeEnum.js +3 -4
- package/src/constants/WidgetTypeEnum.js.map +1 -1
- package/src/hooks/useDataHttp.js +8 -7
- package/src/hooks/useDataHttp.js.map +1 -1
- package/src/hooks/useLowcode.js.map +1 -1
- package/src/lang/en-US.js +3 -1
- package/src/lang/en-US.js.map +1 -1
- package/src/lang/zh-CN.js +5 -5
- package/src/lang/zh-CN.js.map +1 -1
- package/src/utils/util.js +26 -35
- package/src/utils/util.js.map +1 -1
- package/stats.html +1 -1
- package/styles/style.css +1 -1
- package/src/components/FormRender/FormContainer.js +0 -52
- package/src/components/FormRender/FormContainer.js.map +0 -1
- package/src/components/bi-widget/echartBar/echart-bar-widget.vue.js +0 -8
- package/src/components/bi-widget/echartBar/echart-bar-widget.vue.js.map +0 -1
- package/src/components/bi-widget/echartBar/echart-bar-widget.vue2.js +0 -43
- package/src/components/bi-widget/echartBar/echart-bar-widget.vue2.js.map +0 -1
- package/src/components/bi-widget/echartBar/echart-bar.js +0 -35
- package/src/components/bi-widget/echartBar/echart-bar.js.map +0 -1
- package/src/components/bi-widget/index.js +0 -13
- package/src/components/bi-widget/index.js.map +0 -1
- package/src/components/designer.js.map +0 -1
- package/src/components/form-designer/form-widget/RenderDesignerPC.vue.js +0 -26
- package/src/components/form-designer/form-widget/RenderDesignerPC.vue.js.map +0 -1
- package/src/components/form-designer/form-widget/RenderDesignerPC.vue2.js +0 -5
- package/src/components/form-designer/form-widget/RenderDesignerPC.vue2.js.map +0 -1
- package/src/components/form-designer/form-widget/bi/RenderDesignerBI.vue.js +0 -8
- package/src/components/form-designer/form-widget/bi/RenderDesignerBI.vue.js.map +0 -1
- package/src/components/form-designer/form-widget/bi/RenderDesignerBI.vue2.js +0 -68
- package/src/components/form-designer/form-widget/bi/RenderDesignerBI.vue2.js.map +0 -1
- package/src/components/form-designer/form-widget/bi/RenderDesignerBIWigetList.vue.js +0 -8
- package/src/components/form-designer/form-widget/bi/RenderDesignerBIWigetList.vue.js.map +0 -1
- package/src/components/form-designer/form-widget/bi/RenderDesignerBIWigetList.vue2.js +0 -136
- package/src/components/form-designer/form-widget/bi/RenderDesignerBIWigetList.vue2.js.map +0 -1
- package/src/components/form-designer/form-widget/bi/WidgetContextMenu.vue.js +0 -8
- package/src/components/form-designer/form-widget/bi/WidgetContextMenu.vue.js.map +0 -1
- package/src/components/form-designer/form-widget/bi/WidgetContextMenu.vue2.js +0 -153
- package/src/components/form-designer/form-widget/bi/WidgetContextMenu.vue2.js.map +0 -1
- package/src/components/form-designer/form-widget/bi/useRuler.js +0 -66
- package/src/components/form-designer/form-widget/bi/useRuler.js.map +0 -1
- package/src/components/form-designer/setting-panel/panel/PanelItemDrag.vue.js +0 -51
- package/src/components/form-designer/setting-panel/panel/PanelItemDrag.vue.js.map +0 -1
- package/src/components/form-designer/setting-panel/panel/PanelItemDragForBI.vue.js +0 -51
- package/src/components/form-designer/setting-panel/panel/PanelItemDragForBI.vue.js.map +0 -1
- package/src/components/form-designer/setting-panel/panel/PanelItemDragForBI.vue2.js +0 -5
- package/src/components/form-designer/setting-panel/panel/PanelItemDragForBI.vue2.js.map +0 -1
- package/src/components/form-designer/setting-panel/property-editor/dsEnabled-editor.vue.js +0 -5
- package/src/components/form-designer/setting-panel/property-editor/dsEnabled-editor.vue.js.map +0 -1
- package/src/components/form-designer/setting-panel/property-editor/dsEnabled-editor.vue2.js +0 -71
- package/src/components/form-designer/setting-panel/property-editor/dsEnabled-editor.vue2.js.map +0 -1
- package/src/components/form-designer/setting-panel/property-editor/echart-bar-editor.vue.js +0 -5
- package/src/components/form-designer/setting-panel/property-editor/echart-bar-editor.vue.js.map +0 -1
- package/src/components/form-designer/setting-panel/property-editor/echart-bar-editor.vue2.js +0 -81
- package/src/components/form-designer/setting-panel/property-editor/echart-bar-editor.vue2.js.map +0 -1
- package/src/components/form-render/SubmitButtonRender.vue.js +0 -92
- package/src/components/form-render/SubmitButtonRender.vue.js.map +0 -1
- package/src/components/form-render/SubmitButtonRender.vue2.js +0 -5
- package/src/components/form-render/SubmitButtonRender.vue2.js.map +0 -1
- package/src/constants/LayoutTypeEnum.js +0 -5
- package/src/constants/LayoutTypeEnum.js.map +0 -1
- package/src/hooks/useDesigner.js +0 -51
- package/src/hooks/useDesigner.js.map +0 -1
- /package/src/components/form-designer/{setting-panel/panel → widget-panel}/PanelItemDrag.vue2.js +0 -0
- /package/src/components/form-designer/{setting-panel/panel → widget-panel}/PanelItemDrag.vue2.js.map +0 -0
package/src/utils/util.js
CHANGED
|
@@ -7,7 +7,7 @@ function C(t) {
|
|
|
7
7
|
}
|
|
8
8
|
const F = function() {
|
|
9
9
|
return Math.floor(Math.random() * 1e5 + Math.random() * 2e4 + Math.random() * 5e3);
|
|
10
|
-
},
|
|
10
|
+
}, f = function(t) {
|
|
11
11
|
return d(t);
|
|
12
12
|
}, E = function(t, e) {
|
|
13
13
|
Object.keys(e).forEach((n) => {
|
|
@@ -15,14 +15,14 @@ const F = function() {
|
|
|
15
15
|
});
|
|
16
16
|
}, v = function(t, e = "") {
|
|
17
17
|
const n = document.getElementsByTagName("head")[0], o = document.createElement("style");
|
|
18
|
-
o.type = "text/css", o.rel = "stylesheet", o.id = e ? "vform-custom-css-" + e : "vform-custom-css"
|
|
18
|
+
o.type = "text/css", o.rel = "stylesheet", o.id = e ? "vform-custom-css-" + e : "vform-custom-css";
|
|
19
19
|
try {
|
|
20
20
|
o.appendChild(document.createTextNode(t));
|
|
21
21
|
} catch {
|
|
22
22
|
o.styleSheet.cssText = t;
|
|
23
23
|
}
|
|
24
24
|
n.appendChild(o);
|
|
25
|
-
},
|
|
25
|
+
}, L = function(t, e = "") {
|
|
26
26
|
const n = document.getElementsByTagName("body")[0], o = document.createElement("script");
|
|
27
27
|
o.id = e ? "v_form_global_functions-" + e : "v_form_global_functions", o.type = "text/javascript", o.innerHTML = t, n.appendChild(o);
|
|
28
28
|
};
|
|
@@ -31,8 +31,8 @@ function s(t, e, n = null, o = !1) {
|
|
|
31
31
|
r.formItemFlag || r.formItemFlag === !1 && o ? e(r, n) : r.type === "grid" ? r.cols.map((a) => {
|
|
32
32
|
s(a.widgetList, e, r, o);
|
|
33
33
|
}) : r.type === "table" ? r.rows.map((a) => {
|
|
34
|
-
a.cols.map((
|
|
35
|
-
s(
|
|
34
|
+
a.cols.map((c) => {
|
|
35
|
+
s(c.widgetList, e, r, o);
|
|
36
36
|
});
|
|
37
37
|
}) : r.type === "tab" ? r.tabs.map((a) => {
|
|
38
38
|
s(a.widgetList, e, r, o);
|
|
@@ -76,7 +76,7 @@ function p(t, e) {
|
|
|
76
76
|
l(n, e);
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function _(t, e = !1) {
|
|
80
80
|
if (!t)
|
|
81
81
|
return [];
|
|
82
82
|
const n = [];
|
|
@@ -88,7 +88,7 @@ function L(t, e = !1) {
|
|
|
88
88
|
});
|
|
89
89
|
}, null, e), n;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function x(t) {
|
|
92
92
|
if (!t)
|
|
93
93
|
return [];
|
|
94
94
|
const e = [];
|
|
@@ -100,7 +100,7 @@ function _(t) {
|
|
|
100
100
|
});
|
|
101
101
|
}), e;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function S(t, e) {
|
|
104
104
|
if (!t)
|
|
105
105
|
return null;
|
|
106
106
|
let n = null;
|
|
@@ -108,7 +108,7 @@ function x(t, e) {
|
|
|
108
108
|
r.options.name === e && (n = r);
|
|
109
109
|
}), n;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function T(t, e, n, o, r) {
|
|
112
112
|
const a = new u(e.target, {
|
|
113
113
|
text: () => t
|
|
114
114
|
});
|
|
@@ -118,7 +118,7 @@ function B(t, e, n, o, r) {
|
|
|
118
118
|
n.error(r), a.destroy();
|
|
119
119
|
}), a.onClick(e);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function k() {
|
|
122
122
|
const { formCode: t = "" } = m();
|
|
123
123
|
return {
|
|
124
124
|
labelWidth: 80,
|
|
@@ -128,11 +128,8 @@ function H() {
|
|
|
128
128
|
labelAlign: "right",
|
|
129
129
|
cssCode: "",
|
|
130
130
|
customClass: [],
|
|
131
|
-
okButtonLabel: "",
|
|
132
131
|
isEnterSubmit: 0,
|
|
133
|
-
|
|
134
|
-
cancelButtonHidden: "",
|
|
135
|
-
cancelButtonLabel: "",
|
|
132
|
+
buttonList: [],
|
|
136
133
|
functions: "",
|
|
137
134
|
//全局函数
|
|
138
135
|
layoutType: "PC",
|
|
@@ -147,12 +144,6 @@ function H() {
|
|
|
147
144
|
})
|
|
148
145
|
`,
|
|
149
146
|
onFormDataChange: "",
|
|
150
|
-
onOkButtonClick: `
|
|
151
|
-
this.getFormRef().onFormUpdate().then(()=>{
|
|
152
|
-
this.$message.success('保存成功!');
|
|
153
|
-
})
|
|
154
|
-
`,
|
|
155
|
-
onCancelButtonClick: "",
|
|
156
147
|
serveList: {
|
|
157
148
|
list: [],
|
|
158
149
|
vformUpdate: {
|
|
@@ -190,13 +181,13 @@ return {...data,data:d}`,
|
|
|
190
181
|
}
|
|
191
182
|
};
|
|
192
183
|
}
|
|
193
|
-
function
|
|
194
|
-
const e =
|
|
184
|
+
function H(t) {
|
|
185
|
+
const e = f(t);
|
|
195
186
|
return e.onFormCreated = "", e.onFormMounted = "", e.onFormDataChange = "", e;
|
|
196
187
|
}
|
|
197
|
-
function
|
|
188
|
+
function M(t, e, n, o) {
|
|
198
189
|
if (["cascader", "treeSelect", "select"].includes(e))
|
|
199
|
-
return
|
|
190
|
+
return f(t);
|
|
200
191
|
const r = [];
|
|
201
192
|
return t && t.length > 0 && t.forEach((a) => {
|
|
202
193
|
r.push({
|
|
@@ -205,27 +196,27 @@ function T(t, e, n, o) {
|
|
|
205
196
|
});
|
|
206
197
|
}), t;
|
|
207
198
|
}
|
|
208
|
-
function
|
|
199
|
+
function D(t, e) {
|
|
209
200
|
let n = null;
|
|
210
201
|
return e && t.dataSources && t.dataSources.forEach((o) => {
|
|
211
202
|
o.uniqueName === e && (n = o);
|
|
212
203
|
}), n;
|
|
213
204
|
}
|
|
214
205
|
export {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
206
|
+
H as cloneFormConfigWithoutEventHandler,
|
|
207
|
+
T as copyToClipboard,
|
|
208
|
+
f as deepClone,
|
|
218
209
|
F as generateId,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
210
|
+
x as getAllContainerWidgets,
|
|
211
|
+
_ as getAllFieldWidgets,
|
|
212
|
+
S as getContainerWidgetByName,
|
|
213
|
+
D as getDSByName,
|
|
214
|
+
k as getDefaultFormConfig,
|
|
224
215
|
v as insertCustomCssToHead,
|
|
225
|
-
|
|
216
|
+
L as insertGlobalFunctionsToHtml,
|
|
226
217
|
C as isNull,
|
|
227
218
|
E as overwriteObj,
|
|
228
|
-
|
|
219
|
+
M as translateOptionItems,
|
|
229
220
|
i as traverseContainerWidgets,
|
|
230
221
|
s as traverseFieldWidgets,
|
|
231
222
|
p as traverseFieldWidgetsOfContainer
|
package/src/utils/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../src/utils/util.js"],"sourcesContent":["import Clipboard from 'clipboard';\nimport { getLocat } from '@kp-ui/tool';\nimport { isArray, isEmpty, cloneDeep } from 'lodash-es';\nimport {\n containers,\n advancedFields,\n basicFields,\n customFields\n} from '@/components/form-designer/widget-panel/widgetsConfig';\nexport function isNull(value) {\n return value === null || value === undefined;\n}\n\nexport function isNotNull(value) {\n return value !== null && value !== undefined;\n}\n\nexport function isEmptyStr(str) {\n //return (str === undefined) || (!str) || (!/[^\\s]/.test(str));\n return str === undefined || (!str && str !== 0 && str !== '0') || !/[^\\s]/.test(str);\n}\n\nexport const generateId = function () {\n return Math.floor(Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000);\n};\n\nexport const deepClone = function (origin) {\n return cloneDeep(origin);\n};\n\nexport const overwriteObj = function (obj1, obj2) {\n /* 浅拷贝对象属性,obj2覆盖obj1 */\n // for (let prop in obj2) {\n // if (obj2.hasOwnProperty(prop)) {\n // obj1[prop] = obj2[prop]\n // }\n // }\n\n Object.keys(obj2).forEach(prop => {\n obj1[prop] = obj2[prop];\n });\n};\n\nconst getComTypeMap = type => {\n const allWidgets = [...containers, ...basicFields, ...advancedFields, ...customFields];\n const map = new Map();\n allWidgets.forEach(item => {\n const type = item.type.replace(/-/g, '').toLowerCase();\n map.set(type, item);\n });\n return map.get(type.replace(/-/g, '').toLowerCase());\n};\n\nexport const fmtArray = a => {\n a = a.map(item => {\n item = overwriteDeep(item);\n return item;\n });\n return a;\n};\n\nexport const overwriteDeep = (a, ops) => {\n if (isArray(a)) {\n const res = fmtArray(a);\n return res;\n }\n let b = ops;\n const type = a.type;\n\n if (a.options) {\n if (type) {\n b = getComTypeMap(type) || b;\n }\n }\n\n for (const k in b) {\n if (typeof b[k] === 'object' && b[k] !== null) {\n a[k] = isEmpty(a[k]) ? b[k] : overwriteDeep(a[k], b[k]);\n } else {\n a[k] = a[k] === void 0 ? b[k] : a[k];\n }\n }\n return a;\n};\n\nexport const insertCustomCssToHead = function (cssCode, formId = '') {\n const head = document.getElementsByTagName('head')[0];\n\n const newStyle = document.createElement('style');\n newStyle.type = 'text/css';\n newStyle.rel = 'stylesheet';\n newStyle.id = !!formId ? 'vform-custom-css' + '-' + formId : 'vform-custom-css';\n console.log(cssCode);\n\n try {\n newStyle.appendChild(document.createTextNode(cssCode));\n } catch (ex) {\n newStyle.styleSheet.cssText = cssCode;\n }\n\n head.appendChild(newStyle);\n};\n\nexport const insertGlobalFunctionsToHtml = function (functionsCode, formId = '') {\n const bodyEle = document.getElementsByTagName('body')[0];\n // let oldScriptEle = document.getElementById('v_form_global_functions');\n // !!oldScriptEle && bodyEle.removeChild(oldScriptEle); //先清除后插入!!\n // if (!!formId) {\n // oldScriptEle = document.getElementById('v_form_global_functions' + '-' + formId);\n // !!oldScriptEle && bodyEle.removeChild(oldScriptEle); //先清除后插入!!\n // }\n\n const newScriptEle = document.createElement('script');\n newScriptEle.id = !!formId\n ? 'v_form_global_functions' + '-' + formId\n : 'v_form_global_functions';\n newScriptEle.type = 'text/javascript';\n newScriptEle.innerHTML = functionsCode;\n bodyEle.appendChild(newScriptEle);\n};\n\nexport const optionExists = function (optionsObj, optionName) {\n if (!optionsObj) {\n return false;\n }\n\n return Object.keys(optionsObj).indexOf(optionName) > -1;\n};\n\nexport const loadRemoteScript = function (srcPath, callback) {\n /*加载远程js,加载成功后执行回调函数*/\n const sid = encodeURIComponent(srcPath);\n const oldScriptEle = document.getElementById(sid);\n\n if (!oldScriptEle) {\n let s = document.createElement('script');\n s.src = srcPath;\n s.id = sid;\n document.body.appendChild(s);\n\n s.onload = s.onreadystatechange = function (_, isAbort) {\n /* 借鉴自ace.js */\n if (\n isAbort ||\n !s.readyState ||\n s.readyState === 'loaded' ||\n s.readyState === 'complete'\n ) {\n s = s.onload = s.onreadystatechange = null;\n if (!isAbort) {\n callback();\n }\n }\n };\n }\n};\n\nexport function traverseFieldWidgets(\n widgetList,\n handler,\n parent = null,\n staticWidgetsIncluded = false\n) {\n if (!widgetList) {\n return;\n }\n\n widgetList.map(w => {\n if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {\n handler(w, parent);\n } else if (w.type === 'grid') {\n w.cols.map(col => {\n traverseFieldWidgets(col.widgetList, handler, w, staticWidgetsIncluded);\n });\n } else if (w.type === 'table') {\n w.rows.map(row => {\n row.cols.map(cell => {\n traverseFieldWidgets(cell.widgetList, handler, w, staticWidgetsIncluded);\n });\n });\n } else if (w.type === 'tab') {\n w.tabs.map(tab => {\n traverseFieldWidgets(tab.widgetList, handler, w, staticWidgetsIncluded);\n });\n } else if (w.type === 'sub-form' || w.type === 'grid-sub-form') {\n traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);\n } else if (w.category === 'container') {\n //自定义容器\n traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);\n }\n });\n}\n\nexport function traverseContainerWidgets(widgetList, handler) {\n if (!widgetList?.length) {\n return;\n }\n\n widgetList.map(w => {\n if (w.category === 'container') {\n handler(w);\n }\n\n if (w.type === 'grid') {\n w.cols.map(col => {\n traverseContainerWidgets(col.widgetList, handler);\n });\n } else if (w.type === 'table') {\n w.rows.map(row => {\n row.cols.map(cell => {\n traverseContainerWidgets(cell.widgetList, handler);\n });\n });\n } else if (w.type === 'tab') {\n w.tabs.map(tab => {\n traverseContainerWidgets(tab.widgetList, handler);\n });\n } else if (w.type === 'sub-form' || w.type === 'grid-sub-form') {\n traverseContainerWidgets(w.widgetList, handler);\n } else if (w.category === 'container') {\n //自定义容器\n traverseContainerWidgets(w.widgetList, handler);\n }\n });\n}\n\nexport function traverseAllWidgets(widgetList, handler) {\n if (!widgetList) {\n return;\n }\n\n widgetList.map(w => {\n handler(w);\n\n if (w.type === 'grid') {\n w.cols.map(col => {\n handler(col);\n traverseAllWidgets(col.widgetList, handler);\n });\n } else if (w.type === 'table') {\n w.rows.map(row => {\n row.cols.map(cell => {\n handler(cell);\n traverseAllWidgets(cell.widgetList, handler);\n });\n });\n } else if (w.type === 'tab') {\n w.tabs.map(tab => {\n traverseAllWidgets(tab.widgetList, handler);\n });\n } else if (w.type === 'sub-form' || w.type === 'grid-sub-form') {\n traverseAllWidgets(w.widgetList, handler);\n } else if (w.category === 'container') {\n //自定义容器\n traverseAllWidgets(w.widgetList, handler);\n }\n });\n}\n\nfunction handleWidgetForTraverse(widget, handler) {\n if (!!widget.category && widget.category === 'container') {\n traverseFieldWidgetsOfContainer(widget, handler);\n } else if (widget.formItemFlag) {\n handler(widget);\n }\n}\n\n/**\n * 遍历容器内的字段组件\n * @param con\n * @param handler\n */\nexport function traverseFieldWidgetsOfContainer(con, handler) {\n if (con.type === 'grid') {\n con.cols.forEach(col => {\n col.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n });\n } else if (con.type === 'table') {\n con.rows.forEach(row => {\n row.cols.forEach(cell => {\n cell.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n });\n });\n } else if (con.type === 'tab') {\n con.tabs.forEach(tab => {\n tab.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n });\n } else if (con.type === 'sub-form' || con.type === 'grid-sub-form') {\n con.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n } else if (con.category === 'container') {\n //自定义容器\n con.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n }\n}\n\nfunction handleContainerTraverse(widget, fieldHandler, containerHandler) {\n if (!!widget.category && widget.category === 'container') {\n traverseWidgetsOfContainer(widget, fieldHandler, containerHandler);\n } else if (widget.formItemFlag) {\n fieldHandler(widget);\n }\n}\n\n/**\n * 遍历容器内部的字段组件和容器组件\n * @param con\n * @param fieldHandler\n * @param containerHandler\n */\nexport function traverseWidgetsOfContainer(con, fieldHandler, containerHandler) {\n if (con.type === 'grid') {\n con.cols.forEach(col => {\n col.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n });\n } else if (con.type === 'table') {\n con.rows.forEach(row => {\n row.cols.forEach(cell => {\n cell.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n });\n });\n } else if (con.type === 'tab') {\n con.tabs.forEach(tab => {\n tab.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n });\n } else if (con.type === 'sub-form' || con.type === 'grid-sub-form') {\n con.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n } else if (con.category === 'container') {\n //自定义容器\n con.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n }\n}\n\n/**\n * 获取所有字段组件\n * @param widgetList\n * @param staticWidgetsIncluded 是否包含按钮等静态组件,默认不包含\n * @returns {[]}\n */\nexport function getAllFieldWidgets(widgetList, staticWidgetsIncluded = false) {\n if (!widgetList) {\n return [];\n }\n\n const result = [];\n const handlerFn = w => {\n result.push({\n type: w.type,\n name: w.options.name,\n field: w\n });\n };\n traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);\n\n return result;\n}\n\n/**\n * 获取所有容器组件\n * @param widgetList\n * @returns {[]}\n */\nexport function getAllContainerWidgets(widgetList) {\n if (!widgetList) {\n return [];\n }\n\n const result = [];\n const handlerFn = w => {\n result.push({\n type: w.type,\n name: w.options.name,\n container: w\n });\n };\n traverseContainerWidgets(widgetList, handlerFn);\n\n return result;\n}\n\nexport function getFieldWidgetByName(widgetList, fieldName, staticWidgetsIncluded) {\n if (!widgetList) {\n return null;\n }\n\n let foundWidget = null;\n const handlerFn = widget => {\n if (widget.options.name === fieldName) {\n foundWidget = widget;\n }\n };\n\n traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);\n return foundWidget;\n}\n\nexport function getContainerWidgetByName(widgetList, containerName) {\n if (!widgetList) {\n return null;\n }\n\n let foundContainer = null;\n const handlerFn = con => {\n if (con.options.name === containerName) {\n foundContainer = con;\n }\n };\n\n traverseContainerWidgets(widgetList, handlerFn);\n return foundContainer;\n}\n\nexport function getContainerWidgetById(widgetList, containerId) {\n if (!widgetList) {\n return null;\n }\n\n let foundContainer = null;\n const handlerFn = con => {\n if (con.id === containerId) {\n foundContainer = con;\n }\n };\n\n traverseContainerWidgets(widgetList, handlerFn);\n return foundContainer;\n}\n\nexport function copyToClipboard(content, clickEvent, $message, successMsg, errorMsg) {\n const clipboard = new Clipboard(clickEvent.target, {\n text: () => content\n });\n\n clipboard.on('success', () => {\n $message.success(successMsg);\n clipboard.destroy();\n });\n\n clipboard.on('error', () => {\n $message.error(errorMsg);\n clipboard.destroy();\n });\n\n clipboard.onClick(clickEvent);\n}\n\nexport function getQueryParam(variable) {\n const query = window.location.search.substring(1);\n const vars = query.split('&');\n for (let i = 0; i < vars.length; i++) {\n const pair = vars[i].split('=');\n if (pair[0] == variable) {\n return pair[1];\n }\n }\n\n return undefined;\n}\n\nexport function getDefaultFormConfig() {\n const { formCode = '' } = getLocat();\n\n return {\n labelWidth: 80,\n labelPosition: 'horizontal', //'left',\n size: '',\n labelAlign: 'right',\n cssCode: '',\n customClass: [],\n\n okButtonLabel: '',\n isEnterSubmit: 0,\n okButtonHidden: '',\n\n cancelButtonHidden: '',\n cancelButtonLabel: '',\n\n functions: '', //全局函数\n layoutType: 'PC',\n onFormCreated: '',\n onFormMounted: `\n if(!this.vfCtx) return\n if(!this.vfCtx._id) return\n const type = this.vfCtx.type\n this.setReadMode(type==='view')\n this.onFormDetail().then(res=>{\n this.setFormData({...res})\n })\n `,\n\n onFormDataChange: '',\n onOkButtonClick: `\n this.getFormRef().onFormUpdate().then(()=>{\n this.$message.success('保存成功!');\n })\n `,\n onCancelButtonClick: '',\n\n serveList: {\n list: [],\n vformUpdate: {\n http: {\n url: `/api/tmgc2-mgt/formDefinition/${formCode}/evaluate/formSubmit`,\n method: 'post',\n data: { _id: '${_id}' },\n params: {}\n },\n dataReqHandlerCode: `const d=data.data||{};\\n Object.keys(d).forEach(k=>{\\n if(d[k]==='null'){\\n d[k]=null\\n }\\n })\\nreturn {...data,data:d}`,\n dataHandlerCode: ''\n },\n vformDetail: {\n http: {\n url: `/api/tmgc2-mgt/formDefinition/${formCode}/evaluate/formLoad`,\n method: 'post',\n data: { _id: '${_id}' },\n params: {}\n },\n dataReqHandlerCode: `const d=data.data||{};\\n Object.keys(d).forEach(k=>{\\n if(d[k]==='null'){\\n d[k]=null\\n }\\n })\\nreturn {...data,data:d}`,\n dataHandlerCode: 'return data.data.object||{}'\n }\n }\n };\n}\n\nexport function buildDefaultFormJson() {\n return {\n widgetList: [],\n formConfig: deepClone(getDefaultFormConfig())\n };\n}\n\nexport function cloneFormConfigWithoutEventHandler(formConfig) {\n const newFC = deepClone(formConfig);\n newFC.onFormCreated = '';\n newFC.onFormMounted = '';\n newFC.onFormDataChange = '';\n\n return newFC;\n}\n\n/**\n * 转译选择项数据\n * @param rawData\n * @param widgetType\n * @param labelKey\n * @param valueKey\n * @returns {[]}\n */\nexport function translateOptionItems(rawData, widgetType, labelKey, valueKey) {\n if (['cascader', 'treeSelect', 'select'].includes(widgetType)) {\n // 级联选择不转译\n return deepClone(rawData);\n }\n\n const result = [];\n if (!!rawData && rawData.length > 0) {\n rawData.forEach(ri => {\n result.push({\n label: ri[labelKey],\n value: ri[valueKey]\n });\n });\n }\n\n return rawData; //result;\n}\n\nexport function getDSByName(formConfig, dsName) {\n let resultDS = null;\n if (!!dsName && !!formConfig.dataSources) {\n formConfig.dataSources.forEach(ds => {\n if (ds.uniqueName === dsName) {\n resultDS = ds;\n }\n });\n }\n\n return resultDS;\n}\n"],"names":["isNull","value","generateId","deepClone","origin","cloneDeep","overwriteObj","obj1","obj2","prop","insertCustomCssToHead","cssCode","formId","head","newStyle","insertGlobalFunctionsToHtml","functionsCode","bodyEle","newScriptEle","traverseFieldWidgets","widgetList","handler","parent","staticWidgetsIncluded","w","col","row","cell","tab","traverseContainerWidgets","handleWidgetForTraverse","widget","traverseFieldWidgetsOfContainer","con","cw","getAllFieldWidgets","result","getAllContainerWidgets","getContainerWidgetByName","containerName","foundContainer","copyToClipboard","content","clickEvent","$message","successMsg","errorMsg","clipboard","Clipboard","getDefaultFormConfig","formCode","getLocat","cloneFormConfigWithoutEventHandler","formConfig","newFC","translateOptionItems","rawData","widgetType","labelKey","valueKey","ri","getDSByName","dsName","resultDS","ds"],"mappings":";;;;AASO,SAASA,EAAOC,GAAO;AAC1B,SAAOA,KAAU;AACrB;AAWY,MAACC,IAAa,WAAY;AAClC,SAAO,KAAK,MAAM,KAAK,OAAM,IAAK,MAAS,KAAK,OAAM,IAAK,MAAQ,KAAK,OAAM,IAAK,GAAI;AAC3F,GAEaC,IAAY,SAAUC,GAAQ;AACvC,SAAOC,EAAUD,CAAM;AAC3B,GAEaE,IAAe,SAAUC,GAAMC,GAAM;AAQ9C,SAAO,KAAKA,CAAI,EAAE,QAAQ,CAAAC,MAAQ;AAC9B,IAAAF,EAAKE,CAAI,IAAID,EAAKC,CAAI;AAAA,EAC1B,CAAC;AACL,GA4CaC,IAAwB,SAAUC,GAASC,IAAS,IAAI;AACjE,QAAMC,IAAO,SAAS,qBAAqB,MAAM,EAAE,CAAC,GAE9CC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A,QACgB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QACpB,iBAAiB;AAAA,MACjC;AAAA,MACY,aAAa;AAAA,QACT,MAAM;AAAA,UACF,KAAK,iCAAiCA,CAAQ;AAAA,UAC9C,QAAQ;AAAA,UACR,MAAM,EAAE,KAAK,SAAQ;AAAA,UACrB,QAAQ,CAAA;AAAA,QAC5B;AAAA,QACgB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QACpB,iBAAiB;AAAA,MACjC;AAAA,IACA;AAAA,EACA;AACA;AASO,SAASE,EAAmCC,GAAY;AAC3D,QAAMC,IAAQnD,EAAUkD,CAAU;AAClC,SAAAC,EAAM,gBAAgB,IACtBA,EAAM,gBAAgB,IACtBA,EAAM,mBAAmB,IAElBA;AACX;AAUO,SAASC,EAAqBC,GAASC,GAAYC,GAAUC,GAAU;AAC1E,MAAI,CAAC,YAAY,cAAc,QAAQ,EAAE,SAASF,CAAU;AAExD,WAAOtD,EAAUqD,CAAO;AAG5B,QAAMpB,IAAS,CAAA;AACf,SAAMoB,KAAWA,EAAQ,SAAS,KAC9BA,EAAQ,QAAQ,CAAAI,MAAM;AAClB,IAAAxB,EAAO,KAAK;AAAA,MACR,OAAOwB,EAAGF,CAAQ;AAAA,MAClB,OAAOE,EAAGD,CAAQ;AAAA,IAClC,CAAa;AAAA,EACL,CAAC,GAGEH;AACX;AAEO,SAASK,EAAYR,GAAYS,GAAQ;AAC5C,MAAIC,IAAW;AACf,SAAMD,KAAYT,EAAW,eACzBA,EAAW,YAAY,QAAQ,CAAAW,MAAM;AACjC,IAAIA,EAAG,eAAeF,MAClBC,IAAWC;AAAA,EAEnB,CAAC,GAGED;AACX;"}
|
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../src/utils/util.js"],"sourcesContent":["import Clipboard from 'clipboard';\nimport { getLocat } from '@kp-ui/tool';\nimport { isArray, isEmpty, cloneDeep } from 'lodash-es';\nimport {\n containers,\n advancedFields,\n basicFields,\n customFields\n} from '@/components/form-designer/widget-panel/widgetsConfig';\nexport function isNull(value) {\n return value === null || value === undefined;\n}\n\nexport function isNotNull(value) {\n return value !== null && value !== undefined;\n}\n\nexport function isEmptyStr(str) {\n //return (str === undefined) || (!str) || (!/[^\\s]/.test(str));\n return str === undefined || (!str && str !== 0 && str !== '0') || !/[^\\s]/.test(str);\n}\n\nexport const generateId = function () {\n return Math.floor(Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000);\n};\n\nexport const deepClone = function (origin) {\n return cloneDeep(origin);\n};\n\nexport const overwriteObj = function (obj1, obj2) {\n /* 浅拷贝对象属性,obj2覆盖obj1 */\n // for (let prop in obj2) {\n // if (obj2.hasOwnProperty(prop)) {\n // obj1[prop] = obj2[prop]\n // }\n // }\n\n Object.keys(obj2).forEach(prop => {\n obj1[prop] = obj2[prop];\n });\n};\n\nconst getComTypeMap = type => {\n const allWidgets = [...containers, ...basicFields, ...advancedFields, ...customFields];\n const map = new Map();\n allWidgets.forEach(item => {\n const type = item.type.replace(/-/g, '').toLowerCase();\n map.set(type, item);\n });\n return map.get(type.replace(/-/g, '').toLowerCase());\n};\n\nexport const fmtArray = a => {\n a = a.map(item => {\n item = overwriteDeep(item);\n return item;\n });\n return a;\n};\n\nexport const overwriteDeep = (a, ops) => {\n if (isArray(a)) {\n const res = fmtArray(a);\n return res;\n }\n let b = ops;\n const type = a.type;\n\n if (a.options) {\n if (type) {\n b = getComTypeMap(type) || b;\n }\n }\n\n for (const k in b) {\n if (typeof b[k] === 'object' && b[k] !== null) {\n a[k] = isEmpty(a[k]) ? b[k] : overwriteDeep(a[k], b[k]);\n } else {\n a[k] = a[k] === void 0 ? b[k] : a[k];\n }\n }\n return a;\n};\n\nexport const insertCustomCssToHead = function (cssCode, formId = '') {\n const head = document.getElementsByTagName('head')[0];\n\n const newStyle = document.createElement('style');\n newStyle.type = 'text/css';\n newStyle.rel = 'stylesheet';\n newStyle.id = !!formId ? 'vform-custom-css' + '-' + formId : 'vform-custom-css';\n try {\n newStyle.appendChild(document.createTextNode(cssCode));\n } catch (ex) {\n newStyle.styleSheet.cssText = cssCode;\n }\n\n head.appendChild(newStyle);\n};\n\nexport const insertGlobalFunctionsToHtml = function (functionsCode, formId = '') {\n const bodyEle = document.getElementsByTagName('body')[0];\n // let oldScriptEle = document.getElementById('v_form_global_functions');\n // !!oldScriptEle && bodyEle.removeChild(oldScriptEle); //先清除后插入!!\n // if (!!formId) {\n // oldScriptEle = document.getElementById('v_form_global_functions' + '-' + formId);\n // !!oldScriptEle && bodyEle.removeChild(oldScriptEle); //先清除后插入!!\n // }\n\n const newScriptEle = document.createElement('script');\n newScriptEle.id = !!formId\n ? 'v_form_global_functions' + '-' + formId\n : 'v_form_global_functions';\n newScriptEle.type = 'text/javascript';\n newScriptEle.innerHTML = functionsCode;\n bodyEle.appendChild(newScriptEle);\n};\n\nexport const optionExists = function (optionsObj, optionName) {\n if (!optionsObj) {\n return false;\n }\n\n return Object.keys(optionsObj).indexOf(optionName) > -1;\n};\n\nexport const loadRemoteScript = function (srcPath, callback) {\n /*加载远程js,加载成功后执行回调函数*/\n const sid = encodeURIComponent(srcPath);\n const oldScriptEle = document.getElementById(sid);\n\n if (!oldScriptEle) {\n let s = document.createElement('script');\n s.src = srcPath;\n s.id = sid;\n document.body.appendChild(s);\n\n s.onload = s.onreadystatechange = function (_, isAbort) {\n /* 借鉴自ace.js */\n if (\n isAbort ||\n !s.readyState ||\n s.readyState === 'loaded' ||\n s.readyState === 'complete'\n ) {\n s = s.onload = s.onreadystatechange = null;\n if (!isAbort) {\n callback();\n }\n }\n };\n }\n};\n\nexport function traverseFieldWidgets(\n widgetList,\n handler,\n parent = null,\n staticWidgetsIncluded = false\n) {\n if (!widgetList) {\n return;\n }\n\n widgetList.map(w => {\n if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {\n handler(w, parent);\n } else if (w.type === 'grid') {\n w.cols.map(col => {\n traverseFieldWidgets(col.widgetList, handler, w, staticWidgetsIncluded);\n });\n } else if (w.type === 'table') {\n w.rows.map(row => {\n row.cols.map(cell => {\n traverseFieldWidgets(cell.widgetList, handler, w, staticWidgetsIncluded);\n });\n });\n } else if (w.type === 'tab') {\n w.tabs.map(tab => {\n traverseFieldWidgets(tab.widgetList, handler, w, staticWidgetsIncluded);\n });\n } else if (w.type === 'sub-form' || w.type === 'grid-sub-form') {\n traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);\n } else if (w.category === 'container') {\n //自定义容器\n traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);\n }\n });\n}\n\nexport function traverseContainerWidgets(widgetList, handler) {\n if (!widgetList?.length) {\n return;\n }\n\n widgetList.map(w => {\n if (w.category === 'container') {\n handler(w);\n }\n\n if (w.type === 'grid') {\n w.cols.map(col => {\n traverseContainerWidgets(col.widgetList, handler);\n });\n } else if (w.type === 'table') {\n w.rows.map(row => {\n row.cols.map(cell => {\n traverseContainerWidgets(cell.widgetList, handler);\n });\n });\n } else if (w.type === 'tab') {\n w.tabs.map(tab => {\n traverseContainerWidgets(tab.widgetList, handler);\n });\n } else if (w.type === 'sub-form' || w.type === 'grid-sub-form') {\n traverseContainerWidgets(w.widgetList, handler);\n } else if (w.category === 'container') {\n //自定义容器\n traverseContainerWidgets(w.widgetList, handler);\n }\n });\n}\n\nexport function traverseAllWidgets(widgetList, handler) {\n if (!widgetList) {\n return;\n }\n\n widgetList.map(w => {\n handler(w);\n\n if (w.type === 'grid') {\n w.cols.map(col => {\n handler(col);\n traverseAllWidgets(col.widgetList, handler);\n });\n } else if (w.type === 'table') {\n w.rows.map(row => {\n row.cols.map(cell => {\n handler(cell);\n traverseAllWidgets(cell.widgetList, handler);\n });\n });\n } else if (w.type === 'tab') {\n w.tabs.map(tab => {\n traverseAllWidgets(tab.widgetList, handler);\n });\n } else if (w.type === 'sub-form' || w.type === 'grid-sub-form') {\n traverseAllWidgets(w.widgetList, handler);\n } else if (w.category === 'container') {\n //自定义容器\n traverseAllWidgets(w.widgetList, handler);\n }\n });\n}\n\nfunction handleWidgetForTraverse(widget, handler) {\n if (!!widget.category && widget.category === 'container') {\n traverseFieldWidgetsOfContainer(widget, handler);\n } else if (widget.formItemFlag) {\n handler(widget);\n }\n}\n\n/**\n * 遍历容器内的字段组件\n * @param con\n * @param handler\n */\nexport function traverseFieldWidgetsOfContainer(con, handler) {\n if (con.type === 'grid') {\n con.cols.forEach(col => {\n col.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n });\n } else if (con.type === 'table') {\n con.rows.forEach(row => {\n row.cols.forEach(cell => {\n cell.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n });\n });\n } else if (con.type === 'tab') {\n con.tabs.forEach(tab => {\n tab.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n });\n } else if (con.type === 'sub-form' || con.type === 'grid-sub-form') {\n con.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n } else if (con.category === 'container') {\n //自定义容器\n con.widgetList.forEach(cw => {\n handleWidgetForTraverse(cw, handler);\n });\n }\n}\n\nfunction handleContainerTraverse(widget, fieldHandler, containerHandler) {\n if (!!widget.category && widget.category === 'container') {\n traverseWidgetsOfContainer(widget, fieldHandler, containerHandler);\n } else if (widget.formItemFlag) {\n fieldHandler(widget);\n }\n}\n\n/**\n * 遍历容器内部的字段组件和容器组件\n * @param con\n * @param fieldHandler\n * @param containerHandler\n */\nexport function traverseWidgetsOfContainer(con, fieldHandler, containerHandler) {\n if (con.type === 'grid') {\n con.cols.forEach(col => {\n col.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n });\n } else if (con.type === 'table') {\n con.rows.forEach(row => {\n row.cols.forEach(cell => {\n cell.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n });\n });\n } else if (con.type === 'tab') {\n con.tabs.forEach(tab => {\n tab.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n });\n } else if (con.type === 'sub-form' || con.type === 'grid-sub-form') {\n con.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n } else if (con.category === 'container') {\n //自定义容器\n con.widgetList.forEach(cw => {\n handleContainerTraverse(cw, fieldHandler, containerHandler);\n });\n }\n}\n\n/**\n * 获取所有字段组件\n * @param widgetList\n * @param staticWidgetsIncluded 是否包含按钮等静态组件,默认不包含\n * @returns {[]}\n */\nexport function getAllFieldWidgets(widgetList, staticWidgetsIncluded = false) {\n if (!widgetList) {\n return [];\n }\n\n const result = [];\n const handlerFn = w => {\n result.push({\n type: w.type,\n name: w.options.name,\n field: w\n });\n };\n traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);\n\n return result;\n}\n\n/**\n * 获取所有容器组件\n * @param widgetList\n * @returns {[]}\n */\nexport function getAllContainerWidgets(widgetList) {\n if (!widgetList) {\n return [];\n }\n\n const result = [];\n const handlerFn = w => {\n result.push({\n type: w.type,\n name: w.options.name,\n container: w\n });\n };\n traverseContainerWidgets(widgetList, handlerFn);\n\n return result;\n}\n\nexport function getFieldWidgetByName(widgetList, fieldName, staticWidgetsIncluded) {\n if (!widgetList) {\n return null;\n }\n\n let foundWidget = null;\n const handlerFn = widget => {\n if (widget.options.name === fieldName) {\n foundWidget = widget;\n }\n };\n\n traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);\n return foundWidget;\n}\n\nexport function getContainerWidgetByName(widgetList, containerName) {\n if (!widgetList) {\n return null;\n }\n\n let foundContainer = null;\n const handlerFn = con => {\n if (con.options.name === containerName) {\n foundContainer = con;\n }\n };\n\n traverseContainerWidgets(widgetList, handlerFn);\n return foundContainer;\n}\n\nexport function getContainerWidgetById(widgetList, containerId) {\n if (!widgetList) {\n return null;\n }\n\n let foundContainer = null;\n const handlerFn = con => {\n if (con.id === containerId) {\n foundContainer = con;\n }\n };\n\n traverseContainerWidgets(widgetList, handlerFn);\n return foundContainer;\n}\n\nexport function copyToClipboard(content, clickEvent, $message, successMsg, errorMsg) {\n const clipboard = new Clipboard(clickEvent.target, {\n text: () => content\n });\n\n clipboard.on('success', () => {\n $message.success(successMsg);\n clipboard.destroy();\n });\n\n clipboard.on('error', () => {\n $message.error(errorMsg);\n clipboard.destroy();\n });\n\n clipboard.onClick(clickEvent);\n}\n\nexport function getQueryParam(variable) {\n const query = window.location.search.substring(1);\n const vars = query.split('&');\n for (let i = 0; i < vars.length; i++) {\n const pair = vars[i].split('=');\n if (pair[0] == variable) {\n return pair[1];\n }\n }\n\n return undefined;\n}\n\nexport function getDefaultFormConfig() {\n const { formCode = '' } = getLocat();\n\n return {\n labelWidth: 80,\n labelPosition: 'horizontal', //'left',\n size: '',\n labelAlign: 'right',\n cssCode: '',\n customClass: [],\n\n isEnterSubmit: 0,\n\n buttonList: [],\n\n functions: '', //全局函数\n layoutType: 'PC',\n onFormCreated: '',\n onFormMounted: `\n if(!this.vfCtx) return\n if(!this.vfCtx._id) return\n const type = this.vfCtx.type\n this.setReadMode(type==='view')\n this.onFormDetail().then(res=>{\n this.setFormData({...res})\n })\n `,\n\n onFormDataChange: '',\n\n serveList: {\n list: [],\n vformUpdate: {\n http: {\n url: `/api/tmgc2-mgt/formDefinition/${formCode}/evaluate/formSubmit`,\n method: 'post',\n data: { _id: '${_id}' },\n params: {}\n },\n dataReqHandlerCode: `const d=data.data||{};\\n Object.keys(d).forEach(k=>{\\n if(d[k]==='null'){\\n d[k]=null\\n }\\n })\\nreturn {...data,data:d}`,\n dataHandlerCode: ''\n },\n vformDetail: {\n http: {\n url: `/api/tmgc2-mgt/formDefinition/${formCode}/evaluate/formLoad`,\n method: 'post',\n data: { _id: '${_id}' },\n params: {}\n },\n dataReqHandlerCode: `const d=data.data||{};\\n Object.keys(d).forEach(k=>{\\n if(d[k]==='null'){\\n d[k]=null\\n }\\n })\\nreturn {...data,data:d}`,\n dataHandlerCode: 'return data.data.object||{}'\n }\n }\n };\n}\n\nexport function buildDefaultFormJson() {\n return {\n widgetList: [],\n formConfig: deepClone(getDefaultFormConfig())\n };\n}\n\nexport function cloneFormConfigWithoutEventHandler(formConfig) {\n const newFC = deepClone(formConfig);\n newFC.onFormCreated = '';\n newFC.onFormMounted = '';\n newFC.onFormDataChange = '';\n\n return newFC;\n}\n\n/**\n * 转译选择项数据\n * @param rawData\n * @param widgetType\n * @param labelKey\n * @param valueKey\n * @returns {[]}\n */\nexport function translateOptionItems(rawData, widgetType, labelKey, valueKey) {\n if (['cascader', 'treeSelect', 'select'].includes(widgetType)) {\n // 级联选择不转译\n return deepClone(rawData);\n }\n\n const result = [];\n if (!!rawData && rawData.length > 0) {\n rawData.forEach(ri => {\n result.push({\n label: ri[labelKey],\n value: ri[valueKey]\n });\n });\n }\n\n return rawData; //result;\n}\n\n/**\n * 组装axios请求配置参数\n * @param arrayObj\n * @param DSV\n * @param VFR\n * @returns {{}}\n */\nexport function assembleAxiosConfig(arrayObj, DSV, VFR) {\n const result = {};\n if (!arrayObj || arrayObj.length <= 0) {\n return result;\n }\n\n arrayObj.map(ai => {\n if (ai.type === 'String') {\n result[ai.name] = String(ai.value);\n } else if (ai.type === 'Number') {\n result[ai.name] = Number(ai.value);\n } else if (ai.type === 'Boolean') {\n if (ai.value.toLowerCase() === 'false' || ai.value === '0') {\n result[ai.name] = false;\n } else if (ai.value.toLowerCase() === 'true' || ai.value === '1') {\n result[ai.name] = true;\n } else {\n result[ai.name] = null;\n }\n } else if (ai.type === 'Variable') {\n result[ai.name] = eval(ai.value);\n }\n });\n\n /* 加入如下两行日志打印代码,是为了防止编译打包时DSV、VFR参数被剔除!! begin */\n /* DSV、VFR入参没有在本函数中直接使用到,但在eval表达式中可能被使用到,故需确保DSV、VFR参数始终存在!! */\n console.log('test DSV: ', DSV);\n console.log('test VFR: ', VFR);\n /* 加入如下两行日志打印代码,是为了防止编译打包时DSV、VFR入参会被剔除!! end */\n\n return result;\n}\n\nfunction buildRequestConfig(dataSource, DSV, VFR, isSandbox) {\n const config = {};\n if (dataSource.requestURLType === 'String') {\n config.url = dataSource.requestURL;\n } else {\n config.url = eval(dataSource.requestURL);\n }\n config.method = dataSource.requestMethod;\n\n config.headers = assembleAxiosConfig(dataSource.headers, DSV, VFR);\n config.params = assembleAxiosConfig(dataSource.params, DSV, VFR);\n config.data = assembleAxiosConfig(dataSource.data, DSV, VFR);\n\n const chFn = new Function('config', 'isSandbox', 'DSV', 'VFR', dataSource.configHandlerCode);\n return chFn.call(null, config, isSandbox, DSV, VFR);\n}\n\nexport function getDSByName(formConfig, dsName) {\n let resultDS = null;\n if (!!dsName && !!formConfig.dataSources) {\n formConfig.dataSources.forEach(ds => {\n if (ds.uniqueName === dsName) {\n resultDS = ds;\n }\n });\n }\n\n return resultDS;\n}\n"],"names":["isNull","value","generateId","deepClone","origin","cloneDeep","overwriteObj","obj1","obj2","prop","insertCustomCssToHead","cssCode","formId","head","newStyle","insertGlobalFunctionsToHtml","functionsCode","bodyEle","newScriptEle","traverseFieldWidgets","widgetList","handler","parent","staticWidgetsIncluded","w","col","row","cell","tab","traverseContainerWidgets","handleWidgetForTraverse","widget","traverseFieldWidgetsOfContainer","con","cw","getAllFieldWidgets","result","getAllContainerWidgets","getContainerWidgetByName","containerName","foundContainer","copyToClipboard","content","clickEvent","$message","successMsg","errorMsg","clipboard","Clipboard","getDefaultFormConfig","formCode","getLocat","cloneFormConfigWithoutEventHandler","formConfig","newFC","translateOptionItems","rawData","widgetType","labelKey","valueKey","ri","getDSByName","dsName","resultDS","ds"],"mappings":";;;;AASO,SAASA,EAAOC,GAAO;AAC1B,SAAOA,KAAU;AACrB;AAWY,MAACC,IAAa,WAAY;AAClC,SAAO,KAAK,MAAM,KAAK,OAAM,IAAK,MAAS,KAAK,OAAM,IAAK,MAAQ,KAAK,OAAM,IAAK,GAAI;AAC3F,GAEaC,IAAY,SAAUC,GAAQ;AACvC,SAAOC,EAAUD,CAAM;AAC3B,GAEaE,IAAe,SAAUC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