Feat/phone email link enhancements (#1172)
* feat: Add type guards for ViewField email values and definitions, update ViewFieldTypes & peopleViewFields * feat: use ContactLink for EditablePhoneCell & create EditableEmailCell & EmailInputDisplay comp * fix: set second value for field * enhance: add edit btn for phone cell * feat: install dependencies intl-tel-input * feat: add phone cell input & connect intl-tel-input * fix: resolve rebase errors * fix: remove placeholder * feat(storybook): create stories for EmailInputDisplay, PhoneInputDisplay, and PhoneEditableField components --------- Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
@ -9,6 +9,7 @@ export type FieldType =
|
||||
| 'double-text-chip'
|
||||
| 'double-text'
|
||||
| 'number'
|
||||
| 'email'
|
||||
| 'boolean'
|
||||
| 'date'
|
||||
| 'phone'
|
||||
@ -40,6 +41,11 @@ export type FieldNumberMetadata = {
|
||||
placeHolder: string;
|
||||
};
|
||||
|
||||
export type FieldEmailMetadata = {
|
||||
fieldName: string;
|
||||
placeHolder: string;
|
||||
};
|
||||
|
||||
export type FieldRelationMetadata = {
|
||||
relationType: Entity;
|
||||
fieldName: string;
|
||||
@ -82,6 +88,7 @@ export type FieldMetadata =
|
||||
| FieldPhoneMetadata
|
||||
| FieldURLMetadata
|
||||
| FieldNumberMetadata
|
||||
| FieldEmailMetadata
|
||||
| FieldDateMetadata
|
||||
| FieldProbabilityMetadata;
|
||||
|
||||
@ -92,6 +99,7 @@ export type FieldDateValue = string;
|
||||
export type FieldPhoneValue = string;
|
||||
export type FieldURLValue = string;
|
||||
export type FieldNumberValue = number | null;
|
||||
export type FieldEmailValue = string;
|
||||
export type FieldProbabilityValue = number;
|
||||
|
||||
export type FieldDoubleTextValue = {
|
||||
|
||||
@ -10,6 +10,7 @@ export type ViewFieldType =
|
||||
| 'number'
|
||||
| 'date'
|
||||
| 'phone'
|
||||
| 'email'
|
||||
| 'url'
|
||||
| 'probability'
|
||||
| 'boolean'
|
||||
@ -27,6 +28,12 @@ export type ViewFieldPhoneMetadata = {
|
||||
fieldName: string;
|
||||
};
|
||||
|
||||
export type ViewFieldEmailMetadata = {
|
||||
type: 'email';
|
||||
placeHolder: string;
|
||||
fieldName: string;
|
||||
};
|
||||
|
||||
export type ViewFieldURLMetadata = {
|
||||
type: 'url';
|
||||
placeHolder: string;
|
||||
@ -99,6 +106,7 @@ export type ViewFieldMetadata = { type: ViewFieldType } & (
|
||||
| ViewFieldDoubleTextChipMetadata
|
||||
| ViewFieldDoubleTextMetadata
|
||||
| ViewFieldPhoneMetadata
|
||||
| ViewFieldEmailMetadata
|
||||
| ViewFieldURLMetadata
|
||||
| ViewFieldNumberMetadata
|
||||
| ViewFieldBooleanMetadata
|
||||
@ -123,6 +131,7 @@ export type ViewFieldTextValue = string;
|
||||
export type ViewFieldChipValue = string;
|
||||
export type ViewFieldDateValue = string;
|
||||
export type ViewFieldPhoneValue = string;
|
||||
export type ViewFieldEmailValue = string;
|
||||
export type ViewFieldBooleanValue = boolean;
|
||||
export type ViewFieldMoneyValue = number;
|
||||
export type ViewFieldURLValue = string;
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
import {
|
||||
ViewFieldDefinition,
|
||||
ViewFieldEmailMetadata,
|
||||
ViewFieldMetadata,
|
||||
} from '../ViewField';
|
||||
|
||||
export function isViewFieldEmail(
|
||||
field: ViewFieldDefinition<ViewFieldMetadata>,
|
||||
): field is ViewFieldDefinition<ViewFieldEmailMetadata> {
|
||||
return field.metadata.type === 'email';
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
import { ViewFieldEmailValue } from '../ViewField';
|
||||
|
||||
export function isViewFieldEmailValue(
|
||||
fieldValue: unknown,
|
||||
): fieldValue is ViewFieldEmailValue {
|
||||
return (
|
||||
fieldValue !== null &&
|
||||
fieldValue !== undefined &&
|
||||
typeof fieldValue === 'string'
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user