@go-wind/admin-vben 0.0.0-stage → 0.1.1
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 +21 -0
- package/package.json +38 -3
- package/src/base/design/css/global.css +169 -0
- package/src/base/design/css/nprogress.css +59 -0
- package/src/base/design/css/transition.css +236 -0
- package/src/base/design/css/ui.css +83 -0
- package/src/base/design/design-tokens/dark.css +448 -0
- package/src/base/design/design-tokens/default.css +396 -0
- package/src/base/design/design-tokens/index.ts +4 -0
- package/src/base/design/index.ts +8 -0
- package/src/base/design/scss-bem/bem.scss +34 -0
- package/src/base/design/scss-bem/constants.scss +5 -0
- package/src/base/icons/create-icon.ts +14 -0
- package/src/base/icons/index.ts +11 -0
- package/src/base/icons/lucide.ts +62 -0
- package/src/base/shared/cache/__tests__/storage-manager.test.ts +130 -0
- package/src/base/shared/cache/index.ts +1 -0
- package/src/base/shared/cache/storage-manager.ts +118 -0
- package/src/base/shared/cache/types.ts +17 -0
- package/src/base/shared/color/__tests__/convert.test.ts +58 -0
- package/src/base/shared/color/color.ts +10 -0
- package/src/base/shared/color/convert.ts +62 -0
- package/src/base/shared/color/generator.ts +45 -0
- package/src/base/shared/color/index.ts +3 -0
- package/src/base/shared/constants/globals.ts +16 -0
- package/src/base/shared/constants/index.ts +2 -0
- package/src/base/shared/constants/vben.ts +25 -0
- package/src/base/shared/global-state.ts +45 -0
- package/src/base/shared/store.ts +1 -0
- package/src/base/shared/utils/__tests__/diff.test.ts +53 -0
- package/src/base/shared/utils/__tests__/dom.test.ts +127 -0
- package/src/base/shared/utils/__tests__/inference.test.ts +183 -0
- package/src/base/shared/utils/__tests__/letter.test.ts +116 -0
- package/src/base/shared/utils/__tests__/state-handler.test.ts +60 -0
- package/src/base/shared/utils/__tests__/tree.test.ts +196 -0
- package/src/base/shared/utils/__tests__/unique.test.ts +60 -0
- package/src/base/shared/utils/__tests__/update-css-variables.test.ts +30 -0
- package/src/base/shared/utils/__tests__/util.test.ts +156 -0
- package/src/base/shared/utils/__tests__/window.test.ts +33 -0
- package/src/base/shared/utils/cn.ts +8 -0
- package/src/base/shared/utils/date.ts +57 -0
- package/src/base/shared/utils/diff.ts +96 -0
- package/src/base/shared/utils/dom.ts +95 -0
- package/src/base/shared/utils/download.ts +156 -0
- package/src/base/shared/utils/index.ts +19 -0
- package/src/base/shared/utils/inference.ts +164 -0
- package/src/base/shared/utils/letter.ts +47 -0
- package/src/base/shared/utils/merge.ts +10 -0
- package/src/base/shared/utils/nprogress.ts +43 -0
- package/src/base/shared/utils/state-handler.ts +50 -0
- package/src/base/shared/utils/to.ts +21 -0
- package/src/base/shared/utils/tree.ts +97 -0
- package/src/base/shared/utils/unique.ts +15 -0
- package/src/base/shared/utils/update-css-variables.ts +35 -0
- package/src/base/shared/utils/util.ts +44 -0
- package/src/base/shared/utils/window.ts +37 -0
- package/src/base/typings/app.d.ts +106 -0
- package/src/base/typings/basic.d.ts +39 -0
- package/src/base/typings/helper.d.ts +133 -0
- package/src/base/typings/index.ts +6 -0
- package/src/base/typings/menu-record.ts +77 -0
- package/src/base/typings/tabs.ts +3 -0
- package/src/base/typings/vue-router.d.ts +143 -0
- package/src/constants/core.ts +31 -0
- package/src/constants/index.ts +2 -0
- package/src/core/composables/__tests__/use-sortable.test.ts +48 -0
- package/src/core/composables/index.ts +13 -0
- package/src/core/composables/use-is-mobile.ts +7 -0
- package/src/core/composables/use-layout-style.ts +87 -0
- package/src/core/composables/use-namespace.ts +106 -0
- package/src/core/composables/use-priority-value.ts +93 -0
- package/src/core/composables/use-scroll-lock.ts +54 -0
- package/src/core/composables/use-simple-locale/README.md +3 -0
- package/src/core/composables/use-simple-locale/index.ts +25 -0
- package/src/core/composables/use-simple-locale/messages.ts +22 -0
- package/src/core/composables/use-sortable.ts +29 -0
- package/src/core/preferences/config.ts +115 -0
- package/src/core/preferences/constants.ts +88 -0
- package/src/core/preferences/index.ts +35 -0
- package/src/core/preferences/preferences.ts +231 -0
- package/src/core/preferences/types.ts +281 -0
- package/src/core/preferences/update-css-variables.ts +116 -0
- package/src/core/preferences/use-preferences.ts +232 -0
- package/src/effects/access/access-control.vue +47 -0
- package/src/effects/access/accessible.ts +86 -0
- package/src/effects/access/directive.ts +42 -0
- package/src/effects/access/index.ts +4 -0
- package/src/effects/access/use-access.ts +53 -0
- package/src/effects/common-ui/components/api-component/api-component.vue +205 -0
- package/src/effects/common-ui/components/api-component/index.ts +1 -0
- package/src/effects/common-ui/components/captcha/hooks/useCaptchaPoints.ts +19 -0
- package/src/effects/common-ui/components/captcha/index.ts +6 -0
- package/src/effects/common-ui/components/captcha/point-selection-captcha/index.vue +175 -0
- package/src/effects/common-ui/components/captcha/point-selection-captcha/point-selection-captcha-card.vue +83 -0
- package/src/effects/common-ui/components/captcha/slider-captcha/index.vue +243 -0
- package/src/effects/common-ui/components/captcha/slider-captcha/slider-captcha-action.vue +63 -0
- package/src/effects/common-ui/components/captcha/slider-captcha/slider-captcha-bar.vue +38 -0
- package/src/effects/common-ui/components/captcha/slider-captcha/slider-captcha-content.vue +52 -0
- package/src/effects/common-ui/components/captcha/slider-rotate-captcha/index.vue +213 -0
- package/src/effects/common-ui/components/captcha/types.ts +175 -0
- package/src/effects/common-ui/components/col-page/col-page.vue +107 -0
- package/src/effects/common-ui/components/col-page/index.ts +2 -0
- package/src/effects/common-ui/components/col-page/types.ts +26 -0
- package/src/effects/common-ui/components/ellipsis-text/ellipsis-text.vue +142 -0
- package/src/effects/common-ui/components/ellipsis-text/index.ts +1 -0
- package/src/effects/common-ui/components/icon-picker/icon-picker.vue +230 -0
- package/src/effects/common-ui/components/icon-picker/index.ts +1 -0
- package/src/effects/common-ui/components/index.ts +23 -0
- package/src/effects/common-ui/components/json-viewer/index.ts +3 -0
- package/src/effects/common-ui/components/json-viewer/index.vue +114 -0
- package/src/effects/common-ui/components/json-viewer/style.scss +98 -0
- package/src/effects/common-ui/components/json-viewer/types.ts +44 -0
- package/src/effects/common-ui/components/page/__tests__/page.test.ts +89 -0
- package/src/effects/common-ui/components/page/index.ts +2 -0
- package/src/effects/common-ui/components/page/page.vue +99 -0
- package/src/effects/common-ui/components/page/types.ts +17 -0
- package/src/effects/common-ui/components/resize/index.ts +1 -0
- package/src/effects/common-ui/components/resize/resize.vue +1122 -0
- package/src/effects/common-ui/index.ts +2 -0
- package/src/effects/common-ui/ui/about/about.ts +14 -0
- package/src/effects/common-ui/ui/about/about.vue +182 -0
- package/src/effects/common-ui/ui/about/index.ts +1 -0
- package/src/effects/common-ui/ui/authentication/auth-title.vue +13 -0
- package/src/effects/common-ui/ui/authentication/code-login.vue +118 -0
- package/src/effects/common-ui/ui/authentication/forget-password.vue +115 -0
- package/src/effects/common-ui/ui/authentication/index.ts +7 -0
- package/src/effects/common-ui/ui/authentication/login-expired-modal.vue +56 -0
- package/src/effects/common-ui/ui/authentication/login.vue +184 -0
- package/src/effects/common-ui/ui/authentication/qrcode-login.vue +94 -0
- package/src/effects/common-ui/ui/authentication/register.vue +119 -0
- package/src/effects/common-ui/ui/authentication/third-party-login.vue +36 -0
- package/src/effects/common-ui/ui/authentication/types.ts +70 -0
- package/src/effects/common-ui/ui/dashboard/analysis/analysis-chart-card.vue +24 -0
- package/src/effects/common-ui/ui/dashboard/analysis/analysis-charts-tabs.vue +40 -0
- package/src/effects/common-ui/ui/dashboard/analysis/analysis-overview.vue +55 -0
- package/src/effects/common-ui/ui/dashboard/analysis/index.ts +3 -0
- package/src/effects/common-ui/ui/dashboard/index.ts +3 -0
- package/src/effects/common-ui/ui/dashboard/typing.ts +32 -0
- package/src/effects/common-ui/ui/dashboard/workbench/index.ts +3 -0
- package/src/effects/common-ui/ui/dashboard/workbench/workbench-header.vue +46 -0
- package/src/effects/common-ui/ui/dashboard/workbench/workbench-project.vue +63 -0
- package/src/effects/common-ui/ui/dashboard/workbench/workbench-quick-nav.vue +54 -0
- package/src/effects/common-ui/ui/fallback/fallback.ts +25 -0
- package/src/effects/common-ui/ui/fallback/fallback.vue +163 -0
- package/src/effects/common-ui/ui/fallback/icons/icon-403.vue +151 -0
- package/src/effects/common-ui/ui/fallback/icons/icon-404.vue +154 -0
- package/src/effects/common-ui/ui/fallback/icons/icon-500.vue +215 -0
- package/src/effects/common-ui/ui/fallback/icons/icon-coming-soon.vue +262 -0
- package/src/effects/common-ui/ui/fallback/icons/icon-offline.vue +112 -0
- package/src/effects/common-ui/ui/fallback/index.ts +2 -0
- package/src/effects/common-ui/ui/index.ts +4 -0
- package/src/effects/hooks/index.ts +8 -0
- package/src/effects/hooks/use-app-config.ts +23 -0
- package/src/effects/hooks/use-content-maximize.ts +24 -0
- package/src/effects/hooks/use-design-tokens.ts +280 -0
- package/src/effects/hooks/use-pagination.ts +57 -0
- package/src/effects/hooks/use-refresh.ts +16 -0
- package/src/effects/hooks/use-tabs.ts +113 -0
- package/src/effects/hooks/use-watermark.ts +88 -0
- package/src/icons/iconify/index.ts +79 -0
- package/src/icons/icons/empty-icon.vue +27 -0
- package/src/icons/index.ts +3 -0
- package/src/icons/svg/icons/antdv-logo.svg +29 -0
- package/src/icons/svg/icons/avatar-1.svg +1 -0
- package/src/icons/svg/icons/avatar-2.svg +1 -0
- package/src/icons/svg/icons/avatar-3.svg +1 -0
- package/src/icons/svg/icons/avatar-4.svg +1 -0
- package/src/icons/svg/icons/bell.svg +1 -0
- package/src/icons/svg/icons/cake.svg +1 -0
- package/src/icons/svg/icons/card.svg +1 -0
- package/src/icons/svg/icons/download.svg +1 -0
- package/src/icons/svg/icons/language.svg +1 -0
- package/src/icons/svg/icons/setting.svg +1 -0
- package/src/icons/svg/index.ts +29 -0
- package/src/icons/svg/load.ts +61 -0
- package/src/locales/i18n.ts +146 -0
- package/src/locales/index.ts +30 -0
- package/src/locales/langs/en-US/authentication.json +97 -0
- package/src/locales/langs/en-US/common.json +27 -0
- package/src/locales/langs/en-US/preferences.json +169 -0
- package/src/locales/langs/en-US/ui.json +87 -0
- package/src/locales/langs/zh-CN/authentication.json +97 -0
- package/src/locales/langs/zh-CN/common.json +27 -0
- package/src/locales/langs/zh-CN/preferences.json +169 -0
- package/src/locales/langs/zh-CN/ui.json +87 -0
- package/src/locales/typing.ts +25 -0
- package/src/preferences/index.ts +17 -0
- package/src/stores/index.ts +3 -0
- package/src/stores/modules/access.test.ts +46 -0
- package/src/stores/modules/access.ts +130 -0
- package/src/stores/modules/index.ts +4 -0
- package/src/stores/modules/lock.test.ts +31 -0
- package/src/stores/modules/lock.ts +38 -0
- package/src/stores/modules/tabbar.test.ts +295 -0
- package/src/stores/modules/tabbar.ts +558 -0
- package/src/stores/modules/user.test.ts +37 -0
- package/src/stores/modules/user.ts +92 -0
- package/src/stores/setup.ts +43 -0
- package/src/styles/antd/index.css +292 -0
- package/src/styles/ele/index.css +3 -0
- package/src/styles/global/index.scss +1 -0
- package/src/styles/index.ts +1 -0
- package/src/types/global.d.ts +23 -0
- package/src/types/index.ts +2 -0
- package/src/types/user.ts +26 -0
- package/src/ui-kit/form-ui/components/form-actions.vue +205 -0
- package/src/ui-kit/form-ui/config.ts +82 -0
- package/src/ui-kit/form-ui/form-api.ts +351 -0
- package/src/ui-kit/form-ui/form-render/context.ts +24 -0
- package/src/ui-kit/form-ui/form-render/dependencies.ts +124 -0
- package/src/ui-kit/form-ui/form-render/expandable.ts +99 -0
- package/src/ui-kit/form-ui/form-render/form-field.vue +350 -0
- package/src/ui-kit/form-ui/form-render/form-label.vue +22 -0
- package/src/ui-kit/form-ui/form-render/form.vue +160 -0
- package/src/ui-kit/form-ui/form-render/helper.ts +60 -0
- package/src/ui-kit/form-ui/form-render/index.ts +3 -0
- package/src/ui-kit/form-ui/index.ts +12 -0
- package/src/ui-kit/form-ui/types.ts +395 -0
- package/src/ui-kit/form-ui/use-form-context.ts +59 -0
- package/src/ui-kit/form-ui/use-vben-form.ts +50 -0
- package/src/ui-kit/form-ui/vben-form.vue +77 -0
- package/src/ui-kit/form-ui/vben-use-form.vue +113 -0
- package/src/ui-kit/layout-ui/components/index.ts +5 -0
- package/src/ui-kit/layout-ui/components/layout-content.vue +63 -0
- package/src/ui-kit/layout-ui/components/layout-footer.vue +43 -0
- package/src/ui-kit/layout-ui/components/layout-header.vue +76 -0
- package/src/ui-kit/layout-ui/components/layout-sidebar.vue +315 -0
- package/src/ui-kit/layout-ui/components/layout-tabbar.vue +29 -0
- package/src/ui-kit/layout-ui/components/widgets/index.ts +2 -0
- package/src/ui-kit/layout-ui/components/widgets/sidebar-collapse-button.vue +19 -0
- package/src/ui-kit/layout-ui/components/widgets/sidebar-fixed-button.vue +19 -0
- package/src/ui-kit/layout-ui/hooks/use-layout.ts +41 -0
- package/src/ui-kit/layout-ui/index.ts +2 -0
- package/src/ui-kit/layout-ui/vben-layout.ts +165 -0
- package/src/ui-kit/layout-ui/vben-layout.vue +596 -0
- package/src/ui-kit/menu-ui/components/collapse-transition.vue +96 -0
- package/src/ui-kit/menu-ui/components/index.ts +4 -0
- package/src/ui-kit/menu-ui/components/menu-badge-dot.vue +28 -0
- package/src/ui-kit/menu-ui/components/menu-badge.vue +57 -0
- package/src/ui-kit/menu-ui/components/menu-item.vue +122 -0
- package/src/ui-kit/menu-ui/components/menu.vue +859 -0
- package/src/ui-kit/menu-ui/components/normal-menu/index.ts +2 -0
- package/src/ui-kit/menu-ui/components/normal-menu/normal-menu.ts +27 -0
- package/src/ui-kit/menu-ui/components/normal-menu/normal-menu.vue +162 -0
- package/src/ui-kit/menu-ui/components/sub-menu-content.vue +105 -0
- package/src/ui-kit/menu-ui/components/sub-menu.vue +273 -0
- package/src/ui-kit/menu-ui/hooks/index.ts +2 -0
- package/src/ui-kit/menu-ui/hooks/use-menu-context.ts +55 -0
- package/src/ui-kit/menu-ui/hooks/use-menu.ts +48 -0
- package/src/ui-kit/menu-ui/index.ts +3 -0
- package/src/ui-kit/menu-ui/menu.vue +38 -0
- package/src/ui-kit/menu-ui/sub-menu.vue +71 -0
- package/src/ui-kit/menu-ui/types.ts +139 -0
- package/src/ui-kit/menu-ui/utils/index.ts +51 -0
- package/src/ui-kit/popup-ui/drawer/__tests__/drawer-api.test.ts +132 -0
- package/src/ui-kit/popup-ui/drawer/drawer-api.ts +144 -0
- package/src/ui-kit/popup-ui/drawer/drawer.ts +152 -0
- package/src/ui-kit/popup-ui/drawer/drawer.vue +251 -0
- package/src/ui-kit/popup-ui/drawer/index.ts +3 -0
- package/src/ui-kit/popup-ui/drawer/use-drawer.ts +105 -0
- package/src/ui-kit/popup-ui/index.ts +2 -0
- package/src/ui-kit/popup-ui/modal/__tests__/modal-api.test.ts +128 -0
- package/src/ui-kit/popup-ui/modal/index.ts +3 -0
- package/src/ui-kit/popup-ui/modal/modal-api.ts +172 -0
- package/src/ui-kit/popup-ui/modal/modal.ts +175 -0
- package/src/ui-kit/popup-ui/modal/modal.vue +311 -0
- package/src/ui-kit/popup-ui/modal/use-modal-draggable.ts +116 -0
- package/src/ui-kit/popup-ui/modal/use-modal.ts +117 -0
- package/src/ui-kit/shadcn-ui/components/avatar/avatar.vue +49 -0
- package/src/ui-kit/shadcn-ui/components/avatar/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/back-top/back-top.vue +43 -0
- package/src/ui-kit/shadcn-ui/components/back-top/backtop.ts +38 -0
- package/src/ui-kit/shadcn-ui/components/back-top/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/back-top/use-backtop.ts +45 -0
- package/src/ui-kit/shadcn-ui/components/breadcrumb/breadcrumb-background.vue +109 -0
- package/src/ui-kit/shadcn-ui/components/breadcrumb/breadcrumb-view.vue +22 -0
- package/src/ui-kit/shadcn-ui/components/breadcrumb/breadcrumb.vue +98 -0
- package/src/ui-kit/shadcn-ui/components/breadcrumb/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/components/breadcrumb/types.ts +17 -0
- package/src/ui-kit/shadcn-ui/components/button/button.ts +24 -0
- package/src/ui-kit/shadcn-ui/components/button/button.vue +42 -0
- package/src/ui-kit/shadcn-ui/components/button/icon-button.vue +78 -0
- package/src/ui-kit/shadcn-ui/components/button/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/components/checkbox/checkbox.vue +26 -0
- package/src/ui-kit/shadcn-ui/components/checkbox/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/context-menu/context-menu.vue +96 -0
- package/src/ui-kit/shadcn-ui/components/context-menu/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/components/context-menu/interface.ts +38 -0
- package/src/ui-kit/shadcn-ui/components/count-to-animator/count-to-animator.vue +111 -0
- package/src/ui-kit/shadcn-ui/components/count-to-animator/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/dropdown-menu/dropdown-menu.vue +49 -0
- package/src/ui-kit/shadcn-ui/components/dropdown-menu/dropdown-radio-menu.vue +52 -0
- package/src/ui-kit/shadcn-ui/components/dropdown-menu/index.ts +4 -0
- package/src/ui-kit/shadcn-ui/components/dropdown-menu/interface.ts +32 -0
- package/src/ui-kit/shadcn-ui/components/expandable-arrow/expandable-arrow.vue +31 -0
- package/src/ui-kit/shadcn-ui/components/expandable-arrow/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/full-screen/full-screen.vue +51 -0
- package/src/ui-kit/shadcn-ui/components/full-screen/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/hover-card/hover-card.vue +54 -0
- package/src/ui-kit/shadcn-ui/components/hover-card/index.ts +2 -0
- package/src/ui-kit/shadcn-ui/components/icon/icon.vue +33 -0
- package/src/ui-kit/shadcn-ui/components/icon/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/index.ts +23 -0
- package/src/ui-kit/shadcn-ui/components/input-password/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/input-password/input-password.vue +57 -0
- package/src/ui-kit/shadcn-ui/components/input-password/password-strength.vue +66 -0
- package/src/ui-kit/shadcn-ui/components/logo/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/logo/logo.vue +65 -0
- package/src/ui-kit/shadcn-ui/components/pin-input/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/components/pin-input/input.vue +116 -0
- package/src/ui-kit/shadcn-ui/components/pin-input/types.ts +30 -0
- package/src/ui-kit/shadcn-ui/components/popover/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/popover/popover.vue +57 -0
- package/src/ui-kit/shadcn-ui/components/render-content/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/render-content/render-content.vue +39 -0
- package/src/ui-kit/shadcn-ui/components/scrollbar/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/scrollbar/scrollbar.vue +153 -0
- package/src/ui-kit/shadcn-ui/components/segmented/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/components/segmented/segmented.vue +59 -0
- package/src/ui-kit/shadcn-ui/components/segmented/tabs-indicator.vue +37 -0
- package/src/ui-kit/shadcn-ui/components/segmented/types.ts +6 -0
- package/src/ui-kit/shadcn-ui/components/select/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/select/select.vue +29 -0
- package/src/ui-kit/shadcn-ui/components/spine-text/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/components/spine-text/spine-text.vue +49 -0
- package/src/ui-kit/shadcn-ui/components/spinner/index.ts +2 -0
- package/src/ui-kit/shadcn-ui/components/spinner/loading.vue +137 -0
- package/src/ui-kit/shadcn-ui/components/spinner/spinner.vue +125 -0
- package/src/ui-kit/shadcn-ui/components/tooltip/help-tooltip.vue +31 -0
- package/src/ui-kit/shadcn-ui/components/tooltip/index.ts +2 -0
- package/src/ui-kit/shadcn-ui/components/tooltip/tooltip.vue +43 -0
- package/src/ui-kit/shadcn-ui/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/ui/accordion/Accordion.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/accordion/AccordionContent.vue +26 -0
- package/src/ui-kit/shadcn-ui/ui/accordion/AccordionItem.vue +27 -0
- package/src/ui-kit/shadcn-ui/ui/accordion/AccordionTrigger.vue +41 -0
- package/src/ui-kit/shadcn-ui/ui/accordion/index.ts +4 -0
- package/src/ui-kit/shadcn-ui/ui/alert-dialog/AlertDialog.vue +16 -0
- package/src/ui-kit/shadcn-ui/ui/alert-dialog/AlertDialogAction.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/alert-dialog/AlertDialogCancel.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/alert-dialog/AlertDialogContent.vue +101 -0
- package/src/ui-kit/shadcn-ui/ui/alert-dialog/AlertDialogDescription.vue +28 -0
- package/src/ui-kit/shadcn-ui/ui/alert-dialog/AlertDialogOverlay.vue +8 -0
- package/src/ui-kit/shadcn-ui/ui/alert-dialog/AlertDialogTitle.vue +30 -0
- package/src/ui-kit/shadcn-ui/ui/alert-dialog/index.ts +6 -0
- package/src/ui-kit/shadcn-ui/ui/avatar/Avatar.vue +25 -0
- package/src/ui-kit/shadcn-ui/ui/avatar/AvatarFallback.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/avatar/AvatarImage.vue +9 -0
- package/src/ui-kit/shadcn-ui/ui/avatar/avatar.ts +20 -0
- package/src/ui-kit/shadcn-ui/ui/avatar/index.ts +4 -0
- package/src/ui-kit/shadcn-ui/ui/badge/Badge.vue +16 -0
- package/src/ui-kit/shadcn-ui/ui/badge/badge.ts +23 -0
- package/src/ui-kit/shadcn-ui/ui/badge/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/ui/breadcrumb/Breadcrumb.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/breadcrumb/BreadcrumbEllipsis.vue +22 -0
- package/src/ui-kit/shadcn-ui/ui/breadcrumb/BreadcrumbItem.vue +17 -0
- package/src/ui-kit/shadcn-ui/ui/breadcrumb/BreadcrumbLink.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/breadcrumb/BreadcrumbList.vue +20 -0
- package/src/ui-kit/shadcn-ui/ui/breadcrumb/BreadcrumbPage.vue +18 -0
- package/src/ui-kit/shadcn-ui/ui/breadcrumb/BreadcrumbSeparator.vue +21 -0
- package/src/ui-kit/shadcn-ui/ui/breadcrumb/index.ts +7 -0
- package/src/ui-kit/shadcn-ui/ui/button/Button.vue +30 -0
- package/src/ui-kit/shadcn-ui/ui/button/button.ts +34 -0
- package/src/ui-kit/shadcn-ui/ui/button/index.ts +5 -0
- package/src/ui-kit/shadcn-ui/ui/button/types.ts +20 -0
- package/src/ui-kit/shadcn-ui/ui/card/Card.vue +20 -0
- package/src/ui-kit/shadcn-ui/ui/card/CardContent.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/card/CardDescription.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/card/CardFooter.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/card/CardHeader.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/card/CardTitle.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/card/index.ts +6 -0
- package/src/ui-kit/shadcn-ui/ui/checkbox/Checkbox.vue +45 -0
- package/src/ui-kit/shadcn-ui/ui/checkbox/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenu.vue +18 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuCheckboxItem.vue +44 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuContent.vue +40 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuGroup.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuItem.vue +40 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuLabel.vue +32 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuPortal.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuRadioGroup.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuRadioItem.vue +44 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuSeparator.vue +25 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuShortcut.vue +17 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuSub.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuSubContent.vue +37 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuSubTrigger.vue +43 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/ContextMenuTrigger.vue +17 -0
- package/src/ui-kit/shadcn-ui/ui/context-menu/index.ts +14 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/Dialog.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogClose.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogContent.vue +117 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogDescription.vue +30 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogFooter.vue +15 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogHeader.vue +15 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogOverlay.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogScrollContent.vue +71 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogTitle.vue +28 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/DialogTrigger.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/dialog/index.ts +9 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenu.vue +21 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +44 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuContent.vue +45 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuGroup.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuItem.vue +38 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuLabel.vue +34 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuRadioGroup.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuRadioItem.vue +45 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuSeparator.vue +29 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuShortcut.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuSub.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuSubContent.vue +37 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuSubTrigger.vue +37 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/src/ui-kit/shadcn-ui/ui/dropdown-menu/index.ts +16 -0
- package/src/ui-kit/shadcn-ui/ui/form/FormControl.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/form/FormDescription.vue +20 -0
- package/src/ui-kit/shadcn-ui/ui/form/FormItem.vue +20 -0
- package/src/ui-kit/shadcn-ui/ui/form/FormLabel.vue +18 -0
- package/src/ui-kit/shadcn-ui/ui/form/FormMessage.vue +18 -0
- package/src/ui-kit/shadcn-ui/ui/form/index.ts +11 -0
- package/src/ui-kit/shadcn-ui/ui/form/injectionKeys.ts +4 -0
- package/src/ui-kit/shadcn-ui/ui/form/useFormField.ts +38 -0
- package/src/ui-kit/shadcn-ui/ui/hover-card/HoverCard.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/hover-card/HoverCardContent.vue +43 -0
- package/src/ui-kit/shadcn-ui/ui/hover-card/HoverCardTrigger.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/hover-card/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/ui/index.ts +30 -0
- package/src/ui-kit/shadcn-ui/ui/input/Input.vue +32 -0
- package/src/ui-kit/shadcn-ui/ui/input/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/ui/label/Label.vue +29 -0
- package/src/ui-kit/shadcn-ui/ui/label/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/ui/number-field/NumberField.vue +26 -0
- package/src/ui-kit/shadcn-ui/ui/number-field/NumberFieldContent.vue +20 -0
- package/src/ui-kit/shadcn-ui/ui/number-field/NumberFieldDecrement.vue +37 -0
- package/src/ui-kit/shadcn-ui/ui/number-field/NumberFieldIncrement.vue +37 -0
- package/src/ui-kit/shadcn-ui/ui/number-field/NumberFieldInput.vue +16 -0
- package/src/ui-kit/shadcn-ui/ui/number-field/index.ts +5 -0
- package/src/ui-kit/shadcn-ui/ui/pagination/PaginationEllipsis.vue +27 -0
- package/src/ui-kit/shadcn-ui/ui/pagination/PaginationFirst.vue +33 -0
- package/src/ui-kit/shadcn-ui/ui/pagination/PaginationLast.vue +33 -0
- package/src/ui-kit/shadcn-ui/ui/pagination/PaginationNext.vue +33 -0
- package/src/ui-kit/shadcn-ui/ui/pagination/PaginationPrev.vue +33 -0
- package/src/ui-kit/shadcn-ui/ui/pagination/index.ts +10 -0
- package/src/ui-kit/shadcn-ui/ui/pin-input/PinInput.vue +31 -0
- package/src/ui-kit/shadcn-ui/ui/pin-input/PinInputGroup.vue +23 -0
- package/src/ui-kit/shadcn-ui/ui/pin-input/PinInputInput.vue +32 -0
- package/src/ui-kit/shadcn-ui/ui/pin-input/PinInputSeparator.vue +15 -0
- package/src/ui-kit/shadcn-ui/ui/pin-input/index.ts +4 -0
- package/src/ui-kit/shadcn-ui/ui/popover/Popover.vue +16 -0
- package/src/ui-kit/shadcn-ui/ui/popover/PopoverContent.vue +50 -0
- package/src/ui-kit/shadcn-ui/ui/popover/PopoverTrigger.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/popover/index.ts +4 -0
- package/src/ui-kit/shadcn-ui/ui/radio-group/RadioGroup.vue +29 -0
- package/src/ui-kit/shadcn-ui/ui/radio-group/RadioGroupItem.vue +39 -0
- package/src/ui-kit/shadcn-ui/ui/radio-group/index.ts +2 -0
- package/src/ui-kit/shadcn-ui/ui/resizable/ResizableHandle.vue +49 -0
- package/src/ui-kit/shadcn-ui/ui/resizable/ResizablePanelGroup.vue +37 -0
- package/src/ui-kit/shadcn-ui/ui/resizable/index.ts +3 -0
- package/src/ui-kit/shadcn-ui/ui/scroll-area/ScrollArea.vue +49 -0
- package/src/ui-kit/shadcn-ui/ui/scroll-area/ScrollBar.vue +42 -0
- package/src/ui-kit/shadcn-ui/ui/scroll-area/index.ts +2 -0
- package/src/ui-kit/shadcn-ui/ui/select/Select.vue +16 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectContent.vue +67 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectGroup.vue +21 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectItem.vue +46 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectItemText.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectLabel.vue +13 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectScrollDownButton.vue +35 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectScrollUpButton.vue +35 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectSeparator.vue +22 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectTrigger.vue +40 -0
- package/src/ui-kit/shadcn-ui/ui/select/SelectValue.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/select/index.ts +11 -0
- package/src/ui-kit/shadcn-ui/ui/separator/Separator.vue +42 -0
- package/src/ui-kit/shadcn-ui/ui/separator/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/Sheet.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/SheetClose.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/SheetContent.vue +83 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/SheetDescription.vue +24 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/SheetFooter.vue +15 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/SheetHeader.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/SheetOverlay.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/SheetTitle.vue +24 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/SheetTrigger.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/index.ts +10 -0
- package/src/ui-kit/shadcn-ui/ui/sheet/sheet.ts +22 -0
- package/src/ui-kit/shadcn-ui/ui/switch/Switch.vue +45 -0
- package/src/ui-kit/shadcn-ui/ui/switch/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/ui/tabs/Tabs.vue +16 -0
- package/src/ui-kit/shadcn-ui/ui/tabs/TabsContent.vue +29 -0
- package/src/ui-kit/shadcn-ui/ui/tabs/TabsList.vue +29 -0
- package/src/ui-kit/shadcn-ui/ui/tabs/TabsTrigger.vue +31 -0
- package/src/ui-kit/shadcn-ui/ui/tabs/index.ts +5 -0
- package/src/ui-kit/shadcn-ui/ui/textarea/Textarea.vue +32 -0
- package/src/ui-kit/shadcn-ui/ui/textarea/index.ts +1 -0
- package/src/ui-kit/shadcn-ui/ui/toggle/Toggle.vue +48 -0
- package/src/ui-kit/shadcn-ui/ui/toggle/index.ts +2 -0
- package/src/ui-kit/shadcn-ui/ui/toggle/toggle.ts +25 -0
- package/src/ui-kit/shadcn-ui/ui/toggle-group/ToggleGroup.vue +48 -0
- package/src/ui-kit/shadcn-ui/ui/toggle-group/ToggleGroupItem.vue +51 -0
- package/src/ui-kit/shadcn-ui/ui/toggle-group/index.ts +2 -0
- package/src/ui-kit/shadcn-ui/ui/tooltip/Tooltip.vue +19 -0
- package/src/ui-kit/shadcn-ui/ui/tooltip/TooltipContent.vue +52 -0
- package/src/ui-kit/shadcn-ui/ui/tooltip/TooltipProvider.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/tooltip/TooltipTrigger.vue +11 -0
- package/src/ui-kit/shadcn-ui/ui/tooltip/index.ts +4 -0
- package/src/ui-kit/shadcn-ui/ui/tree/index.ts +4 -0
- package/src/ui-kit/shadcn-ui/ui/tree/tree.vue +464 -0
- package/src/ui-kit/shadcn-ui/ui/tree/types.ts +62 -0
- package/src/ui-kit/tabs-ui/components/index.ts +2 -0
- package/src/ui-kit/tabs-ui/components/tabs/tabs.vue +133 -0
- package/src/ui-kit/tabs-ui/components/tabs-chrome/tabs.vue +195 -0
- package/src/ui-kit/tabs-ui/components/widgets/index.ts +2 -0
- package/src/ui-kit/tabs-ui/components/widgets/tool-more.vue +18 -0
- package/src/ui-kit/tabs-ui/components/widgets/tool-screen.vue +19 -0
- package/src/ui-kit/tabs-ui/index.ts +3 -0
- package/src/ui-kit/tabs-ui/tabs-view.vue +95 -0
- package/src/ui-kit/tabs-ui/types.ts +64 -0
- package/src/ui-kit/tabs-ui/use-tabs-drag.ts +127 -0
- package/src/ui-kit/tabs-ui/use-tabs-view-scroll.ts +194 -0
- package/src/utils/helpers/__tests__/find-menu-by-path.test.ts +88 -0
- package/src/utils/helpers/__tests__/generate-menus.test.ts +236 -0
- package/src/utils/helpers/__tests__/generate-routes-frontend.test.ts +105 -0
- package/src/utils/helpers/__tests__/merge-route-modules.test.ts +68 -0
- package/src/utils/helpers/find-menu-by-path.ts +37 -0
- package/src/utils/helpers/generate-menus.ts +80 -0
- package/src/utils/helpers/generate-routes-backend.ts +81 -0
- package/src/utils/helpers/generate-routes-frontend.ts +58 -0
- package/src/utils/helpers/get-popup-container.ts +6 -0
- package/src/utils/helpers/index.ts +8 -0
- package/src/utils/helpers/merge-route-modules.ts +28 -0
- package/src/utils/helpers/reset-routes.ts +31 -0
- package/src/utils/helpers/unmount-global-loading.ts +31 -0
- package/src/utils/index.ts +4 -0
- package/README.md +0 -3
|
@@ -0,0 +1,859 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { UseResizeObserverReturn } from '@vueuse/core';
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
MenuItemClicked,
|
|
6
|
+
MenuItemRegistered,
|
|
7
|
+
MenuProps,
|
|
8
|
+
MenuProvider,
|
|
9
|
+
} from '../types';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
computed,
|
|
13
|
+
nextTick,
|
|
14
|
+
reactive,
|
|
15
|
+
ref,
|
|
16
|
+
toRef,
|
|
17
|
+
useSlots,
|
|
18
|
+
type VNodeArrayChildren,
|
|
19
|
+
watch,
|
|
20
|
+
watchEffect,
|
|
21
|
+
} from 'vue';
|
|
22
|
+
|
|
23
|
+
import { useNamespace } from '../../../core/composables';
|
|
24
|
+
import { Ellipsis } from '../../../base/icons';
|
|
25
|
+
import { isHttpUrl } from '../../../base/shared/utils';
|
|
26
|
+
|
|
27
|
+
import { useResizeObserver } from '@vueuse/core';
|
|
28
|
+
|
|
29
|
+
import {
|
|
30
|
+
createMenuContext,
|
|
31
|
+
createSubMenuContext,
|
|
32
|
+
useMenuStyle,
|
|
33
|
+
} from '../hooks';
|
|
34
|
+
import { flattedChildren } from '../utils';
|
|
35
|
+
import SubMenu from './sub-menu.vue';
|
|
36
|
+
|
|
37
|
+
interface Props extends MenuProps {}
|
|
38
|
+
|
|
39
|
+
defineOptions({ name: 'Menu' });
|
|
40
|
+
|
|
41
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
42
|
+
accordion: true,
|
|
43
|
+
collapse: false,
|
|
44
|
+
mode: 'vertical',
|
|
45
|
+
rounded: true,
|
|
46
|
+
theme: 'dark',
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const emit = defineEmits<{
|
|
50
|
+
close: [string, string[]];
|
|
51
|
+
open: [string, string[]];
|
|
52
|
+
select: [string, string[]];
|
|
53
|
+
}>();
|
|
54
|
+
|
|
55
|
+
const { b, is } = useNamespace('menu');
|
|
56
|
+
const menuStyle = useMenuStyle();
|
|
57
|
+
const slots = useSlots();
|
|
58
|
+
const menu = ref<HTMLUListElement>();
|
|
59
|
+
const sliceIndex = ref(-1);
|
|
60
|
+
const openedMenus = ref<MenuProvider['openedMenus']>(
|
|
61
|
+
props.defaultOpeneds && !props.collapse ? [...props.defaultOpeneds] : [],
|
|
62
|
+
);
|
|
63
|
+
const activePath = ref<MenuProvider['activePath']>(props.defaultActive);
|
|
64
|
+
const items = ref<MenuProvider['items']>({});
|
|
65
|
+
const subMenus = ref<MenuProvider['subMenus']>({});
|
|
66
|
+
const mouseInChild = ref(false);
|
|
67
|
+
|
|
68
|
+
const isMenuPopup = computed<MenuProvider['isMenuPopup']>(() => {
|
|
69
|
+
return (
|
|
70
|
+
props.mode === 'horizontal' || (props.mode === 'vertical' && props.collapse)
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const getSlot = computed(() => {
|
|
75
|
+
// 更新插槽内容
|
|
76
|
+
const defaultSlots: VNodeArrayChildren = slots.default?.() ?? [];
|
|
77
|
+
|
|
78
|
+
const originalSlot = flattedChildren(defaultSlots) as VNodeArrayChildren;
|
|
79
|
+
const slotDefault =
|
|
80
|
+
sliceIndex.value === -1
|
|
81
|
+
? originalSlot
|
|
82
|
+
: originalSlot.slice(0, sliceIndex.value);
|
|
83
|
+
|
|
84
|
+
const slotMore =
|
|
85
|
+
sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
|
|
86
|
+
|
|
87
|
+
return { showSlotMore: slotMore.length > 0, slotDefault, slotMore };
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
watch(
|
|
91
|
+
() => props.collapse,
|
|
92
|
+
(value) => {
|
|
93
|
+
if (value) openedMenus.value = [];
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
watch(items.value, initMenu);
|
|
98
|
+
|
|
99
|
+
watch(
|
|
100
|
+
() => props.defaultActive,
|
|
101
|
+
(currentActive = '') => {
|
|
102
|
+
if (!items.value[currentActive]) {
|
|
103
|
+
activePath.value = '';
|
|
104
|
+
}
|
|
105
|
+
updateActiveName(currentActive);
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
let resizeStopper: UseResizeObserverReturn['stop'];
|
|
110
|
+
watchEffect(() => {
|
|
111
|
+
if (props.mode === 'horizontal') {
|
|
112
|
+
resizeStopper = useResizeObserver(menu, handleResize).stop;
|
|
113
|
+
} else {
|
|
114
|
+
resizeStopper?.();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// 注入上下文
|
|
119
|
+
createMenuContext(
|
|
120
|
+
reactive({
|
|
121
|
+
activePath,
|
|
122
|
+
addMenuItem,
|
|
123
|
+
addSubMenu,
|
|
124
|
+
closeMenu,
|
|
125
|
+
handleMenuItemClick,
|
|
126
|
+
handleSubMenuClick,
|
|
127
|
+
isMenuPopup,
|
|
128
|
+
openedMenus,
|
|
129
|
+
openMenu,
|
|
130
|
+
props,
|
|
131
|
+
removeMenuItem,
|
|
132
|
+
removeSubMenu,
|
|
133
|
+
subMenus,
|
|
134
|
+
theme: toRef(props, 'theme'),
|
|
135
|
+
items,
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
createSubMenuContext({
|
|
140
|
+
addSubMenu,
|
|
141
|
+
level: 1,
|
|
142
|
+
mouseInChild,
|
|
143
|
+
removeSubMenu,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
function calcMenuItemWidth(menuItem: HTMLElement) {
|
|
147
|
+
const computedStyle = getComputedStyle(menuItem);
|
|
148
|
+
const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
|
|
149
|
+
const marginRight = Number.parseInt(computedStyle.marginRight, 10);
|
|
150
|
+
return menuItem.offsetWidth + marginLeft + marginRight || 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function calcSliceIndex() {
|
|
154
|
+
if (!menu.value) {
|
|
155
|
+
return -1;
|
|
156
|
+
}
|
|
157
|
+
const items = [...(menu.value?.childNodes ?? [])].filter(
|
|
158
|
+
(item) =>
|
|
159
|
+
// remove comment type node #12634
|
|
160
|
+
item.nodeName !== '#comment' &&
|
|
161
|
+
(item.nodeName !== '#text' || item.nodeValue),
|
|
162
|
+
) as HTMLElement[];
|
|
163
|
+
|
|
164
|
+
const moreItemWidth = 46;
|
|
165
|
+
const computedMenuStyle = getComputedStyle(menu?.value);
|
|
166
|
+
|
|
167
|
+
const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
|
|
168
|
+
const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
|
|
169
|
+
const menuWidth = menu.value?.clientWidth - paddingLeft - paddingRight;
|
|
170
|
+
|
|
171
|
+
let calcWidth = 0;
|
|
172
|
+
let sliceIndex = 0;
|
|
173
|
+
items.forEach((item, index) => {
|
|
174
|
+
calcWidth += calcMenuItemWidth(item);
|
|
175
|
+
if (calcWidth <= menuWidth - moreItemWidth) {
|
|
176
|
+
sliceIndex = index + 1;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
return sliceIndex === items.length ? -1 : sliceIndex;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function debounce(fn: () => void, wait = 33.34) {
|
|
183
|
+
let timer: null | ReturnType<typeof setTimeout>;
|
|
184
|
+
return () => {
|
|
185
|
+
timer && clearTimeout(timer);
|
|
186
|
+
timer = setTimeout(() => {
|
|
187
|
+
fn();
|
|
188
|
+
}, wait);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
let isFirstTimeRender = true;
|
|
193
|
+
function handleResize() {
|
|
194
|
+
if (sliceIndex.value === calcSliceIndex()) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const callback = () => {
|
|
198
|
+
sliceIndex.value = -1;
|
|
199
|
+
nextTick(() => {
|
|
200
|
+
sliceIndex.value = calcSliceIndex();
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
callback();
|
|
204
|
+
// // execute callback directly when first time resize to avoid shaking
|
|
205
|
+
isFirstTimeRender ? callback() : debounce(callback)();
|
|
206
|
+
isFirstTimeRender = false;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function getActivePaths() {
|
|
210
|
+
const activeItem = activePath.value && items.value[activePath.value];
|
|
211
|
+
|
|
212
|
+
if (!activeItem || props.mode === 'horizontal' || props.collapse) {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return activeItem.parentPaths;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// 默认展开菜单
|
|
220
|
+
function initMenu() {
|
|
221
|
+
const parentPaths = getActivePaths();
|
|
222
|
+
|
|
223
|
+
// 展开该菜单项的路径上所有子菜单
|
|
224
|
+
// expand all subMenus of the menu item
|
|
225
|
+
parentPaths.forEach((path) => {
|
|
226
|
+
const subMenu = subMenus.value[path];
|
|
227
|
+
subMenu && openMenu(path, subMenu.parentPaths);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function updateActiveName(val: string) {
|
|
232
|
+
const itemsInData = items.value;
|
|
233
|
+
const item =
|
|
234
|
+
itemsInData[val] ||
|
|
235
|
+
(activePath.value && itemsInData[activePath.value]) ||
|
|
236
|
+
itemsInData[props.defaultActive || ''];
|
|
237
|
+
|
|
238
|
+
activePath.value = item ? item.path : val;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function handleMenuItemClick(data: MenuItemClicked) {
|
|
242
|
+
const { collapse, mode } = props;
|
|
243
|
+
if (mode === 'horizontal' || collapse) {
|
|
244
|
+
openedMenus.value = [];
|
|
245
|
+
}
|
|
246
|
+
const { parentPaths, path } = data;
|
|
247
|
+
if (!path || !parentPaths) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (!isHttpUrl(path)) {
|
|
251
|
+
activePath.value = path;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
emit('select', path, parentPaths);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function handleSubMenuClick({ parentPaths, path }: MenuItemRegistered) {
|
|
258
|
+
const isOpened = openedMenus.value.includes(path);
|
|
259
|
+
|
|
260
|
+
if (isOpened) {
|
|
261
|
+
closeMenu(path, parentPaths);
|
|
262
|
+
} else {
|
|
263
|
+
openMenu(path, parentPaths);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function close(path: string) {
|
|
268
|
+
const i = openedMenus.value.indexOf(path);
|
|
269
|
+
|
|
270
|
+
if (i !== -1) {
|
|
271
|
+
openedMenus.value.splice(i, 1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* 关闭、折叠菜单
|
|
277
|
+
*/
|
|
278
|
+
function closeMenu(path: string, parentPaths: string[]) {
|
|
279
|
+
if (props.accordion) {
|
|
280
|
+
openedMenus.value = subMenus.value[path]?.parentPaths ?? [];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
close(path);
|
|
284
|
+
|
|
285
|
+
emit('close', path, parentPaths);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 点击展开菜单
|
|
290
|
+
*/
|
|
291
|
+
function openMenu(path: string, parentPaths: string[]) {
|
|
292
|
+
if (openedMenus.value.includes(path)) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
// 手风琴模式菜单
|
|
296
|
+
if (props.accordion) {
|
|
297
|
+
const activeParentPaths = getActivePaths();
|
|
298
|
+
if (activeParentPaths.includes(path)) {
|
|
299
|
+
parentPaths = activeParentPaths;
|
|
300
|
+
}
|
|
301
|
+
openedMenus.value = openedMenus.value.filter((path: string) =>
|
|
302
|
+
parentPaths.includes(path),
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
openedMenus.value.push(path);
|
|
306
|
+
emit('open', path, parentPaths);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function addMenuItem(item: MenuItemRegistered) {
|
|
310
|
+
items.value[item.path] = item;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function addSubMenu(subMenu: MenuItemRegistered) {
|
|
314
|
+
subMenus.value[subMenu.path] = subMenu;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function removeSubMenu(subMenu: MenuItemRegistered) {
|
|
318
|
+
Reflect.deleteProperty(subMenus.value, subMenu.path);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function removeMenuItem(item: MenuItemRegistered) {
|
|
322
|
+
Reflect.deleteProperty(items.value, item.path);
|
|
323
|
+
}
|
|
324
|
+
</script>
|
|
325
|
+
<template>
|
|
326
|
+
<ul
|
|
327
|
+
ref="menu"
|
|
328
|
+
:class="[
|
|
329
|
+
theme,
|
|
330
|
+
b(),
|
|
331
|
+
is(mode, true),
|
|
332
|
+
is(theme, true),
|
|
333
|
+
is('rounded', rounded),
|
|
334
|
+
is('collapse', collapse),
|
|
335
|
+
]"
|
|
336
|
+
:style="menuStyle"
|
|
337
|
+
role="menu"
|
|
338
|
+
>
|
|
339
|
+
<template v-if="mode === 'horizontal' && getSlot.showSlotMore">
|
|
340
|
+
<template v-for="item in getSlot.slotDefault" :key="item.key">
|
|
341
|
+
<component :is="item" />
|
|
342
|
+
</template>
|
|
343
|
+
<SubMenu is-sub-menu-more path="sub-menu-more">
|
|
344
|
+
<template #title>
|
|
345
|
+
<Ellipsis class="size-4" />
|
|
346
|
+
</template>
|
|
347
|
+
<template v-for="item in getSlot.slotMore" :key="item.key">
|
|
348
|
+
<component :is="item" />
|
|
349
|
+
</template>
|
|
350
|
+
</SubMenu>
|
|
351
|
+
</template>
|
|
352
|
+
<template v-else>
|
|
353
|
+
<slot></slot>
|
|
354
|
+
</template>
|
|
355
|
+
</ul>
|
|
356
|
+
</template>
|
|
357
|
+
|
|
358
|
+
<style lang="scss">
|
|
359
|
+
$namespace: vben;
|
|
360
|
+
|
|
361
|
+
@mixin menu-item-active {
|
|
362
|
+
color: var(--menu-item-active-color);
|
|
363
|
+
text-decoration: none;
|
|
364
|
+
cursor: pointer;
|
|
365
|
+
background: var(--menu-item-active-background-color);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
@mixin menu-item {
|
|
369
|
+
position: relative;
|
|
370
|
+
display: flex;
|
|
371
|
+
// gap: 12px;
|
|
372
|
+
align-items: center;
|
|
373
|
+
height: var(--menu-item-height);
|
|
374
|
+
padding: var(--menu-item-padding-y) var(--menu-item-padding-x);
|
|
375
|
+
margin: 0 var(--menu-item-margin-x) var(--menu-item-margin-y)
|
|
376
|
+
var(--menu-item-margin-x);
|
|
377
|
+
font-size: var(--menu-font-size);
|
|
378
|
+
color: var(--menu-item-color);
|
|
379
|
+
text-decoration: none;
|
|
380
|
+
white-space: nowrap;
|
|
381
|
+
list-style: none;
|
|
382
|
+
cursor: pointer;
|
|
383
|
+
background: var(--menu-item-background-color);
|
|
384
|
+
border: none;
|
|
385
|
+
border-radius: var(--menu-item-radius);
|
|
386
|
+
transition:
|
|
387
|
+
background 0.15s ease,
|
|
388
|
+
color 0.15s ease,
|
|
389
|
+
padding 0.15s ease,
|
|
390
|
+
border-color 0.15s ease;
|
|
391
|
+
|
|
392
|
+
&.is-disabled {
|
|
393
|
+
cursor: not-allowed;
|
|
394
|
+
background: none !important;
|
|
395
|
+
opacity: 0.25;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.#{$namespace}-menu__icon {
|
|
399
|
+
transition: transform 0.25s;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
&:hover {
|
|
403
|
+
.#{$namespace}-menu__icon {
|
|
404
|
+
transform: scale(1.2);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
&:hover,
|
|
409
|
+
&:focus {
|
|
410
|
+
outline: none;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
* {
|
|
414
|
+
vertical-align: bottom;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
@mixin menu-title {
|
|
419
|
+
max-width: var(--menu-title-width);
|
|
420
|
+
overflow: hidden;
|
|
421
|
+
text-overflow: ellipsis;
|
|
422
|
+
white-space: nowrap;
|
|
423
|
+
opacity: 1;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.#{$namespace}-menu__popup-container,
|
|
427
|
+
.#{$namespace}-menu {
|
|
428
|
+
--menu-title-width: 140px;
|
|
429
|
+
--menu-item-icon-size: 16px;
|
|
430
|
+
--menu-item-height: 38px;
|
|
431
|
+
--menu-item-padding-y: 21px;
|
|
432
|
+
--menu-item-padding-x: 12px;
|
|
433
|
+
--menu-item-popup-padding-y: 20px;
|
|
434
|
+
--menu-item-popup-padding-x: 12px;
|
|
435
|
+
--menu-item-margin-y: 2px;
|
|
436
|
+
--menu-item-margin-x: 0px;
|
|
437
|
+
--menu-item-collapse-padding-y: 23.5px;
|
|
438
|
+
--menu-item-collapse-padding-x: 0px;
|
|
439
|
+
--menu-item-collapse-margin-y: 4px;
|
|
440
|
+
--menu-item-collapse-margin-x: 0px;
|
|
441
|
+
--menu-item-radius: 0px;
|
|
442
|
+
--menu-item-indent: 16px;
|
|
443
|
+
--menu-font-size: 14px;
|
|
444
|
+
|
|
445
|
+
&.is-dark {
|
|
446
|
+
--menu-background-color: hsl(var(--menu));
|
|
447
|
+
// --menu-submenu-opened-background-color: hsl(var(--menu-opened-dark));
|
|
448
|
+
--menu-item-background-color: var(--menu-background-color);
|
|
449
|
+
--menu-item-color: hsl(var(--foreground) / 80%);
|
|
450
|
+
--menu-item-hover-color: hsl(var(--accent-foreground));
|
|
451
|
+
--menu-item-hover-background-color: hsl(var(--accent));
|
|
452
|
+
// 选中:主色实底药丸 + 白字(react antd Menu 基准,design-language.md §4)
|
|
453
|
+
--menu-item-active-color: hsl(var(--primary-foreground));
|
|
454
|
+
--menu-item-active-background-color: hsl(var(--primary));
|
|
455
|
+
--menu-submenu-hover-color: hsl(var(--foreground));
|
|
456
|
+
--menu-submenu-hover-background-color: hsl(var(--accent));
|
|
457
|
+
--menu-submenu-active-color: hsl(var(--foreground));
|
|
458
|
+
--menu-submenu-active-background-color: transparent;
|
|
459
|
+
--menu-submenu-background-color: var(--menu-background-color);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
&.is-light {
|
|
463
|
+
--menu-background-color: hsl(var(--menu));
|
|
464
|
+
// --menu-submenu-opened-background-color: hsl(var(--menu-opened));
|
|
465
|
+
--menu-item-background-color: var(--menu-background-color);
|
|
466
|
+
--menu-item-color: hsl(var(--foreground));
|
|
467
|
+
--menu-item-hover-color: var(--menu-item-color);
|
|
468
|
+
--menu-item-hover-background-color: hsl(var(--accent));
|
|
469
|
+
// 选中:主色实底药丸 + 白字(react antd Menu 基准,design-language.md §4)
|
|
470
|
+
--menu-item-active-color: hsl(var(--primary-foreground));
|
|
471
|
+
--menu-item-active-background-color: hsl(var(--primary));
|
|
472
|
+
--menu-submenu-hover-color: hsl(var(--primary));
|
|
473
|
+
--menu-submenu-hover-background-color: hsl(var(--accent));
|
|
474
|
+
--menu-submenu-active-color: hsl(var(--primary));
|
|
475
|
+
--menu-submenu-active-background-color: transparent;
|
|
476
|
+
--menu-submenu-background-color: var(--menu-background-color);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
&.is-rounded {
|
|
480
|
+
--menu-item-margin-x: 8px;
|
|
481
|
+
--menu-item-collapse-margin-x: 6px;
|
|
482
|
+
--menu-item-radius: 8px;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
&.is-horizontal:not(.is-rounded) {
|
|
486
|
+
--menu-item-height: 40px;
|
|
487
|
+
--menu-item-radius: 6px;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
&.is-horizontal.is-rounded {
|
|
491
|
+
--menu-item-height: 40px;
|
|
492
|
+
--menu-item-radius: 6px;
|
|
493
|
+
--menu-item-padding-x: 12px;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// .vben-menu__popup,
|
|
497
|
+
&.is-horizontal {
|
|
498
|
+
--menu-item-padding-y: 0px;
|
|
499
|
+
--menu-item-padding-x: 10px;
|
|
500
|
+
--menu-item-margin-y: 0px;
|
|
501
|
+
--menu-item-margin-x: 1px;
|
|
502
|
+
--menu-background-color: transparent;
|
|
503
|
+
|
|
504
|
+
&.is-dark {
|
|
505
|
+
--menu-item-hover-color: hsl(var(--accent-foreground));
|
|
506
|
+
--menu-item-hover-background-color: hsl(var(--accent));
|
|
507
|
+
--menu-item-active-color: hsl(var(--accent-foreground));
|
|
508
|
+
--menu-item-active-background-color: hsl(var(--accent));
|
|
509
|
+
--menu-submenu-active-color: hsl(var(--foreground));
|
|
510
|
+
--menu-submenu-active-background-color: hsl(var(--accent));
|
|
511
|
+
--menu-submenu-hover-color: hsl(var(--accent-foreground));
|
|
512
|
+
--menu-submenu-hover-background-color: hsl(var(--accent));
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
&.is-light {
|
|
516
|
+
--menu-item-active-color: hsl(var(--primary));
|
|
517
|
+
--menu-item-active-background-color: hsl(var(--primary) / 15%);
|
|
518
|
+
--menu-item-hover-background-color: hsl(var(--accent));
|
|
519
|
+
--menu-item-hover-color: hsl(var(--primary));
|
|
520
|
+
--menu-submenu-active-color: hsl(var(--primary));
|
|
521
|
+
--menu-submenu-active-background-color: hsl(var(--primary) / 15%);
|
|
522
|
+
--menu-submenu-hover-color: hsl(var(--primary));
|
|
523
|
+
--menu-submenu-hover-background-color: hsl(var(--accent));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.#{$namespace}-menu {
|
|
529
|
+
position: relative;
|
|
530
|
+
box-sizing: border-box;
|
|
531
|
+
padding-left: 0;
|
|
532
|
+
margin: 0;
|
|
533
|
+
list-style: none;
|
|
534
|
+
background: hsl(var(--menu-background-color));
|
|
535
|
+
|
|
536
|
+
// 垂直菜单
|
|
537
|
+
&.is-vertical {
|
|
538
|
+
&:not(.#{$namespace}-menu.is-collapse) {
|
|
539
|
+
& .#{$namespace}-menu-item,
|
|
540
|
+
& .#{$namespace}-sub-menu-content,
|
|
541
|
+
& .#{$namespace}-menu-item-group__title {
|
|
542
|
+
padding-left: calc(
|
|
543
|
+
var(--menu-item-indent) + var(--menu-level) * var(--menu-item-indent)
|
|
544
|
+
);
|
|
545
|
+
white-space: nowrap;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
& > .#{$namespace}-sub-menu {
|
|
549
|
+
& > .#{$namespace}-menu {
|
|
550
|
+
& > .#{$namespace}-menu-item {
|
|
551
|
+
padding-left: calc(
|
|
552
|
+
0px + var(--menu-item-indent) + var(--menu-level) *
|
|
553
|
+
var(--menu-item-indent)
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
& > .#{$namespace}-sub-menu-content {
|
|
559
|
+
padding-left: calc(var(--menu-item-indent) - 8px);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
& > .#{$namespace}-menu-item {
|
|
563
|
+
padding-left: calc(var(--menu-item-indent) - 8px);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
&.is-horizontal {
|
|
569
|
+
display: flex;
|
|
570
|
+
flex-wrap: nowrap;
|
|
571
|
+
max-width: 100%;
|
|
572
|
+
height: var(--height-horizontal-height);
|
|
573
|
+
border-right: none;
|
|
574
|
+
|
|
575
|
+
.#{$namespace}-menu-item {
|
|
576
|
+
display: inline-flex;
|
|
577
|
+
align-items: center;
|
|
578
|
+
justify-content: center;
|
|
579
|
+
height: var(--menu-item-height);
|
|
580
|
+
padding-right: calc(var(--menu-item-padding-x) + 6px);
|
|
581
|
+
margin: 0;
|
|
582
|
+
margin-right: 2px;
|
|
583
|
+
// border-bottom: 2px solid transparent;
|
|
584
|
+
border-radius: var(--menu-item-radius);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
& > .#{$namespace}-sub-menu {
|
|
588
|
+
height: var(--menu-item-height);
|
|
589
|
+
margin-right: 2px;
|
|
590
|
+
|
|
591
|
+
&:focus,
|
|
592
|
+
&:hover {
|
|
593
|
+
outline: none;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
& .#{$namespace}-sub-menu-content {
|
|
597
|
+
height: 100%;
|
|
598
|
+
padding-right: 40px;
|
|
599
|
+
// border-bottom: 2px solid transparent;
|
|
600
|
+
border-radius: var(--menu-item-radius);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
& .#{$namespace}-menu-item:not(.is-disabled):hover,
|
|
605
|
+
& .#{$namespace}-menu-item:not(.is-disabled):focus {
|
|
606
|
+
outline: none;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
& > .#{$namespace}-menu-item.is-active {
|
|
610
|
+
color: var(--menu-item-active-color);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// &.is-light {
|
|
614
|
+
// & > .#{$namespace}-sub-menu {
|
|
615
|
+
// &.is-active {
|
|
616
|
+
// border-bottom: 2px solid var(--menu-item-active-color);
|
|
617
|
+
// }
|
|
618
|
+
// &:not(.is-active) .#{$namespace}-sub-menu-content {
|
|
619
|
+
// &:hover {
|
|
620
|
+
// border-bottom: 2px solid var(--menu-item-active-color);
|
|
621
|
+
// }
|
|
622
|
+
// }
|
|
623
|
+
// }
|
|
624
|
+
// & > .#{$namespace}-menu-item.is-active {
|
|
625
|
+
// border-bottom: 2px solid var(--menu-item-active-color);
|
|
626
|
+
// }
|
|
627
|
+
|
|
628
|
+
// & .#{$namespace}-menu-item:not(.is-disabled):hover,
|
|
629
|
+
// & .#{$namespace}-menu-item:not(.is-disabled):focus {
|
|
630
|
+
// border-bottom: 2px solid var(--menu-item-active-color);
|
|
631
|
+
// }
|
|
632
|
+
// }
|
|
633
|
+
}
|
|
634
|
+
// 折叠菜单
|
|
635
|
+
|
|
636
|
+
&.is-collapse {
|
|
637
|
+
.#{$namespace}-menu__icon {
|
|
638
|
+
margin-right: 0;
|
|
639
|
+
}
|
|
640
|
+
.#{$namespace}-sub-menu__icon-arrow {
|
|
641
|
+
display: none;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.#{$namespace}-sub-menu-content,
|
|
645
|
+
.#{$namespace}-menu-item {
|
|
646
|
+
display: flex;
|
|
647
|
+
align-items: center;
|
|
648
|
+
justify-content: center;
|
|
649
|
+
padding: var(--menu-item-collapse-padding-y)
|
|
650
|
+
var(--menu-item-collapse-padding-x);
|
|
651
|
+
margin: var(--menu-item-collapse-margin-y)
|
|
652
|
+
var(--menu-item-collapse-margin-x);
|
|
653
|
+
transition: all 0.3s;
|
|
654
|
+
|
|
655
|
+
&.is-active {
|
|
656
|
+
// 收起态激活(含父级 sub-menu-content):主色实底药丸 + 白字(design-language.md §4)。
|
|
657
|
+
// color 缺失时 sub-menu-content 会落回 --menu-submenu-active-color(is-light 下同为
|
|
658
|
+
// 主色),蓝底蓝字图标隐形;!important 对齐上方 background 的覆盖强度。
|
|
659
|
+
color: hsl(var(--primary-foreground)) !important;
|
|
660
|
+
background: var(--menu-item-active-background-color) !important;
|
|
661
|
+
border-radius: var(--menu-item-radius);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
&.is-light {
|
|
666
|
+
.#{$namespace}-sub-menu-content,
|
|
667
|
+
.#{$namespace}-menu-item {
|
|
668
|
+
&.is-active {
|
|
669
|
+
background: var(--menu-item-active-background-color) !important;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
&.is-rounded {
|
|
675
|
+
.#{$namespace}-sub-menu-content,
|
|
676
|
+
.#{$namespace}-menu-item {
|
|
677
|
+
&.is-collapse-show-title {
|
|
678
|
+
// padding: 32px 0 !important;
|
|
679
|
+
margin: 4px 8px !important;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
&__popup-container {
|
|
686
|
+
max-width: 240px;
|
|
687
|
+
height: unset;
|
|
688
|
+
padding: 0;
|
|
689
|
+
background: var(--menu-background-color);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
&__popup {
|
|
693
|
+
padding: 10px 0;
|
|
694
|
+
border-radius: var(--menu-item-radius);
|
|
695
|
+
|
|
696
|
+
.#{$namespace}-sub-menu-content,
|
|
697
|
+
.#{$namespace}-menu-item {
|
|
698
|
+
padding: var(--menu-item-popup-padding-y) var(--menu-item-popup-padding-x);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
&__icon {
|
|
703
|
+
flex-shrink: 0;
|
|
704
|
+
width: var(--menu-item-icon-size);
|
|
705
|
+
height: var(--menu-item-icon-size);
|
|
706
|
+
margin-right: 8px;
|
|
707
|
+
text-align: center;
|
|
708
|
+
vertical-align: middle;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
.#{$namespace}-menu-item {
|
|
713
|
+
fill: var(--menu-item-color);
|
|
714
|
+
|
|
715
|
+
@include menu-item;
|
|
716
|
+
|
|
717
|
+
&.is-active {
|
|
718
|
+
fill: var(--menu-item-active-color);
|
|
719
|
+
|
|
720
|
+
@include menu-item-active;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
&__content {
|
|
724
|
+
display: inline-flex;
|
|
725
|
+
align-items: center;
|
|
726
|
+
width: 100%;
|
|
727
|
+
height: var(--menu-item-height);
|
|
728
|
+
|
|
729
|
+
span {
|
|
730
|
+
@include menu-title;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
&.is-collapse-show-title {
|
|
735
|
+
padding: 32px 0 !important;
|
|
736
|
+
// margin: 4px 8px !important;
|
|
737
|
+
.#{$namespace}-menu-tooltip__trigger {
|
|
738
|
+
flex-direction: column;
|
|
739
|
+
}
|
|
740
|
+
.#{$namespace}-menu__icon {
|
|
741
|
+
display: block;
|
|
742
|
+
font-size: 20px !important;
|
|
743
|
+
transition: all 0.25s ease;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
.#{$namespace}-menu__name {
|
|
747
|
+
display: inline-flex;
|
|
748
|
+
margin-top: 8px;
|
|
749
|
+
margin-bottom: 0;
|
|
750
|
+
font-size: 12px;
|
|
751
|
+
font-weight: 400;
|
|
752
|
+
line-height: normal;
|
|
753
|
+
transition: all 0.25s ease;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
&:not(.is-active):hover {
|
|
758
|
+
color: var(--menu-item-hover-color);
|
|
759
|
+
text-decoration: none;
|
|
760
|
+
cursor: pointer;
|
|
761
|
+
background: var(--menu-item-hover-background-color) !important;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
.#{$namespace}-menu-tooltip__trigger {
|
|
765
|
+
position: absolute;
|
|
766
|
+
top: 0;
|
|
767
|
+
left: 0;
|
|
768
|
+
box-sizing: border-box;
|
|
769
|
+
display: inline-flex;
|
|
770
|
+
align-items: center;
|
|
771
|
+
justify-content: center;
|
|
772
|
+
width: 100%;
|
|
773
|
+
height: 100%;
|
|
774
|
+
padding: 0 var(--menu-item-padding-x);
|
|
775
|
+
font-size: var(--menu-font-size);
|
|
776
|
+
line-height: var(--menu-item-height);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
.#{$namespace}-sub-menu {
|
|
781
|
+
padding-left: 0;
|
|
782
|
+
margin: 0;
|
|
783
|
+
list-style: none;
|
|
784
|
+
background: var(--menu-submenu-background-color);
|
|
785
|
+
fill: var(--menu-item-color);
|
|
786
|
+
|
|
787
|
+
&.is-active {
|
|
788
|
+
div[data-state='open'] > .#{$namespace}-sub-menu-content,
|
|
789
|
+
> .#{$namespace}-sub-menu-content {
|
|
790
|
+
// font-weight: 500;
|
|
791
|
+
color: var(--menu-submenu-active-color);
|
|
792
|
+
text-decoration: none;
|
|
793
|
+
cursor: pointer;
|
|
794
|
+
background: var(--menu-submenu-active-background-color);
|
|
795
|
+
fill: var(--menu-submenu-active-color);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
.#{$namespace}-sub-menu-content {
|
|
801
|
+
height: var(--menu-item-height);
|
|
802
|
+
|
|
803
|
+
@include menu-item;
|
|
804
|
+
|
|
805
|
+
&__icon-arrow {
|
|
806
|
+
position: absolute;
|
|
807
|
+
top: 50%;
|
|
808
|
+
right: 10px;
|
|
809
|
+
width: inherit;
|
|
810
|
+
margin-top: -8px;
|
|
811
|
+
margin-right: 0;
|
|
812
|
+
// font-size: 16px;
|
|
813
|
+
font-weight: normal;
|
|
814
|
+
opacity: 1;
|
|
815
|
+
transition: transform 0.25s ease;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
&__title {
|
|
819
|
+
@include menu-title;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
&.is-collapse-show-title {
|
|
823
|
+
flex-direction: column;
|
|
824
|
+
padding: 32px 0 !important;
|
|
825
|
+
// margin: 4px 8px !important;
|
|
826
|
+
.#{$namespace}-menu__icon {
|
|
827
|
+
display: block;
|
|
828
|
+
font-size: 20px !important;
|
|
829
|
+
transition: all 0.25s ease;
|
|
830
|
+
}
|
|
831
|
+
.#{$namespace}-sub-menu-content__title {
|
|
832
|
+
display: inline-flex;
|
|
833
|
+
flex-shrink: 0;
|
|
834
|
+
margin-top: 8px;
|
|
835
|
+
margin-bottom: 0;
|
|
836
|
+
font-size: 12px;
|
|
837
|
+
font-weight: 400;
|
|
838
|
+
line-height: normal;
|
|
839
|
+
transition: all 0.25s ease;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
&.is-more {
|
|
844
|
+
padding-right: 12px !important;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
// &:not(.is-active):hover {
|
|
848
|
+
&:hover {
|
|
849
|
+
color: var(--menu-submenu-hover-color);
|
|
850
|
+
text-decoration: none;
|
|
851
|
+
cursor: pointer;
|
|
852
|
+
background: var(--menu-submenu-hover-background-color) !important;
|
|
853
|
+
|
|
854
|
+
// svg {
|
|
855
|
+
// fill: var(--menu-submenu-hover-color);
|
|
856
|
+
// }
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
</style>
|