form-custom-test 3.0.214 → 3.0.216

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.
@@ -10945,6 +10945,9 @@ var fieldMixin = {
10945
10945
  if (!foundRef && (!this.subFormItemFlag || this.designState)) {
10946
10946
  foundRef = this.refList[widgetName];
10947
10947
  }
10948
+ if (!foundRef) {
10949
+ foundRef = this.refList[widgetName];
10950
+ }
10948
10951
  if (!foundRef && !!showError) {
10949
10952
  this.$message.error(this.i18nt("render.hint.refNotFound") + widgetName);
10950
10953
  }
@@ -11267,7 +11270,10 @@ const _sfc_main$3F = {
11267
11270
  },
11268
11271
  rules: Array
11269
11272
  },
11270
- inject: ["getFormConfig"],
11273
+ inject: {
11274
+ getFormConfig: { from: "getFormConfig" },
11275
+ getCustomSubFormFieldLabelHidden: { default: null }
11276
+ },
11271
11277
  computed: {
11272
11278
  formConfig() {
11273
11279
  return this.getFormConfig();
@@ -11276,13 +11282,13 @@ const _sfc_main$3F = {
11276
11282
  return !!this.designer && this.field.id === this.designer.selectedId;
11277
11283
  },
11278
11284
  label() {
11279
- if (!!this.field.options.labelHidden) {
11285
+ if (!!this.field.options.labelHidden || this.isParentSubFormLabelHidden) {
11280
11286
  return "";
11281
11287
  }
11282
11288
  return this.field.options.label;
11283
11289
  },
11284
11290
  labelWidth() {
11285
- if (!!this.field.options.labelHidden) {
11291
+ if (!!this.field.options.labelHidden || this.isParentSubFormLabelHidden) {
11286
11292
  return 0;
11287
11293
  }
11288
11294
  if (!!this.field.options.labelWidth) {
@@ -11312,6 +11318,12 @@ const _sfc_main$3F = {
11312
11318
  },
11313
11319
  subFormItemFlag() {
11314
11320
  return !!this.parentWidget ? this.parentWidget.type === "sub-form" || this.parentWidget.type === "custom-sub-form" : false;
11321
+ },
11322
+ isParentSubFormLabelHidden() {
11323
+ if (typeof this.getCustomSubFormFieldLabelHidden === "function") {
11324
+ return !!this.getCustomSubFormFieldLabelHidden();
11325
+ }
11326
+ return false;
11315
11327
  }
11316
11328
  },
11317
11329
  created() {
@@ -11503,7 +11515,7 @@ function _sfc_render$3F(_ctx, _cache, $props, $setup, $data, $options) {
11503
11515
  ], 64)) : createCommentVNode("", true)
11504
11516
  ], 2);
11505
11517
  }
11506
- var FormItemWrapper = /* @__PURE__ */ _export_sfc$1(_sfc_main$3F, [["render", _sfc_render$3F], ["__scopeId", "data-v-a42827ee"]]);
11518
+ var FormItemWrapper = /* @__PURE__ */ _export_sfc$1(_sfc_main$3F, [["render", _sfc_render$3F], ["__scopeId", "data-v-3cbbbdb2"]]);
11507
11519
  var __glob_0_8$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11508
11520
  __proto__: null,
11509
11521
  "default": FormItemWrapper
@@ -54472,7 +54484,7 @@ const _hoisted_12$2 = {
54472
54484
  class: ""
54473
54485
  };
54474
54486
  const _hoisted_13$2 = { style: { "border": "1px solid #DCDFE6" } };
54475
- const _hoisted_14$2 = { class: "dialog-footer" };
54487
+ const _hoisted_14$1 = { class: "dialog-footer" };
54476
54488
  const _hoisted_15$1 = {
54477
54489
  key: 5,
54478
54490
  class: ""
@@ -54984,7 +54996,7 @@ function _sfc_render$2Z(_ctx, _cache, $props, $setup, $data, $options) {
54984
54996
  "append-to-body": true
54985
54997
  }, {
54986
54998
  footer: withCtx(() => [
54987
- createElementVNode("div", _hoisted_14$2, [
54999
+ createElementVNode("div", _hoisted_14$1, [
54988
55000
  createVNode(_component_el_button, {
54989
55001
  type: "primary",
54990
55002
  class: "copy-form-data-json-btn",
@@ -56915,7 +56927,7 @@ const _hoisted_12$1 = {
56915
56927
  class: ""
56916
56928
  };
56917
56929
  const _hoisted_13$1 = { class: "dialog-footer" };
56918
- const _hoisted_14$1 = {
56930
+ const _hoisted_14 = {
56919
56931
  key: 10,
56920
56932
  class: ""
56921
56933
  };
@@ -57303,7 +57315,7 @@ function _sfc_render$2m(_ctx, _cache, $props, $setup, $data, $options) {
57303
57315
  ])), [
57304
57316
  [_directive_drag, [".drag-dialog.el-dialog", ".drag-dialog .el-dialog__header"]]
57305
57317
  ]) : createCommentVNode("", true),
57306
- $data.showImportTreeDialogFlag ? withDirectives((openBlock(), createElementBlock("div", _hoisted_14$1, [
57318
+ $data.showImportTreeDialogFlag ? withDirectives((openBlock(), createElementBlock("div", _hoisted_14, [
57307
57319
  createVNode(_component_el_dialog, {
57308
57320
  title: _ctx.i18nt("designer.setting.importOptions"),
57309
57321
  modelValue: $data.showImportTreeDialogFlag,
@@ -69198,13 +69210,13 @@ function registerIcon(app) {
69198
69210
  if (typeof window !== "undefined") {
69199
69211
  let loadSvg = function() {
69200
69212
  var body = document.body;
69201
- var svgDom = document.getElementById("__svg__icons__dom__1782180395662__");
69213
+ var svgDom = document.getElementById("__svg__icons__dom__1782204510169__");
69202
69214
  if (!svgDom) {
69203
69215
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
69204
69216
  svgDom.style.position = "absolute";
69205
69217
  svgDom.style.width = "0";
69206
69218
  svgDom.style.height = "0";
69207
- svgDom.id = "__svg__icons__dom__1782180395662__";
69219
+ svgDom.id = "__svg__icons__dom__1782204510169__";
69208
69220
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
69209
69221
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
69210
69222
  }
@@ -76183,6 +76195,7 @@ const customSubFormSchema = {
76183
76195
  disabled: false,
76184
76196
  showBlankRow: true,
76185
76197
  showRowNumber: true,
76198
+ labelHidden: false,
76186
76199
  customClass: "",
76187
76200
  onSubFormRowChange: "",
76188
76201
  onSubFormRowAdd: "",
@@ -76222,6 +76235,15 @@ const _sfc_main$l = {
76222
76235
  return this.widget.options.customClass || "";
76223
76236
  }
76224
76237
  },
76238
+ provide() {
76239
+ const vm = this;
76240
+ return {
76241
+ getCustomSubFormFieldLabelHidden() {
76242
+ var _a2, _b2;
76243
+ return !!((_b2 = (_a2 = vm.widget) == null ? void 0 : _a2.options) == null ? void 0 : _b2.labelHidden);
76244
+ }
76245
+ };
76246
+ },
76225
76247
  created() {
76226
76248
  this.initRefList();
76227
76249
  },
@@ -76242,7 +76264,10 @@ const _sfc_main$l = {
76242
76264
  }
76243
76265
  };
76244
76266
  const _hoisted_1$i = { class: "sub-form-header" };
76245
- const _hoisted_2$d = { class: "sub-form-label" };
76267
+ const _hoisted_2$d = {
76268
+ key: 0,
76269
+ class: "sub-form-label"
76270
+ };
76246
76271
  const _hoisted_3$b = { class: "group-header" };
76247
76272
  const _hoisted_4$9 = { class: "group-title" };
76248
76273
  const _hoisted_5$7 = {
@@ -76279,7 +76304,7 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
76279
76304
  onClick: _cache[1] || (_cache[1] = withModifiers(($event) => _ctx.selectWidget($props.widget), ["stop"]))
76280
76305
  }, [
76281
76306
  createElementVNode("div", _hoisted_1$i, [
76282
- createElementVNode("span", _hoisted_2$d, toDisplayString($props.widget.options.label || "\u81EA\u5B9A\u4E49\u5B50\u8868\u5355"), 1)
76307
+ !$props.widget.options.labelHidden ? (openBlock(), createElementBlock("span", _hoisted_2$d, toDisplayString($props.widget.options.label || "\u81EA\u5B9A\u4E49\u5B50\u8868\u5355"), 1)) : createCommentVNode("", true)
76283
76308
  ]),
76284
76309
  (openBlock(true), createElementBlock(Fragment, null, renderList($data.previewRows, (row, rowIdx) => {
76285
76310
  return openBlock(), createElementBlock("div", {
@@ -76367,7 +76392,7 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
76367
76392
  _: 1
76368
76393
  }, 8, ["designer", "widget", "parent-widget", "parent-list", "index-of-parent-list"]);
76369
76394
  }
76370
- var CustomSubFormWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$l], ["__scopeId", "data-v-787fff1a"]]);
76395
+ var CustomSubFormWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$l], ["__scopeId", "data-v-0d784fb7"]]);
76371
76396
  var customSubFormItem_vue_vue_type_style_index_0_scoped_true_lang = "";
76372
76397
  const _sfc_main$k = {
76373
76398
  name: "custom-sub-form-item",
@@ -76382,6 +76407,15 @@ const _sfc_main$k = {
76382
76407
  widget: Object
76383
76408
  },
76384
76409
  inject: ["refList", "sfRefList", "globalModel"],
76410
+ provide() {
76411
+ const vm = this;
76412
+ return {
76413
+ getCustomSubFormFieldLabelHidden() {
76414
+ var _a2, _b2;
76415
+ return !!((_b2 = (_a2 = vm.widget) == null ? void 0 : _a2.options) == null ? void 0 : _b2.labelHidden);
76416
+ }
76417
+ };
76418
+ },
76385
76419
  data() {
76386
76420
  return {
76387
76421
  rowIdData: [],
@@ -76736,7 +76770,10 @@ const _sfc_main$k = {
76736
76770
  }
76737
76771
  }
76738
76772
  };
76739
- const _hoisted_1$h = { class: "sub-form-header" };
76773
+ const _hoisted_1$h = {
76774
+ key: 0,
76775
+ class: "sub-form-header"
76776
+ };
76740
76777
  const _hoisted_2$c = { class: "sub-form-label" };
76741
76778
  const _hoisted_3$a = { class: "group-header" };
76742
76779
  const _hoisted_4$8 = { class: "group-title" };
@@ -76744,29 +76781,25 @@ const _hoisted_5$6 = {
76744
76781
  key: 0,
76745
76782
  class: "row-number-span"
76746
76783
  };
76747
- const _hoisted_6$6 = {
76748
- key: 1,
76749
- class: "row-number-span"
76750
- };
76751
- const _hoisted_7$5 = { class: "group-actions" };
76752
- const _hoisted_8$3 = { class: "group-content" };
76753
- const _hoisted_9$2 = {
76784
+ const _hoisted_6$6 = { class: "group-actions" };
76785
+ const _hoisted_7$5 = { class: "group-content" };
76786
+ const _hoisted_8$3 = {
76754
76787
  key: 1,
76755
76788
  class: "field-loading",
76756
76789
  style: { "color": "#909399", "font-size": "12px", "padding": "8px" }
76757
76790
  };
76758
- const _hoisted_10$1 = {
76791
+ const _hoisted_9$2 = {
76759
76792
  key: 1,
76760
76793
  class: "empty-hint"
76761
76794
  };
76762
- const _hoisted_11 = { key: 0 };
76763
- const _hoisted_12 = { key: 1 };
76764
- const _hoisted_13 = {
76765
- key: 0,
76795
+ const _hoisted_10$1 = { key: 0 };
76796
+ const _hoisted_11 = { key: 1 };
76797
+ const _hoisted_12 = {
76798
+ key: 1,
76766
76799
  class: "empty-hint"
76767
76800
  };
76768
- const _hoisted_14 = {
76769
- key: 1,
76801
+ const _hoisted_13 = {
76802
+ key: 2,
76770
76803
  class: "empty-hint"
76771
76804
  };
76772
76805
  function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
@@ -76779,9 +76812,9 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
76779
76812
  key: $props.widget.id,
76780
76813
  class: normalizeClass(["custom-sub-form-container", $options.customClass])
76781
76814
  }, [
76782
- createElementVNode("div", _hoisted_1$h, [
76815
+ !$props.widget.options.labelHidden ? (openBlock(), createElementBlock("div", _hoisted_1$h, [
76783
76816
  createElementVNode("span", _hoisted_2$c, toDisplayString($props.widget.options.label || "\u81EA\u5B9A\u4E49\u5B50\u8868\u5355"), 1)
76784
- ]),
76817
+ ])) : createCommentVNode("", true),
76785
76818
  (openBlock(true), createElementBlock(Fragment, null, renderList($data.rowIdData, (subFormRowId, sfrIdx) => {
76786
76819
  return openBlock(), createElementBlock("div", {
76787
76820
  class: "form-group-row",
@@ -76789,9 +76822,9 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
76789
76822
  }, [
76790
76823
  createElementVNode("div", _hoisted_3$a, [
76791
76824
  createElementVNode("div", _hoisted_4$8, [
76792
- $props.widget.options.showRowNumber ? (openBlock(), createElementBlock("span", _hoisted_5$6, toDisplayString($props.widget.options.label || "\u81EA\u5B9A\u4E49\u5B50\u8868\u5355") + " " + toDisplayString(sfrIdx + 1), 1)) : (openBlock(), createElementBlock("span", _hoisted_6$6, "\u8868\u5355\u7EC4"))
76825
+ $props.widget.options.showRowNumber && !$props.widget.options.labelHidden ? (openBlock(), createElementBlock("span", _hoisted_5$6, toDisplayString($props.widget.options.label || "\u81EA\u5B9A\u4E49\u5B50\u8868\u5355") + " " + toDisplayString(sfrIdx + 1), 1)) : createCommentVNode("", true)
76793
76826
  ]),
76794
- createElementVNode("div", _hoisted_7$5, [
76827
+ createElementVNode("div", _hoisted_6$6, [
76795
76828
  sfrIdx > 0 && !$props.widget.options.disabled ? (openBlock(), createBlock(_component_el_button, {
76796
76829
  key: 0,
76797
76830
  size: "small",
@@ -76807,7 +76840,7 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
76807
76840
  }, 8, ["onClick"])) : createCommentVNode("", true)
76808
76841
  ])
76809
76842
  ]),
76810
- createElementVNode("div", _hoisted_8$3, [
76843
+ createElementVNode("div", _hoisted_7$5, [
76811
76844
  $props.widget && $props.widget.widgetList && $props.widget.widgetList.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList($props.widget.widgetList, (subWidget, swIdx) => {
76812
76845
  return openBlock(), createElementBlock(Fragment, {
76813
76846
  key: subWidget ? subWidget.id + "gc" + subFormRowId + "-" + swIdx : "gc" + subFormRowId + "-" + swIdx
@@ -76834,18 +76867,18 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
76834
76867
  "sub-form-row-index": sfrIdx,
76835
76868
  "sub-form-col-index": swIdx,
76836
76869
  "sub-form-disabled": $props.widget.options.disabled
76837
- }, null, 8, ["field", "parent-list", "index-of-parent-list", "parent-widget", "sub-form-row-id", "sub-form-row-index", "sub-form-col-index", "sub-form-disabled"])) : (openBlock(), createElementBlock("div", _hoisted_9$2, " \u5B57\u6BB5\u52A0\u8F7D\u4E2D... "))
76870
+ }, null, 8, ["field", "parent-list", "index-of-parent-list", "parent-widget", "sub-form-row-id", "sub-form-row-index", "sub-form-col-index", "sub-form-disabled"])) : (openBlock(), createElementBlock("div", _hoisted_8$3, " \u5B57\u6BB5\u52A0\u8F7D\u4E2D... "))
76838
76871
  ], 64)) : createCommentVNode("", true)
76839
76872
  ], 64);
76840
- }), 128)) : (openBlock(), createElementBlock("div", _hoisted_10$1, [
76841
- !$props.widget ? (openBlock(), createElementBlock("div", _hoisted_11, "\u7EC4\u4EF6\u672A\u521D\u59CB\u5316")) : !$props.widget.widgetList || $props.widget.widgetList.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_12, " \u8BF7\u5148\u5728\u8BBE\u8BA1\u5668\u4E2D\u62D6\u62FD\u7EC4\u4EF6\u5230\u5B50\u8868\u5355\u4E2D ")) : createCommentVNode("", true)
76873
+ }), 128)) : (openBlock(), createElementBlock("div", _hoisted_9$2, [
76874
+ !$props.widget ? (openBlock(), createElementBlock("div", _hoisted_10$1, "\u7EC4\u4EF6\u672A\u521D\u59CB\u5316")) : !$props.widget.widgetList || $props.widget.widgetList.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_11, " \u8BF7\u5148\u5728\u8BBE\u8BA1\u5668\u4E2D\u62D6\u62FD\u7EC4\u4EF6\u5230\u5B50\u8868\u5355\u4E2D ")) : createCommentVNode("", true)
76842
76875
  ]))
76843
76876
  ])
76844
76877
  ]);
76845
76878
  }), 128)),
76846
- !$props.widget.widgetList || $props.widget.widgetList.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_13, " \u8BF7\u5148\u5728\u8BBE\u8BA1\u5668\u4E2D\u62D6\u62FD\u7EC4\u4EF6\u5230\u5B50\u8868\u5355\u4E2D ")) : $data.rowIdData.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_14, ' \u70B9\u51FB"\u6DFB\u52A0"\u6309\u94AE\u6DFB\u52A0\u6570\u636E\u884C ')) : createCommentVNode("", true),
76879
+ !$props.widget.widgetList || $props.widget.widgetList.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_12, " \u8BF7\u5148\u5728\u8BBE\u8BA1\u5668\u4E2D\u62D6\u62FD\u7EC4\u4EF6\u5230\u5B50\u8868\u5355\u4E2D ")) : $data.rowIdData.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_13, ' \u70B9\u51FB"\u6DFB\u52A0"\u6309\u94AE\u6DFB\u52A0\u6570\u636E\u884C ')) : createCommentVNode("", true),
76847
76880
  !$props.widget.options.disabled ? (openBlock(), createBlock(_component_el_button, {
76848
- key: 2,
76881
+ key: 3,
76849
76882
  disabled: $data.actionDisabled,
76850
76883
  type: "primary",
76851
76884
  plain: "",
@@ -76865,7 +76898,7 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
76865
76898
  _: 1
76866
76899
  }, 8, ["widget"]);
76867
76900
  }
76868
- var CustomSubFormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["render", _sfc_render$k], ["__scopeId", "data-v-6bd07e4e"]]);
76901
+ var CustomSubFormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["render", _sfc_render$k], ["__scopeId", "data-v-09af068c"]]);
76869
76902
  const customTableCellSchema = {
76870
76903
  type: "custom-table-cell",
76871
76904
  category: "container",
@@ -80207,10 +80240,96 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
80207
80240
  }, 8, ["designer", "field", "rules", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"]);
80208
80241
  }
80209
80242
  var AssetSelectWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["render", _sfc_render$a]]);
80243
+ const DEFAULT_DICT_API = "/unified-dict/sysItemDict/page";
80244
+ const DEFAULT_DICT_PARAMS = { current: 1, size: 1e4 };
80245
+ function normalizeDictRecords(records) {
80246
+ if (!Array.isArray(records)) {
80247
+ return {};
80248
+ }
80249
+ return records.reduce((prev, cur) => {
80250
+ var _a2, _b2, _c2, _d, _e;
80251
+ const dictType = cur.dictType;
80252
+ if (!dictType) {
80253
+ return prev;
80254
+ }
80255
+ if (!prev[dictType]) {
80256
+ prev[dictType] = [];
80257
+ }
80258
+ prev[dictType].push(__spreadValues({
80259
+ label: (_b2 = (_a2 = cur.label) != null ? _a2 : cur.dictLabel) != null ? _b2 : "",
80260
+ value: (_e = (_d = (_c2 = cur.itemValue) != null ? _c2 : cur.dictValue) != null ? _d : cur.value) != null ? _e : ""
80261
+ }, cur));
80262
+ return prev;
80263
+ }, {});
80264
+ }
80210
80265
  class DictManager {
80211
80266
  constructor() {
80212
80267
  this.dictCache = {};
80213
80268
  this.loading = false;
80269
+ this._loaded = false;
80270
+ this._listeners = [];
80271
+ this._fetchPromise = null;
80272
+ }
80273
+ onLoaded(fn) {
80274
+ if (typeof fn !== "function") {
80275
+ return () => {
80276
+ };
80277
+ }
80278
+ if (this._loaded) {
80279
+ fn(this.dictCache);
80280
+ return () => {
80281
+ };
80282
+ }
80283
+ this._listeners.push(fn);
80284
+ return () => {
80285
+ this._listeners = this._listeners.filter((item) => item !== fn);
80286
+ };
80287
+ }
80288
+ _notifyLoaded() {
80289
+ this._loaded = true;
80290
+ this._listeners.forEach((fn) => {
80291
+ try {
80292
+ fn(this.dictCache);
80293
+ } catch (error) {
80294
+ console.error("[dictManager] onLoaded callback error:", error);
80295
+ }
80296
+ });
80297
+ }
80298
+ fetchFromApi(service2, options = {}) {
80299
+ const {
80300
+ url = DEFAULT_DICT_API,
80301
+ params = DEFAULT_DICT_PARAMS,
80302
+ force = false,
80303
+ customFetch
80304
+ } = options;
80305
+ if (this._fetchPromise && !force) {
80306
+ return this._fetchPromise;
80307
+ }
80308
+ if (this._loaded && Object.keys(this.dictCache).length > 0 && !force) {
80309
+ return Promise.resolve(this.dictCache);
80310
+ }
80311
+ this.loading = true;
80312
+ const requestPromise = typeof customFetch === "function" ? Promise.resolve().then(() => customFetch()).then((result) => {
80313
+ if (result && !Array.isArray(result) && typeof result === "object") {
80314
+ return result;
80315
+ }
80316
+ return normalizeDictRecords(Array.isArray(result) ? result : []);
80317
+ }) : service2.post(url, params).then((res) => {
80318
+ var _a2, _b2, _c2, _d;
80319
+ const records = (_d = (_c2 = (_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.records) != null ? _b2 : res == null ? void 0 : res.records) != null ? _c2 : res == null ? void 0 : res.data) != null ? _d : [];
80320
+ return normalizeDictRecords(Array.isArray(records) ? records : []);
80321
+ });
80322
+ this._fetchPromise = requestPromise.then((dictData) => {
80323
+ this.init(dictData || {});
80324
+ this._notifyLoaded();
80325
+ return dictData;
80326
+ }).catch((error) => {
80327
+ console.warn("[form-custom-test] \u5B57\u5178\u6570\u636E\u52A0\u8F7D\u5931\u8D25:", error);
80328
+ return {};
80329
+ }).finally(() => {
80330
+ this.loading = false;
80331
+ });
80332
+ return this._fetchPromise;
80214
80333
  }
80215
80334
  init(dictData) {
80216
80335
  this.dictCache = dictData || {};
@@ -80263,7 +80382,6 @@ class DictManager {
80263
80382
  return this.mapToOptionItems(this.getDictData(dictCode));
80264
80383
  }
80265
80384
  getDictTypeOptions() {
80266
- console.log("this.dictCache", this.dictCache);
80267
80385
  return Object.keys(this.dictCache || {}).map((dictType) => ({
80268
80386
  label: dictType,
80269
80387
  value: dictType
@@ -80271,6 +80389,8 @@ class DictManager {
80271
80389
  }
80272
80390
  clear() {
80273
80391
  this.dictCache = {};
80392
+ this._loaded = false;
80393
+ this._fetchPromise = null;
80274
80394
  if (typeof window !== "undefined") {
80275
80395
  window.dictCache = {};
80276
80396
  }
@@ -80367,8 +80487,14 @@ const _sfc_main$9 = {
80367
80487
  },
80368
80488
  mounted() {
80369
80489
  this.handleOnMounted();
80490
+ this._offDictLoaded = dictManager.onLoaded(() => {
80491
+ this.loadDictOptions();
80492
+ });
80370
80493
  },
80371
80494
  beforeUnmount() {
80495
+ if (this._offDictLoaded) {
80496
+ this._offDictLoaded();
80497
+ }
80372
80498
  this.unregisterFromRefList();
80373
80499
  },
80374
80500
  methods: {
@@ -80565,7 +80691,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
80565
80691
  _: 1
80566
80692
  }, 8, ["designer", "field", "rules", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"]);
80567
80693
  }
80568
- var DictSelectWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-07bda0ac"]]);
80694
+ var DictSelectWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-6f18008b"]]);
80569
80695
  var dictSelectDictCodeEditor_vue_vue_type_style_index_0_scoped_true_lang = "";
80570
80696
  const _sfc_main$8 = {
80571
80697
  name: "dict-select-dictCode-editor",
@@ -80594,6 +80720,15 @@ const _sfc_main$8 = {
80594
80720
  },
80595
80721
  mounted() {
80596
80722
  this.$nextTick(() => this.refreshDictTypeOptions());
80723
+ this._offDictLoaded = dictManager.onLoaded(() => {
80724
+ this.refreshDictTypeOptions();
80725
+ this.syncOptionItemsFromDict();
80726
+ });
80727
+ },
80728
+ beforeUnmount() {
80729
+ if (this._offDictLoaded) {
80730
+ this._offDictLoaded();
80731
+ }
80597
80732
  },
80598
80733
  methods: {
80599
80734
  refreshDictTypeOptions() {
@@ -80653,7 +80788,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
80653
80788
  _: 1
80654
80789
  }, 8, ["label"]);
80655
80790
  }
80656
- var DictSelectDictCodeEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-5b750108"]]);
80791
+ var DictSelectDictCodeEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-2dfeafae"]]);
80657
80792
  var detailDialog_vue_vue_type_style_index_0_scoped_true_lang = "";
80658
80793
  const _sfc_main$7 = {
80659
80794
  name: "detail-dialog",
@@ -82876,6 +83011,18 @@ const loadExtension = function(app) {
82876
83011
  addCustomWidgetSchema(customInputSchema);
82877
83012
  app.component(CustomInputWidget.name, CustomInputWidget);
82878
83013
  };
83014
+ function setupDict(app, service2, options = {}) {
83015
+ const dictConfig = options.dict || {};
83016
+ app.config.globalProperties.$dictManager = dictManager;
83017
+ app.provide("dictManager", dictManager);
83018
+ if (typeof window !== "undefined") {
83019
+ window.dictManager = dictManager;
83020
+ }
83021
+ if (dictConfig.autoLoad !== false && service2) {
83022
+ dictManager.fetchFromApi(service2, dictConfig);
83023
+ }
83024
+ return dictManager;
83025
+ }
82879
83026
  const { cookies } = useCookies();
82880
83027
  function getElMessage(app) {
82881
83028
  var _a2, _b2, _c2;
@@ -82897,7 +83044,7 @@ if (typeof window !== "undefined" && !window.Sortable) {
82897
83044
  window.Sortable = SortableLib;
82898
83045
  }
82899
83046
  const Draggable = (_c = VuedraggableCjs == null ? void 0 : VuedraggableCjs.default) != null ? _c : VuedraggableCjs;
82900
- VFormDesigner.install = function(app) {
83047
+ VFormDesigner.install = function(app, options = {}) {
82901
83048
  addDirective(app);
82902
83049
  loadExtension(app);
82903
83050
  app.use(ContainerWidgets);
@@ -82910,8 +83057,12 @@ VFormDesigner.install = function(app) {
82910
83057
  app.provide("ElMessage", getElMessage(app));
82911
83058
  app.config.globalProperties.$cookies = cookies;
82912
83059
  app.provide("cookies", cookies);
83060
+ if (typeof window !== "undefined") {
83061
+ window.service = service$1;
83062
+ }
83063
+ setupDict(app, service$1, options);
82913
83064
  };
82914
- VFormRender.install = function(app) {
83065
+ VFormRender.install = function(app, options = {}) {
82915
83066
  loadExtension(app);
82916
83067
  app.use(ContainerItems);
82917
83068
  registerIcon(app);
@@ -82920,12 +83071,16 @@ VFormRender.install = function(app) {
82920
83071
  app.provide("service", service$1);
82921
83072
  app.config.globalProperties.$cookies = cookies;
82922
83073
  app.provide("cookies", cookies);
83074
+ if (typeof window !== "undefined") {
83075
+ window.service = service$1;
83076
+ }
83077
+ setupDict(app, service$1, options);
82923
83078
  };
82924
83079
  const components = [
82925
83080
  VFormDesigner,
82926
83081
  VFormRender
82927
83082
  ];
82928
- const install = (app) => {
83083
+ const install = (app, options = {}) => {
82929
83084
  addDirective(app);
82930
83085
  loadExtension(app);
82931
83086
  app.use(ContainerWidgets);
@@ -82941,10 +83096,12 @@ const install = (app) => {
82941
83096
  if (typeof window !== "undefined") {
82942
83097
  window.service = service$1;
82943
83098
  }
83099
+ setupDict(app, service$1, options);
82944
83100
  };
82945
83101
  var install$1 = {
82946
83102
  install,
82947
83103
  VFormDesigner,
82948
- VFormRender
83104
+ VFormRender,
83105
+ dictManager
82949
83106
  };
82950
83107
  export { install$1 as default };