@kp-ui/lowcode 1.0.101 → 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.
@@ -1,22 +1,20 @@
1
- import { resolveComponent as p, createBlock as b, openBlock as m, withCtx as c, createVNode as y, createElementVNode as A, normalizeStyle as _, withKeys as B, normalizeClass as J, createElementBlock as S, Fragment as L, renderList as F, resolveDynamicComponent as v, createSlots as W, renderSlot as O, mergeProps as w, render as M, h as P } from "vue";
2
- import T from "../../utils/emitter.js";
3
- import $ from "../form-designer/form-widget/field-widget/index.js";
4
- import { TpfConfigProvider as H } from "tmgc2-share";
5
- import { buildDefaultFormJson as z, getContainerWidgetByName as C, cloneFormConfigWithoutEventHandler as E, deepClone as d, getDSByName as j, overwriteObj as g, runDataSourceRequest as V, getAllContainerWidgets as N, getAllFieldWidgets as G, getDefaultFormConfig as K, traverseFieldWidgets as q, getFieldWidgetByName as k, traverseFieldWidgetsOfContainer as U, insertCustomCssToHead as Q, insertGlobalFunctionsToHtml as X, generateId as D } from "../../utils/util.js";
6
- import Y, { changeLocale as Z } from "../../utils/i18n.js";
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 tt from "./dynamic-drawer.vue.js";
10
- import { fmtHttpParams as x } from "../../utils/request/fmtHttpParams.js";
8
+ import Z from "./dynamic-drawer.vue.js";
9
+ import { fmtHttpParams as V } from "../../utils/request/fmtHttpParams.js";
11
10
  /* empty css */
12
- import et from "../../../_virtual/_plugin-vue_export-helper.js";
13
- const it = {
11
+ import I from "../../../_virtual/_plugin-vue_export-helper.js";
12
+ const tt = {
14
13
  name: "VFormRender",
15
14
  componentName: "VFormRender",
16
- mixins: [T, Y],
15
+ mixins: [$, Q],
17
16
  components: {
18
- TpfConfigProvider: H,
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: () => z()
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 x.call(this, t.vformDetail, {
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 x.call(this, e.vformUpdate, {
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" + D(), t && !this.dynamicCreation && this.insertCustomStyleAndScriptNode(), this.addFieldChangeEventHandler(), this.addFieldValidateEventHandler(), this.registerFormToRefList(), this.handleOnCreated(), this.disabledMode && this.$nextTick(() => {
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 && Q(
225
+ this.formConfig && this.formConfig.cssCode && q(
228
226
  this.formConfig.cssCode,
229
227
  this.previewState ? "" : this.formId
230
- ), this.formConfig && this.formConfig.functions && X(
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] = d(t.options.dataSource);
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] = d(i);
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] = d(i);
276
+ this.formDataModel[e] = f(i);
279
277
  } else {
280
278
  const i = [];
281
- U(t, (r) => {
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] = d(e);
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 = k(
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 = k(
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 (q(this.widgetList, o), i) {
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 = j(this.formConfig, e);
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 V(
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
- Z(t);
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 = d(K());
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] = d(t[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 G(this.formJsonObj.widgetList, t);
608
+ return z(this.formJsonObj.widgetList, t);
611
609
  },
612
610
  /**
613
611
  * 获取所有容器组件
614
612
  * @returns {*[]}
615
613
  */
616
614
  getContainerWidgets() {
617
- return N(this.formJsonObj.widgetList);
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 = j(this.formJsonObj.formConfig, t), o = new Object({});
671
- return g(o, this.globalDsv), g(o, e), await V(i, o, this, !1, this.$message);
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 = C(o.widgetList, t) || C(s.widgetList, t);
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: d(r.widgetList),
730
- formConfig: E(o.formConfig)
731
- }, f = D() + "", l = P(I, {
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: f,
737
+ wrapperId: l,
740
738
  vfCtx: { ...e }
741
739
  });
742
- l.appContext = this.$root.$.appContext;
743
- const n = document.createElement("div");
744
- n.id = "vf-dynamic-dialog-wrapper" + f, document.body.appendChild(n), M(l, n), document.body.appendChild(l.el), l.component.exposed.show();
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 = C(o.widgetList, t);
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: d(s.widgetList),
754
- formConfig: E(o.formConfig)
755
- }, a = D() + "", f = y(tt, {
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
- f.appContext = this.$root.$.appContext;
766
- const l = document.createElement("div");
767
- l.id = "vf-dynamic-drawer-wrapper" + a, document.body.appendChild(l), M(f, l), document.body.appendChild(f.el), f.component.ctx.show();
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 ot(t, e, i, o, s, r) {
783
- const a = p("a-form"), f = p("a-spin"), l = p("TpfConfigProvider");
784
- return m(), b(l, null, {
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
- y(f, { spinning: s.isLoading }, {
787
- default: c(() => [
788
- A("div", {
789
- style: _(s.isLoading ? "min-height: 260px" : "")
790
- }, [
791
- y(a, {
792
- layout: r.labelPosition,
793
- class: J([[r.customClass, s.readModeFlag ? "readonly-mode-form" : ""], "render-form tpf-form"]),
794
- "label-width": r.labelWidth,
795
- "validate-on-rule-change": !1,
796
- model: s.formDataModel,
797
- ref: "renderForm",
798
- onKeydown: B(r.handleEnterKey, ["enter"])
799
- }, {
800
- default: c(() => [
801
- (m(!0), S(L, null, F(r.widgetList, (n, R) => (m(), S(L, null, [
802
- n.category === "container" ? (m(), b(v(r.getContainerWidgetName(n)), {
803
- widget: n,
804
- key: n.id,
805
- data: s.formDataModel[n.options.name],
806
- "parent-list": r.widgetList,
807
- "index-of-parent-list": R,
808
- "parent-widget": null,
809
- model: s.formDataModel
810
- }, W({ _: 2 }, [
811
- F(Object.keys(t.$slots), (h) => ({
812
- name: h,
813
- fn: c((u) => [
814
- O(t.$slots, h, w({ ref_for: !0 }, u), void 0, !0)
815
- ])
816
- }))
817
- ]), 1032, ["widget", "data", "parent-list", "index-of-parent-list", "model"])) : (m(), b(v(r.getWidgetName(n)), {
818
- field: n,
819
- "form-model": s.formDataModel,
820
- designer: null,
821
- key: n.id,
822
- "parent-list": r.widgetList,
823
- "index-of-parent-list": R,
824
- "parent-widget": null
825
- }, W({ _: 2 }, [
826
- F(Object.keys(t.$slots), (h) => ({
827
- name: h,
828
- fn: c((u) => [
829
- O(t.$slots, h, w({ ref_for: !0 }, u), void 0, !0)
830
- ])
831
- }))
832
- ]), 1032, ["field", "form-model", "parent-list", "index-of-parent-list"]))
833
- ], 64))), 256))
834
- ]),
835
- _: 3
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 pt = /* @__PURE__ */ et(it, [["render", ot], ["__scopeId", "data-v-10da8437"]]);
838
+ const ct = /* @__PURE__ */ I(tt, [["render", et], ["__scopeId", "data-v-e118a282"]]);
846
839
  export {
847
- pt as default
840
+ ct as default
848
841
  };
849
842
  //# sourceMappingURL=index.vue.js.map