@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
|
@@ -1,232 +1,229 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
1
|
import { actions, makePropGetter, useGetLatest, } from 'react-table';
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions);
|
|
27
|
-
};
|
|
2
|
+
export const useResizeColumns = (ownerDocument) => (hooks) => {
|
|
3
|
+
hooks.getResizerProps = [defaultGetResizerProps(ownerDocument)];
|
|
4
|
+
hooks.stateReducers.push(reducer);
|
|
5
|
+
hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions);
|
|
28
6
|
};
|
|
29
|
-
|
|
7
|
+
const isTouchEvent = (event) => {
|
|
30
8
|
return event.type === 'touchstart';
|
|
31
9
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
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
|
-
upHandler: function () {
|
|
66
|
-
var _a, _b, _c;
|
|
67
|
-
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
|
|
68
|
-
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
|
|
69
|
-
(_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseleave', handlersAndEvents.mouse.upHandler);
|
|
70
|
-
dispatchEnd();
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
touch: {
|
|
74
|
-
moveEvent: 'touchmove',
|
|
75
|
-
moveHandler: function (e) {
|
|
76
|
-
if (e.cancelable) {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
e.stopPropagation();
|
|
79
|
-
}
|
|
80
|
-
dispatchMove(e.touches[0].clientX);
|
|
81
|
-
},
|
|
82
|
-
upEvent: 'touchend',
|
|
83
|
-
upHandler: function () {
|
|
84
|
-
var _a, _b;
|
|
85
|
-
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
|
|
86
|
-
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
|
|
87
|
-
dispatchEnd();
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
var events = isTouchEvent(e)
|
|
92
|
-
? handlersAndEvents.touch
|
|
93
|
-
: handlersAndEvents.mouse;
|
|
94
|
-
var passiveIfSupported = passiveEventSupported()
|
|
95
|
-
? { passive: false }
|
|
96
|
-
: false;
|
|
97
|
-
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
|
|
98
|
-
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
|
|
99
|
-
if (!isTouchEvent(e)) {
|
|
100
|
-
(_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.addEventListener('mouseleave', handlersAndEvents.mouse.upHandler, passiveIfSupported);
|
|
101
|
-
}
|
|
102
|
-
dispatch({
|
|
103
|
-
type: actions.columnStartResizing,
|
|
104
|
-
columnId: header.id,
|
|
105
|
-
columnWidth: getHeaderWidth(header),
|
|
106
|
-
nextColumnWidth: getHeaderWidth(nextHeader),
|
|
107
|
-
headerIdWidths: headerIdWidths,
|
|
108
|
-
nextHeaderIdWidths: nextHeaderIdWidths,
|
|
109
|
-
clientX: clientX,
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
return [
|
|
113
|
-
props,
|
|
114
|
-
{
|
|
115
|
-
onClick: function (e) {
|
|
116
|
-
// Prevents from triggering sort
|
|
117
|
-
e.stopPropagation();
|
|
118
|
-
},
|
|
119
|
-
onMouseDown: function (e) {
|
|
120
|
-
e.persist();
|
|
121
|
-
// Prevents from triggering drag'n'drop
|
|
122
|
-
e.preventDefault();
|
|
123
|
-
// Prevents from triggering sort
|
|
124
|
-
e.stopPropagation();
|
|
125
|
-
onResizeStart(e, header);
|
|
10
|
+
const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, nextHeader, }) => {
|
|
11
|
+
const { dispatch } = instance;
|
|
12
|
+
const onResizeStart = (e, header) => {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
15
|
+
if (isTouchEvent(e) && e.touches && e.touches.length > 1) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const headerIdWidths = getLeafHeaders(header).map((d) => [
|
|
19
|
+
d.id,
|
|
20
|
+
getHeaderWidth(d),
|
|
21
|
+
]);
|
|
22
|
+
const nextHeaderIdWidths = nextHeader
|
|
23
|
+
? getLeafHeaders(nextHeader).map((d) => [d.id, getHeaderWidth(d)])
|
|
24
|
+
: [];
|
|
25
|
+
const clientX = isTouchEvent(e)
|
|
26
|
+
? Math.round(e.touches[0].clientX)
|
|
27
|
+
: e.clientX;
|
|
28
|
+
const dispatchMove = (clientXPos) => dispatch({ type: actions.columnResizing, clientX: clientXPos });
|
|
29
|
+
const dispatchEnd = () => dispatch({
|
|
30
|
+
type: actions.columnDoneResizing,
|
|
31
|
+
});
|
|
32
|
+
const handlersAndEvents = {
|
|
33
|
+
mouse: {
|
|
34
|
+
moveEvent: 'mousemove',
|
|
35
|
+
moveHandler: (e) => dispatchMove(e.clientX),
|
|
36
|
+
upEvent: 'mouseup',
|
|
37
|
+
upHandler: () => {
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
|
|
40
|
+
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
|
|
41
|
+
(_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseleave', handlersAndEvents.mouse.upHandler);
|
|
42
|
+
dispatchEnd();
|
|
126
43
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
44
|
+
},
|
|
45
|
+
touch: {
|
|
46
|
+
moveEvent: 'touchmove',
|
|
47
|
+
moveHandler: (e) => {
|
|
48
|
+
if (e.cancelable) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
}
|
|
52
|
+
dispatchMove(e.touches[0].clientX);
|
|
132
53
|
},
|
|
133
|
-
|
|
134
|
-
|
|
54
|
+
upEvent: 'touchend',
|
|
55
|
+
upHandler: () => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
|
|
58
|
+
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
|
|
59
|
+
dispatchEnd();
|
|
135
60
|
},
|
|
136
|
-
draggable: false,
|
|
137
|
-
role: 'separator',
|
|
138
61
|
},
|
|
139
|
-
|
|
62
|
+
};
|
|
63
|
+
const events = isTouchEvent(e)
|
|
64
|
+
? handlersAndEvents.touch
|
|
65
|
+
: handlersAndEvents.mouse;
|
|
66
|
+
const passiveIfSupported = passiveEventSupported()
|
|
67
|
+
? { passive: false }
|
|
68
|
+
: false;
|
|
69
|
+
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
|
|
70
|
+
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
|
|
71
|
+
if (!isTouchEvent(e)) {
|
|
72
|
+
(_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.addEventListener('mouseleave', handlersAndEvents.mouse.upHandler, passiveIfSupported);
|
|
73
|
+
}
|
|
74
|
+
dispatch({
|
|
75
|
+
type: actions.columnStartResizing,
|
|
76
|
+
columnId: header.id,
|
|
77
|
+
columnWidth: getHeaderWidth(header),
|
|
78
|
+
nextColumnWidth: getHeaderWidth(nextHeader),
|
|
79
|
+
headerIdWidths,
|
|
80
|
+
nextHeaderIdWidths,
|
|
81
|
+
clientX,
|
|
82
|
+
});
|
|
140
83
|
};
|
|
84
|
+
return [
|
|
85
|
+
props,
|
|
86
|
+
{
|
|
87
|
+
onClick: (e) => {
|
|
88
|
+
// Prevents from triggering sort
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
},
|
|
91
|
+
onMouseDown: (e) => {
|
|
92
|
+
e.persist();
|
|
93
|
+
// Prevents from triggering drag'n'drop
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
// Prevents from triggering sort
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
onResizeStart(e, header);
|
|
98
|
+
},
|
|
99
|
+
onTouchStart: (e) => {
|
|
100
|
+
e.persist();
|
|
101
|
+
// Prevents from triggering drag'n'drop
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
onResizeStart(e, header);
|
|
104
|
+
},
|
|
105
|
+
style: {
|
|
106
|
+
cursor: 'col-resize',
|
|
107
|
+
},
|
|
108
|
+
draggable: false,
|
|
109
|
+
role: 'separator',
|
|
110
|
+
},
|
|
111
|
+
];
|
|
141
112
|
};
|
|
142
113
|
useResizeColumns.pluginName = 'useResizeColumns';
|
|
143
|
-
|
|
114
|
+
const reducer = (newState, action, previousState, instance) => {
|
|
144
115
|
if (action.type === actions.init) {
|
|
145
|
-
return
|
|
116
|
+
return {
|
|
117
|
+
...newState,
|
|
118
|
+
columnResizing: {
|
|
146
119
|
columnWidths: {},
|
|
147
|
-
}
|
|
120
|
+
},
|
|
121
|
+
};
|
|
148
122
|
}
|
|
149
123
|
if (action.type === actions.resetResize) {
|
|
150
|
-
return
|
|
124
|
+
return {
|
|
125
|
+
...newState,
|
|
126
|
+
columnResizing: {
|
|
151
127
|
columnWidths: {},
|
|
152
|
-
}
|
|
128
|
+
},
|
|
129
|
+
};
|
|
153
130
|
}
|
|
154
131
|
if (action.type === actions.columnStartResizing) {
|
|
155
|
-
|
|
156
|
-
return
|
|
132
|
+
const { clientX, columnId, columnWidth, nextColumnWidth, headerIdWidths, nextHeaderIdWidths, } = action;
|
|
133
|
+
return {
|
|
134
|
+
...newState,
|
|
135
|
+
columnResizing: {
|
|
136
|
+
...newState.columnResizing,
|
|
137
|
+
startX: clientX,
|
|
138
|
+
columnWidth,
|
|
139
|
+
nextColumnWidth,
|
|
140
|
+
headerIdWidths,
|
|
141
|
+
nextHeaderIdWidths,
|
|
142
|
+
isResizingColumn: columnId,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
157
145
|
}
|
|
158
146
|
if (action.type === actions.columnResizing) {
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
const { clientX } = action;
|
|
148
|
+
const { startX = 0, columnWidth = 1, nextColumnWidth = 1, headerIdWidths = [], nextHeaderIdWidths = [], } = newState.columnResizing;
|
|
161
149
|
if (!instance) {
|
|
162
150
|
return newState;
|
|
163
151
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
152
|
+
const deltaX = clientX - startX;
|
|
153
|
+
const newColumnWidths = getColumnWidths(headerIdWidths, deltaX / columnWidth);
|
|
154
|
+
const isTableWidthDecreasing = calculateTableWidth(newColumnWidths, instance.flatHeaders) <
|
|
167
155
|
instance.tableWidth;
|
|
168
|
-
|
|
156
|
+
const newNextColumnWidths = (instance === null || instance === void 0 ? void 0 : instance.columnResizeMode) === 'fit' ||
|
|
169
157
|
((instance === null || instance === void 0 ? void 0 : instance.columnResizeMode) === 'expand' && isTableWidthDecreasing)
|
|
170
158
|
? getColumnWidths(nextHeaderIdWidths, -deltaX / nextColumnWidth)
|
|
171
159
|
: {};
|
|
172
160
|
if (!isNewColumnWidthsValid(newColumnWidths, instance.flatHeaders) ||
|
|
173
161
|
!isNewColumnWidthsValid(newNextColumnWidths, instance.flatHeaders) ||
|
|
174
|
-
!isNewTableWidthValid(
|
|
162
|
+
!isNewTableWidthValid({ ...newColumnWidths, ...newNextColumnWidths }, instance)) {
|
|
175
163
|
return newState;
|
|
176
164
|
}
|
|
177
165
|
// Setting `width` here because it might take several rerenders until actual column width is set.
|
|
178
166
|
// Also setting after the actual resize happened.
|
|
179
|
-
instance === null || instance === void 0 ? void 0 : instance.flatHeaders.forEach(
|
|
167
|
+
instance === null || instance === void 0 ? void 0 : instance.flatHeaders.forEach((h) => {
|
|
180
168
|
if (!h.width) {
|
|
181
169
|
h.width = h.resizeWidth;
|
|
182
170
|
}
|
|
183
171
|
});
|
|
184
|
-
return
|
|
172
|
+
return {
|
|
173
|
+
...newState,
|
|
174
|
+
columnResizing: {
|
|
175
|
+
...newState.columnResizing,
|
|
176
|
+
columnWidths: {
|
|
177
|
+
...newState.columnResizing.columnWidths,
|
|
178
|
+
...newColumnWidths,
|
|
179
|
+
...newNextColumnWidths,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
};
|
|
185
183
|
}
|
|
186
184
|
if (action.type === actions.columnDoneResizing) {
|
|
187
|
-
return
|
|
185
|
+
return {
|
|
186
|
+
...newState,
|
|
187
|
+
columnResizing: {
|
|
188
|
+
...newState.columnResizing,
|
|
189
|
+
startX: undefined,
|
|
190
|
+
isResizingColumn: undefined,
|
|
191
|
+
},
|
|
192
|
+
};
|
|
188
193
|
}
|
|
189
194
|
return newState;
|
|
190
195
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
headerIdWidths.forEach(
|
|
194
|
-
var headerId = _a[0], headerWidth = _a[1];
|
|
196
|
+
const getColumnWidths = (headerIdWidths, deltaPercentage) => {
|
|
197
|
+
const columnWidths = {};
|
|
198
|
+
headerIdWidths.forEach(([headerId, headerWidth]) => {
|
|
195
199
|
columnWidths[headerId] = Math.max(headerWidth + headerWidth * deltaPercentage, 0);
|
|
196
200
|
});
|
|
197
201
|
return columnWidths;
|
|
198
202
|
};
|
|
199
|
-
|
|
203
|
+
const isNewColumnWidthsValid = (columnWidths, headers) => {
|
|
200
204
|
// Prevents from going outside the column bounds
|
|
201
|
-
if (Object.values(columnWidths).some(
|
|
205
|
+
if (Object.values(columnWidths).some((width) => width <= 1)) {
|
|
202
206
|
return false;
|
|
203
207
|
}
|
|
204
|
-
|
|
205
|
-
|
|
208
|
+
for (const [headerId, width] of Object.entries(columnWidths)) {
|
|
209
|
+
const header = headers === null || headers === void 0 ? void 0 : headers.find((h) => h.id === headerId);
|
|
206
210
|
if (!header) {
|
|
207
|
-
|
|
211
|
+
continue;
|
|
208
212
|
}
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
const minWidth = header.minWidth || 0;
|
|
214
|
+
const maxWidth = header.maxWidth || Infinity;
|
|
211
215
|
if (width < minWidth || width > maxWidth) {
|
|
212
|
-
return
|
|
216
|
+
return false;
|
|
213
217
|
}
|
|
214
|
-
};
|
|
215
|
-
for (var _i = 0, _a = Object.entries(columnWidths); _i < _a.length; _i++) {
|
|
216
|
-
var _b = _a[_i], headerId = _b[0], width = _b[1];
|
|
217
|
-
var state_1 = _loop_1(headerId, width);
|
|
218
|
-
if (typeof state_1 === "object")
|
|
219
|
-
return state_1.value;
|
|
220
218
|
}
|
|
221
219
|
return true;
|
|
222
220
|
};
|
|
223
|
-
|
|
221
|
+
const isNewTableWidthValid = (columnWidths, instance) => {
|
|
224
222
|
if (instance.columnResizeMode === 'fit') {
|
|
225
223
|
return true;
|
|
226
224
|
}
|
|
227
|
-
|
|
228
|
-
for (
|
|
229
|
-
var header = _a[_i];
|
|
225
|
+
let newTableWidth = 0;
|
|
226
|
+
for (const header of instance.flatHeaders) {
|
|
230
227
|
newTableWidth += columnWidths[header.id]
|
|
231
228
|
? columnWidths[header.id]
|
|
232
229
|
: getHeaderWidth(header);
|
|
@@ -237,21 +234,21 @@ var isNewTableWidthValid = function (columnWidths, instance) {
|
|
|
237
234
|
}
|
|
238
235
|
return true;
|
|
239
236
|
};
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
flatHeaders.forEach(
|
|
237
|
+
const useInstanceBeforeDimensions = (instance) => {
|
|
238
|
+
const { flatHeaders, getHooks, state: { columnResizing }, columnResizeMode, } = instance;
|
|
239
|
+
const getInstance = useGetLatest(instance);
|
|
240
|
+
flatHeaders.forEach((header, index) => {
|
|
244
241
|
var _a;
|
|
245
|
-
|
|
242
|
+
const resizeWidth = columnResizing.columnWidths[header.id];
|
|
246
243
|
header.width = resizeWidth || header.width || header.originalWidth;
|
|
247
244
|
header.isResizing = columnResizing.isResizingColumn === header.id;
|
|
248
|
-
|
|
245
|
+
const headerToResize = header.disableResizing && columnResizeMode === 'fit'
|
|
249
246
|
? getPreviousResizableHeader(header, instance)
|
|
250
247
|
: header;
|
|
251
248
|
// When `columnResizeMode` is `expand` and it is a last column,
|
|
252
249
|
// then try to find some column on the left side to resize
|
|
253
250
|
// when table width is decreasing.
|
|
254
|
-
|
|
251
|
+
const nextResizableHeader = columnResizeMode === 'expand' && index === flatHeaders.length - 1
|
|
255
252
|
? getPreviousResizableHeader(header, instance)
|
|
256
253
|
: getNextResizableHeader(header, instance);
|
|
257
254
|
header.canResize =
|
|
@@ -274,30 +271,26 @@ var useInstanceBeforeDimensions = function (instance) {
|
|
|
274
271
|
});
|
|
275
272
|
});
|
|
276
273
|
};
|
|
277
|
-
|
|
274
|
+
const getPreviousResizableHeader = (headerColumn, instance) => {
|
|
278
275
|
var _a;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
|
|
284
|
-
return __spreadArray([], headersList, true).slice(0, headerIndex)
|
|
276
|
+
const headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(({ isVisible }) => isVisible);
|
|
277
|
+
const headerIndex = headersList.findIndex((h) => h.id === headerColumn.id);
|
|
278
|
+
return [...headersList]
|
|
279
|
+
.slice(0, headerIndex)
|
|
285
280
|
.reverse()
|
|
286
|
-
.find(
|
|
281
|
+
.find((h) => !h.disableResizing);
|
|
287
282
|
};
|
|
288
|
-
|
|
283
|
+
const getNextResizableHeader = (headerColumn, instance) => {
|
|
289
284
|
var _a;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
return __spreadArray([], headersList, true).slice(headerIndex + 1)
|
|
296
|
-
.find(function (h) { return !h.disableResizing; });
|
|
285
|
+
const headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(({ isVisible }) => isVisible);
|
|
286
|
+
const headerIndex = headersList.findIndex((h) => h.id === headerColumn.id);
|
|
287
|
+
return [...headersList]
|
|
288
|
+
.slice(headerIndex + 1)
|
|
289
|
+
.find((h) => !h.disableResizing);
|
|
297
290
|
};
|
|
298
291
|
function getLeafHeaders(header) {
|
|
299
|
-
|
|
300
|
-
|
|
292
|
+
const leafHeaders = [];
|
|
293
|
+
const recurseHeader = (header) => {
|
|
301
294
|
if (header.columns && header.columns.length) {
|
|
302
295
|
header.columns.map(recurseHeader);
|
|
303
296
|
}
|
|
@@ -306,13 +299,12 @@ function getLeafHeaders(header) {
|
|
|
306
299
|
recurseHeader(header);
|
|
307
300
|
return leafHeaders;
|
|
308
301
|
}
|
|
309
|
-
|
|
302
|
+
const getHeaderWidth = (header) => {
|
|
310
303
|
return Number(header.width || header.resizeWidth || 0);
|
|
311
304
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
for (
|
|
315
|
-
var header = headers_1[_i];
|
|
305
|
+
const calculateTableWidth = (columnWidths, headers) => {
|
|
306
|
+
let newTableWidth = 0;
|
|
307
|
+
for (const header of headers) {
|
|
316
308
|
newTableWidth += columnWidths[header.id]
|
|
317
309
|
? columnWidths[header.id]
|
|
318
310
|
: getHeaderWidth(header);
|
|
@@ -320,21 +312,21 @@ var calculateTableWidth = function (columnWidths, headers) {
|
|
|
320
312
|
return newTableWidth;
|
|
321
313
|
};
|
|
322
314
|
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#safely_detecting_option_support
|
|
323
|
-
|
|
324
|
-
|
|
315
|
+
let passiveSupported = null;
|
|
316
|
+
const passiveEventSupported = () => {
|
|
325
317
|
// memoize support to avoid adding multiple test events
|
|
326
318
|
if (passiveSupported != null) {
|
|
327
319
|
return passiveSupported;
|
|
328
320
|
}
|
|
329
321
|
try {
|
|
330
|
-
|
|
322
|
+
const options = {
|
|
331
323
|
once: true,
|
|
332
324
|
get passive() {
|
|
333
325
|
passiveSupported = true;
|
|
334
326
|
return false;
|
|
335
327
|
},
|
|
336
328
|
};
|
|
337
|
-
window.addEventListener('test',
|
|
329
|
+
window.addEventListener('test', () => { }, options);
|
|
338
330
|
}
|
|
339
331
|
catch (_a) {
|
|
340
332
|
passiveSupported = false;
|
|
@@ -3,27 +3,26 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
export function useScrollToRow(
|
|
7
|
-
|
|
8
|
-
var rowRefs = React.useRef({});
|
|
6
|
+
export function useScrollToRow({ data, enableVirtualization, page, paginatorRenderer, scrollToRow, }) {
|
|
7
|
+
const rowRefs = React.useRef({});
|
|
9
8
|
// Refs prevents from having `page` and `data` as dependencies
|
|
10
9
|
// therefore we avoid unnecessary scroll to row.
|
|
11
|
-
|
|
10
|
+
const pageRef = React.useRef(page);
|
|
12
11
|
pageRef.current = page;
|
|
13
|
-
|
|
12
|
+
const dataRef = React.useRef(data);
|
|
14
13
|
dataRef.current = data;
|
|
15
14
|
// For virtualized tables, all we need to do is pass the index of the item
|
|
16
15
|
// to the VirtualScroll component
|
|
17
|
-
|
|
16
|
+
const scrollToIndex = React.useMemo(() => {
|
|
18
17
|
if (!scrollToRow || paginatorRenderer) {
|
|
19
18
|
return undefined;
|
|
20
19
|
}
|
|
21
|
-
|
|
20
|
+
const index = scrollToRow(pageRef.current, dataRef.current);
|
|
22
21
|
return index < 0 ? undefined : index;
|
|
23
22
|
}, [paginatorRenderer, scrollToRow]);
|
|
24
23
|
// For non-virtualized tables, we need to add a ref to each row
|
|
25
24
|
// and scroll to the element
|
|
26
|
-
React.useEffect(
|
|
25
|
+
React.useEffect(() => {
|
|
27
26
|
var _a;
|
|
28
27
|
if (enableVirtualization ||
|
|
29
28
|
scrollToIndex === undefined ||
|
|
@@ -33,10 +32,10 @@ export function useScrollToRow(_a) {
|
|
|
33
32
|
}
|
|
34
33
|
(_a = rowRefs.current[pageRef.current[scrollToIndex].id]) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
35
34
|
}, [enableVirtualization, scrollToIndex]);
|
|
36
|
-
|
|
37
|
-
return
|
|
35
|
+
const tableRowRef = React.useCallback((row) => {
|
|
36
|
+
return (element) => {
|
|
38
37
|
rowRefs.current[row.id] = element;
|
|
39
38
|
};
|
|
40
39
|
}, []);
|
|
41
|
-
return { scrollToIndex
|
|
40
|
+
return { scrollToIndex, tableRowRef };
|
|
42
41
|
}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
1
|
import { SelectionColumn, SELECTION_CELL_ID } from '../columns';
|
|
11
|
-
export
|
|
2
|
+
export const useSelectionCell = (isSelectable, selectionMode, isRowDisabled) => (hooks) => {
|
|
12
3
|
if (!isSelectable) {
|
|
13
4
|
return;
|
|
14
5
|
}
|
|
15
|
-
hooks.allColumns.push(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}; };
|
|
6
|
+
hooks.allColumns.push((columns) => selectionMode === 'single' ||
|
|
7
|
+
columns.find((c) => c.id === SELECTION_CELL_ID)
|
|
8
|
+
? columns
|
|
9
|
+
: [SelectionColumn({ isDisabled: isRowDisabled }), ...columns]);
|
|
10
|
+
};
|