@etsoo/react 1.2.59 → 1.2.60
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/lib/mu/MaskInput.js +4 -2
- package/package.json +1 -1
- package/src/mu/MaskInput.tsx +3 -2
package/lib/mu/MaskInput.js
CHANGED
|
@@ -16,6 +16,7 @@ export function MaskInput(props) {
|
|
|
16
16
|
: MUGlobal.inputFieldVariant, ...rest } = props;
|
|
17
17
|
const { ref, maskRef } = useIMask(mask);
|
|
18
18
|
const localValue = (_a = defaultValue !== null && defaultValue !== void 0 ? defaultValue : value) !== null && _a !== void 0 ? _a : '';
|
|
19
|
+
const maskObj = maskRef.current;
|
|
19
20
|
// Shrink
|
|
20
21
|
InputLabelProps.shrink = search
|
|
21
22
|
? MUGlobal.searchFieldShrink
|
|
@@ -25,8 +26,9 @@ export function MaskInput(props) {
|
|
|
25
26
|
InputProps.readOnly = readOnly;
|
|
26
27
|
InputProps.inputRef = ref;
|
|
27
28
|
React.useEffect(() => {
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
if (maskObj != null)
|
|
30
|
+
maskObj.value = String(localValue);
|
|
31
|
+
}, [maskObj, localValue]);
|
|
30
32
|
// Layout
|
|
31
33
|
return (React.createElement(TextField, { InputLabelProps: InputLabelProps, InputProps: InputProps, size: size, variant: variant, ...rest }));
|
|
32
34
|
}
|
package/package.json
CHANGED
package/src/mu/MaskInput.tsx
CHANGED
|
@@ -48,6 +48,7 @@ export function MaskInput(props: MaskInputProps) {
|
|
|
48
48
|
|
|
49
49
|
const { ref, maskRef } = useIMask(mask);
|
|
50
50
|
const localValue = defaultValue ?? value ?? '';
|
|
51
|
+
const maskObj = maskRef.current;
|
|
51
52
|
|
|
52
53
|
// Shrink
|
|
53
54
|
InputLabelProps.shrink = search
|
|
@@ -59,8 +60,8 @@ export function MaskInput(props: MaskInputProps) {
|
|
|
59
60
|
InputProps.inputRef = ref;
|
|
60
61
|
|
|
61
62
|
React.useEffect(() => {
|
|
62
|
-
|
|
63
|
-
}, [localValue]);
|
|
63
|
+
if (maskObj != null) maskObj.value = String(localValue);
|
|
64
|
+
}, [maskObj, localValue]);
|
|
64
65
|
|
|
65
66
|
// Layout
|
|
66
67
|
return (
|