tntd 2.6.8 → 2.6.10

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 (451) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -0
  3. package/es/actions/index.js +26 -0
  4. package/es/actions/index.js.map +1 -0
  5. package/es/actions/index.less +70 -0
  6. package/es/cascader/index.js +5 -1
  7. package/es/cascader/index.js.map +1 -1
  8. package/es/check-card/group.js +197 -0
  9. package/es/check-card/group.js.map +1 -0
  10. package/es/check-card/index.js +163 -0
  11. package/es/check-card/index.js.map +1 -0
  12. package/es/check-card/index.less +179 -0
  13. package/es/checkbox/checkbox-group.js +5 -0
  14. package/es/checkbox/checkbox-group.js.map +1 -0
  15. package/es/checkbox/index.js +5 -0
  16. package/es/checkbox/index.js.map +1 -1
  17. package/es/color-picker/ColorPicker.js +1 -1
  18. package/es/color-picker/ColorPicker.js.map +1 -1
  19. package/es/color-picker/index.less +1 -1
  20. package/es/config-provider/DisabledContext.js +12 -0
  21. package/es/config-provider/DisabledContext.js.map +1 -0
  22. package/es/config-provider/SizeContext.js +9 -0
  23. package/es/config-provider/SizeContext.js.map +1 -0
  24. package/es/config-provider/index.js +4 -0
  25. package/es/config-provider/index.js.map +1 -1
  26. package/es/connect/index.js +29 -0
  27. package/es/connect/index.js.map +1 -0
  28. package/es/date-picker/index.js +15 -1
  29. package/es/date-picker/index.js.map +1 -1
  30. package/es/ellipsis/index.js +1 -1
  31. package/es/ellipsis/index.js.map +1 -1
  32. package/es/ellipsis/index.less +1 -1
  33. package/es/handle/index.js +13 -5
  34. package/es/handle/index.js.map +1 -1
  35. package/es/handle/index.less +1 -1
  36. package/es/index.js +8 -1
  37. package/es/index.js.map +1 -1
  38. package/es/index.less +5 -0
  39. package/es/input/input.js +19 -10
  40. package/es/input/input.js.map +1 -1
  41. package/es/input-number/index.js +3 -1
  42. package/es/input-number/index.js.map +1 -1
  43. package/es/label/label.js +140 -0
  44. package/es/label/label.js.map +1 -0
  45. package/es/label/label.test.js +12 -0
  46. package/es/label/label.test.js.map +1 -0
  47. package/es/locale/en_US.js +4 -2
  48. package/es/locale/en_US.js.map +1 -1
  49. package/es/locale/zh_CN.js +4 -2
  50. package/es/locale/zh_CN.js.map +1 -1
  51. package/es/page/Box.js +1 -1
  52. package/es/page/Box.js.map +1 -1
  53. package/es/page/index.js +1 -1
  54. package/es/page/index.js.map +1 -1
  55. package/es/page/index.less +5 -5
  56. package/es/preview-text/index.js +265 -0
  57. package/es/preview-text/index.js.map +1 -0
  58. package/es/preview-text/index.less +3 -0
  59. package/es/query-form/Field/SelectInput.js +7 -5
  60. package/es/query-form/Field/SelectInput.js.map +1 -1
  61. package/es/radio/index.js +3 -0
  62. package/es/radio/index.js.map +1 -1
  63. package/es/radio/radio-group.js +5 -0
  64. package/es/radio/radio-group.js.map +1 -0
  65. package/es/segmented/index.js +67 -0
  66. package/es/segmented/index.js.map +1 -0
  67. package/es/segmented/index.less +138 -0
  68. package/es/select/index.js.map +1 -1
  69. package/es/select/select.js +25 -3
  70. package/es/select/select.js.map +1 -1
  71. package/es/switch/index.js +2 -3
  72. package/es/switch/index.js.map +1 -1
  73. package/es/switch/switch.js +10 -0
  74. package/es/switch/switch.js.map +1 -0
  75. package/es/table/table.js +10 -4
  76. package/es/table/table.js.map +1 -1
  77. package/es/table/total-shower.js +10 -0
  78. package/es/table/total-shower.js.map +1 -0
  79. package/es/time-picker/index.js +3 -1
  80. package/es/time-picker/index.js.map +1 -1
  81. package/es/title/index.js +9 -11
  82. package/es/title/index.js.map +1 -1
  83. package/es/title/index.less +10 -10
  84. package/es/tntd-form/ErrorList.js +87 -0
  85. package/es/tntd-form/ErrorList.js.map +1 -0
  86. package/es/tntd-form/Form.js +122 -0
  87. package/es/tntd-form/Form.js.map +1 -0
  88. package/es/tntd-form/FormItem/ItemHolder.js +144 -0
  89. package/es/tntd-form/FormItem/ItemHolder.js.map +1 -0
  90. package/es/tntd-form/FormItem/index.js +264 -0
  91. package/es/tntd-form/FormItem/index.js.map +1 -0
  92. package/es/tntd-form/FormItemInput.js +79 -0
  93. package/es/tntd-form/FormItemInput.js.map +1 -0
  94. package/es/tntd-form/FormItemLabel.js +98 -0
  95. package/es/tntd-form/FormItemLabel.js.map +1 -0
  96. package/es/tntd-form/FormList.js +40 -0
  97. package/es/tntd-form/FormList.js.map +1 -0
  98. package/es/tntd-form/_util/motion.js +47 -0
  99. package/es/tntd-form/_util/motion.js.map +1 -0
  100. package/es/tntd-form/_util/reactNode.js +16 -0
  101. package/es/tntd-form/_util/reactNode.js.map +1 -0
  102. package/es/tntd-form/_util/scrollTo.js +35 -0
  103. package/es/tntd-form/_util/scrollTo.js.map +1 -0
  104. package/es/tntd-form/_util/type.js +3 -0
  105. package/es/tntd-form/_util/type.js.map +1 -0
  106. package/es/tntd-form/_util/warning.js +5 -0
  107. package/es/tntd-form/_util/warning.js.map +1 -0
  108. package/es/tntd-form/_util/wave.js +168 -0
  109. package/es/tntd-form/_util/wave.js.map +1 -0
  110. package/es/tntd-form/context.js +40 -0
  111. package/es/tntd-form/context.js.map +1 -0
  112. package/es/tntd-form/hooks/useDebounce.js +13 -0
  113. package/es/tntd-form/hooks/useDebounce.js.map +1 -0
  114. package/es/tntd-form/hooks/useForm.js +40 -0
  115. package/es/tntd-form/hooks/useForm.js.map +1 -0
  116. package/es/tntd-form/hooks/useFormInstance.js +8 -0
  117. package/es/tntd-form/hooks/useFormInstance.js.map +1 -0
  118. package/es/tntd-form/hooks/useFormItemStatus.js +13 -0
  119. package/es/tntd-form/hooks/useFormItemStatus.js.map +1 -0
  120. package/es/tntd-form/hooks/useFrameState.js +37 -0
  121. package/es/tntd-form/hooks/useFrameState.js.map +1 -0
  122. package/es/tntd-form/hooks/useItemRef.js +20 -0
  123. package/es/tntd-form/hooks/useItemRef.js.map +1 -0
  124. package/es/tntd-form/index.js +17 -1
  125. package/es/tntd-form/index.js.map +1 -1
  126. package/es/tntd-form/interface.js +2 -0
  127. package/es/tntd-form/interface.js.map +1 -0
  128. package/es/tntd-form/style/components.less +16 -0
  129. package/es/tntd-form/style/horizontal.less +26 -0
  130. package/es/tntd-form/style/index.js +5 -0
  131. package/es/tntd-form/style/index.js.map +1 -0
  132. package/es/tntd-form/style/index.less +342 -0
  133. package/es/tntd-form/style/inline.less +40 -0
  134. package/es/tntd-form/style/mixin.less +90 -0
  135. package/es/tntd-form/style/rtl.less +204 -0
  136. package/es/tntd-form/style/status.less +45 -0
  137. package/es/tntd-form/style/vertical.less +95 -0
  138. package/es/tntd-form/tntd-form.stories.js +786 -0
  139. package/es/tntd-form/tntd-form.stories.js.map +1 -0
  140. package/es/tntd-form/util.js +18 -0
  141. package/es/tntd-form/util.js.map +1 -0
  142. package/es/tntd-form/validateMessagesContext.js +5 -0
  143. package/es/tntd-form/validateMessagesContext.js.map +1 -0
  144. package/es/tntd-modal/index.js +71 -56
  145. package/es/tntd-modal/index.js.map +1 -1
  146. package/es/tntd-modal/index.less +83 -63
  147. package/es/tree-select/index.js +4 -1
  148. package/es/tree-select/index.js.map +1 -1
  149. package/es/upload/index.js +8 -1
  150. package/es/upload/index.js.map +1 -1
  151. package/es/utils/index.js +1 -0
  152. package/es/utils/index.js.map +1 -1
  153. package/es/utils/simple-template.js +10 -0
  154. package/es/utils/simple-template.js.map +1 -0
  155. package/es/water-mark/index.js +110 -0
  156. package/es/water-mark/index.js.map +1 -0
  157. package/lib/actions/index.d.ts +15 -0
  158. package/lib/actions/index.d.ts.map +1 -0
  159. package/lib/actions/index.js +34 -0
  160. package/lib/actions/index.js.map +1 -0
  161. package/lib/actions/index.less +70 -0
  162. package/lib/cascader/index.d.ts +6 -1
  163. package/lib/cascader/index.d.ts.map +1 -1
  164. package/lib/cascader/index.js +10 -3
  165. package/lib/cascader/index.js.map +1 -1
  166. package/lib/check-card/group.d.ts +130 -0
  167. package/lib/check-card/group.d.ts.map +1 -0
  168. package/lib/check-card/group.js +236 -0
  169. package/lib/check-card/group.js.map +1 -0
  170. package/lib/check-card/index.d.ts +136 -0
  171. package/lib/check-card/index.d.ts.map +1 -0
  172. package/lib/check-card/index.js +178 -0
  173. package/lib/check-card/index.js.map +1 -0
  174. package/lib/check-card/index.less +179 -0
  175. package/lib/checkbox/checkbox-group.d.ts +8 -0
  176. package/lib/checkbox/checkbox-group.d.ts.map +1 -0
  177. package/lib/checkbox/checkbox-group.js +13 -0
  178. package/lib/checkbox/checkbox-group.js.map +1 -0
  179. package/lib/checkbox/index.d.ts +1 -0
  180. package/lib/checkbox/index.d.ts.map +1 -1
  181. package/lib/checkbox/index.js +16 -0
  182. package/lib/checkbox/index.js.map +1 -1
  183. package/lib/color-picker/ColorPicker.js +1 -1
  184. package/lib/color-picker/ColorPicker.js.map +1 -1
  185. package/lib/color-picker/index.less +1 -1
  186. package/lib/config-provider/DisabledContext.d.ts +10 -0
  187. package/lib/config-provider/DisabledContext.d.ts.map +1 -0
  188. package/lib/config-provider/DisabledContext.js +22 -0
  189. package/lib/config-provider/DisabledContext.js.map +1 -0
  190. package/lib/config-provider/SizeContext.d.ts +10 -0
  191. package/lib/config-provider/SizeContext.d.ts.map +1 -0
  192. package/lib/config-provider/SizeContext.js +23 -0
  193. package/lib/config-provider/SizeContext.js.map +1 -0
  194. package/lib/config-provider/index.d.ts +1 -0
  195. package/lib/config-provider/index.d.ts.map +1 -1
  196. package/lib/config-provider/index.js +15 -0
  197. package/lib/config-provider/index.js.map +1 -1
  198. package/lib/connect/index.d.ts +12 -0
  199. package/lib/connect/index.d.ts.map +1 -0
  200. package/lib/connect/index.js +50 -0
  201. package/lib/connect/index.js.map +1 -0
  202. package/lib/date-picker/index.d.ts +6 -1
  203. package/lib/date-picker/index.d.ts.map +1 -1
  204. package/lib/date-picker/index.js +29 -3
  205. package/lib/date-picker/index.js.map +1 -1
  206. package/lib/ellipsis/index.js +1 -1
  207. package/lib/ellipsis/index.js.map +1 -1
  208. package/lib/ellipsis/index.less +1 -1
  209. package/lib/handle/index.d.ts.map +1 -1
  210. package/lib/handle/index.js +13 -4
  211. package/lib/handle/index.js.map +1 -1
  212. package/lib/handle/index.less +1 -1
  213. package/lib/index.d.ts +7 -0
  214. package/lib/index.d.ts.map +1 -1
  215. package/lib/index.js +22 -0
  216. package/lib/index.js.map +1 -1
  217. package/lib/index.less +5 -0
  218. package/lib/input/input.d.ts +5 -0
  219. package/lib/input/input.d.ts.map +1 -1
  220. package/lib/input/input.js +18 -8
  221. package/lib/input/input.js.map +1 -1
  222. package/lib/input-number/index.d.ts +7 -2
  223. package/lib/input-number/index.d.ts.map +1 -1
  224. package/lib/input-number/index.js +4 -1
  225. package/lib/input-number/index.js.map +1 -1
  226. package/lib/label/label.d.ts +52 -0
  227. package/lib/label/label.d.ts.map +1 -0
  228. package/lib/label/label.js +150 -0
  229. package/lib/label/label.js.map +1 -0
  230. package/lib/label/label.test.d.ts +2 -0
  231. package/lib/label/label.test.d.ts.map +1 -0
  232. package/lib/label/label.test.js +14 -0
  233. package/lib/label/label.test.js.map +1 -0
  234. package/lib/locale/default.d.ts +1 -0
  235. package/lib/locale/default.d.ts.map +1 -1
  236. package/lib/locale/en_US.d.ts +1 -0
  237. package/lib/locale/en_US.d.ts.map +1 -1
  238. package/lib/locale/en_US.js +4 -2
  239. package/lib/locale/en_US.js.map +1 -1
  240. package/lib/locale/zh_CN.d.ts +1 -0
  241. package/lib/locale/zh_CN.d.ts.map +1 -1
  242. package/lib/locale/zh_CN.js +4 -2
  243. package/lib/locale/zh_CN.js.map +1 -1
  244. package/lib/page/Box.js +1 -1
  245. package/lib/page/Box.js.map +1 -1
  246. package/lib/page/index.js +1 -1
  247. package/lib/page/index.js.map +1 -1
  248. package/lib/page/index.less +5 -5
  249. package/lib/preview-text/index.d.ts +20 -0
  250. package/lib/preview-text/index.d.ts.map +1 -0
  251. package/lib/preview-text/index.js +278 -0
  252. package/lib/preview-text/index.js.map +1 -0
  253. package/lib/preview-text/index.less +3 -0
  254. package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
  255. package/lib/query-form/Field/SelectInput.js +6 -4
  256. package/lib/query-form/Field/SelectInput.js.map +1 -1
  257. package/lib/radio/index.d.ts.map +1 -1
  258. package/lib/radio/index.js +4 -0
  259. package/lib/radio/index.js.map +1 -1
  260. package/lib/radio/radio-group.d.ts +8 -0
  261. package/lib/radio/radio-group.d.ts.map +1 -0
  262. package/lib/radio/radio-group.js +13 -0
  263. package/lib/radio/radio-group.js.map +1 -0
  264. package/lib/segmented/index.d.ts +23 -0
  265. package/lib/segmented/index.d.ts.map +1 -0
  266. package/lib/segmented/index.js +80 -0
  267. package/lib/segmented/index.js.map +1 -0
  268. package/lib/segmented/index.less +138 -0
  269. package/lib/select/index.d.ts +2 -1
  270. package/lib/select/index.d.ts.map +1 -1
  271. package/lib/select/index.js.map +1 -1
  272. package/lib/select/select.d.ts +12 -0
  273. package/lib/select/select.d.ts.map +1 -1
  274. package/lib/select/select.js +25 -4
  275. package/lib/select/select.js.map +1 -1
  276. package/lib/svg-components/illustration-403.d.ts +1 -1
  277. package/lib/svg-components/illustration-404.d.ts +1 -1
  278. package/lib/svg-components/illustration-500.d.ts +1 -1
  279. package/lib/svg-components/illustration-empty.d.ts +1 -1
  280. package/lib/svg-components/illustration-failure.d.ts +1 -1
  281. package/lib/svg-components/illustration-no-access.d.ts +1 -1
  282. package/lib/svg-components/illustration-no-chart.d.ts +1 -1
  283. package/lib/svg-components/illustration-no-result.d.ts +1 -1
  284. package/lib/svg-components/illustration-offline.d.ts +1 -1
  285. package/lib/svg-components/illustration-success.d.ts +1 -1
  286. package/lib/switch/index.d.ts +2 -3
  287. package/lib/switch/index.d.ts.map +1 -1
  288. package/lib/switch/index.js +1 -2
  289. package/lib/switch/index.js.map +1 -1
  290. package/lib/switch/switch.d.ts +10 -0
  291. package/lib/switch/switch.d.ts.map +1 -0
  292. package/lib/switch/switch.js +37 -0
  293. package/lib/switch/switch.js.map +1 -0
  294. package/lib/table/assets/image-loading-background.d.ts +1 -1
  295. package/lib/table/assets/image-loading.d.ts +1 -1
  296. package/lib/table/table.d.ts.map +1 -1
  297. package/lib/table/table.js +14 -7
  298. package/lib/table/table.js.map +1 -1
  299. package/lib/table/total-shower.d.ts +9 -0
  300. package/lib/table/total-shower.d.ts.map +1 -0
  301. package/lib/table/total-shower.js +17 -0
  302. package/lib/table/total-shower.js.map +1 -0
  303. package/lib/time-picker/index.d.ts +7 -2
  304. package/lib/time-picker/index.d.ts.map +1 -1
  305. package/lib/time-picker/index.js +3 -1
  306. package/lib/time-picker/index.js.map +1 -1
  307. package/lib/title/index.d.ts +11 -1
  308. package/lib/title/index.d.ts.map +1 -1
  309. package/lib/title/index.js +8 -10
  310. package/lib/title/index.js.map +1 -1
  311. package/lib/title/index.less +10 -10
  312. package/lib/tntd-cascader/AntdCascader/config/utils.d.ts +1 -1
  313. package/lib/tntd-form/ErrorList.d.ts +13 -0
  314. package/lib/tntd-form/ErrorList.d.ts.map +1 -0
  315. package/lib/tntd-form/ErrorList.js +104 -0
  316. package/lib/tntd-form/ErrorList.js.map +1 -0
  317. package/lib/tntd-form/Form.d.ts +36 -0
  318. package/lib/tntd-form/Form.d.ts.map +1 -0
  319. package/lib/tntd-form/Form.js +160 -0
  320. package/lib/tntd-form/Form.js.map +1 -0
  321. package/lib/tntd-form/FormItem/ItemHolder.d.ts +18 -0
  322. package/lib/tntd-form/FormItem/ItemHolder.d.ts.map +1 -0
  323. package/lib/tntd-form/FormItem/ItemHolder.js +163 -0
  324. package/lib/tntd-form/FormItem/ItemHolder.js.map +1 -0
  325. package/lib/tntd-form/FormItem/index.d.ts +36 -0
  326. package/lib/tntd-form/FormItem/index.d.ts.map +1 -0
  327. package/lib/tntd-form/FormItem/index.js +301 -0
  328. package/lib/tntd-form/FormItem/index.js.map +1 -0
  329. package/lib/tntd-form/FormItemInput.d.ts +30 -0
  330. package/lib/tntd-form/FormItemInput.d.ts.map +1 -0
  331. package/lib/tntd-form/FormItemInput.js +92 -0
  332. package/lib/tntd-form/FormItemInput.js.map +1 -0
  333. package/lib/tntd-form/FormItemLabel.d.ts +24 -0
  334. package/lib/tntd-form/FormItemLabel.d.ts.map +1 -0
  335. package/lib/tntd-form/FormItemLabel.js +106 -0
  336. package/lib/tntd-form/FormItemLabel.js.map +1 -0
  337. package/lib/tntd-form/FormList.d.ts +26 -0
  338. package/lib/tntd-form/FormList.d.ts.map +1 -0
  339. package/lib/tntd-form/FormList.js +56 -0
  340. package/lib/tntd-form/FormList.js.map +1 -0
  341. package/lib/tntd-form/_util/motion.d.ts +9 -0
  342. package/lib/tntd-form/_util/motion.d.ts.map +1 -0
  343. package/lib/tntd-form/_util/motion.js +59 -0
  344. package/lib/tntd-form/_util/motion.js.map +1 -0
  345. package/lib/tntd-form/_util/reactNode.d.ts +9 -0
  346. package/lib/tntd-form/_util/reactNode.d.ts.map +1 -0
  347. package/lib/tntd-form/_util/reactNode.js +27 -0
  348. package/lib/tntd-form/_util/reactNode.js.map +1 -0
  349. package/lib/tntd-form/_util/scrollTo.d.ts +1 -0
  350. package/lib/tntd-form/_util/scrollTo.d.ts.map +1 -0
  351. package/lib/tntd-form/_util/scrollTo.js +35 -0
  352. package/lib/tntd-form/_util/scrollTo.js.map +1 -0
  353. package/lib/tntd-form/_util/type.d.ts +4 -0
  354. package/lib/tntd-form/_util/type.d.ts.map +1 -0
  355. package/lib/tntd-form/_util/type.js +21 -0
  356. package/lib/tntd-form/_util/type.js.map +1 -0
  357. package/lib/tntd-form/_util/warning.d.ts +5 -0
  358. package/lib/tntd-form/_util/warning.d.ts.map +1 -0
  359. package/lib/tntd-form/_util/warning.js +20 -0
  360. package/lib/tntd-form/_util/warning.js.map +1 -0
  361. package/lib/tntd-form/_util/wave.d.ts +1 -0
  362. package/lib/tntd-form/_util/wave.d.ts.map +1 -0
  363. package/lib/tntd-form/_util/wave.js +168 -0
  364. package/lib/tntd-form/_util/wave.js.map +1 -0
  365. package/lib/tntd-form/context.d.ts +51 -0
  366. package/lib/tntd-form/context.d.ts.map +1 -0
  367. package/lib/tntd-form/context.js +54 -0
  368. package/lib/tntd-form/context.js.map +1 -0
  369. package/lib/tntd-form/hooks/useDebounce.d.ts +2 -0
  370. package/lib/tntd-form/hooks/useDebounce.d.ts.map +1 -0
  371. package/lib/tntd-form/hooks/useDebounce.js +31 -0
  372. package/lib/tntd-form/hooks/useDebounce.js.map +1 -0
  373. package/lib/tntd-form/hooks/useForm.d.ts +16 -0
  374. package/lib/tntd-form/hooks/useForm.d.ts.map +1 -0
  375. package/lib/tntd-form/hooks/useForm.js +63 -0
  376. package/lib/tntd-form/hooks/useForm.js.map +1 -0
  377. package/lib/tntd-form/hooks/useFormInstance.d.ts +3 -0
  378. package/lib/tntd-form/hooks/useFormInstance.d.ts.map +1 -0
  379. package/lib/tntd-form/hooks/useFormInstance.js +13 -0
  380. package/lib/tntd-form/hooks/useFormInstance.js.map +1 -0
  381. package/lib/tntd-form/hooks/useFormItemStatus.d.ts +7 -0
  382. package/lib/tntd-form/hooks/useFormItemStatus.d.ts.map +1 -0
  383. package/lib/tntd-form/hooks/useFormItemStatus.js +20 -0
  384. package/lib/tntd-form/hooks/useFormItemStatus.js.map +1 -0
  385. package/lib/tntd-form/hooks/useFrameState.d.ts +4 -0
  386. package/lib/tntd-form/hooks/useFrameState.d.ts.map +1 -0
  387. package/lib/tntd-form/hooks/useFrameState.js +55 -0
  388. package/lib/tntd-form/hooks/useFrameState.js.map +1 -0
  389. package/lib/tntd-form/hooks/useItemRef.d.ts +4 -0
  390. package/lib/tntd-form/hooks/useItemRef.d.ts.map +1 -0
  391. package/lib/tntd-form/hooks/useItemRef.js +28 -0
  392. package/lib/tntd-form/hooks/useItemRef.js.map +1 -0
  393. package/lib/tntd-form/index.d.ts +23 -1
  394. package/lib/tntd-form/index.d.ts.map +1 -1
  395. package/lib/tntd-form/index.js +24 -8
  396. package/lib/tntd-form/index.js.map +1 -1
  397. package/lib/tntd-form/interface.d.ts +4 -0
  398. package/lib/tntd-form/interface.d.ts.map +1 -0
  399. package/lib/tntd-form/interface.js +7 -0
  400. package/lib/tntd-form/interface.js.map +1 -0
  401. package/lib/tntd-form/style/components.less +16 -0
  402. package/lib/tntd-form/style/horizontal.less +26 -0
  403. package/lib/tntd-form/style/index.d.ts +5 -0
  404. package/lib/tntd-form/style/index.d.ts.map +1 -0
  405. package/lib/tntd-form/style/index.js +6 -0
  406. package/lib/tntd-form/style/index.js.map +1 -0
  407. package/lib/tntd-form/style/index.less +342 -0
  408. package/lib/tntd-form/style/inline.less +40 -0
  409. package/lib/tntd-form/style/mixin.less +90 -0
  410. package/lib/tntd-form/style/rtl.less +204 -0
  411. package/lib/tntd-form/style/status.less +45 -0
  412. package/lib/tntd-form/style/vertical.less +95 -0
  413. package/lib/tntd-form/tntd-form.stories.d.ts +33 -0
  414. package/lib/tntd-form/tntd-form.stories.d.ts.map +1 -0
  415. package/lib/tntd-form/tntd-form.stories.js +888 -0
  416. package/lib/tntd-form/tntd-form.stories.js.map +1 -0
  417. package/lib/tntd-form/util.d.ts +4 -0
  418. package/lib/tntd-form/util.d.ts.map +1 -0
  419. package/lib/tntd-form/util.js +25 -0
  420. package/lib/tntd-form/util.js.map +1 -0
  421. package/lib/tntd-form/validateMessagesContext.d.ts +5 -0
  422. package/lib/tntd-form/validateMessagesContext.d.ts.map +1 -0
  423. package/lib/tntd-form/validateMessagesContext.js +12 -0
  424. package/lib/tntd-form/validateMessagesContext.js.map +1 -0
  425. package/lib/tntd-modal/index.d.ts +15 -2
  426. package/lib/tntd-modal/index.d.ts.map +1 -1
  427. package/lib/tntd-modal/index.js +76 -61
  428. package/lib/tntd-modal/index.js.map +1 -1
  429. package/lib/tntd-modal/index.less +83 -63
  430. package/lib/tree-select/index.d.ts +7 -1
  431. package/lib/tree-select/index.d.ts.map +1 -1
  432. package/lib/tree-select/index.js +9 -3
  433. package/lib/tree-select/index.js.map +1 -1
  434. package/lib/upload/index.d.ts +6 -1
  435. package/lib/upload/index.d.ts.map +1 -1
  436. package/lib/upload/index.js +11 -1
  437. package/lib/upload/index.js.map +1 -1
  438. package/lib/utils/index.d.ts +1 -0
  439. package/lib/utils/index.d.ts.map +1 -1
  440. package/lib/utils/index.js +12 -0
  441. package/lib/utils/index.js.map +1 -1
  442. package/lib/utils/simple-template.d.ts +9 -0
  443. package/lib/utils/simple-template.d.ts.map +1 -0
  444. package/lib/utils/simple-template.js +19 -0
  445. package/lib/utils/simple-template.js.map +1 -0
  446. package/lib/water-mark/index.d.ts +49 -0
  447. package/lib/water-mark/index.d.ts.map +1 -0
  448. package/lib/water-mark/index.js +142 -0
  449. package/lib/water-mark/index.js.map +1 -0
  450. package/package.json +26 -5
  451. package/themes/default/variables.less +43 -0
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAa,UAAU,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,UAAU,MAAM,YAAY,CAAA;AAcnC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,EAAoC,EAAE,GAAG,EAAE,EAAE;QAA7C,EAAE,SAAS,EAAE,WAAW,OAAY,EAAP,KAAK,cAAlC,4BAAoC,CAAF;IAAY,OAAA,CAC7C,oBAAC,cAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;QAExC,OAAO,CACL,oBAAC,UAAU,oBACL,KAAK,IACT,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE;gBAC/B,CAAC,GAAG,SAAS,UAAU,CAAC,EAAE,WAAW,KAAK,SAAS;aACpD,CAAC,EACF,GAAG,EAAE,GAAG,IACR,CACH,CAAA;IACH,CAAC,CACc,CAClB,CAAA;CAAA,CACiB,CAAA;AAEpB,MAAM,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAA;AACrC,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAA","sourcesContent":["import React, { ReactNode, forwardRef } from 'react'\nimport { default as AntdSelect } from 'antd/es/select'\nimport { ConfigConsumer } from 'antd/es/config-provider'\nimport type { SelectProps as AntdSelectProps } from 'antd/es/select'\nimport classNames from 'classnames'\n\nexport interface SelectProps extends AntdSelectProps {\n // 线框风格\n borderStyle?: 'outline'\n children?: ReactNode\n}\n\ninterface SelectComponent\n extends React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<AntdSelect>> {\n OptGroup: typeof AntdSelect.OptGroup\n Option: typeof AntdSelect.Option\n}\n\nexport const Select = forwardRef<AntdSelect, SelectProps>(\n ({ className, borderStyle, ...props }, ref) => (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('select')\n\n return (\n <AntdSelect\n {...props}\n className={classNames(className, {\n [`${prefixCls}-outline`]: borderStyle === 'outline',\n })}\n ref={ref}\n />\n )\n }}\n </ConfigConsumer>\n )\n) as SelectComponent\n\nSelect.OptGroup = AntdSelect.OptGroup\nSelect.Option = AntdSelect.Option\n"]}
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAa,UAAU,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,WAAW,MAAM,iBAAiB,CAAA;AA6BzC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,C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K,CACd,CAAA;IACH,CAAC,CACc,CAClB,CAAA;CAAA,CACiB,CAAA;AAEpB,MAAM,CAAC,MAAM,MAAM,GAAG,wBAAwB,CAC5C,cAAc,EACd,WAAW,CAAC,MAAM,CACA,CAAA;AAEpB,MAAM,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAA;AACrC,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAA","sourcesContent":["import React, { ReactNode, forwardRef } from 'react'\nimport { default as AntdSelect } from 'antd/es/select'\nimport { ConfigConsumer } from 'antd/es/config-provider'\nimport type { SelectProps as AntdSelectProps } from 'antd/es/select'\nimport classNames from 'classnames'\nimport { get } from 'lodash'\nimport { connectReadonlyComponent } from '../connect'\nimport PreviewText from '../preview-text'\n\nexport interface SelectProps extends AntdSelectProps {\n // 线框风格\n borderStyle?: 'outline'\n children?: ReactNode\n options?: Array<\n | string\n | number\n | {\n label: string\n value: string | number\n disabled?: boolean\n }\n >\n fieldNames?: {\n label?: string\n value?: string\n options?: string\n }\n readonly?: boolean\n}\n\ninterface SelectComponent\n extends React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<AntdSelect>> {\n OptGroup: typeof AntdSelect.OptGroup\n Option: typeof AntdSelect.Option\n}\n\nconst { Option } = AntdSelect\n\nexport const InternalSelect = forwardRef<AntdSelect, SelectProps>(\n ({ className, borderStyle, options, fieldNames, children, ...props }, ref) => (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('select')\n\n return (\n <AntdSelect\n {...props}\n className={classNames(className, {\n [`${prefixCls}-outline`]: borderStyle === 'outline',\n })}\n ref={ref}\n >\n {children\n ? children\n : options?.map((option) => {\n if (typeof option === 'object') {\n return (\n <Option\n key={get(option, fieldNames?.value || 'value')}\n value={get(option, fieldNames?.value || 'value')}\n disabled={!!option.disabled}\n >\n {get(option, fieldNames?.label || 'label')}\n </Option>\n )\n }\n\n return (\n <Option key={option} value={option}>\n {option}\n </Option>\n )\n })}\n </AntdSelect>\n )\n }}\n </ConfigConsumer>\n )\n) as SelectComponent\n\nexport const Select = connectReadonlyComponent(\n InternalSelect,\n PreviewText.Select\n) as SelectComponent\n\nSelect.OptGroup = AntdSelect.OptGroup\nSelect.Option = AntdSelect.Option\n"]}
@@ -1,4 +1,3 @@
1
- import Switch from 'antd/es/switch';
2
- import 'antd/es/switch/style';
3
- export * from 'antd/es/switch';
1
+ import Switch from './switch';
2
+ export * from './switch';
4
3
  export default Switch;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,gBAAgB,CAAA;AAEnC,OAAO,sBAAsB,CAAA;AAE7B,cAAc,gBAAgB,CAAA;AAE9B,eAAe,MAAM,CAAA","sourcesContent":["import Switch from 'antd/es/switch'\n\nimport 'antd/es/switch/style'\n\nexport * from 'antd/es/switch'\n\nexport default Switch\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAA;AAE7B,cAAc,UAAU,CAAA;AAExB,eAAe,MAAM,CAAA","sourcesContent":["import Switch from './switch'\n\nexport * from './switch'\n\nexport default Switch\n"]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import AntdSwitch from 'antd/es/switch';
3
+ import { connectReadonlyComponent } from '../connect';
4
+ import 'antd/es/switch/style';
5
+ export * from 'antd/es/switch';
6
+ export const Switch = connectReadonlyComponent(AntdSwitch, props => React.createElement(AntdSwitch, Object.assign({}, props, {
7
+ disabled: true
8
+ })));
9
+ Switch.displayName = 'Switch';
10
+ export default Switch;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/switch/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,UAAU,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAErD,OAAO,sBAAsB,CAAA;AAE7B,cAAc,gBAAgB,CAAA;AAM9B,MAAM,CAAC,MAAM,MAAM,GAAG,wBAAwB,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CACpE,oBAAC,UAAU,oBAAK,KAAK,IAAE,QAAQ,UAAG,CACnC,CAAC,CAAA;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;AAE7B,eAAe,MAAM,CAAA","sourcesContent":["import React, { forwardRef } from 'react'\nimport AntdSwitch from 'antd/es/switch'\nimport type { SwitchProps as AntdSwitchProps } from 'antd/es/switch'\nimport { connectReadonlyComponent } from '../connect'\n\nimport 'antd/es/switch/style'\n\nexport * from 'antd/es/switch'\n\nexport type SwitchProps = AntdSwitchProps & {\n readonly?: boolean\n}\n\nexport const Switch = connectReadonlyComponent(AntdSwitch, (props) => (\n <AntdSwitch {...props} disabled />\n))\n\nSwitch.displayName = 'Switch'\n\nexport default Switch\n"]}
package/es/table/table.js CHANGED
@@ -16,6 +16,13 @@ import React, { useMemo, useRef } from 'react';
16
16
  import { TableContext } from './context';
17
17
  import { useColumnSetting } from './hooks';
18
18
  import { normalizeColumns } from './utils';
19
+ import { TotalShower } from './total-shower';
20
+ const getDefaultPagination = locale => ({
21
+ showTotal: total => React.createElement(TotalShower, {
22
+ total: total,
23
+ locale: locale
24
+ })
25
+ });
19
26
  export const Table = _a => {
20
27
  var {
21
28
  className,
@@ -28,9 +35,7 @@ export const Table = _a => {
28
35
  shadowed = !bordered,
29
36
  striped = false,
30
37
  showCellBorders = false,
31
- pagination = {
32
- showTotal: total => `共 ${total} 条记录`
33
- },
38
+ pagination,
34
39
  enableToolbar = false,
35
40
  refresh
36
41
  } = _a,
@@ -70,6 +75,7 @@ export const Table = _a => {
70
75
  defaultLocale: locale
71
76
  }, localeObject => {
72
77
  const locale = localeObject;
78
+ const paginationConfig = pagination || getDefaultPagination(locale);
73
79
  return React.createElement(AntdTable, Object.assign({
74
80
  className: classNames(prefixCls, {
75
81
  [`${prefixCls}-borderless`]: !bordered,
@@ -84,7 +90,7 @@ export const Table = _a => {
84
90
  bordered: bordered,
85
91
  size: size,
86
92
  columns: displayColumns,
87
- pagination: pagination
93
+ pagination: paginationConfig
88
94
  }, rest));
89
95
  }));
90
96
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/table/table.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,cAAc,MAAM,wCAAwC,CAAA;AAEnE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,MAAM,MAAM,sBAAsB,CAAA;AACzC,OAAO,WAAW,MAAM,2BAA2B,CAAA;AACnD,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAe1C,MAAM,CAAC,MAAM,KAAK,GAAG,CAAK,EAiBV,EAAE,EAAE;QAjBM,EACxB,SAAS,EACT,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,GAAG,CAAC,QAAQ,EACpB,OAAO,GAAG,KAAK,EACf,eAAe,GAAG,KAAK,EACvB,UAAU,GAAG;QACX,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM;KACvC,EACD,aAAa,GAAG,KAAK,EACrB,OAAO,OAEO,EADX,IAAI,cAhBiB,oKAiBzB,CADQ;IAEP,MAAM,cAAc,GAAG,MAAM,CAAiB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,GAAG,SAAS,UAAU,CAAC,EAAE,OAAO;4BACjC,CAAC,GAAG,SAAS,WAAW,CAAC,EAAE,QAAQ;yBACpC,EACD,SAAS,CACV,EACD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,UAAU,IAClB,IAAI,EACR,CACH,CAAA;gBACH,CAAC,CACc,CACb,CACP,CAAA;QACH,CAAC,CACc,CACK,CACzB,CAAA;AACH,CAAC,CAAA;AAED,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;AACrB,KAAK,CAAC,WAAW,GAAG,WAAW,CAAA;AAC/B,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA","sourcesContent":["import { ConfigConsumer } from 'antd/es/config-provider'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport type { TableProps as AntdTableProps } from 'antd/es/table'\nimport { default as AntdTable } from 'antd/es/table'\nimport Column from 'antd/es/table/Column'\nimport ColumnGroup from 'antd/es/table/ColumnGroup'\nimport classNames from 'classnames'\nimport React, { useMemo, useRef } from 'react'\n\nimport { TableContext } from './context'\nimport { useColumnSetting } from './hooks'\nimport { normalizeColumns } from './utils'\n\nexport type TableProps<T> = Omit<AntdTableProps<T>, 'locale'> & {\n storageKey?: string\n enableToolbar?: boolean\n showCellBorders?: boolean\n striped?: boolean\n shadowed?: boolean\n locale?: AntdTableProps<T>['locale'] & {\n loadingDescription?: string\n emptyText?: string\n }\n refresh?(): void\n}\n\nexport const Table = <T,>({\n className,\n locale,\n bordered,\n size,\n storageKey,\n columns,\n children,\n shadowed = !bordered,\n striped = false,\n showCellBorders = false,\n pagination = {\n showTotal: (total) => `共 ${total} 条记录`,\n },\n enableToolbar = false,\n refresh,\n ...rest\n}: TableProps<T>) => {\n const tableContainer = useRef<HTMLDivElement>(null)\n // const [innerSize, setInnerSize] = useLocalStorage<TableProps<T>['size']>(\n // TABLE_SIZE_STORAGE_KEY,\n // 'default'\n // )\n const normalizedColumns = useMemo(\n () => columns || normalizeColumns<T>(children as React.ReactChildren),\n [children, columns]\n )\n const [displayColumns, columnSetting, setColumnSetting] = useColumnSetting(\n normalizedColumns,\n storageKey\n )\n\n /**\n * update the innerSize when props size changes\n */\n // useEffect(() => {\n // if (size) {\n // setInnerSize(size)\n // }\n // }, [setInnerSize, size])\n\n return (\n <TableContext.Provider\n value={{\n // size: innerSize,\n tableContainer,\n columnSetting,\n refresh,\n // setSize: setInnerSize,\n setColumnSetting,\n }}\n >\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('table')\n\n return (\n <div ref={tableContainer}>\n <LocaleReceiver componentName=\"Table\" defaultLocale={locale}>\n {(localeObject) => {\n const locale = localeObject as Record<string, string>\n\n return (\n <AntdTable\n className={classNames(\n prefixCls,\n {\n [`${prefixCls}-borderless`]: !bordered,\n [`${prefixCls}-hide-cell-borders`]: !showCellBorders,\n [`${prefixCls}-size-small`]: size === 'small',\n [`${prefixCls}-size-middle`]: size === 'middle',\n [`${prefixCls}-size-middle`]: size === 'middle',\n [`${prefixCls}-striped`]: striped,\n [`${prefixCls}-shadowed`]: shadowed,\n },\n className\n )}\n locale={locale}\n bordered={bordered}\n size={size}\n columns={displayColumns}\n pagination={pagination}\n {...rest}\n />\n )\n }}\n </LocaleReceiver>\n </div>\n )\n }}\n </ConfigConsumer>\n </TableContext.Provider>\n )\n}\n\nTable.Column = Column\nTable.ColumnGroup = ColumnGroup\nTable.displayName = 'Table'\n"]}
1
+ {"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/table/table.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,cAAc,MAAM,wCAAwC,CAAA;AAEnE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,MAAM,MAAM,sBAAsB,CAAA;AACzC,O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,CACc,CACb,CACP,CAAA;QACH,CAAC,CACc,CACK,CACzB,CAAA;AACH,CAAC,CAAA;AAED,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;AACrB,KAAK,CAAC,WAAW,GAAG,WAAW,CAAA;AAC/B,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA","sourcesContent":["import { ConfigConsumer } from 'antd/es/config-provider'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport type { TableProps as AntdTableProps } from 'antd/es/table'\nimport { default as AntdTable } from 'antd/es/table'\nimport Column from 'antd/es/table/Column'\nimport ColumnGroup from 'antd/es/table/ColumnGroup'\nimport classNames from 'classnames'\nimport React, { useMemo, useRef } from 'react'\n\nimport { TableContext } from './context'\nimport { useColumnSetting } from './hooks'\nimport { normalizeColumns } from './utils'\nimport { TotalShower } from './total-shower'\n\nexport type TableProps<T> = Omit<AntdTableProps<T>, 'locale'> & {\n storageKey?: string\n enableToolbar?: boolean\n showCellBorders?: boolean\n striped?: boolean\n shadowed?: boolean\n locale?: AntdTableProps<T>['locale'] & {\n loadingDescription?: string\n emptyText?: string\n }\n refresh?(): void\n}\n\nconst getDefaultPagination = (locale: NonNullable<AntdTableProps<unknown>['locale']>) => ({\n showTotal: (total: number) => <TotalShower total={total} locale={locale} />,\n})\n\nexport const Table = <T,>({\n className,\n locale,\n bordered,\n size,\n storageKey,\n columns,\n children,\n shadowed = !bordered,\n striped = false,\n showCellBorders = false,\n pagination,\n enableToolbar = false,\n refresh,\n ...rest\n}: TableProps<T>) => {\n const tableContainer = useRef<HTMLDivElement>(null)\n // const [innerSize, setInnerSize] = useLocalStorage<TableProps<T>['size']>(\n // TABLE_SIZE_STORAGE_KEY,\n // 'default'\n // )\n const normalizedColumns = useMemo(\n () => columns || normalizeColumns<T>(children as React.ReactChildren),\n [children, columns]\n )\n const [displayColumns, columnSetting, setColumnSetting] = useColumnSetting(\n normalizedColumns,\n storageKey\n )\n\n /**\n * update the innerSize when props size changes\n */\n // useEffect(() => {\n // if (size) {\n // setInnerSize(size)\n // }\n // }, [setInnerSize, size])\n\n return (\n <TableContext.Provider\n value={{\n // size: innerSize,\n tableContainer,\n columnSetting,\n refresh,\n // setSize: setInnerSize,\n setColumnSetting,\n }}\n >\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('table')\n\n return (\n <div ref={tableContainer}>\n <LocaleReceiver componentName=\"Table\" defaultLocale={locale}>\n {(localeObject) => {\n const locale = localeObject as Record<string, string>\n const paginationConfig = pagination || getDefaultPagination(locale)\n\n return (\n <AntdTable\n className={classNames(\n prefixCls,\n {\n [`${prefixCls}-borderless`]: !bordered,\n [`${prefixCls}-hide-cell-borders`]: !showCellBorders,\n [`${prefixCls}-size-small`]: size === 'small',\n [`${prefixCls}-size-middle`]: size === 'middle',\n [`${prefixCls}-size-middle`]: size === 'middle',\n [`${prefixCls}-striped`]: striped,\n [`${prefixCls}-shadowed`]: shadowed,\n },\n className\n )}\n locale={locale}\n bordered={bordered}\n size={size}\n columns={displayColumns}\n pagination={paginationConfig}\n {...rest}\n />\n )\n }}\n </LocaleReceiver>\n </div>\n )\n }}\n </ConfigConsumer>\n </TableContext.Provider>\n )\n}\n\nTable.Column = Column\nTable.ColumnGroup = ColumnGroup\nTable.displayName = 'Table'\n"]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { simpleTemplate } from '../utils';
3
+ export const TotalShower = ({
4
+ total,
5
+ locale
6
+ }) => {
7
+ return React.createElement(React.Fragment, null, simpleTemplate(locale.total, {
8
+ total
9
+ }));
10
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"total-shower.js","sourceRoot":"","sources":["../../src/table/total-shower.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,MAAM,GAMP,EAAE,EAAE;IACH,OAAO,0CAAG,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAI,CAAA;AACvD,CAAC,CAAA","sourcesContent":["import React from 'react'\n\nimport type { TableProps as AntdTableProps } from 'antd/es/table'\nimport { simpleTemplate } from '../utils'\n\nexport const TotalShower = ({\n total,\n locale,\n}: {\n total: number\n locale: AntdTableProps<unknown>['locale'] & {\n total?: string\n }\n}) => {\n return <>{simpleTemplate(locale.total, { total })}</>\n}\n"]}
@@ -1,4 +1,6 @@
1
1
  import TimePicker from 'antd/es/time-picker';
2
+ import { connectReadonlyComponent } from '../connect';
3
+ import { PreviewText } from '../preview-text';
2
4
  import 'antd/es/time-picker/style';
3
5
  export * from 'antd/es/time-picker';
4
- export default TimePicker;
6
+ export default connectReadonlyComponent(TimePicker, PreviewText.TimePicker);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/time-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAE5C,OAAO,2BAA2B,CAAA;AAElC,cAAc,qBAAqB,CAAA;AAEnC,eAAe,UAAU,CAAA","sourcesContent":["import TimePicker from 'antd/es/time-picker'\n\nimport 'antd/es/time-picker/style'\n\nexport * from 'antd/es/time-picker'\n\nexport default TimePicker\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/time-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,2BAA2B,CAAA;AAElC,cAAc,qBAAqB,CAAA;AAMnC,eAAe,wBAAwB,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA","sourcesContent":["import TimePicker from 'antd/es/time-picker'\nimport type { TimePickerProps as AntdTimePickerProps } from 'antd/es/time-picker'\nimport { connectReadonlyComponent } from '../connect'\nimport { PreviewText } from '../preview-text'\n\nimport 'antd/es/time-picker/style'\n\nexport * from 'antd/es/time-picker'\n\nexport type TimePickerProps = AntdTimePickerProps & {\n readonly?: boolean\n}\n\nexport default connectReadonlyComponent(TimePicker, PreviewText.TimePicker)\n"]}
package/es/title/index.js CHANGED
@@ -17,22 +17,20 @@ export default (props => {
17
17
  size = 'default',
18
18
  extra,
19
19
  number,
20
- simple,
21
- style
20
+ simple
22
21
  } = _a,
23
- rest = __rest(_a, ["title", "subTitle", "size", "extra", "number", "simple", "style"]);
24
- return React.createElement("div", {
25
- className: cn('tnt-title', size, {
22
+ rest = __rest(_a, ["title", "subTitle", "size", "extra", "number", "simple"]);
23
+ return React.createElement("div", Object.assign({
24
+ className: cn('tntd-title', size, {
26
25
  'has-number': number
27
26
  }, {
28
27
  'is-simple': simple
29
- }),
30
- style: Object.assign({}, style)
31
- }, React.createElement("div", {
32
- className: "tnt-title-text"
28
+ })
29
+ }, rest), React.createElement("div", {
30
+ className: "tntd-title-text"
33
31
  }, number && React.createElement("i", {
34
- class: "count"
32
+ className: "count"
35
33
  }, number <= 9 ? `0${number}` : number), React.createElement("h3", null, title), React.createElement("span", null, subTitle)), extra && React.createElement("div", {
36
- className: "tnt-title-extra"
34
+ className: "tntd-title-extra"
37
35
  }, extra));
38
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/title/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,cAAc,CAAA;AAErB,eAAe,CAAC,KAAK,EAAE,EAAE;IACvB,MAAM,KASF,KAAK,IAAI,EAAE,EATT,EACJ,KAAK,GAAG,MAAM,EACd,QAAQ,EACR,IAAI,GAAG,SAAS,EAChB,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,OAEQ,EADV,IAAI,cARH,mEASL,CAAc,CAAA;IAEf,OAAO,CACL,6BACE,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,EACnF,KAAK,oBAAO,KAAK;QAEjB,6BAAK,SAAS,EAAC,gBAAgB;YAC5B,MAAM,IAAI,2BAAG,KAAK,EAAC,OAAO,IAAE,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAK;YACrE,gCAAK,KAAK,CAAM;YAChB,kCAAO,QAAQ,CAAQ,CACnB;QACL,KAAK,IAAI,6BAAK,SAAS,EAAC,iBAAiB,IAAE,KAAK,CAAO,CACpD,CACP,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport cn from 'classnames'\nimport './index.less'\n\nexport default (props) => {\n const {\n title = '暂无标题',\n subTitle,\n size = 'default',\n extra,\n number,\n simple,\n style,\n ...rest\n } = props || {}\n\n return (\n <div\n className={cn('tnt-title', size, { 'has-number': number }, { 'is-simple': simple })}\n style={{ ...style }}\n >\n <div className=\"tnt-title-text\">\n {number && <i class=\"count\">{number <= 9 ? `0${number}` : number}</i>}\n <h3>{title}</h3>\n <span>{subTitle}</span>\n </div>\n {extra && <div className=\"tnt-title-extra\">{extra}</div>}\n </div>\n )\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/title/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAA6B,MAAM,OAAO,CAAA;AACjD,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,cAAc,CAAA;AAWrB,eAAe,CAAC,KAAiB,EAAE,EAAE;IACnC,MAAM,KAQF,KAAK,IAAI,EAAE,EART,EACJ,KAAK,GAAG,MAAM,EACd,QAAQ,EACR,IAAI,GAAG,SAAS,EAChB,KAAK,EACL,MAAM,EACN,MAAM,OAEO,EADV,IAAI,cAPH,0DAQL,CAAc,CAAA;IAEf,OAAO,CACL,2CACE,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,IAChF,IAAI;QAER,6BAAK,SAAS,EAAC,iBAAiB;YAC7B,MAAM,IAAI,2BAAG,SAAS,EAAC,OAAO,IAAE,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAK;YACzE,gCAAK,KAAK,CAAM;YAChB,kCAAO,QAAQ,CAAQ,CACnB;QACL,KAAK,IAAI,6BAAK,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAO,CACrD,CACP,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { FC, ComponentProps } from 'react'\nimport cn from 'classnames'\nimport './index.less'\n\nexport interface TitleProps extends ComponentProps<'div'> {\n title?: string\n subTitle?: string\n size?: 'default' | 'small' | 'middle' | 'large'\n extra?: React.ReactNode\n number?: number\n simple?: boolean\n}\n\nexport default (props: TitleProps) => {\n const {\n title = '暂无标题',\n subTitle,\n size = 'default',\n extra,\n number,\n simple,\n ...rest\n } = props || {}\n\n return (\n <div\n className={cn('tntd-title', size, { 'has-number': number }, { 'is-simple': simple })}\n {...rest}\n >\n <div className=\"tntd-title-text\">\n {number && <i className=\"count\">{number <= 9 ? `0${number}` : number}</i>}\n <h3>{title}</h3>\n <span>{subTitle}</span>\n </div>\n {extra && <div className=\"tntd-title-extra\">{extra}</div>}\n </div>\n )\n}\n"]}
@@ -1,4 +1,4 @@
1
- .tnt-title {
1
+ .tntd-title {
2
2
  & {
3
3
  position: relative;
4
4
  height: 32px;
@@ -8,7 +8,7 @@
8
8
  }
9
9
 
10
10
  &.has-number {
11
- .tnt-title-text {
11
+ .tntd-title-text {
12
12
  h3 {
13
13
  margin-left: 0;
14
14
  }
@@ -58,14 +58,14 @@
58
58
  .count {
59
59
  position: relative;
60
60
  top: -1px;
61
- color: #0089ff;
61
+ color: @primary-color;
62
62
  font-size: 22px;
63
63
  font-style: normal;
64
64
  margin-right: 12px;
65
65
  position: relative;
66
66
  vertical-align: top;
67
67
  font-weight: 400;
68
- font-family: Roboto, 'Helvetica Neue', Helvetica, Tahoma, Arial, 'PingFang SC',
68
+ font-family: 'OswaldLight', Roboto, 'Helvetica Neue', Helvetica, Tahoma, Arial, 'PingFang SC',
69
69
  'Microsoft YaHei' !important;
70
70
  letter-spacing: 1px;
71
71
  }
@@ -75,7 +75,7 @@
75
75
  content: '';
76
76
  width: 22px;
77
77
  height: 15px;
78
- border-top: 1px solid #0089ff;
78
+ border-top: 1px solid @primary-color;
79
79
  background-color: #fff;
80
80
  top: 45%;
81
81
  left: 58%;
@@ -88,7 +88,7 @@
88
88
  height: 28px;
89
89
  line-height: 28px;
90
90
  }
91
- .tnt-title-text {
91
+ .tntd-title-text {
92
92
  h3 {
93
93
  font-size: 14px;
94
94
  }
@@ -103,7 +103,7 @@
103
103
  height: 36px;
104
104
  line-height: 36px;
105
105
  }
106
- .tnt-title-text {
106
+ .tntd-title-text {
107
107
  h3 {
108
108
  font-size: 18px;
109
109
  }
@@ -118,7 +118,7 @@
118
118
  height: 40px;
119
119
  line-height: 40px;
120
120
  }
121
- .tnt-title-text {
121
+ .tntd-title-text {
122
122
  h3 {
123
123
  font-size: 20px;
124
124
  }
@@ -128,7 +128,7 @@
128
128
  }
129
129
  }
130
130
  }
131
- .tnt-title-text {
131
+ .tntd-title-text {
132
132
  & {
133
133
  position: relative;
134
134
  float: left;
@@ -161,7 +161,7 @@
161
161
  margin-right: 8px;
162
162
  }
163
163
  }
164
- .tnt-title-extra {
164
+ .tntd-title-extra {
165
165
  & {
166
166
  position: relative;
167
167
  float: right;
@@ -0,0 +1,87 @@
1
+ import classNames from 'classnames';
2
+ import CSSMotion, { CSSMotionList } from 'rc-motion';
3
+ import * as React from 'react';
4
+ import { ConfigContext } from '../config-provider';
5
+ import collapseMotion from './_util/motion';
6
+ import { FormItemPrefixContext } from './context';
7
+ import useDebounce from './hooks/useDebounce';
8
+ const EMPTY_LIST = [];
9
+ function toErrorEntity(error, errorStatus, prefix, index = 0) {
10
+ return {
11
+ key: typeof error === 'string' ? error : `${prefix}-${index}`,
12
+ error,
13
+ errorStatus
14
+ };
15
+ }
16
+ export default function ErrorList({
17
+ help,
18
+ helpStatus,
19
+ errors = EMPTY_LIST,
20
+ warnings = EMPTY_LIST,
21
+ className: rootClassName,
22
+ fieldId,
23
+ onVisibleChanged
24
+ }) {
25
+ const {
26
+ prefixCls
27
+ } = React.useContext(FormItemPrefixContext);
28
+ // TODO
29
+ // @ts-ignore
30
+ const {
31
+ getPrefixCls
32
+ } = React.useContext(ConfigContext);
33
+ const baseClassName = `${prefixCls}-item-explain`;
34
+ // TODO:
35
+ // @ts-ignore
36
+ const rootPrefixCls = getPrefixCls();
37
+ // We have to debounce here again since somewhere use ErrorList directly still need no shaking
38
+ // ref: https://github.com/ant-design/ant-design/issues/36336
39
+ const debounceErrors = useDebounce(errors);
40
+ const debounceWarnings = useDebounce(warnings);
41
+ const fullKeyList = React.useMemo(() => {
42
+ if (help !== undefined && help !== null) {
43
+ return [toErrorEntity(help, helpStatus, 'help')];
44
+ }
45
+ return [...debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index)), ...debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))];
46
+ }, [help, helpStatus, debounceErrors, debounceWarnings]);
47
+ const helpProps = {};
48
+ if (fieldId) {
49
+ helpProps.id = `${fieldId}_help`;
50
+ }
51
+ return React.createElement(CSSMotion, {
52
+ motionDeadline: collapseMotion.motionDeadline,
53
+ motionName: `${rootPrefixCls}-show-help`,
54
+ visible: !!fullKeyList.length,
55
+ onVisibleChanged: onVisibleChanged
56
+ }, holderProps => {
57
+ const {
58
+ className: holderClassName,
59
+ style: holderStyle
60
+ } = holderProps;
61
+ return React.createElement("div", Object.assign({}, helpProps, {
62
+ className: classNames(baseClassName, holderClassName, rootClassName),
63
+ style: holderStyle,
64
+ role: "alert"
65
+ }), React.createElement(CSSMotionList, Object.assign({
66
+ keys: fullKeyList
67
+ }, collapseMotion, {
68
+ motionName: `${rootPrefixCls}-show-help-item`,
69
+ component: false
70
+ }), itemProps => {
71
+ const {
72
+ key,
73
+ error,
74
+ errorStatus,
75
+ className: itemClassName,
76
+ style: itemStyle
77
+ } = itemProps;
78
+ return React.createElement("div", {
79
+ key: key,
80
+ className: classNames(itemClassName, {
81
+ [`${baseClassName}-${errorStatus}`]: errorStatus
82
+ }),
83
+ style: itemStyle
84
+ }, error);
85
+ }));
86
+ });
87
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorList.js","sourceRoot":"","sources":["../../src/tntd-form/ErrorList.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,SAAS,EAAE,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,cAAc,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,WAAW,MAAM,qBAAqB,CAAA;AAG7C,MAAM,UAAU,GAAsB,EAAE,CAAA;AAQxC,SAAS,aAAa,CACpB,KAAsB,EACtB,WAAuC,EACvC,MAAc,EACd,QAAgB,CAAC;IAEjB,OAAO;QACL,GAAG,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE;QAC7D,KAAK;QACL,WAAW;KACZ,CAAA;AACH,CAAC;AAYD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,IAAI,EACJ,UAAU,EACV,MAAM,GAAG,UA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,CAAA;KACjC;IAED,OAAO,CACL,oBAAC,SAAS,IACR,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,UAAU,EAAE,GAAG,aAAa,YAAY,EACxC,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAC7B,gBAAgB,EAAE,gBAAgB,IAEjC,CAAC,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA;QAEtE,OAAO,CACL,6CACM,SAAS,IACb,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE,eAAe,EAAE,aAAa,CAAC,EACpE,KAAK,EAAE,WAAW,EAClB,IAAI,EAAC,OAAO;YAEZ,oBAAC,aAAa,kBACZ,IAAI,EAAE,WAAW,IACb,cAAc,IAClB,UAAU,EAAE,GAAG,aAAa,iBAAiB,EAC7C,SAAS,EAAE,KAAK,KAEf,CAAC,SAAS,EAAE,EAAE;gBACb,MAAM,EACJ,GAAG,EACH,KAAK,EACL,WAAW,EACX,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,SAAS,GACjB,GAAG,SAAS,CAAA;gBAEb,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE;wBACnC,CAAC,GAAG,aAAa,IAAI,WAAW,EAAE,CAAC,EAAE,WAAW;qBACjD,CAAC,EACF,KAAK,EAAE,SAAS,IAEf,KAAK,CACF,CACP,CAAA;YACH,CAAC,CACa,CACZ,CACP,CAAA;IACH,CAAC,CACS,CACb,CAAA;AACH,CAAC","sourcesContent":["import classNames from 'classnames'\nimport CSSMotion, { CSSMotionList } from 'rc-motion'\nimport * as React from 'react'\nimport { ConfigContext } from '../config-provider'\nimport collapseMotion from './_util/motion'\nimport { FormItemPrefixContext } from './context'\nimport useDebounce from './hooks/useDebounce'\nimport type { ValidateStatus } from './FormItem'\n\nconst EMPTY_LIST: React.ReactNode[] = []\n\ninterface ErrorEntity {\n error: React.ReactNode\n errorStatus?: ValidateStatus\n key: string\n}\n\nfunction toErrorEntity(\n error: React.ReactNode,\n errorStatus: ValidateStatus | undefined,\n prefix: string,\n index: number = 0\n): ErrorEntity {\n return {\n key: typeof error === 'string' ? error : `${prefix}-${index}`,\n error,\n errorStatus,\n }\n}\n\nexport interface ErrorListProps {\n fieldId?: string\n help?: React.ReactNode\n helpStatus?: ValidateStatus\n errors?: React.ReactNode[]\n warnings?: React.ReactNode[]\n className?: string\n onVisibleChanged?: (visible: boolean) => void\n}\n\nexport default function ErrorList({\n help,\n helpStatus,\n errors = EMPTY_LIST,\n warnings = EMPTY_LIST,\n className: rootClassName,\n fieldId,\n onVisibleChanged,\n}: ErrorListProps) {\n const { prefixCls } = React.useContext(FormItemPrefixContext)\n // TODO\n // @ts-ignore\n const { getPrefixCls } = React.useContext(ConfigContext)\n\n const baseClassName = `${prefixCls}-item-explain`\n // TODO:\n // @ts-ignore\n const rootPrefixCls = getPrefixCls()\n\n // We have to debounce here again since somewhere use ErrorList directly still need no shaking\n // ref: https://github.com/ant-design/ant-design/issues/36336\n const debounceErrors = useDebounce(errors)\n const debounceWarnings = useDebounce(warnings)\n\n const fullKeyList = React.useMemo(() => {\n if (help !== undefined && help !== null) {\n return [toErrorEntity(help, helpStatus, 'help')]\n }\n\n return [\n ...debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index)),\n ...debounceWarnings.map((warning, index) =>\n toErrorEntity(warning, 'warning', 'warning', index)\n ),\n ]\n }, [help, helpStatus, debounceErrors, debounceWarnings])\n\n const helpProps: { id?: string } = {}\n\n if (fieldId) {\n helpProps.id = `${fieldId}_help`\n }\n\n return (\n <CSSMotion\n motionDeadline={collapseMotion.motionDeadline}\n motionName={`${rootPrefixCls}-show-help`}\n visible={!!fullKeyList.length}\n onVisibleChanged={onVisibleChanged}\n >\n {(holderProps) => {\n const { className: holderClassName, style: holderStyle } = holderProps\n\n return (\n <div\n {...helpProps}\n className={classNames(baseClassName, holderClassName, rootClassName)}\n style={holderStyle}\n role=\"alert\"\n >\n <CSSMotionList\n keys={fullKeyList}\n {...collapseMotion}\n motionName={`${rootPrefixCls}-show-help-item`}\n component={false}\n >\n {(itemProps) => {\n const {\n key,\n error,\n errorStatus,\n className: itemClassName,\n style: itemStyle,\n } = itemProps\n\n return (\n <div\n key={key}\n className={classNames(itemClassName, {\n [`${baseClassName}-${errorStatus}`]: errorStatus,\n })}\n style={itemStyle}\n >\n {error}\n </div>\n )\n }}\n </CSSMotionList>\n </div>\n )\n }}\n </CSSMotion>\n )\n}\n"]}
@@ -0,0 +1,122 @@
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6
+ }
7
+ return t;
8
+ };
9
+ import classNames from 'classnames';
10
+ import FieldForm, { List, useWatch } from 'rc-field-form';
11
+ import * as React from 'react';
12
+ import { useMemo } from 'react';
13
+ import { ConfigContext } from '../config-provider';
14
+ import DisabledContext, { DisabledContextProvider } from '../config-provider/DisabledContext';
15
+ import SizeContext, { SizeContextProvider } from '../config-provider/SizeContext';
16
+ import { FormContext, FormProvider } from './context';
17
+ import ValidateMessagesContext from './validateMessagesContext';
18
+ import useForm from './hooks/useForm';
19
+ const InternalForm = (props, ref) => {
20
+ const contextSize = React.useContext(SizeContext);
21
+ const contextDisabled = React.useContext(DisabledContext);
22
+ // TODO
23
+ // @ts-ignore
24
+ const {
25
+ getPrefixCls,
26
+ direction,
27
+ form: contextForm
28
+ } = React.useContext(ConfigContext);
29
+ const {
30
+ prefixCls: customizePrefixCls,
31
+ className = '',
32
+ size = contextSize,
33
+ disabled = contextDisabled,
34
+ form,
35
+ colon,
36
+ labelAlign,
37
+ labelWrap,
38
+ labelCol,
39
+ wrapperCol,
40
+ hideRequiredMark,
41
+ layout = 'horizontal',
42
+ scrollToFirstError,
43
+ requiredMark,
44
+ onFinishFailed,
45
+ name,
46
+ readonly
47
+ } = props,
48
+ restFormProps = __rest(props, ["prefixCls", "className", "size", "disabled", "form", "colon", "labelAlign", "labelWrap", "labelCol", "wrapperCol", "hideRequiredMark", "layout", "scrollToFirstError", "requiredMark", "onFinishFailed", "name", "readonly"]);
49
+ const contextValidateMessages = React.useContext(ValidateMessagesContext);
50
+ const mergedRequiredMark = useMemo(() => {
51
+ if (requiredMark !== undefined) {
52
+ return requiredMark;
53
+ }
54
+ if (contextForm && contextForm.requiredMark !== undefined) {
55
+ return contextForm.requiredMark;
56
+ }
57
+ if (hideRequiredMark) {
58
+ return false;
59
+ }
60
+ return true;
61
+ }, [hideRequiredMark, requiredMark, contextForm]);
62
+ const mergedColon = colon !== null && colon !== void 0 ? colon : contextForm === null || contextForm === void 0 ? void 0 : contextForm.colon;
63
+ const prefixCls = getPrefixCls('form', customizePrefixCls);
64
+ const formClassName = classNames(prefixCls, {
65
+ [`${prefixCls}-tntd`]: true,
66
+ [`${prefixCls}-${layout}`]: true,
67
+ [`${prefixCls}-hide-required-mark`]: mergedRequiredMark === false,
68
+ [`${prefixCls}-rtl`]: direction === 'rtl',
69
+ [`${prefixCls}-${size}`]: size
70
+ }, className);
71
+ const [wrapForm] = useForm(form);
72
+ const {
73
+ __INTERNAL__
74
+ } = wrapForm;
75
+ __INTERNAL__.name = name;
76
+ const formContextValue = useMemo(() => ({
77
+ name,
78
+ labelAlign,
79
+ labelCol,
80
+ labelWrap,
81
+ wrapperCol,
82
+ vertical: layout === 'vertical',
83
+ colon: mergedColon,
84
+ requiredMark: mergedRequiredMark,
85
+ itemRef: __INTERNAL__.itemRef,
86
+ form: wrapForm,
87
+ readonly
88
+ }), [name, labelAlign, labelCol, labelWrap, wrapperCol, layout, mergedColon, mergedRequiredMark, wrapForm, readonly]);
89
+ React.useImperativeHandle(ref, () => wrapForm);
90
+ const onInternalFinishFailed = errorInfo => {
91
+ onFinishFailed === null || onFinishFailed === void 0 ? void 0 : onFinishFailed(errorInfo);
92
+ let defaultScrollToFirstError = {
93
+ block: 'nearest'
94
+ };
95
+ if (scrollToFirstError && errorInfo.errorFields.length) {
96
+ if (typeof scrollToFirstError === 'object') {
97
+ defaultScrollToFirstError = scrollToFirstError;
98
+ }
99
+ wrapForm.scrollToField(errorInfo.errorFields[0].name, defaultScrollToFirstError);
100
+ }
101
+ };
102
+ return React.createElement(DisabledContextProvider, {
103
+ disabled: disabled
104
+ }, React.createElement(SizeContextProvider, {
105
+ size: size
106
+ }, React.createElement(FormProvider, Object.assign({}, {
107
+ // This is not list in API, we pass with spread
108
+ validateMessages: contextValidateMessages
109
+ }), React.createElement(FormContext.Provider, {
110
+ value: formContextValue
111
+ }, React.createElement(FieldForm, Object.assign({
112
+ id: name
113
+ }, restFormProps, {
114
+ name: name,
115
+ onFinishFailed: onInternalFinishFailed,
116
+ form: wrapForm,
117
+ className: formClassName
118
+ }))))));
119
+ };
120
+ const Form = React.forwardRef(InternalForm);
121
+ export { useForm, List, useWatch };
122
+ export default Form;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/tntd-form/Form.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,eAAe,EAAE,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAE7F,OAAO,WAAW,EAAE,EAAE,mBAAmB,EA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,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAA;IAE9C,MAAM,sBAAsB,GAAG,CAAC,SAA8B,EAAE,EAAE;QAChE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAG,SAAS,CAAC,CAAA;QAE3B,IAAI,yBAAyB,GAAY,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;QAE7D,IAAI,kBAAkB,IAAI,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE;YACtD,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;gBAC1C,yBAAyB,GAAG,kBAAkB,CAAA;aAC/C;YACD,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAA;SACjF;IACH,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,uBAAuB,IAAC,QAAQ,EAAE,QAAQ;QACzC,oBAAC,mBAAmB,IAAC,IAAI,EAAE,IAAI;YAC7B,oBAAC,YAAY,oBACP;gBACF,+CAA+C;gBAC/C,gBAAgB,EAAE,uBAAuB;aAC1C;gBAED,oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;oBAC3C,oBAAC,SAAS,kBACR,EAAE,EAAE,IAAI,IACJ,aAAa,IACjB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,sBAAsB,EACtC,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,aAAa,IACxB,CACmB,CACV,CACK,CACE,CAC3B,CAAA;AACH,CAAC,CAAA;AAED,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAA0B,YAAY,CAE5C,CAAA;AAEvB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAgB,QAAQ,EAAE,CAAA;AAEhD,eAAe,IAAI,CAAA","sourcesContent":["import classNames from 'classnames'\nimport FieldForm, { List, useWatch } from 'rc-field-form'\nimport type { FormProps as RcFormProps } from 'rc-field-form/lib/Form'\nimport type { ValidateErrorEntity } from 'rc-field-form/lib/interface'\nimport * as React from 'react'\nimport { useMemo } from 'react'\nimport type { Options } from 'scroll-into-view-if-needed'\nimport { ConfigContext } from '../config-provider'\nimport DisabledContext, { DisabledContextProvider } from '../config-provider/DisabledContext'\nimport type { SizeType } from '../config-provider/SizeContext'\nimport SizeContext, { SizeContextProvider } from '../config-provider/SizeContext'\nimport type { ColProps } from '../col'\nimport type { FormContextProps } from './context'\nimport { FormContext, FormProvider } from './context'\nimport ValidateMessagesContext from './validateMessagesContext'\nimport useForm, { FormInstance } from './hooks/useForm'\nimport type { FormLabelAlign } from './interface'\n\nexport type RequiredMark = boolean | 'optional'\nexport type FormLayout = 'horizontal' | 'inline' | 'vertical'\n\nexport interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form'> {\n prefixCls?: string\n colon?: boolean\n name?: string\n layout?: FormLayout\n labelAlign?: FormLabelAlign\n labelWrap?: boolean\n labelCol?: ColProps\n wrapperCol?: ColProps\n form?: FormInstance<Values>\n size?: SizeType\n disabled?: boolean\n readonly?: boolean\n scrollToFirstError?: Options | boolean\n requiredMark?: RequiredMark\n /** @deprecated Will warning in future branch. Pls use `requiredMark` instead. */\n hideRequiredMark?: boolean\n}\n\nconst InternalForm: React.ForwardRefRenderFunction<FormInstance, FormProps> = (props, ref) => {\n const contextSize = React.useContext(SizeContext)\n const contextDisabled = React.useContext(DisabledContext)\n // TODO\n // @ts-ignore\n const { getPrefixCls, direction, form: contextForm } = React.useContext(ConfigContext)\n\n const {\n prefixCls: customizePrefixCls,\n className = '',\n size = contextSize,\n disabled = contextDisabled,\n form,\n colon,\n labelAlign,\n labelWrap,\n labelCol,\n wrapperCol,\n hideRequiredMark,\n layout = 'horizontal',\n scrollToFirstError,\n requiredMark,\n onFinishFailed,\n name,\n readonly,\n ...restFormProps\n } = props\n\n const contextValidateMessages = React.useContext(ValidateMessagesContext)\n\n const mergedRequiredMark = useMemo(() => {\n if (requiredMark !== undefined) {\n return requiredMark\n }\n\n if (contextForm && contextForm.requiredMark !== undefined) {\n return contextForm.requiredMark\n }\n\n if (hideRequiredMark) {\n return false\n }\n\n return true\n }, [hideRequiredMark, requiredMark, contextForm])\n\n const mergedColon = colon ?? contextForm?.colon\n\n const prefixCls = getPrefixCls('form', customizePrefixCls)\n\n const formClassName = classNames(\n prefixCls,\n {\n [`${prefixCls}-tntd`]: true,\n [`${prefixCls}-${layout}`]: true,\n [`${prefixCls}-hide-required-mark`]: mergedRequiredMark === false,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n [`${prefixCls}-${size}`]: size,\n },\n className\n )\n\n const [wrapForm] = useForm(form)\n const { __INTERNAL__ } = wrapForm\n __INTERNAL__.name = name\n\n const formContextValue = useMemo<FormContextProps>(\n () => ({\n name,\n labelAlign,\n labelCol,\n labelWrap,\n wrapperCol,\n vertical: layout === 'vertical',\n colon: mergedColon,\n requiredMark: mergedRequiredMark,\n itemRef: __INTERNAL__.itemRef,\n form: wrapForm,\n readonly,\n }),\n [\n name,\n labelAlign,\n labelCol,\n labelWrap,\n wrapperCol,\n layout,\n mergedColon,\n mergedRequiredMark,\n wrapForm,\n readonly,\n ]\n )\n\n React.useImperativeHandle(ref, () => wrapForm)\n\n const onInternalFinishFailed = (errorInfo: ValidateErrorEntity) => {\n onFinishFailed?.(errorInfo)\n\n let defaultScrollToFirstError: Options = { block: 'nearest' }\n\n if (scrollToFirstError && errorInfo.errorFields.length) {\n if (typeof scrollToFirstError === 'object') {\n defaultScrollToFirstError = scrollToFirstError\n }\n wrapForm.scrollToField(errorInfo.errorFields[0].name, defaultScrollToFirstError)\n }\n }\n\n return (\n <DisabledContextProvider disabled={disabled}>\n <SizeContextProvider size={size}>\n <FormProvider\n {...{\n // This is not list in API, we pass with spread\n validateMessages: contextValidateMessages,\n }}\n >\n <FormContext.Provider value={formContextValue}>\n <FieldForm\n id={name}\n {...restFormProps}\n name={name}\n onFinishFailed={onInternalFinishFailed}\n form={wrapForm}\n className={formClassName}\n />\n </FormContext.Provider>\n </FormProvider>\n </SizeContextProvider>\n </DisabledContextProvider>\n )\n}\n\nconst Form = React.forwardRef<FormInstance, FormProps>(InternalForm) as <Values = any>(\n props: React.PropsWithChildren<FormProps<Values>> & { ref?: React.Ref<FormInstance<Values>> }\n) => React.ReactElement\n\nexport { useForm, List, FormInstance, useWatch }\n\nexport default Form\n"]}