@manohub/ui 0.7.0 → 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 +3 -3
- 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 +1 -1
- package/dist/components/form/index.d.ts +115 -17
- package/dist/components/form/index.js +39 -9
- package/dist/components/layout/index.d.ts +43 -1
- package/dist/components/layout/index.js +22 -2
- package/dist/components/notice/index.d.ts +2 -2
- 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/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 +142 -126
- package/dist/components/tabs/index.js +87 -119
- package/dist/components/tag/index.d.ts +2 -2
- package/dist/components/toast/index.d.ts +8 -8
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -3
- package/dist/styles/components/capsule.css +4 -4
- package/dist/styles/components/form.css +206 -26
- package/dist/styles/components/input.css +28 -1
- package/dist/styles/components/layout.css +2 -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/index.css +3 -3
- package/dist/styles/operations/tabs.css +73 -0
- package/package.json +2 -2
- package/dist/components/tabset/index.d.ts +0 -109
- package/dist/components/tabset/index.js +0 -75
- package/dist/styles/components/tabs.tokens.css +0 -30
- package/dist/styles/operations/tabset.css +0 -57
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
2
|
+
import { type Padding } from '../part-padding';
|
|
2
3
|
/**
|
|
3
4
|
* 布局间距档:**只开放令牌档位,不开放任意 px**(`none/sm/md/lg/xl` → `0 / --ui-space-1/2/3/4`)。
|
|
4
5
|
*
|
|
@@ -32,7 +33,8 @@ export type LayoutSpan = 1 | 2 | 3 | 4;
|
|
|
32
33
|
*
|
|
33
34
|
* ## 与其它件的边界
|
|
34
35
|
*
|
|
35
|
-
* - 表单里并排字段用 `Form columns
|
|
36
|
+
* - 表单里并排字段用 `Form` 的 `columns`(它管 label 列、行距与**回落**),不要用本族拼表单
|
|
37
|
+
* —— 本族的列数是**恒定**的,窄了只等分收窄,表单会被压出不可用的窄控件;
|
|
36
38
|
* - 页面级两栏(各自滚动)用 `Page.Split`;
|
|
37
39
|
* - 只有「块与块怎么摆」这一件事归本族,滚动 / 工具位 / 卡片外观都不归它。
|
|
38
40
|
*/
|
|
@@ -63,6 +65,20 @@ export declare const Layout: {
|
|
|
63
65
|
type: NumberConstructor;
|
|
64
66
|
default: undefined;
|
|
65
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* 内距:**走骨架件共享口径**(`Padding`,同 `Card` / `Form` / `Page` / `Panel`)——
|
|
70
|
+
* `number` 四边同值、`{ y, x }` 分上下 / 左右、`string` 原样下发(CSS 简写,**逃生舱**)。
|
|
71
|
+
* 口径与理由见 `part-padding.ts`。
|
|
72
|
+
*
|
|
73
|
+
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 ——
|
|
74
|
+
* 内距在设计稿里常是**确定坐标**,令牌梯度(最大 24px)表达不了。
|
|
75
|
+
* ⚠️ 用它之前先想一次:这个数真是「内距」吗?若是「与某个内容列对齐」这类**布局坐标**,
|
|
76
|
+
* 优先改由结构表达(同轴容器 / `columns` / `minColumnWidth`)。
|
|
77
|
+
*/
|
|
78
|
+
padding: {
|
|
79
|
+
type: PropType<Padding>;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
66
82
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
67
83
|
/** 行间距档(默认 `md` 8px;要贴紧写 `none`) */
|
|
68
84
|
gap: {
|
|
@@ -89,7 +105,22 @@ export declare const Layout: {
|
|
|
89
105
|
type: NumberConstructor;
|
|
90
106
|
default: undefined;
|
|
91
107
|
};
|
|
108
|
+
/**
|
|
109
|
+
* 内距:**走骨架件共享口径**(`Padding`,同 `Card` / `Form` / `Page` / `Panel`)——
|
|
110
|
+
* `number` 四边同值、`{ y, x }` 分上下 / 左右、`string` 原样下发(CSS 简写,**逃生舱**)。
|
|
111
|
+
* 口径与理由见 `part-padding.ts`。
|
|
112
|
+
*
|
|
113
|
+
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 ——
|
|
114
|
+
* 内距在设计稿里常是**确定坐标**,令牌梯度(最大 24px)表达不了。
|
|
115
|
+
* ⚠️ 用它之前先想一次:这个数真是「内距」吗?若是「与某个内容列对齐」这类**布局坐标**,
|
|
116
|
+
* 优先改由结构表达(同轴容器 / `columns` / `minColumnWidth`)。
|
|
117
|
+
*/
|
|
118
|
+
padding: {
|
|
119
|
+
type: PropType<Padding>;
|
|
120
|
+
default: undefined;
|
|
121
|
+
};
|
|
92
122
|
}>> & Readonly<{}>, {
|
|
123
|
+
padding: Padding;
|
|
93
124
|
justify: LayoutJustify;
|
|
94
125
|
gap: LayoutGap;
|
|
95
126
|
align: LayoutAlign;
|
|
@@ -124,6 +155,11 @@ export declare const Layout: {
|
|
|
124
155
|
type: PropType<LayoutSpan>;
|
|
125
156
|
default: number;
|
|
126
157
|
};
|
|
158
|
+
/** 内距:口径同 `Layout.Row`(共享 `Padding`,复用 `mergePartStyle`) */
|
|
159
|
+
padding: {
|
|
160
|
+
type: PropType<Padding>;
|
|
161
|
+
default: undefined;
|
|
162
|
+
};
|
|
127
163
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
128
164
|
/** 单元内间距档(默认 `md` 8px;要贴紧写 `none`) */
|
|
129
165
|
gap: {
|
|
@@ -150,7 +186,13 @@ export declare const Layout: {
|
|
|
150
186
|
type: PropType<LayoutSpan>;
|
|
151
187
|
default: number;
|
|
152
188
|
};
|
|
189
|
+
/** 内距:口径同 `Layout.Row`(共享 `Padding`,复用 `mergePartStyle`) */
|
|
190
|
+
padding: {
|
|
191
|
+
type: PropType<Padding>;
|
|
192
|
+
default: undefined;
|
|
193
|
+
};
|
|
153
194
|
}>> & Readonly<{}>, {
|
|
195
|
+
padding: Padding;
|
|
154
196
|
wrap: boolean;
|
|
155
197
|
justify: LayoutJustify;
|
|
156
198
|
span: LayoutSpan;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, createVNode } from "vue";
|
|
2
|
+
import { mergePartStyle } from "../part-padding.js";
|
|
2
3
|
function modifier(base, name, value) {
|
|
3
4
|
return value === void 0 || value === "" ? "" : `${base}--${name}-${value}`;
|
|
4
5
|
}
|
|
@@ -30,6 +31,11 @@ const LayoutColumn = /* @__PURE__ */ defineComponent({
|
|
|
30
31
|
span: {
|
|
31
32
|
type: Number,
|
|
32
33
|
default: 1
|
|
34
|
+
},
|
|
35
|
+
/** 内距:口径同 `Layout.Row`(共享 `Padding`,复用 `mergePartStyle`) */
|
|
36
|
+
padding: {
|
|
37
|
+
type: [Number, Object, String],
|
|
38
|
+
default: void 0
|
|
33
39
|
}
|
|
34
40
|
},
|
|
35
41
|
slots: Object,
|
|
@@ -39,7 +45,7 @@ const LayoutColumn = /* @__PURE__ */ defineComponent({
|
|
|
39
45
|
}) {
|
|
40
46
|
return () => createVNode("div", {
|
|
41
47
|
"class": ["mh-layout-column", modifier("mh-layout-column", "gap", props.gap), modifier("mh-layout-column", "align", props.align), props.justify && props.justify !== "start" ? modifier("mh-layout-column", "justify", props.justify) : "", props.wrap ? "mh-layout-column--wrap" : "", props.span > 1 ? `mh-layout-column--span-${props.span}` : "", attrs.class].filter(Boolean).join(" "),
|
|
42
|
-
"style": attrs.style
|
|
48
|
+
"style": mergePartStyle(attrs.style, props.padding)
|
|
43
49
|
}, [slots.default?.()]);
|
|
44
50
|
}
|
|
45
51
|
});
|
|
@@ -71,6 +77,20 @@ const LayoutRow = /* @__PURE__ */ defineComponent({
|
|
|
71
77
|
minColumnWidth: {
|
|
72
78
|
type: Number,
|
|
73
79
|
default: void 0
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* 内距:**走骨架件共享口径**(`Padding`,同 `Card` / `Form` / `Page` / `Panel`)——
|
|
83
|
+
* `number` 四边同值、`{ y, x }` 分上下 / 左右、`string` 原样下发(CSS 简写,**逃生舱**)。
|
|
84
|
+
* 口径与理由见 `part-padding.ts`。
|
|
85
|
+
*
|
|
86
|
+
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 ——
|
|
87
|
+
* 内距在设计稿里常是**确定坐标**,令牌梯度(最大 24px)表达不了。
|
|
88
|
+
* ⚠️ 用它之前先想一次:这个数真是「内距」吗?若是「与某个内容列对齐」这类**布局坐标**,
|
|
89
|
+
* 优先改由结构表达(同轴容器 / `columns` / `minColumnWidth`)。
|
|
90
|
+
*/
|
|
91
|
+
padding: {
|
|
92
|
+
type: [Number, Object, String],
|
|
93
|
+
default: void 0
|
|
74
94
|
}
|
|
75
95
|
},
|
|
76
96
|
slots: Object,
|
|
@@ -86,7 +106,7 @@ const LayoutRow = /* @__PURE__ */ defineComponent({
|
|
|
86
106
|
if (props.minColumnWidth) style["--mh-layout-row-min"] = `${props.minColumnWidth}px`;
|
|
87
107
|
return createVNode("div", {
|
|
88
108
|
"class": ["mh-layout-row", modifier("mh-layout-row", "gap", props.gap), modifier("mh-layout-row", "align", props.align), props.justify && props.justify !== "start" ? modifier("mh-layout-row", "justify", props.justify) : "", isGrid ? "mh-layout-row--grid" : "", isGrid ? modifier("mh-layout-row", "columns", props.columns) : "", attrs.class].filter(Boolean).join(" "),
|
|
89
|
-
"style": style
|
|
109
|
+
"style": mergePartStyle(style, props.padding)
|
|
90
110
|
}, [slots.default?.()]);
|
|
91
111
|
};
|
|
92
112
|
}
|
|
@@ -136,11 +136,11 @@ export declare const Notice: import("vue").DefineComponent<import("vue").Extract
|
|
|
136
136
|
default: undefined;
|
|
137
137
|
};
|
|
138
138
|
}>> & Readonly<{}>, {
|
|
139
|
-
icon: boolean | "
|
|
139
|
+
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";
|
|
140
140
|
onClose: () => void;
|
|
141
141
|
message: string;
|
|
142
|
-
tone: NoticeTone;
|
|
143
142
|
closable: boolean;
|
|
143
|
+
tone: NoticeTone;
|
|
144
144
|
description: string;
|
|
145
145
|
action: string;
|
|
146
146
|
closeText: string;
|
|
@@ -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",
|
|
@@ -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<{
|