@react-typed-forms/schemas 12.0.0 → 12.0.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/lib/hooks.d.ts +2 -2
- package/lib/index.cjs +1 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/schemaInterface.d.ts +2 -1
- package/lib/treeNodes.d.ts +4 -1
- package/lib/types.d.ts +2 -1
- package/lib/util.d.ts +1 -21
- package/package.json +1 -1
package/lib/schemaInterface.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { FieldOption, SchemaField, SchemaInterface, ValidationMessageType } from "./types";
|
|
2
2
|
import { Control } from "@react-typed-forms/core";
|
|
3
|
+
import { SchemaDataNode, SchemaNode } from "./treeNodes";
|
|
3
4
|
export declare class DefaultSchemaInterface implements SchemaInterface {
|
|
4
5
|
protected boolStrings: [string, string];
|
|
5
6
|
constructor(boolStrings?: [string, string]);
|
|
6
7
|
parseToMillis(field: SchemaField, v: string): number;
|
|
7
8
|
validationMessageText(field: SchemaField, messageType: ValidationMessageType, actual: any, expected: any): string;
|
|
8
9
|
getOptions({ options }: SchemaField): FieldOption[] | null | undefined;
|
|
9
|
-
getFilterOptions(field:
|
|
10
|
+
getFilterOptions(array: SchemaDataNode, field: SchemaNode): FieldOption[] | undefined | null;
|
|
10
11
|
isEmptyValue(f: SchemaField, value: any): boolean;
|
|
11
12
|
textValue(field: SchemaField, value: any, element?: boolean | undefined): string | undefined;
|
|
12
13
|
controlLength(f: SchemaField, control: Control<any>): number;
|
package/lib/treeNodes.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Control } from "@react-typed-forms/core";
|
|
2
|
-
import { ControlDefinition, SchemaField } from "./types";
|
|
2
|
+
import { ControlDefinition, SchemaField, DataControlDefinition } from "./types";
|
|
3
3
|
export interface FormNode {
|
|
4
4
|
definition: ControlDefinition;
|
|
5
5
|
getChildNodes(): FormNode[];
|
|
@@ -41,5 +41,8 @@ export declare function traverseParents<A, B extends {
|
|
|
41
41
|
}>(current: B | undefined, get: (b: B) => A, until?: (b: B) => boolean): A[];
|
|
42
42
|
export declare function getRootDataNode(dataNode: SchemaDataNode): SchemaDataNode;
|
|
43
43
|
export declare function getJsonPath(dataNode: SchemaDataNode): (string | number)[];
|
|
44
|
+
export declare function getSchemaPath(schemaNode: SchemaNode): SchemaField[];
|
|
44
45
|
export declare function getSchemaFieldList(schema: SchemaNode): SchemaField[];
|
|
45
46
|
export declare function rootSchemaNode(fields: SchemaField[], lookup?: SchemaTreeLookup): SchemaNode;
|
|
47
|
+
export declare function visitControlDataArray<A>(controls: ControlDefinition[] | undefined | null, context: SchemaDataNode, cb: (definition: DataControlDefinition, node: SchemaDataNode) => A | undefined): A | undefined;
|
|
48
|
+
export declare function visitControlData<A>(definition: ControlDefinition, ctx: SchemaDataNode, cb: (definition: DataControlDefinition, field: SchemaDataNode) => A | undefined): A | undefined;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Control } from "@react-typed-forms/core";
|
|
2
|
+
import { SchemaDataNode, SchemaNode } from "./treeNodes";
|
|
2
3
|
export interface SchemaField {
|
|
3
4
|
type: string;
|
|
4
5
|
field: string;
|
|
@@ -62,7 +63,7 @@ export interface SchemaInterface {
|
|
|
62
63
|
controlLength(field: SchemaField, control: Control<any>): number;
|
|
63
64
|
valueLength(field: SchemaField, value: any): number;
|
|
64
65
|
getOptions(field: SchemaField): FieldOption[] | undefined | null;
|
|
65
|
-
getFilterOptions(field:
|
|
66
|
+
getFilterOptions(array: SchemaDataNode, field: SchemaNode): FieldOption[] | undefined | null;
|
|
66
67
|
parseToMillis(field: SchemaField, v: string): number;
|
|
67
68
|
validationMessageText(field: SchemaField, messageType: ValidationMessageType, actual: any, expected: any): string;
|
|
68
69
|
}
|
package/lib/util.d.ts
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
import { CompoundField, ControlDefinition, DataControlDefinition, DisplayOnlyRenderOptions, FieldOption, SchemaField, SchemaInterface } from "./types";
|
|
2
2
|
import { MutableRefObject } from "react";
|
|
3
|
-
import { Control } from "@react-typed-forms/core";
|
|
4
3
|
import { SchemaDataNode } from "./treeNodes";
|
|
5
4
|
export type JsonPath = string | number;
|
|
6
|
-
export interface
|
|
7
|
-
data: Control<any>;
|
|
8
|
-
path: JsonPath[];
|
|
9
|
-
}
|
|
10
|
-
export interface ControlDataContext extends DataContext {
|
|
11
|
-
fields: SchemaField[];
|
|
12
|
-
schemaInterface: SchemaInterface;
|
|
13
|
-
dataNode: SchemaDataNode | undefined;
|
|
14
|
-
parentNode: SchemaDataNode;
|
|
15
|
-
}
|
|
16
|
-
export declare class ControlDataContextImpl implements ControlDataContext {
|
|
5
|
+
export interface ControlDataContext {
|
|
17
6
|
schemaInterface: SchemaInterface;
|
|
18
7
|
dataNode: SchemaDataNode | undefined;
|
|
19
8
|
parentNode: SchemaDataNode;
|
|
20
|
-
constructor(schemaInterface: SchemaInterface, dataNode: SchemaDataNode | undefined, parentNode: SchemaDataNode);
|
|
21
|
-
get fields(): SchemaField[];
|
|
22
|
-
get data(): Control<unknown>;
|
|
23
|
-
get path(): (string | number)[];
|
|
24
9
|
}
|
|
25
10
|
export declare function applyDefaultValues(v: Record<string, any> | undefined, fields: SchemaField[], doneSet?: Set<Record<string, any>>): any;
|
|
26
11
|
export declare function applyDefaultForField(v: any, field: SchemaField, parent: SchemaField[], notElement?: boolean, doneSet?: Set<Record<string, any>>): any;
|
|
@@ -48,10 +33,6 @@ export declare function useUpdatedRef<A>(a: A): MutableRefObject<A>;
|
|
|
48
33
|
export declare function isControlReadonly(c: ControlDefinition): boolean;
|
|
49
34
|
export declare function isControlDisabled(c: ControlDefinition): boolean;
|
|
50
35
|
export declare function getDisplayOnlyOptions(d: ControlDefinition): DisplayOnlyRenderOptions | undefined;
|
|
51
|
-
export declare function visitControlDataArray<A>(controls: ControlDefinition[] | undefined | null, context: ControlDataContext, cb: (definition: DataControlDefinition, field: SchemaField, control: Control<any>, element: boolean) => A | undefined): A | undefined;
|
|
52
|
-
export declare function visitControlData<A>(definition: ControlDefinition, ctx: ControlDataContext, cb: (definition: DataControlDefinition, field: SchemaField, control: Control<any>, element: boolean) => A | undefined): A | undefined;
|
|
53
|
-
export declare function lookupChildControl(data: DataContext, path: SchemaField[], element?: number): Control<any> | undefined;
|
|
54
|
-
export declare function lookupChildControlPath(data: DataContext, jsonPath: JsonPath[]): Control<any> | undefined;
|
|
55
36
|
export declare function cleanDataForSchema(v: {
|
|
56
37
|
[k: string]: any;
|
|
57
38
|
} | undefined, fields: SchemaField[], removeIfDefault?: boolean): any;
|
|
@@ -60,7 +41,6 @@ export declare function jsonPathString(jsonPath: JsonPath[], customIndex?: (n: n
|
|
|
60
41
|
export declare function findChildDefinition(parent: ControlDefinition, childPath: number | number[]): ControlDefinition;
|
|
61
42
|
export declare function getOverrideClass(className?: string | null): string | null | undefined;
|
|
62
43
|
export declare function rendererClass(controlClass?: string | null, globalClass?: string | null): string | undefined;
|
|
63
|
-
export declare function watchControlLookup(base: Control<any> | undefined, path: (string | number)[]): Control<any> | undefined;
|
|
64
44
|
export type HookDep = string | number | undefined | null;
|
|
65
45
|
export interface DynamicHookGenerator<A, P> {
|
|
66
46
|
deps: HookDep;
|