form-custom-test 3.0.194 → 3.0.196

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.
@@ -27667,6 +27667,13 @@ const _sfc_main$2Y = {
27667
27667
  }
27668
27668
  });
27669
27669
  }
27670
+ } else if (wItem.type === "sub-table" && wItem.formItemFlag) {
27671
+ let fieldName = wItem.options.name;
27672
+ if (!this.formData.hasOwnProperty(fieldName)) {
27673
+ this.formDataModel[fieldName] = deepClone(wItem.options.defaultValue || []);
27674
+ } else {
27675
+ this.formDataModel[fieldName] = deepClone(this.formData[fieldName]);
27676
+ }
27670
27677
  } else if (wItem.type === "sub-form") {
27671
27678
  let subFormName = wItem.options.name;
27672
27679
  if (!this.formData.hasOwnProperty(subFormName)) {
@@ -28344,7 +28351,7 @@ function _sfc_render$2Y(_ctx, _cache, $props, $setup, $data, $options) {
28344
28351
  _: 3
28345
28352
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
28346
28353
  }
28347
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$2Y, [["render", _sfc_render$2Y], ["__scopeId", "data-v-3d429201"]]);
28354
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$2Y, [["render", _sfc_render$2Y], ["__scopeId", "data-v-7129091e"]]);
28348
28355
  var ace$2 = { exports: {} };
28349
28356
  (function(module, exports) {
28350
28357
  (function() {
@@ -69038,13 +69045,13 @@ function registerIcon(app) {
69038
69045
  if (typeof window !== "undefined") {
69039
69046
  let loadSvg = function() {
69040
69047
  var body = document.body;
69041
- var svgDom = document.getElementById("__svg__icons__dom__1780624450717__");
69048
+ var svgDom = document.getElementById("__svg__icons__dom__1780627772452__");
69042
69049
  if (!svgDom) {
69043
69050
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
69044
69051
  svgDom.style.position = "absolute";
69045
69052
  svgDom.style.width = "0";
69046
69053
  svgDom.style.height = "0";
69047
- svgDom.id = "__svg__icons__dom__1780624450717__";
69054
+ svgDom.id = "__svg__icons__dom__1780627772452__";
69048
69055
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
69049
69056
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
69050
69057
  }
@@ -77805,15 +77812,25 @@ const _sfc_main$c = {
77805
77812
  },
77806
77813
  created() {
77807
77814
  this.initRefList();
77808
- this.initTableData();
77809
- },
77810
- mounted() {
77811
- this.initTableData();
77815
+ this.initEventHandler();
77812
77816
  },
77813
77817
  beforeUnmount() {
77814
77818
  this.unregisterFromRefList();
77815
77819
  },
77816
77820
  methods: {
77821
+ initEventHandler() {
77822
+ this.on$("setFormData", (newFormData) => {
77823
+ var _a2, _b2;
77824
+ const fieldName = (_b2 = (_a2 = this.widget) == null ? void 0 : _a2.options) == null ? void 0 : _b2.name;
77825
+ if (!fieldName || !newFormData) {
77826
+ return;
77827
+ }
77828
+ const value2 = newFormData[fieldName];
77829
+ if (Array.isArray(value2)) {
77830
+ this.setValue(value2);
77831
+ }
77832
+ });
77833
+ },
77817
77834
  updateFormModel(data2) {
77818
77835
  if (this.globalModel && this.globalModel.formModel) {
77819
77836
  this.globalModel.formModel[this.widget.options.name] = deepClone(data2);
@@ -77824,17 +77841,6 @@ const _sfc_main$c = {
77824
77841
  ]);
77825
77842
  }
77826
77843
  },
77827
- initTableData() {
77828
- if (this.fieldModel && Array.isArray(this.fieldModel)) {
77829
- this.tableData = deepClone(this.fieldModel);
77830
- } else if (this.widget.options.defaultValue && Array.isArray(this.widget.options.defaultValue)) {
77831
- this.tableData = deepClone(this.widget.options.defaultValue);
77832
- this.updateFormModel(this.tableData);
77833
- } else {
77834
- this.tableData = [];
77835
- this.updateFormModel([]);
77836
- }
77837
- },
77838
77844
  handleAddRow() {
77839
77845
  this.editingIndex = -1;
77840
77846
  this.dialogTitle = "\u65B0\u589E";
@@ -77932,6 +77938,13 @@ const _sfc_main$c = {
77932
77938
  });
77933
77939
  }
77934
77940
  }
77941
+ if (this.isTextColumn(col) && col.maxLength) {
77942
+ colRules.push({
77943
+ max: col.maxLength,
77944
+ message: `${col.label}\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7${col.maxLength}\u4E2A\u5B57\u7B26`,
77945
+ trigger: ["blur", "change"]
77946
+ });
77947
+ }
77935
77948
  if (colRules.length > 0) {
77936
77949
  rules[col.prop] = colRules;
77937
77950
  }
@@ -78012,6 +78025,12 @@ const _sfc_main$c = {
78012
78025
  this.dialogFormData._columnOptions = {};
78013
78026
  }
78014
78027
  },
78028
+ isTextColumn(col) {
78029
+ return !col.type || col.type === "input" || col.type === "textarea";
78030
+ },
78031
+ getColMaxLength(col) {
78032
+ return col.maxLength && col.maxLength > 0 ? col.maxLength : void 0;
78033
+ },
78015
78034
  getValue() {
78016
78035
  return this.tableData;
78017
78036
  },
@@ -78160,7 +78179,6 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
78160
78179
  }, toDisplayString($props.widget.options.label), 3),
78161
78180
  $props.widget.options.required ? (openBlock(), createElementBlock("span", _hoisted_2$7, "*")) : createCommentVNode("", true)
78162
78181
  ])) : createCommentVNode("", true),
78163
- createTextVNode(" " + toDisplayString($data.tableData) + " ", 1),
78164
78182
  createElementVNode("div", _hoisted_3$6, [
78165
78183
  !$props.widget.options.disabled ? (openBlock(), createBlock(_component_el_button, {
78166
78184
  key: 0,
@@ -78305,8 +78323,10 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
78305
78323
  "onUpdate:modelValue": ($event) => $data.dialogFormData[col.prop] = $event,
78306
78324
  placeholder: col.placeholder || `\u8BF7\u8F93\u5165${col.label}`,
78307
78325
  disabled: $props.widget.options.disabled,
78326
+ maxlength: $options.getColMaxLength(col),
78327
+ "show-word-limit": !!col.showWordLimit && !!col.maxLength,
78308
78328
  onChange: ($event) => $options.handleInputChange(col)
78309
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "onChange"])) : col.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
78329
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "maxlength", "show-word-limit", "onChange"])) : col.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
78310
78330
  key: 1,
78311
78331
  modelValue: $data.dialogFormData[col.prop],
78312
78332
  "onUpdate:modelValue": ($event) => $data.dialogFormData[col.prop] = $event,
@@ -78371,8 +78391,10 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
78371
78391
  placeholder: col.placeholder || `\u8BF7\u8F93\u5165${col.label}`,
78372
78392
  disabled: $props.widget.options.disabled,
78373
78393
  rows: col.rows || 3,
78394
+ maxlength: $options.getColMaxLength(col),
78395
+ "show-word-limit": !!col.showWordLimit && !!col.maxLength,
78374
78396
  onChange: ($event) => $options.handleInputChange(col)
78375
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "rows", "onChange"])) : createCommentVNode("", true)
78397
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "rows", "maxlength", "show-word-limit", "onChange"])) : createCommentVNode("", true)
78376
78398
  ]),
78377
78399
  _: 2
78378
78400
  }, 1032, ["label", "prop", "required"]);
@@ -78390,7 +78412,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
78390
78412
  _: 1
78391
78413
  }, 8, ["widget"]);
78392
78414
  }
78393
- var SubTableItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-69f3fc2b"]]);
78415
+ var SubTableItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-70478d6d"]]);
78394
78416
  var subTableColumnsEditor_vue_vue_type_style_index_0_scoped_true_lang = "";
78395
78417
  const _sfc_main$b = {
78396
78418
  name: "sub-table-columns-editor",
@@ -78437,6 +78459,17 @@ const _sfc_main$b = {
78437
78459
  }
78438
78460
  },
78439
78461
  methods: {
78462
+ isTextColumn(col) {
78463
+ return !col.type || col.type === "input" || col.type === "textarea";
78464
+ },
78465
+ handleMaxLengthInput(col, val) {
78466
+ if (!val || isNaN(val)) {
78467
+ col.maxLength = null;
78468
+ col.showWordLimit = false;
78469
+ } else {
78470
+ col.maxLength = Number(val);
78471
+ }
78472
+ },
78440
78473
  addNewColumn() {
78441
78474
  if (!this.optionModel.columns) {
78442
78475
  this.optionModel.columns = [];
@@ -78448,6 +78481,8 @@ const _sfc_main$b = {
78448
78481
  width: "",
78449
78482
  minWidth: "",
78450
78483
  placeholder: "",
78484
+ maxLength: null,
78485
+ showWordLimit: false,
78451
78486
  required: false,
78452
78487
  validation: "",
78453
78488
  validationHint: "",
@@ -78777,6 +78812,36 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
78777
78812
  ]),
78778
78813
  _: 2
78779
78814
  }, 1024),
78815
+ $options.isTextColumn(col) ? (openBlock(), createBlock(_component_el_form_item, {
78816
+ key: 1,
78817
+ label: _ctx.i18nt("designer.setting.maxLength")
78818
+ }, {
78819
+ default: withCtx(() => [
78820
+ createVNode(_component_el_input, {
78821
+ type: "number",
78822
+ class: "hide-spin-button",
78823
+ min: "1",
78824
+ "model-value": col.maxLength,
78825
+ placeholder: "\u4E0D\u9650",
78826
+ onInput: (val) => $options.handleMaxLengthInput(col, val),
78827
+ onChange: $options.handleColumnChange
78828
+ }, null, 8, ["model-value", "onInput", "onChange"])
78829
+ ]),
78830
+ _: 2
78831
+ }, 1032, ["label"])) : createCommentVNode("", true),
78832
+ $options.isTextColumn(col) && col.maxLength ? (openBlock(), createBlock(_component_el_form_item, {
78833
+ key: 2,
78834
+ label: _ctx.i18nt("designer.setting.showWordLimit")
78835
+ }, {
78836
+ default: withCtx(() => [
78837
+ createVNode(_component_el_switch, {
78838
+ modelValue: col.showWordLimit,
78839
+ "onUpdate:modelValue": ($event) => col.showWordLimit = $event,
78840
+ onChange: $options.handleColumnChange
78841
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
78842
+ ]),
78843
+ _: 2
78844
+ }, 1032, ["label"])) : createCommentVNode("", true),
78780
78845
  createVNode(_component_el_form_item, { label: "\u662F\u5426\u5FC5\u586B" }, {
78781
78846
  default: withCtx(() => [
78782
78847
  createVNode(_component_el_switch, {
@@ -78813,7 +78878,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
78813
78878
  _: 2
78814
78879
  }, 1024),
78815
78880
  col.validation ? (openBlock(), createBlock(_component_el_form_item, {
78816
- key: 1,
78881
+ key: 3,
78817
78882
  label: "\u6821\u9A8C\u5931\u8D25\u63D0\u793A"
78818
78883
  }, {
78819
78884
  default: withCtx(() => [
@@ -78827,7 +78892,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
78827
78892
  _: 2
78828
78893
  }, 1024)) : createCommentVNode("", true),
78829
78894
  col.type === "select" ? (openBlock(), createBlock(_component_el_form_item, {
78830
- key: 2,
78895
+ key: 4,
78831
78896
  label: "\u9009\u9879\u6570\u636E"
78832
78897
  }, {
78833
78898
  default: withCtx(() => [
@@ -78844,7 +78909,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
78844
78909
  _: 2
78845
78910
  }, 1024)) : createCommentVNode("", true),
78846
78911
  col.type === "select" ? (openBlock(), createBlock(_component_el_form_item, {
78847
- key: 3,
78912
+ key: 5,
78848
78913
  label: "onMounted\u4E8B\u4EF6"
78849
78914
  }, {
78850
78915
  default: withCtx(() => [
@@ -78872,7 +78937,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
78872
78937
  _: 2
78873
78938
  }, 1024)) : createCommentVNode("", true),
78874
78939
  col.type === "select" ? (openBlock(), createBlock(_component_el_form_item, {
78875
- key: 4,
78940
+ key: 6,
78876
78941
  label: "\u4F9D\u8D56\u5217\uFF08\u8054\u52A8\uFF09"
78877
78942
  }, {
78878
78943
  default: withCtx(() => [
@@ -78905,7 +78970,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
78905
78970
  _: 2
78906
78971
  }, 1024)) : createCommentVNode("", true),
78907
78972
  col.type === "select" && col.dependOn ? (openBlock(), createBlock(_component_el_form_item, {
78908
- key: 5,
78973
+ key: 7,
78909
78974
  label: "\u8054\u52A8\u5904\u7406\u51FD\u6570"
78910
78975
  }, {
78911
78976
  default: withCtx(() => [
@@ -78989,7 +79054,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
78989
79054
  _: 2
78990
79055
  }, 1024),
78991
79056
  col.type === "textarea" ? (openBlock(), createBlock(_component_el_form_item, {
78992
- key: 6,
79057
+ key: 8,
78993
79058
  label: "\u884C\u6570"
78994
79059
  }, {
78995
79060
  default: withCtx(() => [
@@ -79070,7 +79135,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
79070
79135
  }, 8, ["modelValue", "title"])
79071
79136
  ], 64);
79072
79137
  }
79073
- var SubTableColumnsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-2d1b4989"]]);
79138
+ var SubTableColumnsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-2401420e"]]);
79074
79139
  const _sfc_main$a = {
79075
79140
  name: "current-user-widget",
79076
79141
  componentName: "FieldWidget",
@@ -80106,17 +80171,25 @@ const _sfc_main$7 = {
80106
80171
  },
80107
80172
  applyFormJsonToRender(parsed) {
80108
80173
  this.formJson = parsed && parsed.widgetList && parsed.formConfig ? parsed : lodash.exports.cloneDeep(this.defaultFormJson);
80174
+ this.showForm = true;
80109
80175
  this.$nextTick(() => {
80110
80176
  const ref2 = this.$refs.detailFormRender;
80111
80177
  if (ref2 && typeof ref2.setFormJson === "function") {
80112
80178
  ref2.setFormJson(lodash.exports.cloneDeep(this.formJson));
80113
80179
  this.$nextTick(() => {
80180
+ this.applyFormDataToRender();
80114
80181
  this.flushPendingColHiddenOps();
80115
80182
  this.syncFormDisabledStatus();
80116
80183
  });
80117
80184
  }
80118
80185
  });
80119
80186
  },
80187
+ applyFormDataToRender() {
80188
+ const ref2 = this.$refs.detailFormRender;
80189
+ if (ref2 && typeof ref2.setFormData === "function" && this.formData) {
80190
+ ref2.setFormData(lodash.exports.cloneDeep(this.formData));
80191
+ }
80192
+ },
80120
80193
  setColHidden(colNames, hidden) {
80121
80194
  const names = Array.isArray(colNames) ? colNames : [colNames];
80122
80195
  this.pendingColHiddenOps.push({ names, hidden });
@@ -80137,7 +80210,6 @@ const _sfc_main$7 = {
80137
80210
  initFormData() {
80138
80211
  this.showForm = false;
80139
80212
  this.formData = lodash.exports.cloneDeep(this.currentRowData) || {};
80140
- console.log(this.formData, "formData");
80141
80213
  const code = this.typeJson;
80142
80214
  if (!code) {
80143
80215
  this.$message.error("\u672A\u627E\u5230\u8D44\u4EA7\u7C7B\u578B\u5BF9\u5E94\u7684\u8868\u5355\u914D\u7F6E");
@@ -80155,20 +80227,11 @@ const _sfc_main$7 = {
80155
80227
  let parsed;
80156
80228
  try {
80157
80229
  parsed = typeof data2.formJson === "string" ? JSON.parse(data2.formJson) : data2.formJson;
80158
- this.showForm = true;
80159
80230
  } catch (e) {
80160
80231
  console.error(e);
80161
80232
  parsed = null;
80162
80233
  }
80163
80234
  this.applyFormJsonToRender(parsed);
80164
- this.showForm = true;
80165
- setTimeout(() => {
80166
- const ref2 = this.$refs.detailFormRender;
80167
- if (!ref2) {
80168
- return;
80169
- }
80170
- ref2.setFormData(__spreadValues({}, this.formData));
80171
- }, 1e3);
80172
80235
  }).catch((err) => {
80173
80236
  console.error(err);
80174
80237
  this.applyFormJsonToRender(null);
@@ -80269,7 +80332,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
80269
80332
  _: 1
80270
80333
  }, 8, ["modelValue", "onClose"]);
80271
80334
  }
80272
- var DetailDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-7947e8f0"]]);
80335
+ var DetailDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-a20a039c"]]);
80273
80336
  var index_vue_vue_type_style_index_0_lang = "";
80274
80337
  const _sfc_main$6 = {
80275
80338
  name: "asset-table-widget",