@rjsf/core 6.0.2 → 6.1.1
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 +63 -40
- package/dist/index.cjs +295 -265
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +173 -140
- package/dist/index.esm.js.map +4 -4
- package/lib/components/RichHelp.d.ts +20 -0
- package/lib/components/RichHelp.d.ts.map +1 -0
- package/lib/components/RichHelp.js +17 -0
- package/lib/components/fields/ArrayField.d.ts.map +1 -1
- package/lib/components/fields/ArrayField.js +6 -1
- package/lib/components/fields/ObjectField.js +1 -1
- package/lib/components/fields/StringField.d.ts.map +1 -1
- package/lib/components/fields/StringField.js +3 -3
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldItemTemplate.js +5 -5
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
- package/lib/components/templates/ButtonTemplates/AddButton.js +1 -1
- package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldHelpTemplate.js +3 -6
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.js +4 -2
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/RichHelp.tsx +46 -0
- package/src/components/fields/ArrayField.tsx +7 -0
- package/src/components/fields/ObjectField.tsx +2 -2
- package/src/components/fields/StringField.tsx +3 -2
- package/src/components/templates/ArrayFieldItemTemplate.tsx +8 -11
- package/src/components/templates/ButtonTemplates/AddButton.tsx +3 -1
- package/src/components/templates/FieldHelpTemplate.tsx +5 -11
- package/src/components/templates/WrapIfAdditionalTemplate.tsx +7 -3
- package/src/index.ts +3 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { FormContextType, Registry, RJSFSchema, StrictRJSFSchema, UiSchema } from '@rjsf/utils';
|
|
3
|
+
export interface RichHelpProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
|
|
4
|
+
/** The description text for a field, potentially containing markdown */
|
|
5
|
+
help: string | ReactElement;
|
|
6
|
+
/** The uiSchema object for this base component */
|
|
7
|
+
uiSchema?: UiSchema<T, S, F>;
|
|
8
|
+
/** The `registry` object */
|
|
9
|
+
registry: Registry<T, S, F>;
|
|
10
|
+
}
|
|
11
|
+
/** Renders the given `description` in the props as
|
|
12
|
+
*
|
|
13
|
+
* @param props - The `RichHelpProps` for this component
|
|
14
|
+
*/
|
|
15
|
+
declare function RichHelp<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ help, registry, uiSchema, }: RichHelpProps<T, S, F>): string | import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare namespace RichHelp {
|
|
17
|
+
var TEST_IDS: import("@rjsf/utils").TestIdShape;
|
|
18
|
+
}
|
|
19
|
+
export default RichHelp;
|
|
20
|
+
//# sourceMappingURL=RichHelp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichHelp.d.ts","sourceRoot":"","sources":["../../src/components/RichHelp.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EACL,eAAe,EACf,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,QAAQ,EAGT,MAAM,aAAa,CAAC;AAKrB,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG;IAC9G,wEAAwE;IACxE,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,4BAA4B;IAC5B,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,iBAAwB,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAAE,EAClH,IAAI,EACJ,QAAQ,EACR,QAAa,GACd,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,oDAYxB;kBAhBuB,QAAQ;;;eAAR,QAAQ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getTestIds, getUiOptions, } from '@rjsf/utils';
|
|
3
|
+
import Markdown from 'markdown-to-jsx';
|
|
4
|
+
const TEST_IDS = getTestIds();
|
|
5
|
+
/** Renders the given `description` in the props as
|
|
6
|
+
*
|
|
7
|
+
* @param props - The `RichHelpProps` for this component
|
|
8
|
+
*/
|
|
9
|
+
export default function RichHelp({ help, registry, uiSchema = {}, }) {
|
|
10
|
+
const { globalUiOptions } = registry;
|
|
11
|
+
const uiOptions = getUiOptions(uiSchema, globalUiOptions);
|
|
12
|
+
if (uiOptions.enableMarkdownInHelp && typeof help === 'string') {
|
|
13
|
+
return (_jsx(Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: help }));
|
|
14
|
+
}
|
|
15
|
+
return help;
|
|
16
|
+
}
|
|
17
|
+
RichHelp.TEST_IDS = TEST_IDS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/ArrayField.tsx"],"names":[],"mappings":"AACA,OAAO,EAmBL,UAAU,EACV,eAAe,EAEf,UAAU,EACV,gBAAgB,EAIjB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ArrayField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/ArrayField.tsx"],"names":[],"mappings":"AACA,OAAO,EAmBL,UAAU,EACV,eAAe,EAEf,UAAU,EACV,gBAAgB,EAIjB,MAAM,aAAa,CAAC;AAizBrB;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAClH,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,2CAkP7B"}
|
|
@@ -165,10 +165,13 @@ function ArrayAsFiles(props) {
|
|
|
165
165
|
*/
|
|
166
166
|
function ArrayFieldItem(props) {
|
|
167
167
|
const { itemKey, index, name, disabled, hideError, readonly, registry, uiOptions, parentUiSchema, canAdd, canRemove = true, canMoveUp, canMoveDown, itemSchema, itemData, itemUiSchema, itemFieldPathId, itemErrorSchema, autofocus, onBlur, onFocus, onChange, rawErrors, totalItems, title, handleAddItem, handleCopyItem, handleRemoveItem, handleReorderItems, } = props;
|
|
168
|
-
const { fields: { ArraySchemaField, SchemaField }, } = registry;
|
|
168
|
+
const { schemaUtils, fields: { ArraySchemaField, SchemaField }, globalUiOptions, } = registry;
|
|
169
169
|
const fieldPathId = useDeepCompareMemo(itemFieldPathId);
|
|
170
170
|
const ItemSchemaField = ArraySchemaField || SchemaField;
|
|
171
171
|
const ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
172
|
+
const displayLabel = schemaUtils.getDisplayLabel(itemSchema, itemUiSchema, globalUiOptions);
|
|
173
|
+
const { description } = getUiOptions(itemUiSchema);
|
|
174
|
+
const hasDescription = !!description || !!itemSchema.description;
|
|
172
175
|
const { orderable = true, removable = true, copyable = false } = uiOptions;
|
|
173
176
|
const has = {
|
|
174
177
|
moveUp: orderable && canMoveUp,
|
|
@@ -226,6 +229,8 @@ function ArrayFieldItem(props) {
|
|
|
226
229
|
schema: itemSchema,
|
|
227
230
|
uiSchema: itemUiSchema,
|
|
228
231
|
parentUiSchema,
|
|
232
|
+
displayLabel,
|
|
233
|
+
hasDescription,
|
|
229
234
|
};
|
|
230
235
|
return _jsx(ArrayFieldItemTemplate, { ...templateProps });
|
|
231
236
|
}
|
|
@@ -210,7 +210,7 @@ export default function ObjectField(props) {
|
|
|
210
210
|
const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, name, ADDITIONAL_PROPERTY_FLAG]);
|
|
211
211
|
const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
|
|
212
212
|
const hidden = getUiOptions(fieldUiSchema).widget === 'hidden';
|
|
213
|
-
const content = (_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));
|
|
213
|
+
const content = (_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));
|
|
214
214
|
return {
|
|
215
215
|
content,
|
|
216
216
|
name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/StringField.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,UAAU,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EAEjB,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,
|
|
1
|
+
{"version":3,"file":"StringField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/StringField.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,UAAU,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EAEjB,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,2CA8D3B;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -6,8 +6,8 @@ import { getWidget, getUiOptions, optionsList, hasWidget, } from '@rjsf/utils';
|
|
|
6
6
|
* @param props - The `FieldProps` for this template
|
|
7
7
|
*/
|
|
8
8
|
function StringField(props) {
|
|
9
|
-
const { schema, name, uiSchema, fieldPathId, formData, required, disabled = false, readonly = false, autofocus = false, onChange, onBlur, onFocus, registry, rawErrors, hideError, } = props;
|
|
10
|
-
const { title, format } = schema;
|
|
9
|
+
const { schema, name, uiSchema, fieldPathId, formData, required, disabled = false, readonly = false, autofocus = false, onChange, onBlur, onFocus, registry, rawErrors, hideError, title, } = props;
|
|
10
|
+
const { title: schemaTitle, format } = schema;
|
|
11
11
|
const { widgets, schemaUtils, globalUiOptions } = registry;
|
|
12
12
|
const enumOptions = schemaUtils.isSelect(schema) ? optionsList(schema, uiSchema) : undefined;
|
|
13
13
|
let defaultWidget = enumOptions ? 'select' : 'text';
|
|
@@ -16,7 +16,7 @@ function StringField(props) {
|
|
|
16
16
|
}
|
|
17
17
|
const { widget = defaultWidget, placeholder = '', title: uiTitle, ...options } = getUiOptions(uiSchema);
|
|
18
18
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
19
|
-
const label = uiTitle ?? title ?? name;
|
|
19
|
+
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
20
20
|
const Widget = getWidget(schema, widget, widgets);
|
|
21
21
|
const onWidgetChange = useCallback((value, errorSchema, id) => {
|
|
22
22
|
// String field change passes an empty path array to the parent field which adds the appropriate path
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldItemTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,eAAe,EAGf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;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,2BAA2B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ArrayFieldItemTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,eAAe,EAGf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;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,2BAA2B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CA6B5C"}
|
|
@@ -5,7 +5,7 @@ import { getTemplate, getUiOptions, } from '@rjsf/utils';
|
|
|
5
5
|
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
6
6
|
*/
|
|
7
7
|
export default function ArrayFieldItemTemplate(props) {
|
|
8
|
-
const { children, className, buttonsProps, hasToolbar, registry, uiSchema } = props;
|
|
8
|
+
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
9
9
|
const uiOptions = getUiOptions(uiSchema);
|
|
10
10
|
const ArrayFieldItemButtonsTemplate = getTemplate('ArrayFieldItemButtonsTemplate', registry, uiOptions);
|
|
11
11
|
const btnStyle = {
|
|
@@ -14,8 +14,8 @@ export default function ArrayFieldItemTemplate(props) {
|
|
|
14
14
|
paddingRight: 6,
|
|
15
15
|
fontWeight: 'bold',
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const margin = hasDescription ? 31 : 9;
|
|
18
|
+
const containerStyle = { display: 'flex', alignItems: displayLabel ? 'center' : 'baseline' };
|
|
19
|
+
const toolbarStyle = { display: 'flex', justifyContent: 'flex-end', marginTop: displayLabel ? `${margin}px` : 0 };
|
|
20
|
+
return (_jsxs("div", { className: className, style: containerStyle, children: [_jsx("div", { className: hasToolbar ? 'col-xs-9 col-md-10 col-xl-11' : 'col-xs-12', children: children }), hasToolbar && (_jsx("div", { className: 'col-xs-3 col-md-2 col-xl-1 array-item-toolbox', children: _jsx("div", { className: 'btn-group', style: toolbarStyle, children: _jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) }) }))] }));
|
|
21
21
|
}
|
|
@@ -1 +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,EAAE,EACF,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,
|
|
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,EAAE,EACF,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAoB1B"}
|
|
@@ -5,5 +5,5 @@ import IconButton from './IconButton.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export default function AddButton({ id, className, onClick, disabled, registry, }) {
|
|
7
7
|
const { translateString } = registry;
|
|
8
|
-
return (_jsx("div", { className: 'row', children: _jsx("p", { className: `col-xs-
|
|
8
|
+
return (_jsx("div", { className: 'row', children: _jsx("p", { className: `col-xs-4 col-sm-2 col-lg-1 col-xs-offset-8 col-sm-offset-10 col-lg-offset-11 text-right ${className}`, children: _jsx(IconButton, { id: id, iconType: 'info', icon: 'plus', className: 'btn-add col-xs-12', title: translateString(TranslatableString.AddButton), onClick: onClick, disabled: disabled, registry: registry }) }) }));
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldHelpTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/FieldHelpTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldHelpTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/FieldHelpTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpG;;;GAGG;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,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,kDAW/B"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { helpId } from '@rjsf/utils';
|
|
3
|
+
import RichHelp from '../RichHelp.js';
|
|
3
4
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
4
5
|
*
|
|
5
6
|
* @param props - The `FieldHelpProps` to be rendered
|
|
6
7
|
*/
|
|
7
8
|
export default function FieldHelpTemplate(props) {
|
|
8
|
-
const { fieldPathId, help } = props;
|
|
9
|
+
const { fieldPathId, help, uiSchema, registry } = props;
|
|
9
10
|
if (!help) {
|
|
10
11
|
return null;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
if (typeof help === 'string') {
|
|
14
|
-
return (_jsx("p", { id: id, className: 'help-block', children: help }));
|
|
15
|
-
}
|
|
16
|
-
return (_jsx("div", { id: id, className: 'help-block', children: help }));
|
|
13
|
+
return (_jsx("div", { id: helpId(fieldPathId), className: 'help-block', children: _jsx(RichHelp, { help: help, registry: registry, uiSchema: uiSchema }) }));
|
|
17
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WrapIfAdditionalTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/WrapIfAdditionalTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,UAAU,EACV,gBAAgB,EAEhB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,6BAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"WrapIfAdditionalTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/WrapIfAdditionalTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,UAAU,EACV,gBAAgB,EAEhB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,6BAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAwE9C"}
|
|
@@ -7,12 +7,13 @@ import Label from './FieldTemplate/Label.js';
|
|
|
7
7
|
* @param props - The `WrapIfAdditionalProps` for this component
|
|
8
8
|
*/
|
|
9
9
|
export default function WrapIfAdditionalTemplate(props) {
|
|
10
|
-
const { id, classNames, style, disabled, label, onKeyRenameBlur, onRemoveProperty, readonly, required, schema, hideError, rawErrors, children, uiSchema, registry, } = props;
|
|
10
|
+
const { id, classNames, style, disabled, displayLabel, label, onKeyRenameBlur, onRemoveProperty, rawDescription, readonly, required, schema, hideError, rawErrors, children, uiSchema, registry, } = props;
|
|
11
11
|
const { templates, translateString } = registry;
|
|
12
12
|
// Button templates are not overridden in the uiSchema
|
|
13
13
|
const { RemoveButton } = templates.ButtonTemplates;
|
|
14
14
|
const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
15
15
|
const additional = ADDITIONAL_PROPERTY_FLAG in schema;
|
|
16
|
+
const hasDescription = !!rawDescription;
|
|
16
17
|
const classNamesList = ['form-group', classNames];
|
|
17
18
|
if (!hideError && rawErrors && rawErrors.length > 0) {
|
|
18
19
|
classNamesList.push('has-error has-danger');
|
|
@@ -21,5 +22,6 @@ export default function WrapIfAdditionalTemplate(props) {
|
|
|
21
22
|
if (!additional) {
|
|
22
23
|
return (_jsx("div", { className: uiClassNames, style: style, children: children }));
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
const margin = hasDescription ? 46 : 26;
|
|
26
|
+
return (_jsx("div", { className: uiClassNames, style: style, children: _jsxs("div", { className: 'row', children: [_jsx("div", { className: 'col-xs-5 form-additional', children: _jsxs("div", { className: 'form-group', children: [displayLabel && _jsx(Label, { label: keyLabel, required: required, id: `${id}-key` }), displayLabel && rawDescription && _jsx("div", { children: "\u00A0" }), _jsx("input", { className: 'form-control', type: 'text', id: `${id}-key`, onBlur: onKeyRenameBlur, defaultValue: label })] }) }), _jsx("div", { className: 'form-additional form-group col-xs-5', children: children }), _jsx("div", { className: 'col-xs-2', style: { marginTop: displayLabel ? `${margin}px` : undefined }, children: _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 }) })] }) }));
|
|
25
27
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import Form, { FormProps, FormState, IChangeEvent } from './components/Form.js';
|
|
2
2
|
import RichDescription, { RichDescriptionProps } from './components/RichDescription.js';
|
|
3
|
+
import RichHelp, { RichHelpProps } from './components/RichHelp.js';
|
|
3
4
|
import withTheme, { ThemeProps } from './withTheme.js';
|
|
4
5
|
import getDefaultRegistry from './getDefaultRegistry.js';
|
|
5
6
|
import getTestRegistry from './getTestRegistry.js';
|
|
6
|
-
export type { FormProps, FormState, IChangeEvent, ThemeProps, RichDescriptionProps };
|
|
7
|
-
export { withTheme, getDefaultRegistry, getTestRegistry, RichDescription };
|
|
7
|
+
export type { FormProps, FormState, IChangeEvent, ThemeProps, RichDescriptionProps, RichHelpProps };
|
|
8
|
+
export { withTheme, getDefaultRegistry, getTestRegistry, RichDescription, RichHelp };
|
|
8
9
|
export default Form;
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,eAAe,EAAE,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,eAAe,EAAE,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,QAAQ,EAAE,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAC;AAEpG,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;AACrF,eAAe,IAAI,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Form from './components/Form.js';
|
|
2
2
|
import RichDescription from './components/RichDescription.js';
|
|
3
|
+
import RichHelp from './components/RichHelp.js';
|
|
3
4
|
import withTheme from './withTheme.js';
|
|
4
5
|
import getDefaultRegistry from './getDefaultRegistry.js';
|
|
5
6
|
import getTestRegistry from './getTestRegistry.js';
|
|
6
|
-
export { withTheme, getDefaultRegistry, getTestRegistry, RichDescription };
|
|
7
|
+
export { withTheme, getDefaultRegistry, getTestRegistry, RichDescription, RichHelp };
|
|
7
8
|
export default Form;
|