@94ai/nf-table 9.0.0 → 10.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.
@@ -5414,16 +5414,12 @@ __sfc_main$1.setup = (__props, __ctx) => {
5414
5414
  }
5415
5415
  }
5416
5416
  };
5417
- const insertColumn = (column, append = false) => {
5417
+ const insertColumn = (column) => {
5418
5418
  if (!unChangedColumn.value.includes(column.prop)) {
5419
5419
  const unFixedIndex = unFixedColumn.value.findIndex((item) => item.prop === column.prop);
5420
5420
  const fixedIndex = fixedColumn.value.findIndex((item) => item.prop === column.prop);
5421
5421
  if (unFixedIndex === -1 && fixedIndex === -1) {
5422
- if (append) {
5423
- (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).push(column);
5424
- } else {
5425
- (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).unshift(column);
5426
- }
5422
+ (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).push(column);
5427
5423
  }
5428
5424
  }
5429
5425
  };
@@ -5475,13 +5471,17 @@ __sfc_main$1.setup = (__props, __ctx) => {
5475
5471
  if (item) {
5476
5472
  item.initHidden = false;
5477
5473
  const cloneItem = commonUtils.deepClone(item);
5478
- if (!cloneItem.attr) {
5479
- cloneItem.attr = {};
5480
- }
5481
5474
  newColumns.push(cloneItem);
5482
5475
  }
5483
5476
  });
5484
5477
  currentTable.value = newColumns;
5478
+ if (columnName.value) {
5479
+ searchValue = currentTable.value.filter((item) => {
5480
+ var _a2;
5481
+ return (_a2 = item.addLabel || item.label) == null ? void 0 : _a2.includes(columnName.value);
5482
+ });
5483
+ setFields(searchValue);
5484
+ }
5485
5485
  currentTable.value.map((item) => {
5486
5486
  if (!unChangedColumn.value.includes(item.prop)) {
5487
5487
  if (item.attr.fixed) {
@@ -5500,7 +5500,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
5500
5500
  searchValue.map((item) => {
5501
5501
  if (!unChangedColumn.value.includes(item.prop)) {
5502
5502
  if (v) {
5503
- insertColumn(item, true);
5503
+ insertColumn(item);
5504
5504
  } else {
5505
5505
  pullAwayColumn(item);
5506
5506
  }
@@ -5512,7 +5512,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
5512
5512
  currentTable.value.map((item) => {
5513
5513
  if (!unChangedColumn.value.includes(item.prop)) {
5514
5514
  if (v) {
5515
- insertColumn(item, true);
5515
+ insertColumn(item);
5516
5516
  } else {
5517
5517
  pullAwayColumn(item);
5518
5518
  }
@@ -5529,7 +5529,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
5529
5529
  if (item.prop === prop) {
5530
5530
  item.initHidden = !v;
5531
5531
  v ? "" : item.attr.fixed = false;
5532
- v ? insertColumn(item, true) : pullAwayColumn(item);
5532
+ v ? insertColumn(item) : pullAwayColumn(item);
5533
5533
  }
5534
5534
  });
5535
5535
  updateCheckStatus();
@@ -9441,9 +9441,9 @@ __sfc_main.setup = (__props, __ctx) => {
9441
9441
  return {
9442
9442
  ...item.events || {},
9443
9443
  click: (...args) => {
9444
- var _a2, _b2;
9445
- (_a2 = item.events) == null ? void 0 : _a2.click(args);
9446
- (_b2 = item.onClick) == null ? void 0 : _b2.call(item, scope.row, scope);
9444
+ var _a2, _b2, _c2;
9445
+ (_b2 = (_a2 = item.events) == null ? void 0 : _a2.click) == null ? void 0 : _b2.call(_a2, args);
9446
+ (_c2 = item.onClick) == null ? void 0 : _c2.call(item, scope.row, scope);
9447
9447
  }
9448
9448
  };
9449
9449
  };
@@ -9494,9 +9494,6 @@ __sfc_main.setup = (__props, __ctx) => {
9494
9494
  }
9495
9495
  return key;
9496
9496
  });
9497
- vueDemi.computed(() => {
9498
- return "nf-table-view-identity";
9499
- });
9500
9497
  const checkViewIdentityChange = async () => {
9501
9498
  };
9502
9499
  const cPageAttrs = vueDemi.reactive({
@@ -9804,9 +9801,7 @@ __sfc_main.setup = (__props, __ctx) => {
9804
9801
  columns.every((i) => {
9805
9802
  if (i.prop === key) {
9806
9803
  i.initHidden = state.initHidden;
9807
- i.attr ? i.attr["fixed"] = state.fixed : i.attr = {
9808
- fixed: state.fixed
9809
- };
9804
+ i.attr["fixed"] = state.fixed;
9810
9805
  i._index = state.index;
9811
9806
  if (maxIndex < state.index) {
9812
9807
  maxIndex = state.index;
@@ -9833,7 +9828,7 @@ __sfc_main.setup = (__props, __ctx) => {
9833
9828
  console.log(e);
9834
9829
  }
9835
9830
  }
9836
- tableColumns.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
9831
+ tableColumns.value = columns.sort((a, b) => a._index - b._index);
9837
9832
  vueDemi.nextTick(() => {
9838
9833
  props.columns._skip = false;
9839
9834
  });
@@ -9918,7 +9913,7 @@ __sfc_main.setup = (__props, __ctx) => {
9918
9913
  }
9919
9914
  };
9920
9915
  const showPage = vueDemi.computed(() => {
9921
- return showData.value.length > props.pageAttrs["page-size"];
9916
+ return props.data.length > props.pageAttrs["page-size"];
9922
9917
  });
9923
9918
  const renderPage = vueDemi.computed(() => {
9924
9919
  return props.alwaysShowPage || showPage.value;
@@ -10133,6 +10128,10 @@ __sfc_main.setup = (__props, __ctx) => {
10133
10128
  await ((_b2 = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b2.call(_a2, newWidth, oldWidth, column, event));
10134
10129
  };
10135
10130
  let opFixedRightCleanup = null;
10131
+ vueDemi.onBeforeUnmount(() => {
10132
+ opFixedRightCleanup == null ? void 0 : opFixedRightCleanup();
10133
+ opFixedRightCleanup = null;
10134
+ });
10136
10135
  const initOpFixedRightResizer = async () => {
10137
10136
  var _a2, _b2, _c2;
10138
10137
  await vueDemi.nextTick();
@@ -10157,14 +10156,10 @@ __sfc_main.setup = (__props, __ctx) => {
10157
10156
  var _a3;
10158
10157
  return ((_a3 = col == null ? void 0 : col.attr) == null ? void 0 : _a3.fixed) === "right";
10159
10158
  });
10160
- if (fixedIndex < 0)
10161
- return;
10162
10159
  const th = fixedRightHeader.querySelectorAll("th")[fixedIndex];
10163
10160
  if (!th)
10164
10161
  return;
10165
10162
  const fixedRightRoot = tableEl.querySelector(".el-table__fixed-right");
10166
- if (!fixedRightRoot)
10167
- return;
10168
10163
  const oldOverlay = fixedRightRoot.querySelector('[data-nf-fixed-right-overlay="true"]');
10169
10164
  if (oldOverlay)
10170
10165
  oldOverlay.remove();
@@ -10179,8 +10174,6 @@ __sfc_main.setup = (__props, __ctx) => {
10179
10174
  const mainHeader = tableEl.querySelector(".el-table__header-wrapper thead tr");
10180
10175
  const cleanupHideAfter = [];
10181
10176
  const hideNativeAfter = (el) => {
10182
- if (!el)
10183
- return;
10184
10177
  el.classList.add("nf-table-hide-after");
10185
10178
  cleanupHideAfter.push(el);
10186
10179
  };
@@ -10226,6 +10219,7 @@ __sfc_main.setup = (__props, __ctx) => {
10226
10219
  return line;
10227
10220
  };
10228
10221
  let pending = false;
10222
+ let indicatorFrame = 0;
10229
10223
  let cachedRect = null;
10230
10224
  const onPointerMove = (e) => {
10231
10225
  e.preventDefault();
@@ -10242,7 +10236,8 @@ __sfc_main.setup = (__props, __ctx) => {
10242
10236
  if (indicatorLine) {
10243
10237
  if (!pending) {
10244
10238
  pending = true;
10245
- requestAnimationFrame(() => {
10239
+ indicatorFrame = requestAnimationFrame(() => {
10240
+ indicatorFrame = 0;
10246
10241
  indicatorLine.style.display = "block";
10247
10242
  indicatorLine.style.transform = `translateX(${dragX}px)`;
10248
10243
  pending = false;
@@ -10250,7 +10245,11 @@ __sfc_main.setup = (__props, __ctx) => {
10250
10245
  }
10251
10246
  }
10252
10247
  };
10253
- const onPointerUp = async (e) => {
10248
+ const stopPointerDrag = () => {
10249
+ if (indicatorFrame)
10250
+ cancelAnimationFrame(indicatorFrame);
10251
+ indicatorFrame = 0;
10252
+ pending = false;
10254
10253
  document.removeEventListener("pointermove", onPointerMove);
10255
10254
  document.removeEventListener("pointerup", onPointerUp);
10256
10255
  const dragMask = document.getElementById("nf-fixed-right-drag-mask");
@@ -10259,6 +10258,9 @@ __sfc_main.setup = (__props, __ctx) => {
10259
10258
  indicatorLine.remove();
10260
10259
  indicatorLine = null;
10261
10260
  }
10261
+ };
10262
+ const onPointerUp = async (e) => {
10263
+ stopPointerDrag();
10262
10264
  try {
10263
10265
  handle.releasePointerCapture && handle.releasePointerCapture(e.pointerId);
10264
10266
  } catch {
@@ -10308,6 +10310,7 @@ __sfc_main.setup = (__props, __ctx) => {
10308
10310
  handle.addEventListener("pointerdown", onPointerDown);
10309
10311
  opFixedRightCleanup = () => {
10310
10312
  try {
10313
+ stopPointerDrag();
10311
10314
  handle.removeEventListener("pointerdown", onPointerDown);
10312
10315
  handle.remove();
10313
10316
  cleanupHideAfter.forEach((el) => el.classList.remove("nf-table-hide-after"));
@@ -10455,15 +10458,9 @@ __sfc_main.setup = (__props, __ctx) => {
10455
10458
  initOpFixedRightResizer();
10456
10459
  });
10457
10460
  const nfTableBorder = window.nfTableBorder;
10458
- const nfSearchFormModel = vueDemi.computed({
10459
- get: () => {
10460
- var _a2;
10461
- return ((_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.nfSearchFormModel) || {};
10462
- },
10463
- set: (formData) => {
10464
- var _a2, _b2;
10465
- return (_b2 = (_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.setNfSearchFormModel) == null ? void 0 : _b2.call(_a2, formData);
10466
- }
10461
+ const nfSearchFormModel = vueDemi.computed(() => {
10462
+ var _a2;
10463
+ return ((_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.nfSearchFormModel) || {};
10467
10464
  });
10468
10465
  return Object.assign({
10469
10466
  resolveValue: commonUtils.resolveValue,
@@ -5412,16 +5412,12 @@ __sfc_main$1.setup = (__props, __ctx) => {
5412
5412
  }
5413
5413
  }
5414
5414
  };
5415
- const insertColumn = (column, append = false) => {
5415
+ const insertColumn = (column) => {
5416
5416
  if (!unChangedColumn.value.includes(column.prop)) {
5417
5417
  const unFixedIndex = unFixedColumn.value.findIndex((item) => item.prop === column.prop);
5418
5418
  const fixedIndex = fixedColumn.value.findIndex((item) => item.prop === column.prop);
5419
5419
  if (unFixedIndex === -1 && fixedIndex === -1) {
5420
- if (append) {
5421
- (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).push(column);
5422
- } else {
5423
- (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).unshift(column);
5424
- }
5420
+ (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).push(column);
5425
5421
  }
5426
5422
  }
5427
5423
  };
@@ -5473,13 +5469,17 @@ __sfc_main$1.setup = (__props, __ctx) => {
5473
5469
  if (item) {
5474
5470
  item.initHidden = false;
5475
5471
  const cloneItem = deepClone(item);
5476
- if (!cloneItem.attr) {
5477
- cloneItem.attr = {};
5478
- }
5479
5472
  newColumns.push(cloneItem);
5480
5473
  }
5481
5474
  });
5482
5475
  currentTable.value = newColumns;
5476
+ if (columnName.value) {
5477
+ searchValue = currentTable.value.filter((item) => {
5478
+ var _a2;
5479
+ return (_a2 = item.addLabel || item.label) == null ? void 0 : _a2.includes(columnName.value);
5480
+ });
5481
+ setFields(searchValue);
5482
+ }
5483
5483
  currentTable.value.map((item) => {
5484
5484
  if (!unChangedColumn.value.includes(item.prop)) {
5485
5485
  if (item.attr.fixed) {
@@ -5498,7 +5498,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
5498
5498
  searchValue.map((item) => {
5499
5499
  if (!unChangedColumn.value.includes(item.prop)) {
5500
5500
  if (v) {
5501
- insertColumn(item, true);
5501
+ insertColumn(item);
5502
5502
  } else {
5503
5503
  pullAwayColumn(item);
5504
5504
  }
@@ -5510,7 +5510,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
5510
5510
  currentTable.value.map((item) => {
5511
5511
  if (!unChangedColumn.value.includes(item.prop)) {
5512
5512
  if (v) {
5513
- insertColumn(item, true);
5513
+ insertColumn(item);
5514
5514
  } else {
5515
5515
  pullAwayColumn(item);
5516
5516
  }
@@ -5527,7 +5527,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
5527
5527
  if (item.prop === prop) {
5528
5528
  item.initHidden = !v;
5529
5529
  v ? "" : item.attr.fixed = false;
5530
- v ? insertColumn(item, true) : pullAwayColumn(item);
5530
+ v ? insertColumn(item) : pullAwayColumn(item);
5531
5531
  }
5532
5532
  });
5533
5533
  updateCheckStatus();
@@ -9439,9 +9439,9 @@ __sfc_main.setup = (__props, __ctx) => {
9439
9439
  return {
9440
9440
  ...item.events || {},
9441
9441
  click: (...args) => {
9442
- var _a2, _b2;
9443
- (_a2 = item.events) == null ? void 0 : _a2.click(args);
9444
- (_b2 = item.onClick) == null ? void 0 : _b2.call(item, scope.row, scope);
9442
+ var _a2, _b2, _c2;
9443
+ (_b2 = (_a2 = item.events) == null ? void 0 : _a2.click) == null ? void 0 : _b2.call(_a2, args);
9444
+ (_c2 = item.onClick) == null ? void 0 : _c2.call(item, scope.row, scope);
9445
9445
  }
9446
9446
  };
9447
9447
  };
@@ -9492,9 +9492,6 @@ __sfc_main.setup = (__props, __ctx) => {
9492
9492
  }
9493
9493
  return key;
9494
9494
  });
9495
- computed(() => {
9496
- return "nf-table-view-identity";
9497
- });
9498
9495
  const checkViewIdentityChange = async () => {
9499
9496
  };
9500
9497
  const cPageAttrs = reactive({
@@ -9802,9 +9799,7 @@ __sfc_main.setup = (__props, __ctx) => {
9802
9799
  columns.every((i) => {
9803
9800
  if (i.prop === key) {
9804
9801
  i.initHidden = state.initHidden;
9805
- i.attr ? i.attr["fixed"] = state.fixed : i.attr = {
9806
- fixed: state.fixed
9807
- };
9802
+ i.attr["fixed"] = state.fixed;
9808
9803
  i._index = state.index;
9809
9804
  if (maxIndex < state.index) {
9810
9805
  maxIndex = state.index;
@@ -9831,7 +9826,7 @@ __sfc_main.setup = (__props, __ctx) => {
9831
9826
  console.log(e);
9832
9827
  }
9833
9828
  }
9834
- tableColumns.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
9829
+ tableColumns.value = columns.sort((a, b) => a._index - b._index);
9835
9830
  nextTick(() => {
9836
9831
  props.columns._skip = false;
9837
9832
  });
@@ -9916,7 +9911,7 @@ __sfc_main.setup = (__props, __ctx) => {
9916
9911
  }
9917
9912
  };
9918
9913
  const showPage = computed(() => {
9919
- return showData.value.length > props.pageAttrs["page-size"];
9914
+ return props.data.length > props.pageAttrs["page-size"];
9920
9915
  });
9921
9916
  const renderPage = computed(() => {
9922
9917
  return props.alwaysShowPage || showPage.value;
@@ -10131,6 +10126,10 @@ __sfc_main.setup = (__props, __ctx) => {
10131
10126
  await ((_b2 = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b2.call(_a2, newWidth, oldWidth, column, event));
10132
10127
  };
10133
10128
  let opFixedRightCleanup = null;
10129
+ onBeforeUnmount(() => {
10130
+ opFixedRightCleanup == null ? void 0 : opFixedRightCleanup();
10131
+ opFixedRightCleanup = null;
10132
+ });
10134
10133
  const initOpFixedRightResizer = async () => {
10135
10134
  var _a2, _b2, _c2;
10136
10135
  await nextTick();
@@ -10155,14 +10154,10 @@ __sfc_main.setup = (__props, __ctx) => {
10155
10154
  var _a3;
10156
10155
  return ((_a3 = col == null ? void 0 : col.attr) == null ? void 0 : _a3.fixed) === "right";
10157
10156
  });
10158
- if (fixedIndex < 0)
10159
- return;
10160
10157
  const th = fixedRightHeader.querySelectorAll("th")[fixedIndex];
10161
10158
  if (!th)
10162
10159
  return;
10163
10160
  const fixedRightRoot = tableEl.querySelector(".el-table__fixed-right");
10164
- if (!fixedRightRoot)
10165
- return;
10166
10161
  const oldOverlay = fixedRightRoot.querySelector('[data-nf-fixed-right-overlay="true"]');
10167
10162
  if (oldOverlay)
10168
10163
  oldOverlay.remove();
@@ -10177,8 +10172,6 @@ __sfc_main.setup = (__props, __ctx) => {
10177
10172
  const mainHeader = tableEl.querySelector(".el-table__header-wrapper thead tr");
10178
10173
  const cleanupHideAfter = [];
10179
10174
  const hideNativeAfter = (el) => {
10180
- if (!el)
10181
- return;
10182
10175
  el.classList.add("nf-table-hide-after");
10183
10176
  cleanupHideAfter.push(el);
10184
10177
  };
@@ -10224,6 +10217,7 @@ __sfc_main.setup = (__props, __ctx) => {
10224
10217
  return line;
10225
10218
  };
10226
10219
  let pending = false;
10220
+ let indicatorFrame = 0;
10227
10221
  let cachedRect = null;
10228
10222
  const onPointerMove = (e) => {
10229
10223
  e.preventDefault();
@@ -10240,7 +10234,8 @@ __sfc_main.setup = (__props, __ctx) => {
10240
10234
  if (indicatorLine) {
10241
10235
  if (!pending) {
10242
10236
  pending = true;
10243
- requestAnimationFrame(() => {
10237
+ indicatorFrame = requestAnimationFrame(() => {
10238
+ indicatorFrame = 0;
10244
10239
  indicatorLine.style.display = "block";
10245
10240
  indicatorLine.style.transform = `translateX(${dragX}px)`;
10246
10241
  pending = false;
@@ -10248,7 +10243,11 @@ __sfc_main.setup = (__props, __ctx) => {
10248
10243
  }
10249
10244
  }
10250
10245
  };
10251
- const onPointerUp = async (e) => {
10246
+ const stopPointerDrag = () => {
10247
+ if (indicatorFrame)
10248
+ cancelAnimationFrame(indicatorFrame);
10249
+ indicatorFrame = 0;
10250
+ pending = false;
10252
10251
  document.removeEventListener("pointermove", onPointerMove);
10253
10252
  document.removeEventListener("pointerup", onPointerUp);
10254
10253
  const dragMask = document.getElementById("nf-fixed-right-drag-mask");
@@ -10257,6 +10256,9 @@ __sfc_main.setup = (__props, __ctx) => {
10257
10256
  indicatorLine.remove();
10258
10257
  indicatorLine = null;
10259
10258
  }
10259
+ };
10260
+ const onPointerUp = async (e) => {
10261
+ stopPointerDrag();
10260
10262
  try {
10261
10263
  handle.releasePointerCapture && handle.releasePointerCapture(e.pointerId);
10262
10264
  } catch {
@@ -10306,6 +10308,7 @@ __sfc_main.setup = (__props, __ctx) => {
10306
10308
  handle.addEventListener("pointerdown", onPointerDown);
10307
10309
  opFixedRightCleanup = () => {
10308
10310
  try {
10311
+ stopPointerDrag();
10309
10312
  handle.removeEventListener("pointerdown", onPointerDown);
10310
10313
  handle.remove();
10311
10314
  cleanupHideAfter.forEach((el) => el.classList.remove("nf-table-hide-after"));
@@ -10453,15 +10456,9 @@ __sfc_main.setup = (__props, __ctx) => {
10453
10456
  initOpFixedRightResizer();
10454
10457
  });
10455
10458
  const nfTableBorder = window.nfTableBorder;
10456
- const nfSearchFormModel = computed({
10457
- get: () => {
10458
- var _a2;
10459
- return ((_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.nfSearchFormModel) || {};
10460
- },
10461
- set: (formData) => {
10462
- var _a2, _b2;
10463
- return (_b2 = (_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.setNfSearchFormModel) == null ? void 0 : _b2.call(_a2, formData);
10464
- }
10459
+ const nfSearchFormModel = computed(() => {
10460
+ var _a2;
10461
+ return ((_a2 = nfSearchFormRef.value) == null ? void 0 : _a2.nfSearchFormModel) || {};
10465
10462
  });
10466
10463
  return Object.assign({
10467
10464
  resolveValue,