@ucloud-fe/react-components 1.5.17 → 1.5.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1935 -0
- package/dist/assets/ucicon.eot +0 -0
- package/dist/assets/ucicon.svg +1569 -0
- package/dist/assets/ucicon.ttf +0 -0
- package/dist/assets/ucicon.woff +0 -0
- package/dist/icon.min.css +1 -0
- package/dist/icon.min.js +1 -0
- package/dist/main.min.js +19 -0
- package/lib/__index.js +228 -0
- package/lib/components/ActionList/ActionList.d.ts +40 -0
- package/lib/components/ActionList/ActionList.js +349 -0
- package/lib/components/ActionList/index.d.ts +10 -0
- package/lib/components/ActionList/index.js +23 -0
- package/lib/components/ActionList/style/index.d.ts +3 -0
- package/lib/components/ActionList/style/index.js +45 -0
- package/lib/components/AutoComplete/AutoComplete.d.ts +40 -0
- package/lib/components/AutoComplete/AutoComplete.js +181 -0
- package/lib/components/AutoComplete/Popup.d.ts +19 -0
- package/lib/components/AutoComplete/Popup.js +123 -0
- package/lib/components/AutoComplete/index.d.ts +2 -0
- package/lib/components/AutoComplete/index.js +13 -0
- package/lib/components/AutoComplete/style/index.d.ts +17 -0
- package/lib/components/AutoComplete/style/index.js +55 -0
- package/lib/components/Badge/Badge.d.ts +43 -0
- package/lib/components/Badge/Badge.js +175 -0
- package/lib/components/Badge/Bubble.d.ts +47 -0
- package/lib/components/Badge/Bubble.js +152 -0
- package/lib/components/Badge/index.d.ts +7 -0
- package/lib/components/Badge/index.js +20 -0
- package/lib/components/Badge/placements.d.ts +35 -0
- package/lib/components/Badge/placements.js +43 -0
- package/lib/components/Badge/style/index.d.ts +54 -0
- package/lib/components/Badge/style/index.js +143 -0
- package/lib/components/Box/Box.d.ts +47 -0
- package/lib/components/Box/Box.js +135 -0
- package/lib/components/Box/index.d.ts +2 -0
- package/lib/components/Box/index.js +13 -0
- package/lib/components/Box/style/index.d.ts +1 -0
- package/lib/components/Box/style/index.js +136 -0
- package/lib/components/Breadcrumb/BackButton.d.ts +4 -0
- package/lib/components/Breadcrumb/BackButton.js +24 -0
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +10 -0
- package/lib/components/Breadcrumb/Breadcrumb.js +60 -0
- package/lib/components/Breadcrumb/Item.d.ts +16 -0
- package/lib/components/Breadcrumb/Item.js +62 -0
- package/lib/components/Breadcrumb/index.d.ts +11 -0
- package/lib/components/Breadcrumb/index.js +27 -0
- package/lib/components/Breadcrumb/interface.d.ts +2 -0
- package/lib/components/Breadcrumb/interface.js +11 -0
- package/lib/components/Breadcrumb/style/index.d.ts +20 -0
- package/lib/components/Breadcrumb/style/index.js +104 -0
- package/lib/components/Button/.recodo/interaction.js +64 -0
- package/lib/components/Button/Button.d.ts +54 -0
- package/lib/components/Button/Button.js +132 -0
- package/lib/components/Button/index.d.ts +2 -0
- package/lib/components/Button/index.js +13 -0
- package/lib/components/Button/shared.d.ts +3 -0
- package/lib/components/Button/shared.js +15 -0
- package/lib/components/Button/style/index.d.ts +22 -0
- package/lib/components/Button/style/index.js +240 -0
- package/lib/components/Calendar/Calendar.d.ts +37 -0
- package/lib/components/Calendar/Calendar.js +113 -0
- package/lib/components/Calendar/Cell.d.ts +8 -0
- package/lib/components/Calendar/Cell.js +55 -0
- package/lib/components/Calendar/HeaderButton.d.ts +8 -0
- package/lib/components/Calendar/HeaderButton.js +75 -0
- package/lib/components/Calendar/HeaderSwitcher.d.ts +17 -0
- package/lib/components/Calendar/HeaderSwitcher.js +64 -0
- package/lib/components/Calendar/Month.d.ts +5 -0
- package/lib/components/Calendar/Month.js +93 -0
- package/lib/components/Calendar/TwoSide.d.ts +4 -0
- package/lib/components/Calendar/TwoSide.js +155 -0
- package/lib/components/Calendar/index.d.ts +10 -0
- package/lib/components/Calendar/index.js +26 -0
- package/lib/components/Calendar/locale/en_US.js +30 -0
- package/lib/components/Calendar/locale/zh_CN.d.ts +11 -0
- package/lib/components/Calendar/locale/zh_CN.js +27 -0
- package/lib/components/Calendar/style/index.d.ts +25 -0
- package/lib/components/Calendar/style/index.js +82 -0
- package/lib/components/Calendar/utils.d.ts +16 -0
- package/lib/components/Calendar/utils.js +162 -0
- package/lib/components/Card/Action.js +27 -0
- package/lib/components/Card/Card.js +109 -0
- package/lib/components/Card/Content.js +28 -0
- package/lib/components/Card/Footer.js +28 -0
- package/lib/components/Card/Header.js +40 -0
- package/lib/components/Card/SubArea.js +43 -0
- package/lib/components/Card/index.js +30 -0
- package/lib/components/Card/style/index.js +131 -0
- package/lib/components/Cascader/Cascade.d.ts +24 -0
- package/lib/components/Cascader/Cascade.js +280 -0
- package/lib/components/Cascader/CascadeContext.d.ts +7 -0
- package/lib/components/Cascader/CascadeContext.js +20 -0
- package/lib/components/Cascader/Cascader.d.ts +41 -0
- package/lib/components/Cascader/Cascader.js +359 -0
- package/lib/components/Cascader/Item.d.ts +14 -0
- package/lib/components/Cascader/Item.js +97 -0
- package/lib/components/Cascader/Items.d.ts +11 -0
- package/lib/components/Cascader/Items.js +175 -0
- package/lib/components/Cascader/index.d.ts +2 -0
- package/lib/components/Cascader/index.js +13 -0
- package/lib/components/Cascader/interface.d.ts +12 -0
- package/lib/components/Cascader/interface.js +5 -0
- package/lib/components/Cascader/locale/en_US.js +11 -0
- package/lib/components/Cascader/locale/zh_CN.d.ts +5 -0
- package/lib/components/Cascader/locale/zh_CN.js +11 -0
- package/lib/components/Cascader/style/cascade.d.ts +15 -0
- package/lib/components/Cascader/style/cascade.js +55 -0
- package/lib/components/Cascader/style/index.d.ts +11 -0
- package/lib/components/Cascader/style/index.js +49 -0
- package/lib/components/Checkbox/.recodo/interaction.js +100 -0
- package/lib/components/Checkbox/Checkbox.d.ts +29 -0
- package/lib/components/Checkbox/Checkbox.js +177 -0
- package/lib/components/Checkbox/CheckboxContext.d.ts +8 -0
- package/lib/components/Checkbox/CheckboxContext.js +21 -0
- package/lib/components/Checkbox/CheckboxIcon.d.ts +7 -0
- package/lib/components/Checkbox/CheckboxIcon.js +42 -0
- package/lib/components/Checkbox/Group.d.ts +26 -0
- package/lib/components/Checkbox/Group.js +108 -0
- package/lib/components/Checkbox/index.d.ts +13 -0
- package/lib/components/Checkbox/index.js +28 -0
- package/lib/components/Checkbox/interface.d.ts +8 -0
- package/lib/components/Checkbox/interface.js +17 -0
- package/lib/components/Checkbox/style/index.d.ts +31 -0
- package/lib/components/Checkbox/style/index.js +81 -0
- package/lib/components/Col/index.js +14 -0
- package/lib/components/Collapse/Collapse.d.ts +19 -0
- package/lib/components/Collapse/Collapse.js +63 -0
- package/lib/components/Collapse/CollapseContext.d.ts +4 -0
- package/lib/components/Collapse/CollapseContext.js +17 -0
- package/lib/components/Collapse/Panel.d.ts +29 -0
- package/lib/components/Collapse/Panel.js +98 -0
- package/lib/components/Collapse/hooks.d.ts +29 -0
- package/lib/components/Collapse/hooks.js +103 -0
- package/lib/components/Collapse/index.d.ts +9 -0
- package/lib/components/Collapse/index.js +26 -0
- package/lib/components/Collapse/style/index.d.ts +6 -0
- package/lib/components/Collapse/style/index.js +39 -0
- package/lib/components/Combine/Combine.d.ts +19 -0
- package/lib/components/Combine/Combine.js +80 -0
- package/lib/components/Combine/index.d.ts +3 -0
- package/lib/components/Combine/index.js +13 -0
- package/lib/components/Combine/style/index.d.ts +6 -0
- package/lib/components/Combine/style/index.js +60 -0
- package/lib/components/Compact/Compact.js +108 -0
- package/lib/components/Compact/index.js +13 -0
- package/lib/components/Compact/style/index.js +16 -0
- package/lib/components/ConfigProvider/ConfigContext.d.ts +9 -0
- package/lib/components/ConfigProvider/ConfigContext.js +24 -0
- package/lib/components/ConfigProvider/ConfigProvider.d.ts +40 -0
- package/lib/components/ConfigProvider/ConfigProvider.js +75 -0
- package/lib/components/ConfigProvider/index.d.ts +4 -0
- package/lib/components/ConfigProvider/index.js +20 -0
- package/lib/components/DatePicker/DatePicker.d.ts +73 -0
- package/lib/components/DatePicker/DatePicker.js +168 -0
- package/lib/components/DatePicker/Footer.d.ts +23 -0
- package/lib/components/DatePicker/Footer.js +96 -0
- package/lib/components/DatePicker/Month.d.ts +5 -0
- package/lib/components/DatePicker/Month.js +88 -0
- package/lib/components/DatePicker/Range.d.ts +101 -0
- package/lib/components/DatePicker/Range.js +549 -0
- package/lib/components/DatePicker/index.d.ts +11 -0
- package/lib/components/DatePicker/index.js +23 -0
- package/lib/components/DatePicker/locale/en_US.js +26 -0
- package/lib/components/DatePicker/locale/zh_CN.d.ts +20 -0
- package/lib/components/DatePicker/locale/zh_CN.js +26 -0
- package/lib/components/DatePicker/style/index.d.ts +62 -0
- package/lib/components/DatePicker/style/index.js +193 -0
- package/lib/components/DatePicker/usePicker.d.ts +11 -0
- package/lib/components/DatePicker/usePicker.js +424 -0
- package/lib/components/DatePicker/useRangePicker.d.ts +18 -0
- package/lib/components/DatePicker/useRangePicker.js +111 -0
- package/lib/components/DatePicker/utils.d.ts +18 -0
- package/lib/components/DatePicker/utils.js +143 -0
- package/lib/components/Drawer/Drawer.js +252 -0
- package/lib/components/Drawer/index.js +13 -0
- package/lib/components/Drawer/style/index.js +82 -0
- package/lib/components/EditableList/EditableList.js +277 -0
- package/lib/components/EditableList/index.js +13 -0
- package/lib/components/EditableList/locale/en_US.js +10 -0
- package/lib/components/EditableList/locale/zh_CN.js +10 -0
- package/lib/components/EditableList/style/index.js +28 -0
- package/lib/components/EditableTable/EditableTable.js +227 -0
- package/lib/components/EditableTable/index.js +13 -0
- package/lib/components/EditableTable/style/index.js +60 -0
- package/lib/components/Form/ControllerContext.d.ts +5 -0
- package/lib/components/Form/ControllerContext.js +15 -0
- package/lib/components/Form/Form.js +95 -0
- package/lib/components/Form/Group.js +89 -0
- package/lib/components/Form/Item.d.ts +37 -0
- package/lib/components/Form/Item.js +243 -0
- package/lib/components/Form/ItemContext.d.ts +3 -0
- package/lib/components/Form/ItemContext.js +15 -0
- package/lib/components/Form/ItemPropsWrap.js +44 -0
- package/lib/components/Form/SubArea.js +48 -0
- package/lib/components/Form/index.js +22 -0
- package/lib/components/Form/style/index.d.ts +59 -0
- package/lib/components/Form/style/index.js +229 -0
- package/lib/components/Grid/Col.d.ts +16 -0
- package/lib/components/Grid/Col.js +51 -0
- package/lib/components/Grid/Row.d.ts +17 -0
- package/lib/components/Grid/Row.js +68 -0
- package/lib/components/Grid/index.d.ts +8 -0
- package/lib/components/Grid/index.js +30 -0
- package/lib/components/Grid/style/index.d.ts +2 -0
- package/lib/components/Grid/style/index.js +143 -0
- package/lib/components/Icon/Icon.d.ts +11 -0
- package/lib/components/Icon/Icon.js +65 -0
- package/lib/components/Icon/index.d.ts +2 -0
- package/lib/components/Icon/index.js +13 -0
- package/lib/components/Icon/style/index.d.ts +7 -0
- package/lib/components/Icon/style/index.js +34 -0
- package/lib/components/Input/.recodo/interaction.js +96 -0
- package/lib/components/Input/Input.d.ts +45 -0
- package/lib/components/Input/Input.js +173 -0
- package/lib/components/Input/Search.d.ts +8 -0
- package/lib/components/Input/Search.js +82 -0
- package/lib/components/Input/index.d.ts +12 -0
- package/lib/components/Input/index.js +37 -0
- package/lib/components/Input/style/index.d.ts +34 -0
- package/lib/components/Input/style/index.js +169 -0
- package/lib/components/Link/Button.d.ts +24 -0
- package/lib/components/Link/Button.js +114 -0
- package/lib/components/Link/Link.d.ts +9 -0
- package/lib/components/Link/Link.js +30 -0
- package/lib/components/Link/index.d.ts +9 -0
- package/lib/components/Link/index.js +20 -0
- package/lib/components/Link/style/index.d.ts +3 -0
- package/lib/components/Link/style/index.js +35 -0
- package/lib/components/Loading/Loading.d.ts +27 -0
- package/lib/components/Loading/Loading.js +108 -0
- package/lib/components/Loading/index.d.ts +2 -0
- package/lib/components/Loading/index.js +13 -0
- package/lib/components/Loading/style/index.d.ts +8 -0
- package/lib/components/Loading/style/index.js +89 -0
- package/lib/components/LocaleProvider/LocaleContext.d.ts +9 -0
- package/lib/components/LocaleProvider/LocaleContext.js +15 -0
- package/lib/components/LocaleProvider/LocaleProvider.d.ts +7 -0
- package/lib/components/LocaleProvider/LocaleProvider.js +44 -0
- package/lib/components/LocaleProvider/index.d.ts +12 -0
- package/lib/components/LocaleProvider/index.js +20 -0
- package/lib/components/LocaleProvider/locale/en_US.js +55 -0
- package/lib/components/LocaleProvider/locale/zh_CN.js +55 -0
- package/lib/components/LocaleProvider/localeConsumerDecorator.d.ts +11 -0
- package/lib/components/LocaleProvider/localeConsumerDecorator.js +78 -0
- package/lib/components/LocaleProvider/runtime.d.ts +4 -0
- package/lib/components/LocaleProvider/runtime.js +28 -0
- package/lib/components/LocaleProvider/useLocale.d.ts +6 -0
- package/lib/components/LocaleProvider/useLocale.js +44 -0
- package/lib/components/Menu/Item.d.ts +20 -0
- package/lib/components/Menu/Item.js +107 -0
- package/lib/components/Menu/Menu.d.ts +59 -0
- package/lib/components/Menu/Menu.js +386 -0
- package/lib/components/Menu/MenuContext.d.ts +8 -0
- package/lib/components/Menu/MenuContext.js +27 -0
- package/lib/components/Menu/SubMenu.d.ts +20 -0
- package/lib/components/Menu/SubMenu.js +128 -0
- package/lib/components/Menu/index.d.ts +19 -0
- package/lib/components/Menu/index.js +35 -0
- package/lib/components/Menu/locale/en_US.js +10 -0
- package/lib/components/Menu/locale/zh_CN.d.ts +4 -0
- package/lib/components/Menu/locale/zh_CN.js +10 -0
- package/lib/components/Menu/style/index.d.ts +36 -0
- package/lib/components/Menu/style/index.js +117 -0
- package/lib/components/Message/Message.js +158 -0
- package/lib/components/Message/MessageContainer.js +145 -0
- package/lib/components/Message/index.js +22 -0
- package/lib/components/Message/method.js +232 -0
- package/lib/components/Message/style/index.js +141 -0
- package/lib/components/Modal/Content.js +57 -0
- package/lib/components/Modal/Modal.js +287 -0
- package/lib/components/Modal/index.js +25 -0
- package/lib/components/Modal/locale/en_US.js +11 -0
- package/lib/components/Modal/locale/zh_CN.js +11 -0
- package/lib/components/Modal/method.js +436 -0
- package/lib/components/Modal/style/index.js +137 -0
- package/lib/components/Notice/Notice.d.ts +16 -0
- package/lib/components/Notice/Notice.js +126 -0
- package/lib/components/Notice/index.d.ts +16 -0
- package/lib/components/Notice/index.js +23 -0
- package/lib/components/Notice/style/index.d.ts +12 -0
- package/lib/components/Notice/style/index.js +90 -0
- package/lib/components/NumberInput/NumberInput.d.ts +149 -0
- package/lib/components/NumberInput/NumberInput.js +936 -0
- package/lib/components/NumberInput/index.d.ts +2 -0
- package/lib/components/NumberInput/index.js +13 -0
- package/lib/components/NumberInput/style/index.d.ts +9 -0
- package/lib/components/NumberInput/style/index.js +92 -0
- package/lib/components/Pagination/Options.js +205 -0
- package/lib/components/Pagination/Pager.js +65 -0
- package/lib/components/Pagination/Pagination.js +664 -0
- package/lib/components/Pagination/index.js +13 -0
- package/lib/components/Pagination/locale/en_US.js +23 -0
- package/lib/components/Pagination/locale/zh_CN.js +23 -0
- package/lib/components/Pagination/style/index.js +40 -0
- package/lib/components/PopConfirm/PopConfirm.d.ts +11 -0
- package/lib/components/PopConfirm/PopConfirm.js +119 -0
- package/lib/components/PopConfirm/index.d.ts +2 -0
- package/lib/components/PopConfirm/index.js +13 -0
- package/lib/components/PopConfirm/locale/en_US.js +11 -0
- package/lib/components/PopConfirm/locale/zh_CN.d.ts +5 -0
- package/lib/components/PopConfirm/locale/zh_CN.js +11 -0
- package/lib/components/PopConfirm/style/index.d.ts +10 -0
- package/lib/components/PopConfirm/style/index.js +70 -0
- package/lib/components/Popover/ContainerContext.d.ts +8 -0
- package/lib/components/Popover/ContainerContext.js +52 -0
- package/lib/components/Popover/Popover.d.ts +187 -0
- package/lib/components/Popover/Popover.js +380 -0
- package/lib/components/Popover/index.d.ts +3 -0
- package/lib/components/Popover/index.js +51 -0
- package/lib/components/Popover/placements.d.ts +183 -0
- package/lib/components/Popover/placements.js +96 -0
- package/lib/components/Popover/style/index.d.ts +17 -0
- package/lib/components/Popover/style/index.js +96 -0
- package/lib/components/Progress/Progress.js +95 -0
- package/lib/components/Progress/index.js +13 -0
- package/lib/components/Progress/style/index.js +75 -0
- package/lib/components/Radio/Button.js +30 -0
- package/lib/components/Radio/Card.d.ts +12 -0
- package/lib/components/Radio/Card.js +58 -0
- package/lib/components/Radio/Group.js +181 -0
- package/lib/components/Radio/Radio.js +380 -0
- package/lib/components/Radio/RadioIcon.d.ts +6 -0
- package/lib/components/Radio/RadioIcon.js +37 -0
- package/lib/components/Radio/Tag.js +30 -0
- package/lib/components/Radio/index.js +22 -0
- package/lib/components/Radio/style/index.d.ts +26 -0
- package/lib/components/Radio/style/index.js +260 -0
- package/lib/components/Row/index.js +14 -0
- package/lib/components/Select/Extra.d.ts +11 -0
- package/lib/components/Select/Extra.js +56 -0
- package/lib/components/Select/Group.d.ts +20 -0
- package/lib/components/Select/Group.js +46 -0
- package/lib/components/Select/Option.d.ts +24 -0
- package/lib/components/Select/Option.js +64 -0
- package/lib/components/Select/Overflow.d.ts +19 -0
- package/lib/components/Select/Overflow.js +114 -0
- package/lib/components/Select/Select.d.ts +126 -0
- package/lib/components/Select/Select.js +1452 -0
- package/lib/components/Select/SelectContext.d.ts +8 -0
- package/lib/components/Select/SelectContext.js +33 -0
- package/lib/components/Select/index.d.ts +21 -0
- package/lib/components/Select/index.js +27 -0
- package/lib/components/Select/locale/en_US.js +14 -0
- package/lib/components/Select/locale/zh_CN.d.ts +8 -0
- package/lib/components/Select/locale/zh_CN.js +14 -0
- package/lib/components/Select/style/index.d.ts +85 -0
- package/lib/components/Select/style/index.js +254 -0
- package/lib/components/Skeleton/Skeleton.d.ts +11 -0
- package/lib/components/Skeleton/Skeleton.js +64 -0
- package/lib/components/Skeleton/index.d.ts +2 -0
- package/lib/components/Skeleton/index.js +13 -0
- package/lib/components/Skeleton/style/index.d.ts +9 -0
- package/lib/components/Skeleton/style/index.js +41 -0
- package/lib/components/Slider/Slider.js +781 -0
- package/lib/components/Slider/index.js +13 -0
- package/lib/components/Slider/locale/en_US.js +19 -0
- package/lib/components/Slider/locale/zh_CN.js +19 -0
- package/lib/components/Slider/style/index.js +45 -0
- package/lib/components/Spin/Spin.js +29 -0
- package/lib/components/Spin/index.js +13 -0
- package/lib/components/Spin/style/index.js +18 -0
- package/lib/components/Steps/Link.js +71 -0
- package/lib/components/Steps/Step.js +80 -0
- package/lib/components/Steps/StepIcon.js +115 -0
- package/lib/components/Steps/Steps.js +147 -0
- package/lib/components/Steps/index.js +13 -0
- package/lib/components/Steps/style/index.js +141 -0
- package/lib/components/SvgIcon/SvgIcon.d.ts +29 -0
- package/lib/components/SvgIcon/SvgIcon.js +248 -0
- package/lib/components/SvgIcon/SvgIconWrap.d.ts +21 -0
- package/lib/components/SvgIcon/SvgIconWrap.js +83 -0
- package/lib/components/SvgIcon/icons/ArrowDown.d.ts +3 -0
- package/lib/components/SvgIcon/icons/ArrowDown.js +24 -0
- package/lib/components/SvgIcon/icons/ArrowLeft.d.ts +3 -0
- package/lib/components/SvgIcon/icons/ArrowLeft.js +25 -0
- package/lib/components/SvgIcon/icons/ArrowRight.d.ts +3 -0
- package/lib/components/SvgIcon/icons/ArrowRight.js +24 -0
- package/lib/components/SvgIcon/icons/ArrowUp.d.ts +3 -0
- package/lib/components/SvgIcon/icons/ArrowUp.js +24 -0
- package/lib/components/SvgIcon/icons/Calendar.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Calendar.js +23 -0
- package/lib/components/SvgIcon/icons/Circle.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Circle.js +25 -0
- package/lib/components/SvgIcon/icons/CircleCrossFill.d.ts +3 -0
- package/lib/components/SvgIcon/icons/CircleCrossFill.js +23 -0
- package/lib/components/SvgIcon/icons/CircleMarkFill.d.ts +3 -0
- package/lib/components/SvgIcon/icons/CircleMarkFill.js +23 -0
- package/lib/components/SvgIcon/icons/CircleYesMdFill.d.ts +3 -0
- package/lib/components/SvgIcon/icons/CircleYesMdFill.js +23 -0
- package/lib/components/SvgIcon/icons/Clock.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Clock.js +23 -0
- package/lib/components/SvgIcon/icons/Cog.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Cog.js +24 -0
- package/lib/components/SvgIcon/icons/Cross.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Cross.js +23 -0
- package/lib/components/SvgIcon/icons/CrossBold.d.ts +3 -0
- package/lib/components/SvgIcon/icons/CrossBold.js +23 -0
- package/lib/components/SvgIcon/icons/CrossCircle.d.ts +3 -0
- package/lib/components/SvgIcon/icons/CrossCircle.js +23 -0
- package/lib/components/SvgIcon/icons/CrossCircleFilled.d.ts +3 -0
- package/lib/components/SvgIcon/icons/CrossCircleFilled.js +23 -0
- package/lib/components/SvgIcon/icons/DottedLineArrowRight.d.ts +3 -0
- package/lib/components/SvgIcon/icons/DottedLineArrowRight.js +23 -0
- package/lib/components/SvgIcon/icons/DoubleArrowLeft.d.ts +3 -0
- package/lib/components/SvgIcon/icons/DoubleArrowLeft.js +24 -0
- package/lib/components/SvgIcon/icons/DoubleArrowRight.d.ts +3 -0
- package/lib/components/SvgIcon/icons/DoubleArrowRight.js +24 -0
- package/lib/components/SvgIcon/icons/Dragger.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Dragger.js +23 -0
- package/lib/components/SvgIcon/icons/Ellipsis.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Ellipsis.js +23 -0
- package/lib/components/SvgIcon/icons/ExclamationCircleFilled.d.ts +3 -0
- package/lib/components/SvgIcon/icons/ExclamationCircleFilled.js +24 -0
- package/lib/components/SvgIcon/icons/Eye.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Eye.js +23 -0
- package/lib/components/SvgIcon/icons/Filter.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Filter.js +23 -0
- package/lib/components/SvgIcon/icons/Horz.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Horz.js +27 -0
- package/lib/components/SvgIcon/icons/InfoCircleFilled.d.ts +3 -0
- package/lib/components/SvgIcon/icons/InfoCircleFilled.js +24 -0
- package/lib/components/SvgIcon/icons/LineArrowDown.d.ts +3 -0
- package/lib/components/SvgIcon/icons/LineArrowDown.js +23 -0
- package/lib/components/SvgIcon/icons/LineArrowUp.d.ts +3 -0
- package/lib/components/SvgIcon/icons/LineArrowUp.js +23 -0
- package/lib/components/SvgIcon/icons/LoadingLIne.js +24 -0
- package/lib/components/SvgIcon/icons/LoadingLine.d.ts +3 -0
- package/lib/components/SvgIcon/icons/LoadingLine.js +24 -0
- package/lib/components/SvgIcon/icons/Minus.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Minus.js +24 -0
- package/lib/components/SvgIcon/icons/Plus.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Plus.js +23 -0
- package/lib/components/SvgIcon/icons/QuestionCircle.d.ts +3 -0
- package/lib/components/SvgIcon/icons/QuestionCircle.js +24 -0
- package/lib/components/SvgIcon/icons/Refresh.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Refresh.js +23 -0
- package/lib/components/SvgIcon/icons/RingLoading.d.ts +3 -0
- package/lib/components/SvgIcon/icons/RingLoading.js +23 -0
- package/lib/components/SvgIcon/icons/Search.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Search.js +23 -0
- package/lib/components/SvgIcon/icons/Sort.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Sort.js +23 -0
- package/lib/components/SvgIcon/icons/Tick.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Tick.js +23 -0
- package/lib/components/SvgIcon/icons/TickCircleFilled.d.ts +3 -0
- package/lib/components/SvgIcon/icons/TickCircleFilled.js +23 -0
- package/lib/components/SvgIcon/icons/TickSmall.d.ts +3 -0
- package/lib/components/SvgIcon/icons/TickSmall.js +23 -0
- package/lib/components/SvgIcon/icons/Trash.d.ts +3 -0
- package/lib/components/SvgIcon/icons/Trash.js +23 -0
- package/lib/components/SvgIcon/icons/TriangleDown.d.ts +3 -0
- package/lib/components/SvgIcon/icons/TriangleDown.js +23 -0
- package/lib/components/SvgIcon/icons/TriangleLeft.d.ts +3 -0
- package/lib/components/SvgIcon/icons/TriangleLeft.js +24 -0
- package/lib/components/SvgIcon/icons/TriangleRight.d.ts +3 -0
- package/lib/components/SvgIcon/icons/TriangleRight.js +23 -0
- package/lib/components/SvgIcon/icons/TriangleUp.d.ts +3 -0
- package/lib/components/SvgIcon/icons/TriangleUp.js +23 -0
- package/lib/components/SvgIcon/index.d.ts +2 -0
- package/lib/components/SvgIcon/index.js +13 -0
- package/lib/components/SvgIcon/style/index.d.ts +1 -0
- package/lib/components/SvgIcon/style/index.js +35 -0
- package/lib/components/Switch/Switch.d.ts +19 -0
- package/lib/components/Switch/Switch.js +93 -0
- package/lib/components/Switch/index.d.ts +3 -0
- package/lib/components/Switch/index.js +15 -0
- package/lib/components/Switch/style/index.d.ts +16 -0
- package/lib/components/Switch/style/index.js +77 -0
- package/lib/components/Table/ActionList.js +14 -0
- package/lib/components/Table/ColumnConfigButton.js +267 -0
- package/lib/components/Table/DragWrap.d.ts +42 -0
- package/lib/components/Table/DragWrap.js +64 -0
- package/lib/components/Table/ExpandedRowContent.js +55 -0
- package/lib/components/Table/HoverDisplayArea.js +69 -0
- package/lib/components/Table/ResizableTH.js +214 -0
- package/lib/components/Table/SearchInput.js +69 -0
- package/lib/components/Table/Table.js +1808 -0
- package/lib/components/Table/TableRow.d.ts +9 -0
- package/lib/components/Table/TableRow.js +98 -0
- package/lib/components/Table/index.js +37 -0
- package/lib/components/Table/locale/en_US.js +23 -0
- package/lib/components/Table/locale/zh_CN.js +23 -0
- package/lib/components/Table/style/index.js +200 -0
- package/lib/components/Table/utils.js +53 -0
- package/lib/components/Tabs/Pane.d.ts +30 -0
- package/lib/components/Tabs/Pane.js +75 -0
- package/lib/components/Tabs/RefContext.d.ts +8 -0
- package/lib/components/Tabs/RefContext.js +33 -0
- package/lib/components/Tabs/TabBar.d.ts +13 -0
- package/lib/components/Tabs/TabBar.js +663 -0
- package/lib/components/Tabs/TabContent.d.ts +12 -0
- package/lib/components/Tabs/TabContent.js +77 -0
- package/lib/components/Tabs/Tabs.d.ts +27 -0
- package/lib/components/Tabs/Tabs.js +238 -0
- package/lib/components/Tabs/index.d.ts +23 -0
- package/lib/components/Tabs/index.js +28 -0
- package/lib/components/Tabs/shared.d.ts +12 -0
- package/lib/components/Tabs/shared.js +19 -0
- package/lib/components/Tabs/style/index.d.ts +6 -0
- package/lib/components/Tabs/style/index.js +67 -0
- package/lib/components/Tabs/utils.d.ts +5 -0
- package/lib/components/Tabs/utils.js +36 -0
- package/lib/components/Tag/Group.d.ts +16 -0
- package/lib/components/Tag/Group.js +68 -0
- package/lib/components/Tag/Icon.d.ts +33 -0
- package/lib/components/Tag/Icon.js +102 -0
- package/lib/components/Tag/Tag.d.ts +52 -0
- package/lib/components/Tag/Tag.js +132 -0
- package/lib/components/Tag/index.d.ts +8 -0
- package/lib/components/Tag/index.js +23 -0
- package/lib/components/Tag/style/index.d.ts +110 -0
- package/lib/components/Tag/style/index.js +241 -0
- package/lib/components/Textarea/Textarea.d.ts +12 -0
- package/lib/components/Textarea/Textarea.js +64 -0
- package/lib/components/Textarea/index.d.ts +2 -0
- package/lib/components/Textarea/index.js +13 -0
- package/lib/components/Textarea/style/index.d.ts +1 -0
- package/lib/components/Textarea/style/index.js +32 -0
- package/lib/components/ThemeProvider/ThemeProvider.d.ts +21 -0
- package/lib/components/ThemeProvider/ThemeProvider.js +145 -0
- package/lib/components/ThemeProvider/dark.js +15 -0
- package/lib/components/ThemeProvider/designTokens.d.ts +269 -0
- package/lib/components/ThemeProvider/designTokens.js +543 -0
- package/lib/components/ThemeProvider/designTokensDark.d.ts +269 -0
- package/lib/components/ThemeProvider/designTokensDark.js +543 -0
- package/lib/components/ThemeProvider/green.js +9 -0
- package/lib/components/ThemeProvider/index.d.ts +2 -0
- package/lib/components/ThemeProvider/index.js +16 -0
- package/lib/components/ThemeProvider/material.js +20 -0
- package/lib/components/ThemeProvider/ocean.js +9 -0
- package/lib/components/ThemeProvider/runtime.d.ts +2 -0
- package/lib/components/ThemeProvider/runtime.js +30 -0
- package/lib/components/ThemeProvider/theme.d.ts +6 -0
- package/lib/components/ThemeProvider/theme.js +115 -0
- package/lib/components/ThemeProvider/useDesignTokens.d.ts +2 -0
- package/lib/components/ThemeProvider/useDesignTokens.js +26 -0
- package/lib/components/TimePicker/Time.d.ts +11 -0
- package/lib/components/TimePicker/Time.js +39 -0
- package/lib/components/TimePicker/TimePicker.d.ts +27 -0
- package/lib/components/TimePicker/TimePicker.js +282 -0
- package/lib/components/TimePicker/index.d.ts +2 -0
- package/lib/components/TimePicker/index.js +13 -0
- package/lib/components/TimePicker/locale/en_US.js +10 -0
- package/lib/components/TimePicker/locale/zh_CN.d.ts +4 -0
- package/lib/components/TimePicker/locale/zh_CN.js +10 -0
- package/lib/components/TimePicker/style/index.d.ts +14 -0
- package/lib/components/TimePicker/style/index.js +81 -0
- package/lib/components/TimePicker/util.d.ts +1 -0
- package/lib/components/TimePicker/util.js +49 -0
- package/lib/components/Tooltip/Tooltip.d.ts +13 -0
- package/lib/components/Tooltip/Tooltip.js +96 -0
- package/lib/components/Tooltip/index.d.ts +2 -0
- package/lib/components/Tooltip/index.js +13 -0
- package/lib/components/Tooltip/style/index.d.ts +19 -0
- package/lib/components/Tooltip/style/index.js +103 -0
- package/lib/components/Transfer/Transfer.js +578 -0
- package/lib/components/Transfer/index.js +13 -0
- package/lib/components/Transfer/locale/en_US.js +15 -0
- package/lib/components/Transfer/locale/zh_CN.js +15 -0
- package/lib/components/Transfer/style/index.js +55 -0
- package/lib/components/TransferMenu/TransferMenu.js +115 -0
- package/lib/components/TransferMenu/index.js +13 -0
- package/lib/components/TransferMenu/style/index.js +23 -0
- package/lib/components/TransferTable/TransferTable.js +148 -0
- package/lib/components/TransferTable/index.js +13 -0
- package/lib/components/TransferTable/style/index.js +38 -0
- package/lib/components/Tree/Item.d.ts +27 -0
- package/lib/components/Tree/Item.js +305 -0
- package/lib/components/Tree/Items.d.ts +14 -0
- package/lib/components/Tree/Items.js +105 -0
- package/lib/components/Tree/Tree.d.ts +49 -0
- package/lib/components/Tree/Tree.js +580 -0
- package/lib/components/Tree/TreeContext.d.ts +7 -0
- package/lib/components/Tree/TreeContext.js +18 -0
- package/lib/components/Tree/index.d.ts +4 -0
- package/lib/components/Tree/index.js +14 -0
- package/lib/components/Tree/interface.d.ts +19 -0
- package/lib/components/Tree/interface.js +5 -0
- package/lib/components/Tree/style/index.d.ts +22 -0
- package/lib/components/Tree/style/index.js +63 -0
- package/lib/components/Tree/util.d.ts +2 -0
- package/lib/components/Tree/util.js +44 -0
- package/lib/components/Upload/CardItem.js +214 -0
- package/lib/components/Upload/Dropzone.js +187 -0
- package/lib/components/Upload/Item.js +209 -0
- package/lib/components/Upload/List.js +200 -0
- package/lib/components/Upload/Progress.js +115 -0
- package/lib/components/Upload/Selector.js +152 -0
- package/lib/components/Upload/Thumbnail.js +110 -0
- package/lib/components/Upload/Upload.js +556 -0
- package/lib/components/Upload/icons/Archive.js +18 -0
- package/lib/components/Upload/icons/Docs.js +18 -0
- package/lib/components/Upload/icons/Dropzone.js +18 -0
- package/lib/components/Upload/icons/Image.js +18 -0
- package/lib/components/Upload/icons/PDF.js +18 -0
- package/lib/components/Upload/icons/Text.js +18 -0
- package/lib/components/Upload/icons/Unknown.js +18 -0
- package/lib/components/Upload/icons/Upload.js +18 -0
- package/lib/components/Upload/index.js +16 -0
- package/lib/components/Upload/locale/en_US.js +22 -0
- package/lib/components/Upload/locale/zh_CN.js +22 -0
- package/lib/components/Upload/style/index.js +177 -0
- package/lib/components/Upload/utils.js +143 -0
- package/lib/components/ZForm/ZForm.js +79 -0
- package/lib/components/ZForm/controllerDecorator.js +90 -0
- package/lib/components/ZForm/index.js +16 -0
- package/lib/config.d.ts +6 -0
- package/lib/config.js +28 -0
- package/lib/decorators/selectableWithStore/item.js +170 -0
- package/lib/decorators/selectableWithStore/store.js +424 -0
- package/lib/decorators/uncontrolled.d.ts +7 -0
- package/lib/decorators/uncontrolled.js +122 -0
- package/lib/hooks/group.d.ts +42 -0
- package/lib/hooks/group.js +403 -0
- package/lib/hooks/selectable.d.ts +22 -0
- package/lib/hooks/selectable.js +127 -0
- package/lib/hooks/useConfig.d.ts +2 -0
- package/lib/hooks/useConfig.js +30 -0
- package/lib/hooks/useConstructor.d.ts +2 -0
- package/lib/hooks/useConstructor.js +31 -0
- package/lib/hooks/useDidMount.d.ts +2 -0
- package/lib/hooks/useDidMount.js +34 -0
- package/lib/hooks/useInitial.d.ts +2 -0
- package/lib/hooks/useInitial.js +23 -0
- package/lib/hooks/useIsInitial.d.ts +2 -0
- package/lib/hooks/useIsInitial.js +40 -0
- package/lib/hooks/useOverflow.d.ts +24 -0
- package/lib/hooks/useOverflow.js +159 -0
- package/lib/hooks/usePopoverConfig.d.ts +27 -0
- package/lib/hooks/usePopoverConfig.js +78 -0
- package/lib/hooks/useSearch.d.ts +23 -0
- package/lib/hooks/useSearch.js +387 -0
- package/lib/hooks/useSimpleVirtualList.d.ts +6 -0
- package/lib/hooks/useSimpleVirtualList.js +128 -0
- package/lib/hooks/useUncontrolled.d.ts +4 -0
- package/lib/hooks/useUncontrolled.js +85 -0
- package/lib/hooks/useVirtualList.d.ts +6 -0
- package/lib/hooks/useVirtualList.js +196 -0
- package/lib/index.js +241 -0
- package/lib/interfaces/Color.js +9 -0
- package/lib/interfaces/Size.js +8 -0
- package/lib/libs/dom-align/adjustForViewport.js +55 -0
- package/lib/libs/dom-align/align/align.js +244 -0
- package/lib/libs/dom-align/align/alignElement.js +34 -0
- package/lib/libs/dom-align/align/alignPoint.js +67 -0
- package/lib/libs/dom-align/getAlignOffset.js +38 -0
- package/lib/libs/dom-align/getElFuturePos.js +23 -0
- package/lib/libs/dom-align/getOffsetParent.js +63 -0
- package/lib/libs/dom-align/getRegion.js +38 -0
- package/lib/libs/dom-align/getVisibleRectForElement.js +118 -0
- package/lib/libs/dom-align/index.js +27 -0
- package/lib/libs/dom-align/isAncestorFixed.js +34 -0
- package/lib/libs/dom-align/propertyUtils.js +138 -0
- package/lib/libs/dom-align/utils.js +657 -0
- package/lib/libs/rc-align/index.d.ts +42 -0
- package/lib/libs/rc-align/index.js +275 -0
- package/lib/libs/rc-align/util.d.ts +8 -0
- package/lib/libs/rc-align/util.js +67 -0
- package/lib/libs/rc-drawer/Drawer.js +831 -0
- package/lib/libs/rc-drawer/index.js +14 -0
- package/lib/libs/rc-drawer/utils.js +87 -0
- package/lib/libs/rc-table/BaseTable.d.ts +2 -0
- package/lib/libs/rc-table/BaseTable.js +221 -0
- package/lib/libs/rc-table/BodyTable.d.ts +18 -0
- package/lib/libs/rc-table/BodyTable.js +82 -0
- package/lib/libs/rc-table/ColGroup.d.ts +10 -0
- package/lib/libs/rc-table/ColGroup.js +47 -0
- package/lib/libs/rc-table/ColumnManager.d.ts +10 -0
- package/lib/libs/rc-table/ColumnManager.js +206 -0
- package/lib/libs/rc-table/ExpandIcon.d.ts +11 -0
- package/lib/libs/rc-table/ExpandIcon.js +65 -0
- package/lib/libs/rc-table/ExpandableRow.d.ts +2 -0
- package/lib/libs/rc-table/ExpandableRow.js +191 -0
- package/lib/libs/rc-table/ExpandableTable.d.ts +2 -0
- package/lib/libs/rc-table/ExpandableTable.js +304 -0
- package/lib/libs/rc-table/HeadTable.d.ts +18 -0
- package/lib/libs/rc-table/HeadTable.js +76 -0
- package/lib/libs/rc-table/Table.d.ts +81 -0
- package/lib/libs/rc-table/Table.js +452 -0
- package/lib/libs/rc-table/TableCell.d.ts +17 -0
- package/lib/libs/rc-table/TableCell.js +168 -0
- package/lib/libs/rc-table/TableHeader.d.ts +16 -0
- package/lib/libs/rc-table/TableHeader.js +109 -0
- package/lib/libs/rc-table/TableHeaderRow.d.ts +2 -0
- package/lib/libs/rc-table/TableHeaderRow.js +146 -0
- package/lib/libs/rc-table/TableRow.d.ts +2 -0
- package/lib/libs/rc-table/TableRow.js +301 -0
- package/lib/libs/rc-table/index.d.ts +2 -0
- package/lib/libs/rc-table/index.js +13 -0
- package/lib/libs/rc-table/utils.d.ts +7 -0
- package/lib/libs/rc-table/utils.js +117 -0
- package/lib/libs/rc-trigger/index.js +14 -0
- package/lib/libs/rc-trigger/src/LazyRenderBox.js +82 -0
- package/lib/libs/rc-trigger/src/Popup.js +383 -0
- package/lib/libs/rc-trigger/src/PopupInner.js +85 -0
- package/lib/libs/rc-trigger/src/index.js +867 -0
- package/lib/libs/rc-trigger/src/mock.js +33 -0
- package/lib/libs/rc-trigger/src/utils.js +48 -0
- package/lib/sharedComponents/InputWrap.d.ts +16 -0
- package/lib/sharedComponents/InputWrap.js +66 -0
- package/lib/sharedComponents/Search/Highlight.d.ts +5 -0
- package/lib/sharedComponents/Search/Highlight.js +20 -0
- package/lib/sharedComponents/Search/Search.d.ts +19 -0
- package/lib/sharedComponents/Search/Search.js +72 -0
- package/lib/sharedComponents/Search/SearchInput.d.ts +4 -0
- package/lib/sharedComponents/Search/SearchInput.js +51 -0
- package/lib/sharedComponents/Search/index.d.ts +5 -0
- package/lib/sharedComponents/Search/index.js +29 -0
- package/lib/sharedComponents/Search/locale/en_US.js +11 -0
- package/lib/sharedComponents/Search/locale/zh_CN.d.ts +5 -0
- package/lib/sharedComponents/Search/locale/zh_CN.js +11 -0
- package/lib/sharedComponents/Search/style.d.ts +14 -0
- package/lib/sharedComponents/Search/style.js +56 -0
- package/lib/sharedComponents/VirtualScrollList.d.ts +7 -0
- package/lib/sharedComponents/VirtualScrollList.js +68 -0
- package/lib/stores/SimpleStore.js +73 -0
- package/lib/style/animation.d.ts +17 -0
- package/lib/style/animation.js +49 -0
- package/lib/style/globalAnimation.d.ts +1 -0
- package/lib/style/globalAnimation.js +20 -0
- package/lib/style/index.d.ts +10 -0
- package/lib/style/index.js +114 -0
- package/lib/style/interface.d.ts +8 -0
- package/lib/style/interface.js +13 -0
- package/lib/style/sWrap.d.ts +18 -0
- package/lib/style/sWrap.js +110 -0
- package/lib/style/utils.d.ts +14 -0
- package/lib/style/utils.js +171 -0
- package/lib/type.d.ts +9 -0
- package/lib/type.js +118 -0
- package/lib/utils/KeyCode.d.ts +15 -0
- package/lib/utils/KeyCode.js +21 -0
- package/lib/utils/attrs.d.ts +5 -0
- package/lib/utils/attrs.js +39 -0
- package/lib/utils/checkStickySupport.d.ts +2 -0
- package/lib/utils/checkStickySupport.js +38 -0
- package/lib/utils/deprecatedLog.d.ts +2 -0
- package/lib/utils/deprecatedLog.js +27 -0
- package/lib/utils/each.d.ts +1 -0
- package/lib/utils/each.js +15 -0
- package/lib/utils/generateError.js +27 -0
- package/lib/utils/hoistStatics.d.ts +1 -0
- package/lib/utils/hoistStatics.js +14 -0
- package/lib/utils/isArray.d.ts +2 -0
- package/lib/utils/isArray.js +19 -0
- package/lib/utils/isEmpty.d.ts +2 -0
- package/lib/utils/isEmpty.js +26 -0
- package/lib/utils/isFirefox.d.ts +2 -0
- package/lib/utils/isFirefox.js +12 -0
- package/lib/utils/isFunction.d.ts +2 -0
- package/lib/utils/isFunction.js +20 -0
- package/lib/utils/isIE.d.ts +2 -0
- package/lib/utils/isIE.js +12 -0
- package/lib/utils/isNumber.d.ts +2 -0
- package/lib/utils/isNumber.js +19 -0
- package/lib/utils/isObject.d.ts +2 -0
- package/lib/utils/isObject.js +19 -0
- package/lib/utils/isSafari.d.ts +2 -0
- package/lib/utils/isSafari.js +10 -0
- package/lib/utils/memo.d.ts +2 -0
- package/lib/utils/memo.js +32 -0
- package/lib/utils/noop.d.ts +2 -0
- package/lib/utils/noop.js +20 -0
- package/lib/utils/once.d.ts +2 -0
- package/lib/utils/once.js +29 -0
- package/lib/utils/pick.d.ts +2 -0
- package/lib/utils/pick.js +29 -0
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +24 -0
- package/lib/utils/styledWrap.d.ts +22 -0
- package/lib/utils/styledWrap.js +98 -0
- package/lib/utils/typeMemo.d.ts +2 -0
- package/lib/utils/typeMemo.js +18 -0
- package/lib/utils/wait.d.ts +2 -0
- package/lib/utils/wait.js +23 -0
- package/lib/utils/warning.d.ts +4 -0
- package/lib/utils/warning.js +34 -0
- package/lib/utils/withProps.d.ts +3 -0
- package/lib/utils/withProps.js +86 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1452 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = exports.deprecatedLogForPopover = void 0;
|
|
11
|
+
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
17
|
+
|
|
18
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
19
|
+
|
|
20
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/newArrowCheck"));
|
|
25
|
+
|
|
26
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
+
|
|
28
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
29
|
+
|
|
30
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
31
|
+
|
|
32
|
+
var _Popover = _interopRequireDefault(require("../../components/Popover"));
|
|
33
|
+
|
|
34
|
+
var _Tag = _interopRequireDefault(require("../../components/Tag"));
|
|
35
|
+
|
|
36
|
+
var _Tooltip = _interopRequireDefault(require("../../components/Tooltip"));
|
|
37
|
+
|
|
38
|
+
var _Search = require("../../sharedComponents/Search");
|
|
39
|
+
|
|
40
|
+
var _useLocale = _interopRequireDefault(require("../../components/LocaleProvider/useLocale"));
|
|
41
|
+
|
|
42
|
+
var _SvgIcon = _interopRequireDefault(require("../../components/SvgIcon"));
|
|
43
|
+
|
|
44
|
+
var _usePopoverConfig = _interopRequireDefault(require("../../hooks/usePopoverConfig"));
|
|
45
|
+
|
|
46
|
+
var _useUncontrolled5 = _interopRequireDefault(require("../../hooks/useUncontrolled"));
|
|
47
|
+
|
|
48
|
+
var _useInitial = _interopRequireDefault(require("../../hooks/useInitial"));
|
|
49
|
+
|
|
50
|
+
var _noop = _interopRequireDefault(require("../../utils/noop"));
|
|
51
|
+
|
|
52
|
+
var _deprecatedLog = _interopRequireDefault(require("../../utils/deprecatedLog"));
|
|
53
|
+
|
|
54
|
+
var _warning = require("../../utils/warning");
|
|
55
|
+
|
|
56
|
+
var _isObject = _interopRequireDefault(require("../../utils/isObject"));
|
|
57
|
+
|
|
58
|
+
var _isEmpty = _interopRequireDefault(require("../../utils/isEmpty"));
|
|
59
|
+
|
|
60
|
+
var _style = require("../../components/Input/style");
|
|
61
|
+
|
|
62
|
+
var _VirtualScrollList = _interopRequireDefault(require("../../sharedComponents/VirtualScrollList"));
|
|
63
|
+
|
|
64
|
+
var _Option = require("./Option");
|
|
65
|
+
|
|
66
|
+
var _Group = _interopRequireDefault(require("./Group"));
|
|
67
|
+
|
|
68
|
+
var _Extra = _interopRequireDefault(require("./Extra"));
|
|
69
|
+
|
|
70
|
+
var _style2 = require("./style");
|
|
71
|
+
|
|
72
|
+
var _SelectContext = _interopRequireDefault(require("./SelectContext"));
|
|
73
|
+
|
|
74
|
+
var _zh_CN = _interopRequireDefault(require("./locale/zh_CN"));
|
|
75
|
+
|
|
76
|
+
var _Overflow = _interopRequireWildcard(require("./Overflow"));
|
|
77
|
+
|
|
78
|
+
var _excluded = ["v1"],
|
|
79
|
+
_excluded2 = ["content"],
|
|
80
|
+
_excluded3 = ["content"],
|
|
81
|
+
_excluded4 = ["v1", "size", "disabled", "multiple", "placeholder", "renderContent", "renderSelector", "renderPopup", "value", "onChange", "visible", "setVisible", "locale", "dataSource", "search", "searchValue", "setSearchValue", "wrapRef", "clearable", "styleType", "block"],
|
|
82
|
+
_excluded5 = ["items", "onClose", "disabled"],
|
|
83
|
+
_excluded6 = ["size", "value", "defaultValue", "onChange", "onVisibleChange", "disabled", "search", "multiple", "renderContent", "renderSelector", "placeholder", "locale", "options", "children", "emptyContent", "showSelectAll", "extra", "clearable", "customStyle", "popover", "popoverProps", "renderPopup", "virtualList", "block", "styleType"];
|
|
84
|
+
|
|
85
|
+
var _this = void 0;
|
|
86
|
+
|
|
87
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
88
|
+
|
|
89
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
90
|
+
|
|
91
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
92
|
+
|
|
93
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
94
|
+
|
|
95
|
+
var deprecatedLogForPopover = (0, _deprecatedLog.default)('Select popover', 'popoverProps');
|
|
96
|
+
exports.deprecatedLogForPopover = deprecatedLogForPopover;
|
|
97
|
+
var warnLogForVirtualList = (0, _warning.onceWarning)('Select virtualList only valid when use options');
|
|
98
|
+
var warnLogForCustomHeight = (0, _warning.onceWarning)('CustomStyle.optionListMaxHeight is invalid when use virtualList, please use virtualList.height');
|
|
99
|
+
var warnLogForSearchProps = (0, _warning.onceWarning)("Don't use item.props in custom search, just use item as props.");
|
|
100
|
+
var warnLogForSubGroup = (0, _deprecatedLog.default)('Select.Group', 'Cascader');
|
|
101
|
+
var popoverStretch = ['minWidth'];
|
|
102
|
+
var blockPopoverStretch = ['width'];
|
|
103
|
+
var groupOptions = {
|
|
104
|
+
itemTag: 'isMenuItem',
|
|
105
|
+
subGroupTag: 'isMenuSubMenu',
|
|
106
|
+
itemKeyName: 'value',
|
|
107
|
+
subGroupKeyName: 'groupKey',
|
|
108
|
+
displayName: 'label',
|
|
109
|
+
subGroupName: 'children',
|
|
110
|
+
ItemComponent: _Option.PureOption,
|
|
111
|
+
SubGroupComponent: _Group.default
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var isValidKey = function isValidKey(v) {
|
|
115
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
116
|
+
return typeof v === 'string' || typeof v === 'number';
|
|
117
|
+
}.bind(void 0);
|
|
118
|
+
|
|
119
|
+
var groupChildrenAsDataSource = function groupChildrenAsDataSource(children) {
|
|
120
|
+
var _this2 = this;
|
|
121
|
+
|
|
122
|
+
var globalDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
123
|
+
|
|
124
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
125
|
+
itemTag: 'isItem',
|
|
126
|
+
subGroupTag: 'isSubGroup',
|
|
127
|
+
itemKeyName: 'itemKey',
|
|
128
|
+
subGroupKeyName: 'subGroupKey'
|
|
129
|
+
},
|
|
130
|
+
itemTag = _ref.itemTag,
|
|
131
|
+
subGroupTag = _ref.subGroupTag,
|
|
132
|
+
itemKeyName = _ref.itemKeyName,
|
|
133
|
+
subGroupKeyName = _ref.subGroupKeyName;
|
|
134
|
+
|
|
135
|
+
var searchValue = arguments.length > 3 ? arguments[3] : undefined;
|
|
136
|
+
var handleSearch = arguments.length > 4 ? arguments[4] : undefined;
|
|
137
|
+
var subGroupMap = new Map();
|
|
138
|
+
var childrenMap = new Map();
|
|
139
|
+
|
|
140
|
+
var _group = function group(children, disabled, prefix) {
|
|
141
|
+
var _this3 = this;
|
|
142
|
+
|
|
143
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
144
|
+
var validKeys = [];
|
|
145
|
+
var disabledKeys = [];
|
|
146
|
+
|
|
147
|
+
var l = _react.default.Children.count(children);
|
|
148
|
+
|
|
149
|
+
var renderChildren = [];
|
|
150
|
+
|
|
151
|
+
_react.default.Children.forEach(children, function (child, i) {
|
|
152
|
+
(0, _newArrowCheck2.default)(this, _this3);
|
|
153
|
+
var isFirst = i === 0;
|
|
154
|
+
var isLast = i === l - 1;
|
|
155
|
+
|
|
156
|
+
if ( /*#__PURE__*/_react.default.isValidElement(child)) {
|
|
157
|
+
var _child$type, _child$type2;
|
|
158
|
+
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
160
|
+
if ((_child$type = child.type) !== null && _child$type !== void 0 && _child$type[itemTag]) {
|
|
161
|
+
var _props = child.props;
|
|
162
|
+
|
|
163
|
+
var _key = _props[itemKeyName] === undefined ? child.key : _props[itemKeyName];
|
|
164
|
+
|
|
165
|
+
var _visible = searchValue ? handleSearch(_key, child.props) : true;
|
|
166
|
+
|
|
167
|
+
if (_visible) {
|
|
168
|
+
var _ref2, _React$cloneElement;
|
|
169
|
+
|
|
170
|
+
var isDisabled = disabled || _props.disabled;
|
|
171
|
+
|
|
172
|
+
if (isDisabled) {
|
|
173
|
+
disabledKeys.push(_key);
|
|
174
|
+
} else {
|
|
175
|
+
validKeys.push(_key);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
var display = Array.isArray(_visible) ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, _visible[0], /*#__PURE__*/_react.default.createElement(_Search.Highlight, null, _visible[1]), _visible[2]) : (_ref2 = _props.children) !== null && _ref2 !== void 0 ? _ref2 : _key;
|
|
179
|
+
renderChildren.push( /*#__PURE__*/_react.default.cloneElement(child, (_React$cloneElement = {}, (0, _defineProperty2.default)(_React$cloneElement, itemKeyName, _key), (0, _defineProperty2.default)(_React$cloneElement, "disabled", globalDisabled || isDisabled), (0, _defineProperty2.default)(_React$cloneElement, "isFirst", isFirst), (0, _defineProperty2.default)(_React$cloneElement, "isLast", isLast), (0, _defineProperty2.default)(_React$cloneElement, "key", isValidKey(_key) ? _key : child.key || "".concat(i)), (0, _defineProperty2.default)(_React$cloneElement, "children", display), _React$cloneElement)));
|
|
180
|
+
childrenMap.set(_key, display);
|
|
181
|
+
} else {
|
|
182
|
+
childrenMap.set(_key, _props.children);
|
|
183
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
184
|
+
|
|
185
|
+
} else if (subGroupTag && subGroupKeyName && (_child$type2 = child.type) !== null && _child$type2 !== void 0 && _child$type2[subGroupTag]) {
|
|
186
|
+
var _React$cloneElement2;
|
|
187
|
+
|
|
188
|
+
var _props2 = child.props;
|
|
189
|
+
|
|
190
|
+
var _key2 = _props2[subGroupKeyName] || child.key || "".concat(prefix, "-").concat(i);
|
|
191
|
+
|
|
192
|
+
var _isDisabled = disabled || _props2.disabled;
|
|
193
|
+
|
|
194
|
+
var _group2 = _group(child.props.children, _isDisabled, _key2),
|
|
195
|
+
_group3 = (0, _slicedToArray2.default)(_group2, 3),
|
|
196
|
+
subValidKeys = _group3[0],
|
|
197
|
+
subDisabledKeys = _group3[1],
|
|
198
|
+
subRenderChildren = _group3[2];
|
|
199
|
+
|
|
200
|
+
subGroupMap.set(_key2, {
|
|
201
|
+
validKeys: subValidKeys,
|
|
202
|
+
disabledKeys: subDisabledKeys
|
|
203
|
+
});
|
|
204
|
+
validKeys.push.apply(validKeys, (0, _toConsumableArray2.default)(subValidKeys));
|
|
205
|
+
disabledKeys.push.apply(disabledKeys, (0, _toConsumableArray2.default)(subDisabledKeys));
|
|
206
|
+
renderChildren.push( /*#__PURE__*/_react.default.cloneElement(child, (_React$cloneElement2 = {
|
|
207
|
+
disabled: globalDisabled || _isDisabled
|
|
208
|
+
}, (0, _defineProperty2.default)(_React$cloneElement2, subGroupKeyName, _key2), (0, _defineProperty2.default)(_React$cloneElement2, "isFirst", isFirst), (0, _defineProperty2.default)(_React$cloneElement2, "isLast", isLast), (0, _defineProperty2.default)(_React$cloneElement2, "key", _key2), _React$cloneElement2), subRenderChildren));
|
|
209
|
+
} else {
|
|
210
|
+
renderChildren.push(child);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}.bind(this));
|
|
214
|
+
|
|
215
|
+
return [validKeys, disabledKeys, renderChildren];
|
|
216
|
+
}.bind(this);
|
|
217
|
+
|
|
218
|
+
return [].concat((0, _toConsumableArray2.default)(_group(children, false, 'group-root')), [subGroupMap, childrenMap]);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
var groupOptionsAsDataSource = function groupOptionsAsDataSource(options) {
|
|
222
|
+
var _this4 = this;
|
|
223
|
+
|
|
224
|
+
var globalDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
225
|
+
|
|
226
|
+
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
227
|
+
subGroupName: 'children',
|
|
228
|
+
displayName: 'label',
|
|
229
|
+
itemKeyName: 'itemKey',
|
|
230
|
+
subGroupKeyName: 'subGroupKey',
|
|
231
|
+
ItemComponent: function ItemComponent() {
|
|
232
|
+
(0, _newArrowCheck2.default)(this, _this4);
|
|
233
|
+
return null;
|
|
234
|
+
}.bind(this),
|
|
235
|
+
SubGroupComponent: function SubGroupComponent() {
|
|
236
|
+
(0, _newArrowCheck2.default)(this, _this4);
|
|
237
|
+
return null;
|
|
238
|
+
}.bind(this)
|
|
239
|
+
},
|
|
240
|
+
subGroupName = _ref3.subGroupName,
|
|
241
|
+
displayName = _ref3.displayName,
|
|
242
|
+
itemKeyName = _ref3.itemKeyName,
|
|
243
|
+
subGroupKeyName = _ref3.subGroupKeyName,
|
|
244
|
+
ItemComponent = _ref3.ItemComponent,
|
|
245
|
+
SubGroupComponent = _ref3.SubGroupComponent;
|
|
246
|
+
|
|
247
|
+
var searchValue = arguments.length > 3 ? arguments[3] : undefined;
|
|
248
|
+
var handleSearch = arguments.length > 4 ? arguments[4] : undefined;
|
|
249
|
+
var subGroupMap = new Map();
|
|
250
|
+
var childrenMap = new Map();
|
|
251
|
+
|
|
252
|
+
var group = function group(options) {
|
|
253
|
+
var _this5 = this;
|
|
254
|
+
|
|
255
|
+
var disabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
256
|
+
var prefixKey = arguments.length > 2 ? arguments[2] : undefined;
|
|
257
|
+
var validKeys = [];
|
|
258
|
+
var disabledKeys = [];
|
|
259
|
+
var renderChildren = [];
|
|
260
|
+
options.forEach(function (child, i) {
|
|
261
|
+
(0, _newArrowCheck2.default)(this, _this5);
|
|
262
|
+
var subChildren = child[subGroupName];
|
|
263
|
+
|
|
264
|
+
if (subChildren) {
|
|
265
|
+
var _key3 = child[subGroupKeyName] || child.key || "".concat(prefixKey, "-").concat(i);
|
|
266
|
+
|
|
267
|
+
var reactKey = child.key || isValidKey(child[subGroupKeyName]) ? child[subGroupKeyName] : "".concat(prefixKey, "-").concat(i);
|
|
268
|
+
var isDisabled = disabled || child.disabled;
|
|
269
|
+
|
|
270
|
+
var _group4 = group(subChildren, isDisabled, _key3),
|
|
271
|
+
_group5 = (0, _slicedToArray2.default)(_group4, 3),
|
|
272
|
+
subValidKeys = _group5[0],
|
|
273
|
+
subDisabledKeys = _group5[1],
|
|
274
|
+
subRenderChildren = _group5[2];
|
|
275
|
+
|
|
276
|
+
subGroupMap.set(_key3, {
|
|
277
|
+
validKeys: subValidKeys,
|
|
278
|
+
disabledKeys: subDisabledKeys
|
|
279
|
+
});
|
|
280
|
+
validKeys.push.apply(validKeys, (0, _toConsumableArray2.default)(subValidKeys));
|
|
281
|
+
disabledKeys.push.apply(disabledKeys, (0, _toConsumableArray2.default)(subDisabledKeys));
|
|
282
|
+
|
|
283
|
+
var _visible2 = searchValue ? !!subRenderChildren.length : true;
|
|
284
|
+
|
|
285
|
+
if (_visible2) {
|
|
286
|
+
renderChildren.push( /*#__PURE__*/_react.default.createElement(SubGroupComponent, (0, _extends2.default)({
|
|
287
|
+
key: reactKey
|
|
288
|
+
}, child, (0, _defineProperty2.default)({
|
|
289
|
+
disabled: globalDisabled || isDisabled
|
|
290
|
+
}, subGroupKeyName, _key3)), subRenderChildren));
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
var _key4 = child[itemKeyName] === undefined ? child.key : child[itemKeyName];
|
|
294
|
+
|
|
295
|
+
var _reactKey = child.key || isValidKey(child[itemKeyName]) ? child[itemKeyName] : "".concat(prefixKey, "-").concat(i);
|
|
296
|
+
|
|
297
|
+
var _isDisabled2 = disabled || child.disabled;
|
|
298
|
+
|
|
299
|
+
var _visible3 = searchValue ? handleSearch(_key4, child) : true;
|
|
300
|
+
|
|
301
|
+
if (_visible3) {
|
|
302
|
+
var _ref5;
|
|
303
|
+
|
|
304
|
+
if (_isDisabled2) {
|
|
305
|
+
disabledKeys.push(_key4);
|
|
306
|
+
} else {
|
|
307
|
+
validKeys.push(_key4);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
var display = Array.isArray(_visible3) ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, _visible3[0], /*#__PURE__*/_react.default.createElement(_Search.Highlight, null, _visible3[1]), _visible3[2]) : (_ref5 = child[displayName]) !== null && _ref5 !== void 0 ? _ref5 : _key4;
|
|
311
|
+
renderChildren.push( /*#__PURE__*/_react.default.createElement(ItemComponent, (0, _extends2.default)({
|
|
312
|
+
key: _reactKey
|
|
313
|
+
}, child, (0, _defineProperty2.default)({
|
|
314
|
+
disabled: globalDisabled || _isDisabled2
|
|
315
|
+
}, itemKeyName, _key4)), display));
|
|
316
|
+
childrenMap.set(_key4, display);
|
|
317
|
+
} else {
|
|
318
|
+
var _ref7;
|
|
319
|
+
|
|
320
|
+
childrenMap.set(_key4, (_ref7 = child[displayName]) !== null && _ref7 !== void 0 ? _ref7 : child[itemKeyName]);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}.bind(this));
|
|
324
|
+
return [validKeys, disabledKeys, renderChildren];
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
return [].concat((0, _toConsumableArray2.default)(group(options, false, 'group-root')), [subGroupMap, childrenMap]);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
var Popup = /*#__PURE__*/_react.default.memo(function Popup(_ref8) {
|
|
331
|
+
var v1 = _ref8.v1,
|
|
332
|
+
props = (0, _objectWithoutProperties2.default)(_ref8, _excluded);
|
|
333
|
+
var PopupComponent = props.renderPopup ? CustomPopup : v1 ? PopupV1 : PopupV2;
|
|
334
|
+
return /*#__PURE__*/_react.default.createElement(PopupComponent, props);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
var CustomPopup = /*#__PURE__*/_react.default.memo(function CustomPopup(props) {
|
|
338
|
+
var onChange = props.onChange,
|
|
339
|
+
value = props.value,
|
|
340
|
+
multiple = props.multiple,
|
|
341
|
+
extra = props.extra,
|
|
342
|
+
search = props.search,
|
|
343
|
+
children = props.children,
|
|
344
|
+
options = props.options,
|
|
345
|
+
handleVisibleChange = props.handleVisibleChange,
|
|
346
|
+
renderPopup = props.renderPopup;
|
|
347
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderPopup === null || renderPopup === void 0 ? void 0 : renderPopup({
|
|
348
|
+
handleVisible: handleVisibleChange,
|
|
349
|
+
onChange: onChange,
|
|
350
|
+
value: value,
|
|
351
|
+
multiple: multiple,
|
|
352
|
+
extra: extra,
|
|
353
|
+
search: search,
|
|
354
|
+
children: children,
|
|
355
|
+
options: options
|
|
356
|
+
}));
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
var PopupV1 = /*#__PURE__*/_react.default.memo(function PopupV1(_ref9) {
|
|
360
|
+
var _this6 = this;
|
|
361
|
+
|
|
362
|
+
var extra = _ref9.extra,
|
|
363
|
+
_ref9$customStyle = _ref9.customStyle,
|
|
364
|
+
customStyle = _ref9$customStyle === void 0 ? {} : _ref9$customStyle,
|
|
365
|
+
search = _ref9.search,
|
|
366
|
+
multiple = _ref9.multiple,
|
|
367
|
+
_emptyContent = _ref9.emptyContent,
|
|
368
|
+
showSelectAll = _ref9.showSelectAll,
|
|
369
|
+
value = _ref9.value,
|
|
370
|
+
options = _ref9.options,
|
|
371
|
+
children = _ref9.children,
|
|
372
|
+
onChange = _ref9.onChange,
|
|
373
|
+
locale = _ref9.locale,
|
|
374
|
+
handleVisibleChange = _ref9.handleVisibleChange,
|
|
375
|
+
hidePopup = _ref9.hidePopup,
|
|
376
|
+
dataSource = _ref9.dataSource,
|
|
377
|
+
searchValue = _ref9.searchValue,
|
|
378
|
+
setSearchValue = _ref9.setSearchValue,
|
|
379
|
+
virtualList = _ref9.virtualList;
|
|
380
|
+
var handleChange = (0, _react.useCallback)(function (value) {
|
|
381
|
+
(0, _newArrowCheck2.default)(this, _this6);
|
|
382
|
+
|
|
383
|
+
if (!multiple) {
|
|
384
|
+
handleVisibleChange(false);
|
|
385
|
+
onChange(value[0]);
|
|
386
|
+
} else {
|
|
387
|
+
onChange(value);
|
|
388
|
+
}
|
|
389
|
+
}.bind(this), [multiple, onChange, handleVisibleChange]);
|
|
390
|
+
var handleSearchInput = (0, _react.useCallback)(function (e) {
|
|
391
|
+
(0, _newArrowCheck2.default)(this, _this6);
|
|
392
|
+
setSearchValue(e.target.value);
|
|
393
|
+
}.bind(this), [setSearchValue]);
|
|
394
|
+
var finalExtra = (0, _react.useMemo)(function () {
|
|
395
|
+
(0, _newArrowCheck2.default)(this, _this6);
|
|
396
|
+
|
|
397
|
+
if (typeof extra === 'function') {
|
|
398
|
+
return /*#__PURE__*/_react.default.createElement(_Extra.default, null, extra(hidePopup));
|
|
399
|
+
} else if (!(0, _isEmpty.default)(extra)) {
|
|
400
|
+
if ( /*#__PURE__*/_react.default.isValidElement(extra)) {
|
|
401
|
+
return /*#__PURE__*/_react.default.createElement(_Extra.default, null, extra);
|
|
402
|
+
} else if ((0, _isObject.default)(extra)) {
|
|
403
|
+
var _ref10 = extra,
|
|
404
|
+
_content = _ref10.content,
|
|
405
|
+
rest = (0, _objectWithoutProperties2.default)(_ref10, _excluded2);
|
|
406
|
+
return /*#__PURE__*/_react.default.createElement(_Extra.default, rest, _content);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}.bind(this), [extra, hidePopup]);
|
|
410
|
+
var maxWidth = customStyle.popupMaxWidth ? customStyle.popupMaxWidth : 'none';
|
|
411
|
+
|
|
412
|
+
var newCustomStyle = _objectSpread({}, customStyle);
|
|
413
|
+
|
|
414
|
+
if (virtualList) {
|
|
415
|
+
if ('optionListMaxHeight' in newCustomStyle) {
|
|
416
|
+
warnLogForCustomHeight();
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
newCustomStyle.optionListMaxHeight = 'none';
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
var emptyContent = (0, _react.useMemo)(function () {
|
|
423
|
+
(0, _newArrowCheck2.default)(this, _this6);
|
|
424
|
+
return _emptyContent || /*#__PURE__*/_react.default.createElement(_style2.EmptyContentWrapper, null, locale.emptyTip);
|
|
425
|
+
}.bind(this), [_emptyContent, locale]);
|
|
426
|
+
return /*#__PURE__*/_react.default.createElement(_style2.MenuWrap, {
|
|
427
|
+
maxWidth: maxWidth
|
|
428
|
+
}, search && /*#__PURE__*/_react.default.createElement(_style2.SelectSearchInput, {
|
|
429
|
+
block: true,
|
|
430
|
+
onChange: handleSearchInput,
|
|
431
|
+
value: searchValue,
|
|
432
|
+
status: "default"
|
|
433
|
+
}), children || options !== null && options !== void 0 && options.length ? /*#__PURE__*/_react.default.createElement(_style2.BlockMenu, {
|
|
434
|
+
onChange: handleChange,
|
|
435
|
+
customStyle: newCustomStyle,
|
|
436
|
+
menuCustomStyle: {
|
|
437
|
+
maxWidth: 'none'
|
|
438
|
+
},
|
|
439
|
+
dataSource: dataSource,
|
|
440
|
+
multiple: multiple,
|
|
441
|
+
showSelectAll: showSelectAll,
|
|
442
|
+
selectedKeys: multiple ? value : [value],
|
|
443
|
+
virtualList: options ? virtualList : false
|
|
444
|
+
}) : /*#__PURE__*/_react.default.createElement(_style2.BlockMenu, {
|
|
445
|
+
customStyle: newCustomStyle,
|
|
446
|
+
menuCustomStyle: {
|
|
447
|
+
maxWidth: 'none'
|
|
448
|
+
}
|
|
449
|
+
}, emptyContent), finalExtra ? /*#__PURE__*/_react.default.createElement(_style2.FooterWrap, null, finalExtra) : null);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
var PopupV2 = /*#__PURE__*/_react.default.memo(function PopupV2(_ref11) {
|
|
453
|
+
var _this7 = this,
|
|
454
|
+
_dataSource$;
|
|
455
|
+
|
|
456
|
+
var extra = _ref11.extra,
|
|
457
|
+
_ref11$customStyle = _ref11.customStyle,
|
|
458
|
+
customStyle = _ref11$customStyle === void 0 ? {} : _ref11$customStyle,
|
|
459
|
+
multiple = _ref11.multiple,
|
|
460
|
+
_emptyContent = _ref11.emptyContent,
|
|
461
|
+
showSelectAll = _ref11.showSelectAll,
|
|
462
|
+
value = _ref11.value,
|
|
463
|
+
options = _ref11.options,
|
|
464
|
+
children = _ref11.children,
|
|
465
|
+
onChange = _ref11.onChange,
|
|
466
|
+
locale = _ref11.locale,
|
|
467
|
+
handleVisibleChange = _ref11.handleVisibleChange,
|
|
468
|
+
hidePopup = _ref11.hidePopup,
|
|
469
|
+
dataSource = _ref11.dataSource,
|
|
470
|
+
virtualList = _ref11.virtualList,
|
|
471
|
+
searchValue = _ref11.searchValue;
|
|
472
|
+
var menuRef = (0, _react.useRef)(null);
|
|
473
|
+
var handleChange = (0, _react.useCallback)(function (value) {
|
|
474
|
+
(0, _newArrowCheck2.default)(this, _this7);
|
|
475
|
+
|
|
476
|
+
if (!multiple) {
|
|
477
|
+
handleVisibleChange(false);
|
|
478
|
+
onChange(value[0]);
|
|
479
|
+
} else {
|
|
480
|
+
onChange(value);
|
|
481
|
+
}
|
|
482
|
+
}.bind(this), [multiple, onChange, handleVisibleChange]);
|
|
483
|
+
var handleSelectAll = (0, _react.useCallback)(function () {
|
|
484
|
+
(0, _newArrowCheck2.default)(this, _this7);
|
|
485
|
+
var validKeys = dataSource[0];
|
|
486
|
+
var newValue = Array.from(new Set([].concat((0, _toConsumableArray2.default)(value || []), (0, _toConsumableArray2.default)(validKeys))));
|
|
487
|
+
onChange(newValue);
|
|
488
|
+
}.bind(this), [dataSource, onChange, value]);
|
|
489
|
+
var emptyContent = (0, _react.useMemo)(function () {
|
|
490
|
+
(0, _newArrowCheck2.default)(this, _this7);
|
|
491
|
+
return _emptyContent || /*#__PURE__*/_react.default.createElement(_style2.EmptyContentWrapper, null, locale.emptyTip);
|
|
492
|
+
}.bind(this), [_emptyContent, locale]);
|
|
493
|
+
var finalExtra = (0, _react.useMemo)(function () {
|
|
494
|
+
(0, _newArrowCheck2.default)(this, _this7);
|
|
495
|
+
|
|
496
|
+
if (typeof extra === 'function') {
|
|
497
|
+
return /*#__PURE__*/_react.default.createElement(_Extra.default, null, extra(hidePopup));
|
|
498
|
+
} else if (!(0, _isEmpty.default)(extra)) {
|
|
499
|
+
if ( /*#__PURE__*/_react.default.isValidElement(extra)) {
|
|
500
|
+
return /*#__PURE__*/_react.default.createElement(_Extra.default, null, extra);
|
|
501
|
+
} else if ((0, _isObject.default)(extra)) {
|
|
502
|
+
var _ref12 = extra,
|
|
503
|
+
_content2 = _ref12.content,
|
|
504
|
+
rest = (0, _objectWithoutProperties2.default)(_ref12, _excluded3);
|
|
505
|
+
return /*#__PURE__*/_react.default.createElement(_Extra.default, rest, _content2);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}.bind(this), [extra, hidePopup]);
|
|
509
|
+
var maxWidth = customStyle.popupMaxWidth ? customStyle.popupMaxWidth : 'none';
|
|
510
|
+
|
|
511
|
+
var newCustomStyle = _objectSpread({}, customStyle);
|
|
512
|
+
|
|
513
|
+
if (virtualList) {
|
|
514
|
+
if ('optionListMaxHeight' in newCustomStyle) {
|
|
515
|
+
warnLogForCustomHeight();
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
newCustomStyle.optionListMaxHeight = 'none';
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
var hasContent = (children || (options === null || options === void 0 ? void 0 : options.length)) && (Array.isArray(dataSource[2]) ? (_dataSource$ = dataSource[2]) === null || _dataSource$ === void 0 ? void 0 : _dataSource$.length : dataSource[2]);
|
|
522
|
+
return /*#__PURE__*/_react.default.createElement(_style2.MenuWrap, {
|
|
523
|
+
maxWidth: maxWidth
|
|
524
|
+
}, hasContent ? /*#__PURE__*/_react.default.createElement(_style2.BlockMenu, {
|
|
525
|
+
showSelectAll: showSelectAll && multiple && /*#__PURE__*/_react.default.createElement("div", {
|
|
526
|
+
className: _style2.selectAllBtnWrapCls,
|
|
527
|
+
key: "__select_select_all",
|
|
528
|
+
onClick: handleSelectAll
|
|
529
|
+
}, locale.selectAll, searchValue ? " (".concat(searchValue, ")") : ''),
|
|
530
|
+
onChange: handleChange,
|
|
531
|
+
customStyle: newCustomStyle,
|
|
532
|
+
menuCustomStyle: {
|
|
533
|
+
maxWidth: 'none'
|
|
534
|
+
},
|
|
535
|
+
dataSource: dataSource,
|
|
536
|
+
multiple: multiple,
|
|
537
|
+
selectedKeys: multiple ? value : [value],
|
|
538
|
+
virtualList: options ? virtualList : false,
|
|
539
|
+
ref: menuRef,
|
|
540
|
+
_selectStyle: multiple
|
|
541
|
+
}) : /*#__PURE__*/_react.default.createElement(_style2.BlockMenu, {
|
|
542
|
+
customStyle: newCustomStyle,
|
|
543
|
+
menuCustomStyle: {
|
|
544
|
+
maxWidth: 'none'
|
|
545
|
+
}
|
|
546
|
+
}, emptyContent), finalExtra ? /*#__PURE__*/_react.default.createElement(_style2.FooterWrap, null, finalExtra) : null);
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
var Selector = /*#__PURE__*/_react.default.memo(function Selector(_ref13) {
|
|
550
|
+
var v1 = _ref13.v1,
|
|
551
|
+
size = _ref13.size,
|
|
552
|
+
disabled = _ref13.disabled,
|
|
553
|
+
multiple = _ref13.multiple,
|
|
554
|
+
placeholder = _ref13.placeholder,
|
|
555
|
+
renderContent = _ref13.renderContent,
|
|
556
|
+
renderSelector = _ref13.renderSelector,
|
|
557
|
+
renderPopup = _ref13.renderPopup,
|
|
558
|
+
value = _ref13.value,
|
|
559
|
+
onChange = _ref13.onChange,
|
|
560
|
+
visible = _ref13.visible,
|
|
561
|
+
setVisible = _ref13.setVisible,
|
|
562
|
+
locale = _ref13.locale,
|
|
563
|
+
dataSource = _ref13.dataSource,
|
|
564
|
+
search = _ref13.search,
|
|
565
|
+
searchValue = _ref13.searchValue,
|
|
566
|
+
setSearchValue = _ref13.setSearchValue,
|
|
567
|
+
wrapRef = _ref13.wrapRef,
|
|
568
|
+
clearable = _ref13.clearable,
|
|
569
|
+
styleType = _ref13.styleType,
|
|
570
|
+
block = _ref13.block,
|
|
571
|
+
_popupProps = (0, _objectWithoutProperties2.default)(_ref13, _excluded4);
|
|
572
|
+
|
|
573
|
+
var props = {
|
|
574
|
+
size: size,
|
|
575
|
+
disabled: disabled,
|
|
576
|
+
multiple: multiple,
|
|
577
|
+
placeholder: placeholder,
|
|
578
|
+
renderContent: renderContent,
|
|
579
|
+
renderSelector: renderSelector,
|
|
580
|
+
renderPopup: renderPopup,
|
|
581
|
+
value: value,
|
|
582
|
+
onChange: onChange,
|
|
583
|
+
visible: visible,
|
|
584
|
+
setVisible: setVisible,
|
|
585
|
+
locale: locale,
|
|
586
|
+
dataSource: dataSource,
|
|
587
|
+
search: search,
|
|
588
|
+
searchValue: searchValue,
|
|
589
|
+
setSearchValue: setSearchValue,
|
|
590
|
+
wrapRef: wrapRef,
|
|
591
|
+
clearable: clearable,
|
|
592
|
+
block: block,
|
|
593
|
+
_popupProps: _popupProps
|
|
594
|
+
};
|
|
595
|
+
var SelectorComponent = renderSelector ? CustomSelector : v1 ? SelectorV1 : multiple ? styleType === 'list' ? MultipleListSelector : MultipleSelector : SingleSelector;
|
|
596
|
+
return /*#__PURE__*/_react.default.createElement(SelectorComponent, props);
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
var useOldContent = function useOldContent(_ref14) {
|
|
600
|
+
var _this8 = this;
|
|
601
|
+
|
|
602
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
603
|
+
var locale = _ref14.locale,
|
|
604
|
+
placeholder = _ref14.placeholder,
|
|
605
|
+
multiple = _ref14.multiple,
|
|
606
|
+
dataSource = _ref14.dataSource,
|
|
607
|
+
value = _ref14.value,
|
|
608
|
+
renderContent = _ref14.renderContent,
|
|
609
|
+
renderPopup = _ref14.renderPopup;
|
|
610
|
+
placeholder = (0, _react.useMemo)(function () {
|
|
611
|
+
(0, _newArrowCheck2.default)(this, _this8);
|
|
612
|
+
return placeholder || locale.placeholder;
|
|
613
|
+
}.bind(this), [locale.placeholder, placeholder]);
|
|
614
|
+
var defaultRenderContent = (0, _react.useCallback)(function (value, valueChild) {
|
|
615
|
+
(0, _newArrowCheck2.default)(this, _this8);
|
|
616
|
+
|
|
617
|
+
if (!multiple) {
|
|
618
|
+
if (value === undefined) {
|
|
619
|
+
return placeholder;
|
|
620
|
+
} else {
|
|
621
|
+
return valueChild;
|
|
622
|
+
}
|
|
623
|
+
} else {
|
|
624
|
+
if (value && value.length) {
|
|
625
|
+
return "".concat(locale.selected).concat(value.length).concat(locale.items);
|
|
626
|
+
} else {
|
|
627
|
+
return placeholder;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}.bind(this), [locale.items, locale.selected, multiple, placeholder]);
|
|
631
|
+
var getContent = (0, _react.useCallback)(function () {
|
|
632
|
+
var _this9 = this;
|
|
633
|
+
|
|
634
|
+
(0, _newArrowCheck2.default)(this, _this8);
|
|
635
|
+
|
|
636
|
+
var _dataSource = (0, _slicedToArray2.default)(dataSource, 5),
|
|
637
|
+
_dataSource$2 = _dataSource[4],
|
|
638
|
+
childrenMap = _dataSource$2 === void 0 ? new Map() : _dataSource$2;
|
|
639
|
+
|
|
640
|
+
var valueChild;
|
|
641
|
+
|
|
642
|
+
var getValueChild = function getValueChild(v) {
|
|
643
|
+
(0, _newArrowCheck2.default)(this, _this9);
|
|
644
|
+
return childrenMap.has(v) ? childrenMap.get(v) : v;
|
|
645
|
+
}.bind(this);
|
|
646
|
+
|
|
647
|
+
if (!multiple) {
|
|
648
|
+
valueChild = getValueChild(value);
|
|
649
|
+
} else {
|
|
650
|
+
var _value = value ? (0, _toConsumableArray2.default)(value) : []; // only get the top twenty item child for better performance
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
if (_value.length > 20) {
|
|
654
|
+
_value.length = 20;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
valueChild = _value.map(getValueChild);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
if (renderContent) {
|
|
661
|
+
return renderContent(value, valueChild);
|
|
662
|
+
} else {
|
|
663
|
+
return defaultRenderContent(value, valueChild);
|
|
664
|
+
}
|
|
665
|
+
}.bind(this), [dataSource, defaultRenderContent, multiple, renderContent, value]);
|
|
666
|
+
var content = (0, _react.useMemo)(getContent, [getContent]); // 自定义渲染弹层时,开发者可能不传入 options 和 children,导致 content memo deps 不触发变更,故强制更新
|
|
667
|
+
|
|
668
|
+
if (renderPopup) content = getContent();
|
|
669
|
+
return content;
|
|
670
|
+
}.bind(void 0);
|
|
671
|
+
|
|
672
|
+
var CustomSelector = /*#__PURE__*/_react.default.memo(function CustomSelector(props) {
|
|
673
|
+
var content = useOldContent(props); // eslint-disable-next-line react/prop-types
|
|
674
|
+
|
|
675
|
+
var renderSelector = props.renderSelector,
|
|
676
|
+
visible = props.visible,
|
|
677
|
+
_popupProps = props._popupProps;
|
|
678
|
+
|
|
679
|
+
var selector = (renderSelector === null || renderSelector === void 0 ? void 0 : renderSelector(content, visible)) || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
680
|
+
|
|
681
|
+
return /*#__PURE__*/_react.default.isValidElement(selector) ? /*#__PURE__*/_react.default.cloneElement(selector, _popupProps) : null;
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
var SelectorV1 = /*#__PURE__*/_react.default.memo(function SelectorV1(props) {
|
|
685
|
+
var size = props.size,
|
|
686
|
+
disabled = props.disabled,
|
|
687
|
+
visible = props.visible,
|
|
688
|
+
_popupProps = props._popupProps;
|
|
689
|
+
var content = useOldContent(props);
|
|
690
|
+
var title = typeof content === 'string' ? content : undefined;
|
|
691
|
+
return /*#__PURE__*/_react.default.createElement(_style2.SSelector, (0, _extends2.default)({
|
|
692
|
+
styleType: "border",
|
|
693
|
+
size: size,
|
|
694
|
+
disabled: disabled,
|
|
695
|
+
title: title
|
|
696
|
+
}, _popupProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
697
|
+
className: _style2.selectorContentCls,
|
|
698
|
+
key: "content"
|
|
699
|
+
}, content), /*#__PURE__*/_react.default.createElement(_style2.Arrow, {
|
|
700
|
+
key: "icon",
|
|
701
|
+
type: visible ? 'arrow-up' : 'arrow-down'
|
|
702
|
+
}));
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
var RestListItem = /*#__PURE__*/_react.default.memo(function RestListItem(_ref15) {
|
|
706
|
+
var _this10 = this;
|
|
707
|
+
|
|
708
|
+
var item = _ref15.item,
|
|
709
|
+
disabled = _ref15.disabled,
|
|
710
|
+
onClose = _ref15.onClose;
|
|
711
|
+
var handleClose = (0, _react.useCallback)(function () {
|
|
712
|
+
(0, _newArrowCheck2.default)(this, _this10);
|
|
713
|
+
onClose(item.key);
|
|
714
|
+
}.bind(this), [item.key, onClose]);
|
|
715
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
716
|
+
key: item.key,
|
|
717
|
+
className: _style2.restItemCls
|
|
718
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
719
|
+
"data-role": "label"
|
|
720
|
+
}, item.children), !disabled && /*#__PURE__*/_react.default.createElement("span", {
|
|
721
|
+
"data-role": "close",
|
|
722
|
+
onClick: handleClose
|
|
723
|
+
}, /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
724
|
+
type: "cross"
|
|
725
|
+
})));
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
var RestList = /*#__PURE__*/_react.default.memo(function RestList(_ref16) {
|
|
729
|
+
var _this11 = this;
|
|
730
|
+
|
|
731
|
+
var items = _ref16.items,
|
|
732
|
+
onClose = _ref16.onClose,
|
|
733
|
+
disabled = _ref16.disabled,
|
|
734
|
+
rest = (0, _objectWithoutProperties2.default)(_ref16, _excluded5);
|
|
735
|
+
var prevent = (0, _react.useCallback)(function (e) {
|
|
736
|
+
(0, _newArrowCheck2.default)(this, _this11);
|
|
737
|
+
e.preventDefault();
|
|
738
|
+
e.stopPropagation();
|
|
739
|
+
}.bind(this), []);
|
|
740
|
+
return /*#__PURE__*/_react.default.createElement(_style2.SRestList, (0, _extends2.default)({}, rest, {
|
|
741
|
+
onClick: prevent,
|
|
742
|
+
onContextMenu: prevent
|
|
743
|
+
}), /*#__PURE__*/_react.default.createElement(_VirtualScrollList.default, {
|
|
744
|
+
width: 160,
|
|
745
|
+
height: 180
|
|
746
|
+
}, items.map(function (item) {
|
|
747
|
+
(0, _newArrowCheck2.default)(this, _this11);
|
|
748
|
+
return /*#__PURE__*/_react.default.createElement(RestListItem, {
|
|
749
|
+
item: item,
|
|
750
|
+
key: item.key,
|
|
751
|
+
onClose: onClose,
|
|
752
|
+
disabled: disabled
|
|
753
|
+
});
|
|
754
|
+
}.bind(this))));
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
var TagItem = /*#__PURE__*/_react.default.memo(function TagItem(_ref17) {
|
|
758
|
+
var _this12 = this;
|
|
759
|
+
|
|
760
|
+
var item = _ref17.item,
|
|
761
|
+
disabled = _ref17.disabled,
|
|
762
|
+
onClose = _ref17.onClose;
|
|
763
|
+
var handleClose = (0, _react.useCallback)(function () {
|
|
764
|
+
(0, _newArrowCheck2.default)(this, _this12);
|
|
765
|
+
onClose(item.key);
|
|
766
|
+
}.bind(this), [item.key, onClose]);
|
|
767
|
+
return /*#__PURE__*/_react.default.createElement(_Tag.default, {
|
|
768
|
+
key: item.key,
|
|
769
|
+
closable: true,
|
|
770
|
+
disabled: disabled,
|
|
771
|
+
onClose: handleClose
|
|
772
|
+
}, item.children);
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
var restAlign = {
|
|
776
|
+
points: ['tl', 'br'],
|
|
777
|
+
overflow: {
|
|
778
|
+
adjustX: 1,
|
|
779
|
+
adjustY: 1
|
|
780
|
+
},
|
|
781
|
+
offset: [10, 10],
|
|
782
|
+
targetOffset: [0, 0]
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
var MultipleListSelector = /*#__PURE__*/_react.default.memo(function MultipleSelector(props) {
|
|
786
|
+
var _this13 = this;
|
|
787
|
+
|
|
788
|
+
var size = props.size,
|
|
789
|
+
disabled = props.disabled,
|
|
790
|
+
visible = props.visible,
|
|
791
|
+
setVisible = props.setVisible,
|
|
792
|
+
dataSource = props.dataSource,
|
|
793
|
+
value = props.value,
|
|
794
|
+
onChange = props.onChange,
|
|
795
|
+
placeholder = props.placeholder,
|
|
796
|
+
search = props.search,
|
|
797
|
+
_props$searchValue = props.searchValue,
|
|
798
|
+
searchValue = _props$searchValue === void 0 ? '' : _props$searchValue,
|
|
799
|
+
setSearchValue = props.setSearchValue,
|
|
800
|
+
clearable = props.clearable,
|
|
801
|
+
locale = props.locale,
|
|
802
|
+
block = props.block,
|
|
803
|
+
_popupProps = props._popupProps;
|
|
804
|
+
|
|
805
|
+
var _dataSource2 = (0, _slicedToArray2.default)(dataSource, 5),
|
|
806
|
+
_dataSource2$ = _dataSource2[4],
|
|
807
|
+
childrenMap = _dataSource2$ === void 0 ? new Map() : _dataSource2$;
|
|
808
|
+
|
|
809
|
+
var inputRef = (0, _react.useRef)(null);
|
|
810
|
+
var items = (0, _react.useMemo)(function () {
|
|
811
|
+
var _this14 = this;
|
|
812
|
+
|
|
813
|
+
(0, _newArrowCheck2.default)(this, _this13);
|
|
814
|
+
return (value || []).map(function (v) {
|
|
815
|
+
(0, _newArrowCheck2.default)(this, _this14);
|
|
816
|
+
return {
|
|
817
|
+
key: v,
|
|
818
|
+
children: childrenMap.has(v) ? childrenMap.get(v) : v
|
|
819
|
+
};
|
|
820
|
+
}.bind(this));
|
|
821
|
+
}.bind(this), [childrenMap, value]);
|
|
822
|
+
var handleClose = (0, _react.useCallback)(function (key) {
|
|
823
|
+
var _this15 = this;
|
|
824
|
+
|
|
825
|
+
(0, _newArrowCheck2.default)(this, _this13);
|
|
826
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value.filter(function (v) {
|
|
827
|
+
(0, _newArrowCheck2.default)(this, _this15);
|
|
828
|
+
return v !== key;
|
|
829
|
+
}.bind(this)));
|
|
830
|
+
}.bind(this), [onChange, value]);
|
|
831
|
+
var renderItem = (0, _react.useCallback)(function (item) {
|
|
832
|
+
(0, _newArrowCheck2.default)(this, _this13);
|
|
833
|
+
return /*#__PURE__*/_react.default.createElement(TagItem, {
|
|
834
|
+
key: item.key,
|
|
835
|
+
disabled: disabled,
|
|
836
|
+
onClose: handleClose,
|
|
837
|
+
item: item
|
|
838
|
+
});
|
|
839
|
+
}.bind(this), [disabled, handleClose]);
|
|
840
|
+
var handleInput = (0, _react.useCallback)(function (e) {
|
|
841
|
+
(0, _newArrowCheck2.default)(this, _this13);
|
|
842
|
+
setSearchValue(e.target.value);
|
|
843
|
+
}.bind(this), [setSearchValue]);
|
|
844
|
+
(0, _react.useEffect)(function () {
|
|
845
|
+
var _inputRef$current;
|
|
846
|
+
|
|
847
|
+
(0, _newArrowCheck2.default)(this, _this13);
|
|
848
|
+
if (visible) (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
849
|
+
}.bind(this), [visible]);
|
|
850
|
+
var handleClear = (0, _react.useCallback)(function (e) {
|
|
851
|
+
(0, _newArrowCheck2.default)(this, _this13);
|
|
852
|
+
e.stopPropagation();
|
|
853
|
+
e.preventDefault();
|
|
854
|
+
|
|
855
|
+
if (!disabled) {
|
|
856
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([]);
|
|
857
|
+
setSearchValue(''); // inputRef.current?.focus();
|
|
858
|
+
|
|
859
|
+
setVisible(false);
|
|
860
|
+
}
|
|
861
|
+
}.bind(this), [disabled, onChange, setVisible, setSearchValue]);
|
|
862
|
+
var empty = (0, _react.useMemo)(function () {
|
|
863
|
+
(0, _newArrowCheck2.default)(this, _this13);
|
|
864
|
+
return !(value !== null && value !== void 0 && value.length);
|
|
865
|
+
}.bind(this), [value]);
|
|
866
|
+
var handleSelectorClick = (0, _react.useCallback)(function (e) {
|
|
867
|
+
var _inputRef$current2, _popupProps$onClick;
|
|
868
|
+
|
|
869
|
+
(0, _newArrowCheck2.default)(this, _this13);
|
|
870
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
|
|
871
|
+
(_popupProps$onClick = _popupProps.onClick) === null || _popupProps$onClick === void 0 ? void 0 : _popupProps$onClick.call(_popupProps, e);
|
|
872
|
+
}.bind(this), [_popupProps]);
|
|
873
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_style2.SSelectorMultiple, (0, _extends2.default)({
|
|
874
|
+
focused: visible,
|
|
875
|
+
empty: empty
|
|
876
|
+
}, _popupProps, {
|
|
877
|
+
onClick: handleSelectorClick,
|
|
878
|
+
block: block,
|
|
879
|
+
size: size,
|
|
880
|
+
disabled: disabled
|
|
881
|
+
}), /*#__PURE__*/_react.default.createElement(_style.InputPart, {
|
|
882
|
+
stretch: true,
|
|
883
|
+
className: _style2.measureWrapCls
|
|
884
|
+
}, placeholder && empty && !searchValue && /*#__PURE__*/_react.default.createElement("div", {
|
|
885
|
+
className: _style2.placeholderCls
|
|
886
|
+
}, placeholder), !searchValue && !empty && /*#__PURE__*/_react.default.createElement("div", {
|
|
887
|
+
className: (0, _classnames.default)(_style2.placeholderCls, _style2.contentCls)
|
|
888
|
+
}, locale.selected, items.length, locale.items), search ? /*#__PURE__*/_react.default.createElement("input", {
|
|
889
|
+
value: searchValue,
|
|
890
|
+
ref: inputRef,
|
|
891
|
+
onChange: handleInput,
|
|
892
|
+
disabled: disabled
|
|
893
|
+
}) : null), /*#__PURE__*/_react.default.createElement(_style.Clear, {
|
|
894
|
+
clearable: clearable && !empty,
|
|
895
|
+
onClick: handleClear
|
|
896
|
+
}), /*#__PURE__*/_react.default.createElement(_style.InputPart, null, /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
897
|
+
type: visible ? 'arrow-up' : 'arrow-down'
|
|
898
|
+
}))), items.length ? /*#__PURE__*/_react.default.createElement(_Tag.default.Group, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
899
|
+
className: _style2.listCls
|
|
900
|
+
}, items.map(renderItem))) : null);
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
var MultipleSelector = /*#__PURE__*/_react.default.memo(function MultipleSelector(props) {
|
|
904
|
+
var _this16 = this;
|
|
905
|
+
|
|
906
|
+
var size = props.size,
|
|
907
|
+
disabled = props.disabled,
|
|
908
|
+
visible = props.visible,
|
|
909
|
+
setVisible = props.setVisible,
|
|
910
|
+
dataSource = props.dataSource,
|
|
911
|
+
value = props.value,
|
|
912
|
+
onChange = props.onChange,
|
|
913
|
+
placeholder = props.placeholder,
|
|
914
|
+
search = props.search,
|
|
915
|
+
_props$searchValue2 = props.searchValue,
|
|
916
|
+
searchValue = _props$searchValue2 === void 0 ? '' : _props$searchValue2,
|
|
917
|
+
setSearchValue = props.setSearchValue,
|
|
918
|
+
wrapRef = props.wrapRef,
|
|
919
|
+
clearable = props.clearable,
|
|
920
|
+
block = props.block,
|
|
921
|
+
_popupProps = props._popupProps;
|
|
922
|
+
|
|
923
|
+
var _dataSource3 = (0, _slicedToArray2.default)(dataSource, 5),
|
|
924
|
+
_dataSource3$ = _dataSource3[4],
|
|
925
|
+
childrenMap = _dataSource3$ === void 0 ? new Map() : _dataSource3$;
|
|
926
|
+
|
|
927
|
+
var inputRef = (0, _react.useRef)(null);
|
|
928
|
+
var items = (0, _react.useMemo)(function () {
|
|
929
|
+
var _this17 = this;
|
|
930
|
+
|
|
931
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
932
|
+
return (value || []).map(function (v) {
|
|
933
|
+
(0, _newArrowCheck2.default)(this, _this17);
|
|
934
|
+
return {
|
|
935
|
+
key: v,
|
|
936
|
+
children: childrenMap.has(v) ? childrenMap.get(v) : v
|
|
937
|
+
};
|
|
938
|
+
}.bind(this));
|
|
939
|
+
}.bind(this), [childrenMap, value]);
|
|
940
|
+
var handleClose = (0, _react.useCallback)(function (key) {
|
|
941
|
+
var _this18 = this;
|
|
942
|
+
|
|
943
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
944
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value.filter(function (v) {
|
|
945
|
+
(0, _newArrowCheck2.default)(this, _this18);
|
|
946
|
+
return v !== key;
|
|
947
|
+
}.bind(this)));
|
|
948
|
+
}.bind(this), [onChange, value]);
|
|
949
|
+
var popoverConfigProps = (0, _usePopoverConfig.default)();
|
|
950
|
+
var renderItem = (0, _react.useCallback)(function (item) {
|
|
951
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
952
|
+
return /*#__PURE__*/_react.default.createElement(TagItem, {
|
|
953
|
+
key: item.key,
|
|
954
|
+
disabled: disabled,
|
|
955
|
+
onClose: handleClose,
|
|
956
|
+
item: item
|
|
957
|
+
});
|
|
958
|
+
}.bind(this), [disabled, handleClose]);
|
|
959
|
+
var getRestPopupContainer = (0, _react.useCallback)(function () {
|
|
960
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
961
|
+
return wrapRef === null || wrapRef === void 0 ? void 0 : wrapRef.current;
|
|
962
|
+
}.bind(this), [wrapRef]);
|
|
963
|
+
var renderRest = (0, _react.useCallback)(function (items) {
|
|
964
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
965
|
+
if (!items.length) return null;
|
|
966
|
+
return /*#__PURE__*/_react.default.createElement(_Tooltip.default, (0, _extends2.default)({
|
|
967
|
+
key: "rest",
|
|
968
|
+
popup: /*#__PURE__*/_react.default.createElement(RestList, {
|
|
969
|
+
onClose: handleClose,
|
|
970
|
+
disabled: disabled,
|
|
971
|
+
items: items
|
|
972
|
+
}),
|
|
973
|
+
arrow: false,
|
|
974
|
+
getPopupContainer: getRestPopupContainer,
|
|
975
|
+
customStyle: {
|
|
976
|
+
popupWrapperPadding: '0'
|
|
977
|
+
},
|
|
978
|
+
align: restAlign
|
|
979
|
+
}, popoverConfigProps), /*#__PURE__*/_react.default.createElement(_Tag.default, {
|
|
980
|
+
disabled: disabled
|
|
981
|
+
}, "+", items.length));
|
|
982
|
+
}.bind(this), [disabled, getRestPopupContainer, handleClose, popoverConfigProps]);
|
|
983
|
+
var handleInput = (0, _react.useCallback)(function (e) {
|
|
984
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
985
|
+
setSearchValue(e.target.value);
|
|
986
|
+
}.bind(this), [setSearchValue]);
|
|
987
|
+
(0, _react.useEffect)(function () {
|
|
988
|
+
var _inputRef$current3;
|
|
989
|
+
|
|
990
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
991
|
+
if (visible) (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.focus();
|
|
992
|
+
}.bind(this), [visible]);
|
|
993
|
+
var handleClear = (0, _react.useCallback)(function (e) {
|
|
994
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
995
|
+
e.stopPropagation();
|
|
996
|
+
e.preventDefault();
|
|
997
|
+
|
|
998
|
+
if (!disabled) {
|
|
999
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([]);
|
|
1000
|
+
setSearchValue(''); // inputRef.current?.focus();
|
|
1001
|
+
|
|
1002
|
+
setVisible(false);
|
|
1003
|
+
}
|
|
1004
|
+
}.bind(this), [disabled, onChange, setVisible, setSearchValue]);
|
|
1005
|
+
var empty = (0, _react.useMemo)(function () {
|
|
1006
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
1007
|
+
return !(value !== null && value !== void 0 && value.length);
|
|
1008
|
+
}.bind(this), [value]);
|
|
1009
|
+
var handleSelectorClick = (0, _react.useCallback)(function (e) {
|
|
1010
|
+
var _inputRef$current4, _popupProps$onClick2;
|
|
1011
|
+
|
|
1012
|
+
(0, _newArrowCheck2.default)(this, _this16);
|
|
1013
|
+
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.focus();
|
|
1014
|
+
(_popupProps$onClick2 = _popupProps.onClick) === null || _popupProps$onClick2 === void 0 ? void 0 : _popupProps$onClick2.call(_popupProps, e);
|
|
1015
|
+
}.bind(this), [_popupProps]);
|
|
1016
|
+
|
|
1017
|
+
var _useState = (0, _react.useState)(0),
|
|
1018
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
1019
|
+
count = _useState2[0],
|
|
1020
|
+
setCount = _useState2[1];
|
|
1021
|
+
|
|
1022
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_style2.SSelectorMultiple, (0, _extends2.default)({
|
|
1023
|
+
focused: visible,
|
|
1024
|
+
empty: empty
|
|
1025
|
+
}, _popupProps, {
|
|
1026
|
+
onClick: handleSelectorClick,
|
|
1027
|
+
block: block,
|
|
1028
|
+
size: size,
|
|
1029
|
+
disabled: disabled
|
|
1030
|
+
}), /*#__PURE__*/_react.default.createElement(_style.InputPart, {
|
|
1031
|
+
stretch: true,
|
|
1032
|
+
className: _style2.measureWrapCls
|
|
1033
|
+
}, placeholder && empty && !searchValue && /*#__PURE__*/_react.default.createElement("div", {
|
|
1034
|
+
className: _style2.placeholderCls
|
|
1035
|
+
}, placeholder), items.length ? /*#__PURE__*/_react.default.createElement(_Overflow.Static, (0, _extends2.default)({
|
|
1036
|
+
items: items,
|
|
1037
|
+
renderItem: renderItem,
|
|
1038
|
+
renderRest: renderRest,
|
|
1039
|
+
static: true,
|
|
1040
|
+
count: count
|
|
1041
|
+
}, _popupProps)) : null, search ? /*#__PURE__*/_react.default.createElement("input", {
|
|
1042
|
+
value: searchValue,
|
|
1043
|
+
ref: inputRef,
|
|
1044
|
+
onChange: handleInput,
|
|
1045
|
+
disabled: disabled
|
|
1046
|
+
}) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
1047
|
+
className: _style2.measureCls
|
|
1048
|
+
}, items.length ? /*#__PURE__*/_react.default.createElement(_Overflow.default, {
|
|
1049
|
+
items: items,
|
|
1050
|
+
renderItem: renderItem,
|
|
1051
|
+
renderRest: renderRest,
|
|
1052
|
+
onMeasure: setCount,
|
|
1053
|
+
changeContent: searchValue
|
|
1054
|
+
}) : null, search ? /*#__PURE__*/_react.default.createElement("span", {
|
|
1055
|
+
className: _style2.measureContentCls
|
|
1056
|
+
}, searchValue) : null)), /*#__PURE__*/_react.default.createElement(_style.Clear, {
|
|
1057
|
+
clearable: clearable && !empty,
|
|
1058
|
+
onClick: handleClear
|
|
1059
|
+
}), /*#__PURE__*/_react.default.createElement(_style.InputPart, null, /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
1060
|
+
type: visible ? 'arrow-up' : 'arrow-down'
|
|
1061
|
+
}))));
|
|
1062
|
+
}); // 单选下的选择器
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
var SingleSelector = /*#__PURE__*/_react.default.memo(function SingleSelector(_ref18) {
|
|
1066
|
+
var _this19 = this;
|
|
1067
|
+
|
|
1068
|
+
var size = _ref18.size,
|
|
1069
|
+
disabled = _ref18.disabled,
|
|
1070
|
+
placeholder = _ref18.placeholder,
|
|
1071
|
+
renderContent = _ref18.renderContent,
|
|
1072
|
+
renderPopup = _ref18.renderPopup,
|
|
1073
|
+
value = _ref18.value,
|
|
1074
|
+
onChange = _ref18.onChange,
|
|
1075
|
+
visible = _ref18.visible,
|
|
1076
|
+
setVisible = _ref18.setVisible,
|
|
1077
|
+
dataSource = _ref18.dataSource,
|
|
1078
|
+
search = _ref18.search,
|
|
1079
|
+
_ref18$searchValue = _ref18.searchValue,
|
|
1080
|
+
searchValue = _ref18$searchValue === void 0 ? '' : _ref18$searchValue,
|
|
1081
|
+
setSearchValue = _ref18.setSearchValue,
|
|
1082
|
+
clearable = _ref18.clearable,
|
|
1083
|
+
_popupProps = _ref18._popupProps;
|
|
1084
|
+
var inputRef = (0, _react.useRef)(null);
|
|
1085
|
+
var getContent = (0, _react.useCallback)(function () {
|
|
1086
|
+
var _this20 = this;
|
|
1087
|
+
|
|
1088
|
+
(0, _newArrowCheck2.default)(this, _this19);
|
|
1089
|
+
|
|
1090
|
+
var _dataSource4 = (0, _slicedToArray2.default)(dataSource, 5),
|
|
1091
|
+
_dataSource4$ = _dataSource4[4],
|
|
1092
|
+
childrenMap = _dataSource4$ === void 0 ? new Map() : _dataSource4$;
|
|
1093
|
+
|
|
1094
|
+
var getValueChild = function getValueChild(v) {
|
|
1095
|
+
(0, _newArrowCheck2.default)(this, _this20);
|
|
1096
|
+
return childrenMap.has(v) ? childrenMap.get(v) : v;
|
|
1097
|
+
}.bind(this);
|
|
1098
|
+
|
|
1099
|
+
var valueChild = getValueChild(value);
|
|
1100
|
+
|
|
1101
|
+
if (renderContent) {
|
|
1102
|
+
return renderContent(value, valueChild);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
return value === undefined ? undefined : valueChild;
|
|
1106
|
+
}.bind(this), [dataSource, renderContent, value]);
|
|
1107
|
+
var content = (0, _react.useMemo)(getContent, [getContent]); // 自定义渲染弹层时,开发者可能不传入 options 和 children,导致 content memo deps 不触发变更,故强制更新
|
|
1108
|
+
|
|
1109
|
+
if (renderPopup) content = getContent();
|
|
1110
|
+
var handleInput = (0, _react.useCallback)(function (e) {
|
|
1111
|
+
(0, _newArrowCheck2.default)(this, _this19);
|
|
1112
|
+
setSearchValue(e.target.value);
|
|
1113
|
+
}.bind(this), [setSearchValue]);
|
|
1114
|
+
var empty = value === undefined;
|
|
1115
|
+
|
|
1116
|
+
var sharedProps = _objectSpread({
|
|
1117
|
+
className: _style2.selectInputCls,
|
|
1118
|
+
size: size,
|
|
1119
|
+
disabled: disabled,
|
|
1120
|
+
block: true,
|
|
1121
|
+
cursor: search ? 'text' : 'pointer',
|
|
1122
|
+
focused: visible,
|
|
1123
|
+
empty: empty,
|
|
1124
|
+
search: search
|
|
1125
|
+
}, _popupProps);
|
|
1126
|
+
|
|
1127
|
+
(0, _react.useEffect)(function () {
|
|
1128
|
+
var _inputRef$current5;
|
|
1129
|
+
|
|
1130
|
+
(0, _newArrowCheck2.default)(this, _this19);
|
|
1131
|
+
if (visible) (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.focus();
|
|
1132
|
+
}.bind(this), [visible]);
|
|
1133
|
+
var handleClear = (0, _react.useCallback)(function (e) {
|
|
1134
|
+
(0, _newArrowCheck2.default)(this, _this19);
|
|
1135
|
+
e.preventDefault();
|
|
1136
|
+
e.stopPropagation();
|
|
1137
|
+
|
|
1138
|
+
if (!disabled) {
|
|
1139
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
|
|
1140
|
+
setSearchValue(''); // inputRef.current?.focus();
|
|
1141
|
+
|
|
1142
|
+
setVisible(false);
|
|
1143
|
+
}
|
|
1144
|
+
}.bind(this), [disabled, onChange, setVisible, setSearchValue]);
|
|
1145
|
+
return /*#__PURE__*/_react.default.createElement(_style2.SSelectorSingle, sharedProps, /*#__PURE__*/_react.default.createElement(_style.InputPart, {
|
|
1146
|
+
stretch: true,
|
|
1147
|
+
className: _style2.inputWrapCls
|
|
1148
|
+
}, content ? /*#__PURE__*/_react.default.createElement("span", {
|
|
1149
|
+
className: (0, _classnames.default)(_style2.placeholderCls, _style2.contentCls),
|
|
1150
|
+
style: {
|
|
1151
|
+
visibility: searchValue ? 'hidden' : 'visible'
|
|
1152
|
+
}
|
|
1153
|
+
}, content) : /*#__PURE__*/_react.default.createElement("span", {
|
|
1154
|
+
className: _style2.placeholderCls,
|
|
1155
|
+
style: {
|
|
1156
|
+
visibility: searchValue ? 'hidden' : 'visible'
|
|
1157
|
+
}
|
|
1158
|
+
}, placeholder), search && /*#__PURE__*/_react.default.createElement("input", {
|
|
1159
|
+
className: _style2.inputCls,
|
|
1160
|
+
value: searchValue,
|
|
1161
|
+
onChange: handleInput,
|
|
1162
|
+
disabled: disabled,
|
|
1163
|
+
ref: inputRef
|
|
1164
|
+
})), /*#__PURE__*/_react.default.createElement(_style.Clear, {
|
|
1165
|
+
clearable: clearable && !empty,
|
|
1166
|
+
onClick: handleClear
|
|
1167
|
+
}), /*#__PURE__*/_react.default.createElement(_style.InputPart, null, /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
1168
|
+
type: visible ? 'arrow-up' : 'arrow-down'
|
|
1169
|
+
})));
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
var Select = function Select(_ref19) {
|
|
1173
|
+
var _search,
|
|
1174
|
+
_search2,
|
|
1175
|
+
_search3,
|
|
1176
|
+
_this21 = this;
|
|
1177
|
+
|
|
1178
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
1179
|
+
var _ref19$size = _ref19.size,
|
|
1180
|
+
size = _ref19$size === void 0 ? 'md' : _ref19$size,
|
|
1181
|
+
_value = _ref19.value,
|
|
1182
|
+
defaultValue = _ref19.defaultValue,
|
|
1183
|
+
_onChange = _ref19.onChange,
|
|
1184
|
+
_ref19$onVisibleChang = _ref19.onVisibleChange,
|
|
1185
|
+
onVisibleChange = _ref19$onVisibleChang === void 0 ? _noop.default : _ref19$onVisibleChang,
|
|
1186
|
+
disabled = _ref19.disabled,
|
|
1187
|
+
search = _ref19.search,
|
|
1188
|
+
multiple = _ref19.multiple,
|
|
1189
|
+
renderContent = _ref19.renderContent,
|
|
1190
|
+
renderSelector = _ref19.renderSelector,
|
|
1191
|
+
placeholder = _ref19.placeholder,
|
|
1192
|
+
_locale = _ref19.locale,
|
|
1193
|
+
options = _ref19.options,
|
|
1194
|
+
children = _ref19.children,
|
|
1195
|
+
emptyContent = _ref19.emptyContent,
|
|
1196
|
+
showSelectAll = _ref19.showSelectAll,
|
|
1197
|
+
extra = _ref19.extra,
|
|
1198
|
+
clearable = _ref19.clearable,
|
|
1199
|
+
customStyle = _ref19.customStyle,
|
|
1200
|
+
popover = _ref19.popover,
|
|
1201
|
+
popoverProps = _ref19.popoverProps,
|
|
1202
|
+
renderPopup = _ref19.renderPopup,
|
|
1203
|
+
virtualList = _ref19.virtualList,
|
|
1204
|
+
block = _ref19.block,
|
|
1205
|
+
styleType = _ref19.styleType,
|
|
1206
|
+
htmlProps = (0, _objectWithoutProperties2.default)(_ref19, _excluded6);
|
|
1207
|
+
if (multiple) clearable = true;
|
|
1208
|
+
|
|
1209
|
+
var _useUncontrolled = (0, _useUncontrolled5.default)(_value, defaultValue, _onChange),
|
|
1210
|
+
_useUncontrolled2 = (0, _slicedToArray2.default)(_useUncontrolled, 2),
|
|
1211
|
+
value = _useUncontrolled2[0],
|
|
1212
|
+
onChange = _useUncontrolled2[1];
|
|
1213
|
+
|
|
1214
|
+
var _useState3 = (0, _react.useState)(false),
|
|
1215
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
1216
|
+
visible = _useState4[0],
|
|
1217
|
+
setVisible = _useState4[1];
|
|
1218
|
+
|
|
1219
|
+
var locale = (0, _useLocale.default)(_zh_CN.default, 'Select', _locale);
|
|
1220
|
+
var wrapRef = (0, _react.useRef)(null);
|
|
1221
|
+
if (search === true) search = {};
|
|
1222
|
+
|
|
1223
|
+
var _useUncontrolled3 = (0, _useUncontrolled5.default)((_search = search) === null || _search === void 0 ? void 0 : _search.searchValue, ((_search2 = search) === null || _search2 === void 0 ? void 0 : _search2.defaultSearchValue) || '', (_search3 = search) === null || _search3 === void 0 ? void 0 : _search3.onSearchValueChange),
|
|
1224
|
+
_useUncontrolled4 = (0, _slicedToArray2.default)(_useUncontrolled3, 2),
|
|
1225
|
+
searchValue = _useUncontrolled4[0],
|
|
1226
|
+
setSearchValue = _useUncontrolled4[1];
|
|
1227
|
+
|
|
1228
|
+
(0, _useInitial.default)(function () {
|
|
1229
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1230
|
+
if (popover) deprecatedLogForPopover();
|
|
1231
|
+
if (virtualList && !options) warnLogForVirtualList();
|
|
1232
|
+
}.bind(this));
|
|
1233
|
+
var handleSearch = (0, _react.useCallback)(function (value, props) {
|
|
1234
|
+
var _this22 = this;
|
|
1235
|
+
|
|
1236
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1237
|
+
|
|
1238
|
+
if (!search || !searchValue) {
|
|
1239
|
+
return true;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
if ((0, _typeof2.default)(search) === 'object' && search.handleSearch) {
|
|
1243
|
+
var _beforeProps$label;
|
|
1244
|
+
|
|
1245
|
+
// assign props for forward compatible
|
|
1246
|
+
var beforeProps = _objectSpread({}, props);
|
|
1247
|
+
|
|
1248
|
+
if (options) beforeProps.children = (_beforeProps$label = beforeProps.label) !== null && _beforeProps$label !== void 0 ? _beforeProps$label : beforeProps.value;
|
|
1249
|
+
|
|
1250
|
+
var itemInfo = _objectSpread({}, props);
|
|
1251
|
+
|
|
1252
|
+
if (!('props' in itemInfo)) {
|
|
1253
|
+
Object.defineProperty(itemInfo, 'props', {
|
|
1254
|
+
get: function get() {
|
|
1255
|
+
(0, _newArrowCheck2.default)(this, _this22);
|
|
1256
|
+
warnLogForSearchProps();
|
|
1257
|
+
return beforeProps;
|
|
1258
|
+
}.bind(this)
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
return search.handleSearch(searchValue, value, itemInfo);
|
|
1263
|
+
} else {
|
|
1264
|
+
var _props$label;
|
|
1265
|
+
|
|
1266
|
+
// use label for options case
|
|
1267
|
+
var _children = options ? (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : props.value : props.children;
|
|
1268
|
+
|
|
1269
|
+
if (_children && typeof _children === 'string') {
|
|
1270
|
+
var i = _children.indexOf(searchValue);
|
|
1271
|
+
|
|
1272
|
+
if (i >= 0) {
|
|
1273
|
+
var l = searchValue.length;
|
|
1274
|
+
return [_children.substring(0, i), _children.substring(i, i + l), _children.substring(i + l)];
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
return (value + '').indexOf(searchValue) >= 0;
|
|
1279
|
+
}
|
|
1280
|
+
}.bind(this), [options, search, searchValue]);
|
|
1281
|
+
var childrenDataSource = (0, _react.useMemo)(function () {
|
|
1282
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1283
|
+
return options ? [] : groupChildrenAsDataSource(children, disabled, groupOptions, searchValue, handleSearch);
|
|
1284
|
+
}.bind(this), [children, disabled, handleSearch, options, searchValue]);
|
|
1285
|
+
var optionsDataSource = (0, _react.useMemo)(function () {
|
|
1286
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1287
|
+
return options ? groupOptionsAsDataSource(options, disabled, groupOptions, searchValue, handleSearch) : [];
|
|
1288
|
+
}.bind(this), [disabled, handleSearch, options, searchValue]);
|
|
1289
|
+
var dataSource = (0, _react.useMemo)(function () {
|
|
1290
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1291
|
+
|
|
1292
|
+
if (options) {
|
|
1293
|
+
return optionsDataSource;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
return childrenDataSource;
|
|
1297
|
+
}.bind(this), [options, childrenDataSource, optionsDataSource]);
|
|
1298
|
+
virtualList = (0, _react.useMemo)(function () {
|
|
1299
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1300
|
+
return options ? virtualList : false;
|
|
1301
|
+
}.bind(this), [options, virtualList]);
|
|
1302
|
+
var handleVisibleChange = (0, _react.useCallback)(function (open) {
|
|
1303
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1304
|
+
if (disabled) return;
|
|
1305
|
+
setVisible(open);
|
|
1306
|
+
onVisibleChange(open);
|
|
1307
|
+
if (!open) setSearchValue('');
|
|
1308
|
+
}.bind(this), [disabled, onVisibleChange, setSearchValue]);
|
|
1309
|
+
var hidePopup = (0, _react.useCallback)(function () {
|
|
1310
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1311
|
+
return handleVisibleChange(false);
|
|
1312
|
+
}.bind(this), [handleVisibleChange]);
|
|
1313
|
+
var hasSubGroup = (0, _react.useMemo)(function () {
|
|
1314
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1315
|
+
var hasSubGroup = dataSource[3].size > 0;
|
|
1316
|
+
warnLogForSubGroup();
|
|
1317
|
+
return hasSubGroup;
|
|
1318
|
+
}.bind(this), [dataSource]); // 多层数据/搜索且自定义 selector/自定义渲染内容时,无法兼容,回滚到老版本
|
|
1319
|
+
|
|
1320
|
+
var _useState5 = (0, _react.useState)(function () {
|
|
1321
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1322
|
+
return hasSubGroup || !!(search && (renderContent || renderSelector));
|
|
1323
|
+
}.bind(this)),
|
|
1324
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 1),
|
|
1325
|
+
v1 = _useState6[0];
|
|
1326
|
+
|
|
1327
|
+
var handleOnChange = (0, _react.useCallback)(function (v) {
|
|
1328
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1329
|
+
onChange(v);
|
|
1330
|
+
setSearchValue('');
|
|
1331
|
+
}.bind(this), [onChange, setSearchValue]);
|
|
1332
|
+
|
|
1333
|
+
var popup = /*#__PURE__*/_react.default.createElement(Popup, {
|
|
1334
|
+
v1: v1,
|
|
1335
|
+
extra: extra,
|
|
1336
|
+
customStyle: customStyle,
|
|
1337
|
+
search: search,
|
|
1338
|
+
multiple: multiple,
|
|
1339
|
+
emptyContent: emptyContent,
|
|
1340
|
+
showSelectAll: showSelectAll,
|
|
1341
|
+
value: value,
|
|
1342
|
+
renderPopup: renderPopup,
|
|
1343
|
+
handleVisibleChange: handleVisibleChange,
|
|
1344
|
+
options: options,
|
|
1345
|
+
onChange: handleOnChange,
|
|
1346
|
+
locale: locale,
|
|
1347
|
+
hidePopup: hidePopup,
|
|
1348
|
+
dataSource: dataSource,
|
|
1349
|
+
searchValue: searchValue,
|
|
1350
|
+
setSearchValue: setSearchValue,
|
|
1351
|
+
virtualList: virtualList
|
|
1352
|
+
}, children);
|
|
1353
|
+
|
|
1354
|
+
var selector = /*#__PURE__*/_react.default.createElement(Selector, {
|
|
1355
|
+
v1: v1,
|
|
1356
|
+
size: size,
|
|
1357
|
+
disabled: disabled,
|
|
1358
|
+
multiple: multiple,
|
|
1359
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : locale.placeholder,
|
|
1360
|
+
renderContent: renderContent,
|
|
1361
|
+
renderSelector: renderSelector,
|
|
1362
|
+
renderPopup: renderPopup,
|
|
1363
|
+
value: value,
|
|
1364
|
+
onChange: onChange,
|
|
1365
|
+
visible: visible,
|
|
1366
|
+
setVisible: setVisible,
|
|
1367
|
+
locale: locale,
|
|
1368
|
+
dataSource: dataSource,
|
|
1369
|
+
clearable: clearable,
|
|
1370
|
+
search: search,
|
|
1371
|
+
searchValue: searchValue,
|
|
1372
|
+
setSearchValue: setSearchValue,
|
|
1373
|
+
styleType: styleType,
|
|
1374
|
+
wrapRef: wrapRef,
|
|
1375
|
+
block: block
|
|
1376
|
+
});
|
|
1377
|
+
|
|
1378
|
+
var popoverTriggerAttrs = (0, _react.useMemo)(function () {
|
|
1379
|
+
(0, _newArrowCheck2.default)(this, _this21);
|
|
1380
|
+
return v1 ? {
|
|
1381
|
+
trigger: ['click']
|
|
1382
|
+
} : {
|
|
1383
|
+
trigger: [],
|
|
1384
|
+
showAction: ['click', 'contextMenu', 'focus']
|
|
1385
|
+
};
|
|
1386
|
+
}.bind(this), [v1]);
|
|
1387
|
+
var popoverConfigProps = (0, _usePopoverConfig.default)();
|
|
1388
|
+
return /*#__PURE__*/_react.default.createElement(_SelectContext.default.Provider, {
|
|
1389
|
+
value: {
|
|
1390
|
+
hidePopup: hidePopup,
|
|
1391
|
+
handleSearch: handleSearch,
|
|
1392
|
+
searchValue: searchValue
|
|
1393
|
+
}
|
|
1394
|
+
}, /*#__PURE__*/_react.default.createElement(_style2.SelectWrap, (0, _extends2.default)({
|
|
1395
|
+
ref: wrapRef,
|
|
1396
|
+
disabled: disabled,
|
|
1397
|
+
multiple: multiple,
|
|
1398
|
+
block: block
|
|
1399
|
+
}, htmlProps), /*#__PURE__*/_react.default.createElement(_Popover.default, (0, _extends2.default)({
|
|
1400
|
+
visible: visible,
|
|
1401
|
+
onVisibleChange: handleVisibleChange,
|
|
1402
|
+
placement: "bottomLeft",
|
|
1403
|
+
stretch: block ? blockPopoverStretch : popoverStretch
|
|
1404
|
+
}, popoverTriggerAttrs, popoverConfigProps, popover, popoverProps, {
|
|
1405
|
+
popup: popup,
|
|
1406
|
+
forceRender: false
|
|
1407
|
+
}), selector)));
|
|
1408
|
+
}.bind(void 0);
|
|
1409
|
+
|
|
1410
|
+
Select.propTypes = {
|
|
1411
|
+
placeholder: _propTypes.default.node,
|
|
1412
|
+
onChange: _propTypes.default.func,
|
|
1413
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
1414
|
+
label: _propTypes.default.node
|
|
1415
|
+
})),
|
|
1416
|
+
extra: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
1417
|
+
content: _propTypes.default.node.isRequired
|
|
1418
|
+
}), _propTypes.default.node, _propTypes.default.func]),
|
|
1419
|
+
multiple: _propTypes.default.bool,
|
|
1420
|
+
showSelectAll: _propTypes.default.bool,
|
|
1421
|
+
disabled: _propTypes.default.bool,
|
|
1422
|
+
styleType: _propTypes.default.oneOf(['list']),
|
|
1423
|
+
renderContent: _propTypes.default.func,
|
|
1424
|
+
renderSelector: _propTypes.default.func,
|
|
1425
|
+
renderPopup: _propTypes.default.func,
|
|
1426
|
+
search: _propTypes.default.oneOfType([_propTypes.default.oneOf([true]), _propTypes.default.shape({
|
|
1427
|
+
handleSearch: _propTypes.default.func,
|
|
1428
|
+
searchValue: _propTypes.default.string,
|
|
1429
|
+
defaultSearchValue: _propTypes.default.string,
|
|
1430
|
+
onSearchValueChange: _propTypes.default.func
|
|
1431
|
+
})]),
|
|
1432
|
+
block: _propTypes.default.bool,
|
|
1433
|
+
clearable: _propTypes.default.bool,
|
|
1434
|
+
popover: _propTypes.default.any,
|
|
1435
|
+
popoverProps: _propTypes.default.any,
|
|
1436
|
+
onVisibleChange: _propTypes.default.func,
|
|
1437
|
+
locale: _propTypes.default.any,
|
|
1438
|
+
customStyle: _propTypes.default.shape({
|
|
1439
|
+
optionListMaxHeight: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
1440
|
+
popupMaxWidth: _propTypes.default.string,
|
|
1441
|
+
popupWidth: _propTypes.default.string
|
|
1442
|
+
}),
|
|
1443
|
+
emptyContent: _propTypes.default.node,
|
|
1444
|
+
virtualList: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.shape({
|
|
1445
|
+
simple: _propTypes.default.oneOf([true]),
|
|
1446
|
+
height: _propTypes.default.number
|
|
1447
|
+
})])
|
|
1448
|
+
};
|
|
1449
|
+
|
|
1450
|
+
var _default = /*#__PURE__*/_react.default.memo(Select);
|
|
1451
|
+
|
|
1452
|
+
exports.default = _default;
|