@lemon-fe/components 0.1.154 → 1.1.0-alpha.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 (411) hide show
  1. package/es/{Actions → actions}/index.d.ts +8 -5
  2. package/es/{Actions → actions}/index.js +56 -39
  3. package/es/{Actions → actions}/index.less +5 -5
  4. package/es/alert/index.d.ts +3 -0
  5. package/es/alert/index.js +18 -0
  6. package/es/{BaseTable/Actions.js → base-table/actions.js} +13 -10
  7. package/es/{BaseTable → base-table}/index.d.ts +0 -1
  8. package/es/{BaseTable → base-table}/index.js +48 -22
  9. package/es/{BaseTable/ResizeHeaderCell.js → base-table/resize-header-cell.js} +3 -3
  10. package/es/{BaseTable → base-table}/utils.d.ts +1 -1
  11. package/es/{BaseTable/VirtualBody.js → base-table/virtual-body.js} +12 -13
  12. package/es/{ColorPicker → color-picker}/index.js +7 -7
  13. package/es/{ColorPicker → color-picker}/index.less +1 -1
  14. package/es/component-configure/index.d.ts +12 -0
  15. package/es/component-configure/index.js +4 -0
  16. package/es/data-grid/cell-editors/date.d.ts +19 -0
  17. package/es/data-grid/cell-editors/date.js +92 -0
  18. package/es/data-grid/cell-editors/number.d.ts +32 -0
  19. package/es/data-grid/cell-editors/number.js +120 -0
  20. package/es/data-grid/cell-editors/row.d.ts +23 -0
  21. package/es/data-grid/cell-editors/row.js +119 -0
  22. package/es/data-grid/cell-editors/select.d.ts +33 -0
  23. package/es/data-grid/cell-editors/select.js +102 -0
  24. package/es/data-grid/cell-editors/text.d.ts +10 -0
  25. package/es/data-grid/cell-editors/text.js +81 -0
  26. package/es/data-grid/cell-editors/utils.d.ts +10 -0
  27. package/es/data-grid/cell-editors/utils.js +45 -0
  28. package/es/data-grid/cell-editors/wrapper.d.ts +5 -0
  29. package/es/data-grid/cell-editors/wrapper.js +8 -0
  30. package/es/data-grid/components/custom-panel/drag-context.d.ts +4 -0
  31. package/es/data-grid/components/custom-panel/drag-context.js +3 -0
  32. package/es/data-grid/components/custom-panel/field-modal.d.ts +10 -0
  33. package/es/data-grid/components/custom-panel/field-modal.js +223 -0
  34. package/es/data-grid/components/custom-panel/index.d.ts +5 -0
  35. package/es/data-grid/components/custom-panel/index.js +321 -0
  36. package/es/data-grid/components/custom-panel/item.d.ts +14 -0
  37. package/es/data-grid/components/custom-panel/item.js +181 -0
  38. package/es/data-grid/components/custom-panel/typings.d.ts +25 -0
  39. package/es/data-grid/components/search.d.ts +4 -0
  40. package/es/data-grid/components/search.js +159 -0
  41. package/es/data-grid/components/selected.d.ts +7 -0
  42. package/es/data-grid/components/selected.js +24 -0
  43. package/es/data-grid/context/grid-store.d.ts +4 -0
  44. package/es/data-grid/context/grid-store.js +4 -0
  45. package/es/data-grid/hooks.d.ts +20 -0
  46. package/es/data-grid/hooks.js +71 -0
  47. package/es/data-grid/index.d.ts +102 -0
  48. package/es/data-grid/index.js +1684 -0
  49. package/es/data-grid/index.less +659 -0
  50. package/es/data-grid/modules/clipboard/clipboard/clipboardService.d.ts +62 -0
  51. package/es/data-grid/modules/clipboard/clipboard/clipboardService.js +1007 -0
  52. package/es/data-grid/modules/clipboard/clipboardModule.d.ts +2 -0
  53. package/es/data-grid/modules/clipboard/clipboardModule.js +10 -0
  54. package/es/data-grid/modules/clipboard/main.d.ts +1 -0
  55. package/es/data-grid/modules/clipboard/main.js +1 -0
  56. package/es/data-grid/modules/clipboard/version.d.ts +1 -0
  57. package/es/data-grid/modules/clipboard/version.js +2 -0
  58. package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnModelItem.d.ts +26 -0
  59. package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnModelItem.js +94 -0
  60. package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnToolPanel.d.ts +32 -0
  61. package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnToolPanel.js +272 -0
  62. package/es/data-grid/modules/column-tool-panel/columnToolPanel/modelItemUtils.d.ts +16 -0
  63. package/es/data-grid/modules/column-tool-panel/columnToolPanel/modelItemUtils.js +209 -0
  64. package/es/data-grid/modules/column-tool-panel/columnToolPanel/pivotModePanel.d.ts +9 -0
  65. package/es/data-grid/modules/column-tool-panel/columnToolPanel/pivotModePanel.js +68 -0
  66. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsHeaderPanel.d.ts +32 -0
  67. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsHeaderPanel.js +150 -0
  68. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanel.d.ts +44 -0
  69. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanel.js +455 -0
  70. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanelItemDragFeature.d.ts +26 -0
  71. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanelItemDragFeature.js +224 -0
  72. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsPanel.d.ts +24 -0
  73. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsPanel.js +123 -0
  74. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnComp.d.ts +37 -0
  75. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnComp.js +314 -0
  76. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnGroupComp.d.ts +51 -0
  77. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnGroupComp.js +406 -0
  78. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelContextMenu.d.ts +24 -0
  79. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelContextMenu.js +264 -0
  80. package/es/data-grid/modules/column-tool-panel/columnsToolPanelModule.d.ts +2 -0
  81. package/es/data-grid/modules/column-tool-panel/columnsToolPanelModule.js +29 -0
  82. package/es/data-grid/modules/column-tool-panel/main.d.ts +2 -0
  83. package/es/data-grid/modules/column-tool-panel/main.js +3 -0
  84. package/es/data-grid/modules/column-tool-panel/version.d.ts +1 -0
  85. package/es/data-grid/modules/column-tool-panel/version.js +2 -0
  86. package/es/data-grid/modules/master-detail/main.d.ts +1 -0
  87. package/es/data-grid/modules/master-detail/main.js +1 -0
  88. package/es/data-grid/modules/master-detail/masterDetail/detailCellRenderer.d.ts +14 -0
  89. package/es/data-grid/modules/master-detail/masterDetail/detailCellRenderer.js +144 -0
  90. package/es/data-grid/modules/master-detail/masterDetail/detailCellRendererCtrl.d.ts +19 -0
  91. package/es/data-grid/modules/master-detail/masterDetail/detailCellRendererCtrl.js +203 -0
  92. package/es/data-grid/modules/master-detail/masterDetailModule.d.ts +2 -0
  93. package/es/data-grid/modules/master-detail/masterDetailModule.js +18 -0
  94. package/es/data-grid/modules/master-detail/version.d.ts +1 -0
  95. package/es/data-grid/modules/master-detail/version.js +2 -0
  96. package/es/data-grid/modules/menu/main.d.ts +1 -0
  97. package/es/data-grid/modules/menu/main.js +1 -0
  98. package/es/data-grid/modules/menu/menu/chartMenuItemMapper.d.ts +13 -0
  99. package/es/data-grid/modules/menu/menu/chartMenuItemMapper.js +351 -0
  100. package/es/data-grid/modules/menu/menu/contextMenu.d.ts +13 -0
  101. package/es/data-grid/modules/menu/menu/contextMenu.js +267 -0
  102. package/es/data-grid/modules/menu/menu/enterpriseMenu.d.ts +66 -0
  103. package/es/data-grid/modules/menu/menu/enterpriseMenu.js +592 -0
  104. package/es/data-grid/modules/menu/menu/menuItemMapper.d.ts +13 -0
  105. package/es/data-grid/modules/menu/menu/menuItemMapper.js +328 -0
  106. package/es/data-grid/modules/menu/menuModule.d.ts +2 -0
  107. package/es/data-grid/modules/menu/menuModule.js +12 -0
  108. package/es/data-grid/modules/menu/version.d.ts +1 -0
  109. package/es/data-grid/modules/menu/version.js +2 -0
  110. package/es/data-grid/modules/row-grouping/main.d.ts +4 -0
  111. package/es/data-grid/modules/row-grouping/main.js +4 -0
  112. package/es/data-grid/modules/row-grouping/rowGrouping/aggFuncService.d.ts +23 -0
  113. package/es/data-grid/modules/row-grouping/rowGrouping/aggFuncService.js +250 -0
  114. package/es/data-grid/modules/row-grouping/rowGrouping/aggregationStage.d.ts +22 -0
  115. package/es/data-grid/modules/row-grouping/rowGrouping/aggregationStage.js +285 -0
  116. package/es/data-grid/modules/row-grouping/rowGrouping/batchRemover.d.ts +12 -0
  117. package/es/data-grid/modules/row-grouping/rowGrouping/batchRemover.js +77 -0
  118. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/baseDropZonePanel.d.ts +75 -0
  119. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/baseDropZonePanel.js +516 -0
  120. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/dropZoneColumnComp.d.ts +40 -0
  121. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/dropZoneColumnComp.js +367 -0
  122. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/gridHeaderDropZones.d.ts +11 -0
  123. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/gridHeaderDropZones.js +85 -0
  124. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/pivotDropZonePanel.d.ts +17 -0
  125. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/pivotDropZonePanel.js +139 -0
  126. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/rowGroupDropZonePanel.d.ts +15 -0
  127. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/rowGroupDropZonePanel.js +105 -0
  128. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/valueDropZonePanel.d.ts +15 -0
  129. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/valueDropZonePanel.js +105 -0
  130. package/es/data-grid/modules/row-grouping/rowGrouping/filterAggregatesStage.d.ts +9 -0
  131. package/es/data-grid/modules/row-grouping/rowGrouping/filterAggregatesStage.js +136 -0
  132. package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFilter.d.ts +39 -0
  133. package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFilter.js +319 -0
  134. package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFloatingFilter.d.ts +23 -0
  135. package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFloatingFilter.js +163 -0
  136. package/es/data-grid/modules/row-grouping/rowGrouping/groupStage.d.ts +48 -0
  137. package/es/data-grid/modules/row-grouping/rowGrouping/groupStage.js +740 -0
  138. package/es/data-grid/modules/row-grouping/rowGrouping/pivotColDefService.d.ts +24 -0
  139. package/es/data-grid/modules/row-grouping/rowGrouping/pivotColDefService.js +396 -0
  140. package/es/data-grid/modules/row-grouping/rowGrouping/pivotStage.d.ts +19 -0
  141. package/es/data-grid/modules/row-grouping/rowGrouping/pivotStage.js +182 -0
  142. package/es/data-grid/modules/row-grouping/rowGroupingModule.d.ts +2 -0
  143. package/es/data-grid/modules/row-grouping/rowGroupingModule.js +28 -0
  144. package/es/data-grid/modules/row-grouping/version.d.ts +1 -0
  145. package/es/data-grid/modules/row-grouping/version.js +2 -0
  146. package/es/data-grid/modules/side-bar/main.d.ts +2 -0
  147. package/es/data-grid/modules/side-bar/main.js +2 -0
  148. package/es/data-grid/modules/side-bar/sideBar/common/toolPanelColDefService.d.ts +11 -0
  149. package/es/data-grid/modules/side-bar/sideBar/common/toolPanelColDefService.js +216 -0
  150. package/es/data-grid/modules/side-bar/sideBar/horizontalResizeComp.d.ts +19 -0
  151. package/es/data-grid/modules/side-bar/sideBar/horizontalResizeComp.js +108 -0
  152. package/es/data-grid/modules/side-bar/sideBar/sideBarButtonComp.d.ts +16 -0
  153. package/es/data-grid/modules/side-bar/sideBar/sideBarButtonComp.js +84 -0
  154. package/es/data-grid/modules/side-bar/sideBar/sideBarButtonsComp.d.ts +18 -0
  155. package/es/data-grid/modules/side-bar/sideBar/sideBarButtonsComp.js +89 -0
  156. package/es/data-grid/modules/side-bar/sideBar/sideBarComp.d.ts +28 -0
  157. package/es/data-grid/modules/side-bar/sideBar/sideBarComp.js +325 -0
  158. package/es/data-grid/modules/side-bar/sideBar/sideBarDefParser.d.ts +10 -0
  159. package/es/data-grid/modules/side-bar/sideBar/sideBarDefParser.js +95 -0
  160. package/es/data-grid/modules/side-bar/sideBar/toolPanelWrapper.d.ts +17 -0
  161. package/es/data-grid/modules/side-bar/sideBar/toolPanelWrapper.js +103 -0
  162. package/es/data-grid/modules/side-bar/sideBarModule.d.ts +2 -0
  163. package/es/data-grid/modules/side-bar/sideBarModule.js +22 -0
  164. package/es/data-grid/modules/side-bar/version.d.ts +1 -0
  165. package/es/data-grid/modules/side-bar/version.js +2 -0
  166. package/es/data-grid/renderer/actions-renderer.d.ts +3 -0
  167. package/es/data-grid/renderer/actions-renderer.js +50 -0
  168. package/es/data-grid/renderer/actions.d.ts +11 -0
  169. package/es/data-grid/renderer/actions.js +72 -0
  170. package/es/data-grid/renderer/cell-delete-renderer.d.ts +5 -0
  171. package/es/data-grid/renderer/cell-delete-renderer.js +49 -0
  172. package/es/data-grid/renderer/cell-index-renderer.d.ts +4 -0
  173. package/es/data-grid/renderer/cell-index-renderer.js +43 -0
  174. package/es/data-grid/renderer/cell-renderer.d.ts +4 -0
  175. package/es/data-grid/renderer/cell-renderer.js +58 -0
  176. package/es/data-grid/renderer/detali-cell-renderer.d.ts +9 -0
  177. package/es/data-grid/renderer/detali-cell-renderer.js +59 -0
  178. package/es/data-grid/renderer/header-renderer.d.ts +6 -0
  179. package/es/data-grid/renderer/header-renderer.js +98 -0
  180. package/es/data-grid/typings.d.ts +226 -0
  181. package/es/data-grid/typings.js +1 -0
  182. package/es/data-grid/utils.d.ts +51 -0
  183. package/es/data-grid/utils.js +293 -0
  184. package/es/dropdown/index.d.ts +14 -0
  185. package/es/dropdown/index.js +42 -0
  186. package/es/dropdown/index.less +5 -0
  187. package/es/{DurationPicker → duration-picker}/index.d.ts +12 -9
  188. package/es/duration-picker/index.js +204 -0
  189. package/es/duration-picker/index.less +12 -0
  190. package/es/{EditableTable/EditableCell.d.ts → editable-table/editable-cell.d.ts} +1 -1
  191. package/es/editable-table/editable-cell.js +41 -0
  192. package/es/{EditableTable/EditableTableFormItem.d.ts → editable-table/editable-table-form-item.d.ts} +1 -1
  193. package/es/{EditableTable/EditableTableFormItem.js → editable-table/editable-table-form-item.js} +3 -5
  194. package/es/{EditableTable → editable-table}/index.d.ts +3 -3
  195. package/es/editable-table/index.js +8 -0
  196. package/es/{EditableTable/Table.d.ts → editable-table/table.d.ts} +1 -1
  197. package/es/{EditableTable/Table.js → editable-table/table.js} +27 -22
  198. package/es/{EditableTable → editable-table}/typings.d.ts +2 -2
  199. package/es/editable-table/util.js +311 -0
  200. package/es/empty-image/index.d.ts +2 -0
  201. package/es/empty-image/index.js +78 -0
  202. package/es/{Filter → filter}/index.d.ts +3 -3
  203. package/es/filter/index.js +615 -0
  204. package/es/{Filter → filter}/index.less +5 -5
  205. package/es/filter/typings.d.ts +70 -0
  206. package/es/{FormLayout → form-layout}/index.d.ts +5 -0
  207. package/es/form-layout/index.js +48 -0
  208. package/es/{FormLayout → form-layout}/index.less +21 -8
  209. package/es/grey-panel/index.d.ts +6 -0
  210. package/es/grey-panel/index.js +15 -0
  211. package/es/grey-panel/index.less +11 -0
  212. package/es/icons/add.d.ts +6 -0
  213. package/es/icons/add.js +39 -0
  214. package/es/{Icons/BigTip → icons/big-tip}/index.d.ts +1 -1
  215. package/es/{Icons/BigTip → icons/big-tip}/index.js +6 -8
  216. package/es/{Icons/Down.d.ts → icons/calendar.d.ts} +1 -1
  217. package/es/icons/calendar.js +35 -0
  218. package/es/icons/clear.d.ts +3 -0
  219. package/es/icons/clear.js +18 -0
  220. package/es/icons/clock.d.ts +5 -0
  221. package/es/icons/clock.js +27 -0
  222. package/es/icons/close-light.d.ts +5 -0
  223. package/es/icons/close-light.js +31 -0
  224. package/es/{Icons/Close.d.ts → icons/close.d.ts} +1 -1
  225. package/es/icons/close.js +22 -0
  226. package/es/{Icons/CollapseUp.d.ts → icons/collapse-up.d.ts} +1 -1
  227. package/es/icons/collapse-up.js +24 -0
  228. package/es/{Icons/Search.d.ts → icons/dark-search.d.ts} +1 -1
  229. package/es/{Icons/DarkSearch.js → icons/dark-search.js} +3 -5
  230. package/es/icons/delete.d.ts +3 -0
  231. package/es/icons/delete.js +37 -0
  232. package/es/icons/down.d.ts +3 -0
  233. package/es/icons/down.js +18 -0
  234. package/es/icons/drag/drag.svg +7 -0
  235. package/es/icons/drag/index.d.ts +3 -0
  236. package/es/icons/drag/index.js +31 -0
  237. package/es/{Icons/Empty.d.ts → icons/empty.d.ts} +1 -0
  238. package/es/icons/index.d.ts +45 -0
  239. package/es/icons/index.js +45 -0
  240. package/es/{Icons/LookUp.d.ts → icons/look-up.d.ts} +1 -1
  241. package/es/{Icons/LookUp.js → icons/look-up.js} +3 -5
  242. package/es/icons/more.d.ts +3 -0
  243. package/es/icons/more.js +37 -0
  244. package/es/icons/new-tag.d.ts +3 -0
  245. package/es/icons/new-tag.js +19 -0
  246. package/es/icons/plus/index.d.ts +3 -0
  247. package/es/icons/plus/index.js +27 -0
  248. package/es/icons/plus/plus.svg +6 -0
  249. package/es/icons/question.d.ts +3 -0
  250. package/es/icons/question.js +18 -0
  251. package/es/icons/reload.d.ts +3 -0
  252. package/es/icons/reload.js +18 -0
  253. package/es/icons/search.d.ts +3 -0
  254. package/es/icons/search.js +18 -0
  255. package/es/icons/tip.d.ts +5 -0
  256. package/es/{Icons/Tip.js → icons/tip.js} +64 -75
  257. package/es/index.d.ts +43 -32
  258. package/es/index.js +36 -28
  259. package/es/input-compact/index.d.ts +11 -0
  260. package/es/input-compact/index.js +63 -0
  261. package/es/input-compact/index.less +33 -0
  262. package/es/input-number/index.d.ts +8 -0
  263. package/es/input-number/index.js +35 -0
  264. package/es/input-number/index.less +58 -0
  265. package/es/{Layout → layout}/index.d.ts +26 -8
  266. package/es/layout/index.js +253 -0
  267. package/es/{Layout → layout}/index.less +43 -25
  268. package/es/{PageLoading → page-loading}/index.d.ts +2 -1
  269. package/es/{PageLoading → page-loading}/index.js +5 -3
  270. package/es/popup/index.d.ts +80 -0
  271. package/es/popup/index.js +260 -0
  272. package/es/popup/index.less +34 -0
  273. package/es/portal/index.d.ts +18 -0
  274. package/es/{Portal → portal}/index.js +48 -14
  275. package/es/{Section → section}/index.d.ts +10 -2
  276. package/es/section/index.js +99 -0
  277. package/es/{Section → section}/index.less +22 -6
  278. package/es/{Section/TabBar.d.ts → section/tab-bar.d.ts} +2 -1
  279. package/es/{Section/TabBar.js → section/tab-bar.js} +6 -3
  280. package/es/select-panel/index.d.ts +17 -0
  281. package/es/select-panel/index.js +63 -0
  282. package/es/select-panel/index.less +112 -0
  283. package/es/select-view/index.d.ts +63 -0
  284. package/es/select-view/index.js +269 -0
  285. package/es/select-view/index.less +57 -0
  286. package/es/{SiderTree → sider-tree}/index.d.ts +6 -12
  287. package/es/{SiderTree → sider-tree}/index.js +58 -82
  288. package/es/sider-tree/index.less +151 -0
  289. package/es/{SiderTree/TreeNodeTitle.js → sider-tree/tree-node-title.js} +13 -10
  290. package/es/{SiderTree → sider-tree}/typings.d.ts +2 -2
  291. package/es/state/index.d.ts +8 -0
  292. package/es/state/index.js +20 -0
  293. package/es/state/index.less +131 -0
  294. package/es/styles/empty.png +0 -0
  295. package/es/styles/index.less +28 -0
  296. package/es/styles/overrides.less +347 -0
  297. package/es/styles/theme.less +29 -0
  298. package/es/{utils.less → styles/utils.less} +18 -18
  299. package/es/symbol-icon/index.js +30 -0
  300. package/es/{TabBar → tab-bar}/index.d.ts +2 -3
  301. package/es/tab-bar/index.js +31 -0
  302. package/es/tab-bar/index.less +5 -0
  303. package/es/table/index.js +201 -0
  304. package/es/{Table → table}/typings.d.ts +2 -3
  305. package/es/{Table → table}/utils.d.ts +1 -1
  306. package/es/tip-mark/index.d.ts +8 -0
  307. package/es/tip-mark/index.js +44 -0
  308. package/es/utils.d.ts +2 -1
  309. package/es/utils.js +10 -2
  310. package/package.json +50 -21
  311. package/README.md +0 -11
  312. package/es/Dropdown/index.d.ts +0 -15
  313. package/es/Dropdown/index.js +0 -45
  314. package/es/Dropdown/index.less +0 -13
  315. package/es/DurationPicker/index.js +0 -174
  316. package/es/DurationPicker/index.less +0 -61
  317. package/es/EditableTable/EditableCell.js +0 -41
  318. package/es/EditableTable/index.js +0 -8
  319. package/es/EditableTable/util.js +0 -311
  320. package/es/Filter/index.js +0 -555
  321. package/es/Filter/typings.d.ts +0 -37
  322. package/es/FormHorizontal/index.d.ts +0 -6
  323. package/es/FormHorizontal/index.js +0 -30
  324. package/es/FormHorizontal/index.less +0 -14
  325. package/es/FormInline/index.d.ts +0 -15
  326. package/es/FormInline/index.js +0 -74
  327. package/es/FormInline/index.less +0 -26
  328. package/es/FormLayout/index.js +0 -36
  329. package/es/FormTable/index.d.ts +0 -6
  330. package/es/FormTable/index.js +0 -125
  331. package/es/FormTable/index.less +0 -11
  332. package/es/FormTable/typings.d.ts +0 -38
  333. package/es/Icons/Calendar.d.ts +0 -5
  334. package/es/Icons/Calendar.js +0 -42
  335. package/es/Icons/Close.js +0 -24
  336. package/es/Icons/CollapseUp.js +0 -26
  337. package/es/Icons/DarkSearch.d.ts +0 -5
  338. package/es/Icons/Down.js +0 -30
  339. package/es/Icons/More.d.ts +0 -5
  340. package/es/Icons/More.js +0 -39
  341. package/es/Icons/Search.js +0 -30
  342. package/es/Icons/Tip.d.ts +0 -6
  343. package/es/Icons/index.d.ts +0 -24
  344. package/es/Icons/index.js +0 -25
  345. package/es/InputMaxLength/index.d.ts +0 -14
  346. package/es/InputMaxLength/index.js +0 -72
  347. package/es/InputMaxLength/index.less +0 -8
  348. package/es/Layout/index.js +0 -184
  349. package/es/MainFramework/components/DropMenu/index.d.ts +0 -11
  350. package/es/MainFramework/components/DropMenu/index.js +0 -93
  351. package/es/MainFramework/components/DropMenu/index.less +0 -59
  352. package/es/MainFramework/components/Menu/index.d.ts +0 -10
  353. package/es/MainFramework/components/Menu/index.js +0 -603
  354. package/es/MainFramework/components/Menu/index.less +0 -445
  355. package/es/MainFramework/components/RefreshButton/index.d.ts +0 -6
  356. package/es/MainFramework/components/RefreshButton/index.js +0 -63
  357. package/es/MainFramework/components/RefreshButton/index.less +0 -30
  358. package/es/MainFramework/components/TabBar/index.d.ts +0 -10
  359. package/es/MainFramework/components/TabBar/index.js +0 -101
  360. package/es/MainFramework/components/TabBar/index.less +0 -155
  361. package/es/MainFramework/components/WaterMark/index.d.ts +0 -6
  362. package/es/MainFramework/components/WaterMark/index.js +0 -65
  363. package/es/MainFramework/index.d.ts +0 -28
  364. package/es/MainFramework/index.js +0 -78
  365. package/es/MainFramework/index.less +0 -97
  366. package/es/MainFramework/typings.d.ts +0 -10
  367. package/es/Popup/index.d.ts +0 -39
  368. package/es/Popup/index.js +0 -180
  369. package/es/Popup/index.less +0 -12
  370. package/es/Portal/index.d.ts +0 -17
  371. package/es/Section/index.js +0 -90
  372. package/es/SelectView/index.d.ts +0 -56
  373. package/es/SelectView/index.js +0 -227
  374. package/es/SelectView/index.less +0 -60
  375. package/es/SiderTree/index.less +0 -222
  376. package/es/SymbolIcon/index.js +0 -27
  377. package/es/TabBar/index.js +0 -42
  378. package/es/TabBar/index.less +0 -31
  379. package/es/Table/index.js +0 -205
  380. package/es/TipMark/index.d.ts +0 -10
  381. package/es/TipMark/index.js +0 -35
  382. package/es/TipMark/index.less +0 -6
  383. package/es/index.less +0 -26
  384. package/es/init.d.ts +0 -3
  385. package/es/init.js +0 -134
  386. package/es/overrides.less +0 -183
  387. package/es/theme.less +0 -9
  388. /package/es/{BaseTable/Actions.d.ts → base-table/actions.d.ts} +0 -0
  389. /package/es/{BaseTable/BaseTableContext.d.ts → base-table/base-table-context.d.ts} +0 -0
  390. /package/es/{BaseTable/BaseTableContext.js → base-table/base-table-context.js} +0 -0
  391. /package/es/{BaseTable → base-table}/empty.png +0 -0
  392. /package/es/{BaseTable → base-table}/index.less +0 -0
  393. /package/es/{BaseTable/ResizeHeaderCell.d.ts → base-table/resize-header-cell.d.ts} +0 -0
  394. /package/es/{BaseTable → base-table}/typings.d.ts +0 -0
  395. /package/es/{BaseTable → base-table}/utils.js +0 -0
  396. /package/es/{BaseTable/VirtualBody.d.ts → base-table/virtual-body.d.ts} +0 -0
  397. /package/es/{ColorPicker → color-picker}/index.d.ts +0 -0
  398. /package/es/{EditableTable → editable-table}/index.less +0 -0
  399. /package/es/{EditableTable → editable-table}/util.d.ts +0 -0
  400. /package/es/{Icons/BigTip → icons/big-tip}/error.png +0 -0
  401. /package/es/{Icons/BigTip → icons/big-tip}/info.png +0 -0
  402. /package/es/{Icons/BigTip → icons/big-tip}/success.png +0 -0
  403. /package/es/{Icons/BigTip → icons/big-tip}/warning.png +0 -0
  404. /package/es/{Icons/Empty.js → icons/empty.js} +0 -0
  405. /package/es/{PageLoading → page-loading}/index.less +0 -0
  406. /package/es/{SiderTree → sider-tree}/empty.png +0 -0
  407. /package/es/{SiderTree/TreeNodeTitle.d.ts → sider-tree/tree-node-title.d.ts} +0 -0
  408. /package/es/{SymbolIcon → symbol-icon}/index.d.ts +0 -0
  409. /package/es/{SymbolIcon → symbol-icon}/index.less +0 -0
  410. /package/es/{Table → table}/index.d.ts +0 -0
  411. /package/es/{Table → table}/utils.js +0 -0
@@ -0,0 +1,1684 @@
1
+ var _excluded = ["validator"],
2
+ _excluded2 = ["title", "dataIndex", "render", "ellipsis", "sorter", "editable", "className"],
3
+ _excluded3 = ["title", "children"],
4
+ _excluded4 = ["rowKey", "fetch", "dataSource", "rowActions", "columns", "autoLoad", "loading", "summary", "detailCell", "pagination", "rowSelection", "columnTypes", "defaultColDef", "components", "sideBar", "detailCellRendererParams", "context", "showSearch", "cellDisplayFlex"];
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+ 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; }
7
+ 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; }
8
+ 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); }
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ 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."); }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ 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; }
14
+ 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; }
15
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
16
+ 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."); }
17
+ 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); }
18
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
19
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
20
+ 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; }
21
+ 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; }
22
+ 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); } }
23
+ 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); }); }; }
24
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
26
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
28
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
30
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
31
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
32
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
33
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
34
+ 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; }
35
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
36
+ 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); }
37
+ import React, { Component, createRef } from 'react';
38
+ import { ComponentConfigureContext } from "../component-configure";
39
+ import DateEditor from "./cell-editors/date";
40
+ import NumberEditor from "./cell-editors/number";
41
+ import RowEditor, { RowEditorData } from "./cell-editors/row";
42
+ import SelectEditor from "./cell-editors/select";
43
+ import TextEditor from "./cell-editors/text";
44
+ import EditorWrapper from "./cell-editors/wrapper";
45
+ import CustomColumnPanel from "./components/custom-panel";
46
+ import Search from "./components/search";
47
+ import Selected from "./components/selected";
48
+ import GridStoreContext from "./context/grid-store";
49
+ import { useGridStore } from "./hooks";
50
+ import { ClipboardModule } from "./modules/clipboard/main";
51
+ import { ColumnsToolPanelModule } from "./modules/column-tool-panel/main";
52
+ import { MasterDetailModule } from "./modules/master-detail/main";
53
+ import { MenuModule } from "./modules/menu/main";
54
+ import { RowGroupingModule } from "./modules/row-grouping/main";
55
+ import { SideBarModule } from "./modules/side-bar/main";
56
+ import ActionsRenderer from "./renderer/actions-renderer";
57
+ import CellIndexRender from "./renderer/cell-index-renderer";
58
+ import CellRenderer from "./renderer/cell-renderer";
59
+ import DetailCellRenderer from "./renderer/detali-cell-renderer";
60
+ import HeaderRenderer from "./renderer/header-renderer";
61
+ import { prefix, getColField, isColumn, withSyncRender, Store, Selection, columnTypes } from "./utils";
62
+ import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
63
+ import { ModuleRegistry, GridApi, ColumnApi } from '@ag-grid-community/core';
64
+ import { InfiniteRowModelModule } from '@ag-grid-community/infinite-row-model';
65
+ import { AgGridReact } from '@ag-grid-community/react';
66
+ import { Spin, Pagination } from 'antd';
67
+ import Scheme from 'async-validator';
68
+ import BigNumber from 'bignumber.js';
69
+ import classNames from 'classnames';
70
+ import { Parser } from 'expr-eval';
71
+ import { get, set } from 'lodash';
72
+ import memoizeOne from 'memoize-one';
73
+ import shallowEqual from 'shallowequal';
74
+ function toNumber(a) {
75
+ if (typeof a === 'string') {
76
+ return a.replace(/,/g, '');
77
+ }
78
+ return a;
79
+ }
80
+ var add = function add(a, b) {
81
+ return new BigNumber(toNumber(a)).plus(toNumber(b));
82
+ };
83
+ var subtract = function subtract(a, b) {
84
+ return new BigNumber(toNumber(a)).minus(toNumber(b));
85
+ };
86
+ var multiply = function multiply(a, b) {
87
+ return new BigNumber(toNumber(a)).times(toNumber(b));
88
+ };
89
+ var divide = function divide(a, b) {
90
+ return new BigNumber(toNumber(a)).div(toNumber(b));
91
+ };
92
+ ModuleRegistry.registerModules([ClientSideRowModelModule, RowGroupingModule, InfiniteRowModelModule, ClipboardModule, MenuModule, SideBarModule, ColumnsToolPanelModule, MasterDetailModule], false);
93
+ var defaultColDef = {
94
+ resizable: true,
95
+ initialWidth: 140,
96
+ suppressMenu: true
97
+ };
98
+ var defaultComponents = {
99
+ agColumnHeader: HeaderRenderer,
100
+ agColumnGroupHeader: HeaderRenderer,
101
+ 'text-editor': TextEditor,
102
+ 'number-editor': NumberEditor,
103
+ 'date-editor': DateEditor,
104
+ 'select-editor': SelectEditor,
105
+ 'row-editor': RowEditor,
106
+ 'row-index': CellIndexRender
107
+ };
108
+ function unsort() {
109
+ return 0;
110
+ }
111
+ function EmptyOverlay(props) {
112
+ var err = useGridStore(function (state) {
113
+ return state.fetchError;
114
+ });
115
+ var _props$desc = props.desc,
116
+ desc = _props$desc === void 0 ? '暂无数据' : _props$desc;
117
+ return /*#__PURE__*/React.createElement("div", {
118
+ className: prefix('empty-overlay')
119
+ }, err ? err.message : desc, "~");
120
+ }
121
+ var DataGrid = /*#__PURE__*/function (_Component) {
122
+ _inherits(DataGrid, _Component);
123
+ var _super = _createSuper(DataGrid);
124
+ function DataGrid(props) {
125
+ var _this;
126
+ _classCallCheck(this, DataGrid);
127
+ _this = _super.call(this, props);
128
+ _defineProperty(_assertThisInitialized(_this), "api", new GridApi());
129
+ _defineProperty(_assertThisInitialized(_this), "columnApi", new ColumnApi());
130
+ _defineProperty(_assertThisInitialized(_this), "selected", void 0);
131
+ _defineProperty(_assertThisInitialized(_this), "store", void 0);
132
+ _defineProperty(_assertThisInitialized(_this), "dataSource", []);
133
+ _defineProperty(_assertThisInitialized(_this), "validator", null);
134
+ _defineProperty(_assertThisInitialized(_this), "requestId", 0);
135
+ _defineProperty(_assertThisInitialized(_this), "isReady", false);
136
+ _defineProperty(_assertThisInitialized(_this), "readyQueue", []);
137
+ _defineProperty(_assertThisInitialized(_this), "emptyRowData", []);
138
+ _defineProperty(_assertThisInitialized(_this), "sideBarDef", {
139
+ toolPanels: [{
140
+ id: 'columns',
141
+ labelDefault: 'Columns',
142
+ labelKey: 'columns',
143
+ iconKey: 'columns',
144
+ toolPanel: CustomColumnPanel,
145
+ toolPanelParams: {
146
+ enableSave: !!_this.props.customColumnPanelStorage
147
+ }
148
+ }]
149
+ });
150
+ _defineProperty(_assertThisInitialized(_this), "searchRef", /*#__PURE__*/createRef());
151
+ _defineProperty(_assertThisInitialized(_this), "prevFocusedCell", null);
152
+ _defineProperty(_assertThisInitialized(_this), "fields", []);
153
+ _defineProperty(_assertThisInitialized(_this), "getFieldsSummary", memoizeOne(function (dataSource, fields) {
154
+ var summaryField = fields.filter(function (field) {
155
+ return field.summary;
156
+ });
157
+ var summary = {};
158
+ dataSource.forEach(function (data) {
159
+ var rowId = _this.getRowId({
160
+ data: data
161
+ });
162
+ var node = _this.api.getRowNode(rowId);
163
+ if (node === undefined) {
164
+ return;
165
+ }
166
+ summaryField.forEach(function (field) {
167
+ if (field.summaryType === 2) {
168
+ return;
169
+ }
170
+ var column = _this.columnApi.getColumn(field.id);
171
+ if (column === null) {
172
+ return;
173
+ }
174
+ var colDef = column.getColDef();
175
+ var value = _this.api.getValue(field.id, node);
176
+ if (typeof colDef.valueFormatter === 'function') {
177
+ value = colDef.valueFormatter({
178
+ api: _this.api,
179
+ columnApi: _this.columnApi,
180
+ context: _this.store.getState().context,
181
+ node: node,
182
+ data: data,
183
+ column: column,
184
+ colDef: colDef,
185
+ value: value
186
+ });
187
+ }
188
+ if (summary[field.id] === undefined) {
189
+ summary[field.id] = new BigNumber(0);
190
+ }
191
+ summary[field.id] = summary[field.id].plus(value);
192
+ });
193
+ });
194
+ return summary;
195
+ }));
196
+ _defineProperty(_assertThisInitialized(_this), "init", /*#__PURE__*/function () {
197
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args) {
198
+ var api, columnApi, onGridReady;
199
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
200
+ while (1) switch (_context.prev = _context.next) {
201
+ case 0:
202
+ api = args.api, columnApi = args.columnApi;
203
+ _this.api = api;
204
+ _this.columnApi = columnApi;
205
+ _this.isReady = true;
206
+ _this.clearReadyQueue();
207
+ onGridReady = _this.props.onGridReady;
208
+ if (onGridReady !== undefined) {
209
+ onGridReady(args);
210
+ }
211
+ api.addEventListener('sortChanged', function () {
212
+ if (!_this.isClientMode()) {
213
+ _this.getDataFromServer();
214
+ }
215
+ });
216
+
217
+ // 用于同步selection
218
+ api.addEventListener('rowSelected', function (_ref2) {
219
+ var node = _ref2.node;
220
+ var rowSelection = _this.props.rowSelection;
221
+ if (rowSelection !== undefined && node.id !== undefined && node.data !== undefined && api.getRowNode(node.id) !== undefined) {
222
+ var prevSelected = _this.selected.has(node.id);
223
+ var currSelected = node.isSelected();
224
+ if (currSelected !== prevSelected) {
225
+ if (rowSelection.type === 'radio') {
226
+ _this.selected.clear();
227
+ }
228
+ if (currSelected) {
229
+ _this.selected.set(node.id, node.data);
230
+ } else {
231
+ _this.selected.delete(node.id);
232
+ }
233
+ }
234
+ }
235
+ });
236
+ api.addEventListener('selectionChanged', function () {
237
+ var rowSelection = _this.props.rowSelection;
238
+ if (_this.selected.isDirty() && rowSelection !== undefined && rowSelection.onChange !== undefined) {
239
+ var result = _this.selected.flush();
240
+ rowSelection.onChange(result[0], result[1].filter(Boolean));
241
+ }
242
+ });
243
+ api.addEventListener('paginationChanged', function () {
244
+ if (_this.isClientMode()) {
245
+ _this.setState({
246
+ page: api.paginationGetCurrentPage() + 1
247
+ });
248
+ }
249
+ });
250
+ case 11:
251
+ case "end":
252
+ return _context.stop();
253
+ }
254
+ }, _callee);
255
+ }));
256
+ return function (_x) {
257
+ return _ref.apply(this, arguments);
258
+ };
259
+ }());
260
+ _defineProperty(_assertThisInitialized(_this), "NoRowsOverlay", function () {
261
+ return /*#__PURE__*/React.createElement(EmptyOverlay, {
262
+ desc: _this.props.emptyText
263
+ });
264
+ });
265
+ _defineProperty(_assertThisInitialized(_this), "getRowId", function (params) {
266
+ var rowKey = _this.props.rowKey;
267
+ var result = typeof rowKey === 'function' ? rowKey(params.data) : get(params.data, rowKey);
268
+ return String(result !== null && result !== void 0 ? result : '').toString();
269
+ });
270
+ _defineProperty(_assertThisInitialized(_this), "cellValueChanged", function (evt) {
271
+ var _this$props = _this.props,
272
+ onDataSourceChange = _this$props.onDataSourceChange,
273
+ onCellValueChanged = _this$props.onCellValueChanged;
274
+ if (onCellValueChanged) {
275
+ onCellValueChanged(evt);
276
+ }
277
+ if (onDataSourceChange !== undefined) {
278
+ var _this$searchRef$curre;
279
+ /**
280
+ * 这么做是为了解决可编辑表格直接修改了原始数据的问题
281
+ */
282
+ _this.dataSource = _toConsumableArray(_this.dataSource);
283
+ (_this$searchRef$curre = _this.searchRef.current) === null || _this$searchRef$curre === void 0 || _this$searchRef$curre.reset();
284
+ onDataSourceChange(_this.dataSource, evt);
285
+ }
286
+ });
287
+ _defineProperty(_assertThisInitialized(_this), "rowDataUpdated", function (evt) {
288
+ if (!_this.isReady) {
289
+ return;
290
+ }
291
+ var _this$props2 = _this.props,
292
+ onDataSourceChange = _this$props2.onDataSourceChange,
293
+ onRowDataUpdated = _this$props2.onRowDataUpdated;
294
+ var data = [];
295
+ if (onRowDataUpdated !== undefined) {
296
+ onRowDataUpdated(evt);
297
+ }
298
+ _this.api.forEachNode(function (rowNode) {
299
+ if (rowNode.data !== undefined) {
300
+ data.push(rowNode.data);
301
+ }
302
+ });
303
+ if (_this.isClientMode()) {
304
+ var _this$state = _this.state,
305
+ page = _this$state.page,
306
+ pageSize = _this$state.pageSize;
307
+ var totalPages = Math.ceil(data.length / pageSize) || 1;
308
+ var newPage = page > totalPages ? totalPages : page;
309
+ if (newPage !== page) {
310
+ _this.api.paginationGoToPage(newPage - 1);
311
+ }
312
+ _this.setState({
313
+ total: data.length
314
+ });
315
+ }
316
+
317
+ /**
318
+ * 浅比较是为了防止通过设置props.dataSource触发onDataSourceChange
319
+ */
320
+ if (!shallowEqual(data, _this.dataSource)) {
321
+ _this.dataSource = data;
322
+ if (onDataSourceChange !== undefined) {
323
+ var _this$searchRef$curre2;
324
+ (_this$searchRef$curre2 = _this.searchRef.current) === null || _this$searchRef$curre2 === void 0 || _this$searchRef$curre2.reset();
325
+ onDataSourceChange(data, evt);
326
+ }
327
+ }
328
+ });
329
+ _defineProperty(_assertThisInitialized(_this), "cellEditingStop", function (evt) {
330
+ var onCellEditingStopped = _this.props.onCellEditingStopped;
331
+ var data = evt.data;
332
+ _this.validateRecord(data);
333
+ onCellEditingStopped === null || onCellEditingStopped === void 0 || onCellEditingStopped(evt);
334
+ });
335
+ /**
336
+ * 自行实现stopEditingWhenCellsLoseFocus的效果
337
+ * 由于AgGrid使用的是原生的focusout事件不是React的合成事件,导致单元格内使用Modal这样的组件会有诸多不便,所以自行实现这个效果
338
+ */
339
+ _defineProperty(_assertThisInitialized(_this), "blurTimer", null);
340
+ _defineProperty(_assertThisInitialized(_this), "handleBlur", function () {
341
+ if (_this.props.stopEditingWhenCellsLoseFocus) {
342
+ _this.blurTimer = setTimeout(function () {
343
+ if (_this.isReady) {
344
+ _this.api.clearFocusedCell();
345
+ }
346
+ _this.blurTimer = null;
347
+ }, 4);
348
+ }
349
+ });
350
+ _defineProperty(_assertThisInitialized(_this), "handleFocus", function () {
351
+ if (_this.blurTimer !== null) {
352
+ clearTimeout(_this.blurTimer);
353
+ }
354
+ });
355
+ _defineProperty(_assertThisInitialized(_this), "handleClearSelected", function () {
356
+ _this.selected.clear();
357
+ _this.api.getSelectedNodes().forEach(function (node) {
358
+ node.setSelected(false, false, true);
359
+ });
360
+ _this.api.dispatchEvent({
361
+ type: 'selectionChanged'
362
+ });
363
+ });
364
+ _defineProperty(_assertThisInitialized(_this), "getMemoizedDefaultColDef", memoizeOne(function (defaultColDefProp) {
365
+ return _objectSpread(_objectSpread({
366
+ comparator: _this.isClientMode() ? undefined : unsort
367
+ }, defaultColDef), defaultColDefProp);
368
+ }, function (next, prev) {
369
+ return shallowEqual(prev[0], next[0]);
370
+ }));
371
+ _defineProperty(_assertThisInitialized(_this), "getMemoizedColumnTypes", memoizeOne(function (columnTypesProp) {
372
+ return _objectSpread(_objectSpread({}, columnTypes), columnTypesProp);
373
+ }));
374
+ _defineProperty(_assertThisInitialized(_this), "getMemoizedComponents", memoizeOne(function (componentsProp) {
375
+ return _objectSpread(_objectSpread({}, defaultComponents), componentsProp);
376
+ }, function (next, prev) {
377
+ return shallowEqual(prev[0], next[0]);
378
+ }));
379
+ _defineProperty(_assertThisInitialized(_this), "getMemoizedDetailCellParams", memoizeOne(function (detailCell, params, autoHeight) {
380
+ if (detailCell === undefined) {
381
+ return params;
382
+ }
383
+ return {
384
+ masterDetail: true,
385
+ detailCellRenderer: DetailCellRenderer,
386
+ detailCellRendererParams: _objectSpread(_objectSpread(_objectSpread({}, params), detailCell.params), {}, {
387
+ autoHeight: autoHeight,
388
+ render: detailCell.render
389
+ })
390
+ };
391
+ }));
392
+ _defineProperty(_assertThisInitialized(_this), "getRowStyle", function (params) {
393
+ var getRowStyle = _this.props.getRowStyle;
394
+ var style = getRowStyle === null || getRowStyle === void 0 ? void 0 : getRowStyle(params);
395
+ if (params.node.rowPinned === 'bottom') {
396
+ return _objectSpread({
397
+ fontWeight: 'bold'
398
+ }, style);
399
+ }
400
+ return style;
401
+ });
402
+ _defineProperty(_assertThisInitialized(_this), "cellFocused", function (evt) {
403
+ var rowIndex = evt.rowIndex,
404
+ rowPinned = evt.rowPinned,
405
+ column = evt.column,
406
+ api = evt.api;
407
+ var onCellFocused = _this.props.onCellFocused;
408
+ onCellFocused === null || onCellFocused === void 0 || onCellFocused(evt);
409
+ if (rowIndex === null || column === null || rowPinned) {
410
+ _this.prevFocusedCell = null;
411
+ return;
412
+ }
413
+ var node = api.getModel().getRow(rowIndex);
414
+ if (node === undefined || !node.id) {
415
+ _this.prevFocusedCell = null;
416
+ return;
417
+ }
418
+ _this.prevFocusedCell = {
419
+ row: node.id,
420
+ column: typeof column === 'string' ? column : column.getColId()
421
+ };
422
+ });
423
+ _this.state = _objectSpread({
424
+ loading: false
425
+ }, _this.getPagination());
426
+ _this.store = new Store({
427
+ errors: new Map(),
428
+ context: props.context,
429
+ grid: _assertThisInitialized(_this)
430
+ });
431
+ var _props$rowSelection = props.rowSelection,
432
+ _props$rowSelection2 = _props$rowSelection === void 0 ? {} : _props$rowSelection,
433
+ _props$rowSelection2$ = _props$rowSelection2.selectedRowKeys,
434
+ selectedRowKeys = _props$rowSelection2$ === void 0 ? [] : _props$rowSelection2$;
435
+ _this.selected = new Selection(selectedRowKeys);
436
+ _this.syncColRender();
437
+ return _this;
438
+ }
439
+ _createClass(DataGrid, [{
440
+ key: "setField",
441
+ value: function setField(field) {
442
+ var newFields = _toConsumableArray(this.fields);
443
+ var idx = this.fields.findIndex(function (item) {
444
+ return item.id === field.id;
445
+ });
446
+ if (idx >= 0) {
447
+ newFields[idx] = field;
448
+ } else {
449
+ newFields.push(field);
450
+ }
451
+ this.fields = newFields;
452
+ this.updateColumnDefs(this.columnApi.getColumnState());
453
+ }
454
+ }, {
455
+ key: "getField",
456
+ value: function getField(id) {
457
+ return this.fields.find(function (item) {
458
+ return item.id === id;
459
+ });
460
+ }
461
+ }, {
462
+ key: "getFields",
463
+ value: function getFields() {
464
+ return this.fields;
465
+ }
466
+ }, {
467
+ key: "deleteField",
468
+ value: function deleteField(id) {
469
+ var idx = this.fields.findIndex(function (item) {
470
+ return item.id === id;
471
+ });
472
+ if (idx >= 0) {
473
+ this.fields.splice(idx, 1);
474
+ this.updateColumnDefs(this.columnApi.getColumnState());
475
+ }
476
+ }
477
+ }, {
478
+ key: "saveFields",
479
+ value: function () {
480
+ var _saveFields = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
481
+ var customColumnPanelStorage;
482
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
483
+ while (1) switch (_context2.prev = _context2.next) {
484
+ case 0:
485
+ customColumnPanelStorage = this.props.customColumnPanelStorage;
486
+ if (!customColumnPanelStorage) {
487
+ _context2.next = 4;
488
+ break;
489
+ }
490
+ _context2.next = 4;
491
+ return customColumnPanelStorage.set({
492
+ fields: this.fields,
493
+ columState: this.columnApi.getColumnState()
494
+ });
495
+ case 4:
496
+ case "end":
497
+ return _context2.stop();
498
+ }
499
+ }, _callee2, this);
500
+ }));
501
+ function saveFields() {
502
+ return _saveFields.apply(this, arguments);
503
+ }
504
+ return saveFields;
505
+ }()
506
+ }, {
507
+ key: "resetFields",
508
+ value: function resetFields() {
509
+ this.fields = [];
510
+ var _this$getColumnDefs = this.getColumnDefs(),
511
+ _this$getColumnDefs2 = _slicedToArray(_this$getColumnDefs, 1),
512
+ defs = _this$getColumnDefs2[0];
513
+ this.api.setColumnDefs([]);
514
+ this.api.setColumnDefs(defs);
515
+ }
516
+ }, {
517
+ key: "getPagination",
518
+ value: function getPagination() {
519
+ var _this$props3 = this.props,
520
+ pagination = _this$props3.pagination,
521
+ fetch = _this$props3.fetch;
522
+ var page = 1;
523
+ var pageSize = 50;
524
+ var total = 0;
525
+ var enable = false;
526
+ if (_typeof(pagination) === 'object') {
527
+ enable = true;
528
+ pageSize = pagination.defaultPageSize || pagination.pageSize || 20;
529
+ page = pagination.defaultCurrent || pagination.current || 1;
530
+ total = pagination.total || 0;
531
+ } else if (pagination === true) {
532
+ enable = true;
533
+ } else if (pagination === false) {
534
+ enable = false;
535
+ total = Number.MAX_SAFE_INTEGER;
536
+ pageSize = Number.MAX_SAFE_INTEGER;
537
+ } else if (fetch !== undefined) {
538
+ enable = true;
539
+ }
540
+ return {
541
+ pagination: enable,
542
+ page: page,
543
+ pageSize: pageSize,
544
+ total: total
545
+ };
546
+ }
547
+ }, {
548
+ key: "componentDidUpdate",
549
+ value: function componentDidUpdate(prevProps) {
550
+ var _this2 = this,
551
+ _prevProps$rowSelecti;
552
+ var _this$props4 = this.props,
553
+ columns = _this$props4.columns,
554
+ rowSelection = _this$props4.rowSelection,
555
+ dataSource = _this$props4.dataSource,
556
+ context = _this$props4.context;
557
+ if (columns !== prevProps.columns) {
558
+ this.syncColRender();
559
+ this.afterReady(function () {
560
+ _this2.updateColumnDefs(_this2.columnApi.getColumnState());
561
+ if (_this2.fields.length > 0) {
562
+ _this2.api.refreshCells({
563
+ columns: _this2.fields.map(function (item) {
564
+ return item.id;
565
+ })
566
+ });
567
+ }
568
+ });
569
+ }
570
+ if ((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) !== ((_prevProps$rowSelecti = prevProps.rowSelection) === null || _prevProps$rowSelecti === void 0 ? void 0 : _prevProps$rowSelecti.selectedRowKeys)) {
571
+ this.syncSelection();
572
+ }
573
+ if (dataSource !== prevProps.dataSource) {
574
+ this.syncRowData();
575
+ }
576
+ if (!shallowEqual(context, prevProps.context)) {
577
+ this.store.setState({
578
+ context: context
579
+ });
580
+ }
581
+ }
582
+ }, {
583
+ key: "componentWillUnmount",
584
+ value: function componentWillUnmount() {
585
+ this.isReady = false;
586
+ window.removeEventListener('blur', this.handleFocus);
587
+ }
588
+ }, {
589
+ key: "componentDidMount",
590
+ value: function () {
591
+ var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
592
+ var _this$props5, customColumnPanelStorage, autoLoad, state, data;
593
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
594
+ while (1) switch (_context3.prev = _context3.next) {
595
+ case 0:
596
+ window.addEventListener('blur', this.handleFocus);
597
+
598
+ /** 加载定制列数据如果接口很慢的话,可能会存在列更新的时序问题,尝试过阻塞其他操作,但在明细页面依旧会出现2个加载动画的情况。未来尝试解决 */
599
+ _this$props5 = this.props, customColumnPanelStorage = _this$props5.customColumnPanelStorage, autoLoad = _this$props5.autoLoad;
600
+ if (!customColumnPanelStorage) {
601
+ _context3.next = 16;
602
+ break;
603
+ }
604
+ _context3.prev = 3;
605
+ _context3.next = 6;
606
+ return customColumnPanelStorage.get();
607
+ case 6:
608
+ data = _context3.sent;
609
+ if (data) {
610
+ this.fields = data.fields;
611
+ state = data.columState;
612
+ }
613
+ _context3.next = 13;
614
+ break;
615
+ case 10:
616
+ _context3.prev = 10;
617
+ _context3.t0 = _context3["catch"](3);
618
+ console.log('获取列定制失败', _context3.t0.message);
619
+ case 13:
620
+ this.updateColumnDefs(state, true);
621
+ _context3.next = 17;
622
+ break;
623
+ case 16:
624
+ this.updateColumnDefs();
625
+ case 17:
626
+ if (this.isClientMode()) {
627
+ this.syncRowData();
628
+ } else if (autoLoad) {
629
+ this.getDataFromServer();
630
+ }
631
+ case 18:
632
+ case "end":
633
+ return _context3.stop();
634
+ }
635
+ }, _callee3, this, [[3, 10]]);
636
+ }));
637
+ function componentDidMount() {
638
+ return _componentDidMount.apply(this, arguments);
639
+ }
640
+ return componentDidMount;
641
+ }()
642
+ }, {
643
+ key: "syncColRender",
644
+ value: function syncColRender() {
645
+ var _this$props$columns = this.props.columns,
646
+ columns = _this$props$columns === void 0 ? [] : _this$props$columns;
647
+ var descriptor = Object.create(null);
648
+ var traverse = function traverse(cols) {
649
+ cols.forEach(function (item) {
650
+ var rules = get(item, ['editable', 'rules']);
651
+ if (rules !== undefined) {
652
+ var id = getColField(item);
653
+ if (id !== undefined) {
654
+ var path = id.split('.');
655
+ var node = {};
656
+ for (var i = path.length - 1; i >= 0; i -= 1) {
657
+ node = _defineProperty({}, path[i], i === path.length - 1 ? rules.map(function (rule) {
658
+ var validator = rule.validator,
659
+ restRule = _objectWithoutProperties(rule, _excluded);
660
+ return _objectSpread(_objectSpread({}, restRule), {}, {
661
+ asyncValidator: validator ? function (mRule, value, _, record) {
662
+ return validator(mRule, value, record);
663
+ } : undefined,
664
+ validator: undefined
665
+ });
666
+ }) : {
667
+ type: 'object',
668
+ fields: node
669
+ });
670
+ }
671
+ Object.assign(descriptor, node);
672
+ }
673
+ }
674
+ if (!isColumn(item)) {
675
+ traverse(item.children);
676
+ }
677
+ });
678
+ };
679
+ traverse(columns);
680
+ if (Object.keys(descriptor).length > 0) {
681
+ this.validator = new Scheme(descriptor);
682
+ } else {
683
+ this.validator = null;
684
+ }
685
+ }
686
+ }, {
687
+ key: "syncSelection",
688
+ value: function syncSelection() {
689
+ var _this3 = this;
690
+ this.afterReady(function () {
691
+ var _this3$props$rowSelec = _this3.props.rowSelection,
692
+ _this3$props$rowSelec2 = _this3$props$rowSelec === void 0 ? {} : _this3$props$rowSelec,
693
+ selectedRowKeys = _this3$props$rowSelec2.selectedRowKeys;
694
+ if (selectedRowKeys !== undefined && !_this3.selected.isSameKeys(selectedRowKeys)) {
695
+ var newSelected = new Map();
696
+ _this3.selected.forEach(function (id) {
697
+ var node = _this3.api.getRowNode(id);
698
+ if (node !== undefined) {
699
+ node.setSelected(false, false, true);
700
+ }
701
+ });
702
+ selectedRowKeys.forEach(function (id) {
703
+ var node = _this3.api.getRowNode(id);
704
+ var data;
705
+ if (node !== undefined) {
706
+ node.setSelected(true, false, true);
707
+ data = node.data;
708
+ }
709
+ newSelected.set(id, data || _this3.selected.get(id) || null);
710
+ });
711
+ _this3.selected.clone(newSelected);
712
+ _this3.api.dispatchEvent({
713
+ type: 'selectionChanged'
714
+ });
715
+ }
716
+ });
717
+ }
718
+ }, {
719
+ key: "syncRowData",
720
+ value: function syncRowData() {
721
+ var dataSource = this.props.dataSource;
722
+ if (dataSource !== undefined && dataSource !== this.dataSource) {
723
+ this.updateRowData(dataSource);
724
+ }
725
+ }
726
+ }, {
727
+ key: "updateColumnDefs",
728
+ value: function updateColumnDefs(state) {
729
+ var _this4 = this;
730
+ var allState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
731
+ this.afterReady(function () {
732
+ var _this4$getColumnDefs = _this4.getColumnDefs(),
733
+ _this4$getColumnDefs2 = _slicedToArray(_this4$getColumnDefs, 2),
734
+ defs = _this4$getColumnDefs2[0],
735
+ leafColIds = _this4$getColumnDefs2[1];
736
+ _this4.api.setColumnDefs(defs);
737
+ if (state) {
738
+ /**
739
+ * 表格初始化列抖动问题:先调用setColumnDefs,后applyColumnState,会产生列移动动画,所以先禁用列移动的动画
740
+ */
741
+ _this4.api.__setProperty('suppressColumnMoveAnimation', true);
742
+ var newState = _toConsumableArray(state);
743
+ leafColIds.forEach(function (colId, index) {
744
+ if (!colId) {
745
+ return;
746
+ }
747
+ var idx = state.findIndex(function (item) {
748
+ return item.colId === colId;
749
+ });
750
+ if (idx < 0) {
751
+ newState.splice(index, 0, {
752
+ colId: colId
753
+ });
754
+ }
755
+ });
756
+
757
+ /**
758
+ * 初始化的时候,需要使用存储的columnState,不仅仅是顺序,其他情况由于在defs里已经有列的状态控制了
759
+ */
760
+ _this4.columnApi.applyColumnState({
761
+ state: allState ? newState : newState.map(function (item) {
762
+ return {
763
+ colId: item.colId
764
+ };
765
+ }),
766
+ applyOrder: true
767
+ });
768
+ _this4.api.__setProperty('suppressColumnMoveAnimation', !!_this4.props.suppressColumnMoveAnimation);
769
+ }
770
+ });
771
+ }
772
+ }, {
773
+ key: "getFullColumnDef",
774
+ value: function getFullColumnDef(col) {
775
+ if (col.type === undefined) {
776
+ return _objectSpread({}, col);
777
+ }
778
+ var _this$props6 = this.props,
779
+ mColumnTypes = _this$props6.columnTypes,
780
+ mDefaultColDef = _this$props6.defaultColDef;
781
+ var colTypes = this.getMemoizedColumnTypes(mColumnTypes);
782
+ var result = {};
783
+ var types;
784
+ if (typeof col.type === 'string') {
785
+ types = [col.type];
786
+ } else {
787
+ types = col.type;
788
+ }
789
+ types.forEach(function (type) {
790
+ var colType = colTypes[type];
791
+ if (colType !== undefined) {
792
+ Object.assign(result, colType);
793
+ }
794
+ });
795
+ Object.assign(result, mDefaultColDef);
796
+ return _objectSpread(_objectSpread({}, result), col);
797
+ }
798
+ }, {
799
+ key: "getColumnDefs",
800
+ value: function getColumnDefs() {
801
+ var _this5 = this,
802
+ _this$props$customCol;
803
+ var _this$props7 = this.props,
804
+ _this$props7$columns = _this$props7.columns,
805
+ columns = _this$props7$columns === void 0 ? [] : _this$props7$columns,
806
+ rowActions = _this$props7.rowActions,
807
+ rowSelection = _this$props7.rowSelection;
808
+ var leafColIds = [];
809
+ var map = function map(cols) {
810
+ return cols.map(function (item) {
811
+ if (isColumn(item)) {
812
+ var title = item.title,
813
+ dataIndex = item.dataIndex,
814
+ render = item.render,
815
+ _item$ellipsis = item.ellipsis,
816
+ ellipsis = _item$ellipsis === void 0 ? true : _item$ellipsis,
817
+ sorter = item.sorter,
818
+ editable = item.editable,
819
+ className = item.className,
820
+ colDef = _objectWithoutProperties(item, _excluded2);
821
+ var opts = colDef;
822
+ var field = getColField(item);
823
+ if (field !== undefined) {
824
+ opts.field = getColField(item);
825
+ }
826
+ var def = _this5.getFullColumnDef(opts);
827
+
828
+ /** 部分列由于使用type 可能存在colId以及field都不存在, maintainColumnOrder下updateColumnDefs有问题,故从merge后的def中提取field或者colId */
829
+ opts.colId = def.colId || def.field;
830
+
831
+ // className
832
+ if (className) {
833
+ opts.cellClass = className;
834
+ }
835
+
836
+ // title
837
+ if (_typeof(title) === 'object' || typeof title === 'function') {
838
+ opts.headerComponentParams = _objectSpread(_objectSpread({}, opts.headerComponentParams), {}, {
839
+ title: title
840
+ });
841
+ } else if (title !== undefined) {
842
+ opts.headerName = title.toString();
843
+ }
844
+
845
+ // render
846
+ if (render !== undefined) {
847
+ opts.cellRenderer = CellRenderer;
848
+ opts.cellRendererParams = _objectSpread(_objectSpread({}, opts.cellRendererParams), {}, {
849
+ render: render
850
+ });
851
+ }
852
+
853
+ // ellipsis
854
+ if (ellipsis === false) {
855
+ opts.wrapText = true;
856
+ opts.autoHeight = true;
857
+ }
858
+
859
+ // sortable
860
+ if (sorter !== undefined) {
861
+ if (typeof sorter === 'function') {
862
+ opts.sortable = true;
863
+ opts.comparator = function (valA, valB, nodeA, nodeB) {
864
+ return sorter(nodeA.data, nodeB.data);
865
+ };
866
+ } else {
867
+ opts.sortable = sorter;
868
+ }
869
+ }
870
+
871
+ // editable
872
+ if (_typeof(editable) === 'object') {
873
+ var renderer = editable.renderer,
874
+ valueSetter = editable.valueSetter,
875
+ enable = editable.enable;
876
+ opts.editable = function (mParams) {
877
+ if (DataGrid.isSummaryRow({
878
+ node: mParams.node
879
+ })) {
880
+ return false;
881
+ }
882
+ if (enable !== undefined) {
883
+ return enable(mParams);
884
+ }
885
+ return true;
886
+ };
887
+ opts.cellClassRules = _objectSpread(_objectSpread({}, opts.cellClassRules), {}, _defineProperty({}, prefix('editor-cell'), function (mParams) {
888
+ if (mParams.node.isRowPinned()) {
889
+ return false;
890
+ }
891
+ if (enable !== undefined) {
892
+ return enable(mParams);
893
+ }
894
+ return true;
895
+ }));
896
+
897
+ /** 由于ag-grid注册事件使用的是js原生事件,不在React事件流内,会产生很多问题,所以默认关闭所有Enter导致关闭编辑,由组件内部自行实现回车 */
898
+ opts.suppressKeyboardEvent = function (keyParmas) {
899
+ if (item.suppressKeyboardEvent !== undefined && item.suppressKeyboardEvent(keyParmas)) {
900
+ return true;
901
+ }
902
+ if (keyParmas.editing && keyParmas.event.key === 'Enter') {
903
+ return true;
904
+ }
905
+ return false;
906
+ };
907
+ opts.cellRenderer = CellRenderer;
908
+ if (def.cellRenderer && render === undefined) {
909
+ opts.cellRendererParams = _objectSpread(_objectSpread({}, opts.cellRendererParams), {}, {
910
+ render: function render(val, idx, data, params) {
911
+ return def.cellRenderer(params);
912
+ }
913
+ });
914
+ }
915
+ opts.valueSetter = function (mParams) {
916
+ var colField = mParams.colDef.field,
917
+ data = mParams.data,
918
+ newValue = mParams.newValue,
919
+ oldValue = mParams.oldValue;
920
+ if (!colField || newValue === oldValue) {
921
+ return false;
922
+ }
923
+ if (valueSetter !== undefined) {
924
+ var _result = valueSetter(newValue, data);
925
+ set(data, colField, newValue);
926
+ Object.assign(data, _result);
927
+ } else if (newValue instanceof RowEditorData) {
928
+ Object.assign(data, newValue.getValue());
929
+ } else {
930
+ set(data, colField, newValue);
931
+ }
932
+ return true;
933
+ };
934
+ if (typeof renderer === 'function') {
935
+ opts.cellEditorSelector = function (editorParams) {
936
+ var result = renderer(editorParams);
937
+ return {
938
+ component: result.component || result.type,
939
+ params: result.params
940
+ };
941
+ };
942
+ } else {
943
+ opts.cellEditor = renderer.component || renderer.type;
944
+ opts.cellEditorParams = renderer.params;
945
+ }
946
+ } else {
947
+ opts.editable = editable;
948
+ }
949
+ leafColIds.push(opts.colId);
950
+ return opts;
951
+ } else {
952
+ var _title = item.title,
953
+ _item$children = item.children,
954
+ children = _item$children === void 0 ? [] : _item$children,
955
+ rest = _objectWithoutProperties(item, _excluded3);
956
+ var _opts = {
957
+ children: map(children)
958
+ };
959
+ if (_typeof(_title) === 'object' || typeof _title === 'function') {
960
+ _opts.headerGroupComponentParams = _objectSpread(_objectSpread({}, _opts.headerGroupComponentParams), {}, {
961
+ title: _title
962
+ });
963
+ _opts.headerGroupComponent = HeaderRenderer;
964
+ } else if (_title !== undefined) {
965
+ _opts.headerName = _title.toString();
966
+ }
967
+ return _objectSpread(_objectSpread({}, _opts), rest);
968
+ }
969
+ });
970
+ };
971
+ var result = map(columns);
972
+ var suppressFieldValueGetter = !!((_this$props$customCol = this.props.customColumnPanelStorage) !== null && _this$props$customCol !== void 0 && _this$props$customCol.suppressFieldValueGetter);
973
+ this.fields.forEach(function (field) {
974
+ leafColIds.push(field.id);
975
+ var fieldCol = {
976
+ colId: field.id,
977
+ headerName: field.name,
978
+ spanHeaderHeight: true,
979
+ sortable: false,
980
+ type: 'rightAligned'
981
+ };
982
+ if (suppressFieldValueGetter) {
983
+ fieldCol.field = field.id;
984
+ } else {
985
+ /**
986
+ * 预校验是否可以进行四则运算,可能会有边界情况没考虑到
987
+ */
988
+ var scopeMap = {};
989
+ var reg = /\$\{([^{}]+)\}/g;
990
+ var expression = field.expression.replace(reg, function (match, p1) {
991
+ if (p1) {
992
+ var mapKey = "a".concat(Object.keys(scopeMap).length);
993
+ scopeMap[mapKey] = p1;
994
+ return mapKey;
995
+ }
996
+ return match;
997
+ });
998
+ var code = null;
999
+ try {
1000
+ var mCode = Parser.parse(expression);
1001
+
1002
+ // https://github.com/silentmatt/expr-eval/issues/121
1003
+ // @ts-ignore
1004
+ Object.assign(mCode.binaryOps, {
1005
+ '+': add,
1006
+ '-': subtract,
1007
+ '/': divide,
1008
+ '*': multiply
1009
+ });
1010
+ mCode.evaluate(Object.fromEntries(Object.entries(scopeMap).map(function (_ref3) {
1011
+ var _ref4 = _slicedToArray(_ref3, 1),
1012
+ k = _ref4[0];
1013
+ return [k, 1];
1014
+ })));
1015
+ code = mCode;
1016
+ } catch (err) {
1017
+ console.log('pre check mathmatic expression failed:', err.message);
1018
+ }
1019
+ fieldCol.valueGetter = function (params) {
1020
+ var api = params.api,
1021
+ node = params.node,
1022
+ columnApi = params.columnApi;
1023
+ if (node !== null && node.data !== undefined) {
1024
+ if (DataGrid.isSummaryRow({
1025
+ node: node
1026
+ }) && field.summaryType === 1) {
1027
+ var summary = _this5.getFieldsSummary(_this5.dataSource, _this5.fields);
1028
+ return get(summary, field.id);
1029
+ }
1030
+ var getValue = function getValue(colId) {
1031
+ var col = columnApi.getColumn(colId);
1032
+ if (col === null) {
1033
+ return null;
1034
+ }
1035
+ var colDef = col.getColDef();
1036
+ var value = api.getValue(colId, node);
1037
+ if (typeof colDef.valueFormatter === 'function') {
1038
+ value = colDef.valueFormatter(_objectSpread(_objectSpread({}, params), {}, {
1039
+ column: col,
1040
+ colDef: colDef,
1041
+ value: value
1042
+ }));
1043
+ }
1044
+ return value;
1045
+ };
1046
+ if (code) {
1047
+ try {
1048
+ var scope = Object.fromEntries(Object.entries(scopeMap).map(function (_ref5) {
1049
+ var _getValue;
1050
+ var _ref6 = _slicedToArray(_ref5, 1),
1051
+ k = _ref6[0];
1052
+ return [k, (_getValue = getValue(scopeMap[k])) !== null && _getValue !== void 0 ? _getValue : ''];
1053
+ }));
1054
+ return code.evaluate(scope);
1055
+ } catch (err) {
1056
+ console.warn('DataGrid field evaluate', err);
1057
+ return null;
1058
+ }
1059
+ } else {
1060
+ return field.expression.replace(reg, function (match, p1) {
1061
+ if (p1) {
1062
+ return getValue(p1) || '';
1063
+ }
1064
+ return match;
1065
+ });
1066
+ }
1067
+ }
1068
+ return null;
1069
+ };
1070
+ fieldCol.valueFormatter = function (params) {
1071
+ if (Number.isNaN(params.value) || !Number.isFinite(params.value) || BigNumber.isBigNumber(params.value) && (params.value.isNaN() || !params.value.isFinite())) {
1072
+ return '-';
1073
+ }
1074
+ return params.value;
1075
+ };
1076
+ }
1077
+ result.push(fieldCol);
1078
+ });
1079
+ if (rowSelection !== undefined) {
1080
+ var checkboxSelection = rowSelection.checkboxSelection;
1081
+ if (checkboxSelection === undefined) {
1082
+ checkboxSelection = rowSelection.type !== 'radio' ? true : false;
1083
+ }
1084
+ if (checkboxSelection) {
1085
+ var _rowSelection$fixed;
1086
+ leafColIds.unshift('$$selection');
1087
+ result.unshift({
1088
+ width: 32,
1089
+ colId: '$$selection',
1090
+ checkboxSelection: checkboxSelection,
1091
+ showDisabledCheckboxes: true,
1092
+ headerCheckboxSelection: rowSelection.type !== 'radio',
1093
+ spanHeaderHeight: true,
1094
+ sortable: false,
1095
+ suppressAutoSize: true,
1096
+ suppressMovable: true,
1097
+ suppressMenu: true,
1098
+ lockPinned: true,
1099
+ lockVisible: true,
1100
+ suppressColumnsToolPanel: true,
1101
+ cellClass: prefix('cell-selection'),
1102
+ headerClass: prefix('cell-selection'),
1103
+ pinned: (_rowSelection$fixed = rowSelection.fixed) !== null && _rowSelection$fixed !== void 0 ? _rowSelection$fixed : 'left'
1104
+ });
1105
+ }
1106
+ }
1107
+ if (rowActions !== undefined) {
1108
+ leafColIds.push('$$actions');
1109
+ result.push(_objectSpread({
1110
+ colId: '$$actions',
1111
+ pinned: 'right',
1112
+ headerName: '操作',
1113
+ sortable: false,
1114
+ suppressAutoSize: true,
1115
+ suppressMovable: true,
1116
+ suppressColumnsToolPanel: true,
1117
+ lockPinned: true,
1118
+ lockVisible: true,
1119
+ initialWidth: 160,
1120
+ cellClass: prefix('operator-cell'),
1121
+ cellRenderer: ActionsRenderer
1122
+ }, this.props.rowActionsColDef));
1123
+ }
1124
+ return [result, leafColIds];
1125
+ }
1126
+ }, {
1127
+ key: "isClientMode",
1128
+ value: function isClientMode() {
1129
+ return this.props.fetch === undefined;
1130
+ }
1131
+ }, {
1132
+ key: "clearReadyQueue",
1133
+ value: function clearReadyQueue() {
1134
+ this.readyQueue.forEach(function (cb) {
1135
+ cb();
1136
+ });
1137
+ this.readyQueue = [];
1138
+ }
1139
+ }, {
1140
+ key: "afterReady",
1141
+ value: function afterReady(cb) {
1142
+ if (this.isReady) {
1143
+ cb();
1144
+ } else {
1145
+ this.readyQueue.push(cb);
1146
+ }
1147
+ }
1148
+ }, {
1149
+ key: "isPreserveSelected",
1150
+ value: function isPreserveSelected() {
1151
+ var rowSelection = this.props.rowSelection;
1152
+ if (rowSelection === undefined) {
1153
+ return false;
1154
+ }
1155
+ return !!rowSelection.preserveSelectedRowKeys;
1156
+ }
1157
+ }, {
1158
+ key: "updateRowData",
1159
+ value: function updateRowData() {
1160
+ var _this6 = this;
1161
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1162
+ this.afterReady(function () {
1163
+ _this6.dataSource = data;
1164
+ _this6.api.setRowData(data);
1165
+ if (_this6.isPreserveSelected()) {
1166
+ _this6.api.forEachNode(function (node) {
1167
+ if (node.id && _this6.selected.has(node.id)) {
1168
+ var rowData = _this6.selected.get(node.id);
1169
+ if (node.data !== undefined && rowData !== node.data) {
1170
+ _this6.selected.set(node.id, node.data);
1171
+ }
1172
+ if (!node.isSelected()) {
1173
+ node.setSelected(true, false, true);
1174
+ }
1175
+ }
1176
+ });
1177
+ } else {
1178
+ var keys = new Map(data.map(function (item) {
1179
+ return [_this6.getRowId({
1180
+ data: item
1181
+ }), item];
1182
+ }));
1183
+ _this6.selected.forEach(function (id) {
1184
+ if (!keys.has(id)) {
1185
+ _this6.selected.delete(id);
1186
+ } else {
1187
+ var node = _this6.api.getRowNode(id);
1188
+ if (node !== undefined) {
1189
+ if (node.data !== undefined && _this6.selected.get(id) !== node.data) {
1190
+ _this6.selected.set(id, node.data);
1191
+ }
1192
+ if (!node.isSelected()) {
1193
+ node.setSelected(true, false, true);
1194
+ }
1195
+ }
1196
+ }
1197
+ });
1198
+ }
1199
+ if (_this6.selected.isDirty()) {
1200
+ _this6.api.dispatchEvent({
1201
+ type: 'selectionChanged'
1202
+ });
1203
+ }
1204
+ });
1205
+ }
1206
+ }, {
1207
+ key: "getSummaryRowData",
1208
+ value: function getSummaryRowData() {
1209
+ var result = [];
1210
+ for (var _len = arguments.length, summaries = new Array(_len), _key = 0; _key < _len; _key++) {
1211
+ summaries[_key] = arguments[_key];
1212
+ }
1213
+ summaries.forEach(function (summary) {
1214
+ if (Array.isArray(summary)) {
1215
+ result.push.apply(result, _toConsumableArray(summary));
1216
+ } else if (summary) {
1217
+ result.push(summary);
1218
+ }
1219
+ });
1220
+ if (result.length <= 0) {
1221
+ return;
1222
+ }
1223
+ return result.map(function (item) {
1224
+ return _objectSpread(_objectSpread({}, item), {}, _defineProperty({}, DataGrid.SummaryFlag, true));
1225
+ });
1226
+ }
1227
+ }, {
1228
+ key: "getDataFromServer",
1229
+ value: function getDataFromServer() {
1230
+ var _this7 = this;
1231
+ this.afterReady(function () {
1232
+ var _this7$props = _this7.props,
1233
+ fetch = _this7$props.fetch,
1234
+ onLoading = _this7$props.onLoading,
1235
+ onLoad = _this7$props.onLoad;
1236
+ var loadingChange = function loadingChange(flag) {
1237
+ if (onLoading) {
1238
+ onLoading(flag);
1239
+ } else {
1240
+ _this7.setState({
1241
+ loading: flag
1242
+ });
1243
+ }
1244
+ };
1245
+ if (typeof fetch === 'function') {
1246
+ if (_this7.requestId < Number.MAX_SAFE_INTEGER) {
1247
+ _this7.requestId += 1;
1248
+ }
1249
+ var _this7$state = _this7.state,
1250
+ page = _this7$state.page,
1251
+ pageSize = _this7$state.pageSize;
1252
+ var columnState = _this7.columnApi.getColumnState();
1253
+ var id = _this7.requestId;
1254
+ loadingChange(true);
1255
+ fetch({
1256
+ current: page,
1257
+ pageSize: pageSize,
1258
+ sort: columnState.filter(function (item) {
1259
+ return item.sort !== undefined && item.sort !== null;
1260
+ }).map(function (item) {
1261
+ return {
1262
+ field: item.colId,
1263
+ order: item.sort
1264
+ };
1265
+ })
1266
+ }).then(function (res) {
1267
+ if (id !== _this7.requestId) {
1268
+ return;
1269
+ }
1270
+ loadingChange(false);
1271
+ if (res.total !== undefined) {
1272
+ _this7.setState({
1273
+ page: page,
1274
+ pageSize: pageSize,
1275
+ total: res.total
1276
+ });
1277
+ }
1278
+ var summary = _this7.props.summary;
1279
+ _this7.updateRowData(res.data);
1280
+ _this7.api.setPinnedBottomRowData(_this7.getSummaryRowData(summary, res.summary));
1281
+ if (res.data.length > 0) {
1282
+ _this7.api.ensureIndexVisible(0);
1283
+ }
1284
+ if (onLoad) {
1285
+ onLoad(res.extra);
1286
+ }
1287
+ _this7.store.setState({
1288
+ fetchError: undefined
1289
+ });
1290
+ }).catch(function (err) {
1291
+ _this7.store.setState({
1292
+ fetchError: err
1293
+ });
1294
+ loadingChange(false);
1295
+
1296
+ /** 如果当前是在第一页说明根本没有数据,会误杀其他情况,但不重要 */
1297
+ _this7.setState(function (prev) {
1298
+ return {
1299
+ total: prev.page === 1 ? 0 : prev.total
1300
+ };
1301
+ });
1302
+ _this7.updateRowData([]);
1303
+ _this7.api.setPinnedBottomRowData([]);
1304
+ });
1305
+ }
1306
+ });
1307
+ }
1308
+ }, {
1309
+ key: "pagination",
1310
+ value: function pagination(page, pageSize) {
1311
+ var _this8 = this;
1312
+ this.setState({
1313
+ page: page,
1314
+ pageSize: pageSize
1315
+ }, function () {
1316
+ if (_this8.isClientMode()) {
1317
+ withSyncRender(function () {
1318
+ _this8.api.paginationGoToPage(page - 1);
1319
+ _this8.api.paginationSetPageSize(pageSize);
1320
+ });
1321
+ } else {
1322
+ _this8.getDataFromServer();
1323
+ }
1324
+ });
1325
+ }
1326
+ }, {
1327
+ key: "getMainMenuItems",
1328
+ value: function getMainMenuItems(params) {
1329
+ if (params.defaultItems.includes('pinSubMenu')) {
1330
+ return params.defaultItems;
1331
+ }
1332
+ return ['pinSubMenu', 'separator'].concat(_toConsumableArray(params.defaultItems));
1333
+ }
1334
+ }, {
1335
+ key: "validateRecord",
1336
+ value: function validateRecord(record) {
1337
+ var _this9 = this;
1338
+ if (this.validator === null) {
1339
+ return;
1340
+ }
1341
+ var rowId = this.getRowId({
1342
+ data: record
1343
+ });
1344
+ return this.validator.validate(record).then(function () {
1345
+ var errors = new Map(_this9.store.getState().errors);
1346
+ var error = errors.get(rowId);
1347
+ if (error === undefined) {
1348
+ return;
1349
+ }
1350
+ errors.delete(rowId);
1351
+ _this9.store.setState({
1352
+ errors: errors
1353
+ });
1354
+ }).catch(function (res) {
1355
+ var fields = res.fields;
1356
+ var errors = new Map(_this9.store.getState().errors);
1357
+ var error = new Map();
1358
+ Object.entries(fields).forEach(function (item) {
1359
+ error.set(item[0], item[1].map(function (err) {
1360
+ return err.message || "".concat(item[0], "\u8F93\u5165\u9519\u8BEF");
1361
+ }));
1362
+ });
1363
+ errors.set(rowId, error);
1364
+ _this9.store.setState({
1365
+ errors: errors
1366
+ });
1367
+ });
1368
+ }
1369
+ }, {
1370
+ key: "validate",
1371
+ value: function () {
1372
+ var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
1373
+ var _this10 = this;
1374
+ var promises, result, flag, errors, failed;
1375
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1376
+ while (1) switch (_context4.prev = _context4.next) {
1377
+ case 0:
1378
+ promises = [];
1379
+ this.api.forEachNode(function (rowNode, idx) {
1380
+ var record = rowNode.data;
1381
+ if (record === undefined) {
1382
+ return;
1383
+ }
1384
+ var rowId = _this10.getRowId({
1385
+ data: record
1386
+ });
1387
+ if (_this10.validator === null) {
1388
+ promises.push(Promise.resolve(true));
1389
+ } else {
1390
+ promises.push(_this10.validator.validate(record).catch(function (_ref7) {
1391
+ var fields = _ref7.fields;
1392
+ return Promise.reject({
1393
+ id: rowId,
1394
+ data: record,
1395
+ fields: fields,
1396
+ node: rowNode,
1397
+ index: idx
1398
+ });
1399
+ }));
1400
+ }
1401
+ });
1402
+ _context4.next = 4;
1403
+ return Promise.allSettled(promises);
1404
+ case 4:
1405
+ result = _context4.sent;
1406
+ flag = false;
1407
+ errors = new Map();
1408
+ failed = [];
1409
+ result.forEach(function (item) {
1410
+ if (item.status === 'rejected') {
1411
+ var _ref8 = item.reason,
1412
+ id = _ref8.id,
1413
+ fields = _ref8.fields;
1414
+ var error = new Map();
1415
+ Object.entries(fields).forEach(function (_ref9) {
1416
+ var _ref10 = _slicedToArray(_ref9, 2),
1417
+ field = _ref10[0],
1418
+ errs = _ref10[1];
1419
+ error.set(field, errs.map(function (err) {
1420
+ return err.message || "".concat(field, "\u8F93\u5165\u9519\u8BEF");
1421
+ }));
1422
+ });
1423
+ errors.set(id, error);
1424
+ failed.push(item.reason);
1425
+ flag = true;
1426
+ }
1427
+ });
1428
+ if (!flag) {
1429
+ _context4.next = 12;
1430
+ break;
1431
+ }
1432
+ this.store.setState({
1433
+ errors: errors
1434
+ });
1435
+ return _context4.abrupt("return", Promise.reject(failed));
1436
+ case 12:
1437
+ return _context4.abrupt("return", true);
1438
+ case 13:
1439
+ case "end":
1440
+ return _context4.stop();
1441
+ }
1442
+ }, _callee4, this);
1443
+ }));
1444
+ function validate() {
1445
+ return _validate.apply(this, arguments);
1446
+ }
1447
+ return validate;
1448
+ }()
1449
+ }, {
1450
+ key: "fetch",
1451
+ value: function fetch(page) {
1452
+ var _this11 = this;
1453
+ var curr = page || 1;
1454
+ this.setState({
1455
+ page: curr
1456
+ }, function () {
1457
+ _this11.getDataFromServer();
1458
+ });
1459
+ }
1460
+ }, {
1461
+ key: "refresh",
1462
+ value: function refresh() {
1463
+ this.getDataFromServer();
1464
+ }
1465
+ }, {
1466
+ key: "ready",
1467
+ value: function ready() {
1468
+ return this.isReady;
1469
+ }
1470
+ }, {
1471
+ key: "focusPreviousCell",
1472
+ value:
1473
+ /**
1474
+ * 在表格失去焦点后,聚焦失去焦点的单元格
1475
+ * @returns
1476
+ */
1477
+ function focusPreviousCell() {
1478
+ if (this.prevFocusedCell === null || this.api.getFocusedCell()) {
1479
+ console.warn('no focused previous cell');
1480
+ return;
1481
+ }
1482
+ var column = this.columnApi.getColumn(this.prevFocusedCell.column);
1483
+ var node = this.api.getRowNode(this.prevFocusedCell.row);
1484
+ if (node === undefined || column === null || node.rowIndex === null) {
1485
+ this.prevFocusedCell = null;
1486
+ return;
1487
+ }
1488
+ this.api.setFocusedCell(node.rowIndex, column);
1489
+ if (column.isCellEditable(node)) {
1490
+ this.api.startEditingCell({
1491
+ rowIndex: node.rowIndex,
1492
+ colKey: column.getColId()
1493
+ });
1494
+ }
1495
+ }
1496
+ }, {
1497
+ key: "render",
1498
+ value: function render() {
1499
+ var _this12 = this;
1500
+ var reactCtx = this.context;
1501
+ var _reactCtx$DataGrid$th = _objectSpread(_objectSpread({}, reactCtx.DataGrid), this.props),
1502
+ rowKey = _reactCtx$DataGrid$th.rowKey,
1503
+ fetch = _reactCtx$DataGrid$th.fetch,
1504
+ dataSource = _reactCtx$DataGrid$th.dataSource,
1505
+ rowActions = _reactCtx$DataGrid$th.rowActions,
1506
+ columns = _reactCtx$DataGrid$th.columns,
1507
+ autoLoad = _reactCtx$DataGrid$th.autoLoad,
1508
+ loadingProp = _reactCtx$DataGrid$th.loading,
1509
+ summary = _reactCtx$DataGrid$th.summary,
1510
+ detailCell = _reactCtx$DataGrid$th.detailCell,
1511
+ pagination = _reactCtx$DataGrid$th.pagination,
1512
+ rowSelection = _reactCtx$DataGrid$th.rowSelection,
1513
+ columnTypesProp = _reactCtx$DataGrid$th.columnTypes,
1514
+ defaultColDefProp = _reactCtx$DataGrid$th.defaultColDef,
1515
+ componentsProp = _reactCtx$DataGrid$th.components,
1516
+ sideBarProp = _reactCtx$DataGrid$th.sideBar,
1517
+ detailCellRendererParams = _reactCtx$DataGrid$th.detailCellRendererParams,
1518
+ context = _reactCtx$DataGrid$th.context,
1519
+ showSearch = _reactCtx$DataGrid$th.showSearch,
1520
+ cellDisplayFlex = _reactCtx$DataGrid$th.cellDisplayFlex,
1521
+ restProps = _objectWithoutProperties(_reactCtx$DataGrid$th, _excluded4);
1522
+ var _this$state2 = this.state,
1523
+ enablePagination = _this$state2.pagination,
1524
+ page = _this$state2.page,
1525
+ pageSize = _this$state2.pageSize,
1526
+ total = _this$state2.total,
1527
+ loading = _this$state2.loading;
1528
+ var mPage = _typeof(pagination) === 'object' ? pagination : {};
1529
+ var footer = [];
1530
+ var gridRowSelection;
1531
+ if (rowSelection !== undefined) {
1532
+ if (rowSelection.type === 'radio') {
1533
+ gridRowSelection = 'single';
1534
+ } else {
1535
+ gridRowSelection = 'multiple';
1536
+ }
1537
+ footer.push( /*#__PURE__*/React.createElement(Selected, {
1538
+ selection: this.selected,
1539
+ onClear: this.handleClearSelected,
1540
+ key: "selection"
1541
+ }));
1542
+ }
1543
+ if (showSearch) {
1544
+ footer.push( /*#__PURE__*/React.createElement(Search, _extends({
1545
+ key: "search",
1546
+ ref: this.searchRef
1547
+ }, _typeof(showSearch) === 'object' ? showSearch : {})));
1548
+ }
1549
+ if (enablePagination) {
1550
+ footer.push( /*#__PURE__*/React.createElement(Pagination, _extends({
1551
+ key: "pagination",
1552
+ size: "small",
1553
+ showPrevNextJumpers: true,
1554
+ showSizeChanger: true,
1555
+ showQuickJumper: true,
1556
+ showTotal: function showTotal(val) {
1557
+ return "\u5171".concat(val, "\u6761");
1558
+ },
1559
+ defaultCurrent: 1,
1560
+ defaultPageSize: 20,
1561
+ pageSizeOptions: ['10', '20', '50', '100']
1562
+ }, mPage, {
1563
+ pageSize: pageSize,
1564
+ current: page,
1565
+ total: total,
1566
+ onChange: function onChange(curr, limit) {
1567
+ _this12.pagination(curr, limit);
1568
+ if (mPage.onChange) {
1569
+ mPage.onChange(curr, limit);
1570
+ }
1571
+ }
1572
+ })));
1573
+ }
1574
+ return /*#__PURE__*/React.createElement(GridStoreContext.Provider, {
1575
+ value: this.store
1576
+ }, /*#__PURE__*/React.createElement("div", {
1577
+ className: classNames('ag-theme-lemon', "".concat(prefix()), _defineProperty(_defineProperty({}, prefix('group-rows'), restProps.groupDisplayType === 'groupRows'), prefix('cell-flex'), cellDisplayFlex)),
1578
+ style: restProps.domLayout === 'autoHeight' ? {
1579
+ height: 'auto'
1580
+ } : undefined,
1581
+ onBlur: function onBlur(e) {
1582
+ if (e.currentTarget.contains(e.relatedTarget)) {
1583
+ return;
1584
+ }
1585
+ _this12.handleBlur();
1586
+ },
1587
+ onFocus: this.handleFocus
1588
+ }, /*#__PURE__*/React.createElement(AgGridReact, _extends({
1589
+ singleClickEdit: true,
1590
+ suppressPaginationPanel: true,
1591
+ suppressCopyRowsToClipboard: true,
1592
+ suppressDragLeaveHidesColumns: true
1593
+ /** 防止粘贴错误的值到可编辑表格 */,
1594
+ suppressClipboardPaste: true,
1595
+ enableCellEditingOnBackspace: true,
1596
+ maintainColumnOrder: true,
1597
+ suppressCsvExport: true,
1598
+ suppressRowClickSelection: gridRowSelection === 'multiple',
1599
+ noRowsOverlayComponent: this.NoRowsOverlay,
1600
+ getMainMenuItems: this.getMainMenuItems,
1601
+ rowBuffer: 20,
1602
+ rowData: this.emptyRowData,
1603
+ sideBar: sideBarProp === true ? this.sideBarDef : sideBarProp,
1604
+ pinnedBottomRowData: this.getSummaryRowData(summary),
1605
+ masterDetail: detailCell !== undefined
1606
+ }, this.getMemoizedDetailCellParams(detailCell, detailCellRendererParams, restProps.detailRowAutoHeight), restProps, {
1607
+ getRowStyle: this.getRowStyle,
1608
+ stopEditingWhenCellsLoseFocus: false,
1609
+ onRowDataUpdated: this.rowDataUpdated,
1610
+ onCellValueChanged: this.cellValueChanged,
1611
+ onCellEditingStopped: this.cellEditingStop,
1612
+ onCellFocused: this.cellFocused,
1613
+ pagination: enablePagination,
1614
+ paginationPageSize: pageSize,
1615
+ getRowId: this.getRowId,
1616
+ onGridReady: this.init,
1617
+ context: context,
1618
+ rowSelection: gridRowSelection,
1619
+ components: this.getMemoizedComponents(componentsProp),
1620
+ defaultColDef: this.getMemoizedDefaultColDef(defaultColDefProp),
1621
+ columnTypes: this.getMemoizedColumnTypes(columnTypesProp)
1622
+ })), footer.length > 0 && /*#__PURE__*/React.createElement("div", {
1623
+ className: prefix('bottom')
1624
+ }, footer), (loadingProp !== null && loadingProp !== void 0 ? loadingProp : loading) ? /*#__PURE__*/React.createElement(Spin, {
1625
+ className: prefix('spin')
1626
+ }) : null));
1627
+ }
1628
+ }], [{
1629
+ key: "isSummaryRow",
1630
+ value: function isSummaryRow(_ref11) {
1631
+ var node = _ref11.node;
1632
+ if (node && node.data && node.data[DataGrid.SummaryFlag]) {
1633
+ return true;
1634
+ }
1635
+ return false;
1636
+ }
1637
+ }]);
1638
+ return DataGrid;
1639
+ }(Component);
1640
+ _defineProperty(DataGrid, "contextType", ComponentConfigureContext);
1641
+ _defineProperty(DataGrid, "defaultProps", {
1642
+ stopEditingWhenCellsLoseFocus: true,
1643
+ autoLoad: false,
1644
+ localeText: {
1645
+ copy: '复制',
1646
+ copyWithHeaders: '复制(带表头)',
1647
+ copyWithGroupHeaders: '复制(带表头分组)',
1648
+ paste: '粘贴',
1649
+ export: '导出',
1650
+ csvExport: 'CSV 导出',
1651
+ searchOoo: '搜索',
1652
+ autosizeThiscolumn: '当前列宽自适应',
1653
+ autosizeAllColumns: '所有列宽自适应',
1654
+ resetColumns: '重置所有列',
1655
+ pinColumn: '固定列',
1656
+ pinLeft: '固定在左侧',
1657
+ pinRight: '固定在右侧',
1658
+ noPin: '不固定',
1659
+ expandAll: '展开所有',
1660
+ collapseAll: '折叠所有',
1661
+ columns: '列'
1662
+ }
1663
+ });
1664
+ _defineProperty(DataGrid, "SummaryFlag", Symbol('summary'));
1665
+ _defineProperty(DataGrid, "IndexColId", '$$index');
1666
+ _defineProperty(DataGrid, "EmptyCol", {
1667
+ colId: '$$empty',
1668
+ flex: 1,
1669
+ resizable: false,
1670
+ suppressMovable: true,
1671
+ headerName: '',
1672
+ suppressNavigable: true,
1673
+ lockVisible: true,
1674
+ suppressMenu: true,
1675
+ suppressColumnsToolPanel: true
1676
+ });
1677
+ _defineProperty(DataGrid, "Editors", {
1678
+ Text: TextEditor,
1679
+ Date: DateEditor,
1680
+ Number: NumberEditor,
1681
+ Select: SelectEditor,
1682
+ Wrapper: EditorWrapper
1683
+ });
1684
+ export { DataGrid as default };