@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,25 +1,3 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
/*---------------------------------------------------------------------------------------------
|
|
24
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -31,16 +9,14 @@ import { IconButton, Button, DropdownButton } from '../Buttons';
|
|
|
31
9
|
import { ProgressRadial } from '../ProgressIndicators';
|
|
32
10
|
import { MenuItem } from '../Menu';
|
|
33
11
|
import { getBoundedValue, useTheme, useOverflow, useContainerWidth, SvgChevronLeft, SvgChevronRight, } from '../utils';
|
|
34
|
-
|
|
35
|
-
pageSizeLabel:
|
|
36
|
-
rangeLabel:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
: "".concat(startIndex, "-").concat(endIndex, " of ").concat(totalRows);
|
|
40
|
-
},
|
|
12
|
+
const defaultLocalization = {
|
|
13
|
+
pageSizeLabel: (size) => `${size} per page`,
|
|
14
|
+
rangeLabel: (startIndex, endIndex, totalRows, isLoading) => isLoading
|
|
15
|
+
? `${startIndex}-${endIndex}…`
|
|
16
|
+
: `${startIndex}-${endIndex} of ${totalRows}`,
|
|
41
17
|
previousPage: 'Previous page',
|
|
42
18
|
nextPage: 'Next page',
|
|
43
|
-
goToPageLabel:
|
|
19
|
+
goToPageLabel: (page) => `Go to page ${page}`,
|
|
44
20
|
rowsPerPageLabel: 'Rows per page',
|
|
45
21
|
};
|
|
46
22
|
/**
|
|
@@ -52,50 +28,45 @@ var defaultLocalization = {
|
|
|
52
28
|
* paginatorRenderer={(props) => <TablePaginator {...props} />}
|
|
53
29
|
* />
|
|
54
30
|
*/
|
|
55
|
-
export
|
|
56
|
-
|
|
31
|
+
export const TablePaginator = (props) => {
|
|
32
|
+
const { currentPage, totalRowsCount, pageSize, onPageChange, totalSelectedRowsCount = 0, focusActivationMode = 'manual', isLoading = false, size = 'default', pageSizeList, onPageSizeChange, localization: userLocalization, className, ...rest } = props;
|
|
57
33
|
useTheme();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
React.useEffect(
|
|
34
|
+
const localization = React.useMemo(() => ({ ...defaultLocalization, ...userLocalization }), [userLocalization]);
|
|
35
|
+
const pageListRef = React.useRef(null);
|
|
36
|
+
const [focusedIndex, setFocusedIndex] = React.useState(currentPage);
|
|
37
|
+
React.useEffect(() => {
|
|
62
38
|
setFocusedIndex(currentPage);
|
|
63
39
|
}, [currentPage]);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
React.useEffect(
|
|
40
|
+
const needFocus = React.useRef(false);
|
|
41
|
+
const isMounted = React.useRef(false);
|
|
42
|
+
React.useEffect(() => {
|
|
67
43
|
var _a, _b;
|
|
68
44
|
// Checking `isMounted.current` prevents from focusing on initial load.
|
|
69
45
|
// Checking `needFocus.current` prevents from focusing page when clicked on previous/next page.
|
|
70
46
|
if (isMounted.current && needFocus.current) {
|
|
71
|
-
|
|
47
|
+
const buttonToFocus = Array.from((_b = (_a = pageListRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.iui-table-paginator-page-button')) !== null && _b !== void 0 ? _b : []).find((el) => { var _a; return ((_a = el.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === (focusedIndex + 1).toString(); });
|
|
72
48
|
buttonToFocus === null || buttonToFocus === void 0 ? void 0 : buttonToFocus.focus();
|
|
73
49
|
needFocus.current = false;
|
|
74
50
|
}
|
|
75
51
|
isMounted.current = true;
|
|
76
52
|
}, [focusedIndex]);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.map(function (_, index) { return pageButton(index); });
|
|
89
|
-
}, [pageButton, totalPagesCount]);
|
|
90
|
-
var _f = useOverflow(pageList), overflowRef = _f[0], visibleCount = _f[1];
|
|
91
|
-
var _g = useContainerWidth(), paginatorResizeRef = _g[0], paginatorWidth = _g[1];
|
|
92
|
-
var onKeyDown = function (event) {
|
|
53
|
+
const buttonSize = size != 'default' ? 'small' : undefined;
|
|
54
|
+
const pageButton = React.useCallback((index, tabIndex = index === focusedIndex ? 0 : -1) => (React.createElement("button", { key: index, className: cx('iui-table-paginator-page-button', {
|
|
55
|
+
'iui-table-paginator-page-button-small': buttonSize === 'small',
|
|
56
|
+
}), "data-iui-active": index === currentPage, onClick: () => onPageChange(index), "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1)), [focusedIndex, currentPage, localization, buttonSize, onPageChange]);
|
|
57
|
+
const totalPagesCount = Math.ceil(totalRowsCount / pageSize);
|
|
58
|
+
const pageList = React.useMemo(() => new Array(totalPagesCount)
|
|
59
|
+
.fill(null)
|
|
60
|
+
.map((_, index) => pageButton(index)), [pageButton, totalPagesCount]);
|
|
61
|
+
const [overflowRef, visibleCount] = useOverflow(pageList);
|
|
62
|
+
const [paginatorResizeRef, paginatorWidth] = useContainerWidth();
|
|
63
|
+
const onKeyDown = (event) => {
|
|
93
64
|
// alt + arrow keys are used by browser/assistive technologies
|
|
94
65
|
if (event.altKey) {
|
|
95
66
|
return;
|
|
96
67
|
}
|
|
97
|
-
|
|
98
|
-
|
|
68
|
+
const focusPage = (delta) => {
|
|
69
|
+
const newFocusedIndex = getBoundedValue(focusedIndex + delta, 0, totalPagesCount - 1);
|
|
99
70
|
needFocus.current = true;
|
|
100
71
|
if (focusActivationMode === 'auto') {
|
|
101
72
|
onPageChange(newFocusedIndex);
|
|
@@ -127,9 +98,9 @@ export var TablePaginator = function (props) {
|
|
|
127
98
|
break;
|
|
128
99
|
}
|
|
129
100
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
101
|
+
const halfVisibleCount = Math.floor(visibleCount / 2);
|
|
102
|
+
let startPage = focusedIndex - halfVisibleCount;
|
|
103
|
+
let endPage = focusedIndex + halfVisibleCount + 1;
|
|
133
104
|
if (startPage < 0) {
|
|
134
105
|
endPage = Math.min(totalPagesCount, endPage + Math.abs(startPage)); // If no room at the beginning, show extra pages at the end
|
|
135
106
|
startPage = 0;
|
|
@@ -138,22 +109,22 @@ export var TablePaginator = function (props) {
|
|
|
138
109
|
startPage = Math.max(0, startPage - (endPage - totalPagesCount)); // If no room at the end, show extra pages at the beginning
|
|
139
110
|
endPage = totalPagesCount;
|
|
140
111
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
112
|
+
const hasNoRows = totalPagesCount === 0;
|
|
113
|
+
const showPagesList = totalPagesCount > 1 || isLoading;
|
|
114
|
+
const showPageSizeList = pageSizeList && !!onPageSizeChange && !!totalRowsCount;
|
|
115
|
+
const ellipsis = (React.createElement("span", { className: cx('iui-table-paginator-ellipsis', {
|
|
145
116
|
'iui-table-paginator-ellipsis-small': size === 'small',
|
|
146
117
|
}) }, "\u2026"));
|
|
147
|
-
|
|
118
|
+
const noRowsContent = (React.createElement(React.Fragment, null, isLoading ? (React.createElement(ProgressRadial, { indeterminate: true, size: 'small' })) : (React.createElement(Button, { styleType: 'borderless', disabled: true, size: buttonSize }, "1"))));
|
|
148
119
|
if (!showPagesList && !showPageSizeList) {
|
|
149
120
|
return null;
|
|
150
121
|
}
|
|
151
|
-
return (React.createElement("div",
|
|
152
|
-
React.createElement("div", { className: 'iui-left' }, totalSelectedRowsCount > 0 && (React.createElement("span", null,
|
|
122
|
+
return (React.createElement("div", { className: cx('iui-table-paginator', className), ref: paginatorResizeRef, ...rest },
|
|
123
|
+
React.createElement("div", { className: 'iui-left' }, totalSelectedRowsCount > 0 && (React.createElement("span", null, `${totalSelectedRowsCount} ${totalSelectedRowsCount === 1 ? 'row' : 'rows'} selected`))),
|
|
153
124
|
showPagesList && (React.createElement("div", { className: 'iui-center', ref: overflowRef },
|
|
154
|
-
React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === 0, onClick:
|
|
125
|
+
React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === 0, onClick: () => onPageChange(currentPage - 1), size: buttonSize, "aria-label": localization.previousPage },
|
|
155
126
|
React.createElement(SvgChevronLeft, null)),
|
|
156
|
-
React.createElement("span", { className: 'iui-table-paginator-pages-group', onKeyDown: onKeyDown, ref: pageListRef }, (
|
|
127
|
+
React.createElement("span", { className: 'iui-table-paginator-pages-group', onKeyDown: onKeyDown, ref: pageListRef }, (() => {
|
|
157
128
|
if (hasNoRows) {
|
|
158
129
|
return noRowsContent;
|
|
159
130
|
}
|
|
@@ -172,16 +143,14 @@ export var TablePaginator = function (props) {
|
|
|
172
143
|
ellipsis,
|
|
173
144
|
React.createElement(ProgressRadial, { indeterminate: true, size: 'small' })))));
|
|
174
145
|
})()),
|
|
175
|
-
React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === totalPagesCount - 1 || hasNoRows, onClick:
|
|
146
|
+
React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === totalPagesCount - 1 || hasNoRows, onClick: () => onPageChange(currentPage + 1), size: buttonSize, "aria-label": localization.nextPage },
|
|
176
147
|
React.createElement(SvgChevronRight, null)))),
|
|
177
148
|
React.createElement("div", { className: 'iui-right' }, showPageSizeList && (React.createElement(React.Fragment, null,
|
|
178
149
|
localization.rowsPerPageLabel !== null &&
|
|
179
150
|
paginatorWidth >= 1024 && (React.createElement("span", { className: 'iui-table-paginator-page-size-label' }, localization.rowsPerPageLabel)),
|
|
180
|
-
React.createElement(DropdownButton, { styleType: 'borderless', size: buttonSize, menuItems:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
} }, localization.pageSizeLabel(size))); });
|
|
185
|
-
} }, localization.rangeLabel(currentPage * pageSize + 1, Math.min(totalRowsCount, (currentPage + 1) * pageSize), totalRowsCount, isLoading)))))));
|
|
151
|
+
React.createElement(DropdownButton, { styleType: 'borderless', size: buttonSize, menuItems: (close) => pageSizeList.map((size) => (React.createElement(MenuItem, { key: size, isSelected: size === pageSize, onClick: () => {
|
|
152
|
+
close();
|
|
153
|
+
onPageSizeChange(size);
|
|
154
|
+
} }, localization.pageSizeLabel(size)))) }, localization.rangeLabel(currentPage * pageSize + 1, Math.min(totalRowsCount, (currentPage + 1) * pageSize), totalRowsCount, isLoading)))))));
|
|
186
155
|
};
|
|
187
156
|
export default TablePaginator;
|
|
@@ -8,11 +8,9 @@ import { CellProps, Row, TableInstance, TableState } from 'react-table';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const TableRow: <T extends Record<string, unknown>>(props: {
|
|
10
10
|
row: Row<T>;
|
|
11
|
-
rowProps?: ((row: Row<T>) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
status?: "positive" | "warning" | "negative" | undefined;
|
|
15
|
-
isLoading?: boolean | undefined;
|
|
11
|
+
rowProps?: ((row: Row<T>) => React.ComponentPropsWithRef<'div'> & {
|
|
12
|
+
status?: 'positive' | 'warning' | 'negative';
|
|
13
|
+
isLoading?: boolean;
|
|
16
14
|
}) | undefined;
|
|
17
15
|
isLast: boolean;
|
|
18
16
|
onRowInViewport: React.MutableRefObject<((rowData: T) => void) | undefined>;
|
|
@@ -30,11 +28,9 @@ export declare const TableRow: <T extends Record<string, unknown>>(props: {
|
|
|
30
28
|
}) => JSX.Element;
|
|
31
29
|
export declare const TableRowMemoized: <T extends Record<string, unknown>>(props: {
|
|
32
30
|
row: Row<T>;
|
|
33
|
-
rowProps?: ((row: Row<T>) =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
status?: "positive" | "warning" | "negative" | undefined;
|
|
37
|
-
isLoading?: boolean | undefined;
|
|
31
|
+
rowProps?: ((row: Row<T>) => React.ComponentPropsWithRef<'div'> & {
|
|
32
|
+
status?: 'positive' | 'warning' | 'negative';
|
|
33
|
+
isLoading?: boolean;
|
|
38
34
|
}) | undefined;
|
|
39
35
|
isLast: boolean;
|
|
40
36
|
onRowInViewport: React.MutableRefObject<((rowData: T) => void) | undefined>;
|
|
@@ -1,25 +1,3 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
/*---------------------------------------------------------------------------------------------
|
|
24
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -34,17 +12,17 @@ import { TableCell } from './TableCell';
|
|
|
34
12
|
* Although state is not used it is needed for `React.memo` to check state that changes row state e.g. selection.
|
|
35
13
|
* When adding new features check whether it changes state that affects row. If it does then add equality check to `React.memo`.
|
|
36
14
|
*/
|
|
37
|
-
export
|
|
15
|
+
export const TableRow = (props) => {
|
|
38
16
|
var _a;
|
|
39
|
-
|
|
40
|
-
|
|
17
|
+
const { row, rowProps, isLast, onRowInViewport, onBottomReached, intersectionMargin, onClick, subComponent, isDisabled, tableHasSubRows, tableInstance, expanderCell, bodyRef, tableRowRef, } = props;
|
|
18
|
+
const onIntersect = React.useCallback(() => {
|
|
41
19
|
var _a, _b;
|
|
42
20
|
(_a = onRowInViewport.current) === null || _a === void 0 ? void 0 : _a.call(onRowInViewport, row.original);
|
|
43
21
|
isLast && ((_b = onBottomReached.current) === null || _b === void 0 ? void 0 : _b.call(onBottomReached));
|
|
44
22
|
}, [isLast, onBottomReached, onRowInViewport, row.original]);
|
|
45
|
-
|
|
23
|
+
const intersectionRoot = React.useMemo(() => {
|
|
46
24
|
var _a, _b;
|
|
47
|
-
|
|
25
|
+
const isTableBodyScrollable = ((_a = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.scrollHeight) !== null && _a !== void 0 ? _a : 0) > ((_b = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.offsetHeight) !== null && _b !== void 0 ? _b : 0);
|
|
48
26
|
// If table body is scrollable, make it the intersection root
|
|
49
27
|
if (isTableBodyScrollable) {
|
|
50
28
|
return bodyRef;
|
|
@@ -52,47 +30,49 @@ export var TableRow = function (props) {
|
|
|
52
30
|
// Otherwise, make the viewport the intersection root
|
|
53
31
|
return undefined;
|
|
54
32
|
}, [bodyRef]);
|
|
55
|
-
|
|
56
|
-
rootMargin:
|
|
33
|
+
const intersectionRef = useIntersection(onIntersect, {
|
|
34
|
+
rootMargin: `${intersectionMargin}px`,
|
|
57
35
|
root: intersectionRoot,
|
|
58
36
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
37
|
+
const userRowProps = (_a = rowProps === null || rowProps === void 0 ? void 0 : rowProps(row)) !== null && _a !== void 0 ? _a : {};
|
|
38
|
+
const { status, isLoading, ...restUserRowProps } = userRowProps;
|
|
39
|
+
const mergedProps = {
|
|
40
|
+
...row.getRowProps({ style: { flex: `0 0 auto`, minWidth: '100%' } }),
|
|
41
|
+
...restUserRowProps,
|
|
42
|
+
...{
|
|
43
|
+
className: cx('iui-table-row', {
|
|
44
|
+
'iui-table-row-expanded': row.isExpanded && subComponent,
|
|
45
|
+
'iui-loading': isLoading,
|
|
46
|
+
}, userRowProps === null || userRowProps === void 0 ? void 0 : userRowProps.className),
|
|
47
|
+
'aria-selected': row.isSelected || undefined,
|
|
48
|
+
'aria-disabled': isDisabled || undefined,
|
|
49
|
+
'data-iui-status': status,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const refs = useMergedRefs(intersectionRef, mergedProps.ref, tableRowRef);
|
|
71
53
|
return (React.createElement(React.Fragment, null,
|
|
72
|
-
React.createElement("div",
|
|
54
|
+
React.createElement("div", { ...mergedProps, ref: refs, onClick: (event) => {
|
|
73
55
|
var _a;
|
|
74
56
|
(_a = mergedProps === null || mergedProps === void 0 ? void 0 : mergedProps.onClick) === null || _a === void 0 ? void 0 : _a.call(mergedProps, event);
|
|
75
57
|
onClick === null || onClick === void 0 ? void 0 : onClick(event, row);
|
|
76
|
-
} }
|
|
58
|
+
} }, row.cells.map((cell, index) => {
|
|
77
59
|
return (React.createElement(TableCell, { key: cell.getCellProps().key, cell: cell, cellIndex: index, isDisabled: isDisabled, tableHasSubRows: tableHasSubRows, tableInstance: tableInstance, expanderCell: expanderCell }));
|
|
78
60
|
})),
|
|
79
61
|
subComponent && (React.createElement(WithCSSTransition, { in: row.isExpanded },
|
|
80
62
|
React.createElement("div", { className: cx('iui-table-row', 'iui-table-expanded-content'), "aria-disabled": isDisabled }, subComponent(row))))));
|
|
81
63
|
};
|
|
82
|
-
|
|
64
|
+
const hasAnySelectedSubRow = (row, selectedRowIds) => {
|
|
83
65
|
if (selectedRowIds === null || selectedRowIds === void 0 ? void 0 : selectedRowIds[row.id]) {
|
|
84
66
|
return true;
|
|
85
67
|
}
|
|
86
|
-
return row.subRows.some(
|
|
87
|
-
return hasAnySelectedSubRow(subRow, selectedRowIds);
|
|
88
|
-
});
|
|
68
|
+
return row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, selectedRowIds));
|
|
89
69
|
};
|
|
90
|
-
export
|
|
70
|
+
export const TableRowMemoized = React.memo(TableRow, (prevProp, nextProp) => {
|
|
91
71
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
92
72
|
return prevProp.isLast === nextProp.isLast &&
|
|
93
73
|
((_a = prevProp.state.hiddenColumns) === null || _a === void 0 ? void 0 : _a.length) ===
|
|
94
74
|
((_b = nextProp.state.hiddenColumns) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
95
|
-
!!((_c = prevProp.state.hiddenColumns) === null || _c === void 0 ? void 0 : _c.every(
|
|
75
|
+
!!((_c = prevProp.state.hiddenColumns) === null || _c === void 0 ? void 0 : _c.every((column, index) => { var _a; return ((_a = nextProp.state.hiddenColumns) === null || _a === void 0 ? void 0 : _a[index]) === column; })) &&
|
|
96
76
|
prevProp.onRowInViewport === nextProp.onRowInViewport &&
|
|
97
77
|
prevProp.onBottomReached === nextProp.onBottomReached &&
|
|
98
78
|
prevProp.onClick === nextProp.onClick &&
|
|
@@ -100,16 +80,12 @@ export var TableRowMemoized = React.memo(TableRow, function (prevProp, nextProp)
|
|
|
100
80
|
((_d = prevProp.state.selectedRowIds) === null || _d === void 0 ? void 0 : _d[prevProp.row.id]) ===
|
|
101
81
|
((_e = nextProp.state.selectedRowIds) === null || _e === void 0 ? void 0 : _e[nextProp.row.id]) &&
|
|
102
82
|
// Check if sub-rows selection has changed and whether to show indeterminate state or not
|
|
103
|
-
prevProp.row.subRows.some(
|
|
104
|
-
|
|
105
|
-
}) ===
|
|
106
|
-
nextProp.row.subRows.some(function (subRow) {
|
|
107
|
-
return hasAnySelectedSubRow(subRow, nextProp.state.selectedRowIds);
|
|
108
|
-
}) &&
|
|
83
|
+
prevProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, prevProp.state.selectedRowIds)) ===
|
|
84
|
+
nextProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, nextProp.state.selectedRowIds)) &&
|
|
109
85
|
((_f = prevProp.state.expanded) === null || _f === void 0 ? void 0 : _f[prevProp.row.id]) ===
|
|
110
86
|
((_g = nextProp.state.expanded) === null || _g === void 0 ? void 0 : _g[nextProp.row.id]) &&
|
|
111
87
|
prevProp.subComponent === nextProp.subComponent &&
|
|
112
|
-
prevProp.row.cells.every(
|
|
88
|
+
prevProp.row.cells.every((cell, index) => nextProp.row.cells[index].column === cell.column) &&
|
|
113
89
|
prevProp.isDisabled === nextProp.isDisabled &&
|
|
114
90
|
prevProp.rowProps === nextProp.rowProps &&
|
|
115
91
|
prevProp.expanderCell === nextProp.expanderCell &&
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const onExpandHandler = (newState, instance, onExpand) => {
|
|
2
2
|
if (!(instance === null || instance === void 0 ? void 0 : instance.preFilteredFlatRows.length)) {
|
|
3
3
|
onExpand === null || onExpand === void 0 ? void 0 : onExpand([], newState);
|
|
4
4
|
return;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
instance.preFilteredFlatRows.forEach(
|
|
6
|
+
const expandedData = [];
|
|
7
|
+
instance.preFilteredFlatRows.forEach((row) => {
|
|
8
8
|
if (newState.expanded[row.id]) {
|
|
9
9
|
expandedData.push(row.original);
|
|
10
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export const onFilterHandler = (newState, action, previousState, instance, onFilter) => {
|
|
2
|
+
const previousFilter = previousState.filters.find((f) => f.id === action.columnId);
|
|
3
3
|
if ((previousFilter === null || previousFilter === void 0 ? void 0 : previousFilter.value) != action.filterValue) {
|
|
4
|
-
|
|
4
|
+
const filters = newState.filters.map((f) => {
|
|
5
5
|
var _a, _b;
|
|
6
|
-
|
|
6
|
+
const column = instance === null || instance === void 0 ? void 0 : instance.allColumns.find((c) => c.id === f.id);
|
|
7
7
|
return {
|
|
8
8
|
id: f.id,
|
|
9
9
|
value: f.value,
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
export var onTableResizeStart = function (state) {
|
|
13
|
-
return __assign(__assign({}, state), { isTableResizing: true });
|
|
1
|
+
export const onTableResizeStart = (state) => {
|
|
2
|
+
return { ...state, isTableResizing: true };
|
|
14
3
|
};
|
|
15
|
-
export
|
|
16
|
-
return
|
|
4
|
+
export const onTableResizeEnd = (state, action) => {
|
|
5
|
+
return {
|
|
6
|
+
...state,
|
|
7
|
+
isTableResizing: false,
|
|
8
|
+
columnResizing: {
|
|
9
|
+
...state.columnResizing,
|
|
10
|
+
columnWidths: {
|
|
11
|
+
...action.columnWidths,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
17
15
|
};
|
|
@@ -1,30 +1,19 @@
|
|
|
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
1
|
/**
|
|
13
2
|
* Handles selection when clicked on a checkbox.
|
|
14
3
|
*/
|
|
15
|
-
export
|
|
4
|
+
export const onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
|
|
16
5
|
if (!(instance === null || instance === void 0 ? void 0 : instance.rows.length)) {
|
|
17
6
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect([], newState);
|
|
18
7
|
return;
|
|
19
8
|
}
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const newSelectedRowIds = {};
|
|
10
|
+
const handleRow = (row) => {
|
|
22
11
|
if (isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)) {
|
|
23
12
|
return false;
|
|
24
13
|
}
|
|
25
|
-
|
|
26
|
-
row.initialSubRows.forEach(
|
|
27
|
-
|
|
14
|
+
let isAllSubSelected = true;
|
|
15
|
+
row.initialSubRows.forEach((subRow) => {
|
|
16
|
+
const result = handleRow(subRow);
|
|
28
17
|
if (!result) {
|
|
29
18
|
isAllSubSelected = false;
|
|
30
19
|
}
|
|
@@ -39,25 +28,28 @@ export var onSelectHandler = function (newState, instance, onSelect, isRowDisabl
|
|
|
39
28
|
}
|
|
40
29
|
return !!newSelectedRowIds[row.id];
|
|
41
30
|
};
|
|
42
|
-
instance.initialRows.forEach(
|
|
43
|
-
|
|
31
|
+
instance.initialRows.forEach((row) => handleRow(row));
|
|
32
|
+
const selectedData = getSelectedData(newSelectedRowIds, instance);
|
|
44
33
|
newState.selectedRowIds = newSelectedRowIds;
|
|
45
34
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectedData, newState);
|
|
46
35
|
};
|
|
47
36
|
/**
|
|
48
37
|
* Handles selection when clicked on a row.
|
|
49
38
|
*/
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
var selectedRowIds = (_a = {}, _a[action.id] = true, _a);
|
|
39
|
+
export const onSingleSelectHandler = (state, action, instance, onSelect, isRowDisabled) => {
|
|
40
|
+
const selectedRowIds = { [action.id]: true };
|
|
53
41
|
if (instance === null || instance === void 0 ? void 0 : instance.selectSubRows) {
|
|
54
|
-
|
|
42
|
+
const handleRow = (row) => {
|
|
55
43
|
selectedRowIds[row.id] = true;
|
|
56
|
-
row.subRows.forEach(
|
|
44
|
+
row.subRows.forEach((r) => handleRow(r));
|
|
57
45
|
};
|
|
58
|
-
|
|
46
|
+
handleRow(instance.rowsById[action.id]);
|
|
59
47
|
}
|
|
60
|
-
|
|
48
|
+
const newState = {
|
|
49
|
+
...state,
|
|
50
|
+
lastSelectedRowId: action.id,
|
|
51
|
+
selectedRowIds,
|
|
52
|
+
};
|
|
61
53
|
// Passing to `onSelectHandler` to handle filtered sub-rows
|
|
62
54
|
onSelectHandler(newState, instance, onSelect, isRowDisabled);
|
|
63
55
|
return newState;
|
|
@@ -65,43 +57,46 @@ export var onSingleSelectHandler = function (state, action, instance, onSelect,
|
|
|
65
57
|
/**
|
|
66
58
|
* Handles selection when clicked on a row while shift key is pressed.
|
|
67
59
|
*/
|
|
68
|
-
export
|
|
60
|
+
export const onShiftSelectHandler = (state, action, instance, onSelect, isRowDisabled) => {
|
|
69
61
|
if (instance == null) {
|
|
70
62
|
return state;
|
|
71
63
|
}
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
let startIndex = Math.max(0, instance.flatRows.findIndex((row) => row.id === state.lastSelectedRowId));
|
|
65
|
+
let endIndex = Math.max(0, instance.flatRows.findIndex((row) => row.id === action.id));
|
|
74
66
|
if (startIndex > endIndex) {
|
|
75
|
-
|
|
67
|
+
const temp = startIndex;
|
|
76
68
|
startIndex = endIndex;
|
|
77
69
|
endIndex = temp;
|
|
78
70
|
}
|
|
79
|
-
|
|
71
|
+
const selectedRowIds = {};
|
|
80
72
|
// 1. Select all rows between start and end
|
|
81
73
|
instance.flatRows
|
|
82
74
|
.slice(startIndex, endIndex + 1)
|
|
83
|
-
.forEach(
|
|
75
|
+
.forEach((r) => (selectedRowIds[r.id] = true));
|
|
84
76
|
// 2. Select all children of the last row (endIndex)
|
|
85
77
|
// Since lastRow's children come after endIndex + 1 (not selected in step 1)
|
|
86
|
-
|
|
78
|
+
const handleRow = (row) => {
|
|
87
79
|
selectedRowIds[row.id] = true;
|
|
88
|
-
row.subRows.forEach(
|
|
80
|
+
row.subRows.forEach((r) => handleRow(r));
|
|
89
81
|
};
|
|
90
82
|
handleRow(instance.flatRows[endIndex]);
|
|
91
|
-
|
|
83
|
+
const newState = {
|
|
84
|
+
...state,
|
|
85
|
+
selectedRowIds,
|
|
86
|
+
};
|
|
92
87
|
// 3.1 Deselect all selected disabled rows and their children
|
|
93
88
|
// 3.2 Convert all partially selected rows marked with tick mark to horizontal line
|
|
94
89
|
onSelectHandler(newState, instance, onSelect, isRowDisabled);
|
|
95
90
|
return newState;
|
|
96
91
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
const getSelectedData = (selectedRowIds, instance) => {
|
|
93
|
+
const selectedData = [];
|
|
94
|
+
const setSelectedData = (row) => {
|
|
100
95
|
if (selectedRowIds[row.id]) {
|
|
101
96
|
selectedData.push(row.original);
|
|
102
97
|
}
|
|
103
|
-
row.initialSubRows.forEach(
|
|
98
|
+
row.initialSubRows.forEach((subRow) => setSelectedData(subRow));
|
|
104
99
|
};
|
|
105
|
-
instance === null || instance === void 0 ? void 0 : instance.initialRows.forEach(
|
|
100
|
+
instance === null || instance === void 0 ? void 0 : instance.initialRows.forEach((row) => setSelectedData(row));
|
|
106
101
|
return selectedData;
|
|
107
102
|
};
|
|
@@ -1,25 +1,3 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
/*---------------------------------------------------------------------------------------------
|
|
24
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -37,11 +15,11 @@ import cx from 'classnames';
|
|
|
37
15
|
* cellRenderer: (props) => <DefaultCell {...props} />,
|
|
38
16
|
* }
|
|
39
17
|
*/
|
|
40
|
-
export
|
|
18
|
+
export const DefaultCell = (props) => {
|
|
41
19
|
// Omitting `cellProps`
|
|
42
20
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
43
|
-
|
|
44
|
-
return (React.createElement("div",
|
|
21
|
+
const { cellElementProps: { className: cellElementClassName, style: cellElementStyle, ...cellElementProps }, children, startIcon, endIcon, cellProps, isDisabled, className, style, status, ...rest } = props;
|
|
22
|
+
return (React.createElement("div", { ...cellElementProps, ...rest, className: cx(cellElementClassName, className), "aria-disabled": (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(cellProps.row.original)) || undefined, "data-iui-status": status, style: { ...cellElementStyle, ...style } },
|
|
45
23
|
startIcon && (React.createElement("div", { className: 'iui-table-cell-start-icon' }, startIcon)),
|
|
46
24
|
children,
|
|
47
25
|
endIcon && React.createElement("div", { className: 'iui-table-cell-end-icon' }, endIcon)));
|