@digitalwalletcorp/vue-core 1.4.3 → 1.4.5
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 +8 -3
- package/lib/{components-ytOBcKlQ.cjs → components-Dniui6mw.cjs} +1 -1
- package/lib/{components-Mk1fpjbw.js → components-gKR_xoi-.js} +1 -1
- package/lib/copy-button.d.cts +6 -0
- package/lib/copy-button.d.ts +6 -0
- package/lib/help-button.d.cts +2 -2
- package/lib/help-button.d.ts +2 -2
- package/lib/help-popper.d.cts +2 -2
- package/lib/help-popper.d.ts +2 -2
- package/lib/helpers/snackbar.d.cts +17 -2
- package/lib/helpers/snackbar.d.ts +17 -2
- package/lib/helpers/vue-core-options.d.cts +12 -1
- package/lib/helpers/vue-core-options.d.ts +12 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +139 -265
- package/lib/internal/anchored-popover.d.cts +2 -2
- package/lib/internal/anchored-popover.d.ts +2 -2
- package/lib/internal/date-format.d.cts +9 -0
- package/lib/internal/date-format.d.ts +9 -0
- package/lib/internal/icon-popper.d.cts +2 -2
- package/lib/internal/icon-popper.d.ts +2 -2
- package/lib/nuxt.cjs +1 -1
- package/lib/nuxt.js +1 -1
- package/lib/register.cjs +1 -1
- package/lib/register.js +1 -1
- package/lib/style.css +1 -1
- package/lib/warning-popper.d.cts +2 -2
- package/lib/warning-popper.d.ts +2 -2
- package/lib/warning-popper.vue_vue_type_style_index_0_lang-BxdfpRXg.cjs +4 -0
- package/lib/warning-popper.vue_vue_type_style_index_0_lang-DuzeuEx2.js +2178 -0
- package/package.json +1 -1
- package/src/copy-button.vue +14 -1
- package/src/helpers/snackbar.ts +34 -3
- package/src/helpers/vue-core-options.ts +13 -1
- package/src/index.ts +2 -2
- package/src/internal/date-format.ts +25 -0
- package/lib/warning-popper.vue_vue_type_style_index_0_lang-142lRixg.cjs +0 -4
- package/lib/warning-popper.vue_vue_type_style_index_0_lang-BKR56ef2.js +0 -2019
|
@@ -0,0 +1,2178 @@
|
|
|
1
|
+
import { defineComponent as O, useSlots as Z, openBlock as u, createElementBlock as f, normalizeStyle as F, renderSlot as x, createBlock as j, resolveDynamicComponent as te, mergeProps as le, createCommentVNode as T, normalizeClass as I, createTextVNode as Q, toDisplayString as A, ref as B, onMounted as X, onBeforeUnmount as G, useModel as re, computed as E, createElementVNode as b, createVNode as D, unref as _, createSlots as de, withCtx as H, mergeModels as J, withModifiers as ee, normalizeProps as je, guardReactiveProps as We, TransitionGroup as ct, Fragment as K, renderList as U, getCurrentInstance as Ke, inject as ke, toValue as ut, shallowReactive as pt, render as pe, h as me, shallowRef as mt, watch as Y, withKeys as we, useAttrs as Fe, useId as se, reactive as Te, Transition as vt, provide as ft, Teleport as gt } from "vue";
|
|
2
|
+
import { SvgTriangleButton as Ve, SvgWastebasket as bt, SvgMemo as ht, SvgHighBrightness as wt, SvgMoonPhases as yt, SvgChevronDouble as Ee, SvgChevron as Me, SvgBlackArrow as Ae, SvgFolderDownload as _t, SvgCloudDownload as $t, SvgPointingTriangle as kt, SvgQuestion as Ce, SvgHourglass as Ct, SvgCritical as St, SvgWarningSign as Ge, SvgInfo as xt, SvgNegativeSquaredCrossMark as Pt, SvgCornerDiagonal as Bt, SvgRoundPushpin as Lt, SvgPushpin as Tt, SvgSquare as Et, SvgCircle as Mt, SvgDiamond as At } from "@digitalwalletcorp/vue-svg-icons";
|
|
3
|
+
const oe = /* @__PURE__ */ O({
|
|
4
|
+
__name: "label-icon",
|
|
5
|
+
props: {
|
|
6
|
+
preset: {},
|
|
7
|
+
gap: {},
|
|
8
|
+
iconClass: { type: [Boolean, null, String, Object, Array] },
|
|
9
|
+
iconStyle: { type: [Boolean, null, String, Object, Array] },
|
|
10
|
+
labelClass: { type: [Boolean, null, String, Object, Array] },
|
|
11
|
+
labelStyle: { type: [Boolean, null, String, Object, Array] }
|
|
12
|
+
},
|
|
13
|
+
setup(n) {
|
|
14
|
+
const t = n, e = Z();
|
|
15
|
+
return (o, a) => (u(), f("span", {
|
|
16
|
+
class: "dwui-label-icon",
|
|
17
|
+
style: F(t.gap == null ? void 0 : { "--dwui-gap-label-icon": t.gap })
|
|
18
|
+
}, [
|
|
19
|
+
x(o.$slots, "icon", {}, () => [
|
|
20
|
+
t.preset != null ? (u(), j(te(t.preset.icon), le({ key: 0 }, t.preset.iconProps, {
|
|
21
|
+
class: t.iconClass,
|
|
22
|
+
style: t.iconStyle
|
|
23
|
+
}), null, 16, ["class", "style"])) : T("", !0)
|
|
24
|
+
]),
|
|
25
|
+
e.default != null || t.preset != null ? (u(), f("span", {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: I(["dwui-label", t.labelClass]),
|
|
28
|
+
style: F(t.labelStyle)
|
|
29
|
+
}, [
|
|
30
|
+
x(o.$slots, "default", {}, () => [
|
|
31
|
+
Q(A(typeof t.preset?.label == "function" ? t.preset.label() : t.preset?.label), 1)
|
|
32
|
+
])
|
|
33
|
+
], 6)) : T("", !0)
|
|
34
|
+
], 4));
|
|
35
|
+
}
|
|
36
|
+
}), Ot = 70;
|
|
37
|
+
function Ue(n) {
|
|
38
|
+
const t = B(!0);
|
|
39
|
+
let e;
|
|
40
|
+
return X(() => {
|
|
41
|
+
const o = n.value;
|
|
42
|
+
o != null && (e = new ResizeObserver(() => {
|
|
43
|
+
t.value = Ot <= o.scrollHeight;
|
|
44
|
+
}), e.observe(o));
|
|
45
|
+
}), G(() => {
|
|
46
|
+
e?.disconnect();
|
|
47
|
+
}), t;
|
|
48
|
+
}
|
|
49
|
+
const Dt = ["disabled"], It = { class: "dwui-accordion-legend" }, Nt = ["aria-expanded"], Dn = /* @__PURE__ */ O({
|
|
50
|
+
__name: "accordion-fieldset",
|
|
51
|
+
props: /* @__PURE__ */ J({
|
|
52
|
+
legend: {},
|
|
53
|
+
disabled: { type: Boolean },
|
|
54
|
+
initialExpand: { type: Boolean }
|
|
55
|
+
}, {
|
|
56
|
+
expanded: { type: Boolean, default: void 0 },
|
|
57
|
+
expandedModifiers: {}
|
|
58
|
+
}),
|
|
59
|
+
emits: ["update:expanded"],
|
|
60
|
+
setup(n) {
|
|
61
|
+
const t = n, e = Z(), o = B(), a = re(n, "expanded"), l = B(!!t.initialExpand), s = E({
|
|
62
|
+
get: () => a.value ?? l.value,
|
|
63
|
+
set: (r) => {
|
|
64
|
+
l.value = r, a.value = r;
|
|
65
|
+
}
|
|
66
|
+
}), p = Ue(o), i = () => {
|
|
67
|
+
s.value = !s.value;
|
|
68
|
+
};
|
|
69
|
+
return (r, h) => (u(), f("fieldset", {
|
|
70
|
+
class: "dwui-accordion-fieldset",
|
|
71
|
+
disabled: t.disabled
|
|
72
|
+
}, [
|
|
73
|
+
b("legend", It, [
|
|
74
|
+
b("button", {
|
|
75
|
+
type: "button",
|
|
76
|
+
class: "dwui-accordion-toggle",
|
|
77
|
+
"aria-expanded": s.value,
|
|
78
|
+
onClick: i
|
|
79
|
+
}, [
|
|
80
|
+
D(_(Ve), {
|
|
81
|
+
direction: s.value ? "up" : "down"
|
|
82
|
+
}, null, 8, ["direction"]),
|
|
83
|
+
t.legend != null || e.legend != null || e.icon != null ? (u(), j(oe, { key: 0 }, de({ _: 2 }, [
|
|
84
|
+
e.icon != null ? {
|
|
85
|
+
name: "icon",
|
|
86
|
+
fn: H(() => [
|
|
87
|
+
x(r.$slots, "icon")
|
|
88
|
+
]),
|
|
89
|
+
key: "0"
|
|
90
|
+
} : void 0,
|
|
91
|
+
t.legend != null || e.legend != null ? {
|
|
92
|
+
name: "default",
|
|
93
|
+
fn: H(() => [
|
|
94
|
+
x(r.$slots, "legend", {}, () => [
|
|
95
|
+
Q(A(t.legend), 1)
|
|
96
|
+
])
|
|
97
|
+
]),
|
|
98
|
+
key: "1"
|
|
99
|
+
} : void 0
|
|
100
|
+
]), 1024)) : T("", !0)
|
|
101
|
+
], 8, Nt)
|
|
102
|
+
]),
|
|
103
|
+
b("div", {
|
|
104
|
+
ref_key: "refContents",
|
|
105
|
+
ref: o,
|
|
106
|
+
class: I(["dwui-accordion-contents", _(p) ? s.value ? "dwui-expanded" : "dwui-shrunk" : ""])
|
|
107
|
+
}, [
|
|
108
|
+
x(r.$slots, "default")
|
|
109
|
+
], 2)
|
|
110
|
+
], 8, Dt));
|
|
111
|
+
}
|
|
112
|
+
}), zt = { class: "dwui-accordion-section" }, Ht = {
|
|
113
|
+
key: 0,
|
|
114
|
+
class: "dwui-accordion-section-control"
|
|
115
|
+
}, Rt = ["disabled", "aria-expanded"], In = /* @__PURE__ */ O({
|
|
116
|
+
__name: "accordion-section",
|
|
117
|
+
props: /* @__PURE__ */ J({
|
|
118
|
+
disabled: { type: Boolean },
|
|
119
|
+
initialExpand: { type: Boolean },
|
|
120
|
+
noGradient: { type: Boolean },
|
|
121
|
+
expandLabel: {},
|
|
122
|
+
collapseLabel: {},
|
|
123
|
+
expandPreset: {},
|
|
124
|
+
collapsePreset: {}
|
|
125
|
+
}, {
|
|
126
|
+
expanded: { type: Boolean, default: void 0 },
|
|
127
|
+
expandedModifiers: {}
|
|
128
|
+
}),
|
|
129
|
+
emits: ["update:expanded"],
|
|
130
|
+
setup(n) {
|
|
131
|
+
const t = n, e = Z(), o = B(), a = re(n, "expanded"), l = B(!!t.initialExpand), s = E({
|
|
132
|
+
get: () => a.value ?? l.value,
|
|
133
|
+
set: (C) => {
|
|
134
|
+
l.value = C, a.value = C;
|
|
135
|
+
}
|
|
136
|
+
}), p = Ue(o), i = E(() => s.value ? t.collapsePreset : t.expandPreset), r = () => (s.value ? e["collapse-icon"] : e["expand-icon"]) ?? i.value?.icon, h = () => (s.value ? e["collapse-icon"] : e["expand-icon"]) == null ? i.value?.iconProps : void 0, v = E(() => {
|
|
137
|
+
const C = s.value ? t.collapseLabel : t.expandLabel;
|
|
138
|
+
if (C != null)
|
|
139
|
+
return C;
|
|
140
|
+
const P = i.value?.label;
|
|
141
|
+
return typeof P == "function" ? P() : P;
|
|
142
|
+
}), m = () => {
|
|
143
|
+
s.value = !s.value;
|
|
144
|
+
};
|
|
145
|
+
return (C, P) => (u(), f("div", zt, [
|
|
146
|
+
b("div", {
|
|
147
|
+
ref_key: "refContents",
|
|
148
|
+
ref: o,
|
|
149
|
+
class: I(["dwui-accordion-section-contents", [
|
|
150
|
+
_(p) ? s.value ? "dwui-expanded" : "dwui-shrunk" : "",
|
|
151
|
+
{ "dwui-no-gradient": t.noGradient }
|
|
152
|
+
]])
|
|
153
|
+
}, [
|
|
154
|
+
x(C.$slots, "default")
|
|
155
|
+
], 2),
|
|
156
|
+
_(p) ? (u(), f("div", Ht, [
|
|
157
|
+
b("button", {
|
|
158
|
+
type: "button",
|
|
159
|
+
class: "dwui-accordion-section-toggle",
|
|
160
|
+
disabled: t.disabled,
|
|
161
|
+
"aria-expanded": s.value,
|
|
162
|
+
onClick: ee(m, ["stop"])
|
|
163
|
+
}, [
|
|
164
|
+
r() != null || v.value != null ? (u(), j(oe, { key: 0 }, de({ _: 2 }, [
|
|
165
|
+
r() != null ? {
|
|
166
|
+
name: "icon",
|
|
167
|
+
fn: H(() => [
|
|
168
|
+
(u(), j(te(r()), je(We(h())), null, 16))
|
|
169
|
+
]),
|
|
170
|
+
key: "0"
|
|
171
|
+
} : void 0,
|
|
172
|
+
v.value != null ? {
|
|
173
|
+
name: "default",
|
|
174
|
+
fn: H(() => [
|
|
175
|
+
Q(A(v.value), 1)
|
|
176
|
+
]),
|
|
177
|
+
key: "1"
|
|
178
|
+
} : void 0
|
|
179
|
+
]), 1024)) : (u(), j(_(Ve), {
|
|
180
|
+
key: 1,
|
|
181
|
+
direction: s.value ? "up" : "down"
|
|
182
|
+
}, null, 8, ["direction"]))
|
|
183
|
+
], 8, Rt)
|
|
184
|
+
])) : T("", !0)
|
|
185
|
+
]));
|
|
186
|
+
}
|
|
187
|
+
}), Xe = /* @__PURE__ */ Symbol("dwui-vue-core-options"), jt = ["aria-label", "title"], Wt = ["title", "onClick"], Kt = {
|
|
188
|
+
key: 0,
|
|
189
|
+
class: "dwui-snackbar-header"
|
|
190
|
+
}, Ft = {
|
|
191
|
+
key: 0,
|
|
192
|
+
class: "dwui-snackbar-title"
|
|
193
|
+
}, Vt = {
|
|
194
|
+
key: 1,
|
|
195
|
+
class: "dwui-snackbar-label"
|
|
196
|
+
}, Gt = { class: "dwui-snackbar-message" }, Ut = {
|
|
197
|
+
key: 1,
|
|
198
|
+
class: "dwui-snackbar-timestamp"
|
|
199
|
+
}, Xt = /* @__PURE__ */ O({
|
|
200
|
+
__name: "snackbar-container",
|
|
201
|
+
props: {
|
|
202
|
+
placement: {},
|
|
203
|
+
direction: {},
|
|
204
|
+
items: {}
|
|
205
|
+
},
|
|
206
|
+
emits: ["emit:close", "emit:clear", "emit:afterLeave"],
|
|
207
|
+
setup(n, { emit: t }) {
|
|
208
|
+
const e = n, o = t, a = E(() => {
|
|
209
|
+
const [s, p = "center"] = e.placement.split("-");
|
|
210
|
+
return [
|
|
211
|
+
`dwui-snackbar-container-${s}`,
|
|
212
|
+
`dwui-snackbar-container-${p}`,
|
|
213
|
+
`dwui-snackbar-container-${e.direction}`
|
|
214
|
+
];
|
|
215
|
+
}), l = E(() => e.items.filter((s) => s.clearable).at(-1)?.clearLabel);
|
|
216
|
+
return (s, p) => (u(), j(ct, {
|
|
217
|
+
tag: "div",
|
|
218
|
+
name: "dwui-snackbar-fade",
|
|
219
|
+
class: I(["dwui-snackbar-container", a.value]),
|
|
220
|
+
role: "status",
|
|
221
|
+
onAfterLeave: p[1] || (p[1] = (i) => o("emit:afterLeave"))
|
|
222
|
+
}, {
|
|
223
|
+
default: H(() => [
|
|
224
|
+
l.value != null ? (u(), f("button", {
|
|
225
|
+
key: "clear",
|
|
226
|
+
type: "button",
|
|
227
|
+
class: "dwui-snackbar-clear-button",
|
|
228
|
+
"aria-label": l.value,
|
|
229
|
+
title: l.value,
|
|
230
|
+
onClick: p[0] || (p[0] = (i) => o("emit:clear"))
|
|
231
|
+
}, [
|
|
232
|
+
D(_(bt))
|
|
233
|
+
], 8, jt)) : T("", !0),
|
|
234
|
+
(u(!0), f(K, null, U(e.items, (i) => (u(), f("button", {
|
|
235
|
+
key: i.id,
|
|
236
|
+
type: "button",
|
|
237
|
+
class: I(["dwui-snackbar", i.class]),
|
|
238
|
+
style: F(i.style),
|
|
239
|
+
title: i.message,
|
|
240
|
+
onClick: (r) => o("emit:close", i.id)
|
|
241
|
+
}, [
|
|
242
|
+
i.title || i.label ? (u(), f("span", Kt, [
|
|
243
|
+
i.title ? (u(), f("span", Ft, A(i.title), 1)) : T("", !0),
|
|
244
|
+
i.label ? (u(), f("span", Vt, A(i.label), 1)) : T("", !0)
|
|
245
|
+
])) : T("", !0),
|
|
246
|
+
b("span", Gt, A(i.message), 1),
|
|
247
|
+
i.timestamp ? (u(), f("span", Ut, A(i.timestamp), 1)) : T("", !0)
|
|
248
|
+
], 14, Wt))), 128))
|
|
249
|
+
]),
|
|
250
|
+
_: 1
|
|
251
|
+
}, 8, ["class"]));
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
function Yt(n, t = /* @__PURE__ */ new Date()) {
|
|
255
|
+
const e = new Intl.DateTimeFormat("en-US", {
|
|
256
|
+
timeZone: n || "UTC",
|
|
257
|
+
hourCycle: "h23",
|
|
258
|
+
year: "numeric",
|
|
259
|
+
month: "2-digit",
|
|
260
|
+
day: "2-digit",
|
|
261
|
+
hour: "2-digit",
|
|
262
|
+
minute: "2-digit",
|
|
263
|
+
second: "2-digit",
|
|
264
|
+
timeZoneName: "longOffset"
|
|
265
|
+
}).formatToParts(t), o = (l) => e.find((s) => s.type === l)?.value ?? "", a = o("timeZoneName").replace(/^GMT/, "") || "+00:00";
|
|
266
|
+
return `${o("year")}-${o("month")}-${o("day")} ${o("hour")}:${o("minute")}:${o("second")}${a}`;
|
|
267
|
+
}
|
|
268
|
+
const qt = 50, ae = /* @__PURE__ */ new Map(), ye = /* @__PURE__ */ new Map();
|
|
269
|
+
let Oe = 0;
|
|
270
|
+
const ve = (n, t, e) => {
|
|
271
|
+
const o = n.findIndex((l) => l.id === t);
|
|
272
|
+
if (o < 0)
|
|
273
|
+
return;
|
|
274
|
+
n.splice(o, 1);
|
|
275
|
+
const a = ye.get(t);
|
|
276
|
+
ye.delete(t), clearTimeout(a?.timer), a?.onClose?.(e);
|
|
277
|
+
}, Ye = (n) => {
|
|
278
|
+
const t = n.map((e) => e.id);
|
|
279
|
+
for (let e = 0; e < t.length; e++)
|
|
280
|
+
setTimeout(() => ve(n, t[e], "clear"), qt * e);
|
|
281
|
+
}, Jt = (n, t) => {
|
|
282
|
+
const e = `${n} ${t}`, o = ae.get(e);
|
|
283
|
+
if (o)
|
|
284
|
+
return o;
|
|
285
|
+
const a = document.createElement("div");
|
|
286
|
+
document.body.appendChild(a);
|
|
287
|
+
const l = pt([]);
|
|
288
|
+
return ae.set(e, l), pe(me(Xt, {
|
|
289
|
+
placement: n,
|
|
290
|
+
direction: t,
|
|
291
|
+
items: l,
|
|
292
|
+
"onEmit:close": (s) => ve(l, s, "click"),
|
|
293
|
+
"onEmit:clear": () => Ye(l),
|
|
294
|
+
"onEmit:afterLeave": () => {
|
|
295
|
+
l.length === 0 && ae.get(e) === l && (ae.delete(e), pe(null, a), a.remove());
|
|
296
|
+
}
|
|
297
|
+
}), a), l;
|
|
298
|
+
};
|
|
299
|
+
function Zt(n, t) {
|
|
300
|
+
const {
|
|
301
|
+
placement: e = "bottom",
|
|
302
|
+
direction: o = "overlap",
|
|
303
|
+
duration: a,
|
|
304
|
+
clearable: l = !1,
|
|
305
|
+
clearLabel: s = "Clear all",
|
|
306
|
+
timezone: p,
|
|
307
|
+
onClose: i,
|
|
308
|
+
...r
|
|
309
|
+
} = t ?? {}, h = p === !1 ? void 0 : Yt(p ?? ""), v = Jt(e, o);
|
|
310
|
+
Oe += 1;
|
|
311
|
+
const m = Oe;
|
|
312
|
+
return v.push({
|
|
313
|
+
...r,
|
|
314
|
+
id: m,
|
|
315
|
+
message: n,
|
|
316
|
+
timestamp: h,
|
|
317
|
+
clearable: l,
|
|
318
|
+
clearLabel: s
|
|
319
|
+
}), ye.set(m, {
|
|
320
|
+
timer: a ? setTimeout(() => ve(v, m, "duration"), a) : void 0,
|
|
321
|
+
onClose: i
|
|
322
|
+
}), {
|
|
323
|
+
close: () => ve(v, m, "handle")
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function Nn() {
|
|
327
|
+
for (const n of ae.values())
|
|
328
|
+
Ye(n);
|
|
329
|
+
}
|
|
330
|
+
function Qt() {
|
|
331
|
+
if (!Ke())
|
|
332
|
+
throw new Error("useSnackbar() must be called inside setup().");
|
|
333
|
+
const n = ke(Xe, void 0);
|
|
334
|
+
return {
|
|
335
|
+
showSnackbar: (t, e) => Zt(t, {
|
|
336
|
+
...e,
|
|
337
|
+
timezone: e?.timezone ?? ut(n?.snackbar?.timezone)
|
|
338
|
+
})
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
const eo = ["aria-label"], zn = /* @__PURE__ */ O({
|
|
342
|
+
__name: "copy-button",
|
|
343
|
+
props: {
|
|
344
|
+
value: {},
|
|
345
|
+
label: { default: "Copy" },
|
|
346
|
+
copiedMessage: { default: void 0 },
|
|
347
|
+
copiedDuration: { default: 5e3 }
|
|
348
|
+
},
|
|
349
|
+
emits: ["emit:copy", "emit:error"],
|
|
350
|
+
setup(n, { emit: t }) {
|
|
351
|
+
const e = n, o = t, a = Z(), { showSnackbar: l } = Qt(), s = async () => {
|
|
352
|
+
const p = String(typeof e.value == "function" ? e.value() : e.value);
|
|
353
|
+
try {
|
|
354
|
+
await navigator.clipboard.writeText(p);
|
|
355
|
+
} catch (i) {
|
|
356
|
+
o("emit:error", i);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
o("emit:copy", p), e.copiedMessage && l(e.copiedMessage, { duration: e.copiedDuration });
|
|
360
|
+
};
|
|
361
|
+
return (p, i) => (u(), f("button", {
|
|
362
|
+
type: "button",
|
|
363
|
+
class: "dwui-copy-button",
|
|
364
|
+
"aria-label": a.default ? void 0 : e.label,
|
|
365
|
+
onClick: s
|
|
366
|
+
}, [
|
|
367
|
+
x(p.$slots, "default", {}, () => [
|
|
368
|
+
D(_(ht))
|
|
369
|
+
])
|
|
370
|
+
], 8, eo));
|
|
371
|
+
}
|
|
372
|
+
}), to = ["aria-label", "aria-checked"], oo = { class: "dwui-dark-mode-selector-track" }, no = { class: "dwui-dark-mode-selector-icon-light" }, ao = { class: "dwui-dark-mode-selector-icon-dark" }, Hn = /* @__PURE__ */ O({
|
|
373
|
+
__name: "dark-mode-selector",
|
|
374
|
+
props: {
|
|
375
|
+
storageKey: { default: "dwui-color-scheme" },
|
|
376
|
+
label: { default: "Dark mode" }
|
|
377
|
+
},
|
|
378
|
+
emits: ["emit:change"],
|
|
379
|
+
setup(n, { emit: t }) {
|
|
380
|
+
const e = n, o = t, a = B(!1);
|
|
381
|
+
let l = null, s = null;
|
|
382
|
+
const p = (k) => k === "light" || k === "dark", i = () => s?.matches ? "dark" : "light", r = () => {
|
|
383
|
+
try {
|
|
384
|
+
const k = localStorage.getItem(e.storageKey);
|
|
385
|
+
return p(k) ? k : null;
|
|
386
|
+
} catch {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
}, h = (k) => {
|
|
390
|
+
const c = document.documentElement.classList;
|
|
391
|
+
c.remove(k === "dark" ? "light" : "dark"), c.add(k), a.value = k === "dark", l !== k && (l = k, o("emit:change", k));
|
|
392
|
+
}, v = (k) => {
|
|
393
|
+
try {
|
|
394
|
+
localStorage.setItem(e.storageKey, k);
|
|
395
|
+
} catch {
|
|
396
|
+
}
|
|
397
|
+
h(k);
|
|
398
|
+
}, m = () => {
|
|
399
|
+
v(a.value ? "light" : "dark");
|
|
400
|
+
}, C = (k) => {
|
|
401
|
+
v(k.matches ? "dark" : "light");
|
|
402
|
+
}, P = (k) => {
|
|
403
|
+
k.key === e.storageKey && h(p(k.newValue) ? k.newValue : i());
|
|
404
|
+
};
|
|
405
|
+
return X(() => {
|
|
406
|
+
s = window.matchMedia("(prefers-color-scheme: dark)"), h(r() ?? i()), s.addEventListener("change", C), window.addEventListener("storage", P);
|
|
407
|
+
}), G(() => {
|
|
408
|
+
s?.removeEventListener("change", C), window.removeEventListener("storage", P);
|
|
409
|
+
}), (k, c) => (u(), f("button", {
|
|
410
|
+
type: "button",
|
|
411
|
+
role: "switch",
|
|
412
|
+
class: "dwui-dark-mode-selector",
|
|
413
|
+
"aria-label": e.label,
|
|
414
|
+
"aria-checked": a.value,
|
|
415
|
+
onClick: m
|
|
416
|
+
}, [
|
|
417
|
+
b("span", oo, [
|
|
418
|
+
b("span", no, [
|
|
419
|
+
x(k.$slots, "icon-light", {}, () => [
|
|
420
|
+
D(_(wt))
|
|
421
|
+
])
|
|
422
|
+
]),
|
|
423
|
+
b("span", ao, [
|
|
424
|
+
x(k.$slots, "icon-dark", {}, () => [
|
|
425
|
+
D(_(yt), { "moon-age": 3.85 })
|
|
426
|
+
])
|
|
427
|
+
])
|
|
428
|
+
]),
|
|
429
|
+
c[0] || (c[0] = b("span", { class: "dwui-dark-mode-selector-handle" }, null, -1))
|
|
430
|
+
], 8, to));
|
|
431
|
+
}
|
|
432
|
+
}), lo = { class: "dwui-pagination" }, so = { class: "dwui-pagination-list" }, io = ["disabled", "aria-label", "title"], ro = ["disabled", "aria-label", "title"], co = ["disabled", "aria-label", "title"], uo = ["aria-current", "onClick"], po = ["disabled", "aria-label", "title"], mo = ["disabled", "aria-label", "title"], vo = ["disabled", "aria-label", "title"], fo = {
|
|
433
|
+
key: 0,
|
|
434
|
+
class: "dwui-pagination-select"
|
|
435
|
+
}, go = ["value", "disabled"], bo = ["value"], ho = /* @__PURE__ */ O({
|
|
436
|
+
__name: "pagination",
|
|
437
|
+
props: {
|
|
438
|
+
current: {},
|
|
439
|
+
totalCount: {},
|
|
440
|
+
limit: {},
|
|
441
|
+
maxPagination: {},
|
|
442
|
+
showPageSelect: { type: Boolean },
|
|
443
|
+
labels: {}
|
|
444
|
+
},
|
|
445
|
+
emits: ["emit:changePage"],
|
|
446
|
+
setup(n, { emit: t }) {
|
|
447
|
+
const e = n, o = t, a = E(() => Math.ceil(e.totalCount / e.limit)), l = E(() => Math.min(Math.max(e.current, 1), a.value)), s = B(!1), p = E(() => a.value < 1 ? [] : s.value ? Array.from({ length: a.value }, (c, S) => S + 1) : [l.value]), i = E(() => {
|
|
448
|
+
if (a.value < 1)
|
|
449
|
+
return [];
|
|
450
|
+
const c = Math.min(
|
|
451
|
+
Math.max(l.value - Math.floor((e.maxPagination - 1) / 2), 1),
|
|
452
|
+
Math.max(a.value - e.maxPagination + 1, 1)
|
|
453
|
+
), S = Math.min(c + e.maxPagination - 1, a.value);
|
|
454
|
+
return Array.from({ length: S - c + 1 }, (w, N) => c + N);
|
|
455
|
+
}), r = (c) => {
|
|
456
|
+
c !== e.current && o("emit:changePage", c);
|
|
457
|
+
}, h = (c) => {
|
|
458
|
+
let S;
|
|
459
|
+
c < 0 ? S = Math.max(i.value[0] - e.maxPagination, 1) : S = Math.min(i.value[i.value.length - 1] + e.maxPagination, a.value) - e.maxPagination + 1, r(S + Math.round((e.maxPagination - 1) / 2));
|
|
460
|
+
}, v = (c) => {
|
|
461
|
+
r(Number(c.target.value));
|
|
462
|
+
}, m = () => {
|
|
463
|
+
s.value = !0;
|
|
464
|
+
}, C = (c) => {
|
|
465
|
+
document.activeElement !== c.currentTarget && (s.value = !1);
|
|
466
|
+
}, P = () => {
|
|
467
|
+
s.value = !0;
|
|
468
|
+
}, k = () => {
|
|
469
|
+
s.value = !1;
|
|
470
|
+
};
|
|
471
|
+
return (c, S) => (u(), f("div", lo, [
|
|
472
|
+
b("ul", so, [
|
|
473
|
+
b("li", null, [
|
|
474
|
+
b("button", {
|
|
475
|
+
type: "button",
|
|
476
|
+
disabled: l.value <= 1,
|
|
477
|
+
"aria-label": e.labels.firstPage,
|
|
478
|
+
title: e.labels.firstPage,
|
|
479
|
+
onClick: S[0] || (S[0] = (w) => r(1))
|
|
480
|
+
}, [
|
|
481
|
+
D(_(Ee), {
|
|
482
|
+
direction: "left",
|
|
483
|
+
size: "1em",
|
|
484
|
+
"stroke-width": 8
|
|
485
|
+
})
|
|
486
|
+
], 8, io)
|
|
487
|
+
]),
|
|
488
|
+
b("li", null, [
|
|
489
|
+
b("button", {
|
|
490
|
+
type: "button",
|
|
491
|
+
disabled: l.value <= 1,
|
|
492
|
+
"aria-label": e.labels.previousPage,
|
|
493
|
+
title: e.labels.previousPage,
|
|
494
|
+
onClick: S[1] || (S[1] = (w) => r(l.value - 1))
|
|
495
|
+
}, [
|
|
496
|
+
D(_(Me), {
|
|
497
|
+
direction: "left",
|
|
498
|
+
size: "1em",
|
|
499
|
+
"stroke-width": 8
|
|
500
|
+
})
|
|
501
|
+
], 8, ro)
|
|
502
|
+
]),
|
|
503
|
+
b("li", null, [
|
|
504
|
+
b("button", {
|
|
505
|
+
type: "button",
|
|
506
|
+
disabled: i.value.length === 0 || i.value[0] === 1,
|
|
507
|
+
"aria-label": e.labels.previousPages,
|
|
508
|
+
title: e.labels.previousPages,
|
|
509
|
+
onClick: S[2] || (S[2] = (w) => h(-1))
|
|
510
|
+
}, [
|
|
511
|
+
D(_(Ae), {
|
|
512
|
+
direction: "left",
|
|
513
|
+
size: "1em"
|
|
514
|
+
})
|
|
515
|
+
], 8, co)
|
|
516
|
+
]),
|
|
517
|
+
(u(!0), f(K, null, U(i.value, (w) => (u(), f("li", { key: w }, [
|
|
518
|
+
b("button", {
|
|
519
|
+
type: "button",
|
|
520
|
+
class: I(["dwui-pagination-page", { "dwui-current": w === l.value }]),
|
|
521
|
+
"aria-current": w === l.value ? "page" : void 0,
|
|
522
|
+
onClick: (N) => r(w)
|
|
523
|
+
}, A(w), 11, uo)
|
|
524
|
+
]))), 128)),
|
|
525
|
+
b("li", null, [
|
|
526
|
+
b("button", {
|
|
527
|
+
type: "button",
|
|
528
|
+
disabled: i.value.length === 0 || i.value[i.value.length - 1] === a.value,
|
|
529
|
+
"aria-label": e.labels.nextPages,
|
|
530
|
+
title: e.labels.nextPages,
|
|
531
|
+
onClick: S[3] || (S[3] = (w) => h(1))
|
|
532
|
+
}, [
|
|
533
|
+
D(_(Ae), {
|
|
534
|
+
direction: "right",
|
|
535
|
+
size: "1em"
|
|
536
|
+
})
|
|
537
|
+
], 8, po)
|
|
538
|
+
]),
|
|
539
|
+
b("li", null, [
|
|
540
|
+
b("button", {
|
|
541
|
+
type: "button",
|
|
542
|
+
disabled: a.value <= l.value,
|
|
543
|
+
"aria-label": e.labels.nextPage,
|
|
544
|
+
title: e.labels.nextPage,
|
|
545
|
+
onClick: S[4] || (S[4] = (w) => r(l.value + 1))
|
|
546
|
+
}, [
|
|
547
|
+
D(_(Me), {
|
|
548
|
+
direction: "right",
|
|
549
|
+
size: "1em",
|
|
550
|
+
"stroke-width": 8
|
|
551
|
+
})
|
|
552
|
+
], 8, mo)
|
|
553
|
+
]),
|
|
554
|
+
b("li", null, [
|
|
555
|
+
b("button", {
|
|
556
|
+
type: "button",
|
|
557
|
+
disabled: a.value <= l.value,
|
|
558
|
+
"aria-label": e.labels.lastPage,
|
|
559
|
+
title: e.labels.lastPage,
|
|
560
|
+
onClick: S[5] || (S[5] = (w) => r(a.value))
|
|
561
|
+
}, [
|
|
562
|
+
D(_(Ee), {
|
|
563
|
+
direction: "right",
|
|
564
|
+
size: "1em",
|
|
565
|
+
"stroke-width": 8
|
|
566
|
+
})
|
|
567
|
+
], 8, vo)
|
|
568
|
+
])
|
|
569
|
+
]),
|
|
570
|
+
e.showPageSelect ? (u(), f("label", fo, [
|
|
571
|
+
b("span", null, A(e.labels.pageNumber), 1),
|
|
572
|
+
b("select", {
|
|
573
|
+
value: l.value,
|
|
574
|
+
disabled: a.value <= 1,
|
|
575
|
+
onPointerenter: m,
|
|
576
|
+
onPointerleave: C,
|
|
577
|
+
onFocus: P,
|
|
578
|
+
onBlur: k,
|
|
579
|
+
onChange: v
|
|
580
|
+
}, [
|
|
581
|
+
(u(!0), f(K, null, U(p.value, (w) => (u(), f("option", {
|
|
582
|
+
key: w,
|
|
583
|
+
value: w
|
|
584
|
+
}, A(w) + " (" + A((w - 1) * e.limit + 1) + " - " + A(Math.min(w * e.limit, e.totalCount)) + ") ", 9, bo))), 128))
|
|
585
|
+
], 40, go)
|
|
586
|
+
])) : T("", !0)
|
|
587
|
+
]));
|
|
588
|
+
}
|
|
589
|
+
}), wo = { class: "dwui-data-table-controls" }, yo = { class: "dwui-data-table-tools" }, _o = {
|
|
590
|
+
key: 0,
|
|
591
|
+
class: "dwui-data-table-total"
|
|
592
|
+
}, $o = { class: "dwui-data-table-total-count" }, ko = {
|
|
593
|
+
key: 1,
|
|
594
|
+
class: "dwui-data-table-limit"
|
|
595
|
+
}, Co = ["value", "max"], So = ["title", "aria-label"], xo = ["title", "aria-label"], De = /* @__PURE__ */ O({
|
|
596
|
+
__name: "data-table-controls",
|
|
597
|
+
props: {
|
|
598
|
+
pagination: { type: Boolean },
|
|
599
|
+
showTotal: { type: Boolean },
|
|
600
|
+
showLimit: { type: Boolean },
|
|
601
|
+
showPageSelect: { type: Boolean },
|
|
602
|
+
showDownloadPage: { type: Boolean },
|
|
603
|
+
showDownloadAll: { type: Boolean },
|
|
604
|
+
current: {},
|
|
605
|
+
limit: {},
|
|
606
|
+
maxLimit: {},
|
|
607
|
+
maxPagination: {},
|
|
608
|
+
totalCount: {},
|
|
609
|
+
labels: {},
|
|
610
|
+
formatTotalCount: { type: Function }
|
|
611
|
+
},
|
|
612
|
+
emits: ["emit:changePage", "emit:changeLimit", "emit:downloadPage", "emit:downloadAll"],
|
|
613
|
+
setup(n, { emit: t }) {
|
|
614
|
+
const e = n, o = t, a = new Intl.NumberFormat("en-US"), l = E(() => e.formatTotalCount ? e.formatTotalCount(e.totalCount) : a.format(e.totalCount)), s = (p) => {
|
|
615
|
+
const i = p.target, r = Math.min(Math.max(Math.trunc(Number(i.value)) || 1, 1), e.maxLimit);
|
|
616
|
+
i.value = String(r), r !== e.limit && o("emit:changeLimit", r);
|
|
617
|
+
};
|
|
618
|
+
return (p, i) => (u(), f("div", wo, [
|
|
619
|
+
e.pagination ? (u(), j(ho, {
|
|
620
|
+
key: 0,
|
|
621
|
+
current: e.current,
|
|
622
|
+
"total-count": e.totalCount,
|
|
623
|
+
limit: e.limit,
|
|
624
|
+
"max-pagination": e.maxPagination,
|
|
625
|
+
"show-page-select": e.showPageSelect,
|
|
626
|
+
labels: e.labels,
|
|
627
|
+
"onEmit:changePage": i[0] || (i[0] = (r) => o("emit:changePage", r))
|
|
628
|
+
}, null, 8, ["current", "total-count", "limit", "max-pagination", "show-page-select", "labels"])) : T("", !0),
|
|
629
|
+
b("div", yo, [
|
|
630
|
+
e.showTotal ? (u(), f("span", _o, [
|
|
631
|
+
b("span", null, A(e.labels.totalCount), 1),
|
|
632
|
+
b("span", $o, A(l.value), 1),
|
|
633
|
+
b("span", null, A(e.labels.totalUnit), 1)
|
|
634
|
+
])) : T("", !0),
|
|
635
|
+
e.showLimit ? (u(), f("label", ko, [
|
|
636
|
+
b("span", null, A(e.labels.limit), 1),
|
|
637
|
+
b("input", {
|
|
638
|
+
type: "number",
|
|
639
|
+
value: e.limit,
|
|
640
|
+
min: "1",
|
|
641
|
+
max: e.maxLimit,
|
|
642
|
+
step: "1",
|
|
643
|
+
onChange: s
|
|
644
|
+
}, null, 40, Co)
|
|
645
|
+
])) : T("", !0),
|
|
646
|
+
e.showDownloadPage ? (u(), f("button", {
|
|
647
|
+
key: 2,
|
|
648
|
+
type: "button",
|
|
649
|
+
title: e.labels.downloadPage,
|
|
650
|
+
"aria-label": e.labels.downloadPage,
|
|
651
|
+
onClick: i[1] || (i[1] = (r) => o("emit:downloadPage"))
|
|
652
|
+
}, [
|
|
653
|
+
D(_(_t))
|
|
654
|
+
], 8, So)) : T("", !0),
|
|
655
|
+
e.showDownloadAll ? (u(), f("button", {
|
|
656
|
+
key: 3,
|
|
657
|
+
type: "button",
|
|
658
|
+
title: e.labels.downloadAll,
|
|
659
|
+
"aria-label": e.labels.downloadAll,
|
|
660
|
+
onClick: i[2] || (i[2] = (r) => o("emit:downloadAll"))
|
|
661
|
+
}, [
|
|
662
|
+
D(_($t))
|
|
663
|
+
], 8, xo)) : T("", !0)
|
|
664
|
+
])
|
|
665
|
+
]));
|
|
666
|
+
}
|
|
667
|
+
}), _e = (n, t) => {
|
|
668
|
+
let e = n;
|
|
669
|
+
for (const o of t.replace(/\[(\w+)\]/g, ".$1").split(".")) {
|
|
670
|
+
if (e == null)
|
|
671
|
+
return;
|
|
672
|
+
e = e[o];
|
|
673
|
+
}
|
|
674
|
+
return e;
|
|
675
|
+
}, $e = (n) => typeof n == "function" ? n() : n ?? "", Ie = (n) => n === !0 || n === "true" || n === "1" || n === "on" || n === 1, Ne = (n) => typeof n == "number" ? n : Number(String(n).replace(/[^+\-\d.]/g, "")), Po = (n, t, e) => {
|
|
676
|
+
if (n == null && t == null)
|
|
677
|
+
return 0;
|
|
678
|
+
if (n == null)
|
|
679
|
+
return -1;
|
|
680
|
+
if (t == null)
|
|
681
|
+
return 1;
|
|
682
|
+
if (n === t)
|
|
683
|
+
return 0;
|
|
684
|
+
switch (e) {
|
|
685
|
+
case "boolean":
|
|
686
|
+
return (Ie(n) ? 1 : 0) - (Ie(t) ? 1 : 0);
|
|
687
|
+
case "number": {
|
|
688
|
+
const o = Ne(n), a = Ne(t);
|
|
689
|
+
return Number.isNaN(o) || Number.isNaN(a) ? (Number.isNaN(o) ? 0 : 1) - (Number.isNaN(a) ? 0 : 1) : o - a;
|
|
690
|
+
}
|
|
691
|
+
case "object":
|
|
692
|
+
return fe(n).localeCompare(fe(t));
|
|
693
|
+
default:
|
|
694
|
+
return String(n).localeCompare(String(t));
|
|
695
|
+
}
|
|
696
|
+
}, fe = (n) => {
|
|
697
|
+
try {
|
|
698
|
+
return JSON.stringify(n, (t, e) => typeof e == "bigint" ? e.toString() : e) ?? "";
|
|
699
|
+
} catch {
|
|
700
|
+
return "";
|
|
701
|
+
}
|
|
702
|
+
}, Bo = "$index", qe = (n) => {
|
|
703
|
+
const t = [];
|
|
704
|
+
for (const e of n)
|
|
705
|
+
if (e.csv === !0)
|
|
706
|
+
t.push({ header: e, column: {} });
|
|
707
|
+
else if (Array.isArray(e.csv))
|
|
708
|
+
for (const o of e.csv)
|
|
709
|
+
o.disabled || t.push({ header: e, column: o });
|
|
710
|
+
return t;
|
|
711
|
+
}, Rn = (n) => qe(n).map(({ header: t, column: e }) => $e(e.label ?? t.label)), jn = (n, t, e) => qe(n).map(({ header: o, column: a }) => {
|
|
712
|
+
if (a.format)
|
|
713
|
+
return a.format(t);
|
|
714
|
+
const l = a.key ?? o.id;
|
|
715
|
+
return l === Bo ? e : _e(t, l);
|
|
716
|
+
}), Lo = ["rowspan", "colspan", "title", "aria-sort"], To = { class: "dwui-data-table-header" }, Eo = ["role", "tabindex", "onClick", "onKeydown"], Mo = ["innerHTML"], Ao = { key: 2 }, Oo = ["onPointerdown"], Do = {
|
|
717
|
+
key: 0,
|
|
718
|
+
class: "dwui-data-table-no-data"
|
|
719
|
+
}, Io = ["colspan"], No = {
|
|
720
|
+
key: 0,
|
|
721
|
+
class: "dwui-data-table-loading"
|
|
722
|
+
}, Wn = /* @__PURE__ */ O({
|
|
723
|
+
__name: "data-table",
|
|
724
|
+
props: {
|
|
725
|
+
dataList: {},
|
|
726
|
+
headers: {},
|
|
727
|
+
loading: { type: Boolean, default: !1 },
|
|
728
|
+
totalCount: { default: void 0 },
|
|
729
|
+
current: { default: 1 },
|
|
730
|
+
limit: { default: 100 },
|
|
731
|
+
maxLimit: { default: void 0 },
|
|
732
|
+
maxPagination: { default: void 0 },
|
|
733
|
+
selectable: { type: Boolean, default: void 0 },
|
|
734
|
+
controls: { default: void 0 },
|
|
735
|
+
pagination: { default: void 0 },
|
|
736
|
+
showDownloadPage: { type: Boolean, default: void 0 },
|
|
737
|
+
showDownloadAll: { type: Boolean, default: void 0 },
|
|
738
|
+
showTotal: { type: Boolean, default: void 0 },
|
|
739
|
+
showLimit: { type: Boolean, default: void 0 },
|
|
740
|
+
showPageSelect: { type: Boolean, default: void 0 },
|
|
741
|
+
showNoData: { type: Boolean, default: void 0 },
|
|
742
|
+
resizable: { type: Boolean, default: void 0 },
|
|
743
|
+
sortable: { type: Boolean, default: void 0 },
|
|
744
|
+
sortMode: { default: void 0 },
|
|
745
|
+
contentClass: { type: [Boolean, null, String, Object, Array], default: void 0 },
|
|
746
|
+
contentStyle: { type: [Boolean, null, String, Object, Array], default: void 0 },
|
|
747
|
+
tableClass: { type: [Boolean, null, String, Object, Array], default: void 0 },
|
|
748
|
+
tableStyle: { type: [Boolean, null, String, Object, Array], default: void 0 },
|
|
749
|
+
labels: { default: void 0 },
|
|
750
|
+
formatTotalCount: { type: Function, default: void 0 }
|
|
751
|
+
},
|
|
752
|
+
emits: ["emit:selectRow", "emit:changeSort", "emit:updateHeader", "emit:dblclickRow", "emit:changeLimit", "emit:changePage", "emit:downloadPage", "emit:downloadAll"],
|
|
753
|
+
setup(n, { expose: t, emit: e }) {
|
|
754
|
+
const o = n, a = e, l = ke(Xe, {}), s = B(), p = B(), i = B(), r = B({}), h = B(""), v = B(!1), m = B();
|
|
755
|
+
let C;
|
|
756
|
+
const P = E(() => o.headers.map((d) => r.value[d.id] == null ? d : { ...d, width: r.value[d.id] })), k = {
|
|
757
|
+
maxLimit: 9999,
|
|
758
|
+
maxPagination: 7,
|
|
759
|
+
selectable: !0,
|
|
760
|
+
controls: "both",
|
|
761
|
+
pagination: "both",
|
|
762
|
+
showDownloadPage: !0,
|
|
763
|
+
showDownloadAll: !0,
|
|
764
|
+
showTotal: !0,
|
|
765
|
+
showLimit: !0,
|
|
766
|
+
showPageSelect: !1,
|
|
767
|
+
showNoData: !0,
|
|
768
|
+
resizable: !0,
|
|
769
|
+
sortable: !0,
|
|
770
|
+
sortMode: "remote",
|
|
771
|
+
contentClass: void 0,
|
|
772
|
+
contentStyle: void 0,
|
|
773
|
+
tableClass: void 0,
|
|
774
|
+
tableStyle: void 0,
|
|
775
|
+
formatTotalCount: void 0
|
|
776
|
+
}, c = E(() => {
|
|
777
|
+
const d = { ...k };
|
|
778
|
+
for (const g of [l.dataTable ?? {}, o])
|
|
779
|
+
for (const y of Object.keys(k))
|
|
780
|
+
g[y] !== void 0 && Object.assign(d, { [y]: g[y] });
|
|
781
|
+
return d;
|
|
782
|
+
}), S = E(() => {
|
|
783
|
+
const d = {
|
|
784
|
+
totalCount: "Total",
|
|
785
|
+
totalUnit: "",
|
|
786
|
+
limit: "Rows per page",
|
|
787
|
+
noData: "No data found",
|
|
788
|
+
pageNumber: "Page",
|
|
789
|
+
downloadPage: "Download this page",
|
|
790
|
+
downloadAll: "Download all",
|
|
791
|
+
firstPage: "First page",
|
|
792
|
+
previousPage: "Previous page",
|
|
793
|
+
previousPages: "Previous pages",
|
|
794
|
+
nextPages: "Next pages",
|
|
795
|
+
nextPage: "Next page",
|
|
796
|
+
lastPage: "Last page",
|
|
797
|
+
...l.dataTable?.labels,
|
|
798
|
+
...o.labels
|
|
799
|
+
}, g = {};
|
|
800
|
+
for (const y of Object.keys(d)) {
|
|
801
|
+
const M = d[y];
|
|
802
|
+
g[y] = typeof M == "function" ? M() : M;
|
|
803
|
+
}
|
|
804
|
+
return g;
|
|
805
|
+
}), w = E(() => Math.min(o.limit, c.value.maxLimit)), N = E(() => ({
|
|
806
|
+
showTotal: c.value.showTotal,
|
|
807
|
+
showLimit: c.value.showLimit,
|
|
808
|
+
showPageSelect: c.value.showPageSelect,
|
|
809
|
+
showDownloadPage: c.value.showDownloadPage,
|
|
810
|
+
showDownloadAll: c.value.showDownloadAll,
|
|
811
|
+
current: o.current,
|
|
812
|
+
limit: w.value,
|
|
813
|
+
maxLimit: c.value.maxLimit,
|
|
814
|
+
maxPagination: c.value.maxPagination,
|
|
815
|
+
totalCount: o.totalCount ?? o.dataList.length,
|
|
816
|
+
formatTotalCount: c.value.formatTotalCount,
|
|
817
|
+
labels: S.value
|
|
818
|
+
})), $ = mt(void 0), z = E(() => {
|
|
819
|
+
const d = c.value.sortMode === "page" ? o.headers.find((y) => y.id === h.value) : void 0;
|
|
820
|
+
if (!d)
|
|
821
|
+
return o.dataList;
|
|
822
|
+
const g = d.compare ?? ((y, M) => {
|
|
823
|
+
const R = d.sortKey ?? d.id;
|
|
824
|
+
return Po(_e(y, R), _e(M, R), d.type ?? "string");
|
|
825
|
+
});
|
|
826
|
+
return [...o.dataList].sort((y, M) => v.value ? g(M, y) : g(y, M));
|
|
827
|
+
}), L = E(() => {
|
|
828
|
+
const d = $.value;
|
|
829
|
+
if (d == null)
|
|
830
|
+
return -1;
|
|
831
|
+
const g = z.value.indexOf(d);
|
|
832
|
+
if (g !== -1)
|
|
833
|
+
return g;
|
|
834
|
+
const y = fe(d);
|
|
835
|
+
return y === "" ? -1 : z.value.findIndex((M) => fe(M) === y);
|
|
836
|
+
}), V = E(() => o.headers.reduce((d, g) => d + (g.colspan == null ? 1 : Number(g.colspan)), 0)), W = (d) => {
|
|
837
|
+
if (d != null)
|
|
838
|
+
return typeof d == "number" ? `${d}px` : d;
|
|
839
|
+
}, q = (d) => ({
|
|
840
|
+
width: W(d.width),
|
|
841
|
+
minWidth: W(d.minWidth),
|
|
842
|
+
maxWidth: W(d.maxWidth)
|
|
843
|
+
}), ot = (d) => {
|
|
844
|
+
if (h.value === d)
|
|
845
|
+
return v.value ? "descending" : "ascending";
|
|
846
|
+
}, Se = (d) => {
|
|
847
|
+
if (!(!c.value.sortable || h.value !== d))
|
|
848
|
+
return v.value ? "down" : "up";
|
|
849
|
+
}, nt = (d) => (o.current - 1) * w.value + d + 1, xe = () => Array.from(i.value?.children ?? []).filter((d) => d.tagName === "TR" && !d.classList.contains("dwui-data-table-no-data")), at = (d) => Array.from(d.children).filter((g) => g.tagName === "TD" || g.tagName === "TH"), Pe = () => {
|
|
850
|
+
a("emit:updateHeader", P.value.map((d) => ({ ...d })));
|
|
851
|
+
}, ge = () => {
|
|
852
|
+
xe().forEach((d, g) => d.classList.toggle("dwui-selected", g === L.value));
|
|
853
|
+
}, lt = () => {
|
|
854
|
+
const d = s.value, g = xe()[L.value];
|
|
855
|
+
if (!d || !g)
|
|
856
|
+
return;
|
|
857
|
+
const y = p.value?.offsetHeight ?? 0, M = g.offsetTop, R = M + g.offsetHeight;
|
|
858
|
+
M < d.scrollTop + y ? d.scrollTop = M - y : d.scrollTop + d.clientHeight < R && (d.scrollTop = R - d.clientHeight);
|
|
859
|
+
}, ce = (d, g) => {
|
|
860
|
+
$.value = d, a("emit:selectRow", d, g);
|
|
861
|
+
}, Be = (d, g) => {
|
|
862
|
+
c.value.selectable && (g === L.value ? ce(void 0, -1) : (ce(d, g), s.value?.focus({ preventScroll: !0 })));
|
|
863
|
+
}, st = (d, g) => {
|
|
864
|
+
g !== L.value && Be(d, g), a("emit:dblclickRow", d, g);
|
|
865
|
+
}, it = (d) => {
|
|
866
|
+
if (d.target !== d.currentTarget || L.value < 0 || d.key !== "ArrowUp" && d.key !== "ArrowDown")
|
|
867
|
+
return;
|
|
868
|
+
const g = L.value + (d.key === "ArrowUp" ? -1 : 1);
|
|
869
|
+
g < 0 || z.value.length <= g || (d.preventDefault(), ce(z.value[g], g));
|
|
870
|
+
}, be = (d) => {
|
|
871
|
+
!c.value.sortable || o.dataList.length === 0 || (v.value = h.value === d.id ? !v.value : !1, h.value = d.id, a("emit:changeSort", {
|
|
872
|
+
sortKey: h.value,
|
|
873
|
+
descending: v.value
|
|
874
|
+
}));
|
|
875
|
+
}, rt = (d, g) => {
|
|
876
|
+
if (!c.value.resizable)
|
|
877
|
+
return;
|
|
878
|
+
d.preventDefault();
|
|
879
|
+
const y = p.value?.firstElementChild, M = y ? at(y) : [];
|
|
880
|
+
for (const [R, ne] of M.entries())
|
|
881
|
+
r.value[o.headers[R].id] = ne.getBoundingClientRect().width;
|
|
882
|
+
m.value = { index: g, x: d.clientX }, d.currentTarget.setPointerCapture(d.pointerId), Pe();
|
|
883
|
+
}, dt = (d) => {
|
|
884
|
+
if (!m.value)
|
|
885
|
+
return;
|
|
886
|
+
const g = d.clientX - m.value.x;
|
|
887
|
+
if (g === 0)
|
|
888
|
+
return;
|
|
889
|
+
m.value.x = d.clientX;
|
|
890
|
+
const y = m.value.index, M = o.headers.map((ne) => ne.id);
|
|
891
|
+
r.value[M[y]] += g;
|
|
892
|
+
const R = g / (M.length - y - 1);
|
|
893
|
+
for (const ne of M.slice(y + 1))
|
|
894
|
+
r.value[ne] -= R;
|
|
895
|
+
}, Le = () => {
|
|
896
|
+
m.value && (m.value = void 0, Pe());
|
|
897
|
+
};
|
|
898
|
+
return X(() => {
|
|
899
|
+
C = new MutationObserver(ge), i.value && C.observe(i.value, { childList: !0 }), ge();
|
|
900
|
+
}), G(() => {
|
|
901
|
+
C?.disconnect();
|
|
902
|
+
}), Y(() => o.headers, (d, g) => {
|
|
903
|
+
const y = d.map((R) => R.id), M = g.map((R) => R.id);
|
|
904
|
+
(y.length !== M.length || y.some((R) => !M.includes(R))) && (r.value = {});
|
|
905
|
+
}), Y(() => o.loading, (d, g) => {
|
|
906
|
+
g && !d && (c.value.sortMode === "page" && (h.value = "", v.value = !1), $.value != null && ce(void 0, -1));
|
|
907
|
+
}), Y(L, (d) => {
|
|
908
|
+
0 <= d && lt();
|
|
909
|
+
}, { flush: "post" }), Y(L, ge, { flush: "post" }), t({
|
|
910
|
+
/** ソートの状態を返す */
|
|
911
|
+
getSortContext: () => ({
|
|
912
|
+
sortKey: h.value,
|
|
913
|
+
descending: v.value
|
|
914
|
+
})
|
|
915
|
+
}), (d, g) => (u(), f("section", {
|
|
916
|
+
class: I(["dwui-data-table", { "dwui-selectable": c.value.selectable }])
|
|
917
|
+
}, [
|
|
918
|
+
c.value.controls === "both" || c.value.controls === "top" ? (u(), j(De, le({ key: 0 }, N.value, {
|
|
919
|
+
pagination: c.value.pagination === "both" || c.value.pagination === "top",
|
|
920
|
+
"onEmit:changePage": g[0] || (g[0] = (y) => a("emit:changePage", y)),
|
|
921
|
+
"onEmit:changeLimit": g[1] || (g[1] = (y) => a("emit:changeLimit", y)),
|
|
922
|
+
"onEmit:downloadPage": g[2] || (g[2] = (y) => a("emit:downloadPage")),
|
|
923
|
+
"onEmit:downloadAll": g[3] || (g[3] = (y) => a("emit:downloadAll"))
|
|
924
|
+
}), null, 16, ["pagination"])) : T("", !0),
|
|
925
|
+
b("div", {
|
|
926
|
+
ref_key: "refContent",
|
|
927
|
+
ref: s,
|
|
928
|
+
class: I(["dwui-data-table-content", [{ "dwui-loading": o.loading }, c.value.contentClass]]),
|
|
929
|
+
style: F(c.value.contentStyle),
|
|
930
|
+
tabindex: "-1",
|
|
931
|
+
onKeydown: it
|
|
932
|
+
}, [
|
|
933
|
+
b("table", {
|
|
934
|
+
class: I(c.value.tableClass),
|
|
935
|
+
style: F(c.value.tableStyle)
|
|
936
|
+
}, [
|
|
937
|
+
b("thead", {
|
|
938
|
+
ref_key: "refThead",
|
|
939
|
+
ref: p
|
|
940
|
+
}, [
|
|
941
|
+
b("tr", null, [
|
|
942
|
+
(u(!0), f(K, null, U(P.value, (y, M) => (u(), f("th", {
|
|
943
|
+
key: y.id,
|
|
944
|
+
rowspan: y.rowspan,
|
|
945
|
+
colspan: y.colspan,
|
|
946
|
+
title: y.title,
|
|
947
|
+
style: F(q(y)),
|
|
948
|
+
"aria-sort": ot(y.id),
|
|
949
|
+
scope: "col"
|
|
950
|
+
}, [
|
|
951
|
+
b("div", To, [
|
|
952
|
+
b("span", {
|
|
953
|
+
class: "dwui-data-table-sort",
|
|
954
|
+
role: c.value.sortable ? "button" : void 0,
|
|
955
|
+
tabindex: c.value.sortable ? 0 : void 0,
|
|
956
|
+
onClick: (R) => be(y),
|
|
957
|
+
onKeydown: [
|
|
958
|
+
we(ee((R) => be(y), ["prevent"]), ["enter"]),
|
|
959
|
+
we(ee((R) => be(y), ["prevent"]), ["space"])
|
|
960
|
+
]
|
|
961
|
+
}, [
|
|
962
|
+
Se(y.id) ? (u(), j(_(kt), {
|
|
963
|
+
key: 0,
|
|
964
|
+
direction: Se(y.id),
|
|
965
|
+
size: "0.7em"
|
|
966
|
+
}, null, 8, ["direction"])) : T("", !0),
|
|
967
|
+
y.html ? (u(), f("span", {
|
|
968
|
+
key: 1,
|
|
969
|
+
innerHTML: _($e)(y.label)
|
|
970
|
+
}, null, 8, Mo)) : (u(), f("span", Ao, A(_($e)(y.label)), 1))
|
|
971
|
+
], 40, Eo)
|
|
972
|
+
]),
|
|
973
|
+
c.value.resizable && M < P.value.length - 1 ? (u(), f("div", {
|
|
974
|
+
key: 0,
|
|
975
|
+
class: "dwui-data-table-resizer",
|
|
976
|
+
onPointerdown: (R) => rt(R, M),
|
|
977
|
+
onPointermove: dt,
|
|
978
|
+
onPointerup: Le,
|
|
979
|
+
onPointercancel: Le
|
|
980
|
+
}, null, 40, Oo)) : T("", !0)
|
|
981
|
+
], 12, Lo))), 128))
|
|
982
|
+
])
|
|
983
|
+
], 512),
|
|
984
|
+
b("tbody", {
|
|
985
|
+
ref_key: "refTbody",
|
|
986
|
+
ref: i
|
|
987
|
+
}, [
|
|
988
|
+
o.loading ? T("", !0) : (u(), f(K, { key: 0 }, [
|
|
989
|
+
x(d.$slots, "default", {
|
|
990
|
+
rows: z.value,
|
|
991
|
+
clickRow: Be,
|
|
992
|
+
dblclickRow: st,
|
|
993
|
+
rowNumber: nt,
|
|
994
|
+
selectedIndex: L.value
|
|
995
|
+
}),
|
|
996
|
+
o.dataList.length === 0 && c.value.showNoData ? (u(), f("tr", Do, [
|
|
997
|
+
b("td", { colspan: V.value }, A(S.value.noData), 9, Io)
|
|
998
|
+
])) : T("", !0)
|
|
999
|
+
], 64))
|
|
1000
|
+
], 512)
|
|
1001
|
+
], 6),
|
|
1002
|
+
o.loading ? (u(), f("div", No, [
|
|
1003
|
+
x(d.$slots, "loading", {}, () => [
|
|
1004
|
+
g[8] || (g[8] = b("div", { class: "dwui-data-table-loading-spinner" }, null, -1))
|
|
1005
|
+
])
|
|
1006
|
+
])) : T("", !0)
|
|
1007
|
+
], 38),
|
|
1008
|
+
c.value.controls === "both" || c.value.controls === "bottom" ? (u(), j(De, le({ key: 1 }, N.value, {
|
|
1009
|
+
pagination: c.value.pagination === "both" || c.value.pagination === "bottom",
|
|
1010
|
+
"onEmit:changePage": g[4] || (g[4] = (y) => a("emit:changePage", y)),
|
|
1011
|
+
"onEmit:changeLimit": g[5] || (g[5] = (y) => a("emit:changeLimit", y)),
|
|
1012
|
+
"onEmit:downloadPage": g[6] || (g[6] = (y) => a("emit:downloadPage")),
|
|
1013
|
+
"onEmit:downloadAll": g[7] || (g[7] = (y) => a("emit:downloadAll"))
|
|
1014
|
+
}), null, 16, ["pagination"])) : T("", !0)
|
|
1015
|
+
], 2));
|
|
1016
|
+
}
|
|
1017
|
+
}), ze = {
|
|
1018
|
+
top: "bottom",
|
|
1019
|
+
bottom: "top",
|
|
1020
|
+
left: "right",
|
|
1021
|
+
right: "left"
|
|
1022
|
+
}, he = (n, t, e) => Math.min(Math.max(n, t), e), zo = (n, t, e, o) => {
|
|
1023
|
+
const { offset: a, margin: l, arrowMargin: s } = o, [p, i = "center"] = o.placement.split("-"), r = p === "top" || p === "bottom", h = n.top + n.height, v = n.left + n.width, m = {
|
|
1024
|
+
top: n.top - l,
|
|
1025
|
+
bottom: e.height - h - l,
|
|
1026
|
+
left: n.left - l,
|
|
1027
|
+
right: e.width - v - l
|
|
1028
|
+
}, k = (r ? t.height : t.width) + a <= m[p] || m[ze[p]] <= m[p] ? p : ze[p];
|
|
1029
|
+
let c;
|
|
1030
|
+
switch (k) {
|
|
1031
|
+
case "top":
|
|
1032
|
+
c = n.top - a - t.height;
|
|
1033
|
+
break;
|
|
1034
|
+
case "bottom":
|
|
1035
|
+
c = h + a;
|
|
1036
|
+
break;
|
|
1037
|
+
case "left":
|
|
1038
|
+
c = n.left - a - t.width;
|
|
1039
|
+
break;
|
|
1040
|
+
default:
|
|
1041
|
+
c = v + a;
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
const S = r ? n.left : n.top, w = r ? n.width : n.height, N = r ? t.width : t.height;
|
|
1045
|
+
let $;
|
|
1046
|
+
switch (i) {
|
|
1047
|
+
case "start":
|
|
1048
|
+
$ = S;
|
|
1049
|
+
break;
|
|
1050
|
+
case "end":
|
|
1051
|
+
$ = S + w - N;
|
|
1052
|
+
break;
|
|
1053
|
+
default:
|
|
1054
|
+
$ = S + (w - N) / 2;
|
|
1055
|
+
break;
|
|
1056
|
+
}
|
|
1057
|
+
const z = he(r ? c : $, l, Math.max(l, e.height - l - t.height)), L = he(r ? $ : c, l, Math.max(l, e.width - l - t.width)), V = S + w / 2, q = he(V - (r ? L : z), s, Math.max(s, N - s));
|
|
1058
|
+
return { top: z, left: L, side: k, arrow: q };
|
|
1059
|
+
}, Ho = ["popover", "data-side"], Ro = { class: "dwui-anchored-popover-content" }, He = 4, jo = 7, Wo = 12, Ko = 8, Je = /* @__PURE__ */ O({
|
|
1060
|
+
__name: "anchored-popover",
|
|
1061
|
+
props: {
|
|
1062
|
+
anchor: {},
|
|
1063
|
+
placement: {},
|
|
1064
|
+
arrow: { type: Boolean },
|
|
1065
|
+
mode: {}
|
|
1066
|
+
},
|
|
1067
|
+
emits: ["emit:open", "emit:close"],
|
|
1068
|
+
setup(n, { expose: t, emit: e }) {
|
|
1069
|
+
const o = n, a = e, l = B(), s = B(), p = () => {
|
|
1070
|
+
l.value?.hidePopover();
|
|
1071
|
+
}, i = () => {
|
|
1072
|
+
l.value?.showPopover();
|
|
1073
|
+
}, r = () => {
|
|
1074
|
+
const m = l.value;
|
|
1075
|
+
if (!o.anchor || !m)
|
|
1076
|
+
return;
|
|
1077
|
+
const C = {
|
|
1078
|
+
width: document.documentElement.clientWidth,
|
|
1079
|
+
height: document.documentElement.clientHeight
|
|
1080
|
+
}, P = zo(o.anchor.getBoundingClientRect(), m.getBoundingClientRect(), C, {
|
|
1081
|
+
placement: o.placement,
|
|
1082
|
+
offset: o.arrow ? He + jo : He,
|
|
1083
|
+
margin: Ko,
|
|
1084
|
+
arrowMargin: Wo
|
|
1085
|
+
});
|
|
1086
|
+
s.value = P.side, m.style.top = `${P.top}px`, m.style.left = `${P.left}px`, m.style.setProperty("--dwui-offset-arrow", `${P.arrow}px`), m.style.visibility = "visible";
|
|
1087
|
+
}, h = (m) => {
|
|
1088
|
+
l.value?.contains(m.target) || r();
|
|
1089
|
+
}, v = (m) => {
|
|
1090
|
+
m.newState === "open" ? (r(), window.addEventListener("scroll", h, !0), window.addEventListener("resize", r), a("emit:open")) : (l.value && (l.value.style.visibility = ""), window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", r), a("emit:close"));
|
|
1091
|
+
};
|
|
1092
|
+
return G(() => {
|
|
1093
|
+
window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", r);
|
|
1094
|
+
}), t({
|
|
1095
|
+
/** パネルの要素。invoker の設定や、要素がパネルの中かの判定に使う */
|
|
1096
|
+
element: l,
|
|
1097
|
+
show: i,
|
|
1098
|
+
hide: p
|
|
1099
|
+
}), (m, C) => (u(), f("div", {
|
|
1100
|
+
ref_key: "refPanel",
|
|
1101
|
+
ref: l,
|
|
1102
|
+
class: I(["dwui-anchored-popover", { "dwui-arrow": o.arrow }]),
|
|
1103
|
+
popover: o.mode,
|
|
1104
|
+
"data-side": s.value,
|
|
1105
|
+
onToggle: v
|
|
1106
|
+
}, [
|
|
1107
|
+
b("div", Ro, [
|
|
1108
|
+
x(m.$slots, "default")
|
|
1109
|
+
])
|
|
1110
|
+
], 42, Ho));
|
|
1111
|
+
}
|
|
1112
|
+
}), Fo = ["aria-label"], Kn = /* @__PURE__ */ O({
|
|
1113
|
+
inheritAttrs: !1,
|
|
1114
|
+
__name: "help-button",
|
|
1115
|
+
props: {
|
|
1116
|
+
placement: { default: "bottom-start" },
|
|
1117
|
+
arrow: { type: Boolean, default: !1 },
|
|
1118
|
+
label: { default: "Help" }
|
|
1119
|
+
},
|
|
1120
|
+
emits: ["emit:open", "emit:close"],
|
|
1121
|
+
setup(n, { emit: t }) {
|
|
1122
|
+
const e = n, o = t, a = Fe(), l = B(), s = B();
|
|
1123
|
+
return X(() => {
|
|
1124
|
+
const p = s.value?.element;
|
|
1125
|
+
l.value && p && (l.value.popoverTargetElement = p);
|
|
1126
|
+
}), (p, i) => (u(), f(K, null, [
|
|
1127
|
+
b("button", le({
|
|
1128
|
+
ref_key: "refButton",
|
|
1129
|
+
ref: l,
|
|
1130
|
+
type: "button",
|
|
1131
|
+
class: "dwui-help-button",
|
|
1132
|
+
"aria-label": e.label
|
|
1133
|
+
}, _(a)), [
|
|
1134
|
+
x(p.$slots, "icon", {}, () => [
|
|
1135
|
+
D(_(Ce))
|
|
1136
|
+
])
|
|
1137
|
+
], 16, Fo),
|
|
1138
|
+
D(Je, {
|
|
1139
|
+
ref_key: "refPopover",
|
|
1140
|
+
ref: s,
|
|
1141
|
+
class: "dwui-help-button-popover",
|
|
1142
|
+
mode: "auto",
|
|
1143
|
+
anchor: l.value,
|
|
1144
|
+
placement: e.placement,
|
|
1145
|
+
arrow: e.arrow,
|
|
1146
|
+
"onEmit:open": i[0] || (i[0] = (r) => o("emit:open")),
|
|
1147
|
+
"onEmit:close": i[1] || (i[1] = (r) => o("emit:close"))
|
|
1148
|
+
}, {
|
|
1149
|
+
default: H(() => [
|
|
1150
|
+
x(p.$slots, "default")
|
|
1151
|
+
]),
|
|
1152
|
+
_: 3
|
|
1153
|
+
}, 8, ["anchor", "placement", "arrow"])
|
|
1154
|
+
], 64));
|
|
1155
|
+
}
|
|
1156
|
+
}), Vo = ["aria-label", "aria-describedby"], Go = 150, Ze = /* @__PURE__ */ O({
|
|
1157
|
+
inheritAttrs: !1,
|
|
1158
|
+
__name: "icon-popper",
|
|
1159
|
+
props: {
|
|
1160
|
+
placement: {},
|
|
1161
|
+
arrow: { type: Boolean },
|
|
1162
|
+
popoverClass: {},
|
|
1163
|
+
label: {}
|
|
1164
|
+
},
|
|
1165
|
+
emits: ["emit:open", "emit:close"],
|
|
1166
|
+
setup(n, { emit: t }) {
|
|
1167
|
+
const e = n, o = t, a = Fe(), l = B(), s = B(), p = B(!1), i = se();
|
|
1168
|
+
let r;
|
|
1169
|
+
const h = () => {
|
|
1170
|
+
r !== void 0 && (clearTimeout(r), r = void 0);
|
|
1171
|
+
}, v = () => {
|
|
1172
|
+
h(), s.value?.show();
|
|
1173
|
+
}, m = () => {
|
|
1174
|
+
h(), s.value?.hide();
|
|
1175
|
+
}, C = () => {
|
|
1176
|
+
h(), r = setTimeout(() => {
|
|
1177
|
+
r = void 0, s.value?.hide();
|
|
1178
|
+
}, Go);
|
|
1179
|
+
}, P = (W) => {
|
|
1180
|
+
const q = W.target;
|
|
1181
|
+
!l.value?.contains(q) && !s.value?.element?.contains(q) && m();
|
|
1182
|
+
}, k = (W) => {
|
|
1183
|
+
W.pointerType !== "touch" && v();
|
|
1184
|
+
}, c = (W) => {
|
|
1185
|
+
W.pointerType !== "touch" && C();
|
|
1186
|
+
}, S = (W) => {
|
|
1187
|
+
W.pointerType !== "touch" && h();
|
|
1188
|
+
}, w = (W) => {
|
|
1189
|
+
W.pointerType === "touch" && (p.value ? m() : v());
|
|
1190
|
+
}, N = () => {
|
|
1191
|
+
v();
|
|
1192
|
+
}, $ = () => {
|
|
1193
|
+
m();
|
|
1194
|
+
}, z = () => {
|
|
1195
|
+
m();
|
|
1196
|
+
}, L = () => {
|
|
1197
|
+
p.value = !0, document.addEventListener("pointerdown", P, !0), o("emit:open");
|
|
1198
|
+
}, V = () => {
|
|
1199
|
+
p.value = !1, document.removeEventListener("pointerdown", P, !0), o("emit:close");
|
|
1200
|
+
};
|
|
1201
|
+
return G(() => {
|
|
1202
|
+
h(), document.removeEventListener("pointerdown", P, !0);
|
|
1203
|
+
}), (W, q) => (u(), f(K, null, [
|
|
1204
|
+
b("span", le({
|
|
1205
|
+
ref_key: "refTrigger",
|
|
1206
|
+
ref: l,
|
|
1207
|
+
class: "dwui-icon-popper",
|
|
1208
|
+
tabindex: "0",
|
|
1209
|
+
"aria-label": e.label,
|
|
1210
|
+
"aria-describedby": _(i)
|
|
1211
|
+
}, _(a), {
|
|
1212
|
+
onPointerenter: k,
|
|
1213
|
+
onPointerleave: c,
|
|
1214
|
+
onPointerdown: w,
|
|
1215
|
+
onFocus: N,
|
|
1216
|
+
onBlur: $,
|
|
1217
|
+
onKeydown: we(z, ["esc"])
|
|
1218
|
+
}), [
|
|
1219
|
+
x(W.$slots, "icon")
|
|
1220
|
+
], 16, Vo),
|
|
1221
|
+
D(Je, {
|
|
1222
|
+
ref_key: "refPopover",
|
|
1223
|
+
ref: s,
|
|
1224
|
+
id: _(i),
|
|
1225
|
+
class: I(["dwui-icon-popper-popover", e.popoverClass]),
|
|
1226
|
+
role: "tooltip",
|
|
1227
|
+
mode: "manual",
|
|
1228
|
+
anchor: l.value,
|
|
1229
|
+
placement: e.placement,
|
|
1230
|
+
arrow: e.arrow,
|
|
1231
|
+
onPointerenter: S,
|
|
1232
|
+
onPointerleave: c,
|
|
1233
|
+
"onEmit:open": L,
|
|
1234
|
+
"onEmit:close": V
|
|
1235
|
+
}, {
|
|
1236
|
+
default: H(() => [
|
|
1237
|
+
x(W.$slots, "default")
|
|
1238
|
+
]),
|
|
1239
|
+
_: 3
|
|
1240
|
+
}, 8, ["id", "class", "anchor", "placement", "arrow"])
|
|
1241
|
+
], 64));
|
|
1242
|
+
}
|
|
1243
|
+
}), Fn = /* @__PURE__ */ O({
|
|
1244
|
+
__name: "help-popper",
|
|
1245
|
+
props: {
|
|
1246
|
+
placement: { default: "right" },
|
|
1247
|
+
arrow: { type: Boolean, default: !0 },
|
|
1248
|
+
label: { default: "Help" }
|
|
1249
|
+
},
|
|
1250
|
+
emits: ["emit:open", "emit:close"],
|
|
1251
|
+
setup(n, { emit: t }) {
|
|
1252
|
+
const e = n, o = t;
|
|
1253
|
+
return (a, l) => (u(), j(Ze, {
|
|
1254
|
+
class: "dwui-help-popper",
|
|
1255
|
+
"popover-class": "dwui-help-popper-popover",
|
|
1256
|
+
placement: e.placement,
|
|
1257
|
+
arrow: e.arrow,
|
|
1258
|
+
label: e.label,
|
|
1259
|
+
"onEmit:open": l[0] || (l[0] = (s) => o("emit:open")),
|
|
1260
|
+
"onEmit:close": l[1] || (l[1] = (s) => o("emit:close"))
|
|
1261
|
+
}, {
|
|
1262
|
+
icon: H(() => [
|
|
1263
|
+
x(a.$slots, "icon", {}, () => [
|
|
1264
|
+
D(_(Ce))
|
|
1265
|
+
])
|
|
1266
|
+
]),
|
|
1267
|
+
default: H(() => [
|
|
1268
|
+
x(a.$slots, "default")
|
|
1269
|
+
]),
|
|
1270
|
+
_: 3
|
|
1271
|
+
}, 8, ["placement", "arrow", "label"]));
|
|
1272
|
+
}
|
|
1273
|
+
}), Vn = /* @__PURE__ */ O({
|
|
1274
|
+
__name: "hourglass-loading",
|
|
1275
|
+
props: {
|
|
1276
|
+
loading: { type: Boolean },
|
|
1277
|
+
duration: {},
|
|
1278
|
+
size: { default: "1.2em" }
|
|
1279
|
+
},
|
|
1280
|
+
setup(n) {
|
|
1281
|
+
const t = n;
|
|
1282
|
+
return (e, o) => t.loading ? (u(), j(_(Ct), {
|
|
1283
|
+
key: 0,
|
|
1284
|
+
duration: t.duration,
|
|
1285
|
+
size: t.size,
|
|
1286
|
+
class: "dwui-hourglass-loading"
|
|
1287
|
+
}, null, 8, ["duration", "size"])) : x(e.$slots, "default", {}, void 0, void 0, 1);
|
|
1288
|
+
}
|
|
1289
|
+
}), Gn = /* @__PURE__ */ O({
|
|
1290
|
+
__name: "intersection-lazy-component",
|
|
1291
|
+
props: {
|
|
1292
|
+
root: {},
|
|
1293
|
+
rootMargin: {},
|
|
1294
|
+
threshold: {}
|
|
1295
|
+
},
|
|
1296
|
+
emits: ["emit:visible"],
|
|
1297
|
+
setup(n, { emit: t }) {
|
|
1298
|
+
const e = n, o = t, a = B(), l = B(!1);
|
|
1299
|
+
let s;
|
|
1300
|
+
const p = () => {
|
|
1301
|
+
s?.disconnect(), s = void 0, !(!a.value || l.value) && (s = new IntersectionObserver((i) => {
|
|
1302
|
+
i.some((r) => r.isIntersecting) && (l.value = !0, s?.disconnect(), s = void 0, o("emit:visible"));
|
|
1303
|
+
}, {
|
|
1304
|
+
root: e.root,
|
|
1305
|
+
rootMargin: e.rootMargin,
|
|
1306
|
+
threshold: e.threshold
|
|
1307
|
+
}), s.observe(a.value));
|
|
1308
|
+
};
|
|
1309
|
+
return X(() => {
|
|
1310
|
+
p();
|
|
1311
|
+
}), G(() => {
|
|
1312
|
+
s?.disconnect();
|
|
1313
|
+
}), Y(() => [e.root, e.rootMargin, e.threshold], () => {
|
|
1314
|
+
p();
|
|
1315
|
+
}, { flush: "post" }), (i, r) => (u(), f("div", {
|
|
1316
|
+
ref_key: "refTarget",
|
|
1317
|
+
ref: a,
|
|
1318
|
+
class: "dwui-intersection-lazy-component"
|
|
1319
|
+
}, [
|
|
1320
|
+
l.value ? x(i.$slots, "default", {}, void 0, void 0, 0) : x(i.$slots, "placeholder", {}, void 0, void 0, 1)
|
|
1321
|
+
], 512));
|
|
1322
|
+
}
|
|
1323
|
+
}), Uo = {
|
|
1324
|
+
type: "button",
|
|
1325
|
+
class: "dwui-label-button"
|
|
1326
|
+
}, Un = /* @__PURE__ */ O({
|
|
1327
|
+
__name: "label-button",
|
|
1328
|
+
props: {
|
|
1329
|
+
preset: {},
|
|
1330
|
+
gap: {},
|
|
1331
|
+
iconClass: { type: [Boolean, null, String, Object, Array] },
|
|
1332
|
+
iconStyle: { type: [Boolean, null, String, Object, Array] },
|
|
1333
|
+
labelClass: { type: [Boolean, null, String, Object, Array] },
|
|
1334
|
+
labelStyle: { type: [Boolean, null, String, Object, Array] }
|
|
1335
|
+
},
|
|
1336
|
+
setup(n) {
|
|
1337
|
+
const t = n, e = Z();
|
|
1338
|
+
return (o, a) => (u(), f("button", Uo, [
|
|
1339
|
+
D(oe, {
|
|
1340
|
+
preset: t.preset,
|
|
1341
|
+
gap: t.gap,
|
|
1342
|
+
"icon-class": t.iconClass,
|
|
1343
|
+
"icon-style": t.iconStyle,
|
|
1344
|
+
"label-class": t.labelClass,
|
|
1345
|
+
"label-style": t.labelStyle
|
|
1346
|
+
}, de({ _: 2 }, [
|
|
1347
|
+
e.icon != null ? {
|
|
1348
|
+
name: "icon",
|
|
1349
|
+
fn: H(() => [
|
|
1350
|
+
x(o.$slots, "icon")
|
|
1351
|
+
]),
|
|
1352
|
+
key: "0"
|
|
1353
|
+
} : void 0,
|
|
1354
|
+
e.default != null ? {
|
|
1355
|
+
name: "default",
|
|
1356
|
+
fn: H(() => [
|
|
1357
|
+
x(o.$slots, "default")
|
|
1358
|
+
]),
|
|
1359
|
+
key: "1"
|
|
1360
|
+
} : void 0
|
|
1361
|
+
]), 1032, ["preset", "gap", "icon-class", "icon-style", "label-class", "label-style"])
|
|
1362
|
+
]));
|
|
1363
|
+
}
|
|
1364
|
+
}), Xo = /^\s*[[{]/;
|
|
1365
|
+
function Yo(n) {
|
|
1366
|
+
return typeof n == "string" ? n : n instanceof Error ? String(n) : ie(n, 0, "", []) ?? String(n);
|
|
1367
|
+
}
|
|
1368
|
+
function qo(n) {
|
|
1369
|
+
if (Xo.test(n))
|
|
1370
|
+
try {
|
|
1371
|
+
const t = JSON.parse(n);
|
|
1372
|
+
return typeof t == "object" && t !== null ? t : void 0;
|
|
1373
|
+
} catch {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
function ie(n, t, e, o) {
|
|
1378
|
+
switch (typeof n) {
|
|
1379
|
+
case "string": {
|
|
1380
|
+
const a = qo(n);
|
|
1381
|
+
return a === void 0 ? `"${n}"` : ie(a, t, e, o);
|
|
1382
|
+
}
|
|
1383
|
+
case "number":
|
|
1384
|
+
case "boolean":
|
|
1385
|
+
return String(n);
|
|
1386
|
+
case "bigint":
|
|
1387
|
+
return `"${n.toString()}"`;
|
|
1388
|
+
case "object": {
|
|
1389
|
+
if (n === null)
|
|
1390
|
+
return "null";
|
|
1391
|
+
if (n instanceof Error)
|
|
1392
|
+
return `"${String(n)}"`;
|
|
1393
|
+
const { toJSON: a } = n;
|
|
1394
|
+
if (typeof a == "function")
|
|
1395
|
+
return ie(a.call(n, e), t, e, o);
|
|
1396
|
+
if (o.includes(n))
|
|
1397
|
+
return '"[Circular]"';
|
|
1398
|
+
o.push(n);
|
|
1399
|
+
try {
|
|
1400
|
+
return Jo(n, t, o);
|
|
1401
|
+
} finally {
|
|
1402
|
+
o.pop();
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
default:
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
function Jo(n, t, e) {
|
|
1410
|
+
const o = Array.isArray(n), a = [];
|
|
1411
|
+
if (o)
|
|
1412
|
+
for (let r = 0; r < n.length; r++)
|
|
1413
|
+
a.push(ie(n[r], t + 1, String(r), e) ?? "null");
|
|
1414
|
+
else
|
|
1415
|
+
for (const [r, h] of Object.entries(n)) {
|
|
1416
|
+
const v = ie(h, t + 1, r, e);
|
|
1417
|
+
v !== void 0 && a.push(`"${r}": ${v}`);
|
|
1418
|
+
}
|
|
1419
|
+
const [l, s] = o ? ["[", "]"] : ["{", "}"];
|
|
1420
|
+
if (a.length === 0)
|
|
1421
|
+
return `${l}${s}`;
|
|
1422
|
+
const p = " ".repeat(t + 1), i = " ".repeat(t);
|
|
1423
|
+
return `${l}
|
|
1424
|
+
${p}${a.join(`,
|
|
1425
|
+
${p}`)}
|
|
1426
|
+
${i}${s}`;
|
|
1427
|
+
}
|
|
1428
|
+
const Zo = ["aria-labelledby", "aria-describedby"], Qo = { class: "dwui-modal-dialog-header" }, en = { class: "dwui-modal-dialog-icon" }, tn = ["id", "innerHTML"], on = ["id"], nn = ["id"], an = { key: 0 }, ln = ["innerHTML"], sn = { key: 2 }, rn = {
|
|
1429
|
+
key: 0,
|
|
1430
|
+
class: "dwui-modal-dialog-images"
|
|
1431
|
+
}, dn = ["src", "alt"], cn = ["onClick"], Xn = /* @__PURE__ */ O({
|
|
1432
|
+
__name: "modal-dialog",
|
|
1433
|
+
props: /* @__PURE__ */ J({
|
|
1434
|
+
type: { default: "info" },
|
|
1435
|
+
title: { default: void 0 },
|
|
1436
|
+
message: { default: void 0 },
|
|
1437
|
+
html: { type: Boolean, default: !1 },
|
|
1438
|
+
image: { default: void 0 },
|
|
1439
|
+
buttons: { default: void 0 },
|
|
1440
|
+
okLabel: { default: "OK" },
|
|
1441
|
+
yesLabel: { default: "Yes" },
|
|
1442
|
+
noLabel: { default: "No" },
|
|
1443
|
+
cancelLabel: { default: "Cancel" }
|
|
1444
|
+
}, {
|
|
1445
|
+
open: { type: Boolean, default: !1 },
|
|
1446
|
+
openModifiers: {}
|
|
1447
|
+
}),
|
|
1448
|
+
emits: /* @__PURE__ */ J(["emit:close"], ["update:open"]),
|
|
1449
|
+
setup(n, { emit: t }) {
|
|
1450
|
+
const e = n, o = t, a = re(n, "open"), l = B(), s = B(), p = se(), i = se(), r = {
|
|
1451
|
+
info: xt,
|
|
1452
|
+
confirm: Ce,
|
|
1453
|
+
warn: Ge,
|
|
1454
|
+
error: St
|
|
1455
|
+
}, h = ["cancel", "no", "yes", "ok"], v = E(() => e.buttons ?? (e.type === "confirm" ? ["yes", "no"] : ["ok"])), m = E(() => ({
|
|
1456
|
+
ok: e.okLabel,
|
|
1457
|
+
yes: e.yesLabel,
|
|
1458
|
+
no: e.noLabel,
|
|
1459
|
+
cancel: e.cancelLabel
|
|
1460
|
+
})), C = E(() => e.message == null ? [] : [e.message].flat()), P = E(() => [e.image ?? []].flat().map(($) => typeof $ == "string" ? {
|
|
1461
|
+
src: $,
|
|
1462
|
+
alt: ""
|
|
1463
|
+
} : $)), k = ($) => {
|
|
1464
|
+
N($);
|
|
1465
|
+
}, c = ($) => {
|
|
1466
|
+
$.preventDefault(), N("cancel");
|
|
1467
|
+
}, S = ($) => {
|
|
1468
|
+
if ($.key !== "ArrowLeft" && $.key !== "ArrowRight")
|
|
1469
|
+
return;
|
|
1470
|
+
const z = [...s.value?.children ?? []], L = z.indexOf(document.activeElement);
|
|
1471
|
+
L < 0 || z[$.key === "ArrowRight" ? L + 1 : L - 1]?.focus();
|
|
1472
|
+
}, w = () => {
|
|
1473
|
+
l.value?.showModal();
|
|
1474
|
+
const $ = h.find((L) => v.value.includes(L)), z = $ ? v.value.indexOf($) : -1;
|
|
1475
|
+
s.value?.children[z]?.focus();
|
|
1476
|
+
}, N = ($) => {
|
|
1477
|
+
l.value?.close(), a.value = !1, o("emit:close", $);
|
|
1478
|
+
};
|
|
1479
|
+
return X(() => {
|
|
1480
|
+
a.value && w();
|
|
1481
|
+
}), Y(a, ($) => {
|
|
1482
|
+
$ ? w() : l.value?.close();
|
|
1483
|
+
}, { flush: "post" }), ($, z) => (u(), f("dialog", {
|
|
1484
|
+
ref_key: "refDialog",
|
|
1485
|
+
ref: l,
|
|
1486
|
+
class: I(["dwui-modal-dialog", `dwui-modal-dialog-${e.type}`]),
|
|
1487
|
+
"aria-labelledby": e.title ? _(p) : void 0,
|
|
1488
|
+
"aria-describedby": _(i),
|
|
1489
|
+
onCancel: c,
|
|
1490
|
+
onKeydown: S
|
|
1491
|
+
}, [
|
|
1492
|
+
b("div", Qo, [
|
|
1493
|
+
b("span", en, [
|
|
1494
|
+
x($.$slots, "icon", {}, () => [
|
|
1495
|
+
(u(), j(te(r[e.type])))
|
|
1496
|
+
])
|
|
1497
|
+
]),
|
|
1498
|
+
e.title ? (u(), f(K, { key: 0 }, [
|
|
1499
|
+
e.html ? (u(), f("span", {
|
|
1500
|
+
key: 0,
|
|
1501
|
+
id: _(p),
|
|
1502
|
+
class: "dwui-modal-dialog-title",
|
|
1503
|
+
innerHTML: e.title
|
|
1504
|
+
}, null, 8, tn)) : (u(), f("span", {
|
|
1505
|
+
key: 1,
|
|
1506
|
+
id: _(p),
|
|
1507
|
+
class: "dwui-modal-dialog-title"
|
|
1508
|
+
}, A(e.title), 9, on))
|
|
1509
|
+
], 64)) : T("", !0)
|
|
1510
|
+
]),
|
|
1511
|
+
b("div", {
|
|
1512
|
+
id: _(i),
|
|
1513
|
+
class: "dwui-modal-dialog-body"
|
|
1514
|
+
}, [
|
|
1515
|
+
x($.$slots, "default", {}, () => [
|
|
1516
|
+
(u(!0), f(K, null, U(C.value, (L, V) => (u(), f(K, { key: V }, [
|
|
1517
|
+
typeof L != "string" ? (u(), f("pre", an, A(_(Yo)(L)), 1)) : e.html ? (u(), f("p", {
|
|
1518
|
+
key: 1,
|
|
1519
|
+
innerHTML: L
|
|
1520
|
+
}, null, 8, ln)) : (u(), f("p", sn, A(L), 1))
|
|
1521
|
+
], 64))), 128)),
|
|
1522
|
+
P.value.length ? (u(), f("div", rn, [
|
|
1523
|
+
(u(!0), f(K, null, U(P.value, (L, V) => (u(), f("img", {
|
|
1524
|
+
key: V,
|
|
1525
|
+
src: L.src,
|
|
1526
|
+
alt: L.alt
|
|
1527
|
+
}, null, 8, dn))), 128))
|
|
1528
|
+
])) : T("", !0)
|
|
1529
|
+
])
|
|
1530
|
+
], 8, nn),
|
|
1531
|
+
b("div", {
|
|
1532
|
+
ref_key: "refButtons",
|
|
1533
|
+
ref: s,
|
|
1534
|
+
class: "dwui-modal-dialog-buttons"
|
|
1535
|
+
}, [
|
|
1536
|
+
(u(!0), f(K, null, U(v.value, (L) => (u(), f("button", {
|
|
1537
|
+
key: L,
|
|
1538
|
+
type: "button",
|
|
1539
|
+
class: I(["dwui-modal-dialog-button", `dwui-modal-dialog-button-${L}`]),
|
|
1540
|
+
onClick: (V) => k(L)
|
|
1541
|
+
}, A(m.value[L]), 11, cn))), 128))
|
|
1542
|
+
], 512)
|
|
1543
|
+
], 42, Zo));
|
|
1544
|
+
}
|
|
1545
|
+
});
|
|
1546
|
+
function un(n) {
|
|
1547
|
+
const t = n.minWidth ?? 20, e = n.minHeight ?? 20, o = B(!1), a = B(!1), l = Te({
|
|
1548
|
+
x: 0,
|
|
1549
|
+
y: 0
|
|
1550
|
+
}), s = Te({
|
|
1551
|
+
width: -1,
|
|
1552
|
+
height: -1
|
|
1553
|
+
});
|
|
1554
|
+
let p = null, i = "bottom-right", r = {
|
|
1555
|
+
x: 0,
|
|
1556
|
+
y: 0
|
|
1557
|
+
};
|
|
1558
|
+
const h = (w) => {
|
|
1559
|
+
if (w.pointerId !== p)
|
|
1560
|
+
return;
|
|
1561
|
+
w.preventDefault();
|
|
1562
|
+
const N = w.clientX - r.x, $ = w.clientY - r.y;
|
|
1563
|
+
if (r = {
|
|
1564
|
+
x: w.clientX,
|
|
1565
|
+
y: w.clientY
|
|
1566
|
+
}, o.value)
|
|
1567
|
+
l.x += N, l.y += $;
|
|
1568
|
+
else if (a.value) {
|
|
1569
|
+
if (i.endsWith("left")) {
|
|
1570
|
+
const z = Math.max(t, s.width - N);
|
|
1571
|
+
l.x += s.width - z, s.width = z;
|
|
1572
|
+
} else
|
|
1573
|
+
s.width = Math.max(t, s.width + N);
|
|
1574
|
+
if (i.startsWith("top")) {
|
|
1575
|
+
const z = Math.max(e, s.height - $);
|
|
1576
|
+
l.y += s.height - z, s.height = z;
|
|
1577
|
+
} else
|
|
1578
|
+
s.height = Math.max(e, s.height + $);
|
|
1579
|
+
}
|
|
1580
|
+
}, v = () => {
|
|
1581
|
+
const w = n.target.value?.getBoundingClientRect().width || 0;
|
|
1582
|
+
l.x < 40 - w && (l.x = 40 - w), window.innerWidth - 40 < l.x && (l.x = window.innerWidth - 40), l.y < 0 && (l.y = 0), n.clampBottom && window.innerHeight - 20 < l.y && (l.y = window.innerHeight - 20);
|
|
1583
|
+
}, m = (w) => {
|
|
1584
|
+
if (w.pointerId !== p)
|
|
1585
|
+
return;
|
|
1586
|
+
const N = o.value;
|
|
1587
|
+
C(), N && v();
|
|
1588
|
+
}, C = () => {
|
|
1589
|
+
document.removeEventListener("pointermove", h, !0), document.removeEventListener("pointerup", m, !0), document.removeEventListener("pointercancel", m, !0), p = null, o.value = !1, a.value = !1;
|
|
1590
|
+
}, P = (w) => {
|
|
1591
|
+
C(), p = w.pointerId, r = {
|
|
1592
|
+
x: w.clientX,
|
|
1593
|
+
y: w.clientY
|
|
1594
|
+
}, document.addEventListener("pointermove", h, !0), document.addEventListener("pointerup", m, !0), document.addEventListener("pointercancel", m, !0);
|
|
1595
|
+
}, k = (w) => {
|
|
1596
|
+
w.isPrimary && n.dragMode() === "body" && (P(w), o.value = !0);
|
|
1597
|
+
}, c = (w) => {
|
|
1598
|
+
w.isPrimary && n.dragMode() === "header" && (P(w), o.value = !0);
|
|
1599
|
+
}, S = (w, N = "bottom-right") => {
|
|
1600
|
+
if (!w.isPrimary)
|
|
1601
|
+
return;
|
|
1602
|
+
i = N;
|
|
1603
|
+
const $ = n.target.value?.getBoundingClientRect();
|
|
1604
|
+
$ && (s.width < 0 && (s.width = $.width), s.height < 0 && (s.height = $.height)), P(w), a.value = !0;
|
|
1605
|
+
};
|
|
1606
|
+
return G(C), {
|
|
1607
|
+
moving: o,
|
|
1608
|
+
resizing: a,
|
|
1609
|
+
currentPosition: l,
|
|
1610
|
+
currentRect: s,
|
|
1611
|
+
onDragStart: k,
|
|
1612
|
+
onDragHeaderStart: c,
|
|
1613
|
+
onResizeStart: S,
|
|
1614
|
+
teardown: C
|
|
1615
|
+
};
|
|
1616
|
+
}
|
|
1617
|
+
const pn = ["aria-labelledby"], mn = ["id"], vn = ["aria-label"], fn = ["onPointerdown"], gn = /* @__PURE__ */ O({
|
|
1618
|
+
__name: "movable-window",
|
|
1619
|
+
props: {
|
|
1620
|
+
name: {},
|
|
1621
|
+
dragMode: {},
|
|
1622
|
+
loading: { type: Boolean },
|
|
1623
|
+
closeLabel: {},
|
|
1624
|
+
clampBottom: { type: Boolean },
|
|
1625
|
+
headerClass: { type: [Boolean, null, String, Object, Array] },
|
|
1626
|
+
headerStyle: { type: [Boolean, null, String, Object, Array] }
|
|
1627
|
+
},
|
|
1628
|
+
emits: ["emit:close"],
|
|
1629
|
+
setup(n, { expose: t, emit: e }) {
|
|
1630
|
+
const o = n, a = e, l = B(), s = se(), p = ["top-left", "top-right", "bottom-left"], i = un({
|
|
1631
|
+
target: l,
|
|
1632
|
+
dragMode: () => o.dragMode,
|
|
1633
|
+
clampBottom: o.clampBottom
|
|
1634
|
+
}), r = E(() => {
|
|
1635
|
+
const { currentPosition: h, currentRect: v } = i;
|
|
1636
|
+
return {
|
|
1637
|
+
top: `${h.y}px`,
|
|
1638
|
+
left: `${h.x}px`,
|
|
1639
|
+
width: 0 <= v.width ? `${v.width}px` : void 0,
|
|
1640
|
+
height: 0 <= v.height ? `${v.height}px` : void 0
|
|
1641
|
+
};
|
|
1642
|
+
});
|
|
1643
|
+
return t({
|
|
1644
|
+
/** ウィンドウの要素 */
|
|
1645
|
+
element: l,
|
|
1646
|
+
/** 位置(px)。書き込むと移動する */
|
|
1647
|
+
position: i.currentPosition,
|
|
1648
|
+
/** 幅・高さ(px)。-1 は中身に合わせる。書き込むとその寸法になる */
|
|
1649
|
+
size: i.currentRect,
|
|
1650
|
+
/** ドラッグ・リサイズのリスナーを解除する */
|
|
1651
|
+
teardown: i.teardown
|
|
1652
|
+
}), (h, v) => (u(), f("div", {
|
|
1653
|
+
ref_key: "refWindow",
|
|
1654
|
+
ref: l,
|
|
1655
|
+
class: "dwui-movable-window",
|
|
1656
|
+
role: "dialog",
|
|
1657
|
+
"aria-labelledby": _(s),
|
|
1658
|
+
style: F(r.value)
|
|
1659
|
+
}, [
|
|
1660
|
+
b("div", {
|
|
1661
|
+
class: "dwui-movable-window-frame",
|
|
1662
|
+
onPointerdown: v[2] || (v[2] = //@ts-ignore
|
|
1663
|
+
(...m) => _(i).onDragStart && _(i).onDragStart(...m))
|
|
1664
|
+
}, [
|
|
1665
|
+
b("div", {
|
|
1666
|
+
class: I(["dwui-movable-window-header", [`${o.name}-header`, o.headerClass, { "dwui-movable": o.dragMode }]]),
|
|
1667
|
+
style: F(o.headerStyle),
|
|
1668
|
+
onPointerdown: v[1] || (v[1] = //@ts-ignore
|
|
1669
|
+
(...m) => _(i).onDragHeaderStart && _(i).onDragHeaderStart(...m))
|
|
1670
|
+
}, [
|
|
1671
|
+
b("div", {
|
|
1672
|
+
id: _(s),
|
|
1673
|
+
class: I(["dwui-movable-window-title", `${o.name}-title`])
|
|
1674
|
+
}, [
|
|
1675
|
+
x(h.$slots, "title")
|
|
1676
|
+
], 10, mn),
|
|
1677
|
+
x(h.$slots, "actions"),
|
|
1678
|
+
b("button", {
|
|
1679
|
+
type: "button",
|
|
1680
|
+
class: I(["dwui-movable-window-close-button", `${o.name}-close-button`]),
|
|
1681
|
+
"aria-label": o.closeLabel,
|
|
1682
|
+
onClick: v[0] || (v[0] = (m) => a("emit:close"))
|
|
1683
|
+
}, [
|
|
1684
|
+
D(_(Pt))
|
|
1685
|
+
], 10, vn)
|
|
1686
|
+
], 38),
|
|
1687
|
+
b("div", {
|
|
1688
|
+
class: I(["dwui-movable-window-body", [`${o.name}-body`, { "dwui-movable": o.dragMode === "body" }]])
|
|
1689
|
+
}, [
|
|
1690
|
+
x(h.$slots, "default")
|
|
1691
|
+
], 2)
|
|
1692
|
+
], 32),
|
|
1693
|
+
o.loading ? (u(), f("div", {
|
|
1694
|
+
key: 0,
|
|
1695
|
+
class: I(["dwui-movable-window-loading", `${o.name}-loading`])
|
|
1696
|
+
}, [
|
|
1697
|
+
b("div", {
|
|
1698
|
+
class: I(["dwui-movable-window-spinner", `${o.name}-spinner`])
|
|
1699
|
+
}, null, 2)
|
|
1700
|
+
], 2)) : T("", !0),
|
|
1701
|
+
(u(), f(K, null, U(p, (m) => b("div", {
|
|
1702
|
+
key: m,
|
|
1703
|
+
class: I(["dwui-movable-window-corner", [`${o.name}-corner`, `dwui-${m}`]]),
|
|
1704
|
+
onPointerdown: ee((C) => _(i).onResizeStart(C, m), ["prevent"])
|
|
1705
|
+
}, null, 42, fn)), 64)),
|
|
1706
|
+
b("div", {
|
|
1707
|
+
class: I(["dwui-movable-window-resizer", `${o.name}-resizer`]),
|
|
1708
|
+
onPointerdown: v[3] || (v[3] = ee((m) => _(i).onResizeStart(m, "bottom-right"), ["prevent"]))
|
|
1709
|
+
}, [
|
|
1710
|
+
D(_(Bt), { direction: "bottom-right" })
|
|
1711
|
+
], 34)
|
|
1712
|
+
], 12, pn));
|
|
1713
|
+
}
|
|
1714
|
+
});
|
|
1715
|
+
let Re = 0;
|
|
1716
|
+
const bn = () => (Re += 1, Re);
|
|
1717
|
+
function hn(n, t, e) {
|
|
1718
|
+
const o = document.createElement("div");
|
|
1719
|
+
document.body.appendChild(o);
|
|
1720
|
+
const a = B(!0), l = B(!1), s = {
|
|
1721
|
+
close: () => {
|
|
1722
|
+
a.value = !1;
|
|
1723
|
+
},
|
|
1724
|
+
setLoading: (r) => {
|
|
1725
|
+
l.value = r;
|
|
1726
|
+
}
|
|
1727
|
+
}, p = O(() => () => n({
|
|
1728
|
+
open: a.value,
|
|
1729
|
+
loading: l.value,
|
|
1730
|
+
"onUpdate:open": (r) => {
|
|
1731
|
+
a.value = r;
|
|
1732
|
+
},
|
|
1733
|
+
"onEmit:close": () => {
|
|
1734
|
+
e.delete(s), pe(null, o), o.remove(), t.onClosed?.(), t.onClose?.();
|
|
1735
|
+
}
|
|
1736
|
+
}, s)), i = me(p);
|
|
1737
|
+
return t.appContext && (i.appContext = t.appContext), pe(i, o), e.add(s), s;
|
|
1738
|
+
}
|
|
1739
|
+
function wn(n) {
|
|
1740
|
+
const t = Ke();
|
|
1741
|
+
if (!t)
|
|
1742
|
+
throw new Error(`${n}() must be called inside setup().`);
|
|
1743
|
+
const e = /* @__PURE__ */ new Set();
|
|
1744
|
+
return G(() => {
|
|
1745
|
+
for (const o of e)
|
|
1746
|
+
o.close();
|
|
1747
|
+
}), {
|
|
1748
|
+
appContext: t.appContext,
|
|
1749
|
+
own: (o) => {
|
|
1750
|
+
const a = o(() => {
|
|
1751
|
+
e.delete(a);
|
|
1752
|
+
});
|
|
1753
|
+
return e.add(a), a;
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
const ue = [], Qe = /* @__PURE__ */ new Set(), et = (n, t, e, o) => {
|
|
1758
|
+
const { appContext: a, onClose: l, ...s } = e ?? {};
|
|
1759
|
+
return hn((p, i) => me(yn, {
|
|
1760
|
+
...s,
|
|
1761
|
+
...p
|
|
1762
|
+
}, {
|
|
1763
|
+
default: () => me(n, {
|
|
1764
|
+
...t,
|
|
1765
|
+
close: i.close,
|
|
1766
|
+
setLoading: i.setLoading
|
|
1767
|
+
})
|
|
1768
|
+
}), { appContext: a, onClose: l, onClosed: o }, Qe);
|
|
1769
|
+
};
|
|
1770
|
+
function Yn(n, t, e) {
|
|
1771
|
+
return et(n, t, e);
|
|
1772
|
+
}
|
|
1773
|
+
function qn() {
|
|
1774
|
+
for (const n of [...Qe])
|
|
1775
|
+
n.close();
|
|
1776
|
+
}
|
|
1777
|
+
function Jn() {
|
|
1778
|
+
const n = wn("useOverlayBox");
|
|
1779
|
+
return {
|
|
1780
|
+
showOverlayBox: (t, e, o) => n.own((a) => et(t, e, {
|
|
1781
|
+
appContext: n.appContext,
|
|
1782
|
+
...o
|
|
1783
|
+
}, a))
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
const yn = /* @__PURE__ */ O({
|
|
1787
|
+
__name: "overlay-box",
|
|
1788
|
+
props: /* @__PURE__ */ J({
|
|
1789
|
+
title: { default: void 0 },
|
|
1790
|
+
dragMode: { default: void 0 },
|
|
1791
|
+
closeOnBackdrop: { type: Boolean, default: !1 },
|
|
1792
|
+
loading: { type: Boolean, default: !1 },
|
|
1793
|
+
closeLabel: { default: "Close" }
|
|
1794
|
+
}, {
|
|
1795
|
+
open: { type: Boolean, default: !1 },
|
|
1796
|
+
openModifiers: {}
|
|
1797
|
+
}),
|
|
1798
|
+
emits: /* @__PURE__ */ J(["emit:close"], ["update:open"]),
|
|
1799
|
+
setup(n, { emit: t }) {
|
|
1800
|
+
const e = n, o = t, a = re(n, "open"), l = B(), s = B(0), p = /* @__PURE__ */ Symbol("dwui-overlay-box");
|
|
1801
|
+
let i = null;
|
|
1802
|
+
const r = () => {
|
|
1803
|
+
e.closeOnBackdrop && (a.value = !1);
|
|
1804
|
+
}, h = () => {
|
|
1805
|
+
a.value = !1;
|
|
1806
|
+
}, v = (c) => {
|
|
1807
|
+
c.key !== "Escape" || !c.isTrusted || c.isComposing || c.target instanceof Element && c.target.closest("dialog") || ue.at(-1) === p && (a.value = !1);
|
|
1808
|
+
}, m = () => {
|
|
1809
|
+
o("emit:close");
|
|
1810
|
+
}, C = () => {
|
|
1811
|
+
const c = ue.indexOf(p);
|
|
1812
|
+
0 <= c && ue.splice(c, 1);
|
|
1813
|
+
}, P = () => {
|
|
1814
|
+
s.value = bn();
|
|
1815
|
+
const c = l.value, S = c?.element?.getBoundingClientRect();
|
|
1816
|
+
c && (c.position.x = (window.innerWidth - (S?.width || 0)) / 2, c.position.y = Math.max(0, (window.innerHeight - (S?.height || 0)) / 2)), i = document.activeElement instanceof HTMLElement ? document.activeElement : null, c?.element?.focus(), ue.push(p);
|
|
1817
|
+
}, k = () => {
|
|
1818
|
+
l.value?.teardown(), C(), i?.isConnected && i.focus(), i = null;
|
|
1819
|
+
};
|
|
1820
|
+
return X(() => {
|
|
1821
|
+
a.value && P();
|
|
1822
|
+
}), G(() => {
|
|
1823
|
+
C();
|
|
1824
|
+
}), Y(a, (c) => {
|
|
1825
|
+
c ? P() : k();
|
|
1826
|
+
}, { flush: "post" }), (c, S) => (u(), j(vt, {
|
|
1827
|
+
name: "dwui-overlay-box-fade",
|
|
1828
|
+
onAfterLeave: m
|
|
1829
|
+
}, {
|
|
1830
|
+
default: H(() => [
|
|
1831
|
+
a.value ? (u(), f("div", {
|
|
1832
|
+
key: 0,
|
|
1833
|
+
class: "dwui-overlay-box",
|
|
1834
|
+
style: F({ "--dwui-order-window": s.value })
|
|
1835
|
+
}, [
|
|
1836
|
+
b("div", {
|
|
1837
|
+
class: "dwui-overlay-box-backdrop",
|
|
1838
|
+
onClick: r
|
|
1839
|
+
}),
|
|
1840
|
+
D(gn, {
|
|
1841
|
+
ref_key: "refWindow",
|
|
1842
|
+
ref: l,
|
|
1843
|
+
class: "dwui-overlay-box-container",
|
|
1844
|
+
name: "dwui-overlay-box",
|
|
1845
|
+
tabindex: "-1",
|
|
1846
|
+
"drag-mode": e.dragMode,
|
|
1847
|
+
loading: e.loading,
|
|
1848
|
+
"close-label": e.closeLabel,
|
|
1849
|
+
"clamp-bottom": "",
|
|
1850
|
+
onKeydown: v,
|
|
1851
|
+
"onEmit:close": h
|
|
1852
|
+
}, {
|
|
1853
|
+
title: H(() => [
|
|
1854
|
+
x(c.$slots, "title", {}, () => [
|
|
1855
|
+
Q(A(e.title), 1)
|
|
1856
|
+
])
|
|
1857
|
+
]),
|
|
1858
|
+
default: H(() => [
|
|
1859
|
+
x(c.$slots, "default")
|
|
1860
|
+
]),
|
|
1861
|
+
_: 3
|
|
1862
|
+
}, 8, ["drag-mode", "loading", "close-label"])
|
|
1863
|
+
], 4)) : T("", !0)
|
|
1864
|
+
]),
|
|
1865
|
+
_: 3
|
|
1866
|
+
}));
|
|
1867
|
+
}
|
|
1868
|
+
}), _n = { class: "dwui-page-section" }, $n = { class: "dwui-page-section-content" }, Zn = /* @__PURE__ */ O({
|
|
1869
|
+
__name: "page-section",
|
|
1870
|
+
props: {
|
|
1871
|
+
title: {},
|
|
1872
|
+
icon: { default: "diamond" },
|
|
1873
|
+
iconVariant: {},
|
|
1874
|
+
iconColor: {},
|
|
1875
|
+
titleClass: { type: [Boolean, null, String, Object, Array] },
|
|
1876
|
+
titleStyle: { type: [Boolean, null, String, Object, Array] }
|
|
1877
|
+
},
|
|
1878
|
+
setup(n) {
|
|
1879
|
+
const t = n, e = {
|
|
1880
|
+
diamond: { component: At, shape: !0, color: "#1a44b6" },
|
|
1881
|
+
circle: { component: Mt, shape: !0, color: "#e78b2f" },
|
|
1882
|
+
square: { component: Et, shape: !0, color: "#d13a2b" },
|
|
1883
|
+
pushpin: { component: Tt, shape: !1 },
|
|
1884
|
+
"round-pushpin": { component: Lt, shape: !1 }
|
|
1885
|
+
}, o = E(() => {
|
|
1886
|
+
const a = e[t.icon];
|
|
1887
|
+
return {
|
|
1888
|
+
component: a.component,
|
|
1889
|
+
props: a.shape ? { variant: t.iconVariant, color: t.iconColor ?? a.color } : {}
|
|
1890
|
+
};
|
|
1891
|
+
});
|
|
1892
|
+
return (a, l) => (u(), f("section", _n, [
|
|
1893
|
+
t.title != null ? (u(), f("div", {
|
|
1894
|
+
key: 0,
|
|
1895
|
+
class: I(["dwui-page-section-title", t.titleClass]),
|
|
1896
|
+
style: F(t.titleStyle)
|
|
1897
|
+
}, [
|
|
1898
|
+
D(oe, null, {
|
|
1899
|
+
icon: H(() => [
|
|
1900
|
+
x(a.$slots, "icon", {}, () => [
|
|
1901
|
+
(u(), j(te(o.value.component), je(We(o.value.props)), null, 16))
|
|
1902
|
+
])
|
|
1903
|
+
]),
|
|
1904
|
+
default: H(() => [
|
|
1905
|
+
Q(" " + A(t.title), 1)
|
|
1906
|
+
]),
|
|
1907
|
+
_: 3
|
|
1908
|
+
})
|
|
1909
|
+
], 6)) : T("", !0),
|
|
1910
|
+
b("div", $n, [
|
|
1911
|
+
x(a.$slots, "default")
|
|
1912
|
+
])
|
|
1913
|
+
]));
|
|
1914
|
+
}
|
|
1915
|
+
}), kn = { class: "dwui-page-title" }, Cn = {
|
|
1916
|
+
key: 0,
|
|
1917
|
+
class: "dwui-page-title-actions"
|
|
1918
|
+
}, Qn = /* @__PURE__ */ O({
|
|
1919
|
+
__name: "page-title",
|
|
1920
|
+
props: {
|
|
1921
|
+
title: {}
|
|
1922
|
+
},
|
|
1923
|
+
setup(n) {
|
|
1924
|
+
const t = n, e = Z();
|
|
1925
|
+
return (o, a) => (u(), f("section", kn, [
|
|
1926
|
+
D(oe, { class: "dwui-page-title-label" }, de({
|
|
1927
|
+
default: H(() => [
|
|
1928
|
+
Q(" " + A(t.title), 1)
|
|
1929
|
+
]),
|
|
1930
|
+
_: 2
|
|
1931
|
+
}, [
|
|
1932
|
+
e.icon != null ? {
|
|
1933
|
+
name: "icon",
|
|
1934
|
+
fn: H(() => [
|
|
1935
|
+
x(o.$slots, "icon")
|
|
1936
|
+
]),
|
|
1937
|
+
key: "0"
|
|
1938
|
+
} : void 0
|
|
1939
|
+
]), 1024),
|
|
1940
|
+
e.default != null ? (u(), f("span", Cn, [
|
|
1941
|
+
x(o.$slots, "default")
|
|
1942
|
+
])) : T("", !0)
|
|
1943
|
+
]));
|
|
1944
|
+
}
|
|
1945
|
+
}), ea = /* @__PURE__ */ O({
|
|
1946
|
+
__name: "screen-loading",
|
|
1947
|
+
props: {
|
|
1948
|
+
loading: { type: Boolean }
|
|
1949
|
+
},
|
|
1950
|
+
setup(n) {
|
|
1951
|
+
const t = n, e = B(null), o = () => {
|
|
1952
|
+
const l = e.value;
|
|
1953
|
+
l && !l.open && l.showModal();
|
|
1954
|
+
}, a = () => {
|
|
1955
|
+
const l = e.value;
|
|
1956
|
+
l?.open && l.close();
|
|
1957
|
+
};
|
|
1958
|
+
return X(() => {
|
|
1959
|
+
t.loading && o();
|
|
1960
|
+
}), G(() => {
|
|
1961
|
+
a();
|
|
1962
|
+
}), Y(() => t.loading, (l) => {
|
|
1963
|
+
l ? o() : a();
|
|
1964
|
+
}, { flush: "post" }), (l, s) => (u(), f("dialog", {
|
|
1965
|
+
ref_key: "refDialog",
|
|
1966
|
+
ref: e,
|
|
1967
|
+
class: "dwui-screen-loading",
|
|
1968
|
+
closedby: "none",
|
|
1969
|
+
onCancel: s[0] || (s[0] = ee(() => {
|
|
1970
|
+
}, ["prevent"]))
|
|
1971
|
+
}, [...s[1] || (s[1] = [
|
|
1972
|
+
b("div", { class: "dwui-screen-loading-spinner" }, null, -1)
|
|
1973
|
+
])], 544));
|
|
1974
|
+
}
|
|
1975
|
+
}), tt = /* @__PURE__ */ Symbol("dwui-tab-group"), Sn = ["id", "aria-labelledby", "aria-busy", "hidden"], xn = {
|
|
1976
|
+
key: 0,
|
|
1977
|
+
class: "dwui-tab-loading"
|
|
1978
|
+
}, Pn = {
|
|
1979
|
+
key: 1,
|
|
1980
|
+
class: "dwui-tab-loading-spinner"
|
|
1981
|
+
}, Bn = /* @__PURE__ */ O({
|
|
1982
|
+
__name: "tab-content",
|
|
1983
|
+
props: {
|
|
1984
|
+
tabId: {},
|
|
1985
|
+
label: {},
|
|
1986
|
+
disabled: { type: Boolean },
|
|
1987
|
+
status: {},
|
|
1988
|
+
headerClass: { type: [Boolean, null, String, Object, Array] },
|
|
1989
|
+
headerStyle: { type: [Boolean, null, String, Object, Array] }
|
|
1990
|
+
},
|
|
1991
|
+
setup(n) {
|
|
1992
|
+
const t = n, e = ke(tt, void 0), o = B(!1), a = () => e?.loadingSlot(), l = E(() => e?.activeTabId.value === t.tabId), s = E(() => !!e?.mounted.value && l.value), p = (i) => {
|
|
1993
|
+
o.value = i;
|
|
1994
|
+
};
|
|
1995
|
+
return (i, r) => t.disabled ? T("", !0) : (u(), f("div", {
|
|
1996
|
+
key: 0,
|
|
1997
|
+
id: _(e) ? `${_(e).groupName}-${t.tabId}-panel` : void 0,
|
|
1998
|
+
class: "dwui-tab-content",
|
|
1999
|
+
role: "tabpanel",
|
|
2000
|
+
"aria-labelledby": _(e) ? `${_(e).groupName}-${t.tabId}` : void 0,
|
|
2001
|
+
"aria-busy": o.value ? "true" : void 0,
|
|
2002
|
+
hidden: !l.value
|
|
2003
|
+
}, [
|
|
2004
|
+
x(i.$slots, "default", {
|
|
2005
|
+
activated: s.value,
|
|
2006
|
+
setLoading: p
|
|
2007
|
+
}),
|
|
2008
|
+
o.value ? (u(), f("div", xn, [
|
|
2009
|
+
a() != null ? (u(), j(te(a()), { key: 0 })) : (u(), f("span", Pn))
|
|
2010
|
+
])) : T("", !0)
|
|
2011
|
+
], 8, Sn));
|
|
2012
|
+
}
|
|
2013
|
+
}), Ln = { class: "dwui-tab-group" }, Tn = ["id", "name", "disabled", "checked", "aria-selected", "aria-controls", "onChange"], En = ["for"], Mn = { class: "dwui-tab-items" }, ta = /* @__PURE__ */ O({
|
|
2014
|
+
__name: "tab-group",
|
|
2015
|
+
props: /* @__PURE__ */ J({
|
|
2016
|
+
tabGroupName: {},
|
|
2017
|
+
selectFirstEnabled: { type: Boolean },
|
|
2018
|
+
headerClass: { type: [Boolean, null, String, Object, Array] },
|
|
2019
|
+
headerStyle: { type: [Boolean, null, String, Object, Array] },
|
|
2020
|
+
teleport: {}
|
|
2021
|
+
}, {
|
|
2022
|
+
selectedTabId: {},
|
|
2023
|
+
selectedTabIdModifiers: {}
|
|
2024
|
+
}),
|
|
2025
|
+
emits: ["update:selectedTabId"],
|
|
2026
|
+
setup(n) {
|
|
2027
|
+
const t = n, e = re(n, "selectedTabId"), o = Z(), a = t.tabGroupName ?? se(), l = (h) => {
|
|
2028
|
+
if (h.type !== Bn)
|
|
2029
|
+
return;
|
|
2030
|
+
const v = h.props ?? {}, m = v.disabled;
|
|
2031
|
+
return {
|
|
2032
|
+
tabId: String(v["tab-id"] ?? v.tabId),
|
|
2033
|
+
label: v.label,
|
|
2034
|
+
// 属性だけを書いた場合(<TabContent disabled>)は空文字になる
|
|
2035
|
+
disabled: m === "" || !!m,
|
|
2036
|
+
status: v.status,
|
|
2037
|
+
headerClass: v["header-class"] ?? v.headerClass,
|
|
2038
|
+
headerStyle: v["header-style"] ?? v.headerStyle,
|
|
2039
|
+
// TabContentの#iconスロットは、TabContentではなくここで見出しに描画する
|
|
2040
|
+
icon: h.children?.icon
|
|
2041
|
+
};
|
|
2042
|
+
}, s = E(() => {
|
|
2043
|
+
const h = [];
|
|
2044
|
+
for (const v of o.default?.() ?? []) {
|
|
2045
|
+
const m = Array.isArray(v.children) ? v.children : [v];
|
|
2046
|
+
for (const C of m) {
|
|
2047
|
+
const P = l(C);
|
|
2048
|
+
P && h.push(P);
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
return h;
|
|
2052
|
+
}), p = E(() => e.value != null ? e.value : (t.selectFirstEnabled ? s.value.find((v) => !v.disabled) : s.value[0])?.tabId), i = B(!1);
|
|
2053
|
+
ft(tt, { groupName: a, activeTabId: p, mounted: i, loadingSlot: () => o.loading }), X(() => {
|
|
2054
|
+
i.value = !0;
|
|
2055
|
+
});
|
|
2056
|
+
const r = (h) => {
|
|
2057
|
+
e.value = h;
|
|
2058
|
+
};
|
|
2059
|
+
return (h, v) => (u(), f("div", Ln, [
|
|
2060
|
+
(u(), j(gt, {
|
|
2061
|
+
to: t.teleport ?? "body",
|
|
2062
|
+
disabled: t.teleport == null
|
|
2063
|
+
}, [
|
|
2064
|
+
b("div", {
|
|
2065
|
+
class: I(["dwui-tab-headers", t.headerClass]),
|
|
2066
|
+
role: "tablist",
|
|
2067
|
+
style: F(t.headerStyle)
|
|
2068
|
+
}, [
|
|
2069
|
+
(u(!0), f(K, null, U(s.value, (m) => (u(), f(K, {
|
|
2070
|
+
key: m.tabId
|
|
2071
|
+
}, [
|
|
2072
|
+
b("input", {
|
|
2073
|
+
id: `${_(a)}-${m.tabId}`,
|
|
2074
|
+
type: "radio",
|
|
2075
|
+
class: "dwui-tab-radio",
|
|
2076
|
+
role: "tab",
|
|
2077
|
+
name: _(a),
|
|
2078
|
+
disabled: m.disabled,
|
|
2079
|
+
checked: m.tabId === p.value,
|
|
2080
|
+
"aria-selected": m.tabId === p.value ? "true" : "false",
|
|
2081
|
+
"aria-controls": `${_(a)}-${m.tabId}-panel`,
|
|
2082
|
+
onChange: (C) => r(m.tabId)
|
|
2083
|
+
}, null, 40, Tn),
|
|
2084
|
+
b("label", {
|
|
2085
|
+
for: `${_(a)}-${m.tabId}`,
|
|
2086
|
+
class: I(["dwui-tab-item", [m.status != null ? `dwui-tab-${m.status}` : void 0, m.headerClass]]),
|
|
2087
|
+
style: F(m.headerStyle)
|
|
2088
|
+
}, [
|
|
2089
|
+
D(oe, null, de({
|
|
2090
|
+
default: H(() => [
|
|
2091
|
+
Q(" " + A(m.label), 1)
|
|
2092
|
+
]),
|
|
2093
|
+
_: 2
|
|
2094
|
+
}, [
|
|
2095
|
+
m.icon != null ? {
|
|
2096
|
+
name: "icon",
|
|
2097
|
+
fn: H(() => [
|
|
2098
|
+
(u(), j(te(m.icon)))
|
|
2099
|
+
]),
|
|
2100
|
+
key: "0"
|
|
2101
|
+
} : void 0
|
|
2102
|
+
]), 1024)
|
|
2103
|
+
], 14, En)
|
|
2104
|
+
], 64))), 128))
|
|
2105
|
+
], 6)
|
|
2106
|
+
], 8, ["to", "disabled"])),
|
|
2107
|
+
b("div", Mn, [
|
|
2108
|
+
x(h.$slots, "default")
|
|
2109
|
+
])
|
|
2110
|
+
]));
|
|
2111
|
+
}
|
|
2112
|
+
}), oa = /* @__PURE__ */ O({
|
|
2113
|
+
__name: "warning-popper",
|
|
2114
|
+
props: {
|
|
2115
|
+
placement: { default: "right" },
|
|
2116
|
+
arrow: { type: Boolean, default: !0 },
|
|
2117
|
+
label: { default: "Warning" }
|
|
2118
|
+
},
|
|
2119
|
+
emits: ["emit:open", "emit:close"],
|
|
2120
|
+
setup(n, { emit: t }) {
|
|
2121
|
+
const e = n, o = t;
|
|
2122
|
+
return (a, l) => (u(), j(Ze, {
|
|
2123
|
+
class: "dwui-warning-popper",
|
|
2124
|
+
"popover-class": "dwui-warning-popper-popover",
|
|
2125
|
+
placement: e.placement,
|
|
2126
|
+
arrow: e.arrow,
|
|
2127
|
+
label: e.label,
|
|
2128
|
+
"onEmit:open": l[0] || (l[0] = (s) => o("emit:open")),
|
|
2129
|
+
"onEmit:close": l[1] || (l[1] = (s) => o("emit:close"))
|
|
2130
|
+
}, {
|
|
2131
|
+
icon: H(() => [
|
|
2132
|
+
x(a.$slots, "icon", {}, () => [
|
|
2133
|
+
D(_(Ge))
|
|
2134
|
+
])
|
|
2135
|
+
]),
|
|
2136
|
+
default: H(() => [
|
|
2137
|
+
x(a.$slots, "default")
|
|
2138
|
+
]),
|
|
2139
|
+
_: 3
|
|
2140
|
+
}, 8, ["placement", "arrow", "label"]));
|
|
2141
|
+
}
|
|
2142
|
+
});
|
|
2143
|
+
export {
|
|
2144
|
+
Rn as A,
|
|
2145
|
+
jn as B,
|
|
2146
|
+
Yn as C,
|
|
2147
|
+
Zt as D,
|
|
2148
|
+
Jn as E,
|
|
2149
|
+
Qt as F,
|
|
2150
|
+
Xe as G,
|
|
2151
|
+
gn as _,
|
|
2152
|
+
zn as a,
|
|
2153
|
+
Xn as b,
|
|
2154
|
+
zo as c,
|
|
2155
|
+
ea as d,
|
|
2156
|
+
Dn as e,
|
|
2157
|
+
In as f,
|
|
2158
|
+
Hn as g,
|
|
2159
|
+
Wn as h,
|
|
2160
|
+
Kn as i,
|
|
2161
|
+
Fn as j,
|
|
2162
|
+
Vn as k,
|
|
2163
|
+
Gn as l,
|
|
2164
|
+
hn as m,
|
|
2165
|
+
bn as n,
|
|
2166
|
+
Un as o,
|
|
2167
|
+
oe as p,
|
|
2168
|
+
yn as q,
|
|
2169
|
+
Zn as r,
|
|
2170
|
+
Qn as s,
|
|
2171
|
+
Yo as t,
|
|
2172
|
+
wn as u,
|
|
2173
|
+
Bn as v,
|
|
2174
|
+
ta as w,
|
|
2175
|
+
oa as x,
|
|
2176
|
+
qn as y,
|
|
2177
|
+
Nn as z
|
|
2178
|
+
};
|