Tt filter step input per variable type (#13371)
- add fieldMetadataId to step output schema - use it to display FormFieldInput in Filter input - few fixes for a few fields Next step: - Handle composite fields - Design review
This commit is contained in:
@ -47,6 +47,7 @@ import { isFieldRichTextV2 } from '@/object-record/record-field/types/guards/isF
|
||||
import { isFieldSelect } from '@/object-record/record-field/types/guards/isFieldSelect';
|
||||
import { isFieldText } from '@/object-record/record-field/types/guards/isFieldText';
|
||||
import { isFieldUuid } from '@/object-record/record-field/types/guards/isFieldUuid';
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { JsonValue } from 'type-fest';
|
||||
|
||||
type FormFieldInputProps = {
|
||||
@ -70,7 +71,7 @@ export const FormFieldInput = ({
|
||||
error,
|
||||
onError,
|
||||
}: FormFieldInputProps) => {
|
||||
return isFieldNumber(field) ? (
|
||||
return isFieldNumber(field) || field.type === FieldMetadataType.NUMERIC ? (
|
||||
<FormNumberFieldInput
|
||||
label={field.label}
|
||||
defaultValue={defaultValue as string | number | undefined}
|
||||
|
||||
@ -48,7 +48,7 @@ export const FormBooleanFieldInput = ({
|
||||
}
|
||||
: {
|
||||
type: 'static',
|
||||
value: defaultValue ?? false,
|
||||
value: Boolean(defaultValue),
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useLis
|
||||
import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString';
|
||||
import { css } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { ChangeEvent, KeyboardEvent, useId, useRef, useState } from 'react';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
@ -106,9 +107,10 @@ export const FormDateTimeFieldInput = ({
|
||||
},
|
||||
);
|
||||
|
||||
const draftValueAsDate = isDefined(draftValue.value)
|
||||
? new Date(draftValue.value)
|
||||
: null;
|
||||
const draftValueAsDate =
|
||||
isDefined(draftValue.value) && isNonEmptyString(draftValue.value)
|
||||
? new Date(draftValue.value)
|
||||
: null;
|
||||
|
||||
const [pickerDate, setPickerDate] =
|
||||
useState<Nullable<Date>>(draftValueAsDate);
|
||||
|
||||
Reference in New Issue
Block a user