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.
package/dist/render.es.js CHANGED
@@ -25818,6 +25818,13 @@ const _sfc_main$y = {
25818
25818
  }
25819
25819
  });
25820
25820
  }
25821
+ } else if (wItem.type === "sub-table" && wItem.formItemFlag) {
25822
+ let fieldName = wItem.options.name;
25823
+ if (!this.formData.hasOwnProperty(fieldName)) {
25824
+ this.formDataModel[fieldName] = deepClone(wItem.options.defaultValue || []);
25825
+ } else {
25826
+ this.formDataModel[fieldName] = deepClone(this.formData[fieldName]);
25827
+ }
25821
25828
  } else if (wItem.type === "sub-form") {
25822
25829
  let subFormName = wItem.options.name;
25823
25830
  if (!this.formData.hasOwnProperty(subFormName)) {
@@ -26495,7 +26502,7 @@ function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
26495
26502
  _: 3
26496
26503
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
26497
26504
  }
26498
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["render", _sfc_render$y], ["__scopeId", "data-v-3d429201"]]);
26505
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["render", _sfc_render$y], ["__scopeId", "data-v-7129091e"]]);
26499
26506
  function registerIcon(app) {
26500
26507
  app.component("el-icon-edit", edit);
26501
26508
  app.component("el-icon-minus", minus);
@@ -26510,13 +26517,13 @@ function registerIcon(app) {
26510
26517
  if (typeof window !== "undefined") {
26511
26518
  let loadSvg = function() {
26512
26519
  var body = document.body;
26513
- var svgDom = document.getElementById("__svg__icons__dom__1780624459666__");
26520
+ var svgDom = document.getElementById("__svg__icons__dom__1780627781215__");
26514
26521
  if (!svgDom) {
26515
26522
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26516
26523
  svgDom.style.position = "absolute";
26517
26524
  svgDom.style.width = "0";
26518
26525
  svgDom.style.height = "0";
26519
- svgDom.id = "__svg__icons__dom__1780624459666__";
26526
+ svgDom.id = "__svg__icons__dom__1780627781215__";
26520
26527
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
26521
26528
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
26522
26529
  }
@@ -36277,15 +36284,25 @@ const _sfc_main$d = {
36277
36284
  },
36278
36285
  created() {
36279
36286
  this.initRefList();
36280
- this.initTableData();
36281
- },
36282
- mounted() {
36283
- this.initTableData();
36287
+ this.initEventHandler();
36284
36288
  },
36285
36289
  beforeUnmount() {
36286
36290
  this.unregisterFromRefList();
36287
36291
  },
36288
36292
  methods: {
36293
+ initEventHandler() {
36294
+ this.on$("setFormData", (newFormData) => {
36295
+ var _a, _b;
36296
+ const fieldName = (_b = (_a = this.widget) == null ? void 0 : _a.options) == null ? void 0 : _b.name;
36297
+ if (!fieldName || !newFormData) {
36298
+ return;
36299
+ }
36300
+ const value2 = newFormData[fieldName];
36301
+ if (Array.isArray(value2)) {
36302
+ this.setValue(value2);
36303
+ }
36304
+ });
36305
+ },
36289
36306
  updateFormModel(data2) {
36290
36307
  if (this.globalModel && this.globalModel.formModel) {
36291
36308
  this.globalModel.formModel[this.widget.options.name] = deepClone(data2);
@@ -36296,17 +36313,6 @@ const _sfc_main$d = {
36296
36313
  ]);
36297
36314
  }
36298
36315
  },
36299
- initTableData() {
36300
- if (this.fieldModel && Array.isArray(this.fieldModel)) {
36301
- this.tableData = deepClone(this.fieldModel);
36302
- } else if (this.widget.options.defaultValue && Array.isArray(this.widget.options.defaultValue)) {
36303
- this.tableData = deepClone(this.widget.options.defaultValue);
36304
- this.updateFormModel(this.tableData);
36305
- } else {
36306
- this.tableData = [];
36307
- this.updateFormModel([]);
36308
- }
36309
- },
36310
36316
  handleAddRow() {
36311
36317
  this.editingIndex = -1;
36312
36318
  this.dialogTitle = "\u65B0\u589E";
@@ -36404,6 +36410,13 @@ const _sfc_main$d = {
36404
36410
  });
36405
36411
  }
36406
36412
  }
36413
+ if (this.isTextColumn(col) && col.maxLength) {
36414
+ colRules.push({
36415
+ max: col.maxLength,
36416
+ message: `${col.label}\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7${col.maxLength}\u4E2A\u5B57\u7B26`,
36417
+ trigger: ["blur", "change"]
36418
+ });
36419
+ }
36407
36420
  if (colRules.length > 0) {
36408
36421
  rules[col.prop] = colRules;
36409
36422
  }
@@ -36484,6 +36497,12 @@ const _sfc_main$d = {
36484
36497
  this.dialogFormData._columnOptions = {};
36485
36498
  }
36486
36499
  },
36500
+ isTextColumn(col) {
36501
+ return !col.type || col.type === "input" || col.type === "textarea";
36502
+ },
36503
+ getColMaxLength(col) {
36504
+ return col.maxLength && col.maxLength > 0 ? col.maxLength : void 0;
36505
+ },
36487
36506
  getValue() {
36488
36507
  return this.tableData;
36489
36508
  },
@@ -36632,7 +36651,6 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
36632
36651
  }, toDisplayString($props.widget.options.label), 3),
36633
36652
  $props.widget.options.required ? (openBlock(), createElementBlock("span", _hoisted_2$8, "*")) : createCommentVNode("", true)
36634
36653
  ])) : createCommentVNode("", true),
36635
- createTextVNode(" " + toDisplayString($data.tableData) + " ", 1),
36636
36654
  createElementVNode("div", _hoisted_3$6, [
36637
36655
  !$props.widget.options.disabled ? (openBlock(), createBlock(_component_el_button, {
36638
36656
  key: 0,
@@ -36777,8 +36795,10 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
36777
36795
  "onUpdate:modelValue": ($event) => $data.dialogFormData[col.prop] = $event,
36778
36796
  placeholder: col.placeholder || `\u8BF7\u8F93\u5165${col.label}`,
36779
36797
  disabled: $props.widget.options.disabled,
36798
+ maxlength: $options.getColMaxLength(col),
36799
+ "show-word-limit": !!col.showWordLimit && !!col.maxLength,
36780
36800
  onChange: ($event) => $options.handleInputChange(col)
36781
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "onChange"])) : col.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
36801
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "maxlength", "show-word-limit", "onChange"])) : col.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
36782
36802
  key: 1,
36783
36803
  modelValue: $data.dialogFormData[col.prop],
36784
36804
  "onUpdate:modelValue": ($event) => $data.dialogFormData[col.prop] = $event,
@@ -36843,8 +36863,10 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
36843
36863
  placeholder: col.placeholder || `\u8BF7\u8F93\u5165${col.label}`,
36844
36864
  disabled: $props.widget.options.disabled,
36845
36865
  rows: col.rows || 3,
36866
+ maxlength: $options.getColMaxLength(col),
36867
+ "show-word-limit": !!col.showWordLimit && !!col.maxLength,
36846
36868
  onChange: ($event) => $options.handleInputChange(col)
36847
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "rows", "onChange"])) : createCommentVNode("", true)
36869
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "rows", "maxlength", "show-word-limit", "onChange"])) : createCommentVNode("", true)
36848
36870
  ]),
36849
36871
  _: 2
36850
36872
  }, 1032, ["label", "prop", "required"]);
@@ -36862,7 +36884,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
36862
36884
  _: 1
36863
36885
  }, 8, ["widget"]);
36864
36886
  }
36865
- var SubTableItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$d], ["__scopeId", "data-v-69f3fc2b"]]);
36887
+ var SubTableItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$d], ["__scopeId", "data-v-70478d6d"]]);
36866
36888
  var ace$2 = { exports: {} };
36867
36889
  (function(module, exports) {
36868
36890
  (function() {
@@ -61456,6 +61478,17 @@ const _sfc_main$b = {
61456
61478
  }
61457
61479
  },
61458
61480
  methods: {
61481
+ isTextColumn(col) {
61482
+ return !col.type || col.type === "input" || col.type === "textarea";
61483
+ },
61484
+ handleMaxLengthInput(col, val) {
61485
+ if (!val || isNaN(val)) {
61486
+ col.maxLength = null;
61487
+ col.showWordLimit = false;
61488
+ } else {
61489
+ col.maxLength = Number(val);
61490
+ }
61491
+ },
61459
61492
  addNewColumn() {
61460
61493
  if (!this.optionModel.columns) {
61461
61494
  this.optionModel.columns = [];
@@ -61467,6 +61500,8 @@ const _sfc_main$b = {
61467
61500
  width: "",
61468
61501
  minWidth: "",
61469
61502
  placeholder: "",
61503
+ maxLength: null,
61504
+ showWordLimit: false,
61470
61505
  required: false,
61471
61506
  validation: "",
61472
61507
  validationHint: "",
@@ -61796,6 +61831,36 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
61796
61831
  ]),
61797
61832
  _: 2
61798
61833
  }, 1024),
61834
+ $options.isTextColumn(col) ? (openBlock(), createBlock(_component_el_form_item, {
61835
+ key: 1,
61836
+ label: _ctx.i18nt("designer.setting.maxLength")
61837
+ }, {
61838
+ default: withCtx(() => [
61839
+ createVNode(_component_el_input, {
61840
+ type: "number",
61841
+ class: "hide-spin-button",
61842
+ min: "1",
61843
+ "model-value": col.maxLength,
61844
+ placeholder: "\u4E0D\u9650",
61845
+ onInput: (val) => $options.handleMaxLengthInput(col, val),
61846
+ onChange: $options.handleColumnChange
61847
+ }, null, 8, ["model-value", "onInput", "onChange"])
61848
+ ]),
61849
+ _: 2
61850
+ }, 1032, ["label"])) : createCommentVNode("", true),
61851
+ $options.isTextColumn(col) && col.maxLength ? (openBlock(), createBlock(_component_el_form_item, {
61852
+ key: 2,
61853
+ label: _ctx.i18nt("designer.setting.showWordLimit")
61854
+ }, {
61855
+ default: withCtx(() => [
61856
+ createVNode(_component_el_switch, {
61857
+ modelValue: col.showWordLimit,
61858
+ "onUpdate:modelValue": ($event) => col.showWordLimit = $event,
61859
+ onChange: $options.handleColumnChange
61860
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
61861
+ ]),
61862
+ _: 2
61863
+ }, 1032, ["label"])) : createCommentVNode("", true),
61799
61864
  createVNode(_component_el_form_item, { label: "\u662F\u5426\u5FC5\u586B" }, {
61800
61865
  default: withCtx(() => [
61801
61866
  createVNode(_component_el_switch, {
@@ -61832,7 +61897,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
61832
61897
  _: 2
61833
61898
  }, 1024),
61834
61899
  col.validation ? (openBlock(), createBlock(_component_el_form_item, {
61835
- key: 1,
61900
+ key: 3,
61836
61901
  label: "\u6821\u9A8C\u5931\u8D25\u63D0\u793A"
61837
61902
  }, {
61838
61903
  default: withCtx(() => [
@@ -61846,7 +61911,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
61846
61911
  _: 2
61847
61912
  }, 1024)) : createCommentVNode("", true),
61848
61913
  col.type === "select" ? (openBlock(), createBlock(_component_el_form_item, {
61849
- key: 2,
61914
+ key: 4,
61850
61915
  label: "\u9009\u9879\u6570\u636E"
61851
61916
  }, {
61852
61917
  default: withCtx(() => [
@@ -61863,7 +61928,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
61863
61928
  _: 2
61864
61929
  }, 1024)) : createCommentVNode("", true),
61865
61930
  col.type === "select" ? (openBlock(), createBlock(_component_el_form_item, {
61866
- key: 3,
61931
+ key: 5,
61867
61932
  label: "onMounted\u4E8B\u4EF6"
61868
61933
  }, {
61869
61934
  default: withCtx(() => [
@@ -61891,7 +61956,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
61891
61956
  _: 2
61892
61957
  }, 1024)) : createCommentVNode("", true),
61893
61958
  col.type === "select" ? (openBlock(), createBlock(_component_el_form_item, {
61894
- key: 4,
61959
+ key: 6,
61895
61960
  label: "\u4F9D\u8D56\u5217\uFF08\u8054\u52A8\uFF09"
61896
61961
  }, {
61897
61962
  default: withCtx(() => [
@@ -61924,7 +61989,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
61924
61989
  _: 2
61925
61990
  }, 1024)) : createCommentVNode("", true),
61926
61991
  col.type === "select" && col.dependOn ? (openBlock(), createBlock(_component_el_form_item, {
61927
- key: 5,
61992
+ key: 7,
61928
61993
  label: "\u8054\u52A8\u5904\u7406\u51FD\u6570"
61929
61994
  }, {
61930
61995
  default: withCtx(() => [
@@ -62008,7 +62073,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
62008
62073
  _: 2
62009
62074
  }, 1024),
62010
62075
  col.type === "textarea" ? (openBlock(), createBlock(_component_el_form_item, {
62011
- key: 6,
62076
+ key: 8,
62012
62077
  label: "\u884C\u6570"
62013
62078
  }, {
62014
62079
  default: withCtx(() => [
@@ -62089,7 +62154,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
62089
62154
  }, 8, ["modelValue", "title"])
62090
62155
  ], 64);
62091
62156
  }
62092
- var SubTableColumnsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-2d1b4989"]]);
62157
+ var SubTableColumnsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-2401420e"]]);
62093
62158
  const _sfc_main$a = {
62094
62159
  name: "current-user-widget",
62095
62160
  componentName: "FieldWidget",
@@ -63125,17 +63190,25 @@ const _sfc_main$7 = {
63125
63190
  },
63126
63191
  applyFormJsonToRender(parsed) {
63127
63192
  this.formJson = parsed && parsed.widgetList && parsed.formConfig ? parsed : lodash.exports.cloneDeep(this.defaultFormJson);
63193
+ this.showForm = true;
63128
63194
  this.$nextTick(() => {
63129
63195
  const ref2 = this.$refs.detailFormRender;
63130
63196
  if (ref2 && typeof ref2.setFormJson === "function") {
63131
63197
  ref2.setFormJson(lodash.exports.cloneDeep(this.formJson));
63132
63198
  this.$nextTick(() => {
63199
+ this.applyFormDataToRender();
63133
63200
  this.flushPendingColHiddenOps();
63134
63201
  this.syncFormDisabledStatus();
63135
63202
  });
63136
63203
  }
63137
63204
  });
63138
63205
  },
63206
+ applyFormDataToRender() {
63207
+ const ref2 = this.$refs.detailFormRender;
63208
+ if (ref2 && typeof ref2.setFormData === "function" && this.formData) {
63209
+ ref2.setFormData(lodash.exports.cloneDeep(this.formData));
63210
+ }
63211
+ },
63139
63212
  setColHidden(colNames, hidden) {
63140
63213
  const names = Array.isArray(colNames) ? colNames : [colNames];
63141
63214
  this.pendingColHiddenOps.push({ names, hidden });
@@ -63156,7 +63229,6 @@ const _sfc_main$7 = {
63156
63229
  initFormData() {
63157
63230
  this.showForm = false;
63158
63231
  this.formData = lodash.exports.cloneDeep(this.currentRowData) || {};
63159
- console.log(this.formData, "formData");
63160
63232
  const code = this.typeJson;
63161
63233
  if (!code) {
63162
63234
  this.$message.error("\u672A\u627E\u5230\u8D44\u4EA7\u7C7B\u578B\u5BF9\u5E94\u7684\u8868\u5355\u914D\u7F6E");
@@ -63174,20 +63246,11 @@ const _sfc_main$7 = {
63174
63246
  let parsed;
63175
63247
  try {
63176
63248
  parsed = typeof data2.formJson === "string" ? JSON.parse(data2.formJson) : data2.formJson;
63177
- this.showForm = true;
63178
63249
  } catch (e) {
63179
63250
  console.error(e);
63180
63251
  parsed = null;
63181
63252
  }
63182
63253
  this.applyFormJsonToRender(parsed);
63183
- this.showForm = true;
63184
- setTimeout(() => {
63185
- const ref2 = this.$refs.detailFormRender;
63186
- if (!ref2) {
63187
- return;
63188
- }
63189
- ref2.setFormData(__spreadValues({}, this.formData));
63190
- }, 1e3);
63191
63254
  }).catch((err) => {
63192
63255
  console.error(err);
63193
63256
  this.applyFormJsonToRender(null);
@@ -63288,7 +63351,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
63288
63351
  _: 1
63289
63352
  }, 8, ["modelValue", "onClose"]);
63290
63353
  }
63291
- var DetailDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-7947e8f0"]]);
63354
+ var DetailDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-a20a039c"]]);
63292
63355
  var index_vue_vue_type_style_index_0_lang = "";
63293
63356
  const _sfc_main$6 = {
63294
63357
  name: "asset-table-widget",