@itwin/itwinui-react 1.32.0 → 1.34.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 +28 -0
- package/cjs/core/ButtonGroup/ButtonGroup.d.ts +6 -1
- package/cjs/core/ButtonGroup/ButtonGroup.js +6 -3
- package/cjs/core/ComboBox/ComboBox.d.ts +6 -1
- package/cjs/core/ComboBox/ComboBox.js +4 -2
- package/cjs/core/Footer/Footer.d.ts +14 -2
- package/cjs/core/Footer/Footer.js +40 -17
- package/cjs/core/InputGroup/InputGroup.js +12 -2
- package/cjs/core/LabeledSelect/LabeledSelect.js +10 -4
- package/cjs/core/Slider/Slider.js +10 -1
- package/cjs/core/StatusMessage/StatusMessage.d.ts +24 -0
- package/cjs/core/StatusMessage/StatusMessage.js +39 -0
- package/cjs/core/StatusMessage/index.d.ts +4 -0
- package/cjs/core/StatusMessage/index.js +10 -0
- package/cjs/core/Table/Table.d.ts +5 -0
- package/cjs/core/Table/Table.js +8 -8
- package/cjs/core/Table/TableRowMemoized.js +1 -0
- package/cjs/core/Table/actionHandlers/resizeHandler.d.ts +2 -0
- package/cjs/core/Table/actionHandlers/selectHandler.d.ts +1 -0
- package/cjs/core/Table/filters/BaseFilter.js +1 -1
- package/cjs/core/Table/filters/FilterToggle.js +4 -4
- package/cjs/core/Table/hooks/index.d.ts +1 -0
- package/cjs/core/Table/hooks/index.js +3 -1
- package/cjs/core/Table/hooks/useColumnDragAndDrop.d.ts +2 -0
- package/cjs/core/Table/hooks/useColumnDragAndDrop.js +120 -0
- package/cjs/core/Table/hooks/useExpanderCell.js +1 -0
- package/cjs/core/Table/hooks/useResizeColumns.js +8 -4
- package/cjs/core/Table/hooks/useSelectionCell.js +2 -2
- package/cjs/core/ToggleSwitch/ToggleSwitch.js +13 -10
- package/cjs/core/UserIcon/UserIcon.js +1 -10
- package/cjs/core/index.d.ts +2 -0
- package/cjs/core/index.js +3 -1
- package/cjs/core/utils/components/InputContainer.d.ts +1 -0
- package/cjs/core/utils/components/InputContainer.js +8 -7
- package/cjs/core/utils/hooks/useIntersection.d.ts +4 -3
- package/cjs/core/utils/hooks/useIntersection.js +10 -5
- package/cjs/core/utils/hooks/useOverflow.d.ts +3 -2
- package/cjs/core/utils/hooks/useOverflow.js +24 -21
- package/cjs/types/react-table-config.d.ts +7 -0
- package/esm/core/ButtonGroup/ButtonGroup.d.ts +6 -1
- package/esm/core/ButtonGroup/ButtonGroup.js +6 -3
- package/esm/core/ComboBox/ComboBox.d.ts +6 -1
- package/esm/core/ComboBox/ComboBox.js +4 -2
- package/esm/core/Footer/Footer.d.ts +14 -2
- package/esm/core/Footer/Footer.js +40 -17
- package/esm/core/InputGroup/InputGroup.js +12 -2
- package/esm/core/LabeledSelect/LabeledSelect.js +10 -4
- package/esm/core/Slider/Slider.js +10 -1
- package/esm/core/StatusMessage/StatusMessage.d.ts +24 -0
- package/esm/core/StatusMessage/StatusMessage.js +32 -0
- package/esm/core/StatusMessage/index.d.ts +4 -0
- package/esm/core/StatusMessage/index.js +6 -0
- package/esm/core/Table/Table.d.ts +5 -0
- package/esm/core/Table/Table.js +10 -10
- package/esm/core/Table/TableRowMemoized.js +1 -0
- package/esm/core/Table/actionHandlers/resizeHandler.d.ts +2 -0
- package/esm/core/Table/actionHandlers/selectHandler.d.ts +1 -0
- package/esm/core/Table/filters/BaseFilter.js +1 -1
- package/esm/core/Table/filters/FilterToggle.js +4 -4
- package/esm/core/Table/hooks/index.d.ts +1 -0
- package/esm/core/Table/hooks/index.js +1 -0
- package/esm/core/Table/hooks/useColumnDragAndDrop.d.ts +2 -0
- package/esm/core/Table/hooks/useColumnDragAndDrop.js +116 -0
- package/esm/core/Table/hooks/useExpanderCell.js +1 -0
- package/esm/core/Table/hooks/useResizeColumns.js +8 -4
- package/esm/core/Table/hooks/useSelectionCell.js +2 -2
- package/esm/core/ToggleSwitch/ToggleSwitch.js +13 -10
- package/esm/core/UserIcon/UserIcon.js +1 -10
- package/esm/core/index.d.ts +2 -0
- package/esm/core/index.js +1 -0
- package/esm/core/utils/components/InputContainer.d.ts +1 -0
- package/esm/core/utils/components/InputContainer.js +8 -7
- package/esm/core/utils/hooks/useIntersection.d.ts +4 -3
- package/esm/core/utils/hooks/useIntersection.js +10 -5
- package/esm/core/utils/hooks/useOverflow.d.ts +3 -2
- package/esm/core/utils/hooks/useOverflow.js +24 -21
- package/esm/types/react-table-config.d.ts +7 -0
- package/package.json +15 -14
|
@@ -51,20 +51,23 @@ export var ToggleSwitch = React.forwardRef(function (props, ref) {
|
|
|
51
51
|
useTheme();
|
|
52
52
|
var inputElementRef = React.useRef(null);
|
|
53
53
|
var refs = useMergedRefs(inputElementRef, ref);
|
|
54
|
+
var WrapperComponent = label ? 'label' : 'div';
|
|
54
55
|
React.useEffect(function () {
|
|
55
56
|
if (inputElementRef.current && setFocus) {
|
|
56
57
|
inputElementRef.current.focus();
|
|
57
58
|
}
|
|
58
59
|
}, [setFocus]);
|
|
59
|
-
return (React.createElement(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
return (React.createElement(WrapperComponent, { className: cx('iui-toggle-switch-wrapper', {
|
|
61
|
+
'iui-disabled': disabled,
|
|
62
|
+
'iui-label-on-right': label && labelPosition === 'right',
|
|
63
|
+
'iui-label-on-left': label && labelPosition === 'left',
|
|
64
|
+
}, className), style: style },
|
|
65
|
+
React.createElement("input", __assign({ className: 'iui-toggle-switch', type: 'checkbox', role: 'switch', disabled: disabled, ref: refs }, rest)),
|
|
66
|
+
icon &&
|
|
67
|
+
React.cloneElement(icon, {
|
|
68
|
+
className: cx('iui-toggle-switch-icon', icon.props.className),
|
|
69
|
+
'aria-hidden': true,
|
|
70
|
+
}),
|
|
71
|
+
label && React.createElement("span", { className: 'iui-toggle-switch-label' }, label)));
|
|
69
72
|
});
|
|
70
73
|
export default ToggleSwitch;
|
|
@@ -24,9 +24,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
25
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
26
|
*--------------------------------------------------------------------------------------------*/
|
|
27
|
-
import SvgAway from '@itwin/itwinui-icons-react/cjs/icons/Away';
|
|
28
|
-
import SvgCheckmark from '@itwin/itwinui-icons-react/cjs/icons/Checkmark';
|
|
29
|
-
import SvgCloseSmall from '@itwin/itwinui-icons-react/cjs/icons/CloseSmall';
|
|
30
27
|
import cx from 'classnames';
|
|
31
28
|
import React from 'react';
|
|
32
29
|
import { useTheme } from '../utils';
|
|
@@ -57,16 +54,10 @@ export var UserIcon = function (props) {
|
|
|
57
54
|
var _c = props.size, size = _c === void 0 ? 'small' : _c, status = props.status, abbreviation = props.abbreviation, image = props.image, _d = props.backgroundColor, backgroundColor = _d === void 0 ? 'white' : _d, title = props.title, translatedStatusTitles = props.translatedStatusTitles, className = props.className, style = props.style, rest = __rest(props, ["size", "status", "abbreviation", "image", "backgroundColor", "title", "translatedStatusTitles", "className", "style"]);
|
|
58
55
|
useTheme();
|
|
59
56
|
var statusTitles = __assign(__assign({}, defaultStatusTitles), translatedStatusTitles);
|
|
60
|
-
var iconMap = {
|
|
61
|
-
away: React.createElement(SvgAway, { className: 'iui-status-symbol', "aria-hidden": true }),
|
|
62
|
-
offline: React.createElement(SvgCloseSmall, { className: 'iui-status-symbol', "aria-hidden": true }),
|
|
63
|
-
online: React.createElement(SvgCheckmark, { className: 'iui-status-symbol', "aria-hidden": true }),
|
|
64
|
-
busy: React.createElement(React.Fragment, null),
|
|
65
|
-
};
|
|
66
57
|
return (React.createElement("span", __assign({ className: cx('iui-user-icon', (_a = {}, _a["iui-" + size] = size !== 'medium', _a), className), title: title, style: style }, rest), image !== null && image !== void 0 ? image : (React.createElement("abbr", { className: 'iui-initials', style: { backgroundColor: backgroundColor } }, abbreviation === null || abbreviation === void 0 ? void 0 : abbreviation.substring(0, 2))),
|
|
67
58
|
React.createElement("span", { className: 'iui-stroke' }),
|
|
68
59
|
status && (React.createElement("span", { title: statusTitles[status], className: cx('iui-status', (_b = {},
|
|
69
60
|
_b["iui-" + status] = !!status,
|
|
70
|
-
_b)), "aria-label": statusTitles[status] }
|
|
61
|
+
_b)), "aria-label": statusTitles[status] }))));
|
|
71
62
|
};
|
|
72
63
|
export default UserIcon;
|
package/esm/core/index.d.ts
CHANGED
|
@@ -62,6 +62,8 @@ export { SideNavigation, SidenavButton, SidenavSubmenu, SidenavSubmenuHeader, }
|
|
|
62
62
|
export type { SideNavigationProps, SidenavButtonProps, SidenavSubmenuProps, SidenavSubmenuHeaderProps, } from './SideNavigation';
|
|
63
63
|
export { Slider } from './Slider';
|
|
64
64
|
export type { SliderProps } from './Slider';
|
|
65
|
+
export { StatusMessage } from './StatusMessage';
|
|
66
|
+
export type { StatusMessageProps } from './StatusMessage';
|
|
65
67
|
export { Table, tableFilters, FilterButtonBar, DefaultCell, EditableCell, TablePaginator, } from './Table';
|
|
66
68
|
export type { TableProps, TableFilterProps, TableFilterValue, DateRangeFilterOptions, FilterButtonBarProps, DefaultCellProps, EditableCellProps, TablePaginatorProps, TablePaginatorRendererProps, } from './Table';
|
|
67
69
|
export { Tag, TagContainer } from './Tag';
|
package/esm/core/index.js
CHANGED
|
@@ -34,6 +34,7 @@ export { RadioTile, RadioTileGroup } from './RadioTiles';
|
|
|
34
34
|
export { Select } from './Select';
|
|
35
35
|
export { SideNavigation, SidenavButton, SidenavSubmenu, SidenavSubmenuHeader, } from './SideNavigation';
|
|
36
36
|
export { Slider } from './Slider';
|
|
37
|
+
export { StatusMessage } from './StatusMessage';
|
|
37
38
|
export { Table, tableFilters, FilterButtonBar, DefaultCell, EditableCell, TablePaginator, } from './Table';
|
|
38
39
|
export { Tag, TagContainer } from './Tag';
|
|
39
40
|
export { Textarea } from './Textarea';
|
|
@@ -9,6 +9,7 @@ export declare type InputContainerProps<T extends React.ElementType = 'div'> = {
|
|
|
9
9
|
icon?: JSX.Element;
|
|
10
10
|
isLabelInline?: boolean;
|
|
11
11
|
isIconInline?: boolean;
|
|
12
|
+
statusMessage?: React.ReactNode;
|
|
12
13
|
} & React.ComponentPropsWithoutRef<T>;
|
|
13
14
|
/**
|
|
14
15
|
* Input container to wrap inputs with label, and add optional message and icon.
|
|
@@ -33,22 +33,23 @@ import cx from 'classnames';
|
|
|
33
33
|
export var InputContainer = function (props) {
|
|
34
34
|
var _a;
|
|
35
35
|
var _b;
|
|
36
|
-
var _c = props.as, Element = _c === void 0 ? 'div' : _c, label = props.label, disabled = props.disabled, required = props.required, status = props.status, message = props.message, icon = props.icon, isLabelInline = props.isLabelInline, isIconInline = props.isIconInline, children = props.children, className = props.className, style = props.style, rest = __rest(props, ["as", "label", "disabled", "required", "status", "message", "icon", "isLabelInline", "isIconInline", "children", "className", "style"]);
|
|
36
|
+
var _c = props.as, Element = _c === void 0 ? 'div' : _c, label = props.label, disabled = props.disabled, required = props.required, status = props.status, message = props.message, icon = props.icon, isLabelInline = props.isLabelInline, isIconInline = props.isIconInline, children = props.children, className = props.className, style = props.style, statusMessage = props.statusMessage, rest = __rest(props, ["as", "label", "disabled", "required", "status", "message", "icon", "isLabelInline", "isIconInline", "children", "className", "style", "statusMessage"]);
|
|
37
37
|
return (React.createElement(Element, __assign({ className: cx('iui-input-container', (_a = {
|
|
38
38
|
'iui-disabled': disabled
|
|
39
39
|
},
|
|
40
40
|
_a["iui-" + status] = !!status,
|
|
41
41
|
_a['iui-inline-label'] = isLabelInline,
|
|
42
42
|
_a['iui-inline-icon'] = isIconInline,
|
|
43
|
-
_a['iui-with-message'] = !!message && !isLabelInline,
|
|
43
|
+
_a['iui-with-message'] = (!!message || !!icon || !!statusMessage) && !isLabelInline,
|
|
44
44
|
_a), className), style: style }, rest),
|
|
45
45
|
label && (React.createElement("div", { className: cx('iui-label', {
|
|
46
46
|
'iui-required': required,
|
|
47
47
|
}) }, label)),
|
|
48
48
|
children,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
statusMessage ? (statusMessage) : (React.createElement(React.Fragment, null,
|
|
50
|
+
icon &&
|
|
51
|
+
React.cloneElement(icon, {
|
|
52
|
+
className: cx('iui-input-icon', (_b = icon.props) === null || _b === void 0 ? void 0 : _b.className),
|
|
53
|
+
}),
|
|
54
|
+
message && !isLabelInline && (React.createElement("div", { className: 'iui-message' }, message))))));
|
|
54
55
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hook that uses `IntersectionObserver` to trigger `onIntersect` callback when element is in viewport.
|
|
3
|
-
* Callback is called only once.
|
|
4
|
-
*
|
|
3
|
+
* Callback is called only once by default (can be changed using the `once` parameter).
|
|
4
|
+
* @returns a callback ref that needs to be set on the element you want to observe.
|
|
5
|
+
* @private
|
|
5
6
|
* @example
|
|
6
7
|
* const onIntersection = React.useCallback(() => {
|
|
7
8
|
* console.log('Element is in viewport!');
|
|
@@ -9,4 +10,4 @@
|
|
|
9
10
|
* const ref = useIntersection(onIntersection);
|
|
10
11
|
* return (<div ref={ref}>One of many elements</div>);
|
|
11
12
|
*/
|
|
12
|
-
export declare const useIntersection: (onIntersect: () => void, options?: IntersectionObserverInit) => (node: HTMLElement | null) => void;
|
|
13
|
+
export declare const useIntersection: (onIntersect: () => void, options?: IntersectionObserverInit, once?: boolean) => (node: HTMLElement | null) => void;
|
|
@@ -6,8 +6,9 @@ import React from 'react';
|
|
|
6
6
|
import { getWindow } from '../functions/dom';
|
|
7
7
|
/**
|
|
8
8
|
* Hook that uses `IntersectionObserver` to trigger `onIntersect` callback when element is in viewport.
|
|
9
|
-
* Callback is called only once.
|
|
10
|
-
*
|
|
9
|
+
* Callback is called only once by default (can be changed using the `once` parameter).
|
|
10
|
+
* @returns a callback ref that needs to be set on the element you want to observe.
|
|
11
|
+
* @private
|
|
11
12
|
* @example
|
|
12
13
|
* const onIntersection = React.useCallback(() => {
|
|
13
14
|
* console.log('Element is in viewport!');
|
|
@@ -15,8 +16,9 @@ import { getWindow } from '../functions/dom';
|
|
|
15
16
|
* const ref = useIntersection(onIntersection);
|
|
16
17
|
* return (<div ref={ref}>One of many elements</div>);
|
|
17
18
|
*/
|
|
18
|
-
export var useIntersection = function (onIntersect, options) {
|
|
19
|
+
export var useIntersection = function (onIntersect, options, once) {
|
|
19
20
|
if (options === void 0) { options = {}; }
|
|
21
|
+
if (once === void 0) { once = true; }
|
|
20
22
|
var root = options.root, rootMargin = options.rootMargin, threshold = options.threshold;
|
|
21
23
|
var observer = React.useRef();
|
|
22
24
|
var setRef = React.useCallback(function (node) {
|
|
@@ -33,11 +35,14 @@ export var useIntersection = function (onIntersect, options) {
|
|
|
33
35
|
observer.current = new IntersectionObserver(function (_a, obs) {
|
|
34
36
|
var entry = _a[0];
|
|
35
37
|
if (entry.isIntersecting) {
|
|
36
|
-
|
|
38
|
+
if (once) {
|
|
39
|
+
obs.disconnect();
|
|
40
|
+
}
|
|
37
41
|
onIntersect();
|
|
38
42
|
}
|
|
39
43
|
}, { root: root, rootMargin: rootMargin, threshold: threshold });
|
|
40
44
|
observer.current.observe(node);
|
|
41
|
-
}, [onIntersect, root, rootMargin, threshold]);
|
|
45
|
+
}, [onIntersect, once, root, rootMargin, threshold]);
|
|
46
|
+
React.useEffect(function () { return function () { var _a; return (_a = observer.current) === null || _a === void 0 ? void 0 : _a.disconnect(); }; }, []);
|
|
42
47
|
return setRef;
|
|
43
48
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Hook that observes the size of an element and returns the number of items
|
|
4
|
-
* that should be visible based on the
|
|
4
|
+
* that should be visible based on the size of the container element.
|
|
5
5
|
*
|
|
6
6
|
* The returned number should be used to render the element with fewer items.
|
|
7
7
|
*
|
|
8
8
|
* @private
|
|
9
9
|
* @param items Items that this element contains.
|
|
10
10
|
* @param disabled Set to true to disconnect the observer.
|
|
11
|
+
* @param dimension 'horizontal' (default) or 'vertical'
|
|
11
12
|
* @returns [callback ref to set on container, stateful count of visible items]
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
@@ -20,4 +21,4 @@ import React from 'react';
|
|
|
20
21
|
* </div>
|
|
21
22
|
* );
|
|
22
23
|
*/
|
|
23
|
-
export declare const useOverflow: <T extends HTMLElement>(items: React.ReactNode[] | string, disabled?: boolean) => readonly [(instance: T | null) => void, number];
|
|
24
|
+
export declare const useOverflow: <T extends HTMLElement>(items: React.ReactNode[] | string, disabled?: boolean, orientation?: 'horizontal' | 'vertical') => readonly [(instance: T | null) => void, number];
|
|
@@ -8,13 +8,14 @@ import { useResizeObserver } from './useResizeObserver';
|
|
|
8
8
|
var STARTING_MAX_ITEMS_COUNT = 20;
|
|
9
9
|
/**
|
|
10
10
|
* Hook that observes the size of an element and returns the number of items
|
|
11
|
-
* that should be visible based on the
|
|
11
|
+
* that should be visible based on the size of the container element.
|
|
12
12
|
*
|
|
13
13
|
* The returned number should be used to render the element with fewer items.
|
|
14
14
|
*
|
|
15
15
|
* @private
|
|
16
16
|
* @param items Items that this element contains.
|
|
17
17
|
* @param disabled Set to true to disconnect the observer.
|
|
18
|
+
* @param dimension 'horizontal' (default) or 'vertical'
|
|
18
19
|
* @returns [callback ref to set on container, stateful count of visible items]
|
|
19
20
|
*
|
|
20
21
|
* @example
|
|
@@ -27,20 +28,21 @@ var STARTING_MAX_ITEMS_COUNT = 20;
|
|
|
27
28
|
* </div>
|
|
28
29
|
* );
|
|
29
30
|
*/
|
|
30
|
-
export var useOverflow = function (items, disabled) {
|
|
31
|
+
export var useOverflow = function (items, disabled, orientation) {
|
|
31
32
|
if (disabled === void 0) { disabled = false; }
|
|
33
|
+
if (orientation === void 0) { orientation = 'horizontal'; }
|
|
32
34
|
var containerRef = React.useRef(null);
|
|
33
35
|
var _a = React.useState(function () {
|
|
34
36
|
return disabled ? items.length : Math.min(items.length, STARTING_MAX_ITEMS_COUNT);
|
|
35
37
|
}), visibleCount = _a[0], setVisibleCount = _a[1];
|
|
36
38
|
var needsFullRerender = React.useRef(true);
|
|
37
|
-
var _b = React.useState(0),
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var width = _a.width;
|
|
41
|
-
return
|
|
42
|
-
}, []);
|
|
43
|
-
var _c = useResizeObserver(
|
|
39
|
+
var _b = React.useState(0), containerSize = _b[0], setContainerSize = _b[1];
|
|
40
|
+
var previousContainerSize = React.useRef(0);
|
|
41
|
+
var updateContainerSize = React.useCallback(function (_a) {
|
|
42
|
+
var width = _a.width, height = _a.height;
|
|
43
|
+
return setContainerSize(orientation === 'horizontal' ? width : height);
|
|
44
|
+
}, [orientation]);
|
|
45
|
+
var _c = useResizeObserver(updateContainerSize), resizeRef = _c[0], observer = _c[1];
|
|
44
46
|
var resizeObserverRef = React.useRef(observer);
|
|
45
47
|
React.useLayoutEffect(function () {
|
|
46
48
|
if (disabled) {
|
|
@@ -50,7 +52,7 @@ export var useOverflow = function (items, disabled) {
|
|
|
50
52
|
setVisibleCount(Math.min(items.length, STARTING_MAX_ITEMS_COUNT));
|
|
51
53
|
needsFullRerender.current = true;
|
|
52
54
|
}
|
|
53
|
-
}, [
|
|
55
|
+
}, [containerSize, disabled, items]);
|
|
54
56
|
var mergedRefs = useMergedRefs(containerRef, resizeRef);
|
|
55
57
|
React.useLayoutEffect(function () {
|
|
56
58
|
var _a;
|
|
@@ -58,24 +60,25 @@ export var useOverflow = function (items, disabled) {
|
|
|
58
60
|
(_a = resizeObserverRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var
|
|
63
|
+
var dimension = orientation === 'horizontal' ? 'Width' : 'Height';
|
|
64
|
+
var availableSize = containerRef.current["offset" + dimension];
|
|
65
|
+
var requiredSize = containerRef.current["scroll" + dimension];
|
|
66
|
+
if (availableSize < requiredSize) {
|
|
67
|
+
var avgItemSize = requiredSize / visibleCount;
|
|
68
|
+
var visibleItems = Math.floor(availableSize / avgItemSize);
|
|
66
69
|
setVisibleCount(visibleItems);
|
|
67
70
|
}
|
|
68
71
|
else if (needsFullRerender.current) {
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var visibleItems = Math.floor(
|
|
72
|
+
var childrenSize = Array.from(containerRef.current.children).reduce(function (sum, child) { return sum + child["offset" + dimension]; }, 0);
|
|
73
|
+
var avgItemSize = childrenSize / visibleCount;
|
|
74
|
+
var visibleItems = Math.floor(availableSize / avgItemSize);
|
|
72
75
|
// Doubling the visible items to overflow the container. Just to be safe.
|
|
73
76
|
setVisibleCount(Math.min(items.length, visibleItems * 2));
|
|
74
77
|
}
|
|
75
78
|
needsFullRerender.current = false;
|
|
76
|
-
}, [
|
|
79
|
+
}, [containerSize, visibleCount, disabled, items.length, orientation]);
|
|
77
80
|
React.useLayoutEffect(function () {
|
|
78
|
-
|
|
79
|
-
}, [
|
|
81
|
+
previousContainerSize.current = containerSize;
|
|
82
|
+
}, [containerSize]);
|
|
80
83
|
return [mergedRefs, visibleCount];
|
|
81
84
|
};
|
|
@@ -32,6 +32,7 @@ declare module 'react-table' {
|
|
|
32
32
|
isResizingColumn?: string;
|
|
33
33
|
};
|
|
34
34
|
isTableResizing?: boolean;
|
|
35
|
+
columnReorderStartIndex: number;
|
|
35
36
|
}
|
|
36
37
|
interface ColumnInterface<D extends object = {}> extends UseSortByColumnOptions<D>, UseFiltersColumnOptions<D>, UseResizeColumnsColumnOptions<D> {
|
|
37
38
|
/**
|
|
@@ -67,11 +68,17 @@ declare module 'react-table' {
|
|
|
67
68
|
* }
|
|
68
69
|
*/
|
|
69
70
|
cellRenderer?: (props: CellRendererProps<D>) => React.ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* If true, column can't be reordered.
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
disableReordering?: boolean;
|
|
70
76
|
}
|
|
71
77
|
interface ColumnInstance<D extends object = {}> extends UseFiltersColumnProps<D>, UseGroupByColumnProps<D>, UseResizeColumnsColumnProps<D>, UseSortByColumnProps<D> {
|
|
72
78
|
originalWidth: number;
|
|
73
79
|
resizeWidth?: number;
|
|
74
80
|
isResizerVisible?: boolean;
|
|
81
|
+
getDragAndDropProps: () => TableKeyedProps;
|
|
75
82
|
}
|
|
76
83
|
interface Cell<D extends object = {}> extends UseGroupByCellProps<D>, UseRowStateCellProps<D> {
|
|
77
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/itwinui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"author": "Bentley Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"build-storybook": "build-storybook"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@itwin/itwinui-css": "^0.
|
|
43
|
+
"@itwin/itwinui-css": "^0.52.0",
|
|
44
44
|
"@itwin/itwinui-icons-react": "^1.5.0",
|
|
45
45
|
"@itwin/itwinui-illustrations-react": "^1.0.1",
|
|
46
46
|
"@tippyjs/react": "^4.2.5",
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@babel/core": "^7.12.10",
|
|
54
|
-
"@storybook/addon-essentials": "~6.
|
|
55
|
-
"@storybook/addon-storysource": "~6.
|
|
56
|
-
"@storybook/addons": "~6.
|
|
57
|
-
"@storybook/api": "~6.
|
|
58
|
-
"@storybook/builder-webpack5": "~6.
|
|
59
|
-
"@storybook/components": "~6.
|
|
60
|
-
"@storybook/core-events": "~6.
|
|
61
|
-
"@storybook/manager-webpack5": "~6.
|
|
54
|
+
"@storybook/addon-essentials": "~6.4.19",
|
|
55
|
+
"@storybook/addon-storysource": "~6.4.19",
|
|
56
|
+
"@storybook/addons": "~6.4.19",
|
|
57
|
+
"@storybook/api": "~6.4.19",
|
|
58
|
+
"@storybook/builder-webpack5": "~6.4.19",
|
|
59
|
+
"@storybook/components": "~6.4.19",
|
|
60
|
+
"@storybook/core-events": "~6.4.19",
|
|
61
|
+
"@storybook/manager-webpack5": "~6.4.19",
|
|
62
62
|
"@storybook/preset-typescript": "^3.0.0",
|
|
63
|
-
"@storybook/react": "~6.
|
|
64
|
-
"@storybook/theming": "~6.
|
|
63
|
+
"@storybook/react": "~6.4.19",
|
|
64
|
+
"@storybook/theming": "~6.4.19",
|
|
65
65
|
"@testing-library/jest-dom": "^5.14.1",
|
|
66
66
|
"@testing-library/react": "^12.0.0",
|
|
67
67
|
"@testing-library/react-hooks": "^7.0.1",
|
|
@@ -77,12 +77,13 @@
|
|
|
77
77
|
"babel-loader": "^8.2.2",
|
|
78
78
|
"concurrently": "^5.3.0",
|
|
79
79
|
"cpx": "^1.5.0",
|
|
80
|
-
"creevey": "^0.
|
|
80
|
+
"creevey": "^0.8.0-beta.0",
|
|
81
81
|
"eslint": "^7.32.0",
|
|
82
82
|
"eslint-config-prettier": "^8.3.0",
|
|
83
83
|
"eslint-plugin-prettier": "^4.0.0",
|
|
84
84
|
"eslint-plugin-react": "^7.25.1",
|
|
85
85
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
86
|
+
"eslint-plugin-storybook": "^0.5.7",
|
|
86
87
|
"fast-glob": "^3.2.5",
|
|
87
88
|
"husky": "^4.0.0",
|
|
88
89
|
"inquirer": "^6.2.2",
|
|
@@ -96,7 +97,7 @@
|
|
|
96
97
|
"react": "^17.0.2",
|
|
97
98
|
"react-dom": "^17.0.2",
|
|
98
99
|
"rimraf": "^2.6.2",
|
|
99
|
-
"storybook-dark-mode": "^1.0.
|
|
100
|
+
"storybook-dark-mode": "^1.0.9",
|
|
100
101
|
"tippy.js": "^6.3.1",
|
|
101
102
|
"ts-jest": "^27.0.4",
|
|
102
103
|
"ts-loader": "^8.0.1",
|