form-custom-test 3.0.159 → 3.0.161

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.
@@ -31,7 +31,7 @@ var __objRest = (source2, exclude) => {
31
31
  };
32
32
  var _a, _b, _c;
33
33
  import * as vue from "vue";
34
- import { reactive, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, resolveComponent, createBlock, withCtx, createVNode, createTextVNode, Fragment, renderList, renderSlot, normalizeStyle, withModifiers, defineComponent, createSlots, watch, ref, onBeforeUnmount, onMounted, onUnmounted, withDirectives, mergeProps, resolveDynamicComponent, vShow, resolveDirective, isVNode } from "vue";
34
+ import { reactive, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, resolveComponent, createBlock, withCtx, createVNode, createTextVNode, Fragment, renderList, renderSlot, normalizeStyle, withModifiers, withDirectives, vShow, defineComponent, createSlots, watch, ref, onBeforeUnmount, onMounted, onUnmounted, mergeProps, resolveDynamicComponent, resolveDirective, isVNode } from "vue";
35
35
  import { ElMessage } from "element-plus";
36
36
  import require$$1 from "sortablejs";
37
37
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -4850,7 +4850,7 @@ const getRegExp = function(validatorName2) {
4850
4850
  maxLen10Decimals2: "/^\\d{1,10}(\\.\\d{1,2})?$/",
4851
4851
  maxLen12Decimals2: "/^\\d{1,12}(\\.\\d{1,2})?$/",
4852
4852
  latitude: "/^-?(?:90(?:\\.0{1,6})?|[1-8]?\\d(?:\\.\\d{1,6})?|0(?:\\.\\d{1,6})?)$/",
4853
- sixFigures: "/^\\d{1,6}(\\.\\d{1,6})?$/",
4853
+ sixFigures: "/^(0|[1-9]\\d{0,5})(\\.\\d{1,6})?$/",
4854
4854
  percentage: "/^(?:100(?:\\.0{0,4})?|[1-9]?\\d(?:\\.\\d{0,4})?|0(?:\\.\\d{0,4})?)$/",
4855
4855
  longitude: "/^-?(?:180(?:\\.0{1,6})?|1[0-7]\\d(?:\\.\\d{1,6})?|[1-9]?\\d(?:\\.\\d{1,6})?|0(?:\\.\\d{1,6})?)$/"
4856
4856
  };
@@ -10568,10 +10568,13 @@ var fieldMixin = {
10568
10568
  this.rules.splice(0, this.rules.length);
10569
10569
  },
10570
10570
  buildFieldRules() {
10571
- if (!this.field.formItemFlag && this.field.options.hidden) {
10571
+ if (!this.field.formItemFlag) {
10572
10572
  return;
10573
10573
  }
10574
10574
  this.rules.splice(0, this.rules.length);
10575
+ if (!!this.field.options.hidden && !this.designState) {
10576
+ return;
10577
+ }
10575
10578
  if (!!this.field.options.required) {
10576
10579
  this.rules.push({
10577
10580
  required: true,
@@ -10743,6 +10746,10 @@ var fieldMixin = {
10743
10746
  return formRef && typeof formRef.findColByName === "function" ? formRef.findColByName(null, colName) : null;
10744
10747
  },
10745
10748
  setColHidden(colName, hidden) {
10749
+ const formRef = this.getFormRef();
10750
+ if (formRef && typeof formRef.setColHidden === "function") {
10751
+ return formRef.setColHidden(colName, hidden);
10752
+ }
10746
10753
  const hiddenVal = !!hidden;
10747
10754
  if (Array.isArray(colName)) {
10748
10755
  let anySet = false;
@@ -11221,7 +11228,7 @@ function _sfc_render$3w(_ctx, _cache, $props, $setup, $data, $options) {
11221
11228
  return openBlock(), createElementBlock("div", {
11222
11229
  class: normalizeClass(["field-wrapper", { "design-time-bottom-margin": !!this.designer }])
11223
11230
  }, [
11224
- !!$props.field.formItemFlag && (!$props.field.options.hidden || $props.designState === true) ? (openBlock(), createBlock(_component_el_form_item, {
11231
+ !!$props.field.formItemFlag ? withDirectives((openBlock(), createBlock(_component_el_form_item, {
11225
11232
  key: 0,
11226
11233
  label: $options.label,
11227
11234
  "label-width": $options.labelWidth + "px",
@@ -11285,7 +11292,9 @@ function _sfc_render$3w(_ctx, _cache, $props, $setup, $data, $options) {
11285
11292
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
11286
11293
  ]),
11287
11294
  _: 3
11288
- }, 8, ["label", "label-width", "title", "rules", "prop", "class"])) : createCommentVNode("", true),
11295
+ }, 8, ["label", "label-width", "title", "rules", "prop", "class"])), [
11296
+ [vShow, $props.designState === true || !$props.field.options.hidden]
11297
+ ]) : createCommentVNode("", true),
11289
11298
  !!this.designer ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
11290
11299
  $props.designer.selectedId === $props.field.id ? (openBlock(), createElementBlock("div", _hoisted_2$B, [
11291
11300
  createElementVNode("i", {
@@ -11329,7 +11338,7 @@ function _sfc_render$3w(_ctx, _cache, $props, $setup, $data, $options) {
11329
11338
  ], 64)) : createCommentVNode("", true)
11330
11339
  ], 2);
11331
11340
  }
11332
- var FormItemWrapper = /* @__PURE__ */ _export_sfc$1(_sfc_main$3w, [["render", _sfc_render$3w], ["__scopeId", "data-v-eed9a7f0"]]);
11341
+ var FormItemWrapper = /* @__PURE__ */ _export_sfc$1(_sfc_main$3w, [["render", _sfc_render$3w], ["__scopeId", "data-v-a42827ee"]]);
11333
11342
  var __glob_0_8$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11334
11343
  __proto__: null,
11335
11344
  "default": FormItemWrapper
@@ -26229,6 +26238,12 @@ const _sfc_main$2Y = {
26229
26238
  this.initLayoutProps();
26230
26239
  this.initRefList();
26231
26240
  },
26241
+ mounted() {
26242
+ var _a2, _b2;
26243
+ if (!this.designState && ((_b2 = (_a2 = this.widget) == null ? void 0 : _a2.options) == null ? void 0 : _b2.hidden)) {
26244
+ this.$nextTick(() => this.syncColFieldValidation(true));
26245
+ }
26246
+ },
26232
26247
  beforeUnmount() {
26233
26248
  var _a2, _b2;
26234
26249
  if (this.refList != null && ((_b2 = (_a2 = this.widget) == null ? void 0 : _a2.options) == null ? void 0 : _b2.name)) {
@@ -26241,12 +26256,40 @@ const _sfc_main$2Y = {
26241
26256
  this.layoutProps.span = val;
26242
26257
  },
26243
26258
  immediate: true
26259
+ },
26260
+ "widget.options.hidden": {
26261
+ handler(val) {
26262
+ if (this.designState)
26263
+ return;
26264
+ this.syncColFieldValidation(!!val);
26265
+ }
26244
26266
  }
26245
26267
  },
26246
26268
  methods: {
26269
+ syncColFieldValidation(hidden) {
26270
+ if (!this.widget)
26271
+ return;
26272
+ const hiddenFlag = !!hidden;
26273
+ traverseFieldWidgetsOfContainer(this.widget, (fieldWidget2) => {
26274
+ if (!fieldWidget2.formItemFlag || !fieldWidget2.options || !fieldWidget2.options.name) {
26275
+ return;
26276
+ }
26277
+ const fieldRef = this.getWidgetRef(fieldWidget2.options.name);
26278
+ if (!fieldRef)
26279
+ return;
26280
+ if (hiddenFlag) {
26281
+ if (typeof fieldRef.clearFieldRules === "function") {
26282
+ fieldRef.clearFieldRules();
26283
+ }
26284
+ } else if (typeof fieldRef.buildFieldRules === "function") {
26285
+ fieldRef.buildFieldRules();
26286
+ }
26287
+ });
26288
+ },
26247
26289
  setHidden(flag) {
26248
26290
  if (this.widget && this.widget.options) {
26249
26291
  this.widget.options.hidden = !!flag;
26292
+ this.syncColFieldValidation(flag);
26250
26293
  this.$nextTick(() => this.$forceUpdate());
26251
26294
  }
26252
26295
  },
@@ -26348,7 +26391,7 @@ function _sfc_render$2Y(_ctx, _cache, $props, $setup, $data, $options) {
26348
26391
  [vShow, $options.colVisible]
26349
26392
  ]) : createCommentVNode("", true);
26350
26393
  }
26351
- var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$2Y, [["render", _sfc_render$2Y], ["__scopeId", "data-v-746165e2"]]);
26394
+ var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$2Y, [["render", _sfc_render$2Y], ["__scopeId", "data-v-20705201"]]);
26352
26395
  var __glob_0_1$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
26353
26396
  __proto__: null,
26354
26397
  "default": GridColItem
@@ -26598,9 +26641,9 @@ function _sfc_render$2X(_ctx, _cache, $props, $setup, $data, $options) {
26598
26641
  ref: $props.widget.id
26599
26642
  }, {
26600
26643
  default: withCtx(() => [
26601
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.widget.cols.filter((item) => !item.options.hidden) || [], (colWidget, colIdx) => {
26644
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.widget.cols || [], (colWidget, colIdx) => {
26602
26645
  return openBlock(), createBlock(_component_grid_col_item, {
26603
- key: colIdx,
26646
+ key: colWidget.id,
26604
26647
  widget: colWidget,
26605
26648
  "parent-list": $props.widget.cols,
26606
26649
  "index-of-parent-list": colIdx,
@@ -27581,13 +27624,81 @@ const _sfc_main$2S = {
27581
27624
  }
27582
27625
  });
27583
27626
  },
27627
+ findFieldByName(fieldName) {
27628
+ if (!fieldName || !this.widgetList)
27629
+ return null;
27630
+ let found = null;
27631
+ const walk = (list) => {
27632
+ if (!Array.isArray(list) || found)
27633
+ return;
27634
+ list.forEach((w) => {
27635
+ if (found || !w)
27636
+ return;
27637
+ if (w.formItemFlag && w.options && w.options.name === fieldName) {
27638
+ found = w;
27639
+ return;
27640
+ }
27641
+ if (Array.isArray(w.widgetList))
27642
+ walk(w.widgetList);
27643
+ if (Array.isArray(w.cols)) {
27644
+ w.cols.forEach((c) => walk(c && c.widgetList));
27645
+ }
27646
+ if (Array.isArray(w.rows)) {
27647
+ w.rows.forEach((r) => Array.isArray(r && r.cols) && r.cols.forEach((c) => walk(c && c.widgetList)));
27648
+ }
27649
+ if (Array.isArray(w.tabs)) {
27650
+ w.tabs.forEach((t) => walk(t && t.widgetList));
27651
+ }
27652
+ });
27653
+ };
27654
+ walk(this.widgetList);
27655
+ return found;
27656
+ },
27584
27657
  findWidgetAndSetHidden(widgetName, hiddenFlag) {
27585
27658
  let foundW = this.getWidgetRef(widgetName);
27586
27659
  if (!!foundW) {
27587
27660
  foundW.setHidden(hiddenFlag);
27588
- } else {
27589
- this.findWidgetOfSubFormAndSetHidden(widgetName, hiddenFlag);
27661
+ return;
27662
+ }
27663
+ const fieldSchema = this.findFieldByName(widgetName);
27664
+ if (fieldSchema && fieldSchema.options) {
27665
+ fieldSchema.options.hidden = !!hiddenFlag;
27666
+ this.$nextTick(() => {
27667
+ const ref2 = this.getWidgetRef(widgetName);
27668
+ if (ref2) {
27669
+ if (hiddenFlag) {
27670
+ if (typeof ref2.clearFieldRules === "function")
27671
+ ref2.clearFieldRules();
27672
+ } else if (typeof ref2.buildFieldRules === "function") {
27673
+ ref2.buildFieldRules();
27674
+ }
27675
+ }
27676
+ this.$forceUpdate();
27677
+ });
27678
+ return;
27679
+ }
27680
+ this.findWidgetOfSubFormAndSetHidden(widgetName, hiddenFlag);
27681
+ },
27682
+ setFieldRequired(fieldName, required) {
27683
+ const flag = !!required;
27684
+ const fieldRef = this.getWidgetRef(fieldName);
27685
+ if (fieldRef && typeof fieldRef.setRequired === "function") {
27686
+ fieldRef.setRequired(flag);
27687
+ if (typeof fieldRef.buildFieldRules === "function") {
27688
+ fieldRef.buildFieldRules();
27689
+ }
27690
+ return true;
27590
27691
  }
27692
+ const fieldSchema = this.findFieldByName(fieldName);
27693
+ if (fieldSchema && fieldSchema.options) {
27694
+ fieldSchema.options.required = flag;
27695
+ const refAfter = this.getWidgetRef(fieldName);
27696
+ if (refAfter && typeof refAfter.buildFieldRules === "function") {
27697
+ refAfter.buildFieldRules();
27698
+ }
27699
+ return true;
27700
+ }
27701
+ return false;
27591
27702
  },
27592
27703
  findWidgetOfSubFormAndSetHidden(widgetName, hiddenFlag) {
27593
27704
  this.findWidgetNameInSubForm(widgetName).forEach((wn) => {
@@ -27991,11 +28102,41 @@ const _sfc_main$2S = {
27991
28102
  }
27992
28103
  return null;
27993
28104
  },
28105
+ syncFieldRulesByCol(col, hidden) {
28106
+ if (!col)
28107
+ return;
28108
+ const hiddenFlag = !!hidden;
28109
+ traverseFieldWidgetsOfContainer(col, (fieldWidget2) => {
28110
+ if (!fieldWidget2.formItemFlag || !fieldWidget2.options || !fieldWidget2.options.name) {
28111
+ return;
28112
+ }
28113
+ const fieldRef = this.getWidgetRef(fieldWidget2.options.name);
28114
+ if (!fieldRef)
28115
+ return;
28116
+ if (hiddenFlag) {
28117
+ if (typeof fieldRef.clearFieldRules === "function") {
28118
+ fieldRef.clearFieldRules();
28119
+ }
28120
+ } else if (typeof fieldRef.buildFieldRules === "function") {
28121
+ fieldRef.buildFieldRules();
28122
+ }
28123
+ });
28124
+ },
27994
28125
  setColHidden(colName, hidden) {
28126
+ if (Array.isArray(colName)) {
28127
+ let anySet = false;
28128
+ colName.forEach((name) => {
28129
+ if (this.setColHidden(name, hidden)) {
28130
+ anySet = true;
28131
+ }
28132
+ });
28133
+ return anySet;
28134
+ }
27995
28135
  const col = this.findColByName(null, colName);
27996
28136
  if (!col || !col.options)
27997
28137
  return false;
27998
28138
  col.options.hidden = !!hidden;
28139
+ this.syncFieldRulesByCol(col, hidden);
27999
28140
  this.$nextTick(() => this.$forceUpdate());
28000
28141
  return true;
28001
28142
  }
@@ -28056,7 +28197,7 @@ function _sfc_render$2S(_ctx, _cache, $props, $setup, $data, $options) {
28056
28197
  _: 3
28057
28198
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
28058
28199
  }
28059
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$2S, [["render", _sfc_render$2S], ["__scopeId", "data-v-6e3bb628"]]);
28200
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$2S, [["render", _sfc_render$2S], ["__scopeId", "data-v-3d429201"]]);
28060
28201
  var ace$2 = { exports: {} };
28061
28202
  (function(module, exports) {
28062
28203
  (function() {
@@ -68622,13 +68763,13 @@ function registerIcon(app) {
68622
68763
  if (typeof window !== "undefined") {
68623
68764
  let loadSvg = function() {
68624
68765
  var body = document.body;
68625
- var svgDom = document.getElementById("__svg__icons__dom__1779190375616__");
68766
+ var svgDom = document.getElementById("__svg__icons__dom__1779273144844__");
68626
68767
  if (!svgDom) {
68627
68768
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
68628
68769
  svgDom.style.position = "absolute";
68629
68770
  svgDom.style.width = "0";
68630
68771
  svgDom.style.height = "0";
68631
- svgDom.id = "__svg__icons__dom__1779190375616__";
68772
+ svgDom.id = "__svg__icons__dom__1779273144844__";
68632
68773
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
68633
68774
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
68634
68775
  }