Files
payload/test/fields/payload-types.ts
Alessio Gravili 8f086e315c feat: hasMany for number field (#2517)
* added custom config extension points

* Added custom field to documentation

* fix: not building due to incorrect typings

* Upload dist

* point to number array test

* feat: hasMany for number field

* fix: types

* Fix: incorrectly styles input for hasMany

* Revert "point to number array test"

This reverts commit 5a5162a803.

* Revert "Merge branch 'production-with-custom' into number-hasmany-v2"

This reverts commit dfc3ac523e, reversing
changes made to a3b1b7dd67.

* test: adds test for numbers with hasMany

* test: add number field e2e

* Fix updated index.tsx

* Fix updated index.tsx

* chore: add jsDocs for hasMany property

* chore: rename isMultiText to isCreatable, as it makes more sense

* fix: incorrect double space in comments

* chore: rename onMultiTextChange to handleHasManyChange

* chore: improve ordering

* docs: add documentation for hasMany

* docs: add more jsdocs for number field

* fix: new value not transformed to number

* improve types

* fix: only allow numbers as input using filterOption

* fix: Option / value type breaking sortable selects

* fix: typings and add id for sorting

* add animation to react select

* undo transitions due to glitches

* fix: keyboard handler for select for empty input values

* fix: validation for hasMany numbers

* feat: perform validation in the filter as well

* attempt to fix duplicate key issue

* add todo

* remove console logs

* fix: stupid key warning

* fix: validation tests

* feat: add filterOption to keydown listener

* feat: numberOnly for react-select

* chore: improve variable naming

* fix: allow numbers for relationship value by stringifying those for sortable react-selects

* feat: generated types for hasMany number field

* graphql typings part 1

* graphql defaults type

* better typing for number in buildObjectType

* fix: default graphql type disregarding hasMany for relationship field

* feat: minRows and maxRows for hasMany numbers

* simplify joi schema

* working minRows and maxRows validation!

* jesus christ: fix incorrect translations for number & relationship fields for greaterThanMax and lessThanMin

* fix weird type error

* move validation tests to validations.spec.ts and fix them

* fix: make sure filterOption only passes a number array to validate function

* fix: adds missing dark-mode styles for version differences view (#2812)

Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>

* fix: #2821 i18n ui field label (#2823)

* chore: version diff styles (#2824)

Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>

* chore: remove --legacy-peer-deps from gh actions workflow (#2814)

* chore: removes cms text from instances of payload name (#2793)

* chore(release): v1.9.2

* chore: update changelog release notes v1.9.2

* chore: cleans up graphql-schema-gen test folder

* fix: adds custom property to ui field in joi validation (#2835)

* adjust validation

* improve isnumber function

* Update number.mdx

---------

Co-authored-by: Teun Mooij <tmooij@infinitaslearning.com>
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
Co-authored-by: Tylan Davis <89618855+tylandavis@users.noreply.github.com>
Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>
Co-authored-by: Dan Ribbens <DanRibbens@users.noreply.github.com>
Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
Co-authored-by: Jarrod Flesch <30633324+JarrodMFlesch@users.noreply.github.com>
2023-06-20 20:21:27 +02:00

593 lines
12 KiB
TypeScript

/* tslint:disable */
/**
* This file was automatically generated by Payload.
* 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;
'array-fields': ArrayField;
'block-fields': BlockField;
'code-fields': CodeField;
'collapsible-fields': CollapsibleField;
'conditional-logic': ConditionalLogic;
'date-fields': DateField;
'radio-fields': RadioField;
'group-fields': GroupField;
'row-fields': RowField;
'indexed-fields': IndexedField;
'json-fields': JsonField;
'number-fields': NumberField;
'point-fields': PointField;
'relationship-fields': RelationshipField;
'rich-text-fields': RichTextField;
'select-fields': SelectField;
'tabs-fields': TabsField;
'text-fields': TextField;
uploads: Upload;
uploads2: Uploads2;
uploads3: Uploads3;
};
globals: {};
}
export interface User {
id: string;
canViewConditionalField?: boolean;
updatedAt: string;
createdAt: string;
email: string;
resetPasswordToken?: string;
resetPasswordExpiration?: string;
salt?: string;
hash?: string;
loginAttempts?: number;
lockUntil?: string;
password?: string;
}
export interface ArrayField {
id: string;
items: {
text: string;
id?: string;
}[];
collapsedArray?: {
text: string;
id?: string;
}[];
localized: {
text: string;
id?: string;
}[];
readOnly?: {
text?: string;
id?: string;
}[];
potentiallyEmptyArray?: {
text?: string;
id?: string;
}[];
rowLabelAsFunction?: {
title?: string;
id?: string;
}[];
rowLabelAsComponent?: {
title?: string;
id?: string;
}[];
updatedAt: string;
createdAt: string;
}
export interface BlockField {
id: string;
blocks: (
| {
text: string;
richText?: {
[k: string]: unknown;
}[];
id?: string;
blockName?: string;
blockType: 'text';
}
| {
number: number;
id?: string;
blockName?: string;
blockType: 'number';
}
| {
subBlocks?: (
| {
text: string;
id?: string;
blockName?: string;
blockType: 'text';
}
| {
number: number;
id?: string;
blockName?: string;
blockType: 'number';
}
)[];
id?: string;
blockName?: string;
blockType: 'subBlocks';
}
| {
textInCollapsible?: string;
textInRow?: string;
id?: string;
blockName?: string;
blockType: 'tabs';
}
)[];
collapsedByDefaultBlocks: (
| {
text: string;
richText?: {
[k: string]: unknown;
}[];
id?: string;
blockName?: string;
blockType: 'text';
}
| {
number: number;
id?: string;
blockName?: string;
blockType: 'number';
}
| {
subBlocks?: (
| {
text: string;
id?: string;
blockName?: string;
blockType: 'text';
}
| {
number: number;
id?: string;
blockName?: string;
blockType: 'number';
}
)[];
id?: string;
blockName?: string;
blockType: 'subBlocks';
}
| {
textInCollapsible?: string;
textInRow?: string;
id?: string;
blockName?: string;
blockType: 'tabs';
}
)[];
localizedBlocks: (
| {
text: string;
richText?: {
[k: string]: unknown;
}[];
id?: string;
blockName?: string;
blockType: 'text';
}
| {
number: number;
id?: string;
blockName?: string;
blockType: 'number';
}
| {
subBlocks?: (
| {
text: string;
id?: string;
blockName?: string;
blockType: 'text';
}
| {
number: number;
id?: string;
blockName?: string;
blockType: 'number';
}
)[];
id?: string;
blockName?: string;
blockType: 'subBlocks';
}
| {
textInCollapsible?: string;
textInRow?: string;
id?: string;
blockName?: string;
blockType: 'tabs';
}
)[];
i18nBlocks?: {
text?: string;
id?: string;
blockName?: string;
blockType: 'text';
}[];
updatedAt: string;
createdAt: string;
}
export interface CodeField {
id: string;
javascript?: string;
typescript?: string;
json?: string;
html?: string;
css?: string;
updatedAt: string;
createdAt: string;
}
export interface CollapsibleField {
id: string;
text: string;
group?: {
textWithinGroup?: string;
subGroup?: {
textWithinSubGroup?: string;
};
};
someText?: string;
functionTitleField?: string;
componentTitleField?: string;
nestedTitle?: string;
arrayWithCollapsibles?: {
innerCollapsible?: string;
id?: string;
}[];
updatedAt: string;
createdAt: string;
}
export interface ConditionalLogic {
id: string;
text: string;
toggleField?: boolean;
fieldToToggle: string;
userConditional?: string;
updatedAt: string;
createdAt: string;
}
export interface DateField {
id: string;
default: string;
timeOnly?: string;
dayOnly?: string;
dayAndTime?: string;
monthOnly?: string;
updatedAt: string;
createdAt: string;
}
export interface RadioField {
id: string;
radio?: 'one' | 'two' | 'three';
updatedAt: string;
createdAt: string;
}
export interface GroupField {
id: string;
group: {
text: string;
defaultParent?: string;
defaultChild?: string;
subGroup?: {
textWithinGroup?: string;
arrayWithinGroup?: {
textWithinArray?: string;
id?: string;
}[];
};
};
potentiallyEmptyGroup?: {
text?: string;
};
groupInRow?: {
field?: string;
secondField?: string;
thirdField?: string;
};
secondGroupInRow?: {
field?: string;
nestedGroup?: {
nestedField?: string;
};
};
groups: {
groupInRow?: {
field?: string;
secondField?: string;
thirdField?: string;
};
secondGroupInRow?: {
field?: string;
nestedGroup?: {
nestedField?: string;
};
};
};
updatedAt: string;
createdAt: string;
}
export interface RowField {
id: string;
title: string;
updatedAt: string;
createdAt: string;
}
export interface IndexedField {
id: string;
text: string;
uniqueText?: string;
/**
* @minItems 2
* @maxItems 2
*/
point?: [number, number];
group?: {
localizedUnique?: string;
/**
* @minItems 2
* @maxItems 2
*/
point?: [number, number];
};
collapsibleLocalizedUnique?: string;
collapsibleTextUnique?: string;
partOne?: string;
partTwo?: string;
updatedAt: string;
createdAt: string;
}
export interface JsonField {
id: string;
json?:
| {
[k: string]: unknown;
}
| unknown[]
| string
| number
| boolean
| null;
updatedAt: string;
createdAt: string;
}
export interface NumberField {
id: string;
number?: number;
min?: number;
max?: number;
positiveNumber?: number;
negativeNumber?: number;
decimalMin?: number;
decimalMax?: number;
defaultNumber?: number;
hasMany?: number[];
validatesHasMany?: number[];
localizedHasMany?: number[];
updatedAt: string;
createdAt: string;
}
export interface PointField {
id: string;
/**
* @minItems 2
* @maxItems 2
*/
point: [number, number];
/**
* @minItems 2
* @maxItems 2
*/
localized?: [number, number];
group?: {
/**
* @minItems 2
* @maxItems 2
*/
point?: [number, number];
};
updatedAt: string;
createdAt: string;
}
export interface RelationshipField {
id: string;
relationship:
| {
value: string | TextField;
relationTo: 'text-fields';
}
| {
value: string | ArrayField;
relationTo: 'array-fields';
};
relationToSelf?: string | RelationshipField;
relationToSelfSelectOnly?: string | RelationshipField;
relationWithDynamicDefault?: string | User;
relationHasManyWithDynamicDefault?: {
value: string | User;
relationTo: 'users';
};
relationshipWithMin?: string[] | TextField[];
relationshipWithMax?: string[] | TextField[];
updatedAt: string;
createdAt: string;
}
export interface TextField {
id: string;
text: string;
localizedText?: string;
i18nText?: string;
defaultFunction?: string;
defaultAsync?: string;
overrideLength?: string;
updatedAt: string;
createdAt: string;
}
export interface RichTextField {
id: string;
title: string;
selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[];
richText: {
[k: string]: unknown;
}[];
richTextCustomFields?: {
[k: string]: unknown;
}[];
richTextReadOnly?: {
[k: string]: unknown;
}[];
updatedAt: string;
createdAt: string;
}
export interface SelectField {
id: string;
select?: 'one' | 'two' | 'three';
selectReadOnly?: 'one' | 'two' | 'three';
selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[];
selectHasManyLocalized?: ('one' | 'two')[];
selectI18n?: 'one' | 'two' | 'three';
simple?: 'One' | 'Two' | 'Three';
updatedAt: string;
createdAt: string;
}
export interface TabsField {
id: string;
array: {
text: string;
id?: string;
}[];
blocks: (
| {
text: string;
richText?: {
[k: string]: unknown;
}[];
id?: string;
blockName?: string;
blockType: 'text';
}
| {
number: number;
id?: string;
blockName?: string;
blockType: 'number';
}
| {
subBlocks?: (
| {
text: string;
id?: string;
blockName?: string;
blockType: 'text';
}
| {
number: number;
id?: string;
blockName?: string;
blockType: 'number';
}
)[];
id?: string;
blockName?: string;
blockType: 'subBlocks';
}
| {
textInCollapsible?: string;
textInRow?: string;
id?: string;
blockName?: string;
blockType: 'tabs';
}
)[];
group: {
number: number;
};
textInRow: string;
numberInRow: number;
tab: {
array: {
text: string;
id?: string;
}[];
text?: string;
defaultValue?: string;
};
namedTabWithDefaultValue: {
defaultValue?: string;
};
localizedTab: {
text?: string;
};
accessControlTab: {
text?: string;
};
hooksTab: {
beforeValidate?: boolean;
beforeChange?: boolean;
afterChange?: boolean;
afterRead?: boolean;
};
textarea?: string;
anotherText: string;
nestedTab: {
text?: string;
};
updatedAt: string;
createdAt: string;
}
export interface Upload {
id: string;
text?: string;
media?: string | Upload;
richText?: {
[k: string]: unknown;
}[];
updatedAt: string;
createdAt: string;
url?: string;
filename?: string;
mimeType?: string;
filesize?: number;
width?: number;
height?: number;
}
export interface Uploads2 {
id: string;
text?: string;
media?: string | Uploads2;
updatedAt: string;
createdAt: string;
url?: string;
filename?: string;
mimeType?: string;
filesize?: number;
width?: number;
height?: number;
}
export interface Uploads3 {
id: string;
media?: string | Uploads3;
richText?: {
[k: string]: unknown;
}[];
updatedAt: string;
createdAt: string;
url?: string;
filename?: string;
mimeType?: string;
filesize?: number;
width?: number;
height?: number;
}