mirror of
https://github.com/lingble/twenty.git
synced 2025-11-01 13:17:57 +00:00
@@ -34,6 +34,7 @@
|
|||||||
"lodash.camelcase": "^4.3.0",
|
"lodash.camelcase": "^4.3.0",
|
||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
"lodash.kebabcase": "^4.1.1",
|
"lodash.kebabcase": "^4.1.1",
|
||||||
|
"lodash.snakecase": "^4.1.1",
|
||||||
"luxon": "^3.3.0",
|
"luxon": "^3.3.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-data-grid": "7.0.0-beta.13",
|
"react-data-grid": "7.0.0-beta.13",
|
||||||
@@ -138,6 +139,7 @@
|
|||||||
"@types/lodash.camelcase": "^4.3.7",
|
"@types/lodash.camelcase": "^4.3.7",
|
||||||
"@types/lodash.debounce": "^4.0.7",
|
"@types/lodash.debounce": "^4.0.7",
|
||||||
"@types/lodash.kebabcase": "^4.1.7",
|
"@types/lodash.kebabcase": "^4.1.7",
|
||||||
|
"@types/lodash.snakecase": "^4.1.9",
|
||||||
"@types/luxon": "^3.3.0",
|
"@types/luxon": "^3.3.0",
|
||||||
"@types/react-datepicker": "^4.11.2",
|
"@types/react-datepicker": "^4.11.2",
|
||||||
"@types/scroll-into-view": "^1.16.0",
|
"@types/scroll-into-view": "^1.16.0",
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|||||||
*/
|
*/
|
||||||
const documents = {
|
const documents = {
|
||||||
"\n mutation CreateOneObjectMetadataItem($input: CreateOneObjectInput!) {\n createOneObject(input: $input) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.CreateOneObjectMetadataItemDocument,
|
"\n mutation CreateOneObjectMetadataItem($input: CreateOneObjectInput!) {\n createOneObject(input: $input) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.CreateOneObjectMetadataItemDocument,
|
||||||
"\n mutation CreateOneFieldMetadataItem($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.CreateOneFieldMetadataItemDocument,
|
"\n mutation CreateOneFieldMetadataItem($input: CreateOneFieldMetadataInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n defaultValue\n options\n }\n }\n": types.CreateOneFieldMetadataItemDocument,
|
||||||
"\n mutation CreateOneRelationMetadata($input: CreateOneRelationInput!) {\n createOneRelation(input: $input) {\n id\n relationType\n fromObjectMetadataId\n toObjectMetadataId\n fromFieldMetadataId\n toFieldMetadataId\n createdAt\n updatedAt\n }\n }\n": types.CreateOneRelationMetadataDocument,
|
"\n mutation CreateOneRelationMetadata($input: CreateOneRelationInput!) {\n createOneRelation(input: $input) {\n id\n relationType\n fromObjectMetadataId\n toObjectMetadataId\n fromFieldMetadataId\n toFieldMetadataId\n createdAt\n updatedAt\n }\n }\n": types.CreateOneRelationMetadataDocument,
|
||||||
"\n mutation UpdateOneFieldMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateFieldInput!\n ) {\n updateOneField(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.UpdateOneFieldMetadataItemDocument,
|
"\n mutation UpdateOneFieldMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateFieldInput!\n ) {\n updateOneField(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.UpdateOneFieldMetadataItemDocument,
|
||||||
"\n mutation UpdateOneObjectMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateObjectInput!\n ) {\n updateOneObject(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.UpdateOneObjectMetadataItemDocument,
|
"\n mutation UpdateOneObjectMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateObjectInput!\n ) {\n updateOneObject(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.UpdateOneObjectMetadataItemDocument,
|
||||||
"\n mutation DeleteOneObjectMetadataItem($idToDelete: ID!) {\n deleteOneObject(input: { id: $idToDelete }) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.DeleteOneObjectMetadataItemDocument,
|
"\n mutation DeleteOneObjectMetadataItem($idToDelete: ID!) {\n deleteOneObject(input: { id: $idToDelete }) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.DeleteOneObjectMetadataItemDocument,
|
||||||
"\n mutation DeleteOneFieldMetadataItem($idToDelete: ID!) {\n deleteOneField(input: { id: $idToDelete }) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.DeleteOneFieldMetadataItemDocument,
|
"\n mutation DeleteOneFieldMetadataItem($idToDelete: ID!) {\n deleteOneField(input: { id: $idToDelete }) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.DeleteOneFieldMetadataItemDocument,
|
||||||
"\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n toFieldMetadataId\n }\n toRelationMetadata {\n id\n relationType\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromFieldMetadataId\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n": types.ObjectMetadataItemsDocument,
|
"\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n toFieldMetadataId\n }\n toRelationMetadata {\n id\n relationType\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromFieldMetadataId\n }\n defaultValue\n options\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n": types.ObjectMetadataItemsDocument,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,7 +44,7 @@ export function graphql(source: "\n mutation CreateOneObjectMetadataItem($input
|
|||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||||
*/
|
*/
|
||||||
export function graphql(source: "\n mutation CreateOneFieldMetadataItem($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"): (typeof documents)["\n mutation CreateOneFieldMetadataItem($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"];
|
export function graphql(source: "\n mutation CreateOneFieldMetadataItem($input: CreateOneFieldMetadataInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n defaultValue\n options\n }\n }\n"): (typeof documents)["\n mutation CreateOneFieldMetadataItem($input: CreateOneFieldMetadataInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n defaultValue\n options\n }\n }\n"];
|
||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||||
*/
|
*/
|
||||||
@@ -52,7 +52,7 @@ export function graphql(source: "\n mutation CreateOneRelationMetadata($input:
|
|||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||||
*/
|
*/
|
||||||
export function graphql(source: "\n mutation UpdateOneFieldMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateFieldInput!\n ) {\n updateOneField(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"): (typeof documents)["\n mutation UpdateOneFieldMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateFieldInput!\n ) {\n updateOneField(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"];
|
export function graphql(source: "\n mutation UpdateOneFieldMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateFieldInput!\n ) {\n updateOneField(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"): (typeof documents)["\n mutation UpdateOneFieldMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateFieldInput!\n ) {\n updateOneField(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"];
|
||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||||
*/
|
*/
|
||||||
@@ -64,11 +64,11 @@ export function graphql(source: "\n mutation DeleteOneObjectMetadataItem($idToD
|
|||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||||
*/
|
*/
|
||||||
export function graphql(source: "\n mutation DeleteOneFieldMetadataItem($idToDelete: ID!) {\n deleteOneField(input: { id: $idToDelete }) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"): (typeof documents)["\n mutation DeleteOneFieldMetadataItem($idToDelete: ID!) {\n deleteOneField(input: { id: $idToDelete }) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"];
|
export function graphql(source: "\n mutation DeleteOneFieldMetadataItem($idToDelete: ID!) {\n deleteOneField(input: { id: $idToDelete }) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"): (typeof documents)["\n mutation DeleteOneFieldMetadataItem($idToDelete: ID!) {\n deleteOneField(input: { id: $idToDelete }) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"];
|
||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||||
*/
|
*/
|
||||||
export function graphql(source: "\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n toFieldMetadataId\n }\n toRelationMetadata {\n id\n relationType\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromFieldMetadataId\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"): (typeof documents)["\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n toFieldMetadataId\n }\n toRelationMetadata {\n id\n relationType\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromFieldMetadataId\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"];
|
export function graphql(source: "\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n toFieldMetadataId\n }\n toRelationMetadata {\n id\n relationType\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromFieldMetadataId\n }\n defaultValue\n options\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"): (typeof documents)["\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n toFieldMetadataId\n }\n toRelationMetadata {\n id\n relationType\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromFieldMetadataId\n }\n defaultValue\n options\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"];
|
||||||
|
|
||||||
export function graphql(source: string) {
|
export function graphql(source: string) {
|
||||||
return (documents as any)[source] ?? {};
|
return (documents as any)[source] ?? {};
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -125,6 +125,7 @@ export type FieldConnection = {
|
|||||||
export type FieldDeleteResponse = {
|
export type FieldDeleteResponse = {
|
||||||
__typename?: 'FieldDeleteResponse';
|
__typename?: 'FieldDeleteResponse';
|
||||||
createdAt?: Maybe<Scalars['DateTime']>;
|
createdAt?: Maybe<Scalars['DateTime']>;
|
||||||
|
defaultValue?: Maybe<Scalars['JSON']>;
|
||||||
description?: Maybe<Scalars['String']>;
|
description?: Maybe<Scalars['String']>;
|
||||||
icon?: Maybe<Scalars['String']>;
|
icon?: Maybe<Scalars['String']>;
|
||||||
id?: Maybe<Scalars['ID']>;
|
id?: Maybe<Scalars['ID']>;
|
||||||
@@ -134,8 +135,7 @@ export type FieldDeleteResponse = {
|
|||||||
isSystem?: Maybe<Scalars['Boolean']>;
|
isSystem?: Maybe<Scalars['Boolean']>;
|
||||||
label?: Maybe<Scalars['String']>;
|
label?: Maybe<Scalars['String']>;
|
||||||
name?: Maybe<Scalars['String']>;
|
name?: Maybe<Scalars['String']>;
|
||||||
/** @deprecated Use label name instead */
|
options?: Maybe<Scalars['JSON']>;
|
||||||
placeholder?: Maybe<Scalars['String']>;
|
|
||||||
type?: Maybe<FieldMetadataType>;
|
type?: Maybe<FieldMetadataType>;
|
||||||
updatedAt?: Maybe<Scalars['DateTime']>;
|
updatedAt?: Maybe<Scalars['DateTime']>;
|
||||||
};
|
};
|
||||||
@@ -146,14 +146,16 @@ export enum FieldMetadataType {
|
|||||||
Currency = 'CURRENCY',
|
Currency = 'CURRENCY',
|
||||||
DateTime = 'DATE_TIME',
|
DateTime = 'DATE_TIME',
|
||||||
Email = 'EMAIL',
|
Email = 'EMAIL',
|
||||||
Enum = 'ENUM',
|
|
||||||
FullName = 'FULL_NAME',
|
FullName = 'FULL_NAME',
|
||||||
Link = 'LINK',
|
Link = 'LINK',
|
||||||
|
MultiSelect = 'MULTI_SELECT',
|
||||||
Number = 'NUMBER',
|
Number = 'NUMBER',
|
||||||
Numeric = 'NUMERIC',
|
Numeric = 'NUMERIC',
|
||||||
Phone = 'PHONE',
|
Phone = 'PHONE',
|
||||||
Probability = 'PROBABILITY',
|
Probability = 'PROBABILITY',
|
||||||
|
Rating = 'RATING',
|
||||||
Relation = 'RELATION',
|
Relation = 'RELATION',
|
||||||
|
Select = 'SELECT',
|
||||||
Text = 'TEXT',
|
Text = 'TEXT',
|
||||||
Uuid = 'UUID'
|
Uuid = 'UUID'
|
||||||
}
|
}
|
||||||
@@ -191,20 +193,15 @@ export type Mutation = {
|
|||||||
__typename?: 'Mutation';
|
__typename?: 'Mutation';
|
||||||
challenge: LoginToken;
|
challenge: LoginToken;
|
||||||
createEvent: Analytics;
|
createEvent: Analytics;
|
||||||
createOneField: Field;
|
|
||||||
createOneObject: Object;
|
createOneObject: Object;
|
||||||
createOneRefreshToken: RefreshToken;
|
createOneRefreshToken: RefreshToken;
|
||||||
createOneRelation: Relation;
|
|
||||||
deleteCurrentWorkspace: Workspace;
|
deleteCurrentWorkspace: Workspace;
|
||||||
deleteOneField: FieldDeleteResponse;
|
|
||||||
deleteOneObject: ObjectDeleteResponse;
|
deleteOneObject: ObjectDeleteResponse;
|
||||||
deleteOneRelation: RelationDeleteResponse;
|
|
||||||
deleteUser: User;
|
deleteUser: User;
|
||||||
generateApiKeyToken: ApiKeyToken;
|
generateApiKeyToken: ApiKeyToken;
|
||||||
impersonate: Verify;
|
impersonate: Verify;
|
||||||
renewToken: AuthTokens;
|
renewToken: AuthTokens;
|
||||||
signUp: LoginToken;
|
signUp: LoginToken;
|
||||||
updateOneField: Field;
|
|
||||||
updateOneObject: Object;
|
updateOneObject: Object;
|
||||||
updateWorkspace: Workspace;
|
updateWorkspace: Workspace;
|
||||||
uploadFile: Scalars['String'];
|
uploadFile: Scalars['String'];
|
||||||
@@ -342,13 +339,9 @@ export type Query = {
|
|||||||
clientConfig: ClientConfig;
|
clientConfig: ClientConfig;
|
||||||
currentUser: User;
|
currentUser: User;
|
||||||
currentWorkspace: Workspace;
|
currentWorkspace: Workspace;
|
||||||
field: Field;
|
|
||||||
fields: FieldConnection;
|
|
||||||
findWorkspaceFromInviteHash: Workspace;
|
findWorkspaceFromInviteHash: Workspace;
|
||||||
object: Object;
|
object: Object;
|
||||||
objects: ObjectConnection;
|
objects: ObjectConnection;
|
||||||
relation: Relation;
|
|
||||||
relations: RelationConnection;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -531,18 +524,18 @@ export type WorkspaceInviteHashValid = {
|
|||||||
export type Field = {
|
export type Field = {
|
||||||
__typename?: 'field';
|
__typename?: 'field';
|
||||||
createdAt: Scalars['DateTime'];
|
createdAt: Scalars['DateTime'];
|
||||||
|
defaultValue?: Maybe<Scalars['JSON']>;
|
||||||
description?: Maybe<Scalars['String']>;
|
description?: Maybe<Scalars['String']>;
|
||||||
fromRelationMetadata?: Maybe<Relation>;
|
fromRelationMetadata?: Maybe<Relation>;
|
||||||
icon?: Maybe<Scalars['String']>;
|
icon?: Maybe<Scalars['String']>;
|
||||||
id: Scalars['ID'];
|
id: Scalars['ID'];
|
||||||
isActive: Scalars['Boolean'];
|
isActive?: Maybe<Scalars['Boolean']>;
|
||||||
isCustom: Scalars['Boolean'];
|
isCustom?: Maybe<Scalars['Boolean']>;
|
||||||
isNullable: Scalars['Boolean'];
|
isNullable?: Maybe<Scalars['Boolean']>;
|
||||||
isSystem: Scalars['Boolean'];
|
isSystem?: Maybe<Scalars['Boolean']>;
|
||||||
label: Scalars['String'];
|
label: Scalars['String'];
|
||||||
name: Scalars['String'];
|
name: Scalars['String'];
|
||||||
/** @deprecated Use label name instead */
|
options?: Maybe<Scalars['JSON']>;
|
||||||
placeholder?: Maybe<Scalars['String']>;
|
|
||||||
toRelationMetadata?: Maybe<Relation>;
|
toRelationMetadata?: Maybe<Relation>;
|
||||||
type: FieldMetadataType;
|
type: FieldMetadataType;
|
||||||
updatedAt: Scalars['DateTime'];
|
updatedAt: Scalars['DateTime'];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const CREATE_ONE_OBJECT_METADATA_ITEM = gql`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const CREATE_ONE_FIELD_METADATA_ITEM = gql`
|
export const CREATE_ONE_FIELD_METADATA_ITEM = gql`
|
||||||
mutation CreateOneFieldMetadataItem($input: CreateOneFieldInput!) {
|
mutation CreateOneFieldMetadataItem($input: CreateOneFieldMetadataInput!) {
|
||||||
createOneField(input: $input) {
|
createOneField(input: $input) {
|
||||||
id
|
id
|
||||||
type
|
type
|
||||||
@@ -28,12 +28,13 @@ export const CREATE_ONE_FIELD_METADATA_ITEM = gql`
|
|||||||
label
|
label
|
||||||
description
|
description
|
||||||
icon
|
icon
|
||||||
placeholder
|
|
||||||
isCustom
|
isCustom
|
||||||
isActive
|
isActive
|
||||||
isNullable
|
isNullable
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
|
defaultValue
|
||||||
|
options
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -65,7 +66,6 @@ export const UPDATE_ONE_FIELD_METADATA_ITEM = gql`
|
|||||||
label
|
label
|
||||||
description
|
description
|
||||||
icon
|
icon
|
||||||
placeholder
|
|
||||||
isCustom
|
isCustom
|
||||||
isActive
|
isActive
|
||||||
isNullable
|
isNullable
|
||||||
@@ -125,7 +125,6 @@ export const DELETE_ONE_FIELD_METADATA_ITEM = gql`
|
|||||||
label
|
label
|
||||||
description
|
description
|
||||||
icon
|
icon
|
||||||
placeholder
|
|
||||||
isCustom
|
isCustom
|
||||||
isActive
|
isActive
|
||||||
isNullable
|
isNullable
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ export const FIND_MANY_OBJECT_METADATA_ITEMS = gql`
|
|||||||
}
|
}
|
||||||
fromFieldMetadataId
|
fromFieldMetadataId
|
||||||
}
|
}
|
||||||
|
defaultValue
|
||||||
|
options
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pageInfo {
|
pageInfo {
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
import { FieldType } from '@/object-record/field/types/FieldType';
|
import { FieldType } from '@/object-record/field/types/FieldType';
|
||||||
import { Field } from '~/generated/graphql';
|
import { Field } from '~/generated/graphql';
|
||||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||||
|
|
||||||
import { FieldMetadataItem } from '../types/FieldMetadataItem';
|
import { FieldMetadataItem } from '../types/FieldMetadataItem';
|
||||||
|
import { FieldMetadataOption } from '../types/FieldMetadataOption';
|
||||||
import { formatFieldMetadataItemInput } from '../utils/formatFieldMetadataItemInput';
|
import { formatFieldMetadataItemInput } from '../utils/formatFieldMetadataItemInput';
|
||||||
|
|
||||||
import { useCreateOneFieldMetadataItem } from './useCreateOneFieldMetadataItem';
|
import { useCreateOneFieldMetadataItem } from './useCreateOneFieldMetadataItem';
|
||||||
@@ -17,6 +20,7 @@ export const useFieldMetadataItem = () => {
|
|||||||
const createMetadataField = (
|
const createMetadataField = (
|
||||||
input: Pick<Field, 'label' | 'icon' | 'description'> & {
|
input: Pick<Field, 'label' | 'icon' | 'description'> & {
|
||||||
objectMetadataId: string;
|
objectMetadataId: string;
|
||||||
|
options?: Omit<FieldMetadataOption, 'id'>[];
|
||||||
type: FieldMetadataType;
|
type: FieldMetadataType;
|
||||||
},
|
},
|
||||||
) =>
|
) =>
|
||||||
@@ -27,11 +31,20 @@ export const useFieldMetadataItem = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const editMetadataField = (
|
const editMetadataField = (
|
||||||
input: Pick<Field, 'id' | 'label' | 'icon' | 'description'>,
|
input: Pick<Field, 'id' | 'label' | 'icon' | 'description'> & {
|
||||||
|
options?: FieldMetadataOption[];
|
||||||
|
},
|
||||||
) =>
|
) =>
|
||||||
updateOneFieldMetadataItem({
|
updateOneFieldMetadataItem({
|
||||||
fieldMetadataIdToUpdate: input.id,
|
fieldMetadataIdToUpdate: input.id,
|
||||||
updatePayload: formatFieldMetadataItemInput(input),
|
updatePayload: formatFieldMetadataItemInput({
|
||||||
|
...input,
|
||||||
|
// In Edit mode, all options need an id,
|
||||||
|
// so we generate an id for newly created options.
|
||||||
|
options: input.options?.map((option) =>
|
||||||
|
option.id ? option : { ...option, id: v4() },
|
||||||
|
),
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const activateMetadataField = (metadataField: FieldMetadataItem) =>
|
const activateMetadataField = (metadataField: FieldMetadataItem) =>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import { ThemeColor } from '@/ui/theme/constants/colors';
|
||||||
import { Field, Relation } from '~/generated-metadata/graphql';
|
import { Field, Relation } from '~/generated-metadata/graphql';
|
||||||
|
|
||||||
export type FieldMetadataItem = Omit<
|
export type FieldMetadataItem = Omit<
|
||||||
Field,
|
Field,
|
||||||
'fromRelationMetadata' | 'toRelationMetadata'
|
'fromRelationMetadata' | 'toRelationMetadata' | 'defaultValue' | 'options'
|
||||||
> & {
|
> & {
|
||||||
fromRelationMetadata?:
|
fromRelationMetadata?:
|
||||||
| (Pick<Relation, 'id' | 'toFieldMetadataId' | 'relationType'> & {
|
| (Pick<Relation, 'id' | 'toFieldMetadataId' | 'relationType'> & {
|
||||||
@@ -20,4 +21,12 @@ export type FieldMetadataItem = Omit<
|
|||||||
>;
|
>;
|
||||||
})
|
})
|
||||||
| null;
|
| null;
|
||||||
|
defaultValue?: string;
|
||||||
|
options?: {
|
||||||
|
color: ThemeColor;
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
position: number;
|
||||||
|
value: string;
|
||||||
|
}[];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { ThemeColor } from '@/ui/theme/constants/colors';
|
||||||
|
|
||||||
|
export type FieldMetadataOption = {
|
||||||
|
color?: ThemeColor;
|
||||||
|
id?: string;
|
||||||
|
isDefault?: boolean;
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
@@ -1,12 +1,34 @@
|
|||||||
import toCamelCase from 'lodash.camelcase';
|
import toCamelCase from 'lodash.camelcase';
|
||||||
|
import toSnakeCase from 'lodash.snakecase';
|
||||||
|
|
||||||
import { Field } from '~/generated-metadata/graphql';
|
import { Field } from '~/generated-metadata/graphql';
|
||||||
|
|
||||||
|
import { FieldMetadataOption } from '../types/FieldMetadataOption';
|
||||||
|
|
||||||
|
const getOptionValueFromLabel = (label: string) =>
|
||||||
|
toSnakeCase(label.trim()).toUpperCase();
|
||||||
|
|
||||||
export const formatFieldMetadataItemInput = (
|
export const formatFieldMetadataItemInput = (
|
||||||
input: Pick<Field, 'label' | 'icon' | 'description'>,
|
input: Pick<Field, 'label' | 'icon' | 'description' | 'defaultValue'> & {
|
||||||
) => ({
|
options?: FieldMetadataOption[];
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const defaultOption = input.options?.find((option) => option.isDefault);
|
||||||
|
|
||||||
|
return {
|
||||||
|
defaultValue: defaultOption
|
||||||
|
? getOptionValueFromLabel(defaultOption.label)
|
||||||
|
: undefined,
|
||||||
description: input.description?.trim() ?? null,
|
description: input.description?.trim() ?? null,
|
||||||
icon: input.icon,
|
icon: input.icon,
|
||||||
label: input.label.trim(),
|
label: input.label.trim(),
|
||||||
name: toCamelCase(input.label.trim()),
|
name: toCamelCase(input.label.trim()),
|
||||||
});
|
options: input.options?.map((option, index) => ({
|
||||||
|
color: option.color,
|
||||||
|
id: option.id,
|
||||||
|
label: option.label.trim(),
|
||||||
|
position: index,
|
||||||
|
value: getOptionValueFromLabel(option.label),
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|||||||
@@ -12,11 +12,7 @@ import { isFieldRating } from '../../types/guards/isFieldRating';
|
|||||||
export const useRatingField = () => {
|
export const useRatingField = () => {
|
||||||
const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext);
|
const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext);
|
||||||
|
|
||||||
assertFieldMetadata(
|
assertFieldMetadata(FieldMetadataType.Rating, isFieldRating, fieldDefinition);
|
||||||
FieldMetadataType.Probability,
|
|
||||||
isFieldRating,
|
|
||||||
fieldDefinition,
|
|
||||||
);
|
|
||||||
|
|
||||||
const fieldName = fieldDefinition.metadata.fieldName;
|
const fieldName = fieldDefinition.metadata.fieldName;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useContext } from 'react';
|
|||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { ThemeColor } from '@/ui/theme/constants/colors';
|
import { ThemeColor } from '@/ui/theme/constants/colors';
|
||||||
|
import { FieldMetadataType } from '~/generated/graphql';
|
||||||
|
|
||||||
import { FieldContext } from '../../contexts/FieldContext';
|
import { FieldContext } from '../../contexts/FieldContext';
|
||||||
import { useFieldInitialValue } from '../../hooks/useFieldInitialValue';
|
import { useFieldInitialValue } from '../../hooks/useFieldInitialValue';
|
||||||
@@ -14,7 +15,7 @@ import { isFieldSelectValue } from '../../types/guards/isFieldSelectValue';
|
|||||||
export const useSelectField = () => {
|
export const useSelectField = () => {
|
||||||
const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext);
|
const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext);
|
||||||
|
|
||||||
assertFieldMetadata('ENUM', isFieldSelect, fieldDefinition);
|
assertFieldMetadata(FieldMetadataType.Select, isFieldSelect, fieldDefinition);
|
||||||
|
|
||||||
const { fieldName } = fieldDefinition.metadata;
|
const { fieldName } = fieldDefinition.metadata;
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const RatingFieldInputWithContext = ({
|
|||||||
fieldDefinition={{
|
fieldDefinition={{
|
||||||
fieldMetadataId: 'rating',
|
fieldMetadataId: 'rating',
|
||||||
label: 'Rating',
|
label: 'Rating',
|
||||||
type: FieldMetadataType.Probability,
|
type: FieldMetadataType.Rating,
|
||||||
iconName: 'Icon123',
|
iconName: 'Icon123',
|
||||||
metadata: {
|
metadata: {
|
||||||
fieldName: 'Rating',
|
fieldName: 'Rating',
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { selectorFamily } from 'recoil';
|
|||||||
|
|
||||||
import { isFieldFullName } from '@/object-record/field/types/guards/isFieldFullName';
|
import { isFieldFullName } from '@/object-record/field/types/guards/isFieldFullName';
|
||||||
import { isFieldFullNameValue } from '@/object-record/field/types/guards/isFieldFullNameValue';
|
import { isFieldFullNameValue } from '@/object-record/field/types/guards/isFieldFullNameValue';
|
||||||
|
import { isFieldSelect } from '@/object-record/field/types/guards/isFieldSelect';
|
||||||
import { isFieldUuid } from '@/object-record/field/types/guards/isFieldUuid';
|
import { isFieldUuid } from '@/object-record/field/types/guards/isFieldUuid';
|
||||||
import { assertNotNull } from '~/utils/assert';
|
import { assertNotNull } from '~/utils/assert';
|
||||||
|
|
||||||
@@ -42,7 +43,8 @@ export const isEntityFieldEmptyFamilySelector = selectorFamily({
|
|||||||
isFieldNumber(fieldDefinition) ||
|
isFieldNumber(fieldDefinition) ||
|
||||||
isFieldRating(fieldDefinition) ||
|
isFieldRating(fieldDefinition) ||
|
||||||
isFieldEmail(fieldDefinition) ||
|
isFieldEmail(fieldDefinition) ||
|
||||||
isFieldBoolean(fieldDefinition)
|
isFieldBoolean(fieldDefinition) ||
|
||||||
|
isFieldSelect(fieldDefinition)
|
||||||
//|| isFieldPhone(fieldDefinition)
|
//|| isFieldPhone(fieldDefinition)
|
||||||
) {
|
) {
|
||||||
const fieldValue = get(entityFieldsFamilyState(entityId))?.[
|
const fieldValue = get(entityFieldsFamilyState(entityId))?.[
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
export type FieldType =
|
export type FieldType =
|
||||||
| 'BOOLEAN'
|
| 'BOOLEAN'
|
||||||
| 'UUID'
|
|
||||||
| 'TEXT'
|
|
||||||
| 'RELATION'
|
|
||||||
| 'CHIP'
|
| 'CHIP'
|
||||||
|
| 'CURRENCY'
|
||||||
| 'DATE_TIME'
|
| 'DATE_TIME'
|
||||||
| 'DOUBLE_TEXT_CHIP'
|
| 'DOUBLE_TEXT_CHIP'
|
||||||
| 'DOUBLE_TEXT'
|
| 'DOUBLE_TEXT'
|
||||||
| 'EMAIL'
|
| 'EMAIL'
|
||||||
| 'ENUM'
|
| 'FULL_NAME'
|
||||||
|
| 'LINK'
|
||||||
| 'NUMBER'
|
| 'NUMBER'
|
||||||
| 'PHONE'
|
| 'PHONE'
|
||||||
| 'PROBABILITY'
|
| 'RATING'
|
||||||
|
| 'RELATION'
|
||||||
|
| 'SELECT'
|
||||||
|
| 'TEXT'
|
||||||
| 'URL'
|
| 'URL'
|
||||||
| 'LINK'
|
| 'UUID';
|
||||||
| 'CURRENCY'
|
|
||||||
| 'FULL_NAME';
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ type AssertFieldMetadataFunction = <
|
|||||||
? FieldDateTimeMetadata
|
? FieldDateTimeMetadata
|
||||||
: E extends 'EMAIL'
|
: E extends 'EMAIL'
|
||||||
? FieldEmailMetadata
|
? FieldEmailMetadata
|
||||||
: E extends 'ENUM'
|
: E extends 'SELECT'
|
||||||
? FieldSelectMetadata
|
? FieldSelectMetadata
|
||||||
: E extends 'LINK'
|
: E extends 'LINK'
|
||||||
? FieldLinkMetadata
|
? FieldLinkMetadata
|
||||||
@@ -37,7 +37,7 @@ type AssertFieldMetadataFunction = <
|
|||||||
? FieldNumberMetadata
|
? FieldNumberMetadata
|
||||||
: E extends 'PHONE'
|
: E extends 'PHONE'
|
||||||
? FieldPhoneMetadata
|
? FieldPhoneMetadata
|
||||||
: E extends 'PROBABILITY'
|
: E extends 'RATING'
|
||||||
? FieldRatingMetadata
|
? FieldRatingMetadata
|
||||||
: E extends 'RELATION'
|
: E extends 'RELATION'
|
||||||
? FieldRelationMetadata
|
? FieldRelationMetadata
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ import { FieldMetadata, FieldRatingMetadata } from '../FieldMetadata';
|
|||||||
export const isFieldRating = (
|
export const isFieldRating = (
|
||||||
field: Pick<FieldDefinition<FieldMetadata>, 'type'>,
|
field: Pick<FieldDefinition<FieldMetadata>, 'type'>,
|
||||||
): field is FieldDefinition<FieldRatingMetadata> =>
|
): field is FieldDefinition<FieldRatingMetadata> =>
|
||||||
field.type === FieldMetadataType.Probability;
|
field.type === FieldMetadataType.Rating;
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
import { FieldMetadataType } from '~/generated/graphql';
|
||||||
|
|
||||||
import { FieldDefinition } from '../FieldDefinition';
|
import { FieldDefinition } from '../FieldDefinition';
|
||||||
import { FieldMetadata, FieldSelectMetadata } from '../FieldMetadata';
|
import { FieldMetadata, FieldSelectMetadata } from '../FieldMetadata';
|
||||||
|
|
||||||
export const isFieldSelect = (
|
export const isFieldSelect = (
|
||||||
field: FieldDefinition<FieldMetadata>,
|
field: Pick<FieldDefinition<FieldMetadata>, 'type'>,
|
||||||
): field is FieldDefinition<FieldSelectMetadata> => field.type === 'ENUM';
|
): field is FieldDefinition<FieldSelectMetadata> =>
|
||||||
|
field.type === FieldMetadataType.Select;
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export const SettingsObjectFieldPreview = ({
|
|||||||
>
|
>
|
||||||
{fieldMetadata.type === FieldMetadataType.Boolean ? (
|
{fieldMetadata.type === FieldMetadataType.Boolean ? (
|
||||||
<BooleanFieldInput readonly />
|
<BooleanFieldInput readonly />
|
||||||
) : fieldMetadata.type === FieldMetadataType.Probability ? (
|
) : fieldMetadata.type === FieldMetadataType.Rating ? (
|
||||||
<RatingFieldInput readonly />
|
<RatingFieldInput readonly />
|
||||||
) : (
|
) : (
|
||||||
<FieldDisplay />
|
<FieldDisplay />
|
||||||
|
|||||||
@@ -88,10 +88,10 @@ export const SettingsObjectFieldTypeSelectSection = ({
|
|||||||
FieldMetadataType.Boolean,
|
FieldMetadataType.Boolean,
|
||||||
FieldMetadataType.Currency,
|
FieldMetadataType.Currency,
|
||||||
FieldMetadataType.DateTime,
|
FieldMetadataType.DateTime,
|
||||||
FieldMetadataType.Enum,
|
FieldMetadataType.Select,
|
||||||
FieldMetadataType.Link,
|
FieldMetadataType.Link,
|
||||||
FieldMetadataType.Number,
|
FieldMetadataType.Number,
|
||||||
FieldMetadataType.Probability,
|
FieldMetadataType.Rating,
|
||||||
FieldMetadataType.Relation,
|
FieldMetadataType.Relation,
|
||||||
FieldMetadataType.Text,
|
FieldMetadataType.Text,
|
||||||
].includes(values.type) && (
|
].includes(values.type) && (
|
||||||
@@ -151,7 +151,7 @@ export const SettingsObjectFieldTypeSelectSection = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
) : values.type === FieldMetadataType.Enum ? (
|
) : values.type === FieldMetadataType.Select ? (
|
||||||
<SettingsObjectFieldSelectForm
|
<SettingsObjectFieldSelectForm
|
||||||
values={selectFormConfig}
|
values={selectFormConfig}
|
||||||
onChange={(nextValues) => onChange({ select: nextValues })}
|
onChange={(nextValues) => onChange({ select: nextValues })}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export const Rating: Story = {
|
|||||||
fieldMetadata: {
|
fieldMetadata: {
|
||||||
icon: 'IconHandClick',
|
icon: 'IconHandClick',
|
||||||
label: 'Engagement',
|
label: 'Engagement',
|
||||||
type: FieldMetadataType.Probability,
|
type: FieldMetadataType.Rating,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export const WithSelectForm: Story = {
|
|||||||
fieldMetadata: { label: 'Industry', icon: 'IconBuildingFactory2' },
|
fieldMetadata: { label: 'Industry', icon: 'IconBuildingFactory2' },
|
||||||
values: {
|
values: {
|
||||||
...fieldMetadataFormDefaultValues,
|
...fieldMetadataFormDefaultValues,
|
||||||
type: FieldMetadataType.Enum,
|
type: FieldMetadataType.Select,
|
||||||
select: [
|
select: [
|
||||||
{
|
{
|
||||||
color: 'pink',
|
color: 'pink',
|
||||||
|
|||||||
@@ -59,10 +59,14 @@ export const settingsFieldMetadataTypes: Record<
|
|||||||
Icon: IconCalendarEvent,
|
Icon: IconCalendarEvent,
|
||||||
defaultValue: defaultDateValue.toISOString(),
|
defaultValue: defaultDateValue.toISOString(),
|
||||||
},
|
},
|
||||||
[FieldMetadataType.Enum]: {
|
[FieldMetadataType.Select]: {
|
||||||
label: 'Select',
|
label: 'Select',
|
||||||
Icon: IconTag,
|
Icon: IconTag,
|
||||||
},
|
},
|
||||||
|
[FieldMetadataType.MultiSelect]: {
|
||||||
|
label: 'Multi-Select',
|
||||||
|
Icon: IconTag,
|
||||||
|
},
|
||||||
[FieldMetadataType.Currency]: {
|
[FieldMetadataType.Currency]: {
|
||||||
label: 'Currency',
|
label: 'Currency',
|
||||||
Icon: IconCoins,
|
Icon: IconCoins,
|
||||||
@@ -79,5 +83,10 @@ export const settingsFieldMetadataTypes: Record<
|
|||||||
Icon: IconTwentyStar,
|
Icon: IconTwentyStar,
|
||||||
defaultValue: '3',
|
defaultValue: '3',
|
||||||
},
|
},
|
||||||
|
[FieldMetadataType.Rating]: {
|
||||||
|
label: 'Rating',
|
||||||
|
Icon: IconTwentyStar,
|
||||||
|
defaultValue: '3',
|
||||||
|
},
|
||||||
[FieldMetadataType.FullName]: { label: 'Full Name', Icon: IconUser },
|
[FieldMetadataType.FullName]: { label: 'Full Name', Icon: IconUser },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,11 +56,12 @@ const relationSchema = fieldSchema.merge(
|
|||||||
|
|
||||||
const selectSchema = fieldSchema.merge(
|
const selectSchema = fieldSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
type: z.literal(FieldMetadataType.Enum),
|
type: z.literal(FieldMetadataType.Select),
|
||||||
select: z
|
select: z
|
||||||
.array(
|
.array(
|
||||||
z.object({
|
z.object({
|
||||||
color: themeColorSchema,
|
color: themeColorSchema,
|
||||||
|
id: z.string().optional(),
|
||||||
isDefault: z.boolean().optional(),
|
isDefault: z.boolean().optional(),
|
||||||
label: z.string().min(1),
|
label: z.string().min(1),
|
||||||
}),
|
}),
|
||||||
@@ -70,18 +71,20 @@ const selectSchema = fieldSchema.merge(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Enum: _Enum,
|
Select: _Select,
|
||||||
Relation: _Relation,
|
Relation: _Relation,
|
||||||
...otherFieldTypes
|
...otherFieldTypes
|
||||||
} = FieldMetadataType;
|
} = FieldMetadataType;
|
||||||
|
|
||||||
|
type OtherFieldType = Exclude<
|
||||||
|
FieldMetadataType,
|
||||||
|
FieldMetadataType.Relation | FieldMetadataType.Select
|
||||||
|
>;
|
||||||
|
|
||||||
const otherFieldTypesSchema = fieldSchema.merge(
|
const otherFieldTypesSchema = fieldSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
type: z.enum(
|
type: z.enum(
|
||||||
Object.values(otherFieldTypes) as [
|
Object.values(otherFieldTypes) as [OtherFieldType, ...OtherFieldType[]],
|
||||||
Exclude<FieldMetadataType, FieldMetadataType.Relation>,
|
|
||||||
...Exclude<FieldMetadataType, FieldMetadataType.Relation>[],
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -165,7 +168,7 @@ export const useFieldMetadataForm = () => {
|
|||||||
!isDeeplyEqual(initialRelationFormValues, nextRelationFormValues),
|
!isDeeplyEqual(initialRelationFormValues, nextRelationFormValues),
|
||||||
);
|
);
|
||||||
setHasSelectFormChanged(
|
setHasSelectFormChanged(
|
||||||
nextFieldFormValues.type === FieldMetadataType.Enum &&
|
nextFieldFormValues.type === FieldMetadataType.Select &&
|
||||||
!isDeeplyEqual(initialSelectFormValues, nextSelectFormValues),
|
!isDeeplyEqual(initialSelectFormValues, nextSelectFormValues),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -177,6 +180,7 @@ export const useFieldMetadataForm = () => {
|
|||||||
hasFormChanged:
|
hasFormChanged:
|
||||||
hasFieldFormChanged || hasRelationFormChanged || hasSelectFormChanged,
|
hasFieldFormChanged || hasRelationFormChanged || hasSelectFormChanged,
|
||||||
hasRelationFormChanged,
|
hasRelationFormChanged,
|
||||||
|
hasSelectFormChanged,
|
||||||
initForm,
|
initForm,
|
||||||
isInitialized,
|
isInitialized,
|
||||||
isValid: validationResult.success,
|
isValid: validationResult.success,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export const useFieldPreview = ({
|
|||||||
|
|
||||||
const defaultSelectValue = selectOptions?.[0];
|
const defaultSelectValue = selectOptions?.[0];
|
||||||
const selectValue =
|
const selectValue =
|
||||||
fieldMetadata.type === FieldMetadataType.Enum &&
|
fieldMetadata.type === FieldMetadataType.Select &&
|
||||||
typeof firstRecordFieldValue === 'string'
|
typeof firstRecordFieldValue === 'string'
|
||||||
? selectOptions?.find(
|
? selectOptions?.find(
|
||||||
(selectOption) => selectOption.value === firstRecordFieldValue,
|
(selectOption) => selectOption.value === firstRecordFieldValue,
|
||||||
@@ -65,7 +65,7 @@ export const useFieldPreview = ({
|
|||||||
value:
|
value:
|
||||||
fieldMetadata.type === FieldMetadataType.Relation
|
fieldMetadata.type === FieldMetadataType.Relation
|
||||||
? relationValue
|
? relationValue
|
||||||
: fieldMetadata.type === FieldMetadataType.Enum
|
: fieldMetadata.type === FieldMetadataType.Select
|
||||||
? selectValue || defaultSelectValue
|
? selectValue || defaultSelectValue
|
||||||
: firstRecordFieldValue || defaultValue,
|
: firstRecordFieldValue || defaultValue,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ export const SettingsObjectDetail = () => {
|
|||||||
fieldMetadataItem={activeMetadataField}
|
fieldMetadataItem={activeMetadataField}
|
||||||
ActionIcon={
|
ActionIcon={
|
||||||
<SettingsObjectFieldActiveActionDropdown
|
<SettingsObjectFieldActiveActionDropdown
|
||||||
isCustomField={activeMetadataField.isCustom}
|
isCustomField={!!activeMetadataField.isCustom}
|
||||||
scopeKey={activeMetadataField.id}
|
scopeKey={activeMetadataField.id}
|
||||||
onEdit={() =>
|
onEdit={() =>
|
||||||
navigate(`./${getFieldSlug(activeMetadataField)}`)
|
navigate(`./${getFieldSlug(activeMetadataField)}`)
|
||||||
@@ -119,7 +119,7 @@ export const SettingsObjectDetail = () => {
|
|||||||
fieldMetadataItem={disabledMetadataField}
|
fieldMetadataItem={disabledMetadataField}
|
||||||
ActionIcon={
|
ActionIcon={
|
||||||
<SettingsObjectFieldDisabledActionDropdown
|
<SettingsObjectFieldDisabledActionDropdown
|
||||||
isCustomField={disabledMetadataField.isCustom}
|
isCustomField={!!disabledMetadataField.isCustom}
|
||||||
scopeKey={disabledMetadataField.id}
|
scopeKey={disabledMetadataField.id}
|
||||||
onActivate={() =>
|
onActivate={() =>
|
||||||
activateMetadataField(disabledMetadataField)
|
activateMetadataField(disabledMetadataField)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export const SettingsObjectFieldEdit = () => {
|
|||||||
hasFieldFormChanged,
|
hasFieldFormChanged,
|
||||||
hasFormChanged,
|
hasFormChanged,
|
||||||
hasRelationFormChanged,
|
hasRelationFormChanged,
|
||||||
|
hasSelectFormChanged,
|
||||||
initForm,
|
initForm,
|
||||||
isInitialized,
|
isInitialized,
|
||||||
isValid,
|
isValid,
|
||||||
@@ -65,6 +66,14 @@ export const SettingsObjectFieldEdit = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectOptions = activeMetadataField.options?.map((option) => ({
|
||||||
|
...option,
|
||||||
|
isDefault: activeMetadataField.defaultValue === option.value,
|
||||||
|
}));
|
||||||
|
selectOptions?.sort(
|
||||||
|
(optionA, optionB) => optionA.position - optionB.position,
|
||||||
|
);
|
||||||
|
|
||||||
initForm({
|
initForm({
|
||||||
icon: activeMetadataField.icon ?? undefined,
|
icon: activeMetadataField.icon ?? undefined,
|
||||||
label: activeMetadataField.label,
|
label: activeMetadataField.label,
|
||||||
@@ -78,6 +87,7 @@ export const SettingsObjectFieldEdit = () => {
|
|||||||
objectMetadataId: relationObjectMetadataItem?.id || '',
|
objectMetadataId: relationObjectMetadataItem?.id || '',
|
||||||
type: relationType || RelationMetadataType.OneToMany,
|
type: relationType || RelationMetadataType.OneToMany,
|
||||||
},
|
},
|
||||||
|
...(selectOptions?.length ? { select: selectOptions } : {}),
|
||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
activeMetadataField,
|
activeMetadataField,
|
||||||
@@ -111,12 +121,16 @@ export const SettingsObjectFieldEdit = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasFieldFormChanged) {
|
if (hasFieldFormChanged || hasSelectFormChanged) {
|
||||||
await editMetadataField({
|
await editMetadataField({
|
||||||
description: validatedFormValues.description,
|
description: validatedFormValues.description,
|
||||||
icon: validatedFormValues.icon,
|
icon: validatedFormValues.icon,
|
||||||
id: activeMetadataField.id,
|
id: activeMetadataField.id,
|
||||||
label: validatedFormValues.label,
|
label: validatedFormValues.label,
|
||||||
|
options:
|
||||||
|
validatedFormValues.type === FieldMetadataType.Select
|
||||||
|
? validatedFormValues.select
|
||||||
|
: undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,10 @@ export const SettingsObjectNewFieldStep2 = () => {
|
|||||||
label: validatedFormValues.label,
|
label: validatedFormValues.label,
|
||||||
objectMetadataId: activeObjectMetadataItem.id,
|
objectMetadataId: activeObjectMetadataItem.id,
|
||||||
type: validatedFormValues.type,
|
type: validatedFormValues.type,
|
||||||
|
options:
|
||||||
|
validatedFormValues.type === FieldMetadataType.Select
|
||||||
|
? validatedFormValues.select
|
||||||
|
: undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,12 +189,14 @@ export const SettingsObjectNewFieldStep2 = () => {
|
|||||||
const excludedFieldTypes = [
|
const excludedFieldTypes = [
|
||||||
FieldMetadataType.Currency,
|
FieldMetadataType.Currency,
|
||||||
FieldMetadataType.Email,
|
FieldMetadataType.Email,
|
||||||
FieldMetadataType.Enum,
|
|
||||||
FieldMetadataType.Numeric,
|
|
||||||
FieldMetadataType.FullName,
|
FieldMetadataType.FullName,
|
||||||
FieldMetadataType.Link,
|
FieldMetadataType.Link,
|
||||||
|
FieldMetadataType.MultiSelect,
|
||||||
|
FieldMetadataType.Numeric,
|
||||||
FieldMetadataType.Phone,
|
FieldMetadataType.Phone,
|
||||||
FieldMetadataType.Probability,
|
FieldMetadataType.Probability,
|
||||||
|
FieldMetadataType.Rating,
|
||||||
|
FieldMetadataType.Select,
|
||||||
FieldMetadataType.Uuid,
|
FieldMetadataType.Uuid,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -5654,6 +5654,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/lodash" "*"
|
"@types/lodash" "*"
|
||||||
|
|
||||||
|
"@types/lodash.snakecase@^4.1.9":
|
||||||
|
version "4.1.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/lodash.snakecase/-/lodash.snakecase-4.1.9.tgz#2d2b3313a44500cb6d8a1c598e0353778d4420d2"
|
||||||
|
integrity sha512-emBZJUiNlo+QPXr1junMKXwzHJK9zbFvTVdyAoorFcm1YRsbzkZCYPTVMM9AW+dlnA6utG7vpfvOs8alxv/TMw==
|
||||||
|
dependencies:
|
||||||
|
"@types/lodash" "*"
|
||||||
|
|
||||||
"@types/lodash@*", "@types/lodash@^4.14.167":
|
"@types/lodash@*", "@types/lodash@^4.14.167":
|
||||||
version "4.14.202"
|
version "4.14.202"
|
||||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8"
|
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8"
|
||||||
@@ -13725,6 +13732,11 @@ lodash.mergewith@4.6.2:
|
|||||||
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55"
|
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55"
|
||||||
integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==
|
integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==
|
||||||
|
|
||||||
|
lodash.snakecase@^4.1.1:
|
||||||
|
version "4.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d"
|
||||||
|
integrity sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==
|
||||||
|
|
||||||
lodash.sortby@^4.7.0:
|
lodash.sortby@^4.7.0:
|
||||||
version "4.7.0"
|
version "4.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
|
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
|
||||||
|
|||||||
Reference in New Issue
Block a user