@digitalwalletcorp/vue-core 1.4.0 → 1.4.2

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