bank20baht-ui 0.4.0 → 0.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.
- package/dist/chunks/{baht-workflow-h9pLnwlk.js → baht-workflow-Dy8HZQ_f.js} +1352 -1256
- package/dist/components/primitives/baht-bar-chart.d.ts +32 -0
- package/dist/components/primitives/baht-meter.d.ts +8 -1
- package/dist/components/primitives/baht-stat.d.ts +4 -1
- package/dist/custom-elements.json +148 -4
- package/dist/index.js +1 -1
- package/dist/react.d.ts +1 -0
- package/dist/ssr.js +1 -1
- package/dist/tokens.css +74 -5
- package/dist/vscode.html-custom-data.json +11 -1
- package/dist/web-types.json +23 -3
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { nothing as h, html as n, svg as
|
|
2
|
-
import { property as l, customElement as
|
|
3
|
-
import { B as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import { repeat as
|
|
7
|
-
import { html as
|
|
8
|
-
import { c as
|
|
9
|
-
import { live as
|
|
10
|
-
import { ifDefined as
|
|
11
|
-
import
|
|
12
|
-
var
|
|
13
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1
|
+
import { nothing as h, html as n, svg as L } from "lit";
|
|
2
|
+
import { property as l, customElement as b, state as y, query as It } from "lit/decorators.js";
|
|
3
|
+
import { B as g, b as he, h as S, a as Y } from "./base-CajA2aCO.js";
|
|
4
|
+
import { t as m } from "./i18n-BcPL9_Jh.js";
|
|
5
|
+
import { n as $e, k as Nt, o as ds, i as zt, p as us, d as ae, a as rs, m as Ae, v as Le, c as bs, g as fs, l as ms } from "./display-DQRcvsn7.js";
|
|
6
|
+
import { repeat as Ce } from "lit/directives/repeat.js";
|
|
7
|
+
import { html as se, unsafeStatic as os } from "lit/static-html.js";
|
|
8
|
+
import { c as vs, r as W } from "./baht-toast-CD1WrOYr.js";
|
|
9
|
+
import { live as lt } from "lit/directives/live.js";
|
|
10
|
+
import { ifDefined as N } from "lit/directives/if-defined.js";
|
|
11
|
+
import $s from "flatpickr";
|
|
12
|
+
var ys = Object.defineProperty, gs = Object.getOwnPropertyDescriptor, ce = (t, e, i, a) => {
|
|
13
|
+
for (var s = a > 1 ? void 0 : a ? gs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
14
14
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
15
|
-
return a && s &&
|
|
15
|
+
return a && s && ys(e, i, s), s;
|
|
16
16
|
};
|
|
17
|
-
let
|
|
17
|
+
let Vt = class extends g {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments), this.tone = "neutral", this.label = "", this.dot = null;
|
|
20
20
|
}
|
|
@@ -28,50 +28,50 @@ let zt = class extends $ {
|
|
|
28
28
|
</span>`;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
ce([
|
|
32
32
|
l()
|
|
33
|
-
],
|
|
34
|
-
|
|
33
|
+
], Vt.prototype, "tone", 2);
|
|
34
|
+
ce([
|
|
35
35
|
l()
|
|
36
|
-
],
|
|
37
|
-
|
|
36
|
+
], Vt.prototype, "label", 2);
|
|
37
|
+
ce([
|
|
38
38
|
l({ attribute: !1 })
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
],
|
|
43
|
-
var
|
|
44
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
39
|
+
], Vt.prototype, "dot", 2);
|
|
40
|
+
Vt = ce([
|
|
41
|
+
b("baht-badge")
|
|
42
|
+
], Vt);
|
|
43
|
+
var ws = Object.defineProperty, xs = Object.getOwnPropertyDescriptor, Me = (t, e, i, a) => {
|
|
44
|
+
for (var s = a > 1 ? void 0 : a ? xs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
45
45
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
46
|
-
return a && s &&
|
|
46
|
+
return a && s && ws(e, i, s), s;
|
|
47
47
|
};
|
|
48
|
-
let
|
|
48
|
+
let ie = class extends g {
|
|
49
49
|
constructor() {
|
|
50
50
|
super(...arguments), this.variant = "inline", this.code = "";
|
|
51
51
|
}
|
|
52
52
|
firstUpdated() {
|
|
53
53
|
const t = this.renderRoot.querySelector(this.variant === "block" ? "pre" : "code");
|
|
54
|
-
t &&
|
|
54
|
+
t && he(this, t);
|
|
55
55
|
}
|
|
56
56
|
render() {
|
|
57
57
|
return this.variant === "block" ? n`<pre class="baht-code baht-code--block" tabindex="0">${this.code}</pre>` : n`<code class="baht-code">${this.code}</code>`;
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
Me([
|
|
61
61
|
l()
|
|
62
|
-
],
|
|
63
|
-
|
|
62
|
+
], ie.prototype, "variant", 2);
|
|
63
|
+
Me([
|
|
64
64
|
l()
|
|
65
|
-
],
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
],
|
|
69
|
-
var
|
|
70
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
65
|
+
], ie.prototype, "code", 2);
|
|
66
|
+
ie = Me([
|
|
67
|
+
b("baht-code")
|
|
68
|
+
], ie);
|
|
69
|
+
var _s = Object.defineProperty, ks = Object.getOwnPropertyDescriptor, gt = (t, e, i, a) => {
|
|
70
|
+
for (var s = a > 1 ? void 0 : a ? ks(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
71
71
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
72
|
-
return a && s &&
|
|
72
|
+
return a && s && _s(e, i, s), s;
|
|
73
73
|
};
|
|
74
|
-
let
|
|
74
|
+
let ht = class extends g {
|
|
75
75
|
constructor() {
|
|
76
76
|
super(...arguments), this.page = 1, this.totalPages = 1, this.variant = "numbered", this.siblings = 1, this.hasNext = !1, this.hasPrev = !1;
|
|
77
77
|
}
|
|
@@ -99,7 +99,7 @@ let nt = class extends $ {
|
|
|
99
99
|
const { page: t, totalPages: e, siblings: i } = this, a = /* @__PURE__ */ new Set([1, e]);
|
|
100
100
|
for (let c = t - i; c <= t + i; c++)
|
|
101
101
|
c >= 1 && c <= e && a.add(c);
|
|
102
|
-
const s = [...a].sort((c,
|
|
102
|
+
const s = [...a].sort((c, f) => c - f), r = [];
|
|
103
103
|
let o = 0;
|
|
104
104
|
for (const c of s)
|
|
105
105
|
o && c - o === 2 ? r.push(o + 1) : o && c - o > 2 && r.push(null), r.push(c), o = c;
|
|
@@ -126,34 +126,34 @@ let nt = class extends $ {
|
|
|
126
126
|
</nav>`;
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
|
|
129
|
+
gt([
|
|
130
130
|
l({ type: Number })
|
|
131
|
-
],
|
|
132
|
-
|
|
131
|
+
], ht.prototype, "page", 2);
|
|
132
|
+
gt([
|
|
133
133
|
l({ type: Number, attribute: "total-pages" })
|
|
134
|
-
],
|
|
135
|
-
|
|
134
|
+
], ht.prototype, "totalPages", 2);
|
|
135
|
+
gt([
|
|
136
136
|
l()
|
|
137
|
-
],
|
|
138
|
-
|
|
137
|
+
], ht.prototype, "variant", 2);
|
|
138
|
+
gt([
|
|
139
139
|
l({ type: Number })
|
|
140
|
-
],
|
|
141
|
-
|
|
140
|
+
], ht.prototype, "siblings", 2);
|
|
141
|
+
gt([
|
|
142
142
|
l({ type: Boolean, attribute: "has-next" })
|
|
143
|
-
],
|
|
144
|
-
|
|
143
|
+
], ht.prototype, "hasNext", 2);
|
|
144
|
+
gt([
|
|
145
145
|
l({ type: Boolean, attribute: "has-prev" })
|
|
146
|
-
],
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
],
|
|
150
|
-
var
|
|
151
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
146
|
+
], ht.prototype, "hasPrev", 2);
|
|
147
|
+
ht = gt([
|
|
148
|
+
b("baht-pagination")
|
|
149
|
+
], ht);
|
|
150
|
+
var Ps = Object.defineProperty, Os = Object.getOwnPropertyDescriptor, O = (t, e, i, a) => {
|
|
151
|
+
for (var s = a > 1 ? void 0 : a ? Os(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
152
152
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
153
|
-
return a && s &&
|
|
153
|
+
return a && s && Ps(e, i, s), s;
|
|
154
154
|
};
|
|
155
|
-
const
|
|
156
|
-
let
|
|
155
|
+
const Cs = " › ", ye = (t) => t !== null && typeof t == "object" && !Array.isArray(t) && !(t instanceof Date), ee = (t) => t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
156
|
+
let k = class extends g {
|
|
157
157
|
constructor() {
|
|
158
158
|
super(...arguments), this.items = [], this.columns = {}, this.loading = !1, this.error = !1, this.errorMessage = "Couldn't load data. Try again.", this.emptyMessage = "No records yet.", this.showIndex = !0, this.indexOffset = 0, this.skeletonRows = 10, this.rowKey = "", this.clickable = !0, this.renderers = {}, this.visibleColumns = [], this.columnPicker = !0, this.page = 1, this.totalPages = 1, this.cursorMode = !1, this.hasNext = !1, this.hasPrev = !1, this.pickerOpen = !1, this.pickedColumns = null, this.draftColumns = [], this.pickAvail = [], this.pickSel = [], this.expanded = [], this.pickerPreviousFocus = null, this.onPickerKeydown = (t) => {
|
|
159
159
|
t.key === "Escape" ? this.closePicker() : t.key === "Tab" && this.trapPickerFocus(t);
|
|
@@ -178,7 +178,7 @@ let P = class extends $ {
|
|
|
178
178
|
r != null && r.contains(s) ? t.shiftKey && s === i ? (a.focus(), t.preventDefault()) : !t.shiftKey && s === a && (i.focus(), t.preventDefault()) : (i.focus(), t.preventDefault());
|
|
179
179
|
}
|
|
180
180
|
disconnectedCallback() {
|
|
181
|
-
super.disconnectedCallback(),
|
|
181
|
+
super.disconnectedCallback(), S() && document.removeEventListener("keydown", this.onPickerKeydown);
|
|
182
182
|
}
|
|
183
183
|
willUpdate(t) {
|
|
184
184
|
t.has("visibleColumns") && !t.has("columns") && (this.pickedColumns = null);
|
|
@@ -191,10 +191,10 @@ let P = class extends $ {
|
|
|
191
191
|
if (!t) return {};
|
|
192
192
|
const e = {};
|
|
193
193
|
for (const [i, a] of Object.entries(t))
|
|
194
|
-
e[i] =
|
|
195
|
-
label:
|
|
196
|
-
fields: Object.fromEntries(Object.keys(a).map((s) => [s,
|
|
197
|
-
} :
|
|
194
|
+
e[i] = ye(a) ? {
|
|
195
|
+
label: ee(i),
|
|
196
|
+
fields: Object.fromEntries(Object.keys(a).map((s) => [s, ee(s)]))
|
|
197
|
+
} : ee(i);
|
|
198
198
|
return e;
|
|
199
199
|
}
|
|
200
200
|
/** Walk a dotted key through the spec; undefined when no such column exists. */
|
|
@@ -233,25 +233,25 @@ let P = class extends $ {
|
|
|
233
233
|
for (const a of t.split(".")) {
|
|
234
234
|
const s = i == null ? void 0 : i[a];
|
|
235
235
|
if (s === void 0) {
|
|
236
|
-
e.push(
|
|
236
|
+
e.push(ee(a)), i = void 0;
|
|
237
237
|
continue;
|
|
238
238
|
}
|
|
239
239
|
e.push(typeof s == "string" ? s : s.label), i = typeof s == "string" ? void 0 : s.fields;
|
|
240
240
|
}
|
|
241
|
-
return e.join(
|
|
241
|
+
return e.join(Cs);
|
|
242
242
|
}
|
|
243
243
|
/** The row's value at a dotted key (`requester.department`). */
|
|
244
244
|
static valueAt(t, e) {
|
|
245
245
|
let i = t;
|
|
246
246
|
for (const a of e.split(".")) {
|
|
247
|
-
if (
|
|
247
|
+
if (!ye(i)) return;
|
|
248
248
|
i = i[a];
|
|
249
249
|
}
|
|
250
250
|
return i;
|
|
251
251
|
}
|
|
252
252
|
// ---- picker -----------------------------------------------------------
|
|
253
253
|
openPicker() {
|
|
254
|
-
this.draftColumns = this.columnKeys.slice(), this.pickAvail = [], this.pickSel = [], this.pickerOpen = !0, this.pickerPreviousFocus = document.activeElement,
|
|
254
|
+
this.draftColumns = this.columnKeys.slice(), this.pickAvail = [], this.pickSel = [], this.pickerOpen = !0, this.pickerPreviousFocus = document.activeElement, S() && document.addEventListener("keydown", this.onPickerKeydown), this.updateComplete.then(() => {
|
|
255
255
|
var t;
|
|
256
256
|
this.pickerOpen && ((t = this.pickerFocusables()[0]) == null || t.focus());
|
|
257
257
|
});
|
|
@@ -259,7 +259,7 @@ let P = class extends $ {
|
|
|
259
259
|
closePicker() {
|
|
260
260
|
var e;
|
|
261
261
|
if (!this.pickerOpen) return;
|
|
262
|
-
this.pickerOpen = !1,
|
|
262
|
+
this.pickerOpen = !1, S() && document.removeEventListener("keydown", this.onPickerKeydown);
|
|
263
263
|
const t = this.pickerPreviousFocus;
|
|
264
264
|
this.pickerPreviousFocus = null, t != null && t.isConnected && ((e = t.focus) == null || e.call(t));
|
|
265
265
|
}
|
|
@@ -309,9 +309,9 @@ let P = class extends $ {
|
|
|
309
309
|
);
|
|
310
310
|
}
|
|
311
311
|
cell(t, e) {
|
|
312
|
-
const i = this.renderers[e], a =
|
|
312
|
+
const i = this.renderers[e], a = k.valueAt(t, e);
|
|
313
313
|
if (i) return i(a, t);
|
|
314
|
-
if (
|
|
314
|
+
if (ye(a)) {
|
|
315
315
|
const s = a.name ?? a.label ?? a.title ?? a.id;
|
|
316
316
|
return s == null ? "" : String(s);
|
|
317
317
|
}
|
|
@@ -380,7 +380,7 @@ let P = class extends $ {
|
|
|
380
380
|
</li>`;
|
|
381
381
|
}
|
|
382
382
|
renderColumnModal() {
|
|
383
|
-
const t = this.allColumnKeys, e = this.allPaths().filter((a) => !this.draftColumns.includes(a)).length, i = (a) => (s) => a(
|
|
383
|
+
const t = this.allColumnKeys, e = this.allPaths().filter((a) => !this.draftColumns.includes(a)).length, i = (a) => (s) => a(k.selectedValues(s));
|
|
384
384
|
return n`<div
|
|
385
385
|
class="baht-table-picker-scrim"
|
|
386
386
|
@click=${(a) => a.target === a.currentTarget && this.closePicker()}
|
|
@@ -456,90 +456,90 @@ let P = class extends $ {
|
|
|
456
456
|
</div>`;
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
|
-
|
|
459
|
+
O([
|
|
460
460
|
l({ attribute: !1 })
|
|
461
|
-
],
|
|
462
|
-
|
|
461
|
+
], k.prototype, "items", 2);
|
|
462
|
+
O([
|
|
463
463
|
l({ attribute: !1 })
|
|
464
|
-
],
|
|
465
|
-
|
|
464
|
+
], k.prototype, "columns", 2);
|
|
465
|
+
O([
|
|
466
466
|
l({ type: Boolean })
|
|
467
|
-
],
|
|
468
|
-
|
|
467
|
+
], k.prototype, "loading", 2);
|
|
468
|
+
O([
|
|
469
469
|
l({ type: Boolean })
|
|
470
|
-
],
|
|
471
|
-
|
|
470
|
+
], k.prototype, "error", 2);
|
|
471
|
+
O([
|
|
472
472
|
l({ attribute: "error-message" })
|
|
473
|
-
],
|
|
474
|
-
|
|
473
|
+
], k.prototype, "errorMessage", 2);
|
|
474
|
+
O([
|
|
475
475
|
l({ attribute: "empty-message" })
|
|
476
|
-
],
|
|
477
|
-
|
|
476
|
+
], k.prototype, "emptyMessage", 2);
|
|
477
|
+
O([
|
|
478
478
|
l({ type: Boolean, attribute: "show-index" })
|
|
479
|
-
],
|
|
480
|
-
|
|
479
|
+
], k.prototype, "showIndex", 2);
|
|
480
|
+
O([
|
|
481
481
|
l({ type: Number, attribute: "index-offset" })
|
|
482
|
-
],
|
|
483
|
-
|
|
482
|
+
], k.prototype, "indexOffset", 2);
|
|
483
|
+
O([
|
|
484
484
|
l({ type: Number, attribute: "skeleton-rows" })
|
|
485
|
-
],
|
|
486
|
-
|
|
485
|
+
], k.prototype, "skeletonRows", 2);
|
|
486
|
+
O([
|
|
487
487
|
l({ attribute: "row-key" })
|
|
488
|
-
],
|
|
489
|
-
|
|
488
|
+
], k.prototype, "rowKey", 2);
|
|
489
|
+
O([
|
|
490
490
|
l({ type: Boolean })
|
|
491
|
-
],
|
|
492
|
-
|
|
491
|
+
], k.prototype, "clickable", 2);
|
|
492
|
+
O([
|
|
493
493
|
l({ attribute: !1 })
|
|
494
|
-
],
|
|
495
|
-
|
|
494
|
+
], k.prototype, "renderers", 2);
|
|
495
|
+
O([
|
|
496
496
|
l({ attribute: !1 })
|
|
497
|
-
],
|
|
498
|
-
|
|
497
|
+
], k.prototype, "visibleColumns", 2);
|
|
498
|
+
O([
|
|
499
499
|
l({ type: Boolean, attribute: "column-picker" })
|
|
500
|
-
],
|
|
501
|
-
|
|
500
|
+
], k.prototype, "columnPicker", 2);
|
|
501
|
+
O([
|
|
502
502
|
l({ type: Number })
|
|
503
|
-
],
|
|
504
|
-
|
|
503
|
+
], k.prototype, "page", 2);
|
|
504
|
+
O([
|
|
505
505
|
l({ type: Number, attribute: "total-pages" })
|
|
506
|
-
],
|
|
507
|
-
|
|
506
|
+
], k.prototype, "totalPages", 2);
|
|
507
|
+
O([
|
|
508
508
|
l({ type: Boolean, attribute: "cursor-mode" })
|
|
509
|
-
],
|
|
510
|
-
|
|
509
|
+
], k.prototype, "cursorMode", 2);
|
|
510
|
+
O([
|
|
511
511
|
l({ type: Boolean, attribute: "has-next" })
|
|
512
|
-
],
|
|
513
|
-
|
|
512
|
+
], k.prototype, "hasNext", 2);
|
|
513
|
+
O([
|
|
514
514
|
l({ type: Boolean, attribute: "has-prev" })
|
|
515
|
-
],
|
|
516
|
-
|
|
515
|
+
], k.prototype, "hasPrev", 2);
|
|
516
|
+
O([
|
|
517
517
|
y()
|
|
518
|
-
],
|
|
519
|
-
|
|
518
|
+
], k.prototype, "pickerOpen", 2);
|
|
519
|
+
O([
|
|
520
520
|
y()
|
|
521
|
-
],
|
|
522
|
-
|
|
521
|
+
], k.prototype, "pickedColumns", 2);
|
|
522
|
+
O([
|
|
523
523
|
y()
|
|
524
|
-
],
|
|
525
|
-
|
|
524
|
+
], k.prototype, "draftColumns", 2);
|
|
525
|
+
O([
|
|
526
526
|
y()
|
|
527
|
-
],
|
|
528
|
-
|
|
527
|
+
], k.prototype, "pickAvail", 2);
|
|
528
|
+
O([
|
|
529
529
|
y()
|
|
530
|
-
],
|
|
531
|
-
|
|
530
|
+
], k.prototype, "pickSel", 2);
|
|
531
|
+
O([
|
|
532
532
|
y()
|
|
533
|
-
],
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
],
|
|
537
|
-
var
|
|
538
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
533
|
+
], k.prototype, "expanded", 2);
|
|
534
|
+
k = O([
|
|
535
|
+
b("baht-table")
|
|
536
|
+
], k);
|
|
537
|
+
var Ds = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, ut = (t, e, i, a) => {
|
|
538
|
+
for (var s = a > 1 ? void 0 : a ? Fs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
539
539
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
540
|
-
return a && s &&
|
|
540
|
+
return a && s && Ds(e, i, s), s;
|
|
541
541
|
};
|
|
542
|
-
let
|
|
542
|
+
let rt = class extends g {
|
|
543
543
|
constructor() {
|
|
544
544
|
super(...arguments), this.items = [], this.loading = !1, this.error = !1, this.errorMessage = "Couldn't load data. Try again.", this.emptyMessage = "Nothing here yet.", this.skeletonRows = 5, this.clickable = !0;
|
|
545
545
|
}
|
|
@@ -585,36 +585,36 @@ let at = class extends $ {
|
|
|
585
585
|
return n`<div class="baht-list" role=${t ? "list" : h}>${this.renderRows()}</div>`;
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
|
-
|
|
588
|
+
ut([
|
|
589
589
|
l({ attribute: !1 })
|
|
590
|
-
],
|
|
591
|
-
|
|
590
|
+
], rt.prototype, "items", 2);
|
|
591
|
+
ut([
|
|
592
592
|
l({ type: Boolean })
|
|
593
|
-
],
|
|
594
|
-
|
|
593
|
+
], rt.prototype, "loading", 2);
|
|
594
|
+
ut([
|
|
595
595
|
l({ type: Boolean })
|
|
596
|
-
],
|
|
597
|
-
|
|
596
|
+
], rt.prototype, "error", 2);
|
|
597
|
+
ut([
|
|
598
598
|
l({ attribute: "error-message" })
|
|
599
|
-
],
|
|
600
|
-
|
|
599
|
+
], rt.prototype, "errorMessage", 2);
|
|
600
|
+
ut([
|
|
601
601
|
l({ attribute: "empty-message" })
|
|
602
|
-
],
|
|
603
|
-
|
|
602
|
+
], rt.prototype, "emptyMessage", 2);
|
|
603
|
+
ut([
|
|
604
604
|
l({ type: Number, attribute: "skeleton-rows" })
|
|
605
|
-
],
|
|
606
|
-
|
|
605
|
+
], rt.prototype, "skeletonRows", 2);
|
|
606
|
+
ut([
|
|
607
607
|
l({ type: Boolean })
|
|
608
|
-
],
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
],
|
|
612
|
-
var
|
|
613
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
608
|
+
], rt.prototype, "clickable", 2);
|
|
609
|
+
rt = ut([
|
|
610
|
+
b("baht-list")
|
|
611
|
+
], rt);
|
|
612
|
+
var Es = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, Jt = (t, e, i, a) => {
|
|
613
|
+
for (var s = a > 1 ? void 0 : a ? Bs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
614
614
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
615
|
-
return a && s &&
|
|
615
|
+
return a && s && Es(e, i, s), s;
|
|
616
616
|
};
|
|
617
|
-
let
|
|
617
|
+
let Pt = class extends g {
|
|
618
618
|
constructor() {
|
|
619
619
|
super(...arguments), this.text = "", this.position = "top", this.dismissed = !1;
|
|
620
620
|
}
|
|
@@ -633,7 +633,7 @@ let _t = class extends $ {
|
|
|
633
633
|
t ? (t.setAttribute("aria-describedby", this.tooltipId), this.anchorEl.removeAttribute("tabindex"), this.anchorEl.removeAttribute("aria-describedby")) : (this.anchorEl.setAttribute("tabindex", "0"), this.anchorEl.setAttribute("aria-describedby", this.tooltipId));
|
|
634
634
|
}
|
|
635
635
|
firstUpdated() {
|
|
636
|
-
|
|
636
|
+
he(this, this.anchorEl), this.wireDescribedBy(), setTimeout(() => this.isConnected && this.wireDescribedBy(), 0);
|
|
637
637
|
}
|
|
638
638
|
onKeydown(t) {
|
|
639
639
|
t.key === "Escape" && (this.dismissed = !0);
|
|
@@ -653,27 +653,27 @@ let _t = class extends $ {
|
|
|
653
653
|
</span>`;
|
|
654
654
|
}
|
|
655
655
|
};
|
|
656
|
-
|
|
656
|
+
Jt([
|
|
657
657
|
l()
|
|
658
|
-
],
|
|
659
|
-
|
|
658
|
+
], Pt.prototype, "text", 2);
|
|
659
|
+
Jt([
|
|
660
660
|
l()
|
|
661
|
-
],
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
],
|
|
665
|
-
|
|
661
|
+
], Pt.prototype, "position", 2);
|
|
662
|
+
Jt([
|
|
663
|
+
It(".baht-tooltip-anchor")
|
|
664
|
+
], Pt.prototype, "anchorEl", 2);
|
|
665
|
+
Jt([
|
|
666
666
|
y()
|
|
667
|
-
],
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
],
|
|
671
|
-
var
|
|
672
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
667
|
+
], Pt.prototype, "dismissed", 2);
|
|
668
|
+
Pt = Jt([
|
|
669
|
+
b("baht-tooltip")
|
|
670
|
+
], Pt);
|
|
671
|
+
var Is = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Mt = (t, e, i, a) => {
|
|
672
|
+
for (var s = a > 1 ? void 0 : a ? Ms(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
673
673
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
674
|
-
return a && s &&
|
|
674
|
+
return a && s && Is(e, i, s), s;
|
|
675
675
|
};
|
|
676
|
-
let
|
|
676
|
+
let mt = class extends g {
|
|
677
677
|
constructor() {
|
|
678
678
|
super(...arguments), this.tone = "info", this.heading = "", this.message = "", this.dismissible = !1, this.dismissed = !1, this.generation = 0;
|
|
679
679
|
}
|
|
@@ -689,7 +689,7 @@ let bt = class extends $ {
|
|
|
689
689
|
e();
|
|
690
690
|
return;
|
|
691
691
|
}
|
|
692
|
-
i.classList.add("baht-alert--leaving"),
|
|
692
|
+
i.classList.add("baht-alert--leaving"), vs(i, e);
|
|
693
693
|
}
|
|
694
694
|
render() {
|
|
695
695
|
return this.dismissed ? h : n`<div class="baht-alert baht-alert--${this.tone}" role="alert">
|
|
@@ -697,34 +697,34 @@ let bt = class extends $ {
|
|
|
697
697
|
${this.heading ? n`<div class="baht-alert-title">${this.heading}</div>` : h}
|
|
698
698
|
${this.message ? n`<div class="baht-alert-message">${this.message}</div>` : h}
|
|
699
699
|
</div>
|
|
700
|
-
${this.dismissible ? n`<button type="button" class="baht-alert-dismiss" aria-label=${
|
|
700
|
+
${this.dismissible ? n`<button type="button" class="baht-alert-dismiss" aria-label=${m("dismiss")} @click=${() => this.dismiss()}>×</button>` : h}
|
|
701
701
|
</div>`;
|
|
702
702
|
}
|
|
703
703
|
};
|
|
704
|
-
|
|
704
|
+
Mt([
|
|
705
705
|
l()
|
|
706
|
-
],
|
|
707
|
-
|
|
706
|
+
], mt.prototype, "tone", 2);
|
|
707
|
+
Mt([
|
|
708
708
|
l()
|
|
709
|
-
],
|
|
710
|
-
|
|
709
|
+
], mt.prototype, "heading", 2);
|
|
710
|
+
Mt([
|
|
711
711
|
l()
|
|
712
|
-
],
|
|
713
|
-
|
|
712
|
+
], mt.prototype, "message", 2);
|
|
713
|
+
Mt([
|
|
714
714
|
l({ type: Boolean })
|
|
715
|
-
],
|
|
716
|
-
|
|
715
|
+
], mt.prototype, "dismissible", 2);
|
|
716
|
+
Mt([
|
|
717
717
|
y()
|
|
718
|
-
],
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
],
|
|
722
|
-
var js = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor,
|
|
718
|
+
], mt.prototype, "dismissed", 2);
|
|
719
|
+
mt = Mt([
|
|
720
|
+
b("baht-alert")
|
|
721
|
+
], mt);
|
|
722
|
+
var js = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, jt = (t, e, i, a) => {
|
|
723
723
|
for (var s = a > 1 ? void 0 : a ? Ss(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
724
724
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
725
725
|
return a && s && js(e, i, s), s;
|
|
726
726
|
};
|
|
727
|
-
let
|
|
727
|
+
let vt = class extends g {
|
|
728
728
|
constructor() {
|
|
729
729
|
super(...arguments), this.value = 0, this.max = 5, this.readonly = !1, this.label = "Rating", this.hover = 0;
|
|
730
730
|
}
|
|
@@ -777,30 +777,30 @@ let ft = class extends $ {
|
|
|
777
777
|
</div>`;
|
|
778
778
|
}
|
|
779
779
|
};
|
|
780
|
-
|
|
780
|
+
jt([
|
|
781
781
|
l({ type: Number })
|
|
782
|
-
],
|
|
783
|
-
|
|
782
|
+
], vt.prototype, "value", 2);
|
|
783
|
+
jt([
|
|
784
784
|
l({ type: Number })
|
|
785
|
-
],
|
|
786
|
-
|
|
785
|
+
], vt.prototype, "max", 2);
|
|
786
|
+
jt([
|
|
787
787
|
l({ type: Boolean })
|
|
788
|
-
],
|
|
789
|
-
|
|
788
|
+
], vt.prototype, "readonly", 2);
|
|
789
|
+
jt([
|
|
790
790
|
l()
|
|
791
|
-
],
|
|
792
|
-
|
|
791
|
+
], vt.prototype, "label", 2);
|
|
792
|
+
jt([
|
|
793
793
|
y()
|
|
794
|
-
],
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
],
|
|
798
|
-
var Ts = Object.defineProperty,
|
|
799
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
794
|
+
], vt.prototype, "hover", 2);
|
|
795
|
+
vt = jt([
|
|
796
|
+
b("baht-rating")
|
|
797
|
+
], vt);
|
|
798
|
+
var Ts = Object.defineProperty, As = Object.getOwnPropertyDescriptor, bt = (t, e, i, a) => {
|
|
799
|
+
for (var s = a > 1 ? void 0 : a ? As(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
800
800
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
801
801
|
return a && s && Ts(e, i, s), s;
|
|
802
802
|
};
|
|
803
|
-
let
|
|
803
|
+
let ot = class extends g {
|
|
804
804
|
constructor() {
|
|
805
805
|
super(...arguments), this.value = 0, this.min = 0, this.max = 100, this.step = 1, this.label = "", this.disabled = !1, this.showValue = !0;
|
|
806
806
|
}
|
|
@@ -821,7 +821,7 @@ let it = class extends $ {
|
|
|
821
821
|
type="range"
|
|
822
822
|
id=${this.inputId}
|
|
823
823
|
aria-label=${this.label ? h : "Value"}
|
|
824
|
-
.value=${
|
|
824
|
+
.value=${lt(String(this.value))}
|
|
825
825
|
min=${this.min}
|
|
826
826
|
max=${this.max}
|
|
827
827
|
step=${this.step}
|
|
@@ -833,36 +833,36 @@ let it = class extends $ {
|
|
|
833
833
|
</div>`;
|
|
834
834
|
}
|
|
835
835
|
};
|
|
836
|
-
|
|
836
|
+
bt([
|
|
837
837
|
l({ type: Number })
|
|
838
|
-
],
|
|
839
|
-
|
|
838
|
+
], ot.prototype, "value", 2);
|
|
839
|
+
bt([
|
|
840
840
|
l({ type: Number })
|
|
841
|
-
],
|
|
842
|
-
|
|
841
|
+
], ot.prototype, "min", 2);
|
|
842
|
+
bt([
|
|
843
843
|
l({ type: Number })
|
|
844
|
-
],
|
|
845
|
-
|
|
844
|
+
], ot.prototype, "max", 2);
|
|
845
|
+
bt([
|
|
846
846
|
l({ type: Number })
|
|
847
|
-
],
|
|
848
|
-
|
|
847
|
+
], ot.prototype, "step", 2);
|
|
848
|
+
bt([
|
|
849
849
|
l()
|
|
850
|
-
],
|
|
851
|
-
|
|
850
|
+
], ot.prototype, "label", 2);
|
|
851
|
+
bt([
|
|
852
852
|
l({ type: Boolean })
|
|
853
|
-
],
|
|
854
|
-
|
|
853
|
+
], ot.prototype, "disabled", 2);
|
|
854
|
+
bt([
|
|
855
855
|
l({ type: Boolean, attribute: "show-value" })
|
|
856
|
-
],
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
],
|
|
860
|
-
var
|
|
861
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
856
|
+
], ot.prototype, "showValue", 2);
|
|
857
|
+
ot = bt([
|
|
858
|
+
b("baht-range")
|
|
859
|
+
], ot);
|
|
860
|
+
var Ls = Object.defineProperty, Ns = Object.getOwnPropertyDescriptor, St = (t, e, i, a) => {
|
|
861
|
+
for (var s = a > 1 ? void 0 : a ? Ns(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
862
862
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
863
|
-
return a && s &&
|
|
863
|
+
return a && s && Ls(e, i, s), s;
|
|
864
864
|
};
|
|
865
|
-
let
|
|
865
|
+
let $t = class extends g {
|
|
866
866
|
constructor() {
|
|
867
867
|
super(...arguments), this.length = 6, this.value = "", this.disabled = !1, this.mode = "numeric", this.label = "One-time code", this._chars = [], this._lastValue = "", this._wasFull = !1;
|
|
868
868
|
}
|
|
@@ -936,7 +936,7 @@ let mt = class extends $ {
|
|
|
936
936
|
inputmode=${this.mode === "numeric" ? "numeric" : "text"}
|
|
937
937
|
maxlength="1"
|
|
938
938
|
autocomplete=${e === 0 ? "one-time-code" : "off"}
|
|
939
|
-
aria-label=${
|
|
939
|
+
aria-label=${m("otpCharacter", { i: e + 1, n: this.length })}
|
|
940
940
|
.value=${t}
|
|
941
941
|
?disabled=${this.disabled}
|
|
942
942
|
@input=${(i) => this.onInput(e, i)}
|
|
@@ -946,30 +946,30 @@ let mt = class extends $ {
|
|
|
946
946
|
</div>`;
|
|
947
947
|
}
|
|
948
948
|
};
|
|
949
|
-
|
|
949
|
+
St([
|
|
950
950
|
l({ type: Number })
|
|
951
|
-
],
|
|
952
|
-
|
|
951
|
+
], $t.prototype, "length", 2);
|
|
952
|
+
St([
|
|
953
953
|
l()
|
|
954
|
-
],
|
|
955
|
-
|
|
954
|
+
], $t.prototype, "value", 2);
|
|
955
|
+
St([
|
|
956
956
|
l({ type: Boolean })
|
|
957
|
-
],
|
|
958
|
-
|
|
957
|
+
], $t.prototype, "disabled", 2);
|
|
958
|
+
St([
|
|
959
959
|
l()
|
|
960
|
-
],
|
|
961
|
-
|
|
960
|
+
], $t.prototype, "mode", 2);
|
|
961
|
+
St([
|
|
962
962
|
l()
|
|
963
|
-
],
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
],
|
|
967
|
-
var
|
|
968
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
963
|
+
], $t.prototype, "label", 2);
|
|
964
|
+
$t = St([
|
|
965
|
+
b("baht-otp")
|
|
966
|
+
], $t);
|
|
967
|
+
var qs = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, Tt = (t, e, i, a) => {
|
|
968
|
+
for (var s = a > 1 ? void 0 : a ? Rs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
969
969
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
970
|
-
return a && s &&
|
|
970
|
+
return a && s && qs(e, i, s), s;
|
|
971
971
|
};
|
|
972
|
-
let
|
|
972
|
+
let yt = class extends g {
|
|
973
973
|
constructor() {
|
|
974
974
|
super(...arguments), this.options = [], this.selected = [], this.multiple = !0, this.disabled = !1, this.label = "Filters";
|
|
975
975
|
}
|
|
@@ -993,30 +993,30 @@ let vt = class extends $ {
|
|
|
993
993
|
</div>`;
|
|
994
994
|
}
|
|
995
995
|
};
|
|
996
|
-
|
|
996
|
+
Tt([
|
|
997
997
|
l({ attribute: !1 })
|
|
998
|
-
],
|
|
999
|
-
|
|
998
|
+
], yt.prototype, "options", 2);
|
|
999
|
+
Tt([
|
|
1000
1000
|
l({ attribute: !1 })
|
|
1001
|
-
],
|
|
1002
|
-
|
|
1001
|
+
], yt.prototype, "selected", 2);
|
|
1002
|
+
Tt([
|
|
1003
1003
|
l({ type: Boolean })
|
|
1004
|
-
],
|
|
1005
|
-
|
|
1004
|
+
], yt.prototype, "multiple", 2);
|
|
1005
|
+
Tt([
|
|
1006
1006
|
l({ type: Boolean })
|
|
1007
|
-
],
|
|
1008
|
-
|
|
1007
|
+
], yt.prototype, "disabled", 2);
|
|
1008
|
+
Tt([
|
|
1009
1009
|
l()
|
|
1010
|
-
],
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
],
|
|
1014
|
-
var
|
|
1015
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1010
|
+
], yt.prototype, "label", 2);
|
|
1011
|
+
yt = Tt([
|
|
1012
|
+
b("baht-filter")
|
|
1013
|
+
], yt);
|
|
1014
|
+
var zs = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, pe = (t, e, i, a) => {
|
|
1015
|
+
for (var s = a > 1 ? void 0 : a ? Vs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1016
1016
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1017
|
-
return a && s &&
|
|
1017
|
+
return a && s && zs(e, i, s), s;
|
|
1018
1018
|
};
|
|
1019
|
-
let
|
|
1019
|
+
let Kt = class extends g {
|
|
1020
1020
|
constructor() {
|
|
1021
1021
|
super(...arguments), this.variant = "rect", this.width = "100%", this.height = "";
|
|
1022
1022
|
}
|
|
@@ -1029,24 +1029,24 @@ let Vt = class extends $ {
|
|
|
1029
1029
|
></span>`;
|
|
1030
1030
|
}
|
|
1031
1031
|
};
|
|
1032
|
-
|
|
1032
|
+
pe([
|
|
1033
1033
|
l()
|
|
1034
|
-
],
|
|
1035
|
-
|
|
1034
|
+
], Kt.prototype, "variant", 2);
|
|
1035
|
+
pe([
|
|
1036
1036
|
l()
|
|
1037
|
-
],
|
|
1038
|
-
|
|
1037
|
+
], Kt.prototype, "width", 2);
|
|
1038
|
+
pe([
|
|
1039
1039
|
l()
|
|
1040
|
-
],
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
],
|
|
1044
|
-
var
|
|
1045
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1040
|
+
], Kt.prototype, "height", 2);
|
|
1041
|
+
Kt = pe([
|
|
1042
|
+
b("baht-skeleton")
|
|
1043
|
+
], Kt);
|
|
1044
|
+
var Ks = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, Yt = (t, e, i, a) => {
|
|
1045
|
+
for (var s = a > 1 ? void 0 : a ? Us(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1046
1046
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1047
|
-
return a && s &&
|
|
1047
|
+
return a && s && Ks(e, i, s), s;
|
|
1048
1048
|
};
|
|
1049
|
-
let
|
|
1049
|
+
let Ot = class extends g {
|
|
1050
1050
|
constructor() {
|
|
1051
1051
|
super(...arguments), this.value = null, this.tone = "primary", this.showLabel = !1, this.label = "Progress";
|
|
1052
1052
|
}
|
|
@@ -1067,27 +1067,27 @@ let kt = class extends $ {
|
|
|
1067
1067
|
</div>`;
|
|
1068
1068
|
}
|
|
1069
1069
|
};
|
|
1070
|
-
|
|
1070
|
+
Yt([
|
|
1071
1071
|
l({ type: Number })
|
|
1072
|
-
],
|
|
1073
|
-
|
|
1072
|
+
], Ot.prototype, "value", 2);
|
|
1073
|
+
Yt([
|
|
1074
1074
|
l()
|
|
1075
|
-
],
|
|
1076
|
-
|
|
1075
|
+
], Ot.prototype, "tone", 2);
|
|
1076
|
+
Yt([
|
|
1077
1077
|
l({ type: Boolean, attribute: "show-label" })
|
|
1078
|
-
],
|
|
1079
|
-
|
|
1078
|
+
], Ot.prototype, "showLabel", 2);
|
|
1079
|
+
Yt([
|
|
1080
1080
|
l()
|
|
1081
|
-
],
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
],
|
|
1085
|
-
var
|
|
1086
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1081
|
+
], Ot.prototype, "label", 2);
|
|
1082
|
+
Ot = Yt([
|
|
1083
|
+
b("baht-progress")
|
|
1084
|
+
], Ot);
|
|
1085
|
+
var Hs = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, je = (t, e, i, a) => {
|
|
1086
|
+
for (var s = a > 1 ? void 0 : a ? Gs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1087
1087
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1088
|
-
return a && s &&
|
|
1088
|
+
return a && s && Hs(e, i, s), s;
|
|
1089
1089
|
};
|
|
1090
|
-
let
|
|
1090
|
+
let re = class extends g {
|
|
1091
1091
|
constructor() {
|
|
1092
1092
|
super(...arguments), this.size = "md", this.label = "Loading";
|
|
1093
1093
|
}
|
|
@@ -1098,24 +1098,24 @@ let ie = class extends $ {
|
|
|
1098
1098
|
};
|
|
1099
1099
|
je([
|
|
1100
1100
|
l()
|
|
1101
|
-
],
|
|
1101
|
+
], re.prototype, "size", 2);
|
|
1102
1102
|
je([
|
|
1103
1103
|
l()
|
|
1104
|
-
],
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
],
|
|
1108
|
-
var
|
|
1109
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1104
|
+
], re.prototype, "label", 2);
|
|
1105
|
+
re = je([
|
|
1106
|
+
b("baht-spinner")
|
|
1107
|
+
], re);
|
|
1108
|
+
var Ws = Object.defineProperty, Js = Object.getOwnPropertyDescriptor, Xt = (t, e, i, a) => {
|
|
1109
|
+
for (var s = a > 1 ? void 0 : a ? Js(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1110
1110
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1111
|
-
return a && s &&
|
|
1111
|
+
return a && s && Ws(e, i, s), s;
|
|
1112
1112
|
};
|
|
1113
|
-
let
|
|
1113
|
+
let Ct = class extends g {
|
|
1114
1114
|
constructor() {
|
|
1115
1115
|
super(...arguments), this.heading = "", this.subtitle = "", this.hero = !1;
|
|
1116
1116
|
}
|
|
1117
1117
|
firstUpdated() {
|
|
1118
|
-
|
|
1118
|
+
he(this, this.bodyEl);
|
|
1119
1119
|
}
|
|
1120
1120
|
render() {
|
|
1121
1121
|
return n`<div class="baht-card${this.hero ? " baht-card--hero" : ""}">
|
|
@@ -1125,32 +1125,32 @@ let Pt = class extends $ {
|
|
|
1125
1125
|
</div>`;
|
|
1126
1126
|
}
|
|
1127
1127
|
};
|
|
1128
|
-
|
|
1128
|
+
Xt([
|
|
1129
1129
|
l()
|
|
1130
|
-
],
|
|
1131
|
-
|
|
1130
|
+
], Ct.prototype, "heading", 2);
|
|
1131
|
+
Xt([
|
|
1132
1132
|
l()
|
|
1133
|
-
],
|
|
1134
|
-
|
|
1133
|
+
], Ct.prototype, "subtitle", 2);
|
|
1134
|
+
Xt([
|
|
1135
1135
|
l({ type: Boolean })
|
|
1136
|
-
],
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
],
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
],
|
|
1143
|
-
var
|
|
1144
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1136
|
+
], Ct.prototype, "hero", 2);
|
|
1137
|
+
Xt([
|
|
1138
|
+
It(".baht-card-body")
|
|
1139
|
+
], Ct.prototype, "bodyEl", 2);
|
|
1140
|
+
Ct = Xt([
|
|
1141
|
+
b("baht-card")
|
|
1142
|
+
], Ct);
|
|
1143
|
+
var Ys = Object.defineProperty, Xs = Object.getOwnPropertyDescriptor, de = (t, e, i, a) => {
|
|
1144
|
+
for (var s = a > 1 ? void 0 : a ? Xs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1145
1145
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1146
|
-
return a && s &&
|
|
1146
|
+
return a && s && Ys(e, i, s), s;
|
|
1147
1147
|
};
|
|
1148
|
-
let
|
|
1148
|
+
let Ut = class extends g {
|
|
1149
1149
|
constructor() {
|
|
1150
1150
|
super(...arguments), this.legend = "", this.disabled = !1;
|
|
1151
1151
|
}
|
|
1152
1152
|
firstUpdated() {
|
|
1153
|
-
|
|
1153
|
+
he(this, this.bodyEl);
|
|
1154
1154
|
}
|
|
1155
1155
|
render() {
|
|
1156
1156
|
return n`<fieldset class="baht-fieldset" ?disabled=${this.disabled}>
|
|
@@ -1159,24 +1159,24 @@ let Kt = class extends $ {
|
|
|
1159
1159
|
</fieldset>`;
|
|
1160
1160
|
}
|
|
1161
1161
|
};
|
|
1162
|
-
|
|
1162
|
+
de([
|
|
1163
1163
|
l()
|
|
1164
|
-
],
|
|
1165
|
-
|
|
1164
|
+
], Ut.prototype, "legend", 2);
|
|
1165
|
+
de([
|
|
1166
1166
|
l({ type: Boolean })
|
|
1167
|
-
],
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
],
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
],
|
|
1174
|
-
var
|
|
1175
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1167
|
+
], Ut.prototype, "disabled", 2);
|
|
1168
|
+
de([
|
|
1169
|
+
It(".baht-fieldset-body")
|
|
1170
|
+
], Ut.prototype, "bodyEl", 2);
|
|
1171
|
+
Ut = de([
|
|
1172
|
+
b("baht-fieldset")
|
|
1173
|
+
], Ut);
|
|
1174
|
+
var Zs = Object.defineProperty, Qs = Object.getOwnPropertyDescriptor, ls = (t, e, i, a) => {
|
|
1175
|
+
for (var s = a > 1 ? void 0 : a ? Qs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1176
1176
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1177
|
-
return a && s &&
|
|
1177
|
+
return a && s && Zs(e, i, s), s;
|
|
1178
1178
|
};
|
|
1179
|
-
let
|
|
1179
|
+
let De = class extends g {
|
|
1180
1180
|
constructor() {
|
|
1181
1181
|
super(...arguments), this.items = [];
|
|
1182
1182
|
}
|
|
@@ -1200,18 +1200,18 @@ let Ce = class extends $ {
|
|
|
1200
1200
|
</div>`;
|
|
1201
1201
|
}
|
|
1202
1202
|
};
|
|
1203
|
-
|
|
1203
|
+
ls([
|
|
1204
1204
|
l({ attribute: !1 })
|
|
1205
|
-
],
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
],
|
|
1209
|
-
var
|
|
1210
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1205
|
+
], De.prototype, "items", 2);
|
|
1206
|
+
De = ls([
|
|
1207
|
+
b("baht-timeline")
|
|
1208
|
+
], De);
|
|
1209
|
+
var ta = Object.defineProperty, ea = Object.getOwnPropertyDescriptor, ue = (t, e, i, a) => {
|
|
1210
|
+
for (var s = a > 1 ? void 0 : a ? ea(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1211
1211
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1212
|
-
return a && s &&
|
|
1212
|
+
return a && s && ta(e, i, s), s;
|
|
1213
1213
|
};
|
|
1214
|
-
let
|
|
1214
|
+
let Dt = class extends g {
|
|
1215
1215
|
constructor() {
|
|
1216
1216
|
super(...arguments), this.items = [], this.multiple = !1, this.openSet = /* @__PURE__ */ new Set(), this.itemsFingerprint = "";
|
|
1217
1217
|
}
|
|
@@ -1220,7 +1220,7 @@ let Ot = class extends $ {
|
|
|
1220
1220
|
}
|
|
1221
1221
|
willUpdate(t) {
|
|
1222
1222
|
if (t.has("items")) {
|
|
1223
|
-
const e =
|
|
1223
|
+
const e = Dt.fingerprint(this.items);
|
|
1224
1224
|
e !== this.itemsFingerprint && (this.itemsFingerprint = e, this.openSet = new Set(this.items.flatMap((i, a) => i.open ? [a] : [])));
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
@@ -1252,24 +1252,24 @@ let Ot = class extends $ {
|
|
|
1252
1252
|
</div>`;
|
|
1253
1253
|
}
|
|
1254
1254
|
};
|
|
1255
|
-
|
|
1255
|
+
ue([
|
|
1256
1256
|
l({ attribute: !1 })
|
|
1257
|
-
],
|
|
1258
|
-
|
|
1257
|
+
], Dt.prototype, "items", 2);
|
|
1258
|
+
ue([
|
|
1259
1259
|
l({ type: Boolean })
|
|
1260
|
-
],
|
|
1261
|
-
|
|
1260
|
+
], Dt.prototype, "multiple", 2);
|
|
1261
|
+
ue([
|
|
1262
1262
|
y()
|
|
1263
|
-
],
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
],
|
|
1267
|
-
var
|
|
1268
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1263
|
+
], Dt.prototype, "openSet", 2);
|
|
1264
|
+
Dt = ue([
|
|
1265
|
+
b("baht-accordion")
|
|
1266
|
+
], Dt);
|
|
1267
|
+
var sa = Object.defineProperty, aa = Object.getOwnPropertyDescriptor, Zt = (t, e, i, a) => {
|
|
1268
|
+
for (var s = a > 1 ? void 0 : a ? aa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1269
1269
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1270
|
-
return a && s &&
|
|
1270
|
+
return a && s && sa(e, i, s), s;
|
|
1271
1271
|
};
|
|
1272
|
-
let
|
|
1272
|
+
let Ft = class extends g {
|
|
1273
1273
|
constructor() {
|
|
1274
1274
|
super(...arguments), this.href = "", this.label = "", this.external = !1, this.externalHint = "opens in new tab";
|
|
1275
1275
|
}
|
|
@@ -1282,27 +1282,27 @@ let Ct = class extends $ {
|
|
|
1282
1282
|
>${this.label}${this.external ? n` <span class="baht-link-external" aria-hidden="true">↗</span><span class="baht-visually-hidden"> (${this.externalHint})</span>` : h}</a>`;
|
|
1283
1283
|
}
|
|
1284
1284
|
};
|
|
1285
|
-
|
|
1285
|
+
Zt([
|
|
1286
1286
|
l()
|
|
1287
|
-
],
|
|
1288
|
-
|
|
1287
|
+
], Ft.prototype, "href", 2);
|
|
1288
|
+
Zt([
|
|
1289
1289
|
l()
|
|
1290
|
-
],
|
|
1291
|
-
|
|
1290
|
+
], Ft.prototype, "label", 2);
|
|
1291
|
+
Zt([
|
|
1292
1292
|
l({ type: Boolean })
|
|
1293
|
-
],
|
|
1294
|
-
|
|
1293
|
+
], Ft.prototype, "external", 2);
|
|
1294
|
+
Zt([
|
|
1295
1295
|
l({ attribute: "external-hint" })
|
|
1296
|
-
],
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
],
|
|
1300
|
-
var
|
|
1301
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1296
|
+
], Ft.prototype, "externalHint", 2);
|
|
1297
|
+
Ft = Zt([
|
|
1298
|
+
b("baht-link")
|
|
1299
|
+
], Ft);
|
|
1300
|
+
var ia = Object.defineProperty, ra = Object.getOwnPropertyDescriptor, Se = (t, e, i, a) => {
|
|
1301
|
+
for (var s = a > 1 ? void 0 : a ? ra(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1302
1302
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1303
|
-
return a && s &&
|
|
1303
|
+
return a && s && ia(e, i, s), s;
|
|
1304
1304
|
};
|
|
1305
|
-
let
|
|
1305
|
+
let oe = class extends g {
|
|
1306
1306
|
constructor() {
|
|
1307
1307
|
super(...arguments), this.items = [], this.separator = "›";
|
|
1308
1308
|
}
|
|
@@ -1329,28 +1329,28 @@ let re = class extends $ {
|
|
|
1329
1329
|
};
|
|
1330
1330
|
Se([
|
|
1331
1331
|
l({ attribute: !1 })
|
|
1332
|
-
],
|
|
1332
|
+
], oe.prototype, "items", 2);
|
|
1333
1333
|
Se([
|
|
1334
1334
|
l()
|
|
1335
|
-
],
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
],
|
|
1339
|
-
var
|
|
1340
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1335
|
+
], oe.prototype, "separator", 2);
|
|
1336
|
+
oe = Se([
|
|
1337
|
+
b("baht-breadcrumbs")
|
|
1338
|
+
], oe);
|
|
1339
|
+
var oa = Object.getOwnPropertyDescriptor, la = (t, e, i, a) => {
|
|
1340
|
+
for (var s = a > 1 ? void 0 : a ? oa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1341
1341
|
(o = t[r]) && (s = o(s) || s);
|
|
1342
1342
|
return s;
|
|
1343
1343
|
};
|
|
1344
|
-
let
|
|
1344
|
+
let Ne = class extends Y {
|
|
1345
1345
|
renderControl() {
|
|
1346
1346
|
return n`<input
|
|
1347
1347
|
class="baht-control baht-control--text"
|
|
1348
1348
|
id=${this.controlId}
|
|
1349
1349
|
type=${this.field.type === "email" ? "email" : this.field.type === "password" ? "password" : "text"}
|
|
1350
|
-
.value=${
|
|
1351
|
-
placeholder=${
|
|
1352
|
-
maxlength=${
|
|
1353
|
-
autocomplete=${
|
|
1350
|
+
.value=${lt(this.shownValue == null ? "" : String(this.shownValue))}
|
|
1351
|
+
placeholder=${N(this.field.placeholder)}
|
|
1352
|
+
maxlength=${N(this.field.max_length)}
|
|
1353
|
+
autocomplete=${N(this.field.autocomplete)}
|
|
1354
1354
|
?disabled=${this.disabled}
|
|
1355
1355
|
?readonly=${this.readonly}
|
|
1356
1356
|
?required=${this.required}
|
|
@@ -1360,24 +1360,24 @@ let Le = class extends W {
|
|
|
1360
1360
|
/>`;
|
|
1361
1361
|
}
|
|
1362
1362
|
};
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
],
|
|
1366
|
-
var
|
|
1367
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1363
|
+
Ne = la([
|
|
1364
|
+
b("baht-input")
|
|
1365
|
+
], Ne);
|
|
1366
|
+
var na = Object.getOwnPropertyDescriptor, ha = (t, e, i, a) => {
|
|
1367
|
+
for (var s = a > 1 ? void 0 : a ? na(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1368
1368
|
(o = t[r]) && (s = o(s) || s);
|
|
1369
1369
|
return s;
|
|
1370
1370
|
};
|
|
1371
|
-
let
|
|
1371
|
+
let qe = class extends Y {
|
|
1372
1372
|
renderControl() {
|
|
1373
1373
|
return n`<textarea
|
|
1374
1374
|
class="baht-control baht-control--textarea"
|
|
1375
1375
|
id=${this.controlId}
|
|
1376
|
-
.value=${
|
|
1377
|
-
placeholder=${
|
|
1378
|
-
maxlength=${
|
|
1376
|
+
.value=${lt(this.shownValue == null ? "" : String(this.shownValue))}
|
|
1377
|
+
placeholder=${N(this.field.placeholder)}
|
|
1378
|
+
maxlength=${N(this.field.max_length)}
|
|
1379
1379
|
rows=${this.field.rows ?? 3}
|
|
1380
|
-
autocomplete=${
|
|
1380
|
+
autocomplete=${N(this.field.autocomplete)}
|
|
1381
1381
|
?disabled=${this.disabled}
|
|
1382
1382
|
?readonly=${this.readonly}
|
|
1383
1383
|
?required=${this.required}
|
|
@@ -1387,25 +1387,25 @@ let Ne = class extends W {
|
|
|
1387
1387
|
></textarea>`;
|
|
1388
1388
|
}
|
|
1389
1389
|
};
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
],
|
|
1393
|
-
var
|
|
1394
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1390
|
+
qe = ha([
|
|
1391
|
+
b("baht-textarea")
|
|
1392
|
+
], qe);
|
|
1393
|
+
var ca = Object.getOwnPropertyDescriptor, pa = (t, e, i, a) => {
|
|
1394
|
+
for (var s = a > 1 ? void 0 : a ? ca(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1395
1395
|
(o = t[r]) && (s = o(s) || s);
|
|
1396
1396
|
return s;
|
|
1397
1397
|
};
|
|
1398
|
-
let
|
|
1398
|
+
let Re = class extends Y {
|
|
1399
1399
|
renderControl() {
|
|
1400
1400
|
return n`<input
|
|
1401
1401
|
class="baht-control baht-control--number"
|
|
1402
1402
|
id=${this.controlId}
|
|
1403
1403
|
type="number"
|
|
1404
|
-
.value=${
|
|
1405
|
-
placeholder=${
|
|
1406
|
-
min=${
|
|
1407
|
-
max=${
|
|
1408
|
-
step=${
|
|
1404
|
+
.value=${lt(this.shownValue == null ? "" : String(this.shownValue))}
|
|
1405
|
+
placeholder=${N(this.field.placeholder)}
|
|
1406
|
+
min=${N(this.field.min)}
|
|
1407
|
+
max=${N(this.field.max)}
|
|
1408
|
+
step=${N(this.field.step)}
|
|
1409
1409
|
?disabled=${this.disabled}
|
|
1410
1410
|
?readonly=${this.readonly}
|
|
1411
1411
|
?required=${this.required}
|
|
@@ -1418,23 +1418,23 @@ let qe = class extends W {
|
|
|
1418
1418
|
/>`;
|
|
1419
1419
|
}
|
|
1420
1420
|
};
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
],
|
|
1424
|
-
var
|
|
1425
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1421
|
+
Re = pa([
|
|
1422
|
+
b("baht-number")
|
|
1423
|
+
], Re);
|
|
1424
|
+
var da = Object.defineProperty, ua = Object.getOwnPropertyDescriptor, Te = (t, e, i, a) => {
|
|
1425
|
+
for (var s = a > 1 ? void 0 : a ? ua(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1426
1426
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1427
|
-
return a && s &&
|
|
1427
|
+
return a && s && da(e, i, s), s;
|
|
1428
1428
|
};
|
|
1429
|
-
const
|
|
1430
|
-
let
|
|
1429
|
+
const ba = 500;
|
|
1430
|
+
let le = class extends Y {
|
|
1431
1431
|
constructor() {
|
|
1432
1432
|
super(...arguments), this.open = !1, this.active = 0, this.typeBuffer = "", this.onDocMousedown = (t) => {
|
|
1433
1433
|
this.contains(t.target) || this.close();
|
|
1434
1434
|
};
|
|
1435
1435
|
}
|
|
1436
1436
|
disconnectedCallback() {
|
|
1437
|
-
super.disconnectedCallback(), clearTimeout(this.typeTimer),
|
|
1437
|
+
super.disconnectedCallback(), clearTimeout(this.typeTimer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
|
|
1438
1438
|
}
|
|
1439
1439
|
get listId() {
|
|
1440
1440
|
return `${this.controlId}-list`;
|
|
@@ -1445,7 +1445,7 @@ let oe = class extends W {
|
|
|
1445
1445
|
/** Placeholder row first (picks `null`), then the field's options. */
|
|
1446
1446
|
get rows() {
|
|
1447
1447
|
return [
|
|
1448
|
-
{ key: "", label: this.field.placeholder ??
|
|
1448
|
+
{ key: "", label: this.field.placeholder ?? m("choose") },
|
|
1449
1449
|
...this.field.options ?? []
|
|
1450
1450
|
];
|
|
1451
1451
|
}
|
|
@@ -1469,10 +1469,10 @@ let oe = class extends W {
|
|
|
1469
1469
|
(e = t == null ? void 0 : t.scrollIntoView) == null || e.call(t, { block: "nearest" });
|
|
1470
1470
|
}
|
|
1471
1471
|
openList() {
|
|
1472
|
-
!this.interactive || this.open || (this.active = this.selectedIndex, this.open = !0,
|
|
1472
|
+
!this.interactive || this.open || (this.active = this.selectedIndex, this.open = !0, S() && document.addEventListener("mousedown", this.onDocMousedown));
|
|
1473
1473
|
}
|
|
1474
1474
|
close() {
|
|
1475
|
-
this.open && (this.open = !1,
|
|
1475
|
+
this.open && (this.open = !1, S() && document.removeEventListener("mousedown", this.onDocMousedown));
|
|
1476
1476
|
}
|
|
1477
1477
|
toggle() {
|
|
1478
1478
|
this.open ? this.close() : this.openList();
|
|
@@ -1490,7 +1490,7 @@ let oe = class extends W {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
/** Type-to-select: first option (after the highlighted one) starting with the buffer. */
|
|
1492
1492
|
typeahead(t) {
|
|
1493
|
-
clearTimeout(this.typeTimer), this.typeBuffer += t.toLowerCase(), this.typeTimer = setTimeout(() => this.typeBuffer = "",
|
|
1493
|
+
clearTimeout(this.typeTimer), this.typeBuffer += t.toLowerCase(), this.typeTimer = setTimeout(() => this.typeBuffer = "", ba);
|
|
1494
1494
|
const e = this.rows, i = this.typeBuffer.length === 1 ? this.active + 1 : this.active;
|
|
1495
1495
|
for (let a = 0; a < e.length; a++) {
|
|
1496
1496
|
const s = (i + a) % e.length;
|
|
@@ -1586,19 +1586,19 @@ let oe = class extends W {
|
|
|
1586
1586
|
};
|
|
1587
1587
|
Te([
|
|
1588
1588
|
y()
|
|
1589
|
-
],
|
|
1589
|
+
], le.prototype, "open", 2);
|
|
1590
1590
|
Te([
|
|
1591
1591
|
y()
|
|
1592
|
-
],
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
],
|
|
1596
|
-
var
|
|
1597
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1592
|
+
], le.prototype, "active", 2);
|
|
1593
|
+
le = Te([
|
|
1594
|
+
b("baht-select")
|
|
1595
|
+
], le);
|
|
1596
|
+
var fa = Object.getOwnPropertyDescriptor, ma = (t, e, i, a) => {
|
|
1597
|
+
for (var s = a > 1 ? void 0 : a ? fa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1598
1598
|
(o = t[r]) && (s = o(s) || s);
|
|
1599
1599
|
return s;
|
|
1600
1600
|
};
|
|
1601
|
-
let
|
|
1601
|
+
let ze = class extends Y {
|
|
1602
1602
|
get selected() {
|
|
1603
1603
|
return Array.isArray(this.value) ? this.value : [];
|
|
1604
1604
|
}
|
|
@@ -1618,7 +1618,7 @@ let Re = class extends W {
|
|
|
1618
1618
|
<input
|
|
1619
1619
|
type="checkbox"
|
|
1620
1620
|
value=${t.key}
|
|
1621
|
-
.checked=${
|
|
1621
|
+
.checked=${lt(this.selected.includes(t.key))}
|
|
1622
1622
|
?disabled=${this.disabled || this.readonly}
|
|
1623
1623
|
@change=${(e) => this.toggle(t.key, e.target.checked)}
|
|
1624
1624
|
/>
|
|
@@ -1628,15 +1628,15 @@ let Re = class extends W {
|
|
|
1628
1628
|
</div>`;
|
|
1629
1629
|
}
|
|
1630
1630
|
};
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
],
|
|
1634
|
-
var
|
|
1635
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1631
|
+
ze = ma([
|
|
1632
|
+
b("baht-multiselect")
|
|
1633
|
+
], ze);
|
|
1634
|
+
var va = Object.getOwnPropertyDescriptor, $a = (t, e, i, a) => {
|
|
1635
|
+
for (var s = a > 1 ? void 0 : a ? va(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1636
1636
|
(o = t[r]) && (s = o(s) || s);
|
|
1637
1637
|
return s;
|
|
1638
1638
|
};
|
|
1639
|
-
let
|
|
1639
|
+
let Ve = class extends Y {
|
|
1640
1640
|
/** Label sits beside the box, so suppress the block label. */
|
|
1641
1641
|
renderLabel() {
|
|
1642
1642
|
return h;
|
|
@@ -1646,7 +1646,7 @@ let ze = class extends W {
|
|
|
1646
1646
|
<input
|
|
1647
1647
|
type="checkbox"
|
|
1648
1648
|
id=${this.controlId}
|
|
1649
|
-
.checked=${
|
|
1649
|
+
.checked=${lt(this.value === !0)}
|
|
1650
1650
|
?disabled=${this.disabled || this.readonly}
|
|
1651
1651
|
?required=${this.required}
|
|
1652
1652
|
aria-invalid=${this.invalid}
|
|
@@ -1659,15 +1659,15 @@ let ze = class extends W {
|
|
|
1659
1659
|
</label>`;
|
|
1660
1660
|
}
|
|
1661
1661
|
};
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
],
|
|
1665
|
-
var
|
|
1666
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1662
|
+
Ve = $a([
|
|
1663
|
+
b("baht-checkbox")
|
|
1664
|
+
], Ve);
|
|
1665
|
+
var ya = Object.getOwnPropertyDescriptor, ga = (t, e, i, a) => {
|
|
1666
|
+
for (var s = a > 1 ? void 0 : a ? ya(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1667
1667
|
(o = t[r]) && (s = o(s) || s);
|
|
1668
1668
|
return s;
|
|
1669
1669
|
};
|
|
1670
|
-
let
|
|
1670
|
+
let Ke = class extends Y {
|
|
1671
1671
|
renderControl() {
|
|
1672
1672
|
return n`<div
|
|
1673
1673
|
class="baht-control baht-control--radio"
|
|
@@ -1683,7 +1683,7 @@ let Ve = class extends W {
|
|
|
1683
1683
|
type="radio"
|
|
1684
1684
|
name=${this.controlId}
|
|
1685
1685
|
value=${t.key}
|
|
1686
|
-
.checked=${
|
|
1686
|
+
.checked=${lt(this.value === t.key)}
|
|
1687
1687
|
?disabled=${this.disabled || this.readonly}
|
|
1688
1688
|
@change=${() => this.emitInput(t.key)}
|
|
1689
1689
|
/>
|
|
@@ -1693,15 +1693,15 @@ let Ve = class extends W {
|
|
|
1693
1693
|
</div>`;
|
|
1694
1694
|
}
|
|
1695
1695
|
};
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
],
|
|
1699
|
-
var
|
|
1700
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1696
|
+
Ke = ga([
|
|
1697
|
+
b("baht-radio")
|
|
1698
|
+
], Ke);
|
|
1699
|
+
var wa = Object.getOwnPropertyDescriptor, xa = (t, e, i, a) => {
|
|
1700
|
+
for (var s = a > 1 ? void 0 : a ? wa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1701
1701
|
(o = t[r]) && (s = o(s) || s);
|
|
1702
1702
|
return s;
|
|
1703
1703
|
};
|
|
1704
|
-
let
|
|
1704
|
+
let Ue = class extends Y {
|
|
1705
1705
|
renderLabel() {
|
|
1706
1706
|
return h;
|
|
1707
1707
|
}
|
|
@@ -1712,7 +1712,7 @@ let Ke = class extends W {
|
|
|
1712
1712
|
role="switch"
|
|
1713
1713
|
id=${this.controlId}
|
|
1714
1714
|
aria-checked=${this.value === !0 ? "true" : "false"}
|
|
1715
|
-
.checked=${
|
|
1715
|
+
.checked=${lt(this.value === !0)}
|
|
1716
1716
|
?disabled=${this.disabled || this.readonly}
|
|
1717
1717
|
?required=${this.required}
|
|
1718
1718
|
aria-invalid=${this.invalid}
|
|
@@ -1726,15 +1726,15 @@ let Ke = class extends W {
|
|
|
1726
1726
|
</label>`;
|
|
1727
1727
|
}
|
|
1728
1728
|
};
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
],
|
|
1732
|
-
var
|
|
1733
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1729
|
+
Ue = xa([
|
|
1730
|
+
b("baht-toggle")
|
|
1731
|
+
], Ue);
|
|
1732
|
+
var _a = Object.getOwnPropertyDescriptor, ka = (t, e, i, a) => {
|
|
1733
|
+
for (var s = a > 1 ? void 0 : a ? _a(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1734
1734
|
(o = t[r]) && (s = o(s) || s);
|
|
1735
1735
|
return s;
|
|
1736
1736
|
};
|
|
1737
|
-
let
|
|
1737
|
+
let He = class extends Y {
|
|
1738
1738
|
constructor() {
|
|
1739
1739
|
super(...arguments), this.lastEmitted = null;
|
|
1740
1740
|
}
|
|
@@ -1744,7 +1744,7 @@ let Ue = class extends W {
|
|
|
1744
1744
|
id=${this.controlId}
|
|
1745
1745
|
type="text"
|
|
1746
1746
|
autocomplete="off"
|
|
1747
|
-
placeholder=${
|
|
1747
|
+
placeholder=${N(this.field.placeholder)}
|
|
1748
1748
|
?disabled=${this.disabled}
|
|
1749
1749
|
?readonly=${this.readonly}
|
|
1750
1750
|
?required=${this.required}
|
|
@@ -1765,7 +1765,7 @@ let Ue = class extends W {
|
|
|
1765
1765
|
return;
|
|
1766
1766
|
}
|
|
1767
1767
|
if (!this.fp || this.fp.input !== e || t.has("field") || t.has("disabled") || t.has("readonly")) {
|
|
1768
|
-
this.teardown(), this.fp =
|
|
1768
|
+
this.teardown(), this.fp = $s(e, this.options());
|
|
1769
1769
|
return;
|
|
1770
1770
|
}
|
|
1771
1771
|
t.has("value") && (this.lastEmitted = null, this.syncValue());
|
|
@@ -1778,10 +1778,10 @@ let Ue = class extends W {
|
|
|
1778
1778
|
syncValue() {
|
|
1779
1779
|
if (!this.fp) return;
|
|
1780
1780
|
const t = this.datesOf(this.value);
|
|
1781
|
-
|
|
1781
|
+
We(this.fp.selectedDates, t) || (t.length === 0 ? this.fp.clear(!1) : this.fp.setDate(t, !1));
|
|
1782
1782
|
}
|
|
1783
1783
|
options() {
|
|
1784
|
-
const t = this.field, e =
|
|
1784
|
+
const t = this.field, e = $e(t), i = Nt(t.min), a = Nt(t.max);
|
|
1785
1785
|
return {
|
|
1786
1786
|
static: !0,
|
|
1787
1787
|
disableMobile: !0,
|
|
@@ -1793,7 +1793,7 @@ let Ue = class extends W {
|
|
|
1793
1793
|
defaultDate: this.datesOf(this.value),
|
|
1794
1794
|
...i ? { minDate: i } : {},
|
|
1795
1795
|
...a ? { maxDate: a } : {},
|
|
1796
|
-
disable:
|
|
1796
|
+
disable: Je(t),
|
|
1797
1797
|
onReady: (s, r, o) => this.mountFooter(o),
|
|
1798
1798
|
onOpen: () => this.refreshFooter(),
|
|
1799
1799
|
onChange: (s) => {
|
|
@@ -1810,9 +1810,9 @@ let Ue = class extends W {
|
|
|
1810
1810
|
const e = document.createElement("div");
|
|
1811
1811
|
e.className = "baht-datepicker-footer";
|
|
1812
1812
|
const i = document.createElement("button");
|
|
1813
|
-
i.type = "button", i.className = "baht-button baht-button--sm baht-datepicker-today", i.textContent =
|
|
1813
|
+
i.type = "button", i.className = "baht-button baht-button--sm baht-datepicker-today", i.textContent = m("today"), i.addEventListener("click", () => this.pickToday());
|
|
1814
1814
|
const a = document.createElement("button");
|
|
1815
|
-
a.type = "button", a.className = "baht-button baht-button--danger baht-button--sm baht-datepicker-clear", a.textContent =
|
|
1815
|
+
a.type = "button", a.className = "baht-button baht-button--danger baht-button--sm baht-datepicker-clear", a.textContent = m("clear"), a.addEventListener("click", () => {
|
|
1816
1816
|
var s, r;
|
|
1817
1817
|
(s = this.fp) == null || s.clear(), (r = this.fp) == null || r.close();
|
|
1818
1818
|
}), e.append(i, a), t.calendarContainer.appendChild(e), this.todayBtn = i, this.clearBtn = a, this.refreshFooter(t);
|
|
@@ -1824,15 +1824,15 @@ let Ue = class extends W {
|
|
|
1824
1824
|
t && (this.todayBtn && (this.todayBtn.disabled = !this.todayAllowed()), this.clearBtn && (this.clearBtn.disabled = t.selectedDates.length === 0));
|
|
1825
1825
|
}
|
|
1826
1826
|
todayAllowed() {
|
|
1827
|
-
const t =
|
|
1828
|
-
if (e && t <
|
|
1829
|
-
for (const a of
|
|
1827
|
+
const t = kt(/* @__PURE__ */ new Date()), e = Nt(this.field.min), i = Nt(this.field.max);
|
|
1828
|
+
if (e && t < kt(e) || i && t > kt(i)) return !1;
|
|
1829
|
+
for (const a of Je(this.field) ?? [])
|
|
1830
1830
|
if (a instanceof Date) {
|
|
1831
|
-
if (
|
|
1831
|
+
if (Ge(a, t)) return !1;
|
|
1832
1832
|
} else if (typeof a == "function") {
|
|
1833
1833
|
if (a(t)) return !1;
|
|
1834
1834
|
} else if (typeof a == "object" && "from" in a) {
|
|
1835
|
-
const s =
|
|
1835
|
+
const s = kt(new Date(a.from)), r = kt(new Date(a.to));
|
|
1836
1836
|
if (t >= s && t <= r) return !1;
|
|
1837
1837
|
}
|
|
1838
1838
|
return !0;
|
|
@@ -1840,13 +1840,13 @@ let Ue = class extends W {
|
|
|
1840
1840
|
pickToday() {
|
|
1841
1841
|
const t = this.fp;
|
|
1842
1842
|
if (!t || !this.todayAllowed()) return;
|
|
1843
|
-
const e =
|
|
1844
|
-
switch (
|
|
1843
|
+
const e = kt(/* @__PURE__ */ new Date());
|
|
1844
|
+
switch ($e(this.field)) {
|
|
1845
1845
|
case "range":
|
|
1846
1846
|
t.setDate([e, e], !0);
|
|
1847
1847
|
break;
|
|
1848
1848
|
case "multiple": {
|
|
1849
|
-
t.selectedDates.some((a) =>
|
|
1849
|
+
t.selectedDates.some((a) => Ge(a, e)) || t.setDate([...t.selectedDates, e], !0);
|
|
1850
1850
|
break;
|
|
1851
1851
|
}
|
|
1852
1852
|
default:
|
|
@@ -1856,16 +1856,16 @@ let Ue = class extends W {
|
|
|
1856
1856
|
}
|
|
1857
1857
|
emitIfChanged(t) {
|
|
1858
1858
|
const e = this.lastEmitted ?? this.datesOf(this.value);
|
|
1859
|
-
|
|
1859
|
+
We(t, e) || (this.lastEmitted = [...t], this.emitInput(this.toValue(t)));
|
|
1860
1860
|
}
|
|
1861
1861
|
/** Host value (any mode) -> the Date list flatpickr works with. */
|
|
1862
1862
|
datesOf(t) {
|
|
1863
|
-
return
|
|
1863
|
+
return ds(t).map(Nt).filter((e) => e !== null);
|
|
1864
1864
|
}
|
|
1865
1865
|
/** flatpickr's selection -> the value shape of the field's mode. */
|
|
1866
1866
|
toValue(t) {
|
|
1867
|
-
const e = t.map(
|
|
1868
|
-
switch (
|
|
1867
|
+
const e = t.map(zt);
|
|
1868
|
+
switch ($e(this.field)) {
|
|
1869
1869
|
case "range":
|
|
1870
1870
|
return e.length === 2 ? [e[0], e[1]] : null;
|
|
1871
1871
|
case "multiple":
|
|
@@ -1875,44 +1875,44 @@ let Ue = class extends W {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
1877
|
};
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
],
|
|
1881
|
-
function
|
|
1878
|
+
He = ka([
|
|
1879
|
+
b("baht-datepicker")
|
|
1880
|
+
], He);
|
|
1881
|
+
function kt(t) {
|
|
1882
1882
|
return new Date(t.getFullYear(), t.getMonth(), t.getDate());
|
|
1883
1883
|
}
|
|
1884
|
-
function He(t, e) {
|
|
1885
|
-
return Rt(t) === Rt(e);
|
|
1886
|
-
}
|
|
1887
1884
|
function Ge(t, e) {
|
|
1888
|
-
return t
|
|
1885
|
+
return zt(t) === zt(e);
|
|
1886
|
+
}
|
|
1887
|
+
function We(t, e) {
|
|
1888
|
+
return t.length !== e.length ? !1 : t.every((i, a) => zt(i) === zt(e[a]));
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Je(t) {
|
|
1891
1891
|
const e = [];
|
|
1892
1892
|
for (const a of t.disabled_dates ?? []) {
|
|
1893
|
-
const s =
|
|
1893
|
+
const s = us(a);
|
|
1894
1894
|
s && e.push(s[0].getTime() === s[1].getTime() ? s[0] : { from: s[0], to: s[1] });
|
|
1895
1895
|
}
|
|
1896
1896
|
const i = t.disabled_weekdays;
|
|
1897
1897
|
return i != null && i.length && e.push((a) => i.includes(a.getDay())), e;
|
|
1898
1898
|
}
|
|
1899
|
-
var
|
|
1900
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1899
|
+
var Pa = Object.defineProperty, Oa = Object.getOwnPropertyDescriptor, Qt = (t, e, i, a) => {
|
|
1900
|
+
for (var s = a > 1 ? void 0 : a ? Oa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
1901
1901
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
1902
|
-
return a && s &&
|
|
1902
|
+
return a && s && Pa(e, i, s), s;
|
|
1903
1903
|
};
|
|
1904
|
-
function
|
|
1904
|
+
function Ye(t) {
|
|
1905
1905
|
return t !== null && typeof t == "object" && typeof t.url == "string";
|
|
1906
1906
|
}
|
|
1907
|
-
function
|
|
1907
|
+
function ge(t) {
|
|
1908
1908
|
return t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)} MB` : t >= 1024 ? `${Math.round(t / 1024)} KB` : `${t} B`;
|
|
1909
1909
|
}
|
|
1910
|
-
let
|
|
1910
|
+
let Et = class extends Y {
|
|
1911
1911
|
constructor() {
|
|
1912
1912
|
super(...arguments), this.uploadingCount = 0, this.uploadError = null, this.rejectedNames = [];
|
|
1913
1913
|
}
|
|
1914
1914
|
get refs() {
|
|
1915
|
-
return Array.isArray(this.value) ? this.value.filter(
|
|
1915
|
+
return Array.isArray(this.value) ? this.value.filter(Ye) : Ye(this.value) ? [this.value] : [];
|
|
1916
1916
|
}
|
|
1917
1917
|
emitRefs(t) {
|
|
1918
1918
|
this.emitInput(this.field.multiple ? t : t[0] ?? null);
|
|
@@ -1925,7 +1925,7 @@ let Dt = class extends W {
|
|
|
1925
1925
|
try {
|
|
1926
1926
|
e.push(await this.uploader(i));
|
|
1927
1927
|
} catch {
|
|
1928
|
-
this.uploadError =
|
|
1928
|
+
this.uploadError = m("uploadFailed");
|
|
1929
1929
|
} finally {
|
|
1930
1930
|
this.uploadingCount -= 1;
|
|
1931
1931
|
}
|
|
@@ -1950,7 +1950,7 @@ let Dt = class extends W {
|
|
|
1950
1950
|
const t = [];
|
|
1951
1951
|
return this.field.accept && t.push(
|
|
1952
1952
|
this.field.accept.split(",").map((e) => e.trim()).join(", ")
|
|
1953
|
-
), this.field.max_size && t.push(
|
|
1953
|
+
), this.field.max_size && t.push(m("uploadMaxSize", { size: ge(this.field.max_size) })), t.join(" · ");
|
|
1954
1954
|
}
|
|
1955
1955
|
renderControl() {
|
|
1956
1956
|
const t = this.disabled || this.readonly || this.uploadingCount > 0, e = this.hintText(), i = [
|
|
@@ -1973,7 +1973,7 @@ let Dt = class extends W {
|
|
|
1973
1973
|
class="baht-control baht-control--file baht-dropzone-input"
|
|
1974
1974
|
id=${this.controlId}
|
|
1975
1975
|
type="file"
|
|
1976
|
-
accept=${
|
|
1976
|
+
accept=${N(this.field.accept)}
|
|
1977
1977
|
?multiple=${this.field.multiple}
|
|
1978
1978
|
?disabled=${t}
|
|
1979
1979
|
?required=${this.required}
|
|
@@ -1981,83 +1981,83 @@ let Dt = class extends W {
|
|
|
1981
1981
|
aria-describedby=${this.describedBy}
|
|
1982
1982
|
@change=${(a) => this.onPick(a)}
|
|
1983
1983
|
/>
|
|
1984
|
-
<span class="baht-dropzone-icon" aria-hidden="true">${
|
|
1984
|
+
<span class="baht-dropzone-icon" aria-hidden="true">${W("upload")}</span>
|
|
1985
1985
|
<span class="baht-dropzone-text">
|
|
1986
1986
|
<label class="baht-dropzone-action" for=${this.controlId}
|
|
1987
|
-
>${this.field.multiple ?
|
|
1987
|
+
>${this.field.multiple ? m("chooseFiles") : m("chooseFile")}</label
|
|
1988
1988
|
>
|
|
1989
|
-
<span class="baht-dropzone-or">${
|
|
1989
|
+
<span class="baht-dropzone-or">${m("orDropHere")}</span>
|
|
1990
1990
|
</span>
|
|
1991
1991
|
${e ? n`<span class="baht-dropzone-hint">${e}</span>` : h}
|
|
1992
1992
|
</div>
|
|
1993
|
-
${this.uploadingCount > 0 ? n`<p class="baht-file-status" role="status">${
|
|
1993
|
+
${this.uploadingCount > 0 ? n`<p class="baht-file-status" role="status">${m("uploading")}</p>` : h}
|
|
1994
1994
|
${this.uploadError ? n`<p class="baht-error" role="alert">${this.uploadError}</p>` : h}
|
|
1995
1995
|
${this.rejectedNames.length > 0 ? n`<p class="baht-error baht-file-rejected" role="alert">
|
|
1996
|
-
${
|
|
1996
|
+
${m("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
|
|
1997
1997
|
</p>` : h}
|
|
1998
1998
|
${this.captured.map(
|
|
1999
1999
|
(a) => n`<span class="baht-file-chip">
|
|
2000
2000
|
<span class="baht-file-name">${a.name}</span>
|
|
2001
|
-
<span class="baht-file-size">${
|
|
2001
|
+
<span class="baht-file-size">${ge(a.size)}</span>
|
|
2002
2002
|
</span>`
|
|
2003
2003
|
)}
|
|
2004
2004
|
${this.refs.map(
|
|
2005
2005
|
(a) => n`<span class="baht-file-chip">
|
|
2006
2006
|
<a href=${a.url} target="_blank" rel="noreferrer"
|
|
2007
|
-
>${a.name}<span class="baht-visually-hidden"> (${
|
|
2007
|
+
>${a.name}<span class="baht-visually-hidden"> (${m("opensInNewTab")})</span></a
|
|
2008
2008
|
>
|
|
2009
|
-
<span class="baht-file-size">${
|
|
2009
|
+
<span class="baht-file-size">${ge(a.size)}</span>
|
|
2010
2010
|
${this.disabled || this.readonly ? h : n`<button
|
|
2011
2011
|
type="button"
|
|
2012
2012
|
class="baht-file-remove"
|
|
2013
|
-
aria-label=${
|
|
2014
|
-
title=${
|
|
2013
|
+
aria-label=${m("removeFile")}
|
|
2014
|
+
title=${m("removeFile")}
|
|
2015
2015
|
@click=${() => this.emitRefs(this.refs.filter((s) => s !== a))}
|
|
2016
2016
|
>
|
|
2017
|
-
${
|
|
2017
|
+
${W("close")}
|
|
2018
2018
|
</button>`}
|
|
2019
2019
|
</span>`
|
|
2020
2020
|
)}`;
|
|
2021
2021
|
}
|
|
2022
2022
|
};
|
|
2023
|
-
|
|
2023
|
+
Qt([
|
|
2024
2024
|
l({ attribute: !1 })
|
|
2025
|
-
],
|
|
2026
|
-
|
|
2025
|
+
], Et.prototype, "uploader", 2);
|
|
2026
|
+
Qt([
|
|
2027
2027
|
y()
|
|
2028
|
-
],
|
|
2029
|
-
|
|
2028
|
+
], Et.prototype, "uploadingCount", 2);
|
|
2029
|
+
Qt([
|
|
2030
2030
|
y()
|
|
2031
|
-
],
|
|
2032
|
-
|
|
2031
|
+
], Et.prototype, "uploadError", 2);
|
|
2032
|
+
Qt([
|
|
2033
2033
|
y()
|
|
2034
|
-
],
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
],
|
|
2038
|
-
var
|
|
2039
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
2034
|
+
], Et.prototype, "rejectedNames", 2);
|
|
2035
|
+
Et = Qt([
|
|
2036
|
+
b("baht-file")
|
|
2037
|
+
], Et);
|
|
2038
|
+
var Ca = Object.defineProperty, Da = Object.getOwnPropertyDescriptor, I = (t, e, i, a) => {
|
|
2039
|
+
for (var s = a > 1 ? void 0 : a ? Da(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2040
2040
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2041
|
-
return a && s &&
|
|
2041
|
+
return a && s && Ca(e, i, s), s;
|
|
2042
2042
|
};
|
|
2043
|
-
function
|
|
2043
|
+
function Fa(t, e) {
|
|
2044
2044
|
return e.split(".").reduce((i, a) => {
|
|
2045
2045
|
if (i !== null && typeof i == "object") return i[a];
|
|
2046
2046
|
}, t);
|
|
2047
2047
|
}
|
|
2048
|
-
function
|
|
2048
|
+
function Ea(t, e) {
|
|
2049
2049
|
const i = t.trim();
|
|
2050
2050
|
if (!i) return null;
|
|
2051
2051
|
try {
|
|
2052
2052
|
const a = JSON.parse(i);
|
|
2053
2053
|
if (typeof a == "string") return a;
|
|
2054
|
-
const s = e ?
|
|
2054
|
+
const s = e ? Fa(a, e) : a;
|
|
2055
2055
|
return typeof s == "string" && s ? s : null;
|
|
2056
2056
|
} catch {
|
|
2057
2057
|
return /^(https?:\/\/|\/|data:|blob:)/.test(i) ? i : null;
|
|
2058
2058
|
}
|
|
2059
2059
|
}
|
|
2060
|
-
function
|
|
2060
|
+
function Ba(t) {
|
|
2061
2061
|
const i = (t.split(/[?#]/)[0] ?? t).split("/").filter(Boolean).pop() ?? t;
|
|
2062
2062
|
try {
|
|
2063
2063
|
return decodeURIComponent(i);
|
|
@@ -2065,10 +2065,10 @@ function Ea(t) {
|
|
|
2065
2065
|
return i;
|
|
2066
2066
|
}
|
|
2067
2067
|
}
|
|
2068
|
-
function
|
|
2068
|
+
function we(t) {
|
|
2069
2069
|
return t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)} MB` : t >= 1024 ? `${Math.round(t / 1024)} KB` : `${t} B`;
|
|
2070
2070
|
}
|
|
2071
|
-
let F = class extends
|
|
2071
|
+
let F = class extends g {
|
|
2072
2072
|
constructor() {
|
|
2073
2073
|
super(...arguments), this.url = "", this.method = "POST", this.fieldName = "file", this.responseKey = "url", this.headers = {}, this.withCredentials = !1, this.value = null, this.label = "", this.hint = "", this.multiple = !1, this.disabled = !1, this.required = !1, this.error = null, this.pending = [], this.rejectedNames = [], this.dragging = !1, this.known = /* @__PURE__ */ new Map(), this.seq = 0;
|
|
2074
2074
|
}
|
|
@@ -2079,7 +2079,7 @@ let F = class extends $ {
|
|
|
2079
2079
|
return `baht-upload-${this.uid}`;
|
|
2080
2080
|
}
|
|
2081
2081
|
fileFor(t) {
|
|
2082
|
-
return this.known.get(t) ?? { name:
|
|
2082
|
+
return this.known.get(t) ?? { name: Ba(t), size: 0, url: t };
|
|
2083
2083
|
}
|
|
2084
2084
|
/** Empty the value (does not delete anything on the server). */
|
|
2085
2085
|
clear() {
|
|
@@ -2139,7 +2139,7 @@ let F = class extends $ {
|
|
|
2139
2139
|
})
|
|
2140
2140
|
);
|
|
2141
2141
|
}, e.onload = () => {
|
|
2142
|
-
const a = e.status >= 200 && e.status < 300, s = a ?
|
|
2142
|
+
const a = e.status >= 200 && e.status < 300, s = a ? Ea(e.responseText, this.responseKey) : null;
|
|
2143
2143
|
if (!a || !s) return this.failed(t, a ? 0 : e.status);
|
|
2144
2144
|
this.known.set(s, {
|
|
2145
2145
|
name: t.file.name,
|
|
@@ -2152,7 +2152,7 @@ let F = class extends $ {
|
|
|
2152
2152
|
i.append(this.fieldName || "file", t.file, t.file.name), e.send(i);
|
|
2153
2153
|
}
|
|
2154
2154
|
failed(t, e) {
|
|
2155
|
-
const i =
|
|
2155
|
+
const i = m("uploadFailed");
|
|
2156
2156
|
this.patch(t.id, { error: i, percent: 0 }), this.dispatchEvent(
|
|
2157
2157
|
new CustomEvent("baht-upload-error", {
|
|
2158
2158
|
detail: { file: t.file, status: e, message: i },
|
|
@@ -2171,7 +2171,7 @@ let F = class extends $ {
|
|
|
2171
2171
|
const t = [];
|
|
2172
2172
|
return this.accept && t.push(
|
|
2173
2173
|
this.accept.split(",").map((e) => e.trim()).join(", ")
|
|
2174
|
-
), this.maxSize && t.push(
|
|
2174
|
+
), this.maxSize && t.push(m("uploadMaxSize", { size: we(this.maxSize) })), t.join(" · ");
|
|
2175
2175
|
}
|
|
2176
2176
|
render() {
|
|
2177
2177
|
const t = this.pending.some((c) => !c.error), e = !!this.error, i = this.hint || this.defaultHint(), a = i ? `${this.inputId}-hint` : void 0, s = this.error ? `${this.inputId}-error` : void 0, r = [a, s].filter(Boolean).join(" ") || void 0, o = [
|
|
@@ -2194,22 +2194,22 @@ let F = class extends $ {
|
|
|
2194
2194
|
class="baht-dropzone-input"
|
|
2195
2195
|
id=${this.inputId}
|
|
2196
2196
|
type="file"
|
|
2197
|
-
accept=${
|
|
2197
|
+
accept=${N(this.accept)}
|
|
2198
2198
|
?multiple=${this.multiple}
|
|
2199
2199
|
?disabled=${this.disabled}
|
|
2200
2200
|
?required=${this.required}
|
|
2201
2201
|
aria-invalid=${e ? "true" : "false"}
|
|
2202
|
-
aria-describedby=${
|
|
2202
|
+
aria-describedby=${N(r)}
|
|
2203
2203
|
@change=${(c) => this.onPick(c)}
|
|
2204
2204
|
/>
|
|
2205
|
-
<span class="baht-dropzone-icon" aria-hidden="true">${
|
|
2205
|
+
<span class="baht-dropzone-icon" aria-hidden="true">${W("upload")}</span>
|
|
2206
2206
|
<span class="baht-dropzone-text">
|
|
2207
2207
|
<label class="baht-dropzone-action" for=${this.inputId}
|
|
2208
|
-
>${this.multiple ?
|
|
2208
|
+
>${this.multiple ? m("chooseFiles") : m("chooseFile")}</label
|
|
2209
2209
|
>
|
|
2210
|
-
<span class="baht-dropzone-or">${
|
|
2210
|
+
<span class="baht-dropzone-or">${m("orDropHere")}</span>
|
|
2211
2211
|
</span>
|
|
2212
|
-
${i ? n`<span class="baht-dropzone-hint" id=${
|
|
2212
|
+
${i ? n`<span class="baht-dropzone-hint" id=${N(a)}>${i}</span>` : h}
|
|
2213
2213
|
</div>
|
|
2214
2214
|
|
|
2215
2215
|
${this.pending.length > 0 || this.urls.length > 0 ? n`<ul class="baht-upload-list" aria-live="polite" aria-busy=${t ? "true" : "false"}>
|
|
@@ -2217,50 +2217,50 @@ let F = class extends $ {
|
|
|
2217
2217
|
${this.pending.map((c) => this.renderPending(c))}
|
|
2218
2218
|
</ul>` : h}
|
|
2219
2219
|
${this.rejectedNames.length > 0 ? n`<p class="baht-error" role="alert">
|
|
2220
|
-
${
|
|
2220
|
+
${m("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
|
|
2221
2221
|
</p>` : h}
|
|
2222
|
-
${this.error ? n`<p class="baht-error" id=${
|
|
2222
|
+
${this.error ? n`<p class="baht-error" id=${N(s)} role="alert">${this.error}</p>` : h}
|
|
2223
2223
|
</div>`;
|
|
2224
2224
|
}
|
|
2225
2225
|
renderStored(t) {
|
|
2226
2226
|
const e = this.fileFor(t);
|
|
2227
2227
|
return n`<li class="baht-file-chip baht-file-chip--done">
|
|
2228
|
-
<span class="baht-file-chip-icon" aria-hidden="true">${
|
|
2228
|
+
<span class="baht-file-chip-icon" aria-hidden="true">${W("check")}</span>
|
|
2229
2229
|
<a class="baht-file-name" href=${t} target="_blank" rel="noreferrer"
|
|
2230
|
-
>${e.name}<span class="baht-visually-hidden"> (${
|
|
2230
|
+
>${e.name}<span class="baht-visually-hidden"> (${m("opensInNewTab")})</span></a
|
|
2231
2231
|
>
|
|
2232
|
-
${e.size > 0 ? n`<span class="baht-file-size">${
|
|
2232
|
+
${e.size > 0 ? n`<span class="baht-file-size">${we(e.size)}</span>` : h}
|
|
2233
2233
|
${this.disabled ? h : n`<button
|
|
2234
2234
|
type="button"
|
|
2235
2235
|
class="baht-file-remove"
|
|
2236
|
-
aria-label=${
|
|
2237
|
-
title=${
|
|
2236
|
+
aria-label=${m("removeFile")}
|
|
2237
|
+
title=${m("removeFile")}
|
|
2238
2238
|
@click=${() => this.emitValue(this.urls.filter((i) => i !== t))}
|
|
2239
2239
|
>
|
|
2240
|
-
${
|
|
2240
|
+
${W("close")}
|
|
2241
2241
|
</button>`}
|
|
2242
2242
|
</li>`;
|
|
2243
2243
|
}
|
|
2244
2244
|
renderPending(t) {
|
|
2245
2245
|
return n`<li class="baht-file-chip ${t.error ? "baht-file-chip--error" : "baht-file-chip--busy"}">
|
|
2246
2246
|
<span class="baht-file-name">${t.file.name}</span>
|
|
2247
|
-
<span class="baht-file-size">${
|
|
2247
|
+
<span class="baht-file-size">${we(t.file.size)}</span>
|
|
2248
2248
|
${t.error ? n`<span class="baht-file-status baht-file-status--error" role="alert">${t.error}</span>
|
|
2249
2249
|
<button type="button" class="baht-upload-retry" @click=${() => this.retry(t)}>
|
|
2250
|
-
${
|
|
2250
|
+
${m("retry")}
|
|
2251
2251
|
</button>
|
|
2252
2252
|
<button
|
|
2253
2253
|
type="button"
|
|
2254
2254
|
class="baht-file-remove"
|
|
2255
|
-
aria-label=${
|
|
2256
|
-
title=${
|
|
2255
|
+
aria-label=${m("removeFile")}
|
|
2256
|
+
title=${m("removeFile")}
|
|
2257
2257
|
@click=${() => this.dismiss(t)}
|
|
2258
2258
|
>
|
|
2259
|
-
${
|
|
2259
|
+
${W("close")}
|
|
2260
2260
|
</button>` : n`<span
|
|
2261
2261
|
class="baht-upload-bar"
|
|
2262
2262
|
role="progressbar"
|
|
2263
|
-
aria-label=${
|
|
2263
|
+
aria-label=${m("uploading")}
|
|
2264
2264
|
aria-valuemin="0"
|
|
2265
2265
|
aria-valuemax="100"
|
|
2266
2266
|
aria-valuenow=${String(t.percent)}
|
|
@@ -2324,50 +2324,50 @@ I([
|
|
|
2324
2324
|
y()
|
|
2325
2325
|
], F.prototype, "dragging", 2);
|
|
2326
2326
|
F = I([
|
|
2327
|
-
|
|
2327
|
+
b("baht-upload")
|
|
2328
2328
|
], F);
|
|
2329
|
-
var
|
|
2330
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
2329
|
+
var Ia = Object.defineProperty, Ma = Object.getOwnPropertyDescriptor, ns = (t, e, i, a) => {
|
|
2330
|
+
for (var s = a > 1 ? void 0 : a ? Ma(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2331
2331
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2332
|
-
return a && s &&
|
|
2332
|
+
return a && s && Ia(e, i, s), s;
|
|
2333
2333
|
};
|
|
2334
|
-
let
|
|
2334
|
+
let Fe = class extends g {
|
|
2335
2335
|
render() {
|
|
2336
2336
|
if (!this.field) return h;
|
|
2337
2337
|
const t = this.field.variant ?? "body";
|
|
2338
2338
|
return n`<div class="baht-text baht-text--${t}">${this.field.text ?? this.field.label ?? ""}</div>`;
|
|
2339
2339
|
}
|
|
2340
2340
|
};
|
|
2341
|
-
|
|
2341
|
+
ns([
|
|
2342
2342
|
l({ attribute: !1 })
|
|
2343
|
-
],
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
],
|
|
2347
|
-
var ja = Object.defineProperty, Sa = Object.getOwnPropertyDescriptor,
|
|
2343
|
+
], Fe.prototype, "field", 2);
|
|
2344
|
+
Fe = ns([
|
|
2345
|
+
b("baht-text")
|
|
2346
|
+
], Fe);
|
|
2347
|
+
var ja = Object.defineProperty, Sa = Object.getOwnPropertyDescriptor, hs = (t, e, i, a) => {
|
|
2348
2348
|
for (var s = a > 1 ? void 0 : a ? Sa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2349
2349
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2350
2350
|
return a && s && ja(e, i, s), s;
|
|
2351
2351
|
};
|
|
2352
|
-
let
|
|
2352
|
+
let Ee = class extends g {
|
|
2353
2353
|
render() {
|
|
2354
2354
|
return this.field ? n`<div class="baht-section">
|
|
2355
2355
|
<span class="baht-section-label">${this.field.text ?? this.field.label ?? ""}</span>
|
|
2356
2356
|
</div>` : h;
|
|
2357
2357
|
}
|
|
2358
2358
|
};
|
|
2359
|
-
|
|
2359
|
+
hs([
|
|
2360
2360
|
l({ attribute: !1 })
|
|
2361
|
-
],
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
],
|
|
2365
|
-
var Ta = Object.defineProperty,
|
|
2366
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
2361
|
+
], Ee.prototype, "field", 2);
|
|
2362
|
+
Ee = hs([
|
|
2363
|
+
b("baht-section")
|
|
2364
|
+
], Ee);
|
|
2365
|
+
var Ta = Object.defineProperty, Aa = Object.getOwnPropertyDescriptor, be = (t, e, i, a) => {
|
|
2366
|
+
for (var s = a > 1 ? void 0 : a ? Aa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2367
2367
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2368
2368
|
return a && s && Ta(e, i, s), s;
|
|
2369
2369
|
};
|
|
2370
|
-
let
|
|
2370
|
+
let Ht = class extends g {
|
|
2371
2371
|
constructor() {
|
|
2372
2372
|
super(...arguments), this.total = 0, this.label = "", this.color = "";
|
|
2373
2373
|
}
|
|
@@ -2381,31 +2381,31 @@ let Ut = class extends $ {
|
|
|
2381
2381
|
</div>`;
|
|
2382
2382
|
}
|
|
2383
2383
|
};
|
|
2384
|
-
|
|
2384
|
+
be([
|
|
2385
2385
|
l({ type: Number })
|
|
2386
|
-
],
|
|
2387
|
-
|
|
2386
|
+
], Ht.prototype, "total", 2);
|
|
2387
|
+
be([
|
|
2388
2388
|
l()
|
|
2389
|
-
],
|
|
2390
|
-
|
|
2389
|
+
], Ht.prototype, "label", 2);
|
|
2390
|
+
be([
|
|
2391
2391
|
l()
|
|
2392
|
-
],
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
],
|
|
2396
|
-
var
|
|
2392
|
+
], Ht.prototype, "color", 2);
|
|
2393
|
+
Ht = be([
|
|
2394
|
+
b("baht-stat-chart")
|
|
2395
|
+
], Ht);
|
|
2396
|
+
var La = Object.defineProperty, At = (t, e, i, a) => {
|
|
2397
2397
|
for (var s = void 0, r = t.length - 1, o; r >= 0; r--)
|
|
2398
2398
|
(o = t[r]) && (s = o(e, i, s) || s);
|
|
2399
|
-
return s &&
|
|
2399
|
+
return s && La(e, i, s), s;
|
|
2400
2400
|
};
|
|
2401
|
-
const
|
|
2402
|
-
function
|
|
2403
|
-
return e && t === 0 ? e : `var(--baht-chart-${t %
|
|
2401
|
+
const Na = 10;
|
|
2402
|
+
function ft(t, e) {
|
|
2403
|
+
return e && t === 0 ? e : `var(--baht-chart-${t % Na + 1})`;
|
|
2404
2404
|
}
|
|
2405
|
-
function
|
|
2405
|
+
function Xe(t, e = 5) {
|
|
2406
2406
|
return `var(--baht-chart-seq-${Math.min(e - 1, Math.max(0, t)) + 1})`;
|
|
2407
2407
|
}
|
|
2408
|
-
function
|
|
2408
|
+
function Rt(t, e = "number", i = "THB") {
|
|
2409
2409
|
if (!Number.isFinite(t)) return "—";
|
|
2410
2410
|
switch (e) {
|
|
2411
2411
|
case "currency":
|
|
@@ -2429,22 +2429,22 @@ function qt(t, e = "number", i = "THB") {
|
|
|
2429
2429
|
return new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(t);
|
|
2430
2430
|
}
|
|
2431
2431
|
}
|
|
2432
|
-
function
|
|
2432
|
+
function Be(t, e = 4) {
|
|
2433
2433
|
if (!Number.isFinite(t) || t <= 0) return [0, 1];
|
|
2434
2434
|
const i = t / (Math.max(1, e) + 1), a = 10 ** Math.floor(Math.log10(i)), s = [1, 2, 2.5, 5, 10].map((c) => c * a).find((c) => c >= i - 1e-9) ?? 10 * a, r = Math.ceil(t / s) * s, o = [];
|
|
2435
2435
|
for (let c = 0; c <= r + s / 1e3; c += s) o.push(Number(c.toFixed(10)));
|
|
2436
2436
|
return o;
|
|
2437
2437
|
}
|
|
2438
|
-
function
|
|
2438
|
+
function ne(t, e) {
|
|
2439
2439
|
const [i, a] = t, [s, r] = e, o = a - i;
|
|
2440
2440
|
return !Number.isFinite(o) || o === 0 ? () => s : (c) => s + (c - i) / o * (r - s);
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function qa(t, e, i = "Other") {
|
|
2443
2443
|
if (t.length <= e) return t;
|
|
2444
2444
|
const a = t.slice(0, e - 1), s = t.slice(e - 1).reduce((r, o) => r + o.count, 0);
|
|
2445
2445
|
return [...a, { label: i, count: s }];
|
|
2446
2446
|
}
|
|
2447
|
-
function
|
|
2447
|
+
function fe(t, e, i, a = "View as table") {
|
|
2448
2448
|
return n`<details class="baht-chart-table">
|
|
2449
2449
|
<summary>${a}</summary>
|
|
2450
2450
|
<table>
|
|
@@ -2466,13 +2466,13 @@ function be(t, e, i, a = "View as table") {
|
|
|
2466
2466
|
</table>
|
|
2467
2467
|
</details>`;
|
|
2468
2468
|
}
|
|
2469
|
-
class
|
|
2469
|
+
class st extends g {
|
|
2470
2470
|
constructor() {
|
|
2471
2471
|
super(...arguments), this.emptyMessage = "No data to chart", this.loading = !1, this.showTable = !0, this.format = "number", this.currency = "THB", this.held = null;
|
|
2472
2472
|
}
|
|
2473
2473
|
/** Value → display text using this chart's `format` / `currency`. */
|
|
2474
2474
|
fmt(e) {
|
|
2475
|
-
return
|
|
2475
|
+
return Rt(e, this.format, this.currency);
|
|
2476
2476
|
}
|
|
2477
2477
|
/**
|
|
2478
2478
|
* The snapshot to draw. While `loading` is set the previous one is returned,
|
|
@@ -2495,21 +2495,21 @@ class Q extends $ {
|
|
|
2495
2495
|
* untrusted data (interaction.md).
|
|
2496
2496
|
*/
|
|
2497
2497
|
showTip(e, i) {
|
|
2498
|
-
var
|
|
2498
|
+
var $;
|
|
2499
2499
|
const a = this.tipEl;
|
|
2500
2500
|
if (!a) return;
|
|
2501
2501
|
a.textContent = i, a.hidden = !1;
|
|
2502
2502
|
const s = this.querySelector(".baht-chart");
|
|
2503
2503
|
if (!s || typeof s.getBoundingClientRect != "function") return;
|
|
2504
2504
|
const r = s.getBoundingClientRect(), o = e;
|
|
2505
|
-
let c,
|
|
2505
|
+
let c, f;
|
|
2506
2506
|
if (typeof o.clientX == "number" && (o.clientX !== 0 || o.clientY !== 0))
|
|
2507
|
-
c = o.clientX - r.left,
|
|
2507
|
+
c = o.clientX - r.left, f = o.clientY - r.top;
|
|
2508
2508
|
else {
|
|
2509
|
-
const
|
|
2510
|
-
c = p ? p.left + p.width / 2 - r.left : 0,
|
|
2509
|
+
const w = e.currentTarget, p = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w);
|
|
2510
|
+
c = p ? p.left + p.width / 2 - r.left : 0, f = p ? p.top - r.top : 0;
|
|
2511
2511
|
}
|
|
2512
|
-
a.style.left = `${Math.round(c)}px`, a.style.top = `${Math.round(
|
|
2512
|
+
a.style.left = `${Math.round(c)}px`, a.style.top = `${Math.round(f)}px`;
|
|
2513
2513
|
}
|
|
2514
2514
|
/** Hide the tooltip (pointerleave / blur). */
|
|
2515
2515
|
hideTip() {
|
|
@@ -2538,78 +2538,78 @@ class Q extends $ {
|
|
|
2538
2538
|
</div>`;
|
|
2539
2539
|
}
|
|
2540
2540
|
}
|
|
2541
|
-
|
|
2541
|
+
At([
|
|
2542
2542
|
l({ attribute: "empty-message" })
|
|
2543
|
-
],
|
|
2544
|
-
|
|
2543
|
+
], st.prototype, "emptyMessage");
|
|
2544
|
+
At([
|
|
2545
2545
|
l({ type: Boolean, reflect: !0 })
|
|
2546
|
-
],
|
|
2547
|
-
|
|
2546
|
+
], st.prototype, "loading");
|
|
2547
|
+
At([
|
|
2548
2548
|
l({ type: Boolean, attribute: "show-table" })
|
|
2549
|
-
],
|
|
2550
|
-
|
|
2549
|
+
], st.prototype, "showTable");
|
|
2550
|
+
At([
|
|
2551
2551
|
l()
|
|
2552
|
-
],
|
|
2553
|
-
|
|
2552
|
+
], st.prototype, "format");
|
|
2553
|
+
At([
|
|
2554
2554
|
l()
|
|
2555
|
-
],
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
],
|
|
2559
|
-
var
|
|
2560
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
2555
|
+
], st.prototype, "currency");
|
|
2556
|
+
At([
|
|
2557
|
+
It(".baht-chart-tooltip")
|
|
2558
|
+
], st.prototype, "tipEl");
|
|
2559
|
+
var Ra = Object.defineProperty, za = Object.getOwnPropertyDescriptor, wt = (t, e, i, a) => {
|
|
2560
|
+
for (var s = a > 1 ? void 0 : a ? za(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2561
2561
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2562
|
-
return a && s &&
|
|
2562
|
+
return a && s && Ra(e, i, s), s;
|
|
2563
2563
|
};
|
|
2564
|
-
let
|
|
2564
|
+
let ct = class extends g {
|
|
2565
2565
|
constructor() {
|
|
2566
2566
|
super(...arguments), this.values = [], this.width = 96, this.height = 24, this.accentLast = !0, this.color = "", this.label = "";
|
|
2567
2567
|
}
|
|
2568
2568
|
render() {
|
|
2569
|
-
const t = (this.values ?? []).filter((
|
|
2569
|
+
const t = (this.values ?? []).filter((x) => Number.isFinite(x));
|
|
2570
2570
|
if (t.length < 2) return h;
|
|
2571
|
-
const e = Math.max(16, this.width), i = Math.max(8, this.height), a = 3, s = Math.min(...t), r = Math.max(...t), o =
|
|
2571
|
+
const e = Math.max(16, this.width), i = Math.max(8, this.height), a = 3, s = Math.min(...t), r = Math.max(...t), o = ne([0, t.length - 1], [a, e - a]), c = ne([s, r === s ? s + 1 : r], [i - a, a]), f = t.map((x, u) => `${o(u).toFixed(2)},${c(x).toFixed(2)}`).join(" "), $ = o(t.length - 1), w = c(t[t.length - 1]), p = this.color || "var(--baht-chart-muted)", P = this.label || `Trend of ${t.length} points`;
|
|
2572
2572
|
return n`<svg
|
|
2573
2573
|
class="baht-sparkline"
|
|
2574
2574
|
width=${e}
|
|
2575
2575
|
height=${i}
|
|
2576
2576
|
viewBox="0 0 ${e} ${i}"
|
|
2577
2577
|
role="img"
|
|
2578
|
-
aria-label=${
|
|
2578
|
+
aria-label=${P}
|
|
2579
2579
|
>
|
|
2580
|
-
${
|
|
2581
|
-
${this.accentLast ?
|
|
2580
|
+
${L`<polyline class="baht-sparkline-line" points=${f} fill="none" stroke=${p}/>`}
|
|
2581
|
+
${this.accentLast ? L`<circle class="baht-sparkline-dot" cx=${$.toFixed(2)} cy=${w.toFixed(2)} r="3"
|
|
2582
2582
|
fill="var(--baht-chart-1)"/>` : h}
|
|
2583
2583
|
</svg>`;
|
|
2584
2584
|
}
|
|
2585
2585
|
};
|
|
2586
|
-
|
|
2586
|
+
wt([
|
|
2587
2587
|
l({ type: Array })
|
|
2588
|
-
],
|
|
2589
|
-
|
|
2588
|
+
], ct.prototype, "values", 2);
|
|
2589
|
+
wt([
|
|
2590
2590
|
l({ type: Number })
|
|
2591
|
-
],
|
|
2592
|
-
|
|
2591
|
+
], ct.prototype, "width", 2);
|
|
2592
|
+
wt([
|
|
2593
2593
|
l({ type: Number })
|
|
2594
|
-
],
|
|
2595
|
-
|
|
2594
|
+
], ct.prototype, "height", 2);
|
|
2595
|
+
wt([
|
|
2596
2596
|
l({ type: Boolean, attribute: "accent-last" })
|
|
2597
|
-
],
|
|
2598
|
-
|
|
2597
|
+
], ct.prototype, "accentLast", 2);
|
|
2598
|
+
wt([
|
|
2599
2599
|
l()
|
|
2600
|
-
],
|
|
2601
|
-
|
|
2600
|
+
], ct.prototype, "color", 2);
|
|
2601
|
+
wt([
|
|
2602
2602
|
l()
|
|
2603
|
-
],
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
],
|
|
2607
|
-
var
|
|
2608
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
2603
|
+
], ct.prototype, "label", 2);
|
|
2604
|
+
ct = wt([
|
|
2605
|
+
b("baht-sparkline")
|
|
2606
|
+
], ct);
|
|
2607
|
+
var Va = Object.defineProperty, Ka = Object.getOwnPropertyDescriptor, X = (t, e, i, a) => {
|
|
2608
|
+
for (var s = a > 1 ? void 0 : a ? Ka(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2609
2609
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2610
|
-
return a && s &&
|
|
2610
|
+
return a && s && Va(e, i, s), s;
|
|
2611
2611
|
};
|
|
2612
|
-
let
|
|
2612
|
+
let K = class extends g {
|
|
2613
2613
|
constructor() {
|
|
2614
2614
|
super(...arguments), this.label = "", this.value = 0, this.format = "number", this.currency = "THB", this.delta = null, this.deltaKind = "pct", this.deltaLabel = "", this.upIsGood = !0, this.trend = [], this.size = "md";
|
|
2615
2615
|
}
|
|
@@ -2624,19 +2624,20 @@ let z = class extends $ {
|
|
|
2624
2624
|
}
|
|
2625
2625
|
get deltaText() {
|
|
2626
2626
|
const t = this.delta ?? 0, e = Math.abs(t);
|
|
2627
|
-
return this.deltaKind === "pct" ? `${
|
|
2627
|
+
return this.deltaKind === "pct" ? `${Rt(e / 100, "percent")}` : Rt(e, this.format, this.currency);
|
|
2628
2628
|
}
|
|
2629
2629
|
render() {
|
|
2630
2630
|
const t = this.delta != null && Number.isFinite(this.delta), e = this.tone, i = (this.delta ?? 0) > 0 ? "up" : (this.delta ?? 0) < 0 ? "down" : "flat";
|
|
2631
2631
|
return n`<div class="baht-stat${this.size === "hero" ? " baht-stat--hero" : ""}">
|
|
2632
2632
|
${this.label ? n`<div class="baht-stat-label">${this.label}</div>` : h}
|
|
2633
|
-
<div class="baht-stat-value">${
|
|
2633
|
+
<div class="baht-stat-value">${Rt(this.value, this.format, this.currency)}</div>
|
|
2634
2634
|
${t ? n`<div class="baht-stat-delta baht-stat-delta--${e}">
|
|
2635
2635
|
<span class="baht-stat-arrow" aria-hidden="true">${this.arrow}</span>
|
|
2636
2636
|
<span class="baht-stat-delta-value">${this.deltaText}</span>
|
|
2637
2637
|
<span class="baht-visually-hidden">${i}</span>
|
|
2638
2638
|
${this.deltaLabel ? n`<span class="baht-stat-delta-label">${this.deltaLabel}</span>` : h}
|
|
2639
2639
|
</div>` : h}
|
|
2640
|
+
${!t && this.deltaLabel ? n`<div class="baht-stat-caption">${this.deltaLabel}</div>` : h}
|
|
2640
2641
|
${this.trend.length > 1 ? n`<baht-sparkline
|
|
2641
2642
|
class="baht-stat-trend"
|
|
2642
2643
|
.values=${this.trend}
|
|
@@ -2645,46 +2646,46 @@ let z = class extends $ {
|
|
|
2645
2646
|
</div>`;
|
|
2646
2647
|
}
|
|
2647
2648
|
};
|
|
2648
|
-
|
|
2649
|
+
X([
|
|
2649
2650
|
l()
|
|
2650
|
-
],
|
|
2651
|
-
|
|
2651
|
+
], K.prototype, "label", 2);
|
|
2652
|
+
X([
|
|
2652
2653
|
l({ type: Number })
|
|
2653
|
-
],
|
|
2654
|
-
|
|
2654
|
+
], K.prototype, "value", 2);
|
|
2655
|
+
X([
|
|
2655
2656
|
l()
|
|
2656
|
-
],
|
|
2657
|
-
|
|
2657
|
+
], K.prototype, "format", 2);
|
|
2658
|
+
X([
|
|
2658
2659
|
l()
|
|
2659
|
-
],
|
|
2660
|
-
|
|
2660
|
+
], K.prototype, "currency", 2);
|
|
2661
|
+
X([
|
|
2661
2662
|
l({ type: Number })
|
|
2662
|
-
],
|
|
2663
|
-
|
|
2663
|
+
], K.prototype, "delta", 2);
|
|
2664
|
+
X([
|
|
2664
2665
|
l({ attribute: "delta-kind" })
|
|
2665
|
-
],
|
|
2666
|
-
|
|
2666
|
+
], K.prototype, "deltaKind", 2);
|
|
2667
|
+
X([
|
|
2667
2668
|
l({ attribute: "delta-label" })
|
|
2668
|
-
],
|
|
2669
|
-
|
|
2669
|
+
], K.prototype, "deltaLabel", 2);
|
|
2670
|
+
X([
|
|
2670
2671
|
l({ type: Boolean, attribute: "up-is-good" })
|
|
2671
|
-
],
|
|
2672
|
-
|
|
2672
|
+
], K.prototype, "upIsGood", 2);
|
|
2673
|
+
X([
|
|
2673
2674
|
l({ type: Array })
|
|
2674
|
-
],
|
|
2675
|
-
|
|
2675
|
+
], K.prototype, "trend", 2);
|
|
2676
|
+
X([
|
|
2676
2677
|
l()
|
|
2677
|
-
],
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
],
|
|
2681
|
-
var
|
|
2682
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
2678
|
+
], K.prototype, "size", 2);
|
|
2679
|
+
K = X([
|
|
2680
|
+
b("baht-stat")
|
|
2681
|
+
], K);
|
|
2682
|
+
var Ua = Object.defineProperty, Ha = Object.getOwnPropertyDescriptor, Lt = (t, e, i, a) => {
|
|
2683
|
+
for (var s = a > 1 ? void 0 : a ? Ha(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2683
2684
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2684
|
-
return a && s &&
|
|
2685
|
+
return a && s && Ua(e, i, s), s;
|
|
2685
2686
|
};
|
|
2686
|
-
const
|
|
2687
|
-
let
|
|
2687
|
+
const Ze = 6;
|
|
2688
|
+
let J = class extends st {
|
|
2688
2689
|
constructor() {
|
|
2689
2690
|
super(...arguments), this.groups = [], this.total = null, this.color = "", this.centerLabel = "records", this.otherLabel = "Other";
|
|
2690
2691
|
}
|
|
@@ -2692,24 +2693,24 @@ let H = class extends Q {
|
|
|
2692
2693
|
const t = this.hold(this.groups ?? []);
|
|
2693
2694
|
if (t.length === 0)
|
|
2694
2695
|
return n`<div class=${this.rootClass("baht-donut-chart")}>${this.renderEmpty()}</div>`;
|
|
2695
|
-
const e =
|
|
2696
|
-
let
|
|
2697
|
-
const
|
|
2698
|
-
const
|
|
2696
|
+
const e = qa(t, Ze, this.otherLabel), i = e.reduce((p, P) => p + P.count, 0) || 1, a = this.total ?? t.reduce((p, P) => p + P.count, 0), s = J.R, r = 2 * Math.PI * s, o = e.length > 1 ? J.GAP : 0, c = t.length > Ze;
|
|
2697
|
+
let f = 0;
|
|
2698
|
+
const $ = e.map((p, P) => {
|
|
2699
|
+
const x = p.count / i, u = Math.max(0, x * r - o), v = {
|
|
2699
2700
|
...p,
|
|
2700
|
-
frac:
|
|
2701
|
-
dash: `${
|
|
2702
|
-
offset: -
|
|
2701
|
+
frac: x,
|
|
2702
|
+
dash: `${u} ${r - u}`,
|
|
2703
|
+
offset: -f * r,
|
|
2703
2704
|
// the folded tail is grey — never a generated ninth hue
|
|
2704
|
-
color: c &&
|
|
2705
|
+
color: c && P === e.length - 1 ? "var(--baht-chart-muted)" : ft(P, this.color || void 0)
|
|
2705
2706
|
};
|
|
2706
|
-
return
|
|
2707
|
-
}),
|
|
2707
|
+
return f += x, v;
|
|
2708
|
+
}), w = `${a} ${this.centerLabel}: ${$.map((p) => `${p.label || "(empty)"} ${p.count} (${Math.round(p.frac * 100)}%)`).join(", ")}`;
|
|
2708
2709
|
return n`<div class=${this.rootClass("baht-donut-chart")}>
|
|
2709
|
-
<svg width="160" height="160" viewBox="0 0 160 160" role="img" aria-label=${
|
|
2710
|
+
<svg width="160" height="160" viewBox="0 0 160 160" role="img" aria-label=${w}>
|
|
2710
2711
|
<g transform="translate(80,80) rotate(-90)">
|
|
2711
|
-
${
|
|
2712
|
-
(p) =>
|
|
2712
|
+
${$.map(
|
|
2713
|
+
(p) => L`<circle r=${s} cx="0" cy="0" fill="none" stroke=${p.color}
|
|
2713
2714
|
stroke-width="22" stroke-dasharray=${p.dash} stroke-dashoffset=${p.offset}/>`
|
|
2714
2715
|
)}
|
|
2715
2716
|
</g>
|
|
@@ -2717,7 +2718,7 @@ let H = class extends Q {
|
|
|
2717
2718
|
<text x="80" y="94" text-anchor="middle" class="baht-donut-chart-sub">${this.centerLabel}</text>
|
|
2718
2719
|
</svg>
|
|
2719
2720
|
<div class="baht-chart-legend">
|
|
2720
|
-
${
|
|
2721
|
+
${$.map(
|
|
2721
2722
|
(p) => n`<div class="baht-chart-legend-row">
|
|
2722
2723
|
<span class="baht-chart-swatch" style="background:${p.color}" aria-hidden="true"></span>
|
|
2723
2724
|
<span class="baht-chart-legend-label">${p.label || "(empty)"}</span>
|
|
@@ -2726,10 +2727,10 @@ let H = class extends Q {
|
|
|
2726
2727
|
</div>`
|
|
2727
2728
|
)}
|
|
2728
2729
|
</div>
|
|
2729
|
-
${this.showTable ?
|
|
2730
|
+
${this.showTable ? fe(
|
|
2730
2731
|
`${a} ${this.centerLabel}`,
|
|
2731
2732
|
["Slice", "Value", "Share"],
|
|
2732
|
-
|
|
2733
|
+
$.map((p) => [
|
|
2733
2734
|
p.label || "(empty)",
|
|
2734
2735
|
this.fmt(p.count),
|
|
2735
2736
|
`${Math.round(p.frac * 100)}%`
|
|
@@ -2738,35 +2739,60 @@ let H = class extends Q {
|
|
|
2738
2739
|
</div>`;
|
|
2739
2740
|
}
|
|
2740
2741
|
};
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2742
|
+
J.R = 54;
|
|
2743
|
+
J.GAP = 2;
|
|
2744
|
+
Lt([
|
|
2744
2745
|
l({ attribute: !1 })
|
|
2745
|
-
],
|
|
2746
|
-
|
|
2746
|
+
], J.prototype, "groups", 2);
|
|
2747
|
+
Lt([
|
|
2747
2748
|
l({ type: Number })
|
|
2748
|
-
],
|
|
2749
|
-
|
|
2749
|
+
], J.prototype, "total", 2);
|
|
2750
|
+
Lt([
|
|
2750
2751
|
l()
|
|
2751
|
-
],
|
|
2752
|
-
|
|
2752
|
+
], J.prototype, "color", 2);
|
|
2753
|
+
Lt([
|
|
2753
2754
|
l({ attribute: "center-label" })
|
|
2754
|
-
],
|
|
2755
|
-
|
|
2755
|
+
], J.prototype, "centerLabel", 2);
|
|
2756
|
+
Lt([
|
|
2756
2757
|
l({ attribute: "other-label" })
|
|
2757
|
-
],
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
],
|
|
2761
|
-
var
|
|
2762
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
2758
|
+
], J.prototype, "otherLabel", 2);
|
|
2759
|
+
J = Lt([
|
|
2760
|
+
b("baht-donut-chart")
|
|
2761
|
+
], J);
|
|
2762
|
+
var Ga = Object.defineProperty, Wa = Object.getOwnPropertyDescriptor, V = (t, e, i, a) => {
|
|
2763
|
+
for (var s = a > 1 ? void 0 : a ? Wa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2763
2764
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2764
|
-
return a && s &&
|
|
2765
|
+
return a && s && Ga(e, i, s), s;
|
|
2765
2766
|
};
|
|
2766
|
-
const
|
|
2767
|
-
let
|
|
2767
|
+
const Qe = 24, ts = 2, Ja = 56, Ya = 26;
|
|
2768
|
+
let z = class extends st {
|
|
2768
2769
|
constructor() {
|
|
2769
|
-
super(...arguments), this.groups = [], this.series = [], this.categories = [], this.orientation = "horizontal", this.stacked = !1, this.compare = [], this.markers = [], this.labelValues = "ends", this.emphasis = null, this.color = "", this.label = "";
|
|
2770
|
+
super(...arguments), this.groups = [], this.series = [], this.categories = [], this.orientation = "horizontal", this.stacked = !1, this.compare = [], this.compareLabel = "Previous period", this.markers = [], this.labelValues = "ends", this.emphasis = null, this.color = "", this.label = "", this.band = 0;
|
|
2771
|
+
}
|
|
2772
|
+
connectedCallback() {
|
|
2773
|
+
super.connectedCallback(), !(!S() || typeof ResizeObserver > "u") && (this.resizeObserver = new ResizeObserver(() => this.measure()), this.resizeObserver.observe(this));
|
|
2774
|
+
}
|
|
2775
|
+
disconnectedCallback() {
|
|
2776
|
+
var t;
|
|
2777
|
+
(t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = void 0, super.disconnectedCallback();
|
|
2778
|
+
}
|
|
2779
|
+
firstUpdated() {
|
|
2780
|
+
S() && queueMicrotask(() => this.measure());
|
|
2781
|
+
}
|
|
2782
|
+
/** Host width → px per category. Never runs on the server (`hasDom` guard). */
|
|
2783
|
+
measure() {
|
|
2784
|
+
var r;
|
|
2785
|
+
if (!S() || !this.isConnected || this.orientation !== "vertical") return;
|
|
2786
|
+
const t = this.columnCount;
|
|
2787
|
+
if (t === 0) return;
|
|
2788
|
+
const e = ((r = this.getBoundingClientRect) == null ? void 0 : r.call(this).width) ?? 0;
|
|
2789
|
+
if (!e) return;
|
|
2790
|
+
const a = (Math.max(0, e - Ja) - ts * (t - 1)) / t, s = a > 0 ? Math.floor(a * 100) / 100 : 0;
|
|
2791
|
+
Math.abs(s - this.band) > 0.01 && (this.band = s);
|
|
2792
|
+
}
|
|
2793
|
+
get columnCount() {
|
|
2794
|
+
const t = this.model.series;
|
|
2795
|
+
return t.length === 0 ? 0 : Math.max(...t.map((e) => e.values.length));
|
|
2770
2796
|
}
|
|
2771
2797
|
/** The series actually drawn — `groups` is normalised into one series. */
|
|
2772
2798
|
get model() {
|
|
@@ -2782,7 +2808,7 @@ let R = class extends Q {
|
|
|
2782
2808
|
}
|
|
2783
2809
|
colorFor(t, e, i) {
|
|
2784
2810
|
const a = this.model.series[t];
|
|
2785
|
-
return this.emphasis != null && !(i ? t === this.emphasis : e === this.emphasis) ? "var(--baht-chart-muted)" :
|
|
2811
|
+
return this.emphasis != null && !(i ? t === this.emphasis : e === this.emphasis) ? "var(--baht-chart-muted)" : ft(i ? t : 0, this.color || (a == null ? void 0 : a.color) || void 0);
|
|
2786
2812
|
}
|
|
2787
2813
|
render() {
|
|
2788
2814
|
const t = this.hold(this.model);
|
|
@@ -2792,7 +2818,7 @@ let R = class extends Q {
|
|
|
2792
2818
|
domainMax(t, e, i) {
|
|
2793
2819
|
const a = Math.max(...t.map((c) => c.values.length)), s = Array.from(
|
|
2794
2820
|
{ length: a },
|
|
2795
|
-
(c,
|
|
2821
|
+
(c, f) => e ? t.reduce(($, w) => $ + (w.values[f] ?? 0), 0) : Math.max(...t.map(($) => $.values[f] ?? 0))
|
|
2796
2822
|
), r = Math.max(
|
|
2797
2823
|
1,
|
|
2798
2824
|
...s,
|
|
@@ -2800,284 +2826,345 @@ let R = class extends Q {
|
|
|
2800
2826
|
...(this.markers ?? []).map((c) => c.value)
|
|
2801
2827
|
);
|
|
2802
2828
|
if (i) return r;
|
|
2803
|
-
const o =
|
|
2829
|
+
const o = Be(r, 4);
|
|
2804
2830
|
return o[o.length - 1] ?? r;
|
|
2805
2831
|
}
|
|
2806
2832
|
tableTwin(t, e, i) {
|
|
2807
|
-
var
|
|
2833
|
+
var r;
|
|
2808
2834
|
if (!this.showTable) return h;
|
|
2809
|
-
const a = ["Category", ...t.map((
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2835
|
+
const a = ["Category", ...t.map((o) => o.name || "Value")];
|
|
2836
|
+
(r = this.compare) != null && r.length && a.push(this.compareLabel);
|
|
2837
|
+
const s = Array.from({ length: i }, (o, c) => {
|
|
2838
|
+
var $;
|
|
2839
|
+
const f = [
|
|
2840
|
+
e[c] || "(empty)",
|
|
2841
|
+
...t.map((w) => this.fmt(w.values[c] ?? 0))
|
|
2842
|
+
];
|
|
2843
|
+
return ($ = this.compare) != null && $.length && f.push(this.fmt(this.compare[c] ?? 0)), f;
|
|
2844
|
+
});
|
|
2845
|
+
for (const o of this.markers ?? [])
|
|
2846
|
+
s.push([
|
|
2847
|
+
`${o.label ?? "Target"}${o.category ? ` (${o.category})` : ""}`,
|
|
2848
|
+
this.fmt(o.value),
|
|
2849
|
+
...Array.from({ length: a.length - 2 }, () => "—")
|
|
2850
|
+
]);
|
|
2851
|
+
return fe(this.label || "Bar chart data", a, s);
|
|
2822
2852
|
}
|
|
2823
2853
|
/** Markers with no `category` span the chart; the rest ride their own row. */
|
|
2824
2854
|
markersFor(t) {
|
|
2825
2855
|
return (this.markers ?? []).filter((e) => !e.category || e.category === t);
|
|
2826
2856
|
}
|
|
2857
|
+
/** Markers that apply to every row / column. */
|
|
2858
|
+
get chartMarkers() {
|
|
2859
|
+
return (this.markers ?? []).filter((t) => !t.category);
|
|
2860
|
+
}
|
|
2861
|
+
/** What a marker reads as: its own label, else its formatted value. */
|
|
2862
|
+
markerText(t) {
|
|
2863
|
+
return t.label ? `${t.label} ${this.fmt(t.value)}` : this.fmt(t.value);
|
|
2864
|
+
}
|
|
2865
|
+
/**
|
|
2866
|
+
* Marker lines, positioned along the value axis. The label is drawn separately
|
|
2867
|
+
* (`markerLabels`) as real text — a `title` attribute alone never reaches AT.
|
|
2868
|
+
*/
|
|
2827
2869
|
markerOverlay(t, e) {
|
|
2828
2870
|
return this.markersFor(e).map(
|
|
2829
2871
|
(i) => n`<span
|
|
2830
2872
|
class="baht-bar-chart-marker"
|
|
2831
2873
|
style=${`left:${Math.min(100, i.value / t * 100).toFixed(2)}%`}
|
|
2832
|
-
title=${i.label ?? this.fmt(i.value)}
|
|
2833
2874
|
aria-hidden="true"
|
|
2834
2875
|
></span>`
|
|
2835
2876
|
);
|
|
2836
2877
|
}
|
|
2878
|
+
/**
|
|
2879
|
+
* Marker labels, sorted along the axis and thinned so neighbours never collide:
|
|
2880
|
+
* a dropped label keeps its line, and its value still reads in the table twin.
|
|
2881
|
+
*/
|
|
2882
|
+
placedMarkers(t) {
|
|
2883
|
+
const e = [], i = [...this.chartMarkers].sort((a, s) => a.value - s.value);
|
|
2884
|
+
for (const a of i) {
|
|
2885
|
+
const s = Math.min(100, Math.max(0, a.value / t * 100)), r = e[e.length - 1];
|
|
2886
|
+
r && s - r.pct < 12 || e.push({ m: a, pct: s });
|
|
2887
|
+
}
|
|
2888
|
+
return e;
|
|
2889
|
+
}
|
|
2890
|
+
/** Legend rows: one per series, plus the muted `compare` key when it is set. */
|
|
2891
|
+
legendEntries(t) {
|
|
2892
|
+
const e = t.map((i, a) => ({
|
|
2893
|
+
label: i.name || "Value",
|
|
2894
|
+
color: ft(a, i.color)
|
|
2895
|
+
}));
|
|
2896
|
+
return (this.compare ?? []).length > 0 && e.push({ label: this.compareLabel, color: "var(--baht-chart-muted)" }), e;
|
|
2897
|
+
}
|
|
2837
2898
|
renderHorizontal(t) {
|
|
2838
|
-
const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((
|
|
2839
|
-
const
|
|
2840
|
-
value:
|
|
2841
|
-
color: this.colorFor(
|
|
2842
|
-
name:
|
|
2899
|
+
const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((P) => P.values.length)), o = this.domainMax(e, this.stacked, a), c = (this.compare ?? []).length > 0, f = (this.stacked ? 1 : e.length) + (c ? 1 : 0), $ = Math.min(Qe, Math.max(6, Math.floor(48 / f))), w = Array.from({ length: r }, (P, x) => {
|
|
2900
|
+
const u = i[x] || "(empty)", v = e.reduce((C, R) => C + (R.values[x] ?? 0), 0), D = `${u}: ${e.map((C) => `${C.name ? `${C.name} ` : ""}${this.fmt(C.values[x] ?? 0)}`).join(", ")}${c ? `, previous ${this.fmt(this.compare[x] ?? 0)}` : ""}`, G = e.map((C, R) => ({
|
|
2901
|
+
value: C.values[x] ?? 0,
|
|
2902
|
+
color: this.colorFor(R, x, s),
|
|
2903
|
+
name: C.name
|
|
2843
2904
|
}));
|
|
2844
2905
|
return n`<div class="baht-bar-chart-row">
|
|
2845
|
-
<span class="baht-bar-chart-label" title=${
|
|
2906
|
+
<span class="baht-bar-chart-label" title=${u}>${u}</span>
|
|
2846
2907
|
<div
|
|
2847
2908
|
class="baht-bar-chart-track${this.stacked ? " baht-bar-chart-track--stacked" : ""}"
|
|
2848
2909
|
tabindex="0"
|
|
2849
2910
|
role="button"
|
|
2850
|
-
aria-label=${
|
|
2851
|
-
@pointermove=${(
|
|
2911
|
+
aria-label=${D}
|
|
2912
|
+
@pointermove=${(C) => this.showTip(C, D)}
|
|
2852
2913
|
@pointerleave=${() => this.hideTip()}
|
|
2853
|
-
@focus=${(
|
|
2914
|
+
@focus=${(C) => this.showTip(C, D)}
|
|
2854
2915
|
@blur=${() => this.hideTip()}
|
|
2855
2916
|
>
|
|
2856
|
-
${this.markerOverlay(o,
|
|
2917
|
+
${this.markerOverlay(o, u)}
|
|
2857
2918
|
<div class="baht-bar-chart-bars">
|
|
2858
|
-
${this.stacked ? n`<div class="baht-bar-chart-stack" style=${`height:${
|
|
2859
|
-
${
|
|
2860
|
-
(
|
|
2919
|
+
${this.stacked ? n`<div class="baht-bar-chart-stack" style=${`height:${$}px`}>
|
|
2920
|
+
${G.map(
|
|
2921
|
+
(C) => n`<div
|
|
2861
2922
|
class="baht-bar-chart-bar baht-bar-chart-bar--segment"
|
|
2862
|
-
style=${`width:${Math.max(0,
|
|
2923
|
+
style=${`width:${Math.max(0, C.value / o * 100)}%;background:${C.color}`}
|
|
2863
2924
|
></div>`
|
|
2864
2925
|
)}
|
|
2865
|
-
</div>` :
|
|
2866
|
-
(
|
|
2926
|
+
</div>` : G.map(
|
|
2927
|
+
(C) => n`<div
|
|
2867
2928
|
class="baht-bar-chart-bar"
|
|
2868
|
-
style=${`width:${Math.max(2,
|
|
2929
|
+
style=${`width:${Math.max(2, C.value / o * 100)}%;height:${$}px;background:${C.color}`}
|
|
2869
2930
|
></div>`
|
|
2870
2931
|
)}
|
|
2871
2932
|
${c ? n`<div
|
|
2872
2933
|
class="baht-bar-chart-bar baht-bar-chart-bar--compare"
|
|
2873
|
-
style=${`width:${Math.max(2, (this.compare[
|
|
2934
|
+
style=${`width:${Math.max(2, (this.compare[x] ?? 0) / o * 100)}%;height:${Math.min(8, $)}px`}
|
|
2874
2935
|
></div>` : h}
|
|
2875
2936
|
</div>
|
|
2876
2937
|
</div>
|
|
2877
2938
|
${this.labelValues === "ends" ? n`<span class="baht-bar-chart-count"
|
|
2878
|
-
>${a ? e[0].values[
|
|
2939
|
+
>${a ? e[0].values[x] ?? 0 : this.fmt(this.stacked ? v : e[0].values[x] ?? 0)}</span
|
|
2879
2940
|
>` : h}
|
|
2880
2941
|
</div>`;
|
|
2881
|
-
});
|
|
2942
|
+
}), p = this.placedMarkers(o);
|
|
2882
2943
|
return n`<div class=${this.rootClass("baht-bar-chart")}>
|
|
2883
|
-
${
|
|
2944
|
+
${p.length > 0 ? n`<div class="baht-bar-chart-row baht-bar-chart-row--markers">
|
|
2945
|
+
<span class="baht-bar-chart-label"></span>
|
|
2946
|
+
<div class="baht-bar-chart-markbar">
|
|
2947
|
+
${p.map(
|
|
2948
|
+
({ m: P, pct: x }) => n`<span
|
|
2949
|
+
class="baht-bar-chart-marker-label"
|
|
2950
|
+
style=${`left:${x.toFixed(2)}%;transform:translateX(${x > 88 ? "-100%" : x < 12 ? "0" : "-50%"})`}
|
|
2951
|
+
>${this.markerText(P)}</span
|
|
2952
|
+
>`
|
|
2953
|
+
)}
|
|
2954
|
+
</div>
|
|
2955
|
+
${this.labelValues === "ends" ? n`<span class="baht-bar-chart-count"></span>` : h}
|
|
2956
|
+
</div>` : h}
|
|
2957
|
+
${w}
|
|
2884
2958
|
${this.renderTooltip()}
|
|
2885
|
-
${this.renderLegend(
|
|
2959
|
+
${this.renderLegend(this.legendEntries(e))}
|
|
2886
2960
|
${this.tableTwin(e, i, r)}
|
|
2887
2961
|
</div>`;
|
|
2888
2962
|
}
|
|
2889
2963
|
renderVertical(t) {
|
|
2890
|
-
const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((
|
|
2964
|
+
const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((v) => v.values.length)), o = this.domainMax(e, this.stacked, a), c = Be(o, 4), f = (this.compare ?? []).length > 0, $ = (this.stacked ? 1 : e.length) + (f ? 1 : 0), w = this.band > 0 ? (this.band - ts) / $ : 48 / $, p = Math.min(Qe, Math.max(2, Math.floor(w))), P = this.band > 0 ? Math.max(1, Math.ceil(Ya / Math.max(1, this.band))) : Math.max(1, Math.ceil(r / 12)), x = this.chartMarkers.map((v) => this.markerText(v)), u = this.label || `Column chart, ${r} categories. ${i.map((v, D) => `${v} ${this.fmt(e[0].values[D] ?? 0)}`).join(", ")}${x.length ? `. Reference lines: ${x.join(", ")}` : ""}`;
|
|
2891
2965
|
return n`<div class=${this.rootClass("baht-bar-chart baht-bar-chart--vertical")}>
|
|
2892
|
-
<div class="baht-bar-chart-plot" role="img" aria-label=${
|
|
2966
|
+
<div class="baht-bar-chart-plot" role="img" aria-label=${u}>
|
|
2893
2967
|
<div class="baht-bar-chart-yaxis" aria-hidden="true">
|
|
2894
|
-
${[...c].reverse().map((
|
|
2968
|
+
${[...c].reverse().map((v) => n`<span class="baht-chart-tick-text">${this.fmt(v)}</span>`)}
|
|
2895
2969
|
</div>
|
|
2896
2970
|
<div class="baht-bar-chart-grid">
|
|
2897
|
-
${
|
|
2898
|
-
(
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2971
|
+
${this.chartMarkers.map(
|
|
2972
|
+
(v) => n`<span
|
|
2973
|
+
class="baht-bar-chart-marker baht-bar-chart-marker--horizontal"
|
|
2974
|
+
style=${`bottom:${Math.min(100, v.value / o * 100).toFixed(2)}%`}
|
|
2975
|
+
aria-hidden="true"
|
|
2976
|
+
></span>`
|
|
2977
|
+
)}
|
|
2978
|
+
${this.placedMarkers(o).map(
|
|
2979
|
+
({ m: v, pct: D }) => n`<span
|
|
2980
|
+
class="baht-bar-chart-marker-label baht-bar-chart-marker-label--end"
|
|
2981
|
+
style=${`bottom:${D.toFixed(2)}%`}
|
|
2982
|
+
>${this.markerText(v)}</span
|
|
2983
|
+
>`
|
|
2904
2984
|
)}
|
|
2905
2985
|
${[...c].reverse().map(() => n`<span class="baht-chart-grid-rule" aria-hidden="true"></span>`)}
|
|
2906
2986
|
<div class="baht-bar-chart-columns">
|
|
2907
|
-
${Array.from({ length: r }, (
|
|
2908
|
-
const
|
|
2987
|
+
${Array.from({ length: r }, (v, D) => {
|
|
2988
|
+
const G = i[D] || "(empty)", C = `${G}: ${e.map((R) => `${R.name ? `${R.name} ` : ""}${this.fmt(R.values[D] ?? 0)}`).join(", ")}`;
|
|
2909
2989
|
return n`<div
|
|
2910
2990
|
class="baht-bar-chart-column"
|
|
2991
|
+
style=${this.band > 0 ? `flex:0 0 auto;width:${this.band}px` : h}
|
|
2911
2992
|
tabindex="0"
|
|
2912
2993
|
role="button"
|
|
2913
|
-
aria-label=${
|
|
2914
|
-
@pointermove=${(
|
|
2994
|
+
aria-label=${C}
|
|
2995
|
+
@pointermove=${(R) => this.showTip(R, C)}
|
|
2915
2996
|
@pointerleave=${() => this.hideTip()}
|
|
2916
|
-
@focus=${(
|
|
2997
|
+
@focus=${(R) => this.showTip(R, C)}
|
|
2917
2998
|
@blur=${() => this.hideTip()}
|
|
2918
2999
|
>
|
|
2919
3000
|
<div class="baht-bar-chart-column-bars">
|
|
2920
3001
|
${e.map(
|
|
2921
|
-
(
|
|
3002
|
+
(R, d) => n`<div
|
|
2922
3003
|
class="baht-bar-chart-col"
|
|
2923
|
-
style=${`height:${Math.max(1, (
|
|
3004
|
+
style=${`height:${Math.max(1, (R.values[D] ?? 0) / o * 100)}%;width:${p}px;background:${this.colorFor(d, D, s)}`}
|
|
2924
3005
|
></div>`
|
|
2925
3006
|
)}
|
|
2926
|
-
${
|
|
3007
|
+
${f ? n`<div
|
|
2927
3008
|
class="baht-bar-chart-col baht-bar-chart-col--compare"
|
|
2928
|
-
style=${`height:${Math.max(1, (this.compare[
|
|
3009
|
+
style=${`height:${Math.max(1, (this.compare[D] ?? 0) / o * 100)}%;width:${Math.min(8, p)}px`}
|
|
2929
3010
|
></div>` : h}
|
|
2930
3011
|
</div>
|
|
2931
|
-
|
|
3012
|
+
${D % P === 0 ? n`<span class="baht-bar-chart-xlabel">${G}</span>` : h}
|
|
2932
3013
|
</div>`;
|
|
2933
3014
|
})}
|
|
2934
3015
|
</div>
|
|
2935
3016
|
</div>
|
|
2936
3017
|
</div>
|
|
2937
3018
|
${this.renderTooltip()}
|
|
2938
|
-
${this.renderLegend(
|
|
3019
|
+
${this.renderLegend(this.legendEntries(e))}
|
|
2939
3020
|
${this.tableTwin(e, i, r)}
|
|
2940
3021
|
</div>`;
|
|
2941
3022
|
}
|
|
2942
3023
|
};
|
|
2943
|
-
|
|
3024
|
+
V([
|
|
2944
3025
|
l({ attribute: !1 })
|
|
2945
|
-
],
|
|
2946
|
-
|
|
3026
|
+
], z.prototype, "groups", 2);
|
|
3027
|
+
V([
|
|
2947
3028
|
l({ attribute: !1 })
|
|
2948
|
-
],
|
|
2949
|
-
|
|
3029
|
+
], z.prototype, "series", 2);
|
|
3030
|
+
V([
|
|
2950
3031
|
l({ attribute: !1 })
|
|
2951
|
-
],
|
|
2952
|
-
|
|
3032
|
+
], z.prototype, "categories", 2);
|
|
3033
|
+
V([
|
|
2953
3034
|
l()
|
|
2954
|
-
],
|
|
2955
|
-
|
|
3035
|
+
], z.prototype, "orientation", 2);
|
|
3036
|
+
V([
|
|
2956
3037
|
l({ type: Boolean })
|
|
2957
|
-
],
|
|
2958
|
-
|
|
3038
|
+
], z.prototype, "stacked", 2);
|
|
3039
|
+
V([
|
|
2959
3040
|
l({ attribute: !1 })
|
|
2960
|
-
],
|
|
2961
|
-
|
|
3041
|
+
], z.prototype, "compare", 2);
|
|
3042
|
+
V([
|
|
3043
|
+
l({ attribute: "compare-label" })
|
|
3044
|
+
], z.prototype, "compareLabel", 2);
|
|
3045
|
+
V([
|
|
2962
3046
|
l({ attribute: !1 })
|
|
2963
|
-
],
|
|
2964
|
-
|
|
3047
|
+
], z.prototype, "markers", 2);
|
|
3048
|
+
V([
|
|
2965
3049
|
l({ attribute: "label-values" })
|
|
2966
|
-
],
|
|
2967
|
-
|
|
3050
|
+
], z.prototype, "labelValues", 2);
|
|
3051
|
+
V([
|
|
2968
3052
|
l({ type: Number })
|
|
2969
|
-
],
|
|
2970
|
-
|
|
3053
|
+
], z.prototype, "emphasis", 2);
|
|
3054
|
+
V([
|
|
2971
3055
|
l()
|
|
2972
|
-
],
|
|
2973
|
-
|
|
3056
|
+
], z.prototype, "color", 2);
|
|
3057
|
+
V([
|
|
2974
3058
|
l()
|
|
2975
|
-
],
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
],
|
|
2979
|
-
|
|
2980
|
-
|
|
3059
|
+
], z.prototype, "label", 2);
|
|
3060
|
+
V([
|
|
3061
|
+
y()
|
|
3062
|
+
], z.prototype, "band", 2);
|
|
3063
|
+
z = V([
|
|
3064
|
+
b("baht-bar-chart")
|
|
3065
|
+
], z);
|
|
3066
|
+
var Xa = Object.defineProperty, Za = Object.getOwnPropertyDescriptor, nt = (t, e, i, a) => {
|
|
3067
|
+
for (var s = a > 1 ? void 0 : a ? Za(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
2981
3068
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
2982
|
-
return a && s &&
|
|
3069
|
+
return a && s && Xa(e, i, s), s;
|
|
2983
3070
|
};
|
|
2984
|
-
const
|
|
2985
|
-
let
|
|
3071
|
+
const es = 640, xe = 260, B = { top: 14, right: 72, bottom: 30, left: 60 };
|
|
3072
|
+
let et = class extends st {
|
|
2986
3073
|
constructor() {
|
|
2987
3074
|
super(...arguments), this.series = [], this.categories = [], this.area = !1, this.markers = [], this.forecast = 0, this.baseline = null, this.labelValues = "ends", this.label = "", this.crosshairAt = null;
|
|
2988
3075
|
}
|
|
2989
3076
|
get plot() {
|
|
2990
|
-
return { w:
|
|
3077
|
+
return { w: es - B.left - B.right, h: xe - B.top - B.bottom };
|
|
2991
3078
|
}
|
|
2992
3079
|
render() {
|
|
2993
3080
|
const t = this.hold({
|
|
2994
3081
|
series: (this.series ?? []).filter((d) => {
|
|
2995
|
-
var
|
|
2996
|
-
return d && ((
|
|
3082
|
+
var _;
|
|
3083
|
+
return d && ((_ = d.values) == null ? void 0 : _.length);
|
|
2997
3084
|
}),
|
|
2998
3085
|
categories: this.categories ?? []
|
|
2999
3086
|
}), { series: e, categories: i } = t;
|
|
3000
3087
|
if (e.length === 0)
|
|
3001
3088
|
return n`<div class=${this.rootClass("baht-line-chart")}>${this.renderEmpty()}</div>`;
|
|
3002
|
-
const a = Math.max(...e.map((d) => d.values.length)), s = e.flatMap((d) => d.values).filter((d) => Number.isFinite(d)), r = Math.max(0, ...s, ...(this.markers ?? []).map((d) => d.value)), o =
|
|
3003
|
-
i:
|
|
3089
|
+
const a = Math.max(...e.map((d) => d.values.length)), s = e.flatMap((d) => d.values).filter((d) => Number.isFinite(d)), r = Math.max(0, ...s, ...(this.markers ?? []).map((d) => d.value)), o = Be(r, 4), c = o[o.length - 1] ?? 1, { w: f, h: $ } = this.plot, w = ne([0, Math.max(1, a - 1)], [B.left, B.left + f]), p = ne([0, c], [B.top + $, B.top]), P = Math.max(0, a - 1 - Math.max(0, this.forecast)), x = (d, _, tt) => d.slice(_, tt + 1).map((at, it) => `${it === 0 ? "M" : "L"}${w(_ + it).toFixed(2)},${p(at).toFixed(2)}`).join(" "), u = e.map((d, _) => ({
|
|
3090
|
+
i: _,
|
|
3004
3091
|
name: d.name,
|
|
3005
3092
|
value: d.values[d.values.length - 1] ?? 0,
|
|
3006
3093
|
yPos: p(d.values[d.values.length - 1] ?? 0),
|
|
3007
|
-
color:
|
|
3008
|
-
})),
|
|
3094
|
+
color: ft(_, d.color)
|
|
3095
|
+
})), v = [...u].sort((d, _) => d.yPos - _.yPos), D = v.some((d, _) => _ > 0 && d.yPos - v[_ - 1].yPos < 15), G = this.labelValues === "ends" && !D, C = Math.max(1, Math.ceil(a / 8)), R = this.label || `Line chart, ${e.length} series over ${a} points. ${e.map((d, _) => `${d.name}: ${this.fmt(u[_].value)} at the end`).join(". ")}`;
|
|
3009
3096
|
return n`<div class=${this.rootClass("baht-line-chart")}>
|
|
3010
3097
|
<svg
|
|
3011
3098
|
class="baht-chart-svg"
|
|
3012
|
-
viewBox="0 0 ${
|
|
3099
|
+
viewBox="0 0 ${es} ${xe}"
|
|
3013
3100
|
preserveAspectRatio="xMidYMid meet"
|
|
3014
3101
|
role="img"
|
|
3015
|
-
aria-label=${
|
|
3102
|
+
aria-label=${R}
|
|
3016
3103
|
>
|
|
3017
3104
|
${o.map(
|
|
3018
|
-
(d) =>
|
|
3019
|
-
<line class="baht-chart-grid-line" x1=${B.left} x2=${B.left +
|
|
3105
|
+
(d) => L`
|
|
3106
|
+
<line class="baht-chart-grid-line" x1=${B.left} x2=${B.left + f}
|
|
3020
3107
|
y1=${p(d).toFixed(2)} y2=${p(d).toFixed(2)}/>
|
|
3021
3108
|
<text class="baht-chart-tick" x=${B.left - 8} y=${(p(d) + 4).toFixed(2)}
|
|
3022
3109
|
text-anchor="end">${this.fmt(d)}</text>`
|
|
3023
3110
|
)}
|
|
3024
3111
|
${this.baseline != null ? [
|
|
3025
|
-
|
|
3112
|
+
L`<line class="baht-chart-baseline" x1=${B.left} x2=${B.left + f}
|
|
3026
3113
|
y1=${p(this.baseline).toFixed(2)} y2=${p(this.baseline).toFixed(2)}/>`
|
|
3027
3114
|
] : []}
|
|
3028
3115
|
${(this.markers ?? []).map(
|
|
3029
|
-
(d) =>
|
|
3030
|
-
<line class="baht-chart-marker-line" x1=${B.left} x2=${B.left +
|
|
3116
|
+
(d) => L`
|
|
3117
|
+
<line class="baht-chart-marker-line" x1=${B.left} x2=${B.left + f}
|
|
3031
3118
|
y1=${p(d.value).toFixed(2)} y2=${p(d.value).toFixed(2)}/>
|
|
3032
|
-
<text class="baht-chart-marker-label" x=${B.left +
|
|
3119
|
+
<text class="baht-chart-marker-label" x=${B.left + f} y=${(p(d.value) - 5).toFixed(2)}
|
|
3033
3120
|
text-anchor="end">${d.label ?? this.fmt(d.value)}</text>`
|
|
3034
3121
|
)}
|
|
3035
|
-
${this.area && e.length === 1 ?
|
|
3036
|
-
d=${`${
|
|
3037
|
-
${e.map((d,
|
|
3038
|
-
const
|
|
3039
|
-
|
|
3122
|
+
${this.area && e.length === 1 ? L`<path class="baht-chart-area" fill=${ft(0, e[0].color)}
|
|
3123
|
+
d=${`${x(e[0].values, 0, a - 1)} L${w(a - 1).toFixed(2)},${p(0).toFixed(2)} L${w(0).toFixed(2)},${p(0).toFixed(2)} Z`}/>` : h}
|
|
3124
|
+
${e.map((d, _) => {
|
|
3125
|
+
const tt = ft(_, d.color), at = [
|
|
3126
|
+
L`<path class="baht-chart-line" d=${x(d.values, 0, P)} stroke=${tt} fill="none"/>`
|
|
3040
3127
|
];
|
|
3041
|
-
return
|
|
3042
|
-
|
|
3043
|
-
stroke=${
|
|
3044
|
-
),
|
|
3045
|
-
|
|
3046
|
-
cy=${p(d.values[d.values.length - 1] ?? 0).toFixed(2)} r="4" fill=${
|
|
3047
|
-
),
|
|
3128
|
+
return P < a - 1 && at.push(
|
|
3129
|
+
L`<path class="baht-chart-line baht-chart-line--forecast" d=${x(d.values, P, a - 1)}
|
|
3130
|
+
stroke=${tt} fill="none"/>`
|
|
3131
|
+
), at.push(
|
|
3132
|
+
L`<circle class="baht-chart-end-dot" cx=${w(a - 1).toFixed(2)}
|
|
3133
|
+
cy=${p(d.values[d.values.length - 1] ?? 0).toFixed(2)} r="4" fill=${tt}/>`
|
|
3134
|
+
), at;
|
|
3048
3135
|
})}
|
|
3049
|
-
${
|
|
3050
|
-
(d) =>
|
|
3051
|
-
<text class="baht-chart-end-label" x=${
|
|
3136
|
+
${G ? u.map(
|
|
3137
|
+
(d) => L`
|
|
3138
|
+
<text class="baht-chart-end-label" x=${w(a - 1) + 10} y=${(d.yPos + 4).toFixed(2)}
|
|
3052
3139
|
text-anchor="start">${this.fmt(d.value)}</text>`
|
|
3053
3140
|
) : h}
|
|
3054
3141
|
${i.map(
|
|
3055
|
-
(d,
|
|
3142
|
+
(d, _) => _ % C === 0 ? L`<text class="baht-chart-tick" x=${w(_).toFixed(2)} y=${xe - 10} text-anchor="middle">${d}</text>` : h
|
|
3056
3143
|
)}
|
|
3057
|
-
${Array.from({ length: a }, (d,
|
|
3058
|
-
const
|
|
3059
|
-
return
|
|
3060
|
-
width=${Math.max(24,
|
|
3061
|
-
aria-label=${
|
|
3062
|
-
@pointermove=${(
|
|
3144
|
+
${Array.from({ length: a }, (d, _) => {
|
|
3145
|
+
const tt = f / Math.max(1, a - 1), at = `${i[_] ?? `Point ${_ + 1}`}: ${e.map((it) => `${it.name} ${this.fmt(it.values[_] ?? 0)}`).join(", ")}`;
|
|
3146
|
+
return L`<rect class="baht-chart-hit" x=${(w(_) - tt / 2).toFixed(2)} y=${B.top}
|
|
3147
|
+
width=${Math.max(24, tt).toFixed(2)} height=${$} tabindex="0" role="button"
|
|
3148
|
+
aria-label=${at}
|
|
3149
|
+
@pointermove=${(it) => this.onHover(it, _, at)}
|
|
3063
3150
|
@pointerleave=${() => this.onLeave()}
|
|
3064
|
-
@focus=${(
|
|
3151
|
+
@focus=${(it) => this.onHover(it, _, at)}
|
|
3065
3152
|
@blur=${() => this.onLeave()}/>`;
|
|
3066
3153
|
})}
|
|
3067
|
-
${this.crosshairAt != null ?
|
|
3068
|
-
x2=${
|
|
3154
|
+
${this.crosshairAt != null ? L`<line class="baht-chart-crosshair" x1=${w(this.crosshairAt).toFixed(2)}
|
|
3155
|
+
x2=${w(this.crosshairAt).toFixed(2)} y1=${B.top} y2=${B.top + $}/>` : h}
|
|
3069
3156
|
</svg>
|
|
3070
3157
|
${this.renderTooltip()}
|
|
3071
3158
|
${this.renderLegend(
|
|
3072
|
-
e.map((d,
|
|
3159
|
+
e.map((d, _) => ({ label: d.name, color: ft(_, d.color) })),
|
|
3073
3160
|
"line"
|
|
3074
3161
|
)}
|
|
3075
|
-
${this.showTable ?
|
|
3162
|
+
${this.showTable ? fe(
|
|
3076
3163
|
this.label || "Line chart data",
|
|
3077
3164
|
["Point", ...e.map((d) => d.name)],
|
|
3078
|
-
Array.from({ length: a }, (d,
|
|
3079
|
-
i[
|
|
3080
|
-
...e.map((
|
|
3165
|
+
Array.from({ length: a }, (d, _) => [
|
|
3166
|
+
i[_] ?? `Point ${_ + 1}`,
|
|
3167
|
+
...e.map((tt) => this.fmt(tt.values[_] ?? 0))
|
|
3081
3168
|
])
|
|
3082
3169
|
) : h}
|
|
3083
3170
|
</div>`;
|
|
@@ -3089,85 +3176,85 @@ let Z = class extends Q {
|
|
|
3089
3176
|
this.crosshairAt = null, this.requestUpdate(), this.hideTip();
|
|
3090
3177
|
}
|
|
3091
3178
|
};
|
|
3092
|
-
|
|
3179
|
+
nt([
|
|
3093
3180
|
l({ attribute: !1 })
|
|
3094
|
-
],
|
|
3095
|
-
|
|
3181
|
+
], et.prototype, "series", 2);
|
|
3182
|
+
nt([
|
|
3096
3183
|
l({ attribute: !1 })
|
|
3097
|
-
],
|
|
3098
|
-
|
|
3184
|
+
], et.prototype, "categories", 2);
|
|
3185
|
+
nt([
|
|
3099
3186
|
l({ type: Boolean })
|
|
3100
|
-
],
|
|
3101
|
-
|
|
3187
|
+
], et.prototype, "area", 2);
|
|
3188
|
+
nt([
|
|
3102
3189
|
l({ attribute: !1 })
|
|
3103
|
-
],
|
|
3104
|
-
|
|
3190
|
+
], et.prototype, "markers", 2);
|
|
3191
|
+
nt([
|
|
3105
3192
|
l({ type: Number })
|
|
3106
|
-
],
|
|
3107
|
-
|
|
3193
|
+
], et.prototype, "forecast", 2);
|
|
3194
|
+
nt([
|
|
3108
3195
|
l({ type: Number })
|
|
3109
|
-
],
|
|
3110
|
-
|
|
3196
|
+
], et.prototype, "baseline", 2);
|
|
3197
|
+
nt([
|
|
3111
3198
|
l({ attribute: "label-values" })
|
|
3112
|
-
],
|
|
3113
|
-
|
|
3199
|
+
], et.prototype, "labelValues", 2);
|
|
3200
|
+
nt([
|
|
3114
3201
|
l()
|
|
3115
|
-
],
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
],
|
|
3119
|
-
var
|
|
3120
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
3202
|
+
], et.prototype, "label", 2);
|
|
3203
|
+
et = nt([
|
|
3204
|
+
b("baht-line-chart")
|
|
3205
|
+
], et);
|
|
3206
|
+
var Qa = Object.defineProperty, ti = Object.getOwnPropertyDescriptor, xt = (t, e, i, a) => {
|
|
3207
|
+
for (var s = a > 1 ? void 0 : a ? ti(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
3121
3208
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
3122
|
-
return a && s &&
|
|
3209
|
+
return a && s && Qa(e, i, s), s;
|
|
3123
3210
|
};
|
|
3124
|
-
const
|
|
3125
|
-
function
|
|
3211
|
+
const _e = 22, qt = 24, ss = 34, ke = 18, ei = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
3212
|
+
function Pe(t) {
|
|
3126
3213
|
const e = /^(\d{4})-(\d{2})-(\d{2})/.exec(t ?? "");
|
|
3127
3214
|
return e ? new Date(Date.UTC(+e[1], +e[2] - 1, +e[3])) : null;
|
|
3128
3215
|
}
|
|
3129
|
-
function
|
|
3216
|
+
function Oe(t) {
|
|
3130
3217
|
return t.toISOString().slice(0, 10);
|
|
3131
3218
|
}
|
|
3132
|
-
let
|
|
3219
|
+
let pt = class extends st {
|
|
3133
3220
|
constructor() {
|
|
3134
3221
|
super(...arguments), this.values = [], this.from = "", this.to = "", this.lessLabel = "Less", this.moreLabel = "More", this.label = "";
|
|
3135
3222
|
}
|
|
3136
3223
|
get range() {
|
|
3137
|
-
const t = (this.values ?? []).map((a) =>
|
|
3224
|
+
const t = (this.values ?? []).map((a) => Pe(a.date)).filter((a) => !!a), e = Pe(this.from) ?? (t.length ? new Date(Math.min(...t.map((a) => +a))) : null), i = Pe(this.to) ?? (t.length ? new Date(Math.max(...t.map((a) => +a))) : null);
|
|
3138
3225
|
return !e || !i || +i < +e ? null : { start: e, end: i };
|
|
3139
3226
|
}
|
|
3140
3227
|
render() {
|
|
3141
3228
|
const t = this.hold({ values: this.values ?? [], range: this.range }), e = t.range;
|
|
3142
3229
|
if (!e || t.values.length === 0)
|
|
3143
3230
|
return n`<div class=${this.rootClass("baht-heatmap")}>${this.renderEmpty()}</div>`;
|
|
3144
|
-
const i = new Map(t.values.map((
|
|
3231
|
+
const i = new Map(t.values.map((u) => [u.date.slice(0, 10), u.value])), a = [], s = new Date(e.start), r = (e.start.getUTCDay() + 6) % 7;
|
|
3145
3232
|
let o = 0;
|
|
3146
3233
|
for (; +s <= +e.end; ) {
|
|
3147
|
-
const
|
|
3148
|
-
a.push({ iso:
|
|
3234
|
+
const u = Oe(s), v = (s.getUTCDay() + 6) % 7, D = Math.floor((r + o) / 7);
|
|
3235
|
+
a.push({ iso: u, value: i.has(u) ? i.get(u) : null, col: D, row: v }), s.setUTCDate(s.getUTCDate() + 1), o += 1;
|
|
3149
3236
|
}
|
|
3150
|
-
const c = Math.max(1, ...a.map((
|
|
3237
|
+
const c = Math.max(1, ...a.map((u) => u.col + 1)), f = ss + c * qt, $ = ke + 7 * qt + 4, w = Math.max(1, ...a.map((u) => u.value ?? 0)), p = (u) => Math.min(4, Math.max(0, Math.ceil(u / w * 5) - 1)), P = a.reduce((u, v) => u + (v.value ?? 0), 0), x = this.label || `Calendar heatmap, ${a.length} days from ${Oe(e.start)} to ${Oe(e.end)}, total ${this.fmt(P)}`;
|
|
3151
3238
|
return n`<div class=${this.rootClass("baht-heatmap")}>
|
|
3152
3239
|
<svg
|
|
3153
3240
|
class="baht-chart-svg baht-heatmap-svg"
|
|
3154
|
-
width=${
|
|
3155
|
-
height=${
|
|
3156
|
-
viewBox="0 0 ${
|
|
3241
|
+
width=${f}
|
|
3242
|
+
height=${$}
|
|
3243
|
+
viewBox="0 0 ${f} ${$}"
|
|
3157
3244
|
preserveAspectRatio="xMinYMin meet"
|
|
3158
3245
|
role="img"
|
|
3159
|
-
aria-label=${
|
|
3246
|
+
aria-label=${x}
|
|
3160
3247
|
>
|
|
3161
|
-
${
|
|
3162
|
-
(
|
|
3248
|
+
${ei.map(
|
|
3249
|
+
(u, v) => v % 2 === 0 ? L`<text class="baht-chart-tick" x="0" y=${ke + v * qt + _e / 2 + 4}>${u}</text>` : h
|
|
3163
3250
|
)}
|
|
3164
|
-
${a.map((
|
|
3165
|
-
const
|
|
3166
|
-
return
|
|
3167
|
-
width=${
|
|
3168
|
-
@pointermove=${(
|
|
3251
|
+
${a.map((u) => {
|
|
3252
|
+
const v = u.value == null ? `${u.iso}: no activity` : `${u.iso}: ${this.fmt(u.value)}`, D = u.value == null || u.value <= 0 ? "var(--baht-chart-grid)" : Xe(p(u.value));
|
|
3253
|
+
return L`<rect class="baht-heatmap-cell" x=${ss + u.col * qt} y=${ke + u.row * qt}
|
|
3254
|
+
width=${_e} height=${_e} rx="3" fill=${D} tabindex="0" role="button" aria-label=${v}
|
|
3255
|
+
@pointermove=${(G) => this.showTip(G, v)}
|
|
3169
3256
|
@pointerleave=${() => this.hideTip()}
|
|
3170
|
-
@focus=${(
|
|
3257
|
+
@focus=${(G) => this.showTip(G, v)}
|
|
3171
3258
|
@blur=${() => this.hideTip()}/>`;
|
|
3172
3259
|
})}
|
|
3173
3260
|
</svg>
|
|
@@ -3175,73 +3262,79 @@ let ct = class extends Q {
|
|
|
3175
3262
|
<div class="baht-heatmap-scale">
|
|
3176
3263
|
<span class="baht-heatmap-scale-label">${this.lessLabel}</span>
|
|
3177
3264
|
${[0, 1, 2, 3, 4].map(
|
|
3178
|
-
(
|
|
3265
|
+
(u) => n`<span
|
|
3179
3266
|
class="baht-chart-swatch"
|
|
3180
|
-
style=${`background:${
|
|
3267
|
+
style=${`background:${Xe(u)}`}
|
|
3181
3268
|
aria-hidden="true"
|
|
3182
3269
|
></span>`
|
|
3183
3270
|
)}
|
|
3184
3271
|
<span class="baht-heatmap-scale-label">${this.moreLabel}</span>
|
|
3185
3272
|
</div>
|
|
3186
|
-
${this.showTable ?
|
|
3273
|
+
${this.showTable ? fe(
|
|
3187
3274
|
this.label || "Calendar heatmap data",
|
|
3188
3275
|
["Date", "Value"],
|
|
3189
|
-
a.map((
|
|
3276
|
+
a.map((u) => [u.iso, u.value == null ? "—" : this.fmt(u.value)])
|
|
3190
3277
|
) : h}
|
|
3191
3278
|
</div>`;
|
|
3192
3279
|
}
|
|
3193
3280
|
};
|
|
3194
|
-
|
|
3281
|
+
xt([
|
|
3195
3282
|
l({ attribute: !1 })
|
|
3196
|
-
],
|
|
3197
|
-
|
|
3283
|
+
], pt.prototype, "values", 2);
|
|
3284
|
+
xt([
|
|
3198
3285
|
l()
|
|
3199
|
-
],
|
|
3200
|
-
|
|
3286
|
+
], pt.prototype, "from", 2);
|
|
3287
|
+
xt([
|
|
3201
3288
|
l()
|
|
3202
|
-
],
|
|
3203
|
-
|
|
3289
|
+
], pt.prototype, "to", 2);
|
|
3290
|
+
xt([
|
|
3204
3291
|
l({ attribute: "less-label" })
|
|
3205
|
-
],
|
|
3206
|
-
|
|
3292
|
+
], pt.prototype, "lessLabel", 2);
|
|
3293
|
+
xt([
|
|
3207
3294
|
l({ attribute: "more-label" })
|
|
3208
|
-
],
|
|
3209
|
-
|
|
3295
|
+
], pt.prototype, "moreLabel", 2);
|
|
3296
|
+
xt([
|
|
3210
3297
|
l()
|
|
3211
|
-
],
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
],
|
|
3215
|
-
var
|
|
3216
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
3298
|
+
], pt.prototype, "label", 2);
|
|
3299
|
+
pt = xt([
|
|
3300
|
+
b("baht-heatmap")
|
|
3301
|
+
], pt);
|
|
3302
|
+
var si = Object.defineProperty, ai = Object.getOwnPropertyDescriptor, Z = (t, e, i, a) => {
|
|
3303
|
+
for (var s = a > 1 ? void 0 : a ? ai(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
3217
3304
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
3218
|
-
return a && s &&
|
|
3305
|
+
return a && s && si(e, i, s), s;
|
|
3219
3306
|
};
|
|
3220
|
-
let
|
|
3307
|
+
let U = class extends g {
|
|
3221
3308
|
constructor() {
|
|
3222
|
-
super(...arguments), this.value = 0, this.max = 100, this.label = "", this.format = "number", this.currency = "THB", this.thresholds = { warning: 0.8, danger: 1 }, this.expected = null, this.overLabel = "Over budget", this.nearLabel = "Near limit";
|
|
3309
|
+
super(...arguments), this.value = 0, this.max = 100, this.label = "", this.format = "number", this.currency = "THB", this.thresholds = { warning: 0.8, danger: 1 }, this.expected = null, this.overLabel = "Over budget", this.atLabel = "At budget", this.nearLabel = "Near limit";
|
|
3223
3310
|
}
|
|
3224
3311
|
get fraction() {
|
|
3225
3312
|
const t = this.max || 1, e = this.value / t;
|
|
3226
3313
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
3227
3314
|
}
|
|
3228
|
-
/**
|
|
3315
|
+
/**
|
|
3316
|
+
* `ok` | `warning` | `danger`, from the fraction and the thresholds. `danger` is
|
|
3317
|
+
* strictly **above** its threshold: spending exactly the budget is not
|
|
3318
|
+
* overspending, so it reads as the warning tone with an "At budget" status.
|
|
3319
|
+
* `warning` stays inclusive (`>=`).
|
|
3320
|
+
*/
|
|
3229
3321
|
get severity() {
|
|
3230
3322
|
const { warning: t, danger: e } = this.thresholds ?? { warning: 0.8, danger: 1 }, i = this.fraction;
|
|
3231
|
-
return i
|
|
3323
|
+
return i > e ? "danger" : i >= t ? "warning" : "ok";
|
|
3232
3324
|
}
|
|
3233
3325
|
get statusText() {
|
|
3234
|
-
const t = this.severity;
|
|
3235
|
-
return
|
|
3326
|
+
const { danger: t } = this.thresholds ?? { danger: 1 }, e = this.severity;
|
|
3327
|
+
return e === "danger" ? this.overLabel : e === "warning" ? this.fraction >= t ? this.atLabel : this.nearLabel : "";
|
|
3236
3328
|
}
|
|
3237
3329
|
render() {
|
|
3238
|
-
|
|
3330
|
+
var c;
|
|
3331
|
+
const t = this.severity, e = Math.min(100, this.fraction * 100), i = (f) => Rt(f, this.format, this.currency), a = this.expected != null && Number.isFinite(this.expected) && this.max ? Math.min(100, Math.max(0, this.expected / this.max * 100)) : null, s = `${i(this.value)} of ${i(this.max)}`, r = t === "warning" && this.fraction >= (((c = this.thresholds) == null ? void 0 : c.danger) ?? 1), o = t === "danger" ? "!" : r ? "=" : t === "warning" ? "△" : "";
|
|
3239
3332
|
return n`<div class="baht-meter baht-meter--${t}">
|
|
3240
3333
|
<div class="baht-meter-head">
|
|
3241
3334
|
${this.label ? n`<span class="baht-meter-label">${this.label}</span>` : h}
|
|
3242
3335
|
<span class="baht-meter-value">${s}</span>
|
|
3243
3336
|
${this.statusText ? n`<span class="baht-meter-status"
|
|
3244
|
-
><span class="baht-meter-icon" aria-hidden="true">${
|
|
3337
|
+
><span class="baht-meter-icon" aria-hidden="true">${o}</span
|
|
3245
3338
|
>${this.statusText}</span
|
|
3246
3339
|
>` : h}
|
|
3247
3340
|
</div>
|
|
@@ -3265,42 +3358,45 @@ let G = class extends $ {
|
|
|
3265
3358
|
</div>`;
|
|
3266
3359
|
}
|
|
3267
3360
|
};
|
|
3268
|
-
|
|
3361
|
+
Z([
|
|
3269
3362
|
l({ type: Number })
|
|
3270
|
-
],
|
|
3271
|
-
|
|
3363
|
+
], U.prototype, "value", 2);
|
|
3364
|
+
Z([
|
|
3272
3365
|
l({ type: Number })
|
|
3273
|
-
],
|
|
3274
|
-
|
|
3366
|
+
], U.prototype, "max", 2);
|
|
3367
|
+
Z([
|
|
3275
3368
|
l()
|
|
3276
|
-
],
|
|
3277
|
-
|
|
3369
|
+
], U.prototype, "label", 2);
|
|
3370
|
+
Z([
|
|
3278
3371
|
l()
|
|
3279
|
-
],
|
|
3280
|
-
|
|
3372
|
+
], U.prototype, "format", 2);
|
|
3373
|
+
Z([
|
|
3281
3374
|
l()
|
|
3282
|
-
],
|
|
3283
|
-
|
|
3375
|
+
], U.prototype, "currency", 2);
|
|
3376
|
+
Z([
|
|
3284
3377
|
l({ attribute: !1 })
|
|
3285
|
-
],
|
|
3286
|
-
|
|
3378
|
+
], U.prototype, "thresholds", 2);
|
|
3379
|
+
Z([
|
|
3287
3380
|
l({ type: Number })
|
|
3288
|
-
],
|
|
3289
|
-
|
|
3381
|
+
], U.prototype, "expected", 2);
|
|
3382
|
+
Z([
|
|
3290
3383
|
l({ attribute: "over-label" })
|
|
3291
|
-
],
|
|
3292
|
-
|
|
3384
|
+
], U.prototype, "overLabel", 2);
|
|
3385
|
+
Z([
|
|
3386
|
+
l({ attribute: "at-label" })
|
|
3387
|
+
], U.prototype, "atLabel", 2);
|
|
3388
|
+
Z([
|
|
3293
3389
|
l({ attribute: "near-label" })
|
|
3294
|
-
],
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
],
|
|
3298
|
-
var
|
|
3299
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
3390
|
+
], U.prototype, "nearLabel", 2);
|
|
3391
|
+
U = Z([
|
|
3392
|
+
b("baht-meter")
|
|
3393
|
+
], U);
|
|
3394
|
+
var ii = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, me = (t, e, i, a) => {
|
|
3395
|
+
for (var s = a > 1 ? void 0 : a ? ri(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
3300
3396
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
3301
|
-
return a && s &&
|
|
3397
|
+
return a && s && ii(e, i, s), s;
|
|
3302
3398
|
};
|
|
3303
|
-
let
|
|
3399
|
+
let Gt = class extends g {
|
|
3304
3400
|
constructor() {
|
|
3305
3401
|
super(...arguments), this.icon = "🗂️", this.message = "Nothing to display", this.hint = "";
|
|
3306
3402
|
}
|
|
@@ -3312,24 +3408,24 @@ let Ht = class extends $ {
|
|
|
3312
3408
|
</div>`;
|
|
3313
3409
|
}
|
|
3314
3410
|
};
|
|
3315
|
-
|
|
3411
|
+
me([
|
|
3316
3412
|
l()
|
|
3317
|
-
],
|
|
3318
|
-
|
|
3413
|
+
], Gt.prototype, "icon", 2);
|
|
3414
|
+
me([
|
|
3319
3415
|
l()
|
|
3320
|
-
],
|
|
3321
|
-
|
|
3416
|
+
], Gt.prototype, "message", 2);
|
|
3417
|
+
me([
|
|
3322
3418
|
l()
|
|
3323
|
-
],
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
],
|
|
3327
|
-
var
|
|
3328
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
3419
|
+
], Gt.prototype, "hint", 2);
|
|
3420
|
+
Gt = me([
|
|
3421
|
+
b("baht-empty-state")
|
|
3422
|
+
], Gt);
|
|
3423
|
+
var oi = Object.defineProperty, li = Object.getOwnPropertyDescriptor, te = (t, e, i, a) => {
|
|
3424
|
+
for (var s = a > 1 ? void 0 : a ? li(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
3329
3425
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
3330
|
-
return a && s &&
|
|
3426
|
+
return a && s && oi(e, i, s), s;
|
|
3331
3427
|
};
|
|
3332
|
-
let
|
|
3428
|
+
let Bt = class extends g {
|
|
3333
3429
|
constructor() {
|
|
3334
3430
|
super(...arguments), this.icon = "⚠️", this.heading = "Something went wrong", this.message = "", this.retryLabel = "";
|
|
3335
3431
|
}
|
|
@@ -3345,27 +3441,27 @@ let Ft = class extends $ {
|
|
|
3345
3441
|
</div>`;
|
|
3346
3442
|
}
|
|
3347
3443
|
};
|
|
3348
|
-
|
|
3444
|
+
te([
|
|
3349
3445
|
l()
|
|
3350
|
-
],
|
|
3351
|
-
|
|
3446
|
+
], Bt.prototype, "icon", 2);
|
|
3447
|
+
te([
|
|
3352
3448
|
l()
|
|
3353
|
-
],
|
|
3354
|
-
|
|
3449
|
+
], Bt.prototype, "heading", 2);
|
|
3450
|
+
te([
|
|
3355
3451
|
l()
|
|
3356
|
-
],
|
|
3357
|
-
|
|
3452
|
+
], Bt.prototype, "message", 2);
|
|
3453
|
+
te([
|
|
3358
3454
|
l({ attribute: "retry-label" })
|
|
3359
|
-
],
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
],
|
|
3363
|
-
var
|
|
3364
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
3455
|
+
], Bt.prototype, "retryLabel", 2);
|
|
3456
|
+
Bt = te([
|
|
3457
|
+
b("baht-error-state")
|
|
3458
|
+
], Bt);
|
|
3459
|
+
var ni = Object.defineProperty, hi = Object.getOwnPropertyDescriptor, _t = (t, e, i, a) => {
|
|
3460
|
+
for (var s = a > 1 ? void 0 : a ? hi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
3365
3461
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
3366
|
-
return a && s &&
|
|
3462
|
+
return a && s && ni(e, i, s), s;
|
|
3367
3463
|
};
|
|
3368
|
-
let
|
|
3464
|
+
let dt = class extends g {
|
|
3369
3465
|
constructor() {
|
|
3370
3466
|
super(...arguments), this.value = {}, this.keyPlaceholder = "key", this.valuePlaceholder = "value", this.add_label = "Add row", this.disabled = !1, this.rows = [{ k: "", v: "" }], this.syncedJson = "";
|
|
3371
3467
|
}
|
|
@@ -3422,7 +3518,7 @@ let pt = class extends $ {
|
|
|
3422
3518
|
aria-label="Remove row ${e + 1}"
|
|
3423
3519
|
?disabled=${this.disabled}
|
|
3424
3520
|
@click=${() => this.commit(this.rows.filter((i, a) => a !== e))}
|
|
3425
|
-
>${
|
|
3521
|
+
>${W("close")}</button>
|
|
3426
3522
|
</div>`
|
|
3427
3523
|
)}
|
|
3428
3524
|
<button
|
|
@@ -3430,37 +3526,37 @@ let pt = class extends $ {
|
|
|
3430
3526
|
class="baht-keyvalue-add"
|
|
3431
3527
|
?disabled=${this.disabled}
|
|
3432
3528
|
@click=${this.addRow}
|
|
3433
|
-
>${
|
|
3529
|
+
>${W("plus")}${this.add_label}</button>
|
|
3434
3530
|
</div>`;
|
|
3435
3531
|
}
|
|
3436
3532
|
};
|
|
3437
|
-
|
|
3533
|
+
_t([
|
|
3438
3534
|
l({ attribute: !1 })
|
|
3439
|
-
],
|
|
3440
|
-
|
|
3535
|
+
], dt.prototype, "value", 2);
|
|
3536
|
+
_t([
|
|
3441
3537
|
l({ attribute: "key-placeholder" })
|
|
3442
|
-
],
|
|
3443
|
-
|
|
3538
|
+
], dt.prototype, "keyPlaceholder", 2);
|
|
3539
|
+
_t([
|
|
3444
3540
|
l({ attribute: "value-placeholder" })
|
|
3445
|
-
],
|
|
3446
|
-
|
|
3541
|
+
], dt.prototype, "valuePlaceholder", 2);
|
|
3542
|
+
_t([
|
|
3447
3543
|
l({ attribute: "add-label" })
|
|
3448
|
-
],
|
|
3449
|
-
|
|
3544
|
+
], dt.prototype, "add_label", 2);
|
|
3545
|
+
_t([
|
|
3450
3546
|
l({ type: Boolean })
|
|
3451
|
-
],
|
|
3452
|
-
|
|
3547
|
+
], dt.prototype, "disabled", 2);
|
|
3548
|
+
_t([
|
|
3453
3549
|
y()
|
|
3454
|
-
],
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
],
|
|
3458
|
-
var
|
|
3459
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
3550
|
+
], dt.prototype, "rows", 2);
|
|
3551
|
+
dt = _t([
|
|
3552
|
+
b("baht-keyvalue-editor")
|
|
3553
|
+
], dt);
|
|
3554
|
+
var ci = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, A = (t, e, i, a) => {
|
|
3555
|
+
for (var s = a > 1 ? void 0 : a ? pi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
3460
3556
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
3461
|
-
return a && s &&
|
|
3557
|
+
return a && s && ci(e, i, s), s;
|
|
3462
3558
|
};
|
|
3463
|
-
let
|
|
3559
|
+
let j = class extends g {
|
|
3464
3560
|
constructor() {
|
|
3465
3561
|
super(...arguments), this.label = "Reference", this.value = "", this.display = "", this.placeholder = "", this.disabled = !1, this.invalid = !1, this.href = "", this.lookupLabel = "Look up records", this.debounce = 200, this.fetcher = null, this.open = !1, this.term = "", this.options = [], this.loading = !1, this.activeIndex = -1, this.fetchSeq = 0, this.onDocMousedown = (t) => {
|
|
3466
3562
|
this.contains(t.target) || this.close();
|
|
@@ -3470,16 +3566,16 @@ let S = class extends $ {
|
|
|
3470
3566
|
return `baht-refpicker-list-${this.uid}`;
|
|
3471
3567
|
}
|
|
3472
3568
|
disconnectedCallback() {
|
|
3473
|
-
super.disconnectedCallback(), clearTimeout(this.timer),
|
|
3569
|
+
super.disconnectedCallback(), clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
|
|
3474
3570
|
}
|
|
3475
3571
|
openLookup() {
|
|
3476
|
-
this.disabled || this.open || (this.open = !0, this.term = "", this.activeIndex = -1,
|
|
3572
|
+
this.disabled || this.open || (this.open = !0, this.term = "", this.activeIndex = -1, S() && document.addEventListener("mousedown", this.onDocMousedown), this.search(""), this.updateComplete.then(() => {
|
|
3477
3573
|
var t;
|
|
3478
3574
|
return (t = this.inputEl) == null ? void 0 : t.focus();
|
|
3479
3575
|
}));
|
|
3480
3576
|
}
|
|
3481
3577
|
close() {
|
|
3482
|
-
this.open && (this.open = !1, this.loading = !1, clearTimeout(this.timer),
|
|
3578
|
+
this.open && (this.open = !1, this.loading = !1, clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown));
|
|
3483
3579
|
}
|
|
3484
3580
|
search(t) {
|
|
3485
3581
|
clearTimeout(this.timer), this.timer = setTimeout(async () => {
|
|
@@ -3554,7 +3650,7 @@ let S = class extends $ {
|
|
|
3554
3650
|
aria-label="Clear"
|
|
3555
3651
|
@mousedown=${(e) => e.preventDefault()}
|
|
3556
3652
|
@click=${() => this.clear()}
|
|
3557
|
-
>${
|
|
3653
|
+
>${W("close")}</button>` : h}
|
|
3558
3654
|
</div>
|
|
3559
3655
|
<button
|
|
3560
3656
|
type="button"
|
|
@@ -3563,13 +3659,13 @@ let S = class extends $ {
|
|
|
3563
3659
|
title=${this.lookupLabel}
|
|
3564
3660
|
?disabled=${this.disabled}
|
|
3565
3661
|
@click=${() => this.open ? this.close() : this.openLookup()}
|
|
3566
|
-
>${
|
|
3662
|
+
>${W("search")}</button>
|
|
3567
3663
|
${this.value && this.href ? n`<a
|
|
3568
3664
|
class="baht-refpicker-open"
|
|
3569
3665
|
href=${this.href}
|
|
3570
3666
|
aria-label="Open record"
|
|
3571
3667
|
title="Open record"
|
|
3572
|
-
>${
|
|
3668
|
+
>${W("external")}</a>` : h}
|
|
3573
3669
|
<div
|
|
3574
3670
|
class="baht-refpicker-list"
|
|
3575
3671
|
id=${this.listboxId}
|
|
@@ -3596,63 +3692,63 @@ let S = class extends $ {
|
|
|
3596
3692
|
</div>`;
|
|
3597
3693
|
}
|
|
3598
3694
|
};
|
|
3599
|
-
|
|
3695
|
+
A([
|
|
3600
3696
|
l()
|
|
3601
|
-
],
|
|
3602
|
-
|
|
3697
|
+
], j.prototype, "label", 2);
|
|
3698
|
+
A([
|
|
3603
3699
|
l()
|
|
3604
|
-
],
|
|
3605
|
-
|
|
3700
|
+
], j.prototype, "value", 2);
|
|
3701
|
+
A([
|
|
3606
3702
|
l()
|
|
3607
|
-
],
|
|
3608
|
-
|
|
3703
|
+
], j.prototype, "display", 2);
|
|
3704
|
+
A([
|
|
3609
3705
|
l()
|
|
3610
|
-
],
|
|
3611
|
-
|
|
3706
|
+
], j.prototype, "placeholder", 2);
|
|
3707
|
+
A([
|
|
3612
3708
|
l({ type: Boolean })
|
|
3613
|
-
],
|
|
3614
|
-
|
|
3709
|
+
], j.prototype, "disabled", 2);
|
|
3710
|
+
A([
|
|
3615
3711
|
l({ type: Boolean })
|
|
3616
|
-
],
|
|
3617
|
-
|
|
3712
|
+
], j.prototype, "invalid", 2);
|
|
3713
|
+
A([
|
|
3618
3714
|
l()
|
|
3619
|
-
],
|
|
3620
|
-
|
|
3715
|
+
], j.prototype, "href", 2);
|
|
3716
|
+
A([
|
|
3621
3717
|
l({ attribute: "lookup-label" })
|
|
3622
|
-
],
|
|
3623
|
-
|
|
3718
|
+
], j.prototype, "lookupLabel", 2);
|
|
3719
|
+
A([
|
|
3624
3720
|
l({ type: Number })
|
|
3625
|
-
],
|
|
3626
|
-
|
|
3721
|
+
], j.prototype, "debounce", 2);
|
|
3722
|
+
A([
|
|
3627
3723
|
l({ attribute: !1 })
|
|
3628
|
-
],
|
|
3629
|
-
|
|
3724
|
+
], j.prototype, "fetcher", 2);
|
|
3725
|
+
A([
|
|
3630
3726
|
y()
|
|
3631
|
-
],
|
|
3632
|
-
|
|
3727
|
+
], j.prototype, "open", 2);
|
|
3728
|
+
A([
|
|
3633
3729
|
y()
|
|
3634
|
-
],
|
|
3635
|
-
|
|
3730
|
+
], j.prototype, "term", 2);
|
|
3731
|
+
A([
|
|
3636
3732
|
y()
|
|
3637
|
-
],
|
|
3638
|
-
|
|
3733
|
+
], j.prototype, "options", 2);
|
|
3734
|
+
A([
|
|
3639
3735
|
y()
|
|
3640
|
-
],
|
|
3641
|
-
|
|
3736
|
+
], j.prototype, "loading", 2);
|
|
3737
|
+
A([
|
|
3642
3738
|
y()
|
|
3643
|
-
],
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
],
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
],
|
|
3650
|
-
var
|
|
3651
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
3739
|
+
], j.prototype, "activeIndex", 2);
|
|
3740
|
+
A([
|
|
3741
|
+
It("input")
|
|
3742
|
+
], j.prototype, "inputEl", 2);
|
|
3743
|
+
j = A([
|
|
3744
|
+
b("baht-reference-picker")
|
|
3745
|
+
], j);
|
|
3746
|
+
var di = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, M = (t, e, i, a) => {
|
|
3747
|
+
for (var s = a > 1 ? void 0 : a ? ui(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
3652
3748
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
3653
|
-
return a && s &&
|
|
3749
|
+
return a && s && di(e, i, s), s;
|
|
3654
3750
|
};
|
|
3655
|
-
let E = class extends
|
|
3751
|
+
let E = class extends g {
|
|
3656
3752
|
constructor() {
|
|
3657
3753
|
super(...arguments), this.label = "Search", this.value = "", this.placeholder = "", this.disabled = !1, this.invalid = !1, this.options = [], this.fetcher = null, this.debounce = 150, this.minChars = 1, this.maxItems = 8, this.freeText = !0, this.autocomplete = "off", this.term = "", this.open = !1, this.results = [], this.loading = !1, this.activeIndex = -1, this.fetchSeq = 0, this.picked = null, this.lastPicked = null, this.onDocMousedown = (t) => {
|
|
3658
3754
|
this.contains(t.target) || this.close();
|
|
@@ -3668,7 +3764,7 @@ let E = class extends $ {
|
|
|
3668
3764
|
return `${this.listboxId}-${t}`;
|
|
3669
3765
|
}
|
|
3670
3766
|
disconnectedCallback() {
|
|
3671
|
-
super.disconnectedCallback(), clearTimeout(this.timer),
|
|
3767
|
+
super.disconnectedCallback(), clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
|
|
3672
3768
|
}
|
|
3673
3769
|
willUpdate(t) {
|
|
3674
3770
|
super.willUpdate(t), t.has("value") && this.timer === void 0 && (this.term = this.value);
|
|
@@ -3715,10 +3811,10 @@ let E = class extends $ {
|
|
|
3715
3811
|
this.activeIndex !== t && (this.activeIndex = t);
|
|
3716
3812
|
}
|
|
3717
3813
|
listen() {
|
|
3718
|
-
|
|
3814
|
+
S() && document.addEventListener("mousedown", this.onDocMousedown);
|
|
3719
3815
|
}
|
|
3720
3816
|
close() {
|
|
3721
|
-
|
|
3817
|
+
S() && document.removeEventListener("mousedown", this.onDocMousedown), this.open && (this.open = !1, this.activeIndex = -1);
|
|
3722
3818
|
}
|
|
3723
3819
|
// ---- events ------------------------------------------------------------
|
|
3724
3820
|
emitChange(t, e) {
|
|
@@ -3798,7 +3894,7 @@ let E = class extends $ {
|
|
|
3798
3894
|
aria-invalid=${this.invalid ? "true" : h}
|
|
3799
3895
|
autocomplete=${this.autocomplete}
|
|
3800
3896
|
placeholder=${this.placeholder || h}
|
|
3801
|
-
.value=${
|
|
3897
|
+
.value=${lt(this.term)}
|
|
3802
3898
|
?disabled=${this.disabled}
|
|
3803
3899
|
@input=${(i) => this.onInput(i)}
|
|
3804
3900
|
@keydown=${(i) => this.onKeydown(i)}
|
|
@@ -3835,64 +3931,64 @@ let E = class extends $ {
|
|
|
3835
3931
|
</div>`;
|
|
3836
3932
|
}
|
|
3837
3933
|
};
|
|
3838
|
-
|
|
3934
|
+
M([
|
|
3839
3935
|
l()
|
|
3840
3936
|
], E.prototype, "label", 2);
|
|
3841
|
-
|
|
3937
|
+
M([
|
|
3842
3938
|
l()
|
|
3843
3939
|
], E.prototype, "value", 2);
|
|
3844
|
-
|
|
3940
|
+
M([
|
|
3845
3941
|
l()
|
|
3846
3942
|
], E.prototype, "placeholder", 2);
|
|
3847
|
-
|
|
3943
|
+
M([
|
|
3848
3944
|
l({ type: Boolean })
|
|
3849
3945
|
], E.prototype, "disabled", 2);
|
|
3850
|
-
|
|
3946
|
+
M([
|
|
3851
3947
|
l({ type: Boolean })
|
|
3852
3948
|
], E.prototype, "invalid", 2);
|
|
3853
|
-
|
|
3949
|
+
M([
|
|
3854
3950
|
l({ attribute: !1 })
|
|
3855
3951
|
], E.prototype, "options", 2);
|
|
3856
|
-
|
|
3952
|
+
M([
|
|
3857
3953
|
l({ attribute: !1 })
|
|
3858
3954
|
], E.prototype, "fetcher", 2);
|
|
3859
|
-
|
|
3955
|
+
M([
|
|
3860
3956
|
l({ type: Number })
|
|
3861
3957
|
], E.prototype, "debounce", 2);
|
|
3862
|
-
|
|
3958
|
+
M([
|
|
3863
3959
|
l({ type: Number, attribute: "min-chars" })
|
|
3864
3960
|
], E.prototype, "minChars", 2);
|
|
3865
|
-
|
|
3961
|
+
M([
|
|
3866
3962
|
l({ type: Number, attribute: "max-items" })
|
|
3867
3963
|
], E.prototype, "maxItems", 2);
|
|
3868
|
-
|
|
3964
|
+
M([
|
|
3869
3965
|
l({ attribute: "free-text", converter: (t) => t !== "false" })
|
|
3870
3966
|
], E.prototype, "freeText", 2);
|
|
3871
|
-
|
|
3967
|
+
M([
|
|
3872
3968
|
l()
|
|
3873
3969
|
], E.prototype, "autocomplete", 2);
|
|
3874
|
-
|
|
3970
|
+
M([
|
|
3875
3971
|
y()
|
|
3876
3972
|
], E.prototype, "term", 2);
|
|
3877
|
-
|
|
3973
|
+
M([
|
|
3878
3974
|
y()
|
|
3879
3975
|
], E.prototype, "open", 2);
|
|
3880
|
-
|
|
3976
|
+
M([
|
|
3881
3977
|
y()
|
|
3882
3978
|
], E.prototype, "results", 2);
|
|
3883
|
-
|
|
3979
|
+
M([
|
|
3884
3980
|
y()
|
|
3885
3981
|
], E.prototype, "loading", 2);
|
|
3886
|
-
|
|
3982
|
+
M([
|
|
3887
3983
|
y()
|
|
3888
3984
|
], E.prototype, "activeIndex", 2);
|
|
3889
|
-
|
|
3890
|
-
|
|
3985
|
+
M([
|
|
3986
|
+
It("input")
|
|
3891
3987
|
], E.prototype, "inputEl", 2);
|
|
3892
|
-
E =
|
|
3893
|
-
|
|
3988
|
+
E = M([
|
|
3989
|
+
b("baht-typeahead")
|
|
3894
3990
|
], E);
|
|
3895
|
-
const
|
|
3991
|
+
const cs = {
|
|
3896
3992
|
text: "baht-input",
|
|
3897
3993
|
email: "baht-input",
|
|
3898
3994
|
password: "baht-input",
|
|
@@ -3909,22 +4005,22 @@ const ns = {
|
|
|
3909
4005
|
section: "baht-section",
|
|
3910
4006
|
repeater: "baht-repeater"
|
|
3911
4007
|
};
|
|
3912
|
-
var
|
|
3913
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
4008
|
+
var bi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, ps = (t, e, i, a) => {
|
|
4009
|
+
for (var s = a > 1 ? void 0 : a ? fi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
3914
4010
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
3915
|
-
return a && s &&
|
|
4011
|
+
return a && s && bi(e, i, s), s;
|
|
3916
4012
|
};
|
|
3917
|
-
const
|
|
4013
|
+
const mi = {
|
|
3918
4014
|
"1/4": "baht-field--w-1-4",
|
|
3919
4015
|
"1/2": "baht-field--w-1-2",
|
|
3920
4016
|
"3/4": "baht-field--w-3-4",
|
|
3921
4017
|
full: "baht-field--w-full"
|
|
3922
|
-
},
|
|
3923
|
-
function
|
|
3924
|
-
let e =
|
|
3925
|
-
return e || (e =
|
|
4018
|
+
}, as = /* @__PURE__ */ new Map();
|
|
4019
|
+
function vi(t) {
|
|
4020
|
+
let e = as.get(t);
|
|
4021
|
+
return e || (e = os(t), as.set(t, e)), e;
|
|
3926
4022
|
}
|
|
3927
|
-
let
|
|
4023
|
+
let Ie = class extends Y {
|
|
3928
4024
|
constructor() {
|
|
3929
4025
|
super(...arguments), this.rowErrors = [];
|
|
3930
4026
|
}
|
|
@@ -3944,7 +4040,7 @@ let Be = class extends W {
|
|
|
3944
4040
|
addRow() {
|
|
3945
4041
|
const t = {};
|
|
3946
4042
|
for (const e of this.subFields)
|
|
3947
|
-
e.type === "label" || e.type === "section" || (t[e.key] =
|
|
4043
|
+
e.type === "label" || e.type === "section" || (t[e.key] = ae(e));
|
|
3948
4044
|
this.emitInput([...this.rows, t]);
|
|
3949
4045
|
}
|
|
3950
4046
|
removeRow(t) {
|
|
@@ -3953,7 +4049,7 @@ let Be = class extends W {
|
|
|
3953
4049
|
/** Pending keystrokes in any row land in the array before the host reads it. */
|
|
3954
4050
|
flushTyped() {
|
|
3955
4051
|
var t;
|
|
3956
|
-
if (!
|
|
4052
|
+
if (!S()) return super.flushTyped();
|
|
3957
4053
|
for (const e of this.querySelectorAll(".baht-repeater-row > .baht-field > *"))
|
|
3958
4054
|
(t = e.flushTyped) == null || t.call(e);
|
|
3959
4055
|
super.flushTyped();
|
|
@@ -3969,17 +4065,17 @@ let Be = class extends W {
|
|
|
3969
4065
|
* focus, same as <baht-form> — and the whole thing renders on the server.
|
|
3970
4066
|
*/
|
|
3971
4067
|
renderSub(t, e, i) {
|
|
3972
|
-
const a =
|
|
4068
|
+
const a = cs[i.type];
|
|
3973
4069
|
if (!a) return h;
|
|
3974
|
-
const s =
|
|
4070
|
+
const s = vi(a), r = mi[i.width ?? "full"] ?? "baht-field--w-full", o = (c) => {
|
|
3975
4071
|
c.stopPropagation();
|
|
3976
|
-
const { value:
|
|
3977
|
-
this.patchRow(e, i.key,
|
|
4072
|
+
const { value: f } = c.detail;
|
|
4073
|
+
this.patchRow(e, i.key, f);
|
|
3978
4074
|
};
|
|
3979
4075
|
return n`<div class="baht-field ${r}" data-key=${i.key} data-type=${i.type}>
|
|
3980
|
-
${
|
|
4076
|
+
${se`<${s}
|
|
3981
4077
|
.field=${i}
|
|
3982
|
-
.value=${Object.hasOwn(t, i.key) ? t[i.key] :
|
|
4078
|
+
.value=${Object.hasOwn(t, i.key) ? t[i.key] : ae(i)}
|
|
3983
4079
|
.disabled=${this.disabled}
|
|
3984
4080
|
.readonly=${this.readonly}
|
|
3985
4081
|
.required=${!!i.required}
|
|
@@ -3998,16 +4094,16 @@ let Be = class extends W {
|
|
|
3998
4094
|
aria-labelledby=${this.field.label ? this.labelId : h}
|
|
3999
4095
|
aria-describedby=${this.describedBy}
|
|
4000
4096
|
>
|
|
4001
|
-
${
|
|
4097
|
+
${Ce(
|
|
4002
4098
|
t,
|
|
4003
4099
|
(a, s) => s,
|
|
4004
4100
|
(a, s) => n`<div
|
|
4005
4101
|
class="baht-repeater-row"
|
|
4006
4102
|
data-row=${s}
|
|
4007
4103
|
role="group"
|
|
4008
|
-
aria-label=${
|
|
4104
|
+
aria-label=${m("row", { n: s + 1 })}
|
|
4009
4105
|
>
|
|
4010
|
-
${
|
|
4106
|
+
${Ce(
|
|
4011
4107
|
this.subFields,
|
|
4012
4108
|
(r) => r.key,
|
|
4013
4109
|
(r) => this.renderSub(a, s, r)
|
|
@@ -4015,8 +4111,8 @@ let Be = class extends W {
|
|
|
4015
4111
|
${e ? n`<button
|
|
4016
4112
|
type="button"
|
|
4017
4113
|
class="baht-repeater-remove"
|
|
4018
|
-
aria-label=${
|
|
4019
|
-
title=${
|
|
4114
|
+
aria-label=${m("removeRowN", { n: s + 1 })}
|
|
4115
|
+
title=${m("removeRowN", { n: s + 1 })}
|
|
4020
4116
|
@click=${() => this.removeRow(s)}
|
|
4021
4117
|
>
|
|
4022
4118
|
✕
|
|
@@ -4029,23 +4125,23 @@ let Be = class extends W {
|
|
|
4029
4125
|
?disabled=${this.disabled || i}
|
|
4030
4126
|
@click=${() => this.addRow()}
|
|
4031
4127
|
>
|
|
4032
|
-
+ ${this.field.add_label ??
|
|
4128
|
+
+ ${this.field.add_label ?? m("addRow")}
|
|
4033
4129
|
</button>`}
|
|
4034
4130
|
</div>`;
|
|
4035
4131
|
}
|
|
4036
4132
|
};
|
|
4037
|
-
|
|
4133
|
+
ps([
|
|
4038
4134
|
l({ attribute: !1 })
|
|
4039
|
-
],
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
],
|
|
4043
|
-
var
|
|
4044
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
4135
|
+
], Ie.prototype, "rowErrors", 2);
|
|
4136
|
+
Ie = ps([
|
|
4137
|
+
b("baht-repeater")
|
|
4138
|
+
], Ie);
|
|
4139
|
+
var $i = Object.defineProperty, yi = Object.getOwnPropertyDescriptor, ve = (t, e, i, a) => {
|
|
4140
|
+
for (var s = a > 1 ? void 0 : a ? yi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
4045
4141
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
4046
|
-
return a && s &&
|
|
4142
|
+
return a && s && $i(e, i, s), s;
|
|
4047
4143
|
};
|
|
4048
|
-
let
|
|
4144
|
+
let Wt = class extends g {
|
|
4049
4145
|
constructor() {
|
|
4050
4146
|
super(...arguments), this.steps = [], this.current = 0, this.variant = "default";
|
|
4051
4147
|
}
|
|
@@ -4053,7 +4149,7 @@ let Gt = class extends $ {
|
|
|
4053
4149
|
const t = this.variant === "sidebar";
|
|
4054
4150
|
return n`<ol
|
|
4055
4151
|
class="baht-steps ${t ? "baht-steps--sidebar" : ""}"
|
|
4056
|
-
aria-label=${
|
|
4152
|
+
aria-label=${m("step", { current: this.current + 1, total: this.steps.length })}
|
|
4057
4153
|
>
|
|
4058
4154
|
${this.steps.map((e, i) => {
|
|
4059
4155
|
const a = i < this.current ? "done" : i === this.current ? "current" : "todo";
|
|
@@ -4063,40 +4159,40 @@ let Gt = class extends $ {
|
|
|
4063
4159
|
>
|
|
4064
4160
|
${t ? h : n`<span class="baht-step-marker" aria-hidden="true">${a === "done" ? "✓" : i + 1}</span>`}
|
|
4065
4161
|
<span class="baht-step-label">${e}</span>
|
|
4066
|
-
${a === "done" ? n`<span class="baht-visually-hidden"> (${
|
|
4162
|
+
${a === "done" ? n`<span class="baht-visually-hidden"> (${m("stepDone")})</span>` : a === "current" ? n`<span class="baht-visually-hidden"> (${m("stepCurrent")})</span>` : h}
|
|
4067
4163
|
</li>`;
|
|
4068
4164
|
})}
|
|
4069
4165
|
</ol>`;
|
|
4070
4166
|
}
|
|
4071
4167
|
};
|
|
4072
|
-
|
|
4168
|
+
ve([
|
|
4073
4169
|
l({ attribute: !1 })
|
|
4074
|
-
],
|
|
4075
|
-
|
|
4170
|
+
], Wt.prototype, "steps", 2);
|
|
4171
|
+
ve([
|
|
4076
4172
|
l({ type: Number })
|
|
4077
|
-
],
|
|
4078
|
-
|
|
4173
|
+
], Wt.prototype, "current", 2);
|
|
4174
|
+
ve([
|
|
4079
4175
|
l()
|
|
4080
|
-
],
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
],
|
|
4084
|
-
var
|
|
4085
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
4176
|
+
], Wt.prototype, "variant", 2);
|
|
4177
|
+
Wt = ve([
|
|
4178
|
+
b("baht-steps")
|
|
4179
|
+
], Wt);
|
|
4180
|
+
var gi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, Q = (t, e, i, a) => {
|
|
4181
|
+
for (var s = a > 1 ? void 0 : a ? wi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
4086
4182
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
4087
|
-
return a && s &&
|
|
4183
|
+
return a && s && gi(e, i, s), s;
|
|
4088
4184
|
};
|
|
4089
|
-
const
|
|
4185
|
+
const xi = {
|
|
4090
4186
|
"1/4": "baht-field--w-1-4",
|
|
4091
4187
|
"1/2": "baht-field--w-1-2",
|
|
4092
4188
|
"3/4": "baht-field--w-3-4",
|
|
4093
4189
|
full: "baht-field--w-full"
|
|
4094
|
-
},
|
|
4095
|
-
function
|
|
4096
|
-
let e =
|
|
4097
|
-
return e || (e =
|
|
4190
|
+
}, is = /* @__PURE__ */ new Map();
|
|
4191
|
+
function _i(t) {
|
|
4192
|
+
let e = is.get(t);
|
|
4193
|
+
return e || (e = os(t), is.set(t, e)), e;
|
|
4098
4194
|
}
|
|
4099
|
-
let
|
|
4195
|
+
let H = class extends g {
|
|
4100
4196
|
constructor() {
|
|
4101
4197
|
super(...arguments), this.value = {}, this.registry = {}, this.options = {}, this.fieldStates = {}, this.flags = {}, this.readonly = !1, this.edits = {}, this.errors = [], this.dynamicOptions = /* @__PURE__ */ new Map(), this.optionsSnapshots = /* @__PURE__ */ new Map(), this.optionsEpoch = /* @__PURE__ */ new Map(), this.warnedViews = /* @__PURE__ */ new Set(), this.flagCache = {};
|
|
4102
4198
|
}
|
|
@@ -4104,7 +4200,7 @@ let V = class extends $ {
|
|
|
4104
4200
|
return this.form ? ((this.flagCache.form !== this.form || this.flagCache.flags !== this.flags) && (this.flagCache = {
|
|
4105
4201
|
form: this.form,
|
|
4106
4202
|
flags: this.flags,
|
|
4107
|
-
out:
|
|
4203
|
+
out: rs(this.form, this.flags)
|
|
4108
4204
|
}), this.flagCache.out) : this.form;
|
|
4109
4205
|
}
|
|
4110
4206
|
willUpdate(t) {
|
|
@@ -4120,7 +4216,7 @@ let V = class extends $ {
|
|
|
4120
4216
|
const t = this.getData();
|
|
4121
4217
|
for (const a of ((e = this.effectiveForm) == null ? void 0 : e.fields) ?? []) {
|
|
4122
4218
|
if (!a.options_from) continue;
|
|
4123
|
-
const s = JSON.stringify((a.options_deps ?? []).map((
|
|
4219
|
+
const s = JSON.stringify((a.options_deps ?? []).map((f) => t[f] ?? null));
|
|
4124
4220
|
if (this.optionsSnapshots.get(a.key) === s) continue;
|
|
4125
4221
|
this.optionsSnapshots.set(a.key, s);
|
|
4126
4222
|
const r = (this.optionsEpoch.get(a.key) ?? 0) + 1;
|
|
@@ -4131,10 +4227,10 @@ let V = class extends $ {
|
|
|
4131
4227
|
continue;
|
|
4132
4228
|
}
|
|
4133
4229
|
const c = o(t);
|
|
4134
|
-
c instanceof Promise ? c.then((
|
|
4135
|
-
this.optionsEpoch.get(a.key) === r && (this.dynamicOptions.set(a.key,
|
|
4136
|
-
}).catch((
|
|
4137
|
-
console.warn(`[bahtui] options fetcher "${a.options_from}" failed`,
|
|
4230
|
+
c instanceof Promise ? c.then((f) => {
|
|
4231
|
+
this.optionsEpoch.get(a.key) === r && (this.dynamicOptions.set(a.key, f), this.requestUpdate());
|
|
4232
|
+
}).catch((f) => {
|
|
4233
|
+
console.warn(`[bahtui] options fetcher "${a.options_from}" failed`, f), this.optionsEpoch.get(a.key) === r && this.optionsSnapshots.delete(a.key);
|
|
4138
4234
|
}) : this.dynamicOptions.set(a.key, c);
|
|
4139
4235
|
}
|
|
4140
4236
|
}
|
|
@@ -4149,13 +4245,13 @@ let V = class extends $ {
|
|
|
4149
4245
|
for (; e.length > 0; ) {
|
|
4150
4246
|
const r = e.shift();
|
|
4151
4247
|
for (const o of ((a = this.effectiveForm) == null ? void 0 : a.fields) ?? [])
|
|
4152
|
-
!((s = o.options_deps) != null && s.includes(r)) || i.has(o.key) || (i.add(o.key), this.edits = { ...this.edits, [o.key]:
|
|
4248
|
+
!((s = o.options_deps) != null && s.includes(r)) || i.has(o.key) || (i.add(o.key), this.edits = { ...this.edits, [o.key]: ae(o) }, e.push(o.key));
|
|
4153
4249
|
}
|
|
4154
4250
|
}
|
|
4155
4251
|
get sortedFields() {
|
|
4156
4252
|
if (!this.form) return [];
|
|
4157
|
-
const t =
|
|
4158
|
-
return t || (this.view !== void 0 && !this.warnedViews.has(this.view) && (this.warnedViews.add(this.view), console.warn(`[bahtui] unknown view "${this.view}" — showing the full form`)),
|
|
4253
|
+
const t = Ae(this.effectiveForm, this.view);
|
|
4254
|
+
return t || (this.view !== void 0 && !this.warnedViews.has(this.view) && (this.warnedViews.add(this.view), console.warn(`[bahtui] unknown view "${this.view}" — showing the full form`)), Ae(this.effectiveForm) ?? []);
|
|
4159
4255
|
}
|
|
4160
4256
|
stateFor(t) {
|
|
4161
4257
|
return this.fieldStates[t.key] ?? {
|
|
@@ -4167,13 +4263,13 @@ let V = class extends $ {
|
|
|
4167
4263
|
};
|
|
4168
4264
|
}
|
|
4169
4265
|
valueFor(t) {
|
|
4170
|
-
return Object.hasOwn(this.edits, t.key) ? this.edits[t.key] : Object.hasOwn(this.value, t.key) ? this.value[t.key] :
|
|
4266
|
+
return Object.hasOwn(this.edits, t.key) ? this.edits[t.key] : Object.hasOwn(this.value, t.key) ? this.value[t.key] : ae(t);
|
|
4171
4267
|
}
|
|
4172
4268
|
// ---- public API (spec 01 §6) ----
|
|
4173
4269
|
/** Debounced keystrokes still in a control land in `edits` before anyone reads them. */
|
|
4174
4270
|
flushTyped() {
|
|
4175
4271
|
var t;
|
|
4176
|
-
if (
|
|
4272
|
+
if (S())
|
|
4177
4273
|
for (const e of this.querySelectorAll(":scope > .baht-form > .baht-field > *"))
|
|
4178
4274
|
(t = e.flushTyped) == null || t.call(e);
|
|
4179
4275
|
}
|
|
@@ -4195,7 +4291,7 @@ let V = class extends $ {
|
|
|
4195
4291
|
const s = this.stateFor(a);
|
|
4196
4292
|
if (!s.visible) continue;
|
|
4197
4293
|
const r = s.required === !!a.required ? a : { ...a, required: s.required };
|
|
4198
|
-
t.push(...
|
|
4294
|
+
t.push(...Le(r, this.valueFor(a), this.registry, e));
|
|
4199
4295
|
}
|
|
4200
4296
|
this.errors = t;
|
|
4201
4297
|
const i = { valid: t.length === 0, errors: t };
|
|
@@ -4225,7 +4321,7 @@ let V = class extends $ {
|
|
|
4225
4321
|
const e = this.stateFor(t);
|
|
4226
4322
|
if (!e.visible) return [];
|
|
4227
4323
|
const i = this.getData(), a = e.required === !!t.required ? t : { ...t, required: e.required };
|
|
4228
|
-
return
|
|
4324
|
+
return Le(a, this.valueFor(t), this.registry, i);
|
|
4229
4325
|
}
|
|
4230
4326
|
/** `validateOn: 'blur'` — validate just the field the user left, same as
|
|
4231
4327
|
* how errors are shown elsewhere (merged into `this.errors`, painted by
|
|
@@ -4236,51 +4332,51 @@ let V = class extends $ {
|
|
|
4236
4332
|
this.errors = [...i, ...e];
|
|
4237
4333
|
}
|
|
4238
4334
|
renderField(t) {
|
|
4239
|
-
var
|
|
4240
|
-
const e =
|
|
4335
|
+
var x, u;
|
|
4336
|
+
const e = cs[t.type];
|
|
4241
4337
|
if (!e)
|
|
4242
4338
|
return console.warn(`[bahtui] unknown field type "${t.type}" — skipped`), h;
|
|
4243
|
-
const i = this.stateFor(t), a =
|
|
4339
|
+
const i = this.stateFor(t), a = xi[t.width ?? "full"] ?? "baht-field--w-full", s = ((x = this.errors.find((v) => v.key === t.key)) == null ? void 0 : x.message) ?? null;
|
|
4244
4340
|
if (this.readonly && t.type !== "label" && t.type !== "section")
|
|
4245
4341
|
return this.renderReadonlyField(t, a, i.visible);
|
|
4246
|
-
const r = t.options_from ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, o = this.valueFor(t), c = !i.enabled,
|
|
4247
|
-
let
|
|
4342
|
+
const r = t.options_from ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, o = this.valueFor(t), c = !i.enabled, f = this.readonly || i.readonly, $ = this.options.inputDebounce, w = (v) => this.onControlInput(t.key, v), p = _i(e);
|
|
4343
|
+
let P;
|
|
4248
4344
|
if (t.type === "repeater") {
|
|
4249
|
-
const
|
|
4250
|
-
|
|
4345
|
+
const v = this.errors.filter((D) => D.key.startsWith(`${t.key}[`));
|
|
4346
|
+
P = se`<${p}
|
|
4251
4347
|
.field=${r}
|
|
4252
4348
|
.value=${o}
|
|
4253
4349
|
.disabled=${c}
|
|
4254
|
-
.readonly=${
|
|
4350
|
+
.readonly=${f}
|
|
4255
4351
|
.required=${i.required}
|
|
4256
4352
|
.error=${s}
|
|
4257
|
-
.debounce=${
|
|
4258
|
-
.rowErrors=${
|
|
4259
|
-
@baht-input=${
|
|
4353
|
+
.debounce=${$}
|
|
4354
|
+
.rowErrors=${v}
|
|
4355
|
+
@baht-input=${w}
|
|
4260
4356
|
></${p}>`;
|
|
4261
4357
|
} else if (t.type === "file") {
|
|
4262
|
-
let
|
|
4263
|
-
t.uploader && (
|
|
4358
|
+
let v;
|
|
4359
|
+
t.uploader && (v = (u = this.registry.uploaders) == null ? void 0 : u[t.uploader], v || console.warn(`[bahtui] unknown uploader "${t.uploader}" — capture only`)), P = se`<${p}
|
|
4264
4360
|
.field=${r}
|
|
4265
4361
|
.value=${o}
|
|
4266
4362
|
.disabled=${c}
|
|
4267
|
-
.readonly=${
|
|
4363
|
+
.readonly=${f}
|
|
4268
4364
|
.required=${i.required}
|
|
4269
4365
|
.error=${s}
|
|
4270
|
-
.debounce=${
|
|
4271
|
-
.uploader=${
|
|
4272
|
-
@baht-input=${
|
|
4366
|
+
.debounce=${$}
|
|
4367
|
+
.uploader=${v}
|
|
4368
|
+
@baht-input=${w}
|
|
4273
4369
|
></${p}>`;
|
|
4274
4370
|
} else
|
|
4275
|
-
|
|
4371
|
+
P = se`<${p}
|
|
4276
4372
|
.field=${r}
|
|
4277
4373
|
.value=${o}
|
|
4278
4374
|
.disabled=${c}
|
|
4279
|
-
.readonly=${
|
|
4375
|
+
.readonly=${f}
|
|
4280
4376
|
.required=${i.required}
|
|
4281
4377
|
.error=${s}
|
|
4282
|
-
.debounce=${
|
|
4283
|
-
@baht-input=${
|
|
4378
|
+
.debounce=${$}
|
|
4379
|
+
@baht-input=${w}
|
|
4284
4380
|
></${p}>`;
|
|
4285
4381
|
return n`<div
|
|
4286
4382
|
class="baht-field ${a} ${i.visible ? "" : "baht-field--hidden"}"
|
|
@@ -4289,7 +4385,7 @@ let V = class extends $ {
|
|
|
4289
4385
|
data-testid="${this.form.form_id}.${t.key}"
|
|
4290
4386
|
@focusout=${() => this.onFieldBlur(t)}
|
|
4291
4387
|
>
|
|
4292
|
-
${
|
|
4388
|
+
${P}
|
|
4293
4389
|
</div>`;
|
|
4294
4390
|
}
|
|
4295
4391
|
/**
|
|
@@ -4302,7 +4398,7 @@ let V = class extends $ {
|
|
|
4302
4398
|
i && this.onFieldInput(i, e);
|
|
4303
4399
|
}
|
|
4304
4400
|
renderReadonlyField(t, e, i) {
|
|
4305
|
-
const a = t.options_from ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, s =
|
|
4401
|
+
const a = t.options_from ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, s = bs(t, this.valueFor(t), a), r = s.kind === "empty" ? n`<span class="baht-readonly-value baht-readonly-value--empty">${m("emptyValue")}</span>` : s.kind === "text" ? n`<span class="baht-readonly-value">${s.text}</span>` : s.kind === "chips" ? n`<span class="baht-readonly-value baht-readonly-chips"
|
|
4306
4402
|
>${s.items.map((o) => n`<span class="baht-readonly-chip">${o}</span>`)}</span
|
|
4307
4403
|
>` : n`<div class="baht-readonly-rows">
|
|
4308
4404
|
${s.rows.map(
|
|
@@ -4328,7 +4424,7 @@ let V = class extends $ {
|
|
|
4328
4424
|
}
|
|
4329
4425
|
render() {
|
|
4330
4426
|
return n`<div class="baht-form ${this.readonly ? "baht-form--readonly" : ""}">
|
|
4331
|
-
${
|
|
4427
|
+
${Ce(
|
|
4332
4428
|
this.sortedFields,
|
|
4333
4429
|
(t) => t.key,
|
|
4334
4430
|
(t) => this.renderField(t)
|
|
@@ -4336,45 +4432,45 @@ let V = class extends $ {
|
|
|
4336
4432
|
</div>`;
|
|
4337
4433
|
}
|
|
4338
4434
|
};
|
|
4339
|
-
|
|
4435
|
+
Q([
|
|
4340
4436
|
l({ attribute: !1 })
|
|
4341
|
-
],
|
|
4342
|
-
|
|
4437
|
+
], H.prototype, "form", 2);
|
|
4438
|
+
Q([
|
|
4343
4439
|
l({ attribute: !1 })
|
|
4344
|
-
],
|
|
4345
|
-
|
|
4440
|
+
], H.prototype, "value", 2);
|
|
4441
|
+
Q([
|
|
4346
4442
|
l({ attribute: !1 })
|
|
4347
|
-
],
|
|
4348
|
-
|
|
4443
|
+
], H.prototype, "registry", 2);
|
|
4444
|
+
Q([
|
|
4349
4445
|
l({ attribute: !1 })
|
|
4350
|
-
],
|
|
4351
|
-
|
|
4446
|
+
], H.prototype, "options", 2);
|
|
4447
|
+
Q([
|
|
4352
4448
|
l({ attribute: !1 })
|
|
4353
|
-
],
|
|
4354
|
-
|
|
4449
|
+
], H.prototype, "fieldStates", 2);
|
|
4450
|
+
Q([
|
|
4355
4451
|
l({ type: String })
|
|
4356
|
-
],
|
|
4357
|
-
|
|
4452
|
+
], H.prototype, "view", 2);
|
|
4453
|
+
Q([
|
|
4358
4454
|
l({ attribute: !1 })
|
|
4359
|
-
],
|
|
4360
|
-
|
|
4455
|
+
], H.prototype, "flags", 2);
|
|
4456
|
+
Q([
|
|
4361
4457
|
l({ type: Boolean })
|
|
4362
|
-
],
|
|
4363
|
-
|
|
4458
|
+
], H.prototype, "readonly", 2);
|
|
4459
|
+
Q([
|
|
4364
4460
|
y()
|
|
4365
|
-
],
|
|
4366
|
-
|
|
4461
|
+
], H.prototype, "edits", 2);
|
|
4462
|
+
Q([
|
|
4367
4463
|
y()
|
|
4368
|
-
],
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
],
|
|
4372
|
-
var
|
|
4373
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
4464
|
+
], H.prototype, "errors", 2);
|
|
4465
|
+
H = Q([
|
|
4466
|
+
b("baht-form")
|
|
4467
|
+
], H);
|
|
4468
|
+
var ki = Object.defineProperty, Pi = Object.getOwnPropertyDescriptor, q = (t, e, i, a) => {
|
|
4469
|
+
for (var s = a > 1 ? void 0 : a ? Pi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
|
|
4374
4470
|
(o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
|
|
4375
|
-
return a && s &&
|
|
4471
|
+
return a && s && ki(e, i, s), s;
|
|
4376
4472
|
};
|
|
4377
|
-
let T = class extends
|
|
4473
|
+
let T = class extends g {
|
|
4378
4474
|
constructor() {
|
|
4379
4475
|
super(...arguments), this.value = {}, this.registry = {}, this.validateGate = !0, this.showBack = !0, this.flags = {}, this.showSteps = !1, this.stepsVariant = "default", this.data = {}, this.derived = null, this.current = null, this.approvalError = null, this.history = [], this.flagCache = {};
|
|
4380
4476
|
}
|
|
@@ -4385,7 +4481,7 @@ let T = class extends $ {
|
|
|
4385
4481
|
return this.workflow ? ((this.flagCache.workflow !== this.workflow || this.flagCache.flags !== this.flags) && (this.flagCache = {
|
|
4386
4482
|
workflow: this.workflow,
|
|
4387
4483
|
flags: this.flags,
|
|
4388
|
-
out:
|
|
4484
|
+
out: rs(this.workflow, this.flags)
|
|
4389
4485
|
}), this.flagCache.out) : this.workflow;
|
|
4390
4486
|
}
|
|
4391
4487
|
willUpdate(t) {
|
|
@@ -4393,7 +4489,7 @@ let T = class extends $ {
|
|
|
4393
4489
|
t.has("workflow") || t.has("value") ? (this.data = structuredClone(this.value ?? {}), this.reevaluate(), this.history = [], this.current = ((e = this.visibleForms[0]) == null ? void 0 : e.form_name) ?? null, this.approvalError = null) : t.has("flags") && (this.reevaluate(), this.current && !this.visibleForms.some((a) => a.form_name === this.current) && (this.current = ((i = this.visibleForms[0]) == null ? void 0 : i.form_name) ?? null));
|
|
4394
4490
|
}
|
|
4395
4491
|
reevaluate() {
|
|
4396
|
-
this.derived =
|
|
4492
|
+
this.derived = fs(this.effectiveWorkflow, this.data), this.data = this.derived.data;
|
|
4397
4493
|
}
|
|
4398
4494
|
/** Forms in ascending order whose derived visibility is true. */
|
|
4399
4495
|
get visibleForms() {
|
|
@@ -4413,7 +4509,7 @@ let T = class extends $ {
|
|
|
4413
4509
|
if (!this.current) return "end";
|
|
4414
4510
|
const t = this.effectiveWorkflow;
|
|
4415
4511
|
if (t.transitions && t.transitions.length > 0)
|
|
4416
|
-
return
|
|
4512
|
+
return ms(t, this.current, this.data);
|
|
4417
4513
|
const e = this.visibleForms, i = e.findIndex((s) => s.form_name === this.current);
|
|
4418
4514
|
return ((a = e[i + 1]) == null ? void 0 : a.form_name) ?? "end";
|
|
4419
4515
|
}
|
|
@@ -4490,12 +4586,12 @@ let T = class extends $ {
|
|
|
4490
4586
|
this.decide("rejected");
|
|
4491
4587
|
}
|
|
4492
4588
|
decide(t) {
|
|
4493
|
-
var
|
|
4589
|
+
var f;
|
|
4494
4590
|
const e = this.currentForm;
|
|
4495
4591
|
if (!e || e.kind !== "approval") return;
|
|
4496
|
-
const i = e.approval ?? {}, a = String(((
|
|
4592
|
+
const i = e.approval ?? {}, a = String(((f = this.data[e.form_name]) == null ? void 0 : f.comment) ?? ""), s = i.comment ?? "optional";
|
|
4497
4593
|
if ((s === "required" || s === "requireOnReject" && t === "rejected") && a.trim() === "") {
|
|
4498
|
-
this.approvalError =
|
|
4594
|
+
this.approvalError = m("commentRequired");
|
|
4499
4595
|
return;
|
|
4500
4596
|
}
|
|
4501
4597
|
this.approvalError = null, this.data = {
|
|
@@ -4509,7 +4605,7 @@ let T = class extends $ {
|
|
|
4509
4605
|
}
|
|
4510
4606
|
this.emit("baht-reject", o);
|
|
4511
4607
|
const c = i.on_reject ?? { action: "end" };
|
|
4512
|
-
c.action === "goto" && this.visibleForms.some((
|
|
4608
|
+
c.action === "goto" && this.visibleForms.some(($) => $.form_name === c.form) ? this.gotoForm(c.form) : this.emit("baht-complete", { data: this.getData(), status: "rejected" });
|
|
4513
4609
|
}
|
|
4514
4610
|
/** Jump back to a visible form, truncating the history to that point. */
|
|
4515
4611
|
gotoForm(t) {
|
|
@@ -4558,7 +4654,7 @@ let T = class extends $ {
|
|
|
4558
4654
|
const e = ((a = t.approval) == null ? void 0 : a.comment) ?? "optional", i = this.summary_forms(t);
|
|
4559
4655
|
return n`<div class="baht-approval">
|
|
4560
4656
|
<div class="baht-approval-summary">
|
|
4561
|
-
${i.length === 0 ? n`<p class="baht-approval-empty">${
|
|
4657
|
+
${i.length === 0 ? n`<p class="baht-approval-empty">${m("nothingToReview")}</p>` : i.map(
|
|
4562
4658
|
(r) => n`<section class="baht-approval-group">
|
|
4563
4659
|
<h4 class="baht-approval-group-title">${r.form_name}</h4>
|
|
4564
4660
|
<baht-form
|
|
@@ -4572,7 +4668,7 @@ let T = class extends $ {
|
|
|
4572
4668
|
</div>
|
|
4573
4669
|
${e !== "hidden" ? n`<label class="baht-approval-comment">
|
|
4574
4670
|
<span class="baht-approval-comment-label">
|
|
4575
|
-
${
|
|
4671
|
+
${m("comment")}${e === "required" ? m("commentRequiredSuffix") : ""}
|
|
4576
4672
|
</span>
|
|
4577
4673
|
<textarea
|
|
4578
4674
|
rows="3"
|
|
@@ -4596,7 +4692,7 @@ let T = class extends $ {
|
|
|
4596
4692
|
data-testid="${this.workflow.workflow_id}.${t.form_name}"
|
|
4597
4693
|
>
|
|
4598
4694
|
<div class="baht-visually-hidden" role="status">
|
|
4599
|
-
${
|
|
4695
|
+
${m("step", { current: a + 1, total: i.length })}
|
|
4600
4696
|
</div>
|
|
4601
4697
|
${this.showSteps ? n`<baht-steps
|
|
4602
4698
|
.steps=${i.map((o) => o.form_name)}
|
|
@@ -4616,7 +4712,7 @@ let T = class extends $ {
|
|
|
4616
4712
|
data-testid="${this.workflow.workflow_id}.back"
|
|
4617
4713
|
@click=${() => this.back()}
|
|
4618
4714
|
>
|
|
4619
|
-
${this.backLabel ??
|
|
4715
|
+
${this.backLabel ?? m("back")}
|
|
4620
4716
|
</button>` : h}
|
|
4621
4717
|
${e ? n`<button
|
|
4622
4718
|
type="button"
|
|
@@ -4624,7 +4720,7 @@ let T = class extends $ {
|
|
|
4624
4720
|
data-testid="${this.workflow.workflow_id}.reject"
|
|
4625
4721
|
@click=${() => this.decide("rejected")}
|
|
4626
4722
|
>
|
|
4627
|
-
${((s = t.approval) == null ? void 0 : s.reject_label) ??
|
|
4723
|
+
${((s = t.approval) == null ? void 0 : s.reject_label) ?? m("reject")}
|
|
4628
4724
|
</button>
|
|
4629
4725
|
<button
|
|
4630
4726
|
type="button"
|
|
@@ -4632,123 +4728,123 @@ let T = class extends $ {
|
|
|
4632
4728
|
data-testid="${this.workflow.workflow_id}.approve"
|
|
4633
4729
|
@click=${() => this.decide("approved")}
|
|
4634
4730
|
>
|
|
4635
|
-
${((r = t.approval) == null ? void 0 : r.approve_label) ??
|
|
4731
|
+
${((r = t.approval) == null ? void 0 : r.approve_label) ?? m("approve")}
|
|
4636
4732
|
</button>` : n`<button type="button" class="baht-button baht-button--next"
|
|
4637
4733
|
data-testid="${this.workflow.workflow_id}.next"
|
|
4638
4734
|
@click=${() => this.next()}
|
|
4639
4735
|
>
|
|
4640
|
-
${this.isLast ? this.submitLabel ??
|
|
4736
|
+
${this.isLast ? this.submitLabel ?? m("submit") : this.nextLabel ?? m("next")}
|
|
4641
4737
|
</button>`}
|
|
4642
4738
|
</div>
|
|
4643
4739
|
</div>`;
|
|
4644
4740
|
}
|
|
4645
4741
|
};
|
|
4646
|
-
|
|
4742
|
+
q([
|
|
4647
4743
|
l({ attribute: !1 })
|
|
4648
4744
|
], T.prototype, "workflow", 2);
|
|
4649
|
-
|
|
4745
|
+
q([
|
|
4650
4746
|
l({ attribute: !1 })
|
|
4651
4747
|
], T.prototype, "value", 2);
|
|
4652
|
-
|
|
4748
|
+
q([
|
|
4653
4749
|
l({ attribute: !1 })
|
|
4654
4750
|
], T.prototype, "registry", 2);
|
|
4655
|
-
|
|
4751
|
+
q([
|
|
4656
4752
|
l({ type: Boolean, attribute: "validate-gate" })
|
|
4657
4753
|
], T.prototype, "validateGate", 2);
|
|
4658
|
-
|
|
4754
|
+
q([
|
|
4659
4755
|
l({ attribute: "next-label" })
|
|
4660
4756
|
], T.prototype, "nextLabel", 2);
|
|
4661
|
-
|
|
4757
|
+
q([
|
|
4662
4758
|
l({ attribute: "submit-label" })
|
|
4663
4759
|
], T.prototype, "submitLabel", 2);
|
|
4664
|
-
|
|
4760
|
+
q([
|
|
4665
4761
|
l({ attribute: "back-label" })
|
|
4666
4762
|
], T.prototype, "backLabel", 2);
|
|
4667
|
-
|
|
4763
|
+
q([
|
|
4668
4764
|
l({ type: Boolean, attribute: "show-back" })
|
|
4669
4765
|
], T.prototype, "showBack", 2);
|
|
4670
|
-
|
|
4766
|
+
q([
|
|
4671
4767
|
l({ attribute: !1 })
|
|
4672
4768
|
], T.prototype, "flags", 2);
|
|
4673
|
-
|
|
4769
|
+
q([
|
|
4674
4770
|
l({ type: Boolean, attribute: "show-steps" })
|
|
4675
4771
|
], T.prototype, "showSteps", 2);
|
|
4676
|
-
|
|
4772
|
+
q([
|
|
4677
4773
|
l({ attribute: "steps-variant" })
|
|
4678
4774
|
], T.prototype, "stepsVariant", 2);
|
|
4679
|
-
|
|
4775
|
+
q([
|
|
4680
4776
|
y()
|
|
4681
4777
|
], T.prototype, "data", 2);
|
|
4682
|
-
|
|
4778
|
+
q([
|
|
4683
4779
|
y()
|
|
4684
4780
|
], T.prototype, "derived", 2);
|
|
4685
|
-
|
|
4781
|
+
q([
|
|
4686
4782
|
y()
|
|
4687
4783
|
], T.prototype, "current", 2);
|
|
4688
|
-
|
|
4784
|
+
q([
|
|
4689
4785
|
y()
|
|
4690
4786
|
], T.prototype, "approvalError", 2);
|
|
4691
|
-
T =
|
|
4692
|
-
|
|
4787
|
+
T = q([
|
|
4788
|
+
b("baht-workflow")
|
|
4693
4789
|
], T);
|
|
4694
4790
|
export {
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4791
|
+
Xe as $,
|
|
4792
|
+
ht as A,
|
|
4793
|
+
Dt as B,
|
|
4794
|
+
Ot as C,
|
|
4795
|
+
Ke as D,
|
|
4796
|
+
ot as E,
|
|
4797
|
+
vt as F,
|
|
4798
|
+
j as G,
|
|
4799
|
+
Ie as H,
|
|
4800
|
+
Ee as I,
|
|
4801
|
+
le as J,
|
|
4802
|
+
Kt as K,
|
|
4803
|
+
ct as L,
|
|
4804
|
+
re as M,
|
|
4805
|
+
K as N,
|
|
4806
|
+
Ht as O,
|
|
4807
|
+
Wt as P,
|
|
4808
|
+
k as Q,
|
|
4809
|
+
Fe as R,
|
|
4810
|
+
qe as S,
|
|
4811
|
+
De as T,
|
|
4812
|
+
Ue as U,
|
|
4813
|
+
Pt as V,
|
|
4718
4814
|
E as W,
|
|
4719
4815
|
F as X,
|
|
4720
4816
|
T as Y,
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4817
|
+
cs as Z,
|
|
4818
|
+
ft as _,
|
|
4819
|
+
mt as a,
|
|
4820
|
+
qa as a0,
|
|
4821
|
+
Rt as a1,
|
|
4822
|
+
ne as a2,
|
|
4823
|
+
Be as a3,
|
|
4824
|
+
fe as a4,
|
|
4825
|
+
Vt as b,
|
|
4826
|
+
z as c,
|
|
4827
|
+
oe as d,
|
|
4828
|
+
Ct as e,
|
|
4829
|
+
st as f,
|
|
4830
|
+
Ve as g,
|
|
4831
|
+
ie as h,
|
|
4832
|
+
He as i,
|
|
4833
|
+
J as j,
|
|
4834
|
+
Gt as k,
|
|
4835
|
+
Bt as l,
|
|
4836
|
+
Ut as m,
|
|
4837
|
+
Et as n,
|
|
4838
|
+
yt as o,
|
|
4839
|
+
H as p,
|
|
4840
|
+
pt as q,
|
|
4841
|
+
Ne as r,
|
|
4842
|
+
dt as s,
|
|
4843
|
+
et as t,
|
|
4844
|
+
Ft as u,
|
|
4845
|
+
rt as v,
|
|
4846
|
+
U as w,
|
|
4847
|
+
ze as x,
|
|
4848
|
+
Re as y,
|
|
4849
|
+
$t as z
|
|
4754
4850
|
};
|