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
|
@@ -37,7 +37,6 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
37
37
|
* @see https://rsuitejs.com/components/date-range-picker
|
|
38
38
|
*/
|
|
39
39
|
const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
40
|
-
var _ref, _ref2;
|
|
41
40
|
const {
|
|
42
41
|
formatDate,
|
|
43
42
|
propsWithDefaults
|
|
@@ -112,9 +111,9 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
112
111
|
merge,
|
|
113
112
|
prefix
|
|
114
113
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
115
|
-
const formatStr = format ||
|
|
114
|
+
const formatStr = format || locale?.shortDateFormat || 'yyyy-MM-dd';
|
|
116
115
|
const rangeFormatStr = `${formatStr}${character}${formatStr}`;
|
|
117
|
-
const [value, setValue] = (0, _hooks.useControlled)(valueProp, defaultValue
|
|
116
|
+
const [value, setValue] = (0, _hooks.useControlled)(valueProp, defaultValue ?? null);
|
|
118
117
|
const {
|
|
119
118
|
mode,
|
|
120
119
|
has
|
|
@@ -148,14 +147,14 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
148
147
|
* the second click to determine the end date of the date range.
|
|
149
148
|
*
|
|
150
149
|
*/
|
|
151
|
-
const [selectedDates, setSelectedDates] = (0, _react.useState)(
|
|
150
|
+
const [selectedDates, setSelectedDates] = (0, _react.useState)(valueProp ?? defaultValue ?? []);
|
|
152
151
|
|
|
153
152
|
// The date of the current hover, used to reduce the calculation of `handleMouseMove`
|
|
154
153
|
const [hoverDateRange, setHoverDateRange] = (0, _react.useState)(value);
|
|
155
154
|
|
|
156
155
|
// The displayed calendar panel is rendered based on this value.
|
|
157
156
|
const [calendarDateRange, setCalendarDateRangeValue] = (0, _react.useState)((0, _utils.getSafeCalendarDate)({
|
|
158
|
-
value:
|
|
157
|
+
value: value ?? defaultCalendarValue ?? null,
|
|
159
158
|
allowSameMonth
|
|
160
159
|
}));
|
|
161
160
|
|
|
@@ -178,7 +177,7 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
178
177
|
*/
|
|
179
178
|
const getCalendarDatetime = calendarKey => {
|
|
180
179
|
const index = calendarKey === 'start' ? 0 : 1;
|
|
181
|
-
return
|
|
180
|
+
return calendarDateRange?.[index] || defaultCalendarValue?.[index];
|
|
182
181
|
};
|
|
183
182
|
|
|
184
183
|
/**
|
|
@@ -193,7 +192,7 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
193
192
|
let nextValue = dateRange;
|
|
194
193
|
|
|
195
194
|
// The time should remain the same when the dates in the date range are changed.
|
|
196
|
-
if (has('time') && dateRange
|
|
195
|
+
if (has('time') && dateRange?.length && (eventName === 'changeDate' || eventName === 'changeMonth')) {
|
|
197
196
|
const startDate = (0, _date.copyTime)({
|
|
198
197
|
from: getCalendarDatetime('start'),
|
|
199
198
|
to: dateRange[0]
|
|
@@ -219,8 +218,8 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
219
218
|
};
|
|
220
219
|
(0, _react.useEffect)(() => {
|
|
221
220
|
// If value changes, update the selected and hover date values on the calendar panel.
|
|
222
|
-
setSelectedDates(valueProp
|
|
223
|
-
setHoverDateRange(valueProp
|
|
221
|
+
setSelectedDates(valueProp ?? []);
|
|
222
|
+
setHoverDateRange(valueProp ?? null);
|
|
224
223
|
}, [valueProp]);
|
|
225
224
|
const getInputHtmlSize = () => {
|
|
226
225
|
const padding = 4;
|
|
@@ -241,7 +240,7 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
241
240
|
return date => (0, _utils.getWeekHoverRange)(date, {
|
|
242
241
|
isoWeek,
|
|
243
242
|
weekStart,
|
|
244
|
-
locale: locale
|
|
243
|
+
locale: locale?.dateLocale
|
|
245
244
|
});
|
|
246
245
|
} else if (hoverRange === 'month') {
|
|
247
246
|
return _utils.getMonthHoverRange;
|
|
@@ -264,10 +263,10 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
264
263
|
};
|
|
265
264
|
const setDateRange = (event, nextValue, closeOverlay = true) => {
|
|
266
265
|
// If nextValue is null, it means that the user is erasing the selected dates.
|
|
267
|
-
setSelectedDates(nextValue
|
|
266
|
+
setSelectedDates(nextValue ?? []);
|
|
268
267
|
setValue(nextValue);
|
|
269
268
|
if (!(0, _utils.isSameRange)(nextValue, value, formatStr)) {
|
|
270
|
-
onChange
|
|
269
|
+
onChange?.(nextValue, event);
|
|
271
270
|
}
|
|
272
271
|
|
|
273
272
|
// `closeOverlay` default value is `true`
|
|
@@ -309,14 +308,14 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
309
308
|
*/
|
|
310
309
|
const handleSelectDate = (0, _hooks.useEventCallback)((index, date, event) => {
|
|
311
310
|
const calendarKey = index === 0 ? 'start' : 'end';
|
|
312
|
-
let nextSelectDates = hoverDateRange
|
|
311
|
+
let nextSelectDates = hoverDateRange ?? [];
|
|
313
312
|
const hoverRangeValue = getHoverRangeValue(date);
|
|
314
313
|
const noHoverRangeValid = (0, _isNil.default)(hoverRangeValue);
|
|
315
314
|
|
|
316
315
|
// in `oneTap` mode
|
|
317
316
|
if (oneTap) {
|
|
318
317
|
setDateRange(event, noHoverRangeValid ? [(0, _date.startOfDay)(date), (0, _date.endOfDay)(date)] : hoverRangeValue);
|
|
319
|
-
onSelect
|
|
318
|
+
onSelect?.(date, event);
|
|
320
319
|
return;
|
|
321
320
|
}
|
|
322
321
|
|
|
@@ -369,7 +368,7 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
369
368
|
eventName: 'changeDate'
|
|
370
369
|
});
|
|
371
370
|
}
|
|
372
|
-
onSelect
|
|
371
|
+
onSelect?.(date, event);
|
|
373
372
|
setSelectedIdle(!isSelectedIdle);
|
|
374
373
|
});
|
|
375
374
|
|
|
@@ -427,11 +426,11 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
427
426
|
} else {
|
|
428
427
|
// Reset the date on the calendar to the default date
|
|
429
428
|
nextCalendarDate = (0, _utils.getSafeCalendarDate)({
|
|
430
|
-
value: defaultCalendarValue
|
|
429
|
+
value: defaultCalendarValue ?? null,
|
|
431
430
|
allowSameMonth
|
|
432
431
|
});
|
|
433
432
|
}
|
|
434
|
-
setSelectedDates(value
|
|
433
|
+
setSelectedDates(value ?? []);
|
|
435
434
|
setCalendarDateRange({
|
|
436
435
|
dateRange: nextCalendarDate
|
|
437
436
|
});
|
|
@@ -452,9 +451,9 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
452
451
|
if (closeOverlay) {
|
|
453
452
|
setDateRange(event, value, closeOverlay);
|
|
454
453
|
} else {
|
|
455
|
-
setSelectedDates(value
|
|
454
|
+
setSelectedDates(value ?? []);
|
|
456
455
|
}
|
|
457
|
-
onShortcutClick
|
|
456
|
+
onShortcutClick?.(range, event);
|
|
458
457
|
|
|
459
458
|
// End unfinished selections.
|
|
460
459
|
setSelectedIdle(true);
|
|
@@ -469,14 +468,14 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
469
468
|
const handleClickOK = (0, _hooks.useEventCallback)(event => {
|
|
470
469
|
const nextValue = calculateDateRange();
|
|
471
470
|
setDateRange(event, nextValue);
|
|
472
|
-
onOk
|
|
471
|
+
onOk?.(nextValue, event);
|
|
473
472
|
});
|
|
474
473
|
const handleClean = (0, _hooks.useEventCallback)(event => {
|
|
475
474
|
setCalendarDateRange({
|
|
476
475
|
dateRange: null
|
|
477
476
|
});
|
|
478
477
|
setDateRange(event, null);
|
|
479
|
-
onClean
|
|
478
|
+
onClean?.(event);
|
|
480
479
|
event.stopPropagation();
|
|
481
480
|
});
|
|
482
481
|
|
|
@@ -565,20 +564,17 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
565
564
|
return isRangeDisabled(startDate, endDate, _constants.DATERANGE_DISABLED_TARGET.TOOLBAR_SHORTCUT);
|
|
566
565
|
};
|
|
567
566
|
const handleClose = (0, _hooks.useEventCallback)(() => {
|
|
568
|
-
|
|
569
|
-
(_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);
|
|
567
|
+
trigger.current?.close?.();
|
|
570
568
|
});
|
|
571
569
|
const handleInputKeyDown = (0, _hooks.useEventCallback)(event => {
|
|
572
570
|
(0, _Picker.onMenuKeyDown)(event, {
|
|
573
571
|
esc: handleClose,
|
|
574
572
|
enter: () => {
|
|
575
|
-
var _trigger$current2;
|
|
576
573
|
const {
|
|
577
574
|
open
|
|
578
|
-
} =
|
|
575
|
+
} = trigger.current?.getState() || {};
|
|
579
576
|
if (!open) {
|
|
580
|
-
|
|
581
|
-
(_trigger$current3 = trigger.current) === null || _trigger$current3 === void 0 || _trigger$current3.open();
|
|
577
|
+
trigger.current?.open();
|
|
582
578
|
}
|
|
583
579
|
}
|
|
584
580
|
});
|
|
@@ -619,7 +615,7 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
619
615
|
format: formatStr,
|
|
620
616
|
value: selectedDates,
|
|
621
617
|
monthDropdownProps,
|
|
622
|
-
hoverRangeValue: hoverDateRange
|
|
618
|
+
hoverRangeValue: hoverDateRange ?? undefined,
|
|
623
619
|
hideHours,
|
|
624
620
|
hideMinutes,
|
|
625
621
|
hideSeconds,
|
|
@@ -730,7 +726,7 @@ const DateRangePicker = (0, _utils3.forwardRef)((props, ref) => {
|
|
|
730
726
|
selectedDone: isSelectedIdle,
|
|
731
727
|
target: _constants.DATERANGE_DISABLED_TARGET.INPUT
|
|
732
728
|
};
|
|
733
|
-
if (isDateDisabled
|
|
729
|
+
if (isDateDisabled?.(startDate, disabledOptions) || isDateDisabled?.(endDate, disabledOptions)) {
|
|
734
730
|
return true;
|
|
735
731
|
}
|
|
736
732
|
return false;
|
|
@@ -21,7 +21,7 @@ function Header(props) {
|
|
|
21
21
|
clickable,
|
|
22
22
|
onSelect
|
|
23
23
|
} = props;
|
|
24
|
-
const [startDate, endDate] = value
|
|
24
|
+
const [startDate, endDate] = value ?? [null, null];
|
|
25
25
|
const v = startDate && endDate ? [startDate, endDate].sort(_date.compareAsc) : [startDate, endDate];
|
|
26
26
|
const start = v[0] ? /*#__PURE__*/_react.default.createElement(_FormattedDate.FormattedDate, {
|
|
27
27
|
date: v[0],
|
|
@@ -40,7 +40,7 @@ function Header(props) {
|
|
|
40
40
|
size: "xs",
|
|
41
41
|
appearance: "subtle",
|
|
42
42
|
className: prefix('header-date'),
|
|
43
|
-
onClick: () => onSelect
|
|
43
|
+
onClick: () => onSelect?.('start'),
|
|
44
44
|
"aria-label": "Select start date"
|
|
45
45
|
}, start), /*#__PURE__*/_react.default.createElement("span", {
|
|
46
46
|
className: prefix('header-character')
|
|
@@ -48,7 +48,7 @@ function Header(props) {
|
|
|
48
48
|
size: "xs",
|
|
49
49
|
appearance: "subtle",
|
|
50
50
|
className: prefix('header-date'),
|
|
51
|
-
onClick: () => onSelect
|
|
51
|
+
onClick: () => onSelect?.('end'),
|
|
52
52
|
"aria-label": "Select end date"
|
|
53
53
|
}, end)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
54
54
|
className: prefix('header-date')
|
|
@@ -27,7 +27,7 @@ function allowedMaxDays(days) {
|
|
|
27
27
|
return (date, selectValue, selectedDone, target) => {
|
|
28
28
|
let beforeLimit = false;
|
|
29
29
|
let afterLimit = false;
|
|
30
|
-
if (selectValue
|
|
30
|
+
if (selectValue?.[0]) {
|
|
31
31
|
const startDate = selectValue[0];
|
|
32
32
|
beforeLimit = (0, _utils.composeFunctions)(f => DateUtils.addDays(f, -days + 1), f => isAfterDay(f, date))(startDate);
|
|
33
33
|
afterLimit = (0, _utils.composeFunctions)(f => DateUtils.addDays(f, days - 1), f => isBeforeDay(f, date))(startDate);
|
|
@@ -46,7 +46,7 @@ function allowedDays(days) {
|
|
|
46
46
|
return (date, selectValue, selectedDone, target) => {
|
|
47
47
|
let beforeLimit = false;
|
|
48
48
|
let afterLimit = false;
|
|
49
|
-
if (selectValue
|
|
49
|
+
if (selectValue?.[0]) {
|
|
50
50
|
const startDate = selectValue[0];
|
|
51
51
|
beforeLimit = (0, _utils.composeFunctions)(f => DateUtils.addDays(f, -days + 1), f => !DateUtils.isSameDay(f, date))(startDate);
|
|
52
52
|
afterLimit = (0, _utils.composeFunctions)(f => DateUtils.addDays(f, days - 1), f => !DateUtils.isSameDay(f, date))(startDate);
|
|
@@ -16,19 +16,19 @@ function useCalendarHandlers({
|
|
|
16
16
|
}) {
|
|
17
17
|
const calendarDate = (0, _react.useMemo)(() => calendarDateRange[index], [calendarDateRange, index]);
|
|
18
18
|
const handleSelect = (0, _hooks.useEventCallback)((date, event) => {
|
|
19
|
-
onSelect
|
|
19
|
+
onSelect?.(index, date, event);
|
|
20
20
|
});
|
|
21
21
|
const handleChangeMonth = (0, _hooks.useEventCallback)(nextPageDate => {
|
|
22
|
-
onChangeCalendarMonth
|
|
22
|
+
onChangeCalendarMonth?.(index, nextPageDate);
|
|
23
23
|
});
|
|
24
24
|
const handleChangeTime = (0, _hooks.useEventCallback)(nextPageDate => {
|
|
25
|
-
onChangeCalendarTime
|
|
25
|
+
onChangeCalendarTime?.(index, nextPageDate);
|
|
26
26
|
});
|
|
27
27
|
const handleMoveForward = (0, _hooks.useEventCallback)(() => {
|
|
28
|
-
onChangeCalendarMonth
|
|
28
|
+
onChangeCalendarMonth?.(index, (0, _date.addMonths)(calendarDate, 1));
|
|
29
29
|
});
|
|
30
30
|
const handleMoveBackward = (0, _hooks.useEventCallback)(() => {
|
|
31
|
-
onChangeCalendarMonth
|
|
31
|
+
onChangeCalendarMonth?.(index, (0, _date.addMonths)(calendarDate, -1));
|
|
32
32
|
});
|
|
33
33
|
return {
|
|
34
34
|
calendarDate,
|
|
@@ -11,9 +11,8 @@ function getSafeCalendarDate({
|
|
|
11
11
|
calendarKey = 'start',
|
|
12
12
|
allowSameMonth
|
|
13
13
|
}) {
|
|
14
|
-
var _value;
|
|
15
14
|
// Update calendarDate if the value is not null
|
|
16
|
-
value =
|
|
15
|
+
value = value ?? [];
|
|
17
16
|
const gap = allowSameMonth ? 0 : 1;
|
|
18
17
|
if (value[0] && value[1]) {
|
|
19
18
|
const diffMonth = (0, _date.differenceInCalendarMonths)(value[1], value[0]);
|
package/cjs/Dropdown/Dropdown.js
CHANGED
|
@@ -134,11 +134,11 @@ const Dropdown = (0, _utils.forwardRef)((props, ref) => {
|
|
|
134
134
|
}, popupProps), children);
|
|
135
135
|
},
|
|
136
136
|
onToggleMenu: open => {
|
|
137
|
-
onToggle
|
|
137
|
+
onToggle?.(open);
|
|
138
138
|
if (open) {
|
|
139
|
-
onOpen
|
|
139
|
+
onOpen?.();
|
|
140
140
|
} else {
|
|
141
|
-
onClose
|
|
141
|
+
onClose?.();
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}, ({
|
|
@@ -51,12 +51,11 @@ const DropdownItem = (0, _utils.forwardRef)((props, ref) => {
|
|
|
51
51
|
prefix
|
|
52
52
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
53
53
|
const handleSelectItem = (0, _react.useCallback)(event => {
|
|
54
|
-
|
|
55
|
-
onSelect
|
|
56
|
-
dropdown === null || dropdown === void 0 || (_dropdown$onSelect = dropdown.onSelect) === null || _dropdown$onSelect === void 0 || _dropdown$onSelect.call(dropdown, eventKey, event);
|
|
54
|
+
onSelect?.(eventKey, event);
|
|
55
|
+
dropdown?.onSelect?.(eventKey, event);
|
|
57
56
|
}, [onSelect, eventKey, dropdown]);
|
|
58
|
-
const selected = activeProp || !(0, _isNil.default)(eventKey) && (0, _utils.shallowEqual)(dropdown
|
|
59
|
-
const dispatch = dropdown
|
|
57
|
+
const selected = activeProp || !(0, _isNil.default)(eventKey) && (0, _utils.shallowEqual)(dropdown?.activeKey, eventKey);
|
|
58
|
+
const dispatch = dropdown?.dispatch;
|
|
60
59
|
(0, _react.useEffect)(() => {
|
|
61
60
|
if (dispatch) {
|
|
62
61
|
dispatch({
|
|
@@ -39,5 +39,5 @@ export interface DropdownMenuProps<T = string | number> extends StandardProps {
|
|
|
39
39
|
* </Dropdown.Menu>
|
|
40
40
|
* </Dropdown>
|
|
41
41
|
*/
|
|
42
|
-
declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuProps<string | number> & SanitizedHTMListProps
|
|
42
|
+
declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuProps<string | number> & SanitizedHTMListProps & React.RefAttributes<HTMLElement>>;
|
|
43
43
|
export default DropdownMenu;
|
|
@@ -54,7 +54,7 @@ const DropdownMenu = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
54
54
|
rtl
|
|
55
55
|
} = (0, _hooks.useCustom)();
|
|
56
56
|
const handleToggleSubmenu = (0, _react.useCallback)((_, event) => {
|
|
57
|
-
onToggle
|
|
57
|
+
onToggle?.(eventKey, event);
|
|
58
58
|
}, [eventKey, onToggle]);
|
|
59
59
|
const {
|
|
60
60
|
merge,
|
package/cjs/Form/Form.d.ts
CHANGED
|
@@ -98,9 +98,7 @@ export interface FormProps<V = Record<string, any>, M = any, E = {
|
|
|
98
98
|
declare const Form: import("../internals/types").InternalRefForwardingComponent<"form", FormProps<Record<string, any>, any, {
|
|
99
99
|
[x: string]: any;
|
|
100
100
|
}> & {
|
|
101
|
-
ref?: React.Ref<FormInstance
|
|
102
|
-
[x: string]: string | undefined;
|
|
103
|
-
}>> | undefined;
|
|
101
|
+
ref?: React.Ref<FormInstance>;
|
|
104
102
|
}, never> & {
|
|
105
103
|
Stack: import("../internals/types").InternalRefForwardingComponent<"span", import("../FormStack").FormStackProps, never> & Record<string, never>;
|
|
106
104
|
Control: FormControlComponent;
|
package/cjs/Form/Form.js
CHANGED
|
@@ -106,21 +106,20 @@ const Form = (0, _utils.forwardRef)((props, ref) => {
|
|
|
106
106
|
const submit = (0, _hooks.useEventCallback)(event => {
|
|
107
107
|
// Check the form before submitting
|
|
108
108
|
if (check()) {
|
|
109
|
-
onSubmit
|
|
109
|
+
onSubmit?.(formValue, event);
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
const reset = (0, _hooks.useEventCallback)(event => {
|
|
113
113
|
resetErrors();
|
|
114
114
|
const resetValue = resetFormValue();
|
|
115
115
|
if (resetValue) {
|
|
116
|
-
onChange
|
|
116
|
+
onChange?.(resetValue);
|
|
117
117
|
}
|
|
118
|
-
onReset
|
|
118
|
+
onReset?.(resetValue, event);
|
|
119
119
|
});
|
|
120
120
|
const handleSubmit = (0, _hooks.useEventCallback)(event => {
|
|
121
|
-
|
|
122
|
-
event
|
|
123
|
-
event === null || event === void 0 || (_event$stopPropagatio = event.stopPropagation) === null || _event$stopPropagatio === void 0 || _event$stopPropagatio.call(event);
|
|
121
|
+
event?.preventDefault?.();
|
|
122
|
+
event?.stopPropagation?.();
|
|
124
123
|
|
|
125
124
|
// Prevent submission when the form is disabled, readOnly, or plaintext
|
|
126
125
|
if (disabled || readOnly || plaintext) {
|
|
@@ -129,9 +128,8 @@ const Form = (0, _utils.forwardRef)((props, ref) => {
|
|
|
129
128
|
submit(event);
|
|
130
129
|
});
|
|
131
130
|
const handleReset = (0, _hooks.useEventCallback)(event => {
|
|
132
|
-
|
|
133
|
-
event
|
|
134
|
-
event === null || event === void 0 || (_event$stopPropagatio2 = event.stopPropagation) === null || _event$stopPropagatio2 === void 0 || _event$stopPropagatio2.call(event);
|
|
131
|
+
event?.preventDefault?.();
|
|
132
|
+
event?.stopPropagation?.();
|
|
135
133
|
|
|
136
134
|
// Prevent reset when the form is disabled, readOnly, or plaintext
|
|
137
135
|
if (disabled || readOnly || plaintext) {
|
|
@@ -155,14 +153,14 @@ const Form = (0, _utils.forwardRef)((props, ref) => {
|
|
|
155
153
|
});
|
|
156
154
|
const removeFieldValue = (0, _hooks.useEventCallback)(name => {
|
|
157
155
|
const formValue = onRemoveValue(name);
|
|
158
|
-
onChange
|
|
156
|
+
onChange?.(formValue);
|
|
159
157
|
});
|
|
160
158
|
const removeFieldError = (0, _hooks.useEventCallback)(name => {
|
|
161
159
|
onRemoveError(name);
|
|
162
160
|
});
|
|
163
161
|
const onFieldChange = (0, _hooks.useEventCallback)((name, value, event) => {
|
|
164
162
|
const nextFormValue = setFieldValue(name, value);
|
|
165
|
-
onChange
|
|
163
|
+
onChange?.(nextFormValue, event);
|
|
166
164
|
});
|
|
167
165
|
const formContextValue = {
|
|
168
166
|
errorFromContext,
|
|
@@ -38,16 +38,16 @@ function useFormValidate(_formError, props) {
|
|
|
38
38
|
const checkResult = type.check(value, formValue, key);
|
|
39
39
|
if (checkResult.hasError === true) {
|
|
40
40
|
errorCount += 1;
|
|
41
|
-
formErrorObj[key] =
|
|
41
|
+
formErrorObj[key] = checkResult?.errorMessage || checkResult;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Check nested object
|
|
45
|
-
if (type
|
|
45
|
+
if (type?.objectTypeSchemaSpec) {
|
|
46
46
|
Object.entries(type.objectTypeSchemaSpec).forEach(([nestedKey, nestedType]) => {
|
|
47
47
|
formErrorObj[key] = formErrorObj[key] || {
|
|
48
48
|
object: {}
|
|
49
49
|
};
|
|
50
|
-
checkField(nestedKey, nestedType, value
|
|
50
|
+
checkField(nestedKey, nestedType, value?.[nestedKey], formErrorObj[key].object);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
};
|
|
@@ -55,10 +55,10 @@ function useFormValidate(_formError, props) {
|
|
|
55
55
|
checkField(key, type, formValue[key], formError);
|
|
56
56
|
});
|
|
57
57
|
setFormError(formError);
|
|
58
|
-
onCheck
|
|
59
|
-
callback
|
|
58
|
+
onCheck?.(formError);
|
|
59
|
+
callback?.(formError);
|
|
60
60
|
if (errorCount > 0) {
|
|
61
|
-
onError
|
|
61
|
+
onError?.(formError);
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
64
|
return true;
|
|
@@ -77,10 +77,10 @@ function useFormValidate(_formError, props) {
|
|
|
77
77
|
if (nestedField) {
|
|
78
78
|
nextFormError = (0, _set.default)(nextFormError, (0, _nameToPath.nameToPath)(fieldName), resultOfCurrentField);
|
|
79
79
|
setFormError(nextFormError);
|
|
80
|
-
onCheck
|
|
81
|
-
callback
|
|
80
|
+
onCheck?.(nextFormError);
|
|
81
|
+
callback?.(resultOfCurrentField);
|
|
82
82
|
if (resultOfCurrentField.hasError) {
|
|
83
|
-
onError
|
|
83
|
+
onError?.(nextFormError);
|
|
84
84
|
}
|
|
85
85
|
return !resultOfCurrentField.hasError;
|
|
86
86
|
} else {
|
|
@@ -101,10 +101,10 @@ function useFormValidate(_formError, props) {
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
setFormError(nextFormError);
|
|
104
|
-
onCheck
|
|
105
|
-
callback
|
|
104
|
+
onCheck?.(nextFormError);
|
|
105
|
+
callback?.(resultOfCurrentField);
|
|
106
106
|
if (hasError) {
|
|
107
|
-
onError
|
|
107
|
+
onError?.(nextFormError);
|
|
108
108
|
}
|
|
109
109
|
return !hasError;
|
|
110
110
|
}
|
|
@@ -138,10 +138,10 @@ function useFormValidate(_formError, props) {
|
|
|
138
138
|
formError[keys[i]] = values[i].errorMessage;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
onCheck
|
|
141
|
+
onCheck?.(formError);
|
|
142
142
|
setFormError(formError);
|
|
143
143
|
if (errorCount > 0) {
|
|
144
|
-
onError
|
|
144
|
+
onError?.(formError);
|
|
145
145
|
}
|
|
146
146
|
return {
|
|
147
147
|
hasError: errorCount > 0,
|
|
@@ -163,10 +163,10 @@ function useFormValidate(_formError, props) {
|
|
|
163
163
|
|
|
164
164
|
if (nestedField) {
|
|
165
165
|
nextFormError = (0, _set.default)(nextFormError, (0, _nameToPath.nameToPath)(fieldName), resultOfCurrentField);
|
|
166
|
-
onCheck
|
|
166
|
+
onCheck?.(nextFormError);
|
|
167
167
|
setFormError(nextFormError);
|
|
168
168
|
if (resultOfCurrentField.hasError) {
|
|
169
|
-
onError
|
|
169
|
+
onError?.(nextFormError);
|
|
170
170
|
}
|
|
171
171
|
return resultOfCurrentField;
|
|
172
172
|
} else {
|
|
@@ -187,9 +187,9 @@ function useFormValidate(_formError, props) {
|
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
189
|
setFormError(nextFormError);
|
|
190
|
-
onCheck
|
|
190
|
+
onCheck?.(nextFormError);
|
|
191
191
|
if (hasError) {
|
|
192
|
-
onError
|
|
192
|
+
onError?.(nextFormError);
|
|
193
193
|
}
|
|
194
194
|
return resultOfCurrentField;
|
|
195
195
|
}
|
|
@@ -211,7 +211,7 @@ function useFormValidate(_formError, props) {
|
|
|
211
211
|
const formError = (0, _omit.default)(realFormErrorRef.current, [nestedField ? (0, _nameToPath.nameToPath)(name) : name]);
|
|
212
212
|
realFormErrorRef.current = formError;
|
|
213
213
|
setFormError(formError);
|
|
214
|
-
onCheck
|
|
214
|
+
onCheck?.(formError);
|
|
215
215
|
return formError;
|
|
216
216
|
}, [nestedField, onCheck, setFormError]);
|
|
217
217
|
const cleanErrors = (0, _hooks.useEventCallback)(() => {
|
|
@@ -74,9 +74,9 @@ const FormControl = (0, _utils.forwardRef)((props, ref) => {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
// Combine props and context values
|
|
77
|
-
const resolvedReadOnly = readOnly
|
|
78
|
-
const resolvedPlaintext = plaintext
|
|
79
|
-
const resolvedDisabled = disabled
|
|
77
|
+
const resolvedReadOnly = readOnly ?? contextReadOnly;
|
|
78
|
+
const resolvedPlaintext = plaintext ?? contextPlaintext;
|
|
79
|
+
const resolvedDisabled = disabled ?? contextDisabled;
|
|
80
80
|
const {
|
|
81
81
|
withPrefix,
|
|
82
82
|
prefix
|
|
@@ -86,13 +86,13 @@ const FormControl = (0, _utils.forwardRef)((props, ref) => {
|
|
|
86
86
|
// Handle onChange with both hook's implementation and prop callback
|
|
87
87
|
const handleChange = (value, event) => {
|
|
88
88
|
handleFieldChange(value, event);
|
|
89
|
-
propsOnChange
|
|
89
|
+
propsOnChange?.(value, event);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
// Handle onBlur with both hook's implementation and prop callback
|
|
93
93
|
const handleBlur = event => {
|
|
94
94
|
handleFieldBlur(); // onBlur doesn't take parameters in the hook
|
|
95
|
-
propsOnBlur
|
|
95
|
+
propsOnBlur?.(event);
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
// Toggle component is a special case that uses `checked` and `defaultChecked` instead of `value` and `defaultValue` props.
|
|
@@ -16,11 +16,10 @@ function defaultRenderInput(props, ref) {
|
|
|
16
16
|
}
|
|
17
17
|
const pickers = ['DatePicker', 'DateRangePicker', 'TimePicker', 'TimeRangePicker', 'InputPicker', 'TagPicker', 'Cascader', 'MultiCascader', 'SelectPicker', 'CheckPicker', 'CheckTreePicker', 'TreePicker'];
|
|
18
18
|
function getDisplayName(Component) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return Component === null || Component === void 0 ? void 0 : Component.type;
|
|
19
|
+
if (typeof Component?.type === 'string') {
|
|
20
|
+
return Component?.type;
|
|
22
21
|
}
|
|
23
|
-
return
|
|
22
|
+
return Component?.type?.displayName || '';
|
|
24
23
|
}
|
|
25
24
|
function renderChildren(children, props, ref) {
|
|
26
25
|
if (typeof children === 'function') {
|
|
@@ -40,8 +39,8 @@ function renderChildren(children, props, ref) {
|
|
|
40
39
|
...rest,
|
|
41
40
|
// Pass onBlur to the child component to automatically save or cancel after the focus event is processed.
|
|
42
41
|
// Special handling in the Picker component, call onBlur when onExit and onClean
|
|
43
|
-
onExit: (0, _utils.createChainedFunction)(() => onBlur
|
|
44
|
-
onClean: (0, _utils.createChainedFunction)(() => onBlur
|
|
42
|
+
onExit: (0, _utils.createChainedFunction)(() => onBlur?.(), onExit),
|
|
43
|
+
onClean: (0, _utils.createChainedFunction)(() => onBlur?.(), onClean),
|
|
45
44
|
ref
|
|
46
45
|
});
|
|
47
46
|
}
|