@manohub/ui 1.1.5 → 1.2.0
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/dist/components/button/index.d.ts +12 -12
- package/dist/components/capsule/index.d.ts +1 -1
- package/dist/components/code-block/index.d.ts +5 -5
- package/dist/components/date-picker/date-panel.d.ts +1 -1
- package/dist/components/date-picker/index.d.ts +6 -6
- package/dist/components/dialog/index.d.ts +2 -12
- package/dist/components/dialog/index.js +8 -7
- package/dist/components/drawer/index.js +7 -1
- package/dist/components/filter/index.d.ts +2 -2
- package/dist/components/form/index.d.ts +4 -4
- package/dist/components/input/index.d.ts +10 -10
- package/dist/components/input/number-input.d.ts +2 -2
- package/dist/components/list/list.d.ts +1 -1
- package/dist/components/list/tree.d.ts +1 -1
- package/dist/components/list-view/index.d.ts +2 -2
- package/dist/components/notice/index.d.ts +2 -2
- package/dist/components/notification/index.d.ts +1 -1
- package/dist/components/page/index.d.ts +2 -4
- package/dist/components/page/index.js +9 -2
- package/dist/components/panel/index.d.ts +2 -2
- package/dist/components/panel/index.js +10 -3
- package/dist/components/query-state/index.d.ts +1 -3
- package/dist/components/radio/index.d.ts +7 -7
- package/dist/components/scrollbar/index.d.ts +50 -0
- package/dist/components/scrollbar/index.js +187 -0
- package/dist/components/select/select-list.d.ts +1 -3
- package/dist/components/tabbar/index.d.ts +1 -1
- package/dist/components/table/index.js +10 -3
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/toast/index.d.ts +4 -4
- package/dist/styles/components/dialog.css +21 -6
- package/dist/styles/components/drawer.css +18 -5
- package/dist/styles/components/page.css +20 -3
- package/dist/styles/components/panel.css +17 -0
- package/dist/styles/components/scrollbar.css +63 -0
- package/dist/styles/components/table.css +33 -4
- package/dist/styles/index.css +1 -0
- package/package.json +2 -2
|
@@ -84,7 +84,7 @@ export declare const PanelHeader: import("vue").DefineComponent<import("vue").Ex
|
|
|
84
84
|
type: PropType<PanelPadding>;
|
|
85
85
|
default: undefined;
|
|
86
86
|
};
|
|
87
|
-
}>, () =>
|
|
87
|
+
}>, () => string | number | boolean | void | import("vue").VNodeArrayChildren | import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
88
88
|
/** 面板标题;缺省时**不渲染标题节点**,但仍会渲染 `extra` 那一行(无标题的区域头,见组件头注释);要给完全自定义的头走 `header` 插槽。 */
|
|
89
89
|
title: {
|
|
90
90
|
type: StringConstructor;
|
|
@@ -255,7 +255,7 @@ export declare const Panel: {
|
|
|
255
255
|
type: PropType<PanelPadding>;
|
|
256
256
|
default: undefined;
|
|
257
257
|
};
|
|
258
|
-
}>, () =>
|
|
258
|
+
}>, () => string | number | boolean | void | import("vue").VNodeArrayChildren | import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
259
259
|
/** 面板标题;缺省时**不渲染标题节点**,但仍会渲染 `extra` 那一行(无标题的区域头,见组件头注释);要给完全自定义的头走 `header` 插槽。 */
|
|
260
260
|
title: {
|
|
261
261
|
type: StringConstructor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, h, createVNode } from "vue";
|
|
1
|
+
import { defineComponent, h, createVNode, ref } from "vue";
|
|
2
2
|
import { mergePartStyle, partPaddingStyle } from "../part-padding.js";
|
|
3
|
+
import { useOverlayScrollbar } from "../scrollbar/index.js";
|
|
3
4
|
const PanelHeader = /* @__PURE__ */ defineComponent({
|
|
4
5
|
name: "PanelHeader",
|
|
5
6
|
inheritAttrs: false,
|
|
@@ -66,10 +67,16 @@ const PanelBody = /* @__PURE__ */ defineComponent({
|
|
|
66
67
|
slots,
|
|
67
68
|
attrs
|
|
68
69
|
}) {
|
|
70
|
+
const scrollRef = ref(null);
|
|
71
|
+
const scrollbar = useOverlayScrollbar(scrollRef);
|
|
69
72
|
return () => createVNode("div", {
|
|
70
73
|
"class": ["mh-panel__body", attrs.class].filter(Boolean).join(" "),
|
|
71
|
-
"style":
|
|
72
|
-
}, [
|
|
74
|
+
"style": attrs.style
|
|
75
|
+
}, [createVNode("div", {
|
|
76
|
+
"class": "mh-panel__scroll",
|
|
77
|
+
"ref": scrollRef,
|
|
78
|
+
"style": partPaddingStyle(props.padding)
|
|
79
|
+
}, [slots.default?.()]), scrollbar.render()]);
|
|
73
80
|
}
|
|
74
81
|
});
|
|
75
82
|
const PanelFooter = /* @__PURE__ */ defineComponent({
|
|
@@ -109,9 +109,7 @@ export declare const QueryState: import("vue").DefineComponent<import("vue").Ext
|
|
|
109
109
|
type: NumberConstructor;
|
|
110
110
|
default: number;
|
|
111
111
|
};
|
|
112
|
-
}>, () => string | number | boolean | import("vue").
|
|
113
|
-
[key: string]: any;
|
|
114
|
-
}> | import("vue").VNodeArrayChildren | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
112
|
+
}>, () => string | number | boolean | import("vue").VNodeArrayChildren | import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
115
113
|
loading: {
|
|
116
114
|
type: BooleanConstructor;
|
|
117
115
|
default: boolean;
|
|
@@ -128,9 +128,9 @@ export declare const Radio: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
128
128
|
}>> & Readonly<{}>, {
|
|
129
129
|
size: ControlSize;
|
|
130
130
|
disabled: boolean;
|
|
131
|
-
name: string;
|
|
132
131
|
label: string;
|
|
133
132
|
onChange: (value: string | number) => void;
|
|
133
|
+
name: string;
|
|
134
134
|
checked: boolean | undefined;
|
|
135
135
|
autofocus: boolean;
|
|
136
136
|
}, SlotsType<{
|
|
@@ -223,9 +223,9 @@ export declare const RadioCard: import("vue").DefineComponent<import("vue").Extr
|
|
|
223
223
|
};
|
|
224
224
|
}>> & Readonly<{}>, {
|
|
225
225
|
disabled: boolean;
|
|
226
|
-
name: string;
|
|
227
226
|
label: string;
|
|
228
227
|
onChange: (value: string | number) => void;
|
|
228
|
+
name: string;
|
|
229
229
|
checked: boolean | undefined;
|
|
230
230
|
description: string;
|
|
231
231
|
}, SlotsType<{
|
|
@@ -303,9 +303,9 @@ export declare const RadioCompound: {
|
|
|
303
303
|
}>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
304
304
|
size: ControlSize;
|
|
305
305
|
disabled: boolean;
|
|
306
|
-
name: string;
|
|
307
306
|
label: string;
|
|
308
307
|
onChange: (value: string | number) => void;
|
|
308
|
+
name: string;
|
|
309
309
|
checked: boolean | undefined;
|
|
310
310
|
autofocus: boolean;
|
|
311
311
|
}, true, {}, SlotsType<{
|
|
@@ -354,9 +354,9 @@ export declare const RadioCompound: {
|
|
|
354
354
|
}>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
|
|
355
355
|
size: ControlSize;
|
|
356
356
|
disabled: boolean;
|
|
357
|
-
name: string;
|
|
358
357
|
label: string;
|
|
359
358
|
onChange: (value: string | number) => void;
|
|
359
|
+
name: string;
|
|
360
360
|
checked: boolean | undefined;
|
|
361
361
|
autofocus: boolean;
|
|
362
362
|
}>;
|
|
@@ -400,9 +400,9 @@ export declare const RadioCompound: {
|
|
|
400
400
|
}>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
401
401
|
size: ControlSize;
|
|
402
402
|
disabled: boolean;
|
|
403
|
-
name: string;
|
|
404
403
|
label: string;
|
|
405
404
|
onChange: (value: string | number) => void;
|
|
405
|
+
name: string;
|
|
406
406
|
checked: boolean | undefined;
|
|
407
407
|
autofocus: boolean;
|
|
408
408
|
}, {}, string, SlotsType<{
|
|
@@ -468,9 +468,9 @@ export declare const RadioCompound: {
|
|
|
468
468
|
};
|
|
469
469
|
}>> & Readonly<{}>, {
|
|
470
470
|
disabled: boolean;
|
|
471
|
-
name: string;
|
|
472
471
|
label: string;
|
|
473
472
|
onChange: (value: string | number) => void;
|
|
473
|
+
name: string;
|
|
474
474
|
checked: boolean | undefined;
|
|
475
475
|
description: string;
|
|
476
476
|
}, SlotsType<{
|
|
@@ -568,8 +568,8 @@ export declare const RadioCompound: {
|
|
|
568
568
|
size: ControlSize;
|
|
569
569
|
vertical: boolean;
|
|
570
570
|
disabled: boolean;
|
|
571
|
-
name: string;
|
|
572
571
|
onChange: (value: string | number) => void;
|
|
572
|
+
name: string;
|
|
573
573
|
options: RadioGroupOption[];
|
|
574
574
|
defaultValue: string | number | undefined;
|
|
575
575
|
columns: number;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scrollbar —— **浮层滚动条(跨件原语)**。
|
|
3
|
+
*
|
|
4
|
+
* 它不是一个可见的组件,而是一条「谁在滚,就把拇指画给它」的实现:原生滚动条两轴归零
|
|
5
|
+
* (消费方的滚动盒自己写 `scrollbar-width: none` + `::-webkit-scrollbar { width/height: 0 }`),
|
|
6
|
+
* 拇指由本件画在**滚动盒的兄弟节点**上(定位父里),于是滚动条既不占宽度、也不会随内容滚走。
|
|
7
|
+
*
|
|
8
|
+
* 为什么值得单独成件(出处:Table 满高档 2026-10-19):`scrollbar-gutter: stable` 给它服务的任何滚动容器
|
|
9
|
+
* **永久**预留一条槽,而槽里没人上色 ⇒ 表头底 / 行线 / 斑马底全在槽左缘截断,露一条贯穿到底的白缝;
|
|
10
|
+
* 换成「不预留」又会让滚动条一出没就整块缩 6px。把原生条归零是唯一同时解决两者的做法,
|
|
11
|
+
* 代价就是「拇指得自己画」—— 那条代价只该付一次。
|
|
12
|
+
*
|
|
13
|
+
* 结构(消费方要照抄的三件事):
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* <div class="定位父(position: relative)">
|
|
17
|
+
* <div class="滚动盒(overflow: auto + 原生条归零)">…内容…</div>
|
|
18
|
+
* <div class="mh-scrollbar">…两根拇指…</div> <!-- 本件 render() 的输出 -->
|
|
19
|
+
* </div>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* 判定与取舍(全部有出处,改之前先读):
|
|
23
|
+
* 1. **拇指 6px、离框 2px、最短 24px** —— 6px 与 `kit/index.css` 的滚动条皮肤同值(那里同样登记了
|
|
24
|
+
* 「等设计给值再开槽位」),故**不新开 `--ui-scrollbar-*` 令牌**;2px 与 24px 属「没人会去改的值」。
|
|
25
|
+
* 2. **一轴不可滚就 `hidden`** —— 否则会挂一根贴满全长的假拇指;两轴同一条判据(`scrollHeight/clientHeight`
|
|
26
|
+
* 与 `scrollWidth/clientWidth` 对称)。
|
|
27
|
+
* 3. **轨道不吃指针** —— 只有拇指响应指针(`pointer-events` 在面上分层),**轨道点击翻页明确不做**:
|
|
28
|
+
* 那一 6px 带点击直接落到内容上。翻页走滚轮 / 触控板 / 键盘 / 拖拇指。
|
|
29
|
+
* 4. **显隐走命令式类**(`is-visible` / `is-dragging`),不走响应式:滚动一次不该重渲染整棵子树。
|
|
30
|
+
* 它能活过重渲染的前提是「这两个类在 vnode 里是静态串、patch 不写 `className`」—— 谁把
|
|
31
|
+
* `.mh-scrollbar` 的类改成动态拼接,这两个状态就必须改回 `ref`。
|
|
32
|
+
* 5. **拖动映射与原生拇指同口径**:`scrollTop += dy × 可滚距离 / 拇指可走距离`;监听挂 `window`
|
|
33
|
+
* (同 `Page` 的分栏手柄),拖出容器也不丢。
|
|
34
|
+
* 6. **不做 RTL**:`right` / `left` 写死,RTL 语言下需要另开一档(当前无需求)。
|
|
35
|
+
*
|
|
36
|
+
* 消费方(现:`Table` 满高档、`Panel.Body`):`useOverlayScrollbar(滚动盒 ref)` + `{overlay.render()}`。
|
|
37
|
+
* 滚动监听、`ResizeObserver`、卸载清理都在本件里,消费方不必再写一遍。
|
|
38
|
+
*/
|
|
39
|
+
import { type Ref, type VNode } from 'vue';
|
|
40
|
+
export interface OverlayScrollbar {
|
|
41
|
+
/** 渲染浮层(两根拇指)。挂在滚动盒**后面**、定位父里面 */
|
|
42
|
+
render: () => VNode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 给一个滚动盒配一套浮层滚动条。
|
|
46
|
+
*
|
|
47
|
+
* @param scrollBox 滚动盒(`overflow: auto` 的那个元素)的 ref。为 `null` 时不挂任何监听 ——
|
|
48
|
+
* `fill` 这类「结构后出现」的滚动盒会在它出现后自动接上(`watch` + `flush: 'post'`)。
|
|
49
|
+
*/
|
|
50
|
+
export declare function useOverlayScrollbar(scrollBox: Ref<HTMLElement | null>): OverlayScrollbar;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { ref, onMounted, watch, onUpdated, onBeforeUnmount, createVNode } from "vue";
|
|
2
|
+
const SCROLLBAR_MIN = 24;
|
|
3
|
+
const SCROLLBAR_FADE = 800;
|
|
4
|
+
function useOverlayScrollbar(scrollBox) {
|
|
5
|
+
const ovbarRef = ref(null);
|
|
6
|
+
const vThumbRef = ref(null);
|
|
7
|
+
const hThumbRef = ref(null);
|
|
8
|
+
let fadeTimer;
|
|
9
|
+
let hovering = false;
|
|
10
|
+
let draggingAxis = null;
|
|
11
|
+
let dragStart = {
|
|
12
|
+
pointer: 0,
|
|
13
|
+
scroll: 0,
|
|
14
|
+
span: 0,
|
|
15
|
+
maxScroll: 0
|
|
16
|
+
};
|
|
17
|
+
const sync = () => {
|
|
18
|
+
const box = scrollBox.value;
|
|
19
|
+
const track = ovbarRef.value;
|
|
20
|
+
if (!box || !track) return;
|
|
21
|
+
const axes = [[vThumbRef.value, "y"], [hThumbRef.value, "x"]];
|
|
22
|
+
for (const [thumb, axis] of axes) {
|
|
23
|
+
if (!thumb) continue;
|
|
24
|
+
const vertical = axis === "y";
|
|
25
|
+
const trackSize = vertical ? track.clientHeight : track.clientWidth;
|
|
26
|
+
const viewSize = vertical ? box.clientHeight : box.clientWidth;
|
|
27
|
+
const contentSize = vertical ? box.scrollHeight : box.scrollWidth;
|
|
28
|
+
const maxScroll = contentSize - viewSize;
|
|
29
|
+
const scrollable = maxScroll > 1 && trackSize > 0;
|
|
30
|
+
thumb.hidden = !scrollable;
|
|
31
|
+
if (!scrollable) continue;
|
|
32
|
+
const length = Math.min(trackSize, Math.max(SCROLLBAR_MIN, Math.round(trackSize * viewSize / contentSize)));
|
|
33
|
+
const shift = (vertical ? box.scrollTop : box.scrollLeft) / maxScroll * (trackSize - length);
|
|
34
|
+
if (vertical) {
|
|
35
|
+
thumb.style.height = `${length}px`;
|
|
36
|
+
thumb.style.transform = `translateY(${shift}px)`;
|
|
37
|
+
} else {
|
|
38
|
+
thumb.style.width = `${length}px`;
|
|
39
|
+
thumb.style.transform = `translateX(${shift}px)`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const show = () => {
|
|
44
|
+
if (fadeTimer) {
|
|
45
|
+
clearTimeout(fadeTimer);
|
|
46
|
+
fadeTimer = void 0;
|
|
47
|
+
}
|
|
48
|
+
ovbarRef.value?.classList.add("is-visible");
|
|
49
|
+
};
|
|
50
|
+
const hideLater = () => {
|
|
51
|
+
if (draggingAxis || hovering) return;
|
|
52
|
+
if (fadeTimer) clearTimeout(fadeTimer);
|
|
53
|
+
fadeTimer = setTimeout(() => {
|
|
54
|
+
fadeTimer = void 0;
|
|
55
|
+
ovbarRef.value?.classList.remove("is-visible");
|
|
56
|
+
}, SCROLLBAR_FADE);
|
|
57
|
+
};
|
|
58
|
+
const onEnter = () => {
|
|
59
|
+
hovering = true;
|
|
60
|
+
sync();
|
|
61
|
+
show();
|
|
62
|
+
};
|
|
63
|
+
const onLeave = () => {
|
|
64
|
+
hovering = false;
|
|
65
|
+
hideLater();
|
|
66
|
+
};
|
|
67
|
+
const onScroll = () => {
|
|
68
|
+
sync();
|
|
69
|
+
show();
|
|
70
|
+
hideLater();
|
|
71
|
+
};
|
|
72
|
+
const stopThumbDrag = () => {
|
|
73
|
+
draggingAxis = null;
|
|
74
|
+
ovbarRef.value?.classList.remove("is-dragging");
|
|
75
|
+
window.removeEventListener("pointermove", onThumbMove);
|
|
76
|
+
window.removeEventListener("pointerup", stopThumbDrag);
|
|
77
|
+
window.removeEventListener("pointercancel", stopThumbDrag);
|
|
78
|
+
hideLater();
|
|
79
|
+
};
|
|
80
|
+
const onThumbMove = (event) => {
|
|
81
|
+
const box = scrollBox.value;
|
|
82
|
+
if (!draggingAxis || !box) return;
|
|
83
|
+
const {
|
|
84
|
+
pointer,
|
|
85
|
+
scroll,
|
|
86
|
+
span,
|
|
87
|
+
maxScroll
|
|
88
|
+
} = dragStart;
|
|
89
|
+
if (span <= 0) return;
|
|
90
|
+
const delta = (draggingAxis === "y" ? event.clientY : event.clientX) - pointer;
|
|
91
|
+
const next = scroll + delta * maxScroll / span;
|
|
92
|
+
if (draggingAxis === "y") box.scrollTop = next;
|
|
93
|
+
else box.scrollLeft = next;
|
|
94
|
+
};
|
|
95
|
+
const startThumbDrag = (axis, event) => {
|
|
96
|
+
const box = scrollBox.value;
|
|
97
|
+
const track = ovbarRef.value;
|
|
98
|
+
const thumb = axis === "y" ? vThumbRef.value : hThumbRef.value;
|
|
99
|
+
if (!box || !track || !thumb || event.button !== 0) return;
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
draggingAxis = axis;
|
|
102
|
+
show();
|
|
103
|
+
track.classList.add("is-dragging");
|
|
104
|
+
const vertical = axis === "y";
|
|
105
|
+
const trackSize = vertical ? track.clientHeight : track.clientWidth;
|
|
106
|
+
const thumbSize = vertical ? thumb.offsetHeight : thumb.offsetWidth;
|
|
107
|
+
dragStart = {
|
|
108
|
+
pointer: vertical ? event.clientY : event.clientX,
|
|
109
|
+
scroll: vertical ? box.scrollTop : box.scrollLeft,
|
|
110
|
+
span: trackSize - thumbSize,
|
|
111
|
+
maxScroll: vertical ? box.scrollHeight - box.clientHeight : box.scrollWidth - box.clientWidth
|
|
112
|
+
};
|
|
113
|
+
window.addEventListener("pointermove", onThumbMove);
|
|
114
|
+
window.addEventListener("pointerup", stopThumbDrag);
|
|
115
|
+
window.addEventListener("pointercancel", stopThumbDrag);
|
|
116
|
+
};
|
|
117
|
+
let teardown = null;
|
|
118
|
+
let resizeObserver;
|
|
119
|
+
const observeContent = () => {
|
|
120
|
+
const box = scrollBox.value;
|
|
121
|
+
if (!resizeObserver || !box) return;
|
|
122
|
+
for (const child of Array.from(box.children)) resizeObserver.observe(child);
|
|
123
|
+
};
|
|
124
|
+
const attach = () => {
|
|
125
|
+
teardown?.();
|
|
126
|
+
teardown = null;
|
|
127
|
+
resizeObserver?.disconnect();
|
|
128
|
+
resizeObserver = void 0;
|
|
129
|
+
const box = scrollBox.value;
|
|
130
|
+
const hoverArea = ovbarRef.value?.parentElement ?? null;
|
|
131
|
+
if (box) box.addEventListener("scroll", onScroll, {
|
|
132
|
+
passive: true
|
|
133
|
+
});
|
|
134
|
+
hoverArea?.addEventListener("pointerenter", onEnter);
|
|
135
|
+
hoverArea?.addEventListener("pointerleave", onLeave);
|
|
136
|
+
if (box && typeof ResizeObserver !== "undefined") {
|
|
137
|
+
resizeObserver = new ResizeObserver(sync);
|
|
138
|
+
resizeObserver.observe(box);
|
|
139
|
+
}
|
|
140
|
+
observeContent();
|
|
141
|
+
sync();
|
|
142
|
+
if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(sync);
|
|
143
|
+
teardown = () => {
|
|
144
|
+
box?.removeEventListener("scroll", onScroll);
|
|
145
|
+
hoverArea?.removeEventListener("pointerenter", onEnter);
|
|
146
|
+
hoverArea?.removeEventListener("pointerleave", onLeave);
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
onMounted(attach);
|
|
150
|
+
watch(scrollBox, attach, {
|
|
151
|
+
flush: "post"
|
|
152
|
+
});
|
|
153
|
+
onUpdated(() => {
|
|
154
|
+
sync();
|
|
155
|
+
observeContent();
|
|
156
|
+
});
|
|
157
|
+
onBeforeUnmount(() => {
|
|
158
|
+
teardown?.();
|
|
159
|
+
teardown = null;
|
|
160
|
+
resizeObserver?.disconnect();
|
|
161
|
+
resizeObserver = void 0;
|
|
162
|
+
stopThumbDrag();
|
|
163
|
+
if (fadeTimer) clearTimeout(fadeTimer);
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
/**
|
|
167
|
+
* 浮层的结构:`aria-hidden` —— 它纯视觉,滚动语义仍在真滚动盒上(滚轮 / 键盘 / 触控板照旧)。
|
|
168
|
+
* `pointerdown` 只挂在拇指上:轨道不收指针,也不做点击翻页。
|
|
169
|
+
*/
|
|
170
|
+
render: () => createVNode("div", {
|
|
171
|
+
"class": "mh-scrollbar",
|
|
172
|
+
"ref": ovbarRef,
|
|
173
|
+
"aria-hidden": "true"
|
|
174
|
+
}, [createVNode("div", {
|
|
175
|
+
"class": "mh-scrollbar__thumb mh-scrollbar__thumb--y",
|
|
176
|
+
"ref": vThumbRef,
|
|
177
|
+
"onPointerdown": (event) => startThumbDrag("y", event)
|
|
178
|
+
}, null), createVNode("div", {
|
|
179
|
+
"class": "mh-scrollbar__thumb mh-scrollbar__thumb--x",
|
|
180
|
+
"ref": hThumbRef,
|
|
181
|
+
"onPointerdown": (event) => startThumbDrag("x", event)
|
|
182
|
+
}, null)])
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export {
|
|
186
|
+
useOverlayScrollbar
|
|
187
|
+
};
|
|
@@ -84,9 +84,7 @@ export declare const SelectList: import("vue").DefineComponent<import("vue").Ext
|
|
|
84
84
|
type: PropType<() => VNodeChild>;
|
|
85
85
|
default: undefined;
|
|
86
86
|
};
|
|
87
|
-
}>, () => string | number | boolean | import("vue").
|
|
88
|
-
[key: string]: any;
|
|
89
|
-
}> | import("vue").VNodeArrayChildren, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
87
|
+
}>, () => string | number | boolean | import("vue").VNodeArrayChildren | import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
90
88
|
/** 已经过滤过的渲染树(分组内全空则由消费方整组去掉) */
|
|
91
89
|
options: {
|
|
92
90
|
type: PropType<SelectItem[]>;
|
|
@@ -162,9 +162,9 @@ export declare const TabBar: import("vue").DefineComponent<import("vue").Extract
|
|
|
162
162
|
"onUpdate:value"?: ((value: TabBarValue) => any) | undefined;
|
|
163
163
|
}>, {
|
|
164
164
|
size: ControlSize;
|
|
165
|
+
onChange: (value: TabBarValue) => void;
|
|
165
166
|
value: TabBarValue | undefined;
|
|
166
167
|
type: TabBarType;
|
|
167
|
-
onChange: (value: TabBarValue) => void;
|
|
168
168
|
onClose: (value: TabBarValue) => void;
|
|
169
169
|
defaultValue: TabBarValue | undefined;
|
|
170
170
|
centered: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, onMounted, onUpdated, createVNode } from "vue";
|
|
2
2
|
import { Icon } from "@manohub/icon";
|
|
3
3
|
import { Checkbox } from "../checkbox/index.js";
|
|
4
|
+
import { useOverlayScrollbar } from "../scrollbar/index.js";
|
|
4
5
|
const Table = /* @__PURE__ */ defineComponent({
|
|
5
6
|
name: "Table",
|
|
6
7
|
inheritAttrs: false,
|
|
@@ -344,6 +345,7 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
344
345
|
};
|
|
345
346
|
onMounted(syncHead);
|
|
346
347
|
onUpdated(syncHead);
|
|
348
|
+
const scrollbar = useOverlayScrollbar(scrollBoxRef);
|
|
347
349
|
return () => {
|
|
348
350
|
const fill = props.fill !== false;
|
|
349
351
|
const tableClass = ["mh-table", resolvedSize.value === "sm" ? "mh-table--sm" : "", resolvedSize.value === "lg" ? "mh-table--lg" : "", props.bordered ? "" : "mh-table--borderless", fill ? "mh-table--fill" : "", fill || props.layout === "fixed" ? "mh-table--fixed" : "", attrs.class].filter(Boolean).join(" ");
|
|
@@ -369,10 +371,15 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
369
371
|
return createVNode("div", {
|
|
370
372
|
"class": "mh-table-wrapper",
|
|
371
373
|
"style": attrs.style
|
|
372
|
-
}, [batchBar, createVNode("
|
|
374
|
+
}, [batchBar, createVNode("div", {
|
|
375
|
+
"class": "mh-table__body mh-table__body--auto"
|
|
376
|
+
}, [createVNode("div", {
|
|
377
|
+
"class": "mh-table-scroll mh-table-scroll--auto",
|
|
378
|
+
"ref": scrollBoxRef
|
|
379
|
+
}, [createVNode("table", {
|
|
373
380
|
"class": bodyTableClass,
|
|
374
381
|
"style": cellTokens
|
|
375
|
-
}, [colElements(), props.showHeader ? renderHead() : null, renderBody()]), summaryBar, loadingOverlay]);
|
|
382
|
+
}, [colElements(), props.showHeader ? renderHead() : null, renderBody()])]), scrollbar.render()]), summaryBar, loadingOverlay]);
|
|
376
383
|
}
|
|
377
384
|
const wrapperStyle = props.fill === true || props.fill === "parent" ? [{
|
|
378
385
|
height: "100%"
|
|
@@ -400,7 +407,7 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
400
407
|
}, [createVNode("table", {
|
|
401
408
|
"class": bodyTableClass,
|
|
402
409
|
"style": cellTokens
|
|
403
|
-
}, [colElements(), renderBody()])]), loadingOverlay]), summaryBar]);
|
|
410
|
+
}, [colElements(), renderBody()])]), scrollbar.render(), loadingOverlay]), summaryBar]);
|
|
404
411
|
};
|
|
405
412
|
}
|
|
406
413
|
});
|
|
@@ -70,9 +70,9 @@ export declare const TabPanel: import("vue").DefineComponent<import("vue").Extra
|
|
|
70
70
|
type: BooleanConstructor;
|
|
71
71
|
default: boolean;
|
|
72
72
|
};
|
|
73
|
-
}>, () => string | number | boolean | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
73
|
+
}>, () => string | number | boolean | import("vue").VNodeArrayChildren | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
74
74
|
[key: string]: any;
|
|
75
|
-
}> |
|
|
75
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
76
76
|
name: {
|
|
77
77
|
type: StringConstructor;
|
|
78
78
|
required: true;
|
|
@@ -186,8 +186,8 @@ export declare const Tabs: import("vue").DefineComponent<import("vue").ExtractPr
|
|
|
186
186
|
"onUpdate:value"?: ((value: string | number) => any) | undefined;
|
|
187
187
|
}>, {
|
|
188
188
|
size: ControlSize;
|
|
189
|
-
value: string | number | undefined;
|
|
190
189
|
onChange: (value: string | number) => void;
|
|
190
|
+
value: string | number | undefined;
|
|
191
191
|
options: TabsOption[];
|
|
192
192
|
defaultValue: string | number | undefined;
|
|
193
193
|
lazy: boolean;
|
|
@@ -90,7 +90,7 @@ export declare const Toast: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
90
90
|
onClose?: (() => any) | undefined;
|
|
91
91
|
}>, {
|
|
92
92
|
text: string;
|
|
93
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "
|
|
93
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
94
94
|
closable: boolean;
|
|
95
95
|
tone: ToastTone;
|
|
96
96
|
action: string;
|
|
@@ -142,7 +142,7 @@ export declare const ToastCompound: {
|
|
|
142
142
|
close: () => true;
|
|
143
143
|
}, import("vue").PublicProps, {
|
|
144
144
|
text: string;
|
|
145
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "
|
|
145
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
146
146
|
closable: boolean;
|
|
147
147
|
tone: ToastTone;
|
|
148
148
|
action: string;
|
|
@@ -196,7 +196,7 @@ export declare const ToastCompound: {
|
|
|
196
196
|
onClose?: (() => any) | undefined;
|
|
197
197
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
|
|
198
198
|
text: string;
|
|
199
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "
|
|
199
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
200
200
|
closable: boolean;
|
|
201
201
|
tone: ToastTone;
|
|
202
202
|
action: string;
|
|
@@ -247,7 +247,7 @@ export declare const ToastCompound: {
|
|
|
247
247
|
close: () => true;
|
|
248
248
|
}, string, {
|
|
249
249
|
text: string;
|
|
250
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "
|
|
250
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
251
251
|
closable: boolean;
|
|
252
252
|
tone: ToastTone;
|
|
253
253
|
action: string;
|
|
@@ -124,24 +124,39 @@
|
|
|
124
124
|
outline-offset: 2px;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
/*
|
|
127
|
+
/* 内容区(上下归面板;三段之间无分割线,交界间距只由面板的 `gap` 拥有)
|
|
128
128
|
`flex: 1 1 auto` + `min-height: 0`:吃掉页头与底栏之外的全部高度(含 `panelHeight` /
|
|
129
129
|
消费方经 style 给的高度),超出即**本段**滚动 —— 页头与底栏因此永远可见。
|
|
130
|
-
|
|
130
|
+
|
|
131
|
+
⚠️ 2026-10-19 起本段是**定位父**(浮层滚动条的宿主),自己不滚:滚动落在里面的 `.mh-dialog__scroll`。
|
|
132
|
+
浮层是 `position: absolute` 的兄弟节点,挂在滚动盒自己身上会跟着内容滚走(Table / Panel 同款两层结构)。
|
|
133
|
+
左右内距跟着**滚动盒**走 —— 它属于滚动容器的可视范围(原生滚动条也吃自己容器的内距),
|
|
134
|
+
落在 Body 上会让浮层拇指与内容边对不齐;搬到面板上则会把滚动条顶到面板内 24 处(2026-10-10 实测)。 */
|
|
131
135
|
.mh-dialog__body {
|
|
136
|
+
position: relative;
|
|
132
137
|
flex: 1 1 auto;
|
|
133
138
|
min-height: 0;
|
|
134
|
-
overflow
|
|
135
|
-
padding-inline: var(--ui-dialog-padding-x);
|
|
139
|
+
overflow: hidden;
|
|
136
140
|
font-size: var(--ui-font-body);
|
|
137
141
|
line-height: var(--ui-line-body);
|
|
138
142
|
color: var(--ui-base-content);
|
|
139
143
|
}
|
|
144
|
+
/* 正文的唯一滚动盒:原生条两轴归零(白缝成因见 `scrollbar.css` 头),拇指由浮层画 */
|
|
145
|
+
.mh-dialog__scroll {
|
|
146
|
+
height: 100%;
|
|
147
|
+
overflow-y: auto;
|
|
148
|
+
padding-inline: var(--ui-dialog-padding-x);
|
|
149
|
+
scrollbar-width: none;
|
|
150
|
+
}
|
|
151
|
+
.mh-dialog__scroll::-webkit-scrollbar {
|
|
152
|
+
width: 0;
|
|
153
|
+
height: 0;
|
|
154
|
+
}
|
|
140
155
|
/* 首尾孩子不吃外边距:正文里的 <p> 自带 UA margin,会与内容内距叠成一块大空档 */
|
|
141
|
-
.mh-dialog__body > :first-child {
|
|
156
|
+
.mh-dialog__body > .mh-dialog__scroll > :first-child {
|
|
142
157
|
margin-top: 0;
|
|
143
158
|
}
|
|
144
|
-
.mh-dialog__body > :last-child {
|
|
159
|
+
.mh-dialog__body > .mh-dialog__scroll > :last-child {
|
|
145
160
|
margin-bottom: 0;
|
|
146
161
|
}
|
|
147
162
|
|
|
@@ -111,21 +111,34 @@
|
|
|
111
111
|
outline-offset: 2px;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
/*
|
|
114
|
+
/* 内容区:**三段里唯一可滚的那段**(页头与底栏固定,抽屉才像抽屉)。
|
|
115
|
+
⚠️ 2026-10-19 起本段是**定位父**(浮层滚动条的宿主),自己不滚:滚动落在 `.mh-drawer__scroll`。
|
|
116
|
+
内距跟着滚动盒走(它属于滚动容器的可视范围,浮动拇指的位置与长度才对得上;口径同 Dialog / Panel)。 */
|
|
115
117
|
.mh-drawer__body {
|
|
118
|
+
position: relative;
|
|
116
119
|
flex: 1 1 auto;
|
|
117
120
|
min-height: 0;
|
|
118
|
-
overflow
|
|
119
|
-
padding: var(--ui-drawer-padding-x);
|
|
121
|
+
overflow: hidden;
|
|
120
122
|
font-size: var(--ui-font-body);
|
|
121
123
|
line-height: var(--ui-line-body);
|
|
122
124
|
color: var(--ui-base-content);
|
|
123
125
|
}
|
|
126
|
+
/* 正文的唯一滚动盒:原生条两轴归零(白缝成因见 `scrollbar.css` 头),拇指由浮层画 */
|
|
127
|
+
.mh-drawer__scroll {
|
|
128
|
+
height: 100%;
|
|
129
|
+
overflow-y: auto;
|
|
130
|
+
padding: var(--ui-drawer-padding-x);
|
|
131
|
+
scrollbar-width: none;
|
|
132
|
+
}
|
|
133
|
+
.mh-drawer__scroll::-webkit-scrollbar {
|
|
134
|
+
width: 0;
|
|
135
|
+
height: 0;
|
|
136
|
+
}
|
|
124
137
|
/* 首尾孩子不吃外边距:正文里的 <p> 自带 UA margin,会与内容内距叠成一块大空档 */
|
|
125
|
-
.mh-drawer__body > :first-child {
|
|
138
|
+
.mh-drawer__body > .mh-drawer__scroll > :first-child {
|
|
126
139
|
margin-top: 0;
|
|
127
140
|
}
|
|
128
|
-
.mh-drawer__body > :last-child {
|
|
141
|
+
.mh-drawer__body > .mh-drawer__scroll > :last-child {
|
|
129
142
|
margin-bottom: 0;
|
|
130
143
|
}
|
|
131
144
|
|
|
@@ -95,18 +95,35 @@
|
|
|
95
95
|
padding: 14px var(--ui-space-5) 0;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/* 主体区:**定位父**(浮层滚动条的宿主),自己不滚 —— 滚动交给里面的 `.mh-page__scroll`。
|
|
99
|
+
为什么要两层:浮层是 `position: absolute` 的兄弟节点,挂在滚动盒自己身上会跟着内容滚走
|
|
100
|
+
(Table 满高档 / Panel.Body / Dialog / Drawer 同款结构,2026-10-19 收口)。
|
|
101
|
+
⚠️ 代价:`Page.Body > *` 这类直接子选择器不再命中业务内容(中间隔了滚动盒),见 `page.md`。 */
|
|
98
102
|
.mh-page__body {
|
|
103
|
+
position: relative;
|
|
99
104
|
flex: 1;
|
|
100
105
|
min-height: 0;
|
|
101
|
-
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* 主体滚动盒:页面内距 20 落在这一层(与页头左边距对齐,同设计稿);原生条两轴归零
|
|
110
|
+
(白缝成因见 `scrollbar.css` 头),拇指由浮层画。缺省不滚,`--scroll` 档才滚。 */
|
|
111
|
+
.mh-page__scroll {
|
|
112
|
+
height: 100%;
|
|
102
113
|
padding: 0 var(--ui-space-5);
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
scrollbar-width: none;
|
|
116
|
+
}
|
|
117
|
+
.mh-page__scroll::-webkit-scrollbar {
|
|
118
|
+
width: 0;
|
|
119
|
+
height: 0;
|
|
103
120
|
}
|
|
104
121
|
|
|
105
|
-
.mh-page__body--scroll {
|
|
122
|
+
.mh-page__body--scroll > .mh-page__scroll {
|
|
106
123
|
overflow-y: auto;
|
|
107
124
|
}
|
|
108
125
|
|
|
109
|
-
.mh-page__body--plain {
|
|
126
|
+
.mh-page__body--plain > .mh-page__scroll {
|
|
110
127
|
overflow: hidden;
|
|
111
128
|
}
|
|
112
129
|
|