@94ai/nf-table 8.3.23 → 9.0.0

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.
@@ -1,5 +1,5 @@
1
- import { defineComponent, getCurrentInstance, ref, computed, onMounted, onBeforeMount, nextTick, reactive, watch, set } from "vue-demi";
2
- import { CachedManager, deepClone, resolveValue } from "@94ai/common-utils";
1
+ import { defineComponent, getCurrentInstance, ref, computed, onMounted, onBeforeMount, nextTick, reactive, watch, onBeforeUnmount, set } from "vue-demi";
2
+ import { CachedManager, deepClone, useLocale, resolveValue } from "@94ai/common-utils";
3
3
  import { normalizeComponent as normalizeComponent$1 } from "@94ai/vue2-runtime-helpers";
4
4
  import { Checkbox, Radio, TableColumn, Loading } from "element-ui";
5
5
  import { getCurrentInstance as getCurrentInstance$1, effectScope, shallowReactive } from "vue";
@@ -2413,7 +2413,7 @@ var autoScroll = throttle$1(function(evt, options, rootEl2, isFallback) {
2413
2413
  clearInterval(autoScrolls[layersOut].pid);
2414
2414
  if (vx != 0 || vy != 0) {
2415
2415
  scrollThisInstance = true;
2416
- autoScrolls[layersOut].pid = setInterval((function() {
2416
+ autoScrolls[layersOut].pid = setInterval(function() {
2417
2417
  if (isFallback && this.layer === 0) {
2418
2418
  Sortable.active._onTouchMove(touchEvt$1);
2419
2419
  }
@@ -2425,7 +2425,7 @@ var autoScroll = throttle$1(function(evt, options, rootEl2, isFallback) {
2425
2425
  }
2426
2426
  }
2427
2427
  scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
2428
- }).bind({
2428
+ }.bind({
2429
2429
  layer: layersOut
2430
2430
  }), 24);
2431
2431
  }
@@ -3130,9 +3130,9 @@ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(sortable_esm);
3130
3130
  });
3131
3131
  if (mode & 2 && typeof value != "string")
3132
3132
  for (var key in value)
3133
- __webpack_require__.d(ns, key, (function(key2) {
3133
+ __webpack_require__.d(ns, key, function(key2) {
3134
3134
  return value[key2];
3135
- }).bind(null, key));
3135
+ }.bind(null, key));
3136
3136
  return ns;
3137
3137
  };
3138
3138
  __webpack_require__.n = function(module2) {
@@ -9100,8 +9100,7 @@ __sfc_main.props = {
9100
9100
  selectEmptyWarningTips: {
9101
9101
  key: "selectEmptyWarningTips",
9102
9102
  required: false,
9103
- type: String,
9104
- default: "请选择至少一个选项"
9103
+ type: String
9105
9104
  },
9106
9105
  columnDisplayBtnClass: {
9107
9106
  key: "columnDisplayBtnClass",
@@ -9160,32 +9159,27 @@ __sfc_main.props = {
9160
9159
  columnDisplayBtnText: {
9161
9160
  key: "columnDisplayBtnText",
9162
9161
  required: false,
9163
- type: String,
9164
- default: "设置列表字段"
9162
+ type: String
9165
9163
  },
9166
9164
  columnCheckTitle: {
9167
9165
  key: "columnCheckTitle",
9168
9166
  required: false,
9169
- type: String,
9170
- default: "设置显示字段"
9167
+ type: String
9171
9168
  },
9172
9169
  columnCheckCancelButtonText: {
9173
9170
  key: "columnCheckCancelButtonText",
9174
9171
  required: false,
9175
- type: String,
9176
- default: "取消"
9172
+ type: String
9177
9173
  },
9178
9174
  columnCheckConfirmButtonText: {
9179
9175
  key: "columnCheckConfirmButtonText",
9180
9176
  required: false,
9181
- type: String,
9182
- default: "确定"
9177
+ type: String
9183
9178
  },
9184
9179
  columnCheckBasicFieldDesc: {
9185
9180
  key: "columnCheckBasicFieldDesc",
9186
9181
  required: false,
9187
- type: String,
9188
- default: "基础字段"
9182
+ type: String
9189
9183
  },
9190
9184
  columnCheckWidth: {
9191
9185
  key: "columnCheckWidth",
@@ -9274,38 +9268,32 @@ __sfc_main.props = {
9274
9268
  columnCheckSearchPlaceholder: {
9275
9269
  key: "columnCheckSearchPlaceholder",
9276
9270
  required: false,
9277
- type: String,
9278
- default: "搜索"
9271
+ type: String
9279
9272
  },
9280
9273
  columnCheckFixedLeftDesc: {
9281
9274
  key: "columnCheckFixedLeftDesc",
9282
9275
  required: false,
9283
- type: String,
9284
- default: "固定在左侧"
9276
+ type: String
9285
9277
  },
9286
9278
  columnCheckClearDesc: {
9287
9279
  key: "columnCheckClearDesc",
9288
9280
  required: false,
9289
- type: String,
9290
- default: "清除"
9281
+ type: String
9291
9282
  },
9292
9283
  columnCheckNoFixedDesc: {
9293
9284
  key: "columnCheckNoFixedDesc",
9294
9285
  required: false,
9295
- type: String,
9296
- default: "不固定"
9286
+ type: String
9297
9287
  },
9298
9288
  columnCheckGetCheckedLengthDesc: {
9299
9289
  key: "columnCheckGetCheckedLengthDesc",
9300
9290
  required: false,
9301
- type: null,
9302
- default: (length) => (length2) => "已选(" + length2 + ")"
9291
+ type: null
9303
9292
  },
9304
9293
  columnCheckGetAllCheckDesc: {
9305
9294
  key: "columnCheckGetAllCheckDesc",
9306
9295
  required: false,
9307
- type: null,
9308
- default: (length) => (length2) => "全选(" + length2 + ")"
9296
+ type: null
9309
9297
  },
9310
9298
  columnCheckTabs: {
9311
9299
  key: "columnCheckTabs",
@@ -9427,7 +9415,7 @@ __sfc_main.props = {
9427
9415
  }
9428
9416
  };
9429
9417
  __sfc_main.setup = (__props, __ctx) => {
9430
- var _a;
9418
+ var _a, _b, _c;
9431
9419
  const props = __props;
9432
9420
  const emit = __ctx.emit;
9433
9421
  const processedColumns = computed(() => {
@@ -9451,9 +9439,9 @@ __sfc_main.setup = (__props, __ctx) => {
9451
9439
  return {
9452
9440
  ...item.events || {},
9453
9441
  click: (...args) => {
9454
- var _a2, _b;
9442
+ var _a2, _b2;
9455
9443
  (_a2 = item.events) == null ? void 0 : _a2.click(args);
9456
- (_b = item.onClick) == null ? void 0 : _b.call(item, scope.row, scope);
9444
+ (_b2 = item.onClick) == null ? void 0 : _b2.call(item, scope.row, scope);
9457
9445
  }
9458
9446
  };
9459
9447
  };
@@ -9472,8 +9460,30 @@ __sfc_main.setup = (__props, __ctx) => {
9472
9460
  const elTableHeight = ref();
9473
9461
  const nfColumCheckDialogVisible = ref(false);
9474
9462
  const preSearchFormData = ref({});
9475
- const cPageChangeSearchApi = ref(props.pageChangeSearchApi ?? props.setEasyConf);
9476
- const cInitSearchApi = ref(props.initSearchApi ?? props.setEasyConf);
9463
+ const cPageChangeSearchApi = ref((_b = props.pageChangeSearchApi) != null ? _b : props.setEasyConf);
9464
+ const cInitSearchApi = ref((_c = props.initSearchApi) != null ? _c : props.setEasyConf);
9465
+ const {
9466
+ t
9467
+ } = useLocale();
9468
+ const localeText = computed(() => ({
9469
+ emptyText: props.emptyText || t("nf.table.emptyText"),
9470
+ columnDisplayBtnText: props.columnDisplayBtnText || t("nf.table.columnDisplayBtnText"),
9471
+ columnCheckTitle: props.columnCheckTitle || t("nf.table.columnCheckTitle"),
9472
+ columnCheckCancelButtonText: props.columnCheckCancelButtonText || t("nf.table.cancel"),
9473
+ columnCheckConfirmButtonText: props.columnCheckConfirmButtonText || t("nf.table.confirm"),
9474
+ columnCheckSearchPlaceholder: props.columnCheckSearchPlaceholder || t("nf.table.searchPlaceholder"),
9475
+ columnCheckFixedLeftDesc: props.columnCheckFixedLeftDesc || t("nf.table.fixedLeft"),
9476
+ columnCheckClearDesc: props.columnCheckClearDesc || t("nf.table.clear"),
9477
+ columnCheckNoFixedDesc: props.columnCheckNoFixedDesc || t("nf.table.noFixed"),
9478
+ columnCheckBasicFieldDesc: props.columnCheckBasicFieldDesc || t("nf.table.basicField"),
9479
+ selectEmptyWarningTips: props.selectEmptyWarningTips || t("nf.table.selectEmptyWarning"),
9480
+ columnCheckGetCheckedLengthDesc: props.columnCheckGetCheckedLengthDesc || ((length) => t("nf.table.checkedLength", {
9481
+ length
9482
+ })),
9483
+ columnCheckGetAllCheckDesc: props.columnCheckGetAllCheckDesc || ((length) => t("nf.table.allCheck", {
9484
+ length
9485
+ }))
9486
+ }));
9477
9487
  const cStorageKey = computed(() => {
9478
9488
  const key = props.storageKey || `nf-table-columns-cached-key-${routeName.value}`;
9479
9489
  const userId = window.userId;
@@ -9482,52 +9492,10 @@ __sfc_main.setup = (__props, __ctx) => {
9482
9492
  }
9483
9493
  return key;
9484
9494
  });
9485
- const cStorageKeyViewIdentity = computed(() => {
9495
+ computed(() => {
9486
9496
  return "nf-table-view-identity";
9487
9497
  });
9488
9498
  const checkViewIdentityChange = async () => {
9489
- const userId = window.userId;
9490
- const viewField = window.viewField;
9491
- if (props.viewIdentity && userId && viewField) {
9492
- let viewIdentity = CachedManager.syncCachedGet(cStorageKeyViewIdentity.value);
9493
- if (!viewIdentity) {
9494
- viewIdentity = await CachedManager.asyncCachedGet(cStorageKeyViewIdentity.value);
9495
- }
9496
- if (!viewIdentity) {
9497
- await CachedManager.asyncCachedSet(cStorageKeyViewIdentity.value, viewField);
9498
- } else {
9499
- const newViewIdentity = viewField.find((item) => item.viewIdentity === props.viewIdentity);
9500
- const oldViewIdentity = viewIdentity.find((item) => item.viewIdentity === props.viewIdentity);
9501
- if (newViewIdentity && !oldViewIdentity || !newViewIdentity && oldViewIdentity) {
9502
- await clearColumnEditCached();
9503
- await clearDragCached();
9504
- } else if (newViewIdentity && oldViewIdentity) {
9505
- let change = false;
9506
- newViewIdentity.fieldList.every((item) => {
9507
- if (!oldViewIdentity.fieldList.includes(item)) {
9508
- change = true;
9509
- return;
9510
- }
9511
- return true;
9512
- });
9513
- if (!change) {
9514
- oldViewIdentity.fieldList.every((item) => {
9515
- if (!newViewIdentity.fieldList.includes(item)) {
9516
- change = true;
9517
- return;
9518
- }
9519
- return true;
9520
- });
9521
- }
9522
- if (change) {
9523
- await clearColumnEditCached();
9524
- await clearDragCached();
9525
- oldViewIdentity.fieldList = newViewIdentity.fieldList;
9526
- await CachedManager.asyncCachedSet(cStorageKeyViewIdentity.value, viewIdentity);
9527
- }
9528
- }
9529
- }
9530
- }
9531
9499
  };
9532
9500
  const cPageAttrs = reactive({
9533
9501
  // 页码,没有props时 & 允许分页时;默认 = 1
@@ -9571,7 +9539,7 @@ __sfc_main.setup = (__props, __ctx) => {
9571
9539
  watch(() => {
9572
9540
  return props.loading || tableLoading.value;
9573
9541
  }, async () => {
9574
- var _a2, _b;
9542
+ var _a2, _b2;
9575
9543
  if (props.loading || tableLoading.value) {
9576
9544
  await nextTick();
9577
9545
  const {
@@ -9593,7 +9561,7 @@ __sfc_main.setup = (__props, __ctx) => {
9593
9561
  customClass
9594
9562
  });
9595
9563
  } else {
9596
- (_b = loadingInstance.value) == null ? void 0 : _b.close();
9564
+ (_b2 = loadingInstance.value) == null ? void 0 : _b2.close();
9597
9565
  }
9598
9566
  }, {
9599
9567
  immediate: true
@@ -9603,9 +9571,9 @@ __sfc_main.setup = (__props, __ctx) => {
9603
9571
  props.columns._skip = true;
9604
9572
  }
9605
9573
  const result = processedColumns.value.filter((item) => {
9606
- var _a2, _b;
9574
+ var _a2, _b2;
9607
9575
  const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
9608
- if ((_b = props.showColumn) == null ? void 0 : _b.includes(prop)) {
9576
+ if ((_b2 = props.showColumn) == null ? void 0 : _b2.includes(prop)) {
9609
9577
  item.initHidden = false;
9610
9578
  }
9611
9579
  return !item.initHidden;
@@ -9639,11 +9607,11 @@ __sfc_main.setup = (__props, __ctx) => {
9639
9607
  if (props.columnEdit) {
9640
9608
  const columnState = {};
9641
9609
  processedColumns.value.map((i, index2) => {
9642
- var _a2, _b;
9610
+ var _a2, _b2;
9643
9611
  const prop = i.prop || ((_a2 = i.attr) == null ? void 0 : _a2.prop);
9644
9612
  columnState[prop] = {
9645
9613
  initHidden: i.initHidden || false,
9646
- fixed: ((_b = i.attr) == null ? void 0 : _b.fixed) || false,
9614
+ fixed: ((_b2 = i.attr) == null ? void 0 : _b2.fixed) || false,
9647
9615
  prop,
9648
9616
  index: index2
9649
9617
  };
@@ -9654,9 +9622,9 @@ __sfc_main.setup = (__props, __ctx) => {
9654
9622
  const syncShowItemToInitHidden = () => {
9655
9623
  props.columns._skip = true;
9656
9624
  processedColumns.value.forEach((item) => {
9657
- var _a2, _b;
9625
+ var _a2, _b2;
9658
9626
  const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
9659
- if ((_b = localShowColumn.value) == null ? void 0 : _b.includes(prop)) {
9627
+ if ((_b2 = localShowColumn.value) == null ? void 0 : _b2.includes(prop)) {
9660
9628
  item.initHidden = false;
9661
9629
  } else {
9662
9630
  item.initHidden = true;
@@ -9693,7 +9661,7 @@ __sfc_main.setup = (__props, __ctx) => {
9693
9661
  }
9694
9662
  };
9695
9663
  const initCachedData = async () => {
9696
- var _a2, _b;
9664
+ var _a2, _b2;
9697
9665
  if (props.columnEdit) {
9698
9666
  try {
9699
9667
  await checkViewIdentityChange();
@@ -9704,7 +9672,7 @@ __sfc_main.setup = (__props, __ctx) => {
9704
9672
  const cachedPriority = props.priority === "cached";
9705
9673
  if (cachedPriority ? cached : (_a2 = localShowColumn.value) == null ? void 0 : _a2.length) {
9706
9674
  cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies();
9707
- } else if (cachedPriority ? (_b = localShowColumn.value) == null ? void 0 : _b.length : cached) {
9675
+ } else if (cachedPriority ? (_b2 = localShowColumn.value) == null ? void 0 : _b2.length : cached) {
9708
9676
  cachedPriority ? await syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn();
9709
9677
  }
9710
9678
  } catch (e) {
@@ -9716,6 +9684,7 @@ __sfc_main.setup = (__props, __ctx) => {
9716
9684
  }
9717
9685
  };
9718
9686
  const getMinWidth = (column) => {
9687
+ var _a2, _b2;
9719
9688
  const columnLabel = resolveValue(column.label);
9720
9689
  if ((columnLabel == null ? void 0 : columnLabel.indexOf("$$")) === 0) {
9721
9690
  const value = Number(columnLabel.replace("$$", ""));
@@ -9723,13 +9692,55 @@ __sfc_main.setup = (__props, __ctx) => {
9723
9692
  return value;
9724
9693
  }
9725
9694
  }
9726
- const fs = 14;
9727
- const char = columnLabel.match(/[\u2E80-\u9FFF]/g);
9728
- const charLen = char ? char.length : 0;
9729
- const num = columnLabel.match(/\d|\./g);
9730
- const numLen = num ? num.length : 0;
9731
- const otherLen = columnLabel.length - charLen - numLen;
9732
- return fs * (charLen * 1 + numLen * 0.7 + otherLen * 0.58) + 20 + (column.sortable ? 24 : 0);
9695
+ const label = columnLabel || "";
9696
+ const sortable = column.sortable || ((_a2 = column.attr) == null ? void 0 : _a2.sortable);
9697
+ const hasColumnCheckIcon = props.columnEdit && column.prop === props.operationPropKey && props.columnPosition === "embed";
9698
+ const labelWidth = (hasColumnCheckIcon ? measureText(` ${label} `, "600 14px") + 33 : measureText(sortable ? `${label} ` : label, "600 14px")) + CELL_PADDING + (sortable ? 24 : 0);
9699
+ const tags = [...getTagTexts(column), ...((_b2 = column.fit) == null ? void 0 : _b2.tags) || []];
9700
+ const tagWidth = Math.max(0, ...tags.map((tag) => measureText(` ${tag}`, "12px") + 26 + CELL_PADDING));
9701
+ return Math.ceil(Math.max(labelWidth, tagWidth, column.__contentWidth || 0));
9702
+ };
9703
+ const CELL_PADDING = 20;
9704
+ let measureContext = null;
9705
+ let fontFamily = "";
9706
+ const measureText = (text, font) => {
9707
+ measureContext = measureContext || document.createElement("canvas").getContext("2d");
9708
+ fontFamily = fontFamily || getComputedStyle(document.body).fontFamily;
9709
+ measureContext.font = `${font} ${fontFamily}`;
9710
+ return measureContext.measureText(String(text)).width;
9711
+ };
9712
+ const getTagTexts = (column) => {
9713
+ const tagMap = column.optionsTag || {};
9714
+ return Object.keys(tagMap).filter((key) => tagMap[key]).map((key) => {
9715
+ var _a2;
9716
+ return (_a2 = column.optionsEnum) == null ? void 0 : _a2[key];
9717
+ });
9718
+ };
9719
+ const applyColumnWidth = (item, dragProp) => {
9720
+ if (!item.label || item.type)
9721
+ return;
9722
+ const attr = item.attr;
9723
+ const raw = item.__rawWidth || (item.__rawWidth = {});
9724
+ const applied = item.__appliedWidth || {};
9725
+ if (attr.width !== applied.width)
9726
+ raw.width = attr.width;
9727
+ if (attr["min-width"] !== applied.minWidth)
9728
+ raw.minWidth = attr["min-width"];
9729
+ const need = getMinWidth(item);
9730
+ set(attr, "min-width", Math.max(parseFloat(raw.minWidth) || 0, need) + "px");
9731
+ if (raw.width) {
9732
+ set(attr, "width", Math.max(parseFloat(raw.width) || 0, need) + "px");
9733
+ }
9734
+ if (props.dragCached) {
9735
+ const columnWidth = CachedManager.syncCachedGet(`${cStorageKey.value}$drag-column-width`) || {};
9736
+ if (columnWidth[dragProp]) {
9737
+ set(attr, "width", columnWidth[dragProp]);
9738
+ }
9739
+ }
9740
+ item.__appliedWidth = {
9741
+ width: attr.width,
9742
+ minWidth: attr["min-width"]
9743
+ };
9733
9744
  };
9734
9745
  const tableColumns = ref([]);
9735
9746
  const elTableRefKey = ref(Date.now());
@@ -9738,16 +9749,7 @@ __sfc_main.setup = (__props, __ctx) => {
9738
9749
  const columns = processedColumns.value.map((item, index2) => {
9739
9750
  var _a2;
9740
9751
  const attr = item.attr || {};
9741
- if (!attr["min-width"] && item.label) {
9742
- attr["min-width"] = String(getMinWidth(item)) + "px";
9743
- }
9744
- if (props.dragCached) {
9745
- const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
9746
- let columnWidth = CachedManager.syncCachedGet(`${cStorageKey.value}$drag-column-width`) || {};
9747
- if (columnWidth[prop]) {
9748
- attr.width = columnWidth[prop];
9749
- }
9750
- }
9752
+ const dragProp = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
9751
9753
  item.attr = {
9752
9754
  ...item.attr,
9753
9755
  ...attr
@@ -9766,6 +9768,11 @@ __sfc_main.setup = (__props, __ctx) => {
9766
9768
  item.optionsEnum[o.value] = o.label;
9767
9769
  item.optionsTag[o.value] = o.tagType;
9768
9770
  });
9771
+ props.columns._skip = true;
9772
+ applyColumnWidth(item, dragProp);
9773
+ nextTick(() => {
9774
+ props.columns._skip = false;
9775
+ });
9769
9776
  });
9770
9777
  } else if (item.options) {
9771
9778
  set(item, "optionsEnum", {});
@@ -9774,6 +9781,7 @@ __sfc_main.setup = (__props, __ctx) => {
9774
9781
  item.optionsTag[o.value] = o.tagType;
9775
9782
  });
9776
9783
  }
9784
+ applyColumnWidth(item, dragProp);
9777
9785
  return item;
9778
9786
  });
9779
9787
  if (readCached && props.columnEdit) {
@@ -9788,6 +9796,7 @@ __sfc_main.setup = (__props, __ctx) => {
9788
9796
  if (typeof columnState === "string") {
9789
9797
  columnState = JSON.parse(columnState);
9790
9798
  }
9799
+ let maxIndex = 0;
9791
9800
  for (const key in columnState) {
9792
9801
  const state = columnState[key];
9793
9802
  columns.every((i) => {
@@ -9797,11 +9806,26 @@ __sfc_main.setup = (__props, __ctx) => {
9797
9806
  fixed: state.fixed
9798
9807
  };
9799
9808
  i._index = state.index;
9809
+ if (maxIndex < state.index) {
9810
+ maxIndex = state.index;
9811
+ }
9800
9812
  return false;
9801
9813
  }
9802
9814
  return true;
9803
9815
  });
9804
9816
  }
9817
+ const columnStateKeys = Object.keys(columnState);
9818
+ columns.forEach((item) => {
9819
+ if (!columnStateKeys.includes(item.prop)) {
9820
+ maxIndex++;
9821
+ item._index = maxIndex;
9822
+ }
9823
+ });
9824
+ const optItem = columns.find((itemOpt) => itemOpt.prop === props.operationPropKey);
9825
+ if (optItem) {
9826
+ maxIndex++;
9827
+ optItem._index = maxIndex++;
9828
+ }
9805
9829
  }
9806
9830
  } catch (e) {
9807
9831
  console.log(e);
@@ -9962,8 +9986,8 @@ __sfc_main.setup = (__props, __ctx) => {
9962
9986
  (_a2 = elTableRef.value) == null ? void 0 : _a2.clearFilter();
9963
9987
  };
9964
9988
  const doLayout = () => {
9965
- var _a2, _b;
9966
- (_b = (_a2 = elTableRef.value) == null ? void 0 : _a2.doLayout) == null ? void 0 : _b.call(_a2);
9989
+ var _a2, _b2;
9990
+ (_b2 = (_a2 = elTableRef.value) == null ? void 0 : _a2.doLayout) == null ? void 0 : _b2.call(_a2);
9967
9991
  };
9968
9992
  const sort2 = (prop, order) => {
9969
9993
  var _a2;
@@ -9977,10 +10001,124 @@ __sfc_main.setup = (__props, __ctx) => {
9977
10001
  ...item.style || {}
9978
10002
  };
9979
10003
  };
10004
+ const fitOperationColumn = () => {
10005
+ const table = elTableRef.value;
10006
+ const config = tableColumns.value.find((item) => item.prop === props.operationPropKey);
10007
+ if (!table || !config || !config.attr)
10008
+ return;
10009
+ const column = (table.store.states.columns || []).find((item) => item.property === props.operationPropKey);
10010
+ if (!column)
10011
+ return;
10012
+ const fixedWrapper = column.fixed === "left" || column.fixed === true ? ".el-table__fixed" : column.fixed === "right" ? ".el-table__fixed-right" : "";
10013
+ let cells = fixedWrapper ? [...table.$el.querySelectorAll(`${fixedWrapper} .el-table__fixed-body-wrapper td.${column.id} .cell`)] : [];
10014
+ if (!cells.length)
10015
+ cells = [...table.$el.querySelectorAll(`.el-table__body-wrapper td.${column.id} .cell`)];
10016
+ if (!cells.length)
10017
+ return;
10018
+ const origins = cells.map((cell) => [cell.style.whiteSpace, cell.style.width]);
10019
+ cells.forEach((cell) => {
10020
+ cell.style.whiteSpace = "nowrap";
10021
+ cell.style.width = "max-content";
10022
+ });
10023
+ const contentTags = ["BUTTON", "A", "I", "SVG", "IMG"];
10024
+ const range = document.createRange();
10025
+ const need = Math.max(...cells.map((cell) => {
10026
+ const rect = cell.getBoundingClientRect();
10027
+ let right = rect.left;
10028
+ cell.querySelectorAll("*").forEach((el) => {
10029
+ const tag = el.tagName.toUpperCase();
10030
+ if (!contentTags.includes(tag) && el.children.length)
10031
+ return;
10032
+ let box = el.getBoundingClientRect();
10033
+ if (!box.width)
10034
+ return;
10035
+ if (!contentTags.includes(tag) && !getComputedStyle(el).display.startsWith("inline")) {
10036
+ range.selectNodeContents(el);
10037
+ box = range.getBoundingClientRect();
10038
+ }
10039
+ right = Math.max(right, box.right);
10040
+ });
10041
+ return Math.ceil(right - rect.left + parseFloat(getComputedStyle(cell).paddingRight)) + 1;
10042
+ }));
10043
+ cells.forEach((cell, i) => {
10044
+ cell.style.whiteSpace = origins[i][0];
10045
+ cell.style.width = origins[i][1];
10046
+ });
10047
+ const current = parseFloat(config.attr.width) || column.realWidth || column.width || 0;
10048
+ if (need > current) {
10049
+ config.__contentWidth = need;
10050
+ props.columns._skip = true;
10051
+ set(config.attr, "width", need + "px");
10052
+ config.__appliedWidth = {
10053
+ ...config.__appliedWidth,
10054
+ width: config.attr.width
10055
+ };
10056
+ nextTick(() => {
10057
+ props.columns._skip = false;
10058
+ doLayout();
10059
+ });
10060
+ }
10061
+ };
10062
+ let rowHeightObserver = null;
10063
+ let rowHeightFrame = 0;
10064
+ const syncRowHeights = () => {
10065
+ var _a2;
10066
+ rowHeightFrame = 0;
10067
+ const tableEl = (_a2 = elTableRef.value) == null ? void 0 : _a2.$el;
10068
+ if (!tableEl)
10069
+ return;
10070
+ const bodies = [tableEl.querySelector(".el-table__body-wrapper tbody"), ...tableEl.querySelectorAll(".el-table__fixed-body-wrapper tbody")].filter(Boolean);
10071
+ if (bodies.length < 2)
10072
+ return;
10073
+ const groups = bodies.map((body) => [...body.children].filter((tr) => tr.tagName === "TR"));
10074
+ if (groups.some((rows) => rows.length !== groups[0].length))
10075
+ return;
10076
+ groups.forEach((rows) => rows.forEach((tr) => {
10077
+ if (tr.dataset.nfRowHeight) {
10078
+ tr.style.height = tr.dataset.nfOriginHeight || "";
10079
+ delete tr.dataset.nfRowHeight;
10080
+ }
10081
+ }));
10082
+ const heights = groups.map((rows) => rows.map((tr) => tr.getBoundingClientRect().height));
10083
+ groups[0].forEach((_, i) => {
10084
+ const rowHeights = heights.map((list) => list[i]);
10085
+ const max = Math.max(...rowHeights);
10086
+ if (max - Math.min(...rowHeights) < 0.5)
10087
+ return;
10088
+ groups.forEach((rows) => {
10089
+ const tr = rows[i];
10090
+ tr.dataset.nfOriginHeight = tr.style.height;
10091
+ tr.dataset.nfRowHeight = "1";
10092
+ tr.style.height = max + "px";
10093
+ });
10094
+ });
10095
+ };
10096
+ const observeRowHeights = () => {
10097
+ var _a2;
10098
+ rowHeightObserver == null ? void 0 : rowHeightObserver.disconnect();
10099
+ rowHeightObserver = null;
10100
+ const tableEl = (_a2 = elTableRef.value) == null ? void 0 : _a2.$el;
10101
+ if (!tableEl || !window.ResizeObserver || !tableEl.querySelector(".el-table__fixed-body-wrapper"))
10102
+ return;
10103
+ rowHeightObserver = new ResizeObserver(() => {
10104
+ rowHeightFrame = rowHeightFrame || requestAnimationFrame(syncRowHeights);
10105
+ });
10106
+ tableEl.querySelectorAll(".el-table__body-wrapper td:not(.is-hidden) > .cell, .el-table__fixed-body-wrapper td:not(.is-hidden) > .cell").forEach((cell) => rowHeightObserver.observe(cell));
10107
+ };
10108
+ onBeforeUnmount(() => {
10109
+ rowHeightObserver == null ? void 0 : rowHeightObserver.disconnect();
10110
+ rowHeightFrame && cancelAnimationFrame(rowHeightFrame);
10111
+ });
10112
+ watch([() => props.data, elTableRefKey], () => {
10113
+ nextTick(() => requestAnimationFrame(() => {
10114
+ fitOperationColumn();
10115
+ observeRowHeights();
10116
+ }));
10117
+ });
9980
10118
  const headerDragend = async (newWidth, oldWidth, column, event) => {
9981
- var _a2, _b;
10119
+ var _a2, _b2;
9982
10120
  await nextTick();
9983
- const minWidth = getMinWidth(column);
10121
+ const minWidth = getMinWidth(tableColumns.value.find((item) => item.prop === column.property) || column);
9984
10122
  if (newWidth < minWidth) {
9985
10123
  column.width = minWidth;
9986
10124
  }
@@ -9990,11 +10128,11 @@ __sfc_main.setup = (__props, __ctx) => {
9990
10128
  await CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, columnCachedData);
9991
10129
  }
9992
10130
  resizeTable();
9993
- await ((_b = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b.call(_a2, newWidth, oldWidth, column, event));
10131
+ await ((_b2 = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b2.call(_a2, newWidth, oldWidth, column, event));
9994
10132
  };
9995
10133
  let opFixedRightCleanup = null;
9996
10134
  const initOpFixedRightResizer = async () => {
9997
- var _a2, _b, _c;
10135
+ var _a2, _b2, _c2;
9998
10136
  await nextTick();
9999
10137
  opFixedRightCleanup == null ? void 0 : opFixedRightCleanup();
10000
10138
  opFixedRightCleanup = null;
@@ -10008,7 +10146,7 @@ __sfc_main.setup = (__props, __ctx) => {
10008
10146
  var _a3;
10009
10147
  return (col.prop || ((_a3 = col.attr) == null ? void 0 : _a3.prop)) === props.operationPropKey;
10010
10148
  });
10011
- if (!opCol || ((_b = opCol == null ? void 0 : opCol.attr) == null ? void 0 : _b.fixed) !== "right")
10149
+ if (!opCol || ((_b2 = opCol == null ? void 0 : opCol.attr) == null ? void 0 : _b2.fixed) !== "right")
10012
10150
  return;
10013
10151
  const fixedRightHeader = tableEl.querySelector(".el-table__fixed-right .el-table__fixed-header-wrapper thead tr");
10014
10152
  if (!fixedRightHeader)
@@ -10064,7 +10202,7 @@ __sfc_main.setup = (__props, __ctx) => {
10064
10202
  handle.style.pointerEvents = "auto";
10065
10203
  overlay.appendChild(handle);
10066
10204
  let indicatorLine = null;
10067
- const columnProp = opCol.prop || ((_c = opCol.attr) == null ? void 0 : _c.prop);
10205
+ const columnProp = opCol.prop || ((_c2 = opCol.attr) == null ? void 0 : _c2.prop);
10068
10206
  const createIndicatorLine = (rect) => {
10069
10207
  const line = document.createElement("div");
10070
10208
  line.id = "nf-fixed-right-indicator-line";
@@ -10222,7 +10360,7 @@ __sfc_main.setup = (__props, __ctx) => {
10222
10360
  }
10223
10361
  };
10224
10362
  const calcTableHeight = () => {
10225
- var _a2, _b;
10363
+ var _a2, _b2;
10226
10364
  if (props.calHeight && nfTableContent.value) {
10227
10365
  const tableContentH = (_a2 = nfTableContent.value) == null ? void 0 : _a2.offsetHeight;
10228
10366
  const actionH = nfTableActionContainerRef.value.offsetHeight;
@@ -10231,13 +10369,13 @@ __sfc_main.setup = (__props, __ctx) => {
10231
10369
  elTableHeight.value = h;
10232
10370
  }
10233
10371
  } else {
10234
- elTableHeight.value = (_b = props.tableAttrs) == null ? void 0 : _b.height;
10372
+ elTableHeight.value = (_b2 = props.tableAttrs) == null ? void 0 : _b2.height;
10235
10373
  }
10236
10374
  };
10237
10375
  const searchApi = async (formData = {}, refresh = false) => {
10238
- var _a2, _b, _c;
10239
- (_b = (_a2 = props.searchFormEvents) == null ? void 0 : _a2["onSearch"]) == null ? void 0 : _b.call(_a2, formData);
10240
- if (!((_c = instance == null ? void 0 : instance.$listeners) == null ? void 0 : _c.searchApi))
10376
+ var _a2, _b2, _c2;
10377
+ (_b2 = (_a2 = props.searchFormEvents) == null ? void 0 : _a2["onSearch"]) == null ? void 0 : _b2.call(_a2, formData);
10378
+ if (!((_c2 = instance == null ? void 0 : instance.$listeners) == null ? void 0 : _c2.searchApi))
10241
10379
  return;
10242
10380
  tableLoading.value = true;
10243
10381
  if (refresh || JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
@@ -10321,8 +10459,8 @@ __sfc_main.setup = (__props, __ctx) => {
10321
10459
  return ((_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.nfSearchFormModel) || {};
10322
10460
  },
10323
10461
  set: (formData) => {
10324
- var _a2, _b;
10325
- return (_b = (_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.setNfSearchFormModel) == null ? void 0 : _b.call(_a2, formData);
10462
+ var _a2, _b2;
10463
+ return (_b2 = (_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.setNfSearchFormModel) == null ? void 0 : _b2.call(_a2, formData);
10326
10464
  }
10327
10465
  });
10328
10466
  return Object.assign({
@@ -10342,6 +10480,7 @@ __sfc_main.setup = (__props, __ctx) => {
10342
10480
  columnCheckNfDrawer,
10343
10481
  elTableHeight,
10344
10482
  nfColumCheckDialogVisible,
10483
+ localeText,
10345
10484
  cStorageKey,
10346
10485
  cPageAttrs,
10347
10486
  handleSizeChange,
@@ -10517,7 +10656,7 @@ __sfc_main.components = Object.assign({
10517
10656
  ColumnCheckDrawer
10518
10657
  }, __sfc_main.components);
10519
10658
  var _sfc_render = function render4() {
10520
- var _a, _b, _c2, _d;
10659
+ var _a, _b, _c2, _d, _e, _f;
10521
10660
  var _vm = this, _c = _vm._self._c;
10522
10661
  _vm._self._setupProxy;
10523
10662
  return _c("div", {
@@ -10531,7 +10670,7 @@ var _sfc_render = function render4() {
10531
10670
  "onSearch": _vm.searchApi
10532
10671
  }
10533
10672
  }, "nf-search-form", _vm.searchFormAttrer, false), _vm.searchFormEvents), [_vm._l(((_a2 = _vm.nfSearchFormRef) == null ? void 0 : _a2.renderSearchFormItemOptions) || [], function(item) {
10534
- var _a3, _b2, _c3, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
10673
+ var _a3, _b2, _c3, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
10535
10674
  return [((_a3 = item.tooltip) == null ? void 0 : _a3.slot) ? _vm._t(item.tooltip.slot, null, {
10536
10675
  "slot": item.tooltip.slot
10537
10676
  }) : _vm._e(), item.slot ? _vm._t(item.slot, null, {
@@ -10539,7 +10678,7 @@ var _sfc_render = function render4() {
10539
10678
  "formData": _vm.nfSearchFormModel
10540
10679
  }) : _vm._e(), ((_b2 = item.inputSlot) == null ? void 0 : _b2.prepend) ? _vm._t((_c3 = item.inputSlot) == null ? void 0 : _c3.prepend, null, {
10541
10680
  "slot": (_d2 = item.inputSlot) == null ? void 0 : _d2.prepend
10542
- }) : _vm._e(), ((_e = item.inputSlot) == null ? void 0 : _e.append) ? _vm._t((_f = item.inputSlot) == null ? void 0 : _f.append, null, {
10681
+ }) : _vm._e(), ((_e2 = item.inputSlot) == null ? void 0 : _e2.append) ? _vm._t((_f2 = item.inputSlot) == null ? void 0 : _f2.append, null, {
10543
10682
  "slot": (_g = item.inputSlot) == null ? void 0 : _g.append
10544
10683
  }) : _vm._e(), ((_h = item.inputSlot) == null ? void 0 : _h.suffix) ? _vm._t((_i = item.inputSlot) == null ? void 0 : _i.suffix, null, {
10545
10684
  "slot": (_j = item.inputSlot) == null ? void 0 : _j.suffix
@@ -10586,7 +10725,7 @@ var _sfc_render = function render4() {
10586
10725
  _vm.nfColumCheckDialogVisible = true;
10587
10726
  }
10588
10727
  }
10589
- }, [_vm._v(" " + _vm._s(_vm.columnDisplayBtnText) + " ")])];
10728
+ }, [_vm._v(" " + _vm._s(_vm.localeText.columnDisplayBtnText) + " ")])];
10590
10729
  }) : _vm._e(), !_vm.virtualized ? _c("el-table", _vm._g(_vm._b({
10591
10730
  key: _vm.elTableRefKey,
10592
10731
  ref: "elTableRef",
@@ -10596,7 +10735,7 @@ var _sfc_render = function render4() {
10596
10735
  },
10597
10736
  attrs: {
10598
10737
  "data": _vm.showData,
10599
- "fit": ((_b = _vm.tableAttrer) == null ? void 0 : _b.fit) ?? true,
10738
+ "fit": (_c2 = (_b = _vm.tableAttrer) == null ? void 0 : _b.fit) != null ? _c2 : true,
10600
10739
  "height": _vm.elTableHeight
10601
10740
  }
10602
10741
  }, "el-table", _vm.tableAttrer, false), _vm.tableEventer), [_vm._l(_vm.tableColumns, function(column) {
@@ -10643,7 +10782,7 @@ var _sfc_render = function render4() {
10643
10782
  "popper-class": "actionTooltipRef",
10644
10783
  "placement": "top",
10645
10784
  "effect": "dark",
10646
- "content": _vm.columnDisplayBtnText
10785
+ "content": _vm.localeText.columnDisplayBtnText
10647
10786
  }
10648
10787
  }, [_c("i", {
10649
10788
  staticClass: "iconfont icon-liebiao_xianshiliemu operation-icon-column-check",
@@ -10725,7 +10864,7 @@ var _sfc_render = function render4() {
10725
10864
  attrs: {
10726
10865
  "slot": "empty",
10727
10866
  "image-size": _vm.emptyImageSize,
10728
- "description": _vm.emptyText
10867
+ "description": _vm.localeText.emptyText
10729
10868
  },
10730
10869
  slot: "empty"
10731
10870
  })];
@@ -10742,11 +10881,11 @@ var _sfc_render = function render4() {
10742
10881
  ref: "elTableRef",
10743
10882
  class: {
10744
10883
  "nf-table-container": true,
10745
- "nf-default-table-border": !_vm.nfTableBorder && !((_c2 = _vm.tableAttrs) == null ? void 0 : _c2.border)
10884
+ "nf-default-table-border": !_vm.nfTableBorder && !((_d = _vm.tableAttrs) == null ? void 0 : _d.border)
10746
10885
  },
10747
10886
  attrs: {
10748
10887
  "data": _vm.tableData,
10749
- "fit": ((_d = _vm.tableAttrer) == null ? void 0 : _d.fit) ?? true,
10888
+ "fit": (_f = (_e = _vm.tableAttrer) == null ? void 0 : _e.fit) != null ? _f : true,
10750
10889
  "height": _vm.elTableHeight
10751
10890
  }
10752
10891
  }, "el-table", _vm.tableAttrer, false), _vm.tableEventer), [_vm._l(_vm.tableColumns, function(column) {
@@ -10800,7 +10939,7 @@ var _sfc_render = function render4() {
10800
10939
  "popper-class": "actionTooltipRef",
10801
10940
  "placement": "top",
10802
10941
  "effect": "dark",
10803
- "content": _vm.columnDisplayBtnText
10942
+ "content": _vm.localeText.columnDisplayBtnText
10804
10943
  }
10805
10944
  }, [_c("i", {
10806
10945
  staticClass: "iconfont icon-liebiao_xianshiliemu operation-icon-column-check",
@@ -10882,7 +11021,7 @@ var _sfc_render = function render4() {
10882
11021
  attrs: {
10883
11022
  "slot": "empty",
10884
11023
  "image-size": _vm.emptyImageSize,
10885
- "description": _vm.emptyText
11024
+ "description": _vm.localeText.emptyText
10886
11025
  },
10887
11026
  slot: "empty"
10888
11027
  })];
@@ -10894,7 +11033,7 @@ var _sfc_render = function render4() {
10894
11033
  }, [_vm._t("actionBar", function() {
10895
11034
  var _a2;
10896
11035
  return [((_a2 = _vm.actionBarOptList) == null ? void 0 : _a2.length) && !_vm.hasActionBarSlot ? [_vm._l(_vm.actionBarOptList, function(item, index2) {
10897
- var _a3, _b2, _c3, _d2, _e, _f, _g, _h, _i, _j;
11036
+ var _a3, _b2, _c3, _d2, _e2, _f2, _g, _h, _i, _j;
10898
11037
  return [item.element === "el-button" ? _c("nf-button", _vm._g({
10899
11038
  key: item.key || index2,
10900
11039
  class: _vm.resolveValue(item.class),
@@ -11169,9 +11308,9 @@ var _sfc_render = function render4() {
11169
11308
  "slot": "prefix"
11170
11309
  }) : _vm._e(), ((_d2 = item.slot) == null ? void 0 : _d2.suffix) ? _vm._t(item.slot.suffix, null, {
11171
11310
  "slot": "suffix"
11172
- }) : _vm._e(), ((_e = item.slot) == null ? void 0 : _e.prepend) ? _vm._t(item.slot.prepend, null, {
11311
+ }) : _vm._e(), ((_e2 = item.slot) == null ? void 0 : _e2.prepend) ? _vm._t(item.slot.prepend, null, {
11173
11312
  "slot": "prepend"
11174
- }) : _vm._e(), ((_f = item.slot) == null ? void 0 : _f.append) ? _vm._t(item.slot.append, null, {
11313
+ }) : _vm._e(), ((_f2 = item.slot) == null ? void 0 : _f2.append) ? _vm._t(item.slot.append, null, {
11175
11314
  "slot": "append"
11176
11315
  }) : _vm._e()], 2) : _vm._e(), item.element === "el-autocomplete" ? _c("el-autocomplete", _vm._g({
11177
11316
  key: item.key || index2,
@@ -11282,10 +11421,10 @@ var _sfc_render = function render4() {
11282
11421
  })], 2)], 2), _vm.nfColumCheckDialogVisible && _vm.checkMode === "dialog" ? _c("column-check-dialog", {
11283
11422
  ref: "columnCheckDialog",
11284
11423
  attrs: {
11285
- "title": _vm.columnCheckTitle,
11286
- "confirm-text": _vm.columnCheckConfirmButtonText,
11287
- "cancel-text": _vm.columnCheckCancelButtonText,
11288
- "basic-field-desc": _vm.columnCheckBasicFieldDesc,
11424
+ "title": _vm.localeText.columnCheckTitle,
11425
+ "confirm-text": _vm.localeText.columnCheckConfirmButtonText,
11426
+ "cancel-text": _vm.localeText.columnCheckCancelButtonText,
11427
+ "basic-field-desc": _vm.localeText.columnCheckBasicFieldDesc,
11289
11428
  "show": _vm.nfColumCheckDialogVisible,
11290
11429
  "table-columns": _vm.processedColumns,
11291
11430
  "column-edit": _vm.columnEdit,
@@ -11319,9 +11458,9 @@ var _sfc_render = function render4() {
11319
11458
  })], 2) : _vm._e(), _vm.checkMode === "drawer" ? _c("nf-drawer", _vm._b({
11320
11459
  ref: "columnCheckNfDrawer",
11321
11460
  attrs: {
11322
- "title": _vm.columnCheckTitle,
11323
- "cancel-button-text": _vm.columnCheckCancelButtonText,
11324
- "confirm-button-text": _vm.columnCheckConfirmButtonText,
11461
+ "title": _vm.localeText.columnCheckTitle,
11462
+ "cancel-button-text": _vm.localeText.columnCheckCancelButtonText,
11463
+ "confirm-button-text": _vm.localeText.columnCheckConfirmButtonText,
11325
11464
  "size": "680px",
11326
11465
  "visible": _vm.nfColumCheckDialogVisible,
11327
11466
  "tabs": _vm.columnCheckTabs,
@@ -11343,14 +11482,14 @@ var _sfc_render = function render4() {
11343
11482
  }), _c("column-check-drawer", {
11344
11483
  ref: "columnCheckDrawer",
11345
11484
  attrs: {
11346
- "search-placeholder": _vm.columnCheckSearchPlaceholder,
11347
- "fixed-left-desc": _vm.columnCheckFixedLeftDesc,
11348
- "clear-desc": _vm.columnCheckClearDesc,
11349
- "no-fixed-desc": _vm.columnCheckNoFixedDesc,
11350
- "basic-field-desc": _vm.columnCheckBasicFieldDesc,
11351
- "select-empty-warning-tips": _vm.selectEmptyWarningTips,
11352
- "get-checked-length-desc": _vm.columnCheckGetCheckedLengthDesc,
11353
- "get-all-check-desc": _vm.columnCheckGetAllCheckDesc,
11485
+ "search-placeholder": _vm.localeText.columnCheckSearchPlaceholder,
11486
+ "fixed-left-desc": _vm.localeText.columnCheckFixedLeftDesc,
11487
+ "clear-desc": _vm.localeText.columnCheckClearDesc,
11488
+ "no-fixed-desc": _vm.localeText.columnCheckNoFixedDesc,
11489
+ "basic-field-desc": _vm.localeText.columnCheckBasicFieldDesc,
11490
+ "select-empty-warning-tips": _vm.localeText.selectEmptyWarningTips,
11491
+ "get-checked-length-desc": _vm.localeText.columnCheckGetCheckedLengthDesc,
11492
+ "get-all-check-desc": _vm.localeText.columnCheckGetAllCheckDesc,
11354
11493
  "column-edit": _vm.columnEdit,
11355
11494
  "operation-prop-key": _vm.operationPropKey,
11356
11495
  "storage-key": _vm.cStorageKey,