form-custom-test 3.0.114 → 3.0.116

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
@@ -1989,6 +1989,7 @@ var enLocale_extension = {
1989
1989
  assetTableClickRow: "Click Row",
1990
1990
  assetSelectAssetTypeValue: "Asset Type Value",
1991
1991
  assetTypeAssetTypeValue: "Asset Type",
1992
+ assetLimit: "Asset Limit",
1992
1993
  assetType: "Asset Typee"
1993
1994
  }
1994
1995
  }
@@ -2039,7 +2040,8 @@ var zhLocale_extension = {
2039
2040
  assetTableTypeJson: "\u8D44\u4EA7\u8868\u683C\u7C7B\u578BJson",
2040
2041
  assetTableClickRow: "\u662F\u5426\u70B9\u51FB\u884C",
2041
2042
  assetSelectAssetTypeValue: "\u8D44\u4EA7\u7C7B\u578B\u503C",
2042
- assetTypeAssetTypeValue: "\u9ED8\u8BA4\u8D44\u4EA7\u7C7B\u578B\u503C"
2043
+ assetTypeAssetTypeValue: "\u9ED8\u8BA4\u8D44\u4EA7\u7C7B\u578B\u503C",
2044
+ assetSelectAssetLimit: "\u8D44\u4EA7\u9009\u62E9\u9650\u5236"
2043
2045
  }
2044
2046
  }
2045
2047
  };
@@ -9738,7 +9740,7 @@ function _sfc_render$15(_ctx, _cache, $props, $setup, $data, $options) {
9738
9740
  return openBlock(), createBlock(_component_el_checkbox_button, {
9739
9741
  key: index2,
9740
9742
  label: item.value,
9741
- disabled: item.disabled,
9743
+ disabled: _ctx.getDisabled() || item.disabled,
9742
9744
  border: $props.field.options.border,
9743
9745
  style: normalizeStyle({ display: $props.field.options.displayStyle })
9744
9746
  }, {
@@ -9751,7 +9753,7 @@ function _sfc_render$15(_ctx, _cache, $props, $setup, $data, $options) {
9751
9753
  return openBlock(), createBlock(_component_el_checkbox, {
9752
9754
  key: index2,
9753
9755
  label: item.value,
9754
- disabled: item.disabled,
9756
+ disabled: _ctx.getDisabled() || item.disabled,
9755
9757
  border: $props.field.options.border,
9756
9758
  style: normalizeStyle({ display: $props.field.options.displayStyle })
9757
9759
  }, {
@@ -9768,7 +9770,7 @@ function _sfc_render$15(_ctx, _cache, $props, $setup, $data, $options) {
9768
9770
  _: 1
9769
9771
  }, 8, ["designer", "field", "rules", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"]);
9770
9772
  }
9771
- var checkboxWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["render", _sfc_render$15], ["__scopeId", "data-v-3944f5f4"]]);
9773
+ var checkboxWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["render", _sfc_render$15], ["__scopeId", "data-v-8c1ca3c8"]]);
9772
9774
  var __glob_0_2$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9773
9775
  __proto__: null,
9774
9776
  "default": checkboxWidget
@@ -26183,13 +26185,13 @@ function registerIcon(app) {
26183
26185
  if (typeof window !== "undefined") {
26184
26186
  let loadSvg = function() {
26185
26187
  var body = document.body;
26186
- var svgDom = document.getElementById("__svg__icons__dom__1777447139884__");
26188
+ var svgDom = document.getElementById("__svg__icons__dom__1777457232091__");
26187
26189
  if (!svgDom) {
26188
26190
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26189
26191
  svgDom.style.position = "absolute";
26190
26192
  svgDom.style.width = "0";
26191
26193
  svgDom.style.height = "0";
26192
- svgDom.id = "__svg__icons__dom__1777447139884__";
26194
+ svgDom.id = "__svg__icons__dom__1777457232091__";
26193
26195
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
26194
26196
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
26195
26197
  }
@@ -26254,6 +26256,35 @@ const createTextareaEditor = function(propName, propLabelKey, configs = {}) {
26254
26256
  }
26255
26257
  };
26256
26258
  };
26259
+ const createInputNumberEditor = function(propName, propLabelKey) {
26260
+ return {
26261
+ props: {
26262
+ optionModel: Object
26263
+ },
26264
+ methods: {
26265
+ updateValue(newValue) {
26266
+ if (newValue === void 0 || newValue === null || isNaN(newValue)) {
26267
+ this.optionModel[propName] = null;
26268
+ } else {
26269
+ this.optionModel[propName] = Number(newValue);
26270
+ }
26271
+ }
26272
+ },
26273
+ render(h) {
26274
+ return createVNode(resolveComponent("el-form-item"), {
26275
+ "label": translate(propLabelKey)
26276
+ }, {
26277
+ default: () => [createVNode(resolveComponent("el-input-number"), {
26278
+ "type": "text",
26279
+ "modelValue": this.optionModel[propName],
26280
+ "onUpdate:modelValue": ($event) => this.optionModel[propName] = $event,
26281
+ "onChange": this.updateValue,
26282
+ "style": "width: 100%"
26283
+ }, null)]
26284
+ });
26285
+ }
26286
+ };
26287
+ };
26257
26288
  const createBooleanEditor = function(propName, propLabelKey) {
26258
26289
  return {
26259
26290
  props: {
@@ -61783,6 +61814,10 @@ const _sfc_main$4 = {
61783
61814
  assetTypeValue: {
61784
61815
  type: String,
61785
61816
  default: ""
61817
+ },
61818
+ limit: {
61819
+ type: Number,
61820
+ default: 0
61786
61821
  }
61787
61822
  },
61788
61823
  watch: {
@@ -61829,7 +61864,9 @@ const _sfc_main$4 = {
61829
61864
  },
61830
61865
  disabled: false,
61831
61866
  total: 0,
61832
- searchValue: ""
61867
+ searchValue: "",
61868
+ _prevTableSelectionIds: [],
61869
+ _handlingSelectionChange: false
61833
61870
  };
61834
61871
  },
61835
61872
  methods: {
@@ -61839,6 +61876,30 @@ const _sfc_main$4 = {
61839
61876
  handleConfirm() {
61840
61877
  this.$emit("confirm", this.selectedRows);
61841
61878
  },
61879
+ handleSelectionChange(selection) {
61880
+ if (this._handlingSelectionChange)
61881
+ return;
61882
+ const tableRef = this.$refs.tableRef;
61883
+ const sel = Array.isArray(selection) ? selection : [];
61884
+ const currentIds = sel.map((r) => r.assetId);
61885
+ if (this.limit > 0 && currentIds.length > this.limit) {
61886
+ const prevIds = Array.isArray(this._prevTableSelectionIds) ? this._prevTableSelectionIds : [];
61887
+ const allowedIds = prevIds.slice(0, this.limit);
61888
+ if (tableRef && typeof tableRef.clearSelection === "function" && typeof tableRef.toggleRowSelection === "function") {
61889
+ this._handlingSelectionChange = true;
61890
+ tableRef.clearSelection();
61891
+ sel.forEach((row) => {
61892
+ if (allowedIds.includes(row.assetId)) {
61893
+ tableRef.toggleRowSelection(row, true);
61894
+ }
61895
+ });
61896
+ this._handlingSelectionChange = false;
61897
+ }
61898
+ this._prevTableSelectionIds = allowedIds;
61899
+ return;
61900
+ }
61901
+ this._prevTableSelectionIds = currentIds;
61902
+ },
61842
61903
  getTableData() {
61843
61904
  service$1({
61844
61905
  method: "post",
@@ -61866,7 +61927,34 @@ const _sfc_main$4 = {
61866
61927
  this.getTableData();
61867
61928
  },
61868
61929
  handleAdd() {
61869
- const selection = this.$refs.tableRef.getSelectionRows();
61930
+ const tableRef = this.$refs.tableRef;
61931
+ const selection = tableRef && typeof tableRef.getSelectionRows === "function" ? tableRef.getSelectionRows() : [];
61932
+ if (!selection || selection.length === 0) {
61933
+ return;
61934
+ }
61935
+ if (this.limit === 1) {
61936
+ const picked = selection[selection.length - 1];
61937
+ this.selectedRows = picked ? [picked] : [];
61938
+ if (tableRef && typeof tableRef.clearSelection === "function") {
61939
+ tableRef.clearSelection();
61940
+ }
61941
+ return;
61942
+ }
61943
+ if (this.limit > 1) {
61944
+ const acc = [...this.selectedRows];
61945
+ selection.forEach((item) => {
61946
+ if (acc.length >= this.limit)
61947
+ return;
61948
+ if (!acc.some((i) => i.assetId === item.assetId)) {
61949
+ acc.push(item);
61950
+ }
61951
+ });
61952
+ this.selectedRows = acc;
61953
+ if (tableRef && typeof tableRef.clearSelection === "function") {
61954
+ tableRef.clearSelection();
61955
+ }
61956
+ return;
61957
+ }
61870
61958
  const arr = [...this.selectedRows, ...selection].reduce((acc, item) => {
61871
61959
  if (!acc.some((i) => i.assetId === item.assetId)) {
61872
61960
  acc.push(item);
@@ -61874,6 +61962,9 @@ const _sfc_main$4 = {
61874
61962
  return acc;
61875
61963
  }, []);
61876
61964
  this.selectedRows = arr;
61965
+ if (tableRef && typeof tableRef.clearSelection === "function") {
61966
+ tableRef.clearSelection();
61967
+ }
61877
61968
  },
61878
61969
  handleRemove(assetId) {
61879
61970
  const index2 = this.selectedRows.findIndex((item) => item.assetId === assetId);
@@ -62102,6 +62193,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
62102
62193
  "check-strictly": "",
62103
62194
  "row-key": "assetId",
62104
62195
  ref: "tableRef",
62196
+ onSelectionChange: $options.handleSelectionChange,
62105
62197
  "header-row-class-name": "headerRowClassName",
62106
62198
  "header-cell-class-name": "headerCellClassName",
62107
62199
  stripe: ""
@@ -62152,7 +62244,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
62152
62244
  })
62153
62245
  ]),
62154
62246
  _: 1
62155
- }, 8, ["data"]),
62247
+ }, 8, ["data", "onSelectionChange"]),
62156
62248
  createVNode(_component_el_pagination, {
62157
62249
  onSizeChange: $options.handleSizeChange,
62158
62250
  onCurrentChange: $options.handleCurrentChange,
@@ -62230,7 +62322,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
62230
62322
  _: 1
62231
62323
  }, 8, ["modelValue", "onClose"]);
62232
62324
  }
62233
- var AssetDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-b38703a2"]]);
62325
+ var AssetDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-58c3d01c"]]);
62234
62326
  var index_vue_vue_type_style_index_0_lang$1 = "";
62235
62327
  const _sfc_main$3 = {
62236
62328
  name: "asset-select-widget",
@@ -62469,9 +62561,10 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
62469
62561
  onClose: $options.handleClose,
62470
62562
  onConfirm: $options.handleConfirm,
62471
62563
  onCancel: $options.handleCancel,
62564
+ limit: $props.field.options.assetLimit,
62472
62565
  fieldValue: $data.fieldModel,
62473
62566
  assetTypeValue: $props.field.options.assetTypeValue
62474
- }, null, 8, ["dialog-visible", "onClose", "onConfirm", "onCancel", "fieldValue", "assetTypeValue"])
62567
+ }, null, 8, ["dialog-visible", "onClose", "onConfirm", "onCancel", "limit", "fieldValue", "assetTypeValue"])
62475
62568
  ], 4)
62476
62569
  ]),
62477
62570
  _: 1
@@ -62881,7 +62974,7 @@ const _sfc_main$1 = {
62881
62974
  }
62882
62975
  },
62883
62976
  handleRow(row) {
62884
- const index2 = this.fieldModel.findIndex((item) => item.id === row.id);
62977
+ const index2 = this.fieldModel.findIndex((item) => item.assetId === row.assetId);
62885
62978
  if (index2 === -1)
62886
62979
  return;
62887
62980
  this.triggerEvent("onOpen", this.fieldModel[index2]);
@@ -62901,7 +62994,7 @@ const _sfc_main$1 = {
62901
62994
  this.detailDialogData = null;
62902
62995
  },
62903
62996
  handleConfirm(formData) {
62904
- const index2 = this.fieldModel.findIndex((item) => item.id === this.detailDialogData.id);
62997
+ const index2 = this.fieldModel.findIndex((item) => item.assetId === this.detailDialogData.assetId);
62905
62998
  if (index2 === -1)
62906
62999
  return;
62907
63000
  const oldValue = lodash.exports.cloneDeep(this.fieldModel);
@@ -63291,6 +63384,7 @@ const loadExtension = function(app) {
63291
63384
  registerCPEditor(app, "asset-select-buttonText", "asset-select-buttonText-editor", createInputTextEditor("buttonText", "extension.setting.assetSelectButtonText"));
63292
63385
  registerCPEditor(app, "asset-select-typeJson", "asset-select-typeJson-editor", createTextareaEditor("typeJson", "extension.setting.assetSelectTypeJson", { rows: 4 }));
63293
63386
  registerCPEditor(app, "asset-select-assetTypeValue", "asset-select-assetTypeValue-editor", createInputTextEditor("assetTypeValue", "extension.setting.assetSelectAssetTypeValue"));
63387
+ registerCPEditor(app, "asset-select-assetLimit", "asset-select-assetLimit-editor", createInputNumberEditor("assetLimit", "extension.setting.assetSelectAssetLimit"));
63294
63388
  app.component(AssetTableWidget.name, AssetTableWidget);
63295
63389
  registerCPEditor(app, "asset-table-typeJson", "asset-table-typeJson-editor", createInputTextEditor("typeJson", "extension.setting.assetTableTypeJson"));
63296
63390
  registerCPEditor(app, "asset-table-clickRow", "asset-table-clickRow-editor", createBooleanEditor("clickRow", "extension.setting.assetTableClickRow"));