form-custom-test 3.0.160 → 3.0.162

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
  };
@@ -8790,17 +8790,39 @@ var fieldMixin = {
8790
8790
  this.fieldModel = this.field.options.defaultValue;
8791
8791
  }
8792
8792
  },
8793
+ clearFieldValidate() {
8794
+ var _a;
8795
+ if (this.designState || !((_a = this.field) == null ? void 0 : _a.formItemFlag)) {
8796
+ return;
8797
+ }
8798
+ const formRef = this.getFormRef();
8799
+ if (!formRef || typeof formRef.clearValidate !== "function") {
8800
+ return;
8801
+ }
8802
+ const prop = this.getPropName();
8803
+ if (!prop) {
8804
+ return;
8805
+ }
8806
+ this.$nextTick(() => {
8807
+ formRef.clearValidate(prop);
8808
+ });
8809
+ },
8793
8810
  clearFieldRules() {
8794
8811
  if (!this.field.formItemFlag) {
8795
8812
  return;
8796
8813
  }
8797
8814
  this.rules.splice(0, this.rules.length);
8815
+ this.clearFieldValidate();
8798
8816
  },
8799
8817
  buildFieldRules() {
8800
- if (!this.field.formItemFlag && this.field.options.hidden) {
8818
+ if (!this.field.formItemFlag) {
8801
8819
  return;
8802
8820
  }
8803
8821
  this.rules.splice(0, this.rules.length);
8822
+ if (!!this.field.options.hidden && !this.designState) {
8823
+ this.clearFieldValidate();
8824
+ return;
8825
+ }
8804
8826
  if (!!this.field.options.required) {
8805
8827
  this.rules.push({
8806
8828
  required: true,
@@ -8838,6 +8860,7 @@ var fieldMixin = {
8838
8860
  label: this.field.options.label
8839
8861
  });
8840
8862
  }
8863
+ this.clearFieldValidate();
8841
8864
  },
8842
8865
  disableChangeValidate() {
8843
8866
  if (!this.rules) {
@@ -8972,6 +8995,10 @@ var fieldMixin = {
8972
8995
  return formRef && typeof formRef.findColByName === "function" ? formRef.findColByName(null, colName) : null;
8973
8996
  },
8974
8997
  setColHidden(colName, hidden) {
8998
+ const formRef = this.getFormRef();
8999
+ if (formRef && typeof formRef.setColHidden === "function") {
9000
+ return formRef.setColHidden(colName, hidden);
9001
+ }
8975
9002
  const hiddenVal = !!hidden;
8976
9003
  if (Array.isArray(colName)) {
8977
9004
  let anySet = false;
@@ -24460,6 +24487,12 @@ const _sfc_main$B = {
24460
24487
  this.initLayoutProps();
24461
24488
  this.initRefList();
24462
24489
  },
24490
+ mounted() {
24491
+ var _a, _b;
24492
+ if (!this.designState && ((_b = (_a = this.widget) == null ? void 0 : _a.options) == null ? void 0 : _b.hidden)) {
24493
+ this.$nextTick(() => this.syncColFieldValidation(true));
24494
+ }
24495
+ },
24463
24496
  beforeUnmount() {
24464
24497
  var _a, _b;
24465
24498
  if (this.refList != null && ((_b = (_a = this.widget) == null ? void 0 : _a.options) == null ? void 0 : _b.name)) {
@@ -24472,12 +24505,50 @@ const _sfc_main$B = {
24472
24505
  this.layoutProps.span = val;
24473
24506
  },
24474
24507
  immediate: true
24508
+ },
24509
+ "widget.options.hidden": {
24510
+ handler(val) {
24511
+ if (this.designState)
24512
+ return;
24513
+ this.syncColFieldValidation(!!val);
24514
+ }
24475
24515
  }
24476
24516
  },
24477
24517
  methods: {
24518
+ syncColFieldValidation(hidden) {
24519
+ if (!this.widget)
24520
+ return;
24521
+ const hiddenFlag = !!hidden;
24522
+ const propsToClear = [];
24523
+ const formRef = this.getFormRef();
24524
+ traverseFieldWidgetsOfContainer(this.widget, (fieldWidget) => {
24525
+ if (!fieldWidget.formItemFlag || !fieldWidget.options || !fieldWidget.options.name) {
24526
+ return;
24527
+ }
24528
+ const fieldRef = this.getWidgetRef(fieldWidget.options.name);
24529
+ if (!fieldRef)
24530
+ return;
24531
+ if (hiddenFlag) {
24532
+ if (typeof fieldRef.clearFieldRules === "function") {
24533
+ fieldRef.clearFieldRules();
24534
+ }
24535
+ } else if (typeof fieldRef.buildFieldRules === "function") {
24536
+ fieldRef.buildFieldRules();
24537
+ }
24538
+ if (typeof fieldRef.getPropName === "function") {
24539
+ propsToClear.push(fieldRef.getPropName());
24540
+ }
24541
+ });
24542
+ if (propsToClear.length > 0 && formRef && typeof formRef.clearValidate === "function") {
24543
+ this.$nextTick(() => {
24544
+ formRef.clearValidate(propsToClear);
24545
+ });
24546
+ }
24547
+ },
24478
24548
  setHidden(flag) {
24479
24549
  if (this.widget && this.widget.options) {
24480
24550
  this.widget.options.hidden = !!flag;
24551
+ this.syncColFieldValidation(flag);
24481
24552
  this.$nextTick(() => this.$forceUpdate());
24482
24553
  }
24483
24554
  },
@@ -24579,7 +24650,7 @@ function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
24579
24650
  [vShow, $options.colVisible]
24580
24651
  ]) : createCommentVNode("", true);
24581
24652
  }
24582
- var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$B], ["__scopeId", "data-v-746165e2"]]);
24653
+ var GridColItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$B], ["__scopeId", "data-v-54aa37b2"]]);
24583
24654
  var __glob_0_1$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24584
24655
  __proto__: null,
24585
24656
  "default": GridColItem
@@ -25851,7 +25922,18 @@ const _sfc_main$v = {
25851
25922
  const fieldSchema = this.findFieldByName(widgetName);
25852
25923
  if (fieldSchema && fieldSchema.options) {
25853
25924
  fieldSchema.options.hidden = !!hiddenFlag;
25854
- this.$nextTick(() => this.$forceUpdate());
25925
+ this.$nextTick(() => {
25926
+ const ref2 = this.getWidgetRef(widgetName);
25927
+ if (ref2) {
25928
+ if (hiddenFlag) {
25929
+ if (typeof ref2.clearFieldRules === "function")
25930
+ ref2.clearFieldRules();
25931
+ } else if (typeof ref2.buildFieldRules === "function") {
25932
+ ref2.buildFieldRules();
25933
+ }
25934
+ }
25935
+ this.$forceUpdate();
25936
+ });
25855
25937
  return;
25856
25938
  }
25857
25939
  this.findWidgetOfSubFormAndSetHidden(widgetName, hiddenFlag);
@@ -25861,9 +25943,6 @@ const _sfc_main$v = {
25861
25943
  const fieldRef = this.getWidgetRef(fieldName);
25862
25944
  if (fieldRef && typeof fieldRef.setRequired === "function") {
25863
25945
  fieldRef.setRequired(flag);
25864
- if (typeof fieldRef.buildFieldRules === "function") {
25865
- fieldRef.buildFieldRules();
25866
- }
25867
25946
  return true;
25868
25947
  }
25869
25948
  const fieldSchema = this.findFieldByName(fieldName);
@@ -25872,6 +25951,8 @@ const _sfc_main$v = {
25872
25951
  const refAfter = this.getWidgetRef(fieldName);
25873
25952
  if (refAfter && typeof refAfter.buildFieldRules === "function") {
25874
25953
  refAfter.buildFieldRules();
25954
+ } else {
25955
+ this.$nextTick(() => this.clearValidate(fieldName));
25875
25956
  }
25876
25957
  return true;
25877
25958
  }
@@ -26158,7 +26239,11 @@ const _sfc_main$v = {
26158
26239
  });
26159
26240
  },
26160
26241
  clearValidate(props) {
26161
- this.$refs.renderForm.clearValidate(props);
26242
+ const form = this.$refs.renderForm;
26243
+ if (!form || typeof form.clearValidate !== "function") {
26244
+ return;
26245
+ }
26246
+ form.clearValidate(props);
26162
26247
  },
26163
26248
  validateForm(callback2) {
26164
26249
  this.$refs["renderForm"].validate((valid) => {
@@ -26279,11 +26364,50 @@ const _sfc_main$v = {
26279
26364
  }
26280
26365
  return null;
26281
26366
  },
26367
+ syncFieldRulesByCol(col, hidden) {
26368
+ if (!col)
26369
+ return;
26370
+ const hiddenFlag = !!hidden;
26371
+ const propsToClear = [];
26372
+ traverseFieldWidgetsOfContainer(col, (fieldWidget) => {
26373
+ if (!fieldWidget.formItemFlag || !fieldWidget.options || !fieldWidget.options.name) {
26374
+ return;
26375
+ }
26376
+ const fieldRef = this.getWidgetRef(fieldWidget.options.name);
26377
+ if (!fieldRef)
26378
+ return;
26379
+ if (hiddenFlag) {
26380
+ if (typeof fieldRef.clearFieldRules === "function") {
26381
+ fieldRef.clearFieldRules();
26382
+ }
26383
+ } else if (typeof fieldRef.buildFieldRules === "function") {
26384
+ fieldRef.buildFieldRules();
26385
+ }
26386
+ if (typeof fieldRef.getPropName === "function") {
26387
+ propsToClear.push(fieldRef.getPropName());
26388
+ }
26389
+ });
26390
+ if (propsToClear.length > 0) {
26391
+ this.$nextTick(() => {
26392
+ this.clearValidate(propsToClear);
26393
+ });
26394
+ }
26395
+ },
26282
26396
  setColHidden(colName, hidden) {
26397
+ if (Array.isArray(colName)) {
26398
+ let anySet = false;
26399
+ colName.forEach((name) => {
26400
+ if (this.setColHidden(name, hidden)) {
26401
+ anySet = true;
26402
+ }
26403
+ });
26404
+ return anySet;
26405
+ }
26283
26406
  const col = this.findColByName(null, colName);
26284
26407
  if (!col || !col.options)
26285
26408
  return false;
26286
26409
  col.options.hidden = !!hidden;
26410
+ this.syncFieldRulesByCol(col, hidden);
26287
26411
  this.$nextTick(() => this.$forceUpdate());
26288
26412
  return true;
26289
26413
  }
@@ -26344,7 +26468,7 @@ function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
26344
26468
  _: 3
26345
26469
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
26346
26470
  }
26347
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$v], ["__scopeId", "data-v-2bb5a9c0"]]);
26471
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$v], ["__scopeId", "data-v-6ba86904"]]);
26348
26472
  function registerIcon(app) {
26349
26473
  app.component("el-icon-edit", edit);
26350
26474
  app.component("el-icon-minus", minus);
@@ -26359,13 +26483,13 @@ function registerIcon(app) {
26359
26483
  if (typeof window !== "undefined") {
26360
26484
  let loadSvg = function() {
26361
26485
  var body = document.body;
26362
- var svgDom = document.getElementById("__svg__icons__dom__1779271953311__");
26486
+ var svgDom = document.getElementById("__svg__icons__dom__1779273901379__");
26363
26487
  if (!svgDom) {
26364
26488
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26365
26489
  svgDom.style.position = "absolute";
26366
26490
  svgDom.style.width = "0";
26367
26491
  svgDom.style.height = "0";
26368
- svgDom.id = "__svg__icons__dom__1779271953311__";
26492
+ svgDom.id = "__svg__icons__dom__1779273901379__";
26369
26493
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
26370
26494
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
26371
26495
  }
@@ -62126,6 +62250,7 @@ const _sfc_main$6 = {
62126
62250
  const tableRef = this.$refs.tableRef;
62127
62251
  const selection = tableRef && typeof tableRef.getSelectionRows === "function" ? tableRef.getSelectionRows() : [];
62128
62252
  if (!selection || selection.length === 0) {
62253
+ this.$message.error(`\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u8D44\u4EA7`);
62129
62254
  return;
62130
62255
  }
62131
62256
  const arr = [...this.selectedRows, ...selection].reduce((acc, item) => {
@@ -62510,7 +62635,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
62510
62635
  _: 1
62511
62636
  }, 8, ["modelValue", "onClose"]);
62512
62637
  }
62513
- var AssetDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-0c6d23e8"]]);
62638
+ var AssetDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-4c34c6a0"]]);
62514
62639
  var index_vue_vue_type_style_index_0_lang$1 = "";
62515
62640
  const _sfc_main$5 = {
62516
62641
  name: "asset-select-widget",