@teamix/pro 1.5.2 → 1.5.4-beta.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 (293) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +20285 -19928
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/dist/pro.min.js.LICENSE.txt +2 -6
  6. package/es/actions/base.js +8 -21
  7. package/es/actions/dialog-component.js +2 -9
  8. package/es/actions/dialog-form.js +37 -75
  9. package/es/actions/dialog-info.js +1 -5
  10. package/es/actions/dialog.js +57 -95
  11. package/es/actions/index.d.ts +3 -0
  12. package/es/actions/index.js +71 -156
  13. package/es/actions/link.js +3 -5
  14. package/es/actions/quick.d.ts +2 -0
  15. package/es/actions/quick.js +26 -0
  16. package/es/actions/request.js +12 -27
  17. package/es/actions/utils.js +1 -9
  18. package/es/card/card-container.js +0 -5
  19. package/es/card/divider.js +0 -5
  20. package/es/card/index.js +56 -95
  21. package/es/card/selectable.js +4 -13
  22. package/es/card/tab.js +1 -10
  23. package/es/card/utils.js +0 -2
  24. package/es/form/Components/Editable/index.js +16 -55
  25. package/es/form/Components/FormGroup/index.d.ts +1 -0
  26. package/es/form/Components/FormGroup/index.js +7 -22
  27. package/es/form/Components/LightFilter/index.js +15 -35
  28. package/es/form/Components/ProField/index.js +2 -14
  29. package/es/form/Components/ProField/mapDateFormat.js +2 -28
  30. package/es/form/Components/Text/index.d.ts +1 -0
  31. package/es/form/Components/Text/index.js +2 -11
  32. package/es/form/Filter/AdvancedFilter.js +11 -26
  33. package/es/form/Filter/Layout.js +11 -24
  34. package/es/form/Filter/LightFilter.js +13 -24
  35. package/es/form/Filter/SimpleFilter.js +7 -21
  36. package/es/form/Filter/index.js +106 -171
  37. package/es/form/Filter/index2.js +11 -28
  38. package/es/form/Filter/useBindUrl.js +18 -46
  39. package/es/form/Filter/useSpecialProps.js +8 -13
  40. package/es/form/ProForm/addCascadeEffect.js +10 -32
  41. package/es/form/ProForm/customComponent.js +0 -5
  42. package/es/form/ProForm/index.js +23 -34
  43. package/es/form/ProForm/useAutoLayout.js +21 -42
  44. package/es/form/ProForm/useAutoSubmit.js +3 -8
  45. package/es/form/ProForm/useFieldRequest.js +0 -5
  46. package/es/form/ProForm/useFormDisplayValues.js +12 -28
  47. package/es/form/ProForm/useInitialRequest.js +0 -5
  48. package/es/form/SchemaForm/adapterComponent.js +0 -3
  49. package/es/form/SchemaForm/adapterDecorator.d.ts +1 -1
  50. package/es/form/SchemaForm/adapterDecorator.js +0 -8
  51. package/es/form/SchemaForm/adapterType.js +0 -2
  52. package/es/form/SchemaForm/index.js +78 -114
  53. package/es/form/SchemaForm/initializeArrayCards.js +0 -6
  54. package/es/form/SchemaForm/initializeArrayCollapse.js +0 -6
  55. package/es/form/SchemaForm/initializeArrayItems.js +2 -9
  56. package/es/form/SchemaForm/initializeArrayTable.js +21 -34
  57. package/es/form/SchemaForm/initializeDataSource.js +2 -6
  58. package/es/form/SchemaForm/initializeFormButton.js +14 -31
  59. package/es/form/SchemaForm/initializeFormCollapse.js +8 -18
  60. package/es/form/SchemaForm/initializeFormGroup.js +10 -20
  61. package/es/form/SchemaForm/initializeFormStep.js +11 -23
  62. package/es/form/SchemaForm/initializeFormTab.js +10 -20
  63. package/es/form/SchemaForm/initializeReactions.js +9 -33
  64. package/es/form/SchemaForm/initializeRequest.js +2 -16
  65. package/es/form/SchemaForm/initializeRules.js +4 -22
  66. package/es/form/SchemaForm/initializeSelectTable.js +7 -33
  67. package/es/form/SchemaForm/reactions.js +19 -34
  68. package/es/form/docs/ActionResponse.d.ts +1 -0
  69. package/es/form/index.d.ts +9 -9
  70. package/es/form/index.js +0 -9
  71. package/es/form/typing.d.ts +6 -4
  72. package/es/form/utils.d.ts +1 -1
  73. package/es/form/utils.js +4 -49
  74. package/es/form/warning.js +2 -7
  75. package/es/index-without-icon.js +4 -3
  76. package/es/index.d.ts +1 -1
  77. package/es/index.js +7 -8
  78. package/es/info/components/InfoGroup/index.js +21 -32
  79. package/es/info/components/InfoValueItem/index.js +66 -119
  80. package/es/info/components/ProInfoItem/index.js +13 -21
  81. package/es/info/components/baseInfo/index.js +14 -26
  82. package/es/info/components/headerInfo/index.js +8 -20
  83. package/es/info/components/tableInfo/index.js +20 -50
  84. package/es/info/index.js +53 -82
  85. package/es/info/utils/index.js +0 -11
  86. package/es/nocode/configurators/common.js +5 -6
  87. package/es/nocode/configurators/index.js +2 -3
  88. package/es/nocode/index.js +6 -6
  89. package/es/nocode/pages/editor.js +5 -9
  90. package/es/nocode/pages/index.js +4 -4
  91. package/es/nocode/pages/playground.js +18 -35
  92. package/es/nocode/pages/renderer.js +9 -42
  93. package/es/nocode/playground.js +10 -23
  94. package/es/page-header/index.d.ts +2 -2
  95. package/es/page-header/index.js +39 -75
  96. package/es/sidebar/components/sidebar-container/index.js +41 -72
  97. package/es/sidebar/components/tree/index.js +88 -144
  98. package/es/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -26
  99. package/es/sidebar/components/tree-node/components/IconAction/index.js +9 -35
  100. package/es/sidebar/components/tree-node/components/IconSwitch/index.js +12 -25
  101. package/es/sidebar/components/tree-node/index.js +41 -83
  102. package/es/sidebar/index.js +69 -94
  103. package/es/sidebar/utils/action-ref.js +2 -7
  104. package/es/sidebar/utils/index.d.ts +5 -2
  105. package/es/sidebar/utils/index.js +41 -98
  106. package/es/table/components/CardView/index.js +62 -149
  107. package/es/table/components/Filter/index.js +42 -83
  108. package/es/table/components/Layout/index.js +25 -45
  109. package/es/table/components/LoadMore/index.js +15 -34
  110. package/es/table/components/Pagination/index.js +25 -58
  111. package/es/table/components/QuickAction/index.js +3 -11
  112. package/es/table/components/ToolBar/CardSwitch.js +6 -17
  113. package/es/table/components/ToolBar/DensityIcon.js +18 -31
  114. package/es/table/components/ToolBar/FilterColumnIcon.js +50 -106
  115. package/es/table/components/ToolBar/FullScreenIcon.js +2 -6
  116. package/es/table/components/ToolBar/Fullscreen.js +19 -35
  117. package/es/table/components/ToolBar/RefreshIcon.js +2 -5
  118. package/es/table/components/ToolBar/index.js +23 -45
  119. package/es/table/index.js +227 -401
  120. package/es/table/utils/columnRender.d.ts +1 -1
  121. package/es/table/utils/columnRender.js +32 -76
  122. package/es/table/utils/genProColumnToColumn.js +5 -14
  123. package/es/table/utils/index.js +14 -47
  124. package/es/table/utils/pureColumnRender.js +21 -53
  125. package/es/table/utils/pureGenProColumnToColumn.d.ts +1 -1
  126. package/es/table/utils/pureGenProColumnToColumn.js +2 -10
  127. package/es/table/utils/useTableSelection.js +6 -33
  128. package/es/templates/List/index.js +2 -9
  129. package/es/timeline/ProTimeLineItem/index.js +24 -64
  130. package/es/timeline/index.js +8 -22
  131. package/es/timeline/typing.d.ts +1 -0
  132. package/es/utils/message.d.ts +2 -2
  133. package/es/utils/message.js +0 -5
  134. package/es/utils/useRealHistory.d.ts +8 -0
  135. package/es/utils/useRealHistory.js +23 -0
  136. package/lib/actions/base.js +8 -24
  137. package/lib/actions/confirm.js +0 -5
  138. package/lib/actions/danger-confirm.js +0 -5
  139. package/lib/actions/danger-pop-confirm.js +0 -4
  140. package/lib/actions/dialog-component.js +2 -15
  141. package/lib/actions/dialog-form.js +36 -88
  142. package/lib/actions/dialog-info.js +1 -10
  143. package/lib/actions/dialog-table.js +0 -5
  144. package/lib/actions/dialog.js +55 -111
  145. package/lib/actions/drawer-form.js +0 -3
  146. package/lib/actions/drawer-info.js +0 -3
  147. package/lib/actions/drawer-table.js +0 -3
  148. package/lib/actions/drawer.js +0 -4
  149. package/lib/actions/error.js +0 -5
  150. package/lib/actions/index.d.ts +3 -0
  151. package/lib/actions/index.js +93 -186
  152. package/lib/actions/link.js +3 -10
  153. package/lib/actions/notice.js +0 -5
  154. package/lib/actions/pop-confirm.js +0 -5
  155. package/lib/actions/quick.d.ts +2 -0
  156. package/lib/actions/quick.js +33 -0
  157. package/lib/actions/request.js +10 -32
  158. package/lib/actions/utils.js +1 -9
  159. package/lib/card/card-container.js +0 -9
  160. package/lib/card/divider.js +0 -7
  161. package/lib/card/index.js +56 -122
  162. package/lib/card/selectable.js +4 -20
  163. package/lib/card/tab.js +1 -14
  164. package/lib/card/utils.js +0 -6
  165. package/lib/field/index.js +0 -6
  166. package/lib/form/Components/Editable/index.js +15 -65
  167. package/lib/form/Components/FormGroup/index.d.ts +1 -0
  168. package/lib/form/Components/FormGroup/index.js +7 -28
  169. package/lib/form/Components/LightFilter/index.js +15 -47
  170. package/lib/form/Components/ProField/index.js +2 -21
  171. package/lib/form/Components/ProField/mapDateFormat.js +2 -32
  172. package/lib/form/Components/Text/index.d.ts +1 -0
  173. package/lib/form/Components/Text/index.js +2 -16
  174. package/lib/form/Filter/AdvancedFilter.js +11 -34
  175. package/lib/form/Filter/Layout.js +11 -33
  176. package/lib/form/Filter/LightFilter.js +13 -32
  177. package/lib/form/Filter/SimpleFilter.js +5 -27
  178. package/lib/form/Filter/index.js +105 -191
  179. package/lib/form/Filter/index2.js +11 -38
  180. package/lib/form/Filter/useBindUrl.js +18 -50
  181. package/lib/form/Filter/useSpecialProps.js +6 -13
  182. package/lib/form/ProForm/addCascadeEffect.js +10 -35
  183. package/lib/form/ProForm/customComponent.js +0 -8
  184. package/lib/form/ProForm/index.js +23 -57
  185. package/lib/form/ProForm/useAutoLayout.js +21 -45
  186. package/lib/form/ProForm/useAutoSubmit.js +3 -10
  187. package/lib/form/ProForm/useFieldRequest.js +0 -8
  188. package/lib/form/ProForm/useFormDisplayValues.js +12 -34
  189. package/lib/form/ProForm/useInitialRequest.js +0 -6
  190. package/lib/form/SchemaForm/adapterComponent.js +0 -6
  191. package/lib/form/SchemaForm/adapterDecorator.d.ts +1 -1
  192. package/lib/form/SchemaForm/adapterDecorator.js +0 -12
  193. package/lib/form/SchemaForm/adapterType.js +0 -5
  194. package/lib/form/SchemaForm/index.js +78 -144
  195. package/lib/form/SchemaForm/initializeArrayCards.js +0 -7
  196. package/lib/form/SchemaForm/initializeArrayCollapse.js +0 -7
  197. package/lib/form/SchemaForm/initializeArrayItems.js +2 -10
  198. package/lib/form/SchemaForm/initializeArrayTable.js +21 -34
  199. package/lib/form/SchemaForm/initializeDataSource.js +2 -8
  200. package/lib/form/SchemaForm/initializeFormButton.js +14 -32
  201. package/lib/form/SchemaForm/initializeFormCollapse.js +8 -18
  202. package/lib/form/SchemaForm/initializeFormGroup.js +10 -20
  203. package/lib/form/SchemaForm/initializeFormStep.js +11 -23
  204. package/lib/form/SchemaForm/initializeFormTab.js +10 -20
  205. package/lib/form/SchemaForm/initializeReactions.js +9 -37
  206. package/lib/form/SchemaForm/initializeRequest.js +2 -18
  207. package/lib/form/SchemaForm/initializeRules.js +4 -24
  208. package/lib/form/SchemaForm/initializeSelectTable.js +7 -36
  209. package/lib/form/SchemaForm/reactions.js +17 -37
  210. package/lib/form/docs/ActionResponse.d.ts +1 -0
  211. package/lib/form/docs/ActionResponse.js +0 -5
  212. package/lib/form/index.d.ts +9 -9
  213. package/lib/form/index.js +0 -25
  214. package/lib/form/typing.d.ts +6 -4
  215. package/lib/form/utils.d.ts +1 -1
  216. package/lib/form/utils.js +4 -61
  217. package/lib/form/warning.js +2 -8
  218. package/lib/hooks/index.js +0 -5
  219. package/lib/index-without-icon.js +2 -36
  220. package/lib/index.d.ts +1 -1
  221. package/lib/index.js +1 -39
  222. package/lib/info/components/InfoGroup/index.js +21 -42
  223. package/lib/info/components/InfoValueItem/index.js +66 -134
  224. package/lib/info/components/ProInfoItem/index.js +13 -29
  225. package/lib/info/components/baseInfo/index.js +14 -38
  226. package/lib/info/components/headerInfo/index.js +8 -31
  227. package/lib/info/components/tableInfo/index.js +20 -62
  228. package/lib/info/index.js +53 -97
  229. package/lib/info/utils/index.js +0 -19
  230. package/lib/info/utils/utils.js +0 -1
  231. package/lib/nocode/configurators/PageHeader.js +0 -2
  232. package/lib/nocode/configurators/ProTable.js +0 -2
  233. package/lib/nocode/configurators/common.js +5 -10
  234. package/lib/nocode/configurators/index.js +2 -10
  235. package/lib/nocode/configurators/map.js +0 -5
  236. package/lib/nocode/index.js +0 -11
  237. package/lib/nocode/pages/editor.js +5 -19
  238. package/lib/nocode/pages/index.js +2 -9
  239. package/lib/nocode/pages/playground.js +18 -52
  240. package/lib/nocode/pages/renderer.js +9 -53
  241. package/lib/nocode/playground.js +10 -35
  242. package/lib/page-container/index.js +0 -6
  243. package/lib/page-header/index.d.ts +2 -2
  244. package/lib/page-header/index.js +38 -88
  245. package/lib/sidebar/components/sidebar-container/index.js +41 -84
  246. package/lib/sidebar/components/tree/index.js +88 -158
  247. package/lib/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -34
  248. package/lib/sidebar/components/tree-node/components/IconAction/index.js +9 -46
  249. package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +12 -35
  250. package/lib/sidebar/components/tree-node/index.js +41 -99
  251. package/lib/sidebar/index.js +69 -112
  252. package/lib/sidebar/utils/action-ref.js +2 -8
  253. package/lib/sidebar/utils/index.d.ts +5 -2
  254. package/lib/sidebar/utils/index.js +41 -106
  255. package/lib/skeleton/index.js +0 -6
  256. package/lib/table/components/CardView/index.js +62 -161
  257. package/lib/table/components/EmptyContent/index.js +0 -6
  258. package/lib/table/components/Filter/index.js +42 -93
  259. package/lib/table/components/Layout/index.js +25 -58
  260. package/lib/table/components/LoadMore/index.js +15 -44
  261. package/lib/table/components/Pagination/index.js +25 -68
  262. package/lib/table/components/QuickAction/index.js +3 -15
  263. package/lib/table/components/ToolBar/CardSwitch.js +6 -28
  264. package/lib/table/components/ToolBar/DensityIcon.js +18 -42
  265. package/lib/table/components/ToolBar/FilterColumnIcon.js +50 -118
  266. package/lib/table/components/ToolBar/FullScreenIcon.js +3 -13
  267. package/lib/table/components/ToolBar/Fullscreen.js +19 -42
  268. package/lib/table/components/ToolBar/RefreshIcon.js +3 -12
  269. package/lib/table/components/ToolBar/index.js +23 -63
  270. package/lib/table/index.js +227 -426
  271. package/lib/table/utils/columnRender.d.ts +1 -1
  272. package/lib/table/utils/columnRender.js +32 -89
  273. package/lib/table/utils/genProColumnToColumn.js +5 -19
  274. package/lib/table/utils/getTableProps.js +0 -2
  275. package/lib/table/utils/getTableSortIcons.js +0 -5
  276. package/lib/table/utils/index.js +12 -55
  277. package/lib/table/utils/pureColumnRender.js +21 -64
  278. package/lib/table/utils/pureGenProColumnToColumn.d.ts +1 -1
  279. package/lib/table/utils/pureGenProColumnToColumn.js +2 -11
  280. package/lib/table/utils/useTableSelection.js +6 -35
  281. package/lib/templates/Detail/index.js +0 -5
  282. package/lib/templates/Form/index.js +0 -5
  283. package/lib/templates/List/index.js +2 -19
  284. package/lib/templates/index.js +0 -6
  285. package/lib/timeline/ProTimeLineItem/index.js +24 -75
  286. package/lib/timeline/index.js +8 -33
  287. package/lib/timeline/typing.d.ts +1 -0
  288. package/lib/utils/index.js +0 -6
  289. package/lib/utils/message.d.ts +2 -2
  290. package/lib/utils/message.js +0 -10
  291. package/lib/utils/useRealHistory.d.ts +8 -0
  292. package/lib/utils/useRealHistory.js +32 -0
  293. package/package.json +1 -1
package/es/table/index.js CHANGED
@@ -1,37 +1,20 @@
1
1
  var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestConfig", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView"];
2
-
3
2
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
-
7
4
  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
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
-
11
6
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
-
13
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
-
15
8
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
-
17
9
  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
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
-
21
11
  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
12
  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
13
  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
14
  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
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
-
31
16
  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
17
  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
18
  import React, { useState, useEffect, useRef, useMemo } from 'react';
36
19
  import { Table, Checkbox } from '@alicloudfe/components';
37
20
  import Pagination from './components/Pagination';
@@ -51,7 +34,6 @@ import classNames from 'classnames';
51
34
  import ProPageContainer from '../page-container';
52
35
  import debounce from 'lodash.debounce';
53
36
  import CardView from './components/CardView';
54
- import columns from '../../demos/table/columns';
55
37
  export * from './typing';
56
38
  var cls = usePrefixCls('teamix-pro-table');
57
39
  /**
@@ -59,234 +41,200 @@ var cls = usePrefixCls('teamix-pro-table');
59
41
  * @param columns 原生传入的 columns
60
42
  * @returns
61
43
  */
62
-
63
44
  var processColumns = function processColumns(columns, initialColumns) {
64
45
  var _getGlobalConfig;
65
-
66
46
  var globalFilterColumns = (_getGlobalConfig = getGlobalConfig('ProTable')) === null || _getGlobalConfig === void 0 ? void 0 : _getGlobalConfig.filterColumns;
67
47
  var filterColumns = columns.filter(function (item) {
68
48
  return item.columnFilters !== false && (item === null || item === void 0 ? void 0 : item.hidden) !== true && (!globalFilterColumns || globalFilterColumns(item));
69
- }); // 处理只剩一列批量选择的情况下宽度错乱问题
70
-
49
+ });
50
+ // 处理只剩一列批量选择的情况下宽度错乱问题
71
51
  if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
72
52
  var _initialColumns$;
73
-
74
53
  if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
75
54
  var _filterColumns$, _filterColumns$2;
76
-
77
55
  if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
78
56
  delete filterColumns[0].width;
79
57
  }
80
-
81
58
  if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
82
59
  filterColumns[0].lock = false;
83
60
  }
84
61
  } else if (((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.columnFilters) !== false) {
85
62
  var _initialColumns$2, _initialColumns$3;
86
-
87
63
  if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.width) {
88
64
  filterColumns[0].width = initialColumns[0].width;
89
65
  }
90
-
91
66
  if ((_initialColumns$3 = initialColumns[0]) === null || _initialColumns$3 === void 0 ? void 0 : _initialColumns$3.lock) {
92
67
  filterColumns[0].lock = initialColumns[0].lock;
93
68
  }
94
69
  }
95
70
  }
96
-
97
71
  return filterColumns;
98
72
  };
99
73
  /** 默认请求翻页参数 */
100
-
101
-
102
74
  var globalPageKey = 'currentPage';
103
75
  var globalPageSizeKey = 'pageSize';
104
-
105
76
  var globalFormatSort = function globalFormatSort(sort) {
106
77
  if (Object.keys(sort).length > 0) {
107
78
  return {
108
79
  sort: sort
109
80
  };
110
81
  }
111
-
112
82
  return {};
113
83
  };
114
-
115
84
  var ProTable = function ProTable(props) {
116
85
  var _rowSelection$selecte;
117
-
118
86
  var header = props.header,
119
- className = props.className,
120
- tableClassName = props.tableClassName,
121
- mainAction = props.mainAction,
122
- extra = props.extra,
123
- propsDataFilter = props.dataFilter,
124
- afterDataFilter = props.afterDataFilter,
125
- toolBar = props.toolBar,
126
- propsColumns = props.columns,
127
- useRowSelection = props.useRowSelection,
128
- propsRowSelection = props.rowSelection,
129
- onChangeRowSelection = props.onChangeRowSelection,
130
- getRowSelection = props.getRowSelection,
131
- primaryKey = props.primaryKey,
132
- footerAction = props.footerAction,
133
- footer = props.footer,
134
- url = props.url,
135
- pageKey = props.pageKey,
136
- pageSizeKey = props.pageSizeKey,
137
- _props$method = props.method,
138
- method = _props$method === void 0 ? 'get' : _props$method,
139
- _props$params = props.params,
140
- propsParams = _props$params === void 0 ? {} : _props$params,
141
- formatSort = props.formatSort,
142
- _props$formatParams = props.formatParams,
143
- formatParams = _props$formatParams === void 0 ? function (params) {
144
- return params;
145
- } : _props$formatParams,
146
- formatResult = props.formatResult,
147
- requestConfig = props.requestConfig,
148
- _props$requestWhenMou = props.requestWhenMount,
149
- requestWhenMount = _props$requestWhenMou === void 0 ? true : _props$requestWhenMou,
150
- _props$showPagination = props.showPagination,
151
- showPagination = _props$showPagination === void 0 ? true : _props$showPagination,
152
- _props$pageSizeList = props.pageSizeList,
153
- pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
154
- responsivePaginationType = props.responsivePaginationType,
155
- _props$showSkeleton = props.showSkeleton,
156
- propsShowSkeleton = _props$showSkeleton === void 0 ? true : _props$showSkeleton,
157
- _props$skeletonSize = props.skeletonSize,
158
- skeletonSize = _props$skeletonSize === void 0 ? 5 : _props$skeletonSize,
159
- propsActionRef = props.actionRef,
160
- propsDataSource = props.dataSource,
161
- _props$filterDebounce = props.filterDebounce,
162
- filterDebounce = _props$filterDebounce === void 0 ? 300 : _props$filterDebounce,
163
- _props$footerSuction = props.footerSuction,
164
- footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
165
- _props$autoRefresh = props.autoRefresh,
166
- autoRefresh = _props$autoRefresh === void 0 ? function () {
167
- return false;
168
- } : _props$autoRefresh,
169
- customRequest = props.customRequest,
170
- _props$filterColumnTy = props.filterColumnType,
171
- filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
172
- defaultFilterParams = props.defaultFilterParams,
173
- _props$reserveSelecte = props.reserveSelectedRecords,
174
- reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
175
- _props$size = props.size,
176
- propsSize = _props$size === void 0 ? 'medium' : _props$size,
177
- disableSelectAll = props.disableSelectAll,
178
- context = props.context,
179
- _props$fixedTableBody = props.fixedTableBody,
180
- fixedTableBody = _props$fixedTableBody === void 0 ? false : _props$fixedTableBody,
181
- isTree = props.isTree,
182
- _props$toolBarAutoWid = props.toolBarAutoWidth,
183
- toolBarAutoWidth = _props$toolBarAutoWid === void 0 ? true : _props$toolBarAutoWid,
184
- dataTeamixSpm = props['data-teamix-spm'],
185
- _props$switchCardView = props.switchCardView,
186
- switchCardView = _props$switchCardView === void 0 ? false : _props$switchCardView,
187
- cardViewProps = props.cardViewProps,
188
- _props$defaultView = props.defaultView,
189
- defaultView = _props$defaultView === void 0 ? 'table' : _props$defaultView,
190
- otherProps = _objectWithoutProperties(props, _excluded);
191
-
87
+ className = props.className,
88
+ tableClassName = props.tableClassName,
89
+ mainAction = props.mainAction,
90
+ extra = props.extra,
91
+ propsDataFilter = props.dataFilter,
92
+ afterDataFilter = props.afterDataFilter,
93
+ toolBar = props.toolBar,
94
+ propsColumns = props.columns,
95
+ useRowSelection = props.useRowSelection,
96
+ propsRowSelection = props.rowSelection,
97
+ onChangeRowSelection = props.onChangeRowSelection,
98
+ getRowSelection = props.getRowSelection,
99
+ primaryKey = props.primaryKey,
100
+ footerAction = props.footerAction,
101
+ footer = props.footer,
102
+ url = props.url,
103
+ pageKey = props.pageKey,
104
+ pageSizeKey = props.pageSizeKey,
105
+ _props$method = props.method,
106
+ method = _props$method === void 0 ? 'get' : _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
+ requestConfig = props.requestConfig,
116
+ _props$requestWhenMou = props.requestWhenMount,
117
+ requestWhenMount = _props$requestWhenMou === void 0 ? true : _props$requestWhenMou,
118
+ _props$showPagination = props.showPagination,
119
+ showPagination = _props$showPagination === void 0 ? true : _props$showPagination,
120
+ _props$pageSizeList = props.pageSizeList,
121
+ pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
122
+ responsivePaginationType = props.responsivePaginationType,
123
+ _props$showSkeleton = props.showSkeleton,
124
+ propsShowSkeleton = _props$showSkeleton === void 0 ? true : _props$showSkeleton,
125
+ _props$skeletonSize = props.skeletonSize,
126
+ skeletonSize = _props$skeletonSize === void 0 ? 5 : _props$skeletonSize,
127
+ propsActionRef = props.actionRef,
128
+ propsDataSource = props.dataSource,
129
+ _props$filterDebounce = props.filterDebounce,
130
+ filterDebounce = _props$filterDebounce === void 0 ? 300 : _props$filterDebounce,
131
+ _props$footerSuction = props.footerSuction,
132
+ footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
133
+ _props$autoRefresh = props.autoRefresh,
134
+ autoRefresh = _props$autoRefresh === void 0 ? function () {
135
+ return false;
136
+ } : _props$autoRefresh,
137
+ customRequest = props.customRequest,
138
+ _props$filterColumnTy = props.filterColumnType,
139
+ filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
140
+ defaultFilterParams = props.defaultFilterParams,
141
+ _props$reserveSelecte = props.reserveSelectedRecords,
142
+ reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
143
+ _props$size = props.size,
144
+ propsSize = _props$size === void 0 ? 'medium' : _props$size,
145
+ disableSelectAll = props.disableSelectAll,
146
+ context = props.context,
147
+ _props$fixedTableBody = props.fixedTableBody,
148
+ fixedTableBody = _props$fixedTableBody === void 0 ? false : _props$fixedTableBody,
149
+ isTree = props.isTree,
150
+ _props$toolBarAutoWid = props.toolBarAutoWidth,
151
+ toolBarAutoWidth = _props$toolBarAutoWid === void 0 ? true : _props$toolBarAutoWid,
152
+ dataTeamixSpm = props['data-teamix-spm'],
153
+ _props$switchCardView = props.switchCardView,
154
+ switchCardView = _props$switchCardView === void 0 ? false : _props$switchCardView,
155
+ cardViewProps = props.cardViewProps,
156
+ _props$defaultView = props.defaultView,
157
+ defaultView = _props$defaultView === void 0 ? 'table' : _props$defaultView,
158
+ otherProps = _objectWithoutProperties(props, _excluded);
192
159
  var targetPageKey = pageKey || globalPageKey;
193
160
  var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
194
161
  var targetFormatSort = formatSort || globalFormatSort;
195
-
196
162
  var _useState = useState(1),
197
- _useState2 = _slicedToArray(_useState, 2),
198
- currentPage = _useState2[0],
199
- setCurrentPage = _useState2[1];
200
-
163
+ _useState2 = _slicedToArray(_useState, 2),
164
+ currentPage = _useState2[0],
165
+ setCurrentPage = _useState2[1];
201
166
  var _useState3 = useState(props.pageSize || 10),
202
- _useState4 = _slicedToArray(_useState3, 2),
203
- pageSize = _useState4[0],
204
- setPageSize = _useState4[1];
205
-
167
+ _useState4 = _slicedToArray(_useState3, 2),
168
+ pageSize = _useState4[0],
169
+ setPageSize = _useState4[1];
206
170
  var _useState5 = useState(0),
207
- _useState6 = _slicedToArray(_useState5, 2),
208
- total = _useState6[0],
209
- setTotal = _useState6[1];
210
-
171
+ _useState6 = _slicedToArray(_useState5, 2),
172
+ total = _useState6[0],
173
+ setTotal = _useState6[1];
211
174
  var _useState7 = useState(propsDataSource !== null && propsDataSource !== void 0 ? propsDataSource : []),
212
- _useState8 = _slicedToArray(_useState7, 2),
213
- data = _useState8[0],
214
- _setData = _useState8[1];
215
-
175
+ _useState8 = _slicedToArray(_useState7, 2),
176
+ data = _useState8[0],
177
+ _setData = _useState8[1];
216
178
  var _useState9 = useState(props.sort || {}),
217
- _useState10 = _slicedToArray(_useState9, 2),
218
- sort = _useState10[0],
219
- setSort = _useState10[1];
220
-
179
+ _useState10 = _slicedToArray(_useState9, 2),
180
+ sort = _useState10[0],
181
+ setSort = _useState10[1];
221
182
  var _useState11 = useState(!propsDataSource && requestWhenMount && propsShowSkeleton),
222
- _useState12 = _slicedToArray(_useState11, 2),
223
- showSkeleton = _useState12[0],
224
- setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
225
-
226
-
183
+ _useState12 = _slicedToArray(_useState11, 2),
184
+ showSkeleton = _useState12[0],
185
+ setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
227
186
  var skeletonDataSource = new Array(skeletonSize).fill({});
228
- var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data'; // 如果使用 customRequest 的话,内置 loading
229
-
187
+ var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data';
188
+ // 如果使用 customRequest 的话,内置 loading
230
189
  var _useState13 = useState(requestWhenMount),
231
- _useState14 = _slicedToArray(_useState13, 2),
232
- customTableLoading = _useState14[0],
233
- setCustomTableLoading = _useState14[1];
234
-
190
+ _useState14 = _slicedToArray(_useState13, 2),
191
+ customTableLoading = _useState14[0],
192
+ setCustomTableLoading = _useState14[1];
235
193
  var tableRef = useRef(null);
236
- var actionRef = useRef(); // 传给 table 的过滤后的 columns
237
-
194
+ var actionRef = useRef();
195
+ // 传给 table 的过滤后的 columns
238
196
  var _useState15 = useState(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns)),
239
- _useState16 = _slicedToArray(_useState15, 2),
240
- filteredColumns = _useState16[0],
241
- setFilteredColumns = _useState16[1];
242
-
197
+ _useState16 = _slicedToArray(_useState15, 2),
198
+ filteredColumns = _useState16[0],
199
+ setFilteredColumns = _useState16[1];
243
200
  var _useState17 = useState(propsSize),
244
- _useState18 = _slicedToArray(_useState17, 2),
245
- size = _useState18[0],
246
- _setSize = _useState18[1];
247
-
201
+ _useState18 = _slicedToArray(_useState17, 2),
202
+ size = _useState18[0],
203
+ _setSize = _useState18[1];
248
204
  var _useState19 = useState(true),
249
- _useState20 = _slicedToArray(_useState19, 2),
250
- showLoading = _useState20[0],
251
- setShowLoading = _useState20[1]; // 存储能够被 on 监听到的 ProTable 状态
205
+ _useState20 = _slicedToArray(_useState19, 2),
206
+ showLoading = _useState20[0],
207
+ setShowLoading = _useState20[1];
208
+ // 存储能够被 on 监听到的 ProTable 状态
252
209
  // 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
253
-
254
-
255
210
  var _useState21 = useState({
256
- fullScreenState: false,
257
- filterRules: {},
258
- filterColumns: []
259
- }),
260
- _useState22 = _slicedToArray(_useState21, 1),
261
- actionRefState = _useState22[0]; // 存储 on 监听事件
262
-
263
-
211
+ fullScreenState: false,
212
+ filterRules: {},
213
+ filterColumns: []
214
+ }),
215
+ _useState22 = _slicedToArray(_useState21, 1),
216
+ actionRefState = _useState22[0];
217
+ // 存储 on 监听事件
264
218
  var _useState23 = useState({
265
- fullScreenState: {}
266
- }),
267
- _useState24 = _slicedToArray(_useState23, 1),
268
- actionRefCallback = _useState24[0]; // 存储定时器 id
269
-
270
-
219
+ fullScreenState: {}
220
+ }),
221
+ _useState24 = _slicedToArray(_useState23, 1),
222
+ actionRefCallback = _useState24[0];
223
+ // 存储定时器 id
271
224
  var autoRefreshTimerRef = useRef();
272
225
  var onResize = null;
273
226
  useEffect(function () {
274
227
  var _propsDataFilter$sche, _propsDataFilter$sche2;
275
-
276
228
  getHeaderHeight(fullscreenState);
277
229
  getFooterSuctionState();
278
-
279
230
  if (window.onresize) {
280
231
  onResize = window.onresize;
281
232
  window.onresize = debounce(function () {
282
233
  var _onResize;
283
-
284
234
  (_onResize = onResize) === null || _onResize === void 0 ? void 0 : _onResize();
285
-
286
235
  if (footerSuction) {
287
236
  getFooterSuctionState();
288
237
  }
289
-
290
238
  if (fixedTableBody) {
291
239
  getHeaderHeight(fullscreenState);
292
240
  }
@@ -296,44 +244,35 @@ var ProTable = function ProTable(props) {
296
244
  if (footerSuction) {
297
245
  getFooterSuctionState();
298
246
  }
299
-
300
247
  if (fixedTableBody) {
301
248
  getHeaderHeight(fullscreenState);
302
249
  }
303
250
  }, 500);
304
- } // 如果不传 dataFilter,则在这里初始化请求
305
-
306
-
251
+ }
252
+ // 如果不传 dataFilter,则在这里初始化请求
307
253
  var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
308
-
309
254
  if (requestWhenMount && !hasDataFilter) {
310
255
  processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
311
-
312
256
  _request();
313
257
  }
314
-
315
258
  return function () {
316
259
  if (onResize) {
317
260
  window.onresize = onResize;
318
261
  } else {
319
262
  window.onresize = null;
320
263
  }
321
-
322
264
  if (autoRefreshTimerRef.current) {
323
265
  clearTimeout(autoRefreshTimerRef.current);
324
266
  }
325
-
326
267
  actionRef.current = undefined;
327
268
  };
328
- }, []); // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
329
-
269
+ }, []);
270
+ // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
330
271
  var getHeaderHeight = function getHeaderHeight(isFullscreen, offset) {
331
272
  var _tableDom$getElements, _tableDom$getElements2, _document$querySelect, _document$querySelect2, _document$querySelect3;
332
-
333
273
  if (!fixedTableBody) {
334
274
  return;
335
275
  }
336
-
337
276
  var tableDom = tableRef.current;
338
277
  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];
339
278
  var basePrefix = usePrefixCls('', {
@@ -342,105 +281,90 @@ var ProTable = function ProTable(props) {
342
281
  var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName(basePrefix('table-header-inner'))) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
343
282
  var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
344
283
  var teamixNavDom = document.querySelector('.teamix-nav-console');
345
- var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer'); // 这边不能直接取 next-table-body
346
-
284
+ var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
285
+ // 这边不能直接取 next-table-body
347
286
  var tableBodyDom = (_document$querySelect = document.querySelector('.teamix-pro-table')) === null || _document$querySelect === void 0 ? void 0 : (_document$querySelect2 = _document$querySelect.getElementsByTagName('table')) === null || _document$querySelect2 === void 0 ? void 0 : (_document$querySelect3 = _document$querySelect2[1]) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.parentNode;
348
287
  var headerFixedTopSectionDom = document.querySelector('.teamix-pro-page-container-fixed-top');
349
288
  setTimeout(function () {
350
289
  var _headerDom$offsetHeig, _tableHeaderDom$offse;
351
-
352
- var headerHeight = (_headerDom$offsetHeig = headerDom === null || headerDom === void 0 ? void 0 : headerDom.offsetHeight) !== null && _headerDom$offsetHeig !== void 0 ? _headerDom$offsetHeig : 0; // table表头默认一行。即42px
353
-
290
+ var headerHeight = (_headerDom$offsetHeig = headerDom === null || headerDom === void 0 ? void 0 : headerDom.offsetHeight) !== null && _headerDom$offsetHeig !== void 0 ? _headerDom$offsetHeig : 0;
291
+ // table表头默认一行。即42px
354
292
  var tableHeaderHeight = (_tableHeaderDom$offse = tableHeaderDom === null || tableHeaderDom === void 0 ? void 0 : tableHeaderDom.offsetHeight) !== null && _tableHeaderDom$offse !== void 0 ? _tableHeaderDom$offse : 42;
355
- var footerRowSelectionHeight = (footerRowSelectionDom === null || footerRowSelectionDom === void 0 ? void 0 : footerRowSelectionDom.offsetHeight) || 50; // 固定表格主体高度
356
-
293
+ var footerRowSelectionHeight = (footerRowSelectionDom === null || footerRowSelectionDom === void 0 ? void 0 : footerRowSelectionDom.offsetHeight) || 50;
294
+ // 固定表格主体高度
357
295
  if (fixedTableBody && !isFullscreen) {
358
296
  var _pageContainerDom$off, _teamixNavDom$offsetH;
359
-
360
297
  // 16px 为 padding
361
298
  var pageHeaderHeight = ((_pageContainerDom$off = pageContainerDom === null || pageContainerDom === void 0 ? void 0 : pageContainerDom.offsetHeight) !== null && _pageContainerDom$off !== void 0 ? _pageContainerDom$off : 0) + 16;
362
- var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0; // 1 为预留值,js无法取出精确高度,会被四舍五入
363
-
299
+ var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0;
300
+ // 1 为预留值,js无法取出精确高度,会被四舍五入
364
301
  var offsetHeaderHeight = headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0) + 1;
365
-
366
302
  if (switchViewState === 'card') {
367
303
  offsetHeaderHeight = offsetHeaderHeight - tableHeaderHeight - footerRowSelectionHeight;
368
304
  }
369
-
370
305
  if ((tableBodyDom === null || tableBodyDom === void 0 ? void 0 : tableBodyDom.clientHeight) < (tableBodyDom === null || tableBodyDom === void 0 ? void 0 : tableBodyDom.scrollHeight)) {
371
306
  setFooterSuctionState(true);
372
307
  } else {
373
308
  setFooterSuctionState(false);
374
- } // 如果有切换区tab,那么重新计算
375
-
376
-
309
+ }
310
+ // 如果有切换区tab,那么重新计算
377
311
  if (headerFixedTopSectionDom.clientHeight) {
378
312
  var _headerFixedTopSectio;
379
-
380
- var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0; // const clientTableBodyHeight =
313
+ var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0;
314
+ // const clientTableBodyHeight =
381
315
  // document.body.clientHeight - offsetHeaderHeight;
382
-
383
316
  setHeaderHeight(headerFixedTopSectionHeight + teamixNavHeight + footerRowSelectionHeight + tableHeaderHeight + 1);
384
317
  return;
385
318
  }
386
-
387
319
  setHeaderHeight(offsetHeaderHeight);
388
320
  } else {
389
321
  // 24px 为 padding
390
322
  setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0) + 1);
391
323
  }
392
324
  }, 50);
393
- }; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
394
-
395
-
325
+ };
326
+ // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
396
327
  var _useState25 = useState(0),
397
- _useState26 = _slicedToArray(_useState25, 2),
398
- headerHeight = _useState26[0],
399
- setHeaderHeight = _useState26[1]; // 全屏显示 className
400
-
401
-
328
+ _useState26 = _slicedToArray(_useState25, 2),
329
+ headerHeight = _useState26[0],
330
+ setHeaderHeight = _useState26[1];
331
+ // 全屏显示 className
402
332
  var _useState27 = useState(false),
403
- _useState28 = _slicedToArray(_useState27, 2),
404
- fullscreenState = _useState28[0],
405
- setFullscreenState = _useState28[1]; // 切换视角
406
-
407
-
333
+ _useState28 = _slicedToArray(_useState27, 2),
334
+ fullscreenState = _useState28[0],
335
+ setFullscreenState = _useState28[1];
336
+ // 切换视角
408
337
  var _useState29 = useState(defaultView !== null && defaultView !== void 0 ? defaultView : 'table'),
409
- _useState30 = _slicedToArray(_useState29, 2),
410
- switchViewState = _useState30[0],
411
- setSwitchViewState = _useState30[1]; // 切换全屏搜索开关
412
-
413
-
338
+ _useState30 = _slicedToArray(_useState29, 2),
339
+ switchViewState = _useState30[0],
340
+ setSwitchViewState = _useState30[1];
341
+ // 切换全屏搜索开关
414
342
  var filterEnableRef = useRef({
415
343
  fullscreen: false,
416
344
  normal: true
417
- }); // 非全屏状态下的
418
-
345
+ });
346
+ // 非全屏状态下的
419
347
  var normalDataFilterFormRef = useRef();
420
348
  var fullscreenDataFilterFormRef = useRef();
421
349
  var normalDataFilterForm = normalDataFilterFormRef.current;
422
- var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current; // 传给 QueryFilter 的 formRef
423
-
424
- var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef; // let dataFilterForm = dataFilterFormRef.current;
350
+ var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current;
351
+ // 传给 QueryFilter 的 formRef
352
+ var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
353
+ // let dataFilterForm = dataFilterFormRef.current;
425
354
  // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
426
-
427
355
  var _useState31 = useState(false),
428
- _useState32 = _slicedToArray(_useState31, 2),
429
- footerSuctionState = _useState32[0],
430
- setFooterSuctionState = _useState32[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
431
-
432
-
356
+ _useState32 = _slicedToArray(_useState31, 2),
357
+ footerSuctionState = _useState32[0],
358
+ setFooterSuctionState = _useState32[1];
359
+ // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
433
360
  var getFooterSuctionState = function getFooterSuctionState() {
434
361
  if (!footerSuction) {
435
362
  return;
436
363
  }
437
-
438
364
  var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
439
-
440
365
  if (containerDom) {
441
366
  var offsetHeight = containerDom.offsetHeight;
442
367
  var scrollHeight = containerDom.scrollHeight;
443
-
444
368
  if (offsetHeight < scrollHeight) {
445
369
  setFooterSuctionState(true);
446
370
  } else {
@@ -452,35 +376,28 @@ var ProTable = function ProTable(props) {
452
376
  setFooterSuctionState(true);
453
377
  }
454
378
  }
455
- }; // rowSelection 相关
456
-
457
-
379
+ };
380
+ // rowSelection 相关
458
381
  var rowSelectionHook = useTableSelection(_objectSpread(_objectSpread({}, propsRowSelection), {}, {
459
382
  // 当初始出现骨架屏的时候,不可选择
460
383
  getProps: function getProps(record, index) {
461
384
  var result = {};
462
-
463
385
  if (propsRowSelection === null || propsRowSelection === void 0 ? void 0 : propsRowSelection.getProps) {
464
386
  result = propsRowSelection.getProps(record, index);
465
387
  }
466
-
467
388
  if (showSkeleton && result) {
468
389
  result.disabled = true;
469
390
  }
470
-
471
391
  return result;
472
392
  },
473
393
  titleProps: function titleProps() {
474
394
  var result = {};
475
-
476
395
  if (propsRowSelection === null || propsRowSelection === void 0 ? void 0 : propsRowSelection.titleProps) {
477
396
  result = propsRowSelection.titleProps();
478
397
  }
479
-
480
398
  if (showSkeleton || disableSelectAll) {
481
399
  result.disabled = true;
482
400
  }
483
-
484
401
  return result;
485
402
  },
486
403
  onChange: onChangeRowSelection
@@ -489,21 +406,19 @@ var ProTable = function ProTable(props) {
489
406
  var selectedCount = (rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.length) || 0;
490
407
  useEffect(function () {
491
408
  getRowSelection && getRowSelection(rowSelectionHook);
492
- }, [rowSelectionHook]); // 获取 table 左下角 checkbox 属性
493
-
409
+ }, [rowSelectionHook]);
410
+ // 获取 table 左下角 checkbox 属性
494
411
  function getCheckAllProps() {
495
412
  var _rowSelection$onChang = rowSelection.onChange,
496
- _onChange = _rowSelection$onChang === void 0 ? function () {} : _rowSelection$onChang,
497
- _rowSelection$onSelec = rowSelection.onSelectAll,
498
- onSelectAll = _rowSelection$onSelec === void 0 ? function () {} : _rowSelection$onSelec,
499
- _rowSelection$selecte2 = rowSelection.selectedRowKeys,
500
- selectedRowKeys = _rowSelection$selecte2 === void 0 ? [] : _rowSelection$selecte2,
501
- getProps = rowSelection.getProps;
502
-
413
+ _onChange = _rowSelection$onChang === void 0 ? function () {} : _rowSelection$onChang,
414
+ _rowSelection$onSelec = rowSelection.onSelectAll,
415
+ onSelectAll = _rowSelection$onSelec === void 0 ? function () {} : _rowSelection$onSelec,
416
+ _rowSelection$selecte2 = rowSelection.selectedRowKeys,
417
+ selectedRowKeys = _rowSelection$selecte2 === void 0 ? [] : _rowSelection$selecte2,
418
+ getProps = rowSelection.getProps;
503
419
  var dataSource = data;
504
420
  var allRowKeys = dataSource.filter(function (d, i) {
505
421
  var _getProps;
506
-
507
422
  return getProps ? !((_getProps = getProps(d, i)) === null || _getProps === void 0 ? void 0 : _getProps.disabled) : true;
508
423
  }).map(function (d) {
509
424
  return getDeepValue(primaryKey || 'id', d);
@@ -519,15 +434,12 @@ var ProTable = function ProTable(props) {
519
434
  result.push.apply(result, _toConsumableArray(allRowKeys.filter(function (k) {
520
435
  return !selectedRowKeys.includes(k);
521
436
  })));
522
-
523
437
  _onChange(result, dataSource);
524
-
525
438
  onSelectAll(check, dataSource);
526
439
  } else {
527
440
  _onChange(selectedRowKeys.filter(function (k) {
528
441
  return !allRowKeys.includes(k);
529
442
  }), []);
530
-
531
443
  onSelectAll(check, []);
532
444
  }
533
445
  },
@@ -535,7 +447,6 @@ var ProTable = function ProTable(props) {
535
447
  checked: nowCheckedKeys.length !== 0 && nowCheckedKeys.length === allRowKeys.length
536
448
  };
537
449
  }
538
-
539
450
  useEffect(function () {
540
451
  if (typeof propsActionRef === 'function' && actionRef.current) {
541
452
  // @ts-ignore
@@ -544,18 +455,17 @@ var ProTable = function ProTable(props) {
544
455
  }, [propsActionRef]);
545
456
  useEffect(function () {
546
457
  var _actionRef$current, _actionRef$current$se;
547
-
548
458
  var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns);
549
459
  setFilteredColumns(columns);
550
460
  (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'filterColumns', columns);
551
- }, [propsColumns]); // dataSource 受控
552
-
461
+ }, [propsColumns]);
462
+ // dataSource 受控
553
463
  useEffect(function () {
554
464
  if (propsDataSource) {
555
465
  _setData(propsDataSource);
556
466
  }
557
- }, [propsDataSource]); // 初始化 ActionRef。
558
-
467
+ }, [propsDataSource]);
468
+ // 初始化 ActionRef。
559
469
  initActionRef(actionRef, {
560
470
  getState: function getState() {
561
471
  return actionRefState;
@@ -571,32 +481,28 @@ var ProTable = function ProTable(props) {
571
481
  if (!actionRefCallback[state]) {
572
482
  actionRefCallback[state] = {};
573
483
  }
574
-
575
484
  actionRefCallback[state][name] = fun;
576
485
  },
577
486
  off: function off(name) {
578
487
  actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (_ref) {
579
488
  var _ref2 = _slicedToArray(_ref, 2),
580
- k = _ref2[0],
581
- v = _ref2[1];
582
-
489
+ k = _ref2[0],
490
+ v = _ref2[1];
583
491
  var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref3) {
584
492
  var _ref4 = _slicedToArray(_ref3, 1),
585
- k = _ref4[0];
586
-
493
+ k = _ref4[0];
587
494
  return k !== name;
588
495
  }));
589
496
  return [k, filterV];
590
497
  }));
591
498
  }
592
- }); // 绑定 Actions
593
-
499
+ });
500
+ // 绑定 Actions
594
501
  useActionType(actionRef, {
595
502
  fullScreen: function fullScreen() {
596
503
  var _actionRef$current2, _actionRef$current2$s;
597
-
598
- var state = !fullscreenState; // 全屏时需要重新计算header高度
599
-
504
+ var state = !fullscreenState;
505
+ // 全屏时需要重新计算header高度
600
506
  setFullscreenState(state);
601
507
  getHeaderHeight(state);
602
508
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'fullScreenState', state);
@@ -604,12 +510,10 @@ var ProTable = function ProTable(props) {
604
510
  },
605
511
  setColumn: function setColumn(newColumns) {
606
512
  var _actionRef$current3, _actionRef$current3$s;
607
-
608
513
  var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
609
514
  var columns = processColumns(newColumns, propsColumns);
610
515
  setFilteredColumns(columns);
611
516
  (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterColumns', columns);
612
-
613
517
  if (update) {
614
518
  emit('refreshFilterState', newColumns);
615
519
  }
@@ -622,9 +526,7 @@ var ProTable = function ProTable(props) {
622
526
  // card视角的刷新等于重新请求
623
527
  if (switchViewState === 'card') {
624
528
  setCurrentPage(1);
625
-
626
529
  _request(_objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)));
627
-
628
530
  setShowSkeleton(true);
629
531
  } else {
630
532
  _request(params);
@@ -635,22 +537,18 @@ var ProTable = function ProTable(props) {
635
537
  if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
636
538
  setCurrentPage(params[targetPageKey]);
637
539
  }
638
-
639
540
  if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
640
541
  setPageSize(params[targetPageSizeKey]);
641
542
  }
642
-
643
543
  _request(params);
644
544
  },
645
545
  reset: function reset() {
646
546
  var _actionRef$current4, _actionRef$current4$s, _dataFilterFormRef$cu;
647
-
648
- (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
649
-
547
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
548
+ // 清空列过滤参数
650
549
  (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, {});
651
550
  (_dataFilterFormRef$cu = dataFilterFormRef.current) === null || _dataFilterFormRef$cu === void 0 ? void 0 : _dataFilterFormRef$cu.reset();
652
551
  setCurrentPage(1);
653
-
654
552
  _request(_defineProperty({}, targetPageKey, 1));
655
553
  },
656
554
  resetPage: function resetPage() {
@@ -659,7 +557,6 @@ var ProTable = function ProTable(props) {
659
557
  nextPage: function nextPage() {
660
558
  var newCurrentPage = currentPage + 1;
661
559
  setCurrentPage(newCurrentPage);
662
-
663
560
  _request(_defineProperty({}, targetPageKey, newCurrentPage));
664
561
  },
665
562
  rowSelection: rowSelection,
@@ -691,63 +588,46 @@ var ProTable = function ProTable(props) {
691
588
  setSwitchViewState(view);
692
589
  setShowSkeleton(true);
693
590
  setCurrentPage(1);
694
-
695
591
  if (view === 'table') {
696
592
  var _request4;
697
-
698
593
  setPageSize(pageSize !== null && pageSize !== void 0 ? pageSize : 20);
699
-
700
594
  _request((_request4 = {}, _defineProperty(_request4, targetPageSizeKey, pageSize !== null && pageSize !== void 0 ? pageSize : 20), _defineProperty(_request4, targetPageKey, 1), _request4));
701
595
  }
702
-
703
596
  if (view === 'card') {
704
597
  var _cardViewProps$pageSi, _cardViewProps$pageSi2, _request5;
705
-
706
598
  setPageSize((_cardViewProps$pageSi = cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.pageSize) !== null && _cardViewProps$pageSi !== void 0 ? _cardViewProps$pageSi : 12);
707
-
708
599
  _request((_request5 = {}, _defineProperty(_request5, targetPageSizeKey, (_cardViewProps$pageSi2 = cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.pageSize) !== null && _cardViewProps$pageSi2 !== void 0 ? _cardViewProps$pageSi2 : 12), _defineProperty(_request5, targetPageKey, 1), _request5));
709
600
  }
710
-
711
601
  getHeaderHeight(fullscreenState);
712
602
  }
713
- }); // 将 Actions 绑定到传入的 propsActionRef 中
714
-
603
+ });
604
+ // 将 Actions 绑定到传入的 propsActionRef 中
715
605
  if (propsActionRef) {
716
606
  propsActionRef.current = actionRef.current;
717
607
  }
718
-
719
608
  function onFormatResult(next) {
720
609
  props.onFormatResult && props.onFormatResult(next);
721
610
  var time = autoRefresh ? autoRefresh(next.data) : false;
722
-
723
611
  if (Number.isInteger(time) && time >= 1000) {
724
612
  autoRefreshTimerRef.current = setTimeout(function () {
725
613
  // 自动刷新不显示 loading
726
614
  _request({}, true);
727
615
  }, Number(time));
728
- } // 设置 dataSource、total
729
-
730
-
616
+ }
617
+ // 设置 dataSource、total
731
618
  if (switchViewState === 'table' || currentPage === 1) {
732
619
  var _next$data;
733
-
734
620
  _setData(next.data || []);
735
-
736
621
  setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
737
622
  }
738
-
739
623
  if (switchViewState === 'card' && currentPage !== 1) {
740
624
  var _next$data2;
741
-
742
625
  _setData([].concat(_toConsumableArray(data), _toConsumableArray(next.data || [])));
743
-
744
626
  setTotal(total + (next.total || ((_next$data2 = next.data) === null || _next$data2 === void 0 ? void 0 : _next$data2.length)));
745
627
  }
746
-
747
628
  setShowSkeleton(false);
748
- } // 请求表格数据工具函数
749
-
750
-
629
+ }
630
+ // 请求表格数据工具函数
751
631
  var getData = useRequest(function (params) {
752
632
  return _defineProperty({
753
633
  url: url,
@@ -763,7 +643,6 @@ var ProTable = function ProTable(props) {
763
643
  onSuccess: function onSuccess(result) {
764
644
  props.onSuccess && props.onSuccess(result);
765
645
  var nextData = result;
766
-
767
646
  if (formatResult) {
768
647
  if (typeof formatResult === 'function') {
769
648
  nextData = formatResult(result) || {};
@@ -775,7 +654,6 @@ var ProTable = function ProTable(props) {
775
654
  };
776
655
  }
777
656
  }
778
-
779
657
  if (nextData instanceof Promise) {
780
658
  nextData.then(function (res) {
781
659
  onFormatResult(res);
@@ -784,62 +662,54 @@ var ProTable = function ProTable(props) {
784
662
  });
785
663
  } else {
786
664
  onFormatResult(nextData);
787
- } // 重新计算是否需要吸底
788
-
789
-
665
+ }
666
+ // 重新计算是否需要吸底
790
667
  if (footerSuction) {
791
668
  getFooterSuctionState();
792
669
  }
793
-
794
670
  if (fixedTableBody) {
795
671
  getHeaderHeight(fullscreenState);
796
672
  }
797
673
  },
798
674
  onError: function onError(error) {
799
675
  setShowSkeleton(false);
800
-
801
676
  if (props.onError) {
802
677
  props.onError(error);
803
- } else {// Message.error(error.toString());
804
- } // 重新计算是否需要吸底
805
-
806
-
678
+ } else {
679
+ // Message.error(error.toString());
680
+ }
681
+ // 重新计算是否需要吸底
807
682
  if (footerSuction) {
808
683
  getFooterSuctionState();
809
684
  }
810
-
811
685
  if (fixedTableBody) {
812
686
  getHeaderHeight(fullscreenState);
813
687
  }
814
688
  }
815
- }); // 请求函数
816
-
689
+ });
690
+ // 请求函数
817
691
  function _request(params, noLoading, filterParams) {
818
692
  var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread3;
819
-
820
693
  // 如果没有传 url 且没有 customRequest,直接返回
821
694
  if (!url && !customRequest) {
822
695
  return;
823
696
  }
824
-
825
697
  var nextShowLoading = !noLoading;
826
- nextShowLoading !== showLoading && setShowLoading(nextShowLoading); // 请求前需要优先清空列过滤条件
698
+ nextShowLoading !== showLoading && setShowLoading(nextShowLoading);
699
+ // 请求前需要优先清空列过滤条件
827
700
  // actionRef.current?.setFilterRules?.({});
828
-
829
- var sortParams = targetFormatSort(sort); // 筛选区请求参数
830
-
831
- var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : (_dataFilterFormRef$cu2 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu2 === void 0 ? void 0 : _dataFilterFormRef$cu2.values; // 列过滤请求参数
832
-
833
- var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
834
-
701
+ var sortParams = targetFormatSort(sort);
702
+ // 筛选区请求参数
703
+ var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : (_dataFilterFormRef$cu2 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu2 === void 0 ? void 0 : _dataFilterFormRef$cu2.values;
704
+ // 列过滤请求参数
705
+ var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
706
+ // 格式化后的请求参数
835
707
  var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread3 = {}, _defineProperty(_objectSpread3, targetPageKey, currentPage), _defineProperty(_objectSpread3, targetPageSizeKey, pageSize), _objectSpread3), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
836
-
837
708
  if (requestData) {
838
709
  if (autoRefreshTimerRef.current) {
839
710
  clearTimeout(autoRefreshTimerRef.current);
840
711
  autoRefreshTimerRef.current = null;
841
712
  }
842
-
843
713
  if (!(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.searchUndefined)) {
844
714
  Object.keys(requestData).forEach(function (key) {
845
715
  if (requestData[key] === undefined) {
@@ -847,53 +717,42 @@ var ProTable = function ProTable(props) {
847
717
  }
848
718
  });
849
719
  }
850
-
851
720
  if (!(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.searchEmptyString)) {
852
721
  Object.keys(requestData).forEach(function (key) {
853
722
  if (requestData[key] === '') {
854
723
  delete requestData[key];
855
724
  }
856
725
  });
857
- } // 如果使用自定义请求
858
-
859
-
726
+ }
727
+ // 如果使用自定义请求
860
728
  if (customRequest && typeof customRequest === 'function') {
861
729
  setCustomTableLoading(true);
862
730
  customRequest(requestData).then(function (res) {
863
731
  var dataRes = res.data,
864
- totalRes = res.total,
865
- success = res.success;
866
-
732
+ totalRes = res.total,
733
+ success = res.success;
867
734
  if (success === true) {
868
735
  // 设置 dataSource、total
869
736
  if (switchViewState === 'table' || params['targetPageKey'] === 1) {
870
737
  _setData(dataRes || []);
871
-
872
738
  setTotal(totalRes || (dataRes === null || dataRes === void 0 ? void 0 : dataRes.length));
873
739
  }
874
-
875
740
  if (switchViewState === 'card' && params['targetPageKey'] !== 1) {
876
741
  _setData([].concat(_toConsumableArray(data), _toConsumableArray(dataRes || [])));
877
-
878
742
  setTotal(total + (totalRes || (dataRes === null || dataRes === void 0 ? void 0 : dataRes.length)));
879
743
  }
880
-
881
744
  setShowSkeleton(false);
882
745
  setCustomTableLoading(false);
883
- } // 重新计算是否需要吸底
884
-
885
-
746
+ }
747
+ // 重新计算是否需要吸底
886
748
  if (footerSuction) {
887
749
  getFooterSuctionState();
888
750
  }
889
-
890
751
  if (fixedTableBody) {
891
752
  getHeaderHeight(fullscreenState);
892
- } // customRequest 中支持 autoRefresh
893
-
894
-
753
+ }
754
+ // customRequest 中支持 autoRefresh
895
755
  var time = autoRefresh ? autoRefresh(data) : false;
896
-
897
756
  if (Number.isInteger(time) && time >= 1000) {
898
757
  autoRefreshTimerRef.current = setTimeout(function () {
899
758
  // 自动刷新不显示 loading
@@ -906,23 +765,18 @@ var ProTable = function ProTable(props) {
906
765
  }
907
766
  }
908
767
  }
909
-
910
768
  function onSort(dataIndex, order) {
911
769
  var nextSort = _defineProperty({}, dataIndex, order);
912
-
913
770
  setSort(nextSort);
914
-
915
771
  _request(targetFormatSort(nextSort));
916
- } // 处理 dataFilter 中的 onFilter、onReset
917
-
918
-
772
+ }
773
+ // 处理 dataFilter 中的 onFilter、onReset
919
774
  var dataFilter = _objectSpread(_objectSpread({
920
775
  mode: 'inline',
921
776
  forceClear: true
922
777
  }, propsDataFilter), {}, {
923
778
  onInit: (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) || requestWhenMount ? function (values) {
924
779
  var _propsDataFilter$onIn;
925
-
926
780
  // 表单初始化请求处理
927
781
  propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$onIn = propsDataFilter.onInit) === null || _propsDataFilter$onIn === void 0 ? void 0 : _propsDataFilter$onIn.call(propsDataFilter, values);
928
782
  !fullscreenState && requestWhenMount && _request({}, false, values);
@@ -930,37 +784,30 @@ var ProTable = function ProTable(props) {
930
784
  } : undefined,
931
785
  onFilter: function onFilter(values) {
932
786
  var _actionRef$current6, _actionRef$current6$c;
933
-
934
787
  // 全屏状态,判断全屏表单onFilter是否禁用
935
788
  if (fullscreenState && !filterEnableRef.current.fullscreen) {
936
789
  filterEnableRef.current.fullscreen = true;
937
790
  return;
938
- } // 非全屏状态,判断普通表单onFiler是否禁用
939
-
940
-
791
+ }
792
+ // 非全屏状态,判断普通表单onFiler是否禁用
941
793
  if (!fullscreenState && !filterEnableRef.current.normal) {
942
794
  filterEnableRef.current.normal = true;
943
795
  return;
944
796
  }
945
-
946
- (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
947
-
797
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
798
+ // 搜索变化时,暂时先清空选择
948
799
  (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
949
800
  setCurrentPage(1);
950
-
951
801
  _request(_defineProperty({}, targetPageKey, 1), false, values);
952
802
  },
953
803
  onReset: function onReset(values) {
954
804
  var _dataFilterFormRef$cu3;
955
-
956
805
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
957
806
  (_dataFilterFormRef$cu3 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu3 === void 0 ? void 0 : _dataFilterFormRef$cu3.reset();
958
807
  setCurrentPage(1);
959
-
960
808
  _request(_defineProperty({}, targetPageKey, 1), false, values);
961
809
  }
962
810
  });
963
-
964
811
  var getTableLoading = function getTableLoading() {
965
812
  if (!customRequest) {
966
813
  return showLoading && !showSkeleton && (getData.loading || props.loading);
@@ -968,7 +815,6 @@ var ProTable = function ProTable(props) {
968
815
  return showLoading && !showSkeleton && (customTableLoading || props.loading);
969
816
  }
970
817
  };
971
-
972
818
  var renderTable = function renderTable(isFullScreen) {
973
819
  if (propsColumns) {
974
820
  return /*#__PURE__*/React.createElement("div", {
@@ -1017,7 +863,7 @@ var ProTable = function ProTable(props) {
1017
863
  dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
1018
864
  showSkeleton: showSkeleton,
1019
865
  loading: getTableLoading(),
1020
- originColumns: columns,
866
+ originColumns: propsColumns,
1021
867
  cardViewProps: cardViewProps,
1022
868
  scrollHeight: fullscreenState || fixedTableBody ? "calc(100vh - ".concat(headerHeight, "px)") : undefined,
1023
869
  actionRef: actionRef,
@@ -1031,27 +877,23 @@ var ProTable = function ProTable(props) {
1031
877
  }, pickProps(getTableProps(), otherProps)));
1032
878
  }
1033
879
  };
1034
-
1035
880
  var renderFooterAction = function renderFooterAction() {
1036
881
  var _footerAction$actions;
1037
-
1038
882
  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) {
1039
883
  // 默认 context
1040
884
  var defaultContext = {
1041
885
  action: actionRef.current,
1042
886
  rowSelection: rowSelection
1043
- }; // 未选择的时候所有 button 默认 disabled
1044
-
887
+ };
888
+ // 未选择的时候所有 button 默认 disabled
1045
889
  var targetActions = footerAction.actions.map(function (action) {
1046
890
  return _objectSpread(_objectSpread({}, action), {}, {
1047
891
  disabled: (action === null || action === void 0 ? void 0 : action.disabled) || selectedCount === 0
1048
892
  });
1049
893
  });
1050
-
1051
894
  var targetFooterActions = _objectSpread(_objectSpread({}, footerAction), {}, {
1052
895
  actions: targetActions
1053
896
  });
1054
-
1055
897
  return /*#__PURE__*/React.createElement("div", {
1056
898
  className: cls('footer-action')
1057
899
  }, /*#__PURE__*/React.createElement(ProActionGroup, _objectSpread(_objectSpread({}, targetFooterActions), {}, {
@@ -1060,39 +902,28 @@ var ProTable = function ProTable(props) {
1060
902
  })));
1061
903
  } else return footerAction;
1062
904
  };
1063
-
1064
905
  var renderFooter = function renderFooter() {
1065
906
  function onChangePagination(currentPage) {
1066
907
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1067
-
1068
908
  // 翻页默认清空选择
1069
909
  if (!reserveSelectedRecords) {
1070
910
  var _actionRef$current7, _actionRef$current7$c;
1071
-
1072
911
  (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
1073
912
  }
1074
-
1075
913
  setCurrentPage(currentPage);
1076
-
1077
914
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
1078
915
  }
1079
-
1080
916
  function onChangePaginationSize(currentPageSize) {
1081
917
  var _request8;
1082
-
1083
918
  // 翻页默认清空选择
1084
919
  if (!reserveSelectedRecords) {
1085
920
  var _actionRef$current8, _actionRef$current8$c;
1086
-
1087
921
  (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
1088
922
  }
1089
-
1090
923
  setPageSize(currentPageSize);
1091
924
  setCurrentPage(1);
1092
-
1093
925
  _request((_request8 = {}, _defineProperty(_request8, targetPageSizeKey, currentPageSize), _defineProperty(_request8, targetPageKey, 1), _request8));
1094
926
  }
1095
-
1096
927
  function renderRowSelection() {
1097
928
  if (rowSelection) {
1098
929
  if (showSkeleton) {
@@ -1122,7 +953,6 @@ var ProTable = function ProTable(props) {
1122
953
  }
1123
954
  }
1124
955
  }
1125
-
1126
956
  if (showPagination && switchViewState === 'table') {
1127
957
  return /*#__PURE__*/React.createElement("div", {
1128
958
  className: cls('footer', {
@@ -1163,21 +993,18 @@ var ProTable = function ProTable(props) {
1163
993
  className: cls('footer-right-wrapper')
1164
994
  }, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : footer));
1165
995
  }
1166
- }; // 判断是否需要吸底
1167
-
1168
-
996
+ };
997
+ // 判断是否需要吸底
1169
998
  var fixFooterState = useMemo(function () {
1170
999
  if (fullscreenState) {
1171
1000
  // TODO XXX
1172
1001
  return false;
1173
1002
  }
1174
-
1175
1003
  if (fixedTableBody || footerSuction) {
1176
1004
  if (footerSuctionState) {
1177
1005
  return true;
1178
1006
  }
1179
1007
  }
1180
-
1181
1008
  return false;
1182
1009
  }, [fullscreenState, fixedTableBody, footerSuction, footerSuctionState]);
1183
1010
  return /*#__PURE__*/React.createElement(FullScreen, {
@@ -1187,12 +1014,11 @@ var ProTable = function ProTable(props) {
1187
1014
  return /*#__PURE__*/React.createElement("div", {
1188
1015
  className: cls({
1189
1016
  '': true,
1190
- fullscreen: fullscreenState // 'footer-suction': footerSuctionState && footerSuction,
1191
-
1017
+ fullscreen: fullscreenState
1018
+ // 'footer-suction': footerSuctionState && footerSuction,
1192
1019
  }),
1193
1020
  ref: tableRef
1194
1021
  }, renderTable(isFullScreen), fixFooterState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !fixFooterState && renderFooter());
1195
1022
  });
1196
1023
  };
1197
-
1198
1024
  export default ProTable;