@topconsultnpm/sdkui-react-beta 6.12.30 → 6.12.32
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.
@@ -10,6 +10,7 @@ interface ITMTextBox extends ITMEditorBase {
|
|
10
10
|
scale?: number;
|
11
11
|
type?: TextBoxType;
|
12
12
|
value?: string | number;
|
13
|
+
fromModal?: boolean;
|
13
14
|
onValueChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
14
15
|
onBlur?: (value: string | undefined) => void;
|
15
16
|
}
|
@@ -32,7 +32,7 @@ const StyledTextBoxEditorButton = styled.div `
|
|
32
32
|
border-bottom-color: ${TMColors.primary};
|
33
33
|
}
|
34
34
|
`;
|
35
|
-
const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, scale, showClearButton, validationItems = [], label = '', readOnly = false, formulaItems = [], buttons = [], isModifiedWhen, placeHolder, elementStyle, width = '100%', maxValue, fontSize = FontSize.defaultFontSize, icon, labelPosition = 'left', value, disabled = false, type = 'text', onValueChanged, onBlur, borderRadius }) => {
|
35
|
+
const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = false, scale, showClearButton, validationItems = [], label = '', readOnly = false, formulaItems = [], buttons = [], isModifiedWhen, placeHolder, elementStyle, width = '100%', maxValue, fontSize = FontSize.defaultFontSize, icon, labelPosition = 'left', value, disabled = false, type = 'text', onValueChanged, onBlur, borderRadius }) => {
|
36
36
|
const [initialType, setInitialType] = useState(type);
|
37
37
|
const [currentType, setCurrentType] = useState(type);
|
38
38
|
const [currentValue, setCurrentValue] = useState(value);
|
@@ -60,7 +60,12 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, scale, showCle
|
|
60
60
|
// Handle autofocus behavior on mount
|
61
61
|
useEffect(() => {
|
62
62
|
if (autoFocus && inputRef.current) {
|
63
|
-
|
63
|
+
if (fromModal) // utilizzato per i textBox derivanti da una Modal che non riescono a utilizzare l'autofocus
|
64
|
+
setTimeout(() => {
|
65
|
+
inputRef.current && inputRef.current.focus(); // Focus the input field
|
66
|
+
}, 100);
|
67
|
+
else
|
68
|
+
inputRef.current.focus(); // Focus the input field
|
64
69
|
}
|
65
70
|
}, [autoFocus]); // This effect runs when the autoFocus prop changes
|
66
71
|
useEffect(() => {
|