@sheinx/hooks 3.0.0-alpha.1 → 3.0.0-alpha.11

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 (339) hide show
  1. package/cjs/common/type.d.ts +2 -0
  2. package/cjs/common/type.d.ts.map +1 -1
  3. package/cjs/common/use-drag-mock/index.d.ts +3 -11
  4. package/cjs/common/use-drag-mock/index.d.ts.map +1 -1
  5. package/cjs/common/use-drag-mock/index.js +27 -56
  6. package/cjs/common/use-drag-mock/use-drag-mock.d.ts +11 -0
  7. package/cjs/common/use-drag-mock/use-drag-mock.d.ts.map +1 -0
  8. package/cjs/common/use-drag-mock/use-drag-mock.js +61 -0
  9. package/cjs/common/use-drag-mock/use-drag-move.d.ts +11 -0
  10. package/cjs/common/use-drag-mock/use-drag-move.d.ts.map +1 -0
  11. package/cjs/common/use-drag-mock/use-drag-move.js +73 -0
  12. package/cjs/common/use-drag-mock/use-drag-resize.d.ts +15 -0
  13. package/cjs/common/use-drag-mock/use-drag-resize.d.ts.map +1 -0
  14. package/cjs/common/use-drag-mock/use-drag-resize.js +89 -0
  15. package/cjs/common/use-filter/index.d.ts +2 -0
  16. package/cjs/common/use-filter/index.d.ts.map +1 -0
  17. package/cjs/common/use-filter/index.js +19 -0
  18. package/cjs/common/use-filter/use-filter.d.ts +21 -0
  19. package/cjs/common/use-filter/use-filter.d.ts.map +1 -0
  20. package/cjs/common/use-filter/use-filter.js +163 -0
  21. package/cjs/common/use-filter/use-filter.type.d.ts +18 -0
  22. package/cjs/common/use-filter/use-filter.type.d.ts.map +1 -0
  23. package/cjs/common/use-fork-ref/setRef.d.ts +0 -1
  24. package/cjs/common/use-fork-ref/setRef.d.ts.map +1 -1
  25. package/cjs/common/use-fork-ref/setRef.js +0 -1
  26. package/cjs/common/use-position-style/index.d.ts.map +1 -1
  27. package/cjs/common/use-position-style/index.js +5 -0
  28. package/cjs/components/use-button/use-button.d.ts +1 -1
  29. package/cjs/components/use-button/use-button.d.ts.map +1 -1
  30. package/cjs/components/use-button/use-button.js +2 -2
  31. package/cjs/components/use-button/use-button.type.d.ts +55 -0
  32. package/cjs/components/use-button/use-button.type.d.ts.map +1 -1
  33. package/cjs/components/use-cascader/index.d.ts +3 -0
  34. package/cjs/components/use-cascader/index.d.ts.map +1 -0
  35. package/cjs/components/use-cascader/index.js +19 -0
  36. package/cjs/components/use-cascader/use-cascader.d.ts +36 -0
  37. package/cjs/components/use-cascader/use-cascader.d.ts.map +1 -0
  38. package/cjs/components/use-cascader/use-cascader.js +47 -0
  39. package/cjs/components/use-cascader/use-cascader.type.d.ts +16 -0
  40. package/cjs/components/use-cascader/use-cascader.type.d.ts.map +1 -0
  41. package/cjs/components/use-check/use-check.type.d.ts +25 -0
  42. package/cjs/components/use-check/use-check.type.d.ts.map +1 -1
  43. package/cjs/components/use-collapse/index.d.ts +5 -0
  44. package/cjs/components/use-collapse/index.d.ts.map +1 -0
  45. package/cjs/components/use-collapse/index.js +26 -0
  46. package/cjs/components/use-collapse/use-collapse-item.d.ts +22 -0
  47. package/cjs/components/use-collapse/use-collapse-item.d.ts.map +1 -0
  48. package/cjs/components/use-collapse/use-collapse-item.js +72 -0
  49. package/cjs/components/use-collapse/use-collapse-item.type.d.ts +29 -0
  50. package/cjs/components/use-collapse/use-collapse-item.type.d.ts.map +1 -0
  51. package/cjs/components/use-collapse/use-collapse-item.type.js +5 -0
  52. package/cjs/components/use-collapse/use-collapse.d.ts +8 -0
  53. package/cjs/components/use-collapse/use-collapse.d.ts.map +1 -0
  54. package/cjs/components/use-collapse/use-collapse.js +51 -0
  55. package/cjs/components/use-collapse/use-collapse.type.d.ts +21 -0
  56. package/cjs/components/use-collapse/use-collapse.type.d.ts.map +1 -0
  57. package/cjs/components/use-collapse/use-collapse.type.js +5 -0
  58. package/cjs/components/use-datepicker/use-datepicker-format.js +1 -1
  59. package/cjs/components/use-datepicker/use-time.js +1 -1
  60. package/cjs/components/use-descriptions/index.d.ts +3 -0
  61. package/cjs/components/use-descriptions/index.d.ts.map +1 -0
  62. package/cjs/components/use-descriptions/index.js +19 -0
  63. package/cjs/components/use-descriptions/use-descriptions.d.ts +6 -0
  64. package/cjs/components/use-descriptions/use-descriptions.d.ts.map +1 -0
  65. package/cjs/components/use-descriptions/use-descriptions.js +77 -0
  66. package/cjs/components/use-descriptions/use-descriptions.type.d.ts +65 -0
  67. package/cjs/components/use-descriptions/use-descriptions.type.d.ts.map +1 -0
  68. package/cjs/components/use-descriptions/use-descriptions.type.js +5 -0
  69. package/cjs/components/use-image/use-image.type.d.ts +76 -0
  70. package/cjs/components/use-image/use-image.type.d.ts.map +1 -1
  71. package/cjs/components/use-input/use-input-format.type.d.ts +25 -5
  72. package/cjs/components/use-input/use-input-format.type.d.ts.map +1 -1
  73. package/cjs/components/use-input/use-input-number.type.d.ts +17 -0
  74. package/cjs/components/use-input/use-input-number.type.d.ts.map +1 -1
  75. package/cjs/components/use-input/use-input-password.type.d.ts +21 -0
  76. package/cjs/components/use-input/use-input-password.type.d.ts.map +1 -1
  77. package/cjs/components/use-input/use-input.js +1 -1
  78. package/cjs/components/use-input/use-input.type.d.ts +43 -0
  79. package/cjs/components/use-input/use-input.type.d.ts.map +1 -1
  80. package/cjs/components/use-select/index.d.ts +1 -0
  81. package/cjs/components/use-select/index.d.ts.map +1 -1
  82. package/cjs/components/use-select/index.js +8 -1
  83. package/cjs/components/use-select/use-select-group.d.ts +7 -0
  84. package/cjs/components/use-select/use-select-group.d.ts.map +1 -0
  85. package/cjs/components/use-select/use-select-group.js +51 -0
  86. package/cjs/components/use-select/use-select-group.type.d.ts +5 -0
  87. package/cjs/components/use-select/use-select-group.type.d.ts.map +1 -0
  88. package/cjs/components/use-select/use-select-group.type.js +5 -0
  89. package/cjs/components/use-select/use-select.d.ts.map +1 -1
  90. package/cjs/components/use-select/use-select.js +4 -4
  91. package/cjs/components/use-select/use-select.type.d.ts +41 -1
  92. package/cjs/components/use-select/use-select.type.d.ts.map +1 -1
  93. package/cjs/components/use-slider/use-slider.d.ts +2 -2
  94. package/cjs/components/use-slider/use-slider.js +4 -4
  95. package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
  96. package/cjs/components/use-table/use-table-virtual.js +12 -2
  97. package/cjs/components/use-tabs/context.type.d.ts +25 -0
  98. package/cjs/components/use-tabs/context.type.d.ts.map +1 -1
  99. package/cjs/components/use-tabs/use-tabs.type.d.ts +8 -0
  100. package/cjs/components/use-tabs/use-tabs.type.d.ts.map +1 -1
  101. package/cjs/components/use-textarea/use-textarea.type.d.ts +29 -0
  102. package/cjs/components/use-textarea/use-textarea.type.d.ts.map +1 -1
  103. package/cjs/components/use-transfer/use-transfer.type.d.ts +53 -0
  104. package/cjs/components/use-transfer/use-transfer.type.d.ts.map +1 -1
  105. package/cjs/components/use-tree/index.d.ts +1 -2
  106. package/cjs/components/use-tree/index.d.ts.map +1 -1
  107. package/cjs/components/use-tree/index.js +1 -8
  108. package/cjs/components/use-tree/use-tree-node.d.ts +2 -1
  109. package/cjs/components/use-tree/use-tree-node.d.ts.map +1 -1
  110. package/cjs/components/use-tree/use-tree-node.js +7 -7
  111. package/cjs/components/use-tree/use-tree-node.type.d.ts +2 -2
  112. package/cjs/components/use-tree/use-tree-node.type.d.ts.map +1 -1
  113. package/cjs/components/use-tree/use-tree.d.ts +25 -2
  114. package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
  115. package/cjs/components/use-tree/use-tree.js +96 -44
  116. package/cjs/components/use-tree/use-tree.type.d.ts +69 -4
  117. package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
  118. package/cjs/components/use-treeselect/index.d.ts +4 -0
  119. package/cjs/components/use-treeselect/index.d.ts.map +1 -0
  120. package/cjs/components/use-treeselect/index.js +26 -0
  121. package/cjs/components/use-treeselect/use-tiled.d.ts +13 -0
  122. package/cjs/components/use-treeselect/use-tiled.d.ts.map +1 -0
  123. package/cjs/components/use-treeselect/use-tiled.js +99 -0
  124. package/cjs/components/use-treeselect/use-tiled.type.d.ts +15 -0
  125. package/cjs/components/use-treeselect/use-tiled.type.d.ts.map +1 -0
  126. package/cjs/components/use-treeselect/use-tiled.type.js +5 -0
  127. package/cjs/components/use-treeselect/use-treeselect.d.ts +7 -0
  128. package/cjs/components/use-treeselect/use-treeselect.d.ts.map +1 -0
  129. package/cjs/components/use-treeselect/use-treeselect.js +29 -0
  130. package/cjs/components/use-treeselect/use-treeselect.type.d.ts +9 -0
  131. package/cjs/components/use-treeselect/use-treeselect.type.d.ts.map +1 -0
  132. package/cjs/components/use-treeselect/use-treeselect.type.js +5 -0
  133. package/cjs/components/use-upload/use-upload.js +5 -5
  134. package/cjs/components/use-upload/use-upload.type.d.ts +5 -1
  135. package/cjs/components/use-upload/use-upload.type.d.ts.map +1 -1
  136. package/cjs/index.d.ts +5 -0
  137. package/cjs/index.d.ts.map +1 -1
  138. package/cjs/index.js +60 -0
  139. package/cjs/utils/dom/element.d.ts +2 -1
  140. package/cjs/utils/dom/element.d.ts.map +1 -1
  141. package/cjs/utils/dom/element.js +9 -1
  142. package/cjs/utils/dom/index.d.ts +3 -0
  143. package/cjs/utils/dom/index.d.ts.map +1 -1
  144. package/cjs/utils/dom/index.js +32 -10
  145. package/cjs/utils/dom/responsiveObserve.d.ts +13 -0
  146. package/cjs/utils/dom/responsiveObserve.d.ts.map +1 -0
  147. package/cjs/utils/dom/responsiveObserve.js +89 -0
  148. package/cjs/utils/dom/responsiveObserve.type.d.ts +5 -0
  149. package/cjs/utils/dom/responsiveObserve.type.d.ts.map +1 -0
  150. package/cjs/utils/dom/responsiveObserve.type.js +5 -0
  151. package/cjs/utils/index.d.ts +1 -0
  152. package/cjs/utils/index.d.ts.map +1 -1
  153. package/cjs/utils/index.js +12 -0
  154. package/cjs/utils/is.d.ts +1 -0
  155. package/cjs/utils/is.d.ts.map +1 -1
  156. package/cjs/utils/is.js +5 -1
  157. package/cjs/utils/react-render.d.ts.map +1 -1
  158. package/cjs/utils/react-render.js +1 -2
  159. package/cjs/utils/render.d.ts.map +1 -1
  160. package/cjs/utils/tree.d.ts +14 -0
  161. package/cjs/utils/tree.d.ts.map +1 -0
  162. package/cjs/utils/tree.js +93 -0
  163. package/esm/common/type.d.ts +2 -0
  164. package/esm/common/type.d.ts.map +1 -1
  165. package/esm/common/use-drag-mock/index.d.ts +3 -11
  166. package/esm/common/use-drag-mock/index.d.ts.map +1 -1
  167. package/esm/common/use-drag-mock/index.js +27 -56
  168. package/esm/common/use-drag-mock/use-drag-mock.d.ts +11 -0
  169. package/esm/common/use-drag-mock/use-drag-mock.d.ts.map +1 -0
  170. package/esm/common/use-drag-mock/use-drag-mock.js +61 -0
  171. package/esm/common/use-drag-mock/use-drag-move.d.ts +11 -0
  172. package/esm/common/use-drag-mock/use-drag-move.d.ts.map +1 -0
  173. package/esm/common/use-drag-mock/use-drag-move.js +73 -0
  174. package/esm/common/use-drag-mock/use-drag-resize.d.ts +15 -0
  175. package/esm/common/use-drag-mock/use-drag-resize.d.ts.map +1 -0
  176. package/esm/common/use-drag-mock/use-drag-resize.js +89 -0
  177. package/esm/common/use-filter/index.d.ts +2 -0
  178. package/esm/common/use-filter/index.d.ts.map +1 -0
  179. package/esm/common/use-filter/index.js +19 -0
  180. package/esm/common/use-filter/use-filter.d.ts +21 -0
  181. package/esm/common/use-filter/use-filter.d.ts.map +1 -0
  182. package/esm/common/use-filter/use-filter.js +163 -0
  183. package/esm/common/use-filter/use-filter.type.d.ts +18 -0
  184. package/esm/common/use-filter/use-filter.type.d.ts.map +1 -0
  185. package/esm/common/use-filter/use-filter.type.js +5 -0
  186. package/esm/common/use-fork-ref/setRef.d.ts +0 -1
  187. package/esm/common/use-fork-ref/setRef.d.ts.map +1 -1
  188. package/esm/common/use-fork-ref/setRef.js +0 -1
  189. package/esm/common/use-position-style/index.d.ts.map +1 -1
  190. package/esm/common/use-position-style/index.js +5 -0
  191. package/esm/components/use-button/use-button.d.ts +1 -1
  192. package/esm/components/use-button/use-button.d.ts.map +1 -1
  193. package/esm/components/use-button/use-button.js +2 -2
  194. package/esm/components/use-button/use-button.type.d.ts +55 -0
  195. package/esm/components/use-button/use-button.type.d.ts.map +1 -1
  196. package/esm/components/use-cascader/index.d.ts +3 -0
  197. package/esm/components/use-cascader/index.d.ts.map +1 -0
  198. package/esm/components/use-cascader/index.js +19 -0
  199. package/esm/components/use-cascader/use-cascader.d.ts +36 -0
  200. package/esm/components/use-cascader/use-cascader.d.ts.map +1 -0
  201. package/esm/components/use-cascader/use-cascader.js +47 -0
  202. package/esm/components/use-cascader/use-cascader.type.d.ts +16 -0
  203. package/esm/components/use-cascader/use-cascader.type.d.ts.map +1 -0
  204. package/esm/components/use-cascader/use-cascader.type.js +5 -0
  205. package/esm/components/use-check/use-check.type.d.ts +25 -0
  206. package/esm/components/use-check/use-check.type.d.ts.map +1 -1
  207. package/esm/components/use-collapse/index.d.ts +5 -0
  208. package/esm/components/use-collapse/index.d.ts.map +1 -0
  209. package/esm/components/use-collapse/index.js +26 -0
  210. package/esm/components/use-collapse/use-collapse-item.d.ts +22 -0
  211. package/esm/components/use-collapse/use-collapse-item.d.ts.map +1 -0
  212. package/esm/components/use-collapse/use-collapse-item.js +72 -0
  213. package/esm/components/use-collapse/use-collapse-item.type.d.ts +29 -0
  214. package/esm/components/use-collapse/use-collapse-item.type.d.ts.map +1 -0
  215. package/esm/components/use-collapse/use-collapse-item.type.js +5 -0
  216. package/esm/components/use-collapse/use-collapse.d.ts +8 -0
  217. package/esm/components/use-collapse/use-collapse.d.ts.map +1 -0
  218. package/esm/components/use-collapse/use-collapse.js +51 -0
  219. package/esm/components/use-collapse/use-collapse.type.d.ts +21 -0
  220. package/esm/components/use-collapse/use-collapse.type.d.ts.map +1 -0
  221. package/esm/components/use-collapse/use-collapse.type.js +5 -0
  222. package/esm/components/use-datepicker/use-datepicker-format.js +1 -1
  223. package/esm/components/use-datepicker/use-time.js +1 -1
  224. package/esm/components/use-descriptions/index.d.ts +3 -0
  225. package/esm/components/use-descriptions/index.d.ts.map +1 -0
  226. package/esm/components/use-descriptions/index.js +19 -0
  227. package/esm/components/use-descriptions/use-descriptions.d.ts +6 -0
  228. package/esm/components/use-descriptions/use-descriptions.d.ts.map +1 -0
  229. package/esm/components/use-descriptions/use-descriptions.js +77 -0
  230. package/esm/components/use-descriptions/use-descriptions.type.d.ts +65 -0
  231. package/esm/components/use-descriptions/use-descriptions.type.d.ts.map +1 -0
  232. package/esm/components/use-descriptions/use-descriptions.type.js +5 -0
  233. package/esm/components/use-image/use-image.type.d.ts +76 -0
  234. package/esm/components/use-image/use-image.type.d.ts.map +1 -1
  235. package/esm/components/use-input/use-input-format.type.d.ts +25 -5
  236. package/esm/components/use-input/use-input-format.type.d.ts.map +1 -1
  237. package/esm/components/use-input/use-input-number.type.d.ts +17 -0
  238. package/esm/components/use-input/use-input-number.type.d.ts.map +1 -1
  239. package/esm/components/use-input/use-input-password.type.d.ts +21 -0
  240. package/esm/components/use-input/use-input-password.type.d.ts.map +1 -1
  241. package/esm/components/use-input/use-input.js +1 -1
  242. package/esm/components/use-input/use-input.type.d.ts +43 -0
  243. package/esm/components/use-input/use-input.type.d.ts.map +1 -1
  244. package/esm/components/use-select/index.d.ts +1 -0
  245. package/esm/components/use-select/index.d.ts.map +1 -1
  246. package/esm/components/use-select/index.js +8 -1
  247. package/esm/components/use-select/use-select-group.d.ts +7 -0
  248. package/esm/components/use-select/use-select-group.d.ts.map +1 -0
  249. package/esm/components/use-select/use-select-group.js +51 -0
  250. package/esm/components/use-select/use-select-group.type.d.ts +5 -0
  251. package/esm/components/use-select/use-select-group.type.d.ts.map +1 -0
  252. package/esm/components/use-select/use-select-group.type.js +5 -0
  253. package/esm/components/use-select/use-select.d.ts.map +1 -1
  254. package/esm/components/use-select/use-select.js +4 -4
  255. package/esm/components/use-select/use-select.type.d.ts +41 -1
  256. package/esm/components/use-select/use-select.type.d.ts.map +1 -1
  257. package/esm/components/use-slider/use-slider.d.ts +2 -2
  258. package/esm/components/use-slider/use-slider.js +4 -4
  259. package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
  260. package/esm/components/use-table/use-table-virtual.js +12 -2
  261. package/esm/components/use-tabs/context.type.d.ts +25 -0
  262. package/esm/components/use-tabs/context.type.d.ts.map +1 -1
  263. package/esm/components/use-tabs/use-tabs.type.d.ts +8 -0
  264. package/esm/components/use-tabs/use-tabs.type.d.ts.map +1 -1
  265. package/esm/components/use-textarea/use-textarea.type.d.ts +29 -0
  266. package/esm/components/use-textarea/use-textarea.type.d.ts.map +1 -1
  267. package/esm/components/use-transfer/use-transfer.type.d.ts +53 -0
  268. package/esm/components/use-transfer/use-transfer.type.d.ts.map +1 -1
  269. package/esm/components/use-tree/index.d.ts +1 -2
  270. package/esm/components/use-tree/index.d.ts.map +1 -1
  271. package/esm/components/use-tree/index.js +1 -8
  272. package/esm/components/use-tree/use-tree-node.d.ts +2 -1
  273. package/esm/components/use-tree/use-tree-node.d.ts.map +1 -1
  274. package/esm/components/use-tree/use-tree-node.js +7 -7
  275. package/esm/components/use-tree/use-tree-node.type.d.ts +2 -2
  276. package/esm/components/use-tree/use-tree-node.type.d.ts.map +1 -1
  277. package/esm/components/use-tree/use-tree.d.ts +25 -2
  278. package/esm/components/use-tree/use-tree.d.ts.map +1 -1
  279. package/esm/components/use-tree/use-tree.js +96 -44
  280. package/esm/components/use-tree/use-tree.type.d.ts +69 -4
  281. package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
  282. package/esm/components/use-treeselect/index.d.ts +4 -0
  283. package/esm/components/use-treeselect/index.d.ts.map +1 -0
  284. package/esm/components/use-treeselect/index.js +26 -0
  285. package/esm/components/use-treeselect/use-tiled.d.ts +13 -0
  286. package/esm/components/use-treeselect/use-tiled.d.ts.map +1 -0
  287. package/esm/components/use-treeselect/use-tiled.js +99 -0
  288. package/esm/components/use-treeselect/use-tiled.type.d.ts +15 -0
  289. package/esm/components/use-treeselect/use-tiled.type.d.ts.map +1 -0
  290. package/esm/components/use-treeselect/use-tiled.type.js +5 -0
  291. package/esm/components/use-treeselect/use-treeselect.d.ts +7 -0
  292. package/esm/components/use-treeselect/use-treeselect.d.ts.map +1 -0
  293. package/esm/components/use-treeselect/use-treeselect.js +29 -0
  294. package/esm/components/use-treeselect/use-treeselect.type.d.ts +9 -0
  295. package/esm/components/use-treeselect/use-treeselect.type.d.ts.map +1 -0
  296. package/esm/components/use-treeselect/use-treeselect.type.js +5 -0
  297. package/esm/components/use-upload/use-upload.js +5 -5
  298. package/esm/components/use-upload/use-upload.type.d.ts +5 -1
  299. package/esm/components/use-upload/use-upload.type.d.ts.map +1 -1
  300. package/esm/index.d.ts +5 -0
  301. package/esm/index.d.ts.map +1 -1
  302. package/esm/index.js +60 -0
  303. package/esm/utils/dom/element.d.ts +2 -1
  304. package/esm/utils/dom/element.d.ts.map +1 -1
  305. package/esm/utils/dom/element.js +9 -1
  306. package/esm/utils/dom/index.d.ts +3 -0
  307. package/esm/utils/dom/index.d.ts.map +1 -1
  308. package/esm/utils/dom/index.js +32 -10
  309. package/esm/utils/dom/responsiveObserve.d.ts +13 -0
  310. package/esm/utils/dom/responsiveObserve.d.ts.map +1 -0
  311. package/esm/utils/dom/responsiveObserve.js +89 -0
  312. package/esm/utils/dom/responsiveObserve.type.d.ts +5 -0
  313. package/esm/utils/dom/responsiveObserve.type.d.ts.map +1 -0
  314. package/esm/utils/dom/responsiveObserve.type.js +5 -0
  315. package/esm/utils/index.d.ts +1 -0
  316. package/esm/utils/index.d.ts.map +1 -1
  317. package/esm/utils/index.js +12 -0
  318. package/esm/utils/is.d.ts +1 -0
  319. package/esm/utils/is.d.ts.map +1 -1
  320. package/esm/utils/is.js +5 -1
  321. package/esm/utils/react-render.d.ts.map +1 -1
  322. package/esm/utils/react-render.js +1 -2
  323. package/esm/utils/render.d.ts.map +1 -1
  324. package/esm/utils/tree.d.ts +14 -0
  325. package/esm/utils/tree.d.ts.map +1 -0
  326. package/esm/utils/tree.js +93 -0
  327. package/package.json +7 -6
  328. package/cjs/components/use-tree/use-placement.d.ts +0 -6
  329. package/cjs/components/use-tree/use-placement.d.ts.map +0 -1
  330. package/cjs/components/use-tree/use-placement.js +0 -25
  331. package/cjs/components/use-tree/use-placement.type.d.ts +0 -4
  332. package/cjs/components/use-tree/use-placement.type.d.ts.map +0 -1
  333. package/esm/components/use-tree/use-placement.d.ts +0 -6
  334. package/esm/components/use-tree/use-placement.d.ts.map +0 -1
  335. package/esm/components/use-tree/use-placement.js +0 -25
  336. package/esm/components/use-tree/use-placement.type.d.ts +0 -4
  337. package/esm/components/use-tree/use-placement.type.d.ts.map +0 -1
  338. /package/cjs/{components/use-tree/use-placement.type.js → common/use-filter/use-filter.type.js} +0 -0
  339. /package/{esm/components/use-tree/use-placement.type.js → cjs/components/use-cascader/use-cascader.type.js} +0 -0
@@ -0,0 +1,3 @@
1
+ export { default, default as useDescriptions } from './use-descriptions';
2
+ export type { DescriptionsItemProps, BaseDescriptionsProps } from './use-descriptions.type';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACzE,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _useDescriptions.default;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "useDescriptions", {
14
+ enumerable: true,
15
+ get: function get() {
16
+ return _useDescriptions.default;
17
+ }
18
+ });
19
+ var _useDescriptions = _interopRequireDefault(require("./use-descriptions"));
@@ -0,0 +1,6 @@
1
+ import type { BaseDescriptionsProps, DescriptionsItemProps } from './use-descriptions.type';
2
+ declare const useDescriptions: (props: BaseDescriptionsProps) => {
3
+ renderItem: DescriptionsItemProps[][];
4
+ };
5
+ export default useDescriptions;
6
+ //# sourceMappingURL=use-descriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-descriptions.d.ts","sourceRoot":"","sources":["use-descriptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAW5F,QAAA,MAAM,eAAe,UAAW,qBAAqB;;CAwDpD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.array.filter.js");
4
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.default = void 0;
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
+ require("core-js/modules/web.dom-collections.for-each.js");
13
+ var _react = require("react");
14
+ var _ = require("../..");
15
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
+ var isObject = _.util.isObject,
18
+ isNumber = _.util.isNumber,
19
+ isArray = _.util.isArray;
20
+ var responsiveArray = ['xxxl', 'xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
21
+ var getLengthByRow = function getLengthByRow(arr) {
22
+ return isArray(arr) ? arr.reduce(function (prev, now) {
23
+ return prev + (now.span || 1);
24
+ }, 0) : 0;
25
+ };
26
+ var useDescriptions = function useDescriptions(props) {
27
+ var items = props.items,
28
+ column = props.column,
29
+ valueStyle = props.valueStyle,
30
+ labelStyle = props.labelStyle;
31
+ var _useState = (0, _react.useState)(),
32
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
33
+ screen = _useState2[0],
34
+ setScreen = _useState2[1];
35
+ var responsiveToken = (0, _react.useRef)();
36
+ var renderItem = [];
37
+ (0, _react.useEffect)(function () {
38
+ responsiveToken.current = _.ResponsiveObserve.subscribe(function (screens) {
39
+ for (var i = 0; i < responsiveArray.length; i++) {
40
+ var breakPoint = responsiveArray[i];
41
+ if (screens[breakPoint]) {
42
+ setScreen(breakPoint);
43
+ break;
44
+ }
45
+ }
46
+ });
47
+ return function () {
48
+ _.ResponsiveObserve.unsubscribe(responsiveToken.current);
49
+ };
50
+ }, []);
51
+ var currentColumn = 3;
52
+ if (column && isObject(column)) currentColumn = column[screen] || 3;
53
+ if (column && isNumber(column) && column > 0) currentColumn = column;
54
+ if (isArray(items) && items.length && currentColumn) {
55
+ items.forEach(function (d) {
56
+ var lastRenderItem = renderItem[renderItem.length - 1];
57
+ var lengthRow = getLengthByRow(lastRenderItem);
58
+ var span = d.span ? d.span > currentColumn ? currentColumn : d.span : 1;
59
+ var newItem = _objectSpread(_objectSpread({}, d), {}, {
60
+ span: span,
61
+ itemValueStyle: Object.assign({}, valueStyle, d === null || d === void 0 ? void 0 : d.itemValueStyle),
62
+ itemLabelStyle: Object.assign({}, labelStyle, d === null || d === void 0 ? void 0 : d.itemLabelStyle)
63
+ });
64
+ if (lengthRow === 0 || lengthRow === currentColumn) renderItem.push([newItem]);else lastRenderItem.push(_objectSpread(_objectSpread({}, newItem), {}, {
65
+ span: d.span ? d.span > currentColumn - lengthRow ? currentColumn - lengthRow : d.span : 1
66
+ }));
67
+ });
68
+ var lastRenderItem = renderItem[renderItem.length - 1];
69
+ var lengthRow = getLengthByRow(lastRenderItem);
70
+ if (lengthRow < currentColumn) lastRenderItem[lastRenderItem.length - 1].span += currentColumn - lengthRow;
71
+ }
72
+ return {
73
+ renderItem: renderItem
74
+ };
75
+ };
76
+ var _default = useDescriptions;
77
+ exports.default = _default;
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ export interface DescriptionsItemProps {
3
+ /**
4
+ * @private 内部属性
5
+ */
6
+ key?: React.Key;
7
+ /**
8
+ * @en Data label
9
+ * @cn 数据标签
10
+ */
11
+ label?: React.ReactNode;
12
+ /**
13
+ * @en Data value
14
+ * @cn 数据值
15
+ */
16
+ value?: React.ReactNode;
17
+ /**
18
+ * @en The number of columns occupied
19
+ * @cn 占据的列数
20
+ */
21
+ span?: number;
22
+ /**
23
+ * @en The style of the current data label
24
+ * @cn 当前数据标签样式
25
+ */
26
+ itemLabelStyle?: React.CSSProperties;
27
+ /**
28
+ * @en The style of the current data value
29
+ * @cn 当前数据值样式
30
+ */
31
+ itemValueStyle?: React.CSSProperties;
32
+ }
33
+ export interface BaseDescriptionsProps {
34
+ /**
35
+ * @en Descriptions array
36
+ * @cn 描述项数组,描述项对象结构见下
37
+ * @override ItemType[]
38
+ */
39
+ items?: DescriptionsItemProps[];
40
+ /**
41
+ * @en Label style
42
+ * @cn 标签样式
43
+ */
44
+ labelStyle?: React.CSSProperties;
45
+ /**
46
+ * @en Value style
47
+ * @cn 值样式
48
+ */
49
+ valueStyle?: React.CSSProperties;
50
+ /**
51
+ * @en The number of columns placed in each row, one data is one column, it can be configured as a number or an object, when configured as an object format, responsive arrangement is supported
52
+ * @cn 每行放置的列的数量,一个数据为一列,可配置为数字或对象,当配置为对象格式时,支持响应式排列
53
+ * @default 3
54
+ */
55
+ column?: number | {
56
+ xs?: number;
57
+ sm?: number;
58
+ md?: number;
59
+ lg?: number;
60
+ xl?: number;
61
+ xxl?: number;
62
+ xxxl?: number;
63
+ };
64
+ }
65
+ //# sourceMappingURL=use-descriptions.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-descriptions.type.d.ts","sourceRoot":"","sources":["use-descriptions.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACtC;AACD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC;;;;OAIG;IACH,MAAM,CAAC,EACH,MAAM,GACN;QACE,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACP"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -18,27 +18,58 @@ export interface BaseImageProps {
18
18
  * @default -
19
19
  *
20
20
  */
21
+ /**
22
+ * @en Image fill type
23
+ * @cn 图片填充方式
24
+ */
21
25
  fit?: ImageFitType;
22
26
  /**
23
27
  * @title 懒加载容器
24
28
  * @description 指定懒加载的容器,如: #id
25
29
  * @default -
26
30
  */
31
+ /**
32
+ * @en Lazy load container
33
+ * @cn 懒加载容器
34
+ */
27
35
  container?: string | HTMLElement;
28
36
  /**
29
37
  * @title 自定义错误内容
30
38
  * @description 当图片加载失败时,允许自定义渲染对应的的内容。
31
39
  * @default -
32
40
  */
41
+ /**
42
+ * @en Custom error content
43
+ * @cn 自定义错误内容
44
+ */
33
45
  error?: React.ReactNode;
46
+ /**
47
+ * @en Original picture address
48
+ * @cn 原始图片地址
49
+ */
34
50
  href?: string;
51
+ /**
52
+ * @en Whether to delay loading, number to set lazy offset
53
+ * @cn 是否延迟加载,如果为数字则表示懒加载偏移量
54
+ * @default false
55
+ */
35
56
  lazy?: boolean | number;
57
+ /**
58
+ * @en The original property of html
59
+ * @cn 是否禁止 img 元素原生 draggable 属性
60
+ * @default false
61
+ */
36
62
  noImgDrag?: boolean;
37
63
  /**
38
64
  * @title 图加载时的占位内容
39
65
  * @description 图片加载过程中,允许自定义渲染加载时的的内容。
40
66
  * @default 'loading'
41
67
  */
68
+ /**
69
+ * @en Loading image placeholder content
70
+ * @cn 图加载时的占位内容
71
+ * @default 'loading
72
+ */
42
73
  placeholder?: React.ReactNode;
43
74
  /**
44
75
  * @title 图片形状
@@ -48,16 +79,61 @@ export interface BaseImageProps {
48
79
  * - thumbnail: 缩略图
49
80
  * @default 'rounded'
50
81
  */
82
+ /**
83
+ * @en Image shape
84
+ * @cn 图片形状
85
+ * @default 'rounded'
86
+ */
51
87
  shape?: ImageShapeType;
88
+ /**
89
+ * @en Target of image
90
+ * @cn 图片打开方式
91
+ * @default '_modal'
92
+ */
52
93
  target?: ImageTargetType;
94
+ /**
95
+ * @en The width of the image
96
+ * @cn 图片宽度
97
+ * @default '100%'
98
+ */
53
99
  width?: number | string;
100
+ /**
101
+ * @en The height of the image
102
+ * @cn 图片高度
103
+ * @default '100%'
104
+ */
54
105
  height?: number | string;
106
+ /**
107
+ * @en The picture address
108
+ * @cn 图片地址
109
+ */
55
110
  src?: string;
111
+ /**
112
+ * @en The original property of html
113
+ * @cn 原生 title 属性
114
+ */
56
115
  title?: string;
57
116
  imageRef?: React.RefObject<HTMLImageElement>;
117
+ /**
118
+ * @en The callback of click
119
+ * @cn 点击图片的回调
120
+ */
58
121
  onClick?: React.MouseEventHandler;
122
+ /**
123
+ * @en Alternate address, applied when src is invalid
124
+ * @cn 备用地址,src无效时会应用
125
+ */
59
126
  alt?: string;
127
+ /**
128
+ * @en Auto transform protocol
129
+ * @cn 是否根据页面自动转换协议
130
+ * @default false
131
+ */
60
132
  autoSSL?: boolean;
133
+ /**
134
+ * @en Callback of image src or alt request fail
135
+ * @cn src或alt 地址请求出错回调
136
+ */
61
137
  onError?: (e: Event, type: number) => void;
62
138
  }
63
139
  //# sourceMappingURL=use-image.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-image.type.d.ts","sourceRoot":"","sources":["use-image.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,oBAAY,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAChE,oBAAY,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AACjE,oBAAY,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE1E,oBAAY,MAAM,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CA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AAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C"}
@@ -4,28 +4,48 @@ export interface InputFormatProps {
4
4
  value: InputValue;
5
5
  onChange: (value: InputValue) => void;
6
6
  /**
7
- * 是否去除前后空格
7
+ * @en Whether to remove leading and trailing spaces
8
+ * @cn 是否去除前后空格
8
9
  */
9
10
  trim?: boolean;
11
+ /**
12
+ * @en Same as the type of the native input tag
13
+ * @cn 同原生 input 标签的 type
14
+ * @override string
15
+ * @default 'text'
16
+ */
10
17
  type?: React.InputHTMLAttributes<HTMLInputElement>['type'];
18
+ /**
19
+ * @en Number type supports "positive" and "non-negative", only works when type = number
20
+ * @cn 设置数字类型 支持 "positive" 和 "non-negative", 仅在 type = number 下生效
21
+ */
11
22
  numType?: 'non-negative' | 'positive';
23
+ /**
24
+ * @en Show as thousands separator, valid only when type is "number"
25
+ * @cn 以千位分隔符展示,仅当 type 为 number 时有效
26
+ * @default false
27
+ */
12
28
  coin?: boolean;
13
29
  /**
14
- * 整数位数限制, 仅在 type = number 下生效
30
+ * @en Integer limit, only works when type = number
31
+ * @cn 整数位数限制, 仅在 type = number 下生效
15
32
  */
16
33
  integerLimit?: number;
17
34
  /**
18
- * 小数位数限制, 仅在 type = number 下生效
35
+ * @en Decimal limit, only works when type = number
36
+ * @cn 小数位数限制, 仅在 type = number 下生效
19
37
  */
20
38
  digits?: number;
21
39
  /**
22
- * 是否自动补全小数位数, 仅在 type = number 下生效
40
+ * @en Whether to automatically complete the number of decimal places, only works when type = number
41
+ * @cn 是否自动补全小数位数, 仅在 type = number 下生效
23
42
  */
24
43
  autoFix?: boolean;
25
44
  onBlur?: React.FocusEventHandler;
26
45
  onFocus?: React.FocusEventHandler;
27
46
  /**
28
- * 取消 blur 触发 onChange,用于多层嵌套的格式化,只在最外层触发一次onChange
47
+ * @en Cancel blur trigger onChange, used for multi-layer nesting of formatting, only trigger onChange once at the outermost layer
48
+ * @cn 取消 blur 触发 onChange,用于多层嵌套的格式化,只在最外层触发一次onChange
29
49
  */
30
50
  cancelBlurChange?: boolean;
31
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-input-format.type.d.ts","sourceRoot":"","sources":["use-input-format.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,oBAAY,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"use-input-format.type.d.ts","sourceRoot":"","sources":["use-input-format.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,oBAAY,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3D;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACtC;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -3,9 +3,26 @@ export declare type NumberValue = string | number | undefined | null;
3
3
  export interface InputNumberProps extends Omit<InputFormatProps, 'value' | 'onChange' | 'autoFix' | 'trim' | 'coin' | 'type'> {
4
4
  value: NumberValue;
5
5
  onChange: (value: NumberValue) => void | undefined;
6
+ /**
7
+ * @en Minimum value
8
+ * @cn 最小值
9
+ */
6
10
  min?: number;
11
+ /**
12
+ * @en Maximum value
13
+ * @cn 最大值
14
+ */
7
15
  max?: number;
16
+ /**
17
+ * @en Allow value is null
18
+ * @cn 清空后值为 null
19
+ */
8
20
  allowNull?: boolean;
21
+ /**
22
+ * @en Change the digital span. It can be decimal
23
+ * @cn 改变数字跨度,可为小数
24
+ * @default 1
25
+ */
9
26
  step?: number;
10
27
  disabled?: boolean;
11
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-input-number.type.d.ts","sourceRoot":"","sources":["use-input-number.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,oBAAY,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;AAC7D,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC3F,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,SAAS,CAAC;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
1
+ {"version":3,"file":"use-input-number.type.d.ts","sourceRoot":"","sources":["use-input-number.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,oBAAY,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;AAC7D,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC3F,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,SAAS,CAAC;IACnD;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -2,10 +2,31 @@ export declare type PasswordValue = string | undefined;
2
2
  export interface InputPasswordProps {
3
3
  value: PasswordValue;
4
4
  onChange: (value: PasswordValue) => void;
5
+ /**
6
+ * @cn 密码符号
7
+ * @en Password symbol
8
+ * @default '•'
9
+ */
5
10
  point?: string;
11
+ /**
12
+ * @cn 是否显示切换密码可见状态的按钮
13
+ * @en Whether to display the button to toggle the visibility of the password
14
+ */
6
15
  visibilityToggle?: boolean;
16
+ /**
17
+ * @cn 是否显示密码
18
+ * @en Whether to display the password
19
+ */
7
20
  visibility?: boolean;
21
+ /**
22
+ * @cn 初始状态是否显示密码
23
+ * @en Whether to display the password initially
24
+ */
8
25
  defaultVisibility?: boolean;
26
+ /**
27
+ * @cn 切换密码可见状态的按钮的图标
28
+ * @en The icon of the button to toggle the visibility of the password
29
+ */
9
30
  onVisibilityChange?: (visibility: boolean) => void;
10
31
  }
11
32
  //# sourceMappingURL=use-input-password.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-input-password.type.d.ts","sourceRoot":"","sources":["use-input-password.type.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAC/C,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD"}
1
+ {"version":3,"file":"use-input-password.type.d.ts","sourceRoot":"","sources":["use-input-password.type.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAC/C,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD"}
@@ -147,7 +147,7 @@ var useInput = function useInput(params) {
147
147
  return {
148
148
  focused: focused,
149
149
  disabled: disabled,
150
- showClear: showClearValue,
150
+ showClear: !disabled && showClearValue,
151
151
  getRootProps: getRootProps,
152
152
  getInputProps: getInputProps,
153
153
  getClearProps: getClearProps
@@ -3,20 +3,63 @@ import { AddNoProps } from '../../common/type';
3
3
  export interface InputPropsOwn {
4
4
  /**
5
5
  * The default value. Use when the component is not controlled.
6
+ * @en Value
7
+ * @cn 输入值
6
8
  */
7
9
  value?: string;
10
+ /**
11
+ * @en Value change callback
12
+ * @cn 值改变回调
13
+ */
8
14
  onChange?: (value: string) => void;
15
+ /**
16
+ * @en The callback of blur
17
+ * @cn 失去焦点后的回调
18
+ */
9
19
  onBlur?: React.FocusEventHandler;
20
+ /**
21
+ * @en The callback when Textarea focus
22
+ * @cn 聚焦后的回调
23
+ */
10
24
  onFocus?: React.FocusEventHandler;
25
+ /**
26
+ * @en Click callback
27
+ * @cn 点击回调
28
+ */
11
29
  onClick?: React.MouseEventHandler;
30
+ /**
31
+ * @en Disable component
32
+ * @cn 禁用组件
33
+ * @default false
34
+ */
12
35
  disabled?: boolean;
36
+ /**
37
+ * @en Can click the clear icon to delete the content of the input box
38
+ * @cn 可点击清空图标删除输入框内容
39
+ * @default false
40
+ */
13
41
  clearable?: boolean;
14
42
  /**
15
43
  * focus后自动全选数据
44
+ * @en Automatically select all data after mouse click
45
+ * @cn 是否自动获得焦点
46
+ * @default false
16
47
  */
17
48
  autoSelect?: boolean;
49
+ /**
50
+ * @en Get input dom
51
+ * @cn 获取input dom
52
+ */
18
53
  inputRef?: React.Ref<HTMLInputElement>;
54
+ /**
55
+ * @en Get root node dom
56
+ * @cn 获取root节点 dom
57
+ */
19
58
  rootRef?: React.Ref<HTMLElement>;
59
+ /**
60
+ * @en Click to clear callback
61
+ * @cn 点击清空回调
62
+ */
20
63
  onClear?: () => void;
21
64
  showClear?: boolean;
22
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-input.type.d.ts","sourceRoot":"","sources":["use-input.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cACf,SAAQ,aAAa,EACnB,IAAI,CACF,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAC3C,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAA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C,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACjC,KAAK,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF,oBAAY,iBAAiB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,IAAI,CACpE,MAAM,EACN,MAAM,oBAAoB,CAC3B,GACC,oBAAoB,CAAC;AAEvB,oBAAY,qBAAqB,GAAG;IAClC,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC;CACtC,CAAC;AAEF,oBAAY,kBAAkB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,UAAU,CAC3E,qBAAqB,EACrB,MAAM,CACP,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { default, default as useSelect } from './use-select';
2
+ export { default as useGroup } from './use-select-group';
2
3
  export type { BaseSelectProps } from './use-select.type';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -10,10 +10,17 @@ Object.defineProperty(exports, "default", {
10
10
  return _useSelect.default;
11
11
  }
12
12
  });
13
+ Object.defineProperty(exports, "useGroup", {
14
+ enumerable: true,
15
+ get: function get() {
16
+ return _useSelectGroup.default;
17
+ }
18
+ });
13
19
  Object.defineProperty(exports, "useSelect", {
14
20
  enumerable: true,
15
21
  get: function get() {
16
22
  return _useSelect.default;
17
23
  }
18
24
  });
19
- var _useSelect = _interopRequireDefault(require("./use-select"));
25
+ var _useSelect = _interopRequireDefault(require("./use-select"));
26
+ var _useSelectGroup = _interopRequireDefault(require("./use-select-group"));
@@ -0,0 +1,7 @@
1
+ import { UseSelectGroupProps } from './use-select-group.type';
2
+ declare const UseSelectGroup: <DataItem>(props: UseSelectGroupProps<DataItem>) => {
3
+ data: DataItem[];
4
+ groupKey: string;
5
+ };
6
+ export default UseSelectGroup;
7
+ //# sourceMappingURL=use-select-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-select-group.d.ts","sourceRoot":"","sources":["use-select-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,QAAA,MAAM,cAAc;;;CAoCnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ require("core-js/modules/web.dom-collections.for-each.js");
9
+ require("core-js/modules/es.array.reduce.js");
10
+ require("core-js/modules/es.array.concat.js");
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+ var _react = require("react");
14
+ var _utils = require("../../utils");
15
+ var UseSelectGroup = function UseSelectGroup(props) {
16
+ var _props$data = props.data,
17
+ dataProp = _props$data === void 0 ? [] : _props$data,
18
+ groupBy = props.groupBy;
19
+ var _useState = (0, _react.useState)([]),
20
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
21
+ data = _useState2[0],
22
+ setData = _useState2[1];
23
+ var groupKey = (0, _react.useRef)('');
24
+ var initGroupData = function initGroupData() {
25
+ if (typeof groupBy !== 'function') {
26
+ setData(dataProp);
27
+ return;
28
+ }
29
+ var groupData = {};
30
+ dataProp.forEach(function (item, index) {
31
+ var group = groupBy(item, index, dataProp);
32
+ if (!groupData[group]) groupData[group || ''] = group ? [(0, _defineProperty2.default)({}, groupKey.current, group)] : [];
33
+ groupData[group].push(item);
34
+ });
35
+ var newData = Object.keys(groupData).reduce(function (p, v) {
36
+ return v ? p.concat(groupData[v]) : groupData[v].concat(p);
37
+ }, []);
38
+ setData(newData);
39
+ };
40
+ (0, _react.useEffect)(function () {
41
+ if (!groupBy) return;
42
+ groupKey.current = (0, _utils.getUidStr)();
43
+ initGroupData();
44
+ }, [dataProp]);
45
+ return {
46
+ data: data,
47
+ groupKey: groupKey.current
48
+ };
49
+ };
50
+ var _default = UseSelectGroup;
51
+ exports.default = _default;
@@ -0,0 +1,5 @@
1
+ export interface UseSelectGroupProps<DataItem> {
2
+ data?: DataItem[];
3
+ groupBy?: (item: DataItem, index?: number, data?: DataItem[]) => string;
4
+ }
5
+ //# sourceMappingURL=use-select-group.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-select-group.type.d.ts","sourceRoot":"","sources":["use-select-group.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB,CAAC,QAAQ;IAC3C,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,MAAM,CAAC;CACzE"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });