@crowdin/app-project-module 1.13.2 → 1.14.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/out/index.js +2 -0
- package/out/modules/chat/index.d.ts +6 -0
- package/out/modules/chat/index.js +21 -0
- package/out/modules/integration/util/defaults.js +6 -0
- package/out/modules/manifest.js +7 -0
- package/out/static/ui/form.bundle.js +606 -266
- package/out/static/ui/form.bundle.js.map +1 -1
- package/out/types.d.ts +6 -0
- package/package.json +2 -2
|
@@ -25847,14 +25847,14 @@ export default theme;`;
|
|
|
25847
25847
|
return a === b ? a : `^(?=.*(?:${a}))(?=.*(?:${b})).*$`;
|
|
25848
25848
|
}
|
|
25849
25849
|
|
|
25850
|
-
function
|
|
25850
|
+
function createPairCombinations(l, r, action) {
|
|
25851
25851
|
const ll = l.length;
|
|
25852
25852
|
const rl = r.length;
|
|
25853
25853
|
if (ll > 0 && rl > 0) {
|
|
25854
25854
|
for (let i = 0; i < ll; i++) {
|
|
25855
25855
|
const lv = l[i];
|
|
25856
25856
|
for (let j = 0; j < rl; j++) {
|
|
25857
|
-
|
|
25857
|
+
action(lv, r[j]);
|
|
25858
25858
|
}
|
|
25859
25859
|
}
|
|
25860
25860
|
}
|
|
@@ -26131,7 +26131,7 @@ export default theme;`;
|
|
|
26131
26131
|
let patterns = {};
|
|
26132
26132
|
const matchedPatterns = new Set();
|
|
26133
26133
|
if (lPatternKeys.length > 0 && rPatternKeys.length > 0) {
|
|
26134
|
-
|
|
26134
|
+
createPairCombinations(lPatternKeys, rPatternKeys, (lKey, rKey) => {
|
|
26135
26135
|
if (isSubRegExp(lKey, rKey)) {
|
|
26136
26136
|
matchedPatterns.add(lKey);
|
|
26137
26137
|
}
|
|
@@ -26140,9 +26140,6 @@ export default theme;`;
|
|
|
26140
26140
|
}
|
|
26141
26141
|
patterns[mergePatterns(lKey, rKey)] = mergeSchemaDefinitions(lPatterns[lKey], rPatterns[rKey]);
|
|
26142
26142
|
});
|
|
26143
|
-
while (!gen.next().done) {
|
|
26144
|
-
/* empty */
|
|
26145
|
-
}
|
|
26146
26143
|
}
|
|
26147
26144
|
patterns = assignPatternPropertiesAndAdditionalPropertiesMerge(patterns, lPatterns, lPatternKeys, matchedPatterns, rAdditional, isRAddTruthy);
|
|
26148
26145
|
patterns = assignPatternPropertiesAndAdditionalPropertiesMerge(patterns, rPatterns, rPatternKeys, matchedPatterns, lAdditional, isLAddTruthy);
|
|
@@ -26206,7 +26203,17 @@ export default theme;`;
|
|
|
26206
26203
|
return target;
|
|
26207
26204
|
};
|
|
26208
26205
|
function mergeArraysOfSchemaDefinition(l, r) {
|
|
26209
|
-
|
|
26206
|
+
const definitions = [];
|
|
26207
|
+
createPairCombinations(l, r, (a, b) => {
|
|
26208
|
+
try {
|
|
26209
|
+
definitions.push(mergeSchemaDefinitions(a, b));
|
|
26210
|
+
}
|
|
26211
|
+
catch { }
|
|
26212
|
+
});
|
|
26213
|
+
if (definitions.length === 0) {
|
|
26214
|
+
throw new Error(`No valid schema combinations could be produced for "${JSON.stringify(l)}" and "${JSON.stringify(r)}"; the merged result is empty`);
|
|
26215
|
+
}
|
|
26216
|
+
return deduplicateJsonSchemaDef(definitions);
|
|
26210
26217
|
}
|
|
26211
26218
|
const ASSIGNERS_MAP = createMap([
|
|
26212
26219
|
[PROPERTIES_ASSIGNER_KEYS, propertiesAssigner],
|
|
@@ -26295,11 +26302,12 @@ export default theme;`;
|
|
|
26295
26302
|
else if (isAArr || isBArr) {
|
|
26296
26303
|
const r = new Set();
|
|
26297
26304
|
if (isAArr && isBArr) {
|
|
26298
|
-
|
|
26299
|
-
|
|
26300
|
-
|
|
26305
|
+
createPairCombinations(a, b, (x, y) => {
|
|
26306
|
+
const type = intersectSchemaTypes(x, y);
|
|
26307
|
+
if (type !== undefined) {
|
|
26308
|
+
r.add(type);
|
|
26301
26309
|
}
|
|
26302
|
-
}
|
|
26310
|
+
});
|
|
26303
26311
|
}
|
|
26304
26312
|
else {
|
|
26305
26313
|
const arr = (isAArr ? a : b);
|
|
@@ -31286,6 +31294,67 @@ export default theme;`;
|
|
|
31286
31294
|
return replaceStringParameters(stringToTranslate, params);
|
|
31287
31295
|
}
|
|
31288
31296
|
|
|
31297
|
+
/** Determines whether the given `value` is (one of) the `selected` value(s).
|
|
31298
|
+
*
|
|
31299
|
+
* @param value - The value being checked to see if it is selected
|
|
31300
|
+
* @param selected - The current selected value or list of values
|
|
31301
|
+
* @returns - true if the `value` is one of the `selected` ones, false otherwise
|
|
31302
|
+
*/
|
|
31303
|
+
function enumOptionsIsSelected(value, selected) {
|
|
31304
|
+
if (Array.isArray(selected)) {
|
|
31305
|
+
return selected.some((sel) => deepEquals(sel, value));
|
|
31306
|
+
}
|
|
31307
|
+
return deepEquals(selected, value);
|
|
31308
|
+
}
|
|
31309
|
+
|
|
31310
|
+
/** Returns the index(es) of the options in `allEnumOptions` whose value(s) match the ones in `value`. All the
|
|
31311
|
+
* `enumOptions` are filtered based on whether they are a "selected" `value` and the index of each selected one is then
|
|
31312
|
+
* stored in an array. If `multiple` is true, that array is returned, otherwise the first element in the array is
|
|
31313
|
+
* returned.
|
|
31314
|
+
*
|
|
31315
|
+
* @param value - The single value or list of values for which indexes are desired
|
|
31316
|
+
* @param [allEnumOptions=[]] - The list of all the known enumOptions
|
|
31317
|
+
* @param [multiple=false] - Optional flag, if true will return a list of index, otherwise a single one
|
|
31318
|
+
* @returns - A single string index for the first `value` in `allEnumOptions`, if not `multiple`. Otherwise, the list
|
|
31319
|
+
* of indexes for (each of) the value(s) in `value`.
|
|
31320
|
+
*/
|
|
31321
|
+
function enumOptionsIndexForValue(value, allEnumOptions = [], multiple = false) {
|
|
31322
|
+
const selectedIndexes = allEnumOptions
|
|
31323
|
+
.map((opt, index) => (enumOptionsIsSelected(opt.value, value) ? String(index) : undefined))
|
|
31324
|
+
.filter((opt) => typeof opt !== 'undefined');
|
|
31325
|
+
if (!multiple) {
|
|
31326
|
+
return selectedIndexes[0];
|
|
31327
|
+
}
|
|
31328
|
+
return selectedIndexes;
|
|
31329
|
+
}
|
|
31330
|
+
|
|
31331
|
+
/** Computes the value to pass to a select element's `value` attribute.
|
|
31332
|
+
*
|
|
31333
|
+
* When `format` is `'realValue'`, converts form data values to strings.
|
|
31334
|
+
* When `format` is `'indexed'` (the default), resolves to index-based values via
|
|
31335
|
+
* `enumOptionsIndexForValue`. Returns `emptyValue` when the current value is empty.
|
|
31336
|
+
*
|
|
31337
|
+
* @param value - The current form data value
|
|
31338
|
+
* @param enumOptions - The available enum options
|
|
31339
|
+
* @param multiple - Whether the select allows multiple selections
|
|
31340
|
+
* @param [format='indexed'] - How option values are encoded on the DOM
|
|
31341
|
+
* @param emptyValue - The value to return when the selection is empty
|
|
31342
|
+
* @returns The value to use for the select element's `value` attribute
|
|
31343
|
+
*/
|
|
31344
|
+
function enumOptionSelectedValue(value, enumOptions, multiple, format = 'indexed', emptyValue) {
|
|
31345
|
+
const isEmpty = typeof value === 'undefined' ||
|
|
31346
|
+
(multiple && Array.isArray(value) && value.length < 1) ||
|
|
31347
|
+
(!multiple && value === emptyValue);
|
|
31348
|
+
if (isEmpty) {
|
|
31349
|
+
return emptyValue;
|
|
31350
|
+
}
|
|
31351
|
+
if (format === 'realValue') {
|
|
31352
|
+
return multiple ? value.map(String) : String(value);
|
|
31353
|
+
}
|
|
31354
|
+
const indexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
31355
|
+
return typeof indexes === 'undefined' ? emptyValue : indexes;
|
|
31356
|
+
}
|
|
31357
|
+
|
|
31289
31358
|
/** Returns the value(s) from `allEnumOptions` at the index(es) provided by `valueIndex`. If `valueIndex` is not an
|
|
31290
31359
|
* array AND the index is not valid for `allEnumOptions`, `emptyValue` is returned. If `valueIndex` is an array, AND it
|
|
31291
31360
|
* contains an invalid index, the returned array will have the resulting undefined values filtered out, leaving only
|
|
@@ -31310,6 +31379,84 @@ export default theme;`;
|
|
|
31310
31379
|
return option ? option.value : emptyValue;
|
|
31311
31380
|
}
|
|
31312
31381
|
|
|
31382
|
+
/** Resolves a single DOM value string back to its typed enum value in `'realValue'` mode.
|
|
31383
|
+
*
|
|
31384
|
+
* First attempts a reverse lookup by matching `String(opt.value)` against the input.
|
|
31385
|
+
* If no option matches and the input parses as a valid index, falls back to the
|
|
31386
|
+
* option at that index — this is how object/array enum values round-trip, since
|
|
31387
|
+
* they are encoded as indices by the encoder.
|
|
31388
|
+
*
|
|
31389
|
+
* @param value - A single string value from a DOM attribute
|
|
31390
|
+
* @param enumOptions - The available enum options
|
|
31391
|
+
* @param emptyValue - The value to return when the input is empty, options are missing, or no match is found
|
|
31392
|
+
* @returns The original typed enum value, or `emptyValue`
|
|
31393
|
+
*/
|
|
31394
|
+
function decodeSingle(value, enumOptions, emptyValue) {
|
|
31395
|
+
if (value === '' || !Array.isArray(enumOptions)) {
|
|
31396
|
+
return emptyValue;
|
|
31397
|
+
}
|
|
31398
|
+
const match = enumOptions.find((opt) => String(opt.value) === value);
|
|
31399
|
+
if (match) {
|
|
31400
|
+
return match.value;
|
|
31401
|
+
}
|
|
31402
|
+
// Fallback: value might be an index (for object/array enum values)
|
|
31403
|
+
const index = Number(value);
|
|
31404
|
+
if (!isNaN(index) && index >= 0 && index < enumOptions.length) {
|
|
31405
|
+
return enumOptions[index].value;
|
|
31406
|
+
}
|
|
31407
|
+
return emptyValue;
|
|
31408
|
+
}
|
|
31409
|
+
/** Decodes a string from a DOM value attribute back to a typed enum value.
|
|
31410
|
+
*
|
|
31411
|
+
* When `format` is `'realValue'`, does a reverse lookup: finds the enum option
|
|
31412
|
+
* whose `String(value)` matches the input string and returns the original typed value.
|
|
31413
|
+
* For object/array values that were encoded as indices, falls back to index resolution.
|
|
31414
|
+
*
|
|
31415
|
+
* When `format` is `'indexed'` (the default), uses index-based resolution via
|
|
31416
|
+
* `enumOptionsValueForIndex`.
|
|
31417
|
+
*
|
|
31418
|
+
* @param value - The string value(s) from the DOM
|
|
31419
|
+
* @param enumOptions - The available enum options
|
|
31420
|
+
* @param [format='indexed'] - How the values were encoded on the DOM
|
|
31421
|
+
* @param emptyValue - The value to return for empty/missing selections
|
|
31422
|
+
* @returns The original typed enum value(s)
|
|
31423
|
+
*/
|
|
31424
|
+
function enumOptionValueDecoder(value, enumOptions, format = 'indexed', emptyValue) {
|
|
31425
|
+
if (format !== 'realValue') {
|
|
31426
|
+
return enumOptionsValueForIndex(value, enumOptions, emptyValue);
|
|
31427
|
+
}
|
|
31428
|
+
if (Array.isArray(value)) {
|
|
31429
|
+
return value.map((v) => decodeSingle(v, enumOptions, emptyValue));
|
|
31430
|
+
}
|
|
31431
|
+
return decodeSingle(value, enumOptions, emptyValue);
|
|
31432
|
+
}
|
|
31433
|
+
|
|
31434
|
+
/** Encodes an enum option value into a string for a DOM value attribute.
|
|
31435
|
+
*
|
|
31436
|
+
* When `format` is `'realValue'`, primitive values are converted via `String()`.
|
|
31437
|
+
* Non-primitive values (objects, arrays) fall back to the index since
|
|
31438
|
+
* `String()` would produce `"[object Object]"`.
|
|
31439
|
+
*
|
|
31440
|
+
* When `format` is `'indexed'` (the default), returns the index as a string.
|
|
31441
|
+
*
|
|
31442
|
+
* @param value - The typed enum value
|
|
31443
|
+
* @param index - The option's position in the enumOptions array
|
|
31444
|
+
* @param [format='indexed'] - How to encode the value for the DOM attribute
|
|
31445
|
+
* @returns The string to use as the DOM value attribute
|
|
31446
|
+
*/
|
|
31447
|
+
function enumOptionValueEncoder(value, index, format = 'indexed') {
|
|
31448
|
+
if (format !== 'realValue') {
|
|
31449
|
+
return String(index);
|
|
31450
|
+
}
|
|
31451
|
+
if (isNil(value)) {
|
|
31452
|
+
return '';
|
|
31453
|
+
}
|
|
31454
|
+
if (typeof value === 'object') {
|
|
31455
|
+
return String(index);
|
|
31456
|
+
}
|
|
31457
|
+
return String(value);
|
|
31458
|
+
}
|
|
31459
|
+
|
|
31313
31460
|
/** Removes the enum option value at the `valueIndex` from the currently `selected` (list of) value(s). If `selected` is
|
|
31314
31461
|
* a list, then that list is updated to remove the enum option value with the `valueIndex` in `allEnumOptions`. If it is
|
|
31315
31462
|
* a single value, then if the enum option value with the `valueIndex` in `allEnumOptions` matches `selected`, undefined
|
|
@@ -31330,40 +31477,6 @@ export default theme;`;
|
|
|
31330
31477
|
return deepEquals(value, selected) ? undefined : selected;
|
|
31331
31478
|
}
|
|
31332
31479
|
|
|
31333
|
-
/** Determines whether the given `value` is (one of) the `selected` value(s).
|
|
31334
|
-
*
|
|
31335
|
-
* @param value - The value being checked to see if it is selected
|
|
31336
|
-
* @param selected - The current selected value or list of values
|
|
31337
|
-
* @returns - true if the `value` is one of the `selected` ones, false otherwise
|
|
31338
|
-
*/
|
|
31339
|
-
function enumOptionsIsSelected(value, selected) {
|
|
31340
|
-
if (Array.isArray(selected)) {
|
|
31341
|
-
return selected.some((sel) => deepEquals(sel, value));
|
|
31342
|
-
}
|
|
31343
|
-
return deepEquals(selected, value);
|
|
31344
|
-
}
|
|
31345
|
-
|
|
31346
|
-
/** Returns the index(es) of the options in `allEnumOptions` whose value(s) match the ones in `value`. All the
|
|
31347
|
-
* `enumOptions` are filtered based on whether they are a "selected" `value` and the index of each selected one is then
|
|
31348
|
-
* stored in an array. If `multiple` is true, that array is returned, otherwise the first element in the array is
|
|
31349
|
-
* returned.
|
|
31350
|
-
*
|
|
31351
|
-
* @param value - The single value or list of values for which indexes are desired
|
|
31352
|
-
* @param [allEnumOptions=[]] - The list of all the known enumOptions
|
|
31353
|
-
* @param [multiple=false] - Optional flag, if true will return a list of index, otherwise a single one
|
|
31354
|
-
* @returns - A single string index for the first `value` in `allEnumOptions`, if not `multiple`. Otherwise, the list
|
|
31355
|
-
* of indexes for (each of) the value(s) in `value`.
|
|
31356
|
-
*/
|
|
31357
|
-
function enumOptionsIndexForValue(value, allEnumOptions = [], multiple = false) {
|
|
31358
|
-
const selectedIndexes = allEnumOptions
|
|
31359
|
-
.map((opt, index) => (enumOptionsIsSelected(opt.value, value) ? String(index) : undefined))
|
|
31360
|
-
.filter((opt) => typeof opt !== 'undefined');
|
|
31361
|
-
if (!multiple) {
|
|
31362
|
-
return selectedIndexes[0];
|
|
31363
|
-
}
|
|
31364
|
-
return selectedIndexes;
|
|
31365
|
-
}
|
|
31366
|
-
|
|
31367
31480
|
/** Add the enum option value at the `valueIndex` to the list of `selected` values in the proper order as defined by
|
|
31368
31481
|
* `allEnumOptions`
|
|
31369
31482
|
*
|
|
@@ -31774,6 +31887,15 @@ export default theme;`;
|
|
|
31774
31887
|
}
|
|
31775
31888
|
}
|
|
31776
31889
|
}
|
|
31890
|
+
// For date/time input types, propagate formatMinimum/formatMaximum to min/max
|
|
31891
|
+
if (['date', 'datetime-local', 'time', 'week', 'month'].includes(inputProps.type)) {
|
|
31892
|
+
if (schema.formatMinimum !== undefined) {
|
|
31893
|
+
inputProps.min = schema.formatMinimum;
|
|
31894
|
+
}
|
|
31895
|
+
if (schema.formatMaximum !== undefined) {
|
|
31896
|
+
inputProps.max = schema.formatMaximum;
|
|
31897
|
+
}
|
|
31898
|
+
}
|
|
31777
31899
|
if (options.autocomplete) {
|
|
31778
31900
|
inputProps.autoComplete = options.autocomplete;
|
|
31779
31901
|
}
|
|
@@ -31783,6 +31905,23 @@ export default theme;`;
|
|
|
31783
31905
|
return inputProps;
|
|
31784
31906
|
}
|
|
31785
31907
|
|
|
31908
|
+
/** Resolves the effective `optionValueFormat` for enum-backed widgets.
|
|
31909
|
+
*
|
|
31910
|
+
* Provides a single source of truth for the default DOM encoding format
|
|
31911
|
+
* (`'indexed'`) used by `SelectWidget`, `RadioWidget`, and `CheckboxesWidget`.
|
|
31912
|
+
* Widgets should call this helper once and pass the result to
|
|
31913
|
+
* `enumOptionValueEncoder`, `enumOptionValueDecoder`, and `enumOptionSelectedValue`
|
|
31914
|
+
* rather than reading `options.optionValueFormat` directly.
|
|
31915
|
+
*
|
|
31916
|
+
* @param options - The widget options (typically from the `options` prop, already
|
|
31917
|
+
* resolved from `ui:options` and `ui:globalOptions`)
|
|
31918
|
+
* @returns The resolved `OptionValueFormat`, defaulting to `'indexed'` when not set
|
|
31919
|
+
*/
|
|
31920
|
+
function getOptionValueFormat(options) {
|
|
31921
|
+
var _a;
|
|
31922
|
+
return (_a = options === null || options === void 0 ? void 0 : options.optionValueFormat) !== null && _a !== void 0 ? _a : 'indexed';
|
|
31923
|
+
}
|
|
31924
|
+
|
|
31786
31925
|
/** The default submit button options, exported for testing purposes
|
|
31787
31926
|
*/
|
|
31788
31927
|
const DEFAULT_OPTIONS = {
|
|
@@ -32264,6 +32403,111 @@ export default theme;`;
|
|
|
32264
32403
|
return get(regOrFc, [...lookupPath, toLookup], fallback);
|
|
32265
32404
|
}
|
|
32266
32405
|
|
|
32406
|
+
/** Determines whether a value is considered "empty" for the purposes of optional object pruning.
|
|
32407
|
+
* A value is empty if it is `undefined`, `null`, an empty string, or an object where all own
|
|
32408
|
+
* properties are themselves empty.
|
|
32409
|
+
*
|
|
32410
|
+
* @param value - The value to check
|
|
32411
|
+
* @returns True if the value is considered empty
|
|
32412
|
+
*/
|
|
32413
|
+
function isValueEmpty(value) {
|
|
32414
|
+
if (isNil(value) || value === '') {
|
|
32415
|
+
return true;
|
|
32416
|
+
}
|
|
32417
|
+
if (Array.isArray(value)) {
|
|
32418
|
+
// An empty array is considered empty; a non-empty array is not
|
|
32419
|
+
return value.length === 0;
|
|
32420
|
+
}
|
|
32421
|
+
if (isObject$3(value)) {
|
|
32422
|
+
const obj = value;
|
|
32423
|
+
const keys = Object.keys(obj);
|
|
32424
|
+
return keys.every((key) => isValueEmpty(obj[key]));
|
|
32425
|
+
}
|
|
32426
|
+
return false;
|
|
32427
|
+
}
|
|
32428
|
+
/** Recursively removes optional objects from the `formData` that are empty (i.e., all their fields
|
|
32429
|
+
* are undefined, null, empty strings, or themselves empty optional objects). This solves the problem
|
|
32430
|
+
* where interacting with fields inside an optional object "activates" it permanently, making the
|
|
32431
|
+
* form unsubmittable when the optional object has required inner fields.
|
|
32432
|
+
*
|
|
32433
|
+
* An object property is considered "optional" when it is NOT listed in its parent schema's `required`
|
|
32434
|
+
* array.
|
|
32435
|
+
*
|
|
32436
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
32437
|
+
* @param schema - The JSON schema describing the `formData`
|
|
32438
|
+
* @param [rootSchema] - The root schema, used primarily to look up `$ref`s
|
|
32439
|
+
* @param [formData] - The current form data to prune
|
|
32440
|
+
* @returns - A new copy of `formData` with empty optional objects removed, or `undefined` if the
|
|
32441
|
+
* entire formData was pruned
|
|
32442
|
+
*/
|
|
32443
|
+
function removeOptionalEmptyObjects(validator, schema, rootSchema, formData) {
|
|
32444
|
+
if (!isObject$3(schema)) {
|
|
32445
|
+
return formData;
|
|
32446
|
+
}
|
|
32447
|
+
const resolvedSchema = retrieveSchema(validator, schema, rootSchema, formData);
|
|
32448
|
+
if (Array.isArray(formData)) {
|
|
32449
|
+
const itemsSchema = resolvedSchema.items;
|
|
32450
|
+
if (!itemsSchema) {
|
|
32451
|
+
return formData;
|
|
32452
|
+
}
|
|
32453
|
+
let hasChanges = false;
|
|
32454
|
+
const mapped = formData.map((item, index) => {
|
|
32455
|
+
let itemSchema = itemsSchema;
|
|
32456
|
+
if (Array.isArray(itemsSchema)) {
|
|
32457
|
+
itemSchema = itemsSchema[index] || resolvedSchema.additionalItems || {};
|
|
32458
|
+
}
|
|
32459
|
+
const cleaned = removeOptionalEmptyObjects(validator, itemSchema, rootSchema, item);
|
|
32460
|
+
if (cleaned !== item) {
|
|
32461
|
+
hasChanges = true;
|
|
32462
|
+
}
|
|
32463
|
+
return cleaned === undefined ? {} : cleaned;
|
|
32464
|
+
});
|
|
32465
|
+
// Although T is an array type here, we still need to cast it back to T since TS
|
|
32466
|
+
// doesn't narrow the generic T automatically
|
|
32467
|
+
return hasChanges ? mapped : formData;
|
|
32468
|
+
}
|
|
32469
|
+
const { properties, required: requiredFields = [] } = resolvedSchema;
|
|
32470
|
+
if (!isObject$3(formData) || !properties) {
|
|
32471
|
+
return formData;
|
|
32472
|
+
}
|
|
32473
|
+
const result = {};
|
|
32474
|
+
const data = formData;
|
|
32475
|
+
let hasAnyValue = false;
|
|
32476
|
+
for (const key of Object.keys(data)) {
|
|
32477
|
+
const value = data[key];
|
|
32478
|
+
const propertySchema = (properties[key] || {});
|
|
32479
|
+
const isRequired = requiredFields.includes(key);
|
|
32480
|
+
const isObj = isObject$3(value);
|
|
32481
|
+
const isArr = Array.isArray(value);
|
|
32482
|
+
if ((isObj || isArr) && properties[key]) {
|
|
32483
|
+
// Recursively process nested objects and arrays
|
|
32484
|
+
const cleaned = removeOptionalEmptyObjects(validator, propertySchema, rootSchema, value);
|
|
32485
|
+
if (!isRequired && isValueEmpty(cleaned)) {
|
|
32486
|
+
// This is an optional property and the cleaned result is empty — omit it
|
|
32487
|
+
continue;
|
|
32488
|
+
}
|
|
32489
|
+
result[key] = cleaned;
|
|
32490
|
+
hasAnyValue = true;
|
|
32491
|
+
}
|
|
32492
|
+
else if (!isRequired && isValueEmpty(value) && properties[key]) {
|
|
32493
|
+
// Optional scalar property that is empty — omit it
|
|
32494
|
+
continue;
|
|
32495
|
+
}
|
|
32496
|
+
else {
|
|
32497
|
+
result[key] = value;
|
|
32498
|
+
if (!isValueEmpty(value)) {
|
|
32499
|
+
hasAnyValue = true;
|
|
32500
|
+
}
|
|
32501
|
+
}
|
|
32502
|
+
}
|
|
32503
|
+
// If the entire object ended up empty after pruning, return undefined so that the
|
|
32504
|
+
// caller (which may itself be a recursive call) can decide whether to keep or drop it
|
|
32505
|
+
if (!hasAnyValue && Object.keys(result).length === 0) {
|
|
32506
|
+
return undefined;
|
|
32507
|
+
}
|
|
32508
|
+
return result;
|
|
32509
|
+
}
|
|
32510
|
+
|
|
32267
32511
|
/** Given a list of `properties` and an `order` list, returns a list that contains the `properties` ordered correctly.
|
|
32268
32512
|
* If `order` is not an array, then the untouched `properties` list is returned. Otherwise `properties` is ordered per
|
|
32269
32513
|
* the `order` list. If `order` contains a '*' then any `properties` that are not mentioned explicity in `order` will be
|
|
@@ -32334,104 +32578,18 @@ export default theme;`;
|
|
|
32334
32578
|
};
|
|
32335
32579
|
}
|
|
32336
32580
|
|
|
32337
|
-
// Keywords where child schemas map to uiSchema at the SAME key
|
|
32338
|
-
const SAME_KEY_KEYWORDS = [ITEMS_KEY, ADDITIONAL_PROPERTIES_KEY];
|
|
32339
|
-
// Keywords where child schemas are in an array, each mapping to uiSchema[keyword][i]
|
|
32340
|
-
const ARRAY_KEYWORDS = [ONE_OF_KEY, ANY_OF_KEY, ALL_OF_KEY];
|
|
32341
|
-
/** Expands `ui:definitions` into the uiSchema by walking the schema tree and finding all `$ref`s.
|
|
32342
|
-
* Called once at form initialization to pre-expand definitions into the uiSchema structure.
|
|
32343
|
-
*
|
|
32344
|
-
* For recursive schemas, expansion stops at recursion points to avoid infinite loops.
|
|
32345
|
-
* Runtime resolution via `resolveUiSchema` handles these cases using registry definitions.
|
|
32346
|
-
*
|
|
32347
|
-
* @param currentSchema - The current schema node being processed
|
|
32348
|
-
* @param uiSchema - The uiSchema at the current path
|
|
32349
|
-
* @param registry - The registry containing rootSchema and uiSchemaDefinitions
|
|
32350
|
-
* @param visited - Set of $refs already visited (to detect recursion)
|
|
32351
|
-
* @returns - The expanded uiSchema with definitions merged in
|
|
32352
|
-
*/
|
|
32353
|
-
function expandUiSchemaDefinitions(currentSchema, uiSchema, registry, visited = new Set()) {
|
|
32354
|
-
const { rootSchema, uiSchemaDefinitions: definitions } = registry;
|
|
32355
|
-
let result = { ...uiSchema };
|
|
32356
|
-
let resolvedSchema = currentSchema;
|
|
32357
|
-
const ref = currentSchema[REF_KEY];
|
|
32358
|
-
const isRecursive = ref && visited.has(ref);
|
|
32359
|
-
if (ref) {
|
|
32360
|
-
visited.add(ref);
|
|
32361
|
-
if (definitions && ref in definitions) {
|
|
32362
|
-
result = mergeObjects(definitions[ref], result);
|
|
32363
|
-
}
|
|
32364
|
-
if (isRecursive) {
|
|
32365
|
-
return result;
|
|
32366
|
-
}
|
|
32367
|
-
try {
|
|
32368
|
-
resolvedSchema = findSchemaDefinition(ref, rootSchema);
|
|
32369
|
-
}
|
|
32370
|
-
catch (_a) {
|
|
32371
|
-
resolvedSchema = currentSchema;
|
|
32372
|
-
}
|
|
32373
|
-
}
|
|
32374
|
-
// Process properties (each property maps to uiSchema[propName] - flattened)
|
|
32375
|
-
const properties = resolvedSchema[PROPERTIES_KEY];
|
|
32376
|
-
if (properties && isObject$3(properties)) {
|
|
32377
|
-
for (const [propName, propSchema] of Object.entries(properties)) {
|
|
32378
|
-
const propUiSchema = (result[propName] || {});
|
|
32379
|
-
const expanded = expandUiSchemaDefinitions(propSchema, propUiSchema, registry, new Set(visited));
|
|
32380
|
-
if (Object.keys(expanded).length > 0) {
|
|
32381
|
-
result[propName] = expanded;
|
|
32382
|
-
}
|
|
32383
|
-
}
|
|
32384
|
-
}
|
|
32385
|
-
// Process keywords where child maps to same key in uiSchema (items, additionalProperties)
|
|
32386
|
-
for (const keyword of SAME_KEY_KEYWORDS) {
|
|
32387
|
-
const subSchema = resolvedSchema[keyword];
|
|
32388
|
-
if (subSchema && isObject$3(subSchema) && !Array.isArray(subSchema)) {
|
|
32389
|
-
const currentUiSchema = result[keyword];
|
|
32390
|
-
if (typeof currentUiSchema !== 'function') {
|
|
32391
|
-
const subUiSchema = (currentUiSchema || {});
|
|
32392
|
-
const expanded = expandUiSchemaDefinitions(subSchema, subUiSchema, registry, new Set(visited));
|
|
32393
|
-
if (Object.keys(expanded).length > 0) {
|
|
32394
|
-
result[keyword] = expanded;
|
|
32395
|
-
}
|
|
32396
|
-
}
|
|
32397
|
-
}
|
|
32398
|
-
}
|
|
32399
|
-
// Process array keywords (oneOf, anyOf, allOf) - each option maps to uiSchema[keyword][i]
|
|
32400
|
-
for (const keyword of ARRAY_KEYWORDS) {
|
|
32401
|
-
const schemaOptions = resolvedSchema[keyword];
|
|
32402
|
-
if (Array.isArray(schemaOptions) && schemaOptions.length > 0) {
|
|
32403
|
-
const currentUiSchemaArray = result[keyword];
|
|
32404
|
-
const uiSchemaArray = Array.isArray(currentUiSchemaArray) ? [...currentUiSchemaArray] : [];
|
|
32405
|
-
let hasExpanded = false;
|
|
32406
|
-
for (let i = 0; i < schemaOptions.length; i++) {
|
|
32407
|
-
const optionSchema = schemaOptions[i];
|
|
32408
|
-
const optionUiSchema = (uiSchemaArray[i] || {});
|
|
32409
|
-
const expanded = expandUiSchemaDefinitions(optionSchema, optionUiSchema, registry, new Set(visited));
|
|
32410
|
-
if (Object.keys(expanded).length > 0) {
|
|
32411
|
-
uiSchemaArray[i] = expanded;
|
|
32412
|
-
hasExpanded = true;
|
|
32413
|
-
}
|
|
32414
|
-
}
|
|
32415
|
-
if (hasExpanded) {
|
|
32416
|
-
result[keyword] = uiSchemaArray;
|
|
32417
|
-
}
|
|
32418
|
-
}
|
|
32419
|
-
}
|
|
32420
|
-
return result;
|
|
32421
|
-
}
|
|
32422
32581
|
/** Resolves the uiSchema for a given schema, considering `ui:definitions` stored in the registry.
|
|
32423
32582
|
*
|
|
32424
|
-
*
|
|
32425
|
-
*
|
|
32426
|
-
*
|
|
32427
|
-
*
|
|
32428
|
-
* from `registry.uiSchemaDefinitions` and merges it with any local uiSchema overrides.
|
|
32583
|
+
* Called at runtime for each field. When the schema contains a `$ref`, looks up the corresponding
|
|
32584
|
+
* uiSchema definition from `registry.uiSchemaDefinitions` and merges it with local overrides.
|
|
32585
|
+
* For schemas with `oneOf`/`anyOf` branches, also populates `uiSchema[keyword][i]` for branches
|
|
32586
|
+
* whose `$ref` matches a definition, so `MultiSchemaField` can read dropdown option titles.
|
|
32429
32587
|
*
|
|
32430
32588
|
* Resolution order (later sources override earlier):
|
|
32431
32589
|
* 1. `ui:definitions[$ref]` - base definition from registry
|
|
32432
32590
|
* 2. `localUiSchema` - local overrides at current path
|
|
32433
32591
|
*
|
|
32434
|
-
* @param schema - The JSON schema (may
|
|
32592
|
+
* @param schema - The JSON schema (may contain `$ref` or `RJSF_REF_KEY`)
|
|
32435
32593
|
* @param localUiSchema - The uiSchema at the current path (local overrides)
|
|
32436
32594
|
* @param registry - The registry containing `uiSchemaDefinitions`
|
|
32437
32595
|
* @returns - The resolved uiSchema with definitions merged in
|
|
@@ -32439,14 +32597,54 @@ export default theme;`;
|
|
|
32439
32597
|
function resolveUiSchema(schema, localUiSchema, registry) {
|
|
32440
32598
|
var _a, _b;
|
|
32441
32599
|
const ref = ((_a = schema[RJSF_REF_KEY]) !== null && _a !== void 0 ? _a : schema[REF_KEY]);
|
|
32442
|
-
const
|
|
32600
|
+
const definitions = registry.uiSchemaDefinitions;
|
|
32601
|
+
const definitionUiSchema = ref && definitions ? definitions[ref] : undefined;
|
|
32602
|
+
let result;
|
|
32443
32603
|
if (!definitionUiSchema) {
|
|
32444
|
-
|
|
32604
|
+
result = localUiSchema || {};
|
|
32605
|
+
}
|
|
32606
|
+
else if (!localUiSchema || isEmpty$1(localUiSchema)) {
|
|
32607
|
+
result = { ...definitionUiSchema };
|
|
32445
32608
|
}
|
|
32446
|
-
|
|
32447
|
-
|
|
32609
|
+
else {
|
|
32610
|
+
result = mergeObjects(definitionUiSchema, localUiSchema);
|
|
32611
|
+
}
|
|
32612
|
+
// Walk oneOf/anyOf branches to populate uiSchema[keyword][i] so MultiSchemaField
|
|
32613
|
+
// can read dropdown option titles at the parent level.
|
|
32614
|
+
if (definitions) {
|
|
32615
|
+
let resolvedSchema = schema;
|
|
32616
|
+
if (ref && schema[REF_KEY] && !schema[RJSF_REF_KEY]) {
|
|
32617
|
+
try {
|
|
32618
|
+
resolvedSchema = findSchemaDefinition(ref, registry.rootSchema);
|
|
32619
|
+
}
|
|
32620
|
+
catch (e) {
|
|
32621
|
+
console.warn('could not resolve $ref in resolveUiSchema:\n', e);
|
|
32622
|
+
return result;
|
|
32623
|
+
}
|
|
32624
|
+
}
|
|
32625
|
+
for (const keyword of [ONE_OF_KEY, ANY_OF_KEY]) {
|
|
32626
|
+
const schemaOptions = resolvedSchema[keyword];
|
|
32627
|
+
if (!Array.isArray(schemaOptions) || schemaOptions.length === 0) {
|
|
32628
|
+
continue;
|
|
32629
|
+
}
|
|
32630
|
+
const currentUiSchemaArray = result[keyword];
|
|
32631
|
+
const uiSchemaArray = Array.isArray(currentUiSchemaArray) ? [...currentUiSchemaArray] : [];
|
|
32632
|
+
let hasExpanded = false;
|
|
32633
|
+
for (let i = 0; i < schemaOptions.length; i++) {
|
|
32634
|
+
const option = schemaOptions[i];
|
|
32635
|
+
const optionRef = ((_b = option === null || option === void 0 ? void 0 : option[RJSF_REF_KEY]) !== null && _b !== void 0 ? _b : option === null || option === void 0 ? void 0 : option[REF_KEY]);
|
|
32636
|
+
if (optionRef && optionRef in definitions) {
|
|
32637
|
+
const optionUiSchema = (uiSchemaArray[i] || {});
|
|
32638
|
+
uiSchemaArray[i] = mergeObjects(definitions[optionRef], optionUiSchema);
|
|
32639
|
+
hasExpanded = true;
|
|
32640
|
+
}
|
|
32641
|
+
}
|
|
32642
|
+
if (hasExpanded) {
|
|
32643
|
+
result[keyword] = uiSchemaArray;
|
|
32644
|
+
}
|
|
32645
|
+
}
|
|
32448
32646
|
}
|
|
32449
|
-
return
|
|
32647
|
+
return result;
|
|
32450
32648
|
}
|
|
32451
32649
|
|
|
32452
32650
|
/** Check to see if a `schema` specifies that a value must be true. This happens when:
|
|
@@ -35302,11 +35500,14 @@ export default theme;`;
|
|
|
35302
35500
|
const { schema: rawSchema, uiSchema = {}, formData, errorSchema, fieldPathId, name, required = false, disabled, readonly, hideError, onBlur, onFocus, onChange, registry, title, } = props;
|
|
35303
35501
|
const { fields, schemaUtils, translateString, globalUiOptions } = registry;
|
|
35304
35502
|
const { OptionalDataControlsField } = fields;
|
|
35503
|
+
const formDataRef = reactExports.useRef(formData);
|
|
35504
|
+
formDataRef.current = formData;
|
|
35305
35505
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData, true);
|
|
35306
35506
|
const uiOptions = getUiOptions(uiSchema, globalUiOptions);
|
|
35307
35507
|
const { properties: schemaProperties = {} } = schema;
|
|
35308
35508
|
// All the children will use childFieldPathId if present in the props, falling back to the fieldPathId
|
|
35309
35509
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
35510
|
+
const lastRenamedProperty = reactExports.useRef({ previousKey: '', currentKey: undefined });
|
|
35310
35511
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
35311
35512
|
const description = uiOptions.description ?? schema.description;
|
|
35312
35513
|
const renderOptionalField = shouldRenderOptionalField(registry, schema, required, uiSchema);
|
|
@@ -35366,6 +35567,10 @@ export default theme;`;
|
|
|
35366
35567
|
// Cast this to make the `set` work properly
|
|
35367
35568
|
set(newFormData, newKey, newValue);
|
|
35368
35569
|
}
|
|
35570
|
+
if (lastRenamedProperty.current.previousKey === newKey) {
|
|
35571
|
+
lastRenamedProperty.current.currentKey = newKey;
|
|
35572
|
+
lastRenamedProperty.current.previousKey = getAvailableKey(newKey, newFormData);
|
|
35573
|
+
}
|
|
35369
35574
|
onChange(newFormData, childFieldPathId.path);
|
|
35370
35575
|
}, [formData, onChange, registry, childFieldPathId, getAvailableKey, schema]);
|
|
35371
35576
|
/** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
|
|
@@ -35377,9 +35582,10 @@ export default theme;`;
|
|
|
35377
35582
|
*/
|
|
35378
35583
|
const handleKeyRename = reactExports.useCallback((oldKey, newKey) => {
|
|
35379
35584
|
if (oldKey !== newKey) {
|
|
35380
|
-
const
|
|
35585
|
+
const currentFormData = formDataRef.current;
|
|
35586
|
+
const actualNewKey = getAvailableKey(newKey, currentFormData);
|
|
35381
35587
|
const newFormData = {
|
|
35382
|
-
...
|
|
35588
|
+
...currentFormData,
|
|
35383
35589
|
};
|
|
35384
35590
|
const newKeys = { [oldKey]: actualNewKey };
|
|
35385
35591
|
const keyValues = Object.keys(newFormData).map((key) => {
|
|
@@ -35387,15 +35593,31 @@ export default theme;`;
|
|
|
35387
35593
|
return { [newKey]: newFormData[key] };
|
|
35388
35594
|
});
|
|
35389
35595
|
const renamedObj = Object.assign({}, ...keyValues);
|
|
35596
|
+
formDataRef.current = renamedObj;
|
|
35597
|
+
if (oldKey !== lastRenamedProperty.current.currentKey) {
|
|
35598
|
+
lastRenamedProperty.current.previousKey = oldKey;
|
|
35599
|
+
}
|
|
35600
|
+
lastRenamedProperty.current.currentKey = actualNewKey;
|
|
35390
35601
|
onChange(renamedObj, childFieldPathId.path);
|
|
35391
35602
|
}
|
|
35392
|
-
}, [
|
|
35603
|
+
}, [onChange, childFieldPathId, getAvailableKey]);
|
|
35393
35604
|
/** Handles the remove click which calls the `onChange` callback with the special ADDITIONAL_PROPERTY_FIELD_REMOVE
|
|
35394
35605
|
* value for the path plus the key to be removed
|
|
35395
35606
|
*/
|
|
35396
35607
|
const handleRemoveProperty = reactExports.useCallback((key) => {
|
|
35397
35608
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
35398
35609
|
}, [onChange, childFieldPathId]);
|
|
35610
|
+
/** Returns the stable React key for a property. For the most recently renamed
|
|
35611
|
+
* additional property, returns the previous key so that React reuses the
|
|
35612
|
+
* existing component instance instead of unmounting/remounting it. This
|
|
35613
|
+
* preserves DOM focus naturally without manual focus management.
|
|
35614
|
+
*/
|
|
35615
|
+
const getStableKey = reactExports.useCallback((property) => {
|
|
35616
|
+
if (lastRenamedProperty.current.currentKey === property) {
|
|
35617
|
+
return lastRenamedProperty.current.previousKey;
|
|
35618
|
+
}
|
|
35619
|
+
return property;
|
|
35620
|
+
}, []);
|
|
35399
35621
|
if (!renderOptionalField || hasFormData) {
|
|
35400
35622
|
try {
|
|
35401
35623
|
const properties = Object.keys(schemaProperties);
|
|
@@ -35415,7 +35637,7 @@ export default theme;`;
|
|
|
35415
35637
|
const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, name, ADDITIONAL_PROPERTY_FLAG]);
|
|
35416
35638
|
const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
|
|
35417
35639
|
const hidden = getUiOptions(fieldUiSchema).widget === 'hidden';
|
|
35418
|
-
const content = (jsxRuntimeExports.jsx(ObjectFieldProperty, { propertyName: name, required: isRequired(schema, name), schema: get(schema, [PROPERTIES_KEY, name], {}), uiSchema: fieldUiSchema, errorSchema: get(errorSchema, [name]), fieldPathId: childFieldPathId, formData: get(formData, [name]), handleKeyRename: handleKeyRename, handleRemoveProperty: handleRemoveProperty, addedByAdditionalProperties: addedByAdditionalProperties, onChange: onChange, onBlur: onBlur, onFocus: onFocus, registry: registry, disabled: disabled, readonly: readonly, hideError: hideError }, name));
|
|
35640
|
+
const content = (jsxRuntimeExports.jsx(ObjectFieldProperty, { propertyName: name, required: isRequired(schema, name), schema: get(schema, [PROPERTIES_KEY, name], {}), uiSchema: fieldUiSchema, errorSchema: get(errorSchema, [name]), fieldPathId: childFieldPathId, formData: get(formData, [name]), handleKeyRename: handleKeyRename, handleRemoveProperty: handleRemoveProperty, addedByAdditionalProperties: addedByAdditionalProperties, onChange: onChange, onBlur: onBlur, onFocus: onFocus, registry: registry, disabled: disabled, readonly: readonly, hideError: hideError }, getStableKey(name)));
|
|
35419
35641
|
return {
|
|
35420
35642
|
content,
|
|
35421
35643
|
name,
|
|
@@ -36160,7 +36382,7 @@ export default theme;`;
|
|
|
36160
36382
|
return (jsxRuntimeExports.jsx("div", { className: uiClassNames, style: style, children: children }));
|
|
36161
36383
|
}
|
|
36162
36384
|
const margin = hasDescription ? 46 : 26;
|
|
36163
|
-
return (jsxRuntimeExports.jsx("div", { className: uiClassNames, style: style, children: jsxRuntimeExports.jsxs("div", { className: 'row', children: [jsxRuntimeExports.jsx("div", { className: 'col-xs-5 form-additional', children: jsxRuntimeExports.jsxs("div", { className: 'form-group', children: [displayLabel && jsxRuntimeExports.jsx(Label, { label: keyLabel, required: required, id: `${id}-key` }), displayLabel && rawDescription && jsxRuntimeExports.jsx("div", { children: "\u00A0" }), jsxRuntimeExports.jsx("input", { className: 'form-control', type: 'text', id: `${id}-key`, onBlur: onKeyRenameBlur, defaultValue: label })] }) }), jsxRuntimeExports.jsx("div", { className: 'form-additional form-group col-xs-5', children: children }), jsxRuntimeExports.jsx("div", { className: 'col-xs-2', style: { marginTop: displayLabel ? `${margin}px` : undefined }, children: jsxRuntimeExports.jsx(RemoveButton, { id: buttonId(id, 'remove'), className: 'rjsf-object-property-remove btn-block', style: { border: '0' }, disabled: disabled || readonly, onClick: onRemoveProperty, uiSchema: uiSchema, registry: registry }) })] }) }));
|
|
36385
|
+
return (jsxRuntimeExports.jsx("div", { className: uiClassNames, style: style, children: jsxRuntimeExports.jsxs("div", { className: 'row', children: [jsxRuntimeExports.jsx("div", { className: 'col-xs-5 form-additional', children: jsxRuntimeExports.jsxs("div", { className: 'form-group', children: [displayLabel && jsxRuntimeExports.jsx(Label, { label: keyLabel, required: required, id: `${id}-key` }), displayLabel && rawDescription && jsxRuntimeExports.jsx("div", { children: "\u00A0" }), jsxRuntimeExports.jsx("input", { className: 'form-control', type: 'text', id: `${id}-key`, onBlur: onKeyRenameBlur, defaultValue: label }, label)] }) }), jsxRuntimeExports.jsx("div", { className: 'form-additional form-group col-xs-5', children: children }), jsxRuntimeExports.jsx("div", { className: 'col-xs-2', style: { marginTop: displayLabel ? `${margin}px` : undefined }, children: jsxRuntimeExports.jsx(RemoveButton, { id: buttonId(id, 'remove'), className: 'rjsf-object-property-remove btn-block', style: { border: '0' }, disabled: disabled || readonly, onClick: onRemoveProperty, uiSchema: uiSchema, registry: registry }) })] }) }));
|
|
36164
36386
|
}
|
|
36165
36387
|
|
|
36166
36388
|
function templates() {
|
|
@@ -36233,10 +36455,12 @@ export default theme;`;
|
|
|
36233
36455
|
*
|
|
36234
36456
|
* @param props - The `WidgetProps` for this component
|
|
36235
36457
|
*/
|
|
36236
|
-
function CheckboxesWidget$1({ id, disabled, options
|
|
36458
|
+
function CheckboxesWidget$1({ id, disabled, options, value, autofocus = false, readonly, onChange, onBlur, onFocus, htmlName, }) {
|
|
36459
|
+
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
36460
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
36237
36461
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
36238
|
-
const handleBlur = reactExports.useCallback(({ target }) => onBlur(id,
|
|
36239
|
-
const handleFocus = reactExports.useCallback(({ target }) => onFocus(id,
|
|
36462
|
+
const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, id, enumOptions, emptyValue, optionValueFormat]);
|
|
36463
|
+
const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, id, enumOptions, emptyValue, optionValueFormat]);
|
|
36240
36464
|
return (jsxRuntimeExports.jsx("div", { className: 'checkboxes', id: id, children: Array.isArray(enumOptions) &&
|
|
36241
36465
|
enumOptions.map((option, index) => {
|
|
36242
36466
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
@@ -36250,7 +36474,7 @@ export default theme;`;
|
|
|
36250
36474
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
36251
36475
|
}
|
|
36252
36476
|
};
|
|
36253
|
-
const checkbox = (jsxRuntimeExports.jsxs("span", { children: [jsxRuntimeExports.jsx("input", { type: 'checkbox', id: optionId(id, index), name: htmlName || id, checked: checked, value:
|
|
36477
|
+
const checkbox = (jsxRuntimeExports.jsxs("span", { children: [jsxRuntimeExports.jsx("input", { type: 'checkbox', id: optionId(id, index), name: htmlName || id, checked: checked, value: enumOptionValueEncoder(option.value, index, optionValueFormat), disabled: disabled || itemDisabled || readonly, autoFocus: autofocus && index === 0, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedByIds(id) }), jsxRuntimeExports.jsx("span", { children: option.label })] }));
|
|
36254
36478
|
return inline ? (jsxRuntimeExports.jsx("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index)) : (jsxRuntimeExports.jsx("div", { className: `checkbox ${disabledCls}`, children: jsxRuntimeExports.jsx("label", { children: checkbox }) }, index));
|
|
36255
36479
|
}) }));
|
|
36256
36480
|
}
|
|
@@ -36368,15 +36592,16 @@ export default theme;`;
|
|
|
36368
36592
|
*/
|
|
36369
36593
|
function RadioWidget$1({ options, value, required, disabled, readonly, autofocus = false, onBlur, onFocus, onChange, id, htmlName, }) {
|
|
36370
36594
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
36371
|
-
const
|
|
36372
|
-
const
|
|
36595
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
36596
|
+
const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, enumOptions, emptyValue, id, optionValueFormat]);
|
|
36597
|
+
const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, enumOptions, emptyValue, id, optionValueFormat]);
|
|
36373
36598
|
return (jsxRuntimeExports.jsx("div", { className: 'field-radio-group', id: id, role: 'radiogroup', children: Array.isArray(enumOptions) &&
|
|
36374
36599
|
enumOptions.map((option, i) => {
|
|
36375
36600
|
const checked = enumOptionsIsSelected(option.value, value);
|
|
36376
36601
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
36377
36602
|
const disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
36378
36603
|
const handleChange = () => onChange(option.value);
|
|
36379
|
-
const radio = (jsxRuntimeExports.jsxs("span", { children: [jsxRuntimeExports.jsx("input", { type: 'radio', id: optionId(id, i), checked: checked, name: htmlName || id, required: required, value:
|
|
36604
|
+
const radio = (jsxRuntimeExports.jsxs("span", { children: [jsxRuntimeExports.jsx("input", { type: 'radio', id: optionId(id, i), checked: checked, name: htmlName || id, required: required, value: enumOptionValueEncoder(option.value, i, optionValueFormat), disabled: disabled || itemDisabled || readonly, autoFocus: autofocus && i === 0, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedByIds(id) }), jsxRuntimeExports.jsx("span", { children: option.label })] }));
|
|
36380
36605
|
return inline ? (jsxRuntimeExports.jsx("label", { className: `radio-inline ${disabledCls}`, children: radio }, i)) : (jsxRuntimeExports.jsx("div", { className: `radio ${disabledCls}`, children: jsxRuntimeExports.jsx("label", { children: radio }) }, i));
|
|
36381
36606
|
}) }));
|
|
36382
36607
|
}
|
|
@@ -36470,24 +36695,25 @@ export default theme;`;
|
|
|
36470
36695
|
function SelectWidget$1({ schema, id, options, value, required, disabled, readonly, multiple = false, autofocus = false, onChange, onBlur, onFocus, placeholder, htmlName, }) {
|
|
36471
36696
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
36472
36697
|
const emptyValue = multiple ? [] : '';
|
|
36698
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
36473
36699
|
const handleFocus = reactExports.useCallback((event) => {
|
|
36474
36700
|
const newValue = getValue(event, multiple);
|
|
36475
|
-
return onFocus(id,
|
|
36476
|
-
}, [onFocus, id, multiple, enumOptions, optEmptyVal]);
|
|
36701
|
+
return onFocus(id, enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
36702
|
+
}, [onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
36477
36703
|
const handleBlur = reactExports.useCallback((event) => {
|
|
36478
36704
|
const newValue = getValue(event, multiple);
|
|
36479
|
-
return onBlur(id,
|
|
36480
|
-
}, [onBlur, id, multiple, enumOptions, optEmptyVal]);
|
|
36705
|
+
return onBlur(id, enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
36706
|
+
}, [onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
36481
36707
|
const handleChange = reactExports.useCallback((event) => {
|
|
36482
36708
|
const newValue = getValue(event, multiple);
|
|
36483
|
-
return onChange(
|
|
36484
|
-
}, [onChange, multiple, enumOptions, optEmptyVal]);
|
|
36485
|
-
const
|
|
36709
|
+
return onChange(enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
36710
|
+
}, [onChange, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
36711
|
+
const selectValue = enumOptionSelectedValue(value, enumOptions, multiple, optionValueFormat, emptyValue);
|
|
36486
36712
|
const showPlaceholderOption = !multiple && schema.default === undefined;
|
|
36487
|
-
return (jsxRuntimeExports.jsxs("select", { id: id, name: htmlName || id, multiple: multiple, role: 'combobox', className: 'form-control', value:
|
|
36713
|
+
return (jsxRuntimeExports.jsxs("select", { id: id, name: htmlName || id, multiple: multiple, role: 'combobox', className: 'form-control', value: selectValue, required: required, disabled: disabled || readonly, autoFocus: autofocus, onBlur: handleBlur, onFocus: handleFocus, onChange: handleChange, "aria-describedby": ariaDescribedByIds(id), children: [showPlaceholderOption && jsxRuntimeExports.jsx("option", { value: '', children: placeholder }), Array.isArray(enumOptions) &&
|
|
36488
36714
|
enumOptions.map(({ value, label }, i) => {
|
|
36489
36715
|
const disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;
|
|
36490
|
-
return (jsxRuntimeExports.jsx("option", { value:
|
|
36716
|
+
return (jsxRuntimeExports.jsx("option", { value: enumOptionValueEncoder(value, i, optionValueFormat), disabled: disabled, children: label }, i));
|
|
36491
36717
|
})] }));
|
|
36492
36718
|
}
|
|
36493
36719
|
|
|
@@ -36825,10 +37051,6 @@ export default theme;`;
|
|
|
36825
37051
|
// Only store a new registry when the props cause a different one to be created
|
|
36826
37052
|
const newRegistry = this.getRegistry(props, rootSchema, schemaUtils);
|
|
36827
37053
|
const registry = deepEquals(state.registry, newRegistry) ? state.registry : newRegistry;
|
|
36828
|
-
// Pre-expand ui:definitions into the uiSchema structure (must happen after registry is created)
|
|
36829
|
-
const expandedUiSchema = registry.uiSchemaDefinitions
|
|
36830
|
-
? expandUiSchemaDefinitions(rootSchema, uiSchema, registry)
|
|
36831
|
-
: uiSchema;
|
|
36832
37054
|
// Only compute a new `fieldPathId` when the `idPrefix` is different than the existing fieldPathId's ID_KEY
|
|
36833
37055
|
const fieldPathId = state.fieldPathId && state.fieldPathId?.[ID_KEY] === registry.globalFormOptions.idPrefix
|
|
36834
37056
|
? state.fieldPathId
|
|
@@ -36836,7 +37058,7 @@ export default theme;`;
|
|
|
36836
37058
|
const nextState = {
|
|
36837
37059
|
schemaUtils,
|
|
36838
37060
|
schema: rootSchema,
|
|
36839
|
-
uiSchema
|
|
37061
|
+
uiSchema,
|
|
36840
37062
|
fieldPathId,
|
|
36841
37063
|
formData,
|
|
36842
37064
|
edit,
|
|
@@ -37010,7 +37232,7 @@ export default theme;`;
|
|
|
37010
37232
|
this._isProcessingUserChange = true;
|
|
37011
37233
|
const { newValue, path, id } = this.pendingChanges[0];
|
|
37012
37234
|
const { newErrorSchema } = this.pendingChanges[0];
|
|
37013
|
-
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
|
|
37235
|
+
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange, removeEmptyOptionalObjects } = this.props;
|
|
37014
37236
|
const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
|
|
37015
37237
|
let { customErrors, errorSchema: originalErrorSchema } = this.state;
|
|
37016
37238
|
const rootPathId = fieldPathId.path[0] || '';
|
|
@@ -37049,6 +37271,13 @@ export default theme;`;
|
|
|
37049
37271
|
formData: newFormData,
|
|
37050
37272
|
};
|
|
37051
37273
|
}
|
|
37274
|
+
if (removeEmptyOptionalObjects) {
|
|
37275
|
+
newFormData = removeOptionalEmptyObjects(schemaUtils.getValidator(), schema, schemaUtils.getRootSchema(), newFormData);
|
|
37276
|
+
state = {
|
|
37277
|
+
...state,
|
|
37278
|
+
formData: newFormData,
|
|
37279
|
+
};
|
|
37280
|
+
}
|
|
37052
37281
|
if (newErrorSchema) {
|
|
37053
37282
|
// First check to see if there is an existing validation error on this path...
|
|
37054
37283
|
// @ts-expect-error TS2590, because getting from the error schema is confusing TS
|
|
@@ -37149,19 +37378,23 @@ export default theme;`;
|
|
|
37149
37378
|
* @param data - The data associated with the field that was blurred
|
|
37150
37379
|
*/
|
|
37151
37380
|
onBlur = (id, data) => {
|
|
37152
|
-
const { onBlur, omitExtraData, liveOmit, liveValidate } = this.props;
|
|
37381
|
+
const { onBlur, omitExtraData, liveOmit, liveValidate, removeEmptyOptionalObjects } = this.props;
|
|
37153
37382
|
if (onBlur) {
|
|
37154
37383
|
onBlur(id, data);
|
|
37155
37384
|
}
|
|
37156
37385
|
if ((omitExtraData === true && liveOmit === 'onBlur') || liveValidate === 'onBlur') {
|
|
37157
37386
|
const { onChange, extraErrors } = this.props;
|
|
37158
|
-
const { formData } = this.state;
|
|
37387
|
+
const { formData, schemaUtils, schema } = this.state;
|
|
37159
37388
|
let newFormData = formData;
|
|
37160
37389
|
let state = { formData: newFormData };
|
|
37161
37390
|
if (omitExtraData === true && liveOmit === 'onBlur') {
|
|
37162
37391
|
newFormData = this.omitExtraData(formData);
|
|
37163
37392
|
state = { formData: newFormData };
|
|
37164
37393
|
}
|
|
37394
|
+
if (removeEmptyOptionalObjects) {
|
|
37395
|
+
newFormData = removeOptionalEmptyObjects(schemaUtils.getValidator(), schema, schemaUtils.getRootSchema(), newFormData);
|
|
37396
|
+
state = { ...state, formData: newFormData };
|
|
37397
|
+
}
|
|
37165
37398
|
if (liveValidate === 'onBlur') {
|
|
37166
37399
|
const { schema, schemaUtils, errorSchema, customErrors, retrievedSchema } = this.state;
|
|
37167
37400
|
const liveValidation = this.liveValidate(schema, schemaUtils, errorSchema, newFormData, extraErrors, customErrors, retrievedSchema);
|
|
@@ -37208,11 +37441,15 @@ export default theme;`;
|
|
|
37208
37441
|
return;
|
|
37209
37442
|
}
|
|
37210
37443
|
event.persist();
|
|
37211
|
-
const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;
|
|
37444
|
+
const { omitExtraData, extraErrors, noValidate, onSubmit, removeEmptyOptionalObjects } = this.props;
|
|
37212
37445
|
let { formData: newFormData } = this.state;
|
|
37213
37446
|
if (omitExtraData === true) {
|
|
37214
37447
|
newFormData = this.omitExtraData(newFormData);
|
|
37215
37448
|
}
|
|
37449
|
+
if (removeEmptyOptionalObjects) {
|
|
37450
|
+
const { schemaUtils, schema } = this.state;
|
|
37451
|
+
newFormData = removeOptionalEmptyObjects(schemaUtils.getValidator(), schema, schemaUtils.getRootSchema(), newFormData);
|
|
37452
|
+
}
|
|
37216
37453
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
37217
37454
|
// There are no errors generated through schema validation.
|
|
37218
37455
|
// Check for user provided errors and update state accordingly.
|
|
@@ -37305,8 +37542,9 @@ export default theme;`;
|
|
|
37305
37542
|
const elementId = path.join(idSeparator);
|
|
37306
37543
|
let field = this.formElement.current.elements[elementId];
|
|
37307
37544
|
if (!field) {
|
|
37308
|
-
// if not an exact match, try finding
|
|
37309
|
-
|
|
37545
|
+
// if not an exact match, try finding a focusable element starting with the element id (like radio buttons or checkboxes)
|
|
37546
|
+
// some themes (e.g. shadcn) use button elements instead of native inputs for radio groups
|
|
37547
|
+
field = this.formElement.current.querySelector(`input[id^="${elementId}"], button[id^="${elementId}"]`);
|
|
37310
37548
|
}
|
|
37311
37549
|
if (field && field.length) {
|
|
37312
37550
|
// If we got a list with length > 0
|
|
@@ -37380,11 +37618,15 @@ export default theme;`;
|
|
|
37380
37618
|
* @returns - True if the form is valid, false otherwise.
|
|
37381
37619
|
*/
|
|
37382
37620
|
validateForm() {
|
|
37383
|
-
const { omitExtraData } = this.props;
|
|
37621
|
+
const { omitExtraData, removeEmptyOptionalObjects } = this.props;
|
|
37384
37622
|
let { formData: newFormData } = this.state;
|
|
37385
37623
|
if (omitExtraData === true) {
|
|
37386
37624
|
newFormData = this.omitExtraData(newFormData);
|
|
37387
37625
|
}
|
|
37626
|
+
if (removeEmptyOptionalObjects) {
|
|
37627
|
+
const { schemaUtils, schema } = this.state;
|
|
37628
|
+
newFormData = removeOptionalEmptyObjects(schemaUtils.getValidator(), schema, schemaUtils.getRootSchema(), newFormData);
|
|
37629
|
+
}
|
|
37388
37630
|
return this.validateFormWithFormData(newFormData);
|
|
37389
37631
|
}
|
|
37390
37632
|
/** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if
|
|
@@ -44082,13 +44324,50 @@ export default theme;`;
|
|
|
44082
44324
|
return ajv;
|
|
44083
44325
|
}
|
|
44084
44326
|
|
|
44327
|
+
/** Filters duplicate errors from `anyOf`/`oneOf` schema paths according to the `suppressDuplicateFiltering` flag.
|
|
44328
|
+
*
|
|
44329
|
+
* @param errorList - The list of `RJSFValidationError`s to filter
|
|
44330
|
+
* @param [suppressDuplicateFiltering='none'] - Controls which duplicate filtering is suppressed:
|
|
44331
|
+
* - `'none'` (default): filters duplicates for both `anyOf` and `oneOf`
|
|
44332
|
+
* - `'all'`: returns `errorList` unmodified
|
|
44333
|
+
* - `'anyOf'`: suppresses filtering for `anyOf` errors; `oneOf` duplicates are still filtered
|
|
44334
|
+
* - `'oneOf'`: suppresses filtering for `oneOf` errors; `anyOf` duplicates are still filtered
|
|
44335
|
+
*/
|
|
44336
|
+
function filterDuplicateErrors(errorList, suppressDuplicateFiltering = 'none') {
|
|
44337
|
+
if (suppressDuplicateFiltering === 'all') {
|
|
44338
|
+
return errorList;
|
|
44339
|
+
}
|
|
44340
|
+
return errorList.reduce((acc, err) => {
|
|
44341
|
+
const { message, schemaPath } = err;
|
|
44342
|
+
// Compute the index only when filtering for that keyword is not suppressed.
|
|
44343
|
+
// 'all' is already handled above; within the reduce, only 'none', 'anyOf', and 'oneOf' are possible.
|
|
44344
|
+
const anyOfIndex = suppressDuplicateFiltering !== 'anyOf' ? schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.indexOf(`/${ANY_OF_KEY}/`) : undefined;
|
|
44345
|
+
const oneOfIndex = suppressDuplicateFiltering !== 'oneOf' ? schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.indexOf(`/${ONE_OF_KEY}/`) : undefined;
|
|
44346
|
+
let schemaPrefix;
|
|
44347
|
+
if (anyOfIndex && anyOfIndex >= 0) {
|
|
44348
|
+
schemaPrefix = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.substring(0, anyOfIndex);
|
|
44349
|
+
}
|
|
44350
|
+
else if (oneOfIndex && oneOfIndex >= 0) {
|
|
44351
|
+
schemaPrefix = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.substring(0, oneOfIndex);
|
|
44352
|
+
}
|
|
44353
|
+
// If there is a schemaPrefix, then search for a duplicate message with the same prefix, otherwise undefined
|
|
44354
|
+
const dup = schemaPrefix
|
|
44355
|
+
? acc.find((e) => { var _a; return e.message === message && ((_a = e.schemaPath) === null || _a === void 0 ? void 0 : _a.startsWith(schemaPrefix)); })
|
|
44356
|
+
: undefined;
|
|
44357
|
+
if (!dup) {
|
|
44358
|
+
acc.push(err);
|
|
44359
|
+
}
|
|
44360
|
+
return acc;
|
|
44361
|
+
}, []);
|
|
44362
|
+
}
|
|
44085
44363
|
/** Transforming the error output from ajv to format used by @rjsf/utils.
|
|
44086
44364
|
* At some point, components should be updated to support ajv.
|
|
44087
44365
|
*
|
|
44088
44366
|
* @param errors - The list of AJV errors to convert to `RJSFValidationErrors`
|
|
44089
44367
|
* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
|
|
44368
|
+
* @param [suppressDuplicateFiltering] - Controls which duplicate filtering is suppressed; see `filterDuplicateErrors`
|
|
44090
44369
|
*/
|
|
44091
|
-
function transformRJSFValidationErrors(errors = [], uiSchema) {
|
|
44370
|
+
function transformRJSFValidationErrors(errors = [], uiSchema, suppressDuplicateFiltering) {
|
|
44092
44371
|
const errorList = errors.map((e) => {
|
|
44093
44372
|
var _a;
|
|
44094
44373
|
const { instancePath, keyword, params, schemaPath, parentSchema, ...rest } = e;
|
|
@@ -44158,29 +44437,7 @@ export default theme;`;
|
|
|
44158
44437
|
title: uiTitle,
|
|
44159
44438
|
};
|
|
44160
44439
|
});
|
|
44161
|
-
|
|
44162
|
-
return errorList.reduce((acc, err) => {
|
|
44163
|
-
const { message, schemaPath } = err;
|
|
44164
|
-
const anyOfIndex = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.indexOf(`/${ANY_OF_KEY}/`);
|
|
44165
|
-
const oneOfIndex = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.indexOf(`/${ONE_OF_KEY}/`);
|
|
44166
|
-
let schemaPrefix;
|
|
44167
|
-
// Look specifically for `/anyOr/` or `/oneOf/` within the schemaPath information
|
|
44168
|
-
if (anyOfIndex && anyOfIndex >= 0) {
|
|
44169
|
-
schemaPrefix = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.substring(0, anyOfIndex);
|
|
44170
|
-
}
|
|
44171
|
-
else if (oneOfIndex && oneOfIndex >= 0) {
|
|
44172
|
-
schemaPrefix = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.substring(0, oneOfIndex);
|
|
44173
|
-
}
|
|
44174
|
-
// If there is a schemaPrefix, then search for a duplicate message with the same prefix, otherwise undefined
|
|
44175
|
-
const dup = schemaPrefix
|
|
44176
|
-
? acc.find((e) => { var _a; return e.message === message && ((_a = e.schemaPath) === null || _a === void 0 ? void 0 : _a.startsWith(schemaPrefix)); })
|
|
44177
|
-
: undefined;
|
|
44178
|
-
if (!dup) {
|
|
44179
|
-
// Only push an error that is not a duplicate
|
|
44180
|
-
acc.push(err);
|
|
44181
|
-
}
|
|
44182
|
-
return acc;
|
|
44183
|
-
}, []);
|
|
44440
|
+
return filterDuplicateErrors(errorList, suppressDuplicateFiltering);
|
|
44184
44441
|
}
|
|
44185
44442
|
/** This function processes the `formData` with an optional user contributed `customValidate` function, which receives
|
|
44186
44443
|
* the form data and a `errorHandler` function that will be used to add custom validation errors for each field. Also
|
|
@@ -44194,10 +44451,11 @@ export default theme;`;
|
|
|
44194
44451
|
* @param [customValidate] - An optional function that is used to perform custom validation
|
|
44195
44452
|
* @param [transformErrors] - An optional function that is used to transform errors after AJV validation
|
|
44196
44453
|
* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
|
|
44454
|
+
* @param [suppressDuplicateFiltering] - Controls which duplicate filtering is suppressed; see `filterDuplicateErrors`
|
|
44197
44455
|
*/
|
|
44198
|
-
function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema) {
|
|
44456
|
+
function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema, suppressDuplicateFiltering) {
|
|
44199
44457
|
const { validationError: invalidSchemaError } = rawErrors;
|
|
44200
|
-
let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
|
|
44458
|
+
let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema, suppressDuplicateFiltering);
|
|
44201
44459
|
if (invalidSchemaError) {
|
|
44202
44460
|
errors = [...errors, { stack: invalidSchemaError.message }];
|
|
44203
44461
|
}
|
|
@@ -44232,9 +44490,10 @@ export default theme;`;
|
|
|
44232
44490
|
* @param [localizer] - If provided, is used to localize a list of Ajv `ErrorObject`s
|
|
44233
44491
|
*/
|
|
44234
44492
|
constructor(options, localizer) {
|
|
44235
|
-
const { additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass, extenderFn } = options;
|
|
44493
|
+
const { additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass, extenderFn, suppressDuplicateFiltering, } = options;
|
|
44236
44494
|
this.ajv = createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass, extenderFn);
|
|
44237
44495
|
this.localizer = localizer;
|
|
44496
|
+
this.suppressDuplicateFiltering = suppressDuplicateFiltering;
|
|
44238
44497
|
}
|
|
44239
44498
|
/** Resets the internal AJV validator to clear schemas from it. Can be helpful for resetting the validator for tests.
|
|
44240
44499
|
*/
|
|
@@ -44327,7 +44586,7 @@ export default theme;`;
|
|
|
44327
44586
|
*/
|
|
44328
44587
|
validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
|
|
44329
44588
|
const rawErrors = this.rawValidation(schema, formData);
|
|
44330
|
-
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);
|
|
44589
|
+
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema, this.suppressDuplicateFiltering);
|
|
44331
44590
|
}
|
|
44332
44591
|
/**
|
|
44333
44592
|
* This function checks if a schema needs to be added and if the root schemas don't match it removes the old root schema from the ajv instance and adds the new one.
|
|
@@ -44402,11 +44661,40 @@ export default theme;`;
|
|
|
44402
44661
|
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
|
|
44403
44662
|
}));
|
|
44404
44663
|
|
|
44664
|
+
/**
|
|
44665
|
+
* Extract props meant for MUI components from the `options` field of the `uiSchema`.
|
|
44666
|
+
* @param {UIOptionsType} options - The options from the uiSchema
|
|
44667
|
+
* @param {string[]} [propsToFilter] - An optional allowlist of props to return (used by button/icon components)
|
|
44668
|
+
* @param {boolean} [rjsfSlotPropsOnly] - If true, returns only `rjsfSlotProps`, preventing root-level prop bleeding
|
|
44669
|
+
* @returns {P}
|
|
44670
|
+
*/
|
|
44671
|
+
function getMuiProps(options, propsToFilter, rjsfSlotPropsOnly) {
|
|
44672
|
+
const muiProps = (options === null || options === void 0 ? void 0 : options.mui) || {};
|
|
44673
|
+
if (propsToFilter) {
|
|
44674
|
+
return Object.keys(muiProps)
|
|
44675
|
+
.filter((key) => propsToFilter.includes(key))
|
|
44676
|
+
.reduce((obj, key) => {
|
|
44677
|
+
obj[key] = muiProps[key];
|
|
44678
|
+
return obj;
|
|
44679
|
+
}, {});
|
|
44680
|
+
}
|
|
44681
|
+
return muiProps;
|
|
44682
|
+
}
|
|
44683
|
+
|
|
44405
44684
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
44406
44685
|
*/
|
|
44407
44686
|
function AddButton({ uiSchema, registry, ...props }) {
|
|
44408
44687
|
const { translateString } = registry;
|
|
44409
|
-
|
|
44688
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44689
|
+
const muiProps = getMuiProps(uiOptions, [
|
|
44690
|
+
'color',
|
|
44691
|
+
'disableFocusRipple',
|
|
44692
|
+
'disableRipple',
|
|
44693
|
+
'edge',
|
|
44694
|
+
'size',
|
|
44695
|
+
'sx',
|
|
44696
|
+
]);
|
|
44697
|
+
return (jsxRuntimeExports.jsx(IconButton$1, { title: translateString(TranslatableString.AddItemButton), ...props, color: 'primary', ...muiProps, children: jsxRuntimeExports.jsx(AddIcon, {}) }));
|
|
44410
44698
|
}
|
|
44411
44699
|
|
|
44412
44700
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -44424,7 +44712,8 @@ export default theme;`;
|
|
|
44424
44712
|
fontWeight: 'bold',
|
|
44425
44713
|
minWidth: 0,
|
|
44426
44714
|
};
|
|
44427
|
-
|
|
44715
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
44716
|
+
return (jsxRuntimeExports.jsxs(Grid, { container: true, alignItems: 'center', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemGridContainer, children: [jsxRuntimeExports.jsx(Grid, { size: { xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 }, style: { overflow: 'auto' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemGridItem, children: jsxRuntimeExports.jsx(Box, { mb: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemOuterBox, children: jsxRuntimeExports.jsx(Paper, { elevation: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemPaper, children: jsxRuntimeExports.jsx(Box, { p: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemInnerBox, children: children }) }) }) }), hasToolbar && (jsxRuntimeExports.jsx(Grid, { sx: { mt: hasDescription ? -5 : -1.5 }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemToolbarGrid, children: jsxRuntimeExports.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) }))] }));
|
|
44428
44717
|
}
|
|
44429
44718
|
|
|
44430
44719
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
@@ -44439,7 +44728,8 @@ export default theme;`;
|
|
|
44439
44728
|
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
44440
44729
|
// Button templates are not overridden in the uiSchema
|
|
44441
44730
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
44442
|
-
|
|
44731
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
44732
|
+
return (jsxRuntimeExports.jsx(Paper, { elevation: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayPaper, children: jsxRuntimeExports.jsxs(Box, { p: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayBox, children: [jsxRuntimeExports.jsx(ArrayFieldTitleTemplate, { fieldPathId: fieldPathId, title: uiOptions.title || title, schema: schema, uiSchema: uiSchema, required: required, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined }), jsxRuntimeExports.jsx(ArrayFieldDescriptionTemplate, { fieldPathId: fieldPathId, description: uiOptions.description || schema.description, schema: schema, uiSchema: uiSchema, registry: registry }), !showOptionalDataControlInTitle ? optionalDataControl : undefined, items, canAdd && (jsxRuntimeExports.jsx(Grid, { container: true, justifyContent: 'flex-end', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayAddButtonGridContainer, children: jsxRuntimeExports.jsx(Grid, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayAddButtonGridItem, children: jsxRuntimeExports.jsx(Box, { mt: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayAddButtonBox, children: jsxRuntimeExports.jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-array-item-add', onClick: onAddClick, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }) }))] }) }));
|
|
44443
44733
|
}
|
|
44444
44734
|
|
|
44445
44735
|
const TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
|
|
@@ -44455,8 +44745,11 @@ export default theme;`;
|
|
|
44455
44745
|
const { ClearButton } = registry.templates.ButtonTemplates;
|
|
44456
44746
|
// Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
|
|
44457
44747
|
const { step, min, max, accept, ...rest } = getInputProps(schema, type, options);
|
|
44748
|
+
const muiProps = getMuiProps(options);
|
|
44749
|
+
const { slotProps: muiSlotProps, ...otherMuiProps } = muiProps;
|
|
44458
44750
|
const htmlInputProps = {
|
|
44459
44751
|
...slotProps === null || slotProps === void 0 ? void 0 : slotProps.htmlInput,
|
|
44752
|
+
...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.htmlInput,
|
|
44460
44753
|
step,
|
|
44461
44754
|
min,
|
|
44462
44755
|
max,
|
|
@@ -44467,25 +44760,26 @@ export default theme;`;
|
|
|
44467
44760
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
44468
44761
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
44469
44762
|
const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type)
|
|
44470
|
-
? { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...InputLabelProps, shrink: true }
|
|
44471
|
-
: { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...InputLabelProps };
|
|
44763
|
+
? { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel, ...InputLabelProps, shrink: true }
|
|
44764
|
+
: { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel, ...InputLabelProps };
|
|
44472
44765
|
const _onClear = reactExports.useCallback((e) => {
|
|
44473
44766
|
var _a;
|
|
44474
44767
|
e.preventDefault();
|
|
44475
44768
|
e.stopPropagation();
|
|
44476
44769
|
onChange((_a = options.emptyValue) !== null && _a !== void 0 ? _a : '');
|
|
44477
44770
|
}, [onChange, options.emptyValue]);
|
|
44478
|
-
const inputProps = { ...InputProps, ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.input };
|
|
44771
|
+
const inputProps = { ...InputProps, ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.input, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.input };
|
|
44479
44772
|
if (options.allowClearTextInputs && value && !readonly && !disabled) {
|
|
44480
44773
|
const clearAdornment = (jsxRuntimeExports.jsx(InputAdornment, { position: 'end', children: jsxRuntimeExports.jsx(ClearButton, { registry: registry, onClick: _onClear }) }));
|
|
44481
44774
|
inputProps.endAdornment = !inputProps.endAdornment ? (clearAdornment) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [inputProps.endAdornment, clearAdornment] }));
|
|
44482
44775
|
}
|
|
44483
44776
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, { id: id, name: htmlName || id, placeholder: placeholder, label: labelValue(label || undefined, hideLabel, undefined), autoFocus: autofocus, required: required, disabled: disabled || readonly, slotProps: {
|
|
44484
44777
|
...slotProps,
|
|
44778
|
+
...muiSlotProps,
|
|
44485
44779
|
input: inputProps,
|
|
44486
44780
|
htmlInput: htmlInputProps,
|
|
44487
44781
|
inputLabel: DisplayInputLabelProps,
|
|
44488
|
-
}, ...rest, value: value || value === 0 ? value : '', error: rawErrors.length > 0, onChange: onChangeOverride || _onChange, onBlur: _onBlur, onFocus: _onFocus, ...textFieldProps, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }), jsxRuntimeExports.jsx(SchemaExamples, { id: id, schema: schema })] }));
|
|
44782
|
+
}, ...rest, value: value || value === 0 ? value : '', error: rawErrors.length > 0, onChange: onChangeOverride || _onChange, onBlur: _onBlur, onFocus: _onFocus, ...{ ...otherMuiProps, ...textFieldProps }, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }), jsxRuntimeExports.jsx(SchemaExamples, { id: id, schema: schema })] }));
|
|
44489
44783
|
}
|
|
44490
44784
|
|
|
44491
44785
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -44494,8 +44788,11 @@ export default theme;`;
|
|
|
44494
44788
|
*/
|
|
44495
44789
|
function DescriptionField(props) {
|
|
44496
44790
|
const { id, description, registry, uiSchema } = props;
|
|
44791
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44792
|
+
const muiProps = getMuiProps(uiOptions);
|
|
44793
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
44497
44794
|
if (description) {
|
|
44498
|
-
return (jsxRuntimeExports.jsx(Typography, { id: id, variant: 'subtitle2', style: { marginTop: '5px' }, children: jsxRuntimeExports.jsx(RichDescription, { description: description, registry: registry, uiSchema: uiSchema }) }));
|
|
44795
|
+
return (jsxRuntimeExports.jsx(Typography, { id: id, variant: 'subtitle2', style: { marginTop: '5px' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.descTypography, children: jsxRuntimeExports.jsx(RichDescription, { description: description, registry: registry, uiSchema: uiSchema }) }));
|
|
44499
44796
|
}
|
|
44500
44797
|
return null;
|
|
44501
44798
|
}
|
|
@@ -44508,10 +44805,12 @@ export default theme;`;
|
|
|
44508
44805
|
*
|
|
44509
44806
|
* @param props - The `ErrorListProps` for this component
|
|
44510
44807
|
*/
|
|
44511
|
-
function ErrorList({ errors, registry, }) {
|
|
44808
|
+
function ErrorList({ errors, registry, uiSchema, }) {
|
|
44512
44809
|
const { translateString } = registry;
|
|
44513
|
-
|
|
44514
|
-
|
|
44810
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44811
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
44812
|
+
return (jsxRuntimeExports.jsx(Paper, { elevation: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorPaper, children: jsxRuntimeExports.jsxs(Box, { mb: 2, p: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorBox, children: [jsxRuntimeExports.jsx(Typography, { variant: 'h6', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorTypography, children: translateString(TranslatableString.ErrorsLabel) }), jsxRuntimeExports.jsx(List, { dense: true, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorList, children: errors.map((error, i) => {
|
|
44813
|
+
return (jsxRuntimeExports.jsxs(ListItem, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorListItem, children: [jsxRuntimeExports.jsx(ListItemIcon, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorListItemIcon, children: jsxRuntimeExports.jsx(ErrorIcon, { color: 'error' }) }), jsxRuntimeExports.jsx(ListItemText, { primary: error.stack, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorListItemText })] }, i));
|
|
44515
44814
|
}) })] }) }));
|
|
44516
44815
|
}
|
|
44517
44816
|
|
|
@@ -44537,7 +44836,16 @@ export default theme;`;
|
|
|
44537
44836
|
|
|
44538
44837
|
function MuiIconButton(props) {
|
|
44539
44838
|
const { icon, color, uiSchema, registry, ...otherProps } = props;
|
|
44540
|
-
|
|
44839
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44840
|
+
const muiProps = getMuiProps(uiOptions, [
|
|
44841
|
+
'color',
|
|
44842
|
+
'disableFocusRipple',
|
|
44843
|
+
'disableRipple',
|
|
44844
|
+
'edge',
|
|
44845
|
+
'size',
|
|
44846
|
+
'sx',
|
|
44847
|
+
]);
|
|
44848
|
+
return (jsxRuntimeExports.jsx(IconButton$1, { ...muiProps, ...otherProps, size: 'small', color: color, children: icon }));
|
|
44541
44849
|
}
|
|
44542
44850
|
function CopyButton(props) {
|
|
44543
44851
|
const { registry: { translateString }, } = props;
|
|
@@ -44567,13 +44875,16 @@ export default theme;`;
|
|
|
44567
44875
|
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
44568
44876
|
*/
|
|
44569
44877
|
function FieldErrorTemplate(props) {
|
|
44570
|
-
const { errors = [], fieldPathId } = props;
|
|
44878
|
+
const { errors = [], fieldPathId, uiSchema } = props;
|
|
44571
44879
|
if (errors.length === 0) {
|
|
44572
44880
|
return null;
|
|
44573
44881
|
}
|
|
44574
44882
|
const id = errorId(fieldPathId);
|
|
44575
|
-
|
|
44576
|
-
|
|
44883
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44884
|
+
const muiProps = getMuiProps(uiOptions);
|
|
44885
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
44886
|
+
return (jsxRuntimeExports.jsx(List, { id: id, dense: true, disablePadding: true, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldErrorList, children: errors.map((error, i) => {
|
|
44887
|
+
return (jsxRuntimeExports.jsx(ListItem, { disableGutters: true, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldErrorListItem, children: jsxRuntimeExports.jsx(FormHelperText, { component: 'div', id: `${id}-${i}`, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldErrorFormHelperText, children: error }) }, i));
|
|
44577
44888
|
}) }));
|
|
44578
44889
|
}
|
|
44579
44890
|
|
|
@@ -44586,7 +44897,10 @@ export default theme;`;
|
|
|
44586
44897
|
if (!help) {
|
|
44587
44898
|
return null;
|
|
44588
44899
|
}
|
|
44589
|
-
|
|
44900
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44901
|
+
const muiProps = getMuiProps(uiOptions);
|
|
44902
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
44903
|
+
return (jsxRuntimeExports.jsx(FormHelperText, { component: 'div', id: helpId(fieldPathId), style: { marginTop: '5px' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.helpFormHelperText, children: jsxRuntimeExports.jsx(RichHelp, { help: help, registry: registry, uiSchema: uiSchema }) }));
|
|
44590
44904
|
}
|
|
44591
44905
|
|
|
44592
44906
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -44602,7 +44916,8 @@ export default theme;`;
|
|
|
44602
44916
|
return jsxRuntimeExports.jsx("div", { style: { display: 'none' }, children: children });
|
|
44603
44917
|
}
|
|
44604
44918
|
const isCheckbox = uiOptions.widget === 'checkbox';
|
|
44605
|
-
|
|
44919
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
|
|
44920
|
+
return (jsxRuntimeExports.jsx(WrapIfAdditionalTemplate, { classNames: classNames, style: style, disabled: disabled, id: id, label: label, displayLabel: displayLabel, rawDescription: rawDescription, onKeyRename: onKeyRename, onKeyRenameBlur: onKeyRenameBlur, onRemoveProperty: onRemoveProperty, readonly: readonly, required: required, schema: schema, uiSchema: uiSchema, registry: registry, children: jsxRuntimeExports.jsxs(FormControl, { fullWidth: true, error: rawErrors.length ? true : false, required: required, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldFormControl, sx: otherMuiProps.sx, className: otherMuiProps.className, children: [children, displayLabel && !isCheckbox && rawDescription ? (jsxRuntimeExports.jsx(Typography, { variant: 'caption', color: 'textSecondary', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldTypography, children: description })) : null, errors, help] }) }));
|
|
44606
44921
|
}
|
|
44607
44922
|
|
|
44608
44923
|
/** Renders a `GridTemplate` for mui, which is expecting the column sizing information coming in via the
|
|
@@ -44616,8 +44931,10 @@ export default theme;`;
|
|
|
44616
44931
|
}
|
|
44617
44932
|
|
|
44618
44933
|
function MultiSchemaFieldTemplate(props) {
|
|
44619
|
-
const { optionSchemaField, selector } = props;
|
|
44620
|
-
|
|
44934
|
+
const { optionSchemaField, selector, uiSchema } = props;
|
|
44935
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44936
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
44937
|
+
return (jsxRuntimeExports.jsxs(Box, { sx: { mb: 2 }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.multiBox, children: [jsxRuntimeExports.jsx(FormControl, { fullWidth: true, sx: { mb: 2 }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.multiFormControl, children: selector }), optionSchemaField] }));
|
|
44621
44938
|
}
|
|
44622
44939
|
|
|
44623
44940
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -44634,10 +44951,11 @@ export default theme;`;
|
|
|
44634
44951
|
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
44635
44952
|
// Button templates are not overridden in the uiSchema
|
|
44636
44953
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
44637
|
-
|
|
44954
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
44955
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [title && (jsxRuntimeExports.jsx(TitleFieldTemplate, { id: titleId(fieldPathId), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined })), description && (jsxRuntimeExports.jsx(DescriptionFieldTemplate, { id: descriptionId(fieldPathId), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), jsxRuntimeExports.jsxs(Grid, { container: true, spacing: 2, style: { marginTop: '10px' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.objectGridContainer, children: [!showOptionalDataControlInTitle ? optionalDataControl : undefined, properties.map((element, index) =>
|
|
44638
44956
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
44639
44957
|
// itself would otherwise still take up space.
|
|
44640
|
-
element.hidden ? (element.content) : (jsxRuntimeExports.jsx(Grid, { size: { xs: 12 }, style: { marginBottom: '10px' }, children: element.content }, index)))] }), canExpand(schema, uiSchema, formData) && (jsxRuntimeExports.jsx(Grid, { container: true, justifyContent: 'flex-end', children: jsxRuntimeExports.jsx(Grid, { children: jsxRuntimeExports.jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-object-property-expand', onClick: onAddProperty, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }))] }));
|
|
44958
|
+
element.hidden ? (element.content) : (jsxRuntimeExports.jsx(Grid, { size: { xs: 12 }, style: { marginBottom: '10px' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.objectGridItem, children: element.content }, index)))] }), canExpand(schema, uiSchema, formData) && (jsxRuntimeExports.jsx(Grid, { container: true, justifyContent: 'flex-end', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.objectAddButtonGridContainer, children: jsxRuntimeExports.jsx(Grid, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.objectAddButtonGridItem, children: jsxRuntimeExports.jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-object-property-expand', onClick: onAddProperty, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }))] }));
|
|
44641
44959
|
}
|
|
44642
44960
|
|
|
44643
44961
|
/** The OptionalDataControlsTemplate renders one of three different states. If
|
|
@@ -44649,12 +44967,12 @@ export default theme;`;
|
|
|
44649
44967
|
* @param props - The `OptionalDataControlsTemplateProps` for the template
|
|
44650
44968
|
*/
|
|
44651
44969
|
function OptionalDataControlsTemplate(props) {
|
|
44652
|
-
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
44970
|
+
const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;
|
|
44653
44971
|
if (onAddClick) {
|
|
44654
|
-
return (jsxRuntimeExports.jsx(MuiIconButton, { id: id, registry: registry, className: 'rjsf-add-optional-data', onClick: onAddClick, title: label, icon: jsxRuntimeExports.jsx(AddIcon, { fontSize: 'small' }) }));
|
|
44972
|
+
return (jsxRuntimeExports.jsx(MuiIconButton, { id: id, registry: registry, uiSchema: uiSchema, className: 'rjsf-add-optional-data', onClick: onAddClick, title: label, icon: jsxRuntimeExports.jsx(AddIcon, { fontSize: 'small' }) }));
|
|
44655
44973
|
}
|
|
44656
44974
|
else if (onRemoveClick) {
|
|
44657
|
-
return (jsxRuntimeExports.jsx(RemoveButton, { id: id, registry: registry, className: 'rjsf-remove-optional-data', onClick: onRemoveClick, title: label }));
|
|
44975
|
+
return (jsxRuntimeExports.jsx(RemoveButton, { id: id, registry: registry, uiSchema: uiSchema, className: 'rjsf-remove-optional-data', onClick: onRemoveClick, title: label }));
|
|
44658
44976
|
}
|
|
44659
44977
|
return jsxRuntimeExports.jsx("em", { id: id, children: label });
|
|
44660
44978
|
}
|
|
@@ -44666,19 +44984,24 @@ export default theme;`;
|
|
|
44666
44984
|
if (norender) {
|
|
44667
44985
|
return null;
|
|
44668
44986
|
}
|
|
44669
|
-
|
|
44987
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44988
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
|
|
44989
|
+
return (jsxRuntimeExports.jsx(Box, { marginTop: 3, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.submitBox, children: jsxRuntimeExports.jsx(Button, { type: 'submit', variant: 'contained', color: 'primary', ...submitButtonProps, ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.submitButton, children: submitText }) }));
|
|
44670
44990
|
}
|
|
44671
44991
|
|
|
44672
44992
|
/** The `TitleField` is the template to use to render the title of a field
|
|
44673
44993
|
*
|
|
44674
44994
|
* @param props - The `TitleFieldProps` for this component
|
|
44675
44995
|
*/
|
|
44676
|
-
function TitleField(
|
|
44677
|
-
|
|
44996
|
+
function TitleField(props) {
|
|
44997
|
+
const { id, title, optionalDataControl, uiSchema } = props;
|
|
44998
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44999
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
45000
|
+
let heading = (jsxRuntimeExports.jsx(Typography, { variant: 'h5', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.titleTypography, children: title }));
|
|
44678
45001
|
if (optionalDataControl) {
|
|
44679
|
-
heading = (jsxRuntimeExports.jsxs(Grid, { container: true, spacing: 0, children: [jsxRuntimeExports.jsx(Grid, { size: 'grow', children: heading }), jsxRuntimeExports.jsx(Grid, { justifyContent: 'flex-end', children: optionalDataControl })] }));
|
|
45002
|
+
heading = (jsxRuntimeExports.jsxs(Grid, { container: true, spacing: 0, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.titleGridContainer, children: [jsxRuntimeExports.jsx(Grid, { size: 'grow', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.titleGridItem, children: heading }), jsxRuntimeExports.jsx(Grid, { justifyContent: 'flex-end', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.titleOptionalDataGridItem, children: optionalDataControl })] }));
|
|
44680
45003
|
}
|
|
44681
|
-
return (jsxRuntimeExports.jsxs(Box, { id: id, mb: 1, mt: 1, children: [heading, jsxRuntimeExports.jsx(Divider, {})] }));
|
|
45004
|
+
return (jsxRuntimeExports.jsxs(Box, { id: id, mb: 1, mt: 1, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.titleBox, children: [heading, jsxRuntimeExports.jsx(Divider, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.titleDivider })] }));
|
|
44682
45005
|
}
|
|
44683
45006
|
|
|
44684
45007
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -44699,10 +45022,14 @@ export default theme;`;
|
|
|
44699
45022
|
paddingRight: 6,
|
|
44700
45023
|
fontWeight: 'bold',
|
|
44701
45024
|
};
|
|
45025
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
45026
|
+
const { rjsfSlotProps } = getMuiProps(uiOptions);
|
|
45027
|
+
const muiSlotProps = rjsfSlotProps;
|
|
44702
45028
|
if (!additional) {
|
|
44703
45029
|
return (jsxRuntimeExports.jsx("div", { className: classNames, style: style, children: children }));
|
|
44704
45030
|
}
|
|
44705
|
-
|
|
45031
|
+
const { wrapGridContainer, wrapKeyGridItem, wrapChildrenGridItem, wrapRemoveButtonGridItem } = muiSlotProps || {};
|
|
45032
|
+
return (jsxRuntimeExports.jsxs(Grid, { container: true, alignItems: 'flex-start', spacing: 2, className: classNames, style: style, ...wrapGridContainer, children: [jsxRuntimeExports.jsx(Grid, { size: 5.5, ...wrapKeyGridItem, children: jsxRuntimeExports.jsx(TextField, { fullWidth: true, required: required, label: displayLabel ? keyLabel : undefined, defaultValue: label, disabled: disabled || readonly, id: `${id}-key`, name: `${id}-key`, onBlur: !readonly ? onKeyRenameBlur : undefined, type: 'text' }, label) }), jsxRuntimeExports.jsx(Grid, { size: 5.5, ...wrapChildrenGridItem, children: children }), jsxRuntimeExports.jsx(Grid, { sx: { mt: 1.5 }, ...wrapRemoveButtonGridItem, children: jsxRuntimeExports.jsx(RemoveButton, { id: buttonId(id, 'remove'), className: 'rjsf-object-property-remove', iconType: 'default', style: btnStyle, disabled: disabled || readonly, onClick: onRemoveProperty, uiSchema: uiSchema, registry: registry }) })] }, `${id}-key`));
|
|
44706
45033
|
}
|
|
44707
45034
|
|
|
44708
45035
|
function generateTemplates() {
|
|
@@ -44750,7 +45077,8 @@ export default theme;`;
|
|
|
44750
45077
|
const _onBlur = () => onBlur(id, value);
|
|
44751
45078
|
const _onFocus = () => onFocus(id, value);
|
|
44752
45079
|
const description = (_a = options.description) !== null && _a !== void 0 ? _a : schema.description;
|
|
44753
|
-
|
|
45080
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
45081
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [!hideLabel && description && (jsxRuntimeExports.jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), jsxRuntimeExports.jsx(FormControlLabel, { ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formControlLabel, control: jsxRuntimeExports.jsx(Checkbox, { id: id, name: htmlName || id, checked: typeof value === 'undefined' ? false : Boolean(value), required: required, disabled: disabled || readonly, autoFocus: autofocus, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id), ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.checkbox }), label: labelValue(label, hideLabel, false) })] }));
|
|
44754
45082
|
}
|
|
44755
45083
|
|
|
44756
45084
|
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
@@ -44758,8 +45086,10 @@ export default theme;`;
|
|
|
44758
45086
|
*
|
|
44759
45087
|
* @param props - The `WidgetProps` for this component
|
|
44760
45088
|
*/
|
|
44761
|
-
function CheckboxesWidget(
|
|
45089
|
+
function CheckboxesWidget(props) {
|
|
45090
|
+
const { label, hideLabel, id, htmlName, disabled, options, value, autofocus, readonly, required, onChange, onBlur, onFocus, } = props;
|
|
44762
45091
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
45092
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
44763
45093
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
44764
45094
|
const _onChange = (index) => ({ target: { checked } }) => {
|
|
44765
45095
|
if (checked) {
|
|
@@ -44769,14 +45099,15 @@ export default theme;`;
|
|
|
44769
45099
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
44770
45100
|
}
|
|
44771
45101
|
};
|
|
44772
|
-
const _onBlur = ({ target }) => onBlur(id,
|
|
44773
|
-
const _onFocus = ({ target }) => onFocus(id,
|
|
44774
|
-
|
|
45102
|
+
const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
45103
|
+
const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
45104
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
45105
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [labelValue(jsxRuntimeExports.jsx(FormLabel, { required: required, htmlFor: id, children: label || undefined }), hideLabel), jsxRuntimeExports.jsx(FormGroup, { ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formGroup, id: id, row: !!inline, children: Array.isArray(enumOptions) &&
|
|
44775
45106
|
enumOptions.map((option, index) => {
|
|
44776
45107
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
44777
45108
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
44778
|
-
const checkbox = (jsxRuntimeExports.jsx(Checkbox, { id: optionId(id, index), name: htmlName || id, checked: checked, disabled: disabled || itemDisabled || readonly, autoFocus: autofocus && index === 0, onChange: _onChange(index), onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id) }));
|
|
44779
|
-
return
|
|
45109
|
+
const checkbox = (jsxRuntimeExports.jsx(Checkbox, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.checkbox, id: optionId(id, index), name: htmlName || id, checked: checked, disabled: disabled || itemDisabled || readonly, autoFocus: autofocus && index === 0, onChange: _onChange(index), onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id) }));
|
|
45110
|
+
return (reactExports.createElement(FormControlLabel, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formControlLabel, control: checkbox, key: index, label: option.label }));
|
|
44780
45111
|
}) })] }));
|
|
44781
45112
|
}
|
|
44782
45113
|
|
|
@@ -44785,18 +45116,20 @@ export default theme;`;
|
|
|
44785
45116
|
*
|
|
44786
45117
|
* @param props - The `WidgetProps` for this component
|
|
44787
45118
|
*/
|
|
44788
|
-
function RadioWidget(
|
|
44789
|
-
|
|
45119
|
+
function RadioWidget(props) {
|
|
45120
|
+
const { id, htmlName, options, value, required, disabled, readonly, label, hideLabel, onChange, onBlur, onFocus } = props;
|
|
44790
45121
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
44791
|
-
const
|
|
44792
|
-
const
|
|
44793
|
-
const
|
|
45122
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
45123
|
+
const _onChange = (_, value) => onChange(enumOptionValueDecoder(value, enumOptions, optionValueFormat, emptyValue));
|
|
45124
|
+
const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
45125
|
+
const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
44794
45126
|
const row = options ? options.inline : false;
|
|
44795
|
-
const
|
|
44796
|
-
|
|
45127
|
+
const selectValue = enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, '');
|
|
45128
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
45129
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [labelValue(jsxRuntimeExports.jsx(FormLabel, { required: required, htmlFor: id, children: label || undefined }), hideLabel), jsxRuntimeExports.jsx(RadioGroup, { ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.radioGroup, id: id, name: htmlName || id, value: selectValue, row: row, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id), children: Array.isArray(enumOptions) &&
|
|
44797
45130
|
enumOptions.map((option, index) => {
|
|
44798
45131
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
44799
|
-
const radio = (
|
|
45132
|
+
const radio = (reactExports.createElement(FormControlLabel, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formControlLabel, control: jsxRuntimeExports.jsx(Radio, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.radio, name: htmlName || id, id: optionId(id, index), color: 'primary' }), label: option.label, value: enumOptionValueEncoder(option.value, index, optionValueFormat), key: index, disabled: disabled || itemDisabled || readonly }));
|
|
44800
45133
|
return radio;
|
|
44801
45134
|
}) })] }));
|
|
44802
45135
|
}
|
|
@@ -44814,7 +45147,8 @@ export default theme;`;
|
|
|
44814
45147
|
};
|
|
44815
45148
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
44816
45149
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
44817
|
-
|
|
45150
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
45151
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [labelValue(jsxRuntimeExports.jsx(FormLabel, { required: required, htmlFor: id, children: label || undefined }), hideLabel), jsxRuntimeExports.jsx(Slider, { disabled: disabled || readonly, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, valueLabelDisplay: 'auto', ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.slider, ...sliderProps, "aria-describedby": ariaDescribedByIds(id) })] }));
|
|
44818
45152
|
}
|
|
44819
45153
|
|
|
44820
45154
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
@@ -44822,29 +45156,35 @@ export default theme;`;
|
|
|
44822
45156
|
*
|
|
44823
45157
|
* @param props - The `WidgetProps` for this component
|
|
44824
45158
|
*/
|
|
44825
|
-
function SelectWidget({
|
|
44826
|
-
|
|
45159
|
+
function SelectWidget(props) {
|
|
45160
|
+
const { schema, id, name, // remove this from textFieldProps
|
|
45161
|
+
htmlName, options, label, hideLabel, required, disabled, placeholder, readonly, value, multiple, autofocus, onChange, onBlur, onFocus, errorSchema, rawErrors = [], registry, uiSchema, hideError, ...textFieldProps } = props;
|
|
44827
45162
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
44828
|
-
|
|
44829
|
-
const
|
|
44830
|
-
const
|
|
44831
|
-
const
|
|
44832
|
-
const
|
|
44833
|
-
const
|
|
44834
|
-
const
|
|
45163
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
45164
|
+
const isMultiple = typeof multiple === 'undefined' ? false : !!multiple;
|
|
45165
|
+
const emptyValue = isMultiple ? [] : '';
|
|
45166
|
+
const isEmpty = typeof value === 'undefined' || (isMultiple && value.length < 1) || (!isMultiple && value === emptyValue);
|
|
45167
|
+
const _onChange = ({ target: { value } }) => onChange(enumOptionValueDecoder(value, enumOptions, optionValueFormat, optEmptyVal));
|
|
45168
|
+
const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
45169
|
+
const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
45170
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
44835
45171
|
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
|
|
44836
|
-
const showPlaceholderOption = !
|
|
44837
|
-
return (jsxRuntimeExports.jsxs(TextField, { id: id, name: htmlName || id, label: labelValue(label || undefined, hideLabel, undefined), value:
|
|
44838
|
-
: true,
|
|
44839
|
-
...
|
|
44840
|
-
|
|
44841
|
-
|
|
44842
|
-
|
|
44843
|
-
|
|
45172
|
+
const showPlaceholderOption = !isMultiple && schema.default === undefined;
|
|
45173
|
+
return (jsxRuntimeExports.jsxs(TextField, { id: id, name: htmlName || id, label: labelValue(label || undefined, hideLabel, undefined), value: enumOptionSelectedValue(value, enumOptions, isMultiple, optionValueFormat, emptyValue), required: required, disabled: disabled || readonly, autoFocus: autofocus, autoComplete: autocomplete, placeholder: placeholder, error: rawErrors.length > 0, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, ...{ ...otherMuiProps, ...textFieldRemainingProps }, select // Apply this and the following props after the potential overrides defined in textFieldProps
|
|
45174
|
+
: true, slotProps: {
|
|
45175
|
+
...muiSlotProps,
|
|
45176
|
+
inputLabel: {
|
|
45177
|
+
...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel,
|
|
45178
|
+
shrink: !isEmpty,
|
|
45179
|
+
},
|
|
45180
|
+
select: {
|
|
45181
|
+
...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.select,
|
|
45182
|
+
multiple,
|
|
45183
|
+
},
|
|
44844
45184
|
}, "aria-describedby": ariaDescribedByIds(id), children: [showPlaceholderOption && jsxRuntimeExports.jsx(MenuItem, { value: '', children: placeholder }), Array.isArray(enumOptions) &&
|
|
44845
45185
|
enumOptions.map(({ value, label }, i) => {
|
|
44846
45186
|
const disabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1;
|
|
44847
|
-
return (jsxRuntimeExports.jsx(MenuItem, { value:
|
|
45187
|
+
return (jsxRuntimeExports.jsx(MenuItem, { value: enumOptionValueEncoder(value, i, optionValueFormat), disabled: disabled, children: label }, i));
|
|
44848
45188
|
})] }));
|
|
44849
45189
|
}
|
|
44850
45190
|
|