bank20baht-ui 0.2.2 → 0.2.4
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/README.md +12 -0
- package/dist/components/baht-form.d.ts +1 -0
- package/dist/components/base.d.ts +1 -1
- package/dist/components/primitives/baht-section.d.ts +2 -2
- package/dist/components/primitives/baht-text.d.ts +2 -2
- package/dist/core/display.d.ts +23 -0
- package/dist/core/i18n.d.ts +2 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/custom-elements.json +30 -0
- package/dist/engine.js +207 -166
- package/dist/index.js +887 -859
- package/dist/tokens.css +38 -12
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { t as m, defaultValue as _t, applyFlags as ee, resolveViewFields as Vt, validateField as Ut,
|
|
2
|
-
import { approvalFields as
|
|
3
|
-
import { LitElement as
|
|
4
|
-
import { property as
|
|
1
|
+
import { t as m, defaultValue as _t, applyFlags as ee, resolveViewFields as Vt, validateField as Ut, displayValue as pe, evaluate as ce, resolveNext as de } from "./engine.js";
|
|
2
|
+
import { approvalFields as ua, evalCondition as ba, evalValueExpr as va, flagEnabled as fa, getCatalog as ma, readRef as ya, setCatalog as $a, setLocale as ga, walkPath as wa } from "./engine.js";
|
|
3
|
+
import { LitElement as ue, nothing as h, html as l, svg as D } from "lit";
|
|
4
|
+
import { property as n, query as tt, customElement as p, state as v } from "lit/decorators.js";
|
|
5
5
|
import { live as B } from "lit/directives/live.js";
|
|
6
6
|
import { ifDefined as O } from "lit/directives/if-defined.js";
|
|
7
|
-
var
|
|
7
|
+
var be = Object.defineProperty, et = (t, e, r, a) => {
|
|
8
8
|
for (var s = void 0, i = t.length - 1, o; i >= 0; i--)
|
|
9
|
-
(o = t[i]) && (s = o(e,
|
|
10
|
-
return s &&
|
|
9
|
+
(o = t[i]) && (s = o(e, r, s) || s);
|
|
10
|
+
return s && be(e, r, s), s;
|
|
11
11
|
};
|
|
12
|
-
class
|
|
12
|
+
class d extends ue {
|
|
13
13
|
createRenderRoot() {
|
|
14
14
|
return this;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
function st(t, e) {
|
|
18
|
-
let
|
|
19
|
-
for (;
|
|
20
|
-
const
|
|
21
|
-
(s) => s !==
|
|
18
|
+
let r = e;
|
|
19
|
+
for (; r.parentNode && r.parentNode !== t; ) r = r.parentNode;
|
|
20
|
+
const a = Array.from(t.childNodes).filter(
|
|
21
|
+
(s) => s !== r && s.nodeType !== Node.COMMENT_NODE
|
|
22
22
|
);
|
|
23
|
-
|
|
23
|
+
a.length > 0 && e.append(...a);
|
|
24
24
|
}
|
|
25
|
-
let
|
|
26
|
-
class g extends
|
|
25
|
+
let ve = 0;
|
|
26
|
+
class g extends d {
|
|
27
27
|
constructor() {
|
|
28
|
-
super(...arguments), this.uid = ++
|
|
28
|
+
super(...arguments), this.uid = ++ve, this.value = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.error = null;
|
|
29
29
|
}
|
|
30
30
|
/** Emit the user's edit upward (composed so it crosses any boundary). */
|
|
31
31
|
emitInput(e) {
|
|
@@ -38,8 +38,8 @@ class g extends c {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
renderLabel() {
|
|
41
|
-
return this.field.label ?
|
|
42
|
-
${this.field.label}${this.required ?
|
|
41
|
+
return this.field.label ? l`<label class="baht-label" id=${this.labelId} for=${this.controlId}>
|
|
42
|
+
${this.field.label}${this.required ? l`<span class="baht-required-mark" aria-hidden="true">*</span>` : h}
|
|
43
43
|
</label>` : h;
|
|
44
44
|
}
|
|
45
45
|
get controlId() {
|
|
@@ -66,31 +66,31 @@ class g extends c {
|
|
|
66
66
|
return this.error ? "true" : h;
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
|
-
return
|
|
69
|
+
return this.field ? l`
|
|
70
70
|
${this.renderLabel()}
|
|
71
71
|
${this.renderControl()}
|
|
72
|
-
${this.field.help ?
|
|
73
|
-
${this.error ?
|
|
74
|
-
|
|
72
|
+
${this.field.help ? l`<div class="baht-help" id=${this.helpId}>${this.field.help}</div>` : h}
|
|
73
|
+
${this.error ? l`<div class="baht-error" id=${this.errorId} role="alert">${this.error}</div>` : h}
|
|
74
|
+
` : h;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
et([
|
|
78
|
-
|
|
78
|
+
n({ attribute: !1 })
|
|
79
79
|
], g.prototype, "field");
|
|
80
80
|
et([
|
|
81
|
-
|
|
81
|
+
n({ attribute: !1 })
|
|
82
82
|
], g.prototype, "value");
|
|
83
83
|
et([
|
|
84
|
-
|
|
84
|
+
n({ type: Boolean })
|
|
85
85
|
], g.prototype, "disabled");
|
|
86
86
|
et([
|
|
87
|
-
|
|
87
|
+
n({ type: Boolean })
|
|
88
88
|
], g.prototype, "readonly");
|
|
89
89
|
et([
|
|
90
|
-
|
|
90
|
+
n({ type: Boolean })
|
|
91
91
|
], g.prototype, "required");
|
|
92
92
|
et([
|
|
93
|
-
|
|
93
|
+
n({ attribute: !1 })
|
|
94
94
|
], g.prototype, "error");
|
|
95
95
|
const se = {
|
|
96
96
|
copy: D`<rect x="6" y="6" width="8" height="8" rx="1.5"/><path d="M10 6V4.5A1.5 1.5 0 0 0 8.5 3H4.5A1.5 1.5 0 0 0 3 4.5v4A1.5 1.5 0 0 0 4.5 10H6"/>`,
|
|
@@ -104,7 +104,7 @@ const se = {
|
|
|
104
104
|
search: D`<circle cx="7" cy="7" r="4"/><path d="m13 13-3.2-3.2"/>`
|
|
105
105
|
};
|
|
106
106
|
function J(t) {
|
|
107
|
-
return
|
|
107
|
+
return l`<svg
|
|
108
108
|
class="baht-icon"
|
|
109
109
|
width="16"
|
|
110
110
|
height="16"
|
|
@@ -117,15 +117,15 @@ function J(t) {
|
|
|
117
117
|
aria-hidden="true"
|
|
118
118
|
>${se[t]}</svg>`;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function fe(t) {
|
|
121
121
|
return t in se;
|
|
122
122
|
}
|
|
123
|
-
var
|
|
124
|
-
for (var s =
|
|
125
|
-
(o = t[i]) && (s = (
|
|
126
|
-
return
|
|
123
|
+
var me = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, F = (t, e, r, a) => {
|
|
124
|
+
for (var s = a > 1 ? void 0 : a ? ye(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
125
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
126
|
+
return a && s && me(e, r, s), s;
|
|
127
127
|
};
|
|
128
|
-
let E = class extends
|
|
128
|
+
let E = class extends d {
|
|
129
129
|
constructor() {
|
|
130
130
|
super(...arguments), this.variant = "primary", this.size = "md", this.disabled = !1, this.type = "button", this.label = "", this.icon = "", this.iconOnly = !1;
|
|
131
131
|
}
|
|
@@ -133,48 +133,48 @@ let E = class extends c {
|
|
|
133
133
|
this.iconOnly || st(this, this.buttonEl);
|
|
134
134
|
}
|
|
135
135
|
render() {
|
|
136
|
-
const t = this.variant === "primary" ? "" : ` baht-button--${this.variant}`, e = this.size === "md" ? "" : ` baht-button--${this.size}`,
|
|
137
|
-
return
|
|
138
|
-
class="baht-button${t}${e}${
|
|
136
|
+
const t = this.variant === "primary" ? "" : ` baht-button--${this.variant}`, e = this.size === "md" ? "" : ` baht-button--${this.size}`, r = this.iconOnly ? " baht-button--icon" : "", a = this.icon && fe(this.icon) ? J(this.icon) : h;
|
|
137
|
+
return l`<button
|
|
138
|
+
class="baht-button${t}${e}${r}"
|
|
139
139
|
type=${this.type}
|
|
140
140
|
aria-label=${this.iconOnly && this.label ? this.label : h}
|
|
141
141
|
?disabled=${this.disabled}
|
|
142
|
-
>${
|
|
142
|
+
>${a}${this.iconOnly ? h : this.label}</button>`;
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
F([
|
|
146
|
+
n()
|
|
147
147
|
], E.prototype, "variant", 2);
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
F([
|
|
149
|
+
n()
|
|
150
150
|
], E.prototype, "size", 2);
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
F([
|
|
152
|
+
n({ type: Boolean })
|
|
153
153
|
], E.prototype, "disabled", 2);
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
F([
|
|
155
|
+
n()
|
|
156
156
|
], E.prototype, "type", 2);
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
F([
|
|
158
|
+
n()
|
|
159
159
|
], E.prototype, "label", 2);
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
F([
|
|
161
|
+
n()
|
|
162
162
|
], E.prototype, "icon", 2);
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
F([
|
|
164
|
+
n({ type: Boolean, attribute: "icon-only" })
|
|
165
165
|
], E.prototype, "iconOnly", 2);
|
|
166
|
-
|
|
166
|
+
F([
|
|
167
167
|
tt("button")
|
|
168
168
|
], E.prototype, "buttonEl", 2);
|
|
169
|
-
E =
|
|
169
|
+
E = F([
|
|
170
170
|
p("baht-button")
|
|
171
171
|
], E);
|
|
172
|
-
var
|
|
173
|
-
for (var s =
|
|
174
|
-
(o = t[i]) && (s = (
|
|
175
|
-
return
|
|
172
|
+
var $e = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, kt = (t, e, r, a) => {
|
|
173
|
+
for (var s = a > 1 ? void 0 : a ? ge(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
174
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
175
|
+
return a && s && $e(e, r, s), s;
|
|
176
176
|
};
|
|
177
|
-
let ht = class extends
|
|
177
|
+
let ht = class extends d {
|
|
178
178
|
constructor() {
|
|
179
179
|
super(...arguments), this.tone = "neutral", this.label = "", this.dot = null;
|
|
180
180
|
}
|
|
@@ -183,29 +183,29 @@ let ht = class extends c {
|
|
|
183
183
|
}
|
|
184
184
|
render() {
|
|
185
185
|
const t = this.tone === "neutral" ? "" : ` baht-badge--${this.tone}`;
|
|
186
|
-
return
|
|
187
|
-
${this.showDot ?
|
|
186
|
+
return l`<span class="baht-badge${t}">
|
|
187
|
+
${this.showDot ? l`<span class="baht-badge-dot" aria-hidden="true"></span>` : h}${this.label}
|
|
188
188
|
</span>`;
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
kt([
|
|
192
|
-
|
|
192
|
+
n()
|
|
193
193
|
], ht.prototype, "tone", 2);
|
|
194
194
|
kt([
|
|
195
|
-
|
|
195
|
+
n()
|
|
196
196
|
], ht.prototype, "label", 2);
|
|
197
197
|
kt([
|
|
198
|
-
|
|
198
|
+
n({ attribute: !1 })
|
|
199
199
|
], ht.prototype, "dot", 2);
|
|
200
200
|
ht = kt([
|
|
201
201
|
p("baht-badge")
|
|
202
202
|
], ht);
|
|
203
|
-
var
|
|
204
|
-
for (var s =
|
|
205
|
-
(o = t[i]) && (s = (
|
|
206
|
-
return
|
|
203
|
+
var we = Object.defineProperty, _e = Object.getOwnPropertyDescriptor, Rt = (t, e, r, a) => {
|
|
204
|
+
for (var s = a > 1 ? void 0 : a ? _e(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
205
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
206
|
+
return a && s && we(e, r, s), s;
|
|
207
207
|
};
|
|
208
|
-
let xt = class extends
|
|
208
|
+
let xt = class extends d {
|
|
209
209
|
constructor() {
|
|
210
210
|
super(...arguments), this.variant = "inline", this.code = "";
|
|
211
211
|
}
|
|
@@ -214,24 +214,24 @@ let xt = class extends c {
|
|
|
214
214
|
t && st(this, t);
|
|
215
215
|
}
|
|
216
216
|
render() {
|
|
217
|
-
return this.variant === "block" ?
|
|
217
|
+
return this.variant === "block" ? l`<pre class="baht-code baht-code--block" tabindex="0">${this.code}</pre>` : l`<code class="baht-code">${this.code}</code>`;
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
Rt([
|
|
221
|
+
n()
|
|
222
222
|
], xt.prototype, "variant", 2);
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
Rt([
|
|
224
|
+
n()
|
|
225
225
|
], xt.prototype, "code", 2);
|
|
226
|
-
xt =
|
|
226
|
+
xt = Rt([
|
|
227
227
|
p("baht-code")
|
|
228
228
|
], xt);
|
|
229
|
-
var
|
|
230
|
-
for (var s =
|
|
231
|
-
(o = t[i]) && (s = (
|
|
232
|
-
return
|
|
229
|
+
var xe = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, U = (t, e, r, a) => {
|
|
230
|
+
for (var s = a > 1 ? void 0 : a ? Oe(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
231
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
232
|
+
return a && s && xe(e, r, s), s;
|
|
233
233
|
};
|
|
234
|
-
let
|
|
234
|
+
let N = class extends d {
|
|
235
235
|
constructor() {
|
|
236
236
|
super(...arguments), this.page = 1, this.totalPages = 1, this.variant = "numbered", this.siblings = 1, this.hasNext = !1, this.hasPrev = !1;
|
|
237
237
|
}
|
|
@@ -256,62 +256,62 @@ let F = class extends c {
|
|
|
256
256
|
}
|
|
257
257
|
/** Visible page numbers with `null` marking an ellipsis gap. */
|
|
258
258
|
get pageItems() {
|
|
259
|
-
const { page: t, totalPages: e, siblings:
|
|
260
|
-
for (let
|
|
261
|
-
|
|
262
|
-
const s = [...
|
|
259
|
+
const { page: t, totalPages: e, siblings: r } = this, a = /* @__PURE__ */ new Set([1, e]);
|
|
260
|
+
for (let c = t - r; c <= t + r; c++)
|
|
261
|
+
c >= 1 && c <= e && a.add(c);
|
|
262
|
+
const s = [...a].sort((c, b) => c - b), i = [];
|
|
263
263
|
let o = 0;
|
|
264
|
-
for (const
|
|
265
|
-
o &&
|
|
264
|
+
for (const c of s)
|
|
265
|
+
o && c - o === 2 ? i.push(o + 1) : o && c - o > 2 && i.push(null), i.push(c), o = c;
|
|
266
266
|
return i;
|
|
267
267
|
}
|
|
268
268
|
render() {
|
|
269
269
|
if (this.variant === "cursor")
|
|
270
|
-
return
|
|
270
|
+
return l`<nav class="baht-pagination baht-pagination--cursor" aria-label="Pagination">
|
|
271
271
|
<button type="button" ?disabled=${!this.hasPrev} @click=${() => this.goCursor("prev")}>« Prev</button>
|
|
272
272
|
<button type="button" ?disabled=${!this.hasNext} @click=${() => this.goCursor("next")}>Next »</button>
|
|
273
273
|
</nav>`;
|
|
274
274
|
const t = this.page <= 1, e = this.page >= this.totalPages;
|
|
275
|
-
return
|
|
275
|
+
return l`<nav class="baht-pagination" aria-label="Pagination">
|
|
276
276
|
<button type="button" aria-label="Previous page" ?disabled=${t} @click=${() => this.go(this.page - 1)}>«</button>
|
|
277
|
-
${this.variant === "compact" ?
|
|
278
|
-
(
|
|
277
|
+
${this.variant === "compact" ? l`<span class="baht-pagination-label">Page ${this.page} of ${this.totalPages}</span>` : this.pageItems.map(
|
|
278
|
+
(r) => r === null ? l`<span class="baht-pagination-ellipsis">…</span>` : l`<button
|
|
279
279
|
type="button"
|
|
280
|
-
aria-current=${
|
|
281
|
-
@click=${() => this.go(
|
|
282
|
-
>${
|
|
280
|
+
aria-current=${r === this.page ? "page" : h}
|
|
281
|
+
@click=${() => this.go(r)}
|
|
282
|
+
>${r}</button>`
|
|
283
283
|
)}
|
|
284
284
|
<button type="button" aria-label="Next page" ?disabled=${e} @click=${() => this.go(this.page + 1)}>»</button>
|
|
285
285
|
</nav>`;
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
288
|
U([
|
|
289
|
-
|
|
290
|
-
],
|
|
289
|
+
n({ type: Number })
|
|
290
|
+
], N.prototype, "page", 2);
|
|
291
291
|
U([
|
|
292
|
-
|
|
293
|
-
],
|
|
292
|
+
n({ type: Number, attribute: "total-pages" })
|
|
293
|
+
], N.prototype, "totalPages", 2);
|
|
294
294
|
U([
|
|
295
|
-
|
|
296
|
-
],
|
|
295
|
+
n()
|
|
296
|
+
], N.prototype, "variant", 2);
|
|
297
297
|
U([
|
|
298
|
-
|
|
299
|
-
],
|
|
298
|
+
n({ type: Number })
|
|
299
|
+
], N.prototype, "siblings", 2);
|
|
300
300
|
U([
|
|
301
|
-
|
|
302
|
-
],
|
|
301
|
+
n({ type: Boolean, attribute: "has-next" })
|
|
302
|
+
], N.prototype, "hasNext", 2);
|
|
303
303
|
U([
|
|
304
|
-
|
|
305
|
-
],
|
|
306
|
-
|
|
304
|
+
n({ type: Boolean, attribute: "has-prev" })
|
|
305
|
+
], N.prototype, "hasPrev", 2);
|
|
306
|
+
N = U([
|
|
307
307
|
p("baht-pagination")
|
|
308
|
-
],
|
|
309
|
-
var
|
|
310
|
-
for (var s =
|
|
311
|
-
(o = t[i]) && (s = (
|
|
312
|
-
return
|
|
308
|
+
], N);
|
|
309
|
+
var Pe = Object.defineProperty, ke = Object.getOwnPropertyDescriptor, f = (t, e, r, a) => {
|
|
310
|
+
for (var s = a > 1 ? void 0 : a ? ke(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
311
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
312
|
+
return a && s && Pe(e, r, s), s;
|
|
313
313
|
};
|
|
314
|
-
let u = class extends
|
|
314
|
+
let u = class extends d {
|
|
315
315
|
constructor() {
|
|
316
316
|
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.onPickerKeydown = (t) => {
|
|
317
317
|
t.key === "Escape" && this.closePicker();
|
|
@@ -326,7 +326,7 @@ let u = class extends c {
|
|
|
326
326
|
}
|
|
327
327
|
get columnKeys() {
|
|
328
328
|
const t = this.allColumnKeys;
|
|
329
|
-
return (this.pickedColumns ?? (this.visibleColumns.length > 0 ? this.visibleColumns : t)).filter((
|
|
329
|
+
return (this.pickedColumns ?? (this.visibleColumns.length > 0 ? this.visibleColumns : t)).filter((r) => t.includes(r));
|
|
330
330
|
}
|
|
331
331
|
openPicker() {
|
|
332
332
|
this.draftColumns = this.columnKeys.slice(), this.pickAvail = [], this.pickSel = [], this.pickerOpen = !0, document.addEventListener("keydown", this.onPickerKeydown);
|
|
@@ -347,10 +347,10 @@ let u = class extends c {
|
|
|
347
347
|
this.draftColumns = this.draftColumns.filter((t) => !this.pickSel.includes(t)), this.pickSel = [];
|
|
348
348
|
}
|
|
349
349
|
moveSelected(t) {
|
|
350
|
-
const e = [...this.draftColumns],
|
|
351
|
-
for (const
|
|
352
|
-
const s =
|
|
353
|
-
s < 0 || s >= e.length || ([e[
|
|
350
|
+
const e = [...this.draftColumns], r = this.pickSel.map((a) => e.indexOf(a)).filter((a) => a >= 0).sort((a, s) => t === -1 ? a - s : s - a);
|
|
351
|
+
for (const a of r) {
|
|
352
|
+
const s = a + t;
|
|
353
|
+
s < 0 || s >= e.length || ([e[a], e[s]] = [e[s], e[a]]);
|
|
354
354
|
}
|
|
355
355
|
this.draftColumns = e;
|
|
356
356
|
}
|
|
@@ -376,32 +376,32 @@ let u = class extends c {
|
|
|
376
376
|
);
|
|
377
377
|
}
|
|
378
378
|
cell(t, e) {
|
|
379
|
-
const
|
|
380
|
-
return
|
|
379
|
+
const r = this.renderers[e], a = t[e];
|
|
380
|
+
return r ? r(a, t) : a == null ? "" : String(a);
|
|
381
381
|
}
|
|
382
382
|
renderBody(t) {
|
|
383
383
|
const e = t.length + (this.showIndex ? 1 : 0);
|
|
384
|
-
return this.loading ?
|
|
384
|
+
return this.loading ? l`${Array.from(
|
|
385
385
|
{ length: this.skeletonRows },
|
|
386
|
-
(
|
|
387
|
-
${this.showIndex ?
|
|
388
|
-
${t.map(() =>
|
|
386
|
+
(r, a) => l`<tr>
|
|
387
|
+
${this.showIndex ? l`<td class="baht-table-index">${this.indexOffset + a + 1}</td>` : h}
|
|
388
|
+
${t.map(() => l`<td><span class="baht-skeleton" style="height:16px;"></span></td>`)}
|
|
389
389
|
</tr>`
|
|
390
|
-
)}` : this.error ?
|
|
391
|
-
(
|
|
390
|
+
)}` : this.error ? l`<tr><td colspan=${e}><div class="baht-table-state baht-table-state--error">${this.errorMessage}</div></td></tr>` : this.items.length === 0 ? l`<tr><td colspan=${e}><div class="baht-table-state">${this.emptyMessage}</div></td></tr>` : l`${this.items.map(
|
|
391
|
+
(r, a) => l`<tr
|
|
392
392
|
tabindex=${this.clickable ? "0" : h}
|
|
393
|
-
@click=${() => this.emitRow(
|
|
393
|
+
@click=${() => this.emitRow(r, a)}
|
|
394
394
|
@keydown=${(s) => {
|
|
395
|
-
s.key !== "Enter" && s.key !== " " || (s.preventDefault(), this.emitRow(
|
|
395
|
+
s.key !== "Enter" && s.key !== " " || (s.preventDefault(), this.emitRow(r, a));
|
|
396
396
|
}}
|
|
397
397
|
>
|
|
398
|
-
${this.showIndex ?
|
|
399
|
-
${t.map((s) =>
|
|
398
|
+
${this.showIndex ? l`<td class="baht-table-index">${this.indexOffset + a + 1}</td>` : h}
|
|
399
|
+
${t.map((s) => l`<td data-col=${s}>${this.cell(r, s)}</td>`)}
|
|
400
400
|
</tr>`
|
|
401
401
|
)}`;
|
|
402
402
|
}
|
|
403
403
|
renderColumnToggle() {
|
|
404
|
-
return
|
|
404
|
+
return l`<div class="baht-table-picker">
|
|
405
405
|
<button
|
|
406
406
|
type="button"
|
|
407
407
|
class="baht-table-picker-toggle"
|
|
@@ -412,10 +412,10 @@ let u = class extends c {
|
|
|
412
412
|
</div>`;
|
|
413
413
|
}
|
|
414
414
|
renderColumnModal() {
|
|
415
|
-
const t = this.allColumnKeys, e = t.filter((
|
|
416
|
-
return
|
|
415
|
+
const t = this.allColumnKeys, e = t.filter((a) => !this.draftColumns.includes(a)), r = (a) => (s) => a(u.selectedValues(s));
|
|
416
|
+
return l`<div
|
|
417
417
|
class="baht-table-picker-scrim"
|
|
418
|
-
@click=${(
|
|
418
|
+
@click=${(a) => a.target === a.currentTarget && this.closePicker()}
|
|
419
419
|
>
|
|
420
420
|
<div class="baht-table-picker-modal" role="dialog" aria-modal="true" aria-label="Choose columns">
|
|
421
421
|
<div class="baht-table-picker-modal-head">
|
|
@@ -425,9 +425,9 @@ let u = class extends c {
|
|
|
425
425
|
<div class="baht-table-picker-grid">
|
|
426
426
|
<div>
|
|
427
427
|
<div class="baht-table-picker-collabel">Available (${e.length})</div>
|
|
428
|
-
<select multiple size="10" class="baht-table-picker-select" @change=${
|
|
428
|
+
<select multiple size="10" class="baht-table-picker-select" @change=${r((a) => this.pickAvail = a)}>
|
|
429
429
|
${e.map(
|
|
430
|
-
(
|
|
430
|
+
(a) => l`<option value=${a} ?selected=${this.pickAvail.includes(a)}>${this.labelFor(a)}</option>`
|
|
431
431
|
)}
|
|
432
432
|
</select>
|
|
433
433
|
</div>
|
|
@@ -439,9 +439,9 @@ let u = class extends c {
|
|
|
439
439
|
</div>
|
|
440
440
|
<div>
|
|
441
441
|
<div class="baht-table-picker-collabel">Selected (${this.draftColumns.length})</div>
|
|
442
|
-
<select multiple size="10" class="baht-table-picker-select" @change=${
|
|
442
|
+
<select multiple size="10" class="baht-table-picker-select" @change=${r((a) => this.pickSel = a)}>
|
|
443
443
|
${this.draftColumns.map(
|
|
444
|
-
(
|
|
444
|
+
(a) => l`<option value=${a} ?selected=${this.pickSel.includes(a)}>${this.labelFor(a)}</option>`
|
|
445
445
|
)}
|
|
446
446
|
</select>
|
|
447
447
|
</div>
|
|
@@ -458,7 +458,7 @@ let u = class extends c {
|
|
|
458
458
|
}
|
|
459
459
|
render() {
|
|
460
460
|
const t = this.columnKeys;
|
|
461
|
-
return
|
|
461
|
+
return l`<div
|
|
462
462
|
class="baht-table-wrap"
|
|
463
463
|
tabindex=${this.clickable ? h : "0"}
|
|
464
464
|
aria-busy=${this.loading ? "true" : h}
|
|
@@ -468,19 +468,19 @@ let u = class extends c {
|
|
|
468
468
|
<table class="baht-table">
|
|
469
469
|
<thead>
|
|
470
470
|
<tr>
|
|
471
|
-
${this.showIndex ?
|
|
472
|
-
${t.map((e) =>
|
|
471
|
+
${this.showIndex ? l`<th scope="col" class="baht-table-index">No.</th>` : h}
|
|
472
|
+
${t.map((e) => l`<th scope="col" data-col=${e}>${this.labelFor(e)}</th>`)}
|
|
473
473
|
</tr>
|
|
474
474
|
</thead>
|
|
475
475
|
<tbody>${this.renderBody(t)}</tbody>
|
|
476
476
|
</table>
|
|
477
|
-
${this.cursorMode ?
|
|
477
|
+
${this.cursorMode ? l`<div class="baht-table-footer">
|
|
478
478
|
<baht-pagination
|
|
479
479
|
variant="cursor"
|
|
480
480
|
?has-next=${this.hasNext}
|
|
481
481
|
?has-prev=${this.hasPrev}
|
|
482
482
|
></baht-pagination>
|
|
483
|
-
</div>` : this.totalPages > 1 ?
|
|
483
|
+
</div>` : this.totalPages > 1 ? l`<div class="baht-table-footer">
|
|
484
484
|
<baht-pagination
|
|
485
485
|
variant="compact"
|
|
486
486
|
page=${this.page}
|
|
@@ -491,61 +491,61 @@ let u = class extends c {
|
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
493
|
f([
|
|
494
|
-
|
|
494
|
+
n({ attribute: !1 })
|
|
495
495
|
], u.prototype, "items", 2);
|
|
496
496
|
f([
|
|
497
|
-
|
|
497
|
+
n({ attribute: !1 })
|
|
498
498
|
], u.prototype, "columns", 2);
|
|
499
499
|
f([
|
|
500
|
-
|
|
500
|
+
n({ type: Boolean })
|
|
501
501
|
], u.prototype, "loading", 2);
|
|
502
502
|
f([
|
|
503
|
-
|
|
503
|
+
n({ type: Boolean })
|
|
504
504
|
], u.prototype, "error", 2);
|
|
505
505
|
f([
|
|
506
|
-
|
|
506
|
+
n({ attribute: "error-message" })
|
|
507
507
|
], u.prototype, "errorMessage", 2);
|
|
508
508
|
f([
|
|
509
|
-
|
|
509
|
+
n({ attribute: "empty-message" })
|
|
510
510
|
], u.prototype, "emptyMessage", 2);
|
|
511
511
|
f([
|
|
512
|
-
|
|
512
|
+
n({ type: Boolean, attribute: "show-index" })
|
|
513
513
|
], u.prototype, "showIndex", 2);
|
|
514
514
|
f([
|
|
515
|
-
|
|
515
|
+
n({ type: Number, attribute: "index-offset" })
|
|
516
516
|
], u.prototype, "indexOffset", 2);
|
|
517
517
|
f([
|
|
518
|
-
|
|
518
|
+
n({ type: Number, attribute: "skeleton-rows" })
|
|
519
519
|
], u.prototype, "skeletonRows", 2);
|
|
520
520
|
f([
|
|
521
|
-
|
|
521
|
+
n({ attribute: "row-key" })
|
|
522
522
|
], u.prototype, "rowKey", 2);
|
|
523
523
|
f([
|
|
524
|
-
|
|
524
|
+
n({ type: Boolean })
|
|
525
525
|
], u.prototype, "clickable", 2);
|
|
526
526
|
f([
|
|
527
|
-
|
|
527
|
+
n({ attribute: !1 })
|
|
528
528
|
], u.prototype, "renderers", 2);
|
|
529
529
|
f([
|
|
530
|
-
|
|
530
|
+
n({ attribute: !1 })
|
|
531
531
|
], u.prototype, "visibleColumns", 2);
|
|
532
532
|
f([
|
|
533
|
-
|
|
533
|
+
n({ type: Boolean, attribute: "column-picker" })
|
|
534
534
|
], u.prototype, "columnPicker", 2);
|
|
535
535
|
f([
|
|
536
|
-
|
|
536
|
+
n({ type: Number })
|
|
537
537
|
], u.prototype, "page", 2);
|
|
538
538
|
f([
|
|
539
|
-
|
|
539
|
+
n({ type: Number, attribute: "total-pages" })
|
|
540
540
|
], u.prototype, "totalPages", 2);
|
|
541
541
|
f([
|
|
542
|
-
|
|
542
|
+
n({ type: Boolean, attribute: "cursor-mode" })
|
|
543
543
|
], u.prototype, "cursorMode", 2);
|
|
544
544
|
f([
|
|
545
|
-
|
|
545
|
+
n({ type: Boolean, attribute: "has-next" })
|
|
546
546
|
], u.prototype, "hasNext", 2);
|
|
547
547
|
f([
|
|
548
|
-
|
|
548
|
+
n({ type: Boolean, attribute: "has-prev" })
|
|
549
549
|
], u.prototype, "hasPrev", 2);
|
|
550
550
|
f([
|
|
551
551
|
v()
|
|
@@ -565,12 +565,12 @@ f([
|
|
|
565
565
|
u = f([
|
|
566
566
|
p("baht-table")
|
|
567
567
|
], u);
|
|
568
|
-
var
|
|
569
|
-
for (var s =
|
|
570
|
-
(o = t[i]) && (s = (
|
|
571
|
-
return
|
|
568
|
+
var Ce = Object.defineProperty, De = Object.getOwnPropertyDescriptor, R = (t, e, r, a) => {
|
|
569
|
+
for (var s = a > 1 ? void 0 : a ? De(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
570
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
571
|
+
return a && s && Ce(e, r, s), s;
|
|
572
572
|
};
|
|
573
|
-
let j = class extends
|
|
573
|
+
let j = class extends d {
|
|
574
574
|
constructor() {
|
|
575
575
|
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;
|
|
576
576
|
}
|
|
@@ -584,67 +584,67 @@ let j = class extends c {
|
|
|
584
584
|
);
|
|
585
585
|
}
|
|
586
586
|
renderRows() {
|
|
587
|
-
return this.loading ?
|
|
587
|
+
return this.loading ? l`${Array.from(
|
|
588
588
|
{ length: this.skeletonRows },
|
|
589
|
-
() =>
|
|
589
|
+
() => l`<div class="baht-list-item">
|
|
590
590
|
<div class="baht-list-main">
|
|
591
591
|
<span class="baht-skeleton baht-skeleton--text" style="width:40%; margin-bottom:6px;"></span>
|
|
592
592
|
<span class="baht-skeleton baht-skeleton--text" style="width:65%;"></span>
|
|
593
593
|
</div>
|
|
594
594
|
</div>`
|
|
595
|
-
)}` : this.error ?
|
|
596
|
-
(t, e) =>
|
|
595
|
+
)}` : this.error ? l`<div class="baht-list-state baht-list-state--error">${this.errorMessage}</div>` : this.items.length === 0 ? l`<div class="baht-list-state">${this.emptyMessage}</div>` : l`${this.items.map(
|
|
596
|
+
(t, e) => l`<div
|
|
597
597
|
class="baht-list-item"
|
|
598
598
|
role="listitem"
|
|
599
599
|
tabindex=${this.clickable ? "0" : h}
|
|
600
600
|
@click=${() => this.emitItem(t, e)}
|
|
601
|
-
@keydown=${(
|
|
602
|
-
|
|
601
|
+
@keydown=${(r) => {
|
|
602
|
+
r.key !== "Enter" && r.key !== " " || (r.preventDefault(), this.emitItem(t, e));
|
|
603
603
|
}}
|
|
604
604
|
>
|
|
605
605
|
<div class="baht-list-main">
|
|
606
606
|
<div class="baht-list-title">${t.title}</div>
|
|
607
|
-
${t.subtitle ?
|
|
607
|
+
${t.subtitle ? l`<div class="baht-list-subtitle">${t.subtitle}</div>` : h}
|
|
608
608
|
</div>
|
|
609
|
-
${t.badge ?
|
|
610
|
-
${t.meta ?
|
|
609
|
+
${t.badge ? l`<baht-badge tone=${t.badgeTone ?? "neutral"} label=${t.badge}></baht-badge>` : h}
|
|
610
|
+
${t.meta ? l`<span class="baht-list-meta">${t.meta}</span>` : h}
|
|
611
611
|
</div>`
|
|
612
612
|
)}`;
|
|
613
613
|
}
|
|
614
614
|
render() {
|
|
615
|
-
return
|
|
615
|
+
return l`<div class="baht-list" role="list">${this.renderRows()}</div>`;
|
|
616
616
|
}
|
|
617
617
|
};
|
|
618
|
-
|
|
619
|
-
|
|
618
|
+
R([
|
|
619
|
+
n({ attribute: !1 })
|
|
620
620
|
], j.prototype, "items", 2);
|
|
621
|
-
|
|
622
|
-
|
|
621
|
+
R([
|
|
622
|
+
n({ type: Boolean })
|
|
623
623
|
], j.prototype, "loading", 2);
|
|
624
|
-
|
|
625
|
-
|
|
624
|
+
R([
|
|
625
|
+
n({ type: Boolean })
|
|
626
626
|
], j.prototype, "error", 2);
|
|
627
|
-
|
|
628
|
-
|
|
627
|
+
R([
|
|
628
|
+
n({ attribute: "error-message" })
|
|
629
629
|
], j.prototype, "errorMessage", 2);
|
|
630
|
-
|
|
631
|
-
|
|
630
|
+
R([
|
|
631
|
+
n({ attribute: "empty-message" })
|
|
632
632
|
], j.prototype, "emptyMessage", 2);
|
|
633
|
-
|
|
634
|
-
|
|
633
|
+
R([
|
|
634
|
+
n({ type: Number, attribute: "skeleton-rows" })
|
|
635
635
|
], j.prototype, "skeletonRows", 2);
|
|
636
|
-
|
|
637
|
-
|
|
636
|
+
R([
|
|
637
|
+
n({ type: Boolean })
|
|
638
638
|
], j.prototype, "clickable", 2);
|
|
639
|
-
j =
|
|
639
|
+
j = R([
|
|
640
640
|
p("baht-list")
|
|
641
641
|
], j);
|
|
642
|
-
var
|
|
643
|
-
for (var s =
|
|
644
|
-
(o = t[i]) && (s = (
|
|
645
|
-
return
|
|
642
|
+
var Ee = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, at = (t, e, r, a) => {
|
|
643
|
+
for (var s = a > 1 ? void 0 : a ? Be(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
644
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
645
|
+
return a && s && Ee(e, r, s), s;
|
|
646
646
|
};
|
|
647
|
-
let x = class extends
|
|
647
|
+
let x = class extends d {
|
|
648
648
|
constructor() {
|
|
649
649
|
super(...arguments), this.open = !1, this.heading = "", this.showClose = !0, this.closeOnScrim = !0, this.previousFocus = null, this.onKeydown = (t) => {
|
|
650
650
|
!this.open || x.openStack.at(-1) !== this || (t.key === "Escape" ? this.requestClose("escape") : t.key === "Tab" && this.trapFocus(t));
|
|
@@ -660,17 +660,17 @@ let x = class extends c {
|
|
|
660
660
|
}
|
|
661
661
|
/** Keep Tab cycling inside the dialog (no keyboard escape to the page behind). */
|
|
662
662
|
trapFocus(t) {
|
|
663
|
-
const e = this.focusables(),
|
|
663
|
+
const e = this.focusables(), r = this.querySelector(".baht-modal");
|
|
664
664
|
if (e.length === 0) {
|
|
665
|
-
|
|
665
|
+
r == null || r.focus(), t.preventDefault();
|
|
666
666
|
return;
|
|
667
667
|
}
|
|
668
|
-
const
|
|
668
|
+
const a = e[0], s = e[e.length - 1], i = document.activeElement;
|
|
669
669
|
if (!this.contains(i)) {
|
|
670
|
-
|
|
670
|
+
a.focus(), t.preventDefault();
|
|
671
671
|
return;
|
|
672
672
|
}
|
|
673
|
-
t.shiftKey && (i ===
|
|
673
|
+
t.shiftKey && (i === a || i === r) ? (s.focus(), t.preventDefault()) : !t.shiftKey && i === s && (a.focus(), t.preventDefault());
|
|
674
674
|
}
|
|
675
675
|
connectedCallback() {
|
|
676
676
|
super.connectedCallback(), document.addEventListener("keydown", this.onKeydown);
|
|
@@ -682,10 +682,10 @@ let x = class extends c {
|
|
|
682
682
|
st(this, this.bodyEl);
|
|
683
683
|
}
|
|
684
684
|
updated(t) {
|
|
685
|
-
var e,
|
|
686
|
-
if (t.has("open") && (x.openStack = x.openStack.filter((
|
|
687
|
-
const
|
|
688
|
-
this.previousFocus = null,
|
|
685
|
+
var e, r;
|
|
686
|
+
if (t.has("open") && (x.openStack = x.openStack.filter((a) => a !== this), this.open && x.openStack.push(this)), t.has("open") && this.open && (this.previousFocus = document.activeElement, (e = this.querySelector(".baht-modal")) == null || e.focus()), t.has("open") && !this.open && t.get("open") === !0) {
|
|
687
|
+
const a = this.previousFocus;
|
|
688
|
+
this.previousFocus = null, a != null && a.isConnected && (!document.activeElement || document.activeElement === document.body || this.contains(document.activeElement)) && ((r = a.focus) == null || r.call(a));
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
/** Ask the host to close (the host owns `open`). */
|
|
@@ -695,15 +695,15 @@ let x = class extends c {
|
|
|
695
695
|
);
|
|
696
696
|
}
|
|
697
697
|
render() {
|
|
698
|
-
return
|
|
698
|
+
return l`<div
|
|
699
699
|
class="baht-modal-scrim"
|
|
700
700
|
style=${this.open ? h : "display:none"}
|
|
701
701
|
@click=${(t) => this.closeOnScrim && t.target === t.currentTarget && this.requestClose("scrim")}
|
|
702
702
|
>
|
|
703
703
|
<div class="baht-modal" role="dialog" aria-modal="true" aria-label=${this.heading || "Dialog"} tabindex="-1">
|
|
704
|
-
${this.heading || this.showClose ?
|
|
704
|
+
${this.heading || this.showClose ? l`<header class="baht-modal-header">
|
|
705
705
|
<div class="baht-modal-title">${this.heading}</div>
|
|
706
|
-
${this.showClose ?
|
|
706
|
+
${this.showClose ? l`<button type="button" class="baht-modal-close" aria-label="Close" @click=${() => this.requestClose("button")}>×</button>` : h}
|
|
707
707
|
</header>` : h}
|
|
708
708
|
<div class="baht-modal-body"></div>
|
|
709
709
|
</div>
|
|
@@ -711,30 +711,30 @@ let x = class extends c {
|
|
|
711
711
|
}
|
|
712
712
|
};
|
|
713
713
|
x.openStack = [];
|
|
714
|
-
|
|
715
|
-
|
|
714
|
+
at([
|
|
715
|
+
n({ type: Boolean, reflect: !0 })
|
|
716
716
|
], x.prototype, "open", 2);
|
|
717
|
-
|
|
718
|
-
|
|
717
|
+
at([
|
|
718
|
+
n()
|
|
719
719
|
], x.prototype, "heading", 2);
|
|
720
|
-
|
|
721
|
-
|
|
720
|
+
at([
|
|
721
|
+
n({ type: Boolean, attribute: "show-close" })
|
|
722
722
|
], x.prototype, "showClose", 2);
|
|
723
|
-
|
|
724
|
-
|
|
723
|
+
at([
|
|
724
|
+
n({ type: Boolean, attribute: "close-on-scrim" })
|
|
725
725
|
], x.prototype, "closeOnScrim", 2);
|
|
726
|
-
|
|
726
|
+
at([
|
|
727
727
|
tt(".baht-modal-body")
|
|
728
728
|
], x.prototype, "bodyEl", 2);
|
|
729
|
-
x =
|
|
729
|
+
x = at([
|
|
730
730
|
p("baht-modal")
|
|
731
731
|
], x);
|
|
732
|
-
var
|
|
733
|
-
for (var s =
|
|
734
|
-
(o = t[i]) && (s = (
|
|
735
|
-
return
|
|
732
|
+
var je = Object.defineProperty, Se = Object.getOwnPropertyDescriptor, Lt = (t, e, r, a) => {
|
|
733
|
+
for (var s = a > 1 ? void 0 : a ? Se(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
734
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
735
|
+
return a && s && je(e, r, s), s;
|
|
736
736
|
};
|
|
737
|
-
let W = class extends
|
|
737
|
+
let W = class extends d {
|
|
738
738
|
constructor() {
|
|
739
739
|
super(...arguments), this.duration = 4e3, this.entries = [], this.timers = /* @__PURE__ */ new Map();
|
|
740
740
|
}
|
|
@@ -751,8 +751,8 @@ let W = class extends c {
|
|
|
751
751
|
), e.id;
|
|
752
752
|
}
|
|
753
753
|
dismiss(t) {
|
|
754
|
-
const e = this.entries.find((
|
|
755
|
-
e && (clearTimeout(this.timers.get(t)), this.timers.delete(t), this.entries = this.entries.filter((
|
|
754
|
+
const e = this.entries.find((r) => r.id === t);
|
|
755
|
+
e && (clearTimeout(this.timers.get(t)), this.timers.delete(t), this.entries = this.entries.filter((r) => r.id !== t), this.dispatchEvent(
|
|
756
756
|
new CustomEvent("baht-dismiss", {
|
|
757
757
|
detail: { id: t, message: e.message },
|
|
758
758
|
bubbles: !0,
|
|
@@ -764,10 +764,10 @@ let W = class extends c {
|
|
|
764
764
|
this.timers.forEach((t) => clearTimeout(t)), this.timers.clear(), super.disconnectedCallback();
|
|
765
765
|
}
|
|
766
766
|
render() {
|
|
767
|
-
return
|
|
767
|
+
return l`<div class="baht-toaster" role="status" aria-live="polite">
|
|
768
768
|
${this.entries.map(
|
|
769
769
|
// Danger/warning interrupt (role=alert); the rest ride the polite container.
|
|
770
|
-
(t) =>
|
|
770
|
+
(t) => l`<div
|
|
771
771
|
class="baht-toast ${t.tone === "neutral" ? "" : `baht-toast--${t.tone}`}"
|
|
772
772
|
role=${t.tone === "danger" || t.tone === "warning" ? "alert" : h}
|
|
773
773
|
>
|
|
@@ -779,21 +779,21 @@ let W = class extends c {
|
|
|
779
779
|
}
|
|
780
780
|
};
|
|
781
781
|
W.counter = 0;
|
|
782
|
-
|
|
783
|
-
|
|
782
|
+
Lt([
|
|
783
|
+
n({ type: Number })
|
|
784
784
|
], W.prototype, "duration", 2);
|
|
785
|
-
|
|
785
|
+
Lt([
|
|
786
786
|
v()
|
|
787
787
|
], W.prototype, "entries", 2);
|
|
788
|
-
W =
|
|
788
|
+
W = Lt([
|
|
789
789
|
p("baht-toast")
|
|
790
790
|
], W);
|
|
791
|
-
var
|
|
792
|
-
for (var s =
|
|
793
|
-
(o = t[i]) && (s = (
|
|
794
|
-
return
|
|
791
|
+
var Fe = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor, ft = (t, e, r, a) => {
|
|
792
|
+
for (var s = a > 1 ? void 0 : a ? Ne(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
793
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
794
|
+
return a && s && Fe(e, r, s), s;
|
|
795
795
|
};
|
|
796
|
-
let I = class extends
|
|
796
|
+
let I = class extends d {
|
|
797
797
|
constructor() {
|
|
798
798
|
super(...arguments), this.text = "", this.position = "top", this.dismissed = !1, this.uid = ++I.instances;
|
|
799
799
|
}
|
|
@@ -821,7 +821,7 @@ let I = class extends c {
|
|
|
821
821
|
this.dismissed = !1;
|
|
822
822
|
}
|
|
823
823
|
render() {
|
|
824
|
-
return
|
|
824
|
+
return l`<span
|
|
825
825
|
class="baht-tooltip-host${this.dismissed ? " baht-tooltip-host--dismissed" : ""}"
|
|
826
826
|
@keydown=${this.onKeydown}
|
|
827
827
|
@mouseleave=${this.rearm}
|
|
@@ -834,10 +834,10 @@ let I = class extends c {
|
|
|
834
834
|
};
|
|
835
835
|
I.instances = 0;
|
|
836
836
|
ft([
|
|
837
|
-
|
|
837
|
+
n()
|
|
838
838
|
], I.prototype, "text", 2);
|
|
839
839
|
ft([
|
|
840
|
-
|
|
840
|
+
n()
|
|
841
841
|
], I.prototype, "position", 2);
|
|
842
842
|
ft([
|
|
843
843
|
tt(".baht-tooltip-anchor")
|
|
@@ -848,12 +848,12 @@ ft([
|
|
|
848
848
|
I = ft([
|
|
849
849
|
p("baht-tooltip")
|
|
850
850
|
], I);
|
|
851
|
-
var
|
|
852
|
-
for (var s =
|
|
853
|
-
(o = t[i]) && (s = (
|
|
854
|
-
return
|
|
851
|
+
var Ie = Object.defineProperty, qe = Object.getOwnPropertyDescriptor, rt = (t, e, r, a) => {
|
|
852
|
+
for (var s = a > 1 ? void 0 : a ? qe(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
853
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
854
|
+
return a && s && Ie(e, r, s), s;
|
|
855
855
|
};
|
|
856
|
-
let A = class extends
|
|
856
|
+
let A = class extends d {
|
|
857
857
|
constructor() {
|
|
858
858
|
super(...arguments), this.tone = "info", this.heading = "", this.message = "", this.dismissible = !1, this.dismissed = !1;
|
|
859
859
|
}
|
|
@@ -864,39 +864,39 @@ let A = class extends c {
|
|
|
864
864
|
this.dismissed = !0, this.dispatchEvent(new CustomEvent("baht-dismiss", { bubbles: !0, composed: !0 }));
|
|
865
865
|
}
|
|
866
866
|
render() {
|
|
867
|
-
return this.dismissed ? h :
|
|
867
|
+
return this.dismissed ? h : l`<div class="baht-alert baht-alert--${this.tone}" role="alert">
|
|
868
868
|
<div class="baht-alert-main">
|
|
869
|
-
${this.heading ?
|
|
870
|
-
${this.message ?
|
|
869
|
+
${this.heading ? l`<div class="baht-alert-title">${this.heading}</div>` : h}
|
|
870
|
+
${this.message ? l`<div class="baht-alert-message">${this.message}</div>` : h}
|
|
871
871
|
</div>
|
|
872
|
-
${this.dismissible ?
|
|
872
|
+
${this.dismissible ? l`<button type="button" class="baht-alert-dismiss" aria-label="Dismiss" @click=${() => this.dismiss()}>×</button>` : h}
|
|
873
873
|
</div>`;
|
|
874
874
|
}
|
|
875
875
|
};
|
|
876
|
-
|
|
877
|
-
|
|
876
|
+
rt([
|
|
877
|
+
n()
|
|
878
878
|
], A.prototype, "tone", 2);
|
|
879
|
-
|
|
880
|
-
|
|
879
|
+
rt([
|
|
880
|
+
n()
|
|
881
881
|
], A.prototype, "heading", 2);
|
|
882
|
-
|
|
883
|
-
|
|
882
|
+
rt([
|
|
883
|
+
n()
|
|
884
884
|
], A.prototype, "message", 2);
|
|
885
|
-
|
|
886
|
-
|
|
885
|
+
rt([
|
|
886
|
+
n({ type: Boolean })
|
|
887
887
|
], A.prototype, "dismissible", 2);
|
|
888
|
-
|
|
888
|
+
rt([
|
|
889
889
|
v()
|
|
890
890
|
], A.prototype, "dismissed", 2);
|
|
891
|
-
A =
|
|
891
|
+
A = rt([
|
|
892
892
|
p("baht-alert")
|
|
893
893
|
], A);
|
|
894
|
-
var
|
|
895
|
-
for (var s =
|
|
896
|
-
(o = t[i]) && (s = (
|
|
897
|
-
return
|
|
894
|
+
var Me = Object.defineProperty, Re = Object.getOwnPropertyDescriptor, it = (t, e, r, a) => {
|
|
895
|
+
for (var s = a > 1 ? void 0 : a ? Re(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
896
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
897
|
+
return a && s && Me(e, r, s), s;
|
|
898
898
|
};
|
|
899
|
-
let T = class extends
|
|
899
|
+
let T = class extends d {
|
|
900
900
|
constructor() {
|
|
901
901
|
super(...arguments), this.value = 0, this.max = 5, this.readonly = !1, this.label = "Rating", this.hover = 0;
|
|
902
902
|
}
|
|
@@ -910,56 +910,56 @@ let T = class extends c {
|
|
|
910
910
|
}
|
|
911
911
|
/** APG radio-group keys: arrows move the value, Home/End jump the ends. */
|
|
912
912
|
onKeydown(t, e) {
|
|
913
|
-
var
|
|
913
|
+
var a;
|
|
914
914
|
if (this.readonly) return;
|
|
915
|
-
let
|
|
916
|
-
if (t.key === "ArrowRight" || t.key === "ArrowUp")
|
|
917
|
-
else if (t.key === "ArrowLeft" || t.key === "ArrowDown")
|
|
918
|
-
else if (t.key === "Home")
|
|
919
|
-
else if (t.key === "End")
|
|
915
|
+
let r;
|
|
916
|
+
if (t.key === "ArrowRight" || t.key === "ArrowUp") r = Math.min(e + 1, this.max);
|
|
917
|
+
else if (t.key === "ArrowLeft" || t.key === "ArrowDown") r = Math.max(e - 1, 1);
|
|
918
|
+
else if (t.key === "Home") r = 1;
|
|
919
|
+
else if (t.key === "End") r = this.max;
|
|
920
920
|
else return;
|
|
921
|
-
t.preventDefault(), this.emitValue(
|
|
921
|
+
t.preventDefault(), this.emitValue(r), (a = this.querySelectorAll("button")[r - 1]) == null || a.focus();
|
|
922
922
|
}
|
|
923
923
|
setHover(t) {
|
|
924
924
|
this.readonly || (this.hover = t);
|
|
925
925
|
}
|
|
926
926
|
render() {
|
|
927
927
|
const t = this.hover || this.value;
|
|
928
|
-
return
|
|
928
|
+
return l`<div
|
|
929
929
|
class="baht-rating"
|
|
930
930
|
role="radiogroup"
|
|
931
931
|
aria-label=${this.label}
|
|
932
932
|
@mouseleave=${() => this.setHover(0)}
|
|
933
933
|
>
|
|
934
|
-
${Array.from({ length: this.max }, (e,
|
|
935
|
-
const
|
|
936
|
-
return
|
|
934
|
+
${Array.from({ length: this.max }, (e, r) => {
|
|
935
|
+
const a = r + 1, s = this.value || 1;
|
|
936
|
+
return l`<button
|
|
937
937
|
type="button"
|
|
938
|
-
class=${
|
|
938
|
+
class=${a <= t ? "baht-rating--on" : ""}
|
|
939
939
|
role="radio"
|
|
940
|
-
aria-checked=${
|
|
941
|
-
aria-label="${
|
|
942
|
-
tabindex=${
|
|
940
|
+
aria-checked=${a === this.value}
|
|
941
|
+
aria-label="${a} of ${this.max}"
|
|
942
|
+
tabindex=${a === s ? "0" : "-1"}
|
|
943
943
|
?disabled=${this.readonly}
|
|
944
|
-
@mouseenter=${() => this.setHover(
|
|
945
|
-
@click=${() => this.pick(
|
|
946
|
-
@keydown=${(i) => this.onKeydown(i,
|
|
944
|
+
@mouseenter=${() => this.setHover(a)}
|
|
945
|
+
@click=${() => this.pick(a)}
|
|
946
|
+
@keydown=${(i) => this.onKeydown(i, a)}
|
|
947
947
|
>★</button>`;
|
|
948
948
|
})}
|
|
949
949
|
</div>`;
|
|
950
950
|
}
|
|
951
951
|
};
|
|
952
952
|
it([
|
|
953
|
-
|
|
953
|
+
n({ type: Number })
|
|
954
954
|
], T.prototype, "value", 2);
|
|
955
955
|
it([
|
|
956
|
-
|
|
956
|
+
n({ type: Number })
|
|
957
957
|
], T.prototype, "max", 2);
|
|
958
958
|
it([
|
|
959
|
-
|
|
959
|
+
n({ type: Boolean })
|
|
960
960
|
], T.prototype, "readonly", 2);
|
|
961
961
|
it([
|
|
962
|
-
|
|
962
|
+
n()
|
|
963
963
|
], T.prototype, "label", 2);
|
|
964
964
|
it([
|
|
965
965
|
v()
|
|
@@ -967,12 +967,12 @@ it([
|
|
|
967
967
|
T = it([
|
|
968
968
|
p("baht-rating")
|
|
969
969
|
], T);
|
|
970
|
-
var Le = Object.defineProperty,
|
|
971
|
-
for (var s =
|
|
972
|
-
(o = t[i]) && (s = (
|
|
973
|
-
return
|
|
970
|
+
var Le = Object.defineProperty, Ae = Object.getOwnPropertyDescriptor, L = (t, e, r, a) => {
|
|
971
|
+
for (var s = a > 1 ? void 0 : a ? Ae(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
972
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
973
|
+
return a && s && Le(e, r, s), s;
|
|
974
974
|
};
|
|
975
|
-
let k = class extends
|
|
975
|
+
let k = class extends d {
|
|
976
976
|
constructor() {
|
|
977
977
|
super(...arguments), this.value = 0, this.min = 0, this.max = 100, this.step = 1, this.label = "", this.disabled = !1, this.showValue = !0, this.uid = ++k.instances;
|
|
978
978
|
}
|
|
@@ -986,8 +986,8 @@ let k = class extends c {
|
|
|
986
986
|
);
|
|
987
987
|
}
|
|
988
988
|
render() {
|
|
989
|
-
return
|
|
990
|
-
${this.label ?
|
|
989
|
+
return l`<div class="baht-range">
|
|
990
|
+
${this.label ? l`<label class="baht-label" for=${this.inputId}>${this.label}</label>` : h}
|
|
991
991
|
<div class="baht-range-row">
|
|
992
992
|
<input
|
|
993
993
|
type="range"
|
|
@@ -1000,42 +1000,42 @@ let k = class extends c {
|
|
|
1000
1000
|
?disabled=${this.disabled}
|
|
1001
1001
|
@input=${(t) => this.onInput(t)}
|
|
1002
1002
|
/>
|
|
1003
|
-
${this.showValue ?
|
|
1003
|
+
${this.showValue ? l`<span class="baht-range-value">${this.value}</span>` : h}
|
|
1004
1004
|
</div>
|
|
1005
1005
|
</div>`;
|
|
1006
1006
|
}
|
|
1007
1007
|
};
|
|
1008
1008
|
k.instances = 0;
|
|
1009
|
-
|
|
1010
|
-
|
|
1009
|
+
L([
|
|
1010
|
+
n({ type: Number })
|
|
1011
1011
|
], k.prototype, "value", 2);
|
|
1012
|
-
|
|
1013
|
-
|
|
1012
|
+
L([
|
|
1013
|
+
n({ type: Number })
|
|
1014
1014
|
], k.prototype, "min", 2);
|
|
1015
|
-
|
|
1016
|
-
|
|
1015
|
+
L([
|
|
1016
|
+
n({ type: Number })
|
|
1017
1017
|
], k.prototype, "max", 2);
|
|
1018
|
-
|
|
1019
|
-
|
|
1018
|
+
L([
|
|
1019
|
+
n({ type: Number })
|
|
1020
1020
|
], k.prototype, "step", 2);
|
|
1021
|
-
|
|
1022
|
-
|
|
1021
|
+
L([
|
|
1022
|
+
n()
|
|
1023
1023
|
], k.prototype, "label", 2);
|
|
1024
|
-
|
|
1025
|
-
|
|
1024
|
+
L([
|
|
1025
|
+
n({ type: Boolean })
|
|
1026
1026
|
], k.prototype, "disabled", 2);
|
|
1027
|
-
|
|
1028
|
-
|
|
1027
|
+
L([
|
|
1028
|
+
n({ type: Boolean, attribute: "show-value" })
|
|
1029
1029
|
], k.prototype, "showValue", 2);
|
|
1030
|
-
k =
|
|
1030
|
+
k = L([
|
|
1031
1031
|
p("baht-range")
|
|
1032
1032
|
], k);
|
|
1033
|
-
var
|
|
1034
|
-
for (var s =
|
|
1035
|
-
(o = t[i]) && (s = (
|
|
1036
|
-
return
|
|
1033
|
+
var Te = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, ot = (t, e, r, a) => {
|
|
1034
|
+
for (var s = a > 1 ? void 0 : a ? Ke(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1035
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1036
|
+
return a && s && Te(e, r, s), s;
|
|
1037
1037
|
};
|
|
1038
|
-
let K = class extends
|
|
1038
|
+
let K = class extends d {
|
|
1039
1039
|
constructor() {
|
|
1040
1040
|
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;
|
|
1041
1041
|
}
|
|
@@ -1048,17 +1048,17 @@ let K = class extends c {
|
|
|
1048
1048
|
willUpdate(t) {
|
|
1049
1049
|
super.willUpdate(t);
|
|
1050
1050
|
const e = t.has("value") && this.value !== this._lastValue;
|
|
1051
|
-
!this.hasUpdated || e ? (this._chars = Array.from({ length: this.length }, (
|
|
1051
|
+
!this.hasUpdated || e ? (this._chars = Array.from({ length: this.length }, (r, a) => this.value[a] ?? ""), this._lastValue = this.value, this._wasFull = this._chars.length > 0 && this._chars.every((r) => r !== "")) : this._chars.length !== this.length && (this._chars = Array.from({ length: this.length }, (r, a) => this._chars[a] ?? ""));
|
|
1052
1052
|
}
|
|
1053
1053
|
/** Writes `text` into `_chars` starting at `start`. Returns the index just
|
|
1054
1054
|
* past the last box written (may equal `this.length`). */
|
|
1055
1055
|
fill(t, e) {
|
|
1056
|
-
let
|
|
1057
|
-
for (const
|
|
1058
|
-
if (
|
|
1059
|
-
this._chars[
|
|
1056
|
+
let r = t;
|
|
1057
|
+
for (const a of e) {
|
|
1058
|
+
if (r >= this.length) break;
|
|
1059
|
+
this._chars[r] = a, r += 1;
|
|
1060
1060
|
}
|
|
1061
|
-
return
|
|
1061
|
+
return r;
|
|
1062
1062
|
}
|
|
1063
1063
|
commit() {
|
|
1064
1064
|
const t = this._chars.join("").slice(0, this.length);
|
|
@@ -1069,7 +1069,7 @@ let K = class extends c {
|
|
|
1069
1069
|
composed: !0
|
|
1070
1070
|
})
|
|
1071
1071
|
);
|
|
1072
|
-
const e = this._chars.length > 0 && this._chars.every((
|
|
1072
|
+
const e = this._chars.length > 0 && this._chars.every((r) => r !== "");
|
|
1073
1073
|
e && !this._wasFull && this.dispatchEvent(
|
|
1074
1074
|
new CustomEvent("baht-otp-complete", {
|
|
1075
1075
|
detail: { value: this.value },
|
|
@@ -1080,31 +1080,31 @@ let K = class extends c {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
onInput(t, e) {
|
|
1082
1082
|
var i, o;
|
|
1083
|
-
const
|
|
1084
|
-
if (
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1083
|
+
const r = e.target, a = this.clean(r.value);
|
|
1084
|
+
if (a.length > 1) {
|
|
1085
|
+
const c = this.fill(t, a);
|
|
1086
|
+
r.value = this._chars[t] ?? "", this.commit(), (i = this.inputs()[Math.min(c, this.length - 1)]) == null || i.focus();
|
|
1087
1087
|
return;
|
|
1088
1088
|
}
|
|
1089
|
-
const s =
|
|
1090
|
-
|
|
1089
|
+
const s = a.slice(-1);
|
|
1090
|
+
r.value = s, this._chars[t] = s, this.commit(), s && t < this.length - 1 && ((o = this.inputs()[t + 1]) == null || o.focus());
|
|
1091
1091
|
}
|
|
1092
1092
|
onKeydown(t, e) {
|
|
1093
|
-
var
|
|
1094
|
-
e.key === "Backspace" && !this._chars[t] && t > 0 && (this._chars[t - 1] = "", this.commit(), (
|
|
1093
|
+
var r;
|
|
1094
|
+
e.key === "Backspace" && !this._chars[t] && t > 0 && (this._chars[t - 1] = "", this.commit(), (r = this.inputs()[t - 1]) == null || r.focus(), e.preventDefault());
|
|
1095
1095
|
}
|
|
1096
1096
|
onPaste(t) {
|
|
1097
|
-
var
|
|
1097
|
+
var a, s;
|
|
1098
1098
|
t.preventDefault();
|
|
1099
|
-
const e = this.clean(((
|
|
1099
|
+
const e = this.clean(((a = t.clipboardData) == null ? void 0 : a.getData("text")) ?? "").slice(0, this.length);
|
|
1100
1100
|
if (!e) return;
|
|
1101
|
-
const
|
|
1102
|
-
this.commit(), (s = this.inputs()[Math.min(
|
|
1101
|
+
const r = this.fill(0, e);
|
|
1102
|
+
this.commit(), (s = this.inputs()[Math.min(r, this.length - 1)]) == null || s.focus();
|
|
1103
1103
|
}
|
|
1104
1104
|
render() {
|
|
1105
|
-
return
|
|
1105
|
+
return l`<div class="baht-otp" role="group" aria-label=${this.label} @paste=${(t) => this.onPaste(t)}>
|
|
1106
1106
|
${this._chars.map(
|
|
1107
|
-
(t, e) =>
|
|
1107
|
+
(t, e) => l`<input
|
|
1108
1108
|
type="text"
|
|
1109
1109
|
inputmode=${this.mode === "numeric" ? "numeric" : "text"}
|
|
1110
1110
|
maxlength="1"
|
|
@@ -1112,51 +1112,51 @@ let K = class extends c {
|
|
|
1112
1112
|
aria-label="Character ${e + 1} of ${this.length}"
|
|
1113
1113
|
.value=${t}
|
|
1114
1114
|
?disabled=${this.disabled}
|
|
1115
|
-
@input=${(
|
|
1116
|
-
@keydown=${(
|
|
1115
|
+
@input=${(r) => this.onInput(e, r)}
|
|
1116
|
+
@keydown=${(r) => this.onKeydown(e, r)}
|
|
1117
1117
|
/>`
|
|
1118
1118
|
)}
|
|
1119
1119
|
</div>`;
|
|
1120
1120
|
}
|
|
1121
1121
|
};
|
|
1122
1122
|
ot([
|
|
1123
|
-
|
|
1123
|
+
n({ type: Number })
|
|
1124
1124
|
], K.prototype, "length", 2);
|
|
1125
1125
|
ot([
|
|
1126
|
-
|
|
1126
|
+
n()
|
|
1127
1127
|
], K.prototype, "value", 2);
|
|
1128
1128
|
ot([
|
|
1129
|
-
|
|
1129
|
+
n({ type: Boolean })
|
|
1130
1130
|
], K.prototype, "disabled", 2);
|
|
1131
1131
|
ot([
|
|
1132
|
-
|
|
1132
|
+
n()
|
|
1133
1133
|
], K.prototype, "mode", 2);
|
|
1134
1134
|
ot([
|
|
1135
|
-
|
|
1135
|
+
n()
|
|
1136
1136
|
], K.prototype, "label", 2);
|
|
1137
1137
|
K = ot([
|
|
1138
1138
|
p("baht-otp")
|
|
1139
1139
|
], K);
|
|
1140
|
-
var
|
|
1141
|
-
for (var s =
|
|
1142
|
-
(o = t[i]) && (s = (
|
|
1143
|
-
return
|
|
1140
|
+
var Ve = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, lt = (t, e, r, a) => {
|
|
1141
|
+
for (var s = a > 1 ? void 0 : a ? Ue(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1142
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1143
|
+
return a && s && Ve(e, r, s), s;
|
|
1144
1144
|
};
|
|
1145
|
-
let V = class extends
|
|
1145
|
+
let V = class extends d {
|
|
1146
1146
|
constructor() {
|
|
1147
1147
|
super(...arguments), this.options = [], this.selected = [], this.multiple = !0, this.disabled = !1, this.label = "Filters";
|
|
1148
1148
|
}
|
|
1149
1149
|
toggle(t) {
|
|
1150
1150
|
const e = this.selected.includes(t);
|
|
1151
|
-
let
|
|
1152
|
-
this.multiple ? (
|
|
1153
|
-
new CustomEvent("baht-change", { detail: { selected:
|
|
1151
|
+
let r;
|
|
1152
|
+
this.multiple ? (r = e ? this.selected.filter((s) => s !== t) : [...this.selected, t], r = this.options.map((s) => s.key).filter((s) => r.includes(s))) : r = e ? [] : [t], this.dispatchEvent(
|
|
1153
|
+
new CustomEvent("baht-change", { detail: { selected: r }, bubbles: !0, composed: !0 })
|
|
1154
1154
|
);
|
|
1155
1155
|
}
|
|
1156
1156
|
render() {
|
|
1157
|
-
return
|
|
1157
|
+
return l`<div class="baht-filter" role="group" aria-label=${this.label}>
|
|
1158
1158
|
${this.options.map(
|
|
1159
|
-
(t) =>
|
|
1159
|
+
(t) => l`<button
|
|
1160
1160
|
type="button"
|
|
1161
1161
|
aria-pressed=${this.selected.includes(t.key)}
|
|
1162
1162
|
?disabled=${this.disabled}
|
|
@@ -1167,35 +1167,35 @@ let V = class extends c {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
};
|
|
1169
1169
|
lt([
|
|
1170
|
-
|
|
1170
|
+
n({ attribute: !1 })
|
|
1171
1171
|
], V.prototype, "options", 2);
|
|
1172
1172
|
lt([
|
|
1173
|
-
|
|
1173
|
+
n({ attribute: !1 })
|
|
1174
1174
|
], V.prototype, "selected", 2);
|
|
1175
1175
|
lt([
|
|
1176
|
-
|
|
1176
|
+
n({ type: Boolean })
|
|
1177
1177
|
], V.prototype, "multiple", 2);
|
|
1178
1178
|
lt([
|
|
1179
|
-
|
|
1179
|
+
n({ type: Boolean })
|
|
1180
1180
|
], V.prototype, "disabled", 2);
|
|
1181
1181
|
lt([
|
|
1182
|
-
|
|
1182
|
+
n()
|
|
1183
1183
|
], V.prototype, "label", 2);
|
|
1184
1184
|
V = lt([
|
|
1185
1185
|
p("baht-filter")
|
|
1186
1186
|
], V);
|
|
1187
|
-
var
|
|
1188
|
-
for (var s =
|
|
1189
|
-
(o = t[i]) && (s = (
|
|
1190
|
-
return
|
|
1187
|
+
var ze = Object.defineProperty, He = Object.getOwnPropertyDescriptor, Ct = (t, e, r, a) => {
|
|
1188
|
+
for (var s = a > 1 ? void 0 : a ? He(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1189
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1190
|
+
return a && s && ze(e, r, s), s;
|
|
1191
1191
|
};
|
|
1192
|
-
let pt = class extends
|
|
1192
|
+
let pt = class extends d {
|
|
1193
1193
|
constructor() {
|
|
1194
1194
|
super(...arguments), this.variant = "rect", this.width = "100%", this.height = "";
|
|
1195
1195
|
}
|
|
1196
1196
|
render() {
|
|
1197
1197
|
const t = this.height || (this.variant === "text" ? "1em" : "20px"), e = this.variant === "rect" ? "" : ` baht-skeleton--${this.variant}`;
|
|
1198
|
-
return
|
|
1198
|
+
return l`<span
|
|
1199
1199
|
class="baht-skeleton${e}"
|
|
1200
1200
|
style="width:${this.width}; height:${t};"
|
|
1201
1201
|
aria-hidden="true"
|
|
@@ -1203,31 +1203,31 @@ let pt = class extends c {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
};
|
|
1205
1205
|
Ct([
|
|
1206
|
-
|
|
1206
|
+
n()
|
|
1207
1207
|
], pt.prototype, "variant", 2);
|
|
1208
1208
|
Ct([
|
|
1209
|
-
|
|
1209
|
+
n()
|
|
1210
1210
|
], pt.prototype, "width", 2);
|
|
1211
1211
|
Ct([
|
|
1212
|
-
|
|
1212
|
+
n()
|
|
1213
1213
|
], pt.prototype, "height", 2);
|
|
1214
1214
|
pt = Ct([
|
|
1215
1215
|
p("baht-skeleton")
|
|
1216
1216
|
], pt);
|
|
1217
|
-
var
|
|
1218
|
-
for (var s =
|
|
1219
|
-
(o = t[i]) && (s = (
|
|
1220
|
-
return
|
|
1217
|
+
var Je = Object.defineProperty, We = Object.getOwnPropertyDescriptor, mt = (t, e, r, a) => {
|
|
1218
|
+
for (var s = a > 1 ? void 0 : a ? We(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1219
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1220
|
+
return a && s && Je(e, r, s), s;
|
|
1221
1221
|
};
|
|
1222
|
-
let G = class extends
|
|
1222
|
+
let G = class extends d {
|
|
1223
1223
|
constructor() {
|
|
1224
1224
|
super(...arguments), this.value = null, this.tone = "primary", this.showLabel = !1, this.label = "Progress";
|
|
1225
1225
|
}
|
|
1226
1226
|
render() {
|
|
1227
|
-
const t = this.value == null || Number.isNaN(this.value), e = t ? 0 : Math.min(100, Math.max(0, this.value)),
|
|
1228
|
-
return
|
|
1227
|
+
const t = this.value == null || Number.isNaN(this.value), e = t ? 0 : Math.min(100, Math.max(0, this.value)), r = this.tone === "primary" ? "" : ` baht-progress--${this.tone}`;
|
|
1228
|
+
return l`<div>
|
|
1229
1229
|
<div
|
|
1230
|
-
class="baht-progress${
|
|
1230
|
+
class="baht-progress${r}${t ? " baht-progress--indeterminate" : ""}"
|
|
1231
1231
|
role="progressbar"
|
|
1232
1232
|
aria-label=${this.label}
|
|
1233
1233
|
aria-valuemin="0"
|
|
@@ -1236,54 +1236,54 @@ let G = class extends c {
|
|
|
1236
1236
|
>
|
|
1237
1237
|
<div class="baht-progress-bar" style=${t ? h : `width:${e}%`}></div>
|
|
1238
1238
|
</div>
|
|
1239
|
-
${this.showLabel && !t ?
|
|
1239
|
+
${this.showLabel && !t ? l`<div class="baht-progress-label">${e}%</div>` : h}
|
|
1240
1240
|
</div>`;
|
|
1241
1241
|
}
|
|
1242
1242
|
};
|
|
1243
1243
|
mt([
|
|
1244
|
-
|
|
1244
|
+
n({ type: Number })
|
|
1245
1245
|
], G.prototype, "value", 2);
|
|
1246
1246
|
mt([
|
|
1247
|
-
|
|
1247
|
+
n()
|
|
1248
1248
|
], G.prototype, "tone", 2);
|
|
1249
1249
|
mt([
|
|
1250
|
-
|
|
1250
|
+
n({ type: Boolean, attribute: "show-label" })
|
|
1251
1251
|
], G.prototype, "showLabel", 2);
|
|
1252
1252
|
mt([
|
|
1253
|
-
|
|
1253
|
+
n()
|
|
1254
1254
|
], G.prototype, "label", 2);
|
|
1255
1255
|
G = mt([
|
|
1256
1256
|
p("baht-progress")
|
|
1257
1257
|
], G);
|
|
1258
|
-
var
|
|
1259
|
-
for (var s =
|
|
1260
|
-
(o = t[i]) && (s = (
|
|
1261
|
-
return
|
|
1258
|
+
var Ge = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, At = (t, e, r, a) => {
|
|
1259
|
+
for (var s = a > 1 ? void 0 : a ? Ye(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1260
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1261
|
+
return a && s && Ge(e, r, s), s;
|
|
1262
1262
|
};
|
|
1263
|
-
let Ot = class extends
|
|
1263
|
+
let Ot = class extends d {
|
|
1264
1264
|
constructor() {
|
|
1265
1265
|
super(...arguments), this.size = "md", this.label = "Loading";
|
|
1266
1266
|
}
|
|
1267
1267
|
render() {
|
|
1268
1268
|
const t = this.size === "md" ? "" : ` baht-spinner--${this.size}`;
|
|
1269
|
-
return
|
|
1269
|
+
return l`<span class="baht-spinner${t}" role="status" aria-label=${this.label}></span>`;
|
|
1270
1270
|
}
|
|
1271
1271
|
};
|
|
1272
1272
|
At([
|
|
1273
|
-
|
|
1273
|
+
n()
|
|
1274
1274
|
], Ot.prototype, "size", 2);
|
|
1275
1275
|
At([
|
|
1276
|
-
|
|
1276
|
+
n()
|
|
1277
1277
|
], Ot.prototype, "label", 2);
|
|
1278
1278
|
Ot = At([
|
|
1279
1279
|
p("baht-spinner")
|
|
1280
1280
|
], Ot);
|
|
1281
|
-
var
|
|
1282
|
-
for (var s =
|
|
1283
|
-
(o = t[i]) && (s = (
|
|
1284
|
-
return
|
|
1281
|
+
var Qe = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, yt = (t, e, r, a) => {
|
|
1282
|
+
for (var s = a > 1 ? void 0 : a ? Xe(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1283
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1284
|
+
return a && s && Qe(e, r, s), s;
|
|
1285
1285
|
};
|
|
1286
|
-
let Y = class extends
|
|
1286
|
+
let Y = class extends d {
|
|
1287
1287
|
constructor() {
|
|
1288
1288
|
super(...arguments), this.heading = "", this.subtitle = "", this.hero = !1;
|
|
1289
1289
|
}
|
|
@@ -1291,21 +1291,21 @@ let Y = class extends c {
|
|
|
1291
1291
|
st(this, this.bodyEl);
|
|
1292
1292
|
}
|
|
1293
1293
|
render() {
|
|
1294
|
-
return
|
|
1295
|
-
${this.heading ?
|
|
1296
|
-
${this.subtitle ?
|
|
1294
|
+
return l`<div class="baht-card${this.hero ? " baht-card--hero" : ""}">
|
|
1295
|
+
${this.heading ? l`<div class="baht-card-title">${this.heading}</div>` : h}
|
|
1296
|
+
${this.subtitle ? l`<div class="baht-card-subtitle">${this.subtitle}</div>` : h}
|
|
1297
1297
|
<div class="baht-card-body"></div>
|
|
1298
1298
|
</div>`;
|
|
1299
1299
|
}
|
|
1300
1300
|
};
|
|
1301
1301
|
yt([
|
|
1302
|
-
|
|
1302
|
+
n()
|
|
1303
1303
|
], Y.prototype, "heading", 2);
|
|
1304
1304
|
yt([
|
|
1305
|
-
|
|
1305
|
+
n()
|
|
1306
1306
|
], Y.prototype, "subtitle", 2);
|
|
1307
1307
|
yt([
|
|
1308
|
-
|
|
1308
|
+
n({ type: Boolean })
|
|
1309
1309
|
], Y.prototype, "hero", 2);
|
|
1310
1310
|
yt([
|
|
1311
1311
|
tt(".baht-card-body")
|
|
@@ -1313,12 +1313,12 @@ yt([
|
|
|
1313
1313
|
Y = yt([
|
|
1314
1314
|
p("baht-card")
|
|
1315
1315
|
], Y);
|
|
1316
|
-
var
|
|
1317
|
-
for (var s =
|
|
1318
|
-
(o = t[i]) && (s = (
|
|
1319
|
-
return
|
|
1316
|
+
var Ze = Object.defineProperty, ts = Object.getOwnPropertyDescriptor, Dt = (t, e, r, a) => {
|
|
1317
|
+
for (var s = a > 1 ? void 0 : a ? ts(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1318
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1319
|
+
return a && s && Ze(e, r, s), s;
|
|
1320
1320
|
};
|
|
1321
|
-
let ct = class extends
|
|
1321
|
+
let ct = class extends d {
|
|
1322
1322
|
constructor() {
|
|
1323
1323
|
super(...arguments), this.legend = "", this.disabled = !1;
|
|
1324
1324
|
}
|
|
@@ -1326,17 +1326,17 @@ let ct = class extends c {
|
|
|
1326
1326
|
st(this, this.bodyEl);
|
|
1327
1327
|
}
|
|
1328
1328
|
render() {
|
|
1329
|
-
return
|
|
1330
|
-
${this.legend ?
|
|
1329
|
+
return l`<fieldset class="baht-fieldset" ?disabled=${this.disabled}>
|
|
1330
|
+
${this.legend ? l`<legend>${this.legend}</legend>` : h}
|
|
1331
1331
|
<div class="baht-fieldset-body"></div>
|
|
1332
1332
|
</fieldset>`;
|
|
1333
1333
|
}
|
|
1334
1334
|
};
|
|
1335
1335
|
Dt([
|
|
1336
|
-
|
|
1336
|
+
n()
|
|
1337
1337
|
], ct.prototype, "legend", 2);
|
|
1338
1338
|
Dt([
|
|
1339
|
-
|
|
1339
|
+
n({ type: Boolean })
|
|
1340
1340
|
], ct.prototype, "disabled", 2);
|
|
1341
1341
|
Dt([
|
|
1342
1342
|
tt(".baht-fieldset-body")
|
|
@@ -1344,47 +1344,47 @@ Dt([
|
|
|
1344
1344
|
ct = Dt([
|
|
1345
1345
|
p("baht-fieldset")
|
|
1346
1346
|
], ct);
|
|
1347
|
-
var
|
|
1348
|
-
for (var s =
|
|
1349
|
-
(o = t[i]) && (s = (
|
|
1350
|
-
return
|
|
1347
|
+
var es = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, ae = (t, e, r, a) => {
|
|
1348
|
+
for (var s = a > 1 ? void 0 : a ? ss(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1349
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1350
|
+
return a && s && es(e, r, s), s;
|
|
1351
1351
|
};
|
|
1352
|
-
let
|
|
1352
|
+
let Nt = class extends d {
|
|
1353
1353
|
constructor() {
|
|
1354
1354
|
super(...arguments), this.items = [];
|
|
1355
1355
|
}
|
|
1356
1356
|
render() {
|
|
1357
|
-
return
|
|
1357
|
+
return l`<div class="baht-timeline" role="list">
|
|
1358
1358
|
${this.items.map(
|
|
1359
|
-
(t, e) =>
|
|
1359
|
+
(t, e) => l`<div class="baht-timeline-item" role="listitem">
|
|
1360
1360
|
<div class="baht-timeline-rail">
|
|
1361
1361
|
<span class="baht-timeline-dot${t.tone && t.tone !== "primary" ? ` baht-timeline-dot--${t.tone}` : ""}"></span>
|
|
1362
|
-
${e < this.items.length - 1 ?
|
|
1362
|
+
${e < this.items.length - 1 ? l`<span class="baht-timeline-line"></span>` : h}
|
|
1363
1363
|
</div>
|
|
1364
1364
|
<div class="baht-timeline-main">
|
|
1365
1365
|
<div class="baht-timeline-title">
|
|
1366
1366
|
${t.title}
|
|
1367
|
-
${t.time ?
|
|
1367
|
+
${t.time ? l`<span class="baht-timeline-time"> · ${t.time}</span>` : h}
|
|
1368
1368
|
</div>
|
|
1369
|
-
${t.description ?
|
|
1369
|
+
${t.description ? l`<div class="baht-timeline-desc">${t.description}</div>` : h}
|
|
1370
1370
|
</div>
|
|
1371
1371
|
</div>`
|
|
1372
1372
|
)}
|
|
1373
1373
|
</div>`;
|
|
1374
1374
|
}
|
|
1375
1375
|
};
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
],
|
|
1379
|
-
|
|
1376
|
+
ae([
|
|
1377
|
+
n({ attribute: !1 })
|
|
1378
|
+
], Nt.prototype, "items", 2);
|
|
1379
|
+
Nt = ae([
|
|
1380
1380
|
p("baht-timeline")
|
|
1381
|
-
],
|
|
1382
|
-
var
|
|
1383
|
-
for (var s =
|
|
1384
|
-
(o = t[i]) && (s = (
|
|
1385
|
-
return
|
|
1381
|
+
], Nt);
|
|
1382
|
+
var as = Object.defineProperty, rs = Object.getOwnPropertyDescriptor, Et = (t, e, r, a) => {
|
|
1383
|
+
for (var s = a > 1 ? void 0 : a ? rs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1384
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1385
|
+
return a && s && as(e, r, s), s;
|
|
1386
1386
|
};
|
|
1387
|
-
let q = class extends
|
|
1387
|
+
let q = class extends d {
|
|
1388
1388
|
constructor() {
|
|
1389
1389
|
super(...arguments), this.items = [], this.multiple = !1, this.openSet = /* @__PURE__ */ new Set(), this.uid = ++q.instances, this.itemsFingerprint = "";
|
|
1390
1390
|
}
|
|
@@ -1394,32 +1394,32 @@ let q = class extends c {
|
|
|
1394
1394
|
willUpdate(t) {
|
|
1395
1395
|
if (t.has("items")) {
|
|
1396
1396
|
const e = q.fingerprint(this.items);
|
|
1397
|
-
e !== this.itemsFingerprint && (this.itemsFingerprint = e, this.openSet = new Set(this.items.flatMap((
|
|
1397
|
+
e !== this.itemsFingerprint && (this.itemsFingerprint = e, this.openSet = new Set(this.items.flatMap((r, a) => r.open ? [a] : [])));
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
1400
|
toggle(t) {
|
|
1401
|
-
const e = !this.openSet.has(t),
|
|
1402
|
-
e ?
|
|
1401
|
+
const e = !this.openSet.has(t), r = this.multiple ? new Set(this.openSet) : /* @__PURE__ */ new Set();
|
|
1402
|
+
e ? r.add(t) : r.delete(t), this.openSet = r, this.dispatchEvent(
|
|
1403
1403
|
new CustomEvent("baht-toggle", { detail: { index: t, open: e }, bubbles: !0, composed: !0 })
|
|
1404
1404
|
);
|
|
1405
1405
|
}
|
|
1406
1406
|
render() {
|
|
1407
|
-
return
|
|
1407
|
+
return l`<div class="baht-accordion">
|
|
1408
1408
|
${this.items.map((t, e) => {
|
|
1409
|
-
const
|
|
1410
|
-
return
|
|
1409
|
+
const r = this.openSet.has(e), a = `baht-acc-${this.uid}-t-${e}`, s = `baht-acc-${this.uid}-p-${e}`;
|
|
1410
|
+
return l`<div class="baht-accordion-item${r ? " baht-accordion-item--open" : ""}">
|
|
1411
1411
|
<button
|
|
1412
1412
|
type="button"
|
|
1413
1413
|
class="baht-accordion-trigger"
|
|
1414
|
-
id=${
|
|
1415
|
-
aria-expanded=${
|
|
1416
|
-
aria-controls=${
|
|
1414
|
+
id=${a}
|
|
1415
|
+
aria-expanded=${r}
|
|
1416
|
+
aria-controls=${r ? s : h}
|
|
1417
1417
|
@click=${() => this.toggle(e)}
|
|
1418
1418
|
>
|
|
1419
1419
|
<span>${t.title}</span>
|
|
1420
1420
|
<span class="baht-accordion-chevron" aria-hidden="true">▾</span>
|
|
1421
1421
|
</button>
|
|
1422
|
-
${
|
|
1422
|
+
${r ? l`<div class="baht-accordion-content" id=${s} role="region" aria-labelledby=${a}>${t.content}</div>` : h}
|
|
1423
1423
|
</div>`;
|
|
1424
1424
|
})}
|
|
1425
1425
|
</div>`;
|
|
@@ -1427,10 +1427,10 @@ let q = class extends c {
|
|
|
1427
1427
|
};
|
|
1428
1428
|
q.instances = 0;
|
|
1429
1429
|
Et([
|
|
1430
|
-
|
|
1430
|
+
n({ attribute: !1 })
|
|
1431
1431
|
], q.prototype, "items", 2);
|
|
1432
1432
|
Et([
|
|
1433
|
-
|
|
1433
|
+
n({ type: Boolean })
|
|
1434
1434
|
], q.prototype, "multiple", 2);
|
|
1435
1435
|
Et([
|
|
1436
1436
|
v()
|
|
@@ -1438,45 +1438,45 @@ Et([
|
|
|
1438
1438
|
q = Et([
|
|
1439
1439
|
p("baht-accordion")
|
|
1440
1440
|
], q);
|
|
1441
|
-
var
|
|
1442
|
-
for (var s =
|
|
1443
|
-
(o = t[i]) && (s = (
|
|
1444
|
-
return
|
|
1441
|
+
var is = Object.defineProperty, os = Object.getOwnPropertyDescriptor, $t = (t, e, r, a) => {
|
|
1442
|
+
for (var s = a > 1 ? void 0 : a ? os(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1443
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1444
|
+
return a && s && is(e, r, s), s;
|
|
1445
1445
|
};
|
|
1446
|
-
let Q = class extends
|
|
1446
|
+
let Q = class extends d {
|
|
1447
1447
|
constructor() {
|
|
1448
1448
|
super(...arguments), this.href = "", this.label = "", this.external = !1, this.externalHint = "opens in new tab";
|
|
1449
1449
|
}
|
|
1450
1450
|
render() {
|
|
1451
|
-
return
|
|
1451
|
+
return l`<a
|
|
1452
1452
|
class="baht-link"
|
|
1453
1453
|
href=${this.href || h}
|
|
1454
1454
|
target=${this.external ? "_blank" : h}
|
|
1455
1455
|
rel=${this.external ? "noopener noreferrer" : h}
|
|
1456
|
-
>${this.label}${this.external ?
|
|
1456
|
+
>${this.label}${this.external ? l` <span class="baht-link-external" aria-hidden="true">↗</span><span class="baht-visually-hidden"> (${this.externalHint})</span>` : h}</a>`;
|
|
1457
1457
|
}
|
|
1458
1458
|
};
|
|
1459
1459
|
$t([
|
|
1460
|
-
|
|
1460
|
+
n()
|
|
1461
1461
|
], Q.prototype, "href", 2);
|
|
1462
1462
|
$t([
|
|
1463
|
-
|
|
1463
|
+
n()
|
|
1464
1464
|
], Q.prototype, "label", 2);
|
|
1465
1465
|
$t([
|
|
1466
|
-
|
|
1466
|
+
n({ type: Boolean })
|
|
1467
1467
|
], Q.prototype, "external", 2);
|
|
1468
1468
|
$t([
|
|
1469
|
-
|
|
1469
|
+
n({ attribute: "external-hint" })
|
|
1470
1470
|
], Q.prototype, "externalHint", 2);
|
|
1471
1471
|
Q = $t([
|
|
1472
1472
|
p("baht-link")
|
|
1473
1473
|
], Q);
|
|
1474
|
-
var
|
|
1475
|
-
for (var s =
|
|
1476
|
-
(o = t[i]) && (s = (
|
|
1477
|
-
return
|
|
1474
|
+
var ls = Object.defineProperty, ns = Object.getOwnPropertyDescriptor, Tt = (t, e, r, a) => {
|
|
1475
|
+
for (var s = a > 1 ? void 0 : a ? ns(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1476
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1477
|
+
return a && s && ls(e, r, s), s;
|
|
1478
1478
|
};
|
|
1479
|
-
let Pt = class extends
|
|
1479
|
+
let Pt = class extends d {
|
|
1480
1480
|
constructor() {
|
|
1481
1481
|
super(...arguments), this.items = [], this.separator = "›";
|
|
1482
1482
|
}
|
|
@@ -1487,37 +1487,37 @@ let Pt = class extends c {
|
|
|
1487
1487
|
}
|
|
1488
1488
|
render() {
|
|
1489
1489
|
const t = this.items.length - 1;
|
|
1490
|
-
return
|
|
1491
|
-
${this.items.map((e,
|
|
1492
|
-
const
|
|
1493
|
-
return
|
|
1490
|
+
return l`<nav class="baht-breadcrumbs" aria-label="Breadcrumb">
|
|
1491
|
+
${this.items.map((e, r) => {
|
|
1492
|
+
const a = r < t ? l`<span class="baht-breadcrumbs-sep" aria-hidden="true">${this.separator}</span>` : h;
|
|
1493
|
+
return r === t ? l`<span class="baht-breadcrumbs-current" aria-current="page">${e.label}</span>${a}` : e.href ? l`<a class="baht-link" href=${e.href}>${e.label}</a>${a}` : l`<a
|
|
1494
1494
|
class="baht-link"
|
|
1495
1495
|
href="#"
|
|
1496
1496
|
@click=${(s) => {
|
|
1497
|
-
s.preventDefault(), this.navigate(e,
|
|
1497
|
+
s.preventDefault(), this.navigate(e, r);
|
|
1498
1498
|
}}
|
|
1499
|
-
>${e.label}</a>${
|
|
1499
|
+
>${e.label}</a>${a}`;
|
|
1500
1500
|
})}
|
|
1501
1501
|
</nav>`;
|
|
1502
1502
|
}
|
|
1503
1503
|
};
|
|
1504
1504
|
Tt([
|
|
1505
|
-
|
|
1505
|
+
n({ attribute: !1 })
|
|
1506
1506
|
], Pt.prototype, "items", 2);
|
|
1507
1507
|
Tt([
|
|
1508
|
-
|
|
1508
|
+
n()
|
|
1509
1509
|
], Pt.prototype, "separator", 2);
|
|
1510
1510
|
Pt = Tt([
|
|
1511
1511
|
p("baht-breadcrumbs")
|
|
1512
1512
|
], Pt);
|
|
1513
|
-
var
|
|
1514
|
-
for (var s =
|
|
1513
|
+
var hs = Object.getOwnPropertyDescriptor, ps = (t, e, r, a) => {
|
|
1514
|
+
for (var s = a > 1 ? void 0 : a ? hs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1515
1515
|
(o = t[i]) && (s = o(s) || s);
|
|
1516
1516
|
return s;
|
|
1517
1517
|
};
|
|
1518
1518
|
let zt = class extends g {
|
|
1519
1519
|
renderControl() {
|
|
1520
|
-
return
|
|
1520
|
+
return l`<input
|
|
1521
1521
|
class="baht-control baht-control--text"
|
|
1522
1522
|
id=${this.controlId}
|
|
1523
1523
|
type=${this.field.type === "email" ? "email" : this.field.type === "password" ? "password" : "text"}
|
|
@@ -1534,17 +1534,17 @@ let zt = class extends g {
|
|
|
1534
1534
|
/>`;
|
|
1535
1535
|
}
|
|
1536
1536
|
};
|
|
1537
|
-
zt =
|
|
1537
|
+
zt = ps([
|
|
1538
1538
|
p("baht-input")
|
|
1539
1539
|
], zt);
|
|
1540
|
-
var
|
|
1541
|
-
for (var s =
|
|
1540
|
+
var cs = Object.getOwnPropertyDescriptor, ds = (t, e, r, a) => {
|
|
1541
|
+
for (var s = a > 1 ? void 0 : a ? cs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1542
1542
|
(o = t[i]) && (s = o(s) || s);
|
|
1543
1543
|
return s;
|
|
1544
1544
|
};
|
|
1545
1545
|
let Ht = class extends g {
|
|
1546
1546
|
renderControl() {
|
|
1547
|
-
return
|
|
1547
|
+
return l`<textarea
|
|
1548
1548
|
class="baht-control baht-control--textarea"
|
|
1549
1549
|
id=${this.controlId}
|
|
1550
1550
|
.value=${B(this.value == null ? "" : String(this.value))}
|
|
@@ -1561,17 +1561,17 @@ let Ht = class extends g {
|
|
|
1561
1561
|
></textarea>`;
|
|
1562
1562
|
}
|
|
1563
1563
|
};
|
|
1564
|
-
Ht =
|
|
1564
|
+
Ht = ds([
|
|
1565
1565
|
p("baht-textarea")
|
|
1566
1566
|
], Ht);
|
|
1567
|
-
var
|
|
1568
|
-
for (var s =
|
|
1567
|
+
var us = Object.getOwnPropertyDescriptor, bs = (t, e, r, a) => {
|
|
1568
|
+
for (var s = a > 1 ? void 0 : a ? us(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1569
1569
|
(o = t[i]) && (s = o(s) || s);
|
|
1570
1570
|
return s;
|
|
1571
1571
|
};
|
|
1572
1572
|
let Jt = class extends g {
|
|
1573
1573
|
renderControl() {
|
|
1574
|
-
return
|
|
1574
|
+
return l`<input
|
|
1575
1575
|
class="baht-control baht-control--number"
|
|
1576
1576
|
id=${this.controlId}
|
|
1577
1577
|
type="number"
|
|
@@ -1592,18 +1592,18 @@ let Jt = class extends g {
|
|
|
1592
1592
|
/>`;
|
|
1593
1593
|
}
|
|
1594
1594
|
};
|
|
1595
|
-
Jt =
|
|
1595
|
+
Jt = bs([
|
|
1596
1596
|
p("baht-number")
|
|
1597
1597
|
], Jt);
|
|
1598
|
-
var
|
|
1599
|
-
for (var s =
|
|
1598
|
+
var vs = Object.getOwnPropertyDescriptor, fs = (t, e, r, a) => {
|
|
1599
|
+
for (var s = a > 1 ? void 0 : a ? vs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1600
1600
|
(o = t[i]) && (s = o(s) || s);
|
|
1601
1601
|
return s;
|
|
1602
1602
|
};
|
|
1603
1603
|
let Wt = class extends g {
|
|
1604
1604
|
renderControl() {
|
|
1605
1605
|
const t = this.value == null ? "" : String(this.value);
|
|
1606
|
-
return
|
|
1606
|
+
return l`<select
|
|
1607
1607
|
class="baht-control baht-control--select"
|
|
1608
1608
|
id=${this.controlId}
|
|
1609
1609
|
.value=${B(t)}
|
|
@@ -1612,22 +1612,22 @@ let Wt = class extends g {
|
|
|
1612
1612
|
aria-invalid=${this.invalid}
|
|
1613
1613
|
aria-describedby=${this.describedBy}
|
|
1614
1614
|
@change=${(e) => {
|
|
1615
|
-
const
|
|
1616
|
-
this.emitInput(
|
|
1615
|
+
const r = e.target.value;
|
|
1616
|
+
this.emitInput(r === "" ? null : r);
|
|
1617
1617
|
}}
|
|
1618
1618
|
>
|
|
1619
|
-
<option value="" ?selected=${t === ""}>${this.field.placeholder ?? "
|
|
1619
|
+
<option value="" ?selected=${t === ""}>${this.field.placeholder ?? m("choose")}</option>
|
|
1620
1620
|
${(this.field.options ?? []).map(
|
|
1621
|
-
(e) =>
|
|
1621
|
+
(e) => l`<option value=${e.key} ?selected=${t === e.key}>${e.label}</option>`
|
|
1622
1622
|
)}
|
|
1623
1623
|
</select>`;
|
|
1624
1624
|
}
|
|
1625
1625
|
};
|
|
1626
|
-
Wt =
|
|
1626
|
+
Wt = fs([
|
|
1627
1627
|
p("baht-select")
|
|
1628
1628
|
], Wt);
|
|
1629
|
-
var
|
|
1630
|
-
for (var s =
|
|
1629
|
+
var ms = Object.getOwnPropertyDescriptor, ys = (t, e, r, a) => {
|
|
1630
|
+
for (var s = a > 1 ? void 0 : a ? ms(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1631
1631
|
(o = t[i]) && (s = o(s) || s);
|
|
1632
1632
|
return s;
|
|
1633
1633
|
};
|
|
@@ -1636,18 +1636,18 @@ let Gt = class extends g {
|
|
|
1636
1636
|
return Array.isArray(this.value) ? this.value : [];
|
|
1637
1637
|
}
|
|
1638
1638
|
toggle(t, e) {
|
|
1639
|
-
const
|
|
1640
|
-
this.emitInput(
|
|
1639
|
+
const r = e ? [...this.selected, t] : this.selected.filter((s) => s !== t), a = (this.field.options ?? []).map((s) => s.key);
|
|
1640
|
+
this.emitInput(a.filter((s) => r.includes(s)));
|
|
1641
1641
|
}
|
|
1642
1642
|
renderControl() {
|
|
1643
|
-
return
|
|
1643
|
+
return l`<div
|
|
1644
1644
|
class="baht-control baht-control--multiselect"
|
|
1645
1645
|
role="group"
|
|
1646
1646
|
aria-labelledby=${this.field.label ? this.labelId : h}
|
|
1647
1647
|
aria-describedby=${this.describedBy}
|
|
1648
1648
|
>
|
|
1649
1649
|
${(this.field.options ?? []).map(
|
|
1650
|
-
(t) =>
|
|
1650
|
+
(t) => l`<label class="baht-option">
|
|
1651
1651
|
<input
|
|
1652
1652
|
type="checkbox"
|
|
1653
1653
|
value=${t.key}
|
|
@@ -1661,11 +1661,11 @@ let Gt = class extends g {
|
|
|
1661
1661
|
</div>`;
|
|
1662
1662
|
}
|
|
1663
1663
|
};
|
|
1664
|
-
Gt =
|
|
1664
|
+
Gt = ys([
|
|
1665
1665
|
p("baht-multiselect")
|
|
1666
1666
|
], Gt);
|
|
1667
|
-
var
|
|
1668
|
-
for (var s =
|
|
1667
|
+
var $s = Object.getOwnPropertyDescriptor, gs = (t, e, r, a) => {
|
|
1668
|
+
for (var s = a > 1 ? void 0 : a ? $s(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1669
1669
|
(o = t[i]) && (s = o(s) || s);
|
|
1670
1670
|
return s;
|
|
1671
1671
|
};
|
|
@@ -1675,7 +1675,7 @@ let Yt = class extends g {
|
|
|
1675
1675
|
return h;
|
|
1676
1676
|
}
|
|
1677
1677
|
renderControl() {
|
|
1678
|
-
return
|
|
1678
|
+
return l`<label class="baht-control baht-control--checkbox baht-option">
|
|
1679
1679
|
<input
|
|
1680
1680
|
type="checkbox"
|
|
1681
1681
|
id=${this.controlId}
|
|
@@ -1687,22 +1687,22 @@ let Yt = class extends g {
|
|
|
1687
1687
|
@change=${(t) => this.emitInput(t.target.checked)}
|
|
1688
1688
|
/>
|
|
1689
1689
|
<span class="baht-label"
|
|
1690
|
-
>${this.field.label}${this.required ?
|
|
1690
|
+
>${this.field.label}${this.required ? l`<span class="baht-required-mark">*</span>` : h}</span
|
|
1691
1691
|
>
|
|
1692
1692
|
</label>`;
|
|
1693
1693
|
}
|
|
1694
1694
|
};
|
|
1695
|
-
Yt =
|
|
1695
|
+
Yt = gs([
|
|
1696
1696
|
p("baht-checkbox")
|
|
1697
1697
|
], Yt);
|
|
1698
|
-
var
|
|
1699
|
-
for (var s =
|
|
1698
|
+
var ws = Object.getOwnPropertyDescriptor, _s = (t, e, r, a) => {
|
|
1699
|
+
for (var s = a > 1 ? void 0 : a ? ws(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1700
1700
|
(o = t[i]) && (s = o(s) || s);
|
|
1701
1701
|
return s;
|
|
1702
1702
|
};
|
|
1703
1703
|
let Qt = class extends g {
|
|
1704
1704
|
renderControl() {
|
|
1705
|
-
return
|
|
1705
|
+
return l`<div
|
|
1706
1706
|
class="baht-control baht-control--radio"
|
|
1707
1707
|
role="radiogroup"
|
|
1708
1708
|
aria-labelledby=${this.field.label ? this.labelId : h}
|
|
@@ -1711,7 +1711,7 @@ let Qt = class extends g {
|
|
|
1711
1711
|
aria-describedby=${this.describedBy}
|
|
1712
1712
|
>
|
|
1713
1713
|
${(this.field.options ?? []).map(
|
|
1714
|
-
(t) =>
|
|
1714
|
+
(t) => l`<label class="baht-option">
|
|
1715
1715
|
<input
|
|
1716
1716
|
type="radio"
|
|
1717
1717
|
name=${this.controlId}
|
|
@@ -1726,11 +1726,11 @@ let Qt = class extends g {
|
|
|
1726
1726
|
</div>`;
|
|
1727
1727
|
}
|
|
1728
1728
|
};
|
|
1729
|
-
Qt =
|
|
1729
|
+
Qt = _s([
|
|
1730
1730
|
p("baht-radio")
|
|
1731
1731
|
], Qt);
|
|
1732
|
-
var
|
|
1733
|
-
for (var s =
|
|
1732
|
+
var xs = Object.getOwnPropertyDescriptor, Os = (t, e, r, a) => {
|
|
1733
|
+
for (var s = a > 1 ? void 0 : a ? xs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1734
1734
|
(o = t[i]) && (s = o(s) || s);
|
|
1735
1735
|
return s;
|
|
1736
1736
|
};
|
|
@@ -1739,7 +1739,7 @@ let Xt = class extends g {
|
|
|
1739
1739
|
return h;
|
|
1740
1740
|
}
|
|
1741
1741
|
renderControl() {
|
|
1742
|
-
return
|
|
1742
|
+
return l`<label class="baht-control baht-control--toggle baht-option">
|
|
1743
1743
|
<input
|
|
1744
1744
|
type="checkbox"
|
|
1745
1745
|
role="switch"
|
|
@@ -1754,22 +1754,22 @@ let Xt = class extends g {
|
|
|
1754
1754
|
/>
|
|
1755
1755
|
<span class="baht-toggle-track"><span class="baht-toggle-thumb"></span></span>
|
|
1756
1756
|
<span class="baht-label"
|
|
1757
|
-
>${this.field.label}${this.required ?
|
|
1757
|
+
>${this.field.label}${this.required ? l`<span class="baht-required-mark">*</span>` : h}</span
|
|
1758
1758
|
>
|
|
1759
1759
|
</label>`;
|
|
1760
1760
|
}
|
|
1761
1761
|
};
|
|
1762
|
-
Xt =
|
|
1762
|
+
Xt = Os([
|
|
1763
1763
|
p("baht-toggle")
|
|
1764
1764
|
], Xt);
|
|
1765
|
-
var
|
|
1766
|
-
for (var s =
|
|
1765
|
+
var Ps = Object.getOwnPropertyDescriptor, ks = (t, e, r, a) => {
|
|
1766
|
+
for (var s = a > 1 ? void 0 : a ? Ps(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1767
1767
|
(o = t[i]) && (s = o(s) || s);
|
|
1768
1768
|
return s;
|
|
1769
1769
|
};
|
|
1770
1770
|
let Zt = class extends g {
|
|
1771
1771
|
renderControl() {
|
|
1772
|
-
return
|
|
1772
|
+
return l`<input
|
|
1773
1773
|
class="baht-control baht-control--date"
|
|
1774
1774
|
id=${this.controlId}
|
|
1775
1775
|
type="date"
|
|
@@ -1788,18 +1788,18 @@ let Zt = class extends g {
|
|
|
1788
1788
|
/>`;
|
|
1789
1789
|
}
|
|
1790
1790
|
};
|
|
1791
|
-
Zt =
|
|
1791
|
+
Zt = ks([
|
|
1792
1792
|
p("baht-datepicker")
|
|
1793
1793
|
], Zt);
|
|
1794
|
-
var
|
|
1795
|
-
for (var s =
|
|
1796
|
-
(o = t[i]) && (s = (
|
|
1797
|
-
return
|
|
1794
|
+
var Cs = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, gt = (t, e, r, a) => {
|
|
1795
|
+
for (var s = a > 1 ? void 0 : a ? Ds(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1796
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1797
|
+
return a && s && Cs(e, r, s), s;
|
|
1798
1798
|
};
|
|
1799
1799
|
function te(t) {
|
|
1800
1800
|
return t !== null && typeof t == "object" && typeof t.url == "string";
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1802
|
+
function Es(t) {
|
|
1803
1803
|
return t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)} MB` : t >= 1024 ? `${Math.round(t / 1024)} KB` : `${t} B`;
|
|
1804
1804
|
}
|
|
1805
1805
|
let X = class extends g {
|
|
@@ -1816,9 +1816,9 @@ let X = class extends g {
|
|
|
1816
1816
|
if (!this.uploader) return;
|
|
1817
1817
|
this.uploadError = null, this.uploadingCount += t.length;
|
|
1818
1818
|
const e = this.field.multiple ? [...this.refs] : [];
|
|
1819
|
-
for (const
|
|
1819
|
+
for (const r of t)
|
|
1820
1820
|
try {
|
|
1821
|
-
e.push(await this.uploader(
|
|
1821
|
+
e.push(await this.uploader(r));
|
|
1822
1822
|
} catch {
|
|
1823
1823
|
this.uploadError = m("uploadFailed");
|
|
1824
1824
|
} finally {
|
|
@@ -1827,7 +1827,7 @@ let X = class extends g {
|
|
|
1827
1827
|
this.emitRefs(e);
|
|
1828
1828
|
}
|
|
1829
1829
|
onPick(t) {
|
|
1830
|
-
const e = t.target,
|
|
1830
|
+
const e = t.target, r = Array.from(e.files ?? []), a = this.field.maxSize, s = a ? r.filter((o) => o.size <= a) : r, i = a ? r.filter((o) => o.size > a) : [];
|
|
1831
1831
|
if (this.rejectedNames = i.map((o) => o.name), this.uploader) {
|
|
1832
1832
|
e.value = "", this.uploadAll(s);
|
|
1833
1833
|
return;
|
|
@@ -1835,7 +1835,7 @@ let X = class extends g {
|
|
|
1835
1835
|
this.emitInput(this.field.multiple ? s : s[0] ?? null);
|
|
1836
1836
|
}
|
|
1837
1837
|
renderControl() {
|
|
1838
|
-
return
|
|
1838
|
+
return l`<input
|
|
1839
1839
|
class="baht-control baht-control--file"
|
|
1840
1840
|
id=${this.controlId}
|
|
1841
1841
|
type="file"
|
|
@@ -1847,16 +1847,16 @@ let X = class extends g {
|
|
|
1847
1847
|
aria-describedby=${this.describedBy}
|
|
1848
1848
|
@change=${(t) => this.onPick(t)}
|
|
1849
1849
|
/>
|
|
1850
|
-
${this.uploadingCount > 0 ?
|
|
1851
|
-
${this.uploadError ?
|
|
1852
|
-
${this.rejectedNames.length > 0 ?
|
|
1850
|
+
${this.uploadingCount > 0 ? l`<p class="baht-file-status" role="status">${m("uploading")}</p>` : h}
|
|
1851
|
+
${this.uploadError ? l`<p class="baht-error" role="alert">${this.uploadError}</p>` : h}
|
|
1852
|
+
${this.rejectedNames.length > 0 ? l`<p class="baht-error baht-file-rejected" role="alert">
|
|
1853
1853
|
${m("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
|
|
1854
1854
|
</p>` : h}
|
|
1855
1855
|
${this.refs.map(
|
|
1856
|
-
(t) =>
|
|
1856
|
+
(t) => l`<span class="baht-file-chip">
|
|
1857
1857
|
<a href=${t.url} target="_blank" rel="noreferrer">${t.name}</a>
|
|
1858
|
-
<span class="baht-file-size">${
|
|
1859
|
-
${this.disabled || this.readonly ? h :
|
|
1858
|
+
<span class="baht-file-size">${Es(t.size)}</span>
|
|
1859
|
+
${this.disabled || this.readonly ? h : l`<button
|
|
1860
1860
|
type="button"
|
|
1861
1861
|
class="baht-file-remove"
|
|
1862
1862
|
aria-label=${m("removeFile")}
|
|
@@ -1870,7 +1870,7 @@ let X = class extends g {
|
|
|
1870
1870
|
}
|
|
1871
1871
|
};
|
|
1872
1872
|
gt([
|
|
1873
|
-
|
|
1873
|
+
n({ attribute: !1 })
|
|
1874
1874
|
], X.prototype, "uploader", 2);
|
|
1875
1875
|
gt([
|
|
1876
1876
|
v()
|
|
@@ -1884,105 +1884,106 @@ gt([
|
|
|
1884
1884
|
X = gt([
|
|
1885
1885
|
p("baht-file")
|
|
1886
1886
|
], X);
|
|
1887
|
-
var
|
|
1888
|
-
for (var s =
|
|
1889
|
-
(o = t[i]) && (s = (
|
|
1890
|
-
return
|
|
1887
|
+
var Bs = Object.defineProperty, js = Object.getOwnPropertyDescriptor, re = (t, e, r, a) => {
|
|
1888
|
+
for (var s = a > 1 ? void 0 : a ? js(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1889
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1890
|
+
return a && s && Bs(e, r, s), s;
|
|
1891
1891
|
};
|
|
1892
|
-
let It = class extends
|
|
1892
|
+
let It = class extends d {
|
|
1893
1893
|
render() {
|
|
1894
|
+
if (!this.field) return h;
|
|
1894
1895
|
const t = this.field.variant ?? "body";
|
|
1895
|
-
return
|
|
1896
|
+
return l`<div class="baht-text baht-text--${t}">${this.field.text ?? this.field.label ?? ""}</div>`;
|
|
1896
1897
|
}
|
|
1897
1898
|
};
|
|
1898
|
-
|
|
1899
|
-
|
|
1899
|
+
re([
|
|
1900
|
+
n({ attribute: !1 })
|
|
1900
1901
|
], It.prototype, "field", 2);
|
|
1901
|
-
It =
|
|
1902
|
+
It = re([
|
|
1902
1903
|
p("baht-text")
|
|
1903
1904
|
], It);
|
|
1904
|
-
var
|
|
1905
|
-
for (var s =
|
|
1906
|
-
(o = t[i]) && (s = (
|
|
1907
|
-
return
|
|
1905
|
+
var Ss = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, ie = (t, e, r, a) => {
|
|
1906
|
+
for (var s = a > 1 ? void 0 : a ? Fs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1907
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1908
|
+
return a && s && Ss(e, r, s), s;
|
|
1908
1909
|
};
|
|
1909
|
-
let qt = class extends
|
|
1910
|
+
let qt = class extends d {
|
|
1910
1911
|
render() {
|
|
1911
|
-
return
|
|
1912
|
+
return this.field ? l`<div class="baht-section">
|
|
1912
1913
|
<span class="baht-section-label">${this.field.text ?? this.field.label ?? ""}</span>
|
|
1913
|
-
</div
|
|
1914
|
+
</div>` : h;
|
|
1914
1915
|
}
|
|
1915
1916
|
};
|
|
1916
1917
|
ie([
|
|
1917
|
-
|
|
1918
|
+
n({ attribute: !1 })
|
|
1918
1919
|
], qt.prototype, "field", 2);
|
|
1919
1920
|
qt = ie([
|
|
1920
1921
|
p("baht-section")
|
|
1921
1922
|
], qt);
|
|
1922
|
-
var Ns = Object.defineProperty,
|
|
1923
|
-
for (var s =
|
|
1924
|
-
(o = t[i]) && (s = (
|
|
1925
|
-
return
|
|
1923
|
+
var Ns = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, Bt = (t, e, r, a) => {
|
|
1924
|
+
for (var s = a > 1 ? void 0 : a ? Is(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1925
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1926
|
+
return a && s && Ns(e, r, s), s;
|
|
1926
1927
|
};
|
|
1927
|
-
let dt = class extends
|
|
1928
|
+
let dt = class extends d {
|
|
1928
1929
|
constructor() {
|
|
1929
1930
|
super(...arguments), this.total = 0, this.label = "", this.color = "";
|
|
1930
1931
|
}
|
|
1931
1932
|
render() {
|
|
1932
|
-
return
|
|
1933
|
+
return l`<div class="baht-stat-chart">
|
|
1933
1934
|
<div
|
|
1934
1935
|
class="baht-stat-chart-total"
|
|
1935
1936
|
style=${this.color ? `color:${this.color}` : h}
|
|
1936
1937
|
>${this.total.toLocaleString("en-US")}</div>
|
|
1937
|
-
${this.label ?
|
|
1938
|
+
${this.label ? l`<div class="baht-stat-chart-label">${this.label}</div>` : h}
|
|
1938
1939
|
</div>`;
|
|
1939
1940
|
}
|
|
1940
1941
|
};
|
|
1941
1942
|
Bt([
|
|
1942
|
-
|
|
1943
|
+
n({ type: Number })
|
|
1943
1944
|
], dt.prototype, "total", 2);
|
|
1944
1945
|
Bt([
|
|
1945
|
-
|
|
1946
|
+
n()
|
|
1946
1947
|
], dt.prototype, "label", 2);
|
|
1947
1948
|
Bt([
|
|
1948
|
-
|
|
1949
|
+
n()
|
|
1949
1950
|
], dt.prototype, "color", 2);
|
|
1950
1951
|
dt = Bt([
|
|
1951
1952
|
p("baht-stat-chart")
|
|
1952
1953
|
], dt);
|
|
1953
|
-
const
|
|
1954
|
+
const qs = 10;
|
|
1954
1955
|
function oe(t, e) {
|
|
1955
|
-
return e && t === 0 ? e : `var(--baht-chart-${t %
|
|
1956
|
+
return e && t === 0 ? e : `var(--baht-chart-${t % qs + 1})`;
|
|
1956
1957
|
}
|
|
1957
|
-
var
|
|
1958
|
-
for (var s =
|
|
1959
|
-
(o = t[i]) && (s = (
|
|
1960
|
-
return
|
|
1958
|
+
var Ms = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, nt = (t, e, r, a) => {
|
|
1959
|
+
for (var s = a > 1 ? void 0 : a ? Rs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1960
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1961
|
+
return a && s && Ms(e, r, s), s;
|
|
1961
1962
|
};
|
|
1962
|
-
let S = class extends
|
|
1963
|
+
let S = class extends d {
|
|
1963
1964
|
constructor() {
|
|
1964
1965
|
super(...arguments), this.groups = [], this.total = null, this.color = "", this.centerLabel = "records", this.emptyMessage = "No data to chart";
|
|
1965
1966
|
}
|
|
1966
1967
|
render() {
|
|
1967
1968
|
if (this.groups.length === 0)
|
|
1968
|
-
return
|
|
1969
|
-
const t = this.groups.reduce((o,
|
|
1969
|
+
return l`<div class="baht-chart-empty">${this.emptyMessage}</div>`;
|
|
1970
|
+
const t = this.groups.reduce((o, c) => o + c.count, 0) || 1, e = this.total ?? this.groups.reduce((o, c) => o + c.count, 0), r = S.R, a = 2 * Math.PI * r;
|
|
1970
1971
|
let s = 0;
|
|
1971
|
-
const i = this.groups.map((o,
|
|
1972
|
+
const i = this.groups.map((o, c) => {
|
|
1972
1973
|
const b = o.count / t, H = {
|
|
1973
1974
|
...o,
|
|
1974
1975
|
frac: b,
|
|
1975
|
-
dash: `${b *
|
|
1976
|
-
offset: -s *
|
|
1977
|
-
color: oe(
|
|
1976
|
+
dash: `${b * a} ${a - b * a}`,
|
|
1977
|
+
offset: -s * a,
|
|
1978
|
+
color: oe(c, this.color || void 0)
|
|
1978
1979
|
};
|
|
1979
1980
|
return s += b, H;
|
|
1980
1981
|
});
|
|
1981
|
-
return
|
|
1982
|
+
return l`<div class="baht-donut-chart">
|
|
1982
1983
|
<svg width="160" height="160" viewBox="0 0 160 160" role="img" aria-label="Donut chart">
|
|
1983
1984
|
<g transform="translate(80,80) rotate(-90)">
|
|
1984
1985
|
${i.map(
|
|
1985
|
-
(o) => D`<circle r=${
|
|
1986
|
+
(o) => D`<circle r=${r} cx="0" cy="0" fill="none" stroke=${o.color}
|
|
1986
1987
|
stroke-width="22" stroke-dasharray=${o.dash} stroke-dashoffset=${o.offset}/>`
|
|
1987
1988
|
)}
|
|
1988
1989
|
</g>
|
|
@@ -1991,7 +1992,7 @@ let S = class extends c {
|
|
|
1991
1992
|
</svg>
|
|
1992
1993
|
<div class="baht-chart-legend">
|
|
1993
1994
|
${i.map(
|
|
1994
|
-
(o) =>
|
|
1995
|
+
(o) => l`<div class="baht-chart-legend-row">
|
|
1995
1996
|
<span class="baht-chart-swatch" style="background:${o.color}" aria-hidden="true"></span>
|
|
1996
1997
|
<span class="baht-chart-legend-label">${o.label || "(empty)"}</span>
|
|
1997
1998
|
<span class="baht-chart-legend-count">${o.count}</span>
|
|
@@ -2004,44 +2005,44 @@ let S = class extends c {
|
|
|
2004
2005
|
};
|
|
2005
2006
|
S.R = 54;
|
|
2006
2007
|
nt([
|
|
2007
|
-
|
|
2008
|
+
n({ attribute: !1 })
|
|
2008
2009
|
], S.prototype, "groups", 2);
|
|
2009
2010
|
nt([
|
|
2010
|
-
|
|
2011
|
+
n({ type: Number })
|
|
2011
2012
|
], S.prototype, "total", 2);
|
|
2012
2013
|
nt([
|
|
2013
|
-
|
|
2014
|
+
n()
|
|
2014
2015
|
], S.prototype, "color", 2);
|
|
2015
2016
|
nt([
|
|
2016
|
-
|
|
2017
|
+
n({ attribute: "center-label" })
|
|
2017
2018
|
], S.prototype, "centerLabel", 2);
|
|
2018
2019
|
nt([
|
|
2019
|
-
|
|
2020
|
+
n({ attribute: "empty-message" })
|
|
2020
2021
|
], S.prototype, "emptyMessage", 2);
|
|
2021
2022
|
S = nt([
|
|
2022
2023
|
p("baht-donut-chart")
|
|
2023
2024
|
], S);
|
|
2024
|
-
var Ls = Object.defineProperty,
|
|
2025
|
-
for (var s =
|
|
2026
|
-
(o = t[i]) && (s = (
|
|
2027
|
-
return
|
|
2025
|
+
var Ls = Object.defineProperty, As = Object.getOwnPropertyDescriptor, jt = (t, e, r, a) => {
|
|
2026
|
+
for (var s = a > 1 ? void 0 : a ? As(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2027
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2028
|
+
return a && s && Ls(e, r, s), s;
|
|
2028
2029
|
};
|
|
2029
|
-
let ut = class extends
|
|
2030
|
+
let ut = class extends d {
|
|
2030
2031
|
constructor() {
|
|
2031
2032
|
super(...arguments), this.groups = [], this.color = "", this.emptyMessage = "No data to chart";
|
|
2032
2033
|
}
|
|
2033
2034
|
render() {
|
|
2034
2035
|
if (this.groups.length === 0)
|
|
2035
|
-
return
|
|
2036
|
+
return l`<div class="baht-chart-empty">${this.emptyMessage}</div>`;
|
|
2036
2037
|
const t = Math.max(1, ...this.groups.map((e) => e.count));
|
|
2037
|
-
return
|
|
2038
|
+
return l`<div class="baht-bar-chart">
|
|
2038
2039
|
${this.groups.map(
|
|
2039
|
-
(e,
|
|
2040
|
+
(e, r) => l`<div class="baht-bar-chart-row">
|
|
2040
2041
|
<span class="baht-bar-chart-label" title=${e.label}>${e.label || "(empty)"}</span>
|
|
2041
2042
|
<div class="baht-bar-chart-track">
|
|
2042
2043
|
<div
|
|
2043
2044
|
class="baht-bar-chart-bar"
|
|
2044
|
-
style="width:${Math.max(2, e.count / t * 100)}%;background:${this.color || oe(
|
|
2045
|
+
style="width:${Math.max(2, e.count / t * 100)}%;background:${this.color || oe(r)}"
|
|
2045
2046
|
></div>
|
|
2046
2047
|
</div>
|
|
2047
2048
|
<span class="baht-bar-chart-count">${e.count}</span>
|
|
@@ -2051,52 +2052,52 @@ let ut = class extends c {
|
|
|
2051
2052
|
}
|
|
2052
2053
|
};
|
|
2053
2054
|
jt([
|
|
2054
|
-
|
|
2055
|
+
n({ attribute: !1 })
|
|
2055
2056
|
], ut.prototype, "groups", 2);
|
|
2056
2057
|
jt([
|
|
2057
|
-
|
|
2058
|
+
n()
|
|
2058
2059
|
], ut.prototype, "color", 2);
|
|
2059
2060
|
jt([
|
|
2060
|
-
|
|
2061
|
+
n({ attribute: "empty-message" })
|
|
2061
2062
|
], ut.prototype, "emptyMessage", 2);
|
|
2062
2063
|
ut = jt([
|
|
2063
2064
|
p("baht-bar-chart")
|
|
2064
2065
|
], ut);
|
|
2065
|
-
var
|
|
2066
|
-
for (var s =
|
|
2067
|
-
(o = t[i]) && (s = (
|
|
2068
|
-
return
|
|
2066
|
+
var Ts = Object.defineProperty, Ks = Object.getOwnPropertyDescriptor, St = (t, e, r, a) => {
|
|
2067
|
+
for (var s = a > 1 ? void 0 : a ? Ks(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2068
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2069
|
+
return a && s && Ts(e, r, s), s;
|
|
2069
2070
|
};
|
|
2070
|
-
let bt = class extends
|
|
2071
|
+
let bt = class extends d {
|
|
2071
2072
|
constructor() {
|
|
2072
2073
|
super(...arguments), this.icon = "🗂️", this.message = "Nothing to display", this.hint = "";
|
|
2073
2074
|
}
|
|
2074
2075
|
render() {
|
|
2075
|
-
return
|
|
2076
|
-
${this.icon ?
|
|
2076
|
+
return l`<div class="baht-empty-state">
|
|
2077
|
+
${this.icon ? l`<div class="baht-empty-state-icon" aria-hidden="true">${this.icon}</div>` : h}
|
|
2077
2078
|
<div class="baht-empty-state-message">${this.message}</div>
|
|
2078
|
-
${this.hint ?
|
|
2079
|
+
${this.hint ? l`<div class="baht-empty-state-hint">${this.hint}</div>` : h}
|
|
2079
2080
|
</div>`;
|
|
2080
2081
|
}
|
|
2081
2082
|
};
|
|
2082
2083
|
St([
|
|
2083
|
-
|
|
2084
|
+
n()
|
|
2084
2085
|
], bt.prototype, "icon", 2);
|
|
2085
2086
|
St([
|
|
2086
|
-
|
|
2087
|
+
n()
|
|
2087
2088
|
], bt.prototype, "message", 2);
|
|
2088
2089
|
St([
|
|
2089
|
-
|
|
2090
|
+
n()
|
|
2090
2091
|
], bt.prototype, "hint", 2);
|
|
2091
2092
|
bt = St([
|
|
2092
2093
|
p("baht-empty-state")
|
|
2093
2094
|
], bt);
|
|
2094
|
-
var
|
|
2095
|
-
for (var s =
|
|
2096
|
-
(o = t[i]) && (s = (
|
|
2097
|
-
return
|
|
2095
|
+
var Vs = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, wt = (t, e, r, a) => {
|
|
2096
|
+
for (var s = a > 1 ? void 0 : a ? Us(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2097
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2098
|
+
return a && s && Vs(e, r, s), s;
|
|
2098
2099
|
};
|
|
2099
|
-
let Z = class extends
|
|
2100
|
+
let Z = class extends d {
|
|
2100
2101
|
constructor() {
|
|
2101
2102
|
super(...arguments), this.icon = "⚠️", this.heading = "Something went wrong", this.message = "", this.retryLabel = "";
|
|
2102
2103
|
}
|
|
@@ -2104,35 +2105,35 @@ let Z = class extends c {
|
|
|
2104
2105
|
this.dispatchEvent(new CustomEvent("baht-retry", { bubbles: !0, composed: !0 }));
|
|
2105
2106
|
}
|
|
2106
2107
|
render() {
|
|
2107
|
-
return
|
|
2108
|
-
${this.icon ?
|
|
2108
|
+
return l`<div class="baht-error-state" role="alert">
|
|
2109
|
+
${this.icon ? l`<div class="baht-error-state-icon" aria-hidden="true">${this.icon}</div>` : h}
|
|
2109
2110
|
<div class="baht-error-state-heading">${this.heading}</div>
|
|
2110
|
-
${this.message ?
|
|
2111
|
-
${this.retryLabel ?
|
|
2111
|
+
${this.message ? l`<div class="baht-error-state-message">${this.message}</div>` : h}
|
|
2112
|
+
${this.retryLabel ? l`<baht-button size="sm" label=${this.retryLabel} @click=${this.onRetry}></baht-button>` : h}
|
|
2112
2113
|
</div>`;
|
|
2113
2114
|
}
|
|
2114
2115
|
};
|
|
2115
2116
|
wt([
|
|
2116
|
-
|
|
2117
|
+
n()
|
|
2117
2118
|
], Z.prototype, "icon", 2);
|
|
2118
2119
|
wt([
|
|
2119
|
-
|
|
2120
|
+
n()
|
|
2120
2121
|
], Z.prototype, "heading", 2);
|
|
2121
2122
|
wt([
|
|
2122
|
-
|
|
2123
|
+
n()
|
|
2123
2124
|
], Z.prototype, "message", 2);
|
|
2124
2125
|
wt([
|
|
2125
|
-
|
|
2126
|
+
n({ attribute: "retry-label" })
|
|
2126
2127
|
], Z.prototype, "retryLabel", 2);
|
|
2127
2128
|
Z = wt([
|
|
2128
2129
|
p("baht-error-state")
|
|
2129
2130
|
], Z);
|
|
2130
|
-
var
|
|
2131
|
-
for (var s =
|
|
2132
|
-
(o = t[i]) && (s = (
|
|
2133
|
-
return
|
|
2131
|
+
var zs = Object.defineProperty, Hs = Object.getOwnPropertyDescriptor, z = (t, e, r, a) => {
|
|
2132
|
+
for (var s = a > 1 ? void 0 : a ? Hs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2133
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2134
|
+
return a && s && zs(e, r, s), s;
|
|
2134
2135
|
};
|
|
2135
|
-
let M = class extends
|
|
2136
|
+
let M = class extends d {
|
|
2136
2137
|
constructor() {
|
|
2137
2138
|
super(...arguments), this.value = {}, this.keyPlaceholder = "key", this.valuePlaceholder = "value", this.addLabel = "Add row", this.disabled = !1, this.rows = [{ k: "", v: "" }], this.syncedJson = "";
|
|
2138
2139
|
}
|
|
@@ -2142,36 +2143,36 @@ let M = class extends c {
|
|
|
2142
2143
|
e !== this.syncedJson && (this.syncedJson = e, this.rows = this.toRows(this.value));
|
|
2143
2144
|
}
|
|
2144
2145
|
toRows(t) {
|
|
2145
|
-
const e = Object.entries(t ?? {}).map(([
|
|
2146
|
-
k:
|
|
2147
|
-
v: typeof
|
|
2146
|
+
const e = Object.entries(t ?? {}).map(([r, a]) => ({
|
|
2147
|
+
k: r,
|
|
2148
|
+
v: typeof a == "string" ? a : JSON.stringify(a)
|
|
2148
2149
|
}));
|
|
2149
2150
|
return e.length > 0 ? e : [{ k: "", v: "" }];
|
|
2150
2151
|
}
|
|
2151
2152
|
commit(t) {
|
|
2152
2153
|
this.rows = t.length > 0 ? t : [{ k: "", v: "" }];
|
|
2153
2154
|
const e = {};
|
|
2154
|
-
for (const
|
|
2155
|
+
for (const r of t) r.k.trim() && (e[r.k.trim()] = r.v);
|
|
2155
2156
|
this.syncedJson = JSON.stringify(e), this.dispatchEvent(
|
|
2156
2157
|
new CustomEvent("baht-change", { detail: { value: e }, bubbles: !0, composed: !0 })
|
|
2157
2158
|
);
|
|
2158
2159
|
}
|
|
2159
2160
|
edit(t, e) {
|
|
2160
|
-
this.commit(this.rows.map((
|
|
2161
|
+
this.commit(this.rows.map((r, a) => a === t ? { ...r, ...e } : r));
|
|
2161
2162
|
}
|
|
2162
2163
|
addRow() {
|
|
2163
2164
|
this.rows = [...this.rows, { k: "", v: "" }];
|
|
2164
2165
|
}
|
|
2165
2166
|
render() {
|
|
2166
|
-
return
|
|
2167
|
+
return l`<div class="baht-keyvalue">
|
|
2167
2168
|
${this.rows.map(
|
|
2168
|
-
(t, e) =>
|
|
2169
|
+
(t, e) => l`<div class="baht-keyvalue-row">
|
|
2169
2170
|
<input
|
|
2170
2171
|
class="baht-control baht-keyvalue-key"
|
|
2171
2172
|
placeholder=${this.keyPlaceholder}
|
|
2172
2173
|
.value=${t.k}
|
|
2173
2174
|
?disabled=${this.disabled}
|
|
2174
|
-
@input=${(
|
|
2175
|
+
@input=${(r) => this.edit(e, { k: r.target.value })}
|
|
2175
2176
|
/>
|
|
2176
2177
|
<span class="baht-keyvalue-eq" aria-hidden="true">=</span>
|
|
2177
2178
|
<input
|
|
@@ -2179,14 +2180,14 @@ let M = class extends c {
|
|
|
2179
2180
|
placeholder=${this.valuePlaceholder}
|
|
2180
2181
|
.value=${t.v}
|
|
2181
2182
|
?disabled=${this.disabled}
|
|
2182
|
-
@input=${(
|
|
2183
|
+
@input=${(r) => this.edit(e, { v: r.target.value })}
|
|
2183
2184
|
/>
|
|
2184
2185
|
<button
|
|
2185
2186
|
type="button"
|
|
2186
2187
|
class="baht-keyvalue-remove"
|
|
2187
2188
|
aria-label="Remove row"
|
|
2188
2189
|
?disabled=${this.disabled}
|
|
2189
|
-
@click=${() => this.commit(this.rows.filter((
|
|
2190
|
+
@click=${() => this.commit(this.rows.filter((r, a) => a !== e))}
|
|
2190
2191
|
>${J("close")}</button>
|
|
2191
2192
|
</div>`
|
|
2192
2193
|
)}
|
|
@@ -2200,19 +2201,19 @@ let M = class extends c {
|
|
|
2200
2201
|
}
|
|
2201
2202
|
};
|
|
2202
2203
|
z([
|
|
2203
|
-
|
|
2204
|
+
n({ attribute: !1 })
|
|
2204
2205
|
], M.prototype, "value", 2);
|
|
2205
2206
|
z([
|
|
2206
|
-
|
|
2207
|
+
n({ attribute: "key-placeholder" })
|
|
2207
2208
|
], M.prototype, "keyPlaceholder", 2);
|
|
2208
2209
|
z([
|
|
2209
|
-
|
|
2210
|
+
n({ attribute: "value-placeholder" })
|
|
2210
2211
|
], M.prototype, "valuePlaceholder", 2);
|
|
2211
2212
|
z([
|
|
2212
|
-
|
|
2213
|
+
n({ attribute: "add-label" })
|
|
2213
2214
|
], M.prototype, "addLabel", 2);
|
|
2214
2215
|
z([
|
|
2215
|
-
|
|
2216
|
+
n({ type: Boolean })
|
|
2216
2217
|
], M.prototype, "disabled", 2);
|
|
2217
2218
|
z([
|
|
2218
2219
|
v()
|
|
@@ -2220,14 +2221,14 @@ z([
|
|
|
2220
2221
|
M = z([
|
|
2221
2222
|
p("baht-keyvalue-editor")
|
|
2222
2223
|
], M);
|
|
2223
|
-
var
|
|
2224
|
-
for (var s =
|
|
2225
|
-
(o = t[i]) && (s = (
|
|
2226
|
-
return
|
|
2224
|
+
var Js = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, w = (t, e, r, a) => {
|
|
2225
|
+
for (var s = a > 1 ? void 0 : a ? Ws(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2226
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2227
|
+
return a && s && Js(e, r, s), s;
|
|
2227
2228
|
};
|
|
2228
|
-
let
|
|
2229
|
+
let Gs = 0, y = class extends d {
|
|
2229
2230
|
constructor() {
|
|
2230
|
-
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.listboxId = `baht-refpicker-list-${++
|
|
2231
|
+
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.listboxId = `baht-refpicker-list-${++Gs}`, this.fetchSeq = 0, this.onDocMousedown = (t) => {
|
|
2231
2232
|
this.contains(t.target) || this.close();
|
|
2232
2233
|
};
|
|
2233
2234
|
}
|
|
@@ -2249,8 +2250,8 @@ let Ws = 0, y = class extends c {
|
|
|
2249
2250
|
const e = ++this.fetchSeq;
|
|
2250
2251
|
this.loading = !0;
|
|
2251
2252
|
try {
|
|
2252
|
-
const
|
|
2253
|
-
e === this.fetchSeq && (this.options =
|
|
2253
|
+
const r = await this.fetcher(t);
|
|
2254
|
+
e === this.fetchSeq && (this.options = r);
|
|
2254
2255
|
} catch {
|
|
2255
2256
|
e === this.fetchSeq && (this.options = []);
|
|
2256
2257
|
} finally {
|
|
@@ -2280,8 +2281,8 @@ let Ws = 0, y = class extends c {
|
|
|
2280
2281
|
if (this.open)
|
|
2281
2282
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
2282
2283
|
t.preventDefault();
|
|
2283
|
-
const e = t.key === "ArrowDown" ? 1 : -1,
|
|
2284
|
-
|
|
2284
|
+
const e = t.key === "ArrowDown" ? 1 : -1, r = this.options.length;
|
|
2285
|
+
r > 0 && (this.activeIndex = (this.activeIndex + e + r) % r);
|
|
2285
2286
|
} else if (t.key === "Enter") {
|
|
2286
2287
|
t.preventDefault();
|
|
2287
2288
|
const e = this.options[this.activeIndex];
|
|
@@ -2290,7 +2291,7 @@ let Ws = 0, y = class extends c {
|
|
|
2290
2291
|
}
|
|
2291
2292
|
render() {
|
|
2292
2293
|
const t = this.open ? this.term : this.display || this.value;
|
|
2293
|
-
return
|
|
2294
|
+
return l`<div class="baht-refpicker${this.open ? " baht-refpicker--open" : ""}">
|
|
2294
2295
|
<div class="baht-refpicker-field">
|
|
2295
2296
|
<input
|
|
2296
2297
|
class="baht-control baht-refpicker-input"
|
|
@@ -2310,7 +2311,7 @@ let Ws = 0, y = class extends c {
|
|
|
2310
2311
|
@input=${this.onInput}
|
|
2311
2312
|
@keydown=${this.onKeydown}
|
|
2312
2313
|
/>
|
|
2313
|
-
${this.value && !this.disabled ?
|
|
2314
|
+
${this.value && !this.disabled ? l`<button
|
|
2314
2315
|
type="button"
|
|
2315
2316
|
class="baht-refpicker-clear"
|
|
2316
2317
|
aria-label="Clear"
|
|
@@ -2326,7 +2327,7 @@ let Ws = 0, y = class extends c {
|
|
|
2326
2327
|
?disabled=${this.disabled}
|
|
2327
2328
|
@click=${() => this.open ? this.close() : this.openLookup()}
|
|
2328
2329
|
>${J("search")}</button>
|
|
2329
|
-
${this.value && this.href ?
|
|
2330
|
+
${this.value && this.href ? l`<a
|
|
2330
2331
|
class="baht-refpicker-open"
|
|
2331
2332
|
href=${this.href}
|
|
2332
2333
|
aria-label="Open record"
|
|
@@ -2339,18 +2340,18 @@ let Ws = 0, y = class extends c {
|
|
|
2339
2340
|
aria-label=${this.label}
|
|
2340
2341
|
?hidden=${!this.open}
|
|
2341
2342
|
>
|
|
2342
|
-
${this.loading ?
|
|
2343
|
-
(e,
|
|
2343
|
+
${this.loading ? l`<div class="baht-refpicker-note">Searching…</div>` : this.options.length === 0 ? l`<div class="baht-refpicker-note">No matches</div>` : this.options.map(
|
|
2344
|
+
(e, r) => l`<button
|
|
2344
2345
|
type="button"
|
|
2345
|
-
class="baht-refpicker-option${
|
|
2346
|
-
id="${this.listboxId}-${
|
|
2346
|
+
class="baht-refpicker-option${r === this.activeIndex ? " baht-refpicker-option--active" : ""}"
|
|
2347
|
+
id="${this.listboxId}-${r}"
|
|
2347
2348
|
role="option"
|
|
2348
2349
|
aria-selected=${e.key === this.value ? "true" : "false"}
|
|
2349
|
-
@mousedown=${(
|
|
2350
|
+
@mousedown=${(a) => a.preventDefault()}
|
|
2350
2351
|
@click=${() => this.pick(e)}
|
|
2351
2352
|
>
|
|
2352
2353
|
<span class="baht-refpicker-option-label">${e.label}</span>
|
|
2353
|
-
${e.sub ?
|
|
2354
|
+
${e.sub ? l`<span class="baht-refpicker-option-sub">${e.sub}</span>` : h}
|
|
2354
2355
|
</button>`
|
|
2355
2356
|
)}
|
|
2356
2357
|
</div>
|
|
@@ -2358,34 +2359,34 @@ let Ws = 0, y = class extends c {
|
|
|
2358
2359
|
}
|
|
2359
2360
|
};
|
|
2360
2361
|
w([
|
|
2361
|
-
|
|
2362
|
+
n()
|
|
2362
2363
|
], y.prototype, "label", 2);
|
|
2363
2364
|
w([
|
|
2364
|
-
|
|
2365
|
+
n()
|
|
2365
2366
|
], y.prototype, "value", 2);
|
|
2366
2367
|
w([
|
|
2367
|
-
|
|
2368
|
+
n()
|
|
2368
2369
|
], y.prototype, "display", 2);
|
|
2369
2370
|
w([
|
|
2370
|
-
|
|
2371
|
+
n()
|
|
2371
2372
|
], y.prototype, "placeholder", 2);
|
|
2372
2373
|
w([
|
|
2373
|
-
|
|
2374
|
+
n({ type: Boolean })
|
|
2374
2375
|
], y.prototype, "disabled", 2);
|
|
2375
2376
|
w([
|
|
2376
|
-
|
|
2377
|
+
n({ type: Boolean })
|
|
2377
2378
|
], y.prototype, "invalid", 2);
|
|
2378
2379
|
w([
|
|
2379
|
-
|
|
2380
|
+
n()
|
|
2380
2381
|
], y.prototype, "href", 2);
|
|
2381
2382
|
w([
|
|
2382
|
-
|
|
2383
|
+
n({ attribute: "lookup-label" })
|
|
2383
2384
|
], y.prototype, "lookupLabel", 2);
|
|
2384
2385
|
w([
|
|
2385
|
-
|
|
2386
|
+
n({ type: Number })
|
|
2386
2387
|
], y.prototype, "debounce", 2);
|
|
2387
2388
|
w([
|
|
2388
|
-
|
|
2389
|
+
n({ attribute: !1 })
|
|
2389
2390
|
], y.prototype, "fetcher", 2);
|
|
2390
2391
|
w([
|
|
2391
2392
|
v()
|
|
@@ -2425,12 +2426,12 @@ const le = {
|
|
|
2425
2426
|
section: "baht-section",
|
|
2426
2427
|
repeater: "baht-repeater"
|
|
2427
2428
|
};
|
|
2428
|
-
var
|
|
2429
|
-
for (var s =
|
|
2430
|
-
(o = t[i]) && (s = (
|
|
2431
|
-
return
|
|
2429
|
+
var Ys = Object.defineProperty, Qs = Object.getOwnPropertyDescriptor, ne = (t, e, r, a) => {
|
|
2430
|
+
for (var s = a > 1 ? void 0 : a ? Qs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2431
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2432
|
+
return a && s && Ys(e, r, s), s;
|
|
2432
2433
|
};
|
|
2433
|
-
const
|
|
2434
|
+
const Xs = {
|
|
2434
2435
|
"1/4": "baht-field--w-1-4",
|
|
2435
2436
|
"1/2": "baht-field--w-1-2",
|
|
2436
2437
|
"3/4": "baht-field--w-3-4",
|
|
@@ -2443,8 +2444,8 @@ let Mt = class extends g {
|
|
|
2443
2444
|
willUpdate(t) {
|
|
2444
2445
|
if (t.has("field") && this.controls.clear(), t.has("value")) {
|
|
2445
2446
|
const e = this.rows.length;
|
|
2446
|
-
for (const
|
|
2447
|
-
Number(
|
|
2447
|
+
for (const r of this.controls.keys())
|
|
2448
|
+
Number(r.slice(0, r.indexOf(":"))) >= e && this.controls.delete(r);
|
|
2448
2449
|
}
|
|
2449
2450
|
}
|
|
2450
2451
|
get rows() {
|
|
@@ -2453,9 +2454,9 @@ let Mt = class extends g {
|
|
|
2453
2454
|
get subFields() {
|
|
2454
2455
|
return [...this.field.fields ?? []].sort((t, e) => t.order - e.order).filter((t) => t.type !== "repeater");
|
|
2455
2456
|
}
|
|
2456
|
-
patchRow(t, e,
|
|
2457
|
-
const
|
|
2458
|
-
|
|
2457
|
+
patchRow(t, e, r) {
|
|
2458
|
+
const a = [...this.rows];
|
|
2459
|
+
a[t] = { ...a[t], [e]: r }, this.emitInput(a);
|
|
2459
2460
|
}
|
|
2460
2461
|
addRow() {
|
|
2461
2462
|
const t = {};
|
|
@@ -2464,40 +2465,40 @@ let Mt = class extends g {
|
|
|
2464
2465
|
this.emitInput([...this.rows, t]);
|
|
2465
2466
|
}
|
|
2466
2467
|
removeRow(t) {
|
|
2467
|
-
this.controls.clear(), this.emitInput(this.rows.filter((e,
|
|
2468
|
+
this.controls.clear(), this.emitInput(this.rows.filter((e, r) => r !== t));
|
|
2468
2469
|
}
|
|
2469
2470
|
errorFor(t, e) {
|
|
2470
|
-
var
|
|
2471
|
-
const
|
|
2472
|
-
return ((
|
|
2471
|
+
var a;
|
|
2472
|
+
const r = `${this.field.key}[${t}].${e}`;
|
|
2473
|
+
return ((a = this.rowErrors.find((s) => s.key === r)) == null ? void 0 : a.message) ?? null;
|
|
2473
2474
|
}
|
|
2474
|
-
renderSub(t, e,
|
|
2475
|
-
const
|
|
2476
|
-
if (!
|
|
2477
|
-
const s = `${e}:${
|
|
2475
|
+
renderSub(t, e, r) {
|
|
2476
|
+
const a = le[r.type];
|
|
2477
|
+
if (!a) return h;
|
|
2478
|
+
const s = `${e}:${r.key}`;
|
|
2478
2479
|
let i = this.controls.get(s);
|
|
2479
|
-
(!i || i.tagName.toLowerCase() !==
|
|
2480
|
-
|
|
2481
|
-
const { value: b } =
|
|
2482
|
-
this.patchRow(e,
|
|
2483
|
-
}), this.controls.set(s, i)), i.field =
|
|
2484
|
-
const o =
|
|
2485
|
-
return
|
|
2480
|
+
(!i || i.tagName.toLowerCase() !== a) && (i = document.createElement(a), i.addEventListener("baht-input", (c) => {
|
|
2481
|
+
c.stopPropagation();
|
|
2482
|
+
const { value: b } = c.detail;
|
|
2483
|
+
this.patchRow(e, r.key, b);
|
|
2484
|
+
}), this.controls.set(s, i)), i.field = r, i.value = Object.hasOwn(t, r.key) ? t[r.key] : _t(r), i.disabled = this.disabled, i.readonly = this.readonly, i.required = !!r.required, i.error = this.errorFor(e, r.key);
|
|
2485
|
+
const o = Xs[r.width ?? "full"] ?? "baht-field--w-full";
|
|
2486
|
+
return l`<div class="baht-field ${o}" data-key=${r.key} data-type=${r.type}>
|
|
2486
2487
|
${i}
|
|
2487
2488
|
</div>`;
|
|
2488
2489
|
}
|
|
2489
2490
|
renderControl() {
|
|
2490
|
-
const t = this.rows, e = !this.disabled && !this.readonly,
|
|
2491
|
-
return
|
|
2491
|
+
const t = this.rows, e = !this.disabled && !this.readonly, r = this.field.maxRows !== void 0 && t.length >= this.field.maxRows;
|
|
2492
|
+
return l`<div
|
|
2492
2493
|
class="baht-repeater"
|
|
2493
2494
|
id=${this.controlId}
|
|
2494
2495
|
role="group"
|
|
2495
2496
|
aria-describedby=${this.describedBy}
|
|
2496
2497
|
>
|
|
2497
2498
|
${t.map(
|
|
2498
|
-
(
|
|
2499
|
-
${this.subFields.map((i) => this.renderSub(
|
|
2500
|
-
${e ?
|
|
2499
|
+
(a, s) => l`<div class="baht-repeater-row" data-row=${s}>
|
|
2500
|
+
${this.subFields.map((i) => this.renderSub(a, s, i))}
|
|
2501
|
+
${e ? l`<button
|
|
2501
2502
|
type="button"
|
|
2502
2503
|
class="baht-repeater-remove"
|
|
2503
2504
|
aria-label=${m("removeRow")}
|
|
@@ -2508,10 +2509,10 @@ let Mt = class extends g {
|
|
|
2508
2509
|
</button>` : h}
|
|
2509
2510
|
</div>`
|
|
2510
2511
|
)}
|
|
2511
|
-
${this.readonly ? h :
|
|
2512
|
+
${this.readonly ? h : l`<button
|
|
2512
2513
|
type="button"
|
|
2513
2514
|
class="baht-repeater-add"
|
|
2514
|
-
?disabled=${this.disabled ||
|
|
2515
|
+
?disabled=${this.disabled || r}
|
|
2515
2516
|
@click=${() => this.addRow()}
|
|
2516
2517
|
>
|
|
2517
2518
|
+ ${this.field.addLabel ?? m("addRow")}
|
|
@@ -2520,63 +2521,63 @@ let Mt = class extends g {
|
|
|
2520
2521
|
}
|
|
2521
2522
|
};
|
|
2522
2523
|
ne([
|
|
2523
|
-
|
|
2524
|
+
n({ attribute: !1 })
|
|
2524
2525
|
], Mt.prototype, "rowErrors", 2);
|
|
2525
2526
|
Mt = ne([
|
|
2526
2527
|
p("baht-repeater")
|
|
2527
2528
|
], Mt);
|
|
2528
|
-
var
|
|
2529
|
-
for (var s =
|
|
2530
|
-
(o = t[i]) && (s = (
|
|
2531
|
-
return
|
|
2529
|
+
var Zs = Object.defineProperty, ta = Object.getOwnPropertyDescriptor, Ft = (t, e, r, a) => {
|
|
2530
|
+
for (var s = a > 1 ? void 0 : a ? ta(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2531
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2532
|
+
return a && s && Zs(e, r, s), s;
|
|
2532
2533
|
};
|
|
2533
|
-
let vt = class extends
|
|
2534
|
+
let vt = class extends d {
|
|
2534
2535
|
constructor() {
|
|
2535
2536
|
super(...arguments), this.steps = [], this.current = 0, this.variant = "default";
|
|
2536
2537
|
}
|
|
2537
2538
|
render() {
|
|
2538
2539
|
const t = this.variant === "sidebar";
|
|
2539
|
-
return
|
|
2540
|
+
return l`<ol
|
|
2540
2541
|
class="baht-steps ${t ? "baht-steps--sidebar" : ""}"
|
|
2541
2542
|
aria-label=${m("step", { current: this.current + 1, total: this.steps.length })}
|
|
2542
2543
|
>
|
|
2543
|
-
${this.steps.map((e,
|
|
2544
|
-
const
|
|
2545
|
-
return
|
|
2546
|
-
class="baht-step baht-step--${
|
|
2547
|
-
aria-current=${
|
|
2544
|
+
${this.steps.map((e, r) => {
|
|
2545
|
+
const a = r < this.current ? "done" : r === this.current ? "current" : "todo";
|
|
2546
|
+
return l`<li
|
|
2547
|
+
class="baht-step baht-step--${a} ${t ? "baht-step--sidebar" : ""}"
|
|
2548
|
+
aria-current=${a === "current" ? "step" : "false"}
|
|
2548
2549
|
>
|
|
2549
|
-
${t ? h :
|
|
2550
|
+
${t ? h : l`<span class="baht-step-marker">${a === "done" ? "✓" : r + 1}</span>`}
|
|
2550
2551
|
<span class="baht-step-label">${e}</span>
|
|
2551
2552
|
</li>`;
|
|
2552
2553
|
})}
|
|
2553
2554
|
</ol>`;
|
|
2554
2555
|
}
|
|
2555
2556
|
};
|
|
2556
|
-
|
|
2557
|
-
|
|
2557
|
+
Ft([
|
|
2558
|
+
n({ attribute: !1 })
|
|
2558
2559
|
], vt.prototype, "steps", 2);
|
|
2559
|
-
|
|
2560
|
-
|
|
2560
|
+
Ft([
|
|
2561
|
+
n({ type: Number })
|
|
2561
2562
|
], vt.prototype, "current", 2);
|
|
2562
|
-
|
|
2563
|
-
|
|
2563
|
+
Ft([
|
|
2564
|
+
n()
|
|
2564
2565
|
], vt.prototype, "variant", 2);
|
|
2565
|
-
vt =
|
|
2566
|
+
vt = Ft([
|
|
2566
2567
|
p("baht-steps")
|
|
2567
2568
|
], vt);
|
|
2568
|
-
var
|
|
2569
|
-
for (var s =
|
|
2570
|
-
(o = t[i]) && (s = (
|
|
2571
|
-
return
|
|
2569
|
+
var ea = Object.defineProperty, sa = Object.getOwnPropertyDescriptor, C = (t, e, r, a) => {
|
|
2570
|
+
for (var s = a > 1 ? void 0 : a ? sa(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2571
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2572
|
+
return a && s && ea(e, r, s), s;
|
|
2572
2573
|
};
|
|
2573
|
-
const
|
|
2574
|
+
const aa = {
|
|
2574
2575
|
"1/4": "baht-field--w-1-4",
|
|
2575
2576
|
"1/2": "baht-field--w-1-2",
|
|
2576
2577
|
"3/4": "baht-field--w-3-4",
|
|
2577
2578
|
full: "baht-field--w-full"
|
|
2578
2579
|
};
|
|
2579
|
-
let P = class extends
|
|
2580
|
+
let P = class extends d {
|
|
2580
2581
|
constructor() {
|
|
2581
2582
|
super(...arguments), this.value = {}, this.registry = {}, this.options = {}, this.fieldStates = {}, this.flags = {}, this.readonly = !1, this.edits = {}, this.errors = [], this.controls = /* @__PURE__ */ new Map(), this.dynamicOptions = /* @__PURE__ */ new Map(), this.optionsSnapshots = /* @__PURE__ */ new Map(), this.optionsEpoch = /* @__PURE__ */ new Map(), this.warnedViews = /* @__PURE__ */ new Set(), this.flagCache = {};
|
|
2582
2583
|
}
|
|
@@ -2596,26 +2597,26 @@ let P = class extends c {
|
|
|
2596
2597
|
* dropped by epoch).
|
|
2597
2598
|
*/
|
|
2598
2599
|
syncDynamicOptions() {
|
|
2599
|
-
var e,
|
|
2600
|
+
var e, r;
|
|
2600
2601
|
const t = this.getData();
|
|
2601
|
-
for (const
|
|
2602
|
-
if (!
|
|
2603
|
-
const s = JSON.stringify((
|
|
2604
|
-
if (this.optionsSnapshots.get(
|
|
2605
|
-
this.optionsSnapshots.set(
|
|
2606
|
-
const i = (this.optionsEpoch.get(
|
|
2607
|
-
this.optionsEpoch.set(
|
|
2608
|
-
const o = (
|
|
2602
|
+
for (const a of ((e = this.effectiveForm) == null ? void 0 : e.field_data) ?? []) {
|
|
2603
|
+
if (!a.optionsFrom) continue;
|
|
2604
|
+
const s = JSON.stringify((a.optionsDeps ?? []).map((b) => t[b] ?? null));
|
|
2605
|
+
if (this.optionsSnapshots.get(a.key) === s) continue;
|
|
2606
|
+
this.optionsSnapshots.set(a.key, s);
|
|
2607
|
+
const i = (this.optionsEpoch.get(a.key) ?? 0) + 1;
|
|
2608
|
+
this.optionsEpoch.set(a.key, i);
|
|
2609
|
+
const o = (r = this.registry.options) == null ? void 0 : r[a.optionsFrom];
|
|
2609
2610
|
if (!o) {
|
|
2610
|
-
console.warn(`[bahtui] unknown options fetcher "${
|
|
2611
|
+
console.warn(`[bahtui] unknown options fetcher "${a.optionsFrom}" — skipped`), this.dynamicOptions.set(a.key, []);
|
|
2611
2612
|
continue;
|
|
2612
2613
|
}
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2615
|
-
this.optionsEpoch.get(
|
|
2614
|
+
const c = o(t);
|
|
2615
|
+
c instanceof Promise ? c.then((b) => {
|
|
2616
|
+
this.optionsEpoch.get(a.key) === i && (this.dynamicOptions.set(a.key, b), this.requestUpdate());
|
|
2616
2617
|
}).catch((b) => {
|
|
2617
|
-
console.warn(`[bahtui] options fetcher "${
|
|
2618
|
-
}) : this.dynamicOptions.set(
|
|
2618
|
+
console.warn(`[bahtui] options fetcher "${a.optionsFrom}" failed`, b), this.optionsEpoch.get(a.key) === i && this.optionsSnapshots.delete(a.key);
|
|
2619
|
+
}) : this.dynamicOptions.set(a.key, c);
|
|
2619
2620
|
}
|
|
2620
2621
|
}
|
|
2621
2622
|
/**
|
|
@@ -2624,12 +2625,12 @@ let P = class extends c {
|
|
|
2624
2625
|
* (province -> district -> subdistrict).
|
|
2625
2626
|
*/
|
|
2626
2627
|
clearDependents(t) {
|
|
2627
|
-
var
|
|
2628
|
-
const e = [t],
|
|
2628
|
+
var a, s;
|
|
2629
|
+
const e = [t], r = /* @__PURE__ */ new Set();
|
|
2629
2630
|
for (; e.length > 0; ) {
|
|
2630
2631
|
const i = e.shift();
|
|
2631
|
-
for (const o of ((
|
|
2632
|
-
!((s = o.optionsDeps) != null && s.includes(i)) ||
|
|
2632
|
+
for (const o of ((a = this.effectiveForm) == null ? void 0 : a.field_data) ?? [])
|
|
2633
|
+
!((s = o.optionsDeps) != null && s.includes(i)) || r.has(o.key) || (r.add(o.key), this.edits = { ...this.edits, [o.key]: _t(o) }, e.push(o.key));
|
|
2633
2634
|
}
|
|
2634
2635
|
}
|
|
2635
2636
|
get sortedFields() {
|
|
@@ -2653,8 +2654,8 @@ let P = class extends c {
|
|
|
2653
2654
|
getData() {
|
|
2654
2655
|
var e;
|
|
2655
2656
|
const t = {};
|
|
2656
|
-
for (const
|
|
2657
|
-
|
|
2657
|
+
for (const r of ((e = this.effectiveForm) == null ? void 0 : e.field_data) ?? [])
|
|
2658
|
+
r.type === "label" || r.type === "section" || (t[r.key] = this.valueFor(r));
|
|
2658
2659
|
return t;
|
|
2659
2660
|
}
|
|
2660
2661
|
setValue(t) {
|
|
@@ -2662,18 +2663,18 @@ let P = class extends c {
|
|
|
2662
2663
|
}
|
|
2663
2664
|
validate() {
|
|
2664
2665
|
const t = [], e = this.getData();
|
|
2665
|
-
for (const
|
|
2666
|
-
if (
|
|
2667
|
-
const s = this.stateFor(
|
|
2666
|
+
for (const a of this.sortedFields) {
|
|
2667
|
+
if (a.type === "label" || a.type === "section") continue;
|
|
2668
|
+
const s = this.stateFor(a);
|
|
2668
2669
|
if (!s.visible) continue;
|
|
2669
|
-
const i = s.required === !!
|
|
2670
|
-
t.push(...Ut(i, this.valueFor(
|
|
2670
|
+
const i = s.required === !!a.required ? a : { ...a, required: s.required };
|
|
2671
|
+
t.push(...Ut(i, this.valueFor(a), this.registry, e));
|
|
2671
2672
|
}
|
|
2672
2673
|
this.errors = t;
|
|
2673
|
-
const
|
|
2674
|
+
const r = { valid: t.length === 0, errors: t };
|
|
2674
2675
|
return this.dispatchEvent(
|
|
2675
|
-
new CustomEvent("baht-validity", { detail:
|
|
2676
|
-
),
|
|
2676
|
+
new CustomEvent("baht-validity", { detail: r, bubbles: !0, composed: !0 })
|
|
2677
|
+
), r;
|
|
2677
2678
|
}
|
|
2678
2679
|
reset() {
|
|
2679
2680
|
this.edits = {}, this.value = {}, this.errors = [], this.requestUpdate();
|
|
@@ -2682,11 +2683,11 @@ let P = class extends c {
|
|
|
2682
2683
|
onFieldInput(t, e) {
|
|
2683
2684
|
var s;
|
|
2684
2685
|
e.stopPropagation();
|
|
2685
|
-
let { value:
|
|
2686
|
-
const
|
|
2687
|
-
t.formatter && !
|
|
2686
|
+
let { value: r } = e.detail;
|
|
2687
|
+
const a = t.formatter ? (s = this.registry.formatters) == null ? void 0 : s[t.formatter] : void 0;
|
|
2688
|
+
t.formatter && !a && console.warn(`[bahtui] unknown formatter "${t.formatter}" — skipped`), a && (r = a(r)), this.edits = { ...this.edits, [t.key]: r }, this.clearDependents(t.key), this.syncDynamicOptions(), (this.options.validateOn ?? "change") === "change" && this.errors.length > 0 && this.validate(), this.dispatchEvent(
|
|
2688
2689
|
new CustomEvent("baht-change", {
|
|
2689
|
-
detail: { formName: this.form.formName, key: t.key, value:
|
|
2690
|
+
detail: { formName: this.form.formName, key: t.key, value: r, data: this.getData() },
|
|
2690
2691
|
bubbles: !0,
|
|
2691
2692
|
composed: !0
|
|
2692
2693
|
})
|
|
@@ -2696,34 +2697,36 @@ let P = class extends c {
|
|
|
2696
2697
|
validateOneField(t) {
|
|
2697
2698
|
const e = this.stateFor(t);
|
|
2698
2699
|
if (!e.visible) return [];
|
|
2699
|
-
const
|
|
2700
|
-
return Ut(
|
|
2700
|
+
const r = this.getData(), a = e.required === !!t.required ? t : { ...t, required: e.required };
|
|
2701
|
+
return Ut(a, this.valueFor(t), this.registry, r);
|
|
2701
2702
|
}
|
|
2702
2703
|
/** `validateOn: 'blur'` — validate just the field the user left, same as
|
|
2703
2704
|
* how errors are shown elsewhere (merged into `this.errors`, painted by
|
|
2704
2705
|
* `renderField`/`.baht-error`). No-op for 'change'/'submit' modes. */
|
|
2705
2706
|
onFieldBlur(t) {
|
|
2706
2707
|
if ((this.options.validateOn ?? "change") !== "blur") return;
|
|
2707
|
-
const e = this.validateOneField(t),
|
|
2708
|
-
this.errors = [...
|
|
2708
|
+
const e = this.validateOneField(t), r = this.errors.filter((a) => a.key !== t.key);
|
|
2709
|
+
this.errors = [...r, ...e];
|
|
2709
2710
|
}
|
|
2710
2711
|
renderField(t) {
|
|
2711
|
-
var o,
|
|
2712
|
+
var o, c;
|
|
2712
2713
|
const e = le[t.type];
|
|
2713
2714
|
if (!e)
|
|
2714
2715
|
return console.warn(`[bahtui] unknown field type "${t.type}" — skipped`), h;
|
|
2715
|
-
const
|
|
2716
|
+
const r = this.stateFor(t), a = aa[t.width ?? "full"] ?? "baht-field--w-full", s = ((o = this.errors.find((b) => b.key === t.key)) == null ? void 0 : o.message) ?? null;
|
|
2717
|
+
if (this.readonly && t.type !== "label" && t.type !== "section")
|
|
2718
|
+
return this.renderReadonlyField(t, a, r.visible);
|
|
2716
2719
|
let i = this.controls.get(t.key);
|
|
2717
2720
|
if ((!i || i.tagName.toLowerCase() !== e) && (i = document.createElement(e), i.addEventListener("baht-input", (b) => {
|
|
2718
2721
|
var Kt;
|
|
2719
2722
|
const H = (Kt = this.effectiveForm) == null ? void 0 : Kt.field_data.find((he) => he.key === t.key);
|
|
2720
2723
|
H && this.onFieldInput(H, b);
|
|
2721
|
-
}), this.controls.set(t.key, i)), i.field = t.optionsFrom ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, i.value = this.valueFor(t), i.disabled = !
|
|
2722
|
-
const b = (
|
|
2724
|
+
}), this.controls.set(t.key, i)), i.field = t.optionsFrom ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, i.value = this.valueFor(t), i.disabled = !r.enabled, i.readonly = this.readonly || r.readonly, i.required = r.required, i.error = s, t.type === "repeater" && (i.rowErrors = this.errors.filter((b) => b.key.startsWith(`${t.key}[`))), t.type === "file" && t.uploader) {
|
|
2725
|
+
const b = (c = this.registry.uploaders) == null ? void 0 : c[t.uploader];
|
|
2723
2726
|
b || console.warn(`[bahtui] unknown uploader "${t.uploader}" — capture only`), i.uploader = b;
|
|
2724
2727
|
}
|
|
2725
|
-
return
|
|
2726
|
-
class="baht-field ${
|
|
2728
|
+
return l`<div
|
|
2729
|
+
class="baht-field ${a} ${r.visible ? "" : "baht-field--hidden"}"
|
|
2727
2730
|
data-key=${t.key}
|
|
2728
2731
|
data-type=${t.type}
|
|
2729
2732
|
@focusout=${() => this.onFieldBlur(t)}
|
|
@@ -2731,35 +2734,59 @@ let P = class extends c {
|
|
|
2731
2734
|
${i}
|
|
2732
2735
|
</div>`;
|
|
2733
2736
|
}
|
|
2737
|
+
renderReadonlyField(t, e, r) {
|
|
2738
|
+
const a = t.optionsFrom ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, s = pe(t, this.valueFor(t), a), i = s.kind === "empty" ? l`<span class="baht-readonly-value baht-readonly-value--empty">${m("emptyValue")}</span>` : s.kind === "text" ? l`<span class="baht-readonly-value">${s.text}</span>` : s.kind === "chips" ? l`<span class="baht-readonly-value baht-readonly-chips"
|
|
2739
|
+
>${s.items.map((o) => l`<span class="baht-readonly-chip">${o}</span>`)}</span
|
|
2740
|
+
>` : l`<div class="baht-readonly-rows">
|
|
2741
|
+
${s.rows.map(
|
|
2742
|
+
(o) => l`<div class="baht-readonly-row">
|
|
2743
|
+
${o.map(
|
|
2744
|
+
(c) => l`<span class="baht-readonly-cell"
|
|
2745
|
+
><span class="baht-readonly-cell-label">${c.label}</span
|
|
2746
|
+
><span class="baht-readonly-cell-value">${c.text}</span></span
|
|
2747
|
+
>`
|
|
2748
|
+
)}
|
|
2749
|
+
</div>`
|
|
2750
|
+
)}
|
|
2751
|
+
</div>`;
|
|
2752
|
+
return l`<div
|
|
2753
|
+
class="baht-field ${e} baht-field--readonly ${r ? "" : "baht-field--hidden"}"
|
|
2754
|
+
data-key=${t.key}
|
|
2755
|
+
data-type=${t.type}
|
|
2756
|
+
>
|
|
2757
|
+
${t.label ? l`<span class="baht-label">${t.label}</span>` : h}
|
|
2758
|
+
${i}
|
|
2759
|
+
</div>`;
|
|
2760
|
+
}
|
|
2734
2761
|
render() {
|
|
2735
|
-
return
|
|
2762
|
+
return l`<div class="baht-form ${this.readonly ? "baht-form--readonly" : ""}">
|
|
2736
2763
|
${this.sortedFields.map((t) => this.renderField(t))}
|
|
2737
2764
|
</div>`;
|
|
2738
2765
|
}
|
|
2739
2766
|
};
|
|
2740
2767
|
C([
|
|
2741
|
-
|
|
2768
|
+
n({ attribute: !1 })
|
|
2742
2769
|
], P.prototype, "form", 2);
|
|
2743
2770
|
C([
|
|
2744
|
-
|
|
2771
|
+
n({ attribute: !1 })
|
|
2745
2772
|
], P.prototype, "value", 2);
|
|
2746
2773
|
C([
|
|
2747
|
-
|
|
2774
|
+
n({ attribute: !1 })
|
|
2748
2775
|
], P.prototype, "registry", 2);
|
|
2749
2776
|
C([
|
|
2750
|
-
|
|
2777
|
+
n({ attribute: !1 })
|
|
2751
2778
|
], P.prototype, "options", 2);
|
|
2752
2779
|
C([
|
|
2753
|
-
|
|
2780
|
+
n({ attribute: !1 })
|
|
2754
2781
|
], P.prototype, "fieldStates", 2);
|
|
2755
2782
|
C([
|
|
2756
|
-
|
|
2783
|
+
n({ type: String })
|
|
2757
2784
|
], P.prototype, "view", 2);
|
|
2758
2785
|
C([
|
|
2759
|
-
|
|
2786
|
+
n({ attribute: !1 })
|
|
2760
2787
|
], P.prototype, "flags", 2);
|
|
2761
2788
|
C([
|
|
2762
|
-
|
|
2789
|
+
n({ type: Boolean })
|
|
2763
2790
|
], P.prototype, "readonly", 2);
|
|
2764
2791
|
C([
|
|
2765
2792
|
v()
|
|
@@ -2770,12 +2797,12 @@ C([
|
|
|
2770
2797
|
P = C([
|
|
2771
2798
|
p("baht-form")
|
|
2772
2799
|
], P);
|
|
2773
|
-
var
|
|
2774
|
-
for (var s =
|
|
2775
|
-
(o = t[i]) && (s = (
|
|
2776
|
-
return
|
|
2800
|
+
var ra = Object.defineProperty, ia = Object.getOwnPropertyDescriptor, _ = (t, e, r, a) => {
|
|
2801
|
+
for (var s = a > 1 ? void 0 : a ? ia(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2802
|
+
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2803
|
+
return a && s && ra(e, r, s), s;
|
|
2777
2804
|
};
|
|
2778
|
-
let $ = class extends
|
|
2805
|
+
let $ = class extends d {
|
|
2779
2806
|
constructor() {
|
|
2780
2807
|
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 = {};
|
|
2781
2808
|
}
|
|
@@ -2790,19 +2817,19 @@ let $ = class extends c {
|
|
|
2790
2817
|
}), this.flagCache.out) : this.workflow;
|
|
2791
2818
|
}
|
|
2792
2819
|
willUpdate(t) {
|
|
2793
|
-
var e,
|
|
2794
|
-
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.formName) ?? null, this.approvalError = null) : t.has("flags") && (this.reevaluate(), this.current && !this.visibleForms.some((
|
|
2820
|
+
var e, r;
|
|
2821
|
+
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.formName) ?? null, this.approvalError = null) : t.has("flags") && (this.reevaluate(), this.current && !this.visibleForms.some((a) => a.formName === this.current) && (this.current = ((r = this.visibleForms[0]) == null ? void 0 : r.formName) ?? null));
|
|
2795
2822
|
}
|
|
2796
2823
|
reevaluate() {
|
|
2797
|
-
this.derived =
|
|
2824
|
+
this.derived = ce(this.effectiveWorkflow, this.data), this.data = this.derived.data;
|
|
2798
2825
|
}
|
|
2799
2826
|
/** Forms in ascending order whose derived visibility is true. */
|
|
2800
2827
|
get visibleForms() {
|
|
2801
2828
|
var e;
|
|
2802
|
-
const t = [...((e = this.effectiveWorkflow) == null ? void 0 : e.forms) ?? []].sort((
|
|
2803
|
-
return this.derived ? t.filter((
|
|
2804
|
-
var
|
|
2805
|
-
return ((
|
|
2829
|
+
const t = [...((e = this.effectiveWorkflow) == null ? void 0 : e.forms) ?? []].sort((r, a) => r.order - a.order);
|
|
2830
|
+
return this.derived ? t.filter((r) => {
|
|
2831
|
+
var a;
|
|
2832
|
+
return ((a = this.derived.forms[r.formName]) == null ? void 0 : a.visible) !== !1;
|
|
2806
2833
|
}) : t;
|
|
2807
2834
|
}
|
|
2808
2835
|
get currentForm() {
|
|
@@ -2810,13 +2837,13 @@ let $ = class extends c {
|
|
|
2810
2837
|
}
|
|
2811
2838
|
/** Where next() would go from here: a formName or 'end' (spec 03 §6). */
|
|
2812
2839
|
get navTarget() {
|
|
2813
|
-
var
|
|
2840
|
+
var a;
|
|
2814
2841
|
if (!this.current) return "end";
|
|
2815
2842
|
const t = this.effectiveWorkflow;
|
|
2816
2843
|
if (t.transitions && t.transitions.length > 0)
|
|
2817
|
-
return
|
|
2818
|
-
const e = this.visibleForms,
|
|
2819
|
-
return ((
|
|
2844
|
+
return de(t, this.current, this.data);
|
|
2845
|
+
const e = this.visibleForms, r = e.findIndex((s) => s.formName === this.current);
|
|
2846
|
+
return ((a = e[r + 1]) == null ? void 0 : a.formName) ?? "end";
|
|
2820
2847
|
}
|
|
2821
2848
|
get isLast() {
|
|
2822
2849
|
return this.current !== null && this.navTarget === "end";
|
|
@@ -2824,9 +2851,9 @@ let $ = class extends c {
|
|
|
2824
2851
|
fieldStatesFor(t) {
|
|
2825
2852
|
const e = {};
|
|
2826
2853
|
if (!this.derived) return e;
|
|
2827
|
-
const
|
|
2828
|
-
for (const [
|
|
2829
|
-
|
|
2854
|
+
const r = `${t}.`;
|
|
2855
|
+
for (const [a, s] of Object.entries(this.derived.fields))
|
|
2856
|
+
a.startsWith(r) && (e[a.slice(r.length)] = s);
|
|
2830
2857
|
return e;
|
|
2831
2858
|
}
|
|
2832
2859
|
get formEl() {
|
|
@@ -2843,8 +2870,8 @@ let $ = class extends c {
|
|
|
2843
2870
|
* that re-feeding the `value` prop causes.
|
|
2844
2871
|
*/
|
|
2845
2872
|
setValue(t, e) {
|
|
2846
|
-
var
|
|
2847
|
-
this.data = { ...this.data, [t]: { ...this.data[t], ...e } }, this.reevaluate(), this.current && !this.visibleForms.some((
|
|
2873
|
+
var r;
|
|
2874
|
+
this.data = { ...this.data, [t]: { ...this.data[t], ...e } }, this.reevaluate(), this.current && !this.visibleForms.some((a) => a.formName === this.current) && (this.current = ((r = this.visibleForms[0]) == null ? void 0 : r.formName) ?? null), this.emit("baht-data-change", { data: this.getData() });
|
|
2848
2875
|
}
|
|
2849
2876
|
next() {
|
|
2850
2877
|
const t = this.currentForm;
|
|
@@ -2858,27 +2885,27 @@ let $ = class extends c {
|
|
|
2858
2885
|
}
|
|
2859
2886
|
/** Advance past the current form: submit+complete at 'end', else step to navTarget. */
|
|
2860
2887
|
advance(t = {}) {
|
|
2861
|
-
const e = { ...t, data: this.getData() },
|
|
2862
|
-
if (
|
|
2888
|
+
const e = { ...t, data: this.getData() }, r = this.navTarget;
|
|
2889
|
+
if (r === "end") {
|
|
2863
2890
|
this.emit("baht-submit", e), this.emit("baht-complete", { data: this.getData(), status: "completed" });
|
|
2864
2891
|
return;
|
|
2865
2892
|
}
|
|
2866
|
-
const
|
|
2867
|
-
if (!
|
|
2868
|
-
const s =
|
|
2893
|
+
const a = this.visibleForms.find((s) => s.formName === r);
|
|
2894
|
+
if (!a || a.formName === this.current) {
|
|
2895
|
+
const s = a ? "self-transition" : "target-hidden";
|
|
2869
2896
|
console.warn(
|
|
2870
|
-
`[bahtui] cannot advance from "${this.current}": target "${
|
|
2897
|
+
`[bahtui] cannot advance from "${this.current}": target "${r}" is ` + (a ? "the current form (self-transition)" : "not visible")
|
|
2871
2898
|
), this.emit("baht-nav-blocked", {
|
|
2872
2899
|
formName: this.current,
|
|
2873
|
-
target:
|
|
2900
|
+
target: r,
|
|
2874
2901
|
reason: s,
|
|
2875
2902
|
data: this.getData()
|
|
2876
2903
|
});
|
|
2877
2904
|
return;
|
|
2878
2905
|
}
|
|
2879
|
-
this.history.push(this.current), this.current =
|
|
2880
|
-
formName:
|
|
2881
|
-
order:
|
|
2906
|
+
this.history.push(this.current), this.current = a.formName, this.emit("baht-next", { formName: a.formName, order: a.order, ...e }), this.emit("baht-step-change", {
|
|
2907
|
+
formName: a.formName,
|
|
2908
|
+
order: a.order,
|
|
2882
2909
|
direction: "forward"
|
|
2883
2910
|
});
|
|
2884
2911
|
}
|
|
@@ -2894,38 +2921,38 @@ let $ = class extends c {
|
|
|
2894
2921
|
var b;
|
|
2895
2922
|
const e = this.currentForm;
|
|
2896
2923
|
if (!e || e.kind !== "approval") return;
|
|
2897
|
-
const
|
|
2898
|
-
if ((s === "required" || s === "requireOnReject" && t === "rejected") &&
|
|
2924
|
+
const r = e.approval ?? {}, a = String(((b = this.data[e.formName]) == null ? void 0 : b.comment) ?? ""), s = r.comment ?? "optional";
|
|
2925
|
+
if ((s === "required" || s === "requireOnReject" && t === "rejected") && a.trim() === "") {
|
|
2899
2926
|
this.approvalError = m("commentRequired");
|
|
2900
2927
|
return;
|
|
2901
2928
|
}
|
|
2902
2929
|
this.approvalError = null, this.data = {
|
|
2903
2930
|
...this.data,
|
|
2904
|
-
[e.formName]: { ...this.data[e.formName], decision: t, comment:
|
|
2931
|
+
[e.formName]: { ...this.data[e.formName], decision: t, comment: a }
|
|
2905
2932
|
}, this.reevaluate();
|
|
2906
|
-
const o = { formName: e.formName, decision: t, comment:
|
|
2933
|
+
const o = { formName: e.formName, decision: t, comment: a, data: this.getData() };
|
|
2907
2934
|
if (t === "approved") {
|
|
2908
|
-
this.emit("baht-approve", o), this.advance({ decision: t, comment:
|
|
2935
|
+
this.emit("baht-approve", o), this.advance({ decision: t, comment: a });
|
|
2909
2936
|
return;
|
|
2910
2937
|
}
|
|
2911
2938
|
this.emit("baht-reject", o);
|
|
2912
|
-
const
|
|
2913
|
-
|
|
2939
|
+
const c = r.onReject ?? { action: "end" };
|
|
2940
|
+
c.action === "goto" && this.visibleForms.some((H) => H.formName === c.form) ? this.gotoForm(c.form) : this.emit("baht-complete", { data: this.getData(), status: "rejected" });
|
|
2914
2941
|
}
|
|
2915
2942
|
/** Jump back to a visible form, truncating the history to that point. */
|
|
2916
2943
|
gotoForm(t) {
|
|
2917
2944
|
const e = this.history.indexOf(t);
|
|
2918
2945
|
this.history = e >= 0 ? this.history.slice(0, e) : [], this.current = t;
|
|
2919
|
-
const
|
|
2920
|
-
this.emit("baht-step-change", { formName: t, order: (
|
|
2946
|
+
const r = this.effectiveWorkflow.forms.find((a) => a.formName === t);
|
|
2947
|
+
this.emit("baht-step-change", { formName: t, order: (r == null ? void 0 : r.order) ?? 0, direction: "back" });
|
|
2921
2948
|
}
|
|
2922
2949
|
back() {
|
|
2923
2950
|
let t = this.history.pop();
|
|
2924
|
-
for (; t !== void 0 && !this.visibleForms.some((
|
|
2951
|
+
for (; t !== void 0 && !this.visibleForms.some((r) => r.formName === t); )
|
|
2925
2952
|
t = this.history.pop();
|
|
2926
2953
|
if (!t) return;
|
|
2927
2954
|
this.current = t, this.approvalError = null;
|
|
2928
|
-
const e = this.effectiveWorkflow.forms.find((
|
|
2955
|
+
const e = this.effectiveWorkflow.forms.find((r) => r.formName === t);
|
|
2929
2956
|
this.emit("baht-step-change", { formName: t, order: (e == null ? void 0 : e.order) ?? 0, direction: "back" });
|
|
2930
2957
|
}
|
|
2931
2958
|
gotoStart() {
|
|
@@ -2936,8 +2963,8 @@ let $ = class extends c {
|
|
|
2936
2963
|
onFormChange(t) {
|
|
2937
2964
|
var s;
|
|
2938
2965
|
t.stopPropagation();
|
|
2939
|
-
const { formName: e, key:
|
|
2940
|
-
this.data = { ...this.data, [e]: { ...this.data[e], [
|
|
2966
|
+
const { formName: e, key: r, value: a } = t.detail;
|
|
2967
|
+
this.data = { ...this.data, [e]: { ...this.data[e], [r]: a } }, this.reevaluate(), this.current && !this.visibleForms.some((i) => i.formName === this.current) && (this.current = ((s = this.visibleForms[0]) == null ? void 0 : s.formName) ?? null), this.emit("baht-data-change", { data: this.getData() });
|
|
2941
2968
|
}
|
|
2942
2969
|
onCommentInput(t, e) {
|
|
2943
2970
|
this.data = { ...this.data, [t]: { ...this.data[t], comment: e } }, this.reevaluate(), e.trim() !== "" && (this.approvalError = null), this.emit("baht-data-change", { data: this.getData() });
|
|
@@ -2948,19 +2975,19 @@ let $ = class extends c {
|
|
|
2948
2975
|
// ---- approval summary (spec 03 §4) ----
|
|
2949
2976
|
/** Forms the approval step summarizes: configured list, else every earlier plain form. */
|
|
2950
2977
|
summaryForms(t) {
|
|
2951
|
-
var
|
|
2952
|
-
const e = (
|
|
2978
|
+
var a;
|
|
2979
|
+
const e = (a = t.approval) == null ? void 0 : a.summaryForms, r = this.visibleForms.filter(
|
|
2953
2980
|
(s) => s.formName !== t.formName && s.kind !== "approval"
|
|
2954
2981
|
);
|
|
2955
|
-
return e ?
|
|
2982
|
+
return e ? r.filter((s) => e.includes(s.formName)) : r.filter((s) => s.order < t.order);
|
|
2956
2983
|
}
|
|
2957
2984
|
renderApproval(t) {
|
|
2958
|
-
var
|
|
2959
|
-
const e = ((
|
|
2960
|
-
return
|
|
2985
|
+
var a, s;
|
|
2986
|
+
const e = ((a = t.approval) == null ? void 0 : a.comment) ?? "optional", r = this.summaryForms(t);
|
|
2987
|
+
return l`<div class="baht-approval">
|
|
2961
2988
|
<div class="baht-approval-summary">
|
|
2962
|
-
${
|
|
2963
|
-
(i) =>
|
|
2989
|
+
${r.length === 0 ? l`<p class="baht-approval-empty">${m("nothingToReview")}</p>` : r.map(
|
|
2990
|
+
(i) => l`<section class="baht-approval-group">
|
|
2964
2991
|
<h4 class="baht-approval-group-title">${i.formName}</h4>
|
|
2965
2992
|
<baht-form
|
|
2966
2993
|
readonly
|
|
@@ -2971,7 +2998,7 @@ let $ = class extends c {
|
|
|
2971
2998
|
</section>`
|
|
2972
2999
|
)}
|
|
2973
3000
|
</div>
|
|
2974
|
-
${e !== "hidden" ?
|
|
3001
|
+
${e !== "hidden" ? l`<label class="baht-approval-comment">
|
|
2975
3002
|
<span class="baht-approval-comment-label">
|
|
2976
3003
|
${m("comment")}${e === "required" ? m("commentRequiredSuffix") : ""}
|
|
2977
3004
|
</span>
|
|
@@ -2983,24 +3010,24 @@ let $ = class extends c {
|
|
|
2983
3010
|
@input=${(i) => this.onCommentInput(t.formName, i.target.value)}
|
|
2984
3011
|
></textarea>
|
|
2985
3012
|
</label>` : h}
|
|
2986
|
-
${this.approvalError ?
|
|
3013
|
+
${this.approvalError ? l`<p class="baht-error" role="alert">${this.approvalError}</p>` : h}
|
|
2987
3014
|
</div>`;
|
|
2988
3015
|
}
|
|
2989
3016
|
render() {
|
|
2990
3017
|
var s, i;
|
|
2991
3018
|
const t = this.currentForm;
|
|
2992
|
-
if (!t) return
|
|
2993
|
-
const e = t.kind === "approval",
|
|
2994
|
-
return
|
|
3019
|
+
if (!t) return l`<div class="baht-workflow"></div>`;
|
|
3020
|
+
const e = t.kind === "approval", r = this.visibleForms, a = r.findIndex((o) => o.formName === t.formName);
|
|
3021
|
+
return l`<div class="baht-workflow" data-step=${t.formName}>
|
|
2995
3022
|
<div class="baht-visually-hidden" role="status">
|
|
2996
|
-
${m("step", { current:
|
|
3023
|
+
${m("step", { current: a + 1, total: r.length })}
|
|
2997
3024
|
</div>
|
|
2998
|
-
${this.showSteps ?
|
|
2999
|
-
.steps=${
|
|
3000
|
-
.current=${
|
|
3025
|
+
${this.showSteps ? l`<baht-steps
|
|
3026
|
+
.steps=${r.map((o) => o.formName)}
|
|
3027
|
+
.current=${a}
|
|
3001
3028
|
.variant=${this.stepsVariant}
|
|
3002
3029
|
></baht-steps>` : h}
|
|
3003
|
-
${e ? this.renderApproval(t) :
|
|
3030
|
+
${e ? this.renderApproval(t) : l`<baht-form
|
|
3004
3031
|
.form=${t}
|
|
3005
3032
|
.value=${this.data[t.formName] ?? {}}
|
|
3006
3033
|
.registry=${this.registry}
|
|
@@ -3009,10 +3036,10 @@ let $ = class extends c {
|
|
|
3009
3036
|
@baht-change=${(o) => this.onFormChange(o)}
|
|
3010
3037
|
></baht-form>`}
|
|
3011
3038
|
<div class="baht-workflow-nav">
|
|
3012
|
-
${this.showBack && this.history.length > 0 ?
|
|
3039
|
+
${this.showBack && this.history.length > 0 ? l`<button type="button" class="baht-button baht-button--back" @click=${() => this.back()}>
|
|
3013
3040
|
${this.backLabel ?? m("back")}
|
|
3014
3041
|
</button>` : h}
|
|
3015
|
-
${e ?
|
|
3042
|
+
${e ? l`<button
|
|
3016
3043
|
type="button"
|
|
3017
3044
|
class="baht-button baht-button--reject"
|
|
3018
3045
|
@click=${() => this.decide("rejected")}
|
|
@@ -3025,7 +3052,7 @@ let $ = class extends c {
|
|
|
3025
3052
|
@click=${() => this.decide("approved")}
|
|
3026
3053
|
>
|
|
3027
3054
|
${((i = t.approval) == null ? void 0 : i.approveLabel) ?? m("approve")}
|
|
3028
|
-
</button>` :
|
|
3055
|
+
</button>` : l`<button type="button" class="baht-button baht-button--next" @click=${() => this.next()}>
|
|
3029
3056
|
${this.isLast ? this.submitLabel ?? m("submit") : this.nextLabel ?? m("next")}
|
|
3030
3057
|
</button>`}
|
|
3031
3058
|
</div>
|
|
@@ -3033,37 +3060,37 @@ let $ = class extends c {
|
|
|
3033
3060
|
}
|
|
3034
3061
|
};
|
|
3035
3062
|
_([
|
|
3036
|
-
|
|
3063
|
+
n({ attribute: !1 })
|
|
3037
3064
|
], $.prototype, "workflow", 2);
|
|
3038
3065
|
_([
|
|
3039
|
-
|
|
3066
|
+
n({ attribute: !1 })
|
|
3040
3067
|
], $.prototype, "value", 2);
|
|
3041
3068
|
_([
|
|
3042
|
-
|
|
3069
|
+
n({ attribute: !1 })
|
|
3043
3070
|
], $.prototype, "registry", 2);
|
|
3044
3071
|
_([
|
|
3045
|
-
|
|
3072
|
+
n({ type: Boolean, attribute: "validate-gate" })
|
|
3046
3073
|
], $.prototype, "validateGate", 2);
|
|
3047
3074
|
_([
|
|
3048
|
-
|
|
3075
|
+
n({ attribute: "next-label" })
|
|
3049
3076
|
], $.prototype, "nextLabel", 2);
|
|
3050
3077
|
_([
|
|
3051
|
-
|
|
3078
|
+
n({ attribute: "submit-label" })
|
|
3052
3079
|
], $.prototype, "submitLabel", 2);
|
|
3053
3080
|
_([
|
|
3054
|
-
|
|
3081
|
+
n({ attribute: "back-label" })
|
|
3055
3082
|
], $.prototype, "backLabel", 2);
|
|
3056
3083
|
_([
|
|
3057
|
-
|
|
3084
|
+
n({ type: Boolean, attribute: "show-back" })
|
|
3058
3085
|
], $.prototype, "showBack", 2);
|
|
3059
3086
|
_([
|
|
3060
|
-
|
|
3087
|
+
n({ attribute: !1 })
|
|
3061
3088
|
], $.prototype, "flags", 2);
|
|
3062
3089
|
_([
|
|
3063
|
-
|
|
3090
|
+
n({ type: Boolean, attribute: "show-steps" })
|
|
3064
3091
|
], $.prototype, "showSteps", 2);
|
|
3065
3092
|
_([
|
|
3066
|
-
|
|
3093
|
+
n({ attribute: "steps-variant" })
|
|
3067
3094
|
], $.prototype, "stepsVariant", 2);
|
|
3068
3095
|
_([
|
|
3069
3096
|
v()
|
|
@@ -3092,7 +3119,7 @@ export {
|
|
|
3092
3119
|
xt as BahtCode,
|
|
3093
3120
|
Zt as BahtDatepicker,
|
|
3094
3121
|
S as BahtDonutChart,
|
|
3095
|
-
|
|
3122
|
+
d as BahtElement,
|
|
3096
3123
|
bt as BahtEmptyState,
|
|
3097
3124
|
Z as BahtErrorState,
|
|
3098
3125
|
g as BahtFieldBase,
|
|
@@ -3108,7 +3135,7 @@ export {
|
|
|
3108
3135
|
Gt as BahtMultiselect,
|
|
3109
3136
|
Jt as BahtNumber,
|
|
3110
3137
|
K as BahtOtp,
|
|
3111
|
-
|
|
3138
|
+
N as BahtPagination,
|
|
3112
3139
|
G as BahtProgress,
|
|
3113
3140
|
Qt as BahtRadio,
|
|
3114
3141
|
k as BahtRange,
|
|
@@ -3124,7 +3151,7 @@ export {
|
|
|
3124
3151
|
u as BahtTable,
|
|
3125
3152
|
It as BahtText,
|
|
3126
3153
|
Ht as BahtTextarea,
|
|
3127
|
-
|
|
3154
|
+
Nt as BahtTimeline,
|
|
3128
3155
|
W as BahtToast,
|
|
3129
3156
|
Xt as BahtToggle,
|
|
3130
3157
|
I as BahtTooltip,
|
|
@@ -3132,22 +3159,23 @@ export {
|
|
|
3132
3159
|
le as TAG_FOR_TYPE,
|
|
3133
3160
|
st as adoptLightChildren,
|
|
3134
3161
|
ee as applyFlags,
|
|
3135
|
-
|
|
3162
|
+
ua as approvalFields,
|
|
3136
3163
|
oe as chartColor,
|
|
3137
3164
|
_t as defaultValue,
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3165
|
+
pe as displayValue,
|
|
3166
|
+
ba as evalCondition,
|
|
3167
|
+
va as evalValueExpr,
|
|
3168
|
+
ce as evaluate,
|
|
3169
|
+
fa as flagEnabled,
|
|
3170
|
+
ma as getCatalog,
|
|
3171
|
+
fe as isIconName,
|
|
3172
|
+
ya as readRef,
|
|
3145
3173
|
J as renderIcon,
|
|
3146
|
-
|
|
3174
|
+
de as resolveNext,
|
|
3147
3175
|
Vt as resolveViewFields,
|
|
3148
|
-
|
|
3149
|
-
|
|
3176
|
+
$a as setCatalog,
|
|
3177
|
+
ga as setLocale,
|
|
3150
3178
|
m as t,
|
|
3151
3179
|
Ut as validateField,
|
|
3152
|
-
|
|
3180
|
+
wa as walkPath
|
|
3153
3181
|
};
|