@overmap-ai/forms 1.0.36-add-utils.0 → 1.0.36-add-utils.1
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/form/fields/BaseField/BaseField.d.ts +4 -0
- package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +2 -0
- package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +2 -0
- package/dist/form/fields/RadioField/RadioField.d.ts +2 -0
- package/dist/form/fields/SelectField/SelectField.d.ts +2 -0
- package/dist/forms.js +40 -2
- package/dist/forms.umd.cjs +9 -9
- package/package.json +1 -1
|
@@ -25,6 +25,10 @@ export declare abstract class BaseField<TType extends string, TValue, TSerialize
|
|
|
25
25
|
abstract areValuesEqual(value1: TValue, value2: TValue): boolean;
|
|
26
26
|
abstract deserializeValue(value: TSerializedValue): TValue;
|
|
27
27
|
isValueBlank(value: TValue): boolean;
|
|
28
|
+
cleanValue(value: TValue): TValue;
|
|
29
|
+
isValueClean(value: TValue): boolean;
|
|
30
|
+
cleanSerializedValue(value: TSerializedValue): TSerializedValue;
|
|
31
|
+
isSerializedValueClean(value: TSerializedValue): boolean;
|
|
28
32
|
abstract blankValue(): TValue;
|
|
29
33
|
abstract blankSerializedValue(): TSerializedValue;
|
|
30
34
|
abstract areSerializedValuesEqual(value1: TSerializedValue, value2: TSerializedValue): boolean;
|
|
@@ -19,6 +19,8 @@ export declare class CheckboxListField extends BaseOptionsField<"checkbox-list",
|
|
|
19
19
|
render(props: FieldRenderProps): ReactNode;
|
|
20
20
|
isSerializedValueValid(value: unknown): value is string[];
|
|
21
21
|
isValueValid(value: unknown): value is string[];
|
|
22
|
+
cleanValue(value: string[]): string[];
|
|
23
|
+
cleanSerializedValue(value: string[]): string[];
|
|
22
24
|
blankValue(): string[];
|
|
23
25
|
blankSerializedValue(): string[];
|
|
24
26
|
areSerializedValuesEqual(value1: string[], value2: string[]): boolean;
|
|
@@ -22,6 +22,8 @@ export declare class MultiSelectField extends BaseOptionsField<"multi-select", s
|
|
|
22
22
|
isSerializedValueValid(value: unknown): value is string[];
|
|
23
23
|
isValueValid(value: unknown): value is string[];
|
|
24
24
|
blankValue(): string[];
|
|
25
|
+
cleanValue(value: string[]): string[];
|
|
26
|
+
cleanSerializedValue(value: string[]): string[];
|
|
25
27
|
areValuesEqual(value1: string[], value2: string[]): boolean;
|
|
26
28
|
blankSerializedValue(): string[];
|
|
27
29
|
areSerializedValuesEqual(value1: string[], value2: string[]): boolean;
|
|
@@ -21,6 +21,8 @@ export declare class RadioField extends BaseOptionsField<"radio", string | null,
|
|
|
21
21
|
isSerializedValueValid(value: unknown): value is string | null;
|
|
22
22
|
isValueValid(value: unknown): value is string | null;
|
|
23
23
|
blankValue(): string | null;
|
|
24
|
+
cleanValue(value: string | null): string | null;
|
|
25
|
+
cleanSerializedValue(value: string | null): string | null;
|
|
24
26
|
areValuesEqual(value1: string | null, value2: string | null): boolean;
|
|
25
27
|
blankSerializedValue(): string | null;
|
|
26
28
|
areSerializedValuesEqual(value1: string | null, value2: string | null): boolean;
|
|
@@ -22,6 +22,8 @@ export declare class SelectField extends BaseOptionsField<"select", string | nul
|
|
|
22
22
|
isSerializedValueValid(value: unknown): value is string | null;
|
|
23
23
|
isValueValid(value: unknown): value is string | null;
|
|
24
24
|
blankValue(): string | null;
|
|
25
|
+
cleanValue(value: string | null): string | null;
|
|
26
|
+
cleanSerializedValue(value: string | null): string | null;
|
|
25
27
|
areValuesEqual(value1: string | null, value2: string | null): boolean;
|
|
26
28
|
blankSerializedValue(): string | null;
|
|
27
29
|
areSerializedValuesEqual(value1: string | null, value2: string | null): boolean;
|
package/dist/forms.js
CHANGED
|
@@ -709,6 +709,18 @@ class Je extends lo {
|
|
|
709
709
|
isValueBlank(t) {
|
|
710
710
|
return this.areValuesEqual(t, this.blankValue());
|
|
711
711
|
}
|
|
712
|
+
cleanValue(t) {
|
|
713
|
+
return t;
|
|
714
|
+
}
|
|
715
|
+
isValueClean(t) {
|
|
716
|
+
return this.areValuesEqual(t, this.cleanValue(t));
|
|
717
|
+
}
|
|
718
|
+
cleanSerializedValue(t) {
|
|
719
|
+
return t;
|
|
720
|
+
}
|
|
721
|
+
isSerializedValueClean(t) {
|
|
722
|
+
return this.areSerializedValuesEqual(t, this.cleanSerializedValue(t));
|
|
723
|
+
}
|
|
712
724
|
isSerializedValueBlank(t) {
|
|
713
725
|
return this.areSerializedValuesEqual(t, this.blankSerializedValue());
|
|
714
726
|
}
|
|
@@ -1532,6 +1544,13 @@ const qt = class qt extends fn {
|
|
|
1532
1544
|
isValueValid(t) {
|
|
1533
1545
|
return or(t);
|
|
1534
1546
|
}
|
|
1547
|
+
cleanValue(t) {
|
|
1548
|
+
const n = new Set(this.options.map(({ value: i }) => i));
|
|
1549
|
+
return t.filter((i) => n.has(i));
|
|
1550
|
+
}
|
|
1551
|
+
cleanSerializedValue(t) {
|
|
1552
|
+
return this.cleanValue(t);
|
|
1553
|
+
}
|
|
1535
1554
|
blankValue() {
|
|
1536
1555
|
return [];
|
|
1537
1556
|
}
|
|
@@ -1770,6 +1789,13 @@ const jt = class jt extends fn {
|
|
|
1770
1789
|
blankValue() {
|
|
1771
1790
|
return [];
|
|
1772
1791
|
}
|
|
1792
|
+
cleanValue(t) {
|
|
1793
|
+
const n = new Set(this.options.map(({ value: i }) => i));
|
|
1794
|
+
return t.filter((i) => n.has(i));
|
|
1795
|
+
}
|
|
1796
|
+
cleanSerializedValue(t) {
|
|
1797
|
+
return this.cleanValue(t);
|
|
1798
|
+
}
|
|
1773
1799
|
areValuesEqual(t, n) {
|
|
1774
1800
|
const i = new Set(t), a = new Set(n);
|
|
1775
1801
|
return i.size === a.size && i.isSubsetOf(a);
|
|
@@ -1875,6 +1901,12 @@ const Yt = class Yt extends fn {
|
|
|
1875
1901
|
blankValue() {
|
|
1876
1902
|
return null;
|
|
1877
1903
|
}
|
|
1904
|
+
cleanValue(t) {
|
|
1905
|
+
return (/* @__PURE__ */ new Set([null, ...this.options.map(({ value: i }) => i)])).has(t) ? t : null;
|
|
1906
|
+
}
|
|
1907
|
+
cleanSerializedValue(t) {
|
|
1908
|
+
return this.cleanValue(t);
|
|
1909
|
+
}
|
|
1878
1910
|
areValuesEqual(t, n) {
|
|
1879
1911
|
return t === n;
|
|
1880
1912
|
}
|
|
@@ -2620,6 +2652,12 @@ const Qt = class Qt extends fn {
|
|
|
2620
2652
|
blankValue() {
|
|
2621
2653
|
return null;
|
|
2622
2654
|
}
|
|
2655
|
+
cleanValue(t) {
|
|
2656
|
+
return (/* @__PURE__ */ new Set([null, ...this.options.map(({ value: i }) => i)])).has(t) ? t : null;
|
|
2657
|
+
}
|
|
2658
|
+
cleanSerializedValue(t) {
|
|
2659
|
+
return this.cleanValue(t);
|
|
2660
|
+
}
|
|
2623
2661
|
areValuesEqual(t, n) {
|
|
2624
2662
|
return t === n;
|
|
2625
2663
|
}
|
|
@@ -25370,7 +25408,7 @@ function Li(r, e) {
|
|
|
25370
25408
|
for (const n of r) {
|
|
25371
25409
|
if (!(n.identifier in e)) continue;
|
|
25372
25410
|
const i = e[n.identifier];
|
|
25373
|
-
n.isValueValid(i) && (t[n.identifier] = i);
|
|
25411
|
+
n.isValueValid(i) && (t[n.identifier] = n.cleanValue(i));
|
|
25374
25412
|
}
|
|
25375
25413
|
return t;
|
|
25376
25414
|
}
|
|
@@ -25379,7 +25417,7 @@ function os(r, e) {
|
|
|
25379
25417
|
for (const n of r) {
|
|
25380
25418
|
if (!(n.identifier in e)) continue;
|
|
25381
25419
|
const i = e[n.identifier];
|
|
25382
|
-
n.isSerializedValueValid(i) && (t[n.identifier] = i);
|
|
25420
|
+
n.isSerializedValueValid(i) && (t[n.identifier] = n.cleanSerializedValue(i));
|
|
25383
25421
|
}
|
|
25384
25422
|
return t;
|
|
25385
25423
|
}
|