form-custom-test 3.0.114 → 3.0.115

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.
@@ -3863,6 +3863,7 @@ const assetSelectSchema = {
3863
3863
  hideFooter: false,
3864
3864
  typeJson: {},
3865
3865
  assetTypeValue: "",
3866
+ assetLimit: 0,
3866
3867
  customClass: ["assetCss"],
3867
3868
  onOpen: "",
3868
3869
  onConfirm: ""
@@ -3956,6 +3957,7 @@ var enLocale_extension = {
3956
3957
  assetTableClickRow: "Click Row",
3957
3958
  assetSelectAssetTypeValue: "Asset Type Value",
3958
3959
  assetTypeAssetTypeValue: "Asset Type",
3960
+ assetLimit: "Asset Limit",
3959
3961
  assetType: "Asset Typee"
3960
3962
  }
3961
3963
  }
@@ -4006,7 +4008,8 @@ var zhLocale_extension = {
4006
4008
  assetTableTypeJson: "\u8D44\u4EA7\u8868\u683C\u7C7B\u578BJson",
4007
4009
  assetTableClickRow: "\u662F\u5426\u70B9\u51FB\u884C",
4008
4010
  assetSelectAssetTypeValue: "\u8D44\u4EA7\u7C7B\u578B\u503C",
4009
- assetTypeAssetTypeValue: "\u9ED8\u8BA4\u8D44\u4EA7\u7C7B\u578B\u503C"
4011
+ assetTypeAssetTypeValue: "\u9ED8\u8BA4\u8D44\u4EA7\u7C7B\u578B\u503C",
4012
+ assetSelectAssetLimit: "\u8D44\u4EA7\u9009\u62E9\u9650\u5236"
4010
4013
  }
4011
4014
  }
4012
4015
  };
@@ -68448,13 +68451,13 @@ function registerIcon(app) {
68448
68451
  if (typeof window !== "undefined") {
68449
68452
  let loadSvg = function() {
68450
68453
  var body = document.body;
68451
- var svgDom = document.getElementById("__svg__icons__dom__1777447131638__");
68454
+ var svgDom = document.getElementById("__svg__icons__dom__1777455426152__");
68452
68455
  if (!svgDom) {
68453
68456
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
68454
68457
  svgDom.style.position = "absolute";
68455
68458
  svgDom.style.width = "0";
68456
68459
  svgDom.style.height = "0";
68457
- svgDom.id = "__svg__icons__dom__1777447131638__";
68460
+ svgDom.id = "__svg__icons__dom__1777455426152__";
68458
68461
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
68459
68462
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
68460
68463
  }
@@ -68609,6 +68612,35 @@ const createTextareaEditor = function(propName, propLabelKey, configs = {}) {
68609
68612
  }
68610
68613
  };
68611
68614
  };
68615
+ const createInputNumberEditor = function(propName, propLabelKey) {
68616
+ return {
68617
+ props: {
68618
+ optionModel: Object
68619
+ },
68620
+ methods: {
68621
+ updateValue(newValue) {
68622
+ if (newValue === void 0 || newValue === null || isNaN(newValue)) {
68623
+ this.optionModel[propName] = null;
68624
+ } else {
68625
+ this.optionModel[propName] = Number(newValue);
68626
+ }
68627
+ }
68628
+ },
68629
+ render(h) {
68630
+ return createVNode(resolveComponent("el-form-item"), {
68631
+ "label": translate(propLabelKey)
68632
+ }, {
68633
+ default: () => [createVNode(resolveComponent("el-input-number"), {
68634
+ "type": "text",
68635
+ "modelValue": this.optionModel[propName],
68636
+ "onUpdate:modelValue": ($event) => this.optionModel[propName] = $event,
68637
+ "onChange": this.updateValue,
68638
+ "style": "width: 100%"
68639
+ }, null)]
68640
+ });
68641
+ }
68642
+ };
68643
+ };
68612
68644
  const createBooleanEditor = function(propName, propLabelKey) {
68613
68645
  return {
68614
68646
  props: {
@@ -78501,6 +78533,10 @@ const _sfc_main$4 = {
78501
78533
  assetTypeValue: {
78502
78534
  type: String,
78503
78535
  default: ""
78536
+ },
78537
+ limit: {
78538
+ type: Number,
78539
+ default: 0
78504
78540
  }
78505
78541
  },
78506
78542
  watch: {
@@ -78547,7 +78583,9 @@ const _sfc_main$4 = {
78547
78583
  },
78548
78584
  disabled: false,
78549
78585
  total: 0,
78550
- searchValue: ""
78586
+ searchValue: "",
78587
+ _prevTableSelectionIds: [],
78588
+ _handlingSelectionChange: false
78551
78589
  };
78552
78590
  },
78553
78591
  methods: {
@@ -78557,6 +78595,30 @@ const _sfc_main$4 = {
78557
78595
  handleConfirm() {
78558
78596
  this.$emit("confirm", this.selectedRows);
78559
78597
  },
78598
+ handleSelectionChange(selection) {
78599
+ if (this._handlingSelectionChange)
78600
+ return;
78601
+ const tableRef = this.$refs.tableRef;
78602
+ const sel = Array.isArray(selection) ? selection : [];
78603
+ const currentIds = sel.map((r) => r.assetId);
78604
+ if (this.limit > 0 && currentIds.length > this.limit) {
78605
+ const prevIds = Array.isArray(this._prevTableSelectionIds) ? this._prevTableSelectionIds : [];
78606
+ const allowedIds = prevIds.slice(0, this.limit);
78607
+ if (tableRef && typeof tableRef.clearSelection === "function" && typeof tableRef.toggleRowSelection === "function") {
78608
+ this._handlingSelectionChange = true;
78609
+ tableRef.clearSelection();
78610
+ sel.forEach((row) => {
78611
+ if (allowedIds.includes(row.assetId)) {
78612
+ tableRef.toggleRowSelection(row, true);
78613
+ }
78614
+ });
78615
+ this._handlingSelectionChange = false;
78616
+ }
78617
+ this._prevTableSelectionIds = allowedIds;
78618
+ return;
78619
+ }
78620
+ this._prevTableSelectionIds = currentIds;
78621
+ },
78560
78622
  getTableData() {
78561
78623
  service$1({
78562
78624
  method: "post",
@@ -78584,7 +78646,34 @@ const _sfc_main$4 = {
78584
78646
  this.getTableData();
78585
78647
  },
78586
78648
  handleAdd() {
78587
- const selection = this.$refs.tableRef.getSelectionRows();
78649
+ const tableRef = this.$refs.tableRef;
78650
+ const selection = tableRef && typeof tableRef.getSelectionRows === "function" ? tableRef.getSelectionRows() : [];
78651
+ if (!selection || selection.length === 0) {
78652
+ return;
78653
+ }
78654
+ if (this.limit === 1) {
78655
+ const picked = selection[selection.length - 1];
78656
+ this.selectedRows = picked ? [picked] : [];
78657
+ if (tableRef && typeof tableRef.clearSelection === "function") {
78658
+ tableRef.clearSelection();
78659
+ }
78660
+ return;
78661
+ }
78662
+ if (this.limit > 1) {
78663
+ const acc = [...this.selectedRows];
78664
+ selection.forEach((item) => {
78665
+ if (acc.length >= this.limit)
78666
+ return;
78667
+ if (!acc.some((i) => i.assetId === item.assetId)) {
78668
+ acc.push(item);
78669
+ }
78670
+ });
78671
+ this.selectedRows = acc;
78672
+ if (tableRef && typeof tableRef.clearSelection === "function") {
78673
+ tableRef.clearSelection();
78674
+ }
78675
+ return;
78676
+ }
78588
78677
  const arr = [...this.selectedRows, ...selection].reduce((acc, item) => {
78589
78678
  if (!acc.some((i) => i.assetId === item.assetId)) {
78590
78679
  acc.push(item);
@@ -78592,6 +78681,9 @@ const _sfc_main$4 = {
78592
78681
  return acc;
78593
78682
  }, []);
78594
78683
  this.selectedRows = arr;
78684
+ if (tableRef && typeof tableRef.clearSelection === "function") {
78685
+ tableRef.clearSelection();
78686
+ }
78595
78687
  },
78596
78688
  handleRemove(assetId) {
78597
78689
  const index2 = this.selectedRows.findIndex((item) => item.assetId === assetId);
@@ -78820,6 +78912,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
78820
78912
  "check-strictly": "",
78821
78913
  "row-key": "assetId",
78822
78914
  ref: "tableRef",
78915
+ onSelectionChange: $options.handleSelectionChange,
78823
78916
  "header-row-class-name": "headerRowClassName",
78824
78917
  "header-cell-class-name": "headerCellClassName",
78825
78918
  stripe: ""
@@ -78870,7 +78963,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
78870
78963
  })
78871
78964
  ]),
78872
78965
  _: 1
78873
- }, 8, ["data"]),
78966
+ }, 8, ["data", "onSelectionChange"]),
78874
78967
  createVNode(_component_el_pagination, {
78875
78968
  onSizeChange: $options.handleSizeChange,
78876
78969
  onCurrentChange: $options.handleCurrentChange,
@@ -78948,7 +79041,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
78948
79041
  _: 1
78949
79042
  }, 8, ["modelValue", "onClose"]);
78950
79043
  }
78951
- var AssetDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-b38703a2"]]);
79044
+ var AssetDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-58c3d01c"]]);
78952
79045
  var index_vue_vue_type_style_index_0_lang$1 = "";
78953
79046
  const _sfc_main$3 = {
78954
79047
  name: "asset-select-widget",
@@ -79187,9 +79280,10 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
79187
79280
  onClose: $options.handleClose,
79188
79281
  onConfirm: $options.handleConfirm,
79189
79282
  onCancel: $options.handleCancel,
79283
+ limit: $props.field.options.assetLimit,
79190
79284
  fieldValue: $data.fieldModel,
79191
79285
  assetTypeValue: $props.field.options.assetTypeValue
79192
- }, null, 8, ["dialog-visible", "onClose", "onConfirm", "onCancel", "fieldValue", "assetTypeValue"])
79286
+ }, null, 8, ["dialog-visible", "onClose", "onConfirm", "onCancel", "limit", "fieldValue", "assetTypeValue"])
79193
79287
  ], 4)
79194
79288
  ]),
79195
79289
  _: 1
@@ -79599,7 +79693,7 @@ const _sfc_main$1 = {
79599
79693
  }
79600
79694
  },
79601
79695
  handleRow(row) {
79602
- const index2 = this.fieldModel.findIndex((item) => item.id === row.id);
79696
+ const index2 = this.fieldModel.findIndex((item) => item.assetId === row.assetId);
79603
79697
  if (index2 === -1)
79604
79698
  return;
79605
79699
  this.triggerEvent("onOpen", this.fieldModel[index2]);
@@ -79619,7 +79713,7 @@ const _sfc_main$1 = {
79619
79713
  this.detailDialogData = null;
79620
79714
  },
79621
79715
  handleConfirm(formData) {
79622
- const index2 = this.fieldModel.findIndex((item) => item.id === this.detailDialogData.id);
79716
+ const index2 = this.fieldModel.findIndex((item) => item.assetId === this.detailDialogData.assetId);
79623
79717
  if (index2 === -1)
79624
79718
  return;
79625
79719
  const oldValue = lodash.exports.cloneDeep(this.fieldModel);
@@ -80023,6 +80117,7 @@ const loadExtension = function(app) {
80023
80117
  registerCPEditor(app, "asset-select-buttonText", "asset-select-buttonText-editor", createInputTextEditor("buttonText", "extension.setting.assetSelectButtonText"));
80024
80118
  registerCPEditor(app, "asset-select-typeJson", "asset-select-typeJson-editor", createTextareaEditor("typeJson", "extension.setting.assetSelectTypeJson", { rows: 4 }));
80025
80119
  registerCPEditor(app, "asset-select-assetTypeValue", "asset-select-assetTypeValue-editor", createInputTextEditor("assetTypeValue", "extension.setting.assetSelectAssetTypeValue"));
80120
+ registerCPEditor(app, "asset-select-assetLimit", "asset-select-assetLimit-editor", createInputNumberEditor("assetLimit", "extension.setting.assetSelectAssetLimit"));
80026
80121
  addCustomWidgetSchema(assetTableSchema);
80027
80122
  app.component(AssetTableWidget.name, AssetTableWidget);
80028
80123
  registerCPEditor(app, "asset-table-typeJson", "asset-table-typeJson-editor", createInputTextEditor("typeJson", "extension.setting.assetTableTypeJson"));