From 2d45fc40503886019722c733c47e86d644f075af Mon Sep 17 00:00:00 2001 From: chavda-bhavik Date: Fri, 4 Oct 2024 19:29:00 +0530 Subject: [PATCH 1/4] feat: Increased year range for date picker --- apps/widget/src/hooks/DataGrid/useDataGrid.ts | 3 +++ apps/widget/src/hooks/Phase3/usePhase3.tsx | 3 +++ apps/widget/src/types/utility.types.ts | 1 + 3 files changed, 7 insertions(+) diff --git a/apps/widget/src/hooks/DataGrid/useDataGrid.ts b/apps/widget/src/hooks/DataGrid/useDataGrid.ts index cd617c4b..b0006099 100644 --- a/apps/widget/src/hooks/DataGrid/useDataGrid.ts +++ b/apps/widget/src/hooks/DataGrid/useDataGrid.ts @@ -153,6 +153,9 @@ export function useDataGrid({ limit }: IDataGridProps) { columnItem.dateFormat = column.dateFormats[variables.baseIndex]; columnItem.correctFormat = true; } + columnItem.datePickerConfig = { + yearRange: [1900, 3000], + }; columnItem.renderer = 'custom'; break; default: diff --git a/apps/widget/src/hooks/Phase3/usePhase3.tsx b/apps/widget/src/hooks/Phase3/usePhase3.tsx index d8fba27f..e41b646d 100644 --- a/apps/widget/src/hooks/Phase3/usePhase3.tsx +++ b/apps/widget/src/hooks/Phase3/usePhase3.tsx @@ -122,6 +122,9 @@ export function usePhase3({ onNext }: IUsePhase3Props) { columnItem.dateFormat = column.dateFormats[variables.baseIndex]; columnItem.correctFormat = true; } + columnItem.datePickerConfig = { + yearRange: [1900, 3000], + }; columnItem.renderer = 'custom'; break; default: diff --git a/apps/widget/src/types/utility.types.ts b/apps/widget/src/types/utility.types.ts index 6d6b93aa..03708d05 100644 --- a/apps/widget/src/types/utility.types.ts +++ b/apps/widget/src/types/utility.types.ts @@ -18,6 +18,7 @@ export type HotItemSchema = { allowInvalid?: boolean; disableVisualSelection?: boolean; description?: string; + datePickerConfig?: Record; // https://github.com/Pikaday/Pikaday#configuration renderer?: | 'custom' | 'check' From a6811790ae5f46066232b6811ab14215d598a802 Mon Sep 17 00:00:00 2001 From: chavda-bhavik Date: Fri, 4 Oct 2024 19:46:19 +0530 Subject: [PATCH 2/4] fix: Heading missalignment in manual-entry --- .../src/components/Common/Heading/Heading.tsx | 41 +++++++++++++------ .../src/components/Common/Layout/Layout.tsx | 16 +------- apps/widget/src/components/widget/Widget.tsx | 9 +--- packages/client/src/config/texts.config.ts | 1 + 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/apps/widget/src/components/Common/Heading/Heading.tsx b/apps/widget/src/components/Common/Heading/Heading.tsx index 9f0de89e..f1c84b45 100644 --- a/apps/widget/src/components/Common/Heading/Heading.tsx +++ b/apps/widget/src/components/Common/Heading/Heading.tsx @@ -1,20 +1,17 @@ import { CloseButton, Group, MediaQuery, Title } from '@mantine/core'; -import { PhasesEnum } from '@types'; +import { FlowsEnum, PhasesEnum } from '@types'; import { Stepper } from '@ui/Stepper'; -import { WIDGET_TEXTS } from '@impler/client'; -import { TemplateModeEnum } from '@impler/shared'; +import { useAppState } from '@store/app.context'; interface IHeadingProps { title?: string; active: PhasesEnum; onClose?: () => void; - mode?: TemplateModeEnum; - hasImageUpload?: boolean; - texts: typeof WIDGET_TEXTS; } -export function Heading({ active, title, mode, hasImageUpload, texts, onClose }: IHeadingProps) { - const manualImportSteps = [ +export function Heading({ active, title, onClose }: IHeadingProps) { + const { texts, flow } = useAppState(); + const straightImportSteps = [ { label: texts.STEPPER_TITLES.UPLOAD_FILE, }, @@ -32,6 +29,15 @@ export function Heading({ active, title, mode, hasImageUpload, texts, onClose }: }, ]; + const manualEntryImportSteps = [ + { + label: texts.STEPPER_TITLES.UPLOAD_FILE, + }, + { + label: texts.STEPPER_TITLES.REVIEW_EDIT, + }, + ]; + const autoImportSteps = [ { label: texts.STEPPER_TITLES.CONFIGURE_JOB, @@ -52,18 +58,27 @@ export function Heading({ active, title, mode, hasImageUpload, texts, onClose }: {title} diff --git a/apps/widget/src/components/Common/Layout/Layout.tsx b/apps/widget/src/components/Common/Layout/Layout.tsx index f4664c90..6b0e9176 100644 --- a/apps/widget/src/components/Common/Layout/Layout.tsx +++ b/apps/widget/src/components/Common/Layout/Layout.tsx @@ -1,33 +1,21 @@ import { PropsWithChildren } from 'react'; import useStyles from './Styles'; import { PhasesEnum } from '@types'; -import { WIDGET_TEXTS } from '@impler/client'; -import { TemplateModeEnum } from '@impler/shared'; import { Heading } from 'components/Common/Heading'; interface ILayoutProps { active: PhasesEnum; title?: string; onClose?: () => void; - mode?: TemplateModeEnum; - hasImageUpload?: boolean; - texts: typeof WIDGET_TEXTS; } export function Layout(props: PropsWithChildren) { const { classes } = useStyles(); - const { children, active, title, hasImageUpload, mode, texts, onClose } = props; + const { children, active, title, onClose } = props; return (
- +
{children}
); diff --git a/apps/widget/src/components/widget/Widget.tsx b/apps/widget/src/components/widget/Widget.tsx index e0dda10a..8f2d5898 100644 --- a/apps/widget/src/components/widget/Widget.tsx +++ b/apps/widget/src/components/widget/Widget.tsx @@ -157,14 +157,7 @@ export function Widget() { return ( - + {PhaseView[phase]} Date: Sun, 6 Oct 2024 09:52:02 +0530 Subject: [PATCH 3/4] feat: Added condition to match empty values in replace --- apps/api/src/app/review/usecases/replace/replace.usecase.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/api/src/app/review/usecases/replace/replace.usecase.ts b/apps/api/src/app/review/usecases/replace/replace.usecase.ts index fcb894d6..86d6fd97 100644 --- a/apps/api/src/app/review/usecases/replace/replace.usecase.ts +++ b/apps/api/src/app/review/usecases/replace/replace.usecase.ts @@ -50,6 +50,7 @@ export class Replace { { $eq: ['$' + path, ''] }, { $regexMatch: { input: { $toString: '$' + path }, regex: /^\s*$/ } }, { $eq: ['$' + path, null] }, + { $not: [{ $ifNull: ['$' + path, false] }] }, ], }; replaceOperation = { $literal: formattedReplace }; @@ -146,6 +147,8 @@ export class Replace { // Add a final stage to remove the temporary _oldRecord field updateStages.push({ $unset: '_oldRecord' }); + console.log(updateStages); + const result = await recordCollectionModal.updateMany({}, updateStages, { multi: true }); return result; From 47de9ff2ffe6a9a8773503d1a7b25347888d76e8 Mon Sep 17 00:00:00 2001 From: chavda-bhavik Date: Sun, 6 Oct 2024 09:52:55 +0530 Subject: [PATCH 4/4] feat: Added checks for empty selected values --- apps/widget/src/components/Common/Table/Table.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/widget/src/components/Common/Table/Table.tsx b/apps/widget/src/components/Common/Table/Table.tsx index c68e8378..eb783327 100644 --- a/apps/widget/src/components/Common/Table/Table.tsx +++ b/apps/widget/src/components/Common/Table/Table.tsx @@ -211,10 +211,13 @@ export const Table = forwardRef( } }} beforeKeyDown={(event) => { - const [[row, col]] = (gridRef as any)?.current.__hotInstance?.getSelected(); - const rows = (gridRef as any)?.current?.__hotInstance?.countRows(); - if (event.key === 'Tab' && col === headings.length - 1) { - (gridRef as any)?.current.__hotInstance.selectCell(Math.min(rows, row + 1), selectEnabled ? 3 : 1); + const selected = (gridRef as any)?.current.__hotInstance?.getSelected(); + if (Array.isArray(selected) && selected.length > 0 && Array.isArray(selected[0])) { + const [[row, col]] = selected; + const rows = (gridRef as any)?.current?.__hotInstance?.countRows(); + if (event.key === 'Tab' && col === headings.length - 1) { + (gridRef as any)?.current.__hotInstance.selectCell(Math.min(rows, row + 1), selectEnabled ? 3 : 1); + } } }} fillHandle={{