@teamix/pro 1.0.22 → 1.1.0

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 (443) hide show
  1. package/dist/all.css +1 -1
  2. package/dist/all.js +12421 -13334
  3. package/dist/all.min.css +1 -1
  4. package/dist/all.min.js +1 -1
  5. package/es/actions/base.d.ts +13 -0
  6. package/es/actions/base.js +23 -0
  7. package/es/actions/confirm.d.ts +7 -0
  8. package/es/actions/confirm.js +11 -0
  9. package/es/actions/danger-confirm.d.ts +7 -0
  10. package/es/actions/danger-confirm.js +14 -0
  11. package/es/actions/dialog-component.d.ts +10 -0
  12. package/es/actions/dialog-component.js +25 -0
  13. package/es/actions/dialog-form.d.ts +15 -0
  14. package/es/actions/dialog-form.js +129 -0
  15. package/es/actions/dialog-table.d.ts +4 -0
  16. package/es/actions/dialog-table.js +1 -0
  17. package/es/actions/dialog.d.ts +17 -0
  18. package/es/actions/dialog.js +197 -0
  19. package/es/actions/drawer-form.d.ts +6 -0
  20. package/es/actions/drawer-form.js +7 -0
  21. package/es/actions/drawer-table.d.ts +2 -0
  22. package/es/actions/drawer-table.js +1 -0
  23. package/es/actions/drawer.d.ts +6 -0
  24. package/es/actions/drawer.js +7 -0
  25. package/es/actions/error.d.ts +7 -0
  26. package/es/actions/error.js +11 -0
  27. package/es/actions/index.d.ts +76 -0
  28. package/es/actions/index.js +317 -0
  29. package/es/actions/index.scss +34 -0
  30. package/es/actions/link.d.ts +14 -0
  31. package/es/actions/link.js +45 -0
  32. package/es/actions/notice.d.ts +7 -0
  33. package/es/actions/notice.js +11 -0
  34. package/es/actions/request.d.ts +9 -0
  35. package/es/actions/request.js +60 -0
  36. package/es/card/index.d.ts +30 -0
  37. package/es/card/index.js +159 -0
  38. package/es/card/index.scss +98 -0
  39. package/es/field/index.d.ts +3 -0
  40. package/es/field/index.js +3 -0
  41. package/es/form/Components/Editable/index.d.ts +20 -0
  42. package/es/form/Components/Editable/index.js +228 -0
  43. package/es/form/Components/FormGroup/index.d.ts +13 -0
  44. package/es/form/Components/FormGroup/index.js +89 -0
  45. package/es/form/Components/FormGroup/index.scss +23 -0
  46. package/es/form/Components/ProField/index.d.ts +150 -0
  47. package/es/form/Components/ProField/index.js +53 -0
  48. package/es/form/Components/Query/index.d.ts +4 -0
  49. package/es/form/Components/Query/index.js +70 -0
  50. package/es/form/Components/Query/index.scss +90 -0
  51. package/es/form/Components/QueryFilter/index.d.ts +3 -0
  52. package/es/form/Components/QueryFilter/index.js +111 -0
  53. package/es/form/Components/Search/index.d.ts +11 -0
  54. package/es/form/Components/Search/index.js +89 -0
  55. package/es/form/Filter/index.d.ts +16 -0
  56. package/es/form/Filter/index.js +218 -0
  57. package/es/form/ProForm/index.d.ts +5 -0
  58. package/es/form/ProForm/index.js +100 -0
  59. package/es/form/ProForm/index.scss +248 -0
  60. package/es/form/SchemaForm/adapterComponent.d.ts +5 -0
  61. package/es/form/SchemaForm/adapterComponent.js +17 -0
  62. package/es/form/SchemaForm/adapterDecorator.d.ts +6 -0
  63. package/es/form/SchemaForm/adapterDecorator.js +28 -0
  64. package/es/form/SchemaForm/adapterType.d.ts +5 -0
  65. package/es/form/SchemaForm/adapterType.js +54 -0
  66. package/es/form/SchemaForm/index.d.ts +4 -0
  67. package/es/form/SchemaForm/index.js +258 -0
  68. package/es/form/SchemaForm/initializeArrayCards.d.ts +3 -0
  69. package/es/form/SchemaForm/initializeArrayCards.js +69 -0
  70. package/es/form/SchemaForm/initializeArrayCollapse.d.ts +3 -0
  71. package/es/form/SchemaForm/initializeArrayCollapse.js +78 -0
  72. package/es/form/SchemaForm/initializeArrayIcon.d.ts +3 -0
  73. package/es/form/SchemaForm/initializeArrayIcon.js +50 -0
  74. package/es/form/SchemaForm/initializeArrayItems.d.ts +3 -0
  75. package/es/form/SchemaForm/initializeArrayItems.js +97 -0
  76. package/es/form/SchemaForm/initializeArrayTable.d.ts +3 -0
  77. package/es/form/SchemaForm/initializeArrayTable.js +66 -0
  78. package/es/form/SchemaForm/initializeFormButton.d.ts +3 -0
  79. package/es/form/SchemaForm/initializeFormButton.js +75 -0
  80. package/es/form/SchemaForm/initializeFormCollapse.d.ts +3 -0
  81. package/es/form/SchemaForm/initializeFormCollapse.js +43 -0
  82. package/es/form/SchemaForm/initializeFormGroup.d.ts +3 -0
  83. package/es/form/SchemaForm/initializeFormGroup.js +46 -0
  84. package/es/form/SchemaForm/initializeFormStep.d.ts +3 -0
  85. package/es/form/SchemaForm/initializeFormStep.js +48 -0
  86. package/es/form/SchemaForm/initializeFormTab.d.ts +3 -0
  87. package/es/form/SchemaForm/initializeFormTab.js +53 -0
  88. package/es/form/SchemaForm/initializeProField.d.ts +5 -0
  89. package/es/form/SchemaForm/initializeProField.js +69 -0
  90. package/es/form/SchemaForm/initializeRequest.d.ts +11 -0
  91. package/es/form/SchemaForm/initializeRequest.js +25 -0
  92. package/es/form/SchemaForm/reactions.d.ts +4 -0
  93. package/es/form/SchemaForm/reactions.js +62 -0
  94. package/es/form/index.d.ts +20 -0
  95. package/es/form/index.js +24 -0
  96. package/es/form/typing.d.ts +78 -0
  97. package/es/form/typing.js +1 -0
  98. package/es/form/utils.d.ts +9 -0
  99. package/es/form/utils.js +108 -0
  100. package/es/form/warning.d.ts +3 -0
  101. package/es/form/warning.js +20 -0
  102. package/es/hooks/index.d.ts +2 -0
  103. package/es/hooks/index.js +2 -0
  104. package/es/index.d.ts +24 -22
  105. package/es/index.js +25 -23
  106. package/es/info/components/FormItem/index.d.ts +5 -0
  107. package/es/info/components/FormItem/index.js +63 -0
  108. package/es/info/components/FormItem/index.scss +49 -0
  109. package/es/info/components/InfoGroup/index.d.ts +5 -0
  110. package/es/info/components/InfoGroup/index.js +16 -0
  111. package/es/info/components/InfoGroup/index.scss +8 -0
  112. package/es/info/components/InfoValueItem/index.d.ts +5 -0
  113. package/es/info/components/InfoValueItem/index.js +211 -0
  114. package/es/info/components/InfoValueItem/index.scss +21 -0
  115. package/es/info/components/baseInfo/index.d.ts +7 -0
  116. package/es/info/components/baseInfo/index.js +72 -0
  117. package/es/info/components/baseInfo/index.scss +3 -0
  118. package/es/info/components/headerInfo/index.d.ts +7 -0
  119. package/es/info/components/headerInfo/index.js +84 -0
  120. package/es/info/components/headerInfo/index.scss +0 -0
  121. package/es/info/components/tableInfo/index.d.ts +8 -0
  122. package/es/info/components/tableInfo/index.js +172 -0
  123. package/es/info/components/tableInfo/index.scss +18 -0
  124. package/es/info/index.d.ts +9 -0
  125. package/es/info/index.js +85 -0
  126. package/es/info/index.scss +8 -0
  127. package/es/info/typing.d.ts +143 -0
  128. package/es/info/typing.js +1 -0
  129. package/es/info/utils/index.d.ts +3 -0
  130. package/es/info/utils/index.js +12 -0
  131. package/es/info/utils/layout.d.ts +2 -0
  132. package/es/info/utils/layout.js +58 -0
  133. package/es/info/utils/useInfoRequest.d.ts +14 -0
  134. package/es/info/utils/useInfoRequest.js +73 -0
  135. package/es/info/utils/utils.d.ts +1 -0
  136. package/es/info/utils/utils.js +13 -0
  137. package/es/layout/index.d.ts +3 -0
  138. package/es/layout/index.js +3 -0
  139. package/es/nocode/configurators/Card.d.ts +3 -0
  140. package/es/nocode/configurators/Card.js +109 -0
  141. package/es/nocode/configurators/PageHeader.d.ts +3 -0
  142. package/es/nocode/configurators/PageHeader.js +196 -0
  143. package/es/nocode/configurators/ProTable.d.ts +3 -0
  144. package/es/nocode/configurators/ProTable.js +317 -0
  145. package/es/nocode/configurators/common.d.ts +176 -0
  146. package/es/nocode/configurators/common.js +314 -0
  147. package/es/nocode/configurators/index.d.ts +15 -0
  148. package/es/nocode/configurators/index.js +27 -0
  149. package/es/nocode/configurators/map.d.ts +2 -0
  150. package/es/nocode/configurators/map.js +8 -0
  151. package/es/nocode/index.d.ts +8 -0
  152. package/es/nocode/index.js +11 -0
  153. package/es/nocode/index.scss +93 -0
  154. package/es/nocode/pages/editor.d.ts +12 -0
  155. package/es/nocode/pages/editor.js +40 -0
  156. package/es/nocode/pages/index.d.ts +14 -0
  157. package/es/nocode/pages/index.js +41 -0
  158. package/es/nocode/pages/playground.d.ts +11 -0
  159. package/es/nocode/pages/playground.js +130 -0
  160. package/es/nocode/pages/renderer.d.ts +10 -0
  161. package/es/nocode/pages/renderer.js +144 -0
  162. package/es/nocode/playground.d.ts +14 -0
  163. package/es/nocode/playground.js +68 -0
  164. package/es/page-container/index.d.ts +3 -0
  165. package/es/page-container/index.js +3 -0
  166. package/es/page-header/index.d.ts +42 -0
  167. package/es/page-header/index.js +222 -0
  168. package/es/page-header/index.scss +171 -0
  169. package/es/skeleton/index.d.ts +3 -0
  170. package/es/skeleton/index.js +3 -0
  171. package/es/table/components/Filter/index.d.ts +9 -0
  172. package/es/table/components/Filter/index.js +231 -0
  173. package/es/table/components/Filter/index.scss +23 -0
  174. package/es/table/components/Layout/index.d.ts +5 -0
  175. package/es/table/components/Layout/index.js +241 -0
  176. package/es/table/components/Layout/index.scss +39 -0
  177. package/es/table/components/QuickAction/index.d.ts +10 -0
  178. package/es/table/components/QuickAction/index.js +53 -0
  179. package/es/table/components/QuickAction/index.scss +0 -0
  180. package/es/table/components/ToolBar/DensityIcon.d.ts +4 -0
  181. package/es/table/components/ToolBar/DensityIcon.js +117 -0
  182. package/es/table/components/ToolBar/FilterColumnIcon.d.ts +4 -0
  183. package/es/table/components/ToolBar/FilterColumnIcon.js +284 -0
  184. package/es/table/components/ToolBar/FullScreenIcon.d.ts +4 -0
  185. package/es/table/components/ToolBar/FullScreenIcon.js +89 -0
  186. package/es/table/components/ToolBar/Fullscreen.d.ts +10 -0
  187. package/es/table/components/ToolBar/Fullscreen.js +68 -0
  188. package/es/table/components/ToolBar/RefreshIcon.d.ts +4 -0
  189. package/es/table/components/ToolBar/RefreshIcon.js +45 -0
  190. package/es/table/components/ToolBar/index.d.ts +5 -0
  191. package/es/table/components/ToolBar/index.js +79 -0
  192. package/es/table/components/ToolBar/index.scss +110 -0
  193. package/es/table/index.d.ts +7 -0
  194. package/es/table/index.js +620 -0
  195. package/es/table/index.scss +104 -0
  196. package/es/table/typing.d.ts +222 -0
  197. package/es/table/typing.js +1 -0
  198. package/es/table/utils/columnRender.d.ts +13 -0
  199. package/es/table/utils/columnRender.js +185 -0
  200. package/es/table/utils/genProColumnToColumn.d.ts +9 -0
  201. package/es/table/utils/genProColumnToColumn.js +51 -0
  202. package/es/table/utils/getTableProps.d.ts +2 -0
  203. package/es/table/utils/getTableProps.js +4 -0
  204. package/es/table/utils/getTableSortIcons.d.ts +3 -0
  205. package/es/table/utils/getTableSortIcons.js +21 -0
  206. package/es/table/utils/index.d.ts +4 -0
  207. package/es/table/utils/index.js +100 -0
  208. package/es/table/utils/useTableSelection.d.ts +3 -0
  209. package/es/table/utils/useTableSelection.js +107 -0
  210. package/es/templates/Detail/index.d.ts +2 -0
  211. package/es/templates/Detail/index.js +5 -0
  212. package/es/templates/Detail/index.scss +3 -0
  213. package/es/templates/Form/index.d.ts +2 -0
  214. package/es/templates/Form/index.js +5 -0
  215. package/es/templates/Form/index.scss +3 -0
  216. package/es/templates/List/index.d.ts +9 -0
  217. package/es/templates/List/index.js +45 -0
  218. package/es/templates/List/index.scss +3 -0
  219. package/es/templates/index.d.ts +5 -0
  220. package/es/templates/index.js +7 -0
  221. package/es/templates/index.scss +3 -0
  222. package/es/utils/index.d.ts +2 -0
  223. package/es/utils/index.js +2 -0
  224. package/lib/actions/base.d.ts +13 -0
  225. package/lib/actions/base.js +33 -0
  226. package/lib/actions/confirm.d.ts +7 -0
  227. package/lib/actions/confirm.js +25 -0
  228. package/lib/actions/danger-confirm.d.ts +7 -0
  229. package/lib/actions/danger-confirm.js +28 -0
  230. package/lib/actions/dialog-component.d.ts +10 -0
  231. package/lib/actions/dialog-component.js +39 -0
  232. package/lib/actions/dialog-form.d.ts +15 -0
  233. package/lib/actions/dialog-form.js +152 -0
  234. package/lib/actions/dialog-table.d.ts +4 -0
  235. package/lib/actions/dialog-table.js +5 -0
  236. package/lib/actions/dialog.d.ts +17 -0
  237. package/lib/actions/dialog.js +219 -0
  238. package/lib/actions/drawer-form.d.ts +6 -0
  239. package/lib/actions/drawer-form.js +18 -0
  240. package/lib/actions/drawer-table.d.ts +2 -0
  241. package/lib/actions/drawer-table.js +5 -0
  242. package/lib/actions/drawer.d.ts +6 -0
  243. package/lib/actions/drawer.js +20 -0
  244. package/lib/actions/error.d.ts +7 -0
  245. package/lib/actions/error.js +25 -0
  246. package/lib/actions/index.d.ts +76 -0
  247. package/lib/actions/index.js +356 -0
  248. package/lib/actions/index.scss +34 -0
  249. package/lib/actions/link.d.ts +14 -0
  250. package/lib/actions/link.js +60 -0
  251. package/lib/actions/notice.d.ts +7 -0
  252. package/lib/actions/notice.js +25 -0
  253. package/lib/actions/request.d.ts +9 -0
  254. package/lib/actions/request.js +75 -0
  255. package/lib/card/index.d.ts +30 -0
  256. package/lib/card/index.js +179 -0
  257. package/lib/card/index.scss +98 -0
  258. package/lib/field/index.d.ts +3 -0
  259. package/lib/field/index.js +30 -0
  260. package/lib/form/Components/Editable/index.d.ts +20 -0
  261. package/lib/form/Components/Editable/index.js +251 -0
  262. package/lib/form/Components/FormGroup/index.d.ts +13 -0
  263. package/lib/form/Components/FormGroup/index.js +103 -0
  264. package/lib/form/Components/FormGroup/index.scss +23 -0
  265. package/lib/form/Components/ProField/index.d.ts +150 -0
  266. package/lib/form/Components/ProField/index.js +68 -0
  267. package/lib/form/Components/Query/index.d.ts +4 -0
  268. package/lib/form/Components/Query/index.js +91 -0
  269. package/lib/form/Components/Query/index.scss +90 -0
  270. package/lib/form/Components/QueryFilter/index.d.ts +3 -0
  271. package/lib/form/Components/QueryFilter/index.js +130 -0
  272. package/lib/form/Components/Search/index.d.ts +11 -0
  273. package/lib/form/Components/Search/index.js +103 -0
  274. package/lib/form/Filter/index.d.ts +16 -0
  275. package/lib/form/Filter/index.js +242 -0
  276. package/lib/form/ProForm/index.d.ts +5 -0
  277. package/lib/form/ProForm/index.js +125 -0
  278. package/lib/form/ProForm/index.scss +248 -0
  279. package/lib/form/SchemaForm/adapterComponent.d.ts +5 -0
  280. package/lib/form/SchemaForm/adapterComponent.js +27 -0
  281. package/lib/form/SchemaForm/adapterDecorator.d.ts +6 -0
  282. package/lib/form/SchemaForm/adapterDecorator.js +34 -0
  283. package/lib/form/SchemaForm/adapterType.d.ts +5 -0
  284. package/lib/form/SchemaForm/adapterType.js +64 -0
  285. package/lib/form/SchemaForm/index.d.ts +4 -0
  286. package/lib/form/SchemaForm/index.js +301 -0
  287. package/lib/form/SchemaForm/initializeArrayCards.d.ts +3 -0
  288. package/lib/form/SchemaForm/initializeArrayCards.js +76 -0
  289. package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +3 -0
  290. package/lib/form/SchemaForm/initializeArrayCollapse.js +85 -0
  291. package/lib/form/SchemaForm/initializeArrayIcon.d.ts +3 -0
  292. package/lib/form/SchemaForm/initializeArrayIcon.js +61 -0
  293. package/lib/form/SchemaForm/initializeArrayItems.d.ts +3 -0
  294. package/lib/form/SchemaForm/initializeArrayItems.js +104 -0
  295. package/lib/form/SchemaForm/initializeArrayTable.d.ts +3 -0
  296. package/lib/form/SchemaForm/initializeArrayTable.js +73 -0
  297. package/lib/form/SchemaForm/initializeFormButton.d.ts +3 -0
  298. package/lib/form/SchemaForm/initializeFormButton.js +82 -0
  299. package/lib/form/SchemaForm/initializeFormCollapse.d.ts +3 -0
  300. package/lib/form/SchemaForm/initializeFormCollapse.js +50 -0
  301. package/lib/form/SchemaForm/initializeFormGroup.d.ts +3 -0
  302. package/lib/form/SchemaForm/initializeFormGroup.js +53 -0
  303. package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -0
  304. package/lib/form/SchemaForm/initializeFormStep.js +55 -0
  305. package/lib/form/SchemaForm/initializeFormTab.d.ts +3 -0
  306. package/lib/form/SchemaForm/initializeFormTab.js +60 -0
  307. package/lib/form/SchemaForm/initializeProField.d.ts +5 -0
  308. package/lib/form/SchemaForm/initializeProField.js +76 -0
  309. package/lib/form/SchemaForm/initializeRequest.d.ts +11 -0
  310. package/lib/form/SchemaForm/initializeRequest.js +34 -0
  311. package/lib/form/SchemaForm/reactions.d.ts +4 -0
  312. package/lib/form/SchemaForm/reactions.js +72 -0
  313. package/lib/form/index.d.ts +20 -0
  314. package/lib/form/index.js +149 -0
  315. package/lib/form/typing.d.ts +78 -0
  316. package/lib/form/typing.js +5 -0
  317. package/lib/form/utils.d.ts +9 -0
  318. package/lib/form/utils.js +124 -0
  319. package/lib/form/warning.d.ts +3 -0
  320. package/lib/form/warning.js +28 -0
  321. package/lib/hooks/index.d.ts +2 -0
  322. package/lib/hooks/index.js +17 -0
  323. package/lib/index.d.ts +24 -22
  324. package/lib/index.js +84 -57
  325. package/lib/info/components/FormItem/index.d.ts +5 -0
  326. package/lib/info/components/FormItem/index.js +78 -0
  327. package/lib/info/components/FormItem/index.scss +49 -0
  328. package/lib/info/components/InfoGroup/index.d.ts +5 -0
  329. package/lib/info/components/InfoGroup/index.js +27 -0
  330. package/lib/info/components/InfoGroup/index.scss +8 -0
  331. package/lib/info/components/InfoValueItem/index.d.ts +5 -0
  332. package/lib/info/components/InfoValueItem/index.js +237 -0
  333. package/lib/info/components/InfoValueItem/index.scss +21 -0
  334. package/lib/info/components/baseInfo/index.d.ts +7 -0
  335. package/lib/info/components/baseInfo/index.js +99 -0
  336. package/lib/info/components/baseInfo/index.scss +3 -0
  337. package/lib/info/components/headerInfo/index.d.ts +7 -0
  338. package/lib/info/components/headerInfo/index.js +111 -0
  339. package/lib/info/components/headerInfo/index.scss +0 -0
  340. package/lib/info/components/tableInfo/index.d.ts +8 -0
  341. package/lib/info/components/tableInfo/index.js +193 -0
  342. package/lib/info/components/tableInfo/index.scss +18 -0
  343. package/lib/info/index.d.ts +9 -0
  344. package/lib/info/index.js +121 -0
  345. package/lib/info/index.scss +8 -0
  346. package/lib/info/typing.d.ts +143 -0
  347. package/lib/info/typing.js +5 -0
  348. package/lib/info/utils/index.d.ts +3 -0
  349. package/lib/info/utils/index.js +19 -0
  350. package/lib/info/utils/layout.d.ts +2 -0
  351. package/lib/info/utils/layout.js +65 -0
  352. package/lib/info/utils/useInfoRequest.d.ts +14 -0
  353. package/lib/info/utils/useInfoRequest.js +82 -0
  354. package/lib/info/utils/utils.d.ts +1 -0
  355. package/lib/info/utils/utils.js +20 -0
  356. package/lib/layout/index.d.ts +3 -0
  357. package/lib/layout/index.js +30 -0
  358. package/lib/nocode/configurators/Card.d.ts +3 -0
  359. package/lib/nocode/configurators/Card.js +116 -0
  360. package/lib/nocode/configurators/PageHeader.d.ts +3 -0
  361. package/lib/nocode/configurators/PageHeader.js +205 -0
  362. package/lib/nocode/configurators/ProTable.d.ts +3 -0
  363. package/lib/nocode/configurators/ProTable.js +326 -0
  364. package/lib/nocode/configurators/common.d.ts +176 -0
  365. package/lib/nocode/configurators/common.js +325 -0
  366. package/lib/nocode/configurators/index.d.ts +15 -0
  367. package/lib/nocode/configurators/index.js +44 -0
  368. package/lib/nocode/configurators/map.d.ts +2 -0
  369. package/lib/nocode/configurators/map.js +21 -0
  370. package/lib/nocode/index.d.ts +8 -0
  371. package/lib/nocode/index.js +76 -0
  372. package/lib/nocode/index.scss +93 -0
  373. package/lib/nocode/pages/editor.d.ts +12 -0
  374. package/lib/nocode/pages/editor.js +58 -0
  375. package/lib/nocode/pages/index.d.ts +14 -0
  376. package/lib/nocode/pages/index.js +93 -0
  377. package/lib/nocode/pages/playground.d.ts +11 -0
  378. package/lib/nocode/pages/playground.js +158 -0
  379. package/lib/nocode/pages/renderer.d.ts +10 -0
  380. package/lib/nocode/pages/renderer.js +164 -0
  381. package/lib/nocode/playground.d.ts +14 -0
  382. package/lib/nocode/playground.js +91 -0
  383. package/lib/page-container/index.d.ts +3 -0
  384. package/lib/page-container/index.js +30 -0
  385. package/lib/page-header/index.d.ts +42 -0
  386. package/lib/page-header/index.js +240 -0
  387. package/lib/page-header/index.scss +171 -0
  388. package/lib/skeleton/index.d.ts +3 -0
  389. package/lib/skeleton/index.js +30 -0
  390. package/lib/table/components/Filter/index.d.ts +9 -0
  391. package/lib/table/components/Filter/index.js +252 -0
  392. package/lib/table/components/Filter/index.scss +23 -0
  393. package/lib/table/components/Layout/index.d.ts +5 -0
  394. package/lib/table/components/Layout/index.js +265 -0
  395. package/lib/table/components/Layout/index.scss +39 -0
  396. package/lib/table/components/QuickAction/index.d.ts +10 -0
  397. package/lib/table/components/QuickAction/index.js +65 -0
  398. package/lib/table/components/QuickAction/index.scss +0 -0
  399. package/lib/table/components/ToolBar/DensityIcon.d.ts +4 -0
  400. package/lib/table/components/ToolBar/DensityIcon.js +135 -0
  401. package/lib/table/components/ToolBar/FilterColumnIcon.d.ts +4 -0
  402. package/lib/table/components/ToolBar/FilterColumnIcon.js +303 -0
  403. package/lib/table/components/ToolBar/FullScreenIcon.d.ts +4 -0
  404. package/lib/table/components/ToolBar/FullScreenIcon.js +107 -0
  405. package/lib/table/components/ToolBar/Fullscreen.d.ts +10 -0
  406. package/lib/table/components/ToolBar/Fullscreen.js +85 -0
  407. package/lib/table/components/ToolBar/RefreshIcon.d.ts +4 -0
  408. package/lib/table/components/ToolBar/RefreshIcon.js +60 -0
  409. package/lib/table/components/ToolBar/index.d.ts +5 -0
  410. package/lib/table/components/ToolBar/index.js +96 -0
  411. package/lib/table/components/ToolBar/index.scss +110 -0
  412. package/lib/table/index.d.ts +7 -0
  413. package/lib/table/index.js +681 -0
  414. package/lib/table/index.scss +104 -0
  415. package/lib/table/typing.d.ts +222 -0
  416. package/lib/table/typing.js +5 -0
  417. package/lib/table/utils/columnRender.d.ts +13 -0
  418. package/lib/table/utils/columnRender.js +201 -0
  419. package/lib/table/utils/genProColumnToColumn.d.ts +9 -0
  420. package/lib/table/utils/genProColumnToColumn.js +62 -0
  421. package/lib/table/utils/getTableProps.d.ts +2 -0
  422. package/lib/table/utils/getTableProps.js +13 -0
  423. package/lib/table/utils/getTableSortIcons.d.ts +3 -0
  424. package/lib/table/utils/getTableSortIcons.js +34 -0
  425. package/lib/table/utils/index.d.ts +4 -0
  426. package/lib/table/utils/index.js +112 -0
  427. package/lib/table/utils/useTableSelection.d.ts +3 -0
  428. package/lib/table/utils/useTableSelection.js +112 -0
  429. package/lib/templates/Detail/index.d.ts +2 -0
  430. package/lib/templates/Detail/index.js +18 -0
  431. package/lib/templates/Detail/index.scss +3 -0
  432. package/lib/templates/Form/index.d.ts +2 -0
  433. package/lib/templates/Form/index.js +18 -0
  434. package/lib/templates/Form/index.scss +3 -0
  435. package/lib/templates/List/index.d.ts +9 -0
  436. package/lib/templates/List/index.js +67 -0
  437. package/lib/templates/List/index.scss +3 -0
  438. package/lib/templates/index.d.ts +5 -0
  439. package/lib/templates/index.js +59 -0
  440. package/lib/templates/index.scss +3 -0
  441. package/lib/utils/index.d.ts +2 -0
  442. package/lib/utils/index.js +17 -0
  443. package/package.json +21 -11
@@ -0,0 +1,620 @@
1
+ var _excluded = ["header", "className", "tableClassName", "mainAction", "quickAction", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction"];
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+
7
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+
9
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
+
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
+
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14
+
15
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
16
+
17
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+
19
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
+
21
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
+
23
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
24
+
25
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
26
+
27
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
28
+
29
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
+
31
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
32
+
33
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
34
+
35
+ import React, { useState, useEffect, useRef, useMemo } from 'react';
36
+ import { Table, Pagination, Message, Checkbox } from '@alicloudfe/components';
37
+ import genProColumnToColumn from './utils/genProColumnToColumn';
38
+ import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps } from '@teamix/utils';
39
+ import { BaseSkeleton as Skeleton } from '../skeleton';
40
+ import './index.scss';
41
+ import Layout from './components/Layout';
42
+ import { useActionType } from './utils';
43
+ import getTableProps from './utils/getTableProps';
44
+ import getTableSortIcons from './utils/getTableSortIcons';
45
+ import useTableSelection from './utils/useTableSelection';
46
+ import FullScreen from './components/ToolBar/Fullscreen';
47
+ import { createForm, toJS } from '../form';
48
+ import { ActionGroup } from '../actions';
49
+ import debounce from 'lodash.debounce';
50
+ import classNames from 'classnames';
51
+ export * from './typing'; // 导出 ProActions 组件
52
+
53
+ export * from '../actions';
54
+ export { default as ActionButton } from '../actions';
55
+ import { registerActionHandler } from '../actions';
56
+ import { useSize } from 'ahooks';
57
+ var cls = baseClass('teamix-pro-table');
58
+ /**
59
+ * 处理原生传入的 columns 以便于 选择列 方便处理
60
+ * @param columns 原生传入的 columns
61
+ * @returns
62
+ */
63
+
64
+ var processColumns = function processColumns(columns) {
65
+ return columns.filter(function (item) {
66
+ return item.columnFilters !== false;
67
+ });
68
+ };
69
+ /** 默认请求翻页参数 */
70
+
71
+
72
+ var globalPageKey = 'currentPage';
73
+ var globalPageSizeKey = 'pageSize';
74
+
75
+ var globalFormatSort = function globalFormatSort(sort) {
76
+ if (Object.keys(sort).length > 0) {
77
+ return {
78
+ sort: sort
79
+ };
80
+ }
81
+
82
+ return {};
83
+ };
84
+
85
+ var ProTable = function ProTable(props) {
86
+ var _rowSelection$selecte;
87
+
88
+ var header = props.header,
89
+ className = props.className,
90
+ tableClassName = props.tableClassName,
91
+ mainAction = props.mainAction,
92
+ quickAction = props.quickAction,
93
+ propsDataFilter = props.dataFilter,
94
+ toolBar = props.toolBar,
95
+ propsColumns = props.columns,
96
+ useRowSelection = props.useRowSelection,
97
+ propsRowSelection = props.rowSelection,
98
+ onChangeRowSelection = props.onChangeRowSelection,
99
+ getRowSelection = props.getRowSelection,
100
+ primaryKey = props.primaryKey,
101
+ footerAction = props.footerAction,
102
+ url = props.url,
103
+ pageKey = props.pageKey,
104
+ pageSizeKey = props.pageSizeKey,
105
+ _props$method = props.method,
106
+ method = _props$method === void 0 ? 'post' : _props$method,
107
+ _props$params = props.params,
108
+ propsParams = _props$params === void 0 ? {} : _props$params,
109
+ formatSort = props.formatSort,
110
+ _props$formatParams = props.formatParams,
111
+ formatParams = _props$formatParams === void 0 ? function (params) {
112
+ return params;
113
+ } : _props$formatParams,
114
+ formatResult = props.formatResult,
115
+ _props$requestWhenMou = props.requestWhenMount,
116
+ requestWhenMount = _props$requestWhenMou === void 0 ? true : _props$requestWhenMou,
117
+ _props$showPagination = props.showPagination,
118
+ showPagination = _props$showPagination === void 0 ? true : _props$showPagination,
119
+ _props$pageSizeList = props.pageSizeList,
120
+ pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
121
+ _props$showSkeleton = props.showSkeleton,
122
+ propsShowSkeleton = _props$showSkeleton === void 0 ? true : _props$showSkeleton,
123
+ _props$skeletonSize = props.skeletonSize,
124
+ skeletonSize = _props$skeletonSize === void 0 ? 5 : _props$skeletonSize,
125
+ propsActionRef = props.actionRef,
126
+ dataSource = props.dataSource,
127
+ _props$filterDebounce = props.filterDebounce,
128
+ filterDebounce = _props$filterDebounce === void 0 ? 300 : _props$filterDebounce,
129
+ _props$footerSuction = props.footerSuction,
130
+ footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
131
+ otherProps = _objectWithoutProperties(props, _excluded);
132
+
133
+ var targetPageKey = pageKey || globalPageKey;
134
+ var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
135
+ var targetFormatSort = formatSort || globalFormatSort;
136
+
137
+ var _useState = useState(1),
138
+ _useState2 = _slicedToArray(_useState, 2),
139
+ currentPage = _useState2[0],
140
+ setCurrentPage = _useState2[1];
141
+
142
+ var _useState3 = useState(props.pageSize || 10),
143
+ _useState4 = _slicedToArray(_useState3, 2),
144
+ pageSize = _useState4[0],
145
+ setPageSize = _useState4[1];
146
+
147
+ var _useState5 = useState(0),
148
+ _useState6 = _slicedToArray(_useState5, 2),
149
+ total = _useState6[0],
150
+ setTotal = _useState6[1];
151
+
152
+ var _useState7 = useState([]),
153
+ _useState8 = _slicedToArray(_useState7, 2),
154
+ data = _useState8[0],
155
+ setData = _useState8[1];
156
+
157
+ var _useState9 = useState(props.sort || {}),
158
+ _useState10 = _slicedToArray(_useState9, 2),
159
+ sort = _useState10[0],
160
+ setSort = _useState10[1];
161
+
162
+ var _useState11 = useState(requestWhenMount && propsShowSkeleton),
163
+ _useState12 = _slicedToArray(_useState11, 2),
164
+ showSkeleton = _useState12[0],
165
+ setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
166
+
167
+
168
+ var skeletonDataSource = new Array(skeletonSize).fill({});
169
+ var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data';
170
+ var tableRef = useRef(null);
171
+ var actionRef = useRef(); // 传给 table 的过滤后的 columns
172
+
173
+ var _useState13 = useState(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [])),
174
+ _useState14 = _slicedToArray(_useState13, 2),
175
+ filteredColumns = _useState14[0],
176
+ setFilteredColumns = _useState14[1];
177
+
178
+ var _useState15 = useState('medium'),
179
+ _useState16 = _slicedToArray(_useState15, 2),
180
+ size = _useState16[0],
181
+ _setSize = _useState16[1]; // 获取header高度,用作全屏吸底吸顶高度计算
182
+
183
+
184
+ var getHeaderHeight = function getHeaderHeight() {
185
+ var _tableDom$getElements, _tableDom$getElements2;
186
+
187
+ var tableDom = tableRef.current;
188
+ var headerDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements = tableDom.getElementsByClassName('teamix-pro-table-layout')) === null || _tableDom$getElements === void 0 ? void 0 : _tableDom$getElements[0];
189
+ var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName('next-table-header-inner')) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
190
+ return new Promise(function (resolve) {
191
+ setTimeout(function () {
192
+ var _headerDom$offsetHeig, _tableHeaderDom$offse;
193
+
194
+ var headerHeight = (_headerDom$offsetHeig = headerDom === null || headerDom === void 0 ? void 0 : headerDom.offsetHeight) !== null && _headerDom$offsetHeig !== void 0 ? _headerDom$offsetHeig : 0; // table表头默认一行。即42px
195
+
196
+ var tableHeaderHeight = (_tableHeaderDom$offse = tableHeaderDom === null || tableHeaderDom === void 0 ? void 0 : tableHeaderDom.offsetHeight) !== null && _tableHeaderDom$offse !== void 0 ? _tableHeaderDom$offse : 42;
197
+ resolve(headerHeight + tableHeaderHeight);
198
+ }, 50);
199
+ });
200
+ }; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
201
+
202
+
203
+ var _useState17 = useState(0),
204
+ _useState18 = _slicedToArray(_useState17, 2),
205
+ headerHeight = _useState18[0],
206
+ setHeaderHeight = _useState18[1]; // 全屏显示 className
207
+
208
+
209
+ var _useState19 = useState(false),
210
+ _useState20 = _slicedToArray(_useState19, 2),
211
+ fullscreenState = _useState20[0],
212
+ setFullscreenState = _useState20[1]; // 父元素位置。用作非全屏模式下的吸底
213
+
214
+
215
+ var _useState21 = useState(),
216
+ _useState22 = _slicedToArray(_useState21, 2),
217
+ parentPosition = _useState22[0],
218
+ setParentPosition = _useState22[1];
219
+ /** 筛选区域 form */
220
+
221
+
222
+ var dataFilterForm = useMemo(function () {
223
+ return createForm();
224
+ }, []); // 获取表格大小
225
+
226
+ var tableSize = useSize(tableRef); // 获取父元素位置
227
+
228
+ var getParentPosition = function getParentPosition() {
229
+ // 暂时仅支持使用全家桶
230
+ if (footerSuction) {
231
+ var _parentDom$offsetLeft, _parentDom$offsetRigh;
232
+
233
+ var parentDom = document.querySelector('.teamix-pro-page-container');
234
+ setParentPosition({
235
+ offsetLeft: (_parentDom$offsetLeft = parentDom === null || parentDom === void 0 ? void 0 : parentDom.offsetLeft) !== null && _parentDom$offsetLeft !== void 0 ? _parentDom$offsetLeft : 0,
236
+ offsetRight: (_parentDom$offsetRigh = parentDom === null || parentDom === void 0 ? void 0 : parentDom.offsetRight) !== null && _parentDom$offsetRigh !== void 0 ? _parentDom$offsetRigh : 0
237
+ });
238
+ }
239
+ }; // 监听表格大小动态改变吸底footer大小
240
+
241
+
242
+ useEffect(function () {
243
+ getParentPosition();
244
+ }, [tableSize]); // rowSelection 相关
245
+
246
+ var rowSelectionHook = useTableSelection(_objectSpread(_objectSpread({}, propsRowSelection), {}, {
247
+ onChange: onChangeRowSelection
248
+ }), primaryKey);
249
+ var rowSelection = useRowSelection ? rowSelectionHook.rowSelection : propsRowSelection;
250
+ var selectedCount = (rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.length) || 0;
251
+ useEffect(function () {
252
+ getRowSelection && getRowSelection(rowSelectionHook);
253
+ }, [rowSelectionHook]); // 获取 table 左下角 checkbox 属性
254
+
255
+ function getCheckAllProps() {
256
+ var _rowSelection$onChang = rowSelection.onChange,
257
+ _onChange = _rowSelection$onChang === void 0 ? function () {} : _rowSelection$onChang,
258
+ _rowSelection$onSelec = rowSelection.onSelectAll,
259
+ onSelectAll = _rowSelection$onSelec === void 0 ? function () {} : _rowSelection$onSelec,
260
+ _rowSelection$selecte2 = rowSelection.selectedRowKeys,
261
+ selectedRowKeys = _rowSelection$selecte2 === void 0 ? [] : _rowSelection$selecte2,
262
+ getProps = rowSelection.getProps;
263
+
264
+ var dataSource = data;
265
+ var allRowKeys = dataSource.filter(function (d, i) {
266
+ var _getProps;
267
+
268
+ return getProps ? !((_getProps = getProps(d, i)) === null || _getProps === void 0 ? void 0 : _getProps.disabled) : true;
269
+ }).map(function (d) {
270
+ return getDeepValue(primaryKey || 'id', d);
271
+ });
272
+ var nowCheckedKeys = allRowKeys.filter(function (k) {
273
+ return selectedRowKeys.includes(k);
274
+ });
275
+ return {
276
+ onChange: function onChange(check) {
277
+ if (check) {
278
+ var result = selectedRowKeys.concat([]);
279
+ result.push.apply(result, _toConsumableArray(allRowKeys.filter(function (k) {
280
+ return !selectedRowKeys.includes(k);
281
+ })));
282
+
283
+ _onChange(result, dataSource);
284
+
285
+ onSelectAll(check, dataSource);
286
+ } else {
287
+ _onChange(selectedRowKeys.filter(function (k) {
288
+ return !allRowKeys.includes(k);
289
+ }), []);
290
+
291
+ onSelectAll(check, []);
292
+ }
293
+ },
294
+ indeterminate: nowCheckedKeys.length !== allRowKeys.length && nowCheckedKeys.length > 0,
295
+ checked: nowCheckedKeys.length !== 0 && nowCheckedKeys.length === allRowKeys.length
296
+ };
297
+ }
298
+
299
+ useEffect(function () {
300
+ if (typeof propsActionRef === 'function' && actionRef.current) {
301
+ // @ts-ignore
302
+ propsActionRef(actionRef.current);
303
+ }
304
+ }, [propsActionRef]);
305
+ useEffect(function () {
306
+ setFilteredColumns(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : []));
307
+ }, [propsColumns]); // 绑定 Actions
308
+
309
+ useActionType(actionRef, {
310
+ fullScreen: function fullScreen() {
311
+ var state = !fullscreenState; // 全屏时需要重新计算header高度
312
+
313
+ getHeaderHeight().then(function (height) {
314
+ setHeaderHeight(height);
315
+ });
316
+ setFullscreenState(state);
317
+ return state;
318
+ },
319
+ setColumn: function setColumn(newColumns) {
320
+ setFilteredColumns(processColumns(newColumns));
321
+ },
322
+ setSize: function setSize(mode) {
323
+ _setSize(mode);
324
+ },
325
+ refresh: function refresh(params) {
326
+ return _request(params);
327
+ },
328
+ request: function request(params) {
329
+ return _request(params);
330
+ },
331
+ reset: function reset() {
332
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
333
+ dataFilterForm.reset();
334
+ setCurrentPage(1);
335
+
336
+ _request(_defineProperty({}, targetPageKey, 1));
337
+ },
338
+ clearRowSelection: function clearRowSelection() {
339
+ rowSelectionHook.setSelectedRowKeys([]);
340
+ rowSelectionHook.setSelectedRecords([]);
341
+ onChangeRowSelection && onChangeRowSelection([]);
342
+ },
343
+ pageInfo: {
344
+ total: total,
345
+ current: currentPage,
346
+ pageSize: pageSize
347
+ },
348
+ resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
349
+ getHeaderHeight().then(function (height) {
350
+ setHeaderHeight(height);
351
+ });
352
+ }
353
+ }); // 将 Actions 绑定到传入的 propsActionRef 中
354
+
355
+ if (propsActionRef) {
356
+ propsActionRef.current = actionRef.current;
357
+ } // 请求表格数据工具函数
358
+
359
+
360
+ var getData = useRequest(function (params) {
361
+ return _defineProperty({
362
+ url: url,
363
+ method: method
364
+ }, requestDataKey, params);
365
+ }, {
366
+ // 使用 request 方法代替 fetch
367
+ requestMethod: function requestMethod(params) {
368
+ return utilResquest(params);
369
+ },
370
+ manual: true,
371
+ onSuccess: function onSuccess(result) {
372
+ props.onSuccess && props.onSuccess(result);
373
+ var nextData = result;
374
+
375
+ if (formatResult) {
376
+ if (typeof formatResult === 'function') {
377
+ nextData = formatResult(result) || {};
378
+ } else if (_typeof(formatResult) === 'object') {
379
+ var dataTotal = getDeepValue(formatResult.total, result);
380
+ nextData = {
381
+ data: getDeepValue(formatResult.data, result) || [],
382
+ total: isNaN(dataTotal) ? 0 : Number(dataTotal)
383
+ };
384
+ }
385
+ }
386
+
387
+ function onFormatResult(next) {
388
+ var _next$data;
389
+
390
+ props.onFormatResult && props.onFormatResult(next); // 设置 dataSource、total
391
+
392
+ setData(next.data || []);
393
+ setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
394
+ setShowSkeleton(false);
395
+ }
396
+
397
+ if (nextData instanceof Promise) {
398
+ nextData.then(function (res) {
399
+ onFormatResult(res);
400
+ }).catch(function () {
401
+ onFormatResult({});
402
+ });
403
+ } else {
404
+ onFormatResult(nextData);
405
+ }
406
+ },
407
+ onError: function onError(error) {
408
+ setShowSkeleton(false);
409
+
410
+ if (props.onError) {
411
+ props.onError(error);
412
+ } else {
413
+ Message.error(error.toString());
414
+ }
415
+ }
416
+ }); // 请求函数
417
+
418
+ function _request(params) {
419
+ var _actionRef$current, _actionRef$current$se, _objectSpread2;
420
+
421
+ // 请求前需要优先清空列过滤条件
422
+ (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setFilterRules) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, {});
423
+ var sortParams = targetFormatSort(sort); // 筛选区请求参数
424
+
425
+ var dataFilterParams = toJS(dataFilterForm.values); // 格式化后的请求参数
426
+
427
+ var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams) : _objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams)), params));
428
+
429
+ if (requestData) {
430
+ // console.log('requestData', requestData);
431
+ getData.run(requestData);
432
+ }
433
+ }
434
+
435
+ useEffect(function () {
436
+ if (requestWhenMount) {
437
+ _request();
438
+ }
439
+ }, []);
440
+
441
+ function onSort(dataIndex, order) {
442
+ var nextSort = _defineProperty({}, dataIndex, order);
443
+
444
+ setSort(nextSort);
445
+
446
+ _request(targetFormatSort(nextSort));
447
+ } // 处理 dataFilter 中的 onFilter、onReset
448
+
449
+
450
+ var dataFilter = _objectSpread(_objectSpread({}, propsDataFilter), {}, {
451
+ onFilter: debounce(function () {
452
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
453
+ setCurrentPage(1);
454
+
455
+ _request(_defineProperty({}, targetPageKey, 1));
456
+ }, filterDebounce),
457
+ onReset: function onReset() {
458
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
459
+ dataFilterForm.reset();
460
+ setCurrentPage(1);
461
+
462
+ _request(_defineProperty({}, targetPageKey, 1));
463
+ }
464
+ });
465
+
466
+ var renderTable = function renderTable() {
467
+ if (propsColumns) {
468
+ return /*#__PURE__*/React.createElement("div", {
469
+ className: classNames('teamix-pro-table-container', className)
470
+ }, /*#__PURE__*/React.createElement(Layout, {
471
+ header: header,
472
+ mainAction: mainAction,
473
+ quickAction: quickAction,
474
+ toolBar: toolBar,
475
+ actionRef: actionRef,
476
+ columns: propsColumns,
477
+ dataFilter: dataFilter,
478
+ dataFilterForm: dataFilterForm,
479
+ rowSelection: rowSelection
480
+ }), /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
481
+ hasBorder: false,
482
+ dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
483
+ columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef),
484
+ loading: !showSkeleton && (getData.loading || props.loading),
485
+ className: classNames('teamix-pro-table', tableClassName, {
486
+ 'with-row-select': rowSelection
487
+ }),
488
+ size: size,
489
+ onSort: onSort,
490
+ sort: sort,
491
+ primaryKey: primaryKey,
492
+ rowSelection: rowSelection,
493
+ sortIcons: getTableSortIcons(),
494
+ fixedHeader: fullscreenState,
495
+ // 102px 为 底部 50px + 空格10px + 顶部 24px padding
496
+ maxBodyHeight: "calc(100vh - 84px - ".concat(headerHeight, "px)")
497
+ }, pickProps(getTableProps(), otherProps))));
498
+ } else {
499
+ // 不传 columns 直接返回原始 Table
500
+ return /*#__PURE__*/React.createElement(Table, _objectSpread({
501
+ className: cls()
502
+ }, pickProps(getTableProps(), otherProps)));
503
+ }
504
+ };
505
+
506
+ var renderFooterAction = function renderFooterAction() {
507
+ var _footerAction$actions;
508
+
509
+ if (_typeof(footerAction) === 'object' && (footerAction === null || footerAction === void 0 ? void 0 : (_footerAction$actions = footerAction.actions) === null || _footerAction$actions === void 0 ? void 0 : _footerAction$actions.length) > 0) {
510
+ // 默认 context
511
+ var defaultContext = {
512
+ action: actionRef.current,
513
+ rowSelection: rowSelection
514
+ };
515
+ return /*#__PURE__*/React.createElement("div", {
516
+ className: cls('footer-action')
517
+ }, /*#__PURE__*/React.createElement(ActionGroup, _objectSpread(_objectSpread({}, footerAction), {}, {
518
+ context: _objectSpread(_objectSpread({}, defaultContext), footerAction.context)
519
+ })));
520
+ } else return footerAction;
521
+ };
522
+
523
+ var renderFooter = function renderFooter() {
524
+ function onChangePagination(currentPage) {
525
+ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
526
+ setCurrentPage(currentPage);
527
+
528
+ _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
529
+ }
530
+
531
+ function onChangePaginationSize(currentPageSize) {
532
+ setPageSize(currentPageSize);
533
+
534
+ _request(_defineProperty({}, targetPageSizeKey, currentPageSize));
535
+ }
536
+
537
+ function renderRowSelection() {
538
+ if (rowSelection) {
539
+ if (showSkeleton) {
540
+ return /*#__PURE__*/React.createElement("div", {
541
+ className: cls('footer-left-wrapper')
542
+ }, /*#__PURE__*/React.createElement(Skeleton.Footer.Operation, null));
543
+ } else {
544
+ return /*#__PURE__*/React.createElement("div", {
545
+ className: cls('footer-left-wrapper')
546
+ }, rowSelection.mode !== 'single' && /*#__PURE__*/React.createElement(Checkbox, _objectSpread({
547
+ className: cls("footer-checkbox-".concat(size))
548
+ }, getCheckAllProps())), footerAction && renderFooterAction(), /*#__PURE__*/React.createElement("span", {
549
+ className: cls('selected-msg')
550
+ }, getMessage('selected', {
551
+ count: selectedCount
552
+ })));
553
+ }
554
+ }
555
+ }
556
+
557
+ if (showPagination || footerAction) {
558
+ var _parentPosition$offse, _parentPosition$offse2;
559
+
560
+ return /*#__PURE__*/React.createElement("div", {
561
+ className: cls('footer', {
562
+ 'footer-has-rowSelection': rowSelection
563
+ }),
564
+ style: {
565
+ left: "".concat((_parentPosition$offse = parentPosition === null || parentPosition === void 0 ? void 0 : parentPosition.offsetLeft) !== null && _parentPosition$offse !== void 0 ? _parentPosition$offse : 0, "px"),
566
+ right: "".concat((_parentPosition$offse2 = parentPosition === null || parentPosition === void 0 ? void 0 : parentPosition.offsetRight) !== null && _parentPosition$offse2 !== void 0 ? _parentPosition$offse2 : 0, "px")
567
+ }
568
+ }, renderRowSelection(), /*#__PURE__*/React.createElement("div", {
569
+ className: cls('footer-right-wrapper')
570
+ }, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : /*#__PURE__*/React.createElement(Pagination, _objectSpread({
571
+ className: cls('pagination'),
572
+ onChange: function onChange(number) {
573
+ return onChangePagination(number);
574
+ },
575
+ total: total,
576
+ totalRender: function totalRender(total) {
577
+ return getMessage('total', {
578
+ total: total
579
+ });
580
+ },
581
+ pageSize: pageSize,
582
+ current: currentPage,
583
+ shape: "arrow-only",
584
+ pageSizeList: pageSizeList,
585
+ pageSizeSelector: total > (props.pageSize || 10) * 2 ? 'dropdown' : false,
586
+ pageSizePosition: "end",
587
+ type: total / pageSize <= 2 ? 'simple' : 'normal',
588
+ onPageSizeChange: function onPageSizeChange(number) {
589
+ return onChangePaginationSize(number);
590
+ }
591
+ }, props.paginationProps))));
592
+ }
593
+ };
594
+
595
+ return /*#__PURE__*/React.createElement(FullScreen, {
596
+ visible: fullscreenState,
597
+ actionRef: actionRef
598
+ }, /*#__PURE__*/React.createElement("div", {
599
+ className: cls({
600
+ '': true,
601
+ fullscreen: fullscreenState,
602
+ 'footer-suction': footerSuction
603
+ }),
604
+ ref: tableRef
605
+ }, renderTable(), renderFooter()));
606
+ }; // 注册 action 里面的弹层表格
607
+
608
+
609
+ registerActionHandler('dialog-table', 'dialog', {
610
+ component: ProTable,
611
+ closeable: true,
612
+ size: 'medium'
613
+ });
614
+ registerActionHandler('drawer-table', 'dialog', {
615
+ component: ProTable,
616
+ closeable: true,
617
+ dialogType: 'drawer',
618
+ size: 'medium'
619
+ });
620
+ export default ProTable;