payload 1.8.6 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateEntityObject = exports.entityToJSONSchema = void 0;
6
+ exports.generateEntitySchemas = exports.entityToJSONSchema = void 0;
7
7
  const pluralize_1 = require("pluralize");
8
8
  const types_1 = require("../fields/config/types");
9
9
  const deepCopyObject_1 = __importDefault(require("./deepCopyObject"));
@@ -38,11 +38,11 @@ function returnOptionEnums(options) {
38
38
  return option;
39
39
  });
40
40
  }
41
- function generateFieldTypes(config, fields) {
42
- let topLevelProps = [];
43
- let requiredTopLevelProps = [];
41
+ function entityFieldsToJSONSchema(config, fields, fieldDefinitionsMap) {
42
+ // required fields for a schema (could be for a nested schema)
43
+ const requiredFields = new Set(fields.filter(propertyIsRequired).map((field) => ((0, types_1.fieldAffectsData)(field) ? field.name : '')));
44
44
  return {
45
- properties: Object.fromEntries(fields.reduce((properties, field) => {
45
+ properties: Object.fromEntries(fields.reduce((acc, field) => {
46
46
  let fieldSchema;
47
47
  switch (field.type) {
48
48
  case 'text':
@@ -254,21 +254,28 @@ function generateFieldTypes(config, fields) {
254
254
  type: 'array',
255
255
  items: {
256
256
  oneOf: field.blocks.map((block) => {
257
- const blockSchema = generateFieldTypes(config, block.fields);
258
- return {
257
+ const blockFieldSchemas = entityFieldsToJSONSchema(config, block.fields, fieldDefinitionsMap);
258
+ const blockSchema = {
259
259
  type: 'object',
260
260
  additionalProperties: false,
261
261
  properties: {
262
- ...blockSchema.properties,
262
+ ...blockFieldSchemas.properties,
263
263
  blockType: {
264
264
  const: block.slug,
265
265
  },
266
266
  },
267
267
  required: [
268
268
  'blockType',
269
- ...blockSchema.required,
269
+ ...blockFieldSchemas.required,
270
270
  ],
271
271
  };
272
+ if (block.interfaceName) {
273
+ fieldDefinitionsMap.set(block.interfaceName, blockSchema);
274
+ return {
275
+ $ref: `#/definitions/${block.interfaceName}`,
276
+ };
277
+ }
278
+ return blockSchema;
272
279
  }),
273
280
  },
274
281
  };
@@ -280,35 +287,47 @@ function generateFieldTypes(config, fields) {
280
287
  items: {
281
288
  type: 'object',
282
289
  additionalProperties: false,
283
- ...generateFieldTypes(config, field.fields),
290
+ ...entityFieldsToJSONSchema(config, field.fields, fieldDefinitionsMap),
284
291
  },
285
292
  };
293
+ if (field.interfaceName) {
294
+ fieldDefinitionsMap.set(field.interfaceName, fieldSchema);
295
+ fieldSchema = {
296
+ $ref: `#/definitions/${field.interfaceName}`,
297
+ };
298
+ }
286
299
  break;
287
300
  }
288
301
  case 'row':
289
302
  case 'collapsible': {
290
- const topLevelFields = generateFieldTypes(config, field.fields);
291
- requiredTopLevelProps = requiredTopLevelProps.concat(topLevelFields.required);
292
- topLevelProps = topLevelProps.concat(Object.entries(topLevelFields.properties).map((prop) => prop));
303
+ const childSchema = entityFieldsToJSONSchema(config, field.fields, fieldDefinitionsMap);
304
+ Object.entries(childSchema.properties).forEach(([propName, propSchema]) => {
305
+ acc.set(propName, propSchema);
306
+ });
307
+ childSchema.required.forEach((propName) => {
308
+ requiredFields.add(propName);
309
+ });
293
310
  break;
294
311
  }
295
312
  case 'tabs': {
296
313
  field.tabs.forEach((tab) => {
314
+ const childSchema = entityFieldsToJSONSchema(config, tab.fields, fieldDefinitionsMap);
297
315
  if ((0, types_1.tabHasName)(tab)) {
298
- requiredTopLevelProps.push(tab.name);
299
- topLevelProps.push([
300
- tab.name,
301
- {
302
- type: 'object',
303
- additionalProperties: false,
304
- ...generateFieldTypes(config, tab.fields),
305
- },
306
- ]);
316
+ // could have interface
317
+ acc.set(tab.name, {
318
+ type: 'object',
319
+ additionalProperties: false,
320
+ ...childSchema,
321
+ });
322
+ requiredFields.add(tab.name);
307
323
  }
308
324
  else {
309
- const topLevelFields = generateFieldTypes(config, tab.fields);
310
- requiredTopLevelProps = requiredTopLevelProps.concat(topLevelFields.required);
311
- topLevelProps = topLevelProps.concat(Object.entries(topLevelFields.properties).map((prop) => prop));
325
+ Object.entries(childSchema.properties).forEach(([propName, propSchema]) => {
326
+ acc.set(propName, propSchema);
327
+ });
328
+ childSchema.required.forEach((propName) => {
329
+ requiredFields.add(propName);
330
+ });
312
331
  }
313
332
  });
314
333
  break;
@@ -317,8 +336,14 @@ function generateFieldTypes(config, fields) {
317
336
  fieldSchema = {
318
337
  type: 'object',
319
338
  additionalProperties: false,
320
- ...generateFieldTypes(config, field.fields),
339
+ ...entityFieldsToJSONSchema(config, field.fields, fieldDefinitionsMap),
321
340
  };
341
+ if (field.interfaceName) {
342
+ fieldDefinitionsMap.set(field.interfaceName, fieldSchema);
343
+ fieldSchema = {
344
+ $ref: `#/definitions/${field.interfaceName}`,
345
+ };
346
+ }
322
347
  break;
323
348
  }
324
349
  default: {
@@ -326,30 +351,14 @@ function generateFieldTypes(config, fields) {
326
351
  }
327
352
  }
328
353
  if (fieldSchema && (0, types_1.fieldAffectsData)(field)) {
329
- return [
330
- ...properties,
331
- [
332
- field.name,
333
- {
334
- ...fieldSchema,
335
- },
336
- ],
337
- ];
354
+ acc.set(field.name, fieldSchema);
338
355
  }
339
- return [
340
- ...properties,
341
- ...topLevelProps,
342
- ];
343
- }, [])),
344
- required: [
345
- ...fields
346
- .filter(propertyIsRequired)
347
- .map((field) => ((0, types_1.fieldAffectsData)(field) ? field.name : '')),
348
- ...requiredTopLevelProps,
349
- ],
356
+ return acc;
357
+ }, new Map())),
358
+ required: Array.from(requiredFields),
350
359
  };
351
360
  }
352
- function entityToJSONSchema(config, incomingEntity) {
361
+ function entityToJSONSchema(config, incomingEntity, fieldDefinitionsMap) {
353
362
  var _a, _b;
354
363
  const entity = (0, deepCopyObject_1.default)(incomingEntity);
355
364
  const title = ((_a = entity.typescript) === null || _a === void 0 ? void 0 : _a.interface) ? entity.typescript.interface : (0, pluralize_1.singular)((0, formatLabels_1.toWords)(entity.slug, true));
@@ -383,22 +392,23 @@ function entityToJSONSchema(config, incomingEntity) {
383
392
  title,
384
393
  type: 'object',
385
394
  additionalProperties: false,
386
- ...generateFieldTypes(config, entity.fields),
395
+ ...entityFieldsToJSONSchema(config, entity.fields, fieldDefinitionsMap),
387
396
  };
388
397
  }
389
398
  exports.entityToJSONSchema = entityToJSONSchema;
390
- function generateEntityObject(config, type) {
399
+ function generateEntitySchemas(entities) {
400
+ const properties = [...entities].reduce((acc, { slug }) => {
401
+ acc[slug] = {
402
+ $ref: `#/definitions/${slug}`,
403
+ };
404
+ return acc;
405
+ }, {});
391
406
  return {
392
407
  type: 'object',
393
- properties: Object.fromEntries(config[type].map(({ slug }) => [
394
- slug,
395
- {
396
- $ref: `#/definitions/${slug}`,
397
- },
398
- ])),
399
- required: config[type].map(({ slug }) => slug),
408
+ properties,
409
+ required: Object.keys(properties),
400
410
  additionalProperties: false,
401
411
  };
402
412
  }
403
- exports.generateEntityObject = generateEntityObject;
413
+ exports.generateEntitySchemas = generateEntitySchemas;
404
414
  //# sourceMappingURL=entityToJSONSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entityToJSONSchema.js","sourceRoot":"","sources":["../../src/utilities/entityToJSONSchema.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAqC;AAErC,kDAAyG;AAGzG,sEAA8C;AAC9C,iDAAyC;AAGzC,MAAM,kBAAkB,GAAG,CAAC,KAAY,EAAE,EAAE;;IAC1C,IAAI,IAAA,wBAAgB,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAE/F,IAAI,QAAQ,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;QAC/C,IAAI,CAAA,MAAA,KAAK,CAAC,KAAK,0CAAE,SAAS,MAAI,MAAA,K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,CAAC,IAAI,CAAC;YACjB,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;KACJ;IAED,OAAO;QACL,KAAK;QACL,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,KAAK;QAC3B,GAAG,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC;KACxE,CAAC;AACJ,CAAC;AAvCD,gDAuCC;AAED,SAAgB,qBAAqB,CAAC,QAA+D;IACnG,MAAM,UAAU,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACxD,GAAG,CAAC,IAAI,CAAC,GAAG;YACV,IAAI,EAAE,iBAAiB,IAAI,EAAE;SAC9B,CAAC;QAEF,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,UAAU;QACV,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;QACjC,oBAAoB,EAAE,KAAK;KAC5B,CAAC;AACJ,CAAC;AAfD,sDAeC"}
@@ -6,8 +6,10 @@ desc: Array fields are intended for sets of repeating fields, that you define. L
6
6
  keywords: array, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
7
7
  ---
8
8
 
9
- <Banner >
10
- The Array field type is used when you need to have a set of "repeating" fields. It stores an array of objects containing the fields that you define. Its uses can be simple or highly complex.
9
+ <Banner>
10
+ The Array field type is used when you need to have a set of "repeating"
11
+ fields. It stores an array of objects containing the fields that you define.
12
+ Its uses can be simple or highly complex.
11
13
  </Banner>
12
14
 
13
15
  **Example uses:**
@@ -17,82 +19,85 @@ keywords: array, fields, config, configuration, documentation, Content Managemen
17
19
  - Event agenda "timeslots" where you need to specify start & end time ([date field](/docs/fields/date)), label ([text field](/docs/fields/text)), and Learn More page [relationship](/docs/fields/relationship)
18
20
 
19
21
  ![Array field in Payload admin panel](https://payloadcms.com/images/docs/fields/array.jpg)
20
- *Admin panel screenshot of an Array field with a Row containing two text fields, a read-only text field and a checkbox*
22
+ _Admin panel screenshot of an Array field with a Row containing two text fields, a read-only text field and a checkbox_
21
23
 
22
24
  ### Config
23
25
 
24
- | Option | Description |
25
- | ---------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
26
- | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
27
- | **`label`** | Text used as the heading in the Admin panel or an object with keys for each language. Auto-generated from name if not defined. |
28
- | **`fields`** * | Array of field types to correspond to each row of the Array. |
29
- | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
30
- | **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
31
- | **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
32
- | **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
33
- | **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
34
- | **`defaultValue`** | Provide an array of row data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
35
- | **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this Array will be kept, so there is no need to specify each nested field as `localized`. |
36
- | **`required`** | Require this field to have a value. |
37
- | **`labels`** | Customize the row labels appearing in the Admin dashboard. |
38
- | **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
39
- | **`custom`** | Extension point for adding custom data (e.g. for plugins) |
26
+ | Option | Description |
27
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28
+ | **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
29
+ | **`label`** | Text used as the heading in the Admin panel or an object with keys for each language. Auto-generated from name if not defined. |
30
+ | **`fields`** \* | Array of field types to correspond to each row of the Array. |
31
+ | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
32
+ | **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
33
+ | **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
34
+ | **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
35
+ | **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
36
+ | **`defaultValue`** | Provide an array of row data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
37
+ | **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this Array will be kept, so there is no need to specify each nested field as `localized`. |
38
+ | **`required`** | Require this field to have a value. |
39
+ | **`labels`** | Customize the row labels appearing in the Admin dashboard. |
40
+ | **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
41
+ | **`custom`** | Extension point for adding custom data (e.g. for plugins) |
42
+ | **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
40
43
 
41
- *\* An asterisk denotes that a property is required.*
44
+ _\* An asterisk denotes that a property is required._
42
45
 
43
46
  ### Admin Config
44
47
 
45
48
  In addition to the default [field admin config](/docs/fields/overview#admin-config), you can adjust the following properties:
46
49
 
47
- | Option | Description |
48
- | ---------------------- | ------------------------------- |
49
- | **`initCollapsed`** | Set the initial collapsed state |
50
- | **`components.RowLabel`** | Function or React component to be rendered as the label on the array row. Receives `({ data, index, path })` as args |
51
-
50
+ | Option | Description |
51
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
52
+ | **`initCollapsed`** | Set the initial collapsed state |
53
+ | **`components.RowLabel`** | Function or React component to be rendered as the label on the array row. Receives `({ data, index, path })` as args |
52
54
 
53
55
  ### Example
54
56
 
55
57
  `collections/ExampleCollection.ts`
58
+
56
59
  ```ts
57
- import { CollectionConfig } from 'payload/types';
60
+ import { CollectionConfig } from "payload/types";
58
61
 
59
62
  export const ExampleCollection: CollectionConfig = {
60
- slug: 'example-collection',
63
+ slug: "example-collection",
61
64
  fields: [
62
65
  {
63
- name: 'slider', // required
64
- type: 'array', // required
65
- label: 'Image Slider',
66
+ name: "slider", // required
67
+ type: "array", // required
68
+ label: "Image Slider",
66
69
  minRows: 2,
67
70
  maxRows: 10,
71
+ interfaceName: "CardSlider", // optional
68
72
  labels: {
69
- singular: 'Slide',
70
- plural: 'Slides',
73
+ singular: "Slide",
74
+ plural: "Slides",
71
75
  },
72
- fields: [ // required
76
+ fields: [
77
+ // required
73
78
  {
74
- name: 'title',
75
- type: 'text',
79
+ name: "title",
80
+ type: "text",
76
81
  },
77
82
  {
78
- name: 'image',
79
- type: 'upload',
80
- relationTo: 'media',
83
+ name: "image",
84
+ type: "upload",
85
+ relationTo: "media",
81
86
  required: true,
82
87
  },
83
88
  {
84
- name: 'caption',
85
- type: 'text',
86
- }
89
+ name: "caption",
90
+ type: "text",
91
+ },
87
92
  ],
88
93
  admin: {
89
94
  components: {
90
95
  RowLabel: ({ data, index }) => {
91
- return data?.title || `Slide ${String(index).padStart(2, '0')}`;
96
+ return data?.title || `Slide ${String(index).padStart(2, "0")}`;
92
97
  },
93
98
  },
94
99
  },
95
- }
96
- ]
100
+ },
101
+ ],
97
102
  };
98
103
  ```
@@ -6,8 +6,11 @@ desc: The Blocks field type is a great layout build and can be used to construct
6
6
  keywords: blocks, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
7
7
  ---
8
8
 
9
- <Banner >
10
- The Blocks field type is <strong>incredibly powerful</strong> and can be used as a <em>layout builder</em> as well as to define any other flexible content model you can think of. It stores an array of objects, where each object must match the shape of one of your provided block configs.
9
+ <Banner>
10
+ The Blocks field type is <strong>incredibly powerful</strong> and can be used
11
+ as a <em>layout builder</em> as well as to define any other flexible content
12
+ model you can think of. It stores an array of objects, where each object must
13
+ match the shape of one of your provided block configs.
11
14
  </Banner>
12
15
 
13
16
  **Example uses:**
@@ -17,55 +20,61 @@ keywords: blocks, fields, config, configuration, documentation, Content Manageme
17
20
  - Virtual event agenda "timeslots" where a timeslot could either be a `Break`, a `Presentation`, or a `BreakoutSession`.
18
21
 
19
22
  ![Blocks field in Payload admin panel](https://payloadcms.com/images/docs/fields/blocks.jpg)
20
- *Admin panel screenshot of a Blocks field type with Call to Action and Number block examples*
21
-
23
+ _Admin panel screenshot of a Blocks field type with Call to Action and Number block examples_
22
24
 
23
25
  ### Field config
24
26
 
25
- | Option | Description |
26
- |-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
27
- | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
28
- | **`label`** | Text used as the heading in the Admin panel or an object with keys for each language. Auto-generated from name if not defined. |
29
- | **`blocks`** * | Array of [block configs](/docs/fields/blocks#block-configs) to be made available to this field. |
30
- | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
31
- | **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
32
- | **`hooks`** | Provide field-level hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
33
- | **`access`** | Provide field-level access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
34
- | **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API response or the Admin panel. |
35
- | **`defaultValue`** | Provide an array of block data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
36
- | **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this field will be kept, so there is no need to specify each nested field as `localized`. || **`required`** | Require this field to have a value. |
37
- | **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
38
- | **`labels`** | Customize the block row labels appearing in the Admin dashboard. |
39
- | **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
40
- | **`custom`** | Extension point for adding custom data (e.g. for plugins) |
41
-
42
- *\* An asterisk denotes that a property is required.*
27
+ | Option | Description |
28
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | -------------- | ----------------------------------- |
29
+ | **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
30
+ | **`label`** | Text used as the heading in the Admin panel or an object with keys for each language. Auto-generated from name if not defined. |
31
+ | **`blocks`** \* | Array of [block configs](/docs/fields/blocks#block-configs) to be made available to this field. |
32
+ | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
33
+ | **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
34
+ | **`hooks`** | Provide field-level hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
35
+ | **`access`** | Provide field-level access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
36
+ | **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API response or the Admin panel. |
37
+ | **`defaultValue`** | Provide an array of block data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
38
+ | **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this field will be kept, so there is no need to specify each nested field as `localized`. | | **`required`** | Require this field to have a value. |
39
+ | **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
40
+ | **`labels`** | Customize the block row labels appearing in the Admin dashboard. |
41
+ | **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
42
+ | **`custom`** | Extension point for adding custom data (e.g. for plugins) |
43
+
44
+ _\* An asterisk denotes that a property is required._
43
45
 
44
46
  ### Admin Config
45
47
 
46
48
  In addition to the default [field admin config](/docs/fields/overview#admin-config), you can adjust the following properties:
47
49
 
48
- | Option | Description |
49
- | ---------------------- | ------------------------------- |
50
- | **`initCollapsed`** | Set the initial collapsed state |
50
+ | Option | Description |
51
+ | ------------------- | ------------------------------- |
52
+ | **`initCollapsed`** | Set the initial collapsed state |
51
53
 
52
54
  ### Block configs
53
55
 
54
56
  Blocks are defined as separate configs of their own.
55
57
 
56
58
  <Banner type="success">
57
- <strong>Tip:</strong><br />
58
- Best practice is to define each block config in its own file, and then import them into your Blocks field as necessary. This way each block config can be easily shared between fields. For instance, using the "layout builder" example, you might want to feature a few of the same blocks in a Post collection as well as a Page collection. Abstracting into their own files trivializes their reusability.
59
+ <strong>Tip:</strong>
60
+ <br />
61
+ Best practice is to define each block config in its own file, and then import
62
+ them into your Blocks field as necessary. This way each block config can be
63
+ easily shared between fields. For instance, using the "layout builder"
64
+ example, you might want to feature a few of the same blocks in a Post
65
+ collection as well as a Page collection. Abstracting into their own files
66
+ trivializes their reusability.
59
67
  </Banner>
60
68
 
61
- | Option | Description |
62
- |----------------------------|---------------------------------------------------------------------------------------------------------|
63
- | **`slug`** * | Identifier for this block type. Will be saved on each block as the `blockType` property. |
64
- | **`fields`** * | Array of fields to be stored in this block. |
65
- | **`labels`** | Customize the block labels that appear in the Admin dashboard. Auto-generated from slug if not defined. |
66
- | **`imageURL`** | Provide a custom image thumbnail to help editors identify this block in the Admin UI. |
67
- | **`imageAltText`** | Customize this block's image thumbnail alt text. |
68
- | **`graphQL.singularName`** | Text to use for the GraphQL schema name. Auto-generated from slug if not defined |
69
+ | Option | Description |
70
+ | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
71
+ | **`slug`** \* | Identifier for this block type. Will be saved on each block as the `blockType` property. |
72
+ | **`fields`** \* | Array of fields to be stored in this block. |
73
+ | **`labels`** | Customize the block labels that appear in the Admin dashboard. Auto-generated from slug if not defined. |
74
+ | **`imageURL`** | Provide a custom image thumbnail to help editors identify this block in the Admin UI. |
75
+ | **`imageAltText`** | Customize this block's image thumbnail alt text. |
76
+ | **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
77
+ | **`graphQL.singularName`** | Text to use for the GraphQL schema name. Auto-generated from slug if not defined. NOTE: this is set for deprecation, prefer `interfaceName`. |
69
78
 
70
79
  #### Auto-generated data per block
71
80
 
@@ -82,41 +91,44 @@ The Admin panel provides each block with a `blockName` field which optionally al
82
91
  ### Example
83
92
 
84
93
  `collections/ExampleCollection.js`
94
+
85
95
  ```ts
86
- import { Block, CollectionConfig } from 'payload/types';
96
+ import { Block, CollectionConfig } from "payload/types";
87
97
 
88
98
  const QuoteBlock: Block = {
89
- slug: 'Quote', // required
90
- imageURL: 'https://google.com/path/to/image.jpg',
91
- imageAltText: 'A nice thumbnail image to show what this block looks like',
92
- fields: [ // required
99
+ slug: "Quote", // required
100
+ imageURL: "https://google.com/path/to/image.jpg",
101
+ imageAltText: "A nice thumbnail image to show what this block looks like",
102
+ interfaceName: "QuoteBlock", // optional
103
+ fields: [
104
+ // required
93
105
  {
94
- name: 'quoteHeader',
95
- type: 'text',
106
+ name: "quoteHeader",
107
+ type: "text",
96
108
  required: true,
97
109
  },
98
110
  {
99
- name: 'quoteText',
100
- type: 'text',
111
+ name: "quoteText",
112
+ type: "text",
101
113
  },
102
- ]
114
+ ],
103
115
  };
104
116
 
105
117
  export const ExampleCollection: CollectionConfig = {
106
- slug: 'example-collection',
118
+ slug: "example-collection",
107
119
  fields: [
108
120
  {
109
- name: 'layout', // required
110
- type: 'blocks', // required
121
+ name: "layout", // required
122
+ type: "blocks", // required
111
123
  minRows: 1,
112
124
  maxRows: 20,
113
- blocks: [ // required
114
- QuoteBlock
115
- ]
116
- }
117
- ]
118
- }
119
-
125
+ blocks: [
126
+ // required
127
+ QuoteBlock,
128
+ ],
129
+ },
130
+ ],
131
+ };
120
132
  ```
121
133
 
122
134
  ### TypeScript
@@ -124,6 +136,5 @@ export const ExampleCollection: CollectionConfig = {
124
136
  As you build your own Block configs, you might want to store them in separate files but retain typing accordingly. To do so, you can import and use Payload's `Block` type:
125
137
 
126
138
  ```ts
127
- import type { Block } from 'payload/types';
128
-
139
+ import type { Block } from "payload/types";
129
140
  ```