File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed
packages/react-sdk-components/src/components/field Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1- import { useState } from 'react' ;
1+ import { useEffect , useState } from 'react' ;
22import { DatePicker } from '@mui/x-date-pickers/DatePicker' ;
33import dayjs , { Dayjs } from 'dayjs' ;
44
@@ -39,6 +39,10 @@ export default function Date(props: DateProps) {
3939 dateFormatInfo . dateFormatStringLC = theDateFormat . dateFormatStringLC ;
4040 dateFormatInfo . dateFormatMask = theDateFormat . dateFormatMask ;
4141
42+ useEffect ( ( ) => {
43+ setDateValue ( dayjs ( value ) ) ;
44+ } , [ value ] ) ;
45+
4246 if ( displayMode === 'DISPLAY_ONLY' ) {
4347 const formattedDate = format ( props . value , 'date' , {
4448 format : dateFormatInfo . dateFormatString
Original file line number Diff line number Diff line change 1- import { useState } from 'react' ;
1+ import { useEffect , useState } from 'react' ;
22import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker' ;
33import dayjs , { Dayjs } from 'dayjs' ;
44
@@ -34,6 +34,10 @@ export default function DateTime(props: DateTimeProps) {
3434 dateFormatInfo . dateFormatStringLC = theDateFormat . dateFormatStringLC ;
3535 dateFormatInfo . dateFormatMask = theDateFormat . dateFormatMask ;
3636
37+ useEffect ( ( ) => {
38+ setDateValue ( dayjs ( value ) ) ;
39+ } , [ value ] ) ;
40+
3741 if ( displayMode === 'DISPLAY_ONLY' ) {
3842 const formattedDateTime = format ( props . value , 'datetime' , {
3943 format : `${ dateFormatInfo . dateFormatString } hh:mm a`
Original file line number Diff line number Diff line change 11import { NumericFormat } from 'react-number-format' ;
22import { TextField } from '@mui/material' ;
3- import { useState } from 'react' ;
3+ import { useEffect , useState } from 'react' ;
44import { getCurrencyCharacters , getCurrencyOptions } from '../Currency/currency-utils' ;
55import handleEvent from '../../helpers/event-utils' ;
66import { format } from '../../helpers/formatters' ;
@@ -58,6 +58,10 @@ export default function Decimal(props: DecimalProps) {
5858
5959 const theCurrencyOptions = getCurrencyOptions ( currencyISOCode ) ;
6060
61+ useEffect ( ( ) => {
62+ setValues ( value . toString ( ) ) ;
63+ } , [ value ] ) ;
64+
6165 let readOnlyProp = { } ; // Note: empty if NOT ReadOnly
6266
6367 if ( readOnly ) {
Original file line number Diff line number Diff line change 1- import { useState } from 'react' ;
1+ import { useEffect , useState } from 'react' ;
22import { NumericFormat } from 'react-number-format' ;
33import { TextField } from '@mui/material' ;
44import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map' ;
@@ -52,6 +52,10 @@ export default function Percentage(props: PercentageProps) {
5252 const theCurrencyOptions = getCurrencyOptions ( currencyISOCode ) ;
5353 const formattedValue = format ( value , pConn . getComponentName ( ) ?. toLowerCase ( ) , theCurrencyOptions ) ;
5454
55+ useEffect ( ( ) => {
56+ setValues ( value . toString ( ) ) ;
57+ } , [ value ] ) ;
58+
5559 let readOnlyProp = { } ; // Note: empty if NOT ReadOnly
5660
5761 if ( readOnly ) {
You can’t perform that action at this time.
0 commit comments