@itwin/itwinui-react 1.35.0 → 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.
- package/CHANGELOG.md +14 -0
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/Menu/Menu.js +8 -3
- package/cjs/core/Table/Table.d.ts +1 -0
- package/cjs/core/Table/Table.js +26 -13
- package/cjs/core/Table/TableCell.js +3 -3
- package/cjs/core/Table/TableRowMemoized.js +12 -7
- package/cjs/core/Table/actionHandlers/index.d.ts +2 -1
- package/cjs/core/Table/actionHandlers/index.js +5 -1
- package/cjs/core/Table/cells/DefaultCell.d.ts +1 -1
- package/cjs/core/Table/cells/DefaultCell.js +5 -2
- package/cjs/core/Table/columns/actionColumn.d.ts +35 -0
- package/cjs/core/Table/columns/actionColumn.js +91 -0
- package/cjs/core/Table/columns/expanderColumn.d.ts +47 -0
- package/cjs/core/Table/columns/expanderColumn.js +81 -0
- package/cjs/core/Table/columns/index.d.ts +3 -0
- package/cjs/core/Table/columns/index.js +15 -0
- package/cjs/core/Table/columns/selectionColumn.d.ts +35 -0
- package/cjs/core/Table/columns/selectionColumn.js +67 -0
- package/cjs/core/Table/hooks/index.d.ts +2 -2
- package/cjs/core/Table/hooks/index.js +1 -3
- package/cjs/core/Table/hooks/useExpanderCell.d.ts +0 -1
- package/cjs/core/Table/hooks/useExpanderCell.js +25 -39
- package/cjs/core/Table/hooks/useResizeColumns.js +8 -2
- package/cjs/core/Table/hooks/useSelectionCell.d.ts +0 -1
- package/cjs/core/Table/hooks/useSelectionCell.js +6 -52
- package/cjs/core/Table/index.d.ts +1 -0
- package/cjs/core/Table/index.js +5 -1
- package/cjs/core/Table/utils.js +1 -1
- package/cjs/core/Toast/Toast.js +1 -1
- package/cjs/core/Typography/Anchor/Anchor.d.ts +1 -0
- package/cjs/core/Typography/Anchor/Anchor.js +1 -0
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +5 -2
- package/cjs/core/utils/components/Popover.js +13 -1
- package/cjs/types/react-table-config.d.ts +18 -0
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/Menu/Menu.js +8 -3
- package/esm/core/Table/Table.d.ts +1 -0
- package/esm/core/Table/Table.js +22 -9
- package/esm/core/Table/TableCell.js +2 -2
- package/esm/core/Table/TableRowMemoized.js +12 -7
- package/esm/core/Table/actionHandlers/index.d.ts +2 -1
- package/esm/core/Table/actionHandlers/index.js +2 -1
- package/esm/core/Table/cells/DefaultCell.d.ts +1 -1
- package/esm/core/Table/cells/DefaultCell.js +5 -2
- package/esm/core/Table/columns/actionColumn.d.ts +35 -0
- package/esm/core/Table/columns/actionColumn.js +84 -0
- package/esm/core/Table/columns/expanderColumn.d.ts +47 -0
- package/esm/core/Table/columns/expanderColumn.js +74 -0
- package/esm/core/Table/columns/index.d.ts +3 -0
- package/esm/core/Table/columns/index.js +7 -0
- package/esm/core/Table/columns/selectionColumn.d.ts +35 -0
- package/esm/core/Table/columns/selectionColumn.js +60 -0
- package/esm/core/Table/hooks/index.d.ts +2 -2
- package/esm/core/Table/hooks/index.js +2 -2
- package/esm/core/Table/hooks/useExpanderCell.d.ts +0 -1
- package/esm/core/Table/hooks/useExpanderCell.js +24 -35
- package/esm/core/Table/hooks/useResizeColumns.js +8 -2
- package/esm/core/Table/hooks/useSelectionCell.d.ts +0 -1
- package/esm/core/Table/hooks/useSelectionCell.js +5 -48
- package/esm/core/Table/index.d.ts +1 -0
- package/esm/core/Table/index.js +1 -0
- package/esm/core/Table/utils.js +1 -1
- package/esm/core/Toast/Toast.js +1 -1
- package/esm/core/Typography/Anchor/Anchor.d.ts +1 -0
- package/esm/core/Typography/Anchor/Anchor.js +1 -0
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/utils/components/Popover.js +13 -1
- package/esm/types/react-table-config.d.ts +18 -0
- package/package.json +2 -2
|
@@ -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,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.SelectionColumn = exports.SELECTION_CELL_ID = void 0;
|
|
18
|
+
/*---------------------------------------------------------------------------------------------
|
|
19
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
20
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
21
|
+
*--------------------------------------------------------------------------------------------*/
|
|
22
|
+
var react_1 = __importDefault(require("react"));
|
|
23
|
+
var Checkbox_1 = require("../../Checkbox");
|
|
24
|
+
var cells_1 = require("../cells");
|
|
25
|
+
exports.SELECTION_CELL_ID = 'iui-table-checkbox-selector';
|
|
26
|
+
/**
|
|
27
|
+
* Selection column that adds selection checkbox column to the Table.
|
|
28
|
+
* It is recommended to use it as the first column.
|
|
29
|
+
* @example
|
|
30
|
+
* const isCheckboxDisabled = useCallback((rowData) => {
|
|
31
|
+
* return rowData.name === 'Name1';
|
|
32
|
+
* }, []);
|
|
33
|
+
* const columns = useMemo(() => [
|
|
34
|
+
* Header: 'Table',
|
|
35
|
+
* columns: [
|
|
36
|
+
* SelectionColumn({ isDisabled: isCheckboxDisabled }),
|
|
37
|
+
* // Rest of your columns
|
|
38
|
+
* ],
|
|
39
|
+
* ], [isCheckboxDisabled]);
|
|
40
|
+
*/
|
|
41
|
+
var SelectionColumn = function (props) {
|
|
42
|
+
if (props === void 0) { props = {}; }
|
|
43
|
+
var isDisabled = props.isDisabled;
|
|
44
|
+
return {
|
|
45
|
+
id: exports.SELECTION_CELL_ID,
|
|
46
|
+
disableResizing: true,
|
|
47
|
+
disableGroupBy: true,
|
|
48
|
+
disableReordering: true,
|
|
49
|
+
minWidth: 48,
|
|
50
|
+
width: 48,
|
|
51
|
+
maxWidth: 48,
|
|
52
|
+
columnClassName: 'iui-slot',
|
|
53
|
+
cellClassName: 'iui-slot',
|
|
54
|
+
Header: function (_a) {
|
|
55
|
+
var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
|
|
56
|
+
var disabled = rows.every(function (row) { return isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original); });
|
|
57
|
+
var checked = initialRows.every(function (row) { return state.selectedRowIds[row.id] || (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original)); });
|
|
58
|
+
return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, getToggleAllRowsSelectedProps(), { style: {}, checked: checked && !disabled, indeterminate: !checked && Object.keys(state.selectedRowIds).length > 0, disabled: disabled })));
|
|
59
|
+
},
|
|
60
|
+
Cell: function (_a) {
|
|
61
|
+
var row = _a.row;
|
|
62
|
+
return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, row.getToggleRowSelectedProps(), { style: {}, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original), onClick: function (e) { return e.stopPropagation(); } })));
|
|
63
|
+
},
|
|
64
|
+
cellRenderer: function (props) { return (react_1.default.createElement(cells_1.DefaultCell, __assign({}, props, { isDisabled: function (rowData) { return !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)); } }))); },
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
exports.SelectionColumn = SelectionColumn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
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';
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useColumnDragAndDrop = exports.useResizeColumns = exports.useSubRowSelection = exports.useSubRowFiltering = exports.useSelectionCell = exports.
|
|
3
|
+
exports.useColumnDragAndDrop = exports.useResizeColumns = exports.useSubRowSelection = exports.useSubRowFiltering = exports.useSelectionCell = exports.useExpanderCell = void 0;
|
|
4
4
|
/*---------------------------------------------------------------------------------------------
|
|
5
5
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
6
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
7
|
*--------------------------------------------------------------------------------------------*/
|
|
8
8
|
var useExpanderCell_1 = require("./useExpanderCell");
|
|
9
|
-
Object.defineProperty(exports, "EXPANDER_CELL_ID", { enumerable: true, get: function () { return useExpanderCell_1.EXPANDER_CELL_ID; } });
|
|
10
9
|
Object.defineProperty(exports, "useExpanderCell", { enumerable: true, get: function () { return useExpanderCell_1.useExpanderCell; } });
|
|
11
10
|
var useSelectionCell_1 = require("./useSelectionCell");
|
|
12
|
-
Object.defineProperty(exports, "SELECTION_CELL_ID", { enumerable: true, get: function () { return useSelectionCell_1.SELECTION_CELL_ID; } });
|
|
13
11
|
Object.defineProperty(exports, "useSelectionCell", { enumerable: true, get: function () { return useSelectionCell_1.useSelectionCell; } });
|
|
14
12
|
var useSubRowFiltering_1 = require("./useSubRowFiltering");
|
|
15
13
|
Object.defineProperty(exports, "useSubRowFiltering", { enumerable: true, get: function () { return useSubRowFiltering_1.useSubRowFiltering; } });
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CellProps, Hooks, Row } from 'react-table';
|
|
3
|
-
export declare const EXPANDER_CELL_ID = "iui-table-expander";
|
|
4
3
|
export declare const useExpanderCell: <T extends Record<string, unknown>>(subComponent?: ((row: Row<T>) => React.ReactNode) | undefined, expanderCell?: ((cellProps: CellProps<T, any>) => React.ReactNode) | undefined, isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
14
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
15
|
if (ar || !(i in from)) {
|
|
@@ -8,50 +19,25 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
8
19
|
}
|
|
9
20
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
21
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.useExpanderCell =
|
|
16
|
-
|
|
17
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
18
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
19
|
-
*--------------------------------------------------------------------------------------------*/
|
|
20
|
-
var ChevronRight_1 = __importDefault(require("@itwin/itwinui-icons-react/cjs/icons/ChevronRight"));
|
|
21
|
-
var react_1 = __importDefault(require("react"));
|
|
22
|
-
var Buttons_1 = require("../../Buttons");
|
|
23
|
-
exports.EXPANDER_CELL_ID = 'iui-table-expander';
|
|
23
|
+
exports.useExpanderCell = void 0;
|
|
24
|
+
var columns_1 = require("../columns");
|
|
24
25
|
var useExpanderCell = function (subComponent, expanderCell, isRowDisabled) { return function (hooks) {
|
|
25
26
|
if (!subComponent) {
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
|
-
hooks.allColumns.push(function (columns) {
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
disableGroupBy: true,
|
|
33
|
-
minWidth: 48,
|
|
34
|
-
width: 48,
|
|
35
|
-
maxWidth: 48,
|
|
36
|
-
columnClassName: 'iui-slot',
|
|
37
|
-
cellClassName: 'iui-slot',
|
|
38
|
-
disableReordering: true,
|
|
39
|
-
Cell: function (props) {
|
|
40
|
-
var row = props.row;
|
|
41
|
-
if (!subComponent(row)) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
else if (expanderCell) {
|
|
45
|
-
return expanderCell(props);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
return (react_1.default.createElement(Buttons_1.IconButton, { className: 'iui-row-expander', styleType: 'borderless', size: 'small', onClick: function (e) {
|
|
49
|
-
e.stopPropagation();
|
|
50
|
-
row.toggleRowExpanded();
|
|
51
|
-
}, disabled: isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(props.row.original) }, react_1.default.createElement(ChevronRight_1.default, null)));
|
|
52
|
-
}
|
|
53
|
-
},
|
|
29
|
+
hooks.allColumns.push(function (columns) {
|
|
30
|
+
var hasExpanderColumn = columns.find(function (c) { return c.id === columns_1.EXPANDER_CELL_ID; });
|
|
31
|
+
if (hasExpanderColumn) {
|
|
32
|
+
return columns;
|
|
54
33
|
}
|
|
55
|
-
|
|
34
|
+
var expanderColumn = (0, columns_1.ExpanderColumn)({
|
|
35
|
+
subComponent: subComponent,
|
|
36
|
+
isDisabled: isRowDisabled,
|
|
37
|
+
});
|
|
38
|
+
return __spreadArray([
|
|
39
|
+
__assign(__assign({}, expanderColumn), { Cell: expanderCell !== null && expanderCell !== void 0 ? expanderCell : expanderColumn.Cell })
|
|
40
|
+
], columns, true);
|
|
41
|
+
});
|
|
56
42
|
}; };
|
|
57
43
|
exports.useExpanderCell = useExpanderCell;
|
|
@@ -229,7 +229,10 @@ var useInstanceBeforeDimensions = function (instance) {
|
|
|
229
229
|
};
|
|
230
230
|
var getPreviousResizableHeader = function (headerColumn, instance) {
|
|
231
231
|
var _a;
|
|
232
|
-
var headersList = ((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders
|
|
232
|
+
var headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(function (_a) {
|
|
233
|
+
var isVisible = _a.isVisible;
|
|
234
|
+
return isVisible;
|
|
235
|
+
});
|
|
233
236
|
var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
|
|
234
237
|
return __spreadArray([], headersList, true).slice(0, headerIndex)
|
|
235
238
|
.reverse()
|
|
@@ -237,7 +240,10 @@ var getPreviousResizableHeader = function (headerColumn, instance) {
|
|
|
237
240
|
};
|
|
238
241
|
var getNextResizableHeader = function (headerColumn, instance) {
|
|
239
242
|
var _a;
|
|
240
|
-
var headersList = ((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders
|
|
243
|
+
var headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(function (_a) {
|
|
244
|
+
var isVisible = _a.isVisible;
|
|
245
|
+
return isVisible;
|
|
246
|
+
});
|
|
241
247
|
var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
|
|
242
248
|
return __spreadArray([], headersList, true).slice(headerIndex + 1)
|
|
243
249
|
.find(function (h) { return !h.disableResizing; });
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { Hooks } from 'react-table';
|
|
2
|
-
export declare const SELECTION_CELL_ID = "iui-table-checkbox-selector";
|
|
3
2
|
export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
3
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
4
|
if (ar || !(i in from)) {
|
|
@@ -19,52 +8,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
8
|
}
|
|
20
9
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
10
|
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.useSelectionCell =
|
|
27
|
-
|
|
28
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
|
-
*--------------------------------------------------------------------------------------------*/
|
|
31
|
-
var react_1 = __importDefault(require("react"));
|
|
32
|
-
var Checkbox_1 = require("../../Checkbox");
|
|
33
|
-
exports.SELECTION_CELL_ID = 'iui-table-checkbox-selector';
|
|
12
|
+
exports.useSelectionCell = void 0;
|
|
13
|
+
var columns_1 = require("../columns");
|
|
34
14
|
var useSelectionCell = function (isSelectable, isRowDisabled) { return function (hooks) {
|
|
35
15
|
if (!isSelectable) {
|
|
36
16
|
return;
|
|
37
17
|
}
|
|
38
|
-
hooks.allColumns.push(function (columns) {
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
disableGroupBy: true,
|
|
43
|
-
minWidth: 48,
|
|
44
|
-
width: 48,
|
|
45
|
-
maxWidth: 48,
|
|
46
|
-
columnClassName: 'iui-slot',
|
|
47
|
-
cellClassName: 'iui-slot',
|
|
48
|
-
disableReordering: true,
|
|
49
|
-
Header: function (_a) {
|
|
50
|
-
var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
|
|
51
|
-
var disabled = rows.every(function (row) { return isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original); });
|
|
52
|
-
var checked = initialRows.every(function (row) {
|
|
53
|
-
return state.selectedRowIds[row.id] || (isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original));
|
|
54
|
-
});
|
|
55
|
-
return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, getToggleAllRowsSelectedProps(), { checked: checked && !disabled, indeterminate: !checked && Object.keys(state.selectedRowIds).length > 0, disabled: disabled })));
|
|
56
|
-
},
|
|
57
|
-
Cell: function (_a) {
|
|
58
|
-
var row = _a.row;
|
|
59
|
-
return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, row.getToggleRowSelectedProps(), { disabled: isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original), onClick: function (e) { return e.stopPropagation(); } })));
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
], columns, true); });
|
|
63
|
-
hooks.useInstanceBeforeDimensions.push(function (_a) {
|
|
64
|
-
var headerGroups = _a.headerGroups;
|
|
65
|
-
// Fix the parent group of the selection button to not be resizable
|
|
66
|
-
var selectionGroupHeader = headerGroups[0].headers[0];
|
|
67
|
-
selectionGroupHeader.canResize = false;
|
|
18
|
+
hooks.allColumns.push(function (columns) {
|
|
19
|
+
return columns.find(function (c) { return c.id === columns_1.SELECTION_CELL_ID; })
|
|
20
|
+
? columns
|
|
21
|
+
: __spreadArray([(0, columns_1.SelectionColumn)({ isDisabled: isRowDisabled })], columns, true);
|
|
68
22
|
});
|
|
69
23
|
}; };
|
|
70
24
|
exports.useSelectionCell = useSelectionCell;
|
|
@@ -6,5 +6,6 @@ export { DefaultCell, EditableCell } from './cells';
|
|
|
6
6
|
export type { DefaultCellProps, EditableCellProps } from './cells';
|
|
7
7
|
export { TablePaginator } from './TablePaginator';
|
|
8
8
|
export type { TablePaginatorProps } from './TablePaginator';
|
|
9
|
+
export { ActionColumn, ExpanderColumn, SelectionColumn } from './columns';
|
|
9
10
|
declare const _default: "./Table";
|
|
10
11
|
export default _default;
|
package/cjs/core/Table/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.tableFilters = exports.FilterButtonBar = exports.BaseFilter = exports.Table = void 0;
|
|
3
|
+
exports.SelectionColumn = exports.ExpanderColumn = exports.ActionColumn = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.tableFilters = exports.FilterButtonBar = exports.BaseFilter = exports.Table = void 0;
|
|
4
4
|
/*---------------------------------------------------------------------------------------------
|
|
5
5
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
6
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -16,4 +16,8 @@ Object.defineProperty(exports, "DefaultCell", { enumerable: true, get: function
|
|
|
16
16
|
Object.defineProperty(exports, "EditableCell", { enumerable: true, get: function () { return cells_1.EditableCell; } });
|
|
17
17
|
var TablePaginator_1 = require("./TablePaginator");
|
|
18
18
|
Object.defineProperty(exports, "TablePaginator", { enumerable: true, get: function () { return TablePaginator_1.TablePaginator; } });
|
|
19
|
+
var columns_1 = require("./columns");
|
|
20
|
+
Object.defineProperty(exports, "ActionColumn", { enumerable: true, get: function () { return columns_1.ActionColumn; } });
|
|
21
|
+
Object.defineProperty(exports, "ExpanderColumn", { enumerable: true, get: function () { return columns_1.ExpanderColumn; } });
|
|
22
|
+
Object.defineProperty(exports, "SelectionColumn", { enumerable: true, get: function () { return columns_1.SelectionColumn; } });
|
|
19
23
|
exports.default = './Table';
|
package/cjs/core/Table/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ var getCellStyle = function (column, isTableResizing) {
|
|
|
9
9
|
style.width = width;
|
|
10
10
|
// This allows flexbox to handle the width of the column on table resize
|
|
11
11
|
if (isTableResizing && column.canResize) {
|
|
12
|
-
style.flex = Number(column.width) + "
|
|
12
|
+
style.flex = Number(column.width) + " " + Number(column.width) + " " + width;
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
15
|
style.flex = "0 0 " + width;
|
package/cjs/core/Toast/Toast.js
CHANGED
|
@@ -143,7 +143,7 @@ var ToastPresentation = function (props) {
|
|
|
143
143
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("iui-toast iui-" + category, className) }, rest),
|
|
144
144
|
react_1.default.createElement("div", { className: 'iui-status-area' }, react_1.default.createElement(StatusIcon, { className: 'iui-icon' })),
|
|
145
145
|
react_1.default.createElement("div", { className: 'iui-message' }, content),
|
|
146
|
-
link && (react_1.default.createElement("a", { className: 'iui-anchor', onClick: link.onClick }, link.title)),
|
|
146
|
+
link && (react_1.default.createElement("a", { className: 'iui-toast-anchor', onClick: link.onClick }, link.title)),
|
|
147
147
|
(type === 'persisting' || hasCloseButton) && (react_1.default.createElement(Buttons_1.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
|
148
148
|
react_1.default.createElement(CloseSmall_1.default, null)))));
|
|
149
149
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/anchor.css';
|
|
2
3
|
export declare const Anchor: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & React.RefAttributes<HTMLAnchorElement>>;
|
|
3
4
|
export default Anchor;
|
|
@@ -33,6 +33,7 @@ exports.Anchor = void 0;
|
|
|
33
33
|
var react_1 = __importDefault(require("react"));
|
|
34
34
|
var classnames_1 = __importDefault(require("classnames"));
|
|
35
35
|
var utils_1 = require("../../utils");
|
|
36
|
+
require("@itwin/itwinui-css/css/anchor.css");
|
|
36
37
|
exports.Anchor = react_1.default.forwardRef(function (_a, ref) {
|
|
37
38
|
var className = _a.className, rest = __rest(_a, ["className"]);
|
|
38
39
|
(0, utils_1.useTheme)();
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export { Slider } from './Slider';
|
|
|
66
66
|
export type { SliderProps } from './Slider';
|
|
67
67
|
export { StatusMessage } from './StatusMessage';
|
|
68
68
|
export type { StatusMessageProps } from './StatusMessage';
|
|
69
|
-
export { Table, tableFilters, FilterButtonBar, DefaultCell, EditableCell, TablePaginator, } from './Table';
|
|
69
|
+
export { Table, tableFilters, FilterButtonBar, DefaultCell, EditableCell, TablePaginator, ActionColumn, ExpanderColumn, SelectionColumn, } from './Table';
|
|
70
70
|
export type { TableProps, TableFilterProps, TableFilterValue, DateRangeFilterOptions, FilterButtonBarProps, DefaultCellProps, EditableCellProps, TablePaginatorProps, TablePaginatorRendererProps, } from './Table';
|
|
71
71
|
export { Tag, TagContainer } from './Tag';
|
|
72
72
|
export type { TagProps, TagContainerProps } from './Tag';
|
package/cjs/core/index.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Modal = exports.MenuExtraContent = exports.MenuDivider = exports.MenuItem = exports.Menu = exports.LabeledTextarea = exports.LabeledSelect = exports.InputGroup = exports.LabeledInput = exports.Label = exports.Input = exports.InformationPanelContent = exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = exports.HorizontalTab = exports.HorizontalTabs = exports.Tab = exports.VerticalTabs = exports.HeaderLogo = exports.HeaderButton = exports.HeaderBreadcrumbs = exports.Header = exports.Footer = exports.FileUploadTemplate = exports.FileUpload = exports.Fieldset = exports.ExpandableBlock = exports.ErrorPage = exports.DropdownMenu = exports.generateLocalizedStrings = exports.DatePicker = exports.ComboBox = exports.ColorPalette = exports.ColorInputPanel = exports.ColorBuilder = exports.ColorSwatch = exports.ColorPicker = exports.Checkbox = exports.Carousel = exports.ButtonGroup = exports.SplitButton = exports.IdeasButton = exports.IconButton = exports.DropdownButton = exports.Button = exports.Breadcrumbs = exports.Badge = exports.Alert = void 0;
|
|
7
|
-
exports.
|
|
8
|
-
exports.MiddleTextTruncation = void 0;
|
|
7
|
+
exports.Wizard = exports.UserIconGroup = exports.UserIcon = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Anchor = exports.TreeNodeExpander = exports.TreeNode = exports.Tree = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.SelectionColumn = exports.ExpanderColumn = exports.ActionColumn = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.tableFilters = exports.Table = exports.StatusMessage = exports.Slider = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = exports.ProgressRadial = exports.ProgressLinear = exports.ModalContent = exports.ModalButtonBar = void 0;
|
|
8
|
+
exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = void 0;
|
|
9
9
|
/*---------------------------------------------------------------------------------------------
|
|
10
10
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
11
11
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -115,6 +115,9 @@ Object.defineProperty(exports, "FilterButtonBar", { enumerable: true, get: funct
|
|
|
115
115
|
Object.defineProperty(exports, "DefaultCell", { enumerable: true, get: function () { return Table_1.DefaultCell; } });
|
|
116
116
|
Object.defineProperty(exports, "EditableCell", { enumerable: true, get: function () { return Table_1.EditableCell; } });
|
|
117
117
|
Object.defineProperty(exports, "TablePaginator", { enumerable: true, get: function () { return Table_1.TablePaginator; } });
|
|
118
|
+
Object.defineProperty(exports, "ActionColumn", { enumerable: true, get: function () { return Table_1.ActionColumn; } });
|
|
119
|
+
Object.defineProperty(exports, "ExpanderColumn", { enumerable: true, get: function () { return Table_1.ExpanderColumn; } });
|
|
120
|
+
Object.defineProperty(exports, "SelectionColumn", { enumerable: true, get: function () { return Table_1.SelectionColumn; } });
|
|
118
121
|
var Tag_1 = require("./Tag");
|
|
119
122
|
Object.defineProperty(exports, "Tag", { enumerable: true, get: function () { return Tag_1.Tag; } });
|
|
120
123
|
Object.defineProperty(exports, "TagContainer", { enumerable: true, get: function () { return Tag_1.TagContainer; } });
|
|
@@ -78,7 +78,19 @@ exports.Popover = react_1.default.forwardRef(function (props, ref) {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
|
|
81
|
+
// Fixing issue where elements below Popover gets click events.
|
|
82
|
+
// Tippy uses react Portal, which propagates events by react tree, not dom tree.
|
|
83
|
+
// Read more: https://reactjs.org/docs/portals.html#event-bubbling-through-portals
|
|
84
|
+
var clonedContent = react_1.default.isValidElement(props.content)
|
|
85
|
+
? react_1.default.cloneElement(props.content, {
|
|
86
|
+
onClick: function (e) {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
(_b = (_a = props.content.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
: props.content;
|
|
93
|
+
computedProps.content = mounted ? clonedContent : '';
|
|
82
94
|
}
|
|
83
95
|
return react_1.default.createElement(react_2.default, __assign({}, computedProps, { ref: refs }));
|
|
84
96
|
});
|
|
@@ -2,9 +2,22 @@
|
|
|
2
2
|
declare module 'react-table' {
|
|
3
3
|
type FieldType = 'text' | 'number' | 'date' | string;
|
|
4
4
|
type CellRendererProps<D extends object = {}> = {
|
|
5
|
+
/**
|
|
6
|
+
* Cell HTML props passed from the Table.
|
|
7
|
+
*/
|
|
5
8
|
cellElementProps: TableCellProps;
|
|
9
|
+
/**
|
|
10
|
+
* Table specific cell props like `column`, `row`.
|
|
11
|
+
*/
|
|
6
12
|
cellProps: CellProps<D>;
|
|
13
|
+
/**
|
|
14
|
+
* Cell's content.
|
|
15
|
+
*/
|
|
7
16
|
children: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Function that returns whether the cell is disabled.
|
|
19
|
+
*/
|
|
20
|
+
isDisabled?: (rowData: D) => boolean;
|
|
8
21
|
};
|
|
9
22
|
interface TableOptions<D extends object = {}> extends Omit<UseTableOptions<D>, 'data'>, UseRowSelectOptions<D>, UseExpandedOptions<D>, UseFiltersOptions<D>, UsePaginationOptions<D>, Omit<UseResizeColumnsOptions<D>, 'disableResizing'>, UseSortByOptions<D> {
|
|
10
23
|
/**
|
|
@@ -73,6 +86,11 @@ declare module 'react-table' {
|
|
|
73
86
|
* @default false
|
|
74
87
|
*/
|
|
75
88
|
disableReordering?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* If true, column's visibility cannot be toggled.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
disableToggleVisibility?: boolean;
|
|
76
94
|
}
|
|
77
95
|
interface ColumnInstance<D extends object = {}> extends UseFiltersColumnProps<D>, UseGroupByColumnProps<D>, UseResizeColumnsColumnProps<D>, UseSortByColumnProps<D> {
|
|
78
96
|
originalWidth: number;
|
|
@@ -17,5 +17,5 @@ export declare type ColorSwatchProps = {
|
|
|
17
17
|
* <ColorSwatch color='#23450b' onClick={onClick}/>
|
|
18
18
|
* <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
|
|
19
19
|
*/
|
|
20
|
-
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "
|
|
20
|
+
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "role" | "children" | "className" | "onClick" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
export default ColorSwatch;
|
package/esm/core/Menu/Menu.js
CHANGED
|
@@ -40,9 +40,14 @@ export var Menu = React.forwardRef(function (props, ref) {
|
|
|
40
40
|
React.useEffect(function () {
|
|
41
41
|
setFocusedIndex(null);
|
|
42
42
|
}, [children]);
|
|
43
|
+
var getFocusableNodes = React.useCallback(function () {
|
|
44
|
+
var focusableItems = getFocusableElements(menuRef.current);
|
|
45
|
+
// Filter out focusable elements that are inside each menu item, e.g. checkbox, anchor
|
|
46
|
+
return focusableItems.filter(function (i) { return !focusableItems.some(function (p) { return p.contains(i.parentElement); }); });
|
|
47
|
+
}, []);
|
|
43
48
|
React.useEffect(function () {
|
|
44
49
|
var _a;
|
|
45
|
-
var items =
|
|
50
|
+
var items = getFocusableNodes();
|
|
46
51
|
if (focusedIndex != null) {
|
|
47
52
|
(_a = items === null || items === void 0 ? void 0 : items[focusedIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
48
53
|
return;
|
|
@@ -51,9 +56,9 @@ export var Menu = React.forwardRef(function (props, ref) {
|
|
|
51
56
|
if (setFocus) {
|
|
52
57
|
setFocusedIndex(selectedIndex > -1 ? selectedIndex : 0);
|
|
53
58
|
}
|
|
54
|
-
}, [setFocus, focusedIndex]);
|
|
59
|
+
}, [setFocus, focusedIndex, getFocusableNodes]);
|
|
55
60
|
var onKeyDown = function (event) {
|
|
56
|
-
var items =
|
|
61
|
+
var items = getFocusableNodes();
|
|
57
62
|
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
58
63
|
return;
|
|
59
64
|
}
|
|
@@ -3,6 +3,7 @@ import { CellProps, TableOptions, Row, TableState } from 'react-table';
|
|
|
3
3
|
import { CommonProps } from '../utils';
|
|
4
4
|
import '@itwin/itwinui-css/css/table.css';
|
|
5
5
|
import { TableFilterValue } from './filters';
|
|
6
|
+
export declare const tableResizeStartAction = "tableResizeStart";
|
|
6
7
|
export declare type TablePaginatorRendererProps = {
|
|
7
8
|
/**
|
|
8
9
|
* The zero-based index of the current page.
|