@react-typed-forms/schemas 7.3.2 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/controlBuilder.d.ts +6 -0
- package/lib/controlRender.d.ts +16 -9
- package/lib/hooks.d.ts +1 -0
- package/lib/index.js +206 -94
- package/lib/index.js.map +1 -1
- package/lib/renderers.d.ts +2 -1
- package/lib/schemaBuilder.d.ts +1 -0
- package/lib/tailwind.d.ts +27 -2
- package/lib/types.d.ts +3 -1
- package/lib/util.d.ts +4 -1
- package/package.json +1 -1
- package/src/controlBuilder.ts +46 -1
- package/src/controlRender.tsx +69 -44
- package/src/hooks.tsx +24 -3
- package/src/renderers.tsx +33 -22
- package/src/schemaBuilder.ts +25 -0
- package/src/tailwind.tsx +2 -2
- package/src/types.ts +3 -1
- package/src/util.ts +38 -3
package/lib/index.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.DynamicPropertyType = void 0;
|
|
|
40
40
|
DynamicPropertyType["Style"] = "Style";
|
|
41
41
|
DynamicPropertyType["LayoutStyle"] = "LayoutStyle";
|
|
42
42
|
DynamicPropertyType["AllowedOptions"] = "AllowedOptions";
|
|
43
|
+
DynamicPropertyType["Label"] = "Label";
|
|
43
44
|
})(exports.DynamicPropertyType || (exports.DynamicPropertyType = {}));
|
|
44
45
|
exports.ExpressionType = void 0;
|
|
45
46
|
(function (ExpressionType) {
|
|
@@ -268,6 +269,27 @@ function defaultCompoundField(field, displayName, collection) {
|
|
|
268
269
|
children: []
|
|
269
270
|
};
|
|
270
271
|
}
|
|
272
|
+
function mergeField(field, mergeInto) {
|
|
273
|
+
var existing = mergeInto.find(function (x) {
|
|
274
|
+
return x.field === field.field;
|
|
275
|
+
});
|
|
276
|
+
if (existing) {
|
|
277
|
+
return mergeInto.map(function (x) {
|
|
278
|
+
return x !== existing ? x : _extends({}, x, {
|
|
279
|
+
onlyForTypes: mergeTypes(x.onlyForTypes, field.onlyForTypes)
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
return [].concat(mergeInto, [field]);
|
|
284
|
+
function mergeTypes(f, s) {
|
|
285
|
+
if (!f) return s;
|
|
286
|
+
if (!s) return f;
|
|
287
|
+
var extras = s.filter(function (x) {
|
|
288
|
+
return !f.includes(x);
|
|
289
|
+
});
|
|
290
|
+
return extras.length ? [].concat(f, extras) : f;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
271
293
|
|
|
272
294
|
function applyDefaultValues(v, fields) {
|
|
273
295
|
if (!v) return defaultValueForFields(fields);
|
|
@@ -539,17 +561,18 @@ function cleanDataForSchema(v, fields) {
|
|
|
539
561
|
function getAllReferencedClasses(c) {
|
|
540
562
|
var _c$children;
|
|
541
563
|
var childClasses = (_c$children = c.children) == null ? void 0 : _c$children.flatMap(getAllReferencedClasses);
|
|
542
|
-
var tc = clsx__default["default"](c.styleClass, c.layoutClass);
|
|
564
|
+
var tc = clsx__default["default"](getOverrideClass(c.styleClass), getOverrideClass(c.layoutClass), getOverrideClass(c.labelClass));
|
|
543
565
|
if (childClasses && !tc) return childClasses;
|
|
544
566
|
if (!tc) return [];
|
|
545
567
|
if (childClasses) return [tc].concat(childClasses);
|
|
546
568
|
return [tc];
|
|
547
569
|
}
|
|
548
|
-
function jsonPathString(jsonPath) {
|
|
570
|
+
function jsonPathString(jsonPath, customIndex) {
|
|
549
571
|
var out = "";
|
|
550
572
|
jsonPath.forEach(function (v, i) {
|
|
551
573
|
if (typeof v === "number") {
|
|
552
|
-
|
|
574
|
+
var _customIndex;
|
|
575
|
+
out += (_customIndex = customIndex == null ? void 0 : customIndex(v)) != null ? _customIndex : "[" + v + "]";
|
|
553
576
|
} else {
|
|
554
577
|
if (i > 0) out += ".";
|
|
555
578
|
out += v;
|
|
@@ -557,6 +580,27 @@ function jsonPathString(jsonPath) {
|
|
|
557
580
|
});
|
|
558
581
|
return out;
|
|
559
582
|
}
|
|
583
|
+
function findChildDefinition(parent, childPath) {
|
|
584
|
+
if (Array.isArray(childPath)) {
|
|
585
|
+
var base = parent;
|
|
586
|
+
childPath.forEach(function (x) {
|
|
587
|
+
return base = base.children[x];
|
|
588
|
+
});
|
|
589
|
+
return base;
|
|
590
|
+
}
|
|
591
|
+
return parent.children[childPath];
|
|
592
|
+
}
|
|
593
|
+
function getOverrideClass(className) {
|
|
594
|
+
if (className && className.startsWith("@ ")) {
|
|
595
|
+
return className.substring(2);
|
|
596
|
+
}
|
|
597
|
+
return className;
|
|
598
|
+
}
|
|
599
|
+
function rendererClass(controlClass, globalClass) {
|
|
600
|
+
var oc = getOverrideClass(controlClass);
|
|
601
|
+
if (oc === controlClass) return clsx__default["default"](controlClass, globalClass);
|
|
602
|
+
return oc ? oc : undefined;
|
|
603
|
+
}
|
|
560
604
|
|
|
561
605
|
function dataControl(field, title, options) {
|
|
562
606
|
return _extends({
|
|
@@ -668,6 +712,42 @@ function useControlDefinitionForSchema(sf, definition) {
|
|
|
668
712
|
});
|
|
669
713
|
}, [sf, definition]);
|
|
670
714
|
}
|
|
715
|
+
function addCustomDataRenderOptions(controlFields, customRenderOptions) {
|
|
716
|
+
return controlFields.map(function (x) {
|
|
717
|
+
return x.field === "renderOptions" && isCompoundField(x) ? addRenderOptions(x) : x;
|
|
718
|
+
});
|
|
719
|
+
function addRenderOptions(roField) {
|
|
720
|
+
var children = roField.children;
|
|
721
|
+
var withTypes = children.map(function (x) {
|
|
722
|
+
return x.field === "type" ? addRenderOptionType(x) : x;
|
|
723
|
+
});
|
|
724
|
+
return _extends({}, roField, {
|
|
725
|
+
children: customRenderOptions.reduce(function (renderOptionFields, ro) {
|
|
726
|
+
return ro.fields.map(function (x) {
|
|
727
|
+
return _extends({}, x, {
|
|
728
|
+
onlyForTypes: [ro.value]
|
|
729
|
+
});
|
|
730
|
+
}).reduce(function (af, x) {
|
|
731
|
+
return mergeField(x, af);
|
|
732
|
+
}, renderOptionFields);
|
|
733
|
+
}, withTypes)
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
function addRenderOptionType(typeField) {
|
|
737
|
+
var _typeField$options;
|
|
738
|
+
var options = (_typeField$options = typeField.options) != null ? _typeField$options : [];
|
|
739
|
+
return _extends({}, typeField, {
|
|
740
|
+
options: [].concat(options, customRenderOptions.map(function (_ref) {
|
|
741
|
+
var name = _ref.name,
|
|
742
|
+
value = _ref.value;
|
|
743
|
+
return {
|
|
744
|
+
name: name,
|
|
745
|
+
value: value
|
|
746
|
+
};
|
|
747
|
+
}))
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
}
|
|
671
751
|
|
|
672
752
|
function useCalculatedControl(calculate) {
|
|
673
753
|
var c = core.useControl(calculate);
|
|
@@ -846,15 +926,18 @@ function hideDisplayOnly(context, field, definition, schemaInterface) {
|
|
|
846
926
|
return displayOptions && !displayOptions.emptyText && schemaInterface.isEmptyValue(field, (_lookupChildControl = lookupChildControl(context, field.field)) == null ? void 0 : _lookupChildControl.value);
|
|
847
927
|
}
|
|
848
928
|
function useJsonataExpression(jExpr, dataContext, bindings) {
|
|
849
|
-
var pathString = jsonPathString(dataContext.path)
|
|
929
|
+
var pathString = jsonPathString(dataContext.path, function (x) {
|
|
930
|
+
return "#$i[" + x + "]";
|
|
931
|
+
});
|
|
932
|
+
var fullExpr = pathString ? pathString + ".(" + jExpr + ")" : jExpr;
|
|
850
933
|
var compiledExpr = React.useMemo(function () {
|
|
851
934
|
try {
|
|
852
|
-
return jsonata__default["default"](
|
|
935
|
+
return jsonata__default["default"](fullExpr);
|
|
853
936
|
} catch (e) {
|
|
854
937
|
console.error(e);
|
|
855
938
|
return jsonata__default["default"]("null");
|
|
856
939
|
}
|
|
857
|
-
}, [
|
|
940
|
+
}, [fullExpr]);
|
|
858
941
|
var control = core.useControl();
|
|
859
942
|
var listenerRef = React.useRef();
|
|
860
943
|
var _useRefState = core.useRefState(function () {
|
|
@@ -899,6 +982,15 @@ function useJsonataExpression(jExpr, dataContext, bindings) {
|
|
|
899
982
|
}, [compiledExpr]);
|
|
900
983
|
return control;
|
|
901
984
|
}
|
|
985
|
+
function useEvalLabelText(useExpr, definition) {
|
|
986
|
+
var dynamicValue = useEvalDynamicHook(definition, exports.DynamicPropertyType.Label, useExpr);
|
|
987
|
+
return React.useCallback(function (ctx) {
|
|
988
|
+
if (dynamicValue) {
|
|
989
|
+
return dynamicValue(ctx);
|
|
990
|
+
}
|
|
991
|
+
return core.useControl(null);
|
|
992
|
+
}, [dynamicValue]);
|
|
993
|
+
}
|
|
902
994
|
|
|
903
995
|
function useValidationHook(definition) {
|
|
904
996
|
var _definition$validator, _definition$validator2;
|
|
@@ -1005,6 +1097,7 @@ function useControlRenderer(definition, fields, renderer, options) {
|
|
|
1005
1097
|
var useIsReadonly = useEvalReadonlyHook(useExpr, definition);
|
|
1006
1098
|
var useIsDisabled = useEvalDisabledHook(useExpr, definition);
|
|
1007
1099
|
var useAllowedOptions = useEvalAllowedOptionsHook(useExpr, definition);
|
|
1100
|
+
var useLabelText = useEvalLabelText(useExpr, definition);
|
|
1008
1101
|
var useCustomStyle = useEvalStyleHook(useExpr, exports.DynamicPropertyType.Style, definition);
|
|
1009
1102
|
var useLayoutStyle = useEvalStyleHook(useExpr, exports.DynamicPropertyType.LayoutStyle, definition);
|
|
1010
1103
|
var useDynamicDisplay = useEvalDisplayHook(useExpr, definition);
|
|
@@ -1021,7 +1114,7 @@ function useControlRenderer(definition, fields, renderer, options) {
|
|
|
1021
1114
|
parentPath = _ref$parentPath === void 0 ? [] : _ref$parentPath;
|
|
1022
1115
|
var stopTracking = core.useComponentTracking();
|
|
1023
1116
|
try {
|
|
1024
|
-
var
|
|
1117
|
+
var _definition$adornment, _definition$adornment2;
|
|
1025
1118
|
var _r$current = r.current,
|
|
1026
1119
|
c = _r$current.definition,
|
|
1027
1120
|
_options = _r$current.options,
|
|
@@ -1039,6 +1132,7 @@ function useControlRenderer(definition, fields, renderer, options) {
|
|
|
1039
1132
|
var displayControl = useDynamicDisplay(parentDataContext);
|
|
1040
1133
|
var customStyle = useCustomStyle(parentDataContext).value;
|
|
1041
1134
|
var layoutStyle = useLayoutStyle(parentDataContext).value;
|
|
1135
|
+
var labelText = useLabelText(parentDataContext);
|
|
1042
1136
|
var visible = visibleControl.current.value;
|
|
1043
1137
|
var visibility = core.useControl(function () {
|
|
1044
1138
|
return visible != null ? {
|
|
@@ -1092,9 +1186,7 @@ function useControlRenderer(definition, fields, renderer, options) {
|
|
|
1092
1186
|
};
|
|
1093
1187
|
}).value;
|
|
1094
1188
|
useValidation(control != null ? control : core.newControl(null), !!myOptions.hidden, parentDataContext);
|
|
1095
|
-
var
|
|
1096
|
-
return useControlRenderer(cd, controlDataContext.fields, renderer, _extends({}, _options, myOptions));
|
|
1097
|
-
})) != null ? _c$children$map : [];
|
|
1189
|
+
var childOptions = _extends({}, _options, myOptions);
|
|
1098
1190
|
React.useEffect(function () {
|
|
1099
1191
|
if (control && typeof myOptions.disabled === "boolean") control.disabled = myOptions.disabled;
|
|
1100
1192
|
}, [control, myOptions.disabled]);
|
|
@@ -1107,17 +1199,22 @@ function useControlRenderer(definition, fields, renderer, options) {
|
|
|
1107
1199
|
var labelAndChildren = renderControlLayout({
|
|
1108
1200
|
definition: c,
|
|
1109
1201
|
renderer: renderer,
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1202
|
+
renderChild: function renderChild(k, child, path) {
|
|
1203
|
+
return /*#__PURE__*/React__default["default"].createElement(ControlRenderer, {
|
|
1204
|
+
key: k,
|
|
1205
|
+
control: controlDataContext.data,
|
|
1206
|
+
fields: controlDataContext.fields,
|
|
1207
|
+
definition: findChildDefinition(c, child),
|
|
1208
|
+
parentPath: path ? [].concat(controlDataContext.path, path) : controlDataContext.path,
|
|
1209
|
+
renderer: renderer,
|
|
1210
|
+
options: childOptions
|
|
1211
|
+
});
|
|
1116
1212
|
},
|
|
1117
1213
|
createDataProps: dataProps,
|
|
1118
1214
|
formOptions: myOptions,
|
|
1119
1215
|
dataContext: controlDataContext,
|
|
1120
1216
|
control: displayControl != null ? displayControl : control,
|
|
1217
|
+
labelText: labelText,
|
|
1121
1218
|
schemaField: _schemaField,
|
|
1122
1219
|
displayControl: displayControl,
|
|
1123
1220
|
style: customStyle,
|
|
@@ -1134,7 +1231,7 @@ function useControlRenderer(definition, fields, renderer, options) {
|
|
|
1134
1231
|
} finally {
|
|
1135
1232
|
stopTracking();
|
|
1136
1233
|
}
|
|
1137
|
-
}, [r, dataProps, useIsVisible, useDefaultValue, useIsReadonly, useIsDisabled, useCustomStyle, useLayoutStyle, useAllowedOptions, useDynamicDisplay, useValidation, renderer, schemaInterface]);
|
|
1234
|
+
}, [r, dataProps, useIsVisible, useDefaultValue, useIsReadonly, useIsDisabled, useCustomStyle, useLayoutStyle, useAllowedOptions, useLabelText, useDynamicDisplay, useValidation, renderer, schemaInterface]);
|
|
1138
1235
|
Component.displayName = "RenderControl";
|
|
1139
1236
|
return Component;
|
|
1140
1237
|
}
|
|
@@ -1154,41 +1251,52 @@ function getControlData(schemaField, parentContext) {
|
|
|
1154
1251
|
fields: isCompoundField(schemaField) ? schemaField.children : parentContext.fields
|
|
1155
1252
|
}) : parentContext];
|
|
1156
1253
|
}
|
|
1157
|
-
function
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1254
|
+
function ControlRenderer(_ref3) {
|
|
1255
|
+
var _effect = core.useComponentTracking();
|
|
1256
|
+
try {
|
|
1257
|
+
var definition = _ref3.definition,
|
|
1258
|
+
fields = _ref3.fields,
|
|
1259
|
+
renderer = _ref3.renderer,
|
|
1260
|
+
options = _ref3.options,
|
|
1261
|
+
control = _ref3.control,
|
|
1262
|
+
parentPath = _ref3.parentPath;
|
|
1263
|
+
var Render = useControlRenderer(definition, fields, renderer, options);
|
|
1264
|
+
return /*#__PURE__*/React__default["default"].createElement(Render, {
|
|
1265
|
+
control: control,
|
|
1266
|
+
parentPath: parentPath
|
|
1267
|
+
});
|
|
1268
|
+
} finally {
|
|
1269
|
+
_effect();
|
|
1162
1270
|
}
|
|
1271
|
+
}
|
|
1272
|
+
function groupProps(definition, renderChild, data, className, style) {
|
|
1273
|
+
var _definition$children, _definition$groupOpti;
|
|
1163
1274
|
return {
|
|
1164
|
-
|
|
1165
|
-
renderChild:
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
parentPath: data.path
|
|
1169
|
-
});
|
|
1275
|
+
children: (_definition$children = definition.children) != null ? _definition$children : [],
|
|
1276
|
+
renderChild: renderChild,
|
|
1277
|
+
renderOptions: (_definition$groupOpti = definition.groupOptions) != null ? _definition$groupOpti : {
|
|
1278
|
+
type: "Standard"
|
|
1170
1279
|
},
|
|
1171
|
-
renderOptions: renderOptions,
|
|
1172
1280
|
className: cc(className),
|
|
1173
1281
|
style: style
|
|
1174
1282
|
};
|
|
1175
1283
|
}
|
|
1176
|
-
function defaultDataProps(
|
|
1177
|
-
var _field$options$length, _field$options, _allowedOptions$value, _definition$renderOpt;
|
|
1178
|
-
var definition =
|
|
1179
|
-
field =
|
|
1180
|
-
control =
|
|
1181
|
-
options =
|
|
1182
|
-
elementRenderer =
|
|
1183
|
-
style =
|
|
1184
|
-
allowedOptions =
|
|
1185
|
-
props = _objectWithoutPropertiesLoose(
|
|
1284
|
+
function defaultDataProps(_ref4) {
|
|
1285
|
+
var _field$options$length, _field$options, _allowedOptions$value, _definition$children2, _definition$renderOpt;
|
|
1286
|
+
var definition = _ref4.definition,
|
|
1287
|
+
field = _ref4.field,
|
|
1288
|
+
control = _ref4.control,
|
|
1289
|
+
options = _ref4.options,
|
|
1290
|
+
elementRenderer = _ref4.elementRenderer,
|
|
1291
|
+
style = _ref4.style,
|
|
1292
|
+
allowedOptions = _ref4.allowedOptions,
|
|
1293
|
+
props = _objectWithoutPropertiesLoose(_ref4, _excluded$1);
|
|
1186
1294
|
var className = cc(definition.styleClass);
|
|
1187
1295
|
var required = !!definition.required;
|
|
1188
1296
|
var fieldOptions = ((_field$options$length = (_field$options = field.options) == null ? void 0 : _field$options.length) != null ? _field$options$length : 0) === 0 ? null : field.options;
|
|
1189
1297
|
var allowed = (_allowedOptions$value = allowedOptions == null ? void 0 : allowedOptions.value) != null ? _allowedOptions$value : [];
|
|
1190
1298
|
return _extends({
|
|
1191
|
-
definition:
|
|
1299
|
+
children: (_definition$children2 = definition.children) != null ? _definition$children2 : [],
|
|
1192
1300
|
control: control,
|
|
1193
1301
|
field: field,
|
|
1194
1302
|
id: "c" + control.uniqueId,
|
|
@@ -1243,24 +1351,24 @@ function defaultArrayProps(arrayControl, field, required, style, className, _ren
|
|
|
1243
1351
|
style: style
|
|
1244
1352
|
};
|
|
1245
1353
|
}
|
|
1246
|
-
function renderControlLayout(
|
|
1247
|
-
var c =
|
|
1248
|
-
renderer =
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
allowedOptions =
|
|
1354
|
+
function renderControlLayout(_ref5) {
|
|
1355
|
+
var c = _ref5.definition,
|
|
1356
|
+
renderer = _ref5.renderer,
|
|
1357
|
+
childRenderer = _ref5.renderChild,
|
|
1358
|
+
childControl = _ref5.control,
|
|
1359
|
+
schemaField = _ref5.schemaField,
|
|
1360
|
+
dataContext = _ref5.dataContext,
|
|
1361
|
+
dataOptions = _ref5.formOptions,
|
|
1362
|
+
dataProps = _ref5.createDataProps,
|
|
1363
|
+
displayControl = _ref5.displayControl,
|
|
1364
|
+
style = _ref5.style,
|
|
1365
|
+
labelText = _ref5.labelText,
|
|
1366
|
+
allowedOptions = _ref5.allowedOptions;
|
|
1259
1367
|
if (isDataControlDefinition(c)) {
|
|
1260
1368
|
return renderData(c);
|
|
1261
1369
|
}
|
|
1262
1370
|
if (isGroupControlsDefinition(c)) {
|
|
1263
|
-
var _c$groupOptions2;
|
|
1371
|
+
var _labelText$value, _c$groupOptions2;
|
|
1264
1372
|
if (c.compoundField) {
|
|
1265
1373
|
var _c$groupOptions;
|
|
1266
1374
|
return renderData(dataControl(c.compoundField, c.title, {
|
|
@@ -1269,19 +1377,20 @@ function renderControlLayout(_ref4) {
|
|
|
1269
1377
|
}));
|
|
1270
1378
|
}
|
|
1271
1379
|
return {
|
|
1272
|
-
processLayout: renderer.renderGroup(groupProps(c
|
|
1380
|
+
processLayout: renderer.renderGroup(groupProps(c, childRenderer, dataContext, c.styleClass, style)),
|
|
1273
1381
|
label: {
|
|
1274
|
-
label: c.title,
|
|
1382
|
+
label: (_labelText$value = labelText == null ? void 0 : labelText.value) != null ? _labelText$value : c.title,
|
|
1383
|
+
className: cc(c.labelClass),
|
|
1275
1384
|
type: exports.LabelType.Group,
|
|
1276
1385
|
hide: (_c$groupOptions2 = c.groupOptions) == null ? void 0 : _c$groupOptions2.hideTitle
|
|
1277
1386
|
}
|
|
1278
1387
|
};
|
|
1279
1388
|
}
|
|
1280
1389
|
if (isActionControlsDefinition(c)) {
|
|
1281
|
-
var
|
|
1390
|
+
var _ref6, _labelText$value2;
|
|
1282
1391
|
return {
|
|
1283
1392
|
children: renderer.renderAction({
|
|
1284
|
-
actionText: (
|
|
1393
|
+
actionText: (_ref6 = (_labelText$value2 = labelText == null ? void 0 : labelText.value) != null ? _labelText$value2 : c.title) != null ? _ref6 : c.actionId,
|
|
1285
1394
|
actionId: c.actionId,
|
|
1286
1395
|
onClick: function onClick() {},
|
|
1287
1396
|
className: cc(c.styleClass),
|
|
@@ -1302,6 +1411,7 @@ function renderControlLayout(_ref4) {
|
|
|
1302
1411
|
}
|
|
1303
1412
|
return {};
|
|
1304
1413
|
function renderData(c, elemIndex) {
|
|
1414
|
+
var _labelText$value3;
|
|
1305
1415
|
if (!schemaField) return {
|
|
1306
1416
|
children: "No schema field for: " + c.field
|
|
1307
1417
|
};
|
|
@@ -1317,22 +1427,24 @@ function renderControlLayout(_ref4) {
|
|
|
1317
1427
|
control: elemIndex != null ? childControl.elements[elemIndex] : childControl,
|
|
1318
1428
|
options: dataOptions,
|
|
1319
1429
|
style: style,
|
|
1320
|
-
childCount: childCount,
|
|
1321
1430
|
allowedOptions: allowedOptions,
|
|
1322
|
-
renderChild:
|
|
1431
|
+
renderChild: elemIndex != null ? function (k, d, p) {
|
|
1432
|
+
return childRenderer(k, d, p ? [elemIndex].concat(p) : [elemIndex]);
|
|
1433
|
+
} : childRenderer,
|
|
1323
1434
|
elementRenderer: elemIndex == null && schemaField.collection ? function (ei) {
|
|
1324
1435
|
return renderLayoutParts(renderData(c, ei), renderer).children;
|
|
1325
1436
|
} : undefined
|
|
1326
1437
|
});
|
|
1327
|
-
var
|
|
1438
|
+
var label = !c.hideTitle ? controlTitle((_labelText$value3 = labelText == null ? void 0 : labelText.value) != null ? _labelText$value3 : c.title, schemaField) : undefined;
|
|
1328
1439
|
return {
|
|
1329
1440
|
processLayout: renderer.renderData(props),
|
|
1330
1441
|
label: {
|
|
1331
1442
|
type: exports.LabelType.Control,
|
|
1332
|
-
label:
|
|
1443
|
+
label: label,
|
|
1333
1444
|
forId: props.id,
|
|
1334
1445
|
required: c.required,
|
|
1335
|
-
hide: c.hideTitle
|
|
1446
|
+
hide: c.hideTitle,
|
|
1447
|
+
className: cc(c.labelClass)
|
|
1336
1448
|
},
|
|
1337
1449
|
errorControl: childControl
|
|
1338
1450
|
};
|
|
@@ -1368,13 +1480,13 @@ function wrapMarkupAt(pos, wrap) {
|
|
|
1368
1480
|
}
|
|
1369
1481
|
function renderLayoutParts(props, renderer) {
|
|
1370
1482
|
var _props$processLayout;
|
|
1371
|
-
var
|
|
1372
|
-
className =
|
|
1373
|
-
children =
|
|
1374
|
-
style =
|
|
1375
|
-
errorControl =
|
|
1376
|
-
label =
|
|
1377
|
-
adornments =
|
|
1483
|
+
var _ref7 = (_props$processLayout = props.processLayout == null ? void 0 : props.processLayout(props)) != null ? _props$processLayout : props,
|
|
1484
|
+
className = _ref7.className,
|
|
1485
|
+
children = _ref7.children,
|
|
1486
|
+
style = _ref7.style,
|
|
1487
|
+
errorControl = _ref7.errorControl,
|
|
1488
|
+
label = _ref7.label,
|
|
1489
|
+
adornments = _ref7.adornments;
|
|
1378
1490
|
var layout = {
|
|
1379
1491
|
children: children,
|
|
1380
1492
|
errorControl: errorControl,
|
|
@@ -1524,12 +1636,13 @@ function createDefaultLabelRenderer(options) {
|
|
|
1524
1636
|
var _options = options,
|
|
1525
1637
|
className = _options.className,
|
|
1526
1638
|
groupLabelClass = _options.groupLabelClass,
|
|
1639
|
+
controlLabelClass = _options.controlLabelClass,
|
|
1527
1640
|
requiredElement = _options.requiredElement;
|
|
1528
1641
|
return {
|
|
1529
1642
|
render: function render(props, labelStart, labelEnd) {
|
|
1530
1643
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, labelStart, /*#__PURE__*/React__default["default"].createElement("label", {
|
|
1531
1644
|
htmlFor: props.forId,
|
|
1532
|
-
className: clsx__default["default"](className, props.type === exports.LabelType.Group && groupLabelClass)
|
|
1645
|
+
className: rendererClass(props.className, clsx__default["default"](className, props.type === exports.LabelType.Group && groupLabelClass, props.type === exports.LabelType.Control && controlLabelClass))
|
|
1533
1646
|
}, props.label, props.required && requiredElement), labelEnd);
|
|
1534
1647
|
},
|
|
1535
1648
|
type: "label"
|
|
@@ -1609,9 +1722,9 @@ function createDefaultGroupRenderer(options) {
|
|
|
1609
1722
|
};
|
|
1610
1723
|
}
|
|
1611
1724
|
function render(props) {
|
|
1612
|
-
var
|
|
1613
|
-
|
|
1614
|
-
|
|
1725
|
+
var renderChild = props.renderChild,
|
|
1726
|
+
renderOptions = props.renderOptions,
|
|
1727
|
+
children = props.children;
|
|
1615
1728
|
var _ref7 = isGridRenderer(renderOptions) ? gridStyles(renderOptions) : isFlexRenderer(renderOptions) ? flexStyles(renderOptions) : {
|
|
1616
1729
|
className: standardClassName
|
|
1617
1730
|
},
|
|
@@ -1620,12 +1733,10 @@ function createDefaultGroupRenderer(options) {
|
|
|
1620
1733
|
return function (cp) {
|
|
1621
1734
|
return _extends({}, cp, {
|
|
1622
1735
|
children: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1623
|
-
className: clsx__default["default"](
|
|
1736
|
+
className: rendererClass(props.className, clsx__default["default"](className, gcn)),
|
|
1624
1737
|
style: style
|
|
1625
|
-
},
|
|
1626
|
-
|
|
1627
|
-
}, function (_, x) {
|
|
1628
|
-
return renderChild(x);
|
|
1738
|
+
}, children == null ? void 0 : children.map(function (c, i) {
|
|
1739
|
+
return renderChild(i, i);
|
|
1629
1740
|
}))
|
|
1630
1741
|
});
|
|
1631
1742
|
};
|
|
@@ -1659,17 +1770,17 @@ function DefaultDisplay(_ref8) {
|
|
|
1659
1770
|
case exports.DisplayDataType.Icon:
|
|
1660
1771
|
return /*#__PURE__*/React__default["default"].createElement("i", {
|
|
1661
1772
|
style: style,
|
|
1662
|
-
className: clsx__default["default"](className, display ? display.value : data.iconClass)
|
|
1773
|
+
className: clsx__default["default"](getOverrideClass(className), display ? display.value : data.iconClass)
|
|
1663
1774
|
});
|
|
1664
1775
|
case exports.DisplayDataType.Text:
|
|
1665
1776
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1666
1777
|
style: style,
|
|
1667
|
-
className:
|
|
1778
|
+
className: rendererClass(className, options.textClassName)
|
|
1668
1779
|
}, display ? display.value : data.text);
|
|
1669
1780
|
case exports.DisplayDataType.Html:
|
|
1670
1781
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1671
1782
|
style: style,
|
|
1672
|
-
className:
|
|
1783
|
+
className: rendererClass(className, options.htmlClassName),
|
|
1673
1784
|
dangerouslySetInnerHTML: {
|
|
1674
1785
|
__html: display ? (_display$value = display.value) != null ? _display$value : "" : data.html
|
|
1675
1786
|
}
|
|
@@ -1715,17 +1826,12 @@ function createDefaultDataRenderer(options) {
|
|
|
1715
1826
|
return renderers.renderGroup({
|
|
1716
1827
|
style: props.style,
|
|
1717
1828
|
className: props.className,
|
|
1829
|
+
children: props.children,
|
|
1718
1830
|
renderOptions: {
|
|
1719
1831
|
type: "Standard",
|
|
1720
1832
|
hideTitle: true
|
|
1721
1833
|
},
|
|
1722
|
-
renderChild:
|
|
1723
|
-
return props.renderChild(i, i, {
|
|
1724
|
-
control: props.dataContext.data,
|
|
1725
|
-
parentPath: props.dataContext.path
|
|
1726
|
-
});
|
|
1727
|
-
},
|
|
1728
|
-
childCount: props.childCount
|
|
1834
|
+
renderChild: props.renderChild
|
|
1729
1835
|
});
|
|
1730
1836
|
}
|
|
1731
1837
|
var renderOptions = props.renderOptions;
|
|
@@ -1762,7 +1868,7 @@ function createDefaultDataRenderer(options) {
|
|
|
1762
1868
|
className: props.className,
|
|
1763
1869
|
control: props.control
|
|
1764
1870
|
}) : /*#__PURE__*/React__default["default"].createElement(ControlInput, {
|
|
1765
|
-
className:
|
|
1871
|
+
className: rendererClass(props.className, inputClass),
|
|
1766
1872
|
style: props.style,
|
|
1767
1873
|
id: props.id,
|
|
1768
1874
|
readOnly: props.readonly,
|
|
@@ -1785,7 +1891,7 @@ function DefaultDisplayOnly(_ref9) {
|
|
|
1785
1891
|
var text = (_ref10 = schemaInterface.isEmptyValue(field, v) ? emptyText : schemaInterface.textValue(field, v)) != null ? _ref10 : "";
|
|
1786
1892
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1787
1893
|
style: style,
|
|
1788
|
-
className: className
|
|
1894
|
+
className: rendererClass(className)
|
|
1789
1895
|
}, text);
|
|
1790
1896
|
} finally {
|
|
1791
1897
|
_effect2();
|
|
@@ -1855,7 +1961,7 @@ function createDefaultLayoutRenderer(options) {
|
|
|
1855
1961
|
}
|
|
1856
1962
|
return createLayoutRenderer(function (props, renderers) {
|
|
1857
1963
|
var layout = renderLayoutParts(_extends({}, props, {
|
|
1858
|
-
className:
|
|
1964
|
+
className: rendererClass(props.className, options.className)
|
|
1859
1965
|
}), renderers);
|
|
1860
1966
|
return {
|
|
1861
1967
|
children: /*#__PURE__*/React__default["default"].createElement(DefaultLayout, _extends({
|
|
@@ -1968,7 +2074,7 @@ function createSelectRenderer(options) {
|
|
|
1968
2074
|
}
|
|
1969
2075
|
return createDataRenderer(function (props, asArray) {
|
|
1970
2076
|
return /*#__PURE__*/React__default["default"].createElement(SelectDataRenderer, {
|
|
1971
|
-
className:
|
|
2077
|
+
className: rendererClass(props.className, options.className),
|
|
1972
2078
|
state: props.control,
|
|
1973
2079
|
id: props.id,
|
|
1974
2080
|
options: props.options,
|
|
@@ -2116,7 +2222,6 @@ function DefaultLayout(_ref15) {
|
|
|
2116
2222
|
var _effect6 = core.useComponentTracking();
|
|
2117
2223
|
try {
|
|
2118
2224
|
var errorClass = _ref15.errorClass,
|
|
2119
|
-
className = _ref15.className,
|
|
2120
2225
|
_ref15$layout = _ref15.layout,
|
|
2121
2226
|
controlEnd = _ref15$layout.controlEnd,
|
|
2122
2227
|
controlStart = _ref15$layout.controlStart,
|
|
@@ -2164,6 +2269,7 @@ var defaultTailwindTheme = {
|
|
|
2164
2269
|
|
|
2165
2270
|
exports.AppendAdornmentPriority = AppendAdornmentPriority;
|
|
2166
2271
|
exports.ControlInput = ControlInput;
|
|
2272
|
+
exports.ControlRenderer = ControlRenderer;
|
|
2167
2273
|
exports.DefaultBoolOptions = DefaultBoolOptions;
|
|
2168
2274
|
exports.DefaultDisplay = DefaultDisplay;
|
|
2169
2275
|
exports.DefaultDisplayOnly = DefaultDisplayOnly;
|
|
@@ -2171,6 +2277,7 @@ exports.DefaultLayout = DefaultLayout;
|
|
|
2171
2277
|
exports.DefaultVisibility = DefaultVisibility;
|
|
2172
2278
|
exports.SelectDataRenderer = SelectDataRenderer;
|
|
2173
2279
|
exports.WrapAdornmentPriority = WrapAdornmentPriority;
|
|
2280
|
+
exports.addCustomDataRenderOptions = addCustomDataRenderOptions;
|
|
2174
2281
|
exports.addMissingControls = addMissingControls;
|
|
2175
2282
|
exports.appendMarkup = appendMarkup;
|
|
2176
2283
|
exports.appendMarkupAt = appendMarkupAt;
|
|
@@ -2225,12 +2332,14 @@ exports.emptyGroupDefinition = emptyGroupDefinition;
|
|
|
2225
2332
|
exports.fieldDisplayName = fieldDisplayName;
|
|
2226
2333
|
exports.fieldEqExpr = fieldEqExpr;
|
|
2227
2334
|
exports.fieldHasTag = fieldHasTag;
|
|
2335
|
+
exports.findChildDefinition = findChildDefinition;
|
|
2228
2336
|
exports.findCompoundField = findCompoundField;
|
|
2229
2337
|
exports.findField = findField;
|
|
2230
2338
|
exports.findScalarField = findScalarField;
|
|
2231
2339
|
exports.getAllReferencedClasses = getAllReferencedClasses;
|
|
2232
2340
|
exports.getControlData = getControlData;
|
|
2233
2341
|
exports.getDisplayOnlyOptions = getDisplayOnlyOptions;
|
|
2342
|
+
exports.getOverrideClass = getOverrideClass;
|
|
2234
2343
|
exports.getTypeField = getTypeField;
|
|
2235
2344
|
exports.groupedControl = groupedControl;
|
|
2236
2345
|
exports.hasOptions = hasOptions;
|
|
@@ -2259,8 +2368,10 @@ exports.makeCompoundField = makeCompoundField;
|
|
|
2259
2368
|
exports.makeEvalExpressionHook = makeEvalExpressionHook;
|
|
2260
2369
|
exports.makeScalarField = makeScalarField;
|
|
2261
2370
|
exports.matchesType = matchesType;
|
|
2371
|
+
exports.mergeField = mergeField;
|
|
2262
2372
|
exports.renderControlLayout = renderControlLayout;
|
|
2263
2373
|
exports.renderLayoutParts = renderLayoutParts;
|
|
2374
|
+
exports.rendererClass = rendererClass;
|
|
2264
2375
|
exports.stringField = stringField;
|
|
2265
2376
|
exports.stringOptionsField = stringOptionsField;
|
|
2266
2377
|
exports.textDisplayControl = textDisplayControl;
|
|
@@ -2271,6 +2382,7 @@ exports.useEvalDefaultValueHook = useEvalDefaultValueHook;
|
|
|
2271
2382
|
exports.useEvalDisabledHook = useEvalDisabledHook;
|
|
2272
2383
|
exports.useEvalDisplayHook = useEvalDisplayHook;
|
|
2273
2384
|
exports.useEvalDynamicHook = useEvalDynamicHook;
|
|
2385
|
+
exports.useEvalLabelText = useEvalLabelText;
|
|
2274
2386
|
exports.useEvalReadonlyHook = useEvalReadonlyHook;
|
|
2275
2387
|
exports.useEvalStyleHook = useEvalStyleHook;
|
|
2276
2388
|
exports.useEvalVisibilityHook = useEvalVisibilityHook;
|