bank20baht-ui 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine.js +8 -8
- package/dist/index.js +95 -85
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
package/dist/engine.js
CHANGED
|
@@ -125,7 +125,7 @@ function $(e, t) {
|
|
|
125
125
|
if (n !== -1)
|
|
126
126
|
return (o = e[t.slice(0, n)]) == null ? void 0 : o[t.slice(n + 1)];
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function j(e) {
|
|
129
129
|
return e == null ? !0 : typeof e == "string" ? e === "" : Array.isArray(e) ? e.length === 0 : !1;
|
|
130
130
|
}
|
|
131
131
|
function k(e, t) {
|
|
@@ -177,9 +177,9 @@ function J(e, t) {
|
|
|
177
177
|
case "endsWith":
|
|
178
178
|
return typeof n == "string" && n.endsWith(String(o));
|
|
179
179
|
case "isEmpty":
|
|
180
|
-
return
|
|
180
|
+
return j(n);
|
|
181
181
|
case "isNotEmpty":
|
|
182
|
-
return !
|
|
182
|
+
return !j(n);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
function w(e, t) {
|
|
@@ -282,7 +282,7 @@ function ee(e, t, n) {
|
|
|
282
282
|
return o.forEach((i, u) => {
|
|
283
283
|
const d = i !== null && typeof i == "object" && !Array.isArray(i) ? i : {}, p = {};
|
|
284
284
|
for (const a of s)
|
|
285
|
-
a.type === "label" || a.type === "repeater" || (p[a.key] = a.key
|
|
285
|
+
a.type === "label" || a.type === "repeater" || (p[a.key] = Object.hasOwn(d, a.key) ? d[a.key] : S(a));
|
|
286
286
|
for (const a of s)
|
|
287
287
|
if (!(a.type === "label" || a.type === "repeater"))
|
|
288
288
|
for (const h of X(a, p[a.key], n, p))
|
|
@@ -303,11 +303,11 @@ function x(e, t) {
|
|
|
303
303
|
function D(e, t) {
|
|
304
304
|
return e.filter((n) => x(n.flag, t)).map((n) => n.fields ? { ...n, fields: D(n.fields, t) } : n);
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
return e.some((t) => t.flag !== void 0 || (t.fields ?
|
|
306
|
+
function O(e) {
|
|
307
|
+
return e.some((t) => t.flag !== void 0 || (t.fields ? O(t.fields) : !1));
|
|
308
308
|
}
|
|
309
309
|
function T(e, t) {
|
|
310
|
-
if (!
|
|
310
|
+
if (!O(e.field_data)) return e;
|
|
311
311
|
const n = D(e.field_data, t), o = new Set(n.map((r) => r.key));
|
|
312
312
|
return {
|
|
313
313
|
...e,
|
|
@@ -318,7 +318,7 @@ function T(e, t) {
|
|
|
318
318
|
function fe(e, t = {}) {
|
|
319
319
|
if ("workflowId" in e) {
|
|
320
320
|
const n = e;
|
|
321
|
-
return n.forms.some((r) => r.flag !== void 0 ||
|
|
321
|
+
return n.forms.some((r) => r.flag !== void 0 || O(r.field_data)) || n.rules.some((r) => r.flag !== void 0) || (n.transitions ?? []).some((r) => r.flag !== void 0) ? {
|
|
322
322
|
...n,
|
|
323
323
|
forms: n.forms.filter((r) => x(r.flag, t)).map((r) => T(r, t)),
|
|
324
324
|
rules: n.rules.filter((r) => x(r.flag, t)),
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { t as b, defaultValue as wt, applyFlags as te, resolveViewFields as Vt,
|
|
|
2
2
|
import { approvalFields as nr, evalCondition as hr, evalValueExpr as pr, flagEnabled as cr, getCatalog as dr, readRef as ur, setCatalog as br, setLocale as vr, walkPath as fr } from "./engine.js";
|
|
3
3
|
import { LitElement as pe, nothing as h, html as n, svg as k } from "lit";
|
|
4
4
|
import { property as l, query as Z, customElement as p, state as v } from "lit/decorators.js";
|
|
5
|
-
import { live as
|
|
5
|
+
import { live as j } from "lit/directives/live.js";
|
|
6
6
|
import { ifDefined as P } from "lit/directives/if-defined.js";
|
|
7
7
|
var ce = Object.defineProperty, tt = (t, e, r, a) => {
|
|
8
8
|
for (var s = void 0, i = t.length - 1, o; i >= 0; i--)
|
|
@@ -286,8 +286,8 @@ bt([
|
|
|
286
286
|
H = bt([
|
|
287
287
|
p("baht-pagination")
|
|
288
288
|
], H);
|
|
289
|
-
var _e = Object.defineProperty,
|
|
290
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
289
|
+
var _e = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, w = (t, e, r, a) => {
|
|
290
|
+
for (var s = a > 1 ? void 0 : a ? Oe(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
291
291
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
292
292
|
return a && s && _e(e, r, s), s;
|
|
293
293
|
};
|
|
@@ -407,10 +407,10 @@ w([
|
|
|
407
407
|
$ = w([
|
|
408
408
|
p("baht-table")
|
|
409
409
|
], $);
|
|
410
|
-
var
|
|
410
|
+
var xe = Object.defineProperty, Pe = Object.getOwnPropertyDescriptor, L = (t, e, r, a) => {
|
|
411
411
|
for (var s = a > 1 ? void 0 : a ? Pe(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
412
412
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
413
|
-
return a && s &&
|
|
413
|
+
return a && s && xe(e, r, s), s;
|
|
414
414
|
};
|
|
415
415
|
let F = class extends u {
|
|
416
416
|
constructor() {
|
|
@@ -486,10 +486,10 @@ var Ce = Object.defineProperty, De = Object.getOwnPropertyDescriptor, st = (t, e
|
|
|
486
486
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
487
487
|
return a && s && Ce(e, r, s), s;
|
|
488
488
|
};
|
|
489
|
-
let
|
|
489
|
+
let x = class extends u {
|
|
490
490
|
constructor() {
|
|
491
491
|
super(...arguments), this.open = !1, this.heading = "", this.showClose = !0, this.closeOnScrim = !0, this.previousFocus = null, this.onKeydown = (t) => {
|
|
492
|
-
!this.open ||
|
|
492
|
+
!this.open || x.openStack.at(-1) !== this || (t.key === "Escape" ? this.requestClose("escape") : t.key === "Tab" && this.trapFocus(t));
|
|
493
493
|
};
|
|
494
494
|
}
|
|
495
495
|
focusables() {
|
|
@@ -518,14 +518,14 @@ let O = class extends u {
|
|
|
518
518
|
super.connectedCallback(), document.addEventListener("keydown", this.onKeydown);
|
|
519
519
|
}
|
|
520
520
|
disconnectedCallback() {
|
|
521
|
-
document.removeEventListener("keydown", this.onKeydown),
|
|
521
|
+
document.removeEventListener("keydown", this.onKeydown), x.openStack = x.openStack.filter((t) => t !== this), super.disconnectedCallback();
|
|
522
522
|
}
|
|
523
523
|
firstUpdated() {
|
|
524
524
|
et(this, this.bodyEl);
|
|
525
525
|
}
|
|
526
526
|
updated(t) {
|
|
527
527
|
var e, r;
|
|
528
|
-
if (t.has("open") && (
|
|
528
|
+
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) {
|
|
529
529
|
const a = this.previousFocus;
|
|
530
530
|
this.previousFocus = null, a != null && a.isConnected && (!document.activeElement || document.activeElement === document.body || this.contains(document.activeElement)) && ((r = a.focus) == null || r.call(a));
|
|
531
531
|
}
|
|
@@ -552,25 +552,25 @@ let O = class extends u {
|
|
|
552
552
|
</div>`;
|
|
553
553
|
}
|
|
554
554
|
};
|
|
555
|
-
|
|
555
|
+
x.openStack = [];
|
|
556
556
|
st([
|
|
557
557
|
l({ type: Boolean, reflect: !0 })
|
|
558
|
-
],
|
|
558
|
+
], x.prototype, "open", 2);
|
|
559
559
|
st([
|
|
560
560
|
l()
|
|
561
|
-
],
|
|
561
|
+
], x.prototype, "heading", 2);
|
|
562
562
|
st([
|
|
563
563
|
l({ type: Boolean, attribute: "show-close" })
|
|
564
|
-
],
|
|
564
|
+
], x.prototype, "showClose", 2);
|
|
565
565
|
st([
|
|
566
566
|
l({ type: Boolean, attribute: "close-on-scrim" })
|
|
567
|
-
],
|
|
567
|
+
], x.prototype, "closeOnScrim", 2);
|
|
568
568
|
st([
|
|
569
569
|
Z(".baht-modal-body")
|
|
570
|
-
],
|
|
571
|
-
|
|
570
|
+
], x.prototype, "bodyEl", 2);
|
|
571
|
+
x = st([
|
|
572
572
|
p("baht-modal")
|
|
573
|
-
],
|
|
573
|
+
], x);
|
|
574
574
|
var ke = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, Mt = (t, e, r, a) => {
|
|
575
575
|
for (var s = a > 1 ? void 0 : a ? Ee(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
576
576
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
@@ -630,10 +630,10 @@ Mt([
|
|
|
630
630
|
W = Mt([
|
|
631
631
|
p("baht-toast")
|
|
632
632
|
], W);
|
|
633
|
-
var
|
|
634
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
633
|
+
var je = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, vt = (t, e, r, a) => {
|
|
634
|
+
for (var s = a > 1 ? void 0 : a ? Be(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
635
635
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
636
|
-
return a && s &&
|
|
636
|
+
return a && s && je(e, r, s), s;
|
|
637
637
|
};
|
|
638
638
|
let S = class extends u {
|
|
639
639
|
constructor() {
|
|
@@ -835,7 +835,7 @@ let C = class extends u {
|
|
|
835
835
|
type="range"
|
|
836
836
|
id=${this.inputId}
|
|
837
837
|
aria-label=${this.label ? h : "Value"}
|
|
838
|
-
.value=${
|
|
838
|
+
.value=${j(String(this.value))}
|
|
839
839
|
min=${this.min}
|
|
840
840
|
max=${this.max}
|
|
841
841
|
step=${this.step}
|
|
@@ -1102,7 +1102,7 @@ var He = Object.defineProperty, We = Object.getOwnPropertyDescriptor, Lt = (t, e
|
|
|
1102
1102
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1103
1103
|
return a && s && He(e, r, s), s;
|
|
1104
1104
|
};
|
|
1105
|
-
let
|
|
1105
|
+
let Ot = class extends u {
|
|
1106
1106
|
constructor() {
|
|
1107
1107
|
super(...arguments), this.size = "md", this.label = "Loading";
|
|
1108
1108
|
}
|
|
@@ -1113,13 +1113,13 @@ let xt = class extends u {
|
|
|
1113
1113
|
};
|
|
1114
1114
|
Lt([
|
|
1115
1115
|
l()
|
|
1116
|
-
],
|
|
1116
|
+
], Ot.prototype, "size", 2);
|
|
1117
1117
|
Lt([
|
|
1118
1118
|
l()
|
|
1119
|
-
],
|
|
1120
|
-
|
|
1119
|
+
], Ot.prototype, "label", 2);
|
|
1120
|
+
Ot = Lt([
|
|
1121
1121
|
p("baht-spinner")
|
|
1122
|
-
],
|
|
1122
|
+
], Ot);
|
|
1123
1123
|
var Je = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, mt = (t, e, r, a) => {
|
|
1124
1124
|
for (var s = a > 1 ? void 0 : a ? Ge(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1125
1125
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
@@ -1318,7 +1318,7 @@ var as = Object.defineProperty, is = Object.getOwnPropertyDescriptor, Rt = (t, e
|
|
|
1318
1318
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1319
1319
|
return a && s && as(e, r, s), s;
|
|
1320
1320
|
};
|
|
1321
|
-
let
|
|
1321
|
+
let xt = class extends u {
|
|
1322
1322
|
constructor() {
|
|
1323
1323
|
super(...arguments), this.items = [], this.separator = "›";
|
|
1324
1324
|
}
|
|
@@ -1345,13 +1345,13 @@ let Ot = class extends u {
|
|
|
1345
1345
|
};
|
|
1346
1346
|
Rt([
|
|
1347
1347
|
l({ attribute: !1 })
|
|
1348
|
-
],
|
|
1348
|
+
], xt.prototype, "items", 2);
|
|
1349
1349
|
Rt([
|
|
1350
1350
|
l()
|
|
1351
|
-
],
|
|
1352
|
-
|
|
1351
|
+
], xt.prototype, "separator", 2);
|
|
1352
|
+
xt = Rt([
|
|
1353
1353
|
p("baht-breadcrumbs")
|
|
1354
|
-
],
|
|
1354
|
+
], xt);
|
|
1355
1355
|
var os = Object.getOwnPropertyDescriptor, ls = (t, e, r, a) => {
|
|
1356
1356
|
for (var s = a > 1 ? void 0 : a ? os(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1357
1357
|
(o = t[i]) && (s = o(s) || s);
|
|
@@ -1363,7 +1363,7 @@ let zt = class extends m {
|
|
|
1363
1363
|
class="baht-control baht-control--text"
|
|
1364
1364
|
id=${this.controlId}
|
|
1365
1365
|
type=${this.field.type === "email" ? "email" : "text"}
|
|
1366
|
-
.value=${
|
|
1366
|
+
.value=${j(this.value == null ? "" : String(this.value))}
|
|
1367
1367
|
placeholder=${P(this.field.placeholder)}
|
|
1368
1368
|
maxlength=${P(this.field.maxLength)}
|
|
1369
1369
|
autocomplete=${P(this.field.autocomplete)}
|
|
@@ -1389,7 +1389,7 @@ let Kt = class extends m {
|
|
|
1389
1389
|
return n`<textarea
|
|
1390
1390
|
class="baht-control baht-control--textarea"
|
|
1391
1391
|
id=${this.controlId}
|
|
1392
|
-
.value=${
|
|
1392
|
+
.value=${j(this.value == null ? "" : String(this.value))}
|
|
1393
1393
|
placeholder=${P(this.field.placeholder)}
|
|
1394
1394
|
maxlength=${P(this.field.maxLength)}
|
|
1395
1395
|
rows=${this.field.rows ?? 3}
|
|
@@ -1417,7 +1417,7 @@ let Ht = class extends m {
|
|
|
1417
1417
|
class="baht-control baht-control--number"
|
|
1418
1418
|
id=${this.controlId}
|
|
1419
1419
|
type="number"
|
|
1420
|
-
.value=${
|
|
1420
|
+
.value=${j(this.value == null ? "" : String(this.value))}
|
|
1421
1421
|
placeholder=${P(this.field.placeholder)}
|
|
1422
1422
|
min=${P(this.field.min)}
|
|
1423
1423
|
max=${P(this.field.max)}
|
|
@@ -1448,7 +1448,7 @@ let Wt = class extends m {
|
|
|
1448
1448
|
return n`<select
|
|
1449
1449
|
class="baht-control baht-control--select"
|
|
1450
1450
|
id=${this.controlId}
|
|
1451
|
-
.value=${
|
|
1451
|
+
.value=${j(t)}
|
|
1452
1452
|
?disabled=${this.disabled || this.readonly}
|
|
1453
1453
|
?required=${this.required}
|
|
1454
1454
|
aria-invalid=${this.invalid}
|
|
@@ -1493,7 +1493,7 @@ let Jt = class extends m {
|
|
|
1493
1493
|
<input
|
|
1494
1494
|
type="checkbox"
|
|
1495
1495
|
value=${t.key}
|
|
1496
|
-
.checked=${
|
|
1496
|
+
.checked=${j(this.selected.includes(t.key))}
|
|
1497
1497
|
?disabled=${this.disabled || this.readonly}
|
|
1498
1498
|
@change=${(e) => this.toggle(t.key, e.target.checked)}
|
|
1499
1499
|
/>
|
|
@@ -1521,7 +1521,7 @@ let Gt = class extends m {
|
|
|
1521
1521
|
<input
|
|
1522
1522
|
type="checkbox"
|
|
1523
1523
|
id=${this.controlId}
|
|
1524
|
-
.checked=${
|
|
1524
|
+
.checked=${j(this.value === !0)}
|
|
1525
1525
|
?disabled=${this.disabled || this.readonly}
|
|
1526
1526
|
?required=${this.required}
|
|
1527
1527
|
aria-invalid=${this.invalid}
|
|
@@ -1558,7 +1558,7 @@ let Yt = class extends m {
|
|
|
1558
1558
|
type="radio"
|
|
1559
1559
|
name=${this.controlId}
|
|
1560
1560
|
value=${t.key}
|
|
1561
|
-
.checked=${
|
|
1561
|
+
.checked=${j(this.value === t.key)}
|
|
1562
1562
|
?disabled=${this.disabled || this.readonly}
|
|
1563
1563
|
@change=${() => this.emitInput(t.key)}
|
|
1564
1564
|
/>
|
|
@@ -1587,7 +1587,7 @@ let Qt = class extends m {
|
|
|
1587
1587
|
role="switch"
|
|
1588
1588
|
id=${this.controlId}
|
|
1589
1589
|
aria-checked=${this.value === !0 ? "true" : "false"}
|
|
1590
|
-
.checked=${
|
|
1590
|
+
.checked=${j(this.value === !0)}
|
|
1591
1591
|
?disabled=${this.disabled || this.readonly}
|
|
1592
1592
|
?required=${this.required}
|
|
1593
1593
|
aria-invalid=${this.invalid}
|
|
@@ -1604,7 +1604,7 @@ let Qt = class extends m {
|
|
|
1604
1604
|
Qt = ws([
|
|
1605
1605
|
p("baht-toggle")
|
|
1606
1606
|
], Qt);
|
|
1607
|
-
var _s = Object.getOwnPropertyDescriptor,
|
|
1607
|
+
var _s = Object.getOwnPropertyDescriptor, Os = (t, e, r, a) => {
|
|
1608
1608
|
for (var s = a > 1 ? void 0 : a ? _s(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1609
1609
|
(o = t[i]) && (s = o(s) || s);
|
|
1610
1610
|
return s;
|
|
@@ -1615,7 +1615,7 @@ let Xt = class extends m {
|
|
|
1615
1615
|
class="baht-control baht-control--date"
|
|
1616
1616
|
id=${this.controlId}
|
|
1617
1617
|
type="date"
|
|
1618
|
-
.value=${
|
|
1618
|
+
.value=${j(this.value == null ? "" : String(this.value))}
|
|
1619
1619
|
min=${P(this.field.min)}
|
|
1620
1620
|
max=${P(this.field.max)}
|
|
1621
1621
|
?disabled=${this.disabled}
|
|
@@ -1630,13 +1630,13 @@ let Xt = class extends m {
|
|
|
1630
1630
|
/>`;
|
|
1631
1631
|
}
|
|
1632
1632
|
};
|
|
1633
|
-
Xt =
|
|
1633
|
+
Xt = Os([
|
|
1634
1634
|
p("baht-datepicker")
|
|
1635
1635
|
], Xt);
|
|
1636
|
-
var
|
|
1636
|
+
var xs = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, $t = (t, e, r, a) => {
|
|
1637
1637
|
for (var s = a > 1 ? void 0 : a ? Ps(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1638
1638
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1639
|
-
return a && s &&
|
|
1639
|
+
return a && s && xs(e, r, s), s;
|
|
1640
1640
|
};
|
|
1641
1641
|
function Zt(t) {
|
|
1642
1642
|
return t !== null && typeof t == "object" && typeof t.url == "string";
|
|
@@ -1743,8 +1743,8 @@ re([
|
|
|
1743
1743
|
It = re([
|
|
1744
1744
|
p("baht-text")
|
|
1745
1745
|
], It);
|
|
1746
|
-
var Es = Object.defineProperty,
|
|
1747
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
1746
|
+
var Es = Object.defineProperty, js = Object.getOwnPropertyDescriptor, jt = (t, e, r, a) => {
|
|
1747
|
+
for (var s = a > 1 ? void 0 : a ? js(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1748
1748
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1749
1749
|
return a && s && Es(e, r, s), s;
|
|
1750
1750
|
};
|
|
@@ -1762,21 +1762,21 @@ let ct = class extends u {
|
|
|
1762
1762
|
</div>`;
|
|
1763
1763
|
}
|
|
1764
1764
|
};
|
|
1765
|
-
|
|
1765
|
+
jt([
|
|
1766
1766
|
l({ type: Number })
|
|
1767
1767
|
], ct.prototype, "total", 2);
|
|
1768
|
-
|
|
1768
|
+
jt([
|
|
1769
1769
|
l()
|
|
1770
1770
|
], ct.prototype, "label", 2);
|
|
1771
|
-
|
|
1771
|
+
jt([
|
|
1772
1772
|
l()
|
|
1773
1773
|
], ct.prototype, "color", 2);
|
|
1774
|
-
ct =
|
|
1774
|
+
ct = jt([
|
|
1775
1775
|
p("baht-stat-chart")
|
|
1776
1776
|
], ct);
|
|
1777
|
-
const
|
|
1777
|
+
const Bs = 10;
|
|
1778
1778
|
function ae(t, e) {
|
|
1779
|
-
return e && t === 0 ? e : `var(--baht-chart-${t %
|
|
1779
|
+
return e && t === 0 ? e : `var(--baht-chart-${t % Bs + 1})`;
|
|
1780
1780
|
}
|
|
1781
1781
|
var Fs = Object.defineProperty, Ns = Object.getOwnPropertyDescriptor, lt = (t, e, r, a) => {
|
|
1782
1782
|
for (var s = a > 1 ? void 0 : a ? Ns(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
@@ -1793,14 +1793,14 @@ let N = class extends u {
|
|
|
1793
1793
|
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 = N.R, a = 2 * Math.PI * r;
|
|
1794
1794
|
let s = 0;
|
|
1795
1795
|
const i = this.groups.map((o, c) => {
|
|
1796
|
-
const d = o.count / t,
|
|
1796
|
+
const d = o.count / t, O = {
|
|
1797
1797
|
...o,
|
|
1798
1798
|
frac: d,
|
|
1799
1799
|
dash: `${d * a} ${a - d * a}`,
|
|
1800
1800
|
offset: -s * a,
|
|
1801
1801
|
color: ae(c, this.color || void 0)
|
|
1802
1802
|
};
|
|
1803
|
-
return s += d,
|
|
1803
|
+
return s += d, O;
|
|
1804
1804
|
});
|
|
1805
1805
|
return n`<div class="baht-donut-chart">
|
|
1806
1806
|
<svg width="160" height="160" viewBox="0 0 160 160" role="img" aria-label="Donut chart">
|
|
@@ -1845,7 +1845,7 @@ lt([
|
|
|
1845
1845
|
N = lt([
|
|
1846
1846
|
p("baht-donut-chart")
|
|
1847
1847
|
], N);
|
|
1848
|
-
var Is = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor,
|
|
1848
|
+
var Is = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, Bt = (t, e, r, a) => {
|
|
1849
1849
|
for (var s = a > 1 ? void 0 : a ? Ss(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1850
1850
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
1851
1851
|
return a && s && Is(e, r, s), s;
|
|
@@ -1874,16 +1874,16 @@ let dt = class extends u {
|
|
|
1874
1874
|
</div>`;
|
|
1875
1875
|
}
|
|
1876
1876
|
};
|
|
1877
|
-
|
|
1877
|
+
Bt([
|
|
1878
1878
|
l({ attribute: !1 })
|
|
1879
1879
|
], dt.prototype, "groups", 2);
|
|
1880
|
-
|
|
1880
|
+
Bt([
|
|
1881
1881
|
l()
|
|
1882
1882
|
], dt.prototype, "color", 2);
|
|
1883
|
-
|
|
1883
|
+
Bt([
|
|
1884
1884
|
l({ attribute: "empty-message" })
|
|
1885
1885
|
], dt.prototype, "emptyMessage", 2);
|
|
1886
|
-
dt =
|
|
1886
|
+
dt = Bt([
|
|
1887
1887
|
p("baht-bar-chart")
|
|
1888
1888
|
], dt);
|
|
1889
1889
|
var qs = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Ft = (t, e, r, a) => {
|
|
@@ -2263,7 +2263,11 @@ let St = class extends m {
|
|
|
2263
2263
|
super(...arguments), this.rowErrors = [], this.controls = /* @__PURE__ */ new Map();
|
|
2264
2264
|
}
|
|
2265
2265
|
willUpdate(t) {
|
|
2266
|
-
t.has("field") && this.controls.clear()
|
|
2266
|
+
if (t.has("field") && this.controls.clear(), t.has("value")) {
|
|
2267
|
+
const e = this.rows.length;
|
|
2268
|
+
for (const r of this.controls.keys())
|
|
2269
|
+
Number(r.slice(0, r.indexOf(":"))) >= e && this.controls.delete(r);
|
|
2270
|
+
}
|
|
2267
2271
|
}
|
|
2268
2272
|
get rows() {
|
|
2269
2273
|
return Array.isArray(this.value) ? this.value : [];
|
|
@@ -2298,7 +2302,7 @@ let St = class extends m {
|
|
|
2298
2302
|
c.stopPropagation();
|
|
2299
2303
|
const { value: d } = c.detail;
|
|
2300
2304
|
this.patchRow(e, r.key, d);
|
|
2301
|
-
}), this.controls.set(s, i)), i.field = r, i.value = r.key
|
|
2305
|
+
}), this.controls.set(s, i)), i.field = r, i.value = Object.hasOwn(t, r.key) ? t[r.key] : wt(r), i.disabled = this.disabled, i.readonly = this.readonly, i.required = !!r.required, i.error = this.errorFor(e, r.key);
|
|
2302
2306
|
const o = Ws[r.width ?? "full"] ?? "baht-field--w-full";
|
|
2303
2307
|
return n`<div class="baht-field ${o}" data-key=${r.key} data-type=${r.type}>
|
|
2304
2308
|
${i}
|
|
@@ -2379,7 +2383,7 @@ At([
|
|
|
2379
2383
|
Pt = At([
|
|
2380
2384
|
p("baht-steps")
|
|
2381
2385
|
], Pt);
|
|
2382
|
-
var Ys = Object.defineProperty, Qs = Object.getOwnPropertyDescriptor,
|
|
2386
|
+
var Ys = Object.defineProperty, Qs = Object.getOwnPropertyDescriptor, B = (t, e, r, a) => {
|
|
2383
2387
|
for (var s = a > 1 ? void 0 : a ? Qs(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
2384
2388
|
(o = t[i]) && (s = (a ? o(e, r, s) : o(s)) || s);
|
|
2385
2389
|
return a && s && Ys(e, r, s), s;
|
|
@@ -2461,7 +2465,7 @@ let D = class extends u {
|
|
|
2461
2465
|
};
|
|
2462
2466
|
}
|
|
2463
2467
|
valueFor(t) {
|
|
2464
|
-
return
|
|
2468
|
+
return Object.hasOwn(this.edits, t.key) ? this.edits[t.key] : Object.hasOwn(this.value, t.key) ? this.value[t.key] : wt(t);
|
|
2465
2469
|
}
|
|
2466
2470
|
// ---- public API (spec 01 §6) ----
|
|
2467
2471
|
getData() {
|
|
@@ -2530,8 +2534,8 @@ let D = class extends u {
|
|
|
2530
2534
|
let i = this.controls.get(t.key);
|
|
2531
2535
|
if ((!i || i.tagName.toLowerCase() !== e) && (i = document.createElement(e), i.addEventListener("baht-input", (d) => {
|
|
2532
2536
|
var Tt;
|
|
2533
|
-
const
|
|
2534
|
-
|
|
2537
|
+
const O = (Tt = this.effectiveForm) == null ? void 0 : Tt.field_data.find((le) => le.key === t.key);
|
|
2538
|
+
O && this.onFieldInput(O, d);
|
|
2535
2539
|
}), 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 = r.readonly, i.required = r.required, i.error = s, t.type === "repeater" && (i.rowErrors = this.errors.filter((d) => d.key.startsWith(`${t.key}[`))), t.type === "file" && t.uploader) {
|
|
2536
2540
|
const d = (c = this.registry.uploaders) == null ? void 0 : c[t.uploader];
|
|
2537
2541
|
d || console.warn(`[bahtui] unknown uploader "${t.uploader}" — capture only`), i.uploader = d;
|
|
@@ -2549,34 +2553,34 @@ let D = class extends u {
|
|
|
2549
2553
|
return n`<div class="baht-form">${this.sortedFields.map((t) => this.renderField(t))}</div>`;
|
|
2550
2554
|
}
|
|
2551
2555
|
};
|
|
2552
|
-
|
|
2556
|
+
B([
|
|
2553
2557
|
l({ attribute: !1 })
|
|
2554
2558
|
], D.prototype, "form", 2);
|
|
2555
|
-
|
|
2559
|
+
B([
|
|
2556
2560
|
l({ attribute: !1 })
|
|
2557
2561
|
], D.prototype, "value", 2);
|
|
2558
|
-
|
|
2562
|
+
B([
|
|
2559
2563
|
l({ attribute: !1 })
|
|
2560
2564
|
], D.prototype, "registry", 2);
|
|
2561
|
-
|
|
2565
|
+
B([
|
|
2562
2566
|
l({ attribute: !1 })
|
|
2563
2567
|
], D.prototype, "options", 2);
|
|
2564
|
-
|
|
2568
|
+
B([
|
|
2565
2569
|
l({ attribute: !1 })
|
|
2566
2570
|
], D.prototype, "fieldStates", 2);
|
|
2567
|
-
|
|
2571
|
+
B([
|
|
2568
2572
|
l({ type: String })
|
|
2569
2573
|
], D.prototype, "view", 2);
|
|
2570
|
-
|
|
2574
|
+
B([
|
|
2571
2575
|
l({ attribute: !1 })
|
|
2572
2576
|
], D.prototype, "flags", 2);
|
|
2573
|
-
|
|
2577
|
+
B([
|
|
2574
2578
|
v()
|
|
2575
2579
|
], D.prototype, "edits", 2);
|
|
2576
|
-
|
|
2580
|
+
B([
|
|
2577
2581
|
v()
|
|
2578
2582
|
], D.prototype, "errors", 2);
|
|
2579
|
-
D =
|
|
2583
|
+
D = B([
|
|
2580
2584
|
p("baht-form")
|
|
2581
2585
|
], D);
|
|
2582
2586
|
var Zs = Object.defineProperty, tr = Object.getOwnPropertyDescriptor, _ = (t, e, r, a) => {
|
|
@@ -2674,9 +2678,15 @@ let g = class extends u {
|
|
|
2674
2678
|
}
|
|
2675
2679
|
const a = this.visibleForms.find((s) => s.formName === r);
|
|
2676
2680
|
if (!a || a.formName === this.current) {
|
|
2681
|
+
const s = a ? "self-transition" : "target-hidden";
|
|
2677
2682
|
console.warn(
|
|
2678
2683
|
`[bahtui] cannot advance from "${this.current}": target "${r}" is ` + (a ? "the current form (self-transition)" : "not visible")
|
|
2679
|
-
)
|
|
2684
|
+
), this.emit("baht-nav-blocked", {
|
|
2685
|
+
formName: this.current,
|
|
2686
|
+
target: r,
|
|
2687
|
+
reason: s,
|
|
2688
|
+
data: this.getData()
|
|
2689
|
+
});
|
|
2680
2690
|
return;
|
|
2681
2691
|
}
|
|
2682
2692
|
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", {
|
|
@@ -2713,7 +2723,7 @@ let g = class extends u {
|
|
|
2713
2723
|
}
|
|
2714
2724
|
this.emit("baht-reject", o);
|
|
2715
2725
|
const c = r.onReject ?? { action: "end" };
|
|
2716
|
-
c.action === "goto" && this.visibleForms.some((
|
|
2726
|
+
c.action === "goto" && this.visibleForms.some((O) => O.formName === c.form) ? this.gotoForm(c.form) : this.emit("baht-complete", { data: this.getData(), status: "rejected" });
|
|
2717
2727
|
}
|
|
2718
2728
|
/** Jump back to a visible form, truncating the history to that point. */
|
|
2719
2729
|
gotoForm(t) {
|
|
@@ -2771,19 +2781,19 @@ let g = class extends u {
|
|
|
2771
2781
|
return n`<div class="baht-approval">
|
|
2772
2782
|
<div class="baht-approval-summary">
|
|
2773
2783
|
${r.length === 0 ? n`<p class="baht-approval-empty">${b("nothingToReview")}</p>` : r.map((i) => {
|
|
2774
|
-
const o = this.fieldStatesFor(i.formName), c = [...i.field_data].sort((d,
|
|
2775
|
-
var
|
|
2776
|
-
return d.type !== "label" && ((
|
|
2784
|
+
const o = this.fieldStatesFor(i.formName), c = [...i.field_data].sort((d, O) => d.order - O.order).filter((d) => {
|
|
2785
|
+
var O;
|
|
2786
|
+
return d.type !== "label" && ((O = o[d.key]) == null ? void 0 : O.visible) !== !1;
|
|
2777
2787
|
});
|
|
2778
2788
|
return n`<section class="baht-approval-group">
|
|
2779
2789
|
<h4 class="baht-approval-group-title">${i.formName}</h4>
|
|
2780
2790
|
<dl class="baht-approval-rows">
|
|
2781
2791
|
${c.map(
|
|
2782
2792
|
(d) => {
|
|
2783
|
-
var
|
|
2793
|
+
var O;
|
|
2784
2794
|
return n`<div class="baht-approval-row">
|
|
2785
2795
|
<dt>${d.label ?? d.key}</dt>
|
|
2786
|
-
<dd>${this.displayValue(d, (
|
|
2796
|
+
<dd>${this.displayValue(d, (O = this.data[i.formName]) == null ? void 0 : O[d.key])}</dd>
|
|
2787
2797
|
</div>`;
|
|
2788
2798
|
}
|
|
2789
2799
|
)}
|
|
@@ -2898,7 +2908,7 @@ export {
|
|
|
2898
2908
|
A as BahtAlert,
|
|
2899
2909
|
nt as BahtBadge,
|
|
2900
2910
|
dt as BahtBarChart,
|
|
2901
|
-
|
|
2911
|
+
xt as BahtBreadcrumbs,
|
|
2902
2912
|
E as BahtButton,
|
|
2903
2913
|
G as BahtCard,
|
|
2904
2914
|
Gt as BahtCheckbox,
|
|
@@ -2917,7 +2927,7 @@ export {
|
|
|
2917
2927
|
M as BahtKeyvalueEditor,
|
|
2918
2928
|
Y as BahtLink,
|
|
2919
2929
|
F as BahtList,
|
|
2920
|
-
|
|
2930
|
+
x as BahtModal,
|
|
2921
2931
|
Jt as BahtMultiselect,
|
|
2922
2932
|
Ht as BahtNumber,
|
|
2923
2933
|
V as BahtOtp,
|
|
@@ -2930,7 +2940,7 @@ export {
|
|
|
2930
2940
|
St as BahtRepeater,
|
|
2931
2941
|
Wt as BahtSelect,
|
|
2932
2942
|
ht as BahtSkeleton,
|
|
2933
|
-
|
|
2943
|
+
Ot as BahtSpinner,
|
|
2934
2944
|
ct as BahtStatChart,
|
|
2935
2945
|
Pt as BahtSteps,
|
|
2936
2946
|
$ as BahtTable,
|
package/dist/web-types.json
CHANGED