@itwin/itwinui-react 2.0.0-dev.2 → 2.0.0-dev.4
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/README.md +10 -1
- package/cjs/core/Alert/Alert.js +8 -30
- package/cjs/core/Avatar/Avatar.js +10 -33
- package/cjs/core/AvatarGroup/AvatarGroup.js +18 -43
- package/cjs/core/Backdrop/Backdrop.js +6 -28
- package/cjs/core/Badge/Badge.js +13 -31
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +14 -40
- package/cjs/core/ButtonGroup/ButtonGroup.js +10 -32
- package/cjs/core/Buttons/Button/Button.js +6 -28
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +14 -36
- package/cjs/core/Buttons/IconButton/IconButton.js +6 -28
- package/cjs/core/Buttons/IdeasButton/IdeasButton.js +6 -28
- package/cjs/core/Buttons/SplitButton/SplitButton.js +14 -36
- package/cjs/core/Carousel/Carousel.js +38 -63
- package/cjs/core/Carousel/CarouselContext.js +1 -1
- package/cjs/core/Carousel/CarouselDot.js +6 -28
- package/cjs/core/Carousel/CarouselDotsList.js +33 -60
- package/cjs/core/Carousel/CarouselNavigation.js +22 -44
- package/cjs/core/Carousel/CarouselSlide.js +12 -34
- package/cjs/core/Carousel/CarouselSlider.js +26 -51
- package/cjs/core/Checkbox/Checkbox.js +18 -42
- package/cjs/core/ColorPicker/ColorBuilder.js +51 -73
- package/cjs/core/ColorPicker/ColorInputPanel.js +64 -88
- package/cjs/core/ColorPicker/ColorPalette.js +26 -50
- package/cjs/core/ColorPicker/ColorPicker.js +25 -49
- package/cjs/core/ColorPicker/ColorPickerContext.js +3 -3
- package/cjs/core/ColorPicker/ColorSwatch.js +13 -34
- package/cjs/core/ComboBox/ComboBox.js +67 -93
- package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxDropdown.js +13 -36
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +12 -34
- package/cjs/core/ComboBox/ComboBoxInput.js +28 -50
- package/cjs/core/ComboBox/ComboBoxInputContainer.js +9 -31
- package/cjs/core/ComboBox/ComboBoxMenu.js +35 -60
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +11 -33
- package/cjs/core/ComboBox/helpers.js +11 -19
- package/cjs/core/DatePicker/DatePicker.js +87 -111
- package/cjs/core/Dialog/Dialog.js +28 -48
- package/cjs/core/Dialog/DialogBackdrop.js +16 -35
- package/cjs/core/Dialog/DialogButtonBar.js +6 -28
- package/cjs/core/Dialog/DialogContent.js +6 -28
- package/cjs/core/Dialog/DialogContext.js +2 -2
- package/cjs/core/Dialog/DialogDragContext.js +6 -15
- package/cjs/core/Dialog/DialogMain.js +52 -59
- package/cjs/core/Dialog/DialogTitleBar.js +14 -36
- package/cjs/core/Dialog/DialogTitleBarTitle.js +6 -28
- package/cjs/core/DropdownMenu/DropdownMenu.js +14 -36
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +12 -34
- package/cjs/core/Fieldset/Fieldset.js +9 -33
- package/cjs/core/FileUpload/FileUpload.js +13 -35
- package/cjs/core/FileUpload/FileUploadTemplate.js +4 -4
- package/cjs/core/Footer/Footer.js +21 -49
- package/cjs/core/Footer/FooterItem.js +6 -28
- package/cjs/core/Footer/FooterList.js +6 -28
- package/cjs/core/Footer/FooterSeparator.js +6 -28
- package/cjs/core/Header/Header.js +10 -32
- package/cjs/core/Header/HeaderBasicButton.js +6 -28
- package/cjs/core/Header/HeaderBreadcrumbs.js +9 -39
- package/cjs/core/Header/HeaderButton.js +22 -36
- package/cjs/core/Header/HeaderDropdownButton.js +14 -36
- package/cjs/core/Header/HeaderLogo.js +7 -29
- package/cjs/core/Header/HeaderSplitButton.js +13 -35
- package/cjs/core/InformationPanel/InformationPanel.js +15 -37
- package/cjs/core/InformationPanel/InformationPanelBody.js +6 -28
- package/cjs/core/InformationPanel/InformationPanelContent.js +6 -28
- package/cjs/core/InformationPanel/InformationPanelHeader.js +7 -29
- package/cjs/core/InformationPanel/InformationPanelWrapper.js +6 -28
- package/cjs/core/Input/Input.js +9 -31
- package/cjs/core/InputGroup/InputGroup.js +6 -28
- package/cjs/core/Label/Label.js +7 -29
- package/cjs/core/LabeledInput/LabeledInput.js +7 -29
- package/cjs/core/LabeledSelect/LabeledSelect.js +7 -29
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +7 -29
- package/cjs/core/Menu/Menu.js +18 -40
- package/cjs/core/Menu/MenuDivider.js +6 -28
- package/cjs/core/Menu/MenuExtraContent.js +6 -28
- package/cjs/core/Menu/MenuItem.js +17 -39
- package/cjs/core/Menu/MenuItemSkeleton.js +11 -30
- package/cjs/core/Modal/Modal.js +12 -30
- package/cjs/core/Modal/ModalButtonBar.js +1 -1
- package/cjs/core/Modal/ModalContent.js +1 -1
- package/cjs/core/{ErrorPage → NonIdealState}/ErrorPage.d.ts +5 -1
- package/cjs/core/NonIdealState/ErrorPage.js +144 -0
- package/cjs/core/NonIdealState/NonIdealState.d.ts +46 -0
- package/cjs/core/NonIdealState/NonIdealState.js +32 -0
- package/{esm/core/ErrorPage → cjs/core/NonIdealState}/index.d.ts +3 -1
- package/cjs/core/{ErrorPage → NonIdealState}/index.js +4 -2
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +11 -34
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +13 -37
- package/cjs/core/Radio/Radio.js +10 -33
- package/cjs/core/RadioTiles/RadioTile.js +9 -31
- package/cjs/core/RadioTiles/RadioTileGroup.js +6 -28
- package/cjs/core/Select/Select.js +59 -72
- package/cjs/core/Select/SelectTag.js +6 -28
- package/cjs/core/SideNavigation/SideNavigation.js +14 -40
- package/cjs/core/SideNavigation/SidenavButton.js +8 -30
- package/cjs/core/SideNavigation/SidenavSubmenu.js +6 -28
- package/cjs/core/SideNavigation/SidenavSubmenuHeader.js +6 -28
- package/cjs/core/SkipToContentLink/SkipToContentLink.js +6 -28
- package/cjs/core/Slider/Slider.js +68 -96
- package/cjs/core/Slider/Thumb.js +20 -39
- package/cjs/core/Slider/Track.js +24 -44
- package/cjs/core/StatusMessage/StatusMessage.js +6 -7
- package/cjs/core/Stepper/Stepper.js +10 -34
- package/cjs/core/Stepper/StepperStep.js +15 -34
- package/cjs/core/Stepper/Wizard.js +6 -28
- package/cjs/core/Stepper/WorkflowDiagram.js +6 -28
- package/cjs/core/Stepper/WorkflowDiagramStep.js +6 -28
- package/cjs/core/Surface/Surface.js +11 -30
- package/cjs/core/Table/SubRowExpander.js +6 -6
- package/cjs/core/Table/Table.d.ts +19 -24
- package/cjs/core/Table/Table.js +189 -195
- package/cjs/core/Table/TableCell.js +29 -30
- package/cjs/core/Table/TablePaginator.js +52 -83
- package/cjs/core/Table/TableRowMemoized.d.ts +6 -10
- package/cjs/core/Table/TableRowMemoized.js +36 -60
- package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
- package/cjs/core/Table/actionHandlers/filterHandler.js +4 -4
- package/cjs/core/Table/actionHandlers/resizeHandler.js +13 -15
- package/cjs/core/Table/actionHandlers/selectHandler.js +35 -40
- package/cjs/core/Table/cells/DefaultCell.js +5 -27
- package/cjs/core/Table/cells/EditableCell.js +16 -40
- package/cjs/core/Table/columns/actionColumn.js +44 -62
- package/cjs/core/Table/columns/expanderColumn.d.ts +2 -5
- package/cjs/core/Table/columns/expanderColumn.js +12 -27
- package/cjs/core/Table/columns/selectionColumn.d.ts +2 -5
- package/cjs/core/Table/columns/selectionColumn.js +16 -37
- package/cjs/core/Table/filters/BaseFilter.js +6 -6
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +19 -41
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +20 -31
- package/cjs/core/Table/filters/FilterButtonBar.js +8 -19
- package/cjs/core/Table/filters/FilterToggle.js +15 -37
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +16 -29
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +11 -11
- package/cjs/core/Table/filters/customFilterFunctions.js +11 -13
- package/cjs/core/Table/filters/defaultFilterFunctions.js +62 -64
- package/cjs/core/Table/filters/tableFilters.js +7 -18
- package/cjs/core/Table/hooks/useColumnDragAndDrop.js +41 -53
- package/cjs/core/Table/hooks/useExpanderCell.js +17 -33
- package/cjs/core/Table/hooks/useResizeColumns.js +197 -205
- package/cjs/core/Table/hooks/useScrollToRow.js +11 -12
- package/cjs/core/Table/hooks/useSelectionCell.js +7 -18
- package/cjs/core/Table/hooks/useStickyColumns.js +28 -33
- package/cjs/core/Table/hooks/useSubRowFiltering.js +37 -57
- package/cjs/core/Table/hooks/useSubRowSelection.js +10 -12
- package/cjs/core/Table/utils.js +15 -26
- package/cjs/core/Tabs/Tab.js +6 -28
- package/cjs/core/Tabs/Tabs.js +45 -67
- package/cjs/core/Tag/Tag.js +8 -30
- package/cjs/core/Tag/TagContainer.js +9 -32
- package/cjs/core/Textarea/Textarea.js +9 -31
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +1 -0
- package/cjs/core/ThemeProvider/ThemeProvider.js +16 -37
- package/cjs/core/Tile/Tile.js +29 -58
- package/cjs/core/TimePicker/TimePicker.js +59 -97
- package/cjs/core/Toast/Toast.js +45 -65
- package/cjs/core/Toast/ToastWrapper.js +13 -24
- package/cjs/core/Toast/Toaster.js +87 -137
- package/cjs/core/Toast/index.js +2 -2
- package/cjs/core/ToggleSwitch/ToggleSwitch.js +10 -32
- package/cjs/core/Tooltip/Tooltip.js +6 -28
- package/cjs/core/Tree/Tree.js +58 -80
- package/cjs/core/Tree/TreeContext.js +3 -3
- package/cjs/core/Tree/TreeNode.js +21 -43
- package/cjs/core/Tree/TreeNodeExpander.js +7 -29
- package/cjs/core/Typography/Anchor/Anchor.js +5 -28
- package/cjs/core/Typography/Blockquote/Blockquote.js +6 -28
- package/cjs/core/Typography/Body/Body.js +7 -29
- package/cjs/core/Typography/Code/Code.js +6 -28
- package/cjs/core/Typography/Headline/Headline.js +6 -28
- package/cjs/core/Typography/Kbd/Kbd.js +6 -28
- package/cjs/core/Typography/Leading/Leading.js +6 -28
- package/cjs/core/Typography/Small/Small.js +6 -28
- package/cjs/core/Typography/Subheading/Subheading.js +6 -28
- package/cjs/core/Typography/Text/Text.js +11 -34
- package/cjs/core/Typography/Title/Title.js +6 -28
- package/cjs/core/index.d.ts +2 -2
- package/cjs/core/index.js +6 -5
- package/cjs/core/utils/color/ColorValue.js +146 -156
- package/cjs/core/utils/components/FocusTrap.js +14 -14
- package/cjs/core/utils/components/InputContainer.js +12 -36
- package/cjs/core/utils/components/MiddleTextTruncation.js +15 -31
- package/cjs/core/utils/components/Popover.d.ts +1 -1
- package/cjs/core/utils/components/Popover.js +57 -60
- package/cjs/core/utils/components/Resizer.js +51 -51
- package/cjs/core/utils/components/VirtualScroll.js +72 -89
- package/cjs/core/utils/components/VisuallyHidden.js +6 -28
- package/cjs/core/utils/components/WithCSSTransition.d.ts +2 -2
- package/cjs/core/utils/components/WithCSSTransition.js +18 -40
- package/cjs/core/utils/functions/colors.js +7 -7
- package/cjs/core/utils/functions/dom.js +7 -8
- package/cjs/core/utils/functions/focusable.js +11 -15
- package/cjs/core/utils/functions/numbers.js +5 -6
- package/cjs/core/utils/functions/styles.js +3 -3
- package/cjs/core/utils/hooks/useContainerWidth.js +9 -13
- package/cjs/core/utils/hooks/useDragAndDrop.js +32 -33
- package/cjs/core/utils/hooks/useEventListener.js +7 -7
- package/cjs/core/utils/hooks/useIntersection.js +9 -12
- package/cjs/core/utils/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/cjs/core/utils/hooks/useLatestRef.js +4 -4
- package/cjs/core/utils/hooks/useMediaQuery.js +9 -12
- package/cjs/core/utils/hooks/useMergedRefs.js +6 -23
- package/cjs/core/utils/hooks/useOverflow.js +26 -33
- package/cjs/core/utils/hooks/useResizeObserver.js +6 -9
- package/cjs/core/utils/hooks/useSafeContext.js +4 -4
- package/cjs/core/utils/hooks/useTheme.js +18 -20
- package/cjs/core/utils/icons/StatusIconMap.js +9 -20
- package/cjs/core/utils/icons/SvgCalendar.js +3 -14
- package/cjs/core/utils/icons/SvgCaretDownSmall.js +3 -14
- package/cjs/core/utils/icons/SvgCaretRightSmall.js +3 -14
- package/cjs/core/utils/icons/SvgCaretUpSmall.js +3 -14
- package/cjs/core/utils/icons/SvgCheckmark.js +3 -14
- package/cjs/core/utils/icons/SvgCheckmarkSmall.js +3 -14
- package/cjs/core/utils/icons/SvgChevronLeft.js +3 -14
- package/cjs/core/utils/icons/SvgChevronLeftDouble.js +3 -14
- package/cjs/core/utils/icons/SvgChevronRight.js +3 -14
- package/cjs/core/utils/icons/SvgChevronRightDouble.js +3 -14
- package/cjs/core/utils/icons/SvgClose.js +3 -14
- package/cjs/core/utils/icons/SvgCloseSmall.js +3 -14
- package/cjs/core/utils/icons/SvgColumnManager.js +3 -14
- package/cjs/core/utils/icons/SvgFilter.js +3 -14
- package/cjs/core/utils/icons/SvgFilterHollow.js +3 -14
- package/cjs/core/utils/icons/SvgImportantSmall.js +3 -14
- package/cjs/core/utils/icons/SvgInfoCircular.js +3 -14
- package/cjs/core/utils/icons/SvgMore.js +3 -14
- package/cjs/core/utils/icons/SvgMoreVertical.js +3 -14
- package/cjs/core/utils/icons/SvgNew.js +3 -14
- package/cjs/core/utils/icons/SvgSmileyHappy.js +3 -14
- package/cjs/core/utils/icons/SvgSortDown.js +3 -14
- package/cjs/core/utils/icons/SvgSortUp.js +3 -14
- package/cjs/core/utils/icons/SvgStatusError.js +3 -14
- package/cjs/core/utils/icons/SvgStatusSuccess.js +3 -14
- package/cjs/core/utils/icons/SvgStatusWarning.js +3 -14
- package/cjs/core/utils/icons/SvgSwap.js +3 -14
- package/cjs/core/utils/icons/SvgUpload.js +3 -14
- package/cjs/types/react-table-config.d.ts +6 -2
- package/esm/core/Alert/Alert.js +5 -27
- package/esm/core/Avatar/Avatar.js +9 -32
- package/esm/core/AvatarGroup/AvatarGroup.js +16 -41
- package/esm/core/Backdrop/Backdrop.js +3 -25
- package/esm/core/Badge/Badge.js +10 -28
- package/esm/core/Breadcrumbs/Breadcrumbs.js +11 -37
- package/esm/core/ButtonGroup/ButtonGroup.js +7 -29
- package/esm/core/Buttons/Button/Button.js +3 -25
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +9 -31
- package/esm/core/Buttons/IconButton/IconButton.js +3 -25
- package/esm/core/Buttons/IdeasButton/IdeasButton.js +3 -25
- package/esm/core/Buttons/SplitButton/SplitButton.js +8 -30
- package/esm/core/Carousel/Carousel.js +29 -54
- package/esm/core/Carousel/CarouselContext.js +1 -1
- package/esm/core/Carousel/CarouselDot.js +4 -26
- package/esm/core/Carousel/CarouselDotsList.js +28 -55
- package/esm/core/Carousel/CarouselNavigation.js +16 -38
- package/esm/core/Carousel/CarouselSlide.js +8 -30
- package/esm/core/Carousel/CarouselSlider.js +22 -47
- package/esm/core/Checkbox/Checkbox.js +14 -38
- package/esm/core/ColorPicker/ColorBuilder.js +46 -68
- package/esm/core/ColorPicker/ColorInputPanel.js +58 -82
- package/esm/core/ColorPicker/ColorPalette.js +20 -44
- package/esm/core/ColorPicker/ColorPicker.js +21 -45
- package/esm/core/ColorPicker/ColorPickerContext.js +3 -3
- package/esm/core/ColorPicker/ColorSwatch.js +9 -30
- package/esm/core/ComboBox/ComboBox.js +55 -81
- package/esm/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxDropdown.js +10 -33
- package/esm/core/ComboBox/ComboBoxEndIcon.js +8 -30
- package/esm/core/ComboBox/ComboBoxInput.js +24 -46
- package/esm/core/ComboBox/ComboBoxInputContainer.js +5 -27
- package/esm/core/ComboBox/ComboBoxMenu.js +29 -54
- package/esm/core/ComboBox/ComboBoxMenuItem.js +7 -29
- package/esm/core/ComboBox/helpers.js +13 -21
- package/esm/core/DatePicker/DatePicker.js +82 -106
- package/esm/core/Dialog/Dialog.js +19 -39
- package/esm/core/Dialog/DialogBackdrop.js +11 -30
- package/esm/core/Dialog/DialogButtonBar.js +3 -25
- package/esm/core/Dialog/DialogContent.js +3 -25
- package/esm/core/Dialog/DialogContext.js +2 -2
- package/esm/core/Dialog/DialogDragContext.js +6 -15
- package/esm/core/Dialog/DialogMain.js +45 -52
- package/esm/core/Dialog/DialogTitleBar.js +7 -29
- package/esm/core/Dialog/DialogTitleBarTitle.js +3 -25
- package/esm/core/DropdownMenu/DropdownMenu.js +11 -33
- package/esm/core/ExpandableBlock/ExpandableBlock.js +9 -31
- package/esm/core/Fieldset/Fieldset.js +6 -30
- package/esm/core/FileUpload/FileUpload.js +10 -32
- package/esm/core/FileUpload/FileUploadTemplate.js +2 -2
- package/esm/core/Footer/Footer.js +16 -44
- package/esm/core/Footer/FooterItem.js +3 -25
- package/esm/core/Footer/FooterList.js +3 -25
- package/esm/core/Footer/FooterSeparator.js +3 -25
- package/esm/core/Header/Header.js +5 -27
- package/esm/core/Header/HeaderBasicButton.js +3 -25
- package/esm/core/Header/HeaderBreadcrumbs.js +7 -37
- package/esm/core/Header/HeaderButton.js +16 -30
- package/esm/core/Header/HeaderDropdownButton.js +9 -31
- package/esm/core/Header/HeaderLogo.js +4 -26
- package/esm/core/Header/HeaderSplitButton.js +8 -30
- package/esm/core/InformationPanel/InformationPanel.js +12 -34
- package/esm/core/InformationPanel/InformationPanelBody.js +3 -25
- package/esm/core/InformationPanel/InformationPanelContent.js +3 -25
- package/esm/core/InformationPanel/InformationPanelHeader.js +3 -25
- package/esm/core/InformationPanel/InformationPanelWrapper.js +3 -25
- package/esm/core/Input/Input.js +6 -28
- package/esm/core/InputGroup/InputGroup.js +4 -26
- package/esm/core/Label/Label.js +4 -26
- package/esm/core/LabeledInput/LabeledInput.js +4 -26
- package/esm/core/LabeledSelect/LabeledSelect.js +4 -26
- package/esm/core/LabeledTextarea/LabeledTextarea.js +4 -26
- package/esm/core/Menu/Menu.js +15 -37
- package/esm/core/Menu/MenuDivider.js +3 -25
- package/esm/core/Menu/MenuExtraContent.js +3 -25
- package/esm/core/Menu/MenuItem.js +13 -35
- package/esm/core/Menu/MenuItemSkeleton.js +8 -27
- package/esm/core/Modal/Modal.js +8 -26
- package/esm/core/Modal/ModalButtonBar.js +1 -1
- package/esm/core/Modal/ModalContent.js +1 -1
- package/esm/core/{ErrorPage → NonIdealState}/ErrorPage.d.ts +5 -1
- package/esm/core/NonIdealState/ErrorPage.js +137 -0
- package/esm/core/NonIdealState/NonIdealState.d.ts +46 -0
- package/esm/core/NonIdealState/NonIdealState.js +25 -0
- package/{cjs/core/ErrorPage → esm/core/NonIdealState}/index.d.ts +3 -1
- package/esm/core/{ErrorPage → NonIdealState}/index.js +2 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +8 -31
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +10 -34
- package/esm/core/Radio/Radio.js +7 -30
- package/esm/core/RadioTiles/RadioTile.js +6 -28
- package/esm/core/RadioTiles/RadioTileGroup.js +3 -25
- package/esm/core/Select/Select.js +53 -66
- package/esm/core/Select/SelectTag.js +3 -25
- package/esm/core/SideNavigation/SideNavigation.js +9 -35
- package/esm/core/SideNavigation/SidenavButton.js +4 -26
- package/esm/core/SideNavigation/SidenavSubmenu.js +3 -25
- package/esm/core/SideNavigation/SidenavSubmenuHeader.js +3 -25
- package/esm/core/SkipToContentLink/SkipToContentLink.js +3 -25
- package/esm/core/Slider/Slider.js +63 -91
- package/esm/core/Slider/Thumb.js +17 -36
- package/esm/core/Slider/Track.js +23 -43
- package/esm/core/StatusMessage/StatusMessage.js +3 -4
- package/esm/core/Stepper/Stepper.js +7 -31
- package/esm/core/Stepper/StepperStep.js +12 -31
- package/esm/core/Stepper/Wizard.js +3 -25
- package/esm/core/Stepper/WorkflowDiagram.js +3 -25
- package/esm/core/Stepper/WorkflowDiagramStep.js +3 -25
- package/esm/core/Surface/Surface.js +8 -27
- package/esm/core/Table/SubRowExpander.js +3 -3
- package/esm/core/Table/Table.d.ts +19 -24
- package/esm/core/Table/Table.js +177 -183
- package/esm/core/Table/TableCell.js +23 -24
- package/esm/core/Table/TablePaginator.js +46 -77
- package/esm/core/Table/TableRowMemoized.d.ts +6 -10
- package/esm/core/Table/TableRowMemoized.js +32 -56
- package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
- package/esm/core/Table/actionHandlers/filterHandler.js +4 -4
- package/esm/core/Table/actionHandlers/resizeHandler.js +13 -15
- package/esm/core/Table/actionHandlers/selectHandler.js +35 -40
- package/esm/core/Table/cells/DefaultCell.js +3 -25
- package/esm/core/Table/cells/EditableCell.js +14 -38
- package/esm/core/Table/columns/actionColumn.js +34 -52
- package/esm/core/Table/columns/expanderColumn.d.ts +2 -5
- package/esm/core/Table/columns/expanderColumn.js +9 -24
- package/esm/core/Table/columns/selectionColumn.d.ts +2 -5
- package/esm/core/Table/columns/selectionColumn.js +14 -35
- package/esm/core/Table/filters/BaseFilter.js +3 -3
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +14 -36
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +15 -26
- package/esm/core/Table/filters/FilterButtonBar.js +4 -15
- package/esm/core/Table/filters/FilterToggle.js +11 -33
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +11 -24
- package/esm/core/Table/filters/TextFilter/TextFilter.js +6 -6
- package/esm/core/Table/filters/customFilterFunctions.js +12 -14
- package/esm/core/Table/filters/defaultFilterFunctions.js +63 -65
- package/esm/core/Table/filters/tableFilters.js +4 -15
- package/esm/core/Table/hooks/useColumnDragAndDrop.js +40 -52
- package/esm/core/Table/hooks/useExpanderCell.js +15 -31
- package/esm/core/Table/hooks/useResizeColumns.js +196 -204
- package/esm/core/Table/hooks/useScrollToRow.js +10 -11
- package/esm/core/Table/hooks/useSelectionCell.js +6 -17
- package/esm/core/Table/hooks/useStickyColumns.js +27 -32
- package/esm/core/Table/hooks/useSubRowFiltering.js +35 -55
- package/esm/core/Table/hooks/useSubRowSelection.js +9 -11
- package/esm/core/Table/utils.js +15 -26
- package/esm/core/Tabs/Tab.js +3 -25
- package/esm/core/Tabs/Tabs.js +41 -63
- package/esm/core/Tag/Tag.js +4 -26
- package/esm/core/Tag/TagContainer.js +6 -29
- package/esm/core/Textarea/Textarea.js +6 -28
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +1 -0
- package/esm/core/ThemeProvider/ThemeProvider.js +15 -36
- package/esm/core/Tile/Tile.js +23 -52
- package/esm/core/TimePicker/TimePicker.js +56 -94
- package/esm/core/Toast/Toast.js +41 -61
- package/esm/core/Toast/ToastWrapper.js +10 -21
- package/esm/core/Toast/Toaster.js +83 -134
- package/esm/core/Toast/index.js +1 -1
- package/esm/core/ToggleSwitch/ToggleSwitch.js +7 -29
- package/esm/core/Tooltip/Tooltip.js +3 -25
- package/esm/core/Tree/Tree.js +54 -76
- package/esm/core/Tree/TreeContext.js +3 -3
- package/esm/core/Tree/TreeNode.js +16 -38
- package/esm/core/Tree/TreeNodeExpander.js +3 -25
- package/esm/core/Typography/Anchor/Anchor.js +2 -25
- package/esm/core/Typography/Blockquote/Blockquote.js +3 -25
- package/esm/core/Typography/Body/Body.js +4 -26
- package/esm/core/Typography/Code/Code.js +3 -25
- package/esm/core/Typography/Headline/Headline.js +3 -25
- package/esm/core/Typography/Kbd/Kbd.js +4 -26
- package/esm/core/Typography/Leading/Leading.js +3 -25
- package/esm/core/Typography/Small/Small.js +3 -25
- package/esm/core/Typography/Subheading/Subheading.js +3 -25
- package/esm/core/Typography/Text/Text.js +8 -31
- package/esm/core/Typography/Title/Title.js +3 -25
- package/esm/core/index.d.ts +2 -2
- package/esm/core/index.js +1 -1
- package/esm/core/utils/color/ColorValue.js +145 -156
- package/esm/core/utils/components/FocusTrap.js +11 -11
- package/esm/core/utils/components/InputContainer.js +10 -34
- package/esm/core/utils/components/MiddleTextTruncation.js +13 -29
- package/esm/core/utils/components/Popover.d.ts +1 -1
- package/esm/core/utils/components/Popover.js +54 -57
- package/esm/core/utils/components/Resizer.js +49 -49
- package/esm/core/utils/components/VirtualScroll.js +69 -86
- package/esm/core/utils/components/VisuallyHidden.js +3 -25
- package/esm/core/utils/components/WithCSSTransition.d.ts +2 -2
- package/esm/core/utils/components/WithCSSTransition.js +16 -38
- package/esm/core/utils/functions/colors.js +8 -8
- package/esm/core/utils/functions/dom.js +7 -8
- package/esm/core/utils/functions/focusable.js +11 -15
- package/esm/core/utils/functions/numbers.js +5 -6
- package/esm/core/utils/functions/styles.js +3 -3
- package/esm/core/utils/hooks/useContainerWidth.js +6 -10
- package/esm/core/utils/hooks/useDragAndDrop.js +28 -29
- package/esm/core/utils/hooks/useEventListener.js +6 -6
- package/esm/core/utils/hooks/useIntersection.js +7 -10
- package/esm/core/utils/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/esm/core/utils/hooks/useLatestRef.js +3 -3
- package/esm/core/utils/hooks/useMediaQuery.js +6 -9
- package/esm/core/utils/hooks/useMergedRefs.js +5 -22
- package/esm/core/utils/hooks/useOverflow.js +23 -30
- package/esm/core/utils/hooks/useResizeObserver.js +4 -7
- package/esm/core/utils/hooks/useSafeContext.js +3 -3
- package/esm/core/utils/hooks/useTheme.js +14 -16
- package/esm/core/utils/icons/StatusIconMap.js +5 -16
- package/esm/core/utils/icons/SvgCalendar.js +2 -13
- package/esm/core/utils/icons/SvgCaretDownSmall.js +2 -13
- package/esm/core/utils/icons/SvgCaretRightSmall.js +2 -13
- package/esm/core/utils/icons/SvgCaretUpSmall.js +2 -13
- package/esm/core/utils/icons/SvgCheckmark.js +2 -13
- package/esm/core/utils/icons/SvgCheckmarkSmall.js +2 -13
- package/esm/core/utils/icons/SvgChevronLeft.js +2 -13
- package/esm/core/utils/icons/SvgChevronLeftDouble.js +2 -13
- package/esm/core/utils/icons/SvgChevronRight.js +2 -13
- package/esm/core/utils/icons/SvgChevronRightDouble.js +2 -13
- package/esm/core/utils/icons/SvgClose.js +2 -13
- package/esm/core/utils/icons/SvgCloseSmall.js +2 -13
- package/esm/core/utils/icons/SvgColumnManager.js +2 -13
- package/esm/core/utils/icons/SvgFilter.js +2 -13
- package/esm/core/utils/icons/SvgFilterHollow.js +2 -13
- package/esm/core/utils/icons/SvgImportantSmall.js +2 -13
- package/esm/core/utils/icons/SvgInfoCircular.js +2 -13
- package/esm/core/utils/icons/SvgMore.js +2 -13
- package/esm/core/utils/icons/SvgMoreVertical.js +2 -13
- package/esm/core/utils/icons/SvgNew.js +2 -13
- package/esm/core/utils/icons/SvgSmileyHappy.js +2 -13
- package/esm/core/utils/icons/SvgSortDown.js +2 -13
- package/esm/core/utils/icons/SvgSortUp.js +2 -13
- package/esm/core/utils/icons/SvgStatusError.js +2 -13
- package/esm/core/utils/icons/SvgStatusSuccess.js +2 -13
- package/esm/core/utils/icons/SvgStatusWarning.js +2 -13
- package/esm/core/utils/icons/SvgSwap.js +2 -13
- package/esm/core/utils/icons/SvgUpload.js +2 -13
- package/esm/types/react-table-config.d.ts +6 -2
- package/package.json +4 -4
- package/cjs/core/ErrorPage/ErrorPage.js +0 -168
- package/esm/core/ErrorPage/ErrorPage.js +0 -161
|
@@ -220,30 +220,25 @@ export declare type TableProps<T extends Record<string, unknown> = Record<string
|
|
|
220
220
|
* Table based on [react-table](https://react-table.tanstack.com/docs/api/overview).
|
|
221
221
|
* @example
|
|
222
222
|
* const columns = React.useMemo(() => [
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* return <span onClick={onViewClick}>View</span>
|
|
243
|
-
* },
|
|
244
|
-
* },
|
|
245
|
-
* ],
|
|
246
|
-
* },
|
|
223
|
+
* {
|
|
224
|
+
* id: 'name',
|
|
225
|
+
* Header: 'Name',
|
|
226
|
+
* accessor: 'name',
|
|
227
|
+
* width: 90,
|
|
228
|
+
* },
|
|
229
|
+
* {
|
|
230
|
+
* id: 'description',
|
|
231
|
+
* Header: 'description',
|
|
232
|
+
* accessor: 'description',
|
|
233
|
+
* maxWidth: 200,
|
|
234
|
+
* },
|
|
235
|
+
* {
|
|
236
|
+
* id: 'view',
|
|
237
|
+
* Header: 'view',
|
|
238
|
+
* Cell: () => {
|
|
239
|
+
* return <span onClick={onViewClick}>View</span>
|
|
240
|
+
* },
|
|
241
|
+
* },
|
|
247
242
|
* ], [onViewClick])
|
|
248
243
|
* const data = [
|
|
249
244
|
* { name: 'Name1', description: 'Description1' },
|
package/cjs/core/Table/Table.js
CHANGED
|
@@ -1,26 +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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
@@ -30,30 +8,30 @@ exports.Table = exports.tableResizeStartAction = void 0;
|
|
|
30
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
31
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
32
10
|
*--------------------------------------------------------------------------------------------*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
13
|
+
const react_table_1 = require("react-table");
|
|
14
|
+
const ProgressIndicators_1 = require("../ProgressIndicators");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
38
16
|
require("@itwin/itwinui-css/css/table.css");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
17
|
+
const utils_2 = require("./utils");
|
|
18
|
+
const TableRowMemoized_1 = require("./TableRowMemoized");
|
|
19
|
+
const filters_1 = require("./filters");
|
|
20
|
+
const customFilterFunctions_1 = require("./filters/customFilterFunctions");
|
|
21
|
+
const hooks_1 = require("./hooks");
|
|
22
|
+
const actionHandlers_1 = require("./actionHandlers");
|
|
23
|
+
const VirtualScroll_1 = __importDefault(require("../utils/components/VirtualScroll"));
|
|
24
|
+
const columns_1 = require("./columns");
|
|
25
|
+
const singleRowSelectedAction = 'singleRowSelected';
|
|
26
|
+
const shiftRowSelectedAction = 'shiftRowSelected';
|
|
49
27
|
exports.tableResizeStartAction = 'tableResizeStart';
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
columns.forEach(
|
|
28
|
+
const tableResizeEndAction = 'tableResizeEnd';
|
|
29
|
+
const flattenColumns = (columns) => {
|
|
30
|
+
const flatColumns = [];
|
|
31
|
+
columns.forEach((column) => {
|
|
54
32
|
flatColumns.push(column);
|
|
55
33
|
if (column.columns) {
|
|
56
|
-
flatColumns.push
|
|
34
|
+
flatColumns.push(...flattenColumns(column.columns));
|
|
57
35
|
}
|
|
58
36
|
});
|
|
59
37
|
return flatColumns;
|
|
@@ -62,30 +40,25 @@ var flattenColumns = function (columns) {
|
|
|
62
40
|
* Table based on [react-table](https://react-table.tanstack.com/docs/api/overview).
|
|
63
41
|
* @example
|
|
64
42
|
* const columns = React.useMemo(() => [
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* return <span onClick={onViewClick}>View</span>
|
|
85
|
-
* },
|
|
86
|
-
* },
|
|
87
|
-
* ],
|
|
88
|
-
* },
|
|
43
|
+
* {
|
|
44
|
+
* id: 'name',
|
|
45
|
+
* Header: 'Name',
|
|
46
|
+
* accessor: 'name',
|
|
47
|
+
* width: 90,
|
|
48
|
+
* },
|
|
49
|
+
* {
|
|
50
|
+
* id: 'description',
|
|
51
|
+
* Header: 'description',
|
|
52
|
+
* accessor: 'description',
|
|
53
|
+
* maxWidth: 200,
|
|
54
|
+
* },
|
|
55
|
+
* {
|
|
56
|
+
* id: 'view',
|
|
57
|
+
* Header: 'view',
|
|
58
|
+
* Cell: () => {
|
|
59
|
+
* return <span onClick={onViewClick}>View</span>
|
|
60
|
+
* },
|
|
61
|
+
* },
|
|
89
62
|
* ], [onViewClick])
|
|
90
63
|
* const data = [
|
|
91
64
|
* { name: 'Name1', description: 'Description1' },
|
|
@@ -100,46 +73,46 @@ var flattenColumns = function (columns) {
|
|
|
100
73
|
* isSortable={true}
|
|
101
74
|
* />
|
|
102
75
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
76
|
+
const Table = (props) => {
|
|
77
|
+
const { data, columns, isLoading = false, emptyTableContent, className, style, id, isSelectable = false, onSelect, onRowClick, selectionMode = 'multi', isSortable = false, onSort, stateReducer, onBottomReached, onRowInViewport, intersectionMargin = 300, subComponent, onExpand, onFilter, globalFilterValue, emptyFilteredTableContent, filterTypes: filterFunctions, expanderCell, isRowDisabled, rowProps, density = 'default', selectSubRows = true, getSubRows, selectRowOnClick = true, paginatorRenderer, pageSize = 25, isResizable = false, columnResizeMode = 'fit', styleType = 'default', enableVirtualization = false, enableColumnReordering = false, ...rest } = props;
|
|
105
78
|
(0, utils_1.useTheme)();
|
|
106
|
-
|
|
107
|
-
|
|
79
|
+
const ownerDocument = react_1.default.useRef();
|
|
80
|
+
const defaultColumn = react_1.default.useMemo(() => ({
|
|
108
81
|
maxWidth: 0,
|
|
109
82
|
minWidth: 0,
|
|
110
83
|
width: 0,
|
|
111
|
-
})
|
|
84
|
+
}), []);
|
|
112
85
|
// useRef prevents from rerendering when one of these callbacks changes
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
react_1.default.useEffect(
|
|
86
|
+
const onBottomReachedRef = react_1.default.useRef(onBottomReached);
|
|
87
|
+
const onRowInViewportRef = react_1.default.useRef(onRowInViewport);
|
|
88
|
+
react_1.default.useEffect(() => {
|
|
116
89
|
onBottomReachedRef.current = onBottomReached;
|
|
117
90
|
onRowInViewportRef.current = onRowInViewport;
|
|
118
91
|
}, [onBottomReached, onRowInViewport]);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return flatColumns.some(
|
|
92
|
+
const hasManualSelectionColumn = react_1.default.useMemo(() => {
|
|
93
|
+
const flatColumns = flattenColumns(columns);
|
|
94
|
+
return flatColumns.some((column) => column.id === columns_1.SELECTION_CELL_ID);
|
|
122
95
|
}, [columns]);
|
|
123
|
-
|
|
96
|
+
const disableUserSelect = react_1.default.useCallback((e) => {
|
|
124
97
|
if (e.key === 'Shift') {
|
|
125
98
|
ownerDocument.current &&
|
|
126
99
|
(ownerDocument.current.documentElement.style.userSelect = 'none');
|
|
127
100
|
}
|
|
128
101
|
}, []);
|
|
129
|
-
|
|
102
|
+
const enableUserSelect = react_1.default.useCallback((e) => {
|
|
130
103
|
if (e.key === 'Shift') {
|
|
131
104
|
ownerDocument.current &&
|
|
132
105
|
(ownerDocument.current.documentElement.style.userSelect = '');
|
|
133
106
|
}
|
|
134
107
|
}, []);
|
|
135
|
-
react_1.default.useEffect(
|
|
108
|
+
react_1.default.useEffect(() => {
|
|
136
109
|
if (!isSelectable || selectionMode !== 'multi') {
|
|
137
110
|
return;
|
|
138
111
|
}
|
|
139
|
-
|
|
112
|
+
const ownerDoc = ownerDocument.current;
|
|
140
113
|
ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.addEventListener('keydown', disableUserSelect);
|
|
141
114
|
ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.addEventListener('keyup', enableUserSelect);
|
|
142
|
-
return
|
|
115
|
+
return () => {
|
|
143
116
|
ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.removeEventListener('keydown', disableUserSelect);
|
|
144
117
|
ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.removeEventListener('keyup', enableUserSelect);
|
|
145
118
|
};
|
|
@@ -150,7 +123,7 @@ var Table = function (props) {
|
|
|
150
123
|
disableUserSelect,
|
|
151
124
|
enableUserSelect,
|
|
152
125
|
]);
|
|
153
|
-
|
|
126
|
+
const tableStateReducer = react_1.default.useCallback((newState, action, previousState, instance) => {
|
|
154
127
|
switch (action.type) {
|
|
155
128
|
case react_table_1.actions.toggleSortBy:
|
|
156
129
|
onSort === null || onSort === void 0 ? void 0 : onSort(newState);
|
|
@@ -205,30 +178,37 @@ var Table = function (props) {
|
|
|
205
178
|
onSort,
|
|
206
179
|
stateReducer,
|
|
207
180
|
]);
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return data.some(
|
|
211
|
-
return getSubRows ? getSubRows(item, index) : item.subRows;
|
|
212
|
-
});
|
|
181
|
+
const filterTypes = react_1.default.useMemo(() => ({ ...customFilterFunctions_1.customFilterFunctions, ...filterFunctions }), [filterFunctions]);
|
|
182
|
+
const hasAnySubRows = react_1.default.useMemo(() => {
|
|
183
|
+
return data.some((item, index) => getSubRows ? getSubRows(item, index) : item.subRows);
|
|
213
184
|
}, [data, getSubRows]);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
185
|
+
const instance = (0, react_table_1.useTable)({
|
|
186
|
+
manualPagination: !paginatorRenderer,
|
|
187
|
+
paginateExpandedRows: false,
|
|
188
|
+
...props,
|
|
189
|
+
columns,
|
|
190
|
+
defaultColumn,
|
|
191
|
+
disableSortBy: !isSortable,
|
|
192
|
+
stateReducer: tableStateReducer,
|
|
193
|
+
filterTypes,
|
|
194
|
+
selectSubRows,
|
|
195
|
+
data,
|
|
196
|
+
getSubRows,
|
|
197
|
+
initialState: { pageSize, ...props.initialState },
|
|
198
|
+
columnResizeMode,
|
|
199
|
+
}, react_table_1.useFlexLayout, (0, hooks_1.useResizeColumns)(ownerDocument), react_table_1.useFilters, (0, hooks_1.useSubRowFiltering)(hasAnySubRows), react_table_1.useGlobalFilter, react_table_1.useSortBy, react_table_1.useExpanded, react_table_1.usePagination, react_table_1.useRowSelect, hooks_1.useSubRowSelection, (0, hooks_1.useExpanderCell)(subComponent, expanderCell, isRowDisabled), (0, hooks_1.useSelectionCell)(isSelectable, selectionMode, isRowDisabled), react_table_1.useColumnOrder, (0, hooks_1.useColumnDragAndDrop)(enableColumnReordering), hooks_1.useStickyColumns);
|
|
200
|
+
const { getTableProps, rows, headerGroups, getTableBodyProps, prepareRow, state, allColumns, dispatch, page, gotoPage, setPageSize, flatHeaders, visibleColumns, setGlobalFilter, } = instance;
|
|
201
|
+
const ariaDataAttributes = Object.entries(rest).reduce((result, [key, value]) => {
|
|
218
202
|
if (key.startsWith('data-') || key.startsWith('aria-')) {
|
|
219
203
|
result[key] = value;
|
|
220
204
|
}
|
|
221
205
|
return result;
|
|
222
206
|
}, {});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return data.length !== 0 && column.canSort;
|
|
229
|
-
};
|
|
230
|
-
var onRowClickHandler = react_1.default.useCallback(function (event, row) {
|
|
231
|
-
var isDisabled = isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original);
|
|
207
|
+
const areFiltersSet = allColumns.some((column) => column.filterValue != null && column.filterValue !== '') || !!globalFilterValue;
|
|
208
|
+
const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter;
|
|
209
|
+
const showSortButton = (column) => data.length !== 0 && column.canSort;
|
|
210
|
+
const onRowClickHandler = react_1.default.useCallback((event, row) => {
|
|
211
|
+
const isDisabled = isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original);
|
|
232
212
|
if (!isDisabled) {
|
|
233
213
|
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(event, row);
|
|
234
214
|
}
|
|
@@ -261,22 +241,22 @@ var Table = function (props) {
|
|
|
261
241
|
dispatch,
|
|
262
242
|
onRowClick,
|
|
263
243
|
]);
|
|
264
|
-
react_1.default.useEffect(
|
|
244
|
+
react_1.default.useEffect(() => {
|
|
265
245
|
setGlobalFilter(globalFilterValue);
|
|
266
246
|
}, [globalFilterValue, setGlobalFilter]);
|
|
267
|
-
react_1.default.useEffect(
|
|
247
|
+
react_1.default.useEffect(() => {
|
|
268
248
|
setPageSize(pageSize);
|
|
269
249
|
}, [pageSize, setPageSize]);
|
|
270
|
-
|
|
250
|
+
const paginatorRendererProps = react_1.default.useMemo(() => ({
|
|
271
251
|
currentPage: state.pageIndex,
|
|
272
252
|
pageSize: state.pageSize,
|
|
273
253
|
totalRowsCount: rows.length,
|
|
274
254
|
size: density !== 'default' ? 'small' : 'default',
|
|
275
|
-
isLoading
|
|
255
|
+
isLoading,
|
|
276
256
|
onPageChange: gotoPage,
|
|
277
257
|
onPageSizeChange: setPageSize,
|
|
278
258
|
totalSelectedRowsCount: selectionMode === 'single' ? 0 : instance.selectedFlatRows.length, // 0 when selectionMode = 'single' since totalSelectedRowCount is for multi-selection mode only
|
|
279
|
-
})
|
|
259
|
+
}), [
|
|
280
260
|
density,
|
|
281
261
|
gotoPage,
|
|
282
262
|
isLoading,
|
|
@@ -287,18 +267,17 @@ var Table = function (props) {
|
|
|
287
267
|
instance.selectedFlatRows,
|
|
288
268
|
selectionMode,
|
|
289
269
|
]);
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
var width = _a.width;
|
|
270
|
+
const { scrollToIndex, tableRowRef } = (0, hooks_1.useScrollToRow)({ ...props, page });
|
|
271
|
+
const columnRefs = react_1.default.useRef({});
|
|
272
|
+
const previousTableWidth = react_1.default.useRef(0);
|
|
273
|
+
const onTableResize = react_1.default.useCallback(({ width }) => {
|
|
295
274
|
instance.tableWidth = width;
|
|
296
275
|
if (width === previousTableWidth.current) {
|
|
297
276
|
return;
|
|
298
277
|
}
|
|
299
278
|
previousTableWidth.current = width;
|
|
300
279
|
// Update column widths when table was resized
|
|
301
|
-
flatHeaders.forEach(
|
|
280
|
+
flatHeaders.forEach((header) => {
|
|
302
281
|
if (columnRefs.current[header.id]) {
|
|
303
282
|
header.resizeWidth =
|
|
304
283
|
columnRefs.current[header.id].getBoundingClientRect().width;
|
|
@@ -310,24 +289,24 @@ var Table = function (props) {
|
|
|
310
289
|
}
|
|
311
290
|
dispatch({ type: exports.tableResizeStartAction });
|
|
312
291
|
}, [dispatch, state.columnResizing.columnWidths, flatHeaders, instance]);
|
|
313
|
-
|
|
292
|
+
const [resizeRef] = (0, utils_1.useResizeObserver)(onTableResize);
|
|
314
293
|
// Flexbox handles columns resize so we take new column widths before browser repaints.
|
|
315
|
-
react_1.default.useLayoutEffect(
|
|
294
|
+
react_1.default.useLayoutEffect(() => {
|
|
316
295
|
if (state.isTableResizing) {
|
|
317
|
-
|
|
318
|
-
flatHeaders.forEach(
|
|
296
|
+
const newColumnWidths = {};
|
|
297
|
+
flatHeaders.forEach((column) => {
|
|
319
298
|
if (columnRefs.current[column.id]) {
|
|
320
|
-
|
|
299
|
+
newColumnWidths[column.id] =
|
|
321
300
|
columnRefs.current[column.id].getBoundingClientRect().width;
|
|
322
301
|
}
|
|
323
302
|
});
|
|
324
|
-
dispatch({ type: tableResizeEndAction, columnWidths:
|
|
303
|
+
dispatch({ type: tableResizeEndAction, columnWidths: newColumnWidths });
|
|
325
304
|
}
|
|
326
305
|
});
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
306
|
+
const headerRef = react_1.default.useRef(null);
|
|
307
|
+
const bodyRef = react_1.default.useRef(null);
|
|
308
|
+
const getPreparedRow = react_1.default.useCallback((index) => {
|
|
309
|
+
const row = page[index];
|
|
331
310
|
prepareRow(row);
|
|
332
311
|
return (react_1.default.createElement(TableRowMemoized_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!(isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell, bodyRef: bodyRef.current, tableRowRef: enableVirtualization ? undefined : tableRowRef(row) }));
|
|
333
312
|
}, [
|
|
@@ -345,9 +324,9 @@ var Table = function (props) {
|
|
|
345
324
|
enableVirtualization,
|
|
346
325
|
tableRowRef,
|
|
347
326
|
]);
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
if (!bodyRef.current || flatHeaders.every(
|
|
327
|
+
const virtualizedItemRenderer = react_1.default.useCallback((index) => getPreparedRow(index), [getPreparedRow]);
|
|
328
|
+
const updateStickyState = () => {
|
|
329
|
+
if (!bodyRef.current || flatHeaders.every((header) => !header.sticky)) {
|
|
351
330
|
return;
|
|
352
331
|
}
|
|
353
332
|
if (bodyRef.current.scrollLeft !== 0) {
|
|
@@ -365,89 +344,104 @@ var Table = function (props) {
|
|
|
365
344
|
dispatch({ type: react_table_1.actions.setScrolledLeft, value: false });
|
|
366
345
|
}
|
|
367
346
|
};
|
|
368
|
-
react_1.default.useEffect(
|
|
347
|
+
react_1.default.useEffect(() => {
|
|
369
348
|
updateStickyState();
|
|
370
349
|
// Call only on init
|
|
371
350
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
372
351
|
}, []);
|
|
373
|
-
|
|
352
|
+
const isHeaderDirectClick = react_1.default.useRef(false);
|
|
374
353
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
375
|
-
react_1.default.createElement("div",
|
|
354
|
+
react_1.default.createElement("div", { ref: (element) => {
|
|
376
355
|
ownerDocument.current = element === null || element === void 0 ? void 0 : element.ownerDocument;
|
|
377
356
|
if (isResizable) {
|
|
378
357
|
resizeRef(element);
|
|
379
358
|
}
|
|
380
|
-
}, id: id
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
359
|
+
}, id: id, ...getTableProps({
|
|
360
|
+
className: (0, classnames_1.default)('iui-table', className),
|
|
361
|
+
style: {
|
|
362
|
+
minWidth: 0,
|
|
363
|
+
...style,
|
|
364
|
+
},
|
|
365
|
+
}), "data-iui-size": density === 'default' ? undefined : density, ...ariaDataAttributes },
|
|
366
|
+
headerGroups.map((headerGroup) => {
|
|
367
|
+
// There may be a better solution for this, but for now I'm filtering out the placeholder cells using header.id
|
|
368
|
+
headerGroup.headers = headerGroup.headers.filter((header) => !header.id.includes('iui-table-checkbox-selector_placeholder') &&
|
|
369
|
+
!header.id.includes('iui-table-expander_placeholder'));
|
|
370
|
+
const headerGroupProps = headerGroup.getHeaderGroupProps({
|
|
371
|
+
className: 'iui-table-row',
|
|
372
|
+
});
|
|
373
|
+
return (react_1.default.createElement("div", { className: 'iui-table-header-wrapper', ref: headerRef, onScroll: () => {
|
|
374
|
+
if (headerRef.current && bodyRef.current) {
|
|
375
|
+
bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
|
376
|
+
updateStickyState();
|
|
377
|
+
}
|
|
378
|
+
}, key: headerGroupProps.key },
|
|
379
|
+
react_1.default.createElement("div", { className: 'iui-table-header' },
|
|
380
|
+
react_1.default.createElement("div", { ...headerGroupProps }, headerGroup.headers.map((column, index) => {
|
|
381
|
+
const { onClick, ...restSortProps } = column.getSortByToggleProps();
|
|
382
|
+
const columnProps = column.getHeaderProps({
|
|
383
|
+
...restSortProps,
|
|
384
|
+
className: (0, classnames_1.default)('iui-table-cell', {
|
|
385
|
+
'iui-actionable': column.canSort,
|
|
386
|
+
'iui-sorted': column.isSorted,
|
|
387
|
+
'iui-table-cell-sticky': !!column.sticky,
|
|
388
|
+
}, column.columnClassName),
|
|
389
|
+
style: {
|
|
390
|
+
...(0, utils_2.getCellStyle)(column, !!state.isTableResizing),
|
|
391
|
+
...(0, utils_2.getStickyStyle)(column, visibleColumns),
|
|
392
|
+
flexWrap: 'unset',
|
|
393
|
+
},
|
|
394
|
+
});
|
|
395
|
+
return (react_1.default.createElement("div", { ...columnProps, ...column.getDragAndDropProps(), key: columnProps.key, title: undefined, ref: (el) => {
|
|
396
|
+
if (el) {
|
|
397
|
+
columnRefs.current[column.id] = el;
|
|
398
|
+
column.resizeWidth =
|
|
399
|
+
el.getBoundingClientRect().width;
|
|
400
|
+
}
|
|
401
|
+
}, onMouseDown: () => {
|
|
402
|
+
isHeaderDirectClick.current = true;
|
|
403
|
+
}, onClick: (e) => {
|
|
404
|
+
// Prevents from triggering sort when resizing and mouse is released in the middle of header
|
|
405
|
+
if (isHeaderDirectClick.current) {
|
|
406
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
407
|
+
isHeaderDirectClick.current = false;
|
|
408
|
+
}
|
|
409
|
+
}, tabIndex: showSortButton(column) ? 0 : undefined, onKeyDown: (e) => {
|
|
410
|
+
if (e.key == 'Enter' && showSortButton(column)) {
|
|
411
|
+
column.toggleSortBy();
|
|
412
|
+
}
|
|
413
|
+
} },
|
|
414
|
+
column.render('Header'),
|
|
415
|
+
(showFilterButton(column) ||
|
|
416
|
+
showSortButton(column)) && (react_1.default.createElement("div", { className: 'iui-table-header-actions-container' },
|
|
417
|
+
showFilterButton(column) && (react_1.default.createElement(filters_1.FilterToggle, { column: column })),
|
|
418
|
+
showSortButton(column) && (react_1.default.createElement("div", { className: 'iui-table-cell-end-icon' }, column.isSortedDesc ||
|
|
419
|
+
(!column.isSorted && column.sortDescFirst) ? (react_1.default.createElement(utils_1.SvgSortDown, { className: 'iui-table-sort', "aria-hidden": true })) : (react_1.default.createElement(utils_1.SvgSortUp, { className: 'iui-table-sort', "aria-hidden": true })))))),
|
|
420
|
+
isResizable &&
|
|
421
|
+
column.isResizerVisible &&
|
|
422
|
+
(index !== headerGroup.headers.length - 1 ||
|
|
423
|
+
columnResizeMode === 'expand') && (react_1.default.createElement("div", { ...column.getResizerProps(), className: 'iui-table-resizer' },
|
|
424
|
+
react_1.default.createElement("div", { className: 'iui-table-resizer-bar' }))),
|
|
425
|
+
enableColumnReordering &&
|
|
426
|
+
!column.disableReordering && (react_1.default.createElement("div", { className: 'iui-table-reorder-bar' })),
|
|
427
|
+
column.sticky === 'left' &&
|
|
428
|
+
state.sticky.isScrolledToRight && (react_1.default.createElement("div", { className: 'iui-table-cell-shadow-right' })),
|
|
429
|
+
column.sticky === 'right' &&
|
|
430
|
+
state.sticky.isScrolledToLeft && (react_1.default.createElement("div", { className: 'iui-table-cell-shadow-left' }))));
|
|
431
|
+
})))));
|
|
432
|
+
}),
|
|
433
|
+
react_1.default.createElement("div", { ...getTableBodyProps({
|
|
434
|
+
className: (0, classnames_1.default)('iui-table-body', {
|
|
435
|
+
'iui-zebra-striping': styleType === 'zebra-rows',
|
|
436
|
+
}),
|
|
437
|
+
style: { outline: 0 },
|
|
438
|
+
}), ref: bodyRef, onScroll: () => {
|
|
445
439
|
if (headerRef.current && bodyRef.current) {
|
|
446
440
|
headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
447
441
|
updateStickyState();
|
|
448
442
|
}
|
|
449
|
-
}, tabIndex: -1, "aria-multiselectable": (isSelectable && selectionMode === 'multi') || undefined }
|
|
450
|
-
data.length !== 0 && (react_1.default.createElement(react_1.default.Fragment, null, enableVirtualization ? (react_1.default.createElement(VirtualScroll_1.default, { itemsLength: page.length, itemRenderer: virtualizedItemRenderer, scrollToIndex: scrollToIndex })) : (page.map(
|
|
443
|
+
}, tabIndex: -1, "aria-multiselectable": (isSelectable && selectionMode === 'multi') || undefined },
|
|
444
|
+
data.length !== 0 && (react_1.default.createElement(react_1.default.Fragment, null, enableVirtualization ? (react_1.default.createElement(VirtualScroll_1.default, { itemsLength: page.length, itemRenderer: virtualizedItemRenderer, scrollToIndex: scrollToIndex })) : (page.map((_, index) => getPreparedRow(index))))),
|
|
451
445
|
isLoading && data.length === 0 && (react_1.default.createElement("div", { className: 'iui-table-empty' },
|
|
452
446
|
react_1.default.createElement(ProgressIndicators_1.ProgressRadial, { indeterminate: true }))),
|
|
453
447
|
isLoading && data.length !== 0 && (react_1.default.createElement("div", { className: 'iui-table-row' },
|