smart-admin-web 10.5.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/LICENSE +201 -0
- package/README.md +78 -0
- package/dist/App.vue.d.ts +3 -0
- package/dist/App.vue.js +54 -0
- package/dist/App.vue.js.map +1 -0
- package/dist/App2.vue.js +5 -0
- package/dist/App2.vue.js.map +1 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/_virtual/_plugin-vue_export-helper.js.map +1 -0
- package/dist/api/client.d.ts +29 -0
- package/dist/api/client.js +139 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/index.d.ts +672 -0
- package/dist/api/index.js +638 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/reauthGate.d.ts +16 -0
- package/dist/api/reauthGate.js +21 -0
- package/dist/api/reauthGate.js.map +1 -0
- package/dist/api/schema.d.ts +10230 -0
- package/dist/assets/icons/ph-subset.json.js +16 -0
- package/dist/assets/icons/ph-subset.json.js.map +1 -0
- package/dist/assets/oauth/dingtalk.svg.js +5 -0
- package/dist/assets/oauth/dingtalk.svg.js.map +1 -0
- package/dist/assets/oauth/gitee.svg.js +5 -0
- package/dist/assets/oauth/gitee.svg.js.map +1 -0
- package/dist/assets/oauth/github.svg.js +5 -0
- package/dist/assets/oauth/github.svg.js.map +1 -0
- package/dist/assets/oauth/qq.svg.js +5 -0
- package/dist/assets/oauth/qq.svg.js.map +1 -0
- package/dist/assets/oauth/wechat.svg.js +5 -0
- package/dist/assets/oauth/wechat.svg.js.map +1 -0
- package/dist/assets/oauth/wecom.svg.js +5 -0
- package/dist/assets/oauth/wecom.svg.js.map +1 -0
- package/dist/assets/svg/star.svg.js +6 -0
- package/dist/assets/svg/star.svg.js.map +1 -0
- package/dist/components/ApiSelect/index.vue.d.ts +22 -0
- package/dist/components/ApiSelect/index.vue.js +50 -0
- package/dist/components/ApiSelect/index.vue.js.map +1 -0
- package/dist/components/ApiSelect/index2.vue.js +5 -0
- package/dist/components/ApiSelect/index2.vue.js.map +1 -0
- package/dist/components/AppIcon.vue.d.ts +7 -0
- package/dist/components/AppIcon.vue.js +33 -0
- package/dist/components/AppIcon.vue.js.map +1 -0
- package/dist/components/AppIcon2.vue.js +5 -0
- package/dist/components/AppIcon2.vue.js.map +1 -0
- package/dist/components/Chart/BarChart.vue.d.ts +13 -0
- package/dist/components/Chart/BarChart.vue.js +27 -0
- package/dist/components/Chart/BarChart.vue.js.map +1 -0
- package/dist/components/Chart/BarChart2.vue.js +5 -0
- package/dist/components/Chart/BarChart2.vue.js.map +1 -0
- package/dist/components/Chart/LineChart.vue.d.ts +15 -0
- package/dist/components/Chart/LineChart.vue.js +33 -0
- package/dist/components/Chart/LineChart.vue.js.map +1 -0
- package/dist/components/Chart/LineChart2.vue.js +5 -0
- package/dist/components/Chart/LineChart2.vue.js.map +1 -0
- package/dist/components/Chart/PieChart.vue.d.ts +14 -0
- package/dist/components/Chart/PieChart.vue.js +31 -0
- package/dist/components/Chart/PieChart.vue.js.map +1 -0
- package/dist/components/Chart/PieChart2.vue.js +5 -0
- package/dist/components/Chart/PieChart2.vue.js.map +1 -0
- package/dist/components/Chart/echarts.d.ts +57 -0
- package/dist/components/Chart/echarts.js +47 -0
- package/dist/components/Chart/echarts.js.map +1 -0
- package/dist/components/Chart/index.vue.d.ts +12 -0
- package/dist/components/Chart/index.vue.js +8 -0
- package/dist/components/Chart/index.vue.js.map +1 -0
- package/dist/components/Chart/index2.vue.js +27 -0
- package/dist/components/Chart/index2.vue.js.map +1 -0
- package/dist/components/CodeBlock/index.vue.d.ts +17 -0
- package/dist/components/CodeBlock/index.vue.js +8 -0
- package/dist/components/CodeBlock/index.vue.js.map +1 -0
- package/dist/components/CodeBlock/index2.vue.js +48 -0
- package/dist/components/CodeBlock/index2.vue.js.map +1 -0
- package/dist/components/CronEditor/index.vue.d.ts +15 -0
- package/dist/components/CronEditor/index.vue.js +8 -0
- package/dist/components/CronEditor/index.vue.js.map +1 -0
- package/dist/components/CronEditor/index2.vue.js +528 -0
- package/dist/components/CronEditor/index2.vue.js.map +1 -0
- package/dist/components/DetailPage/index.vue.d.ts +26 -0
- package/dist/components/DetailPage/index.vue.js +8 -0
- package/dist/components/DetailPage/index.vue.js.map +1 -0
- package/dist/components/DetailPage/index2.vue.js +51 -0
- package/dist/components/DetailPage/index2.vue.js.map +1 -0
- package/dist/components/DictCheckbox/index.vue.d.ts +6 -0
- package/dist/components/DictCheckbox/index.vue.js +43 -0
- package/dist/components/DictCheckbox/index.vue.js.map +1 -0
- package/dist/components/DictCheckbox/index2.vue.js +5 -0
- package/dist/components/DictCheckbox/index2.vue.js.map +1 -0
- package/dist/components/DictRadio/index.vue.d.ts +6 -0
- package/dist/components/DictRadio/index.vue.js +38 -0
- package/dist/components/DictRadio/index.vue.js.map +1 -0
- package/dist/components/DictRadio/index2.vue.js +5 -0
- package/dist/components/DictRadio/index2.vue.js.map +1 -0
- package/dist/components/DictSelect/index.vue.d.ts +6 -0
- package/dist/components/DictSelect/index.vue.js +37 -0
- package/dist/components/DictSelect/index.vue.js.map +1 -0
- package/dist/components/DictSelect/index2.vue.js +5 -0
- package/dist/components/DictSelect/index2.vue.js.map +1 -0
- package/dist/components/DictTag/index.vue.d.ts +10 -0
- package/dist/components/DictTag/index.vue.js +48 -0
- package/dist/components/DictTag/index.vue.js.map +1 -0
- package/dist/components/DictTag/index2.vue.js +5 -0
- package/dist/components/DictTag/index2.vue.js.map +1 -0
- package/dist/components/ErrorBoundary/index.vue.d.ts +13 -0
- package/dist/components/ErrorBoundary/index.vue.js +8 -0
- package/dist/components/ErrorBoundary/index.vue.js.map +1 -0
- package/dist/components/ErrorBoundary/index2.vue.js +61 -0
- package/dist/components/ErrorBoundary/index2.vue.js.map +1 -0
- package/dist/components/ExportColumnsModal/index.vue.d.ts +19 -0
- package/dist/components/ExportColumnsModal/index.vue.js +8 -0
- package/dist/components/ExportColumnsModal/index.vue.js.map +1 -0
- package/dist/components/ExportColumnsModal/index2.vue.js +121 -0
- package/dist/components/ExportColumnsModal/index2.vue.js.map +1 -0
- package/dist/components/FileUpload/index.vue.d.ts +24 -0
- package/dist/components/FileUpload/index.vue.js +42 -0
- package/dist/components/FileUpload/index.vue.js.map +1 -0
- package/dist/components/FileUpload/index2.vue.js +5 -0
- package/dist/components/FileUpload/index2.vue.js.map +1 -0
- package/dist/components/FormContainer/index.vue.d.ts +51 -0
- package/dist/components/FormContainer/index.vue.js +160 -0
- package/dist/components/FormContainer/index.vue.js.map +1 -0
- package/dist/components/FormContainer/index3.vue.js +6 -0
- package/dist/components/FormContainer/index3.vue.js.map +1 -0
- package/dist/components/IconPicker/index.vue.d.ts +18 -0
- package/dist/components/IconPicker/index.vue.js +43 -0
- package/dist/components/IconPicker/index.vue.js.map +1 -0
- package/dist/components/IconPicker/index2.vue.js +5 -0
- package/dist/components/IconPicker/index2.vue.js.map +1 -0
- package/dist/components/ImportWizard/index.vue.d.ts +39 -0
- package/dist/components/ImportWizard/index.vue.js +8 -0
- package/dist/components/ImportWizard/index.vue.js.map +1 -0
- package/dist/components/ImportWizard/index2.vue.js +634 -0
- package/dist/components/ImportWizard/index2.vue.js.map +1 -0
- package/dist/components/JsonEditor/index.vue.d.ts +12 -0
- package/dist/components/JsonEditor/index.vue.js +87 -0
- package/dist/components/JsonEditor/index.vue.js.map +1 -0
- package/dist/components/JsonEditor/index2.vue.js +5 -0
- package/dist/components/JsonEditor/index2.vue.js.map +1 -0
- package/dist/components/MarkdownEditor/MarkdownView.vue.d.ts +6 -0
- package/dist/components/MarkdownEditor/MarkdownView.vue.js +33 -0
- package/dist/components/MarkdownEditor/MarkdownView.vue.js.map +1 -0
- package/dist/components/MarkdownEditor/MarkdownView2.vue.js +5 -0
- package/dist/components/MarkdownEditor/MarkdownView2.vue.js.map +1 -0
- package/dist/components/MarkdownEditor/index.vue.d.ts +10 -0
- package/dist/components/MarkdownEditor/index.vue.js +35 -0
- package/dist/components/MarkdownEditor/index.vue.js.map +1 -0
- package/dist/components/MarkdownEditor/index2.vue.js +5 -0
- package/dist/components/MarkdownEditor/index2.vue.js.map +1 -0
- package/dist/components/MenuSearch.vue.d.ts +10 -0
- package/dist/components/MenuSearch.vue.js +8 -0
- package/dist/components/MenuSearch.vue.js.map +1 -0
- package/dist/components/MenuSearch2.vue.js +121 -0
- package/dist/components/MenuSearch2.vue.js.map +1 -0
- package/dist/components/OrgTreeSelect/index.vue.d.ts +6 -0
- package/dist/components/OrgTreeSelect/index.vue.js +42 -0
- package/dist/components/OrgTreeSelect/index.vue.js.map +1 -0
- package/dist/components/OrgTreeSelect/index2.vue.js +5 -0
- package/dist/components/OrgTreeSelect/index2.vue.js.map +1 -0
- package/dist/components/PasswordStrength/index.vue.d.ts +6 -0
- package/dist/components/PasswordStrength/index.vue.js +8 -0
- package/dist/components/PasswordStrength/index.vue.js.map +1 -0
- package/dist/components/PasswordStrength/index2.vue.js +91 -0
- package/dist/components/PasswordStrength/index2.vue.js.map +1 -0
- package/dist/components/ReauthModal.vue.d.ts +3 -0
- package/dist/components/ReauthModal.vue.js +8 -0
- package/dist/components/ReauthModal.vue.js.map +1 -0
- package/dist/components/ReauthModal2.vue.js +139 -0
- package/dist/components/ReauthModal2.vue.js.map +1 -0
- package/dist/components/RoleSelect/index.vue.d.ts +8 -0
- package/dist/components/RoleSelect/index.vue.js +26 -0
- package/dist/components/RoleSelect/index.vue.js.map +1 -0
- package/dist/components/RoleSelect/index2.vue.js +5 -0
- package/dist/components/RoleSelect/index2.vue.js.map +1 -0
- package/dist/components/SelectTable/index.vue.d.ts +76 -0
- package/dist/components/SelectTable/index.vue.js +8 -0
- package/dist/components/SelectTable/index.vue.js.map +1 -0
- package/dist/components/SelectTable/index2.vue.js +256 -0
- package/dist/components/SelectTable/index2.vue.js.map +1 -0
- package/dist/components/SmartLogo.vue.d.ts +8 -0
- package/dist/components/SmartLogo.vue.js +8 -0
- package/dist/components/SmartLogo.vue.js.map +1 -0
- package/dist/components/SmartLogo2.vue.js +74 -0
- package/dist/components/SmartLogo2.vue.js.map +1 -0
- package/dist/components/StatusSwitch/index.vue.d.ts +21 -0
- package/dist/components/StatusSwitch/index.vue.js +45 -0
- package/dist/components/StatusSwitch/index.vue.js.map +1 -0
- package/dist/components/StatusSwitch/index2.vue.js +5 -0
- package/dist/components/StatusSwitch/index2.vue.js.map +1 -0
- package/dist/components/TableZoomButton/index.vue.d.ts +13 -0
- package/dist/components/TableZoomButton/index.vue.js +42 -0
- package/dist/components/TableZoomButton/index.vue.js.map +1 -0
- package/dist/components/TableZoomButton/index2.vue.js +5 -0
- package/dist/components/TableZoomButton/index2.vue.js.map +1 -0
- package/dist/components/UserPicker/index.vue.d.ts +13 -0
- package/dist/components/UserPicker/index.vue.js +8 -0
- package/dist/components/UserPicker/index.vue.js.map +1 -0
- package/dist/components/UserPicker/index2.vue.js +214 -0
- package/dist/components/UserPicker/index2.vue.js.map +1 -0
- package/dist/components/UserSelect/index.vue.d.ts +9 -0
- package/dist/components/UserSelect/index.vue.js +32 -0
- package/dist/components/UserSelect/index.vue.js.map +1 -0
- package/dist/components/UserSelect/index2.vue.js +5 -0
- package/dist/components/UserSelect/index2.vue.js.map +1 -0
- package/dist/components/oauth/BrandIcon.vue.d.ts +12 -0
- package/dist/components/oauth/BrandIcon.vue.js +8 -0
- package/dist/components/oauth/BrandIcon.vue.js.map +1 -0
- package/dist/components/oauth/BrandIcon2.vue.js +95 -0
- package/dist/components/oauth/BrandIcon2.vue.js.map +1 -0
- package/dist/composables/authMenuRoute.d.ts +32 -0
- package/dist/composables/authMenuRoute.js +37 -0
- package/dist/composables/authMenuRoute.js.map +1 -0
- package/dist/composables/clearClientCache.d.ts +10 -0
- package/dist/composables/clearClientCache.js +17 -0
- package/dist/composables/clearClientCache.js.map +1 -0
- package/dist/composables/useAuthMenu.d.ts +3 -0
- package/dist/composables/useAuthMenu.js +61 -0
- package/dist/composables/useAuthMenu.js.map +1 -0
- package/dist/composables/useBatchDelete.d.ts +18 -0
- package/dist/composables/useBatchDelete.js +21 -0
- package/dist/composables/useBatchDelete.js.map +1 -0
- package/dist/composables/useCompactScreen.d.ts +12 -0
- package/dist/composables/useCompactScreen.js +17 -0
- package/dist/composables/useCompactScreen.js.map +1 -0
- package/dist/composables/useConfirm.d.ts +18 -0
- package/dist/composables/useConfirm.js +61 -0
- package/dist/composables/useConfirm.js.map +1 -0
- package/dist/composables/useFullscreenToggle.d.ts +11 -0
- package/dist/composables/useFullscreenToggle.js +64 -0
- package/dist/composables/useFullscreenToggle.js.map +1 -0
- package/dist/composables/useHeaderTools.d.ts +31 -0
- package/dist/composables/useHeaderTools.js +15 -0
- package/dist/composables/useHeaderTools.js.map +1 -0
- package/dist/composables/useLayoutMenu.d.ts +17 -0
- package/dist/composables/useLayoutMenu.js +93 -0
- package/dist/composables/useLayoutMenu.js.map +1 -0
- package/dist/composables/useMenuBadge.d.ts +11 -0
- package/dist/composables/useMenuBadge.js +17 -0
- package/dist/composables/useMenuBadge.js.map +1 -0
- package/dist/composables/useMenuFlat.d.ts +8 -0
- package/dist/composables/useMenuFlat.js +29 -0
- package/dist/composables/useMenuFlat.js.map +1 -0
- package/dist/composables/useModule.d.ts +16 -0
- package/dist/composables/useModule.js +44 -0
- package/dist/composables/useModule.js.map +1 -0
- package/dist/composables/useNoticeAction.d.ts +8 -0
- package/dist/composables/useNoticeAction.js +79 -0
- package/dist/composables/useNoticeAction.js.map +1 -0
- package/dist/composables/usePageTitle.d.ts +1 -0
- package/dist/composables/usePageTitle.js +20 -0
- package/dist/composables/usePageTitle.js.map +1 -0
- package/dist/composables/useRealtime.d.ts +31 -0
- package/dist/composables/useRealtime.js +59 -0
- package/dist/composables/useRealtime.js.map +1 -0
- package/dist/composables/useSite.d.ts +24 -0
- package/dist/composables/useSite.js +27 -0
- package/dist/composables/useSite.js.map +1 -0
- package/dist/composables/useTabTitle.d.ts +1 -0
- package/dist/composables/useTabTitle.js +10 -0
- package/dist/composables/useTabTitle.js.map +1 -0
- package/dist/composables/useTableRowSort.d.ts +20 -0
- package/dist/composables/useTableRowSort.js +59 -0
- package/dist/composables/useTableRowSort.js.map +1 -0
- package/dist/composables/useTableZoom.d.ts +5 -0
- package/dist/composables/useTableZoom.js +30 -0
- package/dist/composables/useTableZoom.js.map +1 -0
- package/dist/composables/useTheme.d.ts +13 -0
- package/dist/composables/useTheme.js +30 -0
- package/dist/composables/useTheme.js.map +1 -0
- package/dist/composables/useVisualViewportHeight.d.ts +3 -0
- package/dist/composables/useVisualViewportHeight.js +16 -0
- package/dist/composables/useVisualViewportHeight.js.map +1 -0
- package/dist/createSmartAdmin.d.ts +56 -0
- package/dist/createSmartAdmin.js +76 -0
- package/dist/createSmartAdmin.js.map +1 -0
- package/dist/directives/auth.d.ts +16 -0
- package/dist/directives/auth.js +19 -0
- package/dist/directives/auth.js.map +1 -0
- package/dist/env.d.ts +10 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +273 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts/AppHeader.vue.d.ts +12 -0
- package/dist/layouts/AppHeader.vue.js +8 -0
- package/dist/layouts/AppHeader.vue.js.map +1 -0
- package/dist/layouts/AppHeader2.vue.js +352 -0
- package/dist/layouts/AppHeader2.vue.js.map +1 -0
- package/dist/layouts/LayoutModeCards.vue.d.ts +3 -0
- package/dist/layouts/LayoutModeCards.vue.js +8 -0
- package/dist/layouts/LayoutModeCards.vue.js.map +1 -0
- package/dist/layouts/LayoutModeCards2.vue.js +67 -0
- package/dist/layouts/LayoutModeCards2.vue.js.map +1 -0
- package/dist/layouts/NoticeBell.vue.d.ts +3 -0
- package/dist/layouts/NoticeBell.vue.js +8 -0
- package/dist/layouts/NoticeBell.vue.js.map +1 -0
- package/dist/layouts/NoticeBell2.vue.js +292 -0
- package/dist/layouts/NoticeBell2.vue.js.map +1 -0
- package/dist/layouts/PersonalLayout.vue.d.ts +3 -0
- package/dist/layouts/PersonalLayout.vue.js +8 -0
- package/dist/layouts/PersonalLayout.vue.js.map +1 -0
- package/dist/layouts/PersonalLayout2.vue.js +65 -0
- package/dist/layouts/PersonalLayout2.vue.js.map +1 -0
- package/dist/layouts/SettingRow.vue.d.ts +16 -0
- package/dist/layouts/SettingRow.vue.js +8 -0
- package/dist/layouts/SettingRow.vue.js.map +1 -0
- package/dist/layouts/SettingRow2.vue.js +23 -0
- package/dist/layouts/SettingRow2.vue.js.map +1 -0
- package/dist/layouts/SettingsDrawer.vue.d.ts +10 -0
- package/dist/layouts/SettingsDrawer.vue.js +8 -0
- package/dist/layouts/SettingsDrawer.vue.js.map +1 -0
- package/dist/layouts/SettingsDrawer2.vue.js +380 -0
- package/dist/layouts/SettingsDrawer2.vue.js.map +1 -0
- package/dist/layouts/TabsBar.vue.d.ts +3 -0
- package/dist/layouts/TabsBar.vue.js +8 -0
- package/dist/layouts/TabsBar.vue.js.map +1 -0
- package/dist/layouts/TabsBar2.vue.js +132 -0
- package/dist/layouts/TabsBar2.vue.js.map +1 -0
- package/dist/layouts/components/SideNav.vue.d.ts +15 -0
- package/dist/layouts/components/SideNav.vue.js +8 -0
- package/dist/layouts/components/SideNav.vue.js.map +1 -0
- package/dist/layouts/components/SideNav2.vue.js +49 -0
- package/dist/layouts/components/SideNav2.vue.js.map +1 -0
- package/dist/layouts/default.vue.d.ts +3 -0
- package/dist/layouts/default.vue.js +8 -0
- package/dist/layouts/default.vue.js.map +1 -0
- package/dist/layouts/default2.vue.js +213 -0
- package/dist/layouts/default2.vue.js.map +1 -0
- package/dist/lib/chunkReload.d.ts +9 -0
- package/dist/lib/chunkReload.js +24 -0
- package/dist/lib/chunkReload.js.map +1 -0
- package/dist/lib/icons.d.ts +2 -0
- package/dist/lib/icons.js +39 -0
- package/dist/lib/icons.js.map +1 -0
- package/dist/lib/loadingBar.d.ts +7 -0
- package/dist/lib/loadingBar.js +18 -0
- package/dist/lib/loadingBar.js.map +1 -0
- package/dist/lib/markdown.d.ts +8 -0
- package/dist/lib/markdown.js +16 -0
- package/dist/lib/markdown.js.map +1 -0
- package/dist/lib/markdownLinks.d.ts +26 -0
- package/dist/lib/markdownLinks.js +21 -0
- package/dist/lib/markdownLinks.js.map +1 -0
- package/dist/lib/noticeActions.d.ts +13 -0
- package/dist/lib/noticeActions.js +16 -0
- package/dist/lib/noticeActions.js.map +1 -0
- package/dist/lib/runtime.d.ts +21 -0
- package/dist/lib/runtime.js +13 -0
- package/dist/lib/runtime.js.map +1 -0
- package/dist/locales/en-US.d.ts +1358 -0
- package/dist/locales/en-US.js +1362 -0
- package/dist/locales/en-US.js.map +1 -0
- package/dist/locales/index.d.ts +30 -0
- package/dist/locales/index.js +46 -0
- package/dist/locales/index.js.map +1 -0
- package/dist/locales/menuTitle.d.ts +8 -0
- package/dist/locales/menuTitle.js +19 -0
- package/dist/locales/menuTitle.js.map +1 -0
- package/dist/locales/zh-CN.d.ts +1358 -0
- package/dist/locales/zh-CN.js +1368 -0
- package/dist/locales/zh-CN.js.map +1 -0
- package/dist/router/bootFailure.d.ts +8 -0
- package/dist/router/bootFailure.js +11 -0
- package/dist/router/bootFailure.js.map +1 -0
- package/dist/router/detailRoutes.d.ts +2 -0
- package/dist/router/detailRoutes.js +19 -0
- package/dist/router/detailRoutes.js.map +1 -0
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.js +58 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/namedPage.d.ts +13 -0
- package/dist/router/namedPage.js +12 -0
- package/dist/router/namedPage.js.map +1 -0
- package/dist/router/routes.d.ts +2 -0
- package/dist/router/routes.js +121 -0
- package/dist/router/routes.js.map +1 -0
- package/dist/router/viewRegistry.d.ts +18 -0
- package/dist/router/viewRegistry.js +26 -0
- package/dist/router/viewRegistry.js.map +1 -0
- package/dist/stores/app.d.ts +83 -0
- package/dist/stores/app.js +82 -0
- package/dist/stores/app.js.map +1 -0
- package/dist/stores/auth.d.ts +106 -0
- package/dist/stores/auth.js +59 -0
- package/dist/stores/auth.js.map +1 -0
- package/dist/stores/dict.d.ts +11 -0
- package/dist/stores/dict.js +36 -0
- package/dist/stores/dict.js.map +1 -0
- package/dist/stores/tabs.d.ts +53 -0
- package/dist/stores/tabs.js +88 -0
- package/dist/stores/tabs.js.map +1 -0
- package/dist/stores/user.d.ts +64 -0
- package/dist/stores/user.js +64 -0
- package/dist/stores/user.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/theme/accents.d.ts +2 -0
- package/dist/theme/accents.js +5 -0
- package/dist/theme/accents.js.map +1 -0
- package/dist/theme/mix.d.ts +26 -0
- package/dist/theme/mix.js +43 -0
- package/dist/theme/mix.js.map +1 -0
- package/dist/theme/naive-theme.d.ts +9 -0
- package/dist/theme/naive-theme.js +89 -0
- package/dist/theme/naive-theme.js.map +1 -0
- package/dist/types/api.d.ts +714 -0
- package/dist/types/api.js +15 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/menu.d.ts +67 -0
- package/dist/types/menu.js +26 -0
- package/dist/types/menu.js.map +1 -0
- package/dist/utils/chunkUpload.d.ts +6 -0
- package/dist/utils/chunkUpload.js +35 -0
- package/dist/utils/chunkUpload.js.map +1 -0
- package/dist/utils/download.d.ts +8 -0
- package/dist/utils/download.js +8 -0
- package/dist/utils/download.js.map +1 -0
- package/dist/utils/error.d.ts +14 -0
- package/dist/utils/error.js +50 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/format.d.ts +20 -0
- package/dist/utils/format.js +19 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/importDup.d.ts +17 -0
- package/dist/utils/importDup.js +18 -0
- package/dist/utils/importDup.js.map +1 -0
- package/dist/utils/oauthBrand.d.ts +100 -0
- package/dist/utils/oauthBrand.js +97 -0
- package/dist/utils/oauthBrand.js.map +1 -0
- package/dist/utils/tree.d.ts +33 -0
- package/dist/utils/tree.js +47 -0
- package/dist/utils/tree.js.map +1 -0
- package/dist/utils/ua.d.ts +7 -0
- package/dist/utils/ua.js +33 -0
- package/dist/utils/ua.js.map +1 -0
- package/dist/utils/url.d.ts +16 -0
- package/dist/utils/url.js +13 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/views/dashboard/biz.vue.d.ts +3 -0
- package/dist/views/dashboard/biz.vue.js +8 -0
- package/dist/views/dashboard/biz.vue.js.map +1 -0
- package/dist/views/dashboard/biz2.vue.js +136 -0
- package/dist/views/dashboard/biz2.vue.js.map +1 -0
- package/dist/views/dashboard/workbench.vue.d.ts +3 -0
- package/dist/views/dashboard/workbench.vue.js +8 -0
- package/dist/views/dashboard/workbench.vue.js.map +1 -0
- package/dist/views/dashboard/workbench2.vue.js +195 -0
- package/dist/views/dashboard/workbench2.vue.js.map +1 -0
- package/dist/views/embed/iframe.vue.d.ts +3 -0
- package/dist/views/embed/iframe.vue.js +8 -0
- package/dist/views/embed/iframe.vue.js.map +1 -0
- package/dist/views/embed/iframe2.vue.js +21 -0
- package/dist/views/embed/iframe2.vue.js.map +1 -0
- package/dist/views/error/404.vue.d.ts +3 -0
- package/dist/views/error/404.vue.js +8 -0
- package/dist/views/error/404.vue.js.map +1 -0
- package/dist/views/error/4042.vue.js +31 -0
- package/dist/views/error/4042.vue.js.map +1 -0
- package/dist/views/error/BootError.vue.d.ts +3 -0
- package/dist/views/error/BootError.vue.js +8 -0
- package/dist/views/error/BootError.vue.js.map +1 -0
- package/dist/views/error/BootError2.vue.js +57 -0
- package/dist/views/error/BootError2.vue.js.map +1 -0
- package/dist/views/error/MissingRoute.vue.d.ts +3 -0
- package/dist/views/error/MissingRoute.vue.js +8 -0
- package/dist/views/error/MissingRoute.vue.js.map +1 -0
- package/dist/views/error/MissingRoute2.vue.js +23 -0
- package/dist/views/error/MissingRoute2.vue.js.map +1 -0
- package/dist/views/login/LoginForm.vue.d.ts +12 -0
- package/dist/views/login/LoginForm.vue.js +8 -0
- package/dist/views/login/LoginForm.vue.js.map +1 -0
- package/dist/views/login/LoginForm2.vue.js +642 -0
- package/dist/views/login/LoginForm2.vue.js.map +1 -0
- package/dist/views/login/index.vue.d.ts +3 -0
- package/dist/views/login/index.vue.js +8 -0
- package/dist/views/login/index.vue.js.map +1 -0
- package/dist/views/login/index2.vue.js +79 -0
- package/dist/views/login/index2.vue.js.map +1 -0
- package/dist/views/login/skins/AuroraGlass.vue.d.ts +3 -0
- package/dist/views/login/skins/AuroraGlass.vue.js +8 -0
- package/dist/views/login/skins/AuroraGlass.vue.js.map +1 -0
- package/dist/views/login/skins/AuroraGlass2.vue.js +80 -0
- package/dist/views/login/skins/AuroraGlass2.vue.js.map +1 -0
- package/dist/views/login/skins/SplitPanel.vue.d.ts +3 -0
- package/dist/views/login/skins/SplitPanel.vue.js +8 -0
- package/dist/views/login/skins/SplitPanel.vue.js.map +1 -0
- package/dist/views/login/skins/SplitPanel2.vue.js +85 -0
- package/dist/views/login/skins/SplitPanel2.vue.js.map +1 -0
- package/dist/views/login/skins/Spotlight.vue.d.ts +3 -0
- package/dist/views/login/skins/Spotlight.vue.js +8 -0
- package/dist/views/login/skins/Spotlight.vue.js.map +1 -0
- package/dist/views/login/skins/Spotlight2.vue.js +36 -0
- package/dist/views/login/skins/Spotlight2.vue.js.map +1 -0
- package/dist/views/login/skins.d.ts +8 -0
- package/dist/views/login/skins.js +13 -0
- package/dist/views/login/skins.js.map +1 -0
- package/dist/views/mfa/bindComplete.d.ts +7 -0
- package/dist/views/mfa/bindComplete.js +8 -0
- package/dist/views/mfa/bindComplete.js.map +1 -0
- package/dist/views/mfa/index.vue.d.ts +3 -0
- package/dist/views/mfa/index.vue.js +8 -0
- package/dist/views/mfa/index.vue.js.map +1 -0
- package/dist/views/mfa/index2.vue.js +425 -0
- package/dist/views/mfa/index2.vue.js.map +1 -0
- package/dist/views/module/index.vue.d.ts +3 -0
- package/dist/views/module/index.vue.js +8 -0
- package/dist/views/module/index.vue.js.map +1 -0
- package/dist/views/module/index2.vue.js +142 -0
- package/dist/views/module/index2.vue.js.map +1 -0
- package/dist/views/oauth/callback.vue.d.ts +3 -0
- package/dist/views/oauth/callback.vue.js +8 -0
- package/dist/views/oauth/callback.vue.js.map +1 -0
- package/dist/views/oauth/callback2.vue.js +86 -0
- package/dist/views/oauth/callback2.vue.js.map +1 -0
- package/dist/views/personal/bindings.vue.d.ts +3 -0
- package/dist/views/personal/bindings.vue.js +8 -0
- package/dist/views/personal/bindings.vue.js.map +1 -0
- package/dist/views/personal/bindings2.vue.js +220 -0
- package/dist/views/personal/bindings2.vue.js.map +1 -0
- package/dist/views/personal/notice.vue.d.ts +3 -0
- package/dist/views/personal/notice.vue.js +5 -0
- package/dist/views/personal/notice.vue.js.map +1 -0
- package/dist/views/personal/notice2.vue.js +163 -0
- package/dist/views/personal/notice2.vue.js.map +1 -0
- package/dist/views/personal/password.vue.d.ts +3 -0
- package/dist/views/personal/password.vue.js +5 -0
- package/dist/views/personal/password.vue.js.map +1 -0
- package/dist/views/personal/password2.vue.js +147 -0
- package/dist/views/personal/password2.vue.js.map +1 -0
- package/dist/views/personal/profile.vue.d.ts +3 -0
- package/dist/views/personal/profile.vue.js +8 -0
- package/dist/views/personal/profile.vue.js.map +1 -0
- package/dist/views/personal/profile2.vue.js +264 -0
- package/dist/views/personal/profile2.vue.js.map +1 -0
- package/dist/views/personal/security.vue.d.ts +3 -0
- package/dist/views/personal/security.vue.js +8 -0
- package/dist/views/personal/security.vue.js.map +1 -0
- package/dist/views/personal/security2.vue.js +82 -0
- package/dist/views/personal/security2.vue.js.map +1 -0
- package/dist/views/personal/sessions.vue.d.ts +3 -0
- package/dist/views/personal/sessions.vue.js +8 -0
- package/dist/views/personal/sessions.vue.js.map +1 -0
- package/dist/views/personal/sessions2.vue.js +101 -0
- package/dist/views/personal/sessions2.vue.js.map +1 -0
- package/dist/views/system/cache/index.vue.d.ts +3 -0
- package/dist/views/system/cache/index.vue.js +8 -0
- package/dist/views/system/cache/index.vue.js.map +1 -0
- package/dist/views/system/cache/index2.vue.js +113 -0
- package/dist/views/system/cache/index2.vue.js.map +1 -0
- package/dist/views/system/config/components/ConfigFormModal.vue.d.ts +16 -0
- package/dist/views/system/config/components/ConfigFormModal.vue.js +5 -0
- package/dist/views/system/config/components/ConfigFormModal.vue.js.map +1 -0
- package/dist/views/system/config/components/ConfigFormModal2.vue.js +177 -0
- package/dist/views/system/config/components/ConfigFormModal2.vue.js.map +1 -0
- package/dist/views/system/config/components/ExternalAuthConfig.vue.d.ts +3 -0
- package/dist/views/system/config/components/ExternalAuthConfig.vue.js +8 -0
- package/dist/views/system/config/components/ExternalAuthConfig.vue.js.map +1 -0
- package/dist/views/system/config/components/ExternalAuthConfig2.vue.js +218 -0
- package/dist/views/system/config/components/ExternalAuthConfig2.vue.js.map +1 -0
- package/dist/views/system/config/components/GroupExtraConfig.vue.d.ts +9 -0
- package/dist/views/system/config/components/GroupExtraConfig.vue.js +8 -0
- package/dist/views/system/config/components/GroupExtraConfig.vue.js.map +1 -0
- package/dist/views/system/config/components/GroupExtraConfig2.vue.js +108 -0
- package/dist/views/system/config/components/GroupExtraConfig2.vue.js.map +1 -0
- package/dist/views/system/config/components/HighSensConfig.vue.d.ts +3 -0
- package/dist/views/system/config/components/HighSensConfig.vue.js +5 -0
- package/dist/views/system/config/components/HighSensConfig.vue.js.map +1 -0
- package/dist/views/system/config/components/HighSensConfig2.vue.js +134 -0
- package/dist/views/system/config/components/HighSensConfig2.vue.js.map +1 -0
- package/dist/views/system/config/components/JobConfig.vue.d.ts +3 -0
- package/dist/views/system/config/components/JobConfig.vue.js +5 -0
- package/dist/views/system/config/components/JobConfig.vue.js.map +1 -0
- package/dist/views/system/config/components/JobConfig2.vue.js +116 -0
- package/dist/views/system/config/components/JobConfig2.vue.js.map +1 -0
- package/dist/views/system/config/components/OtherConfig.vue.d.ts +3 -0
- package/dist/views/system/config/components/OtherConfig.vue.js +5 -0
- package/dist/views/system/config/components/OtherConfig.vue.js.map +1 -0
- package/dist/views/system/config/components/OtherConfig2.vue.js +121 -0
- package/dist/views/system/config/components/OtherConfig2.vue.js.map +1 -0
- package/dist/views/system/config/components/SecurityConfig.vue.d.ts +3 -0
- package/dist/views/system/config/components/SecurityConfig.vue.js +8 -0
- package/dist/views/system/config/components/SecurityConfig.vue.js.map +1 -0
- package/dist/views/system/config/components/SecurityConfig2.vue.js +456 -0
- package/dist/views/system/config/components/SecurityConfig2.vue.js.map +1 -0
- package/dist/views/system/config/components/SysBaseConfig.vue.d.ts +3 -0
- package/dist/views/system/config/components/SysBaseConfig.vue.js +5 -0
- package/dist/views/system/config/components/SysBaseConfig.vue.js.map +1 -0
- package/dist/views/system/config/components/SysBaseConfig2.vue.js +107 -0
- package/dist/views/system/config/components/SysBaseConfig2.vue.js.map +1 -0
- package/dist/views/system/config/components/UploadConfig.vue.d.ts +3 -0
- package/dist/views/system/config/components/UploadConfig.vue.js +5 -0
- package/dist/views/system/config/components/UploadConfig.vue.js.map +1 -0
- package/dist/views/system/config/components/UploadConfig2.vue.js +135 -0
- package/dist/views/system/config/components/UploadConfig2.vue.js.map +1 -0
- package/dist/views/system/config/groups.d.ts +9 -0
- package/dist/views/system/config/groups.js +18 -0
- package/dist/views/system/config/groups.js.map +1 -0
- package/dist/views/system/config/index.vue.d.ts +3 -0
- package/dist/views/system/config/index.vue.js +5 -0
- package/dist/views/system/config/index.vue.js.map +1 -0
- package/dist/views/system/config/index2.vue.js +127 -0
- package/dist/views/system/config/index2.vue.js.map +1 -0
- package/dist/views/system/dict/index.vue.d.ts +3 -0
- package/dist/views/system/dict/index.vue.js +8 -0
- package/dist/views/system/dict/index.vue.js.map +1 -0
- package/dist/views/system/dict/index2.vue.js +560 -0
- package/dist/views/system/dict/index2.vue.js.map +1 -0
- package/dist/views/system/file/index.vue.d.ts +3 -0
- package/dist/views/system/file/index.vue.js +5 -0
- package/dist/views/system/file/index.vue.js.map +1 -0
- package/dist/views/system/file/index2.vue.js +186 -0
- package/dist/views/system/file/index2.vue.js.map +1 -0
- package/dist/views/system/job/index.vue.d.ts +3 -0
- package/dist/views/system/job/index.vue.js +8 -0
- package/dist/views/system/job/index.vue.js.map +1 -0
- package/dist/views/system/job/index2.vue.js +1167 -0
- package/dist/views/system/job/index2.vue.js.map +1 -0
- package/dist/views/system/job-log/index.vue.d.ts +3 -0
- package/dist/views/system/job-log/index.vue.js +8 -0
- package/dist/views/system/job-log/index.vue.js.map +1 -0
- package/dist/views/system/job-log/index2.vue.js +411 -0
- package/dist/views/system/job-log/index2.vue.js.map +1 -0
- package/dist/views/system/job-monitor/index.vue.d.ts +3 -0
- package/dist/views/system/job-monitor/index.vue.js +8 -0
- package/dist/views/system/job-monitor/index.vue.js.map +1 -0
- package/dist/views/system/job-monitor/index2.vue.js +253 -0
- package/dist/views/system/job-monitor/index2.vue.js.map +1 -0
- package/dist/views/system/log/exception/index.vue.d.ts +3 -0
- package/dist/views/system/log/exception/index.vue.js +8 -0
- package/dist/views/system/log/exception/index.vue.js.map +1 -0
- package/dist/views/system/log/exception/index2.vue.js +216 -0
- package/dist/views/system/log/exception/index2.vue.js.map +1 -0
- package/dist/views/system/log/login/index.vue.d.ts +3 -0
- package/dist/views/system/log/login/index.vue.js +5 -0
- package/dist/views/system/log/login/index.vue.js.map +1 -0
- package/dist/views/system/log/login/index2.vue.js +113 -0
- package/dist/views/system/log/login/index2.vue.js.map +1 -0
- package/dist/views/system/log/op/index.vue.d.ts +3 -0
- package/dist/views/system/log/op/index.vue.js +8 -0
- package/dist/views/system/log/op/index.vue.js.map +1 -0
- package/dist/views/system/log/op/index2.vue.js +332 -0
- package/dist/views/system/log/op/index2.vue.js.map +1 -0
- package/dist/views/system/menu/components/ButtonManager.vue.d.ts +21 -0
- package/dist/views/system/menu/components/ButtonManager.vue.js +8 -0
- package/dist/views/system/menu/components/ButtonManager.vue.js.map +1 -0
- package/dist/views/system/menu/components/ButtonManager2.vue.js +498 -0
- package/dist/views/system/menu/components/ButtonManager2.vue.js.map +1 -0
- package/dist/views/system/menu/components/MenuFormModal.vue.d.ts +22 -0
- package/dist/views/system/menu/components/MenuFormModal.vue.js +8 -0
- package/dist/views/system/menu/components/MenuFormModal.vue.js.map +1 -0
- package/dist/views/system/menu/components/MenuFormModal2.vue.js +259 -0
- package/dist/views/system/menu/components/MenuFormModal2.vue.js.map +1 -0
- package/dist/views/system/menu/index.vue.d.ts +3 -0
- package/dist/views/system/menu/index.vue.js +8 -0
- package/dist/views/system/menu/index.vue.js.map +1 -0
- package/dist/views/system/menu/index2.vue.js +391 -0
- package/dist/views/system/menu/index2.vue.js.map +1 -0
- package/dist/views/system/module/index.vue.d.ts +3 -0
- package/dist/views/system/module/index.vue.js +8 -0
- package/dist/views/system/module/index.vue.js.map +1 -0
- package/dist/views/system/module/index2.vue.js +344 -0
- package/dist/views/system/module/index2.vue.js.map +1 -0
- package/dist/views/system/monitor/index.vue.d.ts +3 -0
- package/dist/views/system/monitor/index.vue.js +8 -0
- package/dist/views/system/monitor/index.vue.js.map +1 -0
- package/dist/views/system/monitor/index2.vue.js +184 -0
- package/dist/views/system/monitor/index2.vue.js.map +1 -0
- package/dist/views/system/notice/index.vue.d.ts +3 -0
- package/dist/views/system/notice/index.vue.js +8 -0
- package/dist/views/system/notice/index.vue.js.map +1 -0
- package/dist/views/system/notice/index2.vue.js +401 -0
- package/dist/views/system/notice/index2.vue.js.map +1 -0
- package/dist/views/system/org/index.vue.d.ts +3 -0
- package/dist/views/system/org/index.vue.js +8 -0
- package/dist/views/system/org/index.vue.js.map +1 -0
- package/dist/views/system/org/index2.vue.js +397 -0
- package/dist/views/system/org/index2.vue.js.map +1 -0
- package/dist/views/system/position/index.vue.d.ts +3 -0
- package/dist/views/system/position/index.vue.js +5 -0
- package/dist/views/system/position/index.vue.js.map +1 -0
- package/dist/views/system/position/index2.vue.js +211 -0
- package/dist/views/system/position/index2.vue.js.map +1 -0
- package/dist/views/system/recycle/index.vue.d.ts +3 -0
- package/dist/views/system/recycle/index.vue.js +8 -0
- package/dist/views/system/recycle/index.vue.js.map +1 -0
- package/dist/views/system/recycle/index2.vue.js +121 -0
- package/dist/views/system/recycle/index2.vue.js.map +1 -0
- package/dist/views/system/role/components/GrantMenuTable.vue.d.ts +18 -0
- package/dist/views/system/role/components/GrantMenuTable.vue.js +8 -0
- package/dist/views/system/role/components/GrantMenuTable.vue.js.map +1 -0
- package/dist/views/system/role/components/GrantMenuTable2.vue.js +212 -0
- package/dist/views/system/role/components/GrantMenuTable2.vue.js.map +1 -0
- package/dist/views/system/role/components/grantMenuGroups.d.ts +31 -0
- package/dist/views/system/role/components/grantMenuGroups.js +76 -0
- package/dist/views/system/role/components/grantMenuGroups.js.map +1 -0
- package/dist/views/system/role/index.vue.d.ts +3 -0
- package/dist/views/system/role/index.vue.js +5 -0
- package/dist/views/system/role/index.vue.js.map +1 -0
- package/dist/views/system/role/index2.vue.js +476 -0
- package/dist/views/system/role/index2.vue.js.map +1 -0
- package/dist/views/system/session/index.vue.d.ts +3 -0
- package/dist/views/system/session/index.vue.js +5 -0
- package/dist/views/system/session/index.vue.js.map +1 -0
- package/dist/views/system/session/index2.vue.js +80 -0
- package/dist/views/system/session/index2.vue.js.map +1 -0
- package/dist/views/system/user/components/ResetPasswordModal.vue.d.ts +10 -0
- package/dist/views/system/user/components/ResetPasswordModal.vue.js +8 -0
- package/dist/views/system/user/components/ResetPasswordModal.vue.js.map +1 -0
- package/dist/views/system/user/components/ResetPasswordModal2.vue.js +111 -0
- package/dist/views/system/user/components/ResetPasswordModal2.vue.js.map +1 -0
- package/dist/views/system/user/components/UserFormModal.vue.d.ts +30 -0
- package/dist/views/system/user/components/UserFormModal.vue.js +8 -0
- package/dist/views/system/user/components/UserFormModal.vue.js.map +1 -0
- package/dist/views/system/user/components/UserFormModal2.vue.js +415 -0
- package/dist/views/system/user/components/UserFormModal2.vue.js.map +1 -0
- package/dist/views/system/user/index.vue.d.ts +3 -0
- package/dist/views/system/user/index.vue.js +8 -0
- package/dist/views/system/user/index.vue.js.map +1 -0
- package/dist/views/system/user/index2.vue.js +427 -0
- package/dist/views/system/user/index2.vue.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useAuthStore as M } from "../stores/auth.js";
|
|
2
|
+
import { useTabsStore as I } from "../stores/tabs.js";
|
|
3
|
+
import { useUserStore as f } from "../stores/user.js";
|
|
4
|
+
import { personalApi as s } from "../api/index.js";
|
|
5
|
+
import { buildRoutesForModule as S } from "./useAuthMenu.js";
|
|
6
|
+
import { router as v } from "../router/index.js";
|
|
7
|
+
let a = null;
|
|
8
|
+
async function o(e) {
|
|
9
|
+
return await S(e), { chooser: !1, moduleId: e };
|
|
10
|
+
}
|
|
11
|
+
function D() {
|
|
12
|
+
const e = M();
|
|
13
|
+
function m() {
|
|
14
|
+
return a ?? (a = c().finally(() => {
|
|
15
|
+
a = null;
|
|
16
|
+
})), a;
|
|
17
|
+
}
|
|
18
|
+
async function c() {
|
|
19
|
+
const [{ modules: r, defaultModuleId: n }, i, l] = await Promise.all([
|
|
20
|
+
s.modules(),
|
|
21
|
+
s.permissions().then((t) => ({ ok: !0, codes: t })).catch(() => ({ ok: !1, codes: [] })),
|
|
22
|
+
s.profile().then((t) => ({ sadm: t.isSuperAdmin, avatar: t.avatar ?? null })).catch(() => {
|
|
23
|
+
var t;
|
|
24
|
+
return { sadm: ((t = f().userInfo) == null ? void 0 : t.isSuperAdmin) ?? !1, avatar: null };
|
|
25
|
+
})
|
|
26
|
+
]);
|
|
27
|
+
e.modules = r, e.defaultModuleId = n ?? null, e.permissionCodes = i.codes, e.permissionsLoaded = i.ok, e.isSuperAdmin = l.sadm;
|
|
28
|
+
const d = f();
|
|
29
|
+
if (d.userInfo && (d.userInfo.avatar = l.avatar), r.length === 0) return { chooser: !0 };
|
|
30
|
+
const u = e.currentModuleId;
|
|
31
|
+
return u && r.some((t) => t.id === u) ? o(u) : r.length === 1 ? o(r[0].id) : n && r.some((t) => t.id === n) ? o(n) : { chooser: !0 };
|
|
32
|
+
}
|
|
33
|
+
async function p(r) {
|
|
34
|
+
await o(r), I().clearTabs(), v.replace(e.homePath);
|
|
35
|
+
}
|
|
36
|
+
async function h(r) {
|
|
37
|
+
await s.setDefaultModule(r), e.defaultModuleId = r;
|
|
38
|
+
}
|
|
39
|
+
return { enter: o, enterInitial: m, switchModule: p, setDefault: h };
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
D as useModule
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=useModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModule.js","sources":["../../src/composables/useModule.ts"],"sourcesContent":["// 多应用门户的进门/切换流程:登录后该直接进哪个应用、还是弹应用选择器,以及切换时清理旧应用的路由与标签。\n// enterInitial() 也是 F5/深链的恢复入口(动态路由只在内存里),路由守卫会调它。\n// 坑:权限码拉取失败时 permissionsLoaded 保持 false,v-auth 走 fail-closed 藏按钮 —— 宁可少显示,不谎报有权限。\nimport { useAuthStore } from '#/stores/auth'\nimport { useTabsStore } from '#/stores/tabs'\nimport { useUserStore } from '#/stores/user'\nimport { personalApi } from '#/api'\nimport { buildRoutesForModule } from './useAuthMenu'\nimport { router } from '#/router'\n\ntype EnterResult = { chooser: true } | { chooser: false; moduleId: number }\n\n// 进门单飞:F5/深链时守卫可能被并发导航各调一次 enterInitial,而 buildRoutesForModule 起手就 resetRouter()\n// —— 后一次会把前一次刚注册的动态路由整片摘掉,表现是偶发 404/白屏。模块级 promise 让并发合流成一次。\nlet entering: Promise<EnterResult> | null = null\n\n/** 进指定应用:重建它的动态路由。 */\nasync function enter(moduleId: number): Promise<EnterResult> {\n await buildRoutesForModule(moduleId)\n return { chooser: false, moduleId }\n}\n\n/** 门户:登录后决定直接进 / 进默认 / 弹选择器,以及切换应用。逻辑与 Naive 无关。 */\nexport function useModule() {\n const auth = useAuthStore()\n\n function enterInitial(): Promise<EnterResult> {\n entering ??= doEnterInitial().finally(() => {\n entering = null\n })\n return entering\n }\n\n async function doEnterInitial(): Promise<EnterResult> {\n // 并行拉模块 + 当前用户权限码。权限码喂 v-auth:成功(哪怕空集=超管)才标 loaded;\n // 失败不阻断进门户,但 permissionsLoaded 保持 false → v-auth fail-closed(藏按钮),不谎报\"有权限\"。\n // profile 拿超管标记喂 v-auth(只对超管 fail-open,普通用户空集则隐藏)+ 顺手回填顶栏头像;失败按普通用户处理(安全侧,不误放行)。\n const [{ modules, defaultModuleId }, perm, profile] = await Promise.all([\n personalApi.modules(),\n personalApi\n .permissions()\n .then(codes => ({ ok: true, codes }))\n .catch(() => ({ ok: false, codes: [] as string[] })),\n personalApi\n .profile()\n .then(p => ({ sadm: p.isSuperAdmin, avatar: p.avatar ?? null }))\n .catch(() => ({ sadm: useUserStore().userInfo?.isSuperAdmin ?? false, avatar: null })),\n ])\n auth.modules = modules\n auth.defaultModuleId = defaultModuleId ?? null\n auth.permissionCodes = perm.codes\n auth.permissionsLoaded = perm.ok\n auth.isSuperAdmin = profile.sadm\n // 顶栏头像:登录出参不含 avatar,这里回填(取不到按无头像处理,顶栏回落图标)\n const user = useUserStore()\n if (user.userInfo) user.userInfo.avatar = profile.avatar\n if (modules.length === 0) return { chooser: true } // 空态:选择器里提示未分配应用\n // F5/深链优先重建\"上次所在应用\"(持久化的 currentModuleId),让其动态路由复活,跨应用深链不落 404。\n const remembered = auth.currentModuleId\n if (remembered && modules.some(m => m.id === remembered)) return enter(remembered)\n if (modules.length === 1) return enter(modules[0]!.id)\n if (defaultModuleId && modules.some(m => m.id === defaultModuleId))\n return enter(defaultModuleId)\n return { chooser: true }\n }\n\n async function switchModule(moduleId: number): Promise<void> {\n await enter(moduleId)\n useTabsStore().clearTabs() // 切应用 → 标签归零(新应用路由已重建)\n router.replace(auth.homePath) // 落到新应用自己的首页\n }\n\n async function setDefault(moduleId: number): Promise<void> {\n await personalApi.setDefaultModule(moduleId)\n auth.defaultModuleId = moduleId // 本地同步,选择页角标立刻转移,不必重拉 /personal/modules\n }\n\n return { enter, enterInitial, switchModule, setDefault }\n}\n"],"names":["entering","enter","moduleId","buildRoutesForModule","useModule","auth","useAuthStore","enterInitial","doEnterInitial","modules","defaultModuleId","perm","profile","personalApi","codes","p","_a","useUserStore","user","remembered","m","switchModule","useTabsStore","router","setDefault"],"mappings":";;;;;;AAcA,IAAIA,IAAwC;AAG5C,eAAeC,EAAMC,GAAwC;AAC3D,eAAMC,EAAqBD,CAAQ,GAC5B,EAAE,SAAS,IAAO,UAAAA,EAAA;AAC3B;AAGO,SAASE,IAAY;AAC1B,QAAMC,IAAOC,EAAA;AAEb,WAASC,IAAqC;AAC5C,WAAAP,UAAaQ,IAAiB,QAAQ,MAAM;AAC1C,MAAAR,IAAW;AAAA,IACb,CAAC,IACMA;AAAA,EACT;AAEA,iBAAeQ,IAAuC;AAIpD,UAAM,CAAC,EAAE,SAAAC,GAAS,iBAAAC,EAAA,GAAmBC,GAAMC,CAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,MACtEC,EAAY,QAAA;AAAA,MACZA,EACG,YAAA,EACA,KAAK,CAAAC,OAAU,EAAE,IAAI,IAAM,OAAAA,EAAA,EAAQ,EACnC,MAAM,OAAO,EAAE,IAAI,IAAO,OAAO,CAAA,IAAiB;AAAA,MACrDD,EACG,QAAA,EACA,KAAK,CAAAE,OAAM,EAAE,MAAMA,EAAE,cAAc,QAAQA,EAAE,UAAU,KAAA,EAAO,EAC9D,MAAM,MAAA;;AAAO,iBAAE,QAAMC,IAAAC,EAAA,EAAe,aAAf,gBAAAD,EAAyB,iBAAgB,IAAO,QAAQ,KAAA;AAAA,OAAO;AAAA,IAAA,CACxF;AACD,IAAAX,EAAK,UAAUI,GACfJ,EAAK,kBAAkBK,KAAmB,MAC1CL,EAAK,kBAAkBM,EAAK,OAC5BN,EAAK,oBAAoBM,EAAK,IAC9BN,EAAK,eAAeO,EAAQ;AAE5B,UAAMM,IAAOD,EAAA;AAEb,QADIC,EAAK,aAAUA,EAAK,SAAS,SAASN,EAAQ,SAC9CH,EAAQ,WAAW,EAAG,QAAO,EAAE,SAAS,GAAA;AAE5C,UAAMU,IAAad,EAAK;AACxB,WAAIc,KAAcV,EAAQ,KAAK,CAAAW,MAAKA,EAAE,OAAOD,CAAU,IAAUlB,EAAMkB,CAAU,IAC7EV,EAAQ,WAAW,IAAUR,EAAMQ,EAAQ,CAAC,EAAG,EAAE,IACjDC,KAAmBD,EAAQ,KAAK,CAAAW,MAAKA,EAAE,OAAOV,CAAe,IACxDT,EAAMS,CAAe,IACvB,EAAE,SAAS,GAAA;AAAA,EACpB;AAEA,iBAAeW,EAAanB,GAAiC;AAC3D,UAAMD,EAAMC,CAAQ,GACpBoB,EAAA,EAAe,UAAA,GACfC,EAAO,QAAQlB,EAAK,QAAQ;AAAA,EAC9B;AAEA,iBAAemB,EAAWtB,GAAiC;AACzD,UAAMW,EAAY,iBAAiBX,CAAQ,GAC3CG,EAAK,kBAAkBH;AAAA,EACzB;AAEA,SAAO,EAAE,OAAAD,GAAO,cAAAM,GAAc,cAAAc,GAAc,YAAAG,EAAA;AAC9C;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NoticeAction } from '../types/api';
|
|
2
|
+
/** 动作样式 → Naive 按钮 type;未知样式按 default。 */
|
|
3
|
+
export declare function noticeActionButtonType(a: NoticeAction): 'primary' | 'error' | 'default';
|
|
4
|
+
export declare function useNoticeAction(): {
|
|
5
|
+
run: (a: NoticeAction) => Promise<boolean>;
|
|
6
|
+
label: (a: NoticeAction) => string;
|
|
7
|
+
buttonType: typeof noticeActionButtonType;
|
|
8
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ref as d, h as v } from "vue";
|
|
2
|
+
import { useDialog as y, useMessage as C, NInput as g } from "naive-ui";
|
|
3
|
+
import { useI18n as k } from "vue-i18n";
|
|
4
|
+
import { useRouter as w } from "vue-router";
|
|
5
|
+
import { callApi as x } from "../api/index.js";
|
|
6
|
+
import { noticeActionLabel as h, classifyNoticeAction as T } from "../lib/noticeActions.js";
|
|
7
|
+
import { translateError as b } from "../utils/error.js";
|
|
8
|
+
function A(e) {
|
|
9
|
+
return e.style === "primary" || e.style === "error" ? e.style : "default";
|
|
10
|
+
}
|
|
11
|
+
function U() {
|
|
12
|
+
const { t: e, te: l } = k(), a = y(), i = C(), m = w(), r = (t) => h(t.label, e, l), s = A;
|
|
13
|
+
function u(t) {
|
|
14
|
+
return new Promise((o) => {
|
|
15
|
+
a.create({
|
|
16
|
+
type: t.style === "error" ? "error" : "warning",
|
|
17
|
+
title: e("common.confirmTitle"),
|
|
18
|
+
content: e("notice.actionConfirm", { label: r(t) }),
|
|
19
|
+
positiveText: e("common.confirm"),
|
|
20
|
+
negativeText: e("common.cancel"),
|
|
21
|
+
onPositiveClick: () => o(!0),
|
|
22
|
+
onNegativeClick: () => o(!1),
|
|
23
|
+
onClose: () => o(!1),
|
|
24
|
+
onMaskClick: () => o(!1),
|
|
25
|
+
onEsc: () => o(!1)
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function f(t) {
|
|
30
|
+
const o = d("");
|
|
31
|
+
return new Promise((n) => {
|
|
32
|
+
a.create({
|
|
33
|
+
type: "info",
|
|
34
|
+
title: r(t),
|
|
35
|
+
content: () => v(g, {
|
|
36
|
+
type: "textarea",
|
|
37
|
+
value: o.value,
|
|
38
|
+
placeholder: e("notice.actionCommentPlaceholder"),
|
|
39
|
+
autosize: { minRows: 3, maxRows: 6 },
|
|
40
|
+
maxlength: 500,
|
|
41
|
+
showCount: !0,
|
|
42
|
+
onUpdateValue: (c) => {
|
|
43
|
+
o.value = c;
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
positiveText: e("common.confirm"),
|
|
47
|
+
negativeText: e("common.cancel"),
|
|
48
|
+
onPositiveClick: () => n(o.value.trim()),
|
|
49
|
+
onNegativeClick: () => n(void 0),
|
|
50
|
+
onClose: () => n(void 0),
|
|
51
|
+
onMaskClick: () => n(void 0),
|
|
52
|
+
onEsc: () => n(void 0)
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function p(t) {
|
|
57
|
+
const o = T(t);
|
|
58
|
+
if (o === "invalid")
|
|
59
|
+
return i.error(e("notice.actionInvalidUrl")), !1;
|
|
60
|
+
if (o === "route")
|
|
61
|
+
return await m.push(t.url), !0;
|
|
62
|
+
let n;
|
|
63
|
+
if (t.comment) {
|
|
64
|
+
if (n = await f(t), n === void 0) return !1;
|
|
65
|
+
} else if (t.confirm && !await u(t))
|
|
66
|
+
return !1;
|
|
67
|
+
try {
|
|
68
|
+
return await x(t.method, t.url, n === void 0 ? void 0 : { comment: n }), i.success(e("notice.actionDone")), !0;
|
|
69
|
+
} catch (c) {
|
|
70
|
+
return i.error(b(c)), !1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { run: p, label: r, buttonType: s };
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
A as noticeActionButtonType,
|
|
77
|
+
U as useNoticeAction
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=useNoticeAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNoticeAction.js","sources":["../../src/composables/useNoticeAction.ts"],"sourcesContent":["// 通知动作按钮的执行样板:确认 / 意见输入 → 请求接口或跳转页面 → toast。\n// 权限仍由目标端点自己判(403 照常提示),这里不做任何鉴权推断。仅限 setup 中调用(useDialog/useMessage)。\nimport { h, ref } from 'vue'\nimport { NInput, useDialog, useMessage } from 'naive-ui'\nimport { useI18n } from 'vue-i18n'\nimport { useRouter } from 'vue-router'\nimport { callApi } from '#/api'\nimport { classifyNoticeAction, noticeActionLabel } from '#/lib/noticeActions'\nimport type { NoticeAction } from '#/types/api'\nimport { translateError } from '#/utils/error'\n\n/** 动作样式 → Naive 按钮 type;未知样式按 default。 */\nexport function noticeActionButtonType(a: NoticeAction): 'primary' | 'error' | 'default' {\n return a.style === 'primary' || a.style === 'error' ? a.style : 'default'\n}\n\nexport function useNoticeAction() {\n const { t, te } = useI18n()\n const dialog = useDialog()\n const message = useMessage()\n const router = useRouter()\n\n const label = (a: NoticeAction) => noticeActionLabel(a.label, t, te)\n const buttonType = noticeActionButtonType\n\n /** 确认框;resolve(是否确认)。 */\n function confirm(a: NoticeAction): Promise<boolean> {\n return new Promise(resolve => {\n dialog.create({\n type: a.style === 'error' ? 'error' : 'warning',\n title: t('common.confirmTitle'),\n content: t('notice.actionConfirm', { label: label(a) }),\n positiveText: t('common.confirm'),\n negativeText: t('common.cancel'),\n onPositiveClick: () => resolve(true),\n onNegativeClick: () => resolve(false),\n onClose: () => resolve(false),\n onMaskClick: () => resolve(false),\n onEsc: () => resolve(false),\n })\n })\n }\n\n /** 意见输入框;resolve(意见文本),取消 resolve(undefined)。 */\n function askComment(a: NoticeAction): Promise<string | undefined> {\n const text = ref('')\n return new Promise(resolve => {\n dialog.create({\n type: 'info',\n title: label(a),\n content: () =>\n h(NInput, {\n type: 'textarea',\n value: text.value,\n placeholder: t('notice.actionCommentPlaceholder'),\n autosize: { minRows: 3, maxRows: 6 },\n maxlength: 500,\n showCount: true,\n onUpdateValue: (v: string) => {\n text.value = v\n },\n }),\n positiveText: t('common.confirm'),\n negativeText: t('common.cancel'),\n onPositiveClick: () => resolve(text.value.trim()),\n onNegativeClick: () => resolve(undefined),\n onClose: () => resolve(undefined),\n onMaskClick: () => resolve(undefined),\n onEsc: () => resolve(undefined),\n })\n })\n }\n\n /**\n * 执行一个动作。resolve(true) 仅当接口成功或已跳转;取消、失败都是 false。\n * url 以 /api/ 开头按 method 请求;其它站内路径 router.push(method 忽略)。\n */\n async function run(a: NoticeAction): Promise<boolean> {\n const kind = classifyNoticeAction(a)\n if (kind === 'invalid') {\n message.error(t('notice.actionInvalidUrl'))\n return false\n }\n if (kind === 'route') {\n await router.push(a.url)\n return true\n }\n let comment: string | undefined\n if (a.comment) {\n comment = await askComment(a)\n if (comment === undefined) return false\n } else if (a.confirm && !(await confirm(a))) {\n return false\n }\n try {\n await callApi(a.method, a.url, comment === undefined ? undefined : { comment })\n message.success(t('notice.actionDone'))\n return true\n } catch (e) {\n message.error(translateError(e))\n return false\n }\n }\n\n return { run, label, buttonType }\n}\n"],"names":["noticeActionButtonType","a","useNoticeAction","t","te","useI18n","dialog","useDialog","message","useMessage","router","useRouter","label","noticeActionLabel","buttonType","confirm","resolve","askComment","text","ref","h","NInput","v","run","kind","classifyNoticeAction","comment","callApi","e","translateError"],"mappings":";;;;;;;AAYO,SAASA,EAAuBC,GAAkD;AACvF,SAAOA,EAAE,UAAU,aAAaA,EAAE,UAAU,UAAUA,EAAE,QAAQ;AAClE;AAEO,SAASC,IAAkB;AAChC,QAAM,EAAE,GAAAC,GAAG,IAAAC,EAAA,IAAOC,EAAA,GACZC,IAASC,EAAA,GACTC,IAAUC,EAAA,GACVC,IAASC,EAAA,GAETC,IAAQ,CAACX,MAAoBY,EAAkBZ,EAAE,OAAOE,GAAGC,CAAE,GAC7DU,IAAad;AAGnB,WAASe,EAAQd,GAAmC;AAClD,WAAO,IAAI,QAAQ,CAAAe,MAAW;AAC5B,MAAAV,EAAO,OAAO;AAAA,QACZ,MAAML,EAAE,UAAU,UAAU,UAAU;AAAA,QACtC,OAAOE,EAAE,qBAAqB;AAAA,QAC9B,SAASA,EAAE,wBAAwB,EAAE,OAAOS,EAAMX,CAAC,GAAG;AAAA,QACtD,cAAcE,EAAE,gBAAgB;AAAA,QAChC,cAAcA,EAAE,eAAe;AAAA,QAC/B,iBAAiB,MAAMa,EAAQ,EAAI;AAAA,QACnC,iBAAiB,MAAMA,EAAQ,EAAK;AAAA,QACpC,SAAS,MAAMA,EAAQ,EAAK;AAAA,QAC5B,aAAa,MAAMA,EAAQ,EAAK;AAAA,QAChC,OAAO,MAAMA,EAAQ,EAAK;AAAA,MAAA,CAC3B;AAAA,IACH,CAAC;AAAA,EACH;AAGA,WAASC,EAAWhB,GAA8C;AAChE,UAAMiB,IAAOC,EAAI,EAAE;AACnB,WAAO,IAAI,QAAQ,CAAAH,MAAW;AAC5B,MAAAV,EAAO,OAAO;AAAA,QACZ,MAAM;AAAA,QACN,OAAOM,EAAMX,CAAC;AAAA,QACd,SAAS,MACPmB,EAAEC,GAAQ;AAAA,UACR,MAAM;AAAA,UACN,OAAOH,EAAK;AAAA,UACZ,aAAaf,EAAE,iCAAiC;AAAA,UAChD,UAAU,EAAE,SAAS,GAAG,SAAS,EAAA;AAAA,UACjC,WAAW;AAAA,UACX,WAAW;AAAA,UACX,eAAe,CAACmB,MAAc;AAC5B,YAAAJ,EAAK,QAAQI;AAAA,UACf;AAAA,QAAA,CACD;AAAA,QACH,cAAcnB,EAAE,gBAAgB;AAAA,QAChC,cAAcA,EAAE,eAAe;AAAA,QAC/B,iBAAiB,MAAMa,EAAQE,EAAK,MAAM,MAAM;AAAA,QAChD,iBAAiB,MAAMF,EAAQ,MAAS;AAAA,QACxC,SAAS,MAAMA,EAAQ,MAAS;AAAA,QAChC,aAAa,MAAMA,EAAQ,MAAS;AAAA,QACpC,OAAO,MAAMA,EAAQ,MAAS;AAAA,MAAA,CAC/B;AAAA,IACH,CAAC;AAAA,EACH;AAMA,iBAAeO,EAAItB,GAAmC;AACpD,UAAMuB,IAAOC,EAAqBxB,CAAC;AACnC,QAAIuB,MAAS;AACX,aAAAhB,EAAQ,MAAML,EAAE,yBAAyB,CAAC,GACnC;AAET,QAAIqB,MAAS;AACX,mBAAMd,EAAO,KAAKT,EAAE,GAAG,GAChB;AAET,QAAIyB;AACJ,QAAIzB,EAAE;AAEJ,UADAyB,IAAU,MAAMT,EAAWhB,CAAC,GACxByB,MAAY,OAAW,QAAO;AAAA,eACzBzB,EAAE,WAAW,CAAE,MAAMc,EAAQd,CAAC;AACvC,aAAO;AAET,QAAI;AACF,mBAAM0B,EAAQ1B,EAAE,QAAQA,EAAE,KAAKyB,MAAY,SAAY,SAAY,EAAE,SAAAA,EAAA,CAAS,GAC9ElB,EAAQ,QAAQL,EAAE,mBAAmB,CAAC,GAC/B;AAAA,IACT,SAASyB,GAAG;AACV,aAAApB,EAAQ,MAAMqB,EAAeD,CAAC,CAAC,GACxB;AAAA,IACT;AAAA,EACF;AAEA,SAAO,EAAE,KAAAL,GAAK,OAAAX,GAAO,YAAAE,EAAA;AACvB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function usePageTitle(): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { watchEffect as n } from "vue";
|
|
2
|
+
import { useRoute as c } from "vue-router";
|
|
3
|
+
import { useAppStore as l } from "../stores/app.js";
|
|
4
|
+
import { useTabsStore as p } from "../stores/tabs.js";
|
|
5
|
+
import { useSite as u } from "./useSite.js";
|
|
6
|
+
import { translateMenuTitle as f } from "../locales/menuTitle.js";
|
|
7
|
+
function w() {
|
|
8
|
+
const e = c(), o = l(), s = p(), { site: i } = u();
|
|
9
|
+
n(() => {
|
|
10
|
+
o.locale;
|
|
11
|
+
const t = s.tabs.find((a) => a.path === e.path), r = (t == null ? void 0 : t.titleFixed) && t.title || e.meta.title || "", m = r ? f(r, e.path) : "";
|
|
12
|
+
document.title = m ? `${m} · ${i.title}` : i.title;
|
|
13
|
+
}), n(() => {
|
|
14
|
+
document.documentElement.lang = o.locale;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
w as usePageTitle
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=usePageTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePageTitle.js","sources":["../../src/composables/usePageTitle.ts"],"sourcesContent":["// 浏览器标题与文档语言。App.vue 调一次即可。\n//\n// 不这样动态维护的话,document.title 只会在启动时被站点名设一次,收藏夹/多窗口/历史记录里所有页面会长得一模一样;\n// <html lang> 也会硬编成 zh-CN,读屏器与浏览器翻译在英文界面下判错语言。\nimport { watchEffect } from 'vue'\nimport { useRoute } from 'vue-router'\nimport { useAppStore } from '#/stores/app'\nimport { useTabsStore } from '#/stores/tabs'\nimport { useSite } from '#/composables/useSite'\nimport { translateMenuTitle } from '#/locales/menuTitle'\n\nexport function usePageTitle(): void {\n const route = useRoute()\n const app = useAppStore()\n const tabs = useTabsStore()\n const { site } = useSite()\n\n watchEffect(() => {\n void app.locale // 依赖:切语言后 i18n key 标题要重算\n // 详情页用 useTabTitle 设过动态标题(记录名)时以它为准 —— 静态 meta.title 是「详情」这种通名。\n const tab = tabs.tabs.find(x => x.path === route.path)\n const raw = (tab?.titleFixed && tab.title) || (route.meta.title as string | undefined) || ''\n const page = raw ? translateMenuTitle(raw, route.path) : ''\n document.title = page ? `${page} · ${site.title}` : site.title\n })\n\n watchEffect(() => {\n document.documentElement.lang = app.locale\n })\n}\n"],"names":["usePageTitle","route","useRoute","app","useAppStore","tabs","useTabsStore","site","useSite","watchEffect","tab","x","raw","page","translateMenuTitle"],"mappings":";;;;;;AAWO,SAASA,IAAqB;AACnC,QAAMC,IAAQC,EAAA,GACRC,IAAMC,EAAA,GACNC,IAAOC,EAAA,GACP,EAAE,MAAAC,EAAA,IAASC,EAAA;AAEjB,EAAAC,EAAY,MAAM;AAChB,IAAKN,EAAI;AAET,UAAMO,IAAML,EAAK,KAAK,KAAK,OAAKM,EAAE,SAASV,EAAM,IAAI,GAC/CW,KAAOF,KAAA,gBAAAA,EAAK,eAAcA,EAAI,SAAWT,EAAM,KAAK,SAAgC,IACpFY,IAAOD,IAAME,EAAmBF,GAAKX,EAAM,IAAI,IAAI;AACzD,aAAS,QAAQY,IAAO,GAAGA,CAAI,MAAMN,EAAK,KAAK,KAAKA,EAAK;AAAA,EAC3D,CAAC,GAEDE,EAAY,MAAM;AAChB,aAAS,gBAAgB,OAAON,EAAI;AAAA,EACtC,CAAC;AACH;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 未读通知刷新总线:useRealtime 收到后端 `notice-changed` 推送后 emit,NoticeBell 订阅后立即重拉未读角标。
|
|
3
|
+
* 解耦长连接与铃铛组件(二者互不 import 对方)。
|
|
4
|
+
*/
|
|
5
|
+
export declare const noticeBus: import('@vueuse/core').UseEventBusReturn<void, any>;
|
|
6
|
+
/** 额外 hub 事件的处理器签名:后端 NotifyUserAsync / BroadcastAsync 恒发单个 data 载荷。 */
|
|
7
|
+
export type RealtimeHandler = (data: unknown) => void;
|
|
8
|
+
/**
|
|
9
|
+
* 在内置这条 SignalR 连接上登记自己的 hub 事件,返回退订函数。
|
|
10
|
+
* <p>建连之前登记的于 start() 时统一绑定,之后登记的直接挂到现有连接;连接重建(登出后再登录)会自动重绑。
|
|
11
|
+
* 组件里用记得在 onScopeDispose / onUnmounted 调返回值退订,否则热更新与路由切换会越挂越多。</p>
|
|
12
|
+
*/
|
|
13
|
+
export declare function onRealtime(event: string, handler: RealtimeHandler): () => void;
|
|
14
|
+
declare function stopConnection(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* 主动登出前调用:标记自愿退出 + 先断 SignalR。
|
|
17
|
+
* <p>后端会话吊销会推 `force-logout`(与管理员强退共用通道);本页断连后收不到,即便迟到推送也不弹强制下线文案。
|
|
18
|
+
* 其它标签页仍可被踢并提示。</p>
|
|
19
|
+
*/
|
|
20
|
+
export declare function beginVoluntaryLogout(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* 实时通知客户端(SignalR)。仅在鉴权外壳挂载时 start、登出/卸载时 stop。
|
|
23
|
+
* <p>后端 `SmartAdmin:Realtime:Enabled` 关闭时 Hub 不存在 → 初次连接失败,**静默退回** NoticeBell 的 30s 轮询兜底
|
|
24
|
+
* 与「下次请求 401」惰性登出(纯增强,无回归)。令牌走 query `access_token`(浏览器 WebSocket 带不了 Authorization 头)。</p>
|
|
25
|
+
* message/router/i18n 在 setup 期(default.vue)绑定,推送到达时复用,故务必在 setup 中调用本 composable。
|
|
26
|
+
*/
|
|
27
|
+
export declare function useRealtime(): {
|
|
28
|
+
start: () => void;
|
|
29
|
+
stop: typeof stopConnection;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useRouter as d } from "vue-router";
|
|
2
|
+
import { useMessage as p } from "naive-ui";
|
|
3
|
+
import { useI18n as h } from "vue-i18n";
|
|
4
|
+
import { useEventBus as w } from "@vueuse/core";
|
|
5
|
+
import { HubConnectionBuilder as y, LogLevel as b } from "@microsoft/signalr";
|
|
6
|
+
import { useUserStore as l } from "../stores/user.js";
|
|
7
|
+
import { runtime as L } from "../lib/runtime.js";
|
|
8
|
+
const R = w("notice-changed");
|
|
9
|
+
let n = null, c = !1;
|
|
10
|
+
const i = /* @__PURE__ */ new Map();
|
|
11
|
+
let f = /* @__PURE__ */ new Set();
|
|
12
|
+
function g(t, o) {
|
|
13
|
+
f.has(o) || (f.add(o), t.on(o, (e) => {
|
|
14
|
+
for (const s of i.get(o) ?? []) s(e);
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
function C(t, o) {
|
|
18
|
+
const e = i.get(t) ?? /* @__PURE__ */ new Set();
|
|
19
|
+
return e.add(o), i.set(t, e), n && g(n, t), () => {
|
|
20
|
+
e.delete(o), e.size === 0 && i.get(t) === e && i.delete(t);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async function m() {
|
|
24
|
+
const t = n;
|
|
25
|
+
if (n = null, t)
|
|
26
|
+
try {
|
|
27
|
+
await t.stop();
|
|
28
|
+
} catch {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function H() {
|
|
32
|
+
c = !0, await m();
|
|
33
|
+
}
|
|
34
|
+
function M() {
|
|
35
|
+
const t = d(), o = p(), { t: e } = h();
|
|
36
|
+
function s() {
|
|
37
|
+
if (n || !l().accessToken) return;
|
|
38
|
+
c = !1;
|
|
39
|
+
const r = new y().withUrl(`${L.apiBase}/hub/realtime`, {
|
|
40
|
+
accessTokenFactory: () => l().accessToken
|
|
41
|
+
}).withAutomaticReconnect().configureLogging(b.Warning).build();
|
|
42
|
+
r.on("force-logout", () => {
|
|
43
|
+
const a = c;
|
|
44
|
+
c = !1, m(), l().clear(), import("../stores/auth.js").then(({ useAuthStore: u }) => u().reset()), import("../router/index.js").then(({ resetRouter: u }) => u()), a || o.warning(e("realtime.forcedLogout")), t.currentRoute.value.path !== "/login" && t.replace("/login");
|
|
45
|
+
}), r.on("notice-changed", () => R.emit()), f = /* @__PURE__ */ new Set();
|
|
46
|
+
for (const a of i.keys()) g(r, a);
|
|
47
|
+
n = r, r.start().catch(() => {
|
|
48
|
+
n === r && (n = null);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return { start: s, stop: m };
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
H as beginVoluntaryLogout,
|
|
55
|
+
R as noticeBus,
|
|
56
|
+
C as onRealtime,
|
|
57
|
+
M as useRealtime
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=useRealtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRealtime.js","sources":["../../src/composables/useRealtime.ts"],"sourcesContent":["import { useRouter } from 'vue-router'\nimport { useMessage } from 'naive-ui'\nimport { useI18n } from 'vue-i18n'\nimport { useEventBus } from '@vueuse/core'\nimport { HubConnectionBuilder, LogLevel, type HubConnection } from '@microsoft/signalr'\nimport { useUserStore } from '#/stores/user'\nimport { runtime } from '#/lib/runtime'\n\n/**\n * 未读通知刷新总线:useRealtime 收到后端 `notice-changed` 推送后 emit,NoticeBell 订阅后立即重拉未读角标。\n * 解耦长连接与铃铛组件(二者互不 import 对方)。\n */\nexport const noticeBus = useEventBus<void>('notice-changed')\n\n// 进程内单例连接:鉴权外壳(default.vue)挂载一次即建一条;重复 start 幂等(已连不再建)。\nlet connection: HubConnection | null = null\n// 主动登出/改密重登:后端 Logout 也走 RevokeAsync → 推 force-logout;本页应静默,勿弹「您已被强制下线」。\n// 其它同会话标签页仍会收到推送并提示(它们没调 beginVoluntaryLogout)。下次 start 清零。\nlet voluntaryLogout = false\n\n/** 额外 hub 事件的处理器签名:后端 NotifyUserAsync / BroadcastAsync 恒发单个 data 载荷。 */\nexport type RealtimeHandler = (data: unknown) => void\n\n// 扩展模块登记的 hub 事件。必须能挂到内置这条连接上:另建一条连向同一个 /hub/realtime 的连接,\n// 意味着一个在线用户两条 WebSocket,而后端是按 userId 群发到该用户的全部连接 ——\n// notice-changed / force-logout 这类内置事件会被投递两遍。\nconst extraHandlers = new Map<string, Set<RealtimeHandler>>()\n// 当前连接上已 conn.on 过的事件名:每建一条新连接清空,保证既不重复绑定也不漏绑。\nlet boundEvents = new Set<string>()\n\nfunction bindExtra(conn: HubConnection, event: string): void {\n if (boundEvents.has(event)) return\n boundEvents.add(event)\n // 一个事件只挂一个派发器,退订只从 Set 里摘处理器,不调 conn.off(event) ——\n // 那会把同事件上其它模块的处理器一起摘掉。\n conn.on(event, (data: unknown) => {\n for (const handler of extraHandlers.get(event) ?? []) handler(data)\n })\n}\n\n/**\n * 在内置这条 SignalR 连接上登记自己的 hub 事件,返回退订函数。\n * <p>建连之前登记的于 start() 时统一绑定,之后登记的直接挂到现有连接;连接重建(登出后再登录)会自动重绑。\n * 组件里用记得在 onScopeDispose / onUnmounted 调返回值退订,否则热更新与路由切换会越挂越多。</p>\n */\nexport function onRealtime(event: string, handler: RealtimeHandler): () => void {\n const handlers = extraHandlers.get(event) ?? new Set<RealtimeHandler>()\n handlers.add(handler)\n extraHandlers.set(event, handlers)\n if (connection) bindExtra(connection, event)\n return () => {\n handlers.delete(handler)\n // 认一下手里这个 Set 还是不是表里那个:退订被调两次时,中间可能已有人重新登记同名事件,\n // 照删会把后来者的处理器一起摘掉,而且是静默的。\n if (handlers.size === 0 && extraHandlers.get(event) === handlers) extraHandlers.delete(event)\n }\n}\n\nasync function stopConnection(): Promise<void> {\n const c = connection\n connection = null\n if (c) {\n try {\n await c.stop()\n } catch {\n /* 停止失败无害 */\n }\n }\n}\n\n/**\n * 主动登出前调用:标记自愿退出 + 先断 SignalR。\n * <p>后端会话吊销会推 `force-logout`(与管理员强退共用通道);本页断连后收不到,即便迟到推送也不弹强制下线文案。\n * 其它标签页仍可被踢并提示。</p>\n */\nexport async function beginVoluntaryLogout(): Promise<void> {\n voluntaryLogout = true\n await stopConnection()\n}\n\n/**\n * 实时通知客户端(SignalR)。仅在鉴权外壳挂载时 start、登出/卸载时 stop。\n * <p>后端 `SmartAdmin:Realtime:Enabled` 关闭时 Hub 不存在 → 初次连接失败,**静默退回** NoticeBell 的 30s 轮询兜底\n * 与「下次请求 401」惰性登出(纯增强,无回归)。令牌走 query `access_token`(浏览器 WebSocket 带不了 Authorization 头)。</p>\n * message/router/i18n 在 setup 期(default.vue)绑定,推送到达时复用,故务必在 setup 中调用本 composable。\n */\nexport function useRealtime() {\n const router = useRouter()\n const message = useMessage()\n const { t } = useI18n()\n\n function start() {\n if (connection || !useUserStore().accessToken) return\n voluntaryLogout = false\n const conn = new HubConnectionBuilder()\n .withUrl(`${runtime.apiBase}/hub/realtime`, {\n accessTokenFactory: () => useUserStore().accessToken,\n })\n .withAutomaticReconnect()\n .configureLogging(LogLevel.Warning)\n .build()\n\n // 强制下线:清会话 + 授权态 + 提示 + 跳登录(与 api/client.ts 刷新失败路径同款收尾)\n conn.on('force-logout', () => {\n const silent = voluntaryLogout\n voluntaryLogout = false\n void stopConnection()\n useUserStore().clear()\n void import('#/stores/auth').then(({ useAuthStore }) => useAuthStore().reset())\n void import('#/router').then(({ resetRouter }) => resetRouter())\n // 主动登出也会触发后端 force-logout 推送:只静默清会话,不谎报「被强制下线」。\n if (!silent) message.warning(t('realtime.forcedLogout'))\n if (router.currentRoute.value.path !== '/login') router.replace('/login')\n })\n // 公告变更:通知 NoticeBell 立即重拉未读(替代最长 30s 轮询延迟)\n conn.on('notice-changed', () => noticeBus.emit())\n // 扩展模块的事件:新连接从零绑一遍\n boundEvents = new Set()\n for (const event of extraHandlers.keys()) bindExtra(conn, event)\n\n connection = conn\n conn.start().catch(() => {\n // 初次连接失败(后端未开启实时 → Hub 404):静默退回轮询兜底,不重试刷屏。\n // withAutomaticReconnect 只在「连过又断」后重连,不重试初次 start,故这里不会造成对已关实时的后端反复叩门。\n if (connection === conn) connection = null\n })\n }\n\n return { start, stop: stopConnection }\n}\n"],"names":["noticeBus","useEventBus","connection","voluntaryLogout","extraHandlers","boundEvents","bindExtra","conn","event","data","handler","onRealtime","handlers","stopConnection","c","beginVoluntaryLogout","useRealtime","router","useRouter","message","useMessage","t","useI18n","start","useUserStore","HubConnectionBuilder","runtime","LogLevel","silent","useAuthStore","resetRouter"],"mappings":";;;;;;;AAYO,MAAMA,IAAYC,EAAkB,gBAAgB;AAG3D,IAAIC,IAAmC,MAGnCC,IAAkB;AAQtB,MAAMC,wBAAoB,IAAA;AAE1B,IAAIC,wBAAkB,IAAA;AAEtB,SAASC,EAAUC,GAAqBC,GAAqB;AAC3D,EAAIH,EAAY,IAAIG,CAAK,MACzBH,EAAY,IAAIG,CAAK,GAGrBD,EAAK,GAAGC,GAAO,CAACC,MAAkB;AAChC,eAAWC,KAAWN,EAAc,IAAII,CAAK,KAAK,CAAA,KAAYC,CAAI;AAAA,EACpE,CAAC;AACH;AAOO,SAASE,EAAWH,GAAeE,GAAsC;AAC9E,QAAME,IAAWR,EAAc,IAAII,CAAK,yBAAS,IAAA;AACjD,SAAAI,EAAS,IAAIF,CAAO,GACpBN,EAAc,IAAII,GAAOI,CAAQ,GAC7BV,KAAYI,EAAUJ,GAAYM,CAAK,GACpC,MAAM;AACX,IAAAI,EAAS,OAAOF,CAAO,GAGnBE,EAAS,SAAS,KAAKR,EAAc,IAAII,CAAK,MAAMI,KAAUR,EAAc,OAAOI,CAAK;AAAA,EAC9F;AACF;AAEA,eAAeK,IAAgC;AAC7C,QAAMC,IAAIZ;AAEV,MADAA,IAAa,MACTY;AACF,QAAI;AACF,YAAMA,EAAE,KAAA;AAAA,IACV,QAAQ;AAAA,IAER;AAEJ;AAOA,eAAsBC,IAAsC;AAC1D,EAAAZ,IAAkB,IAClB,MAAMU,EAAA;AACR;AAQO,SAASG,IAAc;AAC5B,QAAMC,IAASC,EAAA,GACTC,IAAUC,EAAA,GACV,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,WAASC,IAAQ;AACf,QAAIrB,KAAc,CAACsB,EAAA,EAAe,YAAa;AAC/C,IAAArB,IAAkB;AAClB,UAAMI,IAAO,IAAIkB,IACd,QAAQ,GAAGC,EAAQ,OAAO,iBAAiB;AAAA,MAC1C,oBAAoB,MAAMF,IAAe;AAAA,IAAA,CAC1C,EACA,uBAAA,EACA,iBAAiBG,EAAS,OAAO,EACjC,MAAA;AAGH,IAAApB,EAAK,GAAG,gBAAgB,MAAM;AAC5B,YAAMqB,IAASzB;AACf,MAAAA,IAAkB,IACbU,EAAA,GACLW,EAAA,EAAe,MAAA,GACV,OAAO,mBAAe,EAAE,KAAK,CAAC,EAAE,cAAAK,QAAmBA,IAAe,OAAO,GACzE,OAAO,oBAAU,EAAE,KAAK,CAAC,EAAE,aAAAC,EAAA,MAAkBA,GAAa,GAE1DF,KAAQT,EAAQ,QAAQE,EAAE,uBAAuB,CAAC,GACnDJ,EAAO,aAAa,MAAM,SAAS,YAAUA,EAAO,QAAQ,QAAQ;AAAA,IAC1E,CAAC,GAEDV,EAAK,GAAG,kBAAkB,MAAMP,EAAU,MAAM,GAEhDK,wBAAkB,IAAA;AAClB,eAAWG,KAASJ,EAAc,KAAA,EAAQ,CAAAE,EAAUC,GAAMC,CAAK;AAE/D,IAAAN,IAAaK,GACbA,EAAK,QAAQ,MAAM,MAAM;AAGvB,MAAIL,MAAeK,MAAML,IAAa;AAAA,IACxC,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,OAAAqB,GAAO,MAAMV,EAAA;AACxB;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface SiteInfo {
|
|
2
|
+
title: string;
|
|
3
|
+
subtitle: string;
|
|
4
|
+
copyright: string;
|
|
5
|
+
copyrightUrl: string;
|
|
6
|
+
logo: string;
|
|
7
|
+
captchaEnabled: boolean;
|
|
8
|
+
smsLoginEnabled: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function loadSite(force?: boolean): Promise<void>;
|
|
11
|
+
/** 版本号不走后端配置:默认是内核版本(库构建期常量),消费方经 createSmartAdmin({ version }) 换成应用版本。 */
|
|
12
|
+
export declare function useSite(): {
|
|
13
|
+
site: {
|
|
14
|
+
title: string;
|
|
15
|
+
subtitle: string;
|
|
16
|
+
copyright: string;
|
|
17
|
+
copyrightUrl: string;
|
|
18
|
+
logo: string;
|
|
19
|
+
captchaEnabled: boolean;
|
|
20
|
+
smsLoginEnabled: boolean;
|
|
21
|
+
};
|
|
22
|
+
appVersion: string;
|
|
23
|
+
loadSite: typeof loadSite;
|
|
24
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { reactive as l } from "vue";
|
|
2
|
+
import { configApi as r } from "../api/index.js";
|
|
3
|
+
import { runtime as n } from "../lib/runtime.js";
|
|
4
|
+
const i = l({
|
|
5
|
+
title: "SmartAdmin",
|
|
6
|
+
subtitle: "",
|
|
7
|
+
copyright: "",
|
|
8
|
+
copyrightUrl: "",
|
|
9
|
+
logo: "",
|
|
10
|
+
captchaEnabled: !1,
|
|
11
|
+
smsLoginEnabled: !1
|
|
12
|
+
});
|
|
13
|
+
let e = null;
|
|
14
|
+
function a(o = !1) {
|
|
15
|
+
return e && !o || (e = r.siteInfo().then((t) => {
|
|
16
|
+
t.title && (i.title = t.title), i.subtitle = t.subtitle ?? "", i.copyright = t.copyright ?? "", i.copyrightUrl = t.copyrightUrl ?? "", i.logo = t.logo ?? "", i.captchaEnabled = !!t.captchaEnabled, i.smsLoginEnabled = !!t.smsLoginEnabled;
|
|
17
|
+
}).catch(() => {
|
|
18
|
+
})), e;
|
|
19
|
+
}
|
|
20
|
+
function f() {
|
|
21
|
+
return { site: i, appVersion: n.version, loadSite: a };
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
a as loadSite,
|
|
25
|
+
f as useSite
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=useSite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSite.js","sources":["../../src/composables/useSite.ts"],"sourcesContent":["import { reactive } from 'vue'\nimport { configApi } from '#/api'\nimport { runtime } from '#/lib/runtime'\n\n// 站点品牌信息(匿名 GET /sys/config/site 下发)。App.vue 启动、登录页各皮肤、登录后框架(侧栏/顶栏/水印)\n// 共用同一份响应式数据,只拉一次(模块级缓存);改配置保存后 loadSite(true) 强制重取即时生效。\nexport interface SiteInfo {\n title: string\n subtitle: string\n copyright: string\n copyrightUrl: string\n logo: string\n captchaEnabled: boolean\n smsLoginEnabled: boolean\n}\n\n// title 初值给内置名,防 siteInfo 到达前品牌词首帧空白;createSmartAdmin({ brand.title }) 会在挂载前改写它。\nconst site = reactive<SiteInfo>({\n title: 'SmartAdmin',\n subtitle: '',\n copyright: '',\n copyrightUrl: '',\n logo: '',\n captchaEnabled: false,\n smsLoginEnabled: false,\n})\n\nlet inflight: Promise<void> | null = null\n\nexport function loadSite(force = false): Promise<void> {\n if (inflight && !force) return inflight\n inflight = configApi\n .siteInfo()\n .then(s => {\n if (s.title) site.title = s.title\n site.subtitle = s.subtitle ?? ''\n site.copyright = s.copyright ?? ''\n site.copyrightUrl = s.copyrightUrl ?? ''\n site.logo = s.logo ?? ''\n site.captchaEnabled = !!s.captchaEnabled\n site.smsLoginEnabled = !!s.smsLoginEnabled\n })\n .catch(() => {\n // 拉取失败保留内置默认(title=SmartAdmin),不阻塞登录/渲染\n })\n return inflight\n}\n\n/** 版本号不走后端配置:默认是内核版本(库构建期常量),消费方经 createSmartAdmin({ version }) 换成应用版本。 */\nexport function useSite() {\n return { site, appVersion: runtime.version, loadSite }\n}\n"],"names":["site","reactive","inflight","loadSite","force","configApi","s","useSite","runtime"],"mappings":";;;AAiBA,MAAMA,IAAOC,EAAmB;AAAA,EAC9B,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,iBAAiB;AACnB,CAAC;AAED,IAAIC,IAAiC;AAE9B,SAASC,EAASC,IAAQ,IAAsB;AACrD,SAAIF,KAAY,CAACE,MACjBF,IAAWG,EACR,SAAA,EACA,KAAK,CAAAC,MAAK;AACT,IAAIA,EAAE,UAAON,EAAK,QAAQM,EAAE,QAC5BN,EAAK,WAAWM,EAAE,YAAY,IAC9BN,EAAK,YAAYM,EAAE,aAAa,IAChCN,EAAK,eAAeM,EAAE,gBAAgB,IACtCN,EAAK,OAAOM,EAAE,QAAQ,IACtBN,EAAK,iBAAiB,CAAC,CAACM,EAAE,gBAC1BN,EAAK,kBAAkB,CAAC,CAACM,EAAE;AAAA,EAC7B,CAAC,EACA,MAAM,MAAM;AAAA,EAEb,CAAC,IACIJ;AACT;AAGO,SAASK,IAAU;AACxB,SAAO,EAAE,MAAAP,GAAM,YAAYQ,EAAQ,SAAS,UAAAL,EAAA;AAC9C;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useTabTitle(): (title: string) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRoute as r } from "vue-router";
|
|
2
|
+
import { useTabsStore as s } from "../stores/tabs.js";
|
|
3
|
+
function n() {
|
|
4
|
+
const t = r(), e = s();
|
|
5
|
+
return (o) => e.setTitle(t.path, o);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
n as useTabTitle
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useTabTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTabTitle.js","sources":["../../src/composables/useTabTitle.ts"],"sourcesContent":["import { useRoute } from 'vue-router'\nimport { useTabsStore } from '#/stores/tabs'\n\n// 详情页动态标签标题:数据加载后调用返回的 setter,把当前标签标题改成记录名(如「张三」「工单 #123」)。\n// 内部走 tabsStore.setTitle → 置 titleFixed,addTab 复访不再用静态 meta.title 覆盖它;标题随 tab 持久化,F5 无闪复原。\n// 就地态(列表页内切换详情)不要调用它:那时 route.path 是列表标签,改名会改错标签。\nexport function useTabTitle() {\n const route = useRoute()\n const tabs = useTabsStore()\n return (title: string) => tabs.setTitle(route.path, title)\n}\n"],"names":["useTabTitle","route","useRoute","tabs","useTabsStore","title"],"mappings":";;AAMO,SAASA,IAAc;AAC5B,QAAMC,IAAQC,EAAA,GACRC,IAAOC,EAAA;AACb,SAAO,CAACC,MAAkBF,EAAK,SAASF,EAAM,MAAMI,CAAK;AAC3D;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export interface TableRowSortOptions<T> {
|
|
3
|
+
/**
|
|
4
|
+
* 表格所在的容器元素,从中找 tbody;拖拽期间它会被打上 .is-dragging。
|
|
5
|
+
* 该元素要套全局类 <code>.row-sort</code>(styles/table.css)才有配套外观。
|
|
6
|
+
*/
|
|
7
|
+
container: Ref<HTMLElement | null>;
|
|
8
|
+
/** 被排序的数组,原地重排(reactive 数组直接传函数返回值即可) */
|
|
9
|
+
rows: () => T[];
|
|
10
|
+
/** 为真时不可拖(只读态、详情态) */
|
|
11
|
+
disabled: () => boolean;
|
|
12
|
+
/** 重排完成:落位的行 + 原始/目标下标 */
|
|
13
|
+
onSorted?: (row: T, from: number, to: number) => void;
|
|
14
|
+
}
|
|
15
|
+
/** 拖拽手柄的类名,列渲染和样式两边都按它对齐 */
|
|
16
|
+
export declare const DRAG_HANDLE_CLASS = "drag-handle";
|
|
17
|
+
export declare function useTableRowSort<T>(options: TableRowSortOptions<T>): {
|
|
18
|
+
sync: (attempt?: number) => Promise<void>;
|
|
19
|
+
destroy: () => void;
|
|
20
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { onBeforeUnmount as w, nextTick as y } from "vue";
|
|
2
|
+
const S = "drag-handle", h = 10, k = 80;
|
|
3
|
+
function L(e) {
|
|
4
|
+
let r = null, c = null, s;
|
|
5
|
+
function l() {
|
|
6
|
+
clearTimeout(s), r == null || r.destroy(), r = null, c = null;
|
|
7
|
+
}
|
|
8
|
+
async function i(d = 0) {
|
|
9
|
+
var f;
|
|
10
|
+
if (e.disabled()) {
|
|
11
|
+
l();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
await y();
|
|
15
|
+
const t = (f = e.container.value) == null ? void 0 : f.querySelector(".n-data-table-tbody");
|
|
16
|
+
if (!t) {
|
|
17
|
+
l(), d < h && (s = setTimeout(() => void i(d + 1), k));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (t === c) return;
|
|
21
|
+
clearTimeout(s), l();
|
|
22
|
+
const { default: m } = await import("sortablejs");
|
|
23
|
+
r = m.create(t, {
|
|
24
|
+
handle: `.${S}`,
|
|
25
|
+
draggable: ".n-data-table-tr",
|
|
26
|
+
animation: 180,
|
|
27
|
+
easing: "cubic-bezier(0.22, 0.61, 0.36, 1)",
|
|
28
|
+
chosenClass: "row-chosen",
|
|
29
|
+
ghostClass: "row-ghost",
|
|
30
|
+
fallbackClass: "row-fallback",
|
|
31
|
+
// 自绘拖拽层(而不是浏览器的原生拖影),配合样式里的隐藏才能把拖拽锁在表内
|
|
32
|
+
forceFallback: !0,
|
|
33
|
+
// 手柄上的轻微抖动不该被当成拖拽,否则点一下就误触发
|
|
34
|
+
fallbackTolerance: 4,
|
|
35
|
+
scroll: !0,
|
|
36
|
+
forceAutoScrollFallback: !0,
|
|
37
|
+
scrollSensitivity: 64,
|
|
38
|
+
scrollSpeed: 12,
|
|
39
|
+
onStart: () => {
|
|
40
|
+
var a;
|
|
41
|
+
return (a = e.container.value) == null ? void 0 : a.classList.add("is-dragging");
|
|
42
|
+
},
|
|
43
|
+
onEnd: (a) => {
|
|
44
|
+
var g, T;
|
|
45
|
+
(g = e.container.value) == null || g.classList.remove("is-dragging");
|
|
46
|
+
const { oldIndex: n, newIndex: o } = a;
|
|
47
|
+
if (n == null || o == null || n === o) return;
|
|
48
|
+
const b = e.rows(), [u] = b.splice(n, 1);
|
|
49
|
+
u && (b.splice(o, 0, u), (T = e.onSorted) == null || T.call(e, u, n, o));
|
|
50
|
+
}
|
|
51
|
+
}), c = t;
|
|
52
|
+
}
|
|
53
|
+
return w(l), { sync: i, destroy: l };
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
S as DRAG_HANDLE_CLASS,
|
|
57
|
+
L as useTableRowSort
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=useTableRowSort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableRowSort.js","sources":["../../src/composables/useTableRowSort.ts"],"sourcesContent":["// n-data-table 的行拖拽排序:sortablejs 的挂载/重建/销毁与重排回调都收在这里。\n//\n// 为什么不用原生 HTML5 拖放(<tr draggable> + dragstart/drop):那个半透明拖影由浏览器绘制,\n// 能跟着鼠标飘到表格外、弹窗外甚至窗口外,CSS 一点都管不到。这里用 sortablejs 的\n// forceFallback + 隐藏浮层(样式里 .row-fallback { display: none }),拖拽全靠行本身移动来表达,\n// 视觉上永远出不了表体;让位动画与自动滚动交给 sortablejs。\nimport { nextTick, onBeforeUnmount, type Ref } from 'vue'\nimport type Sortable from 'sortablejs'\n\nexport interface TableRowSortOptions<T> {\n /**\n * 表格所在的容器元素,从中找 tbody;拖拽期间它会被打上 .is-dragging。\n * 该元素要套全局类 <code>.row-sort</code>(styles/table.css)才有配套外观。\n */\n container: Ref<HTMLElement | null>\n /** 被排序的数组,原地重排(reactive 数组直接传函数返回值即可) */\n rows: () => T[]\n /** 为真时不可拖(只读态、详情态) */\n disabled: () => boolean\n /** 重排完成:落位的行 + 原始/目标下标 */\n onSorted?: (row: T, from: number, to: number) => void\n}\n\n/** 拖拽手柄的类名,列渲染和样式两边都按它对齐 */\nexport const DRAG_HANDLE_CLASS = 'drag-handle'\n\n/** tbody 还没渲染出来时的重试次数与间隔:弹窗有开场动画,首帧往往取不到表体 */\nconst RETRY_LIMIT = 10\nconst RETRY_DELAY = 80\n\nexport function useTableRowSort<T>(options: TableRowSortOptions<T>) {\n let sortable: Sortable | null = null\n let boundTbody: HTMLElement | null = null\n let retryTimer: ReturnType<typeof setTimeout> | undefined\n\n function destroy() {\n clearTimeout(retryTimer)\n sortable?.destroy()\n sortable = null\n boundTbody = null\n }\n\n /**\n * 重新绑定拖拽。表格换了一个 tbody(弹窗重开、只读态切换)才需要真的重建,\n * 行的增删不动 tbody 元素本身,重复调用是廉价的。\n */\n async function sync(attempt = 0) {\n if (options.disabled()) {\n destroy()\n return\n }\n await nextTick()\n const tbody = options.container.value?.querySelector<HTMLElement>('.n-data-table-tbody')\n if (!tbody) {\n destroy()\n // 弹窗开场动画期间表体还没挂上,过一会儿再试,别把拖拽丢了\n if (attempt < RETRY_LIMIT) {\n retryTimer = setTimeout(() => void sync(attempt + 1), RETRY_DELAY)\n }\n return\n }\n if (tbody === boundTbody) return\n clearTimeout(retryTimer)\n\n destroy()\n const { default: SortableCtor } = await import('sortablejs')\n sortable = SortableCtor.create(tbody, {\n handle: `.${DRAG_HANDLE_CLASS}`,\n draggable: '.n-data-table-tr',\n animation: 180,\n easing: 'cubic-bezier(0.22, 0.61, 0.36, 1)',\n chosenClass: 'row-chosen',\n ghostClass: 'row-ghost',\n fallbackClass: 'row-fallback',\n // 自绘拖拽层(而不是浏览器的原生拖影),配合样式里的隐藏才能把拖拽锁在表内\n forceFallback: true,\n // 手柄上的轻微抖动不该被当成拖拽,否则点一下就误触发\n fallbackTolerance: 4,\n scroll: true,\n forceAutoScrollFallback: true,\n scrollSensitivity: 64,\n scrollSpeed: 12,\n onStart: () => options.container.value?.classList.add('is-dragging'),\n onEnd: event => {\n options.container.value?.classList.remove('is-dragging')\n const { oldIndex: from, newIndex: to } = event\n if (from == null || to == null || from === to) return\n // sortablejs 已经把 DOM 挪好了,这里同步数据;表格带 row-key,Vue 按键重排不会串行\n const rows = options.rows()\n const [row] = rows.splice(from, 1)\n if (!row) return\n rows.splice(to, 0, row)\n options.onSorted?.(row, from, to)\n },\n })\n boundTbody = tbody\n }\n\n onBeforeUnmount(destroy)\n\n return { sync, destroy }\n}\n"],"names":["DRAG_HANDLE_CLASS","RETRY_LIMIT","RETRY_DELAY","useTableRowSort","options","sortable","boundTbody","retryTimer","destroy","sync","attempt","nextTick","tbody","_a","SortableCtor","event","from","to","rows","row","_b","onBeforeUnmount"],"mappings":";AAwBO,MAAMA,IAAoB,eAG3BC,IAAc,IACdC,IAAc;AAEb,SAASC,EAAmBC,GAAiC;AAClE,MAAIC,IAA4B,MAC5BC,IAAiC,MACjCC;AAEJ,WAASC,IAAU;AACjB,iBAAaD,CAAU,GACvBF,KAAA,QAAAA,EAAU,WACVA,IAAW,MACXC,IAAa;AAAA,EACf;AAMA,iBAAeG,EAAKC,IAAU,GAAG;;AAC/B,QAAIN,EAAQ,YAAY;AACtB,MAAAI,EAAA;AACA;AAAA,IACF;AACA,UAAMG,EAAA;AACN,UAAMC,KAAQC,IAAAT,EAAQ,UAAU,UAAlB,gBAAAS,EAAyB,cAA2B;AAClE,QAAI,CAACD,GAAO;AACV,MAAAJ,EAAA,GAEIE,IAAUT,MACZM,IAAa,WAAW,MAAM,KAAKE,EAAKC,IAAU,CAAC,GAAGR,CAAW;AAEnE;AAAA,IACF;AACA,QAAIU,MAAUN,EAAY;AAC1B,iBAAaC,CAAU,GAEvBC,EAAA;AACA,UAAM,EAAE,SAASM,MAAiB,MAAM,OAAO,YAAY;AAC3D,IAAAT,IAAWS,EAAa,OAAOF,GAAO;AAAA,MACpC,QAAQ,IAAIZ,CAAiB;AAAA,MAC7B,WAAW;AAAA,MACX,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,eAAe;AAAA;AAAA,MAEf,eAAe;AAAA;AAAA,MAEf,mBAAmB;AAAA,MACnB,QAAQ;AAAA,MACR,yBAAyB;AAAA,MACzB,mBAAmB;AAAA,MACnB,aAAa;AAAA,MACb,SAAS,MAAA;;AAAM,gBAAAa,IAAAT,EAAQ,UAAU,UAAlB,gBAAAS,EAAyB,UAAU,IAAI;AAAA;AAAA,MACtD,OAAO,CAAAE,MAAS;;AACd,SAAAF,IAAAT,EAAQ,UAAU,UAAlB,QAAAS,EAAyB,UAAU,OAAO;AAC1C,cAAM,EAAE,UAAUG,GAAM,UAAUC,MAAOF;AACzC,YAAIC,KAAQ,QAAQC,KAAM,QAAQD,MAASC,EAAI;AAE/C,cAAMC,IAAOd,EAAQ,KAAA,GACf,CAACe,CAAG,IAAID,EAAK,OAAOF,GAAM,CAAC;AACjC,QAAKG,MACLD,EAAK,OAAOD,GAAI,GAAGE,CAAG,IACtBC,IAAAhB,EAAQ,aAAR,QAAAgB,EAAA,KAAAhB,GAAmBe,GAAKH,GAAMC;AAAA,MAChC;AAAA,IAAA,CACD,GACDX,IAAaM;AAAA,EACf;AAEA,SAAAS,EAAgBb,CAAO,GAEhB,EAAE,MAAAC,GAAM,SAAAD,EAAA;AACjB;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ref as c, watch as r, onScopeDispose as s } from "vue";
|
|
2
|
+
let n = 0;
|
|
3
|
+
function u() {
|
|
4
|
+
n === 0 && (document.body.style.overflow = "hidden"), n++;
|
|
5
|
+
}
|
|
6
|
+
function f() {
|
|
7
|
+
n !== 0 && (n--, n === 0 && (document.body.style.overflow = ""));
|
|
8
|
+
}
|
|
9
|
+
function y() {
|
|
10
|
+
const o = c(!1);
|
|
11
|
+
let e = !1;
|
|
12
|
+
function d() {
|
|
13
|
+
o.value = !o.value;
|
|
14
|
+
}
|
|
15
|
+
function l() {
|
|
16
|
+
o.value = !1;
|
|
17
|
+
}
|
|
18
|
+
function i(t) {
|
|
19
|
+
t.key === "Escape" && l();
|
|
20
|
+
}
|
|
21
|
+
return r(o, (t) => {
|
|
22
|
+
t && !e ? (e = !0, u(), window.addEventListener("keydown", i)) : !t && e && (e = !1, f(), window.removeEventListener("keydown", i));
|
|
23
|
+
}), s(() => {
|
|
24
|
+
e && (e = !1, f()), window.removeEventListener("keydown", i);
|
|
25
|
+
}), { zoomed: o, toggle: d, exit: l };
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
y as useTableZoom
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=useTableZoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableZoom.js","sources":["../../src/composables/useTableZoom.ts"],"sourcesContent":["// 表格「放大」:把某块区域临时铺满视口,给笔记本等窄屏看宽表用。\n//\n// 刻意不用 Fullscreen API(VueUse 的 useFullscreen):Naive 的 NSelect / NPopover 把浮层 teleport 到\n// body,而原生全屏只渲染被全屏那棵子树,浮层会整个看不见 —— 带下拉、气泡的宽表必然踩中。\n// 固定定位遮罩没这个问题:浮层照旧挂在 body 上,z-index 比遮罩高就行(遮罩 50,Naive 浮层 2000+)。\n//\n// 用法:\n// const { zoomed, toggle } = useTableZoom()\n// <div :class=\"{ 'table-zoom': zoomed }\"> ...表格... </div>\n// <n-button @click=\"toggle\">放大/还原</n-button>\n// `.table-zoom` 的样式在 styles/table.css。\nimport { onScopeDispose, ref, watch } from 'vue'\n\n/**\n * body 滚动锁的引用计数。`document.body.style.overflow` 是全局单例,而一个页面上会有多个\n * useTableZoom 实例,各自无条件置/清会互相踩:先退出的那个会在另一个遮罩仍铺满时\n * 把背景滚动放开,正是这把锁要防的现象。\n *\n * 当前 UI 下同时只可能有一个放大态(遮罩不透明且铺满视口,挡住了其它放大按钮),\n * 所以这个计数眼下是防御性的 —— 但别让后来者依赖那个巧合:一旦出现并排/画中画放大就会踩中。\n */\nlet bodyLockCount = 0\nfunction lockBodyScroll() {\n if (bodyLockCount === 0) document.body.style.overflow = 'hidden'\n bodyLockCount++\n}\nfunction unlockBodyScroll() {\n if (bodyLockCount === 0) return\n bodyLockCount--\n if (bodyLockCount === 0) document.body.style.overflow = ''\n}\n\nexport function useTableZoom() {\n const zoomed = ref(false)\n /** 本实例是否持有 body 锁:避免重复加锁/重复解锁把计数带偏 */\n let holdsLock = false\n\n function toggle() {\n zoomed.value = !zoomed.value\n }\n function exit() {\n zoomed.value = false\n }\n\n function onKeydown(e: KeyboardEvent) {\n // 只在放大态拦 Esc;Naive 的下拉/气泡自己也吃 Esc,已经打开时先关浮层再关放大,交给冒泡顺序即可。\n if (e.key === 'Escape') exit()\n }\n\n // 放大时锁掉 body 滚动:遮罩是 fixed,底下的页面还能滚会让滚轮行为很怪。\n watch(zoomed, value => {\n if (value && !holdsLock) {\n holdsLock = true\n lockBodyScroll()\n window.addEventListener('keydown', onKeydown)\n } else if (!value && holdsLock) {\n holdsLock = false\n unlockBodyScroll()\n window.removeEventListener('keydown', onKeydown)\n }\n })\n\n // 组件卸载时(含放大态下直接切路由)务必还锁,否则整站 body 会一直锁着。\n onScopeDispose(() => {\n if (holdsLock) {\n holdsLock = false\n unlockBodyScroll()\n }\n window.removeEventListener('keydown', onKeydown)\n })\n\n return { zoomed, toggle, exit }\n}\n"],"names":["bodyLockCount","lockBodyScroll","unlockBodyScroll","useTableZoom","zoomed","ref","holdsLock","toggle","exit","onKeydown","e","watch","value","onScopeDispose"],"mappings":";AAqBA,IAAIA,IAAgB;AACpB,SAASC,IAAiB;AACxB,EAAID,MAAkB,MAAG,SAAS,KAAK,MAAM,WAAW,WACxDA;AACF;AACA,SAASE,IAAmB;AAC1B,EAAIF,MAAkB,MACtBA,KACIA,MAAkB,MAAG,SAAS,KAAK,MAAM,WAAW;AAC1D;AAEO,SAASG,IAAe;AAC7B,QAAMC,IAASC,EAAI,EAAK;AAExB,MAAIC,IAAY;AAEhB,WAASC,IAAS;AAChB,IAAAH,EAAO,QAAQ,CAACA,EAAO;AAAA,EACzB;AACA,WAASI,IAAO;AACd,IAAAJ,EAAO,QAAQ;AAAA,EACjB;AAEA,WAASK,EAAUC,GAAkB;AAEnC,IAAIA,EAAE,QAAQ,YAAUF,EAAA;AAAA,EAC1B;AAGA,SAAAG,EAAMP,GAAQ,CAAAQ,MAAS;AACrB,IAAIA,KAAS,CAACN,KACZA,IAAY,IACZL,EAAA,GACA,OAAO,iBAAiB,WAAWQ,CAAS,KACnC,CAACG,KAASN,MACnBA,IAAY,IACZJ,EAAA,GACA,OAAO,oBAAoB,WAAWO,CAAS;AAAA,EAEnD,CAAC,GAGDI,EAAe,MAAM;AACnB,IAAIP,MACFA,IAAY,IACZJ,EAAA,IAEF,OAAO,oBAAoB,WAAWO,CAAS;AAAA,EACjD,CAAC,GAEM,EAAE,QAAAL,GAAQ,QAAAG,GAAQ,MAAAC,EAAA;AAC3B;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { GlobalTheme, GlobalThemeOverrides } from 'naive-ui';
|
|
3
|
+
/**
|
|
4
|
+
* 主题落地:随 app.isDark / app.accent / app.density / app.grayscale 变化,
|
|
5
|
+
* 1) 打 data-theme / data-density 到 <html>(裸 CSS 与 tokens 跟着翻);
|
|
6
|
+
* 2) 把 accent 派生的 --color-primary* 写到 <html>(令消费 tokens 的裸 CSS 换色);
|
|
7
|
+
* 3) 重建 Naive themeOverrides(新对象触发 n-config-provider 重渲染)。
|
|
8
|
+
* 返回类型显式写出:推断出的 Naive 主题类型展开后超出 d.ts 序列化上限,包的类型声明会不完整。
|
|
9
|
+
*/
|
|
10
|
+
export declare function useTheme(): {
|
|
11
|
+
overrides: Ref<GlobalThemeOverrides>;
|
|
12
|
+
naiveTheme: Ref<GlobalTheme | null>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ref as s, watch as p } from "vue";
|
|
2
|
+
import { darkTheme as u } from "naive-ui";
|
|
3
|
+
import { useAppStore as d } from "../stores/app.js";
|
|
4
|
+
import { buildThemeOverrides as y } from "../theme/naive-theme.js";
|
|
5
|
+
import { derivePrimary as h } from "../theme/mix.js";
|
|
6
|
+
function P() {
|
|
7
|
+
const e = d(), n = s({}), a = s(null);
|
|
8
|
+
let i = null;
|
|
9
|
+
function c() {
|
|
10
|
+
const t = document.documentElement;
|
|
11
|
+
t.classList.add("theme-switching"), i && clearTimeout(i), i = setTimeout(() => t.classList.remove("theme-switching"), 280);
|
|
12
|
+
}
|
|
13
|
+
function m() {
|
|
14
|
+
const t = document.documentElement, r = getComputedStyle(t).getPropertyValue("--color-bg-container").trim() || void 0, o = h(e.accent, e.isDark, r);
|
|
15
|
+
t.style.setProperty("--color-primary", o.primary), t.style.setProperty("--color-primary-hover", o.hover), t.style.setProperty("--color-primary-pressed", o.pressed), t.style.setProperty("--color-primary-light", o.light);
|
|
16
|
+
}
|
|
17
|
+
function l() {
|
|
18
|
+
const t = e.isDark;
|
|
19
|
+
c();
|
|
20
|
+
const r = document.documentElement;
|
|
21
|
+
r.setAttribute("data-theme", t ? "dark" : ""), r.setAttribute("data-density", e.density), r.toggleAttribute("data-gray", e.grayscale), m(), a.value = e.isDark ? u : null, n.value = y({ dark: e.isDark, accent: e.accent });
|
|
22
|
+
}
|
|
23
|
+
return p([() => e.isDark, () => e.accent, () => e.density, () => e.grayscale], l, {
|
|
24
|
+
immediate: !0
|
|
25
|
+
}), { overrides: n, naiveTheme: a };
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
P as useTheme
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=useTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTheme.js","sources":["../../src/composables/useTheme.ts"],"sourcesContent":["import { ref, watch, type Ref } from 'vue'\nimport { darkTheme, type GlobalTheme, type GlobalThemeOverrides } from 'naive-ui'\nimport { useAppStore } from '#/stores/app'\nimport { buildThemeOverrides } from '#/theme/naive-theme'\nimport { derivePrimary } from '#/theme/mix'\n\n/**\n * 主题落地:随 app.isDark / app.accent / app.density / app.grayscale 变化,\n * 1) 打 data-theme / data-density 到 <html>(裸 CSS 与 tokens 跟着翻);\n * 2) 把 accent 派生的 --color-primary* 写到 <html>(令消费 tokens 的裸 CSS 换色);\n * 3) 重建 Naive themeOverrides(新对象触发 n-config-provider 重渲染)。\n * 返回类型显式写出:推断出的 Naive 主题类型展开后超出 d.ts 序列化上限,包的类型声明会不完整。\n */\nexport function useTheme(): {\n overrides: Ref<GlobalThemeOverrides>\n naiveTheme: Ref<GlobalTheme | null>\n} {\n const app = useAppStore()\n const overrides = ref<GlobalThemeOverrides>({}) as Ref<GlobalThemeOverrides>\n const naiveTheme = ref<GlobalTheme | null>(null) as Ref<GlobalTheme | null>\n\n // 主题切换过渡:短暂给 <html> 加 theme-switching,让颜色平滑过渡且不盖整屏淡化层,文字不会短暂发糊。\n let transitionTimer: ReturnType<typeof setTimeout> | null = null\n\n function beginThemeTransition() {\n const el = document.documentElement\n el.classList.add('theme-switching')\n if (transitionTimer) clearTimeout(transitionTimer)\n transitionTimer = setTimeout(() => el.classList.remove('theme-switching'), 280)\n }\n\n function applyPrimaryVars() {\n const el = document.documentElement\n // 容器色要在 data-theme 打上之后读(apply() 里的顺序),否则暗色首帧会拿到亮色容器。\n const container =\n getComputedStyle(el).getPropertyValue('--color-bg-container').trim() || undefined\n const p = derivePrimary(app.accent, app.isDark, container)\n el.style.setProperty('--color-primary', p.primary)\n el.style.setProperty('--color-primary-hover', p.hover)\n el.style.setProperty('--color-primary-pressed', p.pressed)\n el.style.setProperty('--color-primary-light', p.light)\n }\n\n function apply() {\n const nextDark = app.isDark\n beginThemeTransition() // 主题切换瞬间启用颜色过渡,不做整屏淡化\n const el = document.documentElement\n el.setAttribute('data-theme', nextDark ? 'dark' : '')\n el.setAttribute('data-density', app.density)\n el.toggleAttribute('data-gray', app.grayscale) // 灰阶滤镜(styles/index.css)\n applyPrimaryVars()\n naiveTheme.value = app.isDark ? darkTheme : null\n overrides.value = buildThemeOverrides({ dark: app.isDark, accent: app.accent })\n }\n\n watch([() => app.isDark, () => app.accent, () => app.density, () => app.grayscale], apply, {\n immediate: true,\n })\n\n return { overrides, naiveTheme }\n}\n"],"names":["useTheme","app","useAppStore","overrides","ref","naiveTheme","transitionTimer","beginThemeTransition","el","applyPrimaryVars","container","p","derivePrimary","apply","nextDark","darkTheme","buildThemeOverrides","watch"],"mappings":";;;;;AAaO,SAASA,IAGd;AACA,QAAMC,IAAMC,EAAA,GACNC,IAAYC,EAA0B,EAAE,GACxCC,IAAaD,EAAwB,IAAI;AAG/C,MAAIE,IAAwD;AAE5D,WAASC,IAAuB;AAC9B,UAAMC,IAAK,SAAS;AACpB,IAAAA,EAAG,UAAU,IAAI,iBAAiB,GAC9BF,kBAA8BA,CAAe,GACjDA,IAAkB,WAAW,MAAME,EAAG,UAAU,OAAO,iBAAiB,GAAG,GAAG;AAAA,EAChF;AAEA,WAASC,IAAmB;AAC1B,UAAMD,IAAK,SAAS,iBAEdE,IACJ,iBAAiBF,CAAE,EAAE,iBAAiB,sBAAsB,EAAE,UAAU,QACpEG,IAAIC,EAAcX,EAAI,QAAQA,EAAI,QAAQS,CAAS;AACzD,IAAAF,EAAG,MAAM,YAAY,mBAAmBG,EAAE,OAAO,GACjDH,EAAG,MAAM,YAAY,yBAAyBG,EAAE,KAAK,GACrDH,EAAG,MAAM,YAAY,2BAA2BG,EAAE,OAAO,GACzDH,EAAG,MAAM,YAAY,yBAAyBG,EAAE,KAAK;AAAA,EACvD;AAEA,WAASE,IAAQ;AACf,UAAMC,IAAWb,EAAI;AACrB,IAAAM,EAAA;AACA,UAAMC,IAAK,SAAS;AACpB,IAAAA,EAAG,aAAa,cAAcM,IAAW,SAAS,EAAE,GACpDN,EAAG,aAAa,gBAAgBP,EAAI,OAAO,GAC3CO,EAAG,gBAAgB,aAAaP,EAAI,SAAS,GAC7CQ,EAAA,GACAJ,EAAW,QAAQJ,EAAI,SAASc,IAAY,MAC5CZ,EAAU,QAAQa,EAAoB,EAAE,MAAMf,EAAI,QAAQ,QAAQA,EAAI,QAAQ;AAAA,EAChF;AAEA,SAAAgB,EAAM,CAAC,MAAMhB,EAAI,QAAQ,MAAMA,EAAI,QAAQ,MAAMA,EAAI,SAAS,MAAMA,EAAI,SAAS,GAAGY,GAAO;AAAA,IACzF,WAAW;AAAA,EAAA,CACZ,GAEM,EAAE,WAAAV,GAAW,YAAAE,EAAA;AACtB;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ref as r, onScopeDispose as s } from "vue";
|
|
2
|
+
const i = "--vvh";
|
|
3
|
+
function u() {
|
|
4
|
+
const o = r(0), e = typeof window < "u" ? window.visualViewport : void 0;
|
|
5
|
+
function t() {
|
|
6
|
+
const n = Math.round((e == null ? void 0 : e.height) ?? window.innerHeight ?? 0);
|
|
7
|
+
n <= 0 || n === o.value || (o.value = n, document.documentElement.style.setProperty(i, `${n}px`));
|
|
8
|
+
}
|
|
9
|
+
return t(), e ? (e.addEventListener("resize", t), e.addEventListener("scroll", t)) : window.addEventListener("resize", t), s(() => {
|
|
10
|
+
e ? (e.removeEventListener("resize", t), e.removeEventListener("scroll", t)) : window.removeEventListener("resize", t), document.documentElement.style.removeProperty(i);
|
|
11
|
+
}), o;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
u as useVisualViewportHeight
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useVisualViewportHeight.js.map
|