form-custom-test 3.0.113 → 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.
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
  };
@@ -10867,19 +10869,23 @@ const _sfc_main$R = {
10867
10869
  };
10868
10870
  const _hoisted_1$v = { class: "file-upload-widget-container" };
10869
10871
  const _hoisted_2$k = {
10872
+ key: 0,
10873
+ class: "no-data-wrap"
10874
+ };
10875
+ const _hoisted_3$g = {
10870
10876
  key: 0,
10871
10877
  class: "el-upload__tip"
10872
10878
  };
10873
- const _hoisted_3$g = { class: "main-tip" };
10874
- const _hoisted_4$d = { class: "sub-tip" };
10875
- const _hoisted_5$b = { class: "upload-file-list" };
10876
- const _hoisted_6$b = { class: "left-wrap" };
10877
- const _hoisted_7$9 = ["src"];
10878
- const _hoisted_8$6 = ["title"];
10879
- const _hoisted_9$5 = { class: "right-wrap" };
10880
- const _hoisted_10$4 = ["title", "onClick"];
10881
- const _hoisted_11$2 = ["onClick"];
10879
+ const _hoisted_4$d = { class: "main-tip" };
10880
+ const _hoisted_5$b = { class: "sub-tip" };
10881
+ const _hoisted_6$b = { class: "upload-file-list" };
10882
+ const _hoisted_7$9 = { class: "left-wrap" };
10883
+ const _hoisted_8$6 = ["src"];
10884
+ const _hoisted_9$5 = ["title"];
10885
+ const _hoisted_10$4 = { class: "right-wrap" };
10886
+ const _hoisted_11$2 = ["title", "onClick"];
10882
10887
  const _hoisted_12$1 = ["onClick"];
10888
+ const _hoisted_13$1 = ["onClick"];
10883
10889
  function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
10884
10890
  const _component_el_button = resolveComponent("el-button");
10885
10891
  const _component_el_upload = resolveComponent("el-upload");
@@ -10899,6 +10905,7 @@ function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
10899
10905
  }, {
10900
10906
  default: withCtx(() => [
10901
10907
  createElementVNode("div", _hoisted_1$v, [
10908
+ _ctx.getDisabled() && $data.fileList.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_2$k, " \u6682\u65E0\u6570\u636E ")) : createCommentVNode("", true),
10902
10909
  createVNode(_component_el_upload, {
10903
10910
  ref: "fieldEditor",
10904
10911
  disabled: _ctx.getDisabled(),
@@ -10920,22 +10927,22 @@ function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
10920
10927
  "on-progress": $options.handleProgress
10921
10928
  }, createSlots({
10922
10929
  tip: withCtx(() => [
10923
- !!$props.field.options.uploadTip && !_ctx.getDisabled() ? (openBlock(), createElementBlock("div", _hoisted_2$k, toDisplayString($props.field.options.uploadTip), 1)) : createCommentVNode("", true)
10930
+ !!$props.field.options.uploadTip && !_ctx.getDisabled() ? (openBlock(), createElementBlock("div", _hoisted_3$g, toDisplayString($props.field.options.uploadTip), 1)) : createCommentVNode("", true)
10924
10931
  ]),
10925
10932
  file: withCtx(({ file }) => [
10926
- createElementVNode("div", _hoisted_5$b, [
10927
- createElementVNode("div", _hoisted_6$b, [
10933
+ createElementVNode("div", _hoisted_6$b, [
10934
+ createElementVNode("div", _hoisted_7$9, [
10928
10935
  createElementVNode("img", {
10929
10936
  src: $options.getFileIcon(file.name),
10930
10937
  alt: "",
10931
10938
  style: { "width": "18px", "height": "18px", "margin-right": "8px" }
10932
- }, null, 8, _hoisted_7$9),
10939
+ }, null, 8, _hoisted_8$6),
10933
10940
  createElementVNode("div", {
10934
10941
  class: "upload-file-name",
10935
10942
  title: file.name
10936
- }, toDisplayString(file.name), 9, _hoisted_8$6)
10943
+ }, toDisplayString(file.name), 9, _hoisted_9$5)
10937
10944
  ]),
10938
- createElementVNode("div", _hoisted_9$5, [
10945
+ createElementVNode("div", _hoisted_10$4, [
10939
10946
  !_ctx.getDisabled() ? (openBlock(), createElementBlock("div", {
10940
10947
  key: 0,
10941
10948
  class: "file-action",
@@ -10946,17 +10953,17 @@ function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
10946
10953
  src: _imports_1,
10947
10954
  alt: ""
10948
10955
  }, null, -1)
10949
- ])], 8, _hoisted_10$4)) : createCommentVNode("", true),
10956
+ ])], 8, _hoisted_11$2)) : createCommentVNode("", true),
10950
10957
  _ctx.getDisabled() && !$options.isZip(file.name) ? (openBlock(), createElementBlock("div", {
10951
10958
  key: 1,
10952
10959
  onClick: withModifiers(($event) => $options.handlePreview(file), ["stop"]),
10953
10960
  class: "pr-8px color-primary cursor-pointer file-action-right"
10954
- }, " \u9884\u89C8 ", 8, _hoisted_11$2)) : createCommentVNode("", true),
10961
+ }, " \u9884\u89C8 ", 8, _hoisted_12$1)) : createCommentVNode("", true),
10955
10962
  _ctx.getDisabled() ? (openBlock(), createElementBlock("div", {
10956
10963
  key: 2,
10957
10964
  onClick: withModifiers(($event) => $options.handleDownload(file), ["stop"]),
10958
10965
  class: "pr-8px color-primary cursor-pointer file-action-right"
10959
- }, " \u4E0B\u8F7D ", 8, _hoisted_12$1)) : createCommentVNode("", true)
10966
+ }, " \u4E0B\u8F7D ", 8, _hoisted_13$1)) : createCommentVNode("", true)
10960
10967
  ])
10961
10968
  ])
10962
10969
  ]),
@@ -10970,8 +10977,8 @@ function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
10970
10977
  src: _imports_0,
10971
10978
  alt: ""
10972
10979
  }, null, -1)),
10973
- createElementVNode("div", _hoisted_3$g, toDisplayString($props.field.options.mainTip || "\u70B9\u51FB\u6216\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u533A\u57DF\u4E0A\u4F20"), 1),
10974
- createElementVNode("div", _hoisted_4$d, toDisplayString($props.field.options.subTip || `\u652F\u6301\u4E0A\u4F20${$props.field.options.fileTypes.slice(0, 8).join("\uFF0C")}\u7B49\u683C\u5F0F\u6587\u4EF6`), 1)
10980
+ createElementVNode("div", _hoisted_4$d, toDisplayString($props.field.options.mainTip || "\u70B9\u51FB\u6216\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u533A\u57DF\u4E0A\u4F20"), 1),
10981
+ createElementVNode("div", _hoisted_5$b, toDisplayString($props.field.options.subTip || `\u652F\u6301\u4E0A\u4F20${$props.field.options.fileTypes.slice(0, 8).join("\uFF0C")}\u7B49\u683C\u5F0F\u6587\u4EF6`), 1)
10975
10982
  ], 64)) : (openBlock(), createBlock(_component_el_button, {
10976
10983
  key: 1,
10977
10984
  type: "primary"
@@ -10997,7 +11004,7 @@ function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
10997
11004
  _: 1
10998
11005
  }, 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"]);
10999
11006
  }
11000
- var fileUploadWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["render", _sfc_render$R], ["__scopeId", "data-v-7746136c"]]);
11007
+ var fileUploadWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["render", _sfc_render$R], ["__scopeId", "data-v-497c69c8"]]);
11001
11008
  var __glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11002
11009
  __proto__: null,
11003
11010
  "default": fileUploadWidget
@@ -26178,13 +26185,13 @@ function registerIcon(app) {
26178
26185
  if (typeof window !== "undefined") {
26179
26186
  let loadSvg = function() {
26180
26187
  var body = document.body;
26181
- var svgDom = document.getElementById("__svg__icons__dom__1777432134275__");
26188
+ var svgDom = document.getElementById("__svg__icons__dom__1777455438694__");
26182
26189
  if (!svgDom) {
26183
26190
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26184
26191
  svgDom.style.position = "absolute";
26185
26192
  svgDom.style.width = "0";
26186
26193
  svgDom.style.height = "0";
26187
- svgDom.id = "__svg__icons__dom__1777432134275__";
26194
+ svgDom.id = "__svg__icons__dom__1777455438694__";
26188
26195
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
26189
26196
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
26190
26197
  }
@@ -26249,6 +26256,35 @@ const createTextareaEditor = function(propName, propLabelKey, configs = {}) {
26249
26256
  }
26250
26257
  };
26251
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
+ };
26252
26288
  const createBooleanEditor = function(propName, propLabelKey) {
26253
26289
  return {
26254
26290
  props: {
@@ -61778,6 +61814,10 @@ const _sfc_main$4 = {
61778
61814
  assetTypeValue: {
61779
61815
  type: String,
61780
61816
  default: ""
61817
+ },
61818
+ limit: {
61819
+ type: Number,
61820
+ default: 0
61781
61821
  }
61782
61822
  },
61783
61823
  watch: {
@@ -61824,7 +61864,9 @@ const _sfc_main$4 = {
61824
61864
  },
61825
61865
  disabled: false,
61826
61866
  total: 0,
61827
- searchValue: ""
61867
+ searchValue: "",
61868
+ _prevTableSelectionIds: [],
61869
+ _handlingSelectionChange: false
61828
61870
  };
61829
61871
  },
61830
61872
  methods: {
@@ -61834,6 +61876,30 @@ const _sfc_main$4 = {
61834
61876
  handleConfirm() {
61835
61877
  this.$emit("confirm", this.selectedRows);
61836
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
+ },
61837
61903
  getTableData() {
61838
61904
  service$1({
61839
61905
  method: "post",
@@ -61861,7 +61927,34 @@ const _sfc_main$4 = {
61861
61927
  this.getTableData();
61862
61928
  },
61863
61929
  handleAdd() {
61864
- 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
+ }
61865
61958
  const arr = [...this.selectedRows, ...selection].reduce((acc, item) => {
61866
61959
  if (!acc.some((i) => i.assetId === item.assetId)) {
61867
61960
  acc.push(item);
@@ -61869,6 +61962,9 @@ const _sfc_main$4 = {
61869
61962
  return acc;
61870
61963
  }, []);
61871
61964
  this.selectedRows = arr;
61965
+ if (tableRef && typeof tableRef.clearSelection === "function") {
61966
+ tableRef.clearSelection();
61967
+ }
61872
61968
  },
61873
61969
  handleRemove(assetId) {
61874
61970
  const index2 = this.selectedRows.findIndex((item) => item.assetId === assetId);
@@ -62097,6 +62193,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
62097
62193
  "check-strictly": "",
62098
62194
  "row-key": "assetId",
62099
62195
  ref: "tableRef",
62196
+ onSelectionChange: $options.handleSelectionChange,
62100
62197
  "header-row-class-name": "headerRowClassName",
62101
62198
  "header-cell-class-name": "headerCellClassName",
62102
62199
  stripe: ""
@@ -62147,7 +62244,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
62147
62244
  })
62148
62245
  ]),
62149
62246
  _: 1
62150
- }, 8, ["data"]),
62247
+ }, 8, ["data", "onSelectionChange"]),
62151
62248
  createVNode(_component_el_pagination, {
62152
62249
  onSizeChange: $options.handleSizeChange,
62153
62250
  onCurrentChange: $options.handleCurrentChange,
@@ -62225,7 +62322,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
62225
62322
  _: 1
62226
62323
  }, 8, ["modelValue", "onClose"]);
62227
62324
  }
62228
- 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"]]);
62229
62326
  var index_vue_vue_type_style_index_0_lang$1 = "";
62230
62327
  const _sfc_main$3 = {
62231
62328
  name: "asset-select-widget",
@@ -62464,9 +62561,10 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
62464
62561
  onClose: $options.handleClose,
62465
62562
  onConfirm: $options.handleConfirm,
62466
62563
  onCancel: $options.handleCancel,
62564
+ limit: $props.field.options.assetLimit,
62467
62565
  fieldValue: $data.fieldModel,
62468
62566
  assetTypeValue: $props.field.options.assetTypeValue
62469
- }, null, 8, ["dialog-visible", "onClose", "onConfirm", "onCancel", "fieldValue", "assetTypeValue"])
62567
+ }, null, 8, ["dialog-visible", "onClose", "onConfirm", "onCancel", "limit", "fieldValue", "assetTypeValue"])
62470
62568
  ], 4)
62471
62569
  ]),
62472
62570
  _: 1
@@ -62601,20 +62699,15 @@ const _sfc_main$2 = {
62601
62699
  if (ref2 && typeof ref2.setFormJson === "function") {
62602
62700
  ref2.setFormJson(lodash.exports.cloneDeep(this.formJson));
62603
62701
  this.$nextTick(() => {
62604
- this.syncFormDisabledStatus();
62605
62702
  this.flushPendingColHiddenOps();
62703
+ this.syncFormDisabledStatus();
62606
62704
  });
62607
62705
  }
62608
62706
  });
62609
62707
  },
62610
62708
  setColHidden(colNames, hidden) {
62611
62709
  const names = Array.isArray(colNames) ? colNames : [colNames];
62612
- const ref2 = this.$refs.detailFormRender;
62613
- if (!ref2 || typeof ref2.setColHidden !== "function") {
62614
- this.pendingColHiddenOps.push({ names, hidden });
62615
- return;
62616
- }
62617
- names.forEach((name) => ref2.setColHidden(name, hidden));
62710
+ this.pendingColHiddenOps.push({ names, hidden });
62618
62711
  },
62619
62712
  flushPendingColHiddenOps() {
62620
62713
  if (!this.pendingColHiddenOps.length) {
@@ -62755,7 +62848,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
62755
62848
  _: 1
62756
62849
  }, 8, ["modelValue", "onClose"]);
62757
62850
  }
62758
- var DetailDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-137c1c22"]]);
62851
+ var DetailDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-c6770b7c"]]);
62759
62852
  var index_vue_vue_type_style_index_0_lang = "";
62760
62853
  const _sfc_main$1 = {
62761
62854
  name: "asset-table-widget",
@@ -62834,10 +62927,6 @@ const _sfc_main$1 = {
62834
62927
  this.unregisterFromRefList();
62835
62928
  },
62836
62929
  methods: {
62837
- handleClick() {
62838
- this.dialogVisible = true;
62839
- this.triggerEvent("onOpen");
62840
- },
62841
62930
  handleClose() {
62842
62931
  this.dialogVisible = false;
62843
62932
  this.triggerEvent("onClose");
@@ -62885,7 +62974,7 @@ const _sfc_main$1 = {
62885
62974
  }
62886
62975
  },
62887
62976
  handleRow(row) {
62888
- const index2 = this.fieldModel.findIndex((item) => item.id === row.id);
62977
+ const index2 = this.fieldModel.findIndex((item) => item.assetId === row.assetId);
62889
62978
  if (index2 === -1)
62890
62979
  return;
62891
62980
  this.triggerEvent("onOpen", this.fieldModel[index2]);
@@ -62905,7 +62994,7 @@ const _sfc_main$1 = {
62905
62994
  this.detailDialogData = null;
62906
62995
  },
62907
62996
  handleConfirm(formData) {
62908
- const index2 = this.fieldModel.findIndex((item) => item.id === this.detailDialogData.id);
62997
+ const index2 = this.fieldModel.findIndex((item) => item.assetId === this.detailDialogData.assetId);
62909
62998
  if (index2 === -1)
62910
62999
  return;
62911
63000
  const oldValue = lodash.exports.cloneDeep(this.fieldModel);
@@ -63295,6 +63384,7 @@ const loadExtension = function(app) {
63295
63384
  registerCPEditor(app, "asset-select-buttonText", "asset-select-buttonText-editor", createInputTextEditor("buttonText", "extension.setting.assetSelectButtonText"));
63296
63385
  registerCPEditor(app, "asset-select-typeJson", "asset-select-typeJson-editor", createTextareaEditor("typeJson", "extension.setting.assetSelectTypeJson", { rows: 4 }));
63297
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"));
63298
63388
  app.component(AssetTableWidget.name, AssetTableWidget);
63299
63389
  registerCPEditor(app, "asset-table-typeJson", "asset-table-typeJson-editor", createInputTextEditor("typeJson", "extension.setting.assetTableTypeJson"));
63300
63390
  registerCPEditor(app, "asset-table-clickRow", "asset-table-clickRow-editor", createBooleanEditor("clickRow", "extension.setting.assetTableClickRow"));