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