mobx-formly 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/path-store.js +6 -4
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/path-store.js
CHANGED
|
@@ -9,8 +9,8 @@ import { observable } from 'mobx';
|
|
|
9
9
|
*/
|
|
10
10
|
export class PathStore {
|
|
11
11
|
store = observable.map();
|
|
12
|
-
counts =
|
|
13
|
-
children =
|
|
12
|
+
counts = observable.map();
|
|
13
|
+
children = observable.map({}, { deep: false });
|
|
14
14
|
proxies = new Map();
|
|
15
15
|
/** Whether a value is stored at the exact path. */
|
|
16
16
|
has(path) { return this.store.has(path); }
|
|
@@ -124,8 +124,10 @@ export class PathStore {
|
|
|
124
124
|
this.counts.set(current, (this.counts.get(current) ?? 0) + 1);
|
|
125
125
|
const parent = parts.slice(0, index - 1).join('.');
|
|
126
126
|
let siblings = this.children.get(parent);
|
|
127
|
-
if (!siblings)
|
|
128
|
-
|
|
127
|
+
if (!siblings) {
|
|
128
|
+
siblings = observable.set();
|
|
129
|
+
this.children.set(parent, siblings);
|
|
130
|
+
}
|
|
129
131
|
siblings.add(parts[index - 1]);
|
|
130
132
|
}
|
|
131
133
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export type ValidateResult = boolean | string | string[] | undefined;
|
|
|
79
79
|
export type FieldValidate<TValue = unknown, TValues extends FieldValues = FieldValues> = (value: TValue, values: TValues) => ValidateResult | Promise<ValidateResult>;
|
|
80
80
|
export type ErrorNamespacePath = 'root' | `root.${string}`;
|
|
81
81
|
export type GlobalErrors = FieldError & Record<string, FieldError | undefined>;
|
|
82
|
-
type FieldErrorTree<V> = V extends readonly (infer I)[] ? FieldError & Array<I extends object ? FieldErrors<I> : FieldError | undefined> : V extends ReadonlyMap<infer MapKey, infer MapValue> ? FieldError & (MapKey extends string ? {
|
|
82
|
+
type FieldErrorTree<V> = V extends null | undefined ? never : V extends readonly (infer I)[] ? FieldError & Array<I extends object ? FieldErrors<I> : FieldError | undefined> : V extends ReadonlyMap<infer MapKey, infer MapValue> ? FieldError & (MapKey extends string ? {
|
|
83
83
|
[K in MapKey]?: FieldErrorTree<MapValue>;
|
|
84
84
|
} : {}) : V extends Date | RegExp | ReadonlySet<unknown> ? FieldError : V extends object ? FieldError & FieldErrors<V> : FieldError;
|
|
85
85
|
export type FieldErrors<T extends object = FieldValues> = {
|
package/package.json
CHANGED