Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

fix: correctly types width fields #41

Merged
merged 1 commit into from
May 15, 2023
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
205 changes: 205 additions & 0 deletions demo/src/payload-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
/* tslint:disable */
/**
* This file was automatically generated by Payload CMS.
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
* and re-run `payload generate:types` to regenerate this file.
*/

export interface Config {
collections: {
users: User;
pages: Page;
forms: Form;
'form-submissions': FormSubmission;
};
globals: {};
}
export interface User {
id: string;
updatedAt: string;
createdAt: string;
email?: string;
resetPasswordToken?: string;
resetPasswordExpiration?: string;
loginAttempts?: number;
lockUntil?: string;
password?: string;
}
export interface Page {
id: string;
title: string;
form?: string | Form;
updatedAt: string;
createdAt: string;
}
export interface Form {
id: string;
title: string;
fields?: (
| {
name: string;
label?: string;
width?: number;
defaultValue?: string;
required?: boolean;
id?: string;
blockName?: string;
blockType: 'text';
}
| {
name: string;
label?: string;
width?: number;
defaultValue?: string;
required?: boolean;
id?: string;
blockName?: string;
blockType: 'textarea';
}
| {
name: string;
label?: string;
width?: number;
defaultValue?: string;
options: {
label: string;
value: string;
id?: string;
}[];
required?: boolean;
id?: string;
blockName?: string;
blockType: 'select';
}
| {
name: string;
label?: string;
width?: number;
required?: boolean;
id?: string;
blockName?: string;
blockType: 'email';
}
| {
name: string;
label?: string;
width?: number;
required?: boolean;
id?: string;
blockName?: string;
blockType: 'state';
}
| {
name: string;
label?: string;
width?: number;
required?: boolean;
id?: string;
blockName?: string;
blockType: 'country';
}
| {
name: string;
label?: string;
width?: number;
defaultValue?: number;
required?: boolean;
id?: string;
blockName?: string;
blockType: 'number';
}
| {
name: string;
label?: string;
width?: number;
required?: boolean;
defaultValue?: boolean;
id?: string;
blockName?: string;
blockType: 'checkbox';
}
| {
message?: {
[k: string]: unknown;
}[];
id?: string;
blockName?: string;
blockType: 'message';
}
| {
name: string;
label?: string;
width?: number;
basePrice?: number;
priceConditions?: {
fieldToUse?: string;
condition?: 'hasValue' | 'equals' | 'notEquals';
valueForCondition?: string;
operator?: 'add' | 'subtract' | 'multiply' | 'divide';
valueType?: 'static' | 'valueOfField';
valueForOperator?: string;
id?: string;
}[];
required?: boolean;
id?: string;
blockName?: string;
blockType: 'payment';
}
| {
value?: string;
id?: string;
blockName?: string;
blockType: 'color';
}
)[];
submitButtonLabel?: string;
confirmationType?: 'message' | 'redirect';
confirmationMessage: {
[k: string]: unknown;
}[];
redirect?: {
type?: 'reference' | 'custom';
reference: {
value: string | Page;
relationTo: 'pages';
};
url: string;
};
emails: {
emailTo?: string;
cc?: string;
bcc?: string;
replyTo?: string;
emailFrom?: string;
subject: string;
message?: {
[k: string]: unknown;
}[];
id?: string;
}[];
name?: string;
updatedAt: string;
createdAt: string;
}
export interface FormSubmission {
id: string;
form: string | Form;
submissionData: {
field: string;
value: string;
id?: string;
}[];
payment?: {
field?: string;
status?: string;
amount?: number;
paymentProcessor?: string;
creditCard?: {
token?: string;
brand?: string;
number?: string;
};
};
updatedAt: string;
createdAt: string;
}
16 changes: 8 additions & 8 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface PluginConfig {
export interface TextField {
blockType: 'text'
blockName?: string
width?: string
width?: number
name: string
label?: string
defaultValue?: string
Expand All @@ -62,7 +62,7 @@ export interface TextField {
export interface TextAreaField {
blockType: 'textarea'
blockName?: string
width?: string
width?: number
name: string
label?: string
defaultValue?: string
Expand All @@ -77,7 +77,7 @@ export interface SelectFieldOption {
export interface SelectField {
blockType: 'select'
blockName?: string
width?: string
width?: number
name: string
label?: string
defaultValue?: string
Expand All @@ -97,7 +97,7 @@ export interface PriceCondition {
export interface PaymentField {
blockType: 'payment'
blockName?: string
width?: string
width?: number
name: string
label?: string
defaultValue?: string
Expand All @@ -110,7 +110,7 @@ export interface PaymentField {
export interface EmailField {
blockType: 'email'
blockName?: string
width?: string
width?: number
name: string
label?: string
defaultValue?: string
Expand All @@ -120,7 +120,7 @@ export interface EmailField {
export interface StateField {
blockType: 'state'
blockName?: string
width?: string
width?: number
name: string
label?: string
defaultValue?: string
Expand All @@ -130,7 +130,7 @@ export interface StateField {
export interface CountryField {
blockType: 'country'
blockName?: string
width?: string
width?: number
name: string
label?: string
defaultValue?: string
Expand All @@ -140,7 +140,7 @@ export interface CountryField {
export interface CheckboxField {
blockType: 'checkbox'
blockName?: string
width?: string
width?: number
name: string
label?: string
defaultValue?: boolean
Expand Down