@20baht/ui 0.1.1 → 0.2.0
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/components/baht-form.js +30 -28
- package/dist/components/baht-workflow.js +27 -26
- package/dist/components/define.js +1 -1
- package/dist/components/primitives/baht-repeater.d.ts +7 -1
- package/dist/components/primitives/baht-repeater.js +68 -65
- package/dist/components/primitives/tag-map.d.ts +13 -2
- package/dist/components/primitives/tag-map.js +21 -32
- package/dist/custom-elements.json +43 -4
- package/dist/react.d.ts +354 -545
- package/dist/register.d.ts +10 -10
- package/dist/register.js +10 -10
- package/dist/ssr.js +1 -1
- package/dist/web-types.json +6 -1
- package/package.json +3 -2
|
@@ -2,9 +2,9 @@ import { nothing as c, html as y } from "lit";
|
|
|
2
2
|
import { property as p, state as I } from "lit/decorators.js";
|
|
3
3
|
import { repeat as V } from "lit/directives/repeat.js";
|
|
4
4
|
import { html as b } from "lit/static-html.js";
|
|
5
|
-
import { BahtElement as
|
|
6
|
-
import {
|
|
7
|
-
import { emptyFormState as B, updateForm as C, createScriptContext as K, applyFlags as
|
|
5
|
+
import { BahtElement as D, obj as q, hasDom as O } from "./base.js";
|
|
6
|
+
import { tagForField as _, WIDTH_CLASS as j, staticTag as P } from "./primitives/tag-map.js";
|
|
7
|
+
import { emptyFormState as B, updateForm as C, createScriptContext as K, applyFlags as W, resolveViewFields as E, formFieldState as A, defaultValue as T, formData as R, displayValue as U } from "@20baht/engine";
|
|
8
8
|
import "./primitives/baht-input.js";
|
|
9
9
|
import "./primitives/baht-textarea.js";
|
|
10
10
|
import "./primitives/baht-markdown.js";
|
|
@@ -25,9 +25,9 @@ import "./primitives/baht-text.js";
|
|
|
25
25
|
import "./primitives/baht-section.js";
|
|
26
26
|
import "./primitives/baht-tabs.js";
|
|
27
27
|
import "./primitives/baht-repeater.js";
|
|
28
|
-
import { customElement as
|
|
29
|
-
import { ReferenceLabels as
|
|
30
|
-
import { DynamicOptions as
|
|
28
|
+
import { customElement as H } from "./define.js";
|
|
29
|
+
import { ReferenceLabels as N } from "./reference-labels.js";
|
|
30
|
+
import { DynamicOptions as G } from "./form-options.js";
|
|
31
31
|
import { renderReadonlyField as Y } from "./form-readonly.js";
|
|
32
32
|
import { buildLayout as z, rowStyle as $, isTabSection as J, tabClass as x, foldClass as M } from "./form-layout.js";
|
|
33
33
|
var Q = Object.defineProperty, X = Object.getOwnPropertyDescriptor, l = (t, e, s, r) => {
|
|
@@ -43,11 +43,11 @@ const F = (t) => t.split("[")[0] ?? t, Z = /* @__PURE__ */ new Set([
|
|
|
43
43
|
"currency",
|
|
44
44
|
"time"
|
|
45
45
|
]);
|
|
46
|
-
let h = class extends
|
|
46
|
+
let h = class extends D {
|
|
47
47
|
constructor() {
|
|
48
|
-
super(...arguments), this.value = {}, this.registry = {}, this.showOptional = !1, this.options = {}, this.fieldStates = {}, this.flags = {}, this.tab = "", this.readonly = !1, this.submitOnEnter = !1, this.busy = !1, this.session = B, this.folded = /* @__PURE__ */ new Set(), this.stepping = !1, this.queued = [], this.stepSink = null, this.scriptContext = null, this.referenceLabels = new
|
|
48
|
+
super(...arguments), this.value = {}, this.registry = {}, this.showOptional = !1, this.options = {}, this.fieldStates = {}, this.flags = {}, this.tab = "", this.readonly = !1, this.submitOnEnter = !1, this.busy = !1, this.session = B, this.folded = /* @__PURE__ */ new Set(), this.stepping = !1, this.queued = [], this.stepSink = null, this.scriptContext = null, this.referenceLabels = new N(() => {
|
|
49
49
|
this.requestUpdate();
|
|
50
|
-
}), this.warnedLookups = /* @__PURE__ */ new Set(), this.loadedForm = null, this.dynamicOptions = new
|
|
50
|
+
}), this.warnedLookups = /* @__PURE__ */ new Set(), this.loadedForm = null, this.dynamicOptions = new G({
|
|
51
51
|
form: () => this.effectiveForm,
|
|
52
52
|
data: () => this.getData(),
|
|
53
53
|
registry: () => this.registry,
|
|
@@ -156,12 +156,12 @@ let h = class extends _ {
|
|
|
156
156
|
get effectiveForm() {
|
|
157
157
|
const t = this.assignedForm;
|
|
158
158
|
if (t)
|
|
159
|
-
return (this.flagCache.form !== t || this.flagCache.flags !== this.flags) && (this.flagCache = { form: t, flags: this.flags, out:
|
|
159
|
+
return (this.flagCache.form !== t || this.flagCache.flags !== this.flags) && (this.flagCache = { form: t, flags: this.flags, out: W(t, this.flags) }), this.flagCache.out;
|
|
160
160
|
}
|
|
161
161
|
willUpdate(t) {
|
|
162
162
|
var e;
|
|
163
163
|
if ((t.has("form") || t.has("flags")) && this.dynamicOptions.clear(), t.has("value")) {
|
|
164
|
-
const s =
|
|
164
|
+
const s = q(t.get("value"));
|
|
165
165
|
this.step({ type: "value", previous: s });
|
|
166
166
|
}
|
|
167
167
|
t.has("form") && (this.step({ type: "form", previous: t.get("form") }), this.folded = new Set(
|
|
@@ -182,8 +182,8 @@ let h = class extends _ {
|
|
|
182
182
|
return this.sortedCache = { form: t, view: this.view, out: s }, s;
|
|
183
183
|
}
|
|
184
184
|
resolveSortedFields(t) {
|
|
185
|
-
const e =
|
|
186
|
-
return e || (this.view !== void 0 && !this.warnedViews.has(this.view) && (this.warnedViews.add(this.view), console.warn(`[bahtui] unknown view "${this.view}" — showing the full form`)),
|
|
185
|
+
const e = E(t, this.view);
|
|
186
|
+
return e || (this.view !== void 0 && !this.warnedViews.has(this.view) && (this.warnedViews.add(this.view), console.warn(`[bahtui] unknown view "${this.view}" — showing the full form`)), E(t) ?? []);
|
|
187
187
|
}
|
|
188
188
|
tabLayout() {
|
|
189
189
|
var t, e;
|
|
@@ -247,7 +247,7 @@ let h = class extends _ {
|
|
|
247
247
|
}
|
|
248
248
|
stateFor(t) {
|
|
249
249
|
const e = this.effectiveForm;
|
|
250
|
-
return
|
|
250
|
+
return A(
|
|
251
251
|
e ? this.sessionInput(e) : { form: this.form },
|
|
252
252
|
this.session,
|
|
253
253
|
t
|
|
@@ -270,10 +270,10 @@ let h = class extends _ {
|
|
|
270
270
|
}
|
|
271
271
|
/** `valueFor` for the render path: an unset collection field keeps one default array. */
|
|
272
272
|
renderValueFor(t) {
|
|
273
|
-
return Object.hasOwn(this.edits, t.key) || Object.hasOwn(this.value, t.key) ? this.valueFor(t) : (this.defaultsSeen.has(t) || this.defaultsSeen.set(t,
|
|
273
|
+
return Object.hasOwn(this.edits, t.key) || Object.hasOwn(this.value, t.key) ? this.valueFor(t) : (this.defaultsSeen.has(t) || this.defaultsSeen.set(t, T(t)), this.defaultsSeen.get(t));
|
|
274
274
|
}
|
|
275
275
|
valueFor(t) {
|
|
276
|
-
return Object.hasOwn(this.edits, t.key) ? this.edits[t.key] : Object.hasOwn(this.value, t.key) ? this.value[t.key] :
|
|
276
|
+
return Object.hasOwn(this.edits, t.key) ? this.edits[t.key] : Object.hasOwn(this.value, t.key) ? this.value[t.key] : T(t);
|
|
277
277
|
}
|
|
278
278
|
// ---- public API (spec 01 §6) ----
|
|
279
279
|
/**
|
|
@@ -382,13 +382,13 @@ let h = class extends _ {
|
|
|
382
382
|
var S;
|
|
383
383
|
if (J(t))
|
|
384
384
|
return t.key === e.first ? this.renderTabStrip(e) : c;
|
|
385
|
-
const s =
|
|
385
|
+
const s = _(t.type, this.registry);
|
|
386
386
|
if (!s)
|
|
387
387
|
return console.warn(`[bahtui] unknown field type "${t.type}" — skipped`), c;
|
|
388
388
|
const r = this.stateFor(t), i = j[t.width ?? "full"] ?? "baht-field--w-full", o = ((S = this.errors.find((f) => f.key === t.key)) == null ? void 0 : S.message) ?? null;
|
|
389
389
|
if (this.readonly && t.type !== "label" && t.type !== "section")
|
|
390
390
|
return this.renderReadonlyField(t, i, r.visible, e);
|
|
391
|
-
const n = this.dynamicOptions.withOptions(t), u = this.renderValueFor(t), a = !r.enabled || this.busy,
|
|
391
|
+
const n = this.dynamicOptions.withOptions(t), u = this.renderValueFor(t), a = !r.enabled || this.busy, g = this.readonly || r.readonly, w = this.options.inputDebounce, v = (f) => {
|
|
392
392
|
this.onControlInput(t.key, f);
|
|
393
393
|
}, d = P(s);
|
|
394
394
|
let m;
|
|
@@ -406,7 +406,7 @@ let h = class extends _ {
|
|
|
406
406
|
.field=${n}
|
|
407
407
|
.value=${u}
|
|
408
408
|
.disabled=${a}
|
|
409
|
-
.readonly=${
|
|
409
|
+
.readonly=${g}
|
|
410
410
|
.required=${r.required}
|
|
411
411
|
.showOptional=${this.showOptional}
|
|
412
412
|
.error=${o}
|
|
@@ -414,19 +414,20 @@ let h = class extends _ {
|
|
|
414
414
|
.rowErrors=${f}
|
|
415
415
|
.rowStates=${L}
|
|
416
416
|
.rowLookup=${this.rowLookup}
|
|
417
|
-
|
|
417
|
+
.registry=${this.registry}
|
|
418
|
+
@baht-input=${v}
|
|
418
419
|
></${d}>`;
|
|
419
420
|
} else if (t.type === "reference")
|
|
420
421
|
m = b`<${d}
|
|
421
422
|
.field=${n}
|
|
422
423
|
.value=${u}
|
|
423
424
|
.disabled=${a}
|
|
424
|
-
.readonly=${
|
|
425
|
+
.readonly=${g}
|
|
425
426
|
.required=${r.required}
|
|
426
427
|
.showOptional=${this.showOptional}
|
|
427
428
|
.error=${o}
|
|
428
429
|
.lookup=${this.lookupFor(t)}
|
|
429
|
-
@baht-input=${
|
|
430
|
+
@baht-input=${v}
|
|
430
431
|
></${d}>`;
|
|
431
432
|
else if (t.type === "file" || t.type === "markdown") {
|
|
432
433
|
const f = this.uploaderFor(t);
|
|
@@ -434,26 +435,26 @@ let h = class extends _ {
|
|
|
434
435
|
.field=${n}
|
|
435
436
|
.value=${u}
|
|
436
437
|
.disabled=${a}
|
|
437
|
-
.readonly=${
|
|
438
|
+
.readonly=${g}
|
|
438
439
|
.required=${r.required}
|
|
439
440
|
.showOptional=${this.showOptional}
|
|
440
441
|
.error=${o}
|
|
441
442
|
.debounce=${w}
|
|
442
443
|
.uploader=${f}
|
|
443
444
|
.allowImage=${this.registry.markdownImage}
|
|
444
|
-
@baht-input=${
|
|
445
|
+
@baht-input=${v}
|
|
445
446
|
></${d}>`;
|
|
446
447
|
} else
|
|
447
448
|
m = b`<${d}
|
|
448
449
|
.field=${n}
|
|
449
450
|
.value=${u}
|
|
450
451
|
.disabled=${a}
|
|
451
|
-
.readonly=${
|
|
452
|
+
.readonly=${g}
|
|
452
453
|
.required=${r.required}
|
|
453
454
|
.showOptional=${this.showOptional}
|
|
454
455
|
.error=${o}
|
|
455
456
|
.debounce=${w}
|
|
456
|
-
@baht-input=${
|
|
457
|
+
@baht-input=${v}
|
|
457
458
|
></${d}>`;
|
|
458
459
|
const k = this.fieldMessages[t.key];
|
|
459
460
|
return y`<div
|
|
@@ -528,7 +529,8 @@ let h = class extends _ {
|
|
|
528
529
|
const i = this.dynamicOptions.optionsFor(t), o = U(
|
|
529
530
|
this.dynamicOptions.withOptions(t),
|
|
530
531
|
this.valueFor(t),
|
|
531
|
-
i
|
|
532
|
+
i,
|
|
533
|
+
this.registry
|
|
532
534
|
);
|
|
533
535
|
return Y(
|
|
534
536
|
{
|
|
@@ -619,7 +621,7 @@ l([
|
|
|
619
621
|
I()
|
|
620
622
|
], h.prototype, "folded", 2);
|
|
621
623
|
h = l([
|
|
622
|
-
|
|
624
|
+
H("baht-form")
|
|
623
625
|
], h);
|
|
624
626
|
function tt(t, e) {
|
|
625
627
|
const s = Object.keys(t);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { nothing as
|
|
1
|
+
import { nothing as d, html as h } from "lit";
|
|
2
2
|
import { property as u, state as b } from "lit/decorators.js";
|
|
3
3
|
import { keyed as v } from "lit/directives/keyed.js";
|
|
4
4
|
import { BahtFieldBase as w } from "./field-base.js";
|
|
5
5
|
import { boolOff as f, BahtElement as g, obj as y, hasDom as k, stringOf as $ } from "./base.js";
|
|
6
|
-
import { applyFlags as _, updateWorkflow as C, sameData as p, t as
|
|
6
|
+
import { applyFlags as _, updateWorkflow as C, sameData as p, t as m, visibleForms as x, nextTarget as F, snapshotOf as S } from "@20baht/engine";
|
|
7
7
|
import "./baht-form.js";
|
|
8
8
|
import "./primitives/baht-steps.js";
|
|
9
9
|
import { customElement as E } from "./define.js";
|
|
@@ -61,9 +61,7 @@ let a = class extends g {
|
|
|
61
61
|
`[bahtui] workflow "${this.workflow.workflow_id}" rules: ` + t.detail.errors.map((e) => `${e.ref}: ${e.message}`).join("; ")
|
|
62
62
|
), t.name === "baht-nav-blocked") {
|
|
63
63
|
const { form_name: e, target: r, reason: i } = t.detail;
|
|
64
|
-
console.warn(
|
|
65
|
-
`[bahtui] cannot advance from "${e}": target "${r}" is ` + (i === "self-transition" ? "the current form (self-transition)" : "not visible")
|
|
66
|
-
);
|
|
64
|
+
console.warn(`[bahtui] cannot advance from "${e}": ${O(r, i)}`);
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
willUpdate(t) {
|
|
@@ -84,7 +82,7 @@ let a = class extends g {
|
|
|
84
82
|
/** Why the last decision was refused, in the current locale. */
|
|
85
83
|
get approvalError() {
|
|
86
84
|
var t;
|
|
87
|
-
return (t = this.run) != null && t.approvalError ?
|
|
85
|
+
return (t = this.run) != null && t.approvalError ? m(this.run.approvalError) : null;
|
|
88
86
|
}
|
|
89
87
|
/** The run's data: `{ form_name: { key: value } }`, as the rules left it. */
|
|
90
88
|
get data() {
|
|
@@ -117,7 +115,7 @@ let a = class extends g {
|
|
|
117
115
|
for (const [n, c] of Object.entries(r.fields))
|
|
118
116
|
n.startsWith(i) && (e[n.slice(i.length)] = c);
|
|
119
117
|
const s = this.statesSeen.get(t);
|
|
120
|
-
return s &&
|
|
118
|
+
return s && W(s, e) ? s : (this.statesSeen.set(t, e), e);
|
|
121
119
|
}
|
|
122
120
|
/** The step's own editable form: a data step's, or an approval step's fields (never the summary). */
|
|
123
121
|
get formEl() {
|
|
@@ -248,7 +246,7 @@ let a = class extends g {
|
|
|
248
246
|
const e = ((i = t.approval) == null ? void 0 : i.comment) ?? "optional", r = this.summary_forms(t);
|
|
249
247
|
return h`<div class="baht-approval">
|
|
250
248
|
<div class="baht-approval-summary">
|
|
251
|
-
${r.length === 0 ? h`<p class="baht-approval-empty">${
|
|
249
|
+
${r.length === 0 ? h`<p class="baht-approval-empty">${m("nothingToReview")}</p>` : r.map(
|
|
252
250
|
(n) => h`<section class="baht-approval-group">
|
|
253
251
|
<h4 class="baht-approval-group-title">${n.form_name}</h4>
|
|
254
252
|
<baht-form
|
|
@@ -260,15 +258,15 @@ let a = class extends g {
|
|
|
260
258
|
</section>`
|
|
261
259
|
)}
|
|
262
260
|
</div>
|
|
263
|
-
${t.fields.length > 0 ? this.renderStepForm(t) :
|
|
261
|
+
${t.fields.length > 0 ? this.renderStepForm(t) : d}
|
|
264
262
|
${e !== "hidden" ? h`<label class="baht-approval-comment">
|
|
265
263
|
<span class="baht-approval-comment-label">
|
|
266
|
-
${
|
|
264
|
+
${m("comment")}${e === "required" ? m("commentRequiredSuffix") : ""}
|
|
267
265
|
</span>
|
|
268
266
|
<textarea
|
|
269
267
|
rows="3"
|
|
270
|
-
aria-required=${e === "required" ? "true" :
|
|
271
|
-
aria-invalid=${this.approvalError ? "true" :
|
|
268
|
+
aria-required=${e === "required" ? "true" : d}
|
|
269
|
+
aria-invalid=${this.approvalError ? "true" : d}
|
|
272
270
|
.value=${((s = this.pendingComment) == null ? void 0 : s.form_name) === t.form_name ? this.pendingComment.value : $((o = this.data[t.form_name]) == null ? void 0 : o.comment)}
|
|
273
271
|
@focusout=${() => {
|
|
274
272
|
this.flushComment();
|
|
@@ -277,8 +275,8 @@ let a = class extends g {
|
|
|
277
275
|
this.onCommentInput(t.form_name, n.target.value);
|
|
278
276
|
}}
|
|
279
277
|
></textarea>
|
|
280
|
-
</label>` :
|
|
281
|
-
${this.approvalError ? h`<p class="baht-error" role="alert">${this.approvalError}</p>` :
|
|
278
|
+
</label>` : d}
|
|
279
|
+
${this.approvalError ? h`<p class="baht-error" role="alert">${this.approvalError}</p>` : d}
|
|
282
280
|
</div>`;
|
|
283
281
|
}
|
|
284
282
|
/**
|
|
@@ -313,14 +311,14 @@ let a = class extends g {
|
|
|
313
311
|
data-step=${t.form_name}
|
|
314
312
|
data-testid="${this.workflow.workflow_id}.${t.form_name}"
|
|
315
313
|
>
|
|
316
|
-
${this.chrome === "none" ?
|
|
317
|
-
${
|
|
314
|
+
${this.chrome === "none" ? d : h`<div class="baht-visually-hidden" role="status">
|
|
315
|
+
${m("step", { current: i + 1, total: r.length })}
|
|
318
316
|
</div>`}
|
|
319
317
|
${this.showSteps ? h`<baht-steps
|
|
320
318
|
.steps=${r.map((s) => s.form_name)}
|
|
321
319
|
.current=${i}
|
|
322
320
|
.variant=${this.stepsVariant}
|
|
323
|
-
></baht-steps>` :
|
|
321
|
+
></baht-steps>` : d}
|
|
324
322
|
${v(
|
|
325
323
|
t.form_name,
|
|
326
324
|
h`<div
|
|
@@ -329,13 +327,13 @@ let a = class extends g {
|
|
|
329
327
|
${e ? this.renderApproval(t) : this.renderStepForm(t)}
|
|
330
328
|
</div>`
|
|
331
329
|
)}
|
|
332
|
-
${this.chrome === "none" ?
|
|
330
|
+
${this.chrome === "none" ? d : this.renderNav(t)}
|
|
333
331
|
</div>`;
|
|
334
332
|
}
|
|
335
333
|
/** Back + Next/Submit (or Reject/Approve on an approval step). */
|
|
336
334
|
renderNav(t) {
|
|
337
335
|
var r;
|
|
338
|
-
const e = this.busy ? "true" :
|
|
336
|
+
const e = this.busy ? "true" : d;
|
|
339
337
|
return h`<div class="baht-workflow-nav">
|
|
340
338
|
${this.showBack && (((r = this.run) == null ? void 0 : r.history.length) ?? 0) > 0 ? h`<button type="button" class="baht-button baht-button--back"
|
|
341
339
|
aria-disabled=${e}
|
|
@@ -344,14 +342,14 @@ let a = class extends g {
|
|
|
344
342
|
this.back();
|
|
345
343
|
}}
|
|
346
344
|
>
|
|
347
|
-
${this.backLabel ??
|
|
348
|
-
</button>` :
|
|
345
|
+
${this.backLabel ?? m("back")}
|
|
346
|
+
</button>` : d}
|
|
349
347
|
${t.kind === "approval" ? this.renderDecision(t) : this.renderNext()}
|
|
350
348
|
</div>`;
|
|
351
349
|
}
|
|
352
350
|
renderDecision(t) {
|
|
353
351
|
var r, i;
|
|
354
|
-
const e = this.busy ? "true" :
|
|
352
|
+
const e = this.busy ? "true" : d;
|
|
355
353
|
return h`<button
|
|
356
354
|
type="button"
|
|
357
355
|
class="baht-button baht-button--reject"
|
|
@@ -361,7 +359,7 @@ let a = class extends g {
|
|
|
361
359
|
this.decide("rejected");
|
|
362
360
|
}}
|
|
363
361
|
>
|
|
364
|
-
${((r = t.approval) == null ? void 0 : r.reject_label) ??
|
|
362
|
+
${((r = t.approval) == null ? void 0 : r.reject_label) ?? m("reject")}
|
|
365
363
|
</button>
|
|
366
364
|
<button
|
|
367
365
|
type="button"
|
|
@@ -373,11 +371,11 @@ let a = class extends g {
|
|
|
373
371
|
this.decide("approved");
|
|
374
372
|
}}
|
|
375
373
|
>
|
|
376
|
-
${((i = t.approval) == null ? void 0 : i.approve_label) ??
|
|
374
|
+
${((i = t.approval) == null ? void 0 : i.approve_label) ?? m("approve")}
|
|
377
375
|
</button>`;
|
|
378
376
|
}
|
|
379
377
|
renderNext() {
|
|
380
|
-
const t = this.busy ? "true" :
|
|
378
|
+
const t = this.busy ? "true" : d;
|
|
381
379
|
return h`<button
|
|
382
380
|
type="button"
|
|
383
381
|
class="baht-button baht-button--next"
|
|
@@ -388,7 +386,7 @@ let a = class extends g {
|
|
|
388
386
|
this.next();
|
|
389
387
|
}}
|
|
390
388
|
>
|
|
391
|
-
${this.isLast ? this.submitLabel ??
|
|
389
|
+
${this.isLast ? this.submitLabel ?? m("submit") : this.nextLabel ?? m("next")}
|
|
392
390
|
</button>`;
|
|
393
391
|
}
|
|
394
392
|
};
|
|
@@ -444,6 +442,9 @@ a = l([
|
|
|
444
442
|
E("baht-workflow")
|
|
445
443
|
], a);
|
|
446
444
|
function O(t, e) {
|
|
445
|
+
return e === "rule-error" ? "the rules never settled, so the data is not submitted" : e === "self-transition" ? `target "${t}" is the current form (self-transition)` : `target "${t}" is not visible`;
|
|
446
|
+
}
|
|
447
|
+
function W(t, e) {
|
|
447
448
|
const r = Object.keys(t);
|
|
448
449
|
return r.length === Object.keys(e).length && r.every((i) => {
|
|
449
450
|
const s = t[i], o = e[i];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TemplateResult } from 'lit';
|
|
2
2
|
import { BahtFieldBase } from '../field-base.js';
|
|
3
|
-
import { DerivedFieldState, FieldDescriptor, ValidationError } from '@20baht/engine';
|
|
3
|
+
import { DerivedFieldState, FieldDescriptor, Registry, ValidationError } from '@20baht/engine';
|
|
4
4
|
import { FieldReferenceLookup } from './baht-reference-picker.js';
|
|
5
5
|
/** The lookup of a `reference` column; `row` reads the row it is in when asked. */
|
|
6
6
|
export type RowLookup = (sub: FieldDescriptor, row: () => Record<string, unknown>) => FieldReferenceLookup | null;
|
|
@@ -20,6 +20,12 @@ export declare class BahtRepeater extends BahtFieldBase {
|
|
|
20
20
|
rowStates: Record<string, DerivedFieldState>;
|
|
21
21
|
/** Set by the host form: what makes a `reference` column searchable. */
|
|
22
22
|
rowLookup: RowLookup | null;
|
|
23
|
+
/**
|
|
24
|
+
* Set by the host form: its registry. A column of a type of the app's own (spec 01 §5.1)
|
|
25
|
+
* renders, reads and checks through `registry.fieldTypes`; the row dialog runs the column's
|
|
26
|
+
* `custom` validators from it.
|
|
27
|
+
*/
|
|
28
|
+
registry: Registry;
|
|
23
29
|
private draft;
|
|
24
30
|
private readonly labels;
|
|
25
31
|
private get rows();
|