payload 1.4.0 → 1.4.2

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.
Files changed (45) hide show
  1. package/README.md +0 -3
  2. package/dist/admin/components/elements/DeleteDocument/index.js +1 -1
  3. package/dist/admin/components/elements/PreviewButton/index.js +20 -21
  4. package/dist/admin/components/elements/PreviewButton/types.d.ts +0 -2
  5. package/dist/admin/components/forms/Form/createNestedFieldPath.d.ts +2 -0
  6. package/dist/admin/components/forms/Form/createNestedFieldPath.js +13 -0
  7. package/dist/admin/components/forms/Form/getSiblingData.js +18 -4
  8. package/dist/admin/components/forms/field-types/Array/index.js +4 -6
  9. package/dist/admin/components/forms/field-types/Blocks/index.js +2 -2
  10. package/dist/admin/components/forms/field-types/Collapsible/index.js +2 -2
  11. package/dist/admin/components/forms/field-types/DateTime/index.js +1 -1
  12. package/dist/admin/components/forms/field-types/Group/index.js +2 -2
  13. package/dist/admin/components/forms/field-types/RichText/RichText.js +18 -5
  14. package/dist/admin/components/forms/field-types/Row/index.js +2 -2
  15. package/dist/admin/components/forms/field-types/Select/Input.js +6 -4
  16. package/dist/admin/components/forms/field-types/Tabs/index.js +13 -5
  17. package/dist/admin/components/views/Account/Default.js +1 -1
  18. package/dist/admin/components/views/Global/Default.js +2 -2
  19. package/dist/admin/components/views/collections/Edit/Default.js +2 -2
  20. package/dist/mongoose/buildSchema.js +14 -6
  21. package/dist/translations/index.d.ts +306 -0
  22. package/dist/translations/index.js +3 -1
  23. package/dist/translations/ua.json +306 -0
  24. package/docs/configuration/globals.mdx +67 -29
  25. package/docs/fields/array.mdx +2 -2
  26. package/docs/fields/blocks.mdx +1 -1
  27. package/docs/fields/checkbox.mdx +1 -1
  28. package/docs/fields/code.mdx +1 -1
  29. package/docs/fields/date.mdx +1 -1
  30. package/docs/fields/email.mdx +1 -1
  31. package/docs/fields/group.mdx +1 -1
  32. package/docs/fields/number.mdx +1 -1
  33. package/docs/fields/overview.mdx +4 -0
  34. package/docs/fields/point.mdx +1 -1
  35. package/docs/fields/radio.mdx +1 -1
  36. package/docs/fields/relationship.mdx +1 -1
  37. package/docs/fields/rich-text.mdx +1 -1
  38. package/docs/fields/select.mdx +1 -1
  39. package/docs/fields/tabs.mdx +1 -1
  40. package/docs/fields/text.mdx +1 -1
  41. package/docs/fields/textarea.mdx +1 -1
  42. package/docs/fields/upload.mdx +1 -1
  43. package/package.json +1 -1
  44. package/dist/admin/components/forms/field-types/getFieldPath.d.ts +0 -2
  45. package/dist/admin/components/forms/field-types/getFieldPath.js +0 -6
@@ -6,16 +6,16 @@ desc: Set up your Global config for your needs by defining fields, adding slugs
6
6
  keywords: globals, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
7
7
  ---
8
8
 
9
- Global configs are in many ways similar to [Collections](/docs/configuration/collections). The big difference is that Collections will potentially contain *many* documents, while a Global is a "one-off". Globals are perfect for things like header nav, site-wide banner alerts, app-wide localized strings, and other "global" data that your site or app might rely on.
9
+ Global configs are in many ways similar to [Collections](/docs/configuration/collections). The big difference is that Collections will potentially contain _many_ documents, while a Global is a "one-off". Globals are perfect for things like header nav, site-wide banner alerts, app-wide localized strings, and other "global" data that your site or app might rely on.
10
10
 
11
11
  As with Collection configs, it's often best practice to write your Globals in separate files and then import them into the main Payload config.
12
12
 
13
13
  ## Options
14
14
 
15
15
  | Option | Description |
16
- |--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
17
- | **`slug`** * | Unique, URL-friendly string that will act as an identifier for this Global. |
18
- | **`fields`** * | Array of field types that will determine the structure and functionality of the data stored within this Global. [Click here](/docs/fields/overview) for a full list of field types as well as how to configure them. |
16
+ | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | **`slug`** \* | Unique, URL-friendly string that will act as an identifier for this Global. |
18
+ | **`fields`** \* | Array of field types that will determine the structure and functionality of the data stored within this Global. [Click here](/docs/fields/overview) for a full list of field types as well as how to configure them. |
19
19
  | **`label`** | Text for the name in the Admin panel or an object with keys for each language. Auto-generated from slug if not defined. |
20
20
  | **`description`** | Text or React component to display below the Global header to give editors more information. |
21
21
  | **`admin`** | Admin-specific configuration. See below for [more detail](/docs/configuration/globals#admin-options). |
@@ -24,33 +24,33 @@ As with Collection configs, it's often best practice to write your Globals in se
24
24
  | **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#globals-config) |
25
25
  | **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints) |
26
26
  | **`graphQL.name`** | Text used in schema generation. Auto-generated from slug if not defined. |
27
- | **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. |
27
+ | **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. |
28
28
 
29
- *\* An asterisk denotes that a property is required.*
29
+ _\* An asterisk denotes that a property is required._
30
30
 
31
31
  #### Simple Global example
32
32
 
33
33
  ```ts
34
- import { GlobalConfig } from 'payload/types';
34
+ import { GlobalConfig } from "payload/types";
35
35
 
36
36
  const Nav: GlobalConfig = {
37
- slug: 'nav',
38
- fields: [
39
- {
40
- name: 'items',
41
- type: 'array',
42
- required: true,
43
- maxRows: 8,
44
- fields: [
45
- {
46
- name: 'page',
47
- type: 'relationship',
48
- relationTo: 'pages', // "pages" is the slug of an existing collection
49
- required: true,
50
- }
51
- ]
52
- },
53
- ]
37
+ slug: "nav",
38
+ fields: [
39
+ {
40
+ name: "items",
41
+ type: "array",
42
+ required: true,
43
+ maxRows: 8,
44
+ fields: [
45
+ {
46
+ name: "page",
47
+ type: "relationship",
48
+ relationTo: "pages", // "pages" is the slug of an existing collection
49
+ required: true,
50
+ },
51
+ ],
52
+ },
53
+ ],
54
54
  };
55
55
 
56
56
  export default Nav;
@@ -64,9 +64,47 @@ You can find an [example Global config](https://github.com/payloadcms/public-dem
64
64
 
65
65
  You can customize the way that the Admin panel behaves on a Global-by-Global basis by defining the `admin` property on a Global's config.
66
66
 
67
- | Option | Description |
68
- | ---------------------------- | -------------|
69
- | `components` | Swap in your own React components to be used within this Global. [More](/docs/admin/components#globals) |
67
+ | Option | Description |
68
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------- |
69
+ | `components` | Swap in your own React components to be used within this Global. [More](/docs/admin/components#globals) |
70
+ | `preview` | Function to generate a preview URL within the Admin panel for this global that can point to your app. [More](#preview). |
71
+
72
+ ### Preview
73
+
74
+ Global `admin` options can accept a `preview` function that will be used to generate a link pointing to the frontend of your app to preview data.
75
+
76
+ If the function is specified, a Preview button will automatically appear in the corresponding global's Edit view. Clicking the Preview button will link to the URL that is generated by the function.
77
+
78
+ **The preview function accepts two arguments:**
79
+
80
+ 1. The document being edited
81
+ 1. An `options` object, containing `locale` and `token` properties. The `token` is the currently logged-in user's JWT.
82
+
83
+ **Example global with preview function:**
84
+
85
+ ```ts
86
+ import { GlobalConfig } from "payload/types";
87
+
88
+ const MyGlobal: CollectionConfig = {
89
+ slug: "my-global",
90
+ fields: [
91
+ {
92
+ name: "slug",
93
+ type: "text",
94
+ required: true,
95
+ },
96
+ ],
97
+ admin: {
98
+ preview: (doc, { locale }) => {
99
+ if (doc?.slug) {
100
+ return `https://bigbird.com/preview/${doc.slug}?locale=${locale}`;
101
+ }
102
+
103
+ return null;
104
+ },
105
+ },
106
+ };
107
+ ```
70
108
 
71
109
  ### Access control
72
110
 
@@ -85,14 +123,14 @@ Globals support all field types that Payload has to offer—including simple fie
85
123
  You can import global types as follows:
86
124
 
87
125
  ```ts
88
- import { GlobalConfig } from 'payload/types';
126
+ import { GlobalConfig } from "payload/types";
89
127
 
90
128
  // This is the type used for incoming global configs.
91
129
  // Only the bare minimum properties are marked as required.
92
130
  ```
93
131
 
94
132
  ```ts
95
- import { SanitizedGlobalConfig } from 'payload/types';
133
+ import { SanitizedGlobalConfig } from "payload/types";
96
134
 
97
135
  // This is the type used after an incoming global config is fully sanitized.
98
136
  // Generally, this is only used internally by Payload.
@@ -23,7 +23,7 @@ keywords: array, fields, config, configuration, documentation, Content Managemen
23
23
 
24
24
  | Option | Description |
25
25
  | ---------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
26
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
26
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
27
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
28
  | **`fields`** * | Array of field types to correspond to each row of the Array. |
29
29
  | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
@@ -46,7 +46,7 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
46
46
  | Option | Description |
47
47
  | ---------------------- | ------------------------------- |
48
48
  | **`initCollapsed`** | Set the initial collapsed state |
49
- | **`components.RowLabel`** | Function or React component to be rendered as the label on the array row. Recieves `({ data, index, path })` as args |
49
+ | **`components.RowLabel`** | Function or React component to be rendered as the label on the array row. Receives `({ data, index, path })` as args |
50
50
 
51
51
 
52
52
  ### Example
@@ -24,7 +24,7 @@ keywords: blocks, fields, config, configuration, documentation, Content Manageme
24
24
 
25
25
  | Option | Description |
26
26
  |-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
27
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
27
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
28
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
29
  | **`blocks`** * | Array of [block configs](/docs/fields/blocks#block-configs) to be made available to this field. |
30
30
  | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
@@ -14,7 +14,7 @@ keywords: checkbox, fields, config, configuration, documentation, Content Manage
14
14
 
15
15
  | Option | Description |
16
16
  | ---------------- | ----------- |
17
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
17
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
18
18
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
19
19
  | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
20
20
  | **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. Set this field to `true` if your users will perform queries on this field's data often. |
@@ -17,7 +17,7 @@ This field uses `prismjs` for syntax highlighting and `react-simple-code-editor`
17
17
 
18
18
  | Option | Description |
19
19
  | ---------------- | ----------- |
20
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
20
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
21
21
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
22
22
  | **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
23
23
  | **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. Set this field to `true` if your users will perform queries on this field's data often. |
@@ -17,7 +17,7 @@ This field uses [`react-datepicker`](https://www.npmjs.com/package/react-datepic
17
17
 
18
18
  | Option | Description |
19
19
  | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20
- | **`name`** \* | To be used as the property name when stored and retrieved from the database. |
20
+ | **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
21
21
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
22
22
  | **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. Set this field to `true` if your users will perform queries on this field's data often. |
23
23
  | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
@@ -14,7 +14,7 @@ keywords: email, fields, config, configuration, documentation, Content Managemen
14
14
 
15
15
  | Option | Description |
16
16
  | ---------------- | ----------- |
17
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
17
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
18
18
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
19
19
  | **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
20
20
  | **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. Set this field to `true` if your users will perform queries on this field's data often. |
@@ -14,7 +14,7 @@ keywords: group, fields, config, configuration, documentation, Content Managemen
14
14
 
15
15
  | Option | Description |
16
16
  | ---------------- | ----------- |
17
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
17
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
18
18
  | **`fields`** * | Array of field types to nest within this Group. |
19
19
  | **`label`** | Used as a heading in the Admin panel and to name the generated GraphQL type. |
20
20
  | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
@@ -14,7 +14,7 @@ keywords: number, fields, config, configuration, documentation, Content Manageme
14
14
 
15
15
  | Option | Description |
16
16
  | ---------------- | ----------- |
17
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
17
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
18
18
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
19
19
  | **`min`** | Minimum value accepted. Used in the default `validation` function. |
20
20
  | **`max`** | Maximum value accepted. Used in the default `validation` function. |
@@ -64,6 +64,10 @@ One of the most powerful parts about Payload is its ability for you to define fi
64
64
 
65
65
  In addition to being able to define access control on a document-level, you can define extremely granular permissions on a field by field level. For more information about field-level access control, [click here](/docs/access-control/overview#fields).
66
66
 
67
+ ### Field names
68
+
69
+ Some fields use their `name` property as a unique identifier to store and retrieve from the database. `__v`, `salt`, and `hash` are all reserved field names which are sanitized from Payload's config and cannot be used.
70
+
67
71
  ### Validation
68
72
 
69
73
  Field validation is enforced automatically based on the field type and other properties such as `required` or `min` and `max` value constraints on certain field types. This default behavior can be replaced by providing your own validate function for any field. It will be used on both the frontend and the backend, so it should not rely on any Node-specific packages. The validation function can be either synchronous or asynchronous and expects to return either `true` or a string error message to display in both API responses and within the Admin panel.
@@ -17,7 +17,7 @@ The data structure in the database matches the GeoJSON structure to represent po
17
17
 
18
18
  | Option | Description |
19
19
  | ---------------- | ----------- |
20
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
20
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
21
21
  | **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
22
22
  | **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
23
23
  | **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. To support location queries, point index defaults to `2dsphere`, to disable the index set to `false`. |
@@ -14,7 +14,7 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
14
14
 
15
15
  | Option | Description |
16
16
  | ---------------- | ----------- |
17
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
17
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
18
18
  | **`options`** * | Array of options to allow the field to store. Can either be an array of strings, or an array of objects containing an `label` string and a `value` string. |
19
19
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
20
20
  | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
@@ -20,7 +20,7 @@ keywords: relationship, fields, config, configuration, documentation, Content Ma
20
20
 
21
21
  | Option | Description |
22
22
  | ---------------- | ----------- |
23
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
23
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
24
24
  | **`relationTo`** * | Provide one or many collection `slug`s to be able to assign relationships to. |
25
25
  | **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-relationship-options). |
26
26
  | **`hasMany`** | Boolean when, if set to `true`, allows this field to have many relations instead of only one. |
@@ -20,7 +20,7 @@ The Admin component is built on the powerful [`slatejs`](https://docs.slatejs.or
20
20
 
21
21
  | Option | Description |
22
22
  | ---------------- | ----------- |
23
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
23
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
24
24
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
25
25
  | **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
26
26
  | **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
@@ -15,7 +15,7 @@ keywords: select, multi-select, fields, config, configuration, documentation, Co
15
15
 
16
16
  | Option | Description |
17
17
  | ------------------ |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
18
- | **`name`** \* | To be used as the property name when stored and retrieved from the database. |
18
+ | **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
19
19
  | **`options`** \* | Array of options to allow the field to store. Can either be an array of strings, or an array of objects containing a `label` string and a `value` string. |
20
20
  | **`hasMany`** | Boolean when, if set to `true`, allows this field to have many selections instead of only one. |
21
21
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
@@ -26,7 +26,7 @@ Each tab has its own required `label` and `fields` array. You can also optionall
26
26
 
27
27
  | Option | Description |
28
28
  | ----------------- | ----------- |
29
- | **`name`** | An optional property name to be used when stored and retrieved from the database, similar to a [Group](/docs/fields/group). |
29
+ | **`name`** | An optional property name to be used when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
30
30
  | **`label`** * | The label to render on the tab itself. |
31
31
  | **`fields`** * | The fields to render within this tab. |
32
32
  | **`description`** | Optionally render a description within this tab to describe the contents of the tab itself. |
@@ -14,7 +14,7 @@ keywords: text, fields, config, configuration, documentation, Content Management
14
14
 
15
15
  | Option | Description |
16
16
  | ---------------- | ----------- |
17
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
17
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
18
18
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
19
19
  | **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
20
20
  | **`minLength`** | Used by the default validation function to ensure values are of a minimum character length. |
@@ -14,7 +14,7 @@ keywords: textarea, fields, config, configuration, documentation, Content Manage
14
14
 
15
15
  | Option | Description |
16
16
  | ---------------- | ----------- |
17
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
17
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
18
18
  | **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
19
19
  | **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
20
20
  | **`minLength`** | Used by the default validation function to ensure values are of a minimum character length. |
@@ -25,7 +25,7 @@ keywords: upload, images media, fields, config, configuration, documentation, Co
25
25
 
26
26
  | Option | Description |
27
27
  | ---------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
28
- | **`name`** * | To be used as the property name when stored and retrieved from the database. |
28
+ | **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
29
29
  | **`*relationTo`** * | Provide a single collection `slug` to allow this field to accept a relation to. <strong>Note: the related collection must be configured to support Uploads.</strong> |
30
30
  | **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-upload-options). |
31
31
  | **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Node, React and MongoDB Headless CMS and Application Framework",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -1,2 +0,0 @@
1
- import { Field } from '../../../../fields/config/types';
2
- export declare const getFieldPath: (path: string, field: Field) => string;
@@ -1,6 +0,0 @@
1
- import { fieldAffectsData } from '../../../../fields/config/types';
2
- export const getFieldPath = (path, field) => {
3
- // prevents duplicate . on nesting non-named fields
4
- const dot = path && path.slice(-1) === '.' ? '' : '.';
5
- return `${path ? `${path}${dot}` : ''}${fieldAffectsData(field) ? field.name : ''}`;
6
- };