morya-ui 0.2.1 → 0.2.3
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/CHANGELOG.md +22 -0
- package/dist/Card-BQfmv5Iw.js +62 -0
- package/dist/card/index.js +2 -62
- package/dist/components/Layout/Layout.vue.d.ts +1 -0
- package/dist/components/Layout/Layout.vue.d.ts.map +1 -1
- package/dist/components/Layout/styles.css +4 -0
- package/dist/components/Layout/types.d.ts +2 -0
- package/dist/components/Layout/types.d.ts.map +1 -1
- package/dist/components/Menu/MenuCollapsedTooltip.vue.d.ts +27 -0
- package/dist/components/Menu/MenuCollapsedTooltip.vue.d.ts.map +1 -0
- package/dist/components/Menu/MenuNodes.vue.d.ts.map +1 -1
- package/dist/components/Menu/styles.css +25 -3
- package/dist/components/Page/PageContent.vue.d.ts +19 -0
- package/dist/components/Page/PageContent.vue.d.ts.map +1 -0
- package/dist/components/Page/PageFilters.vue.d.ts +16 -0
- package/dist/components/Page/PageFilters.vue.d.ts.map +1 -0
- package/dist/components/Page/PageHeader.vue.d.ts +22 -0
- package/dist/components/Page/PageHeader.vue.d.ts.map +1 -0
- package/dist/components/Page/PagePlaceholder.vue.d.ts +20 -0
- package/dist/components/Page/PagePlaceholder.vue.d.ts.map +1 -0
- package/dist/components/Page/PageSection.vue.d.ts +19 -0
- package/dist/components/Page/PageSection.vue.d.ts.map +1 -0
- package/dist/components/Page/PageStat.vue.d.ts +18 -0
- package/dist/components/Page/PageStat.vue.d.ts.map +1 -0
- package/dist/components/Page/PageToolbar.vue.d.ts +20 -0
- package/dist/components/Page/PageToolbar.vue.d.ts.map +1 -0
- package/dist/components/Page/index.d.ts +9 -0
- package/dist/components/Page/index.d.ts.map +1 -0
- package/dist/components/Page/styles.css +193 -0
- package/dist/components/Page/types.d.ts +54 -0
- package/dist/components/Page/types.d.ts.map +1 -0
- package/dist/config-provider/index.js +6 -6
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1041 -826
- package/dist/layout/index.js +6 -1
- package/dist/layout/style.css +4 -0
- package/dist/menu/index.js +231 -185
- package/dist/menu/style.css +77 -3
- package/dist/menu/style.js +1 -0
- package/dist/page/index.js +176 -0
- package/dist/page/style.css +1157 -0
- package/dist/page/style.js +5 -0
- package/dist/resolver-map.d.ts.map +1 -1
- package/dist/resolver.js +7 -0
- package/dist/styles.css +1 -1
- package/dist/table/index.js +4 -4
- package/dist/tree/index.js +1 -1
- package/package.json +8 -1
package/dist/menu/index.js
CHANGED
|
@@ -7,35 +7,36 @@ import { t as o } from "../icon-xUOyawgJ.js";
|
|
|
7
7
|
import { t as s } from "../key-CaQYVkjh.js";
|
|
8
8
|
import { t as c } from "../lastPointer-CRxcUqdd.js";
|
|
9
9
|
import { t as ee } from "../Popover-6eE5yIT7.js";
|
|
10
|
-
import {
|
|
10
|
+
import { t as l } from "../Tooltip-CrKm9FMD.js";
|
|
11
|
+
import { c as te } from "../config-CI8_WBbE.js";
|
|
11
12
|
import "./style.js";
|
|
12
|
-
import { Fragment as u, Teleport as
|
|
13
|
+
import { Fragment as u, Teleport as d, Transition as ne, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createVNode as _, defineComponent as v, getCurrentInstance as y, inject as b, mergeProps as x, nextTick as S, normalizeClass as C, normalizeStyle as w, onBeforeUnmount as T, openBlock as E, provide as D, reactive as O, ref as k, renderList as A, renderSlot as j, resolveDynamicComponent as M, toDisplayString as N, unref as P, useAttrs as re, useSlots as ie, watch as F, withCtx as I } from "vue";
|
|
13
14
|
//#region src/shared/menu/tree.ts
|
|
14
|
-
function
|
|
15
|
+
function L(e, t, n = "item") {
|
|
15
16
|
return s(e, t, n);
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function R(e, t, n = "item") {
|
|
18
19
|
for (let r = 0; r < e.length; r++) {
|
|
19
20
|
let i = e[r];
|
|
20
21
|
if (i.separator) continue;
|
|
21
|
-
let a =
|
|
22
|
+
let a = L(i, r, n);
|
|
22
23
|
if (a === t) return [];
|
|
23
24
|
if (i.items?.length) {
|
|
24
|
-
let e =
|
|
25
|
+
let e = R(i.items, t, `${n}-${r}`);
|
|
25
26
|
if (e !== null) return [a, ...e];
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
31
|
function ae(e, t, n, r = "item") {
|
|
31
|
-
return e.items?.length ?
|
|
32
|
+
return e.items?.length ? L(e, n, r) === t || R(e.items, t, `${r}-${n}`) !== null : !1;
|
|
32
33
|
}
|
|
33
34
|
function oe(e, t = "item") {
|
|
34
35
|
let n = [];
|
|
35
36
|
for (let r = 0; r < e.length; r++) {
|
|
36
37
|
let i = e[r];
|
|
37
38
|
if (i.separator || !i.items?.length) continue;
|
|
38
|
-
let a =
|
|
39
|
+
let a = L(i, r, t);
|
|
39
40
|
n.push(a), n.push(...oe(i.items, `${t}-${r}`));
|
|
40
41
|
}
|
|
41
42
|
return n;
|
|
@@ -44,76 +45,98 @@ function se(e, t = "item") {
|
|
|
44
45
|
let n = [];
|
|
45
46
|
for (let r = 0; r < e.length; r++) {
|
|
46
47
|
let i = e[r];
|
|
47
|
-
i.separator || !i.items?.length || n.push(
|
|
48
|
+
i.separator || !i.items?.length || n.push(L(i, r, t));
|
|
48
49
|
}
|
|
49
50
|
return n;
|
|
50
51
|
}
|
|
51
52
|
//#endregion
|
|
52
53
|
//#region src/components/Menu/context.ts
|
|
53
|
-
var ce = Symbol("muMenu")
|
|
54
|
+
var ce = Symbol("muMenu"), z = /* @__PURE__ */ v({
|
|
55
|
+
__name: "MenuCollapsedTooltip",
|
|
56
|
+
props: {
|
|
57
|
+
label: {},
|
|
58
|
+
active: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: !1
|
|
61
|
+
},
|
|
62
|
+
suspended: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: !1
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
setup(e) {
|
|
68
|
+
let t = e, n = f(() => t.active && !!t.label && !t.suspended);
|
|
69
|
+
return (t, r) => n.value ? (E(), p(l, {
|
|
70
|
+
key: 0,
|
|
71
|
+
content: e.label,
|
|
72
|
+
placement: "right",
|
|
73
|
+
"show-delay": 200,
|
|
74
|
+
"hide-delay": 0
|
|
75
|
+
}, {
|
|
76
|
+
default: I(() => [j(t.$slots, "default")]),
|
|
77
|
+
_: 3
|
|
78
|
+
}, 8, ["content"])) : j(t.$slots, "default", {}, void 0, void 0, 1);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
54
81
|
//#endregion
|
|
55
82
|
//#region src/shared/optionalRouter.ts
|
|
56
|
-
function
|
|
83
|
+
function B() {
|
|
57
84
|
let e = y();
|
|
58
85
|
if (!e) return !1;
|
|
59
86
|
for (let t of Object.values(e.appContext.provides)) if (t && typeof t == "object" && "resolve" in t && "push" in t) return !0;
|
|
60
87
|
return !1;
|
|
61
88
|
}
|
|
62
|
-
function
|
|
89
|
+
function le() {
|
|
63
90
|
let e = y();
|
|
64
|
-
return !e || !
|
|
91
|
+
return !e || !B() ? null : e.appContext.components.RouterLink ?? null;
|
|
65
92
|
}
|
|
66
|
-
function
|
|
93
|
+
function ue(e) {
|
|
67
94
|
return typeof e == "string" ? e : typeof e.path == "string" ? e.path : typeof e.href == "string" ? e.href : "#";
|
|
68
95
|
}
|
|
69
|
-
function
|
|
96
|
+
function V(e) {
|
|
70
97
|
return typeof e == "string" ? /^(?:[a-z][a-z\d+\-.]*:)?\/\//i.test(e) || e.startsWith("mailto:") || e.startsWith("tel:") : !1;
|
|
71
98
|
}
|
|
72
99
|
//#endregion
|
|
73
100
|
//#region src/components/Menu/MenuNodes.vue?vue&type=script&setup=true&lang.ts
|
|
74
|
-
var
|
|
101
|
+
var H = {
|
|
75
102
|
key: 0,
|
|
76
103
|
class: "m-menu__separator",
|
|
77
104
|
role: "separator"
|
|
78
|
-
},
|
|
105
|
+
}, U = [
|
|
79
106
|
"tabindex",
|
|
80
107
|
"data-m-menu-key",
|
|
81
108
|
"aria-label",
|
|
82
|
-
"aria-expanded"
|
|
83
|
-
|
|
84
|
-
], V = {
|
|
109
|
+
"aria-expanded"
|
|
110
|
+
], W = {
|
|
85
111
|
key: 0,
|
|
86
112
|
class: "m-menu__icon",
|
|
87
113
|
"aria-hidden": "true"
|
|
88
|
-
},
|
|
114
|
+
}, de = { class: "m-menu__label" }, fe = {
|
|
89
115
|
key: 1,
|
|
90
116
|
class: "m-menu__arrow",
|
|
91
117
|
"aria-hidden": "true"
|
|
92
|
-
},
|
|
118
|
+
}, G = {
|
|
93
119
|
class: "m-menu m-menu--flyout",
|
|
94
120
|
role: "menu"
|
|
95
|
-
},
|
|
121
|
+
}, pe = [
|
|
96
122
|
"tabindex",
|
|
97
123
|
"data-m-menu-key",
|
|
98
124
|
"aria-expanded",
|
|
99
125
|
"aria-disabled",
|
|
100
126
|
"onClick"
|
|
101
|
-
],
|
|
127
|
+
], K = {
|
|
102
128
|
key: 0,
|
|
103
129
|
class: "m-menu__icon",
|
|
104
130
|
"aria-hidden": "true"
|
|
105
|
-
},
|
|
106
|
-
class: "m-menu__arrow",
|
|
107
|
-
"aria-hidden": "true"
|
|
108
|
-
}, q = {
|
|
131
|
+
}, q = { class: "m-menu__label" }, J = {
|
|
109
132
|
key: 0,
|
|
110
133
|
class: "m-menu__submenu",
|
|
111
134
|
role: "group"
|
|
112
|
-
},
|
|
135
|
+
}, Y = { class: "m-menu__submenu-inner" }, me = {
|
|
113
136
|
key: 0,
|
|
114
137
|
class: "m-menu__icon",
|
|
115
138
|
"aria-hidden": "true"
|
|
116
|
-
},
|
|
139
|
+
}, he = { class: "m-menu__label" }, X = /* @__PURE__ */ v({
|
|
117
140
|
__name: "MenuNodes",
|
|
118
141
|
props: {
|
|
119
142
|
items: {},
|
|
@@ -124,94 +147,110 @@ var de = {
|
|
|
124
147
|
setup(e) {
|
|
125
148
|
let n = e, r = b(ce);
|
|
126
149
|
if (!r) throw Error("MenuNodes must be used inside MMenu");
|
|
127
|
-
let i = r, a =
|
|
150
|
+
let i = r, a = le(), s = f(() => i.collapsed.value && !n.flyout), c = f(() => i.mode === "horizontal"), l = f(() => (s.value || c.value) && !n.flyout);
|
|
128
151
|
function te(e, t) {
|
|
129
152
|
i.setFlyoutOpen(e, t);
|
|
130
153
|
}
|
|
131
|
-
function
|
|
154
|
+
function d(e, t) {
|
|
132
155
|
return i.resolveKey(e, t, n.prefix);
|
|
133
156
|
}
|
|
134
|
-
function
|
|
157
|
+
function v(e) {
|
|
135
158
|
return o(e.icon);
|
|
136
159
|
}
|
|
137
|
-
function
|
|
160
|
+
function y(e, t) {
|
|
138
161
|
if (e.disabled) {
|
|
139
162
|
t.preventDefault();
|
|
140
163
|
return;
|
|
141
164
|
}
|
|
142
165
|
i.activate(e), e.to || t.preventDefault();
|
|
143
166
|
}
|
|
144
|
-
function
|
|
145
|
-
e.disabled || l.value || i.toggleExpand(
|
|
167
|
+
function x(e, t) {
|
|
168
|
+
e.disabled || l.value || i.toggleExpand(d(e, t));
|
|
146
169
|
}
|
|
147
|
-
function
|
|
148
|
-
return i.isExpanded(
|
|
170
|
+
function S(e, t) {
|
|
171
|
+
return i.isExpanded(d(e, t));
|
|
149
172
|
}
|
|
150
|
-
function
|
|
151
|
-
let r =
|
|
173
|
+
function T(e, t) {
|
|
174
|
+
let r = v(e);
|
|
152
175
|
return {
|
|
153
176
|
"m-menu__item-content--selected": i.isSelected(e, t, n.prefix),
|
|
154
177
|
"m-menu__item-content--child-active": i.isChildActive(e, t, n.prefix),
|
|
155
178
|
"m-menu__item-content--disabled": !!e.disabled,
|
|
156
179
|
"m-menu__item-content--collapsed": s.value,
|
|
157
180
|
"m-menu__item-content--no-icon": !r,
|
|
158
|
-
"m-menu__item-content--active": i.activeKey.value ===
|
|
181
|
+
"m-menu__item-content--active": i.activeKey.value === d(e, t)
|
|
159
182
|
};
|
|
160
183
|
}
|
|
161
184
|
function D(e, t) {
|
|
162
|
-
return n.flyout ? 0 : i.tabindexForKey(
|
|
185
|
+
return n.flyout ? 0 : i.tabindexForKey(d(e, t));
|
|
163
186
|
}
|
|
164
187
|
function O(e) {
|
|
165
188
|
if (!(c.value || n.flyout)) return i.paddingStyle(e);
|
|
166
189
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
190
|
+
function k(e, t) {
|
|
191
|
+
return S(e, t);
|
|
169
192
|
}
|
|
170
|
-
function
|
|
171
|
-
return !!(e.to && a && !
|
|
193
|
+
function j(e) {
|
|
194
|
+
return !!(e.to && a && !V(e.to));
|
|
195
|
+
}
|
|
196
|
+
function re(e) {
|
|
197
|
+
if (!(!e.to || j(e))) return ue(e.to);
|
|
172
198
|
}
|
|
173
199
|
function ie(e) {
|
|
174
|
-
if (!(!e
|
|
200
|
+
if (!(!j(e) || !e.to)) return e.to;
|
|
201
|
+
}
|
|
202
|
+
function F(e) {
|
|
203
|
+
return s.value && !!e.label;
|
|
175
204
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
205
|
+
function L(e, t) {
|
|
206
|
+
return !!i.flyoutOpen[d(e, t)];
|
|
178
207
|
}
|
|
179
|
-
return (n, r) => (
|
|
208
|
+
return (n, r) => (E(!0), h(u, null, A(e.items, (n, r) => (E(), h(u, { key: d(n, r) }, [n.separator ? (E(), h("div", H)) : n.items?.length ? (E(), h("div", {
|
|
180
209
|
key: 1,
|
|
181
|
-
class:
|
|
210
|
+
class: C(["m-menu__item m-menu__item--submenu", { "m-menu__item--horizontal": c.value }]),
|
|
182
211
|
role: "none"
|
|
183
|
-
}, [l.value ? (
|
|
212
|
+
}, [l.value ? (E(), p(ee, {
|
|
184
213
|
key: 0,
|
|
185
214
|
class: "m-menu__collapsed-popover",
|
|
186
|
-
"model-value": !!
|
|
215
|
+
"model-value": !!P(i).flyoutOpen[d(n, r)],
|
|
187
216
|
trigger: c.value ? "click" : "hover",
|
|
188
217
|
placement: c.value ? "bottom-start" : "right-start",
|
|
189
218
|
"show-delay": c.value ? 0 : 50,
|
|
190
219
|
"hide-delay": c.value ? 0 : 80,
|
|
191
|
-
"onUpdate:modelValue": (e) => te(
|
|
220
|
+
"onUpdate:modelValue": (e) => te(d(n, r), e)
|
|
192
221
|
}, {
|
|
193
|
-
default:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
222
|
+
default: I(() => [_(z, {
|
|
223
|
+
label: n.label,
|
|
224
|
+
active: F(n),
|
|
225
|
+
suspended: L(n, r)
|
|
226
|
+
}, {
|
|
227
|
+
default: I(() => [g("div", {
|
|
228
|
+
class: C(["m-menu__item-content", T(n, r)]),
|
|
229
|
+
style: w(O(e.depth)),
|
|
230
|
+
role: "menuitem",
|
|
231
|
+
tabindex: D(n, r),
|
|
232
|
+
"data-m-menu-key": e.flyout ? void 0 : d(n, r),
|
|
233
|
+
"aria-label": n.label,
|
|
234
|
+
"aria-haspopup": "menu",
|
|
235
|
+
"aria-expanded": c.value ? !!P(i).flyoutOpen[d(n, r)] : void 0
|
|
236
|
+
}, [
|
|
237
|
+
v(n) ? (E(), h("span", W, [_(t, {
|
|
238
|
+
name: v(n),
|
|
239
|
+
size: "sm"
|
|
240
|
+
}, null, 8, ["name"])])) : m("", !0),
|
|
241
|
+
g("span", de, N(n.label), 1),
|
|
242
|
+
c.value ? (E(), h("span", fe, [_(t, {
|
|
243
|
+
name: "chevron-down",
|
|
244
|
+
size: "sm"
|
|
245
|
+
})])) : m("", !0)
|
|
246
|
+
], 14, U)]),
|
|
247
|
+
_: 2
|
|
248
|
+
}, 1032, [
|
|
249
|
+
"label",
|
|
250
|
+
"active",
|
|
251
|
+
"suspended"
|
|
252
|
+
])]),
|
|
253
|
+
content: I(() => [g("div", G, [_(X, {
|
|
215
254
|
items: n.items,
|
|
216
255
|
depth: 0,
|
|
217
256
|
prefix: `${e.prefix}-${r}`,
|
|
@@ -225,28 +264,31 @@ var de = {
|
|
|
225
264
|
"show-delay",
|
|
226
265
|
"hide-delay",
|
|
227
266
|
"onUpdate:modelValue"
|
|
228
|
-
])) : (
|
|
229
|
-
class:
|
|
230
|
-
style:
|
|
267
|
+
])) : (E(), h(u, { key: 1 }, [g("div", {
|
|
268
|
+
class: C(["m-menu__item-content", T(n, r)]),
|
|
269
|
+
style: w(O(e.depth)),
|
|
231
270
|
role: "menuitem",
|
|
232
271
|
tabindex: D(n, r),
|
|
233
|
-
"data-m-menu-key": e.flyout ? void 0 :
|
|
272
|
+
"data-m-menu-key": e.flyout ? void 0 : d(n, r),
|
|
234
273
|
"aria-haspopup": "menu",
|
|
235
|
-
"aria-expanded":
|
|
274
|
+
"aria-expanded": S(n, r),
|
|
236
275
|
"aria-disabled": n.disabled || void 0,
|
|
237
|
-
onClick: (e) =>
|
|
276
|
+
onClick: (e) => x(n, r)
|
|
238
277
|
}, [
|
|
239
|
-
|
|
240
|
-
name:
|
|
278
|
+
v(n) ? (E(), h("span", K, [_(t, {
|
|
279
|
+
name: v(n),
|
|
241
280
|
size: "sm"
|
|
242
281
|
}, null, 8, ["name"])])) : m("", !0),
|
|
243
|
-
g("span",
|
|
244
|
-
g("span",
|
|
245
|
-
|
|
282
|
+
g("span", q, N(n.label), 1),
|
|
283
|
+
g("span", {
|
|
284
|
+
class: C(["m-menu__arrow", { "m-menu__arrow--expanded": k(n, r) }]),
|
|
285
|
+
"aria-hidden": "true"
|
|
286
|
+
}, [_(t, {
|
|
287
|
+
name: "chevron-right",
|
|
246
288
|
size: "sm"
|
|
247
|
-
},
|
|
248
|
-
], 14,
|
|
249
|
-
default:
|
|
289
|
+
})], 2)
|
|
290
|
+
], 14, pe), _(ne, { name: "m-menu-expand" }, {
|
|
291
|
+
default: I(() => [S(n, r) ? (E(), h("div", J, [g("div", Y, [_(X, {
|
|
250
292
|
items: n.items,
|
|
251
293
|
depth: e.depth + 1,
|
|
252
294
|
prefix: `${e.prefix}-${r}`
|
|
@@ -254,44 +296,48 @@ var de = {
|
|
|
254
296
|
"items",
|
|
255
297
|
"depth",
|
|
256
298
|
"prefix"
|
|
257
|
-
])])) : m("", !0)]),
|
|
299
|
+
])])])) : m("", !0)]),
|
|
258
300
|
_: 2
|
|
259
|
-
}, 1024)], 64))], 2)) : (
|
|
301
|
+
}, 1024)], 64))], 2)) : (E(), h("div", {
|
|
260
302
|
key: 2,
|
|
261
|
-
class:
|
|
303
|
+
class: C(["m-menu__item", { "m-menu__item--horizontal": c.value }]),
|
|
262
304
|
role: "none"
|
|
263
|
-
}, [(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
role: "menuitem",
|
|
267
|
-
tabindex: D(n, r),
|
|
268
|
-
"data-m-menu-key": e.flyout ? void 0 : v(n, r),
|
|
269
|
-
"aria-disabled": n.disabled || void 0,
|
|
270
|
-
"aria-current": M(i).isSelected(n, r, e.prefix) ? "page" : void 0,
|
|
271
|
-
title: s.value ? n.label : void 0,
|
|
272
|
-
href: ie(n),
|
|
273
|
-
to: P(n),
|
|
274
|
-
onClick: (e) => x(n, e)
|
|
305
|
+
}, [_(z, {
|
|
306
|
+
label: n.label,
|
|
307
|
+
active: F(n)
|
|
275
308
|
}, {
|
|
276
|
-
default:
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
309
|
+
default: I(() => [(E(), p(M(j(n) ? P(a) : re(n) ? "a" : "div"), {
|
|
310
|
+
class: C(["m-menu__item-content", T(n, r)]),
|
|
311
|
+
style: w(O(e.depth)),
|
|
312
|
+
role: "menuitem",
|
|
313
|
+
tabindex: D(n, r),
|
|
314
|
+
"data-m-menu-key": e.flyout ? void 0 : d(n, r),
|
|
315
|
+
"aria-disabled": n.disabled || void 0,
|
|
316
|
+
"aria-current": P(i).isSelected(n, r, e.prefix) ? "page" : void 0,
|
|
317
|
+
href: re(n),
|
|
318
|
+
to: ie(n),
|
|
319
|
+
onClick: (e) => y(n, e)
|
|
320
|
+
}, {
|
|
321
|
+
default: I(() => [v(n) ? (E(), h("span", me, [_(t, {
|
|
322
|
+
name: v(n),
|
|
323
|
+
size: "sm"
|
|
324
|
+
}, null, 8, ["name"])])) : m("", !0), g("span", he, N(n.label), 1)]),
|
|
325
|
+
_: 2
|
|
326
|
+
}, 1032, [
|
|
327
|
+
"class",
|
|
328
|
+
"style",
|
|
329
|
+
"tabindex",
|
|
330
|
+
"data-m-menu-key",
|
|
331
|
+
"aria-disabled",
|
|
332
|
+
"aria-current",
|
|
333
|
+
"href",
|
|
334
|
+
"to",
|
|
335
|
+
"onClick"
|
|
336
|
+
]))]),
|
|
280
337
|
_: 2
|
|
281
|
-
}, 1032, [
|
|
282
|
-
"class",
|
|
283
|
-
"style",
|
|
284
|
-
"tabindex",
|
|
285
|
-
"data-m-menu-key",
|
|
286
|
-
"aria-disabled",
|
|
287
|
-
"aria-current",
|
|
288
|
-
"title",
|
|
289
|
-
"href",
|
|
290
|
-
"to",
|
|
291
|
-
"onClick"
|
|
292
|
-
]))], 2))], 64))), 128));
|
|
338
|
+
}, 1032, ["label", "active"])], 2))], 64))), 128));
|
|
293
339
|
}
|
|
294
|
-
}),
|
|
340
|
+
}), ge = /* @__PURE__ */ v({
|
|
295
341
|
inheritAttrs: !1,
|
|
296
342
|
__name: "Menu",
|
|
297
343
|
props: {
|
|
@@ -346,14 +392,14 @@ var de = {
|
|
|
346
392
|
"select"
|
|
347
393
|
],
|
|
348
394
|
setup(t, { emit: o }) {
|
|
349
|
-
let s = t, ee =
|
|
350
|
-
function
|
|
351
|
-
|
|
395
|
+
let s = t, ee = re(), { rootAttrs: l } = e(ee, () => s.pt), u = o, v = ie(), y = te(), b = k(null), A = k(null), M = k({}), N = f(() => !!v.default?.()?.length), z = f(() => n(s.popup ? s : { teleport: !1 }, y.value.appendTo)), B = f(() => s.popup && r(s, y.value.appendTo)), le = f(() => s.embedded ?? !s.popup), ue = f(() => s.selectedKey), V = k([]), H = O({});
|
|
396
|
+
function U(e, t) {
|
|
397
|
+
H[e] = t;
|
|
352
398
|
}
|
|
353
|
-
function
|
|
354
|
-
for (let e of Object.keys(
|
|
399
|
+
function W() {
|
|
400
|
+
for (let e of Object.keys(H)) H[e] = !1;
|
|
355
401
|
}
|
|
356
|
-
function
|
|
402
|
+
function de() {
|
|
357
403
|
let e = A.value?.getBoundingClientRect();
|
|
358
404
|
if (e && (e.width > 0 || e.height > 0)) return e;
|
|
359
405
|
let { x: t, y: n } = c();
|
|
@@ -366,33 +412,33 @@ var de = {
|
|
|
366
412
|
height: 0
|
|
367
413
|
};
|
|
368
414
|
}
|
|
369
|
-
function
|
|
370
|
-
!s.popup || !s.modelValue || !
|
|
415
|
+
function fe() {
|
|
416
|
+
!s.popup || !s.modelValue || !B.value || (M.value = i(de(), s.placement, { minWidth: "10rem" }));
|
|
371
417
|
}
|
|
372
418
|
function G() {
|
|
373
|
-
s.modelValue &&
|
|
419
|
+
s.modelValue && fe();
|
|
374
420
|
}
|
|
375
421
|
function pe() {
|
|
376
422
|
if (s.defaultExpandAll) {
|
|
377
|
-
|
|
423
|
+
V.value = oe(s.model);
|
|
378
424
|
return;
|
|
379
425
|
}
|
|
380
426
|
if (s.defaultExpandedKeys.length) {
|
|
381
|
-
|
|
427
|
+
V.value = [...s.defaultExpandedKeys];
|
|
382
428
|
return;
|
|
383
429
|
}
|
|
384
430
|
if (s.selectedKey) {
|
|
385
|
-
let e =
|
|
386
|
-
|
|
431
|
+
let e = R(s.model, s.selectedKey);
|
|
432
|
+
V.value = e ?? [];
|
|
387
433
|
return;
|
|
388
434
|
}
|
|
389
|
-
|
|
435
|
+
V.value = [];
|
|
390
436
|
}
|
|
391
437
|
pe();
|
|
392
438
|
let K = f({
|
|
393
|
-
get: () => s.expandedKeys ??
|
|
439
|
+
get: () => s.expandedKeys ?? V.value,
|
|
394
440
|
set: (e) => {
|
|
395
|
-
|
|
441
|
+
V.value = e, u("update:expandedKeys", e);
|
|
396
442
|
}
|
|
397
443
|
}), q = f(() => se(s.model));
|
|
398
444
|
function J(e) {
|
|
@@ -414,15 +460,15 @@ var de = {
|
|
|
414
460
|
}
|
|
415
461
|
function me(e) {
|
|
416
462
|
if (!e) return;
|
|
417
|
-
let t =
|
|
463
|
+
let t = R(s.model, e);
|
|
418
464
|
if (!t?.length) return;
|
|
419
465
|
let n = /* @__PURE__ */ new Set([...K.value, ...t]);
|
|
420
466
|
if (s.accordion) for (let e of q.value) n.has(e) && !t.includes(e) && n.delete(e);
|
|
421
467
|
K.value = Array.from(n);
|
|
422
468
|
}
|
|
423
|
-
|
|
469
|
+
F(() => s.selectedKey, me);
|
|
424
470
|
function he(e, t, n) {
|
|
425
|
-
return
|
|
471
|
+
return L(e, t, n);
|
|
426
472
|
}
|
|
427
473
|
function ge(e, t, n) {
|
|
428
474
|
let r = he(e, t, n);
|
|
@@ -446,7 +492,7 @@ var de = {
|
|
|
446
492
|
if (e.disabled || e.separator) return;
|
|
447
493
|
e.command?.();
|
|
448
494
|
let t = e.key ?? e.label ?? null;
|
|
449
|
-
|
|
495
|
+
u("update:selectedKey", t), u("select", e), s.popup && (u("update:modelValue", !1), xe()), s.mode === "horizontal" && W();
|
|
450
496
|
}
|
|
451
497
|
function xe() {
|
|
452
498
|
(A.value?.querySelector("button, [tabindex]") ?? A.value)?.focus({ preventScroll: !0 });
|
|
@@ -455,7 +501,7 @@ var de = {
|
|
|
455
501
|
let e = s.collapsed || s.mode === "horizontal", t = [], n = (r, i, a) => {
|
|
456
502
|
r.forEach((r, o) => {
|
|
457
503
|
if (r.separator) return;
|
|
458
|
-
let s =
|
|
504
|
+
let s = L(r, o, i), c = !!r.items?.length;
|
|
459
505
|
t.push({
|
|
460
506
|
item: r,
|
|
461
507
|
key: s,
|
|
@@ -474,8 +520,8 @@ var de = {
|
|
|
474
520
|
if (t) {
|
|
475
521
|
if (t.hasChildren) {
|
|
476
522
|
if (s.collapsed || s.mode === "horizontal") {
|
|
477
|
-
let e = !
|
|
478
|
-
|
|
523
|
+
let e = !H[t.key];
|
|
524
|
+
W(), U(t.key, e);
|
|
479
525
|
} else Y(t.key);
|
|
480
526
|
return;
|
|
481
527
|
}
|
|
@@ -483,7 +529,7 @@ var de = {
|
|
|
483
529
|
}
|
|
484
530
|
},
|
|
485
531
|
onEscape: () => {
|
|
486
|
-
s.popup ?
|
|
532
|
+
s.popup ? u("update:modelValue", !1) : W();
|
|
487
533
|
},
|
|
488
534
|
returnFocusTo: () => s.popup ? A.value?.querySelector("button, [tabindex]") ?? A.value : null
|
|
489
535
|
}), Se = f(() => Z.value[Q.activeIndex.value]?.key ?? null);
|
|
@@ -492,8 +538,8 @@ var de = {
|
|
|
492
538
|
return t == null ? Z.value.find((e) => !e.item.disabled)?.key === e ? 0 : -1 : e === t ? 0 : -1;
|
|
493
539
|
}
|
|
494
540
|
function we(e) {
|
|
495
|
-
if (e == null || !
|
|
496
|
-
let t =
|
|
541
|
+
if (e == null || !b.value) return;
|
|
542
|
+
let t = b.value.querySelectorAll("[data-m-menu-key]");
|
|
497
543
|
for (let n of t) if (n.dataset.mMenuKey === e) {
|
|
498
544
|
n.focus({ preventScroll: !0 });
|
|
499
545
|
return;
|
|
@@ -523,24 +569,24 @@ var de = {
|
|
|
523
569
|
return;
|
|
524
570
|
}
|
|
525
571
|
} else if (e.key === "ArrowDown") {
|
|
526
|
-
e.preventDefault(), t?.hasChildren && (
|
|
572
|
+
e.preventDefault(), t?.hasChildren && (W(), U(t.key, !0));
|
|
527
573
|
return;
|
|
528
574
|
}
|
|
529
575
|
Q.onKeydown(e);
|
|
530
576
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}),
|
|
577
|
+
F(Q.activeIndex, () => {
|
|
578
|
+
S(() => we(Se.value));
|
|
579
|
+
}), D(ce, {
|
|
534
580
|
collapsed: f(() => s.collapsed),
|
|
535
|
-
selectedKey:
|
|
581
|
+
selectedKey: ue,
|
|
536
582
|
expandedKeys: K,
|
|
537
583
|
accordion: s.accordion,
|
|
538
584
|
indent: s.indent,
|
|
539
585
|
rootIndent: s.rootIndent,
|
|
540
586
|
mode: s.mode,
|
|
541
587
|
inverted: s.inverted,
|
|
542
|
-
flyoutOpen:
|
|
543
|
-
setFlyoutOpen:
|
|
588
|
+
flyoutOpen: H,
|
|
589
|
+
setFlyoutOpen: U,
|
|
544
590
|
toggleExpand: Y,
|
|
545
591
|
isExpanded: J,
|
|
546
592
|
activate: be,
|
|
@@ -554,41 +600,41 @@ var de = {
|
|
|
554
600
|
function Ee(e) {
|
|
555
601
|
if (!s.popup || !s.modelValue) return;
|
|
556
602
|
let t = e.target;
|
|
557
|
-
|
|
603
|
+
b.value?.contains(t) || A.value?.contains(t) || u("update:modelValue", !1);
|
|
558
604
|
}
|
|
559
|
-
|
|
560
|
-
s.popup && (e ? (
|
|
561
|
-
}, { immediate: !0 }),
|
|
605
|
+
F(() => s.modelValue, (e) => {
|
|
606
|
+
s.popup && (e ? (S(fe), document.addEventListener("click", Ee), B.value && (window.addEventListener("resize", G), window.addEventListener("scroll", G, !0))) : (document.removeEventListener("click", Ee), window.removeEventListener("resize", G), window.removeEventListener("scroll", G, !0)));
|
|
607
|
+
}, { immediate: !0 }), T(() => {
|
|
562
608
|
document.removeEventListener("click", Ee), window.removeEventListener("resize", G), window.removeEventListener("scroll", G, !0);
|
|
563
609
|
});
|
|
564
610
|
let De = f(() => ["m-menu", {
|
|
565
611
|
"m-menu--popup": s.popup,
|
|
566
|
-
"m-menu--teleported":
|
|
612
|
+
"m-menu--teleported": B.value,
|
|
567
613
|
"m-menu--collapsed": s.collapsed,
|
|
568
|
-
"m-menu--embedded":
|
|
614
|
+
"m-menu--embedded": le.value,
|
|
569
615
|
"m-menu--horizontal": s.mode === "horizontal",
|
|
570
616
|
"m-menu--inverted": s.inverted
|
|
571
617
|
}]), $ = f(() => ({
|
|
572
618
|
"--m-menu-indent": `${s.indent / 16}rem`,
|
|
573
619
|
"--m-menu-root-indent": `${s.rootIndent / 16}rem`
|
|
574
|
-
})), Oe = f(() =>
|
|
620
|
+
})), Oe = f(() => B.value ? {
|
|
575
621
|
...$.value,
|
|
576
|
-
...
|
|
622
|
+
...M.value
|
|
577
623
|
} : $.value);
|
|
578
|
-
return (e, n) => t.popup ?
|
|
624
|
+
return (e, n) => t.popup ? N.value ? (E(), h("div", x({ key: 1 }, P(l), { class: "m-menu-popup" }), [g("div", {
|
|
579
625
|
ref_key: "triggerEl",
|
|
580
626
|
ref: A,
|
|
581
627
|
class: "m-menu-popup__anchor"
|
|
582
|
-
}, [
|
|
583
|
-
to:
|
|
584
|
-
disabled:
|
|
585
|
-
}, [_(
|
|
586
|
-
default:
|
|
628
|
+
}, [j(e.$slots, "default")], 512), (E(), p(d, {
|
|
629
|
+
to: z.value.to,
|
|
630
|
+
disabled: z.value.disabled
|
|
631
|
+
}, [_(ne, { name: "m-scale-fade" }, {
|
|
632
|
+
default: I(() => [t.modelValue ? (E(), h("div", {
|
|
587
633
|
key: 0,
|
|
588
634
|
ref_key: "root",
|
|
589
|
-
ref:
|
|
590
|
-
class:
|
|
591
|
-
style:
|
|
635
|
+
ref: b,
|
|
636
|
+
class: C(De.value),
|
|
637
|
+
style: w(B.value ? Oe.value : $.value),
|
|
592
638
|
role: "menu",
|
|
593
639
|
onKeydown: Te
|
|
594
640
|
}, [_(X, {
|
|
@@ -597,20 +643,20 @@ var de = {
|
|
|
597
643
|
prefix: "item"
|
|
598
644
|
}, null, 8, ["items"])], 38)) : m("", !0)]),
|
|
599
645
|
_: 1
|
|
600
|
-
})], 8, ["to", "disabled"]))], 16)) : (
|
|
646
|
+
})], 8, ["to", "disabled"]))], 16)) : (E(), p(d, {
|
|
601
647
|
key: 2,
|
|
602
|
-
to:
|
|
603
|
-
disabled:
|
|
604
|
-
}, [_(
|
|
605
|
-
default:
|
|
648
|
+
to: z.value.to,
|
|
649
|
+
disabled: z.value.disabled
|
|
650
|
+
}, [_(ne, { name: "m-scale-fade" }, {
|
|
651
|
+
default: I(() => [t.modelValue ? (E(), h("div", x({
|
|
606
652
|
key: 0,
|
|
607
653
|
ref_key: "root",
|
|
608
|
-
ref:
|
|
609
|
-
},
|
|
654
|
+
ref: b
|
|
655
|
+
}, P(l), {
|
|
610
656
|
class: De.value,
|
|
611
|
-
style:
|
|
657
|
+
style: B.value ? {
|
|
612
658
|
...$.value,
|
|
613
|
-
...
|
|
659
|
+
...M.value
|
|
614
660
|
} : $.value,
|
|
615
661
|
role: "menu",
|
|
616
662
|
onKeydown: Te
|
|
@@ -620,11 +666,11 @@ var de = {
|
|
|
620
666
|
prefix: "item"
|
|
621
667
|
}, null, 8, ["items"])], 16)) : m("", !0)]),
|
|
622
668
|
_: 1
|
|
623
|
-
})], 8, ["to", "disabled"])) : (
|
|
669
|
+
})], 8, ["to", "disabled"])) : (E(), h("div", x({
|
|
624
670
|
key: 0,
|
|
625
671
|
ref_key: "root",
|
|
626
|
-
ref:
|
|
627
|
-
},
|
|
672
|
+
ref: b
|
|
673
|
+
}, P(l), {
|
|
628
674
|
class: De.value,
|
|
629
675
|
style: $.value,
|
|
630
676
|
role: "menu",
|
|
@@ -637,4 +683,4 @@ var de = {
|
|
|
637
683
|
}
|
|
638
684
|
});
|
|
639
685
|
//#endregion
|
|
640
|
-
export {
|
|
686
|
+
export { ge as MMenu };
|