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