@canvas-components/list-table 0.3.28 → 0.3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1182,6 +1182,11 @@ function saveHeaderSettingsColumn(columns, draft) {
1182
1182
  return "\u5BBD\u5EA6\u987B\u4ECB\u4E8E\u6700\u5C0F\u5BBD\u5EA6\u548C\u6700\u5927\u5BBD\u5EA6\u4E4B\u95F4";
1183
1183
  }
1184
1184
  if (existing && !existing.userDefined) {
1185
+ if (draft.visible !== void 0) {
1186
+ if (!setHeaderColumnVisible(columns, draft.key, draft.visible)) {
1187
+ return "\u8BE5\u5217\u4E0D\u53EF\u9690\u85CF\uFF0C\u4E14\u8868\u683C\u81F3\u5C11\u9700\u8981\u5C55\u793A\u4E00\u5217";
1188
+ }
1189
+ }
1185
1190
  existing.title = title;
1186
1191
  existing.settingTitle = title;
1187
1192
  existing.userTitle = title;
@@ -1199,6 +1204,11 @@ function saveHeaderSettingsColumn(columns, draft) {
1199
1204
  if (isHeaderDataIndexUsed(columns, dataIndex, draft.key)) {
1200
1205
  return "\u8BE5 dataIndex \u5DF2\u88AB\u5176\u4ED6\u5217\u4F7F\u7528";
1201
1206
  }
1207
+ if (existing && draft.visible !== void 0) {
1208
+ if (!setHeaderColumnVisible(columns, draft.key, draft.visible)) {
1209
+ return "\u8BE5\u5217\u4E0D\u53EF\u9690\u85CF\uFF0C\u4E14\u8868\u683C\u81F3\u5C11\u9700\u8981\u5C55\u793A\u4E00\u5217";
1210
+ }
1211
+ }
1202
1212
  const column = existing ?? { key: createUserColumnKey(columns) };
1203
1213
  column.title = title;
1204
1214
  column.settingTitle = title;
@@ -1207,6 +1217,7 @@ function saveHeaderSettingsColumn(columns, draft) {
1207
1217
  column.minWidth = minWidth;
1208
1218
  column.maxWidth = maxWidth;
1209
1219
  column.fixed = draft.fixed;
1220
+ if (!existing) column.hidden = draft.visible === false;
1210
1221
  column.userDefined = true;
1211
1222
  column.allowSort = true;
1212
1223
  column.sorter = true;
@@ -1214,6 +1225,8 @@ function saveHeaderSettingsColumn(columns, draft) {
1214
1225
  moveColumnToOrder(siblings, existing, draft.order);
1215
1226
  } else if (!existing) {
1216
1227
  siblings.splice((draft.order ?? maxOrder) - 1, 0, column);
1228
+ if (draft.visible === false) normalizeHiddenState(columns);
1229
+ else setHeaderColumnVisible(columns, resolveColumnKey(column), true);
1217
1230
  }
1218
1231
  draft.key = resolveColumnKey(column);
1219
1232
  return null;
@@ -34246,7 +34259,7 @@ var ListTablePersistenceController = class {
34246
34259
  this.options.canvasHost.setContentZoom(nextZoom);
34247
34260
  }
34248
34261
  let currentOptions = this.options.getOptions();
34249
- if (stored.scrollbar) {
34262
+ if (stored.scrollbar && !isSameScrollbarOptions(currentOptions.scrollbar, stored.scrollbar)) {
34250
34263
  currentOptions = { ...currentOptions, scrollbar: stored.scrollbar };
34251
34264
  currentOptions.ui?.onScrollbarChange?.(stored.scrollbar);
34252
34265
  }
@@ -34322,6 +34335,22 @@ var ListTablePersistenceController = class {
34322
34335
  );
34323
34336
  }
34324
34337
  };
34338
+ function isSameScrollbarOptions(current, stored) {
34339
+ if (current === stored) return true;
34340
+ if (!current || !stored) return false;
34341
+ const currentEntries = Object.entries(current);
34342
+ if (currentEntries.length !== Object.keys(stored).length) return false;
34343
+ return currentEntries.every(([key, value]) => {
34344
+ const next = stored[key];
34345
+ if (value && typeof value === "object" && next && typeof next === "object") {
34346
+ const entries = Object.entries(value);
34347
+ return entries.length === Object.keys(next).length && entries.every(
34348
+ ([axisKey, axisValue]) => Object.is(axisValue, next[axisKey])
34349
+ );
34350
+ }
34351
+ return Object.is(value, next);
34352
+ });
34353
+ }
34325
34354
 
34326
34355
  // src/services/data-source-service.ts
34327
34356
  function getListTableBaseDisplayData(params) {
@@ -37511,6 +37540,7 @@ var ListTableCore = class {
37511
37540
  * @param options 新配置。
37512
37541
  */
37513
37542
  updateOptions(options) {
37543
+ const preserveTooltipAndFilterPanel = options.storageKey === this.options.storageKey;
37514
37544
  const preserveContextMenu = options.dataSource !== this.options.dataSource || this.overlayController.shouldPreserveHeaderContextMenuOnOptionsUpdate();
37515
37545
  this.persistenceController.invalidate();
37516
37546
  if (options.storageKey === this.options.storageKey) {
@@ -37603,7 +37633,8 @@ var ListTableCore = class {
37603
37633
  host.renderer?.updateDebugOptions(options.debug ?? {});
37604
37634
  this.hideFloatingOverlays({
37605
37635
  includeLoading: true,
37606
- preserveContextMenu
37636
+ preserveContextMenu,
37637
+ preserveTooltipAndFilterPanel
37607
37638
  });
37608
37639
  this.refreshRuntimeColumns();
37609
37640
  if (shouldPersistColumnConfig) {
@@ -37771,8 +37802,10 @@ var ListTableCore = class {
37771
37802
  if (params?.includeLoading) {
37772
37803
  this.overlayController.hideLoading();
37773
37804
  }
37774
- this.overlayController.hideTooltip();
37775
- this.overlayController.hideFilterPanel();
37805
+ if (!params?.preserveTooltipAndFilterPanel) {
37806
+ this.overlayController.hideTooltip();
37807
+ this.overlayController.hideFilterPanel();
37808
+ }
37776
37809
  this.overlayController.hideFixedPopup();
37777
37810
  if (!params?.preserveContextMenu) {
37778
37811
  this.overlayController.hideHeaderContextMenu();
@@ -37910,5 +37943,3 @@ exports.listTableAntdIconNames = listTableAntdIconNames;
37910
37943
  exports.listTableBuiltinIconNames = listTableBuiltinIconNames;
37911
37944
  exports.listTableIconNames = listTableIconNames;
37912
37945
  exports.resetListTableStoredColumnConfig = resetListTableStoredColumnConfig;
37913
- //# sourceMappingURL=index.cjs.map
37914
- //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1345,6 +1345,8 @@ interface HeaderContextMenuColumnDraft {
1345
1345
  minWidth?: number;
1346
1346
  maxWidth?: number;
1347
1347
  fixed?: "left" | "right";
1348
+ /** 本次保存后是否展示该列;省略时保留现有状态。 */
1349
+ visible?: boolean;
1348
1350
  sortOrder?: "ascend" | "descend" | null;
1349
1351
  order?: number;
1350
1352
  }
package/dist/index.d.ts CHANGED
@@ -1345,6 +1345,8 @@ interface HeaderContextMenuColumnDraft {
1345
1345
  minWidth?: number;
1346
1346
  maxWidth?: number;
1347
1347
  fixed?: "left" | "right";
1348
+ /** 本次保存后是否展示该列;省略时保留现有状态。 */
1349
+ visible?: boolean;
1348
1350
  sortOrder?: "ascend" | "descend" | null;
1349
1351
  order?: number;
1350
1352
  }
package/dist/index.js CHANGED
@@ -1160,6 +1160,11 @@ function saveHeaderSettingsColumn(columns, draft) {
1160
1160
  return "\u5BBD\u5EA6\u987B\u4ECB\u4E8E\u6700\u5C0F\u5BBD\u5EA6\u548C\u6700\u5927\u5BBD\u5EA6\u4E4B\u95F4";
1161
1161
  }
1162
1162
  if (existing && !existing.userDefined) {
1163
+ if (draft.visible !== void 0) {
1164
+ if (!setHeaderColumnVisible(columns, draft.key, draft.visible)) {
1165
+ return "\u8BE5\u5217\u4E0D\u53EF\u9690\u85CF\uFF0C\u4E14\u8868\u683C\u81F3\u5C11\u9700\u8981\u5C55\u793A\u4E00\u5217";
1166
+ }
1167
+ }
1163
1168
  existing.title = title;
1164
1169
  existing.settingTitle = title;
1165
1170
  existing.userTitle = title;
@@ -1177,6 +1182,11 @@ function saveHeaderSettingsColumn(columns, draft) {
1177
1182
  if (isHeaderDataIndexUsed(columns, dataIndex, draft.key)) {
1178
1183
  return "\u8BE5 dataIndex \u5DF2\u88AB\u5176\u4ED6\u5217\u4F7F\u7528";
1179
1184
  }
1185
+ if (existing && draft.visible !== void 0) {
1186
+ if (!setHeaderColumnVisible(columns, draft.key, draft.visible)) {
1187
+ return "\u8BE5\u5217\u4E0D\u53EF\u9690\u85CF\uFF0C\u4E14\u8868\u683C\u81F3\u5C11\u9700\u8981\u5C55\u793A\u4E00\u5217";
1188
+ }
1189
+ }
1180
1190
  const column = existing ?? { key: createUserColumnKey(columns) };
1181
1191
  column.title = title;
1182
1192
  column.settingTitle = title;
@@ -1185,6 +1195,7 @@ function saveHeaderSettingsColumn(columns, draft) {
1185
1195
  column.minWidth = minWidth;
1186
1196
  column.maxWidth = maxWidth;
1187
1197
  column.fixed = draft.fixed;
1198
+ if (!existing) column.hidden = draft.visible === false;
1188
1199
  column.userDefined = true;
1189
1200
  column.allowSort = true;
1190
1201
  column.sorter = true;
@@ -1192,6 +1203,8 @@ function saveHeaderSettingsColumn(columns, draft) {
1192
1203
  moveColumnToOrder(siblings, existing, draft.order);
1193
1204
  } else if (!existing) {
1194
1205
  siblings.splice((draft.order ?? maxOrder) - 1, 0, column);
1206
+ if (draft.visible === false) normalizeHiddenState(columns);
1207
+ else setHeaderColumnVisible(columns, resolveColumnKey(column), true);
1195
1208
  }
1196
1209
  draft.key = resolveColumnKey(column);
1197
1210
  return null;
@@ -34224,7 +34237,7 @@ var ListTablePersistenceController = class {
34224
34237
  this.options.canvasHost.setContentZoom(nextZoom);
34225
34238
  }
34226
34239
  let currentOptions = this.options.getOptions();
34227
- if (stored.scrollbar) {
34240
+ if (stored.scrollbar && !isSameScrollbarOptions(currentOptions.scrollbar, stored.scrollbar)) {
34228
34241
  currentOptions = { ...currentOptions, scrollbar: stored.scrollbar };
34229
34242
  currentOptions.ui?.onScrollbarChange?.(stored.scrollbar);
34230
34243
  }
@@ -34300,6 +34313,22 @@ var ListTablePersistenceController = class {
34300
34313
  );
34301
34314
  }
34302
34315
  };
34316
+ function isSameScrollbarOptions(current, stored) {
34317
+ if (current === stored) return true;
34318
+ if (!current || !stored) return false;
34319
+ const currentEntries = Object.entries(current);
34320
+ if (currentEntries.length !== Object.keys(stored).length) return false;
34321
+ return currentEntries.every(([key, value]) => {
34322
+ const next = stored[key];
34323
+ if (value && typeof value === "object" && next && typeof next === "object") {
34324
+ const entries = Object.entries(value);
34325
+ return entries.length === Object.keys(next).length && entries.every(
34326
+ ([axisKey, axisValue]) => Object.is(axisValue, next[axisKey])
34327
+ );
34328
+ }
34329
+ return Object.is(value, next);
34330
+ });
34331
+ }
34303
34332
 
34304
34333
  // src/services/data-source-service.ts
34305
34334
  function getListTableBaseDisplayData(params) {
@@ -37489,6 +37518,7 @@ var ListTableCore = class {
37489
37518
  * @param options 新配置。
37490
37519
  */
37491
37520
  updateOptions(options) {
37521
+ const preserveTooltipAndFilterPanel = options.storageKey === this.options.storageKey;
37492
37522
  const preserveContextMenu = options.dataSource !== this.options.dataSource || this.overlayController.shouldPreserveHeaderContextMenuOnOptionsUpdate();
37493
37523
  this.persistenceController.invalidate();
37494
37524
  if (options.storageKey === this.options.storageKey) {
@@ -37581,7 +37611,8 @@ var ListTableCore = class {
37581
37611
  host.renderer?.updateDebugOptions(options.debug ?? {});
37582
37612
  this.hideFloatingOverlays({
37583
37613
  includeLoading: true,
37584
- preserveContextMenu
37614
+ preserveContextMenu,
37615
+ preserveTooltipAndFilterPanel
37585
37616
  });
37586
37617
  this.refreshRuntimeColumns();
37587
37618
  if (shouldPersistColumnConfig) {
@@ -37749,8 +37780,10 @@ var ListTableCore = class {
37749
37780
  if (params?.includeLoading) {
37750
37781
  this.overlayController.hideLoading();
37751
37782
  }
37752
- this.overlayController.hideTooltip();
37753
- this.overlayController.hideFilterPanel();
37783
+ if (!params?.preserveTooltipAndFilterPanel) {
37784
+ this.overlayController.hideTooltip();
37785
+ this.overlayController.hideFilterPanel();
37786
+ }
37754
37787
  this.overlayController.hideFixedPopup();
37755
37788
  if (!params?.preserveContextMenu) {
37756
37789
  this.overlayController.hideHeaderContextMenu();
@@ -37880,5 +37913,3 @@ __publicField(ListTable, "SELECTION_COLUMN", SELECTION_COLUMN);
37880
37913
  __publicField(ListTable, "ROW_SELECTION_COLUMN", ROW_SELECTION_COLUMN);
37881
37914
 
37882
37915
  export { EXPAND_COLUMN, ListTable, ROW_SELECTION_COLUMN, SELECTION_COLUMN, getListTableStoredPageSize, listTableAntdIconNames, listTableBuiltinIconNames, listTableIconNames, resetListTableStoredColumnConfig };
37883
- //# sourceMappingURL=index.js.map
37884
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canvas-components/list-table",
3
- "version": "0.3.28",
3
+ "version": "0.3.30",
4
4
  "description": "Framework-agnostic list table core engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@ant-design/icons-svg": "4.6.0",
30
- "@canvas-components/chart": "0.3.5",
31
- "@canvas-components/qrcode": "0.2.0",
32
- "@canvas-components/barcode": "0.2.0",
33
- "@canvas-components/utils": "0.2.6",
34
- "@canvas-components/stats": "0.1.2"
30
+ "@canvas-components/qrcode": "0.2.2",
31
+ "@canvas-components/utils": "0.2.8",
32
+ "@canvas-components/barcode": "0.2.2",
33
+ "@canvas-components/chart": "0.3.7",
34
+ "@canvas-components/stats": "0.1.4"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsup --config tsup.config.ts"