@taocompany/magic-grid 0.1.3 → 0.1.4

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.es.js CHANGED
@@ -17742,6 +17742,19 @@ var Ex = class {
17742
17742
  canToggleHeaderSort(e) {
17743
17743
  return this.columnResizeSession.isActive() || this.deps.columnDragController.shouldSuppressSortClick() || z(e) || B(e) || this.isExpandColumnEntry(e) || this.isGroupColumnEntry(e) || this.isTreeColumnEntry(e) ? !1 : this.deps.columnModel.getColumnById(e)?.sortable ?? !1;
17744
17744
  }
17745
+ shouldHeaderClickSortAndSelectColumn(e) {
17746
+ return !this.deps.isCellSelectionEnabled?.() || !this.deps.getCellSelectionOptions?.().enableColumnSelection ? !1 : this.canToggleHeaderSort(e);
17747
+ }
17748
+ tryApplyHeaderColumnSelection(e, t) {
17749
+ if (!this.cellRangeInteraction.tryHeaderColumnSelection(e)) return !1;
17750
+ let n = this.deps.rowModel.getRow(0);
17751
+ return n && this.setFocusedCell({
17752
+ rowId: n.id,
17753
+ colId: e,
17754
+ rowIndex: 0,
17755
+ colIndex: t
17756
+ }), !0;
17757
+ }
17745
17758
  applyIndexFocus(e, t, n, r = {}) {
17746
17759
  !this.deps.indexFocusService || !this.isIndexColumnEntry(n) || (this.deps.indexFocusService.selectRow(e, t, (e) => this.deps.rowModel.getRow(e)?.id, r), this.deps.applyIndexFocusVisuals(), this.deps.eventBus.emit("indexFocusChanged", { focusedRowIds: this.deps.indexFocusService.getFocusedRowIds() }), this.syncCellRangeFromIndexFocus(t));
17747
17760
  }
@@ -17796,7 +17809,7 @@ var Ex = class {
17796
17809
  if (!t) return;
17797
17810
  this.clearIndexFocusState();
17798
17811
  let n = this.isSelectionColumnEntry(t.colId) && this.deps.selectionService?.isMultiple(), r = y_(e.target), i = this.deps.columnModel.getColumnById(t.colId);
17799
- if (this.focusController.isHeaderNavigationEnabled() ? (e.preventDefault(), e.stopPropagation(), this.setFocusedCell({
17812
+ if (this.focusController.isHeaderNavigationEnabled() ? (e.preventDefault(), e.stopPropagation(), this.canToggleHeaderSort(t.colId) || this.setFocusedCell({
17800
17813
  rowId: Qe,
17801
17814
  colId: t.colId,
17802
17815
  rowIndex: -1,
@@ -17818,15 +17831,8 @@ var Ex = class {
17818
17831
  });
17819
17832
  return;
17820
17833
  }
17821
- if (!Pb(e.target) && this.cellRangeInteraction.tryHeaderColumnSelection(t.colId)) {
17834
+ if (!this.shouldHeaderClickSortAndSelectColumn(t.colId) && !Pb(e.target) && this.tryApplyHeaderColumnSelection(t.colId, t.colIndex)) {
17822
17835
  e.preventDefault(), e.stopPropagation(), this.suppressHeaderSortClick = !0;
17823
- let n = this.deps.rowModel.getRow(0);
17824
- n && this.setFocusedCell({
17825
- rowId: n.id,
17826
- colId: t.colId,
17827
- rowIndex: 0,
17828
- colIndex: t.colIndex
17829
- });
17830
17836
  return;
17831
17837
  }
17832
17838
  };
@@ -17866,7 +17872,7 @@ var Ex = class {
17866
17872
  this.deps.columnDragController.shouldSuppressSortClick() && (e.preventDefault(), e.stopPropagation());
17867
17873
  return;
17868
17874
  }
17869
- e.preventDefault(), e.stopPropagation(), this.deps.toggleHeaderSort(t.colId);
17875
+ e.preventDefault(), e.stopPropagation(), this.deps.toggleHeaderSort(t.colId), this.shouldHeaderClickSortAndSelectColumn(t.colId) && this.tryApplyHeaderColumnSelection(t.colId, t.colIndex);
17870
17876
  };
17871
17877
  handleFloatingFilterClick = (e) => {
17872
17878
  let t = g_(e.target);