Compare commits

...

1416 Commits

Author SHA1 Message Date
James
bf0b114b70 chore(release): v1.10.3 2023-06-29 20:22:40 -04:00
James Mikrut
68b220ff73 Merge pull request #2943 from payloadcms/fix/#2937
fix: #2937, depth not being respected in graphql rich text fields
2023-06-29 20:13:32 -04:00
James
f84b4323e2 fix: #2937, depth not being respected in graphql rich text fields 2023-06-29 20:08:39 -04:00
Jacob Fletcher
0112f4c4ab chore: builds custom server example (#2920) 2023-06-28 16:35:41 -04:00
Jacob Fletcher
6670915323 chore: adds ecommerce template (#2929) 2023-06-28 12:51:17 -04:00
Jacob Fletcher
49f117e220 chore: adds website template (#2928) 2023-06-28 12:48:08 -04:00
James Mikrut
8df4b15116 Merge pull request #2927 from payloadcms/fix/show-updatedAt-date
fix: shows updatedAt date when selecting a version to compare
2023-06-28 12:03:37 -04:00
Jacob Fletcher
766b1b5286 chore: creates templates directory (#2921) 2023-06-28 11:20:59 -04:00
Tylan Davis
3c9dab3b9d fix: shows updatedAt date when selecting a version to compare from dropdown 2023-06-28 10:47:41 -04:00
James Mikrut
7d156ef555 Merge pull request #2910 from payloadcms/chore/error-messages
chore: improves error messaging in unlock/reset/forgot-password
2023-06-28 08:18:28 -04:00
James
1aa38f8fdd chore(release): v1.10.2 2023-06-26 17:58:23 -04:00
Jarrod Flesch
a2d9ef3ca6 fix: adjusts swc loader to only exclude non ts/tsx files - #2888 (#2907) 2023-06-26 13:53:08 -04:00
Jessica Boezwinkle
9fbd7476fb chore: improves error messaging in unlock/reset/forgot-password 2023-06-26 18:39:46 +01:00
Jarrod Flesch
f627277479 fix: correctly scopes data variable within bulk update - #2901 (#2904) 2023-06-26 11:56:53 -04:00
Jessica Chowdhury
0d17d4f38e Merge pull request #2903 from payloadcms/fix/autosave-localized-docs
fix: autosave on localized fields, adds test
2023-06-26 16:00:51 +01:00
Jessica Boezwinkle
7e98cf94f3 chore: remove comments from test 2023-06-26 16:00:21 +01:00
Jessica Boezwinkle
6893231f85 fix: autosave on localized fields, adds test 2023-06-26 15:27:30 +01:00
Elliot DeNolf
8206c0fe8b fix: safely check for tempFilePath when updating media document (#2899) 2023-06-23 15:35:12 -04:00
Teun Mooij
837dcccefe fix: broken export of entityToJSONSchema (#2894) 2023-06-22 16:21:37 -04:00
Dan Ribbens
3e05598b56 chore(release): v1.10.1 2023-06-22 14:38:28 -04:00
Dan Ribbens
8128de64df fix: Relationship hasMany and filterOptions fails above 10 items (#2891) 2023-06-22 14:28:03 -04:00
Jarrod Flesch
b83d788d3c fix: conditional fields perf bug - #2886 (#2890) 2023-06-22 13:51:24 -04:00
PatrikKozak
6e62aab66e Merge pull request #2817 from payloadcms/chore/api-keys-docs
Chore/api keys docs
2023-06-22 11:08:27 -04:00
PatrikKozak
5de3515fc8 chore: re-words portion of api key docs 2023-06-22 10:43:53 -04:00
PatrikKozak
65ac61f300 Merge branch 'master' of https://github.com/payloadcms/payload into chore/api-keys-docs 2023-06-22 10:10:28 -04:00
Jacob Fletcher
10b8d492b3 docs: vercel visual editing (#2883) 2023-06-21 17:56:54 -04:00
Jacob Fletcher
09c6cad3e8 fix: cutoff tooltips in relationship field (#2873) 2023-06-20 17:49:18 -04:00
Dan Ribbens
e4df1293d2 chore(release): v1.10.0 2023-06-20 17:19:31 -04:00
Dan Ribbens
ce84174554 fix: relationship field query pagination (#2871) 2023-06-20 17:03:40 -04:00
Jacob Fletcher
ba9d6336ac fix: mobile loading overlay width #2866 (#2867) 2023-06-20 16:05:48 -04:00
Jacob Fletcher
e90c2c4cb7 chore: simplifies relationship drawer field test (#2872) 2023-06-20 16:04:54 -04:00
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
Alessio Gravili
542b5362d3 fix: drawer fields are read-only if opened from a hasMany relationship (#2843) 2023-06-20 11:22:49 -04:00
Jacob Fletcher
8626dc6b1a fix: fields in relationship drawer not usable #2815 (#2870) 2023-06-20 11:21:23 -04:00
Alessio Gravili
a110ba2dc0 fix: drawer close on backspace (#2869) 2023-06-20 10:10:29 -04:00
James
85d2467d73 fix: #2831, persists payloadAPI through local operations that accept req 2023-06-19 15:57:04 -04:00
Dan Ribbens
99f38098dd fix: default sort with near operator (#2862) 2023-06-19 15:17:22 -04:00
James Mikrut
b1123a4978 Merge pull request #2856 from payloadcms/feat/conditional-logic-perf
feat: optimizes conditional logic performance
2023-06-19 15:03:50 -04:00
James
4af8d56479 chore: ensures conditions are run in all appropriate cases 2023-06-19 15:03:34 -04:00
digitaledge-git
16118960aa fix: near query sorting by distance and pagination (#2861) 2023-06-19 14:54:40 -04:00
James
2c5a737715 chore: fixes initial state for url field 2023-06-19 13:39:11 -04:00
James Mikrut
5fa77d40b9 Merge pull request #2858 from payloadcms/fix/#2842
fix: #2842, querying number custom ids with in
2023-06-19 11:18:58 -04:00
Alessio Gravili
e9106882f7 feat: automatically redirect a user back to their originally requested URL after login (#2838) 2023-06-19 11:15:58 -04:00
James Mikrut
42f0db4251 Merge pull request #2800 from AlessioGr/improve-error
chore: improve error message during webpack load
2023-06-19 11:13:42 -04:00
James Mikrut
c3533dac2a Merge pull request #2846 from dpnolte/chore/disable_eslint_for_generated_types
chore: disable eslint on generated types
2023-06-19 11:11:48 -04:00
James Mikrut
8d52e5f078 Merge pull request #2830 from payloadcms/chore/depth-docs
chore: updates depth docs with N + 1 concept
2023-06-19 11:10:08 -04:00
James
116e9ffe81 fix: #2842, querying number custom ids with in 2023-06-19 11:02:30 -04:00
James
967f217346 feat: optimizes conditional logic performance 2023-06-19 10:48:17 -04:00
James Mikrut
da2a94d0b2 Merge pull request #2850 from AlessioGr/fix-configToJSONSchema
fix: old entityToJSONSchema being exported
2023-06-19 10:28:02 -04:00
James Mikrut
6c2b726fe1 Merge pull request #2855 from payloadcms/fix/#2832
fix: #2832, slow like queries with lots of records
2023-06-19 10:18:49 -04:00
James
4dd703a6bf fix: slow like queries with lots of records 2023-06-19 10:13:47 -04:00
Alessio Gravili
762b572c51 configToJSONSchema 2023-06-18 17:24:58 +02:00
Derk Nolte
6ca371cb8b chore: disable eslint on generated types 2023-06-18 10:14:21 +02:00
Alessio Gravili
0d8d7f358d fix: deprecate min/max in exchange for minRows and maxRows for relationship field (#2826)
* fix: deprecate min/max in exchange for minRows and maxRows for relationship

* fix: update validations unit tests with minRows and maxRows

* fix: incorrect types

* move to sanitize
2023-06-18 02:09:30 +02:00
James
51c2ab1672 chore(release): v1.9.5 2023-06-16 17:41:40 -04:00
James
a88f86cc3f chore: ensures objectid within works properly 2023-06-16 17:37:15 -04:00
James
451c8c7548 chore(release): v1.9.4 2023-06-16 16:43:40 -04:00
James Mikrut
528645d407 Merge pull request #2791 from no-heroes/fix/pagination-false-totaldocs
fix: totalDocs is always 1 when using payload.find({ pagination: false })
2023-06-16 16:37:50 -04:00
James
70cf8487e7 chore(release): v1.9.3 2023-06-16 16:17:34 -04:00
James
aa09e566e0 Merge branch 'master' of github.com:payloadcms/payload 2023-06-16 15:50:16 -04:00
James
c3d6e1b490 fix: ensures relations to object ids can be queried on 2023-06-16 15:50:09 -04:00
Jarrod Flesch
6580f43e53 chore: relocates configToJSON alongside entityToJSON and fieldsToJSON (#2827) 2023-06-16 12:42:59 -04:00
Jarrod Flesch
56d7745139 fix: adds custom property to ui field in joi validation (#2835) 2023-06-16 09:09:31 -04:00
PatrikKozak
ee1c7db915 chore: updates depth docs with N + 1 concept 2023-06-15 16:59:27 -04:00
Jarrod Flesch
b682c76dc7 chore: cleans up graphql-schema-gen test folder 2023-06-15 09:54:53 -04:00
Dan Ribbens
0d035a9c23 chore: update changelog release notes v1.9.2 2023-06-14 11:33:07 -04:00
Dan Ribbens
8310950f7b chore(release): v1.9.2 2023-06-14 11:32:14 -04:00
Jacob Fletcher
120e2936fe chore: removes cms text from instances of payload name (#2793) 2023-06-14 10:31:29 -04:00
Alessio Gravili
884f7991c4 chore: remove --legacy-peer-deps from gh actions workflow (#2814) 2023-06-14 10:23:48 -04:00
Tylan Davis
9664e4b96f chore: version diff styles (#2824)
Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>
2023-06-14 10:21:23 -04:00
Dan Ribbens
63cd7fbd0c fix: #2821 i18n ui field label (#2823) 2023-06-14 08:39:45 -04:00
Tylan Davis
346a48f871 fix: adds missing dark-mode styles for version differences view (#2812)
Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>
2023-06-14 08:29:13 -04:00
Jessica Boezwinkle
8fe3e59e76 Merge branch 'docs/misc-updates' 2023-06-13 17:35:52 +01:00
Jessica Boezwinkle
74d6156e8d chore: adds credentials to rest api examples 2023-06-13 17:35:39 +01:00
PatrikKozak
e834424a4c Merge branch 'master' of https://github.com/payloadcms/payload into chore/api-keys-docs 2023-06-13 12:25:09 -04:00
PatrikKozak
465d8b0245 chore: updates authentication/api-keys docs 2023-06-13 12:25:02 -04:00
Jessica Boezwinkle
25e9c1a50a fix: adds async await to payload.init example 2023-06-13 17:02:35 +01:00
Jessica Boezwinkle
d601cdd29e fix: adds async await to payload.init example 2023-06-13 17:01:55 +01:00
Jessica Chowdhury
5646ce9d8f Merge pull request #2810 from payloadcms/docs/blocks-table
docs: fix blocks table
2023-06-13 09:28:56 +01:00
Jessica Boezwinkle
f7cacbe932 docs: fix blocks table 2023-06-12 17:27:18 +01:00
Alessio Gravili
abe38520aa fix: user can be created without having to specify an email - #2801 2023-06-12 17:35:06 +02:00
Jarrod Flesch
46a5f41721 fix: sanitize reset password result - #2805 (#2808) 2023-06-12 11:23:24 -04:00
Alessio Gravili
2aea4150a0 improve error message 2023-06-10 21:53:30 +02:00
James
4b2b4c3f9f chore(release): v1.9.1 2023-06-09 16:18:47 -04:00
PatrikKozak
b655809903 Merge pull request #2797 from payloadcms/feat/customize-upload-filename
Feat/customize upload filename
2023-06-09 14:58:06 -04:00
PatrikKozak
2e60830f6a Merge branch 'master' of https://github.com/payloadcms/payload into feat/customize-upload-filename 2023-06-09 14:41:45 -04:00
PatrikKozak
752b5456b9 chore: updates test/uploads test to check for value not text 2023-06-09 14:28:27 -04:00
PatrikKozak
35f7677d48 chore: updates test/fields uploads test to check for value not text 2023-06-09 13:34:24 -04:00
PatrikKozak
a3b7da25bc Merge branch 'master' of https://github.com/payloadcms/payload into feat/customize-upload-filename 2023-06-09 12:39:01 -04:00
PatrikKozak
596eea1f0a feat: adds option to customize filename on upload 2023-06-09 12:38:53 -04:00
Jarrod Flesch
725aa3183d chore: stubs out config for field perf testing 2023-06-09 11:27:18 -04:00
Jarrod Flesch
cf49f53809 Merge remote-tracking branch 'origin' into feat/array-rows 2023-06-09 11:03:41 -04:00
Jarrod Flesch
20c7e37345 chore: block array fixes 2023-06-08 11:49:54 -04:00
Alessio Gravili
38e962f2cb feat: collection list view custom components: BeforeList, BeforeListTable, AfterListTable, AfterList (#2792) 2023-06-08 09:33:16 -04:00
Jarrod Flesch
3efb651589 chore: simplifies get/set doc prefs 2023-06-07 22:47:56 -04:00
Jarrod Flesch
589eb3fa15 chore: removes console logs, accounts for initCollapsed 2023-06-07 22:31:36 -04:00
Jarrod Flesch
87554e9b16 chore: builds rows on init, refactors preferences for documents 2023-06-07 22:21:08 -04:00
Richard van Heuven van Staereling
2e73938534 fix: incorrectly return totalDocs=1 instead of the correct count when pagination=false 2023-06-07 23:36:59 +02:00
Richard van Heuven van Staereling
acf2564c73 chore: adds test to check totalDocs count when querying with pagination=false 2023-06-07 23:36:51 +02:00
Dan Ribbens
91dba7be88 chore(release): v1.9.0 2023-06-07 16:59:38 -04:00
Elliot DeNolf
b49591c236 docs: add troubleshooting section, CORS troubleshoot (#2790) 2023-06-07 16:40:34 -04:00
Jarrod Flesch
8458a98eff feat: custom type interfaces (#2709)
* feat: ability to hoist type interfaces and reuse them

* docs: organizes ts and gql docs, adds section for field interfaces on both
2023-06-07 12:48:41 -04:00
Dan Ribbens
a518480292 chore(release): v1.8.6 2023-06-07 09:36:32 -04:00
Jarrod Flesch
a324feae9d chore: fixes graphql overview mdx file 2023-06-06 21:37:41 -04:00
Jarrod Flesch
551f1bd09f Merge remote-tracking branch 'origin/master' into feat/array-rows 2023-06-06 17:12:28 -04:00
Elliot DeNolf
d5dfe4224d test: entityToJSONSchema test for optional arrays with required fields 2023-06-06 16:35:36 -04:00
James
f1fc305ac4 fix: improperly typing optional arrays with required fields as required 2023-06-06 16:22:06 -04:00
Dan Ribbens
37ca5d827b chore: updated yarn lock 2023-06-06 15:20:14 -04:00
Jacob Fletcher
1aa257df4b chore: uses discord vanity urls (#2786) 2023-06-06 15:07:24 -04:00
Dan Ribbens
e4843061f0 Merge branch 'master' of github.com:payloadcms/payload 2023-06-06 14:50:33 -04:00
Alessio Gravili
3c72f3303c fix: read-only Auth fields (#2781) 2023-06-06 14:50:15 -04:00
Alessio Gravili
60f5522e67 fix: read-only Auth fields (#2781) 2023-06-06 14:50:03 -04:00
Dan Ribbens
576af01b6f fix: #2711 index sortable field global versions fields (#2775) 2023-06-06 14:46:14 -04:00
Dan Ribbens
8b767a166a fix: #2771 relationship field not querying all collections (#2774) 2023-06-06 14:26:13 -04:00
Jarrod Flesch
684c1a81a4 chore: exposes all operator in ts type (#2777) 2023-06-06 13:47:45 -04:00
Dan Ribbens
7a72f2f88d Merge branch 'master' of github.com:payloadcms/payload 2023-06-06 11:32:46 -04:00
James Mikrut
21ddcf07f7 Merge pull request #2779 from payloadcms/fix/#2767-bulk-operation-locales
fix: #2778 bulk operations missing locales in admin requests
2023-06-06 11:17:41 -04:00
James Mikrut
03b1ee0896 chore: remove passport local mongoose (#2713) 2023-06-06 10:07:47 -04:00
Dan Ribbens
e30871a96f fix: #2767 bulk operations missing locales in admin requests 2023-06-05 17:26:08 -04:00
Jacob Fletcher
3677cf688d fix: flattens relationships in the update operation for globals #2766 (#2776) 2023-06-05 17:22:57 -04:00
Jacob Fletcher
863be3d852 fix: adjusts activation constraint of draggable nodes (#2773) 2023-06-05 14:22:40 -04:00
Jarrod Flesch
2b4cf08f3a chore: combines array and block row state into array field attribute 2023-06-05 12:35:20 -04:00
Alessio Gravili
bd017bf56b chore: update launch config (#2772) 2023-06-05 12:22:58 -04:00
Alessio Gravili
ce7acff6d6 chore: add alternative vscode launch config (#2759) 2023-06-05 12:01:51 -04:00
Jarrod Flesch
536d7017ee fix: recursiveNestedPaths not merging existing fields when hoisting row/collapsible fields (#2769) 2023-06-04 08:49:23 -04:00
James
7c03e5510c chore(release): v1.8.5 2023-06-02 17:22:37 -07:00
James
ceb9b87783 Merge branch 'master' of github.com:payloadcms/payload 2023-06-02 17:02:29 -07:00
James
42afa6b48a feat: allows objectid through relationship validation 2023-06-02 17:02:10 -07:00
Dan Ribbens
3c7d57a73b chore: update changelog 2023-06-02 15:10:13 -04:00
Dan Ribbens
dcfd06c425 chore(release): v1.8.4 2023-06-02 15:08:08 -04:00
Alessio Gravili
23be263dd2 fix: RichText link custom fields (#2756)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-06-02 13:55:46 -04:00
Jarrod Flesch
f978299868 fix: graphql where types on rows and collapsible's (#2758)
Co-authored-by: Kári Yngvason <kari@hugsmidjan.is>
Co-authored-by: NikolaGanchev <62907292+NikolaGanchev@users.noreply.github.com>
Co-authored-by: James <james@trbl.design>
2023-06-02 13:50:19 -04:00
Jacob Fletcher
dbb0137ea0 chore: updates README 2023-06-02 12:12:29 -04:00
NikolaGanchev
51108c02ea feat: Add Bulgarian translation (#2753) 2023-06-01 18:43:17 -04:00
Alessio Gravili
69b97bbc59 fix: mongoose connection (#2754) 2023-06-01 12:03:47 -04:00
Dan Ribbens
f2399bc05a chore: fix bad merge 2023-05-31 15:56:57 -04:00
Dan Ribbens
93a85dd937 chore: allow custom mongourl during test (#2743)
Co-authored-by: swenzel <swen.wenzel@thearc.de>
Co-authored-by: PatrikKozak <patrik@trbl.design>
2023-05-31 15:51:49 -04:00
Jessica Chowdhury
8ee9724277 fix: fix locale popup overflow (#2737)
* fix: fix locale popup overflow

* chore: refines locale selector css

---------

Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-05-30 15:49:30 -04:00
PatrikKozak
7c446ec71a Merge pull request #2636 from AlessioGr/test-console-log-admin-url
fix: console log correct admin URL for tests
2023-05-30 15:07:28 -04:00
Jessica Chowdhury
f2451d03c1 chore: formats filesize to KB in upload collection list view (#2734) 2023-05-30 14:45:12 -04:00
Jarrod Flesch
0986282f13 fix: adds timestamps to global schemas (#2738) 2023-05-30 14:37:43 -04:00
Jessica Chowdhury
d3638bcb24 Merge pull request #2730 from StLyn4/typing-fixes
fix: typing of sendEmail function
2023-05-30 18:45:39 +01:00
Jessica Chowdhury
f386d1caad Merge pull request #2731 from payloadcms/fix/2729-code-editor-options
fix: adjusts code field joi schema to allow editorOptions
2023-05-30 18:30:37 +01:00
Jacob Fletcher
480c7b3e21 Merge pull request #2736 from payloadcms/fix/use-as-title
fix: searches on correct useAsTitle field in polymorphic list drawers
2023-05-30 13:11:03 -04:00
Jacob Fletcher
908d5747a8 chore: allows super-admins to view as tenant in multi-tenant example (#2719) 2023-05-30 13:10:14 -04:00
Jacob Fletcher
9ec2a40274 fix: searches on correct useAsTitle field in polymorphic list drawers #2710 2023-05-30 12:41:28 -04:00
James Mikrut
a080a6294c Merge pull request #2733 from payloadcms/chore/ui-field-doc
chore: updates ui field docs to show admin.components.Field is required
2023-05-30 12:05:05 -04:00
PatrikKozak
9be854a1a4 chore: updates ui field docs to show admin.components.Field is required 2023-05-30 12:01:33 -04:00
Jacob Fletcher
c76dc77e64 chore: writes e2e test for list drawer useAsTitle search 2023-05-30 11:28:26 -04:00
Elliot DeNolf
a42f17ca41 chore: use Discord vanity URL 2023-05-30 09:57:02 -04:00
Jarrod Flesch
ed136fbc51 fix: adjusts code field joi schema to allow editorOptions 2023-05-30 08:56:37 -04:00
Vsevolod Volkov
e3ff4c46cb fix: typing of sendMail function
Signed-off-by: Vsevolod Volkov <st.lyn4@gmail.com>
2023-05-30 14:31:19 +03:00
Jacob Fletcher
6125b66286 fix: removes payload dependency inception (#2717) 2023-05-26 16:24:10 -04:00
Jarrod Flesch
8285bac2f5 fix: corrects relationship field schema from pr #2696 (#2714) 2023-05-26 11:03:02 -04:00
James Mikrut
61bb0fae53 fix: username / email inconsistency when creating new users
Fixed UserExistsError error message
2023-05-25 20:47:05 -04:00
Jessica Chowdhury
47b9af970b Merge pull request #2665 from payloadcms/example/emails
example: email
2023-05-25 18:22:45 +01:00
Jarrod Flesch
731c85337b chore: stop tests from re-running when a PR body is edited (#2712) 2023-05-25 09:28:02 -04:00
James Mikrut
4b59fda56f Merge pull request #2708 from payloadcms/jmikrut-patch-1
Update overview.mdx
2023-05-24 15:16:53 -04:00
James Mikrut
2361221198 Update overview.mdx 2023-05-24 15:16:14 -04:00
Dan Ribbens
d931ba9b50 chore: update changelog 2023-05-24 13:12:53 -04:00
Dan Ribbens
51fd1db4eb chore(release): v1.8.3 2023-05-24 12:00:55 -04:00
Dan Ribbens
dbd4dd215a chore: yarn lock 2023-05-24 11:44:31 -04:00
Jarrod Flesch
c716954e89 fix: adds credentials to doc access request (#2705) 2023-05-24 10:39:03 -04:00
TomDo1234
5be247da0a Merge branch 'master' of https://github.com/TomDo1234/payload 2023-05-24 07:18:27 +10:00
TomDo1234
b47e84369c fixed UserExistsError message to say email instead of username 2023-05-24 07:12:58 +10:00
TomDo1234
fe7ddf3e0f Merge branch 'master' of https://github.com/TomDo1234/payload 2023-05-24 06:42:46 +10:00
Jacob Fletcher
2fc9288870 feat: builds multi-tenant example (#2689)
* feat: builds multi-tenant example

* chore: updates seed script logic
2023-05-23 16:40:18 -04:00
Jarrod Flesch
f9de807daa Fix: correct graphql param types (#2696)
* chore: colocates gql schema field types with operators
* chore: adds missing `json` gql field schema
* fix: corrects graphql `id` type from JSON to String
2023-05-23 15:27:35 -04:00
Jacob Fletcher
e85ce4eaf2 Merge pull request #2694 from payloadcms/fix/rel-drawer-save
fix: add new relationship drawer onSave handling
2023-05-23 15:24:22 -04:00
Jacob Fletcher
5fc36333b9 Merge pull request #2699 from payloadcms/fix/mobile-rel
fix: unable to clear relationships or open relationship drawer on mobile
2023-05-23 15:24:01 -04:00
Jacob Fletcher
2809cb910c chore: fixes broken test for externally updated relationships 2023-05-23 10:37:52 -04:00
Jacob Fletcher
782f8ca047 fix: unable to clear relationships or open relationship drawer on mobile #2691 #2692 2023-05-23 10:08:16 -04:00
Quentin Beauperin
8bdbd6b073 docs: fix global hooks intro anchor links (#2695) 2023-05-23 09:31:22 -04:00
James Mikrut
7fbd5adaa2 Merge pull request #2687 from payloadcms/chore/install-doc-mongo-uri-secret
chore: updates installation doc to use envs in server.ts example
2023-05-23 08:46:20 -04:00
James Mikrut
324ca171a3 Merge pull request #2693 from payloadcms/fix/2685-graphql-relations
Fix/2685 graphql relations
2023-05-23 08:37:53 -04:00
Jacob Fletcher
bbf114b822 chore: writes e2e test for relationships created using the document drawer 2023-05-22 23:59:09 -04:00
Jacob Fletcher
a2a8ac9549 fix: prevents add new relationship modal from adding duplicative values to the parent doc #2688 2023-05-22 18:01:23 -04:00
Jacob Fletcher
ae384306eb chore: threads operation through the default edit view onSave handler 2023-05-22 17:13:35 -04:00
James Mikrut
9c4e003315 Merge pull request #2690 from payloadcms/fix/#2662
fix: #2662, draft=true querying by id
2023-05-22 16:43:41 -04:00
James
9bb5470342 fix: #2685, graphql querying relationships with custom id 2023-05-22 16:40:24 -04:00
Elliot DeNolf
2f209e3e9b chore: recreate issue in test dir 2023-05-22 16:14:28 -04:00
James
314ddbd44c chore: tests 2023-05-22 15:50:54 -04:00
James
3b78ab04c7 fix: #2662, draft=true querying by id 2023-05-22 15:46:04 -04:00
Dan Ribbens
bb21f51f74 Merge branch 'fix/safely-validate-relationships' 2023-05-22 13:58:47 -04:00
Dan Ribbens
666c2383ba chore: lint fix 2023-05-22 13:58:25 -04:00
James
2703853edb fix: safely validates null relations 2023-05-22 13:46:11 -04:00
PatrikKozak
f728fca036 chore: updates installation doc to use envs in server.ts example 2023-05-22 11:29:41 -04:00
Dan Ribbens
368103d76d Merge branch 'master' of github.com:payloadcms/payload 2023-05-20 05:00:08 -04:00
Quentin Beauperin
3a2462baba docs: add missing admin.group property in configuration/globals (#2684) 2023-05-20 04:35:50 -04:00
Jessica Boezwinkle
bd2bfbbb93 docs: spacing fix on graphql docs 2023-05-19 16:59:23 +01:00
Jessica Boezwinkle
1300fc864c docs: additional params for find operation rest-api 2023-05-19 15:10:24 +01:00
Jessica Boezwinkle
ef2d17922b docs: adds rest-api examples for real this time 2023-05-19 14:49:06 +01:00
Dan Ribbens
b63dd40512 chore: release-it config update to include pre release on github 2023-05-18 12:00:49 -04:00
Quy Luong
fb82567f03 chore: fix and improve Vietnamese translation (#2651) 2023-05-18 11:57:22 -04:00
James Mikrut
b2c443e866 fix: #2647, slate not reinitializing after row change (#2653) 2023-05-18 11:56:25 -04:00
Jacob Fletcher
07d0324a6d Merge pull request #2677 from payloadcms/docs/node-version
docs: node version
2023-05-17 17:13:47 -04:00
Jacob Fletcher
c1e92ad27d fix: modal overflow caused by unused button tooltips (#2676) 2023-05-17 17:13:04 -04:00
Jacob Fletcher
28e481c2e2 Merge pull request #2656 from payloadcms/feat/peer-dep-conflicts
fix: peer dependencies
2023-05-17 17:12:39 -04:00
Jacob Fletcher
1ceea645b6 chore: replaces instances of the text Mongo with MongoDB 2023-05-17 16:35:55 -04:00
Jacob Fletcher
578e5e7e58 docs: updates node version requirement to v14 in installation docs 2023-05-17 16:29:03 -04:00
Jacob Fletcher
463d00732f chore: removes unused peer dependencies 2023-05-17 15:32:23 -04:00
Jacob Fletcher
698a8abe6e chore: fixes failing e2e test when searching within a relationship field 2023-05-17 12:25:24 -04:00
Roody
776877291f chore: Spelling and Grammar Fixes in German Translations (#2667) 2023-05-17 11:04:11 -04:00
Jacob Fletcher
1c25d965ac fix: react-select styles 2023-05-16 12:03:58 -04:00
Jessica Boezwinkle
bc41f81303 example: adds email example 2023-05-16 11:07:33 +01:00
Jarrod Flesch
648c38414e fix: disabled select fields 2023-05-15 16:49:40 -04:00
PatrikKozak
02b972e1ed fix: corrects sendEmail error logger (#2663) 2023-05-15 16:11:33 -04:00
Jacob Fletcher
dd38a08746 chore: bumps @trbl/eslint-config to v3.0.1 2023-05-12 17:50:29 -04:00
Jacob Fletcher
315b0059da chore: migrates to react-select v5.7.3 2023-05-12 17:50:24 -04:00
James
4d3ea70d2b chore: resolves all peer dep conflicts besides react-select 2023-05-12 11:50:05 -04:00
Dan Ribbens
29a0dcffc7 chore(release): v1.8.2 2023-05-10 18:44:00 -04:00
Dan Ribbens
1732bb877c fix: react webpack alias 2023-05-10 18:35:01 -04:00
Dan Ribbens
fc1fac08c8 chore(release): v1.8.1 2023-05-10 18:25:54 -04:00
Dan Ribbens
1d03de333c Revert "Merge pull request #2572 from wesdimiceli/fix/provide-plugin-package-resolution"
This reverts commit 4f5b811383, reversing
changes made to 776cad427d.
2023-05-10 18:12:39 -04:00
Dan Ribbens
74f086a460 Merge branch 'master' of github.com:payloadcms/payload 2023-05-10 15:00:02 -04:00
Dan Ribbens
6e93e3e25d chore: release v1.8.0 2023-05-10 14:45:42 -04:00
Jessica Boezwinkle
d53d0cb439 chore: updates payload version on example repos 2023-05-10 15:56:57 +01:00
Paul
3f185cb18b feat: export additional graphql types (#2610)
* Add paginatedType to graphQL on collections types

* Refactor config query and mutation extension into a reusable type

* Export paginatedListType and payload's version of graphql

* Revert prettier's automatic changes

* Fix requested changes

* Add additional documentation for extending GraphQL

* Add information about the resolver's first argument
2023-05-10 08:53:46 -04:00
Paul
7963e7540f fix: add dotenv.config() to test/dev.ts (#2646) 2023-05-10 08:47:22 -04:00
Angelo Bartolome
85316879cd feat: allow users to manipulate images without needing to resize them (#2574)
* Refactor imageResizer.ts to allow for keeping original size in certain cases

* revert new property for keeping desired size

* add unit tests for maintained image size feature
2023-05-10 08:44:53 -04:00
Jacob Fletcher
69c4760f37 chore: migrates react-router-dom to v5.1 (#2637) 2023-05-09 10:35:37 -04:00
Dan Ribbens
7d04cf14fb feat: add Arabic translations (#2641) 2023-05-09 10:15:23 -04:00
Quentin Beauperin
9072096495 fix: softens columns and filters pill colors (#2642) 2023-05-08 17:59:41 -04:00
Elliot DeNolf
f6cfe15807 Merge pull request #2639 from payloadcms/chore/eslint-config
chore: migrate eslint config
2023-05-08 17:03:29 -04:00
Elliot DeNolf
e1bad04279 chore: lint fix 2023-05-08 16:49:13 -04:00
Elliot DeNolf
dda3341537 chore: upgrade rules to latest eslint-plugin-jest 2023-05-08 16:33:58 -04:00
Elliot DeNolf
6e27795756 chore: migrate @trbl/eslint-config inline 2023-05-08 16:33:19 -04:00
Dennis Snijder
54fac4a5d7 fix: Row groups in tabs vertical alignment (#2593)
* fix: removes top padding from group in row

---------

Co-authored-by: PatrikKozak <patrik@trbl.design>
2023-05-08 15:55:12 -04:00
Alessio Gravili
2697974694 fix: fix tests by hard-coding the URL in the logger 2023-05-08 19:23:09 +02:00
Elliot Lintz
a9b5dffa00 feat: allow full URL in staticURL (#2562)
* feat: support full URL for upload.staticURL

* feat: Update documentation about upload.staticURL property

* feat: Add reproduction test for absolute staticURL
2023-05-08 13:17:16 -04:00
Alessio Gravili
095ccf7194 chore: set serverURL for tests 2023-05-08 19:04:27 +02:00
James Mikrut
4f5b811383 Merge pull request #2572 from wesdimiceli/fix/provide-plugin-package-resolution
fix: resolve process/browser package in webpack config
2023-05-08 12:52:55 -04:00
James Mikrut
776cad427d Merge pull request #2635 from payloadcms/fix/2611-nested-querying
fix: ensures nested querying works when querying across collections
2023-05-08 12:49:55 -04:00
Jarrod Flesch
d365ba5303 chore: fixes test 2023-05-08 12:24:24 -04:00
Jarrod Flesch
31c0ab7ab7 chore: strengthens int test 2023-05-08 12:22:08 -04:00
Jarrod Flesch
09974fa686 fix: ensures nested querying works when querying across collections 2023-05-08 12:20:06 -04:00
James Mikrut
03cbab6c08 Merge pull request #2548 from payloadcms/docs/upload-example
chore: adds export and fields to upload example
2023-05-08 11:51:44 -04:00
James Mikrut
bbe5bff389 Merge pull request #2625 from payloadcms/fix/#2608-custom-id-text-query
fix: query custom text id fields
2023-05-08 11:51:04 -04:00
James Mikrut
f857da964b Merge pull request #2632 from payloadcms/fix/graphql-type
fix: correct casing on graphql type
2023-05-08 11:50:42 -04:00
James Mikrut
d36916b400 Merge pull request #2631 from payloadcms/fix/uploading-webp
fix: webp upload formatting
2023-05-08 11:50:22 -04:00
James Mikrut
c0568f92e4 Merge pull request #2634 from payloadcms/fix/queryHiddenFields
Fix/query hidden fields
2023-05-08 11:49:22 -04:00
James Mikrut
b17891c170 Merge pull request #2633 from payloadcms/fix/upload-schema
fix: defaultValue missing from Upload field schema
2023-05-08 11:49:04 -04:00
James
164d6e93d0 Merge branch 'master' of github.com:payloadcms/payload 2023-05-08 10:27:04 -04:00
James
733ca324d2 chore: force aliases react to avoid invalid hook call 2023-05-08 10:26:57 -04:00
PatrikKozak
fb4f822d34 fix: removes queryHiddenFields from example Find operation 2023-05-08 09:56:32 -04:00
Jessica Boezwinkle
7b21eaf12d fix: defaultValue missing from Upload field schema 2023-05-08 14:55:51 +01:00
PatrikKozak
02a4e17e41 Merge branch 'master' of https://github.com/payloadcms/payload into fix/queryHiddenFields 2023-05-08 09:53:34 -04:00
PatrikKozak
5f30dbb1a5 fix: removes deprecated queryHiddenFIelds from local API docs 2023-05-08 09:53:27 -04:00
Jessica Boezwinkle
219f50b0bc fix: correct casing on graphql type 2023-05-08 14:45:42 +01:00
Jessica Boezwinkle
ccd6ca298e fix: webp upload formatting 2023-05-08 13:15:18 +01:00
Dan Ribbens
967f2ace0e fix: query custom text id fields 2023-05-06 21:25:41 -04:00
Dan Ribbens
2c36468431 chore(release): v1.7.5 2023-05-04 16:55:46 -04:00
Hristiyan Dodov
8dbf0a2bd8 fix: make incrementName match multiple digits (#2609) 2023-05-04 16:35:55 -04:00
Michel v. Varendorff
967899229f feat: collection admin.enableRichTextLink property (#2560) 2023-05-04 16:31:40 -04:00
Jarrod Flesch
1d58007606 feat: custom admin buttons (#2618)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-05-04 16:04:06 -04:00
Jarrod Flesch
56a1dee3d6 docs: fix ui field example code block config 2023-05-04 09:33:28 -04:00
Quentin Beauperin
28572a978e docs: add hideAPIURL to the collections and globals admin options (#2614)
* fix: add the missing `hideAPIURL` admin option in the collections docs

* fix: add the missing `hideAPIURL` admin option in the globals docs
2023-05-03 19:11:56 -04:00
Jarrod Flesch
acfb9bca45 Feat/custom admin buttons (#2613) 2023-05-03 17:21:38 -04:00
Jacob Fletcher
6f82cefdc5 chore: adds cloud messaging to example READMEs (#2612) 2023-05-03 11:14:11 -04:00
James
d0ea57120c chore(release): v1.7.4 2023-05-01 22:45:37 -04:00
Elliot DeNolf
277beb6587 chore: release-it verbose logging 2023-05-01 22:19:07 -04:00
Elliot DeNolf
802deaca03 fix: properly import SwcMinifyWebpackPlugin (#2600) 2023-05-01 22:00:56 -04:00
Dan Ribbens
3c6461f757 chore(release): v1.7.3 2023-05-01 17:27:29 -04:00
James Mikrut
a0bb13a412 fix: #2592, allows usage of hidden fields within access query constraints (#2599)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-05-01 17:15:14 -04:00
Elliot DeNolf
870838e756 feat: adjust stack trace for api error (#2598) 2023-05-01 16:50:48 -04:00
Jarrod Flesch
8f6f13dc93 fix: addds workaround for slate isBlock function issue (#2596) 2023-05-01 16:30:01 -04:00
Harrison-Blair
13179a9498 chore: misc documentation updates (#2589)
* chore: ensures example configs are being exported when necessary
* chore: adds note regarding updating of hidden fields

---------

Co-authored-by: Jessica Boezwinkle <jessica@trbl.design>
2023-05-01 16:28:13 -04:00
Dan Ribbens
0ba22c3aaf fix: query on id throws 500 (#2587) 2023-05-01 14:36:26 -04:00
Seied Ali Mirkarimi
311f77dd25 chore: translations fa.json (#2590)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-05-01 13:52:27 -04:00
Dan Ribbens
8382faa0af fix: bulk operations result type (#2588) 2023-05-01 13:46:17 -04:00
Dan Ribbens
9c5107e86d fix: timestamp queries (#2583) 2023-05-01 13:45:51 -04:00
Elliot DeNolf
14a6b40bcc chore: bump swc-minify-webpack-plugin (#2571) 2023-05-01 11:50:10 -04:00
Jarrod Flesch
07506ae4d9 Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-28 10:17:45 -04:00
Jarrod Flesch
6abcca1215 chore: adds github-stars md file 2023-04-28 10:17:39 -04:00
Wes DiMiceli
02f27f3de6 fix: resolve process/browser package in webpack config 2023-04-27 12:38:49 -04:00
Paul
fbf3a2a1b4 feat: Add new translation for romanian language (#2556)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-04-26 17:18:09 -04:00
Seied Ali Mirkarimi
c80f68af94 feat: add persian translations (#2553)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-04-26 16:12:11 -04:00
Perry
85b3d579d3 feat: supports collection compound indexes (#2529)
Co-authored-by: Perry Li <yuanping.li@moblab.com>
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-04-26 11:11:01 -04:00
Michel v. Varendorff
bf6522898d feat: allow customizing the link fields (#2559) 2023-04-26 11:08:47 -04:00
Jarrod Flesch
ddb34c3d83 chore: recreates yarn lock file 2023-04-25 19:13:48 -04:00
James
010ea4305b chore(release): v1.7.2 2023-04-25 14:48:57 -04:00
James
c33b226660 chore: yarn 2023-04-25 14:41:26 -04:00
Martin Choutka
8670d387d6 Feat: blocks should only search on singular labels (#2479)
* Blocks now only search on singular labels

* Add types to getBlockLabel params

---------

Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-04-25 11:40:50 -04:00
Jarrod Flesch
a684b8f8bf chore: bumps eslint and related dev deps (#2561) 2023-04-25 11:09:31 -04:00
Jessica Boezwinkle
8270d8a228 docs: typo on REST API page 2023-04-25 12:33:33 +01:00
James
48941dce07 chore: merge conflicts 2023-04-24 17:11:23 -04:00
Jacob Fletcher
d6aa06a8af Merge pull request #2551 from payloadcms/fix/doc-drawer-access
fix: document drawer access control
2023-04-24 16:56:17 -04:00
Jacob Fletcher
7a0511610e chore: prevents document drawer from making get request when creating new 2023-04-24 16:22:10 -04:00
Jacob Fletcher
451ffcd982 chore: adds testing coverage for document drawer access control 2023-04-24 15:32:45 -04:00
Jarrod Flesch
fb2fcf3f66 chore: reduce complexity of block modal state tracking 2023-04-24 15:24:45 -04:00
Jarrod Flesch
b97a0881f1 Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-24 15:23:43 -04:00
James
f9b3486ed1 Merge branch 'master' of github.com:payloadcms/payload 2023-04-24 15:16:54 -04:00
James
8cc900e11f chore: merge conflicts 2023-04-24 15:16:46 -04:00
Jarrod Flesch
904c365b75 Fix/2535 upload field access (#2550) 2023-04-24 15:16:12 -04:00
Jessica Chowdhury
362a4ccece Merge pull request #2533 from mauricewegner/feat/rich-text-blockquote
feat: add rich-text blockquote toggle, change quote node type to blockquote
2023-04-24 19:19:28 +01:00
PatrikKozak
750c6c32fa Merge pull request #2499 from AlessioGr/fix-readonly-styles
fix: read-only styles for textArea and richtext
2023-04-24 14:05:59 -04:00
Jacob Fletcher
439caf815f fix: document drawer access control #2545 2023-04-24 13:44:13 -04:00
Steven Thompson
0406548fe6 feat(imageresizer): add trim options (#2073)
* freat(imageresizer): add trim options

* fix(imageresizer): check for trimOptions config key

* feat: add trimOptions to original file upload, add test config

* chore: adjust sharp file ref

---------

Co-authored-by: Steven Thompson <steven@teamtailor.com>
Co-authored-by: Elliot DeNolf <denolfe@gmail.com>
2023-04-24 13:09:04 -04:00
Jessica Boezwinkle
4fb8b0fa28 chore: updates richText docs 2023-04-24 17:58:49 +01:00
James Mikrut
a0fd26602e Merge pull request #2051 from R0bson/master
Fix read of undefined error when autosave enabled
2023-04-24 12:51:56 -04:00
James
6d8eafd072 Merge branch 'master' of github.com:payloadcms/payload into R0bson/master 2023-04-24 12:29:03 -04:00
James
286193b4ab chore: cleanup 2023-04-24 12:27:00 -04:00
Jarrod Flesch
1808a9b663 Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-24 12:19:01 -04:00
PatrikKozak
0683dd22dd Merge pull request #2539 from DennisSnijder/fix/multivalue-draggable
Multi value Select draggable enhancement
2023-04-24 11:58:18 -04:00
Elliot Lintz
7fcde11fa0 fix: prevent floating point number in image sizes (#1935) 2023-04-24 11:19:26 -04:00
Elliot DeNolf
90dab3c445 fix: prevent sharp toFormat settings fallthrough by using clone (#2547) 2023-04-24 10:42:29 -04:00
Jessica Boezwinkle
e942a18e5a chore: adds export and fields to upload example 2023-04-24 15:32:52 +01:00
James Mikrut
d397fe9af7 Merge pull request #2531 from payloadcms/feat/expose-id-in-condition
feat: exposes id in conditional logic
2023-04-24 09:59:51 -04:00
James Mikrut
cf6f0bfb8b Merge pull request #2532 from payloadcms/fix/#2521
fix: #2521, graphql AND not working with drafts
2023-04-24 09:59:44 -04:00
James Mikrut
b628a19e35 Merge pull request #2542 from payloadcms/fix/localized-field-nonlocalized-project
fix: query localized fields without localization configured
2023-04-24 09:56:24 -04:00
Dan Ribbens
4592d981a7 chore: fields test user config regression 2023-04-21 23:31:43 -04:00
Dan Ribbens
f6db81e431 docs: add user to field conditional logic 2023-04-21 22:55:23 -04:00
Dan Ribbens
274edc74a7 feat: add user to field conditional logic 2023-04-21 22:50:47 -04:00
Dan Ribbens
12edb1cc4b fix: query localized fields without localization configured 2023-04-21 21:12:30 -04:00
Dennis Snijder
269b203ef8 Changed background for multi values on select boxes, added is-dragging property to the multi value select and applied a z-index while dragging 2023-04-21 20:23:13 +02:00
mauricewegner
ed230a42e0 feat: add rich-text blockquote element, change quote node type to blockquote 2023-04-20 21:52:05 +02:00
Elliot DeNolf
c251801b1a chore: proper url path for docker deployment 2023-04-20 13:38:22 -04:00
Elliot DeNolf
8c242450e5 docs: fix docker link from getting started page 2023-04-20 13:31:56 -04:00
James
e67ca20108 fix: #2521, graphql AND not working with drafts 2023-04-20 09:31:29 -05:00
James
c117b32147 feat: exposes id in conditional logic 2023-04-20 09:20:02 -05:00
Dan Ribbens
1c5737b68a chore: add graphql variable to collection-graphql test (#2525) 2023-04-19 09:48:31 -04:00
James
db7acb4edd chore(release): v1.7.1 2023-04-18 17:28:25 -04:00
James
72be80abc4 fix: graphql variables not being passed properly 2023-04-18 17:19:15 -04:00
Teun Mooij
023719d775 feat: configuration extension points
* added custom config extension points

* Added custom field to documentation

* fix deeprequired issue
2023-04-18 15:28:42 -04:00
James
431b04075f Merge branch 'master' of github.com:payloadcms/payload 2023-04-18 14:54:10 -04:00
James
5e02985206 fix: adds 'use client' for next 13 compatibility 2023-04-18 14:53:59 -04:00
Elliot DeNolf
b80478d4b4 chore: remove release script to prevent accidental releases 2023-04-18 09:26:41 -04:00
James
fc7fa8debd chore: changelog formatting 2023-04-17 21:53:04 -04:00
James
a4fd0df69c chore(release): v1.7.0 2023-04-17 21:47:24 -04:00
James
cb9ca3e4c9 chore: type fix 2023-04-17 21:40:56 -04:00
James
5a6447805f Merge branch 'master' of github.com:payloadcms/payload 2023-04-17 21:38:12 -04:00
James
52ae6f06a1 feat: exposes new replaceState form api 2023-04-17 21:38:06 -04:00
James Mikrut
799699894c Merge pull request #2518 from payloadcms/fix/#2494-excess-versions
fix: #2494, reduces versions caused by reverting to published with autosave: true
2023-04-17 20:24:58 -04:00
James
e0c0b2fdf6 fix: #2494, reduces versions caused by reverting to published with autosave: true 2023-04-17 20:23:56 -04:00
James Mikrut
506bf646ba Merge pull request #2515 from payloadcms/feat/abstract-query-engine
Feat/abstract query engine
2023-04-17 19:54:49 -04:00
James Mikrut
e6c94c4f36 Merge pull request #2511 from payloadcms/docs/user-token
docs: adds info on payload secret encryption
2023-04-17 19:40:39 -04:00
James
3f9bbe90bd fix: incorrect version defaults 2023-04-17 19:37:22 -04:00
Elliot DeNolf
042e58ea29 feat: support email configuration in payload config (#2485)
* feat: support email configuration in payload config

* feat: set email defaults if no email config

* chore: leftover line from testing

* feat: add warning if email configure in both init and config
2023-04-17 17:21:28 -04:00
James
7fa27686bb chore: clarity to secret key usage 2023-04-17 17:02:07 -04:00
James
e3e2d513df Merge branch 'docs/user-token' of github.com:payloadcms/payload into docs/user-token 2023-04-17 17:00:46 -04:00
James
086feafcb7 chore: cleans duplicative logic 2023-04-17 16:56:38 -04:00
Quentin Beauperin
f9b8e2dbc5 fix: hides preview button until document is saved #2476 (#2477)
Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
2023-04-17 16:55:17 -04:00
Jacob Fletcher
5eafbefa9f Merge pull request #2507 from payloadcms/fix/preview-null
feat: supports null preview url #2472
2023-04-17 16:54:41 -04:00
James
cfadaf781c chore: merge master 2023-04-17 16:50:46 -04:00
Jacob Fletcher
dab5481fc5 Merge pull request #2513 from payloadcms/fix/sidebar-spacing-2478
fix: sidebar spacing #2478
2023-04-17 16:46:37 -04:00
James
1a681dd97b chore: revises outdated tests 2023-04-17 16:46:08 -04:00
Jacob Fletcher
2074f63333 chore: corrects typo in queries overview documentation (#2475) 2023-04-17 16:45:03 -04:00
Dan Ribbens
959a5d78c7 chore: test coverage queries 2023-04-17 16:43:00 -04:00
James
995054d46b chore: adds tests to validate queries 2023-04-17 16:25:07 -04:00
James
d187b809d7 feat: refactors buildQuery to rely on fields instead of mongoose 2023-04-17 16:08:44 -04:00
Dan Ribbens
81d69d1b64 feat: add admin.hidden to collections and globals (#2487) 2023-04-17 15:21:42 -04:00
Elliot DeNolf
faef4d5f8e docs: export default typo 2023-04-17 14:12:33 -04:00
Dan Ribbens
cd548a6e2d feat: replace deprecated express-graphql dependency (#2484) 2023-04-17 13:48:14 -04:00
Jacob Fletcher
78316d4ddc chore: updates global versions test config 2023-04-17 13:43:31 -04:00
Jacob Fletcher
a45ab8bd76 fix: corrects sidebar spacing in collection and global edit views #2478 2023-04-17 13:39:16 -04:00
Jessica Boezwinkle
cd861c22b7 docs: adds info on payload secret encryption 2023-04-17 18:22:03 +01:00
Alessio Gravili
15442a9cc7 fix: use correct locale when querying relationships for list view (#2438)
* chore: use correct locale when querying relationship for list view

* chore: make sure the relationships are re-queried when the locale changes

* chore: cleans up localization test ts-types

---------

Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-04-17 12:43:33 -04:00
Elliot DeNolf
3c04d43eae docs: add custom express middleware and logging example (#2509) 2023-04-17 11:52:09 -04:00
Jacob Fletcher
63e23bab89 chore: adds translations for error:previewing 2023-04-17 11:48:28 -04:00
Jacob Fletcher
e8a24fd2e5 feat: supports null preview url #2472 2023-04-17 11:41:00 -04:00
Elliot DeNolf
aee6ca05cc fix: proper height data for animated gifs (#2506) 2023-04-17 11:34:31 -04:00
Elliot Lintz
0f8051b577 fix: Clear blocks modal search input when closing the modal (#2501) 2023-04-17 11:26:36 -04:00
Alessio Gravili
9d489ed57f actually no, background saves a few bytes 2023-04-15 19:48:28 +02:00
Alessio Gravili
ae88bade03 background => background-color 2023-04-15 19:47:31 +02:00
Alessio Gravili
4be43527e8 disable shadow for read-only textArea field 2023-04-15 19:46:06 +02:00
Alessio Gravili
823d0228c9 fix: read-only styles 2023-04-15 19:37:28 +02:00
James
2d0441a72e chore: begins work to build queries from fields instead of mongoose schema 2023-04-14 15:52:38 -04:00
Jessica Chowdhury
6ceb791891 fix: excess padding on textarea (#2488) 2023-04-13 11:56:04 -04:00
Jarrod Flesch
cd9e0400ac Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-13 08:36:52 -04:00
PatrikKozak
b9a5bb3b8e Merge pull request #2289 from payloadcms/feat/form-builder-example
Feat/form builder example
2023-04-12 11:33:16 -04:00
PatrikKozak
1387ba9ae0 chore: updates form-builder-example nextjs README 2023-04-12 10:39:58 -04:00
PatrikKozak
3dd70483c6 Merge branch 'master' of https://github.com/payloadcms/payload into feat/form-builder-example 2023-04-11 10:49:31 -04:00
James Mikrut
ec2933c49a Merge pull request #2455 from payloadcms/chore/date-docs
chore: updates date field docs
2023-04-11 10:38:57 -04:00
James Mikrut
7eec16ee61 Merge pull request #2448 from AlessioGr/patch-4
docs: explain lifecycle of validate & beforeValidate
2023-04-11 10:38:24 -04:00
James Mikrut
ff89b8f782 Merge pull request #2464 from infonomic/docs/localization-warning
Docs/localization warning
2023-04-11 10:36:58 -04:00
James Mikrut
588a7d0a5b Update overview.mdx 2023-04-11 09:44:01 -04:00
Jessica Chowdhury
19ce0d79ef fix: increase line height for global title (#2465) 2023-04-10 15:42:11 -04:00
Jarrod Flesch
7f2c3d1d0a fix: uses docPermissions to show/hide x button on media collection doc fileDetails - #2428 2023-04-10 15:40:46 -04:00
Jarrod Flesch
13cc669e2c fix: prevents rendering of version actions when a user does not have permission 2023-04-10 15:38:49 -04:00
PatrikKozak
4d515a0d5b chore: improves text-area error rendering 2023-04-10 15:23:37 -04:00
Jacob Fletcher
11a6ce6d3a fix: properly awaits email send to catch potential errors #2444 (#2470) 2023-04-10 13:50:27 -04:00
Jarrod Flesch
048dd89bbc Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-10 13:42:35 -04:00
Jarrod Flesch
48625e0e34 chore: general cleanup on useDocumentInfo hook usage 2023-04-10 13:27:29 -04:00
Anthony Bouch
013c96f0db docs: fixed sentance error in warning 2023-04-10 13:37:27 +07:00
Anthony Bouch
5fa8f69e10 docs: localization warning for existing data 2023-04-10 13:34:52 +07:00
Jessica Boezwinkle
fb89793703 docs: typo in date field and double link in textarea field 2023-04-06 11:35:15 +01:00
PatrikKozak
67098f7a3e chore: updates date field docs 2023-04-05 21:19:26 -04:00
James
299ae4fce5 chore(release): v1.6.32 2023-04-05 13:29:37 -04:00
James Mikrut
09ba58a432 Merge pull request #2454 from payloadcms/feat/only-use-sharp-if-required
feat: only uses sharp if required
2023-04-05 13:24:54 -04:00
James
f9f6ec47d9 feat: only uses sharp if required 2023-04-05 12:59:51 -04:00
Alessio Gravili
b76c25c9e7 docs: explain lifecycle of validate & beforeValida
Caused confusion here: https://discord.com/channels/967097582721572934/1091785894136139808/1092821186959921193

The initial expectation is that beforeValidate runs before any validation happens. However, it seems that client-side validation happens first nonetheless.

Please do check if this is 100% correct before merging.
2023-04-04 17:21:54 +02:00
James
192dac38f8 chore(release): v1.6.31 2023-04-04 08:25:51 -04:00
James
3a6acf322b fix: ensures select hasMany does not get mutated on patch operations 2023-04-04 08:16:10 -04:00
James
a9cd23a883 feat: improves required type accuracy 2023-04-03 22:30:24 -04:00
James
b6dec7af1c chore(release): v1.6.30 2023-04-03 16:14:20 -04:00
James Mikrut
546b7dc20a Merge pull request #2443 from payloadcms/fix/#2442-delete-local-type
fix: incorrect type local api using delete with where
2023-04-03 16:09:19 -04:00
James Mikrut
7cab14353d Merge pull request #2445 from payloadcms/fix/before-change-mutation
fix: originalDoc being mutated in beforeChange field hooks
2023-04-03 16:09:02 -04:00
James
888bbf28e0 fix: originalDoc being mutated in beforeChange field hooks 2023-04-03 15:27:59 -04:00
Dan Ribbens
de5ceb2aca fix: incorrect type local api using delete with where 2023-04-03 12:14:27 -04:00
Dan Ribbens
95719a978c chore(release): v1.6.29 2023-03-31 14:11:22 -04:00
Alessio Gravili
dd16bcffd2 chore: export formatListDrawerSlug (#2422) 2023-03-31 14:00:40 -04:00
Dan Ribbens
02410a0be3 fix: update and delete local API return types (#2434) 2023-03-31 13:58:54 -04:00
James
14f2fbbce7 chore(release): v1.6.28 2023-03-28 11:26:30 -04:00
James
8eea0d6cf4 fix: potential memory leak with probe-image-size 2023-03-28 11:21:56 -04:00
James
752a657a4f chore(release): v1.6.27 2023-03-27 18:05:23 -04:00
James
0ca5851a3c chore: roll back PR #2396 2023-03-27 18:01:40 -04:00
James Mikrut
4bb0bdc4e6 Merge pull request #2397 from zerovox/patch-2
Fix documented imports in the custom element examples
2023-03-27 16:46:27 -05:00
James Mikrut
6865634a6e Merge pull request #2396 from pascalgn/fix/admin-hidden-fields
fix: hide fields with admin.hidden attribute
2023-03-27 16:45:41 -05:00
James
07eb8dd7d2 fix: #2355, select field not fully visible on small screens in certain scenarios 2023-03-27 17:43:18 -04:00
James
789537cc8c docs: previousValue in afterChange field hook, fixes #2383 2023-03-27 16:28:43 -04:00
James
8bbb1a16e3 docs: adds pagination docs, fixes #2376 2023-03-27 16:23:57 -04:00
James
0ff81573b5 Merge branch 'master' of github.com:payloadcms/payload 2023-03-27 16:18:18 -04:00
James
90284ff626 docs: adds more clarity regarding dotenv, fixes #2378 2023-03-27 16:17:51 -04:00
James Mikrut
e4fc1ff47c Merge pull request #2402 from payloadcms/fix/textarea-overlap
fix: textarea field overlap in UI
2023-03-27 15:01:37 -05:00
James
73c7ba4fe5 Merge branch 'master' of github.com:payloadcms/payload 2023-03-27 15:39:57 -04:00
James
72a8b1eebe fix: #2384, preserves manually set verified from admin UI 2023-03-27 15:39:01 -04:00
James Mikrut
c14122a007 Merge pull request #2406 from payloadcms/docs/date-field
docs: expand on date field properties
2023-03-27 14:11:40 -05:00
James
6ca12b1cc0 fix: restoring version did not correctly create new version from result 2023-03-27 14:59:50 -04:00
Elliot DeNolf
e8dc7d462e fix: make update typing a deep partial (#2407) 2023-03-27 12:39:12 -04:00
Jessica Boezwinkle
c2ca499516 docs: update date field 2023-03-27 17:08:20 +01:00
Jessica Boezwinkle
1c8cf24ba6 fix: textarea field overlap in UI 2023-03-27 10:09:53 +01:00
ts
49e4e0c6e7 Fix AfterNavLinks too 2023-03-26 11:24:35 -06:00
ts
bc2e843a83 Fix CustomDefault example imports 2023-03-26 11:16:28 -06:00
Pascal
ad25b096b6 fix: hide fields with admin.hidden attribute 2023-03-26 12:57:06 +02:00
James
1b85f194c5 1.6.26 2023-03-24 13:54:57 -04:00
James
cffc9971c4 fix: order of afterDelete hook 2023-03-24 13:46:22 -04:00
Dan Ribbens
3a6a97618c chore(release): v1.6.25 2023-03-24 12:37:21 -04:00
Dan Ribbens
38e917a3df fix: upload field select existing file (#2392) 2023-03-24 12:19:37 -04:00
Dan Ribbens
3825041393 chore(release): v1.6.24 2023-03-23 13:15:50 -04:00
Dan Ribbens
0fedbabe9e feat: bulk-operations (#2346)
Co-authored-by: PatrikKozak <patrik@trbl.design>
2023-03-23 12:33:13 -04:00
Dan Ribbens
c5cb08c5b8 chore(release): v1.6.23 2023-03-22 14:29:45 -04:00
Jarrod Flesch
833899c893 chore: exposes AccessArgs export from payload/types 2023-03-22 13:22:11 -04:00
Jessica Chowdhury
1f480c4cd5 feat: exposes defaultSort property for collection list view (#2382) 2023-03-22 12:21:04 -04:00
Jarrod Flesch
b74a59947d chore: exports AccessArgs type for granular typing when imported 2023-03-22 11:58:23 -04:00
Dan Ribbens
21b8da7f41 fix: #2363 version tabs and select field comparisons (#2364) 2023-03-22 10:22:14 -04:00
fiona
fb2fd3e9b7 fix: DateField admin type (#2256) 2023-03-22 10:18:37 -04:00
Christian Gil
c0ff75c164 fix: Fix missing Spanish translations (#2372) 2023-03-22 10:17:47 -04:00
Dan Ribbens
e1a6e08aa1 fix: fallback to default locale showing on non-localized fields (#2316) 2023-03-22 10:16:54 -04:00
Jarrod Flesch
ac4cc5548a Update reproduction-guide.md 2023-03-21 23:40:18 -04:00
Jarrod Flesch
e0e1b09b77 chore: adds info in reproduction guide 2023-03-21 23:29:33 -04:00
Jarrod Flesch
fe86707c53 Chore/issue template (#2380) 2023-03-21 23:16:45 -04:00
Jarrod Flesch
2ed7e325b8 Issue template improvements (#2231) 2023-03-21 22:34:01 -04:00
PatrikKozak
e09ebfffa0 fix: allows base64 thumbnails (#2361) 2023-03-21 09:33:16 -04:00
Christian Gil
a8766d00a8 feat: adds title attribute to ThumbnailCard (#2368) 2023-03-20 23:15:03 -04:00
Jacob Fletcher
ef9606bf5b chore: retrofits formatUseAsTitle into ThumbnailCard #2270 (#2367) 2023-03-20 22:51:06 -04:00
Jacob Fletcher
10dd819863 fix: relationship field useAsTitle #2333 (#2350) 2023-03-20 22:21:49 -04:00
Jarrod Flesch
c14db9f94d chore: bumps slate and slate-react 2023-03-20 12:55:51 -04:00
Jarrod Flesch
c8594a7e7a chore: ensures code editor and loading shimmer use height from props 2023-03-20 12:06:36 -04:00
Jacob Fletcher
959567aade docs: middleware order #2327 (#2351) 2023-03-20 09:47:57 -04:00
Jarrod Flesch
7a8c7f3429 chore: ensures monaco editor loader is the same height as it's parent 2023-03-20 08:26:44 -04:00
James
4d578f1bfd fix: #2315 - deleting files if overwriteExistingFiles is true 2023-03-15 17:37:02 -04:00
Dan Ribbens
eabfd91655 chore(release): v1.6.22 2023-03-15 15:39:21 -04:00
Dan Ribbens
a4c6c4891e chore: update webpack dependencies 2023-03-15 15:28:16 -04:00
Dan Ribbens
11c15720d4 chore: update dependencies (#2326) 2023-03-15 14:36:56 -04:00
Franck Martin
24e92cfe69 add: missing french translations for rich-text link editor (#2322) 2023-03-15 14:12:02 -04:00
PatrikKozak
c0ab499a77 chore: adds max-width to confirmation message 2023-03-15 12:04:52 -04:00
PatrikKozak
abf74f1a90 Merge branch 'master' of https://github.com/payloadcms/payload into feat/form-builder-example 2023-03-15 11:58:48 -04:00
PatrikKozak
8e814b1edd chore: style refinements 2023-03-15 11:58:40 -04:00
James
4b243c9007 chore(release): v1.6.21 2023-03-15 10:34:47 -04:00
Jarrod Flesch
8d65ba1efd fix: hidden fields being mutated on patch (#2317) 2023-03-14 15:35:58 -04:00
Dan Ribbens
5f1b0c21eb chore(release): v1.6.20 2023-03-13 17:47:46 -04:00
Dan Ribbens
af164159fb fix: undefined point fields saving as empty object (#2313) 2023-03-13 17:34:51 -04:00
Elliot Lintz
39e303add6 fix: keep drop zone active when hovering inner elements (#2295) 2023-03-13 16:05:56 -04:00
Jarrod Flesch
9b5c889187 Merge pull request #2301 from payloadcms/fix/2270
fix: allow thumbnails in upload gallery to show useAsTitle value
2023-03-13 15:39:54 -04:00
Jarrod Flesch
dd9c15c672 chore: ensures block drawer thumbnail cards render a title properly 2023-03-13 15:26:10 -04:00
Jarrod Flesch
92e9602329 Merge pull request #2310 from payloadcms/fix/2292
fix: allows useListDrawer to work without collectionSlugs defined
2023-03-13 15:12:33 -04:00
James Mikrut
dbf976ee5e Merge pull request #2278 from wkillerud/fix/relationmap-undefined
fix: check relationships indexed access for undefined
2023-03-13 12:08:32 -07:00
James Mikrut
927b3fb6d3 Merge pull request #2291 from joas8211/feat/provide-refresh-permissions
feature: provide refresh permissions
2023-03-13 12:07:10 -07:00
James Mikrut
5e84ca3ce7 Merge pull request #2294 from Elliot67/fix/favicon-404
fix: Prevent browser initial favicon request
2023-03-13 12:05:26 -07:00
James Mikrut
3b2daa1992 Merge pull request #2296 from Firfi/master
chore: rename index.tsx of Pages collection of Preview example into index.ts
2023-03-13 12:04:54 -07:00
James Mikrut
a19c42f1bd fix: tooltip position #2108
fix: tooltip position #2108
2023-03-13 11:47:35 -07:00
PatrikKozak
fc82661b54 Merge pull request #2311 from payloadcms/fix/search-row-titles
Fix/search row titles
2023-03-13 14:46:09 -04:00
James Mikrut
4e95a39132 Merge pull request #2306 from payloadcms/fix/pagination-global-admin-type
Fix/pagination global admin type
2023-03-13 11:38:23 -07:00
PatrikKozak
5a637a8b09 Merge branch 'master' of https://github.com/payloadcms/payload into fix/search-row-titles 2023-03-13 14:30:05 -04:00
PatrikKozak
75e776ddb4 fix: flattens title fields to allow seaching by title if title inside Row field 2023-03-13 14:29:59 -04:00
Jessica Boezwinkle
e1553c2fc8 fix: allows useListDrawer to work without collectionSlugs defined 2023-03-13 18:23:58 +00:00
James Mikrut
db6d35bc03 Merge pull request #2308 from payloadcms/fix/#2265
fix: cancels existing fetches if new fetches are started
2023-03-13 11:19:45 -07:00
James
d5bf957c8e chore: only throws errors in usePayloadAPI if signal is not aborted 2023-03-13 13:54:58 -04:00
Jarrod Flesch
566c45b0b4 fix: ensures documentID exists in doc documentDrawers (#2304) 2023-03-13 12:06:07 -04:00
Jarrod Flesch
39ee306630 chore: adds duplicate caret to track intersection with 2023-03-13 12:04:26 -04:00
PatrikKozak
748475f785 Merge branch 'master' of https://github.com/payloadcms/payload into fix/pagination-global-admin-type 2023-03-13 11:41:58 -04:00
PatrikKozak
bf9929e9a9 fix: removes pagination type from top level admin config types 2023-03-13 11:41:50 -04:00
Jarrod Flesch
9aa1b8ec47 Merge remote-tracking branch 'origin/master' into fix/tooltip-position 2023-03-13 11:28:41 -04:00
James
ccc92fdb75 fix: cancels existing fetches if new fetches are started 2023-03-13 11:22:10 -04:00
James
657aa65e99 fix: removes forced require on array, block, group ts 2023-03-13 11:12:11 -04:00
James
abebde6b12 feat: exposes useTheme hook 2023-03-13 10:58:02 -04:00
Elliot Lintz
1df3d149e0 feat: #2280 Improve UX of paginator (#2293) 2023-03-13 10:12:41 -04:00
James Mikrut
8832d08a22 Merge pull request #2286 from payloadcms/fix/ui-columns
fix: renders presentational table columns
2023-03-13 06:52:07 -07:00
Jacob Fletcher
51dc66b5d9 poc: tooltip position #2108 2023-03-13 09:27:08 -04:00
Jessica Boezwinkle
aae6d716e5 fix: allow thumbnails in upload gallery to show useAsTitle value 2023-03-13 11:29:56 +00:00
Igor Loskutov
32b38439e3 chore: rename index.tsx of Pages collection of Preview example into index.ts 2023-03-12 16:08:50 +07:00
Elliot67
fd8ea88488 fix: Prevent browser initial favicon request 2023-03-12 00:09:07 +01:00
Jesse Sivonen
8d1df96637 docs: add refreshPermissions 2023-03-11 17:18:52 +02:00
Jesse Sivonen
c1f205c2cf test: refresh-permissions 2023-03-11 16:56:22 +02:00
Jesse Sivonen
e9c796e42c feat: provide refresh permissions for auth context 2023-03-11 16:56:01 +02:00
PatrikKozak
b459277c72 feat: updates form-builder example READMEs 2023-03-10 12:03:00 -05:00
PatrikKozak
28ecb0c5eb feat: migrates form builder example nextjs to examples 2023-03-10 11:50:41 -05:00
PatrikKozak
1356b4db40 chore: migrates form builder example cms to examples 2023-03-10 10:55:31 -05:00
Jacob Fletcher
4e1748fb8a fix: renders presentational table columns 2023-03-10 08:59:34 -05:00
William Killerud
959f01739c fix: check relationships indexed access for undefined 2023-03-09 15:09:09 +01:00
James
85dee9a7bc chore(release): v1.6.19 2023-03-08 16:40:05 -08:00
James
057522c5bd fix: ensures nested fields save properly within link, upload rte 2023-03-08 16:36:46 -08:00
James
9a8c6deafb chore(release): v1.6.18 2023-03-08 16:17:38 -08:00
James
7daddf864d fix: #2272, rich text within blocks causing crash on reorder 2023-03-08 16:07:08 -08:00
James
ef826c88ec fix: allows swc/register to transpile files above current workspace 2023-03-08 15:23:38 -08:00
Jarrod Flesch
42fbd96040 Fix/2254 swap relationship (#2261) 2023-03-07 14:27:44 -05:00
Jacob Fletcher
889a55ad99 Merge pull request #2260 from payloadcms/fix/table-column-prefs
fix: column preferences
2023-03-07 14:08:09 -05:00
Jacob Fletcher
3c205bcaba chore: writes e2e test for drawer column retention 2023-03-07 13:52:47 -05:00
Jacob Fletcher
a1ddd2e2e3 fix: table column preferences sync 2023-03-07 13:49:35 -05:00
Jacob Fletcher
5a07b788c7 Merge pull request #2258 from payloadcms/fix/table-columns-2257
Fix/table columns 2257
2023-03-07 10:53:05 -05:00
Jacob Fletcher
5d84a98d7b chore: writes e2e test for duplicative base fields 2023-03-07 10:34:21 -05:00
Jacob Fletcher
b92ad4a2d6 chore: writes e2e test for row fields as table columns 2023-03-07 10:34:12 -05:00
Jacob Fletcher
b10e842e89 fix: renders row fields as table columns #2257 2023-03-07 10:24:27 -05:00
James
bc7d4d8f0e chore(release): v1.6.17 2023-03-06 17:30:25 -05:00
James Mikrut
12c0e09c65 Merge pull request #2248 from payloadcms/fix/2218
Ensure empty objects are preserved within fields with sub schemas
2023-03-06 17:24:40 -05:00
Jarrod Flesch
c447421b05 chore: fixes outdated json field test 2023-03-06 17:06:37 -05:00
James Mikrut
0779f8d73d feat: improves ui performance with thousands of fields
* chore: progress to ui-performance

* chore: removes block load testing
2023-03-06 16:46:07 -05:00
Jarrod Flesch
ace032ef89 fix: minimize not set to false on all field type schemas 2023-03-06 16:08:03 -05:00
Jarrod Flesch
c5f9fa0d97 chore: adds test to empty json objects REST api 2023-03-06 12:27:26 -05:00
James Mikrut
ada9a89cd2 Merge pull request #2237 from payloadcms/feat/relationship-min-max-validation
feat: adds min and max options to relationship with hasMany
2023-03-06 11:48:20 -05:00
James Mikrut
27e538c8c6 Merge pull request #2216 from davidko604/versionsAllowDiskUse
Add allowDiskUse parameter for aggregate query for draft versions
2023-03-06 11:47:31 -05:00
James Mikrut
8bfe63d5b2 Merge pull request #2246 from payloadcms/fix/#2243
fix: Validate typescript signature
2023-03-06 11:39:27 -05:00
James Mikrut
65bbf54b4a Merge pull request #2223 from no-heroes/fix/chaining-hooks
Fix: when chaining hooks, afterRead does not take previous doc but original doc
2023-03-06 11:27:25 -05:00
James
8d31ed6d39 fix: Validate typescript signature 2023-03-06 11:24:36 -05:00
Dan Ribbens
a7f72babe1 test: fix validation options reuse 2023-03-04 16:57:02 -05:00
Dan Ribbens
87a60325cf docs: adds min and max options to relationship with hasMany 2023-03-04 16:23:28 -05:00
Dan Ribbens
0f38a0dcf6 feat: adds min and max options to relationship with hasMany 2023-03-04 16:12:07 -05:00
Jacob Fletcher
812ab9f868 fix: conditionally renders draggable pill (#2224) 2023-03-03 11:36:53 -05:00
Danilo Silva
ea893671d5 chore: refines portuguese translations (#2171) 2023-03-03 11:36:16 -05:00
Jacob Fletcher
474a3cbf7a fix: removes duplicative fields from table columns #2221 (#2226) 2023-03-03 11:35:38 -05:00
Jacob Fletcher
066f5f6d2c fix: versions table (#2235) 2023-03-03 11:23:16 -05:00
Richard van Heuven van Staereling
c661ac2e8a fix: pass result of previous hook into next hook 2023-03-02 17:05:25 +01:00
Richard van Heuven van Staereling
cb005d58eb chore: adds test cases for chaining hooks 2023-03-02 17:05:08 +01:00
Richard van Heuven van Staereling
6c82c1e04f chore: adds collection type to test chaining hooks 2023-03-02 17:04:37 +01:00
davidko604
feebf203b8 Update docs 2023-03-01 12:08:18 -08:00
davidko604
40033c64fb Add allowDiskUse parameter to draft versions aggregate query 2023-03-01 11:27:31 -08:00
Dan Ribbens
ffdbe3c965 Merge branch 'master' of github.com:payloadcms/payload 2023-03-01 12:12:32 -05:00
Dan Ribbens
6e740dbfc1 chore: changelog v1.6.16 2023-03-01 12:11:57 -05:00
Jessica Chowdhury
f6eb0202fe fix: virtual fields example (#2214) 2023-03-01 12:02:24 -05:00
Dan Ribbens
38aa4c45c4 chore: cleanup list unused list files (#2211) 2023-02-28 15:58:15 -05:00
Dan Ribbens
122aa94bdb chore: fix yaml indent (#2210) 2023-02-28 15:21:43 -05:00
PatrikKozak
5aa203d020 fix: redirects example (#2209) 2023-02-28 14:54:13 -05:00
James
aac066d609 chore: version bump 2023-02-28 14:10:37 -05:00
James
70fe14f7af Merge branch 'master' of github.com:payloadcms/payload 2023-02-28 14:10:21 -05:00
James
de2ae5ec15 chore: ensures data is passed to buildStateFromSchema 2023-02-28 14:06:13 -05:00
Jarrod Flesch
45b36ce56d chore: improves empty object json field tests (#2207) 2023-02-28 10:51:38 -05:00
James Mikrut
f7a2ae7e55 Merge pull request #2206 from payloadcms/fix/2189-empty-json
fix: allows empty objects to be retained in db
2023-02-28 10:45:46 -05:00
Jarrod Flesch
0247e2d106 fix: allows empty objects to be retained in db 2023-02-28 10:40:21 -05:00
James Mikrut
237aff9c85 Merge pull request #2200 from payloadcms/fix/#2179
fix: #2179, async default values resetting form state
2023-02-28 09:52:00 -05:00
James Mikrut
51911cdfdf Merge pull request #2196 from payloadcms/fix/#2193-globals-publish
fix: globals publish after draft
2023-02-28 09:51:26 -05:00
James
f64b2b1321 chore: adds back 14.x 2023-02-28 09:47:46 -05:00
James
8caedb19dd Merge branch 'master' of github.com:payloadcms/payload into fix/#2179 2023-02-28 09:47:20 -05:00
Jacob Fletcher
e2c65e3fa5 feat: drag-and-drop columns (#2142) 2023-02-28 09:35:03 -05:00
Jacob Fletcher
523d9d4952 fix: renders rte upload drawer #2178 2023-02-28 09:08:16 -05:00
Dan Ribbens
4cd228a367 chore: split getLatestEntityVersion to separate globals and collections 2023-02-28 09:03:28 -05:00
Dan Ribbens
44651e6ecc fix: globals publish after draft 2023-02-28 09:03:28 -05:00
Elliot DeNolf
b0b82e1f57 ci: playwright artifacts (#2201)
* ci: playwright report

* chore: update playwright report location

* ci: trace file only on failure

* ci: reduce test timeout

* test: up the rateLimit
2023-02-27 21:58:11 -05:00
James
619b49f6f1 chore: attempts to remove node 14.x 2023-02-27 18:18:10 -05:00
James Mikrut
ce3bb96ff7 Merge pull request #2198 from payloadcms/fix/drafts-enabled-validation
fix: skips field validation on submit if skipValidation is set to true
2023-02-27 17:04:05 -05:00
James
a4de51adaa fix: #2179, async default values resetting form state 2023-02-27 17:01:15 -05:00
James Mikrut
861a0fdff9 Merge pull request #2199 from payloadcms/fix/#2150-nth-level-querying
fix: #2150, can now query on N number of levels deep
2023-02-27 16:33:49 -05:00
James Mikrut
c1e8b20f1b Merge pull request #2197 from payloadcms/fix/animated-image-uploads
Fix/animated image uploads
2023-02-27 16:27:07 -05:00
James
ac54b11f9d fix: #2150, can now query on N number of levels deep 2023-02-27 16:17:44 -05:00
PatrikKozak
cf17760735 fix: skips field validation on submit if skipValidation is set to true 2023-02-27 15:35:52 -05:00
PatrikKozak
31488ffdd6 Merge branch 'master' of https://github.com/payloadcms/payload into fix/animated-image-uploads 2023-02-27 15:09:13 -05:00
PatrikKozak
8c4f890af0 fix: properly resizes animated images (#2181) 2023-02-27 15:09:06 -05:00
Elliot DeNolf
5ac436e184 fix: properly set req.payload on forgotPassword in local API (#2194) 2023-02-27 14:31:25 -05:00
Dan Ribbens
387cec9838 fix: clear relationship value (#2188) 2023-02-27 12:44:12 -05:00
Dan Ribbens
a3cc3c3429 fix: version comparison view errors on old select value (#2163) 2023-02-27 12:43:26 -05:00
James Mikrut
bf620fe16f Merge pull request #2172 from philipgher/patch-1
fix: add a mention to the possibility of accessing nested properties
2023-02-27 11:58:51 -05:00
zsoltsimon97
ebd16e8fdf feat: Add Hungarian Translations (#2169)
Co-authored-by: Zsolt Simon <zsolt.simon@telcotrend.hu>
2023-02-27 09:21:42 -05:00
philipgher
ee06515ca9 Update overview.mdx 2023-02-23 22:01:55 +01:00
James
d0abf19037 chore: skips flaky test 2023-02-22 14:03:33 -05:00
James
0d6a27cc69 chore: adds further safety to flaky test 2023-02-22 13:42:35 -05:00
James
164b868dc2 chore: attempts to resolve flaky test 2023-02-22 13:02:40 -05:00
James
c87fd2b649 fix: ensures sorting on drafts works in all cases 2023-02-22 11:09:01 -05:00
James
c4cc283bcd chore(release): v1.6.15 2023-02-21 18:18:32 -05:00
James
cbfabeeb9d chore: fixes bad import 2023-02-21 17:46:56 -05:00
James Mikrut
e84c43a4f6 Merge pull request #2158 from payloadcms/fix/#2092-use-facet-error
fix: mongoose connection error with useFacet
2023-02-21 17:36:49 -05:00
James
83720c8277 chore: adds 'use client' to withCondition 2023-02-21 17:31:59 -05:00
Dan Ribbens
5888fb9b3f fix: mongoose connection error with useFacet 2023-02-21 14:29:42 -05:00
Dan Ribbens
985eb59893 chore(release): v1.6.14 2023-02-21 10:07:11 -05:00
Dan Ribbens
2a4db3896e fix: #2117 collection pagination defaultLimit (#2147) 2023-02-21 09:41:34 -05:00
James Mikrut
9ea1512df9 Merge pull request #2149 from payloadcms/fix/#2148
fix: #2148, adds queryHiddenFields property to find operation
2023-02-20 21:16:27 -05:00
James
15b6bb3d75 fix: #2148, adds queryHiddenFields property to find operation 2023-02-20 21:15:06 -05:00
Christian Gil
d9d2b6c383 docs: Update uploads example based on Sharp types (#2129) 2023-02-20 14:29:28 -05:00
Dan Ribbens
8a8c392095 fix: #2091 admin translations for filter operators (#2143) 2023-02-20 13:54:43 -05:00
Dan Ribbens
b4a20741b2 fix: useFacet config option to disable $facet aggregation (#2141) 2023-02-20 13:54:12 -05:00
Dan Ribbens
007d38be04 chore: locking dependency for compatibility with node 16.x (#2146) 2023-02-20 13:52:50 -05:00
Jessica Chowdhury
40224ed1bc fix: checks locale is valid for monaco code editor (#2144) 2023-02-20 13:52:04 -05:00
Elliot DeNolf
f3f246848a docs: add example local api script 2023-02-20 11:09:22 -05:00
James Mikrut
a6917d8952 Merge pull request #2124 from jmas/patch-2
Fix table in `docs/admin/overview.mdx`
2023-02-20 10:29:16 -05:00
James Mikrut
a60b5acb65 Merge pull request #2140 from payloadcms/fix/#2131
fix: #2131, doesn't log in unverified user after resetting password
2023-02-19 22:12:47 -05:00
James
753de21b12 chore: improves reset password / verification workflow 2023-02-19 22:11:28 -05:00
James
3eb85b1554 fix: #2131, doesn't log in unverified user after resetting password 2023-02-19 22:06:39 -05:00
James Mikrut
7109bfde52 Merge pull request #2139 from payloadcms/fix/#2096
fix: #2096, allows custom ts paths with payload generate:types
2023-02-19 21:37:52 -05:00
James
686a616b4c fix: #2096, allows custom ts paths with payload generate:types 2023-02-19 21:37:10 -05:00
Elliot DeNolf
7e8869858c fix: generate proper json field type according to rfc (#2137) 2023-02-19 21:31:07 -05:00
James Mikrut
a16bad0cc0 Merge pull request #2136 from payloadcms/fix/#2134-rich-text-link-population
fix: #2134, allows links to be populated without having relationship or upload enabled
2023-02-19 21:18:27 -05:00
James
32a0778fc4 fix: #2134, allows links to be populated without having relationship or upload enabled 2023-02-19 21:17:25 -05:00
Jacob Fletcher
6a7663beb5 fix: removes custom header and gutter from rte link drawer #2120 (#2135) 2023-02-19 21:07:32 -05:00
Elliot DeNolf
06fc8cbf4d chore: sizes property optional on create graphql resolver 2023-02-19 21:04:41 -05:00
Daniel Söderling
79d047e64f fix: sizes property optional on upload (#2066)
* omit 'sizes' when uploading files from the inferred collection type

* cleanup

* optional sizes on create and update, instead of omitted
2023-02-19 21:02:37 -05:00
James
ab27b1bfd1 chore(release): v1.6.13 2023-02-18 11:01:39 -05:00
James
42ebf68932 fix: #2125, ensures createdAt and updatedAt are returned in update operations 2023-02-18 10:56:09 -05:00
James
5c5f1f9735 chore: inaccurate group field docs, fixes #2118 2023-02-18 09:33:31 -05:00
Alex Maslakov
3965613154 Fix table in docs/admin/overview.mdx
Found that table in docs Admin > Overview section is broken. I prepared a small fix.
2023-02-18 02:14:11 +02:00
James
8ac0906ff0 chore(release): v1.6.12 2023-02-17 17:07:34 -05:00
James
62879a5bc4 Merge branch 'master' of github.com:payloadcms/payload 2023-02-17 16:59:22 -05:00
James
ff4d1f6ac2 feat: separates admin root component from DOM render logic 2023-02-17 16:45:54 -05:00
James
1930bc260e fix: ensures only valid fields can be queried on 2023-02-17 16:45:18 -05:00
Jacob Fletcher
fa32c27716 feat: adds gql auth example (#2115) 2023-02-16 22:31:41 -05:00
Jacob Fletcher
ebdfd8f69a chore: adds @payloadcms/eslint-config to examples (#2112) 2023-02-16 15:10:41 -05:00
Jessica Chowdhury
2af0c04c8a feat: virtual fields example (#1990) 2023-02-16 10:26:25 -05:00
Jacob Fletcher
cfb3632cbc Merge pull request #2107 from payloadcms/feat/auth-example
feat: auth example
2023-02-16 10:24:36 -05:00
Jacob Fletcher
c076c77db4 feat: auth example 2023-02-15 18:49:08 -05:00
James
f9bcf359a1 chore(release): v1.6.11 2023-02-15 14:52:08 -05:00
James
bf2e5c70f8 Merge branch 'master' of github.com:payloadcms/payload 2023-02-15 14:46:29 -05:00
James
ad3141dc00 chore: updates types for passing async config to InitOptions 2023-02-15 14:46:21 -05:00
Jacob Fletcher
e0eb93bf83 Merge pull request #2105 from payloadcms/example/preview
feat: adds preview example
2023-02-15 14:39:34 -05:00
Jacob Fletcher
7a99b2544a chore: reviews preview example 2023-02-15 14:23:09 -05:00
Jarrod Flesch
2089136671 chore: improves test for max versions (#2102) 2023-02-15 13:10:07 -05:00
Jacob Fletcher
e36f775273 chore: writes test for existing upload deletion (#2103) 2023-02-15 11:39:13 -05:00
Jacob Fletcher
060c3805e5 fix: existing upload deletion #2098 (#2101) 2023-02-15 10:15:30 -05:00
Dan Ribbens
3c3e1f17ef chore(release): v1.6.10 2023-02-14 09:53:16 -05:00
James
8abc9cfbc7 Merge branch 'master' of github.com:payloadcms/payload 2023-02-14 09:40:40 -05:00
James
7bb0984a12 fix: validate type 2023-02-14 09:40:18 -05:00
Dan Ribbens
586b25a54c fix: #2077 useAPIKey UI missing with disableLocalStrategy (#2084) 2023-02-13 22:33:01 -05:00
PatrikKozak
c655ceac9e chore: richtext p tag reference (#2085) 2023-02-13 22:30:04 -05:00
Lucas Levin
d4c1e0deb0 docs: date field pickerAppearance defaults (#2086) 2023-02-13 21:46:30 -05:00
PatrikKozak
e2ed0ccaea chore: removes leftover p tag reference (#2081) 2023-02-13 16:27:18 -05:00
Jarrod Flesch
4999fbaee6 fix: globals not saving drafts unless published first (#2082) 2023-02-13 16:25:43 -05:00
Jarrod Flesch
f80ad26081 Merge pull request #2079 from payloadcms/fix/2064-createdAt-versions
fix: ensures versions createdAt matches the original doc
2023-02-13 15:30:04 -05:00
Christian Gil
b4a7e912b2 fix: Use the user's AdminUI locale for the DatePicker (#2046) (#2057)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-02-13 14:47:26 -05:00
PatrikKozak
0a87f106ec feat: preview example (#1950) 2023-02-13 13:42:28 -05:00
Jacob Fletcher
b0a66ce6d8 chore: e2e tests for relationship default value (#2080) 2023-02-13 12:58:53 -05:00
Jarrod Flesch
8c7e37c56a fix: ensures versions createdAt matches the original doc 2023-02-13 11:03:12 -05:00
Jacob Fletcher
9f30553813 feat: async plugins (#2030)
* feat: async plugins

* wip: async config

* fix: async config
2023-02-13 10:46:55 -05:00
James Mikrut
11532857d2 Merge pull request #2070 from payloadcms/feat/rel-add-new
feat: allows control over relationship add new button
2023-02-13 10:43:56 -05:00
James Mikrut
c975a6c8ba Merge pull request #2061 from payloadcms/feat/export-more-errors
feat: export more errors
2023-02-13 09:30:08 -05:00
Jacob Fletcher
6096044fe0 feat: allows control over relationship add new button 2023-02-13 00:23:31 -05:00
Elliot DeNolf
3ebe7b4a7e docs: add docker link to deployment toc 2023-02-11 14:05:57 -05:00
Elliot DeNolf
a1fd1e07f0 docs: add an initial Basics section to talk about the dist and build directories 2023-02-11 14:03:36 -05:00
Jarrod Flesch
9029dab015 Merge pull request #2050 from behilam/fix/update-document-type
fix: Document type in collection update request handler
2023-02-10 22:41:09 -05:00
Jarrod Flesch
e9e084d933 Merge pull request #2059 from charkour/patch-2
docs: updates radio.mdx for better readability and consistency
2023-02-10 22:38:34 -05:00
Jarrod Flesch
93129f8989 Merge pull request #2060 from ChrisGV04/fix/es-translations
fix: add missing Spanish translations and fix typos
2023-02-10 22:34:43 -05:00
Jarrod Flesch
7e676b4b8d Merge pull request #2062 from nikolicstjepan/master
fix typo in Croatian translation
2023-02-10 22:33:08 -05:00
Stjepan Nikolic
f9cb02026e fix typo in croatian translation 2023-02-10 21:03:43 +01:00
Elliot DeNolf
3a2a41d2b6 feat: export more errors 2023-02-10 14:21:38 -05:00
James
ee658a6e9b chore(release): v1.6.9 2023-02-10 12:38:51 -05:00
James
b7d56b6fce chore: manually bumps payload version 2023-02-10 12:29:11 -05:00
James
d2254c1255 chore: allows buildPath to be defined in config validation 2023-02-10 12:22:06 -05:00
James
4d259a69f2 feat: allows customization of the folder used to serve admin bundled files in production 2023-02-10 12:20:46 -05:00
James
8c50ae6071 Merge branch 'master' of github.com:payloadcms/payload 2023-02-10 12:16:53 -05:00
James
40ecd206e6 Merge branch 'fix/max-versions' of github.com:payloadcms/payload 2023-02-10 12:08:03 -05:00
Jarrod Flesch
9fed4f1c49 chore: simplifies query 2023-02-10 12:07:45 -05:00
James
ecac445fb2 Merge branch 'fix/max-versions' of github.com:payloadcms/payload 2023-02-10 12:07:40 -05:00
Christian Gil
c4742e5c30 fix: Add missing Spanish translations and fix typos 2023-02-10 11:06:13 -06:00
Charles Kornoelje
55aec55ef2 Update radio.mdx 2023-02-10 11:54:30 -05:00
Jarrod Flesch
8e95383afe chore: accounts for globals in filter query 2023-02-10 11:53:57 -05:00
Charles Kornoelje
e072dad30c Update radio.mdx
Matches the pattern in the documentation of `title = {label} Field`
2023-02-10 11:50:51 -05:00
Jarrod Flesch
30688bbe41 fix: adds query constraint to ensureMaxVersions query 2023-02-10 11:37:36 -05:00
Robert
4c22b2a7d9 Fix read of undefined error when autosave enabled
Fixes ERROR (payload): TypeError: Cannot read properties of undefined (reading '<field.name>')
    at promise (...\payload\src\fields\hooks\afterChange\promise.ts:68:23)
    at ...\payload\src\fields\hooks\afterChange\traverseFields.ts:31:26
    at Array.forEach (<anonymous>)
    at traverseFields (...\payload\src\fields\hooks\afterChange\traverseFields.ts:30:10)
    at promise (...\payload\src\fields\hooks\afterChange\promise.ts:154:27)
    at ...\payload\src\fields\hooks\afterChange\traverseFields.ts:31:26
    at Array.forEach (<anonymous>)
    at traverseFields (...\payload\src\fields\hooks\afterChange\traverseFields.ts:30:10)
    at promise (...\payload\src\fields\hooks\afterChange\promise.ts:170:27)
    at ...\payload\src\fields\hooks\afterChange\traverseFields.ts:31:26
2023-02-09 22:26:26 +01:00
Behilam
d5cd9709f7 fix: document type in update request handler 2023-02-09 12:27:08 -05:00
Jonas Voisard
dddbec2682 fix: translation of "or" -> "ou" in french (#2047)
## Description

Fixed a wrong translation

- I have read and understand the CONTRIBUTING.md document in this repository

## Type of change
- fix of tiny error of translation
2023-02-09 08:22:39 -05:00
James
cfc5533920 chore(release): v1.6.7 2023-02-08 14:19:49 -05:00
James Mikrut
caa4c07e3e Merge pull request #2042 from payloadcms/fix/2040-drawer-initial-state
fix: missing state in document drawers when opened
2023-02-08 09:33:27 -05:00
Jarrod Flesch
e6ac872b0d fix: drawer state was not set when opened 2023-02-08 08:36:06 -05:00
James
d42b5d4989 chore(release): v1.6.6 2023-02-07 16:06:26 -05:00
James Mikrut
6d72d66656 Merge pull request #2035 from payloadcms/fix/#1887-dataloader-infinite-loop
fix: #1887, dataloader rich text population infinite loop
2023-02-07 14:50:33 -05:00
James
3a8e730b9c chore: typo in tests 2023-02-07 14:40:33 -05:00
James
ac2e174643 fix: #1887, dataloader rich text population infinite loop 2023-02-07 14:35:37 -05:00
Elliot DeNolf
777794583c docs: add tsconfig aliasing to generating types docs 2023-02-07 14:23:58 -05:00
James
cff6608996 chore: updates date field tests 2023-02-07 13:44:09 -05:00
James
972dd3e174 Merge branch 'fix/datepicker-i18n' of github.com:payloadcms/payload 2023-02-07 13:20:48 -05:00
Jessica Boezwinkle
3bc67e338b chore: updates dateTimeFormat 2023-02-07 17:42:56 +00:00
James
4cd2c8c1d9 chore(release): v1.6.5 2023-02-07 12:38:21 -05:00
Jacob Fletcher
224b68dbf2 chore: fixes failing uploads e2e test 2023-02-07 12:32:08 -05:00
Jarrod Flesch
851983af15 Fix: #1991 - enableRichTextRelationships breaking unrelated list drawers (#2000)
* fix: adds RTE provider, to allow for disabledRTE relationships from breaking other drawers

* chore: updates hook name

* chore: simplifies list drawer rendering

* chore: simplify types

* chore: adds arg to determine what listType drawer to render

* chore: renames listType to contentType, fix upload field drawer

* chore: requires collectionSlugs in useListDrawer

* chore(test): adds tests for list drawers, relationships and uploads

* chore: formatting

* chore: cleans up types, collectionSlugs are required for useListDrawer

* chore: removes RichTextProvider

* chore: removes hoc in favor of FC hoc

* chore: fixes fc hoc
2023-02-07 11:57:23 -05:00
James Mikrut
96a90bbca4 Merge pull request #1978 from payloadcms/fix/1897
fix: removes old media when replaced and re-renders on save
2023-02-07 11:53:05 -05:00
James Mikrut
922887fe77 Merge pull request #2034 from payloadcms/hotfix/max-versions
fix: max versions incorrectly sorting and removing
2023-02-07 11:48:00 -05:00
James Mikrut
0bebb4e7ef Merge pull request #2029 from payloadcms/fix/#1997-absolute-imports-css
fix: webpack css-loader resolve urls
2023-02-07 11:47:22 -05:00
Jarrod Flesch
2e4f7ab35c fix: max versions incorrectly sorting, causing incorrect versions to be held onto 2023-02-07 11:29:25 -05:00
Dan Ribbens
a828ec7c3c chore: set webpack name from test suite for caching (#2027) 2023-02-07 10:38:25 -05:00
Jarrod Flesch
a4514c790b Merge pull request #2025 from payloadcms/fix/checkbox-focus
fix: corrects keyboard accessibility for checkbox field
2023-02-07 08:56:14 -05:00
Jarrod Flesch
b162285f13 Merge pull request #2021 from payloadcms/fix/radio-focus
fix: allows radio input to be keyboard accessible
2023-02-07 08:48:38 -05:00
Jarrod Flesch
bdb2f8939a chore: removes input from tab flow with css 2023-02-07 08:44:31 -05:00
Jarrod Flesch
66465897a9 chore: removes extra margin from hidden radio inputs 2023-02-07 08:34:21 -05:00
Jessica Boezwinkle
43e9c32ec6 chore: removes formatted locale list 2023-02-07 10:45:12 +00:00
Jessica Boezwinkle
6032605341 chore: consolidates focus styling 2023-02-07 10:15:42 +00:00
Jessica Boezwinkle
e40fe65272 chore: consolidates styles 2023-02-07 10:09:04 +00:00
Jarrod Flesch
2ba355c76f Merge pull request #2032 from payloadcms/fix/2020-empty-version-tabs-ui 2023-02-06 22:02:48 -05:00
Jarrod Flesch
b321b07ad5 chore: fixes stalling tests 2023-02-06 21:48:50 -05:00
Jarrod Flesch
a41e295e42 fix: named tabs not displaying data in versions view 2023-02-06 21:35:00 -05:00
xHomu
4b0d4f4cd5 fix: local API update typing (#2010)
* Fix Local API update typing

Payload allows for updating doc with only partial data, but the inferred type requires the whole collection type. 
#2009

* fix typos

* chore: further typing of update operation

---------

Co-authored-by: Elliot DeNolf <denolfe@gmail.com>
2023-02-06 17:32:37 -05:00
Dan Ribbens
ade4c011d3 fix: webpack css-loader resolve urls 2023-02-06 16:43:16 -05:00
Jacob Fletcher
2b654882fd chore: writes uploads e2e test for mimetype filter options #2016 (#2028) 2023-02-06 16:30:51 -05:00
Jarrod Flesch
58abeecb11 Merge pull request #2005 from payloadcms/fix/account-preview-button
fix: ensures preview is enabled before rendering button on account view
2023-02-06 16:21:24 -05:00
Elliot DeNolf
1f0a1c796a fix: auth type leaking into type gen 2023-02-06 16:14:59 -05:00
Jacob Fletcher
dd56ceb700 chore: resolves env path in redirects example (#2026) 2023-02-06 13:34:10 -05:00
Jessica Boezwinkle
090906c559 chore: adds datepicker types and updates datepicker version 2023-02-06 17:45:17 +00:00
Jessica Boezwinkle
65b8fd27af fix: corrects keyboard accessibility for checkbox field 2023-02-06 17:40:00 +00:00
Jacob Fletcher
e6ed676117 chore: passing uploads-related e2e tests 2023-02-06 12:25:05 -05:00
Jacob Fletcher
827428d6b5 fix: replaced media not rendering after document save 2023-02-06 12:25:05 -05:00
Jacob Fletcher
02f9be2c4a feat: deletes old media upon re-upload #1897 2023-02-06 12:25:03 -05:00
Jessica Boezwinkle
aefb655769 fix: enables locales with date field 2023-02-06 17:13:47 +00:00
Jacob Fletcher
5214b331e0 Merge pull request #2015 from payloadcms/chore/redirects
chore: adds redirects example
2023-02-06 10:21:34 -05:00
Jessica Boezwinkle
b5880f26af fix: allows radio input to be tabbable 2023-02-06 12:51:57 +00:00
Jacob Fletcher
59e5a457ef chore: refines redirects example 2023-02-06 07:48:04 -05:00
Jacob Fletcher
0dbc4fa213 feat: enables document drawers from read-only fields (#1989) 2023-02-04 10:42:51 -05:00
PatrikKozak
d51e93b86e chore: scaffolds redirects example (#1993) 2023-02-04 10:25:25 -05:00
James
071462b33b chore(release): v1.6.4 2023-02-03 11:48:03 -05:00
James
f2d11cfcaf chore: new yarn lock 2023-02-03 11:41:12 -05:00
James
90c9bf879f Merge branch 'master' of github.com:payloadcms/payload 2023-02-03 11:35:34 -05:00
James
e813394eb4 chore: docs accuracy 2023-02-03 11:35:23 -05:00
James
8c65f6a938 fix: only hoists localized values if localization is enabled 2023-02-03 11:35:19 -05:00
Jarrod Flesch
e968f4067c fix: ensures preview is enabled before rendering button 2023-02-02 16:08:42 -05:00
Elliot DeNolf
1fd61fb989 chore: add .nvmrc to mirror .node-version 2023-02-01 16:49:55 -05:00
Elliot DeNolf
eb9d860af3 chore: check version config before version delete attempt (#1995) 2023-02-01 16:44:17 -05:00
Elliot DeNolf
12ed655881 feat: support large file uploads (#1981)
* feat: support express-fileupload useTempFiles and tempFileDir

* feat: rework uploads to accommodate useTempFiles option

* fix: properly check versions config before handling version deletion

* chore: fix aspect ratio handling

* chore: bump probe-image-size

* chore: handle temp file resizing buffer

* chore: yarn.lock after reverting probe-image-size bump

* chore: get yarn.lock from master

* chore: clear temp files directly in operations instead of injecting a hook
2023-02-01 15:59:53 -05:00
James
c1df7674b2 chore(release): v1.6.3 2023-02-01 15:54:56 -05:00
Elliot DeNolf
30088ec20b Merge pull request #1994 from payloadcms/fix/await-graphql-schema-gen
fix: properly await graphql schema generation
2023-02-01 15:29:46 -05:00
Elliot DeNolf
7720f452d3 ci: generate graphql schema in GH action 2023-02-01 15:17:48 -05:00
Elliot DeNolf
678614b62b docs: add cross-env to graphql schema gen example 2023-02-01 14:47:24 -05:00
Elliot DeNolf
888b3a2672 fix: properly await graphql schema generation 2023-02-01 14:43:05 -05:00
James Mikrut
fa86fb7e3f Update CHANGELOG.md 2023-02-01 13:02:57 -05:00
James
2a44cad2d0 chore(release): v1.6.2 2023-02-01 13:02:03 -05:00
James
5f0574e15c chore: adds optional password to auth-enabled collections 2023-02-01 12:52:05 -05:00
James
bd4b834b74 Merge branch 'master' of github.com:payloadcms/payload 2023-02-01 11:57:55 -05:00
James
1614bcdc0b docs: updates to reflect new async init 2023-02-01 11:57:46 -05:00
James Mikrut
93f684e5b6 Update CHANGELOG.md 2023-02-01 10:43:57 -05:00
James
9f2e51ea8c chore: simplifies changelog 2023-02-01 10:43:21 -05:00
James
c1caa6318e chore(release): v1.6.1 2023-02-01 10:42:38 -05:00
James
4d5fcfcdad chore: releases minor 2023-02-01 10:37:33 -05:00
James Mikrut
39aec8caa3 Merge pull request #1988 from payloadcms/chore/default-drawer-header
chore: adds default drawer header
2023-02-01 09:58:43 -05:00
James
1c8209c54a chore: canary release 2023-02-01 09:44:41 -05:00
James
742d21f1c9 chore: updates changelog 2023-02-01 09:39:21 -05:00
James
c70d59c8d2 chore: safely traverses locale=all in cases where relationship is null 2023-02-01 09:33:22 -05:00
James
2d74bb00f2 chore: merge 2023-01-31 21:17:35 -05:00
James
6ae6b9268f chore: removes ability to retain deleted versions 2023-01-31 21:16:40 -05:00
Jacob Fletcher
b7aaa53a8a chore: adds default drawer header 2023-01-31 21:02:20 -05:00
James Mikrut
3a3def5e76 Merge pull request #1985 from payloadcms/chore/default-max-versions
chore: defaults maxVersions to 100
2023-01-31 21:01:15 -05:00
James
44d55e39f3 chore: canary release 2023-01-31 20:57:58 -05:00
James
af4ed27d15 chore: reduces width of block selector tiles on bigger screens 2023-01-31 18:19:49 -05:00
James
eb98810cef chore: ensures generated types can extend TypeWithID 2023-01-31 17:45:10 -05:00
Stjepan Nikolić
dfa47a0e0f feat: add Croatian translation (#1982) 2023-01-31 15:12:08 -05:00
Jarrod Flesch
f81fa55289 chore: changelog update - migration script 2023-01-31 11:44:25 -05:00
Jarrod Flesch
ab7b14d81e chore: defaults maxVersions to 100 2023-01-31 11:29:52 -05:00
James
69309a1f88 Merge branch 'master' of github.com:payloadcms/payload 2023-01-31 09:39:31 -05:00
James
abdd1634e4 chore: canary release 2023-01-31 09:39:25 -05:00
Jarrod Flesch
e4d2549984 chore: updates script to remove orphan versions 2023-01-31 09:28:01 -05:00
James
2edabef78f Merge branch 'master' of github.com:payloadcms/payload 2023-01-31 08:45:06 -05:00
James
9c5d7b2f2c chore: improves rich text re-initialization logic when new data comes in 2023-01-31 08:44:59 -05:00
PatrikKozak
453a9036be fix: relation to many index unique fields (#1979) 2023-01-30 16:24:59 -05:00
James
b0ef5fb06d chore: canary release 2023-01-30 15:52:53 -05:00
James
27352f7230 Merge branch 'master' of github.com:payloadcms/payload 2023-01-30 14:19:15 -05:00
James
58c454b628 chore: canary release 2023-01-30 14:19:08 -05:00
Jarrod Flesch
3058eb5617 fix: corrects type for required named tab fields (#1939)
* fix: corrects type for required named tab fields

* chore: tabs and groups are always required

* chore: adjusts tab and group type to omit required since a group/named-tab will always exist
2023-01-30 14:17:40 -05:00
Jacob Fletcher
76745bf19a Merge pull request #1951 from payloadcms/chore/blocks-drawer
chore: refines blocks drawer content
2023-01-30 14:16:03 -05:00
kenryu42
7c6ff89ab6 feat: add Chinese translation (#1926) 2023-01-30 11:25:05 -05:00
James Mikrut
8d26d6d863 Merge pull request #1973 from payloadcms/chore/versions-review
Chore/versions review
2023-01-30 11:51:53 -04:00
Jarrod Flesch
52589f7c59 chore: removes top level spread of version data on version doc 2023-01-30 10:31:30 -05:00
Jarrod Flesch
46b750b3ec chore: ensures only drafts use current time in versioning 2023-01-30 10:29:38 -05:00
Jacob Fletcher
caee0c07d7 docs: gql me query (#1949) 2023-01-27 10:15:53 -05:00
Sean Zubrickas
4cb3e32ff1 chore: readme updates, centering, consistent button style (#1955)
* Update README.md

- updates logo approach to work with npm and github
- updates badge style
- fixes twitter badge
- removes duplicative links for discord and website
- moves feature request link

* changes h1 to p tag, changes h2 to h3 - both done to remove ugly bottom border

* adds target blank to a few anchor tags
2023-01-26 09:32:38 -05:00
Jessica Chowdhury
fb41d245e6 docs(examples): add whitelabel example (#1947)
* chore: adds whitelabel example

* chore: updates readme

* chore: updates icon/logo/favicon assets
2023-01-26 09:24:23 -05:00
Jacob Fletcher
1ab8ccdc99 chore: refines blocks drawer content 2023-01-24 16:05:40 -05:00
Jarrod Flesch
3d854f7724 fix: ensures loader disappears after unsuccessful login, adjusts mobile loader styles (#1948) 2023-01-24 12:46:53 -05:00
Jarrod Flesch
e7908b7f37 fix: aligns global preview config with the docs (#1940) 2023-01-23 17:01:46 -05:00
Mng
6981098329 chore: add default value to richtext props 2023-01-23 09:29:29 -05:00
Jessica Chowdhury
8b778b6407 fix: collection view pagination with limits resulting in empty list 2023-01-23 08:56:35 -05:00
Elliot DeNolf
993a8a1f90 chore: proper release scripts for beta and canary 2023-01-20 17:18:54 -05:00
Jacob Fletcher
25c5b784e1 Merge pull request #1931 from payloadcms/feat/1909
feat: renders blocks field selector within new `BlocksDrawer` component
2023-01-20 16:37:18 -05:00
Jarrod Flesch
9b613ee202 fix: limits and sorts within pagination and not on initial aggregation 2023-01-20 16:30:46 -05:00
Jacob Fletcher
84b36fed6f Merge remote-tracking branch 'upstream/master' into feat/1909 2023-01-20 15:37:03 -05:00
Jacob Fletcher
f351039d48 chore: blocks drawer e2e tests 2023-01-20 15:28:41 -05:00
Jacob Fletcher
339cee416a feat: blocks drawer #1909 2023-01-20 15:28:15 -05:00
Jessica Chowdhury
e39c5e3ec0 Update CHANGELOG.md (#1930) 2023-01-20 12:12:09 -05:00
Jarrod Flesch
517e359399 chore: moves @types/sharp from devDeps to deps array 2023-01-20 11:21:10 -05:00
Elliot DeNolf
1c2eec405b chore: better comment for formatOptions on uploads 2023-01-20 11:13:32 -05:00
Jacob Fletcher
398f40ea68 Merge pull request #1921 from payloadcms/chore/export-entity-to-json
chore: extracts entityToJSONSchema from generateTypes
2023-01-20 10:40:00 -05:00
Jacob Fletcher
1efc6f53d3 feat: explicitly exports utilities 2023-01-20 10:29:13 -05:00
Jarrod Flesch
5ff01f529f chore: audits and removes unused deps 2023-01-20 09:48:13 -05:00
Jarrod Flesch
2a678b9686 chore: shortens loading overlay in/out animation duration (#1925) 2023-01-20 08:13:05 -05:00
James
922122492e chore: regenerates yarn lock 2023-01-19 20:50:02 -05:00
James
7fb0e654cd chore: rolls back pino update 2023-01-19 20:44:18 -05:00
James
3c435daf65 chore: canary release 2023-01-19 20:33:02 -05:00
James
198b077257 chore: removes logger memoization 2023-01-19 20:23:20 -05:00
James
d72237adf3 chore: only requires loadConfig if config is not passed 2023-01-19 20:02:02 -05:00
James
65ce21a238 chore: canary release 2023-01-19 18:18:29 -05:00
James
59dfd9b9bd Merge branch 'master' of github.com:payloadcms/payload 2023-01-19 18:10:54 -05:00
James
268b5dd54e chore: exports both ts and js components 2023-01-19 18:10:47 -05:00
Jarrod Flesch
c0ac155a71 fix: #1870 and #1859
* chore: ensures relationship fields react to locale changes in the admin panel - fixes #1870

* chore: patches in default values for fields, and localized fields using fallbacks - fixes #1859

* chore: organizes field localization and sanitizing

* Revert "Feat/1180 loading UI enhancements"

* Feat/1180 loading UI enhancements

* chore: safely sets tab if name field, only sets fallback value if it exists

* chore: adds test to ensure text fields use fallback locale value when empty
2023-01-19 16:55:03 -05:00
James Mikrut
5d71d4bf6e Merge pull request #1920 from payloadcms/fix/index-version-timestamp-fields
fix: versions error on cosmos db
2023-01-19 16:49:58 -05:00
James
bbc926bccc chore: only calls onInit within initHTTP if local is not true 2023-01-19 16:35:52 -05:00
James
c83ad752ca chore: only sets local to false if local is undefined 2023-01-19 16:19:11 -05:00
James
9ae5b47296 Merge branch 'master' of github.com:payloadcms/payload 2023-01-19 16:06:57 -05:00
James
6dc688cefd chore: ensures onInit is called after initHTTP 2023-01-19 16:06:50 -05:00
Jarrod Flesch
989409a1ab Feat/1180 loading UI enhancements 2023-01-19 15:41:12 -05:00
Jarrod Flesch
ead6229d55 Merge pull request #1922 from payloadcms/revert-1911-feat/1180-loading-ui-enhancements
Revert "Feat/1180 loading UI enhancements"
2023-01-19 15:21:01 -05:00
Jarrod Flesch
69147a51d6 Revert "Feat/1180 loading UI enhancements" 2023-01-19 15:20:44 -05:00
James
6023559142 Merge branch 'master' of github.com:payloadcms/payload 2023-01-19 15:20:42 -05:00
Jarrod Flesch
51bd6d5ce0 Merge pull request #1911 from payloadcms/feat/1180-loading-ui-enhancements
Feat/1180 loading UI enhancements
2023-01-19 15:20:29 -05:00
James
690ec7ce24 chore: updates vscode debug script 2023-01-19 15:20:28 -05:00
Jarrod Flesch
ff8dc859cd Merge branch 'master' into feat/1180-loading-ui-enhancements 2023-01-19 15:04:50 -05:00
Jessica Chowdhury
06230398d7 fix: hides fallback locale checkbox when field localization is set to false (#1893)
* fix: hides fallback locale checkbox when field localization is set to false

* fix: updates fallback locale checkbox logic

* chore: updates naming convention
2023-01-19 14:33:30 -05:00
Jacob Fletcher
c0e21c2406 chore: upgrades package.json (#1919)
* Upgraded the packages to latest patch versions where non breaking

* Upgraded the packages to latest minor versions where non breaking

Co-authored-by: TomDoFuture <108644869+TomDoFuture@users.noreply.github.com>
2023-01-19 14:27:33 -05:00
Jarrod Flesch
fc23b49998 chore: removes forced initial delay on shimmer effect 2023-01-19 14:18:46 -05:00
Jacob Fletcher
e80ead17a8 chore: extracts entityToJSONSchema from generateTypes 2023-01-19 14:16:21 -05:00
Jarrod Flesch
a88c352e72 chore: adds processing loader to use form context 2023-01-19 14:08:06 -05:00
Dan Ribbens
338c4e2fb1 fix: versions error on cosmos db 2023-01-19 13:47:38 -05:00
Jacob Fletcher
8b08e5a1f9 Merge pull request #1892 from payloadcms/fix/restore-draft
fix: creates backup of current version after restoring draft
2023-01-19 11:40:11 -05:00
Jacob Fletcher
b3f2c79d87 chore: passing versions int tests 2023-01-19 11:39:27 -05:00
Jacob Fletcher
bd4da37f23 fix: creates backup of latest version after restoring draft #1873 2023-01-19 11:38:39 -05:00
Jessica Chowdhury
eec4b3ace5 fix: disables escapeValue for i18n (#1886) 2023-01-19 11:36:14 -05:00
Jarrod Flesch
9feca3c4cc chore: merge with master 2023-01-19 11:26:28 -05:00
James Mikrut
4a49640c3f Merge pull request #1915 from payloadcms/canary
Canary release
2023-01-19 10:38:31 -05:00
Jarrod Flesch
32e2211dbe chore: loader bar color correction 2023-01-19 01:06:43 -05:00
Jarrod Flesch
fcc247ffd6 chore: adds translations for uploading and updating 2023-01-19 01:01:59 -05:00
Jarrod Flesch
d13732b44e chore: adds loader for uploads, refines messaging on loaders 2023-01-19 00:45:57 -05:00
Jarrod Flesch
50f74fbeda chore: refines shimmer, adds to list view and CodeEditor element 2023-01-18 17:04:31 -05:00
James
4855ba07c5 chore: canary release 2023-01-18 16:07:50 -05:00
James
1e0c5be5b3 Merge branch 'feat/require-ts-node' of github.com:payloadcms/payload into canary 2023-01-18 16:01:30 -05:00
James
21c15ae559 chore: canary release 2023-01-18 15:56:03 -05:00
Elliot DeNolf
9e7a15c1be chore: ts-ignore swcRegister in tests 2023-01-18 12:26:24 -05:00
Jarrod Flesch
f66dd613e3 chore: directs attention to breaking changes headings 2023-01-18 12:13:46 -05:00
Jarrod Flesch
3c70a15bb6 Decorate changelog 2023-01-18 12:05:10 -05:00
Elliot DeNolf
a1f40c73c9 chore: proper generated type default in changelog 2023-01-18 12:01:49 -05:00
James
98171abed5 chore: ensures tsc succeeds 2023-01-18 11:58:35 -05:00
James
9b949da47c Merge branch 'canary' of github.com:payloadcms/payload into canary 2023-01-18 11:56:12 -05:00
James
caa5cefe53 chore: leverages swc/register for bin scripts 2023-01-18 11:56:03 -05:00
Elliot DeNolf
1befe0ce57 chore: revert onInit type change 2023-01-18 11:46:23 -05:00
James
63ca5126cf chore: changelog update 2023-01-18 11:28:11 -05:00
James
a4105266b4 chore: release 2023-01-18 10:58:30 -05:00
James Mikrut
148fc817cd Merge pull request #1907 from notcorp/master
Update sendEmail.ts
2023-01-18 10:56:19 -05:00
Jarrod Flesch
213849fb32 chore: adjusts useLoadingOverlay api 2023-01-18 10:56:14 -05:00
James
412064d77f chore: merges version deletion 2023-01-18 10:46:23 -05:00
James
700e3a159f Merge branch 'master' of github.com:payloadcms/payload into canary 2023-01-18 10:33:39 -05:00
James Mikrut
ea069c0c51 Merge pull request #1864 from payloadcms/feat/retain-deleted
feat: allows versions to be deleted alongside of main document deletion
2023-01-18 10:33:15 -05:00
James Mikrut
de2ef90043 Merge pull request #1890 from payloadcms/fix/pino-pretty-yarn-2
fix: bump pino and pino-pretty to accommodate yarn 2
2023-01-18 10:32:07 -05:00
James
ed6394300f chore: passing e2e 2023-01-18 10:28:45 -05:00
Chris McGrane
8ae0d045e3 Update sendEmail.ts
Switched sendEmail typing to nodemailer's SendMailOptions
2023-01-18 10:27:26 -05:00
James
70745cea5d chore: renames beta to canary 2023-01-17 16:51:50 -05:00
James
6f62429382 chore: merges removal of swc/register 2023-01-17 16:51:11 -05:00
James
c0a942aa4a chore: finishes typing local API 2023-01-17 16:46:18 -05:00
James
e3c5a6c294 chore: further types local operations 2023-01-17 16:16:26 -05:00
James
66dac29ee6 chore: merges versions simplification 2023-01-17 15:44:11 -05:00
Elliot DeNolf
1f9b4e2296 chore: ts improvements on global findOne 2023-01-17 15:18:38 -05:00
James
2c6844c327 chore: removes unused code 2023-01-17 15:03:38 -05:00
James
3bb262fd66 chore: passing tests 2023-01-17 15:01:15 -05:00
Elliot DeNolf
47bb5d6c61 chore: ts improvements on delete operation 2023-01-17 14:50:41 -05:00
James Mikrut
4851b6bae0 Merge pull request #1901 from miriankakhidze/docs/update-gql-exampe
chore: correct properties in example
2023-01-17 14:02:40 -05:00
James Mikrut
433b3e8c21 Merge pull request #1894 from joohanp/fix-nl-i18n
fix: updated nl i18n typos
2023-01-17 14:02:20 -05:00
Jarrod Flesch
35dc687be6 chore: improves dx and component api 2023-01-17 13:10:41 -05:00
James
dc0f8deb06 chore: prefers TypeWithID over Record<string, unknown> 2023-01-17 10:53:50 -05:00
James
ed998598df chore: implements new typing into create and find operations 2023-01-17 10:22:17 -05:00
James
a53682acee chore: uses resulting version in update ops if draft=true 2023-01-17 09:59:32 -05:00
Mk
d04db59880 chore: correct properties in example 2023-01-17 17:16:30 +04:00
James
34582da561 chore: leverages versions refactor to simplify draft query logic 2023-01-16 21:40:34 -05:00
James
dff840c49b chore: adds version count tests 2023-01-16 21:05:40 -05:00
James
8cfa550954 feat: simplifies versions logic 2023-01-16 21:02:32 -05:00
James
fc7709da51 chore: flattens saving versions into a single file 2023-01-16 20:43:37 -05:00
James
0a4766a61e chore: passing tests 2023-01-16 19:04:09 -05:00
James
671adc7e0e chore: begins simplifying versions 2023-01-16 18:09:38 -05:00
Johan
cc7257efd5 fix: updated nl i18n typos 2023-01-16 21:11:27 +01:00
Elliot DeNolf
773fb57c71 fix: bump pino and pino-pretty to accommodate yarn 2 2023-01-16 10:47:37 -05:00
Jarrod Flesch
5a93683a26 chore: revamps loading provider 2023-01-16 08:26:35 -05:00
James
0af29ff4db chore: dynamically uses generated types via tsconfig paths 2023-01-15 12:22:16 -05:00
James
d8cce02e97 chore(release): v1.5.9 2023-01-15 09:48:19 -05:00
James
b06ca700be fix: #1877, #1867 - mimeTypes and imageSizes no longer cause error in admin ui 2023-01-15 09:41:54 -05:00
TomDoFuture
5f620a2325 Upgraded the packages to latest minor versions where non breaking 2023-01-15 11:23:42 +11:00
TomDoFuture
01d1f43d45 Upgraded the packages to latest patch versions where non breaking 2023-01-15 11:20:10 +11:00
James
6903d7f52f chore: ts compiles 2023-01-13 16:58:10 -05:00
Jarrod Flesch
bb565f9450 Merge remote-tracking branch 'origin' into feat/1180-loading-ui-enhancements 2023-01-13 12:02:16 -05:00
James
918f736141 chore: begins ts improvements 2023-01-13 11:36:01 -05:00
James
a5c76d4bd5 feat: allows versions to be deleted alongside of main document deletion 2023-01-12 14:30:51 -05:00
James
d6d4906148 chore(release): v1.5.8 2023-01-12 13:56:19 -05:00
James
a054cf098c chore: excludes versions that do not have a parent document from draft queries 2023-01-12 13:35:17 -05:00
James
c0710a3b74 chore: progress to ts improvements 2023-01-12 13:22:15 -05:00
Jarrod Flesch
ae05392625 chore: implements fullscreen loader with top level provider 2023-01-12 11:02:26 -05:00
James
3fb2e5d25e Merge branch 'master' of github.com:payloadcms/payload 2023-01-12 10:39:41 -05:00
James
af7b42e531 chore: renames beta releases to canary 2023-01-12 10:39:35 -05:00
James Mikrut
679331873c Merge pull request #1861 from payloadcms/feat/error-reporting
feat: throws descriptive error when collection or global slug not found
2023-01-12 10:26:51 -05:00
James
4460ad0577 chore(release): v1.5.7 2023-01-12 10:25:33 -05:00
James
1ea6e8b4f3 chore: ensures that while querying with draft=true, outdated versions are excluded 2023-01-12 10:20:20 -05:00
James
f018fc04b0 fix: ensures querying with drafts works on both published and non-published posts 2023-01-12 10:06:44 -05:00
James
69026c5779 fix: ensures find with draft=true does not improperly exclude draft ids 2023-01-12 09:50:24 -05:00
Jessica Boezwinkle
b847d85e60 feat: throws descriptive error when collection or global slug not found 2023-01-12 13:12:46 +00:00
James
d3d367c635 feat: isolates local api to local-only functions, converts it to ts generic for stronger typing 2023-01-11 17:03:10 -05:00
James
8de92dc6b9 Merge branch 'master' of github.com:payloadcms/payload into feat/revamped-local-api 2023-01-11 16:14:23 -05:00
James
dabc0bbe80 chore(release): v1.5.6 2023-01-11 16:13:53 -05:00
James
3f30b2f489 fix: ensures that find with draft=true returns ids with drafts 2023-01-11 16:08:32 -05:00
James
84e03893fd chore: begins local api abstraction 2023-01-11 15:58:58 -05:00
Jessica Boezwinkle
b4ffeaf034 chore: converts exported ts files to js 2023-01-11 16:36:52 +00:00
James
a470706c2e chore(release): v1.5.5 2023-01-11 10:41:22 -05:00
James Mikrut
5e7d731ddd Merge pull request #1850 from payloadcms/fix/1848
fix: rte link from text
2023-01-11 10:33:21 -05:00
Jacob Fletcher
2e833a6efd chore: e2e test for rte link from text 2023-01-11 10:25:43 -05:00
Jacob Fletcher
1cde647a2a fix: rte link element initial state #1848 2023-01-11 09:44:41 -05:00
James
047efe02ff chore: revert #1794 for now until permanent init architecture is established 2023-01-11 09:32:44 -05:00
James
441eb2c20c chore: keeps swc/register for playwright tests 2023-01-10 15:53:41 -05:00
Jarrod Flesch
0f45014dce chore: stubs out FullscreenLoader 2023-01-10 14:53:43 -05:00
Jarrod Flesch
1acf615fc7 chore: removes trailing dots for loading translation 2023-01-10 14:53:12 -05:00
James
f1c342e05e feat: requires ts-node to start a project for any config that uses ts or jsx 2023-01-10 11:48:40 -05:00
Jarrod Flesch
96002dbda5 Merge pull request #1719 from payloadcms/feat/1695-nullable-localized-array-and-blocks
Feat: allow null for non-default locales on arrays and blocks
2023-01-10 11:23:46 -05:00
James Mikrut
93d0a9b3d4 Merge pull request #1837 from payloadcms/chore/manual-draft-aggregate
feat/documentdb / azure cosmos compatibiilty
2023-01-10 11:23:19 -05:00
Jarrod Flesch
571495c3e0 chore: sets parameter defaults for locale and defaultLocale to null 2023-01-10 10:44:48 -05:00
Jarrod Flesch
9b71aa17b3 chore: uses defaultLocale for local operations locale and fallbackLocale 2023-01-10 10:40:35 -05:00
Jacob Fletcher
03dcf743e8 Merge pull request #1835 from payloadcms/fix/1801
fix: upload field filterOptions
2023-01-10 09:46:26 -05:00
Jacob Fletcher
dadaf32e4d Merge pull request #1839 from payloadcms/fix/date-useastitle
fix: formats date when useAsTitle
2023-01-10 09:45:04 -05:00
Jacob Fletcher
086117d703 fix: formats date when useAsTitle 2023-01-09 22:05:56 -05:00
James
ea9943e135 chore: ensures versions aggregate runs in the right order 2023-01-09 19:47:31 -05:00
James
bda03d7a84 Merge branch 'chore/manual-draft-aggregate' of github.com:payloadcms/payload into chore/manual-draft-aggregate 2023-01-09 19:46:57 -05:00
James
665d3da651 chore: ensures sort is used within mergeDrafts 2023-01-09 19:46:35 -05:00
James
faab09b76f chore: ensures sort is used within mergeDrafts 2023-01-09 19:41:30 -05:00
James
33401f4064 chore: comment accuracy 2023-01-09 19:11:40 -05:00
James
9e9dfbcb10 chore: cleanup mergeDrafts 2023-01-09 19:06:02 -05:00
James
73af283e1c feat: ensures compatibility with azure cosmos and aws documentdb 2023-01-09 18:59:20 -05:00
PatrikKozak
6c25ad9cc2 Merge branch 'master' of https://github.com/payloadcms/payload into feat/1695-nullable-localized-array-and-blocks 2023-01-09 17:49:31 -05:00
PatrikKozak
c247f3130c feat: adds translations for fallbackToDefaultLocale 2023-01-09 17:46:35 -05:00
Jacob Fletcher
4194632318 chore: fixes failing upload e2e test 2023-01-09 17:15:05 -05:00
Jarrod Flesch
8f84f9e140 chore: adds simplified config for testing 2023-01-09 17:02:25 -05:00
Jarrod Flesch
21420f16df chore: adjusts skipValidation for array 2023-01-09 16:39:13 -05:00
Jarrod Flesch
ee682270a4 Merge remote-tracking branch 'origin' into feat/1695-nullable-localized-array-and-blocks 2023-01-09 16:19:11 -05:00
Jarrod Flesch
6923128774 chore: abstracts NullifyField component out, non-default locales can be set to null to use fallback 2023-01-09 16:08:55 -05:00
Jarrod Flesch
5cabd8e4c0 chore: abstracts CheckboxInput into a uncontrolled input 2023-01-09 16:07:41 -05:00
Jarrod Flesch
84bc5ab299 chore: fixes incorrect tooltip arrow color 2023-01-09 16:06:51 -05:00
Jacob Fletcher
9483ccb120 fix: upload field filterOptions 2023-01-09 14:40:30 -05:00
Jacob Fletcher
d8c700975f chore: creates uploads e2e testing suite 2023-01-09 13:17:55 -05:00
James Mikrut
aee7d36f1d Merge pull request #1832 from payloadcms/fix/#1808
fix: #1808, arrays and blocks now save localized nested field data upon reordering rows
2023-01-09 12:59:52 -05:00
James
febbea5550 chore: restores debugger to use fields test suite 2023-01-09 12:59:36 -05:00
James
ee54c1481c fix: #1808, arrays and blocks now save localized nested field data upon reordering rows 2023-01-09 12:58:13 -05:00
James
78af86f9d1 chore: simplifies init code 2023-01-09 11:27:00 -05:00
Christian Schurr
82961767e3 feat!: enforces payload.init is async
* Run connectMongoose before starting payload init

* - reverted changes
- added deprecated to init
- docs: changed all payload.init to payload.initAsync
- changed all internal init calls

* forgotten inits in docs

* reverted back - removed init and renamed initAsync to init
2023-01-09 11:24:22 -05:00
James Mikrut
7583289d24 Merge pull request #1830 from payloadcms/fix/#1737-upload-filedata-available
fix: ensures upload file data is available for conditions
2023-01-09 11:14:55 -05:00
James
d40e136947 fix: ensures upload file data is available for conditions 2023-01-09 10:43:42 -05:00
Jessica Chowdhury
ed7cfff45c fix: bug when clearing relationship field without hasMany: true (#1829)
* fix: bug when clearing relationship field without hasMany: true

* fix: checks for null value within function
2023-01-09 10:23:40 -05:00
James Mikrut
a10376372a Merge pull request #1796 from payloadcms/fix/groups-within-row
fix: updates margin for group field within a row
2023-01-09 10:03:50 -05:00
James Mikrut
f6e749734a Merge pull request #1824 from payloadcms/fix/rte-uploads-drawer
fix: prevents uploads drawer from crashing when no uploads are enabled
2023-01-09 09:06:25 -05:00
Jacob Fletcher
62c9efbc54 Merge pull request #1819 from Elliot67/patch-2
fix: wrong translation and punctuation spacing
2023-01-09 09:02:09 -05:00
Jacob Fletcher
84e1417b71 fix: prevents uploads drawer from crashing when no uploads are enabled 2023-01-08 23:04:42 -05:00
Elliot Lintz
bf1242aafa fix: wrong translation and punctuation spacing 2023-01-07 03:38:40 +01:00
Jarrod Flesch
001a68f45c chore: adjusts block and array schemas to store undefined instead of empty arrays by default 2023-01-06 16:56:26 -05:00
Jacob Fletcher
a823e75d2b Merge pull request #1815 from iamprompt/patch-1
fix: fix miss typo in Thai translation
2023-01-06 12:24:39 -05:00
James
c21c6b8013 chore(release): v1.5.4 2023-01-06 11:36:26 -05:00
James Mikrut
e42d103af3 Merge pull request #1816 from payloadcms/feat/prebuilt-config
feat: allows init to accept a pre-built config
2023-01-06 11:30:57 -05:00
James
84e00bf7b3 feat: allows init to accept a pre-built config 2023-01-06 11:23:55 -05:00
Supakarn Laorattanakul
25e5ab7cee fix: fix miss typo in Thai translation 2023-01-06 20:23:27 +07:00
James
5a7972fbf8 chore(release): v1.5.3 2023-01-05 13:53:39 -05:00
James
74e10b1788 Merge branch 'master' of github.com:payloadcms/payload 2023-01-05 13:32:47 -05:00
James
6c3bc6fb34 chore: moves graphql types for globals onto payload class 2023-01-05 13:32:38 -05:00
Jarrod Flesch
b8ca2c56d9 Merge pull request #1807 from payloadcms/fix/code-editor-theme-flicker
fix: theme flicker on code editor
2023-01-05 09:42:24 -05:00
Jessica Boezwinkle
c9e7c1b3bc chore: commits the correct file (jess negligence) 2023-01-05 13:58:44 +00:00
Jessica Boezwinkle
dacf1a85fd chore: removes code editor theme from options 2023-01-05 13:57:10 +00:00
Jessica Boezwinkle
6567454ae4 fix: theme flicker on code editor 2023-01-05 10:03:19 +00:00
James
06fd7e7776 chore(release): v1.5.2 2023-01-04 15:16:32 -05:00
James Mikrut
cac4b92a02 Merge pull request #1805 from payloadcms/fix/swc-ignore
fix: ignores admin and components from swc
2023-01-04 15:01:43 -05:00
Jacob Fletcher
7d27431312 fix: ignores admin and components from swc 2023-01-04 14:57:07 -05:00
Jarrod Flesch
206d0c2c2a chore: adds sourcemaps for swc register 2023-01-04 13:54:39 -05:00
James
38b8423150 chore(release): v1.5.1 2023-01-04 13:23:46 -05:00
James Mikrut
ea8b1ba10c Merge pull request #1804 from payloadcms/fix/components-dir
fix: reverts components directory back to ts
2023-01-04 13:07:51 -05:00
Jacob Fletcher
1bbf099fe0 fix: reverts components directory back to ts 2023-01-04 13:04:07 -05:00
James
5fae18e940 chore: passing tests 2023-01-04 12:46:18 -05:00
James
f4d20a9aed chore: removes logging 2023-01-04 11:43:45 -05:00
James
27dd945544 chore: adds logging to debug why tests not passing in ci 2023-01-04 11:36:38 -05:00
James
7c74507bca chore(release): v1.5.0 2023-01-04 10:43:08 -05:00
James
c18ea7c856 chore: migrates component tests to new version of jest 2023-01-04 10:28:31 -05:00
James
681d75e43e chore: adapts tests to new jest version 2023-01-04 10:22:57 -05:00
James Mikrut
c11bcd1416 feat: swc register (#1779)
* feat: implements esbuild and removes babel

* chore: implements esbuild-register

* chore: tests passing

* chore: implements @swc/jest for tests

* feat: implements swc

* chore: removes build and relies on swc/register only

* chore: converts some exports

* chore: flattens ts configs

* chore: allows tsx in swc

* chore: converts more exports into js

* chore: restores payload module.exports

* chore: removes unused dependency
2023-01-04 10:11:26 -05:00
James
82501319ce chore: dependency updates 2023-01-04 10:06:00 -05:00
Jarrod Flesch
b379001f00 Merge pull request #1802 from payloadcms/chore/code-field-props
chore: moves editorProps into admin property for code and json field types
2023-01-04 09:01:07 -05:00
Jarrod Flesch
fe1dfa3e23 chore: updates test config payload-types 2023-01-04 08:51:54 -05:00
Jarrod Flesch
d97c9fd2ee chore: moves editorProps into admin property for code and json field types 2023-01-04 08:41:59 -05:00
Jarrod Flesch
fde79a1b3c Merge pull request #1731 from payloadcms/feat/json-field
feat: builds json field and updates code field editor
2023-01-03 17:00:34 -05:00
Jarrod Flesch
59781b9eef chore: adjusts JSON field type, removes jsonError from config type 2023-01-03 16:47:51 -05:00
Jarrod Flesch
27ab978565 chore: updates json field docs 2023-01-03 15:01:43 -05:00
Jarrod Flesch
f7d664fdcf docs: updates code and json field types to reflect internal switch to monaco-react editor 2023-01-03 15:01:04 -05:00
Jarrod Flesch
4d74d7a994 chore: abstracts CodeEditor component, ensures js and ts language are respected in Code Field with new editor 2023-01-03 13:57:06 -05:00
James
6a3ee4debe chore(release): v1.4.2 2023-01-03 10:16:45 -05:00
Jarrod Flesch
a0181a0eee Merge branch 'master' into feat/json-field 2023-01-03 10:03:16 -05:00
Jessica Boezwinkle
1c3a257244 fix: updatesmargin for group field within a row 2023-01-03 10:26:10 +00:00
James Mikrut
7727496548 Merge pull request #1793 from payloadcms/fix/#1786
fix: #1786, relationship with hasMany no longer sets empty array as default value
2023-01-02 15:50:58 -05:00
James
ecfb363169 fix: #1786, relationship with hasMany no longer sets empty array as default value 2023-01-02 15:49:19 -05:00
James Mikrut
4579a2adc1 Merge pull request #1787 from payloadcms/chore/deleting-error-i18n
chore: fix incorrect translation for error deleting document
2023-01-02 14:42:37 -05:00
James Mikrut
57ba307c3b Merge pull request #1792 from payloadcms/feat/reactive-preview
feat: preview now exposes most recent draft data
2023-01-02 14:39:38 -05:00
James
54dadbeae5 feat: preview now exposes most recent draft data 2023-01-02 14:38:35 -05:00
James Mikrut
2a8bc31e4a Merge pull request #1789 from payloadcms/fix/#1775
fix: #1775 - siblingData for unnamed fields within array rows improperly formatted
2023-01-02 13:39:02 -05:00
James
d6fcd19bd1 fix: #1775 - siblingData for unnamed fields within array rows improperly formatted 2023-01-02 13:31:34 -05:00
Dan Ribbens
e0d4b3fef2 chore: fix incorrect translation for error deleting document 2023-01-02 12:43:05 -05:00
James Mikrut
3552d6a340 Merge pull request #1770 from payloadcms/fix/#1762-select-unmatched-value
fix: #1762 select field crash on missing value option
2023-01-02 10:28:57 -05:00
James Mikrut
e330d8874b Merge pull request #1766 from jacobsfletch/fix/1765
fix: error clearing date field
2023-01-02 09:51:51 -05:00
James Mikrut
d919abbda4 Merge pull request #1782 from jacobsfletch/fix/1777
docs: reserved field names
2023-01-02 09:45:24 -05:00
Jacob Fletcher
8e6b2c4f9d docs: reserved field names 2023-01-02 00:47:54 -05:00
Jacob Fletcher
420ed6738e chore: e2e test for date input clearing 2022-12-26 14:31:08 -05:00
Zlatex
49fa5cb23a feat: add Ukrainian translation (#1767) 2022-12-26 12:48:13 -05:00
Dan Ribbens
ec9196e33c fix: select field crash on missing value option 2022-12-26 12:13:11 -05:00
Jacob Fletcher
883daf7b46 fix: error clearing date field 2022-12-24 09:02:35 -05:00
James
7b92211eca chore(release): v1.4.1 2022-12-23 19:52:05 -05:00
James
192c9fe981 Merge branch 'master' of github.com:payloadcms/payload 2022-12-23 19:46:09 -05:00
James
9f4ce8d756 fix: #1761, avoids rich text modifying form due to selection change 2022-12-23 19:46:01 -05:00
Dan Ribbens
abaa22950c test: json field e2e and int 2022-12-23 17:45:22 -05:00
James Mikrut
e23481a011 Update README.md 2022-12-23 16:29:51 -05:00
James
8a8741a792 chore(release): v1.4.0 2022-12-23 16:13:12 -05:00
James Mikrut
206b757629 Merge pull request #1757 from payloadcms/fix/#1738-svg-image-sizes
fix: #1738 save image dimensions to svg uploads
2022-12-23 16:05:22 -05:00
PatrikKozak
238badabb4 fix: translated tab classnames 2022-12-23 15:20:44 -05:00
James
e86a6efe45 Merge branch 'master' of github.com:payloadcms/payload 2022-12-23 14:39:35 -05:00
James
37bc8826f7 chore: allows relationship and upload elements to reside within lists 2022-12-23 14:39:25 -05:00
Jacob Fletcher
3d4dfbcf7a chore: translates tooltip in rte relationship 2022-12-23 14:09:10 -05:00
Dan Ribbens
2de435f43a fix: #1738 save image dimensions to svg uploads 2022-12-23 13:42:31 -05:00
James
ff4a6a1ea1 Merge branch 'master' of github.com:payloadcms/payload 2022-12-23 13:12:33 -05:00
James
55df622007 chore: ensures that de-indenting top-level lists works in all cases 2022-12-23 13:11:38 -05:00
Jacob Fletcher
baf5b10d23 roadmap: rte and upload drawers (#1668) 2022-12-23 12:41:06 -05:00
James
794b6e8783 chore: safely checks if rte last selected element is empty 2022-12-23 12:30:54 -05:00
James Mikrut
df41201134 Merge pull request #1759 from payloadcms/fix/#1748
fix: #1748, bails out of autosave if doc is published while autosaving
2022-12-23 12:21:29 -05:00
James
95e9300d10 fix: #1748, bails out of autosave if doc is published while autosaving 2022-12-23 12:20:04 -05:00
James Mikrut
ad2a54bb78 Merge pull request #1758 from payloadcms/fix/#1747
fix: #1747, rich text in arrays improperly updating initialValue when…
2022-12-23 11:53:21 -05:00
James
d417e50d52 fix: #1747, rich text in arrays improperly updating initialValue when moving rows 2022-12-23 11:47:16 -05:00
James Mikrut
16c41d36cf Merge pull request #1722 from payloadcms/fix/#551
fix: #551 - rich text nested list structure
2022-12-23 11:14:28 -05:00
James Mikrut
4e019e44b0 Merge pull request #1756 from payloadcms/fix/1753-date-field-updates
Fix: updatedAt and createdAt fields change
2022-12-23 11:04:30 -05:00
Jarrod Flesch
d7e7ee9a52 chore: threads global updatedAt through to edit view 2022-12-23 11:01:02 -05:00
James Mikrut
e7a16364c0 Merge pull request #1754 from payloadcms/fix/#1752
fix: #1752, removes label from row field type
2022-12-23 10:51:48 -05:00
James Mikrut
a46c220489 Merge pull request #1745 from payloadcms/fix/1737
fix: allows cleared file to be reselected
2022-12-23 10:50:30 -05:00
James Mikrut
830af2389e Merge pull request #1744 from payloadcms/fix/1739
fix: missing file after reselect in upload component
2022-12-23 10:49:38 -05:00
James Mikrut
332b5d1dad Merge pull request #1743 from payloadcms/fix/1736
fix: safely clears sort #1736
2022-12-23 10:48:50 -05:00
James Mikrut
3cde636d47 Merge pull request #1741 from payloadcms/fix/richtext-toolbar-drawer
fix: updates richtext toolbar position if inside a drawer
2022-12-23 10:47:42 -05:00
James Mikrut
c0293719d9 Merge pull request #1733 from payloadcms/fix/drawer-stepnav
fix: relationship labels and page stepnav
2022-12-23 10:46:54 -05:00
Jarrod Flesch
bd4ed5b99b fix: removes update and created at fields when duplicating, ensures updatedAt data is reactive 2022-12-23 10:39:15 -05:00
James Mikrut
0527e6f3ea Merge pull request #1700 from payloadcms/fix/#1666-api-key-header-label
fix: #1666 use the slug for authentication header API Key
2022-12-23 10:37:19 -05:00
James
ff3ab18d16 fix: #1752, removes label from row field type 2022-12-23 10:24:43 -05:00
James
691730974e chore: ensures that isListActive disregards editor parent 2022-12-23 10:15:26 -05:00
James
46a29f54fc chore: removes debugging for slate 2022-12-23 10:05:28 -05:00
James
95127c94a6 chore: fixes rich text tests 2022-12-23 09:54:41 -05:00
James
88a0c56f40 chore: finishes left indent of lists 2022-12-23 08:53:35 -05:00
Jacob Fletcher
6bd5907ad7 chore: reverts 9567328 2022-12-23 08:34:41 -05:00
James
801068c8fe chore: revises left indent 2022-12-22 18:26:09 -05:00
James
4516c3670e chore: overhauls lists, prepares for left indent 2022-12-22 15:55:07 -05:00
Jessica Boezwinkle
73b8ba3d4a fix: json field type 2022-12-22 14:12:39 +00:00
Jacob Fletcher
9567328d28 fix: refreshes document drawer on save 2022-12-21 22:42:00 -05:00
Jacob Fletcher
35abe811c1 fix: allows cleared file to be reselected 2022-12-21 17:55:48 -05:00
Jacob Fletcher
6bc1758dc0 fix: missing file after reselect in upload component 2022-12-21 17:28:09 -05:00
Jacob Fletcher
341c163b36 fix: safely clears sort #1736 2022-12-21 16:50:52 -05:00
PatrikKozak
468b0d2a55 fix: updates richtext toolbar position if inside a drawer 2022-12-21 11:49:31 -05:00
Elliot DeNolf
f873fa8d99 docs: add example Dockerfile and docker-compose.yml (#1735)
* docs: add example Dockerfile and docker-compose.yml

* docs: link to docker deployment from installation
2022-12-21 11:39:32 -05:00
Jacob Fletcher
59de4f7e82 fix: updates relationship label on drawer save and prevents stepnav update 2022-12-20 16:48:47 -05:00
Elliot DeNolf
f02bbe6308 chore: README logo (#1732)
* chore: README header logo

* updates conditionally rendered logo for light/dark mode

* adds img folder with light and dark logos to utilize gh conditional

* moves payload logos to avoid polluting root directory

Co-authored-by: Sean Zubrickas <zubricks@gmail.com>
2022-12-20 13:24:07 -05:00
Jessica Boezwinkle
e5835ae4f6 chore: cleans up files 2022-12-20 16:57:54 +00:00
Jessica Boezwinkle
309569c581 chore: pass options through to JSON and code fields, fix versions preview 2022-12-20 16:47:31 +00:00
James Mikrut
a88dddab22 Merge pull request #1728 from payloadcms/feat/account-doc-access
feat: adds doc permissions to account view
2022-12-20 10:08:01 -05:00
Jarrod Flesch
b5048a3323 chore: threads onSave through to account render component, refreshes docPermissions after successful save 2022-12-20 09:43:56 -05:00
Elliot DeNolf
3ec6b3d846 chore: revert README h1 2022-12-20 09:35:07 -05:00
Sean Zubrickas
d0dacdbde0 chore: readme updates (#1717)
* refines readme banner image, badges and headings

* chore: spruce up README a bit more

* adds dark/light mode support for logo

Co-authored-by: Elliot DeNolf <denolfe@gmail.com>
2022-12-20 09:28:12 -05:00
Jarrod Flesch
8d643fb29d feat: adds doc permissions to account view 2022-12-20 09:13:19 -05:00
Jessica Boezwinkle
e5ffb1e92d Merge branch 'master' of https://github.com/payloadcms/payload into feat/json-field 2022-12-20 13:33:02 +00:00
James
087eeb01a2 chore: rich text type declarations 2022-12-19 23:02:39 -05:00
James
542ea8eb81 fix: #551 - rich text nested list structure 2022-12-19 22:51:24 -05:00
Dan Ribbens
60bb2652f0 fix: get relationships in locale of i18n language setting (#1648) 2022-12-19 20:42:09 -05:00
Jarrod Flesch
7b769caf78 chore: stubs out data layer and simple frontend example allow explicit null value setting 2022-12-19 17:02:45 -05:00
Elliot DeNolf
0796d5394d chore: fix single quotes in translations file 2022-12-19 16:15:11 -05:00
Lukas Frana
0be4285305 feat: add Czech translation (#1705) 2022-12-19 16:12:57 -05:00
James Mikrut
e366624440 Merge pull request #1672 from payloadcms/fix/query-drafts
fix: #1611, unable to query draft versions with draft=true
2022-12-19 16:01:57 -05:00
James
c755143cc0 chore: uses mongo aggregate for merging draft results 2022-12-19 16:01:30 -05:00
James Mikrut
020a2797d5 Merge pull request #1716 from payloadcms/fix/#1656-image-sizes-patch
fix: #1656 remove size data
2022-12-19 15:44:16 -05:00
Dan Ribbens
389ee261d4 fix: #1656 remove size data 2022-12-19 15:31:03 -05:00
PatrikKozak
13fd974a2d Merge pull request #1715 from payloadcms/feat/graphql-16
feat(graphql): upgrade to graphql 16
2022-12-19 14:20:17 -05:00
James Mikrut
d492870924 Merge pull request #1709 from payloadcms/fix/#1698
fix: #1698 - globals and autosave not working
2022-12-19 14:07:14 -05:00
Calvin Lai
57f5f5ec43 feat(graphql): upgrade to graphql 16 2022-12-19 14:01:51 -05:00
Jarrod Flesch
0d06b8c178 Merge pull request #1711 from payloadcms/fix/1701-radio-validation
Fix/radio-field-validation
2022-12-19 12:17:13 -05:00
Jessica Chowdhury
9af4c1dde7 fix: prevents special characters breaking relationship field search (#1710)
* fix: prevents special characters breaking relationship field search

* test: add special char querying w/ like operator

Co-authored-by: Elliot DeNolf <denolfe@gmail.com>
2022-12-19 12:16:30 -05:00
Dan Ribbens
5b70ebd119 fix: use the slug for authentication header API Key
BREAKING CHANGE: replaced the useAPIKey authentication header format to use the collection slug instead of the collection label. Previous: `${collection.labels.singular} API-Key ${apiKey}`, updated: `${collection.slug} API-Key ${apiKey}`
2022-12-19 11:02:40 -05:00
Jarrod Flesch
0dfed3b30a fix: simplifies radio validation 2022-12-19 11:01:57 -05:00
James
915f1e2b3a fix: #1698 - globals and autosave not working 2022-12-19 10:52:11 -05:00
Elliot DeNolf
2e765a1e05 chore: log full error on transport configuration error (#1702) 2022-12-18 21:57:33 -05:00
James
26717c9ce4 chore(release): v1.3.4 2022-12-16 17:55:42 -05:00
James
fc35d845e7 Merge branch 'master' of github.com:payloadcms/payload 2022-12-16 17:39:51 -05:00
James Mikrut
6580fc7f91 Merge pull request #1690 from payloadcms/fix/doc-access
fix: doc access should not run where query on collections without id
2022-12-16 17:39:39 -05:00
James
1b8ab36123 chore: removes unnecessary async 2022-12-16 17:39:02 -05:00
Jarrod Flesch
b8c0482cda fix: run docAccess also when checking global 2022-12-16 17:38:29 -05:00
James Mikrut
100da03647 Merge pull request #1688 from payloadcms/fix/#1658-async-validate
fix: #1658 async validate out of order
2022-12-16 17:38:25 -05:00
Jarrod Flesch
016beb6eec fix: doc access should not run where query on collections without id 2022-12-16 17:36:41 -05:00
James Mikrut
f85d366500 Merge pull request #1689 from payloadcms/fix/#1687
fix: autosave with nested localized fields
2022-12-16 17:24:32 -05:00
James
a5670c3163 chore: simplifies logic for autosave patch 2022-12-16 17:24:13 -05:00
James
4202fc2933 fix: autosave with nested localized fields 2022-12-16 17:14:00 -05:00
Dan Ribbens
e913fbe4ea fix: async validate out of order 2022-12-16 16:45:38 -05:00
James
0fbfe149df chore(release): v1.3.3 2022-12-16 10:07:47 -05:00
Jessica Boezwinkle
07b2ccad61 feat: wires up i18n with monaco editor 2022-12-16 15:04:25 +00:00
James
f715146aa3 fix: ensures select field avoids circular dependencies 2022-12-16 10:01:08 -05:00
Jessica Boezwinkle
efe4f6d861 feat: fixes json editor errors and misc styling 2022-12-16 13:34:21 +00:00
James
8eaf05efef chore: json field now edits string but saves json in db 2022-12-15 21:10:56 -05:00
James
6c7282ec37 Merge branch 'feat/json-field' of github.com:payloadcms/payload into feat/json-field 2022-12-15 20:32:30 -05:00
James
d9d05f3644 chore: uses aggregate query if draft=true 2022-12-15 20:31:06 -05:00
Dan Ribbens
d88daa433e chore: Revert "chore: allow empty string route.api" (#1681) 2022-12-15 15:08:50 -05:00
Jessica Boezwinkle
4d6eba8d21 feat: updates code field editor 2022-12-15 18:47:53 +00:00
Jessica Boezwinkle
28d9f9009c feat: adds initial json field 2022-12-15 18:32:11 +00:00
Dan Ribbens
91e33ad1ee fix: allow translation in group admin.description (#1680) 2022-12-15 13:13:33 -05:00
James
4359564e2f chore(release): v1.3.2 2022-12-15 12:58:23 -05:00
James
420eef4d91 fix: safely handles rich text deselection 2022-12-15 12:39:57 -05:00
Dan Ribbens
d2f281d318 chore: update changelog 2022-12-15 12:26:06 -05:00
Dan Ribbens
2f723e0d78 chore(release): v1.3.1 2022-12-15 12:15:09 -05:00
Jacob Fletcher
a1813ca4b3 fix: stringifies date in DateTime field for useAsTitle (#1674) 2022-12-15 10:05:49 -05:00
Dan Ribbens
049d560898 fix: add i18n type to collection and globals admin.description (#1675) 2022-12-15 09:45:06 -05:00
Dan Ribbens
91493f9e8f chore: richtext relationship i18n label (#1662) 2022-12-15 09:23:21 -05:00
PatrikKozak
64086e8122 fix: collapsible children margin bottom (#1673) 2022-12-15 09:22:26 -05:00
Dan Ribbens
75d2cbe9e3 chore: update global admin group type (#1647) 2022-12-15 09:09:53 -05:00
Jacob Fletcher
a0b41eb83b fix: ensures unique document drawer slugs 2022-12-14 16:26:50 -05:00
James
44b31a9e58 fix: #1611, unable to query draft versions with draft=true 2022-12-14 16:25:04 -05:00
Jarrod Flesch
de4c7ae625 Merge pull request #1671 from iamprompt/fix-array-collapsible-label-i18n
fix: array collapsible lable i18n object
2022-12-14 16:20:41 -05:00
Jacob Fletcher
414ae9e11f Merge pull request #1669 from iamprompt/fix-label-i18n-add-relationship-tooltip
fix: add new relationship tooltip label translation
2022-12-14 16:17:20 -05:00
James Mikrut
f13742c1f7 Merge pull request #1670 from payloadcms/fix/select-field-clear-value
Fix/select field clear value
2022-12-14 16:16:21 -05:00
Jarrod Flesch
eda6f70acb Roadmap/#1379 admin ui doc level access (#1624)
* feat: adds document level access endpoints so admin ui can now accurately reflect document level access control
* chore(docs): new doc access callout, updates useDocumentInfo props from change
2022-12-14 16:14:29 -05:00
Supakarn Laorattanakul
8b18da78fe fix i18n object in array collapsible lable 2022-12-15 03:08:09 +07:00
Supakarn Laorattanakul
36c1008a22 fix label i18n - add new relationship tooltip 2022-12-15 02:49:00 +07:00
PatrikKozak
c52389ecb6 Merge branch 'master' of https://github.com/payloadcms/payload into fix/select-field-clear-value 2022-12-14 14:41:52 -05:00
PatrikKozak
80da898de8 fix: adds draftsEnabled to baseSchema for tabs / arrays / groups & allows for null enum 2022-12-14 14:41:41 -05:00
PatrikKozak
b4f39d5fd3 fix: removes case for select field that sets data to undefined if set to null 2022-12-14 14:39:39 -05:00
PatrikKozak
f0db5e0170 fix: adds draftsEnabled to versionSchema in collections / globals 2022-12-14 14:38:18 -05:00
Supakarn Laorattanakul
d9c45f62b1 fix: label translation in about to delete dialog (#1667) 2022-12-14 13:16:15 -05:00
Jacob Fletcher
3ae5d954b5 Merge pull request #1558 from jacobsfletch/feat/inline-relationships
roadmap: inline relationships
2022-12-14 09:51:54 -05:00
PatrikKozak
934b443b5b fix: list view date field display format (#1661) 2022-12-14 07:09:54 -05:00
James Mikrut
965bd456cd Merge pull request #1653 from damtzi/fix/#1652-dashboard-to-custom-route
fix: Set 'Dashboard's link to config route (#1652)
2022-12-13 11:00:43 -05:00
Damian Tziamtzis
9d4dac892e fix: Remove template literal from link 2022-12-12 23:16:56 +01:00
Damian Tziamtzis
940c1e84f5 fix: Set 'Dashboard's link to config route (#1652) 2022-12-12 23:10:57 +01:00
Alessio Gravili
1d7ed8aff9 chore: add default credentials to contributing.md (#1642) 2022-12-12 09:40:34 -05:00
Supakarn Laorattanakul
c15da3178e chore: improve thai translation (#1641) 2022-12-12 09:13:13 -05:00
Elliot DeNolf
c0f8f94cd6 chore: update payload component usage comment 2022-12-11 12:43:21 -05:00
Jacob Fletcher
92d2c4d805 fix: fields e2e tests 2022-12-09 17:50:54 -05:00
Jacob Fletcher
50ea48901e Merge branch 'master' into feat/inline-relationships 2022-12-09 15:37:40 -05:00
Jacob Fletcher
c72f074b77 fix: fields-relationship e2e tests 2022-12-09 15:34:35 -05:00
PatrikKozak
72f7927cc6 chore: adds close & edit keys to translations (#1640) 2022-12-09 14:57:40 -05:00
Jacob Fletcher
cb0437fbca Merge branch 'master' into feat/inline-relationships 2022-12-09 13:18:49 -05:00
Jacob Fletcher
bc6cc8dd14 chore: bumps pino-pretty to latest 2022-12-09 13:16:54 -05:00
Jacob Fletcher
1695b8f263 chore: document drawer a11y 2022-12-09 13:01:57 -05:00
Elliot DeNolf
6ea462c0f7 docs: fix graphql localhost link 2022-12-09 12:24:09 -05:00
Dan Ribbens
45e4504a7b chore(release): v1.3.0 2022-12-09 09:53:33 -05:00
Elliot DeNolf
ba2f2d6e9b feat!: no longer sanitize collection slugs to kebab case (#1607)
BREAKING CHANGE: collection slugs are no longer automatically sanitized to be kebab case. This will only be an issue if your current slugs were in camel case. The upgrade path will be to change those slugs to the kebab case version that the slug was automatically being sanitized to on the backend.

If you only use kebab case or single word slugs: no action needed.

If you have existing slugs with camel case and populated data: you'll need to convert these to the kebab case version to match the previously sanitized value.

ie. myOldSlug is your slug, you should convert it to my-old-slug.

Any future slugs after updating will be used as-is.
2022-12-09 09:40:05 -05:00
Nut Pinyo
7777d11b9e feat: add Thai translation (#1630) 2022-12-09 09:38:57 -05:00
Dan Ribbens
eff3f18e7c fix: #1632 graphQL non-nullable relationship and upload fields (#1633) 2022-12-09 09:38:05 -05:00
Dan Ribbens
756edb858a fix: Select with hasMany and localized (#1636) 2022-12-09 09:36:39 -05:00
Dan Ribbens
b6c597ab5c fix: translation key in revert published modal (#1628) 2022-12-09 09:35:40 -05:00
Dan Ribbens
a44dba5ccc chore: cleanup test fields relationship config (#1635) 2022-12-08 22:46:31 -05:00
Dan Ribbens
11b1c0efc6 fix: filterOptions function argument relationTo is an array (#1627)
Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2022-12-08 21:24:00 -05:00
Jacob Fletcher
3da0cb9c79 chore: improves useDocumentDrawer memoization 2022-12-08 18:13:46 -05:00
Jacob Fletcher
a36ac209b2 fix: drawer blur, scroll, and document sidebar 2022-12-08 18:12:48 -05:00
Jacob Fletcher
e101f925cc feat: further Tooltip improvements 2022-12-08 17:01:00 -05:00
James
bff7c9f7aa chore: ensures rich text initialValue exists 2022-12-08 16:11:13 -05:00
Jacob Fletcher
17fac6e6a0 chore: general ReactSelect and Relationship styles 2022-12-08 14:22:02 -05:00
Jacob Fletcher
00b3b768eb feat: supports tooltip show and delay 2022-12-08 14:11:55 -05:00
James
9558a22ce6 fix: resets slate state when initialValue changes, fixes #1600, #1546 2022-12-08 11:39:17 -05:00
Jarrod Flesch
512bc1ebe6 fix: sanitizes global find query params 2022-12-08 08:39:17 -05:00
Jacob Fletcher
39a956cee3 fix: relationship drawer permissions 2022-12-07 16:40:42 -05:00
Jacob Fletcher
6da13f3794 chore: moves drawer logic from ReactSelect to Relationship 2022-12-07 16:22:33 -05:00
Dan Ribbens
471d21410a fix: change edit key to prevent richtext editor from crashing (#1616) 2022-12-07 14:47:47 -05:00
Jacob Fletcher
f290cda333 fix: escapes react-select events when drawer is open 2022-12-07 12:40:19 -05:00
Christoffer Bjelke
759f001681 feat: add Norwegian bokmål (nb) translation (#1614) 2022-12-07 10:39:02 -05:00
Carsten Dietzel
dc806a9650 chore: update de.json (#1608) 2022-12-07 07:54:25 -05:00
Jacob Fletcher
5f0227fa80 chore: custom react-select clear indicator 2022-12-06 23:45:27 -05:00
Jacob Fletcher
e2fce30964 fix: add new relationship modal when related to many 2022-12-06 18:00:58 -05:00
James Mikrut
1c193b0ed2 Merge pull request #1609 from payloadcms/chore/translation-key-problem-uploading
chore: fix incorrect translation key in FileUploadError
2022-12-06 16:02:06 -05:00
Dan Ribbens
5588b342d7 chore: fix incorrect translation key in FileUploadError 2022-12-06 15:51:00 -05:00
Jacob Fletcher
f4b099a3d1 chore: removes useDrawer hook and drawer context 2022-12-06 14:56:14 -05:00
Jacob Fletcher
49528dd3c3 fix: relationship create and edit onSave handling 2022-12-06 14:56:03 -05:00
James Mikrut
3aee027b0f Merge pull request #1606 from jacobsfletch/fix/1605-filter-options
fix: unflattens fields in filterOptions callback
2022-12-06 13:53:07 -05:00
Jacob Fletcher
92177e012c Merge branch 'master' into feat/inline-relationships 2022-12-06 13:00:15 -05:00
Jacob Fletcher
acff46b4a5 fix: unflattens fields in filterOptions callback 2022-12-06 12:26:58 -05:00
Jacob Fletcher
445c6fc775 chore: reconfigures useDocumentDrawer hook 2022-12-06 12:13:30 -05:00
Jarrod Flesch
de57aa8417 Merge pull request #1532 from payloadcms/feat/#1423-copy-paste-upload
Feat/#1423 copy paste upload
2022-12-06 10:20:13 -05:00
Jarrod Flesch
ff1b4b098c style: reverts upload field to original, keeps underlying copy-paste functionality 2022-12-06 10:05:22 -05:00
James
a72123dd47 fix: #1547, global afterChange hook not falling back to original global if nothing returned 2022-12-06 09:56:52 -05:00
James
5d0fe9a6da chore(release): v1.2.5 2022-12-06 09:38:25 -05:00
James
04eaf725a0 Merge branch 'master' of github.com:payloadcms/payload 2022-12-06 09:32:18 -05:00
James
46a96ccb2e chore: ensures date field modifies form modified 2022-12-06 09:32:10 -05:00
James Mikrut
0b857f7234 Merge pull request #1584 from kalon-robson/fix/missing-unpublish
fix: #1583 mismatch language condition when rendering unpublish
2022-12-06 09:18:06 -05:00
torunai
c8a683100f feat: add Turkish translations (#1596) 2022-12-06 09:14:22 -05:00
Jacob Fletcher
4e0dd3d12d Merge pull request #1592 from jacobsfletch/fix/relationship-option
fix: relationship option
2022-12-05 17:15:49 -05:00
Jacob Fletcher
d9eb1ea801 fix: remounts document drawer when single-value relationship changes 2022-12-05 14:07:42 -05:00
Jacob Fletcher
881c067c40 fix: exits findOptionsByValue when matchedOption is found 2022-12-05 14:04:46 -05:00
PatrikKozak
9d4f4c6305 chore: removes isLocked since not being defined and always returning false (#1553) 2022-12-05 12:37:50 -05:00
Jarrod Flesch
3e2d1b5e9d Merge pull request #1580 from payloadcms/fix/inline-relationship-select
fix: uses pathOrName to pass to internal Relationship field components
2022-12-05 11:09:03 -05:00
James
b6ec4bd2d4 chore: binds prefs model even if not local 2022-12-05 10:25:36 -05:00
Jarrod Flesch
b70dc83d0e Merge pull request #1589 from payloadcms/fix/NaN-limit-and-depth-query
fix: safely coerces limit and depth to number or undefined
2022-12-05 09:29:59 -05:00
Roman Ryzhikov
a2eda6999a chore: update russian translation (#1582) 2022-12-05 09:29:00 -05:00
Jarrod Flesch
dd04d7842e fix: safely coerces limit and depth to number or undefined 2022-12-05 08:41:47 -05:00
Jacob Fletcher
3c862add3c fix: prevents react-select from opening on drawer toggle 2022-12-05 00:29:30 -05:00
Kalon Robson
3ddd0ea3ef fix: mismatch language condition when rendering unpublish 2022-12-04 00:42:38 +00:00
bobbyZ
8ad0042f5f chore: added german translation for richtext fields (#1579) 2022-12-03 17:06:26 -05:00
Jarrod Flesch
8874e871d4 fix: uses pathOrName to pass to internal Relationship field components 2022-12-03 13:44:46 -05:00
Dan Ribbens
356ab8d7eb chore(release): v1.2.4 2022-12-03 12:40:50 -05:00
Dan Ribbens
2dcada199c fix: missing translation richText link modal (#1573) 2022-12-03 12:29:33 -05:00
Dan Ribbens
ca59efe396 chore: typescript typo fix (#1575) 2022-12-03 12:28:08 -05:00
Jacob Fletcher
5592fb148d feat: custom button html element 2022-12-03 00:31:00 -05:00
Jacob Fletcher
1f53990bb1 Merge branch 'master' into feat/inline-relationships 2022-12-02 23:14:10 -05:00
Jacob Fletcher
811ade60b4 feat: wires DocumentDrawer into singular relationships 2022-12-02 17:44:12 -05:00
Jacob Fletcher
6fab722a2e fix: prevents duplicative DocumentDrawer 2022-12-02 15:46:46 -05:00
Jacob Fletcher
83eef0bc77 chore: migrates from react-sortable-hoc to @dnd-kit 2022-12-02 14:26:26 -05:00
Dan Ribbens
308dc3d600 chore(release): v1.2.3 2022-12-02 12:52:18 -05:00
Dan Ribbens
396ea0bd53 fix: reset password regression (#1574) 2022-12-02 12:36:19 -05:00
Dan Ribbens
44df7f523b chore(release): v1.2.2 2022-12-01 20:24:05 -05:00
James Mikrut
8b36ff8d60 Merge pull request #1551 from payloadcms/fix/#1505-collection-model-types
chore: extend CollectionModel type to include mongoose model
2022-12-01 19:30:25 -05:00
James Mikrut
e01b165693 Merge pull request #1559 from payloadcms/fix/#1512-localized-drafts
fix: update drafts includes latest version changes
2022-12-01 19:08:23 -05:00
James Mikrut
15671f2494 Merge pull request #1564 from payloadcms/docs/update-label-descriptions
docs: remove GraphQL from label descriptions
2022-12-01 19:07:44 -05:00
Jacob Fletcher
dd217750d7 feat: retrofits DocumentDrawer into relationship multi-select 2022-12-01 18:01:51 -05:00
Jacob Fletcher
7a42e38cca feat: supports custom react-select components 2022-12-01 17:42:24 -05:00
Jacob Fletcher
475f147f2c feat: retrofits DocumentDrawer into relationship AddNew 2022-12-01 16:39:51 -05:00
Jacob Fletcher
670e5243a9 fix: prevents recursive DocumentDrawer 2022-12-01 16:39:51 -05:00
Jacob Fletcher
2118927f42 feat: builds DocumentDrawer component 2022-12-01 16:39:51 -05:00
Jacob Fletcher
f8cf4c7b6a chore: reconfigures drawer context 2022-12-01 16:39:51 -05:00
Jacob Fletcher
c6013c3904 feat: builds Drawer component 2022-12-01 16:39:51 -05:00
Jarrod Flesch
80d8367a2f Merge pull request #1560 from payloadcms/roadmap/#1401-decouple-pagination-args
Roadmap/#1401 decouple pagination args
2022-12-01 16:34:22 -05:00
Dan Ribbens
283343c4a4 docs: update upload filterOptions 2022-12-01 15:50:41 -05:00
Dan Ribbens
924d903456 docs: remove GraphQL from label descriptions 2022-12-01 15:48:40 -05:00
Justin Nicewander
49efd028fa docs: add filter options section to upload field docs. (#1550) 2022-12-01 15:47:37 -05:00
Jarrod Flesch
e6bda625b4 chore: fixes test expectation 2022-12-01 12:17:47 -05:00
Jarrod Flesch
226c7d5da5 chore: adds REST test for http limitless query param 2022-12-01 11:43:15 -05:00
Jarrod Flesch
891f00d05c fix: allows for limit bypass on version find operations 2022-12-01 10:44:11 -05:00
Jarrod Flesch
c8d1b9f88a fix: sanitize number query params before passing to find operation 2022-12-01 10:06:22 -05:00
Jarrod Flesch
a71801006c fix: adjusts how limit is set, both in options and paginates limit 2022-12-01 09:10:56 -05:00
Jarrod Flesch
dc4e0971a6 chore: simplifies logic to decouple pagination and limit 2022-12-01 08:17:00 -05:00
Jarrod Flesch
f7ce0c615d feat: decouples limit from pagination, allows for no limit query 2022-11-30 22:18:37 -05:00
Jarrod Flesch
dce2081663 fix: aligns mongoose PaginatedDocs type with actual lib type 2022-11-30 22:17:38 -05:00
Dan Ribbens
48989d0f6e fix: update drafts includes latest version changes 2022-11-30 17:03:00 -05:00
Chris Waschl
47fd0d9ec4 fix(i18n): requiresAtLeast variable in de.json (#1556) 2022-11-30 16:32:37 -05:00
Dan Ribbens
bbe547ec47 chore: extend CollectionModel type to include mongoose model 2022-11-30 10:47:04 -05:00
Dan Ribbens
c211a804bd chore: change test assertion to be more consistent (#1543) 2022-11-29 18:24:40 -05:00
Dan Ribbens
57fbff3655 chore: fix translation rich text links (#1499) 2022-11-29 16:36:05 -05:00
Jarrod Flesch
5a158c1b58 Merge pull request #1541 from payloadcms/fix/#1495-sharp-types
Fix/#1495 Sharp types
2022-11-29 16:19:46 -05:00
Jarrod Flesch
088cc16f9b Merge pull request #1523 from payloadcms/fix/#1461-unpublish-validation
Fix/#1461 Form validation when un-publishing
2022-11-29 16:02:50 -05:00
Jarrod Flesch
b3d526b59a fix: moves sharp types from devDeps to deps 2022-11-29 16:00:53 -05:00
Jarrod Flesch
afe2ed2ebc chore: removes frontend ui logic, unnecessary when overwriting document on unpublish 2022-11-29 15:44:56 -05:00
Jarrod Flesch
e6f1c6fc7b fix: corrects skipValidation 2022-11-29 15:44:56 -05:00
Jarrod Flesch
77ab54243a fix: ignore validation when unpublishing, do not allow restore with invalid form state 2022-11-29 15:44:56 -05:00
Dan Ribbens
5a69ed562e chore: fix translation key requiresAtLeast (#1538) 2022-11-29 15:43:41 -05:00
Angelo Bartolome
7aada3c746 fix: indexSortableFields timestamp fields #1506 (#1537) 2022-11-29 15:36:27 -05:00
Jarrod Flesch
425b66a0c2 Merge pull request #1501 from payloadcms/fix/#1446-graphql-contains-schema 2022-11-29 14:15:41 -05:00
Jacob Fletcher
f4ac714286 Merge pull request #1520 from jacobsfletch/docs/rate-limit
docs: rateLimit defaults
2022-11-29 12:50:28 -05:00
Jacob Fletcher
c9bfdbb63c docs: rateLimit defaults 2022-11-29 12:48:53 -05:00
Jarrod Flesch
c56381b721 Merge pull request #1475 from payloadcms/fix/#1442-reactive-relationship-select
Fix/#1442 reactive relationship select
2022-11-29 11:24:37 -05:00
Jarrod Flesch
70675251e5 Merge pull request #1529 from iheidari-aci/patch-1
Add type to fix TS error for re-exporting a type
2022-11-29 11:17:46 -05:00
Jarrod Flesch
3482dd5f78 Merge pull request #1521 from payloadcms/fix/light-theme-syntax
fix: updates syntax colors for light theme
2022-11-29 11:14:11 -05:00
Jessica Boezwinkle
3eebd6613f fix: updates code field css 2022-11-29 16:05:28 +00:00
Jessica Boezwinkle
d03f0aef84 fix: uses baseClass in code field 2022-11-29 16:03:34 +00:00
Jarrod Flesch
b0964b066b chore: exports types as types from /components 2022-11-29 10:37:46 -05:00
Thomas Ghysels
5bd86571ca feat: improve typescript comments (#1467) 2022-11-29 10:10:30 -05:00
Elliot DeNolf
a90a1a9e19 feat: log email transport error messages (#1469) 2022-11-29 09:33:00 -05:00
Jarrod Flesch
d10a993465 Merge pull request #1534 from payloadcms/fix/#1517-blockName-cutoff
fix: blockName grows in all browsers
2022-11-29 09:28:25 -05:00
Jarrod Flesch
03c2ab52a8 fix: blockName grows in all browsers 2022-11-29 08:57:53 -05:00
Jarrod Flesch
143362d45c chore: styles copy paste, adds text translations 2022-11-29 08:41:17 -05:00
Arick
eb69b82adf feat: upload support pasting file 2022-11-29 08:26:11 -05:00
Jessica Boezwinkle
1a6c9a3e18 feat: removes theme provider and updates background for code fields 2022-11-29 10:48:57 +00:00
Iman
6cb9ab6b44 Add type to fix TS error for re-exporting a type
To fix TS error:
Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
2022-11-28 18:28:49 -08:00
Dan Ribbens
04c689c5b0 fix: handle multiple locales in relationship population (#1452) 2022-11-28 14:24:01 -05:00
Jessica Boezwinkle
dbfe7ca6e6 fix: updates syntax colors for light theme 2022-11-28 16:22:13 +00:00
Christian Reichart
e9d2163601 fix: german translation optimizations (#1485)
Co-authored-by: Christian Reichart <christian.reichart@camperboys.com>
2022-11-28 10:02:58 -05:00
Jarrod Flesch
ec51929b1a fix: ensures enums cannot query on partial matches 2022-11-23 16:38:25 -05:00
Jarrod Flesch
a0d03667c5 docs: updates messsy components banner 2022-11-23 16:21:44 -05:00
Jacob Fletcher
246ab414c8 chore: writes e2e test for dynamic filterOptions 2022-11-23 15:11:16 -05:00
Jarrod Flesch
cde1f128e9 chore: adds contains to operators.contains 2022-11-23 14:59:51 -05:00
Jarrod Flesch
4c37af6f10 fix: adds contain operators for text/email/radio fields 2022-11-23 14:46:54 -05:00
Jarrod Flesch
5e829a94bf Merge pull request #1482 from payloadcms/fix/#1479-edit-view-sidebar-styles
Fix/#1479 edit view sidebar styles
2022-11-23 14:26:10 -05:00
Jarrod Flesch
56144c07f0 chore: merge tests 2022-11-23 14:05:56 -05:00
Jacob Fletcher
99c1f41e30 fix: dynamic relationship filterOptions 2022-11-23 13:47:44 -05:00
Jacob Fletcher
be9b5adfa3 types: passes generic through FilterOptions 2022-11-23 13:00:19 -05:00
Jacob Fletcher
a9da81f18c fix: reverts async reducer and resolves infinite effect 2022-11-23 12:11:01 -05:00
Jacob Fletcher
54ef40a335 fix: moves relationship field useEffect into async reducer action 2022-11-23 10:39:38 -05:00
James
fbb4944e83 chore: fixes broken tests and ts 2022-11-22 20:05:40 -05:00
James
56682c7fd4 chore: improves logic for ensuring programmatically set relationship values have options loaded 2022-11-22 19:35:23 -05:00
Vlad Kovalevsky
114758b193 chore: allow empty string route.api 2022-11-22 15:46:22 -05:00
Jarrod Flesch
1602bdc17a chore: moves ensureValuesAreLoaded into effect 2022-11-22 15:17:04 -05:00
Dan Ribbens
9ea41fbb58 chore: fix translation key (#1491) 2022-11-22 13:12:58 -05:00
Jarrod Flesch
59631c7879 chore: adds preview button to versions test configs 2022-11-22 09:13:41 -05:00
Jarrod Flesch
9770affad0 chore: improves edit screen sidebar styles 2022-11-22 09:13:00 -05:00
Dan Ribbens
9f6f2d24f3 Merge branch 'master' of github.com:payloadcms/payload 2022-11-21 21:31:16 -05:00
Dan Ribbens
efb4bd17d4 chore(release): v1.2.1 2022-11-21 21:30:59 -05:00
Dan Ribbens
3a9dc9ef68 fix: translate select field option labels (#1476) 2022-11-21 20:45:23 -05:00
Dan Ribbens
8123585592 fix: translate version comparison view field labels (#1470) 2022-11-21 20:19:16 -05:00
Jarrod Flesch
1d1d2493aa fix: rendering of localized select value 2022-11-21 17:07:22 -05:00
Dan Ribbens
7b6a9ede6e feat: add i18n to option labels in version comparison (#1477) 2022-11-21 16:38:01 -05:00
Dan Ribbens
400cb9b6bc fix: invalid query string user account request (#1478) 2022-11-21 16:32:15 -05:00
Carlo Brualdi
078c28bd5f fix: versionCount was broken & other i18n improvements (#1450) 2022-11-21 16:24:13 -05:00
Jarrod Flesch
23f1ac1e72 chore: updates inline comment 2022-11-21 16:12:50 -05:00
Jarrod Flesch
16d00e87c2 fix: infinite rerenders, accounts for hasMany false 2022-11-21 16:09:31 -05:00
Jarrod Flesch
6a28a41069 chore: adds precision to relationship test 2022-11-21 15:17:48 -05:00
Jacob Fletcher
59a4355614 Merge pull request #1451 from jacobsfletch/fix/draft-patch
fix: ensures draft operations save as drafts
2022-11-21 15:15:52 -05:00
Jarrod Flesch
e4435bb8bd fix: allows for form controlled relationship fields to be populated 2022-11-21 12:55:06 -05:00
Dan Ribbens
3a622fcd63 chore: fix translation namespace typo (#1460) 2022-11-21 11:21:44 -05:00
James Mikrut
29ed75c329 Merge pull request #1456 from jacobsfletch/fix/reactive-stepnav
fix: dynamically sets stepnav from default edit view
2022-11-21 09:13:23 -05:00
Jarrod Flesch
9303e32273 Merge pull request #1420 from thgh/fix/textarea-click-target
fix: Increase textarea click area
2022-11-21 08:13:24 -05:00
Elliot DeNolf
3dbf4e2cd7 chore: simplify bug report template 2022-11-20 12:57:05 -05:00
Ed
5673b709ec docs: make it clear that lockTime is defined in ms (#1459) 2022-11-20 12:50:03 -05:00
Valentín Costa
b00987b044 docs: add missing S in example of i18n (#1463) 2022-11-20 12:47:52 -05:00
Elliot DeNolf
075b7e9f02 fix(i18n): version count (#1465) 2022-11-20 12:46:57 -05:00
Jacob Fletcher
40c87784b0 fix: dynamically sets stepnav from default edit view 2022-11-18 17:30:33 -05:00
Jarrod Flesch
bf30713860 chore: removes unnecessary styles 2022-11-18 16:14:31 -05:00
Jarrod Flesch
2e57b76df0 fix: adjusts styles to allow error bg to fill textarea 2022-11-18 16:11:32 -05:00
Jarrod Flesch
ab4aa9eec6 Merge pull request #1453 from payloadcms/fix/#1424-isClearable-select
fix: sanitizes null select value on the server
2022-11-18 15:19:02 -05:00
Jarrod Flesch
699ca14434 fix: sanitizes select values on the server, allowing isClearable selects to be cleared without error 2022-11-18 14:58:51 -05:00
Jacob Fletcher
25822a91b1 fix: allows patching global drafts #1415 2022-11-18 14:55:24 -05:00
Jacob Fletcher
f700f51f2b fix: flattens locales before versioning published docs #1415 2022-11-18 14:31:25 -05:00
Jacob Fletcher
af6a7aa9e8 fix: versions tests 2022-11-18 14:27:58 -05:00
Jacob Fletcher
b3c232dbbe chore: write tests for draft patches #1415 2022-11-18 13:08:24 -05:00
Jacob Fletcher
fc16ffefdb fix: ensures drafts operations saves as draft #1415 2022-11-18 13:08:16 -05:00
Jarrod Flesch
1d6cf04647 Merge pull request #1447 from payloadcms/fix/1441-options-type
Fix/1441 options type
2022-11-18 12:29:28 -05:00
Jarrod Flesch
a2c0481f59 chore: updates changelog with examples 2022-11-18 11:37:29 -05:00
Jarrod Flesch
bb6ee6a974 chore: reverts irrelevant ts-config change 2022-11-18 08:26:05 -05:00
Dan Ribbens
fa577d0490 chore(release): v1.2.0 2022-11-18 07:43:45 -05:00
Dan Ribbens
bab34d82f5 feat: add i18n to admin panel (#1326)
Co-authored-by: shikhantmaungs <shinkhantmaungs@gmail.com>
Co-authored-by: Thomas Ghysels <info@thomasg.be>
Co-authored-by: Kokutse Djoguenou <kokutse@Kokutses-MacBook-Pro.local>
Co-authored-by: Christian Gil <47041342+ChrisGV04@users.noreply.github.com>
Co-authored-by: Łukasz Rabiec <lukaszrabiec@gmail.com>
Co-authored-by: Jenny <jennifer.eberlei@gmail.com>
Co-authored-by: Hung Vu <hunghvu2017@gmail.com>
Co-authored-by: Shin Khant Maung <101539335+shinkhantmaungs@users.noreply.github.com>
Co-authored-by: Carlo Brualdi <carlo.brualdi@gmail.com>
Co-authored-by: Ariel Tonglet <ariel.tonglet@gmail.com>
Co-authored-by: Roman Ryzhikov <general+github@ya.ru>
Co-authored-by: maekoya <maekoya@stromatolite.jp>
Co-authored-by: Emilia Trollros <3m1l1a@emiliatrollros.se>
Co-authored-by: Kokutse J Djoguenou <90865585+Julesdj@users.noreply.github.com>
Co-authored-by: Mitch Dries <mitch.dries@gmail.com>

BREAKING CHANGE: If you assigned labels to collections, globals or block names, you need to update your config! Your GraphQL schema and generated Typescript interfaces may have changed. Payload no longer uses labels for code based naming. To prevent breaking changes to your GraphQL API and typescript types in your project, you can assign the below properties to match what Payload previously generated for you from labels.

On Collections
Use `graphQL.singularName`, `graphQL.pluralName` for GraphQL schema names.
Use `typescript.interface` for typescript generation name.

On Globals
Use `graphQL.name` for GraphQL Schema name.
Use `typescript.interface` for typescript generation name.

On Blocks (within Block fields)
Use `graphQL.singularName` for graphQL schema names.
2022-11-18 07:36:30 -05:00
Jarrod Flesch
7c6d6fd1ca feat: exports field types properly 2022-11-17 17:06:34 -05:00
Jarrod Flesch
ed01a17621 fix: removes incorrectly import/export option type - #1441 2022-11-17 16:45:38 -05:00
Jarrod Flesch
c49ee15b6a Merge pull request #1223 from bigmistqke/feat/customizable-header-labels
WIP: customizable RowHeaders
2022-11-16 15:06:16 -05:00
Jarrod Flesch
402b1e4615 chore: adds visualization to test examples, reduces collapsibles in test file 2022-11-16 14:54:36 -05:00
Jarrod Flesch
8d827933f3 docs: updates docs to reflect new API 2022-11-16 13:35:00 -05:00
Jarrod Flesch
65f0e1caac fix: build errors 2022-11-16 13:08:07 -05:00
Jarrod Flesch
d9df98ff22 feat: simplifies collapsible label API, adds e2e tests 2022-11-16 12:57:54 -05:00
Jarrod Flesch
999c8fc08b Merge remote-tracking branch 'origin/master' into pr/bigmistqke/1223 2022-11-16 09:05:07 -05:00
Jarrod Flesch
fe221aea67 Merge remote-tracking branch 'origin/master' into pr/bigmistqke/1223 2022-11-16 09:00:53 -05:00
Jarrod Flesch
57a8c352e4 feat: adds playwright tests for array fields 2022-11-16 09:00:50 -05:00
Thomas Ghysels
c303913e61 fix: Increase textarea click area 2022-11-16 01:41:08 +01:00
Jarrod Flesch
e458087a55 fix: sets pointer-events to none so the entire label bar is clickable 2022-11-15 16:05:54 -05:00
Jarrod Flesch
ccb42319ab fix: corrects type for CollapsibleLabel example type, adjusts custom component filenames 2022-11-15 12:40:31 -05:00
Jarrod Flesch
2bf0fffa0d feat: adds docs example 2022-11-15 12:37:47 -05:00
Jarrod Flesch
b74ea218ca feat: specifies component names for arrays/collapsibles, simplifies threaded data 2022-11-15 11:34:36 -05:00
James
49cbb2d0ac chore(release): v1.1.26 2022-11-15 09:26:01 -05:00
Jarrod Flesch
2878b4b1be fix: corrects exported custom component type 2022-11-15 09:23:20 -05:00
James
0f0dc0948e Merge branch 'master' of github.com:payloadcms/payload 2022-11-15 09:21:00 -05:00
James
50bcf001ea fix: #1414 2022-11-15 09:20:54 -05:00
James Mikrut
7be202486b Update CHANGELOG.md 2022-11-15 08:40:12 -05:00
James
f938dd718f chore(release): v1.1.25 2022-11-15 08:39:43 -05:00
James Mikrut
94b2ef1613 Merge pull request #1411 from jacobsfletch/master
Saves tabs to user preferences
2022-11-15 08:06:03 -05:00
Jacob Fletcher
71a6c58b27 chore: cleans up handleTabChange async callback 2022-11-15 07:40:39 -05:00
Jarrod Flesch
13ec1e0398 feat: converts rowHeader to collapsibleLabel, extends data passed to functions/components 2022-11-15 01:53:09 -05:00
Jacob Fletcher
35426eef36 feat: updates tab preference keys 2022-11-14 18:30:18 -05:00
Jacob Fletcher
32833ec571 Merge branch 'payloadcms:master' into master 2022-11-14 17:49:36 -05:00
Jacob Fletcher
5eb8e4a28f feat: saves tab index to user preferences 2022-11-14 17:49:18 -05:00
Thomas Ghysels
0f27b103b4 feat: let textarea grow based on value (#1398)
* feat: autogrowing textarea

* feat: sets textarea min-height and reduces height on mobile

Co-authored-by: Jessica Boezwinkle <jessica@trbl.design>
2022-11-14 16:26:22 -05:00
James
d103f6c94f fix: ensures admin components is defaulted 2022-11-14 15:46:34 -05:00
Alberto Maghini
a345ef0d31 feat: admin UI logout extensibility (#1274)
* added Logout documentation

* updated type and schema

* updated logout component, route and inactivityRoute references

* added custom Logout component into test admin instance

* fixed windows path management

* added dotenv usage

* added check on testSuiteDir and provided more meaningful error message

* fixed object destructure

* updated from logout.route to logoutRoute

* extracted getSanitizedLogoutRoutes method

* added unit tests

* updated references

* updated doc

* reviewed casing and added defaults

* updated usage

* restored workers previous value

* fixed config validation

* updated docs and schema

* updated reference to logoutRoute and inactivityRoute

* updated test ref

Co-authored-by: Alberto Maghini (MSC Technology Italia) <alberto.maghini@msc.com>
Co-authored-by: Alberto Maghini <alberto@newesis.com>
2022-11-14 14:55:31 -05:00
Thomas Ghysels
4d8cc97475 fix: add slug to DocumentInfo context (#1389) 2022-11-14 14:54:05 -05:00
James
7556b54017 chore: fixes TS error in UploadGallery 2022-11-14 14:49:31 -05:00
Feng Sun
5e8a8b2df9 fix: adds unique key to upload cards to prevent old images being shown while navigating to new page 2022-11-14 14:48:08 -05:00
James Mikrut
244fb63c6d Update what-is-payload.mdx 2022-11-14 14:19:48 -05:00
bigmistqke
e4f2be3dec RowHeaderFunction becomes RowHeaderComponent 2022-11-14 17:44:39 +01:00
bigmistqke
f43f433f51 add index to tests 2022-11-14 17:42:50 +01:00
James Mikrut
84f01e8836 Update ui.mdx 2022-11-14 10:11:28 -05:00
bigmistqke
30def3511e add RowHeaders to array's and collapsible's tests 2022-11-14 15:54:21 +01:00
bigmistqke
27499981c8 admin.header to admin.components.RowHeader 2022-11-14 15:53:37 +01:00
bigmistqke
d5e725c608 fix: components optional chaining 2022-11-14 15:52:43 +01:00
bigmistqke
ef5cc2ab0f rename RowLabel-parameter to RowHeader 2022-11-14 15:51:47 +01:00
bigmistqke
5cd87a754b update collapsible's schema and type 2022-11-14 15:12:58 +01:00
bigmistqke
b1370b814a fix bug: deleted baseAdminFields caused errors
also rename admin.header to admin.components.RowHeader
2022-11-14 15:04:45 +01:00
bigmistqke
b1105085c5 rename RowLabel to RowHeader
edit RowLabel.fallback's type to allow strings
2022-11-14 15:02:55 +01:00
Elliot DeNolf
cdaa8cc29f fix: global afterRead and afterChange execution (#1405) 2022-11-14 08:18:58 -05:00
bigmistqke
811913cb85 rename files and collapse types
RowLabel becomes RowHeader for continuity purposes
RowHeaderFunction is removed from types as it is equal to Component
2022-11-14 14:13:51 +01:00
James Mikrut
7356d8977f Update overview.mdx 2022-11-13 20:39:26 -05:00
James
a3959ca5d8 chore(release): v1.1.24 2022-11-13 19:21:13 -05:00
Thomas Ghysels
216b9f88d9 fix: cursor jumping while typing in inputs
* Revert "feat: optimizes field performance by storing internal values in useField hook"

This reverts commit 66210b856b.

* fix: Lightweight fix for cursor jump issue

Resolves #1393
2022-11-13 19:14:16 -05:00
James
183cd9a0be chore: updates docs to reflect new website public images folder 2022-11-13 17:41:39 -05:00
James
5f5c7ba7bf chore(release): v1.1.23 2022-11-12 18:58:34 -05:00
James
66210b856b feat: optimizes field performance by storing internal values in useField hook 2022-11-12 18:46:31 -05:00
James
2f684040fc fix: #1361, ensures collection auth depth works while retrieving static assets 2022-11-12 15:44:24 -05:00
James
2364476689 chore(release): v1.1.22 2022-11-12 14:49:20 -05:00
James
7136db4c71 fix: #1360, relationship field onMenuScrollToBottom not working in some browsers 2022-11-12 14:44:00 -05:00
James
562fccce05 docs: resolves #1273, inaccurate docs regarding local API overrideAccess 2022-11-12 14:22:23 -05:00
James
35f91b038b fix: 1309, duplicative logout in admin UI 2022-11-12 14:19:08 -05:00
James
eb0023e961 fix: #1358, allows listSearchableFields to work when indicated fields are nested 2022-11-12 13:44:30 -05:00
James
1d76e973bb fix: #1367, allows custom global components within schema validation 2022-11-12 13:08:10 -05:00
James
3f28a69959 fix: #1353, ensures errors returned from server make their way to UI 2022-11-12 12:55:30 -05:00
James
77792327f1 Merge branch 'master' of github.com:payloadcms/payload 2022-11-11 12:04:01 -07:00
James
86855d68f6 fix: #1357, nested arrays and blocks sometimes not allowing save 2022-11-11 12:03:39 -07:00
Nick Borko
cfef68f364 fix: fixed GraphQL Access query resolver to return the correct data (#1339) 2022-11-11 04:25:46 -08:00
Nut Pinyo
32b8f46bf2 docs: field hook example configuration (#1329) 2022-11-11 04:19:18 -08:00
James
cc5fa943ad Merge branch 'master' of github.com:payloadcms/payload 2022-11-11 04:12:48 -08:00
James
9da9d38aed docs: adds useEditDepth to docs 2022-11-11 04:12:43 -08:00
Feng Sun
d90ca777db chore: export useEditDepth (#1350) 2022-11-11 04:09:06 -08:00
James
e4b4931dba chore(release): v1.1.21 2022-11-05 12:10:30 -04:00
James
93acea9d7f chore: ensures when array / block rows are added, new row count is properly calculated 2022-11-05 12:05:34 -04:00
James
f883e04ee1 chore(release): v1.1.20 2022-11-05 11:45:07 -04:00
James
bb51a54ebe Merge branch 'master' of github.com:payloadcms/payload 2022-11-05 11:38:02 -04:00
James
483adf08c4 feat: optimizes blocks and arrays by removing some additional rerenders 2022-11-05 11:37:55 -04:00
Elliot DeNolf
4a78f7d3c3 chore: change discord readme badge to blurple 2022-11-04 10:31:42 -04:00
James
78c2306b73 Merge branch 'master' of github.com:payloadcms/payload 2022-11-01 17:51:03 -04:00
James
ddfb011904 docs: quick fix to strong tag 2022-11-01 17:50:55 -04:00
James Mikrut
d1c20e4fef Update CHANGELOG.md 2022-10-31 18:23:34 -04:00
James
a5139072c8 chore(release): v1.1.19 2022-10-31 18:23:10 -04:00
James
e004682799 Merge branch 'master' of github.com:payloadcms/payload 2022-10-31 17:51:00 -04:00
James
c651835061 fix: #1318, improves popup positioning and logic 2022-10-31 17:50:52 -04:00
Elliot DeNolf
2255ebb64a feat: revert enforce kebab-case slugs (#1322) (#1325) 2022-10-31 16:10:11 -04:00
James
e2ec2f7b97 fix: #1311, select existing upload modal always updates state 2022-10-31 15:40:18 -04:00
James
00196a8631 chore: ensures form is modified when rows are moved, fixes #1314 2022-10-31 13:25:19 -04:00
James
2a09f15a15 fix: #1307, #1321 - bug with disableFormData and blocks field 2022-10-31 13:21:16 -04:00
Elliot DeNolf
0420b6dc27 feat: enforce kebab-case slugs (#1322) 2022-10-31 11:11:00 -04:00
Dan Ribbens
10c30260dd docs: fix listSearchableFields anchor (#1297) 2022-10-31 09:44:49 -04:00
Elliot DeNolf
25000261bd fix: custom pino logger options (#1299) 2022-10-26 15:08:52 -04:00
Elliot DeNolf
bb82cdcef4 docs: better inline docs for InitOptions 2022-10-26 10:25:06 -04:00
Elliot DeNolf
027dff8363 chore(release): v1.1.18 2022-10-25 12:30:47 -04:00
James
31ca1ab379 chore: ensures defaultMaxTextLength is optional 2022-10-25 12:23:45 -04:00
Elliot DeNolf
33c1f287f3 chore(release): v1.1.17 2022-10-25 11:09:30 -04:00
Elliot DeNolf
cd4861afda chore: move release-it back to dev deps 2022-10-25 11:03:13 -04:00
James
9f56ac182f Merge branch 'master' of github.com:payloadcms/payload 2022-10-25 11:00:48 -04:00
James
3301f59822 fix: enforces depth: 0 in graphql resolvers 2022-10-25 11:00:38 -04:00
James
f9ca3a9f96 chore: fixes bad field name 2022-10-25 11:00:22 -04:00
Elliot DeNolf
3ba7594a65 chore: update release-it plugin 2022-10-25 10:31:37 -04:00
TomDo1234
6a1b25ab30 feat: adds default max length for text-based fields
* feat: Added to types.ts the default Max Field Length

* feat: Added the defaultMaxFieldLength to the schema.ts

* feat: applying defaultMaxFieldLength to 3 validators

* feat: renamed defaultMaxFieldLength to defaultMaxTextLength , adding defaultMax and min nums

* feat: validating numbers with new defaultminnum and defaultmaxnum

* feat: FIXED BUG, do not return an error message on the defaultmaxnum and minnum override checks

* Added test fields

* Eslint compliance

* feat : eslint compliacnce

* Added tests, though a reasonable payload config needs to be imported to them

* Removed my failed jest tests, relying on the yarn dev test instead

* Increased default num max and min range to JS safe integer

* Jmi suggestions

* feat: removing the superfluous number max and min default

* Added test for max text field

Co-authored-by: Tom Do <tom@iifuture.com>
Co-authored-by: TomDoFuture <108644869+TomDoFuture@users.noreply.github.com>
2022-10-24 18:57:45 -04:00
James
17dbbc7775 fix: group + group styles within collapsible 2022-10-24 18:56:56 -04:00
James
7e25abf87a chore: type fixes 2022-10-24 12:26:25 -04:00
James
0591dfd05b chore: typo 2022-10-24 12:18:03 -04:00
Will Laeri
17610adf36 chore: upgrade vulnerable dependencies (#1228)
* upgrade vulnerable deps

* removed specified node/yarn versions
2022-10-24 12:14:48 -04:00
Will Laeri
91814777b0 feat: specify node 14+ and yarn classic LTS (#1240) 2022-10-24 12:14:22 -04:00
Daniel Söderling
09d793926d feat: added beforeLogin hook (#1289) 2022-10-24 12:05:12 -04:00
James
a9f2f0ec03 fix: #1290, renders more than one rich text leaf where applicable 2022-10-24 12:03:06 -04:00
James
66bf8c3cbd fix: #1286, uses defaultDepth in graphql rich text depth 2022-10-24 11:31:09 -04:00
James
3967c1233f fix: #1291, add inline relationship drafts 2022-10-24 11:23:01 -04:00
James
c929725dd5 fix: ensures field updates when disableFormData changes 2022-10-24 08:56:08 -04:00
James
9c6098b191 chore(release): v1.1.16 2022-10-21 15:48:40 -04:00
James
6daab398da Merge branch 'master' of github.com:payloadcms/payload 2022-10-21 15:39:36 -04:00
James
36ef3789fb fix: obscure bug where upload collection has upload field relating to itself 2022-10-21 15:39:29 -04:00
Hung Vu
14cbf2f079 docs: correction to demo code of radio field (#1266) 2022-10-18 14:10:27 -04:00
Dan Ribbens
87bbf4416b Merge pull request #1272 from payloadcms/fix/#1271-index-sortable-fields-regression 2022-10-18 14:05:36 -04:00
Dan Ribbens
785b992c3e fix: indexSortableFields not respected 2022-10-17 20:17:55 -04:00
bigmistqke
d45de99956 feat: customizable header-labels
for Collapsibles and Arrays
2022-10-07 23:17:24 +02:00
1618 changed files with 166807 additions and 21429 deletions

View File

@@ -11,7 +11,7 @@ module.exports = {
'@typescript-eslint',
],
extends: [
'@trbl',
'./eslint-config',
],
settings: {
'import/resolver': {
@@ -57,6 +57,7 @@ module.exports = {
{
ignore: [
'payload-config',
'payload/generated-types',
],
},
],

42
.github/ISSUE_TEMPLATE/1.bug_report.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Bug Report
description: Create a bug report for Payload
labels: ["possible-bug"]
body:
- type: markdown
attributes:
value: |
*Note:* Feature requests should be opened as [discussions](https://github.com/payloadcms/payload/discussions/new?category=feature-requests-ideas).
- type: input
id: reproduction-link
attributes:
label: Link to reproduction
description: Please add a link to a reproduction. See the fork [reproduction-guide](https://github.com/payloadcms/payload/blob/master/.github/reproduction-guide.md) for more information.
validations:
required: true
- type: textarea
attributes:
label: To Reproduce
description: Steps to reproduce the behavior, please provide a clear description of how to reproduce the issue, based on the linked minimal reproduction. Screenshots can be provided in the issue body below. If using code blocks, make sure that [syntax highlighting is correct](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting) and double check that the rendered preview is not broken.
validations:
required: true
- type: textarea
attributes:
label: Describe the Bug
validations:
required: true
- type: input
id: version
attributes:
label: Payload Version
description: What version of Payload are you running?
validations:
required: true
- type: markdown
attributes:
value: Before submitting the issue, go through the steps you've written down to make sure the steps provided are detailed and clear.
- type: markdown
attributes:
value: Contributors should be able to follow the steps provided in order to reproduce the bug.
- type: markdown
attributes:
value: These steps are used to add integration tests to ensure the same issue does not happen again. Thanks in advance!

View File

@@ -1,34 +0,0 @@
---
name: Bug Report
about: Create a bug report for Payload
labels: 'possible-bug'
---
# Bug Report
<!--- Provide a general summary of the issue in the Title above -->
## Current Behavior
<!--- Tell us what happens instead of the expected behavior -->
## Expected Behavior
<!--- Tell us what you expected happen -->
## Possible Solution
<!--- Optional. If familiar with the codebase, suggest a fix/reason for the bug. -->
## Steps to Reproduce
<!--- Steps to reproduce this bug. Include any code, if relevant -->
1.
2.
3.
4.
## Detailed Description
<!--- Provide any other additional details -->
<!--- Payload version, browser, etc -->

View File

@@ -1,8 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Security Vulnerability
url: https://github.com/payloadcms/payload/blob/master/SECURITY.md
about: See instructions to privately disclose any security concerns
- name: Feature Request
url: https://github.com/payloadcms/payload/discussions
about: Suggest an idea to improve Payload in our GitHub Discussions

58
.github/reproduction-guide.md vendored Normal file
View File

@@ -0,0 +1,58 @@
# Reproduction Guide
1. [fork](https://github.com/payloadcms/payload/fork) this repo
2. run `yarn` to install dependencies
3. open up the `test/_community` directory
4. add any necessary `collections/globals/fields` in this directory to recreate the issue you are experiencing
5. run `yarn dev _community` to start the admin panel
**NOTE:** The goal is to isolate the problem by reducing the number of `collections/globals/fields` you add to the `test/_community` folder. This folder is _not_ meant for you to copy your project into, but rather recreate the issue you are experiencing with minimal config.
## Example test directory file tree
```text
.
├── config.ts
├── int.spec.ts
├── e2e.spec.ts
└── payload-types.ts
```
- `config.ts` - This is the _granular_ Payload config for testing. It should be as lightweight as possible. Reference existing configs for an example
- `int.spec.ts` [Optional] - This is the test file run by jest. Any test file must have a `*int.spec.ts` suffix.
- `e2e.spec.ts` [Optional] - This is the end-to-end test file that will load up the admin UI using the above config and run Playwright tests.
- `payload-types.ts` - Generated types from `config.ts`. Generate this file by running `yarn dev:generate-types _community`.
The directory split up in this way specifically to reduce friction when creating tests and to add the ability to boot up Payload with that specific config. You should modify the files in `test/_community` to get started.
<br />
## Testing is optional but encouraged
An issue does not need to have failing tests — reproduction steps with your forked repo are enough at this point. Some people like to dive deeper and we want to give you the guidance/tools to do so. Read more below:
### Running integration tests (Payload API tests)
First install [Jest Runner for VSVode](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner).
There are a couple ways run integration tests:
- **Granularly** - you can run individual tests in vscode by installing the Jest Runner plugin and using that to run individual tests. Clicking the `debug` button will run the test in debug mode allowing you to set break points.
<img src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/github/int-debug.png" />
- **Manually** - you can run all int tests in the `/test/_community/int.spec.ts` file by running the following command:
```bash
yarn test:int _community
```
### Running E2E tests (Admin Panel UI tests)
The easiest way to run E2E tests is to install
- [Playwright Test for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright)
- [Playwright Runner](https://marketplace.visualstudio.com/items?itemName=ortoni.ortoni)
Once they are installed you can open the `testing` tab in vscode sidebar and drill down to the test you want to run, i.e. `/test/_community/e2e.spec.ts`
<img src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/github/e2e-debug.png" />
#### Notes
- It is recommended to add the test credentials (located in `test/credentials.ts`) to your autofill for `localhost:3000/admin` as this will be required on every nodemon restart. The default credentials are `dev@payloadcms.com` as email and `test` as password.

View File

@@ -2,9 +2,9 @@ name: build
on:
pull_request:
types: [opened, reopened, edited, synchronize]
types: [opened, reopened, synchronize]
push:
branches: ['master']
branches: ["master"]
jobs:
build_yarn:
@@ -14,47 +14,51 @@ jobs:
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
scope: '@payloadcms'
always-auth: true
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: yarn build
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
scope: "@payloadcms"
always-auth: true
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: yarn build
- name: Component Tests
run: yarn test:components
- name: Integration Tests
run: yarn test:int
- name: Component Tests
run: yarn test:components
- name: Integration Tests
run: yarn test:int
- name: Generate Payload Types
run: yarn dev:generate-types fields
- name: Generate Payload Types
run: yarn dev:generate-types fields
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: E2E Tests
run: yarn test:e2e --bail
- name: Generate GraphQL schema file
run: yarn dev:generate-graphql-schema graphql-schema-gen
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: E2E Tests
run: yarn test:e2e --bail
- uses: actions/upload-artifact@v3
if: always()
with:
name: test-results
path: test-results/
retention-days: 30
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
install_npm:
runs-on: ubuntu-latest
strategy:
@@ -62,23 +66,23 @@ jobs:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
scope: '@payloadcms'
always-auth: true
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.cache-name }}-
${{ runner.os }}-npm-
${{ runner.os }}-
- run: npm install --legacy-peer-deps
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
scope: "@payloadcms"
always-auth: true
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.cache-name }}-
${{ runner.os }}-npm-
${{ runner.os }}-
- run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

3
.gitignore vendored
View File

@@ -2,6 +2,7 @@ coverage
package-lock.json
dist
.idea
test-results
# Created by https://www.gitignore.io/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
@@ -163,7 +164,7 @@ GitHub.sublime-settings
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
# MongoDB Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:

1
.node-version Normal file
View File

@@ -0,0 +1 @@
v16.14.2

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
v16.14.2

View File

@@ -1,4 +1,5 @@
{
"verbose": true,
"git": {
"commitMessage": "chore(release): v${version}",
"requireCleanWorkingDir": true

View File

@@ -1,5 +1,5 @@
{
"preReleaseId": "beta",
"verbose": true,
"git": {
"requireCleanWorkingDir": false,
"commit": false,
@@ -7,11 +7,11 @@
"tag": false
},
"github": {
"release": false
"release": true
},
"npm": {
"skipChecks": true,
"tag": "beta"
"tag": "canary"
},
"hooks": {
"before:init": ["yarn", "yarn clean", "yarn test"]

40
.vscode/launch.json vendored
View File

@@ -5,42 +5,18 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug Jest Tests",
"type": "node",
"command": "yarn run dev _community",
"name": "Run Dev Community",
"request": "launch",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
"--runInBand"
],
"env": {
"PAYLOAD_CONFIG_PATH": "demo/payload.config.ts"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/babel-node",
"port": 9229,
"skipFiles": [
"<node_internals>/**"
]
"type": "node-terminal",
"cwd": "${workspaceFolder}"
},
{
"type": "node",
"command": "yarn run dev fields",
"name": "Run Dev Fields",
"request": "launch",
"name": "Launch Program",
"env": {
"BABEL_ENV": "development"
},
"program": "${workspaceFolder}/test/dev.js",
"skipFiles": [
"<node_internals>/**"
],
"runtimeArgs": [
"--nolazy"
],
"args": [
"fields"
]
"type": "node-terminal",
"cwd": "${workspaceFolder}"
},
]
}

File diff suppressed because it is too large Load Diff

64
ISSUE_GUIDE.md Normal file
View File

@@ -0,0 +1,64 @@
# Reporting an issue
To report an issue, please follow the steps below:
1. Fork this repository
2. Add necessary collections/globals/fields to the `test/_community` directory to recreate the issue you are experiencing
3. Create an issue and add a link to your forked repo
**The goal is to isolate the problem by reducing the number of fields/collections you add to the test/_community folder. This folder is not meant for you to copy your project into, but to recreate the issue you are experiencing with minimal config.**
## Test directory file tree explanation
```text
.
├── config.ts
├── int.spec.ts
├── e2e.spec.ts
└── payload-types.ts
```
- `config.ts` - This is the _granular_ Payload config for testing. It should be as lightweight as possible. Reference existing configs for an example
- `int.spec.ts` [Optional] - This is the test file run by jest. Any test file must have a `*int.spec.ts` suffix.
- `e2e.spec.ts` [Optional] - This is the end-to-end test file that will load up the admin UI using the above config and run Playwright tests.
- `payload-types.ts` - Generated types from `config.ts`. Generate this file by running `yarn dev:generate-types _community`.
The directory split up in this way specifically to reduce friction when creating tests and to add the ability to boot up Payload with that specific config. You should modify the files in `test/_community` to get started.
## How to start test collection admin UI
To start the admin panel so you can manually recreate your issue, you can run the following command:
```bash
# This command will start up Payload using your config
# NOTE: it will wipe the test database on restart
yarn dev _community
```
## Testing is optional but encouraged
An issue does not need to have failing tests — reproduction steps with your forked repo are enough at this point. Some people like to dive deeper and we want to give you the guidance/tools to do so. Read more below.
### How to run integration tests (Payload API tests)
There are a couple ways to do this:
- **Granularly** - you can run individual tests in vscode by installing the Jest Runner plugin and using that to run individual tests. Clicking the `debug` button will run the test in debug mode allowing you to set break points.
<img src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/github/int-debug.png" />
- **Manually** - you can run all int tests in the `/test/_community/int.spec.ts` file by running the following command:
```bash
yarn test:int _community
```
### How to run E2E tests (Admin Panel UI tests)
The easiest way to run E2E tests is to install
- [Playwright Test for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright)
- [Playwright Runner](https://marketplace.visualstudio.com/items?itemName=ortoni.ortoni)
Once they are installed you can open the `testing` tab in vscode sidebar and drill down to the test you want to run, i.e. `/test/_community/e2e.spec.ts`
<img src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/github/e2e-debug.png" />
#### Notes
- It is recommended to add the test credentials (located in `test/credentials.ts`) to your autofill for `localhost:3000/admin` as this will be required on every nodemon restart. The default credentials are `dev@payloadcms.com` as email and `test` as password.

132
README.md
View File

@@ -1,30 +1,70 @@
<h1 align="center">Payload</h1>
<p align="center">A free and open-source TypeScript headless CMS & application framework built with Express, MongoDB and React.</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-blue.svg" />
</a>
<a href="https://github.com/payloadcms/payload/actions">
<img src="https://github.com/payloadcms/payload/workflows/build/badge.svg" />
</a>
<a href="https://www.npmjs.com/package/payload">
<img alt="npm" src="https://img.shields.io/npm/v/payload" />
</a>
<a href="https://twitter.com/intent/tweet?text=Payload%20-%20A%20self-hosted%2C%20headless%20JavaScript%20CMS%20%26%20application%20framework&url=https%3A%2F%2Fgithub.com%2Fpayloadcms%2Fpayload">
<img alt="Tweet Payload" src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" />
</a>
<a href="https://discord.com/invite/r6sCXqVk3v">
<img alt="Discord" src="https://img.shields.io/discord/967097582721572934?label=Discord" />
<p style="border: none; margin-bottom:0; padding-bottom: 0;" align="center">
<a href="https://payloadcms.com">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/payload-logo-light.svg">
<img width="350" alt="Payload Logo" src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/payload-logo-dark.svg">
</picture>
</a>
</p>
<h3 align="center">The most powerful TypeScript CMS</h3>
<p align="center">Code-first Headless CMS that bridges the gap between CMS and application framework</p>
<h3 align="center">
<a target="_blank" href="https://payloadcms.com/docs/getting-started/what-is-payload" rel="dofollow"><strong>Explore the docs</strong></a>
·
<a target="_blank" href="https://demo.payloadcms.com/" rel="dofollow"><strong>Try Live Demo</strong></a>
<br />
</h3>
<br />
<p align="center">
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" />
</a>
&nbsp;
<a href="https://github.com/payloadcms/payload/actions">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/payloadcms/payload/tests.yml?style=flat-square">
</a>
&nbsp;
<a href="https://github.com/payloadcms/payload/commits">
<img src="https://img.shields.io/github/commit-activity/m/payloadcms/payload?style=flat-square" alt="git commit activity"/>
</a>
&nbsp;
<a href="https://discord.gg/payload">
<img alt="Discord" src="https://img.shields.io/discord/967097582721572934?label=Discord&color=7289da&style=flat-square" />
</a>
&nbsp;
<a href="https://www.npmjs.com/package/payload">
<img alt="npm" src="https://img.shields.io/npm/v/payload?style=flat-square" />
</a>
&nbsp;
<a href="https://twitter.com/payloadcms">
<img src="https://img.shields.io/badge/follow-payloadcms-1DA1F2?logo=twitter&style=flat-square" alt="Payload Twitter" />
</a>
</p>
<br />
<a href="https://payloadcms.com">
<img src="https://payloadcms.com/images/og-image.jpg" alt="Payload headless CMS Admin panel built with React" />
<img src="https://cms.payloadcms.com/media/payload-github-header.jpg" alt="Payload headless CMS Admin panel built with React" />
</a>
### Features
<br />
## ⭐ Why Payload?
Payload is a CMS that has been designed for developers from the ground up to deliver them what they need to build great digital products. If you know JavaScript, you know Payload. It's a _code-first_ CMS, which allows us to do a lot of things right:
- Payload gives you everything you need, but then steps back and lets you build what you want in JavaScript or TypeScript - with no unnecessary complexity brought by GUIs. You'll understand how your CMS works because you will have written it exactly how you want it.
- Bring your own Express server and do whatever you need on top of Payload. Payload doesn't impose anything on you or your app.
- Completely control the Admin panel by using your own React components. Swap out fields or even entire views with ease.
- Use your data however and wherever you need thanks to auto-generated, yet fully extensible REST, GraphQL, and Local Node APIs.
<a target="_blank" href="https://payloadcms.com/" rel="dofollow"><strong>Read more on our website</strong></a>
## ✨ Features
- Completely free and open-source
- [GraphQL](https://payloadcms.com/docs/graphql/overview), [REST](https://payloadcms.com/docs/rest-api/overview), and [Local](https://payloadcms.com/docs/local-api/overview) APIs
@@ -44,40 +84,56 @@
- Intensely fast API
- Highly secure thanks to HTTP-only cookies, CSRF protection, and more
### Code-first
<a target="_blank" href="https://github.com/payloadcms/payload/discussions"><strong>Request Feature</strong></a>
Payload is a CMS that has been designed for developers from the ground up to deliver them what they need to build great digital products. If you know JavaScript, you know Payload. It's a _code-first_ CMS, which allows us to do a lot of things right:
- Payload gives you everything you need, but then steps back and lets you build what you want in JavaScript or TypeScript - with no unnecessary complexity brought by GUIs. You'll understand how your CMS works because you will have written it exactly how you want it.
- Bring your own Express server and do whatever you need on top of Payload. Payload doesn't impose anything on you or your app.
- Completely control the Admin panel by using your own React components. Swap out fields or even entire views with ease.
- Use your data however and wherever you need thanks to auto-generated, yet fully extensible REST, GraphQL, and Local Node APIs.
### Quick Start
## 🚀 Quick Start
Before beginning to work with Payload, make sure you have all of the [required software](https://payloadcms.com/docs/getting-started/installation).
From there, the easiest way to get started with Payload is to use the `create-payload-app` package:
```
```text
npx create-payload-app
```
Alternatively, it only takes about five minutes to [create an app from scratch](https://payloadcms.com/docs/getting-started/installation#from-scratch).
### Documentation
## 🗒️ Documentation
Check out the [Payload website](https://payloadcms.com/docs/getting-started/what-is-payload) to find in-depth documentation for everything that Payload offers.
### Contributing
## 🙋 Contributing
If you want to add contributions to this repository, please follow the instructions in [contributing.md](./contributing.md).
### Other Resources
## 📚 Examples and Templates
##### Discussions
The examples directory is a great resource for learning how to setup Payload in a variety of different ways. There are also a number of templates to help get you going very quickly. If you maintain your own template, consider adding the `payload-template` topic to your GitHub repository for others to find.
There are lots of good conversations and resources in our [GitHub Discussions board](https://github.com/payloadcms/payload/discussions). If you're struggling with something, chances are, someone's already solved what you're up against. Searching Discussions will often provide very helpful tips and tricks.
- [Examples Directory](./examples)
- [Official Templates](https://github.com/orgs/payloadcms/repositories?q=topic%3Apayload-template)
- [Community Templates](https://github.com/topics/payload-template)
##### Discord
## 🔌 Plugins
Join [Payload's Discord channel](https://discord.com/invite/r6sCXqVk3v) to interact with Payload developers in realtime.
Payload is highly extensible and allows you to install or distribute plugins that add or remove functionality. There are both officially-supported and community-supported plugins available. If you maintain your own plugin, consider adding the `payload-plugin` topic to your GitHub repository for others to find.
- [Official Plugins](https://github.com/orgs/payloadcms/repositories?q=topic%3Apayload-plugin)
- [Community Plugins](https://github.com/topics/payload-plugin)
## 🚨 Need help?
There are lots of good conversations and resources in our Github Discussions board and our Discord Server. If you're struggling with something, chances are, someone's already solved what you're up against. :point_down:
- [GitHub Discussions](https://github.com/payloadcms/payload/discussions)
- [GitHub Issues](https://github.com/payloadcms/payload/issues)
- [Discord](https://t.co/30APlsQUPB)
- [Community Help](https://payloadcms.com/community-help)
## ⭐ Like what we're doing? Give us a star
![payload-github-star](https://cms.payloadcms.com/media/payload-github-star.gif)
## 👏 Thanks to all our contributors
<img align="left" src="https://contributors-img.web.app/image?repo=payloadcms/payload"/>

View File

@@ -1,3 +0,0 @@
const config = require('./src/babel.config');
module.exports = config;

View File

@@ -1,3 +0,0 @@
const babelConfig = require('./dist/babel.config');
exports.config = babelConfig;

5
components/elements.js Normal file
View File

@@ -0,0 +1,5 @@
exports.Button = require('../dist/admin/components/elements/Button').default;
exports.Card = require('../dist/admin/components/elements/Card').default;
exports.Eyebrow = require('../dist/admin/components/elements/Eyebrow').default;
exports.Nav = require('../dist/admin/components/elements/Nav').default;
exports.Gutter = require('../dist/admin/components/elements/Gutter').Gutter;

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props, RenderArrayProps } from '../../dist/admin/components/forms/field-types/Array/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Array/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props, RenderBlockProps } from '../../dist/admin/components/forms/field-types/Blocks/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Blocks/types';

View File

@@ -1 +1 @@
export { Props } from '../../dist/admin/components/views/collections/List/Cell/types';
export type { Props } from '../../dist/admin/components/views/collections/List/Cell/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Checkbox/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Checkbox/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Code/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Code/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/DateTime/types';
export type { Props } from '../../dist/admin/components/forms/field-types/DateTime/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Email/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Email/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Group/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Group/types';

View File

@@ -0,0 +1 @@
export type { Props } from '../../dist/admin/components/forms/field-types/JSON/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Number/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Number/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Password/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Password/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/RadioInput/types';
export type { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/RadioInput/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/types';
export type { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props, Option, ValueWithRelation } from '../../dist/admin/components/forms/field-types/Relationship/types';
export type { Props, Option, ValueWithRelation } from '../../dist/admin/components/forms/field-types/Relationship/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/RichText/types';
export type { Props } from '../../dist/admin/components/forms/field-types/RichText/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Row/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Row/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props, Option } from '../../dist/admin/components/forms/field-types/Select/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Select/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Text/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Text/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Textarea/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Textarea/types';

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/forms/field-types/Upload/types';
export type { Props } from '../../dist/admin/components/forms/field-types/Upload/types';

42
components/forms.js Normal file
View File

@@ -0,0 +1,42 @@
exports.useForm = require('../dist/admin/components/forms/Form/context').useForm;
/**
* @deprecated useWatchForm is no longer preferred. If you need all form fields, prefer `useAllFormFields`.
*/
exports.useWatchForm = require('../dist/admin/components/forms/Form/context').useWatchForm;
exports.useFormFields = require('../dist/admin/components/forms/Form/context').useFormFields;
exports.useAllFormFields = require('../dist/admin/components/forms/Form/context').useAllFormFields;
exports.useFormSubmitted = require('../dist/admin/components/forms/Form/context').useFormSubmitted;
exports.useFormProcessing = require('../dist/admin/components/forms/Form/context').useFormProcessing;
exports.useFormModified = require('../dist/admin/components/forms/Form/context').useFormModified;
exports.useField = require('../dist/admin/components/forms/useField').default;
/**
* @deprecated This method is now called useField. The useFieldType alias will be removed in an upcoming version.
*/
exports.useFieldType = require('../dist/admin/components/forms/useField').default;
exports.Form = require('../dist/admin/components/forms/Form').default;
exports.Text = require('../dist/admin/components/forms/field-types/Text').default;
exports.TextInput = require('../dist/admin/components/forms/field-types/Text/Input').default;
exports.Group = require('../dist/admin/components/forms/field-types/Group').default;
exports.Select = require('../dist/admin/components/forms/field-types/Select').default;
exports.SelectInput = require('../dist/admin/components/forms/field-types/Select/Input').default;
exports.Checkbox = require('../dist/admin/components/forms/field-types/Checkbox').default;
exports.Submit = require('../dist/admin/components/forms/Submit').default;
exports.Label = require('../dist/admin/components/forms/Label').default;
exports.reduceFieldsToValues = require('../dist/admin/components/forms/Form/reduceFieldsToValues').default;
exports.getSiblingData = require('../dist/admin/components/forms/Form/getSiblingData').default;
exports.withCondition = require('../dist/admin/components/forms/withCondition').default;

1
components/hooks.js Normal file
View File

@@ -0,0 +1 @@
exports.useStepNav = require('../dist/admin/components/elements/StepNav').useStepNav;

2
components/icons.js Normal file
View File

@@ -0,0 +1,2 @@
exports.Chevron = require('../dist/admin/components/icons/Chevron').default;
exports.X = require('../dist/admin/components/icons/X').default;

View File

@@ -1,2 +1,2 @@
export { default as Chevron } from '../src/admin/components/icons/Chevron';
export { default as X } from '../src/admin/components/icons/X';
export { default as Chevron } from '../dist/admin/components/icons/Chevron';
export { default as X } from '../dist/admin/components/icons/X';

View File

@@ -0,0 +1 @@
exports.usePreferences = require('../dist/admin/components/utilities/Preferences').usePreferences;

3
components/rich-text.js Normal file
View File

@@ -0,0 +1,3 @@
exports.LeafButton = require('../dist/admin/components/forms/field-types/RichText/leaves/Button').default;
exports.ElementButton = require('../dist/admin/components/forms/field-types/RichText/elements/Button').default;
exports.toggleElement = require('../dist/admin/components/forms/field-types/RichText/elements/toggle').default;

2
components/templates.js Normal file
View File

@@ -0,0 +1,2 @@
exports.DefaultTemplate = require('../dist/admin/components/templates/Default').default;
exports.MinimalTemplate = require('../dist/admin/components/templates/Minimal').default;

7
components/utilities.js Normal file
View File

@@ -0,0 +1,7 @@
exports.Meta = require('../dist/admin/components/utilities/Meta').default;
exports.useLocale = require('../dist/admin/components/utilities/Locale').useLocale;
exports.useDocumentInfo = require('../dist/admin/components/utilities/DocumentInfo').useDocumentInfo;
exports.useConfig = require('../dist/admin/components/utilities/Config').useConfig;
exports.useAuth = require('../dist/admin/components/utilities/Auth').useAuth;
exports.useEditDepth = require('../dist/admin/components/utilities/EditDepth').useEditDepth;
exports.useTheme = require('../dist/admin/components/utilities/Theme').useTheme;

View File

@@ -3,3 +3,4 @@ export { useLocale } from '../dist/admin/components/utilities/Locale';
export { useDocumentInfo } from '../dist/admin/components/utilities/DocumentInfo';
export { useConfig } from '../dist/admin/components/utilities/Config';
export { useAuth } from '../dist/admin/components/utilities/Auth';
export { useEditDepth } from '../dist/admin/components/utilities/EditDepth';

1
components/views/Cell.js Normal file
View File

@@ -0,0 +1 @@
exports.Cell = require('../../dist/admin/components/views/collections/List/Cell').default;

View File

@@ -1,3 +1,2 @@
export { default as Cell } from '../../dist/admin/components/views/collections/List/Cell';
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/views/collections/List/Cell/types';
export type { Props } from '../../dist/admin/components/views/collections/List/Cell/types';

View File

@@ -0,0 +1 @@
exports.Dashboard = required('../../dist/admin/components/views/Dashboard/Default').default;

1
components/views/Edit.js Normal file
View File

@@ -0,0 +1 @@
exports.Edit = require('../../dist/admin/components/views/collections/Edit/Default').default;

View File

@@ -1,3 +1,2 @@
export { default as Edit } from '../../dist/admin/components/views/collections/Edit/Default';
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/views/collections/Edit/types';
export type { Props } from '../../dist/admin/components/views/collections/Edit/types';

1
components/views/List.js Normal file
View File

@@ -0,0 +1 @@
exports.List = require('../../dist/admin/components/views/collections/List/Default').default;

View File

@@ -1,3 +1,2 @@
export { default as List } from '../../dist/admin/components/views/collections/List/Default';
// eslint-disable-next-line import/named
export { Props } from '../../dist/admin/components/views/collections/Edit/types';
export type { Props } from '../../dist/admin/components/views/collections/List/types';

View File

@@ -1,6 +1,6 @@
# Contributing to Payload CMS
# Contributing to Payload
Below you'll find a set of guidelines for how to contribute to Payload CMS.
Below you'll find a set of guidelines for how to contribute to Payload.
## Opening issues
@@ -22,7 +22,7 @@ If you're an incredibly awesome person and want to help us make Payload even bet
### Before Starting
To help us work on new features, you can create a new feature request post in [GitHub Discussion](https://github.com/payloadcms/payload/discussions) or discuss it in our [Discord](https://discord.com/invite/r6sCXqVk3v). New functionality often has large implications across the entire Payload repo, so it is best to discuss the architecture and approach before starting work on a pull request.
To help us work on new features, you can create a new feature request post in [GitHub Discussion](https://github.com/payloadcms/payload/discussions) or discuss it in our [Discord](https://discord.com/invite/payload). New functionality often has large implications across the entire Payload repo, so it is best to discuss the architecture and approach before starting work on a pull request.
### Code
@@ -49,9 +49,13 @@ The directory split up in this way specifically to reduce friction when creating
The following command will start Payload with your config: `yarn dev my-test-dir`. This command will start up Payload using your config and refresh a test database on every restart.
When switching between test directories, you will want to remove your `node_modules/.cache ` manually or by running `yarn clean:cache`.
If you wish to use to your own Mongo database for the `test` directory instead of using the in memory database, all you need to do is add the following env vars to the `test/dev.ts` file:
NOTE: It is recommended to add the test credentials (located in `test/credentials.ts`) to your autofill for `localhost:3000/admin` as this will be required on every nodemon restart.
- `process.env.NODE_ENV`
- `process.env.PAYLOAD_TEST_MONGO_URL`
- Simply set `process.env.NODE_ENV` to `test` and set `process.env.PAYLOAD_TEST_MONGO_URL` to your mongo url e.g. `mongodb://127.0.0.1/your-test-db`.
NOTE: It is recommended to add the test credentials (located in `test/credentials.ts`) to your autofill for `localhost:3000/admin` as this will be required on every nodemon restart. The default credentials are `dev@payloadcms.com` as E-Mail and `test` as password.
## Pull Requests

View File

@@ -30,7 +30,7 @@ If a Collection supports [`Authentication`](/docs/authentication/overview), the
```ts
import { CollectionConfig } from 'payload/types';
const Posts: CollectionConfig = {
export const Posts: CollectionConfig = {
slug: "posts",
// highlight-start
access: {
@@ -42,8 +42,6 @@ const Posts: CollectionConfig = {
},
// highlight-end
};
export default Categories;
```
### Create

View File

@@ -20,7 +20,7 @@ Field Access Control is specified with functions inside a field's config. All fi
```ts
import { CollectionConfig } from 'payload/types';
const Posts: CollectionConfig = {
export const Posts: CollectionConfig = {
slug: 'posts',
fields: [
{
@@ -67,6 +67,8 @@ Returns a boolean which allows or denies the ability to read a field's value. If
Returns a boolean which allows or denies the ability to update a field's value. If `false` is returned, any passed values will be discarded.
If `false` is returned and you attempt to update the field's value, the operation will **not** throw an error however the field will be omitted from the update operation and the value will remain unchanged.
**Available argument properties:**
| Option | Description |

View File

@@ -38,7 +38,7 @@ const defaultPayloadAccess = ({ req: { user } }) => {
<Banner type="success">
<strong>Note:</strong><br/>
In the Local API, all Access Control functions are skipped by default, allowing your server to do whatever it needs. But, you can opt back in by setting the option <strong>overrideAccess</strong> to <strong>true</strong>.
In the Local API, all Access Control functions are skipped by default, allowing your server to do whatever it needs. But, you can opt back in by setting the option <strong>overrideAccess</strong> to <strong>false</strong>.
</Banner>
### Access Control Types

View File

@@ -11,35 +11,39 @@ While designing the Payload Admin panel, we determined it should be as minimal a
To swap in your own React component, first, consult the list of available component overrides below. Determine the scope that corresponds to what you are trying to accomplish, and then author your React component accordingly.
<Banner type="success">
<strong>Tip:</strong><br/>
Custom components will automatically be provided with all props that the default component would accept.
<strong>Tip:</strong>
<br />
Custom components will automatically be provided with all props that the
default component would accept.
</Banner>
### Base Component Overrides
You can override a set of admin panel-wide components by providing a component to your base Payload config's `admin.components` property. The following options are available:
| Path | Description |
| --------------------- | -------------|
| **`Nav`** | Contains the sidebar and mobile Nav in its entirety. |
| **`BeforeDashboard`** | Array of components to inject into the built-in Dashboard, _before_ the default dashboard contents. |
| **`AfterDashboard`** | Array of components to inject into the built-in Dashboard, _after_ the default dashboard contents. [Demo](https://github.com/payloadcms/payload/tree/master/test/admin/components/AfterDashboard/index.tsx)|
| **`BeforeLogin`** | Array of components to inject into the built-in Login, _before_ the default login form. |
| **`AfterLogin`** | Array of components to inject into the built-in Login, _after_ the default login form. |
| **`BeforeNavLinks`** | Array of components to inject into the built-in Nav, _before_ the links themselves. |
| **`AfterNavLinks`** | Array of components to inject into the built-in Nav, _after_ the links. |
| **`views.Account`** | The Account view is used to show the currently logged in user's Account page. |
| **`views.Dashboard`** | The main landing page of the Admin panel. |
| **`graphics.Icon`** | Used as a graphic within the `Nav` component. Often represents a condensed version of a full logo. |
| **`graphics.Logo`** | The full logo to be used in contexts like the `Login` view. |
| **`routes`** | Define your own routes to add to the Payload Admin UI. [More](#custom-routes) |
| **`providers`** | Define your own provider components that will wrap the Payload Admin UI. [More](#custom-providers) |
| Path | Description |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`Nav`** | Contains the sidebar and mobile Nav in its entirety. |
| **`logout.Button`** | A custom React component. |
| **`BeforeDashboard`** | Array of components to inject into the built-in Dashboard, _before_ the default dashboard contents. |
| **`AfterDashboard`** | Array of components to inject into the built-in Dashboard, _after_ the default dashboard contents. [Demo](https://github.com/payloadcms/payload/tree/master/test/admin/components/AfterDashboard/index.tsx) |
| **`BeforeLogin`** | Array of components to inject into the built-in Login, _before_ the default login form. |
| **`AfterLogin`** | Array of components to inject into the built-in Login, _after_ the default login form. |
| **`BeforeNavLinks`** | Array of components to inject into the built-in Nav, _before_ the links themselves. |
| **`AfterNavLinks`** | Array of components to inject into the built-in Nav, _after_ the links. |
| **`views.Account`** | The Account view is used to show the currently logged in user's Account page. |
| **`views.Dashboard`** | The main landing page of the Admin panel. |
| **`graphics.Icon`** | Used as a graphic within the `Nav` component. Often represents a condensed version of a full logo. |
| **`graphics.Logo`** | The full logo to be used in contexts like the `Login` view. |
| **`routes`** | Define your own routes to add to the Payload Admin UI. [More](#custom-routes) |
| **`providers`** | Define your own provider components that will wrap the Payload Admin UI. [More](#custom-providers) |
#### Full example:
`payload.config.js`
```ts
import { buildConfig } from 'payload/config'
import { buildConfig } from "payload/config";
import {
MyCustomNav,
MyCustomLogo,
@@ -47,7 +51,7 @@ import {
MyCustomAccount,
MyCustomDashboard,
MyProvider,
} from './customComponents';
} from "./customComponents";
export default buildConfig({
admin: {
@@ -67,75 +71,166 @@ export default buildConfig({
});
```
*For more examples regarding how to customize components, look at the following [examples](https://github.com/payloadcms/payload/tree/master/test/admin/components).*
_For more examples regarding how to customize components, look at the following [examples](https://github.com/payloadcms/payload/tree/master/test/admin/components)._
### Collections
You can override components on a Collection-by-Collection basis via each Collection's `admin` property.
| Path | Description |
| ---------------- | -------------|
| **`views.Edit`** | Used while a document within this Collection is being edited. |
| **`views.List`** | The `List` view is used to render a paginated, filterable table of Documents in this Collection. |
| Path | Description |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **`views.Edit`** | Used while a document within this Collection is being edited. |
| **`views.List`** | The `List` view is used to render a paginated, filterable table of Documents in this Collection. |
| **`edit.SaveButton`** | Replace the default `Save` button with a custom component. Drafts must be disabled |
| **`edit.SaveDraftButton`** | Replace the default `Save Draft` button with a custom component. Drafts must be enabled and autosave must be disabled. |
| **`edit.PublishButton`** | Replace the default `Publish` button with a custom component. Drafts must be enabled. |
| **`edit.PreviewButton`** | Replace the default `Preview` button with a custom component. |
| **`BeforeList`** | Array of components to inject _before_ the built-in List view
|
| **`BeforeListTable`** | Array of components to inject _before_ the built-in List view's table
|
| **`AfterListTable`** | Array of components to inject _after_ the built-in List view's table
|
| **`AfterList`** | Array of components to inject _after_ the built-in List view
|
#### Examples
```tsx
// Custom Buttons
import * as React from "react";
import {
CustomSaveButtonProps,
CustomSaveDraftButtonProps,
CustomPublishButtonProps,
CustomPreviewButtonProps,
} from "payload/types";
export const CustomSaveButton: CustomSaveButtonProps = ({
DefaultButton,
label,
}) => {
return <DefaultButton label={label} />;
};
export const CustomSaveDraftButton: CustomSaveDraftButtonProps = ({
DefaultButton,
disabled,
label,
saveDraft,
}) => {
return (
<DefaultButton label={label} disabled={disabled} saveDraft={saveDraft} />
);
};
export const CustomPublishButton: CustomPublishButtonProps = ({
DefaultButton,
disabled,
label,
publish,
}) => {
return <DefaultButton label={label} disabled={disabled} publish={publish} />;
};
export const CustomPreviewButton: CustomPreviewButtonProps = ({
DefaultButton,
disabled,
label,
preview,
}) => {
return <DefaultButton label={label} disabled={disabled} preview={preview} />;
};
```
##### Custom Collection List View Example
Collection.ts
```tsx
import { MyListComponent } from './MyListComponent';
export const MyCollection: CollectionConfig = {
slug: 'mycollection',
admin: {
components: {
views: {
List: MyListComponent,
},
},
},
fields: [
...
],
};
```
MyListComponent.tsx
```tsx
import React from 'react';
import {List, type Props} from 'payload/components/views/List' // Payload's default List view component and its props
export const MyListComponent: React.FC<Props> = (props) => (
<div>
<p>Some text before the default list view component. If you just want to do that, you can also use the admin.components.list.BeforeList hook</p>
<List {...props} />
</div>
);
```
### Globals
As with Collections, You can override components on a global-by-global basis via their `admin` property.
| Path | Description |
| ---------------- | -------------|
| **`views.Edit`** | Used while this Global is being edited. |
| Path | Description |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **`views.Edit`** | Used while this Global is being edited. |
| **`edit.SaveButton`** | Replace the default `Save` button with a custom component. Drafts must be disabled |
| **`edit.SaveDraftButton`** | Replace the default `Save Draft` button with a custom component. Drafts must be enabled and autosave must be disabled. |
| **`edit.PublishButton`** | Replace the default `Publish` button with a custom component. Drafts must be enabled. |
| **`edit.PreviewButton`** | Replace the default `Preview` button with a custom component. |
### Fields
All Payload fields support the ability to swap in your own React components. So, for example, instead of rendering a default Text input, you might need to render a color picker that provides the editor with a custom color picker interface to restrict the data entered to colors only.
<Banner type="success">
<strong>Tip:</strong><br/>
Don't see a built-in field type that you need? Build it! Using a combination of custom validation and custom components, you can override the entirety of how a component functions within the admin panel and effectively create your own field type.
<strong>Tip:</strong>
<br />
Don't see a built-in field type that you need? Build it! Using a combination
of custom validation and custom components, you can override the entirety of
how a component functions within the admin panel and effectively create your
own field type.
</Banner>
**Fields support the following custom components:**
| Component | Description |
| --------------- |------------------------------------------------------------------------------------------------------------------------------|
| **`Filter`** | Override the text input that is presented in the `List` view when a user is filtering documents by the customized field. |
| **`Cell`** | Used in the `List` view's table to represent a table-based preview of the data stored in the field. [More](#cell-component) |
| **`Field`** | Swap out the field itself within all `Edit` views. [More](#field-component) |
| Component | Description |
| ------------ | --------------------------------------------------------------------------------------------------------------------------- |
| **`Filter`** | Override the text input that is presented in the `List` view when a user is filtering documents by the customized field. |
| **`Cell`** | Used in the `List` view's table to represent a table-based preview of the data stored in the field. [More](#cell-component) |
| **`Field`** | Swap out the field itself within all `Edit` views. [More](#field-component) |
## Cell Component
These are the props that will be passed to your custom Cell to use in your own components.
| Property | Description |
|--------------|-------------------------------------------------------------------|
| **`field`** | An object that includes the field configuration. |
| **`colIndex`** | A unique number for the column in the list. |
| Property | Description |
| ---------------- | ----------------------------------------------------------------- |
| **`field`** | An object that includes the field configuration. |
| **`colIndex`** | A unique number for the column in the list. |
| **`collection`** | An object with the config of the collection that the field is in. |
| **`cellData`** | The data for the field that the cell represents. |
| **`rowData`** | An object with all the field values for the row. |
| **`rowData`** | An object with all the field values for the row. |
#### Example
```tsx
import React from 'react';
import './index.scss';
const baseClass = 'custom-cell';
import React from "react";
import "./index.scss";
const baseClass = "custom-cell";
const CustomCell: React.FC<Props> = (props) => {
const {
field,
colIndex,
collection,
cellData,
rowData,
} = props;
const { field, colIndex, collection, cellData, rowData } = props;
return (
<span className={baseClass}>
{ cellData }
</span>
);
return <span className={baseClass}>{cellData}</span>;
};
```
@@ -148,21 +243,28 @@ When writing your own custom components you can make use of a number of hooks to
When swapping out the `Field` component, you'll be responsible for sending and receiving the field's `value` from the form itself. To do so, import the `useField` hook as follows:
```tsx
import { useField } from 'payload/components/forms'
import { useField } from "payload/components/forms";
type Props = { path: string }
type Props = { path: string };
const CustomTextField: React.FC<Props> = ({ path }) => {
// highlight-start
const { value, setValue } = useField<Props>({ path })
const { value, setValue } = useField<Props>({ path });
// highlight-end
return <input onChange={e => setValue(e.target.value)} value={value.path} />
}
return (
<input onChange={(e) => setValue(e.target.value)} value={value.path} />
);
};
```
<Banner type="success">
For more information regarding the hooks that are available to you while you build custom components, including the <strong>useField</strong> hook, <a href="/docs/admin/hooks" style={{color: 'black'}}>click here</a>.
For more information regarding the hooks that are available to you while you
build custom components, including the <strong>useField</strong> hook,{" "}
<a href="/docs/admin/hooks" style={{ color: "black" }}>
click here
</a>
.
</Banner>
## Custom routes
@@ -171,28 +273,31 @@ You can easily add your own custom routes to the Payload Admin panel using the `
**Custom routes support the following properties:**
| Property | Description |
| ----------------- | -------------|
| **`Component`** * | Pass in the component that should be rendered when a user navigates to this route. |
| **`path`** * | React Router `path`. [See the React Router docs](https://v5.reactrouter.com/web/api/Route/path-string-string) for more info. |
| **`exact`** | React Router `exact` property. [More](https://v5.reactrouter.com/web/api/Route/exact-bool) |
| **`strict`** | React Router `strict` property. [More](https://v5.reactrouter.com/web/api/Route/strict-bool) |
| **`sensitive`** | React Router `sensitive` property. [More](https://v5.reactrouter.com/web/api/Route/sensitive-bool) |
| Property | Description |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| **`Component`** \* | Pass in the component that should be rendered when a user navigates to this route. |
| **`path`** \* | React Router `path`. [See the React Router docs](https://v5.reactrouter.com/web/api/Route/path-string-string) for more info. |
| **`exact`** | React Router `exact` property. [More](https://v5.reactrouter.com/web/api/Route/exact-bool) |
| **`strict`** | React Router `strict` property. [More](https://v5.reactrouter.com/web/api/Route/strict-bool) |
| **`sensitive`** | React Router `sensitive` property. [More](https://v5.reactrouter.com/web/api/Route/sensitive-bool) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
#### Custom route components
Your custom route components will be given all the props that a React Router `<Route />` typically would receive, as well as two props from Payload:
| Prop | Description |
| ---------------------- | -------------|
| **`user`** | The currently logged in user. Will be `null` if no user is logged in. |
| **`canAccessAdmin`** * | If the currently logged in user is allowed to access the admin panel or not. |
| Prop | Description |
| ----------------------- | ---------------------------------------------------------------------------- |
| **`user`** | The currently logged in user. Will be `null` if no user is logged in. |
| **`canAccessAdmin`** \* | If the currently logged in user is allowed to access the admin panel or not. |
<Banner type="warning">
<strong>Note:</strong><br/>
It's up to you to secure your custom routes. If your route requires a user to be logged in or to have certain access rights, you should handle that within your route component yourself.
<strong>Note:</strong>
<br />
It's up to you to secure your custom routes. If your route requires a user to
be logged in or to have certain access rights, you should handle that within
your route component yourself.
</Banner>
#### Example
@@ -208,7 +313,10 @@ To see how to pass in your custom views to create custom routes of your own, tak
As your admin customizations gets more complex you may want to share state between fields or other components. You can add custom providers to do add your own context to any Payload app for use in other custom components within the admin panel. Within your config add `admin.components.providers`, these can be used to share context or provide other custom functionality. Read the [React context](https://reactjs.org/docs/context.html) docs to learn more.
<Banner type="warning"><strong>Reminder:</strong> Don't forget to pass the **children** prop through the provider component for the admin UI to show</Banner>
<Banner type="warning">
<strong>Reminder:</strong> Don't forget to pass the **children** prop through
the provider component for the admin UI to show
</Banner>
### Styling Custom Components
@@ -220,12 +328,36 @@ To make use of Payload SCSS variables / mixins to use directly in your own compo
@import '~payload/scss';
```
### Getting the current language
When developing custom components you can support multiple languages to be consistent with Payload's i18n support. The best way to do this is to add your translation resources to the [i18n configuration](https://payloadcms.com/docs/configuration/i18n) and import `useTranslation` from `react-i18next` in your components.
For example:
```tsx
import { useTranslation } from "react-i18next";
const CustomComponent: React.FC = () => {
// highlight-start
const { t, i18n } = useTranslation("namespace1");
// highlight-end
return (
<ul>
<li>{t("key", { variable: "value" })}</li>
<li>{t("namespace2:key", { variable: "value" })}</li>
<li>{i18n.language}</li>
</ul>
);
};
```
### Getting the current locale
In any custom component you can get the selected locale with the `useLocale` hook. Here is a simple example:
```tsx
import { useLocale } from 'payload/components/utilities';
import { useLocale } from "payload/components/utilities";
const Greeting: React.FC = () => {
// highlight-start
@@ -233,12 +365,10 @@ const Greeting: React.FC = () => {
// highlight-end
const trans = {
en: 'Hello',
es: 'Hola',
en: "Hello",
es: "Hola",
};
return (
<span> { trans[locale] } </span>
);
return <span> {trans[locale]} </span>;
};
```

View File

@@ -54,10 +54,10 @@ const {
### useFormFields
There are times when a custom field component needs to have access to data from other fields, and you have a few options to do so. The `useFormFields` hook is a powerful and highly performant way to retrieve a form's field state, as well as to retrieve the `dispatchFields` method, which can be helpful for setting other fields' form states from anywhere within a form.
There are times when a custom field component needs to have access to data from other fields, and you have a few options to do so. The `useFormFields` hook is a powerful and highly performant way to retrieve a form's field state, as well as to retrieve the `dispatchFields` method, which can be helpful for setting other fields' form states from anywhere within a form.
<Banner type="success">
<strong>This hook is great for retrieving only certain fields from form state</strong> because it ensures that it will only cause a rerender when the items that you ask for change.
<strong>This hook is great for retrieving only certain fields from form state</strong> because it ensures that it will only cause a rerender when the items that you ask for change.
</Banner>
Thanks to the awesome package [`use-context-selector`](https://github.com/dai-shi/use-context-selector), you can retrieve a specific field's state easily. This is ideal because you can ensure you have an up-to-date field state, and your component will only re-render when _that field's state_ changes.
@@ -84,7 +84,7 @@ const MyComponent: React.FC = () => {
### useAllFormFields
**To retrieve more than one field**, you can use the `useAllFormFields` hook. Your component will re-render when _any_ field changes, so use this hook only if you absolutely need to. Unlike the `useFormFields` hook, this hook does not accept a "selector", and it always returns an array with type of `[fields: Fields, dispatch: React.Dispatch<Action>]]`.
**To retrieve more than one field**, you can use the `useAllFormFields` hook. Your component will re-render when _any_ field changes, so use this hook only if you absolutely need to. Unlike the `useFormFields` hook, this hook does not accept a "selector", and it always returns an array with type of `[fields: Fields, dispatch: React.Dispatch<Action>]]`.
You can do lots of powerful stuff by retrieving the full form state, like using built-in helper functions to reduce field state to values only, or to retrieve sibling data by path.
@@ -100,7 +100,7 @@ const ExampleComponent: React.FC = () => {
// The result below will reflect the data stored in the form at the given time
const formData = reduceFieldsToValues(fields, true);
// Pass in field state and a path,
// Pass in field state and a path,
// and you will be sent all sibling data of the path that you've specified
const siblingData = getSiblingData(fields, 'someFieldName');
@@ -135,7 +135,7 @@ The `useForm` hook can be used to interact with the form itself, and sends back
<Banner type="warning">
<strong>Warning:</strong><br/>
This hook is optimized to avoid causing rerenders when fields change, and as such, its `fields` property will be out of date. You should only leverage this hook if you need to perform actions against the form in response to your users' actions. Do not rely on its returned "fields" as being up-to-date. They will be removed from this hook's response in an upcoming version.
This hook is optimized to avoid causing rerenders when fields change, and as such, its `fields` property will be out of date. You should only leverage this hook if you need to perform actions against the form in response to your users' actions. Do not rely on its returned "fields" as being up-to-date. They will be removed from this hook's response in an upcoming version.
</Banner>
The `useForm` hook returns an object with the following properties:
@@ -162,17 +162,18 @@ The `useForm` hook returns an object with the following properties:
The `useDocumentInfo` hook provides lots of information about the document currently being edited, including the following:
| Property | Description |
|---------------------------|------------------------------------------------------------------------------------|
| **`collection`** | If the doc is a collection, its collection config will be returned |
| **`global`** | If the doc is a global, its global config will be returned |
| **`type`** | The type of document being edited (collection or global) |
| **`id`** | If the doc is a collection, its ID will be returned |
| **`preferencesKey`** | The `preferences` key to use when interacting with document-level user preferences |
| **`versions`** | Versions of the current doc |
| **`unpublishedVersions`** | Unpublished versions of the current doc |
| **`publishedDoc`** | The currently published version of the doc being edited |
| **`getVersions`** | Method to trigger the retrieval of document versions |
| Property | Description |
|---------------------------|--------------------------------------------------------------------------------------------------------------------| |
| **`collection`** | If the doc is a collection, its collection config will be returned |
| **`global`** | If the doc is a global, its global config will be returned |
| **`id`** | If the doc is a collection, its ID will be returned |
| **`preferencesKey`** | The `preferences` key to use when interacting with document-level user preferences |
| **`versions`** | Versions of the current doc |
| **`unpublishedVersions`** | Unpublished versions of the current doc |
| **`publishedDoc`** | The currently published version of the doc being edited |
| **`getVersions`** | Method to trigger the retrieval of document versions |
| **`docPermissions`** | The current documents permissions. Collection document permissions fallback when no id is present (i.e. on create) |
| **`getDocPermissions`** | Method to trigger the retrieval of document level permissions |
**Example:**
@@ -224,14 +225,15 @@ const Greeting: React.FC = () => {
Useful to retrieve info about the currently logged in user as well as methods for interacting with it. It sends back an object with the following properties:
| Property | Description |
|---------------------|-----------------------------------------------------------------------------------------|
| **`user`** | The currently logged in user |
| **`logOut`** | A method to log out the currently logged in user |
| **`refreshCookie`** | A method to trigger the silent refreshing of a user's auth token |
| **`setToken`** | Set the token of the user, to be decoded and used to reset the user and token in memory |
| **`token`** | The logged in user's token (useful for creating preview links, etc.) |
| **`permissions`** | The permissions of the current user |
| Property | Description |
|--------------------------|-----------------------------------------------------------------------------------------|
| **`user`** | The currently logged in user |
| **`logOut`** | A method to log out the currently logged in user |
| **`refreshCookie`** | A method to trigger the silent refreshing of a user's auth token |
| **`setToken`** | Set the token of the user, to be decoded and used to reset the user and token in memory |
| **`token`** | The logged in user's token (useful for creating preview links, etc.) |
| **`refreshPermissions`** | Load new permissions (useful when content that effects permissions has been changed) |
| **`permissions`** | The permissions of the current user |
```tsx
import { useAuth } from 'payload/components/utilities';
@@ -250,7 +252,7 @@ const Greeting: React.FC = () => {
### useConfig
Used to easily fetch the full Payload config.
Used to easily fetch the full Payload config.
```tsx
import { useConfig } from 'payload/components/utilities';
@@ -266,6 +268,24 @@ const MyComponent: React.FC = () => {
};
```
### useEditDepth
Sends back how many editing levels "deep" the current component is. Edit depth is relevant while adding new documents / editing documents in modal windows and other cases.
```tsx
import { useEditDepth } from 'payload/components/utilities';
const MyComponent: React.FC = () => {
// highlight-start
const editDepth = useEditDepth();
// highlight-end
return (
<span>My component is {editDepth} levels deep</span>
)
}
```
### usePreferences
Returns methods to set and get user preferences. More info can be found [here](https://payloadcms.com/docs/admin/preferences).

View File

@@ -11,47 +11,54 @@ Payload dynamically generates a beautiful, fully functional React admin panel to
The Payload Admin panel is built with Webpack, code-split, highly performant (even with 100+ fields), and written fully in TypeScript.
<Banner type="success">
The Admin panel is meant to be simple enough to give you a starting point but not bring too much complexity, so that you can easily customize it to suit the needs of your application and your editors.
The Admin panel is meant to be simple enough to give you a starting point but
not bring too much complexity, so that you can easily customize it to suit the
needs of your application and your editors.
</Banner>
![Payload's Admin panel built in React](https://payloadcms.com/images/admin.jpg)
![Payload's Admin panel built in React](https://payloadcms.com/images/docs/admin.jpg)
*Screenshot of the Admin panel while editing a document from an example `AllFields` collection*
_Screenshot of the Admin panel while editing a document from an example `AllFields` collection_
## Admin Options
All options for the Admin panel are defined in your base Payload config file.
| Option | Description |
| -------------------- | -------------|
| `user` | The `slug` of a Collection that you want be used to log in to the Admin dashboard. [More](/docs/admin/overview#the-admin-user-collection) |
| `meta` | Base meta data to use for the Admin panel. Included properties are `titleSuffix`, `ogImage`, and `favicon`. |
| `disable` | If set to `true`, the entire Admin panel will be disabled. |
| `indexHTML` | Optionally replace the entirety of the `index.html` file used by the Admin panel. Reference the [base index.html file](https://github.com/payloadcms/payload/blob/master/src/admin/index.html) to ensure your replacement has the appropriate HTML elements. |
| `css` | Absolute path to a stylesheet that you can use to override / customize the Admin panel styling. [More](/docs/admin/customizing-css). |
| `scss` | Absolute path to a Sass variables / mixins stylesheet meant to override Payload styles to make for an easy re-skinning of the Admin panel. [More](/docs/admin/customizing-css#overriding-scss-variables). |
| `dateFormat` | Global date format that will be used for all dates in the Admin panel. Any valid [date-fns](https://date-fns.org/) format pattern can be used. |
| `avatar` | Set account profile picture. Options: `gravatar`, `default` or a custom React component. |
| `components` | Component overrides that affect the entirety of the Admin panel. [More](/docs/admin/components) |
| `webpack` | Customize the Webpack config that's used to generate the Admin panel. [More](/docs/admin/webpack) |
| Option | Description |
| --------------------- | -------------------------------------------------------------------------------------------------- |
| `user` | The `slug` of a Collection that you want be used to log in to the Admin dashboard. [More](/docs/admin/overview#the-admin-user-collection) |
| `buildPath` | Specify an absolute path for where to store the built Admin panel bundle used in production. Defaults to `path.resolve(process.cwd(), 'build')`. |
| `meta` | Base meta data to use for the Admin panel. Included properties are `titleSuffix`, `ogImage`, and `favicon`. |
| `disable` | If set to `true`, the entire Admin panel will be disabled. |
| `indexHTML` | Optionally replace the entirety of the `index.html` file used by the Admin panel. Reference the [base index.html file](https://github.com/payloadcms/payload/blob/master/src/admin/index.html) to ensure your replacement has the appropriate HTML elements. |
| `css` | Absolute path to a stylesheet that you can use to override / customize the Admin panel styling. [More](/docs/admin/customizing-css). |
| `scss` | Absolute path to a Sass variables / mixins stylesheet meant to override Payload styles to make for an easy re-skinning of the Admin panel. [More](/docs/admin/customizing-css#overriding-scss-variables). |
| `dateFormat` | Global date format that will be used for all dates in the Admin panel. Any valid [date-fns](https://date-fns.org/) format pattern can be used. |
| `avatar` | Set account profile picture. Options: `gravatar`, `default` or a custom React component. |
| `components` | Component overrides that affect the entirety of the Admin panel. [More](/docs/admin/components) |
| `webpack` | Customize the Webpack config that's used to generate the Admin panel. [More](/docs/admin/webpack) | |
| **`logoutRoute`** | The route for the `logout` page. |
| **`inactivityRoute`** | The route for the `logout` inactivity page. |
### The Admin User Collection
<Banner type="warning">
<strong>Important:</strong><br />
The Payload Admin panel can only be used by one Collection that supports <a href="/docs/authentication/overview">Authentication</a>.
<strong>Important:</strong>
<br />
The Payload Admin panel can only be used by one Collection that supports{" "}
<a href="/docs/authentication/overview">Authentication</a>.
</Banner>
To specify which Collection to use to log in to the Admin panel, pass the `admin` options a `user` key equal to the slug of the Collection that you'd like to use.
`payload.config.js`:
```ts
import { buildConfig } from 'payload/config';
import { buildConfig } from "payload/config";
const config = buildConfig({
admin: {
user: 'admins', // highlight-line
user: "admins", // highlight-line
},
});
```

View File

@@ -56,7 +56,7 @@ You may rely on server-only packages such as the above to perform logic in acces
import { CollectionConfig } from 'payload/types';
import createStripeSubscription from './hooks/createStripeSubscription';
const Subscription: CollectionConfig = {
export const Subscription: CollectionConfig = {
slug: 'subscriptions',
hooks: {
beforeChange: [
@@ -71,8 +71,6 @@ const Subscription: CollectionConfig = {
}
]
};
export default Subscription;
```
The collection above features a `beforeChange` hook that creates a Stripe subscription whenever a Subscription document is created in Payload.

View File

@@ -17,7 +17,7 @@ To enable Authentication on a collection, define an `auth` property and set it t
| **`useAPIKey`** | Payload Authentication provides for API keys to be set on each user within an Authentication-enabled Collection. [More](/docs/authentication/config#api-keys) |
| **`tokenExpiration`** | How long (in seconds) to keep the user logged in. JWTs and HTTP-only cookies will both expire at the same time. |
| **`maxLoginAttempts`** | Only allow a user to attempt logging in X amount of times. Automatically locks out a user from authenticating if this limit is passed. Set to `0` to disable. |
| **`lockTime`** | Set the time that a user should be locked out if they fail authentication more times than `maxLoginAttempts` allows for. |
| **`lockTime`** | Set the time (in milliseconds) that a user should be locked out if they fail authentication more times than `maxLoginAttempts` allows for. |
| **`depth`** | How many levels deep a `user` document should be populated when creating the JWT and binding the `user` to the express `req`. Defaults to `0` and should only be modified if absolutely necessary, as this will affect performance. |
| **`cookies`** | Set cookie options, including `secure`, `sameSite`, and `domain`. For advanced users. |
| **`forgotPassword`** | Customize the way that the `forgotPassword` operation functions. [More](/docs/authentication/config#forgot-password) |
@@ -29,10 +29,12 @@ To enable Authentication on a collection, define an `auth` property and set it t
To integrate with third-party APIs or services, you might need the ability to generate API keys that can be used to identify as a certain user within Payload.
In Payload, users are essentially documents within a collection. Just like you can authenticate as a user with an email and password, which is considered as our default local auth strategy, you can also authenticate as a user with an API key. API keys are generated on a user-by-user basis, similar to email and passwords, and are meant to represent a single user.
For example, if you have a third-party service or external app that needs to be able to perform protected actions at its discretion, you have two options:
1. Create a user for the third-party app, and log in each time to receive a token before you attempt to access any protected actions
1. Enable API key support for the Collection, where you can generate a non-expiring API key per user in the collection
1. Enable API key support for the Collection, where you can generate a non-expiring API key per user in the collection. This is particularly useful as you can create a "user" that reflects an integration with a specific external service and assign a "role" or specific access only needed by that service/integration. Alternatively, you could create a "super admin" user and assign an API key to that user so that any requests made with that API key are considered as being made by that super user.
Technically, both of these options will work for third-party integrations but the second option with API key is simpler, because it reduces the amount of work that your integrations need to do to be authenticated properly.
@@ -43,21 +45,23 @@ To enable API keys on a collection, set the `useAPIKey` auth option to `true`. F
is compromised, your API keys will not be.
</Banner>
##### Authenticating via API Key
#### Authenticating via API Key
To utilize your API key while interacting with the REST or GraphQL API, add the `Authorization` header.
To authenticate REST or GraphQL API requests using an API key, set the `Authorization` header. The header is case-sensitive and needs the slug of the `auth.useAPIKey` enabled collection, then " API-Key ", followed by the `apiKey` that has been assigned. Payload's built-in middleware will then assign the user document to `req.user` and handle requests with the proper access control. By doing this, Payload recognizes the request being made as a request by the user associated with that API key.
**For example, using Fetch:**
```ts
import User from '../collections/User';
const response = await fetch("http://localhost:3000/api/pages", {
headers: {
Authorization: `${collection.labels.singular} API-Key ${YOUR_API_KEY}`,
Authorization: `${User.slug} API-Key ${YOUR_API_KEY}`,
},
});
```
Note: The label portion of the header is case-sensitive and will likely have a capitalized first character unless the label has been customized.
Payload ensures that the same, uniform access control is used across all authentication strategies. This enables you to utilize your existing access control configurations with both API keys and the standard email/password authentication. This consistency can aid in maintaining granular control over your API keys.
### Forgot Password
@@ -82,7 +86,7 @@ Example:
```ts
import { CollectionConfig } from 'payload/types';
const Customers: CollectionConfig = {
export const Customers: CollectionConfig = {
slug: 'customers',
auth: {
forgotPassword: {
@@ -156,7 +160,7 @@ Example:
import { CollectionConfig } from 'payload/types';
const Customers: CollectionConfig = {
export const Customers: CollectionConfig = {
slug: 'customers',
auth: {
verify: {

View File

@@ -66,6 +66,8 @@ query {
}
```
Document access can also be queried on a collection/global basis. Access on a global can queried like `http://localhost:3000/api/global-slug/access`, Collection document access can be queried like `http://localhost:3000/api/collection-slug/access/:id`.
### Me
Returns either a logged in user with token or null when there is no logged in user.
@@ -92,7 +94,7 @@ Example response:
```graphql
query {
Me[collection-singular-label] {
me[collection-singular-label] {
user {
email
}

View File

@@ -12,7 +12,7 @@ keywords: authentication, config, configuration, overview, documentation, Conten
Authentication is used within the Payload Admin panel itself as well as throughout your app(s) themselves however you determine necessary.
![Authentication admin panel functionality](https://payloadcms.com/images/auth-admin.jpg)
![Authentication admin panel functionality](https://payloadcms.com/images/docs/auth-admin.jpg)
*Admin panel screenshot depicting an Admins Collection with Auth enabled*
**Here are some common use cases of Authentication outside of Payload's dashboard itself:**
@@ -35,8 +35,8 @@ Simple example collection:
```ts
import { CollectionConfig } from 'payload/types';
const Admins: CollectionConfig = {
slug:
export const Admins: CollectionConfig = {
slug: 'admins',
// highlight-start
auth: {
tokenExpiration: 7200, // How many seconds to keep the user logged in

View File

@@ -11,38 +11,48 @@ Because Payload uses your existing Express server, you are free to add whatever
This approach has a ton of benefits - it's great for isolation of concerns and limiting scope, but it also means that your additional routes won't have access to Payload's user authentication.
<Banner type="success">
You can make full use of Payload's built-in authentication within your own custom Express endpoints by adding Payload's authentication middleware.
You can make full use of Payload's built-in authentication within your own
custom Express endpoints by adding Payload's authentication middleware.
</Banner>
<Banner type="warning">
Payload must be initialized before the `payload.authenticate` middleware can
be used. This is done by calling `payload.init()` prior to adding the
middleware.
</Banner>
Example in `server.js`:
```ts
import express from 'express';
import payload from 'payload';
import express from "express";
import payload from "payload";
const app = express();
payload.init({
secret: 'PAYLOAD_SECRET_KEY',
mongoURL: 'mongodb://localhost/payload',
express: app,
});
const start = async () => {
await payload.init({
secret: "PAYLOAD_SECRET_KEY",
mongoURL: "mongodb://localhost/payload",
express: app,
});
const router = express.Router();
const router = express.Router();
router.use(payload.authenticate); // highlight-line
// Note: Payload must be initialized before the `payload.authenticate` middleware can be used
router.use(payload.authenticate); // highlight-line
router.get('/', (req, res) => {
if (req.user) {
return res.send(`Authenticated successfully as ${req.user.email}.`);
}
router.get("/", (req, res) => {
if (req.user) {
return res.send(`Authenticated successfully as ${req.user.email}.`);
}
return res.send('Not authenticated');
});
return res.send("Not authenticated");
});
app.use('/some-route-here', router);
app.use("/some-route-here", router);
app.listen(3000, async () => {
payload.logger.info(`listening on ${3000}...`);
});
app.listen(3000);
};
start();
```

View File

@@ -12,19 +12,25 @@ It's often best practice to write your Collections in separate files and then im
## Options
| Option | Description |
| ---------------- | -------------|
| **`slug`** * | Unique, URL-friendly string that will act as an identifier for this Collection. |
| **`fields`** * | Array of field types that will determine the structure and functionality of the data stored within this Collection. [Click here](/docs/fields/overview) for a full list of field types as well as how to configure them. |
| **`labels`** | Singular and plural labels for use in identifying this Collection throughout Payload. Auto-generated from slug if not defined. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-options). |
| **`hooks`** | Entry points to "tie in" to Collection actions at specific points. [More](/docs/hooks/overview#collection-hooks) |
| **`access`** | Provide access control functions to define exactly who should be able to do what with Documents in this Collection. [More](/docs/access-control/overview/#collections) |
| **`auth`** | Specify options if you would like this Collection to feature authentication. For more, consult the [Authentication](/docs/authentication/config) documentation. |
| **`upload`** | Specify options if you would like this Collection to support file uploads. For more, consult the [Uploads](/docs/upload/overview) documentation. |
| **`timestamps`** | Set to false to disable documents' automatically generated `createdAt` and `updatedAt` timestamps. |
| **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#collection-config)|
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints) |
| Option | Description |
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`slug`** * | Unique, URL-friendly string that will act as an identifier for this Collection. |
| **`fields`** * | Array of field types that will determine the structure and functionality of the data stored within this Collection. [Click here](/docs/fields/overview) for a full list of field types as well as how to configure them. |
| **`indexes`** * | Array of database indexes to create, including compound indexes that have multiple fields. |
| **`labels`** | Singular and plural labels for use in identifying this Collection throughout Payload. Auto-generated from slug if not defined. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-options). |
| **`hooks`** | Entry points to "tie in" to Collection actions at specific points. [More](/docs/hooks/overview#collection-hooks) |
| **`access`** | Provide access control functions to define exactly who should be able to do what with Documents in this Collection. [More](/docs/access-control/overview/#collections) |
| **`auth`** | Specify options if you would like this Collection to feature authentication. For more, consult the [Authentication](/docs/authentication/config) documentation. |
| **`upload`** | Specify options if you would like this Collection to support file uploads. For more, consult the [Uploads](/docs/upload/overview) documentation. |
| **`timestamps`** | Set to false to disable documents' automatically generated `createdAt` and `updatedAt` timestamps. |
| **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#collection-config) |
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints) |
| **`graphQL`** | An object with `singularName` and `pluralName` strings used in schema generation. Auto-generated from slug if not defined. |
| **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. |
| **`defaultSort`** | Pass a top-level field to sort by default in the collection List view. Prefix the name of the field with a minus symbol ("-") to sort in descending order. |
| **`pagination`** | Set pagination-specific options for this collection. [More](#pagination) |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -33,7 +39,7 @@ It's often best practice to write your Collections in separate files and then im
```ts
import { CollectionConfig } from 'payload/types';
const Orders: CollectionConfig = {
export const Orders: CollectionConfig = {
slug: 'orders',
fields: [
{
@@ -47,7 +53,7 @@ const Orders: CollectionConfig = {
relationTo: 'customers',
required: true,
}
]
],
};
```
@@ -59,18 +65,21 @@ You can find an assortment of [example collection configs](https://github.com/pa
You can customize the way that the Admin panel behaves on a collection-by-collection basis by defining the `admin` property on a collection's config.
| Option | Description |
| ---------------------------- | -------------|
| `group` | Text used as a label for grouping collection links together in the navigation. |
| `hooks` | Admin-specific hooks for this collection. [More](#admin-hooks) |
| `useAsTitle` | Specify a top-level field to use for a document title throughout the Admin panel. If no field is defined, the ID of the document is used as the title. |
| `description` | Text or React component to display below the Collection label in the List view to give editors more information. |
| `defaultColumns` | Array of field names that correspond to which columns to show by default in this collection's List view. |
| `disableDuplicate ` | Disables the "Duplicate" button while editing documents within this collection. |
| Option | Description |
|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `group` | Text used as a label for grouping collection and global links together in the navigation. |
| `hidden` | Set to true or a function, called with the current user, returning true to exclude this collection from navigation and admin routing. |
| `hooks` | Admin-specific hooks for this collection. [More](#admin-hooks) |
| `useAsTitle` | Specify a top-level field to use for a document title throughout the Admin panel. If no field is defined, the ID of the document is used as the title. |
| `description` | Text or React component to display below the Collection label in the List view to give editors more information. |
| `defaultColumns` | Array of field names that correspond to which columns to show by default in this collection's List view. |
| `disableDuplicate ` | Disables the "Duplicate" button while editing documents within this collection. |
| `hideAPIURL` | Hides the "API URL" meta field while editing documents within this collection. |
| `enableRichTextLink` | The [Rich Text](/docs/fields/rich-text) field features a `Link` element which allows for users to automatically reference related documents within their rich text. Set to `true` by default. |
| `enableRichTextRelationship` | The [Rich Text](/docs/fields/rich-text) field features a `Relationship` element which allows for users to automatically reference related documents within their rich text. Set to `true` by default. |
| `preview` | Function to generate preview URLS within the Admin panel that can point to your app. [More](#preview). |
| `components` | Swap in your own React components to be used within this collection. [More](/docs/admin/components#collections) |
| `listSearchableFields ` | Specify which fields should be searched in the List search view. [More](/docs/configuration/collections#list-searchable-fields) |
| `preview` | Function to generate preview URLS within the Admin panel that can point to your app. [More](#preview). |
| `components` | Swap in your own React components to be used within this collection. [More](/docs/admin/components#collections) |
| `listSearchableFields` | Specify which fields should be searched in the List search view. [More](#list-searchable-fields) |
### Preview
@@ -88,7 +97,7 @@ If the function is specified, a Preview button will automatically appear in the
```ts
import { CollectionConfig } from 'payload/types';
const Posts: CollectionConfig = {
export const Posts: CollectionConfig = {
slug: 'posts',
fields: [
{
@@ -109,6 +118,15 @@ const Posts: CollectionConfig = {
};
```
### Pagination
Here are a few options that you can specify options for pagination on a collection-by-collection basis:
| Option | Description |
| --------------------------- | -------------|
| `defaultLimit` | Integer that specifies the default per-page limit that should be used. Defaults to 10. |
| `limits` | Provide an array of integers to use as per-page options for admins to choose from in the List view. |
### Access control
You can specify extremely granular access control (what users can do with documents in a collection) on a collection by collection basis. To learn more, go to the [Access Control](/docs/access-control/overview) docs.
@@ -121,7 +139,7 @@ Hooks are a powerful way to extend collection functionality and execute your own
Collections support all field types that Payload has to offer—including simple fields like text and checkboxes all the way to more complicated layout-building field groups like Blocks. [Click here](/docs/fields/overview) to learn more about field types.
#### List Searchable Fields
### List Searchable Fields
In the List view, there is a "search" box that allows you to quickly find a document with a search. By default, it searches on the ID field. If you have `admin.useAsTitle` defined, the list search will use that field. However, you can define more than one field to search to make it easier on your admin editors to find the data they need.
@@ -129,7 +147,7 @@ For example, let's say you have a Posts collection with `title`, `metaDescriptio
<Banner type="warning">
<strong>Note:</strong><br/>
If you are adding <strong>listSearchableFields</strong>, make sure you index each of these fields so your admin queries can remain performant.
If you are adding <strong>listSearchableFields</strong>, make sure you index each of these fields so your admin queries can remain performant.
</Banner>
### Admin Hooks
@@ -138,7 +156,7 @@ In addition to collection hooks themselves, Payload provides for admin UI-specif
**`beforeDuplicate`**
The `beforeDuplicate` hook is an async function that accepts an object containing the data to duplicate, as well as the locale of the doc to duplicate. Within this hook, you can modify the data to be duplicated, which is useful in cases where you have unique fields that need to be incremented or similar, as well as if you want to automatically modify a document's `title`.
The `beforeDuplicate` hook is an async function that accepts an object containing the data to duplicate, as well as the locale of the doc to duplicate. Within this hook, you can modify the data to be duplicated, which is useful in cases where you have unique fields that need to be incremented or similar, as well as if you want to automatically modify a document's `title`.
Example:

View File

@@ -8,6 +8,40 @@ keywords: config, configuration, documentation, Content Management System, cms,
Payload utilizes a few Express-specific middleware packages within its own routers. You can customize how they work by passing in configuration options to the main Payload config's `express` property.
### Custom Middleware
Payload allows you to pass in custom Express middleware to be used on all of the routes it opens. This is useful for adding logging or any other custom functionality to your endpoints.
There are 2 exposed properties. Each property is an array of middleware functions.
- `preMiddleware` - runs before any of the Payload middleware
- `postMiddleware` - runs after all of the Payload middleware
```ts
{
express: {
preMiddleware: [
(req, res, next) => {
// do something
next()
}
],
postMiddleware: [
(req, res, next) => {
// do something
next()
}
]
}
}
// Example logging middleware function
const requestLoggerMiddleware = (req, res, next) => {
req.payload.logger.info(`request: ${req.method} ${req.url}`)
next()
}
```
### JSON
`express.json()` is used to parse JSON body content into JavaScript objects accessible on the Express `req`. Payload allows you to customize all of the `json` method's options. Common examples of customization use-cases are increasing the max allowed JSON body size which defaults to `2MB`.

View File

@@ -6,49 +6,52 @@ desc: Set up your Global config for your needs by defining fields, adding slugs
keywords: globals, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
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.
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.
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.
## Options
| Option | Description |
| ---------------- | -------------|
| **`slug`** * | Unique, URL-friendly string that will act as an identifier for this Global. |
| **`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. |
| **`label`** | Singular label for use in identifying this Global throughout Payload. Auto-generated from slug if not defined. |
| **`description`**| Text or React component to display below the Global header to give editors more information. |
| **`admin`** | Admin-specific configuration. See below for [more detail](/docs/configuration/globals#admin-options). |
| **`hooks`** | Entry points to "tie in" to collection actions at specific points. [More](/docs/hooks/overview#global-hooks) |
| **`access`** | Provide access control functions to define exactly who should be able to do what with this Global. [More](/docs/access-control/overview/#globals) |
| **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#globals-config)|
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints)|
| Option | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`slug`** \* | Unique, URL-friendly string that will act as an identifier for this Global. |
| **`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. |
| **`label`** | Text for the name in the Admin panel or an object with keys for each language. Auto-generated from slug if not defined. |
| **`description`** | Text or React component to display below the Global header to give editors more information. |
| **`admin`** | Admin-specific configuration. See below for [more detail](/docs/configuration/globals#admin-options). |
| **`hooks`** | Entry points to "tie in" to collection actions at specific points. [More](/docs/hooks/overview#global-hooks) |
| **`access`** | Provide access control functions to define exactly who should be able to do what with this Global. [More](/docs/access-control/overview/#globals) |
| **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#globals-config) |
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints) |
| **`graphQL.name`** | Text used in schema generation. Auto-generated from slug if not defined. |
| **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
#### Simple Global example
```ts
import { GlobalConfig } from 'payload/types';
import { GlobalConfig } from "payload/types";
const Nav: GlobalConfig = {
slug: 'nav',
fields: [
{
name: 'items',
type: 'array',
required: true,
maxRows: 8,
fields: [
{
name: 'page',
type: 'relationship',
relationTo: 'pages', // "pages" is the slug of an existing collection
required: true,
}
]
},
]
slug: "nav",
fields: [
{
name: "items",
type: "array",
required: true,
maxRows: 8,
fields: [
{
name: "page",
type: "relationship",
relationTo: "pages", // "pages" is the slug of an existing collection
required: true,
},
],
},
],
};
export default Nav;
@@ -62,9 +65,50 @@ You can find an [example Global config](https://github.com/payloadcms/public-dem
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.
| Option | Description |
| ---------------------------- | -------------|
| `components` | Swap in your own React components to be used within this Global. [More](/docs/admin/components#globals) |
| Option | Description |
|--------------|-----------------------------------------------------------------------------------------------------------------------------------|
| `group` | Text used as a label for grouping collection and global links together in the navigation. |
| `hidden` | Set to true or a function, called with the current user, returning true to exclude this global from navigation and admin routing. |
| `components` | Swap in your own React components to be used within this Global. [More](/docs/admin/components#globals) |
| `preview` | Function to generate a preview URL within the Admin panel for this global that can point to your app. [More](#preview). |
| `hideAPIURL` | Hides the "API URL" meta field while editing documents within this collection. |
### Preview
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.
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.
**The preview function accepts two arguments:**
1. The document being edited
1. An `options` object, containing `locale` and `token` properties. The `token` is the currently logged-in user's JWT.
**Example global with preview function:**
```ts
import { GlobalConfig } from "payload/types";
export const MyGlobal: GlobalConfig = {
slug: "my-global",
fields: [
{
name: "slug",
type: "text",
required: true,
},
],
admin: {
preview: (doc, { locale }) => {
if (doc?.slug) {
return `https://bigbird.com/preview/${doc.slug}?locale=${locale}`;
}
return null;
},
},
};
```
### Access control
@@ -83,14 +127,14 @@ Globals support all field types that Payload has to offer—including simple fie
You can import global types as follows:
```ts
import { GlobalConfig } from 'payload/types';
import { GlobalConfig } from "payload/types";
// This is the type used for incoming global configs.
// Only the bare minimum properties are marked as required.
```
```ts
import { SanitizedGlobalConfig } from 'payload/types';
import { SanitizedGlobalConfig } from "payload/types";
// This is the type used after an incoming global config is fully sanitized.
// Generally, this is only used internally by Payload.

102
docs/configuration/i18n.mdx Normal file
View File

@@ -0,0 +1,102 @@
---
title: I18n
label: I18n
order: 40
desc: Manage and customize internationalization support in your CMS editor experience
keywords: internationalization, i18n, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
Not only does Payload support managing localized content, it also has internationalization support so that admin users can work in their preferred language. Payload's i18n support is built on top of [i18next](https://www.i18next.com). It comes included by default and can be extended in your config.
While Payload's built-in features come translated, you may want to also translate parts of your project's configuration too. This is possible in places like collections and globals labels and groups, field labels, descriptions and input placeholder text. The admin UI will display all the correct translations you provide based on the user's language.
Here is an example of a simple collection supporting both English and Spanish editors:
```ts
import { CollectionConfig } from 'payload/types';
export const Articles: CollectionConfig = {
slug: 'articles',
labels: {
singular: {
en: 'Article', es: 'Artículo',
},
plural: {
en: 'Articles', es: 'Artículos',
},
},
admin: {
group: { en: 'Content', es: 'Contenido' },
},
fields: [
{
name: 'title',
type: 'text',
label: {
en: 'Title', es: 'Título',
},
admin: {
placeholder: { en: 'Enter title', es: 'Introduce el título' }
}
},
{
name: 'type',
type: 'radio',
options: [{
value: 'news',
label: { en: 'News', es: 'Noticias' },
}, // etc...
],
},
],
}
```
### Admin UI
The Payload admin panel reads the language settings of a user's browser and display all text in that language, or will fall back to English if the user's language is not yet supported.
After a user logs in, they can change their language selection in the `/account` view.
<Banner>
<strong>Note:</strong><br/>
If there is a language that Payload does not yet support, we accept code <a href="https://github.com/payloadcms/payload/blob/master/contributing.md">contributions</a>.
</Banner>
### Node Express
Payload's backend uses express middleware to set the language on incoming requests before they are handled. This allows backend validation to return error messages in the user's own language or system generated emails to be sent using the correct translation. You can make HTTP requests with the `accept-language` header and Payload will use that language.
Anywhere in your Payload app that you have access to the `req` object, you can access i18next's extensive internationalization features assigned to `req.i18n`. To access text translations you can use `req.t('namespace:key')`.
Read the i18next [API documentation](https://www.i18next.com/overview/api) to learn more.
### Configuration Options
In your Payload config, you can add translations and customize the settings in `i18n`. Payload will use your custom options and merge it with the default, allowing you to override the settings Payload provides.
**Example Payload config extending i18n:**
```ts
import { buildConfig } from 'payload/config'
export default buildConfig({
//...
i18n: {
fallbackLng: 'en', // default
debug: false, // default
resources: {
en: {
custom: { // namespace can be anything you want
key1: 'Translation with {{variable}}', // translation
},
// override existing translation keys
general: {
dashboard: 'Home',
},
},
},
},
//...
});
```
See the i18next [configuration options](https://www.i18next.com/overview/configuration-options) to learn more.

View File

@@ -72,6 +72,15 @@ All field types with a `name` property support the `localized` property—even t
Enabling localization for field types that support nested fields will automatically create localized "sets" of all fields contained within the field. For example, if you have a page layout using a blocks field type, you have the choice of either localizing the full layout, by enabling localization on the top-level blocks field, or only certain fields within the layout.
</Banner>
<Banner type="warning">
<strong>Important:</strong>
<br />
When converting an existing field to or from `localized: true` the data
structure in the document will change for this field and so existing data for
this field will be lost. Before changing the localization setting on fields
with existing data, you may need to consider a field migration strategy.
</Banner>
### Retrieving localized docs
When retrieving documents, you can specify which locale you'd like to receive as well as which fallback locale should be used.

View File

@@ -6,82 +6,86 @@ desc: The Payload config is central to everything that Payload does, from adding
keywords: overview, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
Payload is a *config-based*, code-first CMS and application framework. The Payload config is central to everything that Payload does. It scaffolds the data that Payload stores as well as maintains custom React components, hook logic, custom validations, and much more. The config itself and all of its dependencies are run through Babel, so you can take full advantage of newer JavaScript features and even directly import React components containing JSX.
Payload is a _config-based_, code-first CMS and application framework. The Payload config is central to everything that Payload does. It scaffolds the data that Payload stores as well as maintains custom React components, hook logic, custom validations, and much more.
<strong>Also, because the Payload source code is fully written in TypeScript, its configs are strongly typed—meaning that even if you aren't using TypeScript to build your project, your IDE (such as VSCode) may still provide helpful information like type-ahead suggestions while you write your config.</strong>
**Also, because the Payload source code is fully written in TypeScript, its configs are strongly typed—meaning that even if you aren't using TypeScript, your IDE (such as VSCode) may still provide helpful information like type-ahead suggestions while you write your config.**
<Banner type="warning">
<strong>Important:</strong><br />This file is included in the Payload admin bundle, so make sure you do not embed any sensitive information.
<strong>Important:</strong>
<br />
This file is included in the Payload admin bundle, so make sure you do not
embed any sensitive information.
</Banner>
## Options
| Option | Description |
| -------------------- | -------------|
| `serverURL` | A string used to define the absolute URL of your app including the protocol, for example `https://example.com`. No paths allowed, only protocol, domain and (optionally) port |
| `collections` | An array of all Collections that Payload will manage. To read more about how to define your collection configs, [click here](/docs/configuration/collections). |
| `cors` | Either a whitelist array of URLS to allow CORS requests from, or a wildcard string (`'*'`) to accept incoming requests from any domain. |
| `globals` | An array of all Globals that Payload will manage. For more on Globals and their configs, [click here](/docs/configuration/globals). |
| `admin` | Base Payload admin configuration. Specify custom components, control metadata, set the Admin user collection, and [more](/docs/admin/overview#admin-options). |
| `localization` | Opt-in and control how Payload handles the translation of your content into multiple locales. [More](/docs/configuration/localization) |
| `graphQL` | Manage GraphQL-specific functionality here. Define your own queries and mutations, manage query complexity limits, and [more](/docs/graphql/overview#graphql-options). |
| `cookiePrefix` | A string that will be prefixed to all cookies that Payload sets. |
| `csrf` | A whitelist array of URLs to allow Payload cookies to be accepted from as a form of CSRF protection. [More](/docs/authentication/overview#csrf-protection) |
| `defaultDepth` | If a user does not specify `depth` while requesting a resource, this depth will be used. [More](/docs/getting-started/concepts#depth) |
| `maxDepth` | The maximum allowed depth to be permitted application-wide. This setting helps prevent against malicious queries. Defaults to `10`. |
| `indexSortableFields`| Automatically index all sortable top-level fields in the database to improve sort performance and add database compatibility for Azure Cosmos and similar. |
| `upload` | Base Payload upload configuration. [More](/docs/upload/overview#payload-wide-upload-options). |
| `routes` | Control the routing structure that Payload binds itself to. Specify `admin`, `api`, `graphQL`, and `graphQLPlayground`. |
| `email` | Base email settings to allow Payload to generate email such as Forgot Password requests and other requirements. [More](/docs/email/overview#configuration) |
| `express` | Express-specific middleware options such as compression and JSON parsing. [More](/docs/configuration/express) |
| `debug` | Enable to expose more detailed error information. |
| `telemetry` | Disable Payload telemetry by passing `false`. [More](/docs/configuration/overview#telemetry) |
| `rateLimit` | Control IP-based rate limiting for all Payload resources. Used to prevent DDoS attacks and [more](/docs/production/preventing-abuse#rate-limiting-requests). |
| `hooks` | Tap into Payload-wide hooks. [More](/docs/hooks/overview) |
| `plugins` | An array of Payload plugins. [More](/docs/plugins/overview) |
| `endpoints` | An array of custom API endpoints added to the Payload router. [More](/docs/rest-api/overview#custom-endpoints) |
| Option | Description |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `serverURL` | A string used to define the absolute URL of your app including the protocol, for example `https://example.com`. No paths allowed, only protocol, domain and (optionally) port |
| `collections` | An array of all Collections that Payload will manage. To read more about how to define your collection configs, [click here](/docs/configuration/collections). |
| `cors` | Either a whitelist array of URLS to allow CORS requests from, or a wildcard string (`'*'`) to accept incoming requests from any domain. |
| `globals` | An array of all Globals that Payload will manage. For more on Globals and their configs, [click here](/docs/configuration/globals). |
| `admin` | Base Payload admin configuration. Specify custom components, control metadata, set the Admin user collection, and [more](/docs/admin/overview#admin-options). |
| `localization` | Opt-in and control how Payload handles the translation of your content into multiple locales. [More](/docs/configuration/localization) |
| `graphQL` | Manage GraphQL-specific functionality here. Define your own queries and mutations, manage query complexity limits, and [more](/docs/graphql/overview#graphql-options). |
| `cookiePrefix` | A string that will be prefixed to all cookies that Payload sets. |
| `csrf` | A whitelist array of URLs to allow Payload cookies to be accepted from as a form of CSRF protection. [More](/docs/authentication/overview#csrf-protection) |
| `defaultDepth` | If a user does not specify `depth` while requesting a resource, this depth will be used. [More](/docs/getting-started/concepts#depth) |
| `maxDepth` | The maximum allowed depth to be permitted application-wide. This setting helps prevent against malicious queries. Defaults to `10`. |
| `indexSortableFields` | Automatically index all sortable top-level fields in the database to improve sort performance and add database compatibility for Azure Cosmos and similar. |
| `upload` | Base Payload upload configuration. [More](/docs/upload/overview#payload-wide-upload-options). |
| `routes` | Control the routing structure that Payload binds itself to. Specify `admin`, `api`, `graphQL`, and `graphQLPlayground`. |
| `email` | Base email settings to allow Payload to generate email such as Forgot Password requests and other requirements. [More](/docs/email/overview#configuration) |
| `express` | Express-specific middleware options such as compression and JSON parsing. [More](/docs/configuration/express) |
| `debug` | Enable to expose more detailed error information. |
| `telemetry` | Disable Payload telemetry by passing `false`. [More](/docs/configuration/overview#telemetry) |
| `rateLimit` | Control IP-based rate limiting for all Payload resources. Used to prevent DDoS attacks and [more](/docs/production/preventing-abuse#rate-limiting-requests). |
| `hooks` | Tap into Payload-wide hooks. [More](/docs/hooks/overview) |
| `plugins` | An array of Payload plugins. [More](/docs/plugins/overview) |
| `endpoints` | An array of custom API endpoints added to the Payload router. [More](/docs/rest-api/overview#custom-endpoints) |
| `custom` | Extension point for adding custom data (e.g. for plugins) |
#### Simple example
```ts
import { buildConfig } from 'payload/config';
import { buildConfig } from "payload/config";
export default buildConfig({
collections: [
{
slug: 'pages',
fields: [
{
name: 'title',
type: 'text',
required: true,
},
{
name: 'content',
type: 'richText',
required: true,
}
]
}
],
globals: [
{
slug: 'header',
fields: [
{
name: 'nav',
type: 'array',
fields: [
{
name: 'page',
type: 'relationship',
relationTo: 'pages',
},
]
}
]
}
]
collections: [
{
slug: "pages",
fields: [
{
name: "title",
type: "text",
required: true,
},
{
name: "content",
type: "richText",
required: true,
},
],
},
],
globals: [
{
slug: "header",
fields: [
{
name: "nav",
type: "array",
fields: [
{
name: "page",
type: "relationship",
relationTo: "pages",
},
],
},
],
},
],
});
```
@@ -94,12 +98,15 @@ You can see a full [example config](https://github.com/payloadcms/public-demo/bl
We suggest using the `dotenv` package to handle environment variables alongside of Payload. All that's necessary to do is to require the package as high up in your application as possible (for example, at the top of your `server.js` file), and ensure that it can find an `.env` file that you create.
**Add this line to the top of your server:**
```
require('dotenv').config()
// ...
// the rest of your `server.js` file goes here
```
Note that if you rely on any environment variables in your config itself, you should also call `dotenv()` at the top of your config itself as well. There's no harm in calling it in both your server and your config itself!
**Here is an example project structure w/ `dotenv` and an `.env` file:**
```
@@ -111,8 +118,13 @@ project-name
```
<Banner type="warning">
<strong>Important:</strong><br />
If you use an environment variable to configure any properties that are required for the Admin panel to function (ex. serverURL or any routes), you need to make sure that your Admin panel code can access it. <a href="/docs/admin/webpack#admin-environment-vars">Click here</a> for more info.
<strong>Important:</strong>
<br />
If you use an environment variable to configure any properties that are
required for the Admin panel to function (ex. serverURL or any routes), you
need to make sure that your Admin panel code can access it.{" "}
<a href="/docs/admin/webpack#admin-environment-vars">Click here</a> for more
info.
</Banner>
### Customizing & overriding the config location
@@ -133,53 +145,21 @@ But, you can specify where your Payload config is located as well as what it's n
### Developing within the Config
The Payload config itself, as well as all files that it requires or imports, are run through Babel. TypeScript and all common ES6 features are fully supported. To see the Babel config that is used to parse Payload configs, check out the Payload source code [here](https://github.com/payloadcms/payload/blob/master/src/babel.config.js).
Payload comes with `isomorphic-fetch` installed which means that even in Node, you can use the `fetch` API just as you would within the browser. No need to import `axios` or similar, unless you want to!
#### Payload Config and Babel
The entire Payload config is transpiled automatically by Payload via `babel`.
If for any reason you need to re-use the built-in Payload `babel.config.js`, you can do so by importing it as follows:
```
import { config } from 'payload/babel';
```
<Banner type="warning">
<strong>Note:</strong><br/>
Because the Payload config is transpiled internally, if you want to import it to share or reuse any of its properties within your own Node server's code, you need to make sure that <em>you manually transpile it</em> using <strong>babel-register</strong> or similar. For example, if you try to import your config directly into your server, your Node process will likely crash because the Payload config supports React components, TypeScript, and new ES6+ features.
</Banner>
However, you can share code, like for example your config's `serverURL` property by "hoisting" your shared properties above your config and writing any "shared" code in a module that is compatible with your Node environment.
For example, to share your `serverURL`, you could create a file like the following:
`serverURL.js`:
```js
const serverURL = 'http://localhost:3000';
module.exports = serverURL;
```
Then, you could import this file into both your Payload config and your server, in an effort to avoid importing your full Payload config directly into your server.
### TypeScript
You can import config types as follows:
```ts
import { Config } from 'payload/config';
import { Config } from "payload/config";
// This is the type used for an incoming Payload config.
// Only the bare minimum properties are marked as required.
```
```ts
import { SanitizedConfig } from 'payload/config';
import { SanitizedConfig } from "payload/config";
// This is the type used after an incoming Payload config is fully sanitized.
// Generally, this is only used internally by Payload.

View File

@@ -143,7 +143,7 @@ payload.init({
[06:37:21] INFO (payload): Starting Payload...
[06:37:22] INFO (payload): Payload Demo Initialized
[06:37:22] INFO (payload): listening on 3000...
[06:37:22] INFO (payload): Connected to Mongo server successfully!
[06:37:22] INFO (payload): Connected to MongoDB server successfully!
[06:37:23] INFO (payload): E-mail configured with mock configuration
[06:37:23] INFO (payload): Log into mock email provider at https://ethereal.email
[06:37:23] INFO (payload): Mock email account username: hhav5jw7doo4euev@ethereal.email

View File

@@ -6,8 +6,10 @@ desc: Array fields are intended for sets of repeating fields, that you define. L
keywords: array, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
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.
<Banner>
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.
</Banner>
**Example uses:**
@@ -16,70 +18,86 @@ keywords: array, fields, config, configuration, documentation, Content Managemen
- Navigational structures where editors can specify nav items containing pages ([relationship field](/docs/fields/relationship)), an "open in new tab" [checkbox field](/docs/fields/checkbox)
- 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)
![Array field in Payload admin panel](https://payloadcms.com/images/fields/array.jpg)
*Admin panel screenshot of an Array field with a Row containing two text fields, a read-only text field and a checkbox*
![Array field in Payload admin panel](https://payloadcms.com/images/docs/fields/array.jpg)
_Admin panel screenshot of an Array field with a Row containing two text fields, a read-only text field and a checkbox_
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a heading in the Admin panel and to name the generated GraphQL type. Auto-generated from name if not defined. |
| **`fields`** * | Array of field types to correspond to each row of the Array. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide an array of row data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`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`. |
| **`required`** | Require this field to have a value. |
| **`labels`** | Customize the row labels appearing in the Admin dashboard. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| Option | Description |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`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. |
| **`fields`** \* | Array of field types to correspond to each row of the Array. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide an array of row data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`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`. |
| **`required`** | Require this field to have a value. |
| **`labels`** | Customize the row labels appearing in the Admin dashboard. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
| **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Admin Config
In addition to the default [field admin config](/docs/fields/overview#admin-config), you can adjust the following properties:
| Option | Description |
| ---------------------- | ------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
| Option | Description |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
| **`components.RowLabel`** | Function or React component to be rendered as the label on the array row. Receives `({ data, index, path })` as args |
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: 'slider', // required
type: 'array', // required
label: 'Image Slider',
name: "slider", // required
type: "array", // required
label: "Image Slider",
minRows: 2,
maxRows: 10,
interfaceName: "CardSlider", // optional
labels: {
singular: 'Slide',
plural: 'Slides',
singular: "Slide",
plural: "Slides",
},
fields: [ // required
fields: [
// required
{
name: 'image',
type: 'upload',
relationTo: 'media',
name: "title",
type: "text",
},
{
name: "image",
type: "upload",
relationTo: "media",
required: true,
},
{
name: 'caption',
type: 'text',
}
]
}
]
name: "caption",
type: "text",
},
],
admin: {
components: {
RowLabel: ({ data, index }) => {
return data?.title || `Slide ${String(index).padStart(2, "0")}`;
},
},
},
},
],
};
```

View File

@@ -6,8 +6,11 @@ desc: The Blocks field type is a great layout build and can be used to construct
keywords: blocks, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
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.
<Banner>
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.
</Banner>
**Example uses:**
@@ -16,54 +19,62 @@ keywords: blocks, fields, config, configuration, documentation, Content Manageme
- A form builder tool where available block configs might be `Text`, `Select`, or `Checkbox`.
- Virtual event agenda "timeslots" where a timeslot could either be a `Break`, a `Presentation`, or a `BreakoutSession`.
![Blocks field in Payload admin panel](https://payloadcms.com/images/fields/blocks.jpg)
*Admin panel screenshot of a Blocks field type with Call to Action and Number block examples*
![Blocks field in Payload admin panel](https://payloadcms.com/images/docs/fields/blocks.jpg)
_Admin panel screenshot of a Blocks field type with Call to Action and Number block examples_
### Field config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a heading in the Admin panel and to name the generated GraphQL type. |
| **`blocks`** * | Array of [block configs](/docs/fields/blocks#block-configs) to be made available to this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-level hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide an array of block data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`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. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`labels`** | Customize the block row labels appearing in the Admin dashboard. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| Option | Description |
|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`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. |
| **`blocks`** * | Array of [block configs](/docs/fields/blocks#block-configs) to be made available to this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-level hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide an array of block data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`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`. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`labels`** | Customize the block row labels appearing in the Admin dashboard. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Admin Config
In addition to the default [field admin config](/docs/fields/overview#admin-config), you can adjust the following properties:
| Option | Description |
| ---------------------- | ------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
| Option | Description |
| ------------------- | ------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
### Block configs
Blocks are defined as separate configs of their own.
<Banner type="success">
<strong>Tip:</strong><br />
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.
<strong>Tip:</strong>
<br />
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.
</Banner>
| Option | Description |
| ---------------- | ----------- |
| **`slug`** * | Identifier for this block type. Will be saved on each block as the `blockType` property. |
| **`fields`** * | Array of fields to be stored in this block. |
| **`labels`** | Customize the block labels that appear in the Admin dashboard. Also used to name corresponding GraphQL schema types. Auto-generated from slug if not defined. |
| **`imageURL`** | Provide a custom image thumbnail to help editors identify this block in the Admin UI. |
| **`imageAltText`** | Customize this block's image thumbnail alt text. |
| Option | Description |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`slug`** \* | Identifier for this block type. Will be saved on each block as the `blockType` property. |
| **`fields`** \* | Array of fields to be stored in this block. |
| **`labels`** | Customize the block labels that appear in the Admin dashboard. Auto-generated from slug if not defined. |
| **`imageURL`** | Provide a custom image thumbnail to help editors identify this block in the Admin UI. |
| **`imageAltText`** | Customize this block's image thumbnail alt text. |
| **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
| **`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`. |
#### Auto-generated data per block
@@ -80,6 +91,7 @@ The Admin panel provides each block with a `blockName` field which optionally al
### Example
`collections/ExampleCollection.js`
```ts
import { Block, CollectionConfig } from 'payload/types';
@@ -87,7 +99,9 @@ const QuoteBlock: Block = {
slug: 'Quote', // required
imageURL: 'https://google.com/path/to/image.jpg',
imageAltText: 'A nice thumbnail image to show what this block looks like',
fields: [ // required
interfaceName: 'QuoteBlock', // optional
fields: [
// required
{
name: 'quoteHeader',
type: 'text',
@@ -97,10 +111,10 @@ const QuoteBlock: Block = {
name: 'quoteText',
type: 'text',
},
]
],
};
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
@@ -108,13 +122,13 @@ const ExampleCollection: CollectionConfig = {
type: 'blocks', // required
minRows: 1,
maxRows: 20,
blocks: [ // required
QuoteBlock
]
}
]
}
blocks: [
// required
QuoteBlock,
],
},
],
};
```
### TypeScript
@@ -123,5 +137,4 @@ As you build your own Block configs, you might want to store them in separate fi
```ts
import type { Block } from 'payload/types';
```

View File

@@ -14,8 +14,8 @@ keywords: checkbox, fields, config, configuration, documentation, Content Manage
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`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. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
@@ -26,6 +26,7 @@ keywords: checkbox, fields, config, configuration, documentation, Content Manage
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -35,7 +36,7 @@ keywords: checkbox, fields, config, configuration, documentation, Content Manage
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -11,14 +11,14 @@ keywords: code, fields, config, configuration, documentation, Content Management
The Code field type saves a string in the database, but provides the Admin panel with a code editor styled interface.
</Banner>
This field uses `prismjs` for syntax highlighting and `react-simple-code-editor` for the editor itself.
This field uses the `monaco-react` editor syntax highlighting.
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`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. |
| **`minLength`** | Used by the default validation function to ensure values are of a minimum character length. |
@@ -32,26 +32,18 @@ This field uses `prismjs` for syntax highlighting and `react-simple-code-editor`
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Admin config
### Admin Config
In addition to the default [field admin config](/docs/fields/overview#admin-config), the Code field type also allows for the customization of a `language` property.
In addition to the default [field admin config](/docs/fields/overview#admin-config), you can adjust the following properties:
The following `prismjs` plugins are imported, enabling the `language` property to accept the following values:
| Plugin | Language |
| ---------------------------- | ----------- |
| **`prism-css`** | `css` |
| **`prism-clike`** | `clike` |
| **`prism-markup`** | `markup`, `html`, `xml`, `svg`, `mathml`, `ssml`, `atom`, `rss` |
| **`prism-javascript`** | `javascript`, `js` |
| **`prism-json`** | `json` |
| **`prism-jsx`** | `jsx` |
| **`prism-typescript`** | `typescript`, `ts` |
| **`prism-tsx`** | `tsx` |
| **`prism-yaml`** | `yaml`, `yml` |
| Option | Description |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`language`** | This property can be set to any language listed [here](https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages). |
| **`editorOptions`** | Options that can be passed to the monaco editor, [view the full list](https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.IDiffEditorConstructionOptions.html). |
### Example
@@ -59,7 +51,7 @@ The following `prismjs` plugins are imported, enabling the `language` property t
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
@@ -67,7 +59,7 @@ const ExampleCollection: CollectionConfig = {
type: 'code', // required
required: true,
admin: {
language: 'js'
language: 'javascript'
}
}
]

View File

@@ -14,9 +14,10 @@ keywords: row, fields, config, configuration, documentation, Content Management
| Option | Description |
| -------------- | ------------------------------------------------------------------------- |
| **`label`** * | A label to render within the header of the collapsible component. |
| **`label`** * | A label to render within the header of the collapsible component. This can be a string, function or react component. Function/components receive `({ data, path })` as args. |
| **`fields`** * | Array of field types to nest within this Collapsible. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -34,13 +35,18 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
label: 'Header of collapsible goes here',
label: ({ data }) => data?.title || 'Untitled',
type: 'collapsible', // required
fields: [ // required
{
name: 'title',
type: 'text',
required: true,
},
{
name: 'someTextField',
type: 'text',

View File

@@ -17,8 +17,8 @@ This field uses [`react-datepicker`](https://www.npmjs.com/package/react-datepic
| Option | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`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. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
@@ -28,7 +28,8 @@ This field uses [`react-datepicker`](https://www.npmjs.com/package/react-datepic
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._
@@ -36,45 +37,72 @@ _\* An asterisk denotes that a property is required._
In addition to the default [field admin config](/docs/fields/overview#admin-config), you can customize the following fields that will adjust how the component displays in the admin panel via the `date` property.
| Option | Description |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`pickerAppearance`** | Determines the appearance of the datepicker: `dayAndTime` `timeOnly` `dayOnly` `monthOnly`. Defaults to `dayAndTime`. |
| **`displayFormat`** | Determines how the date is presented. dayAndTime default to `MMM d, yyy h:mm a` timeOnly defaults to `h:mm a` dayOnly defaults to `MMM d, yyy` and monthOnly defaults to `MM/yyyy`. |
| **`placeholder`** | Placeholder text for the field. |
| **`monthsToShow`** | Number of months to display max is 2. Defaults to 1. |
| **`minDate`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). |
| **`maxDate`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). |
| **`minTime`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). |
| **`maxTime`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). |
| **`timeIntervals`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). Defaults to 30 minutes. |
| **`timeFormat`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). Defaults to `'h:mm aa'`. |
| Property | Description |
| ------------------------------ | ------------------------------------------------------------------------------------------- |
| **`placeholder`** | Placeholder text for the field. |
| **`date`** | Pass options to customize date field appearance. |
| **`date.displayFormat`** | Format date to be shown in field **cell**. |
| **`date.pickerAppearance`** \* | Determines the appearance of the datepicker: `dayAndTime` `timeOnly` `dayOnly` `monthOnly`. |
| **`date.monthsToShow`** \* | Number of months to display max is 2. Defaults to 1. |
| **`date.minDate`** \* | Min date value to allow. |
| **`date.maxDate`** \* | Max date value to allow. |
| **`date.minTime`** \* | Min time value to allow. |
| **`date.maxTime`** \* | Max date value to allow. |
| **`date.timeIntervals`** \* | Time intervals to display. Defaults to 30 minutes. |
| **`date.timeFormat`** \* | Determines time format. Defaults to `'h:mm aa'`. |
_\* An asterisk denotes that a property is required._
_\* This property is passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). ._
Common use cases for customizing the `date` property are to restrict your field to only show time or day input—but lots more can be done.
#### Display Format and Picker Appearance
These properties only affect how the date is displayed in the UI. The full date is always stored in the format `YYYY-MM-DDTHH:mm:ss.SSSZ` (e.g. `1999-01-01T8:00:00.000+05:00`).
`displayFormat` determines how the date is presented in the field **cell**, you can pass any valid (unicode date format)[https://date-fns.org/v2.29.3/docs/format].
`pickerAppearance` sets the appearance of the **react datepicker**, the options available are `dayAndTime`, `dayOnly`, `timeOnly`, and `monthOnly`. By default, the datepicker will display `dayOnly`.
When only `pickerAppearance` is set, an equivalent format will be rendered in the date field cell. To overwrite this format, set `displayFormat`.
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
import { CollectionConfig } from "payload/types";
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: 'time', // required
type: 'date', // required
label: 'Event Start Time',
defaultValue: '1988-11-05T8:00:00.000+05:00',
name: "dateOnly",
type: "date",
admin: {
date: {
// All config options above should be placed here
pickerAppearance: 'timeOnly',
}
}
}
]
pickerAppearance: "dayOnly",
displayFormat: "d MMM yyy",
},
},
},
{
name: "timeOnly",
type: "date",
admin: {
date: {
pickerAppearance: "timeOnly",
displayFormat: "h:mm:ss a",
},
},
},
{
name: "monthOnly",
type: "date",
admin: {
date: {
pickerAppearance: "monthOnly",
displayFormat: "MMMM yyyy",
},
},
},
],
};
```

View File

@@ -14,8 +14,8 @@ keywords: email, fields, config, configuration, documentation, Content Managemen
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`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. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
@@ -27,6 +27,7 @@ keywords: email, fields, config, configuration, documentation, Content Managemen
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -48,7 +49,7 @@ Set this property to a string that will be used for browser autocomplete.
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -6,28 +6,30 @@ desc: The Group field allows other fields to be nested under a common property.
keywords: group, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The Group field allows fields to be nested under a common property name. It also groups fields together visually in the Admin panel.
<Banner>
The Group field allows fields to be nested under a common property name. It
also groups fields together visually in the Admin panel.
</Banner>
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`fields`** * | Array of field types to nest within this Group. |
| **`label`** | Used as a heading in the Admin panel and to name the generated GraphQL type. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide an object of data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`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 Group will be kept, so there is no need to specify each nested field as `localized`. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| Option | Description |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`fields`** \* | Array of field types to nest within this Group. |
| **`label`** | Used as a heading in the Admin panel and to name the generated GraphQL type. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide an object of data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`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 Group will be kept, so there is no need to specify each nested field as `localized`. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
| **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Admin config
@@ -40,32 +42,35 @@ Set this property to `true` to hide this field's gutter within the admin panel.
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: 'pageMeta', // required
type: 'group', // required
fields: [ // required
name: "pageMeta", // required
type: "group", // required
interfaceName: "Meta", // optional
fields: [
// required
{
name: 'title',
type: 'text',
name: "title",
type: "text",
required: true,
minLength: 20,
maxLength: 100,
},
{
name: 'description',
type: 'textarea',
name: "description",
type: "textarea",
required: true,
minLength: 40,
maxLength: 160,
}
},
],
}
]
},
],
};
```

61
docs/fields/json.mdx Normal file
View File

@@ -0,0 +1,61 @@
---
title: JSON Field
label: JSON
order: 50
desc: The JSON field type will store any string in the Database. Learn how to use JSON fields, see examples and options.
keywords: json, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The JSON field type saves actual JSON in the database, which differs from the Code field that saves the value as a string in the database.
</Banner>
This field uses the `monaco-react` editor syntax highlighting.
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`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. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._
### Admin Config
In addition to the default [field admin config](/docs/fields/overview#admin-config), you can adjust the following properties:
| Option | Description |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`editorOptions`** | Options that can be passed to the monaco editor, [view the full list](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IDiffEditorConstructionOptions.html). |
### Example
`collections/ExampleCollection.ts
```ts
import { CollectionConfig } from 'payload/types';
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
name: 'customerJSON', // required
type: 'json', // required
required: true,
}
]
};
```

View File

@@ -14,10 +14,13 @@ keywords: number, fields, config, configuration, documentation, Content Manageme
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`min`** | Minimum value accepted. Used in the default `validation` function. |
| **`max`** | Maximum value accepted. Used in the default `validation` function. |
| **`hasMany`** | Makes this field an ordered array of numbers instead of just a single number. |
| **`minRows`** | Minimum number of numbers in the numbers array, if `hasMany` is set to true. |
| **`maxRows`** | Maximum number of numbers in the numbers array, if `hasMany` is set to true. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`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. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
@@ -29,6 +32,7 @@ keywords: number, fields, config, configuration, documentation, Content Manageme
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -54,7 +58,7 @@ Set this property to a string that will be used for browser autocomplete.
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -19,7 +19,7 @@ The required `type` property on a field determines what values it can accept, ho
```ts
import { CollectionConfig } from 'payload/types';
const Page: CollectionConfig = {
export const Page: CollectionConfig = {
slug: 'pages',
fields: [
{
@@ -64,6 +64,10 @@ One of the most powerful parts about Payload is its ability for you to define fi
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).
### Field names
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.
### Validation
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.
@@ -72,20 +76,21 @@ There are two arguments available to custom validation functions.
1. The value which is currently assigned to the field
2. An optional object with dynamic properties for more complex validation having the following:
| Property | Description |
| ------------- | -------------|
| `data` | An object of the full collection or global document |
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
| `operation` | Will be "create" or "update" depending on the UI action or API call |
| `id` | The value of the collection `id`, will be `undefined` on create request |
| `user` | The currently authenticated user object |
| `payload` | If the `validate` function is being executed on the server, Payload will be exposed for easily running local operations. |
| Property | Description |
|---------------|--------------------------------------------------------------------------------------------------------------------------|
| `data` | An object of the full collection or global document. |
| `siblingData` | An object of the document data limited to fields within the same parent to the field. |
| `operation` | Will be "create" or "update" depending on the UI action or API call. |
| `id` | The value of the collection `id`, will be `undefined` on create request. |
| `t` | The function for translating text, [more](/docs/configuration/i18n). |
| `user` | The currently authenticated user object. |
| `payload` | If the `validate` function is being executed on the server, Payload will be exposed for easily running local operations. |
Example:
```ts
import { CollectionConfig } from 'payload/types';
const Orders: CollectionConfig = {
export const Orders: CollectionConfig = {
slug: 'orders',
fields: [
{
@@ -150,18 +155,19 @@ Example:
In addition to each field's base configuration, you can define specific traits and properties for fields that only have effect on how they are rendered in the Admin panel. The following properties are available for all fields within the `admin` property:
| Option | Description |
| ------------- | -------------|
| `condition` | You can programmatically show / hide fields based on what other fields are doing. [Click here](#conditional-logic) for more info. |
| `components` | All field components can be completely and easily swapped out for custom components that you define. [Click here](#custom-components) for more info. |
| `description` | Helper text to display with the field to provide more information for the editor user. [Click here](#description) for more info. |
| `position` | Specify if the field should be rendered in the sidebar by defining `position: 'sidebar'`. |
| `width` | Restrict the width of a field. you can pass any string-based value here, be it pixels, percentages, etc. This property is especially useful when fields are nested within a `Row` type where they can be organized horizontally. |
| `style` | Attach raw CSS style properties to the root DOM element of a field. |
| `className` | Attach a CSS class name to the root DOM element of a field. |
| `readOnly` | Setting a field to `readOnly` has no effect on the API whatsoever but disables the admin component's editability to prevent editors from modifying the field's value. |
| `disabled` | If a field is `disabled`, it is completely omitted from the Admin panel. |
| `hidden` | Setting a field's `hidden` property on its `admin` config will transform it into a `hidden` input type. Its value will still submit with the Admin panel's requests, but the field itself will not be visible to editors. |
| Option | Description |
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `condition` | You can programmatically show / hide fields based on what other fields are doing. [Click here](#conditional-logic) for more info. |
| `components` | All field components can be completely and easily swapped out for custom components that you define. [Click here](#custom-components) for more info. |
| `description` | Helper text to display with the field to provide more information for the editor user. [Click here](#description) for more info. |
| `position` | Specify if the field should be rendered in the sidebar by defining `position: 'sidebar'`. |
| `width` | Restrict the width of a field. you can pass any string-based value here, be it pixels, percentages, etc. This property is especially useful when fields are nested within a `Row` type where they can be organized horizontally. |
| `style` | Attach raw CSS style properties to the root DOM element of a field. |
| `className` | Attach a CSS class name to the root DOM element of a field. |
| `readOnly` | Setting a field to `readOnly` has no effect on the API whatsoever but disables the admin component's editability to prevent editors from modifying the field's value. |
| `disabled` | If a field is `disabled`, it is completely omitted from the Admin panel. |
| `disableBulkEdit` | Set `disableBulkEdit` to `true` to prevent fields from appearing in the select options when making edits for multiple documents. |
| `hidden` | Setting a field's `hidden` property on its `admin` config will transform it into a `hidden` input type. Its value will still submit with the Admin panel's requests, but the field itself will not be visible to editors. |
### Custom components
@@ -169,10 +175,11 @@ All Payload fields support the ability to swap in your own React components with
### Conditional logic
You can show and hide fields based on what other fields are doing by utilizing conditional logic on a field by field basis. The `condition` property on a field's admin config accepts a function which takes two arguments:
You can show and hide fields based on what other fields are doing by utilizing conditional logic on a field by field basis. The `condition` property on a field's admin config accepts a function which takes three arguments:
- `data` - the entire document's data that is currently being edited
- `siblingData` - only the fields that are direct siblings to the field with the condition
- `{ user }` - the final argument is an object containing the currently authenticated user
The `condition` function should return a boolean that will control if the field should be displayed or not.
@@ -191,7 +198,7 @@ The `condition` function should return a boolean that will control if the field
type: 'text',
admin: {
// highlight-start
condition: (data, siblingData) => {
condition: (data, siblingData, { user }) => {
if (data.enableGreeting) {
return true;
} else {

View File

@@ -17,7 +17,7 @@ The data structure in the database matches the GeoJSON structure to represent po
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`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`. |
@@ -30,6 +30,7 @@ The data structure in the database matches the GeoJSON structure to represent po
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -39,7 +40,7 @@ The data structure in the database matches the GeoJSON structure to represent po
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -1,5 +1,5 @@
---
title: Radio Field
title: Radio Group Field
label: Radio Group
order: 120
desc: The Radio field type allows for the selection of one value from a predefined set of possible values. Learn how to use Radio fields, see examples and options.
@@ -7,26 +7,27 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
---
<Banner >
The Radio field type allows for the selection of one value from a predefined set of possible values and presents a radio group-style set of inputs to the Admin panel.
The Radio Group field type allows for the selection of one value from a predefined set of possible values and presents a radio group-style set of inputs to the Admin panel.
</Banner>
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`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. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`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. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`defaultValue`** | Provide data to be used for this field's default value. The default value must exist within provided values in `options`. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -37,11 +38,11 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
### Admin config
In addition to the default [field admin config](/docs/fields/overview#admin-config), the Radio field type allows for the specification of the following `admin` properties:
In addition to the default [field admin config](/docs/fields/overview#admin-config), the Radio Group field type allows for the specification of the following `admin` properties:
**`layout`**
The `layout` property allows for the radio group to be styled as a horizonally or vertically distributed list.
The `layout` property allows for the radio group to be styled as a horizonally or vertically distributed list. The default value is `horizontal`.
### Example
@@ -49,7 +50,7 @@ The `layout` property allows for the radio group to be styled as a horizonally o
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
@@ -65,12 +66,11 @@ const ExampleCollection: CollectionConfig = {
value: 'dark_gray',
},
],
defaultValue: 'option_1',
defaultValue: 'mint', // The first value in options.
admin: {
layout: 'horizontal',
}
}
]
}
```

View File

@@ -6,8 +6,9 @@ desc: The Relationship field provides the ability to relate documents together.
keywords: relationship, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The Relationship field is one of the most powerful fields Payload features. It provides for the ability to easily relate documents together.
<Banner>
The Relationship field is one of the most powerful fields Payload features. It
provides for the ability to easily relate documents together.
</Banner>
**Example uses:**
@@ -18,31 +19,36 @@ keywords: relationship, fields, config, configuration, documentation, Content Ma
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`relationTo`** * | Provide one or many collection `slug`s to be able to assign relationships to. |
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-relationship-options). |
| **`hasMany`** | Boolean when, if set to `true`, allows this field to have many relations instead of only one. |
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`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. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| Option | Description |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`relationTo`** \* | Provide one or many collection `slug`s to be able to assign relationships to. |
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-relationship-options). |
| **`hasMany`** | Boolean when, if set to `true`, allows this field to have many relations instead of only one. |
| **`minRows`** | A number for the fewest allowed items during validation when a value is present. Used with `hasMany`. |
| **`maxRows`** | A number for the most allowed items during validation when a value is present. Used with `hasMany`. |
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`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. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
<Banner type="success">
<strong>Tip:</strong><br/>
The <a href="/docs/getting-started/concepts#depth">Depth</a> parameter can be used to automatically populate related documents that are returned by the API.
<strong>Tip:</strong>
<br />
The <a href="/docs/getting-started/concepts#depth">Depth</a> parameter can be
used to automatically populate related documents that are returned by the API.
</Banner>
### Admin config
@@ -51,7 +57,11 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
**`isSortable`**
Set to `true` if you'd like this field to be sortable within the Admin UI using drag and drop. (Only works when `hasMany` is set to `true`)
Set to `true` if you'd like this field to be sortable within the Admin UI using drag and drop (only works when `hasMany` is set to `true`).
**`allowCreate`**
Set to `false` if you'd like to disable the ability to create new documents from within the relationship field (hides the "Add new" button in the admin UI).
### Filtering relationship options
@@ -59,43 +69,55 @@ Options can be dynamically limited by supplying a [query constraint](/docs/queri
The `filterOptions` property can either be a `Where` query directly, or a function that returns one. When using a function, it will be called with an argument object with the following properties:
| Property | Description |
| ------------- | -------------|
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
| `data` | An object of the full collection or global document currently being edited |
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
| `id` | The value of the collection `id`, will be `undefined` on create request |
| `user` | The currently authenticated user object |
| Property | Description |
| ------------- | ------------------------------------------------------------------------------------ |
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
| `data` | An object of the full collection or global document currently being edited |
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
| `id` | The value of the collection `id`, will be `undefined` on create request |
| `user` | The currently authenticated user object |
**Example:**
### Example
```ts
const relationshipField = {
name: 'purchase',
type: 'relationship',
relationTo: ['products', 'services'],
filterOptions: ({ relationTo, siblingData }) => {
// returns a Where query dynamically by the type of relationship
if (relationTo === 'products') {
return {
'stock': { greater_than: siblingData.quantity }
}
}
import { CollectionConfig } from "payload/types";
if (relationTo === 'services') {
return {
'isAvailable': { equals: true }
}
}
},
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: "purchase",
type: "relationship",
relationTo: ["products", "services"],
filterOptions: ({ relationTo, siblingData }) => {
// returns a Where query dynamically by the type of relationship
if (relationTo === "products") {
return {
stock: { greater_than: siblingData.quantity },
};
}
if (relationTo === "services") {
return {
isAvailable: { equals: true },
};
}
},
},
],
};
```
You can learn more about writing queries [here](/docs/queries/overview).
<Banner type="warning">
<strong>Note:</strong><br/>
When a relationship field has both <strong>filterOptions</strong> and a custom <strong>validate</strong> function, the api will not validate <strong>filterOptions</strong> unless you call the default relationship field validation function imported from <strong>payload/fields/validations</strong> in your validate function.
<strong>Note:</strong>
<br />
When a relationship field has both <strong>filterOptions</strong> and a custom{" "}
<strong>validate</strong> function, the api will not validate{" "}
<strong>filterOptions</strong> unless you call the default relationship field
validation function imported from <strong>payload/fields/validations</strong>{" "}
in your validate function.
</Banner>
### How the data is saved
@@ -123,10 +145,10 @@ The most simple pattern of a relationship is to use `hasMany: false` with a `rel
The shape of the data to save for a document with the field configured this way would be:
```json
{
// Mongo ObjectID of the related user
"owner": "6031ac9e1289176380734024"
}
{
// MongoDB ObjectID of the related user
"owner": "6031ac9e1289176380734024"
}
```
When querying documents in this collection via REST API, you could query as follows:
@@ -154,12 +176,12 @@ Also known as **dynamic references**, in this configuration, the `relationTo` fi
The shape of the data to save for a document with more than one relationship type would be:
```json
{
"owner": {
"relationTo": "organizations",
"value": "6031ac9e1289176380734024"
}
{
"owner": {
"relationTo": "organizations",
"value": "6031ac9e1289176380734024"
}
}
```
Here is an example for how to query documents by this data (note the difference in referencing the `owner.value`):
@@ -193,9 +215,9 @@ The `hasMany` tells Payload that there may be more than one collection saved to
To save the to `hasMany` relationship field we need to send an array of IDs:
```json
{
"owners": [ "6031ac9e1289176380734024", "602c3c327b811235943ee12b" ]
}
{
"owners": ["6031ac9e1289176380734024", "602c3c327b811235943ee12b"]
}
```
When querying documents, the format does not change for arrays:
@@ -227,7 +249,8 @@ Relationship fields with `hasMany` set to more than one kind of collections save
{
"relationTo": "users",
"value": "6031ac9e1289176380734024"
}, {
},
{
"relationTo": "organizations",
"value": "602c3c327b811235943ee12b"
}

View File

@@ -20,8 +20,8 @@ The Admin component is built on the powerful [`slatejs`](https://docs.slatejs.or
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
@@ -31,6 +31,7 @@ The Admin component is built on the powerful [`slatejs`](https://docs.slatejs.or
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -54,6 +55,7 @@ The default `elements` available in Payload are:
- `h4`
- `h5`
- `h6`
- `blockquote`
- `link`
- `ol`
- `ul`
@@ -81,17 +83,19 @@ Set this property to `true` to hide this field's gutter within the admin panel.
This allows [fields](/docs/fields/overview) to be saved as extra fields on a link inside the Rich Text Editor. When this is present, the fields will render inside a modal that can be opened by clicking the "edit" button on the link element.
![RichText link fields](https://payloadcms.com/images/fields/richText/rte-link-fields-modal.jpg)
`link.fields` may either be an array of fields (in which case all fields defined in it will be appended below the default fields) or a function that accepts the default fields as only argument and returns an array defining the entirety of fields to be used (thus providing a mechanism of overriding the default fields).
![RichText link fields](https://payloadcms.com/images/docs/fields/richText/rte-link-fields-modal.jpg)
*RichText link with custom fields*
**`upload.collections[collection-name].fields`**
This allows [fields](/docs/fields/overview) to be saved as meta data on an upload field inside the Rich Text Editor. When this is present, the fields will render inside a modal that can be opened by clicking the "edit" button on the upload element.
![RichText upload element](https://payloadcms.com/images/fields/richText/rte-upload-element.jpg)
![RichText upload element](https://payloadcms.com/images/docs/fields/richText/rte-upload-element.jpg)
*RichText field using the upload element*
![RichText upload element modal](https://payloadcms.com/images/fields/richText/rte-upload-fields-modal.jpg)
![RichText upload element modal](https://payloadcms.com/images/docs/fields/richText/rte-upload-fields-modal.jpg)
*RichText upload element modal displaying fields from the config*
### Relationship element
@@ -104,7 +108,7 @@ Similar to the `relationship` element, the `upload` element is a user-friendly w
<Banner type="success">
<strong>Tip:</strong><br/>
Collections are automatically allowed to be selected within the Rich Text relationship and upload elements by default. If you want to disable a collection from being able to be referenced in Rich Text fields, set the collection admin option of <strong>enableRichTextRelationship</strong> to false.
Collections are automatically allowed to be selected within the Rich Text relationship and upload elements by default. If you want to disable a collection from being able to be referenced in Rich Text fields, set the collection admin options of <strong>enableRichTextLink</strong> and <strong>enableRichTextRelationship</strong> to false.
</Banner>
Relationship and Upload elements are populated dynamically into your Rich Text field' content. Within the REST and Local APIs, any present RichText `relationship` or `upload` elements will respect the `depth` option that you pass, and will be populated accordingly. In GraphQL, each `richText` field accepts an argument of `depth` for you to utilize.
@@ -137,7 +141,7 @@ Custom `Leaf` objects follow a similar pattern but require you to define the `Le
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
@@ -153,6 +157,7 @@ const ExampleCollection: CollectionConfig = {
'h3',
'h4',
'link',
'blockquote',
{
name: 'cta',
Button: CustomCallToActionButton,
@@ -270,7 +275,7 @@ const serialize = (children) => children.map((node, i) => {
{serialize(node.children)}
</h6>
);
case 'quote':
case 'blockquote':
return (
<blockquote key={i}>
{serialize(node.children)}
@@ -366,5 +371,4 @@ import type {
RichTextCustomElement,
RichTextCustomLeaf,
} from 'payload/types';
```

View File

@@ -16,6 +16,7 @@ keywords: row, fields, config, configuration, documentation, Content Management
| ---------------- | ----------- |
| **`fields`** * | Array of field types to nest within this Row. |
| **`admin`** | Admin-specific configuration excluding `description`, `readOnly`, and `hidden`. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -25,7 +26,7 @@ keywords: row, fields, config, configuration, documentation, Content Management
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -14,11 +14,11 @@ keywords: select, multi-select, fields, config, configuration, documentation, Co
### Config
| Option | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. |
| ------------------ |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`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. |
| **`hasMany`** | Boolean when, if set to `true`, allows this field to have many selections instead of only one. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`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. |
@@ -30,6 +30,7 @@ keywords: select, multi-select, fields, config, configuration, documentation, Co
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._
@@ -61,7 +62,7 @@ Set to `true` if you'd like this field to be sortable within the Admin UI using
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -6,70 +6,78 @@ desc: The Tabs field is a great way to organize complex editing experiences into
keywords: tabs, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The Tabs field is presentational-only and only affects the Admin panel (unless a tab is named). By using it, you can place fields within a nice layout component that separates certain sub-fields by a tabbed interface.
<Banner>
The Tabs field is presentational-only and only affects the Admin panel (unless
a tab is named). By using it, you can place fields within a nice layout
component that separates certain sub-fields by a tabbed interface.
</Banner>
![Tabs field type used to separate Hero fields from Page Layout](https://payloadcms.com/images/fields/tabs/tabs.jpg)
*Tabs field type used to separate Hero fields from Page Layout*
![Tabs field type used to separate Hero fields from Page Layout](https://payloadcms.com/images/docs/fields/tabs/tabs.jpg)
_Tabs field type used to separate Hero fields from Page Layout_
### Config
| Option | Description |
| ---------------- | ----------- |
| **`tabs`** * | Array of tabs to render within this Tabs field. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| Option | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------------ |
| **`tabs`** \* | Array of tabs to render within this Tabs field. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
#### Tab-specific Config
Each tab has its own required `label` and `fields` array. You can also optionally pass a `description` to render within each individual tab.
| Option | Description |
| ----------------- | ----------- |
| **`name`** | An optional property name to be used when stored and retrieved from the database, similar to a [Group](/docs/fields/group). |
| **`label`** * | The label to render on the tab itself. |
| **`fields`** * | The fields to render within this tab. |
| **`description`** | Optionally render a description within this tab to describe the contents of the tab itself. |
| Option | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`name`** | An optional property name to be used when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** \* | The label to render on the tab itself. |
| **`fields`** \* | The fields to render within this tab. |
| **`description`** | Optionally render a description within this tab to describe the contents of the tab itself. |
| **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). (`name` must be present) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
type: 'tabs', // required
tabs: [ // required
type: "tabs", // required
tabs: [
// required
{
label: 'Tab One Label', // required
description: 'This will appear within the tab above the fields.',
fields: [ // required
label: "Tab One Label", // required
description: "This will appear within the tab above the fields.",
fields: [
// required
{
name: 'someTextField',
type: 'text',
name: "someTextField",
type: "text",
required: true,
},
],
},
{
name: 'tabTwo',
label: 'Tab Two Label', // required
fields: [ // required
name: "tabTwo",
label: "Tab Two Label", // required
interfaceName: "TabTwo", // optional (`name` must be present)
fields: [
// required
{
name: 'numberField', // accessible via tabTwo.numberField
type: 'number',
name: "numberField", // accessible via tabTwo.numberField
type: "number",
required: true,
},
],
}
]
}
]
}
},
],
},
],
};
```

View File

@@ -14,8 +14,8 @@ keywords: text, fields, config, configuration, documentation, Content Management
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`minLength`** | Used by the default validation function to ensure values are of a minimum character length. |
| **`maxLength`** | Used by the default validation function to ensure values are of a maximum character length. |
@@ -29,6 +29,7 @@ keywords: text, fields, config, configuration, documentation, Content Management
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -50,7 +51,7 @@ Set this property to a string that will be used for browser autocomplete.
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -14,8 +14,8 @@ keywords: textarea, fields, config, configuration, documentation, Content Manage
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`minLength`** | Used by the default validation function to ensure values are of a minimum character length. |
| **`maxLength`** | Used by the default validation function to ensure values are of a maximum character length. |
@@ -25,10 +25,11 @@ keywords: textarea, fields, config, configuration, documentation, Content Manage
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) [More](/docs/fields/overview#default-values) |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values)|
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -50,7 +51,7 @@ Set this property to a string that will be used for browser autocomplete.
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -6,8 +6,11 @@ desc: UI fields are purely presentational and allow developers to customize the
keywords: custom field, react component, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The UI (user interface) field gives you a ton of power to add your own React components directly into the Admin panel, nested directly within your other fields. It has absolutely no effect on the data of your documents. It is presentational-only.
<Banner>
The UI (user interface) field gives you a ton of power to add your own React
components directly into the Admin panel, nested directly within your other
fields. It has absolutely no effect on the data of your documents. It is
presentational-only.
</Banner>
This field is helpful if you need to build in custom functionality via React components within the Admin panel. Think of it as a way for you to "plug in" your own React components directly within your other fields, so you can provide your editors with new controls exactly where you want them to go.
@@ -23,34 +26,36 @@ With this field, you can also inject custom `Cell` components that appear as add
### Config
| Option | Description |
| ---------------------------- |-------------------------------------------------------------------------------------------------------------------|
| **`name`** * | A unique identifier for this field. |
| **`label`** | Human-readable label for this UI field. |
| **`admin.components.Field`** | React component to be rendered for this field within the Edit view. [More](/admin/components/#field-component) |
| **`admin.components.Cell`** | React component to be rendered as a Cell within collection List views. [More](/admin/components/#field-component) |
| Option | Description |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | A unique identifier for this field. |
| **`label`** | Human-readable label for this UI field. |
| **`admin.components.Field`** \* | React component to be rendered for this field within the Edit view. [More](/docs/admin/components/#field-component) |
| **`admin.components.Cell`** | React component to be rendered as a Cell within collection List views. [More](/docs/admin/components/#field-component) |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
type: 'ui', // required
name: "myCustomUIField", // required
type: "ui", // required
admin: {
components: {
Field: MyCustomUIField,
Cell: MyCustomUICell,
}
}
}
]
}
},
},
},
],
};
```

View File

@@ -23,24 +23,25 @@ keywords: upload, images media, fields, config, configuration, documentation, Co
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
| **`*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> |
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-relationship-options). |
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
| **`label`** | Used as a field label in the Admin panel and to name the generated GraphQL type. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| Option | Description |
| ---------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`*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> |
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-upload-options). |
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`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. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`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) |
| **`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. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -50,7 +51,7 @@ keywords: upload, images media, fields, config, configuration, documentation, Co
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
@@ -63,3 +64,37 @@ const ExampleCollection: CollectionConfig = {
}
```
### Filtering upload options
Options can be dynamically limited by supplying a [query constraint](/docs/queries/overview), which will be used both for validating input and filtering available uploads in the UI.
The `filterOptions` property can either be a `Where` query directly, or a function that returns one. When using a function, it will be called with an argument object with the following properties:
| Property | Description |
| ------------- | -------------|
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
| `data` | An object of the full collection or global document currently being edited |
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
| `id` | The value of the collection `id`, will be `undefined` on create request |
| `user` | The currently authenticated user object |
**Example:**
```ts
const uploadField = {
name: 'image',
type: 'upload',
relationTo: 'media',
filterOptions: {
mimeType: { contains: 'image' },
},
};
```
You can learn more about writing queries [here](/docs/queries/overview).
<Banner type="warning">
<strong>Note:</strong><br/>
When an upload field has both <strong>filterOptions</strong> and a custom <strong>validate</strong> function, the api will not validate <strong>filterOptions</strong> unless you call the default upload field validation function imported from <strong>payload/fields/validations</strong> in your validate function.
</Banner>

View File

@@ -117,7 +117,7 @@ It is also possible to limit the depth for specific `relation` and `upload` fiel
}
```
If you were to query the Posts endpoint at, say, `http://localhost:3000/api/posts?depth=1`, you will retrieve Posts with populations one level deep. A returned result may look like the following:
If you were to query the Posts endpoint at, say, `http://localhost:3000/api/posts?depth=1`, you will retrieve Posts with populations one level deep. This depth parameter can be thought of as N, where N is the number of levels you want to populate. To populate one level further, you would simply specify N+1 as the depth. A returned result may look like the following:
```
// ?depth=1

View File

@@ -11,11 +11,12 @@ keywords: documentation, getting started, guide, Content Management System, cms,
Payload requires the following software:
- Yarn or NPM
- NodeJS version 10+
- A Mongo Database
- Node.js version 14+
- A MongoDB Database
<Banner type="warning">
Before proceeding any further, please ensure that you have the above requirements met.
Before proceeding any further, please ensure that you have the above
requirements met.
</Banner>
## Quickstart with create-payload-app
@@ -26,16 +27,16 @@ To quickly scaffold a new Payload app in the fastest way possible, you can use [
npx create-payload-app
```
Then just follow the prompts! You can choose between a TypeScript project, which is fully supported by Payload, or a JavaScript project. You'll get set up with a new folder and a functioning Payload app inside.
Then just follow the prompts! You'll get set up with a new folder and a functioning Payload app inside.
## From scratch
## Adding to an existing app
Adding Payload to either a new or existing app is super straightforward. To add to an existing Node + Express app, just run `npm install --save --legacy-peer-deps payload`. Or, to start a new project from scratch, run `npm init` and then `npm install --save --legacy-peer-deps payload express`.
Adding Payload to either a new or existing TypeScript + Express app is super straightforward. To add to an existing app, just run `npm install --save --legacy-peer-deps payload`.
From there, the first step is writing a baseline config. Create a new `payload.config.js` in the root of your project. The simplest config contains the following:
From there, the first step is writing a baseline config. Create a new `payload.config.ts` in your project's `/src` directory (or whatever your root TS dir is). The simplest config contains the following:
```js
import { buildConfig } from 'payload/config';
import { buildConfig } from "payload/config";
export default buildConfig({
// By default, Payload will boot up normally
@@ -46,46 +47,61 @@ export default buildConfig({
Write the above code into your newly created config file. This baseline config will automatically provide you with a default `User` collection. For more information about users and authentication, including how to provide your own user config, jump to the [Authentication](/docs/authentication/config) section.
Although this is just the bare minimum config, there are *many* more options that you can control here. To reference the full config and all of its options, [click here](/docs/configuration/overview).
Although this is just the bare minimum config, there are _many_ more options that you can control here. To reference the full config and all of its options, [click here](/docs/configuration/overview).
### Server
Now that you've got a baseline Payload config, it's time to initialize Payload. It requires an Express server that you provide, so if you're not familiar with how to set up a baseline Express server, please read up on exactly what Express is and why to use it. Express' own [Documentation](https://expressjs.com/en/starter/hello-world.html) is a good place to start. Otherwise, follow along below for how to build your own Express server to use with Payload.
1. Run `npm install --save --legacy-peer-deps express` if you have not done so already
1. Create a new `server.js` file in the root folder of your app
1. Add the following code to `server.js`:
1. Create a new `server.ts` file in the root directory of your app
1. Add the following code to `server.ts`:
```js
const express = require('express');
```ts
import express from "express";
const app = express();
app.listen(3000, async () => {
console.log('Express is now listening for incoming connections on port 3000.')
console.log(
"Express is now listening for incoming connections on port 3000."
);
});
```
This server doesn't do anything just yet. But, after you have this in place, we can initialize Payload via its `init()` method, which accepts a small set of arguments to tell it how to operate. For a full list of `init` arguments, please consult the [main configuration](/docs/configuration/overview#init) docs.
This server doesn't do anything just yet. But, after you have this in place, we can initialize Payload via its asynchronous `init()` method, which accepts a small set of arguments to tell it how to operate.
To initialize Payload, update your `server.js` file to reflect the following code:
To initialize Payload, update your `server.ts` file to reflect the following code:
```js
const express = require('express');
const payload = require('payload');
```ts
import express from "express";
import payload from "payload";
require("dotenv").config();
const app = express();
payload.init({
secret: 'SECRET_KEY',
mongoURL: 'mongodb://localhost/payload',
express: app,
})
const start = async () => {
await payload.init({
secret: process.env.PAYLOAD_SECRET,
mongoURL: process.env.MONGODB_URI,
express: app,
});
app.listen(3000, async () => {
console.log('Express is now listening for incoming connections on port 3000.')
});
app.listen(3000, async () => {
console.log(
"Express is now listening for incoming connections on port 3000."
);
});
};
start();
```
A quick reminder: in this configuration, we're making use of two environmental variables, `process.env.PAYLOAD_SECRET` and `process.env.MONGODB_URI`. Often, it's smart to store these values in an `.env` file at the root of your directory and set different values for each of your environments (local, stage, prod, etc). The `dotenv` package is very handy and works well alongside of Payload. A typical `.env` file will look like this:
```
MONGODB_URI=mongodb://127.0.0.1/your-payload-app
PAYLOAD_SECRET=your-payload-secret
```
Here is a list of all properties available to pass through `payload.init`:
@@ -96,19 +112,21 @@ Here is a list of all properties available to pass through `payload.init`:
##### `secret`
**Required**. This is a secure string that will be used to authenticate with Payload. It can be random but should be at least 14 characters and be very difficult to guess. Often, it's smart to store this value in an `env` and set different values for each of your environments (local, stage, prod, etc). The `dotenv` package is very handy and works well alongside of Payload.
**Required**. This is a secure string that will be used to authenticate with Payload. It can be random but should be at least 14 characters and be very difficult to guess.
Payload uses this secret key to generate secure user tokens (JWT). Behind the scenes, we do not use your secret key to encrypt directly - instead, we first take the secret key and create an encrypted string using the SHA-256 hash function. Then, we reduce the encrypted string to its first 32 characters. This final value is what Payload uses for encryption.
##### `mongoURL`
**Required**. This is a fully qualified MongoDB connection string that points to your Mongo database. If you don't have Mongo installed locally, you can [follow these steps for Mac OSX](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/) and [these steps](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/) for Windows 10. If you want to use a local database and you know you have MongoDB installed locally, a typical connection string will look like this:
**Required**. This is a fully qualified MongoDB connection string that points to your MongoDB database. If you don't have MongoDB installed locally, you can [follow these steps for Mac OSX](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/) and [these steps](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/) for Windows 10. If you want to use a local database and you know you have MongoDB installed locally, a typical connection string will look like this:
`mongodb://localhost/payload`
`mongodb://127.0.0.1/payload`
In contrast to running Mongo locally, a popular option is to sign up for a free [MongoDB Atlas account](https://www.mongodb.com/cloud/atlas), which is a fully hosted and cloud-based installation of Mongo that you don't need to ever worry about.
In contrast to running MongoDB locally, a popular option is to sign up for a free [MongoDB Atlas account](https://www.mongodb.com/cloud/atlas), which is a fully hosted and cloud-based installation of MongoDB that you don't need to ever worry about.
##### `mongoOptions`
Customize Mongo connection options. Payload will connect to your MongoDB database using default options which you can override and extend to include all the [options](https://mongoosejs.com/docs/connections.html#options) available to mongoose.
Customize MongoDB connection options. Payload will connect to your MongoDB database using default options which you can override and extend to include all the [options](https://mongoosejs.com/docs/connections.html#options) available to mongoose.
##### `email`
@@ -128,6 +146,10 @@ A function that is called immediately following startup that receives the Payloa
### Test it out
After you've gotten this far, it's time to boot up Payload. At the command line, run `npm install` and then `node server.js` in your application's folder to start up your app and initialize Payload.
After you've gotten this far, it's time to boot up Payload. Start your project in your application's folder to get going.
After it starts, you can go to `http://localhost:3000/admin` to create your first Payload user!
### Docker
Looking to deploy Payload with Docker? New projects with `create-payload-app` come with a Dockerfile and docker-compose.yml file ready to go. Examples of these files can be seen in our [Deployment docs](/docs/production/deployment#docker).

View File

@@ -8,7 +8,7 @@ keywords: documentation, getting started, guide, Content Management System, cms,
<YouTube
id="In_lFhzmbME"
title="Payload CMS Introduction - Closing the Gap Between Headless CMS and Application Frameworks"
title="Payload Introduction - Closing the Gap Between Headless CMS and Application Frameworks"
/>
<Banner type="success">
@@ -19,7 +19,7 @@ keywords: documentation, getting started, guide, Content Management System, cms,
Out of the box, Payload gives you a lot of the things that you often need when developing a new website, web app, or native app:
- A Mongo database to store your data
- A MongoDB database to store your data
- A way to store, retrieve, and manipulate data of any shape via full REST and GraphQL APIs
- Authentication—complete with commonly required functionality like registration, email verification, login, & password reset
- Deep access control to your data, based on document or field-level functions
@@ -48,7 +48,7 @@ The team behind Payload has been building websites and apps with existing conten
- Secure
- Fully flexible and extensible
Payload is our silver bullet solution. It represents over two years of passionate development and brings everything we need when we build new apps and websites:
Payload is our silver bullet solution. We've blended the best parts of our experience with other CMS and app frameworks into Payload, and we finally have everything we need when we build new apps and websites:
- A beautiful, dynamic, customizable admin UI
- Extensible and reusable authentication

View File

@@ -53,13 +53,13 @@ export default buildConfig({
type: GraphQL.GraphQLFloat,
},
},
args: {
argNameHere: {
type: new GraphQL.GraphQLNonNull(GraphQLString),
}
},
resolve: myCustomQueryResolver,
})
}),
args: {
argNameHere: {
type: new GraphQL.GraphQLNonNull(GraphQLString),
}
},
resolve: myCustomQueryResolver,
}
}
}
@@ -67,3 +67,90 @@ export default buildConfig({
}
})
```
### Resolver function
In your resolver, make sure you set `depth: 0` if you're returning data directly from the local API so that GraphQL can correctly resolve queries to nested values such as relationship data.
Your function will receive four arguments you can make use of:
Example
```ts
async (obj, args, context, info) => { }
```
**`obj`**
The previous object. Not very often used and usually discarded.
**`args`**
The available arguments from your query or mutation will be available to you here, these must be configured via the custom operation first.
**`context`**
An object containing the `req` and `res` objects that will provide you with the `payload`, `user` instances and more, like any other Payload API handler.
**`info`**
Contextual information about the currently running GraphQL operation. You can get schema information from this as well as contextual information about where this resolver function is being run.
### Types
We've exposed a few types and utilities to help you extend the API further. Payload uses the GraphQL.js package for which you can view the full list of available types in the [official documentation](https://graphql.org/graphql-js/type/).
**`GraphQL`**
You can directly import the GraphQL package used by Payload, most useful for typing. For queries, mutations and handlers make sure you use the `GraphQL` and `payload` instances provided via arguments.
**`buildPaginatedListType`**
This is a utility function that allows you to build a new GraphQL type for a paginated result similar to the Payload's generated schema.
It takes in two arguments, the first for the name of this new schema type and the second for the GraphQL type to be used in the docs parameter.
Example
```ts
export const getMyPosts = (GraphQL, payload) => {
return {
args: {},
resolve: Resolver,
// The name of your new type has to be unique
type: buildPaginatedListType('AuthorPosts', payload.collections['posts'].graphQL?.type),
}
}
```
**`payload.collections.slug.graphQL`**
If you want to extend more of the provided API then the `graphQL` object on your collection slug will contain additional types to help you re-use code for types, mutations and queries.
```ts
graphQL?: {
type: GraphQLObjectType
paginatedType: GraphQLObjectType
JWT: GraphQLObjectType
versionType: GraphQLObjectType
whereInputType: GraphQLInputObjectType
mutationInputType: GraphQLNonNull<any>
updateMutationInputType: GraphQLNonNull<any>
}
```
### Best practices
There are a few ways to structure your code, we recommend using a dedicated `graphql` directory so you can keep all of your logic in one place. You have total freedom of how you want to structure this but a common pattern is to group functions by type and with their resolver.
Example
```
src/graphql
---- queries/
index.ts
-- myCustomQuery/
index.ts
resolver.ts
---- mutations/
```

Some files were not shown because too many files have changed in this diff Show More