@applica-software-guru/react-admin 1.5.358 → 1.5.361
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/components/ra-inputs/AutocompleteInput.d.ts +3 -1
- package/dist/components/ra-inputs/AutocompleteInput.d.ts.map +1 -1
- package/dist/components/ra-inputs/LabeledArrayInput.d.ts.map +1 -1
- package/dist/components/ra-inputs/LabeledInput.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +1 -1
- package/dist/react-admin.cjs.js.gz +0 -0
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +1867 -1868
- package/dist/react-admin.es.js.gz +0 -0
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +25 -25
- package/dist/react-admin.umd.js.gz +0 -0
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ra-inputs/AutocompleteInput.tsx +9 -6
- package/src/components/ra-inputs/LabeledArrayInput.tsx +7 -2
- package/src/components/ra-inputs/LabeledInput.tsx +7 -2
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { LabeledInput } from '@/components/ra-inputs/LabeledInput';
|
|
1
|
+
import { LabeledInput, LabeledInputProps } from '@/components/ra-inputs/LabeledInput';
|
|
2
2
|
import { styled } from '@mui/material/styles';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
AutocompleteInput as RaAutocompleteInput,
|
|
5
|
+
AutocompleteInputProps as RaAutocompleteInputProps
|
|
6
|
+
} from 'react-admin';
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
name: 'StyledAutocompleteInput',
|
|
8
|
-
root: 'root'
|
|
8
|
+
const StyledAutocompleteInput = styled(RaAutocompleteInput as any, {
|
|
9
|
+
name: 'StyledAutocompleteInput'
|
|
9
10
|
})(({ label }) => ({
|
|
10
11
|
'& legend': {
|
|
11
12
|
width: label === false ? 0 : 'auto'
|
|
@@ -15,6 +16,8 @@ const StyledAutocompleteInput = styled(RaAutocompleteInput, {
|
|
|
15
16
|
}
|
|
16
17
|
}));
|
|
17
18
|
|
|
19
|
+
type AutocompleteInputProps = RaAutocompleteInputProps & LabeledInputProps;
|
|
20
|
+
|
|
18
21
|
function AutocompleteInput({ size = 'small', ...props }: AutocompleteInputProps): JSX.Element {
|
|
19
22
|
// Sanitize props removing "perPage":
|
|
20
23
|
// @ts-ignore
|
|
@@ -2,7 +2,7 @@ import { useAppConfig } from '@/components/AppStateProvider';
|
|
|
2
2
|
import { useTheme } from '@emotion/react';
|
|
3
3
|
import { FormHelperText, InputLabel, Stack, SxProps } from '@mui/material';
|
|
4
4
|
import React, { PropsWithChildren } from 'react';
|
|
5
|
-
import { FieldTitle } from 'react-admin';
|
|
5
|
+
import { FieldTitle, useTranslate } from 'react-admin';
|
|
6
6
|
import { useFormContext } from 'react-hook-form';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -20,6 +20,7 @@ function LabeledArrayInput({
|
|
|
20
20
|
...props
|
|
21
21
|
}: LabeledArrayInputProps): React.ReactElement {
|
|
22
22
|
const theme = useTheme() as any;
|
|
23
|
+
const translate = useTranslate();
|
|
23
24
|
const { getCurrentDialog } = useAppConfig();
|
|
24
25
|
const { source, resource, isRequired } = props;
|
|
25
26
|
const { getFieldState, formState } = useFormContext();
|
|
@@ -73,7 +74,11 @@ function LabeledArrayInput({
|
|
|
73
74
|
}}
|
|
74
75
|
error={!!error}
|
|
75
76
|
>
|
|
76
|
-
{helperText
|
|
77
|
+
{React.isValidElement(helperText)
|
|
78
|
+
? helperText
|
|
79
|
+
: typeof helperText === 'string'
|
|
80
|
+
? translate(helperText, { _: helperText })
|
|
81
|
+
: helperText}
|
|
77
82
|
</FormHelperText>
|
|
78
83
|
) : null}
|
|
79
84
|
</Stack>
|
|
@@ -2,7 +2,7 @@ import { useAppConfig } from '@/components/AppStateProvider';
|
|
|
2
2
|
import { FormHelperText, InputLabel, Stack } from '@mui/material';
|
|
3
3
|
import { useTheme } from '@mui/material/styles';
|
|
4
4
|
import React, { PropsWithChildren, ReactElement } from 'react';
|
|
5
|
-
import { CommonInputProps, FieldTitle, useInput } from 'react-admin';
|
|
5
|
+
import { CommonInputProps, FieldTitle, useInput, useTranslate } from 'react-admin';
|
|
6
6
|
|
|
7
7
|
function LabeledInput({
|
|
8
8
|
label,
|
|
@@ -15,6 +15,7 @@ function LabeledInput({
|
|
|
15
15
|
...props
|
|
16
16
|
}: LabeledInputProps): JSX.Element {
|
|
17
17
|
const theme = useTheme();
|
|
18
|
+
const translate = useTranslate();
|
|
18
19
|
const { getCurrentDialog } = useAppConfig();
|
|
19
20
|
const { source, resource, isRequired, chip } = props;
|
|
20
21
|
const {
|
|
@@ -73,7 +74,11 @@ function LabeledInput({
|
|
|
73
74
|
}}
|
|
74
75
|
error={invalid === true}
|
|
75
76
|
>
|
|
76
|
-
{helperText
|
|
77
|
+
{React.isValidElement(helperText)
|
|
78
|
+
? helperText
|
|
79
|
+
: typeof helperText === 'string'
|
|
80
|
+
? translate(helperText, { _: helperText })
|
|
81
|
+
: helperText}
|
|
77
82
|
</FormHelperText>
|
|
78
83
|
) : null}
|
|
79
84
|
</Stack>
|