@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
package/dist/index.d.ts
CHANGED
|
@@ -21,12 +21,13 @@ export { Card, type CardProps, type CardVariant, type CardPadding, type CardHead
|
|
|
21
21
|
export { Divider, type DividerProps } from './components/divider';
|
|
22
22
|
export { Nav, type NavVariant } from './components/nav';
|
|
23
23
|
export { Collapse, type CollapseProps, type CollapseCompound } from './components/collapse';
|
|
24
|
-
export {
|
|
24
|
+
export { TabPanel, Tabs, type TabPanelProps, type TabsOption, type TabsProps } from './components/tabs';
|
|
25
25
|
export { Layout, type LayoutGap, type LayoutAlign, type LayoutJustify, type LayoutColumns, type LayoutSpan, } from './components/layout';
|
|
26
26
|
export { Avatar, type AvatarProps, type AvatarSize, type AvatarCompound } from './components/avatar';
|
|
27
27
|
export { Skeleton, type SkeletonProps } from './components/skeleton';
|
|
28
28
|
export { Radio, type RadioProps, type RadioCompound, type RadioCompoundType, type RadioCardItem, type RadioCardValue, } from './components/radio';
|
|
29
29
|
export { Tag, type TagProps } from './components/tag';
|
|
30
|
+
export { Text, type TextProps, type TextSize, type TextTone, type TextWeight, type TextTag, } from './components/text';
|
|
30
31
|
export { Tree, type TreeNode } from './components/tree';
|
|
31
32
|
export { ListView, type ListViewProps, type ListViewStatus, type ListViewStatusTone, type ListViewCardItemProps, type ListViewCompound, } from './components/list-view';
|
|
32
33
|
export { Badge, type BadgeTone, type BadgeShape, type BadgeSize, type BadgeDot, type BadgeStatus, } from './components/badge';
|
|
@@ -36,7 +37,7 @@ export { Search, type SearchProps } from './components/search';
|
|
|
36
37
|
export { Select, type SelectOption, type SelectValue } from './components/select';
|
|
37
38
|
export { Switch } from './components/switch';
|
|
38
39
|
export { Capsule, type CapsuleOption, type CapsuleShape } from './components/capsule';
|
|
39
|
-
export { Form, type FormProps, type FormHeaderProps, type FormItemProps, type FormValues, type FormItemSlotScope, type FormLabelAlign, type FormPadding, type FormCompound, } from './components/form';
|
|
40
|
+
export { Form, type FormProps, type FormHeaderProps, type FormItemProps, type FormValues, type FormItemSlotScope, type FormItemAlign, type FormLabelAlign, type FormColumns, type FormPadding, type FormCompound, } from './components/form';
|
|
40
41
|
export { Checkbox, type CheckboxOption, type CheckboxCompound, type CheckboxCompoundType, } from './components/checkbox';
|
|
41
42
|
export { Filter, FilterItem, FILTER_ALL, normalizeFilterValue, type FilterValue, type FilterValues, type FilterProps, type FilterItemProps, type FilterItemSlotScope, type FilterCompound, } from './components/filter';
|
|
42
43
|
export { Notice, type NoticeTone } from './components/notice';
|
|
@@ -44,10 +45,10 @@ export { Notification, type NotificationTone, } from './components/notification'
|
|
|
44
45
|
export { Dialog, type DialogWidth } from './components/dialog';
|
|
45
46
|
export { Drawer, type DrawerSide } from './components/drawer';
|
|
46
47
|
export { Tooltip, type TooltipSide, type TooltipAlign, } from './components/tooltip';
|
|
47
|
-
export { Table, type TableColumn, type TableRow, type TableSortOrder, } from './components/table';
|
|
48
|
+
export { Table, type TableColumn, type TableRow, type TableRowSelectable, type TableSortOrder, } from './components/table';
|
|
48
49
|
export { Pagination, type PaginationPageItem } from './components/pagination';
|
|
49
|
-
export {
|
|
50
|
-
export { Steps, type StepsItem, type StepsVariant, type StepsCompound, type StepsCompoundType, } from './components/steps';
|
|
50
|
+
export { TabBar, type TabBarOption, type TabBarValue } from './components/tabbar';
|
|
51
|
+
export { Steps, type CanJump, type StepsItem, type StepsVariant, type StepsCompound, type StepsCompoundType, } from './components/steps';
|
|
51
52
|
export { Toast, type ToastTone, type ToastCompound, type ToastCompoundType, } from './components/toast';
|
|
52
53
|
export { Code } from './components/code';
|
|
53
54
|
export { CodeEditor, type CodeEditorProps, type CodeEditorAutoSize, } from './components/code-editor';
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,13 @@ import { Card } from "./components/card/index.js";
|
|
|
4
4
|
import { Divider } from "./components/divider/index.js";
|
|
5
5
|
import { Nav } from "./components/nav/index.js";
|
|
6
6
|
import { Collapse } from "./components/collapse/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { TabPanel, Tabs } from "./components/tabs/index.js";
|
|
8
8
|
import { Layout } from "./components/layout/index.js";
|
|
9
9
|
import { Avatar } from "./components/avatar/index.js";
|
|
10
10
|
import { Skeleton } from "./components/skeleton/index.js";
|
|
11
11
|
import { Radio } from "./components/radio/index.js";
|
|
12
12
|
import { Tag } from "./components/tag/index.js";
|
|
13
|
+
import { Text } from "./components/text/index.js";
|
|
13
14
|
import { Tree } from "./components/tree/index.js";
|
|
14
15
|
import { ListView } from "./components/list-view/index.js";
|
|
15
16
|
import { Badge } from "./components/badge/index.js";
|
|
@@ -29,7 +30,7 @@ import { Drawer } from "./components/drawer/index.js";
|
|
|
29
30
|
import { Tooltip } from "./components/tooltip/index.js";
|
|
30
31
|
import { Table } from "./components/table/index.js";
|
|
31
32
|
import { Pagination } from "./components/pagination/index.js";
|
|
32
|
-
import {
|
|
33
|
+
import { TabBar } from "./components/tabbar/index.js";
|
|
33
34
|
import { Steps } from "./components/steps/index.js";
|
|
34
35
|
import { Toast } from "./components/toast/index.js";
|
|
35
36
|
import { Code } from "./components/code/index.js";
|
|
@@ -76,10 +77,12 @@ export {
|
|
|
76
77
|
Skeleton,
|
|
77
78
|
Steps,
|
|
78
79
|
Switch,
|
|
80
|
+
TabBar,
|
|
81
|
+
TabPanel,
|
|
79
82
|
Table,
|
|
80
83
|
Tabs,
|
|
81
|
-
Tabset,
|
|
82
84
|
Tag,
|
|
85
|
+
Text,
|
|
83
86
|
Textarea,
|
|
84
87
|
Toast,
|
|
85
88
|
Tooltip,
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
import { type DialogTone } from '../components/dialog';
|
|
1
2
|
export interface ConfirmOptions {
|
|
2
3
|
/** 标题(缺省不渲染页头,只剩内容与底栏) */
|
|
3
4
|
title?: string;
|
|
4
5
|
/** 正文(纯文本;复杂内容请直接用 `Dialog` 组件) */
|
|
5
6
|
detail?: string;
|
|
7
|
+
/**
|
|
8
|
+
* 语义档(决定标题左侧的裸符号与配色):`info` / `success` / `warning` / `error`。
|
|
9
|
+
*
|
|
10
|
+
* 不传则无图标。**危险操作用 `error`** —— 它同时把确定按钮染成危险色
|
|
11
|
+
* (除非显式给了 `okDanger`),这样「删除确认」与「保存成功」不再长得一样。
|
|
12
|
+
*/
|
|
13
|
+
tone?: DialogTone;
|
|
6
14
|
/** 确定按钮文案 */
|
|
7
15
|
okText?: string;
|
|
8
16
|
/** 取消按钮文案(`alert` 不使用) */
|
|
9
17
|
cancelText?: string;
|
|
10
|
-
/**
|
|
18
|
+
/** 确定按钮的危险色(删除类确认;不传时由 `tone === 'error'` 推出) */
|
|
11
19
|
okDanger?: boolean;
|
|
12
20
|
/** 是否显示关闭位(缺省开:用户总得有第三条退路) */
|
|
13
21
|
closable?: boolean;
|
|
@@ -18,11 +26,15 @@ export interface ConfirmOptions {
|
|
|
18
26
|
* 与 `Dialog` 组件的分工:组件是「受控弹窗」,本函数补齐命令式调用缺的那一层(宿主 + 收场 Promise)。
|
|
19
27
|
* 语义与主流库一致:**任何非确定路径都折成 `false`**,调用方 `if (await confirm(...))` 一处判断即可。
|
|
20
28
|
*
|
|
29
|
+
* **遮罩与 Esc 都归 `false`**:`Dialog` 组件形态的 `closeOnBackdrop` 默认已改为 `true`(跟主流),
|
|
30
|
+
* 但命令式确认框必须**显式关掉它** —— 这里一条误点就丢一次决策,与 Ant Design
|
|
31
|
+
* (`<Modal maskClosable>` 默认 `true`、`Modal.confirm` 默认 `false`)的分工一致。
|
|
32
|
+
*
|
|
21
33
|
* 需要「确定按钮进加载态」的异步确认请直接用 `Dialog` 组件(`onOk` 返回 Promise 时自动进加载态)——
|
|
22
34
|
* 命令式形态刻意不引入跨 tick 的加载态,免得调用方以为弹窗已经关了。
|
|
23
35
|
*
|
|
24
|
-
* @example
|
|
25
|
-
* if (await confirm({ title: '删除确认', detail: '删除后不可恢复,确认继续?', okText: '删除',
|
|
36
|
+
* @example 删除确认(`tone: 'error'` 给标题加提示图标并把确定按钮染危险色)
|
|
37
|
+
* if (await confirm({ title: '删除确认', detail: '删除后不可恢复,确认继续?', okText: '删除', tone: 'error' })) {
|
|
26
38
|
* await remove()
|
|
27
39
|
* }
|
|
28
40
|
*/
|
|
@@ -33,8 +45,11 @@ export declare function confirm(options?: ConfirmOptions): Promise<boolean>;
|
|
|
33
45
|
* 底栏**自绘**而不是用内建底栏:内建底栏固定是「取消 + 确定」两枚,而告知框没有「取消」可言
|
|
34
46
|
* (给两枚按钮会让用户以为还有一条分支)。
|
|
35
47
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
48
|
+
* 与 `confirm()` 同一口径:**遮罩与 Esc 都显式关掉**(告知框同样不该被一次误点打发掉)。
|
|
49
|
+
*
|
|
50
|
+
* @example 危险操作的回执:这一条与「保存成功」在图标与配色上区分开
|
|
51
|
+
* await alert({ tone: 'error', title: '移除失败', detail: '该来源系统仍被 3 个应用引用。' })
|
|
52
|
+
* await alert({ tone: 'success', title: '导入完成', detail: '共 128 条,其中 3 条被跳过。' })
|
|
38
53
|
*/
|
|
39
54
|
export declare function alert(options?: ConfirmOptions): Promise<void>;
|
|
40
55
|
/** 收掉全部在档弹窗(逐个折成 `false`);幂等。换应用 / 卸载时调 */
|
package/dist/services/dialog.js
CHANGED
|
@@ -39,10 +39,14 @@ function confirm(options = {}) {
|
|
|
39
39
|
{
|
|
40
40
|
open: ctx.isOpen(),
|
|
41
41
|
title: options.title,
|
|
42
|
+
tone: options.tone,
|
|
42
43
|
closable: options.closable ?? true,
|
|
44
|
+
// 组件形态默认已开(跟主流);命令式这一层显式关掉,防误点丢决策
|
|
45
|
+
closeOnBackdrop: false,
|
|
46
|
+
maskClosable: false,
|
|
43
47
|
okText: options.okText ?? "确定",
|
|
44
48
|
cancelText: options.cancelText ?? "取消",
|
|
45
|
-
okDanger: options.okDanger ??
|
|
49
|
+
okDanger: options.okDanger ?? options.tone === "error",
|
|
46
50
|
onOk: () => ctx.finish(true),
|
|
47
51
|
onCancel: () => ctx.finish(false),
|
|
48
52
|
onClose: () => ctx.finish(false)
|
|
@@ -58,7 +62,10 @@ function alert(options = {}) {
|
|
|
58
62
|
{
|
|
59
63
|
open: ctx.isOpen(),
|
|
60
64
|
title: options.title,
|
|
65
|
+
tone: options.tone,
|
|
61
66
|
closable: options.closable ?? true,
|
|
67
|
+
closeOnBackdrop: false,
|
|
68
|
+
maskClosable: false,
|
|
62
69
|
// 关闭位与 Esc 都算「看过了」
|
|
63
70
|
onCancel: () => ctx.finish(true),
|
|
64
71
|
onClose: () => ctx.finish(true)
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
*
|
|
15
15
|
* 状态三源等价:原生 `input:checked` / 组件下发 `[data-state='active']` / 静态档 `.is-selected`。
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* **与面板组合**:要「选中即切面板」,把本件塞进 `Tabs` 的 `selector` 插槽即可 ——
|
|
18
|
+
* 面板显隐由 `Tabs` 按受控值下发 `hidden`,本族不认识它、它也不认识本族(两层零互指)。
|
|
19
19
|
*
|
|
20
|
-
* **与 `
|
|
21
|
-
*
|
|
20
|
+
* **与 `Tabs` 的判据**:`Tabs` 是操作层的**骨架**(只给根、面板组与收起态,不带面),
|
|
21
|
+
* 面可由本件或按钮族的分段形态担任;本件是**带自己轨道与选中胶囊的轻量选择控件**。
|
|
22
22
|
*/
|
|
23
23
|
.mh-capsule {
|
|
24
24
|
display: inline-flex;
|
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
* (`class="mh-popup mh-card"` + 按钮),不需要新的面;尺寸 220/r10 那组值也不值得为它单开一族。
|
|
17
17
|
*/
|
|
18
18
|
.mh-dialog {
|
|
19
|
+
/* 三段式列布局:页头 / 底栏由内容定高(`flex: none`),内容区吃掉剩余高度。
|
|
20
|
+
与 `Drawer` 同构(那边一直是这么写的)—— 本件此前漏了这一层,表现为
|
|
21
|
+
**高度受控时底栏不贴底**(body 只有内容高,剩余空间全留在 footer 之后)。
|
|
22
|
+
不设高度时零影响:列容器无高度约束 ⇒ body 高 = 内容高(与改前逐像素一致)。
|
|
23
|
+
⚠️ 加 `display: flex` 会以作者源压过 UA 的 `dialog:not([open]) { display: none }`,
|
|
24
|
+
收起态靠操作层 `operations/popup.css` 的 `:is(… dialog.mh-popup:not([open]))` 兜住
|
|
25
|
+
(特异性 0-3-0,高于本行)—— **那条兜底不能删**。 */
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
19
28
|
width: var(--ui-dialog-width);
|
|
20
29
|
max-width: var(--ui-dialog-width);
|
|
21
30
|
padding: 0; /* UA 给 <dialog> 的内距一律归零:内距由页头 / 内容 / 底栏各自拥有 */
|
|
@@ -42,14 +51,38 @@
|
|
|
42
51
|
align-items: center;
|
|
43
52
|
justify-content: space-between;
|
|
44
53
|
gap: var(--ui-space-2);
|
|
54
|
+
flex: none; /* 高度受控时不被压缩(同 Drawer) */
|
|
45
55
|
padding: var(--ui-space-4) var(--ui-space-6) 0;
|
|
46
56
|
font-size: var(--ui-font-heading); /* 规范 16px */
|
|
47
57
|
line-height: var(--ui-line-heading);
|
|
48
58
|
font-weight: var(--ui-weight-medium);
|
|
49
59
|
color: var(--ui-base-content);
|
|
50
60
|
}
|
|
61
|
+
/* 语义档(`tone`):标题左侧一个**裸符号**,颜色按档取语义色 ——
|
|
62
|
+
缺省(不传 tone)不渲染,故不影响既有外观。取色口径与 `Notice` 同一张表
|
|
63
|
+
(success / warning 取 -strong 档,否则浅底上对比度不足)。 */
|
|
64
|
+
.mh-dialog__tone-icon {
|
|
65
|
+
flex: none;
|
|
66
|
+
width: var(--ui-font-icon);
|
|
67
|
+
height: var(--ui-font-icon);
|
|
68
|
+
color: var(--mh-dialog-tone-color, var(--ui-primary));
|
|
69
|
+
}
|
|
70
|
+
.mh-dialog--info {
|
|
71
|
+
--mh-dialog-tone-color: var(--ui-info);
|
|
72
|
+
}
|
|
73
|
+
.mh-dialog--success {
|
|
74
|
+
--mh-dialog-tone-color: var(--ui-success-strong);
|
|
75
|
+
}
|
|
76
|
+
.mh-dialog--warning {
|
|
77
|
+
--mh-dialog-tone-color: var(--ui-warning-strong);
|
|
78
|
+
}
|
|
79
|
+
.mh-dialog--error {
|
|
80
|
+
--mh-dialog-tone-color: var(--ui-error);
|
|
81
|
+
}
|
|
82
|
+
|
|
51
83
|
/* 标题位(插槽版也走这个类,两路渲染同一份排版) */
|
|
52
84
|
.mh-dialog__title {
|
|
85
|
+
flex: 1 1 auto; /* 撑满中段:语义图标在左、关闭位在右(`space-between` 下三者的正确落位) */
|
|
53
86
|
min-width: 0;
|
|
54
87
|
overflow: hidden;
|
|
55
88
|
text-overflow: ellipsis;
|
|
@@ -82,8 +115,13 @@
|
|
|
82
115
|
outline-offset: 2px;
|
|
83
116
|
}
|
|
84
117
|
|
|
85
|
-
/* 内容区(内距 24;三段之间无分割线,交界间距只由三段内距单一拥有)
|
|
118
|
+
/* 内容区(内距 24;三段之间无分割线,交界间距只由三段内距单一拥有)
|
|
119
|
+
`flex: 1 1 auto` + `min-height: 0`:吃掉页头与底栏之外的全部高度(含 `panelHeight` /
|
|
120
|
+
消费方经 style 给的高度),超出即**本段**滚动 —— 页头与底栏因此永远可见。 */
|
|
86
121
|
.mh-dialog__body {
|
|
122
|
+
flex: 1 1 auto;
|
|
123
|
+
min-height: 0;
|
|
124
|
+
overflow-y: auto;
|
|
87
125
|
padding: var(--ui-space-6);
|
|
88
126
|
font-size: var(--ui-font-body);
|
|
89
127
|
line-height: var(--ui-line-body);
|
|
@@ -102,5 +140,6 @@
|
|
|
102
140
|
display: flex;
|
|
103
141
|
justify-content: flex-end;
|
|
104
142
|
gap: var(--ui-space-2);
|
|
143
|
+
flex: none; /* 高度受控时贴底且不被压缩(同 Drawer) */
|
|
105
144
|
padding: 0 var(--ui-space-6) var(--ui-space-4);
|
|
106
145
|
}
|
|
@@ -13,7 +13,13 @@
|
|
|
13
13
|
(farris 用绝对定位的浮层提示条,在弹窗里会压住下一行控件)。
|
|
14
14
|
|
|
15
15
|
label 列宽只由变量驱动:Form / Form.Item 落 `--mh-form-label-width`,默认取令牌,
|
|
16
|
-
故换宽窄不需要在消费方写 CSS。
|
|
16
|
+
故换宽窄不需要在消费方写 CSS。
|
|
17
|
+
|
|
18
|
+
行几何是**两列 grid**(label 列 + 控件列):label 与控件同处第 1 行、交叉轴居中 ⇒ 两侧文字
|
|
19
|
+
落在同一条中线上;错误 / 说明是**行的直接子节点**,自然落第 2 行起,不会把 label 带走。
|
|
20
|
+
对齐**不依赖任何「控件高度」常量**(从前那个 `--ui-form-control-height` 在骨架层没有出处,
|
|
21
|
+
回退 `auto` ⇒ label 盒退化成一行文字并贴行顶,档位越高错得越多)。
|
|
22
|
+
需要顶对齐的行(文本域自动判定、或消费方显式 `align`)见下面的「行内垂直对齐档」。 */
|
|
17
23
|
|
|
18
24
|
/* 行距取 8px 档:Form.Item 自己已经是一个完整行(label 与控件等高 + 错误/说明按文档流往下排),
|
|
19
25
|
再用 16px 行距会把表单拉得很散 —— 尤其是步骤⑤那种「只读文本行」的摘要,行与行之间会显得发虚。
|
|
@@ -23,27 +29,83 @@
|
|
|
23
29
|
display: flex;
|
|
24
30
|
flex-direction: column;
|
|
25
31
|
gap: var(--ui-space-2);
|
|
32
|
+
/* 多列公式用的三个变量(**都在本件**,不进 theme 令牌文件):
|
|
33
|
+
- `--mh-form-columns`:数字档的**列数上限**(档位类只覆盖它,不复制几何);
|
|
34
|
+
- `--mh-form-column-min`:一列的**最小宽度**(`columnMinWidth` 行内覆盖,缺省取令牌 320);
|
|
35
|
+
- `--mh-form-gap`:行距 —— 公式里必须用**与实体 gap 同一个值**算轨道下限
|
|
36
|
+
(从前这里硬编码 8px,`gap` 调大后列宽会算偏、临界宽度上还会误判是否回落)。 */
|
|
37
|
+
--mh-form-columns: 2;
|
|
38
|
+
--mh-form-column-min: var(--ui-form-column-min);
|
|
39
|
+
--mh-form-gap: var(--ui-space-2);
|
|
26
40
|
}
|
|
27
41
|
|
|
28
|
-
/*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
/* ===== 多列(数字档:`columns` = 2 / 3 / 4)=====
|
|
43
|
+
* 轨道下限取「**最小列宽**」与「**按 N 列等分**」的较大者,配 `auto-fit`:
|
|
44
|
+
* - 容器放得下 N 列 ⇒ 排 N 列;
|
|
45
|
+
* - 放不下 ⇒ 轨道数减少(**自动回落**,不会把控件压成窄条)。
|
|
46
|
+
*
|
|
47
|
+
* 把「均分值」当轨道下限就是「**上限 N 列**」的实现 —— 没有它,`auto-fit` 会一路排下去
|
|
48
|
+
* (实测 1400px 得 4 列,与「最多 N 列」的承诺不符)。
|
|
49
|
+
*
|
|
50
|
+
* 这条是表单与 `Layout.Row` 的**关键差别**:后者列数恒定、窄了等分收窄(实测 480px 容器里
|
|
51
|
+
* Form 回落成一列、控件还有 360px;恒定两列会把控件压到 ~104px)。表单会被放进抽屉 / 弹窗 /
|
|
52
|
+
* 分栏,容器宽度不可预知,所以要的是「回落到能用」而不是「列数不变」。
|
|
53
|
+
*
|
|
54
|
+
* `align-items: start`:同一行的字段各自顶部对齐,不被隔壁那个「错误 + 多行说明」撑高的格子拉扯。
|
|
55
|
+
*
|
|
56
|
+
* `mh-form--two-column` 是 `columns={2}` 的**历史类名**(已发布过,改名属破坏性变更),
|
|
57
|
+
* 与 3~6 档共用下面这份几何声明(`2` 与 `3+` 走两个类名只是历史包袱,样式上完全等价)。 */
|
|
58
|
+
|
|
59
|
+
.mh-form--two-column,
|
|
60
|
+
.mh-form--columns-3,
|
|
61
|
+
.mh-form--columns-4,
|
|
62
|
+
.mh-form--columns-5,
|
|
63
|
+
.mh-form--columns-6 {
|
|
33
64
|
display: grid;
|
|
34
|
-
/* 上限 2 列 + 最小列宽:track 下限取「最小列宽」与「按 2 列等分」的较大者
|
|
35
|
-
—— 否则宽表单里 auto-fit 会一路排到 4 列(实测 1400px 得 4 列),
|
|
36
|
-
而 `columns={2}` 承诺的是"最多 2 列、窄了回落"(与 Layout.Row 同一公式)。 */
|
|
37
65
|
grid-template-columns: repeat(
|
|
38
66
|
auto-fit,
|
|
39
67
|
minmax(
|
|
40
|
-
max(
|
|
68
|
+
max(
|
|
69
|
+
var(--mh-form-column-min),
|
|
70
|
+
calc((100% - (var(--mh-form-columns) - 1) * var(--mh-form-gap)) / var(--mh-form-columns))
|
|
71
|
+
),
|
|
41
72
|
1fr
|
|
42
73
|
)
|
|
43
74
|
);
|
|
44
75
|
align-items: start;
|
|
45
76
|
}
|
|
46
77
|
|
|
78
|
+
/* 档位只覆盖变量(几何只有一份)。5 / 6 档在默认最小宽 320 下要容器 1632 / 1960px 才排得出来,
|
|
79
|
+
留着它们是给「宽屏展示页 / 大屏看板」用 —— 配合 `columnMinWidth` 调小最小宽才落地得快。 */
|
|
80
|
+
.mh-form--columns-3 {
|
|
81
|
+
--mh-form-columns: 3;
|
|
82
|
+
}
|
|
83
|
+
.mh-form--columns-4 {
|
|
84
|
+
--mh-form-columns: 4;
|
|
85
|
+
}
|
|
86
|
+
.mh-form--columns-5 {
|
|
87
|
+
--mh-form-columns: 5;
|
|
88
|
+
}
|
|
89
|
+
.mh-form--columns-6 {
|
|
90
|
+
--mh-form-columns: 6;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ===== 动态列数(`columns="auto"`)=====
|
|
94
|
+
* `auto-fill` + `minmax(最小列宽, 1fr)`:**列数随容器宽度变**,列数 =
|
|
95
|
+
* `floor((容器宽 + 行距) / (最小宽 + 行距))`。实测(最小宽 320 / 行距 8):
|
|
96
|
+
* 640px → 1 列、660px → 2 列、1000px → 3 列、1320px → 4 列;每列宽落在 `[最小宽, 2 × 最小宽)`。
|
|
97
|
+
*
|
|
98
|
+
* 为什么是 `auto-fill` 而不是 `auto-fit`:两者只差在「子项少于轨道数」时 ——
|
|
99
|
+
* `auto-fit` 会**折叠空轨道**,于是宽容器里 2 个字段被拉成两条长条(实测 1400px 下每项 696px);
|
|
100
|
+
* `auto-fill` 保留轨道,字段列宽稳定在区间内(1400px 下每项 344px)。表单要的是**列宽稳定**,
|
|
101
|
+
* 不是「把剩余宽度填满」。 */
|
|
102
|
+
|
|
103
|
+
.mh-form--columns-auto {
|
|
104
|
+
display: grid;
|
|
105
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--mh-form-column-min), 1fr));
|
|
106
|
+
align-items: start;
|
|
107
|
+
}
|
|
108
|
+
|
|
47
109
|
/* 跨满整行:说明行 / 卡片组 / 表格 / 文本域这类整块内容(单列时 grid-column 无效,无副作用) */
|
|
48
110
|
|
|
49
111
|
.mh-form-item--full {
|
|
@@ -53,20 +115,27 @@
|
|
|
53
115
|
.mh-form-item {
|
|
54
116
|
/* label 列宽:Item 行内下发 --mh-form-label-width;未传时取令牌 */
|
|
55
117
|
--mh-form-label-width: var(--ui-form-label-width);
|
|
56
|
-
|
|
57
|
-
|
|
118
|
+
/* 两列:label 列(定宽)+ 控件列(吃满剩余)。控件列写 `minmax(0, 1fr)` 而不是 `1fr`:
|
|
119
|
+
它必须能被内部长内容压缩,否则长 URL / 自绘表格会撑破列宽。 */
|
|
120
|
+
display: grid;
|
|
121
|
+
grid-template-columns: var(--mh-form-label-width) minmax(0, 1fr);
|
|
122
|
+
/* **第 1 行内交叉轴居中** = label 文字与控件中线对齐。
|
|
123
|
+
第 1 行的行高由控件(恒高于一行文字)决定 ⇒ 对齐与控件高度**解耦**:
|
|
124
|
+
控件档位换 sm/md/lg、换主题、放自绘控件都自动成立,**不需要任何「控件高度」常量**。 */
|
|
125
|
+
align-items: center;
|
|
58
126
|
}
|
|
59
127
|
|
|
60
128
|
/* label 列:固定宽 + **右对齐**(与 farris 的动态表单一致,也是水平表单的通行默认)。
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
129
|
+
只占第 1 行(控件那一行),所以错误 / 说明的出现不会把它带走;
|
|
130
|
+
本件**不设任何高度** —— 从前用 min-height 取一个外部注入的控件高度来「假装等高」,
|
|
131
|
+
而那个变量在骨架层没有出处(回退 auto),label 盒退化成一行文字并贴行顶:
|
|
132
|
+
输入框中线偏高 6px、大号档偏高 10px、文本域偏高 9px。 */
|
|
64
133
|
|
|
65
134
|
.mh-form-item__label {
|
|
66
|
-
|
|
135
|
+
grid-column: 1;
|
|
136
|
+
grid-row: 1;
|
|
67
137
|
width: var(--mh-form-label-width);
|
|
68
138
|
box-sizing: border-box;
|
|
69
|
-
min-height: var(--ui-form-control-height, auto);
|
|
70
139
|
padding-right: var(--ui-space-3);
|
|
71
140
|
display: flex;
|
|
72
141
|
align-items: center;
|
|
@@ -113,17 +182,57 @@
|
|
|
113
182
|
white-space: nowrap;
|
|
114
183
|
}
|
|
115
184
|
|
|
185
|
+
/* 控件列:只装**控件本体**(错误 / 说明是行的直接子节点,自然落第 2 行起)。
|
|
186
|
+
`min-width: 0` 必须留:grid item 的默认 `min-width: auto` 会让长内容撑破列宽。 */
|
|
187
|
+
|
|
116
188
|
.mh-form-item__control {
|
|
117
|
-
|
|
189
|
+
grid-column: 2;
|
|
190
|
+
grid-row: 1;
|
|
118
191
|
min-width: 0;
|
|
119
192
|
}
|
|
120
193
|
|
|
194
|
+
/* 矮控件(开关 / 勾选框 / 单选)在控件列里**按盒居中**,而不是按行盒的基线排。
|
|
195
|
+
*
|
|
196
|
+
* 它们高 14~18px,**比一行文字(20px)还矮**(`Switch` / `Checkbox` / `Radio` 三件即这一族):
|
|
197
|
+
* 作为行内元素参与基线对齐时,控件列会被 line box 撑高(实测 22px = 18 + 行内 leading),
|
|
198
|
+
* 而控件本身在那一行里偏上 2px —— 开关与标签看着就不在一条中线上(本件第 1 行本来是居中的,
|
|
199
|
+
* 偏的是**控件列内部**这一层)。
|
|
200
|
+
*
|
|
201
|
+
* 单子项时把控件列切成 flex 并 `align-items: center`:控件列高度回到控件自身高度,
|
|
202
|
+
* 与 label 同处第 1 行、各自居中 ⇒ 两侧中线重合(实测 switch 18px / checkbox 14px 偏差都为 0,
|
|
203
|
+
* 行高也从 22px 回到 20px —— 不再被行盒的 leading 撑高)。
|
|
204
|
+
*
|
|
205
|
+
* 为什么限定「**唯一**子项」:控件列里放多个内容时(如「输入框 + 获取按钮」)原本是块级上下堆叠,
|
|
206
|
+
* 无条件 flex 会把它们排成一行 —— 那是布局变更,不是修对齐。
|
|
207
|
+
*
|
|
208
|
+
* 判据是**属性协议** `data-inline-control`,不是元素名、也不是别件的类名:
|
|
209
|
+
*
|
|
210
|
+
* - `Switch` / `Checkbox` / `Radio` 在根节点上声明这个属性(三件正好是这一族,14~18px);
|
|
211
|
+
* - **自绘的行内小控件**(根是 `div` / `span` 都行)在根上加同一个属性就自动接入 ——
|
|
212
|
+
* 不需要对齐本库的类名,也不必知道这里的实现;
|
|
213
|
+
* - 为什么不按元素名判(`label` / `button`):那把判据绑死在「别人怎么写 DOM」上,
|
|
214
|
+
* 自绘控件必然漏掉(而控件根是什么元素本就是它的实现自由);
|
|
215
|
+
* 按类名判则要求两个面互相引用,本仓既有裁决不允许。
|
|
216
|
+
*
|
|
217
|
+
* 对齐**不依赖控件列的高度**(别以为 `display: flex` 让控件列从「撑满行高」变成「内容撑高」
|
|
218
|
+
* 就把对齐弄丢了):switch 行三种行级配置实测 —— `center` 控件列 18px、`stretch` 控件列 20px,
|
|
219
|
+
* switch 中心都落在行中心、与 label 文字同线(Δ 都是 0);三种里唯一会偏的是 `align="start"`
|
|
220
|
+
* 顶对齐档(Δ = −10,label 有 9px 上内距而控件贴顶)—— 那一档是给多行 / 整块内容用的,
|
|
221
|
+
* 开关不要放进那种行,或显式写 `align="center"`。
|
|
222
|
+
* 将来若要让控件列**占满行高**(例如给它画背景 / 分割线),在行上写 `align-items: stretch`
|
|
223
|
+
* 或给控件列 `align-self: stretch` 即可 —— 实测那样 switch 依然居中。 */
|
|
224
|
+
|
|
225
|
+
.mh-form-item__control:has(> [data-inline-control]:only-child) {
|
|
226
|
+
display: flex;
|
|
227
|
+
align-items: center;
|
|
228
|
+
}
|
|
229
|
+
|
|
121
230
|
/* 只读文本行(Form.Item 的 text 形态:摘要 / 详情):正文色与行高,
|
|
122
|
-
长文案(SQL where、列说明)按词折行;`pre-wrap` 保留换行符(多行过滤条件回显)。
|
|
231
|
+
长文案(SQL where、列说明)按词折行;`pre-wrap` 保留换行符(多行过滤条件回显)。
|
|
232
|
+
它只占第 1 行、与 label 各自居中即对齐 —— **不给任何高度**(撑到某个「控件高」等于把那个
|
|
233
|
+
外部高度变量换个名字复活;只读行按内容高排版,行与行的间距归 `Form` 的 gap)。 */
|
|
123
234
|
|
|
124
235
|
.mh-form-item__text {
|
|
125
|
-
/* 与 label 同一口径:桥接层不给 `--ui-form-control-height` 时退回 auto(不给回退会让整条声明作废) */
|
|
126
|
-
min-height: var(--ui-form-control-height, auto);
|
|
127
236
|
display: flex;
|
|
128
237
|
align-items: center;
|
|
129
238
|
font-size: var(--ui-font-body);
|
|
@@ -139,7 +248,12 @@
|
|
|
139
248
|
color: var(--ui-base-content-subtle);
|
|
140
249
|
}
|
|
141
250
|
|
|
251
|
+
/* 错误 / 说明:**行的直接子节点**(不在控件列里面),排在控件行之下、与控件列同列。
|
|
252
|
+
只给 `grid-column` 不给行号 —— 自动放置会把它们推进下一个空行:控件占着第 1 行,
|
|
253
|
+
于是它们既不会挤进第 1 行、也不会掉到 label 列下面去。 */
|
|
254
|
+
|
|
142
255
|
.mh-form-item__error {
|
|
256
|
+
grid-column: 2;
|
|
143
257
|
margin-top: var(--ui-space-1);
|
|
144
258
|
font-size: var(--ui-font-caption);
|
|
145
259
|
line-height: var(--ui-line-caption);
|
|
@@ -147,33 +261,99 @@
|
|
|
147
261
|
}
|
|
148
262
|
|
|
149
263
|
.mh-form-item__hint {
|
|
264
|
+
grid-column: 2;
|
|
150
265
|
margin-top: var(--ui-space-1);
|
|
151
266
|
font-size: var(--ui-font-caption);
|
|
152
267
|
line-height: var(--ui-line-caption);
|
|
153
268
|
color: var(--ui-base-content-subtle);
|
|
154
269
|
}
|
|
155
270
|
|
|
271
|
+
/* ===== 无 label 列(`label` 与 `required` 都没有:整块内容 / 纯说明行)=====
|
|
272
|
+
* 控件位与提示横跨整行 —— 两列 grid 下第一列必须收掉,否则整块内容会被挤到 label 列宽之后。 */
|
|
273
|
+
.mh-form-item--no-label {
|
|
274
|
+
grid-template-columns: minmax(0, 1fr);
|
|
275
|
+
}
|
|
276
|
+
.mh-form-item--no-label > .mh-form-item__control,
|
|
277
|
+
.mh-form-item--no-label > .mh-form-item__error,
|
|
278
|
+
.mh-form-item--no-label > .mh-form-item__hint {
|
|
279
|
+
grid-column: 1 / -1;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/* ===== 行内垂直对齐档 =====
|
|
283
|
+
* 默认(基类)`center`:label 与控件**中线**对齐 —— 第 1 行行高 = 控件真实高度,
|
|
284
|
+
* 与控件档位 / 主题 / 自绘控件都无关。需要顶对齐的是**多行与整块内容**:label 该与首行文字齐,
|
|
285
|
+
* 而不是落到整块高度的中间。
|
|
286
|
+
*
|
|
287
|
+
* 自动判定(按控件形态,消费方零配置):认**原生元素** `textarea`,不认别件的类名(面之间不互指,
|
|
288
|
+
* 是本仓的既有裁决;认元素还顺带覆盖了代码编辑区这类自绘多行件)。
|
|
289
|
+
* 文本域的壳带 8px 上内距 + 1px 边框(控件自身内距被壳归零,见 input.css),
|
|
290
|
+
* label 补上同样的偏移才与**首行文字**同线 —— 不补则仍偏高 9px(实测)。
|
|
291
|
+
* 整条自动判定包 `:where()`:把选择器特异性压回 0-1-0,显式修饰类(0-2-0)才稳定压过它,
|
|
292
|
+
* 不必靠「谁写在后面」争胜出。 */
|
|
293
|
+
.mh-form-item:where(:has(.mh-form-item__control textarea)) {
|
|
294
|
+
align-items: start;
|
|
295
|
+
}
|
|
296
|
+
.mh-form-item:where(:has(.mh-form-item__control textarea)) > .mh-form-item__label {
|
|
297
|
+
padding-top: calc(var(--ui-space-2) + 1px);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* 显式档(`Form.Item` 的 `align`):样式认不出形态的自绘内容(卡片组 / 表格 / 富文本)写 start;
|
|
301
|
+
要强制回到默认的中线对齐写 center。两者都会压过上面的自动判定。
|
|
302
|
+
`start` 沿用与文本域**同一口径**的上内距(8px 内距 + 1px 边框):自绘块自带更大内距时会有几像素差
|
|
303
|
+
(实测块内距 12px 时差 4px)—— 组件无从知道自绘块内部的排版,要求严格同线时在块内自行调整。 */
|
|
304
|
+
.mh-form-item.mh-form-item--align-start {
|
|
305
|
+
align-items: start;
|
|
306
|
+
}
|
|
307
|
+
.mh-form-item.mh-form-item--align-start > .mh-form-item__label {
|
|
308
|
+
padding-top: calc(var(--ui-space-2) + 1px);
|
|
309
|
+
}
|
|
310
|
+
.mh-form-item.mh-form-item--align-center {
|
|
311
|
+
align-items: center;
|
|
312
|
+
}
|
|
313
|
+
.mh-form-item.mh-form-item--align-center > .mh-form-item__label {
|
|
314
|
+
padding-top: 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
156
317
|
/* ===== 纵向排布(`layout="vertical"`:label 在控件上方) =====
|
|
157
|
-
* 窄容器(抽屉 / 移动端)与「字段名很长」的场景用纵向 —— 横向时 label 列宽会把控件压得很窄。
|
|
318
|
+
* 窄容器(抽屉 / 移动端)与「字段名很长」的场景用纵向 —— 横向时 label 列宽会把控件压得很窄。
|
|
319
|
+
* 单列三行:label / 控件 / 提示依次往下(提示不给行号,自动放置接在控件之后)。
|
|
320
|
+
* 选择器带 `>` 且写成 0-3-0:纵向档必须压过上面的顶对齐档与显式档 ——
|
|
321
|
+
* 纵向时 label 本来就在上方,那 9px 上内距只会在 label 上多出一截空隙。 */
|
|
158
322
|
.mh-form--vertical .mh-form-item {
|
|
159
|
-
|
|
160
|
-
align-items: stretch;
|
|
323
|
+
grid-template-columns: minmax(0, 1fr);
|
|
161
324
|
}
|
|
162
|
-
.mh-form--vertical .mh-form-item__label {
|
|
325
|
+
.mh-form--vertical .mh-form-item > .mh-form-item__label {
|
|
326
|
+
grid-column: 1;
|
|
327
|
+
grid-row: 1;
|
|
163
328
|
width: auto;
|
|
164
329
|
min-width: 0;
|
|
165
330
|
justify-content: flex-start;
|
|
166
331
|
padding-right: 0;
|
|
167
|
-
padding-
|
|
332
|
+
padding-top: 0;
|
|
333
|
+
padding-bottom: var(--ui-space-2);
|
|
168
334
|
text-align: left;
|
|
169
335
|
}
|
|
336
|
+
.mh-form--vertical .mh-form-item > .mh-form-item__control {
|
|
337
|
+
grid-column: 1;
|
|
338
|
+
grid-row: 2;
|
|
339
|
+
}
|
|
340
|
+
.mh-form--vertical .mh-form-item > .mh-form-item__error,
|
|
341
|
+
.mh-form--vertical .mh-form-item > .mh-form-item__hint {
|
|
342
|
+
grid-column: 1;
|
|
343
|
+
}
|
|
170
344
|
|
|
171
345
|
/* ===== 表单头(`Form.Header`:单头,成员归位到最前)=====
|
|
172
346
|
只做**标题排版**与**右端操作位**,不承担区块分组(那是 `Panel` 的职责)。
|
|
173
347
|
三样(title / extra / description)都没有时组件整块不渲染 —— 空盒子同样占一档
|
|
174
348
|
`Form` 的 gap,会凭空多出间距。 */
|
|
175
349
|
|
|
350
|
+
/* `grid-column: 1 / -1`:多列下**表头必须跨满整行** —— 它是 `Form` 的一个 grid 子项,
|
|
351
|
+
不跨行就只占一格(实测 `columns={2}`、容器 800 时表头只有 396px = 半宽;列数越多越窄)。
|
|
352
|
+
`1 / -1` 引用的是最后一条**显式**轨道线,不会生成隐式轨道,故动态列数下同样安全;
|
|
353
|
+
单列(flex 形态)时该属性无效、无副作用(与 `.mh-form-item--full` 同款写法)。 */
|
|
354
|
+
|
|
176
355
|
.mh-form__header {
|
|
356
|
+
grid-column: 1 / -1;
|
|
177
357
|
display: flex;
|
|
178
358
|
flex-direction: column;
|
|
179
359
|
gap: var(--ui-space-1);
|
|
@@ -327,7 +327,20 @@
|
|
|
327
327
|
height: var(--ui-input-affix-size);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
/* ===== 清除(有内容才由组件渲染;圆形 + close
|
|
330
|
+
/* ===== 清除(有内容才由组件渲染;圆形 + close 字形)=====
|
|
331
|
+
*
|
|
332
|
+
* **默认隐形,滑过表壳或聚焦时才显形**:常显会在每一个有内容的输入框右端永远挂一颗深色实心圆点 ——
|
|
333
|
+
* 密集场景(表格内编辑、筛选条、多选触发器、带前后缀的搜索行)里那一列圆点比字段本身还抢眼,
|
|
334
|
+
* 也与「清除是低频动作」的层级不符。
|
|
335
|
+
*
|
|
336
|
+
* 为什么用 `opacity` 而不是 `display` / `visibility`:
|
|
337
|
+
* ① 它仍在流中**占位** —— 显隐时输入区宽度不变;换 `display` 会让文字在鼠标移入的一瞬间横跳;
|
|
338
|
+
* ② 它仍是可命中的**定位元素** —— 触发器形态的整箱热区靠 `position: relative` + DOM 顺序压在
|
|
339
|
+
* 覆盖层之上(见上一节),换 `visibility: hidden` 会连命中一起关掉,那一块反被热区接管。
|
|
340
|
+
*
|
|
341
|
+
* `:focus-within` 是**触屏与键盘**的兜底:没有 hover 的设备上,点进输入框同样要能点到清除
|
|
342
|
+
* (键盘另有一条 `Delete` 路径,见组件)。禁用档不显形:那时本来就不该清,圆点落在灰底上还会
|
|
343
|
+
* 被误读成可用。 */
|
|
331
344
|
.mh-input__clear {
|
|
332
345
|
flex: none;
|
|
333
346
|
display: inline-flex;
|
|
@@ -344,6 +357,20 @@
|
|
|
344
357
|
background: var(--ui-base-300); /* 规范 Te10 圆点底 */
|
|
345
358
|
color: var(--ui-base-100);
|
|
346
359
|
cursor: pointer;
|
|
360
|
+
opacity: 0;
|
|
361
|
+
transition-property: opacity;
|
|
362
|
+
transition-duration: 0.15s;
|
|
363
|
+
transition-timing-function: ease;
|
|
364
|
+
}
|
|
365
|
+
/* 显形:滑过**整件**(内距与附加位区域都算)或任一控件拿到焦点 */
|
|
366
|
+
.mh-input__wrap:hover > .mh-input__clear,
|
|
367
|
+
.mh-input__wrap:focus-within > .mh-input__clear {
|
|
368
|
+
opacity: 1;
|
|
369
|
+
}
|
|
370
|
+
/* 禁用:整件不可交互,清除位一并收掉(`:has()` 的特异性高于上面那条,故同时压过 hover) */
|
|
371
|
+
.mh-input__wrap:has(> .mh-input:disabled) > .mh-input__clear,
|
|
372
|
+
.mh-input__wrap:has(> .mh-input.is-disabled) > .mh-input__clear {
|
|
373
|
+
opacity: 0;
|
|
347
374
|
}
|
|
348
375
|
.mh-input__clear:hover,
|
|
349
376
|
.mh-input__clear:active {
|
|
@@ -370,7 +397,7 @@
|
|
|
370
397
|
.mh-input__eye:hover {
|
|
371
398
|
color: var(--ui-primary);
|
|
372
399
|
}
|
|
373
|
-
/* 明文显示中:图标转主色(同一个 `
|
|
400
|
+
/* 明文显示中:图标转主色(同一个 `preview` 字形,靠状态色表达"当前是明文") */
|
|
374
401
|
.mh-input__eye.is-on {
|
|
375
402
|
color: var(--ui-primary);
|
|
376
403
|
}
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
display: flex;
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
gap: var(--mh-layout-row-gap);
|
|
42
|
+
/* 内距不在本件声明:由 `padding` prop 直接下发实体 `padding`(值来自 prop) */
|
|
42
43
|
/* 交叉轴(水平)不声明 = CSS 默认的 stretch(子项齐宽);要居中写 align="center" */
|
|
43
44
|
/* 放开 min-width:行常被塞进窄格子(表格单元格、限宽控件列)——
|
|
44
45
|
不放开的 flex 容器压不进窄格,会把外层撑破 */
|
|
@@ -110,6 +111,7 @@
|
|
|
110
111
|
要贴顶写 align="start"、要齐宽写 align="stretch" */
|
|
111
112
|
align-items: center;
|
|
112
113
|
gap: var(--mh-layout-column-gap);
|
|
114
|
+
/* 内距不在本件声明:同 `.mh-layout-row`,由 `padding` prop 直接下发 */
|
|
113
115
|
min-width: 0;
|
|
114
116
|
}
|
|
115
117
|
|