@manohub/ui 0.6.1 → 0.7.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/README.md +12 -4
- package/dist/components/button/index.d.ts +8 -8
- package/dist/components/capsule/index.d.ts +13 -9
- package/dist/components/capsule/index.js +1 -1
- package/dist/components/card/index.js +7 -4
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/dialog/index.d.ts +58 -6
- package/dist/components/dialog/index.js +45 -8
- package/dist/components/drawer/index.d.ts +18 -6
- package/dist/components/drawer/index.js +11 -5
- package/dist/components/form/index.d.ts +115 -17
- package/dist/components/form/index.js +39 -9
- package/dist/components/input/index.d.ts +4 -4
- package/dist/components/input/index.js +1 -1
- package/dist/components/layout/index.d.ts +43 -1
- package/dist/components/layout/index.js +22 -2
- package/dist/components/notice/index.d.ts +24 -11
- package/dist/components/notice/index.js +11 -5
- package/dist/components/notification/index.d.ts +2 -2
- package/dist/components/page/index.js +4 -4
- package/dist/components/panel/index.js +4 -4
- package/dist/components/part-padding.d.ts +9 -6
- package/dist/components/part-padding.js +2 -1
- package/dist/components/radio/index.d.ts +1 -1
- package/dist/components/radio/index.js +1 -0
- package/dist/components/search/index.d.ts +26 -6
- package/dist/components/search/index.js +22 -4
- package/dist/components/steps/index.d.ts +232 -6
- package/dist/components/steps/index.js +84 -26
- package/dist/components/switch/index.d.ts +29 -5
- package/dist/components/switch/index.js +8 -2
- package/dist/components/tabbar/index.d.ts +184 -0
- package/dist/components/tabbar/index.js +161 -0
- package/dist/components/table/index.d.ts +74 -8
- package/dist/components/table/index.js +69 -16
- package/dist/components/tabs/index.d.ts +145 -125
- package/dist/components/tabs/index.js +93 -117
- package/dist/components/tag/index.d.ts +2 -2
- package/dist/components/text/index.d.ts +120 -0
- package/dist/components/text/index.js +55 -0
- package/dist/components/toast/index.d.ts +8 -8
- package/dist/components/toast/index.js +11 -2
- package/dist/components/upload/index.d.ts +30 -0
- package/dist/components/upload/index.js +7 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +6 -3
- package/dist/services/dialog.d.ts +20 -5
- package/dist/services/dialog.js +8 -1
- package/dist/styles/components/capsule.css +4 -4
- package/dist/styles/components/dialog.css +40 -1
- package/dist/styles/components/form.css +206 -26
- package/dist/styles/components/input.css +29 -2
- package/dist/styles/components/layout.css +2 -0
- package/dist/styles/components/select.css +11 -0
- package/dist/styles/components/steps.css +48 -0
- package/dist/styles/components/{tabs.css → tabbar.css} +66 -65
- package/dist/styles/components/tabbar.tokens.css +30 -0
- package/dist/styles/components/table.css +50 -1
- package/dist/styles/components/table.tokens.css +3 -0
- package/dist/styles/components/text.css +101 -0
- package/dist/styles/components/toast.css +12 -6
- package/dist/styles/index.css +8 -4
- package/dist/styles/operations/tabs.css +73 -0
- package/dist/styles/reset.css +205 -0
- package/package.json +2 -2
- package/dist/components/tabset/index.d.ts +0 -105
- package/dist/components/tabset/index.js +0 -68
- package/dist/styles/components/tabs.tokens.css +0 -30
- package/dist/styles/operations/tabset.css +0 -57
|
@@ -25,9 +25,15 @@ const Notice = /* @__PURE__ */ defineComponent({
|
|
|
25
25
|
type: String,
|
|
26
26
|
default: void 0
|
|
27
27
|
},
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
/**
|
|
29
|
+
* 前置图标:缺省 `false` 不出图标;`true` 按 `tone` 映射;也可直接给字形名。
|
|
30
|
+
*
|
|
31
|
+
* 与 `Toast.icon` / `Notification.icon` **同名同型**(0.6.x 本件叫 `showIcon` 且只收布尔,
|
|
32
|
+
* 三件三个名字三种默认 —— 已统一)。默认值仍与 `Toast` 不同:`Toast` 是「浮出即走」的
|
|
33
|
+
* 消息条,图标是它的主要语义承载;本件是嵌在页面里的说明条,页面里别处往往已经有图标,故缺省不出。
|
|
34
|
+
*/
|
|
35
|
+
icon: {
|
|
36
|
+
type: [Boolean, String],
|
|
31
37
|
default: false
|
|
32
38
|
},
|
|
33
39
|
/** 是否渲染右上关闭按钮(规范:仅通知类信息可关闭) */
|
|
@@ -73,8 +79,8 @@ const Notice = /* @__PURE__ */ defineComponent({
|
|
|
73
79
|
return () => createVNode("div", {
|
|
74
80
|
"class": [attrs.class, "mh-notice", `mh-notice--${props.tone}`, props.message ? "mh-notice--titled" : ""].filter(Boolean).join(" "),
|
|
75
81
|
"role": "alert"
|
|
76
|
-
}, [props.
|
|
77
|
-
"name": TONE_ICON[props.tone],
|
|
82
|
+
}, [props.icon ? createVNode(Icon, {
|
|
83
|
+
"name": typeof props.icon === "string" ? props.icon : TONE_ICON[props.tone],
|
|
78
84
|
"class": "mh-notice__icon"
|
|
79
85
|
}, null) : null, createVNode("div", {
|
|
80
86
|
"class": "mh-notice__body"
|
|
@@ -102,11 +102,11 @@ export declare const Notification: import("vue").DefineComponent<import("vue").E
|
|
|
102
102
|
default: undefined;
|
|
103
103
|
};
|
|
104
104
|
}>> & Readonly<{}>, {
|
|
105
|
-
icon: boolean | "
|
|
105
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "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" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
106
106
|
title: string;
|
|
107
107
|
onClose: () => void;
|
|
108
|
-
tone: NotificationTone;
|
|
109
108
|
closable: boolean;
|
|
109
|
+
tone: NotificationTone;
|
|
110
110
|
avatar: string;
|
|
111
111
|
duration: number;
|
|
112
112
|
}, SlotsType<{
|
|
@@ -12,7 +12,7 @@ const PageFilter = /* @__PURE__ */ defineComponent({
|
|
|
12
12
|
props: {
|
|
13
13
|
/** 内距(px 数字 = 四边同值;`{ y, x }` 分别给);缺省不落行内样式,沿用 CSS 默认(`14px 20px 0`) */
|
|
14
14
|
padding: {
|
|
15
|
-
type: [Number, Object],
|
|
15
|
+
type: [Number, Object, String],
|
|
16
16
|
default: void 0
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -49,7 +49,7 @@ const PageHeader = /* @__PURE__ */ defineComponent({
|
|
|
49
49
|
},
|
|
50
50
|
/** 内距(px 数字 = 四边同值;`{ y, x }` 分别给);缺省不落行内样式,沿用 CSS 默认(`14px 20px 13px`) */
|
|
51
51
|
padding: {
|
|
52
|
-
type: [Number, Object],
|
|
52
|
+
type: [Number, Object, String],
|
|
53
53
|
default: void 0
|
|
54
54
|
}
|
|
55
55
|
},
|
|
@@ -107,7 +107,7 @@ const PageBody = /* @__PURE__ */ defineComponent({
|
|
|
107
107
|
default: "plain"
|
|
108
108
|
},
|
|
109
109
|
padding: {
|
|
110
|
-
type: [Number, Object],
|
|
110
|
+
type: [Number, Object, String],
|
|
111
111
|
default: void 0
|
|
112
112
|
}
|
|
113
113
|
},
|
|
@@ -128,7 +128,7 @@ const PageFooter = /* @__PURE__ */ defineComponent({
|
|
|
128
128
|
props: {
|
|
129
129
|
/** 内距(px 数字 = 四边同值;`{ y, x }` 分别给);缺省不落行内样式,沿用 CSS 默认(`12px 20px`) */
|
|
130
130
|
padding: {
|
|
131
|
-
type: [Number, Object],
|
|
131
|
+
type: [Number, Object, String],
|
|
132
132
|
default: void 0
|
|
133
133
|
}
|
|
134
134
|
},
|
|
@@ -24,7 +24,7 @@ const PanelHeader = /* @__PURE__ */ defineComponent({
|
|
|
24
24
|
},
|
|
25
25
|
/** 头这一行的内距(与根件同一口径);内建头自带 `0 8px` 的内距,本项按需覆盖 */
|
|
26
26
|
padding: {
|
|
27
|
-
type: [Number, Object],
|
|
27
|
+
type: [Number, Object, String],
|
|
28
28
|
default: void 0
|
|
29
29
|
}
|
|
30
30
|
},
|
|
@@ -70,7 +70,7 @@ const PanelBody = /* @__PURE__ */ defineComponent({
|
|
|
70
70
|
props: {
|
|
71
71
|
/** 内容区内距(与根件同一口径);缺省 0 = 内容贴面板边(页面里的区域通常如此) */
|
|
72
72
|
padding: {
|
|
73
|
-
type: [Number, Object],
|
|
73
|
+
type: [Number, Object, String],
|
|
74
74
|
default: void 0
|
|
75
75
|
}
|
|
76
76
|
},
|
|
@@ -91,7 +91,7 @@ const PanelFooter = /* @__PURE__ */ defineComponent({
|
|
|
91
91
|
props: {
|
|
92
92
|
/** 页脚内距(与根件同一口径);缺省 0 = 贴面板边 */
|
|
93
93
|
padding: {
|
|
94
|
-
type: [Number, Object],
|
|
94
|
+
type: [Number, Object, String],
|
|
95
95
|
default: void 0
|
|
96
96
|
}
|
|
97
97
|
},
|
|
@@ -145,7 +145,7 @@ const PanelRoot = /* @__PURE__ */ defineComponent({
|
|
|
145
145
|
},
|
|
146
146
|
/** 面板内距(px 数字,或 `{ y, x }`);缺省 0 = 贴容器边 */
|
|
147
147
|
padding: {
|
|
148
|
-
type: [Number, Object],
|
|
148
|
+
type: [Number, Object, String],
|
|
149
149
|
default: void 0
|
|
150
150
|
}
|
|
151
151
|
},
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import type { StyleValue } from 'vue';
|
|
2
2
|
/**
|
|
3
|
-
* 骨架件的**内距**口径(`
|
|
3
|
+
* 骨架件的**内距**口径(`Card` / `Form` / `Page` / `Panel` / `Layout` 共用同一套)。
|
|
4
4
|
*
|
|
5
5
|
* - `number` → 四边同值(`padding={16}`);
|
|
6
6
|
* - `{ y, x }` → 上下 / 左右分别给(`{ y: 12, x: 20 }`,弹窗里的容器常用 —— 与 `Page` 的页面左右内距同档),
|
|
7
|
-
* **缺哪边就不落哪边的声明**(只给 `y` 时不覆盖消费方在 `style`
|
|
7
|
+
* **缺哪边就不落哪边的声明**(只给 `y` 时不覆盖消费方在 `style` 里写的左右内距);
|
|
8
|
+
* - `string` → **原样下发**(CSS 简写,可非对称,如 `'40px 0 0 140px'`)—— **逃生舱**。
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
* (与 `Form.labelWidth` / `表格.rowHeight`
|
|
10
|
+
* 常规用 `number` / `{ y, x }`:几何值在本仓是**设计基准**,不跟根字号
|
|
11
|
+
* (与 `Form.labelWidth` / `表格.rowHeight` 同口径)。
|
|
12
|
+
* `string` 只为「令牌梯度与 `{ y, x }` 都表达不了的设计要求」留口(典型:**只给一侧**的非对称坐标)——
|
|
13
|
+
* 写它等于自己写 CSS,所以**优先级最低**,能不用就不用。
|
|
11
14
|
*/
|
|
12
15
|
export type Padding = number | {
|
|
13
16
|
y?: number;
|
|
14
17
|
x?: number;
|
|
15
|
-
};
|
|
18
|
+
} | string;
|
|
16
19
|
/**
|
|
17
|
-
* 内距 → 行内样式。缺省(`undefined
|
|
20
|
+
* 内距 → 行内样式。缺省(`undefined` / 空串)时返回 `undefined`:**不额外产生 style 属性**,
|
|
18
21
|
* DOM 与「没有这个维度」时完全一致。
|
|
19
22
|
*/
|
|
20
23
|
export declare function partPaddingStyle(padding: Padding | undefined): StyleValue | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
function partPaddingStyle(padding) {
|
|
2
|
-
if (padding === void 0) return void 0;
|
|
2
|
+
if (padding === void 0 || padding === "") return void 0;
|
|
3
3
|
if (typeof padding === "number") return { padding: `${padding}px` };
|
|
4
|
+
if (typeof padding === "string") return { padding };
|
|
4
5
|
const style = {};
|
|
5
6
|
if (padding.y !== void 0) {
|
|
6
7
|
style.paddingTop = `${padding.y}px`;
|
|
@@ -15,7 +15,7 @@ import type { ControlSize } from '../control-size';
|
|
|
15
15
|
* `Checkbox.Group` 同一份口径,故 `v-model` 是本族的推荐写法。
|
|
16
16
|
*
|
|
17
17
|
* **单选组必须有值**:`modelValue` 与非受控初值都没给时,落到**第一个可选项**(跳过禁用项)——
|
|
18
|
-
* 单选语义就是必选其一,与 `
|
|
18
|
+
* 单选语义就是必选其一,与 `Tabs` 的「缺省第一项」同口径;没有可选项(表为空或全禁用)才是空值。
|
|
19
19
|
* 自排插槽(`Radio.Group` 不给 `options`)时组件无从推断有哪些值,缺省值由消费方自定。
|
|
20
20
|
*
|
|
21
21
|
* 状态表达不统一是**有意的**(各自贴着自己的面):`Radio` 走原生 `input:checked + .mh-radio__box`
|
|
@@ -44,6 +44,7 @@ const Radio = /* @__PURE__ */ defineComponent({
|
|
|
44
44
|
}) {
|
|
45
45
|
return () => createVNode("label", {
|
|
46
46
|
"class": ["mh-radio", props.size === "md" ? "" : `mh-radio--${props.size}`, props.disabled ? "is-disabled" : void 0, attrs.class].filter(Boolean).join(" "),
|
|
47
|
+
"data-inline-control": "true",
|
|
47
48
|
"style": attrs.style
|
|
48
49
|
}, [createVNode("input", {
|
|
49
50
|
"class": "mh-radio__input",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type PropType } from 'vue';
|
|
2
2
|
import type { ControlSize } from '../control-size';
|
|
3
|
+
/** 搜索触发位的形态:`text` 主色文案按钮 / `icon` 纯图标按钮 */
|
|
4
|
+
export type SearchAction = 'text' | 'icon';
|
|
3
5
|
export interface SearchProps {
|
|
4
6
|
/** 受控值 */
|
|
5
7
|
modelValue?: string;
|
|
@@ -16,6 +18,8 @@ export interface SearchProps {
|
|
|
16
18
|
loading?: boolean;
|
|
17
19
|
/** 搜索按钮文案;**不传即不渲染按钮**(只留框内放大镜,提交走回车) */
|
|
18
20
|
searchText?: string;
|
|
21
|
+
/** 触发位形态(配合 `searchText` 或单独给):`text` 文案按钮 / `icon` 纯图标按钮 */
|
|
22
|
+
action?: SearchAction;
|
|
19
23
|
/** 值变更回调(每次输入都调,含清空) */
|
|
20
24
|
onChange?: (value: string) => void;
|
|
21
25
|
/** 搜索触发(点搜索按钮 / 输入框内回车) */
|
|
@@ -26,14 +30,18 @@ export interface SearchProps {
|
|
|
26
30
|
/**
|
|
27
31
|
* 搜索框(**自绘**;输入框 + 可选搜索触发位的组合件)。
|
|
28
32
|
*
|
|
29
|
-
* ##
|
|
33
|
+
* ## 三种形态(**同屏只会出现一个「搜索」字形**)
|
|
30
34
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
35
|
+
* | 形态 | 怎么给 | 框内放大镜 | 右侧触发位 |
|
|
36
|
+
* | --- | --- | --- | --- |
|
|
37
|
+
* | 只有回车(缺省) | 什么都不给 | ✅ | 无 |
|
|
38
|
+
* | 图标按钮 | `action="icon"` | ❌(让给按钮) | 主色图标按钮 |
|
|
39
|
+
* | 文案按钮 | `searchText="搜索"` | ✅ | 主色文案按钮 |
|
|
34
40
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
41
|
+
* **框内放大镜与图标按钮不会同时出现** —— 两者是同一个语义的两种画法,
|
|
42
|
+
* 摆在一起就是「一行里两个放大镜,分不出哪个能点」(0.6.0 的缺陷,0.6.1 靠「不给按钮」绕开,
|
|
43
|
+
* 0.7.0 起由 `action="icon"` 把「图标按钮」这一档补上,取图标按钮时框内自动不再画装饰)。
|
|
44
|
+
* 缺省形态的提交走**回车**(`Input` 的 `onEnter` 与 `onSearch` 是同一次语义)。
|
|
37
45
|
*
|
|
38
46
|
* ## 为什么不是 `Input` 的一个档,而是单独一件
|
|
39
47
|
*
|
|
@@ -66,6 +74,9 @@ export interface SearchProps {
|
|
|
66
74
|
* onSearch={apply}
|
|
67
75
|
* onClear={() => apply('')}
|
|
68
76
|
* />
|
|
77
|
+
*
|
|
78
|
+
* @example 纯图标按钮(框内不再画装饰放大镜;`searchText` 退化为无障碍名)
|
|
79
|
+
* <Search modelValue={kw} action="icon" search-text="搜索" onChange={setKw} onSearch={apply} />
|
|
69
80
|
*/
|
|
70
81
|
export declare const Search: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
71
82
|
modelValue: {
|
|
@@ -100,6 +111,10 @@ export declare const Search: import("vue").DefineComponent<import("vue").Extract
|
|
|
100
111
|
type: StringConstructor;
|
|
101
112
|
default: undefined;
|
|
102
113
|
};
|
|
114
|
+
action: {
|
|
115
|
+
type: PropType<SearchAction>;
|
|
116
|
+
default: undefined;
|
|
117
|
+
};
|
|
103
118
|
onChange: {
|
|
104
119
|
type: PropType<(value: string) => void>;
|
|
105
120
|
default: undefined;
|
|
@@ -147,6 +162,10 @@ export declare const Search: import("vue").DefineComponent<import("vue").Extract
|
|
|
147
162
|
type: StringConstructor;
|
|
148
163
|
default: undefined;
|
|
149
164
|
};
|
|
165
|
+
action: {
|
|
166
|
+
type: PropType<SearchAction>;
|
|
167
|
+
default: undefined;
|
|
168
|
+
};
|
|
150
169
|
onChange: {
|
|
151
170
|
type: PropType<(value: string) => void>;
|
|
152
171
|
default: undefined;
|
|
@@ -171,6 +190,7 @@ export declare const Search: import("vue").DefineComponent<import("vue").Extract
|
|
|
171
190
|
modelValue: string;
|
|
172
191
|
clearable: boolean;
|
|
173
192
|
searchText: string;
|
|
193
|
+
action: SearchAction;
|
|
174
194
|
onSearch: (value: string) => void;
|
|
175
195
|
onClear: () => void;
|
|
176
196
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -38,6 +38,10 @@ const Search = /* @__PURE__ */ defineComponent({
|
|
|
38
38
|
type: String,
|
|
39
39
|
default: void 0
|
|
40
40
|
},
|
|
41
|
+
action: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: void 0
|
|
44
|
+
},
|
|
41
45
|
onChange: {
|
|
42
46
|
type: Function,
|
|
43
47
|
default: void 0
|
|
@@ -69,6 +73,9 @@ const Search = /* @__PURE__ */ defineComponent({
|
|
|
69
73
|
if (cleared) props.onClear?.();
|
|
70
74
|
};
|
|
71
75
|
const search = () => props.onSearch?.(current.value ?? "");
|
|
76
|
+
const iconAction = computed(() => props.action === "icon");
|
|
77
|
+
const showAction = computed(() => iconAction.value || props.searchText !== void 0);
|
|
78
|
+
const actionLabel = computed(() => props.searchText ?? "搜索");
|
|
72
79
|
return () => createVNode("div", {
|
|
73
80
|
"class": ["mh-search", attrs.class].filter(Boolean).join(" "),
|
|
74
81
|
"style": attrs.style
|
|
@@ -82,10 +89,21 @@ const Search = /* @__PURE__ */ defineComponent({
|
|
|
82
89
|
"onChange": commit,
|
|
83
90
|
"onEnter": search
|
|
84
91
|
}, {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
default: () => [iconAction.value ? {} : {
|
|
93
|
+
prefix: () => createVNode(Icon, {
|
|
94
|
+
"name": "search"
|
|
95
|
+
}, null)
|
|
96
|
+
}]
|
|
97
|
+
}), showAction.value ? iconAction.value ? createVNode(Button, {
|
|
98
|
+
"class": "mh-search__btn",
|
|
99
|
+
"variant": "primary",
|
|
100
|
+
"size": props.size,
|
|
101
|
+
"icon": "search",
|
|
102
|
+
"title": actionLabel.value,
|
|
103
|
+
"disabled": props.disabled,
|
|
104
|
+
"loading": props.loading,
|
|
105
|
+
"onClick": search
|
|
106
|
+
}, null) : createVNode(Button, {
|
|
89
107
|
"class": "mh-search__btn",
|
|
90
108
|
"variant": "primary",
|
|
91
109
|
"size": props.size,
|
|
@@ -8,6 +8,12 @@ export interface StepsItem {
|
|
|
8
8
|
icon?: IconName;
|
|
9
9
|
}
|
|
10
10
|
export type StepsVariant = 'node' | 'bar';
|
|
11
|
+
/**
|
|
12
|
+
* 跳转验证:**能不能跳到第 `index` 步**(`current` 是当前步)。
|
|
13
|
+
*
|
|
14
|
+
* 不传即「全可跳」—— 件不猜业务规则,限制由调用方注入(如「只允许回退」= `i <= current`)。
|
|
15
|
+
*/
|
|
16
|
+
export type CanJump = (index: number, current: number) => boolean;
|
|
11
17
|
/**
|
|
12
18
|
* 步骤条(**自绘**;节点式 + 燕尾段式 + 进度条)。
|
|
13
19
|
*
|
|
@@ -23,7 +29,28 @@ export type StepsVariant = 'node' | 'bar';
|
|
|
23
29
|
* - `variant="node"`(缺省):节点 + 同行标题 + 点线折角箭头,段长弹性 —— 步骤数少、要给每步留标题时用;
|
|
24
30
|
* - `variant="bar"`:燕尾段条(定宽 140、相邻重叠 10),只有当前段是主色 —— 段数固定、像进度分段时用。
|
|
25
31
|
*
|
|
26
|
-
*
|
|
32
|
+
* ## 可点档(`clickable`)
|
|
33
|
+
*
|
|
34
|
+
* 规范未演示跳步 ⇒ **缺省不可点**(连手型都不给;步的标签与类名也与老版本一致,只多一个
|
|
35
|
+
* `aria-current="step"` —— 那是当前步的语义标注,与可不可点无关)。要跳转就显式开
|
|
36
|
+
* `clickable`:步渲染成**原生 `<button>`**(键盘 / 焦点 / 禁用都交浏览器)。
|
|
37
|
+
*
|
|
38
|
+
* ### 「哪几步能跳」由调用方给(`canJump`)
|
|
39
|
+
*
|
|
40
|
+
* 本件**不猜业务规则**:`canJump` 缺省 `true`(每一不都可跳),要限制就注入一条判定:
|
|
41
|
+
*
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Steps clickable :can-jump="(index, current) => index <= current" … />
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* 为什么不给内置的「前进最多一步 / 只允许后退」默认:向导的「往前走」几乎总带着前置校验
|
|
47
|
+
* (扫过了吗 / 风险确认了吗),而**步骤条上的点击不会跑那些校验** —— 件若自己放开一步,
|
|
48
|
+
* 就等于给了一条绕开门禁的旁路;可若定成「一律不许前进」,那又是替业务做了决定。
|
|
49
|
+
* 通用件该回答的是「能不能跳」,答案让调用方给。
|
|
50
|
+
*
|
|
51
|
+
* 本件**不给 `beforeChange` / `onBeforeChange` 一类的钩子**:它认 `current`(受控件),件本就不自己
|
|
52
|
+
* 换步,「跳转前验证」的落点是**渲染期的 `disabled`** —— 在事件里再判一次只会得到
|
|
53
|
+
* 「看着可点、点了没反应」这个更差的状态。
|
|
27
54
|
*
|
|
28
55
|
* 进度条(`Steps.Progress`)单列,用于"跑到百分之几"这类无步骤语义的场景。
|
|
29
56
|
*
|
|
@@ -53,7 +80,43 @@ export declare const Steps: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
53
80
|
type: PropType<ControlSize>;
|
|
54
81
|
default: string;
|
|
55
82
|
};
|
|
56
|
-
|
|
83
|
+
/**
|
|
84
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。
|
|
85
|
+
*
|
|
86
|
+
* 缺省 `false` —— 规范未演示跳步,件不凭空长交互。开了之后:
|
|
87
|
+
* - 步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环。
|
|
88
|
+
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
89
|
+
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
90
|
+
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
91
|
+
*
|
|
92
|
+
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
93
|
+
*/
|
|
94
|
+
clickable: {
|
|
95
|
+
type: BooleanConstructor;
|
|
96
|
+
default: boolean;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步)。缺省全可跳。
|
|
100
|
+
*
|
|
101
|
+
* 返回 `false` 的步会被画成禁用态(置灰 + `not-allowed`)、拦掉点击、**也不进键盘序列** ——
|
|
102
|
+
* 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着可点、点了没反应」)。
|
|
103
|
+
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
104
|
+
*
|
|
105
|
+
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
106
|
+
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
107
|
+
*/
|
|
108
|
+
canJump: {
|
|
109
|
+
type: PropType<(index: number, current: number) => boolean>;
|
|
110
|
+
default: undefined;
|
|
111
|
+
};
|
|
112
|
+
/** 点击换步(`clickable` 档下生效);`prevIndex` 为点击前的当前步 */
|
|
113
|
+
onChange: {
|
|
114
|
+
type: PropType<(index: number, prevIndex: number) => void>;
|
|
115
|
+
default: undefined;
|
|
116
|
+
};
|
|
117
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
118
|
+
'update:current': (index: number) => true;
|
|
119
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
57
120
|
/** 步骤表(标题 + 可选节点图标) */
|
|
58
121
|
steps: {
|
|
59
122
|
type: PropType<StepsItem[]>;
|
|
@@ -73,15 +136,55 @@ export declare const Steps: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
73
136
|
type: PropType<ControlSize>;
|
|
74
137
|
default: string;
|
|
75
138
|
};
|
|
76
|
-
|
|
139
|
+
/**
|
|
140
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。
|
|
141
|
+
*
|
|
142
|
+
* 缺省 `false` —— 规范未演示跳步,件不凭空长交互。开了之后:
|
|
143
|
+
* - 步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环。
|
|
144
|
+
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
145
|
+
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
146
|
+
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
147
|
+
*
|
|
148
|
+
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
149
|
+
*/
|
|
150
|
+
clickable: {
|
|
151
|
+
type: BooleanConstructor;
|
|
152
|
+
default: boolean;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步)。缺省全可跳。
|
|
156
|
+
*
|
|
157
|
+
* 返回 `false` 的步会被画成禁用态(置灰 + `not-allowed`)、拦掉点击、**也不进键盘序列** ——
|
|
158
|
+
* 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着可点、点了没反应」)。
|
|
159
|
+
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
160
|
+
*
|
|
161
|
+
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
162
|
+
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
163
|
+
*/
|
|
164
|
+
canJump: {
|
|
165
|
+
type: PropType<(index: number, current: number) => boolean>;
|
|
166
|
+
default: undefined;
|
|
167
|
+
};
|
|
168
|
+
/** 点击换步(`clickable` 档下生效);`prevIndex` 为点击前的当前步 */
|
|
169
|
+
onChange: {
|
|
170
|
+
type: PropType<(index: number, prevIndex: number) => void>;
|
|
171
|
+
default: undefined;
|
|
172
|
+
};
|
|
173
|
+
}>> & Readonly<{
|
|
174
|
+
"onUpdate:current"?: ((index: number) => any) | undefined;
|
|
175
|
+
}>, {
|
|
77
176
|
size: ControlSize;
|
|
177
|
+
onChange: (index: number, prevIndex: number) => void;
|
|
78
178
|
variant: StepsVariant;
|
|
79
179
|
current: number;
|
|
80
180
|
steps: StepsItem[];
|
|
181
|
+
clickable: boolean;
|
|
182
|
+
canJump: (index: number, current: number) => boolean;
|
|
81
183
|
}, SlotsType<{
|
|
82
184
|
title?: (context: {
|
|
83
185
|
item: StepsItem;
|
|
84
186
|
index: number;
|
|
187
|
+
disabled: boolean;
|
|
85
188
|
}) => VNodeChild;
|
|
86
189
|
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
87
190
|
export declare const StepsCompound: {
|
|
@@ -105,15 +208,57 @@ export declare const StepsCompound: {
|
|
|
105
208
|
type: PropType<ControlSize>;
|
|
106
209
|
default: string;
|
|
107
210
|
};
|
|
108
|
-
|
|
211
|
+
/**
|
|
212
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。
|
|
213
|
+
*
|
|
214
|
+
* 缺省 `false` —— 规范未演示跳步,件不凭空长交互。开了之后:
|
|
215
|
+
* - 步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环。
|
|
216
|
+
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
217
|
+
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
218
|
+
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
219
|
+
*
|
|
220
|
+
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
221
|
+
*/
|
|
222
|
+
clickable: {
|
|
223
|
+
type: BooleanConstructor;
|
|
224
|
+
default: boolean;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步)。缺省全可跳。
|
|
228
|
+
*
|
|
229
|
+
* 返回 `false` 的步会被画成禁用态(置灰 + `not-allowed`)、拦掉点击、**也不进键盘序列** ——
|
|
230
|
+
* 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着可点、点了没反应」)。
|
|
231
|
+
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
232
|
+
*
|
|
233
|
+
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
234
|
+
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
235
|
+
*/
|
|
236
|
+
canJump: {
|
|
237
|
+
type: PropType<(index: number, current: number) => boolean>;
|
|
238
|
+
default: undefined;
|
|
239
|
+
};
|
|
240
|
+
/** 点击换步(`clickable` 档下生效);`prevIndex` 为点击前的当前步 */
|
|
241
|
+
onChange: {
|
|
242
|
+
type: PropType<(index: number, prevIndex: number) => void>;
|
|
243
|
+
default: undefined;
|
|
244
|
+
};
|
|
245
|
+
}>> & Readonly<{
|
|
246
|
+
"onUpdate:current"?: ((index: number) => any) | undefined;
|
|
247
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
248
|
+
'update:current': (index: number) => true;
|
|
249
|
+
}, import("vue").PublicProps, {
|
|
109
250
|
size: ControlSize;
|
|
251
|
+
onChange: (index: number, prevIndex: number) => void;
|
|
110
252
|
variant: StepsVariant;
|
|
111
253
|
current: number;
|
|
112
254
|
steps: StepsItem[];
|
|
255
|
+
clickable: boolean;
|
|
256
|
+
canJump: (index: number, current: number) => boolean;
|
|
113
257
|
}, true, {}, SlotsType<{
|
|
114
258
|
title?: (context: {
|
|
115
259
|
item: StepsItem;
|
|
116
260
|
index: number;
|
|
261
|
+
disabled: boolean;
|
|
117
262
|
}) => VNodeChild;
|
|
118
263
|
}>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
119
264
|
P: {};
|
|
@@ -142,11 +287,50 @@ export declare const StepsCompound: {
|
|
|
142
287
|
type: PropType<ControlSize>;
|
|
143
288
|
default: string;
|
|
144
289
|
};
|
|
145
|
-
|
|
290
|
+
/**
|
|
291
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。
|
|
292
|
+
*
|
|
293
|
+
* 缺省 `false` —— 规范未演示跳步,件不凭空长交互。开了之后:
|
|
294
|
+
* - 步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环。
|
|
295
|
+
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
296
|
+
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
297
|
+
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
298
|
+
*
|
|
299
|
+
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
300
|
+
*/
|
|
301
|
+
clickable: {
|
|
302
|
+
type: BooleanConstructor;
|
|
303
|
+
default: boolean;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步)。缺省全可跳。
|
|
307
|
+
*
|
|
308
|
+
* 返回 `false` 的步会被画成禁用态(置灰 + `not-allowed`)、拦掉点击、**也不进键盘序列** ——
|
|
309
|
+
* 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着可点、点了没反应」)。
|
|
310
|
+
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
311
|
+
*
|
|
312
|
+
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
313
|
+
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
314
|
+
*/
|
|
315
|
+
canJump: {
|
|
316
|
+
type: PropType<(index: number, current: number) => boolean>;
|
|
317
|
+
default: undefined;
|
|
318
|
+
};
|
|
319
|
+
/** 点击换步(`clickable` 档下生效);`prevIndex` 为点击前的当前步 */
|
|
320
|
+
onChange: {
|
|
321
|
+
type: PropType<(index: number, prevIndex: number) => void>;
|
|
322
|
+
default: undefined;
|
|
323
|
+
};
|
|
324
|
+
}>> & Readonly<{
|
|
325
|
+
"onUpdate:current"?: ((index: number) => any) | undefined;
|
|
326
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
|
|
146
327
|
size: ControlSize;
|
|
328
|
+
onChange: (index: number, prevIndex: number) => void;
|
|
147
329
|
variant: StepsVariant;
|
|
148
330
|
current: number;
|
|
149
331
|
steps: StepsItem[];
|
|
332
|
+
clickable: boolean;
|
|
333
|
+
canJump: (index: number, current: number) => boolean;
|
|
150
334
|
}>;
|
|
151
335
|
__isFragment?: never;
|
|
152
336
|
__isTeleport?: never;
|
|
@@ -171,15 +355,57 @@ export declare const StepsCompound: {
|
|
|
171
355
|
type: PropType<ControlSize>;
|
|
172
356
|
default: string;
|
|
173
357
|
};
|
|
174
|
-
|
|
358
|
+
/**
|
|
359
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。
|
|
360
|
+
*
|
|
361
|
+
* 缺省 `false` —— 规范未演示跳步,件不凭空长交互。开了之后:
|
|
362
|
+
* - 步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环。
|
|
363
|
+
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
364
|
+
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
365
|
+
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
366
|
+
*
|
|
367
|
+
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
368
|
+
*/
|
|
369
|
+
clickable: {
|
|
370
|
+
type: BooleanConstructor;
|
|
371
|
+
default: boolean;
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步)。缺省全可跳。
|
|
375
|
+
*
|
|
376
|
+
* 返回 `false` 的步会被画成禁用态(置灰 + `not-allowed`)、拦掉点击、**也不进键盘序列** ——
|
|
377
|
+
* 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着可点、点了没反应」)。
|
|
378
|
+
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
379
|
+
*
|
|
380
|
+
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
381
|
+
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
382
|
+
*/
|
|
383
|
+
canJump: {
|
|
384
|
+
type: PropType<(index: number, current: number) => boolean>;
|
|
385
|
+
default: undefined;
|
|
386
|
+
};
|
|
387
|
+
/** 点击换步(`clickable` 档下生效);`prevIndex` 为点击前的当前步 */
|
|
388
|
+
onChange: {
|
|
389
|
+
type: PropType<(index: number, prevIndex: number) => void>;
|
|
390
|
+
default: undefined;
|
|
391
|
+
};
|
|
392
|
+
}>> & Readonly<{
|
|
393
|
+
"onUpdate:current"?: ((index: number) => any) | undefined;
|
|
394
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
395
|
+
'update:current': (index: number) => true;
|
|
396
|
+
}, string, {
|
|
175
397
|
size: ControlSize;
|
|
398
|
+
onChange: (index: number, prevIndex: number) => void;
|
|
176
399
|
variant: StepsVariant;
|
|
177
400
|
current: number;
|
|
178
401
|
steps: StepsItem[];
|
|
402
|
+
clickable: boolean;
|
|
403
|
+
canJump: (index: number, current: number) => boolean;
|
|
179
404
|
}, {}, string, SlotsType<{
|
|
180
405
|
title?: (context: {
|
|
181
406
|
item: StepsItem;
|
|
182
407
|
index: number;
|
|
408
|
+
disabled: boolean;
|
|
183
409
|
}) => VNodeChild;
|
|
184
410
|
}>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
185
411
|
Progress: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|