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.
package/dist/render.es.js CHANGED
@@ -8719,6 +8719,16 @@ var fieldMixin = {
8719
8719
  }
8720
8720
  }
8721
8721
  },
8722
+ mounted() {
8723
+ var _a, _b, _c;
8724
+ if (!this.designState && ((_a = this.field) == null ? void 0 : _a.formItemFlag) && ((_c = (_b = this.field) == null ? void 0 : _b.options) == null ? void 0 : _c.onChange) && !this.subFormItemFlag) {
8725
+ this.$nextTick(() => {
8726
+ setTimeout(() => {
8727
+ this.handleOnChange(this.fieldModel, this.oldFieldValue);
8728
+ }, 300);
8729
+ });
8730
+ }
8731
+ },
8722
8732
  methods: {
8723
8733
  getDisabled() {
8724
8734
  return this.subFormDisabled === true || !!this.field && !!this.field.options && !!this.field.options.disabled;
@@ -8863,6 +8873,10 @@ var fieldMixin = {
8863
8873
  return;
8864
8874
  }
8865
8875
  this.rules.splice(0, this.rules.length);
8876
+ const formRef = this.getFormRef && this.getFormRef();
8877
+ if (formRef && typeof formRef.clearValidate === "function") {
8878
+ formRef.clearValidate(this.getPropName());
8879
+ }
8866
8880
  },
8867
8881
  getFieldRules() {
8868
8882
  return FormValidators;
@@ -8875,6 +8889,9 @@ var fieldMixin = {
8875
8889
  if (!!this.field.options.hidden && !this.designState) {
8876
8890
  return;
8877
8891
  }
8892
+ if (!this.designState && this.isInsideHiddenCol()) {
8893
+ return;
8894
+ }
8878
8895
  if (!!this.field.options.required) {
8879
8896
  this.rules.push({
8880
8897
  required: true,
@@ -9162,6 +9179,68 @@ var fieldMixin = {
9162
9179
  setAppendButtonDisabled(flag) {
9163
9180
  this.field.options.appendButtonDisabled = flag;
9164
9181
  },
9182
+ isInsideHiddenCol() {
9183
+ var _a, _b, _c;
9184
+ const formRef = this.getFormRef && this.getFormRef();
9185
+ const widgetList = ((_a = formRef == null ? void 0 : formRef.formJsonObj) == null ? void 0 : _a.widgetList) || (formRef == null ? void 0 : formRef.widgetList);
9186
+ if (!widgetList || !((_c = (_b = this.field) == null ? void 0 : _b.options) == null ? void 0 : _c.name)) {
9187
+ return false;
9188
+ }
9189
+ const fieldName = this.field.options.name;
9190
+ const findHiddenCol = (list) => {
9191
+ var _a2, _b2;
9192
+ if (!Array.isArray(list))
9193
+ return false;
9194
+ for (const w of list) {
9195
+ if (!w)
9196
+ continue;
9197
+ if (w.type === "grid" && Array.isArray(w.cols)) {
9198
+ for (const col of w.cols) {
9199
+ if (((_a2 = col == null ? void 0 : col.options) == null ? void 0 : _a2.hidden) && this.fieldExistsInList(col.widgetList, fieldName)) {
9200
+ return true;
9201
+ }
9202
+ if (findHiddenCol(col == null ? void 0 : col.widgetList))
9203
+ return true;
9204
+ }
9205
+ }
9206
+ if (w.type === "grid-col" && ((_b2 = w.options) == null ? void 0 : _b2.hidden) && this.fieldExistsInList(w.widgetList, fieldName)) {
9207
+ return true;
9208
+ }
9209
+ if (Array.isArray(w.widgetList) && findHiddenCol(w.widgetList))
9210
+ return true;
9211
+ if (Array.isArray(w.cols) && findHiddenCol(w.cols))
9212
+ return true;
9213
+ if (Array.isArray(w.tabs)) {
9214
+ for (const t of w.tabs) {
9215
+ if (findHiddenCol(t == null ? void 0 : t.widgetList))
9216
+ return true;
9217
+ }
9218
+ }
9219
+ }
9220
+ return false;
9221
+ };
9222
+ return findHiddenCol(widgetList);
9223
+ },
9224
+ fieldExistsInList(list, fieldName) {
9225
+ var _a;
9226
+ if (!Array.isArray(list) || !fieldName)
9227
+ return false;
9228
+ for (const w of list) {
9229
+ if (!w)
9230
+ continue;
9231
+ if (((_a = w.options) == null ? void 0 : _a.name) === fieldName)
9232
+ return true;
9233
+ if (this.fieldExistsInList(w.widgetList, fieldName))
9234
+ return true;
9235
+ if (Array.isArray(w.cols)) {
9236
+ for (const c of w.cols) {
9237
+ if (this.fieldExistsInList(c == null ? void 0 : c.widgetList, fieldName))
9238
+ return true;
9239
+ }
9240
+ }
9241
+ }
9242
+ return false;
9243
+ },
9165
9244
  setHidden(flag) {
9166
9245
  this.field.options.hidden = flag;
9167
9246
  if (!!flag) {
@@ -24701,7 +24780,8 @@ const _sfc_main$P = {
24701
24780
  if (this.designState)
24702
24781
  return;
24703
24782
  this.syncColFieldValidation(!!val);
24704
- }
24783
+ },
24784
+ immediate: true
24705
24785
  }
24706
24786
  },
24707
24787
  methods: {
@@ -24803,7 +24883,7 @@ function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
24803
24883
  key: $props.fieldSchemaData && $props.fieldSchemaData[swIdx] ? $props.fieldSchemaData[swIdx].id : swIdx,
24804
24884
  "parent-list": $props.widget.widgetList,
24805
24885
  "index-of-parent-list": swIdx,
24806
- "parent-widget": $props.parentWidget,
24886
+ "parent-widget": $props.widget,
24807
24887
  "sub-form-row-index": $props.subFormRowIndex,
24808
24888
  "sub-form-row-id": $props.subFormRowId,
24809
24889
  "sub-form-disabled": $props.subFormDisabled,
@@ -24833,7 +24913,7 @@ function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
24833
24913
  [vShow, $options.colVisible]
24834
24914
  ]) : createCommentVNode("", true);
24835
24915
  }
24836
- var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["render", _sfc_render$P], ["__scopeId", "data-v-535c3a84"]]);
24916
+ var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["render", _sfc_render$P], ["__scopeId", "data-v-315cc820"]]);
24837
24917
  var __glob_0_1$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24838
24918
  __proto__: null,
24839
24919
  "default": GridColItem
@@ -26352,6 +26432,7 @@ const _sfc_main$J = {
26352
26432
  if (!needValidation) {
26353
26433
  return this.formDataModel;
26354
26434
  }
26435
+ this.syncAllHiddenColFieldRules();
26355
26436
  let callback2 = function nullFunc() {
26356
26437
  };
26357
26438
  let promise = new window.Promise(function(resolve, reject) {
@@ -26376,6 +26457,43 @@ const _sfc_main$J = {
26376
26457
  });
26377
26458
  return promise;
26378
26459
  },
26460
+ syncAllHiddenColFieldRules() {
26461
+ const walk = (list) => {
26462
+ if (!Array.isArray(list))
26463
+ return;
26464
+ list.forEach((w) => {
26465
+ var _a;
26466
+ if (!w)
26467
+ return;
26468
+ if (w.type === "grid" && Array.isArray(w.cols)) {
26469
+ w.cols.forEach((col) => {
26470
+ var _a2;
26471
+ if ((_a2 = col == null ? void 0 : col.options) == null ? void 0 : _a2.hidden) {
26472
+ this.syncFieldRulesByCol(col, true);
26473
+ }
26474
+ walk(col == null ? void 0 : col.widgetList);
26475
+ });
26476
+ } else if (w.type === "grid-col") {
26477
+ if ((_a = w == null ? void 0 : w.options) == null ? void 0 : _a.hidden) {
26478
+ this.syncFieldRulesByCol(w, true);
26479
+ }
26480
+ walk(w.widgetList);
26481
+ } else {
26482
+ if (Array.isArray(w.widgetList))
26483
+ walk(w.widgetList);
26484
+ if (Array.isArray(w.cols))
26485
+ walk(w.cols);
26486
+ if (Array.isArray(w.tabs)) {
26487
+ w.tabs.forEach((t) => walk(t == null ? void 0 : t.widgetList));
26488
+ }
26489
+ if (Array.isArray(w.rows)) {
26490
+ w.rows.forEach((r) => Array.isArray(r == null ? void 0 : r.cols) && r.cols.forEach((c) => walk(c == null ? void 0 : c.widgetList)));
26491
+ }
26492
+ }
26493
+ });
26494
+ };
26495
+ walk(this.widgetList);
26496
+ },
26379
26497
  setFormData(formData) {
26380
26498
  Object.keys(this.formDataModel).forEach((propName) => {
26381
26499
  if (!!formData && formData.hasOwnProperty(propName)) {
@@ -26474,6 +26592,7 @@ const _sfc_main$J = {
26474
26592
  this.$refs.renderForm.clearValidate(props);
26475
26593
  },
26476
26594
  validateForm(callback2) {
26595
+ this.syncAllHiddenColFieldRules();
26477
26596
  this.$refs["renderForm"].validate((valid) => {
26478
26597
  if (valid && !!this.formConfig && !!this.formConfig.onFormValidateSuccess) {
26479
26598
  this.emitFormValidateSuccess(this.formDataModel);
@@ -26680,7 +26799,7 @@ function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
26680
26799
  _: 3
26681
26800
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
26682
26801
  }
26683
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$J], ["__scopeId", "data-v-289ea27b"]]);
26802
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$J], ["__scopeId", "data-v-cd88fba4"]]);
26684
26803
  function registerIcon(app) {
26685
26804
  app.component("el-icon-edit", edit);
26686
26805
  app.component("el-icon-minus", minus);
@@ -26695,13 +26814,13 @@ function registerIcon(app) {
26695
26814
  if (typeof window !== "undefined") {
26696
26815
  let loadSvg = function() {
26697
26816
  var body = document.body;
26698
- var svgDom = document.getElementById("__svg__icons__dom__1789605624806__");
26817
+ var svgDom = document.getElementById("__svg__icons__dom__1789606658031__");
26699
26818
  if (!svgDom) {
26700
26819
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26701
26820
  svgDom.style.position = "absolute";
26702
26821
  svgDom.style.width = "0";
26703
26822
  svgDom.style.height = "0";
26704
- svgDom.id = "__svg__icons__dom__1789605624806__";
26823
+ svgDom.id = "__svg__icons__dom__1789606658031__";
26705
26824
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
26706
26825
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
26707
26826
  }