@itwin/itwinui-react 3.13.4 → 3.14.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 +45 -0
- package/DEV-cjs/core/Alert/Alert.js +125 -72
- package/DEV-cjs/core/Avatar/Avatar.js +70 -44
- package/DEV-cjs/core/AvatarGroup/AvatarGroup.js +71 -34
- package/DEV-cjs/core/Backdrop/Backdrop.js +26 -22
- package/DEV-cjs/core/Badge/Badge.js +49 -42
- package/DEV-cjs/core/Breadcrumbs/Breadcrumbs.js +164 -85
- package/DEV-cjs/core/ButtonGroup/ButtonGroup.js +141 -79
- package/DEV-cjs/core/Buttons/Button.js +95 -49
- package/DEV-cjs/core/Buttons/DropdownButton.js +53 -35
- package/DEV-cjs/core/Buttons/IconButton.js +77 -41
- package/DEV-cjs/core/Buttons/IdeasButton.js +30 -26
- package/DEV-cjs/core/Buttons/SplitButton.js +90 -56
- package/DEV-cjs/core/Carousel/Carousel.js +77 -67
- package/DEV-cjs/core/Carousel/CarouselContext.js +10 -10
- package/DEV-cjs/core/Carousel/CarouselDot.js +31 -27
- package/DEV-cjs/core/Carousel/CarouselDotsList.js +148 -113
- package/DEV-cjs/core/Carousel/CarouselNavigation.js +98 -69
- package/DEV-cjs/core/Carousel/CarouselSlide.js +51 -42
- package/DEV-cjs/core/Carousel/CarouselSlider.js +68 -61
- package/DEV-cjs/core/Checkbox/Checkbox.js +96 -54
- package/DEV-cjs/core/ColorPicker/ColorBuilder.js +274 -228
- package/DEV-cjs/core/ColorPicker/ColorInputPanel.js +398 -366
- package/DEV-cjs/core/ColorPicker/ColorPalette.js +56 -36
- package/DEV-cjs/core/ColorPicker/ColorPicker.js +88 -69
- package/DEV-cjs/core/ColorPicker/ColorPickerContext.js +22 -18
- package/DEV-cjs/core/ColorPicker/ColorSwatch.js +50 -33
- package/DEV-cjs/core/ComboBox/ComboBox.js +395 -294
- package/DEV-cjs/core/ComboBox/ComboBox.types-test.js +87 -80
- package/DEV-cjs/core/ComboBox/ComboBoxEndIcon.js +36 -27
- package/DEV-cjs/core/ComboBox/ComboBoxInput.js +190 -128
- package/DEV-cjs/core/ComboBox/ComboBoxInputContainer.js +40 -28
- package/DEV-cjs/core/ComboBox/ComboBoxMenu.js +132 -93
- package/DEV-cjs/core/ComboBox/ComboBoxMenuItem.js +75 -34
- package/DEV-cjs/core/ComboBox/ComboBoxMultipleContainer.js +18 -18
- package/DEV-cjs/core/ComboBox/helpers.js +15 -14
- package/DEV-cjs/core/DatePicker/DatePicker.js +556 -353
- package/DEV-cjs/core/Dialog/Dialog.js +86 -58
- package/DEV-cjs/core/Dialog/DialogBackdrop.js +52 -39
- package/DEV-cjs/core/Dialog/DialogButtonBar.js +9 -9
- package/DEV-cjs/core/Dialog/DialogContent.js +9 -9
- package/DEV-cjs/core/Dialog/DialogContext.js +16 -15
- package/DEV-cjs/core/Dialog/DialogDragContext.js +20 -19
- package/DEV-cjs/core/Dialog/DialogMain.js +174 -122
- package/DEV-cjs/core/Dialog/DialogTitleBar.js +68 -33
- package/DEV-cjs/core/Dialog/DialogTitleBarTitle.js +9 -9
- package/DEV-cjs/core/Divider/Divider.js +22 -22
- package/DEV-cjs/core/DropdownMenu/DropdownMenu.js +63 -37
- package/DEV-cjs/core/ExpandableBlock/ExpandableBlock.js +195 -125
- package/DEV-cjs/core/Fieldset/Fieldset.js +34 -23
- package/DEV-cjs/core/FileUpload/FileEmptyCard.js +43 -24
- package/DEV-cjs/core/FileUpload/FileUpload.js +94 -57
- package/DEV-cjs/core/FileUpload/FileUploadCard.js +181 -124
- package/DEV-cjs/core/FileUpload/FileUploadTemplate.js +63 -35
- package/DEV-cjs/core/Flex/Flex.js +78 -77
- package/DEV-cjs/core/Footer/Footer.js +119 -85
- package/DEV-cjs/core/Footer/FooterItem.js +9 -9
- package/DEV-cjs/core/Footer/FooterList.js +9 -9
- package/DEV-cjs/core/Footer/FooterSeparator.js +10 -10
- package/DEV-cjs/core/Header/Header.js +86 -44
- package/DEV-cjs/core/Header/HeaderBasicButton.js +30 -20
- package/DEV-cjs/core/Header/HeaderBreadcrumbs.js +59 -36
- package/DEV-cjs/core/Header/HeaderButton.js +90 -46
- package/DEV-cjs/core/Header/HeaderDropdownButton.js +55 -44
- package/DEV-cjs/core/Header/HeaderLogo.js +53 -30
- package/DEV-cjs/core/Header/HeaderSplitButton.js +72 -44
- package/DEV-cjs/core/Icon/Icon.js +41 -35
- package/DEV-cjs/core/InformationPanel/InformationPanel.js +97 -62
- package/DEV-cjs/core/InformationPanel/InformationPanelBody.js +9 -9
- package/DEV-cjs/core/InformationPanel/InformationPanelContent.js +30 -22
- package/DEV-cjs/core/InformationPanel/InformationPanelHeader.js +51 -32
- package/DEV-cjs/core/InformationPanel/InformationPanelWrapper.js +12 -10
- package/DEV-cjs/core/Input/Input.js +26 -26
- package/DEV-cjs/core/InputGrid/InputGrid.js +151 -117
- package/DEV-cjs/core/InputGroup/InputGroup.js +85 -48
- package/DEV-cjs/core/InputWithDecorations/InputWithDecorations.js +60 -44
- package/DEV-cjs/core/Label/Label.js +40 -25
- package/DEV-cjs/core/LabeledInput/LabeledInput.js +86 -42
- package/DEV-cjs/core/LabeledSelect/LabeledSelect.js +71 -39
- package/DEV-cjs/core/LabeledSelect/LabeledSelect.types-test.js +100 -81
- package/DEV-cjs/core/LabeledTextarea/LabeledTextarea.js +19 -17
- package/DEV-cjs/core/LinkAction/LinkAction.js +27 -26
- package/DEV-cjs/core/List/List.js +11 -11
- package/DEV-cjs/core/List/ListItem.js +42 -34
- package/DEV-cjs/core/Menu/Menu.js +213 -127
- package/DEV-cjs/core/Menu/MenuDivider.js +11 -11
- package/DEV-cjs/core/Menu/MenuExtraContent.js +10 -10
- package/DEV-cjs/core/Menu/MenuItem.js +139 -76
- package/DEV-cjs/core/Menu/MenuItemSkeleton.js +65 -40
- package/DEV-cjs/core/Modal/Modal.js +54 -31
- package/DEV-cjs/core/Modal/ModalButtonBar.js +9 -9
- package/DEV-cjs/core/Modal/ModalContent.js +9 -9
- package/DEV-cjs/core/NonIdealState/ErrorPage.js +208 -127
- package/DEV-cjs/core/NonIdealState/NonIdealState.js +84 -35
- package/DEV-cjs/core/NotificationMarker/NotificationMarker.js +39 -25
- package/DEV-cjs/core/Overlay/Overlay.js +55 -41
- package/DEV-cjs/core/Popover/Popover.js +302 -193
- package/DEV-cjs/core/ProgressIndicators/ProgressLinear.js +70 -33
- package/DEV-cjs/core/ProgressIndicators/ProgressRadial.js +67 -40
- package/DEV-cjs/core/Radio/Radio.js +66 -38
- package/DEV-cjs/core/RadioTiles/RadioTile.js +88 -43
- package/DEV-cjs/core/RadioTiles/RadioTileGroup.js +29 -21
- package/DEV-cjs/core/SearchBox/SearchBox.js +203 -130
- package/DEV-cjs/core/Select/Select.js +457 -274
- package/DEV-cjs/core/Select/Select.types-test.js +112 -87
- package/DEV-cjs/core/Select/SelectTag.js +32 -24
- package/DEV-cjs/core/Select/SelectTagContainer.js +38 -25
- package/DEV-cjs/core/SideNavigation/SideNavigation.js +132 -64
- package/DEV-cjs/core/SideNavigation/SidenavButton.js +55 -33
- package/DEV-cjs/core/SideNavigation/SidenavSubmenu.js +33 -22
- package/DEV-cjs/core/SideNavigation/SidenavSubmenuHeader.js +41 -24
- package/DEV-cjs/core/SkipToContentLink/SkipToContentLink.js +28 -21
- package/DEV-cjs/core/Slider/Slider.js +352 -259
- package/DEV-cjs/core/Slider/Thumb.js +111 -98
- package/DEV-cjs/core/Slider/Track.js +93 -61
- package/DEV-cjs/core/StatusMessage/StatusMessage.js +46 -27
- package/DEV-cjs/core/Stepper/Stepper.js +86 -44
- package/DEV-cjs/core/Stepper/StepperStep.js +113 -59
- package/DEV-cjs/core/Stepper/WorkflowDiagram.js +37 -29
- package/DEV-cjs/core/Stepper/WorkflowDiagramStep.js +48 -28
- package/DEV-cjs/core/Surface/Surface.js +98 -76
- package/DEV-cjs/core/Table/ColumnHeader.js +194 -0
- package/DEV-cjs/core/Table/SubRowExpander.js +45 -34
- package/DEV-cjs/core/Table/Table.js +687 -510
- package/DEV-cjs/core/Table/TableCell.js +104 -61
- package/DEV-cjs/core/Table/TablePaginator.js +314 -178
- package/DEV-cjs/core/Table/TableRowMemoized.js +183 -90
- package/DEV-cjs/core/Table/actionHandlers/expandHandler.js +18 -18
- package/DEV-cjs/core/Table/actionHandlers/filterHandler.js +31 -23
- package/DEV-cjs/core/Table/actionHandlers/index.js +32 -31
- package/DEV-cjs/core/Table/actionHandlers/resizeHandler.js +26 -25
- package/DEV-cjs/core/Table/actionHandlers/selectHandler.js +124 -88
- package/DEV-cjs/core/Table/cells/DefaultCell.js +93 -44
- package/DEV-cjs/core/Table/cells/EditableCell.js +85 -63
- package/DEV-cjs/core/Table/cells/index.js +15 -14
- package/DEV-cjs/core/Table/columns/actionColumn.js +100 -78
- package/DEV-cjs/core/Table/columns/expanderColumn.js +56 -49
- package/DEV-cjs/core/Table/columns/index.js +25 -24
- package/DEV-cjs/core/Table/columns/selectionColumn.js +79 -58
- package/DEV-cjs/core/Table/filters/BaseFilter.js +31 -25
- package/DEV-cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +108 -72
- package/DEV-cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +115 -91
- package/DEV-cjs/core/Table/filters/FilterButtonBar.js +56 -33
- package/DEV-cjs/core/Table/filters/FilterToggle.js +71 -54
- package/DEV-cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +56 -60
- package/DEV-cjs/core/Table/filters/TextFilter/TextFilter.js +38 -36
- package/DEV-cjs/core/Table/filters/customFilterFunctions.js +26 -20
- package/DEV-cjs/core/Table/filters/defaultFilterFunctions.js +119 -77
- package/DEV-cjs/core/Table/filters/index.js +23 -22
- package/DEV-cjs/core/Table/filters/tableFilters.js +28 -25
- package/DEV-cjs/core/Table/filters/types.js +3 -3
- package/DEV-cjs/core/Table/hooks/index.js +39 -38
- package/DEV-cjs/core/Table/hooks/useColumnDragAndDrop.js +118 -101
- package/DEV-cjs/core/Table/hooks/useExpanderCell.js +39 -29
- package/DEV-cjs/core/Table/hooks/useResizeColumns.js +346 -248
- package/DEV-cjs/core/Table/hooks/useScrollToRow.js +42 -38
- package/DEV-cjs/core/Table/hooks/useSelectionCell.js +26 -19
- package/DEV-cjs/core/Table/hooks/useStickyColumns.js +55 -47
- package/DEV-cjs/core/Table/hooks/useSubRowFiltering.js +89 -86
- package/DEV-cjs/core/Table/hooks/useSubRowSelection.js +39 -39
- package/DEV-cjs/core/Table/index.js +42 -41
- package/DEV-cjs/core/Table/utils.js +66 -64
- package/DEV-cjs/core/Tabs/Tabs.js +388 -260
- package/DEV-cjs/core/Tag/Tag.js +80 -42
- package/DEV-cjs/core/Tag/TagContainer.js +31 -23
- package/DEV-cjs/core/Textarea/Textarea.js +19 -17
- package/DEV-cjs/core/ThemeProvider/ThemeContext.js +10 -10
- package/DEV-cjs/core/ThemeProvider/ThemeProvider.js +276 -172
- package/DEV-cjs/core/Tile/Tile.js +310 -173
- package/DEV-cjs/core/TimePicker/TimePicker.js +451 -263
- package/DEV-cjs/core/Toast/Toast.js +226 -157
- package/DEV-cjs/core/Toast/Toaster.js +142 -118
- package/DEV-cjs/core/ToggleSwitch/ToggleSwitch.js +76 -42
- package/DEV-cjs/core/Tooltip/Tooltip.js +221 -170
- package/DEV-cjs/core/TransferList/TransferList.js +171 -132
- package/DEV-cjs/core/Tree/Tree.js +226 -180
- package/DEV-cjs/core/Tree/TreeContext.js +20 -18
- package/DEV-cjs/core/Tree/TreeNode.js +254 -143
- package/DEV-cjs/core/Tree/TreeNodeExpander.js +40 -31
- package/DEV-cjs/core/Typography/Anchor.js +41 -27
- package/DEV-cjs/core/Typography/Blockquote.js +26 -21
- package/DEV-cjs/core/Typography/Code.js +9 -9
- package/DEV-cjs/core/Typography/Kbd.js +43 -38
- package/DEV-cjs/core/Typography/Text.js +45 -31
- package/DEV-cjs/core/VisuallyHidden/VisuallyHidden.js +47 -30
- package/DEV-cjs/index.js +475 -474
- package/DEV-cjs/package.json +1 -0
- package/DEV-cjs/react-table/react-table.js +3 -3
- package/DEV-cjs/react-table/react-table.types-test.js +628 -476
- package/DEV-cjs/styles.js +17 -1
- package/DEV-cjs/utils/color/ColorValue.js +429 -323
- package/DEV-cjs/utils/color/index.js +5 -5
- package/DEV-cjs/utils/components/AutoclearingHiddenLiveRegion.js +31 -26
- package/DEV-cjs/utils/components/Box.js +9 -9
- package/DEV-cjs/utils/components/ButtonBase.js +41 -35
- package/DEV-cjs/utils/components/FieldsetBase.js +9 -9
- package/DEV-cjs/utils/components/FocusTrap.js +48 -45
- package/DEV-cjs/utils/components/InputContainer.js +67 -34
- package/DEV-cjs/utils/components/InputFlexContainer.js +63 -49
- package/DEV-cjs/utils/components/InputWithIcon.js +9 -9
- package/DEV-cjs/utils/components/LineClamp.js +33 -24
- package/DEV-cjs/utils/components/MiddleTextTruncation.js +37 -33
- package/DEV-cjs/utils/components/Portal.js +35 -32
- package/DEV-cjs/utils/components/Resizer.js +221 -185
- package/DEV-cjs/utils/components/ShadowRoot.js +85 -69
- package/DEV-cjs/utils/components/WithCSSTransition.js +57 -50
- package/DEV-cjs/utils/components/index.js +18 -18
- package/DEV-cjs/utils/functions/colors.js +37 -35
- package/DEV-cjs/utils/functions/date.js +15 -15
- package/DEV-cjs/utils/functions/dev.js +25 -19
- package/DEV-cjs/utils/functions/dom.js +39 -39
- package/DEV-cjs/utils/functions/focusable.js +81 -63
- package/DEV-cjs/utils/functions/import.js +28 -22
- package/DEV-cjs/utils/functions/index.js +14 -14
- package/DEV-cjs/utils/functions/numbers.js +26 -24
- package/DEV-cjs/utils/functions/polymorphic.js +56 -43
- package/DEV-cjs/utils/functions/react.js +25 -23
- package/DEV-cjs/utils/functions/supports.js +11 -10
- package/DEV-cjs/utils/hooks/index.js +20 -20
- package/DEV-cjs/utils/hooks/useContainerWidth.js +31 -26
- package/DEV-cjs/utils/hooks/useControlledState.js +28 -27
- package/DEV-cjs/utils/hooks/useDragAndDrop.js +112 -88
- package/DEV-cjs/utils/hooks/useEventListener.js +23 -28
- package/DEV-cjs/utils/hooks/useGlobals.js +46 -40
- package/DEV-cjs/utils/hooks/useId.js +17 -17
- package/DEV-cjs/utils/hooks/useIntersection.js +38 -38
- package/DEV-cjs/utils/hooks/useIsClient.js +16 -16
- package/DEV-cjs/utils/hooks/useIsomorphicLayoutEffect.js +12 -11
- package/DEV-cjs/utils/hooks/useLatestRef.js +16 -18
- package/DEV-cjs/utils/hooks/useMediaQuery.js +32 -23
- package/DEV-cjs/utils/hooks/useMergedRefs.js +25 -23
- package/DEV-cjs/utils/hooks/useOverflow.js +68 -72
- package/DEV-cjs/utils/hooks/useResizeObserver.js +31 -33
- package/DEV-cjs/utils/hooks/useSafeContext.js +15 -14
- package/DEV-cjs/utils/hooks/useSyncExternalStore.js +37 -40
- package/DEV-cjs/utils/hooks/useVirtualScroll.js +42 -40
- package/DEV-cjs/utils/icons/StatusIconMap.js +34 -30
- package/DEV-cjs/utils/icons/Svg.js +12 -12
- package/DEV-cjs/utils/icons/SvgCalendar.js +19 -14
- package/DEV-cjs/utils/icons/SvgCaretDownSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgCaretRightSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgCaretUpSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgCheckmark.js +19 -14
- package/DEV-cjs/utils/icons/SvgCheckmarkSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronLeft.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronLeftDouble.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronRight.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronRightDouble.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronRightSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgClose.js +19 -14
- package/DEV-cjs/utils/icons/SvgCloseSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgColumnManager.js +19 -14
- package/DEV-cjs/utils/icons/SvgDocument.js +19 -14
- package/DEV-cjs/utils/icons/SvgFilter.js +19 -14
- package/DEV-cjs/utils/icons/SvgFilterHollow.js +19 -14
- package/DEV-cjs/utils/icons/SvgImportantSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgInfoCircular.js +19 -14
- package/DEV-cjs/utils/icons/SvgMore.js +19 -14
- package/DEV-cjs/utils/icons/SvgMoreVertical.js +19 -14
- package/DEV-cjs/utils/icons/SvgNew.js +19 -14
- package/DEV-cjs/utils/icons/SvgSearch.js +19 -14
- package/DEV-cjs/utils/icons/SvgSmileyHappy.js +19 -14
- package/DEV-cjs/utils/icons/SvgSortDown.js +19 -14
- package/DEV-cjs/utils/icons/SvgSortUp.js +19 -14
- package/DEV-cjs/utils/icons/SvgStatusError.js +19 -14
- package/DEV-cjs/utils/icons/SvgStatusSuccess.js +19 -14
- package/DEV-cjs/utils/icons/SvgStatusWarning.js +19 -14
- package/DEV-cjs/utils/icons/SvgSwap.js +19 -14
- package/DEV-cjs/utils/icons/SvgUpload.js +19 -14
- package/DEV-cjs/utils/icons/index.js +36 -36
- package/DEV-cjs/utils/index.js +12 -12
- package/DEV-cjs/utils/meta.js +11 -11
- package/DEV-cjs/utils/props.js +3 -3
- package/DEV-cjs/utils/providers/HydrationProvider.js +47 -35
- package/DEV-cjs/utils/providers/ScopeProvider.js +55 -53
- package/DEV-cjs/utils/providers/index.js +6 -6
- package/DEV-cjs/utils/types.js +3 -3
- package/DEV-esm/core/Alert/Alert.js +112 -57
- package/DEV-esm/core/Avatar/Avatar.js +45 -26
- package/DEV-esm/core/AvatarGroup/AvatarGroup.js +58 -21
- package/DEV-esm/core/Backdrop/Backdrop.js +13 -9
- package/DEV-esm/core/Badge/Badge.js +34 -29
- package/DEV-esm/core/Breadcrumbs/Breadcrumbs.js +150 -71
- package/DEV-esm/core/ButtonGroup/ButtonGroup.js +127 -62
- package/DEV-esm/core/Buttons/Button.js +71 -34
- package/DEV-esm/core/Buttons/DropdownButton.js +38 -20
- package/DEV-esm/core/Buttons/IconButton.js +54 -25
- package/DEV-esm/core/Buttons/IdeasButton.js +16 -12
- package/DEV-esm/core/Buttons/SplitButton.js +80 -41
- package/DEV-esm/core/Carousel/Carousel.js +58 -48
- package/DEV-esm/core/Carousel/CarouselDot.js +18 -14
- package/DEV-esm/core/Carousel/CarouselDotsList.js +134 -98
- package/DEV-esm/core/Carousel/CarouselNavigation.js +82 -53
- package/DEV-esm/core/Carousel/CarouselSlide.js +40 -29
- package/DEV-esm/core/Carousel/CarouselSlider.js +59 -48
- package/DEV-esm/core/Checkbox/Checkbox.js +79 -40
- package/DEV-esm/core/ColorPicker/ColorBuilder.js +263 -214
- package/DEV-esm/core/ColorPicker/ColorInputPanel.js +382 -350
- package/DEV-esm/core/ColorPicker/ColorPalette.js +37 -20
- package/DEV-esm/core/ColorPicker/ColorPicker.js +69 -51
- package/DEV-esm/core/ColorPicker/ColorPickerContext.js +7 -4
- package/DEV-esm/core/ColorPicker/ColorSwatch.js +29 -18
- package/DEV-esm/core/ComboBox/ComboBox.js +382 -274
- package/DEV-esm/core/ComboBox/ComboBox.types-test.js +82 -75
- package/DEV-esm/core/ComboBox/ComboBoxEndIcon.js +22 -13
- package/DEV-esm/core/ComboBox/ComboBoxInput.js +170 -114
- package/DEV-esm/core/ComboBox/ComboBoxInputContainer.js +29 -11
- package/DEV-esm/core/ComboBox/ComboBoxMenu.js +121 -79
- package/DEV-esm/core/ComboBox/ComboBoxMenuItem.js +65 -22
- package/DEV-esm/core/ComboBox/ComboBoxMultipleContainer.js +7 -7
- package/DEV-esm/core/DatePicker/DatePicker.js +527 -335
- package/DEV-esm/core/Dialog/Dialog.js +66 -38
- package/DEV-esm/core/Dialog/DialogBackdrop.js +37 -24
- package/DEV-esm/core/Dialog/DialogContext.js +1 -1
- package/DEV-esm/core/Dialog/DialogDragContext.js +5 -5
- package/DEV-esm/core/Dialog/DialogMain.js +166 -106
- package/DEV-esm/core/Dialog/DialogTitleBar.js +43 -15
- package/DEV-esm/core/Divider/Divider.js +9 -9
- package/DEV-esm/core/DropdownMenu/DropdownMenu.js +50 -24
- package/DEV-esm/core/ExpandableBlock/ExpandableBlock.js +177 -110
- package/DEV-esm/core/Fieldset/Fieldset.js +21 -10
- package/DEV-esm/core/FileUpload/FileEmptyCard.js +25 -10
- package/DEV-esm/core/FileUpload/FileUpload.js +66 -44
- package/DEV-esm/core/FileUpload/FileUploadCard.js +163 -105
- package/DEV-esm/core/FileUpload/FileUploadTemplate.js +46 -21
- package/DEV-esm/core/Flex/Flex.js +65 -64
- package/DEV-esm/core/Footer/Footer.js +96 -64
- package/DEV-esm/core/Footer/FooterSeparator.js +1 -1
- package/DEV-esm/core/Header/Header.js +71 -29
- package/DEV-esm/core/Header/HeaderBasicButton.js +14 -7
- package/DEV-esm/core/Header/HeaderBreadcrumbs.js +39 -23
- package/DEV-esm/core/Header/HeaderButton.js +70 -32
- package/DEV-esm/core/Header/HeaderDropdownButton.js +41 -29
- package/DEV-esm/core/Header/HeaderLogo.js +40 -17
- package/DEV-esm/core/Header/HeaderSplitButton.js +60 -30
- package/DEV-esm/core/Icon/Icon.js +28 -22
- package/DEV-esm/core/InformationPanel/InformationPanel.js +84 -49
- package/DEV-esm/core/InformationPanel/InformationPanelContent.js +18 -8
- package/DEV-esm/core/InformationPanel/InformationPanelHeader.js +37 -16
- package/DEV-esm/core/InformationPanel/InformationPanelWrapper.js +3 -1
- package/DEV-esm/core/Input/Input.js +13 -13
- package/DEV-esm/core/InputGrid/InputGrid.js +128 -98
- package/DEV-esm/core/InputGroup/InputGroup.js +66 -32
- package/DEV-esm/core/InputWithDecorations/InputWithDecorations.js +59 -34
- package/DEV-esm/core/Label/Label.js +27 -12
- package/DEV-esm/core/LabeledInput/LabeledInput.js +65 -24
- package/DEV-esm/core/LabeledSelect/LabeledSelect.js +57 -25
- package/DEV-esm/core/LabeledSelect/LabeledSelect.types-test.js +95 -76
- package/DEV-esm/core/LabeledTextarea/LabeledTextarea.js +8 -6
- package/DEV-esm/core/LinkAction/LinkAction.js +8 -8
- package/DEV-esm/core/List/List.js +2 -2
- package/DEV-esm/core/List/ListItem.js +28 -20
- package/DEV-esm/core/Menu/Menu.js +207 -111
- package/DEV-esm/core/Menu/MenuDivider.js +2 -2
- package/DEV-esm/core/Menu/MenuExtraContent.js +1 -1
- package/DEV-esm/core/Menu/MenuItem.js +129 -62
- package/DEV-esm/core/Menu/MenuItemSkeleton.js +47 -26
- package/DEV-esm/core/Modal/Modal.js +43 -20
- package/DEV-esm/core/NonIdealState/ErrorPage.js +159 -114
- package/DEV-esm/core/NonIdealState/NonIdealState.js +65 -22
- package/DEV-esm/core/NotificationMarker/NotificationMarker.js +26 -12
- package/DEV-esm/core/Overlay/Overlay.js +44 -30
- package/DEV-esm/core/Popover/Popover.js +306 -172
- package/DEV-esm/core/ProgressIndicators/ProgressLinear.js +52 -19
- package/DEV-esm/core/ProgressIndicators/ProgressRadial.js +52 -27
- package/DEV-esm/core/Radio/Radio.js +50 -25
- package/DEV-esm/core/RadioTiles/RadioTile.js +63 -30
- package/DEV-esm/core/RadioTiles/RadioTileGroup.js +17 -9
- package/DEV-esm/core/SearchBox/SearchBox.js +200 -118
- package/DEV-esm/core/Select/Select.js +434 -256
- package/DEV-esm/core/Select/Select.types-test.js +107 -82
- package/DEV-esm/core/Select/SelectTag.js +19 -11
- package/DEV-esm/core/Select/SelectTagContainer.js +21 -11
- package/DEV-esm/core/SideNavigation/SideNavigation.js +103 -46
- package/DEV-esm/core/SideNavigation/SidenavButton.js +39 -18
- package/DEV-esm/core/SideNavigation/SidenavSubmenu.js +17 -9
- package/DEV-esm/core/SideNavigation/SidenavSubmenuHeader.js +25 -11
- package/DEV-esm/core/SkipToContentLink/SkipToContentLink.js +12 -8
- package/DEV-esm/core/Slider/Slider.js +317 -244
- package/DEV-esm/core/Slider/Thumb.js +97 -84
- package/DEV-esm/core/Slider/Track.js +77 -48
- package/DEV-esm/core/StatusMessage/StatusMessage.js +32 -13
- package/DEV-esm/core/Stepper/Stepper.js +69 -30
- package/DEV-esm/core/Stepper/StepperStep.js +93 -45
- package/DEV-esm/core/Stepper/WorkflowDiagram.js +23 -15
- package/DEV-esm/core/Stepper/WorkflowDiagramStep.js +28 -14
- package/DEV-esm/core/Surface/Surface.js +85 -63
- package/DEV-esm/core/Table/ColumnHeader.js +188 -0
- package/DEV-esm/core/Table/SubRowExpander.js +33 -22
- package/DEV-esm/core/Table/Table.js +694 -490
- package/DEV-esm/core/Table/TableCell.js +80 -44
- package/DEV-esm/core/Table/TablePaginator.js +305 -161
- package/DEV-esm/core/Table/TableRowMemoized.js +167 -73
- package/DEV-esm/core/Table/actionHandlers/expandHandler.js +10 -10
- package/DEV-esm/core/Table/actionHandlers/filterHandler.js +23 -15
- package/DEV-esm/core/Table/actionHandlers/index.js +5 -1
- package/DEV-esm/core/Table/actionHandlers/resizeHandler.js +14 -14
- package/DEV-esm/core/Table/actionHandlers/selectHandler.js +108 -73
- package/DEV-esm/core/Table/cells/DefaultCell.js +79 -30
- package/DEV-esm/core/Table/cells/EditableCell.js +70 -50
- package/DEV-esm/core/Table/columns/actionColumn.js +81 -59
- package/DEV-esm/core/Table/columns/expanderColumn.js +38 -32
- package/DEV-esm/core/Table/columns/selectionColumn.js +62 -42
- package/DEV-esm/core/Table/filters/BaseFilter.js +16 -13
- package/DEV-esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +92 -56
- package/DEV-esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +101 -77
- package/DEV-esm/core/Table/filters/FilterButtonBar.js +42 -19
- package/DEV-esm/core/Table/filters/FilterToggle.js +58 -40
- package/DEV-esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +42 -46
- package/DEV-esm/core/Table/filters/TextFilter/TextFilter.js +24 -22
- package/DEV-esm/core/Table/filters/customFilterFunctions.js +18 -12
- package/DEV-esm/core/Table/filters/defaultFilterFunctions.js +111 -69
- package/DEV-esm/core/Table/filters/tableFilters.js +15 -12
- package/DEV-esm/core/Table/filters/types.js +1 -1
- package/DEV-esm/core/Table/hooks/useColumnDragAndDrop.js +100 -91
- package/DEV-esm/core/Table/hooks/useExpanderCell.js +26 -18
- package/DEV-esm/core/Table/hooks/useResizeColumns.js +333 -238
- package/DEV-esm/core/Table/hooks/useScrollToRow.js +32 -28
- package/DEV-esm/core/Table/hooks/useSelectionCell.js +17 -10
- package/DEV-esm/core/Table/hooks/useStickyColumns.js +46 -38
- package/DEV-esm/core/Table/hooks/useSubRowFiltering.js +78 -75
- package/DEV-esm/core/Table/hooks/useSubRowSelection.js +29 -29
- package/DEV-esm/core/Table/index.js +5 -1
- package/DEV-esm/core/Table/utils.js +45 -44
- package/DEV-esm/core/Tabs/Tabs.js +372 -243
- package/DEV-esm/core/Tag/Tag.js +55 -27
- package/DEV-esm/core/Tag/TagContainer.js +18 -10
- package/DEV-esm/core/Textarea/Textarea.js +8 -6
- package/DEV-esm/core/ThemeProvider/ThemeProvider.js +258 -155
- package/DEV-esm/core/Tile/Tile.js +286 -157
- package/DEV-esm/core/TimePicker/TimePicker.js +438 -250
- package/DEV-esm/core/Toast/Toast.js +199 -138
- package/DEV-esm/core/Toast/Toaster.js +114 -94
- package/DEV-esm/core/ToggleSwitch/ToggleSwitch.js +60 -29
- package/DEV-esm/core/Tooltip/Tooltip.js +229 -159
- package/DEV-esm/core/TransferList/TransferList.js +146 -112
- package/DEV-esm/core/Tree/Tree.js +226 -175
- package/DEV-esm/core/Tree/TreeContext.js +5 -4
- package/DEV-esm/core/Tree/TreeNode.js +226 -129
- package/DEV-esm/core/Tree/TreeNodeExpander.js +24 -16
- package/DEV-esm/core/Typography/Anchor.js +22 -12
- package/DEV-esm/core/Typography/Blockquote.js +13 -8
- package/DEV-esm/core/Typography/Kbd.js +25 -21
- package/DEV-esm/core/Typography/Text.js +27 -14
- package/DEV-esm/core/VisuallyHidden/VisuallyHidden.js +34 -17
- package/DEV-esm/index.js +21 -3
- package/DEV-esm/react-table/react-table.js +1 -1
- package/DEV-esm/react-table/react-table.types-test.js +635 -471
- package/DEV-esm/styles.js +7 -10
- package/DEV-esm/utils/color/ColorValue.js +406 -304
- package/DEV-esm/utils/components/AutoclearingHiddenLiveRegion.js +16 -14
- package/DEV-esm/utils/components/ButtonBase.js +27 -21
- package/DEV-esm/utils/components/FocusTrap.js +36 -33
- package/DEV-esm/utils/components/InputContainer.js +52 -19
- package/DEV-esm/utils/components/InputFlexContainer.js +31 -27
- package/DEV-esm/utils/components/LineClamp.js +21 -12
- package/DEV-esm/utils/components/MiddleTextTruncation.js +26 -22
- package/DEV-esm/utils/components/Portal.js +11 -11
- package/DEV-esm/utils/components/Resizer.js +215 -175
- package/DEV-esm/utils/components/ShadowRoot.js +72 -56
- package/DEV-esm/utils/components/WithCSSTransition.js +45 -38
- package/DEV-esm/utils/functions/colors.js +21 -20
- package/DEV-esm/utils/functions/date.js +7 -7
- package/DEV-esm/utils/functions/dev.js +12 -7
- package/DEV-esm/utils/functions/dom.js +18 -18
- package/DEV-esm/utils/functions/focusable.js +62 -45
- package/DEV-esm/utils/functions/import.js +20 -14
- package/DEV-esm/utils/functions/numbers.js +11 -9
- package/DEV-esm/utils/functions/polymorphic.js +42 -29
- package/DEV-esm/utils/functions/react.js +14 -12
- package/DEV-esm/utils/functions/supports.js +2 -1
- package/DEV-esm/utils/hooks/useContainerWidth.js +14 -14
- package/DEV-esm/utils/hooks/useControlledState.js +18 -17
- package/DEV-esm/utils/hooks/useDragAndDrop.js +100 -76
- package/DEV-esm/utils/hooks/useEventListener.js +13 -18
- package/DEV-esm/utils/hooks/useGlobals.js +29 -24
- package/DEV-esm/utils/hooks/useId.js +5 -6
- package/DEV-esm/utils/hooks/useIntersection.js +27 -27
- package/DEV-esm/utils/hooks/useIsClient.js +6 -6
- package/DEV-esm/utils/hooks/useIsomorphicLayoutEffect.js +2 -1
- package/DEV-esm/utils/hooks/useLatestRef.js +6 -8
- package/DEV-esm/utils/hooks/useMediaQuery.js +17 -12
- package/DEV-esm/utils/hooks/useMergedRefs.js +10 -9
- package/DEV-esm/utils/hooks/useOverflow.js +57 -59
- package/DEV-esm/utils/hooks/useResizeObserver.js +20 -22
- package/DEV-esm/utils/hooks/useSafeContext.js +5 -4
- package/DEV-esm/utils/hooks/useSyncExternalStore.js +27 -30
- package/DEV-esm/utils/hooks/useVirtualScroll.js +31 -29
- package/DEV-esm/utils/icons/StatusIconMap.js +20 -16
- package/DEV-esm/utils/icons/Svg.js +3 -3
- package/DEV-esm/utils/icons/SvgCalendar.js +8 -3
- package/DEV-esm/utils/icons/SvgCaretDownSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgCaretRightSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgCaretUpSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgCheckmark.js +8 -3
- package/DEV-esm/utils/icons/SvgCheckmarkSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronLeft.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronLeftDouble.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronRight.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronRightDouble.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronRightSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgClose.js +8 -3
- package/DEV-esm/utils/icons/SvgCloseSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgColumnManager.js +8 -3
- package/DEV-esm/utils/icons/SvgDocument.js +8 -3
- package/DEV-esm/utils/icons/SvgFilter.js +8 -3
- package/DEV-esm/utils/icons/SvgFilterHollow.js +8 -3
- package/DEV-esm/utils/icons/SvgImportantSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgInfoCircular.js +8 -3
- package/DEV-esm/utils/icons/SvgMore.js +8 -3
- package/DEV-esm/utils/icons/SvgMoreVertical.js +8 -3
- package/DEV-esm/utils/icons/SvgNew.js +8 -3
- package/DEV-esm/utils/icons/SvgSearch.js +8 -3
- package/DEV-esm/utils/icons/SvgSmileyHappy.js +8 -3
- package/DEV-esm/utils/icons/SvgSortDown.js +8 -3
- package/DEV-esm/utils/icons/SvgSortUp.js +8 -3
- package/DEV-esm/utils/icons/SvgStatusError.js +8 -3
- package/DEV-esm/utils/icons/SvgStatusSuccess.js +8 -3
- package/DEV-esm/utils/icons/SvgStatusWarning.js +8 -3
- package/DEV-esm/utils/icons/SvgSwap.js +8 -3
- package/DEV-esm/utils/icons/SvgUpload.js +8 -3
- package/DEV-esm/utils/meta.js +2 -2
- package/DEV-esm/utils/props.js +1 -1
- package/DEV-esm/utils/providers/HydrationProvider.js +31 -20
- package/DEV-esm/utils/providers/ScopeProvider.js +36 -35
- package/DEV-esm/utils/types.js +1 -1
- package/cjs/core/Buttons/IconButton.d.ts +4 -0
- package/cjs/core/Buttons/IconButton.js +3 -1
- package/cjs/core/Carousel/Carousel.d.ts +4 -2
- package/cjs/core/Carousel/CarouselNavigation.d.ts +4 -2
- package/cjs/core/ComboBox/ComboBox.js +5 -0
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
- package/cjs/core/List/List.d.ts +1 -1
- package/cjs/core/List/List.js +1 -1
- package/cjs/core/List/ListItem.d.ts +4 -4
- package/cjs/core/List/ListItem.js +4 -6
- package/cjs/core/Menu/Menu.js +6 -0
- package/cjs/core/Menu/MenuDivider.d.ts +1 -1
- package/cjs/core/Menu/MenuDivider.js +1 -1
- package/cjs/core/Overlay/Overlay.d.ts +2 -2
- package/cjs/core/Overlay/Overlay.js +2 -2
- package/cjs/core/Popover/Popover.d.ts +8 -1
- package/cjs/core/Popover/Popover.js +40 -9
- package/cjs/core/Select/Select.js +5 -0
- package/cjs/core/Table/ColumnHeader.d.ts +19 -0
- package/cjs/core/Table/ColumnHeader.js +194 -0
- package/cjs/core/Table/Table.js +37 -190
- package/cjs/core/Table/filters/BaseFilter.d.ts +2 -9
- package/cjs/core/Table/filters/BaseFilter.js +17 -15
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +3 -8
- package/cjs/core/Table/filters/FilterButtonBar.d.ts +4 -2
- package/cjs/core/Table/filters/FilterButtonBar.js +1 -0
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +3 -9
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +4 -7
- package/cjs/core/Table/filters/index.d.ts +0 -1
- package/cjs/core/Table/index.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +0 -4
- package/cjs/core/ThemeProvider/ThemeProvider.js +66 -49
- package/cjs/core/Tile/Tile.d.ts +10 -9
- package/cjs/core/Tile/Tile.js +8 -8
- package/cjs/core/Toast/Toaster.d.ts +3 -2
- package/cjs/core/Toast/Toaster.js +2 -1
- package/cjs/core/Tooltip/Tooltip.js +22 -7
- package/cjs/core/TransferList/TransferList.d.ts +5 -5
- package/cjs/core/TransferList/TransferList.js +2 -2
- package/cjs/styles.js +1 -1
- package/cjs/utils/functions/polymorphic.d.ts +3 -7
- package/cjs/utils/functions/polymorphic.js +8 -5
- package/esm/core/Buttons/IconButton.d.ts +4 -0
- package/esm/core/Buttons/IconButton.js +4 -2
- package/esm/core/Carousel/Carousel.d.ts +4 -2
- package/esm/core/Carousel/CarouselNavigation.d.ts +4 -2
- package/esm/core/ComboBox/ComboBox.js +5 -0
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
- package/esm/core/List/List.d.ts +1 -1
- package/esm/core/List/List.js +1 -1
- package/esm/core/List/ListItem.d.ts +4 -4
- package/esm/core/List/ListItem.js +4 -4
- package/esm/core/Menu/Menu.js +6 -0
- package/esm/core/Menu/MenuDivider.d.ts +1 -1
- package/esm/core/Menu/MenuDivider.js +1 -1
- package/esm/core/Overlay/Overlay.d.ts +2 -2
- package/esm/core/Overlay/Overlay.js +2 -2
- package/esm/core/Popover/Popover.d.ts +8 -1
- package/esm/core/Popover/Popover.js +40 -9
- package/esm/core/Select/Select.js +5 -0
- package/esm/core/Table/ColumnHeader.d.ts +19 -0
- package/esm/core/Table/ColumnHeader.js +188 -0
- package/esm/core/Table/Table.js +19 -177
- package/esm/core/Table/filters/BaseFilter.d.ts +2 -9
- package/esm/core/Table/filters/BaseFilter.js +15 -16
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +3 -8
- package/esm/core/Table/filters/FilterButtonBar.d.ts +4 -2
- package/esm/core/Table/filters/FilterButtonBar.js +1 -0
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +3 -9
- package/esm/core/Table/filters/TextFilter/TextFilter.js +4 -7
- package/esm/core/Table/filters/index.d.ts +0 -1
- package/esm/core/Table/index.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +0 -4
- package/esm/core/ThemeProvider/ThemeProvider.js +65 -44
- package/esm/core/Tile/Tile.d.ts +10 -9
- package/esm/core/Tile/Tile.js +8 -8
- package/esm/core/Toast/Toaster.d.ts +3 -2
- package/esm/core/Toast/Toaster.js +2 -1
- package/esm/core/Tooltip/Tooltip.js +22 -8
- package/esm/core/TransferList/TransferList.d.ts +5 -5
- package/esm/core/TransferList/TransferList.js +2 -2
- package/esm/styles.js +1 -1
- package/esm/utils/functions/polymorphic.d.ts +3 -7
- package/esm/utils/functions/polymorphic.js +8 -5
- package/package.json +3 -3
- package/styles.css +22 -14
|
@@ -1,516 +1,720 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
actions as TableActions,
|
|
5
|
+
useFlexLayout,
|
|
6
|
+
useFilters,
|
|
7
|
+
useRowSelect,
|
|
8
|
+
useSortBy,
|
|
9
|
+
useTable,
|
|
10
|
+
useExpanded,
|
|
11
|
+
usePagination,
|
|
12
|
+
useColumnOrder,
|
|
13
|
+
useGlobalFilter,
|
|
14
|
+
} from 'react-table';
|
|
4
15
|
import { ProgressRadial } from '../ProgressIndicators/ProgressRadial.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
16
|
+
import {
|
|
17
|
+
useGlobals,
|
|
18
|
+
useResizeObserver,
|
|
19
|
+
useLayoutEffect,
|
|
20
|
+
Box,
|
|
21
|
+
createWarningLogger,
|
|
22
|
+
ShadowRoot,
|
|
23
|
+
useMergedRefs,
|
|
24
|
+
useLatestRef,
|
|
25
|
+
useVirtualScroll,
|
|
26
|
+
} from '../../utils/index.js';
|
|
27
|
+
import { TableColumnsContext } from './utils.js';
|
|
7
28
|
import { TableRowMemoized } from './TableRowMemoized.js';
|
|
8
|
-
import { FilterToggle } from './filters/index.js';
|
|
9
29
|
import { customFilterFunctions } from './filters/customFilterFunctions.js';
|
|
10
|
-
import {
|
|
11
|
-
|
|
30
|
+
import {
|
|
31
|
+
useExpanderCell,
|
|
32
|
+
useSelectionCell,
|
|
33
|
+
useSubRowFiltering,
|
|
34
|
+
useSubRowSelection,
|
|
35
|
+
useResizeColumns,
|
|
36
|
+
useColumnDragAndDrop,
|
|
37
|
+
useScrollToRow,
|
|
38
|
+
useStickyColumns,
|
|
39
|
+
} from './hooks/index.js';
|
|
40
|
+
import {
|
|
41
|
+
onExpandHandler,
|
|
42
|
+
onFilterHandler,
|
|
43
|
+
onToggleHandler,
|
|
44
|
+
onShiftSelectHandler,
|
|
45
|
+
onSingleSelectHandler,
|
|
46
|
+
onTableResizeEnd,
|
|
47
|
+
onTableResizeStart,
|
|
48
|
+
} from './actionHandlers/index.js';
|
|
12
49
|
import { SELECTION_CELL_ID } from './columns/index.js';
|
|
50
|
+
import { ColumnHeader } from './ColumnHeader.js';
|
|
13
51
|
let singleRowSelectedAction = 'singleRowSelected';
|
|
14
52
|
let shiftRowSelectedAction = 'shiftRowSelected';
|
|
15
53
|
export const tableResizeStartAction = 'tableResizeStart';
|
|
16
54
|
let tableResizeEndAction = 'tableResizeEnd';
|
|
17
|
-
let COLUMN_MIN_WIDTHS = {
|
|
18
|
-
default: 72,
|
|
19
|
-
withExpander: 108
|
|
20
|
-
};
|
|
21
55
|
let logWarning = createWarningLogger();
|
|
22
|
-
let flattenColumns = (columns)=>{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
56
|
+
let flattenColumns = (columns) => {
|
|
57
|
+
let flatColumns = [];
|
|
58
|
+
columns.forEach((column) => {
|
|
59
|
+
flatColumns.push(column);
|
|
60
|
+
if ('columns' in column)
|
|
61
|
+
flatColumns.push(...flattenColumns(column.columns));
|
|
62
|
+
});
|
|
63
|
+
return flatColumns;
|
|
29
64
|
};
|
|
30
|
-
export const Table = (props)=>{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
65
|
+
export const Table = (props) => {
|
|
66
|
+
let {
|
|
67
|
+
data,
|
|
68
|
+
columns,
|
|
69
|
+
isLoading = false,
|
|
70
|
+
emptyTableContent,
|
|
71
|
+
className,
|
|
72
|
+
style,
|
|
73
|
+
id,
|
|
74
|
+
isSelectable = false,
|
|
75
|
+
onSelect,
|
|
76
|
+
onRowClick,
|
|
77
|
+
selectionMode = 'multi',
|
|
78
|
+
isSortable = false,
|
|
79
|
+
onSort,
|
|
80
|
+
stateReducer,
|
|
81
|
+
onBottomReached,
|
|
82
|
+
onRowInViewport,
|
|
83
|
+
intersectionMargin = 300,
|
|
84
|
+
subComponent,
|
|
85
|
+
onExpand,
|
|
86
|
+
onFilter,
|
|
87
|
+
globalFilterValue,
|
|
88
|
+
emptyFilteredTableContent,
|
|
89
|
+
filterTypes: filterFunctions,
|
|
90
|
+
expanderCell,
|
|
91
|
+
isRowDisabled,
|
|
92
|
+
rowProps,
|
|
93
|
+
density = 'default',
|
|
94
|
+
selectSubRows = true,
|
|
95
|
+
getSubRows,
|
|
96
|
+
selectRowOnClick = true,
|
|
97
|
+
paginatorRenderer,
|
|
98
|
+
pageSize = 25,
|
|
99
|
+
isResizable = false,
|
|
100
|
+
columnResizeMode = 'fit',
|
|
101
|
+
styleType = 'default',
|
|
102
|
+
enableVirtualization = false,
|
|
103
|
+
enableColumnReordering = false,
|
|
104
|
+
headerWrapperProps,
|
|
105
|
+
headerProps,
|
|
106
|
+
bodyProps,
|
|
107
|
+
emptyTableContentProps,
|
|
108
|
+
...rest
|
|
109
|
+
} = props;
|
|
110
|
+
useGlobals();
|
|
111
|
+
let ownerDocument = React.useRef();
|
|
112
|
+
let defaultColumn = React.useMemo(
|
|
113
|
+
() => ({
|
|
114
|
+
maxWidth: 0,
|
|
115
|
+
minWidth: 0,
|
|
116
|
+
width: 0,
|
|
117
|
+
}),
|
|
118
|
+
[],
|
|
119
|
+
);
|
|
120
|
+
let rowHeight = React.useMemo(() => {
|
|
121
|
+
if ('condensed' === density) return 50;
|
|
122
|
+
if ('extra-condensed' === density) return 38;
|
|
123
|
+
return 62;
|
|
124
|
+
}, [density]);
|
|
125
|
+
let onBottomReachedRef = useLatestRef(onBottomReached);
|
|
126
|
+
let onRowInViewportRef = useLatestRef(onRowInViewport);
|
|
127
|
+
let hasManualSelectionColumn = React.useMemo(() => {
|
|
128
|
+
let flatColumns = flattenColumns(columns);
|
|
129
|
+
return flatColumns.some((column) => column.id === SELECTION_CELL_ID);
|
|
130
|
+
}, [columns]);
|
|
131
|
+
let disableUserSelect = React.useCallback((e) => {
|
|
132
|
+
if ('Shift' === e.key)
|
|
133
|
+
ownerDocument.current &&
|
|
134
|
+
(ownerDocument.current.documentElement.style.userSelect = 'none');
|
|
135
|
+
}, []);
|
|
136
|
+
let enableUserSelect = React.useCallback((e) => {
|
|
137
|
+
if ('Shift' === e.key)
|
|
138
|
+
ownerDocument.current &&
|
|
139
|
+
(ownerDocument.current.documentElement.style.userSelect = '');
|
|
140
|
+
}, []);
|
|
141
|
+
React.useEffect(() => {
|
|
142
|
+
if (!isSelectable || 'multi' !== selectionMode) return;
|
|
143
|
+
let ownerDoc = ownerDocument.current;
|
|
144
|
+
ownerDoc?.addEventListener('keydown', disableUserSelect);
|
|
145
|
+
ownerDoc?.addEventListener('keyup', enableUserSelect);
|
|
146
|
+
return () => {
|
|
147
|
+
ownerDoc?.removeEventListener('keydown', disableUserSelect);
|
|
148
|
+
ownerDoc?.removeEventListener('keyup', enableUserSelect);
|
|
149
|
+
};
|
|
150
|
+
}, [
|
|
151
|
+
isSelectable,
|
|
152
|
+
selectionMode,
|
|
153
|
+
ownerDocument,
|
|
154
|
+
disableUserSelect,
|
|
155
|
+
enableUserSelect,
|
|
156
|
+
]);
|
|
157
|
+
let previousFilter = React.useRef([]);
|
|
158
|
+
let currentFilter = React.useRef(previousFilter.current);
|
|
159
|
+
let tableStateReducer = React.useCallback(
|
|
160
|
+
(newState, action, previousState, instance) => {
|
|
161
|
+
switch (action.type) {
|
|
162
|
+
case TableActions.toggleSortBy:
|
|
163
|
+
onSort?.(newState);
|
|
164
|
+
break;
|
|
165
|
+
case TableActions.setFilter:
|
|
166
|
+
currentFilter.current = onFilterHandler(
|
|
167
|
+
newState,
|
|
168
|
+
action,
|
|
169
|
+
previousState,
|
|
170
|
+
currentFilter.current,
|
|
171
|
+
instance,
|
|
172
|
+
);
|
|
173
|
+
break;
|
|
174
|
+
case TableActions.toggleRowExpanded:
|
|
175
|
+
case TableActions.toggleAllRowsExpanded:
|
|
176
|
+
onExpandHandler(newState, instance, onExpand);
|
|
177
|
+
break;
|
|
178
|
+
case singleRowSelectedAction:
|
|
179
|
+
newState = onSingleSelectHandler(
|
|
180
|
+
newState,
|
|
181
|
+
action,
|
|
182
|
+
instance,
|
|
183
|
+
onSelect,
|
|
184
|
+
hasManualSelectionColumn ? void 0 : isRowDisabled,
|
|
185
|
+
);
|
|
186
|
+
break;
|
|
187
|
+
case shiftRowSelectedAction:
|
|
188
|
+
newState = onShiftSelectHandler(
|
|
189
|
+
newState,
|
|
190
|
+
action,
|
|
191
|
+
instance,
|
|
192
|
+
onSelect,
|
|
193
|
+
hasManualSelectionColumn ? void 0 : isRowDisabled,
|
|
194
|
+
);
|
|
195
|
+
break;
|
|
196
|
+
case TableActions.toggleRowSelected:
|
|
197
|
+
case TableActions.toggleAllRowsSelected:
|
|
198
|
+
case TableActions.toggleAllPageRowsSelected:
|
|
199
|
+
onToggleHandler(
|
|
200
|
+
newState,
|
|
201
|
+
action,
|
|
202
|
+
instance,
|
|
203
|
+
onSelect,
|
|
204
|
+
hasManualSelectionColumn ? void 0 : isRowDisabled,
|
|
205
|
+
);
|
|
206
|
+
break;
|
|
207
|
+
case tableResizeStartAction:
|
|
208
|
+
newState = onTableResizeStart(newState);
|
|
209
|
+
break;
|
|
210
|
+
case tableResizeEndAction:
|
|
211
|
+
newState = onTableResizeEnd(newState, action);
|
|
212
|
+
break;
|
|
213
|
+
default:
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
return stateReducer
|
|
217
|
+
? stateReducer(newState, action, previousState, instance)
|
|
218
|
+
: newState;
|
|
219
|
+
},
|
|
220
|
+
[
|
|
221
|
+
hasManualSelectionColumn,
|
|
222
|
+
isRowDisabled,
|
|
223
|
+
onExpand,
|
|
224
|
+
onSelect,
|
|
225
|
+
onSort,
|
|
226
|
+
stateReducer,
|
|
227
|
+
],
|
|
228
|
+
);
|
|
229
|
+
let filterTypes = React.useMemo(
|
|
230
|
+
() => ({
|
|
231
|
+
...customFilterFunctions,
|
|
232
|
+
...filterFunctions,
|
|
233
|
+
}),
|
|
234
|
+
[filterFunctions],
|
|
235
|
+
);
|
|
236
|
+
let hasAnySubRows = React.useMemo(
|
|
237
|
+
() =>
|
|
238
|
+
data.some((item, index) =>
|
|
239
|
+
getSubRows ? getSubRows(item, index) : item.subRows,
|
|
240
|
+
),
|
|
241
|
+
[data, getSubRows],
|
|
242
|
+
);
|
|
243
|
+
let instance = useTable(
|
|
244
|
+
{
|
|
245
|
+
manualPagination: !paginatorRenderer,
|
|
246
|
+
paginateExpandedRows: false,
|
|
247
|
+
...props,
|
|
248
|
+
columns,
|
|
249
|
+
defaultColumn,
|
|
250
|
+
disableSortBy: !isSortable,
|
|
251
|
+
stateReducer: tableStateReducer,
|
|
252
|
+
filterTypes,
|
|
253
|
+
selectSubRows,
|
|
254
|
+
data,
|
|
255
|
+
getSubRows,
|
|
256
|
+
initialState: {
|
|
193
257
|
pageSize,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
258
|
+
...props.initialState,
|
|
259
|
+
},
|
|
260
|
+
columnResizeMode,
|
|
261
|
+
},
|
|
262
|
+
useFlexLayout,
|
|
263
|
+
useResizeColumns(ownerDocument),
|
|
264
|
+
useFilters,
|
|
265
|
+
useSubRowFiltering(hasAnySubRows),
|
|
266
|
+
useGlobalFilter,
|
|
267
|
+
useSortBy,
|
|
268
|
+
useExpanded,
|
|
269
|
+
usePagination,
|
|
270
|
+
useRowSelect,
|
|
271
|
+
useSubRowSelection,
|
|
272
|
+
useExpanderCell(subComponent, expanderCell, isRowDisabled),
|
|
273
|
+
useSelectionCell(isSelectable, selectionMode, isRowDisabled, density),
|
|
274
|
+
useColumnOrder,
|
|
275
|
+
useColumnDragAndDrop(enableColumnReordering),
|
|
276
|
+
useStickyColumns,
|
|
277
|
+
);
|
|
278
|
+
let {
|
|
279
|
+
getTableProps,
|
|
280
|
+
rows,
|
|
281
|
+
headerGroups: _headerGroups,
|
|
282
|
+
getTableBodyProps,
|
|
283
|
+
prepareRow,
|
|
284
|
+
state,
|
|
285
|
+
allColumns,
|
|
286
|
+
dispatch,
|
|
287
|
+
page,
|
|
288
|
+
gotoPage,
|
|
289
|
+
setPageSize,
|
|
290
|
+
flatHeaders,
|
|
291
|
+
visibleColumns,
|
|
292
|
+
setGlobalFilter,
|
|
293
|
+
} = instance;
|
|
294
|
+
let headerGroups = _headerGroups;
|
|
295
|
+
if (1 === columns.length && 'columns' in columns[0]) {
|
|
296
|
+
headerGroups = _headerGroups.slice(1);
|
|
297
|
+
logWarning(
|
|
298
|
+
"Table's `columns` prop should not have a top-level `Header` or sub-columns. They are only allowed to be passed for backwards compatibility.\n See https://github.com/iTwin/iTwinUI/wiki/iTwinUI-react-v2-migration-guide#breaking-changes",
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
let ariaDataAttributes = Object.entries(rest).reduce(
|
|
302
|
+
(result, [key, value]) => {
|
|
303
|
+
if (key.startsWith('data-') || key.startsWith('aria-'))
|
|
304
|
+
result[key] = value;
|
|
305
|
+
return result;
|
|
306
|
+
},
|
|
307
|
+
{},
|
|
308
|
+
);
|
|
309
|
+
let areFiltersSet =
|
|
310
|
+
allColumns.some(
|
|
311
|
+
(column) => null != column.filterValue && '' !== column.filterValue,
|
|
312
|
+
) || !!globalFilterValue;
|
|
313
|
+
let onRowClickHandler = React.useCallback(
|
|
314
|
+
(event, row) => {
|
|
315
|
+
let isDisabled = isRowDisabled?.(row.original);
|
|
316
|
+
let ctrlPressed = event.ctrlKey || event.metaKey;
|
|
317
|
+
if (!isDisabled) onRowClick?.(event, row);
|
|
318
|
+
if (
|
|
319
|
+
isSelectable &&
|
|
320
|
+
!isDisabled &&
|
|
321
|
+
selectRowOnClick &&
|
|
322
|
+
!event.isDefaultPrevented()
|
|
323
|
+
) {
|
|
324
|
+
if ('multi' === selectionMode && event.shiftKey)
|
|
325
|
+
dispatch({
|
|
326
|
+
type: shiftRowSelectedAction,
|
|
327
|
+
id: row.id,
|
|
328
|
+
ctrlPressed: ctrlPressed,
|
|
329
|
+
});
|
|
330
|
+
else if (row.isSelected || ('single' !== selectionMode && ctrlPressed))
|
|
331
|
+
row.toggleRowSelected(!row.isSelected);
|
|
332
|
+
else
|
|
333
|
+
dispatch({
|
|
334
|
+
type: singleRowSelectedAction,
|
|
335
|
+
id: row.id,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
[
|
|
340
|
+
isRowDisabled,
|
|
341
|
+
isSelectable,
|
|
342
|
+
selectRowOnClick,
|
|
343
|
+
selectionMode,
|
|
344
|
+
dispatch,
|
|
345
|
+
onRowClick,
|
|
346
|
+
],
|
|
347
|
+
);
|
|
348
|
+
React.useEffect(() => {
|
|
349
|
+
setGlobalFilter(globalFilterValue);
|
|
350
|
+
}, [globalFilterValue, setGlobalFilter]);
|
|
351
|
+
React.useEffect(() => {
|
|
352
|
+
setPageSize(pageSize);
|
|
353
|
+
}, [pageSize, setPageSize]);
|
|
354
|
+
React.useEffect(() => {
|
|
355
|
+
if (previousFilter.current !== currentFilter.current) {
|
|
356
|
+
previousFilter.current = currentFilter.current;
|
|
357
|
+
onFilter?.(currentFilter.current, state, instance.filteredRows);
|
|
358
|
+
}
|
|
359
|
+
}, [state, instance.filteredRows, onFilter]);
|
|
360
|
+
let lastPassedColumns = React.useRef([]);
|
|
361
|
+
React.useEffect(() => {
|
|
362
|
+
if (
|
|
363
|
+
lastPassedColumns.current.length > 0 &&
|
|
364
|
+
JSON.stringify(lastPassedColumns.current) !== JSON.stringify(columns)
|
|
365
|
+
)
|
|
366
|
+
instance.setColumnOrder([]);
|
|
367
|
+
lastPassedColumns.current = columns;
|
|
368
|
+
}, [columns, instance]);
|
|
369
|
+
let paginatorRendererProps = React.useMemo(
|
|
370
|
+
() => ({
|
|
371
|
+
currentPage: state.pageIndex,
|
|
372
|
+
pageSize: state.pageSize,
|
|
373
|
+
totalRowsCount: rows.length,
|
|
374
|
+
size: 'default' !== density ? 'small' : 'default',
|
|
375
|
+
isLoading,
|
|
376
|
+
onPageChange: gotoPage,
|
|
377
|
+
onPageSizeChange: setPageSize,
|
|
378
|
+
totalSelectedRowsCount:
|
|
379
|
+
'single' === selectionMode ? 0 : instance.selectedFlatRows.length,
|
|
380
|
+
}),
|
|
381
|
+
[
|
|
382
|
+
density,
|
|
383
|
+
gotoPage,
|
|
384
|
+
isLoading,
|
|
385
|
+
rows.length,
|
|
386
|
+
setPageSize,
|
|
387
|
+
state.pageIndex,
|
|
388
|
+
state.pageSize,
|
|
389
|
+
instance.selectedFlatRows,
|
|
390
|
+
selectionMode,
|
|
391
|
+
],
|
|
392
|
+
);
|
|
393
|
+
let tableRef = React.useRef(null);
|
|
394
|
+
let { scrollToIndex, tableRowRef } = useScrollToRow({
|
|
395
|
+
...props,
|
|
396
|
+
page,
|
|
397
|
+
});
|
|
398
|
+
let columnRefs = React.useRef({});
|
|
399
|
+
let previousTableWidth = React.useRef(0);
|
|
400
|
+
let onTableResize = React.useCallback(
|
|
401
|
+
({ width }) => {
|
|
402
|
+
if (!isResizable) return;
|
|
403
|
+
instance.tableWidth = width;
|
|
404
|
+
if (width === previousTableWidth.current) return;
|
|
405
|
+
previousTableWidth.current = width;
|
|
406
|
+
flatHeaders.forEach((header) => {
|
|
407
|
+
if (columnRefs.current[header.id])
|
|
408
|
+
header.resizeWidth =
|
|
409
|
+
columnRefs.current[header.id].getBoundingClientRect().width;
|
|
410
|
+
});
|
|
411
|
+
if (0 === Object.keys(state.columnResizing.columnWidths).length) return;
|
|
412
|
+
dispatch({
|
|
413
|
+
type: tableResizeStartAction,
|
|
414
|
+
});
|
|
415
|
+
},
|
|
416
|
+
[
|
|
417
|
+
dispatch,
|
|
418
|
+
state.columnResizing.columnWidths,
|
|
419
|
+
flatHeaders,
|
|
420
|
+
instance,
|
|
421
|
+
isResizable,
|
|
422
|
+
],
|
|
423
|
+
);
|
|
424
|
+
let [resizeRef] = useResizeObserver(onTableResize);
|
|
425
|
+
useLayoutEffect(() => {
|
|
426
|
+
if (state.isTableResizing) {
|
|
427
|
+
let newColumnWidths = {};
|
|
428
|
+
flatHeaders.forEach((column) => {
|
|
429
|
+
if (columnRefs.current[column.id])
|
|
430
|
+
newColumnWidths[column.id] =
|
|
431
|
+
columnRefs.current[column.id].getBoundingClientRect().width;
|
|
432
|
+
});
|
|
433
|
+
dispatch({
|
|
434
|
+
type: tableResizeEndAction,
|
|
435
|
+
columnWidths: newColumnWidths,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
let { virtualizer, css: virtualizerCss } = useVirtualScroll({
|
|
440
|
+
enabled: enableVirtualization,
|
|
441
|
+
count: page.length,
|
|
442
|
+
getScrollElement: () => tableRef.current,
|
|
443
|
+
estimateSize: () => rowHeight,
|
|
444
|
+
getItemKey: (index) => page[index].id,
|
|
445
|
+
overscan: 1,
|
|
446
|
+
});
|
|
447
|
+
useLayoutEffect(() => {
|
|
448
|
+
if (scrollToIndex)
|
|
449
|
+
virtualizer.scrollToIndex(scrollToIndex, {
|
|
450
|
+
align: 'center',
|
|
451
|
+
});
|
|
452
|
+
}, [virtualizer, scrollToIndex]);
|
|
453
|
+
let getPreparedRow = React.useCallback(
|
|
454
|
+
(index, virtualItem, virtualizer) => {
|
|
455
|
+
let row = page[index];
|
|
456
|
+
prepareRow(row);
|
|
457
|
+
return React.createElement(TableRowMemoized, {
|
|
458
|
+
row: row,
|
|
459
|
+
rowProps: rowProps,
|
|
460
|
+
isLast: index === page.length - 1,
|
|
461
|
+
onRowInViewport: onRowInViewportRef,
|
|
462
|
+
onBottomReached: onBottomReachedRef,
|
|
463
|
+
intersectionMargin: intersectionMargin,
|
|
464
|
+
state: state,
|
|
465
|
+
key: row.getRowProps().key,
|
|
466
|
+
onClick: onRowClickHandler,
|
|
467
|
+
subComponent: subComponent,
|
|
468
|
+
isDisabled: !!isRowDisabled?.(row.original),
|
|
469
|
+
tableHasSubRows: hasAnySubRows,
|
|
470
|
+
tableInstance: instance,
|
|
471
|
+
expanderCell: expanderCell,
|
|
472
|
+
scrollContainerRef: tableRef.current,
|
|
473
|
+
tableRowRef: enableVirtualization ? void 0 : tableRowRef(row),
|
|
474
|
+
density: density,
|
|
475
|
+
virtualItem: virtualItem,
|
|
476
|
+
virtualizer: virtualizer,
|
|
477
|
+
});
|
|
478
|
+
},
|
|
479
|
+
[
|
|
480
|
+
page,
|
|
481
|
+
prepareRow,
|
|
482
|
+
rowProps,
|
|
483
|
+
intersectionMargin,
|
|
484
|
+
state,
|
|
485
|
+
onRowClickHandler,
|
|
486
|
+
subComponent,
|
|
487
|
+
isRowDisabled,
|
|
488
|
+
hasAnySubRows,
|
|
489
|
+
instance,
|
|
490
|
+
expanderCell,
|
|
491
|
+
enableVirtualization,
|
|
492
|
+
tableRowRef,
|
|
493
|
+
density,
|
|
494
|
+
onBottomReachedRef,
|
|
495
|
+
onRowInViewportRef,
|
|
496
|
+
],
|
|
497
|
+
);
|
|
498
|
+
let updateStickyState = () => {
|
|
499
|
+
if (!tableRef.current || flatHeaders.every((header) => !header.sticky))
|
|
500
|
+
return;
|
|
501
|
+
0 !== tableRef.current.scrollLeft
|
|
502
|
+
? dispatch({
|
|
503
|
+
type: TableActions.setScrolledRight,
|
|
504
|
+
value: true,
|
|
505
|
+
})
|
|
506
|
+
: dispatch({
|
|
507
|
+
type: TableActions.setScrolledRight,
|
|
508
|
+
value: false,
|
|
339
509
|
});
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
510
|
+
tableRef.current.scrollLeft !==
|
|
511
|
+
tableRef.current.scrollWidth - tableRef.current.clientWidth
|
|
512
|
+
? dispatch({
|
|
513
|
+
type: TableActions.setScrolledLeft,
|
|
514
|
+
value: true,
|
|
515
|
+
})
|
|
516
|
+
: dispatch({
|
|
517
|
+
type: TableActions.setScrolledLeft,
|
|
518
|
+
value: false,
|
|
346
519
|
});
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
520
|
+
};
|
|
521
|
+
React.useEffect(() => {
|
|
522
|
+
updateStickyState();
|
|
523
|
+
}, []);
|
|
524
|
+
return React.createElement(
|
|
525
|
+
TableColumnsContext.Provider,
|
|
526
|
+
{
|
|
527
|
+
value: columns,
|
|
528
|
+
},
|
|
529
|
+
React.createElement(
|
|
530
|
+
Box,
|
|
531
|
+
{
|
|
532
|
+
ref: useMergedRefs(
|
|
533
|
+
tableRef,
|
|
534
|
+
resizeRef,
|
|
535
|
+
React.useCallback((element) => {
|
|
362
536
|
ownerDocument.current = element?.ownerDocument;
|
|
363
|
-
|
|
537
|
+
}, []),
|
|
538
|
+
),
|
|
364
539
|
id: id,
|
|
365
540
|
...getTableProps({
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
541
|
+
className: cx('iui-table', className),
|
|
542
|
+
style: {
|
|
543
|
+
minWidth: 0,
|
|
544
|
+
...style,
|
|
545
|
+
},
|
|
371
546
|
}),
|
|
372
|
-
onScroll: ()=>updateStickyState(),
|
|
373
|
-
|
|
374
|
-
...ariaDataAttributes
|
|
375
|
-
|
|
376
|
-
|
|
547
|
+
onScroll: () => updateStickyState(),
|
|
548
|
+
'data-iui-size': 'default' === density ? void 0 : density,
|
|
549
|
+
...ariaDataAttributes,
|
|
550
|
+
},
|
|
551
|
+
headerGroups.map((headerGroup) => {
|
|
552
|
+
headerGroup.headers = headerGroup.headers.filter(
|
|
553
|
+
(header) =>
|
|
554
|
+
!header.id.includes('iui-table-checkbox-selector_placeholder') &&
|
|
555
|
+
!header.id.includes('iui-table-expander_placeholder'),
|
|
556
|
+
);
|
|
377
557
|
let headerGroupProps = headerGroup.getHeaderGroupProps({
|
|
378
|
-
|
|
558
|
+
className: 'iui-table-row',
|
|
379
559
|
});
|
|
380
|
-
return React.createElement(
|
|
381
|
-
|
|
560
|
+
return React.createElement(
|
|
561
|
+
Box,
|
|
562
|
+
{
|
|
563
|
+
as: 'div',
|
|
382
564
|
key: headerGroupProps.key,
|
|
383
565
|
...headerWrapperProps,
|
|
384
|
-
className: cx(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
}, React.createElement(React.Fragment, null, React.createElement(ShadowRoot, null, 'string' == typeof column.Header ? React.createElement(LineClamp, null, React.createElement("slot", null)) : React.createElement("slot", null), React.createElement("slot", {
|
|
438
|
-
name: "actions"
|
|
439
|
-
}), React.createElement("slot", {
|
|
440
|
-
name: "resizers"
|
|
441
|
-
}), React.createElement("slot", {
|
|
442
|
-
name: "shadows"
|
|
443
|
-
})), column.render('Header'), (showFilterButton(column) || showSortButton(column)) && React.createElement(Box, {
|
|
444
|
-
className: "iui-table-header-actions-container",
|
|
445
|
-
onKeyDown: (e)=>e.stopPropagation(),
|
|
446
|
-
slot: "actions"
|
|
447
|
-
}, showFilterButton(column) && React.createElement(FilterToggle, {
|
|
448
|
-
column: column
|
|
449
|
-
}), showSortButton(column) && React.createElement(Box, {
|
|
450
|
-
className: "iui-table-cell-end-icon"
|
|
451
|
-
}, column.isSortedDesc || !column.isSorted && column.sortDescFirst ? React.createElement(SvgSortDown, {
|
|
452
|
-
className: "iui-table-sort",
|
|
453
|
-
"aria-hidden": true
|
|
454
|
-
}) : React.createElement(SvgSortUp, {
|
|
455
|
-
className: "iui-table-sort",
|
|
456
|
-
"aria-hidden": true
|
|
457
|
-
}))), isResizable && column.isResizerVisible && (index !== headerGroup.headers.length - 1 || 'expand' === columnResizeMode) && React.createElement(Box, {
|
|
458
|
-
...column.getResizerProps(),
|
|
459
|
-
className: "iui-table-resizer",
|
|
460
|
-
slot: "resizers"
|
|
461
|
-
}, React.createElement(Box, {
|
|
462
|
-
className: "iui-table-resizer-bar"
|
|
463
|
-
})), enableColumnReordering && !column.disableReordering && React.createElement(Box, {
|
|
464
|
-
className: "iui-table-reorder-bar",
|
|
465
|
-
slot: "resizers"
|
|
466
|
-
}), 'left' === column.sticky && state.sticky.isScrolledToRight && React.createElement(Box, {
|
|
467
|
-
className: "iui-table-cell-shadow-right",
|
|
468
|
-
slot: "shadows"
|
|
469
|
-
}), 'right' === column.sticky && state.sticky.isScrolledToLeft && React.createElement(Box, {
|
|
470
|
-
className: "iui-table-cell-shadow-left",
|
|
471
|
-
slot: "shadows"
|
|
472
|
-
})));
|
|
473
|
-
}))));
|
|
474
|
-
}), React.createElement(Box, {
|
|
475
|
-
as: "div",
|
|
476
|
-
...bodyProps,
|
|
477
|
-
...getTableBodyProps({
|
|
478
|
-
className: cx('iui-table-body', {
|
|
479
|
-
'iui-zebra-striping': 'zebra-rows' === styleType
|
|
480
|
-
}, bodyProps?.className),
|
|
566
|
+
className: cx(
|
|
567
|
+
'iui-table-header-wrapper',
|
|
568
|
+
headerWrapperProps?.className,
|
|
569
|
+
),
|
|
570
|
+
},
|
|
571
|
+
React.createElement(
|
|
572
|
+
Box,
|
|
573
|
+
{
|
|
574
|
+
as: 'div',
|
|
575
|
+
...headerProps,
|
|
576
|
+
className: cx('iui-table-header', headerProps?.className),
|
|
577
|
+
},
|
|
578
|
+
React.createElement(
|
|
579
|
+
Box,
|
|
580
|
+
headerGroupProps,
|
|
581
|
+
headerGroup.headers.map((column, index) => {
|
|
582
|
+
let dragAndDropProps = column.getDragAndDropProps();
|
|
583
|
+
return React.createElement(ColumnHeader, {
|
|
584
|
+
...dragAndDropProps,
|
|
585
|
+
key: dragAndDropProps.key,
|
|
586
|
+
columnRefs: columnRefs,
|
|
587
|
+
column: column,
|
|
588
|
+
index: index,
|
|
589
|
+
areFiltersSet: areFiltersSet,
|
|
590
|
+
hasAnySubRows: hasAnySubRows,
|
|
591
|
+
headers: headerGroup.headers,
|
|
592
|
+
state: state,
|
|
593
|
+
data: data,
|
|
594
|
+
isResizable: isResizable,
|
|
595
|
+
columnResizeMode: columnResizeMode,
|
|
596
|
+
enableColumnReordering: enableColumnReordering,
|
|
597
|
+
density: density,
|
|
598
|
+
visibleColumns: visibleColumns,
|
|
599
|
+
});
|
|
600
|
+
}),
|
|
601
|
+
),
|
|
602
|
+
),
|
|
603
|
+
);
|
|
604
|
+
}),
|
|
605
|
+
React.createElement(
|
|
606
|
+
Box,
|
|
607
|
+
{
|
|
608
|
+
as: 'div',
|
|
609
|
+
...bodyProps,
|
|
610
|
+
...getTableBodyProps({
|
|
611
|
+
className: cx(
|
|
612
|
+
'iui-table-body',
|
|
613
|
+
{
|
|
614
|
+
'iui-zebra-striping': 'zebra-rows' === styleType,
|
|
615
|
+
},
|
|
616
|
+
bodyProps?.className,
|
|
617
|
+
),
|
|
481
618
|
style: {
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
619
|
+
outline: 0,
|
|
620
|
+
},
|
|
621
|
+
}),
|
|
622
|
+
tabIndex: -1,
|
|
623
|
+
'aria-multiselectable':
|
|
624
|
+
(isSelectable && 'multi' === selectionMode) || void 0,
|
|
625
|
+
},
|
|
626
|
+
React.createElement(
|
|
627
|
+
ShadowRoot,
|
|
628
|
+
{
|
|
629
|
+
css: virtualizerCss,
|
|
630
|
+
},
|
|
631
|
+
enableVirtualization && 0 !== data.length
|
|
632
|
+
? React.createElement(
|
|
633
|
+
'div',
|
|
634
|
+
{
|
|
635
|
+
'data-iui-virtualizer': 'root',
|
|
636
|
+
style: {
|
|
637
|
+
minBlockSize: virtualizer.getTotalSize(),
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
React.createElement('slot', null),
|
|
641
|
+
)
|
|
642
|
+
: React.createElement('slot', null),
|
|
643
|
+
),
|
|
644
|
+
0 !== data.length &&
|
|
645
|
+
React.createElement(
|
|
646
|
+
React.Fragment,
|
|
647
|
+
null,
|
|
648
|
+
enableVirtualization
|
|
649
|
+
? virtualizer
|
|
650
|
+
.getVirtualItems()
|
|
651
|
+
.map((virtualItem) =>
|
|
652
|
+
getPreparedRow(virtualItem.index, virtualItem, virtualizer),
|
|
653
|
+
)
|
|
654
|
+
: page.map((_, index) => getPreparedRow(index)),
|
|
655
|
+
),
|
|
656
|
+
isLoading &&
|
|
657
|
+
0 === data.length &&
|
|
658
|
+
React.createElement(
|
|
659
|
+
Box,
|
|
660
|
+
{
|
|
661
|
+
as: 'div',
|
|
662
|
+
...emptyTableContentProps,
|
|
663
|
+
className: cx(
|
|
664
|
+
'iui-table-empty',
|
|
665
|
+
emptyTableContentProps?.className,
|
|
666
|
+
),
|
|
667
|
+
},
|
|
668
|
+
React.createElement(ProgressRadial, {
|
|
669
|
+
indeterminate: true,
|
|
670
|
+
}),
|
|
671
|
+
),
|
|
672
|
+
!isLoading &&
|
|
673
|
+
0 === data.length &&
|
|
674
|
+
!areFiltersSet &&
|
|
675
|
+
React.createElement(
|
|
676
|
+
Box,
|
|
677
|
+
{
|
|
678
|
+
as: 'div',
|
|
679
|
+
...emptyTableContentProps,
|
|
680
|
+
className: cx(
|
|
681
|
+
'iui-table-empty',
|
|
682
|
+
emptyTableContentProps?.className,
|
|
683
|
+
),
|
|
684
|
+
},
|
|
685
|
+
React.createElement('div', null, emptyTableContent),
|
|
686
|
+
),
|
|
687
|
+
!isLoading &&
|
|
688
|
+
(0 === data.length || 0 === rows.length) &&
|
|
689
|
+
areFiltersSet &&
|
|
690
|
+
React.createElement(
|
|
691
|
+
Box,
|
|
692
|
+
{
|
|
693
|
+
as: 'div',
|
|
694
|
+
...emptyTableContentProps,
|
|
695
|
+
className: cx(
|
|
696
|
+
'iui-table-empty',
|
|
697
|
+
emptyTableContentProps?.className,
|
|
698
|
+
),
|
|
699
|
+
},
|
|
700
|
+
React.createElement('div', null, emptyFilteredTableContent),
|
|
701
|
+
),
|
|
702
|
+
),
|
|
703
|
+
isLoading &&
|
|
704
|
+
0 !== data.length &&
|
|
705
|
+
React.createElement(
|
|
706
|
+
Box,
|
|
707
|
+
{
|
|
708
|
+
className: 'iui-table-body-extra',
|
|
709
|
+
'data-iui-loading': 'true',
|
|
710
|
+
},
|
|
711
|
+
React.createElement(ProgressRadial, {
|
|
712
|
+
indeterminate: true,
|
|
713
|
+
size: 'small',
|
|
714
|
+
}),
|
|
715
|
+
),
|
|
716
|
+
paginatorRenderer?.(paginatorRendererProps),
|
|
717
|
+
),
|
|
718
|
+
);
|
|
515
719
|
};
|
|
516
720
|
Table.displayName = 'Table';
|