@react-typed-forms/schemas 15.2.0 → 16.0.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/lib/RenderForm.d.ts +39 -0
- package/lib/controlBuilder.d.ts +3 -6
- package/lib/controlRender.d.ts +107 -87
- package/lib/index.cjs +556 -2117
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +3 -9
- package/lib/index.js +421 -1642
- package/lib/index.js.map +1 -1
- package/lib/renderers.d.ts +3 -3
- package/lib/types.d.ts +31 -0
- package/lib/util.d.ts +9 -54
- package/package.json +5 -4
- package/src/RenderForm.tsx +301 -0
- package/src/controlBuilder.ts +22 -19
- package/src/controlRender.tsx +228 -507
- package/src/createFormRenderer.tsx +4 -5
- package/src/index.ts +3 -9
- package/src/renderers.tsx +2 -3
- package/src/types.ts +52 -0
- package/src/util.ts +170 -184
- package/lib/controlDefinition.d.ts +0 -398
- package/lib/defaultSchemaInterface.d.ts +0 -24
- package/lib/dynamicHooks.d.ts +0 -54
- package/lib/entityExpression.d.ts +0 -32
- package/lib/hooks.d.ts +0 -28
- package/lib/schemaBuilder.d.ts +0 -67
- package/lib/schemaField.d.ts +0 -252
- package/lib/schemaValidator.d.ts +0 -27
- package/lib/validators.d.ts +0 -19
- package/src/controlDefinition.ts +0 -821
- package/src/defaultSchemaInterface.ts +0 -191
- package/src/dynamicHooks.ts +0 -98
- package/src/entityExpression.ts +0 -38
- package/src/hooks.tsx +0 -469
- package/src/schemaBuilder.ts +0 -318
- package/src/schemaField.ts +0 -552
- package/src/schemaValidator.ts +0 -32
- package/src/validators.ts +0 -217
package/lib/index.js
CHANGED
|
@@ -1,545 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { isCompoundField, findField, getTagParam, SchemaTags, ControlDefinitionType, isScalarField, DataRenderType, isDataControl, isGroupControl, createSchemaTree, relativePath, isCompoundNode, fieldPathForDefinition, schemaForFieldPath, isCheckEntryClasses, isGridRenderer, isAutoCompleteClasses, getGroupRendererOptions, ValidatorType, ControlAdornmentType, DisplayDataType, DynamicPropertyType, ExpressionType, GroupRenderType, mergeFields, resolveSchemas, isActionControl, ActionStyle, isDisplayControl, AdornmentPlacement, lookupDataNode, defaultSchemaInterface, createFormState, legacyFormNode, createSchemaDataNode } from '@astroapps/forms-core';
|
|
2
|
+
export * from '@astroapps/forms-core';
|
|
3
|
+
import { useRef, useMemo, useState, useEffect, useCallback } from 'react';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Enum representing the various field types.
|
|
10
|
-
*/
|
|
11
|
-
var FieldType;
|
|
12
|
-
(function (FieldType) {
|
|
13
|
-
FieldType["String"] = "String";
|
|
14
|
-
FieldType["Bool"] = "Bool";
|
|
15
|
-
FieldType["Int"] = "Int";
|
|
16
|
-
FieldType["Date"] = "Date";
|
|
17
|
-
FieldType["DateTime"] = "DateTime";
|
|
18
|
-
FieldType["Time"] = "Time";
|
|
19
|
-
FieldType["Double"] = "Double";
|
|
20
|
-
FieldType["EntityRef"] = "EntityRef";
|
|
21
|
-
FieldType["Compound"] = "Compound";
|
|
22
|
-
FieldType["AutoId"] = "AutoId";
|
|
23
|
-
FieldType["Image"] = "Image";
|
|
24
|
-
FieldType["Any"] = "Any";
|
|
25
|
-
})(FieldType || (FieldType = {}));
|
|
26
|
-
/**
|
|
27
|
-
* Enum representing the various validation message types.
|
|
28
|
-
*/
|
|
29
|
-
var ValidationMessageType;
|
|
30
|
-
(function (ValidationMessageType) {
|
|
31
|
-
ValidationMessageType["NotEmpty"] = "NotEmpty";
|
|
32
|
-
ValidationMessageType["MinLength"] = "MinLength";
|
|
33
|
-
ValidationMessageType["MaxLength"] = "MaxLength";
|
|
34
|
-
ValidationMessageType["NotAfterDate"] = "NotAfterDate";
|
|
35
|
-
ValidationMessageType["NotBeforeDate"] = "NotBeforeDate";
|
|
36
|
-
})(ValidationMessageType || (ValidationMessageType = {}));
|
|
37
|
-
function findField(fields, field) {
|
|
38
|
-
return fields.find(x => x.field === field);
|
|
39
|
-
}
|
|
40
|
-
function isScalarField(sf) {
|
|
41
|
-
return !isCompoundField(sf);
|
|
42
|
-
}
|
|
43
|
-
function isCompoundField(sf) {
|
|
44
|
-
return sf.type === FieldType.Compound;
|
|
45
|
-
}
|
|
46
|
-
function missingField(field) {
|
|
47
|
-
return {
|
|
48
|
-
field: "__missing",
|
|
49
|
-
type: FieldType.Any,
|
|
50
|
-
displayName: field
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function nodeForSchema(field, lookup, parent) {
|
|
54
|
-
const node = {
|
|
55
|
-
id: parent ? parent.id + "/" + field.field : field.field,
|
|
56
|
-
field,
|
|
57
|
-
getSchema: lookup.getSchema,
|
|
58
|
-
parent,
|
|
59
|
-
getChildNode,
|
|
60
|
-
getChildNodes
|
|
61
|
-
};
|
|
62
|
-
return node;
|
|
63
|
-
function getChildNode(fieldName) {
|
|
64
|
-
if (isCompoundField(field) && !field.schemaRef && !field.treeChildren) {
|
|
65
|
-
const childField = field.children.find(x => x.field === fieldName);
|
|
66
|
-
return childField ? nodeForSchema(childField, lookup, node) : undefined;
|
|
67
|
-
}
|
|
68
|
-
return getChildNodes(false, node).find(x => x.field.field === fieldName);
|
|
69
|
-
}
|
|
70
|
-
function getChildNodes(noRecurse, withParent) {
|
|
71
|
-
if (isCompoundField(field)) {
|
|
72
|
-
if (field.treeChildren) {
|
|
73
|
-
return noRecurse ? [] : parent.getChildNodes(false, withParent != null ? withParent : node);
|
|
74
|
-
}
|
|
75
|
-
const otherRef = field.schemaRef && lookup.getSchema(field.schemaRef);
|
|
76
|
-
if (otherRef) return otherRef.getChildNodes(false, withParent != null ? withParent : node);
|
|
77
|
-
return field.children.map(x => nodeForSchema(x, lookup, withParent != null ? withParent : node));
|
|
78
|
-
}
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function createSchemaLookup(schemaMap) {
|
|
83
|
-
const lookup = {
|
|
84
|
-
getSchema
|
|
85
|
-
};
|
|
86
|
-
return lookup;
|
|
87
|
-
function getSchema(schemaId) {
|
|
88
|
-
const fields = schemaMap[schemaId];
|
|
89
|
-
if (fields) {
|
|
90
|
-
return rootSchemaNode(fields, lookup);
|
|
91
|
-
}
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function makeSchemaDataNode(schema, control, parent, elementIndex) {
|
|
96
|
-
const indexId = typeof elementIndex === "number" ? "/" + elementIndex : "";
|
|
97
|
-
const dataNode = {
|
|
98
|
-
id: (parent ? parent.id + "/" + schema.field.field : schema.field.field) + indexId,
|
|
99
|
-
schema,
|
|
100
|
-
control,
|
|
101
|
-
parent,
|
|
102
|
-
elementIndex,
|
|
103
|
-
getChild,
|
|
104
|
-
getChildElement
|
|
105
|
-
};
|
|
106
|
-
return dataNode;
|
|
107
|
-
function getChild(childNode) {
|
|
108
|
-
const objControl = control;
|
|
109
|
-
if (objControl && objControl.current.isNull) {
|
|
110
|
-
objControl.value = {};
|
|
111
|
-
}
|
|
112
|
-
return makeSchemaDataNode(childNode, objControl == null ? void 0 : objControl.fields[childNode.field.field], dataNode);
|
|
113
|
-
}
|
|
114
|
-
function getChildElement(elementIndex) {
|
|
115
|
-
var _control$elements;
|
|
116
|
-
return makeSchemaDataNode(schema, control == null || (_control$elements = control.elements) == null ? void 0 : _control$elements[elementIndex], dataNode, elementIndex);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function schemaDataForFieldRef(fieldRef, schema) {
|
|
120
|
-
var _fieldRef$split;
|
|
121
|
-
return schemaDataForFieldPath((_fieldRef$split = fieldRef == null ? void 0 : fieldRef.split("/")) != null ? _fieldRef$split : [], schema);
|
|
122
|
-
}
|
|
123
|
-
function schemaForFieldRef(fieldRef, schema) {
|
|
124
|
-
var _fieldRef$split2;
|
|
125
|
-
return schemaForFieldPath((_fieldRef$split2 = fieldRef == null ? void 0 : fieldRef.split("/")) != null ? _fieldRef$split2 : [], schema);
|
|
126
|
-
}
|
|
127
|
-
function traverseSchemaPath(fieldPath, schema, acc, next) {
|
|
128
|
-
let i = 0;
|
|
129
|
-
while (i < fieldPath.length) {
|
|
130
|
-
const nextField = fieldPath[i];
|
|
131
|
-
let childNode = nextField === ".." ? schema.parent : schema.getChildNode(nextField);
|
|
132
|
-
if (!childNode) {
|
|
133
|
-
childNode = nodeForSchema(missingField(nextField), schema, schema);
|
|
134
|
-
}
|
|
135
|
-
acc = next(acc, childNode);
|
|
136
|
-
schema = childNode;
|
|
137
|
-
i++;
|
|
138
|
-
}
|
|
139
|
-
return acc;
|
|
140
|
-
}
|
|
141
|
-
function traverseData(fieldPath, root, data) {
|
|
142
|
-
return traverseSchemaPath(fieldPath, root, data, (acc, n) => acc == null ? void 0 : acc[n.field.field]);
|
|
143
|
-
}
|
|
144
|
-
function schemaDataForFieldPath(fieldPath, dataNode) {
|
|
145
|
-
let i = 0;
|
|
146
|
-
while (i < fieldPath.length) {
|
|
147
|
-
var _nextNode;
|
|
148
|
-
const nextField = fieldPath[i];
|
|
149
|
-
let nextNode = nextField === ".." ? dataNode.parent : lookupField(nextField);
|
|
150
|
-
(_nextNode = nextNode) != null ? _nextNode : nextNode = makeSchemaDataNode(nodeForSchema(missingField(nextField), dataNode.schema, dataNode.schema), newControl(undefined));
|
|
151
|
-
dataNode = nextNode;
|
|
152
|
-
i++;
|
|
153
|
-
}
|
|
154
|
-
return dataNode;
|
|
155
|
-
function lookupField(field) {
|
|
156
|
-
const childNode = dataNode.schema.getChildNode(field);
|
|
157
|
-
if (childNode) {
|
|
158
|
-
return dataNode.getChild(childNode);
|
|
159
|
-
}
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function schemaForFieldPath(fieldPath, schema) {
|
|
164
|
-
let i = 0;
|
|
165
|
-
while (i < fieldPath.length) {
|
|
166
|
-
const nextField = fieldPath[i];
|
|
167
|
-
let childNode = nextField === ".." ? schema.parent : schema.getChildNode(nextField);
|
|
168
|
-
if (!childNode) {
|
|
169
|
-
childNode = nodeForSchema(missingField(nextField), schema, schema);
|
|
170
|
-
}
|
|
171
|
-
schema = childNode;
|
|
172
|
-
i++;
|
|
173
|
-
}
|
|
174
|
-
return schema;
|
|
175
|
-
}
|
|
176
|
-
function rootSchemaNode(fields, lookup = {
|
|
177
|
-
getSchema(schemaId) {
|
|
178
|
-
return undefined;
|
|
179
|
-
}
|
|
180
|
-
}) {
|
|
181
|
-
return nodeForSchema({
|
|
182
|
-
type: FieldType.Compound,
|
|
183
|
-
field: "",
|
|
184
|
-
children: fields
|
|
185
|
-
}, lookup, undefined);
|
|
186
|
-
}
|
|
187
|
-
function getSchemaNodePath(node) {
|
|
188
|
-
const paths = [];
|
|
189
|
-
let curNode = node;
|
|
190
|
-
while (curNode) {
|
|
191
|
-
paths.push(curNode.field.field);
|
|
192
|
-
curNode = curNode.parent;
|
|
193
|
-
}
|
|
194
|
-
return paths.reverse();
|
|
195
|
-
}
|
|
196
|
-
function isCompoundNode(node) {
|
|
197
|
-
return isCompoundField(node.field);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Returns the relative path from a parent node to a child node.
|
|
201
|
-
* @param parent
|
|
202
|
-
* @param child
|
|
203
|
-
*/
|
|
204
|
-
function relativePath(parent, child) {
|
|
205
|
-
// return the path from child to parent
|
|
206
|
-
if (parent.id === child.id) return "";
|
|
207
|
-
const parentPath = getSchemaNodePath(parent);
|
|
208
|
-
const childPath = getSchemaNodePath(child);
|
|
209
|
-
let i = 0;
|
|
210
|
-
while (i < parentPath.length && i < childPath.length && parentPath[i] === childPath[i]) {
|
|
211
|
-
i++;
|
|
212
|
-
}
|
|
213
|
-
const upLevels = parentPath.length - i;
|
|
214
|
-
const downPath = childPath.slice(i).join("/");
|
|
215
|
-
return "../".repeat(upLevels) + downPath;
|
|
216
|
-
}
|
|
217
|
-
var SchemaTags;
|
|
218
|
-
(function (SchemaTags) {
|
|
219
|
-
SchemaTags["NoControl"] = "_NoControl";
|
|
220
|
-
SchemaTags["HtmlEditor"] = "_HtmlEditor";
|
|
221
|
-
SchemaTags["ControlGroup"] = "_ControlGroup:";
|
|
222
|
-
SchemaTags["ControlRef"] = "_ControlRef:";
|
|
223
|
-
SchemaTags["IdField"] = "_IdField:";
|
|
224
|
-
})(SchemaTags || (SchemaTags = {}));
|
|
225
|
-
function getTagParam(field, tag) {
|
|
226
|
-
var _field$tags;
|
|
227
|
-
return (_field$tags = field.tags) == null || (_field$tags = _field$tags.find(x => x.startsWith(tag))) == null ? void 0 : _field$tags.substring(tag.length);
|
|
228
|
-
}
|
|
229
|
-
function makeParamTag(tag, value) {
|
|
230
|
-
return `${tag}${value}`;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
var ControlDefinitionType;
|
|
234
|
-
(function (ControlDefinitionType) {
|
|
235
|
-
ControlDefinitionType["Data"] = "Data";
|
|
236
|
-
ControlDefinitionType["Group"] = "Group";
|
|
237
|
-
ControlDefinitionType["Display"] = "Display";
|
|
238
|
-
ControlDefinitionType["Action"] = "Action";
|
|
239
|
-
})(ControlDefinitionType || (ControlDefinitionType = {}));
|
|
240
|
-
var DynamicPropertyType;
|
|
241
|
-
(function (DynamicPropertyType) {
|
|
242
|
-
DynamicPropertyType["Visible"] = "Visible";
|
|
243
|
-
DynamicPropertyType["DefaultValue"] = "DefaultValue";
|
|
244
|
-
DynamicPropertyType["Readonly"] = "Readonly";
|
|
245
|
-
DynamicPropertyType["Disabled"] = "Disabled";
|
|
246
|
-
DynamicPropertyType["Display"] = "Display";
|
|
247
|
-
DynamicPropertyType["Style"] = "Style";
|
|
248
|
-
DynamicPropertyType["LayoutStyle"] = "LayoutStyle";
|
|
249
|
-
DynamicPropertyType["AllowedOptions"] = "AllowedOptions";
|
|
250
|
-
DynamicPropertyType["Label"] = "Label";
|
|
251
|
-
DynamicPropertyType["ActionData"] = "ActionData";
|
|
252
|
-
})(DynamicPropertyType || (DynamicPropertyType = {}));
|
|
253
|
-
var AdornmentPlacement;
|
|
254
|
-
(function (AdornmentPlacement) {
|
|
255
|
-
AdornmentPlacement["ControlStart"] = "ControlStart";
|
|
256
|
-
AdornmentPlacement["ControlEnd"] = "ControlEnd";
|
|
257
|
-
AdornmentPlacement["LabelStart"] = "LabelStart";
|
|
258
|
-
AdornmentPlacement["LabelEnd"] = "LabelEnd";
|
|
259
|
-
})(AdornmentPlacement || (AdornmentPlacement = {}));
|
|
260
|
-
var ControlAdornmentType;
|
|
261
|
-
(function (ControlAdornmentType) {
|
|
262
|
-
ControlAdornmentType["Tooltip"] = "Tooltip";
|
|
263
|
-
ControlAdornmentType["Accordion"] = "Accordion";
|
|
264
|
-
ControlAdornmentType["HelpText"] = "HelpText";
|
|
265
|
-
ControlAdornmentType["Icon"] = "Icon";
|
|
266
|
-
ControlAdornmentType["SetField"] = "SetField";
|
|
267
|
-
ControlAdornmentType["Optional"] = "Optional";
|
|
268
|
-
})(ControlAdornmentType || (ControlAdornmentType = {}));
|
|
269
|
-
var DataRenderType;
|
|
270
|
-
(function (DataRenderType) {
|
|
271
|
-
DataRenderType["Standard"] = "Standard";
|
|
272
|
-
DataRenderType["Textfield"] = "Textfield";
|
|
273
|
-
DataRenderType["Radio"] = "Radio";
|
|
274
|
-
DataRenderType["HtmlEditor"] = "HtmlEditor";
|
|
275
|
-
DataRenderType["IconList"] = "IconList";
|
|
276
|
-
DataRenderType["CheckList"] = "CheckList";
|
|
277
|
-
DataRenderType["UserSelection"] = "UserSelection";
|
|
278
|
-
DataRenderType["Synchronised"] = "Synchronised";
|
|
279
|
-
DataRenderType["IconSelector"] = "IconSelector";
|
|
280
|
-
DataRenderType["DateTime"] = "DateTime";
|
|
281
|
-
DataRenderType["Checkbox"] = "Checkbox";
|
|
282
|
-
DataRenderType["Dropdown"] = "Dropdown";
|
|
283
|
-
DataRenderType["DisplayOnly"] = "DisplayOnly";
|
|
284
|
-
DataRenderType["Group"] = "Group";
|
|
285
|
-
DataRenderType["NullToggle"] = "NullToggle";
|
|
286
|
-
DataRenderType["Autocomplete"] = "Autocomplete";
|
|
287
|
-
DataRenderType["Jsonata"] = "Jsonata";
|
|
288
|
-
DataRenderType["Array"] = "Array";
|
|
289
|
-
DataRenderType["ArrayElement"] = "ArrayElement";
|
|
290
|
-
})(DataRenderType || (DataRenderType = {}));
|
|
291
|
-
var SyncTextType;
|
|
292
|
-
(function (SyncTextType) {
|
|
293
|
-
SyncTextType["Camel"] = "Camel";
|
|
294
|
-
SyncTextType["Snake"] = "Snake";
|
|
295
|
-
SyncTextType["Pascal"] = "Pascal";
|
|
296
|
-
})(SyncTextType || (SyncTextType = {}));
|
|
297
|
-
var GroupRenderType;
|
|
298
|
-
(function (GroupRenderType) {
|
|
299
|
-
GroupRenderType["Standard"] = "Standard";
|
|
300
|
-
GroupRenderType["Grid"] = "Grid";
|
|
301
|
-
GroupRenderType["Flex"] = "Flex";
|
|
302
|
-
GroupRenderType["Tabs"] = "Tabs";
|
|
303
|
-
GroupRenderType["GroupElement"] = "GroupElement";
|
|
304
|
-
GroupRenderType["SelectChild"] = "SelectChild";
|
|
305
|
-
})(GroupRenderType || (GroupRenderType = {}));
|
|
306
|
-
var DisplayDataType;
|
|
307
|
-
(function (DisplayDataType) {
|
|
308
|
-
DisplayDataType["Text"] = "Text";
|
|
309
|
-
DisplayDataType["Html"] = "Html";
|
|
310
|
-
DisplayDataType["Icon"] = "Icon";
|
|
311
|
-
DisplayDataType["Custom"] = "Custom";
|
|
312
|
-
})(DisplayDataType || (DisplayDataType = {}));
|
|
313
|
-
function visitControlDefinition(x, visitor, defaultValue) {
|
|
314
|
-
switch (x.type) {
|
|
315
|
-
case ControlDefinitionType.Action:
|
|
316
|
-
return visitor.action(x);
|
|
317
|
-
case ControlDefinitionType.Data:
|
|
318
|
-
return visitor.data(x);
|
|
319
|
-
case ControlDefinitionType.Display:
|
|
320
|
-
return visitor.display(x);
|
|
321
|
-
case ControlDefinitionType.Group:
|
|
322
|
-
return visitor.group(x);
|
|
323
|
-
default:
|
|
324
|
-
return defaultValue(x);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
function isGridRenderer(options) {
|
|
328
|
-
return options.type === GroupRenderType.Grid;
|
|
329
|
-
}
|
|
330
|
-
function isSelectChildRenderer(options) {
|
|
331
|
-
return options.type === GroupRenderType.SelectChild;
|
|
332
|
-
}
|
|
333
|
-
function isTabsRenderer(options) {
|
|
334
|
-
return options.type === GroupRenderType.Tabs;
|
|
335
|
-
}
|
|
336
|
-
function isFlexRenderer(options) {
|
|
337
|
-
return options.type === GroupRenderType.Flex;
|
|
338
|
-
}
|
|
339
|
-
function isDisplayOnlyRenderer(options) {
|
|
340
|
-
return options.type === DataRenderType.DisplayOnly;
|
|
341
|
-
}
|
|
342
|
-
function isTextfieldRenderer(options) {
|
|
343
|
-
return options.type === DataRenderType.Textfield;
|
|
344
|
-
}
|
|
345
|
-
function isDateTimeRenderer(options) {
|
|
346
|
-
return options.type === DataRenderType.DateTime;
|
|
347
|
-
}
|
|
348
|
-
function isAutocompleteRenderer(options) {
|
|
349
|
-
return options.type === DataRenderType.Autocomplete;
|
|
350
|
-
}
|
|
351
|
-
function isAutoCompleteClasses(options) {
|
|
352
|
-
switch (options == null ? void 0 : options.type) {
|
|
353
|
-
case DataRenderType.Autocomplete:
|
|
354
|
-
return true;
|
|
355
|
-
default:
|
|
356
|
-
return false;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
function isDataGroupRenderer(options) {
|
|
360
|
-
return (options == null ? void 0 : options.type) === DataRenderType.Group;
|
|
361
|
-
}
|
|
362
|
-
function isArrayRenderer(options) {
|
|
363
|
-
return options.type === DataRenderType.Array;
|
|
364
|
-
}
|
|
365
|
-
function isDataControl(c) {
|
|
366
|
-
return c.type === ControlDefinitionType.Data;
|
|
367
|
-
}
|
|
368
|
-
function isGroupControl(c) {
|
|
369
|
-
return c.type === ControlDefinitionType.Group;
|
|
370
|
-
}
|
|
371
|
-
function isActionControl(c) {
|
|
372
|
-
return c.type === ControlDefinitionType.Action;
|
|
373
|
-
}
|
|
374
|
-
function isDisplayControl(c) {
|
|
375
|
-
return c.type === ControlDefinitionType.Display;
|
|
376
|
-
}
|
|
377
|
-
function isCheckEntryClasses(options) {
|
|
378
|
-
switch (options == null ? void 0 : options.type) {
|
|
379
|
-
case DataRenderType.Radio:
|
|
380
|
-
case DataRenderType.CheckList:
|
|
381
|
-
return true;
|
|
382
|
-
default:
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
class FormNodeImpl {
|
|
387
|
-
constructor(id, definition, tree, parent) {
|
|
388
|
-
this.id = void 0;
|
|
389
|
-
this.definition = void 0;
|
|
390
|
-
this.tree = void 0;
|
|
391
|
-
this.parent = void 0;
|
|
392
|
-
this.children = [];
|
|
393
|
-
this.id = id;
|
|
394
|
-
this.definition = definition;
|
|
395
|
-
this.tree = tree;
|
|
396
|
-
this.parent = parent;
|
|
397
|
-
}
|
|
398
|
-
getChildNodes() {
|
|
399
|
-
return this.children;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
class FormTree {
|
|
403
|
-
createTempNode(id, definition, children, parent) {
|
|
404
|
-
const tempNode = {
|
|
405
|
-
id,
|
|
406
|
-
definition,
|
|
407
|
-
tree: this,
|
|
408
|
-
parent,
|
|
409
|
-
getChildNodes: () => children != null ? children : this.createChildNodes(tempNode, definition.children)
|
|
410
|
-
};
|
|
411
|
-
return tempNode;
|
|
412
|
-
}
|
|
413
|
-
createChildNodes(parent, definitions) {
|
|
414
|
-
var _definitions$map;
|
|
415
|
-
return (_definitions$map = definitions == null ? void 0 : definitions.map((x, i) => this.createTempNode(parent.id + "_" + i, x, undefined, parent))) != null ? _definitions$map : [];
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
class FormTreeImpl extends FormTree {
|
|
419
|
-
constructor(forms) {
|
|
420
|
-
super();
|
|
421
|
-
this.forms = void 0;
|
|
422
|
-
this.controlMap = {};
|
|
423
|
-
this.rootNode = void 0;
|
|
424
|
-
this.idCount = 1;
|
|
425
|
-
this.forms = forms;
|
|
426
|
-
this.rootNode = new FormNodeImpl("", {
|
|
427
|
-
type: "Group"
|
|
428
|
-
}, this);
|
|
429
|
-
}
|
|
430
|
-
getByRefId(id) {
|
|
431
|
-
return this.controlMap[id];
|
|
432
|
-
}
|
|
433
|
-
register(node) {
|
|
434
|
-
this.controlMap[node.id] = node;
|
|
435
|
-
node.getChildNodes().forEach(x => this.register(x));
|
|
436
|
-
}
|
|
437
|
-
addChild(parent, control) {
|
|
438
|
-
var _control$children;
|
|
439
|
-
const node = new FormNodeImpl(control.id ? control.id : "c" + this.idCount++, control, this, parent);
|
|
440
|
-
(_control$children = control.children) == null || _control$children.forEach(x => this.addChild(node, x));
|
|
441
|
-
parent.getChildNodes().push(node);
|
|
442
|
-
this.register(node);
|
|
443
|
-
return node;
|
|
444
|
-
}
|
|
445
|
-
getForm(formId) {
|
|
446
|
-
return this.forms.getForm(formId);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
function legacyFormNode(definition) {
|
|
450
|
-
return createFormTree([definition]).rootNode.getChildNodes()[0];
|
|
451
|
-
}
|
|
452
|
-
function createFormTree(controls, getForm = {
|
|
453
|
-
getForm: () => undefined
|
|
454
|
-
}) {
|
|
455
|
-
const tree = new FormTreeImpl(getForm);
|
|
456
|
-
controls.forEach(x => tree.addChild(tree.rootNode, x));
|
|
457
|
-
return tree;
|
|
458
|
-
}
|
|
459
|
-
function createFormLookup(formMap) {
|
|
460
|
-
const lookup = {
|
|
461
|
-
getForm
|
|
462
|
-
};
|
|
463
|
-
const forms = Object.fromEntries(Object.entries(formMap).map(([k, v]) => [k, createFormTree(v, lookup)]));
|
|
464
|
-
return lookup;
|
|
465
|
-
function getForm(formId) {
|
|
466
|
-
return forms[formId];
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
function fieldPathForDefinition(c) {
|
|
470
|
-
const fieldName = isGroupControl(c) ? c.compoundField : isDataControl(c) ? c.field : undefined;
|
|
471
|
-
return fieldName == null ? void 0 : fieldName.split("/");
|
|
472
|
-
}
|
|
473
|
-
function lookupDataNode(c, parentNode) {
|
|
474
|
-
const fieldNamePath = fieldPathForDefinition(c);
|
|
475
|
-
return fieldNamePath ? schemaDataForFieldPath(fieldNamePath, parentNode) : undefined;
|
|
476
|
-
}
|
|
477
|
-
function traverseParents(current, get, until) {
|
|
478
|
-
let outArray = [];
|
|
479
|
-
while (current && !(until != null && until(current))) {
|
|
480
|
-
outArray.push(get(current));
|
|
481
|
-
current = current.parent;
|
|
482
|
-
}
|
|
483
|
-
return outArray.reverse();
|
|
484
|
-
}
|
|
485
|
-
function getRootDataNode(dataNode) {
|
|
486
|
-
while (dataNode.parent) {
|
|
487
|
-
dataNode = dataNode.parent;
|
|
488
|
-
}
|
|
489
|
-
return dataNode;
|
|
490
|
-
}
|
|
491
|
-
function getJsonPath(dataNode) {
|
|
492
|
-
return traverseParents(dataNode, d => d.elementIndex == null ? d.schema.field.field : d.elementIndex, x => !x.parent);
|
|
493
|
-
}
|
|
494
|
-
function getSchemaPath(schemaNode) {
|
|
495
|
-
return traverseParents(schemaNode, d => d.field, x => !x.parent);
|
|
496
|
-
}
|
|
497
|
-
function getSchemaFieldList(schema) {
|
|
498
|
-
return schema.getChildNodes().map(x => x.field);
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* @deprecated use visitFormNodeData instead
|
|
502
|
-
*/
|
|
503
|
-
function visitControlDataArray(controls, context, cb) {
|
|
504
|
-
if (!controls) return undefined;
|
|
505
|
-
for (const c of controls) {
|
|
506
|
-
const r = visitControlData(c, context, cb);
|
|
507
|
-
if (r !== undefined) return r;
|
|
508
|
-
}
|
|
509
|
-
return undefined;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* @deprecated use visitFormDataInContext instead
|
|
513
|
-
*/
|
|
514
|
-
function visitControlData(definition, ctx, cb) {
|
|
515
|
-
return visitFormDataInContext(ctx, legacyFormNode(definition), (n, d) => cb(d, n));
|
|
516
|
-
}
|
|
517
|
-
function visitFormData(node, dataNode, cb, notSelf) {
|
|
518
|
-
const def = node.definition;
|
|
519
|
-
const result = !notSelf && isDataControl(def) ? cb(dataNode, def) : undefined;
|
|
520
|
-
if (result !== undefined) return result;
|
|
521
|
-
if (dataNode.elementIndex == null && dataNode.schema.field.collection) {
|
|
522
|
-
const _l = dataNode.control.elements.length;
|
|
523
|
-
for (let i = 0; i < _l; i++) {
|
|
524
|
-
const elemChild = dataNode.getChildElement(i);
|
|
525
|
-
const elemResult = visitFormData(node, elemChild, cb);
|
|
526
|
-
if (elemResult !== undefined) return elemResult;
|
|
527
|
-
}
|
|
528
|
-
return undefined;
|
|
529
|
-
}
|
|
530
|
-
if (dataNode.control.isNull) return undefined;
|
|
531
|
-
const children = node.getChildNodes();
|
|
532
|
-
const l = children.length;
|
|
533
|
-
for (let i = 0; i < l; i++) {
|
|
534
|
-
const elemResult = visitFormDataInContext(dataNode, children[i], cb);
|
|
535
|
-
if (elemResult !== undefined) return elemResult;
|
|
536
|
-
}
|
|
537
|
-
return undefined;
|
|
538
|
-
}
|
|
539
|
-
function visitFormDataInContext(parentContext, node, cb) {
|
|
540
|
-
const dataNode = lookupDataNode(node.definition, parentContext);
|
|
541
|
-
return visitFormData(node, dataNode != null ? dataNode : parentContext, cb, !dataNode);
|
|
542
|
-
}
|
|
5
|
+
import { getElementIndex, ensureMetaValue, newControl, ControlChange, useControl, createScopedEffect, removeElement, RenderArrayElements, addElement, useComponentTracking } from '@react-typed-forms/core';
|
|
6
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
543
7
|
|
|
544
8
|
function _extends() {
|
|
545
9
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -560,143 +24,6 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
560
24
|
return t;
|
|
561
25
|
}
|
|
562
26
|
|
|
563
|
-
function buildSchema(def) {
|
|
564
|
-
return Object.entries(def).map(x => x[1](x[0]));
|
|
565
|
-
}
|
|
566
|
-
function stringField(displayName, options) {
|
|
567
|
-
return makeScalarField(_extends({
|
|
568
|
-
type: FieldType.String,
|
|
569
|
-
displayName
|
|
570
|
-
}, options));
|
|
571
|
-
}
|
|
572
|
-
function stringOptionsField(displayName, ...options) {
|
|
573
|
-
return makeScalarField({
|
|
574
|
-
type: FieldType.String,
|
|
575
|
-
displayName,
|
|
576
|
-
options
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
function withScalarOptions(options, v) {
|
|
580
|
-
return n => _extends({}, v(n), options);
|
|
581
|
-
}
|
|
582
|
-
function makeScalarField(options) {
|
|
583
|
-
return n => _extends({}, defaultScalarField(n, n), options);
|
|
584
|
-
}
|
|
585
|
-
function makeCompoundField(options) {
|
|
586
|
-
return n => _extends({}, defaultCompoundField(n, n, false), options);
|
|
587
|
-
}
|
|
588
|
-
function intField(displayName, options) {
|
|
589
|
-
return makeScalarField(_extends({
|
|
590
|
-
type: FieldType.Int,
|
|
591
|
-
displayName
|
|
592
|
-
}, options));
|
|
593
|
-
}
|
|
594
|
-
function doubleField(displayName, options) {
|
|
595
|
-
return makeScalarField(_extends({
|
|
596
|
-
type: FieldType.Double,
|
|
597
|
-
displayName
|
|
598
|
-
}, options));
|
|
599
|
-
}
|
|
600
|
-
function dateField(displayName, options) {
|
|
601
|
-
return makeScalarField(_extends({
|
|
602
|
-
type: FieldType.Date,
|
|
603
|
-
displayName
|
|
604
|
-
}, options));
|
|
605
|
-
}
|
|
606
|
-
function timeField(displayName, options) {
|
|
607
|
-
return makeScalarField(_extends({
|
|
608
|
-
type: FieldType.Time,
|
|
609
|
-
displayName
|
|
610
|
-
}, options));
|
|
611
|
-
}
|
|
612
|
-
function dateTimeField(displayName, options) {
|
|
613
|
-
return makeScalarField(_extends({
|
|
614
|
-
type: FieldType.DateTime,
|
|
615
|
-
displayName
|
|
616
|
-
}, options));
|
|
617
|
-
}
|
|
618
|
-
function boolField(displayName, options) {
|
|
619
|
-
return makeScalarField(_extends({
|
|
620
|
-
type: FieldType.Bool,
|
|
621
|
-
displayName
|
|
622
|
-
}, options));
|
|
623
|
-
}
|
|
624
|
-
function compoundField(displayName, fields, other) {
|
|
625
|
-
return field => _extends({}, defaultCompoundField(field, displayName, false), other, {
|
|
626
|
-
children: fields
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
function defaultScalarField(field, displayName) {
|
|
630
|
-
return {
|
|
631
|
-
field,
|
|
632
|
-
displayName,
|
|
633
|
-
type: FieldType.String
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
function defaultCompoundField(field, displayName, collection) {
|
|
637
|
-
return {
|
|
638
|
-
field,
|
|
639
|
-
displayName,
|
|
640
|
-
type: FieldType.Compound,
|
|
641
|
-
collection,
|
|
642
|
-
children: []
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
function mergeField(field, mergeInto) {
|
|
646
|
-
const existing = mergeInto.find(x => x.field === field.field);
|
|
647
|
-
if (existing) {
|
|
648
|
-
return mergeInto.map(x => x !== existing ? x : _extends({}, x, {
|
|
649
|
-
onlyForTypes: mergeTypes(x.onlyForTypes, field.onlyForTypes)
|
|
650
|
-
}));
|
|
651
|
-
}
|
|
652
|
-
return [...mergeInto, field];
|
|
653
|
-
function mergeTypes(f, s) {
|
|
654
|
-
if (!f) return s;
|
|
655
|
-
if (!s) return f;
|
|
656
|
-
const extras = s.filter(x => !f.includes(x));
|
|
657
|
-
return extras.length ? [...f, ...extras] : f;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
function mergeFields(fields, name, value, newFields) {
|
|
661
|
-
const withType = fields.map(x => x.isTypeField ? addFieldOption(x, name, value) : x);
|
|
662
|
-
return newFields.map(x => _extends({}, x, {
|
|
663
|
-
onlyForTypes: [value]
|
|
664
|
-
})).reduce((af, x) => mergeField(x, af), withType);
|
|
665
|
-
}
|
|
666
|
-
function addFieldOption(typeField, name, value) {
|
|
667
|
-
var _typeField$options;
|
|
668
|
-
const options = (_typeField$options = typeField.options) != null ? _typeField$options : [];
|
|
669
|
-
if (options.some(x => x.value === value)) return typeField;
|
|
670
|
-
return _extends({}, typeField, {
|
|
671
|
-
options: [...options, {
|
|
672
|
-
name,
|
|
673
|
-
value
|
|
674
|
-
}]
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
function resolveSchemas(schemaMap) {
|
|
678
|
-
const out = {};
|
|
679
|
-
function resolveSchemaType(type) {
|
|
680
|
-
if (type in out) {
|
|
681
|
-
return out[type];
|
|
682
|
-
}
|
|
683
|
-
const resolvedFields = [];
|
|
684
|
-
out[type] = resolvedFields;
|
|
685
|
-
schemaMap[type].forEach(x => {
|
|
686
|
-
if (isCompoundField(x) && x.schemaRef) {
|
|
687
|
-
resolvedFields.push(_extends({}, x, {
|
|
688
|
-
children: resolveSchemaType(x.schemaRef)
|
|
689
|
-
}));
|
|
690
|
-
} else {
|
|
691
|
-
resolvedFields.push(x);
|
|
692
|
-
}
|
|
693
|
-
});
|
|
694
|
-
return resolvedFields;
|
|
695
|
-
}
|
|
696
|
-
Object.keys(schemaMap).forEach(resolveSchemaType);
|
|
697
|
-
return out;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
27
|
/**
|
|
701
28
|
* Applies default values to the given record based on the provided schema fields.
|
|
702
29
|
* @param v - The record to apply default values to.
|
|
@@ -705,10 +32,9 @@ function resolveSchemas(schemaMap) {
|
|
|
705
32
|
* @returns The record with default values applied.
|
|
706
33
|
*/
|
|
707
34
|
function applyDefaultValues(v, fields, doneSet) {
|
|
708
|
-
var _doneSet;
|
|
709
35
|
if (!v) return defaultValueForFields(fields);
|
|
710
36
|
if (doneSet && doneSet.has(v)) return v;
|
|
711
|
-
|
|
37
|
+
doneSet != null ? doneSet : doneSet = new Set();
|
|
712
38
|
doneSet.add(v);
|
|
713
39
|
const applyValue = fields.filter(x => isCompoundField(x) || !(x.field in v));
|
|
714
40
|
if (!applyValue.length) return v;
|
|
@@ -756,7 +82,8 @@ function defaultValueForField(sf, required) {
|
|
|
756
82
|
const isRequired = !!(required || sf.required);
|
|
757
83
|
if (isCompoundField(sf)) {
|
|
758
84
|
if (isRequired) {
|
|
759
|
-
|
|
85
|
+
var _sf$children;
|
|
86
|
+
const childValue = defaultValueForFields((_sf$children = sf.children) != null ? _sf$children : []);
|
|
760
87
|
return sf.collection ? [childValue] : childValue;
|
|
761
88
|
}
|
|
762
89
|
return sf.notNullable ? sf.collection ? [] : {} : undefined;
|
|
@@ -773,7 +100,8 @@ function defaultValueForField(sf, required) {
|
|
|
773
100
|
*/
|
|
774
101
|
function elementValueForField(sf) {
|
|
775
102
|
if (isCompoundField(sf)) {
|
|
776
|
-
|
|
103
|
+
var _sf$children2;
|
|
104
|
+
return defaultValueForFields((_sf$children2 = sf.children) != null ? _sf$children2 : []);
|
|
777
105
|
}
|
|
778
106
|
return sf.defaultValue;
|
|
779
107
|
}
|
|
@@ -884,34 +212,7 @@ function findNonDataGroups(controls) {
|
|
|
884
212
|
* @returns The control definitions with missing controls added.
|
|
885
213
|
*/
|
|
886
214
|
function addMissingControls(fields, controls, warning) {
|
|
887
|
-
return addMissingControlsForSchema(
|
|
888
|
-
}
|
|
889
|
-
function registerSchemaEntries(formNode, parentSchema) {
|
|
890
|
-
const formToSchema = {};
|
|
891
|
-
const schemaToForm = {};
|
|
892
|
-
function register(node, parentSchema) {
|
|
893
|
-
const c = node.definition;
|
|
894
|
-
const controlPath = fieldPathForDefinition(c);
|
|
895
|
-
let dataSchema = controlPath ? schemaForFieldPath(controlPath, parentSchema) : undefined;
|
|
896
|
-
if (isGroupControl(c) && dataSchema == null) dataSchema = parentSchema;
|
|
897
|
-
if (dataSchema) {
|
|
898
|
-
var _schemaToForm$dataSch;
|
|
899
|
-
formToSchema[node.id] = dataSchema;
|
|
900
|
-
const formNodes = (_schemaToForm$dataSch = schemaToForm[dataSchema.id]) != null ? _schemaToForm$dataSch : [];
|
|
901
|
-
formNodes.push(node);
|
|
902
|
-
schemaToForm[dataSchema.id] = formNodes;
|
|
903
|
-
}
|
|
904
|
-
node.getChildNodes().forEach(x => {
|
|
905
|
-
var _dataSchema;
|
|
906
|
-
return register(x, (_dataSchema = dataSchema) != null ? _dataSchema : parentSchema);
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
register(formNode, parentSchema);
|
|
910
|
-
return {
|
|
911
|
-
formToSchema,
|
|
912
|
-
schemaToForm,
|
|
913
|
-
register
|
|
914
|
-
};
|
|
215
|
+
return addMissingControlsForSchema(createSchemaTree(fields).rootNode, controls, warning);
|
|
915
216
|
}
|
|
916
217
|
/**
|
|
917
218
|
* Adds missing controls to the provided control definitions based on the schema fields.
|
|
@@ -921,60 +222,51 @@ function registerSchemaEntries(formNode, parentSchema) {
|
|
|
921
222
|
* @returns The control definitions with missing controls added.
|
|
922
223
|
*/
|
|
923
224
|
function addMissingControlsForSchema(schema, controls, warning) {
|
|
924
|
-
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
|
|
225
|
+
const controlMap = {};
|
|
226
|
+
const schemaControlMap = {};
|
|
227
|
+
const rootControls = controls.map(c => toControlAndSchema(c, schema));
|
|
228
|
+
const rootSchema = {
|
|
229
|
+
schema,
|
|
230
|
+
children: rootControls
|
|
231
|
+
};
|
|
232
|
+
addSchemaMapEntry("", rootSchema);
|
|
233
|
+
rootControls.forEach(addReferences);
|
|
234
|
+
const fields = schema.getChildNodes();
|
|
235
|
+
fields.forEach(addMissing);
|
|
236
|
+
return rootControls.map(toDefinition);
|
|
928
237
|
function toDefinition(c) {
|
|
929
|
-
const children = c.
|
|
930
|
-
return _extends({}, c.
|
|
238
|
+
const children = c.children.length ? c.children.map(toDefinition) : null;
|
|
239
|
+
return _extends({}, c.control, {
|
|
931
240
|
children
|
|
932
241
|
});
|
|
933
242
|
}
|
|
934
|
-
}
|
|
935
|
-
/**
|
|
936
|
-
* Adds missing controls to the provided form tree based on the schema fields.
|
|
937
|
-
* @param schema - The root schema node to use for adding missing controls.
|
|
938
|
-
* @param tree - The form tree to add missing controls to.
|
|
939
|
-
* @param warning - An optional function to call with warning messages.
|
|
940
|
-
*/
|
|
941
|
-
function addMissingControlsToForm(schema, tree, warning) {
|
|
942
|
-
const {
|
|
943
|
-
formToSchema,
|
|
944
|
-
schemaToForm,
|
|
945
|
-
register
|
|
946
|
-
} = registerSchemaEntries(tree.rootNode, schema);
|
|
947
|
-
schema.getChildNodes().forEach(addMissing);
|
|
948
|
-
return;
|
|
949
243
|
function addMissing(schemaNode) {
|
|
950
244
|
if (fieldHasTag(schemaNode.field, SchemaTags.NoControl)) return;
|
|
951
245
|
let skipChildren = false;
|
|
952
|
-
const existingControls =
|
|
246
|
+
const existingControls = schemaControlMap[schemaNode.id];
|
|
953
247
|
if (!existingControls) {
|
|
954
248
|
const eligibleParents = getEligibleParents(schemaNode);
|
|
955
249
|
const desiredGroup = getTagParam(schemaNode.field, SchemaTags.ControlGroup);
|
|
956
|
-
let parentGroup = desiredGroup ?
|
|
250
|
+
let parentGroup = desiredGroup ? controlMap[desiredGroup] : undefined;
|
|
957
251
|
if (!parentGroup && desiredGroup) warning == null || warning("No group '" + desiredGroup + "' for " + schemaNode.id);
|
|
958
|
-
if (parentGroup && eligibleParents.indexOf(
|
|
252
|
+
if (parentGroup && eligibleParents.indexOf(parentGroup.schema.id) < 0) {
|
|
959
253
|
warning == null || warning(`Target group '${desiredGroup}' is not an eligible parent for '${schemaNode.id}'`);
|
|
960
254
|
parentGroup = undefined;
|
|
961
255
|
}
|
|
962
256
|
if (!parentGroup && eligibleParents.length) {
|
|
963
|
-
var
|
|
964
|
-
parentGroup = (
|
|
257
|
+
var _schemaControlMap$eli;
|
|
258
|
+
parentGroup = (_schemaControlMap$eli = schemaControlMap[eligibleParents[0]]) == null ? void 0 : _schemaControlMap$eli[0];
|
|
965
259
|
}
|
|
966
260
|
if (parentGroup) {
|
|
967
261
|
const newControl = defaultControlForField(schemaNode.field, true);
|
|
968
262
|
skipChildren = !!newControl.childRefId;
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
const newNode = tree.addChild(parentGroup, newControl);
|
|
972
|
-
register(newNode, parentSchemaNode);
|
|
263
|
+
newControl.field = relativePath(parentGroup.schema, schemaNode);
|
|
264
|
+
parentGroup.children.push(toControlAndSchema(newControl, parentGroup.schema, parentGroup));
|
|
973
265
|
} else warning == null || warning("Could not find a parent group for: " + schemaNode.id);
|
|
974
266
|
} else {
|
|
975
|
-
skipChildren = existingControls.some(x => x.
|
|
267
|
+
skipChildren = existingControls.some(x => x.control.childRefId);
|
|
976
268
|
}
|
|
977
|
-
if (!skipChildren) schemaNode.getChildNodes(
|
|
269
|
+
if (!skipChildren) schemaNode.getChildNodes().forEach(addMissing);
|
|
978
270
|
}
|
|
979
271
|
function getEligibleParents(schemaNode) {
|
|
980
272
|
const eligibleParents = [];
|
|
@@ -982,17 +274,50 @@ function addMissingControlsToForm(schema, tree, warning) {
|
|
|
982
274
|
while (parent) {
|
|
983
275
|
eligibleParents.push(parent.id);
|
|
984
276
|
if (parent.field.collection) break;
|
|
985
|
-
if (!parent.parent) parent.getChildNodes(
|
|
277
|
+
if (!parent.parent) parent.getChildNodes().forEach(addCompound);
|
|
986
278
|
parent = parent.parent;
|
|
987
279
|
}
|
|
988
280
|
return eligibleParents;
|
|
989
281
|
function addCompound(node) {
|
|
990
282
|
if (isCompoundNode(node) && !node.field.collection) {
|
|
991
283
|
eligibleParents.push(node.id);
|
|
992
|
-
node.getChildNodes(
|
|
284
|
+
node.getChildNodes().forEach(addCompound);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function addReferences(c) {
|
|
289
|
+
c.children.forEach(addReferences);
|
|
290
|
+
if (c.control.childRefId) {
|
|
291
|
+
const ref = controlMap[c.control.childRefId];
|
|
292
|
+
if (ref) {
|
|
293
|
+
ref.children.forEach(x => toControlAndSchema(x.control, c.schema, c, true));
|
|
294
|
+
return;
|
|
993
295
|
}
|
|
296
|
+
console.warn("Missing reference", c.control.childRefId);
|
|
994
297
|
}
|
|
995
298
|
}
|
|
299
|
+
function addSchemaMapEntry(schemaId, entry) {
|
|
300
|
+
if (!schemaControlMap[schemaId]) schemaControlMap[schemaId] = [];
|
|
301
|
+
schemaControlMap[schemaId].push(entry);
|
|
302
|
+
}
|
|
303
|
+
function toControlAndSchema(c, parentSchema, parentNode, dontRegister) {
|
|
304
|
+
var _c$children$map, _c$children;
|
|
305
|
+
const controlPath = fieldPathForDefinition(c);
|
|
306
|
+
let dataSchema = controlPath ? schemaForFieldPath(controlPath, parentSchema) : undefined;
|
|
307
|
+
if (isGroupControl(c) && dataSchema == null) dataSchema = parentSchema;
|
|
308
|
+
const entry = {
|
|
309
|
+
schema: dataSchema,
|
|
310
|
+
control: c,
|
|
311
|
+
children: [],
|
|
312
|
+
parent: parentNode
|
|
313
|
+
};
|
|
314
|
+
entry.children = (_c$children$map = (_c$children = c.children) == null ? void 0 : _c$children.map(x => toControlAndSchema(x, dataSchema != null ? dataSchema : parentSchema, entry, dontRegister))) != null ? _c$children$map : [];
|
|
315
|
+
if (!dontRegister && c.id) controlMap[c.id] = entry;
|
|
316
|
+
if (dataSchema) {
|
|
317
|
+
addSchemaMapEntry(dataSchema.id, entry);
|
|
318
|
+
}
|
|
319
|
+
return entry;
|
|
320
|
+
}
|
|
996
321
|
}
|
|
997
322
|
/**
|
|
998
323
|
* Custom hook to use an updated reference.
|
|
@@ -1004,41 +329,19 @@ function useUpdatedRef(a) {
|
|
|
1004
329
|
r.current = a;
|
|
1005
330
|
return r;
|
|
1006
331
|
}
|
|
1007
|
-
/**
|
|
1008
|
-
* Checks if a control definition is readonly.
|
|
1009
|
-
* @param c - The control definition to check.
|
|
1010
|
-
* @returns True if the control definition is readonly, false otherwise.
|
|
1011
|
-
*/
|
|
1012
|
-
function isControlReadonly(c) {
|
|
1013
|
-
return isDataControl(c) && !!c.readonly;
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Checks if a control definition is disabled.
|
|
1017
|
-
* @param c - The control definition to check.
|
|
1018
|
-
* @returns True if the control definition is disabled, false otherwise.
|
|
1019
|
-
*/
|
|
1020
|
-
function isControlDisabled(c) {
|
|
1021
|
-
return isDataControl(c) && !!c.disabled;
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Returns the display-only render options for a control definition.
|
|
1025
|
-
* @param d - The control definition to get the display-only render options for.
|
|
1026
|
-
* @returns The display-only render options, or undefined if not applicable.
|
|
1027
|
-
*/
|
|
1028
|
-
function getDisplayOnlyOptions(d) {
|
|
1029
|
-
return isDataControl(d) && d.renderOptions && isDisplayOnlyRenderer(d.renderOptions) ? d.renderOptions : undefined;
|
|
1030
|
-
}
|
|
1031
332
|
/**
|
|
1032
333
|
* Cleans data for a schema based on the provided schema fields.
|
|
1033
334
|
* @param v - The data to clean.
|
|
1034
|
-
* @param
|
|
335
|
+
* @param schemaNode
|
|
1035
336
|
* @param removeIfDefault - Flag indicating if default values should be removed.
|
|
1036
337
|
* @returns The cleaned data.
|
|
1037
338
|
*/
|
|
1038
|
-
function cleanDataForSchema(v,
|
|
339
|
+
function cleanDataForSchema(v, schemaNode, removeIfDefault) {
|
|
340
|
+
var _fields$find;
|
|
1039
341
|
if (!v) return v;
|
|
1040
|
-
const
|
|
1041
|
-
const
|
|
342
|
+
const fields = schemaNode.getResolvedFields();
|
|
343
|
+
const typeField = (_fields$find = fields.find(x => x.isTypeField)) == null ? void 0 : _fields$find.field;
|
|
344
|
+
const typeValue = typeField ? v[typeField] : undefined;
|
|
1042
345
|
const cleanableFields = !removeIfDefault ? fields.filter(x => {
|
|
1043
346
|
var _x$onlyForTypes$lengt, _x$onlyForTypes;
|
|
1044
347
|
return isCompoundField(x) || ((_x$onlyForTypes$lengt = (_x$onlyForTypes = x.onlyForTypes) == null ? void 0 : _x$onlyForTypes.length) != null ? _x$onlyForTypes$lengt : 0) > 0;
|
|
@@ -1053,13 +356,13 @@ function cleanDataForSchema(v, fields, removeIfDefault) {
|
|
|
1053
356
|
return;
|
|
1054
357
|
}
|
|
1055
358
|
if (isCompoundField(x)) {
|
|
1056
|
-
const
|
|
359
|
+
const childNode = schemaNode.createChildNode(x);
|
|
1057
360
|
if (x.collection) {
|
|
1058
361
|
if (Array.isArray(childValue)) {
|
|
1059
|
-
out[x.field] = childValue.map(cv => cleanDataForSchema(cv,
|
|
362
|
+
out[x.field] = childValue.map(cv => cleanDataForSchema(cv, childNode, removeIfDefault));
|
|
1060
363
|
}
|
|
1061
364
|
} else {
|
|
1062
|
-
out[x.field] = cleanDataForSchema(childValue,
|
|
365
|
+
out[x.field] = cleanDataForSchema(childValue, childNode, removeIfDefault);
|
|
1063
366
|
}
|
|
1064
367
|
}
|
|
1065
368
|
function canBeNull() {
|
|
@@ -1077,45 +380,28 @@ function cleanDataForSchema(v, fields, removeIfDefault) {
|
|
|
1077
380
|
* @returns An array of referenced classes.
|
|
1078
381
|
*/
|
|
1079
382
|
function getAllReferencedClasses(c, collectExtra) {
|
|
1080
|
-
var _c$
|
|
1081
|
-
const childClasses = (_c$
|
|
383
|
+
var _c$children2, _collectExtra;
|
|
384
|
+
const childClasses = (_c$children2 = c.children) == null ? void 0 : _c$children2.flatMap(x => getAllReferencedClasses(x, collectExtra));
|
|
1082
385
|
const go = getGroupClassOverrides(c);
|
|
1083
386
|
const {
|
|
1084
387
|
entryWrapperClass,
|
|
1085
388
|
selectedClass,
|
|
1086
389
|
notSelectedClass
|
|
1087
390
|
} = isDataControl(c) && isCheckEntryClasses(c.renderOptions) ? c.renderOptions : {};
|
|
391
|
+
const groupOptions = isGroupControl(c) ? c.groupOptions : undefined;
|
|
392
|
+
const gridClasses = groupOptions && isGridRenderer(groupOptions) ? [groupOptions.rowClass] : [];
|
|
1088
393
|
const {
|
|
1089
394
|
listContainerClass,
|
|
1090
395
|
listEntryClass,
|
|
1091
396
|
chipContainerClass,
|
|
1092
397
|
chipCloseButtonClass
|
|
1093
398
|
} = isDataControl(c) && isAutoCompleteClasses(c.renderOptions) ? c.renderOptions : {};
|
|
1094
|
-
const tc = clsx([c.styleClass, c.layoutClass, c.labelClass, ...Object.values(go), ...((_collectExtra = collectExtra == null ? void 0 : collectExtra(c)) != null ? _collectExtra : []), entryWrapperClass, selectedClass, notSelectedClass, listContainerClass, listEntryClass, chipContainerClass, chipCloseButtonClass].map(getOverrideClass));
|
|
399
|
+
const tc = clsx([c.styleClass, c.layoutClass, c.labelClass, c.textClass, c.labelTextClass, ...gridClasses, ...Object.values(go), ...((_collectExtra = collectExtra == null ? void 0 : collectExtra(c)) != null ? _collectExtra : []), entryWrapperClass, selectedClass, notSelectedClass, listContainerClass, listEntryClass, chipContainerClass, chipCloseButtonClass].map(getOverrideClass));
|
|
1095
400
|
if (childClasses && !tc) return childClasses;
|
|
1096
401
|
if (!tc) return [];
|
|
1097
402
|
if (childClasses) return [tc, ...childClasses];
|
|
1098
403
|
return [tc];
|
|
1099
404
|
}
|
|
1100
|
-
/**
|
|
1101
|
-
* Converts a JSON path array to a string.
|
|
1102
|
-
* @param jsonPath - The JSON path array to convert.
|
|
1103
|
-
* @param customIndex - Optional function to customize the index format.
|
|
1104
|
-
* @returns The JSON path string.
|
|
1105
|
-
*/
|
|
1106
|
-
function jsonPathString(jsonPath, customIndex) {
|
|
1107
|
-
let out = "";
|
|
1108
|
-
jsonPath.forEach((v, i) => {
|
|
1109
|
-
if (typeof v === "number") {
|
|
1110
|
-
var _customIndex;
|
|
1111
|
-
out += (_customIndex = customIndex == null ? void 0 : customIndex(v)) != null ? _customIndex : "[" + v + "]";
|
|
1112
|
-
} else {
|
|
1113
|
-
if (i > 0) out += ".";
|
|
1114
|
-
out += v;
|
|
1115
|
-
}
|
|
1116
|
-
});
|
|
1117
|
-
return out;
|
|
1118
|
-
}
|
|
1119
405
|
/**
|
|
1120
406
|
* Finds a child control definition within a parent control definition.
|
|
1121
407
|
* @param parent - The parent control definition.
|
|
@@ -1232,14 +518,6 @@ function deepMerge(value, fallback) {
|
|
|
1232
518
|
function coerceToString(v) {
|
|
1233
519
|
return v == null ? "" : typeof v === "object" ? "error: " + JSON.stringify(v) : v.toString();
|
|
1234
520
|
}
|
|
1235
|
-
/**
|
|
1236
|
-
* Returns the group renderer options for a control definition.
|
|
1237
|
-
* @param {ControlDefinition} def - The control definition to get the group renderer options for.
|
|
1238
|
-
* @returns {GroupRenderOptions | undefined} - The group renderer options, or undefined if not applicable.
|
|
1239
|
-
*/
|
|
1240
|
-
function getGroupRendererOptions(def) {
|
|
1241
|
-
return isGroupControl(def) ? def.groupOptions : isDataControl(def) && isDataGroupRenderer(def.renderOptions) ? def.renderOptions.groupOptions : undefined;
|
|
1242
|
-
}
|
|
1243
521
|
/**
|
|
1244
522
|
* Returns the group class overrides for a control definition.
|
|
1245
523
|
* @param {ControlDefinition} def - The control definition to get the group class overrides for.
|
|
@@ -1259,25 +537,17 @@ function getGroupClassOverrides(def) {
|
|
|
1259
537
|
if (childLabelClass) out.labelClass = childLabelClass;
|
|
1260
538
|
return out;
|
|
1261
539
|
}
|
|
1262
|
-
/**
|
|
1263
|
-
* Checks if a control definition is display-only.
|
|
1264
|
-
* @param {ControlDefinition} def - The control definition to check.
|
|
1265
|
-
* @returns {boolean} - True if the control definition is display-only, false otherwise.
|
|
1266
|
-
*/
|
|
1267
|
-
function isControlDisplayOnly(def) {
|
|
1268
|
-
var _getGroupRendererOpti;
|
|
1269
|
-
return Boolean((_getGroupRendererOpti = getGroupRendererOptions(def)) == null ? void 0 : _getGroupRendererOpti.displayOnly);
|
|
1270
|
-
}
|
|
1271
540
|
/**
|
|
1272
541
|
* Combines multiple action handlers into a single handler.
|
|
1273
542
|
* @param {...(ControlActionHandler | undefined)[]} handlers - The action handlers to combine.
|
|
1274
543
|
* @returns {ControlActionHandler} - The combined action handler.
|
|
1275
544
|
*/
|
|
1276
545
|
function actionHandlers(...handlers) {
|
|
546
|
+
const nonNullHandlers = handlers.filter(x => x != null);
|
|
547
|
+
if (nonNullHandlers.length === 0) return undefined;
|
|
1277
548
|
return (actionId, actionData, ctx) => {
|
|
1278
|
-
for (let i = 0; i <
|
|
1279
|
-
|
|
1280
|
-
const res = (_handlers$i = handlers[i]) == null ? void 0 : _handlers$i.call(handlers, actionId, actionData, ctx);
|
|
549
|
+
for (let i = 0; i < nonNullHandlers.length; i++) {
|
|
550
|
+
const res = nonNullHandlers[i](actionId, actionData, ctx);
|
|
1281
551
|
if (res) return res;
|
|
1282
552
|
}
|
|
1283
553
|
return undefined;
|
|
@@ -1323,6 +593,9 @@ function getNullToggler(c) {
|
|
|
1323
593
|
c.value = currentNotNull ? lastDefined.current.value : null;
|
|
1324
594
|
c.disabled = !currentNotNull;
|
|
1325
595
|
}, ControlChange.Value);
|
|
596
|
+
c.subscribe(() => {
|
|
597
|
+
notNull.value = c.current.value != null;
|
|
598
|
+
}, ControlChange.Value);
|
|
1326
599
|
return notNull;
|
|
1327
600
|
function disableIfNotEditing() {
|
|
1328
601
|
notNull.disabled = isEditing.current.value === false;
|
|
@@ -1358,6 +631,20 @@ function getIsEditing(control) {
|
|
|
1358
631
|
function getAllValues(control) {
|
|
1359
632
|
return ensureMetaValue(control, "$allValues", () => newControl([control.value]));
|
|
1360
633
|
}
|
|
634
|
+
function clearMultiValues(dataNode) {
|
|
635
|
+
const c = dataNode.control;
|
|
636
|
+
const sf = dataNode.schema.field;
|
|
637
|
+
if (sf.collection) {
|
|
638
|
+
return;
|
|
639
|
+
} else if (isCompoundField(sf)) {
|
|
640
|
+
dataNode.schema.getChildNodes().forEach(c => {
|
|
641
|
+
clearMultiValues(dataNode.getChild(c));
|
|
642
|
+
});
|
|
643
|
+
} else {
|
|
644
|
+
const allValues = getAllValues(c);
|
|
645
|
+
allValues.setValue(x => [c.current.value]);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
1361
648
|
function applyValues(dataNode, value) {
|
|
1362
649
|
const c = dataNode.control;
|
|
1363
650
|
const sf = dataNode.schema.field;
|
|
@@ -1376,7 +663,10 @@ function applyValues(dataNode, value) {
|
|
|
1376
663
|
}
|
|
1377
664
|
function collectDifferences(dataNode, values) {
|
|
1378
665
|
values.forEach((v, i) => {
|
|
1379
|
-
if (i == 0)
|
|
666
|
+
if (i == 0) {
|
|
667
|
+
dataNode.control.setInitialValue(v);
|
|
668
|
+
clearMultiValues(dataNode);
|
|
669
|
+
} else applyValues(dataNode, v);
|
|
1380
670
|
});
|
|
1381
671
|
const allEdits = [];
|
|
1382
672
|
resetMultiValues(dataNode);
|
|
@@ -1425,28 +715,13 @@ function validationVisitor(onInvalid) {
|
|
|
1425
715
|
return undefined;
|
|
1426
716
|
};
|
|
1427
717
|
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
(
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
}
|
|
1435
|
-
var DateComparison;
|
|
1436
|
-
(function (DateComparison) {
|
|
1437
|
-
DateComparison["NotBefore"] = "NotBefore";
|
|
1438
|
-
DateComparison["NotAfter"] = "NotAfter";
|
|
1439
|
-
})(DateComparison || (DateComparison = {}));
|
|
1440
|
-
|
|
1441
|
-
var ExpressionType;
|
|
1442
|
-
(function (ExpressionType) {
|
|
1443
|
-
ExpressionType["Jsonata"] = "Jsonata";
|
|
1444
|
-
ExpressionType["Data"] = "Data";
|
|
1445
|
-
ExpressionType["DataMatch"] = "FieldValue";
|
|
1446
|
-
ExpressionType["UserMatch"] = "UserMatch";
|
|
1447
|
-
ExpressionType["NotEmpty"] = "NotEmpty";
|
|
1448
|
-
ExpressionType["UUID"] = "UUID";
|
|
1449
|
-
})(ExpressionType || (ExpressionType = {}));
|
|
718
|
+
function useExpression(defaultValue, runExpression, expression, coerce, bindings) {
|
|
719
|
+
const value = useControl(defaultValue);
|
|
720
|
+
createScopedEffect(scope => {
|
|
721
|
+
if (expression != null && expression.type) runExpression(scope, expression, x => value.value = coerce(x), bindings);else value.value = defaultValue;
|
|
722
|
+
}, value);
|
|
723
|
+
return value;
|
|
724
|
+
}
|
|
1450
725
|
|
|
1451
726
|
function dataControl(field, title, options) {
|
|
1452
727
|
return _extends({
|
|
@@ -1609,535 +884,7 @@ function applyExtensionsToSchema(schemaMap, extensions) {
|
|
|
1609
884
|
return resolveSchemas(extensions.reduce(applyExtensionToSchema, schemaMap));
|
|
1610
885
|
}
|
|
1611
886
|
|
|
1612
|
-
|
|
1613
|
-
* Creates a dynamic hook generator.
|
|
1614
|
-
* @template A - The type of the hook result.
|
|
1615
|
-
* @template P - The type of the hook context.
|
|
1616
|
-
* @template S - The type of the hook state.
|
|
1617
|
-
* @param runHook - The function to run the hook.
|
|
1618
|
-
* @param state - The initial state of the hook.
|
|
1619
|
-
* @param deps - The dependencies of the hook.
|
|
1620
|
-
* @returns The dynamic hook generator.
|
|
1621
|
-
*/
|
|
1622
|
-
function makeHook(runHook, state, deps) {
|
|
1623
|
-
return {
|
|
1624
|
-
deps,
|
|
1625
|
-
state,
|
|
1626
|
-
runHook
|
|
1627
|
-
};
|
|
1628
|
-
}
|
|
1629
|
-
/**
|
|
1630
|
-
* Converts an array of dependencies to a dependency string.
|
|
1631
|
-
* @template A - The type of the dependencies.
|
|
1632
|
-
* @param deps - The array of dependencies.
|
|
1633
|
-
* @param asHookDep - The function to convert a dependency to a hook dependency.
|
|
1634
|
-
* @returns The dependency string.
|
|
1635
|
-
*/
|
|
1636
|
-
function makeHookDepString(deps, asHookDep) {
|
|
1637
|
-
return deps.map(x => toDepString(asHookDep(x))).join(",");
|
|
1638
|
-
}
|
|
1639
|
-
/**
|
|
1640
|
-
* Custom hook to use dynamic hooks.
|
|
1641
|
-
* @template P - The type of the hook context.
|
|
1642
|
-
* @template Hooks - The type of the hooks.
|
|
1643
|
-
* @param hooks - The hooks to use.
|
|
1644
|
-
* @returns A function that takes the hook context and returns the hook values.
|
|
1645
|
-
*/
|
|
1646
|
-
function useDynamicHooks(hooks) {
|
|
1647
|
-
const hookEntries = Object.entries(hooks);
|
|
1648
|
-
const deps = makeHookDepString(hookEntries, x => x[1].deps);
|
|
1649
|
-
const ref = useRef({});
|
|
1650
|
-
const s = ref.current;
|
|
1651
|
-
hookEntries.forEach(x => s[x[0]] = x[1].state);
|
|
1652
|
-
return useCallback(p => {
|
|
1653
|
-
return Object.fromEntries(hookEntries.map(([f, hg]) => [f, hg.runHook(p, ref.current[f])]));
|
|
1654
|
-
}, [deps]);
|
|
1655
|
-
}
|
|
1656
|
-
/**
|
|
1657
|
-
* Converts a value to a dependency string.
|
|
1658
|
-
* @param x - The value to convert.
|
|
1659
|
-
* @returns The dependency string.
|
|
1660
|
-
*/
|
|
1661
|
-
function toDepString(x) {
|
|
1662
|
-
if (x === undefined) return "_";
|
|
1663
|
-
if (x === null) return "~";
|
|
1664
|
-
return x.toString();
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
function optionalHook(expr, useHook, coerce) {
|
|
1668
|
-
return expr && expr.type ? useHook(expr, coerce) : undefined;
|
|
1669
|
-
}
|
|
1670
|
-
function useEvalVisibilityHook(useEvalExpressionHook, definition, overrideDataNode) {
|
|
1671
|
-
const dynamicVisibility = useEvalDynamicBoolHook(definition, DynamicPropertyType.Visible, useEvalExpressionHook);
|
|
1672
|
-
return makeDynamicPropertyHook(dynamicVisibility, (ctx, {
|
|
1673
|
-
definition,
|
|
1674
|
-
overrideDataNode
|
|
1675
|
-
}) => useComputed(() => {
|
|
1676
|
-
const dataNode = overrideDataNode != null ? overrideDataNode : ctx.dataNode;
|
|
1677
|
-
return !dataNode || matchesType(dataNode) && !hideDisplayOnly(dataNode, ctx.schemaInterface, definition);
|
|
1678
|
-
}), {
|
|
1679
|
-
definition,
|
|
1680
|
-
overrideDataNode
|
|
1681
|
-
});
|
|
1682
|
-
}
|
|
1683
|
-
function useEvalReadonlyHook(useEvalExpressionHook, definition) {
|
|
1684
|
-
const dynamicReadonly = useEvalDynamicBoolHook(definition, DynamicPropertyType.Readonly, useEvalExpressionHook);
|
|
1685
|
-
return makeDynamicPropertyHook(dynamicReadonly, (ctx, {
|
|
1686
|
-
definition
|
|
1687
|
-
}) => useCalculatedControl(() => isControlReadonly(definition)), {
|
|
1688
|
-
definition
|
|
1689
|
-
});
|
|
1690
|
-
}
|
|
1691
|
-
function useEvalStyleHook(useEvalExpressionHook, property, definition) {
|
|
1692
|
-
const dynamicStyle = useEvalDynamicHook(definition, property, useEvalExpressionHook);
|
|
1693
|
-
return makeDynamicPropertyHook(dynamicStyle, () => useControl(undefined), undefined);
|
|
1694
|
-
}
|
|
1695
|
-
function useEvalAllowedOptionsHook(useEvalExpressionHook, definition) {
|
|
1696
|
-
const dynamicAllowed = useEvalDynamicHook(definition, DynamicPropertyType.AllowedOptions, useEvalExpressionHook);
|
|
1697
|
-
return makeDynamicPropertyHook(dynamicAllowed, () => useControl([]), undefined);
|
|
1698
|
-
}
|
|
1699
|
-
function useEvalDisabledHook(useEvalExpressionHook, definition) {
|
|
1700
|
-
const dynamicDisabled = useEvalDynamicBoolHook(definition, DynamicPropertyType.Disabled, useEvalExpressionHook);
|
|
1701
|
-
return makeDynamicPropertyHook(dynamicDisabled, ctx => useComputed(() => {
|
|
1702
|
-
var _ctx$dataNode, _dataControl$meta$nul;
|
|
1703
|
-
const dataControl = (_ctx$dataNode = ctx.dataNode) == null ? void 0 : _ctx$dataNode.control;
|
|
1704
|
-
const setToNull = (dataControl == null || (_dataControl$meta$nul = dataControl.meta["nullControl"]) == null ? void 0 : _dataControl$meta$nul.value) === false;
|
|
1705
|
-
return setToNull || isControlDisabled(definition);
|
|
1706
|
-
}), undefined);
|
|
1707
|
-
}
|
|
1708
|
-
function useEvalDisplayHook(useEvalExpressionHook, definition) {
|
|
1709
|
-
return useEvalDynamicHook(definition, DynamicPropertyType.Display, useEvalExpressionHook);
|
|
1710
|
-
}
|
|
1711
|
-
function useEvalDefaultValueHook(useEvalExpressionHook, definition) {
|
|
1712
|
-
const dynamicValue = useEvalDynamicHook(definition, DynamicPropertyType.DefaultValue, useEvalExpressionHook);
|
|
1713
|
-
return makeDynamicPropertyHook(dynamicValue, (ctx, {
|
|
1714
|
-
definition
|
|
1715
|
-
}) => {
|
|
1716
|
-
return useComputed(calcDefault);
|
|
1717
|
-
function calcDefault() {
|
|
1718
|
-
var _ctx$dataNode2;
|
|
1719
|
-
const [required, dcv] = isDataControl(definition) ? [definition.required, definition.defaultValue] : [false, undefined];
|
|
1720
|
-
const field = (_ctx$dataNode2 = ctx.dataNode) == null ? void 0 : _ctx$dataNode2.schema.field;
|
|
1721
|
-
return dcv != null ? dcv : field ? ctx.dataNode.elementIndex != null ? elementValueForField(field) : defaultValueForField(field, required) : undefined;
|
|
1722
|
-
}
|
|
1723
|
-
}, {
|
|
1724
|
-
definition
|
|
1725
|
-
});
|
|
1726
|
-
}
|
|
1727
|
-
function useDataExpression(fvExpr, node, coerce = x => x) {
|
|
1728
|
-
const otherField = schemaDataForFieldRef(fvExpr.field, node);
|
|
1729
|
-
return useCalculatedControl(() => {
|
|
1730
|
-
var _otherField$control;
|
|
1731
|
-
return coerce((_otherField$control = otherField.control) == null ? void 0 : _otherField$control.value);
|
|
1732
|
-
});
|
|
1733
|
-
}
|
|
1734
|
-
function useDataMatchExpression(fvExpr, node, coerce = x => x) {
|
|
1735
|
-
const otherField = schemaDataForFieldRef(fvExpr.field, node);
|
|
1736
|
-
return useCalculatedControl(() => {
|
|
1737
|
-
var _otherField$control2;
|
|
1738
|
-
const fv = (_otherField$control2 = otherField.control) == null ? void 0 : _otherField$control2.value;
|
|
1739
|
-
return coerce(Array.isArray(fv) ? fv.includes(fvExpr.value) : fv === fvExpr.value);
|
|
1740
|
-
});
|
|
1741
|
-
}
|
|
1742
|
-
function useNotEmptyExpression(fvExpr, node, schemaInterface, coerce = x => x) {
|
|
1743
|
-
const otherField = schemaDataForFieldRef(fvExpr.field, node);
|
|
1744
|
-
return useCalculatedControl(() => {
|
|
1745
|
-
var _otherField$control3;
|
|
1746
|
-
const fv = (_otherField$control3 = otherField.control) == null ? void 0 : _otherField$control3.value;
|
|
1747
|
-
const field = otherField.schema.field;
|
|
1748
|
-
return coerce(field && !schemaInterface.isEmptyValue(field, fv));
|
|
1749
|
-
});
|
|
1750
|
-
}
|
|
1751
|
-
function defaultEvalHooks(expr, context, coerce) {
|
|
1752
|
-
switch (expr.type) {
|
|
1753
|
-
case ExpressionType.Jsonata:
|
|
1754
|
-
const bindings = useComputed(() => ({
|
|
1755
|
-
formData: context.formData
|
|
1756
|
-
}));
|
|
1757
|
-
return useJsonataExpression(expr.expression, getRootDataNode(context.parentNode).control, getJsonPath(context.parentNode), bindings, coerce);
|
|
1758
|
-
case ExpressionType.UUID:
|
|
1759
|
-
return useUuidExpression(coerce);
|
|
1760
|
-
case ExpressionType.Data:
|
|
1761
|
-
return useDataExpression(expr, context.parentNode, coerce);
|
|
1762
|
-
case ExpressionType.DataMatch:
|
|
1763
|
-
return useDataMatchExpression(expr, context.parentNode, coerce);
|
|
1764
|
-
case ExpressionType.NotEmpty:
|
|
1765
|
-
return useNotEmptyExpression(expr, context.parentNode, context.schemaInterface, coerce);
|
|
1766
|
-
default:
|
|
1767
|
-
return useControl(undefined);
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
const defaultUseEvalExpressionHook = makeEvalExpressionHook(defaultEvalHooks);
|
|
1771
|
-
function makeEvalExpressionHook(f) {
|
|
1772
|
-
return (expr, coerce) => ({
|
|
1773
|
-
deps: expr == null ? void 0 : expr.type,
|
|
1774
|
-
state: expr && expr.type ? expr : undefined,
|
|
1775
|
-
runHook: (ctx, state) => {
|
|
1776
|
-
return state ? f(state, ctx, coerce) : undefined;
|
|
1777
|
-
}
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
function useEvalDynamicBoolHook(definition, type, useEvalExpressionHook) {
|
|
1781
|
-
return useEvalDynamicHook(definition, type, useEvalExpressionHook, x => Boolean(x));
|
|
1782
|
-
}
|
|
1783
|
-
function useEvalDynamicHook(definition, type, useEvalExpressionHook, coerce = x => x) {
|
|
1784
|
-
var _definition$dynamic;
|
|
1785
|
-
const expression = (_definition$dynamic = definition.dynamic) == null ? void 0 : _definition$dynamic.find(x => x.type === type);
|
|
1786
|
-
return useEvalExpressionHook(expression == null ? void 0 : expression.expr, coerce);
|
|
1787
|
-
}
|
|
1788
|
-
function matchesType(context) {
|
|
1789
|
-
const types = context.schema.field.onlyForTypes;
|
|
1790
|
-
if (types == null || types.length === 0) return true;
|
|
1791
|
-
const parent = context.parent;
|
|
1792
|
-
const typeNode = parent.schema.getChildNodes().find(x => x.field.isTypeField);
|
|
1793
|
-
if (typeNode == null) return true;
|
|
1794
|
-
const typeField = parent.getChild(typeNode).control;
|
|
1795
|
-
return typeField && types.includes(typeField.value);
|
|
1796
|
-
}
|
|
1797
|
-
function hideDisplayOnly(context, schemaInterface, definition) {
|
|
1798
|
-
var _context$control;
|
|
1799
|
-
const displayOptions = getDisplayOnlyOptions(definition);
|
|
1800
|
-
return displayOptions && !displayOptions.emptyText && schemaInterface.isEmptyValue(context.schema.field, (_context$control = context.control) == null ? void 0 : _context$control.value);
|
|
1801
|
-
}
|
|
1802
|
-
function useUuidExpression(coerce = x => x) {
|
|
1803
|
-
return useControl(() => coerce(v4()));
|
|
1804
|
-
}
|
|
1805
|
-
function useJsonataExpression(jExpr, data, path, bindings, coerce = x => x) {
|
|
1806
|
-
const pathString = jsonPathString(path, x => `#$i[${x}]`);
|
|
1807
|
-
const fullExpr = pathString ? pathString + ".(" + jExpr + ")" : jExpr;
|
|
1808
|
-
const compiledExpr = useMemo(() => {
|
|
1809
|
-
try {
|
|
1810
|
-
return jsonata(jExpr ? fullExpr : "null");
|
|
1811
|
-
} catch (e) {
|
|
1812
|
-
console.error(e);
|
|
1813
|
-
return jsonata("null");
|
|
1814
|
-
}
|
|
1815
|
-
}, [fullExpr]);
|
|
1816
|
-
const control = useControl();
|
|
1817
|
-
const listenerRef = useRef();
|
|
1818
|
-
const updateRef = useRef(0);
|
|
1819
|
-
const [ref] = useRefState(() => new SubscriptionTracker(() => {
|
|
1820
|
-
const l = listenerRef.current;
|
|
1821
|
-
if (l) {
|
|
1822
|
-
listenerRef.current = undefined;
|
|
1823
|
-
addAfterChangesCallback(() => {
|
|
1824
|
-
listenerRef.current = l;
|
|
1825
|
-
l();
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
1828
|
-
}));
|
|
1829
|
-
useEffect(() => {
|
|
1830
|
-
listenerRef.current = apply;
|
|
1831
|
-
apply();
|
|
1832
|
-
async function apply() {
|
|
1833
|
-
const tracker = ref.current;
|
|
1834
|
-
try {
|
|
1835
|
-
updateRef.current++;
|
|
1836
|
-
control.value = coerce(await compiledExpr.evaluate(trackedValue(data, tracker.collectUsage), collectChanges(tracker.collectUsage, () => bindings == null ? void 0 : bindings.value)));
|
|
1837
|
-
} finally {
|
|
1838
|
-
if (! --updateRef.current) tracker.update();
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
}, [compiledExpr]);
|
|
1842
|
-
useEffect(() => {
|
|
1843
|
-
return () => {
|
|
1844
|
-
listenerRef.current = undefined;
|
|
1845
|
-
ref.current.cleanup();
|
|
1846
|
-
};
|
|
1847
|
-
}, []);
|
|
1848
|
-
return control;
|
|
1849
|
-
}
|
|
1850
|
-
function useEvalActionHook(useExpr, definition) {
|
|
1851
|
-
const dynamicValue = useEvalDynamicHook(definition, DynamicPropertyType.ActionData, useExpr);
|
|
1852
|
-
return makeDynamicPropertyHook(dynamicValue, () => useControl(null), undefined);
|
|
1853
|
-
}
|
|
1854
|
-
function useEvalLabelText(useExpr, definition) {
|
|
1855
|
-
const dynamicValue = useEvalDynamicHook(definition, DynamicPropertyType.Label, useExpr);
|
|
1856
|
-
return makeDynamicPropertyHook(dynamicValue, () => useControl(null), undefined);
|
|
1857
|
-
}
|
|
1858
|
-
function makeDynamicPropertyHook(dynamicValue, makeDefault, state, deps) {
|
|
1859
|
-
return {
|
|
1860
|
-
deps: deps === undefined ? dynamicValue.deps : [deps, dynamicValue.deps].map(toDepString).join(),
|
|
1861
|
-
runHook: (ctx, s) => {
|
|
1862
|
-
var _dynamicValue$runHook, _dynamicValue$runHook2;
|
|
1863
|
-
return (_dynamicValue$runHook = (_dynamicValue$runHook2 = dynamicValue.runHook(ctx, s[0])) == null ? void 0 : _dynamicValue$runHook2.as()) != null ? _dynamicValue$runHook : makeDefault(ctx, s[1]);
|
|
1864
|
-
},
|
|
1865
|
-
state: [dynamicValue.state, state]
|
|
1866
|
-
};
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
function useMakeValidationHook(definition, useValidatorFor = useDefaultValidator) {
|
|
1870
|
-
var _dd$validators;
|
|
1871
|
-
const dd = isDataControl(definition) ? definition : undefined;
|
|
1872
|
-
const refData = useUpdatedRef({
|
|
1873
|
-
dd,
|
|
1874
|
-
useValidatorFor
|
|
1875
|
-
});
|
|
1876
|
-
const depString = dd ? makeHookDepString((_dd$validators = dd.validators) != null ? _dd$validators : [], x => x.type) : "~";
|
|
1877
|
-
return useCallback(ctx => {
|
|
1878
|
-
var _ctx$dataContext$data, _ctx$dataContext$data2, _dd$validators2;
|
|
1879
|
-
const {
|
|
1880
|
-
dd
|
|
1881
|
-
} = refData.current;
|
|
1882
|
-
if (!dd) return;
|
|
1883
|
-
const field = (_ctx$dataContext$data = (_ctx$dataContext$data2 = ctx.dataContext.dataNode) == null ? void 0 : _ctx$dataContext$data2.schema.field) != null ? _ctx$dataContext$data : {
|
|
1884
|
-
field: "__missing",
|
|
1885
|
-
type: FieldType.Any
|
|
1886
|
-
};
|
|
1887
|
-
const {
|
|
1888
|
-
control,
|
|
1889
|
-
hiddenControl,
|
|
1890
|
-
dataContext: {
|
|
1891
|
-
schemaInterface
|
|
1892
|
-
}
|
|
1893
|
-
} = ctx;
|
|
1894
|
-
useValueChangeEffect(control, () => control.setError("default", ""));
|
|
1895
|
-
if (dd.required) useValidator(control, v => {
|
|
1896
|
-
return !hiddenControl.value && schemaInterface.isEmptyValue(field, v) ? schemaInterface.validationMessageText(field, ValidationMessageType.NotEmpty, false, true) : null;
|
|
1897
|
-
}, "required");
|
|
1898
|
-
(_dd$validators2 = dd.validators) == null || _dd$validators2.forEach((v, i) => useValidatorFor(v, _extends({}, ctx, {
|
|
1899
|
-
index: i,
|
|
1900
|
-
field,
|
|
1901
|
-
definition: dd
|
|
1902
|
-
})));
|
|
1903
|
-
}, [!!dd, dd == null ? void 0 : dd.required, depString, useValidatorFor]);
|
|
1904
|
-
}
|
|
1905
|
-
function useDefaultValidator(validator, ctx) {
|
|
1906
|
-
switch (validator.type) {
|
|
1907
|
-
case ValidatorType.Length:
|
|
1908
|
-
useLengthValidator(validator, ctx);
|
|
1909
|
-
break;
|
|
1910
|
-
case ValidatorType.Jsonata:
|
|
1911
|
-
useJsonataValidator(validator, ctx);
|
|
1912
|
-
break;
|
|
1913
|
-
case ValidatorType.Date:
|
|
1914
|
-
useDateValidator(validator, ctx);
|
|
1915
|
-
break;
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
function useJsonataValidator(validator, ctx) {
|
|
1919
|
-
const sdn = ctx.dataContext.parentNode;
|
|
1920
|
-
const errorMsg = useJsonataExpression(validator.expression, getRootDataNode(sdn).control, getJsonPath(sdn), undefined, v => v == null ? null : typeof v === "string" ? v : JSON.stringify(v));
|
|
1921
|
-
useValidator(ctx.control, () => !ctx.hiddenControl.value ? errorMsg.value : null, "jsonata" + ctx.index);
|
|
1922
|
-
}
|
|
1923
|
-
function useLengthValidator(lv, ctx) {
|
|
1924
|
-
const {
|
|
1925
|
-
control,
|
|
1926
|
-
dataContext: {
|
|
1927
|
-
schemaInterface
|
|
1928
|
-
},
|
|
1929
|
-
hiddenControl,
|
|
1930
|
-
field
|
|
1931
|
-
} = ctx;
|
|
1932
|
-
useValidator(control, v => {
|
|
1933
|
-
const len = schemaInterface.controlLength(field, control);
|
|
1934
|
-
const hidden = hiddenControl.value;
|
|
1935
|
-
if (hidden) {
|
|
1936
|
-
return undefined;
|
|
1937
|
-
}
|
|
1938
|
-
if (lv.min != null && len < lv.min) {
|
|
1939
|
-
if (field != null && field.collection) {
|
|
1940
|
-
control.setValue(v => Array.isArray(v) ? v.concat(Array.from({
|
|
1941
|
-
length: lv.min - v.length
|
|
1942
|
-
})) : Array.from({
|
|
1943
|
-
length: lv.min
|
|
1944
|
-
}));
|
|
1945
|
-
} else {
|
|
1946
|
-
return schemaInterface.validationMessageText(field, ValidationMessageType.MinLength, len, lv.min);
|
|
1947
|
-
}
|
|
1948
|
-
} else if (lv.max != null && len > lv.max) {
|
|
1949
|
-
return schemaInterface.validationMessageText(field, ValidationMessageType.MaxLength, len, lv.max);
|
|
1950
|
-
}
|
|
1951
|
-
return undefined;
|
|
1952
|
-
}, "length" + ctx.index);
|
|
1953
|
-
}
|
|
1954
|
-
function useDateValidator(dv, ctx) {
|
|
1955
|
-
const {
|
|
1956
|
-
control,
|
|
1957
|
-
field,
|
|
1958
|
-
index,
|
|
1959
|
-
dataContext: {
|
|
1960
|
-
schemaInterface
|
|
1961
|
-
}
|
|
1962
|
-
} = ctx;
|
|
1963
|
-
let comparisonDate;
|
|
1964
|
-
if (dv.fixedDate) {
|
|
1965
|
-
comparisonDate = schemaInterface.parseToMillis(field, dv.fixedDate);
|
|
1966
|
-
} else {
|
|
1967
|
-
const nowDate = new Date();
|
|
1968
|
-
comparisonDate = Date.UTC(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate());
|
|
1969
|
-
if (dv.daysFromCurrent) {
|
|
1970
|
-
comparisonDate += dv.daysFromCurrent * 86400000;
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
useValidator(control, v => {
|
|
1974
|
-
if (v) {
|
|
1975
|
-
const selDate = schemaInterface.parseToMillis(field, v);
|
|
1976
|
-
const notAfter = dv.comparison === DateComparison.NotAfter;
|
|
1977
|
-
if (notAfter ? selDate > comparisonDate : selDate < comparisonDate) {
|
|
1978
|
-
return schemaInterface.validationMessageText(field, notAfter ? ValidationMessageType.NotAfterDate : ValidationMessageType.NotBeforeDate, selDate, comparisonDate);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
return null;
|
|
1982
|
-
}, "date" + index);
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
class DefaultSchemaInterface {
|
|
1986
|
-
constructor(boolStrings = ["No", "Yes"], parseDateTime = s => Date.parse(s)) {
|
|
1987
|
-
this.boolStrings = void 0;
|
|
1988
|
-
this.parseDateTime = void 0;
|
|
1989
|
-
this.boolStrings = boolStrings;
|
|
1990
|
-
this.parseDateTime = parseDateTime;
|
|
1991
|
-
}
|
|
1992
|
-
parseToMillis(field, v) {
|
|
1993
|
-
return this.parseDateTime(v);
|
|
1994
|
-
}
|
|
1995
|
-
validationMessageText(field, messageType, actual, expected) {
|
|
1996
|
-
switch (messageType) {
|
|
1997
|
-
case ValidationMessageType.NotEmpty:
|
|
1998
|
-
return "Please enter a value";
|
|
1999
|
-
case ValidationMessageType.MinLength:
|
|
2000
|
-
return "Length must be at least " + expected;
|
|
2001
|
-
case ValidationMessageType.MaxLength:
|
|
2002
|
-
return "Length must be less than " + expected;
|
|
2003
|
-
case ValidationMessageType.NotBeforeDate:
|
|
2004
|
-
return `Date must not be before ${new Date(expected).toDateString()}`;
|
|
2005
|
-
case ValidationMessageType.NotAfterDate:
|
|
2006
|
-
return `Date must not be after ${new Date(expected).toDateString()}`;
|
|
2007
|
-
default:
|
|
2008
|
-
return "Unknown error";
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
getDataOptions(node) {
|
|
2012
|
-
return this.getNodeOptions(node.schema);
|
|
2013
|
-
}
|
|
2014
|
-
getNodeOptions(node) {
|
|
2015
|
-
return this.getOptions(node.field);
|
|
2016
|
-
}
|
|
2017
|
-
getOptions({
|
|
2018
|
-
options
|
|
2019
|
-
}) {
|
|
2020
|
-
return options && options.length > 0 ? options : null;
|
|
2021
|
-
}
|
|
2022
|
-
getFilterOptions(array, field) {
|
|
2023
|
-
return this.getNodeOptions(field);
|
|
2024
|
-
}
|
|
2025
|
-
isEmptyValue(f, value) {
|
|
2026
|
-
if (f.collection) return Array.isArray(value) ? value.length === 0 : value == null;
|
|
2027
|
-
switch (f.type) {
|
|
2028
|
-
case FieldType.String:
|
|
2029
|
-
case FieldType.DateTime:
|
|
2030
|
-
case FieldType.Date:
|
|
2031
|
-
case FieldType.Time:
|
|
2032
|
-
return !value;
|
|
2033
|
-
default:
|
|
2034
|
-
return value == null;
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
searchText(field, value) {
|
|
2038
|
-
var _this$textValue$toLow, _this$textValue;
|
|
2039
|
-
return (_this$textValue$toLow = (_this$textValue = this.textValue(field, value)) == null ? void 0 : _this$textValue.toLowerCase()) != null ? _this$textValue$toLow : "";
|
|
2040
|
-
}
|
|
2041
|
-
textValue(field, value, element) {
|
|
2042
|
-
const options = this.getOptions(field);
|
|
2043
|
-
const option = options == null ? void 0 : options.find(x => x.value === value);
|
|
2044
|
-
if (option) return option.name;
|
|
2045
|
-
switch (field.type) {
|
|
2046
|
-
case FieldType.Date:
|
|
2047
|
-
return value ? new Date(value).toLocaleDateString() : undefined;
|
|
2048
|
-
case FieldType.DateTime:
|
|
2049
|
-
return value ? new Date(this.parseToMillis(field, value)).toLocaleString() : undefined;
|
|
2050
|
-
case FieldType.Time:
|
|
2051
|
-
return value ? new Date("1970-01-01T" + value).toLocaleTimeString() : undefined;
|
|
2052
|
-
case FieldType.Bool:
|
|
2053
|
-
return this.boolStrings[value ? 1 : 0];
|
|
2054
|
-
default:
|
|
2055
|
-
return value != null ? value.toString() : undefined;
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
controlLength(f, control) {
|
|
2059
|
-
var _control$elements$len, _control$elements;
|
|
2060
|
-
return f.collection ? (_control$elements$len = (_control$elements = control.elements) == null ? void 0 : _control$elements.length) != null ? _control$elements$len : 0 : this.valueLength(f, control.value);
|
|
2061
|
-
}
|
|
2062
|
-
valueLength(field, value) {
|
|
2063
|
-
var _ref;
|
|
2064
|
-
return (_ref = value && (value == null ? void 0 : value.length)) != null ? _ref : 0;
|
|
2065
|
-
}
|
|
2066
|
-
compareValue(field, v1, v2) {
|
|
2067
|
-
if (v1 == null) return v2 == null ? 0 : 1;
|
|
2068
|
-
if (v2 == null) return -1;
|
|
2069
|
-
switch (field.type) {
|
|
2070
|
-
case FieldType.Date:
|
|
2071
|
-
case FieldType.DateTime:
|
|
2072
|
-
case FieldType.Time:
|
|
2073
|
-
case FieldType.String:
|
|
2074
|
-
return v1.localeCompare(v2);
|
|
2075
|
-
case FieldType.Bool:
|
|
2076
|
-
return v1 ? v2 ? 0 : 1 : -1;
|
|
2077
|
-
case FieldType.Int:
|
|
2078
|
-
case FieldType.Double:
|
|
2079
|
-
return v1 - v2;
|
|
2080
|
-
default:
|
|
2081
|
-
return 0;
|
|
2082
|
-
}
|
|
2083
|
-
}
|
|
2084
|
-
compoundFieldSetup(f) {
|
|
2085
|
-
return f.getChildNodes().map(x => {
|
|
2086
|
-
const {
|
|
2087
|
-
field
|
|
2088
|
-
} = x.field;
|
|
2089
|
-
return [field, this.makeControlSetup(x)];
|
|
2090
|
-
});
|
|
2091
|
-
}
|
|
2092
|
-
compoundFieldEquality(f) {
|
|
2093
|
-
return f.getChildNodes().map(x => {
|
|
2094
|
-
const {
|
|
2095
|
-
field
|
|
2096
|
-
} = x.field;
|
|
2097
|
-
return [field, (a, b) => this.makeEqualityFunc(x)(a[field], b[field])];
|
|
2098
|
-
});
|
|
2099
|
-
}
|
|
2100
|
-
makeEqualityFunc(field, element) {
|
|
2101
|
-
if (field.field.collection && !element) {
|
|
2102
|
-
const elemEqual = this.makeEqualityFunc(field, true);
|
|
2103
|
-
return (a, b) => {
|
|
2104
|
-
if (a === b) return true;
|
|
2105
|
-
if (a == null || b == null) return false;
|
|
2106
|
-
if (a.length !== b.length) return false;
|
|
2107
|
-
for (let i = 0; i < a.length; i++) {
|
|
2108
|
-
if (!elemEqual(a[i], b[i])) return false;
|
|
2109
|
-
}
|
|
2110
|
-
return true;
|
|
2111
|
-
};
|
|
2112
|
-
}
|
|
2113
|
-
switch (field.field.type) {
|
|
2114
|
-
case FieldType.Compound:
|
|
2115
|
-
const allChecks = this.compoundFieldEquality(field);
|
|
2116
|
-
return (a, b) => a === b || a != null && b != null && allChecks.every(x => x[1](a, b));
|
|
2117
|
-
default:
|
|
2118
|
-
return (a, b) => a === b;
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
makeControlSetup(field, element) {
|
|
2122
|
-
let setup = {
|
|
2123
|
-
equals: this.makeEqualityFunc(field, element)
|
|
2124
|
-
};
|
|
2125
|
-
if (field.field.collection && !element) {
|
|
2126
|
-
setup.elems = this.makeControlSetup(field, true);
|
|
2127
|
-
return setup;
|
|
2128
|
-
}
|
|
2129
|
-
switch (field.field.type) {
|
|
2130
|
-
case FieldType.Compound:
|
|
2131
|
-
setup.fields = Object.fromEntries(this.compoundFieldSetup(field));
|
|
2132
|
-
}
|
|
2133
|
-
return setup;
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
const defaultSchemaInterface = new DefaultSchemaInterface();
|
|
2137
|
-
|
|
2138
|
-
const _excluded = ["styleClass", "labelClass", "layoutClass"],
|
|
2139
|
-
_excluded2 = ["parentDataNode"],
|
|
2140
|
-
_excluded3 = ["definition", "control", "formOptions", "style", "allowedOptions", "schemaInterface", "styleClass"];
|
|
887
|
+
const _excluded$1 = ["formOptions", "style", "allowedOptions", "schemaInterface", "styleClass", "textClass", "displayOnly", "inline"];
|
|
2141
888
|
const AppendAdornmentPriority = 0;
|
|
2142
889
|
const WrapAdornmentPriority = 1000;
|
|
2143
890
|
/**
|
|
@@ -2158,258 +905,26 @@ var LabelType;
|
|
|
2158
905
|
*/
|
|
2159
906
|
LabelType[LabelType["Text"] = 2] = "Text";
|
|
2160
907
|
})(LabelType || (LabelType = {}));
|
|
2161
|
-
function
|
|
2162
|
-
|
|
2163
|
-
definition,
|
|
2164
|
-
fields,
|
|
2165
|
-
renderer,
|
|
2166
|
-
options
|
|
2167
|
-
});
|
|
2168
|
-
return useCallback(({
|
|
2169
|
-
control,
|
|
2170
|
-
parentPath
|
|
2171
|
-
}) => {
|
|
2172
|
-
return /*#__PURE__*/jsx(ControlRenderer, _extends({}, r.current, {
|
|
2173
|
-
control: control,
|
|
2174
|
-
parentPath: parentPath
|
|
2175
|
-
}));
|
|
2176
|
-
}, [r]);
|
|
2177
|
-
}
|
|
2178
|
-
function useControlRendererComponent(controlOrFormNode, renderer, options = {}, parentDataNode) {
|
|
2179
|
-
var _options$useDataHook, _options$schemaInterf, _options$useEvalExpre;
|
|
2180
|
-
const [definition, formNode] = "definition" in controlOrFormNode ? [controlOrFormNode.definition, controlOrFormNode] : [controlOrFormNode, legacyFormNode(controlOrFormNode)];
|
|
2181
|
-
const dataProps = (_options$useDataHook = options.useDataHook == null ? void 0 : options.useDataHook(definition)) != null ? _options$useDataHook : defaultDataProps;
|
|
2182
|
-
const elementIndex = options.elementIndex;
|
|
2183
|
-
const schemaInterface = (_options$schemaInterf = options.schemaInterface) != null ? _options$schemaInterf : defaultSchemaInterface;
|
|
2184
|
-
const useExpr = (_options$useEvalExpre = options.useEvalExpressionHook) != null ? _options$useEvalExpre : defaultUseEvalExpressionHook;
|
|
2185
|
-
let dataNode;
|
|
2186
|
-
if (elementIndex != null) {
|
|
2187
|
-
dataNode = parentDataNode.getChildElement(elementIndex);
|
|
2188
|
-
} else {
|
|
2189
|
-
dataNode = lookupDataNode(definition, parentDataNode);
|
|
2190
|
-
}
|
|
2191
|
-
const useValidation = useMakeValidationHook(definition, options.useValidationHook);
|
|
2192
|
-
const dynamicHooks = useDynamicHooks({
|
|
2193
|
-
defaultValueControl: useEvalDefaultValueHook(useExpr, definition),
|
|
2194
|
-
visibleControl: useEvalVisibilityHook(useExpr, definition),
|
|
2195
|
-
readonlyControl: useEvalReadonlyHook(useExpr, definition),
|
|
2196
|
-
disabledControl: useEvalDisabledHook(useExpr, definition),
|
|
2197
|
-
allowedOptions: useEvalAllowedOptionsHook(useExpr, definition),
|
|
2198
|
-
labelText: useEvalLabelText(useExpr, definition),
|
|
2199
|
-
actionData: useEvalActionHook(useExpr, definition),
|
|
2200
|
-
customStyle: useEvalStyleHook(useExpr, DynamicPropertyType.Style, definition),
|
|
2201
|
-
layoutStyle: useEvalStyleHook(useExpr, DynamicPropertyType.LayoutStyle, definition),
|
|
2202
|
-
displayControl: useEvalDisplayHook(useExpr, definition)
|
|
2203
|
-
});
|
|
2204
|
-
const r = useUpdatedRef({
|
|
2205
|
-
options,
|
|
2206
|
-
definition,
|
|
2207
|
-
elementIndex,
|
|
2208
|
-
parentDataNode,
|
|
2209
|
-
dataNode,
|
|
2210
|
-
formNode
|
|
2211
|
-
});
|
|
2212
|
-
if (formNode == null) debugger;
|
|
2213
|
-
const Component = useCallback(() => {
|
|
2214
|
-
const stopTracking = useComponentTracking();
|
|
2215
|
-
try {
|
|
2216
|
-
var _options$formData, _dataNode, _definition$adornment2, _definition$adornment3, _formNode$tree$getByR, _options$adjustLayout;
|
|
2217
|
-
const {
|
|
2218
|
-
definition: c,
|
|
2219
|
-
options,
|
|
2220
|
-
elementIndex,
|
|
2221
|
-
parentDataNode: pdn,
|
|
2222
|
-
dataNode: dn,
|
|
2223
|
-
formNode
|
|
2224
|
-
} = r.current;
|
|
2225
|
-
const formData = (_options$formData = options.formData) != null ? _options$formData : {};
|
|
2226
|
-
const dataContext = {
|
|
2227
|
-
schemaInterface,
|
|
2228
|
-
dataNode: dn,
|
|
2229
|
-
parentNode: pdn,
|
|
2230
|
-
formData
|
|
2231
|
-
};
|
|
2232
|
-
const {
|
|
2233
|
-
readonlyControl,
|
|
2234
|
-
disabledControl,
|
|
2235
|
-
visibleControl,
|
|
2236
|
-
displayControl,
|
|
2237
|
-
layoutStyle,
|
|
2238
|
-
labelText,
|
|
2239
|
-
customStyle,
|
|
2240
|
-
allowedOptions,
|
|
2241
|
-
defaultValueControl,
|
|
2242
|
-
actionData
|
|
2243
|
-
} = dynamicHooks(dataContext);
|
|
2244
|
-
const visible = visibleControl.current.value;
|
|
2245
|
-
const visibility = useControl(() => visible != null ? {
|
|
2246
|
-
visible,
|
|
2247
|
-
showing: visible
|
|
2248
|
-
} : undefined);
|
|
2249
|
-
useControlEffect(() => visibleControl.value, visible => {
|
|
2250
|
-
if (visible != null) visibility.setValue(ex => ({
|
|
2251
|
-
visible,
|
|
2252
|
-
showing: ex ? ex.showing : visible
|
|
2253
|
-
}));
|
|
2254
|
-
});
|
|
2255
|
-
const parentControl = parentDataNode.control;
|
|
2256
|
-
const control = (_dataNode = dataNode) == null ? void 0 : _dataNode.control;
|
|
2257
|
-
useControlEffect(() => {
|
|
2258
|
-
var _definition$adornment, _definition$renderOpt;
|
|
2259
|
-
return [visibility.value, defaultValueControl.value, control == null ? void 0 : control.isNull, isDataControl(definition) && definition.dontClearHidden, ((_definition$adornment = definition.adornments) == null ? void 0 : _definition$adornment.some(x => x.type === ControlAdornmentType.Optional)) || isDataControl(definition) && ((_definition$renderOpt = definition.renderOptions) == null ? void 0 : _definition$renderOpt.type) == DataRenderType.NullToggle, parentControl.isNull, options.hidden, readonlyControl.value];
|
|
2260
|
-
}, ([vc, dv, _, dontClear, dontDefault, parentNull, hidden, ro]) => {
|
|
2261
|
-
if (!ro) {
|
|
2262
|
-
if (control) {
|
|
2263
|
-
if (vc && vc.visible === vc.showing) {
|
|
2264
|
-
if (hidden || !vc.visible) {
|
|
2265
|
-
control.setValue(x => options.clearHidden && !dontClear ? undefined : x == null && dontClear && !dontDefault ? dv : x);
|
|
2266
|
-
} else if (!dontDefault) control.setValue(x => x != null ? x : dv);
|
|
2267
|
-
}
|
|
2268
|
-
} else if (parentNull) {
|
|
2269
|
-
parentControl.setValue(x => x != null ? x : {});
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
}, true);
|
|
2273
|
-
const myOptionsControl = useComputed(() => {
|
|
2274
|
-
var _visibility$fields;
|
|
2275
|
-
return {
|
|
2276
|
-
hidden: options.hidden || !((_visibility$fields = visibility.fields) != null && _visibility$fields.showing.value),
|
|
2277
|
-
readonly: options.readonly || readonlyControl.value,
|
|
2278
|
-
disabled: options.disabled || disabledControl.value,
|
|
2279
|
-
displayOnly: options.displayOnly || isControlDisplayOnly(c)
|
|
2280
|
-
};
|
|
2281
|
-
});
|
|
2282
|
-
const myOptions = trackedValue(myOptionsControl);
|
|
2283
|
-
useValidation({
|
|
2284
|
-
control: control != null ? control : newControl(null),
|
|
2285
|
-
hiddenControl: myOptionsControl.fields.hidden,
|
|
2286
|
-
dataContext
|
|
2287
|
-
});
|
|
2288
|
-
const inheritableOptions = _objectWithoutPropertiesLoose(options, _excluded);
|
|
2289
|
-
const childOptions = _extends({}, inheritableOptions, myOptions, {
|
|
2290
|
-
elementIndex: undefined
|
|
2291
|
-
});
|
|
2292
|
-
useEffect(() => {
|
|
2293
|
-
if (control && typeof myOptions.disabled === "boolean" && control.disabled != myOptions.disabled) control.disabled = myOptions.disabled;
|
|
2294
|
-
}, [control, myOptions.disabled]);
|
|
2295
|
-
if (parentControl.isNull) return /*#__PURE__*/jsx(Fragment, {});
|
|
2296
|
-
const adornments = (_definition$adornment2 = (_definition$adornment3 = definition.adornments) == null ? void 0 : _definition$adornment3.map(x => renderer.renderAdornment({
|
|
2297
|
-
adornment: x,
|
|
2298
|
-
dataContext,
|
|
2299
|
-
useExpr,
|
|
2300
|
-
formOptions: myOptions
|
|
2301
|
-
}))) != null ? _definition$adornment2 : [];
|
|
2302
|
-
const otherChildNodes = definition.childRefId && ((_formNode$tree$getByR = formNode.tree.getByRefId(definition.childRefId)) == null ? void 0 : _formNode$tree$getByR.getChildNodes());
|
|
2303
|
-
const labelAndChildren = renderControlLayout({
|
|
2304
|
-
formNode: otherChildNodes ? formNode.tree.createTempNode(formNode.id, definition, otherChildNodes) : formNode,
|
|
2305
|
-
definition: c,
|
|
2306
|
-
renderer,
|
|
2307
|
-
renderChild: (k, child, options) => {
|
|
2308
|
-
var _ref2;
|
|
2309
|
-
const overrideClasses = getGroupClassOverrides(c);
|
|
2310
|
-
const _ref = options != null ? options : {},
|
|
2311
|
-
{
|
|
2312
|
-
parentDataNode
|
|
2313
|
-
} = _ref,
|
|
2314
|
-
renderOptions = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
2315
|
-
const dContext = (_ref2 = parentDataNode != null ? parentDataNode : dataContext.dataNode) != null ? _ref2 : dataContext.parentNode;
|
|
2316
|
-
const allChildOptions = _extends({}, childOptions, overrideClasses, renderOptions);
|
|
2317
|
-
return /*#__PURE__*/jsx(NewControlRenderer, {
|
|
2318
|
-
definition: child,
|
|
2319
|
-
renderer: renderer,
|
|
2320
|
-
parentDataNode: dContext,
|
|
2321
|
-
options: allChildOptions
|
|
2322
|
-
}, k);
|
|
2323
|
-
},
|
|
2324
|
-
createDataProps: dataProps,
|
|
2325
|
-
formOptions: myOptions,
|
|
2326
|
-
dataContext,
|
|
2327
|
-
control: displayControl != null ? displayControl : control,
|
|
2328
|
-
elementIndex,
|
|
2329
|
-
schemaInterface,
|
|
2330
|
-
labelText,
|
|
2331
|
-
displayControl,
|
|
2332
|
-
style: customStyle.value,
|
|
2333
|
-
allowedOptions,
|
|
2334
|
-
customDisplay: options.customDisplay,
|
|
2335
|
-
actionDataControl: actionData,
|
|
2336
|
-
actionOnClick: options.actionOnClick,
|
|
2337
|
-
styleClass: options.styleClass,
|
|
2338
|
-
labelClass: options.labelClass,
|
|
2339
|
-
useEvalExpression: useExpr,
|
|
2340
|
-
useChildVisibility: (childDef, parentNode, dontOverride) => {
|
|
2341
|
-
var _ref3;
|
|
2342
|
-
return useEvalVisibilityHook(useExpr, childDef, !dontOverride ? lookupDataNode(childDef, (_ref3 = parentNode != null ? parentNode : dataNode) != null ? _ref3 : parentDataNode) : undefined);
|
|
2343
|
-
}
|
|
2344
|
-
});
|
|
2345
|
-
const layoutProps = _extends({}, labelAndChildren, {
|
|
2346
|
-
adornments,
|
|
2347
|
-
className: rendererClass(options.layoutClass, c.layoutClass),
|
|
2348
|
-
style: layoutStyle.value
|
|
2349
|
-
});
|
|
2350
|
-
const renderedControl = renderer.renderLayout((_options$adjustLayout = options.adjustLayout == null ? void 0 : options.adjustLayout(dataContext, layoutProps)) != null ? _options$adjustLayout : layoutProps);
|
|
2351
|
-
return renderer.renderVisibility(_extends({
|
|
2352
|
-
visibility
|
|
2353
|
-
}, renderedControl));
|
|
2354
|
-
} finally {
|
|
2355
|
-
stopTracking();
|
|
2356
|
-
}
|
|
2357
|
-
}, [r, dataProps, useValidation, renderer, schemaInterface, dynamicHooks]);
|
|
2358
|
-
Component.displayName = "RenderControl";
|
|
2359
|
-
return Component;
|
|
2360
|
-
}
|
|
2361
|
-
function ControlRenderer({
|
|
2362
|
-
definition,
|
|
2363
|
-
fields,
|
|
2364
|
-
renderer,
|
|
2365
|
-
options,
|
|
2366
|
-
control,
|
|
2367
|
-
parentPath
|
|
2368
|
-
}) {
|
|
2369
|
-
var _effect = useComponentTracking();
|
|
2370
|
-
try {
|
|
2371
|
-
const schemaDataNode = makeSchemaDataNode(createSchemaLookup({
|
|
2372
|
-
"": fields
|
|
2373
|
-
}).getSchema(""), control);
|
|
2374
|
-
const Render = useControlRendererComponent(definition, renderer, options, schemaDataNode);
|
|
2375
|
-
return /*#__PURE__*/jsx(Render, {});
|
|
2376
|
-
} finally {
|
|
2377
|
-
_effect();
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
function NewControlRenderer({
|
|
2381
|
-
definition,
|
|
2382
|
-
renderer,
|
|
2383
|
-
options,
|
|
2384
|
-
parentDataNode
|
|
2385
|
-
}) {
|
|
2386
|
-
var _effect2 = useComponentTracking();
|
|
2387
|
-
try {
|
|
2388
|
-
const Render = useControlRendererComponent(definition, renderer, options, parentDataNode);
|
|
2389
|
-
return /*#__PURE__*/jsx(Render, {});
|
|
2390
|
-
} finally {
|
|
2391
|
-
_effect2();
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
function defaultDataProps(_ref4) {
|
|
2395
|
-
var _allowedOptions$value, _definition$renderOpt2;
|
|
908
|
+
function defaultDataProps(_ref, definition, control) {
|
|
909
|
+
var _definition$renderOpt;
|
|
2396
910
|
let {
|
|
2397
|
-
definition,
|
|
2398
|
-
control,
|
|
2399
911
|
formOptions,
|
|
2400
912
|
style,
|
|
2401
913
|
allowedOptions,
|
|
2402
914
|
schemaInterface = defaultSchemaInterface,
|
|
2403
|
-
styleClass
|
|
2404
|
-
|
|
2405
|
-
|
|
915
|
+
styleClass,
|
|
916
|
+
textClass: tc,
|
|
917
|
+
displayOnly,
|
|
918
|
+
inline
|
|
919
|
+
} = _ref,
|
|
920
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2406
921
|
const dataNode = props.dataContext.dataNode;
|
|
2407
922
|
const field = dataNode.schema.field;
|
|
2408
923
|
const className = rendererClass(styleClass, definition.styleClass);
|
|
2409
|
-
const
|
|
924
|
+
const textClass = rendererClass(tc, definition.textClass);
|
|
2410
925
|
const required = !!definition.required && !displayOnly;
|
|
2411
926
|
const fieldOptions = schemaInterface.getDataOptions(dataNode);
|
|
2412
|
-
const _allowed =
|
|
927
|
+
const _allowed = allowedOptions != null ? allowedOptions : [];
|
|
2413
928
|
const allowed = Array.isArray(_allowed) ? _allowed : [_allowed];
|
|
2414
929
|
return _extends({
|
|
2415
930
|
dataNode,
|
|
@@ -2417,6 +932,7 @@ function defaultDataProps(_ref4) {
|
|
|
2417
932
|
control,
|
|
2418
933
|
field,
|
|
2419
934
|
id: "c" + control.uniqueId,
|
|
935
|
+
inline: !!inline,
|
|
2420
936
|
options: allowed.length > 0 ? allowed.map(x => {
|
|
2421
937
|
var _fieldOptions$find;
|
|
2422
938
|
return typeof x === "object" ? x : (_fieldOptions$find = fieldOptions == null ? void 0 : fieldOptions.find(y => y.value == x)) != null ? _fieldOptions$find : {
|
|
@@ -2425,40 +941,46 @@ function defaultDataProps(_ref4) {
|
|
|
2425
941
|
};
|
|
2426
942
|
}).filter(x => x != null) : fieldOptions,
|
|
2427
943
|
readonly: !!formOptions.readonly,
|
|
2428
|
-
displayOnly,
|
|
2429
|
-
renderOptions: (_definition$
|
|
944
|
+
displayOnly: !!displayOnly,
|
|
945
|
+
renderOptions: (_definition$renderOpt = definition.renderOptions) != null ? _definition$renderOpt : {
|
|
2430
946
|
type: "Standard"
|
|
2431
947
|
},
|
|
2432
948
|
required,
|
|
2433
949
|
hidden: !!formOptions.hidden,
|
|
2434
950
|
className,
|
|
951
|
+
textClass,
|
|
2435
952
|
style
|
|
2436
953
|
}, props);
|
|
2437
954
|
}
|
|
2438
955
|
function renderControlLayout(props) {
|
|
2439
956
|
const {
|
|
2440
|
-
definition: c,
|
|
2441
957
|
renderer,
|
|
2442
958
|
renderChild,
|
|
2443
959
|
control,
|
|
2444
960
|
dataContext,
|
|
2445
961
|
createDataProps: dataProps,
|
|
2446
|
-
displayControl,
|
|
2447
962
|
style,
|
|
2448
|
-
labelText,
|
|
2449
|
-
useChildVisibility,
|
|
2450
963
|
designMode,
|
|
2451
964
|
customDisplay,
|
|
2452
|
-
|
|
965
|
+
runExpression,
|
|
2453
966
|
labelClass,
|
|
967
|
+
labelTextClass,
|
|
2454
968
|
styleClass,
|
|
2455
|
-
|
|
969
|
+
textClass,
|
|
970
|
+
formNode,
|
|
971
|
+
formOptions,
|
|
972
|
+
actionOnClick,
|
|
973
|
+
state,
|
|
974
|
+
getChildState,
|
|
975
|
+
inline,
|
|
976
|
+
displayOnly
|
|
2456
977
|
} = props;
|
|
978
|
+
const c = state.definition;
|
|
2457
979
|
if (isDataControl(c)) {
|
|
2458
980
|
return renderData(c);
|
|
2459
981
|
}
|
|
2460
982
|
if (isGroupControl(c)) {
|
|
2461
|
-
var _c$groupOptions2,
|
|
983
|
+
var _c$groupOptions2, _c$groupOptions3;
|
|
2462
984
|
if (c.compoundField) {
|
|
2463
985
|
var _c$groupOptions;
|
|
2464
986
|
return renderData(dataControl(c.compoundField, c.title, {
|
|
@@ -2467,41 +989,68 @@ function renderControlLayout(props) {
|
|
|
2467
989
|
}));
|
|
2468
990
|
}
|
|
2469
991
|
return {
|
|
992
|
+
inline,
|
|
2470
993
|
processLayout: renderer.renderGroup({
|
|
2471
994
|
formNode,
|
|
995
|
+
state,
|
|
2472
996
|
definition: c,
|
|
2473
997
|
renderChild,
|
|
2474
|
-
|
|
998
|
+
runExpression,
|
|
2475
999
|
dataContext,
|
|
2476
1000
|
renderOptions: (_c$groupOptions2 = c.groupOptions) != null ? _c$groupOptions2 : {
|
|
2477
1001
|
type: "Standard"
|
|
2478
1002
|
},
|
|
2479
1003
|
className: rendererClass(styleClass, c.styleClass),
|
|
2480
|
-
|
|
1004
|
+
textClass: rendererClass(textClass, c.textClass),
|
|
2481
1005
|
style,
|
|
2482
|
-
designMode
|
|
1006
|
+
designMode,
|
|
1007
|
+
actionOnClick,
|
|
1008
|
+
getChildState
|
|
2483
1009
|
}),
|
|
2484
1010
|
label: {
|
|
2485
|
-
label:
|
|
1011
|
+
label: c.title,
|
|
2486
1012
|
className: rendererClass(labelClass, c.labelClass),
|
|
1013
|
+
textClass: rendererClass(labelTextClass, c.labelTextClass),
|
|
2487
1014
|
type: LabelType.Group,
|
|
2488
1015
|
hide: (_c$groupOptions3 = c.groupOptions) == null ? void 0 : _c$groupOptions3.hideTitle
|
|
2489
1016
|
}
|
|
2490
1017
|
};
|
|
2491
1018
|
}
|
|
2492
1019
|
if (isActionControl(c)) {
|
|
2493
|
-
var
|
|
2494
|
-
const actionData =
|
|
1020
|
+
var _c$actionStyle, _c$title, _props$actionOnClick;
|
|
1021
|
+
const actionData = c.actionData;
|
|
1022
|
+
const actionStyle = (_c$actionStyle = c.actionStyle) != null ? _c$actionStyle : ActionStyle.Button;
|
|
1023
|
+
const actionContent = actionStyle == ActionStyle.Group ? renderActionGroup() : undefined;
|
|
2495
1024
|
return {
|
|
1025
|
+
inline,
|
|
2496
1026
|
children: renderer.renderAction({
|
|
2497
|
-
actionText: (
|
|
1027
|
+
actionText: (_c$title = c.title) != null ? _c$title : c.actionId,
|
|
2498
1028
|
actionId: c.actionId,
|
|
2499
1029
|
actionData,
|
|
1030
|
+
actionContent,
|
|
1031
|
+
actionStyle,
|
|
1032
|
+
textClass: rendererClass(textClass, c.textClass),
|
|
1033
|
+
iconPlacement: c.iconPlacement,
|
|
1034
|
+
icon: c.icon,
|
|
1035
|
+
inline,
|
|
2500
1036
|
onClick: (_props$actionOnClick = props.actionOnClick == null ? void 0 : props.actionOnClick(c.actionId, actionData, dataContext)) != null ? _props$actionOnClick : () => {},
|
|
2501
1037
|
className: rendererClass(styleClass, c.styleClass),
|
|
2502
1038
|
style
|
|
2503
1039
|
})
|
|
2504
1040
|
};
|
|
1041
|
+
function renderActionGroup() {
|
|
1042
|
+
const childDefs = formNode.getResolvedChildren();
|
|
1043
|
+
const childDef = {
|
|
1044
|
+
type: ControlDefinitionType.Group,
|
|
1045
|
+
groupOptions: {
|
|
1046
|
+
type: GroupRenderType.Contents,
|
|
1047
|
+
hideTitle: true
|
|
1048
|
+
},
|
|
1049
|
+
children: childDefs
|
|
1050
|
+
};
|
|
1051
|
+
const childNode = formNode.createChildNode("child", childDef);
|
|
1052
|
+
return renderChild("child", childNode, {});
|
|
1053
|
+
}
|
|
2505
1054
|
}
|
|
2506
1055
|
if (isDisplayControl(c)) {
|
|
2507
1056
|
var _c$displayData;
|
|
@@ -2509,36 +1058,41 @@ function renderControlLayout(props) {
|
|
|
2509
1058
|
const displayProps = {
|
|
2510
1059
|
data,
|
|
2511
1060
|
className: rendererClass(styleClass, c.styleClass),
|
|
1061
|
+
textClass: rendererClass(textClass, c.textClass),
|
|
2512
1062
|
style,
|
|
2513
|
-
|
|
2514
|
-
|
|
1063
|
+
dataContext,
|
|
1064
|
+
inline
|
|
2515
1065
|
};
|
|
2516
1066
|
if (data.type === DisplayDataType.Custom && customDisplay) {
|
|
2517
1067
|
return {
|
|
1068
|
+
inline,
|
|
2518
1069
|
children: customDisplay(data.customId, displayProps)
|
|
2519
1070
|
};
|
|
2520
1071
|
}
|
|
2521
1072
|
return {
|
|
1073
|
+
inline,
|
|
2522
1074
|
children: renderer.renderDisplay(displayProps)
|
|
2523
1075
|
};
|
|
2524
1076
|
}
|
|
2525
1077
|
return {};
|
|
2526
1078
|
function renderData(c) {
|
|
2527
|
-
var
|
|
1079
|
+
var _c$children$length, _c$children;
|
|
2528
1080
|
if (!control) return {
|
|
2529
1081
|
children: "No control for: " + c.field
|
|
2530
1082
|
};
|
|
2531
|
-
const rendererProps = dataProps(props);
|
|
2532
|
-
const label = !c.hideTitle ? controlTitle(
|
|
1083
|
+
const rendererProps = dataProps(props, c, control);
|
|
1084
|
+
const label = !c.hideTitle ? controlTitle(c.title, props.dataContext.dataNode.schema.field) : undefined;
|
|
2533
1085
|
return {
|
|
1086
|
+
inline,
|
|
2534
1087
|
processLayout: renderer.renderData(rendererProps),
|
|
2535
1088
|
label: {
|
|
2536
1089
|
type: ((_c$children$length = (_c$children = c.children) == null ? void 0 : _c$children.length) != null ? _c$children$length : 0) > 0 ? LabelType.Group : LabelType.Control,
|
|
2537
1090
|
label,
|
|
2538
1091
|
forId: rendererProps.id,
|
|
2539
|
-
required: c.required && !
|
|
1092
|
+
required: c.required && !displayOnly,
|
|
2540
1093
|
hide: c.hideTitle,
|
|
2541
|
-
className: rendererClass(labelClass, c.labelClass)
|
|
1094
|
+
className: rendererClass(labelClass, c.labelClass),
|
|
1095
|
+
textClass: rendererClass(labelTextClass, c.labelTextClass)
|
|
2542
1096
|
},
|
|
2543
1097
|
errorControl: control
|
|
2544
1098
|
};
|
|
@@ -2584,13 +1138,15 @@ function renderLayoutParts(props, renderer) {
|
|
|
2584
1138
|
style,
|
|
2585
1139
|
errorControl,
|
|
2586
1140
|
label,
|
|
2587
|
-
adornments
|
|
1141
|
+
adornments,
|
|
1142
|
+
inline
|
|
2588
1143
|
} = (_props$processLayout = props.processLayout == null ? void 0 : props.processLayout(props)) != null ? _props$processLayout : props;
|
|
2589
1144
|
const layout = {
|
|
2590
1145
|
children,
|
|
2591
1146
|
errorControl,
|
|
2592
1147
|
style,
|
|
2593
1148
|
className: className,
|
|
1149
|
+
inline,
|
|
2594
1150
|
wrapLayout: x => x
|
|
2595
1151
|
};
|
|
2596
1152
|
(adornments != null ? adornments : []).sort((a, b) => a.priority - b.priority).forEach(x => x.apply(layout));
|
|
@@ -2716,17 +1272,29 @@ function applyArrayLengthRestrictions({
|
|
|
2716
1272
|
};
|
|
2717
1273
|
}
|
|
2718
1274
|
function fieldOptionAdornment(p) {
|
|
2719
|
-
return (o,
|
|
1275
|
+
return (o, fieldIndex, selected) => /*#__PURE__*/jsx(RenderArrayElements, {
|
|
2720
1276
|
array: p.formNode.getChildNodes(),
|
|
2721
1277
|
children: (cd, i) => p.renderChild(i, cd, {
|
|
2722
1278
|
parentDataNode: p.dataContext.parentNode,
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
1279
|
+
stateKey: fieldIndex.toString(),
|
|
1280
|
+
variables: {
|
|
1281
|
+
formData: {
|
|
1282
|
+
option: o,
|
|
1283
|
+
optionSelected: selected
|
|
1284
|
+
}
|
|
2726
1285
|
}
|
|
2727
1286
|
})
|
|
2728
1287
|
});
|
|
2729
1288
|
}
|
|
1289
|
+
function lookupChildDataContext(dataContext, c) {
|
|
1290
|
+
var _dataContext$dataNode;
|
|
1291
|
+
const parentNode = (_dataContext$dataNode = dataContext.dataNode) != null ? _dataContext$dataNode : dataContext.parentNode;
|
|
1292
|
+
const dataNode = lookupDataNode(c, parentNode);
|
|
1293
|
+
return _extends({}, dataContext, {
|
|
1294
|
+
parentNode,
|
|
1295
|
+
dataNode
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
2730
1298
|
|
|
2731
1299
|
function isIconAdornment(a) {
|
|
2732
1300
|
return a.type === ControlAdornmentType.Icon;
|
|
@@ -2820,7 +1388,6 @@ function createFormRenderer(customRenderers = [], defaultRenderers) {
|
|
|
2820
1388
|
renderLayout,
|
|
2821
1389
|
renderVisibility,
|
|
2822
1390
|
renderLabelText,
|
|
2823
|
-
renderText: defaultRenderers.renderText,
|
|
2824
1391
|
html: defaultRenderers.html
|
|
2825
1392
|
};
|
|
2826
1393
|
function renderVisibility(props) {
|
|
@@ -2868,7 +1435,7 @@ function createFormRenderer(customRenderers = [], defaultRenderers) {
|
|
|
2868
1435
|
var _x$collection, _field$collection, _x$options;
|
|
2869
1436
|
const noMatch = x.match ? !x.match(props, renderOptions) : undefined;
|
|
2870
1437
|
if (noMatch === true) return false;
|
|
2871
|
-
const matchCollection = ((_x$collection = x.collection) != null ? _x$collection : false) === (props.elementIndex == null && ((_field$collection = field.collection) != null ? _field$collection : false));
|
|
1438
|
+
const matchCollection = ((_x$collection = x.collection) != null ? _x$collection : false) === (props.dataNode.elementIndex == null && ((_field$collection = field.collection) != null ? _field$collection : false));
|
|
2872
1439
|
const isSchemaAllowed = !!x.schemaType && renderType == DataRenderType.Standard ? isOneOf(x.schemaType, field.type) : undefined;
|
|
2873
1440
|
const isRendererAllowed = !!x.renderType && isOneOf(x.renderType, renderType);
|
|
2874
1441
|
return matchCollection && ((_x$options = x.options) != null ? _x$options : false) === options && (isSchemaAllowed || isRendererAllowed || !x.renderType && !x.schemaType && noMatch === false);
|
|
@@ -2928,5 +1495,217 @@ function isArrayRegistration(x) {
|
|
|
2928
1495
|
return x.type === "array";
|
|
2929
1496
|
}
|
|
2930
1497
|
|
|
2931
|
-
|
|
1498
|
+
const _excluded = ["styleClass", "labelClass", "layoutClass", "labelTextClass", "textClass"],
|
|
1499
|
+
_excluded2 = ["parentDataNode", "actionOnClick", "variables"];
|
|
1500
|
+
function RenderForm({
|
|
1501
|
+
data,
|
|
1502
|
+
form,
|
|
1503
|
+
renderer,
|
|
1504
|
+
options = {}
|
|
1505
|
+
}) {
|
|
1506
|
+
var _effect = useComponentTracking();
|
|
1507
|
+
try {
|
|
1508
|
+
var _options$schemaInterf, _definition$adornment, _definition$adornment2, _dataContext$dataNode, _options$adjustLayout;
|
|
1509
|
+
const schemaInterface = (_options$schemaInterf = options.schemaInterface) != null ? _options$schemaInterf : defaultSchemaInterface;
|
|
1510
|
+
const [formState, setFormState] = useState(() => {
|
|
1511
|
+
var _options$formState;
|
|
1512
|
+
return (_options$formState = options == null ? void 0 : options.formState) != null ? _options$formState : createFormState(schemaInterface);
|
|
1513
|
+
});
|
|
1514
|
+
const state = formState.getControlState(data, form, options);
|
|
1515
|
+
useEffect(() => {
|
|
1516
|
+
if (!(options != null && options.formState)) {
|
|
1517
|
+
return () => formState.cleanup();
|
|
1518
|
+
}
|
|
1519
|
+
}, [formState, options == null ? void 0 : options.formState]);
|
|
1520
|
+
const definition = state.definition;
|
|
1521
|
+
const visible = !state.hidden;
|
|
1522
|
+
const visibility = useControl(() => visible != null ? {
|
|
1523
|
+
visible,
|
|
1524
|
+
showing: visible
|
|
1525
|
+
} : undefined);
|
|
1526
|
+
visibility.fields.visible.value = visible;
|
|
1527
|
+
const dataContext = {
|
|
1528
|
+
schemaInterface: state.schemaInterface,
|
|
1529
|
+
dataNode: state.dataNode,
|
|
1530
|
+
parentNode: data,
|
|
1531
|
+
variables: state.variables
|
|
1532
|
+
};
|
|
1533
|
+
const adornments = (_definition$adornment = (_definition$adornment2 = definition.adornments) == null ? void 0 : _definition$adornment2.map(x => renderer.renderAdornment({
|
|
1534
|
+
adornment: x,
|
|
1535
|
+
dataContext,
|
|
1536
|
+
formOptions: state
|
|
1537
|
+
}))) != null ? _definition$adornment : [];
|
|
1538
|
+
const {
|
|
1539
|
+
styleClass,
|
|
1540
|
+
labelClass,
|
|
1541
|
+
labelTextClass,
|
|
1542
|
+
textClass
|
|
1543
|
+
} = options,
|
|
1544
|
+
inheritableOptions = _objectWithoutPropertiesLoose(options, _excluded);
|
|
1545
|
+
const {
|
|
1546
|
+
readonly,
|
|
1547
|
+
hidden,
|
|
1548
|
+
disabled,
|
|
1549
|
+
variables
|
|
1550
|
+
} = state;
|
|
1551
|
+
const childOptions = _extends({}, inheritableOptions, {
|
|
1552
|
+
readonly,
|
|
1553
|
+
disabled,
|
|
1554
|
+
variables,
|
|
1555
|
+
formState
|
|
1556
|
+
});
|
|
1557
|
+
const labelAndChildren = renderControlLayout({
|
|
1558
|
+
formNode: form,
|
|
1559
|
+
renderer,
|
|
1560
|
+
state,
|
|
1561
|
+
renderChild: (k, child, options) => {
|
|
1562
|
+
var _ref2;
|
|
1563
|
+
const overrideClasses = getGroupClassOverrides(definition);
|
|
1564
|
+
const _ref = options != null ? options : {},
|
|
1565
|
+
{
|
|
1566
|
+
parentDataNode,
|
|
1567
|
+
actionOnClick,
|
|
1568
|
+
variables
|
|
1569
|
+
} = _ref,
|
|
1570
|
+
renderOptions = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
1571
|
+
const dContext = (_ref2 = parentDataNode != null ? parentDataNode : dataContext.dataNode) != null ? _ref2 : data;
|
|
1572
|
+
const allChildOptions = _extends({}, childOptions, overrideClasses, renderOptions, {
|
|
1573
|
+
variables: _extends({}, childOptions.variables, variables),
|
|
1574
|
+
actionOnClick: actionHandlers(actionOnClick, childOptions.actionOnClick)
|
|
1575
|
+
});
|
|
1576
|
+
return /*#__PURE__*/jsx(RenderForm, {
|
|
1577
|
+
form: child,
|
|
1578
|
+
renderer: renderer,
|
|
1579
|
+
data: dContext,
|
|
1580
|
+
options: allChildOptions
|
|
1581
|
+
}, k);
|
|
1582
|
+
},
|
|
1583
|
+
inline: options == null ? void 0 : options.inline,
|
|
1584
|
+
displayOnly: options == null ? void 0 : options.displayOnly,
|
|
1585
|
+
createDataProps: defaultDataProps,
|
|
1586
|
+
formOptions: state,
|
|
1587
|
+
dataContext,
|
|
1588
|
+
control: (_dataContext$dataNode = dataContext.dataNode) == null ? void 0 : _dataContext$dataNode.control,
|
|
1589
|
+
schemaInterface,
|
|
1590
|
+
style: state.style,
|
|
1591
|
+
allowedOptions: state.allowedOptions,
|
|
1592
|
+
customDisplay: options.customDisplay,
|
|
1593
|
+
actionOnClick: options.actionOnClick,
|
|
1594
|
+
styleClass: styleClass,
|
|
1595
|
+
labelClass: labelClass,
|
|
1596
|
+
labelTextClass: labelTextClass,
|
|
1597
|
+
textClass: textClass,
|
|
1598
|
+
getChildState(child, parent) {
|
|
1599
|
+
var _ref3;
|
|
1600
|
+
return formState.getControlState((_ref3 = parent != null ? parent : state.dataNode) != null ? _ref3 : data, child, childOptions);
|
|
1601
|
+
},
|
|
1602
|
+
runExpression: (scope, expr, returnResult) => {
|
|
1603
|
+
if (expr != null && expr.type) {
|
|
1604
|
+
formState.evalExpression(expr, {
|
|
1605
|
+
scope,
|
|
1606
|
+
dataNode: data,
|
|
1607
|
+
schemaInterface,
|
|
1608
|
+
returnResult
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
const layoutProps = _extends({}, labelAndChildren, {
|
|
1614
|
+
adornments,
|
|
1615
|
+
className: rendererClass(options.layoutClass, definition.layoutClass),
|
|
1616
|
+
style: state.layoutStyle
|
|
1617
|
+
});
|
|
1618
|
+
const renderedControl = renderer.renderLayout((_options$adjustLayout = options.adjustLayout == null ? void 0 : options.adjustLayout(dataContext, layoutProps)) != null ? _options$adjustLayout : layoutProps);
|
|
1619
|
+
return renderer.renderVisibility(_extends({
|
|
1620
|
+
visibility
|
|
1621
|
+
}, renderedControl));
|
|
1622
|
+
} finally {
|
|
1623
|
+
_effect();
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* @deprecated Use RenderForm instead.
|
|
1628
|
+
*/
|
|
1629
|
+
function useControlRendererComponent(controlOrFormNode, renderer, options = {}, parentDataNode) {
|
|
1630
|
+
const [definition, formNode] = "definition" in controlOrFormNode ? [controlOrFormNode.definition, controlOrFormNode] : [controlOrFormNode, legacyFormNode(controlOrFormNode)];
|
|
1631
|
+
const r = useUpdatedRef({
|
|
1632
|
+
options,
|
|
1633
|
+
renderer,
|
|
1634
|
+
parentDataNode,
|
|
1635
|
+
formNode
|
|
1636
|
+
});
|
|
1637
|
+
return useMemo(() => () => {
|
|
1638
|
+
const {
|
|
1639
|
+
options,
|
|
1640
|
+
parentDataNode,
|
|
1641
|
+
formNode,
|
|
1642
|
+
renderer
|
|
1643
|
+
} = r.current;
|
|
1644
|
+
return /*#__PURE__*/jsx(RenderForm, {
|
|
1645
|
+
data: parentDataNode,
|
|
1646
|
+
form: formNode,
|
|
1647
|
+
renderer: renderer,
|
|
1648
|
+
options: options
|
|
1649
|
+
});
|
|
1650
|
+
}, [r]);
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* @deprecated Use RenderForm instead.
|
|
1654
|
+
*/
|
|
1655
|
+
function ControlRenderer({
|
|
1656
|
+
definition,
|
|
1657
|
+
fields,
|
|
1658
|
+
renderer,
|
|
1659
|
+
options,
|
|
1660
|
+
control,
|
|
1661
|
+
parentPath
|
|
1662
|
+
}) {
|
|
1663
|
+
var _effect2 = useComponentTracking();
|
|
1664
|
+
try {
|
|
1665
|
+
const schemaDataNode = createSchemaDataNode(createSchemaTree(fields).rootNode, control);
|
|
1666
|
+
const Render = useControlRendererComponent(definition, renderer, options, schemaDataNode);
|
|
1667
|
+
return /*#__PURE__*/jsx(Render, {});
|
|
1668
|
+
} finally {
|
|
1669
|
+
_effect2();
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* @deprecated Use RenderForm instead.
|
|
1674
|
+
*/
|
|
1675
|
+
function NewControlRenderer({
|
|
1676
|
+
definition,
|
|
1677
|
+
renderer,
|
|
1678
|
+
options,
|
|
1679
|
+
parentDataNode
|
|
1680
|
+
}) {
|
|
1681
|
+
var _effect3 = useComponentTracking();
|
|
1682
|
+
try {
|
|
1683
|
+
const Render = useControlRendererComponent(definition, renderer, options, parentDataNode);
|
|
1684
|
+
return /*#__PURE__*/jsx(Render, {});
|
|
1685
|
+
} finally {
|
|
1686
|
+
_effect3();
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* @deprecated Use RenderForm instead.
|
|
1691
|
+
*/
|
|
1692
|
+
function useControlRenderer(definition, fields, renderer, options = {}) {
|
|
1693
|
+
const r = useUpdatedRef({
|
|
1694
|
+
definition,
|
|
1695
|
+
fields,
|
|
1696
|
+
renderer,
|
|
1697
|
+
options
|
|
1698
|
+
});
|
|
1699
|
+
return useCallback(({
|
|
1700
|
+
control,
|
|
1701
|
+
parentPath
|
|
1702
|
+
}) => {
|
|
1703
|
+
return /*#__PURE__*/jsx(ControlRenderer, _extends({}, r.current, {
|
|
1704
|
+
control: control,
|
|
1705
|
+
parentPath: parentPath
|
|
1706
|
+
}));
|
|
1707
|
+
}, [r]);
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
export { AppendAdornmentPriority, ControlRenderer, LabelType, NewControlRenderer, RenderForm, WrapAdornmentPriority, accordionOptions, actionControl, actionHandlers, addMissingControls, addMissingControlsForSchema, adornmentOptions, appendMarkup, appendMarkupAt, applyArrayLengthRestrictions, applyDefaultForField, applyDefaultValues, applyExtensionToSchema, applyExtensionsToSchema, applyLengthRestrictions, applyValues, autocompleteOptions, checkListOptions, cleanDataForSchema, clearMultiValues, coerceToString, collectDifferences, compoundControl, controlTitle, createAction, createActionRenderer, createAdornmentRenderer, createArrayActions, createArrayRenderer, createDataRenderer, createDisplayRenderer, createFormRenderer, createGroupRenderer, createLabelRenderer, createLayoutRenderer, createVisibilityRenderer, dataControl, dateValidatorOptions, deepMerge, defaultControlForField, defaultDataProps, defaultValueForField, defaultValueForFields, displayOnlyOptions, dynamicDefaultValue, dynamicDisabled, dynamicReadonly, dynamicVisibility, elementValueForField, emptyGroupDefinition, fieldDisplayName, fieldEqExpr, fieldExpr, fieldHasTag, fieldOptionAdornment, findChildDefinition, findCompoundField, findControlsForCompound, findFieldPath, findNonDataGroups, findScalarField, getAllReferencedClasses, getAllValues, getDiffObject, getExternalEditData, getGroupClassOverrides, getIsEditing, getLastDefinedValue, getLengthRestrictions, getNullToggler, getOverrideClass, groupedControl, hasOptions, htmlDisplayControl, isAccordionAdornment, isIconAdornment, isOptionalAdornment, isSetFieldAdornment, jsonataExpr, jsonataOptions, jsonataValidatorOptions, layoutKeyForPlacement, lengthValidatorOptions, lookupChildDataContext, mergeObjects, radioButtonOptions, renderControlLayout, renderLayoutParts, renderOptionsFor, rendererClass, textDisplayControl, textfieldOptions, useControlDefinitionForSchema, useControlRenderer, useControlRendererComponent, useExpression, useUpdatedRef, validationVisitor, validatorOptions, wrapLayout, wrapMarkup, wrapMarkupAt };
|
|
2932
1711
|
//# sourceMappingURL=index.js.map
|