@manohub/ui 1.3.3 → 1.3.4
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 +25 -4
- package/dist/components/button/index.d.ts +5 -5
- package/dist/components/button/index.js +1 -1
- package/dist/components/card/index.d.ts +3 -3
- package/dist/components/checkbox/index.d.ts +30 -25
- package/dist/components/checkbox/index.js +16 -11
- package/dist/components/dialog/index.d.ts +121 -120
- package/dist/components/dialog/index.js +122 -144
- package/dist/components/divider/index.d.ts +1 -1
- package/dist/components/drawer/index.d.ts +53 -54
- package/dist/components/drawer/index.js +71 -96
- package/dist/components/form/index.d.ts +3 -3
- package/dist/components/form/index.js +1 -1
- package/dist/components/input/index.d.ts +1 -2
- package/dist/components/layout/index.d.ts +2 -2
- package/dist/components/layout/index.js +1 -1
- package/dist/components/list/tree.d.ts +5 -5
- package/dist/components/list-view/index.d.ts +1 -1
- package/dist/components/notice/index.d.ts +3 -3
- package/dist/components/notice/index.js +1 -1
- package/dist/components/notification/index.d.ts +2 -2
- package/dist/components/page/index.d.ts +1 -1
- package/dist/components/pagination/index.d.ts +2 -2
- package/dist/components/popup/index.d.ts +117 -0
- package/dist/components/popup/index.js +223 -0
- package/dist/components/popup/inert-scope.d.ts +22 -0
- package/dist/components/popup/inert-scope.js +54 -0
- package/dist/components/popup/scroll-lock.d.ts +2 -0
- package/dist/components/popup/scroll-lock.js +43 -0
- package/dist/components/query-state/index.d.ts +1 -1
- package/dist/components/radio/index.d.ts +18 -19
- package/dist/components/radio/index.js +12 -6
- package/dist/components/scrollbar/index.d.ts +4 -4
- package/dist/components/steps/index.d.ts +7 -7
- package/dist/components/steps/index.js +1 -1
- package/dist/components/tabbar/index.d.ts +1 -1
- package/dist/components/table/index.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/services/dialog.d.ts +5 -5
- package/dist/services/dialog.js +9 -6
- package/dist/styles/components/avatar.css +3 -3
- package/dist/styles/components/badge.css +4 -4
- package/dist/styles/components/button.css +11 -12
- package/dist/styles/components/button.tokens.css +20 -21
- package/dist/styles/components/capsule.css +4 -4
- package/dist/styles/components/capsule.tokens.css +7 -7
- package/dist/styles/components/card.css +1 -2
- package/dist/styles/components/card.tokens.css +2 -2
- package/dist/styles/components/checkbox.css +23 -33
- package/dist/styles/components/checkbox.tokens.css +5 -9
- package/dist/styles/components/code-block.css +230 -230
- package/dist/styles/components/code-block.tokens.css +9 -9
- package/dist/styles/components/collapse.css +2 -2
- package/dist/styles/components/collapse.tokens.css +2 -2
- package/dist/styles/components/date-picker.tokens.css +1 -1
- package/dist/styles/components/dialog.css +36 -31
- package/dist/styles/components/dialog.tokens.css +7 -7
- package/dist/styles/components/divider.css +4 -5
- package/dist/styles/components/divider.tokens.css +1 -1
- package/dist/styles/components/drawer.css +15 -24
- package/dist/styles/components/drawer.tokens.css +4 -4
- package/dist/styles/components/filter.css +2 -2
- package/dist/styles/components/form.css +4 -4
- package/dist/styles/components/form.tokens.css +5 -5
- package/dist/styles/components/input.css +8 -8
- package/dist/styles/components/input.tokens.css +16 -18
- package/dist/styles/components/layout.tokens.css +3 -3
- package/dist/styles/components/list-view.tokens.css +2 -2
- package/dist/styles/components/list.css +4 -5
- package/dist/styles/components/list.tokens.css +3 -3
- package/dist/styles/components/loading.css +3 -3
- package/dist/styles/components/loading.tokens.css +4 -3
- package/dist/styles/components/notice.css +8 -9
- package/dist/styles/components/notice.tokens.css +4 -5
- package/dist/styles/components/notification.css +11 -12
- package/dist/styles/components/notification.tokens.css +12 -14
- package/dist/styles/components/page.css +4 -4
- package/dist/styles/components/pagination.css +8 -10
- package/dist/styles/components/pagination.tokens.css +10 -10
- package/dist/styles/components/panel.css +1 -1
- package/dist/styles/components/query-state.css +7 -7
- package/dist/styles/components/query-state.tokens.css +1 -1
- package/dist/styles/components/radio.css +14 -18
- package/dist/styles/components/radio.tokens.css +6 -8
- package/dist/styles/components/scrollbar.css +2 -2
- package/dist/styles/components/select.css +4 -4
- package/dist/styles/components/select.tokens.css +5 -5
- package/dist/styles/components/skeleton.css +1 -1
- package/dist/styles/components/skeleton.tokens.css +7 -8
- package/dist/styles/components/steps.css +5 -5
- package/dist/styles/components/steps.tokens.css +10 -11
- package/dist/styles/components/switch.css +2 -2
- package/dist/styles/components/switch.tokens.css +5 -5
- package/dist/styles/components/tabbar.css +1 -2
- package/dist/styles/components/tabbar.tokens.css +9 -9
- package/dist/styles/components/table.css +8 -10
- package/dist/styles/components/table.tokens.css +6 -6
- package/dist/styles/components/tag.css +3 -3
- package/dist/styles/components/tag.tokens.css +2 -2
- package/dist/styles/components/toast.css +8 -8
- package/dist/styles/components/toast.tokens.css +7 -6
- package/dist/styles/components/tooltip.css +3 -3
- package/dist/styles/components/tooltip.tokens.css +6 -6
- package/dist/styles/components/upload.css +3 -3
- package/dist/styles/components/upload.tokens.css +8 -8
- package/dist/styles/index.css +1 -0
- package/dist/styles/operations/collapse.css +1 -1
- package/dist/styles/operations/popup-layer.css +95 -0
- package/dist/styles/operations/popup.css +4 -4
- package/dist/styles/operations/tabs.css +3 -3
- package/dist/utils/popup-host.d.ts +36 -0
- package/dist/utils/popup-host.js +21 -0
- package/dist/utils/scope-svg-ids.d.ts +4 -4
- package/dist/utils/state-illustration.d.ts +8 -8
- package/package.json +2 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
1
|
+
import { defineComponent, ref, computed, createVNode } from "vue";
|
|
2
2
|
import { Icon } from "@manohub/icon";
|
|
3
3
|
import { Button } from "../button/index.js";
|
|
4
|
+
import { Popup } from "../popup/index.js";
|
|
4
5
|
import { useOverlayScrollbar } from "../scrollbar/index.js";
|
|
6
|
+
import { resolvePopupHost } from "../../utils/popup-host.js";
|
|
5
7
|
const Drawer = /* @__PURE__ */ defineComponent({
|
|
6
8
|
name: "Drawer",
|
|
7
9
|
inheritAttrs: false,
|
|
@@ -26,34 +28,38 @@ const Drawer = /* @__PURE__ */ defineComponent({
|
|
|
26
28
|
type: [Number, String],
|
|
27
29
|
default: 480
|
|
28
30
|
},
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
+
/** Teleport 目标(选择器 / 元素 / 取值函数) */
|
|
32
|
+
host: {
|
|
33
|
+
type: [String, Object, Function],
|
|
34
|
+
default: void 0
|
|
35
|
+
},
|
|
36
|
+
/** 是否显示遮罩(缺省 `true`):`false` 只改底色,不改模态语义,并关掉点空白关闭 */
|
|
37
|
+
mask: {
|
|
31
38
|
type: Boolean,
|
|
32
39
|
default: true
|
|
33
40
|
},
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
* 「误点遮罩丢掉填了一半的表单」比「多点一次关闭」代价高,故缺省关;
|
|
38
|
-
* 「看一眼就关」的帮助 / 预览类抽屉自己显式传 `:close-on-backdrop="true"`。
|
|
39
|
-
* 与 `Dialog` 同一口径;命令式 `confirm()` / `alert()` 显式传 `false`,不受本缺省影响。
|
|
40
|
-
*/
|
|
41
|
-
closeOnBackdrop: {
|
|
41
|
+
/** 是否显示关闭位 */
|
|
42
|
+
closable: {
|
|
42
43
|
type: Boolean,
|
|
43
|
-
default:
|
|
44
|
+
default: true
|
|
44
45
|
},
|
|
45
|
-
/**
|
|
46
|
+
/** 点遮罩是否关闭 */
|
|
46
47
|
maskClosable: {
|
|
47
48
|
type: Boolean,
|
|
48
|
-
default:
|
|
49
|
+
default: true
|
|
49
50
|
},
|
|
50
51
|
/** Esc 是否关闭(缺省开;表单类需要彻底防误关时自己传 `false`) */
|
|
51
52
|
keyboard: {
|
|
52
53
|
type: Boolean,
|
|
53
54
|
default: true
|
|
54
55
|
},
|
|
56
|
+
/** 是否渲染内建底栏;缺省 = 「给了 `onConfirm` 才渲染」 */
|
|
57
|
+
showFooter: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: void 0
|
|
60
|
+
},
|
|
55
61
|
/** 内建底栏:确定按钮文案 */
|
|
56
|
-
|
|
62
|
+
confirmText: {
|
|
57
63
|
type: String,
|
|
58
64
|
default: "确定"
|
|
59
65
|
},
|
|
@@ -63,22 +69,17 @@ const Drawer = /* @__PURE__ */ defineComponent({
|
|
|
63
69
|
default: "取消"
|
|
64
70
|
},
|
|
65
71
|
/** 确定按钮的危险色(删除类确认) */
|
|
66
|
-
|
|
72
|
+
confirmDanger: {
|
|
67
73
|
type: Boolean,
|
|
68
74
|
default: false
|
|
69
75
|
},
|
|
70
|
-
/** 确定按钮的加载态(外部受控;`
|
|
76
|
+
/** 确定按钮的加载态(外部受控;`onConfirm` 返回 Promise 时本件也会自己管) */
|
|
71
77
|
confirmLoading: {
|
|
72
78
|
type: Boolean,
|
|
73
79
|
default: false
|
|
74
80
|
},
|
|
75
|
-
/** 是否渲染内建底栏;缺省 = 「给了 `onOk` 才渲染」 */
|
|
76
|
-
showFooter: {
|
|
77
|
-
type: Boolean,
|
|
78
|
-
default: void 0
|
|
79
|
-
},
|
|
80
81
|
/** 确定回调(返回 Promise 时按钮自动进加载态;非 thenable 一律忽略) */
|
|
81
|
-
|
|
82
|
+
onConfirm: {
|
|
82
83
|
type: Function,
|
|
83
84
|
default: void 0
|
|
84
85
|
},
|
|
@@ -102,104 +103,78 @@ const Drawer = /* @__PURE__ */ defineComponent({
|
|
|
102
103
|
slots,
|
|
103
104
|
attrs
|
|
104
105
|
}) {
|
|
105
|
-
const dialogRef = ref(null);
|
|
106
106
|
const scrollRef = ref(null);
|
|
107
107
|
const scrollbar = useOverlayScrollbar(scrollRef);
|
|
108
108
|
const innerLoading = ref(false);
|
|
109
|
+
const isHost = computed(() => (props.host === void 0 ? resolvePopupHost() : resolvePopupHost(props.host)) !== null);
|
|
109
110
|
const requestClose = (kind = "close") => {
|
|
110
111
|
if (kind === "cancel") props.onCancel?.();
|
|
111
112
|
props.onClose?.();
|
|
112
113
|
emit("update:open", false);
|
|
113
114
|
};
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
if (!el) return;
|
|
117
|
-
if (props.open) {
|
|
118
|
-
if (!el.open && typeof el.showModal === "function") {
|
|
119
|
-
el.showModal();
|
|
120
|
-
el.focus({
|
|
121
|
-
preventScroll: true
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
} else if (el.open && typeof el.close === "function") {
|
|
125
|
-
el.close();
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
watch(() => props.open, syncOpen, {
|
|
129
|
-
flush: "post"
|
|
130
|
-
});
|
|
131
|
-
onMounted(syncOpen);
|
|
132
|
-
onBeforeUnmount(() => {
|
|
133
|
-
const el = dialogRef.value;
|
|
134
|
-
if (el?.open && typeof el.close === "function") el.close();
|
|
135
|
-
});
|
|
136
|
-
const handleOk = () => {
|
|
137
|
-
const result = props.onOk?.();
|
|
115
|
+
const handleConfirm = () => {
|
|
116
|
+
const result = props.onConfirm?.();
|
|
138
117
|
if (result && typeof result.then === "function") {
|
|
139
118
|
innerLoading.value = true;
|
|
140
119
|
void result.finally(() => innerLoading.value = false);
|
|
141
120
|
}
|
|
142
121
|
};
|
|
143
122
|
const loading = computed(() => props.confirmLoading || innerLoading.value);
|
|
144
|
-
const showBuiltinFooter = computed(() => props.showFooter ?? props.
|
|
123
|
+
const showBuiltinFooter = computed(() => props.showFooter ?? props.onConfirm !== void 0);
|
|
145
124
|
const widthStyle = computed(() => {
|
|
146
125
|
const width = typeof props.width === "number" ? `${props.width}px` : props.width;
|
|
147
126
|
return {
|
|
148
127
|
width
|
|
149
128
|
};
|
|
150
129
|
});
|
|
151
|
-
return () => createVNode(
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
130
|
+
return () => createVNode(Popup, {
|
|
131
|
+
"open": props.open,
|
|
132
|
+
"host": props.host,
|
|
133
|
+
"mask": props.mask,
|
|
134
|
+
"maskClosable": props.maskClosable,
|
|
135
|
+
"keyboard": props.keyboard,
|
|
136
|
+
"onRequestClose": requestClose,
|
|
137
|
+
"class": ["mh-drawer", props.side === "left" ? "mh-drawer--left" : "", isHost.value ? "mh-drawer--host" : "", attrs.class].filter(Boolean).join(" "),
|
|
155
138
|
"style": {
|
|
156
139
|
...widthStyle.value,
|
|
157
140
|
...attrs.style
|
|
158
|
-
},
|
|
159
|
-
"onCancel": (event) => {
|
|
160
|
-
event.preventDefault();
|
|
161
|
-
if (!props.keyboard) return;
|
|
162
|
-
requestClose("cancel");
|
|
163
|
-
},
|
|
164
|
-
"onClick": (event) => {
|
|
165
|
-
if ((props.closeOnBackdrop || props.maskClosable) && event.target === dialogRef.value) {
|
|
166
|
-
requestClose("close");
|
|
167
|
-
}
|
|
168
141
|
}
|
|
169
|
-
}, [props.title || slots.title || props.closable ? createVNode("div", {
|
|
170
|
-
"class": "mh-drawer__header"
|
|
171
|
-
}, [createVNode("span", {
|
|
172
|
-
"class": "mh-drawer__title"
|
|
173
|
-
}, [slots.title ? slots.title() : props.title]), props.closable ? createVNode("button", {
|
|
174
|
-
"type": "button",
|
|
175
|
-
"class": "mh-drawer__close",
|
|
176
|
-
"aria-label": "关闭",
|
|
177
|
-
"onClick": () => requestClose("cancel")
|
|
178
|
-
}, [createVNode(Icon, {
|
|
179
|
-
"name": "close",
|
|
180
|
-
"size": 14
|
|
181
|
-
}, null)]) : null]) : null, createVNode("div", {
|
|
182
|
-
"class": "mh-drawer__body"
|
|
183
|
-
}, [createVNode("div", {
|
|
184
|
-
"class": "mh-drawer__scroll",
|
|
185
|
-
"ref": scrollRef
|
|
186
|
-
}, [slots.default?.()]), scrollbar.render()]), slots.footer ? createVNode("div", {
|
|
187
|
-
"class": "mh-drawer__footer"
|
|
188
|
-
}, [slots.footer()]) : showBuiltinFooter.value ? createVNode("div", {
|
|
189
|
-
"class": "mh-drawer__footer"
|
|
190
|
-
}, [createVNode(Button, {
|
|
191
|
-
"variant": "secondary",
|
|
192
|
-
"onClick": () => requestClose("cancel")
|
|
193
|
-
}, {
|
|
194
|
-
default: () => props.cancelText
|
|
195
|
-
}), createVNode(Button, {
|
|
196
|
-
"variant": "primary",
|
|
197
|
-
"danger": props.okDanger,
|
|
198
|
-
"loading": loading.value,
|
|
199
|
-
"onClick": handleOk
|
|
200
142
|
}, {
|
|
201
|
-
default: () => props.
|
|
202
|
-
|
|
143
|
+
default: () => [props.title || slots.title || props.closable ? createVNode("div", {
|
|
144
|
+
"class": "mh-drawer__header"
|
|
145
|
+
}, [createVNode("span", {
|
|
146
|
+
"class": "mh-drawer__title"
|
|
147
|
+
}, [slots.title ? slots.title() : props.title]), props.closable ? createVNode("button", {
|
|
148
|
+
"type": "button",
|
|
149
|
+
"class": "mh-drawer__close",
|
|
150
|
+
"aria-label": "关闭",
|
|
151
|
+
"onClick": () => requestClose("cancel")
|
|
152
|
+
}, [createVNode(Icon, {
|
|
153
|
+
"name": "close",
|
|
154
|
+
"size": 14
|
|
155
|
+
}, null)]) : null]) : null, createVNode("div", {
|
|
156
|
+
"class": "mh-drawer__body"
|
|
157
|
+
}, [createVNode("div", {
|
|
158
|
+
"class": "mh-drawer__scroll",
|
|
159
|
+
"ref": scrollRef
|
|
160
|
+
}, [slots.default?.()]), scrollbar.render()]), slots.footer ? createVNode("div", {
|
|
161
|
+
"class": "mh-drawer__footer"
|
|
162
|
+
}, [slots.footer()]) : showBuiltinFooter.value ? createVNode("div", {
|
|
163
|
+
"class": "mh-drawer__footer"
|
|
164
|
+
}, [createVNode(Button, {
|
|
165
|
+
"variant": "secondary",
|
|
166
|
+
"onClick": () => requestClose("cancel")
|
|
167
|
+
}, {
|
|
168
|
+
default: () => props.cancelText
|
|
169
|
+
}), createVNode(Button, {
|
|
170
|
+
"variant": "primary",
|
|
171
|
+
"danger": props.confirmDanger,
|
|
172
|
+
"loading": loading.value,
|
|
173
|
+
"onClick": handleConfirm
|
|
174
|
+
}, {
|
|
175
|
+
default: () => props.confirmText
|
|
176
|
+
})]) : null]
|
|
177
|
+
});
|
|
203
178
|
}
|
|
204
179
|
});
|
|
205
180
|
export {
|
|
@@ -372,7 +372,7 @@ export declare const Form: {
|
|
|
372
372
|
type: PropType<"horizontal" | "vertical">;
|
|
373
373
|
default: string;
|
|
374
374
|
};
|
|
375
|
-
/** 行距(px,字段行之间 / 与 `Form.Header` 之间);缺省沿用样式里的 8px 档。筛选条这类「上行 + 一行字段」的紧凑排布要 16
|
|
375
|
+
/** 行距(px,字段行之间 / 与 `Form.Header` 之间);缺省沿用样式里的 8px 档。筛选条这类「上行 + 一行字段」的紧凑排布要 16,长表单也可以调松。 */
|
|
376
376
|
gap: {
|
|
377
377
|
type: NumberConstructor;
|
|
378
378
|
default: undefined;
|
|
@@ -462,7 +462,7 @@ export declare const Form: {
|
|
|
462
462
|
type: PropType<"horizontal" | "vertical">;
|
|
463
463
|
default: string;
|
|
464
464
|
};
|
|
465
|
-
/** 行距(px,字段行之间 / 与 `Form.Header` 之间);缺省沿用样式里的 8px 档。筛选条这类「上行 + 一行字段」的紧凑排布要 16
|
|
465
|
+
/** 行距(px,字段行之间 / 与 `Form.Header` 之间);缺省沿用样式里的 8px 档。筛选条这类「上行 + 一行字段」的紧凑排布要 16,长表单也可以调松。 */
|
|
466
466
|
gap: {
|
|
467
467
|
type: NumberConstructor;
|
|
468
468
|
default: undefined;
|
|
@@ -545,7 +545,7 @@ export declare const Form: {
|
|
|
545
545
|
type: PropType<"horizontal" | "vertical">;
|
|
546
546
|
default: string;
|
|
547
547
|
};
|
|
548
|
-
/** 行距(px,字段行之间 / 与 `Form.Header` 之间);缺省沿用样式里的 8px 档。筛选条这类「上行 + 一行字段」的紧凑排布要 16
|
|
548
|
+
/** 行距(px,字段行之间 / 与 `Form.Header` 之间);缺省沿用样式里的 8px 档。筛选条这类「上行 + 一行字段」的紧凑排布要 16,长表单也可以调松。 */
|
|
549
549
|
gap: {
|
|
550
550
|
type: NumberConstructor;
|
|
551
551
|
default: undefined;
|
|
@@ -237,7 +237,7 @@ const FormRoot = /* @__PURE__ */ defineComponent({
|
|
|
237
237
|
type: String,
|
|
238
238
|
default: "horizontal"
|
|
239
239
|
},
|
|
240
|
-
/** 行距(px,字段行之间 / 与 `Form.Header` 之间);缺省沿用样式里的 8px 档。筛选条这类「上行 + 一行字段」的紧凑排布要 16
|
|
240
|
+
/** 行距(px,字段行之间 / 与 `Form.Header` 之间);缺省沿用样式里的 8px 档。筛选条这类「上行 + 一行字段」的紧凑排布要 16,长表单也可以调松。 */
|
|
241
241
|
gap: {
|
|
242
242
|
type: Number,
|
|
243
243
|
default: void 0
|
|
@@ -10,8 +10,7 @@ export interface TextareaAutoSize {
|
|
|
10
10
|
/**
|
|
11
11
|
* 输入框(**自绘**,不封装 farris)。
|
|
12
12
|
*
|
|
13
|
-
* `Input` / `Textarea` 共用同一份面 `styles/components/input.css
|
|
14
|
-
* `input.css` 里),本文件因此同时导出两个件:单行与多行结构不同(多行没有清除/眼睛,单行没有计数),
|
|
13
|
+
* `Input` / `Textarea` 共用同一份面 `styles/components/input.css`,本文件因此同时导出两个件:单行与多行结构不同(多行没有清除/眼睛,单行没有计数),
|
|
15
14
|
* 硬合成一个件会让 props 互相污染。
|
|
16
15
|
*
|
|
17
16
|
* 统一词表(与 `Checkbox` / `Switch` 同款):`modelValue` / `onChange` / `disabled` / `size`。
|
|
@@ -89,7 +89,7 @@ export declare const Layout: {
|
|
|
89
89
|
/**
|
|
90
90
|
* 内距:**走骨架件共享口径**(`Padding`,同 `Card` / `Form` / `Page` / `Panel`)—— `number` 四边同值、
|
|
91
91
|
* `{ y, x }` 分上下 / 左右、`string` 原样下发(CSS 简写,**逃生舱**),口径与理由见 `part-padding.ts`。
|
|
92
|
-
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 ——
|
|
92
|
+
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 —— 内距常是**确定坐标**,
|
|
93
93
|
* 令牌梯度(最大 24px)表达不了。⚠️ 用它之前先想一次:这个数真是「内距」吗?若是「与某个内容列对齐」这类**布局
|
|
94
94
|
* 坐标**,优先改由结构表达(同轴容器 / `columns` / `minColumnWidth`)。
|
|
95
95
|
*/
|
|
@@ -211,7 +211,7 @@ export declare const Layout: {
|
|
|
211
211
|
/**
|
|
212
212
|
* 内距:**走骨架件共享口径**(`Padding`,同 `Card` / `Form` / `Page` / `Panel`)—— `number` 四边同值、
|
|
213
213
|
* `{ y, x }` 分上下 / 左右、`string` 原样下发(CSS 简写,**逃生舱**),口径与理由见 `part-padding.ts`。
|
|
214
|
-
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 ——
|
|
214
|
+
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 —— 内距常是**确定坐标**,
|
|
215
215
|
* 令牌梯度(最大 24px)表达不了。⚠️ 用它之前先想一次:这个数真是「内距」吗?若是「与某个内容列对齐」这类**布局
|
|
216
216
|
* 坐标**,优先改由结构表达(同轴容器 / `columns` / `minColumnWidth`)。
|
|
217
217
|
*/
|
|
@@ -199,7 +199,7 @@ const LayoutRow = /* @__PURE__ */ defineComponent({
|
|
|
199
199
|
/**
|
|
200
200
|
* 内距:**走骨架件共享口径**(`Padding`,同 `Card` / `Form` / `Page` / `Panel`)—— `number` 四边同值、
|
|
201
201
|
* `{ y, x }` 分上下 / 左右、`string` 原样下发(CSS 简写,**逃生舱**),口径与理由见 `part-padding.ts`。
|
|
202
|
-
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 ——
|
|
202
|
+
* ⚠️ 与 `gap` 不同口径:`gap` 只开放令牌档(防间距分叉),`padding` 接具体值 —— 内距常是**确定坐标**,
|
|
203
203
|
* 令牌梯度(最大 24px)表达不了。⚠️ 用它之前先想一次:这个数真是「内距」吗?若是「与某个内容列对齐」这类**布局
|
|
204
204
|
* 坐标**,优先改由结构表达(同轴容器 / `columns` / `minColumnWidth`)。
|
|
205
205
|
*/
|
|
@@ -3,11 +3,11 @@ import { type ListNode } from './list-shared';
|
|
|
3
3
|
/**
|
|
4
4
|
* 树(**自建**,不封装 farris)。
|
|
5
5
|
*
|
|
6
|
-
* ##
|
|
6
|
+
* ## 视觉与几何
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* 节点行高 30(紧凑档 28)、圆角 6、字号 13、滑过 `--ui-primary-weak`、点击瞬态与选中
|
|
9
|
+
* `--ui-primary-subtle`(选中另加主色字)、箭头 8px(收起态转 −90°)、缩进 = 基础内距 8 + level × 步进 10
|
|
10
|
+
* (**无上限**)。两处**有意差异**(不改视觉,只改承载方式):
|
|
11
11
|
* 1. **缩进步进由 CSS 变量承载**:主题包用 typed `attr(data-level type(<number>))` 一步算出;本组件同时
|
|
12
12
|
* 下发 `data-level`(数据、供 CSS / 测试钩子)与 `--mh-list-level`(公式仍在 CSS 内),不用行内
|
|
13
13
|
* `paddingLeft` —— 那样步进值散落在 JS 里,改了令牌对不上。
|
|
@@ -19,7 +19,7 @@ import { type ListNode } from './list-shared';
|
|
|
19
19
|
* farris `FTreeView` 实测:① 列模板式网格(节点内容可用 `columnTemplate` 承载);② **只在挂载时填充一次
|
|
20
20
|
* 可见行,data 变化不刷新**(唯一兜底是 `key` 强制重挂 —— 那会丢展开态);③ 层级缩进不可控、节点图标走
|
|
21
21
|
* farris 图标字体类。而本组件的硬需求是「数据更新时**不丢**已展开节点 / 滚动位置 / 焦点」,与 ② 直接冲突
|
|
22
|
-
*
|
|
22
|
+
* (重挂必然丢展开态),缩进又要精确控制(③)。故自建:契约完整(含受控展开态)、零 farris 耦合、
|
|
23
23
|
* 可在无浏览器环境测试。
|
|
24
24
|
* 与数据变化:**不需要**「nodes 变就重建」这种逃生舱 —— 渲染直接跟随 `nodes`,展开态由 `expandedKeys`
|
|
25
25
|
* (受控)或内部状态(非受控)持有,数据刷新不改变展开态;`treeKey` 仅作极端场景的强制重挂出口。
|
|
@@ -65,7 +65,7 @@ export interface ListViewProps {
|
|
|
65
65
|
* 列表卡片项:卡片的**结构化形态**(图标 / 标题 / 副标题 / 描述 / 标签 / 状态胶囊 / 统计 / 操作位)。
|
|
66
66
|
*
|
|
67
67
|
* 以 `Card interactive` 为壳,卡片外观与悬浮反馈都来自它;本件只管卡片**内部**的排版与几何(最小高 144、
|
|
68
|
-
* 图标 36、标题 16/600
|
|
68
|
+
* 图标 36、标题 16/600、描述两行截断、尾部贴底、胶囊与标签片),几何同 `Card`。
|
|
69
69
|
*
|
|
70
70
|
* 三处「有意为之」:① **操作位默认隐藏**(`opacity: 0`),卡片悬浮或卡内获得焦点时显形、触屏恒显形 —— 因此
|
|
71
71
|
* 按钮始终可聚焦、可点,只是平时不抢视觉;② **操作位点击不冒泡**(卡内按钮不会顺带触发整卡的 `onClick`);
|
|
@@ -9,7 +9,7 @@ export type NoticeTone = 'info' | 'success' | 'warning' | 'error';
|
|
|
9
9
|
* 头像的卡片)、`Toast`(浮出后自己消失)都不是一回事,三者的判据是**出现方式**(见 `Toast` 的「与 Notice /
|
|
10
10
|
* Notification 的判据」);上游没有可复用的形态,故自建并定为本包的一族。
|
|
11
11
|
*
|
|
12
|
-
* ##
|
|
12
|
+
* ## 口径
|
|
13
13
|
* **警示 / 错误须常驻**(不渲染关闭按钮),只有通知类信息才可关闭 —— 故 `closable` 默认 `false`,由消费方显式开启;
|
|
14
14
|
* 位置:页面顶部通栏(页面主体顶部),静态展示、不随滚动消失。
|
|
15
15
|
* **两种排版**(按内容量选):一行话(默认插槽 / `description`)→ 单行,图标与文字同行;有标题(`message` +
|
|
@@ -40,7 +40,7 @@ export declare const Notice: import("vue").DefineComponent<import("vue").Extract
|
|
|
40
40
|
type: PropType<boolean | IconName>;
|
|
41
41
|
default: boolean;
|
|
42
42
|
};
|
|
43
|
-
/**
|
|
43
|
+
/** 是否渲染右上关闭按钮(仅通知类信息可关闭) */
|
|
44
44
|
closable: {
|
|
45
45
|
type: BooleanConstructor;
|
|
46
46
|
default: boolean;
|
|
@@ -90,7 +90,7 @@ export declare const Notice: import("vue").DefineComponent<import("vue").Extract
|
|
|
90
90
|
type: PropType<boolean | IconName>;
|
|
91
91
|
default: boolean;
|
|
92
92
|
};
|
|
93
|
-
/**
|
|
93
|
+
/** 是否渲染右上关闭按钮(仅通知类信息可关闭) */
|
|
94
94
|
closable: {
|
|
95
95
|
type: BooleanConstructor;
|
|
96
96
|
default: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IconName } from '@manohub/icon';
|
|
2
2
|
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
3
|
-
/** 语义五档(`submit` 与 `success` 共用淡底,只换左边线 ——
|
|
3
|
+
/** 语义五档(`submit` 与 `success` 共用淡底,只换左边线 —— 两档同构) */
|
|
4
4
|
export type NotificationTone = 'info' | 'success' | 'warning' | 'error' | 'submit';
|
|
5
5
|
/**
|
|
6
6
|
* 通知卡(**自绘**;标题 + 正文 + 图标 / 头像 / 标签 / 操作 / 关闭位)。
|
|
@@ -10,7 +10,7 @@ export type NotificationTone = 'info' | 'success' | 'warning' | 'error' | 'submi
|
|
|
10
10
|
* - `Notice`(`.mh-notice*`)= **条状提示**:一行话 + 可选操作;
|
|
11
11
|
* - 本件(`.mh-notification*`)= **通知卡**:标题行(含关闭位)、可带头像与标签、多行正文。
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* 类名前缀刻意不同:两族都叫 `.notice*` 的话会出现两套 `.mh-notice*` 互撞。
|
|
14
14
|
*
|
|
15
15
|
* ## 组合位(面各归其族,本件只给容器)
|
|
16
16
|
*
|
|
@@ -40,7 +40,7 @@ export interface PageHeaderProps {
|
|
|
40
40
|
title?: string;
|
|
41
41
|
/** 页头副标题:标题**下一行**的次要说明(对象名、统计口径等),随 `title` 一起进内置布局。不传即不渲染(页头条高度不变);`title` 不传时本项不生效。 */
|
|
42
42
|
subTitle?: string;
|
|
43
|
-
/** 标题左侧图标:**svg
|
|
43
|
+
/** 标题左侧图标:**svg 节点或返回节点的函数**皆可;缺省渲染默认页头图标(26×26 圆角方块,`currentColor` 随主题)。 */
|
|
44
44
|
icon?: VNodeChild | (() => VNodeChild);
|
|
45
45
|
/** 页头右侧的自由位(唯一可自定义位):搜索框 / 按钮 / 下拉等,水平排列;传节点或返回节点的函数。布局(垂直居中 / 间距)由标准样式锁死。 */
|
|
46
46
|
extra?: unknown;
|
|
@@ -17,8 +17,8 @@ export type PaginationPageItem = number | 'ellipsis';
|
|
|
17
17
|
*
|
|
18
18
|
* ## 页码窗口怎么算
|
|
19
19
|
*
|
|
20
|
-
* 总页数 ≤ 7 全铺;> 7 取**首末 + 当前页±1
|
|
21
|
-
* (零 JS 表达不了"当前页"
|
|
20
|
+
* 总页数 ≤ 7 全铺;> 7 取**首末 + 当前页±1**、其余折成省略号(既定取向)。这个计算是 JS 该干的事
|
|
21
|
+
* (零 JS 表达不了"当前页",样张也是静态铺的)。
|
|
22
22
|
*
|
|
23
23
|
* ## 与 `QueryState` 的分工
|
|
24
24
|
*
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Popup —— 弹窗的**落位与开合**(内件:`Dialog` / `Drawer` 的共享底座,不进公开出口)。
|
|
3
|
+
*
|
|
4
|
+
* ## 它管什么
|
|
5
|
+
* 插到哪、怎么开、怎么关、怎么遮、谁不能点:
|
|
6
|
+
*
|
|
7
|
+
* - **落位**:`host` 给了目标 ⇒ `<Teleport>` **原样**进去(填哪个就是哪个:`'[data-manohub-ui]'` / `'#app'` /
|
|
8
|
+
* 元素 / 取值函数);没给 / 解析不到(选择器查不到、显式 `null`)⇒ 不 Teleport(模态档);
|
|
9
|
+
* - **开合**:模态档 `showModal()`;宿主态 `show()`(非模态,「不进 top layer」正是收窄的关键;
|
|
10
|
+
* 只 Teleport 不换开合方式等于白做 —— `showModal()` 无论挂在哪儿都进 top layer);
|
|
11
|
+
* - **遮罩**:模态档靠 `::backdrop`,宿主态靠 `.mh-popup-layer__mask`;`mask=false` 只把底色改透明,
|
|
12
|
+
* 节点与点击路径不变(看不见遮罩就没有「点这里能关」的暗示,故同时关掉点空白关闭);
|
|
13
|
+
* - **模态语义**:模态档由浏览器给;宿主态用容器级 `inert` 近似(见 `inert-scope.ts`);
|
|
14
|
+
* - **Esc / 焦点**:`cancel`(模态)与 `keydown`(宿主态)走同一个出口;关闭时把焦点还给打开前的元素。
|
|
15
|
+
*
|
|
16
|
+
* ## 它不管什么
|
|
17
|
+
* 皮肤、尺寸、三段内容结构 —— 那些留在 `Dialog` / `Drawer` 里(差异走 props 与回调,本件不判「我是哪件」)。
|
|
18
|
+
* popover 族(`Dropdown` / `Select` / 气泡)与服务族(`Toast` / `Loading`)不走本件:它们的原生机制、
|
|
19
|
+
* 定位与生命周期都不是一回事,硬并进来只会长出一组开关矩阵。
|
|
20
|
+
*/
|
|
21
|
+
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
22
|
+
import { type PopupHostTarget } from '../../utils/popup-host';
|
|
23
|
+
export declare const Popup: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
24
|
+
/** 受控开合(可见性归消费方,本件只把它同步到原生 API) */
|
|
25
|
+
open: {
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
default: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Teleport 目标:`string`(选择器)/ `Element` / 取值函数,**填哪个就是哪个**(不做二次推断)。
|
|
31
|
+
* 不传 = 读 `configurePopupHost()` 的全局缺省;仍解析不到(选择器查不到 / 显式 `null`)⇒ 模态档。
|
|
32
|
+
*/
|
|
33
|
+
host: {
|
|
34
|
+
type: PropType<PopupHostTarget | null>;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
/** 是否显示遮罩(缺省 true)。`false` 只改底色,不改模态语义 */
|
|
38
|
+
mask: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
default: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** 点遮罩 / 空白是否关闭(`mask=false` 时强制失效) */
|
|
43
|
+
maskClosable: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** Esc 是否关闭 */
|
|
48
|
+
keyboard: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Esc 的自定义处理(在 `keyboard` 判断之前)。返回 `true` = 已消费,本件不再走关闭 —— `Dialog` 用它
|
|
54
|
+
* 实现「全屏时第一次 Esc 只退全屏」。
|
|
55
|
+
*/
|
|
56
|
+
onEscape: {
|
|
57
|
+
type: PropType<() => boolean | void>;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
/** 收场上报:`cancel`(Esc / 关闭位)/ `close`(点遮罩)。本件**不自己关**,只回调 */
|
|
61
|
+
onRequestClose: {
|
|
62
|
+
type: PropType<(kind: "cancel" | "close") => void>;
|
|
63
|
+
default: undefined;
|
|
64
|
+
};
|
|
65
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
66
|
+
/** 受控开合(可见性归消费方,本件只把它同步到原生 API) */
|
|
67
|
+
open: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Teleport 目标:`string`(选择器)/ `Element` / 取值函数,**填哪个就是哪个**(不做二次推断)。
|
|
73
|
+
* 不传 = 读 `configurePopupHost()` 的全局缺省;仍解析不到(选择器查不到 / 显式 `null`)⇒ 模态档。
|
|
74
|
+
*/
|
|
75
|
+
host: {
|
|
76
|
+
type: PropType<PopupHostTarget | null>;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
/** 是否显示遮罩(缺省 true)。`false` 只改底色,不改模态语义 */
|
|
80
|
+
mask: {
|
|
81
|
+
type: BooleanConstructor;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
/** 点遮罩 / 空白是否关闭(`mask=false` 时强制失效) */
|
|
85
|
+
maskClosable: {
|
|
86
|
+
type: BooleanConstructor;
|
|
87
|
+
default: boolean;
|
|
88
|
+
};
|
|
89
|
+
/** Esc 是否关闭 */
|
|
90
|
+
keyboard: {
|
|
91
|
+
type: BooleanConstructor;
|
|
92
|
+
default: boolean;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Esc 的自定义处理(在 `keyboard` 判断之前)。返回 `true` = 已消费,本件不再走关闭 —— `Dialog` 用它
|
|
96
|
+
* 实现「全屏时第一次 Esc 只退全屏」。
|
|
97
|
+
*/
|
|
98
|
+
onEscape: {
|
|
99
|
+
type: PropType<() => boolean | void>;
|
|
100
|
+
default: undefined;
|
|
101
|
+
};
|
|
102
|
+
/** 收场上报:`cancel`(Esc / 关闭位)/ `close`(点遮罩)。本件**不自己关**,只回调 */
|
|
103
|
+
onRequestClose: {
|
|
104
|
+
type: PropType<(kind: "cancel" | "close") => void>;
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
}>> & Readonly<{}>, {
|
|
108
|
+
open: boolean;
|
|
109
|
+
mask: boolean;
|
|
110
|
+
host: PopupHostTarget | null;
|
|
111
|
+
maskClosable: boolean;
|
|
112
|
+
keyboard: boolean;
|
|
113
|
+
onEscape: () => boolean | void;
|
|
114
|
+
onRequestClose: (kind: "cancel" | "close") => void;
|
|
115
|
+
}, SlotsType<{
|
|
116
|
+
default?: () => VNodeChild;
|
|
117
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|