@tendaui/react 1.1.4 → 1.1.5

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.
Files changed (342) hide show
  1. package/es/alert/Alert.d.ts +7 -0
  2. package/es/alert/defaultProps.d.ts +2 -0
  3. package/es/alert/index.d.ts +5 -0
  4. package/es/alert/style/css.d.ts +1 -0
  5. package/es/alert/style/index.d.ts +1 -0
  6. package/es/alert/type.d.ts +45 -0
  7. package/es/badge/Badge.d.ts +7 -0
  8. package/es/badge/defaultProps.d.ts +2 -0
  9. package/es/badge/index.d.ts +5 -0
  10. package/es/badge/style/css.d.ts +1 -0
  11. package/es/badge/style/index.d.ts +1 -0
  12. package/es/badge/type.d.ts +50 -0
  13. package/es/button/Button.d.ts +6 -0
  14. package/es/button/_example/base.js +1 -1
  15. package/es/button/_example/icon.js +1 -1
  16. package/es/button/defaultProps.d.ts +2 -0
  17. package/es/button/index.d.ts +5 -0
  18. package/es/button/style/css.d.ts +1 -0
  19. package/es/button/style/index.d.ts +1 -0
  20. package/es/button/type.d.ts +81 -0
  21. package/es/checkbox/Checkbox.d.ts +10 -0
  22. package/es/checkbox/CheckboxGroup.d.ts +14 -0
  23. package/es/checkbox/defaultProps.d.ts +3 -0
  24. package/es/checkbox/index.d.ts +11 -0
  25. package/es/checkbox/style/css.d.ts +1 -0
  26. package/es/checkbox/style/index.d.ts +1 -0
  27. package/es/checkbox/type.d.ts +115 -0
  28. package/es/color-picker/ColorPickPanel.d.ts +4 -0
  29. package/es/color-picker/ColorPicker.d.ts +4 -0
  30. package/es/color-picker/components/panel/alpha.d.ts +4 -0
  31. package/es/color-picker/components/panel/format/index.d.ts +10 -0
  32. package/es/color-picker/components/panel/format/inputs.d.ts +4 -0
  33. package/es/color-picker/components/panel/header.d.ts +13 -0
  34. package/es/color-picker/components/panel/hue.d.ts +4 -0
  35. package/es/color-picker/components/panel/index.d.ts +4 -0
  36. package/es/color-picker/components/panel/saturation.d.ts +4 -0
  37. package/es/color-picker/components/panel/slider.d.ts +11 -0
  38. package/es/color-picker/components/panel/swatches.d.ts +11 -0
  39. package/es/color-picker/components/trigger.d.ts +9 -0
  40. package/es/color-picker/defaultProps.d.ts +2 -0
  41. package/es/color-picker/helpers.d.ts +5 -0
  42. package/es/color-picker/hooks/useClassNames.d.ts +2 -0
  43. package/es/color-picker/hooks/useStyles.d.ts +14 -0
  44. package/es/color-picker/index.d.ts +6 -0
  45. package/es/color-picker/index.js +1 -1
  46. package/es/color-picker/style/css.d.ts +1 -0
  47. package/es/color-picker/style/css.js +1 -0
  48. package/es/color-picker/style/index.d.ts +1 -0
  49. package/es/color-picker/type.d.ts +135 -0
  50. package/es/color-picker/utils/color-picker/cmyk.d.ts +27 -0
  51. package/es/color-picker/utils/color-picker/color.d.ts +144 -0
  52. package/es/color-picker/utils/color-picker/constants.d.ts +30 -0
  53. package/es/color-picker/utils/color-picker/draggable.d.ts +23 -0
  54. package/es/color-picker/utils/color-picker/format.d.ts +64 -0
  55. package/es/color-picker/utils/color-picker/gradient.d.ts +22 -0
  56. package/es/color-picker/utils/color-picker/index.d.ts +7 -0
  57. package/es/color-picker/utils/color-picker/types.d.ts +28 -0
  58. package/es/common/Check.d.ts +22 -0
  59. package/es/common/FakeArrow.d.ts +9 -0
  60. package/es/common/PluginContainer.d.ts +9 -0
  61. package/es/common/Portal.d.ts +16 -0
  62. package/es/common/observe.d.ts +1 -0
  63. package/es/common.d.ts +81 -0
  64. package/es/config-provider/ConfigContext.d.ts +13 -0
  65. package/es/config-provider/ConfigProvider.d.ts +25 -0
  66. package/es/config-provider/index.d.ts +7 -0
  67. package/es/config-provider/type.d.ts +1029 -0
  68. package/es/dialog/Dialog.d.ts +8 -0
  69. package/es/dialog/DialogCard.d.ts +8 -0
  70. package/es/dialog/defaultProps.d.ts +6 -0
  71. package/es/dialog/hooks/useDialogDrag.d.ts +7 -0
  72. package/es/dialog/hooks/useDialogEsc.d.ts +3 -0
  73. package/es/dialog/hooks/useDialogPosition.d.ts +2 -0
  74. package/es/dialog/hooks/useLockStyle.d.ts +2 -0
  75. package/es/dialog/index.d.ts +8 -0
  76. package/es/dialog/plugin.d.ts +6 -0
  77. package/es/dialog/style/css.d.ts +1 -0
  78. package/es/dialog/style/index.d.ts +1 -0
  79. package/es/dialog/type.d.ts +227 -0
  80. package/es/dialog/utils.d.ts +1 -0
  81. package/es/drawer/Drawer.d.ts +11 -0
  82. package/es/drawer/defaultProps.d.ts +2 -0
  83. package/es/drawer/hooks/useDrag.d.ts +8 -0
  84. package/es/drawer/hooks/useLockStyle.d.ts +1 -0
  85. package/es/drawer/index.d.ts +4 -0
  86. package/es/drawer/style/css.d.ts +1 -0
  87. package/es/drawer/style/css.js +1 -1
  88. package/es/drawer/style/index.d.ts +1 -0
  89. package/es/drawer/type.d.ts +199 -0
  90. package/es/drawer/utils/index.d.ts +23 -0
  91. package/es/fireworks/Fireworks.d.ts +7 -0
  92. package/es/fireworks/index.d.ts +5 -0
  93. package/es/fireworks/style/css.d.ts +0 -0
  94. package/es/fireworks/style/css.js +0 -2
  95. package/es/fireworks/style/index.d.ts +0 -0
  96. package/es/fireworks/type.d.ts +69 -0
  97. package/es/form/Form.d.ts +8 -0
  98. package/es/form/FormContext.d.ts +59 -0
  99. package/es/form/FormItem.d.ts +23 -0
  100. package/es/form/FormList.d.ts +4 -0
  101. package/es/form/const.d.ts +6 -0
  102. package/es/form/defaultProps.d.ts +3 -0
  103. package/es/form/easing.d.ts +2 -0
  104. package/es/form/formModel.d.ts +37 -0
  105. package/es/form/hooks/interface.d.ts +16 -0
  106. package/es/form/hooks/useForm.d.ts +3 -0
  107. package/es/form/hooks/useFormItemInitialData.d.ts +9 -0
  108. package/es/form/hooks/useFormItemStyle.d.ts +10 -0
  109. package/es/form/hooks/useInstance.d.ts +16 -0
  110. package/es/form/hooks/useWatch.d.ts +3 -0
  111. package/es/form/index.d.ts +7 -0
  112. package/es/form/scroll.d.ts +39 -0
  113. package/es/form/style/css.d.ts +1 -0
  114. package/es/form/style/index.d.ts +1 -0
  115. package/es/form/type.d.ts +486 -0
  116. package/es/form/utils/index.d.ts +5 -0
  117. package/es/global-config/default-config.d.ts +84 -0
  118. package/es/global-config/locale/ar_KW.d.ts +239 -0
  119. package/es/global-config/locale/en_US.d.ts +263 -0
  120. package/es/global-config/locale/it_IT.d.ts +263 -0
  121. package/es/global-config/locale/ja_JP.d.ts +263 -0
  122. package/es/global-config/locale/ko_KR.d.ts +263 -0
  123. package/es/global-config/locale/ru_RU.d.ts +263 -0
  124. package/es/global-config/locale/zh_CN.d.ts +263 -0
  125. package/es/global-config/locale/zh_TW.d.ts +263 -0
  126. package/es/global-config/mobile/default-config.d.ts +7 -0
  127. package/es/global-config/mobile/locale/ar_KW.d.ts +98 -0
  128. package/es/global-config/mobile/locale/en_US.d.ts +99 -0
  129. package/es/global-config/mobile/locale/it_IT.d.ts +99 -0
  130. package/es/global-config/mobile/locale/ja_JP.d.ts +99 -0
  131. package/es/global-config/mobile/locale/ko_KR.d.ts +99 -0
  132. package/es/global-config/mobile/locale/ru_RU.d.ts +99 -0
  133. package/es/global-config/mobile/locale/zh_CN.d.ts +99 -0
  134. package/es/global-config/mobile/locale/zh_TW.d.ts +99 -0
  135. package/es/global-config/t.d.ts +25 -0
  136. package/es/hooks/useAttach.d.ts +10 -0
  137. package/es/hooks/useCommonClassName.d.ts +54 -0
  138. package/es/hooks/useConfig.d.ts +2 -0
  139. package/es/hooks/useControlled.d.ts +9 -0
  140. package/es/hooks/useDeepEffect.d.ts +7 -0
  141. package/es/hooks/useDefaultProps.d.ts +1 -0
  142. package/es/hooks/useDomCallback.d.ts +1 -0
  143. package/es/hooks/useDomRefCallback.d.ts +1 -0
  144. package/es/hooks/useDragSorter.d.ts +28 -0
  145. package/es/hooks/useEventCallback.d.ts +9 -0
  146. package/es/hooks/useGlobalConfig.d.ts +1 -0
  147. package/es/hooks/useGlobalIcon.d.ts +5 -0
  148. package/es/hooks/useLastest.d.ts +2 -0
  149. package/es/hooks/useLayoutEffect.d.ts +3 -0
  150. package/es/hooks/useMouseEvent.d.ts +25 -0
  151. package/es/hooks/useMutationObserver.d.ts +4 -0
  152. package/es/hooks/usePopper.d.ts +19 -0
  153. package/es/hooks/useResizeObserve.d.ts +1 -0
  154. package/es/hooks/useRipple.d.ts +0 -0
  155. package/es/hooks/useSetState.d.ts +7 -0
  156. package/es/hooks/useVirtualScroll.d.ts +30 -0
  157. package/es/hooks/useWindowSize.d.ts +6 -0
  158. package/es/index.d.ts +25 -0
  159. package/es/index.js +1 -1
  160. package/es/input/Input.d.ts +16 -0
  161. package/es/input/InputGroup.d.ts +10 -0
  162. package/es/input/defaultProps.d.ts +17 -0
  163. package/es/input/index.d.ts +6 -0
  164. package/es/input/style/css.d.ts +1 -0
  165. package/es/input/style/index.d.ts +1 -0
  166. package/es/input/type.d.ts +237 -0
  167. package/es/input-number/InputNumber.d.ts +17 -0
  168. package/es/input-number/defaultProps.d.ts +2 -0
  169. package/es/input-number/index.d.ts +5 -0
  170. package/es/input-number/style/css.d.ts +1 -0
  171. package/es/input-number/style/index.d.ts +1 -0
  172. package/es/input-number/type.d.ts +156 -0
  173. package/es/input-number/useInputNumber.d.ts +51 -0
  174. package/es/ip-input/IPInput.d.ts +5 -0
  175. package/es/ip-input/defaultProps.d.ts +2 -0
  176. package/es/ip-input/index.d.ts +3 -0
  177. package/es/ip-input/style/css.d.ts +1 -0
  178. package/es/ip-input/style/index.d.ts +1 -0
  179. package/es/ip-input/type.d.ts +113 -0
  180. package/es/ip-input/utils.d.ts +35 -0
  181. package/es/layout/Aside.d.ts +11 -0
  182. package/es/layout/Layout.d.ts +26 -0
  183. package/es/layout/defaultProps.d.ts +5 -0
  184. package/es/layout/index.d.ts +10 -0
  185. package/es/layout/style/css.d.ts +1 -0
  186. package/es/layout/style/index.d.ts +1 -0
  187. package/es/layout/type.d.ts +38 -0
  188. package/es/list/List.d.ts +17 -0
  189. package/es/list/ListItem.d.ts +15 -0
  190. package/es/list/ListItemMeta.d.ts +10 -0
  191. package/es/list/defaultProps.d.ts +7 -0
  192. package/es/list/hooks/useListVirtualScroll.d.ts +24 -0
  193. package/es/list/index.d.ts +10 -0
  194. package/es/list/style/css.d.ts +1 -0
  195. package/es/list/style/index.d.ts +1 -0
  196. package/es/list/type.d.ts +92 -0
  197. package/es/loading/Gradient.d.ts +6 -0
  198. package/es/loading/Loading.d.ts +7 -0
  199. package/es/loading/circleAdapter.d.ts +1 -0
  200. package/es/loading/defaultProps.d.ts +2 -0
  201. package/es/loading/index.d.ts +5 -0
  202. package/es/loading/style/css.d.ts +1 -0
  203. package/es/loading/style/index.d.ts +1 -0
  204. package/es/loading/type.d.ts +68 -0
  205. package/es/loading/utils/setStyle.d.ts +7 -0
  206. package/es/locale/LocalReceiver.d.ts +6 -0
  207. package/es/locale/ar_KW.d.ts +3 -0
  208. package/es/locale/en_US.d.ts +3 -0
  209. package/es/locale/it_IT.d.ts +3 -0
  210. package/es/locale/ja_JP.d.ts +3 -0
  211. package/es/locale/ko_KR.d.ts +3 -0
  212. package/es/locale/ru_RU.d.ts +3 -0
  213. package/es/locale/zh_CN.d.ts +3 -0
  214. package/es/locale/zh_TW.d.ts +3 -0
  215. package/es/myform/index.d.ts +0 -0
  216. package/es/notification/Notify.d.ts +11 -0
  217. package/es/notification/NotifyContainer.d.ts +13 -0
  218. package/es/notification/NotifyContext.d.ts +23 -0
  219. package/es/notification/NotifyItem.d.ts +4 -0
  220. package/es/notification/index.d.ts +3 -0
  221. package/es/notification/style/css.d.ts +1 -0
  222. package/es/notification/style/index.d.ts +1 -0
  223. package/es/notification/type.d.ts +22 -0
  224. package/es/popup/Popup.d.ts +21 -0
  225. package/es/popup/defaultProps.d.ts +5 -0
  226. package/es/popup/hooks/useTrigger.d.ts +20 -0
  227. package/es/popup/index.d.ts +5 -0
  228. package/es/popup/style/css.d.ts +1 -0
  229. package/es/popup/style/index.d.ts +1 -0
  230. package/es/popup/type.d.ts +109 -0
  231. package/es/portal/Portal.d.ts +16 -0
  232. package/es/portal/index.d.ts +1 -0
  233. package/es/radio/Radio.d.ts +8 -0
  234. package/es/radio/RadioGroup.d.ts +14 -0
  235. package/es/radio/defaultProps.d.ts +3 -0
  236. package/es/radio/index.d.ts +10 -0
  237. package/es/radio/style/css.d.ts +0 -0
  238. package/es/radio/style/index.d.ts +1 -0
  239. package/es/radio/type.d.ts +117 -0
  240. package/es/radio/useKeyboard.d.ts +4 -0
  241. package/es/select/Option.d.ts +24 -0
  242. package/es/select/OptionGroup.d.ts +7 -0
  243. package/es/select/PopupContent.d.ts +24 -0
  244. package/es/select/Select.d.ts +13 -0
  245. package/es/select/defaultProps.d.ts +4 -0
  246. package/es/select/hooks/useOptions.d.ts +16 -0
  247. package/es/select/hooks/usePanelVirtualScroll.d.ts +24 -0
  248. package/es/select/index.d.ts +8 -0
  249. package/es/select/style/css.d.ts +1 -0
  250. package/es/select/style/index.d.ts +1 -0
  251. package/es/select/type.d.ts +344 -0
  252. package/es/select/utils/helper.d.ts +18 -0
  253. package/es/select-input/SelectInput.d.ts +11 -0
  254. package/es/select-input/defaultProps.d.ts +2 -0
  255. package/es/select-input/hook/useMultiple.d.ts +23 -0
  256. package/es/select-input/hook/useOverlayInnerStyle.d.ts +11 -0
  257. package/es/select-input/hook/useSingle.d.ts +16 -0
  258. package/es/select-input/index.d.ts +5 -0
  259. package/es/select-input/interface.d.ts +17 -0
  260. package/es/select-input/style/css.d.ts +1 -0
  261. package/es/select-input/style/index.d.ts +1 -0
  262. package/es/select-input/type.d.ts +243 -0
  263. package/es/slider/Slider.d.ts +7 -0
  264. package/es/slider/SliderHandleButton.d.ts +11 -0
  265. package/es/slider/defaultProps.d.ts +5 -0
  266. package/es/slider/index.d.ts +5 -0
  267. package/es/slider/style/css.d.ts +1 -0
  268. package/es/slider/style/index.d.ts +1 -0
  269. package/es/slider/type.d.ts +78 -0
  270. package/es/space/defaultProps.d.ts +0 -0
  271. package/es/space/index.d.ts +0 -0
  272. package/es/space/type.d.ts +0 -0
  273. package/es/style/index.d.ts +1 -0
  274. package/es/switch/Switch.d.ts +9 -0
  275. package/es/switch/defaultProps.d.ts +2 -0
  276. package/es/switch/index.d.ts +4 -0
  277. package/es/switch/style/css.d.ts +1 -0
  278. package/es/switch/style/index.d.ts +1 -0
  279. package/es/switch/type.d.ts +48 -0
  280. package/es/tab/TabBar.d.ts +9 -0
  281. package/es/tab/TabNav.d.ts +10 -0
  282. package/es/tab/TabNavItem.d.ts +15 -0
  283. package/es/tab/TabPanel.d.ts +9 -0
  284. package/es/tab/Tabs.d.ts +10 -0
  285. package/es/tab/defaultProps.d.ts +3 -0
  286. package/es/tab/index.d.ts +8 -0
  287. package/es/tab/style/index.d.ts +1 -0
  288. package/es/tab/type.d.ts +130 -0
  289. package/es/tab/useTabClass.d.ts +8 -0
  290. package/es/table/Cell.d.ts +18 -0
  291. package/es/table/TBody.d.ts +28 -0
  292. package/es/table/THead.d.ts +10 -0
  293. package/es/table/TR.d.ts +28 -0
  294. package/es/table/Table.d.ts +6 -0
  295. package/es/table/defaultProps.d.ts +2 -0
  296. package/es/table/hooks/index.d.ts +4 -0
  297. package/es/table/hooks/useTableClassName.d.ts +26 -0
  298. package/es/table/hooks/useTableStyle.d.ts +11 -0
  299. package/es/table/index.d.ts +5 -0
  300. package/es/table/style/css.d.ts +1 -0
  301. package/es/table/style/index.d.ts +1 -0
  302. package/es/table/type.d.ts +195 -0
  303. package/es/tag/Tag.d.ts +14 -0
  304. package/es/tag/defaultProps.d.ts +7 -0
  305. package/es/tag/index.d.ts +4 -0
  306. package/es/tag/style/css.d.ts +1 -0
  307. package/es/tag/style/index.d.ts +1 -0
  308. package/es/tag/type.d.ts +169 -0
  309. package/es/tag-input/TagInput.d.ts +9 -0
  310. package/es/tag-input/defaultProps.d.ts +2 -0
  311. package/es/tag-input/hooks/useHover.d.ts +17 -0
  312. package/es/tag-input/hooks/useTagList.d.ts +30 -0
  313. package/es/tag-input/hooks/useTagScroll.d.ts +25 -0
  314. package/es/tag-input/index.d.ts +5 -0
  315. package/es/tag-input/style/css.d.ts +1 -0
  316. package/es/tag-input/style/index.d.ts +1 -0
  317. package/es/tag-input/type.d.ts +235 -0
  318. package/es/tag-input/useTagList.d.ts +30 -0
  319. package/es/utils/composeRefs.d.ts +2 -0
  320. package/es/utils/dom.d.ts +7 -0
  321. package/es/utils/forwardRefWithStatics.d.ts +2 -0
  322. package/es/utils/getScrollbarWidth.d.ts +6 -0
  323. package/es/utils/helper.d.ts +46 -0
  324. package/es/utils/input-number/large-number.d.ts +85 -0
  325. package/es/utils/input-number/number.d.ts +81 -0
  326. package/es/utils/isFragment.d.ts +4 -0
  327. package/es/utils/listener.d.ts +4 -0
  328. package/es/utils/log/index.d.ts +2 -0
  329. package/es/utils/log/log.d.ts +3 -0
  330. package/es/utils/log/types.d.ts +8 -0
  331. package/es/utils/noop.d.ts +2 -0
  332. package/es/utils/number.d.ts +7 -0
  333. package/es/utils/parentTNode.d.ts +10 -0
  334. package/es/utils/parseTNode.d.ts +10 -0
  335. package/es/utils/react-render.d.ts +16 -0
  336. package/es/utils/ref.d.ts +1 -0
  337. package/es/utils/refs.d.ts +13 -0
  338. package/es/utils/scroll.d.ts +3 -0
  339. package/es/utils/style.d.ts +4 -0
  340. package/es/utils/transition.d.ts +20 -0
  341. package/package.json +1 -1
  342. package/es/fireworks/style/index.css +0 -121
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { TdSelectProps, SelectValue, SelectValueChangeTrigger } from "./type";
3
+ interface SelectPopupProps extends Pick<TdSelectProps, "value" | "size" | "multiple" | "empty" | "options" | "max" | "loadingText" | "loading" | "valueType" | "keys" | "panelTopContent" | "panelBottomContent" | "scroll"> {
4
+ onChange?: (value: SelectValue, context?: {
5
+ label?: string | number;
6
+ value?: SelectValue;
7
+ restData?: Record<string, unknown>;
8
+ e: React.MouseEvent<HTMLLIElement>;
9
+ trigger: SelectValueChangeTrigger;
10
+ }) => void;
11
+ /**
12
+ * 是否展示popup
13
+ */
14
+ showPopup: boolean;
15
+ /**
16
+ * 控制popup展示的函数
17
+ */
18
+ setShowPopup: (show: boolean) => void;
19
+ children?: React.ReactNode;
20
+ onCheckAllChange?: (checkAll: boolean, e: React.MouseEvent<HTMLLIElement>) => void;
21
+ getPopupInstance?: () => HTMLDivElement;
22
+ }
23
+ declare const PopupContent: React.ForwardRefExoticComponent<SelectPopupProps & React.RefAttributes<HTMLDivElement>>;
24
+ export default PopupContent;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { TdSelectProps, SelectOption } from "./type";
3
+ import { StyledProps } from "../common";
4
+ export interface SelectProps<T = SelectOption> extends TdSelectProps<T>, StyledProps {
5
+ children?: React.ReactNode;
6
+ onMouseEnter?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
7
+ onMouseLeave?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
8
+ }
9
+ declare const Select: React.FunctionComponent<SelectProps<SelectOption> & React.RefAttributes<HTMLDivElement>> & {
10
+ Option: React.FC<import("./Option").SelectOptionProps>;
11
+ OptionGroup: React.FC<import("./OptionGroup").SelectGOptionGroupProps>;
12
+ };
13
+ export default Select;
@@ -0,0 +1,4 @@
1
+ import { TdSelectProps, TdOptionProps, TdOptionGroupProps } from "./type";
2
+ export declare const selectDefaultProps: TdSelectProps;
3
+ export declare const optionDefaultProps: TdOptionProps;
4
+ export declare const optionGroupDefaultProps: TdOptionGroupProps;
@@ -0,0 +1,16 @@
1
+ import React, { ReactNode } from "react";
2
+ import type { SelectKeysType, SelectOption, SelectOptionGroup, SelectValue } from "../type";
3
+ import { type ValueToOption } from "../utils/helper";
4
+ export declare function isSelectOptionGroup(option: SelectOption): option is SelectOptionGroup;
5
+ type OptionValueType = SelectValue<SelectOption>;
6
+ declare function UseOptions(keys: SelectKeysType, options: SelectOption[], children: ReactNode, valueType: "object" | "value", value: OptionValueType, reserveKeyword: boolean): {
7
+ currentOptions: SelectOption[];
8
+ setCurrentOptions: React.Dispatch<React.SetStateAction<SelectOption[]>>;
9
+ tmpPropOptions: SelectOption[];
10
+ setTmpPropOptions: React.Dispatch<React.SetStateAction<SelectOption[]>>;
11
+ valueToOption: ValueToOption;
12
+ setValueToOption: React.Dispatch<React.SetStateAction<ValueToOption>>;
13
+ selectedOptions: SelectOption[];
14
+ setSelectedOptions: React.Dispatch<React.SetStateAction<SelectOption[]>>;
15
+ };
16
+ export default UseOptions;
@@ -0,0 +1,24 @@
1
+ import { MutableRefObject, CSSProperties } from "react";
2
+ import { TdSelectProps } from "../type";
3
+ import { SizeEnum } from "../../common";
4
+ interface PanelVirtualScroll {
5
+ scroll?: TdSelectProps["scroll"];
6
+ popupContentRef: MutableRefObject<HTMLDivElement>;
7
+ options: TdSelectProps["options"];
8
+ size: SizeEnum;
9
+ }
10
+ declare const usePanelVirtualScroll: ({ popupContentRef, scroll, options, size }: PanelVirtualScroll) => {
11
+ scrollHeight: number;
12
+ translateY: number;
13
+ visibleData: unknown[];
14
+ handleRowMounted: (rowData: {
15
+ ref: HTMLElement;
16
+ data: {
17
+ __VIRTUAL_SCROLL_INDEX: number;
18
+ };
19
+ }) => void;
20
+ isVirtual: boolean;
21
+ cursorStyle: CSSProperties;
22
+ panelStyle: CSSProperties;
23
+ };
24
+ export default usePanelVirtualScroll;
@@ -0,0 +1,8 @@
1
+ import "./style/index.js";
2
+ export type { SelectProps } from "./Select";
3
+ export * from "./type";
4
+ export declare const Select: import("react").FunctionComponent<import("./Select").SelectProps<import("./type").SelectOption> & import("react").RefAttributes<HTMLDivElement>> & {
5
+ Option: import("react").FC<import("./Option").SelectOptionProps>;
6
+ OptionGroup: import("react").FC<import("./OptionGroup").SelectGOptionGroupProps>;
7
+ };
8
+ export default Select;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -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;
@@ -0,0 +1,2 @@
1
+ import { TdSelectInputProps } from "./type";
2
+ export declare const selectInputDefaultProps: TdSelectInputProps;
@@ -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
+ };
@@ -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
+ };
@@ -0,0 +1,5 @@
1
+ import "./style/index.js";
2
+ export type { SelectInputProps } from "./SelectInput";
3
+ export * from "./type";
4
+ export declare const SelectInput: import("react").ForwardRefExoticComponent<import("./SelectInput").SelectInputProps & import("react").RefAttributes<Partial<import("..").PopupRef & import("..").InputRef>>>;
5
+ export default SelectInput;
@@ -0,0 +1,17 @@
1
+ import { TdSelectInputProps } from "./type";
2
+ export interface SelectInputCommonProperties {
3
+ status?: TdSelectInputProps["status"];
4
+ tips?: TdSelectInputProps["tips"];
5
+ clearable?: TdSelectInputProps["clearable"];
6
+ disabled?: TdSelectInputProps["disabled"];
7
+ label?: TdSelectInputProps["label"];
8
+ placeholder?: TdSelectInputProps["placeholder"];
9
+ readonly?: TdSelectInputProps["readonly"];
10
+ suffix?: TdSelectInputProps["suffix"];
11
+ suffixIcon?: TdSelectInputProps["suffixIcon"];
12
+ size?: TdSelectInputProps["size"];
13
+ onPaste?: TdSelectInputProps["onPaste"];
14
+ onEnter?: TdSelectInputProps["onEnter"];
15
+ onMouseenter?: TdSelectInputProps["onMouseenter"];
16
+ onMouseleave?: TdSelectInputProps["onMouseleave"];
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};