@tendaui/react 1.1.1 → 1.1.2
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/_chunks/{dep-D7LanWes.js → dep-4LYjB3c6.js} +3 -18
- package/es/_chunks/dep-4LYjB3c6.js.map +1 -0
- package/es/_chunks/dep-5U9UjDaf.js +345 -0
- package/es/_chunks/dep-5U9UjDaf.js.map +1 -0
- package/es/_chunks/{dep-B7HmDtze.js → dep-B4_O1Vgv.js} +2 -2
- package/es/_chunks/{dep-B7HmDtze.js.map → dep-B4_O1Vgv.js.map} +1 -1
- package/es/_chunks/dep-BP0-apUT.js.map +1 -1
- package/es/_chunks/dep-BRbJGDI9.js +7 -0
- package/es/_chunks/dep-BRbJGDI9.js.map +1 -0
- package/es/_chunks/{dep-EcrDKDlu.js → dep-BYlJzn45.js} +10 -9
- package/es/_chunks/dep-BYlJzn45.js.map +1 -0
- package/es/_chunks/dep-BbeHB7S3.js +116 -0
- package/es/_chunks/dep-BbeHB7S3.js.map +1 -0
- package/es/_chunks/{dep-DB5wmwh1.js → dep-Bjfn7Zv_.js} +2 -2
- package/es/_chunks/{dep-DB5wmwh1.js.map → dep-Bjfn7Zv_.js.map} +1 -1
- package/es/_chunks/{dep-C36au4Ip.js → dep-BuIAffJt.js} +2 -2
- package/es/_chunks/{dep-C36au4Ip.js.map → dep-BuIAffJt.js.map} +1 -1
- package/es/_chunks/{dep-bWaVq_y3.js → dep-ByzdZjUR.js} +2 -2
- package/es/_chunks/dep-ByzdZjUR.js.map +1 -0
- package/es/_chunks/dep-CD_4-1Xb.js +103 -0
- package/es/_chunks/dep-CD_4-1Xb.js.map +1 -0
- package/es/_chunks/{dep-Dk2xX8lh.js → dep-CJCt0IS0.js} +5 -212
- package/es/_chunks/dep-CJCt0IS0.js.map +1 -0
- package/es/_chunks/dep-CMPsNAXF.js +52 -0
- package/es/_chunks/dep-CMPsNAXF.js.map +1 -0
- package/es/_chunks/dep-COy5g3FT.js +512 -0
- package/es/_chunks/dep-COy5g3FT.js.map +1 -0
- package/es/_chunks/{dep-CoIiHOgo.js → dep-CRURwzDj.js} +3 -3
- package/es/_chunks/{dep-CoIiHOgo.js.map → dep-CRURwzDj.js.map} +1 -1
- package/es/_chunks/dep-C_wPqvpm.js +36 -0
- package/es/_chunks/dep-C_wPqvpm.js.map +1 -0
- package/es/_chunks/dep-Ccktr_jk.js +33 -0
- package/es/_chunks/dep-Ccktr_jk.js.map +1 -0
- package/es/_chunks/dep-Chz4ZJCb.js +20 -0
- package/es/_chunks/dep-Chz4ZJCb.js.map +1 -0
- package/es/_chunks/dep-CkmtEv0Y.js +55 -0
- package/es/_chunks/dep-CkmtEv0Y.js.map +1 -0
- package/es/_chunks/dep-DJmE940f.js +764 -0
- package/es/_chunks/dep-DJmE940f.js.map +1 -0
- package/es/_chunks/{dep-DHWwZ2Nj.js → dep-DQ6kXoi8.js} +2 -2
- package/es/_chunks/{dep-DHWwZ2Nj.js.map → dep-DQ6kXoi8.js.map} +1 -1
- package/es/_chunks/{dep-0QH2Ee4R.js → dep-DRwijJcv.js} +5 -5
- package/es/_chunks/dep-DRwijJcv.js.map +1 -0
- package/es/_chunks/dep-DTlQ2dCA.js +46 -0
- package/es/_chunks/dep-DTlQ2dCA.js.map +1 -0
- package/es/_chunks/dep-DURB9x8g.js +170 -0
- package/es/_chunks/dep-DURB9x8g.js.map +1 -0
- package/es/_chunks/{dep-DZ_0EvBk.js → dep-DX65P8M9.js} +4 -45
- package/es/_chunks/dep-DX65P8M9.js.map +1 -0
- package/es/_chunks/{dep-BH5n5r1M.js → dep-DbVHGoUC.js} +2 -2
- package/es/_chunks/dep-DbVHGoUC.js.map +1 -0
- package/es/_chunks/dep-Dlppf0JU.js +214 -0
- package/es/_chunks/dep-Dlppf0JU.js.map +1 -0
- package/es/_chunks/dep-Dr5wkz0z.js +266 -0
- package/es/_chunks/dep-Dr5wkz0z.js.map +1 -0
- package/es/_chunks/dep-DwWrhxkd.js.map +1 -1
- package/es/_chunks/dep-Tshfumgl.js +31 -0
- package/es/_chunks/dep-Tshfumgl.js.map +1 -0
- package/es/_chunks/{dep-u1x3x6MJ.js → dep-gy8uvBaS.js} +2 -2
- package/es/_chunks/{dep-u1x3x6MJ.js.map → dep-gy8uvBaS.js.map} +1 -1
- package/es/_chunks/dep-oUgTcXgm.js +11 -0
- package/es/_chunks/dep-oUgTcXgm.js.map +1 -0
- package/es/_chunks/dep-zOZQ0R9g.js +1181 -0
- package/es/_chunks/dep-zOZQ0R9g.js.map +1 -0
- package/es/alert/Alert.d.ts +7 -0
- package/es/alert/Alert.js +4 -3
- package/es/alert/Alert.js.map +1 -1
- package/es/alert/defaultProps.d.ts +2 -0
- package/es/alert/index.d.ts +5 -0
- package/es/alert/index.js +4 -3
- package/es/alert/index.js.map +1 -1
- package/es/alert/style/css.d.ts +1 -0
- package/es/alert/style/index.d.ts +1 -0
- package/es/alert/type.d.ts +45 -0
- package/es/badge/Badge.d.ts +7 -0
- package/es/badge/Badge.js +3 -2
- package/es/badge/Badge.js.map +1 -1
- package/es/badge/defaultProps.d.ts +2 -0
- package/es/badge/index.d.ts +5 -0
- package/es/badge/index.js +3 -2
- package/es/badge/index.js.map +1 -1
- package/es/badge/style/css.d.ts +1 -0
- package/es/badge/style/index.d.ts +1 -0
- package/es/badge/type.d.ts +50 -0
- package/es/button/Button.d.ts +6 -0
- package/es/button/Button.js +7 -5
- package/es/button/Button.js.map +1 -1
- package/es/button/_example/base.js +171 -0
- package/es/button/_example/base.js.map +1 -0
- package/es/button/_example/icon.js +181 -0
- package/es/button/_example/icon.js.map +1 -0
- package/es/button/defaultProps.d.ts +2 -0
- package/es/button/index.d.ts +5 -0
- package/es/button/index.js +7 -5
- package/es/button/index.js.map +1 -1
- package/es/button/style/css.d.ts +1 -0
- package/es/button/style/index.d.ts +1 -0
- package/es/button/type.d.ts +81 -0
- package/es/checkbox/Checkbox.d.ts +10 -0
- package/es/checkbox/Checkbox.js +5 -4
- package/es/checkbox/Checkbox.js.map +1 -1
- package/es/checkbox/CheckboxGroup.d.ts +14 -0
- package/es/checkbox/CheckboxGroup.js +5 -4
- package/es/checkbox/CheckboxGroup.js.map +1 -1
- package/es/checkbox/defaultProps.d.ts +3 -0
- package/es/checkbox/index.d.ts +11 -0
- package/es/checkbox/index.js +5 -4
- package/es/checkbox/index.js.map +1 -1
- package/es/checkbox/style/css.d.ts +1 -0
- package/es/checkbox/style/index.d.ts +1 -0
- package/es/checkbox/type.d.ts +115 -0
- package/es/color-picker/ColorPickPanel.d.ts +4 -0
- package/es/color-picker/ColorPickPanel.js +44 -0
- package/es/color-picker/ColorPickPanel.js.map +1 -0
- package/es/color-picker/ColorPicker.d.ts +4 -0
- package/es/color-picker/ColorPicker.js +118 -0
- package/es/color-picker/ColorPicker.js.map +1 -0
- package/es/color-picker/components/panel/alpha.d.ts +4 -0
- package/es/color-picker/components/panel/alpha.js +44 -0
- package/es/color-picker/components/panel/alpha.js.map +1 -0
- package/es/color-picker/components/panel/format/index.d.ts +10 -0
- package/es/color-picker/components/panel/format/index.js +128 -0
- package/es/color-picker/components/panel/format/index.js.map +1 -0
- package/es/color-picker/components/panel/format/inputs.d.ts +4 -0
- package/es/color-picker/components/panel/format/inputs.js +147 -0
- package/es/color-picker/components/panel/format/inputs.js.map +1 -0
- package/es/color-picker/components/panel/header.d.ts +13 -0
- package/es/color-picker/components/panel/header.js +60 -0
- package/es/color-picker/components/panel/header.js.map +1 -0
- package/es/color-picker/components/panel/hue.d.ts +4 -0
- package/es/color-picker/components/panel/hue.js +33 -0
- package/es/color-picker/components/panel/hue.js.map +1 -0
- package/es/color-picker/components/panel/index.d.ts +4 -0
- package/es/color-picker/components/panel/index.js +32 -0
- package/es/color-picker/components/panel/index.js.map +1 -0
- package/es/color-picker/components/panel/saturation.d.ts +4 -0
- package/es/color-picker/components/panel/saturation.js +101 -0
- package/es/color-picker/components/panel/saturation.js.map +1 -0
- package/es/color-picker/components/panel/slider.d.ts +11 -0
- package/es/color-picker/components/panel/slider.js +121 -0
- package/es/color-picker/components/panel/slider.js.map +1 -0
- package/es/color-picker/components/panel/swatches.d.ts +11 -0
- package/es/color-picker/components/panel/swatches.js +100 -0
- package/es/color-picker/components/panel/swatches.js.map +1 -0
- package/es/color-picker/components/trigger.d.ts +9 -0
- package/es/color-picker/components/trigger.js +73 -0
- package/es/color-picker/components/trigger.js.map +1 -0
- package/es/color-picker/defaultProps.d.ts +2 -0
- package/es/color-picker/helpers.d.ts +5 -0
- package/es/color-picker/hooks/useClassNames.d.ts +2 -0
- package/es/color-picker/hooks/useStyles.d.ts +14 -0
- package/es/color-picker/index.d.ts +6 -0
- package/es/color-picker/index.js +62 -0
- package/es/color-picker/index.js.map +1 -0
- package/es/color-picker/style/index.css +597 -0
- package/es/color-picker/style/index.d.ts +1 -0
- package/es/color-picker/style/index.js +2 -0
- package/es/color-picker/style/index.js.map +1 -0
- package/es/color-picker/type.d.ts +135 -0
- package/es/color-picker/utils/color-picker/cmyk.d.ts +27 -0
- package/es/color-picker/utils/color-picker/color.d.ts +144 -0
- package/es/color-picker/utils/color-picker/constants.d.ts +30 -0
- package/es/color-picker/utils/color-picker/draggable.d.ts +23 -0
- package/es/color-picker/utils/color-picker/format.d.ts +64 -0
- package/es/color-picker/utils/color-picker/gradient.d.ts +22 -0
- package/es/color-picker/utils/color-picker/index.d.ts +7 -0
- package/es/color-picker/utils/color-picker/index.js +147 -0
- package/es/color-picker/utils/color-picker/index.js.map +1 -0
- package/es/color-picker/utils/color-picker/types.d.ts +28 -0
- package/es/common/Check.d.ts +22 -0
- package/es/common/Check.js +4 -3
- package/es/common/Check.js.map +1 -1
- package/es/common/FakeArrow.d.ts +9 -0
- package/es/common/FakeArrow.js +3 -2
- package/es/common/FakeArrow.js.map +1 -1
- package/es/common/PluginContainer.d.ts +9 -0
- package/es/common/PluginContainer.js +2 -1
- package/es/common/PluginContainer.js.map +1 -1
- package/es/common/Portal.d.ts +16 -0
- package/es/common/Portal.js +6 -3
- package/es/common/Portal.js.map +1 -1
- package/es/common/observe.d.ts +1 -0
- package/es/common.d.ts +81 -0
- package/es/config-provider/ConfigContext.d.ts +13 -0
- package/es/config-provider/ConfigContext.js +5 -16
- package/es/config-provider/ConfigContext.js.map +1 -1
- package/es/config-provider/ConfigProvider.d.ts +25 -0
- package/es/config-provider/ConfigProvider.js +2 -1
- package/es/config-provider/ConfigProvider.js.map +1 -1
- package/es/config-provider/index.d.ts +7 -0
- package/es/config-provider/index.js +2 -1
- package/es/config-provider/index.js.map +1 -1
- package/es/config-provider/type.d.ts +1029 -0
- package/es/dialog/Dialog.d.ts +8 -0
- package/es/dialog/Dialog.js +12 -149
- package/es/dialog/Dialog.js.map +1 -1
- package/es/dialog/DialogCard.d.ts +8 -0
- package/es/dialog/DialogCard.js +9 -7
- package/es/dialog/DialogCard.js.map +1 -1
- package/es/dialog/defaultProps.d.ts +6 -0
- package/es/dialog/hooks/useDialogDrag.d.ts +7 -0
- package/es/dialog/hooks/useDialogEsc.d.ts +3 -0
- package/es/dialog/hooks/useDialogPosition.d.ts +2 -0
- package/es/dialog/hooks/useLockStyle.d.ts +2 -0
- package/es/dialog/index.d.ts +8 -0
- package/es/dialog/index.js +12 -8
- package/es/dialog/index.js.map +1 -1
- package/es/dialog/plugin.d.ts +6 -0
- package/es/dialog/plugin.js +15 -10
- package/es/dialog/plugin.js.map +1 -1
- package/es/dialog/style/css.d.ts +1 -0
- package/es/dialog/style/index.d.ts +1 -0
- package/es/dialog/type.d.ts +227 -0
- package/es/dialog/utils.d.ts +1 -0
- package/es/drawer/Drawer.d.ts +11 -0
- package/es/drawer/Drawer.js +458 -0
- package/es/drawer/Drawer.js.map +1 -0
- package/es/drawer/defaultProps.d.ts +2 -0
- package/es/drawer/hooks/useDrag.d.ts +8 -0
- package/es/drawer/hooks/useLockStyle.d.ts +1 -0
- package/es/drawer/index.d.ts +4 -0
- package/es/drawer/index.js +39 -0
- package/es/drawer/index.js.map +1 -0
- package/es/drawer/style/css.d.ts +1 -0
- package/es/drawer/style/css.js +1 -0
- package/es/drawer/style/index.css +231 -0
- package/es/drawer/style/index.d.ts +1 -0
- package/es/drawer/style/index.js +2 -0
- package/es/drawer/style/index.js.map +1 -0
- package/es/drawer/type.d.ts +199 -0
- package/es/drawer/utils/index.d.ts +23 -0
- package/es/drawer/utils/index.js +46 -0
- package/es/drawer/utils/index.js.map +1 -0
- package/es/fireworks/Fireworks.d.ts +7 -0
- package/es/fireworks/Fireworks.js +139 -0
- package/es/fireworks/Fireworks.js.map +1 -0
- package/es/fireworks/index.d.ts +5 -0
- package/es/fireworks/index.js +16 -0
- package/es/fireworks/index.js.map +1 -0
- package/es/fireworks/style/css.d.ts +1 -0
- package/es/fireworks/style/css.js +2 -0
- package/es/fireworks/style/index.css +121 -0
- package/es/fireworks/style/index.d.ts +1 -0
- package/es/fireworks/style/index.js +2 -0
- package/es/fireworks/style/index.js.map +1 -0
- package/es/fireworks/type.d.ts +69 -0
- package/es/form/Form.d.ts +8 -0
- package/es/form/Form.js +14 -10
- package/es/form/Form.js.map +1 -1
- package/es/form/FormContext.d.ts +59 -0
- package/es/form/FormItem.d.ts +23 -0
- package/es/form/FormItem.js +14 -10
- package/es/form/FormItem.js.map +1 -1
- package/es/form/FormList.d.ts +4 -0
- package/es/form/FormList.js +2 -1
- package/es/form/FormList.js.map +1 -1
- package/es/form/const.d.ts +6 -0
- package/es/form/defaultProps.d.ts +3 -0
- package/es/form/easing.d.ts +2 -0
- package/es/form/formModel.d.ts +37 -0
- package/es/form/hooks/interface.d.ts +16 -0
- package/es/form/hooks/useForm.d.ts +3 -0
- package/es/form/hooks/useFormItemInitialData.d.ts +9 -0
- package/es/form/hooks/useFormItemStyle.d.ts +10 -0
- package/es/form/hooks/useFormItemStyle.js +4 -3
- package/es/form/hooks/useFormItemStyle.js.map +1 -1
- package/es/form/hooks/useInstance.d.ts +16 -0
- package/es/form/hooks/useInstance.js +5 -4
- package/es/form/hooks/useInstance.js.map +1 -1
- package/es/form/hooks/useWatch.d.ts +3 -0
- package/es/form/index.d.ts +7 -0
- package/es/form/index.js +14 -10
- package/es/form/index.js.map +1 -1
- package/es/form/scroll.d.ts +39 -0
- package/es/form/style/css.d.ts +1 -0
- package/es/form/style/index.d.ts +1 -0
- package/es/form/type.d.ts +486 -0
- package/es/form/utils/index.d.ts +5 -0
- package/es/global-config/default-config.d.ts +84 -0
- package/es/global-config/locale/ar_KW.d.ts +239 -0
- package/es/global-config/locale/en_US.d.ts +263 -0
- package/es/global-config/locale/it_IT.d.ts +263 -0
- package/es/global-config/locale/ja_JP.d.ts +263 -0
- package/es/global-config/locale/ko_KR.d.ts +263 -0
- package/es/global-config/locale/ru_RU.d.ts +263 -0
- package/es/global-config/locale/zh_CN.d.ts +263 -0
- package/es/global-config/locale/zh_TW.d.ts +263 -0
- package/es/global-config/mobile/default-config.d.ts +7 -0
- package/es/global-config/mobile/locale/ar_KW.d.ts +98 -0
- package/es/global-config/mobile/locale/en_US.d.ts +99 -0
- package/es/global-config/mobile/locale/it_IT.d.ts +99 -0
- package/es/global-config/mobile/locale/ja_JP.d.ts +99 -0
- package/es/global-config/mobile/locale/ko_KR.d.ts +99 -0
- package/es/global-config/mobile/locale/ru_RU.d.ts +99 -0
- package/es/global-config/mobile/locale/zh_CN.d.ts +99 -0
- package/es/global-config/mobile/locale/zh_TW.d.ts +99 -0
- package/es/global-config/t.d.ts +25 -0
- package/es/hooks/useAttach.d.ts +10 -0
- package/es/hooks/useCommonClassName.d.ts +54 -0
- package/es/hooks/useConfig.d.ts +2 -0
- package/es/hooks/useControlled.d.ts +9 -0
- package/es/hooks/useDeepEffect.d.ts +7 -0
- package/es/hooks/useDefaultProps.d.ts +1 -0
- package/es/hooks/useDomCallback.d.ts +1 -0
- package/es/hooks/useDomRefCallback.d.ts +1 -0
- package/es/hooks/useDragSorter.d.ts +28 -0
- package/es/hooks/useEventCallback.d.ts +9 -0
- package/es/hooks/useGlobalConfig.d.ts +1 -0
- package/es/hooks/useGlobalIcon.d.ts +5 -0
- package/es/hooks/useLastest.d.ts +2 -0
- package/es/hooks/useLayoutEffect.d.ts +3 -0
- package/es/hooks/useMouseEvent.d.ts +25 -0
- package/es/hooks/useMutationObserver.d.ts +4 -0
- package/es/hooks/usePopper.d.ts +19 -0
- package/es/hooks/useResizeObserve.d.ts +1 -0
- package/es/hooks/useRipple.d.ts +0 -0
- package/es/hooks/useSetState.d.ts +7 -0
- package/es/hooks/useVirtualScroll.d.ts +30 -0
- package/es/hooks/useWindowSize.d.ts +6 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +68 -14
- package/es/index.js.map +1 -1
- package/es/input/Input.d.ts +16 -0
- package/es/input/Input.js +5 -5
- package/es/input/Input.js.map +1 -1
- package/es/input/InputGroup.d.ts +10 -0
- package/es/input/defaultProps.d.ts +17 -0
- package/es/input/index.d.ts +6 -0
- package/es/input/index.js +5 -3
- package/es/input/index.js.map +1 -1
- package/es/input/style/css.d.ts +1 -0
- package/es/input/style/index.d.ts +1 -0
- package/es/input/type.d.ts +237 -0
- package/es/input-number/InputNumber.d.ts +17 -0
- package/es/input-number/InputNumber.js +139 -0
- package/es/input-number/InputNumber.js.map +1 -0
- package/es/input-number/defaultProps.d.ts +2 -0
- package/es/input-number/index.d.ts +5 -0
- package/es/input-number/index.js +43 -0
- package/es/input-number/index.js.map +1 -0
- package/es/input-number/style/css.d.ts +1 -0
- package/es/input-number/style/css.js +1 -0
- package/es/input-number/style/index.css +331 -0
- package/es/input-number/style/index.d.ts +1 -0
- package/es/input-number/style/index.js +2 -0
- package/es/input-number/style/index.js.map +1 -0
- package/es/input-number/type.d.ts +156 -0
- package/es/input-number/useInputNumber.d.ts +51 -0
- package/es/input-number/useInputNumber.js +809 -0
- package/es/input-number/useInputNumber.js.map +1 -0
- package/es/ip-input/IPInput.d.ts +5 -0
- package/es/ip-input/IPInput.js +16 -0
- package/es/ip-input/IPInput.js.map +1 -0
- package/es/ip-input/defaultProps.d.ts +2 -0
- package/es/ip-input/index.d.ts +3 -0
- package/es/ip-input/index.js +16 -0
- package/es/ip-input/index.js.map +1 -0
- package/es/ip-input/style/index.css +323 -0
- package/es/ip-input/style/index.d.ts +1 -0
- package/es/ip-input/style/index.js +2 -0
- package/es/ip-input/style/index.js.map +1 -0
- package/es/ip-input/type.d.ts +113 -0
- package/es/ip-input/utils.d.ts +35 -0
- package/es/layout/Aside.d.ts +11 -0
- package/es/layout/Aside.js +41 -0
- package/es/layout/Aside.js.map +1 -0
- package/es/layout/Layout.d.ts +26 -0
- package/es/layout/Layout.js +106 -0
- package/es/layout/Layout.js.map +1 -0
- package/es/layout/defaultProps.d.ts +5 -0
- package/es/layout/index.d.ts +10 -0
- package/es/layout/index.js +19 -0
- package/es/layout/index.js.map +1 -0
- package/es/layout/style/index.css +56 -0
- package/es/layout/style/index.d.ts +1 -0
- package/es/layout/style/index.js +2 -0
- package/es/layout/style/index.js.map +1 -0
- package/es/layout/type.d.ts +38 -0
- package/es/list/List.d.ts +17 -0
- package/es/list/List.js +217 -0
- package/es/list/List.js.map +1 -0
- package/es/list/ListItem.d.ts +15 -0
- package/es/list/ListItem.js +31 -0
- package/es/list/ListItem.js.map +1 -0
- package/es/list/ListItemMeta.d.ts +10 -0
- package/es/list/ListItemMeta.js +45 -0
- package/es/list/ListItemMeta.js.map +1 -0
- package/es/list/defaultProps.d.ts +7 -0
- package/es/list/hooks/useListVirtualScroll.d.ts +24 -0
- package/es/list/index.d.ts +10 -0
- package/es/list/index.js +40 -0
- package/es/list/index.js.map +1 -0
- package/es/list/style/css.d.ts +1 -0
- package/es/list/style/css.js +1 -0
- package/es/list/style/index.css +172 -0
- package/es/list/style/index.d.ts +1 -0
- package/es/list/style/index.js +2 -0
- package/es/list/style/index.js.map +1 -0
- package/es/list/type.d.ts +92 -0
- package/es/loading/Gradient.d.ts +6 -0
- package/es/loading/Gradient.js +4 -3
- package/es/loading/Gradient.js.map +1 -1
- package/es/loading/Loading.d.ts +7 -0
- package/es/loading/Loading.js +7 -5
- package/es/loading/Loading.js.map +1 -1
- package/es/loading/circleAdapter.d.ts +1 -0
- package/es/loading/defaultProps.d.ts +2 -0
- package/es/loading/index.d.ts +5 -0
- package/es/loading/index.js +7 -5
- package/es/loading/index.js.map +1 -1
- package/es/loading/style/css.d.ts +1 -0
- package/es/loading/style/index.d.ts +1 -0
- package/es/loading/type.d.ts +68 -0
- package/es/loading/utils/setStyle.d.ts +7 -0
- package/es/locale/LocalReceiver.d.ts +6 -0
- package/es/locale/ar_KW.d.ts +3 -0
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/it_IT.d.ts +3 -0
- package/es/locale/ja_JP.d.ts +3 -0
- package/es/locale/ko_KR.d.ts +3 -0
- package/es/locale/ru_RU.d.ts +3 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_TW.d.ts +3 -0
- package/es/myform/index.d.ts +0 -0
- package/es/notification/Notify.d.ts +11 -0
- package/es/notification/NotifyContainer.d.ts +13 -0
- package/es/notification/NotifyContainer.js +3 -2
- package/es/notification/NotifyContainer.js.map +1 -1
- package/es/notification/NotifyContext.d.ts +23 -0
- package/es/notification/NotifyContext.js +3 -2
- package/es/notification/NotifyContext.js.map +1 -1
- package/es/notification/NotifyItem.d.ts +4 -0
- package/es/notification/NotifyItem.js +3 -2
- package/es/notification/NotifyItem.js.map +1 -1
- package/es/notification/index.d.ts +3 -0
- package/es/notification/index.js +3 -2
- package/es/notification/index.js.map +1 -1
- package/es/notification/style/css.d.ts +1 -0
- package/es/notification/style/index.d.ts +1 -0
- package/es/notification/type.d.ts +22 -0
- package/es/popup/Popup.d.ts +21 -0
- package/es/popup/Popup.js +36 -100
- package/es/popup/Popup.js.map +1 -1
- package/es/popup/defaultProps.d.ts +5 -0
- package/es/popup/hooks/useTrigger.d.ts +20 -0
- package/es/popup/index.d.ts +5 -0
- package/es/popup/index.js +8 -4
- package/es/popup/index.js.map +1 -1
- package/es/popup/style/css.d.ts +1 -0
- package/es/popup/style/index.d.ts +1 -0
- package/es/popup/type.d.ts +109 -0
- package/es/portal/Portal.d.ts +16 -0
- package/es/portal/Portal.js +2 -1
- package/es/portal/Portal.js.map +1 -1
- package/es/portal/index.d.ts +1 -0
- package/es/portal/index.js +2 -1
- package/es/portal/index.js.map +1 -1
- package/es/radio/Radio.d.ts +8 -0
- package/es/radio/Radio.js +22 -0
- package/es/radio/Radio.js.map +1 -0
- package/es/radio/RadioGroup.d.ts +14 -0
- package/es/radio/RadioGroup.js +22 -0
- package/es/radio/RadioGroup.js.map +1 -0
- package/es/radio/defaultProps.d.ts +3 -0
- package/es/radio/index.d.ts +10 -0
- package/es/radio/index.js +28 -0
- package/es/radio/index.js.map +1 -0
- package/es/radio/style/css.d.ts +0 -0
- package/es/radio/style/css.js +0 -0
- package/es/radio/style/index.css +333 -0
- package/es/radio/style/index.d.ts +1 -0
- package/es/radio/style/index.js +2 -0
- package/es/radio/style/index.js.map +1 -0
- package/es/radio/type.d.ts +117 -0
- package/es/radio/useKeyboard.d.ts +4 -0
- package/es/select/Option.d.ts +24 -0
- package/es/select/Option.js +3 -2
- package/es/select/Option.js.map +1 -1
- package/es/select/OptionGroup.d.ts +7 -0
- package/es/select/OptionGroup.js +4 -3
- package/es/select/OptionGroup.js.map +1 -1
- package/es/select/PopupContent.d.ts +24 -0
- package/es/select/PopupContent.js +6 -4
- package/es/select/PopupContent.js.map +1 -1
- package/es/select/Select.d.ts +13 -0
- package/es/select/Select.js +21 -12
- package/es/select/Select.js.map +1 -1
- package/es/select/defaultProps.d.ts +4 -0
- package/es/select/hooks/useOptions.d.ts +16 -0
- package/es/select/hooks/usePanelVirtualScroll.d.ts +24 -0
- package/es/select/index.d.ts +8 -0
- package/es/select/index.js +14 -8
- package/es/select/index.js.map +1 -1
- package/es/select/style/css.d.ts +1 -0
- package/es/select/style/index.d.ts +1 -0
- package/es/select/type.d.ts +344 -0
- package/es/select/utils/helper.d.ts +18 -0
- package/es/select-input/SelectInput.d.ts +11 -0
- package/es/select-input/SelectInput.js +10 -5
- package/es/select-input/SelectInput.js.map +1 -1
- package/es/select-input/defaultProps.d.ts +2 -0
- package/es/select-input/hook/useMultiple.d.ts +23 -0
- package/es/select-input/hook/useMultiple.js +7 -4
- package/es/select-input/hook/useMultiple.js.map +1 -1
- package/es/select-input/hook/useOverlayInnerStyle.d.ts +11 -0
- package/es/select-input/hook/useSingle.d.ts +16 -0
- package/es/select-input/hook/useSingle.js +5 -3
- package/es/select-input/hook/useSingle.js.map +1 -1
- package/es/select-input/index.d.ts +5 -0
- package/es/select-input/index.js +10 -5
- package/es/select-input/index.js.map +1 -1
- package/es/select-input/interface.d.ts +17 -0
- package/es/select-input/style/css.d.ts +1 -0
- package/es/select-input/style/index.d.ts +1 -0
- package/es/select-input/type.d.ts +243 -0
- package/es/slider/Slider.d.ts +7 -0
- package/es/slider/Slider.js +668 -0
- package/es/slider/Slider.js.map +1 -0
- package/es/slider/SliderHandleButton.d.ts +11 -0
- package/es/slider/SliderHandleButton.js +48 -0
- package/es/slider/SliderHandleButton.js.map +1 -0
- package/es/slider/defaultProps.d.ts +5 -0
- package/es/slider/index.d.ts +5 -0
- package/es/slider/index.js +46 -0
- package/es/slider/index.js.map +1 -0
- package/es/slider/style/css.d.ts +1 -0
- package/es/slider/style/css.js +1 -0
- package/es/slider/style/index.css +252 -0
- package/es/slider/style/index.d.ts +1 -0
- package/es/slider/style/index.js +2 -0
- package/es/slider/style/index.js.map +1 -0
- package/es/slider/type.d.ts +78 -0
- package/es/space/defaultProps.d.ts +0 -0
- package/es/space/index.d.ts +0 -0
- package/es/space/type.d.ts +0 -0
- package/es/style/index.css +24 -34
- package/es/style/index.d.ts +1 -0
- package/es/switch/Switch.d.ts +9 -0
- package/es/switch/Switch.js +9 -47
- package/es/switch/Switch.js.map +1 -1
- package/es/switch/defaultProps.d.ts +2 -0
- package/es/switch/index.d.ts +4 -0
- package/es/switch/index.js +8 -5
- package/es/switch/index.js.map +1 -1
- package/es/switch/style/css.d.ts +1 -0
- package/es/switch/style/index.d.ts +1 -0
- package/es/switch/type.d.ts +48 -0
- package/es/tab/TabBar.d.ts +9 -0
- package/es/tab/TabBar.js +109 -0
- package/es/tab/TabBar.js.map +1 -0
- package/es/tab/TabNav.d.ts +10 -0
- package/es/tab/TabNav.js +123 -0
- package/es/tab/TabNav.js.map +1 -0
- package/es/tab/TabNavItem.d.ts +15 -0
- package/es/tab/TabNavItem.js +65 -0
- package/es/tab/TabNavItem.js.map +1 -0
- package/es/tab/TabPanel.d.ts +9 -0
- package/es/tab/TabPanel.js +11 -0
- package/es/tab/TabPanel.js.map +1 -0
- package/es/tab/Tabs.d.ts +10 -0
- package/es/tab/Tabs.js +95 -0
- package/es/tab/Tabs.js.map +1 -0
- package/es/tab/defaultProps.d.ts +3 -0
- package/es/tab/index.d.ts +8 -0
- package/es/tab/index.js +31 -0
- package/es/tab/index.js.map +1 -0
- package/es/tab/style/index.css +159 -0
- package/es/tab/style/index.d.ts +1 -0
- package/es/tab/style/index.js +2 -0
- package/es/tab/style/index.js.map +1 -0
- package/es/tab/type.d.ts +130 -0
- package/es/tab/useTabClass.d.ts +8 -0
- package/es/table/Cell.d.ts +18 -0
- package/es/table/Cell.js +73 -0
- package/es/table/Cell.js.map +1 -0
- package/es/table/TBody.d.ts +28 -0
- package/es/table/TBody.js +70 -0
- package/es/table/TBody.js.map +1 -0
- package/es/table/THead.d.ts +10 -0
- package/es/table/THead.js +56 -0
- package/es/table/THead.js.map +1 -0
- package/es/table/TR.d.ts +28 -0
- package/es/table/TR.js +76 -0
- package/es/table/TR.js.map +1 -0
- package/es/table/Table.d.ts +6 -0
- package/es/table/Table.js +98 -0
- package/es/table/Table.js.map +1 -0
- package/es/table/defaultProps.d.ts +2 -0
- package/es/table/hooks/index.d.ts +4 -0
- package/es/table/hooks/index.js +98 -0
- package/es/table/hooks/index.js.map +1 -0
- package/es/table/hooks/useTableClassName.d.ts +26 -0
- package/es/table/hooks/useTableStyle.d.ts +11 -0
- package/es/table/index.d.ts +5 -0
- package/es/table/index.js +22 -0
- package/es/table/index.js.map +1 -0
- package/es/table/style/css.d.ts +1 -0
- package/es/table/style/css.js +1 -0
- package/es/table/style/index.css +139 -0
- package/es/table/style/index.d.ts +1 -0
- package/es/table/style/index.js +2 -0
- package/es/table/style/index.js.map +1 -0
- package/es/table/type.d.ts +195 -0
- package/es/tag/Tag.d.ts +14 -0
- package/es/tag/Tag.js +5 -1182
- package/es/tag/Tag.js.map +1 -1
- package/es/tag/defaultProps.d.ts +7 -0
- package/es/tag/index.d.ts +4 -0
- package/es/tag/index.js +5 -3
- package/es/tag/index.js.map +1 -1
- package/es/tag/style/css.d.ts +1 -0
- package/es/tag/style/index.d.ts +1 -0
- package/es/tag/type.d.ts +169 -0
- package/es/tag-input/TagInput.d.ts +9 -0
- package/es/tag-input/TagInput.js +7 -4
- package/es/tag-input/TagInput.js.map +1 -1
- package/es/tag-input/defaultProps.d.ts +2 -0
- package/es/tag-input/hooks/useHover.d.ts +17 -0
- package/es/tag-input/hooks/useTagList.d.ts +30 -0
- package/es/tag-input/hooks/useTagList.js +5 -3
- package/es/tag-input/hooks/useTagList.js.map +1 -1
- package/es/tag-input/hooks/useTagScroll.d.ts +25 -0
- package/es/tag-input/index.d.ts +5 -0
- package/es/tag-input/index.js +7 -4
- package/es/tag-input/index.js.map +1 -1
- package/es/tag-input/style/css.d.ts +1 -0
- package/es/tag-input/style/index.d.ts +1 -0
- package/es/tag-input/type.d.ts +235 -0
- package/es/tag-input/useTagList.d.ts +30 -0
- package/es/tag-input/useTagList.js +5 -3
- package/es/tag-input/useTagList.js.map +1 -1
- package/es/utils/composeRefs.d.ts +2 -0
- package/es/utils/dom.d.ts +7 -0
- package/es/utils/forwardRefWithStatics.d.ts +2 -0
- package/es/utils/getScrollbarWidth.d.ts +6 -0
- package/es/utils/helper.d.ts +46 -0
- package/es/utils/input-number/large-number.d.ts +85 -0
- package/es/utils/input-number/number.d.ts +81 -0
- package/es/utils/isFragment.d.ts +4 -0
- package/es/utils/listener.d.ts +4 -0
- package/es/utils/log/index.d.ts +2 -0
- package/es/utils/log/index.js +27 -0
- package/es/utils/log/index.js.map +1 -0
- package/es/utils/log/log.d.ts +3 -0
- package/es/utils/log/types.d.ts +8 -0
- package/es/utils/noop.d.ts +2 -0
- package/es/utils/number.d.ts +7 -0
- package/es/utils/parentTNode.d.ts +10 -0
- package/es/utils/parseTNode.d.ts +10 -0
- package/es/utils/react-render.d.ts +16 -0
- package/es/utils/ref.d.ts +1 -0
- package/es/utils/refs.d.ts +13 -0
- package/es/utils/scroll.d.ts +3 -0
- package/es/utils/style.d.ts +4 -0
- package/es/utils/transition.d.ts +20 -0
- package/package.json +60 -59
- package/LICENSE +0 -21
- package/es/_chunks/dep-0QH2Ee4R.js.map +0 -1
- package/es/_chunks/dep-BH5n5r1M.js.map +0 -1
- package/es/_chunks/dep-D7LanWes.js.map +0 -1
- package/es/_chunks/dep-DZ_0EvBk.js.map +0 -1
- package/es/_chunks/dep-Dk2xX8lh.js.map +0 -1
- package/es/_chunks/dep-EcrDKDlu.js.map +0 -1
- package/es/_chunks/dep-bWaVq_y3.js.map +0 -1
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
|
|
3
|
+
* */
|
|
4
|
+
import { InputProps } from '../input';
|
|
5
|
+
import { PopupProps } from '../popup';
|
|
6
|
+
import { SelectInputProps } from '../select-input';
|
|
7
|
+
import { TagInputProps } from '../tag-input';
|
|
8
|
+
import { TagProps } from '../tag';
|
|
9
|
+
import { SelectInputValueChangeContext } from '../select-input';
|
|
10
|
+
import { PopupVisibleChangeContext } from '../popup';
|
|
11
|
+
import { PlainObject, TNode, TElement, SizeEnum, InfinityScroll } from '../common';
|
|
12
|
+
import { MouseEvent, KeyboardEvent, FocusEvent } from 'react';
|
|
13
|
+
export interface TdSelectProps<T extends SelectOption = SelectOption> {
|
|
14
|
+
/**
|
|
15
|
+
* 宽度随内容自适应
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
autoWidth?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 自动聚焦
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
autofocus?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 无边框模式
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
borderless?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 是否可以清空选项
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
clearable?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedSelectedItems` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签
|
|
36
|
+
*/
|
|
37
|
+
collapsedItems?: TNode<{
|
|
38
|
+
value: T[];
|
|
39
|
+
collapsedSelectedItems: T[];
|
|
40
|
+
count: number;
|
|
41
|
+
onClose: (context: {
|
|
42
|
+
index: number;
|
|
43
|
+
e?: MouseEvent;
|
|
44
|
+
}) => void;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* 是否允许用户创建新条目,需配合 filterable 使用
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
creatable?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 是否禁用组件
|
|
53
|
+
*/
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* 当下拉列表为空时显示的内容
|
|
57
|
+
*/
|
|
58
|
+
empty?: TNode;
|
|
59
|
+
/**
|
|
60
|
+
* 自定义搜索规则,用于对现有数据进行搜索,判断是否过滤某一项数据。参数 `filterWords` 表示搜索词,`option`表示单个选项内容,返回值为 `true` 保留该选项,返回值为 `false` 则隐藏该选项。使用该方法时无需设置 `filterable`
|
|
61
|
+
*/
|
|
62
|
+
filter?: (filterWords: string, option: T) => boolean | Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* 是否可搜索,默认搜索规则不区分大小写,全文本任意位置匹配。如果默认搜索规则不符合业务需求,可以更为使用 `filter` 自定义过滤规则
|
|
65
|
+
*/
|
|
66
|
+
filterable?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* 透传 Input 输入框组件的全部属性
|
|
69
|
+
*/
|
|
70
|
+
inputProps?: InputProps;
|
|
71
|
+
/**
|
|
72
|
+
* 输入框的值
|
|
73
|
+
*/
|
|
74
|
+
inputValue?: string;
|
|
75
|
+
/**
|
|
76
|
+
* 输入框的值,非受控属性
|
|
77
|
+
*/
|
|
78
|
+
defaultInputValue?: string;
|
|
79
|
+
/**
|
|
80
|
+
* 用来定义 value / label / disabled 在 `options` 中对应的字段别名
|
|
81
|
+
*/
|
|
82
|
+
keys?: SelectKeysType;
|
|
83
|
+
/**
|
|
84
|
+
* 左侧文本
|
|
85
|
+
*/
|
|
86
|
+
label?: TNode;
|
|
87
|
+
/**
|
|
88
|
+
* 是否为加载状态
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
loading?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* 远程加载时显示的文字,支持自定义。如加上超链接
|
|
94
|
+
*/
|
|
95
|
+
loadingText?: TNode;
|
|
96
|
+
/**
|
|
97
|
+
* 用于控制多选数量,值为 0 则不限制
|
|
98
|
+
* @default 0
|
|
99
|
+
*/
|
|
100
|
+
max?: number;
|
|
101
|
+
/**
|
|
102
|
+
* 最小折叠数量,用于多选情况下折叠选中项,超出该数值的选中项折叠。值为 0 则表示不折叠
|
|
103
|
+
* @default 0
|
|
104
|
+
*/
|
|
105
|
+
minCollapsedNum?: number;
|
|
106
|
+
/**
|
|
107
|
+
* 是否允许多选
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
multiple?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* 数据化配置选项内容
|
|
113
|
+
*/
|
|
114
|
+
options?: Array<T>;
|
|
115
|
+
/**
|
|
116
|
+
* 下拉选项布局方式,有纵向排列和横向排列两种,默认纵向排列
|
|
117
|
+
* @default vertical
|
|
118
|
+
*/
|
|
119
|
+
optionsLayout?: 'vertical' | 'horizontal';
|
|
120
|
+
/**
|
|
121
|
+
* 面板内的底部内容
|
|
122
|
+
*/
|
|
123
|
+
panelBottomContent?: TNode;
|
|
124
|
+
/**
|
|
125
|
+
* 面板内的顶部内容
|
|
126
|
+
*/
|
|
127
|
+
panelTopContent?: TNode;
|
|
128
|
+
/**
|
|
129
|
+
* 占位符
|
|
130
|
+
*/
|
|
131
|
+
placeholder?: string;
|
|
132
|
+
/**
|
|
133
|
+
* 透传给 popup 组件的全部属性
|
|
134
|
+
*/
|
|
135
|
+
popupProps?: PopupProps;
|
|
136
|
+
/**
|
|
137
|
+
* 是否显示下拉框
|
|
138
|
+
*/
|
|
139
|
+
popupVisible?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* 是否显示下拉框,非受控属性
|
|
142
|
+
*/
|
|
143
|
+
defaultPopupVisible?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* 组件前置图标
|
|
146
|
+
*/
|
|
147
|
+
prefixIcon?: TElement;
|
|
148
|
+
/**
|
|
149
|
+
* 只读状态,值为真会隐藏输入框,且无法打开下拉框
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
readonly?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* 多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
reserveKeyword?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`
|
|
160
|
+
*/
|
|
161
|
+
scroll?: InfinityScroll;
|
|
162
|
+
/**
|
|
163
|
+
* 透传 SelectInput 筛选器输入框组件的全部属性
|
|
164
|
+
*/
|
|
165
|
+
selectInputProps?: SelectInputProps;
|
|
166
|
+
/**
|
|
167
|
+
* 是否显示右侧箭头,默认显示
|
|
168
|
+
* @default true
|
|
169
|
+
*/
|
|
170
|
+
showArrow?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* 组件尺寸
|
|
173
|
+
* @default medium
|
|
174
|
+
*/
|
|
175
|
+
size?: SizeEnum;
|
|
176
|
+
/**
|
|
177
|
+
* 输入框状态
|
|
178
|
+
* @default default
|
|
179
|
+
*/
|
|
180
|
+
status?: 'default' | 'success' | 'warning' | 'error';
|
|
181
|
+
/**
|
|
182
|
+
* 后置图标前的后置内容
|
|
183
|
+
*/
|
|
184
|
+
suffix?: TNode;
|
|
185
|
+
/**
|
|
186
|
+
* 组件后置图标
|
|
187
|
+
*/
|
|
188
|
+
suffixIcon?: TElement;
|
|
189
|
+
/**
|
|
190
|
+
* 透传 TagInput 标签输入框组件的全部属性
|
|
191
|
+
*/
|
|
192
|
+
tagInputProps?: TagInputProps;
|
|
193
|
+
/**
|
|
194
|
+
* 透传 Tag 标签组件全部属性
|
|
195
|
+
*/
|
|
196
|
+
tagProps?: TagProps;
|
|
197
|
+
/**
|
|
198
|
+
* 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式
|
|
199
|
+
*/
|
|
200
|
+
tips?: TNode;
|
|
201
|
+
/**
|
|
202
|
+
* 选中值
|
|
203
|
+
*/
|
|
204
|
+
value?: SelectValue;
|
|
205
|
+
/**
|
|
206
|
+
* 选中值,非受控属性
|
|
207
|
+
*/
|
|
208
|
+
defaultValue?: SelectValue;
|
|
209
|
+
/**
|
|
210
|
+
* 自定义选中项呈现的内容
|
|
211
|
+
*/
|
|
212
|
+
valueDisplay?: string | TNode<{
|
|
213
|
+
value: SelectValue;
|
|
214
|
+
onClose: (index: number) => void;
|
|
215
|
+
displayValue?: SelectValue;
|
|
216
|
+
}>;
|
|
217
|
+
/**
|
|
218
|
+
* 用于控制选中值的类型。假设数据选项为:`[{ label: '姓名', value: 'name' }]`,value 表示值仅返回数据选项中的 value, object 表示值返回全部数据。
|
|
219
|
+
* @default value
|
|
220
|
+
*/
|
|
221
|
+
valueType?: 'value' | 'object';
|
|
222
|
+
/**
|
|
223
|
+
* 输入框失去焦点时触发
|
|
224
|
+
*/
|
|
225
|
+
onBlur?: (context: {
|
|
226
|
+
value: SelectValue;
|
|
227
|
+
e: FocusEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>;
|
|
228
|
+
}) => void;
|
|
229
|
+
/**
|
|
230
|
+
* 选中值变化时触发。`context.trigger` 表示触发变化的来源;`context.selectedOptions` 表示选中值的完整对象,数组长度一定和 `value` 相同;`context.option` 表示当前操作的选项,不一定存在
|
|
231
|
+
*/
|
|
232
|
+
onChange?: (value: SelectValue, context: {
|
|
233
|
+
option?: T;
|
|
234
|
+
selectedOptions: T[];
|
|
235
|
+
trigger: SelectValueChangeTrigger;
|
|
236
|
+
e?: MouseEvent<SVGElement | HTMLDivElement | HTMLLIElement> | KeyboardEvent<HTMLInputElement>;
|
|
237
|
+
}) => void;
|
|
238
|
+
/**
|
|
239
|
+
* 点击清除按钮时触发
|
|
240
|
+
*/
|
|
241
|
+
onClear?: (context: {
|
|
242
|
+
e: MouseEvent<HTMLDivElement>;
|
|
243
|
+
}) => void;
|
|
244
|
+
/**
|
|
245
|
+
* 当选择新创建的条目时触发
|
|
246
|
+
*/
|
|
247
|
+
onCreate?: (value: string | number) => void;
|
|
248
|
+
/**
|
|
249
|
+
* 回车键按下时触发。`inputValue` 表示输入框的值,`value` 表示选中值
|
|
250
|
+
*/
|
|
251
|
+
onEnter?: (context: {
|
|
252
|
+
inputValue: string;
|
|
253
|
+
e: KeyboardEvent<HTMLDivElement>;
|
|
254
|
+
value: SelectValue;
|
|
255
|
+
}) => void;
|
|
256
|
+
/**
|
|
257
|
+
* 输入框获得焦点时触发
|
|
258
|
+
*/
|
|
259
|
+
onFocus?: (context: {
|
|
260
|
+
value: SelectValue;
|
|
261
|
+
e: FocusEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>;
|
|
262
|
+
}) => void;
|
|
263
|
+
/**
|
|
264
|
+
* 输入框值发生变化时触发,`context.trigger` 表示触发输入框值变化的来源:文本输入触发、清除按钮触发、失去焦点等
|
|
265
|
+
*/
|
|
266
|
+
onInputChange?: (value: string, context?: SelectInputValueChangeContext) => void;
|
|
267
|
+
/**
|
|
268
|
+
* 下拉框显示或隐藏时触发
|
|
269
|
+
*/
|
|
270
|
+
onPopupVisibleChange?: (visible: boolean, context: PopupVisibleChangeContext) => void;
|
|
271
|
+
/**
|
|
272
|
+
* 多选模式下,选中数据被移除时触发
|
|
273
|
+
*/
|
|
274
|
+
onRemove?: (options: SelectRemoveContext<T>) => void;
|
|
275
|
+
/**
|
|
276
|
+
* 输入值变化时,触发搜索事件。主要用于远程搜索新数据
|
|
277
|
+
*/
|
|
278
|
+
onSearch?: (filterWords: string, context: {
|
|
279
|
+
e: KeyboardEvent<HTMLDivElement>;
|
|
280
|
+
}) => void;
|
|
281
|
+
}
|
|
282
|
+
export interface TdOptionProps {
|
|
283
|
+
/**
|
|
284
|
+
* 当前选项是否为全选,全选可以在顶部,也可以在底部。点击当前选项会选中禁用态除外的全部选项,即使是分组选择器也会选中全部选项
|
|
285
|
+
* @default false
|
|
286
|
+
*/
|
|
287
|
+
checkAll?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* 用于定义复杂的选项内容,同 content
|
|
290
|
+
*/
|
|
291
|
+
children?: TNode;
|
|
292
|
+
/**
|
|
293
|
+
* 用于定义复杂的选项内容
|
|
294
|
+
*/
|
|
295
|
+
content?: TNode;
|
|
296
|
+
/**
|
|
297
|
+
* 是否禁用该选项
|
|
298
|
+
* @default false
|
|
299
|
+
*/
|
|
300
|
+
disabled?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* 选项名称
|
|
303
|
+
* @default ''
|
|
304
|
+
*/
|
|
305
|
+
label?: string;
|
|
306
|
+
/**
|
|
307
|
+
* 选项标题,在选项过长时hover选项展示
|
|
308
|
+
* @default ''
|
|
309
|
+
*/
|
|
310
|
+
title?: string;
|
|
311
|
+
/**
|
|
312
|
+
* 选项值
|
|
313
|
+
*/
|
|
314
|
+
value?: string | number;
|
|
315
|
+
}
|
|
316
|
+
export interface TdOptionGroupProps {
|
|
317
|
+
/**
|
|
318
|
+
* 是否显示分隔线
|
|
319
|
+
* @default true
|
|
320
|
+
*/
|
|
321
|
+
divider?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* 分组别名
|
|
324
|
+
* @default ''
|
|
325
|
+
*/
|
|
326
|
+
label?: string;
|
|
327
|
+
}
|
|
328
|
+
export interface SelectKeysType {
|
|
329
|
+
value?: string;
|
|
330
|
+
label?: string;
|
|
331
|
+
disabled?: string;
|
|
332
|
+
}
|
|
333
|
+
export type SelectValue<T extends SelectOption = SelectOption> = string | number | boolean | T | Array<SelectValue<T>>;
|
|
334
|
+
export type SelectValueChangeTrigger = 'clear' | 'tag-remove' | 'backspace' | 'check' | 'uncheck' | 'default';
|
|
335
|
+
export interface SelectRemoveContext<T> {
|
|
336
|
+
value: SelectValue;
|
|
337
|
+
data: T;
|
|
338
|
+
e: MouseEvent<HTMLDivElement | HTMLLIElement> | KeyboardEvent<HTMLDivElement>;
|
|
339
|
+
}
|
|
340
|
+
export type SelectOption = TdOptionProps | SelectOptionGroup | PlainObject;
|
|
341
|
+
export interface SelectOptionGroup extends TdOptionGroupProps {
|
|
342
|
+
group: string;
|
|
343
|
+
children: Array<TdOptionProps>;
|
|
344
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { SelectValue, TdOptionProps, SelectKeysType, TdSelectProps, SelectOption, SelectOptionGroup } from "../type";
|
|
3
|
+
export declare function isSelectOptionGroup(option: SelectOption): option is SelectOptionGroup;
|
|
4
|
+
export type ValueToOption = {
|
|
5
|
+
[value: string | number]: TdOptionProps;
|
|
6
|
+
};
|
|
7
|
+
export declare const getValueToOption: (children: ReactElement, options: SelectOption[], keys: SelectKeysType) => ValueToOption;
|
|
8
|
+
export declare const getLabel: (children: ReactElement, value: SelectValue<TdOptionProps>, options: TdOptionProps[], keys: SelectKeysType) => string;
|
|
9
|
+
export declare const getMultipleTags: (values: SelectValue[], keys: SelectKeysType) => {
|
|
10
|
+
label: any;
|
|
11
|
+
value: any;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const getSelectValueArr: (values: SelectValue | SelectValue[], activeValue: SelectValue, selected?: boolean, valueType?: TdSelectProps["valueType"], keys?: SelectKeysType, objVal?: SelectValue) => (string | number | boolean | import("../../common").PlainObject | TdOptionProps | SelectOptionGroup | SelectValue<SelectOption>[])[];
|
|
14
|
+
export declare const getSelectedOptions: (value: SelectValue, multiple: TdSelectProps["multiple"], valueType: TdSelectProps["valueType"], keys: SelectKeysType, valueToOption: ValueToOption, selectedValue?: SelectValue) => {
|
|
15
|
+
currentSelectedOptions: any[];
|
|
16
|
+
currentOption: SelectOption;
|
|
17
|
+
allSelectedValue: SelectValue[];
|
|
18
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PopupRef } from "../popup";
|
|
3
|
+
import { TdSelectInputProps } from "./type";
|
|
4
|
+
import { StyledProps } from "../common";
|
|
5
|
+
import { InputRef } from "../input";
|
|
6
|
+
export interface SelectInputProps extends TdSelectInputProps, StyledProps {
|
|
7
|
+
updateScrollTop?: (content: HTMLDivElement) => void;
|
|
8
|
+
options?: unknown[];
|
|
9
|
+
}
|
|
10
|
+
declare const SelectInput: React.ForwardRefExoticComponent<SelectInputProps & React.RefAttributes<Partial<PopupRef & InputRef>>>;
|
|
11
|
+
export default SelectInput;
|
|
@@ -8,15 +8,17 @@ import { _ as _typeof } from '../_chunks/dep-D-UKOauR.js';
|
|
|
8
8
|
import { _ as _slicedToArray } from '../_chunks/dep-CzLhKWCf.js';
|
|
9
9
|
import { isFunction, isObject } from 'lodash-es';
|
|
10
10
|
import { u as useControlled } from '../_chunks/dep-DwWrhxkd.js';
|
|
11
|
-
import { u as useConfig } from '../_chunks/dep-
|
|
11
|
+
import { u as useConfig } from '../_chunks/dep-gy8uvBaS.js';
|
|
12
12
|
import { u as useDefaultProps } from '../_chunks/dep-DGvfel3I.js';
|
|
13
13
|
import '../input/index.js';
|
|
14
14
|
import '../input/Input.js';
|
|
15
15
|
import '../_chunks/dep-DN7d1SzH.js';
|
|
16
16
|
import '@tendaui/icons';
|
|
17
|
-
import '../_chunks/dep-
|
|
17
|
+
import '../_chunks/dep-BRbJGDI9.js';
|
|
18
|
+
import '../_chunks/dep-DRwijJcv.js';
|
|
18
19
|
import '../_chunks/dep-D6YxJv-F.js';
|
|
19
|
-
import '../
|
|
20
|
+
import '../_chunks/dep-5U9UjDaf.js';
|
|
21
|
+
import 'dayjs';
|
|
20
22
|
import '../input/InputGroup.js';
|
|
21
23
|
import '../input/style/css.js';
|
|
22
24
|
import '../tag-input/index.js';
|
|
@@ -25,8 +27,9 @@ import '../tag-input/hooks/useTagList.js';
|
|
|
25
27
|
import '../_chunks/dep-CgyDw_YI.js';
|
|
26
28
|
import '../tag/index.js';
|
|
27
29
|
import '../tag/Tag.js';
|
|
30
|
+
import '../_chunks/dep-zOZQ0R9g.js';
|
|
28
31
|
import '../_chunks/dep-U1T8CQY9.js';
|
|
29
|
-
import '../_chunks/dep-
|
|
32
|
+
import '../_chunks/dep-ByzdZjUR.js';
|
|
30
33
|
import '../_chunks/dep-BP0-apUT.js';
|
|
31
34
|
import 'hoist-non-react-statics';
|
|
32
35
|
import '../tag/style/css.js';
|
|
@@ -35,12 +38,14 @@ import '../tag-input/style/css.js';
|
|
|
35
38
|
import '../popup/Popup.js';
|
|
36
39
|
import '../portal/Portal.js';
|
|
37
40
|
import 'react-dom';
|
|
41
|
+
import '../_chunks/dep-CkmtEv0Y.js';
|
|
38
42
|
import 'react-is';
|
|
39
43
|
import '../_chunks/dep-C1XcmShP.js';
|
|
44
|
+
import '../_chunks/dep-Ccktr_jk.js';
|
|
40
45
|
import '@popperjs/core';
|
|
41
46
|
import 'react-fast-compare';
|
|
42
47
|
import 'react-transition-group';
|
|
43
|
-
import '../_chunks/dep-
|
|
48
|
+
import '../_chunks/dep-DbVHGoUC.js';
|
|
44
49
|
import '../popup/style/css.js';
|
|
45
50
|
|
|
46
51
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.js","sources":["../../../components/select-input/hook/useOverlayInnerStyle.ts","../../../components/select-input/defaultProps.ts","../../../components/select-input/SelectInput.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { isObject, isFunction } from \"lodash-es\";\nimport useControlled from \"../../hooks/useControlled\";\nimport { TdSelectInputProps } from \"../type\";\nimport { TdPopupProps, PopupVisibleChangeContext } from \"../../popup\";\n\nexport type overlayStyleProps = Pick<\n TdSelectInputProps,\n | \"popupProps\"\n | \"autoWidth\"\n | \"readonly\"\n | \"onPopupVisibleChange\"\n | \"disabled\"\n | \"allowInput\"\n | \"popupVisible\"\n | \"defaultPopupVisible\"\n>;\n\nconst MAX_POPUP_WIDTH = 1000;\n\nexport default function useOverlayInnerStyle(\n props: overlayStyleProps,\n extra?: {\n afterHidePopups?: (ctx: PopupVisibleChangeContext) => void;\n }\n) {\n const { popupProps, autoWidth, readonly, disabled, onPopupVisibleChange, allowInput } = props;\n const [innerPopupVisible, setInnerPopupVisible] = useControlled(props, \"popupVisible\", onPopupVisibleChange);\n const matchWidthFunc = (triggerElement: HTMLElement, popupElement: HTMLElement) => {\n if (!triggerElement || !popupElement) {\n return;\n }\n\n const prevDisplay = popupElement.style.display;\n popupElement.style.display = \"\";\n const overlayScrollWidth = popupElement.offsetWidth - popupElement.scrollWidth;\n const width =\n popupElement.offsetWidth - overlayScrollWidth > triggerElement.offsetWidth\n ? popupElement.scrollWidth\n : triggerElement.offsetWidth - overlayScrollWidth;\n if (prevDisplay === \"none\") {\n popupElement.style.display = \"none\";\n }\n let otherOverlayInnerStyle: React.CSSProperties = {};\n if (popupProps && typeof popupProps.overlayInnerStyle === \"object\" && !popupProps.overlayInnerStyle.width) {\n otherOverlayInnerStyle = popupProps.overlayInnerStyle;\n }\n return {\n width: `${Math.min(width, MAX_POPUP_WIDTH)}px`,\n ...otherOverlayInnerStyle\n };\n };\n\n const onInnerPopupVisibleChange = (visible: boolean, context: PopupVisibleChangeContext) => {\n if (disabled || readonly) {\n return;\n }\n // 如果点击触发元素(输入框)且为可输入状态,则继续显示下拉框\n const newVisible = context.trigger === \"trigger-element-click\" && allowInput ? true : visible;\n if (props.popupVisible !== newVisible) {\n setInnerPopupVisible(newVisible, context);\n if (!newVisible) {\n extra?.afterHidePopups?.(context);\n }\n }\n };\n const tOverlayInnerStyle = useMemo(() => {\n let result: TdPopupProps[\"overlayInnerStyle\"] = {};\n const overlayInnerStyle = popupProps?.overlayInnerStyle || {};\n if (isFunction(overlayInnerStyle) || (isObject(overlayInnerStyle) && overlayInnerStyle.width)) {\n result = overlayInnerStyle;\n } else if (!autoWidth) {\n result = matchWidthFunc;\n }\n return result;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [autoWidth, popupProps?.overlayInnerStyle]);\n\n return {\n tOverlayInnerStyle,\n innerPopupVisible,\n onInnerPopupVisibleChange\n };\n}\n","import { TdSelectInputProps } from \"./type\";\n\nexport const selectInputDefaultProps: TdSelectInputProps = {\n allowInput: false,\n autoWidth: false,\n autofocus: false,\n borderless: false,\n clearable: false,\n loading: false,\n minCollapsedNum: 0,\n multiple: false,\n readonly: false,\n reserveKeyword: false,\n status: \"default\"\n};\n","import React, { useRef, useImperativeHandle } from \"react\";\nimport classNames from \"classnames\";\nimport useSingle from \"./hook/useSingle\";\nimport useMultiple from \"./hook/useMultiple\";\nimport Popup, { PopupRef, PopupVisibleChangeContext } from \"../popup\";\nimport useOverlayInnerStyle from \"./hook/useOverlayInnerStyle\";\nimport { TdSelectInputProps } from \"./type\";\nimport { StyledProps } from \"../common\";\nimport { selectInputDefaultProps } from \"./defaultProps\";\nimport useConfig from \"../hooks/useConfig\";\nimport useDefaultProps from \"../hooks/useDefaultProps\";\nimport { InputRef } from \"../input\";\n\nexport interface SelectInputProps extends TdSelectInputProps, StyledProps {\n updateScrollTop?: (content: HTMLDivElement) => void;\n options?: unknown[]; // 参数穿透options, 给SelectInput/SelectInput 自定义选中项呈现的内容和多选状态下设置折叠项内容\n}\n\nconst SelectInput = React.forwardRef<Partial<PopupRef & InputRef>, SelectInputProps>((originalProps, ref) => {\n const props = useDefaultProps<SelectInputProps>(originalProps, selectInputDefaultProps);\n const { classPrefix: prefix } = useConfig();\n const selectInputRef = useRef<PopupRef>(null);\n const selectInputWrapRef = useRef<HTMLElement>(null);\n const { multiple, value, popupVisible, popupProps, borderless, disabled } = props;\n const { commonInputProps, inputRef, singleInputValue, onInnerClear, renderSelectSingle } = useSingle(props);\n\n const { tagInputRef, multipleInputValue, renderSelectMultiple } = useMultiple(props);\n const { tOverlayInnerStyle, innerPopupVisible, onInnerPopupVisibleChange } = useOverlayInnerStyle(props, {\n afterHidePopups: onInnerBlur\n });\n\n const popupClasses = classNames([\n props.className,\n `${prefix}-select-input`,\n {\n [`${prefix}-select-input--borderless`]: borderless,\n [`${prefix}-select-input--multiple`]: multiple,\n [`${prefix}-select-input--popup-visible`]: popupVisible ?? innerPopupVisible,\n [`${prefix}-select-input--empty`]: value instanceof Array ? !value.length : !value\n }\n ]);\n useImperativeHandle(ref, () => ({\n ...(selectInputRef.current || {}),\n ...(inputRef.current || {}),\n ...(tagInputRef.current || {})\n }));\n\n // 浮层显示的受控与非受控\n const visibleProps = { visible: popupVisible ?? innerPopupVisible };\n function onInnerBlur(ctx: PopupVisibleChangeContext) {\n const inputValue = props.multiple ? multipleInputValue : singleInputValue;\n const params: Parameters<TdSelectInputProps[\"onBlur\"]>[1] = {\n e: ctx.e,\n inputValue\n };\n props.onBlur?.(props.value, params);\n }\n const mainContent = (\n <div className={popupClasses} style={props.style}>\n <Popup\n ref={selectInputRef}\n trigger={popupProps?.trigger || \"click\"}\n placement=\"bottom-left\"\n content={props.panel}\n hideEmptyPopup={true}\n onVisibleChange={onInnerPopupVisibleChange}\n updateScrollTop={props.updateScrollTop}\n {...visibleProps}\n {...popupProps}\n disabled={disabled}\n overlayInnerStyle={tOverlayInnerStyle}\n >\n {multiple\n ? renderSelectMultiple({\n commonInputProps,\n onInnerClear,\n popupVisible: visibleProps.visible,\n allowInput: props.allowInput\n })\n : renderSelectSingle(visibleProps.visible)}\n </Popup>\n </div>\n );\n if (!props.tips) {\n return mainContent;\n }\n\n return (\n <div ref={selectInputWrapRef as React.Ref<HTMLDivElement>} className={`t-select-input__wrap`}>\n {mainContent}\n {props.tips && <div className={`t-input__tips t-input__tips--${props.status || \"normal\"}`}>{props.tips}</div>}\n </div>\n );\n});\n\nSelectInput.displayName = \"SelectInput\";\n\nexport default SelectInput;\n"],"names":["MAX_POPUP_WIDTH","useOverlayInnerStyle","props","extra","popupProps","autoWidth","readonly","disabled","onPopupVisibleChange","allowInput","_useControlled","useControlled","_useControlled2","_slicedToArray","innerPopupVisible","setInnerPopupVisible","matchWidthFunc","triggerElement","popupElement","prevDisplay","style","display","overlayScrollWidth","offsetWidth","scrollWidth","width","otherOverlayInnerStyle","_typeof","overlayInnerStyle","_objectSpread","Math","min","onInnerPopupVisibleChange","visible","context","newVisible","trigger","popupVisible","_extra$afterHidePopup","afterHidePopups","call","tOverlayInnerStyle","useMemo","result","isFunction","isObject","selectInputDefaultProps","autofocus","borderless","clearable","loading","minCollapsedNum","multiple","reserveKeyword","status","SelectInput","React","forwardRef","originalProps","ref","useDefaultProps","_useConfig","useConfig","prefix","classPrefix","selectInputRef","useRef","selectInputWrapRef","value","_useSingle","useSingle","commonInputProps","inputRef","singleInputValue","onInnerClear","renderSelectSingle","_useMultiple","useMultiple","tagInputRef","multipleInputValue","renderSelectMultiple","_useOverlayInnerStyle","onInnerBlur","popupClasses","classNames","className","concat","_defineProperty","Array","length","useImperativeHandle","current","visibleProps","ctx","_props$onBlur","inputValue","params","e","onBlur","mainContent","createElement","Popup","placement","content","panel","hideEmptyPopup","onVisibleChange","updateScrollTop","tips","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,eAAA,GAAkB,GAAA;AAExB,SAAwBC,oBAAAA,CACtBC,OACAC,KAAA,EAGA;AACA,EAAA,IAAQC,UAAA,GAAgFF,KAAA,CAAhFE,UAAA;IAAYC,SAAA,GAAoEH,KAAA,CAApEG,SAAA;IAAWC,WAAyDJ,KAAA,CAAzDI;IAAUC,QAAA,GAA+CL,KAAA,CAA/CK,QAAA;IAAUC,oBAAA,GAAqCN,KAAA,CAArCM,oBAAA;IAAsBC,aAAeP,KAAA,CAAfO;EACzE,IAAAC,cAAA,GAAkDC,aAAA,CAAcT,KAAA,EAAO,gBAAgBM,oBAAoB,CAAA;IAAAI,eAAA,GAAAC,cAAA,CAAAH,cAAA,EAAA,CAAA,CAAA;AAApGI,IAAAA,iBAAA,GAAAF,eAAA,CAAA,CAAA,CAAA;AAAmBG,IAAAA,oBAAoB,GAAAH,eAAA,CAAA,CAAA,CAAA;EAC9C,IAAMI,cAAA,GAAiB,SAAjBA,cAAAA,CAAkBC,cAAA,EAA6BC,YAAA,EAA8B;AACjF,IAAA,IAAI,CAACD,cAAA,IAAkB,CAACC,YAAA,EAAc;AACpC,MAAA;AACF,IAAA;AAEA,IAAA,IAAMC,WAAA,GAAcD,aAAaE,KAAA,CAAMC,OAAA;AACvCH,IAAAA,YAAA,CAAaE,MAAMC,OAAA,GAAU,EAAA;IAC7B,IAAMC,kBAAA,GAAqBJ,YAAA,C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B,SAAA,EAAA;AAAW,GAAA,EACnEc,aACAjG,KAAA,CAAM0G,IAAA,uCAAS,KAAA,EAAA;AAAIvB,IAAAA,SAAA,kCAAAC,MAAA,CAA2CpF,KAAA,CAAMoD,MAAA,IAAU,QAAQ;AAAA,GAAA,EAAKpD,KAAA,CAAM0G,IAAK,CACzG,CAAA;AAEJ,CAAC;AAEDrD,WAAA,CAAYsD,WAAA,GAAc,aAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"SelectInput.js","sources":["../../../components/select-input/hook/useOverlayInnerStyle.ts","../../../components/select-input/defaultProps.ts","../../../components/select-input/SelectInput.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { isObject, isFunction } from \"lodash-es\";\nimport useControlled from \"../../hooks/useControlled\";\nimport { TdSelectInputProps } from \"../type\";\nimport { TdPopupProps, PopupVisibleChangeContext } from \"../../popup\";\n\nexport type overlayStyleProps = Pick<\n TdSelectInputProps,\n | \"popupProps\"\n | \"autoWidth\"\n | \"readonly\"\n | \"onPopupVisibleChange\"\n | \"disabled\"\n | \"allowInput\"\n | \"popupVisible\"\n | \"defaultPopupVisible\"\n>;\n\nconst MAX_POPUP_WIDTH = 1000;\n\nexport default function useOverlayInnerStyle(\n props: overlayStyleProps,\n extra?: {\n afterHidePopups?: (ctx: PopupVisibleChangeContext) => void;\n }\n) {\n const { popupProps, autoWidth, readonly, disabled, onPopupVisibleChange, allowInput } = props;\n const [innerPopupVisible, setInnerPopupVisible] = useControlled(props, \"popupVisible\", onPopupVisibleChange);\n const matchWidthFunc = (triggerElement: HTMLElement, popupElement: HTMLElement) => {\n if (!triggerElement || !popupElement) {\n return;\n }\n\n const prevDisplay = popupElement.style.display;\n popupElement.style.display = \"\";\n const overlayScrollWidth = popupElement.offsetWidth - popupElement.scrollWidth;\n const width =\n popupElement.offsetWidth - overlayScrollWidth > triggerElement.offsetWidth\n ? popupElement.scrollWidth\n : triggerElement.offsetWidth - overlayScrollWidth;\n if (prevDisplay === \"none\") {\n popupElement.style.display = \"none\";\n }\n let otherOverlayInnerStyle: React.CSSProperties = {};\n if (popupProps && typeof popupProps.overlayInnerStyle === \"object\" && !popupProps.overlayInnerStyle.width) {\n otherOverlayInnerStyle = popupProps.overlayInnerStyle;\n }\n return {\n width: `${Math.min(width, MAX_POPUP_WIDTH)}px`,\n ...otherOverlayInnerStyle\n };\n };\n\n const onInnerPopupVisibleChange = (visible: boolean, context: PopupVisibleChangeContext) => {\n if (disabled || readonly) {\n return;\n }\n // 如果点击触发元素(输入框)且为可输入状态,则继续显示下拉框\n const newVisible = context.trigger === \"trigger-element-click\" && allowInput ? true : visible;\n if (props.popupVisible !== newVisible) {\n setInnerPopupVisible(newVisible, context);\n if (!newVisible) {\n extra?.afterHidePopups?.(context);\n }\n }\n };\n const tOverlayInnerStyle = useMemo(() => {\n let result: TdPopupProps[\"overlayInnerStyle\"] = {};\n const overlayInnerStyle = popupProps?.overlayInnerStyle || {};\n if (isFunction(overlayInnerStyle) || (isObject(overlayInnerStyle) && overlayInnerStyle.width)) {\n result = overlayInnerStyle;\n } else if (!autoWidth) {\n result = matchWidthFunc;\n }\n return result;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [autoWidth, popupProps?.overlayInnerStyle]);\n\n return {\n tOverlayInnerStyle,\n innerPopupVisible,\n onInnerPopupVisibleChange\n };\n}\n","import { TdSelectInputProps } from \"./type\";\n\nexport const selectInputDefaultProps: TdSelectInputProps = {\n allowInput: false,\n autoWidth: false,\n autofocus: false,\n borderless: false,\n clearable: false,\n loading: false,\n minCollapsedNum: 0,\n multiple: false,\n readonly: false,\n reserveKeyword: false,\n status: \"default\"\n};\n","import React, { useRef, useImperativeHandle } from \"react\";\nimport classNames from \"classnames\";\nimport useSingle from \"./hook/useSingle\";\nimport useMultiple from \"./hook/useMultiple\";\nimport Popup, { PopupRef, PopupVisibleChangeContext } from \"../popup\";\nimport useOverlayInnerStyle from \"./hook/useOverlayInnerStyle\";\nimport { TdSelectInputProps } from \"./type\";\nimport { StyledProps } from \"../common\";\nimport { selectInputDefaultProps } from \"./defaultProps\";\nimport useConfig from \"../hooks/useConfig\";\nimport useDefaultProps from \"../hooks/useDefaultProps\";\nimport { InputRef } from \"../input\";\n\nexport interface SelectInputProps extends TdSelectInputProps, StyledProps {\n updateScrollTop?: (content: HTMLDivElement) => void;\n options?: unknown[]; // 参数穿透options, 给SelectInput/SelectInput 自定义选中项呈现的内容和多选状态下设置折叠项内容\n}\n\nconst SelectInput = React.forwardRef<Partial<PopupRef & InputRef>, SelectInputProps>((originalProps, ref) => {\n const props = useDefaultProps<SelectInputProps>(originalProps, selectInputDefaultProps);\n const { classPrefix: prefix } = useConfig();\n const selectInputRef = useRef<PopupRef>(null);\n const selectInputWrapRef = useRef<HTMLElement>(null);\n const { multiple, value, popupVisible, popupProps, borderless, disabled } = props;\n const { commonInputProps, inputRef, singleInputValue, onInnerClear, renderSelectSingle } = useSingle(props);\n\n const { tagInputRef, multipleInputValue, renderSelectMultiple } = useMultiple(props);\n const { tOverlayInnerStyle, innerPopupVisible, onInnerPopupVisibleChange } = useOverlayInnerStyle(props, {\n afterHidePopups: onInnerBlur\n });\n\n const popupClasses = classNames([\n props.className,\n `${prefix}-select-input`,\n {\n [`${prefix}-select-input--borderless`]: borderless,\n [`${prefix}-select-input--multiple`]: multiple,\n [`${prefix}-select-input--popup-visible`]: popupVisible ?? innerPopupVisible,\n [`${prefix}-select-input--empty`]: value instanceof Array ? !value.length : !value\n }\n ]);\n useImperativeHandle(ref, () => ({\n ...(selectInputRef.current || {}),\n ...(inputRef.current || {}),\n ...(tagInputRef.current || {})\n }));\n\n // 浮层显示的受控与非受控\n const visibleProps = { visible: popupVisible ?? innerPopupVisible };\n function onInnerBlur(ctx: PopupVisibleChangeContext) {\n const inputValue = props.multiple ? multipleInputValue : singleInputValue;\n const params: Parameters<TdSelectInputProps[\"onBlur\"]>[1] = {\n e: ctx.e,\n inputValue\n };\n props.onBlur?.(props.value, params);\n }\n const mainContent = (\n <div className={popupClasses} style={props.style}>\n <Popup\n ref={selectInputRef}\n trigger={popupProps?.trigger || \"click\"}\n placement=\"bottom-left\"\n content={props.panel}\n hideEmptyPopup={true}\n onVisibleChange={onInnerPopupVisibleChange}\n updateScrollTop={props.updateScrollTop}\n {...visibleProps}\n {...popupProps}\n disabled={disabled}\n overlayInnerStyle={tOverlayInnerStyle}\n >\n {multiple\n ? renderSelectMultiple({\n commonInputProps,\n onInnerClear,\n popupVisible: visibleProps.visible,\n allowInput: props.allowInput\n })\n : renderSelectSingle(visibleProps.visible)}\n </Popup>\n </div>\n );\n if (!props.tips) {\n return mainContent;\n }\n\n return (\n <div ref={selectInputWrapRef as React.Ref<HTMLDivElement>} className={`t-select-input__wrap`}>\n {mainContent}\n {props.tips && <div className={`t-input__tips t-input__tips--${props.status || \"normal\"}`}>{props.tips}</div>}\n </div>\n );\n});\n\nSelectInput.displayName = \"SelectInput\";\n\nexport default SelectInput;\n"],"names":["MAX_POPUP_WIDTH","useOverlayInnerStyle","props","extra","popupProps","autoWidth","readonly","disabled","onPopupVisibleChange","allowInput","_useControlled","useControlled","_useControlled2","_slicedToArray","innerPopupVisible","setInnerPopupVisible","matchWidthFunc","triggerElement","popupElement","prevDisplay","style","display","overlayScrollWidth","offsetWidth","scrollWidth","width","otherOverlayInnerStyle","_typeof","overlayInnerStyle","_objectSpread","Math","min","onInnerPopupVisibleChange","visible","context","newVisible","trigger","popupVisible","_extra$afterHidePopup","afterHidePopups","call","tOverlayInnerStyle","useMemo","result","isFunction","isObject","selectInputDefaultProps","autofocus","borderless","clearable","loading","minCollapsedNum","multiple","reserveKeyword","status","SelectInput","React","forwardRef","originalProps","ref","useDefaultProps","_useConfig","useConfig","prefix","classPrefix","selectInputRef","useRef","selectInputWrapRef","value","_useSingle","useSingle","commonInputProps","inputRef","singleInputValue","onInnerClear","renderSelectSingle","_useMultiple","useMultiple","tagInputRef","multipleInputValue","renderSelectMultiple","_useOverlayInnerStyle","onInnerBlur","popupClasses","classNames","className","concat","_defineProperty","Array","length","useImperativeHandle","current","visibleProps","ctx","_props$onBlur","inputValue","params","e","onBlur","mainContent","createElement","Popup","placement","content","panel","hideEmptyPopup","onVisibleChange","updateScrollTop","tips","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,eAAA,GAAkB,GAAA;AAExB,SAAwBC,oBAAAA,CACtBC,OACAC,KAAA,EAGA;AACA,EAAA,IAAQC,UAAA,GAAgFF,KAAA,CAAhFE,UAAA;IAAYC,SAAA,GAAoEH,KAAA,CAApEG,SAAA;IAAWC,WAAyDJ,KAAA,CAAzDI;IAAUC,QAAA,GAA+CL,KAAA,CAA/CK,QAAA;IAAUC,oBAAA,GAAqCN,KAAA,CAArCM,oBAAA;IAAsBC,aAAeP,KAAA,CAAfO;EACzE,IAAAC,cAAA,GAAkDC,aAAA,CAAcT,KAAA,EAAO,gBAAgBM,oBAAoB,CAAA;IAAAI,eAAA,GAAAC,cAAA,CAAAH,cAAA,EAAA,CAAA,CAAA;AAApGI,IAAAA,iBAAA,GAAAF,eAAA,CAAA,CAAA,CAAA;AAAmBG,IAAAA,oBAAoB,GAAAH,eAAA,CAAA,CAAA,CAAA;EAC9C,IAAMI,cAAA,GAAiB,SAAjBA,cAAAA,CAAkBC,cAAA,EAA6BC,YAAA,EAA8B;AACjF,IAAA,IAAI,CAACD,cAAA,IAAkB,CAACC,YAAA,EAAc;AACpC,MAAA;AACF,IAAA;AAEA,IAAA,IAAMC,WAAA,GAAcD,aAAaE,KAAA,CAAMC,OAAA;AACvCH,IAAAA,YAAA,CAAaE,MAAMC,OAAA,GAAU,EAAA;IAC7B,IAAMC,kBAAA,GAAqBJ,YAAA,CAAaK,WAAA,GAAcL,YAAA,CAAaM,WAAA;IACnE,IAAMC,KAAA,GACJP,aAAaK,WAAA,GAAcD,kBAAA,GAAqBL,eAAeM,WAAA,GAC3DL,YAAA,CAAaM,WAAA,GACbP,cAAA,CA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AQ;AAAA,GAAA,EAAKpD,KAAA,CAAM0G,IAAK,CACzG,CAAA;AAEJ,CAAC;AAEDrD,WAAA,CAAYsD,WAAA,GAAc,aAAA;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { MouseEvent } from "react";
|
|
2
|
+
import { TdSelectInputProps } from "../type";
|
|
3
|
+
import { SelectInputCommonProperties } from "../interface";
|
|
4
|
+
import { InputRef } from "../../input";
|
|
5
|
+
import { StyledProps } from "../../common";
|
|
6
|
+
export interface RenderSelectMultipleParams {
|
|
7
|
+
commonInputProps: SelectInputCommonProperties;
|
|
8
|
+
onInnerClear: (context: {
|
|
9
|
+
e: MouseEvent<SVGElement>;
|
|
10
|
+
}) => void;
|
|
11
|
+
popupVisible: boolean;
|
|
12
|
+
allowInput: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SelectInputProps extends TdSelectInputProps, StyledProps {
|
|
15
|
+
options?: unknown[];
|
|
16
|
+
}
|
|
17
|
+
export default function useMultiple(props: SelectInputProps): {
|
|
18
|
+
tags: any[];
|
|
19
|
+
tPlaceholder: string;
|
|
20
|
+
tagInputRef: React.MutableRefObject<InputRef>;
|
|
21
|
+
multipleInputValue: string;
|
|
22
|
+
renderSelectMultiple: (p: RenderSelectMultipleParams) => React.JSX.Element;
|
|
23
|
+
};
|
|
@@ -5,25 +5,28 @@ import { isObject } from 'lodash-es';
|
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { TagInput } from '../../tag-input/index.js';
|
|
7
7
|
import { u as useControlled } from '../../_chunks/dep-DwWrhxkd.js';
|
|
8
|
-
import { u as useConfig } from '../../_chunks/dep-
|
|
8
|
+
import { u as useConfig } from '../../_chunks/dep-gy8uvBaS.js';
|
|
9
9
|
import '../../_chunks/dep-D-UKOauR.js';
|
|
10
10
|
import '../../tag-input/TagInput.js';
|
|
11
11
|
import '@tendaui/icons';
|
|
12
12
|
import '../../input/index.js';
|
|
13
13
|
import '../../input/Input.js';
|
|
14
14
|
import '../../_chunks/dep-DN7d1SzH.js';
|
|
15
|
-
import '../../_chunks/dep-
|
|
15
|
+
import '../../_chunks/dep-BRbJGDI9.js';
|
|
16
|
+
import '../../_chunks/dep-DRwijJcv.js';
|
|
16
17
|
import '../../_chunks/dep-D6YxJv-F.js';
|
|
17
18
|
import '../../_chunks/dep-DGvfel3I.js';
|
|
18
|
-
import '../../
|
|
19
|
+
import '../../_chunks/dep-5U9UjDaf.js';
|
|
20
|
+
import 'dayjs';
|
|
19
21
|
import '../../input/InputGroup.js';
|
|
20
22
|
import '../../input/style/css.js';
|
|
21
23
|
import '../../tag-input/hooks/useTagList.js';
|
|
22
24
|
import '../../_chunks/dep-CgyDw_YI.js';
|
|
23
25
|
import '../../tag/index.js';
|
|
24
26
|
import '../../tag/Tag.js';
|
|
27
|
+
import '../../_chunks/dep-zOZQ0R9g.js';
|
|
25
28
|
import '../../_chunks/dep-U1T8CQY9.js';
|
|
26
|
-
import '../../_chunks/dep-
|
|
29
|
+
import '../../_chunks/dep-ByzdZjUR.js';
|
|
27
30
|
import '../../_chunks/dep-BP0-apUT.js';
|
|
28
31
|
import 'hoist-non-react-statics';
|
|
29
32
|
import '../../tag/style/css.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMultiple.js","sources":["../../../../components/select-input/hook/useMultiple.tsx"],"sourcesContent":["import React, { useRef, MouseEvent } from \"react\";\nimport { isObject } from \"lodash-es\";\nimport classNames from \"classnames\";\nimport { TdSelectInputProps, SelectInputChangeContext, SelectInputKeys, SelectInputValue } from \"../type\";\nimport TagInput, { TagInputValue } from \"../../tag-input\";\nimport { SelectInputCommonProperties } from \"../interface\";\nimport useControlled from \"../../hooks/useControlled\";\nimport useConfig from \"../../hooks/useConfig\";\nimport { InputRef } from \"../../input\";\nimport { StyledProps } from \"../../common\";\n\nexport interface RenderSelectMultipleParams {\n commonInputProps: SelectInputCommonProperties;\n onInnerClear: (context: { e: MouseEvent<SVGElement> }) => void;\n popupVisible: boolean;\n allowInput: boolean;\n}\n\nconst DEFAULT_KEYS = {\n label: \"label\",\n key: \"key\",\n children: \"children\"\n};\n\nexport interface SelectInputProps extends TdSelectInputProps, StyledProps {\n options?: unknown[]; // 参数穿透options, 给SelectInput/SelectInput 自定义选中项呈现的内容和多选状态下设置折叠项内容\n}\n\nexport default function useMultiple(props: SelectInputProps) {\n const { value } = props;\n const { classPrefix } = useConfig();\n const tagInputRef = useRef<InputRef>(null);\n const [tInputValue, setTInputValue] = useControlled(props, \"inputValue\", props.onInputChange);\n const iKeys: SelectInputKeys = { ...DEFAULT_KEYS, ...props.keys };\n\n const getTags = () => {\n if (!(value instanceof Array)) {\n if ([\"\", null, undefined].includes(String(value))) return [];\n return isObject(value) ? [value[iKeys.label]] : [value];\n }\n return value.map((item: SelectInputValue) => (isObject(item) ? item[iKeys.label] : item));\n };\n const tags = getTags();\n const tPlaceholder = !tags || !tags.length ? props.placeholder : \"\";\n\n const onTagInputChange = (val: TagInputValue, context: SelectInputChangeContext) => {\n // 避免触发浮层的显示或隐藏\n if (context.trigger === \"tag-remove\") {\n context.e?.stopPropagation();\n }\n props.onTagChange?.(val, context);\n };\n\n const renderSelectMultiple = (p: RenderSelectMultipleParams) => (\n <TagInput\n ref={tagInputRef}\n {...p.commonInputProps}\n autoWidth={props.autoWidth}\n readonly={props.readonly}\n minCollapsedNum={props.minCollapsedNum}\n collapsedItems={props.collapsedItems}\n tag={props.tag}\n valueDisplay={props.valueDisplay}\n placeholder={tPlaceholder}\n options={props.options}\n value={tags}\n inputValue={p.popupVisible && p.allowInput ? tInputValue : \"\"}\n onChange={onTagInputChange}\n onInputChange={(val, context) => {\n // 筛选器统一特性:筛选器按下回车时不清空输入框\n if (context?.trigger === \"enter\" || context?.trigger === \"blur\") return;\n setTInputValue(val, { trigger: context.trigger, e: context.e });\n }}\n tagProps={props.tagProps}\n onClear={p.onInnerClear}\n // [Important Info]: SelectInput.blur is not equal to TagInput, example: click popup panel\n onFocus={(val, context) => {\n props.onFocus?.(props.value, { ...context, tagInputValue: val });\n }}\n onBlur={!props.panel ? props.onBlur : null}\n {...props.tagInputProps}\n inputProps={{\n ...props.inputProps,\n readonly: !props.allowInput || props.readonly,\n inputClass: classNames(props.tagInputProps?.className, {\n [`${classPrefix}-input--focused`]: p.popupVisible,\n [`${classPrefix}-is-focused`]: p.popupVisible\n })\n }}\n />\n );\n\n return {\n tags,\n tPlaceholder,\n tagInputRef,\n multipleInputValue: tInputValue,\n renderSelectMultiple\n };\n}\n"],"names":["DEFAULT_KEYS","label","key","children","useMultiple","props","value","_useConfig","useConfig","classPrefix","tagInputRef","useRef","_useControlled","useControlled","onInputChange","_useControlled2","_slicedToArray","tInputValue","setTInputValue","iKeys","keys","getTags","Array","includes","String","isObject","map","item","tags","tPlaceholder","length","placeholder","onTagInputChange","val","context","_props$onTagChange","trigger","_context$e","e","stopPropagation","onTagChange","call","renderSelectMultiple","p","_props$tagInputProps","React","createElement","TagInput","_objectSpread","ref","commonInputProps","autoWidth","readonly","minCollapsedNum","collapsedItems","tag","valueDisplay","options","inputValue","popupVisible","allowInput","onChange","tagProps","onClear","onInnerClear","onFocus","_props$onFocus","tagInputValue","onBlur","panel","tagInputProps","inputProps","inputClass","classNames","className","_defineProperty","concat","multipleInputValue"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMultiple.js","sources":["../../../../components/select-input/hook/useMultiple.tsx"],"sourcesContent":["import React, { useRef, MouseEvent } from \"react\";\nimport { isObject } from \"lodash-es\";\nimport classNames from \"classnames\";\nimport { TdSelectInputProps, SelectInputChangeContext, SelectInputKeys, SelectInputValue } from \"../type\";\nimport TagInput, { TagInputValue } from \"../../tag-input\";\nimport { SelectInputCommonProperties } from \"../interface\";\nimport useControlled from \"../../hooks/useControlled\";\nimport useConfig from \"../../hooks/useConfig\";\nimport { InputRef } from \"../../input\";\nimport { StyledProps } from \"../../common\";\n\nexport interface RenderSelectMultipleParams {\n commonInputProps: SelectInputCommonProperties;\n onInnerClear: (context: { e: MouseEvent<SVGElement> }) => void;\n popupVisible: boolean;\n allowInput: boolean;\n}\n\nconst DEFAULT_KEYS = {\n label: \"label\",\n key: \"key\",\n children: \"children\"\n};\n\nexport interface SelectInputProps extends TdSelectInputProps, StyledProps {\n options?: unknown[]; // 参数穿透options, 给SelectInput/SelectInput 自定义选中项呈现的内容和多选状态下设置折叠项内容\n}\n\nexport default function useMultiple(props: SelectInputProps) {\n const { value } = props;\n const { classPrefix } = useConfig();\n const tagInputRef = useRef<InputRef>(null);\n const [tInputValue, setTInputValue] = useControlled(props, \"inputValue\", props.onInputChange);\n const iKeys: SelectInputKeys = { ...DEFAULT_KEYS, ...props.keys };\n\n const getTags = () => {\n if (!(value instanceof Array)) {\n if ([\"\", null, undefined].includes(String(value))) return [];\n return isObject(value) ? [value[iKeys.label]] : [value];\n }\n return value.map((item: SelectInputValue) => (isObject(item) ? item[iKeys.label] : item));\n };\n const tags = getTags();\n const tPlaceholder = !tags || !tags.length ? props.placeholder : \"\";\n\n const onTagInputChange = (val: TagInputValue, context: SelectInputChangeContext) => {\n // 避免触发浮层的显示或隐藏\n if (context.trigger === \"tag-remove\") {\n context.e?.stopPropagation();\n }\n props.onTagChange?.(val, context);\n };\n\n const renderSelectMultiple = (p: RenderSelectMultipleParams) => (\n <TagInput\n ref={tagInputRef}\n {...p.commonInputProps}\n autoWidth={props.autoWidth}\n readonly={props.readonly}\n minCollapsedNum={props.minCollapsedNum}\n collapsedItems={props.collapsedItems}\n tag={props.tag}\n valueDisplay={props.valueDisplay}\n placeholder={tPlaceholder}\n options={props.options}\n value={tags}\n inputValue={p.popupVisible && p.allowInput ? tInputValue : \"\"}\n onChange={onTagInputChange}\n onInputChange={(val, context) => {\n // 筛选器统一特性:筛选器按下回车时不清空输入框\n if (context?.trigger === \"enter\" || context?.trigger === \"blur\") return;\n setTInputValue(val, { trigger: context.trigger, e: context.e });\n }}\n tagProps={props.tagProps}\n onClear={p.onInnerClear}\n // [Important Info]: SelectInput.blur is not equal to TagInput, example: click popup panel\n onFocus={(val, context) => {\n props.onFocus?.(props.value, { ...context, tagInputValue: val });\n }}\n onBlur={!props.panel ? props.onBlur : null}\n {...props.tagInputProps}\n inputProps={{\n ...props.inputProps,\n readonly: !props.allowInput || props.readonly,\n inputClass: classNames(props.tagInputProps?.className, {\n [`${classPrefix}-input--focused`]: p.popupVisible,\n [`${classPrefix}-is-focused`]: p.popupVisible\n })\n }}\n />\n );\n\n return {\n tags,\n tPlaceholder,\n tagInputRef,\n multipleInputValue: tInputValue,\n renderSelectMultiple\n };\n}\n"],"names":["DEFAULT_KEYS","label","key","children","useMultiple","props","value","_useConfig","useConfig","classPrefix","tagInputRef","useRef","_useControlled","useControlled","onInputChange","_useControlled2","_slicedToArray","tInputValue","setTInputValue","iKeys","keys","getTags","Array","includes","String","isObject","map","item","tags","tPlaceholder","length","placeholder","onTagInputChange","val","context","_props$onTagChange","trigger","_context$e","e","stopPropagation","onTagChange","call","renderSelectMultiple","p","_props$tagInputProps","React","createElement","TagInput","_objectSpread","ref","commonInputProps","autoWidth","readonly","minCollapsedNum","collapsedItems","tag","valueDisplay","options","inputValue","popupVisible","allowInput","onChange","tagProps","onClear","onInnerClear","onFocus","_props$onFocus","tagInputValue","onBlur","panel","tagInputProps","inputProps","inputClass","classNames","className","_defineProperty","concat","multipleInputValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,YAAA,GAAe;AACnBC,EAAAA,KAAA,EAAO,OAAA;AACPC,EAAAA,GAAA,EAAK,KAAA;AACLC,EAAAA,QAAA,EAAU;AACZ,CAAA;AAMA,SAAwBC,YAAYC,KAAA,EAAyB;AAC3D,EAAA,IAAQC,QAAUD,KAAA,CAAVC;AACR,EAAA,IAAAC,UAAA,GAAwBC,SAAA,EAAU;IAA1BC,WAAA,GAAAF,UAAA,CAAAE,WAAA;AACR,EAAA,IAAMC,WAAA,GAAcC,OAAiB,IAAI,CAAA;EACzC,IAAAC,cAAA,GA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CAAEgB,YAAA,CAClC;AAAA,OAAA;AACH,KAAA,CACF,CAAA;AAAA,EAAA,CAAA;EAGF,OAAO;AACL/B,IAAAA,IAAA,EAAAA,IAAA;AACAC,IAAAA,YAAA,EAAAA,YAAA;AACAnB,IAAAA,WAAA,EAAAA,WAAA;AACAmE,IAAAA,kBAAA,EAAoB5D,WAAA;AACpByB,IAAAA,oBAAA,EAAAA;GACF;AACF;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TdSelectInputProps } from "../type";
|
|
3
|
+
import { PopupVisibleChangeContext } from "../../popup";
|
|
4
|
+
export type overlayStyleProps = Pick<TdSelectInputProps, "popupProps" | "autoWidth" | "readonly" | "onPopupVisibleChange" | "disabled" | "allowInput" | "popupVisible" | "defaultPopupVisible">;
|
|
5
|
+
export default function useOverlayInnerStyle(props: overlayStyleProps, extra?: {
|
|
6
|
+
afterHidePopups?: (ctx: PopupVisibleChangeContext) => void;
|
|
7
|
+
}): {
|
|
8
|
+
tOverlayInnerStyle: React.CSSProperties | ((triggerElement: HTMLElement, popupElement: HTMLElement) => import("../../common").Styles);
|
|
9
|
+
innerPopupVisible: boolean;
|
|
10
|
+
onInnerPopupVisibleChange: (visible: boolean, context: PopupVisibleChangeContext) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { MouseEvent } from "react";
|
|
2
|
+
import { SelectInputCommonProperties } from "../interface";
|
|
3
|
+
import { TdSelectInputProps } from "../type";
|
|
4
|
+
import { InputRef } from "../../input";
|
|
5
|
+
export interface RenderSelectSingleInputParams {
|
|
6
|
+
tPlaceholder: string;
|
|
7
|
+
}
|
|
8
|
+
export default function useSingle(props: TdSelectInputProps): {
|
|
9
|
+
inputRef: React.MutableRefObject<InputRef>;
|
|
10
|
+
commonInputProps: SelectInputCommonProperties;
|
|
11
|
+
singleInputValue: string;
|
|
12
|
+
onInnerClear: (context: {
|
|
13
|
+
e: MouseEvent<SVGSVGElement>;
|
|
14
|
+
}) => void;
|
|
15
|
+
renderSelectSingle: (popupVisible: boolean) => React.JSX.Element;
|
|
16
|
+
};
|