@manohub/ui 1.0.4 → 1.0.6
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 +8 -2
- package/dist/components/badge/index.d.ts +24 -46
- package/dist/components/badge/index.js +7 -11
- package/dist/components/button/index.d.ts +11 -31
- package/dist/components/capsule/index.d.ts +13 -27
- package/dist/components/card/index.d.ts +28 -62
- package/dist/components/checkbox/index.d.ts +1 -9
- package/dist/components/code-block/index.d.ts +28 -55
- package/dist/components/collapse/index.d.ts +2 -0
- package/dist/components/dialog/index.d.ts +9 -18
- package/dist/components/dialog/index.js +3 -2
- package/dist/components/divider/index.d.ts +1 -12
- package/dist/components/drawer/index.d.ts +7 -15
- package/dist/components/filter/index.d.ts +27 -69
- package/dist/components/filter/index.js +3 -8
- package/dist/components/form/index.d.ts +86 -218
- package/dist/components/form/index.js +5 -12
- package/dist/components/input/bordered.d.ts +4 -6
- package/dist/components/input/index.d.ts +36 -83
- package/dist/components/input/index.js +6 -11
- package/dist/components/input/number-input.d.ts +11 -23
- package/dist/components/layout/index.d.ts +21 -28
- package/dist/components/layout/index.js +5 -8
- package/dist/components/list-view/index.d.ts +10 -43
- package/dist/components/loading/index.d.ts +8 -19
- package/dist/components/nav/index.d.ts +14 -35
- package/dist/components/nav/index.js +1 -3
- package/dist/components/notice/index.d.ts +13 -33
- package/dist/components/notice/index.js +3 -5
- package/dist/components/notification/index.d.ts +0 -9
- package/dist/components/page/index.d.ts +29 -71
- package/dist/components/page/split-resize.d.ts +9 -18
- package/dist/components/pagination/index.d.ts +1 -5
- package/dist/components/panel/index.d.ts +33 -70
- package/dist/components/panel/index.js +1 -4
- package/dist/components/part-padding.d.ts +5 -13
- package/dist/components/query-state/index.d.ts +8 -32
- package/dist/components/radio/index.d.ts +13 -17
- package/dist/components/search/index.d.ts +12 -32
- package/dist/components/select/index.d.ts +30 -49
- package/dist/components/select/index.js +3 -3
- package/dist/components/select/select-panel.d.ts +23 -35
- package/dist/components/select/select-panel.js +5 -10
- package/dist/components/select/select-shared.d.ts +18 -44
- package/dist/components/select/select-tree.d.ts +11 -16
- package/dist/components/select/select-trigger.d.ts +6 -16
- package/dist/components/select/select-trigger.js +5 -11
- package/dist/components/skeleton/index.d.ts +1 -5
- package/dist/components/steps/index.d.ts +55 -111
- package/dist/components/steps/index.js +8 -16
- package/dist/components/switch/index.d.ts +17 -33
- package/dist/components/switch/index.js +2 -4
- package/dist/components/tabbar/index.d.ts +1 -6
- package/dist/components/table/index.d.ts +20 -72
- package/dist/components/table/index.js +4 -8
- package/dist/components/tabs/index.d.ts +22 -44
- package/dist/components/text/index.d.ts +10 -21
- package/dist/components/toast/index.d.ts +4 -13
- package/dist/components/tooltip/index.d.ts +1 -12
- package/dist/components/tree/index.d.ts +51 -101
- package/dist/components/tree/index.js +17 -33
- package/dist/components/upload/index.d.ts +1 -4
- package/dist/index.d.ts +2 -2
- package/dist/services/base.d.ts +32 -8
- package/dist/services/dialog.d.ts +13 -23
- package/dist/services/dialog.js +2 -0
- package/dist/services/index.d.ts +2 -2
- package/dist/services/loading.d.ts +9 -12
- package/dist/services/loading.js +8 -1
- package/dist/services/toast.d.ts +4 -14
- package/dist/styles/components/avatar.css +5 -7
- package/dist/styles/components/avatar.tokens.css +4 -9
- package/dist/styles/components/badge.css +3 -6
- package/dist/styles/components/badge.tokens.css +5 -17
- package/dist/styles/components/button.css +35 -57
- package/dist/styles/components/button.tokens.css +5 -14
- package/dist/styles/components/capsule.css +13 -20
- package/dist/styles/components/capsule.tokens.css +4 -9
- package/dist/styles/components/card.css +13 -24
- package/dist/styles/components/checkbox.css +11 -15
- package/dist/styles/components/checkbox.tokens.css +4 -9
- package/dist/styles/components/code-block.css +30 -40
- package/dist/styles/components/code-block.tokens.css +7 -20
- package/dist/styles/components/collapse.css +6 -10
- package/dist/styles/components/collapse.tokens.css +4 -9
- package/dist/styles/components/dialog.css +19 -27
- package/dist/styles/components/dialog.tokens.css +9 -9
- package/dist/styles/components/divider.css +9 -14
- package/dist/styles/components/divider.tokens.css +4 -9
- package/dist/styles/components/drawer.css +12 -16
- package/dist/styles/components/drawer.tokens.css +7 -9
- package/dist/styles/components/filter.css +13 -24
- package/dist/styles/components/form.css +77 -149
- package/dist/styles/components/form.tokens.css +9 -6
- package/dist/styles/components/input.css +73 -177
- package/dist/styles/components/input.tokens.css +5 -13
- package/dist/styles/components/layout.css +13 -29
- package/dist/styles/components/loading.css +6 -10
- package/dist/styles/components/loading.tokens.css +4 -9
- package/dist/styles/components/notice.css +3 -1
- package/dist/styles/components/notice.tokens.css +8 -6
- package/dist/styles/components/notification.css +9 -12
- package/dist/styles/components/notification.tokens.css +4 -12
- package/dist/styles/components/page.css +32 -48
- package/dist/styles/components/pagination.css +14 -15
- package/dist/styles/components/pagination.tokens.css +4 -9
- package/dist/styles/components/query-state.css +1 -1
- package/dist/styles/components/query-state.tokens.css +6 -0
- package/dist/styles/components/radio.css +12 -25
- package/dist/styles/components/radio.tokens.css +4 -9
- package/dist/styles/components/search.css +8 -18
- package/dist/styles/components/select.css +63 -109
- package/dist/styles/components/select.tokens.css +4 -12
- package/dist/styles/components/skeleton.css +4 -7
- package/dist/styles/components/skeleton.tokens.css +4 -9
- package/dist/styles/components/steps.css +9 -12
- package/dist/styles/components/steps.tokens.css +4 -12
- package/dist/styles/components/switch.css +7 -8
- package/dist/styles/components/switch.tokens.css +4 -9
- package/dist/styles/components/tabbar.css +12 -11
- package/dist/styles/components/tabbar.tokens.css +4 -9
- package/dist/styles/components/table.css +52 -93
- package/dist/styles/components/table.tokens.css +5 -6
- package/dist/styles/components/tag.css +13 -23
- package/dist/styles/components/tag.tokens.css +5 -11
- package/dist/styles/components/text.css +11 -23
- package/dist/styles/components/toast.css +11 -18
- package/dist/styles/components/toast.tokens.css +6 -9
- package/dist/styles/components/tooltip.css +9 -11
- package/dist/styles/components/tooltip.tokens.css +5 -9
- package/dist/styles/components/tree.css +14 -27
- package/dist/styles/components/tree.tokens.css +5 -6
- package/dist/styles/components/upload.css +10 -13
- package/dist/styles/components/upload.tokens.css +4 -9
- package/dist/styles/index.css +27 -50
- package/dist/styles/operations/collapse.css +12 -25
- package/dist/styles/operations/popup.css +41 -79
- package/dist/styles/operations/tabs.css +14 -32
- package/dist/styles/reset.css +0 -61
- package/package.json +2 -2
|
@@ -9,9 +9,10 @@ export interface StepsItem {
|
|
|
9
9
|
}
|
|
10
10
|
export type StepsVariant = 'node' | 'bar';
|
|
11
11
|
/**
|
|
12
|
-
* 跳转验证:**能不能跳到第 `index` 步**(`current`
|
|
12
|
+
* 跳转验证:**能不能跳到第 `index` 步**(`current` 是当前步)。不传即「全可跳」—— 件不猜业务规则,限制由调用方
|
|
13
|
+
* 注入(如「只允许回退」= `i <= current`)。
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
+
* 用法见 `docs/demos/steps/`(每个维度一份可运行样例;文档页 `docs/components/steps.md`)。
|
|
15
16
|
*/
|
|
16
17
|
export type CanJump = (index: number, current: number) => boolean;
|
|
17
18
|
/**
|
|
@@ -19,46 +20,29 @@ export type CanJump = (index: number, current: number) => boolean;
|
|
|
19
20
|
*
|
|
20
21
|
* ## 状态怎么给
|
|
21
22
|
*
|
|
22
|
-
* 只认一个数:`current`(当前步下标,0
|
|
23
|
+
* 只认一个数:`current`(当前步下标,0 起)—— **小于它的都是已完成**、大于它是未开始。由本件按下标算出
|
|
23
24
|
* `--done` / `--current` 与连线是否 `--active`,调用方不必自己拼类名。
|
|
24
|
-
*
|
|
25
25
|
* 连线取「**当前步之后那一段**」为活动档(规范实测取向):已完成步之后的连线仍是灰的,别做成"已完成段全蓝"。
|
|
26
26
|
*
|
|
27
27
|
* ## 两种形态的判据
|
|
28
28
|
*
|
|
29
29
|
* - `variant="node"`(缺省):节点 + 同行标题 + 点线折角箭头,段长弹性 —— 步骤数少、要给每步留标题时用;
|
|
30
|
-
* - `variant="bar"`:燕尾段条(定宽 140、相邻重叠 10),只有当前段是主色 ——
|
|
30
|
+
* - `variant="bar"`:燕尾段条(定宽 140、相邻重叠 10),只有当前段是主色 —— 段数固定时用。
|
|
31
31
|
*
|
|
32
32
|
* ## 可点档(`clickable`)
|
|
33
33
|
*
|
|
34
|
-
* 规范未演示跳步 ⇒
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* 为什么不给内置的「前进最多一步 / 只允许后退」默认:向导的「往前走」几乎总带着前置校验
|
|
47
|
-
* (扫过了吗 / 风险确认了吗),而**步骤条上的点击不会跑那些校验** —— 件若自己放开一步,
|
|
48
|
-
* 就等于给了一条绕开门禁的旁路;可若定成「一律不许前进」,那又是替业务做了决定。
|
|
49
|
-
* 通用件该回答的是「能不能跳」,答案让调用方给。
|
|
50
|
-
*
|
|
51
|
-
* 本件**不给 `beforeChange` / `onBeforeChange` 一类的钩子**:它认 `current`(受控件),件本就不自己
|
|
52
|
-
* 换步,「跳转前验证」的落点是**渲染期的 `disabled`** —— 在事件里再判一次只会得到
|
|
53
|
-
* 「看着可点、点了没反应」这个更差的状态。
|
|
34
|
+
* 规范未演示跳步 ⇒ **缺省不可点**(连手型都不给;步的标签与类名与老版本一致,只多一个 `aria-current="step"`
|
|
35
|
+
* —— 那是当前步的语义标注,与可不可点无关)。要跳转就显式开 `clickable`:步渲染成**原生 `<button>`**
|
|
36
|
+
* (键盘 / 焦点 / 禁用都交浏览器)。
|
|
37
|
+
* **「哪几步能跳」由调用方给(`canJump`)**:本件**不猜业务规则**,`canJump` 缺省 `true`(每一步都可跳),要
|
|
38
|
+
* 限制就注入一条判定 —— `<Steps clickable :can-jump="(index, current) => index <= current" … />`。
|
|
39
|
+
* 为什么不内置「前进最多一步 / 只允许后退」:向导的「往前走」几乎总带着前置校验,而**步骤条上的点击不会跑那些
|
|
40
|
+
* 校验** —— 件自己放开一步就等于给了一条绕开门禁的旁路;定成「一律不许前进」又是替业务做决定。
|
|
41
|
+
* 也**不给 `beforeChange` / `onBeforeChange` 一类钩子**:它认 `current`(受控件)、本就不自己换步,
|
|
42
|
+
* 「跳转前验证」的落点是**渲染期的 `disabled`**(在事件里再判一次只会得到「看着可点、点了没反应」这个更差的
|
|
43
|
+
* 状态)。
|
|
54
44
|
*
|
|
55
45
|
* 进度条(`Steps.Progress`)单列,用于"跑到百分之几"这类无步骤语义的场景。
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* <Steps :steps="[{title:'填单'},{title:'审批'},{title:'完成'}]" :current="1" />
|
|
59
|
-
*
|
|
60
|
-
* @example 燕尾段式
|
|
61
|
-
* <Steps variant="bar" :steps="[{title:'支付明细'},{title:'确认'}]" :current="0" />
|
|
62
46
|
*/
|
|
63
47
|
export declare const Steps: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
64
48
|
/** 步骤表(标题 + 可选节点图标) */
|
|
@@ -81,14 +65,10 @@ export declare const Steps: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
65
|
default: string;
|
|
82
66
|
};
|
|
83
67
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
89
|
-
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
90
|
-
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
91
|
-
*
|
|
68
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。缺省 `false`(规范未演示跳步,件不凭空长交互)。
|
|
69
|
+
* 开了之后:步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环(不要再
|
|
70
|
+
* 靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持);「哪几步能跳」由
|
|
71
|
+
* `canJump` 决定(缺省全可跳);点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
92
72
|
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
93
73
|
*/
|
|
94
74
|
clickable: {
|
|
@@ -96,14 +76,10 @@ export declare const Steps: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
96
76
|
default: boolean;
|
|
97
77
|
};
|
|
98
78
|
/**
|
|
99
|
-
* 跳转验证:**能不能跳到第 `index`
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
104
|
-
*
|
|
105
|
-
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
106
|
-
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
79
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步),缺省全可跳。返回 `false` 的步会被画成禁用态(置灰 +
|
|
80
|
+
* `not-allowed`)、拦掉点击、**也不进键盘序列** —— 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着
|
|
81
|
+
* 可点、点了没反应」);需要异步验证时先把结果存进状态、再据此返回。
|
|
82
|
+
* ⚠️ 它只回答「能不能跳」;若某一步是「本身不可用」(不论从哪来)也用它统一表达 —— 本件不另设行级 `disabled`。
|
|
107
83
|
*/
|
|
108
84
|
canJump: {
|
|
109
85
|
type: PropType<(index: number, current: number) => boolean>;
|
|
@@ -137,14 +113,10 @@ export declare const Steps: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
137
113
|
default: string;
|
|
138
114
|
};
|
|
139
115
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
145
|
-
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
146
|
-
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
147
|
-
*
|
|
116
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。缺省 `false`(规范未演示跳步,件不凭空长交互)。
|
|
117
|
+
* 开了之后:步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环(不要再
|
|
118
|
+
* 靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持);「哪几步能跳」由
|
|
119
|
+
* `canJump` 决定(缺省全可跳);点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
148
120
|
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
149
121
|
*/
|
|
150
122
|
clickable: {
|
|
@@ -152,14 +124,10 @@ export declare const Steps: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
152
124
|
default: boolean;
|
|
153
125
|
};
|
|
154
126
|
/**
|
|
155
|
-
* 跳转验证:**能不能跳到第 `index`
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
160
|
-
*
|
|
161
|
-
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
162
|
-
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
127
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步),缺省全可跳。返回 `false` 的步会被画成禁用态(置灰 +
|
|
128
|
+
* `not-allowed`)、拦掉点击、**也不进键盘序列** —— 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着
|
|
129
|
+
* 可点、点了没反应」);需要异步验证时先把结果存进状态、再据此返回。
|
|
130
|
+
* ⚠️ 它只回答「能不能跳」;若某一步是「本身不可用」(不论从哪来)也用它统一表达 —— 本件不另设行级 `disabled`。
|
|
163
131
|
*/
|
|
164
132
|
canJump: {
|
|
165
133
|
type: PropType<(index: number, current: number) => boolean>;
|
|
@@ -209,14 +177,10 @@ export declare const StepsCompound: {
|
|
|
209
177
|
default: string;
|
|
210
178
|
};
|
|
211
179
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
217
|
-
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
218
|
-
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
219
|
-
*
|
|
180
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。缺省 `false`(规范未演示跳步,件不凭空长交互)。
|
|
181
|
+
* 开了之后:步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环(不要再
|
|
182
|
+
* 靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持);「哪几步能跳」由
|
|
183
|
+
* `canJump` 决定(缺省全可跳);点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
220
184
|
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
221
185
|
*/
|
|
222
186
|
clickable: {
|
|
@@ -224,14 +188,10 @@ export declare const StepsCompound: {
|
|
|
224
188
|
default: boolean;
|
|
225
189
|
};
|
|
226
190
|
/**
|
|
227
|
-
* 跳转验证:**能不能跳到第 `index`
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
232
|
-
*
|
|
233
|
-
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
234
|
-
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
191
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步),缺省全可跳。返回 `false` 的步会被画成禁用态(置灰 +
|
|
192
|
+
* `not-allowed`)、拦掉点击、**也不进键盘序列** —— 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着
|
|
193
|
+
* 可点、点了没反应」);需要异步验证时先把结果存进状态、再据此返回。
|
|
194
|
+
* ⚠️ 它只回答「能不能跳」;若某一步是「本身不可用」(不论从哪来)也用它统一表达 —— 本件不另设行级 `disabled`。
|
|
235
195
|
*/
|
|
236
196
|
canJump: {
|
|
237
197
|
type: PropType<(index: number, current: number) => boolean>;
|
|
@@ -288,14 +248,10 @@ export declare const StepsCompound: {
|
|
|
288
248
|
default: string;
|
|
289
249
|
};
|
|
290
250
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
296
|
-
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
297
|
-
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
298
|
-
*
|
|
251
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。缺省 `false`(规范未演示跳步,件不凭空长交互)。
|
|
252
|
+
* 开了之后:步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环(不要再
|
|
253
|
+
* 靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持);「哪几步能跳」由
|
|
254
|
+
* `canJump` 决定(缺省全可跳);点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
299
255
|
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
300
256
|
*/
|
|
301
257
|
clickable: {
|
|
@@ -303,14 +259,10 @@ export declare const StepsCompound: {
|
|
|
303
259
|
default: boolean;
|
|
304
260
|
};
|
|
305
261
|
/**
|
|
306
|
-
* 跳转验证:**能不能跳到第 `index`
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
311
|
-
*
|
|
312
|
-
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
313
|
-
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
262
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步),缺省全可跳。返回 `false` 的步会被画成禁用态(置灰 +
|
|
263
|
+
* `not-allowed`)、拦掉点击、**也不进键盘序列** —— 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着
|
|
264
|
+
* 可点、点了没反应」);需要异步验证时先把结果存进状态、再据此返回。
|
|
265
|
+
* ⚠️ 它只回答「能不能跳」;若某一步是「本身不可用」(不论从哪来)也用它统一表达 —— 本件不另设行级 `disabled`。
|
|
314
266
|
*/
|
|
315
267
|
canJump: {
|
|
316
268
|
type: PropType<(index: number, current: number) => boolean>;
|
|
@@ -356,14 +308,10 @@ export declare const StepsCompound: {
|
|
|
356
308
|
default: string;
|
|
357
309
|
};
|
|
358
310
|
/**
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
364
|
-
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
365
|
-
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
366
|
-
*
|
|
311
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。缺省 `false`(规范未演示跳步,件不凭空长交互)。
|
|
312
|
+
* 开了之后:步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环(不要再
|
|
313
|
+
* 靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持);「哪几步能跳」由
|
|
314
|
+
* `canJump` 决定(缺省全可跳);点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
367
315
|
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
368
316
|
*/
|
|
369
317
|
clickable: {
|
|
@@ -371,14 +319,10 @@ export declare const StepsCompound: {
|
|
|
371
319
|
default: boolean;
|
|
372
320
|
};
|
|
373
321
|
/**
|
|
374
|
-
* 跳转验证:**能不能跳到第 `index`
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
379
|
-
*
|
|
380
|
-
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
381
|
-
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
322
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步),缺省全可跳。返回 `false` 的步会被画成禁用态(置灰 +
|
|
323
|
+
* `not-allowed`)、拦掉点击、**也不进键盘序列** —— 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着
|
|
324
|
+
* 可点、点了没反应」);需要异步验证时先把结果存进状态、再据此返回。
|
|
325
|
+
* ⚠️ 它只回答「能不能跳」;若某一步是「本身不可用」(不论从哪来)也用它统一表达 —— 本件不另设行级 `disabled`。
|
|
382
326
|
*/
|
|
383
327
|
canJump: {
|
|
384
328
|
type: PropType<(index: number, current: number) => boolean>;
|
|
@@ -24,14 +24,10 @@ const Steps = /* @__PURE__ */ defineComponent({
|
|
|
24
24
|
default: "md"
|
|
25
25
|
},
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* 不要再靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持;
|
|
32
|
-
* - 「哪几步能跳」由 `canJump` 决定(缺省全可跳);
|
|
33
|
-
* - 点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
34
|
-
*
|
|
27
|
+
* 步骤可点:点某步即切到该步(**节点与标题整块**都是点击区)。缺省 `false`(规范未演示跳步,件不凭空长交互)。
|
|
28
|
+
* 开了之后:步渲染成**原生 `<button type="button">`** ⇒ 键盘 Tab/Enter 可达、`:focus-visible` 有焦点环(不要再
|
|
29
|
+
* 靠 `title` 插槽自绘可点元素:那会嵌进 `<button>` 形成嵌套交互,且拿不到键盘支持);「哪几步能跳」由
|
|
30
|
+
* `canJump` 决定(缺省全可跳);点击发 `update:current`(可写 `v-model:current`)与 `onChange`。
|
|
35
31
|
* ⚠️ 「跳转前验证」写在**渲染期**(`disabled`),不要写成点击时的事件拦截 —— 见文件头。
|
|
36
32
|
*/
|
|
37
33
|
clickable: {
|
|
@@ -39,14 +35,10 @@ const Steps = /* @__PURE__ */ defineComponent({
|
|
|
39
35
|
default: false
|
|
40
36
|
},
|
|
41
37
|
/**
|
|
42
|
-
* 跳转验证:**能不能跳到第 `index`
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* 需要异步验证才能决定能不能跳时,把结果先存进状态、再据此返回。
|
|
47
|
-
*
|
|
48
|
-
* ⚠️ 它只回答「能不能跳」。若某一步是「本身不可用」(不论从哪来),也用它统一表达 ——
|
|
49
|
-
* 本件不另设行级 `disabled`,免得同一条规则散在两处。
|
|
38
|
+
* 跳转验证:**能不能跳到第 `index` 步**(第二参是当前步),缺省全可跳。返回 `false` 的步会被画成禁用态(置灰 +
|
|
39
|
+
* `not-allowed`)、拦掉点击、**也不进键盘序列** —— 判定跑在**渲染期**,不是「点了再拦」(那样只能得到「看着
|
|
40
|
+
* 可点、点了没反应」);需要异步验证时先把结果存进状态、再据此返回。
|
|
41
|
+
* ⚠️ 它只回答「能不能跳」;若某一步是「本身不可用」(不论从哪来)也用它统一表达 —— 本件不另设行级 `disabled`。
|
|
50
42
|
*/
|
|
51
43
|
canJump: {
|
|
52
44
|
type: Function,
|
|
@@ -3,35 +3,23 @@ import type { ControlSize } from '../control-size';
|
|
|
3
3
|
/**
|
|
4
4
|
* 开关(**自绘**,不封装 farris)。
|
|
5
5
|
*
|
|
6
|
-
* 统一词表(与 `Checkbox` / `Radio` 同款):`modelValue` / `onChange` / `disabled` / `size
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* 统一词表(与 `Checkbox` / `Radio` 同款):`modelValue` / `onChange` / `disabled` / `size`。三档尺寸:`sm` 28×14 /
|
|
7
|
+
* `md` 36×18(表格与列表档)/ `lg` 50×24(表单档)—— 几何全在样式层的 `--ui-switch-*` 令牌里,档位只覆盖令牌;
|
|
8
|
+
* `form` 是 `size="lg"` 的既有写法。
|
|
9
9
|
*
|
|
10
|
-
* 实现要点(与 `Checkbox`
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - `labelPosition` 用 flex `order` 翻转,**不改 DOM 顺序** —— 否则那条 `~` 兄弟规则立刻失效。
|
|
10
|
+
* 实现要点(与 `Checkbox` 同配方):真实 `<input type="checkbox">` 负责可访问性与键盘(Tab / Space),视觉由轨道 +
|
|
11
|
+
* 滑块自绘;结构固定 `input → label → track > knob`,样式层靠**通用兄弟** `~` 命中轨道(文字可夹在中间);选中态三源
|
|
12
|
+
* 等价(原生 `:checked` / `data-state` / 静态档 `.is-checked`);`labelPosition` 用 flex `order` 翻转、**不改 DOM
|
|
13
|
+
* 顺序** —— 否则那条 `~` 兄弟规则立刻失效。
|
|
15
14
|
*
|
|
16
15
|
* ## 与 `Form.Item` 的关系(**同一个词别写两遍**)
|
|
16
|
+
* `label` 是**控件自己的文案**(长在根 `<label>` 里,**点它也切换开关**),而 `Form.Item` 的 `label` 是**字段名**
|
|
17
|
+
* (点它只是聚焦控件)—— 两者不是一回事,故放进表单行时**不要再传一次**:字段名归 `Form.Item`,开关只放控件本身。
|
|
18
|
+
* 正确 `<Form.Item label="启用"><Switch v-model={on} /></Form.Item>`;错误 `<Switch label="启用" />`(会显示成
|
|
19
|
+
* 「启用 启用 (开关)」,同一个词出现两遍)。只有**没有表单行**的场合(表格行内 / 工具栏 / 设置面板)才需要 `label`
|
|
20
|
+
* 自带文字,那种场景要把文字放到开关右侧就给 `labelPosition="right"`。
|
|
17
21
|
*
|
|
18
|
-
* `
|
|
19
|
-
* 而 `Form.Item` 的 `label` 是**字段名**(点它只是聚焦控件)。两者不是一回事。
|
|
20
|
-
*
|
|
21
|
-
* 所以放进表单行时**不要再传一次**:字段名归 `Form.Item`,开关只放控件本身。
|
|
22
|
-
*
|
|
23
|
-
* - 正确:`<Form.Item label="启用"><Switch v-model={on} /></Form.Item>`
|
|
24
|
-
* - 错误:`<Form.Item label="启用"><Switch v-model={on} label="启用" /></Form.Item>`
|
|
25
|
-
* —— 同一行会显示成「启用 启用 (开关)」,同一个词出现两遍。
|
|
26
|
-
*
|
|
27
|
-
* 只有**没有表单行**的场合(表格行内 / 工具栏 / 设置面板)才需要 `label` 自己带文字;
|
|
28
|
-
* 那种场景若要把文字放到开关右侧,给 `labelPosition="right"`。
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* <Switch modelValue={on} onChange={(v) => (on = v)} />
|
|
32
|
-
*
|
|
33
|
-
* @example 轨道内文案 + 尺寸 + 加载
|
|
34
|
-
* <Switch v-model={auto} checkedText="开" uncheckedText="关" size="lg" loading={saving} />
|
|
22
|
+
* 用法见 `docs/demos/switch/`(每个维度一份可运行样例;文档页 `docs/components/switch.md`)。
|
|
35
23
|
*/
|
|
36
24
|
export declare const Switch: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
37
25
|
/** 受控开关值 */
|
|
@@ -40,10 +28,8 @@ export declare const Switch: import("vue").DefineComponent<import("vue").Extract
|
|
|
40
28
|
default: boolean;
|
|
41
29
|
};
|
|
42
30
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* ⚠️ 放进 `Form.Item` 时**不要传** —— 字段名由 `Form.Item` 的 `label` 给,
|
|
46
|
-
* 两处写同一个词会显示成「启用 启用 (开关)」。独立使用(表格行内 / 工具栏 / 设置面板)才用它。
|
|
31
|
+
* 开关**自己的文案**(点它也切换;复杂内容走默认插槽)。⚠️ 放进 `Form.Item` 时**不要传** —— 字段名由 `Form.Item`
|
|
32
|
+
* 的 `label` 给,两处写同一个词会显示成「启用 启用 (开关)」。独立使用(表格行内 / 工具栏 / 设置面板)才用它。
|
|
47
33
|
*/
|
|
48
34
|
label: {
|
|
49
35
|
type: StringConstructor;
|
|
@@ -102,10 +88,8 @@ export declare const Switch: import("vue").DefineComponent<import("vue").Extract
|
|
|
102
88
|
default: boolean;
|
|
103
89
|
};
|
|
104
90
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* ⚠️ 放进 `Form.Item` 时**不要传** —— 字段名由 `Form.Item` 的 `label` 给,
|
|
108
|
-
* 两处写同一个词会显示成「启用 启用 (开关)」。独立使用(表格行内 / 工具栏 / 设置面板)才用它。
|
|
91
|
+
* 开关**自己的文案**(点它也切换;复杂内容走默认插槽)。⚠️ 放进 `Form.Item` 时**不要传** —— 字段名由 `Form.Item`
|
|
92
|
+
* 的 `label` 给,两处写同一个词会显示成「启用 启用 (开关)」。独立使用(表格行内 / 工具栏 / 设置面板)才用它。
|
|
109
93
|
*/
|
|
110
94
|
label: {
|
|
111
95
|
type: StringConstructor;
|
|
@@ -9,10 +9,8 @@ const Switch = /* @__PURE__ */ defineComponent({
|
|
|
9
9
|
default: false
|
|
10
10
|
},
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* ⚠️ 放进 `Form.Item` 时**不要传** —— 字段名由 `Form.Item` 的 `label` 给,
|
|
15
|
-
* 两处写同一个词会显示成「启用 启用 (开关)」。独立使用(表格行内 / 工具栏 / 设置面板)才用它。
|
|
12
|
+
* 开关**自己的文案**(点它也切换;复杂内容走默认插槽)。⚠️ 放进 `Form.Item` 时**不要传** —— 字段名由 `Form.Item`
|
|
13
|
+
* 的 `label` 给,两处写同一个词会显示成「启用 启用 (开关)」。独立使用(表格行内 / 工具栏 / 设置面板)才用它。
|
|
16
14
|
*/
|
|
17
15
|
label: {
|
|
18
16
|
type: String,
|
|
@@ -34,12 +34,7 @@ export type TabBarType = 'line' | 'card';
|
|
|
34
34
|
* 给 `more` 插槽即出「更多 ▾」页签 + 操作层浮层(原生 popover,零 JS 开合);哪些页签收进"更多"由调用方
|
|
35
35
|
* 决定 —— 收多久、收哪些是业务判断,不是皮肤能定的。
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
* <TabBar :options="[{label:'全部',value:'all'},{label:'进行中',value:'doing'}]" v-model:value="current" />
|
|
39
|
-
*
|
|
40
|
-
* @example 选项卡形态 + 可关闭可新增
|
|
41
|
-
* <TabBar type="card" closable addable :options="tabs" v-model:value="current"
|
|
42
|
-
* :on-close="remove" :on-add="add" />
|
|
37
|
+
* 用法见 `docs/demos/tabbar/`(每个维度一份可运行样例;文档页 `docs/components/tabbar.md`)。
|
|
43
38
|
*/
|
|
44
39
|
export declare const TabBar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
45
40
|
options: {
|
|
@@ -13,6 +13,8 @@ export interface TableColumn {
|
|
|
13
13
|
* - `'120px'` —— 固定宽(`fixed` 下是硬宽,**容器变窄也不收缩**,可能横向滚动)
|
|
14
14
|
* - `'20%'` —— 百分比(**吃满 + 严格按比例 + 任意容器宽不溢出**,响应式首选)
|
|
15
15
|
* - 不传 —— 单用时吃剩余/等分;**与 `px` 混用会被压到 0**,不建议
|
|
16
|
+
*
|
|
17
|
+
* 用法见 `docs/demos/table/`(每个维度一份可运行样例;文档页 `docs/components/table.md`)。
|
|
16
18
|
*/
|
|
17
19
|
width?: string | number;
|
|
18
20
|
align?: 'left' | 'center' | 'right';
|
|
@@ -30,11 +32,9 @@ export interface TableColumn {
|
|
|
30
32
|
*/
|
|
31
33
|
wrap?: boolean;
|
|
32
34
|
/**
|
|
33
|
-
* 列下限(px):防止窄容器把该列压没。**给了才下发 `min-width
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* 想要真下限得换机制(该列直接给 px 硬宽,或把内容包一层带 `min-width` 的盒)。
|
|
37
|
-
* 只在调用方显式要时才下发(`<col>` 上不写时不会出现)。
|
|
35
|
+
* 列下限(px):防止窄容器把该列压没。**给了才下发 `min-width`**(`<col>` 上不写就不会出现)。⚠️ **不是硬下限**:
|
|
36
|
+
* 实测 `<col>` 上的 `min-width` 会被当成**分配权重**参与按比例分摊 —— 800 宽容器下 `width:50% + min-width:500px`
|
|
37
|
+
* 的列只有 **444**。想要真下限得换机制(该列直接给 px 硬宽,或把内容包一层带 `min-width` 的盒)。
|
|
38
38
|
*/
|
|
39
39
|
minWidth?: number;
|
|
40
40
|
/** 必填列:表头加星号 */
|
|
@@ -61,15 +61,6 @@ export interface TableRowProps {
|
|
|
61
61
|
* **回写是受控的**:`setValue(next)` 只把「这一格变成了什么」上报出去
|
|
62
62
|
* (= 发一次 `onCellChange(row, column.key, next, index)`)。本件**从不改 `data`** ——
|
|
63
63
|
* 新数组与「这次改动该不该被接受」都由调用方决定,与行选中同一套受控口径。
|
|
64
|
-
*
|
|
65
|
-
* @example 编辑格:套 `Form.Item` 拿错误位,控件自己绑值、回写走 `setValue`
|
|
66
|
-
* <Table :columns="columns" :data="rows" row-key="id" layout="fixed" :on-cell-change="write">
|
|
67
|
-
* <template #cell="{ row, column, value, index, setValue }">
|
|
68
|
-
* <!-- 格子里的框由控件自己带:默认有框 / `:bordered="false"` 无框 / `bordered="focus"` 聚焦才显框 -->
|
|
69
|
-
* <Input v-if="column.key === 'name'" :model-value="String(value ?? '')" @change="setValue" />
|
|
70
|
-
* <template v-else>{{ value }}</template>
|
|
71
|
-
* </template>
|
|
72
|
-
* </Table>
|
|
73
64
|
*/
|
|
74
65
|
export interface TableCellSlotScope {
|
|
75
66
|
row: TableRow;
|
|
@@ -80,10 +71,7 @@ export interface TableCellSlotScope {
|
|
|
80
71
|
/** 上报该格的新值(= 发一次 `onCellChange`);调用方没接 `onCellChange` 时是空操作 */
|
|
81
72
|
setValue: (next: unknown) => void;
|
|
82
73
|
}
|
|
83
|
-
/**
|
|
84
|
-
* 行级可勾选判定(`selectable` 的函数形态):返回 `false` 的行渲染**禁用态**勾选框,
|
|
85
|
-
* 且不进表头全选的增删范围。签名与 `onRow` / `rowClass` 一致(都给 `index`)。
|
|
86
|
-
*/
|
|
74
|
+
/** 行级可勾选判定(`selectable` 的函数形态):返回 `false` 的行渲染**禁用态**勾选框,且不进表头全选的增删范围;签名与 `onRow` / `rowClass` 一致(都给 `index`)。 */
|
|
87
75
|
export type TableRowSelectable = (row: TableRow, index: number) => boolean;
|
|
88
76
|
/** 分页档:`false` 不渲染;给对象就渲染分页条(**本件不切片,`data` 是当前页数据**) */
|
|
89
77
|
export interface TablePagination {
|
|
@@ -98,49 +86,20 @@ export interface TablePagination {
|
|
|
98
86
|
*
|
|
99
87
|
* ## 这个组件负责什么、不负责什么(都是刻意的)
|
|
100
88
|
*
|
|
101
|
-
* **负责**:把 `columns` × `data`
|
|
102
|
-
* 组件 —— 它内部才是真实 `<input type="checkbox">`,故面上的
|
|
103
|
-
* 零 JS 路径仍成立;选择器**限定在勾选列内**,否则功能列的
|
|
104
|
-
*
|
|
89
|
+
* **负责**:把 `columns` × `data` 渲成表格;列对齐 / 宽度 / 省略 / 必填;行选中(勾选列复用本包的
|
|
90
|
+
* `Checkbox` 组件 —— 它内部才是真实 `<input type="checkbox">`,故面上的
|
|
91
|
+
* `tr:has(.mh-table__col-check input:checked)` 零 JS 路径仍成立;选择器**限定在勾选列内**,否则功能列的
|
|
92
|
+
* `Switch` 也会把整行点亮);展开行;排序按钮的**状态与事件**;加载态与空态;分页条的排布与事件透传;
|
|
105
93
|
* `rowClass` / `onRow` 让调用方标分组行、禁用行与挂行级点击。
|
|
106
94
|
*
|
|
107
95
|
* **不负责**:
|
|
108
96
|
*
|
|
109
|
-
* -
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* - **分页切片**:`pagination`
|
|
113
|
-
*
|
|
97
|
+
* - **排序算法归调用方**(列宽拖拽同理):规范只给了 `↕` 字形与拖拽线两处视觉,而 `↕` 是文字符号(本包禁
|
|
98
|
+
* 拿文字符号冒充图标),故朝向改用现成字形 `chevron-up` / `chevron-down` 表达 —— 本件发 `sort` 事件、
|
|
99
|
+
* 画态,真正排序 / 改列宽由调用方决定(它有数据、也知道业务口径);
|
|
100
|
+
* - **分页切片**:`pagination` 只渲染分页条并透传页码事件,**`data` 始终是当前页数据** —— 组件自己切片会
|
|
101
|
+
* 让「服务端分页」与「客户端分页」两套口径藏在同一个 prop 里;
|
|
114
102
|
* - **错误态**:归 `QueryState`(表格只管列数据)。
|
|
115
|
-
*
|
|
116
|
-
* @example 基本列表(表默认满宽;列宽给权重 + `fixed` 才严格按比例)
|
|
117
|
-
* <Table
|
|
118
|
-
* layout="fixed" striped row-key="id" :data="rows"
|
|
119
|
-
* :columns="[
|
|
120
|
-
* { key: 'name', title: '名称', width: 3 },
|
|
121
|
-
* { key: 'amount', title: '金额', width: 1, align: 'right' },
|
|
122
|
-
* { key: 'description', title: '描述', width: 4, wrap: true },
|
|
123
|
-
* ]"
|
|
124
|
-
* :pagination="{ total: 120, current: page, onChange: (p) => (page = p) }"
|
|
125
|
-
* />
|
|
126
|
-
*
|
|
127
|
-
* @example 操作列(用 `actions` 插槽 + 一列 `align:'right'`;行内操作同族,`Button.Group` 收口)
|
|
128
|
-
* <Table :columns="columns" :data="rows" row-key="id">
|
|
129
|
-
* {{
|
|
130
|
-
* actions: ({ row }) => (
|
|
131
|
-
* <Button.Group>
|
|
132
|
-
* <Button variant="text" onClick={() => open(row)}>编辑</Button>
|
|
133
|
-
* <Button variant="text" danger onClick={() => remove(row)}>删除</Button>
|
|
134
|
-
* </Button.Group>
|
|
135
|
-
* ),
|
|
136
|
-
* }}
|
|
137
|
-
* </Table>
|
|
138
|
-
*
|
|
139
|
-
* @example 单元格自定义 + 按行判定可勾选
|
|
140
|
-
* <Table :columns="columns" :data="rows" row-key="id" v-model="selected"
|
|
141
|
-
* :selectable="(row) => row.status === 'draft'">
|
|
142
|
-
* {{ cell: ({ value, column }) => column.key === 'status' ? <Text tone="success">{value}</Text> : value }}
|
|
143
|
-
* </Table>
|
|
144
103
|
*/
|
|
145
104
|
export declare const Table: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
146
105
|
columns: {
|
|
@@ -181,11 +140,8 @@ export declare const Table: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
181
140
|
default: boolean;
|
|
182
141
|
};
|
|
183
142
|
/**
|
|
184
|
-
* 单元格值变更 —— 由 `#cell` 插槽里的 `setValue`
|
|
185
|
-
*
|
|
186
|
-
* 本件**不改 `data`**(与本仓表格一贯的克制口径一致:全受控、只发事件、不排序、不切片);
|
|
187
|
-
* 要不要接受、以及新数组怎么产生,都由调用方决定。
|
|
188
|
-
* 没接这个回调时 `setValue` 是空操作(插槽里的控件照旧可绑,不会报错)。
|
|
143
|
+
* 单元格值变更 —— 由 `#cell` 插槽里的 `setValue` 触发,是**唯一的回写通道**。本件**不改 `data`**(全受控、只发
|
|
144
|
+
* 事件、不排序、不切片);要不要接受、新数组怎么产生都由调用方决定;没接这个回调时 `setValue` 是空操作。
|
|
189
145
|
*/
|
|
190
146
|
onCellChange: {
|
|
191
147
|
type: PropType<(row: TableRow, key: string, value: unknown, index: number) => void>;
|
|
@@ -350,11 +306,8 @@ export declare const Table: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
350
306
|
default: boolean;
|
|
351
307
|
};
|
|
352
308
|
/**
|
|
353
|
-
* 单元格值变更 —— 由 `#cell` 插槽里的 `setValue`
|
|
354
|
-
*
|
|
355
|
-
* 本件**不改 `data`**(与本仓表格一贯的克制口径一致:全受控、只发事件、不排序、不切片);
|
|
356
|
-
* 要不要接受、以及新数组怎么产生,都由调用方决定。
|
|
357
|
-
* 没接这个回调时 `setValue` 是空操作(插槽里的控件照旧可绑,不会报错)。
|
|
309
|
+
* 单元格值变更 —— 由 `#cell` 插槽里的 `setValue` 触发,是**唯一的回写通道**。本件**不改 `data`**(全受控、只发
|
|
310
|
+
* 事件、不排序、不切片);要不要接受、新数组怎么产生都由调用方决定;没接这个回调时 `setValue` 是空操作。
|
|
358
311
|
*/
|
|
359
312
|
onCellChange: {
|
|
360
313
|
type: PropType<(row: TableRow, key: string, value: unknown, index: number) => void>;
|
|
@@ -504,12 +457,7 @@ export declare const Table: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
504
457
|
expandable: (row: TableRow, index: number) => VNodeChild;
|
|
505
458
|
pagination: false | TablePagination;
|
|
506
459
|
}, SlotsType<{
|
|
507
|
-
/**
|
|
508
|
-
* 单元格:`{ row, column, value, index, setValue }`(不给则直接输出原值)。
|
|
509
|
-
*
|
|
510
|
-
* **编辑格也走这里**(见 `TableCellSlotScope` 的说明):本件不替调用方渲染控件,
|
|
511
|
-
* 只给值、给位置、给一个受控的回写口 `setValue`。
|
|
512
|
-
*/
|
|
460
|
+
/** 单元格插槽:`{ row, column, value, index, setValue }`(不给则直接输出原值)。**编辑格也走这里** —— 本件不替调用方渲染控件,只给值、给位置、给一个受控的回写口。 */
|
|
513
461
|
cell?: (context: TableCellSlotScope) => VNodeChild;
|
|
514
462
|
/** 行尾操作区:`{ row, index }`(面里用 `align: 'right'` 的列承载) */
|
|
515
463
|
actions?: (context: {
|
|
@@ -44,11 +44,8 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
44
44
|
default: false
|
|
45
45
|
},
|
|
46
46
|
/**
|
|
47
|
-
* 单元格值变更 —— 由 `#cell` 插槽里的 `setValue`
|
|
48
|
-
*
|
|
49
|
-
* 本件**不改 `data`**(与本仓表格一贯的克制口径一致:全受控、只发事件、不排序、不切片);
|
|
50
|
-
* 要不要接受、以及新数组怎么产生,都由调用方决定。
|
|
51
|
-
* 没接这个回调时 `setValue` 是空操作(插槽里的控件照旧可绑,不会报错)。
|
|
47
|
+
* 单元格值变更 —— 由 `#cell` 插槽里的 `setValue` 触发,是**唯一的回写通道**。本件**不改 `data`**(全受控、只发
|
|
48
|
+
* 事件、不排序、不切片);要不要接受、新数组怎么产生都由调用方决定;没接这个回调时 `setValue` 是空操作。
|
|
52
49
|
*/
|
|
53
50
|
onCellChange: {
|
|
54
51
|
type: Function,
|
|
@@ -312,9 +309,8 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
312
309
|
"name": "chevron-down",
|
|
313
310
|
"class": "mh-table__expand-icon"
|
|
314
311
|
}, null)])]) : null, hasSelectColumn.value ? (
|
|
315
|
-
/* 勾选列复用 `Checkbox
|
|
316
|
-
|
|
317
|
-
点它会冒泡两次(label 自身一次 + 转发给 input 一次),只挡 input 挡不住行点击。
|
|
312
|
+
/* 勾选列复用 `Checkbox`(不手写原生 input)。行本身可能带 `onRow` 的 onClick:勾选不该顺带触发行
|
|
313
|
+
点击 —— 阻断挂在**单元格**上(`Checkbox` 的根是 `label`,点它会冒泡两次,只挡 input 挡不住)。
|
|
318
314
|
`selectable` 为函数时逐行判定:返回 `false` 的行给禁用态(置灰 + not-allowed)。 */
|
|
319
315
|
createVNode("td", {
|
|
320
316
|
"class": "mh-table__col-check",
|