mlform 0.1.11 → 0.1.13
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 +2 -2
- package/dist/{builtins-D8rXH4ED.js → builtins-yzeQlyRt.js} +3 -7
- package/dist/mlform/builtins.mjs +1 -1
- package/dist/mlform/kit.mjs +2 -2
- package/dist/mlform/primitives.mjs +1 -1
- package/dist/{primitives-k9HTnd72.js → primitives-bjfDE5G2.js} +66 -53
- package/dist/types/builtins/constants.d.ts +0 -1
- package/dist/types/builtins/definitions/collections.d.ts +1 -1
- package/dist/types/builtins/definitions/fields/boolean.d.ts +1 -1
- package/dist/types/primitives/components/field-frame.d.ts +2 -1
- package/dist/types/primitives/components/form-root-templates.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Schema-driven forms for machine learning applications.
|
|
|
9
9
|
|
|
10
10
|
MLForm gives you a predictable UI layer between users and model backends. You describe inputs and reports with a schema, MLForm renders accessible Web Components, validates values, submits structured payloads, and displays model results in the same host container.
|
|
11
11
|
|
|
12
|
-
Version `0.1.
|
|
12
|
+
Version `0.1.13` is the current release in this repository.
|
|
13
13
|
|
|
14
14
|
## Why MLForm
|
|
15
15
|
|
|
@@ -306,7 +306,7 @@ The main package targets Node.js `>=24.9.0`.
|
|
|
306
306
|
|
|
307
307
|
## Release Notes
|
|
308
308
|
|
|
309
|
-
For `0.1.
|
|
309
|
+
For `0.1.13`, use the repository release entry and the published docs as the source of truth:
|
|
310
310
|
|
|
311
311
|
- GitHub releases: https://github.com/UlloaSP/mlform/releases
|
|
312
312
|
- npm package: https://www.npmjs.com/package/mlform
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as e, s as t } from "./schema-DSAZ6bts.js";
|
|
2
|
-
import { s as n } from "./primitives-
|
|
2
|
+
import { s as n } from "./primitives-bjfDE5G2.js";
|
|
3
3
|
import * as r from "zod";
|
|
4
4
|
//#region src/builtins/constants.ts
|
|
5
5
|
var i = {
|
|
@@ -28,7 +28,6 @@ var i = {
|
|
|
28
28
|
}, l = {
|
|
29
29
|
invalidNumber: "Value must be a valid number.",
|
|
30
30
|
textPatternMismatch: "Value does not match the expected pattern.",
|
|
31
|
-
booleanRequired: "This field must be accepted.",
|
|
32
31
|
categoryOptionMismatch: "Value must match one of the available options.",
|
|
33
32
|
invalidTextLengthRange: "Minimum length cannot exceed maximum length.",
|
|
34
33
|
invalidNumericRange: "Minimum value cannot exceed maximum value.",
|
|
@@ -162,13 +161,10 @@ var i = {
|
|
|
162
161
|
falseLabel: r.string().optional()
|
|
163
162
|
}),
|
|
164
163
|
getDefaultValue(e) {
|
|
165
|
-
return typeof e.defaultValue == "boolean" ? e.defaultValue :
|
|
164
|
+
return typeof e.defaultValue == "boolean" ? e.defaultValue : null;
|
|
166
165
|
},
|
|
167
166
|
normalizeValue(e) {
|
|
168
|
-
return !!e;
|
|
169
|
-
},
|
|
170
|
-
validate(e, t) {
|
|
171
|
-
return t.required && e !== !0 ? [l.booleanRequired] : [];
|
|
167
|
+
return e == null || e === "" ? null : e === !0 || e === "true" ? !0 : e === !1 || e === "false" ? !1 : !!e;
|
|
172
168
|
},
|
|
173
169
|
describe(e, t) {
|
|
174
170
|
return y("boolean-field", e, {
|
package/dist/mlform/builtins.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "../builtins-
|
|
1
|
+
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "../builtins-yzeQlyRt.js";
|
|
2
2
|
export { s as booleanFieldDefinition, t as builtinFieldKinds, y as builtinLegacyOutputTypes, x as builtinReportFallbacks, r as builtinReportKinds, b as builtinReportLabels, e as builtinValidationMessages, c as categoryFieldDefinition, n as classifierReportDefinition, _ as createBuiltinMlRegistry, h as createMappedCategoryBehavior, f as createMlRegistryPack, m as dateFieldDefinition, o as longTextFieldDefinition, d as mappedCategoryFieldDefinition, a as multiChoiceFieldDefinition, v as numberFieldDefinition, u as ratingFieldDefinition, l as regressorReportDefinition, g as seriesFieldDefinition, p as singleChoiceFieldDefinition, i as textFieldDefinition };
|
package/dist/mlform/kit.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "../runtime-CI7vlp9i.js";
|
|
2
2
|
import { i as t, s as n } from "../schema-DSAZ6bts.js";
|
|
3
|
-
import { n as r } from "../builtins-
|
|
4
|
-
import { _ as i, a, h as o, l as s, m as c, p as l, r as u, t as d } from "../primitives-
|
|
3
|
+
import { n as r } from "../builtins-yzeQlyRt.js";
|
|
4
|
+
import { _ as i, a, h as o, l as s, m as c, p as l, r as u, t as d } from "../primitives-bjfDE5G2.js";
|
|
5
5
|
import { d as f, h as p, r as m } from "../design-6suKVQDo.js";
|
|
6
6
|
import { LitElement as h, css as g, html as _, nothing as v } from "lit";
|
|
7
7
|
import { customElement as y, property as b, state as x } from "lit/decorators.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, r as f, s as p, t as m, u as h } from "../primitives-
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, r as f, s as p, t as m, u as h } from "../primitives-bjfDE5G2.js";
|
|
2
2
|
export { h as PrimitiveAsyncReportElement, d as PrimitiveDescriptorRegistry, i as PrimitiveFieldElement, n as PrimitiveFormElement, r as PrimitiveReportElement, f as createBuiltinPrimitiveRegistry, p as createPrimitiveDescriptorRegistry, s as createPrimitiveRegistry, c as focusPrimitiveField, m as mountForm, l as primitiveDefaultLabels, o as primitiveStaticText, a as primitiveTagNames, e as resolvePrimitiveText, t as toDescriptorNodes, u as unmountForm };
|
|
@@ -842,11 +842,11 @@ var re = () => new Promise((e) => {
|
|
|
842
842
|
`, ce = (e) => ({
|
|
843
843
|
component: "unsupported-field",
|
|
844
844
|
props: { label: e.config.label ?? e.id }
|
|
845
|
-
}),
|
|
845
|
+
}), w = (e, t) => t?.getField(e.kind)?.describe(e.config, {
|
|
846
846
|
fieldId: e.id,
|
|
847
847
|
state: e.state,
|
|
848
848
|
value: e.state.value
|
|
849
|
-
}) ?? ce(e),
|
|
849
|
+
}) ?? ce(e), le = (e, t, n) => {
|
|
850
850
|
let r = n?.getReport(e.kind);
|
|
851
851
|
return r ? r.describe(e.config, {
|
|
852
852
|
reportId: e.id,
|
|
@@ -854,25 +854,26 @@ var re = () => new Promise((e) => {
|
|
|
854
854
|
payload: e.state.payload,
|
|
855
855
|
result: t.state.lastResult
|
|
856
856
|
}) : null;
|
|
857
|
-
},
|
|
857
|
+
}, ue = (e, t, n) => t.map((t) => e.getField(t)).filter((e) => e !== void 0).map((e) => ({
|
|
858
858
|
controller: e,
|
|
859
|
-
descriptor:
|
|
860
|
-
})),
|
|
859
|
+
descriptor: w(e, n)
|
|
860
|
+
})), de = (e, t, n, r) => (n === "always" ? e.reports : t.map((t) => e.getReport(t)).filter((e) => e !== void 0)).map((t) => ({
|
|
861
861
|
controller: t,
|
|
862
|
-
descriptor:
|
|
863
|
-
})).filter((e) => e.descriptor !== null),
|
|
862
|
+
descriptor: le(t, e, r)
|
|
863
|
+
})).filter((e) => e.descriptor !== null), fe = (e, t, r, i) => n`
|
|
864
864
|
<div class="collection" part="field-list">
|
|
865
865
|
${s(e, (e) => e.controller.id, (e) => n`
|
|
866
866
|
<mlf-field-frame
|
|
867
867
|
data-field-id=${e.controller.id}
|
|
868
868
|
.controller=${e.controller}
|
|
869
869
|
.descriptor=${e.descriptor}
|
|
870
|
+
.descriptorRegistry=${r}
|
|
870
871
|
.registry=${t}
|
|
871
|
-
.text=${
|
|
872
|
+
.text=${i}
|
|
872
873
|
></mlf-field-frame>
|
|
873
874
|
`)}
|
|
874
875
|
</div>
|
|
875
|
-
`,
|
|
876
|
+
`, pe = (e, t, r, i, a) => n`
|
|
876
877
|
<div class="collection" part="report-list">
|
|
877
878
|
${s(e, (e) => e.controller.id, (e) => n`
|
|
878
879
|
<mlf-report-frame
|
|
@@ -904,7 +905,7 @@ var re = () => new Promise((e) => {
|
|
|
904
905
|
</div>
|
|
905
906
|
|
|
906
907
|
<mlf-form-errors .form=${e.form} .text=${e.text}></mlf-form-errors>
|
|
907
|
-
${
|
|
908
|
+
${fe(e.visibleFields, e.registry, e.descriptorRegistry, e.text)}
|
|
908
909
|
</div>
|
|
909
910
|
|
|
910
911
|
<div class="actions" part="actions">
|
|
@@ -933,7 +934,7 @@ var re = () => new Promise((e) => {
|
|
|
933
934
|
</header>
|
|
934
935
|
|
|
935
936
|
<div class="pane-body">
|
|
936
|
-
${
|
|
937
|
+
${pe(e.reportsToRender, e.registry, e.text, e.reportTransport, e.form.state.lastResult ?? null)}
|
|
937
938
|
</div>
|
|
938
939
|
</aside>
|
|
939
940
|
` : r}
|
|
@@ -956,7 +957,7 @@ var re = () => new Promise((e) => {
|
|
|
956
957
|
</div>
|
|
957
958
|
|
|
958
959
|
<mlf-form-errors .form=${e.form} .text=${e.text}></mlf-form-errors>
|
|
959
|
-
${
|
|
960
|
+
${fe(e.visibleFields, e.registry, e.descriptorRegistry, e.text)}
|
|
960
961
|
</div>
|
|
961
962
|
</div>
|
|
962
963
|
|
|
@@ -984,7 +985,7 @@ var re = () => new Promise((e) => {
|
|
|
984
985
|
</header>
|
|
985
986
|
|
|
986
987
|
<div class="split-content">
|
|
987
|
-
${e.reportsToRender.length > 0 ?
|
|
988
|
+
${e.reportsToRender.length > 0 ? pe(e.reportsToRender, e.registry, e.text, e.reportTransport, e.form.state.lastResult ?? null) : n`
|
|
988
989
|
<div class="empty-report-state">
|
|
989
990
|
<p class="empty-report-title">${e.text.reportsEmptyTitle}</p>
|
|
990
991
|
<p class="empty-report-copy">${e.text.reportsEmptyBody}</p>
|
|
@@ -1118,7 +1119,7 @@ var re = () => new Promise((e) => {
|
|
|
1118
1119
|
render() {
|
|
1119
1120
|
let e = this.form, t = this.formState;
|
|
1120
1121
|
if (!e || !t) return n``;
|
|
1121
|
-
let r = this.text, i =
|
|
1122
|
+
let r = this.text, i = ue(e, t.visibleFieldIds, this.descriptorRegistry), a = de(e, t.visibleReportIds, this.reportPane, this.descriptorRegistry), o = this.reportPane !== "hidden" && (e.reports.length > 0 || t.hasFormErrors), s = this.layout === "split" ? o : this.reportPane === "always" ? e.reports.length > 0 : this.reportPane === "auto" ? a.length > 0 : !1;
|
|
1122
1123
|
return this.layout === "split" ? he({
|
|
1123
1124
|
form: e,
|
|
1124
1125
|
state: t,
|
|
@@ -1126,6 +1127,7 @@ var re = () => new Promise((e) => {
|
|
|
1126
1127
|
reportsToRender: a,
|
|
1127
1128
|
showReports: s,
|
|
1128
1129
|
registry: this.registry,
|
|
1130
|
+
descriptorRegistry: this.descriptorRegistry,
|
|
1129
1131
|
text: r,
|
|
1130
1132
|
formLabel: this.formLabel,
|
|
1131
1133
|
reportsLabel: this.reportsLabel,
|
|
@@ -1141,6 +1143,7 @@ var re = () => new Promise((e) => {
|
|
|
1141
1143
|
reportsToRender: a,
|
|
1142
1144
|
showReports: s,
|
|
1143
1145
|
registry: this.registry,
|
|
1146
|
+
descriptorRegistry: this.descriptorRegistry,
|
|
1144
1147
|
text: r,
|
|
1145
1148
|
formLabel: this.formLabel,
|
|
1146
1149
|
reportsLabel: this.reportsLabel,
|
|
@@ -1732,62 +1735,69 @@ var N = class {
|
|
|
1732
1735
|
this.#t = e;
|
|
1733
1736
|
}
|
|
1734
1737
|
#n;
|
|
1735
|
-
get
|
|
1738
|
+
get descriptorRegistry() {
|
|
1736
1739
|
return this.#n;
|
|
1737
1740
|
}
|
|
1738
|
-
set
|
|
1741
|
+
set descriptorRegistry(e) {
|
|
1739
1742
|
this.#n = e;
|
|
1740
1743
|
}
|
|
1741
|
-
#r
|
|
1742
|
-
get
|
|
1744
|
+
#r;
|
|
1745
|
+
get registry() {
|
|
1743
1746
|
return this.#r;
|
|
1744
1747
|
}
|
|
1745
|
-
set
|
|
1748
|
+
set registry(e) {
|
|
1746
1749
|
this.#r = e;
|
|
1747
1750
|
}
|
|
1748
|
-
#i =
|
|
1749
|
-
get
|
|
1751
|
+
#i = m;
|
|
1752
|
+
get text() {
|
|
1750
1753
|
return this.#i;
|
|
1751
1754
|
}
|
|
1752
|
-
set
|
|
1755
|
+
set text(e) {
|
|
1753
1756
|
this.#i = e;
|
|
1754
1757
|
}
|
|
1755
1758
|
#a = null;
|
|
1756
|
-
get
|
|
1759
|
+
get resolvedDescriptor() {
|
|
1757
1760
|
return this.#a;
|
|
1758
1761
|
}
|
|
1759
|
-
set
|
|
1762
|
+
set resolvedDescriptor(e) {
|
|
1760
1763
|
this.#a = e;
|
|
1761
1764
|
}
|
|
1762
1765
|
#o = null;
|
|
1763
|
-
get
|
|
1766
|
+
get fieldState() {
|
|
1764
1767
|
return this.#o;
|
|
1765
1768
|
}
|
|
1766
|
-
set
|
|
1769
|
+
set fieldState(e) {
|
|
1767
1770
|
this.#o = e;
|
|
1768
1771
|
}
|
|
1769
|
-
#s =
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
+
#s = null;
|
|
1773
|
+
get descriptionVisibilityOverride() {
|
|
1774
|
+
return this.#s;
|
|
1775
|
+
}
|
|
1776
|
+
set descriptionVisibilityOverride(e) {
|
|
1777
|
+
this.#s = e;
|
|
1778
|
+
}
|
|
1779
|
+
#c = ++we;
|
|
1780
|
+
#l;
|
|
1772
1781
|
#u = null;
|
|
1773
|
-
#d =
|
|
1782
|
+
#d = null;
|
|
1774
1783
|
#f = "";
|
|
1775
|
-
#p =
|
|
1776
|
-
|
|
1784
|
+
#p = "";
|
|
1785
|
+
#m = new N(this, (e) => {
|
|
1786
|
+
this.resolvedDescriptor = this.#g(e), this.fieldState = e?.state ?? null, this.resolvedDescriptor?.props.description || (this.descriptionVisibilityOverride = null);
|
|
1777
1787
|
});
|
|
1778
1788
|
willUpdate(e) {
|
|
1779
|
-
e.has("controller") && this.#
|
|
1789
|
+
e.has("controller") && this.#m.bind(this.controller), (e.has("controller") || e.has("descriptor") || e.has("descriptorRegistry")) && (this.resolvedDescriptor = this.#g(this.controller)), e.has("descriptor") && !this.resolvedDescriptor?.props.description && (this.descriptionVisibilityOverride = null);
|
|
1780
1790
|
}
|
|
1781
1791
|
render() {
|
|
1782
1792
|
let e = this.resolvedDescriptor, t = this.fieldState;
|
|
1783
1793
|
if (!e || !t || !t.visible) return c``;
|
|
1784
|
-
let n = e.props, r = this.registry?.resolveField(e.component), i = F(n.label, this.controller?.config.label ?? ""), a = F(n.description), o = this.#
|
|
1794
|
+
let n = e.props, r = this.registry?.resolveField(e.component), i = F(n.label, this.controller?.config.label ?? ""), a = F(n.description), o = this.#b(a), s = Se(e.component, n, t, this.controller?.config.defaultValue), l = ye(t.errors), u = Ce(e.component, n, t, this.text), d = l.length > 0 && (t.touched || s), f = d ? {
|
|
1785
1795
|
tone: "error",
|
|
1786
1796
|
message: l
|
|
1787
1797
|
} : s && t.valid ? {
|
|
1788
1798
|
tone: "success",
|
|
1789
1799
|
message: u
|
|
1790
|
-
} : null, p = d ? "error" : s && t.valid ? "success" : "", m = `${g.fieldControl}-${this.controller?.id}-${this.#
|
|
1800
|
+
} : null, p = d ? "error" : s && t.valid ? "success" : "", m = `${g.fieldControl}-${this.controller?.id}-${this.#c}`, h = `${g.fieldErrors}-${this.controller?.id}-${this.#c}`, _ = `${g.fieldDescription}-${this.controller?.id}-${this.#c}-details`;
|
|
1791
1801
|
return c`
|
|
1792
1802
|
<section
|
|
1793
1803
|
class="tile ${p}"
|
|
@@ -1803,7 +1813,7 @@ var N = class {
|
|
|
1803
1813
|
aria-expanded=${String(o)}
|
|
1804
1814
|
aria-controls=${_}
|
|
1805
1815
|
?disabled=${a.length === 0}
|
|
1806
|
-
@click=${this.#
|
|
1816
|
+
@click=${this.#y}
|
|
1807
1817
|
>
|
|
1808
1818
|
${this.text.helpActionGlyph}
|
|
1809
1819
|
</button>
|
|
@@ -1816,7 +1826,7 @@ var N = class {
|
|
|
1816
1826
|
` : c``}
|
|
1817
1827
|
|
|
1818
1828
|
<div class="control-slot">
|
|
1819
|
-
${r ? this.#
|
|
1829
|
+
${r ? this.#h(r, m, h) : c`
|
|
1820
1830
|
<mlf-unsupported-component
|
|
1821
1831
|
role="field"
|
|
1822
1832
|
component=${e.component}
|
|
@@ -1837,8 +1847,8 @@ var N = class {
|
|
|
1837
1847
|
</section>
|
|
1838
1848
|
`;
|
|
1839
1849
|
}
|
|
1840
|
-
#
|
|
1841
|
-
let r = l(e), i = this.#
|
|
1850
|
+
#h(e, t, n) {
|
|
1851
|
+
let r = l(e), i = this.#_(t, n), a = this.resolvedDescriptor;
|
|
1842
1852
|
return c`
|
|
1843
1853
|
<${r}
|
|
1844
1854
|
.controller=${this.controller}
|
|
@@ -1848,14 +1858,17 @@ var N = class {
|
|
|
1848
1858
|
></${r}>
|
|
1849
1859
|
`;
|
|
1850
1860
|
}
|
|
1851
|
-
#
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1861
|
+
#g(e) {
|
|
1862
|
+
return e && this.descriptorRegistry ? w(e, this.descriptorRegistry) : this.descriptor;
|
|
1863
|
+
}
|
|
1864
|
+
#_(e, t) {
|
|
1865
|
+
if (this.resolvedDescriptor === this.#u && this.fieldState === this.#d && e === this.#f && t === this.#p) return this.#l;
|
|
1866
|
+
let n = this.#v(this.resolvedDescriptor?.props ?? {}, this.fieldState, e, t);
|
|
1867
|
+
return this.#u = this.resolvedDescriptor, this.#d = this.fieldState, this.#f = e, this.#p = t, this.#l = n, n;
|
|
1855
1868
|
}
|
|
1856
|
-
#
|
|
1869
|
+
#v(e, t, n, r) {
|
|
1857
1870
|
if (!this.controller || !t) return;
|
|
1858
|
-
let i = typeof e.description == "string" && e.description.length > 0 ? e.description : void 0, a = i ? `${g.fieldDescription}-${this.controller.id}-${this.#
|
|
1871
|
+
let i = typeof e.description == "string" && e.description.length > 0 ? e.description : void 0, a = i ? `${g.fieldDescription}-${this.controller.id}-${this.#c}` : void 0, o = [a, r].filter(Boolean).join(" ") || void 0;
|
|
1859
1872
|
return {
|
|
1860
1873
|
controlId: n,
|
|
1861
1874
|
label: F(e.label, this.controller.config.label),
|
|
@@ -1870,14 +1883,14 @@ var N = class {
|
|
|
1870
1883
|
readOnly: t.readOnly
|
|
1871
1884
|
};
|
|
1872
1885
|
}
|
|
1873
|
-
#
|
|
1874
|
-
this.resolvedDescriptor?.props.description && (this.descriptionVisibilityOverride = !this.#
|
|
1886
|
+
#y = () => {
|
|
1887
|
+
this.resolvedDescriptor?.props.description && (this.descriptionVisibilityOverride = !this.#b(F(this.resolvedDescriptor.props.description)));
|
|
1875
1888
|
};
|
|
1876
|
-
#
|
|
1889
|
+
#b(e) {
|
|
1877
1890
|
return e.length === 0 ? !1 : this.descriptionVisibilityOverride ?? this.resolvedDescriptor?.props.showDescriptionInline === !0;
|
|
1878
1891
|
}
|
|
1879
1892
|
};
|
|
1880
|
-
_([a({ attribute: !1 })], R.prototype, "controller", null), _([a({ attribute: !1 })], R.prototype, "descriptor", null), _([a({ attribute: !1 })], R.prototype, "registry", null), _([a({ attribute: !1 })], R.prototype, "text", null), _([o()], R.prototype, "resolvedDescriptor", null), _([o()], R.prototype, "fieldState", null), _([o()], R.prototype, "descriptionVisibilityOverride", null), R = _([i(d.fieldFrame)], R);
|
|
1893
|
+
_([a({ attribute: !1 })], R.prototype, "controller", null), _([a({ attribute: !1 })], R.prototype, "descriptor", null), _([a({ attribute: !1 })], R.prototype, "descriptorRegistry", null), _([a({ attribute: !1 })], R.prototype, "registry", null), _([a({ attribute: !1 })], R.prototype, "text", null), _([o()], R.prototype, "resolvedDescriptor", null), _([o()], R.prototype, "fieldState", null), _([o()], R.prototype, "descriptionVisibilityOverride", null), R = _([i(d.fieldFrame)], R);
|
|
1881
1894
|
//#endregion
|
|
1882
1895
|
//#region src/primitives/controller-types.ts
|
|
1883
1896
|
var Te = (e, t = {}) => ({
|
|
@@ -2146,7 +2159,7 @@ var B = {
|
|
|
2146
2159
|
}
|
|
2147
2160
|
#t(e) {
|
|
2148
2161
|
let t = { ...this.props };
|
|
2149
|
-
return delete t.widget, e === "boolean" && (t.checked = t.value === !0), t;
|
|
2162
|
+
return delete t.widget, e === "boolean" && (t.checked = t.value === !0 ? !0 : t.value === !1 ? !1 : null), t;
|
|
2150
2163
|
}
|
|
2151
2164
|
};
|
|
2152
2165
|
V = _([i(d.declarativeField)], V);
|
|
@@ -2769,7 +2782,7 @@ var q = class extends v {
|
|
|
2769
2782
|
}
|
|
2770
2783
|
`];
|
|
2771
2784
|
render() {
|
|
2772
|
-
let e = this.props, t = this.fieldContext, r = e.checked === !0, i = this.text, a = g.booleanGroup, o = `${t?.controlId ?? a}-true`, s = `${t?.controlId ?? a}-false`, c = F(e.trueLabel, i.booleanTrue), l = F(e.falseLabel, i.booleanFalse), d = !!(this.fieldContext?.disabled || this.fieldContext?.readOnly);
|
|
2785
|
+
let e = this.props, t = this.fieldContext, r = e.checked === !0 ? !0 : e.checked === !1 ? !1 : null, i = this.text, a = g.booleanGroup, o = `${t?.controlId ?? a}-true`, s = `${t?.controlId ?? a}-false`, c = F(e.trueLabel, i.booleanTrue), l = F(e.falseLabel, i.booleanFalse), d = !!(this.fieldContext?.disabled || this.fieldContext?.readOnly);
|
|
2773
2786
|
return n`
|
|
2774
2787
|
<fieldset
|
|
2775
2788
|
role="radiogroup"
|
|
@@ -2783,7 +2796,7 @@ var q = class extends v {
|
|
|
2783
2796
|
id=${o}
|
|
2784
2797
|
name=${t?.controlId ?? a}
|
|
2785
2798
|
value="true"
|
|
2786
|
-
.checked=${r}
|
|
2799
|
+
.checked=${r === !0}
|
|
2787
2800
|
?disabled=${d}
|
|
2788
2801
|
@change=${this.#e}
|
|
2789
2802
|
@blur=${this.#t}
|
|
@@ -2795,7 +2808,7 @@ var q = class extends v {
|
|
|
2795
2808
|
id=${s}
|
|
2796
2809
|
name=${t?.controlId ?? a}
|
|
2797
2810
|
value="false"
|
|
2798
|
-
.checked=${!
|
|
2811
|
+
.checked=${r === !1}
|
|
2799
2812
|
?disabled=${d}
|
|
2800
2813
|
@change=${this.#e}
|
|
2801
2814
|
@blur=${this.#t}
|
|
@@ -29,7 +29,6 @@ export declare const builtinReportFallbacks: {
|
|
|
29
29
|
export declare const builtinValidationMessages: {
|
|
30
30
|
readonly invalidNumber: "Value must be a valid number.";
|
|
31
31
|
readonly textPatternMismatch: "Value does not match the expected pattern.";
|
|
32
|
-
readonly booleanRequired: "This field must be accepted.";
|
|
33
32
|
readonly categoryOptionMismatch: "Value must match one of the available options.";
|
|
34
33
|
readonly invalidTextLengthRange: "Minimum length cannot exceed maximum length.";
|
|
35
34
|
readonly invalidNumericRange: "Minimum value cannot exceed maximum value.";
|
|
@@ -15,7 +15,7 @@ export declare const builtinFieldDefinitions: readonly [import('./shared').Built
|
|
|
15
15
|
kind: "boolean";
|
|
16
16
|
trueLabel?: string;
|
|
17
17
|
falseLabel?: string;
|
|
18
|
-
}, boolean>, import('./shared').BuiltinFieldDefinition<import('../../schema').BaseFieldConfig & {
|
|
18
|
+
}, boolean | null>, import('./shared').BuiltinFieldDefinition<import('../../schema').BaseFieldConfig & {
|
|
19
19
|
kind: "category";
|
|
20
20
|
options: (string | {
|
|
21
21
|
label: string;
|
|
@@ -5,5 +5,5 @@ type BooleanFieldConfig = BaseFieldConfig & {
|
|
|
5
5
|
trueLabel?: string;
|
|
6
6
|
falseLabel?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const booleanFieldDefinition: BuiltinFieldDefinition<BooleanFieldConfig, boolean>;
|
|
8
|
+
export declare const booleanFieldDefinition: BuiltinFieldDefinition<BooleanFieldConfig, boolean | null>;
|
|
9
9
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { PrimitiveFieldController } from '../controller-types';
|
|
3
|
-
import { FieldDescriptor } from '../descriptors';
|
|
3
|
+
import { FieldDescriptor, PrimitiveDescriptorRegistry } from '../descriptors';
|
|
4
4
|
import { primitiveTagNames, PrimitiveText } from '../constants';
|
|
5
5
|
import { PrimitiveRegistry } from '../types';
|
|
6
6
|
export declare class PrimitiveFieldFrameElement extends LitElement {
|
|
@@ -8,6 +8,7 @@ export declare class PrimitiveFieldFrameElement extends LitElement {
|
|
|
8
8
|
static styles: import('lit').CSSResult;
|
|
9
9
|
accessor controller: PrimitiveFieldController | undefined;
|
|
10
10
|
accessor descriptor: FieldDescriptor | null;
|
|
11
|
+
accessor descriptorRegistry: PrimitiveDescriptorRegistry | undefined;
|
|
11
12
|
accessor registry: PrimitiveRegistry | undefined;
|
|
12
13
|
accessor text: PrimitiveText;
|
|
13
14
|
private accessor resolvedDescriptor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TemplateResult } from 'lit';
|
|
2
2
|
import { PrimitiveFormController } from '../controller-types';
|
|
3
|
+
import { PrimitiveDescriptorRegistry } from '../descriptors';
|
|
3
4
|
import { PrimitiveText } from '../constants';
|
|
4
5
|
import { PrimitiveRegistry, PrimitiveReportTransport } from '../types';
|
|
5
6
|
import { FormRenderState } from './form-root-state';
|
|
@@ -11,6 +12,7 @@ export declare const renderStackedLayout: (options: {
|
|
|
11
12
|
reportsToRender: readonly PresentedReport[];
|
|
12
13
|
showReports: boolean;
|
|
13
14
|
registry: PrimitiveRegistry | undefined;
|
|
15
|
+
descriptorRegistry: PrimitiveDescriptorRegistry | undefined;
|
|
14
16
|
text: PrimitiveText;
|
|
15
17
|
formLabel: string;
|
|
16
18
|
reportsLabel: string;
|
|
@@ -27,6 +29,7 @@ export declare const renderSplitLayout: (options: {
|
|
|
27
29
|
reportsToRender: readonly PresentedReport[];
|
|
28
30
|
showReports: boolean;
|
|
29
31
|
registry: PrimitiveRegistry | undefined;
|
|
32
|
+
descriptorRegistry: PrimitiveDescriptorRegistry | undefined;
|
|
30
33
|
text: PrimitiveText;
|
|
31
34
|
formLabel: string;
|
|
32
35
|
reportsLabel: string;
|