@bridge-ui/vue 0.16.0 → 0.17.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/ai/skills/bridge-ui-components/SKILL.md +2 -1
- package/dist/Actions/Snackbar/createBridgeSnackbarApi.js +1 -1
- package/dist/Actions/actionHostRegistry.d.ts +2 -1
- package/dist/Actions/actionHostRegistry.js +11 -7
- package/dist/Components/DataTable/DataTable.vue.d.ts +5 -3
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +138 -117
- package/dist/Components/DataTable/composables/useDataTable.d.ts +4 -2
- package/dist/Components/DataTable/composables/useDataTable.js +293 -273
- package/dist/Components/DataTable/dataTable.types.d.ts +35 -2
- package/dist/Components/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/Components/Drawer/composables/useDrawer.js +68 -67
- package/dist/Components/Menu/Menu.vue_vue_type_script_setup_true_lang.js +3 -5
- package/dist/Components/Modal/Modal.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/Components/Modal/composables/useModal.js +129 -119
- package/dist/Components/Pagination/Pagination.vue.d.ts +6 -0
- package/dist/Components/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js +23 -11
- package/dist/Components/Pagination/composables/usePagination.d.ts +3 -3
- package/dist/Components/Pagination/composables/usePagination.js +95 -84
- package/dist/Components/Pagination/pagination.types.d.ts +30 -2
- package/dist/Components/Resizable/Resizable.js +5 -0
- package/dist/Components/Resizable/Resizable.vue.d.ts +17 -0
- package/dist/Components/Resizable/Resizable.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/Components/Resizable/composables/useResizable.d.ts +18 -0
- package/dist/Components/Resizable/composables/useResizable.js +195 -0
- package/dist/Components/Resizable/index.d.ts +4 -0
- package/dist/Components/Resizable/index.js +4 -0
- package/dist/Components/Resizable/resizable.types.d.ts +53 -0
- package/dist/Components/Resizable/resizableInjectionKey.d.ts +111 -0
- package/dist/Components/Resizable/resizableInjectionKey.js +4 -0
- package/dist/Components/ResizableHandle/ResizableHandle.js +5 -0
- package/dist/Components/ResizableHandle/ResizableHandle.vue.d.ts +14 -0
- package/dist/Components/ResizableHandle/ResizableHandle.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/Components/ResizableHandle/composables/useResizableHandle.d.ts +35 -0
- package/dist/Components/ResizableHandle/composables/useResizableHandle.js +85 -0
- package/dist/Components/ResizableHandle/index.d.ts +3 -0
- package/dist/Components/ResizableHandle/index.js +3 -0
- package/dist/Components/ResizableHandle/resizableHandle.types.d.ts +58 -0
- package/dist/Components/ResizablePanel/ResizablePanel.js +5 -0
- package/dist/Components/ResizablePanel/ResizablePanel.vue.d.ts +24 -0
- package/dist/Components/ResizablePanel/ResizablePanel.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +21 -0
- package/dist/Components/ResizablePanel/composables/useResizablePanel.js +87 -0
- package/dist/Components/ResizablePanel/index.d.ts +3 -0
- package/dist/Components/ResizablePanel/index.js +3 -0
- package/dist/Components/ResizablePanel/resizablePanel.types.d.ts +71 -0
- package/dist/Components/Snackbar/composables/useSnackbar.js +140 -146
- package/dist/Components/Tooltip/Tooltip.vue_vue_type_script_setup_true_lang.js +4 -6
- package/dist/augments.d.ts +15 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +70 -63
- package/docs/README.md +1 -0
- package/docs/components/DataTable.md +19 -0
- package/docs/components/Pagination.md +17 -5
- package/docs/components/Resizable.md +224 -0
- package/package.json +2 -2
|
@@ -2,21 +2,24 @@ import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js
|
|
|
2
2
|
import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
|
|
3
3
|
import { computed as i, useAttrs as a, useSlots as o } from "vue";
|
|
4
4
|
import { get as s } from "es-toolkit/compat";
|
|
5
|
-
import {
|
|
6
|
-
import { paginationColorProps as
|
|
7
|
-
import { cn as
|
|
5
|
+
import { getPaginationCursorAvailability as c, getPaginationItems as l } from "@bridge-ui/core/Domain";
|
|
6
|
+
import { paginationColorProps as ee, paginationRoundedProps as te, paginationSizeProps as ne, paginationVariantProps as re } from "@bridge-ui/core/Tokens";
|
|
7
|
+
import { cn as u, mergeBridgeUILayeredClasses as d, splitComponentProps as f } from "@bridge-ui/core/Utils";
|
|
8
8
|
//#region src/Components/Pagination/composables/usePagination.ts
|
|
9
|
-
var
|
|
9
|
+
var p = [
|
|
10
10
|
"mode",
|
|
11
11
|
"size",
|
|
12
12
|
"color",
|
|
13
13
|
"count",
|
|
14
|
+
"cursor",
|
|
14
15
|
"classes",
|
|
15
16
|
"hasNext",
|
|
16
17
|
"rounded",
|
|
17
18
|
"variant",
|
|
18
19
|
"disabled",
|
|
19
20
|
"modelValue",
|
|
21
|
+
"nextCursor",
|
|
22
|
+
"prevCursor",
|
|
20
23
|
"customProps",
|
|
21
24
|
"hasPrevious",
|
|
22
25
|
"siblingCount",
|
|
@@ -24,163 +27,171 @@ var g = [
|
|
|
24
27
|
"hideNextButton",
|
|
25
28
|
"hidePrevButton"
|
|
26
29
|
];
|
|
27
|
-
function
|
|
28
|
-
let
|
|
30
|
+
function m(m, h, g, _, v) {
|
|
31
|
+
let y = e(), b = a(), x = o(), S = i(() => f({
|
|
29
32
|
props: {
|
|
30
|
-
...
|
|
31
|
-
...
|
|
33
|
+
...b,
|
|
34
|
+
...m
|
|
32
35
|
},
|
|
33
|
-
bridgeKeys:
|
|
34
|
-
})), { merged:
|
|
35
|
-
libDefaults:
|
|
36
|
+
bridgeKeys: p
|
|
37
|
+
})), { merged: C, entry: w } = n({
|
|
38
|
+
libDefaults: h,
|
|
36
39
|
componentName: "Pagination",
|
|
37
|
-
props: () =>
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
props: () => S.value.componentProps
|
|
41
|
+
}), T = i(() => C.value.customProps), E = i(() => c(C.value.hasNext, C.value.nextCursor)), D = i(() => c(C.value.hasPrevious, C.value.prevCursor)), O = (e) => {
|
|
42
|
+
if (e !== void 0) {
|
|
43
|
+
if (v) {
|
|
44
|
+
v.value = e;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
_("update:cursor", e);
|
|
48
|
+
}
|
|
49
|
+
}, k = i(() => C.value.mode === "simple" ? 1 : g.value ?? 1), A = i(() => C.value.mode === "simple" ? [] : l({
|
|
50
|
+
page: k.value,
|
|
51
|
+
count: C.value.count ?? 0,
|
|
52
|
+
siblingCount: C.value.siblingCount,
|
|
53
|
+
boundaryCount: C.value.boundaryCount
|
|
54
|
+
})), j = r({
|
|
55
|
+
entry: w,
|
|
56
|
+
props: () => S.value.componentProps
|
|
57
|
+
}), ie = i(() => d(ne, w.value?.tokens?.size)), ae = i(() => d(re, w.value?.tokens?.variant)), oe = i(() => d(ee, w.value?.tokens?.color)), M = i(() => d(te, w.value?.tokens?.rounded)), N = i(() => s(ie.value, C.value.size)), P = i(() => s(ae.value, C.value.variant)), F = i(() => s(oe.value, C.value.color)), I = i(() => s(M.value, C.value.rounded)), L = (e) => {
|
|
58
|
+
if (C.value.disabled) return;
|
|
59
|
+
let t = C.value.count ?? 0, n = Math.min(Math.max(1, e), Math.max(t, 1));
|
|
60
|
+
g.value = n, _("change", n);
|
|
50
61
|
}, R = () => {
|
|
51
|
-
if (!
|
|
52
|
-
if (
|
|
53
|
-
if (
|
|
54
|
-
|
|
62
|
+
if (!C.value.disabled) {
|
|
63
|
+
if (C.value.mode === "simple") {
|
|
64
|
+
if (D.value === !1) return;
|
|
65
|
+
O(C.value.prevCursor), _("previous");
|
|
55
66
|
return;
|
|
56
67
|
}
|
|
57
|
-
L(
|
|
68
|
+
L(k.value - 1);
|
|
58
69
|
}
|
|
59
70
|
}, z = () => {
|
|
60
|
-
if (!
|
|
61
|
-
if (
|
|
62
|
-
if (
|
|
63
|
-
|
|
71
|
+
if (!C.value.disabled) {
|
|
72
|
+
if (C.value.mode === "simple") {
|
|
73
|
+
if (E.value === !1) return;
|
|
74
|
+
O(C.value.nextCursor), _("next");
|
|
64
75
|
return;
|
|
65
76
|
}
|
|
66
|
-
L(
|
|
77
|
+
L(k.value + 1);
|
|
67
78
|
}
|
|
68
|
-
}, B = i(() =>
|
|
79
|
+
}, B = i(() => C.value.disabled ? !0 : C.value.mode === "simple" ? D.value === !1 : k.value <= 1), V = i(() => C.value.disabled ? !0 : C.value.mode === "simple" ? E.value === !1 : k.value >= (C.value.count ?? 0)), H = i(() => !C.value.hidePrevButton), U = i(() => !C.value.hideNextButton), W = i(() => C.value.variant === "outlined"), G = i(() => C.value.variant === "ghost" || C.value.variant === "text"), K = i(() => u({
|
|
69
80
|
[s(N.value, "item") ?? ""]: !0,
|
|
70
81
|
[s(P.value, "item") ?? ""]: !0,
|
|
71
82
|
[s(I.value, "item") ?? ""]: G.value
|
|
72
|
-
})), q = i(() =>
|
|
83
|
+
})), q = i(() => u({
|
|
73
84
|
[s(N.value, "itemIcon") ?? ""]: !0,
|
|
74
85
|
[s(P.value, "item") ?? ""]: !0,
|
|
75
86
|
[s(I.value, "item") ?? ""]: G.value
|
|
76
|
-
})),
|
|
87
|
+
})), se = i(() => u({
|
|
77
88
|
[s(P.value, "itemSelected") ?? ""]: !0,
|
|
78
89
|
[s(F.value, "itemSelectedAccent") ?? ""]: !0
|
|
79
|
-
})),
|
|
80
|
-
let e =
|
|
90
|
+
})), J = i(() => {
|
|
91
|
+
let e = A.value.filter((e) => e.type === "page");
|
|
81
92
|
return {
|
|
82
93
|
first: e[0]?.page,
|
|
83
94
|
last: e[e.length - 1]?.page
|
|
84
95
|
};
|
|
85
|
-
}),
|
|
96
|
+
}), Y = (e, t) => {
|
|
86
97
|
if (!W.value) return !1;
|
|
87
98
|
if (e === "prev") return !0;
|
|
88
99
|
if (H.value) return !1;
|
|
89
|
-
let n =
|
|
100
|
+
let n = A.value[0];
|
|
90
101
|
return e === "page" ? n?.type === "page" && n.page === t : e === "ellipsis" && n?.type === "ellipsis" && t === 0;
|
|
91
|
-
},
|
|
92
|
-
let e =
|
|
93
|
-
return t(
|
|
94
|
-
"aria-label": e["aria-label"] ??
|
|
95
|
-
class:
|
|
102
|
+
}, X = i(() => y("Previous")), Z = i(() => y("Next")), ce = i(() => {
|
|
103
|
+
let e = S.value.inheritedAttrs;
|
|
104
|
+
return t(T.value?.root, e, {
|
|
105
|
+
"aria-label": e["aria-label"] ?? y("Pagination"),
|
|
106
|
+
class: u({
|
|
96
107
|
[s(N.value, "root") ?? ""]: !0,
|
|
97
|
-
[s(
|
|
108
|
+
[s(j.value, "root") ?? ""]: !0
|
|
98
109
|
})
|
|
99
110
|
});
|
|
100
|
-
}),
|
|
111
|
+
}), le = i(() => t(T.value?.list, {}, { class: u({
|
|
101
112
|
[s(N.value, "list") ?? ""]: !0,
|
|
102
113
|
[s(P.value, "list") ?? ""]: !0,
|
|
103
114
|
[s(I.value, "list") ?? ""]: W.value,
|
|
104
|
-
[s(
|
|
105
|
-
}) })),
|
|
106
|
-
let n = e ===
|
|
107
|
-
return t(
|
|
115
|
+
[s(j.value, "list") ?? ""]: !0
|
|
116
|
+
}) })), ue = (e) => {
|
|
117
|
+
let n = e === k.value, r = W.value && !H.value && e === J.value.first, i = W.value && !U.value && e === J.value.last;
|
|
118
|
+
return t(T.value?.item, {}, {
|
|
108
119
|
type: "button",
|
|
109
|
-
disabled:
|
|
120
|
+
disabled: C.value.disabled,
|
|
110
121
|
"aria-label": `Page ${e}`,
|
|
111
122
|
"aria-current": n ? "page" : void 0,
|
|
112
123
|
onClick: () => {
|
|
113
124
|
n || L(e);
|
|
114
125
|
},
|
|
115
|
-
class:
|
|
126
|
+
class: u({
|
|
116
127
|
[K.value]: !0,
|
|
117
|
-
[
|
|
118
|
-
[s(
|
|
119
|
-
"ml-0":
|
|
128
|
+
[se.value]: n,
|
|
129
|
+
[s(j.value, "item") ?? ""]: !0,
|
|
130
|
+
"ml-0": Y("page", e),
|
|
120
131
|
[s(I.value, "itemStart") ?? ""]: r,
|
|
121
132
|
[s(I.value, "itemEnd") ?? ""]: i
|
|
122
133
|
})
|
|
123
134
|
});
|
|
124
|
-
},
|
|
135
|
+
}, Q = (e) => t(T.value?.ellipsis, {}, {
|
|
125
136
|
"aria-hidden": !0,
|
|
126
137
|
"data-ellipsis-index": e,
|
|
127
|
-
class:
|
|
138
|
+
class: u({
|
|
128
139
|
[s(N.value, "ellipsis") ?? ""]: !0,
|
|
129
140
|
[s(P.value, "ellipsis") ?? ""]: !0,
|
|
130
141
|
[s(I.value, "item") ?? ""]: G.value,
|
|
131
|
-
[s(
|
|
132
|
-
"ml-0":
|
|
142
|
+
[s(j.value, "ellipsis") ?? ""]: !0,
|
|
143
|
+
"ml-0": Y("ellipsis", e)
|
|
133
144
|
})
|
|
134
145
|
}), $ = i(() => s(N.value, "icon") ?? "sm");
|
|
135
146
|
return {
|
|
136
|
-
page:
|
|
137
|
-
slots:
|
|
138
|
-
merged:
|
|
139
|
-
entries:
|
|
147
|
+
page: k,
|
|
148
|
+
slots: x,
|
|
149
|
+
merged: C,
|
|
150
|
+
entries: A,
|
|
140
151
|
showPrev: H,
|
|
141
152
|
showNext: U,
|
|
142
|
-
rootBind:
|
|
143
|
-
listBind:
|
|
144
|
-
prevBind: i(() => t(
|
|
153
|
+
rootBind: ce,
|
|
154
|
+
listBind: le,
|
|
155
|
+
prevBind: i(() => t(T.value?.prev, {}, {
|
|
145
156
|
onClick: R,
|
|
146
157
|
type: "button",
|
|
147
158
|
disabled: B.value,
|
|
148
|
-
"aria-label":
|
|
149
|
-
class:
|
|
159
|
+
"aria-label": X.value,
|
|
160
|
+
class: u({
|
|
150
161
|
[q.value]: !0,
|
|
151
|
-
[s(
|
|
152
|
-
[s(
|
|
162
|
+
[s(j.value, "prev") ?? ""]: !0,
|
|
163
|
+
[s(j.value, "item") ?? ""]: !0,
|
|
153
164
|
"ml-0": W.value,
|
|
154
165
|
[s(I.value, "itemStart") ?? ""]: W.value
|
|
155
166
|
})
|
|
156
167
|
})),
|
|
157
|
-
nextBind: i(() => t(
|
|
168
|
+
nextBind: i(() => t(T.value?.next, {}, {
|
|
158
169
|
onClick: z,
|
|
159
170
|
type: "button",
|
|
160
171
|
disabled: V.value,
|
|
161
|
-
"aria-label":
|
|
162
|
-
class:
|
|
172
|
+
"aria-label": Z.value,
|
|
173
|
+
class: u({
|
|
163
174
|
[q.value]: !0,
|
|
164
|
-
[s(
|
|
165
|
-
[s(
|
|
175
|
+
[s(j.value, "next") ?? ""]: !0,
|
|
176
|
+
[s(j.value, "item") ?? ""]: !0,
|
|
166
177
|
[s(I.value, "itemEnd") ?? ""]: W.value
|
|
167
178
|
})
|
|
168
179
|
})),
|
|
169
|
-
prevLabel:
|
|
170
|
-
nextLabel:
|
|
171
|
-
getItemBind:
|
|
172
|
-
prevIconBind: i(() => t(
|
|
180
|
+
prevLabel: X,
|
|
181
|
+
nextLabel: Z,
|
|
182
|
+
getItemBind: ue,
|
|
183
|
+
prevIconBind: i(() => t(T.value?.prevIcon, {}, {
|
|
173
184
|
"aria-hidden": !0,
|
|
174
185
|
size: $.value,
|
|
175
186
|
class: "shrink-0 pointer-events-none"
|
|
176
187
|
})),
|
|
177
|
-
nextIconBind: i(() => t(
|
|
188
|
+
nextIconBind: i(() => t(T.value?.nextIcon, {}, {
|
|
178
189
|
"aria-hidden": !0,
|
|
179
190
|
size: $.value,
|
|
180
191
|
class: "shrink-0 pointer-events-none"
|
|
181
192
|
})),
|
|
182
|
-
getEllipsisBind:
|
|
193
|
+
getEllipsisBind: Q
|
|
183
194
|
};
|
|
184
195
|
}
|
|
185
196
|
//#endregion
|
|
186
|
-
export {
|
|
197
|
+
export { m as usePagination };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, HTMLAttributes, LiHTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { PaginationCursor } from '@bridge-ui/core/Domain';
|
|
2
3
|
import { PaginationColor, PaginationRounded, PaginationSize, PaginationVariant } from '@bridge-ui/core/Tokens';
|
|
3
4
|
import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
|
|
4
5
|
import { IconProps } from '../Icon';
|
|
@@ -95,6 +96,12 @@ export interface PaginationEmits {
|
|
|
95
96
|
* Emitted when previous is activated in simple mode.
|
|
96
97
|
*/
|
|
97
98
|
previous: [];
|
|
99
|
+
/**
|
|
100
|
+
* Emitted with `nextCursor` / `prevCursor` when next / previous is
|
|
101
|
+
* activated in simple mode (`v-model:cursor`, only when that cursor prop is
|
|
102
|
+
* passed). Fires before `next` / `previous`.
|
|
103
|
+
*/
|
|
104
|
+
"update:cursor": [cursor: PaginationCursor];
|
|
98
105
|
/**
|
|
99
106
|
* Emitted when `v-model` should update.
|
|
100
107
|
*/
|
|
@@ -128,6 +135,13 @@ export interface PaginationOwnProps {
|
|
|
128
135
|
* @default undefined
|
|
129
136
|
*/
|
|
130
137
|
count?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Current cursor, bound with `v-model:cursor` (`mode="simple"`). Set to
|
|
140
|
+
* `nextCursor` / `prevCursor` when the user navigates.
|
|
141
|
+
*
|
|
142
|
+
* @default undefined
|
|
143
|
+
*/
|
|
144
|
+
cursor?: PaginationCursor;
|
|
131
145
|
/**
|
|
132
146
|
* Extra props for internal parts.
|
|
133
147
|
*
|
|
@@ -141,13 +155,15 @@ export interface PaginationOwnProps {
|
|
|
141
155
|
*/
|
|
142
156
|
disabled?: boolean;
|
|
143
157
|
/**
|
|
144
|
-
* Whether next is available (`mode="simple"`).
|
|
158
|
+
* Whether next is available (`mode="simple"`). Defaults to
|
|
159
|
+
* `nextCursor !== null` when `nextCursor` is passed.
|
|
145
160
|
*
|
|
146
161
|
* @default undefined
|
|
147
162
|
*/
|
|
148
163
|
hasNext?: boolean;
|
|
149
164
|
/**
|
|
150
|
-
* Whether previous is available (`mode="simple"`).
|
|
165
|
+
* Whether previous is available (`mode="simple"`). Defaults to
|
|
166
|
+
* `prevCursor !== null` when `prevCursor` is passed.
|
|
151
167
|
*
|
|
152
168
|
* @default undefined
|
|
153
169
|
*/
|
|
@@ -176,6 +192,18 @@ export interface PaginationOwnProps {
|
|
|
176
192
|
* @default 1
|
|
177
193
|
*/
|
|
178
194
|
modelValue?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Cursor of the next page (`mode="simple"`). `null` disables next.
|
|
197
|
+
*
|
|
198
|
+
* @default undefined
|
|
199
|
+
*/
|
|
200
|
+
nextCursor?: PaginationCursor;
|
|
201
|
+
/**
|
|
202
|
+
* Cursor of the previous page (`mode="simple"`). `null` disables previous.
|
|
203
|
+
*
|
|
204
|
+
* @default undefined
|
|
205
|
+
*/
|
|
206
|
+
prevCursor?: PaginationCursor;
|
|
179
207
|
/**
|
|
180
208
|
* Control corner radius (`ghost` / `text` items and `outlined` group edges).
|
|
181
209
|
*
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ResizableOwnProps, ResizableSlots } from './resizable.types';
|
|
2
|
+
type __VLS_Slots = ResizableSlots;
|
|
3
|
+
declare const __VLS_base: import('vue').DefineComponent<ResizableOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
4
|
+
layoutChange: (layout: number[]) => any;
|
|
5
|
+
}, string, import('vue').PublicProps, Readonly<ResizableOwnProps> & Readonly<{
|
|
6
|
+
onLayoutChange?: ((layout: number[]) => any) | undefined;
|
|
7
|
+
}>, {
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useResizable as e } from "./composables/useResizable.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, mergeProps as r, openBlock as i, renderSlot as a, unref as o } from "vue";
|
|
3
|
+
//#region src/Components/Resizable/Resizable.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var s = /*@__PURE__*/ n({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "Resizable",
|
|
7
|
+
props: {
|
|
8
|
+
classes: {},
|
|
9
|
+
disabled: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: void 0
|
|
12
|
+
},
|
|
13
|
+
keyboardStep: {},
|
|
14
|
+
orientation: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["layoutChange"],
|
|
17
|
+
setup(n, { emit: s }) {
|
|
18
|
+
let { rootRef: c, rootBind: l } = e(n, {
|
|
19
|
+
disabled: !1,
|
|
20
|
+
keyboardStep: 10,
|
|
21
|
+
orientation: "horizontal"
|
|
22
|
+
}, s);
|
|
23
|
+
return (e, n) => (i(), t("div", r({
|
|
24
|
+
ref_key: "rootRef",
|
|
25
|
+
ref: c
|
|
26
|
+
}, o(l)), [a(e.$slots, "default")], 16));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { s as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SetupContext } from 'vue';
|
|
2
|
+
import { LibDefaultsShape } from '@bridge-ui/core/Utils';
|
|
3
|
+
import { ResizableEmits, ResizableOwnProps, ResizableProps } from '../resizable.types';
|
|
4
|
+
type ResizableLibDefaults = LibDefaultsShape<ResizableOwnProps, "disabled" | "orientation" | "keyboardStep">;
|
|
5
|
+
export declare function useResizable(props: ResizableOwnProps, libDefaults: ResizableLibDefaults, emit?: SetupContext<ResizableEmits>["emit"]): {
|
|
6
|
+
layout: import('vue').Ref<Record<string, number>, Record<string, number>>;
|
|
7
|
+
rootRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
8
|
+
dragging: import('vue').ComputedRef<boolean>;
|
|
9
|
+
panelIds: import('vue').ComputedRef<string[]>;
|
|
10
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
11
|
+
id: string;
|
|
12
|
+
"data-orientation": string;
|
|
13
|
+
"data-dragging": string | undefined;
|
|
14
|
+
class: string;
|
|
15
|
+
}, "class", {}, Omit<ResizableProps, "orientation" | "classes" | "disabled" | "keyboardStep">>>;
|
|
16
|
+
orientation: import('vue').ComputedRef<"horizontal" | "vertical">;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { RESIZABLE_INJECTION_KEY as r } from "../resizableInjectionKey.js";
|
|
3
|
+
import { computed as i, onScopeDispose as a, provide as o, ref as s, useAttrs as c, useId as l, watch as u } from "vue";
|
|
4
|
+
import { get as d, isEqual as f } from "es-toolkit/compat";
|
|
5
|
+
import { getResizableCursor as p, getResizableHandleAria as m, getResizableItemIndexes as h, getResizableLayoutFromKey as g, getResizablePointerDelta as _, isResizablePanelCollapsed as v, resizeResizableLayout as y, resizeResizablePanel as b, resolveResizableLayout as x, resolveResizablePanelConstraints as S, sortResizableItemsByDocumentOrder as ee } from "@bridge-ui/core/Domain";
|
|
6
|
+
import { resizableOrientationProps as te } from "@bridge-ui/core/Tokens";
|
|
7
|
+
import { cn as ne, mergeBridgeUILayeredClasses as C, splitComponentProps as w } from "@bridge-ui/core/Utils";
|
|
8
|
+
//#region src/Components/Resizable/composables/useResizable.ts
|
|
9
|
+
var T = [
|
|
10
|
+
"classes",
|
|
11
|
+
"disabled",
|
|
12
|
+
"orientation",
|
|
13
|
+
"keyboardStep"
|
|
14
|
+
];
|
|
15
|
+
function E(e) {
|
|
16
|
+
return e ? getComputedStyle(e).direction === "rtl" : !1;
|
|
17
|
+
}
|
|
18
|
+
function D(D, re, ie) {
|
|
19
|
+
let O = c(), k = `bridge-resizable${l()}`, A = s(null), j = s([]), M = s({}), N = s(null), P = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), I = {}, L = null, R = i(() => w({
|
|
20
|
+
props: {
|
|
21
|
+
...O,
|
|
22
|
+
...D
|
|
23
|
+
},
|
|
24
|
+
bridgeKeys: T
|
|
25
|
+
})), { merged: z, entry: B } = t({
|
|
26
|
+
libDefaults: re,
|
|
27
|
+
componentName: "Resizable",
|
|
28
|
+
props: () => R.value.componentProps
|
|
29
|
+
}), V = n({
|
|
30
|
+
entry: B,
|
|
31
|
+
props: () => R.value.componentProps
|
|
32
|
+
}), H = i(() => C(te, B.value?.tokens?.orientation)), U = i(() => z.value.orientation === "vertical" ? "vertical" : "horizontal"), W = i(() => d(H.value, U.value)), G = i(() => h(j.value)), K = i(() => G.value.panelIds);
|
|
33
|
+
function q() {
|
|
34
|
+
let e = [...Array.from(P, ([e, t]) => ({
|
|
35
|
+
id: e,
|
|
36
|
+
kind: "panel",
|
|
37
|
+
element: t().element
|
|
38
|
+
})), ...Array.from(F, ([e, t]) => ({
|
|
39
|
+
id: e,
|
|
40
|
+
kind: "handle",
|
|
41
|
+
element: t().element
|
|
42
|
+
}))], t = ee(e, (e) => e.element).map(({ id: e, kind: t }) => ({
|
|
43
|
+
id: e,
|
|
44
|
+
kind: t
|
|
45
|
+
}));
|
|
46
|
+
f(j.value, t) || (j.value = t);
|
|
47
|
+
}
|
|
48
|
+
function J(e, t) {
|
|
49
|
+
return P.set(e, t), q(), () => {
|
|
50
|
+
P.delete(e), q();
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function ae(e, t) {
|
|
54
|
+
return F.set(e, t), q(), () => {
|
|
55
|
+
F.delete(e), q();
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function Y(e) {
|
|
59
|
+
return e.map((e) => P.get(e)?.().constraints ?? {});
|
|
60
|
+
}
|
|
61
|
+
function X(e) {
|
|
62
|
+
return e.map((e) => M.value[e] ?? 0);
|
|
63
|
+
}
|
|
64
|
+
u(K, (e) => {
|
|
65
|
+
let t = e.map((e) => {
|
|
66
|
+
let t = P.get(e)?.(), n = t?.constraints ?? {};
|
|
67
|
+
return t?.collapsed && n.collapsible ? {
|
|
68
|
+
...n,
|
|
69
|
+
defaultSize: n.collapsedSize ?? 0
|
|
70
|
+
} : n;
|
|
71
|
+
}), n = x(t, e.map((e) => M.value[e])), r = Object.fromEntries(e.map((e, t) => [e, n[t] ?? 0]));
|
|
72
|
+
f(M.value, r) || (M.value = r);
|
|
73
|
+
});
|
|
74
|
+
function Z(e, t) {
|
|
75
|
+
let n = K.value, r = M.value, i = Y(n), a = !1;
|
|
76
|
+
n.forEach((n, o) => {
|
|
77
|
+
let s = r[n], c = e[o] ?? 0, l = t?.[o] ?? s;
|
|
78
|
+
(s === void 0 || Math.abs(s - c) > 1e-6) && (a = !0), l !== void 0 && !v(i[o], l) && v(i[o], c) && (I[n] = l);
|
|
79
|
+
}), a && (M.value = Object.fromEntries(n.map((t, n) => [t, e[n] ?? 0])), ie?.("layoutChange", e));
|
|
80
|
+
}
|
|
81
|
+
function Q(e) {
|
|
82
|
+
let t = G.value.handleIndexes[e];
|
|
83
|
+
return t === void 0 || t < 0 || t >= K.value.length - 1 ? null : t;
|
|
84
|
+
}
|
|
85
|
+
function oe(e, t) {
|
|
86
|
+
let n = A.value, r = Q(e);
|
|
87
|
+
if (!n || r === null) return;
|
|
88
|
+
L?.();
|
|
89
|
+
let i = K.value, a = U.value, o = a === "vertical", s = n.getBoundingClientRect(), c = E(n), l = X(i), u = Y(i), d = o ? t.clientY : t.clientX, f = o ? s.height : s.width, m = document.body, h = m.style.cursor, g = m.style.userSelect;
|
|
90
|
+
m.style.userSelect = "none", m.style.cursor = p(a), N.value = e;
|
|
91
|
+
let v = (e) => {
|
|
92
|
+
let t = _({
|
|
93
|
+
rtl: c,
|
|
94
|
+
size: f,
|
|
95
|
+
start: d,
|
|
96
|
+
orientation: a,
|
|
97
|
+
current: o ? e.clientY : e.clientX
|
|
98
|
+
});
|
|
99
|
+
Z(y({
|
|
100
|
+
delta: t,
|
|
101
|
+
handleIndex: r,
|
|
102
|
+
layout: l,
|
|
103
|
+
panels: u
|
|
104
|
+
}), l);
|
|
105
|
+
}, b = () => {
|
|
106
|
+
window.removeEventListener("pointermove", v), window.removeEventListener("pointerup", b), window.removeEventListener("pointercancel", b), m.style.cursor = h, m.style.userSelect = g, L = null, N.value = null;
|
|
107
|
+
};
|
|
108
|
+
window.addEventListener("pointermove", v), window.addEventListener("pointerup", b), window.addEventListener("pointercancel", b), L = b;
|
|
109
|
+
}
|
|
110
|
+
a(() => {
|
|
111
|
+
L?.();
|
|
112
|
+
});
|
|
113
|
+
function $(e, t) {
|
|
114
|
+
let n = Q(e);
|
|
115
|
+
if (n === null) return !1;
|
|
116
|
+
let r = K.value, i = r[n] ?? "", a = g({
|
|
117
|
+
key: t,
|
|
118
|
+
handleIndex: n,
|
|
119
|
+
layout: X(r),
|
|
120
|
+
rtl: E(A.value),
|
|
121
|
+
panels: Y(r),
|
|
122
|
+
orientation: U.value,
|
|
123
|
+
expandedSize: I[i],
|
|
124
|
+
step: z.value.keyboardStep
|
|
125
|
+
});
|
|
126
|
+
return a ? (Z(a), !0) : !1;
|
|
127
|
+
}
|
|
128
|
+
function se(e) {
|
|
129
|
+
let t = K.value, n = t.indexOf(e), r = Y(t), i = r[n];
|
|
130
|
+
if (n < 0 || !i?.collapsible) return;
|
|
131
|
+
let a = X(t);
|
|
132
|
+
v(i, a[n]) || Z(b({
|
|
133
|
+
index: n,
|
|
134
|
+
layout: a,
|
|
135
|
+
panels: r,
|
|
136
|
+
size: S(i).collapsedSize
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
function ce(e) {
|
|
140
|
+
let t = K.value, n = t.indexOf(e), r = Y(t), i = r[n], a = X(t);
|
|
141
|
+
if (n < 0 || !v(i, a[n])) return;
|
|
142
|
+
let { minSize: o } = S(i), s = I[e] ?? i?.defaultSize ?? 100 / Math.max(t.length, 1);
|
|
143
|
+
Z(b({
|
|
144
|
+
index: n,
|
|
145
|
+
layout: a,
|
|
146
|
+
panels: r,
|
|
147
|
+
size: Math.max(o, s)
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
function le(e) {
|
|
151
|
+
let t = Q(e);
|
|
152
|
+
if (t === null) return null;
|
|
153
|
+
let n = K.value, r = n[t] ?? "";
|
|
154
|
+
return {
|
|
155
|
+
index: t,
|
|
156
|
+
controls: P.get(r)?.().elementId,
|
|
157
|
+
aria: m(X(n), Y(n), t)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
let ue = i(() => ({
|
|
161
|
+
startDrag: oe,
|
|
162
|
+
expandPanel: ce,
|
|
163
|
+
id: k,
|
|
164
|
+
collapsePanel: se,
|
|
165
|
+
registerPanel: J,
|
|
166
|
+
resizeFromKey: $,
|
|
167
|
+
getHandleState: le,
|
|
168
|
+
registerHandle: ae,
|
|
169
|
+
layout: M.value,
|
|
170
|
+
orientation: U.value,
|
|
171
|
+
orientationItem: W.value,
|
|
172
|
+
draggingHandleId: N.value,
|
|
173
|
+
disabled: z.value.disabled === !0
|
|
174
|
+
}));
|
|
175
|
+
o(r, ue);
|
|
176
|
+
let de = i(() => e({}, R.value.inheritedAttrs, {
|
|
177
|
+
id: k,
|
|
178
|
+
"data-orientation": U.value,
|
|
179
|
+
"data-dragging": N.value ? "" : void 0,
|
|
180
|
+
class: ne({
|
|
181
|
+
[d(W.value, "root") ?? ""]: !0,
|
|
182
|
+
[d(V.value, "root") ?? ""]: !0
|
|
183
|
+
})
|
|
184
|
+
}));
|
|
185
|
+
return {
|
|
186
|
+
layout: M,
|
|
187
|
+
rootRef: A,
|
|
188
|
+
dragging: i(() => N.value !== null),
|
|
189
|
+
panelIds: K,
|
|
190
|
+
rootBind: de,
|
|
191
|
+
orientation: U
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { D as useResizable };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useResizable } from './composables/useResizable';
|
|
2
|
+
export type { ResizableClasses, ResizableEmits, ResizableOwnProps, ResizableProps, ResizableSlots, } from './resizable.types';
|
|
3
|
+
export { default as Resizable } from './Resizable.vue';
|
|
4
|
+
export { RESIZABLE_INJECTION_KEY, type ResizableContextValue, type ResizableHandleEntry, type ResizableHandleState, type ResizablePanelEntry, } from './resizableInjectionKey';
|