@crowdin/app-project-module 1.8.1 → 1.9.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.
@@ -21021,6 +21021,7 @@ export default theme;`;
21021
21021
  const REQUIRED_KEY = 'required';
21022
21022
  const SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
21023
21023
  const REF_KEY = '$ref';
21024
+ const RJSF_REF_KEY = '__rjsf_ref';
21024
21025
  const SCHEMA_KEY = '$schema';
21025
21026
  const DEFAULT_ID_PREFIX = 'root';
21026
21027
  const DEFAULT_ID_SEPARATOR = '_';
@@ -22061,7 +22062,7 @@ export default theme;`;
22061
22062
  * @name has
22062
22063
  * @memberOf SetCache
22063
22064
  * @param {*} value The value to search for.
22064
- * @returns {number} Returns `true` if `value` is found, else `false`.
22065
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
22065
22066
  */
22066
22067
  function setCacheHas(value) {
22067
22068
  return this.__data__.has(value);
@@ -27042,7 +27043,9 @@ export default theme;`;
27042
27043
  function baseUnset(object, path) {
27043
27044
  path = castPath(path, object);
27044
27045
 
27045
- // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
27046
+ // Prevent prototype pollution:
27047
+ // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
27048
+ // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
27046
27049
  var index = -1,
27047
27050
  length = path.length;
27048
27051
 
@@ -27050,32 +27053,17 @@ export default theme;`;
27050
27053
  return true;
27051
27054
  }
27052
27055
 
27053
- var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
27054
-
27055
27056
  while (++index < length) {
27056
- var key = path[index];
27057
-
27058
- // skip non-string keys (e.g., Symbols, numbers)
27059
- if (typeof key !== 'string') {
27060
- continue;
27061
- }
27057
+ var key = toKey(path[index]);
27062
27058
 
27063
27059
  // Always block "__proto__" anywhere in the path if it's not expected
27064
27060
  if (key === '__proto__' && !hasOwnProperty$1.call(object, '__proto__')) {
27065
27061
  return false;
27066
27062
  }
27067
27063
 
27068
- // Block "constructor.prototype" chains
27069
- if (key === 'constructor' &&
27070
- (index + 1) < length &&
27071
- typeof path[index + 1] === 'string' &&
27072
- path[index + 1] === 'prototype') {
27073
-
27074
- // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
27075
- if (isRootPrimitive && index === 0) {
27076
- continue;
27077
- }
27078
-
27064
+ // Block constructor/prototype as non-terminal traversal keys to prevent
27065
+ // escaping the object graph into built-in constructors and prototypes.
27066
+ if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
27079
27067
  return false;
27080
27068
  }
27081
27069
  }
@@ -28781,7 +28769,7 @@ export default theme;`;
28781
28769
  recurseList.push($ref);
28782
28770
  // Retrieve the referenced schema definition.
28783
28771
  const refSchema = findSchemaDefinition($ref, rootSchema, baseURI);
28784
- resolvedSchema = { ...refSchema, ...localSchema };
28772
+ resolvedSchema = { ...refSchema, ...localSchema, [RJSF_REF_KEY]: $ref };
28785
28773
  if (ID_KEY in resolvedSchema) {
28786
28774
  baseURI = resolvedSchema[ID_KEY];
28787
28775
  }
@@ -29805,6 +29793,22 @@ export default theme;`;
29805
29793
  throw new Error('schema cannot be inferred as a constant');
29806
29794
  }
29807
29795
 
29796
+ /** Reorders `options` according to `order`, which may contain a `'*'` wildcard representing all
29797
+ * remaining options in their original order. Options not listed in `order` (and not covered by
29798
+ * a wildcard) are dropped.
29799
+ */
29800
+ function applyEnumOrder(options, order) {
29801
+ const optionsByValue = new Map(options.map((opt) => [String(opt.value), opt]));
29802
+ const orderedKeys = new Set(order.filter((v) => v !== '*').map(String));
29803
+ const rest = options.filter((opt) => !orderedKeys.has(String(opt.value)));
29804
+ return order.flatMap((entry) => {
29805
+ if (entry === '*') {
29806
+ return rest;
29807
+ }
29808
+ const opt = optionsByValue.get(String(entry));
29809
+ return opt ? [opt] : [];
29810
+ });
29811
+ }
29808
29812
  /** Gets the list of options from the `schema`. If the schema has an enum list, then those enum values are returned. The
29809
29813
  * label will be the same as the `value`.
29810
29814
  *
@@ -29821,14 +29825,22 @@ export default theme;`;
29821
29825
  function optionsList(schema, uiSchema) {
29822
29826
  if (schema.enum) {
29823
29827
  let enumNames;
29828
+ let enumOrder;
29824
29829
  if (uiSchema) {
29825
- const { enumNames: uiEnumNames } = getUiOptions(uiSchema);
29830
+ const { enumNames: uiEnumNames, enumOrder: uiEnumOrder } = getUiOptions(uiSchema);
29826
29831
  enumNames = uiEnumNames;
29832
+ enumOrder = uiEnumOrder;
29827
29833
  }
29828
- return schema.enum.map((value, i) => {
29829
- const label = (enumNames === null || enumNames === void 0 ? void 0 : enumNames[i]) || String(value);
29834
+ let options = schema.enum.map((value, i) => {
29835
+ const label = Array.isArray(enumNames)
29836
+ ? enumNames[i] || String(value)
29837
+ : (enumNames === null || enumNames === void 0 ? void 0 : enumNames[String(value)]) || String(value);
29830
29838
  return { label, value };
29831
29839
  });
29840
+ if (enumOrder) {
29841
+ options = applyEnumOrder(options, enumOrder);
29842
+ }
29843
+ return options;
29832
29844
  }
29833
29845
  let altSchemas = undefined;
29834
29846
  let altUiSchemas = undefined;
@@ -30586,6 +30598,13 @@ export default theme;`;
30586
30598
  }
30587
30599
  if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
30588
30600
  set(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
30601
+ const additionalSchema = (isObject$2(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {});
30602
+ const definedProperties = get(schema, PROPERTIES_KEY, {});
30603
+ for (const key of Object.keys((formData !== null && formData !== void 0 ? formData : {}))) {
30604
+ if (!(key in definedProperties)) {
30605
+ pathSchema[key] = toPathSchemaInternal(validator, additionalSchema, `${name}.${key}`, rootSchema, get(formData, [key]), _recurseList, experimental_customMergeAllOf);
30606
+ }
30607
+ }
30589
30608
  }
30590
30609
  if (ITEMS_KEY in schema && Array.isArray(formData)) {
30591
30610
  const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
@@ -32210,7 +32229,7 @@ export default theme;`;
32210
32229
  }
32211
32230
  if (REF_KEY in rootSchema) {
32212
32231
  const resolvedSchema = schemaUtils.retrieveSchema(rootSchema);
32213
- return isEqual(schemaToCompare, resolvedSchema);
32232
+ return isEqual(schemaToCompare, omit(resolvedSchema, RJSF_REF_KEY));
32214
32233
  }
32215
32234
  return false;
32216
32235
  }
@@ -32418,9 +32437,9 @@ export default theme;`;
32418
32437
  * @returns - The resolved uiSchema with definitions merged in
32419
32438
  */
32420
32439
  function resolveUiSchema(schema, localUiSchema, registry) {
32421
- var _a;
32422
- const ref = schema[REF_KEY];
32423
- const definitionUiSchema = ref ? (_a = registry.uiSchemaDefinitions) === null || _a === void 0 ? void 0 : _a[ref] : undefined;
32440
+ var _a, _b;
32441
+ const ref = ((_a = schema[RJSF_REF_KEY]) !== null && _a !== void 0 ? _a : schema[REF_KEY]);
32442
+ const definitionUiSchema = ref ? (_b = registry.uiSchemaDefinitions) === null || _b === void 0 ? void 0 : _b[ref] : undefined;
32424
32443
  if (!definitionUiSchema) {
32425
32444
  return localUiSchema || {};
32426
32445
  }
@@ -33262,7 +33281,10 @@ export default theme;`;
33262
33281
  const { schema, fieldPathId, uiSchema, formData: items = [], disabled = false, readonly = false, autofocus = false, required = false, placeholder, onBlur, onFocus, registry, rawErrors, name, onSelectChange, } = props;
33263
33282
  const { widgets, schemaUtils, globalFormOptions, globalUiOptions } = registry;
33264
33283
  const itemsSchema = schemaUtils.retrieveSchema(schema.items, items);
33265
- const enumOptions = optionsList(itemsSchema, uiSchema);
33284
+ // For computing `enumOptions`, fallback to the array property's uiSchema if there is no `items` schema
33285
+ // Avoids a breaking change reported in https://github.com/rjsf-team/react-jsonschema-form/issues/4985
33286
+ const itemsUiSchema = (uiSchema?.items ?? uiSchema);
33287
+ const enumOptions = optionsList(itemsSchema, itemsUiSchema);
33266
33288
  const { widget = 'select', title: uiTitle, ...options } = getUiOptions(uiSchema, globalUiOptions);
33267
33289
  const Widget = getWidget(schema, widget, widgets);
33268
33290
  const label = uiTitle ?? schema.title ?? name;
@@ -33407,6 +33429,7 @@ export default theme;`;
33407
33429
  name: name && `${name}-${index}`,
33408
33430
  registry,
33409
33431
  uiOptions,
33432
+ parentUiSchema: uiSchema,
33410
33433
  hideError,
33411
33434
  readonly,
33412
33435
  disabled,
@@ -33517,6 +33540,7 @@ export default theme;`;
33517
33540
  name: name && `${name}-${index}`,
33518
33541
  registry,
33519
33542
  uiOptions,
33543
+ parentUiSchema: uiSchema,
33520
33544
  hideError,
33521
33545
  readonly,
33522
33546
  disabled,
@@ -36590,6 +36614,30 @@ export default theme;`;
36590
36614
  * This prevents componentDidUpdate from reverting oneOf/anyOf option switches.
36591
36615
  */
36592
36616
  _isProcessingUserChange = false;
36617
+ /** When the `extraErrors` prop changes, re-merges `schemaValidationErrors` + `extraErrors` + `customErrors` into
36618
+ * state before render, ensuring the updated errors are visible immediately in a single render cycle.
36619
+ *
36620
+ * @param props - The current props
36621
+ * @param state - The current state
36622
+ * @returns Partial state with re-merged errors if `extraErrors` changed, or `null` if no update is needed
36623
+ */
36624
+ static getDerivedStateFromProps(props, state) {
36625
+ if (props.extraErrors !== state._prevExtraErrors) {
36626
+ const baseErrors = {
36627
+ errors: state.schemaValidationErrors || [],
36628
+ errorSchema: (state.schemaValidationErrorSchema || {}),
36629
+ };
36630
+ let { errors, errorSchema } = baseErrors;
36631
+ if (props.extraErrors) {
36632
+ ({ errors, errorSchema } = validationDataMerge(baseErrors, props.extraErrors));
36633
+ }
36634
+ if (state.customErrors) {
36635
+ ({ errors, errorSchema } = validationDataMerge({ errors, errorSchema }, state.customErrors.ErrorSchema, true));
36636
+ }
36637
+ return { _prevExtraErrors: props.extraErrors, errors, errorSchema };
36638
+ }
36639
+ return null;
36640
+ }
36593
36641
  /** Constructs the `Form` from the `props`. Will setup the initial state from the props. It will also call the
36594
36642
  * `onChange` handler if the initially provided `formData` is modified to add missing default values as part of the
36595
36643
  * state construction.
@@ -36603,7 +36651,10 @@ export default theme;`;
36603
36651
  }
36604
36652
  const { formData: propsFormData, initialFormData, onChange } = props;
36605
36653
  const formData = propsFormData ?? initialFormData;
36606
- this.state = this.getStateFromProps(props, formData, undefined, undefined, undefined, true);
36654
+ this.state = {
36655
+ ...this.getStateFromProps(props, formData, undefined, undefined, undefined, true),
36656
+ _prevExtraErrors: props.extraErrors,
36657
+ };
36607
36658
  if (onChange && !deepEquals(this.state.formData, formData)) {
36608
36659
  onChange(toIChangeEvent(this.state));
36609
36660
  }
@@ -36852,7 +36903,7 @@ export default theme;`;
36852
36903
  errors = merged.errors;
36853
36904
  }
36854
36905
  if (customErrors) {
36855
- const merged = validationDataMerge(schemaValidation, customErrors.ErrorSchema, true);
36906
+ const merged = validationDataMerge({ errors, errorSchema }, customErrors.ErrorSchema, true);
36856
36907
  errorSchema = merged.errorSchema;
36857
36908
  errors = merged.errors;
36858
36909
  }
@@ -37275,17 +37326,12 @@ export default theme;`;
37275
37326
  const { extraErrors, extraErrorsBlockSubmit, focusOnFirstError, onError } = this.props;
37276
37327
  const { errors: prevErrors } = this.state;
37277
37328
  const schemaValidation = this.validate(formData);
37278
- let errors = schemaValidation.errors;
37279
- let errorSchema = schemaValidation.errorSchema;
37280
- const schemaValidationErrors = errors;
37281
- const schemaValidationErrorSchema = errorSchema;
37282
- const hasError = errors.length > 0 || (extraErrors && extraErrorsBlockSubmit);
37329
+ // Always merge extraErrors so they remain visible in state regardless of extraErrorsBlockSubmit.
37330
+ const { errors, errorSchema } = extraErrors ? this.mergeErrors(schemaValidation, extraErrors) : schemaValidation;
37331
+ // hasError gates submission: schema errors always block; extraErrors only block when
37332
+ // extraErrorsBlockSubmit is set (non-breaking default: extraErrors are informational only).
37333
+ const hasError = schemaValidation.errors.length > 0 || (extraErrors && extraErrorsBlockSubmit);
37283
37334
  if (hasError) {
37284
- if (extraErrors) {
37285
- const merged = validationDataMerge(schemaValidation, extraErrors);
37286
- errorSchema = merged.errorSchema;
37287
- errors = merged.errors;
37288
- }
37289
37335
  if (focusOnFirstError) {
37290
37336
  if (typeof focusOnFirstError === 'function') {
37291
37337
  focusOnFirstError(errors[0]);
@@ -37297,8 +37343,8 @@ export default theme;`;
37297
37343
  this.setState({
37298
37344
  errors,
37299
37345
  errorSchema,
37300
- schemaValidationErrors,
37301
- schemaValidationErrorSchema,
37346
+ schemaValidationErrors: schemaValidation.errors,
37347
+ schemaValidationErrorSchema: schemaValidation.errorSchema,
37302
37348
  }, () => {
37303
37349
  if (onError) {
37304
37350
  onError(errors);
@@ -37308,6 +37354,15 @@ export default theme;`;
37308
37354
  }
37309
37355
  });
37310
37356
  }
37357
+ else if (errors.length > 0) {
37358
+ // Non-blocking extraErrors are present — update display state without triggering onError.
37359
+ this.setState({
37360
+ errors,
37361
+ errorSchema,
37362
+ schemaValidationErrors: [],
37363
+ schemaValidationErrorSchema: {},
37364
+ });
37365
+ }
37311
37366
  else if (prevErrors.length > 0) {
37312
37367
  this.setState({
37313
37368
  errors: [],