@manohub/ui 0.6.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 +141 -0
- package/dist/components/avatar/index.d.ts +283 -0
- package/dist/components/avatar/index.js +167 -0
- package/dist/components/badge/index.d.ts +132 -0
- package/dist/components/badge/index.js +99 -0
- package/dist/components/button/index.d.ts +578 -0
- package/dist/components/button/index.js +191 -0
- package/dist/components/capsule/index.d.ts +161 -0
- package/dist/components/capsule/index.js +101 -0
- package/dist/components/card/index.d.ts +456 -0
- package/dist/components/card/index.js +231 -0
- package/dist/components/checkbox/index.d.ts +331 -0
- package/dist/components/checkbox/index.js +165 -0
- package/dist/components/code/index.d.ts +134 -0
- package/dist/components/code/index.js +117 -0
- package/dist/components/code-editor/index.d.ts +163 -0
- package/dist/components/code-editor/index.js +98 -0
- package/dist/components/collapse/index.d.ts +125 -0
- package/dist/components/collapse/index.js +95 -0
- package/dist/components/control-size.d.ts +8 -0
- package/dist/components/dialog/index.d.ts +224 -0
- package/dist/components/dialog/index.js +194 -0
- package/dist/components/divider/index.d.ts +64 -0
- package/dist/components/divider/index.js +62 -0
- package/dist/components/drawer/index.d.ts +226 -0
- package/dist/components/drawer/index.js +190 -0
- package/dist/components/filter/index.d.ts +391 -0
- package/dist/components/filter/index.js +203 -0
- package/dist/components/form/index.d.ts +704 -0
- package/dist/components/form/index.js +329 -0
- package/dist/components/input/index.d.ts +980 -0
- package/dist/components/input/index.js +334 -0
- package/dist/components/layout/index.d.ts +162 -0
- package/dist/components/layout/index.js +100 -0
- package/dist/components/list-view/index.d.ts +563 -0
- package/dist/components/list-view/index.js +221 -0
- package/dist/components/loading/index.d.ts +77 -0
- package/dist/components/loading/index.js +40 -0
- package/dist/components/nav/index.d.ts +293 -0
- package/dist/components/nav/index.js +164 -0
- package/dist/components/notice/index.d.ts +137 -0
- package/dist/components/notice/index.js +101 -0
- package/dist/components/notification/index.d.ts +118 -0
- package/dist/components/notification/index.js +99 -0
- package/dist/components/page/index.d.ts +276 -0
- package/dist/components/page/index.js +351 -0
- package/dist/components/page/split-resize.d.ts +42 -0
- package/dist/components/page/split-resize.js +36 -0
- package/dist/components/pagination/index.d.ts +171 -0
- package/dist/components/pagination/index.js +226 -0
- package/dist/components/panel/index.d.ts +401 -0
- package/dist/components/panel/index.js +193 -0
- package/dist/components/part-padding.d.ts +27 -0
- package/dist/components/part-padding.js +23 -0
- package/dist/components/query-state/index.d.ts +207 -0
- package/dist/components/query-state/index.js +181 -0
- package/dist/components/radio/index.d.ts +473 -0
- package/dist/components/radio/index.js +250 -0
- package/dist/components/search/index.d.ts +167 -0
- package/dist/components/search/index.js +105 -0
- package/dist/components/select/index.d.ts +252 -0
- package/dist/components/select/index.js +281 -0
- package/dist/components/skeleton/index.d.ts +88 -0
- package/dist/components/skeleton/index.js +56 -0
- package/dist/components/steps/index.d.ts +199 -0
- package/dist/components/steps/index.js +117 -0
- package/dist/components/switch/index.d.ts +150 -0
- package/dist/components/switch/index.js +103 -0
- package/dist/components/table/index.d.ts +351 -0
- package/dist/components/table/index.js +286 -0
- package/dist/components/tabs/index.d.ts +179 -0
- package/dist/components/tabs/index.js +153 -0
- package/dist/components/tabset/index.d.ts +105 -0
- package/dist/components/tabset/index.js +68 -0
- package/dist/components/tag/index.d.ts +203 -0
- package/dist/components/tag/index.js +144 -0
- package/dist/components/toast/index.d.ts +271 -0
- package/dist/components/toast/index.js +116 -0
- package/dist/components/tooltip/index.d.ts +126 -0
- package/dist/components/tooltip/index.js +97 -0
- package/dist/components/tree/index.d.ts +317 -0
- package/dist/components/tree/index.js +251 -0
- package/dist/components/upload/index.d.ts +384 -0
- package/dist/components/upload/index.js +172 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +102 -0
- package/dist/services/base.d.ts +21 -0
- package/dist/services/base.js +42 -0
- package/dist/services/dialog.d.ts +41 -0
- package/dist/services/dialog.js +83 -0
- package/dist/services/index.d.ts +12 -0
- package/dist/services/loading.d.ts +21 -0
- package/dist/services/loading.js +41 -0
- package/dist/services/toast.d.ts +40 -0
- package/dist/services/toast.js +74 -0
- package/dist/styles/components/avatar.css +128 -0
- package/dist/styles/components/avatar.tokens.css +24 -0
- package/dist/styles/components/badge.css +237 -0
- package/dist/styles/components/button.css +454 -0
- package/dist/styles/components/button.tokens.css +56 -0
- package/dist/styles/components/capsule.css +120 -0
- package/dist/styles/components/capsule.tokens.css +27 -0
- package/dist/styles/components/card.css +192 -0
- package/dist/styles/components/checkbox.css +145 -0
- package/dist/styles/components/checkbox.tokens.css +26 -0
- package/dist/styles/components/code-editor.css +91 -0
- package/dist/styles/components/code-editor.tokens.css +24 -0
- package/dist/styles/components/code.css +153 -0
- package/dist/styles/components/code.tokens.css +29 -0
- package/dist/styles/components/collapse.css +62 -0
- package/dist/styles/components/collapse.tokens.css +20 -0
- package/dist/styles/components/dialog.css +106 -0
- package/dist/styles/components/dialog.tokens.css +24 -0
- package/dist/styles/components/divider.css +71 -0
- package/dist/styles/components/divider.tokens.css +21 -0
- package/dist/styles/components/drawer.css +143 -0
- package/dist/styles/components/drawer.tokens.css +22 -0
- package/dist/styles/components/filter.css +41 -0
- package/dist/styles/components/filter.tokens.css +14 -0
- package/dist/styles/components/form.css +220 -0
- package/dist/styles/components/form.tokens.css +15 -0
- package/dist/styles/components/input.css +445 -0
- package/dist/styles/components/input.tokens.css +41 -0
- package/dist/styles/components/layout.css +198 -0
- package/dist/styles/components/list-view.css +244 -0
- package/dist/styles/components/loading.css +76 -0
- package/dist/styles/components/loading.tokens.css +23 -0
- package/dist/styles/components/nav.css +48 -0
- package/dist/styles/components/notice.css +153 -0
- package/dist/styles/components/notice.tokens.css +17 -0
- package/dist/styles/components/notification.css +159 -0
- package/dist/styles/components/notification.tokens.css +37 -0
- package/dist/styles/components/page.css +473 -0
- package/dist/styles/components/pagination.css +297 -0
- package/dist/styles/components/pagination.tokens.css +32 -0
- package/dist/styles/components/panel.css +77 -0
- package/dist/styles/components/query-state.css +88 -0
- package/dist/styles/components/radio.css +271 -0
- package/dist/styles/components/radio.tokens.css +26 -0
- package/dist/styles/components/search.css +30 -0
- package/dist/styles/components/select.css +242 -0
- package/dist/styles/components/select.tokens.css +33 -0
- package/dist/styles/components/skeleton.css +60 -0
- package/dist/styles/components/skeleton.tokens.css +27 -0
- package/dist/styles/components/steps.css +157 -0
- package/dist/styles/components/steps.tokens.css +42 -0
- package/dist/styles/components/switch.css +165 -0
- package/dist/styles/components/switch.tokens.css +26 -0
- package/dist/styles/components/table.css +439 -0
- package/dist/styles/components/table.tokens.css +41 -0
- package/dist/styles/components/tabs.css +234 -0
- package/dist/styles/components/tabs.tokens.css +30 -0
- package/dist/styles/components/tag.css +200 -0
- package/dist/styles/components/tag.tokens.css +30 -0
- package/dist/styles/components/toast.css +150 -0
- package/dist/styles/components/toast.tokens.css +26 -0
- package/dist/styles/components/tooltip.css +89 -0
- package/dist/styles/components/tooltip.tokens.css +25 -0
- package/dist/styles/components/tree.css +139 -0
- package/dist/styles/components/tree.tokens.css +20 -0
- package/dist/styles/components/upload.css +150 -0
- package/dist/styles/components/upload.tokens.css +27 -0
- package/dist/styles/index.css +149 -0
- package/dist/styles/operations/collapse.css +84 -0
- package/dist/styles/operations/popup.css +189 -0
- package/dist/styles/operations/tabset.css +57 -0
- package/dist/utils/state-illustration.d.ts +31 -0
- package/dist/utils/state-illustration.js +156 -0
- package/package.json +62 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { type IconName } from '@manohub/icon';
|
|
2
|
+
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
3
|
+
import type { ControlSize } from '../control-size';
|
|
4
|
+
export interface TagProps {
|
|
5
|
+
/**
|
|
6
|
+
* 形态:
|
|
7
|
+
* - `regular`(缺省)常规内容标签
|
|
8
|
+
* - `status` 状态标签(配 `tone` 用四色)
|
|
9
|
+
* - `select` 可选标签(渲染隐身原生 radio,选中态实底主色)
|
|
10
|
+
* - `add` 新增标签(虚线框 + 加号图标,点击回调)
|
|
11
|
+
* - `chip` 轻量筛选片
|
|
12
|
+
*/
|
|
13
|
+
shape?: 'regular' | 'status' | 'select' | 'add' | 'chip';
|
|
14
|
+
/** 状态档语义(只用 `shape="status"`) */
|
|
15
|
+
tone?: 'info' | 'success' | 'warning' | 'error';
|
|
16
|
+
/** 尺寸档(20 / 24 / 28) */
|
|
17
|
+
size?: ControlSize;
|
|
18
|
+
/** 大号档(= `size="lg"`,保留的既有写法) */
|
|
19
|
+
lg?: boolean;
|
|
20
|
+
/** 前置图标(图标包的闭合枚举) */
|
|
21
|
+
icon?: IconName;
|
|
22
|
+
/** 描边档:浅主色底 + 浅主色边(设计稿的标签配方,配 `size="sm"` 即「表格内标签」) */
|
|
23
|
+
outline?: boolean;
|
|
24
|
+
/** 可关闭(右端出现关闭位) */
|
|
25
|
+
closable?: boolean;
|
|
26
|
+
/** 自定义色(hex):底按该色 14% 与白混出,字用该色本身 */
|
|
27
|
+
color?: string;
|
|
28
|
+
/** `shape="select"` 的选中态 */
|
|
29
|
+
selected?: boolean;
|
|
30
|
+
/** 禁用(可选档不可点、转弱) */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** `shape="select"` 的原生分组名与值(组内同名互斥) */
|
|
33
|
+
name?: string;
|
|
34
|
+
value?: string | number;
|
|
35
|
+
/** `shape="add"` / `chip` 的点击回调(`select` 档用 `onChange`) */
|
|
36
|
+
onClick?: () => void;
|
|
37
|
+
/** `shape="select"` 的选中变化回调 */
|
|
38
|
+
onChange?: (selected: boolean) => void;
|
|
39
|
+
/** 关闭回调(`closable` 的关闭位点击) */
|
|
40
|
+
onClose?: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 标签(常规 / 状态 / 可选 / 新增 / 轻量筛选片)。
|
|
44
|
+
*
|
|
45
|
+
* **与 `Badge` 的判据**:`Badge` 是状态徽标(固定短、状态色、可带圆点/数字);
|
|
46
|
+
* 本件是内容标签(描述性文字,长度随内容,可能可选/可加/可关闭)。
|
|
47
|
+
*
|
|
48
|
+
* 可选档(`shape="select"`)是**原生 radio**:组内同名互斥、键盘方向键换项都由浏览器接管,
|
|
49
|
+
* 样式层靠 `:has(input:checked)` / `[data-state='selected']` / `.is-selected` 三源等价选态。
|
|
50
|
+
*
|
|
51
|
+
* 关闭是**受控**的:本件只回调 `onClose`,是否移除由业务决定(与 `Notification` 同一口径)——
|
|
52
|
+
* 组件自己删自己会让「关闭后又能从别处恢复」这类需求无解。
|
|
53
|
+
*
|
|
54
|
+
* @example 状态标签
|
|
55
|
+
* <Tag shape="status" tone="success">已通过</Tag>
|
|
56
|
+
*
|
|
57
|
+
* @example 可关闭的筛选条件
|
|
58
|
+
* <Tag closable icon="filter" onClose={() => remove('status')}>状态:已通过</Tag>
|
|
59
|
+
*
|
|
60
|
+
* @example 可选标签(同组互斥)
|
|
61
|
+
* <Tag shape="select" name="scope" value="all" :selected="v === 'all'" @change="select('all')">全部</Tag>
|
|
62
|
+
*/
|
|
63
|
+
export declare const Tag: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
64
|
+
shape: {
|
|
65
|
+
type: PropType<TagProps["shape"]>;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
tone: {
|
|
69
|
+
type: PropType<TagProps["tone"]>;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
72
|
+
size: {
|
|
73
|
+
type: PropType<ControlSize>;
|
|
74
|
+
default: string;
|
|
75
|
+
};
|
|
76
|
+
lg: {
|
|
77
|
+
type: BooleanConstructor;
|
|
78
|
+
default: boolean;
|
|
79
|
+
};
|
|
80
|
+
icon: {
|
|
81
|
+
type: PropType<IconName>;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
84
|
+
outline: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
default: boolean;
|
|
87
|
+
};
|
|
88
|
+
closable: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: boolean;
|
|
91
|
+
};
|
|
92
|
+
color: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
selected: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
default: boolean;
|
|
99
|
+
};
|
|
100
|
+
disabled: {
|
|
101
|
+
type: BooleanConstructor;
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
104
|
+
name: {
|
|
105
|
+
type: StringConstructor;
|
|
106
|
+
default: undefined;
|
|
107
|
+
};
|
|
108
|
+
value: {
|
|
109
|
+
type: PropType<string | number>;
|
|
110
|
+
default: undefined;
|
|
111
|
+
};
|
|
112
|
+
onClick: {
|
|
113
|
+
type: PropType<() => void>;
|
|
114
|
+
default: undefined;
|
|
115
|
+
};
|
|
116
|
+
onChange: {
|
|
117
|
+
type: PropType<(selected: boolean) => void>;
|
|
118
|
+
default: undefined;
|
|
119
|
+
};
|
|
120
|
+
onClose: {
|
|
121
|
+
type: PropType<() => void>;
|
|
122
|
+
default: undefined;
|
|
123
|
+
};
|
|
124
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
125
|
+
shape: {
|
|
126
|
+
type: PropType<TagProps["shape"]>;
|
|
127
|
+
default: string;
|
|
128
|
+
};
|
|
129
|
+
tone: {
|
|
130
|
+
type: PropType<TagProps["tone"]>;
|
|
131
|
+
default: undefined;
|
|
132
|
+
};
|
|
133
|
+
size: {
|
|
134
|
+
type: PropType<ControlSize>;
|
|
135
|
+
default: string;
|
|
136
|
+
};
|
|
137
|
+
lg: {
|
|
138
|
+
type: BooleanConstructor;
|
|
139
|
+
default: boolean;
|
|
140
|
+
};
|
|
141
|
+
icon: {
|
|
142
|
+
type: PropType<IconName>;
|
|
143
|
+
default: undefined;
|
|
144
|
+
};
|
|
145
|
+
outline: {
|
|
146
|
+
type: BooleanConstructor;
|
|
147
|
+
default: boolean;
|
|
148
|
+
};
|
|
149
|
+
closable: {
|
|
150
|
+
type: BooleanConstructor;
|
|
151
|
+
default: boolean;
|
|
152
|
+
};
|
|
153
|
+
color: {
|
|
154
|
+
type: StringConstructor;
|
|
155
|
+
default: undefined;
|
|
156
|
+
};
|
|
157
|
+
selected: {
|
|
158
|
+
type: BooleanConstructor;
|
|
159
|
+
default: boolean;
|
|
160
|
+
};
|
|
161
|
+
disabled: {
|
|
162
|
+
type: BooleanConstructor;
|
|
163
|
+
default: boolean;
|
|
164
|
+
};
|
|
165
|
+
name: {
|
|
166
|
+
type: StringConstructor;
|
|
167
|
+
default: undefined;
|
|
168
|
+
};
|
|
169
|
+
value: {
|
|
170
|
+
type: PropType<string | number>;
|
|
171
|
+
default: undefined;
|
|
172
|
+
};
|
|
173
|
+
onClick: {
|
|
174
|
+
type: PropType<() => void>;
|
|
175
|
+
default: undefined;
|
|
176
|
+
};
|
|
177
|
+
onChange: {
|
|
178
|
+
type: PropType<(selected: boolean) => void>;
|
|
179
|
+
default: undefined;
|
|
180
|
+
};
|
|
181
|
+
onClose: {
|
|
182
|
+
type: PropType<() => void>;
|
|
183
|
+
default: undefined;
|
|
184
|
+
};
|
|
185
|
+
}>> & Readonly<{}>, {
|
|
186
|
+
color: string;
|
|
187
|
+
size: ControlSize;
|
|
188
|
+
icon: "filter" | "copy" | "help" | "table" | "menu" | "search" | "link" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "wrench" | "plus" | "bell" | "settings" | "logout" | "home" | "workbench" | "grid-dots" | "heart" | "heart-filled" | "edit" | "refresh" | "upload" | "save" | "more" | "eye" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "sparkles" | "shield-check" | "shield-alert" | "history";
|
|
189
|
+
disabled: boolean;
|
|
190
|
+
name: string;
|
|
191
|
+
value: string | number;
|
|
192
|
+
onChange: (selected: boolean) => void;
|
|
193
|
+
onClick: () => void;
|
|
194
|
+
onClose: () => void;
|
|
195
|
+
outline: boolean;
|
|
196
|
+
selected: boolean;
|
|
197
|
+
lg: boolean;
|
|
198
|
+
shape: "add" | "select" | "chip" | "regular" | "status" | undefined;
|
|
199
|
+
tone: "error" | "info" | "success" | "warning" | undefined;
|
|
200
|
+
closable: boolean;
|
|
201
|
+
}, SlotsType<{
|
|
202
|
+
default?: () => VNodeChild;
|
|
203
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { defineComponent, computed, createVNode, mergeProps, Fragment, isVNode } from "vue";
|
|
2
|
+
import { Icon } from "@manohub/icon";
|
|
3
|
+
function _isSlot(s) {
|
|
4
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
5
|
+
}
|
|
6
|
+
const Tag = /* @__PURE__ */ defineComponent({
|
|
7
|
+
name: "Tag",
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
props: {
|
|
10
|
+
shape: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "regular"
|
|
13
|
+
},
|
|
14
|
+
tone: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "md"
|
|
21
|
+
},
|
|
22
|
+
lg: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
icon: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: void 0
|
|
29
|
+
},
|
|
30
|
+
outline: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
closable: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
color: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: void 0
|
|
41
|
+
},
|
|
42
|
+
selected: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
name: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: void 0
|
|
53
|
+
},
|
|
54
|
+
value: {
|
|
55
|
+
type: [String, Number],
|
|
56
|
+
default: void 0
|
|
57
|
+
},
|
|
58
|
+
onClick: {
|
|
59
|
+
type: Function,
|
|
60
|
+
default: void 0
|
|
61
|
+
},
|
|
62
|
+
onChange: {
|
|
63
|
+
type: Function,
|
|
64
|
+
default: void 0
|
|
65
|
+
},
|
|
66
|
+
onClose: {
|
|
67
|
+
type: Function,
|
|
68
|
+
default: void 0
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
slots: Object,
|
|
72
|
+
setup(props, {
|
|
73
|
+
slots,
|
|
74
|
+
attrs
|
|
75
|
+
}) {
|
|
76
|
+
const resolvedSize = computed(() => props.lg ? "lg" : props.size);
|
|
77
|
+
const customColor = computed(() => props.color ? {
|
|
78
|
+
"--ui-tag-bg": `color-mix(in srgb, ${props.color} 14%, white)`,
|
|
79
|
+
color: props.color
|
|
80
|
+
} : void 0);
|
|
81
|
+
const classes = () => ["mh-tag", resolvedSize.value === "md" ? void 0 : `mh-tag--${resolvedSize.value}`, props.shape !== "regular" ? `mh-tag--${props.shape}` : void 0, props.shape === "status" && props.tone ? `mh-tag--${props.tone}` : void 0, props.outline ? "mh-tag--outline" : void 0, props.shape === "select" && props.selected ? "is-selected" : void 0, props.disabled ? "is-disabled" : void 0, attrs.class].filter(Boolean).join(" ");
|
|
82
|
+
const content = () => createVNode(Fragment, null, [props.icon ? createVNode(Icon, {
|
|
83
|
+
"name": props.icon,
|
|
84
|
+
"class": "mh-tag__icon"
|
|
85
|
+
}, null) : null, slots.default?.(), props.closable ? createVNode("button", {
|
|
86
|
+
"type": "button",
|
|
87
|
+
"class": "mh-tag__close",
|
|
88
|
+
"aria-label": "关闭",
|
|
89
|
+
"tabindex": -1,
|
|
90
|
+
"onClick": (event) => {
|
|
91
|
+
event.stopPropagation();
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
props.onClose?.();
|
|
94
|
+
}
|
|
95
|
+
}, [createVNode(Icon, {
|
|
96
|
+
"name": "close"
|
|
97
|
+
}, null)]) : null]);
|
|
98
|
+
return () => {
|
|
99
|
+
let _slot;
|
|
100
|
+
const style = {
|
|
101
|
+
...customColor.value,
|
|
102
|
+
...attrs.style
|
|
103
|
+
};
|
|
104
|
+
if (props.shape === "add") {
|
|
105
|
+
return createVNode("button", {
|
|
106
|
+
"type": "button",
|
|
107
|
+
"class": classes(),
|
|
108
|
+
"style": style,
|
|
109
|
+
"onClick": props.onClick,
|
|
110
|
+
"disabled": props.disabled
|
|
111
|
+
}, [createVNode(Icon, {
|
|
112
|
+
"name": "plus",
|
|
113
|
+
"size": 14
|
|
114
|
+
}, null), slots.default?.()]);
|
|
115
|
+
}
|
|
116
|
+
if (props.shape === "select") {
|
|
117
|
+
return createVNode("label", {
|
|
118
|
+
"class": classes(),
|
|
119
|
+
"style": style
|
|
120
|
+
}, [createVNode("input", {
|
|
121
|
+
"type": "radio",
|
|
122
|
+
"name": props.name,
|
|
123
|
+
"value": props.value,
|
|
124
|
+
"checked": props.selected,
|
|
125
|
+
"disabled": props.disabled,
|
|
126
|
+
"onChange": (event) => props.onChange?.(event.target.checked)
|
|
127
|
+
}, null), content()]);
|
|
128
|
+
}
|
|
129
|
+
const Clickable = props.shape === "chip" ? "button" : "span";
|
|
130
|
+
return createVNode(Clickable, mergeProps({
|
|
131
|
+
"class": classes(),
|
|
132
|
+
"style": style
|
|
133
|
+
}, props.shape === "chip" ? {
|
|
134
|
+
type: "button",
|
|
135
|
+
onClick: props.onClick
|
|
136
|
+
} : {}), _isSlot(_slot = content()) ? _slot : {
|
|
137
|
+
default: () => [_slot]
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
export {
|
|
143
|
+
Tag
|
|
144
|
+
};
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
2
|
+
import { type IconName } from '@manohub/icon';
|
|
3
|
+
export type ToastTone = 'info' | 'success' | 'warning' | 'error' | 'loading';
|
|
4
|
+
/**
|
|
5
|
+
* 消息提示(**自绘**;一条浮出消息 + 语义图标 + 可选动作)。
|
|
6
|
+
*
|
|
7
|
+
* ## 与 `Notification` / `Notice` 的判据
|
|
8
|
+
*
|
|
9
|
+
* 三者都是「告诉用户一件事」,按**出现方式**分:**浮出后自己消失** → 本件(消息提示);
|
|
10
|
+
* 嵌在页面里、用户自己关 → `Notification`(通知卡,有标题/头像/标签);一行话 + 可选操作 → `Notice`。
|
|
11
|
+
*
|
|
12
|
+
* ## 只管一条
|
|
13
|
+
*
|
|
14
|
+
* 本件是**一条**提示的渲染与计时:`duration > 0` 时到点发出 `close` 事件(**不自己移除 DOM** —— 存在性归
|
|
15
|
+
* 调用方,避免"组件消失了、队列里还留着"两套口径);多条堆叠用 `Toast.Stack` 包一层。
|
|
16
|
+
*
|
|
17
|
+
* `loading` 档通常是「先给一条加载中,完成后再换成结果态」:换态由调用方替换 `tone`,本件不做轮询。
|
|
18
|
+
*
|
|
19
|
+
* @example 基本(3 秒自动消失)
|
|
20
|
+
* <Toast tone="success" text="保存成功" :duration="3000" @close="remove(it)" />
|
|
21
|
+
*
|
|
22
|
+
* @example 堆叠容器 + 带动作
|
|
23
|
+
* <Toast.Stack>
|
|
24
|
+
* <Toast tone="error" text="导出失败" action="重试" @action="retry" />
|
|
25
|
+
* </Toast.Stack>
|
|
26
|
+
*/
|
|
27
|
+
export declare const Toast: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
28
|
+
tone: {
|
|
29
|
+
type: PropType<ToastTone>;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
/** 正文(复杂内容走默认插槽) */
|
|
33
|
+
text: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
/** 动作文案(走 `action` 插槽可给自定义元素) */
|
|
38
|
+
action: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
/** 自动消失毫秒数;`0` = 不自动消失(缺省不给计时) */
|
|
43
|
+
duration: {
|
|
44
|
+
type: NumberConstructor;
|
|
45
|
+
default: number;
|
|
46
|
+
};
|
|
47
|
+
/** 前置图标:缺省按 `tone` 映射;`false` 不出图标;也可直接给图标名 */
|
|
48
|
+
icon: {
|
|
49
|
+
type: PropType<boolean | IconName>;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
/** 手动关闭位(`duration` 为 0 的常驻提示必须给用户一个关掉的入口) */
|
|
53
|
+
closable: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
onAction: {
|
|
58
|
+
type: PropType<() => void>;
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
61
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
62
|
+
/** 自动消失到点(**只回调不移除**:存在性归调用方,避免"组件没了、队列里还留着"两套口径) */
|
|
63
|
+
close: () => true;
|
|
64
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
65
|
+
tone: {
|
|
66
|
+
type: PropType<ToastTone>;
|
|
67
|
+
default: string;
|
|
68
|
+
};
|
|
69
|
+
/** 正文(复杂内容走默认插槽) */
|
|
70
|
+
text: {
|
|
71
|
+
type: StringConstructor;
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
/** 动作文案(走 `action` 插槽可给自定义元素) */
|
|
75
|
+
action: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
/** 自动消失毫秒数;`0` = 不自动消失(缺省不给计时) */
|
|
80
|
+
duration: {
|
|
81
|
+
type: NumberConstructor;
|
|
82
|
+
default: number;
|
|
83
|
+
};
|
|
84
|
+
/** 前置图标:缺省按 `tone` 映射;`false` 不出图标;也可直接给图标名 */
|
|
85
|
+
icon: {
|
|
86
|
+
type: PropType<boolean | IconName>;
|
|
87
|
+
default: boolean;
|
|
88
|
+
};
|
|
89
|
+
/** 手动关闭位(`duration` 为 0 的常驻提示必须给用户一个关掉的入口) */
|
|
90
|
+
closable: {
|
|
91
|
+
type: BooleanConstructor;
|
|
92
|
+
default: boolean;
|
|
93
|
+
};
|
|
94
|
+
onAction: {
|
|
95
|
+
type: PropType<() => void>;
|
|
96
|
+
default: undefined;
|
|
97
|
+
};
|
|
98
|
+
}>> & Readonly<{
|
|
99
|
+
onClose?: (() => any) | undefined;
|
|
100
|
+
}>, {
|
|
101
|
+
text: string;
|
|
102
|
+
icon: boolean | "filter" | "copy" | "help" | "table" | "menu" | "search" | "link" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "wrench" | "plus" | "bell" | "settings" | "logout" | "home" | "workbench" | "grid-dots" | "heart" | "heart-filled" | "edit" | "refresh" | "upload" | "save" | "more" | "eye" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "sparkles" | "shield-check" | "shield-alert" | "history";
|
|
103
|
+
tone: ToastTone;
|
|
104
|
+
closable: boolean;
|
|
105
|
+
action: string;
|
|
106
|
+
onAction: () => void;
|
|
107
|
+
duration: number;
|
|
108
|
+
}, SlotsType<{
|
|
109
|
+
default?: () => VNodeChild;
|
|
110
|
+
action?: () => VNodeChild;
|
|
111
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
112
|
+
export declare const ToastCompound: {
|
|
113
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
114
|
+
tone: {
|
|
115
|
+
type: PropType<ToastTone>;
|
|
116
|
+
default: string;
|
|
117
|
+
};
|
|
118
|
+
/** 正文(复杂内容走默认插槽) */
|
|
119
|
+
text: {
|
|
120
|
+
type: StringConstructor;
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
/** 动作文案(走 `action` 插槽可给自定义元素) */
|
|
124
|
+
action: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
default: undefined;
|
|
127
|
+
};
|
|
128
|
+
/** 自动消失毫秒数;`0` = 不自动消失(缺省不给计时) */
|
|
129
|
+
duration: {
|
|
130
|
+
type: NumberConstructor;
|
|
131
|
+
default: number;
|
|
132
|
+
};
|
|
133
|
+
/** 前置图标:缺省按 `tone` 映射;`false` 不出图标;也可直接给图标名 */
|
|
134
|
+
icon: {
|
|
135
|
+
type: PropType<boolean | IconName>;
|
|
136
|
+
default: boolean;
|
|
137
|
+
};
|
|
138
|
+
/** 手动关闭位(`duration` 为 0 的常驻提示必须给用户一个关掉的入口) */
|
|
139
|
+
closable: {
|
|
140
|
+
type: BooleanConstructor;
|
|
141
|
+
default: boolean;
|
|
142
|
+
};
|
|
143
|
+
onAction: {
|
|
144
|
+
type: PropType<() => void>;
|
|
145
|
+
default: undefined;
|
|
146
|
+
};
|
|
147
|
+
}>> & Readonly<{
|
|
148
|
+
onClose?: (() => any) | undefined;
|
|
149
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
150
|
+
/** 自动消失到点(**只回调不移除**:存在性归调用方,避免"组件没了、队列里还留着"两套口径) */
|
|
151
|
+
close: () => true;
|
|
152
|
+
}, import("vue").PublicProps, {
|
|
153
|
+
text: string;
|
|
154
|
+
icon: boolean | "filter" | "copy" | "help" | "table" | "menu" | "search" | "link" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "wrench" | "plus" | "bell" | "settings" | "logout" | "home" | "workbench" | "grid-dots" | "heart" | "heart-filled" | "edit" | "refresh" | "upload" | "save" | "more" | "eye" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "sparkles" | "shield-check" | "shield-alert" | "history";
|
|
155
|
+
tone: ToastTone;
|
|
156
|
+
closable: boolean;
|
|
157
|
+
action: string;
|
|
158
|
+
onAction: () => void;
|
|
159
|
+
duration: number;
|
|
160
|
+
}, true, {}, SlotsType<{
|
|
161
|
+
default?: () => VNodeChild;
|
|
162
|
+
action?: () => VNodeChild;
|
|
163
|
+
}>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
164
|
+
P: {};
|
|
165
|
+
B: {};
|
|
166
|
+
D: {};
|
|
167
|
+
C: {};
|
|
168
|
+
M: {};
|
|
169
|
+
Defaults: {};
|
|
170
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
171
|
+
tone: {
|
|
172
|
+
type: PropType<ToastTone>;
|
|
173
|
+
default: string;
|
|
174
|
+
};
|
|
175
|
+
/** 正文(复杂内容走默认插槽) */
|
|
176
|
+
text: {
|
|
177
|
+
type: StringConstructor;
|
|
178
|
+
default: undefined;
|
|
179
|
+
};
|
|
180
|
+
/** 动作文案(走 `action` 插槽可给自定义元素) */
|
|
181
|
+
action: {
|
|
182
|
+
type: StringConstructor;
|
|
183
|
+
default: undefined;
|
|
184
|
+
};
|
|
185
|
+
/** 自动消失毫秒数;`0` = 不自动消失(缺省不给计时) */
|
|
186
|
+
duration: {
|
|
187
|
+
type: NumberConstructor;
|
|
188
|
+
default: number;
|
|
189
|
+
};
|
|
190
|
+
/** 前置图标:缺省按 `tone` 映射;`false` 不出图标;也可直接给图标名 */
|
|
191
|
+
icon: {
|
|
192
|
+
type: PropType<boolean | IconName>;
|
|
193
|
+
default: boolean;
|
|
194
|
+
};
|
|
195
|
+
/** 手动关闭位(`duration` 为 0 的常驻提示必须给用户一个关掉的入口) */
|
|
196
|
+
closable: {
|
|
197
|
+
type: BooleanConstructor;
|
|
198
|
+
default: boolean;
|
|
199
|
+
};
|
|
200
|
+
onAction: {
|
|
201
|
+
type: PropType<() => void>;
|
|
202
|
+
default: undefined;
|
|
203
|
+
};
|
|
204
|
+
}>> & Readonly<{
|
|
205
|
+
onClose?: (() => any) | undefined;
|
|
206
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
|
|
207
|
+
text: string;
|
|
208
|
+
icon: boolean | "filter" | "copy" | "help" | "table" | "menu" | "search" | "link" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "wrench" | "plus" | "bell" | "settings" | "logout" | "home" | "workbench" | "grid-dots" | "heart" | "heart-filled" | "edit" | "refresh" | "upload" | "save" | "more" | "eye" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "sparkles" | "shield-check" | "shield-alert" | "history";
|
|
209
|
+
tone: ToastTone;
|
|
210
|
+
closable: boolean;
|
|
211
|
+
action: string;
|
|
212
|
+
onAction: () => void;
|
|
213
|
+
duration: number;
|
|
214
|
+
}>;
|
|
215
|
+
__isFragment?: never;
|
|
216
|
+
__isTeleport?: never;
|
|
217
|
+
__isSuspense?: never;
|
|
218
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
219
|
+
tone: {
|
|
220
|
+
type: PropType<ToastTone>;
|
|
221
|
+
default: string;
|
|
222
|
+
};
|
|
223
|
+
/** 正文(复杂内容走默认插槽) */
|
|
224
|
+
text: {
|
|
225
|
+
type: StringConstructor;
|
|
226
|
+
default: undefined;
|
|
227
|
+
};
|
|
228
|
+
/** 动作文案(走 `action` 插槽可给自定义元素) */
|
|
229
|
+
action: {
|
|
230
|
+
type: StringConstructor;
|
|
231
|
+
default: undefined;
|
|
232
|
+
};
|
|
233
|
+
/** 自动消失毫秒数;`0` = 不自动消失(缺省不给计时) */
|
|
234
|
+
duration: {
|
|
235
|
+
type: NumberConstructor;
|
|
236
|
+
default: number;
|
|
237
|
+
};
|
|
238
|
+
/** 前置图标:缺省按 `tone` 映射;`false` 不出图标;也可直接给图标名 */
|
|
239
|
+
icon: {
|
|
240
|
+
type: PropType<boolean | IconName>;
|
|
241
|
+
default: boolean;
|
|
242
|
+
};
|
|
243
|
+
/** 手动关闭位(`duration` 为 0 的常驻提示必须给用户一个关掉的入口) */
|
|
244
|
+
closable: {
|
|
245
|
+
type: BooleanConstructor;
|
|
246
|
+
default: boolean;
|
|
247
|
+
};
|
|
248
|
+
onAction: {
|
|
249
|
+
type: PropType<() => void>;
|
|
250
|
+
default: undefined;
|
|
251
|
+
};
|
|
252
|
+
}>> & Readonly<{
|
|
253
|
+
onClose?: (() => any) | undefined;
|
|
254
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
255
|
+
/** 自动消失到点(**只回调不移除**:存在性归调用方,避免"组件没了、队列里还留着"两套口径) */
|
|
256
|
+
close: () => true;
|
|
257
|
+
}, string, {
|
|
258
|
+
text: string;
|
|
259
|
+
icon: boolean | "filter" | "copy" | "help" | "table" | "menu" | "search" | "link" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "wrench" | "plus" | "bell" | "settings" | "logout" | "home" | "workbench" | "grid-dots" | "heart" | "heart-filled" | "edit" | "refresh" | "upload" | "save" | "more" | "eye" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "sparkles" | "shield-check" | "shield-alert" | "history";
|
|
260
|
+
tone: ToastTone;
|
|
261
|
+
closable: boolean;
|
|
262
|
+
action: string;
|
|
263
|
+
onAction: () => void;
|
|
264
|
+
duration: number;
|
|
265
|
+
}, {}, string, SlotsType<{
|
|
266
|
+
default?: () => VNodeChild;
|
|
267
|
+
action?: () => VNodeChild;
|
|
268
|
+
}>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
269
|
+
Stack: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
270
|
+
};
|
|
271
|
+
export type ToastCompoundType = typeof ToastCompound;
|