@digitalwalletcorp/vue-core 1.3.0 → 1.4.0

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