@mtn-ui/components 1.0.8 → 1.0.9

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.
Files changed (44) hide show
  1. package/dist/antd-wrapped/action-group/action-group.vue.js +2 -2
  2. package/dist/antd-wrapped/action-group/action-group.vue2.js +244 -213
  3. package/dist/components.css +1 -1
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.mjs +431 -400
  6. package/dist/types/index.d.ts +18 -0
  7. package/dist/types/packages/components/src/_utils/__tests__/filterMenuByPermission.test.d.ts +1 -0
  8. package/dist/types/packages/components/src/_utils/__tests__/usePermission.test.d.ts +1 -0
  9. package/dist/types/packages/components/src/_utils/constants.d.ts +7 -0
  10. package/dist/types/packages/components/src/_utils/filterMenuByPermission.d.ts +14 -0
  11. package/dist/types/packages/components/src/_utils/index.d.ts +7 -0
  12. package/dist/types/packages/components/src/_utils/types.d.ts +7 -0
  13. package/dist/types/packages/components/src/_utils/usePermission.d.ts +29 -0
  14. package/dist/types/packages/components/src/antd-wrapped/action-group/__tests__/action-group.test.d.ts +1 -0
  15. package/dist/types/packages/components/src/antd-wrapped/action-group/index.d.ts +4 -0
  16. package/dist/types/packages/components/src/antd-wrapped/action-group/props.d.ts +91 -0
  17. package/dist/types/packages/components/src/antd-wrapped/action-group/types.d.ts +110 -0
  18. package/dist/types/packages/components/src/antd-wrapped/action-group/utils.d.ts +17 -0
  19. package/dist/types/packages/components/src/antd-wrapped/button/__tests__/button.test.d.ts +1 -0
  20. package/dist/types/packages/components/src/antd-wrapped/button/button.d.ts +112 -0
  21. package/dist/types/packages/components/src/antd-wrapped/button/index.d.ts +5 -0
  22. package/dist/types/packages/components/src/antd-wrapped/button/props.d.ts +55 -0
  23. package/dist/types/packages/components/src/antd-wrapped/button/types.d.ts +38 -0
  24. package/dist/types/packages/components/src/antd-wrapped/button-group/button-group.d.ts +50 -0
  25. package/dist/types/packages/components/src/antd-wrapped/button-group/index.d.ts +5 -0
  26. package/dist/types/packages/components/src/antd-wrapped/button-group/props.d.ts +28 -0
  27. package/dist/types/packages/components/src/antd-wrapped/delete-button/__tests__/delete-button.test.d.ts +1 -0
  28. package/dist/types/packages/components/src/antd-wrapped/delete-button/index.d.ts +2 -0
  29. package/dist/types/packages/components/src/antd-wrapped/delete-button/props.d.ts +122 -0
  30. package/dist/types/packages/components/src/antd-wrapped/dropdown-button/__tests__/dropdown-button.test.d.ts +1 -0
  31. package/dist/types/packages/components/src/antd-wrapped/dropdown-button/dropdown-button.d.ts +106 -0
  32. package/dist/types/packages/components/src/antd-wrapped/dropdown-button/index.d.ts +5 -0
  33. package/dist/types/packages/components/src/antd-wrapped/dropdown-button/props.d.ts +49 -0
  34. package/dist/types/packages/components/src/antd-wrapped/dropdown-button/types.d.ts +36 -0
  35. package/dist/types/packages/components/src/antd-wrapped/index.d.ts +10 -0
  36. package/dist/types/packages/components/src/antd-wrapped/table/index.d.ts +4 -0
  37. package/dist/types/packages/components/src/antd-wrapped/table/table.d.ts +128 -0
  38. package/dist/types/packages/components/src/data-display/index.d.ts +5 -0
  39. package/dist/types/packages/components/src/data-display/tag/__tests__/tag.test.d.ts +1 -0
  40. package/dist/types/packages/components/src/data-display/tag/index.d.ts +21 -0
  41. package/dist/types/packages/components/src/data-display/tag/props.d.ts +11 -0
  42. package/dist/types/packages/components/src/data-display/tag/tag.d.ts +20 -0
  43. package/dist/types/packages/components/src/index.d.ts +18 -0
  44. package/package.json +1 -1
@@ -0,0 +1,122 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ import { ButtonProps } from '../button/props';
3
+ export declare const deleteButtonProps: {
4
+ loading: {
5
+ type: BooleanConstructor;
6
+ default: undefined;
7
+ };
8
+ /** 确认提示文本(支持函数,动态生成) */
9
+ confirm: {
10
+ type: PropType<string | false | ((count?: number) => string)>;
11
+ default: string;
12
+ };
13
+ /** 确认类型:modal-弹窗确认,popconfirm-气泡确认 */
14
+ confirmType: {
15
+ type: PropType<"modal" | "popconfirm">;
16
+ default: string;
17
+ };
18
+ /** Modal 标题 */
19
+ confirmTitle: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ /** 确认按钮文本 */
24
+ okText: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ };
28
+ /** 取消按钮文本 */
29
+ cancelText: {
30
+ type: StringConstructor;
31
+ default: string;
32
+ };
33
+ /** 是否隐藏图标 */
34
+ hideIcon: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ /** 是否自动处理 Loading(推荐开启) */
39
+ autoLoading: {
40
+ type: BooleanConstructor;
41
+ default: boolean;
42
+ };
43
+ /** 删除前验证函数,返回 false 或 Promise<false> 可阻止删除 */
44
+ beforeDelete: {
45
+ type: PropType<() => boolean | Promise<boolean>>;
46
+ default: undefined;
47
+ };
48
+ /** 删除数量(用于批量删除提示) */
49
+ count: {
50
+ type: NumberConstructor;
51
+ default: number;
52
+ };
53
+ /** 是否显示成功提示 */
54
+ showSuccess: {
55
+ type: BooleanConstructor;
56
+ default: boolean;
57
+ };
58
+ /** 成功提示文本 */
59
+ successText: {
60
+ type: StringConstructor;
61
+ default: string;
62
+ };
63
+ /** 是否显示错误提示 */
64
+ showError: {
65
+ type: BooleanConstructor;
66
+ default: boolean;
67
+ };
68
+ /** 防抖延迟(ms),0 表示不防抖 */
69
+ debounce: {
70
+ type: NumberConstructor;
71
+ default: number;
72
+ };
73
+ /** 删除事件处理函数(用于 ActionGroup Config API) */
74
+ onDelete: {
75
+ type: PropType<(done: () => void) => void | Promise<void>>;
76
+ default: undefined;
77
+ };
78
+ type: {
79
+ type: PropType<"primary" | "default" | "dashed" | "text" | "link">;
80
+ default: string;
81
+ };
82
+ size: {
83
+ type: PropType<"small" | "middle" | "large">;
84
+ default: string;
85
+ };
86
+ disabled: {
87
+ type: BooleanConstructor;
88
+ default: boolean;
89
+ };
90
+ danger: {
91
+ type: BooleanConstructor;
92
+ default: boolean;
93
+ };
94
+ block: {
95
+ type: BooleanConstructor;
96
+ default: boolean;
97
+ };
98
+ ghost: {
99
+ type: BooleanConstructor;
100
+ default: boolean;
101
+ };
102
+ shape: {
103
+ type: PropType<"default" | "circle" | "round">;
104
+ default: string;
105
+ };
106
+ htmlType: {
107
+ type: PropType<"button" | "submit" | "reset">;
108
+ default: string;
109
+ };
110
+ icon: {
111
+ type: PropType<any>;
112
+ };
113
+ permission: {
114
+ type: PropType<string | string[]>;
115
+ default: undefined;
116
+ };
117
+ permissionAction: {
118
+ type: PropType<"hide" | "disable">;
119
+ default: string;
120
+ };
121
+ };
122
+ export type DeleteButtonProps = ExtractPropTypes<typeof deleteButtonProps> & Partial<ButtonProps>;
@@ -0,0 +1,106 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ text: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ type: {
7
+ type: import('vue').PropType<"primary" | "default" | "dashed" | "text" | "link">;
8
+ default: string;
9
+ };
10
+ size: {
11
+ type: import('vue').PropType<"large" | "middle" | "small">;
12
+ default: string;
13
+ };
14
+ menu: {
15
+ type: import('vue').PropType<import('ant-design-vue').MenuProps["items"]>;
16
+ default: undefined;
17
+ };
18
+ disabled: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ loading: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
26
+ danger: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ placement: {
31
+ type: import('vue').PropType<"bottom" | "bottomLeft" | "bottomRight" | "top" | "topLeft" | "topRight">;
32
+ default: string;
33
+ };
34
+ trigger: {
35
+ type: import('vue').PropType<("click" | "hover" | "contextmenu")[]>;
36
+ default: () => string[];
37
+ };
38
+ permission: {
39
+ type: import('vue').PropType<string | string[]>;
40
+ default: undefined;
41
+ };
42
+ permissionAction: {
43
+ type: import('vue').PropType<"hide" | "disable">;
44
+ default: string;
45
+ };
46
+ }>, () => import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "click"[], "click", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
47
+ text: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
51
+ type: {
52
+ type: import('vue').PropType<"primary" | "default" | "dashed" | "text" | "link">;
53
+ default: string;
54
+ };
55
+ size: {
56
+ type: import('vue').PropType<"large" | "middle" | "small">;
57
+ default: string;
58
+ };
59
+ menu: {
60
+ type: import('vue').PropType<import('ant-design-vue').MenuProps["items"]>;
61
+ default: undefined;
62
+ };
63
+ disabled: {
64
+ type: BooleanConstructor;
65
+ default: boolean;
66
+ };
67
+ loading: {
68
+ type: BooleanConstructor;
69
+ default: boolean;
70
+ };
71
+ danger: {
72
+ type: BooleanConstructor;
73
+ default: boolean;
74
+ };
75
+ placement: {
76
+ type: import('vue').PropType<"bottom" | "bottomLeft" | "bottomRight" | "top" | "topLeft" | "topRight">;
77
+ default: string;
78
+ };
79
+ trigger: {
80
+ type: import('vue').PropType<("click" | "hover" | "contextmenu")[]>;
81
+ default: () => string[];
82
+ };
83
+ permission: {
84
+ type: import('vue').PropType<string | string[]>;
85
+ default: undefined;
86
+ };
87
+ permissionAction: {
88
+ type: import('vue').PropType<"hide" | "disable">;
89
+ default: string;
90
+ };
91
+ }>> & Readonly<{
92
+ onClick?: ((...args: any[]) => any) | undefined;
93
+ }>, {
94
+ type: "default" | "link" | "text" | "primary" | "dashed";
95
+ menu: import('ant-design-vue').ItemType[] | undefined;
96
+ text: string;
97
+ size: "small" | "middle" | "large";
98
+ loading: boolean;
99
+ disabled: boolean;
100
+ danger: boolean;
101
+ permission: string | string[];
102
+ permissionAction: "hide" | "disable";
103
+ placement: "bottom" | "bottomLeft" | "bottomRight" | "top" | "topLeft" | "topRight";
104
+ trigger: ("click" | "hover" | "contextmenu")[];
105
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
106
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { default as DropdownButton } from './dropdown-button';
2
+ import { DropdownButtonProps } from './props';
3
+ import { MenuItemWithPermission, MenuWithPermission } from './types';
4
+ export { DropdownButton, type DropdownButtonProps, type MenuItemWithPermission, type MenuWithPermission };
5
+ export default DropdownButton;
@@ -0,0 +1,49 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ import { MenuProps } from 'ant-design-vue';
3
+ export declare const dropdownButtonProps: {
4
+ text: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ type: {
9
+ type: PropType<"primary" | "default" | "dashed" | "text" | "link">;
10
+ default: string;
11
+ };
12
+ size: {
13
+ type: PropType<"large" | "middle" | "small">;
14
+ default: string;
15
+ };
16
+ menu: {
17
+ type: PropType<MenuProps["items"]>;
18
+ default: undefined;
19
+ };
20
+ disabled: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ loading: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ danger: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ placement: {
33
+ type: PropType<"bottom" | "bottomLeft" | "bottomRight" | "top" | "topLeft" | "topRight">;
34
+ default: string;
35
+ };
36
+ trigger: {
37
+ type: PropType<("click" | "hover" | "contextmenu")[]>;
38
+ default: () => string[];
39
+ };
40
+ permission: {
41
+ type: PropType<string | string[]>;
42
+ default: undefined;
43
+ };
44
+ permissionAction: {
45
+ type: PropType<"hide" | "disable">;
46
+ default: string;
47
+ };
48
+ };
49
+ export type DropdownButtonProps = ExtractPropTypes<typeof dropdownButtonProps>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * 扩展的菜单项类型,支持权限控制
3
+ * 基于 Ant Design Vue 的 MenuProps['items'],添加权限相关属性
4
+ */
5
+ export interface MenuItemWithPermission {
6
+ /** 菜单项唯一标识 */
7
+ key?: string;
8
+ /** 菜单项文本 */
9
+ label?: string;
10
+ /** 菜单项图标 */
11
+ icon?: any;
12
+ /** 是否禁用 */
13
+ disabled?: boolean;
14
+ /** 是否危险样式 */
15
+ danger?: boolean;
16
+ /** 点击事件 */
17
+ onClick?: (info?: any) => void;
18
+ /** 菜单项类型(用于分割线) */
19
+ type?: "divider";
20
+ /**
21
+ * 权限码(支持单个或多个,满足任一即可)
22
+ * @example 'user:add'
23
+ * @example ['admin', 'user:manage']
24
+ */
25
+ permission?: string | string[];
26
+ /**
27
+ * 无权限时的行为
28
+ * - 'hide'(默认):隐藏菜单项
29
+ * - 'disable':禁用菜单项(灰色显示但可见)
30
+ */
31
+ permissionAction?: "hide" | "disable";
32
+ }
33
+ /**
34
+ * 扩展的菜单配置类型(数组形式)
35
+ */
36
+ export type MenuWithPermission = MenuItemWithPermission[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Ant Design Vue 封装组件
3
+ * 这些组件基于 Ant Design Vue 二次封装,保持统一的 Tailwind 风格
4
+ */
5
+ export * from './button';
6
+ export * from './button-group';
7
+ export * from './dropdown-button';
8
+ export * from './action-group';
9
+ export * from './delete-button';
10
+ export * from './table';
@@ -0,0 +1,4 @@
1
+ import { Table } from 'ant-design-vue';
2
+ export * from './table';
3
+ export { Table };
4
+ export default Table;
@@ -0,0 +1,128 @@
1
+ import { ButtonProps } from 'ant-design-vue/es/button/buttonTypes';
2
+ import { ColumnType } from 'ant-design-vue/es/table/interface';
3
+ import { TableProps } from 'ant-design-vue/es/table/Table';
4
+ /**
5
+ * 表格列类型枚举
6
+ */
7
+ export declare enum TableColumnTypeEnum {
8
+ /** 文本 */
9
+ TEXT = "text",
10
+ /** 标签 */
11
+ TAG = "tag",
12
+ /** 日期 */
13
+ DATE = "date",
14
+ /** 日期时间 */
15
+ DATETIME = "dateTime",
16
+ /** 下拉选择 */
17
+ SELECT = "select",
18
+ /** 状态 */
19
+ STATUS = "status",
20
+ /** 自定义 */
21
+ CUSTOM = "custom"
22
+ }
23
+ /**
24
+ * 表格列对齐方式枚举
25
+ */
26
+ export declare enum TableColumnAlignEnum {
27
+ /** 左对齐 */
28
+ LEFT = "left",
29
+ /** 居中对齐 */
30
+ CENTER = "center",
31
+ /** 右对齐 */
32
+ RIGHT = "right"
33
+ }
34
+ /**
35
+ * 表格尺寸枚举
36
+ */
37
+ export declare enum TableSizeEnum {
38
+ /** 小尺寸 */
39
+ SMALL = "small",
40
+ /** 中等尺寸 */
41
+ MIDDLE = "middle",
42
+ /** 大尺寸 */
43
+ LARGE = "large"
44
+ }
45
+ /**
46
+ * 表格选择类型枚举
47
+ */
48
+ export declare enum TableSelectionTypeEnum {
49
+ /** 复选框 */
50
+ CHECKBOX = "checkbox",
51
+ /** 单选框 */
52
+ RADIO = "radio"
53
+ }
54
+ /**
55
+ * 按钮位置枚举
56
+ */
57
+ export declare enum ButtonPositionEnum {
58
+ /** 左侧 */
59
+ LEFT = "left",
60
+ /** 右侧 */
61
+ RIGHT = "right"
62
+ }
63
+ /**
64
+ * 搜索配置项
65
+ */
66
+ export interface SearchConfigItem {
67
+ /** 字段名 */
68
+ key: string;
69
+ /** 标签 */
70
+ label: string;
71
+ /** 输入框类型 */
72
+ type?: "input" | "select" | "date" | "dateRange";
73
+ /** 占位符 */
74
+ placeholder?: string;
75
+ /** 选项(用于 select 类型) */
76
+ options?: Array<{
77
+ label: string;
78
+ value: any;
79
+ }>;
80
+ /** 默认值 */
81
+ defaultValue?: any;
82
+ /** 其他属性 */
83
+ [key: string]: any;
84
+ }
85
+ /**
86
+ * 操作按钮配置
87
+ */
88
+ export interface OperateButtonConfig {
89
+ /** 按钮唯一标识 */
90
+ key: string;
91
+ /** 按钮文本 */
92
+ label: string;
93
+ /** 按钮类型 */
94
+ type?: "primary" | "default" | "dashed" | "link" | "text";
95
+ /** 是否危险按钮 */
96
+ danger?: boolean;
97
+ /** 是否禁用 */
98
+ disabled?: boolean;
99
+ /** 点击事件 */
100
+ onClick?: () => void | Promise<void>;
101
+ /** 其他按钮属性 */
102
+ [key: string]: any;
103
+ }
104
+ export interface TableColumn extends Omit<ColumnType, "customRender"> {
105
+ type: TableColumnTypeEnum;
106
+ customRender?: (value: any, record: any, index: number) => any;
107
+ options?: any[];
108
+ color?: string;
109
+ }
110
+ export interface TableAction extends Omit<ButtonProps, "onClick"> {
111
+ key: string;
112
+ label: string;
113
+ position?: ButtonPositionEnum;
114
+ onClick: (record: any, index: number) => void;
115
+ }
116
+ export interface TableConfig extends Omit<TableProps, "columns"> {
117
+ columns: TableColumn[];
118
+ searchList?: SearchConfigItem[];
119
+ operateList?: OperateButtonConfig[];
120
+ }
121
+ export interface TableGeneratorConfig {
122
+ id: string;
123
+ name: string;
124
+ description?: string;
125
+ config: TableConfig;
126
+ createdAt?: string;
127
+ updatedAt?: string;
128
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 数据展示组件
3
+ * Data Display Components
4
+ */
5
+ export * from './tag';
@@ -0,0 +1,21 @@
1
+ export declare const Tag: import('../../../../shared/index.ts').WithInstall<import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ type: {
3
+ type: import('vue').PropType<"success" | "processing" | "error" | "warning" | "default">;
4
+ default: string;
5
+ };
6
+ color: {
7
+ type: StringConstructor;
8
+ };
9
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
+ type: {
11
+ type: import('vue').PropType<"success" | "processing" | "error" | "warning" | "default">;
12
+ default: string;
13
+ };
14
+ color: {
15
+ type: StringConstructor;
16
+ };
17
+ }>> & Readonly<{}>, {
18
+ type: "success" | "processing" | "error" | "warning" | "default";
19
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>>;
20
+ export default Tag;
21
+ export * from './props';
@@ -0,0 +1,11 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ export declare const tagProps: {
3
+ type: {
4
+ type: PropType<"success" | "processing" | "error" | "warning" | "default">;
5
+ default: string;
6
+ };
7
+ color: {
8
+ type: StringConstructor;
9
+ };
10
+ };
11
+ export type TagProps = ExtractPropTypes<typeof tagProps>;
@@ -0,0 +1,20 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ type: {
3
+ type: import('vue').PropType<"success" | "processing" | "error" | "warning" | "default">;
4
+ default: string;
5
+ };
6
+ color: {
7
+ type: StringConstructor;
8
+ };
9
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
+ type: {
11
+ type: import('vue').PropType<"success" | "processing" | "error" | "warning" | "default">;
12
+ default: string;
13
+ };
14
+ color: {
15
+ type: StringConstructor;
16
+ };
17
+ }>> & Readonly<{}>, {
18
+ type: "success" | "processing" | "error" | "warning" | "default";
19
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
20
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import { App } from 'vue';
2
+ /**
3
+ * Mtn UI - Vue 3 Component Library
4
+ *
5
+ * 分类导出:
6
+ * - data-display: 数据展示组件(自实现)
7
+ * - antd-wrapped: 复杂组件(基于 Ant Design Vue 封装)
8
+ * - layout: 布局组件(待添加)
9
+ * - navigation: 导航组件(待添加)
10
+ * - data-entry: 数据录入组件(待添加)
11
+ * - feedback: 反馈组件(待添加)
12
+ */
13
+ export * from './data-display';
14
+ export * from './antd-wrapped';
15
+ declare const _default: {
16
+ install(app: App): void;
17
+ };
18
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtn-ui/components",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "type": "module",
5
5
  "description": "Core components for mtn-ui",
6
6
  "main": "./dist/index.cjs",