mirror of
https://github.com/strapi/strapi.git
synced 2025-08-01 13:29:01 +00:00
fix(helper-lugin): pass field hint to UID component
This commit is contained in:
parent
89b0ad56e7
commit
c375c6935a
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useState, useRef } from 'react';
|
import React, { useEffect, useState, useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useCMEditViewDataManager, useFieldHint } from '@strapi/helper-plugin';
|
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import { TextInput } from '@strapi/design-system/TextInput';
|
import { TextInput } from '@strapi/design-system/TextInput';
|
||||||
@ -23,9 +23,7 @@ import {
|
|||||||
const InputUID = ({
|
const InputUID = ({
|
||||||
attribute,
|
attribute,
|
||||||
contentTypeUID,
|
contentTypeUID,
|
||||||
description,
|
fieldHint,
|
||||||
minimum,
|
|
||||||
maximum,
|
|
||||||
disabled,
|
disabled,
|
||||||
error,
|
error,
|
||||||
intlLabel,
|
intlLabel,
|
||||||
@ -37,7 +35,6 @@ const InputUID = ({
|
|||||||
required,
|
required,
|
||||||
}) => {
|
}) => {
|
||||||
const { modifiedData, initialData, layout } = useCMEditViewDataManager();
|
const { modifiedData, initialData, layout } = useCMEditViewDataManager();
|
||||||
const { fieldHint } = useFieldHint({ description, minimum, maximum });
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [availability, setAvailability] = useState(null);
|
const [availability, setAvailability] = useState(null);
|
||||||
const debouncedValue = useDebounce(value, 300);
|
const debouncedValue = useDebounce(value, 300);
|
||||||
@ -247,11 +244,6 @@ InputUID.propTypes = {
|
|||||||
required: PropTypes.bool,
|
required: PropTypes.bool,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
contentTypeUID: PropTypes.string.isRequired,
|
contentTypeUID: PropTypes.string.isRequired,
|
||||||
description: PropTypes.shape({
|
|
||||||
id: PropTypes.string.isRequired,
|
|
||||||
defaultMessage: PropTypes.string.isRequired,
|
|
||||||
values: PropTypes.object,
|
|
||||||
}),
|
|
||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
error: PropTypes.string,
|
error: PropTypes.string,
|
||||||
intlLabel: PropTypes.shape({
|
intlLabel: PropTypes.shape({
|
||||||
@ -269,20 +261,17 @@ InputUID.propTypes = {
|
|||||||
values: PropTypes.object,
|
values: PropTypes.object,
|
||||||
}),
|
}),
|
||||||
required: PropTypes.bool,
|
required: PropTypes.bool,
|
||||||
minimum: PropTypes.number,
|
fieldHint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
||||||
maximum: PropTypes.number,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
InputUID.defaultProps = {
|
InputUID.defaultProps = {
|
||||||
description: undefined,
|
|
||||||
disabled: false,
|
disabled: false,
|
||||||
error: undefined,
|
error: undefined,
|
||||||
labelAction: undefined,
|
labelAction: undefined,
|
||||||
placeholder: undefined,
|
placeholder: undefined,
|
||||||
value: '',
|
value: '',
|
||||||
required: false,
|
required: false,
|
||||||
minimum: undefined,
|
fieldHint: '',
|
||||||
maximum: undefined,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default InputUID;
|
export default InputUID;
|
||||||
|
@ -103,8 +103,7 @@ const GenericInput = ({
|
|||||||
<CustomInput
|
<CustomInput
|
||||||
{...rest}
|
{...rest}
|
||||||
description={description}
|
description={description}
|
||||||
minimum={minimum}
|
fieldHint={fieldHint}
|
||||||
maximum={maximum}
|
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
intlLabel={intlLabel}
|
intlLabel={intlLabel}
|
||||||
labelAction={labelAction}
|
labelAction={labelAction}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user