@lemon-fe/kits 0.1.136 → 1.0.0-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.
- package/README.md +27 -5
- package/es/app.d.ts +1 -0
- package/es/app.js +3 -0
- package/es/components/Actions/index.d.ts +26 -0
- package/es/components/Actions/index.js +169 -0
- package/es/components/Actions/index.less +67 -0
- package/es/components/BaseTable/Actions.d.ts +9 -0
- package/es/components/BaseTable/Actions.js +136 -0
- package/es/components/BaseTable/BaseTableContext.d.ts +7 -0
- package/es/components/BaseTable/BaseTableContext.js +7 -0
- package/es/components/BaseTable/ResizeHeaderCell.d.ts +8 -0
- package/es/components/BaseTable/ResizeHeaderCell.js +130 -0
- package/es/components/BaseTable/VirtualBody.d.ts +8 -0
- package/es/components/BaseTable/VirtualBody.js +163 -0
- package/es/components/BaseTable/empty.png +0 -0
- package/es/components/BaseTable/index.d.ts +9 -0
- package/es/components/BaseTable/index.js +482 -0
- package/es/components/BaseTable/index.less +189 -0
- package/es/components/BaseTable/typings.d.ts +48 -0
- package/es/components/BaseTable/utils.d.ts +4 -0
- package/es/components/BaseTable/utils.js +26 -0
- package/es/components/ColorPicker/index.d.ts +13 -0
- package/es/components/ColorPicker/index.js +114 -0
- package/es/components/ColorPicker/index.less +47 -0
- package/es/components/DataGrid/Actions.d.ts +9 -0
- package/es/components/DataGrid/Actions.js +119 -0
- package/es/components/DataGrid/CellRenderer.d.ts +4 -0
- package/es/components/DataGrid/CellRenderer.js +68 -0
- package/es/components/DataGrid/GridContext.d.ts +4 -0
- package/es/components/DataGrid/GridContext.js +4 -0
- package/es/components/DataGrid/HeaderRenderer.d.ts +6 -0
- package/es/components/DataGrid/HeaderRenderer.js +93 -0
- package/es/components/DataGrid/cell-editors/Custom.d.ts +9 -0
- package/es/components/DataGrid/cell-editors/Custom.js +105 -0
- package/es/components/DataGrid/cell-editors/Date.d.ts +8 -0
- package/es/components/DataGrid/cell-editors/Date.js +78 -0
- package/es/components/DataGrid/cell-editors/Number.d.ts +9 -0
- package/es/components/DataGrid/cell-editors/Number.js +86 -0
- package/es/components/DataGrid/cell-editors/Select.d.ts +7 -0
- package/es/components/DataGrid/cell-editors/Select.js +70 -0
- package/es/components/DataGrid/cell-editors/Text.d.ts +5 -0
- package/es/components/DataGrid/cell-editors/Text.js +60 -0
- package/es/components/DataGrid/cell-editors/Wrapper.d.ts +4 -0
- package/es/components/DataGrid/cell-editors/Wrapper.js +7 -0
- package/es/components/DataGrid/cell-editors/utils.d.ts +1 -0
- package/es/components/DataGrid/cell-editors/utils.js +2 -0
- package/es/components/DataGrid/empty.png +0 -0
- package/es/components/DataGrid/hooks.d.ts +2 -0
- package/es/components/DataGrid/hooks.js +45 -0
- package/es/components/DataGrid/index.d.ts +77 -0
- package/es/components/DataGrid/index.js +1051 -0
- package/es/components/DataGrid/index.less +304 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/clientSideNodeManager.d.ts +57 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/clientSideNodeManager.js +378 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/clientSideRowModel.d.ts +120 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/clientSideRowModel.js +1160 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/filterService.d.ts +7 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/filterService.js +137 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/filterStage.d.ts +5 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/filterStage.js +60 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/flattenStage.d.ts +10 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/flattenStage.js +199 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/immutableService.d.ts +13 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/immutableService.js +175 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/sortService.d.ts +21 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/sortService.js +330 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/sortStage.d.ts +7 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModel/sortStage.js +75 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModelModule.d.ts +15 -0
- package/es/components/DataGrid/modules/client-side-row-model/clientSideRowModelModule.js +15 -0
- package/es/components/DataGrid/modules/client-side-row-model/index.d.ts +1 -0
- package/es/components/DataGrid/modules/client-side-row-model/index.js +1 -0
- package/es/components/DataGrid/modules/clipboard/clipboard/clipboardService.d.ts +62 -0
- package/es/components/DataGrid/modules/clipboard/clipboard/clipboardService.js +923 -0
- package/es/components/DataGrid/modules/clipboard/clipboardModule.d.ts +7 -0
- package/es/components/DataGrid/modules/clipboard/clipboardModule.js +8 -0
- package/es/components/DataGrid/modules/clipboard/index.d.ts +1 -0
- package/es/components/DataGrid/modules/clipboard/index.js +1 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/columnModelItem.d.ts +32 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/columnModelItem.js +100 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/columnToolPanel.d.ts +51 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/columnToolPanel.js +320 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/modelItemUtils.d.ts +20 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/modelItemUtils.js +247 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/pivotModePanel.d.ts +9 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/pivotModePanel.js +93 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/primaryColsHeaderPanel.d.ts +32 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/primaryColsHeaderPanel.js +186 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/primaryColsListPanel.d.ts +49 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/primaryColsListPanel.js +546 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/primaryColsListPanelItemDragFeature.d.ts +26 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/primaryColsListPanelItemDragFeature.js +264 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/primaryColsPanel.d.ts +32 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/primaryColsPanel.js +151 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/toolPanelColumnComp.d.ts +43 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/toolPanelColumnComp.js +369 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/toolPanelColumnGroupComp.d.ts +62 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/toolPanelColumnGroupComp.js +475 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/toolPanelContextMenu.d.ts +24 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnToolPanel/toolPanelContextMenu.js +322 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnsToolPanelModule.d.ts +24 -0
- package/es/components/DataGrid/modules/column-tool-panel/columnsToolPanelModule.js +24 -0
- package/es/components/DataGrid/modules/column-tool-panel/index.d.ts +2 -0
- package/es/components/DataGrid/modules/column-tool-panel/index.js +3 -0
- package/es/components/DataGrid/modules/menu/index.d.ts +1 -0
- package/es/components/DataGrid/modules/menu/index.js +1 -0
- package/es/components/DataGrid/modules/menu/menu/contextMenu.d.ts +26 -0
- package/es/components/DataGrid/modules/menu/menu/contextMenu.js +329 -0
- package/es/components/DataGrid/modules/menu/menu/enterpriseMenu.d.ts +85 -0
- package/es/components/DataGrid/modules/menu/menu/enterpriseMenu.js +639 -0
- package/es/components/DataGrid/modules/menu/menu/menuItemMapper.d.ts +15 -0
- package/es/components/DataGrid/modules/menu/menu/menuItemMapper.js +565 -0
- package/es/components/DataGrid/modules/menu/menuModule.d.ts +8 -0
- package/es/components/DataGrid/modules/menu/menuModule.js +8 -0
- package/es/components/DataGrid/modules/row-grouping/index.d.ts +4 -0
- package/es/components/DataGrid/modules/row-grouping/index.js +4 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/aggFuncService.d.ts +23 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/aggFuncService.js +303 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/aggregationStage.d.ts +20 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/aggregationStage.js +326 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/batchRemover.d.ts +10 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/batchRemover.js +71 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/baseDropZonePanel.d.ts +75 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/baseDropZonePanel.js +618 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/dropZoneColumnComp.d.ts +40 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/dropZoneColumnComp.js +460 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/gridHeaderDropZones.d.ts +11 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/gridHeaderDropZones.js +108 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/pivotDropZonePanel.d.ts +17 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/pivotDropZonePanel.js +170 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/rowGroupDropZonePanel.d.ts +15 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/rowGroupDropZonePanel.js +133 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/valueDropZonePanel.d.ts +15 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/columnDropZones/valueDropZonePanel.js +133 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/filterAggregatesStage.d.ts +9 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/filterAggregatesStage.js +175 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/groupStage.d.ts +47 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/groupStage.js +814 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/pivotColDefService.d.ts +24 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/pivotColDefService.js +478 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/pivotStage.d.ts +19 -0
- package/es/components/DataGrid/modules/row-grouping/rowGrouping/pivotStage.js +219 -0
- package/es/components/DataGrid/modules/row-grouping/rowGroupingModule.d.ts +16 -0
- package/es/components/DataGrid/modules/row-grouping/rowGroupingModule.js +16 -0
- package/es/components/DataGrid/modules/server-side-row-model/index.d.ts +1 -0
- package/es/components/DataGrid/modules/server-side-row-model/index.js +1 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/blocks/blockUtils.d.ts +47 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/blocks/blockUtils.js +444 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/blocks/infiniteStoreBlock.d.ts +92 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/blocks/infiniteStoreBlock.js +510 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/listeners/expandListener.d.ts +9 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/listeners/expandListener.js +115 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/listeners/filterListener.d.ts +9 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/listeners/filterListener.js +114 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/listeners/listenerUtils.d.ts +5 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/listeners/listenerUtils.js +68 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/listeners/sortListener.d.ts +13 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/listeners/sortListener.js +194 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/nodeManager.d.ts +7 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/nodeManager.js +63 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/serverSideRowModel.d.ts +88 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/serverSideRowModel.js +572 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/stores/fullStore.d.ts +108 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/stores/fullStore.js +876 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/stores/infiniteStore.d.ts +102 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/stores/infiniteStore.js +918 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/stores/storeFactory.d.ts +12 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/stores/storeFactory.js +141 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/stores/storeUtils.d.ts +35 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/stores/storeUtils.js +154 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/transactionManager.d.ts +23 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModel/transactionManager.js +210 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModelModule.d.ts +18 -0
- package/es/components/DataGrid/modules/server-side-row-model/serverSideRowModelModule.js +18 -0
- package/es/components/DataGrid/modules/side-bar/index.d.ts +2 -0
- package/es/components/DataGrid/modules/side-bar/index.js +2 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/common/toolPanelColDefService.d.ts +11 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/common/toolPanelColDefService.js +280 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/horizontalResizeComp.d.ts +19 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/horizontalResizeComp.js +132 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/sideBarButtonComp.d.ts +16 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/sideBarButtonComp.js +108 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/sideBarButtonsComp.d.ts +18 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/sideBarButtonsComp.js +115 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/sideBarComp.d.ts +29 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/sideBarComp.js +353 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/toolPanelWrapper.d.ts +17 -0
- package/es/components/DataGrid/modules/side-bar/sideBar/toolPanelWrapper.js +128 -0
- package/es/components/DataGrid/modules/side-bar/sideBarModule.d.ts +19 -0
- package/es/components/DataGrid/modules/side-bar/sideBarModule.js +19 -0
- package/es/components/DataGrid/typings.d.ts +138 -0
- package/es/components/DataGrid/typings.js +1 -0
- package/es/components/DataGrid/utils.d.ts +43 -0
- package/es/components/DataGrid/utils.js +242 -0
- package/es/components/Dropdown/index.d.ts +15 -0
- package/es/components/Dropdown/index.js +55 -0
- package/es/components/Dropdown/index.less +13 -0
- package/es/components/DurationPicker/index.d.ts +26 -0
- package/es/components/DurationPicker/index.js +204 -0
- package/es/components/DurationPicker/index.less +61 -0
- package/es/components/EditableTable/EditableCell.d.ts +12 -0
- package/es/components/EditableTable/EditableCell.js +41 -0
- package/es/components/EditableTable/EditableTableFormItem.d.ts +6 -0
- package/es/components/EditableTable/EditableTableFormItem.js +47 -0
- package/es/components/EditableTable/Table.d.ts +6 -0
- package/es/components/EditableTable/Table.js +362 -0
- package/es/components/EditableTable/index.d.ts +9 -0
- package/es/components/EditableTable/index.js +8 -0
- package/es/components/EditableTable/index.less +29 -0
- package/es/components/EditableTable/typings.d.ts +90 -0
- package/es/components/EditableTable/util.d.ts +25 -0
- package/es/components/EditableTable/util.js +399 -0
- package/es/components/Filter/index.d.ts +15 -0
- package/es/components/Filter/index.js +644 -0
- package/es/components/Filter/index.less +82 -0
- package/es/components/Filter/typings.d.ts +35 -0
- package/es/components/FormLayout/index.d.ts +32 -0
- package/es/components/FormLayout/index.js +41 -0
- package/es/components/FormLayout/index.less +109 -0
- package/es/components/Icons/BigTip/error.png +0 -0
- package/es/components/Icons/BigTip/index.d.ts +6 -0
- package/es/components/Icons/BigTip/index.js +46 -0
- package/es/components/Icons/BigTip/info.png +0 -0
- package/es/components/Icons/BigTip/success.png +0 -0
- package/es/components/Icons/BigTip/warning.png +0 -0
- package/es/components/Icons/Calendar.d.ts +5 -0
- package/es/components/Icons/Calendar.js +43 -0
- package/es/components/Icons/Close.d.ts +5 -0
- package/es/components/Icons/Close.js +25 -0
- package/es/components/Icons/CollapseUp.d.ts +5 -0
- package/es/components/Icons/CollapseUp.js +27 -0
- package/es/components/Icons/DarkSearch.d.ts +5 -0
- package/es/components/Icons/DarkSearch.js +34 -0
- package/es/components/Icons/Down.d.ts +5 -0
- package/es/components/Icons/Down.js +31 -0
- package/es/components/Icons/Empty.d.ts +3 -0
- package/es/components/Icons/Empty.js +267 -0
- package/es/components/Icons/LookUp.d.ts +5 -0
- package/es/components/Icons/LookUp.js +70 -0
- package/es/components/Icons/More.d.ts +5 -0
- package/es/components/Icons/More.js +40 -0
- package/es/components/Icons/Search.d.ts +5 -0
- package/es/components/Icons/Search.js +31 -0
- package/es/components/Icons/Tip.d.ts +6 -0
- package/es/components/Icons/Tip.js +165 -0
- package/es/components/Icons/index.d.ts +25 -0
- package/es/components/Icons/index.js +25 -0
- package/es/components/Layout/index.d.ts +41 -0
- package/es/components/Layout/index.js +173 -0
- package/es/components/Layout/index.less +136 -0
- package/es/components/PageLoading/index.d.ts +5 -0
- package/es/components/PageLoading/index.js +15 -0
- package/es/components/PageLoading/index.less +8 -0
- package/es/components/Popup/index.d.ts +39 -0
- package/es/components/Popup/index.js +223 -0
- package/es/components/Popup/index.less +12 -0
- package/es/components/Portal/index.d.ts +17 -0
- package/es/components/Portal/index.js +141 -0
- package/es/components/Section/TabBar.d.ts +12 -0
- package/es/components/Section/TabBar.js +51 -0
- package/es/components/Section/index.d.ts +54 -0
- package/es/components/Section/index.js +96 -0
- package/es/components/Section/index.less +130 -0
- package/es/components/SelectView/index.d.ts +47 -0
- package/es/components/SelectView/index.js +244 -0
- package/es/components/SelectView/index.less +60 -0
- package/es/components/SiderTree/TreeNodeTitle.d.ts +9 -0
- package/es/components/SiderTree/TreeNodeTitle.js +107 -0
- package/es/components/SiderTree/empty.png +0 -0
- package/es/components/SiderTree/index.d.ts +37 -0
- package/es/components/SiderTree/index.js +217 -0
- package/es/components/SiderTree/index.less +222 -0
- package/es/components/SiderTree/typings.d.ts +19 -0
- package/es/components/SymbolIcon/index.d.ts +8 -0
- package/es/components/SymbolIcon/index.js +32 -0
- package/es/components/SymbolIcon/index.less +7 -0
- package/es/components/TabBar/index.d.ts +14 -0
- package/es/components/TabBar/index.js +52 -0
- package/es/components/TabBar/index.less +31 -0
- package/es/components/Table/index.d.ts +3 -0
- package/es/components/Table/index.js +242 -0
- package/es/components/Table/typings.d.ts +25 -0
- package/es/components/Table/utils.d.ts +2 -0
- package/es/components/Table/utils.js +3 -0
- package/es/components/utils.d.ts +3 -0
- package/es/components/utils.js +20 -0
- package/es/constants.d.ts +1 -0
- package/es/constants.js +1 -0
- package/es/{useBatchOperator → hooks/useBatchOperator}/index.d.ts +2 -2
- package/es/{useBatchOperator → hooks/useBatchOperator}/index.js +120 -57
- package/es/{usePageTrack → hooks/usePageTrack}/index.d.ts +0 -0
- package/es/{usePageTrack → hooks/usePageTrack}/index.js +0 -0
- package/es/index.d.ts +33 -6
- package/es/index.js +30 -6
- package/es/index.less +25 -1
- package/es/init.d.ts +3 -0
- package/es/init.js +153 -0
- package/es/layouts/BasicLayout/components/Main.d.ts +10 -0
- package/es/layouts/BasicLayout/components/Main.js +390 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/DropMenu/index.d.ts +11 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/DropMenu/index.js +104 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/DropMenu/index.less +59 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/Menu/index.d.ts +10 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/Menu/index.js +667 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/Menu/index.less +445 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/RefreshButton/index.d.ts +6 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/RefreshButton/index.js +72 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/RefreshButton/index.less +30 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/TabBar/index.d.ts +10 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/TabBar/index.js +116 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/TabBar/index.less +155 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/WaterMark/index.d.ts +6 -0
- package/es/layouts/BasicLayout/components/MainFramework/components/WaterMark/index.js +70 -0
- package/es/layouts/BasicLayout/components/MainFramework/index.d.ts +28 -0
- package/es/layouts/BasicLayout/components/MainFramework/index.js +78 -0
- package/es/layouts/BasicLayout/components/MainFramework/index.less +97 -0
- package/es/layouts/BasicLayout/components/MainFramework/typings.d.ts +10 -0
- package/es/layouts/BasicLayout/index.d.ts +3 -0
- package/es/layouts/BasicLayout/index.js +98 -0
- package/es/layouts/BasicLayout/typings.d.ts +82 -0
- package/es/layouts/BlankLayout/index.d.ts +5 -0
- package/es/layouts/BlankLayout/index.js +5 -0
- package/es/layouts/Breadcrumb/index.d.ts +6 -0
- package/es/layouts/Breadcrumb/index.js +75 -0
- package/es/layouts/MicroLayout/index.d.ts +10 -0
- package/es/layouts/MicroLayout/index.js +105 -0
- package/es/layouts/MicroLayout/typings.d.ts +25 -0
- package/es/layouts/components/CachableRoute.d.ts +2 -0
- package/es/layouts/components/CachableRoute.js +38 -0
- package/es/layouts/components/RouteTab.d.ts +20 -0
- package/es/layouts/components/RouteTab.js +40 -0
- package/es/layouts/components/Switch.d.ts +2 -0
- package/es/layouts/components/Switch.js +63 -0
- package/es/layouts/index.d.ts +4 -0
- package/es/layouts/index.js +4 -0
- package/es/layouts/typings.d.ts +29 -0
- package/es/layouts/utils.d.ts +23 -0
- package/es/layouts/utils.js +175 -0
- package/es/styles/overrides.less +191 -0
- package/es/styles/theme.less +9 -0
- package/es/styles/utils.less +110 -0
- package/package.json +75 -22
- package/es/subject.d.ts +0 -12
- package/es/subject.js +0 -30
|
@@ -0,0 +1,1051 @@
|
|
|
1
|
+
var _excluded = ["validator"],
|
|
2
|
+
_excluded2 = ["title", "key", "dataIndex", "align", "type", "fixed", "render", "ellipsis", "cellRenderer", "cellRendererParams", "className", "sorter", "editable"],
|
|
3
|
+
_excluded3 = ["title", "children"],
|
|
4
|
+
_excluded4 = ["rowSelection", "rowKey", "fetch", "dataSource", "summary", "rowActions", "context", "onGridReady", "pagination", "defaultColDef"];
|
|
5
|
+
|
|
6
|
+
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); }
|
|
7
|
+
|
|
8
|
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
9
|
+
|
|
10
|
+
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); } }
|
|
11
|
+
|
|
12
|
+
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); }); }; }
|
|
13
|
+
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
+
|
|
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
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
21
|
+
|
|
22
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
31
|
+
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
+
|
|
36
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
37
|
+
|
|
38
|
+
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, descriptor.key, descriptor); } }
|
|
39
|
+
|
|
40
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
41
|
+
|
|
42
|
+
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); }
|
|
43
|
+
|
|
44
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
+
|
|
46
|
+
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); }; }
|
|
47
|
+
|
|
48
|
+
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); }
|
|
49
|
+
|
|
50
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
51
|
+
|
|
52
|
+
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; } }
|
|
53
|
+
|
|
54
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
55
|
+
|
|
56
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
57
|
+
|
|
58
|
+
import React, { Component } from 'react';
|
|
59
|
+
import { AgGridReact } from '@ag-grid-community/react';
|
|
60
|
+
import shallowEqual from 'shallowequal';
|
|
61
|
+
import { ModuleRegistry, GridApi, ColumnApi } from '@ag-grid-community/core';
|
|
62
|
+
import { InfiniteRowModelModule } from '@ag-grid-community/infinite-row-model';
|
|
63
|
+
import { get, set } from 'lodash';
|
|
64
|
+
import Scheme from 'async-validator';
|
|
65
|
+
import GridContext from "./GridContext";
|
|
66
|
+
import { RowGroupingModule } from "./modules/row-grouping";
|
|
67
|
+
import { ClipboardModule } from "./modules/clipboard";
|
|
68
|
+
import { MenuModule } from "./modules/menu";
|
|
69
|
+
import { ColumnsToolPanelModule } from "./modules/column-tool-panel";
|
|
70
|
+
import { SideBarModule } from "./modules/side-bar";
|
|
71
|
+
import { ServerSideRowModelModule } from "./modules/server-side-row-model";
|
|
72
|
+
import { ClientSideRowModelModule } from "./modules/client-side-row-model";
|
|
73
|
+
import { Spin, Pagination } from 'antd';
|
|
74
|
+
import { prefix, getColField, isColumnType, withSyncRender, ColMethod, Store, Selection, columnTypes } from "./utils";
|
|
75
|
+
import HeaderRenderer from "./HeaderRenderer";
|
|
76
|
+
import CellRenderer from "./CellRenderer";
|
|
77
|
+
import Actions from "./Actions";
|
|
78
|
+
import DateEditor from "./cell-editors/Date";
|
|
79
|
+
import TextEditor from "./cell-editors/Text";
|
|
80
|
+
import NumberEditor from "./cell-editors/Number";
|
|
81
|
+
import SelectEditor from "./cell-editors/Select";
|
|
82
|
+
import Custom from "./cell-editors/Custom";
|
|
83
|
+
import EditorWrapper from "./cell-editors/Wrapper";
|
|
84
|
+
import empty from "./empty.png";
|
|
85
|
+
ModuleRegistry.registerModules([ClientSideRowModelModule, RowGroupingModule, InfiniteRowModelModule, ClipboardModule, MenuModule, SideBarModule, ColumnsToolPanelModule, ServerSideRowModelModule], false);
|
|
86
|
+
var defaultColDef = {
|
|
87
|
+
resizable: true,
|
|
88
|
+
width: 160,
|
|
89
|
+
sortable: true,
|
|
90
|
+
suppressMenu: true
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var DataGrid = /*#__PURE__*/function (_Component) {
|
|
94
|
+
_inherits(DataGrid, _Component);
|
|
95
|
+
|
|
96
|
+
var _super = _createSuper(DataGrid);
|
|
97
|
+
|
|
98
|
+
function DataGrid(props) {
|
|
99
|
+
var _this;
|
|
100
|
+
|
|
101
|
+
_classCallCheck(this, DataGrid);
|
|
102
|
+
|
|
103
|
+
_this = _super.call(this, props);
|
|
104
|
+
|
|
105
|
+
_defineProperty(_assertThisInitialized(_this), "api", new GridApi());
|
|
106
|
+
|
|
107
|
+
_defineProperty(_assertThisInitialized(_this), "selected", new Selection());
|
|
108
|
+
|
|
109
|
+
_defineProperty(_assertThisInitialized(_this), "columnApi", new ColumnApi());
|
|
110
|
+
|
|
111
|
+
_defineProperty(_assertThisInitialized(_this), "colRenderer", new ColMethod());
|
|
112
|
+
|
|
113
|
+
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
114
|
+
|
|
115
|
+
_defineProperty(_assertThisInitialized(_this), "dataSource", []);
|
|
116
|
+
|
|
117
|
+
_defineProperty(_assertThisInitialized(_this), "validator", null);
|
|
118
|
+
|
|
119
|
+
_defineProperty(_assertThisInitialized(_this), "requestId", 0);
|
|
120
|
+
|
|
121
|
+
_defineProperty(_assertThisInitialized(_this), "isReady", false);
|
|
122
|
+
|
|
123
|
+
_defineProperty(_assertThisInitialized(_this), "emptyRowData", []);
|
|
124
|
+
|
|
125
|
+
_defineProperty(_assertThisInitialized(_this), "init", function (args) {
|
|
126
|
+
var api = args.api,
|
|
127
|
+
columnApi = args.columnApi;
|
|
128
|
+
_this.api = api;
|
|
129
|
+
_this.columnApi = columnApi;
|
|
130
|
+
_this.isReady = true;
|
|
131
|
+
var _this$props = _this.props,
|
|
132
|
+
onGridReady = _this$props.onGridReady,
|
|
133
|
+
autoLoad = _this$props.autoLoad;
|
|
134
|
+
|
|
135
|
+
if (onGridReady !== undefined) {
|
|
136
|
+
onGridReady(args);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (_this.isClientMode()) {
|
|
140
|
+
_this.syncRowData();
|
|
141
|
+
} else if (autoLoad) {
|
|
142
|
+
_this.getDataFromServer();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
api.addEventListener('sortChanged', function (evt) {
|
|
146
|
+
_this.sort(evt);
|
|
147
|
+
}); // 用于同步selection
|
|
148
|
+
|
|
149
|
+
api.addEventListener('rowSelected', function (_ref) {
|
|
150
|
+
var node = _ref.node;
|
|
151
|
+
var rowSelection = _this.props.rowSelection;
|
|
152
|
+
|
|
153
|
+
if (rowSelection !== undefined && node.id !== undefined && node.data !== undefined && api.getRowNode(node.id) !== undefined) {
|
|
154
|
+
var prevSelected = _this.selected.has(node.id);
|
|
155
|
+
|
|
156
|
+
var currSelected = node.isSelected();
|
|
157
|
+
|
|
158
|
+
if (currSelected !== prevSelected) {
|
|
159
|
+
if (currSelected) {
|
|
160
|
+
_this.selected.set(node.id, node.data);
|
|
161
|
+
} else {
|
|
162
|
+
_this.selected.delete(node.id);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
api.addEventListener('selectionChanged', function () {
|
|
168
|
+
var rowSelection = _this.props.rowSelection;
|
|
169
|
+
|
|
170
|
+
if (_this.selected.isDirty() && rowSelection !== undefined && rowSelection.onChange !== undefined) {
|
|
171
|
+
var result = _this.selected.flush();
|
|
172
|
+
|
|
173
|
+
rowSelection.onChange(result[0], result[1].filter(Boolean));
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
_defineProperty(_assertThisInitialized(_this), "getRowId", function (params) {
|
|
179
|
+
var rowKey = _this.props.rowKey;
|
|
180
|
+
return typeof rowKey === 'function' ? rowKey(params.data) : get(params.data, rowKey);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
_defineProperty(_assertThisInitialized(_this), "cellValueChanged", function (evt) {
|
|
184
|
+
var onDataSouceChange = _this.props.onDataSouceChange;
|
|
185
|
+
|
|
186
|
+
if (onDataSouceChange !== undefined) {
|
|
187
|
+
onDataSouceChange(_this.dataSource || []);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
_defineProperty(_assertThisInitialized(_this), "cellEditingStop", function (evt) {
|
|
192
|
+
var data = evt.data;
|
|
193
|
+
|
|
194
|
+
_this.validateRecord(data);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
_this.state = _objectSpread({
|
|
198
|
+
colDefs: _this.getColumDefs()
|
|
199
|
+
}, _this.getPagination());
|
|
200
|
+
_this.store = new Store({
|
|
201
|
+
errors: new Map(),
|
|
202
|
+
context: props.context
|
|
203
|
+
});
|
|
204
|
+
var _props$rowSelection = props.rowSelection;
|
|
205
|
+
_props$rowSelection = _props$rowSelection === void 0 ? {} : _props$rowSelection;
|
|
206
|
+
var _props$rowSelection$s = _props$rowSelection.selectedRowKeys,
|
|
207
|
+
selectedRowKeys = _props$rowSelection$s === void 0 ? [] : _props$rowSelection$s;
|
|
208
|
+
selectedRowKeys.forEach(function (key) {
|
|
209
|
+
_this.selected.set(key, null);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
_this.syncColRender();
|
|
213
|
+
|
|
214
|
+
return _this;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
_createClass(DataGrid, [{
|
|
218
|
+
key: "getPagination",
|
|
219
|
+
value: function getPagination() {
|
|
220
|
+
var _this$props2 = this.props,
|
|
221
|
+
pagination = _this$props2.pagination,
|
|
222
|
+
fetch = _this$props2.fetch;
|
|
223
|
+
var page = 1;
|
|
224
|
+
var pageSize = 20;
|
|
225
|
+
var total = 0;
|
|
226
|
+
var enable = false;
|
|
227
|
+
|
|
228
|
+
if (_typeof(pagination) === 'object') {
|
|
229
|
+
enable = true;
|
|
230
|
+
pageSize = pagination.defaultPageSize || pagination.pageSize || 20;
|
|
231
|
+
page = pagination.defaultCurrent || pagination.current || 1;
|
|
232
|
+
total = pagination.total || 0;
|
|
233
|
+
} else if (pagination === true) {
|
|
234
|
+
enable = true;
|
|
235
|
+
} else if (pagination === false) {
|
|
236
|
+
enable = false;
|
|
237
|
+
total = Number.MAX_SAFE_INTEGER;
|
|
238
|
+
pageSize = Number.MAX_SAFE_INTEGER;
|
|
239
|
+
} else if (fetch !== undefined) {
|
|
240
|
+
enable = true;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
pagination: enable,
|
|
245
|
+
page: page,
|
|
246
|
+
pageSize: pageSize,
|
|
247
|
+
total: total
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}, {
|
|
251
|
+
key: "componentDidUpdate",
|
|
252
|
+
value: function componentDidUpdate(prevProps) {
|
|
253
|
+
var _prevProps$rowSelecti;
|
|
254
|
+
|
|
255
|
+
var _this$props3 = this.props,
|
|
256
|
+
columns = _this$props3.columns,
|
|
257
|
+
rowSelection = _this$props3.rowSelection,
|
|
258
|
+
dataSource = _this$props3.dataSource,
|
|
259
|
+
context = _this$props3.context;
|
|
260
|
+
|
|
261
|
+
if (columns !== prevProps.columns) {
|
|
262
|
+
this.syncColRender();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if ((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) !== ((_prevProps$rowSelecti = prevProps.rowSelection) === null || _prevProps$rowSelecti === void 0 ? void 0 : _prevProps$rowSelecti.selectedRowKeys)) {
|
|
266
|
+
this.syncSelection();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (dataSource !== prevProps.dataSource) {
|
|
270
|
+
this.syncRowData();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (!shallowEqual(context, prevProps.context)) {
|
|
274
|
+
this.store.setState({
|
|
275
|
+
context: context
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}, {
|
|
280
|
+
key: "syncColRender",
|
|
281
|
+
value: function syncColRender() {
|
|
282
|
+
var _this2 = this;
|
|
283
|
+
|
|
284
|
+
var _this$props4 = this.props,
|
|
285
|
+
_this$props4$columns = _this$props4.columns,
|
|
286
|
+
columns = _this$props4$columns === void 0 ? [] : _this$props4$columns,
|
|
287
|
+
_this$props4$columnRe = _this$props4.columnRenderMethods,
|
|
288
|
+
columnRenderMethods = _this$props4$columnRe === void 0 ? ['title', 'render', 'editable.render'] : _this$props4$columnRe;
|
|
289
|
+
this.colRenderer.reset();
|
|
290
|
+
var descriptor = Object.create(null);
|
|
291
|
+
|
|
292
|
+
var traverse = function traverse(cols) {
|
|
293
|
+
cols.forEach(function (item) {
|
|
294
|
+
columnRenderMethods.forEach(function (path) {
|
|
295
|
+
_this2.colRenderer.set(item, path);
|
|
296
|
+
});
|
|
297
|
+
var rules = get(item, ['editable', 'rules']);
|
|
298
|
+
|
|
299
|
+
if (rules !== undefined) {
|
|
300
|
+
var id = getColField(item);
|
|
301
|
+
|
|
302
|
+
if (id !== undefined) {
|
|
303
|
+
descriptor[id] = rules.map(function (rule) {
|
|
304
|
+
var validator = rule.validator,
|
|
305
|
+
restRule = _objectWithoutProperties(rule, _excluded);
|
|
306
|
+
|
|
307
|
+
return _objectSpread(_objectSpread({}, restRule), {}, {
|
|
308
|
+
asyncValidator: validator ? function (mRule, value, _, record) {
|
|
309
|
+
return validator(mRule, value, record);
|
|
310
|
+
} : undefined,
|
|
311
|
+
validator: undefined
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (!isColumnType(item)) {
|
|
318
|
+
traverse(item.children);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
traverse(columns);
|
|
324
|
+
|
|
325
|
+
if (Object.keys(descriptor).length > 0) {
|
|
326
|
+
this.validator = new Scheme(descriptor);
|
|
327
|
+
} else {
|
|
328
|
+
this.validator = null;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}, {
|
|
332
|
+
key: "syncSelection",
|
|
333
|
+
value: function syncSelection() {
|
|
334
|
+
var _this3 = this;
|
|
335
|
+
|
|
336
|
+
var _this$props$rowSelect = this.props.rowSelection;
|
|
337
|
+
_this$props$rowSelect = _this$props$rowSelect === void 0 ? {} : _this$props$rowSelect;
|
|
338
|
+
var selectedRowKeys = _this$props$rowSelect.selectedRowKeys;
|
|
339
|
+
|
|
340
|
+
if (selectedRowKeys !== undefined && !this.selected.isSameKeys(selectedRowKeys)) {
|
|
341
|
+
var newSelected = new Map();
|
|
342
|
+
this.selected.forEach(function (id) {
|
|
343
|
+
var node = _this3.api.getRowNode(id);
|
|
344
|
+
|
|
345
|
+
if (node !== undefined) {
|
|
346
|
+
node.setSelected(false, false, true);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
selectedRowKeys.forEach(function (id) {
|
|
350
|
+
newSelected.set(id, _this3.selected.get(id) || null);
|
|
351
|
+
|
|
352
|
+
var node = _this3.api.getRowNode(id);
|
|
353
|
+
|
|
354
|
+
if (node !== undefined) {
|
|
355
|
+
node.setSelected(true, false, true);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
this.selected.clone(newSelected);
|
|
359
|
+
this.api.dispatchEvent({
|
|
360
|
+
type: 'selectionChanged'
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}, {
|
|
365
|
+
key: "syncRowData",
|
|
366
|
+
value: function syncRowData() {
|
|
367
|
+
var dataSource = this.props.dataSource;
|
|
368
|
+
|
|
369
|
+
if (dataSource !== undefined && dataSource !== this.dataSource) {
|
|
370
|
+
this.setState({
|
|
371
|
+
total: dataSource.length
|
|
372
|
+
});
|
|
373
|
+
this.updateRowData(dataSource);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}, {
|
|
377
|
+
key: "getColumDefs",
|
|
378
|
+
value: function getColumDefs() {
|
|
379
|
+
var _this4 = this;
|
|
380
|
+
|
|
381
|
+
var _this$props5 = this.props,
|
|
382
|
+
_this$props5$columns = _this$props5.columns,
|
|
383
|
+
columns = _this$props5$columns === void 0 ? [] : _this$props5$columns,
|
|
384
|
+
rowActions = _this$props5.rowActions;
|
|
385
|
+
|
|
386
|
+
var map = function map(cols) {
|
|
387
|
+
return cols.map(function (item) {
|
|
388
|
+
var field = getColField(item);
|
|
389
|
+
|
|
390
|
+
if (isColumnType(item)) {
|
|
391
|
+
var _title = item.title,
|
|
392
|
+
key = item.key,
|
|
393
|
+
dataIndex = item.dataIndex,
|
|
394
|
+
align = item.align,
|
|
395
|
+
type = item.type,
|
|
396
|
+
fixed = item.fixed,
|
|
397
|
+
render = item.render,
|
|
398
|
+
_item$ellipsis = item.ellipsis,
|
|
399
|
+
ellipsis = _item$ellipsis === void 0 ? true : _item$ellipsis,
|
|
400
|
+
cellRenderer = item.cellRenderer,
|
|
401
|
+
cellRendererParams = item.cellRendererParams,
|
|
402
|
+
className = item.className,
|
|
403
|
+
sorter = item.sorter,
|
|
404
|
+
editable = item.editable,
|
|
405
|
+
_rest = _objectWithoutProperties(item, _excluded2);
|
|
406
|
+
|
|
407
|
+
var _opts = {
|
|
408
|
+
cellClass: className,
|
|
409
|
+
pinned: fixed,
|
|
410
|
+
lockPinned: true,
|
|
411
|
+
field: field,
|
|
412
|
+
type: type,
|
|
413
|
+
cellRenderer: cellRenderer,
|
|
414
|
+
cellRendererParams: cellRendererParams
|
|
415
|
+
}; // title
|
|
416
|
+
|
|
417
|
+
if (_typeof(_title) === 'object' || typeof _title === 'function') {
|
|
418
|
+
_opts.headerComponentParams = _objectSpread(_objectSpread({}, _opts.headerComponentParams), {}, {
|
|
419
|
+
title: typeof _title === 'function' ? _this4.colRenderer.toRef(field, 'title') : _title
|
|
420
|
+
});
|
|
421
|
+
} else if (_title !== undefined) {
|
|
422
|
+
_opts.headerName = _title.toString();
|
|
423
|
+
} // align
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
if (align === 'right') {
|
|
427
|
+
if (!_opts.type) {
|
|
428
|
+
_opts.type = [];
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
if (!Array.isArray(_opts.type)) {
|
|
432
|
+
_opts.type = [_opts.type];
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
_opts.type = [].concat(_toConsumableArray(_opts.type), ['rightAligned']);
|
|
436
|
+
} // render
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
if (!_opts.cellRenderer && render) {
|
|
440
|
+
_opts.cellRenderer = CellRenderer;
|
|
441
|
+
_opts.cellRendererParams = _objectSpread(_objectSpread({}, _opts.cellRendererParams), {}, {
|
|
442
|
+
render: _this4.colRenderer.toRef(field, 'render')
|
|
443
|
+
});
|
|
444
|
+
} // ellipsis
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
if (!ellipsis) {
|
|
448
|
+
_opts.wrapText = true;
|
|
449
|
+
_opts.autoHeight = true;
|
|
450
|
+
} // sorter
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
if (sorter) {
|
|
454
|
+
_opts.sortable = true;
|
|
455
|
+
|
|
456
|
+
if (typeof sorter === 'function') {
|
|
457
|
+
_opts.comparator = function (_1, _2, nodeA, nodeB) {
|
|
458
|
+
return sorter(nodeA.data, nodeB.data);
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
} else {
|
|
462
|
+
_opts.sortable = false;
|
|
463
|
+
} // editable
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
if (_typeof(editable) === 'object') {
|
|
467
|
+
var _type = editable.type,
|
|
468
|
+
params = editable.params,
|
|
469
|
+
_render = editable.render,
|
|
470
|
+
valueSetter = editable.valueSetter;
|
|
471
|
+
_opts.editable = true;
|
|
472
|
+
_opts.cellClassRules = _defineProperty({}, prefix('editor-cell'), function () {
|
|
473
|
+
return true;
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
if (_opts.cellRenderer === undefined) {
|
|
477
|
+
_opts.cellRenderer = CellRenderer;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if (_opts.valueSetter === undefined && valueSetter !== undefined) {
|
|
481
|
+
_opts.valueSetter = function (mParams) {
|
|
482
|
+
var field = mParams.colDef.field,
|
|
483
|
+
data = mParams.data,
|
|
484
|
+
newValue = mParams.newValue;
|
|
485
|
+
|
|
486
|
+
if (field) {
|
|
487
|
+
set(data, field, newValue);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
var result = valueSetter(mParams.newValue, mParams.data);
|
|
491
|
+
Object.assign(data, result);
|
|
492
|
+
return true;
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
switch (_type) {
|
|
497
|
+
case 'text':
|
|
498
|
+
_opts.cellEditor = TextEditor;
|
|
499
|
+
_opts.cellEditorParams = params;
|
|
500
|
+
break;
|
|
501
|
+
|
|
502
|
+
case 'number':
|
|
503
|
+
_opts.cellEditor = NumberEditor;
|
|
504
|
+
_opts.cellEditorParams = params;
|
|
505
|
+
break;
|
|
506
|
+
|
|
507
|
+
case 'date':
|
|
508
|
+
_opts.cellEditor = DateEditor;
|
|
509
|
+
_opts.cellEditorParams = params;
|
|
510
|
+
|
|
511
|
+
_opts.suppressKeyboardEvent = function (_ref2) {
|
|
512
|
+
var editing = _ref2.editing,
|
|
513
|
+
event = _ref2.event;
|
|
514
|
+
|
|
515
|
+
if (editing && event.key === 'Enter') {
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return false;
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
break;
|
|
523
|
+
|
|
524
|
+
case 'select':
|
|
525
|
+
_opts.cellEditor = SelectEditor;
|
|
526
|
+
_opts.cellEditorParams = params;
|
|
527
|
+
|
|
528
|
+
_opts.suppressKeyboardEvent = function (_ref3) {
|
|
529
|
+
var editing = _ref3.editing,
|
|
530
|
+
event = _ref3.event;
|
|
531
|
+
|
|
532
|
+
if (editing && event.key === 'Enter') {
|
|
533
|
+
return true;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return false;
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
break;
|
|
540
|
+
|
|
541
|
+
default:
|
|
542
|
+
if (_render !== undefined) {
|
|
543
|
+
_opts.cellEditor = Custom;
|
|
544
|
+
_opts.cellEditorParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
545
|
+
editableRender: _this4.colRenderer.toRef(field, 'editable.render')
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
if (_opts.valueSetter === undefined) {
|
|
549
|
+
_opts.valueSetter = function (mParams) {
|
|
550
|
+
Object.assign(mParams.data, mParams.newValue);
|
|
551
|
+
return true;
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
}
|
|
557
|
+
} else {
|
|
558
|
+
_opts.editable = editable;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return _objectSpread(_objectSpread({}, _opts), _rest);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
var title = item.title,
|
|
565
|
+
_item$children = item.children,
|
|
566
|
+
children = _item$children === void 0 ? [] : _item$children,
|
|
567
|
+
rest = _objectWithoutProperties(item, _excluded3);
|
|
568
|
+
|
|
569
|
+
var opts = {
|
|
570
|
+
children: map(children)
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
if (title !== undefined) {
|
|
574
|
+
opts.headerName = title.toString();
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
return _objectSpread(_objectSpread({}, opts), rest);
|
|
578
|
+
});
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
var result = map(columns);
|
|
582
|
+
var rowSelection = this.props.rowSelection;
|
|
583
|
+
|
|
584
|
+
if (rowSelection !== undefined && result.length > 0) {
|
|
585
|
+
result[0] = _objectSpread(_objectSpread({
|
|
586
|
+
checkboxSelection: true,
|
|
587
|
+
showDisabledCheckboxes: true,
|
|
588
|
+
headerCheckboxSelection: rowSelection.type !== 'radio'
|
|
589
|
+
}, result[0]), {}, {
|
|
590
|
+
headerComponent: HeaderRenderer
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (rowActions !== undefined) {
|
|
595
|
+
result.push({
|
|
596
|
+
colId: '__actions__',
|
|
597
|
+
pinned: 'right',
|
|
598
|
+
cellRenderer: CellRenderer,
|
|
599
|
+
width: 1,
|
|
600
|
+
maxWidth: 1,
|
|
601
|
+
headerName: '',
|
|
602
|
+
resizable: false,
|
|
603
|
+
sortable: false,
|
|
604
|
+
suppressAutoSize: true,
|
|
605
|
+
suppressMovable: true,
|
|
606
|
+
lockPinned: true,
|
|
607
|
+
lockVisible: true,
|
|
608
|
+
cellClass: prefix('operator-cell'),
|
|
609
|
+
headerClass: prefix('operator-cell'),
|
|
610
|
+
cellRendererParams: {
|
|
611
|
+
render: function render(_, data) {
|
|
612
|
+
var rowActions = _this4.props.rowActions;
|
|
613
|
+
|
|
614
|
+
if (rowActions !== undefined) {
|
|
615
|
+
return /*#__PURE__*/React.createElement(Actions, {
|
|
616
|
+
data: data,
|
|
617
|
+
actions: rowActions
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return null;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
return result;
|
|
628
|
+
}
|
|
629
|
+
}, {
|
|
630
|
+
key: "isClientMode",
|
|
631
|
+
value: function isClientMode() {
|
|
632
|
+
return this.props.dataSource !== undefined;
|
|
633
|
+
}
|
|
634
|
+
}, {
|
|
635
|
+
key: "updateRowData",
|
|
636
|
+
value: function updateRowData() {
|
|
637
|
+
var _this5 = this;
|
|
638
|
+
|
|
639
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
640
|
+
this.dataSource = data;
|
|
641
|
+
this.api.setRowData(data);
|
|
642
|
+
this.api.forEachNode(function (node) {
|
|
643
|
+
if (node.id && _this5.selected.has(node.id)) {
|
|
644
|
+
node.setSelected(true, false, true);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
this.api.dispatchEvent({
|
|
648
|
+
type: 'selectionChanged'
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
}, {
|
|
652
|
+
key: "getDataFromServer",
|
|
653
|
+
value: function getDataFromServer() {
|
|
654
|
+
var _this6 = this;
|
|
655
|
+
|
|
656
|
+
var fetch = this.props.fetch;
|
|
657
|
+
|
|
658
|
+
if (typeof fetch === 'function') {
|
|
659
|
+
if (this.requestId < Number.MAX_SAFE_INTEGER) {
|
|
660
|
+
this.requestId += 1;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
var _this$state = this.state,
|
|
664
|
+
page = _this$state.page,
|
|
665
|
+
pageSize = _this$state.pageSize;
|
|
666
|
+
var columnState = this.columnApi.getColumnState();
|
|
667
|
+
var id = this.requestId;
|
|
668
|
+
this.api.showLoadingOverlay();
|
|
669
|
+
fetch({
|
|
670
|
+
current: page,
|
|
671
|
+
pageSize: pageSize,
|
|
672
|
+
sort: columnState.filter(function (item) {
|
|
673
|
+
return item.sort !== undefined && item.sort !== null;
|
|
674
|
+
}).map(function (item) {
|
|
675
|
+
return {
|
|
676
|
+
field: item.colId,
|
|
677
|
+
order: item.sort === 'desc' ? 'descend' : 'ascend'
|
|
678
|
+
};
|
|
679
|
+
})
|
|
680
|
+
}).then(function (res) {
|
|
681
|
+
_this6.api.hideOverlay();
|
|
682
|
+
|
|
683
|
+
if (id !== _this6.requestId) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
if (res.total !== undefined) {
|
|
688
|
+
_this6.setState({
|
|
689
|
+
page: page,
|
|
690
|
+
pageSize: pageSize,
|
|
691
|
+
total: res.total
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
var _this6$props = _this6.props,
|
|
696
|
+
summary = _this6$props.summary,
|
|
697
|
+
onLoad = _this6$props.onLoad;
|
|
698
|
+
var pinned = [];
|
|
699
|
+
|
|
700
|
+
if (summary !== undefined) {
|
|
701
|
+
if (Array.isArray(summary)) {
|
|
702
|
+
pinned = summary;
|
|
703
|
+
} else {
|
|
704
|
+
pinned.push(summary);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (res.summary !== undefined && res.summary !== null) {
|
|
709
|
+
pinned.push(res.summary);
|
|
710
|
+
} // 重置滚动条
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
_this6.api.setRowData([]);
|
|
714
|
+
|
|
715
|
+
_this6.api.setPinnedBottomRowData(pinned);
|
|
716
|
+
|
|
717
|
+
_this6.updateRowData(res.data);
|
|
718
|
+
|
|
719
|
+
if (onLoad) {
|
|
720
|
+
onLoad(res.extra);
|
|
721
|
+
}
|
|
722
|
+
}).catch(function () {
|
|
723
|
+
_this6.api.hideOverlay();
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}, {
|
|
728
|
+
key: "sort",
|
|
729
|
+
value: function sort(evt) {
|
|
730
|
+
if (this.isClientMode()) {
|
|
731
|
+
var model = this.api.getModel();
|
|
732
|
+
model.onSortChanged(evt);
|
|
733
|
+
} else {
|
|
734
|
+
this.getDataFromServer();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}, {
|
|
738
|
+
key: "pagination",
|
|
739
|
+
value: function pagination(page, pageSize) {
|
|
740
|
+
var _this7 = this;
|
|
741
|
+
|
|
742
|
+
this.setState({
|
|
743
|
+
page: page,
|
|
744
|
+
pageSize: pageSize
|
|
745
|
+
}, function () {
|
|
746
|
+
if (_this7.isClientMode()) {
|
|
747
|
+
withSyncRender(function () {
|
|
748
|
+
_this7.api.paginationGoToPage(page - 1);
|
|
749
|
+
|
|
750
|
+
_this7.api.paginationSetPageSize(pageSize);
|
|
751
|
+
});
|
|
752
|
+
} else {
|
|
753
|
+
_this7.getDataFromServer();
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
}, {
|
|
758
|
+
key: "LoadingOverlay",
|
|
759
|
+
value: function LoadingOverlay() {
|
|
760
|
+
return /*#__PURE__*/React.createElement(Spin, null);
|
|
761
|
+
}
|
|
762
|
+
}, {
|
|
763
|
+
key: "NoRowsOverlay",
|
|
764
|
+
value: function NoRowsOverlay() {
|
|
765
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
766
|
+
className: prefix('empty')
|
|
767
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
768
|
+
src: empty
|
|
769
|
+
}), /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"));
|
|
770
|
+
}
|
|
771
|
+
}, {
|
|
772
|
+
key: "getMainMenuItems",
|
|
773
|
+
value: function getMainMenuItems(params) {
|
|
774
|
+
if (params.defaultItems.includes('pinSubMenu')) {
|
|
775
|
+
return params.defaultItems;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return ['pinSubMenu', 'separator'].concat(_toConsumableArray(params.defaultItems));
|
|
779
|
+
}
|
|
780
|
+
}, {
|
|
781
|
+
key: "validateRecord",
|
|
782
|
+
value: function validateRecord(record) {
|
|
783
|
+
var _this8 = this;
|
|
784
|
+
|
|
785
|
+
if (this.validator === null) {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
var rowId = this.getRowId({
|
|
790
|
+
data: record
|
|
791
|
+
});
|
|
792
|
+
return this.validator.validate(record).then(function () {
|
|
793
|
+
var errors = new Map(_this8.store.getState().errors);
|
|
794
|
+
var error = errors.get(rowId);
|
|
795
|
+
|
|
796
|
+
if (error === undefined) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
errors.delete(rowId);
|
|
801
|
+
|
|
802
|
+
_this8.store.setState({
|
|
803
|
+
errors: errors
|
|
804
|
+
});
|
|
805
|
+
}).catch(function (_ref4) {
|
|
806
|
+
var fields = _ref4.fields;
|
|
807
|
+
var errors = new Map(_this8.store.getState().errors);
|
|
808
|
+
var error = new Map();
|
|
809
|
+
Object.entries(fields).forEach(function (item) {
|
|
810
|
+
error.set(item[0], item[1].map(function (err) {
|
|
811
|
+
return err.message || "".concat(item[0], "\u8F93\u5165\u9519\u8BEF");
|
|
812
|
+
}));
|
|
813
|
+
});
|
|
814
|
+
errors.set(rowId, error);
|
|
815
|
+
|
|
816
|
+
_this8.store.setState({
|
|
817
|
+
errors: errors
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
}, {
|
|
822
|
+
key: "validate",
|
|
823
|
+
value: function () {
|
|
824
|
+
var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
825
|
+
var _this9 = this;
|
|
826
|
+
|
|
827
|
+
var result, flag, errors, failed;
|
|
828
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
829
|
+
while (1) {
|
|
830
|
+
switch (_context.prev = _context.next) {
|
|
831
|
+
case 0:
|
|
832
|
+
_context.next = 2;
|
|
833
|
+
return Promise.allSettled(this.dataSource.map(function (record) {
|
|
834
|
+
var rowId = _this9.getRowId({
|
|
835
|
+
data: record
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
if (_this9.validator === null) {
|
|
839
|
+
return Promise.resolve(true);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
return _this9.validator.validate(record).catch(function (_ref5) {
|
|
843
|
+
var fields = _ref5.fields;
|
|
844
|
+
return Promise.reject({
|
|
845
|
+
id: rowId,
|
|
846
|
+
fields: fields
|
|
847
|
+
});
|
|
848
|
+
});
|
|
849
|
+
}));
|
|
850
|
+
|
|
851
|
+
case 2:
|
|
852
|
+
result = _context.sent;
|
|
853
|
+
flag = false;
|
|
854
|
+
errors = new Map();
|
|
855
|
+
failed = [];
|
|
856
|
+
result.forEach(function (item) {
|
|
857
|
+
if (item.status === 'rejected') {
|
|
858
|
+
var _ref6 = item.reason,
|
|
859
|
+
id = _ref6.id,
|
|
860
|
+
fields = _ref6.fields;
|
|
861
|
+
var error = new Map();
|
|
862
|
+
Object.entries(fields).forEach(function (item) {
|
|
863
|
+
error.set(item[0], item[1].map(function (err) {
|
|
864
|
+
return err.message || "".concat(item[0], "\u8F93\u5165\u9519\u8BEF");
|
|
865
|
+
}));
|
|
866
|
+
});
|
|
867
|
+
errors.set(id, error);
|
|
868
|
+
failed.push(item.reason);
|
|
869
|
+
flag = true;
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
if (!flag) {
|
|
874
|
+
_context.next = 10;
|
|
875
|
+
break;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
this.store.setState({
|
|
879
|
+
errors: errors
|
|
880
|
+
});
|
|
881
|
+
return _context.abrupt("return", Promise.reject(failed));
|
|
882
|
+
|
|
883
|
+
case 10:
|
|
884
|
+
return _context.abrupt("return", true);
|
|
885
|
+
|
|
886
|
+
case 11:
|
|
887
|
+
case "end":
|
|
888
|
+
return _context.stop();
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}, _callee, this);
|
|
892
|
+
}));
|
|
893
|
+
|
|
894
|
+
function validate() {
|
|
895
|
+
return _validate.apply(this, arguments);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
return validate;
|
|
899
|
+
}()
|
|
900
|
+
}, {
|
|
901
|
+
key: "fetch",
|
|
902
|
+
value: function fetch(page) {
|
|
903
|
+
var _this10 = this;
|
|
904
|
+
|
|
905
|
+
var curr = page || 1;
|
|
906
|
+
|
|
907
|
+
var delay = function delay() {
|
|
908
|
+
if (_this10.isReady) {
|
|
909
|
+
_this10.getDataFromServer();
|
|
910
|
+
} else {
|
|
911
|
+
requestAnimationFrame(delay);
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
this.setState({
|
|
916
|
+
page: curr
|
|
917
|
+
}, delay);
|
|
918
|
+
}
|
|
919
|
+
}, {
|
|
920
|
+
key: "refresh",
|
|
921
|
+
value: function refresh() {
|
|
922
|
+
this.getDataFromServer();
|
|
923
|
+
}
|
|
924
|
+
}, {
|
|
925
|
+
key: "render",
|
|
926
|
+
value: function render() {
|
|
927
|
+
var _this11 = this;
|
|
928
|
+
|
|
929
|
+
var _this$props6 = this.props,
|
|
930
|
+
rowSelection = _this$props6.rowSelection,
|
|
931
|
+
rowKey = _this$props6.rowKey,
|
|
932
|
+
fetch = _this$props6.fetch,
|
|
933
|
+
dataSource = _this$props6.dataSource,
|
|
934
|
+
summary = _this$props6.summary,
|
|
935
|
+
rowActions = _this$props6.rowActions,
|
|
936
|
+
context = _this$props6.context,
|
|
937
|
+
onGridReady = _this$props6.onGridReady,
|
|
938
|
+
pagination = _this$props6.pagination,
|
|
939
|
+
defaultColDefProp = _this$props6.defaultColDef,
|
|
940
|
+
restProps = _objectWithoutProperties(_this$props6, _excluded4);
|
|
941
|
+
|
|
942
|
+
var _this$state2 = this.state,
|
|
943
|
+
colDefs = _this$state2.colDefs,
|
|
944
|
+
enablePagination = _this$state2.pagination,
|
|
945
|
+
page = _this$state2.page,
|
|
946
|
+
pageSize = _this$state2.pageSize,
|
|
947
|
+
total = _this$state2.total;
|
|
948
|
+
var mPage = _typeof(pagination) === 'object' ? pagination : {};
|
|
949
|
+
return /*#__PURE__*/React.createElement(GridContext.Provider, {
|
|
950
|
+
value: this.store
|
|
951
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
952
|
+
className: "ag-theme-lemon ".concat(prefix()),
|
|
953
|
+
style: restProps.domLayout === 'autoHeight' ? {
|
|
954
|
+
height: 'auto'
|
|
955
|
+
} : undefined
|
|
956
|
+
}, /*#__PURE__*/React.createElement(AgGridReact, _extends({
|
|
957
|
+
singleClickEdit: true,
|
|
958
|
+
suppressPaginationPanel: true,
|
|
959
|
+
onCellValueChanged: this.cellValueChanged,
|
|
960
|
+
onCellEditingStopped: this.cellEditingStop,
|
|
961
|
+
loadingOverlayComponent: this.LoadingOverlay,
|
|
962
|
+
noRowsOverlayComponent: this.NoRowsOverlay,
|
|
963
|
+
getMainMenuItems: this.getMainMenuItems,
|
|
964
|
+
rowData: this.emptyRowData,
|
|
965
|
+
components: {
|
|
966
|
+
headerComponent: HeaderRenderer
|
|
967
|
+
}
|
|
968
|
+
}, restProps, {
|
|
969
|
+
pagination: enablePagination,
|
|
970
|
+
paginationPageSize: pageSize,
|
|
971
|
+
columnDefs: colDefs,
|
|
972
|
+
getRowId: this.getRowId,
|
|
973
|
+
onGridReady: this.init,
|
|
974
|
+
context: context,
|
|
975
|
+
rowSelection: rowSelection !== undefined ? rowSelection.type !== 'radio' ? 'multiple' : 'single' : undefined,
|
|
976
|
+
defaultColDef: _objectSpread(_objectSpread({}, defaultColDef), defaultColDefProp),
|
|
977
|
+
pinnedBottomRowData: Array.isArray(summary) ? summary : summary ? [summary] : undefined
|
|
978
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
979
|
+
className: prefix('bottom')
|
|
980
|
+
}, /*#__PURE__*/React.createElement("div", null), enablePagination && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
981
|
+
size: "small",
|
|
982
|
+
showPrevNextJumpers: true,
|
|
983
|
+
showSizeChanger: true,
|
|
984
|
+
showQuickJumper: true,
|
|
985
|
+
showTotal: function showTotal(val) {
|
|
986
|
+
return "\u5171".concat(val, "\u6761");
|
|
987
|
+
},
|
|
988
|
+
defaultCurrent: 1,
|
|
989
|
+
defaultPageSize: 20,
|
|
990
|
+
pageSizeOptions: ['10', '20', '50', '100']
|
|
991
|
+
}, mPage, {
|
|
992
|
+
pageSize: pageSize,
|
|
993
|
+
current: page,
|
|
994
|
+
total: total,
|
|
995
|
+
onChange: function onChange(page, pageSize) {
|
|
996
|
+
_this11.pagination(page, pageSize);
|
|
997
|
+
|
|
998
|
+
if (mPage.onChange) {
|
|
999
|
+
mPage.onChange(page, pageSize);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
})))));
|
|
1003
|
+
}
|
|
1004
|
+
}]);
|
|
1005
|
+
|
|
1006
|
+
return DataGrid;
|
|
1007
|
+
}(Component);
|
|
1008
|
+
|
|
1009
|
+
_defineProperty(DataGrid, "defaultProps", {
|
|
1010
|
+
autoLoad: false,
|
|
1011
|
+
columnTypes: columnTypes,
|
|
1012
|
+
localeText: {
|
|
1013
|
+
copy: '复制',
|
|
1014
|
+
copyWithHeaders: '复制(带表头)',
|
|
1015
|
+
copyWithGroupHeaders: '复制(带表头分组)',
|
|
1016
|
+
paste: '粘贴',
|
|
1017
|
+
export: '导出',
|
|
1018
|
+
csvExport: 'CSV 导出',
|
|
1019
|
+
searchOoo: '搜索',
|
|
1020
|
+
autosizeThiscolumn: '当前列宽自适应',
|
|
1021
|
+
autosizeAllColumns: '所有列宽自适应',
|
|
1022
|
+
resetColumns: '重置所有列',
|
|
1023
|
+
pinColumn: '固定列',
|
|
1024
|
+
pinLeft: '固定在左侧',
|
|
1025
|
+
pinRight: '固定在右侧',
|
|
1026
|
+
noPin: '不固定',
|
|
1027
|
+
expandAll: '展开所有',
|
|
1028
|
+
collapseAll: '折叠所有'
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
|
|
1032
|
+
_defineProperty(DataGrid, "EmptyCol", {
|
|
1033
|
+
field: '__empty_column__',
|
|
1034
|
+
flex: 1,
|
|
1035
|
+
resizable: false,
|
|
1036
|
+
suppressMovable: true,
|
|
1037
|
+
headerName: '',
|
|
1038
|
+
suppressNavigable: true,
|
|
1039
|
+
lockVisible: true,
|
|
1040
|
+
suppressMenu: true
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
_defineProperty(DataGrid, "Editors", {
|
|
1044
|
+
Text: TextEditor,
|
|
1045
|
+
Date: DateEditor,
|
|
1046
|
+
Number: NumberEditor,
|
|
1047
|
+
Select: SelectEditor,
|
|
1048
|
+
Wrapper: EditorWrapper
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
export { DataGrid as default };
|