@rjsf/utils 5.1.0 → 5.2.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/dist/index.d.ts +92 -1
- package/dist/utils.cjs.development.js +102 -0
- package/dist/utils.cjs.development.js.map +1 -1
- package/dist/utils.cjs.production.min.js +1 -1
- package/dist/utils.cjs.production.min.js.map +1 -1
- package/dist/utils.esm.js +101 -1
- package/dist/utils.esm.js.map +1 -1
- package/dist/utils.umd.development.js +102 -0
- package/dist/utils.umd.development.js.map +1 -1
- package/dist/utils.umd.production.min.js +1 -1
- package/dist/utils.umd.production.min.js.map +1 -1
- package/package.json +2 -2
package/dist/utils.esm.js
CHANGED
|
@@ -1844,6 +1844,36 @@ function dataURItoBlob(dataURI) {
|
|
|
1844
1844
|
};
|
|
1845
1845
|
}
|
|
1846
1846
|
|
|
1847
|
+
/** Potentially substitutes all replaceable parameters with the associated value(s) from the `params` if available. When
|
|
1848
|
+
* a `params` array is provided, each value in the array is used to replace any of the replaceable parameters in the
|
|
1849
|
+
* `inputString` using the `%1`, `%2`, etc. replacement specifiers.
|
|
1850
|
+
*
|
|
1851
|
+
* @param inputString - The string which will be potentially updated with replacement parameters
|
|
1852
|
+
* @param params - The optional list of replaceable parameter values to substitute into the english string
|
|
1853
|
+
* @returns - The updated string with any replacement specifiers replaced
|
|
1854
|
+
*/
|
|
1855
|
+
function replaceStringParameters(inputString, params) {
|
|
1856
|
+
var output = inputString;
|
|
1857
|
+
if (Array.isArray(params)) {
|
|
1858
|
+
params.forEach(function (param, index) {
|
|
1859
|
+
output = output.replace("%" + (index + 1), param);
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
return output;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/** Translates a `TranslatableString` value `stringToTranslate` into english. When a `params` array is provided, each
|
|
1866
|
+
* value in the array is used to replace any of the replaceable parameters in the `stringToTranslate` using the `%1`,
|
|
1867
|
+
* `%2`, etc. replacement specifiers.
|
|
1868
|
+
*
|
|
1869
|
+
* @param stringToTranslate - The `TranslatableString` value to convert to english
|
|
1870
|
+
* @param params - The optional list of replaceable parameter values to substitute into the english string
|
|
1871
|
+
* @returns - The `stringToTranslate` itself with any replaceable parameter values substituted
|
|
1872
|
+
*/
|
|
1873
|
+
function englishStringTranslator(stringToTranslate, params) {
|
|
1874
|
+
return replaceStringParameters(stringToTranslate, params);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1847
1877
|
/** Returns the value(s) from `allEnumOptions` at the index(es) provided by `valueIndex`. If `valueIndex` is not an
|
|
1848
1878
|
* array AND the index is not valid for `allEnumOptions`, `emptyValue` is returned. If `valueIndex` is an array, AND it
|
|
1849
1879
|
* contains an invalid index, the returned array will have the resulting undefined values filtered out, leaving only
|
|
@@ -2663,5 +2693,75 @@ function utcToLocal(jsonDate) {
|
|
|
2663
2693
|
return yyyy + "-" + MM + "-" + dd + "T" + hh + ":" + mm + ":" + ss + "." + SSS;
|
|
2664
2694
|
}
|
|
2665
2695
|
|
|
2666
|
-
|
|
2696
|
+
/** An enumeration of all the translatable strings used by `@rjsf/core` and its themes. The value of each of the
|
|
2697
|
+
* enumeration keys is expected to be the actual english string. Some strings contain replaceable parameter values
|
|
2698
|
+
* as indicated by `%1`, `%2`, etc. The number after the `%` indicates the order of the parameter. The ordering of
|
|
2699
|
+
* parameters is important because some languages may choose to put the second parameter before the first in its
|
|
2700
|
+
* translation. Also, some strings are rendered using `markdown-to-jsx` and thus support markdown and inline html.
|
|
2701
|
+
*/
|
|
2702
|
+
var TranslatableString;
|
|
2703
|
+
(function (TranslatableString) {
|
|
2704
|
+
/** Fallback title of an array item, used by ArrayField */
|
|
2705
|
+
TranslatableString["ArrayItemTitle"] = "Item";
|
|
2706
|
+
/** Missing items reason, used by ArrayField */
|
|
2707
|
+
TranslatableString["MissingItems"] = "Missing items definition";
|
|
2708
|
+
/** Yes label, used by BooleanField */
|
|
2709
|
+
TranslatableString["YesLabel"] = "Yes";
|
|
2710
|
+
/** No label, used by BooleanField */
|
|
2711
|
+
TranslatableString["NoLabel"] = "No";
|
|
2712
|
+
/** Close label, used by ErrorList */
|
|
2713
|
+
TranslatableString["CloseLabel"] = "Close";
|
|
2714
|
+
/** Errors label, used by ErrorList */
|
|
2715
|
+
TranslatableString["ErrorsLabel"] = "Errors";
|
|
2716
|
+
/** New additionalProperties string default value, used by ObjectField */
|
|
2717
|
+
TranslatableString["NewStringDefault"] = "New Value";
|
|
2718
|
+
/** Add button title, used by AddButton */
|
|
2719
|
+
TranslatableString["AddButton"] = "Add";
|
|
2720
|
+
/** Add button title, used by AddButton */
|
|
2721
|
+
TranslatableString["AddItemButton"] = "Add Item";
|
|
2722
|
+
/** Move down button title, used by IconButton */
|
|
2723
|
+
TranslatableString["MoveDownButton"] = "Move down";
|
|
2724
|
+
/** Move up button title, used by IconButton */
|
|
2725
|
+
TranslatableString["MoveUpButton"] = "Move up";
|
|
2726
|
+
/** Remove button title, used by IconButton */
|
|
2727
|
+
TranslatableString["RemoveButton"] = "Remove";
|
|
2728
|
+
/** Now label, used by AltDateWidget */
|
|
2729
|
+
TranslatableString["NowLabel"] = "Now";
|
|
2730
|
+
/** Clear label, used by AltDateWidget */
|
|
2731
|
+
TranslatableString["ClearLabel"] = "Clear";
|
|
2732
|
+
/** Aria date label, used by DateWidget */
|
|
2733
|
+
TranslatableString["AriaDateLabel"] = "Select a date";
|
|
2734
|
+
/** Decrement button aria label, used by UpDownWidget */
|
|
2735
|
+
TranslatableString["DecrementAriaLabel"] = "Decrease value by 1";
|
|
2736
|
+
/** Increment button aria label, used by UpDownWidget */
|
|
2737
|
+
TranslatableString["IncrementAriaLabel"] = "Increase value by 1";
|
|
2738
|
+
// Strings with replaceable parameters
|
|
2739
|
+
/** Unknown field type reason, where %1 will be replaced with the type as provided by SchemaField */
|
|
2740
|
+
TranslatableString["UnknownFieldType"] = "Unknown field type %1";
|
|
2741
|
+
/** Option prefix, where %1 will be replaced with the option index as provided by MultiSchemaField */
|
|
2742
|
+
TranslatableString["OptionPrefix"] = "Option %1";
|
|
2743
|
+
/** Option prefix, where %1 and %2 will be replaced by the schema title and option index, respectively as provided by
|
|
2744
|
+
* MultiSchemaField
|
|
2745
|
+
*/
|
|
2746
|
+
TranslatableString["TitleOptionPrefix"] = "%1 option %2";
|
|
2747
|
+
/** Key label, where %1 will be replaced by the label as provided by WrapIfAdditionalTemplate */
|
|
2748
|
+
TranslatableString["KeyLabel"] = "%1 Key";
|
|
2749
|
+
// Strings with replaceable parameters AND/OR that support markdown and html
|
|
2750
|
+
/** Unsupported field schema, used by UnsupportedField */
|
|
2751
|
+
TranslatableString["UnsupportedField"] = "Unsupported field schema.";
|
|
2752
|
+
/** Unsupported field schema, where %1 will be replaced by the idSchema.$id as provided by UnsupportedField */
|
|
2753
|
+
TranslatableString["UnsupportedFieldWithId"] = "Unsupported field schema for field <code>%1</code>.";
|
|
2754
|
+
/** Unsupported field schema, where %1 will be replaced by the reason string as provided by UnsupportedField */
|
|
2755
|
+
TranslatableString["UnsupportedFieldWithReason"] = "Unsupported field schema: <em>%1</em>.";
|
|
2756
|
+
/** Unsupported field schema, where %1 and %2 will be replaced by the idSchema.$id and reason strings, respectively,
|
|
2757
|
+
* as provided by UnsupportedField
|
|
2758
|
+
*/
|
|
2759
|
+
TranslatableString["UnsupportedFieldWithIdAndReason"] = "Unsupported field schema for field <code>%1</code>: <em>%2</em>.";
|
|
2760
|
+
/** File name, type and size info, where %1, %2 and %3 will be replaced by the file name, file type and file size as
|
|
2761
|
+
* provided by FileWidget
|
|
2762
|
+
*/
|
|
2763
|
+
TranslatableString["FilesInfo"] = "<strong>%1</strong> (%2, %3 bytes)";
|
|
2764
|
+
})(TranslatableString || (TranslatableString = {}));
|
|
2765
|
+
|
|
2766
|
+
export { ADDITIONAL_PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ALL_OF_KEY, ANY_OF_KEY, CONST_KEY, DEFAULT_KEY, DEFINITIONS_KEY, DEPENDENCIES_KEY, ENUM_KEY, ERRORS_KEY, ErrorSchemaBuilder, ID_KEY, ITEMS_KEY, NAME_KEY, ONE_OF_KEY, PROPERTIES_KEY, REF_KEY, REQUIRED_KEY, RJSF_ADDITONAL_PROPERTIES_FLAG, SUBMIT_BTN_OPTIONS_KEY, TranslatableString, UI_FIELD_KEY, UI_OPTIONS_KEY, UI_WIDGET_KEY, allowAdditionalItems, ariaDescribedByIds, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, descriptionId, englishStringTranslator, enumOptionsDeselectValue, enumOptionsIndexForValue, enumOptionsIsSelected, enumOptionsSelectValue, enumOptionsValueForIndex, errorId, examplesId, findSchemaDefinition, getClosestMatchingOption, getDefaultFormState, getDisplayLabel, getFirstMatchingOption, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, helpId, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionId, optionsList, orderProperties, pad, parseDateString, rangeSpec, replaceStringParameters, retrieveSchema, sanitizeDataForNewSchema, schemaRequiresTrueValue, shouldRender, titleId, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };
|
|
2667
2767
|
//# sourceMappingURL=utils.esm.js.map
|