From 871a3a365e5115d59e19a44fbcbcaac5fb072b4f Mon Sep 17 00:00:00 2001 From: Ivan Date: Fri, 18 Oct 2024 15:05:29 +0200 Subject: [PATCH] Fix #7354: InputMask Classname p-filled not works fine (#7355) --- components/lib/inputmask/InputMask.js | 1 + components/lib/inputtext/InputText.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/components/lib/inputmask/InputMask.js b/components/lib/inputmask/InputMask.js index 505bda234b..8d030abd39 100644 --- a/components/lib/inputmask/InputMask.js +++ b/components/lib/inputmask/InputMask.js @@ -635,6 +635,7 @@ export const InputMask = React.memo( name={props.name} style={props.style} className={className} + value={props.value} {...otherProps} placeholder={props.placeholder} size={props.size} diff --git a/components/lib/inputtext/InputText.js b/components/lib/inputtext/InputText.js index 712455e737..c0e80eeb99 100644 --- a/components/lib/inputtext/InputText.js +++ b/components/lib/inputtext/InputText.js @@ -70,6 +70,14 @@ export const InputText = React.memo( const isFilled = React.useMemo(() => ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue), [props.value, props.defaultValue]); const hasTooltip = ObjectUtils.isNotEmpty(props.tooltip); + React.useEffect(() => { + if (isFilled) { + DomHandler.addClass(elementRef.current, 'p-filled'); + } else { + DomHandler.removeClass(elementRef.current, 'p-filled'); + } + }, [props.disabled, isFilled]); + const rootProps = mergeProps( { className: classNames(props.className, cx('root', { context, isFilled })),