Chore: New standard fields on Companies (#1276)
* New standard fields on Companies Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * New standard fields on Companies Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add requested changes Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Make some fields hidden by default Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add minor refactors Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> --------- Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
@ -9,10 +9,12 @@ export type FieldType =
|
||||
| 'double-text-chip'
|
||||
| 'double-text'
|
||||
| 'number'
|
||||
| 'boolean'
|
||||
| 'date'
|
||||
| 'phone'
|
||||
| 'url'
|
||||
| 'probability';
|
||||
| 'probability'
|
||||
| 'moneyAmount';
|
||||
|
||||
export type FieldTextMetadata = {
|
||||
placeHolder: string;
|
||||
|
||||
@ -11,7 +11,9 @@ export type ViewFieldType =
|
||||
| 'date'
|
||||
| 'phone'
|
||||
| 'url'
|
||||
| 'probability';
|
||||
| 'probability'
|
||||
| 'boolean'
|
||||
| 'moneyAmount';
|
||||
|
||||
export type ViewFieldTextMetadata = {
|
||||
type: 'text';
|
||||
@ -42,6 +44,16 @@ export type ViewFieldNumberMetadata = {
|
||||
isPositive?: boolean;
|
||||
};
|
||||
|
||||
export type ViewFieldMoneyMetadata = {
|
||||
type: 'moneyAmount';
|
||||
fieldName: string;
|
||||
};
|
||||
|
||||
export type ViewFieldBooleanMetadata = {
|
||||
type: 'boolean';
|
||||
fieldName: string;
|
||||
};
|
||||
|
||||
export type ViewFieldRelationMetadata = {
|
||||
type: 'relation';
|
||||
relationType: Entity;
|
||||
@ -89,8 +101,10 @@ export type ViewFieldMetadata = { type: ViewFieldType } & (
|
||||
| ViewFieldPhoneMetadata
|
||||
| ViewFieldURLMetadata
|
||||
| ViewFieldNumberMetadata
|
||||
| ViewFieldBooleanMetadata
|
||||
| ViewFieldDateMetadata
|
||||
| ViewFieldProbabilityMetadata
|
||||
| ViewFieldMoneyMetadata
|
||||
);
|
||||
|
||||
export type ViewFieldDefinition<T extends ViewFieldMetadata | unknown> = {
|
||||
@ -109,6 +123,8 @@ export type ViewFieldTextValue = string;
|
||||
export type ViewFieldChipValue = string;
|
||||
export type ViewFieldDateValue = string;
|
||||
export type ViewFieldPhoneValue = string;
|
||||
export type ViewFieldBooleanValue = boolean;
|
||||
export type ViewFieldMoneyValue = number;
|
||||
export type ViewFieldURLValue = string;
|
||||
export type ViewFieldNumberValue = number | null;
|
||||
export type ViewFieldProbabilityValue = number;
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
import {
|
||||
ViewFieldBooleanMetadata,
|
||||
ViewFieldDefinition,
|
||||
ViewFieldMetadata,
|
||||
} from '../ViewField';
|
||||
|
||||
export function isViewFieldBoolean(
|
||||
field: ViewFieldDefinition<ViewFieldMetadata>,
|
||||
): field is ViewFieldDefinition<ViewFieldBooleanMetadata> {
|
||||
return field.metadata.type === 'boolean';
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
import { ViewFieldBooleanValue } from '../ViewField';
|
||||
|
||||
export function isViewFieldBooleanValue(
|
||||
fieldValue: unknown,
|
||||
): fieldValue is ViewFieldBooleanValue {
|
||||
return typeof fieldValue === 'boolean';
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
import {
|
||||
ViewFieldDefinition,
|
||||
ViewFieldMetadata,
|
||||
ViewFieldMoneyMetadata,
|
||||
} from '../ViewField';
|
||||
|
||||
export function isViewFieldMoney(
|
||||
field: ViewFieldDefinition<ViewFieldMetadata>,
|
||||
): field is ViewFieldDefinition<ViewFieldMoneyMetadata> {
|
||||
return field.metadata.type === 'moneyAmount';
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
import { ViewFieldMoneyValue } from '../ViewField';
|
||||
|
||||
export function isViewFieldMoneyValue(
|
||||
fieldValue: unknown,
|
||||
): fieldValue is ViewFieldMoneyValue {
|
||||
return typeof fieldValue === 'number';
|
||||
}
|
||||
Reference in New Issue
Block a user