@mlightcad/ribbon 0.0.1 → 0.0.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/README.md +41 -3
- package/dist/components/Ribbon.vue.d.ts +102 -0
- package/dist/components/RibbonCollection.vue.d.ts +41 -0
- package/dist/components/RibbonGroup.vue.d.ts +77 -0
- package/dist/components/RibbonGroupContent.vue.d.ts +39 -0
- package/dist/components/RibbonItemHost.vue.d.ts +52 -0
- package/dist/components/RibbonTab.vue.d.ts +47 -0
- package/dist/components/RibbonTabs.vue.d.ts +34 -0
- package/dist/composables/useRibbonState.d.ts +17 -0
- package/dist/context.d.ts +3 -0
- package/{src/ribbon/index.ts → dist/index.d.ts} +15 -43
- package/dist/items/RibbonGallery.vue.d.ts +48 -0
- package/dist/items/RibbonGroupButton.vue.d.ts +49 -0
- package/dist/items/RibbonTemplateItem.vue.d.ts +40 -0
- package/dist/ml-ribbon.css +2 -0
- package/dist/ml-ribbon.es.js +1490 -0
- package/dist/ml-ribbon.umd.js +1 -0
- package/dist/modules/RibbonBackstage.vue.d.ts +61 -0
- package/dist/modules/RibbonContextualTabs.vue.d.ts +41 -0
- package/dist/modules/RibbonFileMenu.vue.d.ts +44 -0
- package/dist/modules/RibbonKeyTips.vue.d.ts +39 -0
- package/dist/types.d.ts +130 -0
- package/package.json +26 -2
- package/.github/workflows/ci.yml +0 -110
- package/.vscode/extensions.json +0 -3
- package/AGENTS.md +0 -42
- package/docs/requirements.md +0 -96
- package/eslint.config.js +0 -41
- package/images/ribbon.jpg +0 -0
- package/index.html +0 -13
- package/playwright/ribbon.spec.ts +0 -6
- package/playwright.config.ts +0 -10
- package/public/favicon.svg +0 -1
- package/public/icons.svg +0 -24
- package/src/App.vue +0 -418
- package/src/assets/hero.png +0 -0
- package/src/assets/vite.svg +0 -1
- package/src/assets/vue.svg +0 -1
- package/src/components/HelloWorld.vue +0 -106
- package/src/main.ts +0 -9
- package/src/ribbon/components/Ribbon.vue +0 -844
- package/src/ribbon/components/RibbonCollection.vue +0 -51
- package/src/ribbon/components/RibbonGroup.vue +0 -327
- package/src/ribbon/components/RibbonGroupContent.vue +0 -61
- package/src/ribbon/components/RibbonItemHost.vue +0 -221
- package/src/ribbon/components/RibbonTab.vue +0 -44
- package/src/ribbon/components/RibbonTabs.vue +0 -49
- package/src/ribbon/composables/useRibbonState.ts +0 -272
- package/src/ribbon/context.ts +0 -4
- package/src/ribbon/items/RibbonGallery.vue +0 -78
- package/src/ribbon/items/RibbonGroupButton.vue +0 -85
- package/src/ribbon/items/RibbonTemplateItem.vue +0 -38
- package/src/ribbon/modules/RibbonBackstage.vue +0 -69
- package/src/ribbon/modules/RibbonContextualTabs.vue +0 -65
- package/src/ribbon/modules/RibbonFileMenu.vue +0 -88
- package/src/ribbon/modules/RibbonKeyTips.vue +0 -114
- package/src/ribbon/styles/ribbon.css +0 -925
- package/src/ribbon/types.ts +0 -162
- package/src/style.css +0 -328
- package/src/tests/ribbon.spec.ts +0 -830
- package/src/tests/setup.ts +0 -4
- package/tools/release.mjs +0 -107
- package/tsconfig.app.json +0 -14
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -24
- package/vite.config.ts +0 -38
|
@@ -0,0 +1,1490 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createSlots as o, createTextVNode as s, createVNode as c, defineComponent as l, inject as u, markRaw as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onMounted as h, onUnmounted as g, openBlock as _, provide as v, ref as y, renderList as b, renderSlot as x, resolveDynamicComponent as S, toDisplayString as C, toRaw as w, unref as T, watch as E, withCtx as D, withModifiers as O } from "vue";
|
|
2
|
+
import { ElButton as k, ElButtonGroup as A, ElCheckbox as ee, ElColorPicker as te, ElConfigProvider as ne, ElDrawer as j, ElDropdown as M, ElDropdownItem as N, ElDropdownMenu as P, ElIcon as F, ElOption as I, ElPopover as re, ElSelect as L, ElSwitch as ie, ElTooltip as R, useGlobalConfig as ae } from "element-plus";
|
|
3
|
+
import { ArrowDown as z, ArrowDownBold as oe, ArrowUp as B, ArrowUpBold as V, Grid as se, Menu as H, Promotion as U } from "@element-plus/icons-vue";
|
|
4
|
+
//#region src/ribbon/context.ts
|
|
5
|
+
var ce = Symbol("RibbonContext");
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/ribbon/composables/useRibbonState.ts
|
|
8
|
+
function W(e) {
|
|
9
|
+
return e == null || typeof e == "string" ? e : typeof e == "object" || typeof e == "function" ? d(w(e)) : e;
|
|
10
|
+
}
|
|
11
|
+
function G(e) {
|
|
12
|
+
if (!e) return;
|
|
13
|
+
let t = { ...e };
|
|
14
|
+
return "icon" in t && (t.icon = W(t.icon)), Array.isArray(t.options) && (t.options = t.options.map((e) => {
|
|
15
|
+
if (!e || typeof e != "object") return e;
|
|
16
|
+
let t = e;
|
|
17
|
+
return "icon" in t ? {
|
|
18
|
+
...t,
|
|
19
|
+
icon: W(t.icon)
|
|
20
|
+
} : t;
|
|
21
|
+
})), t;
|
|
22
|
+
}
|
|
23
|
+
function K(e) {
|
|
24
|
+
return {
|
|
25
|
+
...e,
|
|
26
|
+
icon: W(e.icon),
|
|
27
|
+
props: G(e.props)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function q(e) {
|
|
31
|
+
return {
|
|
32
|
+
...e,
|
|
33
|
+
icon: W(e.icon),
|
|
34
|
+
footerMenuItems: e.footerMenuItems?.map(K),
|
|
35
|
+
collections: e.collections?.map((e) => ({
|
|
36
|
+
...e,
|
|
37
|
+
items: e.items.map(K)
|
|
38
|
+
}))
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function J(e) {
|
|
42
|
+
return {
|
|
43
|
+
...e,
|
|
44
|
+
groups: e.groups?.map(q)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function Y(e) {
|
|
48
|
+
return e.map(J);
|
|
49
|
+
}
|
|
50
|
+
function le(e) {
|
|
51
|
+
(!e.collections || e.collections.length === 0) && (e.collections = [{
|
|
52
|
+
id: `${e.id}-collection-1`,
|
|
53
|
+
items: []
|
|
54
|
+
}]);
|
|
55
|
+
}
|
|
56
|
+
function X(e, t, n, r, i) {
|
|
57
|
+
let a = e.find((e) => e.id === t);
|
|
58
|
+
if (!a?.groups) return;
|
|
59
|
+
let o = a.groups.find((e) => e.id === n);
|
|
60
|
+
if (!o?.collections) return;
|
|
61
|
+
let s = o.collections.find((e) => e.id === r);
|
|
62
|
+
s && i(s.items);
|
|
63
|
+
}
|
|
64
|
+
function ue(e, n, r, i, a) {
|
|
65
|
+
let o = y(r), s = y(i), c = y(a), l = y(Y(n)), u = y(!1), d = y(!1), f = y(!1), p = y([]), m = y(""), h = t(() => l.value.filter((e) => e.visible !== !1)), g = {
|
|
66
|
+
addTab(e) {
|
|
67
|
+
l.value.push(J(e)), c.value ||= e.id;
|
|
68
|
+
},
|
|
69
|
+
removeTab(e) {
|
|
70
|
+
l.value = l.value.filter((t) => t.id !== e), c.value === e && (c.value = h.value[0]?.id ?? "");
|
|
71
|
+
},
|
|
72
|
+
showTab(e) {
|
|
73
|
+
let t = l.value.find((t) => t.id === e);
|
|
74
|
+
t && (t.visible = !0);
|
|
75
|
+
},
|
|
76
|
+
hideTab(e) {
|
|
77
|
+
let t = l.value.find((t) => t.id === e);
|
|
78
|
+
t && (t.visible = !1);
|
|
79
|
+
},
|
|
80
|
+
selectTab(e) {
|
|
81
|
+
c.value = e;
|
|
82
|
+
},
|
|
83
|
+
addGroup(e, t) {
|
|
84
|
+
let n = l.value.find((t) => t.id === e);
|
|
85
|
+
n && (n.groups ??= [], le(t), n.groups.push(q(t)));
|
|
86
|
+
},
|
|
87
|
+
removeGroup(e, t) {
|
|
88
|
+
let n = l.value.find((t) => t.id === e);
|
|
89
|
+
n?.groups && (n.groups = n.groups.filter((e) => e.id !== t));
|
|
90
|
+
},
|
|
91
|
+
showGroup(e, t) {
|
|
92
|
+
let n = l.value.find((t) => t.id === e)?.groups?.find((e) => e.id === t);
|
|
93
|
+
n && (n.visible = !0);
|
|
94
|
+
},
|
|
95
|
+
hideGroup(e, t) {
|
|
96
|
+
let n = l.value.find((t) => t.id === e)?.groups?.find((e) => e.id === t);
|
|
97
|
+
n && (n.visible = !1);
|
|
98
|
+
},
|
|
99
|
+
addItem(e, t, n, r) {
|
|
100
|
+
X(l.value, e, t, n, (e) => e.push(K(r)));
|
|
101
|
+
},
|
|
102
|
+
removeItem(e, t, n, r) {
|
|
103
|
+
X(l.value, e, t, n, (e) => {
|
|
104
|
+
let t = e.findIndex((e) => e.id === r);
|
|
105
|
+
t >= 0 && e.splice(t, 1);
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
updateItem(e, t, n, r, i) {
|
|
109
|
+
X(l.value, e, t, n, (e) => {
|
|
110
|
+
let t = e.find((e) => e.id === r);
|
|
111
|
+
t && Object.assign(t, i);
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
enableItem(e, t, n, r) {
|
|
115
|
+
g.updateItem(e, t, n, r, { disabled: !1 });
|
|
116
|
+
},
|
|
117
|
+
disableItem(e, t, n, r) {
|
|
118
|
+
g.updateItem(e, t, n, r, { disabled: !0 });
|
|
119
|
+
},
|
|
120
|
+
refreshLayout() {
|
|
121
|
+
u.value = !1;
|
|
122
|
+
},
|
|
123
|
+
minimize(e) {
|
|
124
|
+
s.value = e;
|
|
125
|
+
},
|
|
126
|
+
toggleSimplified() {
|
|
127
|
+
o.value = o.value === "classic" ? "simplified" : "classic";
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
context: {
|
|
132
|
+
id: e,
|
|
133
|
+
layout: o,
|
|
134
|
+
minimized: s,
|
|
135
|
+
activeTab: c,
|
|
136
|
+
tabs: l,
|
|
137
|
+
overflowOpen: u,
|
|
138
|
+
backdropOpen: d,
|
|
139
|
+
keyTipsOpen: f,
|
|
140
|
+
keyTips: p,
|
|
141
|
+
keyTipsSequence: m,
|
|
142
|
+
registerKeyTip: (e) => {
|
|
143
|
+
p.value.some((t) => t.id === e.id) || p.value.push(e);
|
|
144
|
+
},
|
|
145
|
+
unregisterKeyTip: (e) => {
|
|
146
|
+
p.value = p.value.filter((t) => t.id !== e);
|
|
147
|
+
},
|
|
148
|
+
api: g
|
|
149
|
+
},
|
|
150
|
+
visibleTabs: h
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/ribbon/modules/RibbonBackstage.vue?vue&type=script&setup=true&lang.ts
|
|
155
|
+
var Z = { class: "ml-ribbon-backstage__nav" }, de = { class: "ml-ribbon-backstage__content" }, fe = { key: 0 }, pe = { key: 1 }, me = /* @__PURE__ */ l({
|
|
156
|
+
__name: "RibbonBackstage",
|
|
157
|
+
props: {
|
|
158
|
+
open: { type: Boolean },
|
|
159
|
+
backLabel: {},
|
|
160
|
+
title: {},
|
|
161
|
+
description: {},
|
|
162
|
+
size: { default: "default" }
|
|
163
|
+
},
|
|
164
|
+
emits: ["close"],
|
|
165
|
+
setup(t, { emit: o }) {
|
|
166
|
+
let l = t, u = o;
|
|
167
|
+
function d() {
|
|
168
|
+
u("close");
|
|
169
|
+
}
|
|
170
|
+
return (t, o) => (_(), n(T(j), {
|
|
171
|
+
"model-value": l.open,
|
|
172
|
+
size: "100%",
|
|
173
|
+
"with-header": !1,
|
|
174
|
+
direction: "ltr",
|
|
175
|
+
onClose: d
|
|
176
|
+
}, {
|
|
177
|
+
default: D(() => [a("div", { class: p(["ml-ribbon-backstage", `ml-ribbon-backstage--size-${l.size || "default"}`]) }, [t.$slots.default ? x(t.$slots, "default", {
|
|
178
|
+
key: 0,
|
|
179
|
+
close: d,
|
|
180
|
+
backLabel: l.backLabel,
|
|
181
|
+
title: l.title,
|
|
182
|
+
description: l.description,
|
|
183
|
+
size: l.size
|
|
184
|
+
}) : (_(), i(e, { key: 1 }, [a("aside", Z, [c(T(k), {
|
|
185
|
+
type: "primary",
|
|
186
|
+
onClick: d
|
|
187
|
+
}, {
|
|
188
|
+
default: D(() => [s(C(l.backLabel), 1)]),
|
|
189
|
+
_: 1
|
|
190
|
+
})]), a("section", de, [l.title ? (_(), i("h2", fe, C(l.title), 1)) : r("", !0), l.description ? (_(), i("p", pe, C(l.description), 1)) : r("", !0)])], 64))], 2)]),
|
|
191
|
+
_: 3
|
|
192
|
+
}, 8, ["model-value"]));
|
|
193
|
+
}
|
|
194
|
+
}), he = {
|
|
195
|
+
class: "ml-ribbon-tabs",
|
|
196
|
+
role: "tablist"
|
|
197
|
+
}, ge = ["aria-selected", "onClick"], _e = /* @__PURE__ */ l({
|
|
198
|
+
__name: "RibbonTabs",
|
|
199
|
+
props: {
|
|
200
|
+
tabs: {},
|
|
201
|
+
activeTab: {}
|
|
202
|
+
},
|
|
203
|
+
emits: ["select"],
|
|
204
|
+
setup(n, { emit: r }) {
|
|
205
|
+
let a = n, o = r, s = t(() => a.tabs.filter((e) => e.visible !== !1));
|
|
206
|
+
return (t, r) => (_(), i("div", he, [(_(!0), i(e, null, b(s.value, (e) => (_(), i("button", {
|
|
207
|
+
key: e.id,
|
|
208
|
+
type: "button",
|
|
209
|
+
class: p(["ml-ribbon-tab", { "is-active": n.activeTab === e.id }]),
|
|
210
|
+
role: "tab",
|
|
211
|
+
"aria-selected": n.activeTab === e.id,
|
|
212
|
+
onClick: (t) => o("select", e.id)
|
|
213
|
+
}, C(e.title), 11, ge))), 128))]));
|
|
214
|
+
}
|
|
215
|
+
}), ve = { class: "ml-ribbon-contextual-tabs" }, ye = { class: "ml-ribbon-contextual-tabs__normal" }, be = { class: "ml-ribbon-contextual-tabs__ctx" }, xe = /* @__PURE__ */ l({
|
|
216
|
+
__name: "RibbonContextualTabs",
|
|
217
|
+
props: {
|
|
218
|
+
tabs: {},
|
|
219
|
+
activeTab: {},
|
|
220
|
+
defaultContextualTitle: {}
|
|
221
|
+
},
|
|
222
|
+
emits: ["select"],
|
|
223
|
+
setup(t, { emit: n }) {
|
|
224
|
+
let r = t, o = n;
|
|
225
|
+
return (n, s) => (_(), i("div", ve, [a("div", ye, [c(_e, {
|
|
226
|
+
tabs: r.tabs.filter((e) => !e.contextual),
|
|
227
|
+
"active-tab": t.activeTab,
|
|
228
|
+
onSelect: s[0] ||= (e) => o("select", e)
|
|
229
|
+
}, null, 8, ["tabs", "active-tab"])]), a("div", be, [(_(!0), i(e, null, b(r.tabs.filter((e) => e.contextual), (e) => (_(), i("section", {
|
|
230
|
+
key: e.id,
|
|
231
|
+
class: "ml-ribbon-contextual-tabs__block",
|
|
232
|
+
style: m({ "--ctx-color": e.contextualColor || "#67c23a" })
|
|
233
|
+
}, [a("small", null, C(e.contextualTitle || r.defaultContextualTitle), 1), c(_e, {
|
|
234
|
+
tabs: [e],
|
|
235
|
+
"active-tab": t.activeTab,
|
|
236
|
+
onSelect: s[1] ||= (e) => o("select", e)
|
|
237
|
+
}, null, 8, ["tabs", "active-tab"])], 4))), 128))])]));
|
|
238
|
+
}
|
|
239
|
+
}), Se = /* @__PURE__ */ l({
|
|
240
|
+
__name: "RibbonFileMenu",
|
|
241
|
+
props: {
|
|
242
|
+
items: {},
|
|
243
|
+
label: {},
|
|
244
|
+
openBackstageLabel: {},
|
|
245
|
+
showOpenBackstage: { type: Boolean }
|
|
246
|
+
},
|
|
247
|
+
emits: ["select", "open-backstage"],
|
|
248
|
+
setup(o, { emit: l }) {
|
|
249
|
+
let u = l, d = y(!1), f = ae("size", ""), m = t(() => f.value || "default"), h = t(() => `ml-ribbon-file-menu-dropdown ml-ribbon-popper ml-ribbon-popper--size-${m.value}`);
|
|
250
|
+
function g(e) {
|
|
251
|
+
d.value = e;
|
|
252
|
+
}
|
|
253
|
+
function v(e) {
|
|
254
|
+
if (e === "__backstage") {
|
|
255
|
+
u("open-backstage");
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
u("select", e);
|
|
259
|
+
}
|
|
260
|
+
return (t, l) => (_(), n(T(M), {
|
|
261
|
+
trigger: "click",
|
|
262
|
+
"popper-class": h.value,
|
|
263
|
+
onCommand: v,
|
|
264
|
+
onVisibleChange: g
|
|
265
|
+
}, {
|
|
266
|
+
dropdown: D(() => [c(T(P), null, {
|
|
267
|
+
default: D(() => [o.showOpenBackstage === !1 ? r("", !0) : (_(), n(T(N), {
|
|
268
|
+
key: 0,
|
|
269
|
+
command: "__backstage"
|
|
270
|
+
}, {
|
|
271
|
+
default: D(() => [s(C(o.openBackstageLabel), 1)]),
|
|
272
|
+
_: 1
|
|
273
|
+
})), (_(!0), i(e, null, b(o.items, (e, t) => (_(), n(T(N), {
|
|
274
|
+
key: e.id,
|
|
275
|
+
divided: o.showOpenBackstage !== !1 && t === 0,
|
|
276
|
+
command: e.id,
|
|
277
|
+
disabled: e.disabled
|
|
278
|
+
}, {
|
|
279
|
+
default: D(() => [s(C(e.label), 1)]),
|
|
280
|
+
_: 2
|
|
281
|
+
}, 1032, [
|
|
282
|
+
"divided",
|
|
283
|
+
"command",
|
|
284
|
+
"disabled"
|
|
285
|
+
]))), 128))]),
|
|
286
|
+
_: 1
|
|
287
|
+
})]),
|
|
288
|
+
default: D(() => [a("button", {
|
|
289
|
+
type: "button",
|
|
290
|
+
class: p(["ml-ribbon-tab ml-ribbon-tab--file", { "is-active": d.value }])
|
|
291
|
+
}, C(o.label), 3)]),
|
|
292
|
+
_: 1
|
|
293
|
+
}, 8, ["popper-class"]));
|
|
294
|
+
}
|
|
295
|
+
}), Ce = /* @__PURE__ */ l({
|
|
296
|
+
__name: "RibbonCollection",
|
|
297
|
+
props: {
|
|
298
|
+
id: {},
|
|
299
|
+
layout: { default: "row" },
|
|
300
|
+
rows: { default: 3 }
|
|
301
|
+
},
|
|
302
|
+
setup(e) {
|
|
303
|
+
let n = e, r = t(() => ({ "--ml-ribbon-collection-rows": String(n.rows) }));
|
|
304
|
+
return (e, t) => (_(), i("div", {
|
|
305
|
+
class: p(["ml-ribbon-collection", [`ml-ribbon-collection--${n.layout}`]]),
|
|
306
|
+
style: m(r.value)
|
|
307
|
+
}, [x(e.$slots, "default")], 6));
|
|
308
|
+
}
|
|
309
|
+
}), we = {
|
|
310
|
+
key: 0,
|
|
311
|
+
class: "ml-ribbon-gallery__title"
|
|
312
|
+
}, Te = { class: "ml-ribbon-gallery__categories" }, Ee = { class: "ml-ribbon-gallery__category-title" }, De = { class: "ml-ribbon-gallery__grid" }, Oe = ["disabled", "onClick"], ke = { class: "ml-ribbon-gallery__preview" }, Ae = { class: "ml-ribbon-gallery__label" }, Q = /* @__PURE__ */ l({
|
|
313
|
+
__name: "RibbonGallery",
|
|
314
|
+
props: {
|
|
315
|
+
id: {},
|
|
316
|
+
label: {},
|
|
317
|
+
categories: {},
|
|
318
|
+
disabled: {
|
|
319
|
+
type: Boolean,
|
|
320
|
+
default: !1
|
|
321
|
+
},
|
|
322
|
+
previewFallback: {}
|
|
323
|
+
},
|
|
324
|
+
emits: ["select"],
|
|
325
|
+
setup(t, { emit: n }) {
|
|
326
|
+
let o = t, s = n, c = y("");
|
|
327
|
+
function l(e) {
|
|
328
|
+
o.disabled || (c.value = e, s("select", e));
|
|
329
|
+
}
|
|
330
|
+
return (n, s) => (_(), i("div", { class: p(["ml-ribbon-gallery", { "is-disabled": t.disabled }]) }, [t.label ? (_(), i("div", we, C(t.label), 1)) : r("", !0), a("div", Te, [(_(!0), i(e, null, b(t.categories, (n) => (_(), i("section", {
|
|
331
|
+
key: n.id,
|
|
332
|
+
class: "ml-ribbon-gallery__category"
|
|
333
|
+
}, [a("h4", Ee, C(n.title), 1), a("div", De, [(_(!0), i(e, null, b(n.items, (e) => (_(), i("button", {
|
|
334
|
+
key: e.id,
|
|
335
|
+
type: "button",
|
|
336
|
+
class: p(["ml-ribbon-gallery__item", { "is-selected": c.value === e.id }]),
|
|
337
|
+
disabled: t.disabled,
|
|
338
|
+
onClick: (t) => l(e.id)
|
|
339
|
+
}, [a("div", ke, C(e.preview ?? o.previewFallback), 1), a("div", Ae, C(e.label), 1)], 10, Oe))), 128))])]))), 128))])], 2));
|
|
340
|
+
}
|
|
341
|
+
}), je = ["data-id"], Me = { class: "ml-ribbon-group-button__label" }, $ = /* @__PURE__ */ l({
|
|
342
|
+
__name: "RibbonGroupButton",
|
|
343
|
+
props: {
|
|
344
|
+
id: {},
|
|
345
|
+
label: {},
|
|
346
|
+
options: {},
|
|
347
|
+
multiple: {
|
|
348
|
+
type: Boolean,
|
|
349
|
+
default: !1
|
|
350
|
+
},
|
|
351
|
+
disabled: {
|
|
352
|
+
type: Boolean,
|
|
353
|
+
default: !1
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
emits: ["change"],
|
|
357
|
+
setup(t, { emit: o }) {
|
|
358
|
+
let l = t, u = o, d = y([]);
|
|
359
|
+
function f(e) {
|
|
360
|
+
if (!l.disabled) {
|
|
361
|
+
if (l.multiple) {
|
|
362
|
+
d.value.includes(e) ? d.value = d.value.filter((t) => t !== e) : d.value = [...d.value, e], u("change", d.value);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
d.value = [e], u("change", e);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return (o, l) => (_(), i("div", {
|
|
369
|
+
class: "ml-ribbon-group-button",
|
|
370
|
+
"data-id": t.id
|
|
371
|
+
}, [a("div", Me, C(t.label), 1), c(T(A), null, {
|
|
372
|
+
default: D(() => [(_(!0), i(e, null, b(t.options, (e) => (_(), n(T(k), {
|
|
373
|
+
key: e.value,
|
|
374
|
+
disabled: t.disabled,
|
|
375
|
+
type: d.value.includes(e.value) ? "primary" : "default",
|
|
376
|
+
onClick: (t) => f(e.value)
|
|
377
|
+
}, {
|
|
378
|
+
default: D(() => [e.icon ? (_(), n(T(F), {
|
|
379
|
+
key: 0,
|
|
380
|
+
class: "ml-ribbon-item-host__icon"
|
|
381
|
+
}, {
|
|
382
|
+
default: D(() => [(_(), n(S(e.icon)))]),
|
|
383
|
+
_: 2
|
|
384
|
+
}, 1024)) : r("", !0), s(" " + C(e.label), 1)]),
|
|
385
|
+
_: 2
|
|
386
|
+
}, 1032, [
|
|
387
|
+
"disabled",
|
|
388
|
+
"type",
|
|
389
|
+
"onClick"
|
|
390
|
+
]))), 128))]),
|
|
391
|
+
_: 1
|
|
392
|
+
})], 8, je));
|
|
393
|
+
}
|
|
394
|
+
}), Ne = ["data-template-id"], Pe = /* @__PURE__ */ l({
|
|
395
|
+
__name: "RibbonTemplateItem",
|
|
396
|
+
props: {
|
|
397
|
+
id: {},
|
|
398
|
+
item: {}
|
|
399
|
+
},
|
|
400
|
+
setup(e) {
|
|
401
|
+
return (t, n) => (_(), i("div", {
|
|
402
|
+
class: "ml-ribbon-template-item",
|
|
403
|
+
"data-template-id": e.id
|
|
404
|
+
}, [x(t.$slots, "default", { item: e.item }, () => [a("span", null, C(e.item.label ?? e.item.id), 1)])], 8, Ne));
|
|
405
|
+
}
|
|
406
|
+
}), Fe = ["data-item-id"], Ie = {
|
|
407
|
+
key: 0,
|
|
408
|
+
class: "ml-ribbon-item-host__keytip"
|
|
409
|
+
}, Le = { class: "ml-ribbon-item-host__content" }, Re = { class: "ml-ribbon-item-host__text-row" }, ze = {
|
|
410
|
+
key: 0,
|
|
411
|
+
class: "ml-ribbon-item-host__label"
|
|
412
|
+
}, Be = { class: "ml-ribbon-dropdown-item__content" }, Ve = { class: "ml-ribbon-dropdown-item__label" }, He = {
|
|
413
|
+
key: 2,
|
|
414
|
+
class: "ml-ribbon-item-host__label"
|
|
415
|
+
}, Ue = /* @__PURE__ */ l({
|
|
416
|
+
__name: "RibbonItemHost",
|
|
417
|
+
props: {
|
|
418
|
+
id: {},
|
|
419
|
+
item: {},
|
|
420
|
+
groupId: {},
|
|
421
|
+
galleryPreviewFallback: {}
|
|
422
|
+
},
|
|
423
|
+
emits: ["item-click"],
|
|
424
|
+
setup(o, { emit: l }) {
|
|
425
|
+
let d = o, f = l, m = u(ce, null), h = t(() => Array.isArray(d.item.props?.options) ? d.item.props.options : []), g = ae("size", ""), v = t(() => g.value || "default"), w = t(() => `ml-ribbon-dropdown-menu ml-ribbon-popper ml-ribbon-popper--size-${v.value}`), E = t(() => `ml-ribbon-select-dropdown ml-ribbon-popper ml-ribbon-popper--size-${v.value}`), A = t(() => d.item.props?.icon || (typeof d.item.icon == "string" || !d.item.icon ? null : d.item.icon)), ne = t(() => {
|
|
426
|
+
let e = d.item.props?.icon;
|
|
427
|
+
return typeof e == "string" && e.trim().length > 0 ? e : typeof d.item.icon == "string" && d.item.icon.trim().length > 0 ? d.item.icon : null;
|
|
428
|
+
}), j = t(() => d.item.hideLabel !== !0), re = t(() => d.item.label || d.item.id), ie = t(() => d.item.keyTip?.trim().toUpperCase() ?? ""), R = y(!1), oe = y(void 0), V = t(() => h.value.find((e) => Z(e) === oe.value) ?? null), se = t(() => {
|
|
429
|
+
let e = V.value;
|
|
430
|
+
if (e) {
|
|
431
|
+
let t = de(e);
|
|
432
|
+
if (t) return t;
|
|
433
|
+
}
|
|
434
|
+
return d.item.label ?? d.item.id;
|
|
435
|
+
}), H = t(() => {
|
|
436
|
+
if (V.value) {
|
|
437
|
+
let e = X(V.value);
|
|
438
|
+
if (e) return e;
|
|
439
|
+
}
|
|
440
|
+
return A.value;
|
|
441
|
+
}), U = t(() => {
|
|
442
|
+
if (V.value) {
|
|
443
|
+
let e = ue(V.value);
|
|
444
|
+
if (e) return e;
|
|
445
|
+
}
|
|
446
|
+
return H.value ? null : ne.value;
|
|
447
|
+
}), W = t(() => {
|
|
448
|
+
if (!m?.keyTipsOpen.value || !ie.value) return !1;
|
|
449
|
+
let e = m.keyTipsSequence.value.toLowerCase();
|
|
450
|
+
return e ? ie.value.toLowerCase().startsWith(e) : !0;
|
|
451
|
+
});
|
|
452
|
+
function G() {
|
|
453
|
+
f("item-click", d.id);
|
|
454
|
+
}
|
|
455
|
+
function K(e) {
|
|
456
|
+
R.value = e;
|
|
457
|
+
}
|
|
458
|
+
function q(e) {
|
|
459
|
+
oe.value = e, le(e), R.value = !1;
|
|
460
|
+
}
|
|
461
|
+
function J() {
|
|
462
|
+
R.value = !R.value;
|
|
463
|
+
}
|
|
464
|
+
function Y() {
|
|
465
|
+
let e = V.value;
|
|
466
|
+
if (!e) {
|
|
467
|
+
G();
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
le(Z(e));
|
|
471
|
+
}
|
|
472
|
+
function le(e) {
|
|
473
|
+
if (typeof e == "string" || typeof e == "number") {
|
|
474
|
+
f("item-click", String(e));
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
G();
|
|
478
|
+
}
|
|
479
|
+
function X(e) {
|
|
480
|
+
if (!e || typeof e != "object") return null;
|
|
481
|
+
let t = e.icon;
|
|
482
|
+
return !t || typeof t == "string" ? null : t;
|
|
483
|
+
}
|
|
484
|
+
function ue(e) {
|
|
485
|
+
if (!e || typeof e != "object") return null;
|
|
486
|
+
let t = e.icon;
|
|
487
|
+
return typeof t != "string" || t.trim().length === 0 ? null : t;
|
|
488
|
+
}
|
|
489
|
+
function Z(e) {
|
|
490
|
+
if (!(!e || typeof e != "object")) return e.value;
|
|
491
|
+
}
|
|
492
|
+
function de(e) {
|
|
493
|
+
if (!e || typeof e != "object") return;
|
|
494
|
+
let t = e.label;
|
|
495
|
+
return typeof t == "string" ? t : void 0;
|
|
496
|
+
}
|
|
497
|
+
return (t, l) => (_(), i("div", {
|
|
498
|
+
class: p(["ml-ribbon-item-host", [
|
|
499
|
+
`is-${o.item.size ?? "medium"}`,
|
|
500
|
+
`type-${o.item.type}`,
|
|
501
|
+
{ "is-label-hidden": o.item.hideLabel === !0 }
|
|
502
|
+
]]),
|
|
503
|
+
"data-item-id": o.id,
|
|
504
|
+
role: "group"
|
|
505
|
+
}, [W.value ? (_(), i("span", Ie, C(ie.value), 1)) : r("", !0), o.item.type === "groupButton" ? (_(), n($, {
|
|
506
|
+
key: 1,
|
|
507
|
+
id: o.item.id,
|
|
508
|
+
label: o.item.label ?? "",
|
|
509
|
+
options: o.item.props?.options ?? [],
|
|
510
|
+
multiple: !!o.item.props?.multiple,
|
|
511
|
+
disabled: o.item.disabled,
|
|
512
|
+
onChange: G
|
|
513
|
+
}, null, 8, [
|
|
514
|
+
"id",
|
|
515
|
+
"label",
|
|
516
|
+
"options",
|
|
517
|
+
"multiple",
|
|
518
|
+
"disabled"
|
|
519
|
+
])) : o.item.type === "gallery" ? (_(), n(Q, {
|
|
520
|
+
key: 2,
|
|
521
|
+
id: o.item.id,
|
|
522
|
+
label: o.item.label ?? "",
|
|
523
|
+
categories: o.item.props?.categories ?? [],
|
|
524
|
+
"preview-fallback": d.galleryPreviewFallback,
|
|
525
|
+
disabled: o.item.disabled,
|
|
526
|
+
onSelect: G
|
|
527
|
+
}, null, 8, [
|
|
528
|
+
"id",
|
|
529
|
+
"label",
|
|
530
|
+
"categories",
|
|
531
|
+
"preview-fallback",
|
|
532
|
+
"disabled"
|
|
533
|
+
])) : o.item.type === "template" ? (_(), n(Pe, {
|
|
534
|
+
key: 3,
|
|
535
|
+
id: o.item.id,
|
|
536
|
+
item: o.item
|
|
537
|
+
}, {
|
|
538
|
+
default: D(() => [x(t.$slots, "template", { item: o.item })]),
|
|
539
|
+
_: 3
|
|
540
|
+
}, 8, ["id", "item"])) : o.item.type === "dropdown" ? (_(), n(T(M), {
|
|
541
|
+
key: 4,
|
|
542
|
+
trigger: "click",
|
|
543
|
+
disabled: o.item.disabled,
|
|
544
|
+
"popper-class": w.value,
|
|
545
|
+
onVisibleChange: K,
|
|
546
|
+
onCommand: q
|
|
547
|
+
}, {
|
|
548
|
+
dropdown: D(() => [c(T(P), null, {
|
|
549
|
+
default: D(() => [(_(!0), i(e, null, b(h.value, (e) => (_(), n(T(N), {
|
|
550
|
+
key: String(e.value),
|
|
551
|
+
command: e.value
|
|
552
|
+
}, {
|
|
553
|
+
default: D(() => [a("span", Be, [X(e) ? (_(), n(T(F), {
|
|
554
|
+
key: 0,
|
|
555
|
+
class: "ml-ribbon-dropdown-item__icon"
|
|
556
|
+
}, {
|
|
557
|
+
default: D(() => [(_(), n(S(X(e))))]),
|
|
558
|
+
_: 2
|
|
559
|
+
}, 1024)) : ue(e) ? (_(), i("i", {
|
|
560
|
+
key: 1,
|
|
561
|
+
class: p(["ml-ribbon-dropdown-item__icon ml-ribbon-dropdown-item__icon--class", ue(e)]),
|
|
562
|
+
"aria-hidden": "true"
|
|
563
|
+
}, null, 2)) : r("", !0), a("span", Ve, C(e.label), 1)])]),
|
|
564
|
+
_: 2
|
|
565
|
+
}, 1032, ["command"]))), 128))]),
|
|
566
|
+
_: 1
|
|
567
|
+
})]),
|
|
568
|
+
default: D(() => [c(T(k), {
|
|
569
|
+
type: "default",
|
|
570
|
+
"aria-label": re.value,
|
|
571
|
+
onClick: J
|
|
572
|
+
}, {
|
|
573
|
+
default: D(() => [a("span", Le, [H.value ? (_(), i("span", {
|
|
574
|
+
key: 0,
|
|
575
|
+
class: "ml-ribbon-item-host__icon ml-ribbon-item-host__icon--dropdown-primary",
|
|
576
|
+
onClick: O(Y, ["stop"])
|
|
577
|
+
}, [c(T(F), null, {
|
|
578
|
+
default: D(() => [(_(), n(S(H.value)))]),
|
|
579
|
+
_: 1
|
|
580
|
+
})])) : U.value ? (_(), i("span", {
|
|
581
|
+
key: 1,
|
|
582
|
+
class: "ml-ribbon-item-host__icon ml-ribbon-item-host__icon--class ml-ribbon-item-host__icon--dropdown-primary",
|
|
583
|
+
onClick: O(Y, ["stop"])
|
|
584
|
+
}, [a("i", {
|
|
585
|
+
class: p(U.value),
|
|
586
|
+
"aria-hidden": "true"
|
|
587
|
+
}, null, 2)])) : r("", !0), a("span", Re, [j.value ? (_(), i("span", ze, C(se.value), 1)) : r("", !0), c(T(F), { class: p(["ml-ribbon-item-host__dropdown-arrow", { "is-open": R.value }]) }, {
|
|
588
|
+
default: D(() => [(_(), n(S(R.value ? T(B) : T(z))))]),
|
|
589
|
+
_: 1
|
|
590
|
+
}, 8, ["class"])])])]),
|
|
591
|
+
_: 1
|
|
592
|
+
}, 8, ["aria-label"])]),
|
|
593
|
+
_: 1
|
|
594
|
+
}, 8, ["disabled", "popper-class"])) : o.item.type === "checkbox" ? (_(), n(T(ee), {
|
|
595
|
+
key: 5,
|
|
596
|
+
disabled: o.item.disabled,
|
|
597
|
+
onChange: G
|
|
598
|
+
}, {
|
|
599
|
+
default: D(() => [s(C(o.item.label), 1)]),
|
|
600
|
+
_: 1
|
|
601
|
+
}, 8, ["disabled"])) : o.item.type === "colorPicker" ? (_(), n(T(te), {
|
|
602
|
+
key: 6,
|
|
603
|
+
disabled: o.item.disabled,
|
|
604
|
+
onChange: G
|
|
605
|
+
}, null, 8, ["disabled"])) : o.item.type === "comboBox" ? (_(), n(T(L), {
|
|
606
|
+
key: 7,
|
|
607
|
+
disabled: o.item.disabled,
|
|
608
|
+
"popper-class": E.value,
|
|
609
|
+
style: { width: "92px" },
|
|
610
|
+
onChange: G
|
|
611
|
+
}, {
|
|
612
|
+
default: D(() => [(_(!0), i(e, null, b(h.value, (e) => (_(), n(T(I), {
|
|
613
|
+
key: String(e.value),
|
|
614
|
+
label: String(e.label),
|
|
615
|
+
value: e.value
|
|
616
|
+
}, null, 8, ["label", "value"]))), 128))]),
|
|
617
|
+
_: 1
|
|
618
|
+
}, 8, ["disabled", "popper-class"])) : (_(), n(T(k), {
|
|
619
|
+
key: 8,
|
|
620
|
+
disabled: o.item.disabled,
|
|
621
|
+
"aria-label": re.value,
|
|
622
|
+
onClick: G
|
|
623
|
+
}, {
|
|
624
|
+
default: D(() => [A.value ? (_(), n(T(F), {
|
|
625
|
+
key: 0,
|
|
626
|
+
class: "ml-ribbon-item-host__icon"
|
|
627
|
+
}, {
|
|
628
|
+
default: D(() => [(_(), n(S(A.value)))]),
|
|
629
|
+
_: 1
|
|
630
|
+
})) : ne.value ? (_(), i("i", {
|
|
631
|
+
key: 1,
|
|
632
|
+
class: p(["ml-ribbon-item-host__icon ml-ribbon-item-host__icon--class", ne.value]),
|
|
633
|
+
"aria-hidden": "true"
|
|
634
|
+
}, null, 2)) : r("", !0), j.value ? (_(), i("span", He, C(o.item.label ?? o.item.id), 1)) : r("", !0)]),
|
|
635
|
+
_: 1
|
|
636
|
+
}, 8, ["disabled", "aria-label"]))], 10, Fe));
|
|
637
|
+
}
|
|
638
|
+
}), We = /* @__PURE__ */ l({
|
|
639
|
+
__name: "RibbonGroupContent",
|
|
640
|
+
props: {
|
|
641
|
+
group: {},
|
|
642
|
+
galleryPreviewFallback: {}
|
|
643
|
+
},
|
|
644
|
+
emits: ["item-click"],
|
|
645
|
+
setup(t, { emit: r }) {
|
|
646
|
+
let a = t, o = r;
|
|
647
|
+
return (t, r) => (_(), i("div", { class: p(["ml-ribbon-group__content", [`ml-ribbon-group__content--${a.group.orientation ?? "column"}`]]) }, [(_(!0), i(e, null, b(a.group.collections ?? [], (t) => (_(), n(Ce, {
|
|
648
|
+
id: t.id,
|
|
649
|
+
key: t.id,
|
|
650
|
+
layout: t.layout ?? (a.group.orientation === "row" ? "row" : "column"),
|
|
651
|
+
rows: t.rows
|
|
652
|
+
}, {
|
|
653
|
+
default: D(() => [(_(!0), i(e, null, b(t.items, (e) => (_(), n(Ue, {
|
|
654
|
+
id: e.id,
|
|
655
|
+
key: e.id,
|
|
656
|
+
item: e,
|
|
657
|
+
"group-id": a.group.id,
|
|
658
|
+
"gallery-preview-fallback": a.galleryPreviewFallback,
|
|
659
|
+
onItemClick: (t) => o("item-click", {
|
|
660
|
+
groupId: a.group.id,
|
|
661
|
+
itemId: e.id
|
|
662
|
+
})
|
|
663
|
+
}, null, 8, [
|
|
664
|
+
"id",
|
|
665
|
+
"item",
|
|
666
|
+
"group-id",
|
|
667
|
+
"gallery-preview-fallback",
|
|
668
|
+
"onItemClick"
|
|
669
|
+
]))), 128))]),
|
|
670
|
+
_: 2
|
|
671
|
+
}, 1032, [
|
|
672
|
+
"id",
|
|
673
|
+
"layout",
|
|
674
|
+
"rows"
|
|
675
|
+
]))), 128))], 2));
|
|
676
|
+
}
|
|
677
|
+
}), Ge = ["data-priority"], Ke = { class: "ml-ribbon-group__body" }, qe = { class: "ml-ribbon-group__footer" }, Je = { class: "ml-ribbon-group__title" }, Ye = ["aria-label", "aria-expanded"], Xe = { class: "ml-ribbon-group__overflow-content" }, Ze = ["aria-label", "aria-expanded"], Qe = { class: "ml-ribbon-group__overflow-content" }, $e = /* @__PURE__ */ l({
|
|
678
|
+
__name: "RibbonGroup",
|
|
679
|
+
props: {
|
|
680
|
+
id: {},
|
|
681
|
+
title: {},
|
|
682
|
+
icon: {},
|
|
683
|
+
groupIconCss: {},
|
|
684
|
+
orientation: {},
|
|
685
|
+
autoWidth: { type: Boolean },
|
|
686
|
+
priority: {},
|
|
687
|
+
launcher: { type: Boolean },
|
|
688
|
+
showLauncherIcon: { type: Boolean },
|
|
689
|
+
groupModel: {},
|
|
690
|
+
overflowTriggerAriaLabel: {},
|
|
691
|
+
galleryPreviewFallback: {}
|
|
692
|
+
},
|
|
693
|
+
emits: ["item-click"],
|
|
694
|
+
setup(e, { emit: o }) {
|
|
695
|
+
let s = e, l = o, u = t(() => s.autoWidth !== !1), d = y(null), m = y([]), v = y(null), b = y(null), w = y(0), O = y(0), A = ae("size", ""), ee = t(() => A.value || "default"), te = t(() => `ml-ribbon-group__overflow-popover ml-ribbon-group__overflow-popover--size-${ee.value}`), ne = t(() => ({ modifiers: [{
|
|
696
|
+
name: "offset",
|
|
697
|
+
options: { offset: [w.value, 8] }
|
|
698
|
+
}] })), j = t(() => ({ modifiers: [{
|
|
699
|
+
name: "offset",
|
|
700
|
+
options: { offset: [O.value, 8] }
|
|
701
|
+
}] })), M = t(() => !s.icon || typeof s.icon == "string" ? null : s.icon), N = t(() => m.value.length > 0), P = t(() => (s.groupModel?.footerMenuItems?.length ?? 0) > 0), I = y(!1), L = y(!1), ie = t(() => {
|
|
702
|
+
if (!s.groupModel || !m.value.length) return null;
|
|
703
|
+
let e = new Set(m.value), t = s.groupModel.collections?.map((t) => ({
|
|
704
|
+
...t,
|
|
705
|
+
items: t.items.filter((t) => e.has(t.id))
|
|
706
|
+
})).filter((e) => e.items.length > 0) ?? [];
|
|
707
|
+
return t.length ? {
|
|
708
|
+
...s.groupModel,
|
|
709
|
+
collections: t
|
|
710
|
+
} : null;
|
|
711
|
+
}), R = t(() => s.groupModel?.footerMenuItems?.length ? {
|
|
712
|
+
id: `${s.groupModel.id}-footer-menu`,
|
|
713
|
+
title: "",
|
|
714
|
+
orientation: "row",
|
|
715
|
+
collections: [{
|
|
716
|
+
id: `${s.groupModel.id}-footer-menu-collection`,
|
|
717
|
+
layout: "row",
|
|
718
|
+
items: s.groupModel.footerMenuItems
|
|
719
|
+
}]
|
|
720
|
+
} : null);
|
|
721
|
+
function oe() {
|
|
722
|
+
let e = d.value?.querySelector(".ml-ribbon-group__content");
|
|
723
|
+
if (!e) {
|
|
724
|
+
m.value.length > 0 && (m.value = []);
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
let t = e.getBoundingClientRect();
|
|
728
|
+
if (t.width <= 0 || t.height <= 0) {
|
|
729
|
+
m.value.length > 0 && (m.value = []);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
let n = [];
|
|
733
|
+
e.querySelectorAll(".ml-ribbon-item-host[data-item-id]").forEach((e) => {
|
|
734
|
+
let r = e.dataset.itemId;
|
|
735
|
+
if (!r) return;
|
|
736
|
+
let i = e.getBoundingClientRect();
|
|
737
|
+
(i.right - t.right > .5 || i.bottom - t.bottom > .5 || t.left - i.left > .5 || t.top - i.top > .5) && n.push(r);
|
|
738
|
+
}), m.value.length === n.length && m.value.every((e, t) => e === n[t]) || (m.value = n);
|
|
739
|
+
}
|
|
740
|
+
function V() {
|
|
741
|
+
f(() => {
|
|
742
|
+
Y(), se(), H(), oe();
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
function se() {
|
|
746
|
+
let e = d.value?.getBoundingClientRect(), t = v.value?.getBoundingClientRect();
|
|
747
|
+
if (!e || !t) {
|
|
748
|
+
w.value !== 0 && (w.value = 0);
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
let n = Math.round(e.left - t.left);
|
|
752
|
+
w.value !== n && (w.value = n);
|
|
753
|
+
}
|
|
754
|
+
function H() {
|
|
755
|
+
let e = d.value?.getBoundingClientRect(), t = b.value?.getBoundingClientRect();
|
|
756
|
+
if (!e || !t) {
|
|
757
|
+
O.value !== 0 && (O.value = 0);
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
let n = Math.round(e.left - t.left);
|
|
761
|
+
O.value !== n && (O.value = n);
|
|
762
|
+
}
|
|
763
|
+
function ce(e) {
|
|
764
|
+
I.value = e;
|
|
765
|
+
}
|
|
766
|
+
function W(e) {
|
|
767
|
+
L.value = e;
|
|
768
|
+
}
|
|
769
|
+
function G() {
|
|
770
|
+
I.value = !I.value;
|
|
771
|
+
}
|
|
772
|
+
function K() {
|
|
773
|
+
L.value = !L.value;
|
|
774
|
+
}
|
|
775
|
+
let q = null, J = null;
|
|
776
|
+
function Y() {
|
|
777
|
+
if (!q) return;
|
|
778
|
+
let e = d.value?.querySelector(".ml-ribbon-group__content") ?? null;
|
|
779
|
+
J !== e && (J && q.unobserve(J), e && q.observe(e), J = e);
|
|
780
|
+
}
|
|
781
|
+
return E(() => s.groupModel, () => {
|
|
782
|
+
V();
|
|
783
|
+
}, { deep: !0 }), h(() => {
|
|
784
|
+
typeof ResizeObserver < "u" && (q = new ResizeObserver(() => {
|
|
785
|
+
se(), H(), oe();
|
|
786
|
+
}), d.value && q.observe(d.value), Y()), V();
|
|
787
|
+
}), g(() => {
|
|
788
|
+
q?.disconnect();
|
|
789
|
+
}), (t, o) => (_(), i("section", {
|
|
790
|
+
ref_key: "groupSectionRef",
|
|
791
|
+
ref: d,
|
|
792
|
+
class: p(["ml-ribbon-group", { "ml-ribbon-group--auto-width": u.value }]),
|
|
793
|
+
"data-priority": e.priority ?? 100
|
|
794
|
+
}, [a("div", Ke, [x(t.$slots, "default")]), a("footer", qe, [
|
|
795
|
+
M.value ? (_(), n(T(F), {
|
|
796
|
+
key: 0,
|
|
797
|
+
class: "ml-ribbon-group__icon"
|
|
798
|
+
}, {
|
|
799
|
+
default: D(() => [(_(), n(S(M.value)))]),
|
|
800
|
+
_: 1
|
|
801
|
+
})) : r("", !0),
|
|
802
|
+
a("span", Je, C(e.title), 1),
|
|
803
|
+
P.value && R.value ? (_(), n(T(re), {
|
|
804
|
+
key: 1,
|
|
805
|
+
trigger: "click",
|
|
806
|
+
placement: "bottom-start",
|
|
807
|
+
"popper-class": te.value,
|
|
808
|
+
"popper-options": j.value,
|
|
809
|
+
onShow: o[1] ||= (e) => ce(!0),
|
|
810
|
+
onHide: o[2] ||= (e) => ce(!1)
|
|
811
|
+
}, {
|
|
812
|
+
reference: D(() => [a("button", {
|
|
813
|
+
ref_key: "footerTriggerRef",
|
|
814
|
+
ref: b,
|
|
815
|
+
type: "button",
|
|
816
|
+
class: p(["ml-ribbon-group__footer-trigger", { "is-open": I.value }]),
|
|
817
|
+
"aria-label": e.overflowTriggerAriaLabel,
|
|
818
|
+
"aria-expanded": I.value,
|
|
819
|
+
onClick: G
|
|
820
|
+
}, [c(T(F), null, {
|
|
821
|
+
default: D(() => [(_(), n(S(I.value ? T(B) : T(z))))]),
|
|
822
|
+
_: 1
|
|
823
|
+
})], 10, Ye)]),
|
|
824
|
+
default: D(() => [a("div", Xe, [c(We, {
|
|
825
|
+
group: R.value,
|
|
826
|
+
"gallery-preview-fallback": e.galleryPreviewFallback,
|
|
827
|
+
onItemClick: o[0] ||= (e) => l("item-click", e)
|
|
828
|
+
}, null, 8, ["group", "gallery-preview-fallback"])])]),
|
|
829
|
+
_: 1
|
|
830
|
+
}, 8, ["popper-class", "popper-options"])) : r("", !0),
|
|
831
|
+
N.value && ie.value ? (_(), n(T(re), {
|
|
832
|
+
key: 2,
|
|
833
|
+
trigger: "click",
|
|
834
|
+
placement: "bottom-start",
|
|
835
|
+
"popper-class": te.value,
|
|
836
|
+
"popper-options": ne.value,
|
|
837
|
+
onShow: o[4] ||= (e) => W(!0),
|
|
838
|
+
onHide: o[5] ||= (e) => W(!1)
|
|
839
|
+
}, {
|
|
840
|
+
reference: D(() => [a("button", {
|
|
841
|
+
ref_key: "overflowTriggerRef",
|
|
842
|
+
ref: v,
|
|
843
|
+
type: "button",
|
|
844
|
+
class: p(["ml-ribbon-group__overflow-trigger", { "is-open": L.value }]),
|
|
845
|
+
"aria-label": e.overflowTriggerAriaLabel,
|
|
846
|
+
"aria-expanded": L.value,
|
|
847
|
+
onClick: K
|
|
848
|
+
}, [c(T(F), null, {
|
|
849
|
+
default: D(() => [(_(), n(S(L.value ? T(B) : T(z))))]),
|
|
850
|
+
_: 1
|
|
851
|
+
})], 10, Ze)]),
|
|
852
|
+
default: D(() => [a("div", Qe, [c(We, {
|
|
853
|
+
group: ie.value,
|
|
854
|
+
"gallery-preview-fallback": e.galleryPreviewFallback,
|
|
855
|
+
onItemClick: o[3] ||= (e) => l("item-click", e)
|
|
856
|
+
}, null, 8, ["group", "gallery-preview-fallback"])])]),
|
|
857
|
+
_: 1
|
|
858
|
+
}, 8, ["popper-class", "popper-options"])) : r("", !0),
|
|
859
|
+
e.showLauncherIcon ?? e.launcher ? (_(), n(T(k), {
|
|
860
|
+
key: 3,
|
|
861
|
+
link: "",
|
|
862
|
+
class: "ml-ribbon-group__launcher"
|
|
863
|
+
}, {
|
|
864
|
+
default: D(() => [c(T(F), null, {
|
|
865
|
+
default: D(() => [c(T(U))]),
|
|
866
|
+
_: 1
|
|
867
|
+
})]),
|
|
868
|
+
_: 1
|
|
869
|
+
})) : r("", !0)
|
|
870
|
+
])], 10, Ge));
|
|
871
|
+
}
|
|
872
|
+
}), et = { class: "ml-ribbon__header" }, tt = { class: "ml-ribbon__head-left" }, nt = { class: "ml-ribbon__head-right" }, rt = {
|
|
873
|
+
key: 2,
|
|
874
|
+
class: "ml-ribbon__tabs-extra"
|
|
875
|
+
}, it = ["data-active-tab"], at = {
|
|
876
|
+
key: 0,
|
|
877
|
+
class: "ml-ribbon-group ml-ribbon-group--overflow"
|
|
878
|
+
}, ot = { class: "ml-ribbon-group__body ml-ribbon-group__body--overflow" }, st = ["aria-label"], ct = { class: "ml-ribbon-overflow-list" }, lt = { class: "ml-ribbon-overflow-group__header" }, ut = ["data-active-tab"], dt = {
|
|
879
|
+
class: "ml-ribbon-simplified-group",
|
|
880
|
+
type: "button"
|
|
881
|
+
}, ft = { class: "ml-ribbon-simplified-group__panel" }, pt = 40, mt = /* @__PURE__ */ l({
|
|
882
|
+
__name: "Ribbon",
|
|
883
|
+
props: {
|
|
884
|
+
id: { default: "ml-ribbon-root" },
|
|
885
|
+
tabs: {},
|
|
886
|
+
activeTab: { default: "" },
|
|
887
|
+
activeLayout: { default: void 0 },
|
|
888
|
+
layout: { default: "classic" },
|
|
889
|
+
size: { default: void 0 },
|
|
890
|
+
minimized: {
|
|
891
|
+
type: Boolean,
|
|
892
|
+
default: !1
|
|
893
|
+
},
|
|
894
|
+
hideLayoutSwitcher: {
|
|
895
|
+
type: Boolean,
|
|
896
|
+
default: !1
|
|
897
|
+
},
|
|
898
|
+
hideMinimizeButton: {
|
|
899
|
+
type: Boolean,
|
|
900
|
+
default: !1
|
|
901
|
+
},
|
|
902
|
+
hideKeyTipsToggle: {
|
|
903
|
+
type: Boolean,
|
|
904
|
+
default: !1
|
|
905
|
+
},
|
|
906
|
+
showFileMenu: {
|
|
907
|
+
type: Boolean,
|
|
908
|
+
default: !0
|
|
909
|
+
},
|
|
910
|
+
showOpenBackstage: {
|
|
911
|
+
type: Boolean,
|
|
912
|
+
default: !0
|
|
913
|
+
},
|
|
914
|
+
fileMenuItems: { default: () => [] },
|
|
915
|
+
texts: { default: () => ({}) }
|
|
916
|
+
},
|
|
917
|
+
emits: [
|
|
918
|
+
"update:activeTab",
|
|
919
|
+
"update:layout",
|
|
920
|
+
"update:minimized",
|
|
921
|
+
"tabChange",
|
|
922
|
+
"layoutChange",
|
|
923
|
+
"itemClick",
|
|
924
|
+
"overflowOpen",
|
|
925
|
+
"overflowClose",
|
|
926
|
+
"backstageOpen",
|
|
927
|
+
"backstageClose",
|
|
928
|
+
"fileMenuSelect"
|
|
929
|
+
],
|
|
930
|
+
setup(s, { expose: l, emit: u }) {
|
|
931
|
+
function m(e) {
|
|
932
|
+
return e == null || typeof e == "string" ? e : typeof e == "object" || typeof e == "function" ? d(w(e)) : e;
|
|
933
|
+
}
|
|
934
|
+
function O(e) {
|
|
935
|
+
if (!e) return;
|
|
936
|
+
let t = { ...e };
|
|
937
|
+
return "icon" in t && (t.icon = m(t.icon)), Array.isArray(t.options) && (t.options = t.options.map((e) => {
|
|
938
|
+
if (!e || typeof e != "object") return e;
|
|
939
|
+
let t = e;
|
|
940
|
+
return "icon" in t ? {
|
|
941
|
+
...t,
|
|
942
|
+
icon: m(t.icon)
|
|
943
|
+
} : t;
|
|
944
|
+
})), t;
|
|
945
|
+
}
|
|
946
|
+
function A(e) {
|
|
947
|
+
return {
|
|
948
|
+
...e,
|
|
949
|
+
icon: m(e.icon),
|
|
950
|
+
props: O(e.props)
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
function ee(e) {
|
|
954
|
+
return {
|
|
955
|
+
...e,
|
|
956
|
+
icon: m(e.icon),
|
|
957
|
+
footerMenuItems: e.footerMenuItems?.map(A),
|
|
958
|
+
collections: e.collections?.map((e) => ({
|
|
959
|
+
...e,
|
|
960
|
+
items: e.items?.map(A)
|
|
961
|
+
}))
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
function te(e) {
|
|
965
|
+
return e.map((e) => ({
|
|
966
|
+
...e,
|
|
967
|
+
groups: e.groups?.map(ee)
|
|
968
|
+
}));
|
|
969
|
+
}
|
|
970
|
+
let j = {
|
|
971
|
+
layoutSwitcherTooltip: "Switch ribbon layout",
|
|
972
|
+
minimizeTooltip: "Minimize ribbon",
|
|
973
|
+
keyTipsToggleText: "Key Tips",
|
|
974
|
+
overflowTriggerAriaLabel: "Open overflow groups",
|
|
975
|
+
groupOverflowTriggerAriaLabel: "Open group menu",
|
|
976
|
+
fileMenuLabel: "File",
|
|
977
|
+
fileMenuOpenBackstageLabel: "Open backstage",
|
|
978
|
+
backstageBackLabel: "Back",
|
|
979
|
+
backstageTitle: "Backstage",
|
|
980
|
+
backstageDescription: "Manage your document and settings here.",
|
|
981
|
+
keyTipsSequencePrefix: "Sequence:",
|
|
982
|
+
keyTipsEmptySequence: "No key sequence",
|
|
983
|
+
contextualTabDefaultTitle: "Contextual",
|
|
984
|
+
galleryPreviewFallback: "Preview unavailable"
|
|
985
|
+
}, M = s, N = u, { context: P, visibleTabs: I } = ue(M.id, M.tabs, M.activeLayout ? String(M.activeLayout).toLowerCase() === "simplified" ? "simplified" : "classic" : M.layout, M.minimized, M.activeTab || M.tabs[0]?.id || "");
|
|
986
|
+
v(ce, P), E(() => M.tabs, (e) => {
|
|
987
|
+
P.tabs.value = te(e), P.tabs.value.some((e) => e.id === P.activeTab.value) || (P.activeTab.value = P.tabs.value[0]?.id || "");
|
|
988
|
+
}, { deep: !0 }), E(() => M.layout, (e) => {
|
|
989
|
+
e !== P.layout.value && (P.layout.value = e);
|
|
990
|
+
}), E(() => M.activeLayout, (e) => {
|
|
991
|
+
if (!e) return;
|
|
992
|
+
let t = String(e).toLowerCase() === "simplified" ? "simplified" : "classic";
|
|
993
|
+
t !== P.layout.value && (P.layout.value = t);
|
|
994
|
+
}), E(() => M.minimized, (e) => {
|
|
995
|
+
e !== P.minimized.value && (P.minimized.value = e);
|
|
996
|
+
}), E(() => M.activeTab, (e) => {
|
|
997
|
+
e && e !== P.activeTab.value && (P.activeTab.value = e);
|
|
998
|
+
}), E(P.activeTab, (e) => {
|
|
999
|
+
N("update:activeTab", e), N("tabChange", e);
|
|
1000
|
+
}), E(P.layout, (e) => {
|
|
1001
|
+
N("update:layout", e), N("layoutChange", e);
|
|
1002
|
+
}), E(P.minimized, (e) => {
|
|
1003
|
+
N("update:minimized", e);
|
|
1004
|
+
}), E(P.overflowOpen, (e) => {
|
|
1005
|
+
N(e ? "overflowOpen" : "overflowClose");
|
|
1006
|
+
}), E(P.backdropOpen, (e) => {
|
|
1007
|
+
N(e ? "backstageOpen" : "backstageClose");
|
|
1008
|
+
});
|
|
1009
|
+
let L = t(() => I.value.find((e) => e.id === P.activeTab.value)), z = t(() => L.value?.groups?.filter((e) => e.visible !== !1) ?? []), B = y(null), U = y(/* @__PURE__ */ new Set()), W = y({}), G = ae("size", ""), K = t(() => M.size || G.value || "default"), q = t(() => `ml-ribbon-group-popover ml-ribbon-group-popover--size-${K.value}`), J = t(() => `ml-ribbon-overflow-popover ml-ribbon-overflow-popover--size-${K.value}`), Y = t(() => ({
|
|
1010
|
+
layoutSwitcherTooltip: M.texts.layoutSwitcherTooltip || j.layoutSwitcherTooltip,
|
|
1011
|
+
minimizeTooltip: M.texts.minimizeTooltip || j.minimizeTooltip,
|
|
1012
|
+
keyTipsToggleText: M.texts.keyTipsToggleText || j.keyTipsToggleText,
|
|
1013
|
+
overflowTriggerAriaLabel: M.texts.overflowTriggerAriaLabel || j.overflowTriggerAriaLabel,
|
|
1014
|
+
groupOverflowTriggerAriaLabel: M.texts.groupOverflowTriggerAriaLabel || j.groupOverflowTriggerAriaLabel,
|
|
1015
|
+
fileMenuLabel: M.texts.fileMenuLabel || j.fileMenuLabel,
|
|
1016
|
+
fileMenuOpenBackstageLabel: M.texts.fileMenuOpenBackstageLabel || j.fileMenuOpenBackstageLabel,
|
|
1017
|
+
backstageBackLabel: M.texts.backstageBackLabel || j.backstageBackLabel,
|
|
1018
|
+
backstageTitle: M.texts.backstageTitle || j.backstageTitle,
|
|
1019
|
+
backstageDescription: M.texts.backstageDescription || j.backstageDescription,
|
|
1020
|
+
keyTipsSequencePrefix: M.texts.keyTipsSequencePrefix || j.keyTipsSequencePrefix,
|
|
1021
|
+
keyTipsEmptySequence: M.texts.keyTipsEmptySequence || j.keyTipsEmptySequence,
|
|
1022
|
+
contextualTabDefaultTitle: M.texts.contextualTabDefaultTitle || j.contextualTabDefaultTitle,
|
|
1023
|
+
galleryPreviewFallback: M.texts.galleryPreviewFallback || j.galleryPreviewFallback
|
|
1024
|
+
})), le = t(() => P.minimized.value ? V : oe), X = t(() => z.value.filter((e) => !U.value.has(e.id))), Z = t(() => z.value.filter((e) => U.value.has(e.id))), de = t(() => {
|
|
1025
|
+
if (!Z.value.length) return 220;
|
|
1026
|
+
let e = Z.value.reduce((e, t) => {
|
|
1027
|
+
let n = W.value[t.id] ?? he(t);
|
|
1028
|
+
return Math.max(e, n);
|
|
1029
|
+
}, 0), t = Math.ceil(e + 40);
|
|
1030
|
+
return Math.max(220, Math.min(720, t));
|
|
1031
|
+
});
|
|
1032
|
+
function fe(e) {
|
|
1033
|
+
let t = (e.collections ?? []).flatMap((e) => (e.items ?? []).map((e) => ({
|
|
1034
|
+
...A(e),
|
|
1035
|
+
size: "medium"
|
|
1036
|
+
})));
|
|
1037
|
+
return {
|
|
1038
|
+
...e,
|
|
1039
|
+
orientation: "row",
|
|
1040
|
+
collections: [{
|
|
1041
|
+
id: `${e.id}-simplified`,
|
|
1042
|
+
layout: "row",
|
|
1043
|
+
items: t
|
|
1044
|
+
}]
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
function pe(e) {
|
|
1048
|
+
return e.priority ?? 100;
|
|
1049
|
+
}
|
|
1050
|
+
function he(e) {
|
|
1051
|
+
return e.autoWidth === !1 ? 190 : 140;
|
|
1052
|
+
}
|
|
1053
|
+
function ge(e) {
|
|
1054
|
+
let t = {};
|
|
1055
|
+
return e.querySelectorAll(".ml-ribbon-group").forEach((e) => {
|
|
1056
|
+
let n = e.dataset.groupId;
|
|
1057
|
+
if (!n) return;
|
|
1058
|
+
let r = e.getBoundingClientRect().width;
|
|
1059
|
+
r > 0 && (t[n] = r);
|
|
1060
|
+
}), t;
|
|
1061
|
+
}
|
|
1062
|
+
function _e(e) {
|
|
1063
|
+
let t = Number.parseFloat(getComputedStyle(e).getPropertyValue("--ml-rb-overflow-slot-width"));
|
|
1064
|
+
return Number.isFinite(t) && t > 0 ? t : pt;
|
|
1065
|
+
}
|
|
1066
|
+
function ve() {
|
|
1067
|
+
if (P.layout.value !== "classic") {
|
|
1068
|
+
U.value = /* @__PURE__ */ new Set();
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
let e = B.value;
|
|
1072
|
+
if (!e) return;
|
|
1073
|
+
let t = z.value;
|
|
1074
|
+
if (!t.length) {
|
|
1075
|
+
U.value = /* @__PURE__ */ new Set();
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
let n = Math.round(e.getBoundingClientRect().width), r = _e(e), i = ge(e);
|
|
1079
|
+
W.value = {
|
|
1080
|
+
...W.value,
|
|
1081
|
+
...i
|
|
1082
|
+
};
|
|
1083
|
+
let a = t.filter((e) => e.enableGroupOverflow === !1), o = t.filter((e) => e.enableGroupOverflow !== !1).map((e, t) => ({
|
|
1084
|
+
group: e,
|
|
1085
|
+
index: t
|
|
1086
|
+
})), s = /* @__PURE__ */ new Set(), c = [...o].sort((e, t) => {
|
|
1087
|
+
let n = pe(t.group) - pe(e.group);
|
|
1088
|
+
return n === 0 ? t.index - e.index : n;
|
|
1089
|
+
}), l = (e) => i[e.id] ?? he(e), u = a.reduce((e, t) => e + l(t), 0), d = (e) => o.filter(({ group: t }) => !e.has(t.id)).reduce((e, { group: t }) => e + l(t), 0), f = (e) => u + d(e) + (e.size > 0 ? r : 0), p = 0;
|
|
1090
|
+
for (; f(s) > n && p < c.length;) {
|
|
1091
|
+
let e = c[p].group;
|
|
1092
|
+
s.add(e.id), p += 1;
|
|
1093
|
+
}
|
|
1094
|
+
U.value = s;
|
|
1095
|
+
}
|
|
1096
|
+
function ye() {
|
|
1097
|
+
f(() => {
|
|
1098
|
+
if (P.layout.value !== "classic" || P.minimized.value) {
|
|
1099
|
+
ve();
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
if (U.value.size === 0) {
|
|
1103
|
+
ve();
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
U.value = /* @__PURE__ */ new Set(), f(() => {
|
|
1107
|
+
ve();
|
|
1108
|
+
});
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
function be(e) {
|
|
1112
|
+
P.activeTab.value = e;
|
|
1113
|
+
}
|
|
1114
|
+
function Ce() {
|
|
1115
|
+
P.api.toggleSimplified();
|
|
1116
|
+
}
|
|
1117
|
+
function we() {
|
|
1118
|
+
P.minimized.value = !P.minimized.value;
|
|
1119
|
+
}
|
|
1120
|
+
function Te(e) {
|
|
1121
|
+
N("fileMenuSelect", e);
|
|
1122
|
+
}
|
|
1123
|
+
function Ee() {
|
|
1124
|
+
P.backdropOpen.value = !1;
|
|
1125
|
+
}
|
|
1126
|
+
function De(e, t) {
|
|
1127
|
+
N("itemClick", {
|
|
1128
|
+
tabId: P.activeTab.value,
|
|
1129
|
+
groupId: e,
|
|
1130
|
+
itemId: t
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
function Oe(e) {
|
|
1134
|
+
if (!(e instanceof HTMLElement)) return !1;
|
|
1135
|
+
if (e.isContentEditable) return !0;
|
|
1136
|
+
let t = e.tagName;
|
|
1137
|
+
return t === "INPUT" || t === "TEXTAREA" || t === "SELECT";
|
|
1138
|
+
}
|
|
1139
|
+
function ke() {
|
|
1140
|
+
let e = L.value;
|
|
1141
|
+
if (!e?.groups?.length) {
|
|
1142
|
+
P.keyTips.value = [];
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
let t = e.groups.filter((e) => e.visible !== !1).flatMap((t) => (t.collections ?? []).flatMap((n) => n.items.filter((e) => e.keyTip && e.disabled !== !0).map((n) => {
|
|
1146
|
+
let r = n.keyTip?.trim().toUpperCase();
|
|
1147
|
+
return r ? {
|
|
1148
|
+
id: `${e.id}:${t.id}:${n.id}`,
|
|
1149
|
+
key: r,
|
|
1150
|
+
targetId: n.id,
|
|
1151
|
+
sequence: r.split(""),
|
|
1152
|
+
scope: "item"
|
|
1153
|
+
} : null;
|
|
1154
|
+
}).filter((e) => !!e)));
|
|
1155
|
+
P.keyTips.value = t;
|
|
1156
|
+
}
|
|
1157
|
+
function Ae(e) {
|
|
1158
|
+
let t = L.value;
|
|
1159
|
+
if (t?.groups?.length) {
|
|
1160
|
+
for (let n of t.groups) if (n.visible !== !1) for (let t of n.collections ?? []) {
|
|
1161
|
+
let r = t.items.find((t) => t.id === e.targetId && t.disabled !== !0);
|
|
1162
|
+
if (r) {
|
|
1163
|
+
De(n.id, r.id), P.keyTipsOpen.value = !1, P.keyTipsSequence.value = "";
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
function Q() {
|
|
1170
|
+
P.keyTipsSequence.value = "";
|
|
1171
|
+
}
|
|
1172
|
+
function je(e) {
|
|
1173
|
+
if (!Oe(e.target)) {
|
|
1174
|
+
if (e.altKey && !e.ctrlKey && !e.metaKey && e.key === "Alt") {
|
|
1175
|
+
e.preventDefault(), P.keyTipsOpen.value = !P.keyTipsOpen.value, P.keyTipsOpen.value || Q();
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
if (P.keyTipsOpen.value && !(e.altKey || e.ctrlKey || e.metaKey)) {
|
|
1179
|
+
if (e.key === "Escape") {
|
|
1180
|
+
e.preventDefault(), P.keyTipsOpen.value = !1, Q();
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
if (e.key === "Backspace") {
|
|
1184
|
+
e.preventDefault(), P.keyTipsSequence.value = P.keyTipsSequence.value.slice(0, -1);
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
if (/^[a-z0-9]$/i.test(e.key)) {
|
|
1188
|
+
e.preventDefault();
|
|
1189
|
+
let t = `${P.keyTipsSequence.value}${e.key.toUpperCase()}`;
|
|
1190
|
+
P.keyTipsSequence.value = t;
|
|
1191
|
+
let n = t.toLowerCase(), r = P.keyTips.value.find((e) => e.key.toLowerCase() === n);
|
|
1192
|
+
if (r) {
|
|
1193
|
+
Ae(r);
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
P.keyTips.value.some((e) => e.key.toLowerCase().startsWith(n)) || Q();
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function Me(e) {
|
|
1202
|
+
return e.icon && typeof e.icon != "string" ? e.icon : e.groupIconCss ? se : null;
|
|
1203
|
+
}
|
|
1204
|
+
E([
|
|
1205
|
+
z,
|
|
1206
|
+
() => P.layout.value,
|
|
1207
|
+
() => P.minimized.value
|
|
1208
|
+
], () => {
|
|
1209
|
+
ye();
|
|
1210
|
+
}), E([L, () => P.tabs.value], () => {
|
|
1211
|
+
ke(), Q();
|
|
1212
|
+
}, {
|
|
1213
|
+
deep: !0,
|
|
1214
|
+
immediate: !0
|
|
1215
|
+
}), E(() => P.keyTipsOpen.value, (e) => {
|
|
1216
|
+
e || Q();
|
|
1217
|
+
}), E(B, (e, t) => {
|
|
1218
|
+
t && $ && $.unobserve(t), e && $ && $.observe(e);
|
|
1219
|
+
}, { flush: "post" });
|
|
1220
|
+
let $ = null;
|
|
1221
|
+
return h(() => {
|
|
1222
|
+
window.addEventListener("keydown", je), typeof ResizeObserver < "u" && ($ = new ResizeObserver(() => {
|
|
1223
|
+
ye();
|
|
1224
|
+
}), B.value && $.observe(B.value)), ye();
|
|
1225
|
+
}), g(() => {
|
|
1226
|
+
window.removeEventListener("keydown", je), $?.disconnect();
|
|
1227
|
+
}), l(P.api), (t, l) => (_(), n(T(ne), { size: M.size }, {
|
|
1228
|
+
default: D(() => [a("section", { class: p(["ml-ribbon", [
|
|
1229
|
+
`ml-ribbon--${T(P).layout.value}`,
|
|
1230
|
+
`ml-ribbon--size-${K.value}`,
|
|
1231
|
+
{
|
|
1232
|
+
"ml-ribbon--minimized": T(P).minimized.value,
|
|
1233
|
+
"ml-ribbon--keytips-open": T(P).keyTipsOpen.value
|
|
1234
|
+
}
|
|
1235
|
+
]]) }, [
|
|
1236
|
+
a("header", et, [a("div", tt, [
|
|
1237
|
+
s.showFileMenu ? (_(), n(Se, {
|
|
1238
|
+
key: 0,
|
|
1239
|
+
items: s.fileMenuItems,
|
|
1240
|
+
label: Y.value.fileMenuLabel,
|
|
1241
|
+
"open-backstage-label": Y.value.fileMenuOpenBackstageLabel,
|
|
1242
|
+
"show-open-backstage": s.showOpenBackstage,
|
|
1243
|
+
onSelect: Te,
|
|
1244
|
+
onOpenBackstage: l[0] ||= (e) => T(P).backdropOpen.value = !0
|
|
1245
|
+
}, null, 8, [
|
|
1246
|
+
"items",
|
|
1247
|
+
"label",
|
|
1248
|
+
"open-backstage-label",
|
|
1249
|
+
"show-open-backstage"
|
|
1250
|
+
])) : r("", !0),
|
|
1251
|
+
c(xe, {
|
|
1252
|
+
tabs: T(I),
|
|
1253
|
+
"active-tab": T(P).activeTab.value,
|
|
1254
|
+
"default-contextual-title": Y.value.contextualTabDefaultTitle,
|
|
1255
|
+
onSelect: be
|
|
1256
|
+
}, null, 8, [
|
|
1257
|
+
"tabs",
|
|
1258
|
+
"active-tab",
|
|
1259
|
+
"default-contextual-title"
|
|
1260
|
+
]),
|
|
1261
|
+
M.hideMinimizeButton ? r("", !0) : (_(), n(T(R), {
|
|
1262
|
+
key: 1,
|
|
1263
|
+
content: Y.value.minimizeTooltip
|
|
1264
|
+
}, {
|
|
1265
|
+
default: D(() => [c(T(k), {
|
|
1266
|
+
class: p([
|
|
1267
|
+
"ml-ribbon__control",
|
|
1268
|
+
"ml-ribbon__control--minimize",
|
|
1269
|
+
T(P).minimized.value ? "ml-ribbon__control--minimize-up" : "ml-ribbon__control--minimize-down"
|
|
1270
|
+
]),
|
|
1271
|
+
icon: le.value,
|
|
1272
|
+
onClick: we
|
|
1273
|
+
}, null, 8, ["class", "icon"])]),
|
|
1274
|
+
_: 1
|
|
1275
|
+
}, 8, ["content"]))
|
|
1276
|
+
]), a("div", nt, [
|
|
1277
|
+
M.hideLayoutSwitcher ? r("", !0) : (_(), n(T(R), {
|
|
1278
|
+
key: 0,
|
|
1279
|
+
content: Y.value.layoutSwitcherTooltip
|
|
1280
|
+
}, {
|
|
1281
|
+
default: D(() => [c(T(k), {
|
|
1282
|
+
circle: "",
|
|
1283
|
+
class: "ml-ribbon__control ml-ribbon__control--layout",
|
|
1284
|
+
icon: T(H),
|
|
1285
|
+
onClick: Ce
|
|
1286
|
+
}, null, 8, ["icon"])]),
|
|
1287
|
+
_: 1
|
|
1288
|
+
}, 8, ["content"])),
|
|
1289
|
+
M.hideKeyTipsToggle ? r("", !0) : (_(), n(T(ie), {
|
|
1290
|
+
key: 1,
|
|
1291
|
+
"inline-prompt": "",
|
|
1292
|
+
class: "ml-ribbon__control ml-ribbon__control--keytips",
|
|
1293
|
+
"active-text": Y.value.keyTipsToggleText,
|
|
1294
|
+
"inactive-text": Y.value.keyTipsToggleText,
|
|
1295
|
+
"model-value": T(P).keyTipsOpen.value,
|
|
1296
|
+
onChange: l[1] ||= (e) => T(P).keyTipsOpen.value = !T(P).keyTipsOpen.value
|
|
1297
|
+
}, null, 8, [
|
|
1298
|
+
"active-text",
|
|
1299
|
+
"inactive-text",
|
|
1300
|
+
"model-value"
|
|
1301
|
+
])),
|
|
1302
|
+
t.$slots["tabs-extra"] ? (_(), i("div", rt, [x(t.$slots, "tabs-extra", {
|
|
1303
|
+
activeTab: T(P).activeTab.value,
|
|
1304
|
+
layout: T(P).layout.value,
|
|
1305
|
+
minimized: T(P).minimized.value
|
|
1306
|
+
})])) : r("", !0)
|
|
1307
|
+
])]),
|
|
1308
|
+
!T(P).minimized.value && L.value && T(P).layout.value === "classic" ? (_(), i("main", {
|
|
1309
|
+
key: 0,
|
|
1310
|
+
class: "ml-ribbon__panel",
|
|
1311
|
+
"data-active-tab": L.value.id,
|
|
1312
|
+
ref_key: "classicPanelRef",
|
|
1313
|
+
ref: B
|
|
1314
|
+
}, [(_(!0), i(e, null, b(X.value, (e) => (_(), n($e, {
|
|
1315
|
+
id: e.id,
|
|
1316
|
+
key: e.id,
|
|
1317
|
+
"data-group-id": e.id,
|
|
1318
|
+
title: e.title,
|
|
1319
|
+
icon: e.icon,
|
|
1320
|
+
"group-icon-css": e.groupIconCss,
|
|
1321
|
+
orientation: e.orientation,
|
|
1322
|
+
"auto-width": e.autoWidth,
|
|
1323
|
+
priority: e.priority ?? 100,
|
|
1324
|
+
launcher: e.launcher,
|
|
1325
|
+
"show-launcher-icon": e.showLauncherIcon,
|
|
1326
|
+
"group-model": e,
|
|
1327
|
+
"overflow-trigger-aria-label": Y.value.groupOverflowTriggerAriaLabel,
|
|
1328
|
+
"gallery-preview-fallback": Y.value.galleryPreviewFallback,
|
|
1329
|
+
onItemClick: l[3] ||= (e) => De(e.groupId, e.itemId)
|
|
1330
|
+
}, {
|
|
1331
|
+
default: D(() => [c(We, {
|
|
1332
|
+
group: e,
|
|
1333
|
+
"gallery-preview-fallback": Y.value.galleryPreviewFallback,
|
|
1334
|
+
onItemClick: l[2] ||= (e) => De(e.groupId, e.itemId)
|
|
1335
|
+
}, null, 8, ["group", "gallery-preview-fallback"])]),
|
|
1336
|
+
_: 2
|
|
1337
|
+
}, 1032, [
|
|
1338
|
+
"id",
|
|
1339
|
+
"data-group-id",
|
|
1340
|
+
"title",
|
|
1341
|
+
"icon",
|
|
1342
|
+
"group-icon-css",
|
|
1343
|
+
"orientation",
|
|
1344
|
+
"auto-width",
|
|
1345
|
+
"priority",
|
|
1346
|
+
"launcher",
|
|
1347
|
+
"show-launcher-icon",
|
|
1348
|
+
"group-model",
|
|
1349
|
+
"overflow-trigger-aria-label",
|
|
1350
|
+
"gallery-preview-fallback"
|
|
1351
|
+
]))), 128)), Z.value.length ? (_(), i("section", at, [a("div", ot, [c(T(re), {
|
|
1352
|
+
trigger: "click",
|
|
1353
|
+
placement: "bottom-end",
|
|
1354
|
+
width: de.value,
|
|
1355
|
+
"popper-class": J.value,
|
|
1356
|
+
onShow: l[5] ||= (e) => T(P).overflowOpen.value = !0,
|
|
1357
|
+
onHide: l[6] ||= (e) => T(P).overflowOpen.value = !1
|
|
1358
|
+
}, {
|
|
1359
|
+
reference: D(() => [a("button", {
|
|
1360
|
+
type: "button",
|
|
1361
|
+
class: "ml-ribbon-overflow-trigger",
|
|
1362
|
+
"aria-label": Y.value.overflowTriggerAriaLabel
|
|
1363
|
+
}, [...l[8] ||= [a("span", { class: "ml-ribbon-overflow-trigger__dots" }, "...", -1)]], 8, st)]),
|
|
1364
|
+
default: D(() => [a("div", ct, [(_(!0), i(e, null, b(Z.value, (e) => (_(), i("section", {
|
|
1365
|
+
key: e.id,
|
|
1366
|
+
class: "ml-ribbon-overflow-group"
|
|
1367
|
+
}, [a("header", lt, C(e.title), 1), c(We, {
|
|
1368
|
+
group: e,
|
|
1369
|
+
"gallery-preview-fallback": Y.value.galleryPreviewFallback,
|
|
1370
|
+
onItemClick: l[4] ||= (e) => De(e.groupId, e.itemId)
|
|
1371
|
+
}, null, 8, ["group", "gallery-preview-fallback"])]))), 128))])]),
|
|
1372
|
+
_: 1
|
|
1373
|
+
}, 8, ["width", "popper-class"])]), l[9] ||= a("footer", { class: "ml-ribbon-group__footer ml-ribbon-group__footer--overflow" }, null, -1)])) : r("", !0)], 8, it)) : r("", !0),
|
|
1374
|
+
!T(P).minimized.value && L.value && T(P).layout.value === "simplified" ? (_(), i("main", {
|
|
1375
|
+
key: 1,
|
|
1376
|
+
class: "ml-ribbon__panel ml-ribbon__panel--simplified",
|
|
1377
|
+
"data-active-tab": L.value.id
|
|
1378
|
+
}, [(_(!0), i(e, null, b(z.value, (e) => (_(), n(T(re), {
|
|
1379
|
+
key: e.id,
|
|
1380
|
+
trigger: "click",
|
|
1381
|
+
placement: "bottom-start",
|
|
1382
|
+
width: 340,
|
|
1383
|
+
"popper-class": q.value
|
|
1384
|
+
}, {
|
|
1385
|
+
reference: D(() => [a("button", dt, [Me(e) ? (_(), n(T(F), {
|
|
1386
|
+
key: 0,
|
|
1387
|
+
class: "ml-ribbon-simplified-group__icon"
|
|
1388
|
+
}, {
|
|
1389
|
+
default: D(() => [(_(), n(S(Me(e))))]),
|
|
1390
|
+
_: 2
|
|
1391
|
+
}, 1024)) : r("", !0), a("span", null, C(e.title), 1)])]),
|
|
1392
|
+
default: D(() => [a("div", ft, [c(We, {
|
|
1393
|
+
group: fe(e),
|
|
1394
|
+
"gallery-preview-fallback": Y.value.galleryPreviewFallback,
|
|
1395
|
+
onItemClick: l[7] ||= (e) => De(e.groupId, e.itemId)
|
|
1396
|
+
}, null, 8, ["group", "gallery-preview-fallback"])])]),
|
|
1397
|
+
_: 2
|
|
1398
|
+
}, 1032, ["popper-class"]))), 128))], 8, ut)) : r("", !0),
|
|
1399
|
+
c(me, {
|
|
1400
|
+
open: T(P).backdropOpen.value,
|
|
1401
|
+
size: K.value,
|
|
1402
|
+
"back-label": Y.value.backstageBackLabel,
|
|
1403
|
+
title: Y.value.backstageTitle,
|
|
1404
|
+
description: Y.value.backstageDescription,
|
|
1405
|
+
onClose: Ee
|
|
1406
|
+
}, o({ _: 2 }, [t.$slots.backstage ? {
|
|
1407
|
+
name: "default",
|
|
1408
|
+
fn: D(() => [x(t.$slots, "backstage", {
|
|
1409
|
+
close: Ee,
|
|
1410
|
+
open: T(P).backdropOpen.value,
|
|
1411
|
+
size: K.value,
|
|
1412
|
+
backLabel: Y.value.backstageBackLabel,
|
|
1413
|
+
title: Y.value.backstageTitle,
|
|
1414
|
+
description: Y.value.backstageDescription
|
|
1415
|
+
})]),
|
|
1416
|
+
key: "0"
|
|
1417
|
+
} : void 0]), 1032, [
|
|
1418
|
+
"open",
|
|
1419
|
+
"size",
|
|
1420
|
+
"back-label",
|
|
1421
|
+
"title",
|
|
1422
|
+
"description"
|
|
1423
|
+
])
|
|
1424
|
+
], 2)]),
|
|
1425
|
+
_: 3
|
|
1426
|
+
}, 8, ["size"]));
|
|
1427
|
+
}
|
|
1428
|
+
}), ht = {
|
|
1429
|
+
class: "ml-ribbon-tab-definition",
|
|
1430
|
+
hidden: ""
|
|
1431
|
+
}, gt = /* @__PURE__ */ l({
|
|
1432
|
+
__name: "RibbonTab",
|
|
1433
|
+
props: {
|
|
1434
|
+
id: {},
|
|
1435
|
+
title: {},
|
|
1436
|
+
visible: { type: Boolean },
|
|
1437
|
+
contextual: { type: Boolean },
|
|
1438
|
+
contextualColor: {},
|
|
1439
|
+
contextualTitle: {}
|
|
1440
|
+
},
|
|
1441
|
+
setup(e) {
|
|
1442
|
+
return (e, t) => (_(), i("div", ht, [x(e.$slots, "default")]));
|
|
1443
|
+
}
|
|
1444
|
+
}), _t = {
|
|
1445
|
+
key: 0,
|
|
1446
|
+
class: "ml-ribbon-keytips",
|
|
1447
|
+
"aria-live": "polite"
|
|
1448
|
+
}, vt = { class: "ml-ribbon-keytips__hint" }, yt = /* @__PURE__ */ l({
|
|
1449
|
+
__name: "RibbonKeyTips",
|
|
1450
|
+
props: {
|
|
1451
|
+
open: { type: Boolean },
|
|
1452
|
+
tips: { default: () => [] },
|
|
1453
|
+
sequencePrefix: {},
|
|
1454
|
+
emptySequenceText: {}
|
|
1455
|
+
},
|
|
1456
|
+
emits: ["activate", "close"],
|
|
1457
|
+
setup(n, { emit: o }) {
|
|
1458
|
+
let s = n, c = o, l = y(""), u = t(() => l.value ? s.tips.filter((e) => e.key.toLowerCase().startsWith(l.value.toLowerCase())) : s.tips), d = t(() => l.value || s.emptySequenceText || ""), f = t(() => s.sequencePrefix ? `${s.sequencePrefix}${d.value}` : d.value), p = t(() => l.value.toLowerCase()), m = t(() => s.tips.filter((e) => e.key.toLowerCase() === p.value)), v = t(() => s.tips.some((e) => e.key.toLowerCase().startsWith(p.value)));
|
|
1459
|
+
function x() {
|
|
1460
|
+
l.value = "";
|
|
1461
|
+
}
|
|
1462
|
+
function S(e) {
|
|
1463
|
+
if (s.open && !(e.altKey || e.ctrlKey || e.metaKey)) {
|
|
1464
|
+
if (e.key === "Escape") {
|
|
1465
|
+
e.preventDefault(), x(), c("close");
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
if (e.key === "Backspace") {
|
|
1469
|
+
e.preventDefault(), l.value = l.value.slice(0, -1);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
if (/^[a-z0-9]$/i.test(e.key)) {
|
|
1473
|
+
if (e.preventDefault(), l.value += e.key.toUpperCase(), m.value.length > 0) {
|
|
1474
|
+
c("activate", m.value[0]), x();
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
v.value || x();
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
return h(() => window.addEventListener("keydown", S)), g(() => window.removeEventListener("keydown", S)), E(() => s.open, (e) => {
|
|
1482
|
+
e || x();
|
|
1483
|
+
}), (t, o) => n.open ? (_(), i("div", _t, [a("div", vt, C(f.value), 1), (_(!0), i(e, null, b(u.value, (e) => (_(), i("span", {
|
|
1484
|
+
key: e.id,
|
|
1485
|
+
class: "ml-ribbon-keytip"
|
|
1486
|
+
}, C(e.key), 1))), 128))])) : r("", !0);
|
|
1487
|
+
}
|
|
1488
|
+
});
|
|
1489
|
+
//#endregion
|
|
1490
|
+
export { mt as MlRibbon, me as MlRibbonBackstage, Ce as MlRibbonCollection, xe as MlRibbonContextualTabs, Se as MlRibbonFileMenu, Q as MlRibbonGallery, $e as MlRibbonGroup, $ as MlRibbonGroupButton, Ue as MlRibbonItemHost, yt as MlRibbonKeyTips, gt as MlRibbonTab, _e as MlRibbonTabs, Pe as MlRibbonTemplateItem };
|