form-custom-test 3.0.244 → 3.0.245

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.
@@ -10726,6 +10726,16 @@ var fieldMixin = {
10726
10726
  }
10727
10727
  }
10728
10728
  },
10729
+ mounted() {
10730
+ var _a2, _b2, _c2;
10731
+ if (!this.designState && ((_a2 = this.field) == null ? void 0 : _a2.formItemFlag) && ((_c2 = (_b2 = this.field) == null ? void 0 : _b2.options) == null ? void 0 : _c2.onChange) && !this.subFormItemFlag) {
10732
+ this.$nextTick(() => {
10733
+ setTimeout(() => {
10734
+ this.handleOnChange(this.fieldModel, this.oldFieldValue);
10735
+ }, 300);
10736
+ });
10737
+ }
10738
+ },
10729
10739
  methods: {
10730
10740
  getDisabled() {
10731
10741
  return this.subFormDisabled === true || !!this.field && !!this.field.options && !!this.field.options.disabled;
@@ -10870,6 +10880,10 @@ var fieldMixin = {
10870
10880
  return;
10871
10881
  }
10872
10882
  this.rules.splice(0, this.rules.length);
10883
+ const formRef = this.getFormRef && this.getFormRef();
10884
+ if (formRef && typeof formRef.clearValidate === "function") {
10885
+ formRef.clearValidate(this.getPropName());
10886
+ }
10873
10887
  },
10874
10888
  getFieldRules() {
10875
10889
  return FormValidators;
@@ -10882,6 +10896,9 @@ var fieldMixin = {
10882
10896
  if (!!this.field.options.hidden && !this.designState) {
10883
10897
  return;
10884
10898
  }
10899
+ if (!this.designState && this.isInsideHiddenCol()) {
10900
+ return;
10901
+ }
10885
10902
  if (!!this.field.options.required) {
10886
10903
  this.rules.push({
10887
10904
  required: true,
@@ -11169,6 +11186,68 @@ var fieldMixin = {
11169
11186
  setAppendButtonDisabled(flag) {
11170
11187
  this.field.options.appendButtonDisabled = flag;
11171
11188
  },
11189
+ isInsideHiddenCol() {
11190
+ var _a2, _b2, _c2;
11191
+ const formRef = this.getFormRef && this.getFormRef();
11192
+ const widgetList2 = ((_a2 = formRef == null ? void 0 : formRef.formJsonObj) == null ? void 0 : _a2.widgetList) || (formRef == null ? void 0 : formRef.widgetList);
11193
+ if (!widgetList2 || !((_c2 = (_b2 = this.field) == null ? void 0 : _b2.options) == null ? void 0 : _c2.name)) {
11194
+ return false;
11195
+ }
11196
+ const fieldName = this.field.options.name;
11197
+ const findHiddenCol = (list) => {
11198
+ var _a3, _b3;
11199
+ if (!Array.isArray(list))
11200
+ return false;
11201
+ for (const w of list) {
11202
+ if (!w)
11203
+ continue;
11204
+ if (w.type === "grid" && Array.isArray(w.cols)) {
11205
+ for (const col of w.cols) {
11206
+ if (((_a3 = col == null ? void 0 : col.options) == null ? void 0 : _a3.hidden) && this.fieldExistsInList(col.widgetList, fieldName)) {
11207
+ return true;
11208
+ }
11209
+ if (findHiddenCol(col == null ? void 0 : col.widgetList))
11210
+ return true;
11211
+ }
11212
+ }
11213
+ if (w.type === "grid-col" && ((_b3 = w.options) == null ? void 0 : _b3.hidden) && this.fieldExistsInList(w.widgetList, fieldName)) {
11214
+ return true;
11215
+ }
11216
+ if (Array.isArray(w.widgetList) && findHiddenCol(w.widgetList))
11217
+ return true;
11218
+ if (Array.isArray(w.cols) && findHiddenCol(w.cols))
11219
+ return true;
11220
+ if (Array.isArray(w.tabs)) {
11221
+ for (const t of w.tabs) {
11222
+ if (findHiddenCol(t == null ? void 0 : t.widgetList))
11223
+ return true;
11224
+ }
11225
+ }
11226
+ }
11227
+ return false;
11228
+ };
11229
+ return findHiddenCol(widgetList2);
11230
+ },
11231
+ fieldExistsInList(list, fieldName) {
11232
+ var _a2;
11233
+ if (!Array.isArray(list) || !fieldName)
11234
+ return false;
11235
+ for (const w of list) {
11236
+ if (!w)
11237
+ continue;
11238
+ if (((_a2 = w.options) == null ? void 0 : _a2.name) === fieldName)
11239
+ return true;
11240
+ if (this.fieldExistsInList(w.widgetList, fieldName))
11241
+ return true;
11242
+ if (Array.isArray(w.cols)) {
11243
+ for (const c of w.cols) {
11244
+ if (this.fieldExistsInList(c == null ? void 0 : c.widgetList, fieldName))
11245
+ return true;
11246
+ }
11247
+ }
11248
+ }
11249
+ return false;
11250
+ },
11172
11251
  setHidden(flag) {
11173
11252
  this.field.options.hidden = flag;
11174
11253
  if (!!flag) {
@@ -26708,7 +26787,8 @@ const _sfc_main$3f = {
26708
26787
  if (this.designState)
26709
26788
  return;
26710
26789
  this.syncColFieldValidation(!!val);
26711
- }
26790
+ },
26791
+ immediate: true
26712
26792
  }
26713
26793
  },
26714
26794
  methods: {
@@ -26810,7 +26890,7 @@ function _sfc_render$3f(_ctx, _cache, $props, $setup, $data, $options) {
26810
26890
  key: $props.fieldSchemaData && $props.fieldSchemaData[swIdx] ? $props.fieldSchemaData[swIdx].id : swIdx,
26811
26891
  "parent-list": $props.widget.widgetList,
26812
26892
  "index-of-parent-list": swIdx,
26813
- "parent-widget": $props.parentWidget,
26893
+ "parent-widget": $props.widget,
26814
26894
  "sub-form-row-index": $props.subFormRowIndex,
26815
26895
  "sub-form-row-id": $props.subFormRowId,
26816
26896
  "sub-form-disabled": $props.subFormDisabled,
@@ -26840,7 +26920,7 @@ function _sfc_render$3f(_ctx, _cache, $props, $setup, $data, $options) {
26840
26920
  [vShow, $options.colVisible]
26841
26921
  ]) : createCommentVNode("", true);
26842
26922
  }
26843
- var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$3f, [["render", _sfc_render$3f], ["__scopeId", "data-v-535c3a84"]]);
26923
+ var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$3f, [["render", _sfc_render$3f], ["__scopeId", "data-v-315cc820"]]);
26844
26924
  var __glob_0_1$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
26845
26925
  __proto__: null,
26846
26926
  "default": GridColItem
@@ -28359,6 +28439,7 @@ const _sfc_main$39 = {
28359
28439
  if (!needValidation) {
28360
28440
  return this.formDataModel;
28361
28441
  }
28442
+ this.syncAllHiddenColFieldRules();
28362
28443
  let callback2 = function nullFunc() {
28363
28444
  };
28364
28445
  let promise = new window.Promise(function(resolve, reject) {
@@ -28383,6 +28464,43 @@ const _sfc_main$39 = {
28383
28464
  });
28384
28465
  return promise;
28385
28466
  },
28467
+ syncAllHiddenColFieldRules() {
28468
+ const walk = (list) => {
28469
+ if (!Array.isArray(list))
28470
+ return;
28471
+ list.forEach((w) => {
28472
+ var _a2;
28473
+ if (!w)
28474
+ return;
28475
+ if (w.type === "grid" && Array.isArray(w.cols)) {
28476
+ w.cols.forEach((col) => {
28477
+ var _a3;
28478
+ if ((_a3 = col == null ? void 0 : col.options) == null ? void 0 : _a3.hidden) {
28479
+ this.syncFieldRulesByCol(col, true);
28480
+ }
28481
+ walk(col == null ? void 0 : col.widgetList);
28482
+ });
28483
+ } else if (w.type === "grid-col") {
28484
+ if ((_a2 = w == null ? void 0 : w.options) == null ? void 0 : _a2.hidden) {
28485
+ this.syncFieldRulesByCol(w, true);
28486
+ }
28487
+ walk(w.widgetList);
28488
+ } else {
28489
+ if (Array.isArray(w.widgetList))
28490
+ walk(w.widgetList);
28491
+ if (Array.isArray(w.cols))
28492
+ walk(w.cols);
28493
+ if (Array.isArray(w.tabs)) {
28494
+ w.tabs.forEach((t) => walk(t == null ? void 0 : t.widgetList));
28495
+ }
28496
+ if (Array.isArray(w.rows)) {
28497
+ w.rows.forEach((r) => Array.isArray(r == null ? void 0 : r.cols) && r.cols.forEach((c) => walk(c == null ? void 0 : c.widgetList)));
28498
+ }
28499
+ }
28500
+ });
28501
+ };
28502
+ walk(this.widgetList);
28503
+ },
28386
28504
  setFormData(formData) {
28387
28505
  Object.keys(this.formDataModel).forEach((propName) => {
28388
28506
  if (!!formData && formData.hasOwnProperty(propName)) {
@@ -28481,6 +28599,7 @@ const _sfc_main$39 = {
28481
28599
  this.$refs.renderForm.clearValidate(props);
28482
28600
  },
28483
28601
  validateForm(callback2) {
28602
+ this.syncAllHiddenColFieldRules();
28484
28603
  this.$refs["renderForm"].validate((valid) => {
28485
28604
  if (valid && !!this.formConfig && !!this.formConfig.onFormValidateSuccess) {
28486
28605
  this.emitFormValidateSuccess(this.formDataModel);
@@ -28687,7 +28806,7 @@ function _sfc_render$39(_ctx, _cache, $props, $setup, $data, $options) {
28687
28806
  _: 3
28688
28807
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
28689
28808
  }
28690
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$39, [["render", _sfc_render$39], ["__scopeId", "data-v-289ea27b"]]);
28809
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$39, [["render", _sfc_render$39], ["__scopeId", "data-v-cd88fba4"]]);
28691
28810
  var ace$2 = { exports: {} };
28692
28811
  (function(module, exports) {
28693
28812
  (function() {
@@ -69444,13 +69563,13 @@ function registerIcon(app) {
69444
69563
  if (typeof window !== "undefined") {
69445
69564
  let loadSvg = function() {
69446
69565
  var body = document.body;
69447
- var svgDom = document.getElementById("__svg__icons__dom__1789605616296__");
69566
+ var svgDom = document.getElementById("__svg__icons__dom__1789606646660__");
69448
69567
  if (!svgDom) {
69449
69568
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
69450
69569
  svgDom.style.position = "absolute";
69451
69570
  svgDom.style.width = "0";
69452
69571
  svgDom.style.height = "0";
69453
- svgDom.id = "__svg__icons__dom__1789605616296__";
69572
+ svgDom.id = "__svg__icons__dom__1789606646660__";
69454
69573
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
69455
69574
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
69456
69575
  }