dou-ui 0.1.0-alpha.7 → 0.1.0-alpha.9
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/dock/context.js.map +1 -1
- package/dist/components/dock/dock-group.js.map +1 -1
- package/dist/components/dock/dock-group.vue_vue_type_script_setup_true_lang.js +25 -24
- package/dist/components/dock/dock-group.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dock/dock-node.js.map +1 -1
- package/dist/components/dock/dock-node.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/dock/dock-node.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dock/dock.js.map +1 -1
- package/dist/components/dock/dock.vue_vue_type_script_setup_true_lang.js +145 -18
- package/dist/components/dock/dock.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dock/drop-side.js +37 -0
- package/dist/components/dock/drop-side.js.map +1 -0
- package/dist/components/tabs/tab-drag.js +16 -7
- package/dist/components/tabs/tab-drag.js.map +1 -1
- package/dist/components/tabs/tabs.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/components/tabs/tabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tabs2.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/components/dock/context.d.ts +4 -1
- package/dist/types/components/dock/dock-group.vue.d.ts +6 -0
- package/dist/types/components/dock/dock.d.ts +52 -5
- package/dist/types/components/dock/dock.vue.d.ts +12 -4
- package/dist/types/components/dock/drop-side.d.ts +24 -0
- package/dist/types/components/dock/index.d.ts +20 -9
- package/dist/types/components/tabs/tab-drag.d.ts +8 -0
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
2
|
import type { SplitterLimit } from '../splitter/splitter';
|
|
3
3
|
import type { TabsSize, TabsValue } from '../tabs/tabs';
|
|
4
|
-
import type { DockNode, DockSide } from './layout';
|
|
4
|
+
import type { DockGroup, DockNode, DockSide } from './layout';
|
|
5
5
|
export type { DockGroup, DockNode, DockSide, DockSplit } from './layout';
|
|
6
6
|
/** What a tab shows; the layout only holds its value. */
|
|
7
7
|
export interface DockPanel {
|
|
@@ -14,6 +14,11 @@ export interface DockPanel {
|
|
|
14
14
|
/** Whether the tab can be dragged; `false` keeps it in its place. Defaults to `true`. */
|
|
15
15
|
draggable?: boolean;
|
|
16
16
|
}
|
|
17
|
+
/** The smallest a group may get, by direction: `width` across a side-by-side split, `height` across a stacked one. */
|
|
18
|
+
export interface DockMinSize {
|
|
19
|
+
width?: SplitterLimit;
|
|
20
|
+
height?: SplitterLimit;
|
|
21
|
+
}
|
|
17
22
|
export interface DockProps {
|
|
18
23
|
/**
|
|
19
24
|
* The layout, bound with `v-model`: splits of two parts and groups of
|
|
@@ -34,12 +39,27 @@ export interface DockProps {
|
|
|
34
39
|
draggable?: boolean;
|
|
35
40
|
/**
|
|
36
41
|
* The smallest each side of a split may get, as `DouSplitter`'s `min`
|
|
37
|
-
* and `minEnd`: numbers in percent, `'120px'` in px.
|
|
42
|
+
* and `minEnd`: numbers in percent, `'120px'` in px. An object gives
|
|
43
|
+
* `width` and `height` apart; a direction left out takes `'120px'`.
|
|
44
|
+
* The edge of a group too small to hold two of these splits nothing off.
|
|
45
|
+
*/
|
|
46
|
+
min?: SplitterLimit | DockMinSize;
|
|
47
|
+
/**
|
|
48
|
+
* The group last used, bound with `v-model:active-group`: the one a
|
|
49
|
+
* pointer pressed in or the focus moved into last, or where a tab was
|
|
50
|
+
* dropped or split off to. `undefined` once that group is gone.
|
|
38
51
|
*/
|
|
39
|
-
|
|
52
|
+
activeGroup?: string;
|
|
40
53
|
/** Makes the id of a group split off. Defaults to `group-1`, `group-2`… */
|
|
41
54
|
createId?: (layout: DockNode) => string;
|
|
42
55
|
}
|
|
56
|
+
/** What `startDrop` drags in from outside the dock. */
|
|
57
|
+
export interface DockDropItem {
|
|
58
|
+
/** The tab it opens, or moves when the layout has it already. Give it an entry in `panels`. */
|
|
59
|
+
value: TabsValue;
|
|
60
|
+
/** The text of the tab that follows the pointer. Defaults to the label in `panels`. */
|
|
61
|
+
label?: string;
|
|
62
|
+
}
|
|
43
63
|
/** Where a tab is: the id of its group and its index there. */
|
|
44
64
|
export interface DockLocation {
|
|
45
65
|
group: string;
|
|
@@ -47,13 +67,15 @@ export interface DockLocation {
|
|
|
47
67
|
}
|
|
48
68
|
export interface DockMoveEvent {
|
|
49
69
|
value: TabsValue;
|
|
50
|
-
from
|
|
70
|
+
/** Where it was; `null` when it was dragged in from outside and opens here. */
|
|
71
|
+
from: DockLocation | null;
|
|
51
72
|
/** Where it ends up, its index counted once the move is done. */
|
|
52
73
|
to: DockLocation;
|
|
53
74
|
}
|
|
54
75
|
export interface DockSplitEvent {
|
|
55
76
|
value: TabsValue;
|
|
56
|
-
from
|
|
77
|
+
/** Where it was; `null` when it was dragged in from outside and opens here. */
|
|
78
|
+
from: DockLocation | null;
|
|
57
79
|
/** The group it was dropped on the edge of. */
|
|
58
80
|
target: string;
|
|
59
81
|
side: DockSide;
|
|
@@ -73,6 +95,7 @@ export interface DockEmits {
|
|
|
73
95
|
remove: [value: TabsValue, group: string];
|
|
74
96
|
/** The add button of a group was pressed. The same as `DouTabs`' `add`, with the group. */
|
|
75
97
|
add: [group: string];
|
|
98
|
+
'update:activeGroup': [group: string | undefined];
|
|
76
99
|
}
|
|
77
100
|
export interface DockSlots {
|
|
78
101
|
/** The content of a tab. */
|
|
@@ -84,6 +107,30 @@ export interface DockSlots {
|
|
|
84
107
|
value: TabsValue;
|
|
85
108
|
selected: boolean;
|
|
86
109
|
}) => unknown;
|
|
110
|
+
/**
|
|
111
|
+
* At the end of each group's tab row, as `DouTabs`' `extra`: e.g. actions
|
|
112
|
+
* for that group. `active` is its selected tab, `undefined` when it has none.
|
|
113
|
+
*/
|
|
114
|
+
extra?: (props: {
|
|
115
|
+
group: DockGroup;
|
|
116
|
+
active: TabsValue | undefined;
|
|
117
|
+
}) => unknown;
|
|
87
118
|
/** Shown when there is no tab left. */
|
|
88
119
|
empty?: () => unknown;
|
|
89
120
|
}
|
|
121
|
+
export interface DockExpose {
|
|
122
|
+
/**
|
|
123
|
+
* Whether a group has room for two `min`s in the direction of `side`:
|
|
124
|
+
* when not, dropping a tab on that edge does not split it. Reactive,
|
|
125
|
+
* so it can be read while rendering.
|
|
126
|
+
*/
|
|
127
|
+
canSplit: (groupId: string, side: DockSide) => boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Call in the `pointerdown` of an element outside the dock to drag it in
|
|
130
|
+
* as a tab: dropped on a tab row, the middle or an edge of a group, it
|
|
131
|
+
* opens there, as a dragged tab would. A value open already moves from
|
|
132
|
+
* its group. Does nothing while `draggable` is off, or for a panel that
|
|
133
|
+
* is disabled or not draggable.
|
|
134
|
+
*/
|
|
135
|
+
startDrop: (event: PointerEvent, item: DockDropItem) => void;
|
|
136
|
+
}
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
import type { SplitterLimit } from '../splitter/splitter';
|
|
1
2
|
import type { TabsValue } from '../tabs/tabs';
|
|
2
|
-
import type { DockPanel, DockProps, DockSlots } from './dock';
|
|
3
|
+
import type { DockExpose, DockPanel, DockProps, DockSlots } from './dock';
|
|
3
4
|
import type { DockNode } from './layout';
|
|
5
|
+
type __VLS_Props = DockProps;
|
|
4
6
|
type __VLS_Slots = DockSlots;
|
|
5
|
-
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
'activeGroup'?: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, DockExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
12
|
split: (event: import("./dock").DockSplitEvent) => any;
|
|
7
13
|
add: (group: string) => any;
|
|
8
14
|
remove: (value: TabsValue, group: string) => any;
|
|
9
15
|
"update:modelValue": (value: DockNode) => any;
|
|
10
16
|
move: (event: import("./dock").DockMoveEvent) => any;
|
|
11
|
-
|
|
17
|
+
"update:activeGroup": (value: string | undefined) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
19
|
onSplit?: ((event: import("./dock").DockSplitEvent) => any) | undefined;
|
|
13
20
|
onAdd?: ((group: string) => any) | undefined;
|
|
14
21
|
onRemove?: ((value: TabsValue, group: string) => any) | undefined;
|
|
15
22
|
"onUpdate:modelValue"?: ((value: DockNode) => any) | undefined;
|
|
16
23
|
onMove?: ((event: import("./dock").DockMoveEvent) => any) | undefined;
|
|
24
|
+
"onUpdate:activeGroup"?: ((value: string | undefined) => any) | undefined;
|
|
17
25
|
}>, {
|
|
18
26
|
panels: DockPanel[];
|
|
19
|
-
min: import("
|
|
27
|
+
min: SplitterLimit | import("./dock").DockMinSize;
|
|
20
28
|
closable: boolean;
|
|
21
29
|
draggable: boolean;
|
|
22
30
|
addable: boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SplitterLimit } from '../splitter/splitter';
|
|
2
|
+
import type { DockSide } from './layout';
|
|
3
|
+
interface Box {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Whether `length` px can hold two parts of at least `min` each beside
|
|
11
|
+
* the 1px divider of a split. A number is a percent of the split.
|
|
12
|
+
*/
|
|
13
|
+
export declare function roomForSplit(length: number, min: SplitterLimit): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Where a tab dropped at `x`, `y` on a group goes: the nearest edge within
|
|
16
|
+
* reach (a quarter of the side, at least 24px) splits it off there, the
|
|
17
|
+
* rest takes it in. The edges of a direction too small to split in two
|
|
18
|
+
* are part of the middle.
|
|
19
|
+
*/
|
|
20
|
+
export declare function dockDropSide(box: Box, x: number, y: number, min: {
|
|
21
|
+
width: SplitterLimit;
|
|
22
|
+
height: SplitterLimit;
|
|
23
|
+
}): DockSide | 'center';
|
|
24
|
+
export {};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import Dock from './dock.vue';
|
|
2
2
|
export declare const DouDock: import("../..").WithInstall<{
|
|
3
|
-
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./dock").DockProps
|
|
3
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./dock").DockProps & {
|
|
4
|
+
activeGroup?: string;
|
|
5
|
+
}> & Readonly<{
|
|
4
6
|
onSplit?: ((event: import("./dock").DockSplitEvent) => any) | undefined;
|
|
5
7
|
onAdd?: ((group: string) => any) | undefined;
|
|
6
8
|
onRemove?: ((value: import("..").TabsValue, group: string) => any) | undefined;
|
|
7
9
|
"onUpdate:modelValue"?: ((value: import("./layout").DockNode) => any) | undefined;
|
|
8
10
|
onMove?: ((event: import("./dock").DockMoveEvent) => any) | undefined;
|
|
9
|
-
|
|
11
|
+
"onUpdate:activeGroup"?: ((value: string | undefined) => any) | undefined;
|
|
12
|
+
}>, import("./dock").DockExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
13
|
split: (event: import("./dock").DockSplitEvent) => any;
|
|
11
14
|
add: (group: string) => any;
|
|
12
15
|
remove: (value: import("..").TabsValue, group: string) => any;
|
|
13
16
|
"update:modelValue": (value: import("./layout").DockNode) => any;
|
|
14
17
|
move: (event: import("./dock").DockMoveEvent) => any;
|
|
18
|
+
"update:activeGroup": (value: string | undefined) => any;
|
|
15
19
|
}, import("vue").PublicProps, {
|
|
16
20
|
panels: import("./dock").DockPanel[];
|
|
17
|
-
min: import("..").SplitterLimit;
|
|
21
|
+
min: import("..").SplitterLimit | import("./dock").DockMinSize;
|
|
18
22
|
closable: boolean;
|
|
19
23
|
draggable: boolean;
|
|
20
24
|
addable: boolean;
|
|
@@ -25,15 +29,18 @@ export declare const DouDock: import("../..").WithInstall<{
|
|
|
25
29
|
C: {};
|
|
26
30
|
M: {};
|
|
27
31
|
Defaults: {};
|
|
28
|
-
}, Readonly<import("./dock").DockProps
|
|
32
|
+
}, Readonly<import("./dock").DockProps & {
|
|
33
|
+
activeGroup?: string;
|
|
34
|
+
}> & Readonly<{
|
|
29
35
|
onSplit?: ((event: import("./dock").DockSplitEvent) => any) | undefined;
|
|
30
36
|
onAdd?: ((group: string) => any) | undefined;
|
|
31
37
|
onRemove?: ((value: import("..").TabsValue, group: string) => any) | undefined;
|
|
32
38
|
"onUpdate:modelValue"?: ((value: import("./layout").DockNode) => any) | undefined;
|
|
33
39
|
onMove?: ((event: import("./dock").DockMoveEvent) => any) | undefined;
|
|
34
|
-
|
|
40
|
+
"onUpdate:activeGroup"?: ((value: string | undefined) => any) | undefined;
|
|
41
|
+
}>, import("./dock").DockExpose, {}, {}, {}, {
|
|
35
42
|
panels: import("./dock").DockPanel[];
|
|
36
|
-
min: import("..").SplitterLimit;
|
|
43
|
+
min: import("..").SplitterLimit | import("./dock").DockMinSize;
|
|
37
44
|
closable: boolean;
|
|
38
45
|
draggable: boolean;
|
|
39
46
|
addable: boolean;
|
|
@@ -41,21 +48,25 @@ export declare const DouDock: import("../..").WithInstall<{
|
|
|
41
48
|
__isFragment?: never;
|
|
42
49
|
__isTeleport?: never;
|
|
43
50
|
__isSuspense?: never;
|
|
44
|
-
} & import("vue").ComponentOptionsBase<Readonly<import("./dock").DockProps
|
|
51
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("./dock").DockProps & {
|
|
52
|
+
activeGroup?: string;
|
|
53
|
+
}> & Readonly<{
|
|
45
54
|
onSplit?: ((event: import("./dock").DockSplitEvent) => any) | undefined;
|
|
46
55
|
onAdd?: ((group: string) => any) | undefined;
|
|
47
56
|
onRemove?: ((value: import("..").TabsValue, group: string) => any) | undefined;
|
|
48
57
|
"onUpdate:modelValue"?: ((value: import("./layout").DockNode) => any) | undefined;
|
|
49
58
|
onMove?: ((event: import("./dock").DockMoveEvent) => any) | undefined;
|
|
50
|
-
|
|
59
|
+
"onUpdate:activeGroup"?: ((value: string | undefined) => any) | undefined;
|
|
60
|
+
}>, import("./dock").DockExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
61
|
split: (event: import("./dock").DockSplitEvent) => any;
|
|
52
62
|
add: (group: string) => any;
|
|
53
63
|
remove: (value: import("..").TabsValue, group: string) => any;
|
|
54
64
|
"update:modelValue": (value: import("./layout").DockNode) => any;
|
|
55
65
|
move: (event: import("./dock").DockMoveEvent) => any;
|
|
66
|
+
"update:activeGroup": (value: string | undefined) => any;
|
|
56
67
|
}, string, {
|
|
57
68
|
panels: import("./dock").DockPanel[];
|
|
58
|
-
min: import("..").SplitterLimit;
|
|
69
|
+
min: import("..").SplitterLimit | import("./dock").DockMinSize;
|
|
59
70
|
closable: boolean;
|
|
60
71
|
draggable: boolean;
|
|
61
72
|
addable: boolean;
|
|
@@ -33,6 +33,14 @@ export declare function registerTabDropZone(zone: TabDropZone): {
|
|
|
33
33
|
export interface StartTabDragOptions {
|
|
34
34
|
/** The tab element: it is copied for the ghost and dimmed while it moves. */
|
|
35
35
|
el: HTMLElement;
|
|
36
|
+
/**
|
|
37
|
+
* For a drag that starts on something other than a tab: the ghost is a
|
|
38
|
+
* tab with this text, sized like the tabs of `tabs`, in place of a copy of `el`.
|
|
39
|
+
*/
|
|
40
|
+
ghost?: {
|
|
41
|
+
label: string;
|
|
42
|
+
tabs: HTMLElement | null | undefined;
|
|
43
|
+
};
|
|
36
44
|
/** An element that stays in the page for the whole drag, to capture the pointer. */
|
|
37
45
|
root: HTMLElement | null;
|
|
38
46
|
drag: () => TabDrag;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dou-ui",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.9",
|
|
4
4
|
"description": "为自己打造的 Vue 3 组件库:简洁克制,样式与组件分离,内置无障碍支持",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"vue": "^3.5.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@dou-ui/icons": "0.1.0-alpha.
|
|
53
|
-
"@dou-ui/theme": "0.1.0-alpha.
|
|
52
|
+
"@dou-ui/icons": "0.1.0-alpha.9",
|
|
53
|
+
"@dou-ui/theme": "0.1.0-alpha.9"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|