@wangxinowo/vue-datepicker-next 1.0.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/README.md +104 -0
- package/dist/vue-datepicker-next.min.css +3560 -0
- package/dist/vue-datepicker-next.min.js +11 -0
- package/package.json +84 -0
- package/src/components/_util/BaseMixin.js +40 -0
- package/src/components/_util/ContainerRender.jsx +98 -0
- package/src/components/_util/FormDecoratorDirective.js +10 -0
- package/src/components/_util/KeyCode.js +521 -0
- package/src/components/_util/Portal.js +51 -0
- package/src/components/_util/PortalWrapper.js +156 -0
- package/src/components/_util/StateMixin.js +10 -0
- package/src/components/_util/__tests__/easings.test.js +13 -0
- package/src/components/_util/__tests__/scrollTo.test.js +56 -0
- package/src/components/_util/antDirective.js +13 -0
- package/src/components/_util/antInputDirective.js +73 -0
- package/src/components/_util/callMoment.js +4 -0
- package/src/components/_util/colors.js +17 -0
- package/src/components/_util/createChainedFunction.js +22 -0
- package/src/components/_util/css-animation/Event.js +130 -0
- package/src/components/_util/css-animation/index.js +184 -0
- package/src/components/_util/easings.js +8 -0
- package/src/components/_util/env.js +14 -0
- package/src/components/_util/getLocale.js +30 -0
- package/src/components/_util/getRequestAnimationFrame.js +46 -0
- package/src/components/_util/getScroll.js +17 -0
- package/src/components/_util/getScrollBarSize.js +38 -0
- package/src/components/_util/getTransitionProps.js +34 -0
- package/src/components/_util/interopDefault.js +4 -0
- package/src/components/_util/isCssAnimationSupported.js +24 -0
- package/src/components/_util/isFlexSupported.js +12 -0
- package/src/components/_util/isNumeric.js +4 -0
- package/src/components/_util/isValid.js +4 -0
- package/src/components/_util/moment-util.js +75 -0
- package/src/components/_util/openAnimation.js +67 -0
- package/src/components/_util/portalDirective.js +24 -0
- package/src/components/_util/props-util.js +335 -0
- package/src/components/_util/proxyComponent.jsx +58 -0
- package/src/components/_util/raf.js +32 -0
- package/src/components/_util/requestAnimationTimeout.js +23 -0
- package/src/components/_util/responsiveObserve.js +94 -0
- package/src/components/_util/scrollTo.js +37 -0
- package/src/components/_util/setStyle.js +25 -0
- package/src/components/_util/store/PropTypes.js +7 -0
- package/src/components/_util/store/Provider.jsx +15 -0
- package/src/components/_util/store/connect.jsx +106 -0
- package/src/components/_util/store/create.js +30 -0
- package/src/components/_util/store/index.js +5 -0
- package/src/components/_util/styleChecker.js +13 -0
- package/src/components/_util/switchScrollingEffect.js +20 -0
- package/src/components/_util/throttleByAnimationFrame.js +45 -0
- package/src/components/_util/transButton.jsx +81 -0
- package/src/components/_util/triggerEvent.js +8 -0
- package/src/components/_util/type.js +4 -0
- package/src/components/_util/vnode.js +147 -0
- package/src/components/_util/vue-types/index.js +263 -0
- package/src/components/_util/vue-types/utils.js +200 -0
- package/src/components/_util/warning.js +7 -0
- package/src/components/_util/wave.jsx +169 -0
- package/src/components/base/index.js +9 -0
- package/src/components/base/style/index.js +2 -0
- package/src/components/button/__tests__/__snapshots__/demo.test.js.snap +103 -0
- package/src/components/button/__tests__/__snapshots__/index.test.js.snap +43 -0
- package/src/components/button/__tests__/demo.test.js +3 -0
- package/src/components/button/__tests__/index.test.js +239 -0
- package/src/components/button/button-group.jsx +52 -0
- package/src/components/button/button.jsx +186 -0
- package/src/components/button/buttonTypes.js +13 -0
- package/src/components/button/index.js +14 -0
- package/src/components/button/style/index.js +2 -0
- package/src/components/button/style/index.less +224 -0
- package/src/components/button/style/mixin.less +357 -0
- package/src/components/calendar/locale/en_US.js +2 -0
- package/src/components/config-provider/__tests__/index.test.js +44 -0
- package/src/components/config-provider/configConsumerProps.jsx +9 -0
- package/src/components/config-provider/index.jsx +91 -0
- package/src/components/config-provider/renderEmpty.jsx +42 -0
- package/src/components/config-provider/style/index.js +1 -0
- package/src/components/config-provider/style/index.less +2 -0
- package/src/components/date-picker/InputIcon.js +20 -0
- package/src/components/date-picker/PresetPanel.jsx +102 -0
- package/src/components/date-picker/RangePicker.jsx +1010 -0
- package/src/components/date-picker/WeekPicker.jsx +235 -0
- package/src/components/date-picker/__tests__/DatePicker.test.js +189 -0
- package/src/components/date-picker/__tests__/MonthPicker.test.js +29 -0
- package/src/components/date-picker/__tests__/RangePicker.test.js +417 -0
- package/src/components/date-picker/__tests__/WeekPicker.test.js +24 -0
- package/src/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap +3 -0
- package/src/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap +695 -0
- package/src/components/date-picker/__tests__/__snapshots__/WeekPicker.test.js.snap +3 -0
- package/src/components/date-picker/__tests__/__snapshots__/demo.test.js.snap +49 -0
- package/src/components/date-picker/__tests__/__snapshots__/other.test.js.snap +240 -0
- package/src/components/date-picker/__tests__/demo.test.js +3 -0
- package/src/components/date-picker/__tests__/mount.test.js +11 -0
- package/src/components/date-picker/__tests__/other.test.js +88 -0
- package/src/components/date-picker/__tests__/showTime.test.js +234 -0
- package/src/components/date-picker/__tests__/utils.js +34 -0
- package/src/components/date-picker/createPicker.js +273 -0
- package/src/components/date-picker/generate/dayjs.js +438 -0
- package/src/components/date-picker/generate/index.js +125 -0
- package/src/components/date-picker/generate/moment.js +357 -0
- package/src/components/date-picker/index.js +37 -0
- package/src/components/date-picker/interface.js +172 -0
- package/src/components/date-picker/locale/ar_EG.js +23 -0
- package/src/components/date-picker/locale/bg_BG.js +19 -0
- package/src/components/date-picker/locale/ca_ES.js +19 -0
- package/src/components/date-picker/locale/cs_CZ.js +19 -0
- package/src/components/date-picker/locale/da_DK.js +19 -0
- package/src/components/date-picker/locale/de_DE.js +19 -0
- package/src/components/date-picker/locale/el_GR.js +19 -0
- package/src/components/date-picker/locale/en_GB.js +19 -0
- package/src/components/date-picker/locale/en_US.js +19 -0
- package/src/components/date-picker/locale/es_ES.js +19 -0
- package/src/components/date-picker/locale/et_EE.js +19 -0
- package/src/components/date-picker/locale/example.json +39 -0
- package/src/components/date-picker/locale/fa_IR.js +19 -0
- package/src/components/date-picker/locale/fi_FI.js +19 -0
- package/src/components/date-picker/locale/fr_BE.js +19 -0
- package/src/components/date-picker/locale/fr_FR.js +19 -0
- package/src/components/date-picker/locale/ga_IE.js +19 -0
- package/src/components/date-picker/locale/he_IL.js +19 -0
- package/src/components/date-picker/locale/hi_IN.js +19 -0
- package/src/components/date-picker/locale/hr_HR.js +19 -0
- package/src/components/date-picker/locale/hu_HU.js +19 -0
- package/src/components/date-picker/locale/id_ID.js +19 -0
- package/src/components/date-picker/locale/is_IS.js +19 -0
- package/src/components/date-picker/locale/it_IT.js +19 -0
- package/src/components/date-picker/locale/ja_JP.js +18 -0
- package/src/components/date-picker/locale/kn_IN.js +19 -0
- package/src/components/date-picker/locale/ko_KR.js +19 -0
- package/src/components/date-picker/locale/ku_IQ.js +18 -0
- package/src/components/date-picker/locale/lv_LV.js +19 -0
- package/src/components/date-picker/locale/mk_MK.js +19 -0
- package/src/components/date-picker/locale/mn_MN.js +19 -0
- package/src/components/date-picker/locale/ms_MY.js +19 -0
- package/src/components/date-picker/locale/nb_NO.js +19 -0
- package/src/components/date-picker/locale/nl_BE.js +19 -0
- package/src/components/date-picker/locale/nl_NL.js +19 -0
- package/src/components/date-picker/locale/pl_PL.js +19 -0
- package/src/components/date-picker/locale/pt_BR.js +19 -0
- package/src/components/date-picker/locale/pt_PT.js +46 -0
- package/src/components/date-picker/locale/ro_RO.js +19 -0
- package/src/components/date-picker/locale/ru_RU.js +22 -0
- package/src/components/date-picker/locale/sk_SK.js +19 -0
- package/src/components/date-picker/locale/sl_SI.js +43 -0
- package/src/components/date-picker/locale/sr_RS.js +19 -0
- package/src/components/date-picker/locale/sv_SE.js +18 -0
- package/src/components/date-picker/locale/ta_IN.js +20 -0
- package/src/components/date-picker/locale/th_TH.js +19 -0
- package/src/components/date-picker/locale/tr_TR.js +19 -0
- package/src/components/date-picker/locale/uk_UA.js +18 -0
- package/src/components/date-picker/locale/vi_VN.js +19 -0
- package/src/components/date-picker/locale/zh_CN.js +21 -0
- package/src/components/date-picker/locale/zh_TW.js +20 -0
- package/src/components/date-picker/statusUtils.js +53 -0
- package/src/components/date-picker/style/Calendar.less +402 -0
- package/src/components/date-picker/style/DecadePanel.less +81 -0
- package/src/components/date-picker/style/MonthPanel.less +86 -0
- package/src/components/date-picker/style/MonthPicker.less +11 -0
- package/src/components/date-picker/style/Picker.less +113 -0
- package/src/components/date-picker/style/RangePicker.less +327 -0
- package/src/components/date-picker/style/TimePicker.less +151 -0
- package/src/components/date-picker/style/WeekPicker.less +21 -0
- package/src/components/date-picker/style/YearPanel.less +93 -0
- package/src/components/date-picker/style/index.js +8 -0
- package/src/components/date-picker/style/index.less +20 -0
- package/src/components/date-picker/style/presets.less +69 -0
- package/src/components/date-picker/style/status.less +94 -0
- package/src/components/date-picker/style/transitions.less +176 -0
- package/src/components/date-picker/utils.js +209 -0
- package/src/components/date-picker/wrapPicker.js +258 -0
- package/src/components/empty/__tests__/__snapshots__/demo.test.js.snap +195 -0
- package/src/components/empty/__tests__/demo.test.js +3 -0
- package/src/components/empty/__tests__/index.test.js +25 -0
- package/src/components/empty/empty.jsx +47 -0
- package/src/components/empty/index.jsx +78 -0
- package/src/components/empty/simple.jsx +20 -0
- package/src/components/empty/style/index.js +2 -0
- package/src/components/empty/style/index.less +52 -0
- package/src/components/icon/IconFont.jsx +52 -0
- package/src/components/icon/__tests__/__snapshots__/demo.test.js.snap +671 -0
- package/src/components/icon/__tests__/__snapshots__/index.test.js.snap +77 -0
- package/src/components/icon/__tests__/demo.test.js +3 -0
- package/src/components/icon/__tests__/index.test.js +236 -0
- package/src/components/icon/index.js +185 -0
- package/src/components/icon/style/index.js +2 -0
- package/src/components/icon/style/index.less +4 -0
- package/src/components/icon/twoTonePrimaryColor.js +12 -0
- package/src/components/icon/utils.js +77 -0
- package/src/components/input/ClearableLabeledInput.jsx +182 -0
- package/src/components/input/Group.jsx +41 -0
- package/src/components/input/Input.jsx +240 -0
- package/src/components/input/Password.jsx +117 -0
- package/src/components/input/ResizableTextArea.jsx +158 -0
- package/src/components/input/Search.jsx +185 -0
- package/src/components/input/TextArea.jsx +131 -0
- package/src/components/input/__tests__/Search.test.js +134 -0
- package/src/components/input/__tests__/__snapshots__/Search.test.js.snap +5 -0
- package/src/components/input/__tests__/__snapshots__/demo.test.js.snap +86 -0
- package/src/components/input/__tests__/__snapshots__/index.test.js.snap +9 -0
- package/src/components/input/__tests__/demo.test.js +3 -0
- package/src/components/input/__tests__/index.test.js +124 -0
- package/src/components/input/calculateNodeHeight.js +151 -0
- package/src/components/input/index.js +27 -0
- package/src/components/input/inputProps.js +36 -0
- package/src/components/input/style/index.js +5 -0
- package/src/components/input/style/index.less +52 -0
- package/src/components/input/style/mixin.less +453 -0
- package/src/components/input/style/search-input.less +34 -0
- package/src/components/locale/ar_EG.js +43 -0
- package/src/components/locale/bg_BG.js +43 -0
- package/src/components/locale/ca_ES.js +41 -0
- package/src/components/locale/cs_CZ.js +41 -0
- package/src/components/locale/da_DK.js +43 -0
- package/src/components/locale/de_DE.js +43 -0
- package/src/components/locale/default.js +62 -0
- package/src/components/locale/el_GR.js +43 -0
- package/src/components/locale/en_GB.js +43 -0
- package/src/components/locale/en_US.js +3 -0
- package/src/components/locale/es_ES.js +59 -0
- package/src/components/locale/et_EE.js +43 -0
- package/src/components/locale/fa_IR.js +43 -0
- package/src/components/locale/fi_FI.js +44 -0
- package/src/components/locale/fr_BE.js +47 -0
- package/src/components/locale/fr_FR.js +47 -0
- package/src/components/locale/ga_IE.js +43 -0
- package/src/components/locale/he_IL.js +43 -0
- package/src/components/locale/hi_IN.js +51 -0
- package/src/components/locale/hr_HR.js +57 -0
- package/src/components/locale/hu_HU.js +44 -0
- package/src/components/locale/hy_AM.js +109 -0
- package/src/components/locale/id_ID.js +45 -0
- package/src/components/locale/is_IS.js +43 -0
- package/src/components/locale/it_IT.js +56 -0
- package/src/components/locale/ja_JP.js +43 -0
- package/src/components/locale/kn_IN.js +51 -0
- package/src/components/locale/ko_KR.js +43 -0
- package/src/components/locale/ku_IQ.js +43 -0
- package/src/components/locale/lv_LV.js +43 -0
- package/src/components/locale/mk_MK.js +58 -0
- package/src/components/locale/mn_MN.js +43 -0
- package/src/components/locale/ms_MY.js +63 -0
- package/src/components/locale/nb_NO.js +43 -0
- package/src/components/locale/ne_NP.js +44 -0
- package/src/components/locale/nl_BE.js +43 -0
- package/src/components/locale/nl_NL.js +62 -0
- package/src/components/locale/pl_PL.js +43 -0
- package/src/components/locale/pt_BR.js +49 -0
- package/src/components/locale/pt_PT.js +44 -0
- package/src/components/locale/ro_RO.js +62 -0
- package/src/components/locale/ru_RU.js +53 -0
- package/src/components/locale/sk_SK.js +62 -0
- package/src/components/locale/sl_SI.js +43 -0
- package/src/components/locale/sr_RS.js +43 -0
- package/src/components/locale/sv_SE.js +47 -0
- package/src/components/locale/ta_IN.js +63 -0
- package/src/components/locale/th_TH.js +62 -0
- package/src/components/locale/tr_TR.js +57 -0
- package/src/components/locale/uk_UA.js +43 -0
- package/src/components/locale/vi_VN.js +43 -0
- package/src/components/locale/zh_CN.js +62 -0
- package/src/components/locale/zh_TW.js +49 -0
- package/src/components/locale-provider/LocaleReceiver.jsx +43 -0
- package/src/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap +434 -0
- package/src/components/locale-provider/__tests__/__snapshots__/index.test.js.snap +22618 -0
- package/src/components/locale-provider/__tests__/demo.test.js +3 -0
- package/src/components/locale-provider/__tests__/index.test.js +271 -0
- package/src/components/locale-provider/ar_EG.js +3 -0
- package/src/components/locale-provider/bg_BG.js +3 -0
- package/src/components/locale-provider/ca_ES.js +3 -0
- package/src/components/locale-provider/cs_CZ.js +3 -0
- package/src/components/locale-provider/da_DK.js +3 -0
- package/src/components/locale-provider/de_DE.js +3 -0
- package/src/components/locale-provider/default.js +3 -0
- package/src/components/locale-provider/el_GR.js +3 -0
- package/src/components/locale-provider/en_GB.js +3 -0
- package/src/components/locale-provider/en_US.js +3 -0
- package/src/components/locale-provider/es_ES.js +3 -0
- package/src/components/locale-provider/et_EE.js +3 -0
- package/src/components/locale-provider/fa_IR.js +3 -0
- package/src/components/locale-provider/fi_FI.js +3 -0
- package/src/components/locale-provider/fr_BE.js +3 -0
- package/src/components/locale-provider/fr_FR.js +3 -0
- package/src/components/locale-provider/ga_IE.js +3 -0
- package/src/components/locale-provider/he_IL.js +3 -0
- package/src/components/locale-provider/hi_IN.js +3 -0
- package/src/components/locale-provider/hr_HR.js +3 -0
- package/src/components/locale-provider/hu_HU.js +3 -0
- package/src/components/locale-provider/hy_AM.js +3 -0
- package/src/components/locale-provider/id_ID.js +3 -0
- package/src/components/locale-provider/index.jsx +82 -0
- package/src/components/locale-provider/is_IS.js +3 -0
- package/src/components/locale-provider/it_IT.js +3 -0
- package/src/components/locale-provider/ja_JP.js +3 -0
- package/src/components/locale-provider/kn_IN.js +3 -0
- package/src/components/locale-provider/ko_KR.js +3 -0
- package/src/components/locale-provider/ku_IQ.js +3 -0
- package/src/components/locale-provider/lv_LV.js +3 -0
- package/src/components/locale-provider/mk_MK.js +3 -0
- package/src/components/locale-provider/mn_MN.js +3 -0
- package/src/components/locale-provider/ms_MY.js +3 -0
- package/src/components/locale-provider/nb_NO.js +3 -0
- package/src/components/locale-provider/ne-NP.js +3 -0
- package/src/components/locale-provider/ne_NP.js +3 -0
- package/src/components/locale-provider/nl_BE.js +3 -0
- package/src/components/locale-provider/nl_NL.js +3 -0
- package/src/components/locale-provider/pl_PL.js +3 -0
- package/src/components/locale-provider/pt_BR.js +3 -0
- package/src/components/locale-provider/pt_PT.js +3 -0
- package/src/components/locale-provider/ro_RO.js +3 -0
- package/src/components/locale-provider/ru_RU.js +3 -0
- package/src/components/locale-provider/sk_SK.js +3 -0
- package/src/components/locale-provider/sl_SI.js +3 -0
- package/src/components/locale-provider/sr_RS.js +3 -0
- package/src/components/locale-provider/style/index.js +1 -0
- package/src/components/locale-provider/style/index.less +2 -0
- package/src/components/locale-provider/sv_SE.js +3 -0
- package/src/components/locale-provider/ta_IN.js +62 -0
- package/src/components/locale-provider/th_TH.js +3 -0
- package/src/components/locale-provider/tr_TR.js +3 -0
- package/src/components/locale-provider/uk_UA.js +3 -0
- package/src/components/locale-provider/vi_VN.js +3 -0
- package/src/components/locale-provider/zh_CN.js +3 -0
- package/src/components/locale-provider/zh_TW.js +3 -0
- package/src/components/style/color/bezierEasing.less +110 -0
- package/src/components/style/color/colorPalette.less +75 -0
- package/src/components/style/color/colors.less +149 -0
- package/src/components/style/color/tinyColor.less +1184 -0
- package/src/components/style/core/base.less +510 -0
- package/src/components/style/core/iconfont.less +19 -0
- package/src/components/style/core/index.less +4 -0
- package/src/components/style/core/motion/fade.less +31 -0
- package/src/components/style/core/motion/move.less +120 -0
- package/src/components/style/core/motion/other.less +45 -0
- package/src/components/style/core/motion/slide.less +120 -0
- package/src/components/style/core/motion/swing.less +34 -0
- package/src/components/style/core/motion/zoom.less +162 -0
- package/src/components/style/core/motion.less +20 -0
- package/src/components/style/index.js +1 -0
- package/src/components/style/index.less +2 -0
- package/src/components/style/index.tsx +1 -0
- package/src/components/style/mixins/clearfix.less +13 -0
- package/src/components/style/mixins/compatibility.less +22 -0
- package/src/components/style/mixins/iconfont.less +43 -0
- package/src/components/style/mixins/index.less +10 -0
- package/src/components/style/mixins/motion.less +35 -0
- package/src/components/style/mixins/operation-unit.less +18 -0
- package/src/components/style/mixins/reset.less +13 -0
- package/src/components/style/mixins/size.less +10 -0
- package/src/components/style/mixins/typography.less +49 -0
- package/src/components/style/themes/default.less +701 -0
- package/src/components/style/themes/index.less +1 -0
- package/src/components/style/v2-compatible-reset.js +1 -0
- package/src/components/style/v2-compatible-reset.less +51 -0
- package/src/components/style/v2-compatible-reset.tsx +1 -0
- package/src/components/tag/CheckableTag.jsx +43 -0
- package/src/components/tag/Tag.jsx +145 -0
- package/src/components/tag/__tests__/__snapshots__/demo.test.js.snap +92 -0
- package/src/components/tag/__tests__/__snapshots__/index.test.js.snap +13 -0
- package/src/components/tag/__tests__/demo.test.js +3 -0
- package/src/components/tag/__tests__/index.test.js +82 -0
- package/src/components/tag/index.js +14 -0
- package/src/components/tag/style/index.js +2 -0
- package/src/components/tag/style/index.less +106 -0
- package/src/components/time-picker/__tests__/__snapshots__/demo.test.js.snap +39 -0
- package/src/components/time-picker/__tests__/__snapshots__/index.test.js.snap +5 -0
- package/src/components/time-picker/__tests__/demo.test.js +3 -0
- package/src/components/time-picker/__tests__/index.test.js +55 -0
- package/src/components/time-picker/index.jsx +267 -0
- package/src/components/time-picker/locale/ar_EG.js +5 -0
- package/src/components/time-picker/locale/bg_BG.js +5 -0
- package/src/components/time-picker/locale/ca_ES.js +5 -0
- package/src/components/time-picker/locale/cs_CZ.js +5 -0
- package/src/components/time-picker/locale/da_DK.js +5 -0
- package/src/components/time-picker/locale/de_DE.js +5 -0
- package/src/components/time-picker/locale/el_GR.js +5 -0
- package/src/components/time-picker/locale/en_GB.js +5 -0
- package/src/components/time-picker/locale/en_US.js +5 -0
- package/src/components/time-picker/locale/es_ES.js +5 -0
- package/src/components/time-picker/locale/et_EE.js +5 -0
- package/src/components/time-picker/locale/fa_IR.js +5 -0
- package/src/components/time-picker/locale/fi_FI.js +5 -0
- package/src/components/time-picker/locale/fr_BE.js +5 -0
- package/src/components/time-picker/locale/fr_FR.js +5 -0
- package/src/components/time-picker/locale/ga_IE.js +5 -0
- package/src/components/time-picker/locale/he_IL.js +5 -0
- package/src/components/time-picker/locale/hi_IN.js +5 -0
- package/src/components/time-picker/locale/hr_HR.js +5 -0
- package/src/components/time-picker/locale/hu_HU.js +5 -0
- package/src/components/time-picker/locale/id_ID.js +5 -0
- package/src/components/time-picker/locale/is_IS.js +5 -0
- package/src/components/time-picker/locale/it_IT.js +5 -0
- package/src/components/time-picker/locale/ja_JP.js +5 -0
- package/src/components/time-picker/locale/kn_IN.js +5 -0
- package/src/components/time-picker/locale/ko_KR.js +5 -0
- package/src/components/time-picker/locale/ku_IQ.js +5 -0
- package/src/components/time-picker/locale/lv_LV.js +5 -0
- package/src/components/time-picker/locale/mk_MK.js +5 -0
- package/src/components/time-picker/locale/mn_MN.js +5 -0
- package/src/components/time-picker/locale/ms_MY.js +5 -0
- package/src/components/time-picker/locale/nb_NO.js +5 -0
- package/src/components/time-picker/locale/nl_BE.js +5 -0
- package/src/components/time-picker/locale/nl_NL.js +5 -0
- package/src/components/time-picker/locale/pl_PL.js +5 -0
- package/src/components/time-picker/locale/pt_BR.js +5 -0
- package/src/components/time-picker/locale/pt_PT.js +5 -0
- package/src/components/time-picker/locale/ro_RO.js +5 -0
- package/src/components/time-picker/locale/ru_RU.js +8 -0
- package/src/components/time-picker/locale/sk_SK.js +5 -0
- package/src/components/time-picker/locale/sl_SI.js +5 -0
- package/src/components/time-picker/locale/sr_RS.js +5 -0
- package/src/components/time-picker/locale/sv_SE.js +5 -0
- package/src/components/time-picker/locale/ta_IN.js +5 -0
- package/src/components/time-picker/locale/th_TH.js +5 -0
- package/src/components/time-picker/locale/tr_TR.js +5 -0
- package/src/components/time-picker/locale/uk_UA.js +5 -0
- package/src/components/time-picker/locale/vi_VN.js +5 -0
- package/src/components/time-picker/locale/zh_CN.js +5 -0
- package/src/components/time-picker/locale/zh_TW.js +5 -0
- package/src/components/time-picker/style/index.js +2 -0
- package/src/components/time-picker/style/index.less +246 -0
- package/src/components/tooltip/Tooltip.jsx +219 -0
- package/src/components/tooltip/__tests__/__snapshots__/demo.test.js.snap +20 -0
- package/src/components/tooltip/__tests__/demo.test.js +3 -0
- package/src/components/tooltip/__tests__/tooltip.test.js +204 -0
- package/src/components/tooltip/abstractTooltipProps.js +34 -0
- package/src/components/tooltip/index.js +10 -0
- package/src/components/tooltip/placements.js +96 -0
- package/src/components/tooltip/style/index.js +2 -0
- package/src/components/tooltip/style/index.less +187 -0
- package/src/components/vc-align/Align.jsx +149 -0
- package/src/components/vc-align/index.js +3 -0
- package/src/components/vc-align/util.js +52 -0
- package/src/components/vc-calendar/assets/common/Calendar.less +106 -0
- package/src/components/vc-calendar/assets/common/FullCalendar.less +91 -0
- package/src/components/vc-calendar/assets/common/Picker.less +10 -0
- package/src/components/vc-calendar/assets/common/RangeCalendar.less +131 -0
- package/src/components/vc-calendar/assets/common/index.less +16 -0
- package/src/components/vc-calendar/assets/index/Calendar.less +301 -0
- package/src/components/vc-calendar/assets/index/DecadePanel.less +122 -0
- package/src/components/vc-calendar/assets/index/Input.less +23 -0
- package/src/components/vc-calendar/assets/index/MonthPanel.less +143 -0
- package/src/components/vc-calendar/assets/index/Picker.less +110 -0
- package/src/components/vc-calendar/assets/index/Time.less +6 -0
- package/src/components/vc-calendar/assets/index/TimePanel.less +72 -0
- package/src/components/vc-calendar/assets/index/YearPanel.less +136 -0
- package/src/components/vc-calendar/assets/index.less +10 -0
- package/src/components/vc-calendar/index.js +8 -0
- package/src/components/vc-calendar/src/Calendar.jsx +390 -0
- package/src/components/vc-calendar/src/FullCalendar.jsx +166 -0
- package/src/components/vc-calendar/src/MonthCalendar.jsx +125 -0
- package/src/components/vc-calendar/src/Picker.jsx +244 -0
- package/src/components/vc-calendar/src/RangeCalendar.jsx +1031 -0
- package/src/components/vc-calendar/src/calendar/CalendarFooter.jsx +86 -0
- package/src/components/vc-calendar/src/calendar/CalendarHeader.jsx +264 -0
- package/src/components/vc-calendar/src/calendar/OkButton.jsx +18 -0
- package/src/components/vc-calendar/src/calendar/TimePickerButton.jsx +22 -0
- package/src/components/vc-calendar/src/calendar/TodayButton.jsx +33 -0
- package/src/components/vc-calendar/src/date/DateConstants.js +4 -0
- package/src/components/vc-calendar/src/date/DateInput.jsx +226 -0
- package/src/components/vc-calendar/src/date/DateTBody.jsx +261 -0
- package/src/components/vc-calendar/src/date/DateTHead.jsx +49 -0
- package/src/components/vc-calendar/src/date/DateTable.jsx +20 -0
- package/src/components/vc-calendar/src/decade/DecadePanel.jsx +131 -0
- package/src/components/vc-calendar/src/full-calendar/CalendarHeader.jsx +134 -0
- package/src/components/vc-calendar/src/index.js +3 -0
- package/src/components/vc-calendar/src/locale/ar_EG.js +27 -0
- package/src/components/vc-calendar/src/locale/bg_BG.js +27 -0
- package/src/components/vc-calendar/src/locale/ca_ES.js +27 -0
- package/src/components/vc-calendar/src/locale/cs_CZ.js +27 -0
- package/src/components/vc-calendar/src/locale/da_DK.js +27 -0
- package/src/components/vc-calendar/src/locale/de_DE.js +27 -0
- package/src/components/vc-calendar/src/locale/el_GR.js +27 -0
- package/src/components/vc-calendar/src/locale/en_GB.js +27 -0
- package/src/components/vc-calendar/src/locale/en_US.js +28 -0
- package/src/components/vc-calendar/src/locale/es_ES.js +27 -0
- package/src/components/vc-calendar/src/locale/et_EE.js +27 -0
- package/src/components/vc-calendar/src/locale/fa_IR.js +27 -0
- package/src/components/vc-calendar/src/locale/fi_FI.js +27 -0
- package/src/components/vc-calendar/src/locale/fr_BE.js +27 -0
- package/src/components/vc-calendar/src/locale/fr_FR.js +27 -0
- package/src/components/vc-calendar/src/locale/ga_IE.js +28 -0
- package/src/components/vc-calendar/src/locale/he_IL.js +28 -0
- package/src/components/vc-calendar/src/locale/hi_IN.js +28 -0
- package/src/components/vc-calendar/src/locale/hr_HR.js +28 -0
- package/src/components/vc-calendar/src/locale/hu_HU.js +27 -0
- package/src/components/vc-calendar/src/locale/id_ID.js +28 -0
- package/src/components/vc-calendar/src/locale/is_IS.js +27 -0
- package/src/components/vc-calendar/src/locale/it_IT.js +27 -0
- package/src/components/vc-calendar/src/locale/ja_JP.js +26 -0
- package/src/components/vc-calendar/src/locale/kn_IN.js +28 -0
- package/src/components/vc-calendar/src/locale/ko_KR.js +27 -0
- package/src/components/vc-calendar/src/locale/ku_IQ.js +27 -0
- package/src/components/vc-calendar/src/locale/lv_LV.js +27 -0
- package/src/components/vc-calendar/src/locale/mk_MK.js +27 -0
- package/src/components/vc-calendar/src/locale/mm_MM.js +28 -0
- package/src/components/vc-calendar/src/locale/mn_MN.js +28 -0
- package/src/components/vc-calendar/src/locale/ms_MY.js +27 -0
- package/src/components/vc-calendar/src/locale/nb_NO.js +27 -0
- package/src/components/vc-calendar/src/locale/nl_BE.js +27 -0
- package/src/components/vc-calendar/src/locale/nl_NL.js +27 -0
- package/src/components/vc-calendar/src/locale/pl_PL.js +27 -0
- package/src/components/vc-calendar/src/locale/pt_BR.js +27 -0
- package/src/components/vc-calendar/src/locale/pt_PT.js +27 -0
- package/src/components/vc-calendar/src/locale/ro_RO.js +28 -0
- package/src/components/vc-calendar/src/locale/ru_RU.js +27 -0
- package/src/components/vc-calendar/src/locale/sk_SK.js +28 -0
- package/src/components/vc-calendar/src/locale/sl_SI.js +27 -0
- package/src/components/vc-calendar/src/locale/sr_RS.js +27 -0
- package/src/components/vc-calendar/src/locale/sv_SE.js +27 -0
- package/src/components/vc-calendar/src/locale/ta_IN.js +28 -0
- package/src/components/vc-calendar/src/locale/th_TH.js +27 -0
- package/src/components/vc-calendar/src/locale/tr_TR.js +27 -0
- package/src/components/vc-calendar/src/locale/ug_CN.js +26 -0
- package/src/components/vc-calendar/src/locale/uk_UA.js +27 -0
- package/src/components/vc-calendar/src/locale/vi_VN.js +28 -0
- package/src/components/vc-calendar/src/locale/zh_CN.js +27 -0
- package/src/components/vc-calendar/src/locale/zh_TW.js +26 -0
- package/src/components/vc-calendar/src/mixin/CalendarMixin.js +122 -0
- package/src/components/vc-calendar/src/mixin/CommonMixin.js +26 -0
- package/src/components/vc-calendar/src/month/MonthPanel.jsx +123 -0
- package/src/components/vc-calendar/src/month/MonthTable.jsx +138 -0
- package/src/components/vc-calendar/src/picker/placements.js +35 -0
- package/src/components/vc-calendar/src/range-calendar/CalendarPart.jsx +171 -0
- package/src/components/vc-calendar/src/util/index.js +113 -0
- package/src/components/vc-calendar/src/util/toTime.js +15 -0
- package/src/components/vc-calendar/src/year/YearPanel.jsx +167 -0
- package/src/components/vc-pagination/locale/en_US.js +15 -0
- package/src/components/vc-select/DropdownMenu.jsx +216 -0
- package/src/components/vc-select/OptGroup.jsx +8 -0
- package/src/components/vc-select/Option.jsx +11 -0
- package/src/components/vc-select/PropTypes.js +59 -0
- package/src/components/vc-select/Select.jsx +1716 -0
- package/src/components/vc-select/SelectTrigger.jsx +259 -0
- package/src/components/vc-select/assets/index.less +541 -0
- package/src/components/vc-select/index.js +11 -0
- package/src/components/vc-select/util.js +223 -0
- package/src/components/vc-time-picker/Combobox.jsx +214 -0
- package/src/components/vc-time-picker/Header.jsx +187 -0
- package/src/components/vc-time-picker/Panel.jsx +225 -0
- package/src/components/vc-time-picker/Select.jsx +140 -0
- package/src/components/vc-time-picker/TimePicker.jsx +386 -0
- package/src/components/vc-time-picker/assets/index/Header.less +22 -0
- package/src/components/vc-time-picker/assets/index/Panel.less +29 -0
- package/src/components/vc-time-picker/assets/index/Picker.less +25 -0
- package/src/components/vc-time-picker/assets/index/Select.less +62 -0
- package/src/components/vc-time-picker/assets/index.less +44 -0
- package/src/components/vc-time-picker/index.js +2 -0
- package/src/components/vc-time-picker/placements.js +35 -0
- package/src/components/vc-tooltip/Content.jsx +23 -0
- package/src/components/vc-tooltip/Tooltip.jsx +106 -0
- package/src/components/vc-tooltip/assets/boostrap/anim.less +61 -0
- package/src/components/vc-tooltip/assets/bootstrap.less +171 -0
- package/src/components/vc-tooltip/assets/bootstrap_white.less +190 -0
- package/src/components/vc-tooltip/index.js +4 -0
- package/src/components/vc-tooltip/placements.js +83 -0
- package/src/components/vc-trigger/LazyRenderBox.jsx +22 -0
- package/src/components/vc-trigger/Popup.jsx +336 -0
- package/src/components/vc-trigger/PopupInner.jsx +25 -0
- package/src/components/vc-trigger/Trigger.jsx +663 -0
- package/src/components/vc-trigger/assets/index.less +72 -0
- package/src/components/vc-trigger/assets/mask.less +65 -0
- package/src/components/vc-trigger/index.js +3 -0
- package/src/components/vc-trigger/index.md +160 -0
- package/src/components/vc-trigger/t.js +665 -0
- package/src/components/vc-trigger/utils.js +27 -0
- package/src/components/vc-util/Dom/addEventListener.js +5 -0
- package/src/components/vc-util/Dom/class.js +28 -0
- package/src/components/vc-util/Dom/contains.js +11 -0
- package/src/components/vc-util/warning.js +38 -0
- package/src/index.js +44 -0
- package/types/index.d.ts +112 -0
|
@@ -0,0 +1,1716 @@
|
|
|
1
|
+
import KeyCode from '../_util/KeyCode';
|
|
2
|
+
import PropTypes from '../_util/vue-types';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import classes from 'component-classes';
|
|
5
|
+
import { Item as MenuItem, ItemGroup as MenuItemGroup } from '../vc-menu';
|
|
6
|
+
import warning from 'warning';
|
|
7
|
+
import Vue from 'vue';
|
|
8
|
+
import Option from './Option';
|
|
9
|
+
import OptGroup from './OptGroup';
|
|
10
|
+
import {
|
|
11
|
+
hasProp,
|
|
12
|
+
getSlotOptions,
|
|
13
|
+
getPropsData,
|
|
14
|
+
getValueByProp as getValue,
|
|
15
|
+
getComponentFromProp,
|
|
16
|
+
getEvents,
|
|
17
|
+
getClass,
|
|
18
|
+
getStyle,
|
|
19
|
+
getAttrs,
|
|
20
|
+
getOptionProps,
|
|
21
|
+
getSlots,
|
|
22
|
+
getListeners,
|
|
23
|
+
} from '../_util/props-util';
|
|
24
|
+
import getTransitionProps from '../_util/getTransitionProps';
|
|
25
|
+
import { cloneElement } from '../_util/vnode';
|
|
26
|
+
import BaseMixin from '../_util/BaseMixin';
|
|
27
|
+
import proxyComponent from '../_util/proxyComponent';
|
|
28
|
+
import ref from 'vue-ref';
|
|
29
|
+
import SelectTrigger from './SelectTrigger';
|
|
30
|
+
import {
|
|
31
|
+
defaultFilterFn,
|
|
32
|
+
findFirstMenuItem,
|
|
33
|
+
findIndexInValueBySingleValue,
|
|
34
|
+
generateUUID,
|
|
35
|
+
getLabelFromPropsValue,
|
|
36
|
+
getMapKey,
|
|
37
|
+
getPropValue,
|
|
38
|
+
getValuePropValue,
|
|
39
|
+
includesSeparators,
|
|
40
|
+
isCombobox,
|
|
41
|
+
isMultipleOrTags,
|
|
42
|
+
isMultipleOrTagsOrCombobox,
|
|
43
|
+
isSingleMode,
|
|
44
|
+
preventDefaultEvent,
|
|
45
|
+
saveRef,
|
|
46
|
+
splitBySeparators,
|
|
47
|
+
toArray,
|
|
48
|
+
toTitle,
|
|
49
|
+
UNSELECTABLE_ATTRIBUTE,
|
|
50
|
+
UNSELECTABLE_STYLE,
|
|
51
|
+
validateOptionValue,
|
|
52
|
+
} from './util';
|
|
53
|
+
import { SelectPropTypes } from './PropTypes';
|
|
54
|
+
import contains from '../vc-util/Dom/contains';
|
|
55
|
+
import { isIE, isEdge } from '../_util/env';
|
|
56
|
+
|
|
57
|
+
Vue.use(ref, { name: 'ant-ref' });
|
|
58
|
+
const SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY';
|
|
59
|
+
|
|
60
|
+
const noop = () => null;
|
|
61
|
+
|
|
62
|
+
// Where el is the DOM element you'd like to test for visibility
|
|
63
|
+
function isHidden(node) {
|
|
64
|
+
return !node || node.offsetParent === null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function chaining(...fns) {
|
|
68
|
+
return function(...args) {
|
|
69
|
+
// eslint-disable-line
|
|
70
|
+
// eslint-disable-line
|
|
71
|
+
for (let i = 0; i < fns.length; i++) {
|
|
72
|
+
if (fns[i] && typeof fns[i] === 'function') {
|
|
73
|
+
fns[i].apply(chaining, args);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const Select = {
|
|
79
|
+
inheritAttrs: false,
|
|
80
|
+
Option,
|
|
81
|
+
OptGroup,
|
|
82
|
+
name: 'Select',
|
|
83
|
+
mixins: [BaseMixin],
|
|
84
|
+
props: {
|
|
85
|
+
...SelectPropTypes,
|
|
86
|
+
prefixCls: SelectPropTypes.prefixCls.def('rc-select'),
|
|
87
|
+
defaultOpen: PropTypes.bool.def(false),
|
|
88
|
+
labelInValue: SelectPropTypes.labelInValue.def(false),
|
|
89
|
+
defaultActiveFirstOption: SelectPropTypes.defaultActiveFirstOption.def(true),
|
|
90
|
+
showSearch: SelectPropTypes.showSearch.def(true),
|
|
91
|
+
allowClear: SelectPropTypes.allowClear.def(false),
|
|
92
|
+
placeholder: SelectPropTypes.placeholder.def(''),
|
|
93
|
+
// showArrow: SelectPropTypes.showArrow.def(true),
|
|
94
|
+
dropdownMatchSelectWidth: PropTypes.bool.def(true),
|
|
95
|
+
dropdownStyle: SelectPropTypes.dropdownStyle.def(() => ({})),
|
|
96
|
+
dropdownMenuStyle: PropTypes.object.def(() => ({})),
|
|
97
|
+
optionFilterProp: SelectPropTypes.optionFilterProp.def('value'),
|
|
98
|
+
optionLabelProp: SelectPropTypes.optionLabelProp.def('value'),
|
|
99
|
+
notFoundContent: PropTypes.any.def('Not Found'),
|
|
100
|
+
backfill: PropTypes.bool.def(false),
|
|
101
|
+
showAction: SelectPropTypes.showAction.def(['click']),
|
|
102
|
+
combobox: PropTypes.bool.def(false),
|
|
103
|
+
tokenSeparators: PropTypes.arrayOf(PropTypes.string).def([]),
|
|
104
|
+
autoClearSearchValue: PropTypes.bool.def(true),
|
|
105
|
+
tabIndex: PropTypes.any.def(0),
|
|
106
|
+
dropdownRender: PropTypes.func.def(menu => menu),
|
|
107
|
+
// onChange: noop,
|
|
108
|
+
// onFocus: noop,
|
|
109
|
+
// onBlur: noop,
|
|
110
|
+
// onSelect: noop,
|
|
111
|
+
// onSearch: noop,
|
|
112
|
+
// onDeselect: noop,
|
|
113
|
+
// onInputKeydown: noop,
|
|
114
|
+
},
|
|
115
|
+
model: {
|
|
116
|
+
prop: 'value',
|
|
117
|
+
event: 'change',
|
|
118
|
+
},
|
|
119
|
+
created() {
|
|
120
|
+
this.saveInputRef = saveRef(this, 'inputRef');
|
|
121
|
+
this.saveInputMirrorRef = saveRef(this, 'inputMirrorRef');
|
|
122
|
+
this.saveTopCtrlRef = saveRef(this, 'topCtrlRef');
|
|
123
|
+
this.saveSelectTriggerRef = saveRef(this, 'selectTriggerRef');
|
|
124
|
+
this.saveRootRef = saveRef(this, 'rootRef');
|
|
125
|
+
this.saveSelectionRef = saveRef(this, 'selectionRef');
|
|
126
|
+
this._focused = false;
|
|
127
|
+
this._mouseDown = false;
|
|
128
|
+
this._options = [];
|
|
129
|
+
this._empty = false;
|
|
130
|
+
},
|
|
131
|
+
data() {
|
|
132
|
+
const props = getOptionProps(this);
|
|
133
|
+
const optionsInfo = this.getOptionsInfoFromProps(props);
|
|
134
|
+
warning(
|
|
135
|
+
this.__propsSymbol__,
|
|
136
|
+
'Replace slots.default with props.children and pass props.__propsSymbol__',
|
|
137
|
+
);
|
|
138
|
+
if (props.tags && typeof props.filterOption !== 'function') {
|
|
139
|
+
const isDisabledExist = Object.keys(optionsInfo).some(key => optionsInfo[key].disabled);
|
|
140
|
+
warning(
|
|
141
|
+
!isDisabledExist,
|
|
142
|
+
'Please avoid setting option to disabled in tags mode since user can always type text as tag.',
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
const state = {
|
|
146
|
+
_value: this.getValueFromProps(props, true), // true: use default value
|
|
147
|
+
_inputValue: props.combobox
|
|
148
|
+
? this.getInputValueForCombobox(
|
|
149
|
+
props,
|
|
150
|
+
optionsInfo,
|
|
151
|
+
true, // use default value
|
|
152
|
+
)
|
|
153
|
+
: '',
|
|
154
|
+
_open: props.defaultOpen,
|
|
155
|
+
_optionsInfo: optionsInfo,
|
|
156
|
+
_backfillValue: '',
|
|
157
|
+
// a flag for aviod redundant getOptionsInfoFromProps call
|
|
158
|
+
_skipBuildOptionsInfo: true,
|
|
159
|
+
_ariaId: generateUUID(),
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
...state,
|
|
163
|
+
_mirrorInputValue: state._inputValue, // https://github.com/vueComponent/ant-design-vue/issues/1458
|
|
164
|
+
...this.getDerivedState(props, state),
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
mounted() {
|
|
169
|
+
this.$nextTick(() => {
|
|
170
|
+
// when defaultOpen is true, we should auto focus search input
|
|
171
|
+
// https://github.com/ant-design/ant-design/issues/14254
|
|
172
|
+
if (this.autoFocus || this._open) {
|
|
173
|
+
this.focus();
|
|
174
|
+
}
|
|
175
|
+
// this.setState({
|
|
176
|
+
// _ariaId: generateUUID(),
|
|
177
|
+
// });
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
watch: {
|
|
181
|
+
__propsSymbol__() {
|
|
182
|
+
Object.assign(this.$data, this.getDerivedState(getOptionProps(this), this.$data));
|
|
183
|
+
},
|
|
184
|
+
'$data._inputValue'(val) {
|
|
185
|
+
this.$data._mirrorInputValue = val;
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
updated() {
|
|
189
|
+
this.$nextTick(() => {
|
|
190
|
+
if (isMultipleOrTags(this.$props)) {
|
|
191
|
+
const inputNode = this.getInputDOMNode();
|
|
192
|
+
const mirrorNode = this.getInputMirrorDOMNode();
|
|
193
|
+
if (inputNode && inputNode.value && mirrorNode) {
|
|
194
|
+
inputNode.style.width = '';
|
|
195
|
+
inputNode.style.width = `${mirrorNode.clientWidth + 10}px`;
|
|
196
|
+
} else if (inputNode) {
|
|
197
|
+
inputNode.style.width = '';
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
this.forcePopupAlign();
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
beforeDestroy() {
|
|
204
|
+
this.clearFocusTime();
|
|
205
|
+
this.clearBlurTime();
|
|
206
|
+
this.clearComboboxTime();
|
|
207
|
+
if (this.dropdownContainer) {
|
|
208
|
+
document.body.removeChild(this.dropdownContainer);
|
|
209
|
+
this.dropdownContainer = null;
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
methods: {
|
|
213
|
+
getDerivedState(nextProps, prevState) {
|
|
214
|
+
const optionsInfo = prevState._skipBuildOptionsInfo
|
|
215
|
+
? prevState._optionsInfo
|
|
216
|
+
: this.getOptionsInfoFromProps(nextProps, prevState);
|
|
217
|
+
|
|
218
|
+
const newState = {
|
|
219
|
+
_optionsInfo: optionsInfo,
|
|
220
|
+
_skipBuildOptionsInfo: false,
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
if ('open' in nextProps) {
|
|
224
|
+
newState._open = nextProps.open;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if ('value' in nextProps) {
|
|
228
|
+
const value = this.getValueFromProps(nextProps);
|
|
229
|
+
newState._value = value;
|
|
230
|
+
if (nextProps.combobox) {
|
|
231
|
+
newState._inputValue = this.getInputValueForCombobox(nextProps, optionsInfo);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return newState;
|
|
235
|
+
},
|
|
236
|
+
getOptionsFromChildren(children = [], options = []) {
|
|
237
|
+
children.forEach(child => {
|
|
238
|
+
if (!child.data || child.data.slot !== undefined) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (getSlotOptions(child).isSelectOptGroup) {
|
|
242
|
+
this.getOptionsFromChildren(child.componentOptions.children, options);
|
|
243
|
+
} else {
|
|
244
|
+
options.push(child);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return options;
|
|
248
|
+
},
|
|
249
|
+
getInputValueForCombobox(props, optionsInfo, useDefaultValue) {
|
|
250
|
+
let value = [];
|
|
251
|
+
if ('value' in props && !useDefaultValue) {
|
|
252
|
+
value = toArray(props.value);
|
|
253
|
+
}
|
|
254
|
+
if ('defaultValue' in props && useDefaultValue) {
|
|
255
|
+
value = toArray(props.defaultValue);
|
|
256
|
+
}
|
|
257
|
+
if (value.length) {
|
|
258
|
+
value = value[0];
|
|
259
|
+
} else {
|
|
260
|
+
return '';
|
|
261
|
+
}
|
|
262
|
+
let label = value;
|
|
263
|
+
if (props.labelInValue) {
|
|
264
|
+
label = value.label;
|
|
265
|
+
} else if (optionsInfo[getMapKey(value)]) {
|
|
266
|
+
label = optionsInfo[getMapKey(value)].label;
|
|
267
|
+
}
|
|
268
|
+
if (label === undefined) {
|
|
269
|
+
label = '';
|
|
270
|
+
}
|
|
271
|
+
return label;
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
getLabelFromOption(props, option) {
|
|
275
|
+
return getPropValue(option, props.optionLabelProp);
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
getOptionsInfoFromProps(props, preState) {
|
|
279
|
+
const options = this.getOptionsFromChildren(this.$props.children);
|
|
280
|
+
const optionsInfo = {};
|
|
281
|
+
options.forEach(option => {
|
|
282
|
+
const singleValue = getValuePropValue(option);
|
|
283
|
+
optionsInfo[getMapKey(singleValue)] = {
|
|
284
|
+
option,
|
|
285
|
+
value: singleValue,
|
|
286
|
+
label: this.getLabelFromOption(props, option),
|
|
287
|
+
title: getValue(option, 'title'),
|
|
288
|
+
disabled: getValue(option, 'disabled'),
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
if (preState) {
|
|
292
|
+
// keep option info in pre state value.
|
|
293
|
+
const oldOptionsInfo = preState._optionsInfo;
|
|
294
|
+
const value = preState._value;
|
|
295
|
+
if (value) {
|
|
296
|
+
value.forEach(v => {
|
|
297
|
+
const key = getMapKey(v);
|
|
298
|
+
if (!optionsInfo[key] && oldOptionsInfo[key] !== undefined) {
|
|
299
|
+
optionsInfo[key] = oldOptionsInfo[key];
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return optionsInfo;
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
getValueFromProps(props, useDefaultValue) {
|
|
308
|
+
let value = [];
|
|
309
|
+
if ('value' in props && !useDefaultValue) {
|
|
310
|
+
value = toArray(props.value);
|
|
311
|
+
}
|
|
312
|
+
if ('defaultValue' in props && useDefaultValue) {
|
|
313
|
+
value = toArray(props.defaultValue);
|
|
314
|
+
}
|
|
315
|
+
if (props.labelInValue) {
|
|
316
|
+
value = value.map(v => {
|
|
317
|
+
return v.key;
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
return value;
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
onInputChange(e) {
|
|
324
|
+
const { value: val, composing } = e.target;
|
|
325
|
+
const { _inputValue = '' } = this.$data;
|
|
326
|
+
if (e.isComposing || composing || _inputValue === val) {
|
|
327
|
+
this.setState({
|
|
328
|
+
_mirrorInputValue: val,
|
|
329
|
+
});
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const { tokenSeparators } = this.$props;
|
|
333
|
+
if (
|
|
334
|
+
isMultipleOrTags(this.$props) &&
|
|
335
|
+
tokenSeparators.length &&
|
|
336
|
+
includesSeparators(val, tokenSeparators)
|
|
337
|
+
) {
|
|
338
|
+
const nextValue = this.getValueByInput(val);
|
|
339
|
+
if (nextValue !== undefined) {
|
|
340
|
+
this.fireChange(nextValue);
|
|
341
|
+
}
|
|
342
|
+
this.setOpenState(false, { needFocus: true });
|
|
343
|
+
this.setInputValue('', false);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
this.setInputValue(val);
|
|
347
|
+
this.setState({
|
|
348
|
+
_open: true,
|
|
349
|
+
});
|
|
350
|
+
if (isCombobox(this.$props)) {
|
|
351
|
+
this.fireChange([val]);
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
onDropdownVisibleChange(open) {
|
|
356
|
+
if (open && !this._focused) {
|
|
357
|
+
this.clearBlurTime();
|
|
358
|
+
this.timeoutFocus();
|
|
359
|
+
this._focused = true;
|
|
360
|
+
this.updateFocusClassName();
|
|
361
|
+
}
|
|
362
|
+
this.setOpenState(open);
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
// combobox ignore
|
|
366
|
+
onKeyDown(event) {
|
|
367
|
+
const { _open: open } = this.$data;
|
|
368
|
+
const { disabled } = this.$props;
|
|
369
|
+
if (disabled) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const keyCode = event.keyCode;
|
|
373
|
+
if (open && !this.getInputDOMNode()) {
|
|
374
|
+
this.onInputKeydown(event);
|
|
375
|
+
} else if (keyCode === KeyCode.ENTER || keyCode === KeyCode.DOWN) {
|
|
376
|
+
// vue state是同步更新,onKeyDown在onMenuSelect后会再次调用,单选时不在调用setOpenState
|
|
377
|
+
// https://github.com/vueComponent/ant-design-vue/issues/1142
|
|
378
|
+
if (keyCode === KeyCode.ENTER && !isMultipleOrTags(this.$props)) {
|
|
379
|
+
this.maybeFocus(true);
|
|
380
|
+
} else if (!open) {
|
|
381
|
+
this.setOpenState(true);
|
|
382
|
+
}
|
|
383
|
+
event.preventDefault();
|
|
384
|
+
} else if (keyCode === KeyCode.SPACE) {
|
|
385
|
+
// Not block space if popup is shown
|
|
386
|
+
if (!open) {
|
|
387
|
+
this.setOpenState(true);
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
onInputKeydown(event) {
|
|
394
|
+
const { disabled, combobox, defaultActiveFirstOption } = this.$props;
|
|
395
|
+
if (disabled) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const state = this.$data;
|
|
399
|
+
const isRealOpen = this.getRealOpenState(state);
|
|
400
|
+
const keyCode = event.keyCode;
|
|
401
|
+
if (isMultipleOrTags(this.$props) && !event.target.value && keyCode === KeyCode.BACKSPACE) {
|
|
402
|
+
event.preventDefault();
|
|
403
|
+
const { _value: value } = state;
|
|
404
|
+
if (value.length) {
|
|
405
|
+
this.removeSelected(value[value.length - 1]);
|
|
406
|
+
}
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
if (keyCode === KeyCode.DOWN) {
|
|
410
|
+
if (!state._open) {
|
|
411
|
+
this.openIfHasChildren();
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
event.stopPropagation();
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
} else if (keyCode === KeyCode.ENTER && state._open) {
|
|
417
|
+
// Aviod trigger form submit when select item
|
|
418
|
+
// https://github.com/ant-design/ant-design/issues/10861
|
|
419
|
+
// https://github.com/ant-design/ant-design/issues/14544
|
|
420
|
+
if (isRealOpen || !combobox) {
|
|
421
|
+
event.preventDefault();
|
|
422
|
+
}
|
|
423
|
+
// Hard close popup to avoid lock of non option in combobox mode
|
|
424
|
+
if (isRealOpen && combobox && defaultActiveFirstOption === false) {
|
|
425
|
+
this.comboboxTimer = setTimeout(() => {
|
|
426
|
+
this.setOpenState(false);
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
} else if (keyCode === KeyCode.ESC) {
|
|
430
|
+
if (state._open) {
|
|
431
|
+
this.setOpenState(false);
|
|
432
|
+
event.preventDefault();
|
|
433
|
+
event.stopPropagation();
|
|
434
|
+
}
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
if (isRealOpen && this.selectTriggerRef) {
|
|
439
|
+
const menu = this.selectTriggerRef.getInnerMenu();
|
|
440
|
+
if (menu && menu.onKeyDown(event, this.handleBackfill)) {
|
|
441
|
+
event.preventDefault();
|
|
442
|
+
event.stopPropagation();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
|
|
447
|
+
onMenuSelect({ item }) {
|
|
448
|
+
if (!item) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
let value = this.$data._value;
|
|
452
|
+
const props = this.$props;
|
|
453
|
+
const selectedValue = getValuePropValue(item);
|
|
454
|
+
const lastValue = value[value.length - 1];
|
|
455
|
+
let skipTrigger = false;
|
|
456
|
+
|
|
457
|
+
if (isMultipleOrTags(props)) {
|
|
458
|
+
if (findIndexInValueBySingleValue(value, selectedValue) !== -1) {
|
|
459
|
+
skipTrigger = true;
|
|
460
|
+
} else {
|
|
461
|
+
value = value.concat([selectedValue]);
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
if (
|
|
465
|
+
!isCombobox(props) &&
|
|
466
|
+
lastValue !== undefined &&
|
|
467
|
+
lastValue === selectedValue &&
|
|
468
|
+
selectedValue !== this.$data._backfillValue
|
|
469
|
+
) {
|
|
470
|
+
this.setOpenState(false, { needFocus: true, fireSearch: false });
|
|
471
|
+
skipTrigger = true;
|
|
472
|
+
} else {
|
|
473
|
+
value = [selectedValue];
|
|
474
|
+
this.setOpenState(false, { needFocus: true, fireSearch: false });
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (!skipTrigger) {
|
|
478
|
+
this.fireChange(value);
|
|
479
|
+
}
|
|
480
|
+
if (!skipTrigger) {
|
|
481
|
+
this.fireSelect(selectedValue);
|
|
482
|
+
const inputValue = isCombobox(props) ? getPropValue(item, props.optionLabelProp) : '';
|
|
483
|
+
|
|
484
|
+
if (props.autoClearSearchValue) {
|
|
485
|
+
this.setInputValue(inputValue, false);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
|
|
490
|
+
onMenuDeselect({ item, domEvent }) {
|
|
491
|
+
if (domEvent.type === 'keydown' && domEvent.keyCode === KeyCode.ENTER) {
|
|
492
|
+
const menuItemDomNode = item.$el;
|
|
493
|
+
// https://github.com/ant-design/ant-design/issues/20465#issuecomment-569033796
|
|
494
|
+
if (!isHidden(menuItemDomNode)) {
|
|
495
|
+
this.removeSelected(getValuePropValue(item));
|
|
496
|
+
}
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (domEvent.type === 'click') {
|
|
500
|
+
this.removeSelected(getValuePropValue(item));
|
|
501
|
+
}
|
|
502
|
+
if (this.autoClearSearchValue) {
|
|
503
|
+
this.setInputValue('');
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
|
|
507
|
+
onArrowClick(e) {
|
|
508
|
+
e.stopPropagation();
|
|
509
|
+
e.preventDefault();
|
|
510
|
+
this.clearBlurTime();
|
|
511
|
+
if (!this.disabled) {
|
|
512
|
+
this.setOpenState(!this.$data._open, { needFocus: !this.$data._open });
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
|
|
516
|
+
onPlaceholderClick() {
|
|
517
|
+
if (this.getInputDOMNode() && this.getInputDOMNode()) {
|
|
518
|
+
this.getInputDOMNode().focus();
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
|
|
522
|
+
onPopupFocus() {
|
|
523
|
+
// fix ie scrollbar, focus element again
|
|
524
|
+
this.maybeFocus(true, true);
|
|
525
|
+
},
|
|
526
|
+
|
|
527
|
+
onClearSelection(event) {
|
|
528
|
+
const props = this.$props;
|
|
529
|
+
const state = this.$data;
|
|
530
|
+
if (props.disabled) {
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
const { _inputValue: inputValue, _value: value } = state;
|
|
534
|
+
event.stopPropagation();
|
|
535
|
+
if (inputValue || value.length) {
|
|
536
|
+
if (value.length) {
|
|
537
|
+
this.fireChange([]);
|
|
538
|
+
}
|
|
539
|
+
this.setOpenState(false, { needFocus: true });
|
|
540
|
+
if (inputValue) {
|
|
541
|
+
this.setInputValue('');
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
|
|
546
|
+
onChoiceAnimationLeave() {
|
|
547
|
+
this.forcePopupAlign();
|
|
548
|
+
},
|
|
549
|
+
|
|
550
|
+
getOptionInfoBySingleValue(value, optionsInfo) {
|
|
551
|
+
let info;
|
|
552
|
+
optionsInfo = optionsInfo || this.$data._optionsInfo;
|
|
553
|
+
if (optionsInfo[getMapKey(value)]) {
|
|
554
|
+
info = optionsInfo[getMapKey(value)];
|
|
555
|
+
}
|
|
556
|
+
if (info) {
|
|
557
|
+
return info;
|
|
558
|
+
}
|
|
559
|
+
let defaultLabel = value;
|
|
560
|
+
if (this.$props.labelInValue) {
|
|
561
|
+
const valueLabel = getLabelFromPropsValue(this.$props.value, value);
|
|
562
|
+
const defaultValueLabel = getLabelFromPropsValue(this.$props.defaultValue, value);
|
|
563
|
+
if (valueLabel !== undefined) {
|
|
564
|
+
defaultLabel = valueLabel;
|
|
565
|
+
} else if (defaultValueLabel !== undefined) {
|
|
566
|
+
defaultLabel = defaultValueLabel;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
const defaultInfo = {
|
|
570
|
+
option: (
|
|
571
|
+
<Option value={value} key={value}>
|
|
572
|
+
{value}
|
|
573
|
+
</Option>
|
|
574
|
+
),
|
|
575
|
+
value,
|
|
576
|
+
label: defaultLabel,
|
|
577
|
+
};
|
|
578
|
+
return defaultInfo;
|
|
579
|
+
},
|
|
580
|
+
|
|
581
|
+
getOptionBySingleValue(value) {
|
|
582
|
+
const { option } = this.getOptionInfoBySingleValue(value);
|
|
583
|
+
return option;
|
|
584
|
+
},
|
|
585
|
+
|
|
586
|
+
getOptionsBySingleValue(values) {
|
|
587
|
+
return values.map(value => {
|
|
588
|
+
return this.getOptionBySingleValue(value);
|
|
589
|
+
});
|
|
590
|
+
},
|
|
591
|
+
|
|
592
|
+
getValueByLabel(label) {
|
|
593
|
+
if (label === undefined) {
|
|
594
|
+
return null;
|
|
595
|
+
}
|
|
596
|
+
let value = null;
|
|
597
|
+
Object.keys(this.$data._optionsInfo).forEach(key => {
|
|
598
|
+
const info = this.$data._optionsInfo[key];
|
|
599
|
+
const { disabled } = info;
|
|
600
|
+
if (disabled) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
const oldLable = toArray(info.label);
|
|
604
|
+
if (oldLable && oldLable.join('') === label) {
|
|
605
|
+
value = info.value;
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
return value;
|
|
609
|
+
},
|
|
610
|
+
|
|
611
|
+
getVLBySingleValue(value) {
|
|
612
|
+
if (this.$props.labelInValue) {
|
|
613
|
+
return {
|
|
614
|
+
key: value,
|
|
615
|
+
label: this.getLabelBySingleValue(value),
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
return value;
|
|
619
|
+
},
|
|
620
|
+
|
|
621
|
+
getVLForOnChange(vlsS) {
|
|
622
|
+
let vls = vlsS;
|
|
623
|
+
if (vls !== undefined) {
|
|
624
|
+
if (!this.labelInValue) {
|
|
625
|
+
vls = vls.map(v => v);
|
|
626
|
+
} else {
|
|
627
|
+
vls = vls.map(vl => ({
|
|
628
|
+
key: vl,
|
|
629
|
+
label: this.getLabelBySingleValue(vl),
|
|
630
|
+
}));
|
|
631
|
+
}
|
|
632
|
+
return isMultipleOrTags(this.$props) ? vls : vls[0];
|
|
633
|
+
}
|
|
634
|
+
return vls;
|
|
635
|
+
},
|
|
636
|
+
|
|
637
|
+
getLabelBySingleValue(value, optionsInfo) {
|
|
638
|
+
const { label } = this.getOptionInfoBySingleValue(value, optionsInfo);
|
|
639
|
+
return label;
|
|
640
|
+
},
|
|
641
|
+
|
|
642
|
+
getDropdownContainer() {
|
|
643
|
+
if (!this.dropdownContainer) {
|
|
644
|
+
this.dropdownContainer = document.createElement('div');
|
|
645
|
+
document.body.appendChild(this.dropdownContainer);
|
|
646
|
+
}
|
|
647
|
+
return this.dropdownContainer;
|
|
648
|
+
},
|
|
649
|
+
|
|
650
|
+
getPlaceholderElement() {
|
|
651
|
+
const { $props: props, $data: state } = this;
|
|
652
|
+
let hidden = false;
|
|
653
|
+
if (state._mirrorInputValue) {
|
|
654
|
+
hidden = true;
|
|
655
|
+
}
|
|
656
|
+
const value = state._value;
|
|
657
|
+
if (value.length) {
|
|
658
|
+
hidden = true;
|
|
659
|
+
}
|
|
660
|
+
if (
|
|
661
|
+
!state._mirrorInputValue &&
|
|
662
|
+
isCombobox(props) &&
|
|
663
|
+
value.length === 1 &&
|
|
664
|
+
state._value &&
|
|
665
|
+
!state._value[0]
|
|
666
|
+
) {
|
|
667
|
+
hidden = false;
|
|
668
|
+
}
|
|
669
|
+
const placeholder = props.placeholder;
|
|
670
|
+
if (placeholder) {
|
|
671
|
+
const p = {
|
|
672
|
+
on: {
|
|
673
|
+
mousedown: preventDefaultEvent,
|
|
674
|
+
click: this.onPlaceholderClick,
|
|
675
|
+
},
|
|
676
|
+
attrs: UNSELECTABLE_ATTRIBUTE,
|
|
677
|
+
style: {
|
|
678
|
+
display: hidden ? 'none' : 'block',
|
|
679
|
+
...UNSELECTABLE_STYLE,
|
|
680
|
+
},
|
|
681
|
+
class: `${props.prefixCls}-selection__placeholder`,
|
|
682
|
+
};
|
|
683
|
+
return <div {...p}>{placeholder}</div>;
|
|
684
|
+
}
|
|
685
|
+
return null;
|
|
686
|
+
},
|
|
687
|
+
inputClick(e) {
|
|
688
|
+
if (this.$data._open) {
|
|
689
|
+
this.clearBlurTime();
|
|
690
|
+
e.stopPropagation();
|
|
691
|
+
} else {
|
|
692
|
+
this._focused = false;
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
inputBlur(e) {
|
|
696
|
+
const target = e.relatedTarget || document.activeElement;
|
|
697
|
+
|
|
698
|
+
// https://github.com/vueComponent/ant-design-vue/issues/999
|
|
699
|
+
// https://github.com/vueComponent/ant-design-vue/issues/1223
|
|
700
|
+
if (
|
|
701
|
+
(isIE || isEdge) &&
|
|
702
|
+
(e.relatedTarget === this.$refs.arrow ||
|
|
703
|
+
(target &&
|
|
704
|
+
this.selectTriggerRef &&
|
|
705
|
+
this.selectTriggerRef.getInnerMenu() &&
|
|
706
|
+
this.selectTriggerRef.getInnerMenu().$el === target) ||
|
|
707
|
+
contains(e.target, target))
|
|
708
|
+
) {
|
|
709
|
+
e.target.focus();
|
|
710
|
+
e.preventDefault();
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
this.clearBlurTime();
|
|
714
|
+
if (this.disabled) {
|
|
715
|
+
e.preventDefault();
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
this.blurTimer = setTimeout(() => {
|
|
719
|
+
this._focused = false;
|
|
720
|
+
this.updateFocusClassName();
|
|
721
|
+
const props = this.$props;
|
|
722
|
+
let { _value: value } = this.$data;
|
|
723
|
+
const { _inputValue: inputValue } = this.$data;
|
|
724
|
+
if (
|
|
725
|
+
isSingleMode(props) &&
|
|
726
|
+
props.showSearch &&
|
|
727
|
+
inputValue &&
|
|
728
|
+
props.defaultActiveFirstOption
|
|
729
|
+
) {
|
|
730
|
+
const options = this._options || [];
|
|
731
|
+
if (options.length) {
|
|
732
|
+
const firstOption = findFirstMenuItem(options);
|
|
733
|
+
if (firstOption) {
|
|
734
|
+
value = [getValuePropValue(firstOption)];
|
|
735
|
+
this.fireChange(value);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
} else if (isMultipleOrTags(props) && inputValue) {
|
|
739
|
+
if (this._mouseDown) {
|
|
740
|
+
// need update dropmenu when not blur
|
|
741
|
+
this.setInputValue('');
|
|
742
|
+
} else {
|
|
743
|
+
// why not use setState?
|
|
744
|
+
this.$data._inputValue = '';
|
|
745
|
+
if (this.getInputDOMNode && this.getInputDOMNode()) {
|
|
746
|
+
this.getInputDOMNode().value = '';
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
const tmpValue = this.getValueByInput(inputValue);
|
|
750
|
+
if (tmpValue !== undefined) {
|
|
751
|
+
value = tmpValue;
|
|
752
|
+
this.fireChange(value);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
// if click the rest space of Select in multiple mode
|
|
756
|
+
if (isMultipleOrTags(props) && this._mouseDown) {
|
|
757
|
+
this.maybeFocus(true, true);
|
|
758
|
+
this._mouseDown = false;
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
this.setOpenState(false);
|
|
762
|
+
this.$emit('blur', this.getVLForOnChange(value));
|
|
763
|
+
}, 200);
|
|
764
|
+
},
|
|
765
|
+
inputFocus(e) {
|
|
766
|
+
if (this.$props.disabled) {
|
|
767
|
+
e.preventDefault();
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
this.clearBlurTime();
|
|
771
|
+
|
|
772
|
+
// In IE11, onOuterFocus will be trigger twice when focus input
|
|
773
|
+
// First one: e.target is div
|
|
774
|
+
// Second one: e.target is input
|
|
775
|
+
// other browser only trigger second one
|
|
776
|
+
// https://github.com/ant-design/ant-design/issues/15942
|
|
777
|
+
// Here we ignore the first one when e.target is div
|
|
778
|
+
const inputNode = this.getInputDOMNode();
|
|
779
|
+
if (inputNode && e.target === this.rootRef) {
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
if (!isMultipleOrTagsOrCombobox(this.$props) && e.target === inputNode) {
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
if (this._focused) {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
this._focused = true;
|
|
789
|
+
this.updateFocusClassName();
|
|
790
|
+
// only effect multiple or tag mode
|
|
791
|
+
if (!isMultipleOrTags(this.$props) || !this._mouseDown) {
|
|
792
|
+
this.timeoutFocus();
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
_getInputElement() {
|
|
796
|
+
const props = this.$props;
|
|
797
|
+
const { _inputValue: inputValue, _mirrorInputValue } = this.$data;
|
|
798
|
+
const attrs = getAttrs(this);
|
|
799
|
+
const defaultInput = <input id={attrs.id} autoComplete="off" />;
|
|
800
|
+
|
|
801
|
+
const inputElement = props.getInputElement ? props.getInputElement() : defaultInput;
|
|
802
|
+
const inputCls = classnames(getClass(inputElement), {
|
|
803
|
+
[`${props.prefixCls}-search__field`]: true,
|
|
804
|
+
});
|
|
805
|
+
const inputEvents = getEvents(inputElement);
|
|
806
|
+
// https://github.com/ant-design/ant-design/issues/4992#issuecomment-281542159
|
|
807
|
+
// Add space to the end of the inputValue as the width measurement tolerance
|
|
808
|
+
inputElement.data = inputElement.data || {};
|
|
809
|
+
return (
|
|
810
|
+
<div class={`${props.prefixCls}-search__field__wrap`} onClick={this.inputClick}>
|
|
811
|
+
{cloneElement(inputElement, {
|
|
812
|
+
props: {
|
|
813
|
+
disabled: props.disabled,
|
|
814
|
+
value: inputValue,
|
|
815
|
+
},
|
|
816
|
+
attrs: {
|
|
817
|
+
...(inputElement.data.attrs || {}),
|
|
818
|
+
disabled: props.disabled,
|
|
819
|
+
value: inputValue,
|
|
820
|
+
},
|
|
821
|
+
domProps: {
|
|
822
|
+
value: inputValue,
|
|
823
|
+
},
|
|
824
|
+
class: inputCls,
|
|
825
|
+
directives: [
|
|
826
|
+
{
|
|
827
|
+
name: 'ant-ref',
|
|
828
|
+
value: this.saveInputRef,
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: 'ant-input',
|
|
832
|
+
},
|
|
833
|
+
],
|
|
834
|
+
on: {
|
|
835
|
+
input: this.onInputChange,
|
|
836
|
+
keydown: chaining(
|
|
837
|
+
this.onInputKeydown,
|
|
838
|
+
inputEvents.keydown,
|
|
839
|
+
getListeners(this).inputKeydown,
|
|
840
|
+
),
|
|
841
|
+
focus: chaining(this.inputFocus, inputEvents.focus),
|
|
842
|
+
blur: chaining(this.inputBlur, inputEvents.blur),
|
|
843
|
+
},
|
|
844
|
+
})}
|
|
845
|
+
<span
|
|
846
|
+
{...{
|
|
847
|
+
directives: [
|
|
848
|
+
{
|
|
849
|
+
name: 'ant-ref',
|
|
850
|
+
value: this.saveInputMirrorRef,
|
|
851
|
+
},
|
|
852
|
+
],
|
|
853
|
+
}}
|
|
854
|
+
// ref='inputMirrorRef'
|
|
855
|
+
class={`${props.prefixCls}-search__field__mirror`}
|
|
856
|
+
>
|
|
857
|
+
{_mirrorInputValue}
|
|
858
|
+
</span>
|
|
859
|
+
</div>
|
|
860
|
+
);
|
|
861
|
+
},
|
|
862
|
+
|
|
863
|
+
getInputDOMNode() {
|
|
864
|
+
return this.topCtrlRef
|
|
865
|
+
? this.topCtrlRef.querySelector('input,textarea,div[contentEditable]')
|
|
866
|
+
: this.inputRef;
|
|
867
|
+
},
|
|
868
|
+
|
|
869
|
+
getInputMirrorDOMNode() {
|
|
870
|
+
return this.inputMirrorRef;
|
|
871
|
+
},
|
|
872
|
+
|
|
873
|
+
getPopupDOMNode() {
|
|
874
|
+
if (this.selectTriggerRef) {
|
|
875
|
+
return this.selectTriggerRef.getPopupDOMNode();
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
|
|
879
|
+
getPopupMenuComponent() {
|
|
880
|
+
if (this.selectTriggerRef) {
|
|
881
|
+
return this.selectTriggerRef.getInnerMenu();
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
|
|
885
|
+
setOpenState(open, config = {}) {
|
|
886
|
+
const { $props: props, $data: state } = this;
|
|
887
|
+
const { needFocus, fireSearch } = config;
|
|
888
|
+
if (state._open === open) {
|
|
889
|
+
this.maybeFocus(open, !!needFocus);
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
this.__emit('dropdownVisibleChange', open);
|
|
893
|
+
const nextState = {
|
|
894
|
+
_open: open,
|
|
895
|
+
_backfillValue: '',
|
|
896
|
+
};
|
|
897
|
+
// clear search input value when open is false in singleMode.
|
|
898
|
+
if (!open && isSingleMode(props) && props.showSearch) {
|
|
899
|
+
this.setInputValue('', fireSearch);
|
|
900
|
+
}
|
|
901
|
+
if (!open) {
|
|
902
|
+
this.maybeFocus(open, !!needFocus);
|
|
903
|
+
}
|
|
904
|
+
this.setState(nextState, () => {
|
|
905
|
+
if (open) {
|
|
906
|
+
this.maybeFocus(open, !!needFocus);
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
},
|
|
910
|
+
|
|
911
|
+
setInputValue(inputValue, fireSearch = true) {
|
|
912
|
+
if (inputValue !== this.$data._inputValue) {
|
|
913
|
+
this.setState(
|
|
914
|
+
{
|
|
915
|
+
_inputValue: inputValue,
|
|
916
|
+
},
|
|
917
|
+
this.forcePopupAlign,
|
|
918
|
+
);
|
|
919
|
+
if (fireSearch) {
|
|
920
|
+
this.$emit('search', inputValue);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
getValueByInput(str) {
|
|
925
|
+
const { multiple, tokenSeparators } = this.$props;
|
|
926
|
+
let nextValue = this.$data._value;
|
|
927
|
+
let hasNewValue = false;
|
|
928
|
+
splitBySeparators(str, tokenSeparators).forEach(label => {
|
|
929
|
+
const selectedValue = [label];
|
|
930
|
+
if (multiple) {
|
|
931
|
+
const value = this.getValueByLabel(label);
|
|
932
|
+
if (value && findIndexInValueBySingleValue(nextValue, value) === -1) {
|
|
933
|
+
nextValue = nextValue.concat(value);
|
|
934
|
+
hasNewValue = true;
|
|
935
|
+
this.fireSelect(value);
|
|
936
|
+
}
|
|
937
|
+
} else if (findIndexInValueBySingleValue(nextValue, label) === -1) {
|
|
938
|
+
nextValue = nextValue.concat(selectedValue);
|
|
939
|
+
hasNewValue = true;
|
|
940
|
+
this.fireSelect(label);
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
return hasNewValue ? nextValue : undefined;
|
|
944
|
+
},
|
|
945
|
+
|
|
946
|
+
getRealOpenState(state) {
|
|
947
|
+
const { open: _open } = this.$props;
|
|
948
|
+
if (typeof _open === 'boolean') {
|
|
949
|
+
return _open;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
let open = (state || this.$data)._open;
|
|
953
|
+
const options = this._options || [];
|
|
954
|
+
if (isMultipleOrTagsOrCombobox(this.$props) || !this.$props.showSearch) {
|
|
955
|
+
if (open && !options.length) {
|
|
956
|
+
open = false;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
return open;
|
|
960
|
+
},
|
|
961
|
+
|
|
962
|
+
focus() {
|
|
963
|
+
if (isSingleMode(this.$props) && this.selectionRef) {
|
|
964
|
+
this.selectionRef.focus();
|
|
965
|
+
} else if (this.getInputDOMNode()) {
|
|
966
|
+
this.getInputDOMNode().focus();
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
|
|
970
|
+
blur() {
|
|
971
|
+
if (isSingleMode(this.$props) && this.selectionRef) {
|
|
972
|
+
this.selectionRef.blur();
|
|
973
|
+
} else if (this.getInputDOMNode()) {
|
|
974
|
+
this.getInputDOMNode().blur();
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
markMouseDown() {
|
|
978
|
+
this._mouseDown = true;
|
|
979
|
+
},
|
|
980
|
+
|
|
981
|
+
markMouseLeave() {
|
|
982
|
+
this._mouseDown = false;
|
|
983
|
+
},
|
|
984
|
+
|
|
985
|
+
handleBackfill(item) {
|
|
986
|
+
if (!this.backfill || !(isSingleMode(this.$props) || isCombobox(this.$props))) {
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
const key = getValuePropValue(item);
|
|
991
|
+
|
|
992
|
+
if (isCombobox(this.$props)) {
|
|
993
|
+
this.setInputValue(key, false);
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
this.setState({
|
|
997
|
+
_value: [key],
|
|
998
|
+
_backfillValue: key,
|
|
999
|
+
});
|
|
1000
|
+
},
|
|
1001
|
+
|
|
1002
|
+
_filterOption(input, child, defaultFilter = defaultFilterFn) {
|
|
1003
|
+
const { _value: value, _backfillValue: backfillValue } = this.$data;
|
|
1004
|
+
const lastValue = value[value.length - 1];
|
|
1005
|
+
if (!input || (lastValue && lastValue === backfillValue)) {
|
|
1006
|
+
return true;
|
|
1007
|
+
}
|
|
1008
|
+
let filterFn = this.$props.filterOption;
|
|
1009
|
+
if (hasProp(this, 'filterOption')) {
|
|
1010
|
+
if (filterFn === true) {
|
|
1011
|
+
filterFn = defaultFilter.bind(this);
|
|
1012
|
+
}
|
|
1013
|
+
} else {
|
|
1014
|
+
filterFn = defaultFilter.bind(this);
|
|
1015
|
+
}
|
|
1016
|
+
if (!filterFn) {
|
|
1017
|
+
return true;
|
|
1018
|
+
} else if (typeof filterFn === 'function') {
|
|
1019
|
+
return filterFn.call(this, input, child);
|
|
1020
|
+
} else if (getValue(child, 'disabled')) {
|
|
1021
|
+
return false;
|
|
1022
|
+
}
|
|
1023
|
+
return true;
|
|
1024
|
+
},
|
|
1025
|
+
|
|
1026
|
+
timeoutFocus() {
|
|
1027
|
+
if (this.focusTimer) {
|
|
1028
|
+
this.clearFocusTime();
|
|
1029
|
+
}
|
|
1030
|
+
this.focusTimer = window.setTimeout(() => {
|
|
1031
|
+
// this._focused = true
|
|
1032
|
+
// this.updateFocusClassName()
|
|
1033
|
+
this.$emit('focus');
|
|
1034
|
+
}, 10);
|
|
1035
|
+
},
|
|
1036
|
+
|
|
1037
|
+
clearFocusTime() {
|
|
1038
|
+
if (this.focusTimer) {
|
|
1039
|
+
clearTimeout(this.focusTimer);
|
|
1040
|
+
this.focusTimer = null;
|
|
1041
|
+
}
|
|
1042
|
+
},
|
|
1043
|
+
|
|
1044
|
+
clearBlurTime() {
|
|
1045
|
+
if (this.blurTimer) {
|
|
1046
|
+
clearTimeout(this.blurTimer);
|
|
1047
|
+
this.blurTimer = null;
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
1050
|
+
|
|
1051
|
+
clearComboboxTime() {
|
|
1052
|
+
if (this.comboboxTimer) {
|
|
1053
|
+
clearTimeout(this.comboboxTimer);
|
|
1054
|
+
this.comboboxTimer = null;
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
|
|
1058
|
+
updateFocusClassName() {
|
|
1059
|
+
const { rootRef, prefixCls } = this;
|
|
1060
|
+
// avoid setState and its side effect
|
|
1061
|
+
if (this._focused) {
|
|
1062
|
+
classes(rootRef).add(`${prefixCls}-focused`);
|
|
1063
|
+
} else {
|
|
1064
|
+
classes(rootRef).remove(`${prefixCls}-focused`);
|
|
1065
|
+
}
|
|
1066
|
+
},
|
|
1067
|
+
|
|
1068
|
+
maybeFocus(open, needFocus) {
|
|
1069
|
+
if (needFocus || open) {
|
|
1070
|
+
const input = this.getInputDOMNode();
|
|
1071
|
+
const { activeElement } = document;
|
|
1072
|
+
if (input && (open || isMultipleOrTagsOrCombobox(this.$props))) {
|
|
1073
|
+
if (activeElement !== input) {
|
|
1074
|
+
input.focus();
|
|
1075
|
+
this._focused = true;
|
|
1076
|
+
}
|
|
1077
|
+
} else if (activeElement !== this.selectionRef && this.selectionRef) {
|
|
1078
|
+
this.selectionRef.focus();
|
|
1079
|
+
this._focused = true;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
|
|
1084
|
+
removeSelected(selectedKey, e) {
|
|
1085
|
+
const props = this.$props;
|
|
1086
|
+
if (props.disabled || this.isChildDisabled(selectedKey)) {
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
// Do not trigger Trigger popup
|
|
1090
|
+
if (e && e.stopPropagation) {
|
|
1091
|
+
e.stopPropagation();
|
|
1092
|
+
}
|
|
1093
|
+
const oldValue = this.$data._value;
|
|
1094
|
+
const value = oldValue.filter(singleValue => {
|
|
1095
|
+
return singleValue !== selectedKey;
|
|
1096
|
+
});
|
|
1097
|
+
const canMultiple = isMultipleOrTags(props);
|
|
1098
|
+
|
|
1099
|
+
if (canMultiple) {
|
|
1100
|
+
let event = selectedKey;
|
|
1101
|
+
if (props.labelInValue) {
|
|
1102
|
+
event = {
|
|
1103
|
+
key: selectedKey,
|
|
1104
|
+
label: this.getLabelBySingleValue(selectedKey),
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
this.$emit('deselect', event, this.getOptionBySingleValue(selectedKey));
|
|
1108
|
+
}
|
|
1109
|
+
this.fireChange(value);
|
|
1110
|
+
},
|
|
1111
|
+
|
|
1112
|
+
openIfHasChildren() {
|
|
1113
|
+
const { $props } = this;
|
|
1114
|
+
if (($props.children && $props.children.length) || isSingleMode($props)) {
|
|
1115
|
+
this.setOpenState(true);
|
|
1116
|
+
}
|
|
1117
|
+
},
|
|
1118
|
+
fireSelect(value) {
|
|
1119
|
+
this.$emit('select', this.getVLBySingleValue(value), this.getOptionBySingleValue(value));
|
|
1120
|
+
},
|
|
1121
|
+
fireChange(value) {
|
|
1122
|
+
if (!hasProp(this, 'value')) {
|
|
1123
|
+
this.setState(
|
|
1124
|
+
{
|
|
1125
|
+
_value: value,
|
|
1126
|
+
},
|
|
1127
|
+
this.forcePopupAlign,
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
1130
|
+
const vls = this.getVLForOnChange(value);
|
|
1131
|
+
const options = this.getOptionsBySingleValue(value);
|
|
1132
|
+
this._valueOptions = options;
|
|
1133
|
+
this.$emit('change', vls, isMultipleOrTags(this.$props) ? options : options[0]);
|
|
1134
|
+
},
|
|
1135
|
+
|
|
1136
|
+
isChildDisabled(key) {
|
|
1137
|
+
return (this.$props.children || []).some(child => {
|
|
1138
|
+
const childValue = getValuePropValue(child);
|
|
1139
|
+
return childValue === key && getValue(child, 'disabled');
|
|
1140
|
+
});
|
|
1141
|
+
},
|
|
1142
|
+
forcePopupAlign() {
|
|
1143
|
+
if (!this.$data._open) {
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
if (this.selectTriggerRef && this.selectTriggerRef.triggerRef) {
|
|
1147
|
+
this.selectTriggerRef.triggerRef.forcePopupAlign();
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
renderFilterOptions() {
|
|
1151
|
+
const { _inputValue: inputValue } = this.$data;
|
|
1152
|
+
const { children, tags, notFoundContent } = this.$props;
|
|
1153
|
+
const menuItems = [];
|
|
1154
|
+
const childrenKeys = [];
|
|
1155
|
+
let empty = false;
|
|
1156
|
+
let options = this.renderFilterOptionsFromChildren(children, childrenKeys, menuItems);
|
|
1157
|
+
if (tags) {
|
|
1158
|
+
// tags value must be string
|
|
1159
|
+
let value = this.$data._value;
|
|
1160
|
+
value = value.filter(singleValue => {
|
|
1161
|
+
return (
|
|
1162
|
+
childrenKeys.indexOf(singleValue) === -1 &&
|
|
1163
|
+
(!inputValue || String(singleValue).indexOf(String(inputValue)) > -1)
|
|
1164
|
+
);
|
|
1165
|
+
});
|
|
1166
|
+
|
|
1167
|
+
// sort by length
|
|
1168
|
+
value.sort((val1, val2) => {
|
|
1169
|
+
return val1.length - val2.length;
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
value.forEach(singleValue => {
|
|
1173
|
+
const key = singleValue;
|
|
1174
|
+
const attrs = {
|
|
1175
|
+
...UNSELECTABLE_ATTRIBUTE,
|
|
1176
|
+
role: 'option',
|
|
1177
|
+
};
|
|
1178
|
+
const menuItem = (
|
|
1179
|
+
<MenuItem style={UNSELECTABLE_STYLE} {...{ attrs }} value={key} key={key}>
|
|
1180
|
+
{key}
|
|
1181
|
+
</MenuItem>
|
|
1182
|
+
);
|
|
1183
|
+
options.push(menuItem);
|
|
1184
|
+
menuItems.push(menuItem);
|
|
1185
|
+
});
|
|
1186
|
+
// ref: https://github.com/ant-design/ant-design/issues/14090
|
|
1187
|
+
if (inputValue && menuItems.every(option => getValuePropValue(option) !== inputValue)) {
|
|
1188
|
+
const p = {
|
|
1189
|
+
attrs: UNSELECTABLE_ATTRIBUTE,
|
|
1190
|
+
key: inputValue,
|
|
1191
|
+
props: {
|
|
1192
|
+
value: inputValue,
|
|
1193
|
+
role: 'option',
|
|
1194
|
+
},
|
|
1195
|
+
style: UNSELECTABLE_STYLE,
|
|
1196
|
+
};
|
|
1197
|
+
options.unshift(<MenuItem {...p}>{inputValue}</MenuItem>);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
if (!options.length && notFoundContent) {
|
|
1202
|
+
empty = true;
|
|
1203
|
+
const p = {
|
|
1204
|
+
attrs: UNSELECTABLE_ATTRIBUTE,
|
|
1205
|
+
key: 'NOT_FOUND',
|
|
1206
|
+
props: {
|
|
1207
|
+
value: 'NOT_FOUND',
|
|
1208
|
+
disabled: true,
|
|
1209
|
+
role: 'option',
|
|
1210
|
+
},
|
|
1211
|
+
style: UNSELECTABLE_STYLE,
|
|
1212
|
+
};
|
|
1213
|
+
options = [<MenuItem {...p}>{notFoundContent}</MenuItem>];
|
|
1214
|
+
}
|
|
1215
|
+
return { empty, options };
|
|
1216
|
+
},
|
|
1217
|
+
|
|
1218
|
+
renderFilterOptionsFromChildren(children = [], childrenKeys, menuItems) {
|
|
1219
|
+
const sel = [];
|
|
1220
|
+
const props = this.$props;
|
|
1221
|
+
const { _inputValue: inputValue } = this.$data;
|
|
1222
|
+
const tags = props.tags;
|
|
1223
|
+
children.forEach(child => {
|
|
1224
|
+
if (!child.data || child.data.slot !== undefined) {
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
if (getSlotOptions(child).isSelectOptGroup) {
|
|
1228
|
+
let label = getComponentFromProp(child, 'label');
|
|
1229
|
+
let key = child.key;
|
|
1230
|
+
if (!key && typeof label === 'string') {
|
|
1231
|
+
key = label;
|
|
1232
|
+
} else if (!label && key) {
|
|
1233
|
+
label = key;
|
|
1234
|
+
}
|
|
1235
|
+
let childChildren = getSlots(child).default;
|
|
1236
|
+
childChildren = typeof childChildren === 'function' ? childChildren() : childChildren;
|
|
1237
|
+
// Match option group label
|
|
1238
|
+
if (inputValue && this._filterOption(inputValue, child)) {
|
|
1239
|
+
const innerItems = childChildren.map(subChild => {
|
|
1240
|
+
const childValueSub = getValuePropValue(subChild) || subChild.key;
|
|
1241
|
+
return (
|
|
1242
|
+
<MenuItem key={childValueSub} value={childValueSub} {...subChild.data}>
|
|
1243
|
+
{subChild.componentOptions.children}
|
|
1244
|
+
</MenuItem>
|
|
1245
|
+
);
|
|
1246
|
+
});
|
|
1247
|
+
|
|
1248
|
+
sel.push(
|
|
1249
|
+
<MenuItemGroup key={key} title={label} class={getClass(child)}>
|
|
1250
|
+
{innerItems}
|
|
1251
|
+
</MenuItemGroup>,
|
|
1252
|
+
);
|
|
1253
|
+
|
|
1254
|
+
// Not match
|
|
1255
|
+
} else {
|
|
1256
|
+
const innerItems = this.renderFilterOptionsFromChildren(
|
|
1257
|
+
childChildren,
|
|
1258
|
+
childrenKeys,
|
|
1259
|
+
menuItems,
|
|
1260
|
+
);
|
|
1261
|
+
if (innerItems.length) {
|
|
1262
|
+
sel.push(
|
|
1263
|
+
<MenuItemGroup key={key} title={label} {...child.data}>
|
|
1264
|
+
{innerItems}
|
|
1265
|
+
</MenuItemGroup>,
|
|
1266
|
+
);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
warning(
|
|
1273
|
+
getSlotOptions(child).isSelectOption,
|
|
1274
|
+
'the children of `Select` should be `Select.Option` or `Select.OptGroup`, ' +
|
|
1275
|
+
`instead of \`${getSlotOptions(child).name || getSlotOptions(child)}\`.`,
|
|
1276
|
+
);
|
|
1277
|
+
|
|
1278
|
+
const childValue = getValuePropValue(child);
|
|
1279
|
+
|
|
1280
|
+
validateOptionValue(childValue, this.$props);
|
|
1281
|
+
if (this._filterOption(inputValue, child)) {
|
|
1282
|
+
const p = {
|
|
1283
|
+
attrs: {
|
|
1284
|
+
...UNSELECTABLE_ATTRIBUTE,
|
|
1285
|
+
...getAttrs(child),
|
|
1286
|
+
},
|
|
1287
|
+
key: childValue,
|
|
1288
|
+
props: {
|
|
1289
|
+
value: childValue,
|
|
1290
|
+
...getPropsData(child),
|
|
1291
|
+
role: 'option',
|
|
1292
|
+
},
|
|
1293
|
+
style: UNSELECTABLE_STYLE,
|
|
1294
|
+
on: getEvents(child),
|
|
1295
|
+
class: getClass(child),
|
|
1296
|
+
};
|
|
1297
|
+
const menuItem = <MenuItem {...p}>{child.componentOptions.children}</MenuItem>;
|
|
1298
|
+
sel.push(menuItem);
|
|
1299
|
+
menuItems.push(menuItem);
|
|
1300
|
+
}
|
|
1301
|
+
if (tags) {
|
|
1302
|
+
childrenKeys.push(childValue);
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1306
|
+
return sel;
|
|
1307
|
+
},
|
|
1308
|
+
|
|
1309
|
+
renderTopControlNode() {
|
|
1310
|
+
const { $props: props } = this;
|
|
1311
|
+
const { _value: value, _inputValue: inputValue, _open: open } = this.$data;
|
|
1312
|
+
const {
|
|
1313
|
+
choiceTransitionName,
|
|
1314
|
+
prefixCls,
|
|
1315
|
+
maxTagTextLength,
|
|
1316
|
+
maxTagCount,
|
|
1317
|
+
maxTagPlaceholder,
|
|
1318
|
+
showSearch,
|
|
1319
|
+
} = props;
|
|
1320
|
+
const removeIcon = getComponentFromProp(this, 'removeIcon');
|
|
1321
|
+
const className = `${prefixCls}-selection__rendered`;
|
|
1322
|
+
// search input is inside topControlNode in single, multiple & combobox. 2016/04/13
|
|
1323
|
+
let innerNode = null;
|
|
1324
|
+
if (isSingleMode(props)) {
|
|
1325
|
+
let selectedValue = null;
|
|
1326
|
+
if (value.length) {
|
|
1327
|
+
let showSelectedValue = false;
|
|
1328
|
+
let opacity = 1;
|
|
1329
|
+
if (!showSearch) {
|
|
1330
|
+
showSelectedValue = true;
|
|
1331
|
+
} else if (open) {
|
|
1332
|
+
showSelectedValue = !inputValue;
|
|
1333
|
+
if (showSelectedValue) {
|
|
1334
|
+
opacity = 0.4;
|
|
1335
|
+
}
|
|
1336
|
+
} else {
|
|
1337
|
+
showSelectedValue = true;
|
|
1338
|
+
}
|
|
1339
|
+
const singleValue = value[0];
|
|
1340
|
+
const { label, title } = this.getOptionInfoBySingleValue(singleValue);
|
|
1341
|
+
selectedValue = (
|
|
1342
|
+
<div
|
|
1343
|
+
key="value"
|
|
1344
|
+
class={`${prefixCls}-selection-selected-value`}
|
|
1345
|
+
title={toTitle(title || label)}
|
|
1346
|
+
style={{
|
|
1347
|
+
display: showSelectedValue ? 'block' : 'none',
|
|
1348
|
+
opacity,
|
|
1349
|
+
}}
|
|
1350
|
+
>
|
|
1351
|
+
{label}
|
|
1352
|
+
</div>
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
if (!showSearch) {
|
|
1356
|
+
innerNode = [selectedValue];
|
|
1357
|
+
} else {
|
|
1358
|
+
innerNode = [
|
|
1359
|
+
selectedValue,
|
|
1360
|
+
<div
|
|
1361
|
+
class={`${prefixCls}-search ${prefixCls}-search--inline`}
|
|
1362
|
+
key="input"
|
|
1363
|
+
style={{
|
|
1364
|
+
display: open ? 'block' : 'none',
|
|
1365
|
+
}}
|
|
1366
|
+
>
|
|
1367
|
+
{this._getInputElement()}
|
|
1368
|
+
</div>,
|
|
1369
|
+
];
|
|
1370
|
+
}
|
|
1371
|
+
} else {
|
|
1372
|
+
let selectedValueNodes = [];
|
|
1373
|
+
let limitedCountValue = value;
|
|
1374
|
+
let maxTagPlaceholderEl;
|
|
1375
|
+
if (maxTagCount !== undefined && value.length > maxTagCount) {
|
|
1376
|
+
limitedCountValue = limitedCountValue.slice(0, maxTagCount);
|
|
1377
|
+
const omittedValues = this.getVLForOnChange(value.slice(maxTagCount, value.length));
|
|
1378
|
+
let content = `+ ${value.length - maxTagCount} ...`;
|
|
1379
|
+
if (maxTagPlaceholder) {
|
|
1380
|
+
content =
|
|
1381
|
+
typeof maxTagPlaceholder === 'function'
|
|
1382
|
+
? maxTagPlaceholder(omittedValues)
|
|
1383
|
+
: maxTagPlaceholder;
|
|
1384
|
+
}
|
|
1385
|
+
const attrs = {
|
|
1386
|
+
...UNSELECTABLE_ATTRIBUTE,
|
|
1387
|
+
role: 'presentation',
|
|
1388
|
+
title: toTitle(content),
|
|
1389
|
+
};
|
|
1390
|
+
maxTagPlaceholderEl = (
|
|
1391
|
+
<li
|
|
1392
|
+
style={UNSELECTABLE_STYLE}
|
|
1393
|
+
{...{ attrs }}
|
|
1394
|
+
onMousedown={preventDefaultEvent}
|
|
1395
|
+
class={`${prefixCls}-selection__choice ${prefixCls}-selection__choice__disabled`}
|
|
1396
|
+
key="maxTagPlaceholder"
|
|
1397
|
+
>
|
|
1398
|
+
<div class={`${prefixCls}-selection__choice__content`}>{content}</div>
|
|
1399
|
+
</li>
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
if (isMultipleOrTags(props)) {
|
|
1403
|
+
selectedValueNodes = limitedCountValue.map(singleValue => {
|
|
1404
|
+
const info = this.getOptionInfoBySingleValue(singleValue);
|
|
1405
|
+
let content = info.label;
|
|
1406
|
+
const title = info.title || content;
|
|
1407
|
+
if (
|
|
1408
|
+
maxTagTextLength &&
|
|
1409
|
+
typeof content === 'string' &&
|
|
1410
|
+
content.length > maxTagTextLength
|
|
1411
|
+
) {
|
|
1412
|
+
content = `${content.slice(0, maxTagTextLength)}...`;
|
|
1413
|
+
}
|
|
1414
|
+
const disabled = this.isChildDisabled(singleValue);
|
|
1415
|
+
const choiceClassName = disabled
|
|
1416
|
+
? `${prefixCls}-selection__choice ${prefixCls}-selection__choice__disabled`
|
|
1417
|
+
: `${prefixCls}-selection__choice`;
|
|
1418
|
+
// attrs 放在一起,避免动态title混乱问题,很奇怪的问题 https://github.com/vueComponent/ant-design-vue/issues/588
|
|
1419
|
+
const attrs = {
|
|
1420
|
+
...UNSELECTABLE_ATTRIBUTE,
|
|
1421
|
+
role: 'presentation',
|
|
1422
|
+
title: toTitle(title),
|
|
1423
|
+
};
|
|
1424
|
+
return (
|
|
1425
|
+
<li
|
|
1426
|
+
style={UNSELECTABLE_STYLE}
|
|
1427
|
+
{...{ attrs }}
|
|
1428
|
+
onMousedown={preventDefaultEvent}
|
|
1429
|
+
class={choiceClassName}
|
|
1430
|
+
key={singleValue || SELECT_EMPTY_VALUE_KEY}
|
|
1431
|
+
>
|
|
1432
|
+
<div class={`${prefixCls}-selection__choice__content`}>{content}</div>
|
|
1433
|
+
{disabled ? null : (
|
|
1434
|
+
<span
|
|
1435
|
+
onClick={event => {
|
|
1436
|
+
this.removeSelected(singleValue, event);
|
|
1437
|
+
}}
|
|
1438
|
+
class={`${prefixCls}-selection__choice__remove`}
|
|
1439
|
+
>
|
|
1440
|
+
{removeIcon || <i class={`${prefixCls}-selection__choice__remove-icon`}>×</i>}
|
|
1441
|
+
</span>
|
|
1442
|
+
)}
|
|
1443
|
+
</li>
|
|
1444
|
+
);
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
if (maxTagPlaceholderEl) {
|
|
1448
|
+
selectedValueNodes.push(maxTagPlaceholderEl);
|
|
1449
|
+
}
|
|
1450
|
+
selectedValueNodes.push(
|
|
1451
|
+
<li class={`${prefixCls}-search ${prefixCls}-search--inline`} key="__input">
|
|
1452
|
+
{this._getInputElement()}
|
|
1453
|
+
</li>,
|
|
1454
|
+
);
|
|
1455
|
+
|
|
1456
|
+
if (isMultipleOrTags(props) && choiceTransitionName) {
|
|
1457
|
+
const transitionProps = getTransitionProps(choiceTransitionName, {
|
|
1458
|
+
tag: 'ul',
|
|
1459
|
+
afterLeave: this.onChoiceAnimationLeave,
|
|
1460
|
+
});
|
|
1461
|
+
innerNode = (
|
|
1462
|
+
<transition-group {...transitionProps}>{selectedValueNodes}</transition-group>
|
|
1463
|
+
);
|
|
1464
|
+
} else {
|
|
1465
|
+
innerNode = <ul>{selectedValueNodes}</ul>;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
return (
|
|
1469
|
+
<div
|
|
1470
|
+
class={className}
|
|
1471
|
+
{...{
|
|
1472
|
+
directives: [
|
|
1473
|
+
{
|
|
1474
|
+
name: 'ant-ref',
|
|
1475
|
+
value: this.saveTopCtrlRef,
|
|
1476
|
+
},
|
|
1477
|
+
],
|
|
1478
|
+
}}
|
|
1479
|
+
onClick={this.topCtrlContainerClick}
|
|
1480
|
+
>
|
|
1481
|
+
{this.getPlaceholderElement()}
|
|
1482
|
+
{innerNode}
|
|
1483
|
+
</div>
|
|
1484
|
+
);
|
|
1485
|
+
},
|
|
1486
|
+
renderArrow(multiple) {
|
|
1487
|
+
// showArrow : Set to true if not multiple by default but keep set value.
|
|
1488
|
+
const { showArrow = !multiple, loading, prefixCls } = this.$props;
|
|
1489
|
+
const inputIcon = getComponentFromProp(this, 'inputIcon');
|
|
1490
|
+
if (!showArrow && !loading) {
|
|
1491
|
+
return null;
|
|
1492
|
+
}
|
|
1493
|
+
// if loading have loading icon
|
|
1494
|
+
const defaultIcon = loading ? (
|
|
1495
|
+
<i class={`${prefixCls}-arrow-loading`} />
|
|
1496
|
+
) : (
|
|
1497
|
+
<i class={`${prefixCls}-arrow-icon`} />
|
|
1498
|
+
);
|
|
1499
|
+
return (
|
|
1500
|
+
<span
|
|
1501
|
+
key="arrow"
|
|
1502
|
+
class={`${prefixCls}-arrow`}
|
|
1503
|
+
style={UNSELECTABLE_STYLE}
|
|
1504
|
+
{...{ attrs: UNSELECTABLE_ATTRIBUTE }}
|
|
1505
|
+
onClick={this.onArrowClick}
|
|
1506
|
+
ref="arrow"
|
|
1507
|
+
>
|
|
1508
|
+
{inputIcon || defaultIcon}
|
|
1509
|
+
</span>
|
|
1510
|
+
);
|
|
1511
|
+
},
|
|
1512
|
+
topCtrlContainerClick(e) {
|
|
1513
|
+
if (this.$data._open && !isSingleMode(this.$props)) {
|
|
1514
|
+
e.stopPropagation();
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
renderClear() {
|
|
1518
|
+
const { prefixCls, allowClear } = this.$props;
|
|
1519
|
+
const { _value: value, _inputValue: inputValue } = this.$data;
|
|
1520
|
+
const clearIcon = getComponentFromProp(this, 'clearIcon');
|
|
1521
|
+
const clear = (
|
|
1522
|
+
<span
|
|
1523
|
+
key="clear"
|
|
1524
|
+
class={`${prefixCls}-selection__clear`}
|
|
1525
|
+
onMousedown={preventDefaultEvent}
|
|
1526
|
+
style={UNSELECTABLE_STYLE}
|
|
1527
|
+
{...{ attrs: UNSELECTABLE_ATTRIBUTE }}
|
|
1528
|
+
onClick={this.onClearSelection}
|
|
1529
|
+
>
|
|
1530
|
+
{clearIcon || <i class={`${prefixCls}-selection__clear-icon`}>×</i>}
|
|
1531
|
+
</span>
|
|
1532
|
+
);
|
|
1533
|
+
if (!allowClear) {
|
|
1534
|
+
return null;
|
|
1535
|
+
}
|
|
1536
|
+
if (isCombobox(this.$props)) {
|
|
1537
|
+
if (inputValue) {
|
|
1538
|
+
return clear;
|
|
1539
|
+
}
|
|
1540
|
+
return null;
|
|
1541
|
+
}
|
|
1542
|
+
if (inputValue || value.length) {
|
|
1543
|
+
return clear;
|
|
1544
|
+
}
|
|
1545
|
+
return null;
|
|
1546
|
+
},
|
|
1547
|
+
|
|
1548
|
+
selectionRefClick() {
|
|
1549
|
+
//e.stopPropagation();
|
|
1550
|
+
if (!this.disabled) {
|
|
1551
|
+
const input = this.getInputDOMNode();
|
|
1552
|
+
if (this._focused && this.$data._open) {
|
|
1553
|
+
// this._focused = false;
|
|
1554
|
+
this.setOpenState(false, false);
|
|
1555
|
+
input && input.blur();
|
|
1556
|
+
} else {
|
|
1557
|
+
this.clearBlurTime();
|
|
1558
|
+
//this._focused = true;
|
|
1559
|
+
this.setOpenState(true, true);
|
|
1560
|
+
input && input.focus();
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
},
|
|
1564
|
+
selectionRefFocus(e) {
|
|
1565
|
+
if (this._focused || this.disabled || isMultipleOrTagsOrCombobox(this.$props)) {
|
|
1566
|
+
e.preventDefault();
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
this._focused = true;
|
|
1570
|
+
this.updateFocusClassName();
|
|
1571
|
+
this.$emit('focus');
|
|
1572
|
+
},
|
|
1573
|
+
selectionRefBlur(e) {
|
|
1574
|
+
if (isMultipleOrTagsOrCombobox(this.$props)) {
|
|
1575
|
+
e.preventDefault();
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
this.inputBlur(e);
|
|
1579
|
+
},
|
|
1580
|
+
},
|
|
1581
|
+
|
|
1582
|
+
render() {
|
|
1583
|
+
const props = this.$props;
|
|
1584
|
+
const multiple = isMultipleOrTags(props);
|
|
1585
|
+
// Default set showArrow to true if not set (not set directly in defaultProps to handle multiple case)
|
|
1586
|
+
const { showArrow = true } = props;
|
|
1587
|
+
const state = this.$data;
|
|
1588
|
+
const { disabled, prefixCls, loading } = props;
|
|
1589
|
+
const ctrlNode = this.renderTopControlNode();
|
|
1590
|
+
const { _open: open, _inputValue: inputValue, _value: value } = this.$data;
|
|
1591
|
+
if (open) {
|
|
1592
|
+
const filterOptions = this.renderFilterOptions();
|
|
1593
|
+
this._empty = filterOptions.empty;
|
|
1594
|
+
this._options = filterOptions.options;
|
|
1595
|
+
}
|
|
1596
|
+
const realOpen = this.getRealOpenState();
|
|
1597
|
+
const empty = this._empty;
|
|
1598
|
+
const options = this._options || [];
|
|
1599
|
+
const { mouseenter = noop, mouseleave = noop, popupScroll = noop } = getListeners(this);
|
|
1600
|
+
const selectionProps = {
|
|
1601
|
+
props: {},
|
|
1602
|
+
attrs: {
|
|
1603
|
+
role: 'combobox',
|
|
1604
|
+
'aria-autocomplete': 'list',
|
|
1605
|
+
'aria-haspopup': 'true',
|
|
1606
|
+
'aria-expanded': realOpen,
|
|
1607
|
+
'aria-controls': this.$data._ariaId,
|
|
1608
|
+
},
|
|
1609
|
+
on: {
|
|
1610
|
+
// click: this.selectionRefClick,
|
|
1611
|
+
},
|
|
1612
|
+
class: `${prefixCls}-selection ${prefixCls}-selection--${multiple ? 'multiple' : 'single'}`,
|
|
1613
|
+
// directives: [
|
|
1614
|
+
// {
|
|
1615
|
+
// name: 'ant-ref',
|
|
1616
|
+
// value: this.saveSelectionRef,
|
|
1617
|
+
// },
|
|
1618
|
+
// ],
|
|
1619
|
+
key: 'selection',
|
|
1620
|
+
};
|
|
1621
|
+
//if (!isMultipleOrTagsOrCombobox(props)) {
|
|
1622
|
+
// selectionProps.on.keydown = this.onKeyDown;
|
|
1623
|
+
// selectionProps.on.focus = this.selectionRefFocus;
|
|
1624
|
+
// selectionProps.on.blur = this.selectionRefBlur;
|
|
1625
|
+
// selectionProps.attrs.tabIndex = props.disabled ? -1 : props.tabIndex;
|
|
1626
|
+
//}
|
|
1627
|
+
let extraSelectionProps = { attrs: { tabIndex: -1 } };
|
|
1628
|
+
if (!isMultipleOrTagsOrCombobox(props)) {
|
|
1629
|
+
extraSelectionProps.attrs.tabIndex = props.disabled ? -1 : props.tabIndex;
|
|
1630
|
+
}
|
|
1631
|
+
const rootCls = {
|
|
1632
|
+
[prefixCls]: true,
|
|
1633
|
+
[`${prefixCls}-open`]: open,
|
|
1634
|
+
[`${prefixCls}-focused`]: open || !!this._focused,
|
|
1635
|
+
[`${prefixCls}-combobox`]: isCombobox(props),
|
|
1636
|
+
[`${prefixCls}-disabled`]: disabled,
|
|
1637
|
+
[`${prefixCls}-enabled`]: !disabled,
|
|
1638
|
+
[`${prefixCls}-allow-clear`]: !!props.allowClear,
|
|
1639
|
+
[`${prefixCls}-no-arrow`]: !showArrow,
|
|
1640
|
+
[`${prefixCls}-loading`]: !!loading,
|
|
1641
|
+
};
|
|
1642
|
+
return (
|
|
1643
|
+
<SelectTrigger
|
|
1644
|
+
dropdownAlign={props.dropdownAlign}
|
|
1645
|
+
dropdownClassName={props.dropdownClassName}
|
|
1646
|
+
dropdownMatchSelectWidth={props.dropdownMatchSelectWidth}
|
|
1647
|
+
defaultActiveFirstOption={props.defaultActiveFirstOption}
|
|
1648
|
+
dropdownMenuStyle={props.dropdownMenuStyle}
|
|
1649
|
+
transitionName={props.transitionName}
|
|
1650
|
+
animation={props.animation}
|
|
1651
|
+
prefixCls={props.prefixCls}
|
|
1652
|
+
dropdownStyle={props.dropdownStyle}
|
|
1653
|
+
combobox={props.combobox}
|
|
1654
|
+
showSearch={props.showSearch}
|
|
1655
|
+
options={options}
|
|
1656
|
+
empty={empty}
|
|
1657
|
+
multiple={multiple}
|
|
1658
|
+
disabled={disabled}
|
|
1659
|
+
visible={realOpen}
|
|
1660
|
+
inputValue={inputValue}
|
|
1661
|
+
value={value}
|
|
1662
|
+
backfillValue={state._backfillValue}
|
|
1663
|
+
firstActiveValue={props.firstActiveValue}
|
|
1664
|
+
onDropdownVisibleChange={this.onDropdownVisibleChange}
|
|
1665
|
+
getPopupContainer={props.getPopupContainer}
|
|
1666
|
+
onMenuSelect={this.onMenuSelect}
|
|
1667
|
+
onMenuDeselect={this.onMenuDeselect}
|
|
1668
|
+
onPopupScroll={popupScroll}
|
|
1669
|
+
onPopupFocus={this.onPopupFocus}
|
|
1670
|
+
onMouseenter={mouseenter}
|
|
1671
|
+
onMouseleave={mouseleave}
|
|
1672
|
+
showAction={props.showAction}
|
|
1673
|
+
menuItemSelectedIcon={getComponentFromProp(this, 'menuItemSelectedIcon')}
|
|
1674
|
+
{...{
|
|
1675
|
+
directives: [
|
|
1676
|
+
{
|
|
1677
|
+
name: 'ant-ref',
|
|
1678
|
+
value: this.saveSelectTriggerRef,
|
|
1679
|
+
},
|
|
1680
|
+
],
|
|
1681
|
+
}}
|
|
1682
|
+
dropdownRender={props.dropdownRender}
|
|
1683
|
+
ariaId={this.$data._ariaId}
|
|
1684
|
+
>
|
|
1685
|
+
<div
|
|
1686
|
+
{...{
|
|
1687
|
+
directives: [
|
|
1688
|
+
{
|
|
1689
|
+
name: 'ant-ref',
|
|
1690
|
+
value: chaining(this.saveRootRef, this.saveSelectionRef),
|
|
1691
|
+
},
|
|
1692
|
+
],
|
|
1693
|
+
}}
|
|
1694
|
+
style={getStyle(this)}
|
|
1695
|
+
class={classnames(rootCls)}
|
|
1696
|
+
onMousedown={this.markMouseDown}
|
|
1697
|
+
onMouseup={this.markMouseLeave}
|
|
1698
|
+
onMouseout={this.markMouseLeave}
|
|
1699
|
+
{...extraSelectionProps}
|
|
1700
|
+
onBlur={this.selectionRefBlur}
|
|
1701
|
+
onFocus={this.selectionRefFocus}
|
|
1702
|
+
onClick={this.selectionRefClick}
|
|
1703
|
+
onKeydown={isMultipleOrTagsOrCombobox(props) ? noop : this.onKeyDown}
|
|
1704
|
+
>
|
|
1705
|
+
<div {...selectionProps}>
|
|
1706
|
+
{ctrlNode}
|
|
1707
|
+
{this.renderClear()}
|
|
1708
|
+
{this.renderArrow(!!multiple)}
|
|
1709
|
+
</div>
|
|
1710
|
+
</div>
|
|
1711
|
+
</SelectTrigger>
|
|
1712
|
+
);
|
|
1713
|
+
},
|
|
1714
|
+
};
|
|
1715
|
+
export { Select };
|
|
1716
|
+
export default proxyComponent(Select);
|