@dtjoy/dt-design 1.1.1 → 1.1.5

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 (623) hide show
  1. package/README.md +44 -24
  2. package/dist/dt-design.min.css +1 -0
  3. package/dist/dt-design.min.js +1 -0
  4. package/es/_util/context/createContextSelector.d.ts +28 -0
  5. package/es/_util/context/createContextSelector.js +110 -0
  6. package/es/_util/context/immutable.d.ts +10 -0
  7. package/es/_util/context/immutable.js +84 -0
  8. package/es/_util/context/index.d.ts +3 -0
  9. package/es/_util/context/index.js +3 -0
  10. package/{esm → es}/_util/gapSize.d.ts +1 -1
  11. package/{esm → es}/_util/getScroll.js +1 -1
  12. package/es/_util/hooks/index.d.ts +11 -0
  13. package/es/_util/hooks/index.js +11 -0
  14. package/es/_util/hooks/useBreakpoint.d.ts +5 -0
  15. package/es/_util/hooks/useBreakpoint.js +75 -0
  16. package/es/_util/hooks/useCssVar.d.ts +3 -0
  17. package/es/_util/hooks/useCssVar.js +28 -0
  18. package/es/_util/hooks/useEvent.d.ts +1 -0
  19. package/es/_util/hooks/useEvent.js +1 -0
  20. package/es/_util/hooks/useLayoutEffect.d.ts +1 -0
  21. package/es/_util/hooks/useLayoutEffect.js +1 -0
  22. package/es/_util/hooks/useMultipleSelect.d.ts +2 -0
  23. package/es/_util/hooks/useMultipleSelect.js +37 -0
  24. package/es/_util/hooks/useProxyImperativeHandle.d.ts +4 -0
  25. package/{esm → es}/_util/hooks/useProxyImperativeHandle.js +10 -3
  26. package/es/_util/hooks/useTimeoutLock.d.ts +1 -0
  27. package/es/_util/hooks/useTimeoutLock.js +26 -0
  28. package/es/_util/index.d.ts +11 -0
  29. package/{esm → es}/_util/index.js +9 -1
  30. package/es/_util/is.d.ts +5 -0
  31. package/es/_util/is.js +16 -0
  32. package/es/_util/rcUtil.d.ts +17 -0
  33. package/es/_util/rcUtil.js +58 -0
  34. package/{esm → es}/_util/scrollTo.js +1 -1
  35. package/es/_util/scrollbar.d.ts +1 -0
  36. package/es/_util/scrollbar.js +32 -0
  37. package/{esm → es}/_util/type.d.ts +1 -0
  38. package/es/_util/validate.d.ts +2 -0
  39. package/es/_util/validate.js +10 -0
  40. package/{esm → es}/_util/warning.js +5 -6
  41. package/{lib/blockHeader → es/block-header}/index.d.ts +1 -1
  42. package/{esm/blockHeader → es/block-header}/index.js +1 -1
  43. package/{lib/blockHeader → es/block-header}/style/index.less +167 -143
  44. package/{esm → es}/button/index.d.ts +3 -3
  45. package/{esm → es}/button/index.js +16 -4
  46. package/{esm → es}/button/style/index.less +62 -59
  47. package/{esm → es}/button/style/mixin.less +40 -39
  48. package/{esm → es}/collapsible/index.js +3 -2
  49. package/{esm → es}/collapsible/style/index.less +24 -24
  50. package/{esm/collapsibleActionItems → es/collapsible-action-items}/index.d.ts +1 -1
  51. package/{esm/collapsibleActionItems → es/collapsible-action-items}/index.js +21 -19
  52. package/{lib/collapsibleActionItems → es/collapsible-action-items}/style/index.less +7 -7
  53. package/{lib → es}/flex/index.d.ts +2 -2
  54. package/{esm → es}/flex/index.js +3 -3
  55. package/{esm → es}/flex/style/index.less +80 -76
  56. package/{esm/formList → es/form-list}/index.d.ts +9 -0
  57. package/{esm/formList → es/form-list}/index.js +18 -8
  58. package/{lib/formList → es/form-list}/style/index.less +45 -45
  59. package/es/index.d.ts +26 -0
  60. package/es/index.js +21 -0
  61. package/{lib/overflowList → es/overflow-list}/index.d.ts +4 -1
  62. package/{esm/overflowList → es/overflow-list}/index.js +37 -9
  63. package/{esm/overflowList → es/overflow-list}/style/index.less +9 -9
  64. package/{lib/resizeObserver → es/resize-observer}/index.d.ts +1 -1
  65. package/{esm/resizeObserver → es/resize-observer}/index.js +8 -8
  66. package/{esm → es}/splitter/Panel.d.ts +1 -1
  67. package/{esm → es}/splitter/Panel.js +12 -4
  68. package/{esm → es}/splitter/SplitBar.d.ts +6 -2
  69. package/{esm → es}/splitter/SplitBar.js +82 -80
  70. package/{esm → es}/splitter/Splitter.js +52 -23
  71. package/{esm → es}/splitter/hooks/sizeUtil.js +1 -1
  72. package/es/splitter/hooks/useDragListeners.d.ts +14 -0
  73. package/es/splitter/hooks/useDragListeners.js +107 -0
  74. package/{esm → es}/splitter/hooks/useItems.d.ts +6 -0
  75. package/es/splitter/hooks/useOrientation.d.ts +2 -0
  76. package/es/splitter/hooks/useOrientation.js +6 -0
  77. package/{esm → es}/splitter/hooks/useResizable.d.ts +3 -0
  78. package/{esm → es}/splitter/hooks/useResizable.js +5 -2
  79. package/{esm → es}/splitter/hooks/useResize.d.ts +1 -1
  80. package/{esm → es}/splitter/hooks/useResize.js +10 -3
  81. package/{esm → es}/splitter/hooks/useSizes.js +5 -6
  82. package/{lib → es}/splitter/index.d.ts +2 -1
  83. package/es/splitter/interface.d.ts +45 -0
  84. package/es/splitter/style/index.less +349 -0
  85. package/{esm/statusTag → es/status-tag}/index.js +1 -1
  86. package/{esm/statusTag → es/status-tag}/style/index.less +70 -70
  87. package/{esm/statusTag → es/status-tag}/style/mixin.less +48 -39
  88. package/{esm → es}/style/index.less +1 -1
  89. package/es/style/themes/index.less +2 -0
  90. package/{esm → es}/style/themes/variable.less +5 -5
  91. package/es/table/Column.d.ts +2 -0
  92. package/es/table/Column.js +1 -0
  93. package/es/table/ColumnGroup.d.ts +2 -0
  94. package/es/table/ColumnGroup.js +1 -0
  95. package/es/table/InternalTable.d.ts +43 -0
  96. package/es/table/InternalTable.js +816 -0
  97. package/{lib → es}/table/Table.d.ts +7 -5
  98. package/{esm → es}/table/Table.js +6 -4
  99. package/es/table/components/Body/BodyRow.d.ts +37 -0
  100. package/es/table/components/Body/BodyRow.js +182 -0
  101. package/es/table/components/Body/ExpandedRow.d.ts +15 -0
  102. package/es/table/components/Body/ExpandedRow.js +51 -0
  103. package/es/table/components/Body/MeasureCell.d.ts +8 -0
  104. package/es/table/components/Body/MeasureCell.js +33 -0
  105. package/es/table/components/Body/MeasureRow.d.ts +10 -0
  106. package/es/table/components/Body/MeasureRow.js +54 -0
  107. package/es/table/components/Body/index.d.ts +11 -0
  108. package/es/table/components/Body/index.js +123 -0
  109. package/es/table/components/Cell/index.d.ts +39 -0
  110. package/es/table/components/Cell/index.js +196 -0
  111. package/es/table/components/Cell/useCellRender.d.ts +3 -0
  112. package/es/table/components/Cell/useCellRender.js +69 -0
  113. package/es/table/components/Cell/useHoverState.d.ts +2 -0
  114. package/es/table/components/Cell/useHoverState.js +13 -0
  115. package/es/table/components/ColGroup.d.ts +9 -0
  116. package/es/table/components/ColGroup.js +53 -0
  117. package/es/table/components/ExpandIcon.d.ts +12 -0
  118. package/es/table/components/ExpandIcon.js +27 -0
  119. package/es/table/components/FixedHolder/index.d.ts +27 -0
  120. package/es/table/components/FixedHolder/index.js +186 -0
  121. package/es/table/components/Footer/Cell.d.ts +11 -0
  122. package/es/table/components/Footer/Cell.js +47 -0
  123. package/es/table/components/Footer/Row.d.ts +8 -0
  124. package/es/table/components/Footer/Row.js +10 -0
  125. package/es/table/components/Footer/Summary.d.ts +14 -0
  126. package/es/table/components/Footer/Summary.js +12 -0
  127. package/es/table/components/Footer/SummaryContext.d.ts +11 -0
  128. package/es/table/components/Footer/SummaryContext.js +3 -0
  129. package/es/table/components/Footer/index.d.ts +16 -0
  130. package/es/table/components/Footer/index.js +31 -0
  131. package/es/table/components/Header/Header.d.ts +10 -0
  132. package/es/table/components/Header/Header.js +110 -0
  133. package/es/table/components/Header/HeaderRow.d.ts +19 -0
  134. package/es/table/components/Header/HeaderRow.js +63 -0
  135. package/es/table/components/Panel.d.ts +7 -0
  136. package/es/table/components/Panel.js +11 -0
  137. package/es/table/components/RcTable.d.ts +114 -0
  138. package/es/table/components/RcTable.js +757 -0
  139. package/es/table/components/VirtualTable.d.ts +5 -0
  140. package/{esm/table/RcTable → es/table/components}/VirtualTable.js +4 -1
  141. package/es/table/components/VirtualTableBody/BodyGrid.d.ts +13 -0
  142. package/es/table/components/VirtualTableBody/BodyGrid.js +307 -0
  143. package/es/table/components/VirtualTableBody/BodyLine.d.ts +14 -0
  144. package/es/table/components/VirtualTableBody/BodyLine.js +116 -0
  145. package/es/table/components/VirtualTableBody/VirtualCell.d.ts +26 -0
  146. package/es/table/components/VirtualTableBody/VirtualCell.js +118 -0
  147. package/es/table/components/VirtualTableBody/context.d.ts +13 -0
  148. package/es/table/components/VirtualTableBody/context.js +3 -0
  149. package/es/table/components/VirtualTableBody/index.d.ts +16 -0
  150. package/es/table/components/VirtualTableBody/index.js +102 -0
  151. package/es/table/constant.d.ts +2 -0
  152. package/es/table/constant.js +2 -0
  153. package/es/table/features/columns/Column.d.ts +7 -0
  154. package/es/table/features/columns/Column.js +4 -0
  155. package/es/table/features/columns/ColumnGroup.d.ts +9 -0
  156. package/es/table/features/columns/ColumnGroup.js +4 -0
  157. package/es/table/features/columns/index.d.ts +8 -0
  158. package/es/table/features/columns/index.js +6 -0
  159. package/es/table/features/columns/useColumns.d.ts +31 -0
  160. package/es/table/features/columns/useColumns.js +227 -0
  161. package/es/table/features/columns/useFilledColumns.d.ts +4 -0
  162. package/es/table/features/columns/useFilledColumns.js +34 -0
  163. package/es/table/features/columns/useTitleColumns.d.ts +4 -0
  164. package/es/table/features/columns/useTitleColumns.js +26 -0
  165. package/es/table/features/columns/useWidthColumns.d.ts +5 -0
  166. package/es/table/features/columns/useWidthColumns.js +75 -0
  167. package/es/table/features/editable/BatchEditModal.d.ts +4 -0
  168. package/es/table/features/editable/BatchEditModal.js +786 -0
  169. package/es/table/features/editable/EditableCell.d.ts +42 -0
  170. package/es/table/features/editable/EditableCell.js +294 -0
  171. package/es/table/features/editable/EditableContext.d.ts +33 -0
  172. package/es/table/features/editable/EditableContext.js +20 -0
  173. package/es/table/features/editable/batchEditTypes.d.ts +55 -0
  174. package/es/table/features/editable/batchEditTypes.js +1 -0
  175. package/es/table/features/editable/batchEditUtils.d.ts +44 -0
  176. package/es/table/features/editable/batchEditUtils.js +258 -0
  177. package/es/table/features/editable/builtinEditors.d.ts +32 -0
  178. package/es/table/features/editable/builtinEditors.js +165 -0
  179. package/es/table/features/editable/index.d.ts +11 -0
  180. package/es/table/features/editable/index.js +10 -0
  181. package/es/table/features/editable/useBatchRules.d.ts +17 -0
  182. package/es/table/features/editable/useBatchRules.js +96 -0
  183. package/es/table/features/editable/useEditable.d.ts +51 -0
  184. package/es/table/features/editable/useEditable.js +693 -0
  185. package/es/table/features/expand/expandUtil.d.ts +5 -0
  186. package/es/table/features/expand/expandUtil.js +47 -0
  187. package/es/table/features/expand/index.d.ts +2 -0
  188. package/es/table/features/expand/index.js +2 -0
  189. package/es/table/features/expand/useExpand.d.ts +10 -0
  190. package/es/table/features/expand/useExpand.js +90 -0
  191. package/es/table/features/filter/FilterDropdown.d.ts +31 -0
  192. package/es/table/features/filter/FilterDropdown.js +494 -0
  193. package/es/table/features/filter/FilterSearch.d.ts +12 -0
  194. package/es/table/features/filter/FilterSearch.js +24 -0
  195. package/es/table/features/filter/FilterWrapper.d.ts +8 -0
  196. package/es/table/features/filter/FilterWrapper.js +23 -0
  197. package/es/table/features/filter/index.d.ts +4 -0
  198. package/es/table/features/filter/index.js +4 -0
  199. package/es/table/features/filter/useFilter.d.ts +22 -0
  200. package/es/table/features/filter/useFilter.js +240 -0
  201. package/es/table/features/fixed/fixUtil.d.ts +21 -0
  202. package/es/table/features/fixed/fixUtil.js +69 -0
  203. package/es/table/features/fixed/index.d.ts +4 -0
  204. package/es/table/features/fixed/index.js +4 -0
  205. package/es/table/features/fixed/offsetUtil.d.ts +4 -0
  206. package/es/table/features/fixed/offsetUtil.js +13 -0
  207. package/es/table/features/fixed/useFixedInfo.d.ts +2 -0
  208. package/es/table/features/fixed/useFixedInfo.js +16 -0
  209. package/es/table/features/fixed/useStickyOffsets.d.ts +6 -0
  210. package/es/table/features/fixed/useStickyOffsets.js +29 -0
  211. package/es/table/features/hover/index.d.ts +1 -0
  212. package/es/table/features/hover/index.js +1 -0
  213. package/es/table/features/hover/useHover.d.ts +2 -0
  214. package/es/table/features/hover/useHover.js +22 -0
  215. package/es/table/features/pagination/index.d.ts +1 -0
  216. package/es/table/features/pagination/index.js +1 -0
  217. package/es/table/features/pagination/usePagination.d.ts +5 -0
  218. package/es/table/features/pagination/usePagination.js +89 -0
  219. package/es/table/features/resize/ResizeHandle.d.ts +22 -0
  220. package/es/table/features/resize/ResizeHandle.js +99 -0
  221. package/es/table/features/resize/index.d.ts +5 -0
  222. package/es/table/features/resize/index.js +3 -0
  223. package/es/table/features/resize/transformResizableColumns.d.ts +11 -0
  224. package/es/table/features/resize/transformResizableColumns.js +52 -0
  225. package/es/table/features/resize/useResize.d.ts +52 -0
  226. package/es/table/features/resize/useResize.js +586 -0
  227. package/es/table/features/selection/index.d.ts +1 -0
  228. package/es/table/features/selection/index.js +1 -0
  229. package/es/table/features/selection/useSelection.d.ts +20 -0
  230. package/es/table/features/selection/useSelection.js +579 -0
  231. package/es/table/features/sort/index.d.ts +1 -0
  232. package/es/table/features/sort/index.js +1 -0
  233. package/es/table/features/sort/useSorter.d.ts +21 -0
  234. package/es/table/features/sort/useSorter.js +372 -0
  235. package/es/table/features/sticky/index.d.ts +2 -0
  236. package/es/table/features/sticky/index.js +2 -0
  237. package/es/table/features/sticky/stickyScrollBar.d.ts +12 -0
  238. package/es/table/features/sticky/stickyScrollBar.js +203 -0
  239. package/es/table/features/sticky/useSticky.d.ts +10 -0
  240. package/es/table/features/sticky/useSticky.js +34 -0
  241. package/es/table/features/summary/index.d.ts +1 -0
  242. package/es/table/features/summary/index.js +1 -0
  243. package/es/table/features/virtual/index.d.ts +2 -0
  244. package/es/table/features/virtual/index.js +2 -0
  245. package/es/table/features/virtual/useFlattenRecords.d.ts +19 -0
  246. package/es/table/features/virtual/useFlattenRecords.js +55 -0
  247. package/es/table/features/virtual/useFrame.d.ts +7 -0
  248. package/es/table/features/virtual/useFrame.js +67 -0
  249. package/es/table/immutableHelper.d.ts +9 -0
  250. package/es/table/immutableHelper.js +36 -0
  251. package/es/table/index.d.ts +24 -0
  252. package/es/table/index.js +23 -0
  253. package/es/table/interface.d.ts +438 -0
  254. package/es/table/interface.js +56 -0
  255. package/es/table/shared/context/PerfContext.d.ts +6 -0
  256. package/es/table/shared/context/PerfContext.js +6 -0
  257. package/es/table/shared/context/TableContext.d.ts +51 -0
  258. package/es/table/shared/context/TableContext.js +8 -0
  259. package/es/table/shared/hooks/useLazyKVMap.d.ts +4 -0
  260. package/es/table/shared/hooks/useLazyKVMap.js +30 -0
  261. package/es/table/shared/hooks/useRenderTimes.d.ts +5 -0
  262. package/es/table/shared/hooks/useRenderTimes.js +39 -0
  263. package/es/table/shared/hooks/useRowInfo.d.ts +11 -0
  264. package/es/table/shared/hooks/useRowInfo.js +73 -0
  265. package/es/table/shared/utils/legacyUtil.d.ts +5 -0
  266. package/es/table/shared/utils/legacyUtil.js +30 -0
  267. package/{esm/table → es/table/shared/utils}/util.d.ts +3 -11
  268. package/{esm/table → es/table/shared/utils}/util.js +6 -13
  269. package/es/table/shared/utils/valueUtil.d.ts +8 -0
  270. package/es/table/shared/utils/valueUtil.js +29 -0
  271. package/es/table/style/base.less +164 -0
  272. package/es/table/style/bordered.less +83 -0
  273. package/es/table/style/editable.less +50 -0
  274. package/es/table/style/ellipsis.less +33 -0
  275. package/es/table/style/empty.less +16 -0
  276. package/es/table/style/expand.less +123 -0
  277. package/es/table/style/filter.less +34 -0
  278. package/es/table/style/fixed.less +85 -0
  279. package/es/table/style/index.d.ts +3 -0
  280. package/es/table/style/index.js +3 -0
  281. package/es/table/style/index.less +19 -0
  282. package/es/table/style/pagination.less +29 -0
  283. package/es/table/style/radius.less +64 -0
  284. package/es/table/style/resize.less +78 -0
  285. package/es/table/style/rtl.less +52 -0
  286. package/es/table/style/selection.less +63 -0
  287. package/es/table/style/size.less +54 -0
  288. package/es/table/style/sorter.less +99 -0
  289. package/es/table/style/sticky.less +45 -0
  290. package/es/table/style/summary.less +23 -0
  291. package/es/table/style/variables.less +80 -0
  292. package/es/table/style/virtual.less +95 -0
  293. package/lib/_util/context/createContextSelector.js +120 -0
  294. package/lib/_util/context/immutable.js +92 -0
  295. package/lib/_util/context/index.js +41 -0
  296. package/lib/_util/easings.js +1 -1
  297. package/lib/_util/getScroll.js +6 -6
  298. package/lib/_util/hooks/index.js +82 -5
  299. package/lib/_util/hooks/useBreakpoint.js +85 -0
  300. package/lib/_util/hooks/useCssVar.js +37 -0
  301. package/lib/_util/hooks/useEvent.js +13 -0
  302. package/lib/_util/hooks/useForceUpdate.js +5 -4
  303. package/lib/_util/hooks/useLayoutEffect.js +13 -0
  304. package/lib/_util/hooks/useMultipleSelect.js +43 -0
  305. package/lib/_util/hooks/useOrientation.js +7 -8
  306. package/lib/_util/hooks/useProxyImperativeHandle.js +18 -14
  307. package/lib/_util/hooks/useSyncState.js +19 -9
  308. package/lib/_util/hooks/useTimeoutLock.js +35 -0
  309. package/lib/_util/index.js +101 -1
  310. package/lib/_util/is.js +22 -0
  311. package/lib/_util/rcUtil.js +134 -0
  312. package/lib/_util/scrollTo.js +22 -18
  313. package/lib/_util/scrollbar.js +38 -0
  314. package/lib/_util/validate.js +17 -0
  315. package/lib/_util/warning.js +25 -27
  316. package/lib/block-header/index.js +141 -0
  317. package/{esm/blockHeader → lib/block-header}/style/index.less +167 -143
  318. package/lib/button/index.js +24 -9
  319. package/lib/button/style/index.less +62 -59
  320. package/lib/button/style/mixin.less +40 -39
  321. package/lib/collapsible/index.js +210 -169
  322. package/lib/collapsible/style/index.less +24 -24
  323. package/lib/collapsible-action-items/index.js +83 -0
  324. package/{esm/collapsibleActionItems → lib/collapsible-action-items}/style/index.less +7 -7
  325. package/lib/flex/index.js +43 -34
  326. package/lib/flex/style/index.less +80 -76
  327. package/lib/flex/utils.js +23 -23
  328. package/lib/form-list/index.js +163 -0
  329. package/{esm/formList → lib/form-list}/style/index.less +45 -45
  330. package/lib/index.js +37 -67
  331. package/lib/overflow-list/index.js +203 -0
  332. package/lib/{overflowList → overflow-list}/style/index.less +9 -9
  333. package/lib/resize/index.js +13 -13
  334. package/lib/resize-observer/index.js +182 -0
  335. package/lib/splitter/Panel.js +36 -25
  336. package/lib/splitter/SplitBar.js +151 -134
  337. package/lib/splitter/Splitter.js +141 -89
  338. package/lib/splitter/hooks/sizeUtil.js +50 -33
  339. package/lib/splitter/hooks/useDragListeners.js +114 -0
  340. package/lib/splitter/hooks/useItems.js +27 -20
  341. package/lib/splitter/hooks/useOrientation.js +12 -0
  342. package/lib/splitter/hooks/useResizable.js +32 -30
  343. package/lib/splitter/hooks/useResize.js +76 -45
  344. package/lib/splitter/hooks/useSizes.js +55 -30
  345. package/lib/splitter/index.js +1 -1
  346. package/lib/splitter/style/index.less +349 -312
  347. package/lib/status-tag/index.js +131 -0
  348. package/lib/{statusTag → status-tag}/style/index.less +70 -70
  349. package/lib/{statusTag → status-tag}/style/mixin.less +48 -39
  350. package/lib/style/index.less +1 -1
  351. package/lib/style/themes/index.less +2 -2
  352. package/lib/style/themes/variable.less +5 -5
  353. package/lib/table/Column.js +13 -0
  354. package/lib/table/ColumnGroup.js +13 -0
  355. package/lib/table/InternalTable.js +699 -270
  356. package/lib/table/Table.js +14 -11
  357. package/lib/table/TableMeasureRowContext.js +1 -1
  358. package/lib/table/components/Body/BodyRow.js +192 -0
  359. package/lib/table/components/Body/ExpandedRow.js +61 -0
  360. package/lib/table/components/Body/MeasureCell.js +43 -0
  361. package/lib/table/components/Body/MeasureRow.js +64 -0
  362. package/lib/table/components/Body/index.js +133 -0
  363. package/lib/table/components/Cell/index.js +205 -0
  364. package/lib/table/components/Cell/useCellRender.js +78 -0
  365. package/lib/table/components/Cell/useHoverState.js +20 -0
  366. package/lib/table/components/ColGroup.js +62 -0
  367. package/lib/table/components/ExpandIcon.js +35 -0
  368. package/lib/table/components/FixedHolder/index.js +195 -0
  369. package/lib/table/components/Footer/Cell.js +57 -0
  370. package/lib/table/components/Footer/Row.js +19 -0
  371. package/lib/table/components/Footer/Summary.js +19 -0
  372. package/lib/table/components/Footer/SummaryContext.js +12 -0
  373. package/lib/table/components/Footer/index.js +41 -0
  374. package/lib/table/components/Header/Header.js +120 -0
  375. package/lib/table/components/Header/HeaderRow.js +72 -0
  376. package/lib/table/components/Panel.js +20 -0
  377. package/lib/table/components/RcTable.js +764 -0
  378. package/lib/table/components/VirtualTable.js +18 -0
  379. package/lib/table/components/VirtualTableBody/BodyGrid.js +316 -0
  380. package/lib/table/components/VirtualTableBody/BodyLine.js +125 -0
  381. package/lib/table/components/VirtualTableBody/VirtualCell.js +128 -0
  382. package/lib/table/components/VirtualTableBody/context.js +9 -0
  383. package/lib/table/components/VirtualTableBody/index.js +111 -0
  384. package/lib/table/constant.js +8 -0
  385. package/lib/table/features/columns/Column.js +10 -0
  386. package/lib/table/features/columns/ColumnGroup.js +10 -0
  387. package/lib/table/features/columns/index.js +57 -0
  388. package/lib/table/features/columns/useColumns.js +237 -0
  389. package/lib/table/features/columns/useFilledColumns.js +42 -0
  390. package/lib/table/features/columns/useTitleColumns.js +34 -0
  391. package/lib/table/features/columns/useWidthColumns.js +83 -0
  392. package/lib/table/features/editable/BatchEditModal.js +794 -0
  393. package/lib/table/features/editable/EditableCell.js +303 -0
  394. package/lib/table/features/editable/EditableContext.js +28 -0
  395. package/lib/table/features/editable/batchEditTypes.js +5 -0
  396. package/lib/table/features/editable/batchEditUtils.js +264 -0
  397. package/lib/table/features/editable/builtinEditors.js +174 -0
  398. package/lib/table/features/editable/index.js +75 -0
  399. package/lib/table/features/editable/useBatchRules.js +103 -0
  400. package/lib/table/features/editable/useEditable.js +701 -0
  401. package/lib/table/features/expand/expandUtil.js +57 -0
  402. package/lib/table/features/expand/index.js +32 -0
  403. package/lib/table/features/expand/useExpand.js +99 -0
  404. package/lib/table/features/filter/FilterDropdown.js +504 -0
  405. package/lib/table/features/filter/FilterSearch.js +34 -0
  406. package/lib/table/features/filter/FilterWrapper.js +32 -0
  407. package/lib/table/features/filter/index.js +49 -0
  408. package/lib/table/features/filter/useFilter.js +254 -0
  409. package/lib/table/features/fixed/fixUtil.js +75 -0
  410. package/lib/table/features/fixed/index.js +34 -0
  411. package/lib/table/features/fixed/offsetUtil.js +19 -0
  412. package/lib/table/features/fixed/useFixedInfo.js +26 -0
  413. package/lib/table/features/fixed/useStickyOffsets.js +35 -0
  414. package/lib/table/features/hover/index.js +13 -0
  415. package/lib/table/features/hover/useHover.js +31 -0
  416. package/lib/table/features/pagination/index.js +27 -0
  417. package/lib/table/features/pagination/usePagination.js +96 -0
  418. package/lib/table/features/resize/ResizeHandle.js +109 -0
  419. package/lib/table/features/resize/index.js +27 -0
  420. package/lib/table/features/resize/transformResizableColumns.js +61 -0
  421. package/lib/table/features/resize/useResize.js +595 -0
  422. package/lib/table/features/selection/index.js +39 -0
  423. package/lib/table/features/selection/useSelection.js +588 -0
  424. package/lib/table/features/sort/index.js +21 -0
  425. package/lib/table/features/sort/useSorter.js +381 -0
  426. package/lib/table/features/sticky/index.js +20 -0
  427. package/lib/table/features/sticky/stickyScrollBar.js +212 -0
  428. package/lib/table/features/sticky/useSticky.js +43 -0
  429. package/lib/table/features/summary/index.js +13 -0
  430. package/lib/table/features/virtual/index.js +26 -0
  431. package/lib/table/features/virtual/useFlattenRecords.js +64 -0
  432. package/lib/table/features/virtual/useFrame.js +74 -0
  433. package/lib/table/immutableHelper.js +46 -0
  434. package/lib/table/index.js +118 -3
  435. package/lib/table/interface.js +54 -2
  436. package/lib/table/shared/context/PerfContext.js +15 -0
  437. package/lib/table/shared/context/TableContext.js +13 -0
  438. package/lib/table/shared/hooks/useContainerWidth.js +20 -0
  439. package/lib/table/shared/hooks/useLazyKVMap.js +39 -0
  440. package/lib/table/shared/hooks/useRenderTimes.js +49 -0
  441. package/lib/table/shared/hooks/useRowInfo.js +80 -0
  442. package/lib/table/shared/utils/legacyUtil.js +38 -0
  443. package/lib/table/shared/utils/util.js +34 -0
  444. package/lib/table/shared/utils/valueUtil.js +37 -0
  445. package/lib/table/style/base.less +164 -0
  446. package/lib/table/style/bordered.less +83 -141
  447. package/lib/table/style/editable.less +50 -0
  448. package/lib/table/style/ellipsis.less +33 -0
  449. package/lib/table/style/empty.less +16 -0
  450. package/lib/table/style/expand.less +123 -0
  451. package/lib/table/style/filter.less +34 -0
  452. package/lib/table/style/fixed.less +85 -88
  453. package/lib/table/style/index.js +2 -1
  454. package/lib/table/style/index.less +19 -150
  455. package/lib/table/style/pagination.less +29 -0
  456. package/lib/table/style/radius.less +64 -0
  457. package/lib/table/style/resize.less +78 -0
  458. package/lib/table/style/rtl.less +52 -0
  459. package/lib/table/style/selection.less +63 -90
  460. package/lib/table/style/size.less +54 -0
  461. package/lib/table/style/sorter.less +99 -0
  462. package/lib/table/style/sticky.less +45 -55
  463. package/lib/table/style/summary.less +23 -0
  464. package/lib/table/style/variables.less +80 -0
  465. package/lib/table/style/virtual.less +95 -65
  466. package/package.json +148 -155
  467. package/esm/_util/extendsObject.d.ts +0 -4
  468. package/esm/_util/extendsObject.js +0 -17
  469. package/esm/_util/hooks/index.d.ts +0 -4
  470. package/esm/_util/hooks/index.js +0 -4
  471. package/esm/_util/hooks/useProxyImperativeHandle.d.ts +0 -4
  472. package/esm/_util/index.d.ts +0 -3
  473. package/esm/_util/isNonNullable.d.ts +0 -2
  474. package/esm/_util/isNonNullable.js +0 -4
  475. package/esm/blockHeader/index.d.ts +0 -58
  476. package/esm/flex/index.d.ts +0 -7
  477. package/esm/index.d.ts +0 -17
  478. package/esm/index.js +0 -14
  479. package/esm/overflowList/index.d.ts +0 -40
  480. package/esm/resizeObserver/index.d.ts +0 -45
  481. package/esm/splitter/index.d.ts +0 -8
  482. package/esm/splitter/interface.d.ts +0 -69
  483. package/esm/splitter/style/index.less +0 -312
  484. package/esm/style/mixins/index.less +0 -0
  485. package/esm/style/themes/index.less +0 -2
  486. package/esm/table/InternalTable.d.ts +0 -32
  487. package/esm/table/InternalTable.js +0 -429
  488. package/esm/table/RcTable/VirtualTable.d.ts +0 -2
  489. package/esm/table/RcTable/index.d.ts +0 -2
  490. package/esm/table/RcTable/index.js +0 -9
  491. package/esm/table/Table.d.ts +0 -17
  492. package/esm/table/index.d.ts +0 -7
  493. package/esm/table/index.js +0 -2
  494. package/esm/table/interface.d.ts +0 -196
  495. package/esm/table/interface.js +0 -4
  496. package/esm/table/style/bordered.less +0 -141
  497. package/esm/table/style/fixed.less +0 -88
  498. package/esm/table/style/index.d.ts +0 -2
  499. package/esm/table/style/index.js +0 -2
  500. package/esm/table/style/index.less +0 -150
  501. package/esm/table/style/selection.less +0 -90
  502. package/esm/table/style/sticky.less +0 -55
  503. package/esm/table/style/virtual.less +0 -65
  504. package/lib/_util/easings.d.ts +0 -1
  505. package/lib/_util/extendsObject.d.ts +0 -4
  506. package/lib/_util/extendsObject.js +0 -20
  507. package/lib/_util/gapSize.d.ts +0 -3
  508. package/lib/_util/getScroll.d.ts +0 -3
  509. package/lib/_util/hooks/index.d.ts +0 -4
  510. package/lib/_util/hooks/useForceUpdate.d.ts +0 -2
  511. package/lib/_util/hooks/useOrientation.d.ts +0 -2
  512. package/lib/_util/hooks/useProxyImperativeHandle.d.ts +0 -4
  513. package/lib/_util/hooks/useSyncState.d.ts +0 -3
  514. package/lib/_util/index.d.ts +0 -3
  515. package/lib/_util/isNonNullable.d.ts +0 -2
  516. package/lib/_util/isNonNullable.js +0 -10
  517. package/lib/_util/scrollTo.d.ts +0 -10
  518. package/lib/_util/type.d.ts +0 -52
  519. package/lib/_util/warning.d.ts +0 -31
  520. package/lib/blockHeader/index.js +0 -121
  521. package/lib/blockHeader/style/index.d.ts +0 -2
  522. package/lib/button/index.d.ts +0 -10
  523. package/lib/button/style/index.d.ts +0 -2
  524. package/lib/collapsible/index.d.ts +0 -102
  525. package/lib/collapsible/style/index.d.ts +0 -1
  526. package/lib/collapsibleActionItems/index.d.ts +0 -24
  527. package/lib/collapsibleActionItems/index.js +0 -68
  528. package/lib/collapsibleActionItems/style/index.d.ts +0 -2
  529. package/lib/flex/interface.d.ts +0 -16
  530. package/lib/flex/style/index.d.ts +0 -2
  531. package/lib/flex/utils.d.ts +0 -7
  532. package/lib/formList/index.d.ts +0 -78
  533. package/lib/formList/index.js +0 -130
  534. package/lib/formList/style/index.d.ts +0 -2
  535. package/lib/index.d.ts +0 -17
  536. package/lib/overflowList/index.js +0 -144
  537. package/lib/overflowList/style/index.d.ts +0 -2
  538. package/lib/resize/index.d.ts +0 -9
  539. package/lib/resizeObserver/index.js +0 -137
  540. package/lib/splitter/Panel.d.ts +0 -7
  541. package/lib/splitter/SplitBar.d.ts +0 -24
  542. package/lib/splitter/Splitter.d.ts +0 -5
  543. package/lib/splitter/hooks/sizeUtil.d.ts +0 -3
  544. package/lib/splitter/hooks/useItems.d.ts +0 -14
  545. package/lib/splitter/hooks/useResizable.d.ts +0 -10
  546. package/lib/splitter/hooks/useResize.d.ts +0 -6
  547. package/lib/splitter/hooks/useSizes.d.ts +0 -4
  548. package/lib/splitter/interface.d.ts +0 -69
  549. package/lib/splitter/style/index.d.ts +0 -2
  550. package/lib/statusTag/index.d.ts +0 -29
  551. package/lib/statusTag/index.js +0 -125
  552. package/lib/statusTag/style/index.d.ts +0 -2
  553. package/lib/style/index.d.ts +0 -1
  554. package/lib/style/mixins/index.less +0 -0
  555. package/lib/table/InternalTable.d.ts +0 -32
  556. package/lib/table/RcTable/VirtualTable.d.ts +0 -2
  557. package/lib/table/RcTable/VirtualTable.js +0 -17
  558. package/lib/table/RcTable/index.d.ts +0 -2
  559. package/lib/table/RcTable/index.js +0 -17
  560. package/lib/table/TableMeasureRowContext.d.ts +0 -3
  561. package/lib/table/hooks/useContainerWidth.d.ts +0 -1
  562. package/lib/table/hooks/useContainerWidth.js +0 -20
  563. package/lib/table/index.d.ts +0 -7
  564. package/lib/table/interface.d.ts +0 -196
  565. package/lib/table/style/index.d.ts +0 -2
  566. package/lib/table/util.d.ts +0 -14
  567. package/lib/table/util.js +0 -44
  568. /package/{esm → es}/_util/easings.d.ts +0 -0
  569. /package/{esm → es}/_util/easings.js +0 -0
  570. /package/{esm → es}/_util/gapSize.js +0 -0
  571. /package/{esm → es}/_util/getScroll.d.ts +0 -0
  572. /package/{esm → es}/_util/hooks/useForceUpdate.d.ts +0 -0
  573. /package/{esm → es}/_util/hooks/useForceUpdate.js +0 -0
  574. /package/{esm → es}/_util/hooks/useOrientation.d.ts +0 -0
  575. /package/{esm → es}/_util/hooks/useOrientation.js +0 -0
  576. /package/{esm → es}/_util/hooks/useSyncState.d.ts +0 -0
  577. /package/{esm → es}/_util/hooks/useSyncState.js +0 -0
  578. /package/{esm → es}/_util/scrollTo.d.ts +0 -0
  579. /package/{esm → es}/_util/type.js +0 -0
  580. /package/{esm → es}/_util/warning.d.ts +0 -0
  581. /package/{esm/blockHeader → es/block-header}/style/index.d.ts +0 -0
  582. /package/{esm/blockHeader → es/block-header}/style/index.js +0 -0
  583. /package/{esm → es}/button/style/index.d.ts +0 -0
  584. /package/{esm → es}/button/style/index.js +0 -0
  585. /package/{esm → es}/collapsible/index.d.ts +0 -0
  586. /package/{esm → es}/collapsible/style/index.d.ts +0 -0
  587. /package/{esm → es}/collapsible/style/index.js +0 -0
  588. /package/{esm/collapsibleActionItems → es/collapsible-action-items}/style/index.d.ts +0 -0
  589. /package/{esm/collapsibleActionItems → es/collapsible-action-items}/style/index.js +0 -0
  590. /package/{esm → es}/flex/interface.d.ts +0 -0
  591. /package/{esm → es}/flex/interface.js +0 -0
  592. /package/{esm → es}/flex/style/index.d.ts +0 -0
  593. /package/{esm → es}/flex/style/index.js +0 -0
  594. /package/{esm → es}/flex/utils.d.ts +0 -0
  595. /package/{esm → es}/flex/utils.js +0 -0
  596. /package/{esm/formList → es/form-list}/style/index.d.ts +0 -0
  597. /package/{esm/formList → es/form-list}/style/index.js +0 -0
  598. /package/{esm/overflowList → es/overflow-list}/style/index.d.ts +0 -0
  599. /package/{esm/overflowList → es/overflow-list}/style/index.js +0 -0
  600. /package/{esm → es}/resize/index.d.ts +0 -0
  601. /package/{esm → es}/resize/index.js +0 -0
  602. /package/{esm → es}/splitter/Splitter.d.ts +0 -0
  603. /package/{esm → es}/splitter/hooks/sizeUtil.d.ts +0 -0
  604. /package/{esm → es}/splitter/hooks/useItems.js +0 -0
  605. /package/{esm → es}/splitter/hooks/useSizes.d.ts +0 -0
  606. /package/{esm → es}/splitter/index.js +0 -0
  607. /package/{esm → es}/splitter/interface.js +0 -0
  608. /package/{esm → es}/splitter/style/index.d.ts +0 -0
  609. /package/{esm → es}/splitter/style/index.js +0 -0
  610. /package/{esm/statusTag → es/status-tag}/index.d.ts +0 -0
  611. /package/{esm/statusTag → es/status-tag}/style/index.d.ts +0 -0
  612. /package/{esm/statusTag → es/status-tag}/style/index.js +0 -0
  613. /package/{esm → es}/style/index.d.ts +0 -0
  614. /package/{esm → es}/style/index.js +0 -0
  615. /package/{esm → es}/table/TableMeasureRowContext.d.ts +0 -0
  616. /package/{esm → es}/table/TableMeasureRowContext.js +0 -0
  617. /package/{esm/table → es/table/shared}/hooks/useContainerWidth.d.ts +0 -0
  618. /package/{esm/table → es/table/shared}/hooks/useContainerWidth.js +0 -0
  619. /package/lib/{blockHeader → block-header}/style/index.js +0 -0
  620. /package/lib/{collapsibleActionItems → collapsible-action-items}/style/index.js +0 -0
  621. /package/lib/{formList → form-list}/style/index.js +0 -0
  622. /package/lib/{overflowList → overflow-list}/style/index.js +0 -0
  623. /package/lib/{statusTag → status-tag}/style/index.js +0 -0
@@ -0,0 +1,701 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.parseEditableConfig = parseEditableConfig;
8
+ var React = _interopRequireWildcard(require("react"));
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
12
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
+ 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."); }
17
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
18
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
20
+ 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); }
21
+ 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; }
22
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
26
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
27
+ /** 错误集合类型 — 从 interface.ts 重新导出保持兼容 */
28
+
29
+ /** 重新导出,保持 index.ts 的 API 不变 */
30
+
31
+ /** 空配置常量 — 保证引用稳定,使 React.memo 比较生效 */
32
+ var EMPTY_EDITABLE_CONFIG = Object.freeze({});
33
+
34
+ /** 扁平化后的行:rowIndex 为 DFS 扁平序号(无 children 时 = data 下标) */
35
+
36
+ /**
37
+ * 深度优先扁平化数据(含树形 children)。
38
+ * 排序/筛选/展开子行都会改变"展示下标",只有 rowKey 能稳定标识一条记录。
39
+ */
40
+ function flattenEditableRows(rows, childrenColumnName, getRowKey) {
41
+ var flat = [];
42
+ var dig = function dig(list) {
43
+ list.forEach(function (record, index) {
44
+ flat.push({
45
+ record: record,
46
+ rowIndex: flat.length,
47
+ rowKey: getRowKey === null || getRowKey === void 0 ? void 0 : getRowKey(record, index)
48
+ });
49
+ var children = record === null || record === void 0 ? void 0 : record[childrenColumnName];
50
+ if (Array.isArray(children)) dig(children);
51
+ });
52
+ };
53
+ dig(rows);
54
+ return flat;
55
+ }
56
+
57
+ /**
58
+ * 按 rowKey 在(含树形 children 的)数据中不可变更新一条记录。
59
+ *
60
+ * 返回 `undefined` 表示无法按 key 唯一定位(未命中或 key 重复),
61
+ * 调用方需降级为索引更新,以保持与历史行为兼容。
62
+ */
63
+ function updateRecordByKey(data, childrenColumnName, getRowKey, targetKey, dataIndex, value) {
64
+ var matches = 0;
65
+ var walk = function walk(rows) {
66
+ var changed = false;
67
+ var next = rows.map(function (row, index) {
68
+ if (getRowKey(row, index) === targetKey) {
69
+ matches += 1;
70
+ changed = true;
71
+ return _objectSpread(_objectSpread({}, row), {}, _defineProperty({}, dataIndex, value));
72
+ }
73
+ var children = row === null || row === void 0 ? void 0 : row[childrenColumnName];
74
+ if (Array.isArray(children)) {
75
+ var nextChildren = walk(children);
76
+ if (nextChildren !== children) {
77
+ changed = true;
78
+ return _objectSpread(_objectSpread({}, row), {}, _defineProperty({}, childrenColumnName, nextChildren));
79
+ }
80
+ }
81
+ return row;
82
+ });
83
+ return changed ? next : rows;
84
+ };
85
+ var result = walk(data);
86
+ // 仅当 key 唯一命中时才按 key 更新
87
+ return matches === 1 ? result : undefined;
88
+ }
89
+
90
+ /**
91
+ * validateCell 的写入记录 — validateAll 竞态合并用。
92
+ * 记录完整错误消息与定位信息,使合并成为纯函数(不依赖 setState 时机读取 prev)。
93
+ */
94
+
95
+ /**
96
+ * validateAll 完成时的错误合并(纯函数 — setErrors 与返回值共用同一份合并结果)。
97
+ * 校验期间被用户重新编辑(validateCell 写入,seq > startSeq)的单元格保留其最新错误状态;
98
+ * 未被触碰的单元格应用 validateAll 的校验结果。
99
+ */
100
+ function mergeValidatedErrors(validated, touchedCells, startSeq) {
101
+ var _next;
102
+ var next = null;
103
+ var _iterator = _createForOfIteratorHelper(touchedCells),
104
+ _step;
105
+ try {
106
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
107
+ var _step$value = _slicedToArray(_step.value, 2),
108
+ key = _step$value[0],
109
+ touched = _step$value[1];
110
+ if (touched.seq > startSeq) {
111
+ if (!next) next = new Map(validated);
112
+ if (touched.messages.length > 0) {
113
+ next.set(key, touched.messages);
114
+ } else {
115
+ next.delete(key);
116
+ }
117
+ }
118
+ }
119
+ // 无校验期编辑 → 直接复用校验结果,避免额外 Map 分配
120
+ } catch (err) {
121
+ _iterator.e(err);
122
+ } finally {
123
+ _iterator.f();
124
+ }
125
+ return (_next = next) !== null && _next !== void 0 ? _next : validated;
126
+ }
127
+
128
+ /**
129
+ * 解析列的 editable 配置
130
+ */
131
+ function parseEditableConfig(editable, globalEnabled) {
132
+ if (editable === true) return {
133
+ enabled: true,
134
+ config: EMPTY_EDITABLE_CONFIG
135
+ };
136
+ if (editable && _typeof(editable) === 'object') return {
137
+ enabled: true,
138
+ config: editable
139
+ };
140
+ // 列级显式关闭优先于全局开关:editable === false → 该列禁用编辑
141
+ if (editable === false) return {
142
+ enabled: false,
143
+ config: null
144
+ };
145
+ // 列未配置 → 继承全局开关
146
+ if (globalEnabled) return {
147
+ enabled: true,
148
+ config: EMPTY_EDITABLE_CONFIG
149
+ };
150
+ return {
151
+ enabled: false,
152
+ config: null
153
+ };
154
+ }
155
+
156
+ /** 叶子列类型(排除 ColumnGroupType) */
157
+
158
+ /**
159
+ * useEditable hook
160
+ *
161
+ * 管理表格的可编辑状态、校验、错误展示
162
+ *
163
+ * 性能优化:
164
+ * - flatColumns 通过 useMemo 缓存,避免每次 onCellChange / validateCell 都重新扁平化
165
+ * - colMap 缓存 dataIndex → column 映射,O(1) 查找
166
+ */
167
+ function useEditable(_ref) {
168
+ var columns = _ref.columns,
169
+ data = _ref.data,
170
+ onChange = _ref.onChange,
171
+ onValidate = _ref.onValidate,
172
+ getRowKey = _ref.getRowKey,
173
+ _ref$childrenColumnNa = _ref.childrenColumnName,
174
+ childrenColumnName = _ref$childrenColumnNa === void 0 ? 'children' : _ref$childrenColumnNa,
175
+ scrollToRow = _ref.scrollToRow;
176
+ var _React$useState = React.useState(function () {
177
+ return new Map();
178
+ }),
179
+ _React$useState2 = _slicedToArray(_React$useState, 2),
180
+ errors = _React$useState2[0],
181
+ setErrors = _React$useState2[1];
182
+
183
+ // validateAll 竞态防护(序号机制):
184
+ // touchSeqRef 全局单调递增;cellTouchSeqRef 记录每个单元格最后一次 validateCell 写入的序号。
185
+ // validateAll 开始时快照序号,结束时对校验期间被用户重新编辑(validateCell 写入)过的
186
+ // 单元格保留其最新错误状态,未被触碰的单元格应用 validateAll 的校验结果。
187
+ var touchSeqRef = React.useRef(0);
188
+ var cellTouchSeqRef = React.useRef(new Map());
189
+ var dataRef = React.useRef(data);
190
+ dataRef.current = data;
191
+ var onChangeRef = React.useRef(onChange);
192
+ onChangeRef.current = onChange;
193
+ var onValidateRef = React.useRef(onValidate);
194
+ onValidateRef.current = onValidate;
195
+ var getRowKeyRef = React.useRef(getRowKey);
196
+ getRowKeyRef.current = getRowKey;
197
+ var childrenColumnNameRef = React.useRef(childrenColumnName);
198
+ childrenColumnNameRef.current = childrenColumnName;
199
+ var scrollToRowRef = React.useRef(scrollToRow);
200
+ scrollToRowRef.current = scrollToRow;
201
+
202
+ // 错误 key 的第一分量是 rowKey;无 key 的降级场景传入 rowIndex
203
+ var errorKey = React.useCallback(function (rowId, dataIndex) {
204
+ return "".concat(rowId, "-").concat(dataIndex);
205
+ }, []);
206
+
207
+ // ---- 扁平化列 + 缓存映射 ----
208
+ // useMemo 确保 columns 引用不变时不会重复计算
209
+ var flatColumns = React.useMemo(function () {
210
+ var result = [];
211
+ var walk = function walk(cols) {
212
+ var _iterator2 = _createForOfIteratorHelper(cols),
213
+ _step2;
214
+ try {
215
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
216
+ var col = _step2.value;
217
+ if ('children' in col && col.children) {
218
+ walk(col.children);
219
+ } else {
220
+ result.push(col);
221
+ }
222
+ }
223
+ } catch (err) {
224
+ _iterator2.e(err);
225
+ } finally {
226
+ _iterator2.f();
227
+ }
228
+ };
229
+ walk(columns);
230
+ return result;
231
+ }, [columns]);
232
+ var colMap = React.useMemo(function () {
233
+ var map = new Map();
234
+ var _iterator3 = _createForOfIteratorHelper(flatColumns),
235
+ _step3;
236
+ try {
237
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
238
+ var _col$dataIndex;
239
+ var col = _step3.value;
240
+ var key = String((_col$dataIndex = col.dataIndex) !== null && _col$dataIndex !== void 0 ? _col$dataIndex : col.key);
241
+ if (key) map.set(key, col);
242
+ }
243
+ } catch (err) {
244
+ _iterator3.e(err);
245
+ } finally {
246
+ _iterator3.f();
247
+ }
248
+ return map;
249
+ }, [flatColumns]);
250
+ var getEditableConfig = React.useCallback(function (col) {
251
+ if (!col) return null;
252
+ var ed = col.editable;
253
+ if (ed === true) return EMPTY_EDITABLE_CONFIG;
254
+ if (ed && _typeof(ed) === 'object') return ed;
255
+ return null;
256
+ }, []);
257
+
258
+ // 校验单个值
259
+ var validateValue = React.useCallback( /*#__PURE__*/function () {
260
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value, record, config, colTitle, dataIndex) {
261
+ var messages, _iterator4, _step4, rule, isEmpty, msg;
262
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
263
+ while (1) switch (_context.prev = _context.next) {
264
+ case 0:
265
+ messages = [];
266
+ if (!config.rules) {
267
+ _context.next = 37;
268
+ break;
269
+ }
270
+ _iterator4 = _createForOfIteratorHelper(config.rules);
271
+ _context.prev = 3;
272
+ _iterator4.s();
273
+ case 5:
274
+ if ((_step4 = _iterator4.n()).done) {
275
+ _context.next = 29;
276
+ break;
277
+ }
278
+ rule = _step4.value;
279
+ if (!rule.required) {
280
+ _context.next = 12;
281
+ break;
282
+ }
283
+ isEmpty = value === undefined || value === null || value === '' || Array.isArray(value) && value.length === 0;
284
+ if (!isEmpty) {
285
+ _context.next = 12;
286
+ break;
287
+ }
288
+ messages.push(rule.message || "".concat(colTitle || dataIndex, " \u5FC5\u586B"));
289
+ return _context.abrupt("continue", 27);
290
+ case 12:
291
+ if (!(rule.pattern && value != null && value !== '')) {
292
+ _context.next = 16;
293
+ break;
294
+ }
295
+ if (rule.pattern.test(String(value))) {
296
+ _context.next = 16;
297
+ break;
298
+ }
299
+ messages.push(rule.message || "".concat(colTitle || dataIndex, " \u683C\u5F0F\u4E0D\u6B63\u786E"));
300
+ return _context.abrupt("continue", 27);
301
+ case 16:
302
+ if (!rule.validator) {
303
+ _context.next = 27;
304
+ break;
305
+ }
306
+ _context.prev = 17;
307
+ _context.next = 20;
308
+ return rule.validator(value, record);
309
+ case 20:
310
+ msg = _context.sent;
311
+ if (msg) messages.push(msg);
312
+ _context.next = 27;
313
+ break;
314
+ case 24:
315
+ _context.prev = 24;
316
+ _context.t0 = _context["catch"](17);
317
+ messages.push(_context.t0 instanceof Error ? _context.t0.message : String(_context.t0));
318
+ case 27:
319
+ _context.next = 5;
320
+ break;
321
+ case 29:
322
+ _context.next = 34;
323
+ break;
324
+ case 31:
325
+ _context.prev = 31;
326
+ _context.t1 = _context["catch"](3);
327
+ _iterator4.e(_context.t1);
328
+ case 34:
329
+ _context.prev = 34;
330
+ _iterator4.f();
331
+ return _context.finish(34);
332
+ case 37:
333
+ return _context.abrupt("return", messages);
334
+ case 38:
335
+ case "end":
336
+ return _context.stop();
337
+ }
338
+ }, _callee, null, [[3, 31, 34, 37], [17, 24]]);
339
+ }));
340
+ return function (_x, _x2, _x3, _x4, _x5) {
341
+ return _ref2.apply(this, arguments);
342
+ };
343
+ }(), []);
344
+
345
+ // 校验单个单元格(rowKey 定位错误位;无 key 时降级为 rowIndex)
346
+ var validateCell = React.useCallback( /*#__PURE__*/function () {
347
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(rowKey, dataIndex, value, record, rowIndex) {
348
+ var _ref4, _ref5;
349
+ var col, config, messages, key;
350
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
351
+ while (1) switch (_context2.prev = _context2.next) {
352
+ case 0:
353
+ col = colMap.get(String(dataIndex));
354
+ if (col) {
355
+ _context2.next = 3;
356
+ break;
357
+ }
358
+ return _context2.abrupt("return");
359
+ case 3:
360
+ config = getEditableConfig(col);
361
+ if (config) {
362
+ _context2.next = 6;
363
+ break;
364
+ }
365
+ return _context2.abrupt("return");
366
+ case 6:
367
+ _context2.next = 8;
368
+ return validateValue(value, record, config, col.title, dataIndex);
369
+ case 8:
370
+ messages = _context2.sent;
371
+ key = errorKey((_ref4 = rowKey !== null && rowKey !== void 0 ? rowKey : rowIndex) !== null && _ref4 !== void 0 ? _ref4 : '', dataIndex); // 记录本次写入序号 — validateAll 据此识别校验期间被用户重新编辑过的单元格
372
+ cellTouchSeqRef.current.set(key, {
373
+ seq: ++touchSeqRef.current,
374
+ messages: messages,
375
+ rowId: (_ref5 = rowKey !== null && rowKey !== void 0 ? rowKey : rowIndex) !== null && _ref5 !== void 0 ? _ref5 : '',
376
+ dataIndex: dataIndex,
377
+ rowIndex: rowIndex
378
+ });
379
+ setErrors(function (prev) {
380
+ var existing = prev.get(key);
381
+ // 错误内容没变化 → 返回旧 Map,不触发 context 重渲染
382
+ if (existing && existing.length === messages.length && existing.every(function (m, i) {
383
+ return m === messages[i];
384
+ })) {
385
+ return prev;
386
+ }
387
+ if (!existing && messages.length === 0) {
388
+ return prev;
389
+ }
390
+ // 有变化才创建新 Map
391
+ var next = new Map(prev);
392
+ if (messages.length > 0) {
393
+ next.set(key, messages);
394
+ } else {
395
+ next.delete(key);
396
+ }
397
+ return next;
398
+ });
399
+ case 12:
400
+ case "end":
401
+ return _context2.stop();
402
+ }
403
+ }, _callee2);
404
+ }));
405
+ return function (_x6, _x7, _x8, _x9, _x10) {
406
+ return _ref3.apply(this, arguments);
407
+ };
408
+ }(), [errorKey, getEditableConfig, validateValue, colMap]);
409
+
410
+ // 校验全部数据(异步 — 支持异步 validator)
411
+ var validateAll = React.useCallback( /*#__PURE__*/function () {
412
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(validateData) {
413
+ var _onValidateRef$curren;
414
+ var rows, nextErrors, startTouchSeq, flatRows, rowResults, errorEntries, _iterator7, _step7, _step7$value, _rowIndex, _rowKey, cells, _iterator9, _step9, cell, mergedErrors, mergedFirstError, _i, _errorEntries, _errorEntries$_i, key, errRowIndex, errRowKey, errDataIndex, errMessages, _iterator8, _step8, _step8$value, _key, touched, _touched$rowIndex, touchedRowIndex, result;
415
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
416
+ while (1) switch (_context4.prev = _context4.next) {
417
+ case 0:
418
+ rows = validateData !== null && validateData !== void 0 ? validateData : dataRef.current;
419
+ nextErrors = new Map(); // 校验开始时的写入序号快照 — 完成合并时以此识别校验期间被触碰过的单元格
420
+ startTouchSeq = touchSeqRef.current; // 扁平化(DFS,含树形 children)— 错误以 rowKey 定位,排序/筛选后仍挂对行
421
+ flatRows = flattenEditableRows(rows, childrenColumnNameRef.current, getRowKeyRef.current); // 行间并行、行内串行(保留 continue 语义)
422
+ _context4.next = 6;
423
+ return Promise.all(flatRows.map( /*#__PURE__*/function () {
424
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref7) {
425
+ var row, rowIndex, rowKey, cells, _iterator5, _step5, col, config, dataIndex, value, messages, _iterator6, _step6, rule, isEmpty, msg;
426
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
427
+ while (1) switch (_context3.prev = _context3.next) {
428
+ case 0:
429
+ row = _ref7.record, rowIndex = _ref7.rowIndex, rowKey = _ref7.rowKey;
430
+ cells = [];
431
+ _iterator5 = _createForOfIteratorHelper(flatColumns);
432
+ _context3.prev = 3;
433
+ _iterator5.s();
434
+ case 5:
435
+ if ((_step5 = _iterator5.n()).done) {
436
+ _context3.next = 52;
437
+ break;
438
+ }
439
+ col = _step5.value;
440
+ config = getEditableConfig(col);
441
+ if (config) {
442
+ _context3.next = 10;
443
+ break;
444
+ }
445
+ return _context3.abrupt("continue", 50);
446
+ case 10:
447
+ dataIndex = col.dataIndex;
448
+ value = row[dataIndex];
449
+ messages = [];
450
+ if (!config.rules) {
451
+ _context3.next = 49;
452
+ break;
453
+ }
454
+ _iterator6 = _createForOfIteratorHelper(config.rules);
455
+ _context3.prev = 15;
456
+ _iterator6.s();
457
+ case 17:
458
+ if ((_step6 = _iterator6.n()).done) {
459
+ _context3.next = 41;
460
+ break;
461
+ }
462
+ rule = _step6.value;
463
+ if (!rule.required) {
464
+ _context3.next = 24;
465
+ break;
466
+ }
467
+ isEmpty = value === undefined || value === null || value === '' || Array.isArray(value) && value.length === 0;
468
+ if (!isEmpty) {
469
+ _context3.next = 24;
470
+ break;
471
+ }
472
+ messages.push(rule.message || "".concat(String(col.title || dataIndex), " \u5FC5\u586B"));
473
+ return _context3.abrupt("continue", 39);
474
+ case 24:
475
+ if (!(rule.pattern && value != null && value !== '')) {
476
+ _context3.next = 28;
477
+ break;
478
+ }
479
+ if (rule.pattern.test(String(value))) {
480
+ _context3.next = 28;
481
+ break;
482
+ }
483
+ messages.push(rule.message || "".concat(String(col.title || dataIndex), " \u683C\u5F0F\u4E0D\u6B63\u786E"));
484
+ return _context3.abrupt("continue", 39);
485
+ case 28:
486
+ if (!rule.validator) {
487
+ _context3.next = 39;
488
+ break;
489
+ }
490
+ _context3.prev = 29;
491
+ _context3.next = 32;
492
+ return rule.validator(value, row);
493
+ case 32:
494
+ msg = _context3.sent;
495
+ if (msg) messages.push(msg);
496
+ _context3.next = 39;
497
+ break;
498
+ case 36:
499
+ _context3.prev = 36;
500
+ _context3.t0 = _context3["catch"](29);
501
+ messages.push(_context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0));
502
+ case 39:
503
+ _context3.next = 17;
504
+ break;
505
+ case 41:
506
+ _context3.next = 46;
507
+ break;
508
+ case 43:
509
+ _context3.prev = 43;
510
+ _context3.t1 = _context3["catch"](15);
511
+ _iterator6.e(_context3.t1);
512
+ case 46:
513
+ _context3.prev = 46;
514
+ _iterator6.f();
515
+ return _context3.finish(46);
516
+ case 49:
517
+ if (messages.length > 0) {
518
+ cells.push({
519
+ key: errorKey(rowKey !== null && rowKey !== void 0 ? rowKey : rowIndex, String(dataIndex)),
520
+ dataIndex: dataIndex,
521
+ messages: messages
522
+ });
523
+ }
524
+ case 50:
525
+ _context3.next = 5;
526
+ break;
527
+ case 52:
528
+ _context3.next = 57;
529
+ break;
530
+ case 54:
531
+ _context3.prev = 54;
532
+ _context3.t2 = _context3["catch"](3);
533
+ _iterator5.e(_context3.t2);
534
+ case 57:
535
+ _context3.prev = 57;
536
+ _iterator5.f();
537
+ return _context3.finish(57);
538
+ case 60:
539
+ return _context3.abrupt("return", {
540
+ rowIndex: rowIndex,
541
+ rowKey: rowKey,
542
+ cells: cells
543
+ });
544
+ case 61:
545
+ case "end":
546
+ return _context3.stop();
547
+ }
548
+ }, _callee3, null, [[3, 54, 57, 60], [15, 43, 46, 49], [29, 36]]);
549
+ }));
550
+ return function (_x12) {
551
+ return _ref8.apply(this, arguments);
552
+ };
553
+ }()));
554
+ case 6:
555
+ rowResults = _context4.sent;
556
+ // 收集本次校验的错误条目,用于合并后重建 firstError
557
+ errorEntries = []; // 合并结果
558
+ _iterator7 = _createForOfIteratorHelper(rowResults);
559
+ try {
560
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
561
+ _step7$value = _step7.value, _rowIndex = _step7$value.rowIndex, _rowKey = _step7$value.rowKey, cells = _step7$value.cells;
562
+ _iterator9 = _createForOfIteratorHelper(cells);
563
+ try {
564
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
565
+ cell = _step9.value;
566
+ nextErrors.set(cell.key, cell.messages);
567
+ errorEntries.push({
568
+ key: cell.key,
569
+ rowIndex: _rowIndex,
570
+ rowKey: _rowKey,
571
+ dataIndex: cell.dataIndex,
572
+ messages: cell.messages
573
+ });
574
+ }
575
+ } catch (err) {
576
+ _iterator9.e(err);
577
+ } finally {
578
+ _iterator9.f();
579
+ }
580
+ }
581
+
582
+ // 函数式合并:异步校验期间被用户重新编辑过的单元格
583
+ // (validateCell 已写入,序号 > startTouchSeq)保留其最新错误状态;
584
+ // 未被触碰的单元格应用本次校验结果。
585
+ // setErrors 与返回值共用同一份合并结果,保证外部拿到的 errors 与内部 state 一致。
586
+ } catch (err) {
587
+ _iterator7.e(err);
588
+ } finally {
589
+ _iterator7.f();
590
+ }
591
+ mergedErrors = mergeValidatedErrors(nextErrors, cellTouchSeqRef.current, startTouchSeq); // 合并后重建 firstError:保留在 mergedErrors 中的错误里 rowIndex 最小者
592
+ for (_i = 0, _errorEntries = errorEntries; _i < _errorEntries.length; _i++) {
593
+ _errorEntries$_i = _errorEntries[_i], key = _errorEntries$_i.key, errRowIndex = _errorEntries$_i.rowIndex, errRowKey = _errorEntries$_i.rowKey, errDataIndex = _errorEntries$_i.dataIndex, errMessages = _errorEntries$_i.messages;
594
+ if (mergedErrors.has(key)) {
595
+ if (!mergedFirstError || errRowIndex < mergedFirstError.rowIndex) {
596
+ mergedFirstError = {
597
+ rowIndex: errRowIndex,
598
+ rowKey: errRowKey !== null && errRowKey !== void 0 ? errRowKey : errRowIndex,
599
+ dataIndex: errDataIndex,
600
+ message: errMessages[0]
601
+ };
602
+ }
603
+ }
604
+ }
605
+ _iterator8 = _createForOfIteratorHelper(cellTouchSeqRef.current);
606
+ try {
607
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
608
+ _step8$value = _slicedToArray(_step8.value, 2), _key = _step8$value[0], touched = _step8$value[1];
609
+ if (touched.seq > startTouchSeq && touched.messages.length > 0 && mergedErrors.has(_key)) {
610
+ touchedRowIndex = (_touched$rowIndex = touched.rowIndex) !== null && _touched$rowIndex !== void 0 ? _touched$rowIndex : 0;
611
+ if (!mergedFirstError || touchedRowIndex < mergedFirstError.rowIndex) {
612
+ mergedFirstError = {
613
+ rowIndex: touchedRowIndex,
614
+ rowKey: touched.rowId,
615
+ dataIndex: touched.dataIndex,
616
+ message: touched.messages[0]
617
+ };
618
+ }
619
+ }
620
+ }
621
+ } catch (err) {
622
+ _iterator8.e(err);
623
+ } finally {
624
+ _iterator8.f();
625
+ }
626
+ setErrors(mergedErrors);
627
+ result = {
628
+ valid: mergedErrors.size === 0,
629
+ firstError: mergedFirstError,
630
+ errors: mergedErrors
631
+ };
632
+ (_onValidateRef$curren = onValidateRef.current) === null || _onValidateRef$curren === void 0 || _onValidateRef$curren.call(onValidateRef, result);
633
+ if (!result.valid && mergedFirstError && scrollToRowRef.current) {
634
+ scrollToRowRef.current(mergedFirstError.rowKey, mergedFirstError.rowIndex);
635
+ }
636
+ return _context4.abrupt("return", result);
637
+ case 19:
638
+ case "end":
639
+ return _context4.stop();
640
+ }
641
+ }, _callee4);
642
+ }));
643
+ return function (_x11) {
644
+ return _ref6.apply(this, arguments);
645
+ };
646
+ }(), [errorKey, getEditableConfig, flatColumns]);
647
+ var resetErrors = React.useCallback(function () {
648
+ setErrors(new Map());
649
+ }, []);
650
+ var onCellChange = React.useCallback(function (rowKey, dataIndex, value, record, rowIndex) {
651
+ var _onChangeRef$current;
652
+ var currentData = dataRef.current;
653
+ var newData;
654
+
655
+ // 优先按 rowKey 定位(含树形 children)— 排序/筛选后展示下标与 rawData 下标已不一致
656
+ if (rowKey !== undefined && rowKey !== null && getRowKeyRef.current) {
657
+ newData = updateRecordByKey(currentData, childrenColumnNameRef.current, getRowKeyRef.current, rowKey, dataIndex, value);
658
+ }
659
+ if (!newData) {
660
+ // 降级:无 key / key 未命中 / key 重复 → 维持原有索引行为
661
+ newData = currentData.map(function (row, i) {
662
+ if (i === rowIndex) {
663
+ return _objectSpread(_objectSpread({}, row), {}, _defineProperty({}, dataIndex, value));
664
+ }
665
+ return row;
666
+ });
667
+ }
668
+ (_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 || _onChangeRef$current.call(onChangeRef, newData);
669
+
670
+ // 触发列的 onChange 回调 — O(1) 查找
671
+ var col = colMap.get(String(dataIndex));
672
+ if (col) {
673
+ var _config$onChange;
674
+ var config = getEditableConfig(col);
675
+ config === null || config === void 0 || (_config$onChange = config.onChange) === null || _config$onChange === void 0 || _config$onChange.call(config, value, record, rowIndex);
676
+ }
677
+ }, [getEditableConfig, colMap]);
678
+ var scrollToError = React.useCallback(function (rowKey, rowIndex) {
679
+ var _scrollToRowRef$curre;
680
+ (_scrollToRowRef$curre = scrollToRowRef.current) === null || _scrollToRowRef$curre === void 0 || _scrollToRowRef$curre.call(scrollToRowRef, rowKey, rowIndex !== null && rowIndex !== void 0 ? rowIndex : 0);
681
+ }, []);
682
+ var contextValue = React.useMemo(function () {
683
+ return {
684
+ errors: errors,
685
+ validateCell: validateCell,
686
+ validateAll: validateAll,
687
+ resetErrors: resetErrors,
688
+ onCellChange: onCellChange,
689
+ scrollToError: scrollToError
690
+ };
691
+ }, [errors, validateCell, validateAll, resetErrors, onCellChange, scrollToError]);
692
+ return {
693
+ contextValue: contextValue,
694
+ errors: errors,
695
+ validateCell: validateCell,
696
+ validateAll: validateAll,
697
+ resetErrors: resetErrors,
698
+ onCellChange: onCellChange
699
+ };
700
+ }
701
+ var _default = exports.default = useEditable;