@itwin/itwinui-react 1.35.0 → 1.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/cjs/core/Alert/Alert.js +1 -1
- package/cjs/core/Badge/Badge.js +1 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/cjs/core/Buttons/Button/Button.js +2 -2
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -2
- package/cjs/core/Carousel/Carousel.js +1 -1
- package/cjs/core/Carousel/CarouselDotsList.js +1 -1
- package/cjs/core/Carousel/CarouselSlider.js +1 -1
- package/cjs/core/Checkbox/Checkbox.js +1 -1
- package/cjs/core/ColorPicker/ColorBuilder.js +3 -3
- package/cjs/core/ColorPicker/ColorInputPanel.js +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +1 -1
- package/cjs/core/ComboBox/ComboBox.js +9 -6
- package/cjs/core/DatePicker/DatePicker.js +2 -2
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/cjs/core/Footer/Footer.js +2 -2
- package/cjs/core/Header/HeaderBreadcrumbs.js +1 -1
- package/cjs/core/Header/HeaderButton.js +1 -0
- package/cjs/core/InformationPanel/InformationPanel.js +2 -2
- package/cjs/core/Input/Input.js +1 -1
- package/cjs/core/Menu/Menu.js +8 -3
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +1 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +2 -2
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
- package/cjs/core/Radio/Radio.js +1 -1
- package/cjs/core/Select/Select.js +3 -3
- package/cjs/core/SkipToContentLink/SkipToContentLink.d.ts +33 -0
- package/cjs/core/SkipToContentLink/SkipToContentLink.js +50 -0
- package/cjs/core/SkipToContentLink/index.d.ts +4 -0
- package/cjs/core/SkipToContentLink/index.js +10 -0
- package/cjs/core/Slider/Slider.js +1 -1
- package/cjs/core/Slider/Thumb.js +1 -1
- package/cjs/core/Slider/Track.js +1 -1
- package/cjs/core/Surface/Surface.d.ts +32 -0
- package/cjs/core/Surface/Surface.js +70 -0
- package/cjs/core/Surface/index.d.ts +4 -0
- package/cjs/core/Surface/index.js +10 -0
- package/cjs/core/Table/Table.d.ts +7 -0
- package/cjs/core/Table/Table.js +44 -21
- package/cjs/core/Table/TableCell.js +3 -3
- package/cjs/core/Table/TablePaginator.js +6 -6
- package/cjs/core/Table/TableRowMemoized.js +13 -8
- 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 +1 -2
- package/cjs/core/Table/hooks/useSelectionCell.js +8 -53
- package/cjs/core/Table/index.d.ts +1 -0
- package/cjs/core/Table/index.js +5 -1
- package/cjs/core/Table/utils.js +5 -5
- package/cjs/core/Tabs/Tabs.d.ts +1 -1
- package/cjs/core/Tabs/Tabs.js +7 -8
- package/cjs/core/Tag/Tag.js +6 -3
- package/cjs/core/Tag/TagContainer.js +1 -1
- package/cjs/core/Tile/Tile.d.ts +6 -2
- package/cjs/core/Tile/Tile.js +8 -3
- package/cjs/core/Toast/Toast.js +3 -3
- package/cjs/core/Toast/ToastWrapper.js +1 -1
- package/cjs/core/Tree/TreeNode.js +2 -2
- package/cjs/core/Typography/Anchor/Anchor.d.ts +1 -0
- package/cjs/core/Typography/Anchor/Anchor.js +1 -0
- package/cjs/core/Typography/Text/Text.js +1 -1
- package/cjs/core/UserIcon/UserIcon.js +2 -2
- package/cjs/core/UserIconGroup/UserIconGroup.js +3 -3
- package/cjs/core/Wizard/Step.js +1 -1
- package/cjs/core/Wizard/Wizard.js +1 -1
- package/cjs/core/index.d.ts +5 -1
- package/cjs/core/index.js +9 -2
- package/cjs/core/utils/color/ColorValue.js +11 -11
- package/cjs/core/utils/color/index.js +5 -1
- package/cjs/core/utils/components/FocusTrap.js +6 -8
- package/cjs/core/utils/components/InputContainer.js +1 -1
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
- package/cjs/core/utils/components/Popover.js +13 -1
- package/cjs/core/utils/components/VirtualScroll.js +1 -1
- package/cjs/core/utils/components/WithCSSTransition.js +5 -5
- package/cjs/core/utils/components/index.js +5 -1
- package/cjs/core/utils/functions/focusable.js +1 -1
- package/cjs/core/utils/functions/index.js +5 -1
- package/cjs/core/utils/hooks/index.js +5 -1
- package/cjs/core/utils/hooks/useOverflow.js +3 -3
- package/cjs/core/utils/hooks/useTheme.js +1 -1
- package/cjs/core/utils/index.js +5 -1
- package/cjs/index.js +5 -1
- package/cjs/types/react-table-config.d.ts +18 -0
- package/esm/core/Alert/Alert.js +1 -1
- package/esm/core/Badge/Badge.js +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/esm/core/Buttons/Button/Button.js +2 -2
- package/esm/core/Buttons/IconButton/IconButton.js +2 -2
- package/esm/core/Carousel/Carousel.js +1 -1
- package/esm/core/Carousel/CarouselDotsList.js +1 -1
- package/esm/core/Carousel/CarouselSlider.js +1 -1
- package/esm/core/Checkbox/Checkbox.js +1 -1
- package/esm/core/ColorPicker/ColorBuilder.js +3 -3
- package/esm/core/ColorPicker/ColorInputPanel.js +1 -1
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ColorPicker/ColorSwatch.js +1 -1
- package/esm/core/ComboBox/ComboBox.js +9 -6
- package/esm/core/DatePicker/DatePicker.js +2 -2
- package/esm/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/esm/core/Footer/Footer.js +2 -2
- package/esm/core/Header/HeaderBreadcrumbs.js +1 -1
- package/esm/core/Header/HeaderButton.js +1 -0
- package/esm/core/InformationPanel/InformationPanel.js +2 -2
- package/esm/core/Input/Input.js +1 -1
- package/esm/core/Menu/Menu.js +8 -3
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +1 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +2 -2
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
- package/esm/core/Radio/Radio.js +1 -1
- package/esm/core/Select/Select.js +3 -3
- package/esm/core/SkipToContentLink/SkipToContentLink.d.ts +33 -0
- package/esm/core/SkipToContentLink/SkipToContentLink.js +44 -0
- package/esm/core/SkipToContentLink/index.d.ts +4 -0
- package/esm/core/SkipToContentLink/index.js +6 -0
- package/esm/core/Slider/Slider.js +1 -1
- package/esm/core/Slider/Thumb.js +1 -1
- package/esm/core/Slider/Track.js +1 -1
- package/esm/core/Surface/Surface.d.ts +32 -0
- package/esm/core/Surface/Surface.js +64 -0
- package/esm/core/Surface/index.d.ts +4 -0
- package/esm/core/Surface/index.js +6 -0
- package/esm/core/Table/Table.d.ts +7 -0
- package/esm/core/Table/Table.js +40 -17
- package/esm/core/Table/TableCell.js +2 -2
- package/esm/core/Table/TablePaginator.js +6 -6
- package/esm/core/Table/TableRowMemoized.js +13 -8
- 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 +1 -2
- package/esm/core/Table/hooks/useSelectionCell.js +7 -49
- package/esm/core/Table/index.d.ts +1 -0
- package/esm/core/Table/index.js +1 -0
- package/esm/core/Table/utils.js +5 -5
- package/esm/core/Tabs/Tabs.d.ts +1 -1
- package/esm/core/Tabs/Tabs.js +7 -8
- package/esm/core/Tag/Tag.js +6 -3
- package/esm/core/Tag/TagContainer.js +1 -1
- package/esm/core/Tile/Tile.d.ts +6 -2
- package/esm/core/Tile/Tile.js +8 -3
- package/esm/core/Toast/Toast.js +3 -3
- package/esm/core/Toast/ToastWrapper.js +1 -1
- package/esm/core/Tree/TreeNode.js +2 -2
- package/esm/core/Typography/Anchor/Anchor.d.ts +1 -0
- package/esm/core/Typography/Anchor/Anchor.js +1 -0
- package/esm/core/Typography/Text/Text.js +1 -1
- package/esm/core/UserIcon/UserIcon.js +2 -2
- package/esm/core/UserIconGroup/UserIconGroup.js +3 -3
- package/esm/core/Wizard/Step.js +1 -1
- package/esm/core/Wizard/Wizard.js +1 -1
- package/esm/core/index.d.ts +5 -1
- package/esm/core/index.js +3 -1
- package/esm/core/utils/color/ColorValue.js +11 -11
- package/esm/core/utils/components/FocusTrap.js +6 -8
- package/esm/core/utils/components/InputContainer.js +1 -1
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
- package/esm/core/utils/components/Popover.js +13 -1
- package/esm/core/utils/components/VirtualScroll.js +1 -1
- package/esm/core/utils/components/WithCSSTransition.js +5 -5
- package/esm/core/utils/functions/focusable.js +1 -1
- package/esm/core/utils/hooks/useOverflow.js +3 -3
- package/esm/core/utils/hooks/useTheme.js +1 -1
- package/esm/types/react-table-config.d.ts +18 -0
- package/package.json +21 -20
|
@@ -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,81 @@
|
|
|
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.ExpanderColumn = exports.EXPANDER_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 ChevronRight_1 = __importDefault(require("@itwin/itwinui-icons-react/cjs/icons/ChevronRight"));
|
|
24
|
+
var Buttons_1 = require("../../Buttons");
|
|
25
|
+
var cells_1 = require("../cells");
|
|
26
|
+
exports.EXPANDER_CELL_ID = 'iui-table-expander';
|
|
27
|
+
/**
|
|
28
|
+
* Expander column that adds sub-content expander column to the Table.
|
|
29
|
+
* It is recommended to use it as the first column or after selection column.
|
|
30
|
+
* @example
|
|
31
|
+
* const subComponent = useCallback(
|
|
32
|
+
* (row: Row) => (
|
|
33
|
+
* <div style={{ padding: 16 }}>
|
|
34
|
+
* <Leading>Extra information</Leading>
|
|
35
|
+
* <pre>
|
|
36
|
+
* <code>{JSON.stringify({ values: row.values }, null, 2)}</code>
|
|
37
|
+
* </pre>
|
|
38
|
+
* </div>
|
|
39
|
+
* ),
|
|
40
|
+
* [],
|
|
41
|
+
* );
|
|
42
|
+
* const isExpanderDisabled = useCallback((rowData) => {
|
|
43
|
+
* return rowData.name === 'Name2';
|
|
44
|
+
* }, []);
|
|
45
|
+
* const columns = useMemo(() => [
|
|
46
|
+
* Header: 'Table',
|
|
47
|
+
* columns: [
|
|
48
|
+
* ExpanderColumn({ subComponent, isDisabled: isExpanderDisabled }),
|
|
49
|
+
* // Rest of your columns
|
|
50
|
+
* ],
|
|
51
|
+
* ], [isExpanderDisabled, subComponent]);
|
|
52
|
+
*/
|
|
53
|
+
var ExpanderColumn = function (props) {
|
|
54
|
+
if (props === void 0) { props = {}; }
|
|
55
|
+
var subComponent = props.subComponent, isDisabled = props.isDisabled;
|
|
56
|
+
return {
|
|
57
|
+
id: exports.EXPANDER_CELL_ID,
|
|
58
|
+
disableResizing: true,
|
|
59
|
+
disableGroupBy: true,
|
|
60
|
+
disableReordering: true,
|
|
61
|
+
minWidth: 48,
|
|
62
|
+
width: 48,
|
|
63
|
+
maxWidth: 48,
|
|
64
|
+
columnClassName: 'iui-slot',
|
|
65
|
+
cellClassName: 'iui-slot',
|
|
66
|
+
Cell: function (props) {
|
|
67
|
+
var row = props.row;
|
|
68
|
+
if (!(subComponent === null || subComponent === void 0 ? void 0 : subComponent(row))) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return (react_1.default.createElement(Buttons_1.IconButton, { className: 'iui-row-expander', styleType: 'borderless', size: 'small', onClick: function (e) {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
row.toggleRowExpanded();
|
|
75
|
+
}, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(props.row.original) }, react_1.default.createElement(ChevronRight_1.default, null)));
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
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)); } }))); },
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
exports.ExpanderColumn = ExpanderColumn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpanderColumn = exports.EXPANDER_CELL_ID = exports.SelectionColumn = exports.SELECTION_CELL_ID = exports.ActionColumn = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
var actionColumn_1 = require("./actionColumn");
|
|
9
|
+
Object.defineProperty(exports, "ActionColumn", { enumerable: true, get: function () { return actionColumn_1.ActionColumn; } });
|
|
10
|
+
var selectionColumn_1 = require("./selectionColumn");
|
|
11
|
+
Object.defineProperty(exports, "SELECTION_CELL_ID", { enumerable: true, get: function () { return selectionColumn_1.SELECTION_CELL_ID; } });
|
|
12
|
+
Object.defineProperty(exports, "SelectionColumn", { enumerable: true, get: function () { return selectionColumn_1.SelectionColumn; } });
|
|
13
|
+
var expanderColumn_1 = require("./expanderColumn");
|
|
14
|
+
Object.defineProperty(exports, "EXPANDER_CELL_ID", { enumerable: true, get: function () { return expanderColumn_1.EXPANDER_CELL_ID; } });
|
|
15
|
+
Object.defineProperty(exports, "ExpanderColumn", { enumerable: true, get: function () { return expanderColumn_1.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,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
|
|
3
|
-
export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
|
|
2
|
+
export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, selectionMode: 'multi' | 'single', 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,18 @@ 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
|
-
|
|
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';
|
|
34
|
-
var useSelectionCell = function (isSelectable, isRowDisabled) { return function (hooks) {
|
|
12
|
+
exports.useSelectionCell = void 0;
|
|
13
|
+
var columns_1 = require("../columns");
|
|
14
|
+
var useSelectionCell = function (isSelectable, selectionMode, isRowDisabled) { return function (hooks) {
|
|
35
15
|
if (!isSelectable) {
|
|
36
16
|
return;
|
|
37
17
|
}
|
|
38
|
-
hooks.allColumns.push(function (columns) {
|
|
39
|
-
|
|
40
|
-
id
|
|
41
|
-
|
|
42
|
-
|
|
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 selectionMode === 'single' ||
|
|
20
|
+
columns.find(function (c) { return c.id === columns_1.SELECTION_CELL_ID; })
|
|
21
|
+
? columns
|
|
22
|
+
: __spreadArray([(0, columns_1.SelectionColumn)({ isDisabled: isRowDisabled })], columns, true);
|
|
68
23
|
});
|
|
69
24
|
}; };
|
|
70
25
|
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
|
@@ -5,21 +5,21 @@ var getCellStyle = function (column, isTableResizing) {
|
|
|
5
5
|
var style = {};
|
|
6
6
|
style.flex = "1 1 145px";
|
|
7
7
|
if (column.width) {
|
|
8
|
-
var width = typeof column.width === 'string' ? column.width : column.width
|
|
8
|
+
var width = typeof column.width === 'string' ? column.width : "".concat(column.width, "px");
|
|
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 = "".concat(Number(column.width), " ").concat(Number(column.width), " ").concat(width);
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
style.flex = "0 0 "
|
|
15
|
+
style.flex = "0 0 ".concat(width);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
if (column.maxWidth) {
|
|
19
|
-
style.maxWidth = column.maxWidth
|
|
19
|
+
style.maxWidth = "".concat(column.maxWidth, "px");
|
|
20
20
|
}
|
|
21
21
|
if (column.minWidth) {
|
|
22
|
-
style.minWidth = column.minWidth
|
|
22
|
+
style.minWidth = "".concat(column.minWidth, "px");
|
|
23
23
|
}
|
|
24
24
|
return style;
|
|
25
25
|
};
|
package/cjs/core/Tabs/Tabs.d.ts
CHANGED
package/cjs/core/Tabs/Tabs.js
CHANGED
|
@@ -83,20 +83,19 @@ var Tabs = function (props) {
|
|
|
83
83
|
var activeTab = tablistRef.current.children[currentActiveIndex];
|
|
84
84
|
var activeTabRect = activeTab.getBoundingClientRect();
|
|
85
85
|
setStripeProperties(__assign(__assign({}, (orientation === 'horizontal' && {
|
|
86
|
-
'--stripe-width': activeTabRect.width
|
|
87
|
-
'--stripe-left': activeTab.offsetLeft
|
|
86
|
+
'--stripe-width': "".concat(activeTabRect.width, "px"),
|
|
87
|
+
'--stripe-left': "".concat(activeTab.offsetLeft, "px"),
|
|
88
88
|
})), (orientation === 'vertical' && {
|
|
89
|
-
'--stripe-height': activeTabRect.height
|
|
90
|
-
'--stripe-top': activeTab.offsetTop
|
|
89
|
+
'--stripe-height': "".concat(activeTabRect.height, "px"),
|
|
90
|
+
'--stripe-top': "".concat(activeTab.offsetTop, "px"),
|
|
91
91
|
})));
|
|
92
92
|
}
|
|
93
93
|
}, [currentActiveIndex, type, orientation, tabsWidth]);
|
|
94
94
|
var _l = react_1.default.useState(), focusedIndex = _l[0], setFocusedIndex = _l[1];
|
|
95
95
|
react_1.default.useEffect(function () {
|
|
96
|
-
var _a;
|
|
97
96
|
if (tablistRef.current && focusedIndex !== undefined) {
|
|
98
97
|
var tab = tablistRef.current.querySelectorAll('.iui-tab')[focusedIndex];
|
|
99
|
-
|
|
98
|
+
tab === null || tab === void 0 ? void 0 : tab.focus();
|
|
100
99
|
}
|
|
101
100
|
}, [focusedIndex]);
|
|
102
101
|
var _m = react_1.default.useState(false), hasSublabel = _m[0], setHasSublabel = _m[1]; // used for setting size
|
|
@@ -173,8 +172,8 @@ var Tabs = function (props) {
|
|
|
173
172
|
}
|
|
174
173
|
};
|
|
175
174
|
var isIE = !((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, '--stripe-width', '100px'));
|
|
176
|
-
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-wrapper', "iui-"
|
|
177
|
-
react_1.default.createElement("ul", __assign({ className: (0, classnames_1.default)('iui-tabs', "iui-"
|
|
175
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-wrapper', "iui-".concat(orientation), wrapperClassName), style: stripeProperties },
|
|
176
|
+
react_1.default.createElement("ul", __assign({ className: (0, classnames_1.default)('iui-tabs', "iui-".concat(type), {
|
|
178
177
|
'iui-green': color === 'green',
|
|
179
178
|
'iui-animated': type !== 'default' && !isIE,
|
|
180
179
|
'iui-not-animated': isIE,
|
package/cjs/core/Tag/Tag.js
CHANGED
|
@@ -45,9 +45,12 @@ var Buttons_1 = require("../Buttons");
|
|
|
45
45
|
var Tag = function (props) {
|
|
46
46
|
var className = props.className, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, onRemove = props.onRemove, rest = __rest(props, ["className", "variant", "children", "onRemove"]);
|
|
47
47
|
(0, utils_1.useTheme)();
|
|
48
|
-
return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)(
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)({
|
|
49
|
+
'iui-tag-basic': variant === 'basic',
|
|
50
|
+
'iui-tag': variant === 'default',
|
|
51
|
+
}, className) }, rest),
|
|
52
|
+
variant === 'default' ? (react_1.default.createElement("span", { className: 'iui-tag-label' }, children)) : (children),
|
|
53
|
+
onRemove && (react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', size: 'small', onClick: onRemove, "aria-label": 'Delete tag', className: 'iui-tag-button' },
|
|
51
54
|
react_1.default.createElement(CloseSmall_1.default, { "aria-hidden": true })))));
|
|
52
55
|
};
|
|
53
56
|
exports.Tag = Tag;
|
|
@@ -45,7 +45,7 @@ var TagContainer = function (props) {
|
|
|
45
45
|
var className = props.className, children = props.children, overflow = props.overflow, _b = props.background, background = _b === void 0 ? 'none' : _b, rest = __rest(props, ["className", "children", "overflow", "background"]);
|
|
46
46
|
(0, utils_1.useTheme)();
|
|
47
47
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-tag-container', (_a = {},
|
|
48
|
-
_a["iui-"
|
|
48
|
+
_a["iui-".concat(overflow)] = !!overflow,
|
|
49
49
|
_a['iui-visible'] = background !== 'none',
|
|
50
50
|
_a), className) }, rest), children));
|
|
51
51
|
};
|
package/cjs/core/Tile/Tile.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CommonProps } from '../utils';
|
|
3
2
|
import '@itwin/itwinui-css/css/tile.css';
|
|
4
3
|
export declare type TileProps = {
|
|
5
4
|
/**
|
|
@@ -80,7 +79,12 @@ export declare type TileProps = {
|
|
|
80
79
|
* Any custom nodes that will be appended to the tile's main content.
|
|
81
80
|
*/
|
|
82
81
|
children?: React.ReactNode;
|
|
83
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Whether the tile is expected to be interactable (i.e. `onClick`).
|
|
84
|
+
* It becomes focusable and gets on hover styling.
|
|
85
|
+
*/
|
|
86
|
+
isActionable?: boolean;
|
|
87
|
+
} & React.ComponentPropsWithoutRef<'div'>;
|
|
84
88
|
/**
|
|
85
89
|
* Tile component that displays content and actions in a card-like format.
|
|
86
90
|
* @example
|