Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rich text editor support with example #1594

Merged
merged 18 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/mysql-end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ jobs:

- name: Start and Test Chinook instance
working-directory: src/packages/end-to-end
timeout-minutes: 2
timeout-minutes: 7
run: |
pnpm start-server &
sleep 3 &&
sleep 5 &&
pnpm test-mysql &&
killall node
4 changes: 2 additions & 2 deletions .github/workflows/postgres-end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ jobs:

- name: Start and Test GW instance
working-directory: src/packages/end-to-end
timeout-minutes: 4
timeout-minutes: 7
run: |
pnpm start-server &
sleep 3 &&
sleep 5 &&
pnpm test-postgres &&
pnpm test-ui-postgres &&
killall node
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sqlite-end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ jobs:

- name: Start and Test GW instance
working-directory: src/packages/end-to-end
timeout-minutes: 4
timeout-minutes: 7
run: |
pnpm start-server &
sleep 3 &&
sleep 5 &&
pnpm test-sqlite &&
pnpm test-ui-sqlite &&
killall node
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ jobs:

- name: Start and Test GW instance
working-directory: src/packages/end-to-end
timeout-minutes: 6
timeout-minutes: 7
run: |
pnpm start-server &
sleep 3 &&
sleep 5 &&
pnpm test-sqlite &&
pnpm test-ui-sqlite &&
taskkill /F /IM node.exe /T
Expand Down
12 changes: 12 additions & 0 deletions src/examples/auth-zero/src/frontend/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export type AdminUiFieldExtensionsMetadata = {
export type AdminUiFieldMetadata = {
__typename?: 'AdminUiFieldMetadata';
attributes?: Maybe<AdminUiFieldAttributeMetadata>;
detailPanelInputComponent?: Maybe<DetailPanelInputComponent>;
extensions?: Maybe<AdminUiFieldExtensionsMetadata>;
filter?: Maybe<AdminUiFilterMetadata>;
hideInDetailForm?: Maybe<Scalars['Boolean']['output']>;
Expand Down Expand Up @@ -658,6 +659,17 @@ export type DeleteOneFilterInput = {
id: Scalars['ID']['input'];
};

export type DetailPanelInputComponent = {
__typename?: 'DetailPanelInputComponent';
name: DetailPanelInputComponentOption;
options?: Maybe<Scalars['JSON']['output']>;
};

export enum DetailPanelInputComponentOption {
RichText = 'RICH_TEXT',
Text = 'TEXT'
}

export type Employee = {
__typename?: 'Employee';
address?: Maybe<Scalars['String']['output']>;
Expand Down
12 changes: 12 additions & 0 deletions src/examples/auth-zero/src/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export type AdminUiFieldExtensionsMetadata = {
export type AdminUiFieldMetadata = {
__typename?: 'AdminUiFieldMetadata';
attributes?: Maybe<AdminUiFieldAttributeMetadata>;
detailPanelInputComponent?: Maybe<DetailPanelInputComponent>;
extensions?: Maybe<AdminUiFieldExtensionsMetadata>;
filter?: Maybe<AdminUiFilterMetadata>;
hideInDetailForm?: Maybe<Scalars['Boolean']['output']>;
Expand Down Expand Up @@ -658,6 +659,17 @@ export type DeleteOneFilterInput = {
id: Scalars['ID']['input'];
};

export type DetailPanelInputComponent = {
__typename?: 'DetailPanelInputComponent';
name: DetailPanelInputComponentOption;
options?: Maybe<Scalars['JSON']['output']>;
};

export enum DetailPanelInputComponentOption {
RichText = 'RICH_TEXT',
Text = 'TEXT'
}

export type Employee = {
__typename?: 'Employee';
address?: Maybe<Scalars['String']['output']>;
Expand Down
12 changes: 12 additions & 0 deletions src/examples/aws-cognito/src/frontend/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export type AdminUiFieldExtensionsMetadata = {
export type AdminUiFieldMetadata = {
__typename?: 'AdminUiFieldMetadata';
attributes?: Maybe<AdminUiFieldAttributeMetadata>;
detailPanelInputComponent?: Maybe<DetailPanelInputComponent>;
extensions?: Maybe<AdminUiFieldExtensionsMetadata>;
filter?: Maybe<AdminUiFilterMetadata>;
hideInDetailForm?: Maybe<Scalars['Boolean']['output']>;
Expand Down Expand Up @@ -259,6 +260,17 @@ export type DeleteOneFilterInput = {
id: Scalars['ID']['input'];
};

export type DetailPanelInputComponent = {
__typename?: 'DetailPanelInputComponent';
name: DetailPanelInputComponentOption;
options?: Maybe<Scalars['JSON']['output']>;
};

export enum DetailPanelInputComponentOption {
RichText = 'RICH_TEXT',
Text = 'TEXT'
}

export type Mutation = {
__typename?: 'Mutation';
/** Create a single CognitoUser. */
Expand Down
12 changes: 12 additions & 0 deletions src/examples/aws-cognito/src/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export type AdminUiFieldExtensionsMetadata = {
export type AdminUiFieldMetadata = {
__typename?: 'AdminUiFieldMetadata';
attributes?: Maybe<AdminUiFieldAttributeMetadata>;
detailPanelInputComponent?: Maybe<DetailPanelInputComponent>;
extensions?: Maybe<AdminUiFieldExtensionsMetadata>;
filter?: Maybe<AdminUiFilterMetadata>;
hideInDetailForm?: Maybe<Scalars['Boolean']['output']>;
Expand Down Expand Up @@ -259,6 +260,17 @@ export type DeleteOneFilterInput = {
id: Scalars['ID']['input'];
};

export type DetailPanelInputComponent = {
__typename?: 'DetailPanelInputComponent';
name: DetailPanelInputComponentOption;
options?: Maybe<Scalars['JSON']['output']>;
};

export enum DetailPanelInputComponentOption {
RichText = 'RICH_TEXT',
Text = 'TEXT'
}

export type Mutation = {
__typename?: 'Mutation';
/** Create a single CognitoUser. */
Expand Down
3 changes: 2 additions & 1 deletion src/examples/databases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ CREATE TABLE "user" (
username VARCHAR(50) NOT NULL,
email VARCHAR(100) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
status TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'suspended', 'blocked'))
status TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'suspended', 'blocked')),
notes TEXT
);

-- Seed data for user table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ export class User {
default: 'active',
})
status?: UserStatus = UserStatus.ACTIVE;

@Property({ type: String, nullable: true })
notes!: string;
}
23 changes: 22 additions & 1 deletion src/examples/databases/src/backend/schema/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Field, ID, Entity, graphweaverMetadata } from '@exogee/graphweaver';
import {
Field,
ID,
Entity,
graphweaverMetadata,
DetailPanelInputComponentOption,
} from '@exogee/graphweaver';
import { MikroBackendProvider } from '@exogee/graphweaver-mikroorm';

import { User as OrmUser, UserStatus } from '../entities';
Expand Down Expand Up @@ -26,4 +32,19 @@ export class User {

@Field(() => UserStatus, { defaultValue: UserStatus.ACTIVE })
status!: UserStatus;

@Field(() => String, {
nullable: true,
description: 'Formatted text using rich text (saved as HTML)',
adminUIOptions: {
detailPanelInputComponent: {
name: DetailPanelInputComponentOption.RICH_TEXT,
options: {
h5: { hide: true },
h6: { hide: true },
},
},
},
})
notes?: string;
}
31 changes: 31 additions & 0 deletions src/examples/databases/src/frontend/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type AdminUiEntityMetadata = {
primaryKeyField: Scalars['String']['output'];
summaryField?: Maybe<Scalars['String']['output']>;
supportedAggregationTypes: Array<AggregationType>;
supportsPseudoCursorPagination: Scalars['Boolean']['output'];
};

export type AdminUiEnumMetadata = {
Expand Down Expand Up @@ -75,6 +76,7 @@ export type AdminUiFieldExtensionsMetadata = {
export type AdminUiFieldMetadata = {
__typename?: 'AdminUiFieldMetadata';
attributes?: Maybe<AdminUiFieldAttributeMetadata>;
detailPanelInputComponent?: Maybe<DetailPanelInputComponent>;
extensions?: Maybe<AdminUiFieldExtensionsMetadata>;
filter?: Maybe<AdminUiFilterMetadata>;
hideInDetailForm?: Maybe<Scalars['Boolean']['output']>;
Expand All @@ -95,6 +97,7 @@ export type AdminUiFilterMetadata = {
export enum AdminUiFilterType {
Boolean = 'BOOLEAN',
DateRange = 'DATE_RANGE',
DropDownText = 'DROP_DOWN_TEXT',
Enum = 'ENUM',
Numeric = 'NUMERIC',
Relationship = 'RELATIONSHIP',
Expand All @@ -120,6 +123,17 @@ export type DeleteOneFilterInput = {
id: Scalars['ID']['input'];
};

export type DetailPanelInputComponent = {
__typename?: 'DetailPanelInputComponent';
name: DetailPanelInputComponentOption;
options?: Maybe<Scalars['JSON']['output']>;
};

export enum DetailPanelInputComponentOption {
RichText = 'RICH_TEXT',
Text = 'TEXT'
}

export type Mutation = {
__typename?: 'Mutation';
/** Create or update many Tasks. */
Expand Down Expand Up @@ -426,6 +440,7 @@ export type User = {
__typename?: 'User';
email: Scalars['String']['output'];
id: Scalars['ID']['output'];
notes?: Maybe<Scalars['String']['output']>;
status: UserStatus;
username: Scalars['String']['output'];
};
Expand All @@ -434,13 +449,15 @@ export type User = {
export type UserCreateOrUpdateInput = {
email?: InputMaybe<Scalars['String']['input']>;
id?: InputMaybe<Scalars['ID']['input']>;
notes?: InputMaybe<Scalars['String']['input']>;
status?: InputMaybe<UserStatus>;
username?: InputMaybe<Scalars['String']['input']>;
};

/** Data needed to create Users. */
export type UserInsertInput = {
email: Scalars['String']['input'];
notes?: InputMaybe<Scalars['String']['input']>;
status?: InputMaybe<UserStatus>;
username: Scalars['String']['input'];
};
Expand All @@ -455,6 +472,7 @@ export enum UserStatus {
export type UserUpdateInput = {
email?: InputMaybe<Scalars['String']['input']>;
id: Scalars['ID']['input'];
notes?: InputMaybe<Scalars['String']['input']>;
status?: InputMaybe<UserStatus>;
username?: InputMaybe<Scalars['String']['input']>;
};
Expand Down Expand Up @@ -484,6 +502,18 @@ export type UsersListFilter = {
id_nin?: InputMaybe<Array<Scalars['ID']['input']>>;
id_notnull?: InputMaybe<Scalars['Boolean']['input']>;
id_null?: InputMaybe<Scalars['Boolean']['input']>;
notes?: InputMaybe<Scalars['String']['input']>;
notes_gt?: InputMaybe<Scalars['String']['input']>;
notes_gte?: InputMaybe<Scalars['String']['input']>;
notes_ilike?: InputMaybe<Scalars['String']['input']>;
notes_in?: InputMaybe<Array<Scalars['String']['input']>>;
notes_like?: InputMaybe<Scalars['String']['input']>;
notes_lt?: InputMaybe<Scalars['String']['input']>;
notes_lte?: InputMaybe<Scalars['String']['input']>;
notes_ne?: InputMaybe<Scalars['String']['input']>;
notes_nin?: InputMaybe<Array<Scalars['String']['input']>>;
notes_notnull?: InputMaybe<Scalars['Boolean']['input']>;
notes_null?: InputMaybe<Scalars['Boolean']['input']>;
status?: InputMaybe<UserStatus>;
status_in?: InputMaybe<Array<UserStatus>>;
status_nin?: InputMaybe<Array<UserStatus>>;
Expand All @@ -504,6 +534,7 @@ export type UsersListFilter = {
export type UsersOrderByInput = {
email?: InputMaybe<Sort>;
id?: InputMaybe<Sort>;
notes?: InputMaybe<Sort>;
status?: InputMaybe<Sort>;
username?: InputMaybe<Sort>;
};
Expand Down
Loading
Loading