@rjsf/chakra-ui 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/chakra-ui.esm.js +58 -117
- package/dist/chakra-ui.esm.js.map +3 -3
- package/dist/chakra-ui.umd.js +38 -93
- package/dist/index.cjs +128 -184
- package/dist/index.cjs.map +3 -3
- package/lib/AltDateTimeWidget/AltDateTimeWidget.d.ts +1 -1
- package/lib/AltDateTimeWidget/AltDateTimeWidget.js +2 -2
- package/lib/AltDateTimeWidget/AltDateTimeWidget.js.map +1 -1
- package/lib/AltDateWidget/AltDateWidget.d.ts +1 -1
- package/lib/AltDateWidget/AltDateWidget.js +8 -49
- package/lib/AltDateWidget/AltDateWidget.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +2 -2
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -2
- 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/FieldTemplate/FieldTemplate.js +2 -2
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +2 -2
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.js +2 -2
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +2 -2
- package/lib/TextareaWidget/TextareaWidget.js.map +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/AltDateTimeWidget/AltDateTimeWidget.tsx +2 -2
- package/src/AltDateWidget/AltDateWidget.tsx +13 -88
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -2
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +1 -9
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +2 -1
- package/src/CheckboxWidget/CheckboxWidget.tsx +2 -1
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +2 -1
- package/src/FieldTemplate/FieldTemplate.tsx +6 -4
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +2 -2
- package/src/RadioWidget/RadioWidget.tsx +2 -1
- package/src/SelectWidget/SelectWidget.tsx +2 -1
- 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/chakra-ui",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.23",
|
|
4
4
|
"description": "Chakra UI theme, fields, and widgets for react-jsonschema-form",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@chakra-ui/react": ">=3.16.1",
|
|
67
|
-
"@rjsf/core": "^6.0.0-beta.
|
|
68
|
-
"@rjsf/utils": "^6.0.0-beta.
|
|
67
|
+
"@rjsf/core": "^6.0.0-beta.23",
|
|
68
|
+
"@rjsf/utils": "^6.0.0-beta.23",
|
|
69
69
|
"chakra-react-select": ">=6",
|
|
70
70
|
"react": ">=18"
|
|
71
71
|
},
|
|
@@ -86,10 +86,10 @@
|
|
|
86
86
|
"@emotion/eslint-plugin": "^11.12.0",
|
|
87
87
|
"@emotion/jest": "^11.13.0",
|
|
88
88
|
"@emotion/react": "^11.14.0",
|
|
89
|
-
"@rjsf/core": "^6.0.0-beta.
|
|
90
|
-
"@rjsf/snapshot-tests": "^6.0.0-beta.
|
|
91
|
-
"@rjsf/utils": "^6.0.0-beta.
|
|
92
|
-
"@rjsf/validator-ajv8": "^6.0.0-beta.
|
|
89
|
+
"@rjsf/core": "^6.0.0-beta.23",
|
|
90
|
+
"@rjsf/snapshot-tests": "^6.0.0-beta.23",
|
|
91
|
+
"@rjsf/utils": "^6.0.0-beta.23",
|
|
92
|
+
"@rjsf/validator-ajv8": "^6.0.0-beta.23",
|
|
93
93
|
"chakra-react-select": "^6.1.0",
|
|
94
94
|
"eslint": "^8.57.1"
|
|
95
95
|
},
|
|
@@ -5,12 +5,12 @@ function AltDateTimeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
|
|
|
5
5
|
props: WidgetProps<T, S, F>,
|
|
6
6
|
) {
|
|
7
7
|
const { AltDateWidget } = props.registry.widgets;
|
|
8
|
-
return <AltDateWidget {...props}
|
|
8
|
+
return <AltDateWidget {...props} time />;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
AltDateTimeWidget.defaultProps = {
|
|
12
12
|
..._AltDateWidget.defaultProps,
|
|
13
|
-
|
|
13
|
+
time: true,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export default AltDateTimeWidget;
|
|
@@ -1,118 +1,45 @@
|
|
|
1
1
|
import { Box, Button, FieldsetRoot } from '@chakra-ui/react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
DateObject,
|
|
6
|
-
dateRangeOptions,
|
|
3
|
+
DateElement,
|
|
4
|
+
DateElementProp,
|
|
7
5
|
FormContextType,
|
|
8
|
-
getDateElementProps,
|
|
9
|
-
parseDateString,
|
|
10
6
|
RJSFSchema,
|
|
11
7
|
StrictRJSFSchema,
|
|
12
|
-
toDateString,
|
|
13
8
|
TranslatableString,
|
|
9
|
+
useAltDateWidgetProps,
|
|
14
10
|
WidgetProps,
|
|
15
11
|
} from '@rjsf/utils';
|
|
16
|
-
import { MouseEvent, useEffect, useState } from 'react';
|
|
17
12
|
import { getChakra } from '../utils';
|
|
18
13
|
|
|
19
|
-
function DateElement<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
20
|
-
props: WidgetProps<T, S, F>,
|
|
21
|
-
) {
|
|
22
|
-
const { SelectWidget } = props.registry.widgets;
|
|
23
|
-
const value = props.value ? props.value : undefined;
|
|
24
|
-
return (
|
|
25
|
-
<SelectWidget
|
|
26
|
-
{...props}
|
|
27
|
-
label={''}
|
|
28
|
-
className='form-control'
|
|
29
|
-
onChange={(elemValue: WidgetProps<T, S, F>) => props.select(props.type, elemValue)}
|
|
30
|
-
options={{
|
|
31
|
-
enumOptions: dateRangeOptions<S>(props.range[0], props.range[1]),
|
|
32
|
-
}}
|
|
33
|
-
placeholder={props.type}
|
|
34
|
-
schema={{ type: 'integer' } as S}
|
|
35
|
-
value={value}
|
|
36
|
-
aria-describedby={ariaDescribedByIds(props.name)}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface AltDateStateType extends DateObject {
|
|
42
|
-
[x: string]: number | undefined;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const readyForChange = (state: AltDateStateType) => {
|
|
46
|
-
return Object.keys(state).every((key) => typeof state[key] !== 'undefined' && state[key] !== -1);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
14
|
function AltDateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
50
15
|
props: WidgetProps<T, S, F>,
|
|
51
16
|
) {
|
|
52
|
-
const { autofocus, disabled, id, onBlur,
|
|
17
|
+
const { autofocus, disabled, id, onBlur, onFocus, options, readonly, registry } = props;
|
|
53
18
|
const { translateString } = registry;
|
|
54
|
-
const
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
setState(parseDateString(value, showTime));
|
|
57
|
-
}, [showTime, value]);
|
|
58
|
-
|
|
59
|
-
const handleChange = (property: string, nextValue: string) => {
|
|
60
|
-
const nextState = {
|
|
61
|
-
...state,
|
|
62
|
-
[property]: typeof nextValue === 'undefined' ? -1 : nextValue,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
if (readyForChange(nextState)) {
|
|
66
|
-
onChange(toDateString(nextState, showTime));
|
|
67
|
-
} else {
|
|
68
|
-
setState(nextState);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const handleNow = (event: MouseEvent<HTMLButtonElement>) => {
|
|
73
|
-
event.preventDefault();
|
|
74
|
-
if (disabled || readonly) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const nextState = parseDateString(new Date().toJSON(), showTime);
|
|
78
|
-
onChange(toDateString(nextState, showTime));
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const handleClear = (event: MouseEvent<HTMLButtonElement>) => {
|
|
82
|
-
event.preventDefault();
|
|
83
|
-
if (disabled || readonly) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
onChange(undefined);
|
|
87
|
-
};
|
|
19
|
+
const { elements, handleChange, handleClear, handleSetNow } = useAltDateWidgetProps(props);
|
|
88
20
|
|
|
89
21
|
const chakraProps = getChakra({ uiSchema: props.uiSchema });
|
|
90
22
|
|
|
91
23
|
return (
|
|
92
24
|
<FieldsetRoot {...(chakraProps as any)}>
|
|
93
25
|
<Box display='flex' flexWrap='wrap' alignItems='center'>
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
showTime,
|
|
97
|
-
options.yearsRange as [number, number] | undefined,
|
|
98
|
-
options.format as DateElementFormat | undefined,
|
|
99
|
-
).map((elemProps: any, i) => {
|
|
100
|
-
const elemId = id + '_' + elemProps.type;
|
|
26
|
+
{elements.map((elemProps: DateElementProp, i) => {
|
|
27
|
+
const elemId = `${id}_${elemProps.type}`;
|
|
101
28
|
return (
|
|
102
|
-
<Box key={elemId} mr='2' mb='2'>
|
|
29
|
+
<Box key={elemId} mr='2' mb='2' width='20'>
|
|
103
30
|
<DateElement<T, S, F>
|
|
104
31
|
{...props}
|
|
105
32
|
{...elemProps}
|
|
106
33
|
autofocus={autofocus && i === 0}
|
|
107
34
|
disabled={disabled}
|
|
108
|
-
|
|
35
|
+
rootId={id}
|
|
109
36
|
name={id}
|
|
110
37
|
onBlur={onBlur}
|
|
111
38
|
onFocus={onFocus}
|
|
112
39
|
readonly={readonly}
|
|
113
40
|
registry={registry}
|
|
114
41
|
select={handleChange}
|
|
115
|
-
value={elemProps.value < 0 ? '' : elemProps.value}
|
|
42
|
+
value={elemProps.value && elemProps.value < 0 ? '' : elemProps.value}
|
|
116
43
|
/>
|
|
117
44
|
</Box>
|
|
118
45
|
);
|
|
@@ -120,14 +47,12 @@ function AltDateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
|
|
|
120
47
|
</Box>
|
|
121
48
|
<Box display='flex'>
|
|
122
49
|
{!options.hideNowButton && (
|
|
123
|
-
<Button onClick={
|
|
50
|
+
<Button onClick={handleSetNow} mr='2'>
|
|
124
51
|
{translateString(TranslatableString.NowLabel)}
|
|
125
52
|
</Button>
|
|
126
53
|
)}
|
|
127
54
|
{!options.hideClearButton && (
|
|
128
|
-
<Button onClick={
|
|
129
|
-
{translateString(TranslatableString.ClearLabel)}
|
|
130
|
-
</Button>
|
|
55
|
+
<Button onClick={handleClear}>{translateString(TranslatableString.ClearLabel)}</Button>
|
|
131
56
|
)}
|
|
132
57
|
</Box>
|
|
133
58
|
</FieldsetRoot>
|
|
@@ -138,7 +63,7 @@ AltDateWidget.defaultProps = {
|
|
|
138
63
|
autofocus: false,
|
|
139
64
|
disabled: false,
|
|
140
65
|
readonly: false,
|
|
141
|
-
|
|
66
|
+
time: false,
|
|
142
67
|
options: {
|
|
143
68
|
yearsRange: [1900, new Date().getFullYear() + 2],
|
|
144
69
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, ButtonGroup, HStack } from '@chakra-ui/react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
ArrayFieldItemTemplateProps,
|
|
4
4
|
FormContextType,
|
|
5
5
|
getTemplate,
|
|
6
6
|
getUiOptions,
|
|
@@ -12,7 +12,7 @@ export default function ArrayFieldItemTemplate<
|
|
|
12
12
|
T = any,
|
|
13
13
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
14
14
|
F extends FormContextType = any,
|
|
15
|
-
>(props:
|
|
15
|
+
>(props: ArrayFieldItemTemplateProps<T, S, F>) {
|
|
16
16
|
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
17
17
|
const uiOptions = getUiOptions<T, S, F>(uiSchema);
|
|
18
18
|
const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(
|
|
@@ -2,7 +2,6 @@ import { Box, Grid, GridItem } from '@chakra-ui/react';
|
|
|
2
2
|
import {
|
|
3
3
|
getTemplate,
|
|
4
4
|
getUiOptions,
|
|
5
|
-
ArrayFieldItemTemplateType,
|
|
6
5
|
ArrayFieldTemplateProps,
|
|
7
6
|
StrictRJSFSchema,
|
|
8
7
|
RJSFSchema,
|
|
@@ -35,11 +34,6 @@ export default function ArrayFieldTemplate<
|
|
|
35
34
|
registry,
|
|
36
35
|
uiOptions,
|
|
37
36
|
);
|
|
38
|
-
const ArrayFieldItemTemplate = getTemplate<'ArrayFieldItemTemplate', T, S, F>(
|
|
39
|
-
'ArrayFieldItemTemplate',
|
|
40
|
-
registry,
|
|
41
|
-
uiOptions,
|
|
42
|
-
);
|
|
43
37
|
const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>(
|
|
44
38
|
'ArrayFieldTitleTemplate',
|
|
45
39
|
registry,
|
|
@@ -71,9 +65,7 @@ export default function ArrayFieldTemplate<
|
|
|
71
65
|
<Grid key={`array-item-list-${fieldPathId.$id}`}>
|
|
72
66
|
<GridItem>
|
|
73
67
|
{!showOptionalDataControlInTitle ? optionalDataControl : undefined}
|
|
74
|
-
{items
|
|
75
|
-
<ArrayFieldItemTemplate key={key} {...itemProps} />
|
|
76
|
-
))}
|
|
68
|
+
{items}
|
|
77
69
|
</GridItem>
|
|
78
70
|
{canAdd && (
|
|
79
71
|
<GridItem justifySelf='flex-end'>
|
|
@@ -21,6 +21,7 @@ export default function BaseInputTemplate<
|
|
|
21
21
|
>(props: BaseInputTemplateProps<T, S, F>) {
|
|
22
22
|
const {
|
|
23
23
|
id,
|
|
24
|
+
htmlName,
|
|
24
25
|
type,
|
|
25
26
|
value,
|
|
26
27
|
label,
|
|
@@ -60,7 +61,7 @@ export default function BaseInputTemplate<
|
|
|
60
61
|
>
|
|
61
62
|
<Input
|
|
62
63
|
id={id}
|
|
63
|
-
name={id}
|
|
64
|
+
name={htmlName || id}
|
|
64
65
|
value={value || value === 0 ? value : ''}
|
|
65
66
|
onChange={onChangeOverride || _onChange}
|
|
66
67
|
onBlur={_onBlur}
|
|
@@ -23,6 +23,7 @@ export default function CheckboxWidget<
|
|
|
23
23
|
>(props: WidgetProps<T, S, F>) {
|
|
24
24
|
const {
|
|
25
25
|
id,
|
|
26
|
+
htmlName,
|
|
26
27
|
value,
|
|
27
28
|
disabled,
|
|
28
29
|
readonly,
|
|
@@ -66,7 +67,7 @@ export default function CheckboxWidget<
|
|
|
66
67
|
)}
|
|
67
68
|
<Checkbox
|
|
68
69
|
id={id}
|
|
69
|
-
name={id}
|
|
70
|
+
name={htmlName || id}
|
|
70
71
|
checked={typeof value === 'undefined' ? false : value}
|
|
71
72
|
disabled={disabled || readonly}
|
|
72
73
|
onCheckedChange={_onChange}
|
|
@@ -22,6 +22,7 @@ export default function CheckboxesWidget<
|
|
|
22
22
|
>(props: WidgetProps<T, S, F>) {
|
|
23
23
|
const {
|
|
24
24
|
id,
|
|
25
|
+
htmlName,
|
|
25
26
|
disabled,
|
|
26
27
|
options,
|
|
27
28
|
value,
|
|
@@ -70,7 +71,7 @@ export default function CheckboxesWidget<
|
|
|
70
71
|
<Checkbox
|
|
71
72
|
key={index}
|
|
72
73
|
id={optionId(id, index)}
|
|
73
|
-
name={id}
|
|
74
|
+
name={htmlName || id}
|
|
74
75
|
value={String(index)}
|
|
75
76
|
disabled={disabled || itemDisabled || readonly}
|
|
76
77
|
onBlur={_onBlur}
|
|
@@ -22,8 +22,9 @@ export default function FieldTemplate<
|
|
|
22
22
|
displayLabel,
|
|
23
23
|
hidden,
|
|
24
24
|
label,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
onKeyRename,
|
|
26
|
+
onKeyRenameBlur,
|
|
27
|
+
onRemoveProperty,
|
|
27
28
|
readonly,
|
|
28
29
|
registry,
|
|
29
30
|
required,
|
|
@@ -53,8 +54,9 @@ export default function FieldTemplate<
|
|
|
53
54
|
disabled={disabled}
|
|
54
55
|
id={id}
|
|
55
56
|
label={label}
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
onKeyRename={onKeyRename}
|
|
58
|
+
onKeyRenameBlur={onKeyRenameBlur}
|
|
59
|
+
onRemoveProperty={onRemoveProperty}
|
|
58
60
|
readonly={readonly}
|
|
59
61
|
required={required}
|
|
60
62
|
schema={schema}
|
|
@@ -29,7 +29,7 @@ export default function ObjectFieldTemplate<
|
|
|
29
29
|
schema,
|
|
30
30
|
formData,
|
|
31
31
|
optionalDataControl,
|
|
32
|
-
|
|
32
|
+
onAddProperty,
|
|
33
33
|
registry,
|
|
34
34
|
} = props;
|
|
35
35
|
const uiOptions = getUiOptions<T, S, F>(uiSchema);
|
|
@@ -81,7 +81,7 @@ export default function ObjectFieldTemplate<
|
|
|
81
81
|
<AddButton
|
|
82
82
|
id={buttonId(fieldPathId, 'add')}
|
|
83
83
|
className='rjsf-object-property-expand'
|
|
84
|
-
onClick={
|
|
84
|
+
onClick={onAddProperty}
|
|
85
85
|
disabled={disabled || readonly}
|
|
86
86
|
uiSchema={uiSchema}
|
|
87
87
|
registry={registry}
|
|
@@ -18,6 +18,7 @@ import { getChakra } from '../utils';
|
|
|
18
18
|
|
|
19
19
|
export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({
|
|
20
20
|
id,
|
|
21
|
+
htmlName,
|
|
21
22
|
options,
|
|
22
23
|
value,
|
|
23
24
|
required,
|
|
@@ -58,7 +59,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
58
59
|
onBlur={_onBlur}
|
|
59
60
|
onFocus={_onFocus}
|
|
60
61
|
value={selectedIndex}
|
|
61
|
-
name={id}
|
|
62
|
+
name={htmlName || id}
|
|
62
63
|
aria-describedby={ariaDescribedByIds(id)}
|
|
63
64
|
>
|
|
64
65
|
<Stack direction={row ? 'row' : 'column'}>
|
|
@@ -23,6 +23,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
23
23
|
) {
|
|
24
24
|
const {
|
|
25
25
|
id,
|
|
26
|
+
htmlName,
|
|
26
27
|
options,
|
|
27
28
|
label,
|
|
28
29
|
hideLabel,
|
|
@@ -126,7 +127,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
126
127
|
<SelectRoot
|
|
127
128
|
collection={selectOptions}
|
|
128
129
|
id={id}
|
|
129
|
-
name={id}
|
|
130
|
+
name={htmlName || id}
|
|
130
131
|
multiple={isMultiple}
|
|
131
132
|
closeOnSelect={!isMultiple}
|
|
132
133
|
onBlur={_onBlur}
|
|
@@ -18,6 +18,7 @@ export default function TextareaWidget<
|
|
|
18
18
|
F extends FormContextType = any,
|
|
19
19
|
>({
|
|
20
20
|
id,
|
|
21
|
+
htmlName,
|
|
21
22
|
placeholder,
|
|
22
23
|
value,
|
|
23
24
|
label,
|
|
@@ -52,7 +53,7 @@ export default function TextareaWidget<
|
|
|
52
53
|
>
|
|
53
54
|
<Textarea
|
|
54
55
|
id={id}
|
|
55
|
-
name={id}
|
|
56
|
+
name={htmlName || id}
|
|
56
57
|
value={value ?? ''}
|
|
57
58
|
placeholder={placeholder}
|
|
58
59
|
autoFocus={autofocus}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FocusEvent } from 'react';
|
|
2
1
|
import {
|
|
3
2
|
ADDITIONAL_PROPERTY_FLAG,
|
|
4
3
|
buttonId,
|
|
@@ -24,8 +23,8 @@ export default function WrapIfAdditionalTemplate<
|
|
|
24
23
|
disabled,
|
|
25
24
|
id,
|
|
26
25
|
label,
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
onRemoveProperty,
|
|
27
|
+
onKeyRenameBlur,
|
|
29
28
|
readonly,
|
|
30
29
|
registry,
|
|
31
30
|
required,
|
|
@@ -45,8 +44,6 @@ export default function WrapIfAdditionalTemplate<
|
|
|
45
44
|
);
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) => onKeyChange(target.value);
|
|
49
|
-
|
|
50
47
|
return (
|
|
51
48
|
<Grid key={`${id}-key`} className={classNames} style={style} alignItems='center' gap={2}>
|
|
52
49
|
<GridItem>
|
|
@@ -56,7 +53,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
56
53
|
disabled={disabled || readonly}
|
|
57
54
|
id={`${id}-key`}
|
|
58
55
|
name={`${id}-key`}
|
|
59
|
-
onBlur={!readonly ?
|
|
56
|
+
onBlur={!readonly ? onKeyRenameBlur : undefined}
|
|
60
57
|
type='text'
|
|
61
58
|
mb={1}
|
|
62
59
|
/>
|
|
@@ -68,7 +65,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
68
65
|
id={buttonId(id, 'remove')}
|
|
69
66
|
className='rjsf-object-property-remove'
|
|
70
67
|
disabled={disabled || readonly}
|
|
71
|
-
onClick={
|
|
68
|
+
onClick={onRemoveProperty}
|
|
72
69
|
uiSchema={uiSchema}
|
|
73
70
|
registry={registry}
|
|
74
71
|
/>
|