From d74472bb14bdbdabbc58c4d5f6ec0db0c28615fe Mon Sep 17 00:00:00 2001 From: PritamIT2023 Date: Mon, 14 Oct 2024 18:58:19 +0530 Subject: [PATCH] fix(global): :bug: fix CoreDatePicker not working fix CoreDatePicker not working Ref: #344 --- .../dataTable/CoreDataTableDetailsPane.js | 10 ++-- package/components/inputs/CoreDatepicker.js | 8 ++- .../inputs/CoreMultiTimeRangePicker.js | 57 ++++++------------- 3 files changed, 28 insertions(+), 47 deletions(-) diff --git a/package/components/dataDisplay/dataTable/CoreDataTableDetailsPane.js b/package/components/dataDisplay/dataTable/CoreDataTableDetailsPane.js index 45f77231..c98d99fd 100644 --- a/package/components/dataDisplay/dataTable/CoreDataTableDetailsPane.js +++ b/package/components/dataDisplay/dataTable/CoreDataTableDetailsPane.js @@ -8,7 +8,7 @@ import { WrappidDataContext } from "@wrappid/styles"; import CoreDataTableDetailsPaneContainer from "./CoreDataTableDetailsPaneContainer"; import CoreTableAction from "./CoreTableAction"; import TableRowAuditData from "./TableRowAuditData"; -import { ENV_DEV_MODE, MEDIUM_WINDOW_WIDTH } from "../../../config/constants"; +import { ENV_DEV_MODE, SMALL_WINDOW_WIDTH } from "../../../config/constants"; import CoreClasses from "../../../styles/CoreClasses"; import { getLabel } from "../../../utils/stringUtils"; import { APP_PLATFORM } from "../../../utils/themeUtil"; @@ -122,7 +122,7 @@ export default function CoreDataTableDetailsPane(props) { rowActions.length > 0 && ( )} - {(window.windowWidth < MEDIUM_WINDOW_WIDTH || + {(window.innerWidth < SMALL_WINDOW_WIDTH || config?.wrappid?.platform === APP_PLATFORM) && ( 0 && ( )} - {(window.windowWidth < MEDIUM_WINDOW_WIDTH || + {(window.innerWidth < SMALL_WINDOW_WIDTH || config?.wrappid?.platform === APP_PLATFORM) && ( { - if(formik){ - formik?.setFieldValue(id, value); - } - if(props?.onChange){ - props?.onChange(value); - } - setStartTime(value); - }; - const onChangeEndTime = (value) => { - if(formik){ - formik?.setFieldValue(id, value); - } - if(props?.onChange){ - props?.onChange(value); - } - setEndTime(value); - }; - + const { + // eslint-disable-next-line no-unused-vars + id, label, onChange, value, formik, ampm + } = props; const [timeRanges, setTimeRanges] = React.useState([ { endTime : null, @@ -68,12 +50,12 @@ export default function CoreMultiTimeRangePicker(props) { setTimeRanges(y); }; - // const _handleChange = (i, v, type) => { - // let x = [...timeRanges]; + const _handleChange = (i, v, type) => { + let x = [...timeRanges]; - // x[i][type] = v?.format("LLL"); - // formik.setFieldValue(props.id, x); - // }; + x[i][type] = v?.format("LLL"); + formik.setFieldValue(props.id, x); + }; // -- console.log("END VALUE", id, spValue, value); @@ -89,8 +71,10 @@ export default function CoreMultiTimeRangePicker(props) { label={props.startTimeLabel ? props.startTimeLabel : "Start Time"} inputFormat={props.ampm ? "hh:mm" : "HH:MM"} ampm={props.ampm ? true : false} - value={timeRange.startTime ? moment(timeRange.startTime) : startTime} - onChange={onChangeStartTime} + value={timeRange.startTime ? moment(timeRange.startTime) : null} + onChange={(v) => { + _handleChange(index, v, "startTime"); + }} touched={props.touched} error={props.error} /> @@ -101,8 +85,10 @@ export default function CoreMultiTimeRangePicker(props) { label={props.endTimeLabel ? props.endTimeLabel : "End Time"} inputFormat={props.ampm ? "hh:mm" : "HH:MM"} ampm={props.ampm ? true : false} - value={timeRange.endTime ? moment(timeRange.endTime) : endTime} - onChange={onChangeEndTime} + value={timeRange.endTime ? moment(timeRange.endTime) : null} + onChange={(v) => { + _handleChange(index, v, "endTime"); + }} touched={props.touched} error={props.error} /> @@ -132,11 +118,4 @@ export default function CoreMultiTimeRangePicker(props) { ); -} -CoreMultiTimeRangePicker.validProps = [ - { - name : "formik", - types: [{ type: "object" }] - } -]; -CoreMultiTimeRangePicker.invalidProps = []; \ No newline at end of file +} \ No newline at end of file