@react-typed-forms/schemas 13.5.3 → 14.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/controlDefinition.d.ts +24 -8
- package/lib/controlRender.d.ts +7 -5
- package/lib/hooks.d.ts +1 -1
- 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/schemaField.d.ts +19 -3
- package/lib/util.d.ts +2 -22
- package/package.json +5 -5
package/lib/schemaField.d.ts
CHANGED
|
@@ -202,17 +202,19 @@ export interface SchemaTreeLookup<A = string> {
|
|
|
202
202
|
getSchema(schemaId: A): SchemaNode | undefined;
|
|
203
203
|
}
|
|
204
204
|
export interface SchemaNode extends SchemaTreeLookup {
|
|
205
|
+
id: string;
|
|
205
206
|
field: SchemaField;
|
|
206
207
|
getChildNode(field: string): SchemaNode | undefined;
|
|
207
|
-
getChildNodes(withParent?: SchemaNode): SchemaNode[];
|
|
208
|
+
getChildNodes(noRecurse?: boolean, withParent?: SchemaNode): SchemaNode[];
|
|
208
209
|
parent?: SchemaNode;
|
|
209
210
|
}
|
|
210
211
|
export interface SchemaDataNode {
|
|
212
|
+
id: string;
|
|
211
213
|
schema: SchemaNode;
|
|
212
214
|
elementIndex?: number;
|
|
213
215
|
control?: Control<unknown>;
|
|
214
216
|
parent?: SchemaDataNode;
|
|
215
|
-
getChild(
|
|
217
|
+
getChild(schemaNode: SchemaNode): SchemaDataNode;
|
|
216
218
|
getChildElement(index: number): SchemaDataNode;
|
|
217
219
|
}
|
|
218
220
|
export declare function findField(fields: SchemaField[], field: string): SchemaField | undefined;
|
|
@@ -226,8 +228,22 @@ export declare function traverseSchemaPath<A>(fieldPath: string[], schema: Schem
|
|
|
226
228
|
export declare function traverseData(fieldPath: string[], root: SchemaNode, data: {
|
|
227
229
|
[k: string]: any;
|
|
228
230
|
}): unknown;
|
|
229
|
-
export declare function schemaDataForFieldPath(fieldPath: string[],
|
|
231
|
+
export declare function schemaDataForFieldPath(fieldPath: string[], dataNode: SchemaDataNode): SchemaDataNode;
|
|
230
232
|
export declare function schemaForFieldPath(fieldPath: string[], schema: SchemaNode): SchemaNode;
|
|
231
233
|
export declare function rootSchemaNode(fields: SchemaField[], lookup?: SchemaTreeLookup): SchemaNode;
|
|
232
234
|
export declare function getSchemaNodePath(node: SchemaNode): string[];
|
|
233
235
|
export declare function isCompoundNode(node: SchemaNode): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Returns the relative path from a parent node to a child node.
|
|
238
|
+
* @param parent
|
|
239
|
+
* @param child
|
|
240
|
+
*/
|
|
241
|
+
export declare function relativePath(parent: SchemaNode, child: SchemaNode): string;
|
|
242
|
+
export declare enum SchemaTags {
|
|
243
|
+
NoControl = "_NoControl",
|
|
244
|
+
HtmlEditor = "_HtmlEditor",
|
|
245
|
+
ControlGroup = "_ControlGroup:",
|
|
246
|
+
ControlRef = "_ControlRef:"
|
|
247
|
+
}
|
|
248
|
+
export declare function getTagParam(field: SchemaField, tag: string): string | undefined;
|
|
249
|
+
export declare function makeParamTag(tag: string, value: string): string;
|
package/lib/util.d.ts
CHANGED
|
@@ -89,31 +89,11 @@ export declare function hasOptions(o: {
|
|
|
89
89
|
/**
|
|
90
90
|
* Returns the default control definition for a specific schema field.
|
|
91
91
|
* @param sf - The schema field to get the default control definition for.
|
|
92
|
+
* @param noChildren - Flag indicating if children should not be included.
|
|
92
93
|
* @returns The default control definition for the schema field.
|
|
93
94
|
*/
|
|
94
|
-
export declare function defaultControlForField(sf: SchemaField): DataControlDefinition;
|
|
95
|
+
export declare function defaultControlForField(sf: SchemaField, noChildren?: boolean): DataControlDefinition;
|
|
95
96
|
export declare function findControlsForCompound(compound: SchemaNode, definition: ControlDefinition): ControlDefinition[];
|
|
96
|
-
/**
|
|
97
|
-
* Interface representing a control group lookup.
|
|
98
|
-
*/
|
|
99
|
-
export interface ControlGroupLookup {
|
|
100
|
-
groups: ControlDefinition[];
|
|
101
|
-
children: Record<string, ControlGroupLookup>;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Finds compound groups in the provided schema fields and control definitions.
|
|
105
|
-
* @param fields - The schema fields to search in.
|
|
106
|
-
* @param controls - The control definitions to search in.
|
|
107
|
-
* @returns A record of found compound groups.
|
|
108
|
-
*/
|
|
109
|
-
export declare function findCompoundGroups(fields: SchemaNode[], controls: ControlDefinition[]): Record<string, ControlGroupLookup>;
|
|
110
|
-
/**
|
|
111
|
-
* Checks if a field exists in the provided control group lookup.
|
|
112
|
-
* @param field - The field to check.
|
|
113
|
-
* @param lookup - The control group lookup to check in.
|
|
114
|
-
* @returns An array of tuples containing the field and the control group lookup.
|
|
115
|
-
*/
|
|
116
|
-
export declare function existsInGroups(field: SchemaNode, lookup: ControlGroupLookup): [SchemaNode, ControlGroupLookup][];
|
|
117
97
|
/**
|
|
118
98
|
* Finds non-data groups in the provided control definitions.
|
|
119
99
|
* @param controls - The control definitions to search in.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-typed-forms/schemas",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
@@ -37,11 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "^18.2.0",
|
|
40
|
-
"@react-typed-forms/core": "^
|
|
40
|
+
"@react-typed-forms/core": "^4.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"react": "^18.2.0",
|
|
44
|
-
"@react-typed-forms/core": "^3.6.1",
|
|
45
44
|
"@react-typed-forms/transform": "^0.2.0",
|
|
46
45
|
"typedoc": "^0.27.2",
|
|
47
46
|
"@types/uuid": "^10.0.0",
|
|
@@ -51,11 +50,12 @@
|
|
|
51
50
|
"nswag": "^13.18.2",
|
|
52
51
|
"prettier": "^3.0.3",
|
|
53
52
|
"rimraf": "^3.0.2",
|
|
54
|
-
"typescript": "^5.6.2"
|
|
53
|
+
"typescript": "^5.6.2",
|
|
54
|
+
"@react-typed-forms/core": "4.0.0"
|
|
55
55
|
},
|
|
56
56
|
"gitHead": "698e16cd3ab31b7dd0528fc76536f4d3205ce8c6",
|
|
57
57
|
"scripts": {
|
|
58
|
-
"build": "rimraf ./lib/ && microbundle -f modern,cjs --jsx React.createElement --jsxFragment React.Fragment",
|
|
58
|
+
"build": "rimraf ./lib/ node_modules/.cache && microbundle -f modern,cjs --jsx React.createElement --jsxFragment React.Fragment",
|
|
59
59
|
"watch": "microbundle -w -f modern,cjs --no-compress --jsx React.createElement --jsxFragment React.Fragment",
|
|
60
60
|
"update-readme": "md-magic --path README.md",
|
|
61
61
|
"gencode": "nswag swagger2tsclient /input:http://localhost:5216/swagger/v1/swagger.json /runtime:Net60 /output:src/types.ts /GenerateClientClasses:false /MarkOptionalProperties:false /Template:Fetch /TypeStyle:Interface /DateTimeType:string"
|