@rjsf/primereact 6.0.0-beta.21 → 6.0.0-beta.23
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.cjs +21 -30
- package/dist/index.cjs.map +3 -3
- package/dist/primereact.esm.js +21 -31
- package/dist/primereact.esm.js.map +3 -3
- package/dist/primereact.umd.js +21 -30
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +3 -12
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +2 -2
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +2 -2
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +2 -2
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.js +2 -2
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.js +5 -5
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +2 -2
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -3
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -3
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -17
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +2 -1
- package/src/CheckboxWidget/CheckboxWidget.tsx +2 -1
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +2 -1
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +2 -2
- package/src/RadioWidget/RadioWidget.tsx +2 -2
- package/src/SelectWidget/SelectWidget.tsx +4 -3
- package/src/TextareaWidget/TextareaWidget.tsx +2 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +4 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rjsf/primereact",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.23",
|
|
4
4
|
"description": "PrimeReact theme, fields and widgets for react-jsonschema-form",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -61,17 +61,17 @@
|
|
|
61
61
|
"node": ">=20"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@rjsf/core": "^6.0.0-beta.
|
|
65
|
-
"@rjsf/utils": "^6.0.0-beta.
|
|
64
|
+
"@rjsf/core": "^6.0.0-beta.23",
|
|
65
|
+
"@rjsf/utils": "^6.0.0-beta.23",
|
|
66
66
|
"primeicons": ">=6.0.0",
|
|
67
67
|
"primereact": ">=8.0.0",
|
|
68
68
|
"react": ">=18"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@rjsf/core": "^6.0.0-beta.
|
|
72
|
-
"@rjsf/snapshot-tests": "^6.0.0-beta.
|
|
73
|
-
"@rjsf/utils": "^6.0.0-beta.
|
|
74
|
-
"@rjsf/validator-ajv8": "^6.0.0-beta.
|
|
71
|
+
"@rjsf/core": "^6.0.0-beta.23",
|
|
72
|
+
"@rjsf/snapshot-tests": "^6.0.0-beta.23",
|
|
73
|
+
"@rjsf/utils": "^6.0.0-beta.23",
|
|
74
|
+
"@rjsf/validator-ajv8": "^6.0.0-beta.23",
|
|
75
75
|
"@rollup/plugin-replace": "^6.0.2",
|
|
76
76
|
"eslint": "^8.57.1",
|
|
77
77
|
"primeflex": "^4.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ArrayFieldItemTemplateProps,
|
|
3
3
|
FormContextType,
|
|
4
4
|
getTemplate,
|
|
5
5
|
getUiOptions,
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
|
|
10
10
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
11
11
|
*
|
|
12
|
-
* @param props - The `
|
|
12
|
+
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
13
13
|
*/
|
|
14
14
|
export default function ArrayFieldItemTemplate<
|
|
15
15
|
T = any,
|
|
16
16
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
17
17
|
F extends FormContextType = any,
|
|
18
|
-
>(props:
|
|
18
|
+
>(props: ArrayFieldItemTemplateProps<T, S, F>) {
|
|
19
19
|
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
20
20
|
const uiOptions = getUiOptions<T, S, F>(uiSchema);
|
|
21
21
|
const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(
|
|
@@ -3,11 +3,9 @@ import {
|
|
|
3
3
|
getUiOptions,
|
|
4
4
|
isFixedItems,
|
|
5
5
|
ArrayFieldTemplateProps,
|
|
6
|
-
ArrayFieldItemTemplateType,
|
|
7
6
|
FormContextType,
|
|
8
7
|
RJSFSchema,
|
|
9
8
|
StrictRJSFSchema,
|
|
10
|
-
UI_OPTIONS_KEY,
|
|
11
9
|
buttonId,
|
|
12
10
|
} from '@rjsf/utils';
|
|
13
11
|
import { Fieldset } from 'primereact/fieldset';
|
|
@@ -15,7 +13,7 @@ import AddButton from '../AddButton';
|
|
|
15
13
|
|
|
16
14
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
17
15
|
*
|
|
18
|
-
* @param props - The `
|
|
16
|
+
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
19
17
|
*/
|
|
20
18
|
export default function ArrayFieldTemplate<
|
|
21
19
|
T = any,
|
|
@@ -45,11 +43,6 @@ export default function ArrayFieldTemplate<
|
|
|
45
43
|
registry,
|
|
46
44
|
uiOptions,
|
|
47
45
|
);
|
|
48
|
-
const ArrayFieldItemTemplate = getTemplate<'ArrayFieldItemTemplate', T, S, F>(
|
|
49
|
-
'ArrayFieldItemTemplate',
|
|
50
|
-
registry,
|
|
51
|
-
uiOptions,
|
|
52
|
-
);
|
|
53
46
|
const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>(
|
|
54
47
|
'ArrayFieldTitleTemplate',
|
|
55
48
|
registry,
|
|
@@ -83,15 +76,7 @@ export default function ArrayFieldTemplate<
|
|
|
83
76
|
<div key={`array-item-list-${fieldPathId.$id}`}>
|
|
84
77
|
<div>
|
|
85
78
|
{!showOptionalDataControlInTitle ? optionalDataControl : undefined}
|
|
86
|
-
{items
|
|
87
|
-
const mergedUiSchema = {
|
|
88
|
-
...itemUiSchema,
|
|
89
|
-
[UI_OPTIONS_KEY]: {
|
|
90
|
-
...itemUiSchema[UI_OPTIONS_KEY],
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
return <ArrayFieldItemTemplate key={key} {...props} uiSchema={mergedUiSchema} />;
|
|
94
|
-
})}
|
|
79
|
+
{items}
|
|
95
80
|
</div>
|
|
96
81
|
{canAdd && (
|
|
97
82
|
<div
|
|
@@ -19,6 +19,7 @@ export default function BaseInputTemplate<
|
|
|
19
19
|
>(props: BaseInputTemplateProps<T, S, F>) {
|
|
20
20
|
const {
|
|
21
21
|
id,
|
|
22
|
+
htmlName,
|
|
22
23
|
placeholder,
|
|
23
24
|
value,
|
|
24
25
|
required,
|
|
@@ -52,7 +53,7 @@ export default function BaseInputTemplate<
|
|
|
52
53
|
return (
|
|
53
54
|
<InputText
|
|
54
55
|
id={id}
|
|
55
|
-
name={id}
|
|
56
|
+
name={htmlName || id}
|
|
56
57
|
placeholder={placeholder}
|
|
57
58
|
{...primeProps}
|
|
58
59
|
{...inputProps}
|
|
@@ -25,6 +25,7 @@ export default function CheckboxWidget<
|
|
|
25
25
|
>(props: WidgetProps<T, S, F>) {
|
|
26
26
|
const {
|
|
27
27
|
id,
|
|
28
|
+
htmlName,
|
|
28
29
|
value,
|
|
29
30
|
disabled,
|
|
30
31
|
readonly,
|
|
@@ -68,7 +69,7 @@ export default function CheckboxWidget<
|
|
|
68
69
|
<div style={{ display: 'flex', flexDirection: 'row', gap: '0.5rem', alignItems: 'center' }}>
|
|
69
70
|
<Checkbox
|
|
70
71
|
inputId={id}
|
|
71
|
-
name={id}
|
|
72
|
+
name={htmlName || id}
|
|
72
73
|
{...primeProps}
|
|
73
74
|
disabled={disabled || readonly}
|
|
74
75
|
autoFocus={autofocus}
|
|
@@ -27,6 +27,7 @@ export default function CheckboxesWidget<
|
|
|
27
27
|
>(props: WidgetProps<T, S, F>) {
|
|
28
28
|
const {
|
|
29
29
|
id,
|
|
30
|
+
htmlName,
|
|
30
31
|
disabled,
|
|
31
32
|
options,
|
|
32
33
|
value,
|
|
@@ -85,7 +86,7 @@ export default function CheckboxesWidget<
|
|
|
85
86
|
<div key={index} style={{ display: 'flex', flexDirection: 'row', gap: '0.5rem', alignItems: 'center' }}>
|
|
86
87
|
<Checkbox
|
|
87
88
|
inputId={optionId(id, index)}
|
|
88
|
-
name={id}
|
|
89
|
+
name={htmlName || id}
|
|
89
90
|
{...primeProps}
|
|
90
91
|
value={option.value}
|
|
91
92
|
checked={checked}
|
|
@@ -25,7 +25,7 @@ export default function ObjectFieldTemplate<
|
|
|
25
25
|
const {
|
|
26
26
|
description,
|
|
27
27
|
optionalDataControl,
|
|
28
|
-
|
|
28
|
+
onAddProperty,
|
|
29
29
|
title,
|
|
30
30
|
properties,
|
|
31
31
|
disabled,
|
|
@@ -81,7 +81,7 @@ export default function ObjectFieldTemplate<
|
|
|
81
81
|
id={buttonId(fieldPathId, 'add')}
|
|
82
82
|
className='rjsf-object-property-expand'
|
|
83
83
|
icon='pi pi-plus'
|
|
84
|
-
onClick={
|
|
84
|
+
onClick={onAddProperty}
|
|
85
85
|
disabled={disabled || readonly}
|
|
86
86
|
registry={registry}
|
|
87
87
|
/>
|
|
@@ -18,7 +18,7 @@ import { RadioButton, RadioButtonChangeEvent } from 'primereact/radiobutton';
|
|
|
18
18
|
export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
19
19
|
props: WidgetProps<T, S, F>,
|
|
20
20
|
) {
|
|
21
|
-
const { id, value, disabled, readonly, onChange, onBlur, onFocus, options } = props;
|
|
21
|
+
const { id, htmlName, value, disabled, readonly, onChange, onBlur, onFocus, options } = props;
|
|
22
22
|
const primeProps = (options.prime || {}) as object;
|
|
23
23
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
24
24
|
|
|
@@ -39,7 +39,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
39
39
|
<div key={index} style={{ display: 'flex', alignItems: 'center' }}>
|
|
40
40
|
<RadioButton
|
|
41
41
|
inputId={optionId(id, index)}
|
|
42
|
-
name={id}
|
|
42
|
+
name={htmlName || id}
|
|
43
43
|
{...primeProps}
|
|
44
44
|
onFocus={_onFocus}
|
|
45
45
|
onBlur={_onBlur}
|
|
@@ -27,6 +27,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
27
27
|
function SingleSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({
|
|
28
28
|
schema,
|
|
29
29
|
id,
|
|
30
|
+
htmlName,
|
|
30
31
|
name, // remove this from dropdownProps
|
|
31
32
|
options,
|
|
32
33
|
label,
|
|
@@ -46,7 +47,6 @@ function SingleSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F
|
|
|
46
47
|
registry,
|
|
47
48
|
uiSchema,
|
|
48
49
|
hideError,
|
|
49
|
-
formContext,
|
|
50
50
|
...dropdownProps
|
|
51
51
|
}: WidgetProps<T, S, F>) {
|
|
52
52
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
@@ -68,7 +68,7 @@ function SingleSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F
|
|
|
68
68
|
return (
|
|
69
69
|
<Dropdown
|
|
70
70
|
id={id}
|
|
71
|
-
name={id}
|
|
71
|
+
name={htmlName || id}
|
|
72
72
|
{...primeProps}
|
|
73
73
|
value={!isEmpty && typeof selectedIndexes !== 'undefined' ? selectedIndexes : emptyValue}
|
|
74
74
|
options={(enumOptions ?? []).map(({ value, label }, i: number) => ({
|
|
@@ -90,6 +90,7 @@ function SingleSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F
|
|
|
90
90
|
|
|
91
91
|
function MultiSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({
|
|
92
92
|
id,
|
|
93
|
+
htmlName,
|
|
93
94
|
options,
|
|
94
95
|
disabled,
|
|
95
96
|
placeholder,
|
|
@@ -117,7 +118,7 @@ function MultiSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
|
|
|
117
118
|
return (
|
|
118
119
|
<MultiSelect
|
|
119
120
|
id={id}
|
|
120
|
-
name={id}
|
|
121
|
+
name={htmlName || id}
|
|
121
122
|
{...primeProps}
|
|
122
123
|
value={!isEmpty && typeof selectedIndexes !== 'undefined' ? selectedIndexes : emptyValue}
|
|
123
124
|
options={(enumOptions ?? []).map(({ value, label }, i: number) => ({
|
|
@@ -11,7 +11,7 @@ export default function TextareaWidget<
|
|
|
11
11
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
12
12
|
F extends FormContextType = any,
|
|
13
13
|
>(props: WidgetProps<T, S, F>) {
|
|
14
|
-
const { id, value, required, disabled, readonly, autofocus, onChange, onBlur, onFocus, options } = props;
|
|
14
|
+
const { id, htmlName, value, required, disabled, readonly, autofocus, onChange, onBlur, onFocus, options } = props;
|
|
15
15
|
const primeProps = (options.prime || {}) as object;
|
|
16
16
|
|
|
17
17
|
let rows = 5;
|
|
@@ -27,6 +27,7 @@ export default function TextareaWidget<
|
|
|
27
27
|
return (
|
|
28
28
|
<InputTextarea
|
|
29
29
|
id={id}
|
|
30
|
+
name={htmlName || id}
|
|
30
31
|
{...primeProps}
|
|
31
32
|
value={value || ''}
|
|
32
33
|
required={required}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FocusEvent } from 'react';
|
|
2
1
|
import {
|
|
3
2
|
ADDITIONAL_PROPERTY_FLAG,
|
|
4
3
|
buttonId,
|
|
@@ -26,8 +25,8 @@ export default function WrapIfAdditionalTemplate<
|
|
|
26
25
|
disabled,
|
|
27
26
|
id,
|
|
28
27
|
label,
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
onRemoveProperty,
|
|
29
|
+
onKeyRenameBlur,
|
|
31
30
|
readonly,
|
|
32
31
|
required,
|
|
33
32
|
schema,
|
|
@@ -46,8 +45,6 @@ export default function WrapIfAdditionalTemplate<
|
|
|
46
45
|
);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) => onKeyChange(target.value);
|
|
50
|
-
|
|
51
48
|
return (
|
|
52
49
|
<div
|
|
53
50
|
className={classNames}
|
|
@@ -63,7 +60,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
63
60
|
name={`${id}-key`}
|
|
64
61
|
defaultValue={label}
|
|
65
62
|
disabled={disabled || readonly}
|
|
66
|
-
onBlur={!readonly ?
|
|
63
|
+
onBlur={!readonly ? onKeyRenameBlur : undefined}
|
|
67
64
|
required={required}
|
|
68
65
|
style={{ width: '100%' }}
|
|
69
66
|
/>
|
|
@@ -74,7 +71,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
74
71
|
id={buttonId(id, 'remove')}
|
|
75
72
|
className='rjsf-object-property-remove'
|
|
76
73
|
disabled={disabled || readonly}
|
|
77
|
-
onClick={
|
|
74
|
+
onClick={onRemoveProperty}
|
|
78
75
|
registry={registry}
|
|
79
76
|
/>
|
|
80
77
|
</div>
|