@done-coding/admin-core 0.17.1-alpha.0 → 0.18.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -1
- package/es/_virtual/_plugin-vue_export-helper.mjs +7 -6
- package/es/bridge/config-hook.mjs +49 -37
- package/es/bridge/index.mjs +152 -109
- package/es/bridge/layout.mjs +45 -31
- package/es/bridge/plugin.mjs +22 -12
- package/es/bridge/route.mjs +59 -50
- package/es/bridge/state.mjs +54 -39
- package/es/bridge/storage.mjs +18 -8
- package/es/bridge/theme/index.mjs +200 -97
- package/es/bridge/theme/persist.mjs +11 -7
- package/es/bridge/theme/system-dark.mjs +13 -6
- package/es/components/app-layout/AppAside.vue.mjs +4 -4
- package/es/components/app-layout/AppAside.vue2.mjs +37 -30
- package/es/components/app-layout/AppBody.vue.mjs +4 -4
- package/es/components/app-layout/AppBody.vue2.mjs +97 -60
- package/es/components/app-layout/AppBreadcrumb.vue.mjs +4 -4
- package/es/components/app-layout/AppBreadcrumb.vue2.mjs +59 -38
- package/es/components/app-layout/AppCollapseToggle.vue.mjs +4 -4
- package/es/components/app-layout/AppCollapseToggle.vue2.mjs +51 -42
- package/es/components/app-layout/AppFooter.vue.mjs +4 -4
- package/es/components/app-layout/AppFooter.vue2.mjs +15 -12
- package/es/components/app-layout/AppHeader.vue.mjs +4 -4
- package/es/components/app-layout/AppHeader.vue2.mjs +81 -58
- package/es/components/app-layout/AppLayout.vue.mjs +4 -4
- package/es/components/app-layout/AppLayout.vue2.mjs +148 -112
- package/es/components/app-layout/AppPage.vue.mjs +4 -4
- package/es/components/app-layout/AppPage.vue2.mjs +254 -197
- package/es/components/app-layout/AppShell.vue.mjs +44 -42
- package/es/components/app-layout/AppShell.vue2.mjs +2 -2
- package/es/components/app-layout/AppSidebar.vue.mjs +4 -4
- package/es/components/app-layout/AppSidebar.vue2.mjs +76 -59
- package/es/components/app-layout/AppTheme.vue.mjs +4 -4
- package/es/components/app-layout/AppTheme.vue2.mjs +69 -57
- package/es/components/app-layout/app-page-geometry.mjs +44 -42
- package/es/components/app-layout/keep-alive.mjs +27 -19
- package/es/components/app-layout/viewport.mjs +4 -3
- package/es/components/data-view/DataListView.vue.mjs +4 -4
- package/es/components/data-view/DataListView.vue2.mjs +133 -93
- package/es/components/data-view/DataListViewItem.vue.mjs +4 -4
- package/es/components/data-view/DataListViewItem.vue2.mjs +11 -9
- package/es/components/data-view/utils.mjs +36 -34
- package/es/components/display/ActionBtn.vue.mjs +94 -71
- package/es/components/display/ActionBtn.vue2.mjs +2 -2
- package/es/components/display/ActionBtnGroup.vue.mjs +54 -48
- package/es/components/display/ActionBtnGroup.vue2.mjs +2 -2
- package/es/components/display/ActionConfirm.vue.mjs +4 -4
- package/es/components/display/ActionConfirm.vue2.mjs +116 -92
- package/es/components/display/BooleanTag.vue.mjs +24 -18
- package/es/components/display/BooleanTag.vue2.mjs +2 -2
- package/es/components/display/HeightProvider.vue.mjs +37 -27
- package/es/components/display/HeightProvider.vue2.mjs +2 -2
- package/es/components/display/TabsHeader.vue.mjs +4 -4
- package/es/components/display/TabsHeader.vue2.mjs +86 -57
- package/es/components/display/TabsMain.vue.mjs +156 -125
- package/es/components/display/TabsMain.vue2.mjs +2 -2
- package/es/components/display/TabsNaturalFlow.vue.mjs +15 -11
- package/es/components/display/TabsNaturalFlow.vue2.mjs +2 -2
- package/es/components/display/TabsRefineFlow.vue.mjs +55 -42
- package/es/components/display/TabsRefineFlow.vue2.mjs +2 -2
- package/es/components/display/TabsTile.vue.mjs +4 -4
- package/es/components/display/TabsTile.vue2.mjs +204 -146
- package/es/components/display/WatchSize.vue.mjs +50 -30
- package/es/components/display/WatchSize.vue2.mjs +2 -2
- package/es/components/display/use-tabs-query-sync.mjs +21 -17
- package/es/components/form/FormItem.vue.mjs +4 -4
- package/es/components/form/FormItem.vue2.mjs +183 -121
- package/es/components/form/FormItemNestForm.vue.mjs +4 -4
- package/es/components/form/FormItemNestForm.vue2.mjs +38 -34
- package/es/components/form/FormItemNestFormList.vue.mjs +4 -4
- package/es/components/form/FormItemNestFormList.vue2.mjs +135 -106
- package/es/components/form/FormMain.vue.mjs +4 -4
- package/es/components/form/FormMain.vue2.mjs +226 -139
- package/es/components/form/FormRadioGroup.vue.mjs +67 -52
- package/es/components/form/FormRadioGroup.vue2.mjs +2 -2
- package/es/components/form/FormSearch.vue.mjs +4 -4
- package/es/components/form/FormSearch.vue2.mjs +194 -156
- package/es/components/form/FormSelect.vue.mjs +69 -42
- package/es/components/form/FormSelect.vue2.mjs +2 -2
- package/es/components/form/FormSubmitBtn.vue.mjs +30 -25
- package/es/components/form/FormSubmitBtn.vue2.mjs +2 -2
- package/es/components/form/FormSubmitPanel.vue.mjs +4 -4
- package/es/components/form/FormSubmitPanel.vue2.mjs +129 -96
- package/es/components/form/FormTree.vue.mjs +19 -16
- package/es/components/form/FormTree.vue2.mjs +2 -2
- package/es/components/form/FormVerifyCode.vue.mjs +58 -41
- package/es/components/form/FormVerifyCode.vue2.mjs +2 -2
- package/es/components/form/FormVerifyImage.vue.mjs +4 -4
- package/es/components/form/FormVerifyImage.vue2.mjs +62 -40
- package/es/components/form/form-search-utils.mjs +83 -52
- package/es/components/form/nest-form-item-list.mjs +63 -55
- package/es/components/form/nest-form-item.mjs +30 -30
- package/es/components/form/nest-registry.mjs +4 -4
- package/es/components/form/use-form-submit.mjs +18 -15
- package/es/components/form/use-layout-by-container.mjs +23 -15
- package/es/components/form/use-nest-form-list.mjs +19 -16
- package/es/components/form/use-nest-form.mjs +37 -28
- package/es/components/form/use-nest-layout-scale.mjs +11 -10
- package/es/components/form/utils.mjs +233 -145
- package/es/components/list-page/ListPage.vue.mjs +4 -4
- package/es/components/list-page/ListPage.vue2.mjs +313 -207
- package/es/components/list-page/use-sticky.mjs +45 -33
- package/es/components/menu/MenuItemSub.vue.mjs +47 -43
- package/es/components/menu/MenuItemSub.vue2.mjs +2 -2
- package/es/components/menu/MenuTree.vue.mjs +84 -61
- package/es/components/menu/MenuTree.vue2.mjs +2 -2
- package/es/components/misc/AutoRefresh.vue.mjs +4 -4
- package/es/components/misc/AutoRefresh.vue2.mjs +78 -53
- package/es/components/misc/AutoRefreshGroup.vue.mjs +4 -4
- package/es/components/misc/AutoRefreshGroup.vue2.mjs +54 -51
- package/es/components/misc/SelectModule.vue.mjs +54 -45
- package/es/components/misc/SelectModule.vue2.mjs +2 -2
- package/es/components/misc/TriggerAutoImport.vue.mjs +7 -5
- package/es/components/misc/TriggerAutoImport.vue2.mjs +2 -2
- package/es/components/modal/ModalConfirm.vue.mjs +4 -4
- package/es/components/modal/ModalConfirm.vue2.mjs +160 -125
- package/es/components/modal/ModalDetail.vue.mjs +50 -39
- package/es/components/modal/ModalDetail.vue2.mjs +2 -2
- package/es/components/modal/ModalForm.vue.mjs +63 -52
- package/es/components/modal/ModalForm.vue2.mjs +2 -2
- package/es/components/modal/ModalPorter.vue.mjs +51 -36
- package/es/components/modal/ModalPorter.vue2.mjs +2 -2
- package/es/components/modal/ModalShelf.vue.mjs +38 -28
- package/es/components/modal/ModalShelf.vue2.mjs +2 -2
- package/es/components/modal/modal-shelf-core.mjs +52 -36
- package/es/components/modal/modal-shelf-hierarchy.mjs +11 -9
- package/es/components/panel/PanelEditSwitch.vue.mjs +4 -4
- package/es/components/panel/PanelEditSwitch.vue2.mjs +88 -66
- package/es/components/panel/PanelItem.vue.mjs +4 -4
- package/es/components/panel/PanelItem.vue2.mjs +103 -77
- package/es/components/panel/PanelItemNestForm.vue.mjs +4 -4
- package/es/components/panel/PanelItemNestForm.vue2.mjs +61 -52
- package/es/components/panel/PanelItemNestPanel.vue.mjs +22 -20
- package/es/components/panel/PanelItemNestPanel.vue2.mjs +2 -2
- package/es/components/panel/PanelMain.vue.mjs +4 -4
- package/es/components/panel/PanelMain.vue2.mjs +92 -74
- package/es/components/panel/nest-panel-form.mjs +44 -38
- package/es/components/panel/nest-panel-item.mjs +18 -17
- package/es/components/slot-layout/SlotLayoutFlowAside.vue.mjs +4 -4
- package/es/components/slot-layout/SlotLayoutFlowAside.vue2.mjs +55 -42
- package/es/components/slot-layout/SlotLayoutTemplate.vue.mjs +11 -9
- package/es/components/slot-layout/SlotLayoutTemplate.vue2.mjs +2 -2
- package/es/components/table/TableMain.vue.mjs +4 -4
- package/es/components/table/TableMain.vue2.mjs +378 -275
- package/es/components/table/TableSkeleton.vue.mjs +4 -4
- package/es/components/table/TableSkeleton.vue2.mjs +95 -74
- package/es/components/table/TableToolbar.vue.mjs +4 -4
- package/es/components/table/TableToolbar.vue2.mjs +170 -154
- package/es/components/table/ToolbarButtons.vue.mjs +12 -10
- package/es/components/table/ToolbarButtons.vue2.mjs +2 -2
- package/es/components/table/constants.mjs +4 -3
- package/es/components/table/use-fill-height.mjs +12 -10
- package/es/components/table/use-table-skeleton.mjs +19 -15
- package/es/config/list-model.mjs +2 -2
- package/es/config/route.mjs +4 -3
- package/es/helpers/form.mjs +35 -25
- package/es/helpers/list-helper.mjs +59 -44
- package/es/hooks/activated.mjs +49 -33
- package/es/hooks/feel-size.mjs +39 -23
- package/es/hooks/menus-dispatch.mjs +68 -35
- package/es/hooks/timeout.mjs +29 -14
- package/es/hooks/use-breakpoint.mjs +35 -23
- package/es/hooks/use-channel-viewport-height.mjs +30 -20
- package/es/hooks/use-custom-breakpoint.mjs +48 -31
- package/es/hooks/use-observe-size.mjs +37 -20
- package/es/hooks/use-theme-apply.mjs +175 -124
- package/es/hooks/use-viewport-apply.mjs +39 -27
- package/es/index.mjs +239 -239
- package/es/inject/key.mjs +52 -41
- package/es/injectInfo.json.mjs +2 -2
- package/es/router/group-redirect.mjs +22 -16
- package/es/router/guard/index.mjs +26 -21
- package/es/router/guard/login.mjs +4 -2
- package/es/router/guard/permission.mjs +4 -2
- package/es/store/app.mjs +163 -123
- package/es/store/router-permission.mjs +75 -46
- package/es/store/user.mjs +100 -71
- package/es/style.css +769 -1
- package/es/utils/dom.mjs +20 -16
- package/es/utils/export.mjs +34 -18
- package/es/utils/id.mjs +5 -3
- package/es/utils/router.mjs +21 -14
- package/es/utils/theme-scale.mjs +50 -35
- package/es/utils/time.mjs +20 -14
- package/package.json +4 -3
- package/src/bridge/README.md +5 -0
- package/src/bridge/docs/README.md +72 -0
- package/src/components/README.md +84 -0
- package/src/components/app-layout/README.md +46 -0
- package/src/components/app-layout/docs/README-AppAside.md +69 -0
- package/src/components/app-layout/docs/README-AppBody.md +81 -0
- package/src/components/app-layout/docs/README-AppBreadcrumb.md +71 -0
- package/src/components/app-layout/docs/README-AppFooter.md +41 -0
- package/src/components/app-layout/docs/README-AppHeader.md +73 -0
- package/src/components/app-layout/docs/README-AppLayout.md +83 -0
- package/src/components/app-layout/docs/README-AppPage.md +80 -0
- package/src/components/app-layout/docs/README-AppSidebar.md +70 -0
- package/src/components/app-layout/docs/README-AppTheme.md +66 -0
- package/src/components/data-view/README.md +19 -0
- package/src/components/data-view/docs/README-DataListView.md +114 -0
- package/src/components/display/README.md +23 -0
- package/src/components/display/docs/README-ActionBtn.md +84 -0
- package/src/components/display/docs/README-ActionBtnGroup.md +96 -0
- package/src/components/display/docs/README-ActionConfirm.md +77 -0
- package/src/components/display/docs/README-BooleanTag.md +76 -0
- package/src/components/display/docs/README-HeightProvider.md +74 -0
- package/src/components/display/docs/README-TabsMain.md +99 -0
- package/src/components/display/docs/README-WatchSize.md +70 -0
- package/src/components/form/README.md +24 -0
- package/src/components/form/docs/README-FormItemNestForm.md +86 -0
- package/src/components/form/docs/README-FormItemNestFormList.md +93 -0
- package/src/components/form/docs/README-FormMain.md +101 -0
- package/src/components/form/docs/README-FormSearch.md +89 -0
- package/src/components/form/docs/README-FormSubmitBtn.md +72 -0
- package/src/components/form/docs/README-FormSubmitPanel.md +97 -0
- package/src/components/list-page/README.md +16 -0
- package/src/components/list-page/docs/README-ListPage.md +136 -0
- package/src/components/menu/README.md +19 -0
- package/src/components/menu/docs/README-MenuItemSub.md +53 -0
- package/src/components/menu/docs/README-MenuTree.md +76 -0
- package/src/components/misc/README.md +21 -0
- package/src/components/misc/docs/README-AutoRefresh.md +74 -0
- package/src/components/misc/docs/README-AutoRefreshGroup.md +74 -0
- package/src/components/misc/docs/README-SelectModule.md +72 -0
- package/src/components/modal/README.md +21 -0
- package/src/components/modal/docs/README-ModalConfirm.md +105 -0
- package/src/components/modal/docs/README-ModalDetail.md +103 -0
- package/src/components/modal/docs/README-ModalForm.md +97 -0
- package/src/components/modal/docs/README-ModalPorter.md +92 -0
- package/src/components/modal/docs/README-ModalShelf.md +115 -0
- package/src/components/panel/README.md +19 -0
- package/src/components/panel/docs/README-PanelMain.md +149 -0
- package/src/components/slot-layout/README.md +17 -0
- package/src/components/slot-layout/docs/README-SlotLayoutFlowAside.md +83 -0
- package/src/components/slot-layout/docs/README-SlotLayoutTemplate.md +73 -0
- package/src/components/table/README.md +17 -0
- package/src/components/table/docs/README-TableMain.md +140 -0
- package/src/hooks/README.md +5 -0
- package/src/hooks/docs/README.md +49 -0
- package/types/bridge/config-hook.d.ts +68 -0
- package/types/bridge/index.d.ts +411 -0
- package/types/bridge/layout.d.ts +40 -0
- package/types/bridge/plugin.d.ts +18 -0
- package/types/bridge/route.d.ts +20 -1
- package/types/bridge/state.d.ts +14 -0
- package/types/bridge/storage.d.ts +9 -0
- package/types/bridge/theme/index.d.ts +7 -0
- package/types/bridge/theme/persist.d.ts +12 -0
- package/types/bridge/theme/system-dark.d.ts +12 -0
- package/types/bridge/theme/types.d.ts +238 -0
- package/types/components/app-layout/AppAside.vue.d.ts +1 -0
- package/types/components/app-layout/AppCollapseToggle.vue.d.ts +3 -0
- package/types/components/app-layout/AppHeader.vue.d.ts +3 -0
- package/types/components/app-layout/AppLayout.vue.d.ts +12 -0
- package/types/components/app-layout/AppPage.vue.d.ts +17 -0
- package/types/components/app-layout/AppSidebar.vue.d.ts +2 -0
- package/types/components/app-layout/app-page-geometry.d.ts +48 -0
- package/types/components/app-layout/keep-alive.d.ts +17 -0
- package/types/components/app-layout/types.d.ts +125 -0
- package/types/components/app-layout/viewport.d.ts +28 -0
- package/types/components/data-view/DataListViewItem.vue.d.ts +8 -0
- package/types/components/data-view/index.d.ts +4 -0
- package/types/components/data-view/types.d.ts +42 -0
- package/types/components/data-view/utils.d.ts +3 -0
- package/types/components/display/TabsHeader.vue.d.ts +2 -0
- package/types/components/display/TabsMain.vue.d.ts +2 -0
- package/types/components/display/TabsRefineFlow.vue.d.ts +1 -0
- package/types/components/display/TabsTile.vue.d.ts +247 -12
- package/types/components/display/WatchSize.vue.d.ts +9 -0
- package/types/components/display/index.d.ts +37 -1
- package/types/components/display/types.d.ts +163 -0
- package/types/components/display/use-tabs-query-sync.d.ts +29 -0
- package/types/components/form/FormItemNestForm.vue.d.ts +5 -0
- package/types/components/form/FormItemNestFormList.vue.d.ts +17 -0
- package/types/components/form/FormVerifyCode.vue.d.ts +9 -0
- package/types/components/form/FormVerifyImage.vue.d.ts +1 -0
- package/types/components/form/form-search-utils.d.ts +34 -0
- package/types/components/form/nest-form-item-list.d.ts +28 -0
- package/types/components/form/nest-form-item.d.ts +21 -0
- package/types/components/form/nest-registry.d.ts +14 -0
- package/types/components/form/types.d.ts +208 -8
- package/types/components/form/use-form-submit.d.ts +13 -0
- package/types/components/form/use-layout-by-container.d.ts +23 -0
- package/types/components/form/use-nest-form-list.d.ts +13 -0
- package/types/components/form/use-nest-form.d.ts +15 -0
- package/types/components/form/use-nest-layout-scale.d.ts +12 -0
- package/types/components/form/utils.d.ts +56 -1
- package/types/components/list-page/ListPage.vue.d.ts +6 -0
- package/types/components/list-page/types.d.ts +50 -2
- package/types/components/list-page/use-sticky.d.ts +23 -0
- package/types/components/misc/index.d.ts +6 -1
- package/types/components/misc/types.d.ts +7 -0
- package/types/components/modal/ModalConfirm.vue.d.ts +29 -0
- package/types/components/modal/index.d.ts +7 -1
- package/types/components/modal/modal-shelf-core.d.ts +3 -0
- package/types/components/modal/modal-shelf-hierarchy.d.ts +4 -0
- package/types/components/modal/modal-shelf-types.d.ts +34 -0
- package/types/components/modal/types.d.ts +63 -2
- package/types/components/panel/PanelItemNestForm.vue.d.ts +6 -0
- package/types/components/panel/PanelItemNestPanel.vue.d.ts +5 -0
- package/types/components/panel/nest-panel-form.d.ts +21 -0
- package/types/components/panel/nest-panel-item.d.ts +14 -0
- package/types/components/panel/types.d.ts +52 -1
- package/types/components/slot-layout/SlotLayoutTemplate.vue.d.ts +21 -0
- package/types/components/slot-layout/types.d.ts +4 -0
- package/types/components/table/constants.d.ts +8 -0
- package/types/components/table/types.d.ts +140 -9
- package/types/components/table/use-fill-height.d.ts +14 -0
- package/types/components/table/use-table-skeleton.d.ts +16 -0
- package/types/config/list-model.d.ts +29 -0
- package/types/config/route.d.ts +2 -0
- package/types/helpers/form.d.ts +5 -0
- package/types/helpers/list-helper.d.ts +26 -0
- package/types/helpers/types.d.ts +11 -0
- package/types/hooks/activated.d.ts +23 -0
- package/types/hooks/feel-size.d.ts +2 -0
- package/types/hooks/menus-dispatch.d.ts +4 -0
- package/types/hooks/timeout.d.ts +4 -0
- package/types/hooks/use-channel-viewport-height.d.ts +8 -0
- package/types/hooks/use-custom-breakpoint.d.ts +19 -0
- package/types/hooks/use-observe-size.d.ts +29 -0
- package/types/hooks/use-theme-apply.d.ts +23 -0
- package/types/hooks/use-viewport-apply.d.ts +12 -0
- package/types/inject/key.d.ts +163 -0
- package/types/injectInfo.json.d.ts +1 -1
- package/types/router/group-redirect.d.ts +9 -0
- package/types/router/guard/index.d.ts +13 -0
- package/types/router/guard/login.d.ts +1 -0
- package/types/router/guard/permission.d.ts +1 -0
- package/types/router/guard/types.d.ts +3 -0
- package/types/store/app.d.ts +27 -0
- package/types/store/router-permission.d.ts +53 -0
- package/types/store/user.d.ts +24 -0
- package/types/types/dot-path.d.ts +8 -0
- package/types/types/route.d.ts +45 -0
- package/types/types/utility-types.d.ts +7 -0
- package/types/utils/dom.d.ts +22 -0
- package/types/utils/export.d.ts +16 -1
- package/types/utils/id.d.ts +1 -0
- package/types/utils/router.d.ts +2 -0
- package/types/utils/theme-scale.d.ts +31 -0
- package/types/utils/time.d.ts +1 -0
package/README.md
CHANGED
|
@@ -1 +1,77 @@
|
|
|
1
|
-
|
|
1
|
+
# @done-coding/admin-core
|
|
2
|
+
|
|
3
|
+
面向多形态应用的**配置化前端框架核心**:表单 / 列表 / 表格 / 弹窗 / 面板 / 布局组件族 + hooks + bridge 接线中枢。既能搭后台管理台,也能搭面向终端用户的应用(AI 应用台、创作/对话类产品)。
|
|
4
|
+
|
|
5
|
+
核心范式:**配置驱动**——组件消费配置对象(`FormItemConfig` / `TableColumnProps` / `PanelItemConfig`…)而非散装 props/插槽;**万物皆表单、万物皆 Nest 递归组合**(嵌套子表单/子面板不手写 HTML)。
|
|
6
|
+
|
|
7
|
+
> 完整可运行示例见 `apps/reference`(范式项目):路由与目录逐字同构(`/list-page/guide` ↔ `pages/list-page/guide/`),每个组件族都有最佳实践(guide)/ 完整功能(showcase)页面。
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @done-coding/admin-core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**样式必须显式引入**(SFC scoped CSS 被抽取到独立 `style.css`,漏引会导致 scoped 选择器失效、布局塌陷):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import "@done-coding/admin-core/style.css";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
peer 依赖需消费方自装:`vue` / `vue-router` / `pinia` / `pinia-plugin-persistedstate` / `element-plus` / `@element-plus/icons-vue` / `lodash` / `@done-coding/request-axios`
|
|
22
|
+
|
|
23
|
+
## 快速开始(三件套)
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
// ① 实例化 bridge(接线中枢:认证 / 布局 / 主题 / 路由派生)
|
|
27
|
+
// 参考 apps/reference/src/config/bridge.ts
|
|
28
|
+
const appCoreBridge = createCoreBridge({ ... });
|
|
29
|
+
|
|
30
|
+
// ② 组装 AppLayout(全局布局根,provide 全部契约)
|
|
31
|
+
// 参考 apps/reference/src/App.vue
|
|
32
|
+
<AppLayout :bridge="appCoreBridge" :app-store="appStore" :user-store="userStore">
|
|
33
|
+
<template #brand>...</template>
|
|
34
|
+
<template #userEntry>...</template>
|
|
35
|
+
<template #aside>...</template>
|
|
36
|
+
</AppLayout>
|
|
37
|
+
|
|
38
|
+
// ③ 页面用组件族(范式:AppPage 容器 + ListPage/FormMain/PanelMain 三主件)
|
|
39
|
+
// 参考 apps/reference/src/pages/list-page/guide/
|
|
40
|
+
<AppPage>
|
|
41
|
+
<ListPage :list="searchFormList" :columns="columns" row-key="id" :api="listApi" />
|
|
42
|
+
</AppPage>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 组件族索引
|
|
46
|
+
|
|
47
|
+
| 族 | 组件 | 文档 |
|
|
48
|
+
| --- | --- | --- |
|
|
49
|
+
| form 表单族 | FormMain / FormSearch / FormSubmitBtn / FormSubmitPanel / FormItemNestForm / FormItemNestFormList / FormSelect / FormRadioGroup / FormTree / FormVerifyImage / FormVerifyCode | [README](./src/components/form/README.md) 等 |
|
|
50
|
+
| list-page 列表族 | ListPage(FormSearch + TableMain 组合页) | [README](./src/components/list-page/README.md) |
|
|
51
|
+
| table 表格族 | TableMain | [README](./src/components/table/README.md) |
|
|
52
|
+
| modal 弹窗族 | ModalConfirm / ModalForm / ModalDetail / ModalShelf / ModalPorter | [README](./src/components/modal/README.md) 等 |
|
|
53
|
+
| panel 面板族 | PanelMain / PanelItem / PanelEditSwitch / PanelItemNestPanel / PanelItemNestForm | [README](./src/components/panel/README.md) |
|
|
54
|
+
| display 展示族 | TabsMain / ActionBtn / ActionBtnGroup / ActionConfirm / WatchSize / HeightProvider / BooleanTag | [README](./src/components/display/README.md) 等 |
|
|
55
|
+
| app-layout 布局族 | AppLayout / AppPage / AppBody / AppHeader / AppSidebar / AppAside / AppBreadcrumb / AppFooter / AppTheme / AppCollapseToggle | 族引导见 [components/README](./src/components/README.md) |
|
|
56
|
+
| menu 菜单族 | MenuTree / MenuItemSub | 同上 |
|
|
57
|
+
| slot-layout 插槽布局族 | SlotLayoutTemplate / SlotLayoutFlowAside | 同上 |
|
|
58
|
+
| data-view 数据视图族 | DataListView / DataListViewItem(TableMain 内部件,customView 模式) | 同上 |
|
|
59
|
+
| misc 杂项族 | AutoRefresh / AutoRefreshGroup / SelectModule / TriggerAutoRefresh | 同上 |
|
|
60
|
+
|
|
61
|
+
## 模块索引
|
|
62
|
+
|
|
63
|
+
| 模块 | 说明 | 文档 |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| bridge | `createCoreBridge` 接线中枢:auth / 布局 / 主题 / 路由派生 + 响应式配置视图 | [README](./src/bridge/README.md) |
|
|
66
|
+
| hooks | useActivated / useFeelSize / useBreakpoint / useCustomBreakpoint / useObserveSize / useChannelViewportHeight / useCoreThemeApply / useCoreViewportApply / useMenusDataDispatch / useTimeout | [README](./src/hooks/README.md) |
|
|
67
|
+
| store | createAppStore / createUserStore / router-permission pinia 工厂 | 见 reference `src/store/` 实例化 |
|
|
68
|
+
| inject | 跨包 Symbol 契约(SCOPE_VIEWPORT_MAX_HEIGHT / CORE_BRIDGE_KEY / FORM_NEST_REGISTRY_KEY 等) | 见各组件文档「高度链」相关段落 |
|
|
69
|
+
| config | APP_API_LIST_MODEL_KEY_CONFIG(列表接口模型)/ ROUTE_MODULE_LEVEL / TabsMainReplaceQueryKey | — |
|
|
70
|
+
| types / utils / router | 路由元类型 / 通用工具(time/id/dom/router/export/theme-scale)/ withGroupRedirect | — |
|
|
71
|
+
|
|
72
|
+
## 文档约定
|
|
73
|
+
|
|
74
|
+
- 组件文档命名 `README-<PascalName>.md`,位于组件族目录内;`src/**/README*.md` 随 npm 包发布
|
|
75
|
+
- 每个组件文档结构:定位 → 快速上手(最佳实践)→ API(props/emits/slots/expose)→ 反模式/注意 → 关联
|
|
76
|
+
- 完整可运行范式页见 `apps/reference`:`<族>/guide`(最佳实践)、`<族>/showcase`(完整功能)、其余功能语义名
|
|
77
|
+
- API 以 `packages/core/src/**/types.ts` 与组件源码为真相源;文档与其冲突时以源码为准
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
for (const [
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const _export_sfc = (sfc, props) => {
|
|
2
|
+
const target = sfc.__vccOpts || sfc;
|
|
3
|
+
for (const [key, val] of props) {
|
|
4
|
+
target[key] = val;
|
|
5
|
+
}
|
|
6
|
+
return target;
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
+
_export_sfc as default
|
|
9
10
|
};
|
|
@@ -1,43 +1,55 @@
|
|
|
1
|
-
import { reactive
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { reactive, readonly } from "vue";
|
|
2
|
+
function createBridgeConfigHook(init) {
|
|
3
|
+
const reactiveBaseInfo = reactive(init.APP_BASE_INFO);
|
|
4
|
+
const reactiveHeader = reactive(init.APP_LAYOUT_HEADER_CONFIG);
|
|
5
|
+
const reactiveFooter = reactive(init.APP_LAYOUT_FOOTER_CONFIG);
|
|
6
|
+
const reactiveSidebar = reactive(init.APP_LAYOUT_SIDEBAR_CONFIG);
|
|
7
|
+
const reactiveAside = reactive(init.APP_LAYOUT_ASIDE_CONFIG);
|
|
8
|
+
const reactiveBreadcrumb = reactive(init.APP_LAYOUT_BREADCRUMB_CONFIG);
|
|
9
|
+
const reactiveBody = reactive(init.APP_LAYOUT_BODY_CONFIG);
|
|
10
|
+
const reactiveViewport = reactive(init.APP_LAYOUT_VIEWPORT_CONFIG);
|
|
11
|
+
const reactiveGap = reactive(init.APP_LAYOUT_GAP_CONFIG);
|
|
12
|
+
const reactiveTheme = reactive(init.APP_THEME_CONFIG);
|
|
13
|
+
const reactiveMap = {
|
|
14
|
+
APP_BASE_INFO: reactiveBaseInfo,
|
|
15
|
+
APP_LAYOUT_HEADER_CONFIG: reactiveHeader,
|
|
16
|
+
APP_LAYOUT_FOOTER_CONFIG: reactiveFooter,
|
|
17
|
+
APP_LAYOUT_SIDEBAR_CONFIG: reactiveSidebar,
|
|
18
|
+
APP_LAYOUT_ASIDE_CONFIG: reactiveAside,
|
|
19
|
+
APP_LAYOUT_BREADCRUMB_CONFIG: reactiveBreadcrumb,
|
|
20
|
+
APP_LAYOUT_BODY_CONFIG: reactiveBody,
|
|
21
|
+
APP_LAYOUT_VIEWPORT_CONFIG: reactiveViewport,
|
|
22
|
+
APP_LAYOUT_GAP_CONFIG: reactiveGap,
|
|
23
|
+
APP_THEME_CONFIG: reactiveTheme
|
|
24
|
+
};
|
|
25
|
+
const layoutAggregate = reactive({
|
|
26
|
+
header: reactiveHeader,
|
|
27
|
+
footer: reactiveFooter,
|
|
28
|
+
sidebar: reactiveSidebar,
|
|
29
|
+
aside: reactiveAside,
|
|
30
|
+
breadcrumb: reactiveBreadcrumb,
|
|
31
|
+
body: reactiveBody,
|
|
32
|
+
viewport: reactiveViewport,
|
|
33
|
+
gap: reactiveGap
|
|
23
34
|
});
|
|
35
|
+
const update = (key, partial) => {
|
|
36
|
+
Object.assign(reactiveMap[key], partial);
|
|
37
|
+
};
|
|
24
38
|
return {
|
|
25
|
-
update
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
roTheme: _(T),
|
|
38
|
-
roLayout: _(s)
|
|
39
|
+
update,
|
|
40
|
+
roBaseInfo: readonly(reactiveBaseInfo),
|
|
41
|
+
roHeader: readonly(reactiveHeader),
|
|
42
|
+
roFooter: readonly(reactiveFooter),
|
|
43
|
+
roSidebar: readonly(reactiveSidebar),
|
|
44
|
+
roAside: readonly(reactiveAside),
|
|
45
|
+
roBreadcrumb: readonly(reactiveBreadcrumb),
|
|
46
|
+
roBody: readonly(reactiveBody),
|
|
47
|
+
roViewport: readonly(reactiveViewport),
|
|
48
|
+
roGap: readonly(reactiveGap),
|
|
49
|
+
roTheme: readonly(reactiveTheme),
|
|
50
|
+
roLayout: readonly(layoutAggregate)
|
|
39
51
|
};
|
|
40
52
|
}
|
|
41
53
|
export {
|
|
42
|
-
|
|
54
|
+
createBridgeConfigHook
|
|
43
55
|
};
|
package/es/bridge/index.mjs
CHANGED
|
@@ -1,36 +1,50 @@
|
|
|
1
|
-
import { computed
|
|
2
|
-
import { createStorageWithNamespace
|
|
3
|
-
import { createUseState
|
|
4
|
-
import { createGenerateRouteMetaRawTree
|
|
5
|
-
import { createBridgeConfigHook
|
|
6
|
-
import { createBridgePluginHost
|
|
7
|
-
import { createBridgeThemeHook
|
|
8
|
-
import { createBridgeLayoutHook
|
|
9
|
-
import { CORE_BRIDGE_KEY
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { createStorageWithNamespace } from "./storage.mjs";
|
|
3
|
+
import { createUseState } from "./state.mjs";
|
|
4
|
+
import { createGenerateRouteMetaRawTree } from "./route.mjs";
|
|
5
|
+
import { createBridgeConfigHook } from "./config-hook.mjs";
|
|
6
|
+
import { createBridgePluginHost } from "./plugin.mjs";
|
|
7
|
+
import { createBridgeThemeHook } from "./theme/index.mjs";
|
|
8
|
+
import { createBridgeLayoutHook } from "./layout.mjs";
|
|
9
|
+
import { CORE_BRIDGE_KEY } from "../inject/key.mjs";
|
|
10
|
+
function createCoreBridge(options) {
|
|
11
|
+
const rawNs = options.APP_CACHE_CONFIG.namespace;
|
|
12
|
+
let effectiveNs;
|
|
13
|
+
if (rawNs === "") {
|
|
14
|
+
console.error(
|
|
15
|
+
"[bridge] APP_CACHE_CONFIG.namespace 为空,已兜底为 'DC_CORE'"
|
|
16
|
+
);
|
|
17
|
+
effectiveNs = "DC_CORE";
|
|
18
|
+
} else {
|
|
19
|
+
effectiveNs = rawNs;
|
|
20
|
+
}
|
|
21
|
+
Object.freeze(options);
|
|
22
|
+
const storage = createStorageWithNamespace(effectiveNs);
|
|
23
|
+
const routes = options.routes;
|
|
24
|
+
const getUserInfoInitFn_ = options.getUserInfoInitFn;
|
|
25
|
+
const userInfoAccess = options.userInfoAccess;
|
|
26
|
+
const useStateInstance = createUseState(effectiveNs);
|
|
27
|
+
const genRouteMetaRawTreeInstance = createGenerateRouteMetaRawTree(
|
|
28
|
+
options.APP_ROUTER_META_DEFAULT_CONFIG
|
|
29
|
+
);
|
|
30
|
+
const asideConfig = {
|
|
19
31
|
// 核内默认宽 0:默认 shell 渲染 AppAside 但不可见、经典 1:1 无右间隙;app/preset 加宽启用。
|
|
20
32
|
width: 0,
|
|
21
|
-
...
|
|
22
|
-
}
|
|
33
|
+
...options.APP_LAYOUT_ASIDE_CONFIG
|
|
34
|
+
};
|
|
35
|
+
const gapConfig = {
|
|
23
36
|
size: 0,
|
|
24
|
-
...
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
...options.APP_LAYOUT_GAP_CONFIG
|
|
38
|
+
};
|
|
39
|
+
const configHook = createBridgeConfigHook({
|
|
40
|
+
APP_BASE_INFO: options.APP_BASE_INFO,
|
|
41
|
+
APP_THEME_CONFIG: options.APP_THEME_CONFIG,
|
|
42
|
+
APP_LAYOUT_HEADER_CONFIG: options.APP_LAYOUT_HEADER_CONFIG,
|
|
43
|
+
APP_LAYOUT_FOOTER_CONFIG: options.APP_LAYOUT_FOOTER_CONFIG,
|
|
44
|
+
APP_LAYOUT_SIDEBAR_CONFIG: options.APP_LAYOUT_SIDEBAR_CONFIG,
|
|
45
|
+
APP_LAYOUT_ASIDE_CONFIG: asideConfig,
|
|
46
|
+
APP_LAYOUT_BREADCRUMB_CONFIG: options.APP_LAYOUT_BREADCRUMB_CONFIG,
|
|
47
|
+
APP_LAYOUT_BODY_CONFIG: options.APP_LAYOUT_BODY_CONFIG,
|
|
34
48
|
// viewport 边框:app 可整体不传 / 传部分字段,与核内默认四边 0 浅合并补全
|
|
35
49
|
// (config-hook reactive 入参 [MUST] 全字段非 undefined,故此处合并而非透传)。
|
|
36
50
|
APP_LAYOUT_VIEWPORT_CONFIG: {
|
|
@@ -38,70 +52,90 @@ function x(e) {
|
|
|
38
52
|
paddingRight: 0,
|
|
39
53
|
paddingBottom: 0,
|
|
40
54
|
paddingLeft: 0,
|
|
41
|
-
...
|
|
55
|
+
...options.APP_LAYOUT_VIEWPORT_CONFIG
|
|
42
56
|
},
|
|
43
|
-
APP_LAYOUT_GAP_CONFIG:
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
APP_LAYOUT_GAP_CONFIG: gapConfig
|
|
58
|
+
});
|
|
59
|
+
const themeHook = createBridgeThemeHook({
|
|
60
|
+
initConfig: options.APP_THEME_CONFIG,
|
|
61
|
+
update: configHook.update,
|
|
47
62
|
// 布局基线快照(preset 切换基线复位 + 叠加用)。六组布局 config init 值浅快照——
|
|
48
63
|
// viewport 取已合并核内默认四边 0 的完整值(与 configHook 入参口径一致)。
|
|
49
64
|
layoutBaseline: {
|
|
50
|
-
header: { ...
|
|
51
|
-
footer: { ...
|
|
52
|
-
sidebar: { ...
|
|
53
|
-
aside: { ...
|
|
54
|
-
breadcrumb: { ...
|
|
55
|
-
body: { ...
|
|
65
|
+
header: { ...options.APP_LAYOUT_HEADER_CONFIG },
|
|
66
|
+
footer: { ...options.APP_LAYOUT_FOOTER_CONFIG },
|
|
67
|
+
sidebar: { ...options.APP_LAYOUT_SIDEBAR_CONFIG },
|
|
68
|
+
aside: { ...asideConfig },
|
|
69
|
+
breadcrumb: { ...options.APP_LAYOUT_BREADCRUMB_CONFIG },
|
|
70
|
+
body: { ...options.APP_LAYOUT_BODY_CONFIG },
|
|
56
71
|
viewport: {
|
|
57
72
|
paddingTop: 0,
|
|
58
73
|
paddingRight: 0,
|
|
59
74
|
paddingBottom: 0,
|
|
60
75
|
paddingLeft: 0,
|
|
61
|
-
...
|
|
76
|
+
...options.APP_LAYOUT_VIEWPORT_CONFIG
|
|
62
77
|
},
|
|
63
|
-
gap: { ...
|
|
78
|
+
gap: { ...gapConfig }
|
|
64
79
|
},
|
|
65
|
-
storage
|
|
66
|
-
defaultMode:
|
|
67
|
-
})
|
|
68
|
-
|
|
80
|
+
storage,
|
|
81
|
+
defaultMode: options.defaultThemeMode
|
|
82
|
+
});
|
|
83
|
+
const layoutHook = createBridgeLayoutHook({ storage });
|
|
84
|
+
const themeColors = computed(
|
|
85
|
+
() => themeHook.themeIsDark.value ? configHook.roTheme.dark : configHook.roTheme.light
|
|
69
86
|
);
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
87
|
+
let tokenFn;
|
|
88
|
+
let loginFn;
|
|
89
|
+
let refreshTokenFn;
|
|
90
|
+
let refreshAuthFn;
|
|
91
|
+
let loginApiFn;
|
|
92
|
+
let logoutApiFn;
|
|
93
|
+
let getUserInfoApiFn;
|
|
94
|
+
let refreshTokenApiFn;
|
|
95
|
+
const msg = (name) => `bridge: ${name} 未注册`;
|
|
96
|
+
const pluginHost = createBridgePluginHost();
|
|
97
|
+
const bridgeInstance = {
|
|
98
|
+
register(options2) {
|
|
99
|
+
if (options2.getToken) tokenFn = options2.getToken;
|
|
100
|
+
if (options2.goToLogin) loginFn = options2.goToLogin;
|
|
101
|
+
if (options2.refreshToken) refreshTokenFn = options2.refreshToken;
|
|
102
|
+
if (options2.refreshAuth) refreshAuthFn = options2.refreshAuth;
|
|
103
|
+
if (options2.loginApi) loginApiFn = options2.loginApi;
|
|
104
|
+
if (options2.logoutApi) logoutApiFn = options2.logoutApi;
|
|
105
|
+
if (options2.getUserInfoApi) getUserInfoApiFn = options2.getUserInfoApi;
|
|
106
|
+
if (options2.refreshTokenApi) refreshTokenApiFn = options2.refreshTokenApi;
|
|
74
107
|
},
|
|
75
108
|
// 已注册返回 undefined 是合法业务态不 throw
|
|
76
109
|
// v3 终锁 Δ8b:零参 facade(BR-1 ③ 终裁——core 对 UserInfo 不透明 + 拦截器无 info 源)
|
|
77
110
|
getToken() {
|
|
78
|
-
if (!
|
|
79
|
-
return
|
|
111
|
+
if (!tokenFn) throw new Error(msg("getToken"));
|
|
112
|
+
return tokenFn();
|
|
80
113
|
},
|
|
81
114
|
goToLogin() {
|
|
82
|
-
if (!
|
|
83
|
-
|
|
115
|
+
if (!loginFn) throw new Error(msg("goToLogin"));
|
|
116
|
+
loginFn();
|
|
84
117
|
},
|
|
85
118
|
// 异步对:未注册才返回 rejected Promise(既有降级语义保留)。
|
|
86
119
|
refreshToken() {
|
|
87
|
-
|
|
88
|
-
|
|
120
|
+
if (!refreshTokenFn)
|
|
121
|
+
return Promise.reject(new Error(msg("refreshToken")));
|
|
122
|
+
return refreshTokenFn().then(() => void 0);
|
|
89
123
|
},
|
|
90
124
|
refreshAuth() {
|
|
91
|
-
|
|
92
|
-
|
|
125
|
+
if (!refreshAuthFn) return Promise.reject(new Error(msg("refreshAuth")));
|
|
126
|
+
return refreshAuthFn().then(() => void 0);
|
|
93
127
|
},
|
|
94
128
|
getStorage() {
|
|
95
|
-
return
|
|
129
|
+
return storage;
|
|
96
130
|
},
|
|
97
131
|
getRoutes() {
|
|
98
|
-
return
|
|
132
|
+
return routes;
|
|
99
133
|
},
|
|
100
134
|
getUserInfoInitFn() {
|
|
101
|
-
return
|
|
135
|
+
return getUserInfoInitFn_;
|
|
102
136
|
},
|
|
103
|
-
useState:
|
|
104
|
-
generateRouteMetaRawTree:
|
|
137
|
+
useState: useStateInstance,
|
|
138
|
+
generateRouteMetaRawTree: genRouteMetaRawTreeInstance,
|
|
105
139
|
// ============ #2.5 期 12 readonly 属性值挂载(per ADR-1 sibling pattern 复用 useState / generateRouteMetaRawTree) ============
|
|
106
140
|
// 插件系统一期:本期 7 字段(BASE_INFO / 5 布局子 / THEME)+ APP_LAYOUT_CONFIG
|
|
107
141
|
// 改挂 configHook 的 readonly(reactive()) 响应式只读视图——经 bridge.update 跟随。
|
|
@@ -112,25 +146,25 @@ function x(e) {
|
|
|
112
146
|
* 更新后本属性自动跟随。[SHOULD] 在 `computed` / 响应式上下文中读取,[MUST NOT]
|
|
113
147
|
* 解构或一次性快照取值(`const x = bridge.APP_BASE_INFO.foo` ⚠️ 快照定格,update 后不变)。
|
|
114
148
|
*/
|
|
115
|
-
APP_BASE_INFO:
|
|
149
|
+
APP_BASE_INFO: configHook.roBaseInfo,
|
|
116
150
|
/** 应用环境信息(per #2.5 期 REQ-1) */
|
|
117
|
-
APP_ENV_INFO:
|
|
151
|
+
APP_ENV_INFO: options.APP_ENV_INFO,
|
|
118
152
|
/** 应用缓存配置(per #2.5 期 REQ-1) */
|
|
119
|
-
APP_CACHE_CONFIG:
|
|
153
|
+
APP_CACHE_CONFIG: options.APP_CACHE_CONFIG,
|
|
120
154
|
/**
|
|
121
155
|
* 应用布局-header 配置(**响应式只读视图**,插件系统一期改)。
|
|
122
156
|
*
|
|
123
157
|
* `readonly(reactive(...))` 包裹——`bridge.update("APP_LAYOUT_HEADER_CONFIG", partial)`
|
|
124
158
|
* 后自动跟随。[SHOULD] 响应式上下文 / `computed` 读取,[MUST NOT] 解构/快照(⚠️ 定格)。
|
|
125
159
|
*/
|
|
126
|
-
APP_LAYOUT_HEADER_CONFIG:
|
|
160
|
+
APP_LAYOUT_HEADER_CONFIG: configHook.roHeader,
|
|
127
161
|
/**
|
|
128
162
|
* 应用布局-footer 配置(**响应式只读视图**,插件系统一期改)。
|
|
129
163
|
*
|
|
130
164
|
* `readonly(reactive(...))`——`bridge.update("APP_LAYOUT_FOOTER_CONFIG", partial)`
|
|
131
165
|
* 后跟随。[SHOULD] 响应式上下文读取,[MUST NOT] 解构/快照(⚠️ 定格)。
|
|
132
166
|
*/
|
|
133
|
-
APP_LAYOUT_FOOTER_CONFIG:
|
|
167
|
+
APP_LAYOUT_FOOTER_CONFIG: configHook.roFooter,
|
|
134
168
|
/**
|
|
135
169
|
* 应用布局-sidebar 配置(**响应式只读视图**,插件系统一期改)。
|
|
136
170
|
*
|
|
@@ -138,28 +172,28 @@ function x(e) {
|
|
|
138
172
|
* 后跟随(一级浅合并,传 `{width}` 保留 `collapseWidth`)。[SHOULD] 响应式上下文
|
|
139
173
|
* 读取,[MUST NOT] 解构/快照(⚠️ 定格)。
|
|
140
174
|
*/
|
|
141
|
-
APP_LAYOUT_SIDEBAR_CONFIG:
|
|
175
|
+
APP_LAYOUT_SIDEBAR_CONFIG: configHook.roSidebar,
|
|
142
176
|
/**
|
|
143
177
|
* 应用布局-aside 右侧补充区配置(**响应式只读视图**,P1' additive)。
|
|
144
178
|
*
|
|
145
179
|
* `readonly(reactive(...))`——`bridge.update("APP_LAYOUT_ASIDE_CONFIG", partial)` 后跟随。
|
|
146
180
|
* 仅自定义 shell 渲染右侧区时消费;经典布局不读。[MUST NOT] 解构/快照(⚠️ 定格)。
|
|
147
181
|
*/
|
|
148
|
-
APP_LAYOUT_ASIDE_CONFIG:
|
|
182
|
+
APP_LAYOUT_ASIDE_CONFIG: configHook.roAside,
|
|
149
183
|
/**
|
|
150
184
|
* 应用布局-面包屑配置(**响应式只读视图**,插件系统一期改)。
|
|
151
185
|
*
|
|
152
186
|
* `readonly(reactive(...))`——`bridge.update("APP_LAYOUT_BREADCRUMB_CONFIG", partial)`
|
|
153
187
|
* 后跟随。[SHOULD] 响应式上下文读取,[MUST NOT] 解构/快照(⚠️ 定格)。
|
|
154
188
|
*/
|
|
155
|
-
APP_LAYOUT_BREADCRUMB_CONFIG:
|
|
189
|
+
APP_LAYOUT_BREADCRUMB_CONFIG: configHook.roBreadcrumb,
|
|
156
190
|
/**
|
|
157
191
|
* 应用布局-页面主体配置(**响应式只读视图**,插件系统一期改)。
|
|
158
192
|
*
|
|
159
193
|
* `readonly(reactive(...))`——`bridge.update("APP_LAYOUT_BODY_CONFIG", partial)`
|
|
160
194
|
* 后跟随。[SHOULD] 响应式上下文读取,[MUST NOT] 解构/快照(⚠️ 定格)。
|
|
161
195
|
*/
|
|
162
|
-
APP_LAYOUT_BODY_CONFIG:
|
|
196
|
+
APP_LAYOUT_BODY_CONFIG: configHook.roBody,
|
|
163
197
|
/**
|
|
164
198
|
* 应用布局-视口边框配置(**响应式只读视图**)。
|
|
165
199
|
*
|
|
@@ -167,7 +201,7 @@ function x(e) {
|
|
|
167
201
|
* 后跟随(一级浅合并,传 `{paddingTop}` 保留其余三边)。store/app 经此派生 viewport
|
|
168
202
|
* padding 给 Header/Sidebar fixed 锚点 + AppBody calc。[MUST NOT] 解构/快照(⚠️ 定格)。
|
|
169
203
|
*/
|
|
170
|
-
APP_LAYOUT_VIEWPORT_CONFIG:
|
|
204
|
+
APP_LAYOUT_VIEWPORT_CONFIG: configHook.roViewport,
|
|
171
205
|
/**
|
|
172
206
|
* 应用布局-模块间距配置(**响应式只读视图**,内缝 gap)。
|
|
173
207
|
*
|
|
@@ -175,7 +209,7 @@ function x(e) {
|
|
|
175
209
|
* 后跟随。store/app 经此派生 gapTop/Left/Right/Bottom 叠加进几何 calc。
|
|
176
210
|
* [MUST NOT] 解构/快照(⚠️ 定格)。
|
|
177
211
|
*/
|
|
178
|
-
APP_LAYOUT_GAP_CONFIG:
|
|
212
|
+
APP_LAYOUT_GAP_CONFIG: configHook.roGap,
|
|
179
213
|
/**
|
|
180
214
|
* 应用布局聚合配置(**响应式只读视图**,插件系统一期改)。
|
|
181
215
|
*
|
|
@@ -183,13 +217,13 @@ function x(e) {
|
|
|
183
217
|
* `readonly(reactive({header, footer, sidebar, breadcrumb, body}))`——不再是
|
|
184
218
|
* `Object.freeze` 静态聚合。[SHOULD] 响应式上下文读取,[MUST NOT] 解构/快照(⚠️ 定格)。
|
|
185
219
|
*/
|
|
186
|
-
APP_LAYOUT_CONFIG:
|
|
220
|
+
APP_LAYOUT_CONFIG: configHook.roLayout,
|
|
187
221
|
/** 应用路由元信息默认配置(per #2.5 期 REQ-1) */
|
|
188
|
-
APP_ROUTER_META_DEFAULT_CONFIG:
|
|
222
|
+
APP_ROUTER_META_DEFAULT_CONFIG: options.APP_ROUTER_META_DEFAULT_CONFIG,
|
|
189
223
|
/** 应用路由配置(per #2.5 期 REQ-1) */
|
|
190
|
-
APP_ROUTER_CONFIG:
|
|
224
|
+
APP_ROUTER_CONFIG: options.APP_ROUTER_CONFIG,
|
|
191
225
|
/** 应用路由路径配置(per #7.3 期 readonly 挂载) */
|
|
192
|
-
APP_ROUTER_PATHS_CONFIG:
|
|
226
|
+
APP_ROUTER_PATHS_CONFIG: options.APP_ROUTER_PATHS_CONFIG,
|
|
193
227
|
/**
|
|
194
228
|
* 应用主题配置(**响应式只读视图**,插件系统一期改)。
|
|
195
229
|
*
|
|
@@ -197,58 +231,67 @@ function x(e) {
|
|
|
197
231
|
* 一级浅合并整体替换 `light`、保留 `dark`,后自动跟随。[SHOULD] 响应式上下文读取,
|
|
198
232
|
* [MUST NOT] 解构/快照(⚠️ 定格)。
|
|
199
233
|
*/
|
|
200
|
-
APP_THEME_CONFIG:
|
|
234
|
+
APP_THEME_CONFIG: configHook.roTheme,
|
|
201
235
|
/** 主题模块(架构反转:风格切换真相源在 bridge;插件经 theme.add 注册风格) */
|
|
202
|
-
theme:
|
|
236
|
+
theme: themeHook.theme,
|
|
203
237
|
/** 当前风格名(响应式只读真相源) */
|
|
204
|
-
themeStyle:
|
|
238
|
+
themeStyle: themeHook.themeStyle,
|
|
205
239
|
/** 明暗模式三态真相源(亮/暗/跟随系统) */
|
|
206
|
-
themeMode:
|
|
240
|
+
themeMode: themeHook.themeMode,
|
|
207
241
|
/** 是否暗色(响应式只读派生;appStore / 挂值 composable 读此) */
|
|
208
|
-
themeIsDark:
|
|
242
|
+
themeIsDark: themeHook.themeIsDark,
|
|
209
243
|
/** 当前 preset 的 layout 运行时维度(AppLayout 直读 shell + 分流意图) */
|
|
210
|
-
themeLayout:
|
|
244
|
+
themeLayout: themeHook.themeLayout,
|
|
211
245
|
/** 当前密度档 / 动效档(节奏真相源;useCoreThemeApply 消费,明暗无关) */
|
|
212
|
-
themeDensity:
|
|
213
|
-
themeMotion:
|
|
246
|
+
themeDensity: themeHook.themeDensity,
|
|
247
|
+
themeMotion: themeHook.themeMotion,
|
|
214
248
|
/** 当前生效 JS 主题色(输出 B;MenuTree/布局直读、appStore.theme 转发) */
|
|
215
|
-
themeColors
|
|
249
|
+
themeColors,
|
|
216
250
|
/** 是否显示内置风格切换下拉(AppTheme ElSelect);init 静态值,缺省 true(亮暗恒显) */
|
|
217
|
-
showThemeStyleSwitcher:
|
|
251
|
+
showThemeStyleSwitcher: options.showThemeStyleSwitcher ?? true,
|
|
218
252
|
/** 布局折叠模块(折叠真相源在 bridge;appStore 转发,AppSidebar / AppAside 驱动) */
|
|
219
|
-
layout:
|
|
253
|
+
layout: layoutHook.layout,
|
|
220
254
|
/** 用户信息字段访问器集(第一宪法:业务注入 get/set 读写 token/refreshToken/permission) */
|
|
221
|
-
userInfoAccess
|
|
255
|
+
userInfoAccess,
|
|
222
256
|
// 插件系统一期:update(REQ-1)+ install(REQ-9)挂载。
|
|
223
257
|
// install 箭头函数闭包引用 bridgeInstance([MUST NOT] 用 this——strict
|
|
224
258
|
// noImplicitThis);provide 整 bridge 自身;零单例([MUST NOT] globalThis/模块级缓存)。
|
|
225
|
-
update:
|
|
226
|
-
use: (
|
|
227
|
-
bridge:
|
|
228
|
-
update:
|
|
229
|
-
plugin
|
|
230
|
-
options:
|
|
259
|
+
update: configHook.update,
|
|
260
|
+
use: (plugin, options2) => pluginHost.use({
|
|
261
|
+
bridge: bridgeInstance,
|
|
262
|
+
update: configHook.update,
|
|
263
|
+
plugin,
|
|
264
|
+
options: options2
|
|
231
265
|
}),
|
|
232
|
-
install: (
|
|
266
|
+
install: (app) => {
|
|
267
|
+
app.provide(CORE_BRIDGE_KEY, bridgeInstance);
|
|
268
|
+
return app;
|
|
269
|
+
},
|
|
233
270
|
// 异步对:未注册返回 rejected 原生 Error(#4a-2 per-method 降级)
|
|
234
|
-
loginApi(
|
|
235
|
-
|
|
271
|
+
loginApi(params) {
|
|
272
|
+
if (!loginApiFn) return Promise.reject(new Error(msg("loginApi")));
|
|
273
|
+
return loginApiFn(params);
|
|
236
274
|
},
|
|
237
275
|
logoutApi() {
|
|
238
|
-
|
|
276
|
+
if (!logoutApiFn) return Promise.reject(new Error(msg("logoutApi")));
|
|
277
|
+
return logoutApiFn();
|
|
239
278
|
},
|
|
240
279
|
getUserInfoApi() {
|
|
241
|
-
|
|
280
|
+
if (!getUserInfoApiFn)
|
|
281
|
+
return Promise.reject(new Error(msg("getUserInfoApi")));
|
|
282
|
+
return getUserInfoApiFn();
|
|
242
283
|
},
|
|
243
|
-
refreshTokenApi(
|
|
244
|
-
|
|
284
|
+
refreshTokenApi(refreshToken) {
|
|
285
|
+
if (!refreshTokenApiFn)
|
|
286
|
+
return Promise.reject(new Error(msg("refreshTokenApi")));
|
|
287
|
+
return refreshTokenApiFn(refreshToken);
|
|
245
288
|
}
|
|
246
289
|
};
|
|
247
|
-
return
|
|
290
|
+
return bridgeInstance;
|
|
248
291
|
}
|
|
249
292
|
export {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
293
|
+
createCoreBridge,
|
|
294
|
+
createGenerateRouteMetaRawTree,
|
|
295
|
+
createStorageWithNamespace,
|
|
296
|
+
createUseState
|
|
254
297
|
};
|