form-custom-test 3.0.160 → 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.
package/dist/render.es.js CHANGED
@@ -3100,7 +3100,7 @@ const getRegExp = function(validatorName2) {
3100
3100
  maxLen10Decimals2: "/^\\d{1,10}(\\.\\d{1,2})?$/",
3101
3101
  maxLen12Decimals2: "/^\\d{1,12}(\\.\\d{1,2})?$/",
3102
3102
  latitude: "/^-?(?:90(?:\\.0{1,6})?|[1-8]?\\d(?:\\.\\d{1,6})?|0(?:\\.\\d{1,6})?)$/",
3103
- sixFigures: "/^\\d{1,6}(\\.\\d{1,6})?$/",
3103
+ sixFigures: "/^(0|[1-9]\\d{0,5})(\\.\\d{1,6})?$/",
3104
3104
  percentage: "/^(?:100(?:\\.0{0,4})?|[1-9]?\\d(?:\\.\\d{0,4})?|0(?:\\.\\d{0,4})?)$/",
3105
3105
  longitude: "/^-?(?:180(?:\\.0{1,6})?|1[0-7]\\d(?:\\.\\d{1,6})?|[1-9]?\\d(?:\\.\\d{1,6})?|0(?:\\.\\d{1,6})?)$/"
3106
3106
  };
@@ -8797,10 +8797,13 @@ var fieldMixin = {
8797
8797
  this.rules.splice(0, this.rules.length);
8798
8798
  },
8799
8799
  buildFieldRules() {
8800
- if (!this.field.formItemFlag && this.field.options.hidden) {
8800
+ if (!this.field.formItemFlag) {
8801
8801
  return;
8802
8802
  }
8803
8803
  this.rules.splice(0, this.rules.length);
8804
+ if (!!this.field.options.hidden && !this.designState) {
8805
+ return;
8806
+ }
8804
8807
  if (!!this.field.options.required) {
8805
8808
  this.rules.push({
8806
8809
  required: true,
@@ -8972,6 +8975,10 @@ var fieldMixin = {
8972
8975
  return formRef && typeof formRef.findColByName === "function" ? formRef.findColByName(null, colName) : null;
8973
8976
  },
8974
8977
  setColHidden(colName, hidden) {
8978
+ const formRef = this.getFormRef();
8979
+ if (formRef && typeof formRef.setColHidden === "function") {
8980
+ return formRef.setColHidden(colName, hidden);
8981
+ }
8975
8982
  const hiddenVal = !!hidden;
8976
8983
  if (Array.isArray(colName)) {
8977
8984
  let anySet = false;
@@ -24460,6 +24467,12 @@ const _sfc_main$B = {
24460
24467
  this.initLayoutProps();
24461
24468
  this.initRefList();
24462
24469
  },
24470
+ mounted() {
24471
+ var _a, _b;
24472
+ if (!this.designState && ((_b = (_a = this.widget) == null ? void 0 : _a.options) == null ? void 0 : _b.hidden)) {
24473
+ this.$nextTick(() => this.syncColFieldValidation(true));
24474
+ }
24475
+ },
24463
24476
  beforeUnmount() {
24464
24477
  var _a, _b;
24465
24478
  if (this.refList != null && ((_b = (_a = this.widget) == null ? void 0 : _a.options) == null ? void 0 : _b.name)) {
@@ -24472,12 +24485,40 @@ const _sfc_main$B = {
24472
24485
  this.layoutProps.span = val;
24473
24486
  },
24474
24487
  immediate: true
24488
+ },
24489
+ "widget.options.hidden": {
24490
+ handler(val) {
24491
+ if (this.designState)
24492
+ return;
24493
+ this.syncColFieldValidation(!!val);
24494
+ }
24475
24495
  }
24476
24496
  },
24477
24497
  methods: {
24498
+ syncColFieldValidation(hidden) {
24499
+ if (!this.widget)
24500
+ return;
24501
+ const hiddenFlag = !!hidden;
24502
+ traverseFieldWidgetsOfContainer(this.widget, (fieldWidget) => {
24503
+ if (!fieldWidget.formItemFlag || !fieldWidget.options || !fieldWidget.options.name) {
24504
+ return;
24505
+ }
24506
+ const fieldRef = this.getWidgetRef(fieldWidget.options.name);
24507
+ if (!fieldRef)
24508
+ return;
24509
+ if (hiddenFlag) {
24510
+ if (typeof fieldRef.clearFieldRules === "function") {
24511
+ fieldRef.clearFieldRules();
24512
+ }
24513
+ } else if (typeof fieldRef.buildFieldRules === "function") {
24514
+ fieldRef.buildFieldRules();
24515
+ }
24516
+ });
24517
+ },
24478
24518
  setHidden(flag) {
24479
24519
  if (this.widget && this.widget.options) {
24480
24520
  this.widget.options.hidden = !!flag;
24521
+ this.syncColFieldValidation(flag);
24481
24522
  this.$nextTick(() => this.$forceUpdate());
24482
24523
  }
24483
24524
  },
@@ -24579,7 +24620,7 @@ function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
24579
24620
  [vShow, $options.colVisible]
24580
24621
  ]) : createCommentVNode("", true);
24581
24622
  }
24582
- var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$B], ["__scopeId", "data-v-746165e2"]]);
24623
+ var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$B], ["__scopeId", "data-v-20705201"]]);
24583
24624
  var __glob_0_1$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24584
24625
  __proto__: null,
24585
24626
  "default": GridColItem
@@ -25851,7 +25892,18 @@ const _sfc_main$v = {
25851
25892
  const fieldSchema = this.findFieldByName(widgetName);
25852
25893
  if (fieldSchema && fieldSchema.options) {
25853
25894
  fieldSchema.options.hidden = !!hiddenFlag;
25854
- this.$nextTick(() => this.$forceUpdate());
25895
+ this.$nextTick(() => {
25896
+ const ref2 = this.getWidgetRef(widgetName);
25897
+ if (ref2) {
25898
+ if (hiddenFlag) {
25899
+ if (typeof ref2.clearFieldRules === "function")
25900
+ ref2.clearFieldRules();
25901
+ } else if (typeof ref2.buildFieldRules === "function") {
25902
+ ref2.buildFieldRules();
25903
+ }
25904
+ }
25905
+ this.$forceUpdate();
25906
+ });
25855
25907
  return;
25856
25908
  }
25857
25909
  this.findWidgetOfSubFormAndSetHidden(widgetName, hiddenFlag);
@@ -26279,11 +26331,41 @@ const _sfc_main$v = {
26279
26331
  }
26280
26332
  return null;
26281
26333
  },
26334
+ syncFieldRulesByCol(col, hidden) {
26335
+ if (!col)
26336
+ return;
26337
+ const hiddenFlag = !!hidden;
26338
+ traverseFieldWidgetsOfContainer(col, (fieldWidget) => {
26339
+ if (!fieldWidget.formItemFlag || !fieldWidget.options || !fieldWidget.options.name) {
26340
+ return;
26341
+ }
26342
+ const fieldRef = this.getWidgetRef(fieldWidget.options.name);
26343
+ if (!fieldRef)
26344
+ return;
26345
+ if (hiddenFlag) {
26346
+ if (typeof fieldRef.clearFieldRules === "function") {
26347
+ fieldRef.clearFieldRules();
26348
+ }
26349
+ } else if (typeof fieldRef.buildFieldRules === "function") {
26350
+ fieldRef.buildFieldRules();
26351
+ }
26352
+ });
26353
+ },
26282
26354
  setColHidden(colName, hidden) {
26355
+ if (Array.isArray(colName)) {
26356
+ let anySet = false;
26357
+ colName.forEach((name) => {
26358
+ if (this.setColHidden(name, hidden)) {
26359
+ anySet = true;
26360
+ }
26361
+ });
26362
+ return anySet;
26363
+ }
26283
26364
  const col = this.findColByName(null, colName);
26284
26365
  if (!col || !col.options)
26285
26366
  return false;
26286
26367
  col.options.hidden = !!hidden;
26368
+ this.syncFieldRulesByCol(col, hidden);
26287
26369
  this.$nextTick(() => this.$forceUpdate());
26288
26370
  return true;
26289
26371
  }
@@ -26344,7 +26426,7 @@ function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
26344
26426
  _: 3
26345
26427
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
26346
26428
  }
26347
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$v], ["__scopeId", "data-v-2bb5a9c0"]]);
26429
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$v], ["__scopeId", "data-v-3d429201"]]);
26348
26430
  function registerIcon(app) {
26349
26431
  app.component("el-icon-edit", edit);
26350
26432
  app.component("el-icon-minus", minus);
@@ -26359,13 +26441,13 @@ function registerIcon(app) {
26359
26441
  if (typeof window !== "undefined") {
26360
26442
  let loadSvg = function() {
26361
26443
  var body = document.body;
26362
- var svgDom = document.getElementById("__svg__icons__dom__1779271953311__");
26444
+ var svgDom = document.getElementById("__svg__icons__dom__1779273154047__");
26363
26445
  if (!svgDom) {
26364
26446
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26365
26447
  svgDom.style.position = "absolute";
26366
26448
  svgDom.style.width = "0";
26367
26449
  svgDom.style.height = "0";
26368
- svgDom.id = "__svg__icons__dom__1779271953311__";
26450
+ svgDom.id = "__svg__icons__dom__1779273154047__";
26369
26451
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
26370
26452
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
26371
26453
  }