@clownlee/menu 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @fly/menu
2
+
3
+ 菜单管理能力,提供微应用的菜单结构管理功能
4
+
5
+ ## 开发
6
+ - `pnpm install`
7
+ - `pnpm build`(库模式,产物位于 dist/,CSS 已内联)
8
+
9
+ ## 目录
10
+ - src/ 源码
11
+ - src/types/ 类型声明
12
+ - src/styles/ 样式
13
+ - .cursor/rules/ 规范
14
+
15
+ ## 规范
16
+ - 依赖使用外部化(Vue/Element Plus/Pinia)
17
+ - CSS 通过 vite-plugin-css-injected-by-js 内联
@@ -0,0 +1,82 @@
1
+ interface MenuTreeModel {
2
+ menuId: string;
3
+ menuName?: string;
4
+ menuCode?: string;
5
+ menuPath?: string;
6
+ menuIcon?: string;
7
+ menuType?: string;
8
+ sortOrder?: number;
9
+ level?: number;
10
+ hasChildren?: boolean;
11
+ appId?: string;
12
+ appName?: string;
13
+ appIcon?: string;
14
+ appUri?: string;
15
+ appUrl?: string;
16
+ appApi?: string;
17
+ children?: MenuTreeModel[];
18
+ }
19
+ interface Props {
20
+ /** 菜单树数据 */
21
+ menuTree?: MenuTreeModel[];
22
+ /** 当前激活的菜单ID */
23
+ activeMenuId?: string;
24
+ /** 展开的一级菜单keys */
25
+ expandedFirstLevelKeys?: string[];
26
+ /** 用户角色 */
27
+ userRole?: string;
28
+ /** 是否显示通知图标 */
29
+ showNotification?: boolean;
30
+ /** 通知数量 */
31
+ notificationCount?: number;
32
+ }
33
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
34
+ menuTree: () => never[];
35
+ activeMenuId: string;
36
+ expandedFirstLevelKeys: () => never[];
37
+ userRole: string;
38
+ showNotification: boolean;
39
+ notificationCount: number;
40
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
41
+ "first-level-click": (payload: {
42
+ menu: MenuTreeModel;
43
+ }) => void;
44
+ "all-apps-click": () => void;
45
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
46
+ menuTree: () => never[];
47
+ activeMenuId: string;
48
+ expandedFirstLevelKeys: () => never[];
49
+ userRole: string;
50
+ showNotification: boolean;
51
+ notificationCount: number;
52
+ }>>> & Readonly<{
53
+ "onFirst-level-click"?: ((payload: {
54
+ menu: MenuTreeModel;
55
+ }) => any) | undefined;
56
+ "onAll-apps-click"?: (() => any) | undefined;
57
+ }>, {
58
+ menuTree: MenuTreeModel[];
59
+ activeMenuId: string;
60
+ expandedFirstLevelKeys: string[];
61
+ userRole: string;
62
+ showNotification: boolean;
63
+ notificationCount: number;
64
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
65
+ export default _default;
66
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
67
+ type __VLS_TypePropsToRuntimeProps<T> = {
68
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
69
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
70
+ } : {
71
+ type: import('vue').PropType<T[K]>;
72
+ required: true;
73
+ };
74
+ };
75
+ type __VLS_WithDefaults<P, D> = {
76
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
77
+ default: D[K];
78
+ }> : P[K];
79
+ };
80
+ type __VLS_Prettify<T> = {
81
+ [K in keyof T]: T[K];
82
+ } & {};
@@ -0,0 +1,98 @@
1
+ import { Component } from 'vue';
2
+
3
+ type ObjectFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
4
+ interface Props {
5
+ /** 头像图片的源地址 */
6
+ src?: string;
7
+ /** 头像大小,支持 number 或 'large' | 'default' | 'small' */
8
+ size?: number | 'large' | 'default' | 'small';
9
+ /** 头像形状,'circle' 圆形或 'square' 方形 */
10
+ shape?: 'circle' | 'square';
11
+ /** 设置头像的图标类型,具体参考 Icon 组件 */
12
+ icon?: string | Component;
13
+ /** 当展示类型为图片时,设置图片如何适应容器,与 object-fit 属性一致 */
14
+ fit?: ObjectFit;
15
+ /** 图片 Avatar 的原生 alt 属性 */
16
+ alt?: string;
17
+ /** 文字内容,当没有 src 和 icon 时显示 */
18
+ text?: string;
19
+ /** 是否显示 Popover 菜单 */
20
+ showPopover?: boolean;
21
+ /** Popover 触发方式 */
22
+ trigger?: 'click' | 'hover' | 'focus';
23
+ /** Popover 宽度 */
24
+ popoverWidth?: number;
25
+ /** 用户姓名 */
26
+ userName?: string;
27
+ /** 租户编码 */
28
+ tenantCode?: string;
29
+ /** 是否显示个人中心菜单项 */
30
+ showProfile?: boolean;
31
+ /** 是否显示设置菜单项 */
32
+ showSettings?: boolean;
33
+ }
34
+ declare function __VLS_template(): {
35
+ default?(_: {}): any;
36
+ };
37
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
38
+ size: string;
39
+ shape: string;
40
+ fit: string;
41
+ showPopover: boolean;
42
+ trigger: string;
43
+ popoverWidth: number;
44
+ showProfile: boolean;
45
+ showSettings: boolean;
46
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
47
+ error: () => void;
48
+ profile: () => void;
49
+ settings: () => void;
50
+ logout: () => void;
51
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
52
+ size: string;
53
+ shape: string;
54
+ fit: string;
55
+ showPopover: boolean;
56
+ trigger: string;
57
+ popoverWidth: number;
58
+ showProfile: boolean;
59
+ showSettings: boolean;
60
+ }>>> & Readonly<{
61
+ onError?: (() => any) | undefined;
62
+ onProfile?: (() => any) | undefined;
63
+ onSettings?: (() => any) | undefined;
64
+ onLogout?: (() => any) | undefined;
65
+ }>, {
66
+ size: number | "large" | "default" | "small";
67
+ shape: "circle" | "square";
68
+ fit: ObjectFit;
69
+ showPopover: boolean;
70
+ trigger: "click" | "hover" | "focus";
71
+ popoverWidth: number;
72
+ showProfile: boolean;
73
+ showSettings: boolean;
74
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
75
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
76
+ export default _default;
77
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
78
+ type __VLS_TypePropsToRuntimeProps<T> = {
79
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
80
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
81
+ } : {
82
+ type: import('vue').PropType<T[K]>;
83
+ required: true;
84
+ };
85
+ };
86
+ type __VLS_WithDefaults<P, D> = {
87
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
88
+ default: D[K];
89
+ }> : P[K];
90
+ };
91
+ type __VLS_Prettify<T> = {
92
+ [K in keyof T]: T[K];
93
+ } & {};
94
+ type __VLS_WithTemplateSlots<T, S> = T & {
95
+ new (): {
96
+ $slots: S;
97
+ };
98
+ };
@@ -0,0 +1,5 @@
1
+ import { default as Avatar } from './avatar/index.vue';
2
+ import { default as AppMenu } from './app-menu/index.vue';
3
+ import { default as RouteMenu } from './route-menu/index.vue';
4
+
5
+ export { Avatar, AppMenu, RouteMenu };