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