@kp-ui/lowcode 1.0.102 → 1.0.103
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/package.json +1 -1
- package/src/components/form-designer/index.vue.js +83 -90
- package/src/components/form-designer/index.vue.js.map +1 -1
- package/src/components/form-render/dynamic-dialog.vue.js.map +1 -1
- package/src/components/form-render/index.vue.js +106 -113
- package/src/components/form-render/index.vue.js.map +1 -1
- package/src/components/public/CustomerModal/CustomerModal.vue2.js +31 -28
- package/src/components/public/CustomerModal/CustomerModal.vue2.js.map +1 -1
- package/src/components/public/CustomerModal/useCustomerModal.js +15 -18
- package/src/components/public/CustomerModal/useCustomerModal.js.map +1 -1
- package/stats.html +1 -1
- package/styles/style.css +1 -1
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { resolveComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import Y
|
|
7
|
-
import I from "./dynamic-dialog.vue.js";
|
|
1
|
+
import { resolveComponent as D, createBlock as p, openBlock as m, withCtx as c, createElementVNode as x, normalizeStyle as A, createVNode as k, withKeys as _, normalizeClass as B, createElementBlock as y, Fragment as R, renderList as b, resolveDynamicComponent as S, createSlots as L, renderSlot as W, mergeProps as v, render as O, h as J } from "vue";
|
|
2
|
+
import $ from "../../utils/emitter.js";
|
|
3
|
+
import H from "../form-designer/form-widget/field-widget/index.js";
|
|
4
|
+
import { buildDefaultFormJson as P, getContainerWidgetByName as F, cloneFormConfigWithoutEventHandler as w, deepClone as f, getDSByName as M, overwriteObj as g, runDataSourceRequest as E, getAllContainerWidgets as T, getAllFieldWidgets as z, getDefaultFormConfig as N, traverseFieldWidgets as G, getFieldWidgetByName as j, traverseFieldWidgetsOfContainer as K, insertCustomCssToHead as q, insertGlobalFunctionsToHtml as U, generateId as C } from "../../utils/util.js";
|
|
5
|
+
import Q, { changeLocale as X } from "../../utils/i18n.js";
|
|
6
|
+
import Y from "./dynamic-dialog.vue.js";
|
|
8
7
|
/* empty css */
|
|
9
|
-
import
|
|
10
|
-
import { fmtHttpParams as
|
|
8
|
+
import Z from "./dynamic-drawer.vue.js";
|
|
9
|
+
import { fmtHttpParams as V } from "../../utils/request/fmtHttpParams.js";
|
|
11
10
|
/* empty css */
|
|
12
|
-
import
|
|
13
|
-
const
|
|
11
|
+
import I from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
12
|
+
const tt = {
|
|
14
13
|
name: "VFormRender",
|
|
15
14
|
componentName: "VFormRender",
|
|
16
|
-
mixins: [
|
|
15
|
+
mixins: [$, Q],
|
|
17
16
|
components: {
|
|
18
|
-
|
|
19
|
-
...$
|
|
17
|
+
...H
|
|
20
18
|
},
|
|
21
19
|
props: {
|
|
22
20
|
vfCtx: {
|
|
@@ -26,7 +24,7 @@ const it = {
|
|
|
26
24
|
formJson: {
|
|
27
25
|
//prop传入的表单JSON配置
|
|
28
26
|
type: Object,
|
|
29
|
-
default: () =>
|
|
27
|
+
default: () => P()
|
|
30
28
|
},
|
|
31
29
|
formData: {
|
|
32
30
|
//prop传入的表单数据
|
|
@@ -191,7 +189,7 @@ const it = {
|
|
|
191
189
|
var e;
|
|
192
190
|
const t = this.formConfig.serveList;
|
|
193
191
|
if ((e = t.vformDetail.http) != null && e.url) {
|
|
194
|
-
const i = await
|
|
192
|
+
const i = await V.call(this, t.vformDetail, {
|
|
195
193
|
vfCtx: this.vfCtx
|
|
196
194
|
});
|
|
197
195
|
return console.log("res: ", i), i;
|
|
@@ -201,7 +199,7 @@ const it = {
|
|
|
201
199
|
var i;
|
|
202
200
|
const t = await this.getFormData(), e = this.formConfig.serveList;
|
|
203
201
|
if ((i = e.vformDetail.http) != null && i.url) {
|
|
204
|
-
const o = await
|
|
202
|
+
const o = await V.call(this, e.vformUpdate, {
|
|
205
203
|
data: t,
|
|
206
204
|
vfCtx: this.vfCtx
|
|
207
205
|
});
|
|
@@ -209,7 +207,7 @@ const it = {
|
|
|
209
207
|
}
|
|
210
208
|
},
|
|
211
209
|
initFormObject(t = !0) {
|
|
212
|
-
this.formId = "vfRender" +
|
|
210
|
+
this.formId = "vfRender" + C(), t && !this.dynamicCreation && this.insertCustomStyleAndScriptNode(), this.addFieldChangeEventHandler(), this.addFieldValidateEventHandler(), this.registerFormToRefList(), this.handleOnCreated(), this.disabledMode && this.$nextTick(() => {
|
|
213
211
|
this.disableForm();
|
|
214
212
|
});
|
|
215
213
|
},
|
|
@@ -224,10 +222,10 @@ const it = {
|
|
|
224
222
|
this.changeLanguage(t);
|
|
225
223
|
},
|
|
226
224
|
insertCustomStyleAndScriptNode() {
|
|
227
|
-
this.formConfig && this.formConfig.cssCode &&
|
|
225
|
+
this.formConfig && this.formConfig.cssCode && q(
|
|
228
226
|
this.formConfig.cssCode,
|
|
229
227
|
this.previewState ? "" : this.formId
|
|
230
|
-
), this.formConfig && this.formConfig.functions &&
|
|
228
|
+
), this.formConfig && this.formConfig.functions && U(
|
|
231
229
|
this.formConfig.functions,
|
|
232
230
|
this.previewState ? "" : this.formId
|
|
233
231
|
);
|
|
@@ -241,7 +239,7 @@ const it = {
|
|
|
241
239
|
if (t.category === "container") {
|
|
242
240
|
if (t.type === "data-table") {
|
|
243
241
|
const { name: e } = t.options;
|
|
244
|
-
this.formDataModel[e] =
|
|
242
|
+
this.formDataModel[e] = f(t.options.dataSource);
|
|
245
243
|
return;
|
|
246
244
|
}
|
|
247
245
|
if (!(t.type === "vf-dialog" || t.type === "vf-drawer")) if (t.type === "grid")
|
|
@@ -264,7 +262,7 @@ const it = {
|
|
|
264
262
|
const e = t.options.name;
|
|
265
263
|
if (this.formData.hasOwnProperty(e)) {
|
|
266
264
|
const i = this.formData[e];
|
|
267
|
-
this.formDataModel[e] =
|
|
265
|
+
this.formDataModel[e] = f(i);
|
|
268
266
|
} else {
|
|
269
267
|
const i = {};
|
|
270
268
|
t.options.showBlankRow ? (t.widgetList.forEach((o) => {
|
|
@@ -275,10 +273,10 @@ const it = {
|
|
|
275
273
|
const e = t.options.name;
|
|
276
274
|
if (this.formData.hasOwnProperty(e)) {
|
|
277
275
|
const i = this.formData[e];
|
|
278
|
-
this.formDataModel[e] =
|
|
276
|
+
this.formDataModel[e] = f(i);
|
|
279
277
|
} else {
|
|
280
278
|
const i = [];
|
|
281
|
-
|
|
279
|
+
K(t, (r) => {
|
|
282
280
|
i.push(r);
|
|
283
281
|
});
|
|
284
282
|
const s = {};
|
|
@@ -296,7 +294,7 @@ const it = {
|
|
|
296
294
|
this.formDataModel[t.options.name] = t.options.defaultValue;
|
|
297
295
|
else {
|
|
298
296
|
const e = this.formData[t.options.name];
|
|
299
|
-
this.formDataModel[t.options.name] =
|
|
297
|
+
this.formDataModel[t.options.name] = f(e);
|
|
300
298
|
}
|
|
301
299
|
},
|
|
302
300
|
addFieldChangeEventHandler() {
|
|
@@ -362,7 +360,7 @@ const it = {
|
|
|
362
360
|
i && i.setDisabled ? i.setDisabled(e) : this.findWidgetOfSubFormAndSetDisabled(t, e);
|
|
363
361
|
},
|
|
364
362
|
findWidgetOfSubFormAndSetDisabled(t, e) {
|
|
365
|
-
const i =
|
|
363
|
+
const i = j(
|
|
366
364
|
this.formJsonObj.widgetList,
|
|
367
365
|
t,
|
|
368
366
|
!0
|
|
@@ -377,7 +375,7 @@ const it = {
|
|
|
377
375
|
i && i.setDisabled ? i.setHidden(e) : this.findWidgetOfSubFormAndSetHidden(t, e);
|
|
378
376
|
},
|
|
379
377
|
findWidgetOfSubFormAndSetHidden(t, e) {
|
|
380
|
-
const i =
|
|
378
|
+
const i = j(
|
|
381
379
|
this.formJsonObj.widgetList,
|
|
382
380
|
t,
|
|
383
381
|
!0
|
|
@@ -393,7 +391,7 @@ const it = {
|
|
|
393
391
|
const o = (s, r) => {
|
|
394
392
|
s.options && s.options.name === t && (i = r.options.name);
|
|
395
393
|
};
|
|
396
|
-
if (
|
|
394
|
+
if (G(this.widgetList, o), i) {
|
|
397
395
|
const s = this.getWidgetRef(i);
|
|
398
396
|
if (s) {
|
|
399
397
|
const r = s.getRowIdData();
|
|
@@ -409,13 +407,13 @@ const it = {
|
|
|
409
407
|
this.getFieldWidgets().forEach((e) => {
|
|
410
408
|
e.field.options.dsEnabled && e.field.options.dsName && e.field.options.dataSetName && t.add(e.field.options.dsName);
|
|
411
409
|
}), t.size > 0 && t.forEach(async (e) => {
|
|
412
|
-
const i =
|
|
410
|
+
const i = M(this.formConfig, e);
|
|
413
411
|
if (i) {
|
|
414
412
|
const o = new Object({});
|
|
415
413
|
g(o, this.globalDsv || {});
|
|
416
414
|
let s = null;
|
|
417
415
|
try {
|
|
418
|
-
s = await
|
|
416
|
+
s = await E(
|
|
419
417
|
i,
|
|
420
418
|
o,
|
|
421
419
|
this,
|
|
@@ -431,7 +429,7 @@ const it = {
|
|
|
431
429
|
//--------------------- 以下为组件支持外部调用的API方法 begin ------------------//
|
|
432
430
|
/* 提示:用户可自行扩充这些方法!!! */
|
|
433
431
|
changeLanguage(t) {
|
|
434
|
-
|
|
432
|
+
X(t);
|
|
435
433
|
},
|
|
436
434
|
getLanguageName() {
|
|
437
435
|
return localStorage.getItem("lowcode_local") || "zh-CN";
|
|
@@ -466,7 +464,7 @@ const it = {
|
|
|
466
464
|
return;
|
|
467
465
|
}
|
|
468
466
|
this.clearFormDataModel(), this.buildFormModel(e.widgetList);
|
|
469
|
-
const i =
|
|
467
|
+
const i = f(N());
|
|
470
468
|
g(i, e.formConfig), this.formJsonObj.formConfig = i, this.formJsonObj.widgetList = e.widgetList, this.insertCustomStyleAndScriptNode(), this.$nextTick(() => {
|
|
471
469
|
this.initFormObject(!1), this.initDataSetRequest(), this.handleOnMounted();
|
|
472
470
|
});
|
|
@@ -499,7 +497,7 @@ const it = {
|
|
|
499
497
|
},
|
|
500
498
|
setFormData(t) {
|
|
501
499
|
console.log("setFormData: ", t), Object.keys(this.formDataModel).forEach((e) => {
|
|
502
|
-
t && t.hasOwnProperty(e) && (this.formDataModel[e] =
|
|
500
|
+
t && t.hasOwnProperty(e) && (this.formDataModel[e] = f(t[e]));
|
|
503
501
|
}), this.broadcast("ContainerItem", "setFormData", this.formDataModel), this.broadcast("FieldWidget", "setFormData", this.formDataModel);
|
|
504
502
|
},
|
|
505
503
|
getFieldValue(t) {
|
|
@@ -607,14 +605,14 @@ const it = {
|
|
|
607
605
|
* @returns {*[]}
|
|
608
606
|
*/
|
|
609
607
|
getFieldWidgets(t = !1) {
|
|
610
|
-
return
|
|
608
|
+
return z(this.formJsonObj.widgetList, t);
|
|
611
609
|
},
|
|
612
610
|
/**
|
|
613
611
|
* 获取所有容器组件
|
|
614
612
|
* @returns {*[]}
|
|
615
613
|
*/
|
|
616
614
|
getContainerWidgets() {
|
|
617
|
-
return
|
|
615
|
+
return T(this.formJsonObj.widgetList);
|
|
618
616
|
},
|
|
619
617
|
/**
|
|
620
618
|
* 增加外部组件引用,可通过getEC()方法获取外部组件,以便在VForm内部调用外部组件方法
|
|
@@ -667,8 +665,8 @@ const it = {
|
|
|
667
665
|
* @param localDsv
|
|
668
666
|
*/
|
|
669
667
|
async executeDataSource(t, e) {
|
|
670
|
-
const i =
|
|
671
|
-
return g(o, this.globalDsv), g(o, e), await
|
|
668
|
+
const i = M(this.formJsonObj.formConfig, t), o = new Object({});
|
|
669
|
+
return g(o, this.globalDsv), g(o, e), await E(i, o, this, !1, this.$message);
|
|
672
670
|
},
|
|
673
671
|
/**
|
|
674
672
|
* 获取父级VFormRender组件实例
|
|
@@ -720,15 +718,15 @@ const it = {
|
|
|
720
718
|
*/
|
|
721
719
|
showDialog(t, e = {}, i = {}) {
|
|
722
720
|
console.log("showDialog", t, e, i);
|
|
723
|
-
const o = this.getTopFormRef(), s = this.getFormRef(), r =
|
|
721
|
+
const o = this.getTopFormRef(), s = this.getFormRef(), r = F(o.widgetList, t) || F(s.widgetList, t);
|
|
724
722
|
if (!t || r.type !== "vf-dialog") {
|
|
725
723
|
this.$message.error(this.i18nt("render.hint.refNotFound") + t);
|
|
726
724
|
return;
|
|
727
725
|
}
|
|
728
726
|
const a = {
|
|
729
|
-
widgetList:
|
|
730
|
-
formConfig:
|
|
731
|
-
},
|
|
727
|
+
widgetList: f(r.widgetList),
|
|
728
|
+
formConfig: w(o.formConfig)
|
|
729
|
+
}, l = C() + "", n = J(Y, {
|
|
732
730
|
options: r.options,
|
|
733
731
|
formJson: a,
|
|
734
732
|
formData: { ...e },
|
|
@@ -736,23 +734,23 @@ const it = {
|
|
|
736
734
|
globalDsv: o.globalDsv,
|
|
737
735
|
parentFormRef: this,
|
|
738
736
|
extraData: i,
|
|
739
|
-
wrapperId:
|
|
737
|
+
wrapperId: l,
|
|
740
738
|
vfCtx: { ...e }
|
|
741
739
|
});
|
|
742
|
-
|
|
743
|
-
const
|
|
744
|
-
|
|
740
|
+
n.appContext = this.$root.$.appContext;
|
|
741
|
+
const d = document.createElement("div");
|
|
742
|
+
d.id = "vf-dynamic-dialog-wrapper" + l, document.body.appendChild(d), O(n, d), document.body.appendChild(n.el), n.component.exposed.show();
|
|
745
743
|
},
|
|
746
744
|
showDrawer(t, e = {}, i = {}) {
|
|
747
|
-
const o = this.getTopFormRef(), s =
|
|
745
|
+
const o = this.getTopFormRef(), s = F(o.widgetList, t);
|
|
748
746
|
if (!s || s.type !== "vf-drawer") {
|
|
749
747
|
this.$message.error(this.i18nt("render.hint.refNotFound") + t);
|
|
750
748
|
return;
|
|
751
749
|
}
|
|
752
750
|
const r = {
|
|
753
|
-
widgetList:
|
|
754
|
-
formConfig:
|
|
755
|
-
}, a =
|
|
751
|
+
widgetList: f(s.widgetList),
|
|
752
|
+
formConfig: w(o.formConfig)
|
|
753
|
+
}, a = C() + "", l = k(Z, {
|
|
756
754
|
options: s.options,
|
|
757
755
|
formJson: r,
|
|
758
756
|
formData: e || {},
|
|
@@ -762,9 +760,9 @@ const it = {
|
|
|
762
760
|
extraData: i,
|
|
763
761
|
wrapperId: a
|
|
764
762
|
});
|
|
765
|
-
|
|
766
|
-
const
|
|
767
|
-
|
|
763
|
+
l.appContext = this.$root.$.appContext;
|
|
764
|
+
const n = document.createElement("div");
|
|
765
|
+
n.id = "vf-dynamic-drawer-wrapper" + a, document.body.appendChild(n), O(l, n), document.body.appendChild(l.el), l.component.ctx.show();
|
|
768
766
|
},
|
|
769
767
|
/**
|
|
770
768
|
* 判断表单是否处于设计器预览状态
|
|
@@ -779,71 +777,66 @@ const it = {
|
|
|
779
777
|
//--------------------- 以上为组件支持外部调用的API方法 end ------------------//
|
|
780
778
|
}
|
|
781
779
|
};
|
|
782
|
-
function
|
|
783
|
-
const a =
|
|
784
|
-
return m(),
|
|
780
|
+
function et(t, e, i, o, s, r) {
|
|
781
|
+
const a = D("a-form"), l = D("a-spin");
|
|
782
|
+
return m(), p(l, { spinning: s.isLoading }, {
|
|
785
783
|
default: c(() => [
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}, 8, ["layout", "class", "label-width", "model", "onKeydown"])
|
|
837
|
-
], 4)
|
|
838
|
-
]),
|
|
839
|
-
_: 3
|
|
840
|
-
}, 8, ["spinning"])
|
|
784
|
+
x("div", {
|
|
785
|
+
style: A(s.isLoading ? "min-height: 260px" : "")
|
|
786
|
+
}, [
|
|
787
|
+
k(a, {
|
|
788
|
+
layout: r.labelPosition,
|
|
789
|
+
class: B([[r.customClass, s.readModeFlag ? "readonly-mode-form" : ""], "render-form tpf-form"]),
|
|
790
|
+
"label-width": r.labelWidth,
|
|
791
|
+
"validate-on-rule-change": !1,
|
|
792
|
+
model: s.formDataModel,
|
|
793
|
+
ref: "renderForm",
|
|
794
|
+
onKeydown: _(r.handleEnterKey, ["enter"])
|
|
795
|
+
}, {
|
|
796
|
+
default: c(() => [
|
|
797
|
+
(m(!0), y(R, null, b(r.widgetList, (n, d) => (m(), y(R, null, [
|
|
798
|
+
n.category === "container" ? (m(), p(S(r.getContainerWidgetName(n)), {
|
|
799
|
+
widget: n,
|
|
800
|
+
key: n.id,
|
|
801
|
+
data: s.formDataModel[n.options.name],
|
|
802
|
+
"parent-list": r.widgetList,
|
|
803
|
+
"index-of-parent-list": d,
|
|
804
|
+
"parent-widget": null,
|
|
805
|
+
model: s.formDataModel
|
|
806
|
+
}, L({ _: 2 }, [
|
|
807
|
+
b(Object.keys(t.$slots), (h) => ({
|
|
808
|
+
name: h,
|
|
809
|
+
fn: c((u) => [
|
|
810
|
+
W(t.$slots, h, v({ ref_for: !0 }, u), void 0, !0)
|
|
811
|
+
])
|
|
812
|
+
}))
|
|
813
|
+
]), 1032, ["widget", "data", "parent-list", "index-of-parent-list", "model"])) : (m(), p(S(r.getWidgetName(n)), {
|
|
814
|
+
field: n,
|
|
815
|
+
"form-model": s.formDataModel,
|
|
816
|
+
designer: null,
|
|
817
|
+
key: n.id,
|
|
818
|
+
"parent-list": r.widgetList,
|
|
819
|
+
"index-of-parent-list": d,
|
|
820
|
+
"parent-widget": null
|
|
821
|
+
}, L({ _: 2 }, [
|
|
822
|
+
b(Object.keys(t.$slots), (h) => ({
|
|
823
|
+
name: h,
|
|
824
|
+
fn: c((u) => [
|
|
825
|
+
W(t.$slots, h, v({ ref_for: !0 }, u), void 0, !0)
|
|
826
|
+
])
|
|
827
|
+
}))
|
|
828
|
+
]), 1032, ["field", "form-model", "parent-list", "index-of-parent-list"]))
|
|
829
|
+
], 64))), 256))
|
|
830
|
+
]),
|
|
831
|
+
_: 3
|
|
832
|
+
}, 8, ["layout", "class", "label-width", "model", "onKeydown"])
|
|
833
|
+
], 4)
|
|
841
834
|
]),
|
|
842
835
|
_: 3
|
|
843
|
-
});
|
|
836
|
+
}, 8, ["spinning"]);
|
|
844
837
|
}
|
|
845
|
-
const
|
|
838
|
+
const ct = /* @__PURE__ */ I(tt, [["render", et], ["__scopeId", "data-v-e118a282"]]);
|
|
846
839
|
export {
|
|
847
|
-
|
|
840
|
+
ct as default
|
|
848
841
|
};
|
|
849
842
|
//# sourceMappingURL=index.vue.js.map
|