@react-typed-forms/schemas 15.2.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/RenderForm.d.ts +39 -0
- package/lib/controlBuilder.d.ts +3 -6
- package/lib/controlRender.d.ts +107 -87
- package/lib/index.cjs +535 -2117
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +3 -9
- package/lib/index.js +402 -1639
- 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 +8 -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 +149 -183
- 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.cjs
CHANGED
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var formsCore = require('@astroapps/forms-core');
|
|
2
2
|
var react = require('react');
|
|
3
3
|
var clsx = require('clsx');
|
|
4
|
-
var
|
|
5
|
-
var uuid = require('uuid');
|
|
4
|
+
var core = require('@react-typed-forms/core');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
|
|
8
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
8
|
|
|
10
9
|
var clsx__default = /*#__PURE__*/_interopDefaultLegacy(clsx);
|
|
11
|
-
var jsonata__default = /*#__PURE__*/_interopDefaultLegacy(jsonata);
|
|
12
10
|
|
|
13
|
-
function _arrayLikeToArray(r, a) {
|
|
14
|
-
(null == a || a > r.length) && (a = r.length);
|
|
15
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
16
|
-
return n;
|
|
17
|
-
}
|
|
18
|
-
function _createForOfIteratorHelperLoose(r, e) {
|
|
19
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
20
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
21
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
22
|
-
t && (r = t);
|
|
23
|
-
var o = 0;
|
|
24
|
-
return function () {
|
|
25
|
-
return o >= r.length ? {
|
|
26
|
-
done: !0
|
|
27
|
-
} : {
|
|
28
|
-
done: !1,
|
|
29
|
-
value: r[o++]
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
34
|
-
}
|
|
35
11
|
function _extends() {
|
|
36
12
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
37
13
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -41,9 +17,6 @@ function _extends() {
|
|
|
41
17
|
return n;
|
|
42
18
|
}, _extends.apply(null, arguments);
|
|
43
19
|
}
|
|
44
|
-
function _inheritsLoose(t, o) {
|
|
45
|
-
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
46
|
-
}
|
|
47
20
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
48
21
|
if (null == r) return {};
|
|
49
22
|
var t = {};
|
|
@@ -53,776 +26,6 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
53
26
|
}
|
|
54
27
|
return t;
|
|
55
28
|
}
|
|
56
|
-
function _setPrototypeOf(t, e) {
|
|
57
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
58
|
-
return t.__proto__ = e, t;
|
|
59
|
-
}, _setPrototypeOf(t, e);
|
|
60
|
-
}
|
|
61
|
-
function _unsupportedIterableToArray(r, a) {
|
|
62
|
-
if (r) {
|
|
63
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
64
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
65
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Enum representing the various field types.
|
|
71
|
-
*/
|
|
72
|
-
exports.FieldType = void 0;
|
|
73
|
-
(function (FieldType) {
|
|
74
|
-
FieldType["String"] = "String";
|
|
75
|
-
FieldType["Bool"] = "Bool";
|
|
76
|
-
FieldType["Int"] = "Int";
|
|
77
|
-
FieldType["Date"] = "Date";
|
|
78
|
-
FieldType["DateTime"] = "DateTime";
|
|
79
|
-
FieldType["Time"] = "Time";
|
|
80
|
-
FieldType["Double"] = "Double";
|
|
81
|
-
FieldType["EntityRef"] = "EntityRef";
|
|
82
|
-
FieldType["Compound"] = "Compound";
|
|
83
|
-
FieldType["AutoId"] = "AutoId";
|
|
84
|
-
FieldType["Image"] = "Image";
|
|
85
|
-
FieldType["Any"] = "Any";
|
|
86
|
-
})(exports.FieldType || (exports.FieldType = {}));
|
|
87
|
-
/**
|
|
88
|
-
* Enum representing the various validation message types.
|
|
89
|
-
*/
|
|
90
|
-
exports.ValidationMessageType = void 0;
|
|
91
|
-
(function (ValidationMessageType) {
|
|
92
|
-
ValidationMessageType["NotEmpty"] = "NotEmpty";
|
|
93
|
-
ValidationMessageType["MinLength"] = "MinLength";
|
|
94
|
-
ValidationMessageType["MaxLength"] = "MaxLength";
|
|
95
|
-
ValidationMessageType["NotAfterDate"] = "NotAfterDate";
|
|
96
|
-
ValidationMessageType["NotBeforeDate"] = "NotBeforeDate";
|
|
97
|
-
})(exports.ValidationMessageType || (exports.ValidationMessageType = {}));
|
|
98
|
-
function findField(fields, field) {
|
|
99
|
-
return fields.find(function (x) {
|
|
100
|
-
return x.field === field;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function isScalarField(sf) {
|
|
104
|
-
return !isCompoundField(sf);
|
|
105
|
-
}
|
|
106
|
-
function isCompoundField(sf) {
|
|
107
|
-
return sf.type === exports.FieldType.Compound;
|
|
108
|
-
}
|
|
109
|
-
function missingField(field) {
|
|
110
|
-
return {
|
|
111
|
-
field: "__missing",
|
|
112
|
-
type: exports.FieldType.Any,
|
|
113
|
-
displayName: field
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function nodeForSchema(field, lookup, parent) {
|
|
117
|
-
var node = {
|
|
118
|
-
id: parent ? parent.id + "/" + field.field : field.field,
|
|
119
|
-
field: field,
|
|
120
|
-
getSchema: lookup.getSchema,
|
|
121
|
-
parent: parent,
|
|
122
|
-
getChildNode: getChildNode,
|
|
123
|
-
getChildNodes: getChildNodes
|
|
124
|
-
};
|
|
125
|
-
return node;
|
|
126
|
-
function getChildNode(fieldName) {
|
|
127
|
-
if (isCompoundField(field) && !field.schemaRef && !field.treeChildren) {
|
|
128
|
-
var childField = field.children.find(function (x) {
|
|
129
|
-
return x.field === fieldName;
|
|
130
|
-
});
|
|
131
|
-
return childField ? nodeForSchema(childField, lookup, node) : undefined;
|
|
132
|
-
}
|
|
133
|
-
return getChildNodes(false, node).find(function (x) {
|
|
134
|
-
return x.field.field === fieldName;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
function getChildNodes(noRecurse, withParent) {
|
|
138
|
-
if (isCompoundField(field)) {
|
|
139
|
-
if (field.treeChildren) {
|
|
140
|
-
return noRecurse ? [] : parent.getChildNodes(false, withParent != null ? withParent : node);
|
|
141
|
-
}
|
|
142
|
-
var otherRef = field.schemaRef && lookup.getSchema(field.schemaRef);
|
|
143
|
-
if (otherRef) return otherRef.getChildNodes(false, withParent != null ? withParent : node);
|
|
144
|
-
return field.children.map(function (x) {
|
|
145
|
-
return nodeForSchema(x, lookup, withParent != null ? withParent : node);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
return [];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function createSchemaLookup(schemaMap) {
|
|
152
|
-
var lookup = {
|
|
153
|
-
getSchema: getSchema
|
|
154
|
-
};
|
|
155
|
-
return lookup;
|
|
156
|
-
function getSchema(schemaId) {
|
|
157
|
-
var fields = schemaMap[schemaId];
|
|
158
|
-
if (fields) {
|
|
159
|
-
return rootSchemaNode(fields, lookup);
|
|
160
|
-
}
|
|
161
|
-
return undefined;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
function makeSchemaDataNode(schema, control, parent, elementIndex) {
|
|
165
|
-
var indexId = typeof elementIndex === "number" ? "/" + elementIndex : "";
|
|
166
|
-
var dataNode = {
|
|
167
|
-
id: (parent ? parent.id + "/" + schema.field.field : schema.field.field) + indexId,
|
|
168
|
-
schema: schema,
|
|
169
|
-
control: control,
|
|
170
|
-
parent: parent,
|
|
171
|
-
elementIndex: elementIndex,
|
|
172
|
-
getChild: getChild,
|
|
173
|
-
getChildElement: getChildElement
|
|
174
|
-
};
|
|
175
|
-
return dataNode;
|
|
176
|
-
function getChild(childNode) {
|
|
177
|
-
var objControl = control;
|
|
178
|
-
if (objControl && objControl.current.isNull) {
|
|
179
|
-
objControl.value = {};
|
|
180
|
-
}
|
|
181
|
-
return makeSchemaDataNode(childNode, objControl == null ? void 0 : objControl.fields[childNode.field.field], dataNode);
|
|
182
|
-
}
|
|
183
|
-
function getChildElement(elementIndex) {
|
|
184
|
-
var _control$elements;
|
|
185
|
-
return makeSchemaDataNode(schema, control == null || (_control$elements = control.elements) == null ? void 0 : _control$elements[elementIndex], dataNode, elementIndex);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function schemaDataForFieldRef(fieldRef, schema) {
|
|
189
|
-
var _fieldRef$split;
|
|
190
|
-
return schemaDataForFieldPath((_fieldRef$split = fieldRef == null ? void 0 : fieldRef.split("/")) != null ? _fieldRef$split : [], schema);
|
|
191
|
-
}
|
|
192
|
-
function schemaForFieldRef(fieldRef, schema) {
|
|
193
|
-
var _fieldRef$split2;
|
|
194
|
-
return schemaForFieldPath((_fieldRef$split2 = fieldRef == null ? void 0 : fieldRef.split("/")) != null ? _fieldRef$split2 : [], schema);
|
|
195
|
-
}
|
|
196
|
-
function traverseSchemaPath(fieldPath, schema, acc, next) {
|
|
197
|
-
var i = 0;
|
|
198
|
-
while (i < fieldPath.length) {
|
|
199
|
-
var nextField = fieldPath[i];
|
|
200
|
-
var childNode = nextField === ".." ? schema.parent : schema.getChildNode(nextField);
|
|
201
|
-
if (!childNode) {
|
|
202
|
-
childNode = nodeForSchema(missingField(nextField), schema, schema);
|
|
203
|
-
}
|
|
204
|
-
acc = next(acc, childNode);
|
|
205
|
-
schema = childNode;
|
|
206
|
-
i++;
|
|
207
|
-
}
|
|
208
|
-
return acc;
|
|
209
|
-
}
|
|
210
|
-
function traverseData(fieldPath, root, data) {
|
|
211
|
-
return traverseSchemaPath(fieldPath, root, data, function (acc, n) {
|
|
212
|
-
return acc == null ? void 0 : acc[n.field.field];
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
function schemaDataForFieldPath(fieldPath, dataNode) {
|
|
216
|
-
var i = 0;
|
|
217
|
-
while (i < fieldPath.length) {
|
|
218
|
-
var _nextNode;
|
|
219
|
-
var nextField = fieldPath[i];
|
|
220
|
-
var nextNode = nextField === ".." ? dataNode.parent : lookupField(nextField);
|
|
221
|
-
(_nextNode = nextNode) != null ? _nextNode : nextNode = makeSchemaDataNode(nodeForSchema(missingField(nextField), dataNode.schema, dataNode.schema), core.newControl(undefined));
|
|
222
|
-
dataNode = nextNode;
|
|
223
|
-
i++;
|
|
224
|
-
}
|
|
225
|
-
return dataNode;
|
|
226
|
-
function lookupField(field) {
|
|
227
|
-
var childNode = dataNode.schema.getChildNode(field);
|
|
228
|
-
if (childNode) {
|
|
229
|
-
return dataNode.getChild(childNode);
|
|
230
|
-
}
|
|
231
|
-
return undefined;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
function schemaForFieldPath(fieldPath, schema) {
|
|
235
|
-
var i = 0;
|
|
236
|
-
while (i < fieldPath.length) {
|
|
237
|
-
var nextField = fieldPath[i];
|
|
238
|
-
var childNode = nextField === ".." ? schema.parent : schema.getChildNode(nextField);
|
|
239
|
-
if (!childNode) {
|
|
240
|
-
childNode = nodeForSchema(missingField(nextField), schema, schema);
|
|
241
|
-
}
|
|
242
|
-
schema = childNode;
|
|
243
|
-
i++;
|
|
244
|
-
}
|
|
245
|
-
return schema;
|
|
246
|
-
}
|
|
247
|
-
function rootSchemaNode(fields, lookup) {
|
|
248
|
-
if (lookup === void 0) {
|
|
249
|
-
lookup = {
|
|
250
|
-
getSchema: function getSchema(schemaId) {
|
|
251
|
-
return undefined;
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
return nodeForSchema({
|
|
256
|
-
type: exports.FieldType.Compound,
|
|
257
|
-
field: "",
|
|
258
|
-
children: fields
|
|
259
|
-
}, lookup, undefined);
|
|
260
|
-
}
|
|
261
|
-
function getSchemaNodePath(node) {
|
|
262
|
-
var paths = [];
|
|
263
|
-
var curNode = node;
|
|
264
|
-
while (curNode) {
|
|
265
|
-
paths.push(curNode.field.field);
|
|
266
|
-
curNode = curNode.parent;
|
|
267
|
-
}
|
|
268
|
-
return paths.reverse();
|
|
269
|
-
}
|
|
270
|
-
function isCompoundNode(node) {
|
|
271
|
-
return isCompoundField(node.field);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Returns the relative path from a parent node to a child node.
|
|
275
|
-
* @param parent
|
|
276
|
-
* @param child
|
|
277
|
-
*/
|
|
278
|
-
function relativePath(parent, child) {
|
|
279
|
-
// return the path from child to parent
|
|
280
|
-
if (parent.id === child.id) return "";
|
|
281
|
-
var parentPath = getSchemaNodePath(parent);
|
|
282
|
-
var childPath = getSchemaNodePath(child);
|
|
283
|
-
var i = 0;
|
|
284
|
-
while (i < parentPath.length && i < childPath.length && parentPath[i] === childPath[i]) {
|
|
285
|
-
i++;
|
|
286
|
-
}
|
|
287
|
-
var upLevels = parentPath.length - i;
|
|
288
|
-
var downPath = childPath.slice(i).join("/");
|
|
289
|
-
return "../".repeat(upLevels) + downPath;
|
|
290
|
-
}
|
|
291
|
-
exports.SchemaTags = void 0;
|
|
292
|
-
(function (SchemaTags) {
|
|
293
|
-
SchemaTags["NoControl"] = "_NoControl";
|
|
294
|
-
SchemaTags["HtmlEditor"] = "_HtmlEditor";
|
|
295
|
-
SchemaTags["ControlGroup"] = "_ControlGroup:";
|
|
296
|
-
SchemaTags["ControlRef"] = "_ControlRef:";
|
|
297
|
-
SchemaTags["IdField"] = "_IdField:";
|
|
298
|
-
})(exports.SchemaTags || (exports.SchemaTags = {}));
|
|
299
|
-
function getTagParam(field, tag) {
|
|
300
|
-
var _field$tags;
|
|
301
|
-
return (_field$tags = field.tags) == null || (_field$tags = _field$tags.find(function (x) {
|
|
302
|
-
return x.startsWith(tag);
|
|
303
|
-
})) == null ? void 0 : _field$tags.substring(tag.length);
|
|
304
|
-
}
|
|
305
|
-
function makeParamTag(tag, value) {
|
|
306
|
-
return "" + tag + value;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
exports.ControlDefinitionType = void 0;
|
|
310
|
-
(function (ControlDefinitionType) {
|
|
311
|
-
ControlDefinitionType["Data"] = "Data";
|
|
312
|
-
ControlDefinitionType["Group"] = "Group";
|
|
313
|
-
ControlDefinitionType["Display"] = "Display";
|
|
314
|
-
ControlDefinitionType["Action"] = "Action";
|
|
315
|
-
})(exports.ControlDefinitionType || (exports.ControlDefinitionType = {}));
|
|
316
|
-
exports.DynamicPropertyType = void 0;
|
|
317
|
-
(function (DynamicPropertyType) {
|
|
318
|
-
DynamicPropertyType["Visible"] = "Visible";
|
|
319
|
-
DynamicPropertyType["DefaultValue"] = "DefaultValue";
|
|
320
|
-
DynamicPropertyType["Readonly"] = "Readonly";
|
|
321
|
-
DynamicPropertyType["Disabled"] = "Disabled";
|
|
322
|
-
DynamicPropertyType["Display"] = "Display";
|
|
323
|
-
DynamicPropertyType["Style"] = "Style";
|
|
324
|
-
DynamicPropertyType["LayoutStyle"] = "LayoutStyle";
|
|
325
|
-
DynamicPropertyType["AllowedOptions"] = "AllowedOptions";
|
|
326
|
-
DynamicPropertyType["Label"] = "Label";
|
|
327
|
-
DynamicPropertyType["ActionData"] = "ActionData";
|
|
328
|
-
})(exports.DynamicPropertyType || (exports.DynamicPropertyType = {}));
|
|
329
|
-
exports.AdornmentPlacement = void 0;
|
|
330
|
-
(function (AdornmentPlacement) {
|
|
331
|
-
AdornmentPlacement["ControlStart"] = "ControlStart";
|
|
332
|
-
AdornmentPlacement["ControlEnd"] = "ControlEnd";
|
|
333
|
-
AdornmentPlacement["LabelStart"] = "LabelStart";
|
|
334
|
-
AdornmentPlacement["LabelEnd"] = "LabelEnd";
|
|
335
|
-
})(exports.AdornmentPlacement || (exports.AdornmentPlacement = {}));
|
|
336
|
-
exports.ControlAdornmentType = void 0;
|
|
337
|
-
(function (ControlAdornmentType) {
|
|
338
|
-
ControlAdornmentType["Tooltip"] = "Tooltip";
|
|
339
|
-
ControlAdornmentType["Accordion"] = "Accordion";
|
|
340
|
-
ControlAdornmentType["HelpText"] = "HelpText";
|
|
341
|
-
ControlAdornmentType["Icon"] = "Icon";
|
|
342
|
-
ControlAdornmentType["SetField"] = "SetField";
|
|
343
|
-
ControlAdornmentType["Optional"] = "Optional";
|
|
344
|
-
})(exports.ControlAdornmentType || (exports.ControlAdornmentType = {}));
|
|
345
|
-
exports.DataRenderType = void 0;
|
|
346
|
-
(function (DataRenderType) {
|
|
347
|
-
DataRenderType["Standard"] = "Standard";
|
|
348
|
-
DataRenderType["Textfield"] = "Textfield";
|
|
349
|
-
DataRenderType["Radio"] = "Radio";
|
|
350
|
-
DataRenderType["HtmlEditor"] = "HtmlEditor";
|
|
351
|
-
DataRenderType["IconList"] = "IconList";
|
|
352
|
-
DataRenderType["CheckList"] = "CheckList";
|
|
353
|
-
DataRenderType["UserSelection"] = "UserSelection";
|
|
354
|
-
DataRenderType["Synchronised"] = "Synchronised";
|
|
355
|
-
DataRenderType["IconSelector"] = "IconSelector";
|
|
356
|
-
DataRenderType["DateTime"] = "DateTime";
|
|
357
|
-
DataRenderType["Checkbox"] = "Checkbox";
|
|
358
|
-
DataRenderType["Dropdown"] = "Dropdown";
|
|
359
|
-
DataRenderType["DisplayOnly"] = "DisplayOnly";
|
|
360
|
-
DataRenderType["Group"] = "Group";
|
|
361
|
-
DataRenderType["NullToggle"] = "NullToggle";
|
|
362
|
-
DataRenderType["Autocomplete"] = "Autocomplete";
|
|
363
|
-
DataRenderType["Jsonata"] = "Jsonata";
|
|
364
|
-
DataRenderType["Array"] = "Array";
|
|
365
|
-
DataRenderType["ArrayElement"] = "ArrayElement";
|
|
366
|
-
})(exports.DataRenderType || (exports.DataRenderType = {}));
|
|
367
|
-
exports.SyncTextType = void 0;
|
|
368
|
-
(function (SyncTextType) {
|
|
369
|
-
SyncTextType["Camel"] = "Camel";
|
|
370
|
-
SyncTextType["Snake"] = "Snake";
|
|
371
|
-
SyncTextType["Pascal"] = "Pascal";
|
|
372
|
-
})(exports.SyncTextType || (exports.SyncTextType = {}));
|
|
373
|
-
exports.GroupRenderType = void 0;
|
|
374
|
-
(function (GroupRenderType) {
|
|
375
|
-
GroupRenderType["Standard"] = "Standard";
|
|
376
|
-
GroupRenderType["Grid"] = "Grid";
|
|
377
|
-
GroupRenderType["Flex"] = "Flex";
|
|
378
|
-
GroupRenderType["Tabs"] = "Tabs";
|
|
379
|
-
GroupRenderType["GroupElement"] = "GroupElement";
|
|
380
|
-
GroupRenderType["SelectChild"] = "SelectChild";
|
|
381
|
-
})(exports.GroupRenderType || (exports.GroupRenderType = {}));
|
|
382
|
-
exports.DisplayDataType = void 0;
|
|
383
|
-
(function (DisplayDataType) {
|
|
384
|
-
DisplayDataType["Text"] = "Text";
|
|
385
|
-
DisplayDataType["Html"] = "Html";
|
|
386
|
-
DisplayDataType["Icon"] = "Icon";
|
|
387
|
-
DisplayDataType["Custom"] = "Custom";
|
|
388
|
-
})(exports.DisplayDataType || (exports.DisplayDataType = {}));
|
|
389
|
-
function visitControlDefinition(x, visitor, defaultValue) {
|
|
390
|
-
switch (x.type) {
|
|
391
|
-
case exports.ControlDefinitionType.Action:
|
|
392
|
-
return visitor.action(x);
|
|
393
|
-
case exports.ControlDefinitionType.Data:
|
|
394
|
-
return visitor.data(x);
|
|
395
|
-
case exports.ControlDefinitionType.Display:
|
|
396
|
-
return visitor.display(x);
|
|
397
|
-
case exports.ControlDefinitionType.Group:
|
|
398
|
-
return visitor.group(x);
|
|
399
|
-
default:
|
|
400
|
-
return defaultValue(x);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
function isGridRenderer(options) {
|
|
404
|
-
return options.type === exports.GroupRenderType.Grid;
|
|
405
|
-
}
|
|
406
|
-
function isSelectChildRenderer(options) {
|
|
407
|
-
return options.type === exports.GroupRenderType.SelectChild;
|
|
408
|
-
}
|
|
409
|
-
function isTabsRenderer(options) {
|
|
410
|
-
return options.type === exports.GroupRenderType.Tabs;
|
|
411
|
-
}
|
|
412
|
-
function isFlexRenderer(options) {
|
|
413
|
-
return options.type === exports.GroupRenderType.Flex;
|
|
414
|
-
}
|
|
415
|
-
function isDisplayOnlyRenderer(options) {
|
|
416
|
-
return options.type === exports.DataRenderType.DisplayOnly;
|
|
417
|
-
}
|
|
418
|
-
function isTextfieldRenderer(options) {
|
|
419
|
-
return options.type === exports.DataRenderType.Textfield;
|
|
420
|
-
}
|
|
421
|
-
function isDateTimeRenderer(options) {
|
|
422
|
-
return options.type === exports.DataRenderType.DateTime;
|
|
423
|
-
}
|
|
424
|
-
function isAutocompleteRenderer(options) {
|
|
425
|
-
return options.type === exports.DataRenderType.Autocomplete;
|
|
426
|
-
}
|
|
427
|
-
function isAutoCompleteClasses(options) {
|
|
428
|
-
switch (options == null ? void 0 : options.type) {
|
|
429
|
-
case exports.DataRenderType.Autocomplete:
|
|
430
|
-
return true;
|
|
431
|
-
default:
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
function isDataGroupRenderer(options) {
|
|
436
|
-
return (options == null ? void 0 : options.type) === exports.DataRenderType.Group;
|
|
437
|
-
}
|
|
438
|
-
function isArrayRenderer(options) {
|
|
439
|
-
return options.type === exports.DataRenderType.Array;
|
|
440
|
-
}
|
|
441
|
-
function isDataControl(c) {
|
|
442
|
-
return c.type === exports.ControlDefinitionType.Data;
|
|
443
|
-
}
|
|
444
|
-
function isGroupControl(c) {
|
|
445
|
-
return c.type === exports.ControlDefinitionType.Group;
|
|
446
|
-
}
|
|
447
|
-
function isActionControl(c) {
|
|
448
|
-
return c.type === exports.ControlDefinitionType.Action;
|
|
449
|
-
}
|
|
450
|
-
function isDisplayControl(c) {
|
|
451
|
-
return c.type === exports.ControlDefinitionType.Display;
|
|
452
|
-
}
|
|
453
|
-
function isCheckEntryClasses(options) {
|
|
454
|
-
switch (options == null ? void 0 : options.type) {
|
|
455
|
-
case exports.DataRenderType.Radio:
|
|
456
|
-
case exports.DataRenderType.CheckList:
|
|
457
|
-
return true;
|
|
458
|
-
default:
|
|
459
|
-
return false;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
var FormNodeImpl = /*#__PURE__*/function () {
|
|
463
|
-
function FormNodeImpl(id, definition, tree, parent) {
|
|
464
|
-
this.id = void 0;
|
|
465
|
-
this.definition = void 0;
|
|
466
|
-
this.tree = void 0;
|
|
467
|
-
this.parent = void 0;
|
|
468
|
-
this.children = [];
|
|
469
|
-
this.id = id;
|
|
470
|
-
this.definition = definition;
|
|
471
|
-
this.tree = tree;
|
|
472
|
-
this.parent = parent;
|
|
473
|
-
}
|
|
474
|
-
var _proto = FormNodeImpl.prototype;
|
|
475
|
-
_proto.getChildNodes = function getChildNodes() {
|
|
476
|
-
return this.children;
|
|
477
|
-
};
|
|
478
|
-
return FormNodeImpl;
|
|
479
|
-
}();
|
|
480
|
-
var FormTree = /*#__PURE__*/function () {
|
|
481
|
-
function FormTree() {}
|
|
482
|
-
var _proto2 = FormTree.prototype;
|
|
483
|
-
_proto2.createTempNode = function createTempNode(id, definition, children, parent) {
|
|
484
|
-
var _this = this;
|
|
485
|
-
var tempNode = {
|
|
486
|
-
id: id,
|
|
487
|
-
definition: definition,
|
|
488
|
-
tree: this,
|
|
489
|
-
parent: parent,
|
|
490
|
-
getChildNodes: function getChildNodes() {
|
|
491
|
-
return children != null ? children : _this.createChildNodes(tempNode, definition.children);
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
return tempNode;
|
|
495
|
-
};
|
|
496
|
-
_proto2.createChildNodes = function createChildNodes(parent, definitions) {
|
|
497
|
-
var _definitions$map,
|
|
498
|
-
_this2 = this;
|
|
499
|
-
return (_definitions$map = definitions == null ? void 0 : definitions.map(function (x, i) {
|
|
500
|
-
return _this2.createTempNode(parent.id + "_" + i, x, undefined, parent);
|
|
501
|
-
})) != null ? _definitions$map : [];
|
|
502
|
-
};
|
|
503
|
-
return FormTree;
|
|
504
|
-
}();
|
|
505
|
-
var FormTreeImpl = /*#__PURE__*/function (_FormTree) {
|
|
506
|
-
function FormTreeImpl(forms) {
|
|
507
|
-
var _this3;
|
|
508
|
-
_this3 = _FormTree.call(this) || this;
|
|
509
|
-
_this3.forms = void 0;
|
|
510
|
-
_this3.controlMap = {};
|
|
511
|
-
_this3.rootNode = void 0;
|
|
512
|
-
_this3.idCount = 1;
|
|
513
|
-
_this3.forms = forms;
|
|
514
|
-
_this3.rootNode = new FormNodeImpl("", {
|
|
515
|
-
type: "Group"
|
|
516
|
-
}, _this3);
|
|
517
|
-
return _this3;
|
|
518
|
-
}
|
|
519
|
-
_inheritsLoose(FormTreeImpl, _FormTree);
|
|
520
|
-
var _proto3 = FormTreeImpl.prototype;
|
|
521
|
-
_proto3.getByRefId = function getByRefId(id) {
|
|
522
|
-
return this.controlMap[id];
|
|
523
|
-
};
|
|
524
|
-
_proto3.register = function register(node) {
|
|
525
|
-
var _this4 = this;
|
|
526
|
-
this.controlMap[node.id] = node;
|
|
527
|
-
node.getChildNodes().forEach(function (x) {
|
|
528
|
-
return _this4.register(x);
|
|
529
|
-
});
|
|
530
|
-
};
|
|
531
|
-
_proto3.addChild = function addChild(parent, control) {
|
|
532
|
-
var _control$children,
|
|
533
|
-
_this5 = this;
|
|
534
|
-
var node = new FormNodeImpl(control.id ? control.id : "c" + this.idCount++, control, this, parent);
|
|
535
|
-
(_control$children = control.children) == null || _control$children.forEach(function (x) {
|
|
536
|
-
return _this5.addChild(node, x);
|
|
537
|
-
});
|
|
538
|
-
parent.getChildNodes().push(node);
|
|
539
|
-
this.register(node);
|
|
540
|
-
return node;
|
|
541
|
-
};
|
|
542
|
-
_proto3.getForm = function getForm(formId) {
|
|
543
|
-
return this.forms.getForm(formId);
|
|
544
|
-
};
|
|
545
|
-
return FormTreeImpl;
|
|
546
|
-
}(FormTree);
|
|
547
|
-
function legacyFormNode(definition) {
|
|
548
|
-
return createFormTree([definition]).rootNode.getChildNodes()[0];
|
|
549
|
-
}
|
|
550
|
-
function createFormTree(controls, getForm) {
|
|
551
|
-
if (getForm === void 0) {
|
|
552
|
-
getForm = {
|
|
553
|
-
getForm: function getForm() {
|
|
554
|
-
return undefined;
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
var tree = new FormTreeImpl(getForm);
|
|
559
|
-
controls.forEach(function (x) {
|
|
560
|
-
return tree.addChild(tree.rootNode, x);
|
|
561
|
-
});
|
|
562
|
-
return tree;
|
|
563
|
-
}
|
|
564
|
-
function createFormLookup(formMap) {
|
|
565
|
-
var lookup = {
|
|
566
|
-
getForm: getForm
|
|
567
|
-
};
|
|
568
|
-
var forms = Object.fromEntries(Object.entries(formMap).map(function (_ref) {
|
|
569
|
-
var k = _ref[0],
|
|
570
|
-
v = _ref[1];
|
|
571
|
-
return [k, createFormTree(v, lookup)];
|
|
572
|
-
}));
|
|
573
|
-
return lookup;
|
|
574
|
-
function getForm(formId) {
|
|
575
|
-
return forms[formId];
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
function fieldPathForDefinition(c) {
|
|
579
|
-
var fieldName = isGroupControl(c) ? c.compoundField : isDataControl(c) ? c.field : undefined;
|
|
580
|
-
return fieldName == null ? void 0 : fieldName.split("/");
|
|
581
|
-
}
|
|
582
|
-
function lookupDataNode(c, parentNode) {
|
|
583
|
-
var fieldNamePath = fieldPathForDefinition(c);
|
|
584
|
-
return fieldNamePath ? schemaDataForFieldPath(fieldNamePath, parentNode) : undefined;
|
|
585
|
-
}
|
|
586
|
-
function traverseParents(current, get, until) {
|
|
587
|
-
var outArray = [];
|
|
588
|
-
while (current && !(until != null && until(current))) {
|
|
589
|
-
outArray.push(get(current));
|
|
590
|
-
current = current.parent;
|
|
591
|
-
}
|
|
592
|
-
return outArray.reverse();
|
|
593
|
-
}
|
|
594
|
-
function getRootDataNode(dataNode) {
|
|
595
|
-
while (dataNode.parent) {
|
|
596
|
-
dataNode = dataNode.parent;
|
|
597
|
-
}
|
|
598
|
-
return dataNode;
|
|
599
|
-
}
|
|
600
|
-
function getJsonPath(dataNode) {
|
|
601
|
-
return traverseParents(dataNode, function (d) {
|
|
602
|
-
return d.elementIndex == null ? d.schema.field.field : d.elementIndex;
|
|
603
|
-
}, function (x) {
|
|
604
|
-
return !x.parent;
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
function getSchemaPath(schemaNode) {
|
|
608
|
-
return traverseParents(schemaNode, function (d) {
|
|
609
|
-
return d.field;
|
|
610
|
-
}, function (x) {
|
|
611
|
-
return !x.parent;
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
function getSchemaFieldList(schema) {
|
|
615
|
-
return schema.getChildNodes().map(function (x) {
|
|
616
|
-
return x.field;
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* @deprecated use visitFormNodeData instead
|
|
621
|
-
*/
|
|
622
|
-
function visitControlDataArray(controls, context, cb) {
|
|
623
|
-
if (!controls) return undefined;
|
|
624
|
-
for (var _iterator = _createForOfIteratorHelperLoose(controls), _step; !(_step = _iterator()).done;) {
|
|
625
|
-
var c = _step.value;
|
|
626
|
-
var r = visitControlData(c, context, cb);
|
|
627
|
-
if (r !== undefined) return r;
|
|
628
|
-
}
|
|
629
|
-
return undefined;
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* @deprecated use visitFormDataInContext instead
|
|
633
|
-
*/
|
|
634
|
-
function visitControlData(definition, ctx, cb) {
|
|
635
|
-
return visitFormDataInContext(ctx, legacyFormNode(definition), function (n, d) {
|
|
636
|
-
return cb(d, n);
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
function visitFormData(node, dataNode, cb, notSelf) {
|
|
640
|
-
var def = node.definition;
|
|
641
|
-
var result = !notSelf && isDataControl(def) ? cb(dataNode, def) : undefined;
|
|
642
|
-
if (result !== undefined) return result;
|
|
643
|
-
if (dataNode.elementIndex == null && dataNode.schema.field.collection) {
|
|
644
|
-
var _l = dataNode.control.elements.length;
|
|
645
|
-
for (var i = 0; i < _l; i++) {
|
|
646
|
-
var elemChild = dataNode.getChildElement(i);
|
|
647
|
-
var elemResult = visitFormData(node, elemChild, cb);
|
|
648
|
-
if (elemResult !== undefined) return elemResult;
|
|
649
|
-
}
|
|
650
|
-
return undefined;
|
|
651
|
-
}
|
|
652
|
-
if (dataNode.control.isNull) return undefined;
|
|
653
|
-
var children = node.getChildNodes();
|
|
654
|
-
var l = children.length;
|
|
655
|
-
for (var _i = 0; _i < l; _i++) {
|
|
656
|
-
var _elemResult = visitFormDataInContext(dataNode, children[_i], cb);
|
|
657
|
-
if (_elemResult !== undefined) return _elemResult;
|
|
658
|
-
}
|
|
659
|
-
return undefined;
|
|
660
|
-
}
|
|
661
|
-
function visitFormDataInContext(parentContext, node, cb) {
|
|
662
|
-
var dataNode = lookupDataNode(node.definition, parentContext);
|
|
663
|
-
return visitFormData(node, dataNode != null ? dataNode : parentContext, cb, !dataNode);
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
function buildSchema(def) {
|
|
667
|
-
return Object.entries(def).map(function (x) {
|
|
668
|
-
return x[1](x[0]);
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
function stringField(displayName, options) {
|
|
672
|
-
return makeScalarField(_extends({
|
|
673
|
-
type: exports.FieldType.String,
|
|
674
|
-
displayName: displayName
|
|
675
|
-
}, options));
|
|
676
|
-
}
|
|
677
|
-
function stringOptionsField(displayName) {
|
|
678
|
-
return makeScalarField({
|
|
679
|
-
type: exports.FieldType.String,
|
|
680
|
-
displayName: displayName,
|
|
681
|
-
options: [].slice.call(arguments, 1)
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
function withScalarOptions(options, v) {
|
|
685
|
-
return function (n) {
|
|
686
|
-
return _extends({}, v(n), options);
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
function makeScalarField(options) {
|
|
690
|
-
return function (n) {
|
|
691
|
-
return _extends({}, defaultScalarField(n, n), options);
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
function makeCompoundField(options) {
|
|
695
|
-
return function (n) {
|
|
696
|
-
return _extends({}, defaultCompoundField(n, n, false), options);
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
function intField(displayName, options) {
|
|
700
|
-
return makeScalarField(_extends({
|
|
701
|
-
type: exports.FieldType.Int,
|
|
702
|
-
displayName: displayName
|
|
703
|
-
}, options));
|
|
704
|
-
}
|
|
705
|
-
function doubleField(displayName, options) {
|
|
706
|
-
return makeScalarField(_extends({
|
|
707
|
-
type: exports.FieldType.Double,
|
|
708
|
-
displayName: displayName
|
|
709
|
-
}, options));
|
|
710
|
-
}
|
|
711
|
-
function dateField(displayName, options) {
|
|
712
|
-
return makeScalarField(_extends({
|
|
713
|
-
type: exports.FieldType.Date,
|
|
714
|
-
displayName: displayName
|
|
715
|
-
}, options));
|
|
716
|
-
}
|
|
717
|
-
function timeField(displayName, options) {
|
|
718
|
-
return makeScalarField(_extends({
|
|
719
|
-
type: exports.FieldType.Time,
|
|
720
|
-
displayName: displayName
|
|
721
|
-
}, options));
|
|
722
|
-
}
|
|
723
|
-
function dateTimeField(displayName, options) {
|
|
724
|
-
return makeScalarField(_extends({
|
|
725
|
-
type: exports.FieldType.DateTime,
|
|
726
|
-
displayName: displayName
|
|
727
|
-
}, options));
|
|
728
|
-
}
|
|
729
|
-
function boolField(displayName, options) {
|
|
730
|
-
return makeScalarField(_extends({
|
|
731
|
-
type: exports.FieldType.Bool,
|
|
732
|
-
displayName: displayName
|
|
733
|
-
}, options));
|
|
734
|
-
}
|
|
735
|
-
function compoundField(displayName, fields, other) {
|
|
736
|
-
return function (field) {
|
|
737
|
-
return _extends({}, defaultCompoundField(field, displayName, false), other, {
|
|
738
|
-
children: fields
|
|
739
|
-
});
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
function defaultScalarField(field, displayName) {
|
|
743
|
-
return {
|
|
744
|
-
field: field,
|
|
745
|
-
displayName: displayName,
|
|
746
|
-
type: exports.FieldType.String
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
function defaultCompoundField(field, displayName, collection) {
|
|
750
|
-
return {
|
|
751
|
-
field: field,
|
|
752
|
-
displayName: displayName,
|
|
753
|
-
type: exports.FieldType.Compound,
|
|
754
|
-
collection: collection,
|
|
755
|
-
children: []
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
function mergeField(field, mergeInto) {
|
|
759
|
-
var existing = mergeInto.find(function (x) {
|
|
760
|
-
return x.field === field.field;
|
|
761
|
-
});
|
|
762
|
-
if (existing) {
|
|
763
|
-
return mergeInto.map(function (x) {
|
|
764
|
-
return x !== existing ? x : _extends({}, x, {
|
|
765
|
-
onlyForTypes: mergeTypes(x.onlyForTypes, field.onlyForTypes)
|
|
766
|
-
});
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
return [].concat(mergeInto, [field]);
|
|
770
|
-
function mergeTypes(f, s) {
|
|
771
|
-
if (!f) return s;
|
|
772
|
-
if (!s) return f;
|
|
773
|
-
var extras = s.filter(function (x) {
|
|
774
|
-
return !f.includes(x);
|
|
775
|
-
});
|
|
776
|
-
return extras.length ? [].concat(f, extras) : f;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
function mergeFields(fields, name, value, newFields) {
|
|
780
|
-
var withType = fields.map(function (x) {
|
|
781
|
-
return x.isTypeField ? addFieldOption(x, name, value) : x;
|
|
782
|
-
});
|
|
783
|
-
return newFields.map(function (x) {
|
|
784
|
-
return _extends({}, x, {
|
|
785
|
-
onlyForTypes: [value]
|
|
786
|
-
});
|
|
787
|
-
}).reduce(function (af, x) {
|
|
788
|
-
return mergeField(x, af);
|
|
789
|
-
}, withType);
|
|
790
|
-
}
|
|
791
|
-
function addFieldOption(typeField, name, value) {
|
|
792
|
-
var _typeField$options;
|
|
793
|
-
var options = (_typeField$options = typeField.options) != null ? _typeField$options : [];
|
|
794
|
-
if (options.some(function (x) {
|
|
795
|
-
return x.value === value;
|
|
796
|
-
})) return typeField;
|
|
797
|
-
return _extends({}, typeField, {
|
|
798
|
-
options: [].concat(options, [{
|
|
799
|
-
name: name,
|
|
800
|
-
value: value
|
|
801
|
-
}])
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
function resolveSchemas(schemaMap) {
|
|
805
|
-
var out = {};
|
|
806
|
-
function resolveSchemaType(type) {
|
|
807
|
-
if (type in out) {
|
|
808
|
-
return out[type];
|
|
809
|
-
}
|
|
810
|
-
var resolvedFields = [];
|
|
811
|
-
out[type] = resolvedFields;
|
|
812
|
-
schemaMap[type].forEach(function (x) {
|
|
813
|
-
if (isCompoundField(x) && x.schemaRef) {
|
|
814
|
-
resolvedFields.push(_extends({}, x, {
|
|
815
|
-
children: resolveSchemaType(x.schemaRef)
|
|
816
|
-
}));
|
|
817
|
-
} else {
|
|
818
|
-
resolvedFields.push(x);
|
|
819
|
-
}
|
|
820
|
-
});
|
|
821
|
-
return resolvedFields;
|
|
822
|
-
}
|
|
823
|
-
Object.keys(schemaMap).forEach(resolveSchemaType);
|
|
824
|
-
return out;
|
|
825
|
-
}
|
|
826
29
|
|
|
827
30
|
/**
|
|
828
31
|
* Applies default values to the given record based on the provided schema fields.
|
|
@@ -838,7 +41,7 @@ function applyDefaultValues(v, fields, doneSet) {
|
|
|
838
41
|
(_doneSet = doneSet) != null ? _doneSet : doneSet = new Set();
|
|
839
42
|
doneSet.add(v);
|
|
840
43
|
var applyValue = fields.filter(function (x) {
|
|
841
|
-
return isCompoundField(x) || !(x.field in v);
|
|
44
|
+
return formsCore.isCompoundField(x) || !(x.field in v);
|
|
842
45
|
});
|
|
843
46
|
if (!applyValue.length) return v;
|
|
844
47
|
var out = _extends({}, v);
|
|
@@ -862,7 +65,7 @@ function applyDefaultForField(v, field, parent, notElement, doneSet) {
|
|
|
862
65
|
return applyDefaultForField(x, field, parent, true, doneSet);
|
|
863
66
|
});
|
|
864
67
|
}
|
|
865
|
-
if (isCompoundField(field)) {
|
|
68
|
+
if (formsCore.isCompoundField(field)) {
|
|
866
69
|
if (!v && !field.required) return v;
|
|
867
70
|
return applyDefaultValues(v, field.treeChildren ? parent : field.children, doneSet);
|
|
868
71
|
}
|
|
@@ -887,9 +90,10 @@ function defaultValueForFields(fields) {
|
|
|
887
90
|
function defaultValueForField(sf, required) {
|
|
888
91
|
if (sf.defaultValue !== undefined) return sf.defaultValue;
|
|
889
92
|
var isRequired = !!(required || sf.required);
|
|
890
|
-
if (isCompoundField(sf)) {
|
|
93
|
+
if (formsCore.isCompoundField(sf)) {
|
|
891
94
|
if (isRequired) {
|
|
892
|
-
var
|
|
95
|
+
var _sf$children;
|
|
96
|
+
var childValue = defaultValueForFields((_sf$children = sf.children) != null ? _sf$children : []);
|
|
893
97
|
return sf.collection ? [childValue] : childValue;
|
|
894
98
|
}
|
|
895
99
|
return sf.notNullable ? sf.collection ? [] : {} : undefined;
|
|
@@ -905,8 +109,9 @@ function defaultValueForField(sf, required) {
|
|
|
905
109
|
* @returns The element value for the schema field.
|
|
906
110
|
*/
|
|
907
111
|
function elementValueForField(sf) {
|
|
908
|
-
if (isCompoundField(sf)) {
|
|
909
|
-
|
|
112
|
+
if (formsCore.isCompoundField(sf)) {
|
|
113
|
+
var _sf$children2;
|
|
114
|
+
return defaultValueForFields((_sf$children2 = sf.children) != null ? _sf$children2 : []);
|
|
910
115
|
}
|
|
911
116
|
return sf.defaultValue;
|
|
912
117
|
}
|
|
@@ -917,7 +122,7 @@ function elementValueForField(sf) {
|
|
|
917
122
|
* @returns The found scalar field, or undefined if not found.
|
|
918
123
|
*/
|
|
919
124
|
function findScalarField(fields, field) {
|
|
920
|
-
return findField(fields, field);
|
|
125
|
+
return formsCore.findField(fields, field);
|
|
921
126
|
}
|
|
922
127
|
/**
|
|
923
128
|
* Finds a compound field in the provided schema fields.
|
|
@@ -926,7 +131,7 @@ function findScalarField(fields, field) {
|
|
|
926
131
|
* @returns The found compound field, or undefined if not found.
|
|
927
132
|
*/
|
|
928
133
|
function findCompoundField(fields, field) {
|
|
929
|
-
return findField(fields, field);
|
|
134
|
+
return formsCore.findField(fields, field);
|
|
930
135
|
}
|
|
931
136
|
/**
|
|
932
137
|
* Checks if a field has a specific tag.
|
|
@@ -963,39 +168,39 @@ function hasOptions(o) {
|
|
|
963
168
|
* @returns The default control definition for the schema field.
|
|
964
169
|
*/
|
|
965
170
|
function defaultControlForField(sf, noChildren) {
|
|
966
|
-
if (isCompoundField(sf)) {
|
|
967
|
-
var ref = getTagParam(sf,
|
|
171
|
+
if (formsCore.isCompoundField(sf)) {
|
|
172
|
+
var ref = formsCore.getTagParam(sf, formsCore.SchemaTags.ControlRef);
|
|
968
173
|
return {
|
|
969
|
-
type:
|
|
174
|
+
type: formsCore.ControlDefinitionType.Data,
|
|
970
175
|
title: sf.displayName,
|
|
971
176
|
field: sf.field,
|
|
972
177
|
required: sf.required,
|
|
973
178
|
childRefId: ref,
|
|
974
179
|
children: !noChildren && !ref ? sf.children.filter(function (x) {
|
|
975
|
-
return !fieldHasTag(x,
|
|
180
|
+
return !fieldHasTag(x, formsCore.SchemaTags.NoControl);
|
|
976
181
|
}).map(function (x) {
|
|
977
182
|
return defaultControlForField(x);
|
|
978
183
|
}) : undefined
|
|
979
184
|
};
|
|
980
|
-
} else if (isScalarField(sf)) {
|
|
981
|
-
var htmlEditor = fieldHasTag(sf,
|
|
185
|
+
} else if (formsCore.isScalarField(sf)) {
|
|
186
|
+
var htmlEditor = fieldHasTag(sf, formsCore.SchemaTags.HtmlEditor);
|
|
982
187
|
return {
|
|
983
|
-
type:
|
|
188
|
+
type: formsCore.ControlDefinitionType.Data,
|
|
984
189
|
title: sf.displayName,
|
|
985
190
|
field: sf.field,
|
|
986
191
|
required: sf.required,
|
|
987
192
|
renderOptions: {
|
|
988
|
-
type: htmlEditor ?
|
|
193
|
+
type: htmlEditor ? formsCore.DataRenderType.HtmlEditor : formsCore.DataRenderType.Standard
|
|
989
194
|
}
|
|
990
195
|
};
|
|
991
196
|
}
|
|
992
197
|
throw "Unknown schema field";
|
|
993
198
|
}
|
|
994
199
|
function findControlsForCompound(compound, definition) {
|
|
995
|
-
if (isDataControl(definition) && compound.field.field === definition.field) {
|
|
200
|
+
if (formsCore.isDataControl(definition) && compound.field.field === definition.field) {
|
|
996
201
|
return [definition];
|
|
997
202
|
}
|
|
998
|
-
if (isGroupControl(definition)) {
|
|
203
|
+
if (formsCore.isGroupControl(definition)) {
|
|
999
204
|
var _definition$children$, _definition$children;
|
|
1000
205
|
if (definition.compoundField === compound.field.field) return [definition];
|
|
1001
206
|
return (_definition$children$ = (_definition$children = definition.children) == null ? void 0 : _definition$children.flatMap(function (d) {
|
|
@@ -1012,7 +217,7 @@ function findControlsForCompound(compound, definition) {
|
|
|
1012
217
|
function findNonDataGroups(controls) {
|
|
1013
218
|
return controls.flatMap(function (control) {
|
|
1014
219
|
var _control$children2;
|
|
1015
|
-
return isGroupControl(control) && !control.compoundField ? [control].concat(findNonDataGroups((_control$children2 = control.children) != null ? _control$children2 : [])) : [];
|
|
220
|
+
return formsCore.isGroupControl(control) && !control.compoundField ? [control].concat(findNonDataGroups((_control$children2 = control.children) != null ? _control$children2 : [])) : [];
|
|
1016
221
|
});
|
|
1017
222
|
}
|
|
1018
223
|
/**
|
|
@@ -1023,34 +228,7 @@ function findNonDataGroups(controls) {
|
|
|
1023
228
|
* @returns The control definitions with missing controls added.
|
|
1024
229
|
*/
|
|
1025
230
|
function addMissingControls(fields, controls, warning) {
|
|
1026
|
-
return addMissingControlsForSchema(
|
|
1027
|
-
}
|
|
1028
|
-
function registerSchemaEntries(formNode, parentSchema) {
|
|
1029
|
-
var formToSchema = {};
|
|
1030
|
-
var schemaToForm = {};
|
|
1031
|
-
function register(node, parentSchema) {
|
|
1032
|
-
var c = node.definition;
|
|
1033
|
-
var controlPath = fieldPathForDefinition(c);
|
|
1034
|
-
var dataSchema = controlPath ? schemaForFieldPath(controlPath, parentSchema) : undefined;
|
|
1035
|
-
if (isGroupControl(c) && dataSchema == null) dataSchema = parentSchema;
|
|
1036
|
-
if (dataSchema) {
|
|
1037
|
-
var _schemaToForm$dataSch;
|
|
1038
|
-
formToSchema[node.id] = dataSchema;
|
|
1039
|
-
var formNodes = (_schemaToForm$dataSch = schemaToForm[dataSchema.id]) != null ? _schemaToForm$dataSch : [];
|
|
1040
|
-
formNodes.push(node);
|
|
1041
|
-
schemaToForm[dataSchema.id] = formNodes;
|
|
1042
|
-
}
|
|
1043
|
-
node.getChildNodes().forEach(function (x) {
|
|
1044
|
-
var _dataSchema;
|
|
1045
|
-
return register(x, (_dataSchema = dataSchema) != null ? _dataSchema : parentSchema);
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
register(formNode, parentSchema);
|
|
1049
|
-
return {
|
|
1050
|
-
formToSchema: formToSchema,
|
|
1051
|
-
schemaToForm: schemaToForm,
|
|
1052
|
-
register: register
|
|
1053
|
-
};
|
|
231
|
+
return addMissingControlsForSchema(formsCore.createSchemaTree(fields).rootNode, controls, warning);
|
|
1054
232
|
}
|
|
1055
233
|
/**
|
|
1056
234
|
* Adds missing controls to the provided control definitions based on the schema fields.
|
|
@@ -1060,61 +238,55 @@ function registerSchemaEntries(formNode, parentSchema) {
|
|
|
1060
238
|
* @returns The control definitions with missing controls added.
|
|
1061
239
|
*/
|
|
1062
240
|
function addMissingControlsForSchema(schema, controls, warning) {
|
|
1063
|
-
var
|
|
1064
|
-
var
|
|
1065
|
-
|
|
1066
|
-
|
|
241
|
+
var controlMap = {};
|
|
242
|
+
var schemaControlMap = {};
|
|
243
|
+
var rootControls = controls.map(function (c) {
|
|
244
|
+
return toControlAndSchema(c, schema);
|
|
245
|
+
});
|
|
246
|
+
var rootSchema = {
|
|
247
|
+
schema: schema,
|
|
248
|
+
children: rootControls
|
|
249
|
+
};
|
|
250
|
+
addSchemaMapEntry("", rootSchema);
|
|
251
|
+
rootControls.forEach(addReferences);
|
|
252
|
+
var fields = schema.getChildNodes();
|
|
253
|
+
fields.forEach(addMissing);
|
|
254
|
+
return rootControls.map(toDefinition);
|
|
1067
255
|
function toDefinition(c) {
|
|
1068
|
-
var children = c.
|
|
1069
|
-
return _extends({}, c.
|
|
256
|
+
var children = c.children.length ? c.children.map(toDefinition) : null;
|
|
257
|
+
return _extends({}, c.control, {
|
|
1070
258
|
children: children
|
|
1071
259
|
});
|
|
1072
260
|
}
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Adds missing controls to the provided form tree based on the schema fields.
|
|
1076
|
-
* @param schema - The root schema node to use for adding missing controls.
|
|
1077
|
-
* @param tree - The form tree to add missing controls to.
|
|
1078
|
-
* @param warning - An optional function to call with warning messages.
|
|
1079
|
-
*/
|
|
1080
|
-
function addMissingControlsToForm(schema, tree, warning) {
|
|
1081
|
-
var _registerSchemaEntrie = registerSchemaEntries(tree.rootNode, schema),
|
|
1082
|
-
formToSchema = _registerSchemaEntrie.formToSchema,
|
|
1083
|
-
schemaToForm = _registerSchemaEntrie.schemaToForm,
|
|
1084
|
-
register = _registerSchemaEntrie.register;
|
|
1085
|
-
schema.getChildNodes().forEach(addMissing);
|
|
1086
|
-
return;
|
|
1087
261
|
function addMissing(schemaNode) {
|
|
1088
|
-
if (fieldHasTag(schemaNode.field,
|
|
262
|
+
if (fieldHasTag(schemaNode.field, formsCore.SchemaTags.NoControl)) return;
|
|
1089
263
|
var skipChildren = false;
|
|
1090
|
-
var existingControls =
|
|
264
|
+
var existingControls = schemaControlMap[schemaNode.id];
|
|
1091
265
|
if (!existingControls) {
|
|
1092
266
|
var eligibleParents = getEligibleParents(schemaNode);
|
|
1093
|
-
var desiredGroup = getTagParam(schemaNode.field,
|
|
1094
|
-
var parentGroup = desiredGroup ?
|
|
267
|
+
var desiredGroup = formsCore.getTagParam(schemaNode.field, formsCore.SchemaTags.ControlGroup);
|
|
268
|
+
var parentGroup = desiredGroup ? controlMap[desiredGroup] : undefined;
|
|
1095
269
|
if (!parentGroup && desiredGroup) warning == null || warning("No group '" + desiredGroup + "' for " + schemaNode.id);
|
|
1096
|
-
if (parentGroup && eligibleParents.indexOf(
|
|
270
|
+
if (parentGroup && eligibleParents.indexOf(parentGroup.schema.id) < 0) {
|
|
1097
271
|
warning == null || warning("Target group '" + desiredGroup + "' is not an eligible parent for '" + schemaNode.id + "'");
|
|
1098
272
|
parentGroup = undefined;
|
|
1099
273
|
}
|
|
1100
274
|
if (!parentGroup && eligibleParents.length) {
|
|
1101
|
-
var
|
|
1102
|
-
parentGroup = (
|
|
275
|
+
var _schemaControlMap$eli;
|
|
276
|
+
parentGroup = (_schemaControlMap$eli = schemaControlMap[eligibleParents[0]]) == null ? void 0 : _schemaControlMap$eli[0];
|
|
1103
277
|
}
|
|
1104
278
|
if (parentGroup) {
|
|
1105
279
|
var _newControl = defaultControlForField(schemaNode.field, true);
|
|
1106
280
|
skipChildren = !!_newControl.childRefId;
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
var newNode = tree.addChild(parentGroup, _newControl);
|
|
1110
|
-
register(newNode, parentSchemaNode);
|
|
281
|
+
_newControl.field = formsCore.relativePath(parentGroup.schema, schemaNode);
|
|
282
|
+
parentGroup.children.push(toControlAndSchema(_newControl, parentGroup.schema, parentGroup));
|
|
1111
283
|
} else warning == null || warning("Could not find a parent group for: " + schemaNode.id);
|
|
1112
284
|
} else {
|
|
1113
285
|
skipChildren = existingControls.some(function (x) {
|
|
1114
|
-
return x.
|
|
286
|
+
return x.control.childRefId;
|
|
1115
287
|
});
|
|
1116
288
|
}
|
|
1117
|
-
if (!skipChildren) schemaNode.getChildNodes(
|
|
289
|
+
if (!skipChildren) schemaNode.getChildNodes().forEach(addMissing);
|
|
1118
290
|
}
|
|
1119
291
|
function getEligibleParents(schemaNode) {
|
|
1120
292
|
var eligibleParents = [];
|
|
@@ -1122,16 +294,54 @@ function addMissingControlsToForm(schema, tree, warning) {
|
|
|
1122
294
|
while (parent) {
|
|
1123
295
|
eligibleParents.push(parent.id);
|
|
1124
296
|
if (parent.field.collection) break;
|
|
1125
|
-
if (!parent.parent) parent.getChildNodes(
|
|
297
|
+
if (!parent.parent) parent.getChildNodes().forEach(addCompound);
|
|
1126
298
|
parent = parent.parent;
|
|
1127
299
|
}
|
|
1128
300
|
return eligibleParents;
|
|
1129
301
|
function addCompound(node) {
|
|
1130
|
-
if (isCompoundNode(node) && !node.field.collection) {
|
|
302
|
+
if (formsCore.isCompoundNode(node) && !node.field.collection) {
|
|
1131
303
|
eligibleParents.push(node.id);
|
|
1132
|
-
node.getChildNodes(
|
|
304
|
+
node.getChildNodes().forEach(addCompound);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function addReferences(c) {
|
|
309
|
+
c.children.forEach(addReferences);
|
|
310
|
+
if (c.control.childRefId) {
|
|
311
|
+
var ref = controlMap[c.control.childRefId];
|
|
312
|
+
if (ref) {
|
|
313
|
+
ref.children.forEach(function (x) {
|
|
314
|
+
return toControlAndSchema(x.control, c.schema, c, true);
|
|
315
|
+
});
|
|
316
|
+
return;
|
|
1133
317
|
}
|
|
318
|
+
console.warn("Missing reference", c.control.childRefId);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function addSchemaMapEntry(schemaId, entry) {
|
|
322
|
+
if (!schemaControlMap[schemaId]) schemaControlMap[schemaId] = [];
|
|
323
|
+
schemaControlMap[schemaId].push(entry);
|
|
324
|
+
}
|
|
325
|
+
function toControlAndSchema(c, parentSchema, parentNode, dontRegister) {
|
|
326
|
+
var _c$children$map, _c$children;
|
|
327
|
+
var controlPath = formsCore.fieldPathForDefinition(c);
|
|
328
|
+
var dataSchema = controlPath ? formsCore.schemaForFieldPath(controlPath, parentSchema) : undefined;
|
|
329
|
+
if (formsCore.isGroupControl(c) && dataSchema == null) dataSchema = parentSchema;
|
|
330
|
+
var entry = {
|
|
331
|
+
schema: dataSchema,
|
|
332
|
+
control: c,
|
|
333
|
+
children: [],
|
|
334
|
+
parent: parentNode
|
|
335
|
+
};
|
|
336
|
+
entry.children = (_c$children$map = (_c$children = c.children) == null ? void 0 : _c$children.map(function (x) {
|
|
337
|
+
var _dataSchema;
|
|
338
|
+
return toControlAndSchema(x, (_dataSchema = dataSchema) != null ? _dataSchema : parentSchema, entry, dontRegister);
|
|
339
|
+
})) != null ? _c$children$map : [];
|
|
340
|
+
if (!dontRegister && c.id) controlMap[c.id] = entry;
|
|
341
|
+
if (dataSchema) {
|
|
342
|
+
addSchemaMapEntry(dataSchema.id, entry);
|
|
1134
343
|
}
|
|
344
|
+
return entry;
|
|
1135
345
|
}
|
|
1136
346
|
}
|
|
1137
347
|
/**
|
|
@@ -1144,46 +354,24 @@ function useUpdatedRef(a) {
|
|
|
1144
354
|
r.current = a;
|
|
1145
355
|
return r;
|
|
1146
356
|
}
|
|
1147
|
-
/**
|
|
1148
|
-
* Checks if a control definition is readonly.
|
|
1149
|
-
* @param c - The control definition to check.
|
|
1150
|
-
* @returns True if the control definition is readonly, false otherwise.
|
|
1151
|
-
*/
|
|
1152
|
-
function isControlReadonly(c) {
|
|
1153
|
-
return isDataControl(c) && !!c.readonly;
|
|
1154
|
-
}
|
|
1155
|
-
/**
|
|
1156
|
-
* Checks if a control definition is disabled.
|
|
1157
|
-
* @param c - The control definition to check.
|
|
1158
|
-
* @returns True if the control definition is disabled, false otherwise.
|
|
1159
|
-
*/
|
|
1160
|
-
function isControlDisabled(c) {
|
|
1161
|
-
return isDataControl(c) && !!c.disabled;
|
|
1162
|
-
}
|
|
1163
|
-
/**
|
|
1164
|
-
* Returns the display-only render options for a control definition.
|
|
1165
|
-
* @param d - The control definition to get the display-only render options for.
|
|
1166
|
-
* @returns The display-only render options, or undefined if not applicable.
|
|
1167
|
-
*/
|
|
1168
|
-
function getDisplayOnlyOptions(d) {
|
|
1169
|
-
return isDataControl(d) && d.renderOptions && isDisplayOnlyRenderer(d.renderOptions) ? d.renderOptions : undefined;
|
|
1170
|
-
}
|
|
1171
357
|
/**
|
|
1172
358
|
* Cleans data for a schema based on the provided schema fields.
|
|
1173
359
|
* @param v - The data to clean.
|
|
1174
|
-
* @param
|
|
360
|
+
* @param schemaNode
|
|
1175
361
|
* @param removeIfDefault - Flag indicating if default values should be removed.
|
|
1176
362
|
* @returns The cleaned data.
|
|
1177
363
|
*/
|
|
1178
|
-
function cleanDataForSchema(v,
|
|
364
|
+
function cleanDataForSchema(v, schemaNode, removeIfDefault) {
|
|
365
|
+
var _fields$find;
|
|
1179
366
|
if (!v) return v;
|
|
1180
|
-
var
|
|
367
|
+
var fields = schemaNode.getResolvedFields();
|
|
368
|
+
var typeField = (_fields$find = fields.find(function (x) {
|
|
1181
369
|
return x.isTypeField;
|
|
1182
|
-
});
|
|
1183
|
-
var typeValue = typeField ? v[typeField
|
|
370
|
+
})) == null ? void 0 : _fields$find.field;
|
|
371
|
+
var typeValue = typeField ? v[typeField] : undefined;
|
|
1184
372
|
var cleanableFields = !removeIfDefault ? fields.filter(function (x) {
|
|
1185
373
|
var _x$onlyForTypes$lengt, _x$onlyForTypes;
|
|
1186
|
-
return isCompoundField(x) || ((_x$onlyForTypes$lengt = (_x$onlyForTypes = x.onlyForTypes) == null ? void 0 : _x$onlyForTypes.length) != null ? _x$onlyForTypes$lengt : 0) > 0;
|
|
374
|
+
return formsCore.isCompoundField(x) || ((_x$onlyForTypes$lengt = (_x$onlyForTypes = x.onlyForTypes) == null ? void 0 : _x$onlyForTypes.length) != null ? _x$onlyForTypes$lengt : 0) > 0;
|
|
1187
375
|
}) : fields;
|
|
1188
376
|
if (!cleanableFields.length) return v;
|
|
1189
377
|
var out = _extends({}, v);
|
|
@@ -1194,16 +382,16 @@ function cleanDataForSchema(v, fields, removeIfDefault) {
|
|
|
1194
382
|
delete out[x.field];
|
|
1195
383
|
return;
|
|
1196
384
|
}
|
|
1197
|
-
if (isCompoundField(x)) {
|
|
1198
|
-
var
|
|
385
|
+
if (formsCore.isCompoundField(x)) {
|
|
386
|
+
var childNode = schemaNode.createChildNode(x);
|
|
1199
387
|
if (x.collection) {
|
|
1200
388
|
if (Array.isArray(childValue)) {
|
|
1201
389
|
out[x.field] = childValue.map(function (cv) {
|
|
1202
|
-
return cleanDataForSchema(cv,
|
|
390
|
+
return cleanDataForSchema(cv, childNode, removeIfDefault);
|
|
1203
391
|
});
|
|
1204
392
|
}
|
|
1205
393
|
} else {
|
|
1206
|
-
out[x.field] = cleanDataForSchema(childValue,
|
|
394
|
+
out[x.field] = cleanDataForSchema(childValue, childNode, removeIfDefault);
|
|
1207
395
|
}
|
|
1208
396
|
}
|
|
1209
397
|
function canBeNull() {
|
|
@@ -1221,45 +409,28 @@ function cleanDataForSchema(v, fields, removeIfDefault) {
|
|
|
1221
409
|
* @returns An array of referenced classes.
|
|
1222
410
|
*/
|
|
1223
411
|
function getAllReferencedClasses(c, collectExtra) {
|
|
1224
|
-
var _c$
|
|
1225
|
-
var childClasses = (_c$
|
|
412
|
+
var _c$children2, _collectExtra;
|
|
413
|
+
var childClasses = (_c$children2 = c.children) == null ? void 0 : _c$children2.flatMap(function (x) {
|
|
1226
414
|
return getAllReferencedClasses(x, collectExtra);
|
|
1227
415
|
});
|
|
1228
416
|
var go = getGroupClassOverrides(c);
|
|
1229
|
-
var _ref = isDataControl(c) && isCheckEntryClasses(c.renderOptions) ? c.renderOptions : {},
|
|
417
|
+
var _ref = formsCore.isDataControl(c) && formsCore.isCheckEntryClasses(c.renderOptions) ? c.renderOptions : {},
|
|
1230
418
|
entryWrapperClass = _ref.entryWrapperClass,
|
|
1231
419
|
selectedClass = _ref.selectedClass,
|
|
1232
420
|
notSelectedClass = _ref.notSelectedClass;
|
|
1233
|
-
var
|
|
421
|
+
var groupOptions = formsCore.isGroupControl(c) ? c.groupOptions : undefined;
|
|
422
|
+
var gridClasses = groupOptions && formsCore.isGridRenderer(groupOptions) ? [groupOptions.rowClass] : [];
|
|
423
|
+
var _ref2 = formsCore.isDataControl(c) && formsCore.isAutoCompleteClasses(c.renderOptions) ? c.renderOptions : {},
|
|
1234
424
|
listContainerClass = _ref2.listContainerClass,
|
|
1235
425
|
listEntryClass = _ref2.listEntryClass,
|
|
1236
426
|
chipContainerClass = _ref2.chipContainerClass,
|
|
1237
427
|
chipCloseButtonClass = _ref2.chipCloseButtonClass;
|
|
1238
|
-
var tc = clsx__default["default"]([c.styleClass, c.layoutClass, c.labelClass].concat(Object.values(go), (_collectExtra = collectExtra == null ? void 0 : collectExtra(c)) != null ? _collectExtra : [], [entryWrapperClass, selectedClass, notSelectedClass, listContainerClass, listEntryClass, chipContainerClass, chipCloseButtonClass]).map(getOverrideClass));
|
|
428
|
+
var tc = clsx__default["default"]([c.styleClass, c.layoutClass, c.labelClass, c.textClass, c.labelTextClass].concat(gridClasses, Object.values(go), (_collectExtra = collectExtra == null ? void 0 : collectExtra(c)) != null ? _collectExtra : [], [entryWrapperClass, selectedClass, notSelectedClass, listContainerClass, listEntryClass, chipContainerClass, chipCloseButtonClass]).map(getOverrideClass));
|
|
1239
429
|
if (childClasses && !tc) return childClasses;
|
|
1240
430
|
if (!tc) return [];
|
|
1241
431
|
if (childClasses) return [tc].concat(childClasses);
|
|
1242
432
|
return [tc];
|
|
1243
433
|
}
|
|
1244
|
-
/**
|
|
1245
|
-
* Converts a JSON path array to a string.
|
|
1246
|
-
* @param jsonPath - The JSON path array to convert.
|
|
1247
|
-
* @param customIndex - Optional function to customize the index format.
|
|
1248
|
-
* @returns The JSON path string.
|
|
1249
|
-
*/
|
|
1250
|
-
function jsonPathString(jsonPath, customIndex) {
|
|
1251
|
-
var out = "";
|
|
1252
|
-
jsonPath.forEach(function (v, i) {
|
|
1253
|
-
if (typeof v === "number") {
|
|
1254
|
-
var _customIndex;
|
|
1255
|
-
out += (_customIndex = customIndex == null ? void 0 : customIndex(v)) != null ? _customIndex : "[" + v + "]";
|
|
1256
|
-
} else {
|
|
1257
|
-
if (i > 0) out += ".";
|
|
1258
|
-
out += v;
|
|
1259
|
-
}
|
|
1260
|
-
});
|
|
1261
|
-
return out;
|
|
1262
|
-
}
|
|
1263
434
|
/**
|
|
1264
435
|
* Finds a child control definition within a parent control definition.
|
|
1265
436
|
* @param parent - The parent control definition.
|
|
@@ -1332,10 +503,10 @@ function findFieldPath(fields, fieldPath) {
|
|
|
1332
503
|
var currentFields = fields;
|
|
1333
504
|
while (i < fieldNames.length && currentFields) {
|
|
1334
505
|
var cf = fieldNames[i];
|
|
1335
|
-
var nextField = findField(currentFields, cf);
|
|
506
|
+
var nextField = formsCore.findField(currentFields, cf);
|
|
1336
507
|
if (!nextField) return undefined;
|
|
1337
508
|
foundFields.push(nextField);
|
|
1338
|
-
currentFields = isCompoundField(nextField) && !nextField.collection ? nextField.children : undefined;
|
|
509
|
+
currentFields = formsCore.isCompoundField(nextField) && !nextField.collection ? nextField.children : undefined;
|
|
1339
510
|
i++;
|
|
1340
511
|
}
|
|
1341
512
|
return foundFields.length === fieldNames.length ? foundFields : undefined;
|
|
@@ -1385,21 +556,13 @@ function deepMerge(value, fallback) {
|
|
|
1385
556
|
function coerceToString(v) {
|
|
1386
557
|
return v == null ? "" : typeof v === "object" ? "error: " + JSON.stringify(v) : v.toString();
|
|
1387
558
|
}
|
|
1388
|
-
/**
|
|
1389
|
-
* Returns the group renderer options for a control definition.
|
|
1390
|
-
* @param {ControlDefinition} def - The control definition to get the group renderer options for.
|
|
1391
|
-
* @returns {GroupRenderOptions | undefined} - The group renderer options, or undefined if not applicable.
|
|
1392
|
-
*/
|
|
1393
|
-
function getGroupRendererOptions(def) {
|
|
1394
|
-
return isGroupControl(def) ? def.groupOptions : isDataControl(def) && isDataGroupRenderer(def.renderOptions) ? def.renderOptions.groupOptions : undefined;
|
|
1395
|
-
}
|
|
1396
559
|
/**
|
|
1397
560
|
* Returns the group class overrides for a control definition.
|
|
1398
561
|
* @param {ControlDefinition} def - The control definition to get the group class overrides for.
|
|
1399
562
|
* @returns {ControlClasses} - The group class overrides.
|
|
1400
563
|
*/
|
|
1401
564
|
function getGroupClassOverrides(def) {
|
|
1402
|
-
var go = getGroupRendererOptions(def);
|
|
565
|
+
var go = formsCore.getGroupRendererOptions(def);
|
|
1403
566
|
if (!go) return {};
|
|
1404
567
|
var childLayoutClass = go.childLayoutClass,
|
|
1405
568
|
childStyleClass = go.childStyleClass,
|
|
@@ -1410,26 +573,19 @@ function getGroupClassOverrides(def) {
|
|
|
1410
573
|
if (childLabelClass) out.labelClass = childLabelClass;
|
|
1411
574
|
return out;
|
|
1412
575
|
}
|
|
1413
|
-
/**
|
|
1414
|
-
* Checks if a control definition is display-only.
|
|
1415
|
-
* @param {ControlDefinition} def - The control definition to check.
|
|
1416
|
-
* @returns {boolean} - True if the control definition is display-only, false otherwise.
|
|
1417
|
-
*/
|
|
1418
|
-
function isControlDisplayOnly(def) {
|
|
1419
|
-
var _getGroupRendererOpti;
|
|
1420
|
-
return Boolean((_getGroupRendererOpti = getGroupRendererOptions(def)) == null ? void 0 : _getGroupRendererOpti.displayOnly);
|
|
1421
|
-
}
|
|
1422
576
|
/**
|
|
1423
577
|
* Combines multiple action handlers into a single handler.
|
|
1424
578
|
* @param {...(ControlActionHandler | undefined)[]} handlers - The action handlers to combine.
|
|
1425
579
|
* @returns {ControlActionHandler} - The combined action handler.
|
|
1426
580
|
*/
|
|
1427
581
|
function actionHandlers() {
|
|
1428
|
-
var
|
|
582
|
+
var nonNullHandlers = [].slice.call(arguments).filter(function (x) {
|
|
583
|
+
return x != null;
|
|
584
|
+
});
|
|
585
|
+
if (nonNullHandlers.length === 0) return undefined;
|
|
1429
586
|
return function (actionId, actionData, ctx) {
|
|
1430
|
-
for (var i = 0; i <
|
|
1431
|
-
var
|
|
1432
|
-
var res = (_handlers$i = (_handlers = handlers)[i]) == null ? void 0 : _handlers$i.call(_handlers, actionId, actionData, ctx);
|
|
587
|
+
for (var i = 0; i < nonNullHandlers.length; i++) {
|
|
588
|
+
var res = nonNullHandlers[i](actionId, actionData, ctx);
|
|
1433
589
|
if (res) return res;
|
|
1434
590
|
}
|
|
1435
591
|
return undefined;
|
|
@@ -1441,7 +597,7 @@ function getDiffObject(dataNode, force) {
|
|
|
1441
597
|
if (!c.dirty && !force) return undefined;
|
|
1442
598
|
if (c.isNull) return null;
|
|
1443
599
|
if (sf.collection && dataNode.elementIndex == null) {
|
|
1444
|
-
var idField = getTagParam(sf,
|
|
600
|
+
var idField = formsCore.getTagParam(sf, formsCore.SchemaTags.IdField);
|
|
1445
601
|
return c.as().elements.map(function (x, i) {
|
|
1446
602
|
var _getElementIndex;
|
|
1447
603
|
var change = getDiffObject(dataNode.getChildElement(i), idField !== undefined);
|
|
@@ -1450,9 +606,9 @@ function getDiffObject(dataNode, force) {
|
|
|
1450
606
|
edit: change
|
|
1451
607
|
};
|
|
1452
608
|
});
|
|
1453
|
-
} else if (isCompoundField(sf)) {
|
|
609
|
+
} else if (formsCore.isCompoundField(sf)) {
|
|
1454
610
|
var children = dataNode.schema.getChildNodes();
|
|
1455
|
-
var _idField = getTagParam(sf,
|
|
611
|
+
var _idField = formsCore.getTagParam(sf, formsCore.SchemaTags.IdField);
|
|
1456
612
|
return Object.fromEntries(children.flatMap(function (c) {
|
|
1457
613
|
var diff = getDiffObject(dataNode.getChild(c), _idField === c.field.field);
|
|
1458
614
|
return diff !== undefined ? [[c.field.field, diff]] : [];
|
|
@@ -1520,7 +676,7 @@ function applyValues(dataNode, value) {
|
|
|
1520
676
|
if (c.isEqual(c.initialValue, value)) return;
|
|
1521
677
|
if (sf.collection) {
|
|
1522
678
|
return;
|
|
1523
|
-
} else if (isCompoundField(sf)) {
|
|
679
|
+
} else if (formsCore.isCompoundField(sf)) {
|
|
1524
680
|
if (value == null) return;
|
|
1525
681
|
dataNode.schema.getChildNodes().forEach(function (c) {
|
|
1526
682
|
applyValues(dataNode.getChild(c), value[c.field.field]);
|
|
@@ -1559,7 +715,7 @@ function collectDifferences(dataNode, values) {
|
|
|
1559
715
|
var sf = dataNode.schema.field;
|
|
1560
716
|
if (sf.collection) {
|
|
1561
717
|
return;
|
|
1562
|
-
} else if (isCompoundField(sf)) {
|
|
718
|
+
} else if (formsCore.isCompoundField(sf)) {
|
|
1563
719
|
if (c.value == null) return;
|
|
1564
720
|
dataNode.schema.getChildNodes().forEach(function (c) {
|
|
1565
721
|
resetMultiValues(dataNode.getChild(c));
|
|
@@ -1576,7 +732,7 @@ function collectDifferences(dataNode, values) {
|
|
|
1576
732
|
}
|
|
1577
733
|
function validationVisitor(onInvalid) {
|
|
1578
734
|
return function (s) {
|
|
1579
|
-
if (isCompoundNode(s.schema)) return undefined;
|
|
735
|
+
if (formsCore.isCompoundNode(s.schema)) return undefined;
|
|
1580
736
|
var v = s.control;
|
|
1581
737
|
v.touched = true;
|
|
1582
738
|
if (!v.validate()) {
|
|
@@ -1585,32 +741,19 @@ function validationVisitor(onInvalid) {
|
|
|
1585
741
|
return undefined;
|
|
1586
742
|
};
|
|
1587
743
|
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
(function (
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
DateComparison["NotBefore"] = "NotBefore";
|
|
1598
|
-
DateComparison["NotAfter"] = "NotAfter";
|
|
1599
|
-
})(exports.DateComparison || (exports.DateComparison = {}));
|
|
1600
|
-
|
|
1601
|
-
exports.ExpressionType = void 0;
|
|
1602
|
-
(function (ExpressionType) {
|
|
1603
|
-
ExpressionType["Jsonata"] = "Jsonata";
|
|
1604
|
-
ExpressionType["Data"] = "Data";
|
|
1605
|
-
ExpressionType["DataMatch"] = "FieldValue";
|
|
1606
|
-
ExpressionType["UserMatch"] = "UserMatch";
|
|
1607
|
-
ExpressionType["NotEmpty"] = "NotEmpty";
|
|
1608
|
-
ExpressionType["UUID"] = "UUID";
|
|
1609
|
-
})(exports.ExpressionType || (exports.ExpressionType = {}));
|
|
744
|
+
function useExpression(defaultValue, runExpression, expression, coerce, bindings) {
|
|
745
|
+
var value = core.useControl(defaultValue);
|
|
746
|
+
core.createScopedEffect(function (scope) {
|
|
747
|
+
if (expression != null && expression.type) runExpression(scope, expression, function (x) {
|
|
748
|
+
return value.value = coerce(x);
|
|
749
|
+
}, bindings);else value.value = defaultValue;
|
|
750
|
+
}, value);
|
|
751
|
+
return value;
|
|
752
|
+
}
|
|
1610
753
|
|
|
1611
754
|
function dataControl(field, title, options) {
|
|
1612
755
|
return _extends({
|
|
1613
|
-
type:
|
|
756
|
+
type: formsCore.ControlDefinitionType.Data,
|
|
1614
757
|
field: field,
|
|
1615
758
|
title: title
|
|
1616
759
|
}, options);
|
|
@@ -1638,80 +781,80 @@ function renderOptionsFor(type) {
|
|
|
1638
781
|
};
|
|
1639
782
|
};
|
|
1640
783
|
}
|
|
1641
|
-
var autocompleteOptions = renderOptionsFor(
|
|
1642
|
-
var checkListOptions = renderOptionsFor(
|
|
1643
|
-
var radioButtonOptions = renderOptionsFor(
|
|
1644
|
-
var lengthValidatorOptions = validatorOptions(
|
|
1645
|
-
var jsonataValidatorOptions = validatorOptions(
|
|
1646
|
-
var dateValidatorOptions = validatorOptions(
|
|
1647
|
-
var accordionOptions = adornmentOptions(
|
|
1648
|
-
var textfieldOptions = renderOptionsFor(
|
|
1649
|
-
var displayOnlyOptions = renderOptionsFor(
|
|
1650
|
-
var jsonataOptions = renderOptionsFor(
|
|
784
|
+
var autocompleteOptions = renderOptionsFor(formsCore.DataRenderType.Autocomplete);
|
|
785
|
+
var checkListOptions = renderOptionsFor(formsCore.DataRenderType.CheckList);
|
|
786
|
+
var radioButtonOptions = renderOptionsFor(formsCore.DataRenderType.Radio);
|
|
787
|
+
var lengthValidatorOptions = validatorOptions(formsCore.ValidatorType.Length);
|
|
788
|
+
var jsonataValidatorOptions = validatorOptions(formsCore.ValidatorType.Jsonata);
|
|
789
|
+
var dateValidatorOptions = validatorOptions(formsCore.ValidatorType.Date);
|
|
790
|
+
var accordionOptions = adornmentOptions(formsCore.ControlAdornmentType.Accordion);
|
|
791
|
+
var textfieldOptions = renderOptionsFor(formsCore.DataRenderType.Textfield);
|
|
792
|
+
var displayOnlyOptions = renderOptionsFor(formsCore.DataRenderType.DisplayOnly);
|
|
793
|
+
var jsonataOptions = renderOptionsFor(formsCore.DataRenderType.Jsonata);
|
|
1651
794
|
function textDisplayControl(text, options) {
|
|
1652
795
|
return _extends({
|
|
1653
|
-
type:
|
|
796
|
+
type: formsCore.ControlDefinitionType.Display,
|
|
1654
797
|
displayData: {
|
|
1655
|
-
type:
|
|
798
|
+
type: formsCore.DisplayDataType.Text,
|
|
1656
799
|
text: text
|
|
1657
800
|
}
|
|
1658
801
|
}, options);
|
|
1659
802
|
}
|
|
1660
803
|
function htmlDisplayControl(html, options) {
|
|
1661
804
|
return _extends({
|
|
1662
|
-
type:
|
|
805
|
+
type: formsCore.ControlDefinitionType.Display,
|
|
1663
806
|
displayData: {
|
|
1664
|
-
type:
|
|
807
|
+
type: formsCore.DisplayDataType.Html,
|
|
1665
808
|
html: html
|
|
1666
809
|
}
|
|
1667
810
|
}, options);
|
|
1668
811
|
}
|
|
1669
812
|
function dynamicDefaultValue(expr) {
|
|
1670
813
|
return {
|
|
1671
|
-
type:
|
|
814
|
+
type: formsCore.DynamicPropertyType.DefaultValue,
|
|
1672
815
|
expr: expr
|
|
1673
816
|
};
|
|
1674
817
|
}
|
|
1675
818
|
function dynamicReadonly(expr) {
|
|
1676
819
|
return {
|
|
1677
|
-
type:
|
|
820
|
+
type: formsCore.DynamicPropertyType.Readonly,
|
|
1678
821
|
expr: expr
|
|
1679
822
|
};
|
|
1680
823
|
}
|
|
1681
824
|
function dynamicVisibility(expr) {
|
|
1682
825
|
return {
|
|
1683
|
-
type:
|
|
826
|
+
type: formsCore.DynamicPropertyType.Visible,
|
|
1684
827
|
expr: expr
|
|
1685
828
|
};
|
|
1686
829
|
}
|
|
1687
830
|
function dynamicDisabled(expr) {
|
|
1688
831
|
return {
|
|
1689
|
-
type:
|
|
832
|
+
type: formsCore.DynamicPropertyType.Disabled,
|
|
1690
833
|
expr: expr
|
|
1691
834
|
};
|
|
1692
835
|
}
|
|
1693
836
|
function fieldExpr(field) {
|
|
1694
837
|
return {
|
|
1695
|
-
type:
|
|
838
|
+
type: formsCore.ExpressionType.Data,
|
|
1696
839
|
field: field
|
|
1697
840
|
};
|
|
1698
841
|
}
|
|
1699
842
|
function fieldEqExpr(field, value) {
|
|
1700
843
|
return {
|
|
1701
|
-
type:
|
|
844
|
+
type: formsCore.ExpressionType.DataMatch,
|
|
1702
845
|
field: field,
|
|
1703
846
|
value: value
|
|
1704
847
|
};
|
|
1705
848
|
}
|
|
1706
849
|
function jsonataExpr(expression) {
|
|
1707
850
|
return {
|
|
1708
|
-
type:
|
|
851
|
+
type: formsCore.ExpressionType.Jsonata,
|
|
1709
852
|
expression: expression
|
|
1710
853
|
};
|
|
1711
854
|
}
|
|
1712
855
|
function groupedControl(children, title, options) {
|
|
1713
856
|
return _extends({
|
|
1714
|
-
type:
|
|
857
|
+
type: formsCore.ControlDefinitionType.Group,
|
|
1715
858
|
children: children,
|
|
1716
859
|
title: title,
|
|
1717
860
|
groupOptions: {
|
|
@@ -1722,7 +865,7 @@ function groupedControl(children, title, options) {
|
|
|
1722
865
|
}
|
|
1723
866
|
function compoundControl(field, title, children, options) {
|
|
1724
867
|
return _extends({
|
|
1725
|
-
type:
|
|
868
|
+
type: formsCore.ControlDefinitionType.Data,
|
|
1726
869
|
field: field,
|
|
1727
870
|
children: children,
|
|
1728
871
|
title: title,
|
|
@@ -1733,7 +876,7 @@ function compoundControl(field, title, children, options) {
|
|
|
1733
876
|
}
|
|
1734
877
|
function actionControl(actionText, actionId, options) {
|
|
1735
878
|
return _extends({
|
|
1736
|
-
type:
|
|
879
|
+
type: formsCore.ControlDefinitionType.Action,
|
|
1737
880
|
title: actionText,
|
|
1738
881
|
actionId: actionId
|
|
1739
882
|
}, options);
|
|
@@ -1746,10 +889,10 @@ function createAction(actionId, onClick, actionText, options) {
|
|
|
1746
889
|
}, options);
|
|
1747
890
|
}
|
|
1748
891
|
var emptyGroupDefinition = {
|
|
1749
|
-
type:
|
|
892
|
+
type: formsCore.ControlDefinitionType.Group,
|
|
1750
893
|
children: [],
|
|
1751
894
|
groupOptions: {
|
|
1752
|
-
type:
|
|
895
|
+
type: formsCore.GroupRenderType.Standard,
|
|
1753
896
|
hideTitle: true
|
|
1754
897
|
}
|
|
1755
898
|
};
|
|
@@ -1771,661 +914,20 @@ function applyExtensionToSchema(schemaMap, extension) {
|
|
|
1771
914
|
cro = _ref[1];
|
|
1772
915
|
outMap[field] = (Array.isArray(cro) ? cro : [cro]).reduce(function (a, cr) {
|
|
1773
916
|
var _cr$fields;
|
|
1774
|
-
return mergeFields(a, cr.name, cr.value, (_cr$fields = cr.fields) != null ? _cr$fields : []);
|
|
917
|
+
return formsCore.mergeFields(a, cr.name, cr.value, (_cr$fields = cr.fields) != null ? _cr$fields : []);
|
|
1775
918
|
}, outMap[field]);
|
|
1776
919
|
});
|
|
1777
920
|
return outMap;
|
|
1778
921
|
}
|
|
1779
922
|
function applyExtensionsToSchema(schemaMap, extensions) {
|
|
1780
|
-
return resolveSchemas(extensions.reduce(applyExtensionToSchema, schemaMap));
|
|
923
|
+
return formsCore.resolveSchemas(extensions.reduce(applyExtensionToSchema, schemaMap));
|
|
1781
924
|
}
|
|
1782
925
|
|
|
926
|
+
var _excluded$1 = ["formOptions", "style", "allowedOptions", "schemaInterface", "styleClass", "textClass", "displayOnly", "inline"];
|
|
927
|
+
var AppendAdornmentPriority = 0;
|
|
928
|
+
var WrapAdornmentPriority = 1000;
|
|
1783
929
|
/**
|
|
1784
|
-
*
|
|
1785
|
-
* @template A - The type of the hook result.
|
|
1786
|
-
* @template P - The type of the hook context.
|
|
1787
|
-
* @template S - The type of the hook state.
|
|
1788
|
-
* @param runHook - The function to run the hook.
|
|
1789
|
-
* @param state - The initial state of the hook.
|
|
1790
|
-
* @param deps - The dependencies of the hook.
|
|
1791
|
-
* @returns The dynamic hook generator.
|
|
1792
|
-
*/
|
|
1793
|
-
function makeHook(runHook, state, deps) {
|
|
1794
|
-
return {
|
|
1795
|
-
deps: deps,
|
|
1796
|
-
state: state,
|
|
1797
|
-
runHook: runHook
|
|
1798
|
-
};
|
|
1799
|
-
}
|
|
1800
|
-
/**
|
|
1801
|
-
* Converts an array of dependencies to a dependency string.
|
|
1802
|
-
* @template A - The type of the dependencies.
|
|
1803
|
-
* @param deps - The array of dependencies.
|
|
1804
|
-
* @param asHookDep - The function to convert a dependency to a hook dependency.
|
|
1805
|
-
* @returns The dependency string.
|
|
1806
|
-
*/
|
|
1807
|
-
function makeHookDepString(deps, asHookDep) {
|
|
1808
|
-
return deps.map(function (x) {
|
|
1809
|
-
return toDepString(asHookDep(x));
|
|
1810
|
-
}).join(",");
|
|
1811
|
-
}
|
|
1812
|
-
/**
|
|
1813
|
-
* Custom hook to use dynamic hooks.
|
|
1814
|
-
* @template P - The type of the hook context.
|
|
1815
|
-
* @template Hooks - The type of the hooks.
|
|
1816
|
-
* @param hooks - The hooks to use.
|
|
1817
|
-
* @returns A function that takes the hook context and returns the hook values.
|
|
1818
|
-
*/
|
|
1819
|
-
function useDynamicHooks(hooks) {
|
|
1820
|
-
var hookEntries = Object.entries(hooks);
|
|
1821
|
-
var deps = makeHookDepString(hookEntries, function (x) {
|
|
1822
|
-
return x[1].deps;
|
|
1823
|
-
});
|
|
1824
|
-
var ref = react.useRef({});
|
|
1825
|
-
var s = ref.current;
|
|
1826
|
-
hookEntries.forEach(function (x) {
|
|
1827
|
-
return s[x[0]] = x[1].state;
|
|
1828
|
-
});
|
|
1829
|
-
return react.useCallback(function (p) {
|
|
1830
|
-
return Object.fromEntries(hookEntries.map(function (_ref) {
|
|
1831
|
-
var f = _ref[0],
|
|
1832
|
-
hg = _ref[1];
|
|
1833
|
-
return [f, hg.runHook(p, ref.current[f])];
|
|
1834
|
-
}));
|
|
1835
|
-
}, [deps]);
|
|
1836
|
-
}
|
|
1837
|
-
/**
|
|
1838
|
-
* Converts a value to a dependency string.
|
|
1839
|
-
* @param x - The value to convert.
|
|
1840
|
-
* @returns The dependency string.
|
|
1841
|
-
*/
|
|
1842
|
-
function toDepString(x) {
|
|
1843
|
-
if (x === undefined) return "_";
|
|
1844
|
-
if (x === null) return "~";
|
|
1845
|
-
return x.toString();
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
function _finallyRethrows(body, finalizer) {
|
|
1849
|
-
try {
|
|
1850
|
-
var result = body();
|
|
1851
|
-
} catch (e) {
|
|
1852
|
-
return finalizer(true, e);
|
|
1853
|
-
}
|
|
1854
|
-
if (result && result.then) {
|
|
1855
|
-
return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
|
|
1856
|
-
}
|
|
1857
|
-
return finalizer(false, result);
|
|
1858
|
-
}
|
|
1859
|
-
function optionalHook(expr, useHook, coerce) {
|
|
1860
|
-
return expr && expr.type ? useHook(expr, coerce) : undefined;
|
|
1861
|
-
}
|
|
1862
|
-
function useEvalVisibilityHook(useEvalExpressionHook, definition, overrideDataNode) {
|
|
1863
|
-
var dynamicVisibility = useEvalDynamicBoolHook(definition, exports.DynamicPropertyType.Visible, useEvalExpressionHook);
|
|
1864
|
-
return makeDynamicPropertyHook(dynamicVisibility, function (ctx, _ref) {
|
|
1865
|
-
var definition = _ref.definition,
|
|
1866
|
-
overrideDataNode = _ref.overrideDataNode;
|
|
1867
|
-
return core.useComputed(function () {
|
|
1868
|
-
var dataNode = overrideDataNode != null ? overrideDataNode : ctx.dataNode;
|
|
1869
|
-
return !dataNode || matchesType(dataNode) && !hideDisplayOnly(dataNode, ctx.schemaInterface, definition);
|
|
1870
|
-
});
|
|
1871
|
-
}, {
|
|
1872
|
-
definition: definition,
|
|
1873
|
-
overrideDataNode: overrideDataNode
|
|
1874
|
-
});
|
|
1875
|
-
}
|
|
1876
|
-
function useEvalReadonlyHook(useEvalExpressionHook, definition) {
|
|
1877
|
-
var dynamicReadonly = useEvalDynamicBoolHook(definition, exports.DynamicPropertyType.Readonly, useEvalExpressionHook);
|
|
1878
|
-
return makeDynamicPropertyHook(dynamicReadonly, function (ctx, _ref2) {
|
|
1879
|
-
var definition = _ref2.definition;
|
|
1880
|
-
return core.useCalculatedControl(function () {
|
|
1881
|
-
return isControlReadonly(definition);
|
|
1882
|
-
});
|
|
1883
|
-
}, {
|
|
1884
|
-
definition: definition
|
|
1885
|
-
});
|
|
1886
|
-
}
|
|
1887
|
-
function useEvalStyleHook(useEvalExpressionHook, property, definition) {
|
|
1888
|
-
var dynamicStyle = useEvalDynamicHook(definition, property, useEvalExpressionHook);
|
|
1889
|
-
return makeDynamicPropertyHook(dynamicStyle, function () {
|
|
1890
|
-
return core.useControl(undefined);
|
|
1891
|
-
}, undefined);
|
|
1892
|
-
}
|
|
1893
|
-
function useEvalAllowedOptionsHook(useEvalExpressionHook, definition) {
|
|
1894
|
-
var dynamicAllowed = useEvalDynamicHook(definition, exports.DynamicPropertyType.AllowedOptions, useEvalExpressionHook);
|
|
1895
|
-
return makeDynamicPropertyHook(dynamicAllowed, function () {
|
|
1896
|
-
return core.useControl([]);
|
|
1897
|
-
}, undefined);
|
|
1898
|
-
}
|
|
1899
|
-
function useEvalDisabledHook(useEvalExpressionHook, definition) {
|
|
1900
|
-
var dynamicDisabled = useEvalDynamicBoolHook(definition, exports.DynamicPropertyType.Disabled, useEvalExpressionHook);
|
|
1901
|
-
return makeDynamicPropertyHook(dynamicDisabled, function (ctx) {
|
|
1902
|
-
return core.useComputed(function () {
|
|
1903
|
-
var _ctx$dataNode, _dataControl$meta$nul;
|
|
1904
|
-
var dataControl = (_ctx$dataNode = ctx.dataNode) == null ? void 0 : _ctx$dataNode.control;
|
|
1905
|
-
var setToNull = (dataControl == null || (_dataControl$meta$nul = dataControl.meta["nullControl"]) == null ? void 0 : _dataControl$meta$nul.value) === false;
|
|
1906
|
-
return setToNull || isControlDisabled(definition);
|
|
1907
|
-
});
|
|
1908
|
-
}, undefined);
|
|
1909
|
-
}
|
|
1910
|
-
function useEvalDisplayHook(useEvalExpressionHook, definition) {
|
|
1911
|
-
return useEvalDynamicHook(definition, exports.DynamicPropertyType.Display, useEvalExpressionHook);
|
|
1912
|
-
}
|
|
1913
|
-
function useEvalDefaultValueHook(useEvalExpressionHook, definition) {
|
|
1914
|
-
var dynamicValue = useEvalDynamicHook(definition, exports.DynamicPropertyType.DefaultValue, useEvalExpressionHook);
|
|
1915
|
-
return makeDynamicPropertyHook(dynamicValue, function (ctx, _ref3) {
|
|
1916
|
-
var definition = _ref3.definition;
|
|
1917
|
-
return core.useComputed(calcDefault);
|
|
1918
|
-
function calcDefault() {
|
|
1919
|
-
var _ctx$dataNode2;
|
|
1920
|
-
var _ref4 = isDataControl(definition) ? [definition.required, definition.defaultValue] : [false, undefined],
|
|
1921
|
-
required = _ref4[0],
|
|
1922
|
-
dcv = _ref4[1];
|
|
1923
|
-
var field = (_ctx$dataNode2 = ctx.dataNode) == null ? void 0 : _ctx$dataNode2.schema.field;
|
|
1924
|
-
return dcv != null ? dcv : field ? ctx.dataNode.elementIndex != null ? elementValueForField(field) : defaultValueForField(field, required) : undefined;
|
|
1925
|
-
}
|
|
1926
|
-
}, {
|
|
1927
|
-
definition: definition
|
|
1928
|
-
});
|
|
1929
|
-
}
|
|
1930
|
-
function useDataExpression(fvExpr, node, coerce) {
|
|
1931
|
-
if (coerce === void 0) {
|
|
1932
|
-
coerce = function coerce(x) {
|
|
1933
|
-
return x;
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
var otherField = schemaDataForFieldRef(fvExpr.field, node);
|
|
1937
|
-
return core.useCalculatedControl(function () {
|
|
1938
|
-
var _otherField$control;
|
|
1939
|
-
return coerce((_otherField$control = otherField.control) == null ? void 0 : _otherField$control.value);
|
|
1940
|
-
});
|
|
1941
|
-
}
|
|
1942
|
-
function useDataMatchExpression(fvExpr, node, coerce) {
|
|
1943
|
-
if (coerce === void 0) {
|
|
1944
|
-
coerce = function coerce(x) {
|
|
1945
|
-
return x;
|
|
1946
|
-
};
|
|
1947
|
-
}
|
|
1948
|
-
var otherField = schemaDataForFieldRef(fvExpr.field, node);
|
|
1949
|
-
return core.useCalculatedControl(function () {
|
|
1950
|
-
var _otherField$control2;
|
|
1951
|
-
var fv = (_otherField$control2 = otherField.control) == null ? void 0 : _otherField$control2.value;
|
|
1952
|
-
return coerce(Array.isArray(fv) ? fv.includes(fvExpr.value) : fv === fvExpr.value);
|
|
1953
|
-
});
|
|
1954
|
-
}
|
|
1955
|
-
function useNotEmptyExpression(fvExpr, node, schemaInterface, coerce) {
|
|
1956
|
-
if (coerce === void 0) {
|
|
1957
|
-
coerce = function coerce(x) {
|
|
1958
|
-
return x;
|
|
1959
|
-
};
|
|
1960
|
-
}
|
|
1961
|
-
var otherField = schemaDataForFieldRef(fvExpr.field, node);
|
|
1962
|
-
return core.useCalculatedControl(function () {
|
|
1963
|
-
var _otherField$control3;
|
|
1964
|
-
var fv = (_otherField$control3 = otherField.control) == null ? void 0 : _otherField$control3.value;
|
|
1965
|
-
var field = otherField.schema.field;
|
|
1966
|
-
return coerce(field && !schemaInterface.isEmptyValue(field, fv));
|
|
1967
|
-
});
|
|
1968
|
-
}
|
|
1969
|
-
function defaultEvalHooks(expr, context, coerce) {
|
|
1970
|
-
switch (expr.type) {
|
|
1971
|
-
case exports.ExpressionType.Jsonata:
|
|
1972
|
-
var bindings = core.useComputed(function () {
|
|
1973
|
-
return {
|
|
1974
|
-
formData: context.formData
|
|
1975
|
-
};
|
|
1976
|
-
});
|
|
1977
|
-
return useJsonataExpression(expr.expression, getRootDataNode(context.parentNode).control, getJsonPath(context.parentNode), bindings, coerce);
|
|
1978
|
-
case exports.ExpressionType.UUID:
|
|
1979
|
-
return useUuidExpression(coerce);
|
|
1980
|
-
case exports.ExpressionType.Data:
|
|
1981
|
-
return useDataExpression(expr, context.parentNode, coerce);
|
|
1982
|
-
case exports.ExpressionType.DataMatch:
|
|
1983
|
-
return useDataMatchExpression(expr, context.parentNode, coerce);
|
|
1984
|
-
case exports.ExpressionType.NotEmpty:
|
|
1985
|
-
return useNotEmptyExpression(expr, context.parentNode, context.schemaInterface, coerce);
|
|
1986
|
-
default:
|
|
1987
|
-
return core.useControl(undefined);
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
var defaultUseEvalExpressionHook = makeEvalExpressionHook(defaultEvalHooks);
|
|
1991
|
-
function makeEvalExpressionHook(f) {
|
|
1992
|
-
return function (expr, coerce) {
|
|
1993
|
-
return {
|
|
1994
|
-
deps: expr == null ? void 0 : expr.type,
|
|
1995
|
-
state: expr && expr.type ? expr : undefined,
|
|
1996
|
-
runHook: function runHook(ctx, state) {
|
|
1997
|
-
return state ? f(state, ctx, coerce) : undefined;
|
|
1998
|
-
}
|
|
1999
|
-
};
|
|
2000
|
-
};
|
|
2001
|
-
}
|
|
2002
|
-
function useEvalDynamicBoolHook(definition, type, useEvalExpressionHook) {
|
|
2003
|
-
return useEvalDynamicHook(definition, type, useEvalExpressionHook, function (x) {
|
|
2004
|
-
return Boolean(x);
|
|
2005
|
-
});
|
|
2006
|
-
}
|
|
2007
|
-
function useEvalDynamicHook(definition, type, useEvalExpressionHook, coerce) {
|
|
2008
|
-
var _definition$dynamic;
|
|
2009
|
-
if (coerce === void 0) {
|
|
2010
|
-
coerce = function coerce(x) {
|
|
2011
|
-
return x;
|
|
2012
|
-
};
|
|
2013
|
-
}
|
|
2014
|
-
var expression = (_definition$dynamic = definition.dynamic) == null ? void 0 : _definition$dynamic.find(function (x) {
|
|
2015
|
-
return x.type === type;
|
|
2016
|
-
});
|
|
2017
|
-
return useEvalExpressionHook(expression == null ? void 0 : expression.expr, coerce);
|
|
2018
|
-
}
|
|
2019
|
-
function matchesType(context) {
|
|
2020
|
-
var types = context.schema.field.onlyForTypes;
|
|
2021
|
-
if (types == null || types.length === 0) return true;
|
|
2022
|
-
var parent = context.parent;
|
|
2023
|
-
var typeNode = parent.schema.getChildNodes().find(function (x) {
|
|
2024
|
-
return x.field.isTypeField;
|
|
2025
|
-
});
|
|
2026
|
-
if (typeNode == null) return true;
|
|
2027
|
-
var typeField = parent.getChild(typeNode).control;
|
|
2028
|
-
return typeField && types.includes(typeField.value);
|
|
2029
|
-
}
|
|
2030
|
-
function hideDisplayOnly(context, schemaInterface, definition) {
|
|
2031
|
-
var _context$control;
|
|
2032
|
-
var displayOptions = getDisplayOnlyOptions(definition);
|
|
2033
|
-
return displayOptions && !displayOptions.emptyText && schemaInterface.isEmptyValue(context.schema.field, (_context$control = context.control) == null ? void 0 : _context$control.value);
|
|
2034
|
-
}
|
|
2035
|
-
function useUuidExpression(coerce) {
|
|
2036
|
-
if (coerce === void 0) {
|
|
2037
|
-
coerce = function coerce(x) {
|
|
2038
|
-
return x;
|
|
2039
|
-
};
|
|
2040
|
-
}
|
|
2041
|
-
return core.useControl(function () {
|
|
2042
|
-
return coerce(uuid.v4());
|
|
2043
|
-
});
|
|
2044
|
-
}
|
|
2045
|
-
function useJsonataExpression(jExpr, data, path, bindings, coerce) {
|
|
2046
|
-
if (coerce === void 0) {
|
|
2047
|
-
coerce = function coerce(x) {
|
|
2048
|
-
return x;
|
|
2049
|
-
};
|
|
2050
|
-
}
|
|
2051
|
-
var pathString = jsonPathString(path, function (x) {
|
|
2052
|
-
return "#$i[" + x + "]";
|
|
2053
|
-
});
|
|
2054
|
-
var fullExpr = pathString ? pathString + ".(" + jExpr + ")" : jExpr;
|
|
2055
|
-
var compiledExpr = react.useMemo(function () {
|
|
2056
|
-
try {
|
|
2057
|
-
return jsonata__default["default"](jExpr ? fullExpr : "null");
|
|
2058
|
-
} catch (e) {
|
|
2059
|
-
console.error(e);
|
|
2060
|
-
return jsonata__default["default"]("null");
|
|
2061
|
-
}
|
|
2062
|
-
}, [fullExpr]);
|
|
2063
|
-
var control = core.useControl();
|
|
2064
|
-
var listenerRef = react.useRef();
|
|
2065
|
-
var updateRef = react.useRef(0);
|
|
2066
|
-
var _useRefState = core.useRefState(function () {
|
|
2067
|
-
return new core.SubscriptionTracker(function () {
|
|
2068
|
-
var l = listenerRef.current;
|
|
2069
|
-
if (l) {
|
|
2070
|
-
listenerRef.current = undefined;
|
|
2071
|
-
core.addAfterChangesCallback(function () {
|
|
2072
|
-
listenerRef.current = l;
|
|
2073
|
-
l();
|
|
2074
|
-
});
|
|
2075
|
-
}
|
|
2076
|
-
});
|
|
2077
|
-
}),
|
|
2078
|
-
ref = _useRefState[0];
|
|
2079
|
-
react.useEffect(function () {
|
|
2080
|
-
var apply = function apply() {
|
|
2081
|
-
try {
|
|
2082
|
-
var tracker = ref.current;
|
|
2083
|
-
var _temp = _finallyRethrows(function () {
|
|
2084
|
-
updateRef.current++;
|
|
2085
|
-
var _coerce = coerce;
|
|
2086
|
-
return Promise.resolve(compiledExpr.evaluate(core.trackedValue(data, tracker.collectUsage), core.collectChanges(tracker.collectUsage, function () {
|
|
2087
|
-
return bindings == null ? void 0 : bindings.value;
|
|
2088
|
-
}))).then(function (_compiledExpr$evaluat) {
|
|
2089
|
-
control.value = _coerce(_compiledExpr$evaluat);
|
|
2090
|
-
});
|
|
2091
|
-
}, function (_wasThrown, _result) {
|
|
2092
|
-
if (! --updateRef.current) tracker.update();
|
|
2093
|
-
if (_wasThrown) throw _result;
|
|
2094
|
-
return _result;
|
|
2095
|
-
});
|
|
2096
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
2097
|
-
} catch (e) {
|
|
2098
|
-
return Promise.reject(e);
|
|
2099
|
-
}
|
|
2100
|
-
};
|
|
2101
|
-
listenerRef.current = apply;
|
|
2102
|
-
apply();
|
|
2103
|
-
}, [compiledExpr]);
|
|
2104
|
-
react.useEffect(function () {
|
|
2105
|
-
return function () {
|
|
2106
|
-
listenerRef.current = undefined;
|
|
2107
|
-
ref.current.cleanup();
|
|
2108
|
-
};
|
|
2109
|
-
}, []);
|
|
2110
|
-
return control;
|
|
2111
|
-
}
|
|
2112
|
-
function useEvalActionHook(useExpr, definition) {
|
|
2113
|
-
var dynamicValue = useEvalDynamicHook(definition, exports.DynamicPropertyType.ActionData, useExpr);
|
|
2114
|
-
return makeDynamicPropertyHook(dynamicValue, function () {
|
|
2115
|
-
return core.useControl(null);
|
|
2116
|
-
}, undefined);
|
|
2117
|
-
}
|
|
2118
|
-
function useEvalLabelText(useExpr, definition) {
|
|
2119
|
-
var dynamicValue = useEvalDynamicHook(definition, exports.DynamicPropertyType.Label, useExpr);
|
|
2120
|
-
return makeDynamicPropertyHook(dynamicValue, function () {
|
|
2121
|
-
return core.useControl(null);
|
|
2122
|
-
}, undefined);
|
|
2123
|
-
}
|
|
2124
|
-
function makeDynamicPropertyHook(dynamicValue, makeDefault, state, deps) {
|
|
2125
|
-
return {
|
|
2126
|
-
deps: deps === undefined ? dynamicValue.deps : [deps, dynamicValue.deps].map(toDepString).join(),
|
|
2127
|
-
runHook: function runHook(ctx, s) {
|
|
2128
|
-
var _dynamicValue$runHook, _dynamicValue$runHook2;
|
|
2129
|
-
return (_dynamicValue$runHook = (_dynamicValue$runHook2 = dynamicValue.runHook(ctx, s[0])) == null ? void 0 : _dynamicValue$runHook2.as()) != null ? _dynamicValue$runHook : makeDefault(ctx, s[1]);
|
|
2130
|
-
},
|
|
2131
|
-
state: [dynamicValue.state, state]
|
|
2132
|
-
};
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
function useMakeValidationHook(definition, useValidatorFor) {
|
|
2136
|
-
var _dd$validators;
|
|
2137
|
-
if (useValidatorFor === void 0) {
|
|
2138
|
-
useValidatorFor = useDefaultValidator;
|
|
2139
|
-
}
|
|
2140
|
-
var dd = isDataControl(definition) ? definition : undefined;
|
|
2141
|
-
var refData = useUpdatedRef({
|
|
2142
|
-
dd: dd,
|
|
2143
|
-
useValidatorFor: useValidatorFor
|
|
2144
|
-
});
|
|
2145
|
-
var depString = dd ? makeHookDepString((_dd$validators = dd.validators) != null ? _dd$validators : [], function (x) {
|
|
2146
|
-
return x.type;
|
|
2147
|
-
}) : "~";
|
|
2148
|
-
return react.useCallback(function (ctx) {
|
|
2149
|
-
var _ctx$dataContext$data, _ctx$dataContext$data2, _dd$validators2;
|
|
2150
|
-
var dd = refData.current.dd;
|
|
2151
|
-
if (!dd) return;
|
|
2152
|
-
var field = (_ctx$dataContext$data = (_ctx$dataContext$data2 = ctx.dataContext.dataNode) == null ? void 0 : _ctx$dataContext$data2.schema.field) != null ? _ctx$dataContext$data : {
|
|
2153
|
-
field: "__missing",
|
|
2154
|
-
type: exports.FieldType.Any
|
|
2155
|
-
};
|
|
2156
|
-
var control = ctx.control,
|
|
2157
|
-
hiddenControl = ctx.hiddenControl,
|
|
2158
|
-
schemaInterface = ctx.dataContext.schemaInterface;
|
|
2159
|
-
core.useValueChangeEffect(control, function () {
|
|
2160
|
-
return control.setError("default", "");
|
|
2161
|
-
});
|
|
2162
|
-
if (dd.required) core.useValidator(control, function (v) {
|
|
2163
|
-
return !hiddenControl.value && schemaInterface.isEmptyValue(field, v) ? schemaInterface.validationMessageText(field, exports.ValidationMessageType.NotEmpty, false, true) : null;
|
|
2164
|
-
}, "required");
|
|
2165
|
-
(_dd$validators2 = dd.validators) == null || _dd$validators2.forEach(function (v, i) {
|
|
2166
|
-
return useValidatorFor(v, _extends({}, ctx, {
|
|
2167
|
-
index: i,
|
|
2168
|
-
field: field,
|
|
2169
|
-
definition: dd
|
|
2170
|
-
}));
|
|
2171
|
-
});
|
|
2172
|
-
}, [!!dd, dd == null ? void 0 : dd.required, depString, useValidatorFor]);
|
|
2173
|
-
}
|
|
2174
|
-
function useDefaultValidator(validator, ctx) {
|
|
2175
|
-
switch (validator.type) {
|
|
2176
|
-
case exports.ValidatorType.Length:
|
|
2177
|
-
useLengthValidator(validator, ctx);
|
|
2178
|
-
break;
|
|
2179
|
-
case exports.ValidatorType.Jsonata:
|
|
2180
|
-
useJsonataValidator(validator, ctx);
|
|
2181
|
-
break;
|
|
2182
|
-
case exports.ValidatorType.Date:
|
|
2183
|
-
useDateValidator(validator, ctx);
|
|
2184
|
-
break;
|
|
2185
|
-
}
|
|
2186
|
-
}
|
|
2187
|
-
function useJsonataValidator(validator, ctx) {
|
|
2188
|
-
var sdn = ctx.dataContext.parentNode;
|
|
2189
|
-
var errorMsg = useJsonataExpression(validator.expression, getRootDataNode(sdn).control, getJsonPath(sdn), undefined, function (v) {
|
|
2190
|
-
return v == null ? null : typeof v === "string" ? v : JSON.stringify(v);
|
|
2191
|
-
});
|
|
2192
|
-
core.useValidator(ctx.control, function () {
|
|
2193
|
-
return !ctx.hiddenControl.value ? errorMsg.value : null;
|
|
2194
|
-
}, "jsonata" + ctx.index);
|
|
2195
|
-
}
|
|
2196
|
-
function useLengthValidator(lv, ctx) {
|
|
2197
|
-
var control = ctx.control,
|
|
2198
|
-
schemaInterface = ctx.dataContext.schemaInterface,
|
|
2199
|
-
hiddenControl = ctx.hiddenControl,
|
|
2200
|
-
field = ctx.field;
|
|
2201
|
-
core.useValidator(control, function (v) {
|
|
2202
|
-
var len = schemaInterface.controlLength(field, control);
|
|
2203
|
-
var hidden = hiddenControl.value;
|
|
2204
|
-
if (hidden) {
|
|
2205
|
-
return undefined;
|
|
2206
|
-
}
|
|
2207
|
-
if (lv.min != null && len < lv.min) {
|
|
2208
|
-
if (field != null && field.collection) {
|
|
2209
|
-
control.setValue(function (v) {
|
|
2210
|
-
return Array.isArray(v) ? v.concat(Array.from({
|
|
2211
|
-
length: lv.min - v.length
|
|
2212
|
-
})) : Array.from({
|
|
2213
|
-
length: lv.min
|
|
2214
|
-
});
|
|
2215
|
-
});
|
|
2216
|
-
} else {
|
|
2217
|
-
return schemaInterface.validationMessageText(field, exports.ValidationMessageType.MinLength, len, lv.min);
|
|
2218
|
-
}
|
|
2219
|
-
} else if (lv.max != null && len > lv.max) {
|
|
2220
|
-
return schemaInterface.validationMessageText(field, exports.ValidationMessageType.MaxLength, len, lv.max);
|
|
2221
|
-
}
|
|
2222
|
-
return undefined;
|
|
2223
|
-
}, "length" + ctx.index);
|
|
2224
|
-
}
|
|
2225
|
-
function useDateValidator(dv, ctx) {
|
|
2226
|
-
var control = ctx.control,
|
|
2227
|
-
field = ctx.field,
|
|
2228
|
-
index = ctx.index,
|
|
2229
|
-
schemaInterface = ctx.dataContext.schemaInterface;
|
|
2230
|
-
var comparisonDate;
|
|
2231
|
-
if (dv.fixedDate) {
|
|
2232
|
-
comparisonDate = schemaInterface.parseToMillis(field, dv.fixedDate);
|
|
2233
|
-
} else {
|
|
2234
|
-
var nowDate = new Date();
|
|
2235
|
-
comparisonDate = Date.UTC(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate());
|
|
2236
|
-
if (dv.daysFromCurrent) {
|
|
2237
|
-
comparisonDate += dv.daysFromCurrent * 86400000;
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
core.useValidator(control, function (v) {
|
|
2241
|
-
if (v) {
|
|
2242
|
-
var selDate = schemaInterface.parseToMillis(field, v);
|
|
2243
|
-
var notAfter = dv.comparison === exports.DateComparison.NotAfter;
|
|
2244
|
-
if (notAfter ? selDate > comparisonDate : selDate < comparisonDate) {
|
|
2245
|
-
return schemaInterface.validationMessageText(field, notAfter ? exports.ValidationMessageType.NotAfterDate : exports.ValidationMessageType.NotBeforeDate, selDate, comparisonDate);
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
return null;
|
|
2249
|
-
}, "date" + index);
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
var DefaultSchemaInterface = /*#__PURE__*/function () {
|
|
2253
|
-
function DefaultSchemaInterface(boolStrings, parseDateTime) {
|
|
2254
|
-
if (boolStrings === void 0) {
|
|
2255
|
-
boolStrings = ["No", "Yes"];
|
|
2256
|
-
}
|
|
2257
|
-
if (parseDateTime === void 0) {
|
|
2258
|
-
parseDateTime = function parseDateTime(s) {
|
|
2259
|
-
return Date.parse(s);
|
|
2260
|
-
};
|
|
2261
|
-
}
|
|
2262
|
-
this.boolStrings = void 0;
|
|
2263
|
-
this.parseDateTime = void 0;
|
|
2264
|
-
this.boolStrings = boolStrings;
|
|
2265
|
-
this.parseDateTime = parseDateTime;
|
|
2266
|
-
}
|
|
2267
|
-
var _proto = DefaultSchemaInterface.prototype;
|
|
2268
|
-
_proto.parseToMillis = function parseToMillis(field, v) {
|
|
2269
|
-
return this.parseDateTime(v);
|
|
2270
|
-
};
|
|
2271
|
-
_proto.validationMessageText = function validationMessageText(field, messageType, actual, expected) {
|
|
2272
|
-
switch (messageType) {
|
|
2273
|
-
case exports.ValidationMessageType.NotEmpty:
|
|
2274
|
-
return "Please enter a value";
|
|
2275
|
-
case exports.ValidationMessageType.MinLength:
|
|
2276
|
-
return "Length must be at least " + expected;
|
|
2277
|
-
case exports.ValidationMessageType.MaxLength:
|
|
2278
|
-
return "Length must be less than " + expected;
|
|
2279
|
-
case exports.ValidationMessageType.NotBeforeDate:
|
|
2280
|
-
return "Date must not be before " + new Date(expected).toDateString();
|
|
2281
|
-
case exports.ValidationMessageType.NotAfterDate:
|
|
2282
|
-
return "Date must not be after " + new Date(expected).toDateString();
|
|
2283
|
-
default:
|
|
2284
|
-
return "Unknown error";
|
|
2285
|
-
}
|
|
2286
|
-
};
|
|
2287
|
-
_proto.getDataOptions = function getDataOptions(node) {
|
|
2288
|
-
return this.getNodeOptions(node.schema);
|
|
2289
|
-
};
|
|
2290
|
-
_proto.getNodeOptions = function getNodeOptions(node) {
|
|
2291
|
-
return this.getOptions(node.field);
|
|
2292
|
-
};
|
|
2293
|
-
_proto.getOptions = function getOptions(_ref) {
|
|
2294
|
-
var options = _ref.options;
|
|
2295
|
-
return options && options.length > 0 ? options : null;
|
|
2296
|
-
};
|
|
2297
|
-
_proto.getFilterOptions = function getFilterOptions(array, field) {
|
|
2298
|
-
return this.getNodeOptions(field);
|
|
2299
|
-
};
|
|
2300
|
-
_proto.isEmptyValue = function isEmptyValue(f, value) {
|
|
2301
|
-
if (f.collection) return Array.isArray(value) ? value.length === 0 : value == null;
|
|
2302
|
-
switch (f.type) {
|
|
2303
|
-
case exports.FieldType.String:
|
|
2304
|
-
case exports.FieldType.DateTime:
|
|
2305
|
-
case exports.FieldType.Date:
|
|
2306
|
-
case exports.FieldType.Time:
|
|
2307
|
-
return !value;
|
|
2308
|
-
default:
|
|
2309
|
-
return value == null;
|
|
2310
|
-
}
|
|
2311
|
-
};
|
|
2312
|
-
_proto.searchText = function searchText(field, value) {
|
|
2313
|
-
var _this$textValue$toLow, _this$textValue;
|
|
2314
|
-
return (_this$textValue$toLow = (_this$textValue = this.textValue(field, value)) == null ? void 0 : _this$textValue.toLowerCase()) != null ? _this$textValue$toLow : "";
|
|
2315
|
-
};
|
|
2316
|
-
_proto.textValue = function textValue(field, value, element) {
|
|
2317
|
-
var options = this.getOptions(field);
|
|
2318
|
-
var option = options == null ? void 0 : options.find(function (x) {
|
|
2319
|
-
return x.value === value;
|
|
2320
|
-
});
|
|
2321
|
-
if (option) return option.name;
|
|
2322
|
-
switch (field.type) {
|
|
2323
|
-
case exports.FieldType.Date:
|
|
2324
|
-
return value ? new Date(value).toLocaleDateString() : undefined;
|
|
2325
|
-
case exports.FieldType.DateTime:
|
|
2326
|
-
return value ? new Date(this.parseToMillis(field, value)).toLocaleString() : undefined;
|
|
2327
|
-
case exports.FieldType.Time:
|
|
2328
|
-
return value ? new Date("1970-01-01T" + value).toLocaleTimeString() : undefined;
|
|
2329
|
-
case exports.FieldType.Bool:
|
|
2330
|
-
return this.boolStrings[value ? 1 : 0];
|
|
2331
|
-
default:
|
|
2332
|
-
return value != null ? value.toString() : undefined;
|
|
2333
|
-
}
|
|
2334
|
-
};
|
|
2335
|
-
_proto.controlLength = function controlLength(f, control) {
|
|
2336
|
-
var _control$elements$len, _control$elements;
|
|
2337
|
-
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);
|
|
2338
|
-
};
|
|
2339
|
-
_proto.valueLength = function valueLength(field, value) {
|
|
2340
|
-
var _ref2;
|
|
2341
|
-
return (_ref2 = value && (value == null ? void 0 : value.length)) != null ? _ref2 : 0;
|
|
2342
|
-
};
|
|
2343
|
-
_proto.compareValue = function compareValue(field, v1, v2) {
|
|
2344
|
-
if (v1 == null) return v2 == null ? 0 : 1;
|
|
2345
|
-
if (v2 == null) return -1;
|
|
2346
|
-
switch (field.type) {
|
|
2347
|
-
case exports.FieldType.Date:
|
|
2348
|
-
case exports.FieldType.DateTime:
|
|
2349
|
-
case exports.FieldType.Time:
|
|
2350
|
-
case exports.FieldType.String:
|
|
2351
|
-
return v1.localeCompare(v2);
|
|
2352
|
-
case exports.FieldType.Bool:
|
|
2353
|
-
return v1 ? v2 ? 0 : 1 : -1;
|
|
2354
|
-
case exports.FieldType.Int:
|
|
2355
|
-
case exports.FieldType.Double:
|
|
2356
|
-
return v1 - v2;
|
|
2357
|
-
default:
|
|
2358
|
-
return 0;
|
|
2359
|
-
}
|
|
2360
|
-
};
|
|
2361
|
-
_proto.compoundFieldSetup = function compoundFieldSetup(f) {
|
|
2362
|
-
var _this = this;
|
|
2363
|
-
return f.getChildNodes().map(function (x) {
|
|
2364
|
-
var field = x.field.field;
|
|
2365
|
-
return [field, _this.makeControlSetup(x)];
|
|
2366
|
-
});
|
|
2367
|
-
};
|
|
2368
|
-
_proto.compoundFieldEquality = function compoundFieldEquality(f) {
|
|
2369
|
-
var _this2 = this;
|
|
2370
|
-
return f.getChildNodes().map(function (x) {
|
|
2371
|
-
var field = x.field.field;
|
|
2372
|
-
return [field, function (a, b) {
|
|
2373
|
-
return _this2.makeEqualityFunc(x)(a[field], b[field]);
|
|
2374
|
-
}];
|
|
2375
|
-
});
|
|
2376
|
-
};
|
|
2377
|
-
_proto.makeEqualityFunc = function makeEqualityFunc(field, element) {
|
|
2378
|
-
if (field.field.collection && !element) {
|
|
2379
|
-
var elemEqual = this.makeEqualityFunc(field, true);
|
|
2380
|
-
return function (a, b) {
|
|
2381
|
-
if (a === b) return true;
|
|
2382
|
-
if (a == null || b == null) return false;
|
|
2383
|
-
if (a.length !== b.length) return false;
|
|
2384
|
-
for (var i = 0; i < a.length; i++) {
|
|
2385
|
-
if (!elemEqual(a[i], b[i])) return false;
|
|
2386
|
-
}
|
|
2387
|
-
return true;
|
|
2388
|
-
};
|
|
2389
|
-
}
|
|
2390
|
-
switch (field.field.type) {
|
|
2391
|
-
case exports.FieldType.Compound:
|
|
2392
|
-
var allChecks = this.compoundFieldEquality(field);
|
|
2393
|
-
return function (a, b) {
|
|
2394
|
-
return a === b || a != null && b != null && allChecks.every(function (x) {
|
|
2395
|
-
return x[1](a, b);
|
|
2396
|
-
});
|
|
2397
|
-
};
|
|
2398
|
-
default:
|
|
2399
|
-
return function (a, b) {
|
|
2400
|
-
return a === b;
|
|
2401
|
-
};
|
|
2402
|
-
}
|
|
2403
|
-
};
|
|
2404
|
-
_proto.makeControlSetup = function makeControlSetup(field, element) {
|
|
2405
|
-
var setup = {
|
|
2406
|
-
equals: this.makeEqualityFunc(field, element)
|
|
2407
|
-
};
|
|
2408
|
-
if (field.field.collection && !element) {
|
|
2409
|
-
setup.elems = this.makeControlSetup(field, true);
|
|
2410
|
-
return setup;
|
|
2411
|
-
}
|
|
2412
|
-
switch (field.field.type) {
|
|
2413
|
-
case exports.FieldType.Compound:
|
|
2414
|
-
setup.fields = Object.fromEntries(this.compoundFieldSetup(field));
|
|
2415
|
-
}
|
|
2416
|
-
return setup;
|
|
2417
|
-
};
|
|
2418
|
-
return DefaultSchemaInterface;
|
|
2419
|
-
}();
|
|
2420
|
-
var defaultSchemaInterface = new DefaultSchemaInterface();
|
|
2421
|
-
|
|
2422
|
-
var _excluded = ["styleClass", "labelClass", "layoutClass"],
|
|
2423
|
-
_excluded2 = ["parentDataNode"],
|
|
2424
|
-
_excluded3 = ["definition", "control", "formOptions", "style", "allowedOptions", "schemaInterface", "styleClass"];
|
|
2425
|
-
var AppendAdornmentPriority = 0;
|
|
2426
|
-
var WrapAdornmentPriority = 1000;
|
|
2427
|
-
/**
|
|
2428
|
-
* Enum representing the types of labels that can be rendered.
|
|
930
|
+
* Enum representing the types of labels that can be rendered.
|
|
2429
931
|
*/
|
|
2430
932
|
exports.LabelType = void 0;
|
|
2431
933
|
(function (LabelType) {
|
|
@@ -2442,285 +944,25 @@ exports.LabelType = void 0;
|
|
|
2442
944
|
*/
|
|
2443
945
|
LabelType[LabelType["Text"] = 2] = "Text";
|
|
2444
946
|
})(exports.LabelType || (exports.LabelType = {}));
|
|
2445
|
-
function
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
parentPath = _ref.parentPath;
|
|
2458
|
-
return /*#__PURE__*/jsxRuntime.jsx(ControlRenderer, _extends({}, r.current, {
|
|
2459
|
-
control: control,
|
|
2460
|
-
parentPath: parentPath
|
|
2461
|
-
}));
|
|
2462
|
-
}, [r]);
|
|
2463
|
-
}
|
|
2464
|
-
function useControlRendererComponent(controlOrFormNode, renderer, options, parentDataNode) {
|
|
2465
|
-
var _options$useDataHook, _options$schemaInterf, _options$useEvalExpre;
|
|
2466
|
-
if (options === void 0) {
|
|
2467
|
-
options = {};
|
|
2468
|
-
}
|
|
2469
|
-
var _ref2 = "definition" in controlOrFormNode ? [controlOrFormNode.definition, controlOrFormNode] : [controlOrFormNode, legacyFormNode(controlOrFormNode)],
|
|
2470
|
-
definition = _ref2[0],
|
|
2471
|
-
formNode = _ref2[1];
|
|
2472
|
-
var dataProps = (_options$useDataHook = options.useDataHook == null ? void 0 : options.useDataHook(definition)) != null ? _options$useDataHook : defaultDataProps;
|
|
2473
|
-
var elementIndex = options.elementIndex;
|
|
2474
|
-
var schemaInterface = (_options$schemaInterf = options.schemaInterface) != null ? _options$schemaInterf : defaultSchemaInterface;
|
|
2475
|
-
var useExpr = (_options$useEvalExpre = options.useEvalExpressionHook) != null ? _options$useEvalExpre : defaultUseEvalExpressionHook;
|
|
2476
|
-
var dataNode;
|
|
2477
|
-
if (elementIndex != null) {
|
|
2478
|
-
dataNode = parentDataNode.getChildElement(elementIndex);
|
|
2479
|
-
} else {
|
|
2480
|
-
dataNode = lookupDataNode(definition, parentDataNode);
|
|
2481
|
-
}
|
|
2482
|
-
var useValidation = useMakeValidationHook(definition, options.useValidationHook);
|
|
2483
|
-
var dynamicHooks = useDynamicHooks({
|
|
2484
|
-
defaultValueControl: useEvalDefaultValueHook(useExpr, definition),
|
|
2485
|
-
visibleControl: useEvalVisibilityHook(useExpr, definition),
|
|
2486
|
-
readonlyControl: useEvalReadonlyHook(useExpr, definition),
|
|
2487
|
-
disabledControl: useEvalDisabledHook(useExpr, definition),
|
|
2488
|
-
allowedOptions: useEvalAllowedOptionsHook(useExpr, definition),
|
|
2489
|
-
labelText: useEvalLabelText(useExpr, definition),
|
|
2490
|
-
actionData: useEvalActionHook(useExpr, definition),
|
|
2491
|
-
customStyle: useEvalStyleHook(useExpr, exports.DynamicPropertyType.Style, definition),
|
|
2492
|
-
layoutStyle: useEvalStyleHook(useExpr, exports.DynamicPropertyType.LayoutStyle, definition),
|
|
2493
|
-
displayControl: useEvalDisplayHook(useExpr, definition)
|
|
2494
|
-
});
|
|
2495
|
-
var r = useUpdatedRef({
|
|
2496
|
-
options: options,
|
|
2497
|
-
definition: definition,
|
|
2498
|
-
elementIndex: elementIndex,
|
|
2499
|
-
parentDataNode: parentDataNode,
|
|
2500
|
-
dataNode: dataNode,
|
|
2501
|
-
formNode: formNode
|
|
2502
|
-
});
|
|
2503
|
-
if (formNode == null) debugger;
|
|
2504
|
-
var Component = react.useCallback(function () {
|
|
2505
|
-
var stopTracking = core.useComponentTracking();
|
|
2506
|
-
try {
|
|
2507
|
-
var _options$formData, _dataNode, _definition$adornment2, _definition$adornment3, _formNode$tree$getByR, _options$adjustLayout;
|
|
2508
|
-
var _r$current = r.current,
|
|
2509
|
-
c = _r$current.definition,
|
|
2510
|
-
_options = _r$current.options,
|
|
2511
|
-
_elementIndex = _r$current.elementIndex,
|
|
2512
|
-
pdn = _r$current.parentDataNode,
|
|
2513
|
-
dn = _r$current.dataNode,
|
|
2514
|
-
_formNode = _r$current.formNode;
|
|
2515
|
-
var formData = (_options$formData = _options.formData) != null ? _options$formData : {};
|
|
2516
|
-
var dataContext = {
|
|
2517
|
-
schemaInterface: schemaInterface,
|
|
2518
|
-
dataNode: dn,
|
|
2519
|
-
parentNode: pdn,
|
|
2520
|
-
formData: formData
|
|
2521
|
-
};
|
|
2522
|
-
var _dynamicHooks = dynamicHooks(dataContext),
|
|
2523
|
-
readonlyControl = _dynamicHooks.readonlyControl,
|
|
2524
|
-
disabledControl = _dynamicHooks.disabledControl,
|
|
2525
|
-
visibleControl = _dynamicHooks.visibleControl,
|
|
2526
|
-
displayControl = _dynamicHooks.displayControl,
|
|
2527
|
-
layoutStyle = _dynamicHooks.layoutStyle,
|
|
2528
|
-
labelText = _dynamicHooks.labelText,
|
|
2529
|
-
customStyle = _dynamicHooks.customStyle,
|
|
2530
|
-
allowedOptions = _dynamicHooks.allowedOptions,
|
|
2531
|
-
defaultValueControl = _dynamicHooks.defaultValueControl,
|
|
2532
|
-
actionData = _dynamicHooks.actionData;
|
|
2533
|
-
var visible = visibleControl.current.value;
|
|
2534
|
-
var visibility = core.useControl(function () {
|
|
2535
|
-
return visible != null ? {
|
|
2536
|
-
visible: visible,
|
|
2537
|
-
showing: visible
|
|
2538
|
-
} : undefined;
|
|
2539
|
-
});
|
|
2540
|
-
core.useControlEffect(function () {
|
|
2541
|
-
return visibleControl.value;
|
|
2542
|
-
}, function (visible) {
|
|
2543
|
-
if (visible != null) visibility.setValue(function (ex) {
|
|
2544
|
-
return {
|
|
2545
|
-
visible: visible,
|
|
2546
|
-
showing: ex ? ex.showing : visible
|
|
2547
|
-
};
|
|
2548
|
-
});
|
|
2549
|
-
});
|
|
2550
|
-
var parentControl = parentDataNode.control;
|
|
2551
|
-
var control = (_dataNode = dataNode) == null ? void 0 : _dataNode.control;
|
|
2552
|
-
core.useControlEffect(function () {
|
|
2553
|
-
var _definition$adornment, _definition$renderOpt;
|
|
2554
|
-
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(function (x) {
|
|
2555
|
-
return x.type === exports.ControlAdornmentType.Optional;
|
|
2556
|
-
})) || isDataControl(definition) && ((_definition$renderOpt = definition.renderOptions) == null ? void 0 : _definition$renderOpt.type) == exports.DataRenderType.NullToggle, parentControl.isNull, _options.hidden, readonlyControl.value];
|
|
2557
|
-
}, function (_ref3) {
|
|
2558
|
-
var vc = _ref3[0],
|
|
2559
|
-
dv = _ref3[1],
|
|
2560
|
-
_ = _ref3[2],
|
|
2561
|
-
dontClear = _ref3[3],
|
|
2562
|
-
dontDefault = _ref3[4],
|
|
2563
|
-
parentNull = _ref3[5],
|
|
2564
|
-
hidden = _ref3[6],
|
|
2565
|
-
ro = _ref3[7];
|
|
2566
|
-
if (!ro) {
|
|
2567
|
-
if (control) {
|
|
2568
|
-
if (vc && vc.visible === vc.showing) {
|
|
2569
|
-
if (hidden || !vc.visible) {
|
|
2570
|
-
control.setValue(function (x) {
|
|
2571
|
-
return _options.clearHidden && !dontClear ? undefined : x == null && dontClear && !dontDefault ? dv : x;
|
|
2572
|
-
});
|
|
2573
|
-
} else if (!dontDefault) control.setValue(function (x) {
|
|
2574
|
-
return x != null ? x : dv;
|
|
2575
|
-
});
|
|
2576
|
-
}
|
|
2577
|
-
} else if (parentNull) {
|
|
2578
|
-
parentControl.setValue(function (x) {
|
|
2579
|
-
return x != null ? x : {};
|
|
2580
|
-
});
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
}, true);
|
|
2584
|
-
var myOptionsControl = core.useComputed(function () {
|
|
2585
|
-
var _visibility$fields;
|
|
2586
|
-
return {
|
|
2587
|
-
hidden: _options.hidden || !((_visibility$fields = visibility.fields) != null && _visibility$fields.showing.value),
|
|
2588
|
-
readonly: _options.readonly || readonlyControl.value,
|
|
2589
|
-
disabled: _options.disabled || disabledControl.value,
|
|
2590
|
-
displayOnly: _options.displayOnly || isControlDisplayOnly(c)
|
|
2591
|
-
};
|
|
2592
|
-
});
|
|
2593
|
-
var myOptions = core.trackedValue(myOptionsControl);
|
|
2594
|
-
useValidation({
|
|
2595
|
-
control: control != null ? control : core.newControl(null),
|
|
2596
|
-
hiddenControl: myOptionsControl.fields.hidden,
|
|
2597
|
-
dataContext: dataContext
|
|
2598
|
-
});
|
|
2599
|
-
var styleClass = _options.styleClass,
|
|
2600
|
-
labelClass = _options.labelClass,
|
|
2601
|
-
layoutClass = _options.layoutClass,
|
|
2602
|
-
inheritableOptions = _objectWithoutPropertiesLoose(_options, _excluded);
|
|
2603
|
-
var childOptions = _extends({}, inheritableOptions, myOptions, {
|
|
2604
|
-
elementIndex: undefined
|
|
2605
|
-
});
|
|
2606
|
-
react.useEffect(function () {
|
|
2607
|
-
if (control && typeof myOptions.disabled === "boolean" && control.disabled != myOptions.disabled) control.disabled = myOptions.disabled;
|
|
2608
|
-
}, [control, myOptions.disabled]);
|
|
2609
|
-
if (parentControl.isNull) return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2610
|
-
var adornments = (_definition$adornment2 = (_definition$adornment3 = definition.adornments) == null ? void 0 : _definition$adornment3.map(function (x) {
|
|
2611
|
-
return renderer.renderAdornment({
|
|
2612
|
-
adornment: x,
|
|
2613
|
-
dataContext: dataContext,
|
|
2614
|
-
useExpr: useExpr,
|
|
2615
|
-
formOptions: myOptions
|
|
2616
|
-
});
|
|
2617
|
-
})) != null ? _definition$adornment2 : [];
|
|
2618
|
-
var otherChildNodes = definition.childRefId && ((_formNode$tree$getByR = _formNode.tree.getByRefId(definition.childRefId)) == null ? void 0 : _formNode$tree$getByR.getChildNodes());
|
|
2619
|
-
var labelAndChildren = renderControlLayout({
|
|
2620
|
-
formNode: otherChildNodes ? _formNode.tree.createTempNode(_formNode.id, definition, otherChildNodes) : _formNode,
|
|
2621
|
-
definition: c,
|
|
2622
|
-
renderer: renderer,
|
|
2623
|
-
renderChild: function renderChild(k, child, options) {
|
|
2624
|
-
var _ref5;
|
|
2625
|
-
var overrideClasses = getGroupClassOverrides(c);
|
|
2626
|
-
var _ref4 = options != null ? options : {},
|
|
2627
|
-
parentDataNode = _ref4.parentDataNode,
|
|
2628
|
-
renderOptions = _objectWithoutPropertiesLoose(_ref4, _excluded2);
|
|
2629
|
-
var dContext = (_ref5 = parentDataNode != null ? parentDataNode : dataContext.dataNode) != null ? _ref5 : dataContext.parentNode;
|
|
2630
|
-
var allChildOptions = _extends({}, childOptions, overrideClasses, renderOptions);
|
|
2631
|
-
return /*#__PURE__*/jsxRuntime.jsx(NewControlRenderer, {
|
|
2632
|
-
definition: child,
|
|
2633
|
-
renderer: renderer,
|
|
2634
|
-
parentDataNode: dContext,
|
|
2635
|
-
options: allChildOptions
|
|
2636
|
-
}, k);
|
|
2637
|
-
},
|
|
2638
|
-
createDataProps: dataProps,
|
|
2639
|
-
formOptions: myOptions,
|
|
2640
|
-
dataContext: dataContext,
|
|
2641
|
-
control: displayControl != null ? displayControl : control,
|
|
2642
|
-
elementIndex: _elementIndex,
|
|
2643
|
-
schemaInterface: schemaInterface,
|
|
2644
|
-
labelText: labelText,
|
|
2645
|
-
displayControl: displayControl,
|
|
2646
|
-
style: customStyle.value,
|
|
2647
|
-
allowedOptions: allowedOptions,
|
|
2648
|
-
customDisplay: _options.customDisplay,
|
|
2649
|
-
actionDataControl: actionData,
|
|
2650
|
-
actionOnClick: _options.actionOnClick,
|
|
2651
|
-
styleClass: _options.styleClass,
|
|
2652
|
-
labelClass: _options.labelClass,
|
|
2653
|
-
useEvalExpression: useExpr,
|
|
2654
|
-
useChildVisibility: function useChildVisibility(childDef, parentNode, dontOverride) {
|
|
2655
|
-
var _ref6;
|
|
2656
|
-
return useEvalVisibilityHook(useExpr, childDef, !dontOverride ? lookupDataNode(childDef, (_ref6 = parentNode != null ? parentNode : dataNode) != null ? _ref6 : parentDataNode) : undefined);
|
|
2657
|
-
}
|
|
2658
|
-
});
|
|
2659
|
-
var layoutProps = _extends({}, labelAndChildren, {
|
|
2660
|
-
adornments: adornments,
|
|
2661
|
-
className: rendererClass(_options.layoutClass, c.layoutClass),
|
|
2662
|
-
style: layoutStyle.value
|
|
2663
|
-
});
|
|
2664
|
-
var renderedControl = renderer.renderLayout((_options$adjustLayout = _options.adjustLayout == null ? void 0 : _options.adjustLayout(dataContext, layoutProps)) != null ? _options$adjustLayout : layoutProps);
|
|
2665
|
-
return renderer.renderVisibility(_extends({
|
|
2666
|
-
visibility: visibility
|
|
2667
|
-
}, renderedControl));
|
|
2668
|
-
} finally {
|
|
2669
|
-
stopTracking();
|
|
2670
|
-
}
|
|
2671
|
-
}, [r, dataProps, useValidation, renderer, schemaInterface, dynamicHooks]);
|
|
2672
|
-
Component.displayName = "RenderControl";
|
|
2673
|
-
return Component;
|
|
2674
|
-
}
|
|
2675
|
-
function ControlRenderer(_ref7) {
|
|
2676
|
-
var _effect = core.useComponentTracking();
|
|
2677
|
-
try {
|
|
2678
|
-
var definition = _ref7.definition,
|
|
2679
|
-
fields = _ref7.fields,
|
|
2680
|
-
renderer = _ref7.renderer,
|
|
2681
|
-
options = _ref7.options,
|
|
2682
|
-
control = _ref7.control,
|
|
2683
|
-
parentPath = _ref7.parentPath;
|
|
2684
|
-
var schemaDataNode = makeSchemaDataNode(createSchemaLookup({
|
|
2685
|
-
"": fields
|
|
2686
|
-
}).getSchema(""), control);
|
|
2687
|
-
var Render = useControlRendererComponent(definition, renderer, options, schemaDataNode);
|
|
2688
|
-
return /*#__PURE__*/jsxRuntime.jsx(Render, {});
|
|
2689
|
-
} finally {
|
|
2690
|
-
_effect();
|
|
2691
|
-
}
|
|
2692
|
-
}
|
|
2693
|
-
function NewControlRenderer(_ref8) {
|
|
2694
|
-
var _effect2 = core.useComponentTracking();
|
|
2695
|
-
try {
|
|
2696
|
-
var definition = _ref8.definition,
|
|
2697
|
-
renderer = _ref8.renderer,
|
|
2698
|
-
options = _ref8.options,
|
|
2699
|
-
parentDataNode = _ref8.parentDataNode;
|
|
2700
|
-
var Render = useControlRendererComponent(definition, renderer, options, parentDataNode);
|
|
2701
|
-
return /*#__PURE__*/jsxRuntime.jsx(Render, {});
|
|
2702
|
-
} finally {
|
|
2703
|
-
_effect2();
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
function defaultDataProps(_ref9) {
|
|
2707
|
-
var _allowedOptions$value, _definition$renderOpt2;
|
|
2708
|
-
var definition = _ref9.definition,
|
|
2709
|
-
control = _ref9.control,
|
|
2710
|
-
formOptions = _ref9.formOptions,
|
|
2711
|
-
style = _ref9.style,
|
|
2712
|
-
allowedOptions = _ref9.allowedOptions,
|
|
2713
|
-
_ref9$schemaInterface = _ref9.schemaInterface,
|
|
2714
|
-
schemaInterface = _ref9$schemaInterface === void 0 ? defaultSchemaInterface : _ref9$schemaInterface,
|
|
2715
|
-
styleClass = _ref9.styleClass,
|
|
2716
|
-
props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
|
|
947
|
+
function defaultDataProps(_ref, definition, control) {
|
|
948
|
+
var _definition$renderOpt;
|
|
949
|
+
var formOptions = _ref.formOptions,
|
|
950
|
+
style = _ref.style,
|
|
951
|
+
allowedOptions = _ref.allowedOptions,
|
|
952
|
+
_ref$schemaInterface = _ref.schemaInterface,
|
|
953
|
+
schemaInterface = _ref$schemaInterface === void 0 ? formsCore.defaultSchemaInterface : _ref$schemaInterface,
|
|
954
|
+
styleClass = _ref.styleClass,
|
|
955
|
+
tc = _ref.textClass,
|
|
956
|
+
displayOnly = _ref.displayOnly,
|
|
957
|
+
inline = _ref.inline,
|
|
958
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2717
959
|
var dataNode = props.dataContext.dataNode;
|
|
2718
960
|
var field = dataNode.schema.field;
|
|
2719
961
|
var className = rendererClass(styleClass, definition.styleClass);
|
|
2720
|
-
var
|
|
962
|
+
var textClass = rendererClass(tc, definition.textClass);
|
|
2721
963
|
var required = !!definition.required && !displayOnly;
|
|
2722
964
|
var fieldOptions = schemaInterface.getDataOptions(dataNode);
|
|
2723
|
-
var _allowed =
|
|
965
|
+
var _allowed = allowedOptions != null ? allowedOptions : [];
|
|
2724
966
|
var allowed = Array.isArray(_allowed) ? _allowed : [_allowed];
|
|
2725
967
|
return _extends({
|
|
2726
968
|
dataNode: dataNode,
|
|
@@ -2728,6 +970,7 @@ function defaultDataProps(_ref9) {
|
|
|
2728
970
|
control: control,
|
|
2729
971
|
field: field,
|
|
2730
972
|
id: "c" + control.uniqueId,
|
|
973
|
+
inline: !!inline,
|
|
2731
974
|
options: allowed.length > 0 ? allowed.map(function (x) {
|
|
2732
975
|
var _fieldOptions$find;
|
|
2733
976
|
return typeof x === "object" ? x : (_fieldOptions$find = fieldOptions == null ? void 0 : fieldOptions.find(function (y) {
|
|
@@ -2740,38 +983,43 @@ function defaultDataProps(_ref9) {
|
|
|
2740
983
|
return x != null;
|
|
2741
984
|
}) : fieldOptions,
|
|
2742
985
|
readonly: !!formOptions.readonly,
|
|
2743
|
-
displayOnly: displayOnly,
|
|
2744
|
-
renderOptions: (_definition$
|
|
986
|
+
displayOnly: !!displayOnly,
|
|
987
|
+
renderOptions: (_definition$renderOpt = definition.renderOptions) != null ? _definition$renderOpt : {
|
|
2745
988
|
type: "Standard"
|
|
2746
989
|
},
|
|
2747
990
|
required: required,
|
|
2748
991
|
hidden: !!formOptions.hidden,
|
|
2749
992
|
className: className,
|
|
993
|
+
textClass: textClass,
|
|
2750
994
|
style: style
|
|
2751
995
|
}, props);
|
|
2752
996
|
}
|
|
2753
997
|
function renderControlLayout(props) {
|
|
2754
|
-
var
|
|
2755
|
-
renderer = props.renderer,
|
|
998
|
+
var renderer = props.renderer,
|
|
2756
999
|
renderChild = props.renderChild,
|
|
2757
1000
|
control = props.control,
|
|
2758
1001
|
dataContext = props.dataContext,
|
|
2759
1002
|
dataProps = props.createDataProps,
|
|
2760
|
-
displayControl = props.displayControl,
|
|
2761
1003
|
style = props.style,
|
|
2762
|
-
labelText = props.labelText,
|
|
2763
|
-
useChildVisibility = props.useChildVisibility,
|
|
2764
1004
|
designMode = props.designMode,
|
|
2765
1005
|
customDisplay = props.customDisplay,
|
|
2766
|
-
|
|
1006
|
+
runExpression = props.runExpression,
|
|
2767
1007
|
labelClass = props.labelClass,
|
|
1008
|
+
labelTextClass = props.labelTextClass,
|
|
2768
1009
|
styleClass = props.styleClass,
|
|
2769
|
-
|
|
2770
|
-
|
|
1010
|
+
textClass = props.textClass,
|
|
1011
|
+
formNode = props.formNode,
|
|
1012
|
+
actionOnClick = props.actionOnClick,
|
|
1013
|
+
state = props.state,
|
|
1014
|
+
getChildState = props.getChildState,
|
|
1015
|
+
inline = props.inline,
|
|
1016
|
+
displayOnly = props.displayOnly;
|
|
1017
|
+
var c = state.definition;
|
|
1018
|
+
if (formsCore.isDataControl(c)) {
|
|
2771
1019
|
return renderData(c);
|
|
2772
1020
|
}
|
|
2773
|
-
if (isGroupControl(c)) {
|
|
2774
|
-
var _c$groupOptions2,
|
|
1021
|
+
if (formsCore.isGroupControl(c)) {
|
|
1022
|
+
var _c$groupOptions2, _c$groupOptions3;
|
|
2775
1023
|
if (c.compoundField) {
|
|
2776
1024
|
var _c$groupOptions;
|
|
2777
1025
|
return renderData(dataControl(c.compoundField, c.title, {
|
|
@@ -2780,78 +1028,110 @@ function renderControlLayout(props) {
|
|
|
2780
1028
|
}));
|
|
2781
1029
|
}
|
|
2782
1030
|
return {
|
|
1031
|
+
inline: inline,
|
|
2783
1032
|
processLayout: renderer.renderGroup({
|
|
2784
1033
|
formNode: formNode,
|
|
1034
|
+
state: state,
|
|
2785
1035
|
definition: c,
|
|
2786
1036
|
renderChild: renderChild,
|
|
2787
|
-
|
|
1037
|
+
runExpression: runExpression,
|
|
2788
1038
|
dataContext: dataContext,
|
|
2789
1039
|
renderOptions: (_c$groupOptions2 = c.groupOptions) != null ? _c$groupOptions2 : {
|
|
2790
1040
|
type: "Standard"
|
|
2791
1041
|
},
|
|
2792
1042
|
className: rendererClass(styleClass, c.styleClass),
|
|
2793
|
-
|
|
1043
|
+
textClass: rendererClass(textClass, c.textClass),
|
|
2794
1044
|
style: style,
|
|
2795
|
-
designMode: designMode
|
|
1045
|
+
designMode: designMode,
|
|
1046
|
+
actionOnClick: actionOnClick,
|
|
1047
|
+
getChildState: getChildState
|
|
2796
1048
|
}),
|
|
2797
1049
|
label: {
|
|
2798
|
-
label:
|
|
1050
|
+
label: c.title,
|
|
2799
1051
|
className: rendererClass(labelClass, c.labelClass),
|
|
1052
|
+
textClass: rendererClass(labelTextClass, c.labelTextClass),
|
|
2800
1053
|
type: exports.LabelType.Group,
|
|
2801
1054
|
hide: (_c$groupOptions3 = c.groupOptions) == null ? void 0 : _c$groupOptions3.hideTitle
|
|
2802
1055
|
}
|
|
2803
1056
|
};
|
|
2804
1057
|
}
|
|
2805
|
-
if (isActionControl(c)) {
|
|
2806
|
-
var
|
|
2807
|
-
var
|
|
1058
|
+
if (formsCore.isActionControl(c)) {
|
|
1059
|
+
var _c$actionStyle, _c$title, _props$actionOnClick;
|
|
1060
|
+
var renderActionGroup = function renderActionGroup() {
|
|
1061
|
+
var childDefs = formNode.getResolvedChildren();
|
|
1062
|
+
var childDef = {
|
|
1063
|
+
type: formsCore.ControlDefinitionType.Group,
|
|
1064
|
+
groupOptions: {
|
|
1065
|
+
type: formsCore.GroupRenderType.Contents,
|
|
1066
|
+
hideTitle: true
|
|
1067
|
+
},
|
|
1068
|
+
children: childDefs
|
|
1069
|
+
};
|
|
1070
|
+
var childNode = formNode.createChildNode("child", childDef);
|
|
1071
|
+
return renderChild("child", childNode, {});
|
|
1072
|
+
};
|
|
1073
|
+
var actionData = c.actionData;
|
|
1074
|
+
var actionStyle = (_c$actionStyle = c.actionStyle) != null ? _c$actionStyle : formsCore.ActionStyle.Button;
|
|
1075
|
+
var actionContent = actionStyle == formsCore.ActionStyle.Group ? renderActionGroup() : undefined;
|
|
2808
1076
|
return {
|
|
1077
|
+
inline: inline,
|
|
2809
1078
|
children: renderer.renderAction({
|
|
2810
|
-
actionText: (
|
|
1079
|
+
actionText: (_c$title = c.title) != null ? _c$title : c.actionId,
|
|
2811
1080
|
actionId: c.actionId,
|
|
2812
1081
|
actionData: actionData,
|
|
1082
|
+
actionContent: actionContent,
|
|
1083
|
+
actionStyle: actionStyle,
|
|
1084
|
+
textClass: rendererClass(textClass, c.textClass),
|
|
1085
|
+
iconPlacement: c.iconPlacement,
|
|
1086
|
+
icon: c.icon,
|
|
1087
|
+
inline: inline,
|
|
2813
1088
|
onClick: (_props$actionOnClick = props.actionOnClick == null ? void 0 : props.actionOnClick(c.actionId, actionData, dataContext)) != null ? _props$actionOnClick : function () {},
|
|
2814
1089
|
className: rendererClass(styleClass, c.styleClass),
|
|
2815
1090
|
style: style
|
|
2816
1091
|
})
|
|
2817
1092
|
};
|
|
2818
1093
|
}
|
|
2819
|
-
if (isDisplayControl(c)) {
|
|
1094
|
+
if (formsCore.isDisplayControl(c)) {
|
|
2820
1095
|
var _c$displayData;
|
|
2821
1096
|
var data = (_c$displayData = c.displayData) != null ? _c$displayData : {};
|
|
2822
1097
|
var displayProps = {
|
|
2823
1098
|
data: data,
|
|
2824
1099
|
className: rendererClass(styleClass, c.styleClass),
|
|
1100
|
+
textClass: rendererClass(textClass, c.textClass),
|
|
2825
1101
|
style: style,
|
|
2826
|
-
|
|
2827
|
-
|
|
1102
|
+
dataContext: dataContext,
|
|
1103
|
+
inline: inline
|
|
2828
1104
|
};
|
|
2829
|
-
if (data.type ===
|
|
1105
|
+
if (data.type === formsCore.DisplayDataType.Custom && customDisplay) {
|
|
2830
1106
|
return {
|
|
1107
|
+
inline: inline,
|
|
2831
1108
|
children: customDisplay(data.customId, displayProps)
|
|
2832
1109
|
};
|
|
2833
1110
|
}
|
|
2834
1111
|
return {
|
|
1112
|
+
inline: inline,
|
|
2835
1113
|
children: renderer.renderDisplay(displayProps)
|
|
2836
1114
|
};
|
|
2837
1115
|
}
|
|
2838
1116
|
return {};
|
|
2839
1117
|
function renderData(c) {
|
|
2840
|
-
var
|
|
1118
|
+
var _c$children$length, _c$children;
|
|
2841
1119
|
if (!control) return {
|
|
2842
1120
|
children: "No control for: " + c.field
|
|
2843
1121
|
};
|
|
2844
|
-
var rendererProps = dataProps(props);
|
|
2845
|
-
var label = !c.hideTitle ? controlTitle(
|
|
1122
|
+
var rendererProps = dataProps(props, c, control);
|
|
1123
|
+
var label = !c.hideTitle ? controlTitle(c.title, props.dataContext.dataNode.schema.field) : undefined;
|
|
2846
1124
|
return {
|
|
1125
|
+
inline: inline,
|
|
2847
1126
|
processLayout: renderer.renderData(rendererProps),
|
|
2848
1127
|
label: {
|
|
2849
1128
|
type: ((_c$children$length = (_c$children = c.children) == null ? void 0 : _c$children.length) != null ? _c$children$length : 0) > 0 ? exports.LabelType.Group : exports.LabelType.Control,
|
|
2850
1129
|
label: label,
|
|
2851
1130
|
forId: rendererProps.id,
|
|
2852
|
-
required: c.required && !
|
|
1131
|
+
required: c.required && !displayOnly,
|
|
2853
1132
|
hide: c.hideTitle,
|
|
2854
|
-
className: rendererClass(labelClass, c.labelClass)
|
|
1133
|
+
className: rendererClass(labelClass, c.labelClass),
|
|
1134
|
+
textClass: rendererClass(labelTextClass, c.labelTextClass)
|
|
2855
1135
|
},
|
|
2856
1136
|
errorControl: control
|
|
2857
1137
|
};
|
|
@@ -2871,13 +1151,13 @@ function wrapMarkup(k, wrap) {
|
|
|
2871
1151
|
}
|
|
2872
1152
|
function layoutKeyForPlacement(pos) {
|
|
2873
1153
|
switch (pos) {
|
|
2874
|
-
case
|
|
1154
|
+
case formsCore.AdornmentPlacement.ControlEnd:
|
|
2875
1155
|
return "controlEnd";
|
|
2876
|
-
case
|
|
1156
|
+
case formsCore.AdornmentPlacement.ControlStart:
|
|
2877
1157
|
return "controlStart";
|
|
2878
|
-
case
|
|
1158
|
+
case formsCore.AdornmentPlacement.LabelStart:
|
|
2879
1159
|
return "labelStart";
|
|
2880
|
-
case
|
|
1160
|
+
case formsCore.AdornmentPlacement.LabelEnd:
|
|
2881
1161
|
return "labelEnd";
|
|
2882
1162
|
}
|
|
2883
1163
|
}
|
|
@@ -2897,18 +1177,20 @@ function wrapMarkupAt(pos, wrap) {
|
|
|
2897
1177
|
}
|
|
2898
1178
|
function renderLayoutParts(props, renderer) {
|
|
2899
1179
|
var _props$processLayout;
|
|
2900
|
-
var
|
|
2901
|
-
className =
|
|
2902
|
-
children =
|
|
2903
|
-
style =
|
|
2904
|
-
errorControl =
|
|
2905
|
-
label =
|
|
2906
|
-
adornments =
|
|
1180
|
+
var _ref2 = (_props$processLayout = props.processLayout == null ? void 0 : props.processLayout(props)) != null ? _props$processLayout : props,
|
|
1181
|
+
className = _ref2.className,
|
|
1182
|
+
children = _ref2.children,
|
|
1183
|
+
style = _ref2.style,
|
|
1184
|
+
errorControl = _ref2.errorControl,
|
|
1185
|
+
label = _ref2.label,
|
|
1186
|
+
adornments = _ref2.adornments,
|
|
1187
|
+
inline = _ref2.inline;
|
|
2907
1188
|
var layout = {
|
|
2908
1189
|
children: children,
|
|
2909
1190
|
errorControl: errorControl,
|
|
2910
1191
|
style: style,
|
|
2911
1192
|
className: className,
|
|
1193
|
+
inline: inline,
|
|
2912
1194
|
wrapLayout: function wrapLayout(x) {
|
|
2913
1195
|
return x;
|
|
2914
1196
|
}
|
|
@@ -2927,7 +1209,7 @@ function controlTitle(title, field) {
|
|
|
2927
1209
|
function getLengthRestrictions(definition) {
|
|
2928
1210
|
var _definition$validator;
|
|
2929
1211
|
var lengthVal = (_definition$validator = definition.validators) == null ? void 0 : _definition$validator.find(function (x) {
|
|
2930
|
-
return x.type ===
|
|
1212
|
+
return x.type === formsCore.ValidatorType.Length;
|
|
2931
1213
|
});
|
|
2932
1214
|
return {
|
|
2933
1215
|
min: lengthVal == null ? void 0 : lengthVal.min,
|
|
@@ -2937,19 +1219,19 @@ function getLengthRestrictions(definition) {
|
|
|
2937
1219
|
function createArrayActions(control, field, options) {
|
|
2938
1220
|
var _field$displayName;
|
|
2939
1221
|
var noun = (_field$displayName = field.displayName) != null ? _field$displayName : field.field;
|
|
2940
|
-
var
|
|
2941
|
-
addText =
|
|
2942
|
-
noAdd =
|
|
2943
|
-
removeText =
|
|
2944
|
-
noRemove =
|
|
2945
|
-
removeActionId =
|
|
2946
|
-
addActionId =
|
|
2947
|
-
editActionId =
|
|
2948
|
-
editText =
|
|
2949
|
-
disabled =
|
|
2950
|
-
readonly =
|
|
2951
|
-
designMode =
|
|
2952
|
-
editExternal =
|
|
1222
|
+
var _ref3 = options != null ? options : {},
|
|
1223
|
+
addText = _ref3.addText,
|
|
1224
|
+
noAdd = _ref3.noAdd,
|
|
1225
|
+
removeText = _ref3.removeText,
|
|
1226
|
+
noRemove = _ref3.noRemove,
|
|
1227
|
+
removeActionId = _ref3.removeActionId,
|
|
1228
|
+
addActionId = _ref3.addActionId,
|
|
1229
|
+
editActionId = _ref3.editActionId,
|
|
1230
|
+
editText = _ref3.editText,
|
|
1231
|
+
disabled = _ref3.disabled,
|
|
1232
|
+
readonly = _ref3.readonly,
|
|
1233
|
+
designMode = _ref3.designMode,
|
|
1234
|
+
editExternal = _ref3.editExternal;
|
|
2953
1235
|
return {
|
|
2954
1236
|
arrayControl: control,
|
|
2955
1237
|
addAction: !readonly && !noAdd ? makeAdd(function () {
|
|
@@ -3025,15 +1307,15 @@ function createArrayActions(control, field, options) {
|
|
|
3025
1307
|
};
|
|
3026
1308
|
}
|
|
3027
1309
|
}
|
|
3028
|
-
function applyArrayLengthRestrictions(
|
|
1310
|
+
function applyArrayLengthRestrictions(_ref4, disable) {
|
|
3029
1311
|
var _arrayControl$element, _arrayControl$element2;
|
|
3030
|
-
var arrayControl =
|
|
3031
|
-
min =
|
|
3032
|
-
max =
|
|
3033
|
-
editAction =
|
|
3034
|
-
aa =
|
|
3035
|
-
ra =
|
|
3036
|
-
required =
|
|
1312
|
+
var arrayControl = _ref4.arrayControl,
|
|
1313
|
+
min = _ref4.min,
|
|
1314
|
+
max = _ref4.max,
|
|
1315
|
+
editAction = _ref4.editAction,
|
|
1316
|
+
aa = _ref4.addAction,
|
|
1317
|
+
ra = _ref4.removeAction,
|
|
1318
|
+
required = _ref4.required;
|
|
3037
1319
|
var _applyLengthRestricti = applyLengthRestrictions((_arrayControl$element = (_arrayControl$element2 = arrayControl.elements) == null ? void 0 : _arrayControl$element2.length) != null ? _arrayControl$element : 0, min == null && required ? 1 : min, max, true, true),
|
|
3038
1320
|
removeAllowed = _applyLengthRestricti[0],
|
|
3039
1321
|
addAllowed = _applyLengthRestricti[1];
|
|
@@ -3046,33 +1328,45 @@ function applyArrayLengthRestrictions(_ref13, disable) {
|
|
|
3046
1328
|
};
|
|
3047
1329
|
}
|
|
3048
1330
|
function fieldOptionAdornment(p) {
|
|
3049
|
-
return function (o,
|
|
1331
|
+
return function (o, fieldIndex, selected) {
|
|
3050
1332
|
return /*#__PURE__*/jsxRuntime.jsx(core.RenderArrayElements, {
|
|
3051
1333
|
array: p.formNode.getChildNodes(),
|
|
3052
1334
|
children: function children(cd, i) {
|
|
3053
1335
|
return p.renderChild(i, cd, {
|
|
3054
1336
|
parentDataNode: p.dataContext.parentNode,
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
1337
|
+
stateKey: fieldIndex.toString(),
|
|
1338
|
+
variables: {
|
|
1339
|
+
formData: {
|
|
1340
|
+
option: o,
|
|
1341
|
+
optionSelected: selected
|
|
1342
|
+
}
|
|
3058
1343
|
}
|
|
3059
1344
|
});
|
|
3060
1345
|
}
|
|
3061
1346
|
});
|
|
3062
1347
|
};
|
|
3063
1348
|
}
|
|
1349
|
+
function lookupChildDataContext(dataContext, c) {
|
|
1350
|
+
var _dataContext$dataNode;
|
|
1351
|
+
var parentNode = (_dataContext$dataNode = dataContext.dataNode) != null ? _dataContext$dataNode : dataContext.parentNode;
|
|
1352
|
+
var dataNode = formsCore.lookupDataNode(c, parentNode);
|
|
1353
|
+
return _extends({}, dataContext, {
|
|
1354
|
+
parentNode: parentNode,
|
|
1355
|
+
dataNode: dataNode
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
3064
1358
|
|
|
3065
1359
|
function isIconAdornment(a) {
|
|
3066
|
-
return a.type ===
|
|
1360
|
+
return a.type === formsCore.ControlAdornmentType.Icon;
|
|
3067
1361
|
}
|
|
3068
1362
|
function isAccordionAdornment(a) {
|
|
3069
|
-
return a.type ===
|
|
1363
|
+
return a.type === formsCore.ControlAdornmentType.Accordion;
|
|
3070
1364
|
}
|
|
3071
1365
|
function isSetFieldAdornment(a) {
|
|
3072
|
-
return a.type ===
|
|
1366
|
+
return a.type === formsCore.ControlAdornmentType.SetField;
|
|
3073
1367
|
}
|
|
3074
1368
|
function isOptionalAdornment(a) {
|
|
3075
|
-
return a.type ===
|
|
1369
|
+
return a.type === formsCore.ControlAdornmentType.Optional;
|
|
3076
1370
|
}
|
|
3077
1371
|
function createLayoutRenderer(render, options) {
|
|
3078
1372
|
return _extends({
|
|
@@ -3157,7 +1451,6 @@ function createFormRenderer(customRenderers, defaultRenderers) {
|
|
|
3157
1451
|
renderLayout: renderLayout,
|
|
3158
1452
|
renderVisibility: renderVisibility,
|
|
3159
1453
|
renderLabelText: renderLabelText,
|
|
3160
|
-
renderText: defaultRenderers.renderText,
|
|
3161
1454
|
html: defaultRenderers.html
|
|
3162
1455
|
};
|
|
3163
1456
|
function renderVisibility(props) {
|
|
@@ -3211,8 +1504,8 @@ function createFormRenderer(customRenderers, defaultRenderers) {
|
|
|
3211
1504
|
var _x$collection, _field$collection, _x$options;
|
|
3212
1505
|
var noMatch = x.match ? !x.match(props, renderOptions) : undefined;
|
|
3213
1506
|
if (noMatch === true) return false;
|
|
3214
|
-
var matchCollection = ((_x$collection = x.collection) != null ? _x$collection : false) === (props.elementIndex == null && ((_field$collection = field.collection) != null ? _field$collection : false));
|
|
3215
|
-
var isSchemaAllowed = !!x.schemaType && renderType ==
|
|
1507
|
+
var matchCollection = ((_x$collection = x.collection) != null ? _x$collection : false) === (props.dataNode.elementIndex == null && ((_field$collection = field.collection) != null ? _field$collection : false));
|
|
1508
|
+
var isSchemaAllowed = !!x.schemaType && renderType == formsCore.DataRenderType.Standard ? isOneOf(x.schemaType, field.type) : undefined;
|
|
3216
1509
|
var isRendererAllowed = !!x.renderType && isOneOf(x.renderType, renderType);
|
|
3217
1510
|
return matchCollection && ((_x$options = x.options) != null ? _x$options : false) === options && (isSchemaAllowed || isRendererAllowed || !x.renderType && !x.schemaType && noMatch === false);
|
|
3218
1511
|
}
|
|
@@ -3279,19 +1572,236 @@ function isArrayRegistration(x) {
|
|
|
3279
1572
|
return x.type === "array";
|
|
3280
1573
|
}
|
|
3281
1574
|
|
|
1575
|
+
var _excluded = ["styleClass", "labelClass", "layoutClass", "labelTextClass", "textClass"],
|
|
1576
|
+
_excluded2 = ["parentDataNode", "actionOnClick", "variables"];
|
|
1577
|
+
function RenderForm(_ref) {
|
|
1578
|
+
var _effect = core.useComponentTracking();
|
|
1579
|
+
try {
|
|
1580
|
+
var _options$schemaInterf, _definition$adornment, _definition$adornment2, _dataContext$dataNode, _options$adjustLayout;
|
|
1581
|
+
var data = _ref.data,
|
|
1582
|
+
form = _ref.form,
|
|
1583
|
+
renderer = _ref.renderer,
|
|
1584
|
+
_ref$options = _ref.options,
|
|
1585
|
+
options = _ref$options === void 0 ? {} : _ref$options;
|
|
1586
|
+
var schemaInterface = (_options$schemaInterf = options.schemaInterface) != null ? _options$schemaInterf : formsCore.defaultSchemaInterface;
|
|
1587
|
+
var _useState = react.useState(function () {
|
|
1588
|
+
var _options$formState;
|
|
1589
|
+
return (_options$formState = options == null ? void 0 : options.formState) != null ? _options$formState : formsCore.createFormState(schemaInterface);
|
|
1590
|
+
}),
|
|
1591
|
+
formState = _useState[0],
|
|
1592
|
+
setFormState = _useState[1];
|
|
1593
|
+
var state = formState.getControlState(data, form, options);
|
|
1594
|
+
react.useEffect(function () {
|
|
1595
|
+
if (!(options != null && options.formState)) {
|
|
1596
|
+
return function () {
|
|
1597
|
+
return formState.cleanup();
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
}, [formState, options == null ? void 0 : options.formState]);
|
|
1601
|
+
var definition = state.definition;
|
|
1602
|
+
var visible = !state.hidden;
|
|
1603
|
+
var visibility = core.useControl(function () {
|
|
1604
|
+
return visible != null ? {
|
|
1605
|
+
visible: visible,
|
|
1606
|
+
showing: visible
|
|
1607
|
+
} : undefined;
|
|
1608
|
+
});
|
|
1609
|
+
visibility.fields.visible.value = visible;
|
|
1610
|
+
var dataContext = {
|
|
1611
|
+
schemaInterface: state.schemaInterface,
|
|
1612
|
+
dataNode: state.dataNode,
|
|
1613
|
+
parentNode: data,
|
|
1614
|
+
variables: state.variables
|
|
1615
|
+
};
|
|
1616
|
+
var adornments = (_definition$adornment = (_definition$adornment2 = definition.adornments) == null ? void 0 : _definition$adornment2.map(function (x) {
|
|
1617
|
+
return renderer.renderAdornment({
|
|
1618
|
+
adornment: x,
|
|
1619
|
+
dataContext: dataContext,
|
|
1620
|
+
formOptions: state
|
|
1621
|
+
});
|
|
1622
|
+
})) != null ? _definition$adornment : [];
|
|
1623
|
+
var styleClass = options.styleClass,
|
|
1624
|
+
labelClass = options.labelClass,
|
|
1625
|
+
layoutClass = options.layoutClass,
|
|
1626
|
+
labelTextClass = options.labelTextClass,
|
|
1627
|
+
textClass = options.textClass,
|
|
1628
|
+
inheritableOptions = _objectWithoutPropertiesLoose(options, _excluded);
|
|
1629
|
+
var readonly = state.readonly,
|
|
1630
|
+
hidden = state.hidden,
|
|
1631
|
+
disabled = state.disabled,
|
|
1632
|
+
variables = state.variables;
|
|
1633
|
+
var childOptions = _extends({}, inheritableOptions, {
|
|
1634
|
+
readonly: readonly,
|
|
1635
|
+
disabled: disabled,
|
|
1636
|
+
variables: variables,
|
|
1637
|
+
formState: formState
|
|
1638
|
+
});
|
|
1639
|
+
var labelAndChildren = renderControlLayout({
|
|
1640
|
+
formNode: form,
|
|
1641
|
+
renderer: renderer,
|
|
1642
|
+
state: state,
|
|
1643
|
+
renderChild: function renderChild(k, child, options) {
|
|
1644
|
+
var _ref3;
|
|
1645
|
+
var overrideClasses = getGroupClassOverrides(definition);
|
|
1646
|
+
var _ref2 = options != null ? options : {},
|
|
1647
|
+
parentDataNode = _ref2.parentDataNode,
|
|
1648
|
+
actionOnClick = _ref2.actionOnClick,
|
|
1649
|
+
variables = _ref2.variables,
|
|
1650
|
+
renderOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
1651
|
+
var dContext = (_ref3 = parentDataNode != null ? parentDataNode : dataContext.dataNode) != null ? _ref3 : data;
|
|
1652
|
+
var allChildOptions = _extends({}, childOptions, overrideClasses, renderOptions, {
|
|
1653
|
+
variables: _extends({}, childOptions.variables, variables),
|
|
1654
|
+
actionOnClick: actionHandlers(actionOnClick, childOptions.actionOnClick)
|
|
1655
|
+
});
|
|
1656
|
+
return /*#__PURE__*/jsxRuntime.jsx(RenderForm, {
|
|
1657
|
+
form: child,
|
|
1658
|
+
renderer: renderer,
|
|
1659
|
+
data: dContext,
|
|
1660
|
+
options: allChildOptions
|
|
1661
|
+
}, k);
|
|
1662
|
+
},
|
|
1663
|
+
inline: options == null ? void 0 : options.inline,
|
|
1664
|
+
displayOnly: options == null ? void 0 : options.displayOnly,
|
|
1665
|
+
createDataProps: defaultDataProps,
|
|
1666
|
+
formOptions: state,
|
|
1667
|
+
dataContext: dataContext,
|
|
1668
|
+
control: (_dataContext$dataNode = dataContext.dataNode) == null ? void 0 : _dataContext$dataNode.control,
|
|
1669
|
+
schemaInterface: schemaInterface,
|
|
1670
|
+
style: state.style,
|
|
1671
|
+
allowedOptions: state.allowedOptions,
|
|
1672
|
+
customDisplay: options.customDisplay,
|
|
1673
|
+
actionOnClick: options.actionOnClick,
|
|
1674
|
+
styleClass: styleClass,
|
|
1675
|
+
labelClass: labelClass,
|
|
1676
|
+
labelTextClass: labelTextClass,
|
|
1677
|
+
textClass: textClass,
|
|
1678
|
+
getChildState: function getChildState(child, parent) {
|
|
1679
|
+
var _ref4;
|
|
1680
|
+
return formState.getControlState((_ref4 = parent != null ? parent : state.dataNode) != null ? _ref4 : data, child, childOptions);
|
|
1681
|
+
},
|
|
1682
|
+
runExpression: function runExpression(scope, expr, returnResult) {
|
|
1683
|
+
if (expr != null && expr.type) {
|
|
1684
|
+
formState.evalExpression(expr, {
|
|
1685
|
+
scope: scope,
|
|
1686
|
+
dataNode: data,
|
|
1687
|
+
schemaInterface: schemaInterface,
|
|
1688
|
+
returnResult: returnResult
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
});
|
|
1693
|
+
var layoutProps = _extends({}, labelAndChildren, {
|
|
1694
|
+
adornments: adornments,
|
|
1695
|
+
className: rendererClass(options.layoutClass, definition.layoutClass),
|
|
1696
|
+
style: state.layoutStyle
|
|
1697
|
+
});
|
|
1698
|
+
var renderedControl = renderer.renderLayout((_options$adjustLayout = options.adjustLayout == null ? void 0 : options.adjustLayout(dataContext, layoutProps)) != null ? _options$adjustLayout : layoutProps);
|
|
1699
|
+
return renderer.renderVisibility(_extends({
|
|
1700
|
+
visibility: visibility
|
|
1701
|
+
}, renderedControl));
|
|
1702
|
+
} finally {
|
|
1703
|
+
_effect();
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
/**
|
|
1707
|
+
* @deprecated Use RenderForm instead.
|
|
1708
|
+
*/
|
|
1709
|
+
function useControlRendererComponent(controlOrFormNode, renderer, options, parentDataNode) {
|
|
1710
|
+
if (options === void 0) {
|
|
1711
|
+
options = {};
|
|
1712
|
+
}
|
|
1713
|
+
var _ref5 = "definition" in controlOrFormNode ? [controlOrFormNode.definition, controlOrFormNode] : [controlOrFormNode, formsCore.legacyFormNode(controlOrFormNode)],
|
|
1714
|
+
formNode = _ref5[1];
|
|
1715
|
+
var r = useUpdatedRef({
|
|
1716
|
+
options: options,
|
|
1717
|
+
renderer: renderer,
|
|
1718
|
+
parentDataNode: parentDataNode,
|
|
1719
|
+
formNode: formNode
|
|
1720
|
+
});
|
|
1721
|
+
return react.useMemo(function () {
|
|
1722
|
+
return function () {
|
|
1723
|
+
var _r$current = r.current,
|
|
1724
|
+
options = _r$current.options,
|
|
1725
|
+
parentDataNode = _r$current.parentDataNode,
|
|
1726
|
+
formNode = _r$current.formNode,
|
|
1727
|
+
renderer = _r$current.renderer;
|
|
1728
|
+
return /*#__PURE__*/jsxRuntime.jsx(RenderForm, {
|
|
1729
|
+
data: parentDataNode,
|
|
1730
|
+
form: formNode,
|
|
1731
|
+
renderer: renderer,
|
|
1732
|
+
options: options
|
|
1733
|
+
});
|
|
1734
|
+
};
|
|
1735
|
+
}, [r]);
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* @deprecated Use RenderForm instead.
|
|
1739
|
+
*/
|
|
1740
|
+
function ControlRenderer(_ref6) {
|
|
1741
|
+
var _effect2 = core.useComponentTracking();
|
|
1742
|
+
try {
|
|
1743
|
+
var definition = _ref6.definition,
|
|
1744
|
+
fields = _ref6.fields,
|
|
1745
|
+
renderer = _ref6.renderer,
|
|
1746
|
+
options = _ref6.options,
|
|
1747
|
+
control = _ref6.control,
|
|
1748
|
+
parentPath = _ref6.parentPath;
|
|
1749
|
+
var schemaDataNode = formsCore.createSchemaDataNode(formsCore.createSchemaTree(fields).rootNode, control);
|
|
1750
|
+
var Render = useControlRendererComponent(definition, renderer, options, schemaDataNode);
|
|
1751
|
+
return /*#__PURE__*/jsxRuntime.jsx(Render, {});
|
|
1752
|
+
} finally {
|
|
1753
|
+
_effect2();
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* @deprecated Use RenderForm instead.
|
|
1758
|
+
*/
|
|
1759
|
+
function NewControlRenderer(_ref7) {
|
|
1760
|
+
var _effect3 = core.useComponentTracking();
|
|
1761
|
+
try {
|
|
1762
|
+
var definition = _ref7.definition,
|
|
1763
|
+
renderer = _ref7.renderer,
|
|
1764
|
+
options = _ref7.options,
|
|
1765
|
+
parentDataNode = _ref7.parentDataNode;
|
|
1766
|
+
var Render = useControlRendererComponent(definition, renderer, options, parentDataNode);
|
|
1767
|
+
return /*#__PURE__*/jsxRuntime.jsx(Render, {});
|
|
1768
|
+
} finally {
|
|
1769
|
+
_effect3();
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* @deprecated Use RenderForm instead.
|
|
1774
|
+
*/
|
|
1775
|
+
function useControlRenderer(definition, fields, renderer, options) {
|
|
1776
|
+
if (options === void 0) {
|
|
1777
|
+
options = {};
|
|
1778
|
+
}
|
|
1779
|
+
var r = useUpdatedRef({
|
|
1780
|
+
definition: definition,
|
|
1781
|
+
fields: fields,
|
|
1782
|
+
renderer: renderer,
|
|
1783
|
+
options: options
|
|
1784
|
+
});
|
|
1785
|
+
return react.useCallback(function (_ref8) {
|
|
1786
|
+
var control = _ref8.control,
|
|
1787
|
+
parentPath = _ref8.parentPath;
|
|
1788
|
+
return /*#__PURE__*/jsxRuntime.jsx(ControlRenderer, _extends({}, r.current, {
|
|
1789
|
+
control: control,
|
|
1790
|
+
parentPath: parentPath
|
|
1791
|
+
}));
|
|
1792
|
+
}, [r]);
|
|
1793
|
+
}
|
|
1794
|
+
|
|
3282
1795
|
exports.AppendAdornmentPriority = AppendAdornmentPriority;
|
|
3283
1796
|
exports.ControlRenderer = ControlRenderer;
|
|
3284
|
-
exports.DefaultSchemaInterface = DefaultSchemaInterface;
|
|
3285
|
-
exports.FormTree = FormTree;
|
|
3286
1797
|
exports.NewControlRenderer = NewControlRenderer;
|
|
1798
|
+
exports.RenderForm = RenderForm;
|
|
3287
1799
|
exports.WrapAdornmentPriority = WrapAdornmentPriority;
|
|
3288
1800
|
exports.accordionOptions = accordionOptions;
|
|
3289
1801
|
exports.actionControl = actionControl;
|
|
3290
1802
|
exports.actionHandlers = actionHandlers;
|
|
3291
|
-
exports.addFieldOption = addFieldOption;
|
|
3292
1803
|
exports.addMissingControls = addMissingControls;
|
|
3293
1804
|
exports.addMissingControlsForSchema = addMissingControlsForSchema;
|
|
3294
|
-
exports.addMissingControlsToForm = addMissingControlsToForm;
|
|
3295
1805
|
exports.adornmentOptions = adornmentOptions;
|
|
3296
1806
|
exports.appendMarkup = appendMarkup;
|
|
3297
1807
|
exports.appendMarkupAt = appendMarkupAt;
|
|
@@ -3303,14 +1813,11 @@ exports.applyExtensionsToSchema = applyExtensionsToSchema;
|
|
|
3303
1813
|
exports.applyLengthRestrictions = applyLengthRestrictions;
|
|
3304
1814
|
exports.applyValues = applyValues;
|
|
3305
1815
|
exports.autocompleteOptions = autocompleteOptions;
|
|
3306
|
-
exports.boolField = boolField;
|
|
3307
|
-
exports.buildSchema = buildSchema;
|
|
3308
1816
|
exports.checkListOptions = checkListOptions;
|
|
3309
1817
|
exports.cleanDataForSchema = cleanDataForSchema;
|
|
3310
1818
|
exports.coerceToString = coerceToString;
|
|
3311
1819
|
exports.collectDifferences = collectDifferences;
|
|
3312
1820
|
exports.compoundControl = compoundControl;
|
|
3313
|
-
exports.compoundField = compoundField;
|
|
3314
1821
|
exports.controlTitle = controlTitle;
|
|
3315
1822
|
exports.createAction = createAction;
|
|
3316
1823
|
exports.createActionRenderer = createActionRenderer;
|
|
@@ -3319,30 +1826,19 @@ exports.createArrayActions = createArrayActions;
|
|
|
3319
1826
|
exports.createArrayRenderer = createArrayRenderer;
|
|
3320
1827
|
exports.createDataRenderer = createDataRenderer;
|
|
3321
1828
|
exports.createDisplayRenderer = createDisplayRenderer;
|
|
3322
|
-
exports.createFormLookup = createFormLookup;
|
|
3323
1829
|
exports.createFormRenderer = createFormRenderer;
|
|
3324
|
-
exports.createFormTree = createFormTree;
|
|
3325
1830
|
exports.createGroupRenderer = createGroupRenderer;
|
|
3326
1831
|
exports.createLabelRenderer = createLabelRenderer;
|
|
3327
1832
|
exports.createLayoutRenderer = createLayoutRenderer;
|
|
3328
|
-
exports.createSchemaLookup = createSchemaLookup;
|
|
3329
1833
|
exports.createVisibilityRenderer = createVisibilityRenderer;
|
|
3330
1834
|
exports.dataControl = dataControl;
|
|
3331
|
-
exports.dateField = dateField;
|
|
3332
|
-
exports.dateTimeField = dateTimeField;
|
|
3333
1835
|
exports.dateValidatorOptions = dateValidatorOptions;
|
|
3334
1836
|
exports.deepMerge = deepMerge;
|
|
3335
|
-
exports.defaultCompoundField = defaultCompoundField;
|
|
3336
1837
|
exports.defaultControlForField = defaultControlForField;
|
|
3337
1838
|
exports.defaultDataProps = defaultDataProps;
|
|
3338
|
-
exports.defaultEvalHooks = defaultEvalHooks;
|
|
3339
|
-
exports.defaultScalarField = defaultScalarField;
|
|
3340
|
-
exports.defaultSchemaInterface = defaultSchemaInterface;
|
|
3341
|
-
exports.defaultUseEvalExpressionHook = defaultUseEvalExpressionHook;
|
|
3342
1839
|
exports.defaultValueForField = defaultValueForField;
|
|
3343
1840
|
exports.defaultValueForFields = defaultValueForFields;
|
|
3344
1841
|
exports.displayOnlyOptions = displayOnlyOptions;
|
|
3345
|
-
exports.doubleField = doubleField;
|
|
3346
1842
|
exports.dynamicDefaultValue = dynamicDefaultValue;
|
|
3347
1843
|
exports.dynamicDisabled = dynamicDisabled;
|
|
3348
1844
|
exports.dynamicReadonly = dynamicReadonly;
|
|
@@ -3354,135 +1850,57 @@ exports.fieldEqExpr = fieldEqExpr;
|
|
|
3354
1850
|
exports.fieldExpr = fieldExpr;
|
|
3355
1851
|
exports.fieldHasTag = fieldHasTag;
|
|
3356
1852
|
exports.fieldOptionAdornment = fieldOptionAdornment;
|
|
3357
|
-
exports.fieldPathForDefinition = fieldPathForDefinition;
|
|
3358
1853
|
exports.findChildDefinition = findChildDefinition;
|
|
3359
1854
|
exports.findCompoundField = findCompoundField;
|
|
3360
1855
|
exports.findControlsForCompound = findControlsForCompound;
|
|
3361
|
-
exports.findField = findField;
|
|
3362
1856
|
exports.findFieldPath = findFieldPath;
|
|
3363
1857
|
exports.findNonDataGroups = findNonDataGroups;
|
|
3364
1858
|
exports.findScalarField = findScalarField;
|
|
3365
1859
|
exports.getAllReferencedClasses = getAllReferencedClasses;
|
|
3366
1860
|
exports.getAllValues = getAllValues;
|
|
3367
1861
|
exports.getDiffObject = getDiffObject;
|
|
3368
|
-
exports.getDisplayOnlyOptions = getDisplayOnlyOptions;
|
|
3369
1862
|
exports.getExternalEditData = getExternalEditData;
|
|
3370
1863
|
exports.getGroupClassOverrides = getGroupClassOverrides;
|
|
3371
|
-
exports.getGroupRendererOptions = getGroupRendererOptions;
|
|
3372
1864
|
exports.getIsEditing = getIsEditing;
|
|
3373
|
-
exports.getJsonPath = getJsonPath;
|
|
3374
1865
|
exports.getLastDefinedValue = getLastDefinedValue;
|
|
3375
1866
|
exports.getLengthRestrictions = getLengthRestrictions;
|
|
3376
1867
|
exports.getNullToggler = getNullToggler;
|
|
3377
1868
|
exports.getOverrideClass = getOverrideClass;
|
|
3378
|
-
exports.getRootDataNode = getRootDataNode;
|
|
3379
|
-
exports.getSchemaFieldList = getSchemaFieldList;
|
|
3380
|
-
exports.getSchemaNodePath = getSchemaNodePath;
|
|
3381
|
-
exports.getSchemaPath = getSchemaPath;
|
|
3382
|
-
exports.getTagParam = getTagParam;
|
|
3383
1869
|
exports.groupedControl = groupedControl;
|
|
3384
1870
|
exports.hasOptions = hasOptions;
|
|
3385
|
-
exports.hideDisplayOnly = hideDisplayOnly;
|
|
3386
1871
|
exports.htmlDisplayControl = htmlDisplayControl;
|
|
3387
|
-
exports.intField = intField;
|
|
3388
1872
|
exports.isAccordionAdornment = isAccordionAdornment;
|
|
3389
|
-
exports.isActionControl = isActionControl;
|
|
3390
|
-
exports.isArrayRenderer = isArrayRenderer;
|
|
3391
|
-
exports.isAutoCompleteClasses = isAutoCompleteClasses;
|
|
3392
|
-
exports.isAutocompleteRenderer = isAutocompleteRenderer;
|
|
3393
|
-
exports.isCheckEntryClasses = isCheckEntryClasses;
|
|
3394
|
-
exports.isCompoundField = isCompoundField;
|
|
3395
|
-
exports.isCompoundNode = isCompoundNode;
|
|
3396
|
-
exports.isControlDisabled = isControlDisabled;
|
|
3397
|
-
exports.isControlDisplayOnly = isControlDisplayOnly;
|
|
3398
|
-
exports.isControlReadonly = isControlReadonly;
|
|
3399
|
-
exports.isDataControl = isDataControl;
|
|
3400
|
-
exports.isDataGroupRenderer = isDataGroupRenderer;
|
|
3401
|
-
exports.isDateTimeRenderer = isDateTimeRenderer;
|
|
3402
|
-
exports.isDisplayControl = isDisplayControl;
|
|
3403
|
-
exports.isDisplayOnlyRenderer = isDisplayOnlyRenderer;
|
|
3404
|
-
exports.isFlexRenderer = isFlexRenderer;
|
|
3405
|
-
exports.isGridRenderer = isGridRenderer;
|
|
3406
|
-
exports.isGroupControl = isGroupControl;
|
|
3407
1873
|
exports.isIconAdornment = isIconAdornment;
|
|
3408
1874
|
exports.isOptionalAdornment = isOptionalAdornment;
|
|
3409
|
-
exports.isScalarField = isScalarField;
|
|
3410
|
-
exports.isSelectChildRenderer = isSelectChildRenderer;
|
|
3411
1875
|
exports.isSetFieldAdornment = isSetFieldAdornment;
|
|
3412
|
-
exports.isTabsRenderer = isTabsRenderer;
|
|
3413
|
-
exports.isTextfieldRenderer = isTextfieldRenderer;
|
|
3414
|
-
exports.jsonPathString = jsonPathString;
|
|
3415
1876
|
exports.jsonataExpr = jsonataExpr;
|
|
3416
1877
|
exports.jsonataOptions = jsonataOptions;
|
|
3417
1878
|
exports.jsonataValidatorOptions = jsonataValidatorOptions;
|
|
3418
1879
|
exports.layoutKeyForPlacement = layoutKeyForPlacement;
|
|
3419
|
-
exports.legacyFormNode = legacyFormNode;
|
|
3420
1880
|
exports.lengthValidatorOptions = lengthValidatorOptions;
|
|
3421
|
-
exports.
|
|
3422
|
-
exports.makeCompoundField = makeCompoundField;
|
|
3423
|
-
exports.makeEvalExpressionHook = makeEvalExpressionHook;
|
|
3424
|
-
exports.makeHook = makeHook;
|
|
3425
|
-
exports.makeHookDepString = makeHookDepString;
|
|
3426
|
-
exports.makeParamTag = makeParamTag;
|
|
3427
|
-
exports.makeScalarField = makeScalarField;
|
|
3428
|
-
exports.makeSchemaDataNode = makeSchemaDataNode;
|
|
3429
|
-
exports.matchesType = matchesType;
|
|
3430
|
-
exports.mergeField = mergeField;
|
|
3431
|
-
exports.mergeFields = mergeFields;
|
|
1881
|
+
exports.lookupChildDataContext = lookupChildDataContext;
|
|
3432
1882
|
exports.mergeObjects = mergeObjects;
|
|
3433
|
-
exports.optionalHook = optionalHook;
|
|
3434
1883
|
exports.radioButtonOptions = radioButtonOptions;
|
|
3435
|
-
exports.relativePath = relativePath;
|
|
3436
1884
|
exports.renderControlLayout = renderControlLayout;
|
|
3437
1885
|
exports.renderLayoutParts = renderLayoutParts;
|
|
3438
1886
|
exports.renderOptionsFor = renderOptionsFor;
|
|
3439
1887
|
exports.rendererClass = rendererClass;
|
|
3440
|
-
exports.resolveSchemas = resolveSchemas;
|
|
3441
|
-
exports.rootSchemaNode = rootSchemaNode;
|
|
3442
|
-
exports.schemaDataForFieldPath = schemaDataForFieldPath;
|
|
3443
|
-
exports.schemaDataForFieldRef = schemaDataForFieldRef;
|
|
3444
|
-
exports.schemaForFieldPath = schemaForFieldPath;
|
|
3445
|
-
exports.schemaForFieldRef = schemaForFieldRef;
|
|
3446
|
-
exports.stringField = stringField;
|
|
3447
|
-
exports.stringOptionsField = stringOptionsField;
|
|
3448
1888
|
exports.textDisplayControl = textDisplayControl;
|
|
3449
1889
|
exports.textfieldOptions = textfieldOptions;
|
|
3450
|
-
exports.timeField = timeField;
|
|
3451
|
-
exports.toDepString = toDepString;
|
|
3452
|
-
exports.traverseData = traverseData;
|
|
3453
|
-
exports.traverseParents = traverseParents;
|
|
3454
|
-
exports.traverseSchemaPath = traverseSchemaPath;
|
|
3455
1890
|
exports.useControlDefinitionForSchema = useControlDefinitionForSchema;
|
|
3456
1891
|
exports.useControlRenderer = useControlRenderer;
|
|
3457
1892
|
exports.useControlRendererComponent = useControlRendererComponent;
|
|
3458
|
-
exports.
|
|
3459
|
-
exports.useDynamicHooks = useDynamicHooks;
|
|
3460
|
-
exports.useEvalActionHook = useEvalActionHook;
|
|
3461
|
-
exports.useEvalAllowedOptionsHook = useEvalAllowedOptionsHook;
|
|
3462
|
-
exports.useEvalDefaultValueHook = useEvalDefaultValueHook;
|
|
3463
|
-
exports.useEvalDisabledHook = useEvalDisabledHook;
|
|
3464
|
-
exports.useEvalDisplayHook = useEvalDisplayHook;
|
|
3465
|
-
exports.useEvalDynamicBoolHook = useEvalDynamicBoolHook;
|
|
3466
|
-
exports.useEvalDynamicHook = useEvalDynamicHook;
|
|
3467
|
-
exports.useEvalLabelText = useEvalLabelText;
|
|
3468
|
-
exports.useEvalReadonlyHook = useEvalReadonlyHook;
|
|
3469
|
-
exports.useEvalStyleHook = useEvalStyleHook;
|
|
3470
|
-
exports.useEvalVisibilityHook = useEvalVisibilityHook;
|
|
3471
|
-
exports.useJsonataExpression = useJsonataExpression;
|
|
3472
|
-
exports.useJsonataValidator = useJsonataValidator;
|
|
3473
|
-
exports.useLengthValidator = useLengthValidator;
|
|
3474
|
-
exports.useMakeValidationHook = useMakeValidationHook;
|
|
1893
|
+
exports.useExpression = useExpression;
|
|
3475
1894
|
exports.useUpdatedRef = useUpdatedRef;
|
|
3476
|
-
exports.useUuidExpression = useUuidExpression;
|
|
3477
1895
|
exports.validationVisitor = validationVisitor;
|
|
3478
1896
|
exports.validatorOptions = validatorOptions;
|
|
3479
|
-
exports.visitControlData = visitControlData;
|
|
3480
|
-
exports.visitControlDataArray = visitControlDataArray;
|
|
3481
|
-
exports.visitControlDefinition = visitControlDefinition;
|
|
3482
|
-
exports.visitFormData = visitFormData;
|
|
3483
|
-
exports.visitFormDataInContext = visitFormDataInContext;
|
|
3484
|
-
exports.withScalarOptions = withScalarOptions;
|
|
3485
1897
|
exports.wrapLayout = wrapLayout;
|
|
3486
1898
|
exports.wrapMarkup = wrapMarkup;
|
|
3487
1899
|
exports.wrapMarkupAt = wrapMarkupAt;
|
|
1900
|
+
Object.keys(formsCore).forEach(function (k) {
|
|
1901
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
1902
|
+
enumerable: true,
|
|
1903
|
+
get: function () { return formsCore[k]; }
|
|
1904
|
+
});
|
|
1905
|
+
});
|
|
3488
1906
|
//# sourceMappingURL=index.cjs.map
|