@douyinfe/semi-ui 2.1.0-beta.0 → 2.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/semi.css +43 -51
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +567 -660
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_base/base.css +510 -0
- package/lib/cjs/_base/base.d.ts +32 -0
- package/lib/cjs/_base/base.js +7 -0
- package/lib/cjs/_base/base.scss +3 -0
- package/lib/cjs/_base/baseComponent.d.ts +25 -0
- package/lib/cjs/_base/baseComponent.js +84 -0
- package/lib/cjs/_base/reactUtils.d.ts +8 -0
- package/lib/cjs/_base/reactUtils.js +55 -0
- package/lib/cjs/_portal/index.d.ts +36 -0
- package/lib/cjs/_portal/index.js +151 -0
- package/lib/cjs/_utils/index.d.ts +68 -0
- package/lib/cjs/_utils/index.js +189 -0
- package/lib/cjs/anchor/anchor-context.d.ts +7 -0
- package/lib/cjs/anchor/anchor-context.js +18 -0
- package/lib/cjs/anchor/index.d.ts +93 -0
- package/lib/cjs/anchor/index.js +334 -0
- package/lib/cjs/anchor/link.d.ts +37 -0
- package/lib/cjs/anchor/link.js +174 -0
- package/lib/cjs/autoComplete/index.d.ts +142 -0
- package/lib/cjs/autoComplete/index.js +427 -0
- package/lib/cjs/avatar/avatarGroup.d.ts +22 -0
- package/lib/cjs/avatar/avatarGroup.js +167 -0
- package/lib/cjs/avatar/index.d.ts +48 -0
- package/lib/cjs/avatar/index.js +259 -0
- package/lib/cjs/avatar/interface.d.ts +31 -0
- package/lib/cjs/avatar/interface.js +7 -0
- package/lib/cjs/backtop/index.d.ts +38 -0
- package/lib/cjs/backtop/index.js +144 -0
- package/lib/cjs/badge/index.d.ts +38 -0
- package/lib/cjs/badge/index.js +107 -0
- package/lib/cjs/banner/index.d.ts +50 -0
- package/lib/cjs/banner/index.js +209 -0
- package/lib/cjs/breadcrumb/bread-context.d.ts +11 -0
- package/lib/cjs/breadcrumb/bread-context.js +18 -0
- package/lib/cjs/breadcrumb/index.d.ts +81 -0
- package/lib/cjs/breadcrumb/index.js +286 -0
- package/lib/cjs/breadcrumb/item.d.ts +53 -0
- package/lib/cjs/breadcrumb/item.js +246 -0
- package/lib/cjs/button/Button.d.ts +61 -0
- package/lib/cjs/button/Button.js +145 -0
- package/lib/cjs/button/buttonGroup.d.ts +26 -0
- package/lib/cjs/button/buttonGroup.js +91 -0
- package/lib/cjs/button/index.d.ts +38 -0
- package/lib/cjs/button/index.js +45 -0
- package/lib/cjs/button/splitButtonGroup.d.ts +12 -0
- package/lib/cjs/button/splitButtonGroup.js +47 -0
- package/lib/cjs/calendar/dayCalendar.d.ts +50 -0
- package/lib/cjs/calendar/dayCalendar.js +234 -0
- package/lib/cjs/calendar/dayCol.d.ts +41 -0
- package/lib/cjs/calendar/dayCol.js +211 -0
- package/lib/cjs/calendar/index.d.ts +42 -0
- package/lib/cjs/calendar/index.js +119 -0
- package/lib/cjs/calendar/interface.d.ts +37 -0
- package/lib/cjs/calendar/interface.js +7 -0
- package/lib/cjs/calendar/monthCalendar.d.ts +59 -0
- package/lib/cjs/calendar/monthCalendar.js +474 -0
- package/lib/cjs/calendar/rangeCalendar.d.ts +51 -0
- package/lib/cjs/calendar/rangeCalendar.js +329 -0
- package/lib/cjs/calendar/timeCol.d.ts +15 -0
- package/lib/cjs/calendar/timeCol.js +101 -0
- package/lib/cjs/calendar/weekCalendar.d.ts +52 -0
- package/lib/cjs/calendar/weekCalendar.js +331 -0
- package/lib/cjs/card/cardGroup.d.ts +27 -0
- package/lib/cjs/card/cardGroup.js +87 -0
- package/lib/cjs/card/index.d.ts +75 -0
- package/lib/cjs/card/index.js +222 -0
- package/lib/cjs/card/meta.d.ts +26 -0
- package/lib/cjs/card/meta.js +93 -0
- package/lib/cjs/cascader/index.d.ts +178 -0
- package/lib/cjs/cascader/index.js +972 -0
- package/lib/cjs/cascader/item.d.ts +72 -0
- package/lib/cjs/cascader/item.js +353 -0
- package/lib/cjs/checkbox/checkbox.d.ts +61 -0
- package/lib/cjs/checkbox/checkbox.js +205 -0
- package/lib/cjs/checkbox/checkboxGroup.d.ts +49 -0
- package/lib/cjs/checkbox/checkboxGroup.js +183 -0
- package/lib/cjs/checkbox/checkboxInner.d.ts +40 -0
- package/lib/cjs/checkbox/checkboxInner.js +97 -0
- package/lib/cjs/checkbox/context.d.ts +14 -0
- package/lib/cjs/checkbox/context.js +17 -0
- package/lib/cjs/checkbox/index.d.ts +8 -0
- package/lib/cjs/checkbox/index.js +29 -0
- package/lib/cjs/collapse/collapse-context.d.ts +13 -0
- package/lib/cjs/collapse/collapse-context.js +18 -0
- package/lib/cjs/collapse/index.d.ts +43 -0
- package/lib/cjs/collapse/index.js +169 -0
- package/lib/cjs/collapse/item.d.ts +23 -0
- package/lib/cjs/collapse/item.js +151 -0
- package/lib/cjs/collapsible/index.d.ts +36 -0
- package/lib/cjs/collapsible/index.js +177 -0
- package/lib/cjs/configProvider/context.d.ts +11 -0
- package/lib/cjs/configProvider/context.js +18 -0
- package/lib/cjs/configProvider/index.d.ts +19 -0
- package/lib/cjs/configProvider/index.js +83 -0
- package/lib/cjs/datePicker/dateInput.d.ts +81 -0
- package/lib/cjs/datePicker/dateInput.js +408 -0
- package/lib/cjs/datePicker/datePicker.d.ts +180 -0
- package/lib/cjs/datePicker/datePicker.js +723 -0
- package/lib/cjs/datePicker/footer.d.ts +11 -0
- package/lib/cjs/datePicker/footer.js +39 -0
- package/lib/cjs/datePicker/index.d.ts +11 -0
- package/lib/cjs/datePicker/index.js +67 -0
- package/lib/cjs/datePicker/month.d.ts +203 -0
- package/lib/cjs/datePicker/month.js +503 -0
- package/lib/cjs/datePicker/monthsGrid.d.ts +88 -0
- package/lib/cjs/datePicker/monthsGrid.js +700 -0
- package/lib/cjs/datePicker/navigation.d.ts +44 -0
- package/lib/cjs/datePicker/navigation.js +117 -0
- package/lib/cjs/datePicker/quickControl.d.ts +22 -0
- package/lib/cjs/datePicker/quickControl.js +86 -0
- package/lib/cjs/datePicker/yearAndMonth.d.ts +48 -0
- package/lib/cjs/datePicker/yearAndMonth.js +279 -0
- package/lib/cjs/descriptions/descriptions-context.d.ts +7 -0
- package/lib/cjs/descriptions/descriptions-context.js +18 -0
- package/lib/cjs/descriptions/index.d.ts +47 -0
- package/lib/cjs/descriptions/index.js +102 -0
- package/lib/cjs/descriptions/item.d.ts +19 -0
- package/lib/cjs/descriptions/item.js +89 -0
- package/lib/cjs/dropdown/context.d.ts +5 -0
- package/lib/cjs/dropdown/context.js +20 -0
- package/lib/cjs/dropdown/dropdownDivider.d.ts +5 -0
- package/lib/cjs/dropdown/dropdownDivider.js +40 -0
- package/lib/cjs/dropdown/dropdownItem.d.ts +47 -0
- package/lib/cjs/dropdown/dropdownItem.js +134 -0
- package/lib/cjs/dropdown/dropdownMenu.d.ts +12 -0
- package/lib/cjs/dropdown/dropdownMenu.js +66 -0
- package/lib/cjs/dropdown/dropdownTitle.d.ts +16 -0
- package/lib/cjs/dropdown/dropdownTitle.js +62 -0
- package/lib/cjs/dropdown/index.d.ts +103 -0
- package/lib/cjs/dropdown/index.js +284 -0
- package/lib/cjs/empty/index.d.ts +38 -0
- package/lib/cjs/empty/index.js +141 -0
- package/lib/cjs/form/arrayField.d.ts +33 -0
- package/lib/cjs/form/arrayField.js +265 -0
- package/lib/cjs/form/baseForm.d.ts +148 -0
- package/lib/cjs/form/baseForm.js +326 -0
- package/lib/cjs/form/context.d.ts +9 -0
- package/lib/cjs/form/context.js +35 -0
- package/lib/cjs/form/errorMessage.d.ts +25 -0
- package/lib/cjs/form/errorMessage.js +108 -0
- package/lib/cjs/form/field.d.ts +96 -0
- package/lib/cjs/form/field.js +132 -0
- package/lib/cjs/form/group.d.ts +14 -0
- package/lib/cjs/form/group.js +147 -0
- package/lib/cjs/form/hoc/withField.d.ts +12 -0
- package/lib/cjs/form/hoc/withField.js +557 -0
- package/lib/cjs/form/hoc/withFormApi.d.ts +3 -0
- package/lib/cjs/form/hoc/withFormApi.js +25 -0
- package/lib/cjs/form/hoc/withFormState.d.ts +3 -0
- package/lib/cjs/form/hoc/withFormState.js +25 -0
- package/lib/cjs/form/hooks/index.d.ts +8 -0
- package/lib/cjs/form/hooks/index.js +72 -0
- package/lib/cjs/form/hooks/useArrayFieldState.d.ts +4 -0
- package/lib/cjs/form/hooks/useArrayFieldState.js +21 -0
- package/lib/cjs/form/hooks/useFieldApi.d.ts +10 -0
- package/lib/cjs/form/hooks/useFieldApi.js +31 -0
- package/lib/cjs/form/hooks/useFieldState.d.ts +6 -0
- package/lib/cjs/form/hooks/useFieldState.js +40 -0
- package/lib/cjs/form/hooks/useFormApi.d.ts +1 -0
- package/lib/cjs/form/hooks/useFormApi.js +17 -0
- package/lib/cjs/form/hooks/useFormState.d.ts +2 -0
- package/lib/cjs/form/hooks/useFormState.js +21 -0
- package/lib/cjs/form/hooks/useFormUpdater.d.ts +1 -0
- package/lib/cjs/form/hooks/useFormUpdater.js +17 -0
- package/lib/cjs/form/hooks/useStateWithGetter.d.ts +1 -0
- package/lib/cjs/form/hooks/useStateWithGetter.js +27 -0
- package/lib/cjs/form/index.d.ts +22 -0
- package/lib/cjs/form/index.js +117 -0
- package/lib/cjs/form/interface.d.ts +111 -0
- package/lib/cjs/form/interface.js +36 -0
- package/lib/cjs/form/label.d.ts +39 -0
- package/lib/cjs/form/label.js +91 -0
- package/lib/cjs/form/section.d.ts +17 -0
- package/lib/cjs/form/section.js +60 -0
- package/lib/cjs/form/slot.d.ts +14 -0
- package/lib/cjs/form/slot.js +200 -0
- package/lib/cjs/grid/col.d.ts +55 -0
- package/lib/cjs/grid/col.js +146 -0
- package/lib/cjs/grid/index.d.ts +5 -0
- package/lib/cjs/grid/index.js +27 -0
- package/lib/cjs/grid/row.d.ts +58 -0
- package/lib/cjs/grid/row.js +207 -0
- package/lib/cjs/iconButton/index.d.ts +47 -0
- package/lib/cjs/iconButton/index.js +154 -0
- package/lib/cjs/icons/index.d.ts +3 -0
- package/lib/cjs/icons/index.js +16 -0
- package/lib/cjs/index.d.ts +79 -0
- package/lib/cjs/index.js +782 -0
- package/lib/cjs/input/index.d.ts +170 -0
- package/lib/cjs/input/index.js +499 -0
- package/lib/cjs/input/inputGroup.d.ts +38 -0
- package/lib/cjs/input/inputGroup.js +163 -0
- package/lib/cjs/input/textarea.d.ts +44 -0
- package/lib/cjs/input/textarea.js +337 -0
- package/lib/cjs/inputNumber/index.d.ts +109 -0
- package/lib/cjs/inputNumber/index.js +528 -0
- package/lib/cjs/layout/Sider.d.ts +38 -0
- package/lib/cjs/layout/Sider.js +160 -0
- package/lib/cjs/layout/index.d.ts +43 -0
- package/lib/cjs/layout/index.js +174 -0
- package/lib/cjs/layout/layout-context.d.ts +9 -0
- package/lib/cjs/layout/layout-context.js +25 -0
- package/lib/cjs/list/index.d.ts +59 -0
- package/lib/cjs/list/index.js +189 -0
- package/lib/cjs/list/item.d.ts +36 -0
- package/lib/cjs/list/item.js +151 -0
- package/lib/cjs/list/list-context.d.ts +12 -0
- package/lib/cjs/list/list-context.js +18 -0
- package/lib/cjs/locale/context.d.ts +4 -0
- package/lib/cjs/locale/context.js +18 -0
- package/lib/cjs/locale/interface.d.ts +151 -0
- package/lib/cjs/locale/interface.js +7 -0
- package/lib/cjs/locale/localeConsumer.d.ts +21 -0
- package/lib/cjs/locale/localeConsumer.js +80 -0
- package/lib/cjs/locale/localeProvider.d.ts +18 -0
- package/lib/cjs/locale/localeProvider.js +54 -0
- package/lib/cjs/locale/source/ar.d.ts +3 -0
- package/lib/cjs/locale/source/ar.js +165 -0
- package/lib/cjs/locale/source/en_GB.d.ts +3 -0
- package/lib/cjs/locale/source/en_GB.js +165 -0
- package/lib/cjs/locale/source/en_US.d.ts +3 -0
- package/lib/cjs/locale/source/en_US.js +165 -0
- package/lib/cjs/locale/source/id_ID.d.ts +3 -0
- package/lib/cjs/locale/source/id_ID.js +165 -0
- package/lib/cjs/locale/source/ja_JP.d.ts +3 -0
- package/lib/cjs/locale/source/ja_JP.js +166 -0
- package/lib/cjs/locale/source/ko_KR.d.ts +3 -0
- package/lib/cjs/locale/source/ko_KR.js +166 -0
- package/lib/cjs/locale/source/ms_MY.d.ts +3 -0
- package/lib/cjs/locale/source/ms_MY.js +165 -0
- package/lib/cjs/locale/source/pt_BR.d.ts +3 -0
- package/lib/cjs/locale/source/pt_BR.js +173 -0
- package/lib/cjs/locale/source/ru_RU.d.ts +3 -0
- package/lib/cjs/locale/source/ru_RU.js +168 -0
- package/lib/cjs/locale/source/th_TH.d.ts +3 -0
- package/lib/cjs/locale/source/th_TH.js +169 -0
- package/lib/cjs/locale/source/tr_TR.d.ts +3 -0
- package/lib/cjs/locale/source/tr_TR.js +168 -0
- package/lib/cjs/locale/source/vi_VN.d.ts +3 -0
- package/lib/cjs/locale/source/vi_VN.js +168 -0
- package/lib/cjs/locale/source/zh_CN.d.ts +3 -0
- package/lib/cjs/locale/source/zh_CN.js +166 -0
- package/lib/cjs/locale/source/zh_TW.d.ts +3 -0
- package/lib/cjs/locale/source/zh_TW.js +166 -0
- package/lib/cjs/modal/ConfirmModal.d.ts +4 -0
- package/lib/cjs/modal/ConfirmModal.js +137 -0
- package/lib/cjs/modal/Modal.d.ts +133 -0
- package/lib/cjs/modal/Modal.js +437 -0
- package/lib/cjs/modal/ModalContent.d.ts +38 -0
- package/lib/cjs/modal/ModalContent.js +337 -0
- package/lib/cjs/modal/confirm.d.ts +215 -0
- package/lib/cjs/modal/confirm.js +132 -0
- package/lib/cjs/modal/index.d.ts +8 -0
- package/lib/cjs/modal/index.js +18 -0
- package/lib/cjs/modal/useModal/HookModal.d.ts +13 -0
- package/lib/cjs/modal/useModal/HookModal.js +79 -0
- package/lib/cjs/modal/useModal/index.d.ts +24 -0
- package/lib/cjs/modal/useModal/index.js +80 -0
- package/lib/cjs/motions/Rotate.d.ts +23 -0
- package/lib/cjs/motions/Rotate.js +87 -0
- package/lib/cjs/navigation/CollapseButton.d.ts +10 -0
- package/lib/cjs/navigation/CollapseButton.js +58 -0
- package/lib/cjs/navigation/Footer.d.ts +27 -0
- package/lib/cjs/navigation/Footer.js +107 -0
- package/lib/cjs/navigation/Header.d.ts +34 -0
- package/lib/cjs/navigation/Header.js +99 -0
- package/lib/cjs/navigation/Item.d.ts +70 -0
- package/lib/cjs/navigation/Item.js +294 -0
- package/lib/cjs/navigation/OpenIconTransition.d.ts +14 -0
- package/lib/cjs/navigation/OpenIconTransition.js +90 -0
- package/lib/cjs/navigation/SubNav.d.ts +103 -0
- package/lib/cjs/navigation/SubNav.js +438 -0
- package/lib/cjs/navigation/SubNavTransition.d.ts +17 -0
- package/lib/cjs/navigation/SubNavTransition.js +90 -0
- package/lib/cjs/navigation/index.d.ts +145 -0
- package/lib/cjs/navigation/index.js +442 -0
- package/lib/cjs/navigation/nav-context.d.ts +7 -0
- package/lib/cjs/navigation/nav-context.js +22 -0
- package/lib/cjs/notification/NoticeTransition.d.ts +10 -0
- package/lib/cjs/notification/NoticeTransition.js +90 -0
- package/lib/cjs/notification/index.d.ts +52 -0
- package/lib/cjs/notification/index.js +316 -0
- package/lib/cjs/notification/notice.d.ts +51 -0
- package/lib/cjs/notification/notice.js +240 -0
- package/lib/cjs/notification/useNotification/HookNotice.d.ts +7 -0
- package/lib/cjs/notification/useNotification/HookNotice.js +72 -0
- package/lib/cjs/notification/useNotification/index.d.ts +10 -0
- package/lib/cjs/notification/useNotification/index.js +161 -0
- package/lib/cjs/overflowList/index.d.ts +87 -0
- package/lib/cjs/overflowList/index.js +290 -0
- package/lib/cjs/overflowList/intersectionObserver.d.ts +34 -0
- package/lib/cjs/overflowList/intersectionObserver.js +119 -0
- package/lib/cjs/pagination/index.d.ts +99 -0
- package/lib/cjs/pagination/index.js +481 -0
- package/lib/cjs/popconfirm/index.d.ts +86 -0
- package/lib/cjs/popconfirm/index.js +254 -0
- package/lib/cjs/popover/Arrow.d.ts +9 -0
- package/lib/cjs/popover/Arrow.js +86 -0
- package/lib/cjs/popover/index.d.ts +87 -0
- package/lib/cjs/popover/index.js +158 -0
- package/lib/cjs/progress/index.d.ts +68 -0
- package/lib/cjs/progress/index.js +303 -0
- package/lib/cjs/radio/context.d.ts +22 -0
- package/lib/cjs/radio/context.js +18 -0
- package/lib/cjs/radio/index.d.ts +10 -0
- package/lib/cjs/radio/index.js +29 -0
- package/lib/cjs/radio/radio.d.ts +79 -0
- package/lib/cjs/radio/radio.js +225 -0
- package/lib/cjs/radio/radioGroup.d.ts +64 -0
- package/lib/cjs/radio/radioGroup.js +189 -0
- package/lib/cjs/radio/radioInner.d.ts +45 -0
- package/lib/cjs/radio/radioInner.js +140 -0
- package/lib/cjs/rating/index.d.ts +91 -0
- package/lib/cjs/rating/index.js +312 -0
- package/lib/cjs/rating/item.d.ts +38 -0
- package/lib/cjs/rating/item.js +143 -0
- package/lib/cjs/resizeObserver/index.d.ts +35 -0
- package/lib/cjs/resizeObserver/index.js +117 -0
- package/lib/cjs/scrollList/index.d.ts +26 -0
- package/lib/cjs/scrollList/index.js +82 -0
- package/lib/cjs/scrollList/scrollItem.d.ts +104 -0
- package/lib/cjs/scrollList/scrollItem.js +551 -0
- package/lib/cjs/select/index.d.ts +234 -0
- package/lib/cjs/select/index.js +1102 -0
- package/lib/cjs/select/option.d.ts +50 -0
- package/lib/cjs/select/option.js +211 -0
- package/lib/cjs/select/optionGroup.d.ts +20 -0
- package/lib/cjs/select/optionGroup.js +56 -0
- package/lib/cjs/select/utils.d.ts +9 -0
- package/lib/cjs/select/utils.js +116 -0
- package/lib/cjs/select/virtualRow.d.ts +8 -0
- package/lib/cjs/select/virtualRow.js +25 -0
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +35 -0
- package/lib/cjs/sideSheet/SideSheetContent.js +195 -0
- package/lib/cjs/sideSheet/SideSheetTransition.d.ts +12 -0
- package/lib/cjs/sideSheet/SideSheetTransition.js +120 -0
- package/lib/cjs/sideSheet/index.d.ts +59 -0
- package/lib/cjs/sideSheet/index.js +303 -0
- package/lib/cjs/skeleton/index.d.ts +33 -0
- package/lib/cjs/skeleton/index.js +101 -0
- package/lib/cjs/skeleton/item.d.ts +34 -0
- package/lib/cjs/skeleton/item.js +134 -0
- package/lib/cjs/slider/index.d.ts +30 -0
- package/lib/cjs/slider/index.js +647 -0
- package/lib/cjs/space/index.d.ts +33 -0
- package/lib/cjs/space/index.js +116 -0
- package/lib/cjs/space/utils.d.ts +5 -0
- package/lib/cjs/space/utils.js +54 -0
- package/lib/cjs/spin/icon.d.ts +10 -0
- package/lib/cjs/spin/icon.js +103 -0
- package/lib/cjs/spin/index.d.ts +63 -0
- package/lib/cjs/spin/index.js +145 -0
- package/lib/cjs/steps/basicStep.d.ts +46 -0
- package/lib/cjs/steps/basicStep.js +180 -0
- package/lib/cjs/steps/basicSteps.d.ts +41 -0
- package/lib/cjs/steps/basicSteps.js +127 -0
- package/lib/cjs/steps/context.d.ts +6 -0
- package/lib/cjs/steps/context.js +17 -0
- package/lib/cjs/steps/fillStep.d.ts +34 -0
- package/lib/cjs/steps/fillStep.js +142 -0
- package/lib/cjs/steps/fillSteps.d.ts +35 -0
- package/lib/cjs/steps/fillSteps.js +127 -0
- package/lib/cjs/steps/index.d.ts +39 -0
- package/lib/cjs/steps/index.js +104 -0
- package/lib/cjs/steps/navStep.d.ts +30 -0
- package/lib/cjs/steps/navStep.js +99 -0
- package/lib/cjs/steps/navSteps.d.ts +33 -0
- package/lib/cjs/steps/navSteps.js +103 -0
- package/lib/cjs/steps/step.d.ts +13 -0
- package/lib/cjs/steps/step.js +58 -0
- package/lib/cjs/switch/index.d.ts +48 -0
- package/lib/cjs/switch/index.js +159 -0
- package/lib/cjs/table/Body/BaseRow.d.ts +125 -0
- package/lib/cjs/table/Body/BaseRow.js +347 -0
- package/lib/cjs/table/Body/ExpandedRow.d.ts +63 -0
- package/lib/cjs/table/Body/ExpandedRow.js +176 -0
- package/lib/cjs/table/Body/SectionRow.d.ts +67 -0
- package/lib/cjs/table/Body/SectionRow.js +248 -0
- package/lib/cjs/table/Body/index.d.ts +70 -0
- package/lib/cjs/table/Body/index.js +861 -0
- package/lib/cjs/table/ColGroup.d.ts +24 -0
- package/lib/cjs/table/ColGroup.js +78 -0
- package/lib/cjs/table/Column.d.ts +36 -0
- package/lib/cjs/table/Column.js +32 -0
- package/lib/cjs/table/ColumnFilter.d.ts +34 -0
- package/lib/cjs/table/ColumnFilter.js +192 -0
- package/lib/cjs/table/ColumnSelection.d.ts +40 -0
- package/lib/cjs/table/ColumnSelection.js +101 -0
- package/lib/cjs/table/ColumnShape.d.ts +32 -0
- package/lib/cjs/table/ColumnShape.js +47 -0
- package/lib/cjs/table/ColumnSorter.d.ts +25 -0
- package/lib/cjs/table/ColumnSorter.js +77 -0
- package/lib/cjs/table/CustomExpandIcon.d.ts +36 -0
- package/lib/cjs/table/CustomExpandIcon.js +102 -0
- package/lib/cjs/table/HeadTable.d.ts +20 -0
- package/lib/cjs/table/HeadTable.js +127 -0
- package/lib/cjs/table/ResizableHeaderCell.d.ts +13 -0
- package/lib/cjs/table/ResizableHeaderCell.js +75 -0
- package/lib/cjs/table/ResizableTable.d.ts +5 -0
- package/lib/cjs/table/ResizableTable.js +213 -0
- package/lib/cjs/table/Table.d.ts +305 -0
- package/lib/cjs/table/Table.js +1558 -0
- package/lib/cjs/table/TableCell.d.ts +124 -0
- package/lib/cjs/table/TableCell.js +394 -0
- package/lib/cjs/table/TableContextProvider.d.ts +3 -0
- package/lib/cjs/table/TableContextProvider.js +61 -0
- package/lib/cjs/table/TableHeader.d.ts +28 -0
- package/lib/cjs/table/TableHeader.js +190 -0
- package/lib/cjs/table/TableHeaderRow.d.ts +59 -0
- package/lib/cjs/table/TableHeaderRow.js +212 -0
- package/lib/cjs/table/TablePagination.d.ts +23 -0
- package/lib/cjs/table/TablePagination.js +67 -0
- package/lib/cjs/table/getColumns.d.ts +8 -0
- package/lib/cjs/table/getColumns.js +52 -0
- package/lib/cjs/table/index.d.ts +100 -0
- package/lib/cjs/table/index.js +85 -0
- package/lib/cjs/table/interface.d.ts +290 -0
- package/lib/cjs/table/interface.js +7 -0
- package/lib/cjs/table/table-context.d.ts +19 -0
- package/lib/cjs/table/table-context.js +25 -0
- package/lib/cjs/table/utils.d.ts +42 -0
- package/lib/cjs/table/utils.js +144 -0
- package/lib/cjs/tabs/TabBar.d.ts +41 -0
- package/lib/cjs/tabs/TabBar.js +309 -0
- package/lib/cjs/tabs/TabPane.d.ts +27 -0
- package/lib/cjs/tabs/TabPane.js +164 -0
- package/lib/cjs/tabs/TabPaneTransition.d.ts +4 -0
- package/lib/cjs/tabs/TabPaneTransition.js +119 -0
- package/lib/cjs/tabs/index.d.ts +50 -0
- package/lib/cjs/tabs/index.js +365 -0
- package/lib/cjs/tabs/interface.d.ts +72 -0
- package/lib/cjs/tabs/interface.js +7 -0
- package/lib/cjs/tabs/tabs-context.d.ts +4 -0
- package/lib/cjs/tabs/tabs-context.js +18 -0
- package/lib/cjs/tag/group.d.ts +40 -0
- package/lib/cjs/tag/group.js +165 -0
- package/lib/cjs/tag/index.d.ts +33 -0
- package/lib/cjs/tag/index.js +219 -0
- package/lib/cjs/tag/interface.d.ts +30 -0
- package/lib/cjs/tag/interface.js +7 -0
- package/lib/cjs/tagInput/index.d.ts +130 -0
- package/lib/cjs/tagInput/index.js +414 -0
- package/lib/cjs/timePicker/Combobox.d.ts +73 -0
- package/lib/cjs/timePicker/Combobox.js +344 -0
- package/lib/cjs/timePicker/PanelShape.d.ts +6 -0
- package/lib/cjs/timePicker/PanelShape.js +21 -0
- package/lib/cjs/timePicker/TimeInput.d.ts +66 -0
- package/lib/cjs/timePicker/TimeInput.js +226 -0
- package/lib/cjs/timePicker/TimePicker.d.ts +197 -0
- package/lib/cjs/timePicker/TimePicker.js +501 -0
- package/lib/cjs/timePicker/TimeShape.d.ts +10 -0
- package/lib/cjs/timePicker/TimeShape.js +26 -0
- package/lib/cjs/timePicker/index.d.ts +95 -0
- package/lib/cjs/timePicker/index.js +51 -0
- package/lib/cjs/timeline/index.d.ts +31 -0
- package/lib/cjs/timeline/index.js +145 -0
- package/lib/cjs/timeline/item.d.ts +30 -0
- package/lib/cjs/timeline/item.js +94 -0
- package/lib/cjs/toast/ToastTransition.d.ts +7 -0
- package/lib/cjs/toast/ToastTransition.js +71 -0
- package/lib/cjs/toast/index.d.ts +200 -0
- package/lib/cjs/toast/index.js +281 -0
- package/lib/cjs/toast/toast.d.ts +45 -0
- package/lib/cjs/toast/toast.js +185 -0
- package/lib/cjs/toast/useToast/HookToast.d.ts +7 -0
- package/lib/cjs/toast/useToast/HookToast.js +72 -0
- package/lib/cjs/toast/useToast/index.d.ts +9 -0
- package/lib/cjs/toast/useToast/index.js +107 -0
- package/lib/cjs/tooltip/ArrowBoundingShape.d.ts +8 -0
- package/lib/cjs/tooltip/ArrowBoundingShape.js +22 -0
- package/lib/cjs/tooltip/TooltipStyledTransition.d.ts +9 -0
- package/lib/cjs/tooltip/TooltipStyledTransition.js +54 -0
- package/lib/cjs/tooltip/TriangleArrow.d.ts +5 -0
- package/lib/cjs/tooltip/TriangleArrow.js +54 -0
- package/lib/cjs/tooltip/TriangleArrowVertical.d.ts +5 -0
- package/lib/cjs/tooltip/TriangleArrowVertical.js +53 -0
- package/lib/cjs/tooltip/index.d.ts +147 -0
- package/lib/cjs/tooltip/index.js +698 -0
- package/lib/cjs/transfer/index.d.ts +164 -0
- package/lib/cjs/transfer/index.js +660 -0
- package/lib/cjs/tree/autoSizer.d.ts +28 -0
- package/lib/cjs/tree/autoSizer.js +115 -0
- package/lib/cjs/tree/collapse.d.ts +29 -0
- package/lib/cjs/tree/collapse.js +164 -0
- package/lib/cjs/tree/index.d.ts +135 -0
- package/lib/cjs/tree/index.js +793 -0
- package/lib/cjs/tree/interface.d.ts +119 -0
- package/lib/cjs/tree/interface.js +7 -0
- package/lib/cjs/tree/nodeList.d.ts +9 -0
- package/lib/cjs/tree/nodeList.js +141 -0
- package/lib/cjs/tree/treeContext.d.ts +40 -0
- package/lib/cjs/tree/treeContext.js +18 -0
- package/lib/cjs/tree/treeNode.d.ts +54 -0
- package/lib/cjs/tree/treeNode.js +527 -0
- package/lib/cjs/tree/treeUtil.d.ts +1 -0
- package/lib/cjs/tree/treeUtil.js +28 -0
- package/lib/cjs/treeSelect/index.d.ts +232 -0
- package/lib/cjs/treeSelect/index.js +1274 -0
- package/lib/cjs/trigger/index.d.ts +36 -0
- package/lib/cjs/trigger/index.js +71 -0
- package/lib/cjs/typography/base.d.ts +176 -0
- package/lib/cjs/typography/base.js +714 -0
- package/lib/cjs/typography/copyable.d.ts +43 -0
- package/lib/cjs/typography/copyable.js +151 -0
- package/lib/cjs/typography/index.d.ts +17 -0
- package/lib/cjs/typography/index.js +48 -0
- package/lib/cjs/typography/interface.d.ts +25 -0
- package/lib/cjs/typography/interface.js +7 -0
- package/lib/cjs/typography/paragraph.d.ts +56 -0
- package/lib/cjs/typography/paragraph.js +83 -0
- package/lib/cjs/typography/text.d.ts +59 -0
- package/lib/cjs/typography/text.js +73 -0
- package/lib/cjs/typography/title.d.ts +61 -0
- package/lib/cjs/typography/title.js +97 -0
- package/lib/cjs/typography/typography.d.ts +22 -0
- package/lib/cjs/typography/typography.js +82 -0
- package/lib/cjs/typography/util.d.ts +2 -0
- package/lib/cjs/typography/util.js +155 -0
- package/lib/cjs/upload/fileCard.d.ts +62 -0
- package/lib/cjs/upload/fileCard.js +388 -0
- package/lib/cjs/upload/index.d.ts +214 -0
- package/lib/cjs/upload/index.js +552 -0
- package/lib/es/button/index.d.ts +1 -0
- package/lib/es/button/index.js +2 -1
- package/lib/es/cascader/index.d.ts +0 -1
- package/lib/es/datePicker/index.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.js +1 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/iconButton/index.d.ts +1 -0
- package/lib/es/iconButton/index.js +1 -0
- package/lib/es/popconfirm/index.d.ts +1 -5
- package/lib/es/popconfirm/index.js +4 -10
- package/lib/es/popover/index.d.ts +1 -3
- package/lib/es/popover/index.js +8 -4
- package/lib/es/radio/context.d.ts +1 -1
- package/lib/es/radio/radio.d.ts +2 -2
- package/lib/es/radio/radioGroup.d.ts +4 -4
- package/lib/es/table/Table.d.ts +1 -1
- package/lib/es/table/index.d.ts +1 -1
- package/lib/es/table/interface.d.ts +2 -1
- package/lib/es/tabs/TabBar.d.ts +2 -4
- package/lib/es/tabs/TabBar.js +4 -12
- package/lib/es/tabs/TabPane.d.ts +1 -2
- package/lib/es/tabs/TabPane.js +2 -3
- package/lib/es/tabs/index.d.ts +2 -4
- package/lib/es/tabs/index.js +14 -83
- package/lib/es/tabs/interface.d.ts +1 -6
- package/lib/es/tagInput/index.d.ts +0 -3
- package/lib/es/tagInput/index.js +1 -6
- package/lib/es/tooltip/index.d.ts +0 -3
- package/lib/es/tooltip/index.js +0 -3
- package/lib/es/treeSelect/index.d.ts +11 -2
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1,1274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
4
|
+
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
+
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
+
|
|
9
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
10
|
+
|
|
11
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
exports.default = void 0;
|
|
16
|
+
|
|
17
|
+
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
18
|
+
|
|
19
|
+
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
20
|
+
|
|
21
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
22
|
+
|
|
23
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
24
|
+
|
|
25
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
26
|
+
|
|
27
|
+
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
28
|
+
|
|
29
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
30
|
+
|
|
31
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
32
|
+
|
|
33
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
34
|
+
|
|
35
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
36
|
+
|
|
37
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
38
|
+
|
|
39
|
+
var _lodashEs = require("lodash-es");
|
|
40
|
+
|
|
41
|
+
var _foundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/treeSelect/foundation"));
|
|
42
|
+
|
|
43
|
+
var _treeUtil = require("@douyinfe/semi-foundation/lib/cjs/tree/treeUtil");
|
|
44
|
+
|
|
45
|
+
var _constants = require("@douyinfe/semi-foundation/lib/cjs/treeSelect/constants");
|
|
46
|
+
|
|
47
|
+
var _constants2 = require("@douyinfe/semi-foundation/lib/cjs/popover/constants");
|
|
48
|
+
|
|
49
|
+
var _reactWindow = require("react-window");
|
|
50
|
+
|
|
51
|
+
require("@douyinfe/semi-foundation/lib/cjs/tree/tree.css");
|
|
52
|
+
|
|
53
|
+
require("@douyinfe/semi-foundation/lib/cjs/treeSelect/treeSelect.css");
|
|
54
|
+
|
|
55
|
+
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
56
|
+
|
|
57
|
+
var _context2 = _interopRequireDefault(require("../configProvider/context"));
|
|
58
|
+
|
|
59
|
+
var _group = _interopRequireDefault(require("../tag/group"));
|
|
60
|
+
|
|
61
|
+
var _index = _interopRequireDefault(require("../tag/index"));
|
|
62
|
+
|
|
63
|
+
var _index2 = _interopRequireDefault(require("../input/index"));
|
|
64
|
+
|
|
65
|
+
var _index3 = _interopRequireDefault(require("../popover/index"));
|
|
66
|
+
|
|
67
|
+
var _autoSizer = _interopRequireDefault(require("../tree/autoSizer"));
|
|
68
|
+
|
|
69
|
+
var _treeContext = _interopRequireDefault(require("../tree/treeContext"));
|
|
70
|
+
|
|
71
|
+
var _treeNode = _interopRequireDefault(require("../tree/treeNode"));
|
|
72
|
+
|
|
73
|
+
var _nodeList = _interopRequireDefault(require("../tree/nodeList"));
|
|
74
|
+
|
|
75
|
+
var _treeUtil2 = require("../tree/treeUtil");
|
|
76
|
+
|
|
77
|
+
var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer"));
|
|
78
|
+
|
|
79
|
+
var _trigger = _interopRequireDefault(require("../trigger"));
|
|
80
|
+
|
|
81
|
+
var _tagInput = _interopRequireDefault(require("../tagInput"));
|
|
82
|
+
|
|
83
|
+
var _utils = require("../_utils");
|
|
84
|
+
|
|
85
|
+
var _semiIcons = require("@douyinfe/semi-icons");
|
|
86
|
+
|
|
87
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
88
|
+
|
|
89
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof 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
|
+
const prefixcls = _constants.cssClasses.PREFIX;
|
|
92
|
+
const prefixTree = _constants.cssClasses.PREFIXTREE;
|
|
93
|
+
const key = 0;
|
|
94
|
+
|
|
95
|
+
class TreeSelect extends _baseComponent.default {
|
|
96
|
+
constructor(props) {
|
|
97
|
+
super(props);
|
|
98
|
+
|
|
99
|
+
this.renderSuffix = () => {
|
|
100
|
+
const {
|
|
101
|
+
suffix
|
|
102
|
+
} = this.props;
|
|
103
|
+
const suffixWrapperCls = (0, _classnames.default)({
|
|
104
|
+
["".concat(prefixcls, "-suffix")]: true,
|
|
105
|
+
["".concat(prefixcls, "-suffix-text")]: suffix && (0, _lodashEs.isString)(suffix),
|
|
106
|
+
["".concat(prefixcls, "-suffix-icon")]: (0, _utils.isSemiIcon)(suffix)
|
|
107
|
+
});
|
|
108
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
109
|
+
className: suffixWrapperCls
|
|
110
|
+
}, suffix);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
this.renderPrefix = () => {
|
|
114
|
+
const {
|
|
115
|
+
prefix,
|
|
116
|
+
insetLabel
|
|
117
|
+
} = this.props;
|
|
118
|
+
const labelNode = prefix || insetLabel;
|
|
119
|
+
const prefixWrapperCls = (0, _classnames.default)({
|
|
120
|
+
["".concat(prefixcls, "-prefix")]: true,
|
|
121
|
+
// to be doublechecked
|
|
122
|
+
["".concat(prefixcls, "-inset-label")]: insetLabel,
|
|
123
|
+
["".concat(prefixcls, "-prefix-text")]: labelNode && (0, _lodashEs.isString)(labelNode),
|
|
124
|
+
["".concat(prefixcls, "-prefix-icon")]: (0, _utils.isSemiIcon)(labelNode)
|
|
125
|
+
});
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
127
|
+
className: prefixWrapperCls
|
|
128
|
+
}, labelNode);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
this.renderContent = () => {
|
|
132
|
+
const {
|
|
133
|
+
dropdownMinWidth
|
|
134
|
+
} = this.state;
|
|
135
|
+
const {
|
|
136
|
+
dropdownStyle,
|
|
137
|
+
dropdownClassName
|
|
138
|
+
} = this.props;
|
|
139
|
+
const style = (0, _assign.default)({
|
|
140
|
+
minWidth: dropdownMinWidth
|
|
141
|
+
}, dropdownStyle);
|
|
142
|
+
const popoverCls = (0, _classnames.default)(dropdownClassName, "".concat(prefixcls, "-popover"));
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
144
|
+
className: popoverCls,
|
|
145
|
+
role: "list-box",
|
|
146
|
+
style: style
|
|
147
|
+
}, this.renderTree());
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
this.removeTag = removedKey => {
|
|
151
|
+
this.foundation.removeTag(removedKey);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
this.handleClick = e => {
|
|
155
|
+
this.foundation.handleClick(e);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
this.showClearBtn = () => {
|
|
159
|
+
const {
|
|
160
|
+
searchPosition
|
|
161
|
+
} = this.props;
|
|
162
|
+
const {
|
|
163
|
+
inputValue
|
|
164
|
+
} = this.state;
|
|
165
|
+
const triggerSearchHasInputValue = searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER && inputValue;
|
|
166
|
+
const {
|
|
167
|
+
showClear,
|
|
168
|
+
disabled,
|
|
169
|
+
multiple
|
|
170
|
+
} = this.props;
|
|
171
|
+
const {
|
|
172
|
+
selectedKeys,
|
|
173
|
+
checkedKeys,
|
|
174
|
+
isOpen,
|
|
175
|
+
isHovering
|
|
176
|
+
} = this.state;
|
|
177
|
+
const hasValue = multiple ? Boolean(checkedKeys.size) : Boolean(selectedKeys.length);
|
|
178
|
+
return showClear && (hasValue || triggerSearchHasInputValue) && !disabled && (isOpen || isHovering);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
this.renderTagList = () => {
|
|
182
|
+
const {
|
|
183
|
+
checkedKeys,
|
|
184
|
+
keyEntities,
|
|
185
|
+
disabledKeys
|
|
186
|
+
} = this.state;
|
|
187
|
+
const {
|
|
188
|
+
treeNodeLabelProp,
|
|
189
|
+
leafOnly,
|
|
190
|
+
disabled,
|
|
191
|
+
disableStrictly,
|
|
192
|
+
size,
|
|
193
|
+
renderSelectedItem: propRenderSelectedItem
|
|
194
|
+
} = this.props;
|
|
195
|
+
const renderSelectedItem = (0, _lodashEs.isFunction)(propRenderSelectedItem) ? propRenderSelectedItem : item => ({
|
|
196
|
+
isRenderInTag: true,
|
|
197
|
+
content: (0, _lodashEs.get)(item, treeNodeLabelProp, null)
|
|
198
|
+
});
|
|
199
|
+
const renderKeys = (0, _treeUtil.normalizeKeyList)([...checkedKeys], keyEntities, leafOnly);
|
|
200
|
+
const tagList = []; // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
201
|
+
|
|
202
|
+
(0, _forEach.default)(renderKeys).call(renderKeys, key => {
|
|
203
|
+
const item = keyEntities[key].data;
|
|
204
|
+
|
|
205
|
+
const onClose = (tagContent, e) => {
|
|
206
|
+
if (e && typeof e.preventDefault === 'function') {
|
|
207
|
+
// make sure that tag will not hidden immediately in controlled mode
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
this.removeTag(key);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const {
|
|
215
|
+
content,
|
|
216
|
+
isRenderInTag
|
|
217
|
+
} = treeNodeLabelProp in item && item ? renderSelectedItem(item, {
|
|
218
|
+
index: key,
|
|
219
|
+
onClose
|
|
220
|
+
}) : null;
|
|
221
|
+
|
|
222
|
+
if (!content) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const isDisabled = disabled || item.disabled || disableStrictly && disabledKeys.has(item.key);
|
|
227
|
+
const tag = {
|
|
228
|
+
closable: !isDisabled,
|
|
229
|
+
color: 'white',
|
|
230
|
+
visible: true,
|
|
231
|
+
onClose,
|
|
232
|
+
key,
|
|
233
|
+
size: size === 'small' ? 'small' : 'large'
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
if (isRenderInTag) {
|
|
237
|
+
// pass ReactNode list to tagList when using tagGroup custom mode
|
|
238
|
+
tagList.push( /*#__PURE__*/_react.default.createElement(_index.default, (0, _assign.default)({}, tag), content));
|
|
239
|
+
} else {
|
|
240
|
+
tagList.push(content);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
return tagList;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* When single selection and the search box is on trigger, the items displayed in the rendered search box
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
this.renderSingleTriggerSearchItem = () => {
|
|
251
|
+
const {
|
|
252
|
+
placeholder,
|
|
253
|
+
disabled
|
|
254
|
+
} = this.props;
|
|
255
|
+
const {
|
|
256
|
+
inputTriggerFocus
|
|
257
|
+
} = this.state;
|
|
258
|
+
const renderText = this.foundation.getRenderTextInSingle();
|
|
259
|
+
const spanCls = (0, _classnames.default)("".concat(prefixcls, "-selection-TriggerSearchItem"), {
|
|
260
|
+
["".concat(prefixcls, "-selection-TriggerSearchItem-placeholder")]: (inputTriggerFocus || !renderText) && !disabled,
|
|
261
|
+
["".concat(prefixcls, "-selection-TriggerSearchItem-disabled")]: disabled
|
|
262
|
+
});
|
|
263
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
264
|
+
className: spanCls
|
|
265
|
+
}, renderText ? renderText : placeholder);
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Single selection and the search box content rendered when the search box is on trigger
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
this.renderSingleTriggerSearch = () => {
|
|
273
|
+
const {
|
|
274
|
+
inputValue
|
|
275
|
+
} = this.state;
|
|
276
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !inputValue && this.renderSingleTriggerSearchItem(), this.renderInput());
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
this.renderSelectContent = () => {
|
|
280
|
+
const {
|
|
281
|
+
multiple,
|
|
282
|
+
placeholder,
|
|
283
|
+
maxTagCount,
|
|
284
|
+
searchPosition,
|
|
285
|
+
filterTreeNode
|
|
286
|
+
} = this.props;
|
|
287
|
+
const {
|
|
288
|
+
selectedKeys,
|
|
289
|
+
checkedKeys
|
|
290
|
+
} = this.state;
|
|
291
|
+
const hasValue = multiple ? Boolean(checkedKeys.size) : Boolean(selectedKeys.length);
|
|
292
|
+
const isTriggerPositionSearch = filterTreeNode && searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER; // searchPosition = trigger
|
|
293
|
+
|
|
294
|
+
if (isTriggerPositionSearch) {
|
|
295
|
+
return multiple ? this.renderTagInput() : this.renderSingleTriggerSearch();
|
|
296
|
+
} // searchPosition = dropdown and single seleciton
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
if (!multiple || !hasValue) {
|
|
300
|
+
const renderText = this.foundation.getRenderTextInSingle();
|
|
301
|
+
const spanCls = (0, _classnames.default)({
|
|
302
|
+
["".concat(prefixcls, "-selection-placeholder")]: !renderText
|
|
303
|
+
});
|
|
304
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
305
|
+
className: spanCls
|
|
306
|
+
}, renderText ? renderText : placeholder);
|
|
307
|
+
} // searchPosition = dropdown and multiple seleciton
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
const tagList = this.renderTagList(); // mode=custom to return tagList directly
|
|
311
|
+
|
|
312
|
+
return /*#__PURE__*/_react.default.createElement(_group.default, {
|
|
313
|
+
maxTagCount: maxTagCount,
|
|
314
|
+
tagList: tagList,
|
|
315
|
+
size: "large",
|
|
316
|
+
mode: "custom"
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
this.handleClear = e => {
|
|
321
|
+
e && e.stopPropagation();
|
|
322
|
+
this.foundation.handleClear(e);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
this.handleMouseOver = e => {
|
|
326
|
+
this.foundation.toggleHoverState(true);
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
this.handleMouseLeave = e => {
|
|
330
|
+
this.foundation.toggleHoverState(false);
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
this.search = value => {
|
|
334
|
+
this.foundation.handleInputChange(value);
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
this.close = () => {
|
|
338
|
+
this.foundation.close(null);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
this.renderArrow = () => {
|
|
342
|
+
const showClearBtn = this.showClearBtn();
|
|
343
|
+
const {
|
|
344
|
+
arrowIcon
|
|
345
|
+
} = this.props;
|
|
346
|
+
|
|
347
|
+
if (showClearBtn) {
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return arrowIcon ? /*#__PURE__*/_react.default.createElement("div", {
|
|
352
|
+
className: (0, _classnames.default)("".concat(prefixcls, "-arrow"))
|
|
353
|
+
}, arrowIcon) : null;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
this.renderClearBtn = () => {
|
|
357
|
+
const showClearBtn = this.showClearBtn();
|
|
358
|
+
const clearCls = (0, _classnames.default)("".concat(prefixcls, "-clearbtn"));
|
|
359
|
+
|
|
360
|
+
if (showClearBtn) {
|
|
361
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
362
|
+
className: clearCls,
|
|
363
|
+
onClick: this.handleClear
|
|
364
|
+
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClear, null));
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return null;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
this.renderSelection = () => {
|
|
371
|
+
const {
|
|
372
|
+
disabled,
|
|
373
|
+
multiple,
|
|
374
|
+
filterTreeNode,
|
|
375
|
+
validateStatus,
|
|
376
|
+
prefix,
|
|
377
|
+
suffix,
|
|
378
|
+
style,
|
|
379
|
+
size,
|
|
380
|
+
insetLabel,
|
|
381
|
+
className,
|
|
382
|
+
placeholder,
|
|
383
|
+
showClear,
|
|
384
|
+
leafOnly,
|
|
385
|
+
searchPosition,
|
|
386
|
+
triggerRender
|
|
387
|
+
} = this.props;
|
|
388
|
+
const {
|
|
389
|
+
isOpen,
|
|
390
|
+
isInput,
|
|
391
|
+
inputValue,
|
|
392
|
+
selectedKeys,
|
|
393
|
+
checkedKeys,
|
|
394
|
+
keyEntities
|
|
395
|
+
} = this.state;
|
|
396
|
+
const filterable = Boolean(filterTreeNode);
|
|
397
|
+
const useCustomTrigger = typeof triggerRender === 'function';
|
|
398
|
+
const mouseEvent = showClear ? {
|
|
399
|
+
onMouseEnter: e => this.handleMouseOver(e),
|
|
400
|
+
onMouseLeave: e => this.handleMouseLeave(e)
|
|
401
|
+
} : {};
|
|
402
|
+
const isTriggerPositionSearch = searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER && filterable;
|
|
403
|
+
const isEmptyTriggerSearch = isTriggerPositionSearch && (0, _lodashEs.isEmpty)(checkedKeys);
|
|
404
|
+
const isValueTriggerSearch = isTriggerPositionSearch && !(0, _lodashEs.isEmpty)(checkedKeys);
|
|
405
|
+
const classNames = useCustomTrigger ? (0, _classnames.default)(className) : (0, _classnames.default)(prefixcls, {
|
|
406
|
+
["".concat(prefixcls, "-focus")]: isOpen && !isInput,
|
|
407
|
+
["".concat(prefixcls, "-disabled")]: disabled,
|
|
408
|
+
["".concat(prefixcls, "-single")]: !multiple,
|
|
409
|
+
["".concat(prefixcls, "-multiple")]: multiple,
|
|
410
|
+
["".concat(prefixcls, "-multiple-tagInput-empty")]: multiple && isEmptyTriggerSearch,
|
|
411
|
+
["".concat(prefixcls, "-multiple-tagInput-notEmpty")]: multiple && isValueTriggerSearch,
|
|
412
|
+
["".concat(prefixcls, "-filterable")]: filterable,
|
|
413
|
+
["".concat(prefixcls, "-error")]: validateStatus === 'error',
|
|
414
|
+
["".concat(prefixcls, "-warning")]: validateStatus === 'warning',
|
|
415
|
+
["".concat(prefixcls, "-small")]: size === 'small',
|
|
416
|
+
["".concat(prefixcls, "-large")]: size === 'large',
|
|
417
|
+
["".concat(prefixcls, "-with-prefix")]: prefix || insetLabel,
|
|
418
|
+
["".concat(prefixcls, "-with-suffix")]: suffix,
|
|
419
|
+
["".concat(prefixcls, "-with-suffix")]: suffix
|
|
420
|
+
}, className);
|
|
421
|
+
const triggerRenderKeys = multiple ? (0, _treeUtil.normalizeKeyList)([...checkedKeys], keyEntities, leafOnly) : selectedKeys;
|
|
422
|
+
const inner = useCustomTrigger ? /*#__PURE__*/_react.default.createElement(_trigger.default, {
|
|
423
|
+
inputValue: inputValue,
|
|
424
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
425
|
+
value: (0, _map.default)(triggerRenderKeys).call(triggerRenderKeys, key => (0, _lodashEs.get)(keyEntities, [key, 'data'])),
|
|
426
|
+
disabled: disabled,
|
|
427
|
+
placeholder: placeholder,
|
|
428
|
+
onClear: this.handleClear,
|
|
429
|
+
componentName: 'TreeSelect',
|
|
430
|
+
triggerRender: triggerRender,
|
|
431
|
+
componentProps: (0, _assign.default)({}, this.props)
|
|
432
|
+
}) : [/*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
433
|
+
key: 'prefix'
|
|
434
|
+
}, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
435
|
+
key: 'selection'
|
|
436
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
437
|
+
className: "".concat(prefixcls, "-selection")
|
|
438
|
+
}, this.renderSelectContent())), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
439
|
+
key: 'suffix'
|
|
440
|
+
}, suffix ? this.renderSuffix() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
441
|
+
key: 'clearBtn'
|
|
442
|
+
}, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
443
|
+
key: 'arrow'
|
|
444
|
+
}, this.renderArrow())];
|
|
445
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _assign.default)({
|
|
446
|
+
className: classNames,
|
|
447
|
+
style: style,
|
|
448
|
+
ref: this.triggerRef,
|
|
449
|
+
onClick: this.handleClick
|
|
450
|
+
}, mouseEvent), inner);
|
|
451
|
+
}; // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
this.renderTagItem = (key, idx) => {
|
|
455
|
+
var _context;
|
|
456
|
+
|
|
457
|
+
const {
|
|
458
|
+
keyEntities,
|
|
459
|
+
disabledKeys
|
|
460
|
+
} = this.state;
|
|
461
|
+
const {
|
|
462
|
+
size,
|
|
463
|
+
leafOnly,
|
|
464
|
+
disabled,
|
|
465
|
+
disableStrictly,
|
|
466
|
+
renderSelectedItem: propRenderSelectedItem,
|
|
467
|
+
treeNodeLabelProp
|
|
468
|
+
} = this.props;
|
|
469
|
+
const keyList = (0, _treeUtil.normalizeKeyList)([key], keyEntities, leafOnly);
|
|
470
|
+
const nodes = (0, _map.default)(keyList).call(keyList, i => keyEntities[i].data);
|
|
471
|
+
const value = (0, _treeUtil.getValueOrKey)(nodes);
|
|
472
|
+
const tagCls = (0, _classnames.default)("".concat(prefixcls, "-selection-tag"), {
|
|
473
|
+
["".concat(prefixcls, "-selection-tag-disabled")]: disabled
|
|
474
|
+
});
|
|
475
|
+
const nodeHaveData = !(0, _lodashEs.isEmpty)(nodes) && !(0, _lodashEs.isEmpty)(nodes[0]);
|
|
476
|
+
const isDisableStrictlyNode = disableStrictly && nodeHaveData && disabledKeys.has(nodes[0].key);
|
|
477
|
+
const closable = nodeHaveData && !nodes[0].disabled && !disabled && !isDisableStrictlyNode;
|
|
478
|
+
|
|
479
|
+
const onClose = (tagChildren, e) => {
|
|
480
|
+
// When value has not changed, prevent clicking tag closeBtn to close tag
|
|
481
|
+
e.preventDefault();
|
|
482
|
+
this.removeTag(key);
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
const tagProps = {
|
|
486
|
+
size: size === 'small' ? 'small' : 'large',
|
|
487
|
+
key: (0, _concat.default)(_context = "tag-".concat(value, "-")).call(_context, idx),
|
|
488
|
+
color: 'white',
|
|
489
|
+
className: tagCls,
|
|
490
|
+
closable,
|
|
491
|
+
onClose
|
|
492
|
+
};
|
|
493
|
+
const item = nodes[0];
|
|
494
|
+
const renderSelectedItem = (0, _lodashEs.isFunction)(propRenderSelectedItem) ? propRenderSelectedItem : selectedItem => ({
|
|
495
|
+
isRenderInTag: true,
|
|
496
|
+
content: (0, _lodashEs.get)(selectedItem, treeNodeLabelProp, null)
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
if ((0, _lodashEs.isFunction)(renderSelectedItem)) {
|
|
500
|
+
const {
|
|
501
|
+
content,
|
|
502
|
+
isRenderInTag
|
|
503
|
+
} = treeNodeLabelProp in item && item ? renderSelectedItem(item, {
|
|
504
|
+
index: idx,
|
|
505
|
+
onClose
|
|
506
|
+
}) : null;
|
|
507
|
+
|
|
508
|
+
if (isRenderInTag) {
|
|
509
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _assign.default)({}, tagProps), content);
|
|
510
|
+
} else {
|
|
511
|
+
return content;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _assign.default)({}, tagProps), value);
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
this.renderTagInput = () => {
|
|
519
|
+
const {
|
|
520
|
+
leafOnly,
|
|
521
|
+
disabled,
|
|
522
|
+
size,
|
|
523
|
+
searchAutoFocus,
|
|
524
|
+
placeholder
|
|
525
|
+
} = this.props;
|
|
526
|
+
const {
|
|
527
|
+
keyEntities,
|
|
528
|
+
checkedKeys,
|
|
529
|
+
inputValue
|
|
530
|
+
} = this.state;
|
|
531
|
+
const keyList = (0, _treeUtil.normalizeKeyList)(checkedKeys, keyEntities, leafOnly);
|
|
532
|
+
return /*#__PURE__*/_react.default.createElement(_tagInput.default, {
|
|
533
|
+
disabled: disabled,
|
|
534
|
+
onInputChange: v => this.search(v),
|
|
535
|
+
ref: this.tagInputRef,
|
|
536
|
+
placeholder: placeholder,
|
|
537
|
+
value: keyList,
|
|
538
|
+
inputValue: inputValue,
|
|
539
|
+
size: size,
|
|
540
|
+
autoFocus: searchAutoFocus,
|
|
541
|
+
renderTagItem: (itemKey, index) => this.renderTagItem(itemKey, index),
|
|
542
|
+
onRemove: itemKey => this.removeTag(itemKey)
|
|
543
|
+
});
|
|
544
|
+
}; // render Tree
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
this.renderInput = () => {
|
|
548
|
+
const {
|
|
549
|
+
searchPlaceholder,
|
|
550
|
+
searchRender,
|
|
551
|
+
showSearchClear,
|
|
552
|
+
searchPosition,
|
|
553
|
+
searchAutoFocus,
|
|
554
|
+
multiple,
|
|
555
|
+
disabled
|
|
556
|
+
} = this.props;
|
|
557
|
+
const isDropdownPositionSearch = searchPosition === _constants.strings.SEARCH_POSITION_DROPDOWN;
|
|
558
|
+
const inputcls = (0, _classnames.default)({
|
|
559
|
+
["".concat(prefixTree, "-input")]: isDropdownPositionSearch,
|
|
560
|
+
["".concat(prefixcls, "-inputTrigger")]: !isDropdownPositionSearch
|
|
561
|
+
});
|
|
562
|
+
const {
|
|
563
|
+
inputValue
|
|
564
|
+
} = this.state;
|
|
565
|
+
const baseInputProps = {
|
|
566
|
+
value: inputValue,
|
|
567
|
+
className: inputcls,
|
|
568
|
+
onChange: value => this.search(value)
|
|
569
|
+
};
|
|
570
|
+
const inputDropdownProps = {
|
|
571
|
+
showClear: showSearchClear,
|
|
572
|
+
prefix: /*#__PURE__*/_react.default.createElement(_semiIcons.IconSearch, null)
|
|
573
|
+
};
|
|
574
|
+
const inputTriggerProps = {
|
|
575
|
+
onFocus: e => this.foundation.handleInputTriggerFocus(),
|
|
576
|
+
onBlur: e => this.foundation.handleInputTriggerBlur(),
|
|
577
|
+
disabled
|
|
578
|
+
};
|
|
579
|
+
const realInputProps = isDropdownPositionSearch ? inputDropdownProps : inputTriggerProps;
|
|
580
|
+
const wrapperCls = (0, _classnames.default)({
|
|
581
|
+
["".concat(prefixTree, "-search-wrapper")]: isDropdownPositionSearch,
|
|
582
|
+
["".concat(prefixcls, "-triggerSingleSearch-wrapper")]: !isDropdownPositionSearch && !multiple
|
|
583
|
+
});
|
|
584
|
+
const useCusSearch = typeof searchRender === 'function' || typeof searchRender === 'boolean';
|
|
585
|
+
|
|
586
|
+
if (useCusSearch && !searchRender) {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
591
|
+
className: wrapperCls
|
|
592
|
+
}, /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
|
|
593
|
+
componentName: "TreeSelect"
|
|
594
|
+
}, locale => {
|
|
595
|
+
const placeholder = isDropdownPositionSearch ? searchPlaceholder || locale.searchPlaceholder : '';
|
|
596
|
+
|
|
597
|
+
if (useCusSearch) {
|
|
598
|
+
return searchRender((0, _assign.default)((0, _assign.default)((0, _assign.default)({}, realInputProps), baseInputProps), {
|
|
599
|
+
placeholder
|
|
600
|
+
}));
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
return /*#__PURE__*/_react.default.createElement(_index2.default, (0, _assign.default)({
|
|
604
|
+
ref: this.inputRef,
|
|
605
|
+
autofocus: searchAutoFocus,
|
|
606
|
+
placeholder: placeholder
|
|
607
|
+
}, baseInputProps, realInputProps));
|
|
608
|
+
}));
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
this.renderEmpty = () => {
|
|
612
|
+
const {
|
|
613
|
+
emptyContent
|
|
614
|
+
} = this.props;
|
|
615
|
+
|
|
616
|
+
if (emptyContent) {
|
|
617
|
+
return /*#__PURE__*/_react.default.createElement(_treeNode.default, {
|
|
618
|
+
empty: true,
|
|
619
|
+
emptyContent: this.props.emptyContent
|
|
620
|
+
});
|
|
621
|
+
} else {
|
|
622
|
+
return /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
|
|
623
|
+
componentName: "Tree"
|
|
624
|
+
}, locale => /*#__PURE__*/_react.default.createElement(_treeNode.default, {
|
|
625
|
+
empty: true,
|
|
626
|
+
emptyContent: locale.emptyText
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
this.onNodeLoad = data => new _promise.default(resolve => this.foundation.setLoadKeys(data, resolve));
|
|
632
|
+
|
|
633
|
+
this.onNodeSelect = (e, treeNode) => {
|
|
634
|
+
this.foundation.handleNodeSelect(e, treeNode);
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
this.onNodeCheck = (e, treeNode) => {
|
|
638
|
+
this.foundation.handleNodeSelect(e, treeNode);
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
this.onNodeExpand = (e, treeNode) => {
|
|
642
|
+
this.foundation.handleNodeExpand(e, treeNode);
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
this.getTreeNodeRequiredProps = () => {
|
|
646
|
+
const {
|
|
647
|
+
expandedKeys,
|
|
648
|
+
selectedKeys,
|
|
649
|
+
checkedKeys,
|
|
650
|
+
halfCheckedKeys,
|
|
651
|
+
keyEntities,
|
|
652
|
+
filteredKeys
|
|
653
|
+
} = this.state;
|
|
654
|
+
return {
|
|
655
|
+
expandedKeys: expandedKeys || new _set.default(),
|
|
656
|
+
selectedKeys: selectedKeys || [],
|
|
657
|
+
checkedKeys: checkedKeys || new _set.default(),
|
|
658
|
+
halfCheckedKeys: halfCheckedKeys || new _set.default(),
|
|
659
|
+
filteredKeys: filteredKeys || new _set.default(),
|
|
660
|
+
keyEntities
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
this.getTreeNodeKey = treeNode => {
|
|
665
|
+
const {
|
|
666
|
+
data
|
|
667
|
+
} = treeNode; // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
668
|
+
|
|
669
|
+
const {
|
|
670
|
+
key
|
|
671
|
+
} = data;
|
|
672
|
+
return key;
|
|
673
|
+
};
|
|
674
|
+
/* Event handler function after popover is closed */
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
this.handlePopoverClose = isVisible => {
|
|
678
|
+
const {
|
|
679
|
+
filterTreeNode
|
|
680
|
+
} = this.props;
|
|
681
|
+
|
|
682
|
+
if (isVisible === false && Boolean(filterTreeNode)) {
|
|
683
|
+
this.foundation.clearInput();
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
this.renderTreeNode = (treeNode, ind, style) => {
|
|
688
|
+
const {
|
|
689
|
+
data
|
|
690
|
+
} = treeNode; // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
691
|
+
|
|
692
|
+
const {
|
|
693
|
+
key
|
|
694
|
+
} = data;
|
|
695
|
+
const treeNodeProps = this.foundation.getTreeNodeProps(key);
|
|
696
|
+
|
|
697
|
+
if (!treeNodeProps) {
|
|
698
|
+
return null;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return /*#__PURE__*/_react.default.createElement(_treeNode.default, (0, _assign.default)({}, treeNodeProps, data, {
|
|
702
|
+
key: key,
|
|
703
|
+
data: data,
|
|
704
|
+
style: style
|
|
705
|
+
}));
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
this.itemKey = (index, data) => {
|
|
709
|
+
// Find the item at the specified index.
|
|
710
|
+
const item = data[index]; // Return a value that uniquely identifies this item.
|
|
711
|
+
|
|
712
|
+
return item.key;
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
this.renderNodeList = () => {
|
|
716
|
+
const {
|
|
717
|
+
flattenNodes,
|
|
718
|
+
motionKeys,
|
|
719
|
+
motionType
|
|
720
|
+
} = this.state;
|
|
721
|
+
const {
|
|
722
|
+
direction
|
|
723
|
+
} = this.context;
|
|
724
|
+
const {
|
|
725
|
+
virtualize,
|
|
726
|
+
motionExpand
|
|
727
|
+
} = this.props;
|
|
728
|
+
|
|
729
|
+
if (!virtualize || (0, _lodashEs.isEmpty)(virtualize)) {
|
|
730
|
+
return /*#__PURE__*/_react.default.createElement(_nodeList.default, {
|
|
731
|
+
flattenNodes: flattenNodes,
|
|
732
|
+
flattenList: this._flattenNodes,
|
|
733
|
+
motionKeys: motionExpand ? motionKeys : new _set.default([]),
|
|
734
|
+
motionType: motionType,
|
|
735
|
+
onMotionEnd: this.onMotionEnd,
|
|
736
|
+
renderTreeNode: this.renderTreeNode
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
const option = _ref => {
|
|
741
|
+
let {
|
|
742
|
+
index,
|
|
743
|
+
style,
|
|
744
|
+
data
|
|
745
|
+
} = _ref;
|
|
746
|
+
return this.renderTreeNode(data[index], index, style);
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
return /*#__PURE__*/_react.default.createElement(_autoSizer.default, {
|
|
750
|
+
defaultHeight: virtualize.height,
|
|
751
|
+
defaultWidth: virtualize.width
|
|
752
|
+
}, _ref2 => {
|
|
753
|
+
let {
|
|
754
|
+
height,
|
|
755
|
+
width
|
|
756
|
+
} = _ref2;
|
|
757
|
+
return /*#__PURE__*/_react.default.createElement(_reactWindow.FixedSizeList, {
|
|
758
|
+
itemCount: flattenNodes.length,
|
|
759
|
+
itemSize: virtualize.itemSize,
|
|
760
|
+
height: height,
|
|
761
|
+
width: width,
|
|
762
|
+
itemKey: this.itemKey,
|
|
763
|
+
itemData: flattenNodes,
|
|
764
|
+
className: "".concat(prefixTree, "-virtual-list"),
|
|
765
|
+
style: {
|
|
766
|
+
direction
|
|
767
|
+
}
|
|
768
|
+
}, option);
|
|
769
|
+
});
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
this.renderTree = () => {
|
|
773
|
+
const {
|
|
774
|
+
keyEntities,
|
|
775
|
+
motionKeys,
|
|
776
|
+
motionType,
|
|
777
|
+
inputValue,
|
|
778
|
+
filteredKeys,
|
|
779
|
+
flattenNodes
|
|
780
|
+
} = this.state;
|
|
781
|
+
const {
|
|
782
|
+
loadData,
|
|
783
|
+
filterTreeNode,
|
|
784
|
+
disabled,
|
|
785
|
+
multiple,
|
|
786
|
+
showFilteredOnly,
|
|
787
|
+
motionExpand,
|
|
788
|
+
outerBottomSlot,
|
|
789
|
+
outerTopSlot,
|
|
790
|
+
expandAction,
|
|
791
|
+
labelEllipsis,
|
|
792
|
+
virtualize,
|
|
793
|
+
optionListStyle,
|
|
794
|
+
searchPosition,
|
|
795
|
+
renderLabel,
|
|
796
|
+
renderFullLabel
|
|
797
|
+
} = this.props;
|
|
798
|
+
const wrapperCls = (0, _classnames.default)("".concat(prefixTree, "-wrapper"));
|
|
799
|
+
const listCls = (0, _classnames.default)("".concat(prefixTree, "-option-list"), {
|
|
800
|
+
["".concat(prefixTree, "-option-list-block")]: true
|
|
801
|
+
});
|
|
802
|
+
const searchNoRes = Boolean(inputValue) && !filteredKeys.size;
|
|
803
|
+
const noData = (0, _lodashEs.isEmpty)(flattenNodes) || showFilteredOnly && searchNoRes;
|
|
804
|
+
const isDropdownPositionSearch = searchPosition === _constants.strings.SEARCH_POSITION_DROPDOWN;
|
|
805
|
+
return /*#__PURE__*/_react.default.createElement(_treeContext.default.Provider, {
|
|
806
|
+
value: {
|
|
807
|
+
loadData,
|
|
808
|
+
treeDisabled: disabled,
|
|
809
|
+
motion: motionExpand,
|
|
810
|
+
motionKeys,
|
|
811
|
+
motionType,
|
|
812
|
+
expandAction,
|
|
813
|
+
filterTreeNode,
|
|
814
|
+
keyEntities,
|
|
815
|
+
onNodeClick: this.onNodeClick,
|
|
816
|
+
onNodeDoubleClick: this.onNodeDoubleClick,
|
|
817
|
+
// tree node will call this function when treeNode is right clicked
|
|
818
|
+
onNodeRightClick: _lodashEs.noop,
|
|
819
|
+
onNodeExpand: this.onNodeExpand,
|
|
820
|
+
onNodeSelect: this.onNodeSelect,
|
|
821
|
+
onNodeCheck: this.onNodeCheck,
|
|
822
|
+
renderTreeNode: this.renderTreeNode,
|
|
823
|
+
multiple,
|
|
824
|
+
showFilteredOnly,
|
|
825
|
+
isSearching: Boolean(inputValue),
|
|
826
|
+
renderLabel,
|
|
827
|
+
renderFullLabel,
|
|
828
|
+
labelEllipsis: typeof labelEllipsis === 'undefined' ? virtualize : labelEllipsis
|
|
829
|
+
}
|
|
830
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
831
|
+
className: wrapperCls,
|
|
832
|
+
role: "list-box"
|
|
833
|
+
}, outerTopSlot, !outerTopSlot && filterTreeNode && isDropdownPositionSearch && this.renderInput(), /*#__PURE__*/_react.default.createElement("div", {
|
|
834
|
+
className: listCls,
|
|
835
|
+
role: "tree",
|
|
836
|
+
style: optionListStyle
|
|
837
|
+
}, noData ? this.renderEmpty() : this.renderNodeList()), outerBottomSlot));
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
this.state = {
|
|
841
|
+
inputTriggerFocus: false,
|
|
842
|
+
isOpen: false,
|
|
843
|
+
isInput: false,
|
|
844
|
+
rePosKey: key,
|
|
845
|
+
dropdownMinWidth: null,
|
|
846
|
+
inputValue: '',
|
|
847
|
+
keyEntities: {},
|
|
848
|
+
treeData: [],
|
|
849
|
+
flattenNodes: [],
|
|
850
|
+
selectedKeys: [],
|
|
851
|
+
checkedKeys: new _set.default(),
|
|
852
|
+
halfCheckedKeys: new _set.default(),
|
|
853
|
+
disabledKeys: new _set.default(),
|
|
854
|
+
motionKeys: new _set.default([]),
|
|
855
|
+
motionType: 'hide',
|
|
856
|
+
expandedKeys: new _set.default(props.expandedKeys),
|
|
857
|
+
filteredKeys: new _set.default(),
|
|
858
|
+
filteredExpandedKeys: new _set.default(),
|
|
859
|
+
filteredShownKeys: new _set.default(),
|
|
860
|
+
prevProps: null,
|
|
861
|
+
isHovering: false,
|
|
862
|
+
cachedKeyValuePairs: {},
|
|
863
|
+
loadedKeys: new _set.default(),
|
|
864
|
+
loadingKeys: new _set.default()
|
|
865
|
+
};
|
|
866
|
+
this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
867
|
+
this.tagInputRef = /*#__PURE__*/_react.default.createRef();
|
|
868
|
+
this.triggerRef = /*#__PURE__*/_react.default.createRef();
|
|
869
|
+
this.optionsRef = /*#__PURE__*/_react.default.createRef();
|
|
870
|
+
this.clickOutsideHandler = null;
|
|
871
|
+
this.foundation = new _foundation.default(this.adapter);
|
|
872
|
+
} // eslint-disable-next-line max-lines-per-function
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
static getDerivedStateFromProps(props, prevState) {
|
|
876
|
+
const {
|
|
877
|
+
prevProps,
|
|
878
|
+
rePosKey
|
|
879
|
+
} = prevState;
|
|
880
|
+
|
|
881
|
+
const needUpdate = name => !prevProps && name in props || prevProps && !(0, _lodashEs.isEqual)(prevProps[name], props[name]);
|
|
882
|
+
|
|
883
|
+
let treeData;
|
|
884
|
+
const withObject = props.onChangeWithObject;
|
|
885
|
+
let keyEntities = prevState.keyEntities || {};
|
|
886
|
+
let valueEntities = prevState.cachedKeyValuePairs || {};
|
|
887
|
+
const newState = {
|
|
888
|
+
prevProps: props
|
|
889
|
+
}; // TreeNode
|
|
890
|
+
|
|
891
|
+
if (needUpdate('treeData')) {
|
|
892
|
+
treeData = props.treeData;
|
|
893
|
+
newState.treeData = treeData;
|
|
894
|
+
const entitiesMap = (0, _treeUtil.convertDataToEntities)(treeData);
|
|
895
|
+
newState.keyEntities = (0, _assign.default)({}, entitiesMap.keyEntities);
|
|
896
|
+
keyEntities = newState.keyEntities;
|
|
897
|
+
newState.cachedKeyValuePairs = (0, _assign.default)({}, entitiesMap.valueEntities);
|
|
898
|
+
valueEntities = newState.cachedKeyValuePairs;
|
|
899
|
+
} // if treeData keys changes, we won't show animation
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
if (treeData && props.motion && !(0, _lodashEs.isEqual)(new _set.default((0, _keys.default)(newState.keyEntities)), new _set.default((0, _keys.default)(prevState.keyEntities)))) {
|
|
903
|
+
if (prevProps && props.motion) {
|
|
904
|
+
newState.motionKeys = new _set.default([]);
|
|
905
|
+
newState.motionType = null;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
const expandAllWhenDataChange = needUpdate('treeData') && props.expandAll; // expandedKeys
|
|
910
|
+
|
|
911
|
+
if (needUpdate('expandedKeys') || prevProps && needUpdate('autoExpandParent')) {
|
|
912
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps); // only show animation when treeData does not change
|
|
913
|
+
|
|
914
|
+
if (prevProps && props.motion && !treeData) {
|
|
915
|
+
const {
|
|
916
|
+
motionKeys,
|
|
917
|
+
motionType
|
|
918
|
+
} = (0, _treeUtil.calcMotionKeys)(prevState.expandedKeys, newState.expandedKeys, keyEntities);
|
|
919
|
+
newState.motionKeys = new _set.default(motionKeys);
|
|
920
|
+
newState.motionType = motionType;
|
|
921
|
+
}
|
|
922
|
+
} else if (!prevProps && (props.defaultExpandAll || props.expandAll) || expandAllWhenDataChange) {
|
|
923
|
+
newState.expandedKeys = new _set.default((0, _keys.default)(keyEntities));
|
|
924
|
+
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
925
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.defaultExpandedKeys, keyEntities);
|
|
926
|
+
} else if (!prevProps && props.defaultValue) {
|
|
927
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.defaultValue, withObject), keyEntities, props.multiple, valueEntities);
|
|
928
|
+
} else if (!prevProps && props.value) {
|
|
929
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject), keyEntities, props.multiple, valueEntities);
|
|
930
|
+
} // flattenNodes
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
if (treeData || needUpdate('expandedKeys')) {
|
|
934
|
+
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys);
|
|
935
|
+
newState.flattenNodes = flattenNodes;
|
|
936
|
+
} // selectedKeys: single mode controlled
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
const isMultiple = props.multiple;
|
|
940
|
+
|
|
941
|
+
if (!isMultiple) {
|
|
942
|
+
if (needUpdate('value')) {
|
|
943
|
+
newState.selectedKeys = (0, _treeUtil.findKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject), valueEntities, isMultiple);
|
|
944
|
+
} else if (!prevProps && props.defaultValue) {
|
|
945
|
+
newState.selectedKeys = (0, _treeUtil.findKeysForValues)((0, _treeUtil.normalizeValue)(props.defaultValue, withObject), valueEntities, isMultiple);
|
|
946
|
+
} else if (treeData) {
|
|
947
|
+
// If `treeData` changed, we also need check it
|
|
948
|
+
newState.selectedKeys = (0, _treeUtil.findKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject) || '', valueEntities, isMultiple);
|
|
949
|
+
}
|
|
950
|
+
} else {
|
|
951
|
+
// checkedKeys: multiple mode controlled || data changed
|
|
952
|
+
let checkedKeyValues;
|
|
953
|
+
|
|
954
|
+
if (needUpdate('value')) {
|
|
955
|
+
checkedKeyValues = (0, _treeUtil.findKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject), valueEntities, isMultiple);
|
|
956
|
+
} else if (!prevProps && props.defaultValue) {
|
|
957
|
+
checkedKeyValues = (0, _treeUtil.findKeysForValues)((0, _treeUtil.normalizeValue)(props.defaultValue, withObject), valueEntities, isMultiple);
|
|
958
|
+
} else if (treeData) {
|
|
959
|
+
// If `treeData` changed, we also need check it
|
|
960
|
+
checkedKeyValues = (0, _treeUtil.findKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject) || [], valueEntities, isMultiple);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
if (checkedKeyValues) {
|
|
964
|
+
const {
|
|
965
|
+
checkedKeys,
|
|
966
|
+
halfCheckedKeys
|
|
967
|
+
} = (0, _treeUtil.calcCheckedKeys)(checkedKeyValues, keyEntities);
|
|
968
|
+
newState.checkedKeys = checkedKeys;
|
|
969
|
+
newState.halfCheckedKeys = halfCheckedKeys;
|
|
970
|
+
}
|
|
971
|
+
} // loadedKeys
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
if (needUpdate('loadedKeys')) {
|
|
975
|
+
newState.loadedKeys = new _set.default(props.loadedKeys);
|
|
976
|
+
} // ================== rePosKey ==================
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
if (needUpdate('treeData') || needUpdate('value')) {
|
|
980
|
+
newState.rePosKey = rePosKey + 1;
|
|
981
|
+
} // ================ disableStrictly =================
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
if (treeData && props.disableStrictly) {
|
|
985
|
+
newState.disabledKeys = (0, _treeUtil.calcDisabledKeys)(keyEntities);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
return newState;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
get adapter() {
|
|
992
|
+
var _this = this;
|
|
993
|
+
|
|
994
|
+
const filterAdapter = {
|
|
995
|
+
updateInputValue: value => {
|
|
996
|
+
this.setState({
|
|
997
|
+
inputValue: value
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
const treeSelectAdapter = {
|
|
1002
|
+
registerClickOutsideHandler: cb => {
|
|
1003
|
+
const clickOutsideHandler = e => {
|
|
1004
|
+
const optionInstance = this.optionsRef && this.optionsRef.current;
|
|
1005
|
+
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
1006
|
+
|
|
1007
|
+
const optionsDom = _reactDom.default.findDOMNode(optionInstance);
|
|
1008
|
+
|
|
1009
|
+
const target = e.target;
|
|
1010
|
+
|
|
1011
|
+
if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
|
|
1012
|
+
cb(e);
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
this.clickOutsideHandler = clickOutsideHandler;
|
|
1017
|
+
document.addEventListener('mousedown', clickOutsideHandler, false);
|
|
1018
|
+
},
|
|
1019
|
+
unregisterClickOutsideHandler: () => {
|
|
1020
|
+
document.removeEventListener('mousedown', this.clickOutsideHandler, false);
|
|
1021
|
+
this.clickOutsideHandler = null;
|
|
1022
|
+
},
|
|
1023
|
+
rePositionDropdown: () => {
|
|
1024
|
+
let {
|
|
1025
|
+
rePosKey
|
|
1026
|
+
} = this.state;
|
|
1027
|
+
rePosKey = rePosKey + 1;
|
|
1028
|
+
this.setState({
|
|
1029
|
+
rePosKey
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
const treeAdapter = {
|
|
1034
|
+
updateState: states => {
|
|
1035
|
+
this.setState((0, _assign.default)({}, states));
|
|
1036
|
+
},
|
|
1037
|
+
notifySelect: (selectKey, bool, node) => {
|
|
1038
|
+
this.props.onSelect && this.props.onSelect(selectKey, bool, node);
|
|
1039
|
+
},
|
|
1040
|
+
notifySearch: input => {
|
|
1041
|
+
this.props.onSearch && this.props.onSearch(input);
|
|
1042
|
+
},
|
|
1043
|
+
cacheFlattenNodes: bool => {
|
|
1044
|
+
this._flattenNodes = bool ? (0, _treeUtil2.cloneDeep)(this.state.flattenNodes) : null;
|
|
1045
|
+
},
|
|
1046
|
+
notifyLoad: (newLoadedKeys, data) => {
|
|
1047
|
+
const {
|
|
1048
|
+
onLoad
|
|
1049
|
+
} = this.props;
|
|
1050
|
+
(0, _lodashEs.isFunction)(onLoad) && onLoad(newLoadedKeys, data);
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
return (0, _assign.default)((0, _assign.default)((0, _assign.default)((0, _assign.default)((0, _assign.default)({}, super.adapter), filterAdapter), treeSelectAdapter), treeAdapter), {
|
|
1054
|
+
updateLoadKeys: (data, resolve) => {
|
|
1055
|
+
this.setState(_ref3 => {
|
|
1056
|
+
let {
|
|
1057
|
+
loadedKeys,
|
|
1058
|
+
loadingKeys
|
|
1059
|
+
} = _ref3;
|
|
1060
|
+
return this.foundation.handleNodeLoad(loadedKeys, loadingKeys, data, resolve);
|
|
1061
|
+
});
|
|
1062
|
+
},
|
|
1063
|
+
updateState: states => {
|
|
1064
|
+
this.setState((0, _assign.default)({}, states));
|
|
1065
|
+
},
|
|
1066
|
+
openMenu: () => {
|
|
1067
|
+
this.setState({
|
|
1068
|
+
isOpen: true
|
|
1069
|
+
}, () => {
|
|
1070
|
+
this.props.onVisibleChange(true);
|
|
1071
|
+
});
|
|
1072
|
+
},
|
|
1073
|
+
closeMenu: cb => {
|
|
1074
|
+
this.setState({
|
|
1075
|
+
isOpen: false
|
|
1076
|
+
}, () => {
|
|
1077
|
+
cb && cb();
|
|
1078
|
+
this.props.onVisibleChange(false);
|
|
1079
|
+
});
|
|
1080
|
+
},
|
|
1081
|
+
getTriggerWidth: () => {
|
|
1082
|
+
const el = this.triggerRef.current;
|
|
1083
|
+
return el && el.getBoundingClientRect().width;
|
|
1084
|
+
},
|
|
1085
|
+
setOptionWrapperWidth: width => {
|
|
1086
|
+
this.setState({
|
|
1087
|
+
dropdownMinWidth: width
|
|
1088
|
+
});
|
|
1089
|
+
},
|
|
1090
|
+
notifyChange: (value, node, e) => {
|
|
1091
|
+
this.props.onChange && this.props.onChange(value, node, e);
|
|
1092
|
+
},
|
|
1093
|
+
notifyChangeWithObject: (node, e) => {
|
|
1094
|
+
this.props.onChange && this.props.onChange(node, e);
|
|
1095
|
+
},
|
|
1096
|
+
notifyExpand: (expandedKeys, _ref4) => {
|
|
1097
|
+
let {
|
|
1098
|
+
expanded: bool,
|
|
1099
|
+
node
|
|
1100
|
+
} = _ref4;
|
|
1101
|
+
this.props.onExpand && this.props.onExpand([...expandedKeys], {
|
|
1102
|
+
expanded: bool,
|
|
1103
|
+
node
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
if (bool && this.props.loadData) {
|
|
1107
|
+
this.onNodeLoad(node);
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
notifyFocus: function () {
|
|
1111
|
+
_this.props.onFocus && _this.props.onFocus(...arguments);
|
|
1112
|
+
},
|
|
1113
|
+
notifyBlur: function () {
|
|
1114
|
+
_this.props.onBlur && _this.props.onBlur(...arguments);
|
|
1115
|
+
},
|
|
1116
|
+
toggleHovering: bool => {
|
|
1117
|
+
this.setState({
|
|
1118
|
+
isHovering: bool
|
|
1119
|
+
});
|
|
1120
|
+
},
|
|
1121
|
+
updateInputFocus: bool => {} // eslint-disable-line
|
|
1122
|
+
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
componentDidMount() {
|
|
1127
|
+
this.foundation.init();
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
componentWillUnmount() {
|
|
1131
|
+
this.foundation.destroy();
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
render() {
|
|
1135
|
+
const content = this.renderContent();
|
|
1136
|
+
const {
|
|
1137
|
+
motion,
|
|
1138
|
+
zIndex,
|
|
1139
|
+
mouseLeaveDelay,
|
|
1140
|
+
mouseEnterDelay,
|
|
1141
|
+
autoAdjustOverflow,
|
|
1142
|
+
stopPropagation,
|
|
1143
|
+
getPopupContainer
|
|
1144
|
+
} = this.props;
|
|
1145
|
+
const {
|
|
1146
|
+
isOpen,
|
|
1147
|
+
rePosKey
|
|
1148
|
+
} = this.state;
|
|
1149
|
+
const selection = this.renderSelection();
|
|
1150
|
+
const pos = 'bottomLeft';
|
|
1151
|
+
return /*#__PURE__*/_react.default.createElement(_index3.default, {
|
|
1152
|
+
stopPropagation: stopPropagation,
|
|
1153
|
+
getPopupContainer: getPopupContainer,
|
|
1154
|
+
zIndex: zIndex,
|
|
1155
|
+
motion: motion,
|
|
1156
|
+
ref: this.optionsRef,
|
|
1157
|
+
content: content,
|
|
1158
|
+
visible: isOpen,
|
|
1159
|
+
trigger: "custom",
|
|
1160
|
+
rePosKey: rePosKey,
|
|
1161
|
+
position: pos,
|
|
1162
|
+
autoAdjustOverflow: autoAdjustOverflow,
|
|
1163
|
+
mouseLeaveDelay: mouseLeaveDelay,
|
|
1164
|
+
mouseEnterDelay: mouseEnterDelay,
|
|
1165
|
+
onVisibleChange: this.handlePopoverClose
|
|
1166
|
+
}, selection);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
TreeSelect.contextType = _context2.default;
|
|
1172
|
+
TreeSelect.propTypes = {
|
|
1173
|
+
loadedKeys: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
1174
|
+
loadData: _propTypes.default.func,
|
|
1175
|
+
onLoad: _propTypes.default.func,
|
|
1176
|
+
arrowIcon: _propTypes.default.node,
|
|
1177
|
+
defaultOpen: _propTypes.default.bool,
|
|
1178
|
+
defaultValue: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.array]),
|
|
1179
|
+
defaultExpandAll: _propTypes.default.bool,
|
|
1180
|
+
defaultExpandedKeys: _propTypes.default.array,
|
|
1181
|
+
expandAll: _propTypes.default.bool,
|
|
1182
|
+
disabled: _propTypes.default.bool,
|
|
1183
|
+
disableStrictly: _propTypes.default.bool,
|
|
1184
|
+
// Whether to turn on the input box filtering function, when it is a function, it represents a custom filtering function
|
|
1185
|
+
filterTreeNode: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.bool]),
|
|
1186
|
+
multiple: _propTypes.default.bool,
|
|
1187
|
+
searchPlaceholder: _propTypes.default.string,
|
|
1188
|
+
searchAutoFocus: _propTypes.default.bool,
|
|
1189
|
+
virtualize: _propTypes.default.object,
|
|
1190
|
+
treeNodeFilterProp: _propTypes.default.string,
|
|
1191
|
+
onChange: _propTypes.default.func,
|
|
1192
|
+
onSearch: _propTypes.default.func,
|
|
1193
|
+
onSelect: _propTypes.default.func,
|
|
1194
|
+
onExpand: _propTypes.default.func,
|
|
1195
|
+
onChangeWithObject: _propTypes.default.bool,
|
|
1196
|
+
onBlur: _propTypes.default.func,
|
|
1197
|
+
onFocus: _propTypes.default.func,
|
|
1198
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.array, _propTypes.default.object]),
|
|
1199
|
+
expandedKeys: _propTypes.default.array,
|
|
1200
|
+
autoExpandParent: _propTypes.default.bool,
|
|
1201
|
+
showClear: _propTypes.default.bool,
|
|
1202
|
+
showSearchClear: _propTypes.default.bool,
|
|
1203
|
+
autoAdjustOverflow: _propTypes.default.bool,
|
|
1204
|
+
showFilteredOnly: _propTypes.default.bool,
|
|
1205
|
+
motionExpand: _propTypes.default.bool,
|
|
1206
|
+
emptyContent: _propTypes.default.node,
|
|
1207
|
+
leafOnly: _propTypes.default.bool,
|
|
1208
|
+
treeData: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
1209
|
+
key: _propTypes.default.string.isRequired,
|
|
1210
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
1211
|
+
label: _propTypes.default.any
|
|
1212
|
+
})),
|
|
1213
|
+
dropdownClassName: _propTypes.default.string,
|
|
1214
|
+
dropdownStyle: _propTypes.default.object,
|
|
1215
|
+
motion: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object, _propTypes.default.func]),
|
|
1216
|
+
placeholder: _propTypes.default.string,
|
|
1217
|
+
maxTagCount: _propTypes.default.number,
|
|
1218
|
+
size: _propTypes.default.oneOf(_constants.strings.SIZE_SET),
|
|
1219
|
+
className: _propTypes.default.string,
|
|
1220
|
+
style: _propTypes.default.object,
|
|
1221
|
+
treeNodeLabelProp: _propTypes.default.string,
|
|
1222
|
+
suffix: _propTypes.default.node,
|
|
1223
|
+
prefix: _propTypes.default.node,
|
|
1224
|
+
insetLabel: _propTypes.default.node,
|
|
1225
|
+
zIndex: _propTypes.default.number,
|
|
1226
|
+
getPopupContainer: _propTypes.default.func,
|
|
1227
|
+
dropdownMatchSelectWidth: _propTypes.default.bool,
|
|
1228
|
+
validateStatus: _propTypes.default.oneOf(_constants.strings.STATUS),
|
|
1229
|
+
mouseEnterDelay: _propTypes.default.number,
|
|
1230
|
+
mouseLeaveDelay: _propTypes.default.number,
|
|
1231
|
+
triggerRender: _propTypes.default.func,
|
|
1232
|
+
stopPropagation: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string]),
|
|
1233
|
+
outerBottomSlot: _propTypes.default.node,
|
|
1234
|
+
outerTopSlot: _propTypes.default.node,
|
|
1235
|
+
onVisibleChange: _propTypes.default.func,
|
|
1236
|
+
expandAction: _propTypes.default.oneOf(['click', 'doubleClick', false]),
|
|
1237
|
+
searchPosition: _propTypes.default.oneOf([_constants.strings.SEARCH_POSITION_DROPDOWN, _constants.strings.SEARCH_POSITION_TRIGGER]),
|
|
1238
|
+
clickToHide: _propTypes.default.bool,
|
|
1239
|
+
renderLabel: _propTypes.default.func,
|
|
1240
|
+
renderFullLabel: _propTypes.default.func,
|
|
1241
|
+
labelEllipsis: _propTypes.default.bool,
|
|
1242
|
+
optionListStyle: _propTypes.default.object,
|
|
1243
|
+
searchRender: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.bool]),
|
|
1244
|
+
renderSelectedItem: _propTypes.default.func
|
|
1245
|
+
};
|
|
1246
|
+
TreeSelect.defaultProps = {
|
|
1247
|
+
searchPosition: _constants.strings.SEARCH_POSITION_DROPDOWN,
|
|
1248
|
+
arrowIcon: /*#__PURE__*/_react.default.createElement(_semiIcons.IconChevronDown, null),
|
|
1249
|
+
autoExpandParent: false,
|
|
1250
|
+
autoAdjustOverflow: true,
|
|
1251
|
+
stopPropagation: true,
|
|
1252
|
+
motion: true,
|
|
1253
|
+
motionExpand: true,
|
|
1254
|
+
expandAll: false,
|
|
1255
|
+
zIndex: _constants2.numbers.DEFAULT_Z_INDEX,
|
|
1256
|
+
disabled: false,
|
|
1257
|
+
disableStrictly: false,
|
|
1258
|
+
multiple: false,
|
|
1259
|
+
filterTreeNode: false,
|
|
1260
|
+
size: 'default',
|
|
1261
|
+
treeNodeFilterProp: 'label',
|
|
1262
|
+
onChangeWithObject: false,
|
|
1263
|
+
treeNodeLabelProp: 'label',
|
|
1264
|
+
dropdownMatchSelectWidth: true,
|
|
1265
|
+
defaultOpen: false,
|
|
1266
|
+
showSearchClear: true,
|
|
1267
|
+
showClear: false,
|
|
1268
|
+
onVisibleChange: _lodashEs.noop,
|
|
1269
|
+
expandAction: false,
|
|
1270
|
+
clickToHide: true,
|
|
1271
|
+
searchAutoFocus: false
|
|
1272
|
+
};
|
|
1273
|
+
var _default = TreeSelect;
|
|
1274
|
+
exports.default = _default;
|