@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,75 @@
|
|
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
|
2
|
+
import { Link, matchPath, useRouteMatch } from 'react-router-dom';
|
|
3
|
+
import { Breadcrumb as AntdBreadcrumb } from 'antd';
|
|
4
|
+
import { uniqBy } from 'lodash';
|
|
5
|
+
import { RouteTabContext } from "../components/RouteTab";
|
|
6
|
+
var BreadcrumbItem = AntdBreadcrumb.Item;
|
|
7
|
+
export default function Breadcrumb(props) {
|
|
8
|
+
var children = props.children;
|
|
9
|
+
|
|
10
|
+
var _useRouteMatch = useRouteMatch(),
|
|
11
|
+
path = _useRouteMatch.path,
|
|
12
|
+
url = _useRouteMatch.url;
|
|
13
|
+
|
|
14
|
+
var _useContext = useContext(RouteTabContext),
|
|
15
|
+
route = _useContext.route;
|
|
16
|
+
|
|
17
|
+
var items = useMemo(function () {
|
|
18
|
+
var pathSet = new Set();
|
|
19
|
+
path.replace(/^\//, '').split(/\//).reduce(function (prev, item) {
|
|
20
|
+
var next = prev + '/' + item;
|
|
21
|
+
pathSet.add(next);
|
|
22
|
+
return next;
|
|
23
|
+
}, '');
|
|
24
|
+
var nodes = [];
|
|
25
|
+
|
|
26
|
+
var traverse = function traverse(routes) {
|
|
27
|
+
for (var i = 0; i < routes.length; i++) {
|
|
28
|
+
var curr = routes[i];
|
|
29
|
+
|
|
30
|
+
if (curr.title === undefined) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var matched = matchPath(url, {
|
|
35
|
+
strict: curr.strict,
|
|
36
|
+
sensitive: curr.sensitive,
|
|
37
|
+
path: curr.path,
|
|
38
|
+
exact: curr.exact
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (matched !== null) {
|
|
42
|
+
if (pathSet.has(matched.path)) {
|
|
43
|
+
nodes.push({
|
|
44
|
+
title: curr.title,
|
|
45
|
+
url: matched.url
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!matched.isExact) {
|
|
50
|
+
if (curr.routes !== undefined) {
|
|
51
|
+
traverse(curr.routes);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
traverse([route]);
|
|
62
|
+
return uniqBy(nodes, 'title');
|
|
63
|
+
}, []);
|
|
64
|
+
return /*#__PURE__*/React.createElement(AntdBreadcrumb, {
|
|
65
|
+
style: {
|
|
66
|
+
fontWeight: 'normal'
|
|
67
|
+
}
|
|
68
|
+
}, children || items.map(function (item, index) {
|
|
69
|
+
return /*#__PURE__*/React.createElement(BreadcrumbItem, {
|
|
70
|
+
key: item.url
|
|
71
|
+
}, item.url && index < items.length - 1 ? /*#__PURE__*/React.createElement(Link, {
|
|
72
|
+
to: item.url
|
|
73
|
+
}, item.title) : item.title);
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MicroLayoutProps } from './typings';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
routerBase: string;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare function MicroLayout(props: MicroLayoutProps): JSX.Element;
|
|
9
|
+
declare const _default: React.MemoExoticComponent<typeof MicroLayout>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
import React, { memo } from 'react';
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
|
+
import { matchPath, useHistory } from 'react-router-dom';
|
|
10
|
+
import RouteTab from "../components/RouteTab";
|
|
11
|
+
|
|
12
|
+
function MicroLayout(props) {
|
|
13
|
+
var _tabs$active;
|
|
14
|
+
|
|
15
|
+
var _props$routes = props.routes,
|
|
16
|
+
routes = _props$routes === void 0 ? [] : _props$routes,
|
|
17
|
+
authorities = props.authorities,
|
|
18
|
+
tabs = props.tabs,
|
|
19
|
+
active = props.active;
|
|
20
|
+
var history = useHistory();
|
|
21
|
+
var auth = useMemo(function () {
|
|
22
|
+
if (authorities === undefined) {
|
|
23
|
+
return authorities;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return new Set(authorities);
|
|
27
|
+
}, [authorities]);
|
|
28
|
+
var basename = useMemo(function () {
|
|
29
|
+
return window.routerBase;
|
|
30
|
+
}, []);
|
|
31
|
+
var key = (_tabs$active = tabs[active]) === null || _tabs$active === void 0 ? void 0 : _tabs$active.rootPath;
|
|
32
|
+
var routeTabs = useMemo(function () {
|
|
33
|
+
return tabs.filter(function (tab) {
|
|
34
|
+
return new RegExp("".concat(basename, "\\b")).test(tab.rootPath);
|
|
35
|
+
}).map(function (item) {
|
|
36
|
+
var tab = _objectSpread(_objectSpread({}, item), {}, {
|
|
37
|
+
location: _objectSpread(_objectSpread({}, item.location), {}, {
|
|
38
|
+
pathname: item.location.pathname.replace(basename, '')
|
|
39
|
+
}),
|
|
40
|
+
route: null,
|
|
41
|
+
match: null
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
var findRoute = function findRoute(items) {
|
|
45
|
+
for (var i = 0; i < items.length; i++) {
|
|
46
|
+
var route = items[i];
|
|
47
|
+
var result = route.path ? matchPath(tab.location.pathname, {
|
|
48
|
+
path: route.path,
|
|
49
|
+
strict: route.strict,
|
|
50
|
+
sensitive: route.sensitive
|
|
51
|
+
}) : null;
|
|
52
|
+
|
|
53
|
+
if (result !== null) {
|
|
54
|
+
if (result.isExact || route.component && !route.exact) {
|
|
55
|
+
return {
|
|
56
|
+
route: route,
|
|
57
|
+
match: result
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (route.routes) {
|
|
62
|
+
var target = findRoute(route.routes);
|
|
63
|
+
|
|
64
|
+
if (target) {
|
|
65
|
+
return target;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return null;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var matched = findRoute(routes);
|
|
75
|
+
|
|
76
|
+
if (matched !== null) {
|
|
77
|
+
tab.match = matched.match;
|
|
78
|
+
tab.route = matched.route;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return tab;
|
|
82
|
+
});
|
|
83
|
+
}, [tabs, routes]);
|
|
84
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, routeTabs.map(function (tab, index) {
|
|
85
|
+
var route = tab.route;
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
key: tab.rootPath,
|
|
88
|
+
style: {
|
|
89
|
+
display: key !== tab.rootPath ? 'none' : undefined,
|
|
90
|
+
width: '100%',
|
|
91
|
+
height: '100%'
|
|
92
|
+
}
|
|
93
|
+
}, route !== null && tab.match !== null && /*#__PURE__*/React.createElement(RouteTab, {
|
|
94
|
+
authorities: auth,
|
|
95
|
+
routes: routes,
|
|
96
|
+
index: index,
|
|
97
|
+
history: history,
|
|
98
|
+
route: route,
|
|
99
|
+
location: tab.location,
|
|
100
|
+
match: tab.match
|
|
101
|
+
}));
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default /*#__PURE__*/memo(MicroLayout);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode, ReactText } from 'react';
|
|
2
|
+
import type { IRoute, Location } from '../BasicLayout/typings';
|
|
3
|
+
|
|
4
|
+
export interface MicroLayoutProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 路由配置
|
|
7
|
+
*/
|
|
8
|
+
routes?: IRoute[];
|
|
9
|
+
/**
|
|
10
|
+
* @description 用户包含的所有权限
|
|
11
|
+
*/
|
|
12
|
+
authorities?: ReactText[] | Set<ReactText>;
|
|
13
|
+
/**
|
|
14
|
+
* @description 主应用tabs
|
|
15
|
+
*/
|
|
16
|
+
tabs: {
|
|
17
|
+
title: string;
|
|
18
|
+
rootPath: string;
|
|
19
|
+
location: Location;
|
|
20
|
+
}[];
|
|
21
|
+
/**
|
|
22
|
+
* @description 当前active tab
|
|
23
|
+
*/
|
|
24
|
+
active: number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
import React, { useContext, useRef } from 'react';
|
|
8
|
+
import { __RouterContext as RouterContext } from 'react-router';
|
|
9
|
+
export default function CachableRoute(props) {
|
|
10
|
+
var context = useContext(RouterContext);
|
|
11
|
+
var node = useRef(null);
|
|
12
|
+
var location = context.location;
|
|
13
|
+
var render = props.render,
|
|
14
|
+
layoutProps = props.layoutProps,
|
|
15
|
+
match = props.computedMatch;
|
|
16
|
+
|
|
17
|
+
var newProps = _objectSpread(_objectSpread({}, context), {}, {
|
|
18
|
+
location: location,
|
|
19
|
+
match: match
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
var focused = match !== null;
|
|
23
|
+
|
|
24
|
+
if (focused) {
|
|
25
|
+
node.current = /*#__PURE__*/React.createElement(RouterContext.Provider, {
|
|
26
|
+
value: newProps
|
|
27
|
+
}, render(_objectSpread(_objectSpread({}, layoutProps), newProps)));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
style: {
|
|
32
|
+
display: focused ? undefined : 'none',
|
|
33
|
+
width: '100%',
|
|
34
|
+
height: '100%',
|
|
35
|
+
overflow: 'auto'
|
|
36
|
+
}
|
|
37
|
+
}, node.current);
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactText } from 'react';
|
|
3
|
+
import { type match } from 'react-router';
|
|
4
|
+
import type { IRoute, Location } from '../typings';
|
|
5
|
+
interface Props {
|
|
6
|
+
route: IRoute;
|
|
7
|
+
routes: IRoute[];
|
|
8
|
+
index: number;
|
|
9
|
+
location: Location;
|
|
10
|
+
match: match;
|
|
11
|
+
history: any;
|
|
12
|
+
authorities?: Set<ReactText>;
|
|
13
|
+
pathAuthorities?: Map<string, ReactText | ReactText[]>;
|
|
14
|
+
}
|
|
15
|
+
export declare const RouteTabContext: React.Context<{
|
|
16
|
+
route: IRoute;
|
|
17
|
+
match: match;
|
|
18
|
+
}>;
|
|
19
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { createContext, memo, useMemo } from 'react';
|
|
2
|
+
import { __RouterContext as RouterContext } from 'react-router';
|
|
3
|
+
import { getRouteElement } from "../utils";
|
|
4
|
+
export var RouteTabContext = /*#__PURE__*/createContext({});
|
|
5
|
+
export default /*#__PURE__*/memo(function RouteTab(props) {
|
|
6
|
+
var route = props.route,
|
|
7
|
+
index = props.index,
|
|
8
|
+
location = props.location,
|
|
9
|
+
match = props.match,
|
|
10
|
+
history = props.history,
|
|
11
|
+
routes = props.routes,
|
|
12
|
+
authorities = props.authorities,
|
|
13
|
+
pathAuthorities = props.pathAuthorities;
|
|
14
|
+
var ctx = useMemo(function () {
|
|
15
|
+
return {
|
|
16
|
+
match: match,
|
|
17
|
+
route: route
|
|
18
|
+
};
|
|
19
|
+
}, [route]);
|
|
20
|
+
return /*#__PURE__*/React.createElement(RouterContext.Provider, {
|
|
21
|
+
value: {
|
|
22
|
+
history: history,
|
|
23
|
+
location: location,
|
|
24
|
+
match: match
|
|
25
|
+
}
|
|
26
|
+
}, /*#__PURE__*/React.createElement(RouteTabContext.Provider, {
|
|
27
|
+
value: ctx
|
|
28
|
+
}, getRouteElement({
|
|
29
|
+
route: route,
|
|
30
|
+
index: index,
|
|
31
|
+
opts: {
|
|
32
|
+
routes: route.routes || [],
|
|
33
|
+
rootRoutes: routes,
|
|
34
|
+
authorities: authorities,
|
|
35
|
+
pathAuthorities: pathAuthorities
|
|
36
|
+
}
|
|
37
|
+
})));
|
|
38
|
+
}, function (prev, next) {
|
|
39
|
+
return !!next.location.key && prev.location.key === next.location.key;
|
|
40
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var _excluded = ["children"];
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
import React, { isValidElement, Children, cloneElement, useRef } from 'react';
|
|
14
|
+
import { __RouterContext as RouterContext, matchPath } from 'react-router';
|
|
15
|
+
export default function Switch(props) {
|
|
16
|
+
var record = useRef(new Set());
|
|
17
|
+
return /*#__PURE__*/React.createElement(RouterContext.Consumer, null, function (context) {
|
|
18
|
+
var children = props.children,
|
|
19
|
+
extraProps = _objectWithoutProperties(props, _excluded);
|
|
20
|
+
|
|
21
|
+
var location = context.location;
|
|
22
|
+
var elements = [];
|
|
23
|
+
var match = null;
|
|
24
|
+
Children.forEach(children, function (child) {
|
|
25
|
+
if (! /*#__PURE__*/isValidElement(child)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var path = child.props.path || child.props.from;
|
|
30
|
+
|
|
31
|
+
if (match === null) {
|
|
32
|
+
match = path ? matchPath(location.pathname, _objectSpread(_objectSpread({}, child.props), {}, {
|
|
33
|
+
path: path
|
|
34
|
+
})) : context.match;
|
|
35
|
+
|
|
36
|
+
if (match !== null) {
|
|
37
|
+
elements.push( /*#__PURE__*/cloneElement(child, {
|
|
38
|
+
location: location,
|
|
39
|
+
computedMatch: match,
|
|
40
|
+
layoutProps: extraProps
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
if (child.props.keepAlive) {
|
|
44
|
+
record.current.add(child.key);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (record.current.has(child.key)) {
|
|
52
|
+
elements.push( /*#__PURE__*/cloneElement(child, {
|
|
53
|
+
location: location,
|
|
54
|
+
computedMatch: path ? matchPath(location.pathname, _objectSpread(_objectSpread({}, child.props), {}, {
|
|
55
|
+
path: path
|
|
56
|
+
})) : context.match,
|
|
57
|
+
layoutProps: extraProps
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return elements;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactText } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface IComponent extends FunctionComponent {
|
|
4
|
+
getInitialProps?: Function;
|
|
5
|
+
preload?: () => Promise<any>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IRoute {
|
|
9
|
+
path?: string;
|
|
10
|
+
exact?: boolean;
|
|
11
|
+
redirect?: string;
|
|
12
|
+
component?: IComponent | string;
|
|
13
|
+
routes?: IRoute[];
|
|
14
|
+
key?: any;
|
|
15
|
+
strict?: boolean;
|
|
16
|
+
sensitive?: boolean;
|
|
17
|
+
wrappers?: any[];
|
|
18
|
+
authority?: (string | number)[];
|
|
19
|
+
keepAlive?: boolean;
|
|
20
|
+
title?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Location {
|
|
24
|
+
key?: string;
|
|
25
|
+
pathname: string;
|
|
26
|
+
search: string;
|
|
27
|
+
hash: string;
|
|
28
|
+
state: any;
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactText } from 'react';
|
|
2
|
+
import type { IRoute } from './typings';
|
|
3
|
+
interface IOpts {
|
|
4
|
+
routes: IRoute[];
|
|
5
|
+
rootRoutes?: IRoute[];
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* 所有权限
|
|
9
|
+
*/
|
|
10
|
+
authorities?: Set<ReactText>;
|
|
11
|
+
/**
|
|
12
|
+
* @description
|
|
13
|
+
* 路径对应的权限
|
|
14
|
+
*/
|
|
15
|
+
pathAuthorities?: Map<string, ReactText | ReactText[]>;
|
|
16
|
+
}
|
|
17
|
+
interface IGetRouteElementOpts {
|
|
18
|
+
route: IRoute;
|
|
19
|
+
index: number;
|
|
20
|
+
opts: IOpts;
|
|
21
|
+
}
|
|
22
|
+
export declare function getRouteElement({ route, index, opts }: IGetRouteElementOpts): JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
|
|
11
|
+
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."); }
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
+
|
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
import React, { createElement } from 'react';
|
|
22
|
+
import { Result } from 'antd';
|
|
23
|
+
import { Redirect, Route } from 'react-router';
|
|
24
|
+
import { matchPath } from 'react-router';
|
|
25
|
+
import CachableRoute from "./components/CachableRoute";
|
|
26
|
+
import Switch from "./components/Switch";
|
|
27
|
+
|
|
28
|
+
var getMatchedAuth = function getMatchedAuth(url, data) {
|
|
29
|
+
var keys = _toConsumableArray(data.keys());
|
|
30
|
+
|
|
31
|
+
var len = 0;
|
|
32
|
+
var result;
|
|
33
|
+
|
|
34
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
35
|
+
var path = keys[i].split('?')[0];
|
|
36
|
+
var matched = matchPath(url, path);
|
|
37
|
+
|
|
38
|
+
if (matched !== null && (matched.isExact || path.length > len)) {
|
|
39
|
+
result = data.get(keys[i]);
|
|
40
|
+
len = path.length;
|
|
41
|
+
|
|
42
|
+
if (matched.isExact) {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
function _render(_ref) {
|
|
52
|
+
var route = _ref.route,
|
|
53
|
+
opts = _ref.opts,
|
|
54
|
+
props = _ref.props;
|
|
55
|
+
var routes = renderRoutes(_objectSpread(_objectSpread({}, opts), {}, {
|
|
56
|
+
routes: route.routes || [],
|
|
57
|
+
rootRoutes: opts.rootRoutes
|
|
58
|
+
}));
|
|
59
|
+
var Component = route.component,
|
|
60
|
+
wrappers = route.wrappers,
|
|
61
|
+
authority = route.authority;
|
|
62
|
+
|
|
63
|
+
if (authority === undefined && opts.pathAuthorities !== undefined) {
|
|
64
|
+
var matchedAuth = getMatchedAuth(props.match.url, opts.pathAuthorities);
|
|
65
|
+
|
|
66
|
+
if (matchedAuth !== undefined) {
|
|
67
|
+
authority = typeof matchedAuth === 'string' || typeof matchedAuth === 'number' ? [matchedAuth] : matchedAuth;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (authority !== undefined) {
|
|
72
|
+
var authorities = opts.authorities;
|
|
73
|
+
var flag = false;
|
|
74
|
+
|
|
75
|
+
if (authorities !== undefined) {
|
|
76
|
+
for (var i = 0; i < authority.length; i += 1) {
|
|
77
|
+
if (authorities.has(authority[i])) {
|
|
78
|
+
flag = true;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!flag) {
|
|
85
|
+
return /*#__PURE__*/React.createElement(Result, {
|
|
86
|
+
status: "403",
|
|
87
|
+
title: "403",
|
|
88
|
+
subTitle: "\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u65E0\u6743\u8BBF\u95EE\u5F53\u524D\u9875\u9762"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (Component) {
|
|
94
|
+
var newProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
95
|
+
route: route,
|
|
96
|
+
routes: opts.rootRoutes
|
|
97
|
+
}); // @ts-ignore
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
var ret = /*#__PURE__*/React.createElement(Component, newProps, routes); // route.wrappers
|
|
101
|
+
|
|
102
|
+
if (wrappers) {
|
|
103
|
+
var len = wrappers.length - 1;
|
|
104
|
+
|
|
105
|
+
while (len >= 0) {
|
|
106
|
+
ret = /*#__PURE__*/createElement(wrappers[len], newProps, ret);
|
|
107
|
+
len -= 1;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return ret;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return routes;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function getRouteElement(_ref2) {
|
|
118
|
+
var route = _ref2.route,
|
|
119
|
+
index = _ref2.index,
|
|
120
|
+
opts = _ref2.opts;
|
|
121
|
+
var routeProps = {
|
|
122
|
+
key: route.key || route.path || index,
|
|
123
|
+
exact: route.exact,
|
|
124
|
+
strict: route.strict,
|
|
125
|
+
sensitive: route.sensitive,
|
|
126
|
+
path: route.path
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
if (route.redirect) {
|
|
130
|
+
return /*#__PURE__*/React.createElement(Redirect, _extends({}, routeProps, {
|
|
131
|
+
from: route.path,
|
|
132
|
+
to: route.redirect
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (route.keepAlive) {
|
|
137
|
+
return /*#__PURE__*/React.createElement(CachableRoute, _extends({}, routeProps, {
|
|
138
|
+
keepAlive: true,
|
|
139
|
+
render: function render(props) {
|
|
140
|
+
return _render({
|
|
141
|
+
route: route,
|
|
142
|
+
opts: opts,
|
|
143
|
+
props: props
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return /*#__PURE__*/React.createElement(Route, _extends({}, routeProps, {
|
|
150
|
+
render: function render(props) {
|
|
151
|
+
return _render({
|
|
152
|
+
route: route,
|
|
153
|
+
opts: opts,
|
|
154
|
+
props: props
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function renderRoutes(opts) {
|
|
161
|
+
if (opts.routes) {
|
|
162
|
+
var children = opts.routes.map(function (route, index) {
|
|
163
|
+
return getRouteElement({
|
|
164
|
+
route: route,
|
|
165
|
+
index: index,
|
|
166
|
+
opts: _objectSpread(_objectSpread({}, opts), {}, {
|
|
167
|
+
rootRoutes: opts.rootRoutes || opts.routes
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
return /*#__PURE__*/React.createElement(Switch, null, children);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return null;
|
|
175
|
+
}
|