tntd 2.7.30 → 2.7.31
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/es/ellipsis/index.js +2 -0
- package/es/ellipsis/index.js.map +1 -1
- package/lib/ellipsis/index.d.ts.map +1 -1
- package/lib/ellipsis/index.js +2 -0
- package/lib/ellipsis/index.js.map +1 -1
- package/package.json +1 -1
- package/themes/common/index.less +3 -3
- package/es/affix/style/index.less +0 -6
- package/es/alert/style/index.less +0 -188
- package/es/anchor/style/index.less +0 -82
- package/es/auto-complete/style/index.less +0 -92
- package/es/avatar/style/index.less +0 -59
- package/es/back-top/style/index.less +0 -42
- package/es/back-top/style/responsive.less +0 -11
- package/es/badge/style/index.less +0 -190
- package/es/breadcrumb/style/index.less +0 -51
- package/es/button/style/index.less +0 -224
- package/es/button/style/mixin.less +0 -357
- package/es/calendar/style/index.less +0 -278
- package/es/card/style/index.less +0 -263
- package/es/card/style/size.less +0 -25
- package/es/carousel/style/index.less +0 -238
- package/es/cascader/style/index.less +0 -227
- package/es/checkbox/style/index.less +0 -4
- package/es/checkbox/style/mixin.less +0 -220
- package/es/collapse/style/index.less +0 -134
- package/es/comment/style/index.less +0 -93
- package/es/config-provider/style/index.less +0 -2
- package/es/date-picker/style/Calendar.less +0 -402
- package/es/date-picker/style/DecadePanel.less +0 -81
- package/es/date-picker/style/MonthPanel.less +0 -86
- package/es/date-picker/style/MonthPicker.less +0 -11
- package/es/date-picker/style/Picker.less +0 -113
- package/es/date-picker/style/RangePicker.less +0 -248
- package/es/date-picker/style/TimePicker.less +0 -151
- package/es/date-picker/style/WeekPicker.less +0 -21
- package/es/date-picker/style/YearPanel.less +0 -85
- package/es/date-picker/style/index.less +0 -17
- package/es/descriptions/style/index.less +0 -144
- package/es/divider/style/index.less +0 -109
- package/es/drawer/style/drawer.less +0 -230
- package/es/drawer/style/index.less +0 -3
- package/es/dropdown/style/index.less +0 -282
- package/es/empty/style/index.less +0 -52
- package/es/form/style/index.less +0 -653
- package/es/form/style/mixin.less +0 -126
- package/es/grid-v4/style/index.less +0 -124
- package/es/grid-v4/style/mixin.less +0 -57
- package/es/grid-v4/style/rtl.less +0 -69
- package/es/handle/handle.js +0 -138
- package/es/handle/handle.js.map +0 -1
- package/es/icon/style/index.less +0 -4
- package/es/input/style/index.less +0 -57
- package/es/input/style/mixin.less +0 -449
- package/es/input/style/search-input.less +0 -34
- package/es/input-number/style/index.less +0 -179
- package/es/layout/style/index.less +0 -124
- package/es/layout/style/light.less +0 -15
- package/es/list/style/bordered.less +0 -41
- package/es/list/style/index.less +0 -234
- package/es/list/style/responsive.less +0 -40
- package/es/locale-provider/style/index.less +0 -2
- package/es/mention/index.js +0 -4
- package/es/mention/index.js.map +0 -1
- package/es/mentions/style/index.less +0 -164
- package/es/menu/style/dark.less +0 -139
- package/es/menu/style/index.less +0 -515
- package/es/message/style/index.less +0 -75
- package/es/modal/style/confirm.less +0 -78
- package/es/modal/style/index.less +0 -4
- package/es/modal/style/modal.less +0 -165
- package/es/notification/style/index.less +0 -199
- package/es/page-header/style/index.less +0 -119
- package/es/pagination/style/index.less +0 -400
- package/es/popover/style/index.less +0 -205
- package/es/progress/style/index.less +0 -182
- package/es/radio/style/index.less +0 -327
- package/es/rate/style/index.less +0 -85
- package/es/result/style/index.less +0 -71
- package/es/select/style/index.less +0 -604
- package/es/skeleton/style/index.less +0 -130
- package/es/slider/style/index.less +0 -197
- package/es/spin/style/index.less +0 -214
- package/es/statistic/style/index.less +0 -40
- package/es/steps/style/compatibility.less +0 -50
- package/es/steps/style/custom-icon.less +0 -31
- package/es/steps/style/label-placement.less +0 -38
- package/es/steps/style/progress-dot.less +0 -80
- package/es/steps/style/vertical.less +0 -74
- package/es/style/color/bezierEasing.less +0 -110
- package/es/style/color/colorPalette.less +0 -75
- package/es/style/color/colors.less +0 -149
- package/es/style/color/tinyColor.less +0 -1184
- package/es/style/core/base.less +0 -510
- package/es/style/core/iconfont.less +0 -19
- package/es/style/core/index.less +0 -4
- package/es/style/core/motion/fade.less +0 -31
- package/es/style/core/motion/move.less +0 -120
- package/es/style/core/motion/other.less +0 -40
- package/es/style/core/motion/slide.less +0 -120
- package/es/style/core/motion/swing.less +0 -34
- package/es/style/core/motion/zoom.less +0 -162
- package/es/style/core/motion.less +0 -20
- package/es/style/index.less +0 -2
- package/es/style/mixins/clearfix.less +0 -13
- package/es/style/mixins/compatibility.less +0 -22
- package/es/style/mixins/iconfont.less +0 -43
- package/es/style/mixins/index.less +0 -10
- package/es/style/mixins/motion.less +0 -35
- package/es/style/mixins/operation-unit.less +0 -18
- package/es/style/mixins/reset.less +0 -13
- package/es/style/mixins/size.less +0 -10
- package/es/style/mixins/typography.less +0 -49
- package/es/style/themes/default.less +0 -699
- package/es/style/themes/index.less +0 -1
- package/es/style/v2-compatible-reset.less +0 -51
- package/es/switch/style/index.less +0 -178
- package/es/table/style/index.less +0 -800
- package/es/table/style/size.less +0 -179
- package/es/tabs/style/card-style.less +0 -186
- package/es/tabs/style/index.less +0 -436
- package/es/tag/style/index.less +0 -106
- package/es/time-picker/style/index.less +0 -246
- package/es/timeline/style/index.less +0 -167
- package/es/tntd-form/TntdForm/components/Item.js +0 -55
- package/es/tntd-form/TntdForm/components/Item.js.map +0 -1
- package/es/tntd-form/TntdForm/components/ItemComp.js +0 -186
- package/es/tntd-form/TntdForm/components/ItemComp.js.map +0 -1
- package/es/tntd-form/TntdForm/components/List.js +0 -102
- package/es/tntd-form/TntdForm/components/List.js.map +0 -1
- package/es/tntd-form/TntdForm/index.js +0 -55
- package/es/tntd-form/TntdForm/index.js.map +0 -1
- package/es/tntd-form/TntdForm/interface.js +0 -1
- package/es/tntd-form/TntdForm/interface.js.map +0 -1
- package/es/tntd-form/TntdForm/store.js +0 -2
- package/es/tntd-form/TntdForm/store.js.map +0 -1
- package/es/tntd-form/TntdForm/utils.js +0 -219
- package/es/tntd-form/TntdForm/utils.js.map +0 -1
- package/es/tntd-form/_util/motion.js +0 -47
- package/es/tntd-form/_util/motion.js.map +0 -1
- package/es/tntd-form/_util/reactNode.js +0 -16
- package/es/tntd-form/_util/reactNode.js.map +0 -1
- package/es/tntd-form/_util/scrollTo.js +0 -35
- package/es/tntd-form/_util/scrollTo.js.map +0 -1
- package/es/tntd-form/_util/type.js +0 -3
- package/es/tntd-form/_util/type.js.map +0 -1
- package/es/tntd-form/_util/warning.js +0 -5
- package/es/tntd-form/_util/warning.js.map +0 -1
- package/es/tntd-form/_util/wave.js +0 -168
- package/es/tntd-form/_util/wave.js.map +0 -1
- package/es/tntd-form/tntd-form.stories.js +0 -836
- package/es/tntd-form/tntd-form.stories.js.map +0 -1
- package/es/tntd-select/_util/DisabledContext.js +0 -12
- package/es/tntd-select/_util/DisabledContext.js.map +0 -1
- package/es/tntd-select/_util/FormItemInputContext.js +0 -2
- package/es/tntd-select/_util/FormItemInputContext.js.map +0 -1
- package/es/tntd-select/_util/PurePanel.js +0 -66
- package/es/tntd-select/_util/PurePanel.js.map +0 -1
- package/es/tntd-select/_util/SizeContext.js +0 -2
- package/es/tntd-select/_util/SizeContext.js.map +0 -1
- package/es/tntd-select/_util/context.js +0 -12
- package/es/tntd-select/_util/context.js.map +0 -1
- package/es/tntd-select/_util/defaultRenderEmpty.js +0 -31
- package/es/tntd-select/_util/defaultRenderEmpty.js.map +0 -1
- package/es/tntd-select/_util/getIcons.js +0 -74
- package/es/tntd-select/_util/getIcons.js.map +0 -1
- package/es/tntd-select/_util/interface.js +0 -4
- package/es/tntd-select/_util/interface.js.map +0 -1
- package/es/tntd-select/_util/motion.js +0 -47
- package/es/tntd-select/_util/motion.js.map +0 -1
- package/es/tntd-select/_util/type.js +0 -3
- package/es/tntd-select/_util/type.js.map +0 -1
- package/es/tntd-select/_util/useCompactItemContext.js +0 -26
- package/es/tntd-select/_util/useCompactItemContext.js.map +0 -1
- package/es/tntd-select/_util/warning.js +0 -14
- package/es/tntd-select/_util/warning.js.map +0 -1
- package/es/tntd-select/rc-select/BaseSelect.js +0 -524
- package/es/tntd-select/rc-select/BaseSelect.js.map +0 -1
- package/es/tntd-select/rc-select/OptGroup.js +0 -4
- package/es/tntd-select/rc-select/OptGroup.js.map +0 -1
- package/es/tntd-select/rc-select/Option.js +0 -4
- package/es/tntd-select/rc-select/Option.js.map +0 -1
- package/es/tntd-select/rc-select/OptionList.js +0 -346
- package/es/tntd-select/rc-select/OptionList.js.map +0 -1
- package/es/tntd-select/rc-select/Select.js +0 -440
- package/es/tntd-select/rc-select/Select.js.map +0 -1
- package/es/tntd-select/rc-select/SelectContext.js +0 -3
- package/es/tntd-select/rc-select/SelectContext.js.map +0 -1
- package/es/tntd-select/rc-select/SelectTrigger.js +0 -130
- package/es/tntd-select/rc-select/SelectTrigger.js.map +0 -1
- package/es/tntd-select/rc-select/Selector/Input.js +0 -103
- package/es/tntd-select/rc-select/Selector/Input.js.map +0 -1
- package/es/tntd-select/rc-select/Selector/MultipleSelector.js +0 -171
- package/es/tntd-select/rc-select/Selector/MultipleSelector.js.map +0 -1
- package/es/tntd-select/rc-select/Selector/SingleSelector.js +0 -98
- package/es/tntd-select/rc-select/Selector/SingleSelector.js.map +0 -1
- package/es/tntd-select/rc-select/Selector/index.js +0 -158
- package/es/tntd-select/rc-select/Selector/index.js.map +0 -1
- package/es/tntd-select/rc-select/TransBtn.js +0 -36
- package/es/tntd-select/rc-select/TransBtn.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useAllowClear.js +0 -24
- package/es/tntd-select/rc-select/hooks/useAllowClear.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useBaseProps.js +0 -9
- package/es/tntd-select/rc-select/hooks/useBaseProps.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useCache.js +0 -38
- package/es/tntd-select/rc-select/hooks/useCache.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useDelayReset.js +0 -23
- package/es/tntd-select/rc-select/hooks/useDelayReset.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useFilterOptions.js +0 -55
- package/es/tntd-select/rc-select/hooks/useFilterOptions.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useId.js +0 -26
- package/es/tntd-select/rc-select/hooks/useId.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useLayoutEffect.js +0 -16
- package/es/tntd-select/rc-select/hooks/useLayoutEffect.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useLock.js +0 -25
- package/es/tntd-select/rc-select/hooks/useLock.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useOptions.js +0 -43
- package/es/tntd-select/rc-select/hooks/useOptions.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useRefFunc.js +0 -13
- package/es/tntd-select/rc-select/hooks/useRefFunc.js.map +0 -1
- package/es/tntd-select/rc-select/hooks/useSelectTriggerControl.js +0 -28
- package/es/tntd-select/rc-select/hooks/useSelectTriggerControl.js.map +0 -1
- package/es/tntd-select/rc-select/index.js +0 -7
- package/es/tntd-select/rc-select/index.js.map +0 -1
- package/es/tntd-select/rc-select/interface.js +0 -1
- package/es/tntd-select/rc-select/interface.js.map +0 -1
- package/es/tntd-select/rc-select/utils/commonUtil.js +0 -30
- package/es/tntd-select/rc-select/utils/commonUtil.js.map +0 -1
- package/es/tntd-select/rc-select/utils/keyUtil.js +0 -9
- package/es/tntd-select/rc-select/utils/keyUtil.js.map +0 -1
- package/es/tntd-select/rc-select/utils/legacyUtil.js +0 -55
- package/es/tntd-select/rc-select/utils/legacyUtil.js.map +0 -1
- package/es/tntd-select/rc-select/utils/platformUtil.js +0 -4
- package/es/tntd-select/rc-select/utils/platformUtil.js.map +0 -1
- package/es/tntd-select/rc-select/utils/valueUtil.js +0 -112
- package/es/tntd-select/rc-select/utils/valueUtil.js.map +0 -1
- package/es/tntd-select/rc-select/utils/warningPropsUtil.js +0 -112
- package/es/tntd-select/rc-select/utils/warningPropsUtil.js.map +0 -1
- package/es/tooltip/style/index.less +0 -187
- package/es/transfer/style/customize.less +0 -62
- package/es/transfer/style/index.less +0 -191
- package/es/tree/style/directory.less +0 -95
- package/es/tree/style/index.less +0 -280
- package/es/tree/style/mixin.less +0 -29
- package/es/tree-select/style/index.less +0 -191
- package/es/typography/style/index.less +0 -204
- package/es/upload/style/index.less +0 -542
- package/lib/affix/style/index.less +0 -6
- package/lib/alert/style/index.less +0 -188
- package/lib/anchor/style/index.less +0 -82
- package/lib/auto-complete/style/index.less +0 -92
- package/lib/avatar/style/index.less +0 -59
- package/lib/back-top/style/index.less +0 -42
- package/lib/back-top/style/responsive.less +0 -11
- package/lib/badge/style/index.less +0 -190
- package/lib/breadcrumb/style/index.less +0 -51
- package/lib/button/style/index.less +0 -224
- package/lib/button/style/mixin.less +0 -357
- package/lib/calendar/style/index.less +0 -278
- package/lib/card/style/index.less +0 -263
- package/lib/card/style/size.less +0 -25
- package/lib/carousel/style/index.less +0 -238
- package/lib/cascader/style/index.less +0 -227
- package/lib/checkbox/style/index.less +0 -4
- package/lib/checkbox/style/mixin.less +0 -220
- package/lib/collapse/style/index.less +0 -134
- package/lib/comment/style/index.less +0 -93
- package/lib/config-provider/style/index.less +0 -2
- package/lib/date-picker/style/Calendar.less +0 -402
- package/lib/date-picker/style/DecadePanel.less +0 -81
- package/lib/date-picker/style/MonthPanel.less +0 -86
- package/lib/date-picker/style/MonthPicker.less +0 -11
- package/lib/date-picker/style/Picker.less +0 -113
- package/lib/date-picker/style/RangePicker.less +0 -248
- package/lib/date-picker/style/TimePicker.less +0 -151
- package/lib/date-picker/style/WeekPicker.less +0 -21
- package/lib/date-picker/style/YearPanel.less +0 -85
- package/lib/date-picker/style/index.less +0 -17
- package/lib/descriptions/style/index.less +0 -144
- package/lib/divider/style/index.less +0 -109
- package/lib/drawer/style/drawer.less +0 -230
- package/lib/drawer/style/index.less +0 -3
- package/lib/dropdown/style/index.less +0 -282
- package/lib/empty/style/index.less +0 -52
- package/lib/form/style/index.less +0 -653
- package/lib/form/style/mixin.less +0 -126
- package/lib/grid-v4/style/index.less +0 -124
- package/lib/grid-v4/style/mixin.less +0 -57
- package/lib/grid-v4/style/rtl.less +0 -69
- package/lib/handle/handle.d.ts +0 -3
- package/lib/handle/handle.d.ts.map +0 -1
- package/lib/handle/handle.js +0 -181
- package/lib/handle/handle.js.map +0 -1
- package/lib/icon/style/index.less +0 -4
- package/lib/input/style/index.less +0 -57
- package/lib/input/style/mixin.less +0 -449
- package/lib/input/style/search-input.less +0 -34
- package/lib/input-number/style/index.less +0 -179
- package/lib/layout/style/index.less +0 -124
- package/lib/layout/style/light.less +0 -15
- package/lib/list/style/bordered.less +0 -41
- package/lib/list/style/index.less +0 -234
- package/lib/list/style/responsive.less +0 -40
- package/lib/locale-provider/style/index.less +0 -2
- package/lib/mention/index.js +0 -25
- package/lib/mentions/style/index.less +0 -164
- package/lib/menu/style/dark.less +0 -139
- package/lib/menu/style/index.less +0 -515
- package/lib/message/style/index.less +0 -75
- package/lib/modal/style/confirm.less +0 -78
- package/lib/modal/style/index.less +0 -4
- package/lib/modal/style/modal.less +0 -165
- package/lib/notification/style/index.less +0 -199
- package/lib/page-header/style/index.less +0 -119
- package/lib/pagination/style/index.less +0 -400
- package/lib/popover/style/index.less +0 -205
- package/lib/progress/style/index.less +0 -182
- package/lib/radio/style/index.less +0 -327
- package/lib/rate/style/index.less +0 -85
- package/lib/result/style/index.less +0 -71
- package/lib/select/style/index.less +0 -604
- package/lib/skeleton/style/index.less +0 -130
- package/lib/slider/style/index.less +0 -197
- package/lib/spin/style/index.less +0 -214
- package/lib/statistic/style/index.less +0 -40
- package/lib/steps/style/compatibility.less +0 -50
- package/lib/steps/style/custom-icon.less +0 -31
- package/lib/steps/style/label-placement.less +0 -38
- package/lib/steps/style/progress-dot.less +0 -80
- package/lib/steps/style/vertical.less +0 -74
- package/lib/style/color/bezierEasing.less +0 -110
- package/lib/style/color/colorPalette.less +0 -75
- package/lib/style/color/colors.less +0 -149
- package/lib/style/color/tinyColor.less +0 -1184
- package/lib/style/core/base.less +0 -510
- package/lib/style/core/iconfont.less +0 -19
- package/lib/style/core/index.less +0 -4
- package/lib/style/core/motion/fade.less +0 -31
- package/lib/style/core/motion/move.less +0 -120
- package/lib/style/core/motion/other.less +0 -40
- package/lib/style/core/motion/slide.less +0 -120
- package/lib/style/core/motion/swing.less +0 -34
- package/lib/style/core/motion/zoom.less +0 -162
- package/lib/style/core/motion.less +0 -20
- package/lib/style/index.less +0 -2
- package/lib/style/mixins/clearfix.less +0 -13
- package/lib/style/mixins/compatibility.less +0 -22
- package/lib/style/mixins/iconfont.less +0 -43
- package/lib/style/mixins/index.less +0 -10
- package/lib/style/mixins/motion.less +0 -35
- package/lib/style/mixins/operation-unit.less +0 -18
- package/lib/style/mixins/reset.less +0 -13
- package/lib/style/mixins/size.less +0 -10
- package/lib/style/mixins/typography.less +0 -49
- package/lib/style/themes/default.less +0 -699
- package/lib/style/themes/index.less +0 -1
- package/lib/style/v2-compatible-reset.less +0 -51
- package/lib/switch/style/index.less +0 -178
- package/lib/table/style/index.less +0 -800
- package/lib/table/style/size.less +0 -179
- package/lib/tabs/style/card-style.less +0 -186
- package/lib/tabs/style/index.less +0 -436
- package/lib/tag/style/index.less +0 -106
- package/lib/time-picker/style/index.less +0 -246
- package/lib/timeline/style/index.less +0 -167
- package/lib/tntd-form/TntdForm/components/Item.js +0 -65
- package/lib/tntd-form/TntdForm/components/ItemComp.js +0 -215
- package/lib/tntd-form/TntdForm/components/List.js +0 -123
- package/lib/tntd-form/TntdForm/index.js +0 -72
- package/lib/tntd-form/TntdForm/interface.js +0 -5
- package/lib/tntd-form/TntdForm/store.js +0 -10
- package/lib/tntd-form/TntdForm/utils.js +0 -239
- package/lib/tntd-form/_util/motion.d.ts +0 -9
- package/lib/tntd-form/_util/motion.d.ts.map +0 -1
- package/lib/tntd-form/_util/motion.js +0 -59
- package/lib/tntd-form/_util/motion.js.map +0 -1
- package/lib/tntd-form/_util/reactNode.d.ts +0 -9
- package/lib/tntd-form/_util/reactNode.d.ts.map +0 -1
- package/lib/tntd-form/_util/reactNode.js +0 -27
- package/lib/tntd-form/_util/reactNode.js.map +0 -1
- package/lib/tntd-form/_util/scrollTo.d.ts +0 -1
- package/lib/tntd-form/_util/scrollTo.d.ts.map +0 -1
- package/lib/tntd-form/_util/scrollTo.js +0 -35
- package/lib/tntd-form/_util/scrollTo.js.map +0 -1
- package/lib/tntd-form/_util/type.d.ts +0 -4
- package/lib/tntd-form/_util/type.d.ts.map +0 -1
- package/lib/tntd-form/_util/type.js +0 -21
- package/lib/tntd-form/_util/type.js.map +0 -1
- package/lib/tntd-form/_util/warning.d.ts +0 -5
- package/lib/tntd-form/_util/warning.d.ts.map +0 -1
- package/lib/tntd-form/_util/warning.js +0 -20
- package/lib/tntd-form/_util/warning.js.map +0 -1
- package/lib/tntd-form/_util/wave.d.ts +0 -1
- package/lib/tntd-form/_util/wave.d.ts.map +0 -1
- package/lib/tntd-form/_util/wave.js +0 -168
- package/lib/tntd-form/_util/wave.js.map +0 -1
- package/lib/tntd-form/tntd-form.stories.d.ts +0 -33
- package/lib/tntd-form/tntd-form.stories.d.ts.map +0 -1
- package/lib/tntd-form/tntd-form.stories.js +0 -943
- package/lib/tntd-form/tntd-form.stories.js.map +0 -1
- package/lib/tntd-select/_util/DisabledContext.d.ts +0 -10
- package/lib/tntd-select/_util/DisabledContext.d.ts.map +0 -1
- package/lib/tntd-select/_util/DisabledContext.js +0 -22
- package/lib/tntd-select/_util/DisabledContext.js.map +0 -1
- package/lib/tntd-select/_util/FormItemInputContext.d.ts +0 -4
- package/lib/tntd-select/_util/FormItemInputContext.d.ts.map +0 -1
- package/lib/tntd-select/_util/FormItemInputContext.js +0 -12
- package/lib/tntd-select/_util/FormItemInputContext.js.map +0 -1
- package/lib/tntd-select/_util/PurePanel.d.ts +0 -9
- package/lib/tntd-select/_util/PurePanel.d.ts.map +0 -1
- package/lib/tntd-select/_util/PurePanel.js +0 -90
- package/lib/tntd-select/_util/PurePanel.js.map +0 -1
- package/lib/tntd-select/_util/SizeContext.d.ts +0 -4
- package/lib/tntd-select/_util/SizeContext.d.ts.map +0 -1
- package/lib/tntd-select/_util/SizeContext.js +0 -12
- package/lib/tntd-select/_util/SizeContext.js.map +0 -1
- package/lib/tntd-select/_util/context.d.ts +0 -42
- package/lib/tntd-select/_util/context.d.ts.map +0 -1
- package/lib/tntd-select/_util/context.js +0 -22
- package/lib/tntd-select/_util/context.js.map +0 -1
- package/lib/tntd-select/_util/defaultRenderEmpty.d.ts +0 -5
- package/lib/tntd-select/_util/defaultRenderEmpty.d.ts.map +0 -1
- package/lib/tntd-select/_util/defaultRenderEmpty.js +0 -44
- package/lib/tntd-select/_util/defaultRenderEmpty.js.map +0 -1
- package/lib/tntd-select/_util/getIcons.d.ts +0 -25
- package/lib/tntd-select/_util/getIcons.d.ts.map +0 -1
- package/lib/tntd-select/_util/getIcons.js +0 -84
- package/lib/tntd-select/_util/getIcons.js.map +0 -1
- package/lib/tntd-select/_util/interface.d.ts +0 -25
- package/lib/tntd-select/_util/interface.d.ts.map +0 -1
- package/lib/tntd-select/_util/interface.js +0 -16
- package/lib/tntd-select/_util/interface.js.map +0 -1
- package/lib/tntd-select/_util/motion.d.ts +0 -9
- package/lib/tntd-select/_util/motion.d.ts.map +0 -1
- package/lib/tntd-select/_util/motion.js +0 -59
- package/lib/tntd-select/_util/motion.js.map +0 -1
- package/lib/tntd-select/_util/type.d.ts +0 -10
- package/lib/tntd-select/_util/type.d.ts.map +0 -1
- package/lib/tntd-select/_util/type.js +0 -21
- package/lib/tntd-select/_util/type.js.map +0 -1
- package/lib/tntd-select/_util/useCompactItemContext.d.ts +0 -9
- package/lib/tntd-select/_util/useCompactItemContext.d.ts.map +0 -1
- package/lib/tntd-select/_util/useCompactItemContext.js +0 -35
- package/lib/tntd-select/_util/useCompactItemContext.js.map +0 -1
- package/lib/tntd-select/_util/warning.d.ts +0 -4
- package/lib/tntd-select/_util/warning.d.ts.map +0 -1
- package/lib/tntd-select/_util/warning.js +0 -24
- package/lib/tntd-select/_util/warning.js.map +0 -1
- package/lib/tntd-select/rc-select/BaseSelect.d.ts +0 -114
- package/lib/tntd-select/rc-select/BaseSelect.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/BaseSelect.js +0 -566
- package/lib/tntd-select/rc-select/BaseSelect.js.map +0 -1
- package/lib/tntd-select/rc-select/OptGroup.d.ts +0 -13
- package/lib/tntd-select/rc-select/OptGroup.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/OptGroup.js +0 -13
- package/lib/tntd-select/rc-select/OptGroup.js.map +0 -1
- package/lib/tntd-select/rc-select/Option.d.ts +0 -15
- package/lib/tntd-select/rc-select/Option.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/Option.js +0 -13
- package/lib/tntd-select/rc-select/Option.js.map +0 -1
- package/lib/tntd-select/rc-select/OptionList.d.ts +0 -11
- package/lib/tntd-select/rc-select/OptionList.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/OptionList.js +0 -372
- package/lib/tntd-select/rc-select/OptionList.js.map +0 -1
- package/lib/tntd-select/rc-select/Select.d.ts +0 -115
- package/lib/tntd-select/rc-select/Select.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/Select.js +0 -509
- package/lib/tntd-select/rc-select/Select.js.map +0 -1
- package/lib/tntd-select/rc-select/SelectContext.d.ts +0 -23
- package/lib/tntd-select/rc-select/SelectContext.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/SelectContext.js +0 -13
- package/lib/tntd-select/rc-select/SelectContext.js.map +0 -1
- package/lib/tntd-select/rc-select/SelectTrigger.d.ts +0 -31
- package/lib/tntd-select/rc-select/SelectTrigger.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/SelectTrigger.js +0 -149
- package/lib/tntd-select/rc-select/SelectTrigger.js.map +0 -1
- package/lib/tntd-select/rc-select/Selector/Input.d.ts +0 -27
- package/lib/tntd-select/rc-select/Selector/Input.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/Selector/Input.js +0 -110
- package/lib/tntd-select/rc-select/Selector/Input.js.map +0 -1
- package/lib/tntd-select/rc-select/Selector/MultipleSelector.d.ts +0 -17
- package/lib/tntd-select/rc-select/Selector/MultipleSelector.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/Selector/MultipleSelector.js +0 -193
- package/lib/tntd-select/rc-select/Selector/MultipleSelector.js.map +0 -1
- package/lib/tntd-select/rc-select/Selector/SingleSelector.d.ts +0 -9
- package/lib/tntd-select/rc-select/Selector/SingleSelector.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/Selector/SingleSelector.js +0 -116
- package/lib/tntd-select/rc-select/Selector/SingleSelector.js.map +0 -1
- package/lib/tntd-select/rc-select/Selector/index.d.ts +0 -83
- package/lib/tntd-select/rc-select/Selector/index.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/Selector/index.js +0 -159
- package/lib/tntd-select/rc-select/Selector/index.js.map +0 -1
- package/lib/tntd-select/rc-select/TransBtn.d.ts +0 -13
- package/lib/tntd-select/rc-select/TransBtn.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/TransBtn.js +0 -48
- package/lib/tntd-select/rc-select/TransBtn.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useAllowClear.d.ts +0 -9
- package/lib/tntd-select/rc-select/hooks/useAllowClear.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useAllowClear.js +0 -35
- package/lib/tntd-select/rc-select/hooks/useAllowClear.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useBaseProps.d.ts +0 -14
- package/lib/tntd-select/rc-select/hooks/useBaseProps.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useBaseProps.js +0 -21
- package/lib/tntd-select/rc-select/hooks/useBaseProps.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useCache.d.ts +0 -8
- package/lib/tntd-select/rc-select/hooks/useCache.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useCache.js +0 -49
- package/lib/tntd-select/rc-select/hooks/useCache.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useDelayReset.d.ts +0 -6
- package/lib/tntd-select/rc-select/hooks/useDelayReset.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useDelayReset.js +0 -44
- package/lib/tntd-select/rc-select/hooks/useDelayReset.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useFilterOptions.d.ts +0 -4
- package/lib/tntd-select/rc-select/hooks/useFilterOptions.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useFilterOptions.js +0 -72
- package/lib/tntd-select/rc-select/hooks/useFilterOptions.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useId.d.ts +0 -6
- package/lib/tntd-select/rc-select/hooks/useId.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useId.js +0 -48
- package/lib/tntd-select/rc-select/hooks/useId.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useLayoutEffect.d.ts +0 -6
- package/lib/tntd-select/rc-select/hooks/useLayoutEffect.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useLayoutEffect.js +0 -26
- package/lib/tntd-select/rc-select/hooks/useLayoutEffect.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useLock.d.ts +0 -8
- package/lib/tntd-select/rc-select/hooks/useLock.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useLock.js +0 -39
- package/lib/tntd-select/rc-select/hooks/useLock.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useOptions.d.ts +0 -12
- package/lib/tntd-select/rc-select/hooks/useOptions.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useOptions.js +0 -53
- package/lib/tntd-select/rc-select/hooks/useOptions.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useRefFunc.d.ts +0 -6
- package/lib/tntd-select/rc-select/hooks/useRefFunc.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useRefFunc.js +0 -22
- package/lib/tntd-select/rc-select/hooks/useRefFunc.js.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useSelectTriggerControl.d.ts +0 -2
- package/lib/tntd-select/rc-select/hooks/useSelectTriggerControl.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/hooks/useSelectTriggerControl.js +0 -43
- package/lib/tntd-select/rc-select/hooks/useSelectTriggerControl.js.map +0 -1
- package/lib/tntd-select/rc-select/index.d.ts +0 -11
- package/lib/tntd-select/rc-select/index.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/index.js +0 -38
- package/lib/tntd-select/rc-select/index.js.map +0 -1
- package/lib/tntd-select/rc-select/interface.d.ts +0 -23
- package/lib/tntd-select/rc-select/interface.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/interface.js +0 -5
- package/lib/tntd-select/rc-select/interface.js.map +0 -1
- package/lib/tntd-select/rc-select/utils/commonUtil.d.ts +0 -10
- package/lib/tntd-select/rc-select/utils/commonUtil.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/utils/commonUtil.js +0 -43
- package/lib/tntd-select/rc-select/utils/commonUtil.js.map +0 -1
- package/lib/tntd-select/rc-select/utils/keyUtil.d.ts +0 -3
- package/lib/tntd-select/rc-select/utils/keyUtil.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/utils/keyUtil.js +0 -16
- package/lib/tntd-select/rc-select/utils/keyUtil.js.map +0 -1
- package/lib/tntd-select/rc-select/utils/legacyUtil.d.ts +0 -4
- package/lib/tntd-select/rc-select/utils/legacyUtil.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/utils/legacyUtil.js +0 -60
- package/lib/tntd-select/rc-select/utils/legacyUtil.js.map +0 -1
- package/lib/tntd-select/rc-select/utils/platformUtil.d.ts +0 -2
- package/lib/tntd-select/rc-select/utils/platformUtil.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/utils/platformUtil.js +0 -10
- package/lib/tntd-select/rc-select/utils/platformUtil.js.map +0 -1
- package/lib/tntd-select/rc-select/utils/valueUtil.d.ts +0 -24
- package/lib/tntd-select/rc-select/utils/valueUtil.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/utils/valueUtil.js +0 -132
- package/lib/tntd-select/rc-select/utils/valueUtil.js.map +0 -1
- package/lib/tntd-select/rc-select/utils/warningPropsUtil.d.ts +0 -5
- package/lib/tntd-select/rc-select/utils/warningPropsUtil.d.ts.map +0 -1
- package/lib/tntd-select/rc-select/utils/warningPropsUtil.js +0 -127
- package/lib/tntd-select/rc-select/utils/warningPropsUtil.js.map +0 -1
- package/lib/tooltip/style/index.less +0 -187
- package/lib/transfer/style/customize.less +0 -62
- package/lib/transfer/style/index.less +0 -191
- package/lib/tree/style/directory.less +0 -95
- package/lib/tree/style/index.less +0 -280
- package/lib/tree/style/mixin.less +0 -29
- package/lib/tree-select/style/index.less +0 -191
- package/lib/typography/style/index.less +0 -204
- package/lib/upload/style/index.less +0 -542
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* To match accessibility requirement, we always provide an input in the component.
|
|
3
|
-
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
|
4
|
-
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
|
5
|
-
*
|
|
6
|
-
* ref:
|
|
7
|
-
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
|
8
|
-
*
|
|
9
|
-
* New api:
|
|
10
|
-
* - listHeight
|
|
11
|
-
* - listItemHeight
|
|
12
|
-
* - component
|
|
13
|
-
*
|
|
14
|
-
* Remove deprecated api:
|
|
15
|
-
* - multiple
|
|
16
|
-
* - tags
|
|
17
|
-
* - combobox
|
|
18
|
-
* - firstActiveValue
|
|
19
|
-
* - dropdownMenuStyle
|
|
20
|
-
* - openClassName (Not list in api)
|
|
21
|
-
*
|
|
22
|
-
* Update:
|
|
23
|
-
* - `backfill` only support `combobox` mode
|
|
24
|
-
* - `combobox` mode not support `labelInValue` since it's meaningless
|
|
25
|
-
* - `getInputElement` only support `combobox` mode
|
|
26
|
-
* - `onChange` return OptionData instead of ReactNode
|
|
27
|
-
* - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
|
|
28
|
-
* - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
|
|
29
|
-
* - `combobox` mode not support `optionLabelProp`
|
|
30
|
-
*/
|
|
31
|
-
var __rest = this && this.__rest || function (s, e) {
|
|
32
|
-
var t = {};
|
|
33
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
34
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
35
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
36
|
-
}
|
|
37
|
-
return t;
|
|
38
|
-
};
|
|
39
|
-
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
40
|
-
import warning from 'rc-util/lib/warning';
|
|
41
|
-
import * as React from 'react';
|
|
42
|
-
import BaseSelect, { isMultiple } from './BaseSelect';
|
|
43
|
-
import OptGroup from './OptGroup';
|
|
44
|
-
import Option from './Option';
|
|
45
|
-
import OptionList from './OptionList';
|
|
46
|
-
import SelectContext from './SelectContext';
|
|
47
|
-
import useCache from './hooks/useCache';
|
|
48
|
-
import useFilterOptions from './hooks/useFilterOptions';
|
|
49
|
-
import useId from './hooks/useId';
|
|
50
|
-
import useOptions from './hooks/useOptions';
|
|
51
|
-
import useRefFunc from './hooks/useRefFunc';
|
|
52
|
-
import { hasValue, isComboNoValue, toArray } from './utils/commonUtil';
|
|
53
|
-
import { fillFieldNames, flattenOptions, injectPropsWithOption } from './utils/valueUtil';
|
|
54
|
-
import warningProps, { warningNullOptions } from './utils/warningPropsUtil';
|
|
55
|
-
const OMIT_DOM_PROPS = ['inputValue'];
|
|
56
|
-
function isRawValue(value) {
|
|
57
|
-
return !value || typeof value !== 'object';
|
|
58
|
-
}
|
|
59
|
-
const Select = React.forwardRef((props, ref) => {
|
|
60
|
-
const {
|
|
61
|
-
id,
|
|
62
|
-
mode,
|
|
63
|
-
prefixCls = 'rc-select',
|
|
64
|
-
backfill,
|
|
65
|
-
fieldNames,
|
|
66
|
-
// Search
|
|
67
|
-
inputValue,
|
|
68
|
-
searchValue,
|
|
69
|
-
onSearch,
|
|
70
|
-
autoClearSearchValue = true,
|
|
71
|
-
// Select
|
|
72
|
-
onSelect,
|
|
73
|
-
onDeselect,
|
|
74
|
-
dropdownMatchSelectWidth = true,
|
|
75
|
-
// Options
|
|
76
|
-
filterOption,
|
|
77
|
-
filterSort,
|
|
78
|
-
optionFilterProp,
|
|
79
|
-
optionLabelProp,
|
|
80
|
-
options,
|
|
81
|
-
optionRender,
|
|
82
|
-
children,
|
|
83
|
-
defaultActiveFirstOption,
|
|
84
|
-
menuItemSelectedIcon,
|
|
85
|
-
virtual,
|
|
86
|
-
direction,
|
|
87
|
-
listHeight = 200,
|
|
88
|
-
listItemHeight = 20,
|
|
89
|
-
// Value
|
|
90
|
-
value,
|
|
91
|
-
defaultValue,
|
|
92
|
-
labelInValue,
|
|
93
|
-
onChange
|
|
94
|
-
} = props,
|
|
95
|
-
restProps = __rest(props, ["id", "mode", "prefixCls", "backfill", "fieldNames", "inputValue", "searchValue", "onSearch", "autoClearSearchValue", "onSelect", "onDeselect", "dropdownMatchSelectWidth", "filterOption", "filterSort", "optionFilterProp", "optionLabelProp", "options", "optionRender", "children", "defaultActiveFirstOption", "menuItemSelectedIcon", "virtual", "direction", "listHeight", "listItemHeight", "value", "defaultValue", "labelInValue", "onChange"]);
|
|
96
|
-
const mergedId = useId(id);
|
|
97
|
-
const multiple = isMultiple(mode);
|
|
98
|
-
const childrenAsData = !!(!options && children);
|
|
99
|
-
const mergedFilterOption = React.useMemo(() => {
|
|
100
|
-
if (filterOption === undefined && mode === 'combobox') {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
return filterOption;
|
|
104
|
-
}, [filterOption, mode]);
|
|
105
|
-
// ========================= FieldNames =========================
|
|
106
|
-
const mergedFieldNames = React.useMemo(() => fillFieldNames(fieldNames, childrenAsData), /* eslint-disable react-hooks/exhaustive-deps */
|
|
107
|
-
[
|
|
108
|
-
// We stringify fieldNames to avoid unnecessary re-renders.
|
|
109
|
-
JSON.stringify(fieldNames), childrenAsData]);
|
|
110
|
-
// =========================== Search ===========================
|
|
111
|
-
const [mergedSearchValue, setSearchValue] = useMergedState('', {
|
|
112
|
-
value: searchValue !== undefined ? searchValue : inputValue,
|
|
113
|
-
postState: search => search || ''
|
|
114
|
-
});
|
|
115
|
-
// =========================== Option ===========================
|
|
116
|
-
const parsedOptions = useOptions(options, children, mergedFieldNames, optionFilterProp, optionLabelProp);
|
|
117
|
-
const {
|
|
118
|
-
valueOptions,
|
|
119
|
-
labelOptions,
|
|
120
|
-
options: mergedOptions
|
|
121
|
-
} = parsedOptions;
|
|
122
|
-
// ========================= Wrap Value =========================
|
|
123
|
-
const convert2LabelValues = React.useCallback(draftValues => {
|
|
124
|
-
// Convert to array
|
|
125
|
-
const valueList = toArray(draftValues);
|
|
126
|
-
// Convert to labelInValue type
|
|
127
|
-
return valueList.map(val => {
|
|
128
|
-
var _a, _b;
|
|
129
|
-
let rawValue;
|
|
130
|
-
let rawLabel;
|
|
131
|
-
let rawKey;
|
|
132
|
-
let rawDisabled;
|
|
133
|
-
let rawTitle;
|
|
134
|
-
// Fill label & value
|
|
135
|
-
if (isRawValue(val)) {
|
|
136
|
-
rawValue = val;
|
|
137
|
-
} else {
|
|
138
|
-
rawKey = val.key;
|
|
139
|
-
rawLabel = val.label;
|
|
140
|
-
rawValue = (_a = val.value) !== null && _a !== void 0 ? _a : rawKey;
|
|
141
|
-
}
|
|
142
|
-
const option = valueOptions.get(rawValue);
|
|
143
|
-
if (option) {
|
|
144
|
-
// Fill missing props
|
|
145
|
-
if (rawLabel === undefined) rawLabel = option === null || option === void 0 ? void 0 : option[optionLabelProp || mergedFieldNames.label];
|
|
146
|
-
if (rawKey === undefined) rawKey = (_b = option === null || option === void 0 ? void 0 : option.key) !== null && _b !== void 0 ? _b : rawValue;
|
|
147
|
-
rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
|
|
148
|
-
rawTitle = option === null || option === void 0 ? void 0 : option.title;
|
|
149
|
-
// Warning if label not same as provided
|
|
150
|
-
if (process.env.NODE_ENV !== 'production' && !optionLabelProp) {
|
|
151
|
-
const optionLabel = option === null || option === void 0 ? void 0 : option[mergedFieldNames.label];
|
|
152
|
-
if (optionLabel !== undefined && !React.isValidElement(optionLabel) && !React.isValidElement(rawLabel) && optionLabel !== rawLabel) {
|
|
153
|
-
warning(false, '`label` of `value` is not same as `label` in Select options.');
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
label: rawLabel,
|
|
159
|
-
value: rawValue,
|
|
160
|
-
key: rawKey,
|
|
161
|
-
disabled: rawDisabled,
|
|
162
|
-
title: rawTitle
|
|
163
|
-
};
|
|
164
|
-
});
|
|
165
|
-
}, [mergedFieldNames, optionLabelProp, valueOptions]);
|
|
166
|
-
// =========================== Values ===========================
|
|
167
|
-
const [internalValue, setInternalValue] = useMergedState(defaultValue, {
|
|
168
|
-
value
|
|
169
|
-
});
|
|
170
|
-
// Merged value with LabelValueType
|
|
171
|
-
const rawLabeledValues = React.useMemo(() => {
|
|
172
|
-
var _a;
|
|
173
|
-
const values = convert2LabelValues(internalValue);
|
|
174
|
-
// combobox no need save value when it's no value (exclude value equal 0)
|
|
175
|
-
if (mode === 'combobox' && isComboNoValue((_a = values[0]) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
176
|
-
return [];
|
|
177
|
-
}
|
|
178
|
-
return values;
|
|
179
|
-
}, [internalValue, convert2LabelValues, mode]);
|
|
180
|
-
// Fill label with cache to avoid option remove
|
|
181
|
-
const [mergedValues, getMixedOption] = useCache(rawLabeledValues, valueOptions);
|
|
182
|
-
const displayValues = React.useMemo(() => {
|
|
183
|
-
// `null` need show as placeholder instead
|
|
184
|
-
// https://github.com/ant-design/ant-design/issues/25057
|
|
185
|
-
if (!mode && mergedValues.length === 1) {
|
|
186
|
-
const firstValue = mergedValues[0];
|
|
187
|
-
if (firstValue.value === null && (firstValue.label === null || firstValue.label === undefined)) {
|
|
188
|
-
return [];
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return mergedValues.map(item => {
|
|
192
|
-
var _a;
|
|
193
|
-
return Object.assign(Object.assign({}, item), {
|
|
194
|
-
label: (_a = item.label) !== null && _a !== void 0 ? _a : item.value
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
}, [mode, mergedValues]);
|
|
198
|
-
/** Convert `displayValues` to raw value type set */
|
|
199
|
-
const rawValues = React.useMemo(() => new Set(mergedValues.map(val => val.value)), [mergedValues]);
|
|
200
|
-
React.useEffect(() => {
|
|
201
|
-
var _a;
|
|
202
|
-
if (mode === 'combobox') {
|
|
203
|
-
const strValue = (_a = mergedValues[0]) === null || _a === void 0 ? void 0 : _a.value;
|
|
204
|
-
setSearchValue(hasValue(strValue) ? String(strValue) : '');
|
|
205
|
-
}
|
|
206
|
-
}, [mergedValues]);
|
|
207
|
-
// ======================= Display Option =======================
|
|
208
|
-
// Create a placeholder item if not exist in `options`
|
|
209
|
-
const createTagOption = useRefFunc((val, label) => {
|
|
210
|
-
const mergedLabel = label !== null && label !== void 0 ? label : val;
|
|
211
|
-
return {
|
|
212
|
-
[mergedFieldNames.value]: val,
|
|
213
|
-
[mergedFieldNames.label]: mergedLabel
|
|
214
|
-
};
|
|
215
|
-
});
|
|
216
|
-
// Fill tag as option if mode is `tags`
|
|
217
|
-
const filledTagOptions = React.useMemo(() => {
|
|
218
|
-
if (mode !== 'tags') {
|
|
219
|
-
return mergedOptions;
|
|
220
|
-
}
|
|
221
|
-
// >>> Tag mode
|
|
222
|
-
const cloneOptions = [...mergedOptions];
|
|
223
|
-
// Check if value exist in options (include new patch item)
|
|
224
|
-
const existOptions = val => valueOptions.has(val);
|
|
225
|
-
// Fill current value as option
|
|
226
|
-
[...mergedValues].sort((a, b) => a.value < b.value ? -1 : 1).forEach(item => {
|
|
227
|
-
const val = item.value;
|
|
228
|
-
if (!existOptions(val)) {
|
|
229
|
-
cloneOptions.push(createTagOption(val, item.label));
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
return cloneOptions;
|
|
233
|
-
}, [createTagOption, mergedOptions, valueOptions, mergedValues, mode]);
|
|
234
|
-
const filteredOptions = useFilterOptions(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, optionFilterProp);
|
|
235
|
-
// Fill options with search value if needed
|
|
236
|
-
const filledSearchOptions = React.useMemo(() => {
|
|
237
|
-
if (mode !== 'tags' || !mergedSearchValue || filteredOptions.some(item => item[optionFilterProp || 'value'] === mergedSearchValue)) {
|
|
238
|
-
return filteredOptions;
|
|
239
|
-
}
|
|
240
|
-
// ignore when search value equal select input value
|
|
241
|
-
if (filteredOptions.some(item => item[mergedFieldNames.value] === mergedSearchValue)) {
|
|
242
|
-
return filteredOptions;
|
|
243
|
-
}
|
|
244
|
-
// Fill search value as option
|
|
245
|
-
return [createTagOption(mergedSearchValue), ...filteredOptions];
|
|
246
|
-
}, [createTagOption, optionFilterProp, mode, filteredOptions, mergedSearchValue, mergedFieldNames]);
|
|
247
|
-
const orderedFilteredOptions = React.useMemo(() => {
|
|
248
|
-
if (!filterSort) {
|
|
249
|
-
return filledSearchOptions;
|
|
250
|
-
}
|
|
251
|
-
return [...filledSearchOptions].sort((a, b) => filterSort(a, b));
|
|
252
|
-
}, [filledSearchOptions, filterSort]);
|
|
253
|
-
const displayOptions = React.useMemo(() => flattenOptions(orderedFilteredOptions, {
|
|
254
|
-
fieldNames: mergedFieldNames,
|
|
255
|
-
childrenAsData
|
|
256
|
-
}), [orderedFilteredOptions, mergedFieldNames, childrenAsData]);
|
|
257
|
-
// =========================== Change ===========================
|
|
258
|
-
const triggerChange = values => {
|
|
259
|
-
const labeledValues = convert2LabelValues(values);
|
|
260
|
-
setInternalValue(labeledValues);
|
|
261
|
-
if (onChange && (
|
|
262
|
-
// Trigger event only when value changed
|
|
263
|
-
labeledValues.length !== mergedValues.length || labeledValues.some((newVal, index) => {
|
|
264
|
-
var _a;
|
|
265
|
-
return ((_a = mergedValues[index]) === null || _a === void 0 ? void 0 : _a.value) !== (newVal === null || newVal === void 0 ? void 0 : newVal.value);
|
|
266
|
-
}))) {
|
|
267
|
-
const returnValues = labelInValue ? labeledValues : labeledValues.map(v => v.value);
|
|
268
|
-
const returnOptions = labeledValues.map(v => injectPropsWithOption(getMixedOption(v.value)));
|
|
269
|
-
onChange(
|
|
270
|
-
// Value
|
|
271
|
-
multiple ? returnValues : returnValues[0],
|
|
272
|
-
// Option
|
|
273
|
-
multiple ? returnOptions : returnOptions[0]);
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
// ======================= Accessibility ========================
|
|
277
|
-
const [activeValue, setActiveValue] = React.useState(null);
|
|
278
|
-
const [accessibilityIndex, setAccessibilityIndex] = React.useState(0);
|
|
279
|
-
const mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';
|
|
280
|
-
const onActiveValue = React.useCallback((active, index, {
|
|
281
|
-
source = 'keyboard'
|
|
282
|
-
} = {}) => {
|
|
283
|
-
setAccessibilityIndex(index);
|
|
284
|
-
if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {
|
|
285
|
-
setActiveValue(String(active));
|
|
286
|
-
}
|
|
287
|
-
}, [backfill, mode]);
|
|
288
|
-
// ========================= OptionList =========================
|
|
289
|
-
const triggerSelect = (val, selected, type) => {
|
|
290
|
-
const getSelectEnt = () => {
|
|
291
|
-
var _a;
|
|
292
|
-
const option = getMixedOption(val);
|
|
293
|
-
return [labelInValue ? {
|
|
294
|
-
label: option === null || option === void 0 ? void 0 : option[mergedFieldNames.label],
|
|
295
|
-
value: val,
|
|
296
|
-
key: (_a = option === null || option === void 0 ? void 0 : option.key) !== null && _a !== void 0 ? _a : val
|
|
297
|
-
} : val, injectPropsWithOption(option)];
|
|
298
|
-
};
|
|
299
|
-
if (selected && onSelect) {
|
|
300
|
-
const [wrappedValue, option] = getSelectEnt();
|
|
301
|
-
onSelect(wrappedValue, option);
|
|
302
|
-
} else if (!selected && onDeselect && type !== 'clear') {
|
|
303
|
-
const [wrappedValue, option] = getSelectEnt();
|
|
304
|
-
onDeselect(wrappedValue, option);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
// Used for OptionList selection
|
|
308
|
-
const onInternalSelect = useRefFunc((val, info) => {
|
|
309
|
-
let cloneValues;
|
|
310
|
-
// Single mode always trigger select only with option list
|
|
311
|
-
const mergedSelect = multiple ? info.selected : true;
|
|
312
|
-
if (mergedSelect) {
|
|
313
|
-
cloneValues = multiple ? [...mergedValues, val] : [val];
|
|
314
|
-
} else {
|
|
315
|
-
cloneValues = mergedValues.filter(v => v.value !== val);
|
|
316
|
-
}
|
|
317
|
-
triggerChange(cloneValues);
|
|
318
|
-
triggerSelect(val, mergedSelect);
|
|
319
|
-
// Clean search value if single or configured
|
|
320
|
-
if (mode === 'combobox') {
|
|
321
|
-
// setSearchValue(String(val));
|
|
322
|
-
setActiveValue('');
|
|
323
|
-
} else if (!isMultiple || autoClearSearchValue) {
|
|
324
|
-
setSearchValue('');
|
|
325
|
-
setActiveValue('');
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
// ======================= Display Change =======================
|
|
329
|
-
// BaseSelect display values change
|
|
330
|
-
const onDisplayValuesChange = (nextValues, info) => {
|
|
331
|
-
triggerChange(nextValues);
|
|
332
|
-
const {
|
|
333
|
-
type,
|
|
334
|
-
values
|
|
335
|
-
} = info;
|
|
336
|
-
if (type === 'remove' || type === 'clear') {
|
|
337
|
-
values.forEach(item => {
|
|
338
|
-
triggerSelect(item.value, false, type);
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
// =========================== Search ===========================
|
|
343
|
-
const onInternalSearch = (searchText, info) => {
|
|
344
|
-
setSearchValue(searchText);
|
|
345
|
-
setActiveValue(null);
|
|
346
|
-
// [Submit] Tag mode should flush input
|
|
347
|
-
if (info.source === 'submit') {
|
|
348
|
-
const formatted = (searchText || '').trim();
|
|
349
|
-
// prevent empty tags from appearing when you click the Enter button
|
|
350
|
-
if (formatted) {
|
|
351
|
-
const newRawValues = Array.from(new Set([...rawValues, formatted]));
|
|
352
|
-
triggerChange(newRawValues);
|
|
353
|
-
triggerSelect(formatted, true);
|
|
354
|
-
setSearchValue('');
|
|
355
|
-
}
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
if (info.source !== 'blur') {
|
|
359
|
-
if (mode === 'combobox') {
|
|
360
|
-
triggerChange(searchText);
|
|
361
|
-
}
|
|
362
|
-
onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchText);
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
const onInternalSearchSplit = words => {
|
|
366
|
-
let patchValues = words;
|
|
367
|
-
if (mode !== 'tags') {
|
|
368
|
-
patchValues = words.map(word => {
|
|
369
|
-
const opt = labelOptions.get(word);
|
|
370
|
-
return opt === null || opt === void 0 ? void 0 : opt.value;
|
|
371
|
-
}).filter(val => val !== undefined);
|
|
372
|
-
}
|
|
373
|
-
const newRawValues = Array.from(new Set([...rawValues, ...patchValues]));
|
|
374
|
-
triggerChange(newRawValues);
|
|
375
|
-
newRawValues.forEach(newRawValue => {
|
|
376
|
-
triggerSelect(newRawValue, true);
|
|
377
|
-
});
|
|
378
|
-
};
|
|
379
|
-
// ========================== Context ===========================
|
|
380
|
-
const selectContext = React.useMemo(() => {
|
|
381
|
-
const realVirtual = virtual !== false && dropdownMatchSelectWidth !== false;
|
|
382
|
-
return Object.assign(Object.assign({}, parsedOptions), {
|
|
383
|
-
flattenOptions: displayOptions,
|
|
384
|
-
onActiveValue,
|
|
385
|
-
defaultActiveFirstOption: mergedDefaultActiveFirstOption,
|
|
386
|
-
onSelect: onInternalSelect,
|
|
387
|
-
menuItemSelectedIcon,
|
|
388
|
-
rawValues,
|
|
389
|
-
fieldNames: mergedFieldNames,
|
|
390
|
-
virtual: realVirtual,
|
|
391
|
-
direction,
|
|
392
|
-
listHeight,
|
|
393
|
-
listItemHeight,
|
|
394
|
-
childrenAsData,
|
|
395
|
-
optionRender
|
|
396
|
-
});
|
|
397
|
-
}, [parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, childrenAsData, optionRender]);
|
|
398
|
-
// ========================== Warning ===========================
|
|
399
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
400
|
-
warningProps(props);
|
|
401
|
-
warningNullOptions(mergedOptions, mergedFieldNames);
|
|
402
|
-
}
|
|
403
|
-
// ==============================================================
|
|
404
|
-
// == Render ==
|
|
405
|
-
// ==============================================================
|
|
406
|
-
return React.createElement(SelectContext.Provider, {
|
|
407
|
-
value: selectContext
|
|
408
|
-
}, React.createElement(BaseSelect, Object.assign({}, restProps, {
|
|
409
|
-
// >>> MISC
|
|
410
|
-
id: mergedId,
|
|
411
|
-
prefixCls: prefixCls,
|
|
412
|
-
ref: ref,
|
|
413
|
-
omitDomProps: OMIT_DOM_PROPS,
|
|
414
|
-
mode: mode,
|
|
415
|
-
// >>> Values
|
|
416
|
-
displayValues: displayValues,
|
|
417
|
-
onDisplayValuesChange: onDisplayValuesChange,
|
|
418
|
-
// >>> Trigger
|
|
419
|
-
direction: direction,
|
|
420
|
-
// >>> Search
|
|
421
|
-
searchValue: mergedSearchValue,
|
|
422
|
-
onSearch: onInternalSearch,
|
|
423
|
-
autoClearSearchValue: autoClearSearchValue,
|
|
424
|
-
onSearchSplit: onInternalSearchSplit,
|
|
425
|
-
dropdownMatchSelectWidth: dropdownMatchSelectWidth,
|
|
426
|
-
// >>> OptionList
|
|
427
|
-
OptionList: OptionList,
|
|
428
|
-
emptyOptions: !displayOptions.length,
|
|
429
|
-
// >>> Accessibility
|
|
430
|
-
activeValue: activeValue,
|
|
431
|
-
activeDescendantId: `${mergedId}_list_${accessibilityIndex}`
|
|
432
|
-
})));
|
|
433
|
-
});
|
|
434
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
435
|
-
Select.displayName = 'Select';
|
|
436
|
-
}
|
|
437
|
-
const TypedSelect = Select;
|
|
438
|
-
TypedSelect.Option = Option;
|
|
439
|
-
TypedSelect.OptGroup = OptGroup;
|
|
440
|
-
export default TypedSelect;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/tntd-select/rc-select/Select.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;;;;;;;;;;AAEH,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,UAAU,EAAE,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,MAAM,eAAe,CAAC;AAClC,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,YAAY,EAAE,EAAE,kBAAkB,E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AwB;YAClD,iBAAiB;YACjB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,CAAC,cAAc,CAAC,MAAM;YACpC,oBAAoB;YACpB,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,GAAG,QAAQ,SAAS,kBAAkB,EAAE,IAC5D,CACqB,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;CAC/B;AAED,MAAM,WAAW,GAAG,MAUnB,CAAC;AAEF,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC;AAC5B,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAEhC,eAAe,WAAW,CAAC","sourcesContent":["/**\n * To match accessibility requirement, we always provide an input in the component.\n * Other element will not set `tabIndex` to avoid `onBlur` sequence problem.\n * For focused select, we set `aria-live=\"polite\"` to update the accessibility content.\n *\n * ref:\n * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions\n *\n * New api:\n * - listHeight\n * - listItemHeight\n * - component\n *\n * Remove deprecated api:\n * - multiple\n * - tags\n * - combobox\n * - firstActiveValue\n * - dropdownMenuStyle\n * - openClassName (Not list in api)\n *\n * Update:\n * - `backfill` only support `combobox` mode\n * - `combobox` mode not support `labelInValue` since it's meaningless\n * - `getInputElement` only support `combobox` mode\n * - `onChange` return OptionData instead of ReactNode\n * - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode\n * - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option\n * - `combobox` mode not support `optionLabelProp`\n */\n\nimport useMergedState from 'rc-util/lib/hooks/useMergedState';\nimport warning from 'rc-util/lib/warning';\nimport * as React from 'react';\nimport type {\n BaseSelectProps,\n BaseSelectPropsWithoutPrivate,\n BaseSelectRef,\n DisplayInfoType,\n DisplayValueType,\n RenderNode,\n} from './BaseSelect';\nimport BaseSelect, { isMultiple } from './BaseSelect';\nimport OptGroup from './OptGroup';\nimport Option from './Option';\nimport OptionList from './OptionList';\nimport SelectContext from './SelectContext';\nimport useCache from './hooks/useCache';\nimport useFilterOptions from './hooks/useFilterOptions';\nimport useId from './hooks/useId';\nimport useOptions from './hooks/useOptions';\nimport useRefFunc from './hooks/useRefFunc';\nimport type { FlattenOptionData } from './interface';\nimport { hasValue, isComboNoValue, toArray } from './utils/commonUtil';\nimport { fillFieldNames, flattenOptions, injectPropsWithOption } from './utils/valueUtil';\nimport warningProps, { warningNullOptions } from './utils/warningPropsUtil';\n\nconst OMIT_DOM_PROPS = ['inputValue'];\n\nexport type OnActiveValue = (\n active: RawValueType,\n index: number,\n info?: { source?: 'keyboard' | 'mouse' },\n) => void;\n\nexport type OnInternalSelect = (value: RawValueType, info: { selected: boolean }) => void;\n\nexport type RawValueType = string | number;\nexport interface LabelInValueType {\n label: React.ReactNode;\n value: RawValueType;\n /** @deprecated `key` is useless since it should always same as `value` */\n key?: React.Key;\n}\n\nexport type DraftValueType =\n | RawValueType\n | LabelInValueType\n | DisplayValueType\n | (RawValueType | LabelInValueType | DisplayValueType)[];\n\nexport type FilterFunc<OptionType> = (inputValue: string, option?: OptionType) => boolean;\n\nexport interface FieldNames {\n value?: string;\n label?: string;\n groupLabel?: string;\n options?: string;\n}\n\nexport interface BaseOptionType {\n disabled?: boolean;\n [name: string]: any;\n}\n\nexport interface DefaultOptionType extends BaseOptionType {\n label: React.ReactNode;\n value?: string | number | null;\n children?: Omit<DefaultOptionType, 'children'>[];\n}\n\nexport type SelectHandler<ValueType, OptionType extends BaseOptionType = DefaultOptionType> = (\n value: ValueType,\n option: OptionType,\n) => void;\n\ntype ArrayElementType<T> = T extends (infer E)[] ? E : T;\n\nexport interface SelectProps<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType>\n extends BaseSelectPropsWithoutPrivate {\n prefixCls?: string;\n id?: string;\n\n backfill?: boolean;\n\n // >>> Field Names\n fieldNames?: FieldNames;\n\n // >>> Search\n /** @deprecated Use `searchValue` instead */\n inputValue?: string;\n searchValue?: string;\n onSearch?: (value: string) => void;\n autoClearSearchValue?: boolean;\n\n // >>> Select\n onSelect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;\n onDeselect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;\n\n // >>> Options\n /**\n * In Select, `false` means do nothing.\n * In TreeSelect, `false` will highlight match item.\n * It's by design.\n */\n filterOption?: boolean | FilterFunc<OptionType>;\n filterSort?: (optionA: OptionType, optionB: OptionType) => number;\n optionFilterProp?: string;\n optionLabelProp?: string;\n children?: React.ReactNode;\n options?: OptionType[];\n optionRender?: (\n oriOption: FlattenOptionData<BaseOptionType>,\n info: { index: number },\n ) => React.ReactNode;\n defaultActiveFirstOption?: boolean;\n virtual?: boolean;\n direction?: 'ltr' | 'rtl';\n listHeight?: number;\n listItemHeight?: number;\n\n // >>> Icon\n menuItemSelectedIcon?: RenderNode;\n\n mode?: 'combobox' | 'multiple' | 'tags';\n labelInValue?: boolean;\n value?: ValueType | null;\n defaultValue?: ValueType | null;\n onChange?: (value: ValueType, option: OptionType | OptionType[]) => void;\n}\n\nfunction isRawValue(value: DraftValueType): value is RawValueType {\n return !value || typeof value !== 'object';\n}\n\nconst Select = React.forwardRef(\n (props: SelectProps<any, DefaultOptionType>, ref: React.Ref<BaseSelectRef>) => {\n const {\n id,\n mode,\n prefixCls = 'rc-select',\n backfill,\n fieldNames,\n\n // Search\n inputValue,\n searchValue,\n onSearch,\n autoClearSearchValue = true,\n\n // Select\n onSelect,\n onDeselect,\n dropdownMatchSelectWidth = true,\n\n // Options\n filterOption,\n filterSort,\n optionFilterProp,\n optionLabelProp,\n options,\n optionRender,\n children,\n defaultActiveFirstOption,\n menuItemSelectedIcon,\n virtual,\n direction,\n listHeight = 200,\n listItemHeight = 20,\n\n // Value\n value,\n defaultValue,\n labelInValue,\n onChange,\n\n ...restProps\n } = props;\n\n const mergedId = useId(id);\n const multiple = isMultiple(mode);\n const childrenAsData = !!(!options && children);\n\n const mergedFilterOption = React.useMemo(() => {\n if (filterOption === undefined && mode === 'combobox') {\n return false;\n }\n return filterOption;\n }, [filterOption, mode]);\n\n // ========================= FieldNames =========================\n const mergedFieldNames = React.useMemo(\n () => fillFieldNames(fieldNames, childrenAsData),\n /* eslint-disable react-hooks/exhaustive-deps */\n [\n // We stringify fieldNames to avoid unnecessary re-renders.\n JSON.stringify(fieldNames),\n childrenAsData,\n ],\n /* eslint-enable react-hooks/exhaustive-deps */\n );\n\n // =========================== Search ===========================\n const [mergedSearchValue, setSearchValue] = useMergedState('', {\n value: searchValue !== undefined ? searchValue : inputValue,\n postState: (search) => search || '',\n });\n\n // =========================== Option ===========================\n const parsedOptions = useOptions(\n options,\n children,\n mergedFieldNames,\n optionFilterProp,\n optionLabelProp,\n );\n const { valueOptions, labelOptions, options: mergedOptions } = parsedOptions;\n\n // ========================= Wrap Value =========================\n const convert2LabelValues = React.useCallback(\n (draftValues: DraftValueType) => {\n // Convert to array\n const valueList = toArray(draftValues);\n\n // Convert to labelInValue type\n return valueList.map((val) => {\n let rawValue: RawValueType;\n let rawLabel: React.ReactNode;\n let rawKey: React.Key;\n let rawDisabled: boolean | undefined;\n let rawTitle: string;\n\n // Fill label & value\n if (isRawValue(val)) {\n rawValue = val;\n } else {\n rawKey = val.key;\n rawLabel = val.label;\n rawValue = val.value ?? rawKey;\n }\n\n const option = valueOptions.get(rawValue);\n if (option) {\n // Fill missing props\n if (rawLabel === undefined)\n rawLabel = option?.[optionLabelProp || mergedFieldNames.label];\n if (rawKey === undefined) rawKey = option?.key ?? rawValue;\n rawDisabled = option?.disabled;\n rawTitle = option?.title;\n\n // Warning if label not same as provided\n if (process.env.NODE_ENV !== 'production' && !optionLabelProp) {\n const optionLabel = option?.[mergedFieldNames.label];\n if (\n optionLabel !== undefined &&\n !React.isValidElement(optionLabel) &&\n !React.isValidElement(rawLabel) &&\n optionLabel !== rawLabel\n ) {\n warning(false, '`label` of `value` is not same as `label` in Select options.');\n }\n }\n }\n\n return {\n label: rawLabel,\n value: rawValue,\n key: rawKey,\n disabled: rawDisabled,\n title: rawTitle,\n };\n });\n },\n [mergedFieldNames, optionLabelProp, valueOptions],\n );\n\n // =========================== Values ===========================\n const [internalValue, setInternalValue] = useMergedState(defaultValue, {\n value,\n });\n\n // Merged value with LabelValueType\n const rawLabeledValues = React.useMemo(() => {\n const values = convert2LabelValues(internalValue);\n\n // combobox no need save value when it's no value (exclude value equal 0)\n if (mode === 'combobox' && isComboNoValue(values[0]?.value)) {\n return [];\n }\n\n return values;\n }, [internalValue, convert2LabelValues, mode]);\n\n // Fill label with cache to avoid option remove\n const [mergedValues, getMixedOption] = useCache(rawLabeledValues, valueOptions);\n\n const displayValues = React.useMemo(() => {\n // `null` need show as placeholder instead\n // https://github.com/ant-design/ant-design/issues/25057\n if (!mode && mergedValues.length === 1) {\n const firstValue = mergedValues[0];\n if (\n firstValue.value === null &&\n (firstValue.label === null || firstValue.label === undefined)\n ) {\n return [];\n }\n }\n\n return mergedValues.map((item) => ({\n ...item,\n label: item.label ?? item.value,\n }));\n }, [mode, mergedValues]);\n\n /** Convert `displayValues` to raw value type set */\n const rawValues = React.useMemo(\n () => new Set(mergedValues.map((val) => val.value)),\n [mergedValues],\n );\n\n React.useEffect(() => {\n if (mode === 'combobox') {\n const strValue = mergedValues[0]?.value;\n setSearchValue(hasValue(strValue) ? String(strValue) : '');\n }\n }, [mergedValues]);\n\n // ======================= Display Option =======================\n // Create a placeholder item if not exist in `options`\n const createTagOption = useRefFunc((val: RawValueType, label?: React.ReactNode) => {\n const mergedLabel = label ?? val;\n return {\n [mergedFieldNames.value]: val,\n [mergedFieldNames.label]: mergedLabel,\n } as DefaultOptionType;\n });\n\n // Fill tag as option if mode is `tags`\n const filledTagOptions = React.useMemo(() => {\n if (mode !== 'tags') {\n return mergedOptions;\n }\n\n // >>> Tag mode\n const cloneOptions = [...mergedOptions];\n\n // Check if value exist in options (include new patch item)\n const existOptions = (val: RawValueType) => valueOptions.has(val);\n\n // Fill current value as option\n [...mergedValues]\n .sort((a, b) => (a.value < b.value ? -1 : 1))\n .forEach((item) => {\n const val = item.value;\n\n if (!existOptions(val)) {\n cloneOptions.push(createTagOption(val, item.label));\n }\n });\n\n return cloneOptions;\n }, [createTagOption, mergedOptions, valueOptions, mergedValues, mode]);\n\n const filteredOptions = useFilterOptions(\n filledTagOptions,\n mergedFieldNames,\n mergedSearchValue,\n mergedFilterOption,\n optionFilterProp,\n );\n\n // Fill options with search value if needed\n const filledSearchOptions = React.useMemo(() => {\n if (\n mode !== 'tags' ||\n !mergedSearchValue ||\n filteredOptions.some((item) => item[optionFilterProp || 'value'] === mergedSearchValue)\n ) {\n return filteredOptions;\n }\n // ignore when search value equal select input value\n if (filteredOptions.some((item) => item[mergedFieldNames.value] === mergedSearchValue)) {\n return filteredOptions;\n }\n // Fill search value as option\n return [createTagOption(mergedSearchValue), ...filteredOptions];\n }, [\n createTagOption,\n optionFilterProp,\n mode,\n filteredOptions,\n mergedSearchValue,\n mergedFieldNames,\n ]);\n\n const orderedFilteredOptions = React.useMemo(() => {\n if (!filterSort) {\n return filledSearchOptions;\n }\n\n return [...filledSearchOptions].sort((a, b) => filterSort(a, b));\n }, [filledSearchOptions, filterSort]);\n\n const displayOptions = React.useMemo(\n () =>\n flattenOptions(orderedFilteredOptions, {\n fieldNames: mergedFieldNames,\n childrenAsData,\n }),\n [orderedFilteredOptions, mergedFieldNames, childrenAsData],\n );\n\n // =========================== Change ===========================\n const triggerChange = (values: DraftValueType) => {\n const labeledValues = convert2LabelValues(values);\n setInternalValue(labeledValues);\n\n if (\n onChange &&\n // Trigger event only when value changed\n (labeledValues.length !== mergedValues.length ||\n labeledValues.some((newVal, index) => mergedValues[index]?.value !== newVal?.value))\n ) {\n const returnValues = labelInValue ? labeledValues : labeledValues.map((v) => v.value);\n const returnOptions = labeledValues.map((v) =>\n injectPropsWithOption(getMixedOption(v.value)),\n );\n\n onChange(\n // Value\n multiple ? returnValues : returnValues[0],\n // Option\n multiple ? returnOptions : returnOptions[0],\n );\n }\n };\n\n // ======================= Accessibility ========================\n const [activeValue, setActiveValue] = React.useState<string>(null);\n const [accessibilityIndex, setAccessibilityIndex] = React.useState(0);\n const mergedDefaultActiveFirstOption =\n defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';\n\n const onActiveValue: OnActiveValue = React.useCallback(\n (active, index, { source = 'keyboard' } = {}) => {\n setAccessibilityIndex(index);\n\n if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {\n setActiveValue(String(active));\n }\n },\n [backfill, mode],\n );\n\n // ========================= OptionList =========================\n const triggerSelect = (val: RawValueType, selected: boolean, type?: DisplayInfoType) => {\n const getSelectEnt = (): [RawValueType | LabelInValueType, DefaultOptionType] => {\n const option = getMixedOption(val);\n return [\n labelInValue\n ? {\n label: option?.[mergedFieldNames.label],\n value: val,\n key: option?.key ?? val,\n }\n : val,\n injectPropsWithOption(option),\n ];\n };\n\n if (selected && onSelect) {\n const [wrappedValue, option] = getSelectEnt();\n onSelect(wrappedValue, option);\n } else if (!selected && onDeselect && type !== 'clear') {\n const [wrappedValue, option] = getSelectEnt();\n onDeselect(wrappedValue, option);\n }\n };\n\n // Used for OptionList selection\n const onInternalSelect = useRefFunc<OnInternalSelect>((val, info) => {\n let cloneValues: (RawValueType | DisplayValueType)[];\n\n // Single mode always trigger select only with option list\n const mergedSelect = multiple ? info.selected : true;\n\n if (mergedSelect) {\n cloneValues = multiple ? [...mergedValues, val] : [val];\n } else {\n cloneValues = mergedValues.filter((v) => v.value !== val);\n }\n\n triggerChange(cloneValues);\n triggerSelect(val, mergedSelect);\n\n // Clean search value if single or configured\n if (mode === 'combobox') {\n // setSearchValue(String(val));\n setActiveValue('');\n } else if (!isMultiple || autoClearSearchValue) {\n setSearchValue('');\n setActiveValue('');\n }\n });\n\n // ======================= Display Change =======================\n // BaseSelect display values change\n const onDisplayValuesChange: BaseSelectProps['onDisplayValuesChange'] = (nextValues, info) => {\n triggerChange(nextValues);\n const { type, values } = info;\n\n if (type === 'remove' || type === 'clear') {\n values.forEach((item) => {\n triggerSelect(item.value, false, type);\n });\n }\n };\n\n // =========================== Search ===========================\n const onInternalSearch: BaseSelectProps['onSearch'] = (searchText, info) => {\n setSearchValue(searchText);\n setActiveValue(null);\n\n // [Submit] Tag mode should flush input\n if (info.source === 'submit') {\n const formatted = (searchText || '').trim();\n // prevent empty tags from appearing when you click the Enter button\n if (formatted) {\n const newRawValues = Array.from(new Set<RawValueType>([...rawValues, formatted]));\n triggerChange(newRawValues);\n triggerSelect(formatted, true);\n setSearchValue('');\n }\n\n return;\n }\n\n if (info.source !== 'blur') {\n if (mode === 'combobox') {\n triggerChange(searchText);\n }\n\n onSearch?.(searchText);\n }\n };\n\n const onInternalSearchSplit: BaseSelectProps['onSearchSplit'] = (words) => {\n let patchValues: RawValueType[] = words;\n\n if (mode !== 'tags') {\n patchValues = words\n .map((word) => {\n const opt = labelOptions.get(word);\n return opt?.value;\n })\n .filter((val) => val !== undefined);\n }\n\n const newRawValues = Array.from(new Set<RawValueType>([...rawValues, ...patchValues]));\n triggerChange(newRawValues);\n newRawValues.forEach((newRawValue) => {\n triggerSelect(newRawValue, true);\n });\n };\n\n // ========================== Context ===========================\n const selectContext = React.useMemo(() => {\n const realVirtual = virtual !== false && dropdownMatchSelectWidth !== false;\n return {\n ...parsedOptions,\n flattenOptions: displayOptions,\n onActiveValue,\n defaultActiveFirstOption: mergedDefaultActiveFirstOption,\n onSelect: onInternalSelect,\n menuItemSelectedIcon,\n rawValues,\n fieldNames: mergedFieldNames,\n virtual: realVirtual,\n direction,\n listHeight,\n listItemHeight,\n childrenAsData,\n optionRender,\n };\n }, [\n parsedOptions,\n displayOptions,\n onActiveValue,\n mergedDefaultActiveFirstOption,\n onInternalSelect,\n menuItemSelectedIcon,\n rawValues,\n mergedFieldNames,\n virtual,\n dropdownMatchSelectWidth,\n listHeight,\n listItemHeight,\n childrenAsData,\n optionRender,\n ]);\n\n // ========================== Warning ===========================\n if (process.env.NODE_ENV !== 'production') {\n warningProps(props);\n warningNullOptions(mergedOptions, mergedFieldNames);\n }\n\n // ==============================================================\n // == Render ==\n // ==============================================================\n return (\n <SelectContext.Provider value={selectContext}>\n <BaseSelect\n {...restProps}\n // >>> MISC\n id={mergedId}\n prefixCls={prefixCls}\n ref={ref}\n omitDomProps={OMIT_DOM_PROPS}\n mode={mode}\n // >>> Values\n displayValues={displayValues}\n onDisplayValuesChange={onDisplayValuesChange}\n // >>> Trigger\n direction={direction}\n // >>> Search\n searchValue={mergedSearchValue}\n onSearch={onInternalSearch}\n autoClearSearchValue={autoClearSearchValue}\n onSearchSplit={onInternalSearchSplit}\n dropdownMatchSelectWidth={dropdownMatchSelectWidth}\n // >>> OptionList\n OptionList={OptionList}\n emptyOptions={!displayOptions.length}\n // >>> Accessibility\n activeValue={activeValue}\n activeDescendantId={`${mergedId}_list_${accessibilityIndex}`}\n />\n </SelectContext.Provider>\n );\n },\n);\n\nif (process.env.NODE_ENV !== 'production') {\n Select.displayName = 'Select';\n}\n\nconst TypedSelect = Select as unknown as (<\n ValueType = any,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,\n>(\n props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & {\n ref?: React.Ref<BaseSelectRef>;\n },\n) => React.ReactElement) & {\n Option: typeof Option;\n OptGroup: typeof OptGroup;\n};\n\nTypedSelect.Option = Option;\nTypedSelect.OptGroup = OptGroup;\n\nexport default TypedSelect;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectContext.js","sourceRoot":"","sources":["../../../src/tntd-select/rc-select/SelectContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6B/B,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAqB,IAAI,CAAC,CAAC;AAEpE,eAAe,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport type { RawValueType, RenderNode } from './BaseSelect';\nimport type {\n BaseOptionType,\n FieldNames,\n OnActiveValue,\n OnInternalSelect,\n SelectProps,\n} from './Select';\nimport type { FlattenOptionData } from './interface';\n\n// Use any here since we do not get the type during compilation\nexport interface SelectContextProps {\n options: BaseOptionType[];\n optionRender?: SelectProps['optionRender'];\n flattenOptions: FlattenOptionData<BaseOptionType>[];\n onActiveValue: OnActiveValue;\n defaultActiveFirstOption?: boolean;\n onSelect: OnInternalSelect;\n menuItemSelectedIcon?: RenderNode;\n rawValues: Set<RawValueType>;\n fieldNames?: FieldNames;\n virtual?: boolean;\n direction?: 'ltr' | 'rtl';\n listHeight?: number;\n listItemHeight?: number;\n childrenAsData?: boolean;\n}\n\nconst SelectContext = React.createContext<SelectContextProps>(null);\n\nexport default SelectContext;\n"]}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
var __rest = this && this.__rest || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
import Trigger from '@rc-component/trigger';
|
|
10
|
-
import classNames from 'classnames';
|
|
11
|
-
import * as React from 'react';
|
|
12
|
-
const getBuiltInPlacements = dropdownMatchSelectWidth => {
|
|
13
|
-
// Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
|
|
14
|
-
const adjustX = dropdownMatchSelectWidth === true ? 0 : 1;
|
|
15
|
-
return {
|
|
16
|
-
bottomLeft: {
|
|
17
|
-
points: ['tl', 'bl'],
|
|
18
|
-
offset: [0, 4],
|
|
19
|
-
overflow: {
|
|
20
|
-
adjustX,
|
|
21
|
-
adjustY: 1
|
|
22
|
-
},
|
|
23
|
-
htmlRegion: 'scroll'
|
|
24
|
-
},
|
|
25
|
-
bottomRight: {
|
|
26
|
-
points: ['tr', 'br'],
|
|
27
|
-
offset: [0, 4],
|
|
28
|
-
overflow: {
|
|
29
|
-
adjustX,
|
|
30
|
-
adjustY: 1
|
|
31
|
-
},
|
|
32
|
-
htmlRegion: 'scroll'
|
|
33
|
-
},
|
|
34
|
-
topLeft: {
|
|
35
|
-
points: ['bl', 'tl'],
|
|
36
|
-
offset: [0, -4],
|
|
37
|
-
overflow: {
|
|
38
|
-
adjustX,
|
|
39
|
-
adjustY: 1
|
|
40
|
-
},
|
|
41
|
-
htmlRegion: 'scroll'
|
|
42
|
-
},
|
|
43
|
-
topRight: {
|
|
44
|
-
points: ['br', 'tr'],
|
|
45
|
-
offset: [0, -4],
|
|
46
|
-
overflow: {
|
|
47
|
-
adjustX,
|
|
48
|
-
adjustY: 1
|
|
49
|
-
},
|
|
50
|
-
htmlRegion: 'scroll'
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
const SelectTrigger = (props, ref) => {
|
|
55
|
-
const {
|
|
56
|
-
prefixCls,
|
|
57
|
-
disabled,
|
|
58
|
-
visible,
|
|
59
|
-
children,
|
|
60
|
-
popupElement,
|
|
61
|
-
animation,
|
|
62
|
-
transitionName,
|
|
63
|
-
dropdownStyle,
|
|
64
|
-
dropdownClassName,
|
|
65
|
-
direction = 'ltr',
|
|
66
|
-
placement,
|
|
67
|
-
builtinPlacements,
|
|
68
|
-
dropdownMatchSelectWidth,
|
|
69
|
-
dropdownRender,
|
|
70
|
-
dropdownAlign,
|
|
71
|
-
getPopupContainer,
|
|
72
|
-
empty,
|
|
73
|
-
getTriggerDOMNode,
|
|
74
|
-
onPopupVisibleChange,
|
|
75
|
-
onPopupMouseEnter
|
|
76
|
-
} = props,
|
|
77
|
-
restProps = __rest(props, ["prefixCls", "disabled", "visible", "children", "popupElement", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "direction", "placement", "builtinPlacements", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "getPopupContainer", "empty", "getTriggerDOMNode", "onPopupVisibleChange", "onPopupMouseEnter"]);
|
|
78
|
-
const dropdownPrefixCls = `${prefixCls}-dropdown`;
|
|
79
|
-
let popupNode = popupElement;
|
|
80
|
-
if (dropdownRender) {
|
|
81
|
-
popupNode = dropdownRender(popupElement);
|
|
82
|
-
}
|
|
83
|
-
const mergedBuiltinPlacements = React.useMemo(() => builtinPlacements || getBuiltInPlacements(dropdownMatchSelectWidth), [builtinPlacements, dropdownMatchSelectWidth]);
|
|
84
|
-
// ===================== Motion ======================
|
|
85
|
-
const mergedTransitionName = animation ? `${dropdownPrefixCls}-${animation}` : transitionName;
|
|
86
|
-
// =================== Popup Width ===================
|
|
87
|
-
const isNumberPopupWidth = typeof dropdownMatchSelectWidth === 'number';
|
|
88
|
-
const stretch = React.useMemo(() => {
|
|
89
|
-
if (isNumberPopupWidth) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return dropdownMatchSelectWidth === false ? 'minWidth' : 'width';
|
|
93
|
-
}, [dropdownMatchSelectWidth, isNumberPopupWidth]);
|
|
94
|
-
let popupStyle = dropdownStyle;
|
|
95
|
-
if (isNumberPopupWidth) {
|
|
96
|
-
popupStyle = Object.assign(Object.assign({}, popupStyle), {
|
|
97
|
-
width: dropdownMatchSelectWidth
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
// ======================= Ref =======================
|
|
101
|
-
const popupRef = React.useRef(null);
|
|
102
|
-
React.useImperativeHandle(ref, () => ({
|
|
103
|
-
getPopupElement: () => popupRef.current
|
|
104
|
-
}));
|
|
105
|
-
return React.createElement(Trigger, Object.assign({}, restProps, {
|
|
106
|
-
showAction: onPopupVisibleChange ? ['click'] : [],
|
|
107
|
-
hideAction: onPopupVisibleChange ? ['click'] : [],
|
|
108
|
-
popupPlacement: placement || (direction === 'rtl' ? 'bottomRight' : 'bottomLeft'),
|
|
109
|
-
builtinPlacements: mergedBuiltinPlacements,
|
|
110
|
-
prefixCls: dropdownPrefixCls,
|
|
111
|
-
popupTransitionName: mergedTransitionName,
|
|
112
|
-
popup: React.createElement("div", {
|
|
113
|
-
ref: popupRef,
|
|
114
|
-
onMouseEnter: onPopupMouseEnter
|
|
115
|
-
}, popupNode),
|
|
116
|
-
stretch: stretch,
|
|
117
|
-
popupAlign: dropdownAlign,
|
|
118
|
-
popupVisible: visible,
|
|
119
|
-
getPopupContainer: getPopupContainer,
|
|
120
|
-
popupClassName: classNames(dropdownClassName, {
|
|
121
|
-
[`${dropdownPrefixCls}-empty`]: empty
|
|
122
|
-
}),
|
|
123
|
-
popupStyle: popupStyle,
|
|
124
|
-
getTriggerDOMNode: getTriggerDOMNode,
|
|
125
|
-
onPopupVisibleChange: onPopupVisibleChange
|
|
126
|
-
}), children);
|
|
127
|
-
};
|
|
128
|
-
const RefSelectTrigger = React.forwardRef(SelectTrigger);
|
|
129
|
-
RefSelectTrigger.displayName = 'SelectTrigger';
|
|
130
|
-
export default RefSelectTrigger;
|