@canvas-components/list-table 0.3.5 → 0.3.6

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.js CHANGED
@@ -10253,6 +10253,25 @@ var ListTableAnimationController = class {
10253
10253
  }
10254
10254
  return getAnimationValue(animation, this.scheduler.now());
10255
10255
  }
10256
+ /**
10257
+ * 清理指定列的控制动画及历史值,避免离屏单元格再次出现时播放过期动画。
10258
+ */
10259
+ resetControlAnimationsForColumn(columnKey) {
10260
+ Array.from(this.runtime.controlAnimations.keys()).forEach((key) => {
10261
+ if (isControlAnimationKeyForColumn(key, columnKey)) {
10262
+ this.runtime.controlAnimations.delete(key);
10263
+ }
10264
+ });
10265
+ Array.from(this.runtime.lastControlValues.keys()).forEach((key) => {
10266
+ if (isControlAnimationKeyForColumn(key, columnKey)) {
10267
+ this.runtime.lastControlValues.delete(key);
10268
+ }
10269
+ });
10270
+ if (this.runtime.controlAnimations.size === 0 && this.runtime.controlAnimationFrameId != null) {
10271
+ this.scheduler.cancelAnimationFrame(this.runtime.controlAnimationFrameId);
10272
+ this.runtime.controlAnimationFrameId = null;
10273
+ }
10274
+ }
10256
10275
  getNestedTableHighlight(params) {
10257
10276
  return this.runtime.nestedTableHighlights.get(
10258
10277
  getNestedTableHighlightKey(
@@ -10463,6 +10482,14 @@ function createDefaultAnimationScheduler() {
10463
10482
  clearInterval: (id) => window.clearInterval(id)
10464
10483
  };
10465
10484
  }
10485
+ function isControlAnimationKeyForColumn(key, columnKey) {
10486
+ const contentSeparatorIndex = key.lastIndexOf("::");
10487
+ if (contentSeparatorIndex < 0) {
10488
+ return false;
10489
+ }
10490
+ const columnSeparatorIndex = key.lastIndexOf("::", contentSeparatorIndex - 1);
10491
+ return columnSeparatorIndex >= 0 && key.slice(columnSeparatorIndex + 2, contentSeparatorIndex) === columnKey;
10492
+ }
10466
10493
 
10467
10494
  // src/shared/carousel/carousel.ts
10468
10495
  function resolveCarouselScrollInterval(params) {
@@ -18076,6 +18103,7 @@ var ListTableHeaderActionController = class {
18076
18103
  this.options.clearExpandedRows();
18077
18104
  this.options.clearCollapsedRows();
18078
18105
  this.options.filterPanel.hide();
18106
+ this.options.persistColumnConfig();
18079
18107
  this.options.applyFilterQueryAsync();
18080
18108
  }
18081
18109
  };
@@ -18525,7 +18553,8 @@ var ListTablePersistenceController = class {
18525
18553
  __publicField(this, "options");
18526
18554
  this.options = options;
18527
18555
  }
18528
- async loadStoredConfig() {
18556
+ async loadStoredConfig(options = {}) {
18557
+ const { restoreQueryState = true } = options;
18529
18558
  const tableOptions = this.options.getOptions();
18530
18559
  const stored = await loadListTableStoredConfig({
18531
18560
  storageKey: tableOptions.storageKey,
@@ -18534,10 +18563,10 @@ var ListTablePersistenceController = class {
18534
18563
  if (!stored) {
18535
18564
  return;
18536
18565
  }
18537
- if (stored.sortState) {
18566
+ if (restoreQueryState && stored.sortState) {
18538
18567
  this.options.setSortState(stored.sortState);
18539
18568
  }
18540
- if (stored.filterState) {
18569
+ if (restoreQueryState && stored.filterState) {
18541
18570
  this.options.setFilterState(stored.filterState);
18542
18571
  }
18543
18572
  if (stored.zoom != null) {
@@ -25737,6 +25766,9 @@ var ListTableRowActionController = class {
25737
25766
  if (!nextKeys) {
25738
25767
  return;
25739
25768
  }
25769
+ this.options.animationController.resetControlAnimationsForColumn(
25770
+ ROW_SELECTION_COLUMN_KEY
25771
+ );
25740
25772
  this.updateSelectedRowKeys(nextKeys, "all");
25741
25773
  this.options.requestRender();
25742
25774
  }
@@ -27201,7 +27233,7 @@ var ListTableCore = class {
27201
27233
  this.hideFloatingOverlays({ includeLoading: true });
27202
27234
  this.refreshRuntimeColumns();
27203
27235
  this.renderController.render();
27204
- this.persistenceController.loadStoredConfig();
27236
+ this.persistenceController.loadStoredConfig({ restoreQueryState: false });
27205
27237
  host.tableId = options.tableId?.trim() ? options.tableId : host.tableId;
27206
27238
  host.rowDragController.syncRegistration();
27207
27239
  }