@rjsf/core 5.24.4 → 5.24.7
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/core.umd.js +602 -601
- package/dist/index.esm.js +602 -601
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +602 -601
- package/dist/index.js.map +2 -2
- package/lib/components/Form.d.ts +1 -0
- package/lib/components/Form.d.ts.map +1 -0
- package/lib/components/Form.js +293 -293
- package/lib/components/fields/ArrayField.d.ts +1 -0
- package/lib/components/fields/ArrayField.d.ts.map +1 -0
- package/lib/components/fields/ArrayField.js +190 -194
- package/lib/components/fields/BooleanField.d.ts +1 -0
- package/lib/components/fields/BooleanField.d.ts.map +1 -0
- package/lib/components/fields/BooleanField.js +3 -5
- package/lib/components/fields/MultiSchemaField.d.ts +1 -0
- package/lib/components/fields/MultiSchemaField.d.ts.map +1 -0
- package/lib/components/fields/MultiSchemaField.js +30 -31
- package/lib/components/fields/NullField.d.ts +1 -0
- package/lib/components/fields/NullField.d.ts.map +1 -0
- package/lib/components/fields/NullField.js +0 -1
- package/lib/components/fields/NumberField.d.ts +1 -0
- package/lib/components/fields/NumberField.d.ts.map +1 -0
- package/lib/components/fields/NumberField.js +0 -1
- package/lib/components/fields/ObjectField.d.ts +1 -0
- package/lib/components/fields/ObjectField.d.ts.map +1 -0
- package/lib/components/fields/ObjectField.js +139 -145
- package/lib/components/fields/SchemaField.d.ts +1 -0
- package/lib/components/fields/SchemaField.d.ts.map +1 -0
- package/lib/components/fields/SchemaField.js +7 -9
- package/lib/components/fields/StringField.d.ts +1 -0
- package/lib/components/fields/StringField.d.ts.map +1 -0
- package/lib/components/fields/StringField.js +1 -3
- package/lib/components/fields/index.d.ts +1 -0
- package/lib/components/fields/index.d.ts.map +1 -0
- package/lib/components/fields/index.js +8 -9
- package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.js +0 -1
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts +1 -0
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -0
- package/lib/components/templates/ArrayFieldItemTemplate.js +0 -1
- package/lib/components/templates/ArrayFieldTemplate.d.ts +1 -0
- package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -0
- package/lib/components/templates/ArrayFieldTemplate.js +0 -1
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -0
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -0
- package/lib/components/templates/ArrayFieldTitleTemplate.js +0 -1
- package/lib/components/templates/BaseInputTemplate.d.ts +1 -0
- package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -0
- package/lib/components/templates/BaseInputTemplate.js +0 -1
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -0
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -0
- package/lib/components/templates/ButtonTemplates/AddButton.js +1 -2
- package/lib/components/templates/ButtonTemplates/IconButton.d.ts +1 -0
- package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -0
- package/lib/components/templates/ButtonTemplates/IconButton.js +0 -1
- package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +1 -0
- package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -0
- package/lib/components/templates/ButtonTemplates/SubmitButton.js +0 -1
- package/lib/components/templates/ButtonTemplates/index.d.ts +1 -0
- package/lib/components/templates/ButtonTemplates/index.d.ts.map +1 -0
- package/lib/components/templates/ButtonTemplates/index.js +3 -4
- package/lib/components/templates/DescriptionField.d.ts +1 -0
- package/lib/components/templates/DescriptionField.d.ts.map +1 -0
- package/lib/components/templates/DescriptionField.js +0 -1
- package/lib/components/templates/ErrorList.d.ts +1 -0
- package/lib/components/templates/ErrorList.d.ts.map +1 -0
- package/lib/components/templates/ErrorList.js +0 -1
- package/lib/components/templates/FieldErrorTemplate.d.ts +1 -0
- package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -0
- package/lib/components/templates/FieldErrorTemplate.js +0 -1
- package/lib/components/templates/FieldHelpTemplate.d.ts +1 -0
- package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -0
- package/lib/components/templates/FieldHelpTemplate.js +0 -1
- package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +1 -0
- package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -0
- package/lib/components/templates/FieldTemplate/FieldTemplate.js +1 -2
- package/lib/components/templates/FieldTemplate/Label.d.ts +1 -0
- package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -0
- package/lib/components/templates/FieldTemplate/Label.js +0 -1
- package/lib/components/templates/FieldTemplate/index.d.ts +2 -1
- package/lib/components/templates/FieldTemplate/index.d.ts.map +1 -0
- package/lib/components/templates/FieldTemplate/index.js +1 -2
- package/lib/components/templates/ObjectFieldTemplate.d.ts +1 -0
- package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -0
- package/lib/components/templates/ObjectFieldTemplate.js +0 -1
- package/lib/components/templates/TitleField.d.ts +1 -0
- package/lib/components/templates/TitleField.d.ts.map +1 -0
- package/lib/components/templates/TitleField.js +0 -1
- package/lib/components/templates/UnsupportedField.d.ts +1 -0
- package/lib/components/templates/UnsupportedField.d.ts.map +1 -0
- package/lib/components/templates/UnsupportedField.js +0 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +1 -0
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -0
- package/lib/components/templates/WrapIfAdditionalTemplate.js +1 -2
- package/lib/components/templates/index.d.ts +1 -0
- package/lib/components/templates/index.d.ts.map +1 -0
- package/lib/components/templates/index.js +15 -16
- package/lib/components/widgets/AltDateTimeWidget.d.ts +1 -0
- package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -0
- package/lib/components/widgets/AltDateTimeWidget.js +0 -1
- package/lib/components/widgets/AltDateWidget.d.ts +1 -0
- package/lib/components/widgets/AltDateWidget.d.ts.map +1 -0
- package/lib/components/widgets/AltDateWidget.js +0 -1
- package/lib/components/widgets/CheckboxWidget.d.ts +1 -0
- package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -0
- package/lib/components/widgets/CheckboxWidget.js +1 -3
- package/lib/components/widgets/CheckboxesWidget.d.ts +1 -0
- package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -0
- package/lib/components/widgets/CheckboxesWidget.js +0 -1
- package/lib/components/widgets/ColorWidget.d.ts +1 -0
- package/lib/components/widgets/ColorWidget.d.ts.map +1 -0
- package/lib/components/widgets/ColorWidget.js +0 -1
- package/lib/components/widgets/DateTimeWidget.d.ts +1 -0
- package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -0
- package/lib/components/widgets/DateTimeWidget.js +0 -1
- package/lib/components/widgets/DateWidget.d.ts +1 -0
- package/lib/components/widgets/DateWidget.d.ts.map +1 -0
- package/lib/components/widgets/DateWidget.js +0 -1
- package/lib/components/widgets/EmailWidget.d.ts +1 -0
- package/lib/components/widgets/EmailWidget.d.ts.map +1 -0
- package/lib/components/widgets/EmailWidget.js +0 -1
- package/lib/components/widgets/FileWidget.d.ts +1 -0
- package/lib/components/widgets/FileWidget.d.ts.map +1 -0
- package/lib/components/widgets/FileWidget.js +1 -3
- package/lib/components/widgets/HiddenWidget.d.ts +1 -0
- package/lib/components/widgets/HiddenWidget.d.ts.map +1 -0
- package/lib/components/widgets/HiddenWidget.js +0 -1
- package/lib/components/widgets/PasswordWidget.d.ts +1 -0
- package/lib/components/widgets/PasswordWidget.d.ts.map +1 -0
- package/lib/components/widgets/PasswordWidget.js +0 -1
- package/lib/components/widgets/RadioWidget.d.ts +1 -0
- package/lib/components/widgets/RadioWidget.d.ts.map +1 -0
- package/lib/components/widgets/RadioWidget.js +0 -1
- package/lib/components/widgets/RangeWidget.d.ts +1 -0
- package/lib/components/widgets/RangeWidget.d.ts.map +1 -0
- package/lib/components/widgets/RangeWidget.js +0 -1
- package/lib/components/widgets/SelectWidget.d.ts +1 -0
- package/lib/components/widgets/SelectWidget.d.ts.map +1 -0
- package/lib/components/widgets/SelectWidget.js +0 -1
- package/lib/components/widgets/TextWidget.d.ts +1 -0
- package/lib/components/widgets/TextWidget.d.ts.map +1 -0
- package/lib/components/widgets/TextWidget.js +0 -1
- package/lib/components/widgets/TextareaWidget.d.ts +1 -0
- package/lib/components/widgets/TextareaWidget.d.ts.map +1 -0
- package/lib/components/widgets/TextareaWidget.js +0 -1
- package/lib/components/widgets/TimeWidget.d.ts +1 -0
- package/lib/components/widgets/TimeWidget.d.ts.map +1 -0
- package/lib/components/widgets/TimeWidget.js +0 -1
- package/lib/components/widgets/URLWidget.d.ts +1 -0
- package/lib/components/widgets/URLWidget.d.ts.map +1 -0
- package/lib/components/widgets/URLWidget.js +0 -1
- package/lib/components/widgets/UpDownWidget.d.ts +1 -0
- package/lib/components/widgets/UpDownWidget.d.ts.map +1 -0
- package/lib/components/widgets/UpDownWidget.js +0 -1
- package/lib/components/widgets/index.d.ts +1 -0
- package/lib/components/widgets/index.d.ts.map +1 -0
- package/lib/components/widgets/index.js +19 -20
- package/lib/getDefaultRegistry.d.ts +1 -0
- package/lib/getDefaultRegistry.d.ts.map +1 -0
- package/lib/getDefaultRegistry.js +3 -4
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +3 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/withTheme.d.ts +2 -1
- package/lib/withTheme.d.ts.map +1 -0
- package/lib/withTheme.js +6 -8
- package/package.json +31 -9
- package/src/tsconfig.json +14 -3
- package/lib/components/Form.js.map +0 -1
- package/lib/components/fields/ArrayField.js.map +0 -1
- package/lib/components/fields/BooleanField.js.map +0 -1
- package/lib/components/fields/MultiSchemaField.js.map +0 -1
- package/lib/components/fields/NullField.js.map +0 -1
- package/lib/components/fields/NumberField.js.map +0 -1
- package/lib/components/fields/ObjectField.js.map +0 -1
- package/lib/components/fields/SchemaField.js.map +0 -1
- package/lib/components/fields/StringField.js.map +0 -1
- package/lib/components/fields/index.js.map +0 -1
- package/lib/components/templates/ArrayFieldDescriptionTemplate.js.map +0 -1
- package/lib/components/templates/ArrayFieldItemTemplate.js.map +0 -1
- package/lib/components/templates/ArrayFieldTemplate.js.map +0 -1
- package/lib/components/templates/ArrayFieldTitleTemplate.js.map +0 -1
- package/lib/components/templates/BaseInputTemplate.js.map +0 -1
- package/lib/components/templates/ButtonTemplates/AddButton.js.map +0 -1
- package/lib/components/templates/ButtonTemplates/IconButton.js.map +0 -1
- package/lib/components/templates/ButtonTemplates/SubmitButton.js.map +0 -1
- package/lib/components/templates/ButtonTemplates/index.js.map +0 -1
- package/lib/components/templates/DescriptionField.js.map +0 -1
- package/lib/components/templates/ErrorList.js.map +0 -1
- package/lib/components/templates/FieldErrorTemplate.js.map +0 -1
- package/lib/components/templates/FieldHelpTemplate.js.map +0 -1
- package/lib/components/templates/FieldTemplate/FieldTemplate.js.map +0 -1
- package/lib/components/templates/FieldTemplate/Label.js.map +0 -1
- package/lib/components/templates/FieldTemplate/index.js.map +0 -1
- package/lib/components/templates/ObjectFieldTemplate.js.map +0 -1
- package/lib/components/templates/TitleField.js.map +0 -1
- package/lib/components/templates/UnsupportedField.js.map +0 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.js.map +0 -1
- package/lib/components/templates/index.js.map +0 -1
- package/lib/components/widgets/AltDateTimeWidget.js.map +0 -1
- package/lib/components/widgets/AltDateWidget.js.map +0 -1
- package/lib/components/widgets/CheckboxWidget.js.map +0 -1
- package/lib/components/widgets/CheckboxesWidget.js.map +0 -1
- package/lib/components/widgets/ColorWidget.js.map +0 -1
- package/lib/components/widgets/DateTimeWidget.js.map +0 -1
- package/lib/components/widgets/DateWidget.js.map +0 -1
- package/lib/components/widgets/EmailWidget.js.map +0 -1
- package/lib/components/widgets/FileWidget.js.map +0 -1
- package/lib/components/widgets/HiddenWidget.js.map +0 -1
- package/lib/components/widgets/PasswordWidget.js.map +0 -1
- package/lib/components/widgets/RadioWidget.js.map +0 -1
- package/lib/components/widgets/RangeWidget.js.map +0 -1
- package/lib/components/widgets/SelectWidget.js.map +0 -1
- package/lib/components/widgets/TextWidget.js.map +0 -1
- package/lib/components/widgets/TextareaWidget.js.map +0 -1
- package/lib/components/widgets/TimeWidget.js.map +0 -1
- package/lib/components/widgets/URLWidget.js.map +0 -1
- package/lib/components/widgets/UpDownWidget.js.map +0 -1
- package/lib/components/widgets/index.js.map +0 -1
- package/lib/getDefaultRegistry.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/withTheme.js.map +0 -1
|
@@ -2,153 +2,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
import { getTemplate, getUiOptions, orderProperties, TranslatableString, ADDITIONAL_PROPERTY_FLAG, PROPERTIES_KEY, REF_KEY, ANY_OF_KEY, ONE_OF_KEY, } from '@rjsf/utils';
|
|
4
4
|
import Markdown from 'markdown-to-jsx';
|
|
5
|
-
import get from 'lodash/get';
|
|
6
|
-
import has from 'lodash/has';
|
|
7
|
-
import isObject from 'lodash/isObject';
|
|
8
|
-
import set from 'lodash/set';
|
|
9
|
-
import unset from 'lodash/unset';
|
|
5
|
+
import get from 'lodash-es/get.js';
|
|
6
|
+
import has from 'lodash-es/has.js';
|
|
7
|
+
import isObject from 'lodash-es/isObject.js';
|
|
8
|
+
import set from 'lodash-es/set.js';
|
|
9
|
+
import unset from 'lodash-es/unset.js';
|
|
10
10
|
/** The `ObjectField` component is used to render a field in the schema that is of type `object`. It tracks whether an
|
|
11
11
|
* additional property key was modified and what it was modified to
|
|
12
12
|
*
|
|
13
13
|
* @param props - The `FieldProps` for this template
|
|
14
14
|
*/
|
|
15
15
|
class ObjectField extends Component {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
additionalProperties: {},
|
|
22
|
-
};
|
|
23
|
-
/** Returns the `onPropertyChange` handler for the `name` field. Handles the special case where a user is attempting
|
|
24
|
-
* to clear the data for a field added as an additional property. Calls the `onChange()` handler with the updated
|
|
25
|
-
* formData.
|
|
26
|
-
*
|
|
27
|
-
* @param name - The name of the property
|
|
28
|
-
* @param addedByAdditionalProperties - Flag indicating whether this property is an additional property
|
|
29
|
-
* @returns - The onPropertyChange callback for the `name` property
|
|
30
|
-
*/
|
|
31
|
-
this.onPropertyChange = (name, addedByAdditionalProperties = false) => {
|
|
32
|
-
return (value, newErrorSchema, id) => {
|
|
33
|
-
const { formData, onChange, errorSchema } = this.props;
|
|
34
|
-
if (value === undefined && addedByAdditionalProperties) {
|
|
35
|
-
// Don't set value = undefined for fields added by
|
|
36
|
-
// additionalProperties. Doing so removes them from the
|
|
37
|
-
// formData, which causes them to completely disappear
|
|
38
|
-
// (including the input field for the property name). Unlike
|
|
39
|
-
// fields which are "mandated" by the schema, these fields can
|
|
40
|
-
// be set to undefined by clicking a "delete field" button, so
|
|
41
|
-
// set empty values to the empty string.
|
|
42
|
-
value = '';
|
|
43
|
-
}
|
|
44
|
-
const newFormData = { ...formData, [name]: value };
|
|
45
|
-
onChange(newFormData, errorSchema &&
|
|
46
|
-
errorSchema && {
|
|
47
|
-
...errorSchema,
|
|
48
|
-
[name]: newErrorSchema,
|
|
49
|
-
}, id);
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
/** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data
|
|
53
|
-
* and calls the `onChange` callback with it
|
|
54
|
-
*
|
|
55
|
-
* @param key - The key for which the drop callback is desired
|
|
56
|
-
* @returns - The drop property click callback
|
|
57
|
-
*/
|
|
58
|
-
this.onDropPropertyClick = (key) => {
|
|
59
|
-
return (event) => {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
const { onChange, formData } = this.props;
|
|
62
|
-
const copiedFormData = { ...formData };
|
|
63
|
-
unset(copiedFormData, key);
|
|
64
|
-
onChange(copiedFormData);
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
/** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
|
|
68
|
-
* that is already not assigned is found.
|
|
69
|
-
*
|
|
70
|
-
* @param preferredKey - The preferred name of a new key
|
|
71
|
-
* @param [formData] - The form data in which to check if the desired key already exists
|
|
72
|
-
* @returns - The name of the next available key from `preferredKey`
|
|
73
|
-
*/
|
|
74
|
-
this.getAvailableKey = (preferredKey, formData) => {
|
|
75
|
-
const { uiSchema, registry } = this.props;
|
|
76
|
-
const { duplicateKeySuffixSeparator = '-' } = getUiOptions(uiSchema, registry.globalUiOptions);
|
|
77
|
-
let index = 0;
|
|
78
|
-
let newKey = preferredKey;
|
|
79
|
-
while (has(formData, newKey)) {
|
|
80
|
-
newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;
|
|
81
|
-
}
|
|
82
|
-
return newKey;
|
|
83
|
-
};
|
|
84
|
-
/** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
|
|
85
|
-
* callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.
|
|
86
|
-
*
|
|
87
|
-
* @param oldValue - The old value of a field
|
|
88
|
-
* @returns - The key change callback function
|
|
89
|
-
*/
|
|
90
|
-
this.onKeyChange = (oldValue) => {
|
|
91
|
-
return (value, newErrorSchema) => {
|
|
92
|
-
if (oldValue === value) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const { formData, onChange, errorSchema } = this.props;
|
|
96
|
-
value = this.getAvailableKey(value, formData);
|
|
97
|
-
const newFormData = {
|
|
98
|
-
...formData,
|
|
99
|
-
};
|
|
100
|
-
const newKeys = { [oldValue]: value };
|
|
101
|
-
const keyValues = Object.keys(newFormData).map((key) => {
|
|
102
|
-
const newKey = newKeys[key] || key;
|
|
103
|
-
return { [newKey]: newFormData[key] };
|
|
104
|
-
});
|
|
105
|
-
const renamedObj = Object.assign({}, ...keyValues);
|
|
106
|
-
this.setState({ wasPropertyKeyModified: true });
|
|
107
|
-
onChange(renamedObj, errorSchema &&
|
|
108
|
-
errorSchema && {
|
|
109
|
-
...errorSchema,
|
|
110
|
-
[value]: newErrorSchema,
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
/** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new
|
|
115
|
-
* default data for that field has been added to the formData.
|
|
116
|
-
*
|
|
117
|
-
* @param schema - The schema element to which the new property is being added
|
|
118
|
-
*/
|
|
119
|
-
this.handleAddClick = (schema) => () => {
|
|
120
|
-
var _a;
|
|
121
|
-
if (!schema.additionalProperties) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const { formData, onChange, registry } = this.props;
|
|
125
|
-
const newFormData = { ...formData };
|
|
126
|
-
let type = undefined;
|
|
127
|
-
let constValue = undefined;
|
|
128
|
-
let defaultValue = undefined;
|
|
129
|
-
if (isObject(schema.additionalProperties)) {
|
|
130
|
-
type = schema.additionalProperties.type;
|
|
131
|
-
constValue = schema.additionalProperties.const;
|
|
132
|
-
defaultValue = schema.additionalProperties.default;
|
|
133
|
-
let apSchema = schema.additionalProperties;
|
|
134
|
-
if (REF_KEY in apSchema) {
|
|
135
|
-
const { schemaUtils } = registry;
|
|
136
|
-
apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] }, formData);
|
|
137
|
-
type = apSchema.type;
|
|
138
|
-
constValue = apSchema.const;
|
|
139
|
-
defaultValue = apSchema.default;
|
|
140
|
-
}
|
|
141
|
-
if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
|
|
142
|
-
type = 'object';
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const newKey = this.getAvailableKey('newKey', newFormData);
|
|
146
|
-
const newValue = (_a = constValue !== null && constValue !== void 0 ? constValue : defaultValue) !== null && _a !== void 0 ? _a : this.getDefaultValue(type);
|
|
147
|
-
// Cast this to make the `set` work properly
|
|
148
|
-
set(newFormData, newKey, newValue);
|
|
149
|
-
onChange(newFormData);
|
|
150
|
-
};
|
|
151
|
-
}
|
|
16
|
+
/** Set up the initial state */
|
|
17
|
+
state = {
|
|
18
|
+
wasPropertyKeyModified: false,
|
|
19
|
+
additionalProperties: {},
|
|
20
|
+
};
|
|
152
21
|
/** Returns a flag indicating whether the `name` field is required in the object schema
|
|
153
22
|
*
|
|
154
23
|
* @param name - The name of the field to check for required-ness
|
|
@@ -158,6 +27,97 @@ class ObjectField extends Component {
|
|
|
158
27
|
const { schema } = this.props;
|
|
159
28
|
return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
|
|
160
29
|
}
|
|
30
|
+
/** Returns the `onPropertyChange` handler for the `name` field. Handles the special case where a user is attempting
|
|
31
|
+
* to clear the data for a field added as an additional property. Calls the `onChange()` handler with the updated
|
|
32
|
+
* formData.
|
|
33
|
+
*
|
|
34
|
+
* @param name - The name of the property
|
|
35
|
+
* @param addedByAdditionalProperties - Flag indicating whether this property is an additional property
|
|
36
|
+
* @returns - The onPropertyChange callback for the `name` property
|
|
37
|
+
*/
|
|
38
|
+
onPropertyChange = (name, addedByAdditionalProperties = false) => {
|
|
39
|
+
return (value, newErrorSchema, id) => {
|
|
40
|
+
const { formData, onChange, errorSchema } = this.props;
|
|
41
|
+
if (value === undefined && addedByAdditionalProperties) {
|
|
42
|
+
// Don't set value = undefined for fields added by
|
|
43
|
+
// additionalProperties. Doing so removes them from the
|
|
44
|
+
// formData, which causes them to completely disappear
|
|
45
|
+
// (including the input field for the property name). Unlike
|
|
46
|
+
// fields which are "mandated" by the schema, these fields can
|
|
47
|
+
// be set to undefined by clicking a "delete field" button, so
|
|
48
|
+
// set empty values to the empty string.
|
|
49
|
+
value = '';
|
|
50
|
+
}
|
|
51
|
+
const newFormData = { ...formData, [name]: value };
|
|
52
|
+
onChange(newFormData, errorSchema &&
|
|
53
|
+
errorSchema && {
|
|
54
|
+
...errorSchema,
|
|
55
|
+
[name]: newErrorSchema,
|
|
56
|
+
}, id);
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
/** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data
|
|
60
|
+
* and calls the `onChange` callback with it
|
|
61
|
+
*
|
|
62
|
+
* @param key - The key for which the drop callback is desired
|
|
63
|
+
* @returns - The drop property click callback
|
|
64
|
+
*/
|
|
65
|
+
onDropPropertyClick = (key) => {
|
|
66
|
+
return (event) => {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
const { onChange, formData } = this.props;
|
|
69
|
+
const copiedFormData = { ...formData };
|
|
70
|
+
unset(copiedFormData, key);
|
|
71
|
+
onChange(copiedFormData);
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
|
|
75
|
+
* that is already not assigned is found.
|
|
76
|
+
*
|
|
77
|
+
* @param preferredKey - The preferred name of a new key
|
|
78
|
+
* @param [formData] - The form data in which to check if the desired key already exists
|
|
79
|
+
* @returns - The name of the next available key from `preferredKey`
|
|
80
|
+
*/
|
|
81
|
+
getAvailableKey = (preferredKey, formData) => {
|
|
82
|
+
const { uiSchema, registry } = this.props;
|
|
83
|
+
const { duplicateKeySuffixSeparator = '-' } = getUiOptions(uiSchema, registry.globalUiOptions);
|
|
84
|
+
let index = 0;
|
|
85
|
+
let newKey = preferredKey;
|
|
86
|
+
while (has(formData, newKey)) {
|
|
87
|
+
newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;
|
|
88
|
+
}
|
|
89
|
+
return newKey;
|
|
90
|
+
};
|
|
91
|
+
/** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
|
|
92
|
+
* callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.
|
|
93
|
+
*
|
|
94
|
+
* @param oldValue - The old value of a field
|
|
95
|
+
* @returns - The key change callback function
|
|
96
|
+
*/
|
|
97
|
+
onKeyChange = (oldValue) => {
|
|
98
|
+
return (value, newErrorSchema) => {
|
|
99
|
+
if (oldValue === value) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const { formData, onChange, errorSchema } = this.props;
|
|
103
|
+
value = this.getAvailableKey(value, formData);
|
|
104
|
+
const newFormData = {
|
|
105
|
+
...formData,
|
|
106
|
+
};
|
|
107
|
+
const newKeys = { [oldValue]: value };
|
|
108
|
+
const keyValues = Object.keys(newFormData).map((key) => {
|
|
109
|
+
const newKey = newKeys[key] || key;
|
|
110
|
+
return { [newKey]: newFormData[key] };
|
|
111
|
+
});
|
|
112
|
+
const renamedObj = Object.assign({}, ...keyValues);
|
|
113
|
+
this.setState({ wasPropertyKeyModified: true });
|
|
114
|
+
onChange(renamedObj, errorSchema &&
|
|
115
|
+
errorSchema && {
|
|
116
|
+
...errorSchema,
|
|
117
|
+
[value]: newErrorSchema,
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
};
|
|
161
121
|
/** Returns a default value to be used for a new additional schema property of the given `type`
|
|
162
122
|
*
|
|
163
123
|
* @param type - The type of the new additional schema property
|
|
@@ -181,18 +141,53 @@ class ObjectField extends Component {
|
|
|
181
141
|
return translateString(TranslatableString.NewStringDefault);
|
|
182
142
|
}
|
|
183
143
|
}
|
|
144
|
+
/** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new
|
|
145
|
+
* default data for that field has been added to the formData.
|
|
146
|
+
*
|
|
147
|
+
* @param schema - The schema element to which the new property is being added
|
|
148
|
+
*/
|
|
149
|
+
handleAddClick = (schema) => () => {
|
|
150
|
+
if (!schema.additionalProperties) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const { formData, onChange, registry } = this.props;
|
|
154
|
+
const newFormData = { ...formData };
|
|
155
|
+
let type = undefined;
|
|
156
|
+
let constValue = undefined;
|
|
157
|
+
let defaultValue = undefined;
|
|
158
|
+
if (isObject(schema.additionalProperties)) {
|
|
159
|
+
type = schema.additionalProperties.type;
|
|
160
|
+
constValue = schema.additionalProperties.const;
|
|
161
|
+
defaultValue = schema.additionalProperties.default;
|
|
162
|
+
let apSchema = schema.additionalProperties;
|
|
163
|
+
if (REF_KEY in apSchema) {
|
|
164
|
+
const { schemaUtils } = registry;
|
|
165
|
+
apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] }, formData);
|
|
166
|
+
type = apSchema.type;
|
|
167
|
+
constValue = apSchema.const;
|
|
168
|
+
defaultValue = apSchema.default;
|
|
169
|
+
}
|
|
170
|
+
if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
|
|
171
|
+
type = 'object';
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const newKey = this.getAvailableKey('newKey', newFormData);
|
|
175
|
+
const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
|
|
176
|
+
// Cast this to make the `set` work properly
|
|
177
|
+
set(newFormData, newKey, newValue);
|
|
178
|
+
onChange(newFormData);
|
|
179
|
+
};
|
|
184
180
|
/** Renders the `ObjectField` from the given props
|
|
185
181
|
*/
|
|
186
182
|
render() {
|
|
187
|
-
var _a, _b, _c, _d;
|
|
188
183
|
const { schema: rawSchema, uiSchema = {}, formData, errorSchema, idSchema, name, required = false, disabled, readonly, hideError, idPrefix, idSeparator, onBlur, onFocus, registry, title, } = this.props;
|
|
189
184
|
const { fields, formContext, schemaUtils, translateString, globalUiOptions } = registry;
|
|
190
185
|
const { SchemaField } = fields;
|
|
191
186
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData);
|
|
192
187
|
const uiOptions = getUiOptions(uiSchema, globalUiOptions);
|
|
193
188
|
const { properties: schemaProperties = {} } = schema;
|
|
194
|
-
const templateTitle =
|
|
195
|
-
const description =
|
|
189
|
+
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
190
|
+
const description = uiOptions.description ?? schema.description;
|
|
196
191
|
let orderedProperties;
|
|
197
192
|
try {
|
|
198
193
|
const properties = Object.keys(schemaProperties);
|
|
@@ -235,4 +230,3 @@ class ObjectField extends Component {
|
|
|
235
230
|
}
|
|
236
231
|
}
|
|
237
232
|
export default ObjectField;
|
|
238
|
-
//# sourceMappingURL=ObjectField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/SchemaField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAKL,UAAU,EAEV,eAAe,EAQf,UAAU,EACV,gBAAgB,EAIjB,MAAM,aAAa,CAAC;AA4UrB;;GAEG;AACH,cAAM,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,CAAE,SAAQ,SAAS,CACpH,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACpB;IACC,qBAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAI9D,MAAM;CAGP;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, Component } from 'react';
|
|
3
3
|
import { ADDITIONAL_PROPERTY_FLAG, deepEquals, descriptionId, getSchemaType, getTemplate, getUiOptions, ID_KEY, mergeObjects, TranslatableString, UI_OPTIONS_KEY, } from '@rjsf/utils';
|
|
4
|
-
import isObject from 'lodash/isObject';
|
|
5
|
-
import omit from 'lodash/omit';
|
|
4
|
+
import isObject from 'lodash-es/isObject.js';
|
|
5
|
+
import omit from 'lodash-es/omit.js';
|
|
6
6
|
import Markdown from 'markdown-to-jsx';
|
|
7
7
|
/** The map of component type to FieldName */
|
|
8
8
|
const COMPONENT_TYPES = {
|
|
@@ -59,7 +59,6 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
|
|
|
59
59
|
* @param props - The `FieldProps` for this component
|
|
60
60
|
*/
|
|
61
61
|
function SchemaFieldRender(props) {
|
|
62
|
-
var _a, _b, _c;
|
|
63
62
|
const { schema: _schema, idSchema: _idSchema, uiSchema, formData, errorSchema, idPrefix, idSeparator, name, onChange, onKeyChange, onDropPropertyClick, required, registry, wasPropertyKeyModified = false, } = props;
|
|
64
63
|
const { formContext, schemaUtils, globalUiOptions } = registry;
|
|
65
64
|
const uiOptions = getUiOptions(uiSchema, globalUiOptions);
|
|
@@ -78,12 +77,12 @@ function SchemaFieldRender(props) {
|
|
|
78
77
|
return onChange(formData, newErrorSchema, theId);
|
|
79
78
|
}, [fieldId, onChange]);
|
|
80
79
|
const FieldComponent = getFieldComponent(schema, uiOptions, idSchema, registry);
|
|
81
|
-
const disabled = Boolean(
|
|
82
|
-
const readonly = Boolean(
|
|
80
|
+
const disabled = Boolean(uiOptions.disabled ?? props.disabled);
|
|
81
|
+
const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
|
|
83
82
|
const uiSchemaHideError = uiOptions.hideError;
|
|
84
83
|
// Set hideError to the value provided in the uiSchema, otherwise stick with the prop to propagate to children
|
|
85
84
|
const hideError = uiSchemaHideError === undefined ? props.hideError : Boolean(uiSchemaHideError);
|
|
86
|
-
const autofocus = Boolean(
|
|
85
|
+
const autofocus = Boolean(uiOptions.autofocus ?? props.autofocus);
|
|
87
86
|
if (Object.keys(schema).length === 0) {
|
|
88
87
|
return null;
|
|
89
88
|
}
|
|
@@ -115,7 +114,7 @@ function SchemaFieldRender(props) {
|
|
|
115
114
|
if (!hideError && __errors && __errors.length > 0) {
|
|
116
115
|
classNames.push('field-error has-error has-danger');
|
|
117
116
|
}
|
|
118
|
-
if (uiSchema
|
|
117
|
+
if (uiSchema?.classNames) {
|
|
119
118
|
if (process.env.NODE_ENV !== 'production') {
|
|
120
119
|
console.warn("'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead.");
|
|
121
120
|
}
|
|
@@ -158,7 +157,7 @@ function SchemaFieldRender(props) {
|
|
|
158
157
|
};
|
|
159
158
|
const _AnyOfField = registry.fields.AnyOfField;
|
|
160
159
|
const _OneOfField = registry.fields.OneOfField;
|
|
161
|
-
const isReplacingAnyOrOneOf =
|
|
160
|
+
const isReplacingAnyOrOneOf = uiSchema?.['ui:field'] && uiSchema?.['ui:fieldReplacesAnyOrOneOf'] === true;
|
|
162
161
|
return (_jsx(FieldTemplate, { ...fieldProps, children: _jsxs(_Fragment, { children: [field, schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (_jsx(_AnyOfField, { name: name, disabled: disabled, readonly: readonly, hideError: hideError, errorSchema: errorSchema, formData: formData, formContext: formContext, idPrefix: idPrefix, idSchema: idSchema, idSeparator: idSeparator, onBlur: props.onBlur, onChange: props.onChange, onFocus: props.onFocus, options: schema.anyOf.map((_schema) => schemaUtils.retrieveSchema(isObject(_schema) ? _schema : {}, formData)), registry: registry, required: required, schema: schema, uiSchema: uiSchema })), schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (_jsx(_OneOfField, { name: name, disabled: disabled, readonly: readonly, hideError: hideError, errorSchema: errorSchema, formData: formData, formContext: formContext, idPrefix: idPrefix, idSchema: idSchema, idSeparator: idSeparator, onBlur: props.onBlur, onChange: props.onChange, onFocus: props.onFocus, options: schema.oneOf.map((_schema) => schemaUtils.retrieveSchema(isObject(_schema) ? _schema : {}, formData)), registry: registry, required: required, schema: schema, uiSchema: uiSchema }))] }) }));
|
|
163
162
|
}
|
|
164
163
|
/** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes
|
|
@@ -173,4 +172,3 @@ class SchemaField extends Component {
|
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
export default SchemaField;
|
|
176
|
-
//# sourceMappingURL=SchemaField.js.map
|
|
@@ -5,3 +5,4 @@ import { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf
|
|
|
5
5
|
*/
|
|
6
6
|
declare function StringField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: FieldProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default StringField;
|
|
8
|
+
//# sourceMappingURL=StringField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/StringField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,iBAAS,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACpG,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAsD3B;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -5,7 +5,6 @@ import { getWidget, getUiOptions, optionsList, hasWidget, } from '@rjsf/utils';
|
|
|
5
5
|
* @param props - The `FieldProps` for this template
|
|
6
6
|
*/
|
|
7
7
|
function StringField(props) {
|
|
8
|
-
var _a;
|
|
9
8
|
const { schema, name, uiSchema, idSchema, formData, required, disabled = false, readonly = false, autofocus = false, onChange, onBlur, onFocus, registry, rawErrors, hideError, } = props;
|
|
10
9
|
const { title, format } = schema;
|
|
11
10
|
const { widgets, formContext, schemaUtils, globalUiOptions } = registry;
|
|
@@ -16,9 +15,8 @@ function StringField(props) {
|
|
|
16
15
|
}
|
|
17
16
|
const { widget = defaultWidget, placeholder = '', title: uiTitle, ...options } = getUiOptions(uiSchema);
|
|
18
17
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
19
|
-
const label =
|
|
18
|
+
const label = uiTitle ?? title ?? name;
|
|
20
19
|
const Widget = getWidget(schema, widget, widgets);
|
|
21
20
|
return (_jsx(Widget, { options: { ...options, enumOptions }, schema: schema, uiSchema: uiSchema, id: idSchema.$id, name: name, label: label, hideLabel: !displayLabel, hideError: hideError, value: formData, onChange: onChange, onBlur: onBlur, onFocus: onFocus, required: required, disabled: disabled, readonly: readonly, formContext: formContext, autofocus: autofocus, registry: registry, placeholder: placeholder, rawErrors: rawErrors }));
|
|
22
21
|
}
|
|
23
22
|
export default StringField;
|
|
24
|
-
//# sourceMappingURL=StringField.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { FormContextType, RegistryFieldsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
declare function fields<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): RegistryFieldsType<T, S, F>;
|
|
3
3
|
export default fields;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAWvG,iBAAS,MAAM,CACb,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,KAC5B,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAa/B;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import ArrayField from './ArrayField';
|
|
2
|
-
import BooleanField from './BooleanField';
|
|
3
|
-
import MultiSchemaField from './MultiSchemaField';
|
|
4
|
-
import NumberField from './NumberField';
|
|
5
|
-
import ObjectField from './ObjectField';
|
|
6
|
-
import SchemaField from './SchemaField';
|
|
7
|
-
import StringField from './StringField';
|
|
8
|
-
import NullField from './NullField';
|
|
1
|
+
import ArrayField from './ArrayField.js';
|
|
2
|
+
import BooleanField from './BooleanField.js';
|
|
3
|
+
import MultiSchemaField from './MultiSchemaField.js';
|
|
4
|
+
import NumberField from './NumberField.js';
|
|
5
|
+
import ObjectField from './ObjectField.js';
|
|
6
|
+
import SchemaField from './SchemaField.js';
|
|
7
|
+
import StringField from './StringField.js';
|
|
8
|
+
import NullField from './NullField.js';
|
|
9
9
|
function fields() {
|
|
10
10
|
return {
|
|
11
11
|
AnyOfField: MultiSchemaField,
|
|
@@ -21,4 +21,3 @@ function fields() {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export default fields;
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -5,3 +5,4 @@ import { ArrayFieldDescriptionProps, FormContextType, RJSFSchema, StrictRJSFSche
|
|
|
5
5
|
* @param props - The `ArrayFieldDescriptionProps` for the component
|
|
6
6
|
*/
|
|
7
7
|
export default function ArrayFieldDescriptionTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldDescriptionProps<T, S, F>): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
//# sourceMappingURL=ArrayFieldDescriptionTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayFieldDescriptionTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldDescriptionTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,0BAA0B,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,6BAA6B,CACnD,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,kDAqB3C"}
|
|
@@ -15,4 +15,3 @@ export default function ArrayFieldDescriptionTemplate(props) {
|
|
|
15
15
|
const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
16
16
|
return (_jsx(DescriptionFieldTemplate, { id: descriptionId(idSchema), description: description, schema: schema, uiSchema: uiSchema, registry: registry }));
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=ArrayFieldDescriptionTemplate.js.map
|
|
@@ -4,3 +4,4 @@ import { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSche
|
|
|
4
4
|
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
5
5
|
*/
|
|
6
6
|
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateItemType<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ArrayFieldItemTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayFieldItemTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAExG;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CA8E3C"}
|
|
@@ -17,4 +17,3 @@ export default function ArrayFieldItemTemplate(props) {
|
|
|
17
17
|
justifyContent: 'space-around',
|
|
18
18
|
}, children: [(hasMoveUp || hasMoveDown) && (_jsx(MoveUpButton, { style: btnStyle, disabled: disabled || readonly || !hasMoveUp, onClick: onReorderClick(index, index - 1), uiSchema: uiSchema, registry: registry })), (hasMoveUp || hasMoveDown) && (_jsx(MoveDownButton, { style: btnStyle, disabled: disabled || readonly || !hasMoveDown, onClick: onReorderClick(index, index + 1), uiSchema: uiSchema, registry: registry })), hasCopy && (_jsx(CopyButton, { style: btnStyle, disabled: disabled || readonly, onClick: onCopyIndexClick(index), uiSchema: uiSchema, registry: registry })), hasRemove && (_jsx(RemoveButton, { style: btnStyle, disabled: disabled || readonly, onClick: onDropIndexClick(index), uiSchema: uiSchema, registry: registry }))] }) }))] }));
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=ArrayFieldItemTemplate.js.map
|
|
@@ -4,3 +4,4 @@ import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema
|
|
|
4
4
|
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
5
5
|
*/
|
|
6
6
|
export default function ArrayFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ArrayFieldTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayFieldTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EAEvB,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAqExC"}
|
|
@@ -15,4 +15,3 @@ export default function ArrayFieldTemplate(props) {
|
|
|
15
15
|
return (_jsxs("fieldset", { className: className, id: idSchema.$id, children: [_jsx(ArrayFieldTitleTemplate, { idSchema: idSchema, title: uiOptions.title || title, required: required, schema: schema, uiSchema: uiSchema, registry: registry }), _jsx(ArrayFieldDescriptionTemplate, { idSchema: idSchema, description: uiOptions.description || schema.description, schema: schema, uiSchema: uiSchema, registry: registry }), _jsx("div", { className: 'row array-item-list', children: items &&
|
|
16
16
|
items.map(({ key, ...itemProps }) => (_jsx(ArrayFieldItemTemplate, { ...itemProps }, key))) }), canAdd && (_jsx(AddButton, { className: 'array-item-add', onClick: onAddClick, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }))] }));
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=ArrayFieldTemplate.js.map
|
|
@@ -5,3 +5,4 @@ import { ArrayFieldTitleProps, FormContextType, RJSFSchema, StrictRJSFSchema } f
|
|
|
5
5
|
* @param props - The `ArrayFieldTitleProps` for the component
|
|
6
6
|
*/
|
|
7
7
|
export default function ArrayFieldTitleTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTitleProps<T, S, F>): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
//# sourceMappingURL=ArrayFieldTitleTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayFieldTitleTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldTitleTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,kDAsBrC"}
|
|
@@ -15,4 +15,3 @@ export default function ArrayFieldTitleTemplate(props) {
|
|
|
15
15
|
const TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
|
|
16
16
|
return (_jsx(TitleFieldTemplate, { id: titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry }));
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=ArrayFieldTitleTemplate.js.map
|
|
@@ -6,3 +6,4 @@ import { BaseInputTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema }
|
|
|
6
6
|
* @param props - The `WidgetProps` for this template
|
|
7
7
|
*/
|
|
8
8
|
export default function BaseInputTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: BaseInputTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=BaseInputTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseInputTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/BaseInputTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,sBAAsB,EAGtB,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAmFvC"}
|
|
@@ -2,3 +2,4 @@ import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '
|
|
|
2
2
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
3
3
|
*/
|
|
4
4
|
export default function AddButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ className, onClick, disabled, registry, }: IconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=AddButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddButton.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/ButtonTemplates/AddButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AAIjH;GACG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAAE,EACnH,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAiB1B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { TranslatableString } from '@rjsf/utils';
|
|
3
|
-
import IconButton from './IconButton';
|
|
3
|
+
import IconButton from './IconButton.js';
|
|
4
4
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
5
5
|
*/
|
|
6
6
|
export default function AddButton({ className, onClick, disabled, registry, }) {
|
|
7
7
|
const { translateString } = registry;
|
|
8
8
|
return (_jsx("div", { className: 'row', children: _jsx("p", { className: `col-xs-3 col-xs-offset-9 text-right ${className}`, children: _jsx(IconButton, { iconType: 'info', icon: 'plus', className: 'btn-add col-xs-12', title: translateString(TranslatableString.AddButton), onClick: onClick, disabled: disabled, registry: registry }) }) }));
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=AddButton.js.map
|
|
@@ -4,3 +4,4 @@ export declare function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSch
|
|
|
4
4
|
export declare function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: IconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: IconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: IconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/ButtonTemplates/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AAEjH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAClH,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAQhC;AAED,wBAAgB,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAC1G,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAahC;AAED,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAC9G,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAahC;AAED,wBAAgB,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAC5G,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAahC;AAED,wBAAgB,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAC5G,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAchC"}
|
|
@@ -20,4 +20,3 @@ export function RemoveButton(props) {
|
|
|
20
20
|
const { registry: { translateString }, } = props;
|
|
21
21
|
return (_jsx(IconButton, { title: translateString(TranslatableString.RemoveButton), className: 'array-item-remove', ...props, iconType: 'danger', icon: 'remove' }));
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=IconButton.js.map
|
|
@@ -2,3 +2,4 @@ import { FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from
|
|
|
2
2
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
3
3
|
*/
|
|
4
4
|
export default function SubmitButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ uiSchema }: SubmitButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
//# sourceMappingURL=SubmitButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubmitButton.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/ButtonTemplates/SubmitButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEvH;GACG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,kDAYzC"}
|
|
@@ -9,4 +9,3 @@ export default function SubmitButton({ uiSchema }) {
|
|
|
9
9
|
}
|
|
10
10
|
return (_jsx("div", { children: _jsx("button", { type: 'submit', ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ''}`, children: submitText }) }));
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=SubmitButton.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
|
|
2
2
|
declare function buttonTemplates<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): TemplatesType<T, S, F>['ButtonTemplates'];
|
|
3
3
|
export default buttonTemplates;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/ButtonTemplates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM3F,iBAAS,eAAe,CACtB,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,KAC5B,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAS7C;AAED,eAAe,eAAe,CAAC"}
|