rsuite 5.2.4 → 5.4.2
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/Avatar/styles/index.less +2 -2
- package/AvatarGroup/package.json +7 -0
- package/AvatarGroup/styles/index.less +19 -0
- package/ButtonGroup/styles/index.less +0 -18
- package/CHANGELOG.md +61 -0
- package/CheckTreePicker/styles/index.less +14 -1
- package/Dropdown/styles/index.less +4 -3
- package/Modal/styles/index.less +23 -22
- package/Nav/styles/index.less +1 -0
- package/Navbar/styles/index.less +19 -5
- package/Radio/styles/index.less +6 -0
- package/Sidenav/styles/index.less +2 -2
- package/Stack/package.json +7 -0
- package/Stack/styles/index.less +5 -0
- package/TreePicker/styles/index.less +10 -14
- package/cjs/@types/common.d.ts +13 -12
- package/cjs/@types/utils.d.ts +12 -0
- package/cjs/Affix/Affix.js +8 -6
- package/cjs/Animation/Transition.d.ts +21 -12
- package/cjs/Animation/Transition.js +4 -1
- package/cjs/AutoComplete/AutoComplete.js +1 -1
- package/cjs/AutoComplete/utils.d.ts +1 -1
- package/cjs/Avatar/Avatar.js +10 -3
- package/cjs/AvatarGroup/AvatarGroup.d.ts +15 -0
- package/cjs/AvatarGroup/AvatarGroup.js +76 -0
- package/cjs/AvatarGroup/index.d.ts +3 -0
- package/cjs/AvatarGroup/index.js +11 -0
- package/cjs/Breadcrumb/Breadcrumb.js +1 -1
- package/cjs/Button/Button.js +8 -2
- package/cjs/ButtonGroup/ButtonGroup.js +14 -3
- package/cjs/ButtonGroup/ButtonGroupContext.d.ts +7 -0
- package/cjs/ButtonGroup/ButtonGroupContext.js +13 -0
- package/cjs/ButtonGroup/index.d.ts +2 -0
- package/cjs/ButtonGroup/index.js +3 -0
- package/cjs/Calendar/Calendar.d.ts +4 -4
- package/cjs/Calendar/Calendar.js +26 -22
- package/cjs/Calendar/CalendarContext.js +1 -1
- package/cjs/Calendar/Header.js +1 -3
- package/cjs/Calendar/Table.js +1 -1
- package/cjs/Calendar/TableRow.js +13 -8
- package/cjs/Calendar/TimeDropdown.js +6 -5
- package/cjs/Calendar/View.js +9 -5
- package/cjs/Calendar/types.d.ts +2 -2
- package/cjs/Calendar/useCalendarDate.d.ts +2 -2
- package/cjs/Carousel/Carousel.d.ts +1 -1
- package/cjs/Carousel/Carousel.js +1 -1
- package/cjs/Cascader/Cascader.d.ts +1 -1
- package/cjs/Cascader/Cascader.js +10 -10
- package/cjs/Cascader/DropdownMenu.d.ts +5 -4
- package/cjs/Cascader/utils.d.ts +10 -10
- package/cjs/CheckPicker/CheckPicker.d.ts +9 -4
- package/cjs/CheckPicker/CheckPicker.js +4 -4
- package/cjs/CheckPicker/test/CheckPicker.test.d.ts +1 -0
- package/cjs/CheckPicker/test/CheckPicker.test.js +76 -0
- package/cjs/CheckTree/index.js +6 -5
- package/cjs/CheckTreePicker/CheckTreeNode.d.ts +1 -1
- package/cjs/CheckTreePicker/CheckTreeNode.js +7 -9
- package/cjs/CheckTreePicker/CheckTreePicker.js +29 -25
- package/cjs/CheckTreePicker/utils.d.ts +3 -1
- package/cjs/CheckTreePicker/utils.js +12 -10
- package/cjs/Checkbox/Checkbox.d.ts +1 -1
- package/cjs/Container/Container.js +6 -3
- package/cjs/CustomProvider/CustomProvider.d.ts +31 -57
- package/cjs/DOMHelper/index.d.ts +12 -12
- package/cjs/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/DatePicker/DatePicker.js +19 -11
- package/cjs/DatePicker/Toolbar.d.ts +12 -9
- package/cjs/DatePicker/Toolbar.js +6 -8
- package/cjs/DatePicker/types.d.ts +4 -4
- package/cjs/DatePicker/utils.d.ts +4 -3
- package/cjs/DateRangePicker/Calendar.d.ts +8 -7
- package/cjs/DateRangePicker/Calendar.js +1 -1
- package/cjs/DateRangePicker/DateRangePicker.d.ts +6 -6
- package/cjs/DateRangePicker/DateRangePicker.js +112 -111
- package/cjs/DateRangePicker/types.d.ts +2 -1
- package/cjs/DateRangePicker/utils.d.ts +6 -6
- package/cjs/DateRangePicker/utils.js +7 -2
- package/cjs/Disclosure/Disclosure.d.ts +8 -5
- package/cjs/Disclosure/Disclosure.js +55 -13
- package/cjs/Disclosure/DisclosureButton.d.ts +2 -2
- package/cjs/Disclosure/DisclosureButton.js +9 -7
- package/cjs/Disclosure/DisclosureContent.js +4 -6
- package/cjs/Disclosure/DisclosureContext.d.ts +8 -3
- package/cjs/Disclosure/useDisclosureContext.d.ts +2 -0
- package/cjs/Disclosure/useDisclosureContext.js +20 -0
- package/cjs/Dropdown/Dropdown.d.ts +1 -1
- package/cjs/Dropdown/Dropdown.js +1 -1
- package/cjs/Dropdown/DropdownContext.d.ts +2 -2
- package/cjs/Dropdown/DropdownItem.js +10 -11
- package/cjs/Dropdown/DropdownMenu.d.ts +3 -3
- package/cjs/Dropdown/DropdownMenu.js +81 -23
- package/cjs/Dropdown/DropdownState.d.ts +1 -1
- package/cjs/Dropdown/DropdownToggle.js +10 -2
- package/cjs/Dropdown/useRenderDropdownItem.d.ts +1 -1
- package/cjs/Form/Form.js +1 -1
- package/cjs/Form/FormContext.d.ts +1 -1
- package/cjs/FormControl/FormControl.d.ts +1 -1
- package/cjs/FormControl/FormControl.js +5 -4
- package/cjs/FormGroup/FormGroup.d.ts +1 -1
- package/cjs/FormGroup/FormGroup.js +9 -4
- package/cjs/Input/Input.d.ts +3 -2
- package/cjs/InputGroup/InputGroup.d.ts +1 -1
- package/cjs/InputNumber/InputNumber.js +6 -2
- package/cjs/InputPicker/InputAutosize.js +4 -4
- package/cjs/InputPicker/InputPicker.d.ts +2 -2
- package/cjs/InputPicker/InputPicker.js +15 -10
- package/cjs/List/ListContext.d.ts +1 -1
- package/cjs/List/ListContext.js +8 -1
- package/cjs/List/helper/AutoScroller.js +4 -2
- package/cjs/List/helper/useManager.d.ts +3 -3
- package/cjs/List/helper/useManager.js +1 -1
- package/cjs/List/helper/useSortHelper.d.ts +3 -3
- package/cjs/List/helper/useSortHelper.js +6 -4
- package/cjs/List/helper/utils.d.ts +2 -2
- package/cjs/MaskedInput/TextMask.d.ts +5 -5
- package/cjs/MaskedInput/adjustCaretPosition.d.ts +6 -6
- package/cjs/MaskedInput/conformToMask.js +5 -4
- package/cjs/MaskedInput/createTextMaskInputElement.d.ts +2 -2
- package/cjs/MaskedInput/utilities.d.ts +1 -1
- package/cjs/Menu/Menu.js +14 -7
- package/cjs/Menu/MenuContext.d.ts +1 -1
- package/cjs/Menu/MenuItem.d.ts +1 -1
- package/cjs/Menu/MenuItem.js +19 -15
- package/cjs/Menu/Menubar.js +8 -8
- package/cjs/Menu/useMenu.js +17 -7
- package/cjs/Modal/Modal.js +39 -21
- package/cjs/Modal/ModalContext.d.ts +2 -2
- package/cjs/Modal/utils.d.ts +1 -1
- package/cjs/Modal/utils.js +3 -5
- package/cjs/MultiCascader/DropdownMenu.d.ts +4 -4
- package/cjs/MultiCascader/MultiCascader.js +6 -6
- package/cjs/MultiCascader/utils.d.ts +17 -17
- package/cjs/Nav/Nav.d.ts +1 -1
- package/cjs/Nav/Nav.js +10 -12
- package/cjs/Nav/NavContext.d.ts +7 -1
- package/cjs/Nav/NavContext.js +1 -0
- package/cjs/Nav/NavItem.d.ts +1 -1
- package/cjs/Navbar/Navbar.js +1 -1
- package/cjs/Navbar/NavbarItem.d.ts +1 -1
- package/cjs/Navbar/index.d.ts +1 -0
- package/cjs/Navbar/index.js +4 -3
- package/cjs/Overlay/Modal.d.ts +2 -2
- package/cjs/Overlay/Modal.js +71 -63
- package/cjs/Overlay/ModalManager.d.ts +17 -8
- package/cjs/Overlay/ModalManager.js +11 -20
- package/cjs/Overlay/Overlay.d.ts +3 -3
- package/cjs/Overlay/Overlay.js +8 -2
- package/cjs/Overlay/OverlayContext.d.ts +6 -0
- package/cjs/Overlay/OverlayContext.js +14 -0
- package/cjs/Overlay/OverlayTrigger.d.ts +11 -11
- package/cjs/Overlay/OverlayTrigger.js +21 -7
- package/cjs/Overlay/Position.d.ts +4 -4
- package/cjs/Overlay/Position.js +14 -8
- package/cjs/Overlay/positionUtils.d.ts +1 -1
- package/cjs/Overlay/positionUtils.js +8 -8
- package/cjs/Pagination/Pagination.d.ts +1 -1
- package/cjs/Pagination/PaginationButton.d.ts +3 -3
- package/cjs/Pagination/PaginationGroup.js +5 -3
- package/cjs/Panel/Panel.d.ts +1 -1
- package/cjs/Panel/Panel.js +2 -2
- package/cjs/PanelGroup/PanelGroup.d.ts +2 -2
- package/cjs/PanelGroup/PanelGroup.js +8 -5
- package/cjs/Picker/DropdownMenu.d.ts +8 -5
- package/cjs/Picker/DropdownMenu.js +5 -5
- package/cjs/Picker/PickerOverlay.js +4 -3
- package/cjs/Picker/PickerToggle.js +4 -3
- package/cjs/Picker/PickerToggleTrigger.d.ts +2 -6
- package/cjs/Picker/SearchBar.d.ts +1 -1
- package/cjs/Picker/SelectedElement.js +2 -1
- package/cjs/Picker/propTypes.d.ts +5 -7
- package/cjs/Picker/propTypes.js +4 -3
- package/cjs/Picker/utils.d.ts +11 -11
- package/cjs/Picker/utils.js +22 -18
- package/cjs/Placeholder/PlaceholderGrid.js +1 -1
- package/cjs/Plaintext/Plaintext.js +2 -1
- package/cjs/Radio/Radio.d.ts +1 -1
- package/cjs/RadioGroup/RadioGroup.d.ts +2 -2
- package/cjs/RadioGroup/RadioGroup.js +1 -1
- package/cjs/RangeSlider/RangeSlider.d.ts +2 -2
- package/cjs/RangeSlider/RangeSlider.js +6 -4
- package/cjs/Rate/Character.js +4 -2
- package/cjs/Rate/Rate.js +2 -1
- package/cjs/Ripple/Ripple.js +1 -1
- package/cjs/SelectPicker/SelectPicker.d.ts +12 -5
- package/cjs/SelectPicker/SelectPicker.js +8 -8
- package/cjs/SelectPicker/index.d.ts +1 -1
- package/cjs/SelectPicker/test/SelectPicker.test.d.ts +1 -0
- package/cjs/SelectPicker/test/SelectPicker.test.js +62 -0
- package/cjs/Sidenav/Node.d.ts +1 -1
- package/cjs/Sidenav/Sidenav.d.ts +4 -4
- package/cjs/Sidenav/Sidenav.js +5 -2
- package/cjs/Sidenav/SidenavDropdown.js +11 -8
- package/cjs/Sidenav/SidenavDropdownItem.js +10 -5
- package/cjs/Sidenav/SidenavDropdownMenu.js +9 -5
- package/cjs/Sidenav/SidenavItem.d.ts +1 -1
- package/cjs/Sidenav/SidenavItem.js +4 -0
- package/cjs/Slider/Graduated.d.ts +5 -5
- package/cjs/Slider/Handle.d.ts +1 -1
- package/cjs/Slider/Handle.js +10 -6
- package/cjs/Slider/Mark.d.ts +1 -1
- package/cjs/Slider/Slider.d.ts +1 -1
- package/cjs/Slider/Slider.js +2 -2
- package/cjs/Slider/utils.d.ts +2 -1
- package/cjs/Slider/utils.js +4 -5
- package/cjs/Stack/Stack.d.ts +26 -0
- package/cjs/Stack/Stack.js +86 -0
- package/cjs/Stack/index.d.ts +3 -0
- package/cjs/Stack/index.js +11 -0
- package/cjs/Steps/StepItem.js +1 -1
- package/cjs/TagInput/index.js +1 -1
- package/cjs/Toggle/Toggle.js +5 -4
- package/cjs/Tree/Tree.d.ts +3 -2
- package/cjs/Tree/Tree.js +6 -5
- package/cjs/Tree/TreeContext.d.ts +0 -1
- package/cjs/TreePicker/TreeNode.js +7 -22
- package/cjs/TreePicker/TreePicker.js +32 -52
- package/cjs/Uploader/UploadFileItem.d.ts +1 -1
- package/cjs/Uploader/UploadFileItem.js +2 -2
- package/cjs/Uploader/UploadTrigger.d.ts +1 -1
- package/cjs/Uploader/UploadTrigger.js +2 -3
- package/cjs/Uploader/Uploader.d.ts +5 -5
- package/cjs/Uploader/Uploader.js +1 -2
- package/cjs/index.d.ts +6 -2
- package/cjs/index.js +13 -5
- package/cjs/locales/index.d.ts +3 -3
- package/cjs/toaster/ToastContainer.d.ts +1 -1
- package/cjs/toaster/ToastContainer.js +1 -1
- package/cjs/toaster/toaster.js +3 -1
- package/cjs/utils/BrowserDetection.js +1 -1
- package/cjs/utils/ReactChildren.d.ts +2 -2
- package/cjs/utils/ajaxUpload.d.ts +1 -1
- package/cjs/utils/ajaxUpload.js +5 -4
- package/cjs/utils/appendTooltip.d.ts +1 -1
- package/cjs/utils/constants.d.ts +4 -4
- package/cjs/utils/createChainedFunction.d.ts +1 -1
- package/cjs/utils/getDataGroupBy.d.ts +1 -1
- package/cjs/utils/index.d.ts +1 -0
- package/cjs/utils/index.js +7 -2
- package/cjs/utils/mergeRefs.d.ts +2 -2
- package/cjs/utils/previewFile.d.ts +1 -1
- package/cjs/utils/propTypeChecker.d.ts +6 -2
- package/cjs/utils/propTypeChecker.js +7 -6
- package/cjs/utils/reactToString.d.ts +2 -1
- package/cjs/utils/statusIcons.d.ts +1 -1
- package/cjs/utils/stringToObject.d.ts +1 -1
- package/cjs/utils/treeUtils.d.ts +35 -32
- package/cjs/utils/treeUtils.js +46 -23
- package/cjs/utils/useControlled.d.ts +6 -1
- package/cjs/utils/useControlled.js +0 -8
- package/cjs/utils/useCustom.js +6 -4
- package/cjs/utils/useFocus.d.ts +2 -2
- package/cjs/utils/useMount.d.ts +2 -0
- package/cjs/utils/useMount.js +19 -0
- package/cjs/utils/usePortal.d.ts +2 -2
- package/cjs/utils/useRootClose.d.ts +2 -2
- package/cjs/utils/useTimeout.d.ts +1 -1
- package/cjs/utils/useTimeout.js +5 -3
- package/dist/rsuite-rtl.css +95 -210
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +95 -210
- package/dist/rsuite.js +214 -115
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/@types/common.d.ts +13 -12
- package/esm/@types/utils.d.ts +12 -0
- package/esm/Affix/Affix.js +9 -7
- package/esm/Animation/Transition.d.ts +21 -12
- package/esm/Animation/Transition.js +4 -1
- package/esm/AutoComplete/AutoComplete.js +1 -1
- package/esm/AutoComplete/utils.d.ts +1 -1
- package/esm/Avatar/Avatar.js +7 -3
- package/esm/AvatarGroup/AvatarGroup.d.ts +15 -0
- package/esm/AvatarGroup/AvatarGroup.js +57 -0
- package/esm/AvatarGroup/index.d.ts +3 -0
- package/esm/AvatarGroup/index.js +2 -0
- package/esm/Breadcrumb/Breadcrumb.js +1 -1
- package/esm/Button/Button.js +6 -2
- package/esm/ButtonGroup/ButtonGroup.js +11 -3
- package/esm/ButtonGroup/ButtonGroupContext.d.ts +7 -0
- package/esm/ButtonGroup/ButtonGroupContext.js +3 -0
- package/esm/ButtonGroup/index.d.ts +2 -0
- package/esm/ButtonGroup/index.js +2 -0
- package/esm/Calendar/Calendar.d.ts +4 -4
- package/esm/Calendar/Calendar.js +27 -23
- package/esm/Calendar/CalendarContext.js +1 -1
- package/esm/Calendar/Header.js +1 -3
- package/esm/Calendar/Table.js +1 -1
- package/esm/Calendar/TableRow.js +14 -9
- package/esm/Calendar/TimeDropdown.js +5 -4
- package/esm/Calendar/View.js +10 -6
- package/esm/Calendar/types.d.ts +2 -2
- package/esm/Calendar/useCalendarDate.d.ts +2 -2
- package/esm/Carousel/Carousel.d.ts +1 -1
- package/esm/Carousel/Carousel.js +1 -1
- package/esm/Cascader/Cascader.d.ts +1 -1
- package/esm/Cascader/Cascader.js +10 -10
- package/esm/Cascader/DropdownMenu.d.ts +5 -4
- package/esm/Cascader/utils.d.ts +10 -10
- package/esm/CheckPicker/CheckPicker.d.ts +9 -4
- package/esm/CheckPicker/CheckPicker.js +4 -4
- package/esm/CheckPicker/test/CheckPicker.test.d.ts +1 -0
- package/esm/CheckPicker/test/CheckPicker.test.js +64 -0
- package/esm/CheckTree/index.js +7 -6
- package/esm/CheckTreePicker/CheckTreeNode.d.ts +1 -1
- package/esm/CheckTreePicker/CheckTreeNode.js +4 -7
- package/esm/CheckTreePicker/CheckTreePicker.js +28 -23
- package/esm/CheckTreePicker/utils.d.ts +3 -1
- package/esm/CheckTreePicker/utils.js +12 -10
- package/esm/Checkbox/Checkbox.d.ts +1 -1
- package/esm/Container/Container.js +7 -4
- package/esm/CustomProvider/CustomProvider.d.ts +31 -57
- package/esm/DOMHelper/index.d.ts +12 -12
- package/esm/DatePicker/DatePicker.d.ts +1 -1
- package/esm/DatePicker/DatePicker.js +18 -11
- package/esm/DatePicker/Toolbar.d.ts +12 -9
- package/esm/DatePicker/Toolbar.js +6 -8
- package/esm/DatePicker/types.d.ts +4 -4
- package/esm/DatePicker/utils.d.ts +4 -3
- package/esm/DateRangePicker/Calendar.d.ts +8 -7
- package/esm/DateRangePicker/Calendar.js +1 -1
- package/esm/DateRangePicker/DateRangePicker.d.ts +6 -6
- package/esm/DateRangePicker/DateRangePicker.js +112 -111
- package/esm/DateRangePicker/types.d.ts +2 -1
- package/esm/DateRangePicker/utils.d.ts +6 -6
- package/esm/DateRangePicker/utils.js +6 -2
- package/esm/Disclosure/Disclosure.d.ts +8 -5
- package/esm/Disclosure/Disclosure.js +56 -15
- package/esm/Disclosure/DisclosureButton.d.ts +2 -2
- package/esm/Disclosure/DisclosureButton.js +8 -7
- package/esm/Disclosure/DisclosureContent.js +5 -7
- package/esm/Disclosure/DisclosureContext.d.ts +8 -3
- package/esm/Disclosure/useDisclosureContext.d.ts +2 -0
- package/esm/Disclosure/useDisclosureContext.js +11 -0
- package/esm/Dropdown/Dropdown.d.ts +1 -1
- package/esm/Dropdown/Dropdown.js +1 -1
- package/esm/Dropdown/DropdownContext.d.ts +2 -2
- package/esm/Dropdown/DropdownItem.js +10 -10
- package/esm/Dropdown/DropdownMenu.d.ts +3 -3
- package/esm/Dropdown/DropdownMenu.js +82 -24
- package/esm/Dropdown/DropdownState.d.ts +1 -1
- package/esm/Dropdown/DropdownToggle.js +9 -2
- package/esm/Dropdown/useRenderDropdownItem.d.ts +1 -1
- package/esm/Form/Form.js +1 -1
- package/esm/Form/FormContext.d.ts +1 -1
- package/esm/FormControl/FormControl.d.ts +1 -1
- package/esm/FormControl/FormControl.js +5 -4
- package/esm/FormGroup/FormGroup.d.ts +1 -1
- package/esm/FormGroup/FormGroup.js +7 -4
- package/esm/Input/Input.d.ts +3 -2
- package/esm/InputGroup/InputGroup.d.ts +1 -1
- package/esm/InputNumber/InputNumber.js +6 -2
- package/esm/InputPicker/InputAutosize.js +4 -4
- package/esm/InputPicker/InputPicker.d.ts +2 -2
- package/esm/InputPicker/InputPicker.js +15 -10
- package/esm/List/ListContext.d.ts +1 -1
- package/esm/List/ListContext.js +7 -1
- package/esm/List/helper/AutoScroller.js +4 -2
- package/esm/List/helper/useManager.d.ts +3 -3
- package/esm/List/helper/useManager.js +1 -1
- package/esm/List/helper/useSortHelper.d.ts +3 -3
- package/esm/List/helper/useSortHelper.js +6 -4
- package/esm/List/helper/utils.d.ts +2 -2
- package/esm/MaskedInput/TextMask.d.ts +5 -5
- package/esm/MaskedInput/adjustCaretPosition.d.ts +6 -6
- package/esm/MaskedInput/conformToMask.js +5 -4
- package/esm/MaskedInput/createTextMaskInputElement.d.ts +2 -2
- package/esm/MaskedInput/utilities.d.ts +1 -1
- package/esm/Menu/Menu.js +13 -7
- package/esm/Menu/MenuContext.d.ts +1 -1
- package/esm/Menu/MenuItem.d.ts +1 -1
- package/esm/Menu/MenuItem.js +18 -15
- package/esm/Menu/Menubar.js +7 -8
- package/esm/Menu/useMenu.js +17 -7
- package/esm/Modal/Modal.js +41 -23
- package/esm/Modal/ModalContext.d.ts +2 -2
- package/esm/Modal/utils.d.ts +1 -1
- package/esm/Modal/utils.js +3 -5
- package/esm/MultiCascader/DropdownMenu.d.ts +4 -4
- package/esm/MultiCascader/MultiCascader.js +6 -6
- package/esm/MultiCascader/utils.d.ts +17 -17
- package/esm/Nav/Nav.d.ts +1 -1
- package/esm/Nav/Nav.js +11 -13
- package/esm/Nav/NavContext.d.ts +7 -1
- package/esm/Nav/NavContext.js +1 -0
- package/esm/Nav/NavItem.d.ts +1 -1
- package/esm/Navbar/Navbar.js +1 -1
- package/esm/Navbar/NavbarItem.d.ts +1 -1
- package/esm/Navbar/index.d.ts +1 -0
- package/esm/Navbar/index.js +1 -0
- package/esm/Overlay/Modal.d.ts +2 -2
- package/esm/Overlay/Modal.js +72 -64
- package/esm/Overlay/ModalManager.d.ts +17 -8
- package/esm/Overlay/ModalManager.js +11 -20
- package/esm/Overlay/Overlay.d.ts +3 -3
- package/esm/Overlay/Overlay.js +8 -3
- package/esm/Overlay/OverlayContext.d.ts +6 -0
- package/esm/Overlay/OverlayContext.js +4 -0
- package/esm/Overlay/OverlayTrigger.d.ts +11 -11
- package/esm/Overlay/OverlayTrigger.js +21 -8
- package/esm/Overlay/Position.d.ts +4 -4
- package/esm/Overlay/Position.js +14 -8
- package/esm/Overlay/positionUtils.d.ts +1 -1
- package/esm/Overlay/positionUtils.js +6 -6
- package/esm/Pagination/Pagination.d.ts +1 -1
- package/esm/Pagination/PaginationButton.d.ts +3 -3
- package/esm/Pagination/PaginationGroup.js +5 -3
- package/esm/Panel/Panel.d.ts +1 -1
- package/esm/Panel/Panel.js +2 -2
- package/esm/PanelGroup/PanelGroup.d.ts +2 -2
- package/esm/PanelGroup/PanelGroup.js +9 -6
- package/esm/Picker/DropdownMenu.d.ts +8 -5
- package/esm/Picker/DropdownMenu.js +5 -5
- package/esm/Picker/PickerOverlay.js +4 -3
- package/esm/Picker/PickerToggle.js +4 -3
- package/esm/Picker/PickerToggleTrigger.d.ts +2 -6
- package/esm/Picker/SearchBar.d.ts +1 -1
- package/esm/Picker/SelectedElement.js +2 -1
- package/esm/Picker/propTypes.d.ts +5 -7
- package/esm/Picker/propTypes.js +4 -3
- package/esm/Picker/utils.d.ts +11 -11
- package/esm/Picker/utils.js +21 -18
- package/esm/Placeholder/PlaceholderGrid.js +1 -1
- package/esm/Plaintext/Plaintext.js +2 -1
- package/esm/Radio/Radio.d.ts +1 -1
- package/esm/RadioGroup/RadioGroup.d.ts +2 -2
- package/esm/RadioGroup/RadioGroup.js +1 -1
- package/esm/RangeSlider/RangeSlider.d.ts +2 -2
- package/esm/RangeSlider/RangeSlider.js +5 -4
- package/esm/Rate/Character.js +3 -2
- package/esm/Rate/Rate.js +2 -1
- package/esm/Ripple/Ripple.js +1 -1
- package/esm/SelectPicker/SelectPicker.d.ts +12 -5
- package/esm/SelectPicker/SelectPicker.js +8 -8
- package/esm/SelectPicker/index.d.ts +1 -1
- package/esm/SelectPicker/test/SelectPicker.test.d.ts +1 -0
- package/esm/SelectPicker/test/SelectPicker.test.js +52 -0
- package/esm/Sidenav/Node.d.ts +1 -1
- package/esm/Sidenav/Sidenav.d.ts +4 -4
- package/esm/Sidenav/Sidenav.js +5 -2
- package/esm/Sidenav/SidenavDropdown.js +11 -7
- package/esm/Sidenav/SidenavDropdownItem.js +11 -5
- package/esm/Sidenav/SidenavDropdownMenu.js +9 -5
- package/esm/Sidenav/SidenavItem.d.ts +1 -1
- package/esm/Sidenav/SidenavItem.js +4 -0
- package/esm/Slider/Graduated.d.ts +5 -5
- package/esm/Slider/Handle.d.ts +1 -1
- package/esm/Slider/Handle.js +10 -6
- package/esm/Slider/Mark.d.ts +1 -1
- package/esm/Slider/Slider.d.ts +1 -1
- package/esm/Slider/Slider.js +2 -2
- package/esm/Slider/utils.d.ts +2 -1
- package/esm/Slider/utils.js +5 -2
- package/esm/Stack/Stack.d.ts +26 -0
- package/esm/Stack/Stack.js +71 -0
- package/esm/Stack/index.d.ts +3 -0
- package/esm/Stack/index.js +2 -0
- package/esm/Steps/StepItem.js +1 -1
- package/esm/TagInput/index.js +1 -1
- package/esm/Toggle/Toggle.js +5 -4
- package/esm/Tree/Tree.d.ts +3 -2
- package/esm/Tree/Tree.js +7 -6
- package/esm/Tree/TreeContext.d.ts +0 -1
- package/esm/TreePicker/TreeNode.js +6 -21
- package/esm/TreePicker/TreePicker.js +31 -50
- package/esm/Uploader/UploadFileItem.d.ts +1 -1
- package/esm/Uploader/UploadFileItem.js +2 -2
- package/esm/Uploader/UploadTrigger.d.ts +1 -1
- package/esm/Uploader/UploadTrigger.js +2 -3
- package/esm/Uploader/Uploader.d.ts +5 -5
- package/esm/Uploader/Uploader.js +1 -2
- package/esm/index.d.ts +6 -2
- package/esm/index.js +3 -1
- package/esm/locales/index.d.ts +3 -3
- package/esm/toaster/ToastContainer.d.ts +1 -1
- package/esm/toaster/ToastContainer.js +1 -1
- package/esm/toaster/toaster.js +3 -1
- package/esm/utils/BrowserDetection.js +1 -1
- package/esm/utils/ReactChildren.d.ts +2 -2
- package/esm/utils/ajaxUpload.d.ts +1 -1
- package/esm/utils/ajaxUpload.js +5 -4
- package/esm/utils/appendTooltip.d.ts +1 -1
- package/esm/utils/constants.d.ts +4 -4
- package/esm/utils/createChainedFunction.d.ts +1 -1
- package/esm/utils/getDataGroupBy.d.ts +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +2 -1
- package/esm/utils/mergeRefs.d.ts +2 -2
- package/esm/utils/previewFile.d.ts +1 -1
- package/esm/utils/propTypeChecker.d.ts +6 -2
- package/esm/utils/propTypeChecker.js +7 -6
- package/esm/utils/reactToString.d.ts +2 -1
- package/esm/utils/statusIcons.d.ts +1 -1
- package/esm/utils/stringToObject.d.ts +1 -1
- package/esm/utils/treeUtils.d.ts +35 -32
- package/esm/utils/treeUtils.js +45 -21
- package/esm/utils/useControlled.d.ts +6 -1
- package/esm/utils/useControlled.js +0 -8
- package/esm/utils/useCustom.js +6 -4
- package/esm/utils/useFocus.d.ts +2 -2
- package/esm/utils/useMount.d.ts +2 -0
- package/esm/utils/useMount.js +13 -0
- package/esm/utils/usePortal.d.ts +2 -2
- package/esm/utils/useRootClose.d.ts +2 -2
- package/esm/utils/useTimeout.d.ts +1 -1
- package/esm/utils/useTimeout.js +5 -3
- package/package.json +2 -2
- package/styles/index.less +2 -0
|
@@ -14,6 +14,8 @@ export interface TreeNodeType {
|
|
|
14
14
|
value?: string | number;
|
|
15
15
|
groupBy?: string;
|
|
16
16
|
children?: TreeNodeType[];
|
|
17
|
+
hasChildren?: boolean;
|
|
18
|
+
checkState?: CheckStateType;
|
|
17
19
|
}
|
|
18
20
|
export interface TreeNodesType {
|
|
19
21
|
[key: string]: TreeNodeType;
|
|
@@ -38,5 +40,5 @@ export declare function isNodeUncheckable(node: any, props: Partial<CheckTreePic
|
|
|
38
40
|
export declare function getFormattedTree(data: any[], nodes: TreeNodesType, props: Partial<CheckTreePickerProps>): any[];
|
|
39
41
|
export declare function getDisabledState(nodes: TreeNodesType, node: TreeNodeType, props: Partial<CheckTreePickerProps>): boolean;
|
|
40
42
|
export declare function getCheckTreePickerDefaultValue(value: any[], uncheckableItemValues: any[]): any[];
|
|
41
|
-
export declare function getSelectedItems(nodes: TreeNodesType, value: (string | number)[], valueKey: string):
|
|
43
|
+
export declare function getSelectedItems(nodes: TreeNodesType, value: (string | number)[], valueKey: string): TreeNodeType[];
|
|
42
44
|
export declare function getNodeCheckState({ nodes, node, cascade, childrenKey }: any): CheckStateType;
|
|
@@ -4,22 +4,24 @@ import _isNil from "lodash/isNil";
|
|
|
4
4
|
import { shallowEqual, CHECK_STATE } from '../utils';
|
|
5
5
|
import { getChildrenByFlattenNodes } from '../utils/treeUtils';
|
|
6
6
|
export function isEveryChildChecked(nodes, parent) {
|
|
7
|
-
if (_isNil(nodes[parent.refKey])) {
|
|
7
|
+
if (_isNil(parent.refKey) || _isNil(nodes[parent.refKey])) {
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
var children = getChildrenByFlattenNodes(nodes, parent);
|
|
12
12
|
|
|
13
13
|
if (!children.length) {
|
|
14
|
-
|
|
14
|
+
var _nodes$parent$refKey$;
|
|
15
|
+
|
|
16
|
+
return (_nodes$parent$refKey$ = nodes[parent.refKey].check) !== null && _nodes$parent$refKey$ !== void 0 ? _nodes$parent$refKey$ : false;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
return children.every(function (child) {
|
|
18
|
-
return nodes[child.refKey].check;
|
|
20
|
+
return !_isNil(child.refKey) && nodes[child.refKey].check;
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
23
|
export function isSomeChildChecked(nodes, parent, childrenKey) {
|
|
22
|
-
if (_isNil(nodes[parent.refKey])) {
|
|
24
|
+
if (!_isNil(parent.refKey) && _isNil(nodes[parent.refKey])) {
|
|
23
25
|
return false;
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -31,7 +33,7 @@ export function isSomeChildChecked(nodes, parent, childrenKey) {
|
|
|
31
33
|
return isSomeChildChecked(nodes, child, childrenKey);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
return nodes[child.refKey].check;
|
|
36
|
+
return !_isNil(child.refKey) && nodes[child.refKey].check;
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
export function isSomeNodeHasChildren(data, childrenKey) {
|
|
@@ -46,7 +48,7 @@ export function isSomeNodeHasChildren(data, childrenKey) {
|
|
|
46
48
|
|
|
47
49
|
export function isAllSiblingNodeUncheckable(node, nodes, uncheckableItemValues, valueKey) {
|
|
48
50
|
var list = [];
|
|
49
|
-
var
|
|
51
|
+
var parentNodeRefKey = node.parent ? node.parent.refKey : '';
|
|
50
52
|
Object.keys(nodes).forEach(function (refKey) {
|
|
51
53
|
var _curNode$parent;
|
|
52
54
|
|
|
@@ -54,7 +56,7 @@ export function isAllSiblingNodeUncheckable(node, nodes, uncheckableItemValues,
|
|
|
54
56
|
|
|
55
57
|
if (_isNil(node.parent) && _isNil(curNode.parent)) {
|
|
56
58
|
list.push(curNode);
|
|
57
|
-
} else if (((_curNode$parent = curNode.parent) === null || _curNode$parent === void 0 ? void 0 : _curNode$parent.refKey) ===
|
|
59
|
+
} else if (((_curNode$parent = curNode.parent) === null || _curNode$parent === void 0 ? void 0 : _curNode$parent.refKey) === parentNodeRefKey) {
|
|
58
60
|
list.push(curNode);
|
|
59
61
|
}
|
|
60
62
|
});
|
|
@@ -107,7 +109,7 @@ export function getFormattedTree(data, nodes, props) {
|
|
|
107
109
|
var curNode = nodes[node.refKey];
|
|
108
110
|
|
|
109
111
|
if (curNode) {
|
|
110
|
-
var _node
|
|
112
|
+
var _node;
|
|
111
113
|
|
|
112
114
|
var checkState = !_isUndefined(cascade) ? getNodeCheckState({
|
|
113
115
|
node: curNode,
|
|
@@ -121,7 +123,7 @@ export function getFormattedTree(data, nodes, props) {
|
|
|
121
123
|
formatted.parent = curNode.parent;
|
|
122
124
|
formatted.checkState = checkState;
|
|
123
125
|
|
|
124
|
-
if (((_node
|
|
126
|
+
if (((_node = node[childrenKey]) === null || _node === void 0 ? void 0 : _node.length) > 0) {
|
|
125
127
|
formatted[childrenKey] = getFormattedTree(formatted[childrenKey], nodes, props);
|
|
126
128
|
}
|
|
127
129
|
}
|
|
@@ -134,7 +136,7 @@ export function getDisabledState(nodes, node, props) {
|
|
|
134
136
|
disabledItemValues = _props$disabledItemVa === void 0 ? [] : _props$disabledItemVa,
|
|
135
137
|
valueKey = props.valueKey;
|
|
136
138
|
|
|
137
|
-
if (_isNil(nodes[node.refKey])) {
|
|
139
|
+
if (!_isNil(node.refKey) && _isNil(nodes[node.refKey])) {
|
|
138
140
|
return false;
|
|
139
141
|
}
|
|
140
142
|
|
|
@@ -31,7 +31,7 @@ export interface CheckboxProps<V = ValueType> extends WithAsProps {
|
|
|
31
31
|
/** Used for the name of the form */
|
|
32
32
|
name?: string;
|
|
33
33
|
/** Called when the user attempts to change the checked state. */
|
|
34
|
-
onChange?: (value: V, checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
34
|
+
onChange?: (value: V | undefined, checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
35
35
|
/** Called when the checkbox or label is clicked. */
|
|
36
36
|
onClick?: (event: React.SyntheticEvent) => void;
|
|
37
37
|
/** Called when the checkbox is clicked. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { useState } from 'react';
|
|
3
|
+
import React, { useState, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useClassNames } from '../utils';
|
|
6
6
|
export var ContainerContext = /*#__PURE__*/React.createContext({});
|
|
@@ -24,10 +24,13 @@ var Container = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
24
24
|
var classes = merge(className, withClassPrefix({
|
|
25
25
|
'has-sidebar': hasSidebar
|
|
26
26
|
}));
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var contextValue = useMemo(function () {
|
|
28
|
+
return {
|
|
29
29
|
setHasSidebar: setHasSidebar
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
|
+
}, [setHasSidebar]);
|
|
32
|
+
return /*#__PURE__*/React.createElement(ContainerContext.Provider, {
|
|
33
|
+
value: contextValue
|
|
31
34
|
}, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
32
35
|
ref: ref,
|
|
33
36
|
className: classes
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { Locale } from '../locales';
|
|
3
3
|
export interface CustomValue<T = Locale> {
|
|
4
4
|
/** Language configuration */
|
|
5
|
-
locale
|
|
5
|
+
locale: T;
|
|
6
6
|
/** Support right-to-left */
|
|
7
|
-
rtl
|
|
7
|
+
rtl: boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Return the formatted date string in the given format. The result may vary by locale.
|
|
10
10
|
*
|
|
@@ -18,7 +18,7 @@ export interface CustomValue<T = Locale> {
|
|
|
18
18
|
* }
|
|
19
19
|
*
|
|
20
20
|
* */
|
|
21
|
-
formatDate
|
|
21
|
+
formatDate: (date: Date | number, format: string) => string;
|
|
22
22
|
/**
|
|
23
23
|
* Return the date parsed from string using the given format string.
|
|
24
24
|
*
|
|
@@ -32,9 +32,9 @@ export interface CustomValue<T = Locale> {
|
|
|
32
32
|
* }
|
|
33
33
|
*
|
|
34
34
|
* */
|
|
35
|
-
parseDate
|
|
35
|
+
parseDate: (dateString: string, formatString: string) => Date;
|
|
36
36
|
}
|
|
37
|
-
export interface CustomProviderProps<T = Locale> extends CustomValue<T
|
|
37
|
+
export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>> {
|
|
38
38
|
/** Supported themes */
|
|
39
39
|
theme?: 'light' | 'dark' | 'high-contrast';
|
|
40
40
|
/** The prefix of the component CSS class */
|
|
@@ -46,25 +46,12 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
46
46
|
common?: {
|
|
47
47
|
loading: string;
|
|
48
48
|
emptyMessage: string;
|
|
49
|
-
};
|
|
49
|
+
} | undefined;
|
|
50
50
|
Plaintext?: {
|
|
51
51
|
unfilled: string;
|
|
52
52
|
notSelected: string;
|
|
53
|
-
/**
|
|
54
|
-
* Return the date parsed from string using the given format string.
|
|
55
|
-
*
|
|
56
|
-
* Example:
|
|
57
|
-
*
|
|
58
|
-
* import parse from 'date-fns/parse';
|
|
59
|
-
* import eo from 'date-fns/locale/eo'
|
|
60
|
-
*
|
|
61
|
-
* function parseDate(date, formatStr) {
|
|
62
|
-
* return parse(date, formatStr, new Date(), { locale: eo });
|
|
63
|
-
* }
|
|
64
|
-
*
|
|
65
|
-
* */
|
|
66
53
|
notUploaded: string;
|
|
67
|
-
};
|
|
54
|
+
} | undefined;
|
|
68
55
|
Pagination?: {
|
|
69
56
|
more: string;
|
|
70
57
|
prev: string;
|
|
@@ -74,7 +61,7 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
74
61
|
limit: string;
|
|
75
62
|
total: string;
|
|
76
63
|
skip: string;
|
|
77
|
-
};
|
|
64
|
+
} | undefined;
|
|
78
65
|
Calendar?: {
|
|
79
66
|
sunday: string;
|
|
80
67
|
monday: string;
|
|
@@ -92,7 +79,7 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
92
79
|
formattedMonthPattern: string;
|
|
93
80
|
formattedDayPattern: string;
|
|
94
81
|
dateLocale: any;
|
|
95
|
-
};
|
|
82
|
+
} | undefined;
|
|
96
83
|
DatePicker?: {
|
|
97
84
|
sunday: string;
|
|
98
85
|
monday: string;
|
|
@@ -110,7 +97,7 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
110
97
|
formattedMonthPattern: string;
|
|
111
98
|
formattedDayPattern: string;
|
|
112
99
|
dateLocale: any;
|
|
113
|
-
};
|
|
100
|
+
} | undefined;
|
|
114
101
|
DateRangePicker?: {
|
|
115
102
|
last7Days: string;
|
|
116
103
|
sunday: string;
|
|
@@ -129,17 +116,17 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
129
116
|
formattedMonthPattern: string;
|
|
130
117
|
formattedDayPattern: string;
|
|
131
118
|
dateLocale: any;
|
|
132
|
-
};
|
|
119
|
+
} | undefined;
|
|
133
120
|
Picker?: {
|
|
134
121
|
noResultsText: string;
|
|
135
122
|
placeholder: string;
|
|
136
|
-
searchPlaceholder: string;
|
|
123
|
+
searchPlaceholder: string; /** Supported themes */
|
|
137
124
|
checkAll: string;
|
|
138
|
-
};
|
|
125
|
+
} | undefined;
|
|
139
126
|
InputPicker?: {
|
|
140
127
|
newItem: string;
|
|
141
128
|
createOption: string;
|
|
142
|
-
};
|
|
129
|
+
} | undefined;
|
|
143
130
|
Uploader?: {
|
|
144
131
|
inited: string;
|
|
145
132
|
progress: string;
|
|
@@ -147,41 +134,28 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
147
134
|
complete: string;
|
|
148
135
|
emptyFile: string;
|
|
149
136
|
upload: string;
|
|
150
|
-
};
|
|
137
|
+
} | undefined;
|
|
151
138
|
CloseButton?: {
|
|
152
139
|
closeLabel: string;
|
|
153
|
-
};
|
|
140
|
+
} | undefined;
|
|
154
141
|
Breadcrumb?: {
|
|
155
142
|
expandText: string;
|
|
156
|
-
};
|
|
143
|
+
} | undefined;
|
|
157
144
|
Toggle?: {
|
|
158
145
|
on: string;
|
|
159
146
|
off: string;
|
|
160
|
-
};
|
|
147
|
+
} | undefined;
|
|
161
148
|
}>>;
|
|
162
149
|
declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
163
150
|
common?: {
|
|
164
151
|
loading: string;
|
|
165
152
|
emptyMessage: string;
|
|
166
|
-
};
|
|
153
|
+
} | undefined;
|
|
167
154
|
Plaintext?: {
|
|
168
155
|
unfilled: string;
|
|
169
156
|
notSelected: string;
|
|
170
|
-
/**
|
|
171
|
-
* Return the date parsed from string using the given format string.
|
|
172
|
-
*
|
|
173
|
-
* Example:
|
|
174
|
-
*
|
|
175
|
-
* import parse from 'date-fns/parse';
|
|
176
|
-
* import eo from 'date-fns/locale/eo'
|
|
177
|
-
*
|
|
178
|
-
* function parseDate(date, formatStr) {
|
|
179
|
-
* return parse(date, formatStr, new Date(), { locale: eo });
|
|
180
|
-
* }
|
|
181
|
-
*
|
|
182
|
-
* */
|
|
183
157
|
notUploaded: string;
|
|
184
|
-
};
|
|
158
|
+
} | undefined;
|
|
185
159
|
Pagination?: {
|
|
186
160
|
more: string;
|
|
187
161
|
prev: string;
|
|
@@ -191,7 +165,7 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
191
165
|
limit: string;
|
|
192
166
|
total: string;
|
|
193
167
|
skip: string;
|
|
194
|
-
};
|
|
168
|
+
} | undefined;
|
|
195
169
|
Calendar?: {
|
|
196
170
|
sunday: string;
|
|
197
171
|
monday: string;
|
|
@@ -209,7 +183,7 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
209
183
|
formattedMonthPattern: string;
|
|
210
184
|
formattedDayPattern: string;
|
|
211
185
|
dateLocale: any;
|
|
212
|
-
};
|
|
186
|
+
} | undefined;
|
|
213
187
|
DatePicker?: {
|
|
214
188
|
sunday: string;
|
|
215
189
|
monday: string;
|
|
@@ -227,7 +201,7 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
227
201
|
formattedMonthPattern: string;
|
|
228
202
|
formattedDayPattern: string;
|
|
229
203
|
dateLocale: any;
|
|
230
|
-
};
|
|
204
|
+
} | undefined;
|
|
231
205
|
DateRangePicker?: {
|
|
232
206
|
last7Days: string;
|
|
233
207
|
sunday: string;
|
|
@@ -246,17 +220,17 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
246
220
|
formattedMonthPattern: string;
|
|
247
221
|
formattedDayPattern: string;
|
|
248
222
|
dateLocale: any;
|
|
249
|
-
};
|
|
223
|
+
} | undefined;
|
|
250
224
|
Picker?: {
|
|
251
225
|
noResultsText: string;
|
|
252
226
|
placeholder: string;
|
|
253
|
-
searchPlaceholder: string;
|
|
227
|
+
searchPlaceholder: string; /** Supported themes */
|
|
254
228
|
checkAll: string;
|
|
255
|
-
};
|
|
229
|
+
} | undefined;
|
|
256
230
|
InputPicker?: {
|
|
257
231
|
newItem: string;
|
|
258
232
|
createOption: string;
|
|
259
|
-
};
|
|
233
|
+
} | undefined;
|
|
260
234
|
Uploader?: {
|
|
261
235
|
inited: string;
|
|
262
236
|
progress: string;
|
|
@@ -264,17 +238,17 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
264
238
|
complete: string;
|
|
265
239
|
emptyFile: string;
|
|
266
240
|
upload: string;
|
|
267
|
-
};
|
|
241
|
+
} | undefined;
|
|
268
242
|
CloseButton?: {
|
|
269
243
|
closeLabel: string;
|
|
270
|
-
};
|
|
244
|
+
} | undefined;
|
|
271
245
|
Breadcrumb?: {
|
|
272
246
|
expandText: string;
|
|
273
|
-
};
|
|
247
|
+
} | undefined;
|
|
274
248
|
Toggle?: {
|
|
275
249
|
on: string;
|
|
276
250
|
off: string;
|
|
277
|
-
};
|
|
251
|
+
} | undefined;
|
|
278
252
|
}>>;
|
|
279
253
|
declare const CustomProvider: (props: CustomProviderProps) => JSX.Element;
|
|
280
254
|
export { CustomContext, Consumer as CustomConsumer };
|
package/esm/DOMHelper/index.d.ts
CHANGED
|
@@ -16,33 +16,33 @@ declare const DOMHelper: {
|
|
|
16
16
|
ownerDocument: (node: Element) => Document;
|
|
17
17
|
ownerWindow: (componentOrElement: Element) => Window;
|
|
18
18
|
getWindow: (node: any) => Window;
|
|
19
|
-
getContainer: (container: Element | (() => Element), defaultContainer?: Element) => Element;
|
|
19
|
+
getContainer: (container: Element | (() => Element), defaultContainer?: Element | undefined) => Element;
|
|
20
20
|
canUseDOM: boolean;
|
|
21
21
|
contains: (context: Element, node: Node & ParentNode) => boolean;
|
|
22
|
-
scrollTop: (node: Element, val?: number) => number;
|
|
23
|
-
scrollLeft: (node: Element, val?: number) => number;
|
|
22
|
+
scrollTop: (node: Element, val?: number | undefined) => number;
|
|
23
|
+
scrollLeft: (node: Element, val?: number | undefined) => number;
|
|
24
24
|
getOffset: (node: Element) => {
|
|
25
25
|
top: number;
|
|
26
26
|
left: number;
|
|
27
27
|
height: number;
|
|
28
28
|
width: number;
|
|
29
|
-
} | DOMRect;
|
|
29
|
+
} | DOMRect | null;
|
|
30
30
|
nodeName: (node: Element) => string;
|
|
31
31
|
getOffsetParent: (node: Element) => Element;
|
|
32
|
-
getPosition: (node: Element, offsetParent?: Element, calcMargin?: boolean) => DOMRect | {
|
|
32
|
+
getPosition: (node: Element, offsetParent?: Element | undefined, calcMargin?: boolean | undefined) => DOMRect | {
|
|
33
33
|
top: number;
|
|
34
34
|
left: number;
|
|
35
35
|
height: number;
|
|
36
36
|
width: number;
|
|
37
|
-
};
|
|
37
|
+
} | null;
|
|
38
38
|
isOverflowing: (container: Element) => boolean;
|
|
39
|
-
getScrollbarSize: (recalc?: boolean) => number | void;
|
|
40
|
-
getHeight: (node: Element | Window, client?: Element) => number;
|
|
41
|
-
getWidth: (node: Element | Window, client?: Element) => number;
|
|
39
|
+
getScrollbarSize: (recalc?: boolean | undefined) => number | void;
|
|
40
|
+
getHeight: (node: Element | Window, client?: Element | undefined) => number;
|
|
41
|
+
getWidth: (node: Element | Window, client?: Element | undefined) => number;
|
|
42
42
|
isFocusable: typeof helpers.isFocusable;
|
|
43
|
-
getStyle: (node: Element, property?: string) => string | CSSStyleDeclaration;
|
|
43
|
+
getStyle: (node: Element, property?: string | undefined) => string | CSSStyleDeclaration;
|
|
44
44
|
removeStyle: (node: Element, keys: string | string[]) => void;
|
|
45
|
-
addStyle: (node: Element, property: string | import("dom-lib/esm/addStyle").CSSProperty, value?: string | number) => void;
|
|
46
|
-
translateDOMPositionXY: (style: CSSStyleDeclaration, x?: number, y?: number) => CSSStyleDeclaration;
|
|
45
|
+
addStyle: (node: Element, property: string | import("dom-lib/esm/addStyle").CSSProperty, value?: string | number | undefined) => void;
|
|
46
|
+
translateDOMPositionXY: (style: CSSStyleDeclaration, x?: number | undefined, y?: number | undefined) => CSSStyleDeclaration;
|
|
47
47
|
};
|
|
48
48
|
export default DOMHelper;
|
|
@@ -5,7 +5,7 @@ import { FormControlBaseProps, PickerBaseProps, RsRefForwardingComponent } from
|
|
|
5
5
|
export type { RangeType } from './Toolbar';
|
|
6
6
|
export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, FormControlBaseProps<Date> {
|
|
7
7
|
/** Configure shortcut options */
|
|
8
|
-
ranges?: RangeType[];
|
|
8
|
+
ranges?: RangeType<Date>[];
|
|
9
9
|
/** Calendar panel default presentation date and time */
|
|
10
10
|
calendarDefaultDate?: Date;
|
|
11
11
|
/** Format date */
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import isNil from 'lodash/isNil';
|
|
5
6
|
import mapValues from 'lodash/mapValues';
|
|
6
7
|
import pick from 'lodash/pick';
|
|
7
8
|
import omit from 'lodash/omit';
|
|
@@ -92,10 +93,10 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
92
93
|
active = _useState2[0],
|
|
93
94
|
setActive = _useState2[1];
|
|
94
95
|
|
|
95
|
-
var triggerRef = useRef();
|
|
96
|
-
var rootRef = useRef();
|
|
97
|
-
var targetRef = useRef();
|
|
98
|
-
var overlayRef = useRef();
|
|
96
|
+
var triggerRef = useRef(null);
|
|
97
|
+
var rootRef = useRef(null);
|
|
98
|
+
var targetRef = useRef(null);
|
|
99
|
+
var overlayRef = useRef(null);
|
|
99
100
|
usePublicMethods(ref, {
|
|
100
101
|
rootRef: rootRef,
|
|
101
102
|
triggerRef: triggerRef,
|
|
@@ -165,7 +166,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
165
166
|
closeOverlay = true;
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
var nextValue =
|
|
169
|
+
var nextValue = !isNil(nextPageDate) ? nextPageDate : calendarDate;
|
|
169
170
|
setCalendarDate(nextValue || new Date());
|
|
170
171
|
setValue(nextValue);
|
|
171
172
|
|
|
@@ -262,7 +263,9 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
262
263
|
}
|
|
263
264
|
}, [formatStr, handleDateChange, oneTap, calendarDate, setCalendarDate, updateValue]);
|
|
264
265
|
var disabledDate = useCallback(function (date) {
|
|
265
|
-
|
|
266
|
+
var _disabledDateProp;
|
|
267
|
+
|
|
268
|
+
return (_disabledDateProp = disabledDateProp === null || disabledDateProp === void 0 ? void 0 : disabledDateProp(date)) !== null && _disabledDateProp !== void 0 ? _disabledDateProp : false;
|
|
266
269
|
}, [disabledDateProp]);
|
|
267
270
|
/**
|
|
268
271
|
* Callback after the input box value is changed.
|
|
@@ -319,16 +322,18 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
319
322
|
}, [onClose, reset]); // Check whether the time is within the time range of the shortcut option in the toolbar.
|
|
320
323
|
|
|
321
324
|
var disabledToolbarHandle = useCallback(function (date) {
|
|
322
|
-
var
|
|
325
|
+
var _disabledDateProp2;
|
|
323
326
|
|
|
324
|
-
var allowDate = (
|
|
327
|
+
var allowDate = (_disabledDateProp2 = disabledDateProp === null || disabledDateProp === void 0 ? void 0 : disabledDateProp(date)) !== null && _disabledDateProp2 !== void 0 ? _disabledDateProp2 : false;
|
|
325
328
|
var allowTime = DateUtils.disabledTime(props, date);
|
|
326
329
|
return allowDate || allowTime;
|
|
327
330
|
}, [disabledDateProp, props]);
|
|
328
331
|
var calendarProps = useMemo(function () {
|
|
329
332
|
return mapValues(pick(props, DateUtils.calendarOnlyProps), function (disabledOrHiddenTimeFunc) {
|
|
330
333
|
return function (next, date) {
|
|
331
|
-
|
|
334
|
+
var _disabledOrHiddenTime;
|
|
335
|
+
|
|
336
|
+
return (_disabledOrHiddenTime = disabledOrHiddenTimeFunc === null || disabledOrHiddenTimeFunc === void 0 ? void 0 : disabledOrHiddenTimeFunc(next, date)) !== null && _disabledOrHiddenTime !== void 0 ? _disabledOrHiddenTime : false;
|
|
332
337
|
};
|
|
333
338
|
});
|
|
334
339
|
}, [props]);
|
|
@@ -366,6 +371,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
366
371
|
top: top
|
|
367
372
|
};
|
|
368
373
|
return /*#__PURE__*/React.createElement(PickerOverlay, {
|
|
374
|
+
role: "dialog",
|
|
369
375
|
className: classes,
|
|
370
376
|
ref: mergeRefs(overlayRef, speakerRef),
|
|
371
377
|
style: styles,
|
|
@@ -403,7 +409,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
403
409
|
|
|
404
410
|
return (_renderValue = renderValue === null || renderValue === void 0 ? void 0 : renderValue(value, formatStr)) !== null && _renderValue !== void 0 ? _renderValue : formatDate(value, formatStr);
|
|
405
411
|
}, [formatStr, formatDate, placeholder, renderValue, value]);
|
|
406
|
-
var
|
|
412
|
+
var caretAs = useMemo(function () {
|
|
407
413
|
return DateUtils.shouldOnlyTime(formatStr) ? IconClockO : IconCalendar;
|
|
408
414
|
}, [formatStr]);
|
|
409
415
|
return /*#__PURE__*/React.createElement(PickerToggleTrigger, {
|
|
@@ -439,7 +445,8 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
439
445
|
active: active,
|
|
440
446
|
placement: placement,
|
|
441
447
|
disabled: disabled,
|
|
442
|
-
|
|
448
|
+
caretAs: caretAs,
|
|
449
|
+
"aria-haspopup": "dialog"
|
|
443
450
|
}), renderDate())));
|
|
444
451
|
});
|
|
445
452
|
DatePicker.displayName = 'DatePicker';
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { RangeType
|
|
2
|
+
import { StandardProps } from '../@types/common';
|
|
3
|
+
import { RangeType } from './types';
|
|
4
4
|
import { CalendarLocale } from '../locales';
|
|
5
5
|
export type { RangeType } from './types';
|
|
6
|
-
export interface ToolbarProps extends
|
|
6
|
+
export interface ToolbarProps<T = any, Shortcut = T> extends StandardProps {
|
|
7
7
|
hideOkBtn?: boolean;
|
|
8
8
|
locale?: CalendarLocale;
|
|
9
|
-
calendarDate
|
|
10
|
-
ranges
|
|
11
|
-
disabledOkBtn?: (value
|
|
12
|
-
disabledShortcut?: (value
|
|
9
|
+
calendarDate: T;
|
|
10
|
+
ranges?: RangeType<Shortcut>[];
|
|
11
|
+
disabledOkBtn?: (value: T) => boolean;
|
|
12
|
+
disabledShortcut?: (value: T) => boolean;
|
|
13
13
|
onOk?: (event: React.MouseEvent) => void;
|
|
14
|
-
onClickShortcut?: (value:
|
|
14
|
+
onClickShortcut?: (value: Shortcut, closeOverlay: boolean, event: React.MouseEvent) => void;
|
|
15
15
|
}
|
|
16
|
+
declare type ToolbarComponent = React.ForwardRefExoticComponent<ToolbarProps> & {
|
|
17
|
+
<T = any, Shortcut = T>(props: ToolbarProps<T, Shortcut>): React.ReactElement | null;
|
|
18
|
+
};
|
|
16
19
|
/**
|
|
17
20
|
* Toolbar for DatePicker and DateRangePicker
|
|
18
21
|
*/
|
|
19
|
-
declare const Toolbar:
|
|
22
|
+
declare const Toolbar: ToolbarComponent;
|
|
20
23
|
export default Toolbar;
|
|
@@ -10,9 +10,7 @@ import { getDefaultRanges, getRanges } from './utils';
|
|
|
10
10
|
* Toolbar for DatePicker and DateRangePicker
|
|
11
11
|
*/
|
|
12
12
|
var Toolbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
13
|
-
var
|
|
14
|
-
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
15
|
-
className = props.className,
|
|
13
|
+
var className = props.className,
|
|
16
14
|
_props$classPrefix = props.classPrefix,
|
|
17
15
|
classPrefix = _props$classPrefix === void 0 ? 'picker-toolbar' : _props$classPrefix,
|
|
18
16
|
disabledOkBtn = props.disabledOkBtn,
|
|
@@ -23,7 +21,7 @@ var Toolbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
23
21
|
calendarDate = props.calendarDate,
|
|
24
22
|
rangesProp = props.ranges,
|
|
25
23
|
locale = props.locale,
|
|
26
|
-
rest = _objectWithoutPropertiesLoose(props, ["
|
|
24
|
+
rest = _objectWithoutPropertiesLoose(props, ["className", "classPrefix", "disabledOkBtn", "disabledShortcut", "hideOkBtn", "onOk", "onClickShortcut", "calendarDate", "ranges", "locale"]);
|
|
27
25
|
|
|
28
26
|
var _useState = useState(getRanges(props)),
|
|
29
27
|
ranges = _useState[0],
|
|
@@ -66,7 +64,7 @@ var Toolbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
var classes = merge(className, withClassPrefix());
|
|
69
|
-
return /*#__PURE__*/React.createElement(
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
70
68
|
ref: ref,
|
|
71
69
|
className: classes
|
|
72
70
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -82,7 +80,7 @@ var Toolbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
82
80
|
return;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
onClickShortcut === null || onClickShortcut === void 0 ? void 0 : onClickShortcut(value, closeOverlay, event);
|
|
83
|
+
onClickShortcut === null || onClickShortcut === void 0 ? void 0 : onClickShortcut(value, closeOverlay !== null && closeOverlay !== void 0 ? closeOverlay : false, event);
|
|
86
84
|
};
|
|
87
85
|
|
|
88
86
|
return /*#__PURE__*/React.createElement(Button, {
|
|
@@ -99,11 +97,11 @@ Toolbar.propTypes = {
|
|
|
99
97
|
ranges: PropTypes.array,
|
|
100
98
|
className: PropTypes.string,
|
|
101
99
|
classPrefix: PropTypes.string,
|
|
102
|
-
calendarDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.arrayOf(PropTypes.instanceOf(Date))]),
|
|
100
|
+
calendarDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.arrayOf(PropTypes.instanceOf(Date))]).isRequired,
|
|
103
101
|
onClickShortcut: PropTypes.func,
|
|
104
102
|
onOk: PropTypes.func,
|
|
105
103
|
disabledShortcut: PropTypes.func,
|
|
106
104
|
disabledOkBtn: PropTypes.func,
|
|
107
|
-
|
|
105
|
+
hideOkBtn: PropTypes.bool
|
|
108
106
|
};
|
|
109
107
|
export default Toolbar;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export declare type ToolbarValue = Date | [Date?, Date?];
|
|
3
|
-
export interface RangeType {
|
|
3
|
+
export interface RangeType<T> {
|
|
4
4
|
label: ReactNode;
|
|
5
5
|
closeOverlay?: boolean;
|
|
6
|
-
value:
|
|
6
|
+
value: T | ((value: T) => T);
|
|
7
7
|
}
|
|
8
|
-
export interface InnerRange extends Omit<RangeType
|
|
9
|
-
value:
|
|
8
|
+
export interface InnerRange<T> extends Omit<RangeType<T>, 'value'> {
|
|
9
|
+
value: T;
|
|
10
10
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { ToolbarProps } from './Toolbar';
|
|
2
2
|
import { InnerRange } from './types';
|
|
3
3
|
import { CalendarState } from '../Calendar';
|
|
4
|
-
|
|
4
|
+
import { DateRange } from '../DateRangePicker/types';
|
|
5
|
+
export declare function getDefaultRanges<T extends Date | DateRange>(date: T): InnerRange<T>[];
|
|
5
6
|
/**
|
|
6
7
|
* get Toolbar ranges from Toolbar props
|
|
7
8
|
* @param ranges
|
|
8
9
|
* @param calendarDate
|
|
9
10
|
*/
|
|
10
|
-
export declare const getRanges: ({ ranges, calendarDate }: Pick<ToolbarProps,
|
|
11
|
+
export declare const getRanges: <T extends Date | DateRange>({ ranges, calendarDate }: Pick<ToolbarProps<T, T>, "calendarDate" | "ranges">) => InnerRange<T>[];
|
|
11
12
|
export declare const useCalendarState: () => {
|
|
12
|
-
calendarState: CalendarState;
|
|
13
|
+
calendarState: CalendarState | undefined;
|
|
13
14
|
reset: () => void;
|
|
14
15
|
openMonth: () => void;
|
|
15
16
|
openTime: () => void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalendarProps as CalendarCoreProps } from '../Calendar/Calendar';
|
|
3
|
-
import {
|
|
3
|
+
import { DateRange } from './types';
|
|
4
4
|
import { RsRefForwardingComponent, WithAsProps } from '../@types/common';
|
|
5
5
|
import { DatePickerLocale } from '../locales';
|
|
6
|
-
|
|
6
|
+
import { DATERANGE_DISABLED_TARGET } from '../utils';
|
|
7
|
+
declare type OmitCalendarCoreTypes = 'disabledDate' | 'onSelect' | 'onMouseMove' | 'calendarDate' | 'format' | 'locale' | 'onToggleMeridian';
|
|
7
8
|
export interface CalendarProps extends WithAsProps, Omit<CalendarCoreProps, OmitCalendarCoreTypes> {
|
|
8
|
-
calendarDate?:
|
|
9
|
-
disabledDate?: (date: Date, selectValue:
|
|
9
|
+
calendarDate?: DateRange;
|
|
10
|
+
disabledDate?: (date: Date, selectValue: [] | [Date] | [Date, Date], type: DATERANGE_DISABLED_TARGET) => boolean;
|
|
10
11
|
format?: string;
|
|
11
|
-
hoverRangeValue?:
|
|
12
|
+
hoverRangeValue?: DateRange;
|
|
12
13
|
index: number;
|
|
13
14
|
isoWeek?: boolean;
|
|
14
15
|
limitEndYear?: number;
|
|
@@ -17,10 +18,10 @@ export interface CalendarProps extends WithAsProps, Omit<CalendarCoreProps, Omit
|
|
|
17
18
|
onChangeCalendarTime?: (index: number, date: Date) => void;
|
|
18
19
|
onToggleMeridian: (index: number, event: React.MouseEvent) => void;
|
|
19
20
|
onMouseMove?: (date: Date) => void;
|
|
20
|
-
onSelect?: (date: Date, event
|
|
21
|
+
onSelect?: (date: Date, event: React.SyntheticEvent) => void;
|
|
21
22
|
showOneCalendar?: boolean;
|
|
22
23
|
showWeekNumbers?: boolean;
|
|
23
|
-
value?:
|
|
24
|
+
value?: [] | [Date] | [Date, Date];
|
|
24
25
|
}
|
|
25
26
|
declare const Calendar: RsRefForwardingComponent<'div', CalendarProps>;
|
|
26
27
|
export default Calendar;
|