@itwin/itwinui-react 1.34.1 → 1.36.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.
Files changed (136) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/core/ButtonGroup/ButtonGroup.js +1 -0
  3. package/cjs/core/Carousel/Carousel.d.ts +68 -0
  4. package/cjs/core/Carousel/Carousel.js +130 -0
  5. package/cjs/core/Carousel/CarouselContext.d.ts +37 -0
  6. package/cjs/core/Carousel/CarouselContext.js +12 -0
  7. package/cjs/core/Carousel/CarouselDot.d.ts +13 -0
  8. package/cjs/core/Carousel/CarouselDot.js +46 -0
  9. package/cjs/core/Carousel/CarouselDotsList.d.ts +32 -0
  10. package/cjs/core/Carousel/CarouselDotsList.js +132 -0
  11. package/cjs/core/Carousel/CarouselNavigation.d.ts +15 -0
  12. package/cjs/core/Carousel/CarouselNavigation.js +88 -0
  13. package/cjs/core/Carousel/CarouselSlide.d.ts +14 -0
  14. package/cjs/core/Carousel/CarouselSlide.js +63 -0
  15. package/cjs/core/Carousel/CarouselSlider.d.ts +5 -0
  16. package/cjs/core/Carousel/CarouselSlider.js +94 -0
  17. package/cjs/core/Carousel/index.d.ts +4 -0
  18. package/cjs/core/Carousel/index.js +10 -0
  19. package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
  20. package/cjs/core/DatePicker/DatePicker.d.ts +5 -0
  21. package/cjs/core/DatePicker/DatePicker.js +38 -13
  22. package/cjs/core/Menu/Menu.js +8 -3
  23. package/cjs/core/Modal/Modal.d.ts +5 -0
  24. package/cjs/core/Modal/Modal.js +11 -9
  25. package/cjs/core/Modal/ModalContent.d.ts +14 -0
  26. package/cjs/core/Modal/ModalContent.js +46 -0
  27. package/cjs/core/Modal/index.d.ts +2 -0
  28. package/cjs/core/Modal/index.js +3 -1
  29. package/cjs/core/Table/Table.d.ts +1 -0
  30. package/cjs/core/Table/Table.js +34 -20
  31. package/cjs/core/Table/TableCell.js +3 -3
  32. package/cjs/core/Table/TableRowMemoized.js +12 -7
  33. package/cjs/core/Table/actionHandlers/index.d.ts +2 -1
  34. package/cjs/core/Table/actionHandlers/index.js +5 -1
  35. package/cjs/core/Table/cells/DefaultCell.d.ts +1 -1
  36. package/cjs/core/Table/cells/DefaultCell.js +5 -2
  37. package/cjs/core/Table/columns/actionColumn.d.ts +35 -0
  38. package/cjs/core/Table/columns/actionColumn.js +91 -0
  39. package/cjs/core/Table/columns/expanderColumn.d.ts +47 -0
  40. package/cjs/core/Table/columns/expanderColumn.js +81 -0
  41. package/cjs/core/Table/columns/index.d.ts +3 -0
  42. package/cjs/core/Table/columns/index.js +15 -0
  43. package/cjs/core/Table/columns/selectionColumn.d.ts +35 -0
  44. package/cjs/core/Table/columns/selectionColumn.js +67 -0
  45. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +18 -2
  46. package/cjs/core/Table/hooks/index.d.ts +2 -2
  47. package/cjs/core/Table/hooks/index.js +1 -3
  48. package/cjs/core/Table/hooks/useExpanderCell.d.ts +0 -1
  49. package/cjs/core/Table/hooks/useExpanderCell.js +25 -39
  50. package/cjs/core/Table/hooks/useResizeColumns.js +8 -2
  51. package/cjs/core/Table/hooks/useSelectionCell.d.ts +0 -1
  52. package/cjs/core/Table/hooks/useSelectionCell.js +6 -52
  53. package/cjs/core/Table/index.d.ts +1 -0
  54. package/cjs/core/Table/index.js +5 -1
  55. package/cjs/core/Table/utils.js +1 -1
  56. package/cjs/core/Toast/Toast.js +1 -1
  57. package/cjs/core/Typography/Anchor/Anchor.d.ts +1 -0
  58. package/cjs/core/Typography/Anchor/Anchor.js +1 -0
  59. package/cjs/core/index.d.ts +5 -3
  60. package/cjs/core/index.js +9 -2
  61. package/cjs/core/utils/components/Popover.js +13 -1
  62. package/cjs/core/utils/hooks/index.d.ts +1 -0
  63. package/cjs/core/utils/hooks/index.js +1 -0
  64. package/cjs/core/utils/hooks/useMediaQuery.d.ts +2 -0
  65. package/cjs/core/utils/hooks/useMediaQuery.js +46 -0
  66. package/cjs/core/utils/hooks/useTheme.d.ts +5 -0
  67. package/cjs/core/utils/hooks/useTheme.js +20 -14
  68. package/cjs/types/react-table-config.d.ts +18 -0
  69. package/esm/core/ButtonGroup/ButtonGroup.js +1 -0
  70. package/esm/core/Carousel/Carousel.d.ts +68 -0
  71. package/esm/core/Carousel/Carousel.js +124 -0
  72. package/esm/core/Carousel/CarouselContext.d.ts +37 -0
  73. package/esm/core/Carousel/CarouselContext.js +6 -0
  74. package/esm/core/Carousel/CarouselDot.d.ts +13 -0
  75. package/esm/core/Carousel/CarouselDot.js +40 -0
  76. package/esm/core/Carousel/CarouselDotsList.d.ts +32 -0
  77. package/esm/core/Carousel/CarouselDotsList.js +126 -0
  78. package/esm/core/Carousel/CarouselNavigation.d.ts +15 -0
  79. package/esm/core/Carousel/CarouselNavigation.js +82 -0
  80. package/esm/core/Carousel/CarouselSlide.d.ts +14 -0
  81. package/esm/core/Carousel/CarouselSlide.js +57 -0
  82. package/esm/core/Carousel/CarouselSlider.d.ts +5 -0
  83. package/esm/core/Carousel/CarouselSlider.js +88 -0
  84. package/esm/core/Carousel/index.d.ts +4 -0
  85. package/esm/core/Carousel/index.js +6 -0
  86. package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
  87. package/esm/core/DatePicker/DatePicker.d.ts +5 -0
  88. package/esm/core/DatePicker/DatePicker.js +38 -13
  89. package/esm/core/Menu/Menu.js +8 -3
  90. package/esm/core/Modal/Modal.d.ts +5 -0
  91. package/esm/core/Modal/Modal.js +11 -9
  92. package/esm/core/Modal/ModalContent.d.ts +14 -0
  93. package/esm/core/Modal/ModalContent.js +39 -0
  94. package/esm/core/Modal/index.d.ts +2 -0
  95. package/esm/core/Modal/index.js +1 -0
  96. package/esm/core/Table/Table.d.ts +1 -0
  97. package/esm/core/Table/Table.js +30 -16
  98. package/esm/core/Table/TableCell.js +2 -2
  99. package/esm/core/Table/TableRowMemoized.js +12 -7
  100. package/esm/core/Table/actionHandlers/index.d.ts +2 -1
  101. package/esm/core/Table/actionHandlers/index.js +2 -1
  102. package/esm/core/Table/cells/DefaultCell.d.ts +1 -1
  103. package/esm/core/Table/cells/DefaultCell.js +5 -2
  104. package/esm/core/Table/columns/actionColumn.d.ts +35 -0
  105. package/esm/core/Table/columns/actionColumn.js +84 -0
  106. package/esm/core/Table/columns/expanderColumn.d.ts +47 -0
  107. package/esm/core/Table/columns/expanderColumn.js +74 -0
  108. package/esm/core/Table/columns/index.d.ts +3 -0
  109. package/esm/core/Table/columns/index.js +7 -0
  110. package/esm/core/Table/columns/selectionColumn.d.ts +35 -0
  111. package/esm/core/Table/columns/selectionColumn.js +60 -0
  112. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +18 -2
  113. package/esm/core/Table/hooks/index.d.ts +2 -2
  114. package/esm/core/Table/hooks/index.js +2 -2
  115. package/esm/core/Table/hooks/useExpanderCell.d.ts +0 -1
  116. package/esm/core/Table/hooks/useExpanderCell.js +24 -35
  117. package/esm/core/Table/hooks/useResizeColumns.js +8 -2
  118. package/esm/core/Table/hooks/useSelectionCell.d.ts +0 -1
  119. package/esm/core/Table/hooks/useSelectionCell.js +5 -48
  120. package/esm/core/Table/index.d.ts +1 -0
  121. package/esm/core/Table/index.js +1 -0
  122. package/esm/core/Table/utils.js +1 -1
  123. package/esm/core/Toast/Toast.js +1 -1
  124. package/esm/core/Typography/Anchor/Anchor.d.ts +1 -0
  125. package/esm/core/Typography/Anchor/Anchor.js +1 -0
  126. package/esm/core/index.d.ts +5 -3
  127. package/esm/core/index.js +3 -2
  128. package/esm/core/utils/components/Popover.js +13 -1
  129. package/esm/core/utils/hooks/index.d.ts +1 -0
  130. package/esm/core/utils/hooks/index.js +1 -0
  131. package/esm/core/utils/hooks/useMediaQuery.d.ts +2 -0
  132. package/esm/core/utils/hooks/useMediaQuery.js +39 -0
  133. package/esm/core/utils/hooks/useTheme.d.ts +5 -0
  134. package/esm/core/utils/hooks/useTheme.js +20 -14
  135. package/esm/types/react-table-config.d.ts +18 -0
  136. package/package.json +3 -2
@@ -37,12 +37,11 @@ import { TableRowMemoized } from './TableRowMemoized';
37
37
  import { FilterToggle } from './filters';
38
38
  import { customFilterFunctions } from './filters/customFilterFunctions';
39
39
  import { useExpanderCell, useSelectionCell, useSubRowFiltering, useSubRowSelection, useResizeColumns, useColumnDragAndDrop, } from './hooks';
40
- import { onExpandHandler, onFilterHandler, onSelectHandler, } from './actionHandlers';
41
- import { onSingleSelectHandler } from './actionHandlers/selectHandler';
42
- import { onTableResizeEnd, onTableResizeStart, } from './actionHandlers/resizeHandler';
40
+ import { onExpandHandler, onFilterHandler, onSelectHandler, onSingleSelectHandler, onTableResizeEnd, onTableResizeStart, } from './actionHandlers';
43
41
  import VirtualScroll from '../utils/components/VirtualScroll';
42
+ import { SELECTION_CELL_ID } from './columns';
44
43
  var singleRowSelectedAction = 'singleRowSelected';
45
- var tableResizeStartAction = 'tableResizeStart';
44
+ export var tableResizeStartAction = 'tableResizeStart';
46
45
  var tableResizeEndAction = 'tableResizeEnd';
47
46
  /**
48
47
  * Table based on [react-table](https://react-table.tanstack.com/docs/api/overview).
@@ -88,9 +87,10 @@ var tableResizeEndAction = 'tableResizeEnd';
88
87
  */
89
88
  export var Table = function (props) {
90
89
  var _a;
91
- var data = props.data, columns = props.columns, _b = props.isLoading, isLoading = _b === void 0 ? false : _b, emptyTableContent = props.emptyTableContent, className = props.className, style = props.style, id = props.id, _c = props.isSelectable, isSelectable = _c === void 0 ? false : _c, onSelect = props.onSelect, onRowClick = props.onRowClick, _d = props.isSortable, isSortable = _d === void 0 ? false : _d, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _e = props.intersectionMargin, intersectionMargin = _e === void 0 ? 300 : _e, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _f = props.density, density = _f === void 0 ? 'default' : _f, _g = props.selectSubRows, selectSubRows = _g === void 0 ? true : _g, getSubRows = props.getSubRows, _h = props.selectRowOnClick, selectRowOnClick = _h === void 0 ? true : _h, paginatorRenderer = props.paginatorRenderer, _j = props.pageSize, pageSize = _j === void 0 ? 25 : _j, _k = props.isResizable, isResizable = _k === void 0 ? false : _k, _l = props.styleType, styleType = _l === void 0 ? 'default' : _l, _m = props.enableVirtualization, enableVirtualization = _m === void 0 ? false : _m, _o = props.enableColumnReordering, enableColumnReordering = _o === void 0 ? false : _o, rest = __rest(props, ["data", "columns", "isLoading", "emptyTableContent", "className", "style", "id", "isSelectable", "onSelect", "onRowClick", "isSortable", "onSort", "stateReducer", "onBottomReached", "onRowInViewport", "intersectionMargin", "subComponent", "onExpand", "onFilter", "emptyFilteredTableContent", "filterTypes", "expanderCell", "isRowDisabled", "rowProps", "density", "selectSubRows", "getSubRows", "selectRowOnClick", "paginatorRenderer", "pageSize", "isResizable", "styleType", "enableVirtualization", "enableColumnReordering"]);
90
+ var _b;
91
+ var data = props.data, columns = props.columns, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, emptyTableContent = props.emptyTableContent, className = props.className, style = props.style, id = props.id, _d = props.isSelectable, isSelectable = _d === void 0 ? false : _d, onSelect = props.onSelect, onRowClick = props.onRowClick, _e = props.isSortable, isSortable = _e === void 0 ? false : _e, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _f = props.intersectionMargin, intersectionMargin = _f === void 0 ? 300 : _f, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _g = props.density, density = _g === void 0 ? 'default' : _g, _h = props.selectSubRows, selectSubRows = _h === void 0 ? true : _h, getSubRows = props.getSubRows, _j = props.selectRowOnClick, selectRowOnClick = _j === void 0 ? true : _j, paginatorRenderer = props.paginatorRenderer, _k = props.pageSize, pageSize = _k === void 0 ? 25 : _k, _l = props.isResizable, isResizable = _l === void 0 ? false : _l, _m = props.styleType, styleType = _m === void 0 ? 'default' : _m, _o = props.enableVirtualization, enableVirtualization = _o === void 0 ? false : _o, _p = props.enableColumnReordering, enableColumnReordering = _p === void 0 ? false : _p, rest = __rest(props, ["data", "columns", "isLoading", "emptyTableContent", "className", "style", "id", "isSelectable", "onSelect", "onRowClick", "isSortable", "onSort", "stateReducer", "onBottomReached", "onRowInViewport", "intersectionMargin", "subComponent", "onExpand", "onFilter", "emptyFilteredTableContent", "filterTypes", "expanderCell", "isRowDisabled", "rowProps", "density", "selectSubRows", "getSubRows", "selectRowOnClick", "paginatorRenderer", "pageSize", "isResizable", "styleType", "enableVirtualization", "enableColumnReordering"]);
92
92
  useTheme();
93
- var _p = React.useState(), ownerDocument = _p[0], setOwnerDocument = _p[1];
93
+ var _q = React.useState(), ownerDocument = _q[0], setOwnerDocument = _q[1];
94
94
  var defaultColumn = React.useMemo(function () { return ({
95
95
  maxWidth: 0,
96
96
  minWidth: 0,
@@ -103,6 +103,7 @@ export var Table = function (props) {
103
103
  onBottomReachedRef.current = onBottomReached;
104
104
  onRowInViewportRef.current = onRowInViewport;
105
105
  }, [onBottomReached, onRowInViewport]);
106
+ var hasManualSelectionColumn = (_b = columns[0]) === null || _b === void 0 ? void 0 : _b.columns.some(function (column) { return column.id === SELECTION_CELL_ID; });
106
107
  var tableStateReducer = React.useCallback(function (newState, action, previousState, instance) {
107
108
  switch (action.type) {
108
109
  case TableActions.toggleSortBy:
@@ -116,13 +117,17 @@ export var Table = function (props) {
116
117
  onExpandHandler(newState, instance, onExpand);
117
118
  break;
118
119
  case singleRowSelectedAction: {
119
- newState = onSingleSelectHandler(newState, action, instance, onSelect, isRowDisabled);
120
+ newState = onSingleSelectHandler(newState, action, instance, onSelect,
121
+ // If it has manual selection column, then we can't check whether row is disabled
122
+ hasManualSelectionColumn ? undefined : isRowDisabled);
120
123
  break;
121
124
  }
122
125
  case TableActions.toggleRowSelected:
123
126
  case TableActions.toggleAllRowsSelected:
124
127
  case TableActions.toggleAllPageRowsSelected: {
125
- onSelectHandler(newState, instance, onSelect, isRowDisabled);
128
+ onSelectHandler(newState, instance, onSelect,
129
+ // If it has manual selection column, then we can't check whether row is disabled
130
+ hasManualSelectionColumn ? undefined : isRowDisabled);
126
131
  break;
127
132
  }
128
133
  case tableResizeStartAction: {
@@ -139,7 +144,15 @@ export var Table = function (props) {
139
144
  return stateReducer
140
145
  ? stateReducer(newState, action, previousState, instance)
141
146
  : newState;
142
- }, [isRowDisabled, onExpand, onFilter, onSelect, onSort, stateReducer]);
147
+ }, [
148
+ hasManualSelectionColumn,
149
+ isRowDisabled,
150
+ onExpand,
151
+ onFilter,
152
+ onSelect,
153
+ onSort,
154
+ stateReducer,
155
+ ]);
143
156
  var filterTypes = React.useMemo(function () { return (__assign(__assign({}, customFilterFunctions), filterFunctions)); }, [filterFunctions]);
144
157
  var hasAnySubRows = React.useMemo(function () {
145
158
  return data.some(function (item, index) {
@@ -228,11 +241,12 @@ export var Table = function (props) {
228
241
  });
229
242
  var headerRef = React.useRef(null);
230
243
  var bodyRef = React.useRef(null);
231
- var getPreparedRow = React.useCallback(function (row) {
244
+ var getPreparedRow = React.useCallback(function (index) {
245
+ var row = page[index];
232
246
  prepareRow(row);
233
- return (React.createElement(TableRowMemoized, { row: row, rowProps: rowProps, isLast: row.index === data.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!(isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell }));
247
+ return (React.createElement(TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!(isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell }));
234
248
  }, [
235
- data.length,
249
+ page,
236
250
  expanderCell,
237
251
  hasAnySubRows,
238
252
  instance,
@@ -244,7 +258,7 @@ export var Table = function (props) {
244
258
  state,
245
259
  subComponent,
246
260
  ]);
247
- var virtualizedItemRenderer = React.useCallback(function (index) { return getPreparedRow(page[index]); }, [getPreparedRow, page]);
261
+ var virtualizedItemRenderer = React.useCallback(function (index) { return getPreparedRow(index); }, [getPreparedRow]);
248
262
  return (React.createElement(React.Fragment, null,
249
263
  React.createElement("div", __assign({ ref: function (element) {
250
264
  setOwnerDocument(element === null || element === void 0 ? void 0 : element.ownerDocument);
@@ -268,8 +282,8 @@ export var Table = function (props) {
268
282
  }
269
283
  } }),
270
284
  column.render('Header'),
271
- !isLoading && (data.length != 0 || areFiltersSet) && (React.createElement(FilterToggle, { column: column, ownerDocument: ownerDocument })),
272
- !isLoading && data.length != 0 && column.canSort && (React.createElement("div", { className: 'iui-cell-end-icon' }, column.isSorted && column.isSortedDesc ? (React.createElement(SvgSortUp, { className: 'iui-icon iui-sort', "aria-hidden": true })) : (React.createElement(SvgSortDown, { className: 'iui-icon iui-sort', "aria-hidden": true })))),
285
+ (data.length !== 0 || areFiltersSet) && (React.createElement(FilterToggle, { column: column, ownerDocument: ownerDocument })),
286
+ data.length !== 0 && column.canSort && (React.createElement("div", { className: 'iui-cell-end-icon' }, column.isSorted && column.isSortedDesc ? (React.createElement(SvgSortUp, { className: 'iui-icon iui-sort', "aria-hidden": true })) : (React.createElement(SvgSortDown, { className: 'iui-icon iui-sort', "aria-hidden": true })))),
273
287
  isResizable &&
274
288
  column.isResizerVisible &&
275
289
  index !== headerGroup.headers.length - 1 && (React.createElement("div", __assign({}, column.getResizerProps(), { className: 'iui-resizer' }),
@@ -287,7 +301,7 @@ export var Table = function (props) {
287
301
  headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
288
302
  }
289
303
  }, tabIndex: -1 }),
290
- data.length !== 0 && (React.createElement(React.Fragment, null, enableVirtualization ? (React.createElement(VirtualScroll, { itemsLength: page.length, itemRenderer: virtualizedItemRenderer })) : (page.map(function (row) { return getPreparedRow(row); })))),
304
+ data.length !== 0 && (React.createElement(React.Fragment, null, enableVirtualization ? (React.createElement(VirtualScroll, { itemsLength: page.length, itemRenderer: virtualizedItemRenderer })) : (page.map(function (_, index) { return getPreparedRow(index); })))),
291
305
  isLoading && data.length === 0 && (React.createElement("div", { className: 'iui-table-empty' },
292
306
  React.createElement(ProgressRadial, { indeterminate: true }))),
293
307
  isLoading && data.length !== 0 && (React.createElement("div", { className: 'iui-row' },
@@ -17,7 +17,7 @@ import React from 'react';
17
17
  import cx from 'classnames';
18
18
  import { getCellStyle } from './utils';
19
19
  import { SubRowExpander } from './SubRowExpander';
20
- import { SELECTION_CELL_ID } from './hooks';
20
+ import { SELECTION_CELL_ID } from './columns';
21
21
  import { DefaultCell } from './cells';
22
22
  export var TableCell = function (props) {
23
23
  var cell = props.cell, cellIndex = props.cellIndex, isDisabled = props.isDisabled, tableHasSubRows = props.tableHasSubRows, tableInstance = props.tableInstance, expanderCell = props.expanderCell;
@@ -46,6 +46,6 @@ export var TableCell = function (props) {
46
46
  cellProps: cellProps,
47
47
  children: cellContent,
48
48
  };
49
- return (React.createElement(React.Fragment, null, cell.column.cellRenderer ? (cell.column.cellRenderer(cellRendererProps)) : (React.createElement(DefaultCell, __assign({}, cellRendererProps)))));
49
+ return (React.createElement(React.Fragment, null, cell.column.cellRenderer ? (cell.column.cellRenderer(__assign(__assign({}, cellRendererProps), { isDisabled: function () { return isDisabled; } }))) : (React.createElement(DefaultCell, __assign({}, cellRendererProps, { isDisabled: function () { return isDisabled; } })))));
50
50
  };
51
51
  export default TableCell;
@@ -51,7 +51,9 @@ export var TableRow = function (props) {
51
51
  return (React.createElement(TableCell, { key: cell.getCellProps().key, cell: cell, cellIndex: index, isDisabled: isDisabled, tableHasSubRows: tableHasSubRows, tableInstance: tableInstance, expanderCell: expanderCell }));
52
52
  })),
53
53
  subComponent && (React.createElement(WithCSSTransition, { in: row.isExpanded },
54
- React.createElement("div", { className: 'iui-row iui-expanded-content' }, subComponent(row))))));
54
+ React.createElement("div", { className: cx('iui-row', 'iui-expanded-content', {
55
+ 'iui-disabled': isDisabled,
56
+ }) }, subComponent(row))))));
55
57
  };
56
58
  var hasAnySelectedSubRow = function (row, selectedRowIds) {
57
59
  if (selectedRowIds === null || selectedRowIds === void 0 ? void 0 : selectedRowIds[row.id]) {
@@ -62,14 +64,17 @@ var hasAnySelectedSubRow = function (row, selectedRowIds) {
62
64
  });
63
65
  };
64
66
  export var TableRowMemoized = React.memo(TableRow, function (prevProp, nextProp) {
65
- var _a, _b, _c, _d;
67
+ var _a, _b, _c, _d, _e, _f, _g;
66
68
  return prevProp.isLast === nextProp.isLast &&
69
+ ((_a = prevProp.state.hiddenColumns) === null || _a === void 0 ? void 0 : _a.length) ===
70
+ ((_b = nextProp.state.hiddenColumns) === null || _b === void 0 ? void 0 : _b.length) &&
71
+ !!((_c = prevProp.state.hiddenColumns) === null || _c === void 0 ? void 0 : _c.every(function (column, index) { var _a; return ((_a = nextProp.state.hiddenColumns) === null || _a === void 0 ? void 0 : _a[index]) === column; })) &&
67
72
  prevProp.onRowInViewport === nextProp.onRowInViewport &&
68
73
  prevProp.onBottomReached === nextProp.onBottomReached &&
69
74
  prevProp.onClick === nextProp.onClick &&
70
75
  prevProp.row.original === nextProp.row.original &&
71
- ((_a = prevProp.state.selectedRowIds) === null || _a === void 0 ? void 0 : _a[prevProp.row.id]) ===
72
- ((_b = nextProp.state.selectedRowIds) === null || _b === void 0 ? void 0 : _b[nextProp.row.id]) &&
76
+ ((_d = prevProp.state.selectedRowIds) === null || _d === void 0 ? void 0 : _d[prevProp.row.id]) ===
77
+ ((_e = nextProp.state.selectedRowIds) === null || _e === void 0 ? void 0 : _e[nextProp.row.id]) &&
73
78
  // Check if sub-rows selection has changed and whether to show indeterminate state or not
74
79
  prevProp.row.subRows.some(function (subRow) {
75
80
  return hasAnySelectedSubRow(subRow, prevProp.state.selectedRowIds);
@@ -77,8 +82,8 @@ export var TableRowMemoized = React.memo(TableRow, function (prevProp, nextProp)
77
82
  nextProp.row.subRows.some(function (subRow) {
78
83
  return hasAnySelectedSubRow(subRow, nextProp.state.selectedRowIds);
79
84
  }) &&
80
- ((_c = prevProp.state.expanded) === null || _c === void 0 ? void 0 : _c[prevProp.row.id]) ===
81
- ((_d = nextProp.state.expanded) === null || _d === void 0 ? void 0 : _d[nextProp.row.id]) &&
85
+ ((_f = prevProp.state.expanded) === null || _f === void 0 ? void 0 : _f[prevProp.row.id]) ===
86
+ ((_g = nextProp.state.expanded) === null || _g === void 0 ? void 0 : _g[nextProp.row.id]) &&
82
87
  prevProp.subComponent === nextProp.subComponent &&
83
88
  prevProp.row.cells.every(function (cell, index) { return nextProp.row.cells[index].column === cell.column; }) &&
84
89
  prevProp.isDisabled === nextProp.isDisabled &&
@@ -87,5 +92,5 @@ export var TableRowMemoized = React.memo(TableRow, function (prevProp, nextProp)
87
92
  prevProp.tableHasSubRows === nextProp.tableHasSubRows &&
88
93
  prevProp.state.columnOrder === nextProp.state.columnOrder &&
89
94
  !nextProp.state.columnResizing.isResizingColumn &&
90
- !nextProp.state.isTableResizing;
95
+ prevProp.state.isTableResizing === nextProp.state.isTableResizing;
91
96
  });
@@ -1,3 +1,4 @@
1
1
  export { onExpandHandler } from './expandHandler';
2
2
  export { onFilterHandler } from './filterHandler';
3
- export { onSelectHandler } from './selectHandler';
3
+ export { onSelectHandler, onSingleSelectHandler } from './selectHandler';
4
+ export { onTableResizeStart, onTableResizeEnd } from './resizeHandler';
@@ -4,4 +4,5 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  export { onExpandHandler } from './expandHandler';
6
6
  export { onFilterHandler } from './filterHandler';
7
- export { onSelectHandler } from './selectHandler';
7
+ export { onSelectHandler, onSingleSelectHandler } from './selectHandler';
8
+ export { onTableResizeStart, onTableResizeEnd } from './resizeHandler';
@@ -12,5 +12,5 @@ export declare type DefaultCellProps<T extends Record<string, unknown>> = CellRe
12
12
  * cellRenderer: (props) => <DefaultCell {...props} />,
13
13
  * }
14
14
  */
15
- export declare const DefaultCell: <T extends Record<string, unknown>>(props: CellRendererProps<T>) => JSX.Element;
15
+ export declare const DefaultCell: <T extends Record<string, unknown>>(props: DefaultCellProps<T>) => JSX.Element;
16
16
  export default DefaultCell;
@@ -25,6 +25,7 @@ var __rest = (this && this.__rest) || function (s, e) {
25
25
  * See LICENSE.md in the project root for license terms and full copyright notice.
26
26
  *--------------------------------------------------------------------------------------------*/
27
27
  import React from 'react';
28
+ import cx from 'classnames';
28
29
  /**
29
30
  * Default cell.
30
31
  * It should be passed to `cellRenderer`.
@@ -39,7 +40,9 @@ import React from 'react';
39
40
  export var DefaultCell = function (props) {
40
41
  // Omitting `cellProps`
41
42
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
- var cellElementProps = props.cellElementProps, children = props.children, cellProps = props.cellProps, rest = __rest(props, ["cellElementProps", "children", "cellProps"]);
43
- return (React.createElement("div", __assign({}, cellElementProps, rest), children));
43
+ var _a = props.cellElementProps, cellElementClassName = _a.className, cellElementStyle = _a.style, cellElementProps = __rest(_a, ["className", "style"]), children = props.children, cellProps = props.cellProps, isDisabled = props.isDisabled, className = props.className, style = props.style, rest = __rest(props, ["cellElementProps", "children", "cellProps", "isDisabled", "className", "style"]);
44
+ return (React.createElement("div", __assign({}, cellElementProps, rest, { className: cx(cellElementClassName, className, {
45
+ 'iui-disabled': isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(cellProps.row.original),
46
+ }), style: __assign(__assign({}, cellElementStyle), style) }), children));
44
47
  };
45
48
  export default DefaultCell;
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import { HeaderProps } from 'react-table';
3
+ /**
4
+ * Action column that adds column manager to the Table header.
5
+ * It is recommended to add this column to the end of the Table
6
+ * and to override its `Cell` prop with your row actions menu.
7
+ * @example
8
+ * {
9
+ * ...ActionColumn({ columnManager: true }),
10
+ * Cell: () => (
11
+ * <DropdownMenu menuItems={menuItems}>
12
+ * <IconButton
13
+ * styleType='borderless'
14
+ * onClick={(e) => e.stopPropagation()}
15
+ * >
16
+ * <SvgMore />
17
+ * </IconButton>
18
+ * </DropdownMenu>
19
+ * ),
20
+ * },
21
+ */
22
+ export declare const ActionColumn: <T extends Record<string, unknown>>({ columnManager, }?: {
23
+ columnManager?: boolean | undefined;
24
+ }) => {
25
+ id: string;
26
+ disableResizing: boolean;
27
+ disableGroupBy: boolean;
28
+ minWidth: number;
29
+ width: number;
30
+ maxWidth: number;
31
+ columnClassName: string;
32
+ cellClassName: string;
33
+ disableReordering: boolean;
34
+ Header: ({ allColumns, dispatch, state }: HeaderProps<T>) => JSX.Element | null;
35
+ };
@@ -0,0 +1,84 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React from 'react';
6
+ import { Checkbox } from '../../Checkbox';
7
+ import SvgColumnManager from '@itwin/itwinui-icons-react/cjs/icons/ColumnManager';
8
+ import { DropdownMenu } from '../../DropdownMenu';
9
+ import { IconButton } from '../../Buttons/IconButton';
10
+ import { MenuItem } from '../../Menu';
11
+ import { tableResizeStartAction } from '../Table';
12
+ import { SELECTION_CELL_ID } from './selectionColumn';
13
+ import { EXPANDER_CELL_ID } from './expanderColumn';
14
+ var ACTION_CELL_ID = 'iui-table-action';
15
+ /**
16
+ * Action column that adds column manager to the Table header.
17
+ * It is recommended to add this column to the end of the Table
18
+ * and to override its `Cell` prop with your row actions menu.
19
+ * @example
20
+ * {
21
+ * ...ActionColumn({ columnManager: true }),
22
+ * Cell: () => (
23
+ * <DropdownMenu menuItems={menuItems}>
24
+ * <IconButton
25
+ * styleType='borderless'
26
+ * onClick={(e) => e.stopPropagation()}
27
+ * >
28
+ * <SvgMore />
29
+ * </IconButton>
30
+ * </DropdownMenu>
31
+ * ),
32
+ * },
33
+ */
34
+ export var ActionColumn = function (_a) {
35
+ var _b = _a === void 0 ? {} : _a, _c = _b.columnManager, columnManager = _c === void 0 ? false : _c;
36
+ return {
37
+ id: ACTION_CELL_ID,
38
+ disableResizing: true,
39
+ disableGroupBy: true,
40
+ minWidth: 48,
41
+ width: 48,
42
+ maxWidth: 48,
43
+ columnClassName: 'iui-slot',
44
+ cellClassName: 'iui-slot',
45
+ disableReordering: true,
46
+ Header: function (_a) {
47
+ var allColumns = _a.allColumns, dispatch = _a.dispatch, state = _a.state;
48
+ var _b = React.useState(false), isOpen = _b[0], setIsOpen = _b[1];
49
+ if (!columnManager) {
50
+ return null;
51
+ }
52
+ var defaultColumnIds = [
53
+ SELECTION_CELL_ID,
54
+ EXPANDER_CELL_ID,
55
+ ACTION_CELL_ID,
56
+ ];
57
+ var headerCheckBoxes = function () {
58
+ return allColumns
59
+ //Filters out any default columns made such as selection and expansion
60
+ .filter(function (_a) {
61
+ var id = _a.id;
62
+ return !defaultColumnIds.includes(id);
63
+ })
64
+ .map(function (column) {
65
+ var checked = column.getToggleHiddenProps().checked;
66
+ var onClick = function () {
67
+ column.toggleHidden(checked);
68
+ // If no column was resized then leave table resize handling to the flexbox
69
+ if (Object.keys(state.columnResizing.columnWidths).length === 0) {
70
+ return;
71
+ }
72
+ // Triggers an update to resize the widths of all visible columns
73
+ dispatch({ type: tableResizeStartAction });
74
+ };
75
+ return (React.createElement(MenuItem, { key: column.id, icon: React.createElement(Checkbox, { checked: checked, disabled: column.disableToggleVisibility, onClick: function (e) { return e.stopPropagation(); }, onChange: onClick, "aria-labelledby": "iui-column-" + column.id }), onClick: onClick, disabled: column.disableToggleVisibility },
76
+ React.createElement("div", { id: "iui-column-" + column.id }, column.render('Header'))));
77
+ });
78
+ };
79
+ return (React.createElement(DropdownMenu, { menuItems: headerCheckBoxes, onHide: function () { return setIsOpen(false); }, onShow: function () { return setIsOpen(true); } },
80
+ React.createElement(IconButton, { styleType: 'borderless', isActive: isOpen },
81
+ React.createElement(SvgColumnManager, null))));
82
+ },
83
+ };
84
+ };
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { CellProps, CellRendererProps, Row } from 'react-table';
3
+ export declare const EXPANDER_CELL_ID = "iui-table-expander";
4
+ /**
5
+ * Expander column that adds sub-content expander column to the Table.
6
+ * It is recommended to use it as the first column or after selection column.
7
+ * @example
8
+ * const subComponent = useCallback(
9
+ * (row: Row) => (
10
+ * <div style={{ padding: 16 }}>
11
+ * <Leading>Extra information</Leading>
12
+ * <pre>
13
+ * <code>{JSON.stringify({ values: row.values }, null, 2)}</code>
14
+ * </pre>
15
+ * </div>
16
+ * ),
17
+ * [],
18
+ * );
19
+ * const isExpanderDisabled = useCallback((rowData) => {
20
+ * return rowData.name === 'Name2';
21
+ * }, []);
22
+ * const columns = useMemo(() => [
23
+ * Header: 'Table',
24
+ * columns: [
25
+ * ExpanderColumn({ subComponent, isDisabled: isExpanderDisabled }),
26
+ * // Rest of your columns
27
+ * ],
28
+ * ], [isExpanderDisabled, subComponent]);
29
+ */
30
+ export declare const ExpanderColumn: <T extends Record<string, unknown>>(props?: {
31
+ /** Function that returns expanded content. If row doesn't have it, then should return `false`/`null`. */
32
+ subComponent?: ((row: Row<T>) => React.ReactNode) | undefined;
33
+ /** Function that returns whether expander is disabled */
34
+ isDisabled?: ((rowData: T) => boolean) | undefined;
35
+ }) => {
36
+ id: string;
37
+ disableResizing: boolean;
38
+ disableGroupBy: boolean;
39
+ disableReordering: boolean;
40
+ minWidth: number;
41
+ width: number;
42
+ maxWidth: number;
43
+ columnClassName: string;
44
+ cellClassName: string;
45
+ Cell: (props: CellProps<T, any>) => JSX.Element | null;
46
+ cellRenderer: (props: CellRendererProps<T>) => JSX.Element;
47
+ };
@@ -0,0 +1,74 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ /*---------------------------------------------------------------------------------------------
13
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
14
+ * See LICENSE.md in the project root for license terms and full copyright notice.
15
+ *--------------------------------------------------------------------------------------------*/
16
+ import React from 'react';
17
+ import SvgChevronRight from '@itwin/itwinui-icons-react/cjs/icons/ChevronRight';
18
+ import { IconButton } from '../../Buttons';
19
+ import { DefaultCell } from '../cells';
20
+ export var EXPANDER_CELL_ID = 'iui-table-expander';
21
+ /**
22
+ * Expander column that adds sub-content expander column to the Table.
23
+ * It is recommended to use it as the first column or after selection column.
24
+ * @example
25
+ * const subComponent = useCallback(
26
+ * (row: Row) => (
27
+ * <div style={{ padding: 16 }}>
28
+ * <Leading>Extra information</Leading>
29
+ * <pre>
30
+ * <code>{JSON.stringify({ values: row.values }, null, 2)}</code>
31
+ * </pre>
32
+ * </div>
33
+ * ),
34
+ * [],
35
+ * );
36
+ * const isExpanderDisabled = useCallback((rowData) => {
37
+ * return rowData.name === 'Name2';
38
+ * }, []);
39
+ * const columns = useMemo(() => [
40
+ * Header: 'Table',
41
+ * columns: [
42
+ * ExpanderColumn({ subComponent, isDisabled: isExpanderDisabled }),
43
+ * // Rest of your columns
44
+ * ],
45
+ * ], [isExpanderDisabled, subComponent]);
46
+ */
47
+ export var ExpanderColumn = function (props) {
48
+ if (props === void 0) { props = {}; }
49
+ var subComponent = props.subComponent, isDisabled = props.isDisabled;
50
+ return {
51
+ id: EXPANDER_CELL_ID,
52
+ disableResizing: true,
53
+ disableGroupBy: true,
54
+ disableReordering: true,
55
+ minWidth: 48,
56
+ width: 48,
57
+ maxWidth: 48,
58
+ columnClassName: 'iui-slot',
59
+ cellClassName: 'iui-slot',
60
+ Cell: function (props) {
61
+ var row = props.row;
62
+ if (!(subComponent === null || subComponent === void 0 ? void 0 : subComponent(row))) {
63
+ return null;
64
+ }
65
+ else {
66
+ return (React.createElement(IconButton, { className: 'iui-row-expander', styleType: 'borderless', size: 'small', onClick: function (e) {
67
+ e.stopPropagation();
68
+ row.toggleRowExpanded();
69
+ }, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(props.row.original) }, React.createElement(SvgChevronRight, null)));
70
+ }
71
+ },
72
+ cellRenderer: function (props) { return (React.createElement(DefaultCell, __assign({}, props, { isDisabled: function (rowData) { return !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)); } }))); },
73
+ };
74
+ };
@@ -0,0 +1,3 @@
1
+ export { ActionColumn } from './actionColumn';
2
+ export { SELECTION_CELL_ID, SelectionColumn } from './selectionColumn';
3
+ export { EXPANDER_CELL_ID, ExpanderColumn } from './expanderColumn';
@@ -0,0 +1,7 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export { ActionColumn } from './actionColumn';
6
+ export { SELECTION_CELL_ID, SelectionColumn } from './selectionColumn';
7
+ export { EXPANDER_CELL_ID, ExpanderColumn } from './expanderColumn';
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import { CellProps, CellRendererProps, HeaderProps } from 'react-table';
3
+ export declare const SELECTION_CELL_ID = "iui-table-checkbox-selector";
4
+ /**
5
+ * Selection column that adds selection checkbox column to the Table.
6
+ * It is recommended to use it as the first column.
7
+ * @example
8
+ * const isCheckboxDisabled = useCallback((rowData) => {
9
+ * return rowData.name === 'Name1';
10
+ * }, []);
11
+ * const columns = useMemo(() => [
12
+ * Header: 'Table',
13
+ * columns: [
14
+ * SelectionColumn({ isDisabled: isCheckboxDisabled }),
15
+ * // Rest of your columns
16
+ * ],
17
+ * ], [isCheckboxDisabled]);
18
+ */
19
+ export declare const SelectionColumn: <T extends Record<string, unknown>>(props?: {
20
+ /** Function that returns whether row checkbox should be disabled. */
21
+ isDisabled?: ((rowData: T) => boolean) | undefined;
22
+ }) => {
23
+ id: string;
24
+ disableResizing: boolean;
25
+ disableGroupBy: boolean;
26
+ disableReordering: boolean;
27
+ minWidth: number;
28
+ width: number;
29
+ maxWidth: number;
30
+ columnClassName: string;
31
+ cellClassName: string;
32
+ Header: ({ getToggleAllRowsSelectedProps, rows, initialRows, state, }: HeaderProps<T>) => JSX.Element;
33
+ Cell: ({ row }: CellProps<T, any>) => JSX.Element;
34
+ cellRenderer: (props: CellRendererProps<T>) => JSX.Element;
35
+ };
@@ -0,0 +1,60 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ /*---------------------------------------------------------------------------------------------
13
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
14
+ * See LICENSE.md in the project root for license terms and full copyright notice.
15
+ *--------------------------------------------------------------------------------------------*/
16
+ import React from 'react';
17
+ import { Checkbox } from '../../Checkbox';
18
+ import { DefaultCell } from '../cells';
19
+ export var SELECTION_CELL_ID = 'iui-table-checkbox-selector';
20
+ /**
21
+ * Selection column that adds selection checkbox column to the Table.
22
+ * It is recommended to use it as the first column.
23
+ * @example
24
+ * const isCheckboxDisabled = useCallback((rowData) => {
25
+ * return rowData.name === 'Name1';
26
+ * }, []);
27
+ * const columns = useMemo(() => [
28
+ * Header: 'Table',
29
+ * columns: [
30
+ * SelectionColumn({ isDisabled: isCheckboxDisabled }),
31
+ * // Rest of your columns
32
+ * ],
33
+ * ], [isCheckboxDisabled]);
34
+ */
35
+ export var SelectionColumn = function (props) {
36
+ if (props === void 0) { props = {}; }
37
+ var isDisabled = props.isDisabled;
38
+ return {
39
+ id: SELECTION_CELL_ID,
40
+ disableResizing: true,
41
+ disableGroupBy: true,
42
+ disableReordering: true,
43
+ minWidth: 48,
44
+ width: 48,
45
+ maxWidth: 48,
46
+ columnClassName: 'iui-slot',
47
+ cellClassName: 'iui-slot',
48
+ Header: function (_a) {
49
+ var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
50
+ var disabled = rows.every(function (row) { return isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original); });
51
+ var checked = initialRows.every(function (row) { return state.selectedRowIds[row.id] || (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original)); });
52
+ return (React.createElement(Checkbox, __assign({}, getToggleAllRowsSelectedProps(), { style: {}, checked: checked && !disabled, indeterminate: !checked && Object.keys(state.selectedRowIds).length > 0, disabled: disabled })));
53
+ },
54
+ Cell: function (_a) {
55
+ var row = _a.row;
56
+ return (React.createElement(Checkbox, __assign({}, row.getToggleRowSelectedProps(), { style: {}, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original), onClick: function (e) { return e.stopPropagation(); } })));
57
+ },
58
+ cellRenderer: function (props) { return (React.createElement(DefaultCell, __assign({}, props, { isDisabled: function (rowData) { return !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)); } }))); },
59
+ };
60
+ };
@@ -44,14 +44,30 @@ export var DateRangeFilter = function (props) {
44
44
  useTheme();
45
45
  var translatedStrings = __assign(__assign({}, defaultStrings), translatedLabels);
46
46
  var _h = React.useState(((_a = column.filterValue) === null || _a === void 0 ? void 0 : _a[0]) ? new Date((_b = column.filterValue) === null || _b === void 0 ? void 0 : _b[0]) : undefined), from = _h[0], setFrom = _h[1];
47
+ var onFromChange = React.useCallback(function (date) {
48
+ setFrom(function (prevDate) {
49
+ if (prevDate || !date) {
50
+ return date;
51
+ }
52
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
53
+ });
54
+ }, []);
47
55
  var _j = React.useState(((_c = column.filterValue) === null || _c === void 0 ? void 0 : _c[1]) ? new Date((_d = column.filterValue) === null || _d === void 0 ? void 0 : _d[1]) : undefined), to = _j[0], setTo = _j[1];
56
+ var onToChange = React.useCallback(function (date) {
57
+ setTo(function (prevDate) {
58
+ if (prevDate || !date) {
59
+ return date;
60
+ }
61
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59, 999);
62
+ });
63
+ }, []);
48
64
  var onKeyDown = function (event) {
49
65
  if (event.key === 'Enter') {
50
66
  setFilter([from, to]);
51
67
  }
52
68
  };
53
69
  return (React.createElement(BaseFilter, null,
54
- React.createElement(DatePickerInput, { label: translatedStrings.from, date: from, onChange: setFrom, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder, setFocus: true }),
55
- React.createElement(DatePickerInput, { label: translatedStrings.to, date: to, onChange: setTo, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder }),
70
+ React.createElement(DatePickerInput, { label: translatedStrings.from, date: from, onChange: onFromChange, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder, setFocus: true }),
71
+ React.createElement(DatePickerInput, { label: translatedStrings.to, date: to, onChange: onToChange, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder }),
56
72
  React.createElement(FilterButtonBar, { setFilter: function () { return setFilter([from, to]); }, clearFilter: clearFilter, translatedLabels: translatedLabels })));
57
73
  };
@@ -1,5 +1,5 @@
1
- export { EXPANDER_CELL_ID, useExpanderCell } from './useExpanderCell';
2
- export { SELECTION_CELL_ID, useSelectionCell } from './useSelectionCell';
1
+ export { useExpanderCell } from './useExpanderCell';
2
+ export { useSelectionCell } from './useSelectionCell';
3
3
  export { useSubRowFiltering } from './useSubRowFiltering';
4
4
  export { useSubRowSelection } from './useSubRowSelection';
5
5
  export { useResizeColumns } from './useResizeColumns';