@crowdin/app-project-module 1.13.2 → 1.15.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 +4 -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 +825 -312
- package/out/static/ui/form.bundle.js.map +1 -1
- package/out/types.d.ts +6 -0
- package/out/util/log-sanitizer.d.ts +18 -0
- package/out/util/log-sanitizer.js +169 -0
- package/package.json +3 -3
|
@@ -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);
|
|
@@ -27177,6 +27185,15 @@ export default theme;`;
|
|
|
27177
27185
|
/** @type {(value: string) => boolean} */
|
|
27178
27186
|
const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
27179
27187
|
|
|
27188
|
+
/** @type {(value: string) => boolean} */
|
|
27189
|
+
const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
27190
|
+
|
|
27191
|
+
/** @type {(value: string) => boolean} */
|
|
27192
|
+
const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
27193
|
+
|
|
27194
|
+
/** @type {(value: string) => boolean} */
|
|
27195
|
+
const isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
|
|
27196
|
+
|
|
27180
27197
|
/**
|
|
27181
27198
|
* @param {Array<string>} input
|
|
27182
27199
|
* @returns {string}
|
|
@@ -27435,31 +27452,126 @@ export default theme;`;
|
|
|
27435
27452
|
}
|
|
27436
27453
|
|
|
27437
27454
|
/**
|
|
27438
|
-
*
|
|
27439
|
-
*
|
|
27440
|
-
*
|
|
27455
|
+
* Re-escape RFC 3986 gen-delims that must not appear literally in the host.
|
|
27456
|
+
* After the URI regex parses, these characters cannot be literal in the host
|
|
27457
|
+
* field, so any that appear after decoding came from percent-encoding and
|
|
27458
|
+
* must be restored to prevent authority structure changes.
|
|
27459
|
+
*
|
|
27460
|
+
* @param {string} host
|
|
27461
|
+
* @param {boolean} isIP - true for IPv4/IPv6 hosts (skip colon re-escaping)
|
|
27462
|
+
* @returns {string}
|
|
27441
27463
|
*/
|
|
27442
|
-
|
|
27443
|
-
|
|
27444
|
-
|
|
27445
|
-
|
|
27446
|
-
|
|
27447
|
-
|
|
27448
|
-
|
|
27449
|
-
|
|
27450
|
-
|
|
27451
|
-
|
|
27464
|
+
const HOST_DELIMS = { '@': '%40', '/': '%2F', '?': '%3F', '#': '%23', ':': '%3A' };
|
|
27465
|
+
const HOST_DELIM_RE = /[@/?#:]/g;
|
|
27466
|
+
const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
27467
|
+
|
|
27468
|
+
function reescapeHostDelimiters (host, isIP) {
|
|
27469
|
+
const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
|
|
27470
|
+
re.lastIndex = 0;
|
|
27471
|
+
return host.replace(re, (ch) => HOST_DELIMS[ch])
|
|
27472
|
+
}
|
|
27473
|
+
|
|
27474
|
+
/**
|
|
27475
|
+
* Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
|
|
27476
|
+
* Reserved delimiters such as `%2F` and `%2E` stay escaped.
|
|
27477
|
+
*
|
|
27478
|
+
* @param {string} input
|
|
27479
|
+
* @param {boolean} [decodeUnreserved=false]
|
|
27480
|
+
* @returns {string}
|
|
27481
|
+
*/
|
|
27482
|
+
function normalizePercentEncoding (input, decodeUnreserved = false) {
|
|
27483
|
+
if (input.indexOf('%') === -1) {
|
|
27484
|
+
return input
|
|
27452
27485
|
}
|
|
27453
|
-
|
|
27454
|
-
|
|
27486
|
+
|
|
27487
|
+
let output = '';
|
|
27488
|
+
|
|
27489
|
+
for (let i = 0; i < input.length; i++) {
|
|
27490
|
+
if (input[i] === '%' && i + 2 < input.length) {
|
|
27491
|
+
const hex = input.slice(i + 1, i + 3);
|
|
27492
|
+
if (isHexPair(hex)) {
|
|
27493
|
+
const normalizedHex = hex.toUpperCase();
|
|
27494
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
27495
|
+
|
|
27496
|
+
if (decodeUnreserved && isUnreserved(decoded)) {
|
|
27497
|
+
output += decoded;
|
|
27498
|
+
} else {
|
|
27499
|
+
output += '%' + normalizedHex;
|
|
27500
|
+
}
|
|
27501
|
+
|
|
27502
|
+
i += 2;
|
|
27503
|
+
continue
|
|
27504
|
+
}
|
|
27505
|
+
}
|
|
27506
|
+
|
|
27507
|
+
output += input[i];
|
|
27455
27508
|
}
|
|
27456
|
-
|
|
27457
|
-
|
|
27509
|
+
|
|
27510
|
+
return output
|
|
27511
|
+
}
|
|
27512
|
+
|
|
27513
|
+
/**
|
|
27514
|
+
* Normalizes path data without turning reserved escapes into live path syntax.
|
|
27515
|
+
* Valid escapes are uppercased, raw unsafe characters are escaped, and only
|
|
27516
|
+
* unreserved bytes that are not `.` are decoded.
|
|
27517
|
+
*
|
|
27518
|
+
* @param {string} input
|
|
27519
|
+
* @returns {string}
|
|
27520
|
+
*/
|
|
27521
|
+
function normalizePathEncoding (input) {
|
|
27522
|
+
let output = '';
|
|
27523
|
+
|
|
27524
|
+
for (let i = 0; i < input.length; i++) {
|
|
27525
|
+
if (input[i] === '%' && i + 2 < input.length) {
|
|
27526
|
+
const hex = input.slice(i + 1, i + 3);
|
|
27527
|
+
if (isHexPair(hex)) {
|
|
27528
|
+
const normalizedHex = hex.toUpperCase();
|
|
27529
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
27530
|
+
|
|
27531
|
+
if (decoded !== '.' && isUnreserved(decoded)) {
|
|
27532
|
+
output += decoded;
|
|
27533
|
+
} else {
|
|
27534
|
+
output += '%' + normalizedHex;
|
|
27535
|
+
}
|
|
27536
|
+
|
|
27537
|
+
i += 2;
|
|
27538
|
+
continue
|
|
27539
|
+
}
|
|
27540
|
+
}
|
|
27541
|
+
|
|
27542
|
+
if (isPathCharacter(input[i])) {
|
|
27543
|
+
output += input[i];
|
|
27544
|
+
} else {
|
|
27545
|
+
output += escape(input[i]);
|
|
27546
|
+
}
|
|
27458
27547
|
}
|
|
27459
|
-
|
|
27460
|
-
|
|
27548
|
+
|
|
27549
|
+
return output
|
|
27550
|
+
}
|
|
27551
|
+
|
|
27552
|
+
/**
|
|
27553
|
+
* Escapes a component while preserving existing valid percent escapes.
|
|
27554
|
+
*
|
|
27555
|
+
* @param {string} input
|
|
27556
|
+
* @returns {string}
|
|
27557
|
+
*/
|
|
27558
|
+
function escapePreservingEscapes (input) {
|
|
27559
|
+
let output = '';
|
|
27560
|
+
|
|
27561
|
+
for (let i = 0; i < input.length; i++) {
|
|
27562
|
+
if (input[i] === '%' && i + 2 < input.length) {
|
|
27563
|
+
const hex = input.slice(i + 1, i + 3);
|
|
27564
|
+
if (isHexPair(hex)) {
|
|
27565
|
+
output += '%' + hex.toUpperCase();
|
|
27566
|
+
i += 2;
|
|
27567
|
+
continue
|
|
27568
|
+
}
|
|
27569
|
+
}
|
|
27570
|
+
|
|
27571
|
+
output += escape(input[i]);
|
|
27461
27572
|
}
|
|
27462
|
-
|
|
27573
|
+
|
|
27574
|
+
return output
|
|
27463
27575
|
}
|
|
27464
27576
|
|
|
27465
27577
|
/**
|
|
@@ -27481,7 +27593,7 @@ export default theme;`;
|
|
|
27481
27593
|
if (ipV6res.isIPV6 === true) {
|
|
27482
27594
|
host = `[${ipV6res.escapedHost}]`;
|
|
27483
27595
|
} else {
|
|
27484
|
-
host =
|
|
27596
|
+
host = reescapeHostDelimiters(host, false);
|
|
27485
27597
|
}
|
|
27486
27598
|
}
|
|
27487
27599
|
uriTokens.push(host);
|
|
@@ -27497,7 +27609,10 @@ export default theme;`;
|
|
|
27497
27609
|
utils = {
|
|
27498
27610
|
nonSimpleDomain,
|
|
27499
27611
|
recomposeAuthority,
|
|
27500
|
-
|
|
27612
|
+
reescapeHostDelimiters,
|
|
27613
|
+
normalizePercentEncoding,
|
|
27614
|
+
normalizePathEncoding,
|
|
27615
|
+
escapePreservingEscapes,
|
|
27501
27616
|
removeDotSegments,
|
|
27502
27617
|
isIPv4,
|
|
27503
27618
|
isUUID,
|
|
@@ -27788,7 +27903,7 @@ export default theme;`;
|
|
|
27788
27903
|
if (hasRequiredFastUri) return fastUri.exports;
|
|
27789
27904
|
hasRequiredFastUri = 1;
|
|
27790
27905
|
|
|
27791
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority,
|
|
27906
|
+
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
|
|
27792
27907
|
const { SCHEMES, getSchemeHandler } = requireSchemes();
|
|
27793
27908
|
|
|
27794
27909
|
/**
|
|
@@ -27799,7 +27914,7 @@ export default theme;`;
|
|
|
27799
27914
|
*/
|
|
27800
27915
|
function normalize (uri, options) {
|
|
27801
27916
|
if (typeof uri === 'string') {
|
|
27802
|
-
uri = /** @type {T} */ (
|
|
27917
|
+
uri = /** @type {T} */ (normalizeString(uri, options));
|
|
27803
27918
|
} else if (typeof uri === 'object') {
|
|
27804
27919
|
uri = /** @type {T} */ (parse(serialize(uri, options), options));
|
|
27805
27920
|
}
|
|
@@ -27894,21 +28009,10 @@ export default theme;`;
|
|
|
27894
28009
|
* @returns {boolean}
|
|
27895
28010
|
*/
|
|
27896
28011
|
function equal (uriA, uriB, options) {
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
|
|
27900
|
-
} else if (typeof uriA === 'object') {
|
|
27901
|
-
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
27902
|
-
}
|
|
27903
|
-
|
|
27904
|
-
if (typeof uriB === 'string') {
|
|
27905
|
-
uriB = unescape(uriB);
|
|
27906
|
-
uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
|
|
27907
|
-
} else if (typeof uriB === 'object') {
|
|
27908
|
-
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
27909
|
-
}
|
|
28012
|
+
const normalizedA = normalizeComparableURI(uriA, options);
|
|
28013
|
+
const normalizedB = normalizeComparableURI(uriB, options);
|
|
27910
28014
|
|
|
27911
|
-
return
|
|
28015
|
+
return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase()
|
|
27912
28016
|
}
|
|
27913
28017
|
|
|
27914
28018
|
/**
|
|
@@ -27944,13 +28048,13 @@ export default theme;`;
|
|
|
27944
28048
|
|
|
27945
28049
|
if (component.path !== undefined) {
|
|
27946
28050
|
if (!options.skipEscape) {
|
|
27947
|
-
component.path =
|
|
28051
|
+
component.path = escapePreservingEscapes(component.path);
|
|
27948
28052
|
|
|
27949
28053
|
if (component.scheme !== undefined) {
|
|
27950
28054
|
component.path = component.path.split('%3A').join(':');
|
|
27951
28055
|
}
|
|
27952
28056
|
} else {
|
|
27953
|
-
component.path =
|
|
28057
|
+
component.path = normalizePercentEncoding(component.path);
|
|
27954
28058
|
}
|
|
27955
28059
|
}
|
|
27956
28060
|
|
|
@@ -28001,12 +28105,29 @@ export default theme;`;
|
|
|
28001
28105
|
|
|
28002
28106
|
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
28003
28107
|
|
|
28108
|
+
/**
|
|
28109
|
+
* @param {import('./types/index').URIComponent} parsed
|
|
28110
|
+
* @param {RegExpMatchArray} matches
|
|
28111
|
+
* @returns {string|undefined}
|
|
28112
|
+
*/
|
|
28113
|
+
function getParseError (parsed, matches) {
|
|
28114
|
+
if (matches[2] !== undefined && parsed.path && parsed.path[0] !== '/') {
|
|
28115
|
+
return 'URI path must start with "/" when authority is present.'
|
|
28116
|
+
}
|
|
28117
|
+
|
|
28118
|
+
if (typeof parsed.port === 'number' && (parsed.port < 0 || parsed.port > 65535)) {
|
|
28119
|
+
return 'URI port is malformed.'
|
|
28120
|
+
}
|
|
28121
|
+
|
|
28122
|
+
return undefined
|
|
28123
|
+
}
|
|
28124
|
+
|
|
28004
28125
|
/**
|
|
28005
28126
|
* @param {string} uri
|
|
28006
28127
|
* @param {import('./types/index').Options} [opts]
|
|
28007
|
-
* @returns
|
|
28128
|
+
* @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean }}
|
|
28008
28129
|
*/
|
|
28009
|
-
function
|
|
28130
|
+
function parseWithStatus (uri, opts) {
|
|
28010
28131
|
const options = Object.assign({}, opts);
|
|
28011
28132
|
/** @type {import('./types/index').URIComponent} */
|
|
28012
28133
|
const parsed = {
|
|
@@ -28019,6 +28140,8 @@ export default theme;`;
|
|
|
28019
28140
|
fragment: undefined
|
|
28020
28141
|
};
|
|
28021
28142
|
|
|
28143
|
+
let malformedAuthorityOrPort = false;
|
|
28144
|
+
|
|
28022
28145
|
let isIP = false;
|
|
28023
28146
|
if (options.reference === 'suffix') {
|
|
28024
28147
|
if (options.scheme) {
|
|
@@ -28044,6 +28167,13 @@ export default theme;`;
|
|
|
28044
28167
|
if (isNaN(parsed.port)) {
|
|
28045
28168
|
parsed.port = matches[5];
|
|
28046
28169
|
}
|
|
28170
|
+
|
|
28171
|
+
const parseError = getParseError(parsed, matches);
|
|
28172
|
+
if (parseError !== undefined) {
|
|
28173
|
+
parsed.error = parsed.error || parseError;
|
|
28174
|
+
malformedAuthorityOrPort = true;
|
|
28175
|
+
}
|
|
28176
|
+
|
|
28047
28177
|
if (parsed.host) {
|
|
28048
28178
|
const ipv4result = isIPv4(parsed.host);
|
|
28049
28179
|
if (ipv4result === false) {
|
|
@@ -28092,14 +28222,18 @@ export default theme;`;
|
|
|
28092
28222
|
parsed.scheme = unescape(parsed.scheme);
|
|
28093
28223
|
}
|
|
28094
28224
|
if (parsed.host !== undefined) {
|
|
28095
|
-
parsed.host = unescape(parsed.host);
|
|
28225
|
+
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
28096
28226
|
}
|
|
28097
28227
|
}
|
|
28098
28228
|
if (parsed.path) {
|
|
28099
|
-
parsed.path =
|
|
28229
|
+
parsed.path = normalizePathEncoding(parsed.path);
|
|
28100
28230
|
}
|
|
28101
28231
|
if (parsed.fragment) {
|
|
28102
|
-
|
|
28232
|
+
try {
|
|
28233
|
+
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
28234
|
+
} catch {
|
|
28235
|
+
parsed.error = parsed.error || 'URI malformed';
|
|
28236
|
+
}
|
|
28103
28237
|
}
|
|
28104
28238
|
}
|
|
28105
28239
|
|
|
@@ -28110,7 +28244,54 @@ export default theme;`;
|
|
|
28110
28244
|
} else {
|
|
28111
28245
|
parsed.error = parsed.error || 'URI can not be parsed.';
|
|
28112
28246
|
}
|
|
28113
|
-
return parsed
|
|
28247
|
+
return { parsed, malformedAuthorityOrPort }
|
|
28248
|
+
}
|
|
28249
|
+
|
|
28250
|
+
/**
|
|
28251
|
+
* @param {string} uri
|
|
28252
|
+
* @param {import('./types/index').Options} [opts]
|
|
28253
|
+
* @returns
|
|
28254
|
+
*/
|
|
28255
|
+
function parse (uri, opts) {
|
|
28256
|
+
return parseWithStatus(uri, opts).parsed
|
|
28257
|
+
}
|
|
28258
|
+
|
|
28259
|
+
/**
|
|
28260
|
+
* @param {string} uri
|
|
28261
|
+
* @param {import('./types/index').Options} [opts]
|
|
28262
|
+
* @returns {string}
|
|
28263
|
+
*/
|
|
28264
|
+
function normalizeString (uri, opts) {
|
|
28265
|
+
return normalizeStringWithStatus(uri, opts).normalized
|
|
28266
|
+
}
|
|
28267
|
+
|
|
28268
|
+
/**
|
|
28269
|
+
* @param {string} uri
|
|
28270
|
+
* @param {import('./types/index').Options} [opts]
|
|
28271
|
+
* @returns {{ normalized: string, malformedAuthorityOrPort: boolean }}
|
|
28272
|
+
*/
|
|
28273
|
+
function normalizeStringWithStatus (uri, opts) {
|
|
28274
|
+
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
28275
|
+
return {
|
|
28276
|
+
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
28277
|
+
malformedAuthorityOrPort
|
|
28278
|
+
}
|
|
28279
|
+
}
|
|
28280
|
+
|
|
28281
|
+
/**
|
|
28282
|
+
* @param {import ('./types/index').URIComponent|string} uri
|
|
28283
|
+
* @param {import('./types/index').Options} [opts]
|
|
28284
|
+
* @returns {string|undefined}
|
|
28285
|
+
*/
|
|
28286
|
+
function normalizeComparableURI (uri, opts) {
|
|
28287
|
+
if (typeof uri === 'string') {
|
|
28288
|
+
const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
|
|
28289
|
+
return malformedAuthorityOrPort ? undefined : normalized
|
|
28290
|
+
}
|
|
28291
|
+
|
|
28292
|
+
if (typeof uri === 'object') {
|
|
28293
|
+
return serialize(uri, opts)
|
|
28294
|
+
}
|
|
28114
28295
|
}
|
|
28115
28296
|
|
|
28116
28297
|
const fastUri$1 = {
|
|
@@ -31286,6 +31467,67 @@ export default theme;`;
|
|
|
31286
31467
|
return replaceStringParameters(stringToTranslate, params);
|
|
31287
31468
|
}
|
|
31288
31469
|
|
|
31470
|
+
/** Determines whether the given `value` is (one of) the `selected` value(s).
|
|
31471
|
+
*
|
|
31472
|
+
* @param value - The value being checked to see if it is selected
|
|
31473
|
+
* @param selected - The current selected value or list of values
|
|
31474
|
+
* @returns - true if the `value` is one of the `selected` ones, false otherwise
|
|
31475
|
+
*/
|
|
31476
|
+
function enumOptionsIsSelected(value, selected) {
|
|
31477
|
+
if (Array.isArray(selected)) {
|
|
31478
|
+
return selected.some((sel) => deepEquals(sel, value));
|
|
31479
|
+
}
|
|
31480
|
+
return deepEquals(selected, value);
|
|
31481
|
+
}
|
|
31482
|
+
|
|
31483
|
+
/** Returns the index(es) of the options in `allEnumOptions` whose value(s) match the ones in `value`. All the
|
|
31484
|
+
* `enumOptions` are filtered based on whether they are a "selected" `value` and the index of each selected one is then
|
|
31485
|
+
* stored in an array. If `multiple` is true, that array is returned, otherwise the first element in the array is
|
|
31486
|
+
* returned.
|
|
31487
|
+
*
|
|
31488
|
+
* @param value - The single value or list of values for which indexes are desired
|
|
31489
|
+
* @param [allEnumOptions=[]] - The list of all the known enumOptions
|
|
31490
|
+
* @param [multiple=false] - Optional flag, if true will return a list of index, otherwise a single one
|
|
31491
|
+
* @returns - A single string index for the first `value` in `allEnumOptions`, if not `multiple`. Otherwise, the list
|
|
31492
|
+
* of indexes for (each of) the value(s) in `value`.
|
|
31493
|
+
*/
|
|
31494
|
+
function enumOptionsIndexForValue(value, allEnumOptions = [], multiple = false) {
|
|
31495
|
+
const selectedIndexes = allEnumOptions
|
|
31496
|
+
.map((opt, index) => (enumOptionsIsSelected(opt.value, value) ? String(index) : undefined))
|
|
31497
|
+
.filter((opt) => typeof opt !== 'undefined');
|
|
31498
|
+
if (!multiple) {
|
|
31499
|
+
return selectedIndexes[0];
|
|
31500
|
+
}
|
|
31501
|
+
return selectedIndexes;
|
|
31502
|
+
}
|
|
31503
|
+
|
|
31504
|
+
/** Computes the value to pass to a select element's `value` attribute.
|
|
31505
|
+
*
|
|
31506
|
+
* When `format` is `'realValue'`, converts form data values to strings.
|
|
31507
|
+
* When `format` is `'indexed'` (the default), resolves to index-based values via
|
|
31508
|
+
* `enumOptionsIndexForValue`. Returns `emptyValue` when the current value is empty.
|
|
31509
|
+
*
|
|
31510
|
+
* @param value - The current form data value
|
|
31511
|
+
* @param enumOptions - The available enum options
|
|
31512
|
+
* @param multiple - Whether the select allows multiple selections
|
|
31513
|
+
* @param [format='indexed'] - How option values are encoded on the DOM
|
|
31514
|
+
* @param emptyValue - The value to return when the selection is empty
|
|
31515
|
+
* @returns The value to use for the select element's `value` attribute
|
|
31516
|
+
*/
|
|
31517
|
+
function enumOptionSelectedValue(value, enumOptions, multiple, format = 'indexed', emptyValue) {
|
|
31518
|
+
const isEmpty = typeof value === 'undefined' ||
|
|
31519
|
+
(multiple && Array.isArray(value) && value.length < 1) ||
|
|
31520
|
+
(!multiple && value === emptyValue);
|
|
31521
|
+
if (isEmpty) {
|
|
31522
|
+
return emptyValue;
|
|
31523
|
+
}
|
|
31524
|
+
if (format === 'realValue') {
|
|
31525
|
+
return multiple ? value.map(String) : String(value);
|
|
31526
|
+
}
|
|
31527
|
+
const indexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
31528
|
+
return typeof indexes === 'undefined' ? emptyValue : indexes;
|
|
31529
|
+
}
|
|
31530
|
+
|
|
31289
31531
|
/** Returns the value(s) from `allEnumOptions` at the index(es) provided by `valueIndex`. If `valueIndex` is not an
|
|
31290
31532
|
* array AND the index is not valid for `allEnumOptions`, `emptyValue` is returned. If `valueIndex` is an array, AND it
|
|
31291
31533
|
* contains an invalid index, the returned array will have the resulting undefined values filtered out, leaving only
|
|
@@ -31310,6 +31552,84 @@ export default theme;`;
|
|
|
31310
31552
|
return option ? option.value : emptyValue;
|
|
31311
31553
|
}
|
|
31312
31554
|
|
|
31555
|
+
/** Resolves a single DOM value string back to its typed enum value in `'realValue'` mode.
|
|
31556
|
+
*
|
|
31557
|
+
* First attempts a reverse lookup by matching `String(opt.value)` against the input.
|
|
31558
|
+
* If no option matches and the input parses as a valid index, falls back to the
|
|
31559
|
+
* option at that index — this is how object/array enum values round-trip, since
|
|
31560
|
+
* they are encoded as indices by the encoder.
|
|
31561
|
+
*
|
|
31562
|
+
* @param value - A single string value from a DOM attribute
|
|
31563
|
+
* @param enumOptions - The available enum options
|
|
31564
|
+
* @param emptyValue - The value to return when the input is empty, options are missing, or no match is found
|
|
31565
|
+
* @returns The original typed enum value, or `emptyValue`
|
|
31566
|
+
*/
|
|
31567
|
+
function decodeSingle(value, enumOptions, emptyValue) {
|
|
31568
|
+
if (value === '' || !Array.isArray(enumOptions)) {
|
|
31569
|
+
return emptyValue;
|
|
31570
|
+
}
|
|
31571
|
+
const match = enumOptions.find((opt) => String(opt.value) === value);
|
|
31572
|
+
if (match) {
|
|
31573
|
+
return match.value;
|
|
31574
|
+
}
|
|
31575
|
+
// Fallback: value might be an index (for object/array enum values)
|
|
31576
|
+
const index = Number(value);
|
|
31577
|
+
if (!isNaN(index) && index >= 0 && index < enumOptions.length) {
|
|
31578
|
+
return enumOptions[index].value;
|
|
31579
|
+
}
|
|
31580
|
+
return emptyValue;
|
|
31581
|
+
}
|
|
31582
|
+
/** Decodes a string from a DOM value attribute back to a typed enum value.
|
|
31583
|
+
*
|
|
31584
|
+
* When `format` is `'realValue'`, does a reverse lookup: finds the enum option
|
|
31585
|
+
* whose `String(value)` matches the input string and returns the original typed value.
|
|
31586
|
+
* For object/array values that were encoded as indices, falls back to index resolution.
|
|
31587
|
+
*
|
|
31588
|
+
* When `format` is `'indexed'` (the default), uses index-based resolution via
|
|
31589
|
+
* `enumOptionsValueForIndex`.
|
|
31590
|
+
*
|
|
31591
|
+
* @param value - The string value(s) from the DOM
|
|
31592
|
+
* @param enumOptions - The available enum options
|
|
31593
|
+
* @param [format='indexed'] - How the values were encoded on the DOM
|
|
31594
|
+
* @param emptyValue - The value to return for empty/missing selections
|
|
31595
|
+
* @returns The original typed enum value(s)
|
|
31596
|
+
*/
|
|
31597
|
+
function enumOptionValueDecoder(value, enumOptions, format = 'indexed', emptyValue) {
|
|
31598
|
+
if (format !== 'realValue') {
|
|
31599
|
+
return enumOptionsValueForIndex(value, enumOptions, emptyValue);
|
|
31600
|
+
}
|
|
31601
|
+
if (Array.isArray(value)) {
|
|
31602
|
+
return value.map((v) => decodeSingle(v, enumOptions, emptyValue));
|
|
31603
|
+
}
|
|
31604
|
+
return decodeSingle(value, enumOptions, emptyValue);
|
|
31605
|
+
}
|
|
31606
|
+
|
|
31607
|
+
/** Encodes an enum option value into a string for a DOM value attribute.
|
|
31608
|
+
*
|
|
31609
|
+
* When `format` is `'realValue'`, primitive values are converted via `String()`.
|
|
31610
|
+
* Non-primitive values (objects, arrays) fall back to the index since
|
|
31611
|
+
* `String()` would produce `"[object Object]"`.
|
|
31612
|
+
*
|
|
31613
|
+
* When `format` is `'indexed'` (the default), returns the index as a string.
|
|
31614
|
+
*
|
|
31615
|
+
* @param value - The typed enum value
|
|
31616
|
+
* @param index - The option's position in the enumOptions array
|
|
31617
|
+
* @param [format='indexed'] - How to encode the value for the DOM attribute
|
|
31618
|
+
* @returns The string to use as the DOM value attribute
|
|
31619
|
+
*/
|
|
31620
|
+
function enumOptionValueEncoder(value, index, format = 'indexed') {
|
|
31621
|
+
if (format !== 'realValue') {
|
|
31622
|
+
return String(index);
|
|
31623
|
+
}
|
|
31624
|
+
if (isNil(value)) {
|
|
31625
|
+
return '';
|
|
31626
|
+
}
|
|
31627
|
+
if (typeof value === 'object') {
|
|
31628
|
+
return String(index);
|
|
31629
|
+
}
|
|
31630
|
+
return String(value);
|
|
31631
|
+
}
|
|
31632
|
+
|
|
31313
31633
|
/** Removes the enum option value at the `valueIndex` from the currently `selected` (list of) value(s). If `selected` is
|
|
31314
31634
|
* a list, then that list is updated to remove the enum option value with the `valueIndex` in `allEnumOptions`. If it is
|
|
31315
31635
|
* a single value, then if the enum option value with the `valueIndex` in `allEnumOptions` matches `selected`, undefined
|
|
@@ -31330,40 +31650,6 @@ export default theme;`;
|
|
|
31330
31650
|
return deepEquals(value, selected) ? undefined : selected;
|
|
31331
31651
|
}
|
|
31332
31652
|
|
|
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
31653
|
/** Add the enum option value at the `valueIndex` to the list of `selected` values in the proper order as defined by
|
|
31368
31654
|
* `allEnumOptions`
|
|
31369
31655
|
*
|
|
@@ -31774,6 +32060,15 @@ export default theme;`;
|
|
|
31774
32060
|
}
|
|
31775
32061
|
}
|
|
31776
32062
|
}
|
|
32063
|
+
// For date/time input types, propagate formatMinimum/formatMaximum to min/max
|
|
32064
|
+
if (['date', 'datetime-local', 'time', 'week', 'month'].includes(inputProps.type)) {
|
|
32065
|
+
if (schema.formatMinimum !== undefined) {
|
|
32066
|
+
inputProps.min = schema.formatMinimum;
|
|
32067
|
+
}
|
|
32068
|
+
if (schema.formatMaximum !== undefined) {
|
|
32069
|
+
inputProps.max = schema.formatMaximum;
|
|
32070
|
+
}
|
|
32071
|
+
}
|
|
31777
32072
|
if (options.autocomplete) {
|
|
31778
32073
|
inputProps.autoComplete = options.autocomplete;
|
|
31779
32074
|
}
|
|
@@ -31783,6 +32078,23 @@ export default theme;`;
|
|
|
31783
32078
|
return inputProps;
|
|
31784
32079
|
}
|
|
31785
32080
|
|
|
32081
|
+
/** Resolves the effective `optionValueFormat` for enum-backed widgets.
|
|
32082
|
+
*
|
|
32083
|
+
* Provides a single source of truth for the default DOM encoding format
|
|
32084
|
+
* (`'indexed'`) used by `SelectWidget`, `RadioWidget`, and `CheckboxesWidget`.
|
|
32085
|
+
* Widgets should call this helper once and pass the result to
|
|
32086
|
+
* `enumOptionValueEncoder`, `enumOptionValueDecoder`, and `enumOptionSelectedValue`
|
|
32087
|
+
* rather than reading `options.optionValueFormat` directly.
|
|
32088
|
+
*
|
|
32089
|
+
* @param options - The widget options (typically from the `options` prop, already
|
|
32090
|
+
* resolved from `ui:options` and `ui:globalOptions`)
|
|
32091
|
+
* @returns The resolved `OptionValueFormat`, defaulting to `'indexed'` when not set
|
|
32092
|
+
*/
|
|
32093
|
+
function getOptionValueFormat(options) {
|
|
32094
|
+
var _a;
|
|
32095
|
+
return (_a = options === null || options === void 0 ? void 0 : options.optionValueFormat) !== null && _a !== void 0 ? _a : 'indexed';
|
|
32096
|
+
}
|
|
32097
|
+
|
|
31786
32098
|
/** The default submit button options, exported for testing purposes
|
|
31787
32099
|
*/
|
|
31788
32100
|
const DEFAULT_OPTIONS = {
|
|
@@ -32264,6 +32576,111 @@ export default theme;`;
|
|
|
32264
32576
|
return get(regOrFc, [...lookupPath, toLookup], fallback);
|
|
32265
32577
|
}
|
|
32266
32578
|
|
|
32579
|
+
/** Determines whether a value is considered "empty" for the purposes of optional object pruning.
|
|
32580
|
+
* A value is empty if it is `undefined`, `null`, an empty string, or an object where all own
|
|
32581
|
+
* properties are themselves empty.
|
|
32582
|
+
*
|
|
32583
|
+
* @param value - The value to check
|
|
32584
|
+
* @returns True if the value is considered empty
|
|
32585
|
+
*/
|
|
32586
|
+
function isValueEmpty(value) {
|
|
32587
|
+
if (isNil(value) || value === '') {
|
|
32588
|
+
return true;
|
|
32589
|
+
}
|
|
32590
|
+
if (Array.isArray(value)) {
|
|
32591
|
+
// An empty array is considered empty; a non-empty array is not
|
|
32592
|
+
return value.length === 0;
|
|
32593
|
+
}
|
|
32594
|
+
if (isObject$3(value)) {
|
|
32595
|
+
const obj = value;
|
|
32596
|
+
const keys = Object.keys(obj);
|
|
32597
|
+
return keys.every((key) => isValueEmpty(obj[key]));
|
|
32598
|
+
}
|
|
32599
|
+
return false;
|
|
32600
|
+
}
|
|
32601
|
+
/** Recursively removes optional objects from the `formData` that are empty (i.e., all their fields
|
|
32602
|
+
* are undefined, null, empty strings, or themselves empty optional objects). This solves the problem
|
|
32603
|
+
* where interacting with fields inside an optional object "activates" it permanently, making the
|
|
32604
|
+
* form unsubmittable when the optional object has required inner fields.
|
|
32605
|
+
*
|
|
32606
|
+
* An object property is considered "optional" when it is NOT listed in its parent schema's `required`
|
|
32607
|
+
* array.
|
|
32608
|
+
*
|
|
32609
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
32610
|
+
* @param schema - The JSON schema describing the `formData`
|
|
32611
|
+
* @param [rootSchema] - The root schema, used primarily to look up `$ref`s
|
|
32612
|
+
* @param [formData] - The current form data to prune
|
|
32613
|
+
* @returns - A new copy of `formData` with empty optional objects removed, or `undefined` if the
|
|
32614
|
+
* entire formData was pruned
|
|
32615
|
+
*/
|
|
32616
|
+
function removeOptionalEmptyObjects(validator, schema, rootSchema, formData) {
|
|
32617
|
+
if (!isObject$3(schema)) {
|
|
32618
|
+
return formData;
|
|
32619
|
+
}
|
|
32620
|
+
const resolvedSchema = retrieveSchema(validator, schema, rootSchema, formData);
|
|
32621
|
+
if (Array.isArray(formData)) {
|
|
32622
|
+
const itemsSchema = resolvedSchema.items;
|
|
32623
|
+
if (!itemsSchema) {
|
|
32624
|
+
return formData;
|
|
32625
|
+
}
|
|
32626
|
+
let hasChanges = false;
|
|
32627
|
+
const mapped = formData.map((item, index) => {
|
|
32628
|
+
let itemSchema = itemsSchema;
|
|
32629
|
+
if (Array.isArray(itemsSchema)) {
|
|
32630
|
+
itemSchema = itemsSchema[index] || resolvedSchema.additionalItems || {};
|
|
32631
|
+
}
|
|
32632
|
+
const cleaned = removeOptionalEmptyObjects(validator, itemSchema, rootSchema, item);
|
|
32633
|
+
if (cleaned !== item) {
|
|
32634
|
+
hasChanges = true;
|
|
32635
|
+
}
|
|
32636
|
+
return cleaned === undefined ? {} : cleaned;
|
|
32637
|
+
});
|
|
32638
|
+
// Although T is an array type here, we still need to cast it back to T since TS
|
|
32639
|
+
// doesn't narrow the generic T automatically
|
|
32640
|
+
return hasChanges ? mapped : formData;
|
|
32641
|
+
}
|
|
32642
|
+
const { properties, required: requiredFields = [] } = resolvedSchema;
|
|
32643
|
+
if (!isObject$3(formData) || !properties) {
|
|
32644
|
+
return formData;
|
|
32645
|
+
}
|
|
32646
|
+
const result = {};
|
|
32647
|
+
const data = formData;
|
|
32648
|
+
let hasAnyValue = false;
|
|
32649
|
+
for (const key of Object.keys(data)) {
|
|
32650
|
+
const value = data[key];
|
|
32651
|
+
const propertySchema = (properties[key] || {});
|
|
32652
|
+
const isRequired = requiredFields.includes(key);
|
|
32653
|
+
const isObj = isObject$3(value);
|
|
32654
|
+
const isArr = Array.isArray(value);
|
|
32655
|
+
if ((isObj || isArr) && properties[key]) {
|
|
32656
|
+
// Recursively process nested objects and arrays
|
|
32657
|
+
const cleaned = removeOptionalEmptyObjects(validator, propertySchema, rootSchema, value);
|
|
32658
|
+
if (!isRequired && isValueEmpty(cleaned)) {
|
|
32659
|
+
// This is an optional property and the cleaned result is empty — omit it
|
|
32660
|
+
continue;
|
|
32661
|
+
}
|
|
32662
|
+
result[key] = cleaned;
|
|
32663
|
+
hasAnyValue = true;
|
|
32664
|
+
}
|
|
32665
|
+
else if (!isRequired && isValueEmpty(value) && properties[key]) {
|
|
32666
|
+
// Optional scalar property that is empty — omit it
|
|
32667
|
+
continue;
|
|
32668
|
+
}
|
|
32669
|
+
else {
|
|
32670
|
+
result[key] = value;
|
|
32671
|
+
if (!isValueEmpty(value)) {
|
|
32672
|
+
hasAnyValue = true;
|
|
32673
|
+
}
|
|
32674
|
+
}
|
|
32675
|
+
}
|
|
32676
|
+
// If the entire object ended up empty after pruning, return undefined so that the
|
|
32677
|
+
// caller (which may itself be a recursive call) can decide whether to keep or drop it
|
|
32678
|
+
if (!hasAnyValue && Object.keys(result).length === 0) {
|
|
32679
|
+
return undefined;
|
|
32680
|
+
}
|
|
32681
|
+
return result;
|
|
32682
|
+
}
|
|
32683
|
+
|
|
32267
32684
|
/** Given a list of `properties` and an `order` list, returns a list that contains the `properties` ordered correctly.
|
|
32268
32685
|
* If `order` is not an array, then the untouched `properties` list is returned. Otherwise `properties` is ordered per
|
|
32269
32686
|
* the `order` list. If `order` contains a '*' then any `properties` that are not mentioned explicity in `order` will be
|
|
@@ -32334,104 +32751,18 @@ export default theme;`;
|
|
|
32334
32751
|
};
|
|
32335
32752
|
}
|
|
32336
32753
|
|
|
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
32754
|
/** Resolves the uiSchema for a given schema, considering `ui:definitions` stored in the registry.
|
|
32423
32755
|
*
|
|
32424
|
-
*
|
|
32425
|
-
*
|
|
32426
|
-
*
|
|
32427
|
-
*
|
|
32428
|
-
* from `registry.uiSchemaDefinitions` and merges it with any local uiSchema overrides.
|
|
32756
|
+
* Called at runtime for each field. When the schema contains a `$ref`, looks up the corresponding
|
|
32757
|
+
* uiSchema definition from `registry.uiSchemaDefinitions` and merges it with local overrides.
|
|
32758
|
+
* For schemas with `oneOf`/`anyOf` branches, also populates `uiSchema[keyword][i]` for branches
|
|
32759
|
+
* whose `$ref` matches a definition, so `MultiSchemaField` can read dropdown option titles.
|
|
32429
32760
|
*
|
|
32430
32761
|
* Resolution order (later sources override earlier):
|
|
32431
32762
|
* 1. `ui:definitions[$ref]` - base definition from registry
|
|
32432
32763
|
* 2. `localUiSchema` - local overrides at current path
|
|
32433
32764
|
*
|
|
32434
|
-
* @param schema - The JSON schema (may
|
|
32765
|
+
* @param schema - The JSON schema (may contain `$ref` or `RJSF_REF_KEY`)
|
|
32435
32766
|
* @param localUiSchema - The uiSchema at the current path (local overrides)
|
|
32436
32767
|
* @param registry - The registry containing `uiSchemaDefinitions`
|
|
32437
32768
|
* @returns - The resolved uiSchema with definitions merged in
|
|
@@ -32439,14 +32770,54 @@ export default theme;`;
|
|
|
32439
32770
|
function resolveUiSchema(schema, localUiSchema, registry) {
|
|
32440
32771
|
var _a, _b;
|
|
32441
32772
|
const ref = ((_a = schema[RJSF_REF_KEY]) !== null && _a !== void 0 ? _a : schema[REF_KEY]);
|
|
32442
|
-
const
|
|
32773
|
+
const definitions = registry.uiSchemaDefinitions;
|
|
32774
|
+
const definitionUiSchema = ref && definitions ? definitions[ref] : undefined;
|
|
32775
|
+
let result;
|
|
32443
32776
|
if (!definitionUiSchema) {
|
|
32444
|
-
|
|
32777
|
+
result = localUiSchema || {};
|
|
32778
|
+
}
|
|
32779
|
+
else if (!localUiSchema || isEmpty$1(localUiSchema)) {
|
|
32780
|
+
result = { ...definitionUiSchema };
|
|
32781
|
+
}
|
|
32782
|
+
else {
|
|
32783
|
+
result = mergeObjects(definitionUiSchema, localUiSchema);
|
|
32445
32784
|
}
|
|
32446
|
-
|
|
32447
|
-
|
|
32785
|
+
// Walk oneOf/anyOf branches to populate uiSchema[keyword][i] so MultiSchemaField
|
|
32786
|
+
// can read dropdown option titles at the parent level.
|
|
32787
|
+
if (definitions) {
|
|
32788
|
+
let resolvedSchema = schema;
|
|
32789
|
+
if (ref && schema[REF_KEY] && !schema[RJSF_REF_KEY]) {
|
|
32790
|
+
try {
|
|
32791
|
+
resolvedSchema = findSchemaDefinition(ref, registry.rootSchema);
|
|
32792
|
+
}
|
|
32793
|
+
catch (e) {
|
|
32794
|
+
console.warn('could not resolve $ref in resolveUiSchema:\n', e);
|
|
32795
|
+
return result;
|
|
32796
|
+
}
|
|
32797
|
+
}
|
|
32798
|
+
for (const keyword of [ONE_OF_KEY, ANY_OF_KEY]) {
|
|
32799
|
+
const schemaOptions = resolvedSchema[keyword];
|
|
32800
|
+
if (!Array.isArray(schemaOptions) || schemaOptions.length === 0) {
|
|
32801
|
+
continue;
|
|
32802
|
+
}
|
|
32803
|
+
const currentUiSchemaArray = result[keyword];
|
|
32804
|
+
const uiSchemaArray = Array.isArray(currentUiSchemaArray) ? [...currentUiSchemaArray] : [];
|
|
32805
|
+
let hasExpanded = false;
|
|
32806
|
+
for (let i = 0; i < schemaOptions.length; i++) {
|
|
32807
|
+
const option = schemaOptions[i];
|
|
32808
|
+
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]);
|
|
32809
|
+
if (optionRef && optionRef in definitions) {
|
|
32810
|
+
const optionUiSchema = (uiSchemaArray[i] || {});
|
|
32811
|
+
uiSchemaArray[i] = mergeObjects(definitions[optionRef], optionUiSchema);
|
|
32812
|
+
hasExpanded = true;
|
|
32813
|
+
}
|
|
32814
|
+
}
|
|
32815
|
+
if (hasExpanded) {
|
|
32816
|
+
result[keyword] = uiSchemaArray;
|
|
32817
|
+
}
|
|
32818
|
+
}
|
|
32448
32819
|
}
|
|
32449
|
-
return
|
|
32820
|
+
return result;
|
|
32450
32821
|
}
|
|
32451
32822
|
|
|
32452
32823
|
/** Check to see if a `schema` specifies that a value must be true. This happens when:
|
|
@@ -35302,11 +35673,14 @@ export default theme;`;
|
|
|
35302
35673
|
const { schema: rawSchema, uiSchema = {}, formData, errorSchema, fieldPathId, name, required = false, disabled, readonly, hideError, onBlur, onFocus, onChange, registry, title, } = props;
|
|
35303
35674
|
const { fields, schemaUtils, translateString, globalUiOptions } = registry;
|
|
35304
35675
|
const { OptionalDataControlsField } = fields;
|
|
35676
|
+
const formDataRef = reactExports.useRef(formData);
|
|
35677
|
+
formDataRef.current = formData;
|
|
35305
35678
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData, true);
|
|
35306
35679
|
const uiOptions = getUiOptions(uiSchema, globalUiOptions);
|
|
35307
35680
|
const { properties: schemaProperties = {} } = schema;
|
|
35308
35681
|
// All the children will use childFieldPathId if present in the props, falling back to the fieldPathId
|
|
35309
35682
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
35683
|
+
const lastRenamedProperty = reactExports.useRef({ previousKey: '', currentKey: undefined });
|
|
35310
35684
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
35311
35685
|
const description = uiOptions.description ?? schema.description;
|
|
35312
35686
|
const renderOptionalField = shouldRenderOptionalField(registry, schema, required, uiSchema);
|
|
@@ -35366,6 +35740,10 @@ export default theme;`;
|
|
|
35366
35740
|
// Cast this to make the `set` work properly
|
|
35367
35741
|
set(newFormData, newKey, newValue);
|
|
35368
35742
|
}
|
|
35743
|
+
if (lastRenamedProperty.current.previousKey === newKey) {
|
|
35744
|
+
lastRenamedProperty.current.currentKey = newKey;
|
|
35745
|
+
lastRenamedProperty.current.previousKey = getAvailableKey(newKey, newFormData);
|
|
35746
|
+
}
|
|
35369
35747
|
onChange(newFormData, childFieldPathId.path);
|
|
35370
35748
|
}, [formData, onChange, registry, childFieldPathId, getAvailableKey, schema]);
|
|
35371
35749
|
/** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
|
|
@@ -35377,9 +35755,10 @@ export default theme;`;
|
|
|
35377
35755
|
*/
|
|
35378
35756
|
const handleKeyRename = reactExports.useCallback((oldKey, newKey) => {
|
|
35379
35757
|
if (oldKey !== newKey) {
|
|
35380
|
-
const
|
|
35758
|
+
const currentFormData = formDataRef.current;
|
|
35759
|
+
const actualNewKey = getAvailableKey(newKey, currentFormData);
|
|
35381
35760
|
const newFormData = {
|
|
35382
|
-
...
|
|
35761
|
+
...currentFormData,
|
|
35383
35762
|
};
|
|
35384
35763
|
const newKeys = { [oldKey]: actualNewKey };
|
|
35385
35764
|
const keyValues = Object.keys(newFormData).map((key) => {
|
|
@@ -35387,15 +35766,31 @@ export default theme;`;
|
|
|
35387
35766
|
return { [newKey]: newFormData[key] };
|
|
35388
35767
|
});
|
|
35389
35768
|
const renamedObj = Object.assign({}, ...keyValues);
|
|
35769
|
+
formDataRef.current = renamedObj;
|
|
35770
|
+
if (oldKey !== lastRenamedProperty.current.currentKey) {
|
|
35771
|
+
lastRenamedProperty.current.previousKey = oldKey;
|
|
35772
|
+
}
|
|
35773
|
+
lastRenamedProperty.current.currentKey = actualNewKey;
|
|
35390
35774
|
onChange(renamedObj, childFieldPathId.path);
|
|
35391
35775
|
}
|
|
35392
|
-
}, [
|
|
35776
|
+
}, [onChange, childFieldPathId, getAvailableKey]);
|
|
35393
35777
|
/** Handles the remove click which calls the `onChange` callback with the special ADDITIONAL_PROPERTY_FIELD_REMOVE
|
|
35394
35778
|
* value for the path plus the key to be removed
|
|
35395
35779
|
*/
|
|
35396
35780
|
const handleRemoveProperty = reactExports.useCallback((key) => {
|
|
35397
35781
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
35398
35782
|
}, [onChange, childFieldPathId]);
|
|
35783
|
+
/** Returns the stable React key for a property. For the most recently renamed
|
|
35784
|
+
* additional property, returns the previous key so that React reuses the
|
|
35785
|
+
* existing component instance instead of unmounting/remounting it. This
|
|
35786
|
+
* preserves DOM focus naturally without manual focus management.
|
|
35787
|
+
*/
|
|
35788
|
+
const getStableKey = reactExports.useCallback((property) => {
|
|
35789
|
+
if (lastRenamedProperty.current.currentKey === property) {
|
|
35790
|
+
return lastRenamedProperty.current.previousKey;
|
|
35791
|
+
}
|
|
35792
|
+
return property;
|
|
35793
|
+
}, []);
|
|
35399
35794
|
if (!renderOptionalField || hasFormData) {
|
|
35400
35795
|
try {
|
|
35401
35796
|
const properties = Object.keys(schemaProperties);
|
|
@@ -35415,7 +35810,7 @@ export default theme;`;
|
|
|
35415
35810
|
const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, name, ADDITIONAL_PROPERTY_FLAG]);
|
|
35416
35811
|
const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
|
|
35417
35812
|
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));
|
|
35813
|
+
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
35814
|
return {
|
|
35420
35815
|
content,
|
|
35421
35816
|
name,
|
|
@@ -36160,7 +36555,7 @@ export default theme;`;
|
|
|
36160
36555
|
return (jsxRuntimeExports.jsx("div", { className: uiClassNames, style: style, children: children }));
|
|
36161
36556
|
}
|
|
36162
36557
|
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 }) })] }) }));
|
|
36558
|
+
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
36559
|
}
|
|
36165
36560
|
|
|
36166
36561
|
function templates() {
|
|
@@ -36233,10 +36628,12 @@ export default theme;`;
|
|
|
36233
36628
|
*
|
|
36234
36629
|
* @param props - The `WidgetProps` for this component
|
|
36235
36630
|
*/
|
|
36236
|
-
function CheckboxesWidget$1({ id, disabled, options
|
|
36631
|
+
function CheckboxesWidget$1({ id, disabled, options, value, autofocus = false, readonly, onChange, onBlur, onFocus, htmlName, }) {
|
|
36632
|
+
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
36633
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
36237
36634
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
36238
|
-
const handleBlur = reactExports.useCallback(({ target }) => onBlur(id,
|
|
36239
|
-
const handleFocus = reactExports.useCallback(({ target }) => onFocus(id,
|
|
36635
|
+
const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, id, enumOptions, emptyValue, optionValueFormat]);
|
|
36636
|
+
const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, id, enumOptions, emptyValue, optionValueFormat]);
|
|
36240
36637
|
return (jsxRuntimeExports.jsx("div", { className: 'checkboxes', id: id, children: Array.isArray(enumOptions) &&
|
|
36241
36638
|
enumOptions.map((option, index) => {
|
|
36242
36639
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
@@ -36250,7 +36647,7 @@ export default theme;`;
|
|
|
36250
36647
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
36251
36648
|
}
|
|
36252
36649
|
};
|
|
36253
|
-
const checkbox = (jsxRuntimeExports.jsxs("span", { children: [jsxRuntimeExports.jsx("input", { type: 'checkbox', id: optionId(id, index), name: htmlName || id, checked: checked, value:
|
|
36650
|
+
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
36651
|
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
36652
|
}) }));
|
|
36256
36653
|
}
|
|
@@ -36368,15 +36765,16 @@ export default theme;`;
|
|
|
36368
36765
|
*/
|
|
36369
36766
|
function RadioWidget$1({ options, value, required, disabled, readonly, autofocus = false, onBlur, onFocus, onChange, id, htmlName, }) {
|
|
36370
36767
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
36371
|
-
const
|
|
36372
|
-
const
|
|
36768
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
36769
|
+
const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, enumOptions, emptyValue, id, optionValueFormat]);
|
|
36770
|
+
const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, enumOptions, emptyValue, id, optionValueFormat]);
|
|
36373
36771
|
return (jsxRuntimeExports.jsx("div", { className: 'field-radio-group', id: id, role: 'radiogroup', children: Array.isArray(enumOptions) &&
|
|
36374
36772
|
enumOptions.map((option, i) => {
|
|
36375
36773
|
const checked = enumOptionsIsSelected(option.value, value);
|
|
36376
36774
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
36377
36775
|
const disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
36378
36776
|
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:
|
|
36777
|
+
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
36778
|
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
36779
|
}) }));
|
|
36382
36780
|
}
|
|
@@ -36470,24 +36868,25 @@ export default theme;`;
|
|
|
36470
36868
|
function SelectWidget$1({ schema, id, options, value, required, disabled, readonly, multiple = false, autofocus = false, onChange, onBlur, onFocus, placeholder, htmlName, }) {
|
|
36471
36869
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
36472
36870
|
const emptyValue = multiple ? [] : '';
|
|
36871
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
36473
36872
|
const handleFocus = reactExports.useCallback((event) => {
|
|
36474
36873
|
const newValue = getValue(event, multiple);
|
|
36475
|
-
return onFocus(id,
|
|
36476
|
-
}, [onFocus, id, multiple, enumOptions, optEmptyVal]);
|
|
36874
|
+
return onFocus(id, enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
36875
|
+
}, [onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
36477
36876
|
const handleBlur = reactExports.useCallback((event) => {
|
|
36478
36877
|
const newValue = getValue(event, multiple);
|
|
36479
|
-
return onBlur(id,
|
|
36480
|
-
}, [onBlur, id, multiple, enumOptions, optEmptyVal]);
|
|
36878
|
+
return onBlur(id, enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
36879
|
+
}, [onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
36481
36880
|
const handleChange = reactExports.useCallback((event) => {
|
|
36482
36881
|
const newValue = getValue(event, multiple);
|
|
36483
|
-
return onChange(
|
|
36484
|
-
}, [onChange, multiple, enumOptions, optEmptyVal]);
|
|
36485
|
-
const
|
|
36882
|
+
return onChange(enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
36883
|
+
}, [onChange, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
36884
|
+
const selectValue = enumOptionSelectedValue(value, enumOptions, multiple, optionValueFormat, emptyValue);
|
|
36486
36885
|
const showPlaceholderOption = !multiple && schema.default === undefined;
|
|
36487
|
-
return (jsxRuntimeExports.jsxs("select", { id: id, name: htmlName || id, multiple: multiple, role: 'combobox', className: 'form-control', value:
|
|
36886
|
+
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
36887
|
enumOptions.map(({ value, label }, i) => {
|
|
36489
36888
|
const disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;
|
|
36490
|
-
return (jsxRuntimeExports.jsx("option", { value:
|
|
36889
|
+
return (jsxRuntimeExports.jsx("option", { value: enumOptionValueEncoder(value, i, optionValueFormat), disabled: disabled, children: label }, i));
|
|
36491
36890
|
})] }));
|
|
36492
36891
|
}
|
|
36493
36892
|
|
|
@@ -36825,10 +37224,6 @@ export default theme;`;
|
|
|
36825
37224
|
// Only store a new registry when the props cause a different one to be created
|
|
36826
37225
|
const newRegistry = this.getRegistry(props, rootSchema, schemaUtils);
|
|
36827
37226
|
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
37227
|
// Only compute a new `fieldPathId` when the `idPrefix` is different than the existing fieldPathId's ID_KEY
|
|
36833
37228
|
const fieldPathId = state.fieldPathId && state.fieldPathId?.[ID_KEY] === registry.globalFormOptions.idPrefix
|
|
36834
37229
|
? state.fieldPathId
|
|
@@ -36836,7 +37231,7 @@ export default theme;`;
|
|
|
36836
37231
|
const nextState = {
|
|
36837
37232
|
schemaUtils,
|
|
36838
37233
|
schema: rootSchema,
|
|
36839
|
-
uiSchema
|
|
37234
|
+
uiSchema,
|
|
36840
37235
|
fieldPathId,
|
|
36841
37236
|
formData,
|
|
36842
37237
|
edit,
|
|
@@ -37010,7 +37405,7 @@ export default theme;`;
|
|
|
37010
37405
|
this._isProcessingUserChange = true;
|
|
37011
37406
|
const { newValue, path, id } = this.pendingChanges[0];
|
|
37012
37407
|
const { newErrorSchema } = this.pendingChanges[0];
|
|
37013
|
-
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
|
|
37408
|
+
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange, removeEmptyOptionalObjects } = this.props;
|
|
37014
37409
|
const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
|
|
37015
37410
|
let { customErrors, errorSchema: originalErrorSchema } = this.state;
|
|
37016
37411
|
const rootPathId = fieldPathId.path[0] || '';
|
|
@@ -37049,6 +37444,13 @@ export default theme;`;
|
|
|
37049
37444
|
formData: newFormData,
|
|
37050
37445
|
};
|
|
37051
37446
|
}
|
|
37447
|
+
if (removeEmptyOptionalObjects) {
|
|
37448
|
+
newFormData = removeOptionalEmptyObjects(schemaUtils.getValidator(), schema, schemaUtils.getRootSchema(), newFormData);
|
|
37449
|
+
state = {
|
|
37450
|
+
...state,
|
|
37451
|
+
formData: newFormData,
|
|
37452
|
+
};
|
|
37453
|
+
}
|
|
37052
37454
|
if (newErrorSchema) {
|
|
37053
37455
|
// First check to see if there is an existing validation error on this path...
|
|
37054
37456
|
// @ts-expect-error TS2590, because getting from the error schema is confusing TS
|
|
@@ -37149,19 +37551,23 @@ export default theme;`;
|
|
|
37149
37551
|
* @param data - The data associated with the field that was blurred
|
|
37150
37552
|
*/
|
|
37151
37553
|
onBlur = (id, data) => {
|
|
37152
|
-
const { onBlur, omitExtraData, liveOmit, liveValidate } = this.props;
|
|
37554
|
+
const { onBlur, omitExtraData, liveOmit, liveValidate, removeEmptyOptionalObjects } = this.props;
|
|
37153
37555
|
if (onBlur) {
|
|
37154
37556
|
onBlur(id, data);
|
|
37155
37557
|
}
|
|
37156
37558
|
if ((omitExtraData === true && liveOmit === 'onBlur') || liveValidate === 'onBlur') {
|
|
37157
37559
|
const { onChange, extraErrors } = this.props;
|
|
37158
|
-
const { formData } = this.state;
|
|
37560
|
+
const { formData, schemaUtils, schema } = this.state;
|
|
37159
37561
|
let newFormData = formData;
|
|
37160
37562
|
let state = { formData: newFormData };
|
|
37161
37563
|
if (omitExtraData === true && liveOmit === 'onBlur') {
|
|
37162
37564
|
newFormData = this.omitExtraData(formData);
|
|
37163
37565
|
state = { formData: newFormData };
|
|
37164
37566
|
}
|
|
37567
|
+
if (removeEmptyOptionalObjects) {
|
|
37568
|
+
newFormData = removeOptionalEmptyObjects(schemaUtils.getValidator(), schema, schemaUtils.getRootSchema(), newFormData);
|
|
37569
|
+
state = { ...state, formData: newFormData };
|
|
37570
|
+
}
|
|
37165
37571
|
if (liveValidate === 'onBlur') {
|
|
37166
37572
|
const { schema, schemaUtils, errorSchema, customErrors, retrievedSchema } = this.state;
|
|
37167
37573
|
const liveValidation = this.liveValidate(schema, schemaUtils, errorSchema, newFormData, extraErrors, customErrors, retrievedSchema);
|
|
@@ -37208,11 +37614,15 @@ export default theme;`;
|
|
|
37208
37614
|
return;
|
|
37209
37615
|
}
|
|
37210
37616
|
event.persist();
|
|
37211
|
-
const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;
|
|
37617
|
+
const { omitExtraData, extraErrors, noValidate, onSubmit, removeEmptyOptionalObjects } = this.props;
|
|
37212
37618
|
let { formData: newFormData } = this.state;
|
|
37213
37619
|
if (omitExtraData === true) {
|
|
37214
37620
|
newFormData = this.omitExtraData(newFormData);
|
|
37215
37621
|
}
|
|
37622
|
+
if (removeEmptyOptionalObjects) {
|
|
37623
|
+
const { schemaUtils, schema } = this.state;
|
|
37624
|
+
newFormData = removeOptionalEmptyObjects(schemaUtils.getValidator(), schema, schemaUtils.getRootSchema(), newFormData);
|
|
37625
|
+
}
|
|
37216
37626
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
37217
37627
|
// There are no errors generated through schema validation.
|
|
37218
37628
|
// Check for user provided errors and update state accordingly.
|
|
@@ -37305,8 +37715,9 @@ export default theme;`;
|
|
|
37305
37715
|
const elementId = path.join(idSeparator);
|
|
37306
37716
|
let field = this.formElement.current.elements[elementId];
|
|
37307
37717
|
if (!field) {
|
|
37308
|
-
// if not an exact match, try finding
|
|
37309
|
-
|
|
37718
|
+
// if not an exact match, try finding a focusable element starting with the element id (like radio buttons or checkboxes)
|
|
37719
|
+
// some themes (e.g. shadcn) use button elements instead of native inputs for radio groups
|
|
37720
|
+
field = this.formElement.current.querySelector(`input[id^="${elementId}"], button[id^="${elementId}"]`);
|
|
37310
37721
|
}
|
|
37311
37722
|
if (field && field.length) {
|
|
37312
37723
|
// If we got a list with length > 0
|
|
@@ -37380,11 +37791,15 @@ export default theme;`;
|
|
|
37380
37791
|
* @returns - True if the form is valid, false otherwise.
|
|
37381
37792
|
*/
|
|
37382
37793
|
validateForm() {
|
|
37383
|
-
const { omitExtraData } = this.props;
|
|
37794
|
+
const { omitExtraData, removeEmptyOptionalObjects } = this.props;
|
|
37384
37795
|
let { formData: newFormData } = this.state;
|
|
37385
37796
|
if (omitExtraData === true) {
|
|
37386
37797
|
newFormData = this.omitExtraData(newFormData);
|
|
37387
37798
|
}
|
|
37799
|
+
if (removeEmptyOptionalObjects) {
|
|
37800
|
+
const { schemaUtils, schema } = this.state;
|
|
37801
|
+
newFormData = removeOptionalEmptyObjects(schemaUtils.getValidator(), schema, schemaUtils.getRootSchema(), newFormData);
|
|
37802
|
+
}
|
|
37388
37803
|
return this.validateFormWithFormData(newFormData);
|
|
37389
37804
|
}
|
|
37390
37805
|
/** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if
|
|
@@ -44082,13 +44497,50 @@ export default theme;`;
|
|
|
44082
44497
|
return ajv;
|
|
44083
44498
|
}
|
|
44084
44499
|
|
|
44500
|
+
/** Filters duplicate errors from `anyOf`/`oneOf` schema paths according to the `suppressDuplicateFiltering` flag.
|
|
44501
|
+
*
|
|
44502
|
+
* @param errorList - The list of `RJSFValidationError`s to filter
|
|
44503
|
+
* @param [suppressDuplicateFiltering='none'] - Controls which duplicate filtering is suppressed:
|
|
44504
|
+
* - `'none'` (default): filters duplicates for both `anyOf` and `oneOf`
|
|
44505
|
+
* - `'all'`: returns `errorList` unmodified
|
|
44506
|
+
* - `'anyOf'`: suppresses filtering for `anyOf` errors; `oneOf` duplicates are still filtered
|
|
44507
|
+
* - `'oneOf'`: suppresses filtering for `oneOf` errors; `anyOf` duplicates are still filtered
|
|
44508
|
+
*/
|
|
44509
|
+
function filterDuplicateErrors(errorList, suppressDuplicateFiltering = 'none') {
|
|
44510
|
+
if (suppressDuplicateFiltering === 'all') {
|
|
44511
|
+
return errorList;
|
|
44512
|
+
}
|
|
44513
|
+
return errorList.reduce((acc, err) => {
|
|
44514
|
+
const { message, schemaPath } = err;
|
|
44515
|
+
// Compute the index only when filtering for that keyword is not suppressed.
|
|
44516
|
+
// 'all' is already handled above; within the reduce, only 'none', 'anyOf', and 'oneOf' are possible.
|
|
44517
|
+
const anyOfIndex = suppressDuplicateFiltering !== 'anyOf' ? schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.indexOf(`/${ANY_OF_KEY}/`) : undefined;
|
|
44518
|
+
const oneOfIndex = suppressDuplicateFiltering !== 'oneOf' ? schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.indexOf(`/${ONE_OF_KEY}/`) : undefined;
|
|
44519
|
+
let schemaPrefix;
|
|
44520
|
+
if (anyOfIndex && anyOfIndex >= 0) {
|
|
44521
|
+
schemaPrefix = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.substring(0, anyOfIndex);
|
|
44522
|
+
}
|
|
44523
|
+
else if (oneOfIndex && oneOfIndex >= 0) {
|
|
44524
|
+
schemaPrefix = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.substring(0, oneOfIndex);
|
|
44525
|
+
}
|
|
44526
|
+
// If there is a schemaPrefix, then search for a duplicate message with the same prefix, otherwise undefined
|
|
44527
|
+
const dup = schemaPrefix
|
|
44528
|
+
? acc.find((e) => { var _a; return e.message === message && ((_a = e.schemaPath) === null || _a === void 0 ? void 0 : _a.startsWith(schemaPrefix)); })
|
|
44529
|
+
: undefined;
|
|
44530
|
+
if (!dup) {
|
|
44531
|
+
acc.push(err);
|
|
44532
|
+
}
|
|
44533
|
+
return acc;
|
|
44534
|
+
}, []);
|
|
44535
|
+
}
|
|
44085
44536
|
/** Transforming the error output from ajv to format used by @rjsf/utils.
|
|
44086
44537
|
* At some point, components should be updated to support ajv.
|
|
44087
44538
|
*
|
|
44088
44539
|
* @param errors - The list of AJV errors to convert to `RJSFValidationErrors`
|
|
44089
44540
|
* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
|
|
44541
|
+
* @param [suppressDuplicateFiltering] - Controls which duplicate filtering is suppressed; see `filterDuplicateErrors`
|
|
44090
44542
|
*/
|
|
44091
|
-
function transformRJSFValidationErrors(errors = [], uiSchema) {
|
|
44543
|
+
function transformRJSFValidationErrors(errors = [], uiSchema, suppressDuplicateFiltering) {
|
|
44092
44544
|
const errorList = errors.map((e) => {
|
|
44093
44545
|
var _a;
|
|
44094
44546
|
const { instancePath, keyword, params, schemaPath, parentSchema, ...rest } = e;
|
|
@@ -44158,29 +44610,7 @@ export default theme;`;
|
|
|
44158
44610
|
title: uiTitle,
|
|
44159
44611
|
};
|
|
44160
44612
|
});
|
|
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
|
-
}, []);
|
|
44613
|
+
return filterDuplicateErrors(errorList, suppressDuplicateFiltering);
|
|
44184
44614
|
}
|
|
44185
44615
|
/** This function processes the `formData` with an optional user contributed `customValidate` function, which receives
|
|
44186
44616
|
* the form data and a `errorHandler` function that will be used to add custom validation errors for each field. Also
|
|
@@ -44194,10 +44624,11 @@ export default theme;`;
|
|
|
44194
44624
|
* @param [customValidate] - An optional function that is used to perform custom validation
|
|
44195
44625
|
* @param [transformErrors] - An optional function that is used to transform errors after AJV validation
|
|
44196
44626
|
* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
|
|
44627
|
+
* @param [suppressDuplicateFiltering] - Controls which duplicate filtering is suppressed; see `filterDuplicateErrors`
|
|
44197
44628
|
*/
|
|
44198
|
-
function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema) {
|
|
44629
|
+
function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema, suppressDuplicateFiltering) {
|
|
44199
44630
|
const { validationError: invalidSchemaError } = rawErrors;
|
|
44200
|
-
let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
|
|
44631
|
+
let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema, suppressDuplicateFiltering);
|
|
44201
44632
|
if (invalidSchemaError) {
|
|
44202
44633
|
errors = [...errors, { stack: invalidSchemaError.message }];
|
|
44203
44634
|
}
|
|
@@ -44232,9 +44663,10 @@ export default theme;`;
|
|
|
44232
44663
|
* @param [localizer] - If provided, is used to localize a list of Ajv `ErrorObject`s
|
|
44233
44664
|
*/
|
|
44234
44665
|
constructor(options, localizer) {
|
|
44235
|
-
const { additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass, extenderFn } = options;
|
|
44666
|
+
const { additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass, extenderFn, suppressDuplicateFiltering, } = options;
|
|
44236
44667
|
this.ajv = createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass, extenderFn);
|
|
44237
44668
|
this.localizer = localizer;
|
|
44669
|
+
this.suppressDuplicateFiltering = suppressDuplicateFiltering;
|
|
44238
44670
|
}
|
|
44239
44671
|
/** Resets the internal AJV validator to clear schemas from it. Can be helpful for resetting the validator for tests.
|
|
44240
44672
|
*/
|
|
@@ -44327,7 +44759,7 @@ export default theme;`;
|
|
|
44327
44759
|
*/
|
|
44328
44760
|
validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
|
|
44329
44761
|
const rawErrors = this.rawValidation(schema, formData);
|
|
44330
|
-
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);
|
|
44762
|
+
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema, this.suppressDuplicateFiltering);
|
|
44331
44763
|
}
|
|
44332
44764
|
/**
|
|
44333
44765
|
* 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 +44834,40 @@ export default theme;`;
|
|
|
44402
44834
|
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
|
|
44403
44835
|
}));
|
|
44404
44836
|
|
|
44837
|
+
/**
|
|
44838
|
+
* Extract props meant for MUI components from the `options` field of the `uiSchema`.
|
|
44839
|
+
* @param {UIOptionsType} options - The options from the uiSchema
|
|
44840
|
+
* @param {string[]} [propsToFilter] - An optional allowlist of props to return (used by button/icon components)
|
|
44841
|
+
* @param {boolean} [rjsfSlotPropsOnly] - If true, returns only `rjsfSlotProps`, preventing root-level prop bleeding
|
|
44842
|
+
* @returns {P}
|
|
44843
|
+
*/
|
|
44844
|
+
function getMuiProps(options, propsToFilter, rjsfSlotPropsOnly) {
|
|
44845
|
+
const muiProps = (options === null || options === void 0 ? void 0 : options.mui) || {};
|
|
44846
|
+
if (propsToFilter) {
|
|
44847
|
+
return Object.keys(muiProps)
|
|
44848
|
+
.filter((key) => propsToFilter.includes(key))
|
|
44849
|
+
.reduce((obj, key) => {
|
|
44850
|
+
obj[key] = muiProps[key];
|
|
44851
|
+
return obj;
|
|
44852
|
+
}, {});
|
|
44853
|
+
}
|
|
44854
|
+
return muiProps;
|
|
44855
|
+
}
|
|
44856
|
+
|
|
44405
44857
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
44406
44858
|
*/
|
|
44407
44859
|
function AddButton({ uiSchema, registry, ...props }) {
|
|
44408
44860
|
const { translateString } = registry;
|
|
44409
|
-
|
|
44861
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44862
|
+
const muiProps = getMuiProps(uiOptions, [
|
|
44863
|
+
'color',
|
|
44864
|
+
'disableFocusRipple',
|
|
44865
|
+
'disableRipple',
|
|
44866
|
+
'edge',
|
|
44867
|
+
'size',
|
|
44868
|
+
'sx',
|
|
44869
|
+
]);
|
|
44870
|
+
return (jsxRuntimeExports.jsx(IconButton$1, { title: translateString(TranslatableString.AddItemButton), ...props, color: 'primary', ...muiProps, children: jsxRuntimeExports.jsx(AddIcon, {}) }));
|
|
44410
44871
|
}
|
|
44411
44872
|
|
|
44412
44873
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -44424,7 +44885,8 @@ export default theme;`;
|
|
|
44424
44885
|
fontWeight: 'bold',
|
|
44425
44886
|
minWidth: 0,
|
|
44426
44887
|
};
|
|
44427
|
-
|
|
44888
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
44889
|
+
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
44890
|
}
|
|
44429
44891
|
|
|
44430
44892
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
@@ -44439,7 +44901,8 @@ export default theme;`;
|
|
|
44439
44901
|
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
44440
44902
|
// Button templates are not overridden in the uiSchema
|
|
44441
44903
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
44442
|
-
|
|
44904
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
44905
|
+
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
44906
|
}
|
|
44444
44907
|
|
|
44445
44908
|
const TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
|
|
@@ -44455,8 +44918,11 @@ export default theme;`;
|
|
|
44455
44918
|
const { ClearButton } = registry.templates.ButtonTemplates;
|
|
44456
44919
|
// Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
|
|
44457
44920
|
const { step, min, max, accept, ...rest } = getInputProps(schema, type, options);
|
|
44921
|
+
const muiProps = getMuiProps(options);
|
|
44922
|
+
const { slotProps: muiSlotProps, ...otherMuiProps } = muiProps;
|
|
44458
44923
|
const htmlInputProps = {
|
|
44459
44924
|
...slotProps === null || slotProps === void 0 ? void 0 : slotProps.htmlInput,
|
|
44925
|
+
...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.htmlInput,
|
|
44460
44926
|
step,
|
|
44461
44927
|
min,
|
|
44462
44928
|
max,
|
|
@@ -44467,25 +44933,26 @@ export default theme;`;
|
|
|
44467
44933
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
44468
44934
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
44469
44935
|
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 };
|
|
44936
|
+
? { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel, ...InputLabelProps, shrink: true }
|
|
44937
|
+
: { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel, ...InputLabelProps };
|
|
44472
44938
|
const _onClear = reactExports.useCallback((e) => {
|
|
44473
44939
|
var _a;
|
|
44474
44940
|
e.preventDefault();
|
|
44475
44941
|
e.stopPropagation();
|
|
44476
44942
|
onChange((_a = options.emptyValue) !== null && _a !== void 0 ? _a : '');
|
|
44477
44943
|
}, [onChange, options.emptyValue]);
|
|
44478
|
-
const inputProps = { ...InputProps, ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.input };
|
|
44944
|
+
const inputProps = { ...InputProps, ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.input, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.input };
|
|
44479
44945
|
if (options.allowClearTextInputs && value && !readonly && !disabled) {
|
|
44480
44946
|
const clearAdornment = (jsxRuntimeExports.jsx(InputAdornment, { position: 'end', children: jsxRuntimeExports.jsx(ClearButton, { registry: registry, onClick: _onClear }) }));
|
|
44481
44947
|
inputProps.endAdornment = !inputProps.endAdornment ? (clearAdornment) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [inputProps.endAdornment, clearAdornment] }));
|
|
44482
44948
|
}
|
|
44483
44949
|
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
44950
|
...slotProps,
|
|
44951
|
+
...muiSlotProps,
|
|
44485
44952
|
input: inputProps,
|
|
44486
44953
|
htmlInput: htmlInputProps,
|
|
44487
44954
|
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 })] }));
|
|
44955
|
+
}, ...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
44956
|
}
|
|
44490
44957
|
|
|
44491
44958
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -44494,8 +44961,11 @@ export default theme;`;
|
|
|
44494
44961
|
*/
|
|
44495
44962
|
function DescriptionField(props) {
|
|
44496
44963
|
const { id, description, registry, uiSchema } = props;
|
|
44964
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44965
|
+
const muiProps = getMuiProps(uiOptions);
|
|
44966
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
44497
44967
|
if (description) {
|
|
44498
|
-
return (jsxRuntimeExports.jsx(Typography, { id: id, variant: 'subtitle2', style: { marginTop: '5px' }, children: jsxRuntimeExports.jsx(RichDescription, { description: description, registry: registry, uiSchema: uiSchema }) }));
|
|
44968
|
+
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
44969
|
}
|
|
44500
44970
|
return null;
|
|
44501
44971
|
}
|
|
@@ -44508,10 +44978,12 @@ export default theme;`;
|
|
|
44508
44978
|
*
|
|
44509
44979
|
* @param props - The `ErrorListProps` for this component
|
|
44510
44980
|
*/
|
|
44511
|
-
function ErrorList({ errors, registry, }) {
|
|
44981
|
+
function ErrorList({ errors, registry, uiSchema, }) {
|
|
44512
44982
|
const { translateString } = registry;
|
|
44513
|
-
|
|
44514
|
-
|
|
44983
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
44984
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
44985
|
+
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) => {
|
|
44986
|
+
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
44987
|
}) })] }) }));
|
|
44516
44988
|
}
|
|
44517
44989
|
|
|
@@ -44537,7 +45009,16 @@ export default theme;`;
|
|
|
44537
45009
|
|
|
44538
45010
|
function MuiIconButton(props) {
|
|
44539
45011
|
const { icon, color, uiSchema, registry, ...otherProps } = props;
|
|
44540
|
-
|
|
45012
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
45013
|
+
const muiProps = getMuiProps(uiOptions, [
|
|
45014
|
+
'color',
|
|
45015
|
+
'disableFocusRipple',
|
|
45016
|
+
'disableRipple',
|
|
45017
|
+
'edge',
|
|
45018
|
+
'size',
|
|
45019
|
+
'sx',
|
|
45020
|
+
]);
|
|
45021
|
+
return (jsxRuntimeExports.jsx(IconButton$1, { ...muiProps, ...otherProps, size: 'small', color: color, children: icon }));
|
|
44541
45022
|
}
|
|
44542
45023
|
function CopyButton(props) {
|
|
44543
45024
|
const { registry: { translateString }, } = props;
|
|
@@ -44567,13 +45048,16 @@ export default theme;`;
|
|
|
44567
45048
|
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
44568
45049
|
*/
|
|
44569
45050
|
function FieldErrorTemplate(props) {
|
|
44570
|
-
const { errors = [], fieldPathId } = props;
|
|
45051
|
+
const { errors = [], fieldPathId, uiSchema } = props;
|
|
44571
45052
|
if (errors.length === 0) {
|
|
44572
45053
|
return null;
|
|
44573
45054
|
}
|
|
44574
45055
|
const id = errorId(fieldPathId);
|
|
44575
|
-
|
|
44576
|
-
|
|
45056
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
45057
|
+
const muiProps = getMuiProps(uiOptions);
|
|
45058
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
45059
|
+
return (jsxRuntimeExports.jsx(List, { id: id, dense: true, disablePadding: true, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldErrorList, children: errors.map((error, i) => {
|
|
45060
|
+
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
45061
|
}) }));
|
|
44578
45062
|
}
|
|
44579
45063
|
|
|
@@ -44586,7 +45070,10 @@ export default theme;`;
|
|
|
44586
45070
|
if (!help) {
|
|
44587
45071
|
return null;
|
|
44588
45072
|
}
|
|
44589
|
-
|
|
45073
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
45074
|
+
const muiProps = getMuiProps(uiOptions);
|
|
45075
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
45076
|
+
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
45077
|
}
|
|
44591
45078
|
|
|
44592
45079
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -44602,7 +45089,8 @@ export default theme;`;
|
|
|
44602
45089
|
return jsxRuntimeExports.jsx("div", { style: { display: 'none' }, children: children });
|
|
44603
45090
|
}
|
|
44604
45091
|
const isCheckbox = uiOptions.widget === 'checkbox';
|
|
44605
|
-
|
|
45092
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
|
|
45093
|
+
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
45094
|
}
|
|
44607
45095
|
|
|
44608
45096
|
/** Renders a `GridTemplate` for mui, which is expecting the column sizing information coming in via the
|
|
@@ -44616,8 +45104,10 @@ export default theme;`;
|
|
|
44616
45104
|
}
|
|
44617
45105
|
|
|
44618
45106
|
function MultiSchemaFieldTemplate(props) {
|
|
44619
|
-
const { optionSchemaField, selector } = props;
|
|
44620
|
-
|
|
45107
|
+
const { optionSchemaField, selector, uiSchema } = props;
|
|
45108
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
45109
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
45110
|
+
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
45111
|
}
|
|
44622
45112
|
|
|
44623
45113
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -44634,10 +45124,11 @@ export default theme;`;
|
|
|
44634
45124
|
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
44635
45125
|
// Button templates are not overridden in the uiSchema
|
|
44636
45126
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
44637
|
-
|
|
45127
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
45128
|
+
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
45129
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
44639
45130
|
// 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 }) }) }))] }));
|
|
45131
|
+
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
45132
|
}
|
|
44642
45133
|
|
|
44643
45134
|
/** The OptionalDataControlsTemplate renders one of three different states. If
|
|
@@ -44649,12 +45140,12 @@ export default theme;`;
|
|
|
44649
45140
|
* @param props - The `OptionalDataControlsTemplateProps` for the template
|
|
44650
45141
|
*/
|
|
44651
45142
|
function OptionalDataControlsTemplate(props) {
|
|
44652
|
-
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
45143
|
+
const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;
|
|
44653
45144
|
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' }) }));
|
|
45145
|
+
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
45146
|
}
|
|
44656
45147
|
else if (onRemoveClick) {
|
|
44657
|
-
return (jsxRuntimeExports.jsx(RemoveButton, { id: id, registry: registry, className: 'rjsf-remove-optional-data', onClick: onRemoveClick, title: label }));
|
|
45148
|
+
return (jsxRuntimeExports.jsx(RemoveButton, { id: id, registry: registry, uiSchema: uiSchema, className: 'rjsf-remove-optional-data', onClick: onRemoveClick, title: label }));
|
|
44658
45149
|
}
|
|
44659
45150
|
return jsxRuntimeExports.jsx("em", { id: id, children: label });
|
|
44660
45151
|
}
|
|
@@ -44666,19 +45157,24 @@ export default theme;`;
|
|
|
44666
45157
|
if (norender) {
|
|
44667
45158
|
return null;
|
|
44668
45159
|
}
|
|
44669
|
-
|
|
45160
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
45161
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
|
|
45162
|
+
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
45163
|
}
|
|
44671
45164
|
|
|
44672
45165
|
/** The `TitleField` is the template to use to render the title of a field
|
|
44673
45166
|
*
|
|
44674
45167
|
* @param props - The `TitleFieldProps` for this component
|
|
44675
45168
|
*/
|
|
44676
|
-
function TitleField(
|
|
44677
|
-
|
|
45169
|
+
function TitleField(props) {
|
|
45170
|
+
const { id, title, optionalDataControl, uiSchema } = props;
|
|
45171
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
45172
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
45173
|
+
let heading = (jsxRuntimeExports.jsx(Typography, { variant: 'h5', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.titleTypography, children: title }));
|
|
44678
45174
|
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 })] }));
|
|
45175
|
+
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
45176
|
}
|
|
44681
|
-
return (jsxRuntimeExports.jsxs(Box, { id: id, mb: 1, mt: 1, children: [heading, jsxRuntimeExports.jsx(Divider, {})] }));
|
|
45177
|
+
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
45178
|
}
|
|
44683
45179
|
|
|
44684
45180
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -44699,10 +45195,14 @@ export default theme;`;
|
|
|
44699
45195
|
paddingRight: 6,
|
|
44700
45196
|
fontWeight: 'bold',
|
|
44701
45197
|
};
|
|
45198
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
45199
|
+
const { rjsfSlotProps } = getMuiProps(uiOptions);
|
|
45200
|
+
const muiSlotProps = rjsfSlotProps;
|
|
44702
45201
|
if (!additional) {
|
|
44703
45202
|
return (jsxRuntimeExports.jsx("div", { className: classNames, style: style, children: children }));
|
|
44704
45203
|
}
|
|
44705
|
-
|
|
45204
|
+
const { wrapGridContainer, wrapKeyGridItem, wrapChildrenGridItem, wrapRemoveButtonGridItem } = muiSlotProps || {};
|
|
45205
|
+
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
45206
|
}
|
|
44707
45207
|
|
|
44708
45208
|
function generateTemplates() {
|
|
@@ -44750,7 +45250,8 @@ export default theme;`;
|
|
|
44750
45250
|
const _onBlur = () => onBlur(id, value);
|
|
44751
45251
|
const _onFocus = () => onFocus(id, value);
|
|
44752
45252
|
const description = (_a = options.description) !== null && _a !== void 0 ? _a : schema.description;
|
|
44753
|
-
|
|
45253
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
45254
|
+
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
45255
|
}
|
|
44755
45256
|
|
|
44756
45257
|
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
@@ -44758,8 +45259,10 @@ export default theme;`;
|
|
|
44758
45259
|
*
|
|
44759
45260
|
* @param props - The `WidgetProps` for this component
|
|
44760
45261
|
*/
|
|
44761
|
-
function CheckboxesWidget(
|
|
45262
|
+
function CheckboxesWidget(props) {
|
|
45263
|
+
const { label, hideLabel, id, htmlName, disabled, options, value, autofocus, readonly, required, onChange, onBlur, onFocus, } = props;
|
|
44762
45264
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
45265
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
44763
45266
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
44764
45267
|
const _onChange = (index) => ({ target: { checked } }) => {
|
|
44765
45268
|
if (checked) {
|
|
@@ -44769,14 +45272,15 @@ export default theme;`;
|
|
|
44769
45272
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
44770
45273
|
}
|
|
44771
45274
|
};
|
|
44772
|
-
const _onBlur = ({ target }) => onBlur(id,
|
|
44773
|
-
const _onFocus = ({ target }) => onFocus(id,
|
|
44774
|
-
|
|
45275
|
+
const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
45276
|
+
const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
45277
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
45278
|
+
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
45279
|
enumOptions.map((option, index) => {
|
|
44776
45280
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
44777
45281
|
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
|
|
45282
|
+
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) }));
|
|
45283
|
+
return (reactExports.createElement(FormControlLabel, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formControlLabel, control: checkbox, key: index, label: option.label }));
|
|
44780
45284
|
}) })] }));
|
|
44781
45285
|
}
|
|
44782
45286
|
|
|
@@ -44785,18 +45289,20 @@ export default theme;`;
|
|
|
44785
45289
|
*
|
|
44786
45290
|
* @param props - The `WidgetProps` for this component
|
|
44787
45291
|
*/
|
|
44788
|
-
function RadioWidget(
|
|
44789
|
-
|
|
45292
|
+
function RadioWidget(props) {
|
|
45293
|
+
const { id, htmlName, options, value, required, disabled, readonly, label, hideLabel, onChange, onBlur, onFocus } = props;
|
|
44790
45294
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
44791
|
-
const
|
|
44792
|
-
const
|
|
44793
|
-
const
|
|
45295
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
45296
|
+
const _onChange = (_, value) => onChange(enumOptionValueDecoder(value, enumOptions, optionValueFormat, emptyValue));
|
|
45297
|
+
const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
45298
|
+
const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
44794
45299
|
const row = options ? options.inline : false;
|
|
44795
|
-
const
|
|
44796
|
-
|
|
45300
|
+
const selectValue = enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, '');
|
|
45301
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
45302
|
+
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
45303
|
enumOptions.map((option, index) => {
|
|
44798
45304
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
44799
|
-
const radio = (
|
|
45305
|
+
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
45306
|
return radio;
|
|
44801
45307
|
}) })] }));
|
|
44802
45308
|
}
|
|
@@ -44814,7 +45320,8 @@ export default theme;`;
|
|
|
44814
45320
|
};
|
|
44815
45321
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
44816
45322
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
44817
|
-
|
|
45323
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
45324
|
+
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
45325
|
}
|
|
44819
45326
|
|
|
44820
45327
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
@@ -44822,29 +45329,35 @@ export default theme;`;
|
|
|
44822
45329
|
*
|
|
44823
45330
|
* @param props - The `WidgetProps` for this component
|
|
44824
45331
|
*/
|
|
44825
|
-
function SelectWidget({
|
|
44826
|
-
|
|
45332
|
+
function SelectWidget(props) {
|
|
45333
|
+
const { schema, id, name, // remove this from textFieldProps
|
|
45334
|
+
htmlName, options, label, hideLabel, required, disabled, placeholder, readonly, value, multiple, autofocus, onChange, onBlur, onFocus, errorSchema, rawErrors = [], registry, uiSchema, hideError, ...textFieldProps } = props;
|
|
44827
45335
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
44828
|
-
|
|
44829
|
-
const
|
|
44830
|
-
const
|
|
44831
|
-
const
|
|
44832
|
-
const
|
|
44833
|
-
const
|
|
44834
|
-
const
|
|
45336
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
45337
|
+
const isMultiple = typeof multiple === 'undefined' ? false : !!multiple;
|
|
45338
|
+
const emptyValue = isMultiple ? [] : '';
|
|
45339
|
+
const isEmpty = typeof value === 'undefined' || (isMultiple && value.length < 1) || (!isMultiple && value === emptyValue);
|
|
45340
|
+
const _onChange = ({ target: { value } }) => onChange(enumOptionValueDecoder(value, enumOptions, optionValueFormat, optEmptyVal));
|
|
45341
|
+
const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
45342
|
+
const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
45343
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
44835
45344
|
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
|
-
|
|
45345
|
+
const showPlaceholderOption = !isMultiple && schema.default === undefined;
|
|
45346
|
+
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
|
|
45347
|
+
: true, slotProps: {
|
|
45348
|
+
...muiSlotProps,
|
|
45349
|
+
inputLabel: {
|
|
45350
|
+
...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel,
|
|
45351
|
+
shrink: !isEmpty,
|
|
45352
|
+
},
|
|
45353
|
+
select: {
|
|
45354
|
+
...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.select,
|
|
45355
|
+
multiple,
|
|
45356
|
+
},
|
|
44844
45357
|
}, "aria-describedby": ariaDescribedByIds(id), children: [showPlaceholderOption && jsxRuntimeExports.jsx(MenuItem, { value: '', children: placeholder }), Array.isArray(enumOptions) &&
|
|
44845
45358
|
enumOptions.map(({ value, label }, i) => {
|
|
44846
45359
|
const disabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1;
|
|
44847
|
-
return (jsxRuntimeExports.jsx(MenuItem, { value:
|
|
45360
|
+
return (jsxRuntimeExports.jsx(MenuItem, { value: enumOptionValueEncoder(value, i, optionValueFormat), disabled: disabled, children: label }, i));
|
|
44848
45361
|
})] }));
|
|
44849
45362
|
}
|
|
44850
45363
|
|