@digitalwalletcorp/vue-core 1.4.0 → 1.4.1

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 (106) hide show
  1. package/lib/accordion-section.d.cts +1 -1
  2. package/lib/accordion-section.d.ts +1 -1
  3. package/lib/components-BCJWnExf.cjs +1 -0
  4. package/lib/{components-B2jz-g6A.js → components-CDIhw5uP.js} +5 -5
  5. package/lib/data-table.d.cts +1 -1
  6. package/lib/data-table.d.ts +1 -1
  7. package/lib/{types → helpers}/data-table.d.cts +47 -0
  8. package/lib/{types → helpers}/data-table.d.ts +47 -0
  9. package/lib/helpers/{show-floating-component.d.cts → floating-component.d.cts} +1 -1
  10. package/lib/helpers/{show-floating-component.d.ts → floating-component.d.ts} +1 -1
  11. package/lib/helpers/{show-modal-dialog.d.cts → modal-dialog.d.cts} +13 -1
  12. package/lib/helpers/{show-modal-dialog.d.ts → modal-dialog.d.ts} +13 -1
  13. package/lib/helpers/{show-overlay-box.d.ts → overlay-box.d.cts} +3 -1
  14. package/lib/helpers/{show-overlay-box.d.cts → overlay-box.d.ts} +3 -1
  15. package/lib/helpers/{show-snackbar.d.cts → snackbar.d.cts} +16 -1
  16. package/lib/helpers/{show-snackbar.d.ts → snackbar.d.ts} +16 -1
  17. package/lib/index.cjs +1 -1
  18. package/lib/index.d.cts +15 -18
  19. package/lib/index.d.ts +15 -18
  20. package/lib/index.js +181 -265
  21. package/lib/internal/data-table-controls.d.cts +1 -1
  22. package/lib/internal/data-table-controls.d.ts +1 -1
  23. package/lib/internal/floating-component.d.cts +1 -1
  24. package/lib/internal/floating-component.d.ts +1 -1
  25. package/lib/internal/movable-window.d.cts +1 -1
  26. package/lib/internal/movable-window.d.ts +1 -1
  27. package/lib/internal/pagination.d.cts +1 -1
  28. package/lib/internal/pagination.d.ts +1 -1
  29. package/lib/internal/snackbar-container.d.cts +1 -1
  30. package/lib/internal/snackbar-container.d.ts +1 -1
  31. package/lib/internal/use-movable-window.d.cts +1 -1
  32. package/lib/internal/use-movable-window.d.ts +1 -1
  33. package/lib/internal/{mount-window.d.cts → window-control.d.cts} +22 -1
  34. package/lib/internal/{mount-window.d.ts → window-control.d.ts} +22 -1
  35. package/lib/label-button.d.cts +1 -1
  36. package/lib/label-button.d.ts +1 -1
  37. package/lib/label-icon.d.cts +12 -2
  38. package/lib/label-icon.d.ts +12 -2
  39. package/lib/modal-dialog.d.cts +1 -1
  40. package/lib/modal-dialog.d.ts +1 -1
  41. package/lib/nuxt.cjs +1 -1
  42. package/lib/nuxt.js +1 -1
  43. package/lib/overlay-box.d.cts +1 -1
  44. package/lib/overlay-box.d.ts +1 -1
  45. package/lib/register.cjs +1 -1
  46. package/lib/register.js +1 -1
  47. package/lib/tab-content.d.cts +1 -1
  48. package/lib/tab-content.d.ts +1 -1
  49. package/lib/warning-popper.vue_vue_type_style_index_0_lang-BJxLA6aU.js +1954 -0
  50. package/lib/warning-popper.vue_vue_type_style_index_0_lang-TYmLM_h9.cjs +1 -0
  51. package/package.json +1 -1
  52. package/src/accordion-section.vue +1 -1
  53. package/src/data-table.vue +2 -2
  54. package/src/helpers/data-table.ts +250 -0
  55. package/src/helpers/{show-floating-component.ts → floating-component.ts} +2 -2
  56. package/src/helpers/{show-modal-dialog.ts → modal-dialog.ts} +17 -1
  57. package/src/helpers/{show-overlay-box.ts → overlay-box.ts} +5 -2
  58. package/src/helpers/{show-snackbar.ts → snackbar.ts} +19 -1
  59. package/src/index.ts +15 -18
  60. package/src/internal/data-table-controls.vue +1 -1
  61. package/src/internal/floating-component.vue +2 -2
  62. package/src/internal/movable-window.vue +1 -1
  63. package/src/internal/pagination.vue +1 -1
  64. package/src/internal/snackbar-container.vue +1 -1
  65. package/src/internal/use-movable-window.ts +1 -1
  66. package/src/internal/{mount-window.ts → window-control.ts} +31 -1
  67. package/src/label-button.vue +1 -1
  68. package/src/label-icon.vue +13 -2
  69. package/src/modal-dialog.vue +1 -1
  70. package/src/overlay-box.vue +3 -3
  71. package/src/tab-content.vue +2 -2
  72. package/src/tab-group.vue +2 -2
  73. package/lib/components-COL2ZbhC.cjs +0 -1
  74. package/lib/helpers/data-table-csv.d.cts +0 -17
  75. package/lib/helpers/data-table-csv.d.ts +0 -17
  76. package/lib/internal/data-table-value.d.cts +0 -32
  77. package/lib/internal/data-table-value.d.ts +0 -32
  78. package/lib/internal/opened-overlay-boxes.d.cts +0 -2
  79. package/lib/internal/opened-overlay-boxes.d.ts +0 -2
  80. package/lib/internal/snackbar-item.d.cts +0 -17
  81. package/lib/internal/snackbar-item.d.ts +0 -17
  82. package/lib/internal/window-order.d.cts +0 -6
  83. package/lib/internal/window-order.d.ts +0 -6
  84. package/lib/types/label-preset.d.cts +0 -12
  85. package/lib/types/label-preset.d.ts +0 -12
  86. package/lib/types/modal-dialog.d.cts +0 -13
  87. package/lib/types/modal-dialog.d.ts +0 -13
  88. package/lib/types/movable-window.d.cts +0 -16
  89. package/lib/types/movable-window.d.ts +0 -16
  90. package/lib/warning-popper.vue_vue_type_style_index_0_lang-4FIOsOY5.cjs +0 -1
  91. package/lib/warning-popper.vue_vue_type_style_index_0_lang-CgXoSjjp.js +0 -1865
  92. package/src/helpers/data-table-csv.ts +0 -55
  93. package/src/internal/data-table-value.ts +0 -99
  94. package/src/internal/opened-overlay-boxes.ts +0 -2
  95. package/src/internal/snackbar-item.ts +0 -20
  96. package/src/internal/window-order.ts +0 -11
  97. package/src/types/data-table.ts +0 -99
  98. package/src/types/label-preset.ts +0 -13
  99. package/src/types/modal-dialog.ts +0 -16
  100. package/src/types/movable-window.ts +0 -18
  101. /package/lib/helpers/{show-screen-loading.d.cts → screen-loading.d.cts} +0 -0
  102. /package/lib/helpers/{show-screen-loading.d.ts → screen-loading.d.ts} +0 -0
  103. /package/lib/internal/{tab-group-context.d.cts → tab-group.d.cts} +0 -0
  104. /package/lib/internal/{tab-group-context.d.ts → tab-group.d.ts} +0 -0
  105. /package/src/helpers/{show-screen-loading.ts → screen-loading.ts} +0 -0
  106. /package/src/internal/{tab-group-context.ts → tab-group.ts} +0 -0
@@ -0,0 +1,1954 @@
1
+ import { defineComponent as A, useSlots as J, 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 se, computed as T, createElementVNode as f, createVNode as O, unref as _, createSlots as ie, withCtx as z, mergeModels as Q, withModifiers as ee, normalizeProps as De, guardReactiveProps as Ie, Fragment as K, renderList as Y, inject as Ne, shallowRef as ot, watch as X, withKeys as ve, useAttrs as He, useId as ae, reactive as Ce, getCurrentInstance as nt, render as Se, h as ge, Transition as lt, provide as at, Teleport as st } from "vue";
2
+ import { SvgTriangleButton as ze, SvgMemo as it, SvgHighBrightness as rt, SvgMoonPhases as dt, SvgChevronDouble as xe, SvgChevron as Pe, SvgBlackArrow as Be, SvgFolderDownload as ct, SvgCloudDownload as ut, SvgPointingTriangle as pt, SvgQuestion as he, SvgHourglass as mt, SvgCritical as vt, SvgWarningSign as Re, SvgInfo as gt, SvgNegativeSquaredCrossMark as ft, SvgCornerDiagonal as bt, SvgRoundPushpin as ht, SvgPushpin as wt, SvgSquare as yt, SvgCircle as _t, SvgDiamond as $t } 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 = J();
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
+ }), kt = 70;
37
+ function je(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 = kt <= o.scrollHeight;
44
+ }), e.observe(o));
45
+ }), U(() => {
46
+ e?.disconnect();
47
+ }), t;
48
+ }
49
+ const Ct = ["disabled"], St = { class: "dwui-accordion-legend" }, xt = ["aria-expanded"], sn = /* @__PURE__ */ A({
50
+ __name: "accordion-fieldset",
51
+ props: /* @__PURE__ */ Q({
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 = J(), o = B(), l = se(n, "expanded"), a = B(!!t.initialExpand), s = T({
62
+ get: () => l.value ?? a.value,
63
+ set: (c) => {
64
+ a.value = c, l.value = c;
65
+ }
66
+ }), m = je(o), d = () => {
67
+ s.value = !s.value;
68
+ };
69
+ return (c, h) => (u(), b("fieldset", {
70
+ class: "dwui-accordion-fieldset",
71
+ disabled: t.disabled
72
+ }, [
73
+ f("legend", St, [
74
+ f("button", {
75
+ type: "button",
76
+ class: "dwui-accordion-toggle",
77
+ "aria-expanded": s.value,
78
+ onClick: d
79
+ }, [
80
+ O(_(ze), {
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 }, ie({ _: 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, xt)
102
+ ]),
103
+ f("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
+ }), Pt = { class: "dwui-accordion-section" }, Bt = {
113
+ key: 0,
114
+ class: "dwui-accordion-section-control"
115
+ }, Lt = ["disabled", "aria-expanded"], rn = /* @__PURE__ */ A({
116
+ __name: "accordion-section",
117
+ props: /* @__PURE__ */ Q({
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 = J(), o = B(), l = se(n, "expanded"), a = B(!!t.initialExpand), s = T({
132
+ get: () => l.value ?? a.value,
133
+ set: (C) => {
134
+ a.value = C, l.value = C;
135
+ }
136
+ }), m = je(o), d = T(() => s.value ? t.collapsePreset : t.expandPreset), c = () => (s.value ? e["collapse-icon"] : e["expand-icon"]) ?? d.value?.icon, h = () => (s.value ? e["collapse-icon"] : e["expand-icon"]) == null ? d.value?.iconProps : void 0, g = T(() => {
137
+ const C = s.value ? t.collapseLabel : t.expandLabel;
138
+ if (C != null)
139
+ return C;
140
+ const P = d.value?.label;
141
+ return typeof P == "function" ? P() : P;
142
+ }), p = () => {
143
+ s.value = !s.value;
144
+ };
145
+ return (C, P) => (u(), b("div", Pt, [
146
+ f("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(C.$slots, "default")
155
+ ], 2),
156
+ _(m) ? (u(), b("div", Bt, [
157
+ f("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 || g.value != null ? (u(), j(oe, { key: 0 }, ie({ _: 2 }, [
165
+ c() != null ? {
166
+ name: "icon",
167
+ fn: z(() => [
168
+ (u(), j(te(c()), De(Ie(h())), null, 16))
169
+ ]),
170
+ key: "0"
171
+ } : void 0,
172
+ g.value != null ? {
173
+ name: "default",
174
+ fn: z(() => [
175
+ Z(H(g.value), 1)
176
+ ]),
177
+ key: "1"
178
+ } : void 0
179
+ ]), 1024)) : (u(), j(_(ze), {
180
+ key: 1,
181
+ direction: s.value ? "up" : "down"
182
+ }, null, 8, ["direction"]))
183
+ ], 8, Lt)
184
+ ])) : M("", !0)
185
+ ]));
186
+ }
187
+ }), Tt = ["aria-label"], dn = /* @__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 = J(), 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(_(it))
213
+ ])
214
+ ], 8, Tt));
215
+ }
216
+ }), Et = ["aria-label", "aria-checked"], Mt = { class: "dwui-dark-mode-selector-track" }, At = { class: "dwui-dark-mode-selector-icon-light" }, Ot = { class: "dwui-dark-mode-selector-icon-dark" }, cn = /* @__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", d = () => 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 r = document.documentElement.classList;
235
+ r.remove(k === "dark" ? "light" : "dark"), r.add(k), l.value = k === "dark", a !== k && (a = k, o("emit:change", k));
236
+ }, g = (k) => {
237
+ try {
238
+ localStorage.setItem(e.storageKey, k);
239
+ } catch {
240
+ }
241
+ h(k);
242
+ }, p = () => {
243
+ g(l.value ? "light" : "dark");
244
+ }, C = (k) => {
245
+ g(k.matches ? "dark" : "light");
246
+ }, P = (k) => {
247
+ k.key === e.storageKey && h(m(k.newValue) ? k.newValue : d());
248
+ };
249
+ return G(() => {
250
+ s = window.matchMedia("(prefers-color-scheme: dark)"), h(c() ?? d()), s.addEventListener("change", C), window.addEventListener("storage", P);
251
+ }), U(() => {
252
+ s?.removeEventListener("change", C), window.removeEventListener("storage", P);
253
+ }), (k, r) => (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
+ f("span", Mt, [
262
+ f("span", At, [
263
+ x(k.$slots, "icon-light", {}, () => [
264
+ O(_(rt))
265
+ ])
266
+ ]),
267
+ f("span", Ot, [
268
+ x(k.$slots, "icon-dark", {}, () => [
269
+ O(_(dt), { "moon-age": 3.85 })
270
+ ])
271
+ ])
272
+ ]),
273
+ r[0] || (r[0] = f("span", { class: "dwui-dark-mode-selector-handle" }, null, -1))
274
+ ], 8, Et));
275
+ }
276
+ }), Dt = { class: "dwui-pagination" }, It = { class: "dwui-pagination-list" }, Nt = ["disabled", "aria-label", "title"], Ht = ["disabled", "aria-label", "title"], zt = ["disabled", "aria-label", "title"], Rt = ["aria-current", "onClick"], jt = ["disabled", "aria-label", "title"], Wt = ["disabled", "aria-label", "title"], Kt = ["disabled", "aria-label", "title"], Ft = {
277
+ key: 0,
278
+ class: "dwui-pagination-select"
279
+ }, Vt = ["value", "disabled"], Ut = ["value"], Gt = /* @__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 = T(() => Math.ceil(e.totalCount / e.limit)), a = T(() => Math.min(Math.max(e.current, 1), l.value)), s = B(!1), m = T(() => l.value < 1 ? [] : s.value ? Array.from({ length: l.value }, (r, S) => S + 1) : [a.value]), d = T(() => {
292
+ if (l.value < 1)
293
+ return [];
294
+ const r = Math.min(
295
+ Math.max(a.value - Math.floor((e.maxPagination - 1) / 2), 1),
296
+ Math.max(l.value - e.maxPagination + 1, 1)
297
+ ), S = Math.min(r + e.maxPagination - 1, l.value);
298
+ return Array.from({ length: S - r + 1 }, (w, D) => r + D);
299
+ }), c = (r) => {
300
+ r !== e.current && o("emit:changePage", r);
301
+ }, h = (r) => {
302
+ let S;
303
+ r < 0 ? S = Math.max(d.value[0] - e.maxPagination, 1) : S = Math.min(d.value[d.value.length - 1] + e.maxPagination, l.value) - e.maxPagination + 1, c(S + Math.round((e.maxPagination - 1) / 2));
304
+ }, g = (r) => {
305
+ c(Number(r.target.value));
306
+ }, p = () => {
307
+ s.value = !0;
308
+ }, C = (r) => {
309
+ document.activeElement !== r.currentTarget && (s.value = !1);
310
+ }, P = () => {
311
+ s.value = !0;
312
+ }, k = () => {
313
+ s.value = !1;
314
+ };
315
+ return (r, S) => (u(), b("div", Dt, [
316
+ f("ul", It, [
317
+ f("li", null, [
318
+ f("button", {
319
+ type: "button",
320
+ disabled: a.value <= 1,
321
+ "aria-label": e.labels.firstPage,
322
+ title: e.labels.firstPage,
323
+ onClick: S[0] || (S[0] = (w) => c(1))
324
+ }, [
325
+ O(_(xe), {
326
+ direction: "left",
327
+ size: "1em",
328
+ "stroke-width": 8
329
+ })
330
+ ], 8, Nt)
331
+ ]),
332
+ f("li", null, [
333
+ f("button", {
334
+ type: "button",
335
+ disabled: a.value <= 1,
336
+ "aria-label": e.labels.previousPage,
337
+ title: e.labels.previousPage,
338
+ onClick: S[1] || (S[1] = (w) => c(a.value - 1))
339
+ }, [
340
+ O(_(Pe), {
341
+ direction: "left",
342
+ size: "1em",
343
+ "stroke-width": 8
344
+ })
345
+ ], 8, Ht)
346
+ ]),
347
+ f("li", null, [
348
+ f("button", {
349
+ type: "button",
350
+ disabled: d.value.length === 0 || d.value[0] === 1,
351
+ "aria-label": e.labels.previousPages,
352
+ title: e.labels.previousPages,
353
+ onClick: S[2] || (S[2] = (w) => h(-1))
354
+ }, [
355
+ O(_(Be), {
356
+ direction: "left",
357
+ size: "1em"
358
+ })
359
+ ], 8, zt)
360
+ ]),
361
+ (u(!0), b(K, null, Y(d.value, (w) => (u(), b("li", { key: w }, [
362
+ f("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, Rt)
368
+ ]))), 128)),
369
+ f("li", null, [
370
+ f("button", {
371
+ type: "button",
372
+ disabled: d.value.length === 0 || d.value[d.value.length - 1] === l.value,
373
+ "aria-label": e.labels.nextPages,
374
+ title: e.labels.nextPages,
375
+ onClick: S[3] || (S[3] = (w) => h(1))
376
+ }, [
377
+ O(_(Be), {
378
+ direction: "right",
379
+ size: "1em"
380
+ })
381
+ ], 8, jt)
382
+ ]),
383
+ f("li", null, [
384
+ f("button", {
385
+ type: "button",
386
+ disabled: l.value <= a.value,
387
+ "aria-label": e.labels.nextPage,
388
+ title: e.labels.nextPage,
389
+ onClick: S[4] || (S[4] = (w) => c(a.value + 1))
390
+ }, [
391
+ O(_(Pe), {
392
+ direction: "right",
393
+ size: "1em",
394
+ "stroke-width": 8
395
+ })
396
+ ], 8, Wt)
397
+ ]),
398
+ f("li", null, [
399
+ f("button", {
400
+ type: "button",
401
+ disabled: l.value <= a.value,
402
+ "aria-label": e.labels.lastPage,
403
+ title: e.labels.lastPage,
404
+ onClick: S[5] || (S[5] = (w) => c(l.value))
405
+ }, [
406
+ O(_(xe), {
407
+ direction: "right",
408
+ size: "1em",
409
+ "stroke-width": 8
410
+ })
411
+ ], 8, Kt)
412
+ ])
413
+ ]),
414
+ e.showPageSelect ? (u(), b("label", Ft, [
415
+ f("span", null, H(e.labels.pageNumber), 1),
416
+ f("select", {
417
+ value: a.value,
418
+ disabled: l.value <= 1,
419
+ onPointerenter: p,
420
+ onPointerleave: C,
421
+ onFocus: P,
422
+ onBlur: k,
423
+ onChange: g
424
+ }, [
425
+ (u(!0), b(K, 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, Ut))), 128))
429
+ ], 40, Vt)
430
+ ])) : M("", !0)
431
+ ]));
432
+ }
433
+ }), Xt = { class: "dwui-data-table-controls" }, Yt = { class: "dwui-data-table-tools" }, qt = {
434
+ key: 0,
435
+ class: "dwui-data-table-total"
436
+ }, Qt = { class: "dwui-data-table-total-count" }, Jt = {
437
+ key: 1,
438
+ class: "dwui-data-table-limit"
439
+ }, Zt = ["value", "max"], eo = ["title", "aria-label"], to = ["title", "aria-label"], Le = /* @__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 = T(() => e.formatTotalCount ? e.formatTotalCount(e.totalCount) : l.format(e.totalCount)), s = (m) => {
459
+ const d = m.target, c = Math.min(Math.max(Math.trunc(Number(d.value)) || 1, 1), e.maxLimit);
460
+ d.value = String(c), c !== e.limit && o("emit:changeLimit", c);
461
+ };
462
+ return (m, d) => (u(), b("div", Xt, [
463
+ e.pagination ? (u(), j(Gt, {
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": d[0] || (d[0] = (c) => o("emit:changePage", c))
472
+ }, null, 8, ["current", "total-count", "limit", "max-pagination", "show-page-select", "labels"])) : M("", !0),
473
+ f("div", Yt, [
474
+ e.showTotal ? (u(), b("span", qt, [
475
+ f("span", null, H(e.labels.totalCount), 1),
476
+ f("span", Qt, H(a.value), 1),
477
+ f("span", null, H(e.labels.totalUnit), 1)
478
+ ])) : M("", !0),
479
+ e.showLimit ? (u(), b("label", Jt, [
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, Zt)
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: d[1] || (d[1] = (c) => o("emit:downloadPage"))
496
+ }, [
497
+ O(_(ct))
498
+ ], 8, eo)) : 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: d[2] || (d[2] = (c) => o("emit:downloadAll"))
505
+ }, [
506
+ O(_(ut))
507
+ ], 8, to)) : M("", !0)
508
+ ])
509
+ ]));
510
+ }
511
+ }), fe = (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
+ }, be = (n) => typeof n == "function" ? n() : n ?? "", Te = (n) => n === !0 || n === "true" || n === "1" || n === "on" || n === 1, Ee = (n) => typeof n == "number" ? n : Number(String(n).replace(/[^+\-\d.]/g, "")), oo = (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 = Ee(n), l = Ee(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 ce(n).localeCompare(ce(t));
537
+ default:
538
+ return String(n).localeCompare(String(t));
539
+ }
540
+ }, ce = (n) => {
541
+ try {
542
+ return JSON.stringify(n, (t, e) => typeof e == "bigint" ? e.toString() : e) ?? "";
543
+ } catch {
544
+ return "";
545
+ }
546
+ }, no = "$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
+ }, un = (n) => We(n).map(({ header: t, column: e }) => be(e.label ?? t.label)), pn = (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 === no ? e : fe(t, a);
560
+ }), lo = /* @__PURE__ */ Symbol("dwui-vue-core-options"), ao = ["rowspan", "colspan", "title", "aria-sort"], so = { class: "dwui-data-table-header" }, io = ["role", "tabindex", "onClick", "onKeydown"], ro = ["innerHTML"], co = { key: 2 }, uo = ["onPointerdown"], po = {
561
+ key: 0,
562
+ class: "dwui-data-table-no-data"
563
+ }, mo = ["colspan"], vo = {
564
+ key: 0,
565
+ class: "dwui-data-table-loading"
566
+ }, mn = /* @__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 = Ne(lo, {}), s = B(), m = B(), d = B(), c = B({}), h = B(""), g = B(!1), p = B();
599
+ let C;
600
+ const P = T(() => 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
+ }, r = T(() => {
621
+ const i = { ...k };
622
+ for (const v of [a.dataTable ?? {}, o])
623
+ for (const y of Object.keys(k))
624
+ v[y] !== void 0 && Object.assign(i, { [y]: v[y] });
625
+ return i;
626
+ }), S = T(() => {
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
+ }, v = {};
644
+ for (const y of Object.keys(i)) {
645
+ const E = i[y];
646
+ v[y] = typeof E == "function" ? E() : E;
647
+ }
648
+ return v;
649
+ }), w = T(() => Math.min(o.limit, r.value.maxLimit)), D = T(() => ({
650
+ showTotal: r.value.showTotal,
651
+ showLimit: r.value.showLimit,
652
+ showPageSelect: r.value.showPageSelect,
653
+ showDownloadPage: r.value.showDownloadPage,
654
+ showDownloadAll: r.value.showDownloadAll,
655
+ current: o.current,
656
+ limit: w.value,
657
+ maxLimit: r.value.maxLimit,
658
+ maxPagination: r.value.maxPagination,
659
+ totalCount: o.totalCount ?? o.dataList.length,
660
+ formatTotalCount: r.value.formatTotalCount,
661
+ labels: S.value
662
+ })), $ = ot(void 0), I = T(() => {
663
+ const i = r.value.sortMode === "page" ? o.headers.find((y) => y.id === h.value) : void 0;
664
+ if (!i)
665
+ return o.dataList;
666
+ const v = i.compare ?? ((y, E) => {
667
+ const R = i.sortKey ?? i.id;
668
+ return oo(fe(y, R), fe(E, R), i.type ?? "string");
669
+ });
670
+ return [...o.dataList].sort((y, E) => g.value ? v(E, y) : v(y, E));
671
+ }), L = T(() => {
672
+ const i = $.value;
673
+ if (i == null)
674
+ return -1;
675
+ const v = I.value.indexOf(i);
676
+ if (v !== -1)
677
+ return v;
678
+ const y = ce(i);
679
+ return y === "" ? -1 : I.value.findIndex((E) => ce(E) === y);
680
+ }), V = T(() => o.headers.reduce((i, v) => i + (v.colspan == null ? 1 : Number(v.colspan)), 0)), W = (i) => {
681
+ if (i != null)
682
+ return typeof i == "number" ? `${i}px` : i;
683
+ }, q = (i) => ({
684
+ width: W(i.width),
685
+ minWidth: W(i.minWidth),
686
+ maxWidth: W(i.maxWidth)
687
+ }), Xe = (i) => {
688
+ if (h.value === i)
689
+ return g.value ? "descending" : "ascending";
690
+ }, we = (i) => {
691
+ if (!(!r.value.sortable || h.value !== i))
692
+ return g.value ? "down" : "up";
693
+ }, Ye = (i) => (o.current - 1) * w.value + i + 1, ye = () => Array.from(d.value?.children ?? []).filter((i) => i.tagName === "TR" && !i.classList.contains("dwui-data-table-no-data")), qe = (i) => Array.from(i.children).filter((v) => v.tagName === "TD" || v.tagName === "TH"), _e = () => {
694
+ l("emit:updateHeader", P.value.map((i) => ({ ...i })));
695
+ }, ue = () => {
696
+ ye().forEach((i, v) => i.classList.toggle("dwui-selected", v === L.value));
697
+ }, Qe = () => {
698
+ const i = s.value, v = ye()[L.value];
699
+ if (!i || !v)
700
+ return;
701
+ const y = m.value?.offsetHeight ?? 0, E = v.offsetTop, R = E + v.offsetHeight;
702
+ E < i.scrollTop + y ? i.scrollTop = E - y : i.scrollTop + i.clientHeight < R && (i.scrollTop = R - i.clientHeight);
703
+ }, re = (i, v) => {
704
+ $.value = i, l("emit:selectRow", i, v);
705
+ }, $e = (i, v) => {
706
+ r.value.selectable && (v === L.value ? re(void 0, -1) : (re(i, v), s.value?.focus({ preventScroll: !0 })));
707
+ }, Je = (i, v) => {
708
+ v !== L.value && $e(i, v), l("emit:dblclickRow", i, v);
709
+ }, Ze = (i) => {
710
+ if (i.target !== i.currentTarget || L.value < 0 || i.key !== "ArrowUp" && i.key !== "ArrowDown")
711
+ return;
712
+ const v = L.value + (i.key === "ArrowUp" ? -1 : 1);
713
+ v < 0 || I.value.length <= v || (i.preventDefault(), re(I.value[v], v));
714
+ }, pe = (i) => {
715
+ !r.value.sortable || o.dataList.length === 0 || (g.value = h.value === i.id ? !g.value : !1, h.value = i.id, l("emit:changeSort", {
716
+ sortKey: h.value,
717
+ descending: g.value
718
+ }));
719
+ }, et = (i, v) => {
720
+ if (!r.value.resizable)
721
+ return;
722
+ i.preventDefault();
723
+ const y = m.value?.firstElementChild, E = y ? qe(y) : [];
724
+ for (const [R, ne] of E.entries())
725
+ c.value[o.headers[R].id] = ne.getBoundingClientRect().width;
726
+ p.value = { index: v, x: i.clientX }, i.currentTarget.setPointerCapture(i.pointerId), _e();
727
+ }, tt = (i) => {
728
+ if (!p.value)
729
+ return;
730
+ const v = i.clientX - p.value.x;
731
+ if (v === 0)
732
+ return;
733
+ p.value.x = i.clientX;
734
+ const y = p.value.index, E = o.headers.map((ne) => ne.id);
735
+ c.value[E[y]] += v;
736
+ const R = v / (E.length - y - 1);
737
+ for (const ne of E.slice(y + 1))
738
+ c.value[ne] -= R;
739
+ }, ke = () => {
740
+ p.value && (p.value = void 0, _e());
741
+ };
742
+ return G(() => {
743
+ C = new MutationObserver(ue), d.value && C.observe(d.value, { childList: !0 }), ue();
744
+ }), U(() => {
745
+ C?.disconnect();
746
+ }), X(() => o.headers, (i, v) => {
747
+ const y = i.map((R) => R.id), E = v.map((R) => R.id);
748
+ (y.length !== E.length || y.some((R) => !E.includes(R))) && (c.value = {});
749
+ }), X(() => o.loading, (i, v) => {
750
+ v && !i && (r.value.sortMode === "page" && (h.value = "", g.value = !1), $.value != null && re(void 0, -1));
751
+ }), X(L, (i) => {
752
+ 0 <= i && Qe();
753
+ }, { flush: "post" }), X(L, ue, { flush: "post" }), t({
754
+ /** ソートの状態を返す */
755
+ getSortContext: () => ({
756
+ sortKey: h.value,
757
+ descending: g.value
758
+ })
759
+ }), (i, v) => (u(), b("section", {
760
+ class: N(["dwui-data-table", { "dwui-selectable": r.value.selectable }])
761
+ }, [
762
+ r.value.controls === "both" || r.value.controls === "top" ? (u(), j(Le, le({ key: 0 }, D.value, {
763
+ pagination: r.value.pagination === "both" || r.value.pagination === "top",
764
+ "onEmit:changePage": v[0] || (v[0] = (y) => l("emit:changePage", y)),
765
+ "onEmit:changeLimit": v[1] || (v[1] = (y) => l("emit:changeLimit", y)),
766
+ "onEmit:downloadPage": v[2] || (v[2] = (y) => l("emit:downloadPage")),
767
+ "onEmit:downloadAll": v[3] || (v[3] = (y) => l("emit:downloadAll"))
768
+ }), null, 16, ["pagination"])) : M("", !0),
769
+ f("div", {
770
+ ref_key: "refContent",
771
+ ref: s,
772
+ class: N(["dwui-data-table-content", [{ "dwui-loading": o.loading }, r.value.contentClass]]),
773
+ style: F(r.value.contentStyle),
774
+ tabindex: "-1",
775
+ onKeydown: Ze
776
+ }, [
777
+ f("table", {
778
+ class: N(r.value.tableClass),
779
+ style: F(r.value.tableStyle)
780
+ }, [
781
+ f("thead", {
782
+ ref_key: "refThead",
783
+ ref: m
784
+ }, [
785
+ f("tr", null, [
786
+ (u(!0), b(K, null, Y(P.value, (y, E) => (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": Xe(y.id),
793
+ scope: "col"
794
+ }, [
795
+ f("div", so, [
796
+ f("span", {
797
+ class: "dwui-data-table-sort",
798
+ role: r.value.sortable ? "button" : void 0,
799
+ tabindex: r.value.sortable ? 0 : void 0,
800
+ onClick: (R) => pe(y),
801
+ onKeydown: [
802
+ ve(ee((R) => pe(y), ["prevent"]), ["enter"]),
803
+ ve(ee((R) => pe(y), ["prevent"]), ["space"])
804
+ ]
805
+ }, [
806
+ we(y.id) ? (u(), j(_(pt), {
807
+ key: 0,
808
+ direction: we(y.id),
809
+ size: "0.7em"
810
+ }, null, 8, ["direction"])) : M("", !0),
811
+ y.html ? (u(), b("span", {
812
+ key: 1,
813
+ innerHTML: _(be)(y.label)
814
+ }, null, 8, ro)) : (u(), b("span", co, H(_(be)(y.label)), 1))
815
+ ], 40, io)
816
+ ]),
817
+ r.value.resizable && E < P.value.length - 1 ? (u(), b("div", {
818
+ key: 0,
819
+ class: "dwui-data-table-resizer",
820
+ onPointerdown: (R) => et(R, E),
821
+ onPointermove: tt,
822
+ onPointerup: ke,
823
+ onPointercancel: ke
824
+ }, null, 40, uo)) : M("", !0)
825
+ ], 12, ao))), 128))
826
+ ])
827
+ ], 512),
828
+ f("tbody", {
829
+ ref_key: "refTbody",
830
+ ref: d
831
+ }, [
832
+ o.loading ? M("", !0) : (u(), b(K, { key: 0 }, [
833
+ x(i.$slots, "default", {
834
+ rows: I.value,
835
+ clickRow: $e,
836
+ dblclickRow: Je,
837
+ rowNumber: Ye,
838
+ selectedIndex: L.value
839
+ }),
840
+ o.dataList.length === 0 && r.value.showNoData ? (u(), b("tr", po, [
841
+ f("td", { colspan: V.value }, H(S.value.noData), 9, mo)
842
+ ])) : M("", !0)
843
+ ], 64))
844
+ ], 512)
845
+ ], 6),
846
+ o.loading ? (u(), b("div", vo, [
847
+ x(i.$slots, "loading", {}, () => [
848
+ v[8] || (v[8] = f("div", { class: "dwui-data-table-loading-spinner" }, null, -1))
849
+ ])
850
+ ])) : M("", !0)
851
+ ], 38),
852
+ r.value.controls === "both" || r.value.controls === "bottom" ? (u(), j(Le, le({ key: 1 }, D.value, {
853
+ pagination: r.value.pagination === "both" || r.value.pagination === "bottom",
854
+ "onEmit:changePage": v[4] || (v[4] = (y) => l("emit:changePage", y)),
855
+ "onEmit:changeLimit": v[5] || (v[5] = (y) => l("emit:changeLimit", y)),
856
+ "onEmit:downloadPage": v[6] || (v[6] = (y) => l("emit:downloadPage")),
857
+ "onEmit:downloadAll": v[7] || (v[7] = (y) => l("emit:downloadAll"))
858
+ }), null, 16, ["pagination"])) : M("", !0)
859
+ ], 2));
860
+ }
861
+ }), Me = {
862
+ top: "bottom",
863
+ bottom: "top",
864
+ left: "right",
865
+ right: "left"
866
+ }, me = (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, d = "center"] = o.placement.split("-"), c = m === "top" || m === "bottom", h = n.top + n.height, g = 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 - g - a
872
+ }, k = (c ? t.height : t.width) + l <= p[m] || p[Me[m]] <= p[m] ? m : Me[m];
873
+ let r;
874
+ switch (k) {
875
+ case "top":
876
+ r = n.top - l - t.height;
877
+ break;
878
+ case "bottom":
879
+ r = h + l;
880
+ break;
881
+ case "left":
882
+ r = n.left - l - t.width;
883
+ break;
884
+ default:
885
+ r = g + l;
886
+ break;
887
+ }
888
+ const S = c ? n.left : n.top, w = c ? n.width : n.height, D = c ? t.width : t.height;
889
+ let $;
890
+ switch (d) {
891
+ case "start":
892
+ $ = S;
893
+ break;
894
+ case "end":
895
+ $ = S + w - D;
896
+ break;
897
+ default:
898
+ $ = S + (w - D) / 2;
899
+ break;
900
+ }
901
+ const I = me(c ? r : $, a, Math.max(a, e.height - a - t.height)), L = me(c ? $ : r, a, Math.max(a, e.width - a - t.width)), V = S + w / 2, q = me(V - (c ? L : I), s, Math.max(s, D - s));
902
+ return { top: I, left: L, side: k, arrow: q };
903
+ }, fo = ["popover", "data-side"], bo = { class: "dwui-anchored-popover-content" }, Ae = 4, ho = 7, wo = 12, yo = 8, Ke = /* @__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
+ }, d = () => {
916
+ a.value?.showPopover();
917
+ }, c = () => {
918
+ const p = a.value;
919
+ if (!o.anchor || !p)
920
+ return;
921
+ const C = {
922
+ width: document.documentElement.clientWidth,
923
+ height: document.documentElement.clientHeight
924
+ }, P = go(o.anchor.getBoundingClientRect(), p.getBoundingClientRect(), C, {
925
+ placement: o.placement,
926
+ offset: o.arrow ? Ae + ho : Ae,
927
+ margin: yo,
928
+ arrowMargin: wo
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
+ }, g = (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: d,
942
+ hide: m
943
+ }), (p, C) => (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: g
950
+ }, [
951
+ f("div", bo, [
952
+ x(p.$slots, "default")
953
+ ])
954
+ ], 42, fo));
955
+ }
956
+ }), _o = ["aria-label"], vn = /* @__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 = He(), a = B(), s = B();
967
+ return G(() => {
968
+ const m = s.value?.element;
969
+ a.value && m && (a.value.popoverTargetElement = m);
970
+ }), (m, d) => (u(), b(K, null, [
971
+ f("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(_(he))
980
+ ])
981
+ ], 16, _o),
982
+ O(Ke, {
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": d[0] || (d[0] = (c) => o("emit:open")),
991
+ "onEmit:close": d[1] || (d[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
+ }), $o = ["aria-label", "aria-describedby"], ko = 150, Fe = /* @__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 = He(), a = B(), s = B(), m = B(!1), d = ae();
1012
+ let c;
1013
+ const h = () => {
1014
+ c !== void 0 && (clearTimeout(c), c = void 0);
1015
+ }, g = () => {
1016
+ h(), s.value?.show();
1017
+ }, p = () => {
1018
+ h(), s.value?.hide();
1019
+ }, C = () => {
1020
+ h(), c = setTimeout(() => {
1021
+ c = void 0, s.value?.hide();
1022
+ }, ko);
1023
+ }, P = (W) => {
1024
+ const q = W.target;
1025
+ !a.value?.contains(q) && !s.value?.element?.contains(q) && p();
1026
+ }, k = (W) => {
1027
+ W.pointerType !== "touch" && g();
1028
+ }, r = (W) => {
1029
+ W.pointerType !== "touch" && C();
1030
+ }, S = (W) => {
1031
+ W.pointerType !== "touch" && h();
1032
+ }, w = (W) => {
1033
+ W.pointerType === "touch" && (m.value ? p() : g());
1034
+ }, D = () => {
1035
+ g();
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
+ }), (W, q) => (u(), b(K, null, [
1048
+ f("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": _(d)
1055
+ }, _(l), {
1056
+ onPointerenter: k,
1057
+ onPointerleave: r,
1058
+ onPointerdown: w,
1059
+ onFocus: D,
1060
+ onBlur: $,
1061
+ onKeydown: ve(I, ["esc"])
1062
+ }), [
1063
+ x(W.$slots, "icon")
1064
+ ], 16, $o),
1065
+ O(Ke, {
1066
+ ref_key: "refPopover",
1067
+ ref: s,
1068
+ id: _(d),
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: S,
1076
+ onPointerleave: r,
1077
+ "onEmit:open": L,
1078
+ "onEmit:close": V
1079
+ }, {
1080
+ default: z(() => [
1081
+ x(W.$slots, "default")
1082
+ ]),
1083
+ _: 3
1084
+ }, 8, ["id", "class", "anchor", "placement", "arrow"])
1085
+ ], 64));
1086
+ }
1087
+ }), gn = /* @__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(Fe, {
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(_(he))
1109
+ ])
1110
+ ]),
1111
+ default: z(() => [
1112
+ x(l.$slots, "default")
1113
+ ]),
1114
+ _: 3
1115
+ }, 8, ["placement", "arrow", "label"]));
1116
+ }
1117
+ }), fn = /* @__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(_(mt), {
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
+ }), bn = /* @__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((d) => {
1146
+ d.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" }), (d, c) => (u(), b("div", {
1160
+ ref_key: "refTarget",
1161
+ ref: l,
1162
+ class: "dwui-intersection-lazy-component"
1163
+ }, [
1164
+ a.value ? x(d.$slots, "default", {}, void 0, void 0, 0) : x(d.$slots, "placeholder", {}, void 0, void 0, 1)
1165
+ ], 512));
1166
+ }
1167
+ }), Co = {
1168
+ type: "button",
1169
+ class: "dwui-label-button"
1170
+ }, hn = /* @__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 = J();
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
+ }, ie({ _: 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
+ }), So = ["aria-labelledby", "aria-describedby"], xo = { class: "dwui-modal-dialog-header" }, Po = { class: "dwui-modal-dialog-icon" }, Bo = ["id", "innerHTML"], Lo = ["id"], To = ["id"], Eo = ["innerHTML"], Mo = { key: 1 }, Ao = {
1209
+ key: 0,
1210
+ class: "dwui-modal-dialog-images"
1211
+ }, Oo = ["src", "alt"], Do = ["onClick"], wn = /* @__PURE__ */ A({
1212
+ __name: "modal-dialog",
1213
+ props: /* @__PURE__ */ Q({
1214
+ type: { default: "info" },
1215
+ title: { default: void 0 },
1216
+ message: { default: void 0 },
1217
+ html: { type: Boolean, default: !1 },
1218
+ image: { default: void 0 },
1219
+ buttons: { default: void 0 },
1220
+ okLabel: { default: "OK" },
1221
+ yesLabel: { default: "Yes" },
1222
+ noLabel: { default: "No" },
1223
+ cancelLabel: { default: "Cancel" }
1224
+ }, {
1225
+ open: { type: Boolean, default: !1 },
1226
+ openModifiers: {}
1227
+ }),
1228
+ emits: /* @__PURE__ */ Q(["emit:close"], ["update:open"]),
1229
+ setup(n, { emit: t }) {
1230
+ const e = n, o = t, l = se(n, "open"), a = B(), s = B(), m = ae(), d = ae(), c = {
1231
+ info: gt,
1232
+ confirm: he,
1233
+ warn: Re,
1234
+ error: vt
1235
+ }, h = ["cancel", "no", "yes", "ok"], g = T(() => e.buttons ?? (e.type === "confirm" ? ["yes", "no"] : ["ok"])), p = T(() => ({
1236
+ ok: e.okLabel,
1237
+ yes: e.yesLabel,
1238
+ no: e.noLabel,
1239
+ cancel: e.cancelLabel
1240
+ })), C = T(() => e.message == null ? [] : [e.message].flat()), P = T(() => [e.image ?? []].flat().map(($) => typeof $ == "string" ? {
1241
+ src: $,
1242
+ alt: ""
1243
+ } : $)), k = ($) => {
1244
+ D($);
1245
+ }, r = ($) => {
1246
+ $.preventDefault(), D("cancel");
1247
+ }, S = ($) => {
1248
+ if ($.key !== "ArrowLeft" && $.key !== "ArrowRight")
1249
+ return;
1250
+ const I = [...s.value?.children ?? []], L = I.indexOf(document.activeElement);
1251
+ L < 0 || I[$.key === "ArrowRight" ? L + 1 : L - 1]?.focus();
1252
+ }, w = () => {
1253
+ a.value?.showModal();
1254
+ const $ = h.find((L) => g.value.includes(L)), I = $ ? g.value.indexOf($) : -1;
1255
+ s.value?.children[I]?.focus();
1256
+ }, D = ($) => {
1257
+ a.value?.close(), l.value = !1, o("emit:close", $);
1258
+ };
1259
+ return G(() => {
1260
+ l.value && w();
1261
+ }), X(l, ($) => {
1262
+ $ ? w() : a.value?.close();
1263
+ }, { flush: "post" }), ($, I) => (u(), b("dialog", {
1264
+ ref_key: "refDialog",
1265
+ ref: a,
1266
+ class: N(["dwui-modal-dialog", `dwui-modal-dialog-${e.type}`]),
1267
+ "aria-labelledby": e.title ? _(m) : void 0,
1268
+ "aria-describedby": _(d),
1269
+ onCancel: r,
1270
+ onKeydown: S
1271
+ }, [
1272
+ f("div", xo, [
1273
+ f("span", Po, [
1274
+ x($.$slots, "icon", {}, () => [
1275
+ (u(), j(te(c[e.type])))
1276
+ ])
1277
+ ]),
1278
+ e.title ? (u(), b(K, { key: 0 }, [
1279
+ e.html ? (u(), b("span", {
1280
+ key: 0,
1281
+ id: _(m),
1282
+ class: "dwui-modal-dialog-title",
1283
+ innerHTML: e.title
1284
+ }, null, 8, Bo)) : (u(), b("span", {
1285
+ key: 1,
1286
+ id: _(m),
1287
+ class: "dwui-modal-dialog-title"
1288
+ }, H(e.title), 9, Lo))
1289
+ ], 64)) : M("", !0)
1290
+ ]),
1291
+ f("div", {
1292
+ id: _(d),
1293
+ class: "dwui-modal-dialog-body"
1294
+ }, [
1295
+ x($.$slots, "default", {}, () => [
1296
+ (u(!0), b(K, null, Y(C.value, (L, V) => (u(), b(K, { key: V }, [
1297
+ e.html ? (u(), b("p", {
1298
+ key: 0,
1299
+ innerHTML: L
1300
+ }, null, 8, Eo)) : (u(), b("p", Mo, H(L), 1))
1301
+ ], 64))), 128)),
1302
+ P.value.length ? (u(), b("div", Ao, [
1303
+ (u(!0), b(K, null, Y(P.value, (L, V) => (u(), b("img", {
1304
+ key: V,
1305
+ src: L.src,
1306
+ alt: L.alt
1307
+ }, null, 8, Oo))), 128))
1308
+ ])) : M("", !0)
1309
+ ])
1310
+ ], 8, To),
1311
+ f("div", {
1312
+ ref_key: "refButtons",
1313
+ ref: s,
1314
+ class: "dwui-modal-dialog-buttons"
1315
+ }, [
1316
+ (u(!0), b(K, null, Y(g.value, (L) => (u(), b("button", {
1317
+ key: L,
1318
+ type: "button",
1319
+ class: N(["dwui-modal-dialog-button", `dwui-modal-dialog-button-${L}`]),
1320
+ onClick: (V) => k(L)
1321
+ }, H(p.value[L]), 11, Do))), 128))
1322
+ ], 512)
1323
+ ], 42, So));
1324
+ }
1325
+ });
1326
+ function Io(n) {
1327
+ const t = n.minWidth ?? 20, e = n.minHeight ?? 20, o = B(!1), l = B(!1), a = Ce({
1328
+ x: 0,
1329
+ y: 0
1330
+ }), s = Ce({
1331
+ width: -1,
1332
+ height: -1
1333
+ });
1334
+ let m = null, d = "bottom-right", c = {
1335
+ x: 0,
1336
+ y: 0
1337
+ };
1338
+ const h = (w) => {
1339
+ if (w.pointerId !== m)
1340
+ return;
1341
+ w.preventDefault();
1342
+ const D = w.clientX - c.x, $ = w.clientY - c.y;
1343
+ if (c = {
1344
+ x: w.clientX,
1345
+ y: w.clientY
1346
+ }, o.value)
1347
+ a.x += D, a.y += $;
1348
+ else if (l.value) {
1349
+ if (d.endsWith("left")) {
1350
+ const I = Math.max(t, s.width - D);
1351
+ a.x += s.width - I, s.width = I;
1352
+ } else
1353
+ s.width = Math.max(t, s.width + D);
1354
+ if (d.startsWith("top")) {
1355
+ const I = Math.max(e, s.height - $);
1356
+ a.y += s.height - I, s.height = I;
1357
+ } else
1358
+ s.height = Math.max(e, s.height + $);
1359
+ }
1360
+ }, g = () => {
1361
+ const w = n.target.value?.getBoundingClientRect().width || 0;
1362
+ 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);
1363
+ }, p = (w) => {
1364
+ if (w.pointerId !== m)
1365
+ return;
1366
+ const D = o.value;
1367
+ C(), D && g();
1368
+ }, C = () => {
1369
+ document.removeEventListener("pointermove", h, !0), document.removeEventListener("pointerup", p, !0), document.removeEventListener("pointercancel", p, !0), m = null, o.value = !1, l.value = !1;
1370
+ }, P = (w) => {
1371
+ C(), m = w.pointerId, c = {
1372
+ x: w.clientX,
1373
+ y: w.clientY
1374
+ }, document.addEventListener("pointermove", h, !0), document.addEventListener("pointerup", p, !0), document.addEventListener("pointercancel", p, !0);
1375
+ }, k = (w) => {
1376
+ w.isPrimary && n.dragMode() === "body" && (P(w), o.value = !0);
1377
+ }, r = (w) => {
1378
+ w.isPrimary && n.dragMode() === "header" && (P(w), o.value = !0);
1379
+ }, S = (w, D = "bottom-right") => {
1380
+ if (!w.isPrimary)
1381
+ return;
1382
+ d = D;
1383
+ const $ = n.target.value?.getBoundingClientRect();
1384
+ $ && (s.width < 0 && (s.width = $.width), s.height < 0 && (s.height = $.height)), P(w), l.value = !0;
1385
+ };
1386
+ return U(C), {
1387
+ moving: o,
1388
+ resizing: l,
1389
+ currentPosition: a,
1390
+ currentRect: s,
1391
+ onDragStart: k,
1392
+ onDragHeaderStart: r,
1393
+ onResizeStart: S,
1394
+ teardown: C
1395
+ };
1396
+ }
1397
+ const No = ["aria-labelledby"], Ho = ["id"], zo = ["aria-label"], Ro = ["onPointerdown"], jo = /* @__PURE__ */ A({
1398
+ __name: "movable-window",
1399
+ props: {
1400
+ name: {},
1401
+ dragMode: {},
1402
+ loading: { type: Boolean },
1403
+ closeLabel: {},
1404
+ clampBottom: { type: Boolean },
1405
+ headerClass: { type: [Boolean, null, String, Object, Array] },
1406
+ headerStyle: { type: [Boolean, null, String, Object, Array] }
1407
+ },
1408
+ emits: ["emit:close"],
1409
+ setup(n, { expose: t, emit: e }) {
1410
+ const o = n, l = e, a = B(), s = ae(), m = ["top-left", "top-right", "bottom-left"], d = Io({
1411
+ target: a,
1412
+ dragMode: () => o.dragMode,
1413
+ clampBottom: o.clampBottom
1414
+ }), c = T(() => {
1415
+ const { currentPosition: h, currentRect: g } = d;
1416
+ return {
1417
+ top: `${h.y}px`,
1418
+ left: `${h.x}px`,
1419
+ width: 0 <= g.width ? `${g.width}px` : void 0,
1420
+ height: 0 <= g.height ? `${g.height}px` : void 0
1421
+ };
1422
+ });
1423
+ return t({
1424
+ /** ウィンドウの要素 */
1425
+ element: a,
1426
+ /** 位置(px)。書き込むと移動する */
1427
+ position: d.currentPosition,
1428
+ /** 幅・高さ(px)。-1 は中身に合わせる。書き込むとその寸法になる */
1429
+ size: d.currentRect,
1430
+ /** ドラッグ・リサイズのリスナーを解除する */
1431
+ teardown: d.teardown
1432
+ }), (h, g) => (u(), b("div", {
1433
+ ref_key: "refWindow",
1434
+ ref: a,
1435
+ class: "dwui-movable-window",
1436
+ role: "dialog",
1437
+ "aria-labelledby": _(s),
1438
+ style: F(c.value)
1439
+ }, [
1440
+ f("div", {
1441
+ class: "dwui-movable-window-frame",
1442
+ onPointerdown: g[2] || (g[2] = //@ts-ignore
1443
+ (...p) => _(d).onDragStart && _(d).onDragStart(...p))
1444
+ }, [
1445
+ f("div", {
1446
+ class: N(["dwui-movable-window-header", [`${o.name}-header`, o.headerClass, { "dwui-movable": o.dragMode }]]),
1447
+ style: F(o.headerStyle),
1448
+ onPointerdown: g[1] || (g[1] = //@ts-ignore
1449
+ (...p) => _(d).onDragHeaderStart && _(d).onDragHeaderStart(...p))
1450
+ }, [
1451
+ f("div", {
1452
+ id: _(s),
1453
+ class: N(["dwui-movable-window-title", `${o.name}-title`])
1454
+ }, [
1455
+ x(h.$slots, "title")
1456
+ ], 10, Ho),
1457
+ x(h.$slots, "actions"),
1458
+ f("button", {
1459
+ type: "button",
1460
+ class: N(["dwui-movable-window-close-button", `${o.name}-close-button`]),
1461
+ "aria-label": o.closeLabel,
1462
+ onClick: g[0] || (g[0] = (p) => l("emit:close"))
1463
+ }, [
1464
+ O(_(ft))
1465
+ ], 10, zo)
1466
+ ], 38),
1467
+ f("div", {
1468
+ class: N(["dwui-movable-window-body", [`${o.name}-body`, { "dwui-movable": o.dragMode === "body" }]])
1469
+ }, [
1470
+ x(h.$slots, "default")
1471
+ ], 2)
1472
+ ], 32),
1473
+ o.loading ? (u(), b("div", {
1474
+ key: 0,
1475
+ class: N(["dwui-movable-window-loading", `${o.name}-loading`])
1476
+ }, [
1477
+ f("div", {
1478
+ class: N(["dwui-movable-window-spinner", `${o.name}-spinner`])
1479
+ }, null, 2)
1480
+ ], 2)) : M("", !0),
1481
+ (u(), b(K, null, Y(m, (p) => f("div", {
1482
+ key: p,
1483
+ class: N(["dwui-movable-window-corner", [`${o.name}-corner`, `dwui-${p}`]]),
1484
+ onPointerdown: ee((C) => _(d).onResizeStart(C, p), ["prevent"])
1485
+ }, null, 42, Ro)), 64)),
1486
+ f("div", {
1487
+ class: N(["dwui-movable-window-resizer", `${o.name}-resizer`]),
1488
+ onPointerdown: g[3] || (g[3] = ee((p) => _(d).onResizeStart(p, "bottom-right"), ["prevent"]))
1489
+ }, [
1490
+ O(_(bt), { direction: "bottom-right" })
1491
+ ], 34)
1492
+ ], 12, No));
1493
+ }
1494
+ });
1495
+ let Oe = 0;
1496
+ const Wo = () => (Oe += 1, Oe);
1497
+ function Ko(n, t, e) {
1498
+ const o = document.createElement("div");
1499
+ document.body.appendChild(o);
1500
+ const l = B(!0), a = B(!1), s = {
1501
+ close: () => {
1502
+ l.value = !1;
1503
+ },
1504
+ setLoading: (c) => {
1505
+ a.value = c;
1506
+ }
1507
+ }, m = A(() => () => n({
1508
+ open: l.value,
1509
+ loading: a.value,
1510
+ "onUpdate:open": (c) => {
1511
+ l.value = c;
1512
+ },
1513
+ "onEmit:close": () => {
1514
+ e.delete(s), Se(null, o), o.remove(), t.onClosed?.(), t.onClose?.();
1515
+ }
1516
+ }, s)), d = ge(m);
1517
+ return t.appContext && (d.appContext = t.appContext), Se(d, o), e.add(s), s;
1518
+ }
1519
+ function Fo(n) {
1520
+ const t = nt();
1521
+ if (!t)
1522
+ throw new Error(`${n}() must be called inside setup().`);
1523
+ const e = /* @__PURE__ */ new Set();
1524
+ return U(() => {
1525
+ for (const o of e)
1526
+ o.close();
1527
+ }), {
1528
+ appContext: t.appContext,
1529
+ own: (o) => {
1530
+ const l = o(() => {
1531
+ e.delete(l);
1532
+ });
1533
+ return e.add(l), l;
1534
+ }
1535
+ };
1536
+ }
1537
+ const de = [], Ve = /* @__PURE__ */ new Set(), Ue = (n, t, e, o) => {
1538
+ const { appContext: l, onClose: a, ...s } = e ?? {};
1539
+ return Ko((m, d) => ge(Vo, {
1540
+ ...s,
1541
+ ...m
1542
+ }, {
1543
+ default: () => ge(n, {
1544
+ ...t,
1545
+ close: d.close,
1546
+ setLoading: d.setLoading
1547
+ })
1548
+ }), { appContext: l, onClose: a, onClosed: o }, Ve);
1549
+ };
1550
+ function yn(n, t, e) {
1551
+ return Ue(n, t, e);
1552
+ }
1553
+ function _n() {
1554
+ for (const n of [...Ve])
1555
+ n.close();
1556
+ }
1557
+ function $n() {
1558
+ const n = Fo("useOverlayBox");
1559
+ return {
1560
+ showOverlayBox: (t, e, o) => n.own((l) => Ue(t, e, {
1561
+ appContext: n.appContext,
1562
+ ...o
1563
+ }, l))
1564
+ };
1565
+ }
1566
+ const Vo = /* @__PURE__ */ A({
1567
+ __name: "overlay-box",
1568
+ props: /* @__PURE__ */ Q({
1569
+ title: { default: void 0 },
1570
+ dragMode: { default: void 0 },
1571
+ closeOnBackdrop: { type: Boolean, default: !1 },
1572
+ loading: { type: Boolean, default: !1 },
1573
+ closeLabel: { default: "Close" }
1574
+ }, {
1575
+ open: { type: Boolean, default: !1 },
1576
+ openModifiers: {}
1577
+ }),
1578
+ emits: /* @__PURE__ */ Q(["emit:close"], ["update:open"]),
1579
+ setup(n, { emit: t }) {
1580
+ const e = n, o = t, l = se(n, "open"), a = B(), s = B(0), m = /* @__PURE__ */ Symbol("dwui-overlay-box");
1581
+ let d = null;
1582
+ const c = () => {
1583
+ e.closeOnBackdrop && (l.value = !1);
1584
+ }, h = () => {
1585
+ l.value = !1;
1586
+ }, g = (r) => {
1587
+ r.key !== "Escape" || !r.isTrusted || r.isComposing || r.target instanceof Element && r.target.closest("dialog") || de.at(-1) === m && (l.value = !1);
1588
+ }, p = () => {
1589
+ o("emit:close");
1590
+ }, C = () => {
1591
+ const r = de.indexOf(m);
1592
+ 0 <= r && de.splice(r, 1);
1593
+ }, P = () => {
1594
+ s.value = Wo();
1595
+ const r = a.value, S = r?.element?.getBoundingClientRect();
1596
+ r && (r.position.x = (window.innerWidth - (S?.width || 0)) / 2, r.position.y = Math.max(0, (window.innerHeight - (S?.height || 0)) / 2)), d = document.activeElement instanceof HTMLElement ? document.activeElement : null, r?.element?.focus(), de.push(m);
1597
+ }, k = () => {
1598
+ a.value?.teardown(), C(), d?.isConnected && d.focus(), d = null;
1599
+ };
1600
+ return G(() => {
1601
+ l.value && P();
1602
+ }), U(() => {
1603
+ C();
1604
+ }), X(l, (r) => {
1605
+ r ? P() : k();
1606
+ }, { flush: "post" }), (r, S) => (u(), j(lt, {
1607
+ name: "dwui-overlay-box-fade",
1608
+ onAfterLeave: p
1609
+ }, {
1610
+ default: z(() => [
1611
+ l.value ? (u(), b("div", {
1612
+ key: 0,
1613
+ class: "dwui-overlay-box",
1614
+ style: F({ "--dwui-order-window": s.value })
1615
+ }, [
1616
+ f("div", {
1617
+ class: "dwui-overlay-box-backdrop",
1618
+ onClick: c
1619
+ }),
1620
+ O(jo, {
1621
+ ref_key: "refWindow",
1622
+ ref: a,
1623
+ class: "dwui-overlay-box-container",
1624
+ name: "dwui-overlay-box",
1625
+ tabindex: "-1",
1626
+ "drag-mode": e.dragMode,
1627
+ loading: e.loading,
1628
+ "close-label": e.closeLabel,
1629
+ "clamp-bottom": "",
1630
+ onKeydown: g,
1631
+ "onEmit:close": h
1632
+ }, {
1633
+ title: z(() => [
1634
+ x(r.$slots, "title", {}, () => [
1635
+ Z(H(e.title), 1)
1636
+ ])
1637
+ ]),
1638
+ default: z(() => [
1639
+ x(r.$slots, "default")
1640
+ ]),
1641
+ _: 3
1642
+ }, 8, ["drag-mode", "loading", "close-label"])
1643
+ ], 4)) : M("", !0)
1644
+ ]),
1645
+ _: 3
1646
+ }));
1647
+ }
1648
+ }), Uo = { class: "dwui-page-section" }, Go = { class: "dwui-page-section-content" }, kn = /* @__PURE__ */ A({
1649
+ __name: "page-section",
1650
+ props: {
1651
+ title: {},
1652
+ icon: { default: "diamond" },
1653
+ iconVariant: {},
1654
+ iconColor: {},
1655
+ titleClass: { type: [Boolean, null, String, Object, Array] },
1656
+ titleStyle: { type: [Boolean, null, String, Object, Array] }
1657
+ },
1658
+ setup(n) {
1659
+ const t = n, e = {
1660
+ diamond: { component: $t, shape: !0, color: "#1a44b6" },
1661
+ circle: { component: _t, shape: !0, color: "#e78b2f" },
1662
+ square: { component: yt, shape: !0, color: "#d13a2b" },
1663
+ pushpin: { component: wt, shape: !1 },
1664
+ "round-pushpin": { component: ht, shape: !1 }
1665
+ }, o = T(() => {
1666
+ const l = e[t.icon];
1667
+ return {
1668
+ component: l.component,
1669
+ props: l.shape ? { variant: t.iconVariant, color: t.iconColor ?? l.color } : {}
1670
+ };
1671
+ });
1672
+ return (l, a) => (u(), b("section", Uo, [
1673
+ t.title != null ? (u(), b("div", {
1674
+ key: 0,
1675
+ class: N(["dwui-page-section-title", t.titleClass]),
1676
+ style: F(t.titleStyle)
1677
+ }, [
1678
+ O(oe, null, {
1679
+ icon: z(() => [
1680
+ x(l.$slots, "icon", {}, () => [
1681
+ (u(), j(te(o.value.component), De(Ie(o.value.props)), null, 16))
1682
+ ])
1683
+ ]),
1684
+ default: z(() => [
1685
+ Z(" " + H(t.title), 1)
1686
+ ]),
1687
+ _: 3
1688
+ })
1689
+ ], 6)) : M("", !0),
1690
+ f("div", Go, [
1691
+ x(l.$slots, "default")
1692
+ ])
1693
+ ]));
1694
+ }
1695
+ }), Xo = { class: "dwui-page-title" }, Yo = {
1696
+ key: 0,
1697
+ class: "dwui-page-title-actions"
1698
+ }, Cn = /* @__PURE__ */ A({
1699
+ __name: "page-title",
1700
+ props: {
1701
+ title: {}
1702
+ },
1703
+ setup(n) {
1704
+ const t = n, e = J();
1705
+ return (o, l) => (u(), b("section", Xo, [
1706
+ O(oe, { class: "dwui-page-title-label" }, ie({
1707
+ default: z(() => [
1708
+ Z(" " + H(t.title), 1)
1709
+ ]),
1710
+ _: 2
1711
+ }, [
1712
+ e.icon != null ? {
1713
+ name: "icon",
1714
+ fn: z(() => [
1715
+ x(o.$slots, "icon")
1716
+ ]),
1717
+ key: "0"
1718
+ } : void 0
1719
+ ]), 1024),
1720
+ e.default != null ? (u(), b("span", Yo, [
1721
+ x(o.$slots, "default")
1722
+ ])) : M("", !0)
1723
+ ]));
1724
+ }
1725
+ }), Sn = /* @__PURE__ */ A({
1726
+ __name: "screen-loading",
1727
+ props: {
1728
+ loading: { type: Boolean }
1729
+ },
1730
+ setup(n) {
1731
+ const t = n, e = B(null), o = () => {
1732
+ const a = e.value;
1733
+ a && !a.open && a.showModal();
1734
+ }, l = () => {
1735
+ const a = e.value;
1736
+ a?.open && a.close();
1737
+ };
1738
+ return G(() => {
1739
+ t.loading && o();
1740
+ }), U(() => {
1741
+ l();
1742
+ }), X(() => t.loading, (a) => {
1743
+ a ? o() : l();
1744
+ }, { flush: "post" }), (a, s) => (u(), b("dialog", {
1745
+ ref_key: "refDialog",
1746
+ ref: e,
1747
+ class: "dwui-screen-loading",
1748
+ closedby: "none",
1749
+ onCancel: s[0] || (s[0] = ee(() => {
1750
+ }, ["prevent"]))
1751
+ }, [...s[1] || (s[1] = [
1752
+ f("div", { class: "dwui-screen-loading-spinner" }, null, -1)
1753
+ ])], 544));
1754
+ }
1755
+ }), Ge = /* @__PURE__ */ Symbol("dwui-tab-group"), qo = ["id", "aria-labelledby", "aria-busy", "hidden"], Qo = {
1756
+ key: 0,
1757
+ class: "dwui-tab-loading"
1758
+ }, Jo = {
1759
+ key: 1,
1760
+ class: "dwui-tab-loading-spinner"
1761
+ }, Zo = /* @__PURE__ */ A({
1762
+ __name: "tab-content",
1763
+ props: {
1764
+ tabId: {},
1765
+ label: {},
1766
+ disabled: { type: Boolean },
1767
+ status: {},
1768
+ headerClass: { type: [Boolean, null, String, Object, Array] },
1769
+ headerStyle: { type: [Boolean, null, String, Object, Array] }
1770
+ },
1771
+ setup(n) {
1772
+ const t = n, e = Ne(Ge, void 0), o = B(!1), l = () => e?.loadingSlot(), a = T(() => e?.activeTabId.value === t.tabId), s = T(() => !!e?.mounted.value && a.value), m = (d) => {
1773
+ o.value = d;
1774
+ };
1775
+ return (d, c) => t.disabled ? M("", !0) : (u(), b("div", {
1776
+ key: 0,
1777
+ id: _(e) ? `${_(e).groupName}-${t.tabId}-panel` : void 0,
1778
+ class: "dwui-tab-content",
1779
+ role: "tabpanel",
1780
+ "aria-labelledby": _(e) ? `${_(e).groupName}-${t.tabId}` : void 0,
1781
+ "aria-busy": o.value ? "true" : void 0,
1782
+ hidden: !a.value
1783
+ }, [
1784
+ x(d.$slots, "default", {
1785
+ activated: s.value,
1786
+ setLoading: m
1787
+ }),
1788
+ o.value ? (u(), b("div", Qo, [
1789
+ l() != null ? (u(), j(te(l()), { key: 0 })) : (u(), b("span", Jo))
1790
+ ])) : M("", !0)
1791
+ ], 8, qo));
1792
+ }
1793
+ }), en = { class: "dwui-tab-group" }, tn = ["id", "name", "disabled", "checked", "aria-selected", "aria-controls", "onChange"], on = ["for"], nn = { class: "dwui-tab-items" }, xn = /* @__PURE__ */ A({
1794
+ __name: "tab-group",
1795
+ props: /* @__PURE__ */ Q({
1796
+ tabGroupName: {},
1797
+ selectFirstEnabled: { type: Boolean },
1798
+ headerClass: { type: [Boolean, null, String, Object, Array] },
1799
+ headerStyle: { type: [Boolean, null, String, Object, Array] },
1800
+ teleport: {}
1801
+ }, {
1802
+ selectedTabId: {},
1803
+ selectedTabIdModifiers: {}
1804
+ }),
1805
+ emits: ["update:selectedTabId"],
1806
+ setup(n) {
1807
+ const t = n, e = se(n, "selectedTabId"), o = J(), l = t.tabGroupName ?? ae(), a = (h) => {
1808
+ if (h.type !== Zo)
1809
+ return;
1810
+ const g = h.props ?? {}, p = g.disabled;
1811
+ return {
1812
+ tabId: String(g["tab-id"] ?? g.tabId),
1813
+ label: g.label,
1814
+ // 属性だけを書いた場合(<TabContent disabled>)は空文字になる
1815
+ disabled: p === "" || !!p,
1816
+ status: g.status,
1817
+ headerClass: g["header-class"] ?? g.headerClass,
1818
+ headerStyle: g["header-style"] ?? g.headerStyle,
1819
+ // TabContentの#iconスロットは、TabContentではなくここで見出しに描画する
1820
+ icon: h.children?.icon
1821
+ };
1822
+ }, s = T(() => {
1823
+ const h = [];
1824
+ for (const g of o.default?.() ?? []) {
1825
+ const p = Array.isArray(g.children) ? g.children : [g];
1826
+ for (const C of p) {
1827
+ const P = a(C);
1828
+ P && h.push(P);
1829
+ }
1830
+ }
1831
+ return h;
1832
+ }), m = T(() => e.value != null ? e.value : (t.selectFirstEnabled ? s.value.find((g) => !g.disabled) : s.value[0])?.tabId), d = B(!1);
1833
+ at(Ge, { groupName: l, activeTabId: m, mounted: d, loadingSlot: () => o.loading }), G(() => {
1834
+ d.value = !0;
1835
+ });
1836
+ const c = (h) => {
1837
+ e.value = h;
1838
+ };
1839
+ return (h, g) => (u(), b("div", en, [
1840
+ (u(), j(st, {
1841
+ to: t.teleport ?? "body",
1842
+ disabled: t.teleport == null
1843
+ }, [
1844
+ f("div", {
1845
+ class: N(["dwui-tab-headers", t.headerClass]),
1846
+ role: "tablist",
1847
+ style: F(t.headerStyle)
1848
+ }, [
1849
+ (u(!0), b(K, null, Y(s.value, (p) => (u(), b(K, {
1850
+ key: p.tabId
1851
+ }, [
1852
+ f("input", {
1853
+ id: `${_(l)}-${p.tabId}`,
1854
+ type: "radio",
1855
+ class: "dwui-tab-radio",
1856
+ role: "tab",
1857
+ name: _(l),
1858
+ disabled: p.disabled,
1859
+ checked: p.tabId === m.value,
1860
+ "aria-selected": p.tabId === m.value ? "true" : "false",
1861
+ "aria-controls": `${_(l)}-${p.tabId}-panel`,
1862
+ onChange: (C) => c(p.tabId)
1863
+ }, null, 40, tn),
1864
+ f("label", {
1865
+ for: `${_(l)}-${p.tabId}`,
1866
+ class: N(["dwui-tab-item", [p.status != null ? `dwui-tab-${p.status}` : void 0, p.headerClass]]),
1867
+ style: F(p.headerStyle)
1868
+ }, [
1869
+ O(oe, null, ie({
1870
+ default: z(() => [
1871
+ Z(" " + H(p.label), 1)
1872
+ ]),
1873
+ _: 2
1874
+ }, [
1875
+ p.icon != null ? {
1876
+ name: "icon",
1877
+ fn: z(() => [
1878
+ (u(), j(te(p.icon)))
1879
+ ]),
1880
+ key: "0"
1881
+ } : void 0
1882
+ ]), 1024)
1883
+ ], 14, on)
1884
+ ], 64))), 128))
1885
+ ], 6)
1886
+ ], 8, ["to", "disabled"])),
1887
+ f("div", nn, [
1888
+ x(h.$slots, "default")
1889
+ ])
1890
+ ]));
1891
+ }
1892
+ }), Pn = /* @__PURE__ */ A({
1893
+ __name: "warning-popper",
1894
+ props: {
1895
+ placement: { default: "right" },
1896
+ arrow: { type: Boolean, default: !0 },
1897
+ label: { default: "Warning" }
1898
+ },
1899
+ emits: ["emit:open", "emit:close"],
1900
+ setup(n, { emit: t }) {
1901
+ const e = n, o = t;
1902
+ return (l, a) => (u(), j(Fe, {
1903
+ class: "dwui-warning-popper",
1904
+ "popover-class": "dwui-warning-popper-popover",
1905
+ placement: e.placement,
1906
+ arrow: e.arrow,
1907
+ label: e.label,
1908
+ "onEmit:open": a[0] || (a[0] = (s) => o("emit:open")),
1909
+ "onEmit:close": a[1] || (a[1] = (s) => o("emit:close"))
1910
+ }, {
1911
+ icon: z(() => [
1912
+ x(l.$slots, "icon", {}, () => [
1913
+ O(_(Re))
1914
+ ])
1915
+ ]),
1916
+ default: z(() => [
1917
+ x(l.$slots, "default")
1918
+ ]),
1919
+ _: 3
1920
+ }, 8, ["placement", "arrow", "label"]));
1921
+ }
1922
+ });
1923
+ export {
1924
+ yn as A,
1925
+ $n as B,
1926
+ lo as C,
1927
+ jo as _,
1928
+ dn as a,
1929
+ wn as b,
1930
+ go as c,
1931
+ Sn as d,
1932
+ sn as e,
1933
+ rn as f,
1934
+ cn as g,
1935
+ mn as h,
1936
+ vn as i,
1937
+ gn as j,
1938
+ fn as k,
1939
+ bn as l,
1940
+ Ko as m,
1941
+ Wo as n,
1942
+ hn as o,
1943
+ oe as p,
1944
+ Vo as q,
1945
+ kn as r,
1946
+ Cn as s,
1947
+ Zo as t,
1948
+ Fo as u,
1949
+ xn as v,
1950
+ Pn as w,
1951
+ _n as x,
1952
+ un as y,
1953
+ pn as z
1954
+ };