@procore/data-table 13.0.0 → 13.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Change Log
2
2
 
3
+ ## 13.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 4b3d586484: Moves packages to devDependncies that should not have been dependencies.
8
+
9
+ ## 13.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - f00d979137: Change keyboard interactions to improve editing
14
+
15
+ ### Patch Changes
16
+
17
+ - 02726b2511: Using the passed in `maxHeight` prop to set table `maxHeight` instead of `height`
18
+ - 08839931f5: Fix selectAll for serverSide table
19
+
3
20
  ## 13.0.0
4
21
 
5
22
  ### Major Changes
@@ -55162,7 +55162,7 @@ function getAffectedRows(currentRows, selectionNode, affectedRows) {
55162
55162
  var _a;
55163
55163
  const isNodeRootLevel = isNodeRootLevelOfGrid(selectionNode.parent);
55164
55164
  const nodeId = selectionNode.id;
55165
- const isRowSelected = !!selectionNode.isSelected();
55165
+ const isRowSelected2 = !!selectionNode.isSelected();
55166
55166
  const parentChildrenMap = {};
55167
55167
  if (selectionNode.group || ((_a = selectionNode.parent) == null ? void 0 : _a.group) && !isNodeRootLevel) {
55168
55168
  currentRows.forEach((row) => {
@@ -55181,7 +55181,7 @@ function getAffectedRows(currentRows, selectionNode, affectedRows) {
55181
55181
  }
55182
55182
  });
55183
55183
  }
55184
- const selectedState = isRowSelected ? rowSelectionState.selected : rowSelectionState.unselected;
55184
+ const selectedState = isRowSelected2 ? rowSelectionState.selected : rowSelectionState.unselected;
55185
55185
  affectedRows[nodeId] = {
55186
55186
  node: selectionNode,
55187
55187
  selectedState
@@ -55227,7 +55227,7 @@ function getAffectedRows(currentRows, selectionNode, affectedRows) {
55227
55227
  ).forEach((node) => {
55228
55228
  affectedRows[node.id] = {
55229
55229
  node,
55230
- selectedState: isRowSelected ? rowSelectionState.selected : rowSelectionState.unselected
55230
+ selectedState: isRowSelected2 ? rowSelectionState.selected : rowSelectionState.unselected
55231
55231
  };
55232
55232
  });
55233
55233
  }
@@ -55289,7 +55289,8 @@ function getSelectedState(node, affectedRows) {
55289
55289
  function ServerSideRowCheckbox(props) {
55290
55290
  var _a, _b, _c, _d;
55291
55291
  const { rowSelectionRef } = useInternalTableContext();
55292
- const indeterminate = ((_b = (_a = rowSelectionRef.current) == null ? void 0 : _a.affectedRows[props.node.id]) == null ? void 0 : _b.selectedState) === "indeterminate" ? true : false;
55292
+ const indeterminate = ((_b = (_a = rowSelectionRef.current) == null ? void 0 : _a.affectedRows[props.node.id]) == null ? void 0 : _b.selectedState) === "indeterminate";
55293
+ const { tableRef } = useInternalTableContext();
55293
55294
  const checked = getSelectedState(
55294
55295
  props.node,
55295
55296
  (_c = rowSelectionRef.current) == null ? void 0 : _c.affectedRows
@@ -55303,7 +55304,8 @@ function ServerSideRowCheckbox(props) {
55303
55304
  "data-qa": "rowCheckbox",
55304
55305
  onClick: noop2,
55305
55306
  onChange: () => {
55306
- props.node.setSelected(!props.node.isSelected());
55307
+ var _a2, _b2;
55308
+ props.node.isSelected() ? (_a2 = tableRef == null ? void 0 : tableRef.current) == null ? void 0 : _a2.deselectRows([props.node.id]) : (_b2 = tableRef == null ? void 0 : tableRef.current) == null ? void 0 : _b2.selectRows([props.node.id]);
55307
55309
  }
55308
55310
  }
55309
55311
  ));
@@ -55700,19 +55702,32 @@ var DataTableCellRenderer = ({
55700
55702
  )
55701
55703
  ));
55702
55704
  };
55705
+ function getStartingValue(eventKey, editorType, existingValue) {
55706
+ if (eventKey && editorType === "input" && eventKey !== "Enter") {
55707
+ if (eventKey === "Backspace") {
55708
+ return "";
55709
+ }
55710
+ return eventKey;
55711
+ }
55712
+ return existingValue;
55713
+ }
55703
55714
  var DataTableCellEditor = React82__default.default.forwardRef(
55704
55715
  ({
55716
+ api,
55705
55717
  colDef,
55706
55718
  Component: Component4,
55707
55719
  context,
55708
55720
  data,
55709
55721
  editorType,
55722
+ eventKey,
55710
55723
  node,
55711
55724
  parseValue,
55712
55725
  stopEditing,
55713
55726
  value
55714
55727
  }, ref) => {
55715
55728
  var _a;
55729
+ const startingValue = getStartingValue(eventKey, editorType, value);
55730
+ const [currentValue, setCurrentValue] = React82.useState(startingValue);
55716
55731
  const { rowHeight, tableRef } = useInternalTableContext();
55717
55732
  const inlineEditorRef = React82__default.default.useRef(null);
55718
55733
  const inputRef = React82__default.default.useRef(null);
@@ -55750,19 +55765,39 @@ var DataTableCellEditor = React82__default.default.forwardRef(
55750
55765
  }
55751
55766
  };
55752
55767
  });
55768
+ function handleKeyDown(event) {
55769
+ if (node.rowIndex !== null && colDef.field && editorType === "input" && !event.shiftKey && !event.metaKey && !event.altKey && !event.ctrlKey) {
55770
+ if (event.key === "ArrowUp") {
55771
+ stopEditing(true);
55772
+ api.setFocusedCell(node.rowIndex - 1, colDef.field, node.rowPinned);
55773
+ } else if (event.key === "ArrowDown" || event.key === "Enter") {
55774
+ stopEditing(true);
55775
+ api.setFocusedCell(node.rowIndex + 1, colDef.field, node.rowPinned);
55776
+ }
55777
+ }
55778
+ }
55753
55779
  React82__default.default.useEffect(() => {
55754
- var _a2, _b, _c, _d, _e, _f, _g;
55780
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
55755
55781
  if (editorType === "input") {
55756
- (_a2 = inputRef.current) == null ? void 0 : _a2.select();
55757
- (_b = inlineEditorRef.current) == null ? void 0 : _b.show();
55782
+ if (eventKey) {
55783
+ (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
55784
+ } else {
55785
+ (_b = inputRef.current) == null ? void 0 : _b.select();
55786
+ }
55787
+ (_c = inlineEditorRef.current) == null ? void 0 : _c.show();
55788
+ (_d = inputRef.current) == null ? void 0 : _d.addEventListener("keydown", handleKeyDown);
55758
55789
  } else if (editorType === "textarea") {
55759
- (_c = textAreaRef.current) == null ? void 0 : _c.select();
55760
- (_d = inlineEditorRef.current) == null ? void 0 : _d.show();
55790
+ (_e = textAreaRef.current) == null ? void 0 : _e.select();
55791
+ (_f = inlineEditorRef.current) == null ? void 0 : _f.show();
55761
55792
  } else {
55762
- (_e = selectRef.current) == null ? void 0 : _e.click();
55763
- (_f = selectRef.current) == null ? void 0 : _f.focus();
55764
- (_g = inlineEditorRef.current) == null ? void 0 : _g.show();
55793
+ (_g = selectRef.current) == null ? void 0 : _g.click();
55794
+ (_h = selectRef.current) == null ? void 0 : _h.focus();
55795
+ (_i = inlineEditorRef.current) == null ? void 0 : _i.show();
55765
55796
  }
55797
+ return () => {
55798
+ var _a3;
55799
+ (_a3 = inputRef.current) == null ? void 0 : _a3.removeEventListener("keydown", handleKeyDown);
55800
+ };
55766
55801
  }, []);
55767
55802
  const handleRefs = (editorType2) => {
55768
55803
  const getRef = (refType) => coreReact.UNSAFE_mergeRefs(refType, ref);
@@ -55793,10 +55828,13 @@ var DataTableCellEditor = React82__default.default.forwardRef(
55793
55828
  parentId: context == null ? void 0 : context.parentId,
55794
55829
  rowPinned: node.rowPinned,
55795
55830
  rowHeight,
55796
- setDataValue: (field, newValue) => node.setDataValue(field, newValue),
55831
+ setDataValue: (field, newValue) => {
55832
+ node.setDataValue(field, newValue);
55833
+ setCurrentValue(newValue);
55834
+ },
55797
55835
  stopEditing,
55798
55836
  tableApi: tableRef == null ? void 0 : tableRef.current,
55799
- value,
55837
+ value: currentValue,
55800
55838
  ref: handleRefs(editorType)
55801
55839
  }
55802
55840
  )
@@ -56172,12 +56210,15 @@ var SortComponent = (props) => {
56172
56210
  }
56173
56211
  return null;
56174
56212
  };
56213
+ var isRowSelected = (rowNode) => {
56214
+ return Boolean(rowNode.selectable ? rowNode.isSelected() : true);
56215
+ };
56175
56216
  var GenericHeaderRenderer = (props) => {
56176
56217
  var _a;
56177
56218
  const colDef = props.column.getColDef();
56178
56219
  const HeaderNode = (_a = colDef.headerComponentParams) == null ? void 0 : _a.headerNode;
56179
56220
  const I18n = coreReact.useI18nContext();
56180
- const { columnApi, gridApi, onServerSideDataRequest } = useInternalTableContext();
56221
+ const { columnApi, tableRef, gridApi, onServerSideDataRequest } = useInternalTableContext();
56181
56222
  const onSSDR = Boolean(onServerSideDataRequest);
56182
56223
  const [sortOrder, setSortOrder] = React82__default.default.useState(props.column.getSort());
56183
56224
  const [isFirstColumn2, setIsFirstColumn] = React82__default.default.useState(false);
@@ -56212,9 +56253,11 @@ var GenericHeaderRenderer = (props) => {
56212
56253
  };
56213
56254
  }, []);
56214
56255
  const onSortToggled = (event) => {
56215
- var _a2;
56256
+ var _a2, _b, _c;
56216
56257
  let currentSort = null;
56217
- if (event.target.parentElement === ((_a2 = checkbox.current) == null ? void 0 : _a2.parentElement)) {
56258
+ if (Array.from(((_b = (_a2 = checkbox.current) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b.children) || []).includes(
56259
+ (_c = event.target) == null ? void 0 : _c.parentElement
56260
+ )) {
56218
56261
  return;
56219
56262
  }
56220
56263
  if (props.enableSorting) {
@@ -56266,6 +56309,9 @@ var GenericHeaderRenderer = (props) => {
56266
56309
  }, [props.column]);
56267
56310
  const [isExpandable, setIsExpandable] = React82__default.default.useState(false);
56268
56311
  React82__default.default.useEffect(() => {
56312
+ if (onSSDR) {
56313
+ return;
56314
+ }
56269
56315
  const hasExpandableNodes = !!findNode(
56270
56316
  (node) => node.isExpandable(),
56271
56317
  props.api
@@ -56393,14 +56439,9 @@ var GenericHeaderRenderer = (props) => {
56393
56439
  return;
56394
56440
  }
56395
56441
  function updateSelectAllCheckbox() {
56396
- const currentPageIds = getCurrentPageIds();
56397
- const selectedRowIds = (props.api.getSelectedRows() ?? []).map(
56398
- ({ id }) => id
56399
- );
56400
- const isAllSelected = currentPageIds.every(
56401
- (id) => selectedRowIds.includes(id)
56402
- );
56403
- const isPartialSelected = !isAllSelected && currentPageIds.some((id) => selectedRowIds.includes(id));
56442
+ const currentRows = getCurrentRows(gridApi);
56443
+ const isAllSelected = currentRows.length && currentRows.every(isRowSelected);
56444
+ const isPartialSelected = !isAllSelected && currentRows.some(isRowSelected);
56404
56445
  if (isAllSelected) {
56405
56446
  setSelectAll("all" /* All */);
56406
56447
  } else if (isPartialSelected) {
@@ -56412,55 +56453,20 @@ var GenericHeaderRenderer = (props) => {
56412
56453
  props.api.addEventListener(selectionChanged, updateSelectAllCheckbox);
56413
56454
  props.api.addEventListener(paginationChanged, updateSelectAllCheckbox);
56414
56455
  return () => {
56415
- props.api.removeEventListener(
56416
- "selectionChanged",
56417
- updateSelectAllCheckbox
56418
- );
56419
- props.api.removeEventListener(
56420
- "paginationChanged",
56421
- updateSelectAllCheckbox
56422
- );
56456
+ props.api.removeEventListener(selectionChanged, updateSelectAllCheckbox);
56457
+ props.api.removeEventListener(paginationChanged, updateSelectAllCheckbox);
56423
56458
  };
56424
56459
  }, [isFirstColumn2, selectAll, props.selectionSSREnabled]);
56425
- const getCurrentPageIds = () => {
56426
- const rowCount = props.api.getDisplayedRowCount();
56427
- const lastGridIndex = rowCount - 1;
56428
- const currentPage = props.api.paginationGetCurrentPage();
56429
- const pageSize = props.api.paginationGetPageSize();
56430
- const startPageIndex = currentPage * pageSize;
56431
- let endPageIndex = (currentPage + 1) * pageSize - 1;
56432
- if (endPageIndex > lastGridIndex) {
56433
- endPageIndex = lastGridIndex;
56434
- }
56435
- return [...Array(endPageIndex - startPageIndex + 1).keys()].map(
56436
- (index) => {
56437
- var _a2, _b;
56438
- return (_b = (_a2 = props.api.getDisplayedRowAtIndex(index + startPageIndex)) == null ? void 0 : _a2.data) == null ? void 0 : _b.id;
56439
- }
56440
- );
56441
- };
56442
- const handleSSRSelectAll = (param) => {
56443
- var _a2;
56444
- if (!props.selectionSSREnabled) {
56445
- return;
56446
- }
56447
- const selectedRowIds = (props.api.getSelectedRows() ?? []).map(
56448
- ({ id }) => id
56449
- );
56450
- const currentPageIds = getCurrentPageIds();
56451
- if (param === "all" /* All */) {
56452
- (_a2 = [.../* @__PURE__ */ new Set([...selectedRowIds, ...currentPageIds])]) == null ? void 0 : _a2.forEach(
56453
- (id) => {
56454
- var _a3;
56455
- (_a3 = props.api.getRowNode(id.toString())) == null ? void 0 : _a3.setSelected(true);
56456
- }
56457
- );
56458
- }
56459
- if (param === "none" /* None */) {
56460
- currentPageIds.forEach((id) => {
56461
- var _a3;
56462
- (_a3 = props.api.getRowNode(id.toString())) == null ? void 0 : _a3.setSelected(false);
56463
- });
56460
+ const toggleSelectAll = () => {
56461
+ var _a2, _b, _c;
56462
+ const nextSelectedState = selectAll === "all" /* All */ ? "none" /* None */ : "all" /* All */;
56463
+ setSelectAll(nextSelectedState);
56464
+ (_a2 = props.onSelectAll) == null ? void 0 : _a2.call(props, nextSelectedState);
56465
+ const isSelectAll = nextSelectedState == "all" /* All */;
56466
+ if (props.selectionSSREnabled) {
56467
+ isSelectAll ? (_b = tableRef == null ? void 0 : tableRef.current) == null ? void 0 : _b.selectAll() : (_c = tableRef == null ? void 0 : tableRef.current) == null ? void 0 : _c.deselectAll();
56468
+ } else {
56469
+ isSelectAll ? props.api.selectAllFiltered() : props.api.deselectAllFiltered();
56464
56470
  }
56465
56471
  };
56466
56472
  return /* @__PURE__ */ React82__default.default.createElement(
@@ -56499,16 +56505,7 @@ var GenericHeaderRenderer = (props) => {
56499
56505
  indeterminate: selectAll === "partial",
56500
56506
  onClick: (e) => e.stopPropagation(),
56501
56507
  onChange: () => {
56502
- var _a2, _b;
56503
- if (selectAll === "all" /* All */) {
56504
- setSelectAll("none" /* None */);
56505
- (_a2 = props.onSelectAll) == null ? void 0 : _a2.call(props, "none" /* None */);
56506
- onSSDR ? handleSSRSelectAll("none" /* None */) : props.api.deselectAllFiltered();
56507
- } else {
56508
- setSelectAll("all" /* All */);
56509
- (_b = props.onSelectAll) == null ? void 0 : _b.call(props, "all" /* All */);
56510
- onSSDR ? handleSSRSelectAll("all" /* All */) : props.api.selectAllFiltered();
56511
- }
56508
+ toggleSelectAll();
56512
56509
  }
56513
56510
  }
56514
56511
  ),
@@ -58792,18 +58789,31 @@ var ClientSideRowModelModule = {
58792
58789
  rowModel: "clientSide",
58793
58790
  beans: [ClientSideRowModel, FilterStage, SortStage, FlattenStage, SortService, FilterService, ImmutableService]
58794
58791
  };
58792
+ var getSelectedRows = ({
58793
+ gridApi,
58794
+ rowSelectionRef
58795
+ }) => {
58796
+ var _a;
58797
+ const serverSideRows = Object.values(
58798
+ ((_a = rowSelectionRef == null ? void 0 : rowSelectionRef.current) == null ? void 0 : _a.affectedRows) || {}
58799
+ ).filter(
58800
+ (affectedRow) => affectedRow.selectedState === rowSelectionState.selected
58801
+ ).map((affectedRow) => affectedRow.node);
58802
+ return (gridApi == null ? void 0 : gridApi.getModel().getType()) === "serverSide" ? serverSideRows : (gridApi == null ? void 0 : gridApi.getSelectedNodes()) ?? [];
58803
+ };
58795
58804
  var useRowSelectionState = () => {
58796
58805
  const [selectedRows, setSelectedRows] = React82__default.default.useState([]);
58797
- const { gridApi } = useInternalTableContext();
58806
+ const { gridApi, rowSelectionRef } = useInternalTableContext();
58798
58807
  React82__default.default.useEffect(() => {
58799
58808
  function selectionEventFunction() {
58800
- const rows = (gridApi == null ? void 0 : gridApi.getSelectedNodes()) ?? [];
58801
- setSelectedRows(rows);
58809
+ setSelectedRows(getSelectedRows({ gridApi, rowSelectionRef }));
58802
58810
  }
58803
58811
  selectionEventFunction();
58804
58812
  gridApi == null ? void 0 : gridApi.addEventListener("selectionChanged", selectionEventFunction);
58813
+ gridApi == null ? void 0 : gridApi.addEventListener("paginationChanged", selectionEventFunction);
58805
58814
  return () => {
58806
58815
  gridApi == null ? void 0 : gridApi.removeEventListener("selectionChanged", selectionEventFunction);
58816
+ gridApi == null ? void 0 : gridApi.removeEventListener("paginationChanged", selectionEventFunction);
58807
58817
  };
58808
58818
  }, [gridApi]);
58809
58819
  return selectedRows;
@@ -75711,6 +75721,7 @@ var useTableApi = ({
75711
75721
  filterStorage,
75712
75722
  onTableConfigChange,
75713
75723
  rowHeight,
75724
+ rowSelectionRef,
75714
75725
  setRowHeight: internalSetRowHeight,
75715
75726
  searchStorage
75716
75727
  } = useInternalTableContext();
@@ -75845,11 +75856,11 @@ var useTableApi = ({
75845
75856
  columnDefinition: colDef,
75846
75857
  node: { rowPinned: false },
75847
75858
  data: {}
75848
- }) === true
75859
+ })
75849
75860
  );
75850
75861
  }
75851
75862
  if (typeof colDef.bulkEditable === "boolean") {
75852
- return colDef.bulkEditable === true;
75863
+ return colDef.bulkEditable;
75853
75864
  }
75854
75865
  if (typeof colDef.editable === "function") {
75855
75866
  return (
@@ -75861,7 +75872,7 @@ var useTableApi = ({
75861
75872
  columnDefinition: colDef,
75862
75873
  node: { rowPinned: false },
75863
75874
  data: {}
75864
- }) === true
75875
+ })
75865
75876
  );
75866
75877
  }
75867
75878
  return colDef.editable === true;
@@ -76036,14 +76047,59 @@ var useTableApi = ({
76036
76047
  [internalSetRowHeight]
76037
76048
  );
76038
76049
  const gridApiMethods = React82__default.default.useMemo(
76039
- () => buildPartialTableApi({ gridApi, columnApi, rowHeight, filterStorage }),
76050
+ () => buildPartialTableApi({
76051
+ gridApi,
76052
+ columnApi,
76053
+ rowHeight,
76054
+ filterStorage,
76055
+ rowSelectionRef
76056
+ }),
76040
76057
  [columnApi, gridApi, rowHeight, filterStorage]
76041
76058
  );
76059
+ const onSelectionChanged = (rowNode) => {
76060
+ var _a;
76061
+ const isGrouped = rowNode.group || ((_a = rowNode.parent) == null ? void 0 : _a.group) && !isNodeRootLevelOfGrid(rowNode.parent);
76062
+ const currAffectedRows = rowSelectionRef.current.affectedRows;
76063
+ if (!isGrouped) {
76064
+ rowSelectionRef.current.affectedRows = {
76065
+ ...currAffectedRows,
76066
+ [rowNode.id]: {
76067
+ node: rowNode,
76068
+ selectedState: rowNode.isSelected() ? rowSelectionState.selected : rowSelectionState.unselected
76069
+ }
76070
+ };
76071
+ gridApi == null ? void 0 : gridApi.redrawRows({ rowNodes: [rowNode] });
76072
+ return;
76073
+ }
76074
+ const rowsToUpdate = getAffectedRows(
76075
+ getCurrentRows(gridApi),
76076
+ rowNode,
76077
+ currAffectedRows
76078
+ );
76079
+ const rowValues = Object.values(rowsToUpdate);
76080
+ rowValues.forEach((row) => {
76081
+ row.node.setSelected(
76082
+ row.selectedState === rowSelectionState.selected,
76083
+ false,
76084
+ "checkboxSelected"
76085
+ );
76086
+ });
76087
+ rowSelectionRef.current.affectedRows = {
76088
+ ...currAffectedRows,
76089
+ ...rowsToUpdate
76090
+ };
76091
+ gridApi == null ? void 0 : gridApi.redrawRows({
76092
+ rowNodes: rowValues.map((rowValue) => rowValue.node)
76093
+ });
76094
+ };
76042
76095
  const selectRows = React82__default.default.useCallback(
76043
76096
  (rowIds) => {
76044
76097
  rowIds == null ? void 0 : rowIds.forEach((id) => {
76045
- var _a;
76046
- (_a = gridApi == null ? void 0 : gridApi.getRowNode(id.toString())) == null ? void 0 : _a.setSelected(true);
76098
+ const rowNode = gridApi == null ? void 0 : gridApi.getRowNode(id.toString());
76099
+ if (!rowNode)
76100
+ return;
76101
+ rowNode.setSelected(true);
76102
+ onSelectionChanged(rowNode);
76047
76103
  });
76048
76104
  },
76049
76105
  [gridApi]
@@ -76051,8 +76107,11 @@ var useTableApi = ({
76051
76107
  const deselectRows = React82__default.default.useCallback(
76052
76108
  (rowIds) => {
76053
76109
  rowIds == null ? void 0 : rowIds.forEach((id) => {
76054
- var _a;
76055
- (_a = gridApi == null ? void 0 : gridApi.getRowNode(id.toString())) == null ? void 0 : _a.setSelected(false);
76110
+ const rowNode = gridApi == null ? void 0 : gridApi.getRowNode(id.toString());
76111
+ if (!rowNode)
76112
+ return;
76113
+ rowNode.setSelected(false);
76114
+ onSelectionChanged(rowNode);
76056
76115
  });
76057
76116
  },
76058
76117
  [gridApi]
@@ -76101,7 +76160,8 @@ function buildPartialTableApi({
76101
76160
  gridApi,
76102
76161
  rowHeight,
76103
76162
  columnApi,
76104
- filterStorage
76163
+ filterStorage,
76164
+ rowSelectionRef
76105
76165
  }) {
76106
76166
  const setRowData = (rows) => {
76107
76167
  if ((gridApi == null ? void 0 : gridApi.getModel().getType()) === "serverSide") {
@@ -76143,7 +76203,8 @@ function buildPartialTableApi({
76143
76203
  gridApi: detailGridApi,
76144
76204
  columnApi: detailGridColumnApi,
76145
76205
  rowHeight,
76146
- filterStorage
76206
+ filterStorage,
76207
+ rowSelectionRef
76147
76208
  }) : void 0;
76148
76209
  };
76149
76210
  const getTableConfiguration = () => {
@@ -76178,44 +76239,58 @@ function buildPartialTableApi({
76178
76239
  }
76179
76240
  return {};
76180
76241
  };
76181
- const getSelectedRows = () => {
76242
+ const getSelectedRows2 = () => {
76182
76243
  return (gridApi == null ? void 0 : gridApi.getSelectedRows()) || [];
76183
76244
  };
76184
- const selectAll = () => {
76185
- const model = gridApi == null ? void 0 : gridApi.getModel();
76186
- if ((model == null ? void 0 : model.getType()) === "clientSide") {
76187
- gridApi == null ? void 0 : gridApi.selectAll();
76188
- }
76189
- gridApi == null ? void 0 : gridApi.forEachNode(function(node) {
76190
- if (node.isSelected() === false) {
76191
- node.setSelected(true, void 0, "apiSelectAll");
76245
+ const rowsNeedingUpdateAfterSelectAll = (isSelectAll) => {
76246
+ const prevRowNodes = (gridApi == null ? void 0 : gridApi.getRenderedNodes()) || [];
76247
+ return prevRowNodes.filter((prevRowNode) => {
76248
+ if (!prevRowNode.selectable) {
76249
+ return false;
76192
76250
  }
76251
+ return isSelectAll ? !prevRowNode.isSelected() : prevRowNode.isSelected();
76193
76252
  });
76253
+ };
76254
+ const updateAffectedRowsOnToggle = (isSelected) => {
76255
+ const prevAffectedRows = rowSelectionRef.current.affectedRows;
76256
+ const currentRows = getCurrentRows(gridApi);
76257
+ rowSelectionRef.current.affectedRows = currentRows.reduce(
76258
+ (accum, rowNode) => {
76259
+ if (!rowNode.id) {
76260
+ return accum;
76261
+ }
76262
+ return {
76263
+ ...accum,
76264
+ [rowNode.id]: {
76265
+ node: rowNode,
76266
+ selectedState: isSelected ? rowSelectionState.selected : rowSelectionState.unselected
76267
+ }
76268
+ };
76269
+ },
76270
+ prevAffectedRows
76271
+ );
76272
+ };
76273
+ const selectAll = () => {
76274
+ const nodesToUpdate = rowsNeedingUpdateAfterSelectAll(true);
76275
+ gridApi == null ? void 0 : gridApi.selectAll();
76194
76276
  if ((gridApi == null ? void 0 : gridApi.getModel().getType()) === "serverSide") {
76195
- gridApi == null ? void 0 : gridApi.redrawRows();
76277
+ updateAffectedRowsOnToggle(true);
76278
+ gridApi == null ? void 0 : gridApi.redrawRows({ rowNodes: nodesToUpdate });
76196
76279
  }
76197
76280
  };
76198
76281
  const deselectAll = () => {
76199
- const model = gridApi == null ? void 0 : gridApi.getModel();
76200
- if ((model == null ? void 0 : model.getType()) === "clientSide") {
76201
- gridApi == null ? void 0 : gridApi.deselectAll();
76202
- }
76203
- gridApi == null ? void 0 : gridApi.forEachNode(function(node) {
76204
- if (node.isSelected() === true) {
76205
- node.setSelected(false, void 0, "apiSelectAll");
76206
- }
76207
- });
76282
+ const nodesToUpdate = rowsNeedingUpdateAfterSelectAll(false);
76283
+ gridApi == null ? void 0 : gridApi.deselectAll();
76208
76284
  if ((gridApi == null ? void 0 : gridApi.getModel().getType()) === "serverSide") {
76209
- gridApi == null ? void 0 : gridApi.redrawRows();
76285
+ updateAffectedRowsOnToggle(false);
76286
+ gridApi == null ? void 0 : gridApi.redrawRows({ rowNodes: nodesToUpdate });
76210
76287
  }
76211
76288
  };
76212
76289
  const collapseAll = () => {
76213
76290
  gridApi == null ? void 0 : gridApi.collapseAll();
76214
76291
  };
76215
76292
  const expandAll = () => {
76216
- gridApi == null ? void 0 : gridApi.forEachNode((node) => {
76217
- node.setExpanded(true);
76218
- });
76293
+ gridApi == null ? void 0 : gridApi.expandAll();
76219
76294
  };
76220
76295
  const setRowNodeExpanded = (rowNode, expanded) => {
76221
76296
  return gridApi == null ? void 0 : gridApi.setRowNodeExpanded(rowNode, expanded);
@@ -76246,7 +76321,7 @@ function buildPartialTableApi({
76246
76321
  getFilteredAndSortedRowNodes,
76247
76322
  getRootAggregateData,
76248
76323
  getRowData,
76249
- getSelectedRows,
76324
+ getSelectedRows: getSelectedRows2,
76250
76325
  getTableConfiguration,
76251
76326
  refreshCells,
76252
76327
  setPinnedBottomRowData,
@@ -77202,42 +77277,6 @@ var Table = (props) => {
77202
77277
  },
77203
77278
  [props.onRowGroupOpened]
77204
77279
  );
77205
- const onSelectionChanged = (event) => {
77206
- if (!internalTableContext.onServerSideDataRequest || event.source === "apiSelectAll") {
77207
- return;
77208
- }
77209
- const previousSelectedIds = Object.keys(
77210
- rowSelectionRef.current.affectedRows
77211
- ).filter(
77212
- (nodeId) => rowSelectionRef.current.affectedRows[nodeId].selectedState === rowSelectionState.selected
77213
- );
77214
- const affectedRows = rowSelectionRef.current.affectedRows;
77215
- const eventSelectedIds = event.api.getSelectedNodes().map((node) => node.id);
77216
- const diff = ramda.symmetricDifference(eventSelectedIds, previousSelectedIds);
77217
- const selectionNode = event.api.getRowNode(diff[0]);
77218
- if (selectionNode === void 0) {
77219
- return;
77220
- }
77221
- const rowsToUpdate = getAffectedRows(
77222
- getCurrentRows(event.api),
77223
- selectionNode,
77224
- affectedRows
77225
- );
77226
- Object.values(rowsToUpdate).forEach((row) => {
77227
- row.node.setSelected(
77228
- row.selectedState === rowSelectionState.selected,
77229
- void 0,
77230
- event.source
77231
- );
77232
- });
77233
- rowSelectionRef.current.affectedRows = {
77234
- ...affectedRows,
77235
- ...rowsToUpdate
77236
- };
77237
- gridApi == null ? void 0 : gridApi.redrawRows({
77238
- rowNodes: Object.values(rowsToUpdate).map((val) => val.node)
77239
- });
77240
- };
77241
77280
  const getGroupRowAgg = React82__default.default.useCallback(
77242
77281
  (params) => {
77243
77282
  const agNodes = params.nodes;
@@ -77391,6 +77430,7 @@ var Table = (props) => {
77391
77430
  cacheBlockSize: props.paginationPageSize || defaultPaginationPageSize,
77392
77431
  defaultColDef,
77393
77432
  enableGroupEdit: internalTableContext.enableGroupEditAndValidation,
77433
+ enableCellEditingOnBackspace: true,
77394
77434
  excelStyles: transformToExcelStyles(props.excelDataTypeFormats),
77395
77435
  components: frameworkComponents,
77396
77436
  fullWidthCellRenderer: FullWidthCellRenderer(
@@ -77447,7 +77487,6 @@ var Table = (props) => {
77447
77487
  onRowDragMove,
77448
77488
  onRowGroupOpened: internalRowGroupOpened,
77449
77489
  onRowSelected: internalOnRowSelected,
77450
- onSelectionChanged,
77451
77490
  onSortChanged: onSortEventChanged,
77452
77491
  onFilterChanged,
77453
77492
  onFirstDataRendered: props.onFirstDataRendered,
@@ -77500,13 +77539,19 @@ var TablePagination = ({
77500
77539
  page: 0,
77501
77540
  items: 0
77502
77541
  });
77542
+ const { rowSelectionRef } = useInternalTableContext();
77503
77543
  React82__default.default.useEffect(() => {
77504
77544
  function onPaginationChanged(params) {
77545
+ var _a;
77505
77546
  if (gridApi && params.api.paginationGetCurrentPage() !== pagination.page || pagination.items !== params.api.paginationGetRowCount()) {
77506
77547
  setPagination({
77507
77548
  page: params.api.paginationGetCurrentPage(),
77508
77549
  items: params.api.paginationGetRowCount()
77509
77550
  });
77551
+ if (params.api.getModel().getType() === "serverSide") {
77552
+ ((_a = rowSelectionRef == null ? void 0 : rowSelectionRef.current) == null ? void 0 : _a.affectedRows) && (rowSelectionRef.current.affectedRows = {});
77553
+ gridApi == null ? void 0 : gridApi.deselectAll();
77554
+ }
77510
77555
  }
77511
77556
  }
77512
77557
  gridApi == null ? void 0 : gridApi.addEventListener("paginationChanged", onPaginationChanged);