tntd 2.7.2 → 2.7.4

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 (428) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -0
  3. package/es/actions/index.js +12 -0
  4. package/es/actions/index.js.map +1 -0
  5. package/es/actions/index.less +70 -0
  6. package/es/affix/index.js +2 -1
  7. package/es/alert/index.js +2 -1
  8. package/es/anchor/index.js +2 -1
  9. package/es/array-input/icon.js +6 -24
  10. package/es/array-input/index.js +119 -203
  11. package/es/auth-context/index.js +2 -1
  12. package/es/auto-complete/index.js +2 -1
  13. package/es/avatar/index.js +2 -1
  14. package/es/back-top/index.js +2 -1
  15. package/es/badge/index.js +2 -1
  16. package/es/breadcrumb/index.js +2 -1
  17. package/es/button/index.js +2 -1
  18. package/es/calendar/index.js +2 -1
  19. package/es/card/index.js +2 -1
  20. package/es/carousel/index.js +2 -1
  21. package/es/cascader/index.js +2 -1
  22. package/es/check-card/group.js +149 -0
  23. package/es/check-card/group.js.map +1 -0
  24. package/es/check-card/index.js +120 -0
  25. package/es/check-card/index.js.map +1 -0
  26. package/es/check-card/index.less +179 -0
  27. package/es/checkbox/checkbox-group.js +2 -1
  28. package/es/checkbox/index.js +2 -1
  29. package/es/col/index.js +2 -1
  30. package/es/collapse/index.js +2 -1
  31. package/es/color-picker/ColorPicker.js +81 -127
  32. package/es/color-picker/ColorPicker.js.map +1 -1
  33. package/es/color-picker/index.js +5 -8
  34. package/es/color-picker/index.less +5 -1
  35. package/es/columns/index.js +30 -66
  36. package/es/columns/style/index.js +2 -1
  37. package/es/comment/index.js +2 -1
  38. package/es/config-provider/DisabledContext.js +5 -9
  39. package/es/config-provider/SizeContext.js +3 -7
  40. package/es/config-provider/config-provider.js +2 -1
  41. package/es/ellipsis/index.js +13 -3
  42. package/es/ellipsis/index.js.map +1 -1
  43. package/es/ellipsis/index.less +2 -2
  44. package/es/handle/index.js +20 -9
  45. package/es/handle/index.js.map +1 -1
  46. package/es/handle/index.less +1 -1
  47. package/es/index.js +7 -0
  48. package/es/index.js.map +1 -1
  49. package/es/index.less +5 -0
  50. package/es/locale/en_US.js +3 -1
  51. package/es/locale/en_US.js.map +1 -1
  52. package/es/locale/zh_CN.js +3 -1
  53. package/es/locale/zh_CN.js.map +1 -1
  54. package/es/mention/index.js +4 -0
  55. package/es/mention/index.js.map +1 -0
  56. package/es/page/Box.js +1 -1
  57. package/es/page/Box.js.map +1 -1
  58. package/es/page/index.js +2 -2
  59. package/es/page/index.js.map +1 -1
  60. package/es/page/index.less +5 -5
  61. package/es/prev-locale.js +1 -1
  62. package/es/prev-locale.js.map +1 -1
  63. package/es/query-form/Field/SelectInput.js +2 -2
  64. package/es/query-form/Field/SelectInput.js.map +1 -1
  65. package/es/query-form/Field/index.js +2 -1
  66. package/es/query-form/Field/index.js.map +1 -1
  67. package/es/query-list-scene/QueryForm.js +2 -2
  68. package/es/query-list-scene/QueryForm.js.map +1 -1
  69. package/es/segmented/index.js +50 -0
  70. package/es/segmented/index.js.map +1 -0
  71. package/es/segmented/index.less +138 -0
  72. package/es/switch/switch.js.map +1 -1
  73. package/es/table/constants.js +53 -0
  74. package/es/table/constants.js.map +1 -1
  75. package/es/table/context.js.map +1 -1
  76. package/es/table/hooks/use-column-setting.js.map +1 -1
  77. package/es/table/table.js +107 -6
  78. package/es/table/table.js.map +1 -1
  79. package/es/table/table.less +3 -1
  80. package/es/table/total-shower.js +6 -0
  81. package/es/table/total-shower.js.map +1 -0
  82. package/es/title/index.js +5 -5
  83. package/es/title/index.js.map +1 -1
  84. package/es/title/index.less +10 -10
  85. package/es/tntd-form/Form.js +13 -1
  86. package/es/tntd-form/Form.js.map +1 -1
  87. package/es/tntd-form/TntdForm/components/Item.js +42 -30
  88. package/es/tntd-form/TntdForm/components/ItemComp.js +167 -158
  89. package/es/tntd-form/TntdForm/components/List.js +89 -78
  90. package/es/tntd-form/TntdForm/index.js +38 -33
  91. package/es/tntd-form/TntdForm/interface.js +1 -2
  92. package/es/tntd-form/TntdForm/store.js +1 -2
  93. package/es/tntd-form/TntdForm/utils.js +158 -168
  94. package/es/tntd-form/tntd-form.stories.js +7 -5
  95. package/es/tntd-form/tntd-form.stories.js.map +1 -1
  96. package/es/tntd-layout/HeaderActions.js +1 -1
  97. package/es/tntd-layout/HeaderActions.js.map +1 -1
  98. package/es/tntd-modal/index.js +54 -21
  99. package/es/tntd-modal/index.js.map +1 -1
  100. package/es/tntd-modal/index.less +83 -63
  101. package/es/tree-select/index.js.map +1 -1
  102. package/es/utils/index.js +1 -0
  103. package/es/utils/index.js.map +1 -1
  104. package/es/utils/simple-template.js +11 -0
  105. package/es/utils/simple-template.js.map +1 -0
  106. package/es/water-mark/index.js +99 -0
  107. package/es/water-mark/index.js.map +1 -0
  108. package/lib/actions/index.d.ts +15 -0
  109. package/lib/actions/index.d.ts.map +1 -0
  110. package/lib/actions/index.js +17 -0
  111. package/lib/actions/index.js.map +1 -0
  112. package/lib/actions/index.less +70 -0
  113. package/lib/check-card/group.d.ts +130 -0
  114. package/lib/check-card/group.d.ts.map +1 -0
  115. package/lib/check-card/group.js +179 -0
  116. package/lib/check-card/group.js.map +1 -0
  117. package/lib/check-card/index.d.ts +136 -0
  118. package/lib/check-card/index.d.ts.map +1 -0
  119. package/lib/check-card/index.js +148 -0
  120. package/lib/check-card/index.js.map +1 -0
  121. package/lib/check-card/index.less +179 -0
  122. package/lib/color-picker/ColorPicker.js +1 -1
  123. package/lib/color-picker/ColorPicker.js.map +1 -1
  124. package/lib/color-picker/index.less +5 -1
  125. package/lib/ellipsis/index.d.ts.map +1 -1
  126. package/lib/ellipsis/index.js +13 -3
  127. package/lib/ellipsis/index.js.map +1 -1
  128. package/lib/ellipsis/index.less +2 -2
  129. package/lib/handle/index.d.ts.map +1 -1
  130. package/lib/handle/index.js +20 -9
  131. package/lib/handle/index.js.map +1 -1
  132. package/lib/handle/index.less +1 -1
  133. package/lib/index.d.ts +7 -0
  134. package/lib/index.d.ts.map +1 -1
  135. package/lib/index.js +11 -1
  136. package/lib/index.js.map +1 -1
  137. package/lib/index.less +5 -0
  138. package/lib/locale/default.d.ts +1 -0
  139. package/lib/locale/default.d.ts.map +1 -1
  140. package/lib/locale/en_US.d.ts +1 -0
  141. package/lib/locale/en_US.d.ts.map +1 -1
  142. package/lib/locale/en_US.js +3 -1
  143. package/lib/locale/en_US.js.map +1 -1
  144. package/lib/locale/zh_CN.d.ts +1 -0
  145. package/lib/locale/zh_CN.d.ts.map +1 -1
  146. package/lib/locale/zh_CN.js +3 -1
  147. package/lib/locale/zh_CN.js.map +1 -1
  148. package/lib/mention/index.js +25 -0
  149. package/lib/page/Box.js +1 -1
  150. package/lib/page/Box.js.map +1 -1
  151. package/lib/page/index.js +2 -2
  152. package/lib/page/index.js.map +1 -1
  153. package/lib/page/index.less +5 -5
  154. package/lib/prev-locale.js +1 -1
  155. package/lib/prev-locale.js.map +1 -1
  156. package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
  157. package/lib/query-form/Field/SelectInput.js +2 -2
  158. package/lib/query-form/Field/SelectInput.js.map +1 -1
  159. package/lib/query-form/Field/index.d.ts.map +1 -1
  160. package/lib/query-form/Field/index.js +2 -1
  161. package/lib/query-form/Field/index.js.map +1 -1
  162. package/lib/query-list-scene/QueryForm.d.ts +1 -1
  163. package/lib/query-list-scene/QueryForm.d.ts.map +1 -1
  164. package/lib/query-list-scene/QueryForm.js +2 -2
  165. package/lib/query-list-scene/QueryForm.js.map +1 -1
  166. package/lib/segmented/index.d.ts +23 -0
  167. package/lib/segmented/index.d.ts.map +1 -0
  168. package/lib/segmented/index.js +78 -0
  169. package/lib/segmented/index.js.map +1 -0
  170. package/lib/segmented/index.less +138 -0
  171. package/lib/switch/switch.d.ts +1 -1
  172. package/lib/switch/switch.d.ts.map +1 -1
  173. package/lib/switch/switch.js.map +1 -1
  174. package/lib/table/constants.d.ts +2 -0
  175. package/lib/table/constants.d.ts.map +1 -1
  176. package/lib/table/constants.js +54 -1
  177. package/lib/table/constants.js.map +1 -1
  178. package/lib/table/context.d.ts +1 -0
  179. package/lib/table/context.d.ts.map +1 -1
  180. package/lib/table/context.js.map +1 -1
  181. package/lib/table/hooks/use-column-setting.d.ts +4 -1
  182. package/lib/table/hooks/use-column-setting.d.ts.map +1 -1
  183. package/lib/table/hooks/use-column-setting.js.map +1 -1
  184. package/lib/table/table.d.ts +2 -1
  185. package/lib/table/table.d.ts.map +1 -1
  186. package/lib/table/table.js +107 -6
  187. package/lib/table/table.js.map +1 -1
  188. package/lib/table/table.less +3 -1
  189. package/lib/table/total-shower.d.ts +9 -0
  190. package/lib/table/total-shower.d.ts.map +1 -0
  191. package/lib/table/total-shower.js +13 -0
  192. package/lib/table/total-shower.js.map +1 -0
  193. package/lib/title/index.d.ts +11 -1
  194. package/lib/title/index.d.ts.map +1 -1
  195. package/lib/title/index.js +5 -5
  196. package/lib/title/index.js.map +1 -1
  197. package/lib/title/index.less +10 -10
  198. package/lib/tntd-form/Form.d.ts.map +1 -1
  199. package/lib/tntd-form/Form.js +12 -0
  200. package/lib/tntd-form/Form.js.map +1 -1
  201. package/lib/tntd-form/TntdForm/components/Item.js +55 -61
  202. package/lib/tntd-form/TntdForm/components/ItemComp.js +203 -190
  203. package/lib/tntd-form/TntdForm/components/List.js +118 -111
  204. package/lib/tntd-form/TntdForm/index.js +61 -67
  205. package/lib/tntd-form/TntdForm/interface.js +4 -2
  206. package/lib/tntd-form/TntdForm/store.js +8 -7
  207. package/lib/tntd-form/TntdForm/utils.js +182 -184
  208. package/lib/tntd-form/tntd-form.stories.d.ts.map +1 -1
  209. package/lib/tntd-form/tntd-form.stories.js +7 -5
  210. package/lib/tntd-form/tntd-form.stories.js.map +1 -1
  211. package/lib/tntd-layout/HeaderActions.js +1 -1
  212. package/lib/tntd-layout/HeaderActions.js.map +1 -1
  213. package/lib/tntd-modal/index.d.ts +15 -2
  214. package/lib/tntd-modal/index.d.ts.map +1 -1
  215. package/lib/tntd-modal/index.js +58 -23
  216. package/lib/tntd-modal/index.js.map +1 -1
  217. package/lib/tntd-modal/index.less +83 -63
  218. package/lib/tree-select/index.d.ts +7 -5
  219. package/lib/tree-select/index.d.ts.map +1 -1
  220. package/lib/tree-select/index.js.map +1 -1
  221. package/lib/utils/index.d.ts +1 -0
  222. package/lib/utils/index.d.ts.map +1 -1
  223. package/lib/utils/index.js +1 -0
  224. package/lib/utils/index.js.map +1 -1
  225. package/lib/utils/simple-template.d.ts +9 -0
  226. package/lib/utils/simple-template.d.ts.map +1 -0
  227. package/lib/utils/simple-template.js +15 -0
  228. package/lib/utils/simple-template.js.map +1 -0
  229. package/lib/water-mark/index.d.ts +49 -0
  230. package/lib/water-mark/index.d.ts.map +1 -0
  231. package/lib/water-mark/index.js +129 -0
  232. package/lib/water-mark/index.js.map +1 -0
  233. package/package.json +21 -3
  234. package/es/_util/colors.js +0 -3
  235. package/es/_util/colors.js.map +0 -1
  236. package/es/_util/easings.js +0 -9
  237. package/es/_util/easings.js.map +0 -1
  238. package/es/_util/getDataOrAriaProps.js +0 -8
  239. package/es/_util/getDataOrAriaProps.js.map +0 -1
  240. package/es/_util/getScroll.js +0 -14
  241. package/es/_util/getScroll.js.map +0 -1
  242. package/es/_util/interopDefault.js +0 -5
  243. package/es/_util/interopDefault.js.map +0 -1
  244. package/es/_util/isNumeric.js +0 -4
  245. package/es/_util/isNumeric.js.map +0 -1
  246. package/es/_util/motion.js +0 -22
  247. package/es/_util/motion.js.map +0 -1
  248. package/es/_util/openAnimation.js +0 -51
  249. package/es/_util/openAnimation.js.map +0 -1
  250. package/es/_util/raf.js +0 -25
  251. package/es/_util/raf.js.map +0 -1
  252. package/es/_util/reactNode.js +0 -6
  253. package/es/_util/reactNode.js.map +0 -1
  254. package/es/_util/ref.js +0 -15
  255. package/es/_util/ref.js.map +0 -1
  256. package/es/_util/responsiveObserve.js +0 -82
  257. package/es/_util/responsiveObserve.js.map +0 -1
  258. package/es/_util/scrollTo.js +0 -29
  259. package/es/_util/scrollTo.js.map +0 -1
  260. package/es/_util/styleChecker.js +0 -12
  261. package/es/_util/styleChecker.js.map +0 -1
  262. package/es/_util/throttleByAnimationFrame.js +0 -40
  263. package/es/_util/throttleByAnimationFrame.js.map +0 -1
  264. package/es/_util/transButton.js +0 -103
  265. package/es/_util/transButton.js.map +0 -1
  266. package/es/_util/triggerEvent.js +0 -8
  267. package/es/_util/triggerEvent.js.map +0 -1
  268. package/es/_util/type.js +0 -3
  269. package/es/_util/type.js.map +0 -1
  270. package/es/_util/warning.js +0 -5
  271. package/es/_util/warning.js.map +0 -1
  272. package/es/_util/wave.js +0 -228
  273. package/es/_util/wave.js.map +0 -1
  274. package/es/config-provider/context.js +0 -41
  275. package/es/config-provider/context.js.map +0 -1
  276. package/es/tntd-form/__tests__/demo-extend.test.js +0 -3
  277. package/es/tntd-form/__tests__/demo-extend.test.js.map +0 -1
  278. package/es/tntd-form/__tests__/demo.test.js +0 -3
  279. package/es/tntd-form/__tests__/demo.test.js.map +0 -1
  280. package/es/tntd-form/__tests__/image.test.js +0 -5
  281. package/es/tntd-form/__tests__/image.test.js.map +0 -1
  282. package/es/tntd-form/__tests__/index.test.js +0 -957
  283. package/es/tntd-form/__tests__/index.test.js.map +0 -1
  284. package/es/tntd-form/__tests__/list-noStyle.test.js +0 -41
  285. package/es/tntd-form/__tests__/list-noStyle.test.js.map +0 -1
  286. package/es/tntd-form/__tests__/list.test.js +0 -164
  287. package/es/tntd-form/__tests__/list.test.js.map +0 -1
  288. package/es/tntd-form/__tests__/ref.test.js +0 -45
  289. package/es/tntd-form/__tests__/ref.test.js.map +0 -1
  290. package/es/tntd-form/__tests__/type.test.js +0 -74
  291. package/es/tntd-form/__tests__/type.test.js.map +0 -1
  292. package/lib/_util/colors.d.ts +0 -3
  293. package/lib/_util/colors.d.ts.map +0 -1
  294. package/lib/_util/colors.js +0 -7
  295. package/lib/_util/colors.js.map +0 -1
  296. package/lib/_util/easings.d.ts +0 -2
  297. package/lib/_util/easings.d.ts.map +0 -1
  298. package/lib/_util/easings.js +0 -14
  299. package/lib/_util/easings.js.map +0 -1
  300. package/lib/_util/getDataOrAriaProps.d.ts +0 -2
  301. package/lib/_util/getDataOrAriaProps.d.ts.map +0 -1
  302. package/lib/_util/getDataOrAriaProps.js +0 -13
  303. package/lib/_util/getDataOrAriaProps.js.map +0 -1
  304. package/lib/_util/getScroll.d.ts +0 -2
  305. package/lib/_util/getScroll.d.ts.map +0 -1
  306. package/lib/_util/getScroll.js +0 -18
  307. package/lib/_util/getScroll.js.map +0 -1
  308. package/lib/_util/interopDefault.d.ts +0 -2
  309. package/lib/_util/interopDefault.d.ts.map +0 -1
  310. package/lib/_util/interopDefault.js +0 -9
  311. package/lib/_util/interopDefault.js.map +0 -1
  312. package/lib/_util/isNumeric.d.ts +0 -3
  313. package/lib/_util/isNumeric.d.ts.map +0 -1
  314. package/lib/_util/isNumeric.js +0 -7
  315. package/lib/_util/isNumeric.js.map +0 -1
  316. package/lib/_util/motion.d.ts +0 -24
  317. package/lib/_util/motion.d.ts.map +0 -1
  318. package/lib/_util/motion.js +0 -17
  319. package/lib/_util/motion.js.map +0 -1
  320. package/lib/_util/openAnimation.d.ts +0 -7
  321. package/lib/_util/openAnimation.d.ts.map +0 -1
  322. package/lib/_util/openAnimation.js +0 -58
  323. package/lib/_util/openAnimation.js.map +0 -1
  324. package/lib/_util/raf.d.ts +0 -10
  325. package/lib/_util/raf.d.ts.map +0 -1
  326. package/lib/_util/raf.js +0 -34
  327. package/lib/_util/raf.js.map +0 -1
  328. package/lib/_util/reactNode.d.ts +0 -3
  329. package/lib/_util/reactNode.d.ts.map +0 -1
  330. package/lib/_util/reactNode.js +0 -31
  331. package/lib/_util/reactNode.js.map +0 -1
  332. package/lib/_util/ref.d.ts +0 -4
  333. package/lib/_util/ref.d.ts.map +0 -1
  334. package/lib/_util/ref.js +0 -22
  335. package/lib/_util/ref.js.map +0 -1
  336. package/lib/_util/responsiveObserve.d.ts +0 -14
  337. package/lib/_util/responsiveObserve.d.ts.map +0 -1
  338. package/lib/_util/responsiveObserve.js +0 -83
  339. package/lib/_util/responsiveObserve.js.map +0 -1
  340. package/lib/_util/scrollTo.d.ts +0 -11
  341. package/lib/_util/scrollTo.d.ts.map +0 -1
  342. package/lib/_util/scrollTo.js +0 -34
  343. package/lib/_util/scrollTo.js.map +0 -1
  344. package/lib/_util/styleChecker.d.ts +0 -4
  345. package/lib/_util/styleChecker.d.ts.map +0 -1
  346. package/lib/_util/styleChecker.js +0 -14
  347. package/lib/_util/styleChecker.js.map +0 -1
  348. package/lib/_util/throttleByAnimationFrame.d.ts +0 -6
  349. package/lib/_util/throttleByAnimationFrame.d.ts.map +0 -1
  350. package/lib/_util/throttleByAnimationFrame.js +0 -49
  351. package/lib/_util/throttleByAnimationFrame.js.map +0 -1
  352. package/lib/_util/transButton.d.ts +0 -21
  353. package/lib/_util/transButton.d.ts.map +0 -1
  354. package/lib/_util/transButton.js +0 -112
  355. package/lib/_util/transButton.js.map +0 -1
  356. package/lib/_util/triggerEvent.d.ts +0 -2
  357. package/lib/_util/triggerEvent.d.ts.map +0 -1
  358. package/lib/_util/triggerEvent.js +0 -12
  359. package/lib/_util/triggerEvent.js.map +0 -1
  360. package/lib/_util/type.d.ts +0 -4
  361. package/lib/_util/type.d.ts.map +0 -1
  362. package/lib/_util/type.js +0 -9
  363. package/lib/_util/type.js.map +0 -1
  364. package/lib/_util/warning.d.ts +0 -5
  365. package/lib/_util/warning.d.ts.map +0 -1
  366. package/lib/_util/warning.js +0 -28
  367. package/lib/_util/warning.js.map +0 -1
  368. package/lib/_util/wave.d.ts +0 -26
  369. package/lib/_util/wave.d.ts.map +0 -1
  370. package/lib/_util/wave.js +0 -249
  371. package/lib/_util/wave.js.map +0 -1
  372. package/lib/config-provider/context.d.ts +0 -61
  373. package/lib/config-provider/context.d.ts.map +0 -1
  374. package/lib/config-provider/context.js +0 -64
  375. package/lib/config-provider/context.js.map +0 -1
  376. package/lib/tntd-form/TntdForm/components/Item.d.ts +0 -5
  377. package/lib/tntd-form/TntdForm/components/Item.d.ts.map +0 -1
  378. package/lib/tntd-form/TntdForm/components/Item.js.map +0 -1
  379. package/lib/tntd-form/TntdForm/components/ItemComp.d.ts +0 -5
  380. package/lib/tntd-form/TntdForm/components/ItemComp.d.ts.map +0 -1
  381. package/lib/tntd-form/TntdForm/components/ItemComp.js.map +0 -1
  382. package/lib/tntd-form/TntdForm/components/List.d.ts +0 -5
  383. package/lib/tntd-form/TntdForm/components/List.d.ts.map +0 -1
  384. package/lib/tntd-form/TntdForm/components/List.js.map +0 -1
  385. package/lib/tntd-form/TntdForm/index.d.ts +0 -10
  386. package/lib/tntd-form/TntdForm/index.d.ts.map +0 -1
  387. package/lib/tntd-form/TntdForm/index.js.map +0 -1
  388. package/lib/tntd-form/TntdForm/interface.d.ts +0 -93
  389. package/lib/tntd-form/TntdForm/interface.d.ts.map +0 -1
  390. package/lib/tntd-form/TntdForm/interface.js.map +0 -1
  391. package/lib/tntd-form/TntdForm/store.d.ts +0 -4
  392. package/lib/tntd-form/TntdForm/store.d.ts.map +0 -1
  393. package/lib/tntd-form/TntdForm/store.js.map +0 -1
  394. package/lib/tntd-form/TntdForm/utils.d.ts +0 -48
  395. package/lib/tntd-form/TntdForm/utils.d.ts.map +0 -1
  396. package/lib/tntd-form/TntdForm/utils.js.map +0 -1
  397. package/lib/tntd-form/__tests__/demo-extend.test.d.ts +0 -2
  398. package/lib/tntd-form/__tests__/demo-extend.test.d.ts.map +0 -1
  399. package/lib/tntd-form/__tests__/demo-extend.test.js +0 -5
  400. package/lib/tntd-form/__tests__/demo-extend.test.js.map +0 -1
  401. package/lib/tntd-form/__tests__/demo.test.d.ts +0 -2
  402. package/lib/tntd-form/__tests__/demo.test.d.ts.map +0 -1
  403. package/lib/tntd-form/__tests__/demo.test.js +0 -8
  404. package/lib/tntd-form/__tests__/demo.test.js.map +0 -1
  405. package/lib/tntd-form/__tests__/image.test.d.ts +0 -2
  406. package/lib/tntd-form/__tests__/image.test.d.ts.map +0 -1
  407. package/lib/tntd-form/__tests__/image.test.js +0 -7
  408. package/lib/tntd-form/__tests__/image.test.js.map +0 -1
  409. package/lib/tntd-form/__tests__/index.test.d.ts +0 -2
  410. package/lib/tntd-form/__tests__/index.test.d.ts.map +0 -1
  411. package/lib/tntd-form/__tests__/index.test.js +0 -981
  412. package/lib/tntd-form/__tests__/index.test.js.map +0 -1
  413. package/lib/tntd-form/__tests__/list-noStyle.test.d.ts +0 -2
  414. package/lib/tntd-form/__tests__/list-noStyle.test.d.ts.map +0 -1
  415. package/lib/tntd-form/__tests__/list-noStyle.test.js +0 -46
  416. package/lib/tntd-form/__tests__/list-noStyle.test.js.map +0 -1
  417. package/lib/tntd-form/__tests__/list.test.d.ts +0 -2
  418. package/lib/tntd-form/__tests__/list.test.d.ts.map +0 -1
  419. package/lib/tntd-form/__tests__/list.test.js +0 -169
  420. package/lib/tntd-form/__tests__/list.test.js.map +0 -1
  421. package/lib/tntd-form/__tests__/ref.test.d.ts +0 -2
  422. package/lib/tntd-form/__tests__/ref.test.d.ts.map +0 -1
  423. package/lib/tntd-form/__tests__/ref.test.js +0 -50
  424. package/lib/tntd-form/__tests__/ref.test.js.map +0 -1
  425. package/lib/tntd-form/__tests__/type.test.d.ts +0 -2
  426. package/lib/tntd-form/__tests__/type.test.d.ts.map +0 -1
  427. package/lib/tntd-form/__tests__/type.test.js +0 -98
  428. package/lib/tntd-form/__tests__/type.test.js.map +0 -1
@@ -10,41 +10,46 @@ import { validateFields, getFieldsValue, getFieldValue } from './utils';
10
10
  import { FormContext } from './store';
11
11
  import List from './components/List';
12
12
  import Item from './components/Item';
13
- const TntdForm = ({ form, initialValues, children }) => {
14
- const updateRefs = useRef({
15
- shouldUpdateList: [],
16
- dependencies: {},
17
- });
18
- const compsRefs = useRef({});
19
- return (React.createElement(FormContext.Provider, { value: {
20
- form,
21
- initialValues,
22
- updateRefs,
23
- compsRefs,
24
- } }, children));
13
+ const TntdForm = ({
14
+ form,
15
+ initialValues,
16
+ children
17
+ }) => {
18
+ const updateRefs = useRef({
19
+ shouldUpdateList: [],
20
+ dependencies: {}
21
+ });
22
+ const compsRefs = useRef({});
23
+ return React.createElement(FormContext.Provider, {
24
+ value: {
25
+ form,
26
+ initialValues,
27
+ updateRefs,
28
+ compsRefs
29
+ }
30
+ }, children);
25
31
  };
26
32
  TntdForm.useForm = () => {
27
- const form = useRef({
28
- dataLevel: {},
29
- formData: {},
30
- validateFields: () => validateFields(form.current),
31
- getFieldsValue: () => getFieldsValue(form.current),
32
- getFieldValue: (field) => getFieldValue(form.current, field),
33
- setFieldsValue: (obj) => {
34
- for (const i in obj) {
35
- if (Object.prototype.hasOwnProperty.call(obj, i)) {
36
- const prefix = (i === null || i === void 0 ? void 0 : i.split('.')) || [];
37
- const attr = prefix.pop();
38
- if (attr && form.current.formData[prefix.join('.')][attr]) {
39
- form.current.formData[prefix.join('.')][attr].setItemValue(obj[i]);
40
- }
41
- }
42
- }
43
- },
44
- });
45
- return [form.current];
33
+ const form = useRef({
34
+ dataLevel: {},
35
+ formData: {},
36
+ validateFields: () => validateFields(form.current),
37
+ getFieldsValue: () => getFieldsValue(form.current),
38
+ getFieldValue: field => getFieldValue(form.current, field),
39
+ setFieldsValue: obj => {
40
+ for (const i in obj) {
41
+ if (Object.prototype.hasOwnProperty.call(obj, i)) {
42
+ const prefix = (i === null || i === void 0 ? void 0 : i.split('.')) || [];
43
+ const attr = prefix.pop();
44
+ if (attr && form.current.formData[prefix.join('.')][attr]) {
45
+ form.current.formData[prefix.join('.')][attr].setItemValue(obj[i]);
46
+ }
47
+ }
48
+ }
49
+ }
50
+ });
51
+ return [form.current];
46
52
  };
47
53
  TntdForm.List = List;
48
54
  TntdForm.Item = Item;
49
- export default TntdForm;
50
- //# sourceMappingURL=index.js.map
55
+ export default TntdForm;
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=interface.js.map
1
+ export {};
@@ -1,3 +1,2 @@
1
1
  import React from 'react';
2
- export const FormContext = React.createContext({});
3
- //# sourceMappingURL=store.js.map
2
+ export const FormContext = React.createContext({});
@@ -1,21 +1,20 @@
1
1
  export const isValidKey = (key, object) => {
2
- return key in object;
2
+ return key in object;
3
3
  };
4
4
  /**
5
5
  * 将xx.xx.xx 转换为数组
6
6
  * @param {*} name
7
7
  * @returns
8
8
  */
9
- export const getNames = (name) => {
10
- let attrs = [];
11
- if (Array.isArray(name)) {
12
- const [str, ...rest] = name;
13
- attrs = str.split('.').concat(rest);
14
- }
15
- else {
16
- attrs = typeof name === 'string' ? name.split('.') : [];
17
- }
18
- return attrs;
9
+ export const getNames = name => {
10
+ let attrs = [];
11
+ if (Array.isArray(name)) {
12
+ const [str, ...rest] = name;
13
+ attrs = str.split('.').concat(rest);
14
+ } else {
15
+ attrs = typeof name === 'string' ? name.split('.') : [];
16
+ }
17
+ return attrs;
19
18
  };
20
19
  /**
21
20
  * 对数据进行校验
@@ -25,34 +24,32 @@ export const getNames = (name) => {
25
24
  * @returns
26
25
  */
27
26
  export const recursionCheck = (list, dataLevel, formData, errorList = []) => {
28
- try {
29
- if (Array.isArray(list)) {
30
- list.forEach((item) => {
31
- const key = item.name;
32
- const attrs = Object.keys(formData[key]);
33
- attrs.forEach((attr) => {
34
- var _a;
35
- const error = (_a = formData[item.name][attr]) === null || _a === void 0 ? void 0 : _a.checkItem();
36
- if (error) {
37
- errorList.push(`${[item.name + '.' + attr]}:`, error);
38
- }
39
- });
40
- if (dataLevel[key]) {
41
- recursionCheck(dataLevel[key], dataLevel, formData, errorList);
42
- }
43
- });
27
+ try {
28
+ if (Array.isArray(list)) {
29
+ list.forEach(item => {
30
+ const key = item.name;
31
+ const attrs = Object.keys(formData[key]);
32
+ attrs.forEach(attr => {
33
+ var _a;
34
+ const error = (_a = formData[item.name][attr]) === null || _a === void 0 ? void 0 : _a.checkItem();
35
+ if (error) {
36
+ errorList.push(`${[item.name + '.' + attr]}:`, error);
37
+ }
38
+ });
39
+ if (dataLevel[key]) {
40
+ recursionCheck(dataLevel[key], dataLevel, formData, errorList);
44
41
  }
45
- return errorList;
42
+ });
46
43
  }
47
- catch (e) {
48
- if (typeof e === 'string') {
49
- throw e.toUpperCase();
50
- }
51
- else if (e instanceof Error) {
52
- throw e.message;
53
- }
54
- throw e;
44
+ return errorList;
45
+ } catch (e) {
46
+ if (typeof e === 'string') {
47
+ throw e.toUpperCase();
48
+ } else if (e instanceof Error) {
49
+ throw e.message;
55
50
  }
51
+ throw e;
52
+ }
56
53
  };
57
54
  /**
58
55
  * 将数据进行排序
@@ -63,78 +60,74 @@ export const recursionCheck = (list, dataLevel, formData, errorList = []) => {
63
60
  * @returns
64
61
  */
65
62
  export const recursionSort = (list, dataLevel, formData) => {
66
- try {
67
- if (Array.isArray(list)) {
68
- const values = list.reduce((total, item, index) => {
69
- const attrObj = {};
70
- const key = item.name;
71
- const prefixs = key.split('.');
72
- const attrs = formData[key] ? Object.keys(formData[key]) : [];
73
- attrs.forEach((attr) => {
74
- var _a;
75
- attrObj[attr] = (_a = formData[key][attr]) === null || _a === void 0 ? void 0 : _a.value;
76
- });
77
- let children = [];
78
- if (dataLevel[key]) {
79
- children = recursionSort(dataLevel[key], dataLevel, formData);
80
- }
81
- const len = prefixs.length - 2;
82
- if (total[prefixs[len]]) {
83
- total[prefixs[len]][index] = Object.assign(Object.assign({}, attrObj), (children || []));
84
- }
85
- else {
86
- total[prefixs[len]] = [
87
- Object.assign(Object.assign({}, attrObj), (children || [])),
88
- ];
89
- }
90
- return total;
91
- }, {});
92
- return values;
93
- }
63
+ try {
64
+ if (Array.isArray(list)) {
65
+ const values = list.reduce((total, item, index) => {
66
+ const attrObj = {};
67
+ const key = item.name;
68
+ const prefixs = key.split('.');
69
+ const attrs = formData[key] ? Object.keys(formData[key]) : [];
70
+ attrs.forEach(attr => {
71
+ var _a;
72
+ attrObj[attr] = (_a = formData[key][attr]) === null || _a === void 0 ? void 0 : _a.value;
73
+ });
74
+ let children = [];
75
+ if (dataLevel[key]) {
76
+ children = recursionSort(dataLevel[key], dataLevel, formData);
77
+ }
78
+ const len = prefixs.length - 2;
79
+ if (total[prefixs[len]]) {
80
+ total[prefixs[len]][index] = Object.assign(Object.assign({}, attrObj), children || []);
81
+ } else {
82
+ total[prefixs[len]] = [Object.assign(Object.assign({}, attrObj), children || [])];
83
+ }
84
+ return total;
85
+ }, {});
86
+ return values;
94
87
  }
95
- catch (e) {
96
- if (typeof e === 'string') {
97
- console.error(e.toUpperCase());
98
- throw e.toUpperCase();
99
- }
100
- else if (e instanceof Error) {
101
- console.error(e.message);
102
- throw e.message;
103
- }
104
- throw e;
88
+ } catch (e) {
89
+ if (typeof e === 'string') {
90
+ console.error(e.toUpperCase());
91
+ throw e.toUpperCase();
92
+ } else if (e instanceof Error) {
93
+ console.error(e.message);
94
+ throw e.message;
105
95
  }
96
+ throw e;
97
+ }
106
98
  };
107
99
  /**
108
100
  * 获取form表单的value
109
101
  * @param {*} formCurrent
110
102
  * @returns
111
103
  */
112
- export const getFieldsValue = (formCurrent) => {
113
- try {
114
- const { formData, dataLevel } = formCurrent;
115
- let firstKey = '';
116
- // 这里不直接用Object.keys的原因是Object.keys并不能保证一定是按照属性顺序
117
- for (const i in dataLevel) {
118
- if (Object.prototype.hasOwnProperty.call(dataLevel, i)) {
119
- firstKey = i;
120
- break;
121
- }
122
- }
123
- const recursionStart = dataLevel[firstKey];
124
- const values = recursionSort(recursionStart, dataLevel, formData);
125
- return values;
104
+ export const getFieldsValue = formCurrent => {
105
+ try {
106
+ const {
107
+ formData,
108
+ dataLevel
109
+ } = formCurrent;
110
+ let firstKey = '';
111
+ // 这里不直接用Object.keys的原因是Object.keys并不能保证一定是按照属性顺序
112
+ for (const i in dataLevel) {
113
+ if (Object.prototype.hasOwnProperty.call(dataLevel, i)) {
114
+ firstKey = i;
115
+ break;
116
+ }
126
117
  }
127
- catch (e) {
128
- if (typeof e === 'string') {
129
- console.error(e.toUpperCase());
130
- return e.toUpperCase();
131
- }
132
- else if (e instanceof Error) {
133
- console.error(e.message);
134
- return e.message;
135
- }
136
- return e;
118
+ const recursionStart = dataLevel[firstKey];
119
+ const values = recursionSort(recursionStart, dataLevel, formData);
120
+ return values;
121
+ } catch (e) {
122
+ if (typeof e === 'string') {
123
+ console.error(e.toUpperCase());
124
+ return e.toUpperCase();
125
+ } else if (e instanceof Error) {
126
+ console.error(e.message);
127
+ return e.message;
137
128
  }
129
+ return e;
130
+ }
138
131
  };
139
132
  /**
140
133
  * 获取form表单的value
@@ -142,88 +135,85 @@ export const getFieldsValue = (formCurrent) => {
142
135
  * @returns
143
136
  */
144
137
  export const getFieldValue = (formCurrent, field) => {
145
- var _a, _b;
146
- try {
147
- const { formData } = formCurrent;
148
- return formData && ((_b = (_a = formData === null || formData === void 0 ? void 0 : formData[field[0]]) === null || _a === void 0 ? void 0 : _a[field[1]]) === null || _b === void 0 ? void 0 : _b.value);
149
- }
150
- catch (e) {
151
- if (typeof e === 'string') {
152
- return e.toUpperCase();
153
- }
154
- else if (e instanceof Error) {
155
- return e.message;
156
- }
157
- return e;
138
+ var _a, _b;
139
+ try {
140
+ const {
141
+ formData
142
+ } = formCurrent;
143
+ return formData && ((_b = (_a = formData === null || formData === void 0 ? void 0 : formData[field[0]]) === null || _a === void 0 ? void 0 : _a[field[1]]) === null || _b === void 0 ? void 0 : _b.value);
144
+ } catch (e) {
145
+ if (typeof e === 'string') {
146
+ return e.toUpperCase();
147
+ } else if (e instanceof Error) {
148
+ return e.message;
158
149
  }
150
+ return e;
151
+ }
159
152
  };
160
153
  /**
161
154
  * 提交时候校验的方法
162
155
  * @param {*} formCurrent
163
156
  * @returns
164
157
  */
165
- export const validateFields = (formCurrent) => {
166
- return new Promise((resolve) => {
167
- const { formData, dataLevel } = formCurrent;
168
- let firstKey = '';
169
- // 这里不直接用Object.keys的原因是Object.keys并不能保证一定是按照属性顺序
170
- for (const i in dataLevel) {
171
- if (Object.prototype.hasOwnProperty.call(dataLevel, i)) {
172
- firstKey = i;
173
- break;
174
- }
175
- }
176
- const recursionStart = dataLevel[firstKey];
177
- const errorList = recursionCheck(recursionStart, dataLevel, formData);
178
- if (Array.isArray(errorList) && errorList.length) {
179
- console.error(JSON.stringify(errorList));
180
- }
181
- else {
182
- resolve(recursionSort(recursionStart, dataLevel, formData));
183
- }
184
- });
158
+ export const validateFields = formCurrent => {
159
+ return new Promise(resolve => {
160
+ const {
161
+ formData,
162
+ dataLevel
163
+ } = formCurrent;
164
+ let firstKey = '';
165
+ // 这里不直接用Object.keys的原因是Object.keys并不能保证一定是按照属性顺序
166
+ for (const i in dataLevel) {
167
+ if (Object.prototype.hasOwnProperty.call(dataLevel, i)) {
168
+ firstKey = i;
169
+ break;
170
+ }
171
+ }
172
+ const recursionStart = dataLevel[firstKey];
173
+ const errorList = recursionCheck(recursionStart, dataLevel, formData);
174
+ if (Array.isArray(errorList) && errorList.length) {
175
+ console.error(JSON.stringify(errorList));
176
+ } else {
177
+ resolve(recursionSort(recursionStart, dataLevel, formData));
178
+ }
179
+ });
185
180
  };
186
181
  /** 获取初始化的值 */
187
182
  export const getInitValue = (initialValues, names) => {
188
- let keys = [];
189
- if (Array.isArray(names)) {
190
- const [str, ...rest] = names;
191
- keys = str.split('.').concat(rest);
192
- }
193
- if (Array.isArray(keys) && !!keys.length) {
194
- keys.forEach((i) => {
195
- initialValues = ['', null, undefined].includes(initialValues === null || initialValues === void 0 ? void 0 : initialValues[i])
196
- ? undefined
197
- : initialValues === null || initialValues === void 0 ? void 0 : initialValues[i];
198
- });
199
- }
200
- return initialValues;
183
+ let keys = [];
184
+ if (Array.isArray(names)) {
185
+ const [str, ...rest] = names;
186
+ keys = str.split('.').concat(rest);
187
+ }
188
+ if (Array.isArray(keys) && !!keys.length) {
189
+ keys.forEach(i => {
190
+ initialValues = ['', null, undefined].includes(initialValues === null || initialValues === void 0 ? void 0 : initialValues[i]) ? undefined : initialValues === null || initialValues === void 0 ? void 0 : initialValues[i];
191
+ });
192
+ }
193
+ return initialValues;
201
194
  };
202
195
  /** 校验表单是否正确的方法 */
203
196
  export const handleCheckItem = (value, rules) => {
204
- try {
205
- if (Array.isArray(rules)) {
206
- rules.forEach((i) => {
207
- // @ts-ignore
208
- if (i.required && ['', null, undefined].includes(value)) {
209
- throw new Error((i === null || i === void 0 ? void 0 : i.message) || 'error');
210
- }
211
- if (i === null || i === void 0 ? void 0 : i.validator) {
212
- i.validator(rules, value, function (_errorMsg) {
213
- throw new Error(_errorMsg);
214
- });
215
- }
216
- });
217
- }
218
- return;
197
+ try {
198
+ if (Array.isArray(rules)) {
199
+ rules.forEach(i => {
200
+ // @ts-ignore
201
+ if (i.required && ['', null, undefined].includes(value)) {
202
+ throw new Error((i === null || i === void 0 ? void 0 : i.message) || 'error');
203
+ }
204
+ if (i === null || i === void 0 ? void 0 : i.validator) {
205
+ i.validator(rules, value, function (_errorMsg) {
206
+ throw new Error(_errorMsg);
207
+ });
208
+ }
209
+ });
219
210
  }
220
- catch (e) {
221
- if (typeof e === 'string') {
222
- return e.toUpperCase();
223
- }
224
- else if (e instanceof Error) {
225
- return e.message;
226
- }
211
+ return;
212
+ } catch (e) {
213
+ if (typeof e === 'string') {
214
+ return e.toUpperCase();
215
+ } else if (e instanceof Error) {
216
+ return e.message;
227
217
  }
228
- };
229
- //# sourceMappingURL=utils.js.map
218
+ }
219
+ };
@@ -13,8 +13,8 @@ import React, { useEffect, useRef, useState } from 'react';
13
13
  import Form from './index';
14
14
  import { Input, InputNumber, Checkbox, Button, Select, Radio, Row, message, Icon, Modal, Drawer, Cascader, DatePicker, TimePicker, TreeSelect, Switch, Upload, } from '../index';
15
15
  import moment from 'moment';
16
- const { TreeNode } = TreeSelect;
17
16
  const { Option } = Select;
17
+ const { TreeNode } = TreeSelect;
18
18
  const options = [
19
19
  { label: 'Apple', value: 'apple' },
20
20
  { label: 'Pear', value: 'pear' },
@@ -50,8 +50,8 @@ Basic.args = {
50
50
  React.createElement(Input, null)),
51
51
  React.createElement(Form.Item, { label: "Password", name: "password", rules: [{ required: true, message: 'Please input your password!' }] },
52
52
  React.createElement(Input.Password, null)),
53
- React.createElement(Form.Item, { label: "TreeSelect", name: "treeSelect" },
54
- React.createElement(TreeSelect, { treeDefaultExpandAll: true, showSearch: true },
53
+ React.createElement(Form.Item, { label: "TreeSelect", name: "treeSelect", rules: [{ required: true, message: 'Please select one node' }] },
54
+ React.createElement(TreeSelect, { showSearch: true, treeDefaultExpandAll: true, allowClear: true },
55
55
  React.createElement(TreeNode, { value: "parent 1", title: "parent 1", key: "0-1" },
56
56
  React.createElement(TreeNode, { value: "parent 1-0", title: "parent 1-0", key: "0-1-1" },
57
57
  React.createElement(TreeNode, { value: "leaf1", title: "my leaf", key: "random" }),
@@ -268,13 +268,14 @@ export const DynamicItemsComplex = DynamicItemsComplexTpl.bind({});
268
268
  // 弹窗中表单
269
269
  const FormInModalTpl = () => {
270
270
  const [data, setData] = useState({});
271
+ const [destroyOnClose, setDestroyOnClose] = useState(true);
271
272
  const [popupType, setPopupType] = useState('modal');
272
273
  const PopupCom = {
273
274
  modal: Modal,
274
275
  drawer: Drawer,
275
276
  }[popupType];
276
- const [form] = Form.useForm();
277
277
  const close = () => setData(null);
278
+ const [form] = Form.useForm();
278
279
  return (React.createElement(React.Fragment, null,
279
280
  React.createElement(Button, { type: "primary", onClick: () => setData({}), style: { marginRight: 12 } }, "\u65B0\u5EFA"),
280
281
  React.createElement(Button, { type: "primary", style: { marginRight: 12, marginBottom: 12 }, onClick: () => setData({
@@ -286,7 +287,8 @@ const FormInModalTpl = () => {
286
287
  React.createElement(Radio.Group, { value: popupType, onChange: (evt) => setPopupType(evt.target.value) },
287
288
  React.createElement(Radio.Button, { value: "modal" }, "\u5F39\u7A97"),
288
289
  React.createElement(Radio.Button, { value: "drawer" }, "\u62BD\u5C49")),
289
- React.createElement(PopupCom, { title: `${(data === null || data === void 0 ? void 0 : data.id) ? '编辑' : '新建'}`, visible: !!data, width: "40%", destroyOnClose: true, onClose: close, onCancel: close, onOk: close },
290
+ React.createElement(Switch, { onClick: () => setDestroyOnClose(!destroyOnClose), checked: destroyOnClose, checkedChildren: "\u5173\u95ED\u65F6\u9500\u6BC1\u5B50\u5143\u7D20", unCheckedChildren: "\u5173\u95ED\u65F6\u4E0D\u9500\u6BC1\u5B50\u5143\u7D20" }),
291
+ React.createElement(PopupCom, { title: `${(data === null || data === void 0 ? void 0 : data.id) ? '编辑' : '新建'}`, visible: !!data, width: "40%", destroyOnClose: destroyOnClose, onClose: close, onCancel: close, onOk: close },
290
292
  React.createElement(Form, { initialValues: data, form: form },
291
293
  React.createElement(Form.Item, { name: "name", label: "\u540D\u79F0" },
292
294
  React.createElement(Input, null)),