@react-typed-forms/schemas 8.2.0 → 9.0.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/lib/controlBuilder.d.ts +9 -2
- package/lib/controlRender.d.ts +12 -11
- package/lib/hooks.d.ts +8 -8
- package/lib/index.js +323 -215
- package/lib/index.js.map +1 -1
- package/lib/renderers.d.ts +1 -0
- package/lib/schemaBuilder.d.ts +5 -2
- package/lib/types.d.ts +9 -1
- package/lib/util.d.ts +12 -0
- package/package.json +2 -2
- package/.babelrc +0 -4
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/operation/update-readme/state.json +0 -3
- package/.rush/temp/package-deps_build.json +0 -13
- package/.rush/temp/shrinkwrap-deps.json +0 -612
- package/src/controlBuilder.ts +0 -175
- package/src/controlRender.tsx +0 -790
- package/src/hooks.tsx +0 -373
- package/src/index.ts +0 -10
- package/src/internal.ts +0 -48
- package/src/renderers.tsx +0 -996
- package/src/schemaBuilder.ts +0 -171
- package/src/schemaInterface.ts +0 -31
- package/src/tailwind.tsx +0 -29
- package/src/types.ts +0 -423
- package/src/util.ts +0 -453
- package/src/validators.ts +0 -116
package/lib/renderers.d.ts
CHANGED
|
@@ -145,6 +145,7 @@ export declare function isIconAdornment(a: ControlAdornment): a is IconAdornment
|
|
|
145
145
|
export declare function createLayoutRenderer(render: LayoutRendererRegistration["render"], options?: Partial<LayoutRendererRegistration>): LayoutRendererRegistration;
|
|
146
146
|
export declare function createArrayRenderer(render: ArrayRendererRegistration["render"], options?: Partial<ArrayRendererRegistration>): ArrayRendererRegistration;
|
|
147
147
|
export declare function createDataRenderer(render: DataRendererRegistration["render"], options?: Partial<DataRendererRegistration>): DataRendererRegistration;
|
|
148
|
+
export declare function createGroupRenderer(render: GroupRendererRegistration["render"], options?: Partial<GroupRendererRegistration>): GroupRendererRegistration;
|
|
148
149
|
export declare function createLabelRenderer(render: LabelRendererRegistration["render"], options?: Omit<LabelRendererRegistration, "type">): LabelRendererRegistration;
|
|
149
150
|
export declare function createVisibilityRenderer(render: VisibilityRendererRegistration["render"], options?: Partial<VisibilityRendererRegistration>): VisibilityRendererRegistration;
|
|
150
151
|
export declare function createAdornmentRenderer(render: (props: AdornmentProps) => AdornmentRenderer, options?: Partial<AdornmentRendererRegistration>): AdornmentRendererRegistration;
|
package/lib/schemaBuilder.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompoundField, FieldOption, FieldType, SchemaField } from "./types";
|
|
1
|
+
import { CompoundField, FieldOption, FieldType, SchemaField, SchemaMap } from "./types";
|
|
2
2
|
type AllowedSchema<T> = T extends string ? SchemaField & {
|
|
3
3
|
type: FieldType.String | FieldType.Date | FieldType.DateTime;
|
|
4
4
|
} : T extends number ? SchemaField & {
|
|
@@ -78,7 +78,7 @@ export declare function boolField(displayName: string, options?: Partial<Omit<Sc
|
|
|
78
78
|
validators?: import("./types").SchemaValidator[] | null | undefined;
|
|
79
79
|
type: FieldType.Bool;
|
|
80
80
|
};
|
|
81
|
-
export declare function compoundField<Other extends Partial<Omit<CompoundField, "type" | "schemaType">>>(displayName: string, fields: SchemaField[], other
|
|
81
|
+
export declare function compoundField<Other extends Partial<Omit<CompoundField, "type" | "schemaType">>>(displayName: string, fields: SchemaField[], other?: Other): (name: string) => CompoundField & {
|
|
82
82
|
collection: Other["collection"];
|
|
83
83
|
};
|
|
84
84
|
export declare function defaultScalarField(field: string, displayName: string): Omit<SchemaField, "type"> & {
|
|
@@ -88,4 +88,7 @@ export declare function defaultCompoundField(field: string, displayName: string,
|
|
|
88
88
|
type: FieldType.Compound;
|
|
89
89
|
};
|
|
90
90
|
export declare function mergeField(field: SchemaField, mergeInto: SchemaField[]): SchemaField[];
|
|
91
|
+
export declare function mergeFields(fields: SchemaField[], name: string, value: any, newFields: SchemaField[]): SchemaField[];
|
|
92
|
+
export declare function addFieldOption(typeField: SchemaField, name: string, value: any): SchemaField;
|
|
93
|
+
export declare function resolveSchemas<A extends SchemaMap>(schemaMap: A): A;
|
|
91
94
|
export {};
|
package/lib/types.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface SchemaField {
|
|
|
14
14
|
options?: FieldOption[] | null;
|
|
15
15
|
validators?: SchemaValidator[] | null;
|
|
16
16
|
}
|
|
17
|
+
export type SchemaMap = Record<string, SchemaField[]>;
|
|
17
18
|
export declare enum FieldType {
|
|
18
19
|
String = "String",
|
|
19
20
|
Bool = "Bool",
|
|
@@ -40,6 +41,7 @@ export interface CompoundField extends SchemaField {
|
|
|
40
41
|
type: FieldType.Compound;
|
|
41
42
|
children: SchemaField[];
|
|
42
43
|
treeChildren?: boolean;
|
|
44
|
+
schemaRef?: string;
|
|
43
45
|
}
|
|
44
46
|
export type AnyControlDefinition = DataControlDefinition | GroupedControlsDefinition | ActionControlDefinition | DisplayControlDefinition;
|
|
45
47
|
export interface SchemaInterface {
|
|
@@ -163,7 +165,8 @@ export declare enum DataRenderType {
|
|
|
163
165
|
DateTime = "DateTime",
|
|
164
166
|
Checkbox = "Checkbox",
|
|
165
167
|
Dropdown = "Dropdown",
|
|
166
|
-
DisplayOnly = "DisplayOnly"
|
|
168
|
+
DisplayOnly = "DisplayOnly",
|
|
169
|
+
Group = "Group"
|
|
167
170
|
}
|
|
168
171
|
export interface RadioButtonRenderOptions extends RenderOptions {
|
|
169
172
|
type: DataRenderType.Radio;
|
|
@@ -171,6 +174,10 @@ export interface RadioButtonRenderOptions extends RenderOptions {
|
|
|
171
174
|
export interface StandardRenderer extends RenderOptions {
|
|
172
175
|
type: DataRenderType.Standard;
|
|
173
176
|
}
|
|
177
|
+
export interface DataGroupRenderOptions extends RenderOptions {
|
|
178
|
+
type: DataRenderType.Group;
|
|
179
|
+
groupOptions?: GroupRenderOptions;
|
|
180
|
+
}
|
|
174
181
|
export interface HtmlEditorRenderOptions extends RenderOptions {
|
|
175
182
|
type: DataRenderType.HtmlEditor;
|
|
176
183
|
allowImages: boolean;
|
|
@@ -307,3 +314,4 @@ export declare function visitControlDefinition<A>(x: ControlDefinition, visitor:
|
|
|
307
314
|
export declare function isGridRenderer(options: GroupRenderOptions): options is GridRenderer;
|
|
308
315
|
export declare function isFlexRenderer(options: GroupRenderOptions): options is FlexRenderer;
|
|
309
316
|
export declare function isDisplayOnlyRenderer(options: RenderOptions): options is DisplayOnlyRenderOptions;
|
|
317
|
+
export declare function isDataGroupRenderer(options: RenderOptions): options is DataGroupRenderOptions;
|
package/lib/util.d.ts
CHANGED
|
@@ -42,3 +42,15 @@ export declare function jsonPathString(jsonPath: JsonPath[], customIndex?: (n: n
|
|
|
42
42
|
export declare function findChildDefinition(parent: ControlDefinition, childPath: number | number[]): ControlDefinition;
|
|
43
43
|
export declare function getOverrideClass(className?: string | null): string | null | undefined;
|
|
44
44
|
export declare function rendererClass(controlClass?: string | null, globalClass?: string | null): string | undefined;
|
|
45
|
+
export type HookDep = string | number | undefined | null;
|
|
46
|
+
export interface DynamicHookGenerator<A, P> {
|
|
47
|
+
deps: HookDep;
|
|
48
|
+
state: any;
|
|
49
|
+
runHook(ctx: P, state: any): A;
|
|
50
|
+
}
|
|
51
|
+
export declare function makeHook<A, P, S = undefined>(runHook: (ctx: P, state: S) => A, state: S, deps?: HookDep): DynamicHookGenerator<A, P>;
|
|
52
|
+
export type DynamicHookValue<A> = A extends DynamicHookGenerator<infer V, any> ? V : never;
|
|
53
|
+
export declare function useDynamicHooks<P, Hooks extends Record<string, DynamicHookGenerator<any, P>>>(hooks: Hooks): (p: P) => {
|
|
54
|
+
[K in keyof Hooks]: DynamicHookValue<Hooks[K]>;
|
|
55
|
+
};
|
|
56
|
+
export declare function toDepString(x: any): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-typed-forms/schemas",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"material-ui"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@react-typed-forms/core": "^3.1.
|
|
27
|
+
"@react-typed-forms/core": "^3.1.2",
|
|
28
28
|
"clsx": "^1 || ^2",
|
|
29
29
|
"jsonata": "^2.0.4",
|
|
30
30
|
"react": "^18.2.0"
|
package/.babelrc
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"files": {
|
|
3
|
-
"packages/schemas/.rush/temp/shrinkwrap-deps.json": "329df00ec3f08b122bf36953ca1785b4e3206a7d",
|
|
4
|
-
"packages/schemas/package.json": "f5b0d0c1f863b7bf50c1f25f9cbe252325bcee76",
|
|
5
|
-
"packages/schemas/src/controlRender.tsx": "7edc71570ea821a36f0260d9263dc41d577168ce",
|
|
6
|
-
"packages/schemas/src/hooks.ts": "4eb4946f7b1c685e0b51cd011b4d39a1fdd6aa2e",
|
|
7
|
-
"packages/schemas/src/index.ts": "67f656f1d7f717bce7e933b9f4d7dc5dc50274dc",
|
|
8
|
-
"packages/schemas/src/schemaBuilder.ts": "1af97440b88f064ad67aa804cbaa0f96622f0a6a",
|
|
9
|
-
"packages/schemas/src/types.ts": "c013bf09120147d7a19e48ce4c8772ee34a2061c",
|
|
10
|
-
"packages/schemas/tsconfig.json": "52e4f044fa580f4e0ad5830f3cfca574e2788372"
|
|
11
|
-
},
|
|
12
|
-
"arguments": "rimraf ./lib/ && tsc "
|
|
13
|
-
}
|