rsuite 5.2.1 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Avatar/styles/index.less +2 -2
- package/AvatarGroup/package.json +7 -0
- package/AvatarGroup/styles/index.less +19 -0
- package/Button/styles/index.less +6 -0
- package/ButtonGroup/styles/index.less +0 -18
- package/CHANGELOG.md +49 -0
- package/CheckTreePicker/styles/index.less +14 -1
- package/PanelGroup/styles/index.less +12 -12
- package/Table/styles/index.less +0 -4
- package/TreePicker/styles/index.less +10 -0
- package/cjs/@types/common.d.ts +9 -8
- package/cjs/@types/utils.d.ts +12 -0
- package/cjs/Affix/Affix.js +5 -5
- 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 +71 -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 +8 -2
- 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 +5 -2
- package/cjs/Calendar/CalendarContext.js +1 -1
- package/cjs/Calendar/TableRow.js +1 -1
- package/cjs/Calendar/TimeDropdown.js +6 -5
- package/cjs/Calendar/types.d.ts +2 -2
- package/cjs/Calendar/useCalendarDate.d.ts +2 -2
- package/cjs/Carousel/Carousel.d.ts +2 -2
- 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 +3 -3
- package/cjs/CheckPicker/CheckPicker.js +4 -4
- package/cjs/CheckTreePicker/CheckTreeNode.d.ts +1 -1
- package/cjs/CheckTreePicker/CheckTreeNode.js +7 -9
- package/cjs/CheckTreePicker/CheckTreePicker.js +34 -27
- 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/CheckboxGroup/CheckboxGroup.js +2 -2
- 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 +15 -9
- 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 +9 -7
- package/cjs/DateRangePicker/Calendar.js +27 -6
- package/cjs/DateRangePicker/DateRangePicker.d.ts +8 -6
- package/cjs/DateRangePicker/DateRangePicker.js +126 -107
- 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.js +4 -2
- package/cjs/Disclosure/DisclosureButton.js +9 -7
- package/cjs/Disclosure/DisclosureContent.js +4 -6
- package/cjs/Disclosure/DisclosureContext.d.ts +2 -2
- 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/DropdownContext.d.ts +2 -2
- package/cjs/Dropdown/DropdownItem.js +3 -2
- package/cjs/Dropdown/DropdownMenu.d.ts +3 -3
- package/cjs/Dropdown/DropdownState.d.ts +1 -1
- package/cjs/Dropdown/DropdownToggle.js +2 -1
- 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/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 +16 -11
- 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/MaskedInput.d.ts +5 -42
- package/cjs/MaskedInput/MaskedInput.js +9 -63
- package/cjs/MaskedInput/TextMask.d.ts +43 -0
- package/cjs/MaskedInput/TextMask.js +80 -0
- 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 +60 -41
- package/cjs/Menu/MenuContext.d.ts +1 -1
- package/cjs/Menu/MenuItem.d.ts +1 -1
- package/cjs/Menu/MenuItem.js +31 -23
- package/cjs/Menu/Menubar.js +8 -8
- package/cjs/Menu/useMenu.js +17 -7
- package/cjs/Modal/Modal.js +12 -6
- package/cjs/Modal/ModalContext.d.ts +2 -2
- package/cjs/Modal/utils.d.ts +1 -1
- package/cjs/Modal/utils.js +12 -15
- package/cjs/MultiCascader/DropdownMenu.d.ts +4 -4
- package/cjs/MultiCascader/MultiCascader.js +6 -6
- package/cjs/MultiCascader/utils.d.ts +14 -14
- package/cjs/Nav/Nav.d.ts +1 -1
- package/cjs/Nav/NavContext.d.ts +1 -1
- 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/Overlay/Modal.d.ts +2 -2
- package/cjs/Overlay/Modal.js +41 -31
- package/cjs/Overlay/ModalManager.d.ts +17 -8
- package/cjs/Overlay/ModalManager.js +11 -20
- package/cjs/Overlay/Overlay.d.ts +2 -2
- package/cjs/Overlay/Overlay.js +1 -1
- package/cjs/Overlay/OverlayTrigger.d.ts +11 -11
- package/cjs/Overlay/OverlayTrigger.js +14 -6
- package/cjs/Overlay/Position.d.ts +3 -3
- package/cjs/Overlay/Position.js +21 -12
- 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/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 +11 -8
- 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/VirtualizedList.d.ts +29 -2
- package/cjs/Picker/propTypes.d.ts +2 -2
- package/cjs/Picker/utils.d.ts +17 -25
- package/cjs/Picker/utils.js +71 -46
- 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 +3 -3
- 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 +5 -2
- package/cjs/Ripple/Ripple.js +1 -1
- package/cjs/SelectPicker/SelectPicker.js +4 -4
- 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/Steps/StepItem.js +2 -2
- package/cjs/TagInput/index.js +1 -1
- package/cjs/Toggle/Toggle.js +1 -1
- package/cjs/Tree/Tree.d.ts +3 -1
- package/cjs/TreePicker/TreeNode.js +6 -8
- package/cjs/TreePicker/TreePicker.js +36 -27
- 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 +2 -0
- package/cjs/index.js +5 -1
- 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/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 +32 -29
- 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/useElementResize.d.ts +1 -1
- package/cjs/utils/useElementResize.js +11 -6
- package/cjs/utils/useFocus.d.ts +2 -2
- package/cjs/utils/usePortal.d.ts +1 -1
- 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 +85 -165
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +85 -165
- package/dist/rsuite.js +468 -445
- 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.LICENSE.txt +9 -0
- package/dist/rsuite.min.js.map +1 -1
- package/esm/@types/common.d.ts +9 -8
- package/esm/@types/utils.d.ts +12 -0
- package/esm/Affix/Affix.js +5 -5
- 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 +54 -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 +7 -2
- 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 +5 -2
- package/esm/Calendar/CalendarContext.js +1 -1
- package/esm/Calendar/TableRow.js +1 -1
- package/esm/Calendar/TimeDropdown.js +5 -4
- package/esm/Calendar/types.d.ts +2 -2
- package/esm/Calendar/useCalendarDate.d.ts +2 -2
- package/esm/Carousel/Carousel.d.ts +2 -2
- 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 +3 -3
- package/esm/CheckPicker/CheckPicker.js +4 -4
- package/esm/CheckTreePicker/CheckTreeNode.d.ts +1 -1
- package/esm/CheckTreePicker/CheckTreeNode.js +4 -7
- package/esm/CheckTreePicker/CheckTreePicker.js +33 -25
- 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/CheckboxGroup/CheckboxGroup.js +2 -2
- 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 +14 -9
- 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 +9 -7
- package/esm/DateRangePicker/Calendar.js +28 -6
- package/esm/DateRangePicker/DateRangePicker.d.ts +8 -6
- package/esm/DateRangePicker/DateRangePicker.js +124 -107
- 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.js +4 -2
- package/esm/Disclosure/DisclosureButton.js +8 -7
- package/esm/Disclosure/DisclosureContent.js +5 -7
- package/esm/Disclosure/DisclosureContext.d.ts +2 -2
- 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/DropdownContext.d.ts +2 -2
- package/esm/Dropdown/DropdownItem.js +3 -2
- package/esm/Dropdown/DropdownMenu.d.ts +3 -3
- package/esm/Dropdown/DropdownState.d.ts +1 -1
- package/esm/Dropdown/DropdownToggle.js +2 -1
- 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/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 +16 -11
- 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/MaskedInput.d.ts +5 -42
- package/esm/MaskedInput/MaskedInput.js +9 -63
- package/esm/MaskedInput/TextMask.d.ts +43 -0
- package/esm/MaskedInput/TextMask.js +67 -0
- 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 +59 -43
- package/esm/Menu/MenuContext.d.ts +1 -1
- package/esm/Menu/MenuItem.d.ts +1 -1
- package/esm/Menu/MenuItem.js +30 -23
- package/esm/Menu/Menubar.js +7 -8
- package/esm/Menu/useMenu.js +17 -7
- package/esm/Modal/Modal.js +12 -6
- package/esm/Modal/ModalContext.d.ts +2 -2
- package/esm/Modal/utils.d.ts +1 -1
- package/esm/Modal/utils.js +11 -12
- package/esm/MultiCascader/DropdownMenu.d.ts +4 -4
- package/esm/MultiCascader/MultiCascader.js +6 -6
- package/esm/MultiCascader/utils.d.ts +14 -14
- package/esm/Nav/Nav.d.ts +1 -1
- package/esm/Nav/NavContext.d.ts +1 -1
- 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/Overlay/Modal.d.ts +2 -2
- package/esm/Overlay/Modal.js +42 -32
- package/esm/Overlay/ModalManager.d.ts +17 -8
- package/esm/Overlay/ModalManager.js +11 -20
- package/esm/Overlay/Overlay.d.ts +2 -2
- package/esm/Overlay/Overlay.js +1 -1
- package/esm/Overlay/OverlayTrigger.d.ts +11 -11
- package/esm/Overlay/OverlayTrigger.js +14 -6
- package/esm/Overlay/Position.d.ts +3 -3
- package/esm/Overlay/Position.js +20 -11
- 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/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 +11 -8
- 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/VirtualizedList.d.ts +29 -2
- package/esm/Picker/propTypes.d.ts +2 -2
- package/esm/Picker/utils.d.ts +17 -25
- package/esm/Picker/utils.js +70 -46
- 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 +3 -3
- 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 +4 -2
- package/esm/Ripple/Ripple.js +1 -1
- package/esm/SelectPicker/SelectPicker.js +4 -4
- 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/Steps/StepItem.js +2 -2
- package/esm/TagInput/index.js +1 -1
- package/esm/Toggle/Toggle.js +1 -1
- package/esm/Tree/Tree.d.ts +3 -1
- package/esm/TreePicker/TreeNode.js +4 -7
- package/esm/TreePicker/TreePicker.js +35 -25
- 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 +2 -0
- package/esm/index.js +1 -0
- 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/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 +32 -29
- 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/useElementResize.d.ts +1 -1
- package/esm/utils/useElementResize.js +12 -5
- package/esm/utils/useFocus.d.ts +2 -2
- package/esm/utils/usePortal.d.ts +1 -1
- 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 +4 -4
- package/styles/index.less +1 -0
|
@@ -21,7 +21,7 @@ export interface UploaderInstance {
|
|
|
21
21
|
}
|
|
22
22
|
export interface UploaderProps extends WithAsProps {
|
|
23
23
|
/** Uploading URL */
|
|
24
|
-
action
|
|
24
|
+
action: string;
|
|
25
25
|
/** File types that can be accepted. See input accept Attribute */
|
|
26
26
|
accept?: string;
|
|
27
27
|
/** Automatically upload files after selecting them */
|
|
@@ -62,7 +62,7 @@ export interface UploaderProps extends WithAsProps {
|
|
|
62
62
|
/** Max file size limit of the preview file */
|
|
63
63
|
maxPreviewFileSize?: number;
|
|
64
64
|
/** You can use a custom element for this component */
|
|
65
|
-
toggleAs?: React.ElementType
|
|
65
|
+
toggleAs?: React.ElementType;
|
|
66
66
|
/** Removable list file */
|
|
67
67
|
removable?: boolean;
|
|
68
68
|
/** File list can be rendered */
|
|
@@ -84,11 +84,11 @@ export interface UploaderProps extends WithAsProps {
|
|
|
84
84
|
/** In the file list, click the callback function for the uploaded file */
|
|
85
85
|
onPreview?: (file: FileType, event: React.SyntheticEvent) => void;
|
|
86
86
|
/** Upload callback function with erro */
|
|
87
|
-
onError?: (status: any, file: FileType, event:
|
|
87
|
+
onError?: (status: any, file: FileType, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
|
88
88
|
/** callback function after successful upload */
|
|
89
|
-
onSuccess?: (response: any, file: FileType, event:
|
|
89
|
+
onSuccess?: (response: any, file: FileType, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
|
90
90
|
/** Callback functions that upload progress change */
|
|
91
|
-
onProgress?: (percent: number, file: FileType, event:
|
|
91
|
+
onProgress?: (percent: number, file: FileType, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
|
92
92
|
/** In the file list, click the callback function to delete a file */
|
|
93
93
|
onRemove?: (file: FileType) => void;
|
|
94
94
|
/** Custom render file information */
|
package/cjs/Uploader/Uploader.js
CHANGED
|
@@ -443,7 +443,7 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
443
443
|
|
|
444
444
|
Uploader.displayName = 'Uploader';
|
|
445
445
|
Uploader.propTypes = {
|
|
446
|
-
action: _propTypes.default.string,
|
|
446
|
+
action: _propTypes.default.string.isRequired,
|
|
447
447
|
accept: _propTypes.default.string,
|
|
448
448
|
autoUpload: _propTypes.default.bool,
|
|
449
449
|
children: _propTypes.default.node,
|
|
@@ -473,7 +473,6 @@ Uploader.propTypes = {
|
|
|
473
473
|
onRemove: _propTypes.default.func,
|
|
474
474
|
maxPreviewFileSize: _propTypes.default.number,
|
|
475
475
|
style: _propTypes.default.object,
|
|
476
|
-
toggleAs: _propTypes.default.elementType,
|
|
477
476
|
renderFileInfo: _propTypes.default.func,
|
|
478
477
|
renderThumbnail: _propTypes.default.func,
|
|
479
478
|
removable: _propTypes.default.bool,
|
package/cjs/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export { default as Badge } from './Badge';
|
|
|
32
32
|
export type { BadgeProps } from './Badge';
|
|
33
33
|
export { default as Avatar } from './Avatar';
|
|
34
34
|
export type { AvatarProps } from './Avatar';
|
|
35
|
+
export { default as AvatarGroup } from './AvatarGroup';
|
|
36
|
+
export type { AvatarGroupProps } from './AvatarGroup';
|
|
35
37
|
export { default as toaster } from './toaster';
|
|
36
38
|
export type { Toaster } from './toaster';
|
|
37
39
|
export { default as Dropdown } from './Dropdown';
|
package/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.CustomProvider = exports.Affix = exports.DOMHelper = exports.Animation = exports.Schema = exports.Footer = exports.Sidebar = exports.Header = exports.Content = exports.Container = exports.FlexboxGrid = exports.Col = exports.Row = exports.Grid = exports.Carousel = exports.Calendar = exports.List = exports.TagGroup = exports.Tag = exports.Timeline = exports.Progress = exports.Table = exports.PanelGroup = exports.Panel = exports.CheckTree = exports.Tree = exports.Rate = exports.RangeSlider = exports.Slider = exports.Uploader = exports.AutoComplete = exports.DateRangePicker = exports.DatePicker = exports.MultiCascader = exports.Cascader = exports.CheckTreePicker = exports.TreePicker = exports.TagInput = exports.TagPicker = exports.InputPicker = exports.CheckPicker = exports.SelectPicker = exports.RadioGroup = exports.Radio = exports.CheckboxGroup = exports.Checkbox = exports.InputGroup = exports.InputNumber = exports.MaskedInput = exports.Input = exports.Form = exports.Toggle = exports.Steps = exports.Pagination = exports.Breadcrumb = exports.Sidenav = exports.Navbar = exports.Nav = exports.Dropdown = exports.toaster = exports.Avatar = exports.Badge = exports.Placeholder = exports.Divider = exports.SafeAnchor = exports.Loader = exports.Drawer = exports.Message = exports.Notification = exports.Modal = exports.Popover = exports.Tooltip = exports.Whisper = exports.ButtonGroup = exports.ButtonToolbar = exports.IconButton = exports.Button = void 0;
|
|
6
|
+
exports.CustomProvider = exports.Affix = exports.DOMHelper = exports.Animation = exports.Schema = exports.Footer = exports.Sidebar = exports.Header = exports.Content = exports.Container = exports.FlexboxGrid = exports.Col = exports.Row = exports.Grid = exports.Carousel = exports.Calendar = exports.List = exports.TagGroup = exports.Tag = exports.Timeline = exports.Progress = exports.Table = exports.PanelGroup = exports.Panel = exports.CheckTree = exports.Tree = exports.Rate = exports.RangeSlider = exports.Slider = exports.Uploader = exports.AutoComplete = exports.DateRangePicker = exports.DatePicker = exports.MultiCascader = exports.Cascader = exports.CheckTreePicker = exports.TreePicker = exports.TagInput = exports.TagPicker = exports.InputPicker = exports.CheckPicker = exports.SelectPicker = exports.RadioGroup = exports.Radio = exports.CheckboxGroup = exports.Checkbox = exports.InputGroup = exports.InputNumber = exports.MaskedInput = exports.Input = exports.Form = exports.Toggle = exports.Steps = exports.Pagination = exports.Breadcrumb = exports.Sidenav = exports.Navbar = exports.Nav = exports.Dropdown = exports.toaster = exports.AvatarGroup = exports.Avatar = exports.Badge = exports.Placeholder = exports.Divider = exports.SafeAnchor = exports.Loader = exports.Drawer = exports.Message = exports.Notification = exports.Modal = exports.Popover = exports.Tooltip = exports.Whisper = exports.ButtonGroup = exports.ButtonToolbar = exports.IconButton = exports.Button = void 0;
|
|
7
7
|
|
|
8
8
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
9
9
|
|
|
@@ -73,6 +73,10 @@ var _Avatar = _interopRequireDefault(require("./Avatar"));
|
|
|
73
73
|
|
|
74
74
|
exports.Avatar = _Avatar.default;
|
|
75
75
|
|
|
76
|
+
var _AvatarGroup = _interopRequireDefault(require("./AvatarGroup"));
|
|
77
|
+
|
|
78
|
+
exports.AvatarGroup = _AvatarGroup.default;
|
|
79
|
+
|
|
76
80
|
var _toaster = _interopRequireDefault(require("./toaster"));
|
|
77
81
|
|
|
78
82
|
exports.toaster = _toaster.default;
|
package/cjs/locales/index.d.ts
CHANGED
|
@@ -19,15 +19,15 @@ declare type PickKeys<T> = {
|
|
|
19
19
|
[keys in keyof T]?: T[keys];
|
|
20
20
|
};
|
|
21
21
|
export declare type Locale = PickKeys<typeof defaultLocale>;
|
|
22
|
-
export declare type CommonLocale =
|
|
22
|
+
export declare type CommonLocale = typeof defaultLocale.common;
|
|
23
23
|
export declare type CalendarLocale = PickKeys<typeof defaultLocale.Calendar>;
|
|
24
24
|
export declare type PlaintextLocale = PickKeys<typeof defaultLocale.Plaintext>;
|
|
25
25
|
export declare type PaginationLocale = PickKeys<typeof defaultLocale.Pagination>;
|
|
26
26
|
export declare type TableLocale = CommonLocale;
|
|
27
27
|
export declare type DatePickerLocale = PickKeys<typeof defaultLocale.DatePicker>;
|
|
28
28
|
export declare type DateRangePickerLocale = PickKeys<typeof defaultLocale.DateRangePicker>;
|
|
29
|
-
export declare type PickerLocale =
|
|
30
|
-
export declare type InputPickerLocale = PickerLocale &
|
|
29
|
+
export declare type PickerLocale = typeof defaultLocale.Picker & CommonLocale;
|
|
30
|
+
export declare type InputPickerLocale = PickerLocale & typeof defaultLocale.InputPicker;
|
|
31
31
|
export declare type UploaderLocale = PickKeys<typeof defaultLocale.Uploader>;
|
|
32
32
|
export declare type CloseButtonLocale = PickKeys<typeof defaultLocale.CloseButton>;
|
|
33
33
|
export declare type BreadcrumbLocale = PickKeys<typeof defaultLocale.Breadcrumb>;
|
|
@@ -18,7 +18,7 @@ export interface NodeProps extends WithAsProps {
|
|
|
18
18
|
onClose?: (event?: React.MouseEvent<HTMLDivElement>) => void;
|
|
19
19
|
}
|
|
20
20
|
interface ToastContainerComponent extends RsRefForwardingComponent<'div', ToastContainerProps> {
|
|
21
|
-
getInstance
|
|
21
|
+
getInstance: (props: ToastContainerProps) => [React.RefObject<ToastContainerInstance>, () => void];
|
|
22
22
|
}
|
|
23
23
|
declare const ToastContainer: ToastContainerComponent;
|
|
24
24
|
export default ToastContainer;
|
|
@@ -30,7 +30,7 @@ var useMessages = function useMessages() {
|
|
|
30
30
|
|
|
31
31
|
var getKey = (0, _react.useCallback)(function (key) {
|
|
32
32
|
if (typeof key === 'undefined' && messages.length) {
|
|
33
|
-
|
|
33
|
+
return messages[messages.length - 1].key;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return key;
|
package/cjs/toaster/toaster.js
CHANGED
|
@@ -48,7 +48,9 @@ toaster.push = function (message, options) {
|
|
|
48
48
|
var container = getContainer(options.placement);
|
|
49
49
|
|
|
50
50
|
if (!container) {
|
|
51
|
-
|
|
51
|
+
var _options$placement;
|
|
52
|
+
|
|
53
|
+
container = createContainer((_options$placement = options.placement) !== null && _options$placement !== void 0 ? _options$placement : '', options);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
return container.current.push(message);
|
|
@@ -29,7 +29,7 @@ var isIE11 = function isIE11() {
|
|
|
29
29
|
exports.isIE11 = isIE11;
|
|
30
30
|
|
|
31
31
|
var isEdge = function isEdge() {
|
|
32
|
-
return _canUseDOM.default && !isIE() &&
|
|
32
|
+
return _canUseDOM.default && !isIE() && 'styleMedia' in window;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
exports.isEdge = isEdge;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare function find(children: React.ReactNode, func: any, context?: any): React.ReactNode;
|
|
3
|
-
export declare function map(children: React.ReactNode, func: any, context?: any): any[];
|
|
4
|
-
export declare function mapCloneElement(children: React.ReactNode, func: any, context?: any): any[];
|
|
3
|
+
export declare function map(children: React.ReactNode, func: any, context?: any): any[] | null | undefined;
|
|
4
|
+
export declare function mapCloneElement(children: React.ReactNode, func: any, context?: any): any[] | null | undefined;
|
|
5
5
|
export declare function count(children: React.ReactChildren): number;
|
|
6
6
|
declare function some(children: React.ReactNode, func: any, context?: any): boolean;
|
|
7
7
|
declare const _default: {
|
package/cjs/utils/ajaxUpload.js
CHANGED
|
@@ -32,15 +32,16 @@ function ajaxUpload(options) {
|
|
|
32
32
|
withCredentials = options.withCredentials,
|
|
33
33
|
disableMultipart = options.disableMultipart;
|
|
34
34
|
var xhr = new XMLHttpRequest();
|
|
35
|
-
var sendableData
|
|
35
|
+
var sendableData;
|
|
36
36
|
xhr.open('POST', url, true);
|
|
37
37
|
|
|
38
38
|
if (!disableMultipart) {
|
|
39
39
|
sendableData = new FormData();
|
|
40
40
|
sendableData.append(name, file, file.name);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
|
|
42
|
+
for (var key in data) {
|
|
43
|
+
sendableData.append(key, data[key]);
|
|
44
|
+
}
|
|
44
45
|
} else {
|
|
45
46
|
sendableData = file;
|
|
46
47
|
}
|
|
@@ -3,7 +3,7 @@ import { TypeAttributes } from '../@types/common';
|
|
|
3
3
|
interface Props {
|
|
4
4
|
ref?: React.Ref<any>;
|
|
5
5
|
message?: React.ReactNode;
|
|
6
|
-
children
|
|
6
|
+
children: React.ReactElement | ((props: any, ref: any) => React.ReactElement);
|
|
7
7
|
placement?: TypeAttributes.Placement;
|
|
8
8
|
}
|
|
9
9
|
export default function appendTooltip({ message, ref, ...rest }: Props): JSX.Element;
|
package/cjs/utils/constants.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const SIZE: string[];
|
|
2
2
|
export declare const STATUS: string[];
|
|
3
3
|
export declare const COLOR: string[];
|
|
4
|
-
export declare const PLACEMENT_4:
|
|
5
|
-
export declare const PLACEMENT_8:
|
|
6
|
-
export declare const PLACEMENT_AUTO:
|
|
7
|
-
export declare const PLACEMENT:
|
|
4
|
+
export declare const PLACEMENT_4: readonly ["top", "bottom", "right", "left"];
|
|
5
|
+
export declare const PLACEMENT_8: readonly ["bottomStart", "bottomEnd", "topStart", "topEnd", "leftStart", "rightStart", "leftEnd", "rightEnd"];
|
|
6
|
+
export declare const PLACEMENT_AUTO: readonly ["auto", "autoVertical", "autoVerticalStart", "autoVerticalEnd", "autoHorizontal", "autoHorizontalStart", "autoHorizontalEnd"];
|
|
7
|
+
export declare const PLACEMENT: readonly ["top", "bottom", "right", "left", "bottomStart", "bottomEnd", "topStart", "topEnd", "leftStart", "rightStart", "leftEnd", "rightEnd", "auto", "autoVertical", "autoVerticalStart", "autoVerticalEnd", "autoHorizontal", "autoHorizontalStart", "autoHorizontalEnd"];
|
|
8
8
|
/**
|
|
9
9
|
* Check Tree Node State
|
|
10
10
|
*/
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
* @param {function} functions to chain
|
|
12
12
|
* @returns {function|undefined}
|
|
13
13
|
*/
|
|
14
|
-
declare function createChainedFunction<T = any>(...funcs: T[]): T;
|
|
14
|
+
declare function createChainedFunction<T = any>(...funcs: (T | null)[]): T;
|
|
15
15
|
export default createChainedFunction;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const KEY_GROUP: string | symbol;
|
|
2
2
|
export declare const KEY_GROUP_TITLE = "groupTitle";
|
|
3
|
-
export default function getDataGroupBy(data: any[], key: string, sort: any): any[];
|
|
3
|
+
export default function getDataGroupBy(data: any[] | undefined, key: string, sort: any): any[];
|
package/cjs/utils/mergeRefs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
declare type CallbackRef<T> = (ref: T | null) => void;
|
|
3
3
|
declare type Ref<T> = React.MutableRefObject<T> | CallbackRef<T>;
|
|
4
|
-
export default function mergeRefs<T>(refA?: Ref<T> | null, refB?: Ref<T
|
|
4
|
+
export default function mergeRefs<T>(refA?: Ref<T | null> | null, refB?: Ref<T | null> | null): React.RefCallback<T>;
|
|
5
5
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function isImage(file: any): boolean;
|
|
2
|
-
declare const _default: (file: File, callback: (result: string | ArrayBuffer) => void) => void;
|
|
2
|
+
declare const _default: (file: File, callback: (result: string | ArrayBuffer | null) => void) => void;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
|
|
1
|
+
import PropTypes, { Requireable, Validator } from 'prop-types';
|
|
2
|
+
declare type ExtractValue<T extends ReadonlyArray<Validator<any>>> = {
|
|
3
|
+
[K in keyof T]: T[K] extends Validator<infer V> ? V : never;
|
|
4
|
+
};
|
|
5
|
+
export declare function tupleType<T extends readonly Validator<any>[]>(...types: T): Requireable<ExtractValue<T>>;
|
|
3
6
|
export declare const refType: PropTypes.Requireable<any>;
|
|
7
|
+
export {};
|
|
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
var ANONYMOUS = '';
|
|
12
12
|
|
|
13
13
|
function createChainableTypeChecker(validate) {
|
|
14
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName
|
|
14
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
|
15
15
|
componentName = componentName || ANONYMOUS;
|
|
16
16
|
propFullName = propFullName || propName;
|
|
17
17
|
|
|
@@ -26,12 +26,13 @@ function createChainableTypeChecker(validate) {
|
|
|
26
26
|
|
|
27
27
|
return null;
|
|
28
28
|
} else {
|
|
29
|
-
return validate(props, propName, componentName, location, propFullName
|
|
29
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
var chainedCheckType = checkType.bind(null, false)
|
|
34
|
-
|
|
33
|
+
var chainedCheckType = Object.assign(checkType.bind(null, false), {
|
|
34
|
+
isRequired: checkType.bind(null, true)
|
|
35
|
+
});
|
|
35
36
|
return chainedCheckType;
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -40,7 +41,7 @@ function tupleType() {
|
|
|
40
41
|
types[_key] = arguments[_key];
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
return createChainableTypeChecker(function (props, propName, componentName, location, propFullName
|
|
44
|
+
return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) {
|
|
44
45
|
var value = props[propName];
|
|
45
46
|
|
|
46
47
|
if (!location) {
|
|
@@ -64,7 +65,7 @@ function tupleType() {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
for (var i = 0; i < value.length; ++i) {
|
|
67
|
-
var error = types[i](value, i, componentName, 'element', propFullName + "[" + i + "]"
|
|
68
|
+
var error = types[i](value, String(i), componentName, 'element', propFullName + "[" + i + "]");
|
|
68
69
|
|
|
69
70
|
if (error) {
|
|
70
71
|
return error;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function reactToString(element: React.ReactElement): string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (value: any, labelKey?: string, valueKey?: string) => object;
|
|
1
|
+
declare const _default: (value: any, labelKey?: string | undefined, valueKey?: string | undefined) => object | null;
|
|
2
2
|
export default _default;
|
package/cjs/utils/treeUtils.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare function getNodeParents(node: any, parentKey?: string, valueKey?:
|
|
|
30
30
|
* @param node
|
|
31
31
|
* @param valueKey
|
|
32
32
|
*/
|
|
33
|
-
export declare function getNodeParentKeys(nodes: TreeNodesType, node: TreeNodeType, valueKey: string):
|
|
33
|
+
export declare function getNodeParentKeys(nodes: TreeNodesType, node: TreeNodeType, valueKey: string): TreeNodeType[];
|
|
34
34
|
export declare function hasVisibleChildren(node: TreeNodeType, childrenKey: string): any;
|
|
35
35
|
/**
|
|
36
36
|
* shallow equal array
|
|
@@ -61,7 +61,7 @@ export declare function createUpdateTreeDataFunction(params: any, { valueKey, ch
|
|
|
61
61
|
childrenKey: any;
|
|
62
62
|
}): (tree: any[]) => any[];
|
|
63
63
|
export declare function findNodeOfTree(data: any, check: any): any;
|
|
64
|
-
export declare function filterNodesOfTree(data: any, check: any):
|
|
64
|
+
export declare function filterNodesOfTree(data: any, check: any): TreeNodeType[];
|
|
65
65
|
/**
|
|
66
66
|
* get all focusable items
|
|
67
67
|
* exclude not visible and disabled node
|
|
@@ -70,7 +70,7 @@ export declare function filterNodesOfTree(data: any, check: any): any[];
|
|
|
70
70
|
* @param isSearching - component is in Searching
|
|
71
71
|
* @returns
|
|
72
72
|
*/
|
|
73
|
-
export declare const getFocusableItems: (filteredData: ItemDataType[], props: PartialTreeProps, isSearching?: boolean) =>
|
|
73
|
+
export declare const getFocusableItems: (filteredData: ItemDataType[], props: PartialTreeProps, isSearching?: boolean | undefined) => TreeNodeType[];
|
|
74
74
|
/**
|
|
75
75
|
* return all focusable Item and active Element index
|
|
76
76
|
* @param focusItemValue
|
|
@@ -82,7 +82,7 @@ export declare const getActiveIndex: (focusItemValue: any, focusItems: any[], va
|
|
|
82
82
|
* @param flattenNodes - flattenData
|
|
83
83
|
*/
|
|
84
84
|
export declare const getActiveItem: (focusItemValue: string | number, flattenNodes: TreeNodesType, valueKey: string) => any;
|
|
85
|
-
export declare const getElementByDataKey: (dataKey: string, treeNodesRefs: any, selector: string) => Element;
|
|
85
|
+
export declare const getElementByDataKey: (dataKey: string, treeNodesRefs: any, selector: string) => Element | null;
|
|
86
86
|
/**
|
|
87
87
|
* focus to specify tree node
|
|
88
88
|
* @param refKey - target node refKey
|
|
@@ -91,7 +91,7 @@ export declare const getElementByDataKey: (dataKey: string, treeNodesRefs: any,
|
|
|
91
91
|
*/
|
|
92
92
|
export declare const focusTreeNode: (refKey: string, treeNodeRefs: any, selector: string) => void;
|
|
93
93
|
export interface FocusPrevOrNextProps {
|
|
94
|
-
focusItemValue: string | number;
|
|
94
|
+
focusItemValue: string | number | null;
|
|
95
95
|
focusableItems: any[];
|
|
96
96
|
treeNodesRefs: any;
|
|
97
97
|
selector: string;
|
|
@@ -111,7 +111,7 @@ export declare const focusPreviousItem: ({ focusItemValue, focusableItems, treeN
|
|
|
111
111
|
export interface ArrowHandlerProps {
|
|
112
112
|
focusItem: TreeNodeType;
|
|
113
113
|
expand: boolean;
|
|
114
|
-
childrenKey
|
|
114
|
+
childrenKey: string;
|
|
115
115
|
onExpand: (focusItem: TreeNodeType) => void;
|
|
116
116
|
onFocusItem: () => void;
|
|
117
117
|
}
|
|
@@ -137,20 +137,21 @@ export declare function rightArrowHandler({ focusItem, expand, childrenKey, onEx
|
|
|
137
137
|
* @param value - activeItem value
|
|
138
138
|
* @param valueKey
|
|
139
139
|
*/
|
|
140
|
-
export declare const getScrollToIndex: (nodes: TreeNodeType[], value: string | number, valueKey: string) => number;
|
|
140
|
+
export declare const getScrollToIndex: (nodes: readonly TreeNodeType[], value: string | number, valueKey: string) => number;
|
|
141
141
|
/**
|
|
142
142
|
* when searching, expand state always return true
|
|
143
143
|
* @param searchKeyword
|
|
144
144
|
* @param expand
|
|
145
145
|
*/
|
|
146
146
|
export declare function getExpandWhenSearching(searchKeyword: string, expand: boolean): boolean;
|
|
147
|
-
|
|
147
|
+
declare function getTreeActiveNode<T extends number | string | undefined>(nodes: TreeNodesType, value: T, valueKey: string): T extends undefined ? undefined : TreeNodeType | undefined;
|
|
148
|
+
export { getTreeActiveNode };
|
|
148
149
|
/**
|
|
149
150
|
* toggle tree node
|
|
150
151
|
* @param param0
|
|
151
152
|
*/
|
|
152
|
-
export declare function toggleExpand({ node, isExpand, expandItemValues, valueKey }: any):
|
|
153
|
-
export declare function getTreeNodeTitle(label: any): string;
|
|
153
|
+
export declare function toggleExpand({ node, isExpand, expandItemValues, valueKey }: any): ItemDataType[];
|
|
154
|
+
export declare function getTreeNodeTitle(label: any): string | undefined;
|
|
154
155
|
/**
|
|
155
156
|
* get all children from flattenNodes object by given parent node
|
|
156
157
|
* @param nodes
|
|
@@ -158,14 +159,14 @@ export declare function getTreeNodeTitle(label: any): string;
|
|
|
158
159
|
*/
|
|
159
160
|
export declare function getChildrenByFlattenNodes(nodes: TreeNodesType, parent: TreeNodeType): TreeNodeType[];
|
|
160
161
|
export declare function useTreeDrag(): {
|
|
161
|
-
dragNode:
|
|
162
|
-
dragOverNodeKey:
|
|
163
|
-
dragNodeKeys:
|
|
164
|
-
dropNodePosition: TREE_NODE_DROP_POSITION;
|
|
165
|
-
setDragNode: (node: ItemDataType) => void;
|
|
166
|
-
setDragOverNodeKey: React.Dispatch<
|
|
167
|
-
setDragNodeKeys: React.Dispatch<React.SetStateAction<
|
|
168
|
-
setDropNodePosition: React.Dispatch<React.SetStateAction<TREE_NODE_DROP_POSITION>>;
|
|
162
|
+
dragNode: ItemDataType | null;
|
|
163
|
+
dragOverNodeKey: null;
|
|
164
|
+
dragNodeKeys: (string | number)[];
|
|
165
|
+
dropNodePosition: TREE_NODE_DROP_POSITION | null;
|
|
166
|
+
setDragNode: (node: ItemDataType | null) => void;
|
|
167
|
+
setDragOverNodeKey: React.Dispatch<React.SetStateAction<null>>;
|
|
168
|
+
setDragNodeKeys: React.Dispatch<React.SetStateAction<(string | number)[]>>;
|
|
169
|
+
setDropNodePosition: React.Dispatch<React.SetStateAction<TREE_NODE_DROP_POSITION | null>>;
|
|
169
170
|
};
|
|
170
171
|
interface FlattenTreeDataProps {
|
|
171
172
|
data: TreeNodeType[];
|
|
@@ -189,44 +190,44 @@ interface UnSerializeListProps {
|
|
|
189
190
|
export declare function useFlattenTreeData({ data, labelKey, valueKey, childrenKey, uncheckableItemValues, callback }: FlattenTreeDataProps): {
|
|
190
191
|
forceUpdate: () => void;
|
|
191
192
|
flattenNodes: TreeNodesType;
|
|
192
|
-
flattenTreeData: (treeData: TreeNodeType[], ref: string, parent?: TreeNodeType, layer?: any) =>
|
|
193
|
-
serializeListOnlyParent: (nodes: TreeNodesType, key: string) =>
|
|
193
|
+
flattenTreeData: (treeData: TreeNodeType[], ref: string, parent?: TreeNodeType | undefined, layer?: any) => never[] | undefined;
|
|
194
|
+
serializeListOnlyParent: (nodes: TreeNodesType, key: string) => (string | number)[];
|
|
194
195
|
unSerializeList: ({ nodes, key, value, cascade, uncheckableItemValues }: UnSerializeListProps) => void;
|
|
195
196
|
formatVirtualizedTreeData: (nodes: TreeNodesType, data: any[], expandItemValues: ItemDataType[], options: {
|
|
196
197
|
cascade?: boolean;
|
|
197
198
|
searchKeyword?: string;
|
|
198
|
-
}) =>
|
|
199
|
+
}) => TreeNodeType[];
|
|
199
200
|
};
|
|
200
201
|
/**
|
|
201
202
|
* A hook that saving every tree node ref
|
|
202
203
|
*/
|
|
203
204
|
export declare function useTreeNodeRefs(): {
|
|
204
205
|
treeNodesRefs: {};
|
|
205
|
-
saveTreeNodeRef: (
|
|
206
|
+
saveTreeNodeRef: (ref: React.Ref<any>, refKey?: string | undefined) => void;
|
|
206
207
|
};
|
|
207
208
|
interface TreeSearchProps {
|
|
208
209
|
labelKey: string;
|
|
209
210
|
childrenKey: string;
|
|
210
|
-
searchKeyword
|
|
211
|
+
searchKeyword?: string;
|
|
211
212
|
data: ItemDataType[];
|
|
212
|
-
searchBy
|
|
213
|
+
searchBy?: (keyword: any, label: any, item: any) => boolean;
|
|
213
214
|
callback?: (keyword: string, data: ItemDataType[], event: React.SyntheticEvent) => void;
|
|
214
215
|
}
|
|
215
216
|
/**
|
|
216
217
|
* A hook that handles tree search filter options
|
|
217
218
|
* @param props
|
|
218
219
|
*/
|
|
219
|
-
export declare function useTreeSearch(props: TreeSearchProps): {
|
|
220
|
+
export declare function useTreeSearch<T extends HTMLElement = HTMLInputElement>(props: TreeSearchProps): {
|
|
220
221
|
searchKeywordState: string;
|
|
221
222
|
filteredData: ItemDataType[];
|
|
222
223
|
setFilteredData: (data: ItemDataType[], searchKeyword: string) => void;
|
|
223
224
|
setSearchKeyword: React.Dispatch<React.SetStateAction<string>>;
|
|
224
|
-
handleSearch: (searchKeyword: string, event: React.
|
|
225
|
+
handleSearch: (searchKeyword: string, event: React.ChangeEvent<T>) => void;
|
|
225
226
|
};
|
|
226
227
|
export declare function useGetTreeNodeChildren(treeData: ItemDataType[], valueKey: string, childrenKey: string): {
|
|
227
228
|
data: ItemDataType[];
|
|
228
229
|
setData: React.Dispatch<React.SetStateAction<ItemDataType[]>>;
|
|
229
|
-
loadingNodeValues:
|
|
230
|
+
loadingNodeValues: never[];
|
|
230
231
|
loadChildren: (node: any, getChildren: any) => void;
|
|
231
232
|
};
|
|
232
233
|
export interface FocusToTreeNodeProps {
|
|
@@ -236,7 +237,7 @@ export interface FocusToTreeNodeProps {
|
|
|
236
237
|
virtualized: boolean;
|
|
237
238
|
container: HTMLDivElement;
|
|
238
239
|
list: ListInstance;
|
|
239
|
-
formattedNodes:
|
|
240
|
+
formattedNodes: TreeNodeType[];
|
|
240
241
|
}
|
|
241
242
|
/**
|
|
242
243
|
* Focus to active tree node.
|
|
@@ -244,4 +245,6 @@ export interface FocusToTreeNodeProps {
|
|
|
244
245
|
*/
|
|
245
246
|
export declare function focusToActiveTreeNode({ list, valueKey, activeNode, virtualized, container, selector, formattedNodes }: FocusToTreeNodeProps): void;
|
|
246
247
|
export declare function isSearching(searchKeyword?: string): boolean;
|
|
247
|
-
export {
|
|
248
|
+
export declare function getTreeNodeIndent(rtl: any, layer: any, absolute?: boolean): {
|
|
249
|
+
[x: string]: number;
|
|
250
|
+
};
|
package/cjs/utils/treeUtils.js
CHANGED
|
@@ -33,6 +33,7 @@ exports.useTreeSearch = useTreeSearch;
|
|
|
33
33
|
exports.useGetTreeNodeChildren = useGetTreeNodeChildren;
|
|
34
34
|
exports.focusToActiveTreeNode = focusToActiveTreeNode;
|
|
35
35
|
exports.isSearching = isSearching;
|
|
36
|
+
exports.getTreeNodeIndent = getTreeNodeIndent;
|
|
36
37
|
exports.getScrollToIndex = exports.focusPreviousItem = exports.focusNextItem = exports.focusTreeNode = exports.getElementByDataKey = exports.getActiveItem = exports.getActiveIndex = exports.getFocusableItems = void 0;
|
|
37
38
|
|
|
38
39
|
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -63,6 +64,8 @@ var _Picker = require("../Picker");
|
|
|
63
64
|
|
|
64
65
|
var _reactToString = _interopRequireDefault(require("./reactToString"));
|
|
65
66
|
|
|
67
|
+
var _constants = require("./constants");
|
|
68
|
+
|
|
66
69
|
// gap of tree node
|
|
67
70
|
var TREE_NODE_GAP = 4;
|
|
68
71
|
/**
|
|
@@ -659,24 +662,21 @@ function getExpandWhenSearching(searchKeyword, expand) {
|
|
|
659
662
|
}
|
|
660
663
|
|
|
661
664
|
function getTreeActiveNode(nodes, value, valueKey) {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
if (!(0, _isUndefined2.default)(value)) {
|
|
665
|
-
Object.keys(nodes).forEach(function (refKey) {
|
|
666
|
-
if ((0, _utils2.shallowEqual)(nodes[refKey][valueKey], value)) {
|
|
667
|
-
activeNode = nodes[refKey];
|
|
668
|
-
}
|
|
669
|
-
});
|
|
665
|
+
if ((0, _isUndefined2.default)(value)) {
|
|
666
|
+
return undefined;
|
|
670
667
|
}
|
|
671
668
|
|
|
672
|
-
|
|
669
|
+
for (var refKey in nodes) {
|
|
670
|
+
if ((0, _utils2.shallowEqual)(nodes[refKey][valueKey], value)) {
|
|
671
|
+
return nodes[refKey];
|
|
672
|
+
}
|
|
673
|
+
}
|
|
673
674
|
}
|
|
675
|
+
|
|
674
676
|
/**
|
|
675
677
|
* toggle tree node
|
|
676
678
|
* @param param0
|
|
677
679
|
*/
|
|
678
|
-
|
|
679
|
-
|
|
680
680
|
function toggleExpand(_ref7) {
|
|
681
681
|
var node = _ref7.node,
|
|
682
682
|
isExpand = _ref7.isExpand,
|
|
@@ -710,7 +710,7 @@ function getTreeNodeTitle(label) {
|
|
|
710
710
|
|
|
711
711
|
|
|
712
712
|
function getChildrenByFlattenNodes(nodes, parent) {
|
|
713
|
-
if ((0, _isNil2.default)(nodes[parent.refKey])) {
|
|
713
|
+
if (!(0, _isNil2.default)(parent.refKey) && (0, _isNil2.default)(nodes[parent.refKey])) {
|
|
714
714
|
return [];
|
|
715
715
|
}
|
|
716
716
|
|
|
@@ -794,7 +794,7 @@ function useFlattenTreeData(_ref8) {
|
|
|
794
794
|
node.refKey = refKey;
|
|
795
795
|
flattenNodes[refKey] = (0, _extends3.default)((_extends2 = {
|
|
796
796
|
layer: layer
|
|
797
|
-
}, _extends2[labelKey] = node[labelKey], _extends2[valueKey] = node[valueKey], _extends2.
|
|
797
|
+
}, _extends2[labelKey] = node[labelKey], _extends2[valueKey] = node[valueKey], _extends2.uncheckable = uncheckableItemValues.some(function (value) {
|
|
798
798
|
return (0, _utils2.shallowEqual)(node[valueKey], value);
|
|
799
799
|
}), _extends2), node);
|
|
800
800
|
|
|
@@ -811,10 +811,8 @@ function useFlattenTreeData(_ref8) {
|
|
|
811
811
|
Object.keys(nodes).forEach(function (refKey) {
|
|
812
812
|
var currentNode = nodes[refKey];
|
|
813
813
|
|
|
814
|
-
if (currentNode.parent) {
|
|
815
|
-
var
|
|
816
|
-
|
|
817
|
-
var parentNode = nodes[(_currentNode$parent = currentNode.parent) === null || _currentNode$parent === void 0 ? void 0 : _currentNode$parent.refKey];
|
|
814
|
+
if (!(0, _isNil2.default)(currentNode.parent) && !(0, _isNil2.default)(currentNode.parent.refKey)) {
|
|
815
|
+
var parentNode = nodes[currentNode.parent.refKey];
|
|
818
816
|
|
|
819
817
|
if (currentNode[key]) {
|
|
820
818
|
if (!(parentNode !== null && parentNode !== void 0 && parentNode.checkAll)) {
|
|
@@ -846,7 +844,7 @@ function useFlattenTreeData(_ref8) {
|
|
|
846
844
|
Object.keys(nodes).forEach(function (refKey) {
|
|
847
845
|
var node = nodes[refKey];
|
|
848
846
|
|
|
849
|
-
if (cascade && node.parent) {
|
|
847
|
+
if (cascade && !(0, _isNil2.default)(node.parent) && !(0, _isNil2.default)(node.parent.refKey)) {
|
|
850
848
|
node[key] = nodes[node.parent.refKey][key];
|
|
851
849
|
} else {
|
|
852
850
|
node[key] = false;
|
|
@@ -928,8 +926,8 @@ function useFlattenTreeData(_ref8) {
|
|
|
928
926
|
function useTreeNodeRefs() {
|
|
929
927
|
var treeNodeRefs = (0, _react.useRef)({});
|
|
930
928
|
|
|
931
|
-
var saveTreeNodeRef = function saveTreeNodeRef(
|
|
932
|
-
if (refKey) {
|
|
929
|
+
var saveTreeNodeRef = function saveTreeNodeRef(ref, refKey) {
|
|
930
|
+
if (!(0, _isNil2.default)(refKey)) {
|
|
933
931
|
treeNodeRefs.current[refKey] = ref;
|
|
934
932
|
}
|
|
935
933
|
};
|
|
@@ -971,11 +969,15 @@ function useTreeSearch(props) {
|
|
|
971
969
|
return data;
|
|
972
970
|
}, [childrenKey, labelKey, searchBy]); // Use search keywords to filter options.
|
|
973
971
|
|
|
974
|
-
var _useState5 = (0, _react.useState)(
|
|
972
|
+
var _useState5 = (0, _react.useState)(function () {
|
|
973
|
+
return searchKeyword !== null && searchKeyword !== void 0 ? searchKeyword : '';
|
|
974
|
+
}),
|
|
975
975
|
searchKeywordState = _useState5[0],
|
|
976
976
|
setSearchKeyword = _useState5[1];
|
|
977
977
|
|
|
978
|
-
var _useState6 = (0, _react.useState)(
|
|
978
|
+
var _useState6 = (0, _react.useState)(function () {
|
|
979
|
+
return filterVisibleData(data, searchKeywordState);
|
|
980
|
+
}),
|
|
979
981
|
filteredData = _useState6[0],
|
|
980
982
|
setFilteredData = _useState6[1];
|
|
981
983
|
|
|
@@ -1068,8 +1070,10 @@ function focusToActiveTreeNode(_ref10) {
|
|
|
1068
1070
|
if (!container) return;
|
|
1069
1071
|
|
|
1070
1072
|
if (virtualized && activeNode) {
|
|
1073
|
+
var _list$scrollToRow;
|
|
1074
|
+
|
|
1071
1075
|
var scrollIndex = getScrollToIndex(formattedNodes, activeNode === null || activeNode === void 0 ? void 0 : activeNode[valueKey], valueKey);
|
|
1072
|
-
list.scrollToRow(scrollIndex);
|
|
1076
|
+
(_list$scrollToRow = list.scrollToRow) === null || _list$scrollToRow === void 0 ? void 0 : _list$scrollToRow.call(list, scrollIndex);
|
|
1073
1077
|
return;
|
|
1074
1078
|
}
|
|
1075
1079
|
|
|
@@ -1084,4 +1088,23 @@ function focusToActiveTreeNode(_ref10) {
|
|
|
1084
1088
|
|
|
1085
1089
|
function isSearching(searchKeyword) {
|
|
1086
1090
|
return !(0, _isEmpty2.default)(searchKeyword);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
function getTreeNodeIndent(rtl, layer, absolute) {
|
|
1094
|
+
var _ref12;
|
|
1095
|
+
|
|
1096
|
+
if (absolute === void 0) {
|
|
1097
|
+
absolute = false;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
// layer start from 1
|
|
1101
|
+
var offset = layer * _constants.TREE_NODE_PADDING + _constants.TREE_NODE_ROOT_PADDING;
|
|
1102
|
+
|
|
1103
|
+
if (absolute) {
|
|
1104
|
+
var _ref11;
|
|
1105
|
+
|
|
1106
|
+
return _ref11 = {}, _ref11[rtl ? 'right' : 'left'] = offset, _ref11;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
return _ref12 = {}, _ref12[rtl ? 'paddingRight' : 'paddingLeft'] = offset, _ref12;
|
|
1087
1110
|
}
|