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