@stenajs-webui/grid 13.2.0 → 13.3.0

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.
@@ -1,9 +1,12 @@
1
1
  import * as React from "react";
2
+ import { RefObject } from "react";
2
3
  export interface StandardTableRowProps<TItem> {
3
4
  item: TItem;
5
+ itemIdList: Array<string>;
4
6
  rowIndex: number;
5
7
  numRows: number;
6
8
  colIndexOffset: number;
7
9
  alwaysVisible?: boolean;
10
+ shiftPressedRef: RefObject<boolean>;
8
11
  }
9
- export declare const StandardTableRow: React.MemoExoticComponent<(<TItem>({ item, rowIndex, numRows, colIndexOffset, alwaysVisible, }: StandardTableRowProps<TItem>) => JSX.Element)>;
12
+ export declare const StandardTableRow: React.MemoExoticComponent<(<TItem>({ item, itemIdList, rowIndex, numRows, colIndexOffset, alwaysVisible, shiftPressedRef, }: StandardTableRowProps<TItem>) => JSX.Element)>;
@@ -2,7 +2,6 @@ import { Dispatch } from "react";
2
2
  import { StandardTableConfig } from "../config/StandardTableConfig";
3
3
  import { StandardTableState } from "../redux/StandardTableReducer";
4
4
  import { StandardTableAction, StandardTableActions } from "../util/ActionsFactory";
5
- import { InternalStandardTableAction } from "../redux/StandardTableActionsAndSelectors";
6
5
  export interface StandardTableInternalActionsContext<TColumnKey extends string> {
7
6
  dispatch: Dispatch<StandardTableAction<TColumnKey>>;
8
7
  actions: StandardTableActions<TColumnKey>;
@@ -12,7 +11,7 @@ export interface StandardTableInternalActionsContext<TColumnKey extends string>
12
11
  * connect the table to a state.
13
12
  */
14
13
  export interface TableContext<TColumnKey extends string> {
15
- dispatch: Dispatch<InternalStandardTableAction<TColumnKey>>;
14
+ dispatch: Dispatch<StandardTableAction<TColumnKey>>;
16
15
  state: StandardTableState<TColumnKey>;
17
16
  actions: StandardTableActions<TColumnKey>;
18
17
  }
@@ -1,10 +1,13 @@
1
1
  import { CheckboxProps } from "@stenajs-webui/forms";
2
2
  import * as React from "react";
3
+ import { RefObject } from "react";
3
4
  interface Props extends Pick<CheckboxProps, "value" | "onValueChange"> {
4
5
  colIndex: number;
5
6
  rowIndex: number;
6
7
  numRows: number;
7
8
  disabled?: boolean;
9
+ onValueChangeAndShift: CheckboxProps["onValueChange"];
10
+ shiftPressedRef: RefObject<boolean>;
8
11
  }
9
12
  export declare const StandardTableRowCheckbox: React.FC<Props>;
10
13
  export {};
@@ -1,4 +1,5 @@
1
- export declare const useRowCheckbox: <TItem>(item: TItem) => {
1
+ export declare const useRowCheckbox: <TItem>(item: TItem, itemIdList: Array<string>) => {
2
2
  isSelected: boolean;
3
3
  toggleSelected: () => void;
4
+ shiftAndToggleSelected: () => void;
4
5
  };
@@ -1,3 +1,3 @@
1
- declare type ReducerIdSuffix = "selectedIds" | "expandedRows" | "sortOrder";
1
+ declare type ReducerIdSuffix = "selectedIds" | "expandedRows" | "sortOrder" | "fields";
2
2
  export declare const getReducerIdFor: (reducerId: string, reducerIdSuffix: ReducerIdSuffix) => string;
3
3
  export {};
@@ -1,19 +1,19 @@
1
- import { ReducerIdGateAction, SelectedIdsAction, SelectedIdsActions, SelectedIdsSelectors, SortOrderAction, SortOrderActions, SortOrderSelectors } from "@stenajs-webui/redux";
2
- import { StandardTableState } from "./StandardTableReducer";
1
+ import { EntityActions, EntitySelectors, SelectedIdsActions, SelectedIdsSelectors, SortOrderActions, SortOrderSelectors } from "@stenajs-webui/redux";
2
+ import { StandardTableStateFields } from "./StandardTableReducer";
3
3
  export interface InternalStandardTableActions<TColumnKey extends string> {
4
4
  sortOrder: SortOrderActions<TColumnKey>;
5
5
  selectedIds: SelectedIdsActions;
6
6
  expandedRows: SelectedIdsActions;
7
+ fields: EntityActions<StandardTableStateFields>;
7
8
  }
8
9
  export interface StandardTableSelectors<TStoreState, TColumnKey extends string> {
9
10
  sortOrder: SortOrderSelectors<TStoreState, TColumnKey>;
10
11
  selectedIds: SelectedIdsSelectors<TStoreState>;
11
12
  expandedRows: SelectedIdsSelectors<TStoreState>;
13
+ fields: EntitySelectors<TStoreState, StandardTableStateFields>;
12
14
  }
13
15
  export interface StandardTableActionsAndSelectors<TStoreState, TColumnKey extends string> {
14
16
  actions: InternalStandardTableActions<TColumnKey>;
15
17
  selectors: StandardTableSelectors<TStoreState, TColumnKey>;
16
18
  }
17
- export declare type InternalStandardTableAction<TColumnKey extends string> = ReducerIdGateAction<SortOrderAction<TColumnKey>> | ReducerIdGateAction<SelectedIdsAction>;
18
- export declare type StandardTableStateSelector<TStoreState, TColumnKey extends string> = (state: TStoreState) => StandardTableState<TColumnKey>;
19
19
  export declare const createInternalStandardTableActions: <TColumnKey extends string>() => InternalStandardTableActions<TColumnKey>;
@@ -1,11 +1,15 @@
1
- import { SelectedIdsState, SortOrderState } from "@stenajs-webui/redux";
2
- import { InternalStandardTableAction } from "./StandardTableActionsAndSelectors";
1
+ import { EntityState, SelectedIdsState, SortOrderState } from "@stenajs-webui/redux";
3
2
  import { Reducer } from "redux";
3
+ import { StandardTableAction } from "../util/ActionsFactory";
4
4
  export interface StandardTableState<TColumnKey extends string> {
5
5
  sortOrder: SortOrderState<TColumnKey>;
6
6
  selectedIds: SelectedIdsState;
7
7
  expandedRows: SelectedIdsState;
8
+ fields: EntityState<StandardTableStateFields>;
9
+ }
10
+ export interface StandardTableStateFields {
11
+ lastSelectedId?: string;
8
12
  }
9
13
  export declare const createStandardTableInitialState: <TColumnKey extends string>(sortBy?: TColumnKey | undefined, desc?: boolean, selectedIds?: string[], expandedRows?: string[]) => StandardTableState<TColumnKey>;
10
- export declare type StandardTableReducer<TColumnKey extends string> = Reducer<StandardTableState<TColumnKey>, InternalStandardTableAction<TColumnKey>>;
11
- export declare const createStandardTableReducer: <TColumnKey extends string>(reducerId: string) => Reducer<StandardTableState<TColumnKey>, InternalStandardTableAction<TColumnKey>>;
14
+ export declare type StandardTableReducer<TColumnKey extends string> = Reducer<StandardTableState<TColumnKey>, StandardTableAction<TColumnKey>>;
15
+ export declare const createStandardTableReducer: <TColumnKey extends string>(reducerId: string) => Reducer<StandardTableState<TColumnKey>, StandardTableAction<TColumnKey>>;
@@ -1,12 +1,14 @@
1
1
  import { InternalStandardTableActions } from "../redux/StandardTableActionsAndSelectors";
2
- import { ReducerIdGateAction, SelectedIdsAction, SortOrderAction } from "@stenajs-webui/redux";
3
- export declare type StandardTableAction<TColumnKey> = ReducerIdGateAction<SelectedIdsAction> | ReducerIdGateAction<SortOrderAction<TColumnKey>>;
4
- export interface StandardTableActions<TColumnKey> {
5
- selectByIds: (ids: Array<string>) => StandardTableAction<TColumnKey>;
2
+ import { EntityAction, ReducerIdGateAction, SelectedIdsAction, SortOrderAction } from "@stenajs-webui/redux";
3
+ import { StandardTableStateFields } from "../redux/StandardTableReducer";
4
+ export declare type StandardTableAction<TColumnKey extends string> = ReducerIdGateAction<SortOrderAction<TColumnKey>> | ReducerIdGateAction<SelectedIdsAction> | ReducerIdGateAction<EntityAction<StandardTableStateFields>>;
5
+ export interface StandardTableActions<TColumnKey extends string> {
6
+ setSelectedIds: (ids: Array<string>) => StandardTableAction<TColumnKey>;
6
7
  clearSelection: () => StandardTableAction<TColumnKey>;
7
8
  expandByIds: (ids: Array<string>) => StandardTableAction<TColumnKey>;
8
9
  collapseAll: () => StandardTableAction<TColumnKey>;
9
10
  sortBy: (columnId: TColumnKey, desc?: boolean) => StandardTableAction<TColumnKey>;
10
11
  clearSortOrder: () => StandardTableAction<TColumnKey>;
12
+ setLastSelectedId: (lastSelectedId: string) => StandardTableAction<TColumnKey>;
11
13
  }
12
14
  export declare const createStandardTableActions: <TColumnKey extends string>(tableId: string, actions: InternalStandardTableActions<TColumnKey>) => StandardTableActions<TColumnKey>;
@@ -0,0 +1 @@
1
+ export declare const getIdsBetweenSelected: (idList: Array<string> | undefined, selected1: string | undefined, selected2: string | undefined) => Array<string> | undefined;
package/dist/index.es.js CHANGED
@@ -16,7 +16,7 @@ import cx from 'classnames';
16
16
  import { faArrowRight } from '@fortawesome/free-solid-svg-icons/faArrowRight';
17
17
  import { TextInput, Checkbox } from '@stenajs-webui/forms';
18
18
  import { useDispatch, useSelector } from 'react-redux';
19
- import { createSortOrderActions, createSelectedIdsActions, createSortOrderReducerInitialState, createSelectedIdsReducerInitialState, reducerIdGate, createSortOrderReducer, createSelectedIdsReducer, reducerIdGateAction } from '@stenajs-webui/redux';
19
+ import { createSortOrderActions, createSelectedIdsActions, createEntityActions, createSortOrderReducerInitialState, createSelectedIdsReducerInitialState, reducerIdGate, createSortOrderReducer, createSelectedIdsReducer, createEntityReducer, reducerIdGateAction } from '@stenajs-webui/redux';
20
20
  import { combineReducers } from 'redux';
21
21
  import { ErrorScreen, LoadingScreen } from '@stenajs-webui/panels';
22
22
  import { compact, upperFirst, lowerCase } from 'lodash';
@@ -734,6 +734,7 @@ var createInternalStandardTableActions = function () { return ({
734
734
  sortOrder: createSortOrderActions(),
735
735
  selectedIds: createSelectedIdsActions(),
736
736
  expandedRows: createSelectedIdsActions(),
737
+ fields: createEntityActions(),
737
738
  }); };
738
739
 
739
740
  var getReducerIdFor = function (reducerId, reducerIdSuffix) { return reducerId + "." + reducerIdSuffix; };
@@ -747,16 +748,19 @@ var createStandardTableInitialState = function (sortBy, desc, selectedIds, expan
747
748
  sortOrder: createSortOrderReducerInitialState(sortBy, desc),
748
749
  selectedIds: createSelectedIdsReducerInitialState(selectedIds),
749
750
  expandedRows: createSelectedIdsReducerInitialState(expandedRows),
751
+ fields: { lastSelectedId: undefined },
750
752
  });
751
753
  };
752
754
  var createStandardTableReducer = function (reducerId) {
753
755
  var sortOrder = reducerIdGate(getReducerIdFor(reducerId, "sortOrder"), createSortOrderReducer());
754
756
  var selectedIds = reducerIdGate(getReducerIdFor(reducerId, "selectedIds"), createSelectedIdsReducer());
755
757
  var expandedRows = reducerIdGate(getReducerIdFor(reducerId, "expandedRows"), createSelectedIdsReducer());
758
+ var fields = reducerIdGate(getReducerIdFor(reducerId, "fields"), createEntityReducer({}));
756
759
  return combineReducers({
757
760
  sortOrder: sortOrder,
758
761
  selectedIds: selectedIds,
759
762
  expandedRows: expandedRows,
763
+ fields: fields,
760
764
  });
761
765
  };
762
766
 
@@ -1203,7 +1207,7 @@ var getStickyPropsPerColumnWithGroups = function (config) {
1203
1207
 
1204
1208
  var createStandardTableActions = function (tableId, actions) {
1205
1209
  return {
1206
- selectByIds: function (ids) {
1210
+ setSelectedIds: function (ids) {
1207
1211
  return reducerIdGateAction(getReducerIdFor(tableId, "selectedIds"), actions.selectedIds.setSelectedIds(ids));
1208
1212
  },
1209
1213
  clearSelection: function () {
@@ -1221,6 +1225,9 @@ var createStandardTableActions = function (tableId, actions) {
1221
1225
  clearSortOrder: function () {
1222
1226
  return reducerIdGateAction(getReducerIdFor(tableId, "sortOrder"), actions.sortOrder.clearSortOrder());
1223
1227
  },
1228
+ setLastSelectedId: function (lastSelectedId) {
1229
+ return reducerIdGateAction(getReducerIdFor(tableId, "fields"), actions.fields.setEntityFields({ lastSelectedId: lastSelectedId }));
1230
+ },
1224
1231
  };
1225
1232
  };
1226
1233
 
@@ -1297,7 +1304,7 @@ var useColumnValueResolver = function (columnId) {
1297
1304
  };
1298
1305
 
1299
1306
  var StandardTableRowCheckbox = memo(function StandardTableRowCheckbox(_a) {
1300
- var value = _a.value, onValueChange = _a.onValueChange, colIndex = _a.colIndex, rowIndex = _a.rowIndex, numRows = _a.numRows, disabled = _a.disabled;
1307
+ var value = _a.value, onValueChange = _a.onValueChange, colIndex = _a.colIndex, rowIndex = _a.rowIndex, numRows = _a.numRows, disabled = _a.disabled, onValueChangeAndShift = _a.onValueChangeAndShift, shiftPressedRef = _a.shiftPressedRef;
1301
1308
  var totalNumColumns = useTotalNumColumnsForRows();
1302
1309
  var tableId = useStandardTableId();
1303
1310
  var gridCell = useGridCell(Boolean(value), {
@@ -1308,27 +1315,82 @@ var StandardTableRowCheckbox = memo(function StandardTableRowCheckbox(_a) {
1308
1315
  tableId: tableId,
1309
1316
  });
1310
1317
  var requiredProps = gridCell.requiredProps;
1311
- return (createElement(Checkbox, __assign({ size: "small", disabled: disabled, value: value, onValueChange: onValueChange }, requiredProps)));
1318
+ var internalOnValueChange = useCallback(function (value) {
1319
+ if (shiftPressedRef.current) {
1320
+ onValueChangeAndShift === null || onValueChangeAndShift === void 0 ? void 0 : onValueChangeAndShift(value);
1321
+ }
1322
+ else {
1323
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(value);
1324
+ }
1325
+ }, [onValueChange, onValueChangeAndShift, shiftPressedRef]);
1326
+ return (createElement(Checkbox, __assign({ size: "small", disabled: disabled, value: value, onValueChange: internalOnValueChange }, requiredProps)));
1312
1327
  });
1313
1328
 
1314
- var useRowCheckbox = function (item) {
1329
+ var getIdsBetweenSelected = function (idList, selected1, selected2) {
1330
+ if (selected1 == null || selected2 == null || idList == null) {
1331
+ return undefined;
1332
+ }
1333
+ if (selected1 === selected2) {
1334
+ return undefined;
1335
+ }
1336
+ var i1 = idList.indexOf(selected1);
1337
+ var i2 = idList.indexOf(selected2);
1338
+ if (i1 < 0 || i2 < 0) {
1339
+ return undefined;
1340
+ }
1341
+ var start = Math.min(i1, i2);
1342
+ var end = Math.max(i1, i2);
1343
+ return idList.slice(start, end + 1);
1344
+ };
1345
+
1346
+ var useRowCheckbox = function (item, itemIdList) {
1315
1347
  var keyResolver = useStandardTableConfig().keyResolver;
1316
- var selectedIds = useStandardTableState().selectedIds.selectedIds;
1317
- var _a = useStandardTableActions(), selectByIds = _a.actions.selectByIds, dispatch = _a.dispatch;
1348
+ var _a = useStandardTableState(), selectedIds = _a.selectedIds.selectedIds, lastSelectedId = _a.fields.lastSelectedId;
1349
+ var _b = useStandardTableActions(), _c = _b.actions, setSelectedIds = _c.setSelectedIds, setLastSelectedId = _c.setLastSelectedId, dispatch = _b.dispatch;
1318
1350
  var itemKey = useMemo(function () { return keyResolver(item); }, [keyResolver, item]);
1319
1351
  var isSelected = useMemo(function () { return selectedIds.includes(itemKey); }, [
1320
1352
  selectedIds,
1321
1353
  itemKey,
1322
1354
  ]);
1323
- var toggle = useArraySet(selectedIds, function (ids) {
1324
- return dispatch(selectByIds(ids));
1325
- }).toggle;
1355
+ var _d = useArraySet(selectedIds, function (ids) { return dispatch(setSelectedIds(ids)); }), toggle = _d.toggle, addMultiple = _d.addMultiple, removeMultiple = _d.removeMultiple;
1356
+ var shiftAndToggleSelected = useCallback(function () {
1357
+ if (itemIdList && lastSelectedId) {
1358
+ var idList = getIdsBetweenSelected(itemIdList, lastSelectedId, itemKey);
1359
+ if (idList === null || idList === void 0 ? void 0 : idList.length) {
1360
+ if (isSelected) {
1361
+ removeMultiple(idList);
1362
+ }
1363
+ else {
1364
+ addMultiple(idList);
1365
+ }
1366
+ }
1367
+ else {
1368
+ toggle(itemKey);
1369
+ }
1370
+ }
1371
+ else {
1372
+ toggle(itemKey);
1373
+ }
1374
+ dispatch(setLastSelectedId(itemKey));
1375
+ }, [
1376
+ itemIdList,
1377
+ lastSelectedId,
1378
+ dispatch,
1379
+ setLastSelectedId,
1380
+ itemKey,
1381
+ isSelected,
1382
+ removeMultiple,
1383
+ addMultiple,
1384
+ toggle,
1385
+ ]);
1326
1386
  var toggleSelected = useCallback(function () {
1327
1387
  toggle(itemKey);
1328
- }, [toggle, itemKey]);
1388
+ dispatch(setLastSelectedId(itemKey));
1389
+ }, [toggle, itemKey, dispatch, setLastSelectedId]);
1329
1390
  return {
1330
1391
  isSelected: isSelected,
1331
1392
  toggleSelected: toggleSelected,
1393
+ shiftAndToggleSelected: shiftAndToggleSelected,
1332
1394
  };
1333
1395
  };
1334
1396
 
@@ -1560,7 +1622,7 @@ var TrWithHoverBackground = styled.tr(templateObject_1 || (templateObject_1 = __
1560
1622
  var templateObject_1;
1561
1623
 
1562
1624
  var StandardTableRow = memo(function StandardTableRow(_a) {
1563
- var item = _a.item, rowIndex = _a.rowIndex, numRows = _a.numRows, colIndexOffset = _a.colIndexOffset, alwaysVisible = _a.alwaysVisible;
1625
+ var item = _a.item, itemIdList = _a.itemIdList, rowIndex = _a.rowIndex, numRows = _a.numRows, colIndexOffset = _a.colIndexOffset, alwaysVisible = _a.alwaysVisible, shiftPressedRef = _a.shiftPressedRef;
1564
1626
  var trRef = useRef(null);
1565
1627
  var totalNumColumns = useTotalNumColumns();
1566
1628
  var stickyCheckboxColumn = useStandardTableConfig().stickyCheckboxColumn;
@@ -1568,7 +1630,7 @@ var StandardTableRow = memo(function StandardTableRow(_a) {
1568
1630
  var columnIndexPerColumnId = useColumnIndexPerColumnIdContext().columnIndexPerColumnId;
1569
1631
  var _b = useStandardTableConfig(), showRowCheckbox = _b.showRowCheckbox, rowBackgroundResolver = _b.rowBackgroundResolver, checkboxDisabledResolver = _b.checkboxDisabledResolver, enableGridCell = _b.enableGridCell, rowIndent = _b.rowIndent, enableExpandCollapse = _b.enableExpandCollapse;
1570
1632
  var isExpanded = useExpandCollapseActions(item).isExpanded;
1571
- var _c = useRowCheckbox(item), isSelected = _c.isSelected, toggleSelected = _c.toggleSelected;
1633
+ var _c = useRowCheckbox(item, itemIdList), isSelected = _c.isSelected, toggleSelected = _c.toggleSelected, shiftAndToggleSelected = _c.shiftAndToggleSelected;
1572
1634
  var visible = useOnScreen(trRef, {
1573
1635
  rootMargin: "400px 0px 400px 0px",
1574
1636
  threshold: 0,
@@ -1621,7 +1683,7 @@ var StandardTableRow = memo(function StandardTableRow(_a) {
1621
1683
  : undefined,
1622
1684
  } },
1623
1685
  createElement(Row, { width: "var(--swui-checkbox-cell-width)", minWidth: "var(--swui-checkbox-cell-width)", alignItems: "center", justifyContent: "center" },
1624
- createElement(StandardTableRowCheckbox, { disabled: disabled, value: isSelected, onValueChange: toggleSelected, colIndex: colIndexOffset + (enableExpandCollapse ? 1 : 0), rowIndex: rowIndex, numRows: numRows })))),
1686
+ createElement(StandardTableRowCheckbox, { disabled: disabled, value: isSelected, onValueChange: toggleSelected, onValueChangeAndShift: shiftAndToggleSelected, colIndex: colIndexOffset + (enableExpandCollapse ? 1 : 0), rowIndex: rowIndex, numRows: numRows, shiftPressedRef: shiftPressedRef })))),
1625
1687
  groupConfigsAndIds.map(function (_a, groupIndex) {
1626
1688
  var groupConfig = _a.groupConfig, groupId = _a.groupId;
1627
1689
  return (createElement(Fragment, { key: groupId }, groupConfig.columnOrder.map(function (columnId, index) { return (createElement(StandardTableCell, { key: columnId, columnId: columnId, item: item, colIndex: colIndexOffset + columnIndexPerColumnId[columnId], rowIndex: rowIndex, numRows: numRows, borderFromGroup: getCellBorderFromGroup(groupIndex, index, groupConfig.borderLeft), disableBorderLeft: groupIndex === 0 && index === 0 })); })));
@@ -1644,6 +1706,8 @@ var StandardTableRow = memo(function StandardTableRow(_a) {
1644
1706
  numRows,
1645
1707
  rowIndent,
1646
1708
  rowIndex,
1709
+ shiftAndToggleSelected,
1710
+ shiftPressedRef,
1647
1711
  showRowCheckbox,
1648
1712
  stickyCheckboxColumn,
1649
1713
  toggleSelected,
@@ -1698,6 +1762,7 @@ var StandardTableRowList = memo(function StandardTableRowList(_a) {
1698
1762
  * rows after sorting.
1699
1763
  */
1700
1764
  var sortCounterRef = useRef(0);
1765
+ var shiftPressedRef = useRef(false);
1701
1766
  var _d = useStandardTableConfig(), keyResolver = _d.keyResolver, disableInfiniteList = _d.disableInfiniteList;
1702
1767
  var _e = useStandardTableState().sortOrder, sortBy = _e.sortBy, desc = _e.desc;
1703
1768
  var valueResolver = useColumnValueResolver(sortBy);
@@ -1718,7 +1783,29 @@ var StandardTableRowList = memo(function StandardTableRowList(_a) {
1718
1783
  sortCounterRef.current++;
1719
1784
  return sortedList;
1720
1785
  }, [items, valueResolver, desc]);
1721
- return (createElement(Fragment, { key: sortCounterRef.current }, sortedItems.map(function (item, index) { return (createElement(StandardTableRow, { alwaysVisible: disableInfiniteList || sortedItems.length < 30, item: item, key: keyResolver(item), colIndexOffset: colIndexOffset, rowIndex: index + rowIndexOffset, numRows: sortedItems.length })); })));
1786
+ var itemIdList = useMemo(function () { return sortedItems.map(function (l) { return keyResolver(l); }); }, [
1787
+ sortedItems,
1788
+ keyResolver,
1789
+ ]);
1790
+ useEffect(function () {
1791
+ var keyUp = function (ev) {
1792
+ if (ev.key === "Shift") {
1793
+ shiftPressedRef.current = false;
1794
+ }
1795
+ };
1796
+ var keyDown = function (ev) {
1797
+ if (ev.key === "Shift") {
1798
+ shiftPressedRef.current = true;
1799
+ }
1800
+ };
1801
+ document.addEventListener("keyup", keyUp);
1802
+ document.addEventListener("keydown", keyDown);
1803
+ return function () {
1804
+ document.removeEventListener("keyup", keyUp);
1805
+ document.removeEventListener("keydown", keyDown);
1806
+ };
1807
+ }, []);
1808
+ return (createElement(Fragment, { key: sortCounterRef.current }, sortedItems.map(function (item, index) { return (createElement(StandardTableRow, { alwaysVisible: disableInfiniteList || sortedItems.length < 30, item: item, itemIdList: itemIdList, key: itemIdList[index], colIndexOffset: colIndexOffset, rowIndex: index + rowIndexOffset, numRows: sortedItems.length, shiftPressedRef: shiftPressedRef })); })));
1722
1809
  });
1723
1810
 
1724
1811
  var StandardTableContent = memo(function StandardTableContent(_a) {
@@ -1752,7 +1839,7 @@ var StandardTableContent = memo(function StandardTableContent(_a) {
1752
1839
  var useTableHeadCheckbox = function (items) {
1753
1840
  var keyResolver = useStandardTableConfig().keyResolver;
1754
1841
  var selectedIds = useStandardTableState().selectedIds.selectedIds;
1755
- var _a = useStandardTableActions(), _b = _a.actions, selectByIds = _b.selectByIds, clearSelection = _b.clearSelection, dispatch = _a.dispatch;
1842
+ var _a = useStandardTableActions(), _b = _a.actions, setSelectedIds = _b.setSelectedIds, clearSelection = _b.clearSelection, dispatch = _a.dispatch;
1756
1843
  var selectionIsEmpty = selectedIds.length === 0;
1757
1844
  var allItemsAreSelected = !items
1758
1845
  ? false
@@ -1760,7 +1847,7 @@ var useTableHeadCheckbox = function (items) {
1760
1847
  var onClickCheckbox = useCallback(function () {
1761
1848
  if (items) {
1762
1849
  if (selectionIsEmpty) {
1763
- dispatch(selectByIds(items.map(function (item) { return keyResolver(item); })));
1850
+ dispatch(setSelectedIds(items.map(function (item) { return keyResolver(item); })));
1764
1851
  }
1765
1852
  else {
1766
1853
  dispatch(clearSelection());
@@ -1772,7 +1859,7 @@ var useTableHeadCheckbox = function (items) {
1772
1859
  dispatch,
1773
1860
  items,
1774
1861
  keyResolver,
1775
- selectByIds,
1862
+ setSelectedIds,
1776
1863
  ]);
1777
1864
  return {
1778
1865
  selectionIsEmpty: selectionIsEmpty,
@@ -1965,12 +2052,10 @@ var StandardTable = function StandardTable(_a) {
1965
2052
  var localTableContext = useLocalStateTableContext(tableId !== null && tableId !== void 0 ? tableId : generatedTableId, createStandardTableInitialState(initialSortOrder, initialSortOrderDesc)).tableContext;
1966
2053
  var currentTableContext = tableContext || localTableContext;
1967
2054
  var state = currentTableContext.state, actions = currentTableContext.actions, dispatch = currentTableContext.dispatch;
1968
- var actionsContext = useMemo(function () {
1969
- return {
1970
- actions: actions,
1971
- dispatch: dispatch,
1972
- };
1973
- }, [actions, dispatch]);
2055
+ var actionsContext = useMemo(function () { return ({
2056
+ actions: actions,
2057
+ dispatch: dispatch,
2058
+ }); }, [actions, dispatch]);
1974
2059
  var usingColumnGroups = Boolean(columnGroupOrder !== null && columnGroupOrder !== void 0 ? columnGroupOrder : "columnGroupOrder" in config);
1975
2060
  var columnGroupsFromConfig = "columnGroups" in config ? config.columnGroups : undefined;
1976
2061
  var columnGroupOrderFromConfig = "columnGroupOrder" in config ? config.columnGroupOrder : undefined;