rsuite 6.1.2 → 6.1.3
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 +9 -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.js +9 -9
- 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 +7 -16
- 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 +1 -3
- package/cjs/Form/Form.js +9 -11
- package/cjs/Form/hooks/useFormRef.d.ts +0 -1
- package/cjs/Form/hooks/useFormValidate.d.ts +0 -1
- package/cjs/Form/hooks/useFormValidate.js +19 -19
- package/cjs/Form/hooks/useFormValue.d.ts +0 -1
- 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 +1 -1
- package/cjs/Timeline/Timeline.js +1 -4
- 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 +1 -1
- 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.js +18 -24
- 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/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 +4 -12
- 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.js +223 -223
- 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.js +9 -9
- 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 +7 -16
- 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 +1 -3
- package/esm/Form/Form.js +9 -11
- package/esm/Form/hooks/useFormRef.d.ts +0 -1
- package/esm/Form/hooks/useFormValidate.d.ts +0 -1
- package/esm/Form/hooks/useFormValidate.js +19 -19
- package/esm/Form/hooks/useFormValue.d.ts +0 -1
- 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 +1 -1
- package/esm/Timeline/Timeline.js +1 -4
- 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 +1 -1
- 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.js +18 -24
- 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/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 +4 -12
- 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
|
@@ -29,18 +29,17 @@ const PickerPopup = (0, _utils.forwardRef)((props, ref) => {
|
|
|
29
29
|
} = props;
|
|
30
30
|
const overlayRef = (0, _react.useRef)(null);
|
|
31
31
|
const handleResize = (0, _hooks.useEventCallback)(() => {
|
|
32
|
-
const instance = target
|
|
32
|
+
const instance = target?.current;
|
|
33
33
|
if (instance && placement && resizePlacement.includes(placement)) {
|
|
34
|
-
|
|
35
|
-
(_instance$updatePosit = instance.updatePosition) === null || _instance$updatePosit === void 0 || _instance$updatePosit.call(instance);
|
|
34
|
+
instance.updatePosition?.();
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
37
|
|
|
39
38
|
// Use useElementResize hook to listen for element size changes
|
|
40
39
|
(0, _hooks.useElementResize)((0, _react.useCallback)(() => overlayRef.current, []), handleResize);
|
|
41
40
|
(0, _react.useEffect)(() => {
|
|
42
|
-
const toggle = target
|
|
43
|
-
if (autoWidth && toggle
|
|
41
|
+
const toggle = target?.current;
|
|
42
|
+
if (autoWidth && toggle?.root) {
|
|
44
43
|
// Get the width of the button and set it to the menu to make them consistent
|
|
45
44
|
const width = (0, _getWidth.default)((0, _utils.getDOMNode)(toggle.root));
|
|
46
45
|
if (overlayRef.current) {
|
|
@@ -65,13 +65,12 @@ const PickerToggle = (0, _utils.forwardRef)((props, ref) => {
|
|
|
65
65
|
}, [inputValueProp]);
|
|
66
66
|
const classes = merge(className, withPrefix());
|
|
67
67
|
const handleClean = (0, _hooks.useEventCallback)(event => {
|
|
68
|
-
var _combobox$current;
|
|
69
68
|
event.stopPropagation();
|
|
70
|
-
onClean
|
|
71
|
-
|
|
69
|
+
onClean?.(event);
|
|
70
|
+
combobox.current?.focus();
|
|
72
71
|
});
|
|
73
72
|
const ToggleCaret = (0, _hooks.useToggleCaret)(placement);
|
|
74
|
-
const Caret = caretAs
|
|
73
|
+
const Caret = caretAs ?? ToggleCaret;
|
|
75
74
|
if (plaintext) {
|
|
76
75
|
return /*#__PURE__*/_react.default.createElement(_Plaintext.default, {
|
|
77
76
|
ref: ref,
|
|
@@ -41,7 +41,7 @@ const SelectedElement = props => {
|
|
|
41
41
|
key: item[valueKey]
|
|
42
42
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
43
43
|
className: prefix('value-item')
|
|
44
|
-
}, item[labelKey], checkAll && locale
|
|
44
|
+
}, item[labelKey], checkAll && locale?.checkAll ? ` (${locale.checkAll})` : ''), index === count - 1 ? null : /*#__PURE__*/_react.default.createElement("span", {
|
|
45
45
|
className: prefix('value-separator')
|
|
46
46
|
}, ","));
|
|
47
47
|
})), countable ? /*#__PURE__*/_react.default.createElement(_Badge.default, {
|
|
@@ -30,7 +30,7 @@ const useFocusItemValue = (defaultFocusItemValue, props) => {
|
|
|
30
30
|
callback,
|
|
31
31
|
// TODO-Doma This legacy behavior of using `.parent` property should be deprecated
|
|
32
32
|
// Always explicitly pass `getParent` when there's need to traverse upwards
|
|
33
|
-
getParent = item => item
|
|
33
|
+
getParent = item => item?.parent
|
|
34
34
|
} = props;
|
|
35
35
|
const [focusItemValue, setFocusItemValue] = (0, _react.useState)(defaultFocusItemValue);
|
|
36
36
|
const [layer, setLayer] = (0, _react.useState)(defaultLayer);
|
|
@@ -38,22 +38,22 @@ const useFocusItemValue = (defaultFocusItemValue, props) => {
|
|
|
38
38
|
const focusCallback = (0, _hooks.useEventCallback)((value, event) => {
|
|
39
39
|
if (focusToOption) {
|
|
40
40
|
const menu = (0, _isFunction.default)(target) ? target() : target;
|
|
41
|
-
const focusElement = menu
|
|
42
|
-
focusElement
|
|
41
|
+
const focusElement = menu?.querySelector(`[data-key="${value}"]`);
|
|
42
|
+
focusElement?.focus();
|
|
43
43
|
}
|
|
44
|
-
callback
|
|
44
|
+
callback?.(value, event);
|
|
45
45
|
});
|
|
46
46
|
const getScrollContainer = (0, _hooks.useEventCallback)(() => {
|
|
47
47
|
const menu = (0, _isFunction.default)(target) ? target() : target;
|
|
48
48
|
|
|
49
49
|
// For Cascader and MutiCascader
|
|
50
|
-
const subMenu = menu
|
|
50
|
+
const subMenu = menu?.querySelector(`[data-layer="${layer}"]`);
|
|
51
51
|
if (subMenu) {
|
|
52
52
|
return subMenu;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// For SelectPicker、CheckPicker、Autocomplete、InputPicker、TagPicker
|
|
56
|
-
return menu
|
|
56
|
+
return menu?.querySelector('[role="listbox"]');
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
/**
|
|
@@ -66,19 +66,11 @@ const useFocusItemValue = (defaultFocusItemValue, props) => {
|
|
|
66
66
|
let currentKeys = keys;
|
|
67
67
|
if (layer < 1) {
|
|
68
68
|
const popup = (0, _isFunction.default)(target) ? target() : target;
|
|
69
|
-
const rootMenu = popup
|
|
69
|
+
const rootMenu = popup?.querySelector('[data-layer="0"]');
|
|
70
70
|
if (rootMenu) {
|
|
71
|
-
|
|
72
|
-
currentKeys = Array.from((_rootMenu$querySelect = rootMenu.querySelectorAll(focusableQueryKey)) !== null && _rootMenu$querySelect !== void 0 ? _rootMenu$querySelect : []).map(item => {
|
|
73
|
-
var _item$dataset;
|
|
74
|
-
return (_item$dataset = item.dataset) === null || _item$dataset === void 0 ? void 0 : _item$dataset.key;
|
|
75
|
-
});
|
|
71
|
+
currentKeys = Array.from(rootMenu.querySelectorAll(focusableQueryKey) ?? []).map(item => item.dataset?.key);
|
|
76
72
|
} else {
|
|
77
|
-
|
|
78
|
-
currentKeys = Array.from((_popup$querySelectorA = popup === null || popup === void 0 ? void 0 : popup.querySelectorAll(focusableQueryKey)) !== null && _popup$querySelectorA !== void 0 ? _popup$querySelectorA : []).map(item => {
|
|
79
|
-
var _item$dataset2;
|
|
80
|
-
return (_item$dataset2 = item.dataset) === null || _item$dataset2 === void 0 ? void 0 : _item$dataset2.key;
|
|
81
|
-
});
|
|
73
|
+
currentKeys = Array.from(popup?.querySelectorAll(focusableQueryKey) ?? []).map(item => item.dataset?.key);
|
|
82
74
|
}
|
|
83
75
|
}
|
|
84
76
|
|
|
@@ -93,8 +85,7 @@ const useFocusItemValue = (defaultFocusItemValue, props) => {
|
|
|
93
85
|
const findFocusItemIndex = (0, _hooks.useEventCallback)(callback => {
|
|
94
86
|
const items = getFocusableMenuItems();
|
|
95
87
|
for (let i = 0; i < items.length; i += 1) {
|
|
96
|
-
|
|
97
|
-
if ((0, _utils.shallowEqual)(focusItemValue, (_items$i = items[i]) === null || _items$i === void 0 ? void 0 : _items$i[valueKey])) {
|
|
88
|
+
if ((0, _utils.shallowEqual)(focusItemValue, items[i]?.[valueKey])) {
|
|
98
89
|
callback(items, i);
|
|
99
90
|
return;
|
|
100
91
|
}
|
|
@@ -103,7 +94,7 @@ const useFocusItemValue = (defaultFocusItemValue, props) => {
|
|
|
103
94
|
});
|
|
104
95
|
const scrollListItem = (0, _hooks.useEventCallback)((direction, itemValue, willOverflow) => {
|
|
105
96
|
const container = getScrollContainer();
|
|
106
|
-
const item = container
|
|
97
|
+
const item = container?.querySelector(`[data-key="${itemValue}"]`);
|
|
107
98
|
if (willOverflow && container) {
|
|
108
99
|
const {
|
|
109
100
|
scrollHeight,
|
|
@@ -145,13 +136,9 @@ const useFocusItemValue = (defaultFocusItemValue, props) => {
|
|
|
145
136
|
});
|
|
146
137
|
const getSubMenuKeys = nextLayer => {
|
|
147
138
|
const menu = (0, _isFunction.default)(target) ? target() : target;
|
|
148
|
-
const subMenu = menu
|
|
139
|
+
const subMenu = menu?.querySelector(`[data-layer="${nextLayer}"]`);
|
|
149
140
|
if (subMenu) {
|
|
150
|
-
|
|
151
|
-
return (_Array$from = Array.from(subMenu.querySelectorAll(focusableQueryKey))) === null || _Array$from === void 0 ? void 0 : _Array$from.map(item => {
|
|
152
|
-
var _item$dataset3;
|
|
153
|
-
return (_item$dataset3 = item.dataset) === null || _item$dataset3 === void 0 ? void 0 : _item$dataset3.key;
|
|
154
|
-
});
|
|
141
|
+
return Array.from(subMenu.querySelectorAll(focusableQueryKey))?.map(item => item.dataset?.key);
|
|
155
142
|
}
|
|
156
143
|
return null;
|
|
157
144
|
};
|
|
@@ -169,11 +156,10 @@ const useFocusItemValue = (defaultFocusItemValue, props) => {
|
|
|
169
156
|
const nextLayer = layer - 1;
|
|
170
157
|
const nextKeys = getSubMenuKeys(nextLayer);
|
|
171
158
|
if (nextKeys) {
|
|
172
|
-
var _getParent;
|
|
173
159
|
setKeys(nextKeys);
|
|
174
160
|
setLayer(nextLayer);
|
|
175
161
|
const focusItem = (0, _utils2.findNodeOfTree)(data, item => item[valueKey] === focusItemValue);
|
|
176
|
-
const parentItemValue =
|
|
162
|
+
const parentItemValue = getParent(focusItem)?.[valueKey];
|
|
177
163
|
if (parentItemValue) {
|
|
178
164
|
setFocusItemValue(parentItemValue);
|
|
179
165
|
focusCallback(parentItemValue, event);
|
|
@@ -18,43 +18,37 @@ function usePickerRef(ref) {
|
|
|
18
18
|
const searchInput = (0, _react.useRef)(null);
|
|
19
19
|
const treeView = (0, _react.useRef)(null);
|
|
20
20
|
const handleOpen = (0, _hooks.useEventCallback)(() => {
|
|
21
|
-
|
|
22
|
-
trigger === null || trigger === void 0 || (_trigger$current = trigger.current) === null || _trigger$current === void 0 || _trigger$current.open();
|
|
21
|
+
trigger?.current?.open();
|
|
23
22
|
});
|
|
24
23
|
const handleClose = (0, _hooks.useEventCallback)(() => {
|
|
25
|
-
|
|
26
|
-
trigger === null || trigger === void 0 || (_trigger$current2 = trigger.current) === null || _trigger$current2 === void 0 || _trigger$current2.close();
|
|
24
|
+
trigger?.current?.close();
|
|
27
25
|
});
|
|
28
26
|
const handleUpdatePosition = (0, _hooks.useEventCallback)(() => {
|
|
29
|
-
|
|
30
|
-
trigger === null || trigger === void 0 || (_trigger$current3 = trigger.current) === null || _trigger$current3 === void 0 || _trigger$current3.updatePosition();
|
|
27
|
+
trigger?.current?.updatePosition();
|
|
31
28
|
});
|
|
32
29
|
(0, _react.useImperativeHandle)(ref, () => {
|
|
33
30
|
return {
|
|
34
31
|
get root() {
|
|
35
|
-
|
|
36
|
-
return (_ref = (root === null || root === void 0 ? void 0 : root.current) || (trigger === null || trigger === void 0 || (_trigger$current4 = trigger.current) === null || _trigger$current4 === void 0 ? void 0 : _trigger$current4.root)) !== null && _ref !== void 0 ? _ref : null;
|
|
32
|
+
return (root?.current || trigger?.current?.root) ?? null;
|
|
37
33
|
},
|
|
38
34
|
get overlay() {
|
|
39
|
-
|
|
40
|
-
if (!(overlay !== null && overlay !== void 0 && overlay.current)) {
|
|
35
|
+
if (!overlay?.current) {
|
|
41
36
|
throw new Error('The overlay is not found. Please confirm whether the picker is open.');
|
|
42
37
|
}
|
|
43
|
-
return
|
|
38
|
+
return overlay?.current ?? null;
|
|
44
39
|
},
|
|
45
40
|
get target() {
|
|
46
|
-
|
|
47
|
-
return (_target$current = target === null || target === void 0 ? void 0 : target.current) !== null && _target$current !== void 0 ? _target$current : null;
|
|
41
|
+
return target?.current ?? null;
|
|
48
42
|
},
|
|
49
43
|
get list() {
|
|
50
|
-
if (!
|
|
44
|
+
if (!list?.current) {
|
|
51
45
|
throw new Error(`
|
|
52
46
|
The list is not found.
|
|
53
47
|
1.Please set virtualized for the component.
|
|
54
48
|
2.Please confirm whether the picker is open.
|
|
55
49
|
`);
|
|
56
50
|
}
|
|
57
|
-
return list
|
|
51
|
+
return list?.current;
|
|
58
52
|
},
|
|
59
53
|
type: _symbols.RSUITE_PICKER_TYPE,
|
|
60
54
|
updatePosition: handleUpdatePosition,
|
|
@@ -28,7 +28,7 @@ function useSearch(data, props) {
|
|
|
28
28
|
* @param {node} label
|
|
29
29
|
*/
|
|
30
30
|
const checkShouldDisplay = (0, _react.useCallback)((item, keyword) => {
|
|
31
|
-
const checkValue = typeof item === 'object' ? item
|
|
31
|
+
const checkValue = typeof item === 'object' ? item?.[labelKey] : String(item);
|
|
32
32
|
const _keyword = (0, _isUndefined.default)(keyword) ? searchKeyword : keyword;
|
|
33
33
|
if (typeof searchBy === 'function') {
|
|
34
34
|
return searchBy(_keyword, checkValue, item);
|
|
@@ -41,7 +41,7 @@ function useSearch(data, props) {
|
|
|
41
41
|
const handleSearch = (searchKeyword, event) => {
|
|
42
42
|
const filteredData = data.filter(item => checkShouldDisplay(item, searchKeyword));
|
|
43
43
|
setSearchKeyword(searchKeyword);
|
|
44
|
-
callback
|
|
44
|
+
callback?.(searchKeyword, filteredData, event);
|
|
45
45
|
};
|
|
46
46
|
return {
|
|
47
47
|
searchKeyword,
|
|
@@ -27,15 +27,13 @@ const useToggleKeyDownEvent = props => {
|
|
|
27
27
|
onMenuPressBackspace
|
|
28
28
|
} = props;
|
|
29
29
|
const handleClose = (0, _hooks.useEventCallback)(() => {
|
|
30
|
-
|
|
31
|
-
(_trigger$current = trigger.current) === null || _trigger$current === void 0 || (_trigger$current$clos = _trigger$current.close) === null || _trigger$current$clos === void 0 || _trigger$current$clos.call(_trigger$current);
|
|
30
|
+
trigger.current?.close?.();
|
|
32
31
|
|
|
33
32
|
// The focus is on the trigger button after closing
|
|
34
|
-
|
|
33
|
+
trigger.current?.focus?.();
|
|
35
34
|
});
|
|
36
35
|
const handleOpen = (0, _hooks.useEventCallback)(() => {
|
|
37
|
-
|
|
38
|
-
(_trigger$current3 = trigger.current) === null || _trigger$current3 === void 0 || (_trigger$current3$ope = _trigger$current3.open) === null || _trigger$current3$ope === void 0 || _trigger$current3$ope.call(_trigger$current3);
|
|
36
|
+
trigger.current?.open?.();
|
|
39
37
|
});
|
|
40
38
|
const handleToggleDropdown = (0, _hooks.useEventCallback)(() => {
|
|
41
39
|
if (active) {
|
|
@@ -49,7 +47,7 @@ const useToggleKeyDownEvent = props => {
|
|
|
49
47
|
if (readOnly || disabled || loading) {
|
|
50
48
|
return;
|
|
51
49
|
}
|
|
52
|
-
if (event.target ===
|
|
50
|
+
if (event.target === target?.current) {
|
|
53
51
|
// enter
|
|
54
52
|
if (toggle && event.key === _constants.KEY_VALUES.ENTER) {
|
|
55
53
|
handleToggleDropdown();
|
|
@@ -57,32 +55,30 @@ const useToggleKeyDownEvent = props => {
|
|
|
57
55
|
|
|
58
56
|
// delete
|
|
59
57
|
if (event.key === _constants.KEY_VALUES.BACKSPACE) {
|
|
60
|
-
onExit
|
|
58
|
+
onExit?.(event);
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
|
-
if (overlay
|
|
61
|
+
if (overlay?.current) {
|
|
64
62
|
// The keyboard operation callback on the menu.
|
|
65
|
-
onMenuKeyDown
|
|
63
|
+
onMenuKeyDown?.(event);
|
|
66
64
|
if (event.key === _constants.KEY_VALUES.ENTER) {
|
|
67
|
-
onMenuPressEnter
|
|
65
|
+
onMenuPressEnter?.(event);
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
69
|
* There is no callback when typing the Backspace key in the search box.
|
|
72
70
|
* The default is to remove search keywords
|
|
73
71
|
*/
|
|
74
|
-
if (event.key === _constants.KEY_VALUES.BACKSPACE && event.target !==
|
|
75
|
-
onMenuPressBackspace
|
|
72
|
+
if (event.key === _constants.KEY_VALUES.BACKSPACE && event.target !== searchInput?.current) {
|
|
73
|
+
onMenuPressBackspace?.(event);
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
// The search box gets focus when typing characters and numbers.
|
|
79
77
|
if (event.key.length === 1 && /\w/.test(event.key)) {
|
|
80
|
-
var _event$target;
|
|
81
78
|
// Exclude Input
|
|
82
79
|
// eg: <SelectPicker renderExtraFooter={() => <Input />} />
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
searchInput === null || searchInput === void 0 || (_searchInput$current = searchInput.current) === null || _searchInput$current === void 0 || _searchInput$current.focus();
|
|
80
|
+
if (event.target?.tagName !== 'INPUT') {
|
|
81
|
+
searchInput?.current?.focus();
|
|
86
82
|
}
|
|
87
83
|
}
|
|
88
84
|
}
|
|
@@ -91,7 +87,7 @@ const useToggleKeyDownEvent = props => {
|
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
// Native event callback
|
|
94
|
-
onKeyDown
|
|
90
|
+
onKeyDown?.(event);
|
|
95
91
|
});
|
|
96
92
|
return onToggle;
|
|
97
93
|
};
|
|
@@ -61,44 +61,44 @@ function onMenuKeyDown(event, events) {
|
|
|
61
61
|
switch (event.key) {
|
|
62
62
|
// down
|
|
63
63
|
case _constants.KEY_VALUES.DOWN:
|
|
64
|
-
down
|
|
64
|
+
down?.(event);
|
|
65
65
|
event.preventDefault();
|
|
66
66
|
break;
|
|
67
67
|
// up
|
|
68
68
|
case _constants.KEY_VALUES.UP:
|
|
69
|
-
up
|
|
69
|
+
up?.(event);
|
|
70
70
|
event.preventDefault();
|
|
71
71
|
break;
|
|
72
72
|
// enter
|
|
73
73
|
case _constants.KEY_VALUES.ENTER:
|
|
74
|
-
enter
|
|
74
|
+
enter?.(event);
|
|
75
75
|
event.preventDefault();
|
|
76
76
|
break;
|
|
77
77
|
// delete
|
|
78
78
|
case _constants.KEY_VALUES.BACKSPACE:
|
|
79
|
-
del
|
|
79
|
+
del?.(event);
|
|
80
80
|
break;
|
|
81
81
|
// esc | tab
|
|
82
82
|
case _constants.KEY_VALUES.ESC:
|
|
83
83
|
case _constants.KEY_VALUES.TAB:
|
|
84
|
-
esc
|
|
84
|
+
esc?.(event);
|
|
85
85
|
break;
|
|
86
86
|
// left arrow
|
|
87
87
|
case _constants.KEY_VALUES.LEFT:
|
|
88
|
-
left
|
|
88
|
+
left?.(event);
|
|
89
89
|
break;
|
|
90
90
|
// right arrow
|
|
91
91
|
case _constants.KEY_VALUES.RIGHT:
|
|
92
|
-
right
|
|
92
|
+
right?.(event);
|
|
93
93
|
break;
|
|
94
94
|
// home
|
|
95
95
|
case _constants.KEY_VALUES.HOME:
|
|
96
|
-
home
|
|
96
|
+
home?.(event);
|
|
97
97
|
event.preventDefault();
|
|
98
98
|
break;
|
|
99
99
|
// end
|
|
100
100
|
case _constants.KEY_VALUES.END:
|
|
101
|
-
end
|
|
101
|
+
end?.(event);
|
|
102
102
|
event.preventDefault();
|
|
103
103
|
break;
|
|
104
104
|
default:
|
|
@@ -59,16 +59,15 @@ const Ripple = (0, _utils.forwardRef)((props, ref) => {
|
|
|
59
59
|
const position = getPosition(triggerRef.current, event);
|
|
60
60
|
setRippling(true);
|
|
61
61
|
setPosition(position);
|
|
62
|
-
onMouseDown
|
|
62
|
+
onMouseDown?.(position, event);
|
|
63
63
|
}
|
|
64
64
|
}, [onMouseDown]);
|
|
65
65
|
(0, _react.useEffect)(() => {
|
|
66
|
-
|
|
67
|
-
const parentNode = (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.parentNode;
|
|
66
|
+
const parentNode = triggerRef.current?.parentNode;
|
|
68
67
|
if (parentNode) {
|
|
69
68
|
const mousedownListener = (0, _on.default)(parentNode, 'mousedown', handleMouseDown);
|
|
70
69
|
return () => {
|
|
71
|
-
mousedownListener
|
|
70
|
+
mousedownListener?.off();
|
|
72
71
|
};
|
|
73
72
|
}
|
|
74
73
|
}, [handleMouseDown]);
|
|
@@ -37,7 +37,7 @@ const SafeAnchor = (0, _utils.forwardRef)((props, ref) => {
|
|
|
37
37
|
event.stopPropagation();
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
onClick
|
|
40
|
+
onClick?.(event);
|
|
41
41
|
}, [disabled, href, onClick]);
|
|
42
42
|
|
|
43
43
|
// There are default role and href attributes on the node to ensure Focus management and keyboard interactions.
|
|
@@ -31,7 +31,7 @@ function useScrollState(scrollShadow) {
|
|
|
31
31
|
|
|
32
32
|
// Listen for changes in scrollHeight
|
|
33
33
|
observer = new MutationObserver(() => {
|
|
34
|
-
const newScrollHeight = target
|
|
34
|
+
const newScrollHeight = target?.scrollHeight;
|
|
35
35
|
if (newScrollHeight && newScrollHeight !== lastScrollHeight) {
|
|
36
36
|
setScrollState(getScrollState(target));
|
|
37
37
|
lastScrollHeight = newScrollHeight;
|
|
@@ -44,8 +44,7 @@ function useScrollState(scrollShadow) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
return () => {
|
|
47
|
-
|
|
48
|
-
(_observer = observer) === null || _observer === void 0 || _observer.disconnect();
|
|
47
|
+
observer?.disconnect();
|
|
49
48
|
};
|
|
50
49
|
});
|
|
51
50
|
const handleScroll = (0, _hooks.useEventCallback)(event => {
|
|
@@ -38,10 +38,10 @@ export declare const useTreeContextProps: () => {
|
|
|
38
38
|
labelKey: string;
|
|
39
39
|
valueKey: string;
|
|
40
40
|
childrenKey: string;
|
|
41
|
-
virtualized?: boolean
|
|
42
|
-
scrollShadow?: boolean
|
|
43
|
-
renderTreeNode?: (
|
|
44
|
-
renderTreeIcon?: (
|
|
41
|
+
virtualized?: boolean;
|
|
42
|
+
scrollShadow?: boolean;
|
|
43
|
+
renderTreeNode?: (nodeData: TreeNode) => React.ReactNode;
|
|
44
|
+
renderTreeIcon?: (nodeData: TreeNode, expanded?: boolean) => React.ReactNode;
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* Custom hook that provides imperative handle for the Tree component.
|
|
@@ -76,14 +76,8 @@ const useTreeImperativeHandle = () => {
|
|
|
76
76
|
}, []);
|
|
77
77
|
return {
|
|
78
78
|
register,
|
|
79
|
-
focusFirstNode: () =>
|
|
80
|
-
|
|
81
|
-
return (_focusFirstNodeRef$cu = focusFirstNodeRef.current) === null || _focusFirstNodeRef$cu === void 0 ? void 0 : _focusFirstNodeRef$cu.call(focusFirstNodeRef);
|
|
82
|
-
},
|
|
83
|
-
focusActiveNode: () => {
|
|
84
|
-
var _focusActiveNodeRef$c;
|
|
85
|
-
return (_focusActiveNodeRef$c = focusActiveNodeRef.current) === null || _focusActiveNodeRef$c === void 0 ? void 0 : _focusActiveNodeRef$c.call(focusActiveNodeRef);
|
|
86
|
-
}
|
|
79
|
+
focusFirstNode: () => focusFirstNodeRef.current?.(),
|
|
80
|
+
focusActiveNode: () => focusActiveNodeRef.current?.()
|
|
87
81
|
};
|
|
88
82
|
};
|
|
89
83
|
exports.useTreeImperativeHandle = useTreeImperativeHandle;
|
|
@@ -31,8 +31,7 @@ const AutoSizer = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
31
31
|
const [width, setWidth] = (0, _react.useState)(defaultWidth || 0);
|
|
32
32
|
const rootRef = (0, _react.useRef)(null);
|
|
33
33
|
const getParentNode = (0, _react.useCallback)(() => {
|
|
34
|
-
|
|
35
|
-
if ((_rootRef$current = rootRef.current) !== null && _rootRef$current !== void 0 && _rootRef$current.parentNode && rootRef.current.parentNode.ownerDocument && rootRef.current.parentNode.ownerDocument.defaultView && rootRef.current.parentNode instanceof rootRef.current.parentNode.ownerDocument.defaultView.HTMLElement) {
|
|
34
|
+
if (rootRef.current?.parentNode && rootRef.current.parentNode.ownerDocument && rootRef.current.parentNode.ownerDocument.defaultView && rootRef.current.parentNode instanceof rootRef.current.parentNode.ownerDocument.defaultView.HTMLElement) {
|
|
36
35
|
return rootRef.current.parentNode;
|
|
37
36
|
}
|
|
38
37
|
return null;
|
|
@@ -52,7 +51,7 @@ const AutoSizer = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
52
51
|
if (!disableHeight && height !== newHeight || !disableWidth && width !== newWidth) {
|
|
53
52
|
setHeight(offsetHeight - paddingTop - paddingBottom);
|
|
54
53
|
setWidth(offsetWidth - paddingLeft - paddingRight);
|
|
55
|
-
onResize
|
|
54
|
+
onResize?.({
|
|
56
55
|
height: offsetHeight,
|
|
57
56
|
width: offsetWidth
|
|
58
57
|
});
|
|
@@ -39,20 +39,16 @@ const List = (0, _utils.forwardRef)((props, ref) => {
|
|
|
39
39
|
} = (0, _hooks.useCustom)();
|
|
40
40
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
41
41
|
resetAfterIndex: (index, shouldForceUpdate) => {
|
|
42
|
-
|
|
43
|
-
(_listRef$current = listRef.current) === null || _listRef$current === void 0 || (_listRef$current$rese = _listRef$current.resetAfterIndex) === null || _listRef$current$rese === void 0 || _listRef$current$rese.call(_listRef$current, index, shouldForceUpdate);
|
|
42
|
+
listRef.current?.resetAfterIndex?.(index, shouldForceUpdate);
|
|
44
43
|
},
|
|
45
44
|
scrollTo: scrollOffset => {
|
|
46
|
-
|
|
47
|
-
(_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 || (_listRef$current2$scr = _listRef$current2.scrollTo) === null || _listRef$current2$scr === void 0 || _listRef$current2$scr.call(_listRef$current2, scrollOffset);
|
|
45
|
+
listRef.current?.scrollTo?.(scrollOffset);
|
|
48
46
|
},
|
|
49
47
|
scrollToItem: (index, align) => {
|
|
50
|
-
|
|
51
|
-
(_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 || (_listRef$current3$scr = _listRef$current3.scrollToItem) === null || _listRef$current3$scr === void 0 || _listRef$current3$scr.call(_listRef$current3, index, align);
|
|
48
|
+
listRef.current?.scrollToItem?.(index, align);
|
|
52
49
|
},
|
|
53
50
|
scrollToRow: index => {
|
|
54
|
-
|
|
55
|
-
(_listRef$current4 = listRef.current) === null || _listRef$current4 === void 0 || (_listRef$current4$scr = _listRef$current4.scrollToItem) === null || _listRef$current4$scr === void 0 || _listRef$current4$scr.call(_listRef$current4, index);
|
|
51
|
+
listRef.current?.scrollToItem?.(index);
|
|
56
52
|
}
|
|
57
53
|
}));
|
|
58
54
|
const setRowHeight = (0, _react.useCallback)(index => {
|
|
@@ -19,8 +19,8 @@ export type CheckStateType = CHECK_STATE.UNCHECK | CHECK_STATE.CHECK | CHECK_STA
|
|
|
19
19
|
* Tree Node Drag Type
|
|
20
20
|
*/
|
|
21
21
|
export declare enum TREE_NODE_DROP_POSITION {
|
|
22
|
-
DRAG_OVER = 0
|
|
23
|
-
DRAG_OVER_TOP = 1
|
|
22
|
+
DRAG_OVER = 0,// drag node in tree node
|
|
23
|
+
DRAG_OVER_TOP = 1,// drag node on tree node
|
|
24
24
|
DRAG_OVER_BOTTOM = 2
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -19,10 +19,8 @@ function useClickOutside({
|
|
|
19
19
|
(0, _react.useEffect)(() => {
|
|
20
20
|
if (enabled) {
|
|
21
21
|
const eventHandler = event => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _handleRef$current;
|
|
25
|
-
(_handleRef$current = handleRef.current) === null || _handleRef$current === void 0 || _handleRef$current.call(handleRef, event);
|
|
22
|
+
if (isOutsideRef.current?.(event)) {
|
|
23
|
+
handleRef.current?.(event);
|
|
26
24
|
}
|
|
27
25
|
};
|
|
28
26
|
window.addEventListener('mousedown', eventHandler);
|
|
@@ -44,7 +44,6 @@ function getComponentLocaleKey(componentName) {
|
|
|
44
44
|
* @param componentProps - The props of the component
|
|
45
45
|
*/
|
|
46
46
|
function useCustom(componentName, componentProps) {
|
|
47
|
-
var _globalLocale$DateTim;
|
|
48
47
|
const {
|
|
49
48
|
components = {},
|
|
50
49
|
locale: globalLocale = _en_GB.default,
|
|
@@ -59,26 +58,25 @@ function useCustom(componentName, componentProps) {
|
|
|
59
58
|
locale: componentLocale,
|
|
60
59
|
...restProps
|
|
61
60
|
} = componentProps || {};
|
|
62
|
-
const dateLocale = globalLocale
|
|
63
|
-
const code = globalLocale
|
|
61
|
+
const dateLocale = globalLocale?.DateTimeFormats?.dateLocale;
|
|
62
|
+
const code = globalLocale?.code;
|
|
64
63
|
const getLocale = (0, _react.useCallback)((key, overrideLocale) => {
|
|
65
64
|
// Initialize with common locale
|
|
66
|
-
const publicLocale =
|
|
65
|
+
const publicLocale = globalLocale?.common || {};
|
|
67
66
|
|
|
68
67
|
// Merge component-specific locale(s) based on key type
|
|
69
|
-
const specificLocale = typeof key === 'string' ? globalLocale
|
|
68
|
+
const specificLocale = typeof key === 'string' ? globalLocale?.[key] : Array.isArray(key) ? (0, _assign.default)({}, ...key.map(k => globalLocale?.[k])) : {};
|
|
70
69
|
|
|
71
70
|
// Merge all parts: public locale, specific locale, custom component locale
|
|
72
71
|
return (0, _assign.default)({}, publicLocale, specificLocale, componentLocale, overrideLocale);
|
|
73
72
|
}, [globalLocale, componentLocale]);
|
|
74
73
|
const propsWithDefaults = (0, _react.useMemo)(() => {
|
|
75
|
-
var _components$component;
|
|
76
74
|
if (!componentName) {
|
|
77
75
|
return;
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
//Memoize the global default props based on component name
|
|
81
|
-
const globalDefaultProps =
|
|
79
|
+
const globalDefaultProps = components[componentName]?.defaultProps || {};
|
|
82
80
|
const mergedProps = (0, _assign.default)({}, globalDefaultProps, restProps);
|
|
83
81
|
const localeKey = getComponentLocaleKey(componentName);
|
|
84
82
|
|
|
@@ -22,8 +22,7 @@ function useEventCallback(fn) {
|
|
|
22
22
|
ref.current = fn;
|
|
23
23
|
});
|
|
24
24
|
return (0, _react.useCallback)((...args) => {
|
|
25
|
-
|
|
26
|
-
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.call(ref, ...args);
|
|
25
|
+
return ref.current?.(...args);
|
|
27
26
|
}, []);
|
|
28
27
|
}
|
|
29
28
|
var _default = exports.default = useEventCallback;
|