rsuite 6.1.2 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/Timeline/styles/index.css +11 -0
- package/Timeline/styles/index.scss +13 -0
- package/Uploader/styles/index.css +3 -0
- package/Uploader/styles/index.scss +3 -0
- package/cjs/Affix/Affix.js +4 -4
- package/cjs/Animation/Collapse.js +4 -5
- package/cjs/Animation/Transition.d.ts +2 -2
- package/cjs/Animation/Transition.js +17 -20
- package/cjs/AutoComplete/AutoComplete.d.ts +2 -0
- package/cjs/AutoComplete/AutoComplete.js +12 -10
- package/cjs/Avatar/useImage.js +1 -1
- package/cjs/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/cjs/Badge/Badge.js +1 -4
- package/cjs/Breadcrumb/Breadcrumb.js +4 -4
- package/cjs/Button/Button.js +6 -6
- package/cjs/Calendar/Calendar.js +5 -5
- package/cjs/Calendar/CalendarBody.js +1 -1
- package/cjs/Calendar/CalendarContainer.js +14 -33
- package/cjs/Calendar/CalendarHeader.js +7 -8
- package/cjs/Calendar/Grid/GridCell.js +2 -2
- package/cjs/Calendar/Grid/GridHeaderRow.js +1 -1
- package/cjs/Calendar/Grid/GridRow.js +5 -6
- package/cjs/Calendar/MonthDropdown/MonthDropdown.js +1 -1
- package/cjs/Calendar/MonthDropdown/MonthDropdownItem.js +1 -1
- package/cjs/Calendar/TimeDropdown/TimeDropdown.js +12 -14
- package/cjs/Calendar/hooks/useCalendar.d.ts +16 -17
- package/cjs/Calendar/hooks/useCalendar.js +2 -4
- package/cjs/Calendar/hooks/useCalendarDate.js +5 -9
- package/cjs/Calendar/hooks/useCalendarState.js +6 -12
- package/cjs/Calendar/types.d.ts +0 -1
- package/cjs/Carousel/Carousel.js +5 -6
- package/cjs/CascadeTree/CascadeTree.js +6 -16
- package/cjs/CascadeTree/TreeView.js +5 -7
- package/cjs/CascadeTree/hooks/useSearch.d.ts +0 -1
- package/cjs/CascadeTree/hooks/useSearch.js +1 -1
- package/cjs/CascadeTree/hooks/useSelect.d.ts +0 -1
- package/cjs/CascadeTree/hooks/useSelect.js +3 -4
- package/cjs/CascadeTree/types.d.ts +0 -1
- package/cjs/CascadeTree/utils.js +1 -2
- package/cjs/Cascader/Cascader.js +18 -29
- package/cjs/Cascader/useActive.d.ts +0 -1
- package/cjs/Cascader/useActive.js +4 -6
- package/cjs/CheckPicker/CheckPicker.js +14 -15
- package/cjs/CheckTree/CheckTree.js +1 -1
- package/cjs/CheckTree/CheckTreeNode.js +3 -4
- package/cjs/CheckTree/CheckTreeView.js +5 -5
- package/cjs/CheckTree/hooks/useTreeCheckState.js +2 -2
- package/cjs/CheckTree/utils.js +9 -17
- package/cjs/CheckTreePicker/CheckTreePicker.js +7 -7
- package/cjs/CheckTreePicker/hooks/useFocusState.d.ts +0 -1
- package/cjs/CheckTreePicker/hooks/useFocusState.js +3 -6
- package/cjs/Checkbox/Checkbox.js +4 -5
- package/cjs/Checkbox/hooks/useIndeterminateCheckbox.d.ts +0 -1
- package/cjs/Checkbox/hooks/useIndeterminateCheckbox.js +1 -1
- package/cjs/CheckboxGroup/CheckboxGroup.js +2 -2
- package/cjs/DOMHelper/index.d.ts +1 -2
- package/cjs/DOMHelper/isElement.js +1 -1
- package/cjs/DateInput/DateField.d.ts +122 -3
- package/cjs/DateInput/DateField.js +12 -15
- package/cjs/DateInput/DateInput.js +3 -4
- package/cjs/DateInput/hooks/useDateInputState.d.ts +124 -4
- package/cjs/DateInput/hooks/useDateInputState.js +2 -2
- package/cjs/DateInput/hooks/useIsFocused.js +2 -2
- package/cjs/DateInput/hooks/useKeyboardInputEvent.d.ts +0 -1
- package/cjs/DateInput/hooks/useKeyboardInputEvent.js +8 -9
- package/cjs/DateInput/hooks/useSelectedState.d.ts +0 -1
- package/cjs/DateInput/utils.d.ts +0 -1
- package/cjs/DateInput/utils.js +2 -3
- package/cjs/DatePicker/DatePicker.js +18 -25
- package/cjs/DatePicker/PredefinedRanges.js +3 -3
- package/cjs/DatePicker/Toolbar.js +4 -4
- package/cjs/DatePicker/hooks/useCustomizedInput.d.ts +0 -1
- package/cjs/DatePicker/hooks/useFocus.js +5 -8
- package/cjs/DatePicker/hooks/useMonthView.d.ts +0 -1
- package/cjs/DatePicker/hooks/useMonthView.js +1 -1
- package/cjs/DatePicker/utils.d.ts +1 -2
- package/cjs/DatePicker/utils.js +2 -2
- package/cjs/DateRangeInput/DateRangeInput.js +8 -9
- package/cjs/DateRangePicker/Calendar.js +2 -2
- package/cjs/DateRangePicker/DateRangePicker.js +25 -29
- package/cjs/DateRangePicker/Header.js +3 -3
- package/cjs/DateRangePicker/disabledDateUtils.js +2 -2
- package/cjs/DateRangePicker/hooks/useCalendarHandlers.d.ts +0 -1
- package/cjs/DateRangePicker/hooks/useCalendarHandlers.js +5 -5
- package/cjs/DateRangePicker/utils.js +1 -2
- package/cjs/Dropdown/Dropdown.js +3 -3
- package/cjs/Dropdown/DropdownItem.js +4 -5
- package/cjs/Dropdown/DropdownMenu.d.ts +1 -1
- package/cjs/Dropdown/DropdownMenu.js +1 -1
- package/cjs/Form/Form.d.ts +38 -3
- package/cjs/Form/Form.js +25 -12
- package/cjs/Form/hooks/useFormRef.d.ts +0 -1
- package/cjs/Form/hooks/useFormValidate.d.ts +2 -1
- package/cjs/Form/hooks/useFormValidate.js +136 -20
- package/cjs/Form/hooks/useFormValue.d.ts +0 -1
- package/cjs/Form/index.d.ts +1 -0
- package/cjs/Form/resolvers.d.ts +59 -0
- package/cjs/Form/resolvers.js +4 -0
- package/cjs/FormControl/FormControl.js +5 -5
- package/cjs/FormGroup/FormGroupContext.d.ts +1 -1
- package/cjs/Highlight/utils/highlightText.js +1 -1
- package/cjs/InlineEdit/renderChildren.js +5 -6
- package/cjs/InlineEdit/useEditState.js +9 -12
- package/cjs/InlineEdit/useFocusEvent.d.ts +0 -1
- package/cjs/InlineEdit/useFocusEvent.js +7 -11
- package/cjs/Input/Input.js +1 -1
- package/cjs/InputGroup/InputGroupContext.d.ts +2 -1
- package/cjs/InputNumber/index.d.ts +0 -1
- package/cjs/InputPicker/InputAutosize.js +1 -1
- package/cjs/InputPicker/InputPicker.js +30 -35
- package/cjs/InputPicker/InputSearch.js +1 -2
- package/cjs/InputPicker/hooks/useData.d.ts +0 -1
- package/cjs/InputPicker/hooks/useData.js +1 -1
- package/cjs/InputPicker/hooks/useInput.js +3 -6
- package/cjs/InputPicker/hooks/useMaxWidth.js +2 -4
- package/cjs/List/helper/AutoScroller.js +2 -4
- package/cjs/List/helper/useSortHelper.d.ts +4 -4
- package/cjs/List/helper/useSortHelper.js +13 -19
- package/cjs/MaskedInput/TextMask.d.ts +5 -5
- package/cjs/MaskedInput/TextMask.js +3 -5
- package/cjs/MaskedInput/conformToMask.d.ts +1 -1
- package/cjs/MaskedInput/createTextMaskInputElement.js +2 -3
- package/cjs/Menu/MenuItem.js +3 -4
- package/cjs/Message/Message.js +1 -1
- package/cjs/Modal/Modal.js +8 -10
- package/cjs/Modal/ModalBody.js +1 -1
- package/cjs/Modal/utils.d.ts +2 -3
- package/cjs/Modal/utils.js +2 -3
- package/cjs/MultiCascadeTree/SearchView.js +1 -1
- package/cjs/MultiCascadeTree/TreeView.js +2 -2
- package/cjs/MultiCascadeTree/hooks/useCascadeValue.d.ts +0 -1
- package/cjs/MultiCascadeTree/hooks/useCascadeValue.js +5 -8
- package/cjs/MultiCascadeTree/hooks/useColumnData.d.ts +0 -1
- package/cjs/MultiCascadeTree/hooks/useSearch.d.ts +0 -1
- package/cjs/MultiCascadeTree/hooks/useSearch.js +2 -2
- package/cjs/MultiCascadeTree/hooks/useSelect.js +3 -4
- package/cjs/MultiCascadeTree/types.d.ts +0 -1
- package/cjs/MultiCascadeTree/utils.d.ts +4 -4
- package/cjs/MultiCascadeTree/utils.js +2 -3
- package/cjs/MultiCascader/MultiCascader.js +13 -16
- package/cjs/Nav/AdaptiveNavItem.js +2 -3
- package/cjs/Nav/Nav.d.ts +1 -1
- package/cjs/Nav/Nav.js +4 -4
- package/cjs/Nav/NavDropdown.d.ts +1 -1
- package/cjs/Nav/NavDropdown.js +3 -3
- package/cjs/Nav/NavDropdownItem.js +2 -2
- package/cjs/Nav/NavDropdownMenu.d.ts +1 -1
- package/cjs/Nav/NavDropdownMenu.js +1 -1
- package/cjs/Nav/NavItem.js +4 -4
- package/cjs/Navbar/Navbar.js +1 -1
- package/cjs/Navbar/NavbarContent.js +1 -1
- package/cjs/Navbar/NavbarDrawer.js +1 -1
- package/cjs/Navbar/NavbarDropdown.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdown.js +3 -3
- package/cjs/Navbar/NavbarDropdownItem.js +5 -6
- package/cjs/Navbar/NavbarDropdownMenu.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdownMenu.js +1 -1
- package/cjs/Navbar/NavbarItem.js +4 -4
- package/cjs/Navbar/NavbarToggle.js +2 -2
- package/cjs/Notification/Notification.js +1 -1
- package/cjs/NumberInput/NumberInput.js +3 -3
- package/cjs/NumberInput/hooks/useEvents.d.ts +0 -1
- package/cjs/NumberInput/hooks/useEvents.js +2 -3
- package/cjs/NumberInput/hooks/useWheelHandler.js +1 -2
- package/cjs/Pagination/Pagination.js +1 -1
- package/cjs/Pagination/PaginationButton.js +1 -1
- package/cjs/Pagination/PaginationGroup.js +3 -4
- package/cjs/Panel/Panel.js +2 -2
- package/cjs/PanelGroup/PanelGroup.js +1 -1
- package/cjs/PasswordInput/PasswordInput.js +2 -2
- package/cjs/PinInput/PinInput.js +1 -1
- package/cjs/PinInput/hooks/usePinInputRefs.d.ts +0 -1
- package/cjs/PinInput/hooks/usePinInputRefs.js +2 -4
- package/cjs/PinInput/hooks/usePinValue.d.ts +1 -1
- package/cjs/PinInput/hooks/usePinValue.js +2 -2
- package/cjs/Progress/ProgressLine.js +1 -1
- package/cjs/Progress/types.d.ts +0 -1
- package/cjs/ProgressCircle/hooks/useProgressCirclePath.d.ts +0 -1
- package/cjs/Radio/Radio.js +3 -3
- package/cjs/RadioGroup/RadioGroup.js +1 -1
- package/cjs/RadioTile/RadioTile.js +2 -2
- package/cjs/RadioTileGroup/RadioTileGroup.js +1 -1
- package/cjs/RangeSlider/RangeSlider.js +6 -6
- package/cjs/Rate/Character.js +2 -2
- package/cjs/Rate/Rate.js +3 -3
- package/cjs/Rate/useRatingStates.d.ts +0 -1
- package/cjs/SegmentedControl/SegmentedControl.js +3 -3
- package/cjs/SegmentedControl/hooks/useIndicatorPosition.js +1 -1
- package/cjs/SelectPicker/SelectPicker.js +13 -16
- package/cjs/Sidebar/Sidebar.js +1 -1
- package/cjs/Sidenav/ExpandedSidenavDropdown.js +6 -6
- package/cjs/Sidenav/ExpandedSidenavDropdownItem.js +4 -5
- package/cjs/Sidenav/Node.js +9 -16
- package/cjs/Sidenav/Sidenav.js +2 -2
- package/cjs/Sidenav/SidenavDropdown.d.ts +1 -1
- package/cjs/Sidenav/SidenavDropdown.js +4 -4
- package/cjs/Sidenav/SidenavDropdownItem.js +3 -4
- package/cjs/Sidenav/SidenavItem.js +5 -6
- package/cjs/Sidenav/SidenavToggle.js +2 -2
- package/cjs/Slider/Slider.js +3 -3
- package/cjs/Slider/useDrag.d.ts +0 -1
- package/cjs/Slider/useDrag.js +7 -12
- package/cjs/Slider/utils.d.ts +1 -2
- package/cjs/Slider/utils.js +2 -3
- package/cjs/Steps/StepItem.js +1 -2
- package/cjs/Table/Table.d.ts +3 -3
- package/cjs/Tabs/Tabs.js +3 -4
- package/cjs/TimePicker/TimePicker.js +2 -2
- package/cjs/Timeline/Timeline.d.ts +6 -1
- package/cjs/Timeline/Timeline.js +14 -10
- package/cjs/Toggle/Toggle.js +2 -2
- package/cjs/Tree/Tree.js +2 -2
- package/cjs/Tree/TreeNode.js +10 -11
- package/cjs/Tree/TreeView.js +5 -5
- package/cjs/Tree/hooks/useExpandTree.js +1 -1
- package/cjs/Tree/hooks/useFlattenTree.js +6 -9
- package/cjs/Tree/hooks/useFocusTree.d.ts +1 -2
- package/cjs/Tree/hooks/useFocusTree.js +12 -14
- package/cjs/Tree/hooks/useTreeDrag.d.ts +0 -1
- package/cjs/Tree/hooks/useTreeDrag.js +10 -12
- package/cjs/Tree/hooks/useTreeNodeProps.js +1 -1
- package/cjs/Tree/hooks/useTreeSearch.js +4 -4
- package/cjs/Tree/hooks/useVirtualizedTreeData.js +2 -2
- package/cjs/Tree/types.d.ts +2 -3
- package/cjs/Tree/utils/flattenTree.d.ts +1 -1
- package/cjs/Tree/utils/focusableTree.js +5 -8
- package/cjs/Tree/utils/getNodeParentKeys.js +2 -4
- package/cjs/Tree/utils/hasVisibleChildren.d.ts +1 -1
- package/cjs/Tree/utils/treeKeyboardInteractions.js +3 -3
- package/cjs/TreePicker/TreePicker.js +8 -9
- package/cjs/TreePicker/hooks/useFocusState.d.ts +0 -1
- package/cjs/TreePicker/hooks/useFocusState.js +4 -8
- package/cjs/Uploader/UploadFileItem.js +8 -10
- package/cjs/Uploader/UploadTrigger.js +8 -10
- package/cjs/Uploader/Uploader.d.ts +2 -0
- package/cjs/Uploader/Uploader.js +66 -26
- package/cjs/Uploader/utils/ajaxUpload.js +5 -5
- package/cjs/Uploader/utils/previewFile.js +1 -1
- package/cjs/internals/Disclosure/Disclosure.js +5 -8
- package/cjs/internals/Disclosure/DisclosureButton.js +2 -2
- package/cjs/internals/InputBase/InputBase.js +5 -6
- package/cjs/internals/Menu/Menu.js +16 -20
- package/cjs/internals/Menu/MenuItem.js +4 -5
- package/cjs/internals/Menu/Menubar.js +5 -7
- package/cjs/internals/Menu/useMenu.js +5 -10
- package/cjs/internals/Overlay/Modal.js +8 -11
- package/cjs/internals/Overlay/ModalManager.js +3 -5
- package/cjs/internals/Overlay/Overlay.js +1 -1
- package/cjs/internals/Overlay/OverlayTrigger.d.ts +0 -1
- package/cjs/internals/Overlay/OverlayTrigger.js +5 -7
- package/cjs/internals/Overlay/Position.js +6 -8
- package/cjs/internals/Picker/ListCheckItem.js +3 -3
- package/cjs/internals/Picker/ListItem.js +1 -1
- package/cjs/internals/Picker/Listbox.js +9 -10
- package/cjs/internals/Picker/PickerIndicator.js +13 -11
- package/cjs/internals/Picker/PickerPopup.js +4 -5
- package/cjs/internals/Picker/PickerToggle.js +3 -4
- package/cjs/internals/Picker/SelectedElement.js +1 -1
- package/cjs/internals/Picker/hooks/useFocusItemValue.d.ts +0 -1
- package/cjs/internals/Picker/hooks/useFocusItemValue.js +14 -28
- package/cjs/internals/Picker/hooks/usePickerRef.d.ts +0 -1
- package/cjs/internals/Picker/hooks/usePickerRef.js +9 -15
- package/cjs/internals/Picker/hooks/useSearch.d.ts +0 -1
- package/cjs/internals/Picker/hooks/useSearch.js +2 -2
- package/cjs/internals/Picker/hooks/useToggleKeyDownEvent.d.ts +0 -1
- package/cjs/internals/Picker/hooks/useToggleKeyDownEvent.js +13 -17
- package/cjs/internals/Picker/utils.js +9 -9
- package/cjs/internals/Ripple/Ripple.js +3 -4
- package/cjs/internals/SafeAnchor/SafeAnchor.js +1 -1
- package/cjs/internals/ScrollView/hooks/useScrollState.d.ts +0 -1
- package/cjs/internals/ScrollView/hooks/useScrollState.js +2 -3
- package/cjs/internals/Tree/TreeProvider.d.ts +4 -4
- package/cjs/internals/Tree/TreeProvider.js +2 -8
- package/cjs/internals/Tree/types.d.ts +0 -1
- package/cjs/internals/Tree/utils/getParentMap.d.ts +0 -1
- package/cjs/internals/Windowing/AutoSizer.js +2 -3
- package/cjs/internals/Windowing/List.js +4 -8
- package/cjs/internals/constants/index.d.ts +2 -2
- package/cjs/internals/hooks/useClickOutside.js +2 -4
- package/cjs/internals/hooks/useCustom.d.ts +0 -1
- package/cjs/internals/hooks/useCustom.js +5 -7
- package/cjs/internals/hooks/useElementResize.d.ts +0 -1
- package/cjs/internals/hooks/useEventCallback.js +1 -2
- package/cjs/internals/hooks/useEventListener.js +1 -1
- package/cjs/internals/hooks/useFocus.js +2 -4
- package/cjs/internals/hooks/useFocusVirtualListItem.d.ts +0 -1
- package/cjs/internals/hooks/useMount.js +1 -2
- package/cjs/internals/hooks/useRootClose.js +6 -6
- package/cjs/internals/hooks/useTimeout.js +1 -2
- package/cjs/internals/hooks/useToggleCaret.d.ts +0 -1
- package/cjs/internals/hooks/useUniqueId.js +1 -1
- package/cjs/internals/hooks/useUpdatedRef.d.ts +0 -1
- package/cjs/internals/styled-system/style-manager.js +1 -1
- package/cjs/internals/styled-system/useStyled.js +2 -2
- package/cjs/internals/types/utils.d.ts +0 -1
- package/cjs/internals/utils/colours.d.ts +4 -4
- package/cjs/internals/utils/colours.js +1 -1
- package/cjs/internals/utils/date/disableTime.js +6 -12
- package/cjs/internals/utils/date/omitHideDisabledProps.d.ts +1 -1
- package/cjs/internals/utils/date/useDateMode.d.ts +1 -1
- package/cjs/internals/utils/react/ReactChildren.js +1 -2
- package/cjs/internals/utils/react/deprecateComponent.js +1 -2
- package/cjs/internals/utils/react/getDOMNode.js +4 -5
- package/cjs/internals/utils/sizes.d.ts +2 -2
- package/cjs/internals/utils/style-sheet/css.d.ts +0 -1
- package/cjs/internals/utils/style-sheet/css.js +1 -1
- package/cjs/internals/utils/style-sheet/prefix.d.ts +0 -1
- package/cjs/internals/utils/style-sheet/responsive.d.ts +1 -1
- package/cjs/internals/utils/style-sheet/styles.d.ts +3 -3
- package/cjs/internals/utils/style-sheet/styles.js +1 -1
- package/cjs/toaster/ToastContainer.js +3 -5
- package/cjs/toaster/hooks/useDelayedClosure.d.ts +0 -1
- package/cjs/toaster/hooks/useDelayedClosure.js +3 -4
- package/cjs/toaster/toaster.js +42 -15
- package/cjs/useDialog/Dialog.d.ts +1 -1
- package/cjs/useDialog/Dialog.js +1 -1
- package/cjs/useDialog/useDialog.d.ts +1 -1
- package/cjs/useDialog/useDialog.js +3 -3
- package/cjs/useFormControl/hooks/useField.d.ts +0 -1
- package/cjs/useFormControl/hooks/useField.js +5 -7
- package/cjs/useFormControl/hooks/useRegisterModel.js +2 -2
- package/cjs/useFormControl/useFormControl.js +8 -8
- package/cjs/useToaster/useToaster.js +4 -5
- package/dist/rsuite-no-reset.css +14 -0
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite.css +14 -0
- package/dist/rsuite.js +224 -224
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Affix/Affix.js +4 -4
- package/esm/Animation/Collapse.js +1 -2
- package/esm/Animation/Transition.d.ts +2 -2
- package/esm/Animation/Transition.js +17 -20
- package/esm/AutoComplete/AutoComplete.d.ts +2 -0
- package/esm/AutoComplete/AutoComplete.js +12 -10
- package/esm/Avatar/useImage.js +1 -1
- package/esm/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/esm/Badge/Badge.js +1 -4
- package/esm/Breadcrumb/Breadcrumb.js +4 -4
- package/esm/Button/Button.js +6 -6
- package/esm/Calendar/Calendar.js +5 -5
- package/esm/Calendar/CalendarBody.js +1 -1
- package/esm/Calendar/CalendarContainer.js +14 -33
- package/esm/Calendar/CalendarHeader.js +7 -8
- package/esm/Calendar/Grid/GridCell.js +2 -2
- package/esm/Calendar/Grid/GridHeaderRow.js +1 -1
- package/esm/Calendar/Grid/GridRow.js +5 -6
- package/esm/Calendar/MonthDropdown/MonthDropdown.js +1 -1
- package/esm/Calendar/MonthDropdown/MonthDropdownItem.js +1 -1
- package/esm/Calendar/TimeDropdown/TimeDropdown.js +12 -14
- package/esm/Calendar/hooks/useCalendar.d.ts +16 -17
- package/esm/Calendar/hooks/useCalendar.js +2 -4
- package/esm/Calendar/hooks/useCalendarDate.js +5 -9
- package/esm/Calendar/hooks/useCalendarState.js +6 -12
- package/esm/Calendar/types.d.ts +0 -1
- package/esm/Carousel/Carousel.js +5 -6
- package/esm/CascadeTree/CascadeTree.js +6 -16
- package/esm/CascadeTree/TreeView.js +5 -7
- package/esm/CascadeTree/hooks/useSearch.d.ts +0 -1
- package/esm/CascadeTree/hooks/useSearch.js +1 -1
- package/esm/CascadeTree/hooks/useSelect.d.ts +0 -1
- package/esm/CascadeTree/hooks/useSelect.js +3 -4
- package/esm/CascadeTree/types.d.ts +0 -1
- package/esm/CascadeTree/utils.js +1 -2
- package/esm/Cascader/Cascader.js +18 -29
- package/esm/Cascader/useActive.d.ts +0 -1
- package/esm/Cascader/useActive.js +4 -6
- package/esm/CheckPicker/CheckPicker.js +14 -15
- package/esm/CheckTree/CheckTree.js +1 -1
- package/esm/CheckTree/CheckTreeNode.js +3 -4
- package/esm/CheckTree/CheckTreeView.js +5 -5
- package/esm/CheckTree/hooks/useTreeCheckState.js +2 -2
- package/esm/CheckTree/utils.js +9 -17
- package/esm/CheckTreePicker/CheckTreePicker.js +7 -7
- package/esm/CheckTreePicker/hooks/useFocusState.d.ts +0 -1
- package/esm/CheckTreePicker/hooks/useFocusState.js +3 -6
- package/esm/Checkbox/Checkbox.js +4 -5
- package/esm/Checkbox/hooks/useIndeterminateCheckbox.d.ts +0 -1
- package/esm/Checkbox/hooks/useIndeterminateCheckbox.js +1 -1
- package/esm/CheckboxGroup/CheckboxGroup.js +2 -2
- package/esm/DOMHelper/index.d.ts +1 -2
- package/esm/DOMHelper/isElement.js +1 -1
- package/esm/DateInput/DateField.d.ts +122 -3
- package/esm/DateInput/DateField.js +12 -15
- package/esm/DateInput/DateInput.js +3 -4
- package/esm/DateInput/hooks/useDateInputState.d.ts +124 -4
- package/esm/DateInput/hooks/useDateInputState.js +2 -2
- package/esm/DateInput/hooks/useIsFocused.js +2 -2
- package/esm/DateInput/hooks/useKeyboardInputEvent.d.ts +0 -1
- package/esm/DateInput/hooks/useKeyboardInputEvent.js +8 -9
- package/esm/DateInput/hooks/useSelectedState.d.ts +0 -1
- package/esm/DateInput/utils.d.ts +0 -1
- package/esm/DateInput/utils.js +2 -3
- package/esm/DatePicker/DatePicker.js +18 -25
- package/esm/DatePicker/PredefinedRanges.js +3 -3
- package/esm/DatePicker/Toolbar.js +4 -4
- package/esm/DatePicker/hooks/useCustomizedInput.d.ts +0 -1
- package/esm/DatePicker/hooks/useFocus.js +5 -8
- package/esm/DatePicker/hooks/useMonthView.d.ts +0 -1
- package/esm/DatePicker/hooks/useMonthView.js +1 -1
- package/esm/DatePicker/utils.d.ts +1 -2
- package/esm/DatePicker/utils.js +2 -2
- package/esm/DateRangeInput/DateRangeInput.js +8 -9
- package/esm/DateRangePicker/Calendar.js +2 -2
- package/esm/DateRangePicker/DateRangePicker.js +25 -29
- package/esm/DateRangePicker/Header.js +3 -3
- package/esm/DateRangePicker/disabledDateUtils.js +2 -2
- package/esm/DateRangePicker/hooks/useCalendarHandlers.d.ts +0 -1
- package/esm/DateRangePicker/hooks/useCalendarHandlers.js +5 -5
- package/esm/DateRangePicker/utils.js +1 -2
- package/esm/Dropdown/Dropdown.js +3 -3
- package/esm/Dropdown/DropdownItem.js +4 -5
- package/esm/Dropdown/DropdownMenu.d.ts +1 -1
- package/esm/Dropdown/DropdownMenu.js +1 -1
- package/esm/Form/Form.d.ts +38 -3
- package/esm/Form/Form.js +25 -12
- package/esm/Form/hooks/useFormRef.d.ts +0 -1
- package/esm/Form/hooks/useFormValidate.d.ts +2 -1
- package/esm/Form/hooks/useFormValidate.js +136 -20
- package/esm/Form/hooks/useFormValue.d.ts +0 -1
- package/esm/Form/index.d.ts +1 -0
- package/esm/Form/resolvers.d.ts +59 -0
- package/esm/Form/resolvers.js +2 -0
- package/esm/FormControl/FormControl.js +5 -5
- package/esm/FormGroup/FormGroupContext.d.ts +1 -1
- package/esm/Highlight/utils/highlightText.js +1 -1
- package/esm/InlineEdit/renderChildren.js +5 -6
- package/esm/InlineEdit/useEditState.js +9 -12
- package/esm/InlineEdit/useFocusEvent.d.ts +0 -1
- package/esm/InlineEdit/useFocusEvent.js +7 -11
- package/esm/Input/Input.js +1 -1
- package/esm/InputGroup/InputGroupContext.d.ts +2 -1
- package/esm/InputNumber/index.d.ts +0 -1
- package/esm/InputPicker/InputAutosize.js +1 -1
- package/esm/InputPicker/InputPicker.js +30 -35
- package/esm/InputPicker/InputSearch.js +1 -2
- package/esm/InputPicker/hooks/useData.d.ts +0 -1
- package/esm/InputPicker/hooks/useData.js +1 -1
- package/esm/InputPicker/hooks/useInput.js +3 -6
- package/esm/InputPicker/hooks/useMaxWidth.js +2 -4
- package/esm/List/helper/AutoScroller.js +2 -4
- package/esm/List/helper/useSortHelper.d.ts +4 -4
- package/esm/List/helper/useSortHelper.js +13 -19
- package/esm/MaskedInput/TextMask.d.ts +5 -5
- package/esm/MaskedInput/TextMask.js +3 -5
- package/esm/MaskedInput/conformToMask.d.ts +1 -1
- package/esm/MaskedInput/createTextMaskInputElement.js +2 -3
- package/esm/Menu/MenuItem.js +3 -4
- package/esm/Message/Message.js +1 -1
- package/esm/Modal/Modal.js +8 -10
- package/esm/Modal/ModalBody.js +1 -1
- package/esm/Modal/utils.d.ts +2 -3
- package/esm/Modal/utils.js +2 -3
- package/esm/MultiCascadeTree/SearchView.js +1 -1
- package/esm/MultiCascadeTree/TreeView.js +2 -2
- package/esm/MultiCascadeTree/hooks/useCascadeValue.d.ts +0 -1
- package/esm/MultiCascadeTree/hooks/useCascadeValue.js +5 -8
- package/esm/MultiCascadeTree/hooks/useColumnData.d.ts +0 -1
- package/esm/MultiCascadeTree/hooks/useSearch.d.ts +0 -1
- package/esm/MultiCascadeTree/hooks/useSearch.js +2 -2
- package/esm/MultiCascadeTree/hooks/useSelect.js +3 -4
- package/esm/MultiCascadeTree/types.d.ts +0 -1
- package/esm/MultiCascadeTree/utils.d.ts +4 -4
- package/esm/MultiCascadeTree/utils.js +2 -3
- package/esm/MultiCascader/MultiCascader.js +13 -16
- package/esm/Nav/AdaptiveNavItem.js +2 -3
- package/esm/Nav/Nav.d.ts +1 -1
- package/esm/Nav/Nav.js +4 -4
- package/esm/Nav/NavDropdown.d.ts +1 -1
- package/esm/Nav/NavDropdown.js +3 -3
- package/esm/Nav/NavDropdownItem.js +2 -2
- package/esm/Nav/NavDropdownMenu.d.ts +1 -1
- package/esm/Nav/NavDropdownMenu.js +1 -1
- package/esm/Nav/NavItem.js +4 -4
- package/esm/Navbar/Navbar.js +1 -1
- package/esm/Navbar/NavbarContent.js +1 -1
- package/esm/Navbar/NavbarDrawer.js +1 -1
- package/esm/Navbar/NavbarDropdown.d.ts +1 -1
- package/esm/Navbar/NavbarDropdown.js +3 -3
- package/esm/Navbar/NavbarDropdownItem.js +5 -6
- package/esm/Navbar/NavbarDropdownMenu.d.ts +1 -1
- package/esm/Navbar/NavbarDropdownMenu.js +1 -1
- package/esm/Navbar/NavbarItem.js +4 -4
- package/esm/Navbar/NavbarToggle.js +2 -2
- package/esm/Notification/Notification.js +1 -1
- package/esm/NumberInput/NumberInput.js +3 -3
- package/esm/NumberInput/hooks/useEvents.d.ts +0 -1
- package/esm/NumberInput/hooks/useEvents.js +2 -3
- package/esm/NumberInput/hooks/useWheelHandler.js +1 -2
- package/esm/Pagination/Pagination.js +1 -1
- package/esm/Pagination/PaginationButton.js +1 -1
- package/esm/Pagination/PaginationGroup.js +3 -4
- package/esm/Panel/Panel.js +2 -2
- package/esm/PanelGroup/PanelGroup.js +1 -1
- package/esm/PasswordInput/PasswordInput.js +2 -2
- package/esm/PinInput/PinInput.js +1 -1
- package/esm/PinInput/hooks/usePinInputRefs.d.ts +0 -1
- package/esm/PinInput/hooks/usePinInputRefs.js +2 -4
- package/esm/PinInput/hooks/usePinValue.d.ts +1 -1
- package/esm/PinInput/hooks/usePinValue.js +2 -2
- package/esm/Progress/ProgressLine.js +1 -1
- package/esm/Progress/types.d.ts +0 -1
- package/esm/ProgressCircle/hooks/useProgressCirclePath.d.ts +0 -1
- package/esm/Radio/Radio.js +3 -3
- package/esm/RadioGroup/RadioGroup.js +1 -1
- package/esm/RadioTile/RadioTile.js +2 -2
- package/esm/RadioTileGroup/RadioTileGroup.js +1 -1
- package/esm/RangeSlider/RangeSlider.js +6 -6
- package/esm/Rate/Character.js +2 -2
- package/esm/Rate/Rate.js +3 -3
- package/esm/Rate/useRatingStates.d.ts +0 -1
- package/esm/SegmentedControl/SegmentedControl.js +3 -3
- package/esm/SegmentedControl/hooks/useIndicatorPosition.js +1 -1
- package/esm/SelectPicker/SelectPicker.js +13 -16
- package/esm/Sidebar/Sidebar.js +1 -1
- package/esm/Sidenav/ExpandedSidenavDropdown.js +6 -6
- package/esm/Sidenav/ExpandedSidenavDropdownItem.js +4 -5
- package/esm/Sidenav/Node.js +9 -16
- package/esm/Sidenav/Sidenav.js +2 -2
- package/esm/Sidenav/SidenavDropdown.d.ts +1 -1
- package/esm/Sidenav/SidenavDropdown.js +4 -4
- package/esm/Sidenav/SidenavDropdownItem.js +3 -4
- package/esm/Sidenav/SidenavItem.js +5 -6
- package/esm/Sidenav/SidenavToggle.js +2 -2
- package/esm/Slider/Slider.js +3 -3
- package/esm/Slider/useDrag.d.ts +0 -1
- package/esm/Slider/useDrag.js +7 -12
- package/esm/Slider/utils.d.ts +1 -2
- package/esm/Slider/utils.js +2 -3
- package/esm/Steps/StepItem.js +1 -2
- package/esm/Table/Table.d.ts +3 -3
- package/esm/Tabs/Tabs.js +3 -4
- package/esm/TimePicker/TimePicker.js +2 -2
- package/esm/Timeline/Timeline.d.ts +6 -1
- package/esm/Timeline/Timeline.js +14 -10
- package/esm/Toggle/Toggle.js +2 -2
- package/esm/Tree/Tree.js +2 -2
- package/esm/Tree/TreeNode.js +10 -11
- package/esm/Tree/TreeView.js +5 -5
- package/esm/Tree/hooks/useExpandTree.js +1 -1
- package/esm/Tree/hooks/useFlattenTree.js +6 -9
- package/esm/Tree/hooks/useFocusTree.d.ts +1 -2
- package/esm/Tree/hooks/useFocusTree.js +12 -14
- package/esm/Tree/hooks/useTreeDrag.d.ts +0 -1
- package/esm/Tree/hooks/useTreeDrag.js +10 -12
- package/esm/Tree/hooks/useTreeNodeProps.js +1 -1
- package/esm/Tree/hooks/useTreeSearch.js +4 -4
- package/esm/Tree/hooks/useVirtualizedTreeData.js +2 -2
- package/esm/Tree/types.d.ts +2 -3
- package/esm/Tree/utils/flattenTree.d.ts +1 -1
- package/esm/Tree/utils/focusableTree.js +5 -8
- package/esm/Tree/utils/getNodeParentKeys.js +2 -4
- package/esm/Tree/utils/hasVisibleChildren.d.ts +1 -1
- package/esm/Tree/utils/treeKeyboardInteractions.js +3 -3
- package/esm/TreePicker/TreePicker.js +8 -9
- package/esm/TreePicker/hooks/useFocusState.d.ts +0 -1
- package/esm/TreePicker/hooks/useFocusState.js +4 -8
- package/esm/Uploader/UploadFileItem.js +8 -10
- package/esm/Uploader/UploadTrigger.js +8 -10
- package/esm/Uploader/Uploader.d.ts +2 -0
- package/esm/Uploader/Uploader.js +66 -26
- package/esm/Uploader/utils/ajaxUpload.js +5 -5
- package/esm/Uploader/utils/previewFile.js +1 -1
- package/esm/internals/Disclosure/Disclosure.js +5 -8
- package/esm/internals/Disclosure/DisclosureButton.js +2 -2
- package/esm/internals/InputBase/InputBase.js +5 -6
- package/esm/internals/Menu/Menu.js +16 -20
- package/esm/internals/Menu/MenuItem.js +4 -5
- package/esm/internals/Menu/Menubar.js +5 -7
- package/esm/internals/Menu/useMenu.js +5 -10
- package/esm/internals/Overlay/Modal.js +8 -11
- package/esm/internals/Overlay/ModalManager.js +3 -5
- package/esm/internals/Overlay/Overlay.js +1 -1
- package/esm/internals/Overlay/OverlayTrigger.d.ts +0 -1
- package/esm/internals/Overlay/OverlayTrigger.js +5 -7
- package/esm/internals/Overlay/Position.js +6 -8
- package/esm/internals/Picker/ListCheckItem.js +3 -3
- package/esm/internals/Picker/ListItem.js +1 -1
- package/esm/internals/Picker/Listbox.js +9 -10
- package/esm/internals/Picker/PickerIndicator.js +13 -11
- package/esm/internals/Picker/PickerPopup.js +4 -5
- package/esm/internals/Picker/PickerToggle.js +3 -4
- package/esm/internals/Picker/SelectedElement.js +1 -1
- package/esm/internals/Picker/hooks/useFocusItemValue.d.ts +0 -1
- package/esm/internals/Picker/hooks/useFocusItemValue.js +14 -28
- package/esm/internals/Picker/hooks/usePickerRef.d.ts +0 -1
- package/esm/internals/Picker/hooks/usePickerRef.js +9 -15
- package/esm/internals/Picker/hooks/useSearch.d.ts +0 -1
- package/esm/internals/Picker/hooks/useSearch.js +2 -2
- package/esm/internals/Picker/hooks/useToggleKeyDownEvent.d.ts +0 -1
- package/esm/internals/Picker/hooks/useToggleKeyDownEvent.js +13 -17
- package/esm/internals/Picker/utils.js +9 -9
- package/esm/internals/Ripple/Ripple.js +3 -4
- package/esm/internals/SafeAnchor/SafeAnchor.js +1 -1
- package/esm/internals/ScrollView/hooks/useScrollState.d.ts +0 -1
- package/esm/internals/ScrollView/hooks/useScrollState.js +2 -3
- package/esm/internals/Tree/TreeProvider.d.ts +4 -4
- package/esm/internals/Tree/TreeProvider.js +2 -8
- package/esm/internals/Tree/types.d.ts +0 -1
- package/esm/internals/Tree/utils/getParentMap.d.ts +0 -1
- package/esm/internals/Windowing/AutoSizer.js +2 -3
- package/esm/internals/Windowing/List.js +4 -8
- package/esm/internals/constants/index.d.ts +2 -2
- package/esm/internals/hooks/useClickOutside.js +2 -4
- package/esm/internals/hooks/useCustom.d.ts +0 -1
- package/esm/internals/hooks/useCustom.js +5 -7
- package/esm/internals/hooks/useElementResize.d.ts +0 -1
- package/esm/internals/hooks/useEventCallback.js +1 -2
- package/esm/internals/hooks/useEventListener.js +1 -1
- package/esm/internals/hooks/useFocus.js +2 -4
- package/esm/internals/hooks/useFocusVirtualListItem.d.ts +0 -1
- package/esm/internals/hooks/useMount.js +1 -2
- package/esm/internals/hooks/useRootClose.js +6 -6
- package/esm/internals/hooks/useTimeout.js +1 -2
- package/esm/internals/hooks/useToggleCaret.d.ts +0 -1
- package/esm/internals/hooks/useUniqueId.js +1 -1
- package/esm/internals/hooks/useUpdatedRef.d.ts +0 -1
- package/esm/internals/styled-system/style-manager.js +1 -1
- package/esm/internals/styled-system/useStyled.js +2 -2
- package/esm/internals/types/utils.d.ts +0 -1
- package/esm/internals/utils/colours.d.ts +4 -4
- package/esm/internals/utils/colours.js +1 -1
- package/esm/internals/utils/date/disableTime.js +6 -12
- package/esm/internals/utils/date/omitHideDisabledProps.d.ts +1 -1
- package/esm/internals/utils/date/useDateMode.d.ts +1 -1
- package/esm/internals/utils/react/ReactChildren.js +1 -2
- package/esm/internals/utils/react/deprecateComponent.js +1 -2
- package/esm/internals/utils/react/getDOMNode.js +4 -5
- package/esm/internals/utils/sizes.d.ts +2 -2
- package/esm/internals/utils/style-sheet/css.d.ts +0 -1
- package/esm/internals/utils/style-sheet/css.js +1 -1
- package/esm/internals/utils/style-sheet/prefix.d.ts +0 -1
- package/esm/internals/utils/style-sheet/responsive.d.ts +1 -1
- package/esm/internals/utils/style-sheet/styles.d.ts +3 -3
- package/esm/internals/utils/style-sheet/styles.js +1 -1
- package/esm/toaster/ToastContainer.js +3 -5
- package/esm/toaster/hooks/useDelayedClosure.d.ts +0 -1
- package/esm/toaster/hooks/useDelayedClosure.js +3 -4
- package/esm/toaster/toaster.js +42 -15
- package/esm/useDialog/Dialog.d.ts +1 -1
- package/esm/useDialog/Dialog.js +1 -1
- package/esm/useDialog/useDialog.d.ts +1 -1
- package/esm/useDialog/useDialog.js +3 -3
- package/esm/useFormControl/hooks/useField.d.ts +0 -1
- package/esm/useFormControl/hooks/useField.js +5 -7
- package/esm/useFormControl/hooks/useRegisterModel.js +2 -2
- package/esm/useFormControl/useFormControl.js +8 -8
- package/esm/useToaster/useToaster.js +4 -5
- package/package.json +1 -1
package/cjs/Slider/useDrag.d.ts
CHANGED
package/cjs/Slider/useDrag.js
CHANGED
|
@@ -25,8 +25,7 @@ const useDrag = props => {
|
|
|
25
25
|
|
|
26
26
|
// Release the move event
|
|
27
27
|
const releaseMoves = (0, _react.useCallback)(() => {
|
|
28
|
-
|
|
29
|
-
(_moveTracker$current = moveTracker.current) === null || _moveTracker$current === void 0 || _moveTracker$current.releaseMoves();
|
|
28
|
+
moveTracker.current?.releaseMoves();
|
|
30
29
|
moveTracker.current = null;
|
|
31
30
|
}, []);
|
|
32
31
|
const setTooltipPosition = (0, _react.useCallback)(() => {
|
|
@@ -39,18 +38,15 @@ const useDrag = props => {
|
|
|
39
38
|
}
|
|
40
39
|
}, [tooltip]);
|
|
41
40
|
const handleDragMove = (0, _hooks.useEventCallback)((_deltaX, _deltaY, event) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _rootRef$current;
|
|
45
|
-
onDragMove === null || onDragMove === void 0 || onDragMove(event, (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.dataset);
|
|
41
|
+
if (moveTracker.current?.isDragging()) {
|
|
42
|
+
onDragMove?.(event, rootRef.current?.dataset);
|
|
46
43
|
setTooltipPosition();
|
|
47
44
|
}
|
|
48
45
|
});
|
|
49
46
|
const handleDragEnd = (0, _hooks.useEventCallback)(event => {
|
|
50
|
-
var _rootRef$current2;
|
|
51
47
|
setActive(false);
|
|
52
48
|
releaseMoves();
|
|
53
|
-
onDragEnd
|
|
49
|
+
onDragEnd?.(event, rootRef.current?.dataset);
|
|
54
50
|
});
|
|
55
51
|
const getMouseMoveTracker = (0, _react.useCallback)(() => {
|
|
56
52
|
return moveTracker.current || new _PointerMoveTracker.default(document.body, {
|
|
@@ -60,15 +56,14 @@ const useDrag = props => {
|
|
|
60
56
|
});
|
|
61
57
|
}, [handleDragEnd, handleDragMove]);
|
|
62
58
|
const onMoveStart = (0, _hooks.useEventCallback)(event => {
|
|
63
|
-
var _moveTracker$current3, _rootRef$current3;
|
|
64
59
|
if (disabled) {
|
|
65
60
|
return;
|
|
66
61
|
}
|
|
67
62
|
moveTracker.current = getMouseMoveTracker();
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
moveTracker.current?.captureMoves(event);
|
|
64
|
+
rootRef.current?.focus();
|
|
70
65
|
setActive(true);
|
|
71
|
-
onDragStart
|
|
66
|
+
onDragStart?.(event);
|
|
72
67
|
});
|
|
73
68
|
const onMouseEnter = (0, _hooks.useEventCallback)(() => {
|
|
74
69
|
setTooltipPosition();
|
package/cjs/Slider/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const precisionMath: (value: any) => number;
|
|
3
|
-
export declare function checkValue<T extends number | undefined | null>(value: T, min: number, max: number): number | T;
|
|
2
|
+
export declare function checkValue<T extends number | undefined | null>(value: T, min: number, max: number): number | (T & undefined);
|
|
4
3
|
export declare function getPosition(e: React.MouseEvent | React.TouchEvent): {
|
|
5
4
|
pageX: number;
|
|
6
5
|
pageY: number;
|
package/cjs/Slider/utils.js
CHANGED
|
@@ -20,7 +20,6 @@ function checkValue(value, min, max) {
|
|
|
20
20
|
return value;
|
|
21
21
|
}
|
|
22
22
|
function getPosition(e) {
|
|
23
|
-
var _event, _event2;
|
|
24
23
|
let event = 'touches' in e ? e.touches[0] : e;
|
|
25
24
|
|
|
26
25
|
// For touchend event, we need to use `changedTouches` instead of `touches`
|
|
@@ -28,7 +27,7 @@ function getPosition(e) {
|
|
|
28
27
|
event = e.changedTouches[0];
|
|
29
28
|
}
|
|
30
29
|
return {
|
|
31
|
-
pageX:
|
|
32
|
-
pageY:
|
|
30
|
+
pageX: event?.pageX || 0,
|
|
31
|
+
pageY: event?.pageY || 0
|
|
33
32
|
};
|
|
34
33
|
}
|
package/cjs/Steps/StepItem.js
CHANGED
|
@@ -22,7 +22,6 @@ const STEP_STATUS_ICON = {
|
|
|
22
22
|
* @see https://rsuitejs.com/components/steps
|
|
23
23
|
*/
|
|
24
24
|
const StepItem = (0, _utils.forwardRef)((props, ref) => {
|
|
25
|
-
var _STEP_STATUS_ICON$sta;
|
|
26
25
|
const {
|
|
27
26
|
as: Component = 'div',
|
|
28
27
|
className,
|
|
@@ -48,7 +47,7 @@ const StepItem = (0, _utils.forwardRef)((props, ref) => {
|
|
|
48
47
|
className: prefix('icon', {
|
|
49
48
|
[`icon-${status}`]: status
|
|
50
49
|
})
|
|
51
|
-
}, status ?
|
|
50
|
+
}, status ? STEP_STATUS_ICON[status] ?? stepNumber : stepNumber);
|
|
52
51
|
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
|
|
53
52
|
ref: ref,
|
|
54
53
|
className: classes,
|
package/cjs/Table/Table.d.ts
CHANGED
|
@@ -12,11 +12,11 @@ export interface CellProps<Row extends RowDataType> extends Omit<TableCellProps<
|
|
|
12
12
|
*
|
|
13
13
|
* @see https://rsuitejs.com/components/table/
|
|
14
14
|
*/
|
|
15
|
-
declare const Table: (<Row extends RowDataType
|
|
15
|
+
declare const Table: (<Row extends RowDataType, Key extends RowKeyType>(props: TableProps<Row, Key> & React.RefAttributes<TableInstance<Row, Key>>) => React.ReactElement) & {
|
|
16
16
|
/**
|
|
17
17
|
* The `Table.Cell` component is used to display data in a table cell.
|
|
18
18
|
*/
|
|
19
|
-
Cell: <
|
|
19
|
+
Cell: <Row extends RowDataType, Key extends RowKeyType>(props: import("rsuite-table/lib/Cell").InnerCellProps<Row, Key> & React.RefAttributes<HTMLDivElement>) => React.ReactElement;
|
|
20
20
|
/**
|
|
21
21
|
* The `Table.Column` component is used to define a column in a table.
|
|
22
22
|
*/
|
|
@@ -24,7 +24,7 @@ declare const Table: (<Row extends RowDataType<any>, Key extends RowKeyType>(pro
|
|
|
24
24
|
/**
|
|
25
25
|
* The `Table.HeaderCell` component is used to define a header cell in a table.
|
|
26
26
|
*/
|
|
27
|
-
HeaderCell: <
|
|
27
|
+
HeaderCell: <Row extends RowDataType, Key extends RowKeyType>(props: import("rsuite-table").HeaderCellProps<Row, Key> & React.RefAttributes<HTMLDivElement>) => React.ReactElement;
|
|
28
28
|
/**
|
|
29
29
|
* The `Table.ColumnGroup` component is used to define a column group in a table.
|
|
30
30
|
*/
|
package/cjs/Tabs/Tabs.js
CHANGED
|
@@ -17,7 +17,7 @@ var _hooks = require("../internals/hooks");
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
function getFocusableTabs(tablist) {
|
|
20
|
-
const tabs = tablist
|
|
20
|
+
const tabs = tablist?.querySelectorAll('[role=tab]');
|
|
21
21
|
return Array.from(tabs).filter(tab => !(tab.getAttribute('aria-disabled') === 'true'));
|
|
22
22
|
}
|
|
23
23
|
function getFocusedTab(tablist) {
|
|
@@ -141,10 +141,9 @@ const Tabs = (0, _utils.forwardRef)((props, ref) => {
|
|
|
141
141
|
const tablistRef = _react.default.useRef(null);
|
|
142
142
|
const handleSelect = (0, _hooks.useEventCallback)((eventKey, event) => {
|
|
143
143
|
setActiveKey(eventKey);
|
|
144
|
-
onSelect
|
|
144
|
+
onSelect?.(eventKey, event);
|
|
145
145
|
});
|
|
146
146
|
const handleKeyDown = (0, _hooks.useEventCallback)(event => {
|
|
147
|
-
var _getFocusableTabs;
|
|
148
147
|
const target = event.target;
|
|
149
148
|
if (target.getAttribute('role') !== 'tab') {
|
|
150
149
|
return;
|
|
@@ -166,7 +165,7 @@ const Tabs = (0, _utils.forwardRef)((props, ref) => {
|
|
|
166
165
|
event.preventDefault();
|
|
167
166
|
break;
|
|
168
167
|
case 'Home':
|
|
169
|
-
item =
|
|
168
|
+
item = getFocusableTabs(tablistRef.current)?.[0];
|
|
170
169
|
event.preventDefault();
|
|
171
170
|
break;
|
|
172
171
|
case 'End':
|
|
@@ -17,12 +17,12 @@ const TimePicker = (0, _utils.forwardRef)((props, ref) => {
|
|
|
17
17
|
} = (0, _hooks.useCustom)('TimePicker', props);
|
|
18
18
|
const locale = getLocale('DateTimeFormats');
|
|
19
19
|
const defaultRanges = (0, _react.useMemo)(() => [{
|
|
20
|
-
label: locale
|
|
20
|
+
label: locale?.now,
|
|
21
21
|
value: () => new Date()
|
|
22
22
|
}], [locale]);
|
|
23
23
|
return /*#__PURE__*/_react.default.createElement(_DatePicker.default, (0, _extends2.default)({
|
|
24
24
|
ref: ref,
|
|
25
|
-
format: locale
|
|
25
|
+
format: locale?.shortTimeFormat,
|
|
26
26
|
ranges: defaultRanges
|
|
27
27
|
}, propsWithDefaults));
|
|
28
28
|
});
|
|
@@ -7,6 +7,11 @@ export interface TimelineProps extends BoxProps {
|
|
|
7
7
|
align?: 'left' | 'right' | 'alternate';
|
|
8
8
|
/** Timeline endless **/
|
|
9
9
|
endless?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Reverse the order of Timeline items
|
|
12
|
+
* @version 6.2.0
|
|
13
|
+
**/
|
|
14
|
+
reverse?: boolean;
|
|
10
15
|
/**
|
|
11
16
|
* Whether an item is active (with highlighted dot).
|
|
12
17
|
*
|
|
@@ -22,7 +27,7 @@ export interface TimelineProps extends BoxProps {
|
|
|
22
27
|
*/
|
|
23
28
|
declare const Timeline: import("../internals/types").InternalRefForwardingComponent<"div", TimelineProps, never> & {
|
|
24
29
|
Item: import("../internals/types").InternalRefForwardingComponent<"div", import("./TimelineItem").TimelineItemProps, never> & Record<string, never>;
|
|
25
|
-
ACTIVE_FIRST: (index: number) =>
|
|
30
|
+
ACTIVE_FIRST: (index: number) => index is 0;
|
|
26
31
|
ACTIVE_LAST: (index: number, totalItemsCount: number) => boolean;
|
|
27
32
|
};
|
|
28
33
|
export default Timeline;
|
package/cjs/Timeline/Timeline.js
CHANGED
|
@@ -35,6 +35,7 @@ const Timeline = (0, _utils.forwardRef)((props, ref) => {
|
|
|
35
35
|
className,
|
|
36
36
|
align = 'left',
|
|
37
37
|
endless,
|
|
38
|
+
reverse,
|
|
38
39
|
isItemActive = ACTIVE_LAST,
|
|
39
40
|
...rest
|
|
40
41
|
} = propsWithDefaults;
|
|
@@ -43,23 +44,26 @@ const Timeline = (0, _utils.forwardRef)((props, ref) => {
|
|
|
43
44
|
withPrefix
|
|
44
45
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
45
46
|
const count = _utils.rch.count(children);
|
|
46
|
-
const withTime = (0, _some.default)(_react.default.Children.toArray(children), item =>
|
|
47
|
-
var _item$props;
|
|
48
|
-
return item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.time;
|
|
49
|
-
});
|
|
47
|
+
const withTime = (0, _some.default)(_react.default.Children.toArray(children), item => item?.props?.time);
|
|
50
48
|
const classes = merge(className, withPrefix(`align-${align}`, {
|
|
51
49
|
endless,
|
|
52
|
-
'with-time': withTime
|
|
50
|
+
'with-time': withTime,
|
|
51
|
+
reverse
|
|
53
52
|
}));
|
|
53
|
+
const childrenArray = _react.default.Children.toArray(children);
|
|
54
|
+
const orderedChildren = reverse ? [...childrenArray].reverse() : childrenArray;
|
|
54
55
|
return /*#__PURE__*/_react.default.createElement(_Box.default, (0, _extends2.default)({
|
|
55
56
|
as: as,
|
|
56
57
|
ref: ref,
|
|
57
58
|
className: classes
|
|
58
|
-
}, rest),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
}, rest), orderedChildren.map((child, domIndex) => {
|
|
60
|
+
const logicalIndex = reverse ? count - 1 - domIndex : domIndex;
|
|
61
|
+
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
62
|
+
last: logicalIndex + 1 === count,
|
|
63
|
+
INTERNAL_active: isItemActive(logicalIndex, count),
|
|
64
|
+
align
|
|
65
|
+
});
|
|
66
|
+
}));
|
|
63
67
|
}, SubcomponentsAndStaticMethods);
|
|
64
68
|
Timeline.displayName = 'Timeline';
|
|
65
69
|
var _default = exports.default = Timeline;
|
package/cjs/Toggle/Toggle.js
CHANGED
|
@@ -51,7 +51,7 @@ const Toggle = (0, _utils.forwardRef)((props, ref) => {
|
|
|
51
51
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
52
52
|
const classes = merge(className, withPrefix({}));
|
|
53
53
|
const inner = checked ? checkedChildren : unCheckedChildren;
|
|
54
|
-
const innerLabel = checked ? locale
|
|
54
|
+
const innerLabel = checked ? locale?.on : locale?.off;
|
|
55
55
|
const labelId = (0, _hooks.useUniqueId)('rs-label');
|
|
56
56
|
const innerId = inner ? labelId + '-inner' : undefined;
|
|
57
57
|
const labelledby = label ? labelId : innerId;
|
|
@@ -64,7 +64,7 @@ const Toggle = (0, _utils.forwardRef)((props, ref) => {
|
|
|
64
64
|
checked
|
|
65
65
|
} = e.target;
|
|
66
66
|
setChecked(checked);
|
|
67
|
-
onChange
|
|
67
|
+
onChange?.(checked, e);
|
|
68
68
|
});
|
|
69
69
|
if (plaintext) {
|
|
70
70
|
return /*#__PURE__*/_react.default.createElement(_Plaintext.default, null, inner || innerLabel);
|
package/cjs/Tree/Tree.js
CHANGED
|
@@ -71,8 +71,8 @@ const Tree = (0, _utils.forwardRef)((props, ref) => {
|
|
|
71
71
|
});
|
|
72
72
|
const handleSelect = (0, _hooks.useEventCallback)((nodeData, nextValue, event) => {
|
|
73
73
|
setValue(nextValue);
|
|
74
|
-
onSelect
|
|
75
|
-
onChange
|
|
74
|
+
onSelect?.(nodeData, nextValue, event);
|
|
75
|
+
onChange?.(nextValue, event);
|
|
76
76
|
});
|
|
77
77
|
const treeContext = (0, _react.useMemo)(() => ({
|
|
78
78
|
props: {
|
package/cjs/Tree/TreeNode.js
CHANGED
|
@@ -60,43 +60,42 @@ const TreeNode = (0, _utils.forwardRef)((props, ref) => {
|
|
|
60
60
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
61
61
|
const labelStr = (0, _react.useMemo)(() => (0, _utils.stringifyReactNode)(label), [label]);
|
|
62
62
|
const handleExpand = (0, _hooks.useEventCallback)(event => {
|
|
63
|
-
var _event$nativeEvent, _event$nativeEvent$st;
|
|
64
63
|
// Stop propagation when using custom loading icon
|
|
65
|
-
event
|
|
64
|
+
event?.nativeEvent?.stopImmediatePropagation?.();
|
|
66
65
|
event.stopPropagation();
|
|
67
|
-
onExpand
|
|
66
|
+
onExpand?.(nodeData, expanded);
|
|
68
67
|
});
|
|
69
68
|
const handleSelect = (0, _hooks.useEventCallback)(event => {
|
|
70
69
|
if (disabled) {
|
|
71
70
|
return;
|
|
72
71
|
}
|
|
73
|
-
onSelect
|
|
72
|
+
onSelect?.(nodeData, event);
|
|
74
73
|
});
|
|
75
74
|
const handleDragStart = (0, _hooks.useEventCallback)(event => {
|
|
76
|
-
onDragStart
|
|
75
|
+
onDragStart?.(nodeData, event);
|
|
77
76
|
});
|
|
78
77
|
const handleDragEnter = (0, _hooks.useEventCallback)(event => {
|
|
79
78
|
event.preventDefault();
|
|
80
79
|
event.stopPropagation();
|
|
81
|
-
onDragEnter
|
|
80
|
+
onDragEnter?.(nodeData, event);
|
|
82
81
|
});
|
|
83
82
|
const handleDragOver = (0, _hooks.useEventCallback)(event => {
|
|
84
83
|
event.preventDefault();
|
|
85
84
|
event.stopPropagation();
|
|
86
|
-
onDragOver
|
|
85
|
+
onDragOver?.(nodeData, event);
|
|
87
86
|
});
|
|
88
87
|
const handleDragLeave = (0, _hooks.useEventCallback)(event => {
|
|
89
88
|
event.stopPropagation();
|
|
90
|
-
onDragLeave
|
|
89
|
+
onDragLeave?.(nodeData, event);
|
|
91
90
|
});
|
|
92
91
|
const handleDragEnd = (0, _hooks.useEventCallback)(event => {
|
|
93
92
|
event.stopPropagation();
|
|
94
|
-
onDragEnd
|
|
93
|
+
onDragEnd?.(nodeData, event);
|
|
95
94
|
});
|
|
96
95
|
const handleDrop = (0, _hooks.useEventCallback)(event => {
|
|
97
96
|
event.preventDefault();
|
|
98
97
|
event.stopPropagation();
|
|
99
|
-
onDrop
|
|
98
|
+
onDrop?.(nodeData, event);
|
|
100
99
|
});
|
|
101
100
|
const classes = merge(className, withPrefix({
|
|
102
101
|
disabled,
|
|
@@ -117,7 +116,7 @@ const TreeNode = (0, _utils.forwardRef)((props, ref) => {
|
|
|
117
116
|
"aria-disabled": disabled,
|
|
118
117
|
"aria-selected": active,
|
|
119
118
|
"data-layer": layer,
|
|
120
|
-
"data-key":
|
|
119
|
+
"data-key": nodeData?.refKey || '',
|
|
121
120
|
title: labelStr,
|
|
122
121
|
className: classes,
|
|
123
122
|
style: styles,
|
package/cjs/Tree/TreeView.js
CHANGED
|
@@ -87,7 +87,7 @@ const TreeView = (0, _utils.forwardRef)((props, ref) => {
|
|
|
87
87
|
withPrefix
|
|
88
88
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
89
89
|
const handleSearchCallback = (0, _hooks.useEventCallback)((value, _data, event) => {
|
|
90
|
-
onSearch
|
|
90
|
+
onSearch?.(value, event);
|
|
91
91
|
});
|
|
92
92
|
const {
|
|
93
93
|
filteredData,
|
|
@@ -108,7 +108,7 @@ const TreeView = (0, _utils.forwardRef)((props, ref) => {
|
|
|
108
108
|
if (virtualized) {
|
|
109
109
|
return transformation().filter(n => n.visible);
|
|
110
110
|
}
|
|
111
|
-
return filteredData.map((dataItem, index) => render
|
|
111
|
+
return filteredData.map((dataItem, index) => render?.(dataItem, index, 1)).filter(n => n);
|
|
112
112
|
};
|
|
113
113
|
(0, _react.useEffect)(() => {
|
|
114
114
|
setFilteredData(data, keyword);
|
|
@@ -167,8 +167,8 @@ const TreeView = (0, _utils.forwardRef)((props, ref) => {
|
|
|
167
167
|
const nextValue = nodeData[valueKey];
|
|
168
168
|
const path = (0, _utils2.getPathTowardsItem)(nodeData, item => itemParentMap.get(item[valueKey]));
|
|
169
169
|
setFocusItemValue(nextValue);
|
|
170
|
-
onSelect
|
|
171
|
-
onSelectItem
|
|
170
|
+
onSelect?.(nodeData, nextValue, event);
|
|
171
|
+
onSelectItem?.(nodeData, path);
|
|
172
172
|
});
|
|
173
173
|
const selectActiveItem = (0, _hooks.useEventCallback)(event => {
|
|
174
174
|
if ((0, _isNil.default)(focusItemValue)) return;
|
|
@@ -213,7 +213,7 @@ const TreeView = (0, _utils.forwardRef)((props, ref) => {
|
|
|
213
213
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
214
214
|
className: prefix('group'),
|
|
215
215
|
role: "group"
|
|
216
|
-
}, children
|
|
216
|
+
}, children?.map((child, i) => renderNode(child, i, layer)), showIndentLine && /*#__PURE__*/_react.default.createElement(_IndentLine.default, null)));
|
|
217
217
|
}
|
|
218
218
|
return /*#__PURE__*/_react.default.createElement(_TreeNode.default, (0, _extends2.default)({
|
|
219
219
|
ref: ref => saveTreeNodeRef(ref, node.refKey),
|
|
@@ -55,7 +55,7 @@ function useExpandTree(data, props) {
|
|
|
55
55
|
valueKey
|
|
56
56
|
});
|
|
57
57
|
setExpandItemValues(nextExpandItemValues);
|
|
58
|
-
onExpand
|
|
58
|
+
onExpand?.(nextExpandItemValues, node, (0, _Picker.createConcatChildrenFunction)(node, node[valueKey], {
|
|
59
59
|
valueKey,
|
|
60
60
|
childrenKey
|
|
61
61
|
}));
|
|
@@ -91,27 +91,24 @@ function useFlattenTree(data, options) {
|
|
|
91
91
|
}
|
|
92
92
|
flattenTreeData(node[childrenKey], node, layer + 1);
|
|
93
93
|
});
|
|
94
|
-
callback
|
|
94
|
+
callback?.(flattenedNodes.current);
|
|
95
95
|
forceUpdate();
|
|
96
96
|
}, [callback, forceUpdate, valueKey, labelKey, uncheckableItemValues, childrenKey]);
|
|
97
97
|
(0, _react.useEffect)(() => {
|
|
98
|
-
// when data is changed, should clear the flattenedNodes, avoid duplicate keys
|
|
99
98
|
flattenedNodes.current = {};
|
|
100
99
|
seenValues.current.clear();
|
|
101
100
|
flattenTreeData(data);
|
|
101
|
+
if (multiple) {
|
|
102
|
+
updateTreeNodeCheckState(value);
|
|
103
|
+
forceUpdate();
|
|
104
|
+
}
|
|
102
105
|
}, [data]);
|
|
103
106
|
(0, _react.useEffect)(() => {
|
|
104
107
|
if (multiple) {
|
|
105
108
|
updateTreeNodeCheckState(value);
|
|
106
109
|
forceUpdate();
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Add a dependency on data, because when loading data asynchronously through getChildren,
|
|
111
|
-
* data may change and the node status needs to be updated.
|
|
112
|
-
* @see https://github.com/rsuite/rsuite/issues/3973
|
|
113
|
-
*/
|
|
114
|
-
}, [value, data]);
|
|
111
|
+
}, [value]);
|
|
115
112
|
return flattenedNodes.current;
|
|
116
113
|
}
|
|
117
114
|
var _default = exports.default = useFlattenTree;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { TreeNode } from '../../internals/Tree/types';
|
|
3
2
|
interface UseFocusTreeProps<T extends TreeNode> {
|
|
4
3
|
filteredData: T[];
|
|
@@ -17,7 +16,7 @@ declare function useFocusTree(props: UseFocusTreeProps<TreeNode>): {
|
|
|
17
16
|
focusTreeFirstNode: (...args: any[]) => any;
|
|
18
17
|
focusItemValue: string | number | null | undefined;
|
|
19
18
|
treeNodesRefs: {};
|
|
20
|
-
saveTreeNodeRef: (ref: any, refKey?: string
|
|
19
|
+
saveTreeNodeRef: (ref: any, refKey?: string) => void;
|
|
21
20
|
setFocusItemValue: import("react").Dispatch<import("react").SetStateAction<string | number | null | undefined>>;
|
|
22
21
|
onTreeKeydown: (...args: any[]) => any;
|
|
23
22
|
};
|
|
@@ -65,7 +65,7 @@ function useFocusTree(props) {
|
|
|
65
65
|
}
|
|
66
66
|
if (focusedValue) {
|
|
67
67
|
setFocusItemValue(focusedValue);
|
|
68
|
-
onFocused
|
|
68
|
+
onFocused?.(focusedValue);
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
const handleLeftArrowEvent = (0, _hooks.useEventCallback)(() => {
|
|
@@ -73,13 +73,12 @@ function useFocusTree(props) {
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
const focusItem = (0, _utils.getActiveItem)(focusItemValue, flattenedNodes, valueKey);
|
|
76
|
-
const expand = expandItemValues.includes(focusItem
|
|
76
|
+
const expand = expandItemValues.includes(focusItem?.[valueKey]);
|
|
77
77
|
const onFocusItem = () => {
|
|
78
|
-
|
|
79
|
-
const focusedValue = focusItem === null || focusItem === void 0 || (_focusItem$parent = focusItem.parent) === null || _focusItem$parent === void 0 ? void 0 : _focusItem$parent[valueKey];
|
|
78
|
+
const focusedValue = focusItem?.parent?.[valueKey];
|
|
80
79
|
setFocusItemValue(focusedValue);
|
|
81
|
-
onFocused
|
|
82
|
-
(0, _utils.focusTreeNode)(focusItem
|
|
80
|
+
onFocused?.(focusedValue);
|
|
81
|
+
(0, _utils.focusTreeNode)(focusItem?.parent?.refKey, treeNodesRefs);
|
|
83
82
|
};
|
|
84
83
|
(0, _utils.handleLeftArrow)({
|
|
85
84
|
focusItem,
|
|
@@ -94,7 +93,7 @@ function useFocusTree(props) {
|
|
|
94
93
|
return;
|
|
95
94
|
}
|
|
96
95
|
const focusItem = (0, _utils.getActiveItem)(focusItemValue, flattenedNodes, valueKey);
|
|
97
|
-
const expand = expandItemValues.includes(focusItem
|
|
96
|
+
const expand = expandItemValues.includes(focusItem?.[valueKey]);
|
|
98
97
|
const onFocusItem = () => handleFocusItem(_constants.KEY_VALUES.DOWN);
|
|
99
98
|
(0, _utils.handleRightArrow)({
|
|
100
99
|
focusItem,
|
|
@@ -109,7 +108,7 @@ function useFocusTree(props) {
|
|
|
109
108
|
const focusedValue = (0, _utils.focusFirstItem)(focusProps);
|
|
110
109
|
if (focusedValue) {
|
|
111
110
|
setFocusItemValue(focusedValue);
|
|
112
|
-
onFocused
|
|
111
|
+
onFocused?.(focusedValue);
|
|
113
112
|
}
|
|
114
113
|
});
|
|
115
114
|
const handleEndKey = (0, _hooks.useEventCallback)(() => {
|
|
@@ -117,7 +116,7 @@ function useFocusTree(props) {
|
|
|
117
116
|
const focusedValue = (0, _utils.focusLastItem)(focusProps);
|
|
118
117
|
if (focusedValue) {
|
|
119
118
|
setFocusItemValue(focusedValue);
|
|
120
|
-
onFocused
|
|
119
|
+
onFocused?.(focusedValue);
|
|
121
120
|
}
|
|
122
121
|
});
|
|
123
122
|
const onTreeKeydown = (0, _hooks.useEventCallback)(event => {
|
|
@@ -138,21 +137,20 @@ function useFocusTree(props) {
|
|
|
138
137
|
container: treeViewRef.current
|
|
139
138
|
});
|
|
140
139
|
if (refKey) {
|
|
141
|
-
|
|
142
|
-
const node = (_flattenedNodesRef$cu = flattenedNodesRef.current) === null || _flattenedNodesRef$cu === void 0 ? void 0 : _flattenedNodesRef$cu[refKey];
|
|
140
|
+
const node = flattenedNodesRef.current?.[refKey];
|
|
143
141
|
if (node) {
|
|
144
142
|
setFocusItemValue(node[valueKey]);
|
|
145
|
-
onFocused
|
|
143
|
+
onFocused?.(node[valueKey]);
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
}, [onFocused, valueKey]);
|
|
149
147
|
(0, _react.useEffect)(() => {
|
|
150
|
-
const unregister = register
|
|
148
|
+
const unregister = register?.({
|
|
151
149
|
focusTreeFirstNode,
|
|
152
150
|
focusTreeActiveNode
|
|
153
151
|
});
|
|
154
152
|
return () => {
|
|
155
|
-
unregister
|
|
153
|
+
unregister?.();
|
|
156
154
|
};
|
|
157
155
|
}, []);
|
|
158
156
|
(0, _react.useEffect)(() => {
|
|
@@ -65,9 +65,8 @@ function createDragPreview(name, className) {
|
|
|
65
65
|
* Removes the drag preview element from the DOM.
|
|
66
66
|
*/
|
|
67
67
|
function removeDragPreview() {
|
|
68
|
-
var _dragPreview$parentNo, _dragPreview$parentNo2;
|
|
69
68
|
const dragPreview = document.getElementById('rs-tree-drag-preview');
|
|
70
|
-
dragPreview
|
|
69
|
+
dragPreview?.parentNode?.removeChild?.(dragPreview);
|
|
71
70
|
}
|
|
72
71
|
/**
|
|
73
72
|
* Custom hook for handling tree node dragging.
|
|
@@ -106,7 +105,7 @@ function useTreeDrag(props) {
|
|
|
106
105
|
const getDragNodeKeys = (0, _react.useCallback)(dragNode => {
|
|
107
106
|
let dragNodeKeys = [dragNode[valueKey]];
|
|
108
107
|
const traverse = data => {
|
|
109
|
-
if (
|
|
108
|
+
if (data?.length > 0) {
|
|
110
109
|
data.forEach(node => {
|
|
111
110
|
dragNodeKeys = dragNodeKeys.concat([node[valueKey]]);
|
|
112
111
|
if (node[childrenKey]) {
|
|
@@ -202,12 +201,11 @@ function useTreeDrag(props) {
|
|
|
202
201
|
}, [createDragTreeDataFunction, dropNodePosition]);
|
|
203
202
|
const handleDragStart = (0, _hooks.useEventCallback)((nodeData, event) => {
|
|
204
203
|
if (draggable) {
|
|
205
|
-
var _event$dataTransfer;
|
|
206
204
|
const dragMoverNode = createDragPreview((0, _utils.stringifyReactNode)(nodeData[labelKey]), prefix('drag-preview'));
|
|
207
|
-
|
|
205
|
+
event.dataTransfer?.setDragImage(dragMoverNode, 0, 0);
|
|
208
206
|
setDragNodeKeys(getDragNodeKeys(nodeData));
|
|
209
207
|
setDragNode(flattenedNodes[nodeData.refKey]);
|
|
210
|
-
onDragStart
|
|
208
|
+
onDragStart?.(nodeData, event);
|
|
211
209
|
}
|
|
212
210
|
});
|
|
213
211
|
const handleDragEnter = (0, _hooks.useEventCallback)((nodeData, event) => {
|
|
@@ -218,7 +216,7 @@ function useTreeDrag(props) {
|
|
|
218
216
|
setDragOverNodeKey(nodeData[valueKey]);
|
|
219
217
|
setDropNodePosition(calDropNodePosition(event, treeNodesRefs[nodeData.refKey]));
|
|
220
218
|
}
|
|
221
|
-
onDragEnter
|
|
219
|
+
onDragEnter?.(nodeData, event);
|
|
222
220
|
});
|
|
223
221
|
const handleDragOver = (0, _hooks.useEventCallback)((nodeData, event) => {
|
|
224
222
|
if (dragNodeKeys.some(d => (0, _utils.shallowEqual)(d, nodeData[valueKey]))) {
|
|
@@ -230,24 +228,24 @@ function useTreeDrag(props) {
|
|
|
230
228
|
if (lastDropNodePosition === dropNodePosition) return;
|
|
231
229
|
setDropNodePosition(lastDropNodePosition);
|
|
232
230
|
}
|
|
233
|
-
onDragOver
|
|
231
|
+
onDragOver?.(nodeData, event);
|
|
234
232
|
});
|
|
235
233
|
const handleDragLeave = (0, _hooks.useEventCallback)((nodeData, event) => {
|
|
236
|
-
onDragLeave
|
|
234
|
+
onDragLeave?.(nodeData, event);
|
|
237
235
|
});
|
|
238
236
|
const handleDragEnd = (0, _hooks.useEventCallback)((nodeData, event) => {
|
|
239
237
|
removeDragPreview();
|
|
240
238
|
setDragNode(null);
|
|
241
239
|
setDragNodeKeys([]);
|
|
242
240
|
setDragOverNodeKey(null);
|
|
243
|
-
onDragEnd
|
|
241
|
+
onDragEnd?.(nodeData, event);
|
|
244
242
|
});
|
|
245
243
|
const handleDrop = (0, _hooks.useEventCallback)((nodeData, event) => {
|
|
246
244
|
if (dragNodeKeys.some(d => (0, _utils.shallowEqual)(d, nodeData[valueKey]))) {
|
|
247
245
|
console.error('Cannot drag a node to itself and its children');
|
|
248
246
|
} else {
|
|
249
247
|
const dropData = getDropData(nodeData);
|
|
250
|
-
onDrop
|
|
248
|
+
onDrop?.(dropData, event);
|
|
251
249
|
}
|
|
252
250
|
removeDragPreview();
|
|
253
251
|
setDragNode(null);
|
|
@@ -263,7 +261,7 @@ function useTreeDrag(props) {
|
|
|
263
261
|
onDrop: handleDrop
|
|
264
262
|
};
|
|
265
263
|
return {
|
|
266
|
-
dragNode: dragNode
|
|
264
|
+
dragNode: dragNode?.current,
|
|
267
265
|
dragOverNodeKey,
|
|
268
266
|
dropNodePosition,
|
|
269
267
|
dragEvents
|
|
@@ -39,7 +39,7 @@ function useTreeNodeProps(props) {
|
|
|
39
39
|
const {
|
|
40
40
|
visible
|
|
41
41
|
} = nodeData;
|
|
42
|
-
const draggingNode = dragNode
|
|
42
|
+
const draggingNode = dragNode ?? {};
|
|
43
43
|
const nodeValue = nodeData[valueKey];
|
|
44
44
|
const nodeLabel = nodeData[labelKey];
|
|
45
45
|
const children = nodeData[childrenKey];
|
|
@@ -39,21 +39,21 @@ function useTreeSearch(props) {
|
|
|
39
39
|
}, [childrenKey, labelKey, searchBy]);
|
|
40
40
|
|
|
41
41
|
// Use search keywords to filter options.
|
|
42
|
-
const [keyword, setSearchKeyword] = (0, _react.useState)(searchKeyword
|
|
42
|
+
const [keyword, setSearchKeyword] = (0, _react.useState)(searchKeyword ?? '');
|
|
43
43
|
const [filteredData, setFilteredData] = (0, _react.useState)(() => filterVisibleData(data, keyword));
|
|
44
44
|
const handleSearch = (searchKeyword, event) => {
|
|
45
45
|
const filteredData = filterVisibleData(data, searchKeyword);
|
|
46
46
|
setFilteredData(filteredData);
|
|
47
47
|
setSearchKeyword(searchKeyword);
|
|
48
48
|
if (event) {
|
|
49
|
-
callback
|
|
49
|
+
callback?.(searchKeyword, filteredData, event);
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
(0, _react.useEffect)(() => {
|
|
53
|
-
handleSearch(searchKeyword
|
|
53
|
+
handleSearch(searchKeyword ?? '');
|
|
54
54
|
}, [searchKeyword]);
|
|
55
55
|
(0, _react.useEffect)(() => {
|
|
56
|
-
setSearchKeyword(searchKeyword
|
|
56
|
+
setSearchKeyword(searchKeyword ?? '');
|
|
57
57
|
}, [searchKeyword, setSearchKeyword]);
|
|
58
58
|
const setVisibleData = (0, _react.useCallback)((data, searchKeyword) => {
|
|
59
59
|
setFilteredData(filterVisibleData(data, searchKeyword));
|