Compare commits

..

811 Commits

Author SHA1 Message Date
James
f361a44cca chore(release): v0.16.3 2022-05-04 11:20:47 -04:00
James
47c37e0153 fix: rare bug while merging locale data 2022-05-04 11:18:52 -04:00
James
5df3b35189 chore(release): v0.16.2 2022-05-02 13:44:31 -04:00
Elliot DeNolf
1e4a68f76e fix: checkbox defaultValues and more typing of sanitize (#550) 2022-05-02 13:42:56 -04:00
James
b3832e21c9 feat: exposes findMany argument to afterRead hooks to discern between find and findByID 2022-05-02 13:38:13 -04:00
James Mikrut
18489faceb feat: optimizes field operations
* wip: beforeChange field op pattern

* feat: optimizes field-level beforeChange

* feat: optimizes beforeValidate

* feat: optimizes afterChange

* feat: optimizes afterRead

* chore: comment accuracy
2022-05-02 12:46:52 -04:00
Dan Ribbens
69d328d15e docs: updated link 2022-04-29 23:29:46 -04:00
Dan Ribbens
738e8ab9b6 docs: preventing abuse of file uploads 2022-04-29 23:25:55 -04:00
Elliot DeNolf
e7349fea9a chore: add explicit release scripts 2022-04-29 20:21:01 -04:00
James
51a6790f26 chore(release): v0.16.1 2022-04-29 18:34:40 -04:00
James
515f20372e chore: passing tests 2022-04-29 18:30:40 -04:00
James
12fbe8368f Merge branch 'fix/localization-defaultvalues' of github.com:payloadcms/payload 2022-04-29 16:49:17 -04:00
Dan Ribbens
55b4dfb309 chore: test defaultValue with localization 2022-04-29 16:48:50 -04:00
James
fb7bb76674 Merge branch 'master' of github.com:payloadcms/payload 2022-04-29 16:48:24 -04:00
James
e46b942259 feat: exposes payload within server-side validation args 2022-04-29 16:48:15 -04:00
Dan Ribbens
e4affd4bf9 docs: updated links 2022-04-29 14:40:49 -04:00
Dan Ribbens
16398d3438 chore(release): v0.16.0 2022-04-29 13:19:34 -04:00
Dan Ribbens
e8503232ba chore: changes eslint rules no-console and cleanup 2022-04-29 12:36:21 -04:00
Dan Ribbens
bf48fdf189 fix: file upload safely handles missing mimeTypes (#540)
* fix: file upload safely handles missing mimeTypes

* feat: uploaded files that do not have mimeTypes are given one based on file extension
2022-04-29 10:36:58 -04:00
Dan Ribbens
834f4c2700 feat: allow subfield readOnly to override parent readOnly (#546) 2022-04-29 10:36:38 -04:00
Dan Ribbens
e297eb9090 feat: allows defaultValue to accept async function to calculate defaultValue (#547)
* feat: field default values with async functions

* docs: improves field default value

* chore: simplifies async defaultValue

* chore: api test coverage for default value functions

* chore: WIP defaultValue async arrays

* chore: refactors and simplifies buildStateFromSchema

* chore: improves tests for defaultValues

Co-authored-by: James <james@trbl.design>
2022-04-29 10:36:10 -04:00
James
1f394bef72 chore(release): v0.15.13 2022-04-26 10:21:55 -04:00
James
1cdd5b96b3 chore: ensures array fields update modified state 2022-04-26 10:19:39 -04:00
James
2d14ab1217 chore(release): v0.15.12 2022-04-25 21:02:31 -04:00
James
8bdbd0dd41 fix: ensures adding array / block rows modifies form state 2022-04-25 20:59:33 -04:00
James
800be4c9a0 chore(release): v0.15.11 2022-04-24 19:37:39 -04:00
James
b99ec060ca fix: improperly typed access control 2022-04-24 19:35:58 -04:00
James
d5f4c030b4 chore(release): v0.15.10 2022-04-24 19:19:41 -04:00
James
4de92e3924 Merge branch 'master' of github.com:payloadcms/payload 2022-04-24 19:16:48 -04:00
James
3b70560e25 fix: block form-data bug 2022-04-24 19:16:39 -04:00
Dan Ribbens
d88c89fb05 chore: update discord invite link 2022-04-24 10:24:37 -04:00
Dan Ribbens
24d6d8e5f9 chore: add public discord link (#541) 2022-04-22 14:35:39 -04:00
Elliot DeNolf
9a9b28113a test: implement cypress test suite (#527) 2022-04-20 23:12:02 -04:00
James
ec84ffbee2 chore(release): v0.15.9 2022-04-20 17:25:20 -04:00
James
3c1dfb88df fix: intermittent blocks UI issue 2022-04-20 17:20:05 -04:00
James
4a6b79b231 chore(release): v0.15.8 2022-04-20 13:53:52 -04:00
James
9e2ed56ef0 chore: migrates to React 18 2022-04-20 11:29:09 -04:00
Alessio Gravili
9e324be057 fix: ensure relationTo is valid in upload fields (#533)
* Error handling

* Improve error message

* Re-position error handling

* Move error checking to sanitize
2022-04-20 09:21:14 -04:00
James Mikrut
b7f47c9bb1 chore/ts dep compat (#535)
* chore: ensures typescript dependency compatibility

* chore: updates dependencies

* chore: updates window-info breakpoints
2022-04-20 09:16:36 -04:00
Dan Ribbens
8a997c82be chore: github action runs demo generate types (#530) 2022-04-17 10:59:32 -04:00
Dan Ribbens
3dcd8a24cb fix: richtext editor input height (#529) 2022-04-17 10:56:33 -04:00
Dan Ribbens
203ce2c2f9 chore: update changelog 2022-04-12 11:50:27 -04:00
Dan Ribbens
42e42175db chore(release): v0.15.7 2022-04-12 11:41:04 -04:00
Dan Ribbens
6f84c0a869 Fix/checkbox validation error position (#521)
* fix: checkbox validation error positioning

* feat: sanitize defaultValue to false when field is required
2022-04-12 11:28:41 -04:00
Dan Ribbens
a4f2c5abd4 chore: update react 18 (#520)
* chore: update to react 18 and related dependencies
2022-04-12 11:26:55 -04:00
Dan Ribbens
6b06fe4481 chore: update react-toastify to 8.x (#522) 2022-04-12 11:26:20 -04:00
Outdated
1fc856faf5 Document Fix for admin/customizing-css (#513)
Addition of node package 'sass-loader' & 'node-sass' as dev dependencies for loading scss for customizing css variables for admin panel.
2022-04-11 17:03:48 -04:00
Dan Ribbens
6e45fd67ce docs: anchor link field component 2022-04-11 10:54:13 -04:00
Dan Ribbens
39415d4eed docs: update anchor links (#518) 2022-04-11 09:31:46 -04:00
John Beene
801b20ae75 Update fields.mdx (#509)
Fix destructuring of args inside exampleFieldHook function
2022-04-07 05:37:04 -04:00
Dan Ribbens
f564402565 chore(release): v0.15.6 2022-04-06 10:25:38 -04:00
Dan Ribbens
0156812af3 chore: generates new demo types 2022-04-06 10:23:48 -04:00
Elliot DeNolf
cf54b336d1 fix: new up separate logger for generateTypes script 2022-04-06 10:08:51 -04:00
Dan Ribbens
096303a93d chore(release): v0.15.5 2022-04-06 07:48:05 -04:00
Dan Ribbens
e1c6d9dd7d fix: relationship component showing no results (#508) 2022-04-06 07:44:30 -04:00
James
ed80d398ea chore: changelog 2022-04-05 16:30:46 -04:00
James
b4ce6ff4b0 chore(release): v0.15.4 2022-04-05 16:30:02 -04:00
James
ec91757257 feat: allows like to search by many words, adds contain to match exact strings 2022-04-05 16:22:57 -04:00
James
b99f6b16af fix: maintains field validation internally for speed 2022-04-05 15:29:03 -04:00
James
9dfb84656d chore: re-implements validation as user types 2022-04-05 15:21:47 -04:00
James
629e63e123 docs: relationship clarity 2022-04-05 15:15:43 -04:00
James
b4131800c9 Merge branch 'master' of github.com:payloadcms/payload 2022-04-05 14:59:09 -04:00
James
aee95eb041 merge: relationship options filter 2022-04-05 14:59:01 -04:00
GeorgeyB
0461c2109b feat: support className config for row, block and array fields (#504) 2022-04-05 14:55:50 -04:00
James
9e9aa6485c docs: payload.init accuracy 2022-04-05 14:55:29 -04:00
James
0651936856 Merge branch 'feat/logger-options' of github.com:payloadcms/payload 2022-04-05 14:51:57 -04:00
James Mikrut
1b4b5707bf feat: extended validation function arguments (#494)
* feat: WIP extended validation function arguments

* chore: optimizes validation extended args

* chore: more consistently passes validation args

* chore: removes field from form state

* chore: passing tests

* fix: default point validation allows not required and some edge cases

* chore: ensures default validate functions receive field config

* chore: demo validation with sibling data

* chore: optimize getDatabByPath and getSiblingData

* chore: adds tests to validate extra arg options

* docs: add validation arguments

* chore: export default field validation

* chore: top level getSiblingData

* fix: #495, avoids appending version to id queries

* chore: revises when field validation is run

* chore: restore original admin field validation

Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2022-04-05 14:51:28 -04:00
Dan Ribbens
89d56a0886 chore: test coverage for relationship filteroptions 2022-04-05 12:21:45 -04:00
Dan Ribbens
1482fded9a feat: upload field implements filterOptions 2022-04-05 12:03:57 -04:00
Elliot DeNolf
6620a4f682 feat(logging): allow pino logger options to be passed into init 2022-04-04 22:55:54 -04:00
James
df934dfeff feat: working PoC for reusing relationship filters in validate 2022-04-04 21:20:21 -04:00
Dan Ribbens
485991bd48 feat: filter relationship options in admin ui using filterOptions 2022-04-04 19:44:49 -04:00
James
1d4d30ce8f chore: revises when field validation is run 2022-04-04 17:07:24 -04:00
James
6c00c2a113 Merge branch 'feat/validate-extended-args' of github.com:payloadcms/payload into feat/validate-extended-args 2022-04-04 15:30:01 -04:00
James
57b5f17bf4 Merge branch 'master' into feat/validate-extended-args 2022-04-04 15:29:31 -04:00
James
bb3080aef7 chore(release): v0.15.3 2022-04-04 15:11:50 -04:00
James
f4a2dff892 fix: #499, graphql row / ui field bug 2022-04-04 15:09:56 -04:00
James
fa7f234b48 chore(release): v0.15.2 2022-04-04 13:59:36 -04:00
James
6f05fe80ae Merge branch 'master' of github.com:payloadcms/payload 2022-04-04 13:57:10 -04:00
James
a703e0582d fix: #495, avoids appending version to id queries 2022-04-04 13:56:09 -04:00
James
ab432a43dc fix: #495, avoids appending version to id queries 2022-04-04 13:54:02 -04:00
Elliot DeNolf
839e3f9dae test: fix all ts errors, eslint overrides 2022-04-03 23:40:29 -04:00
Elliot DeNolf
9c6af860d4 test: migrate test files to ts 2022-04-03 23:40:29 -04:00
Dan Ribbens
845b0b3709 chore: top level getSiblingData 2022-04-01 11:34:13 -04:00
Dan Ribbens
85596bbba6 chore: export default field validation 2022-04-01 10:58:08 -04:00
Dan Ribbens
9ea2777555 docs: add validation arguments 2022-03-31 01:00:52 -04:00
Dan Ribbens
c7eb929176 chore: adds tests to validate extra arg options 2022-03-30 18:06:05 -04:00
Dan Ribbens
42baf2e27e chore: optimize getDatabByPath and getSiblingData 2022-03-30 17:04:26 -04:00
Dan Ribbens
dade960615 chore: demo validation with sibling data 2022-03-30 15:32:58 -04:00
Dan Ribbens
80de7a720f Merge branch 'feat/validate-extended-args' of github.com:payloadcms/payload into feat/validate-extended-args 2022-03-30 15:00:29 -04:00
James
175642c07b chore: ensures default validate functions receive field config 2022-03-30 15:00:19 -04:00
Dan Ribbens
29405bbc0e fix: default point validation allows not required and some edge cases 2022-03-30 12:12:59 -04:00
James
60f295ba9f chore: passing tests 2022-03-29 18:37:02 -04:00
James
2b1a33efba chore: removes field from form state 2022-03-29 17:57:10 -04:00
James
f5191dc7c8 chore: more consistently passes validation args 2022-03-29 15:38:22 -04:00
James
e597b4c66b chore: optimizes validation extended args 2022-03-29 14:11:22 -04:00
James
50cf34ac2e Merge branch 'feat/validate-extended-args' of github.com:payloadcms/payload into feat/validate-extended-args 2022-03-29 10:41:10 -04:00
James
b3a7c16f8e chore(release): v0.15.1 2022-03-28 15:01:40 -04:00
Dan Ribbens
647cac3612 feat: WIP extended validation function arguments 2022-03-28 12:58:39 -04:00
Dan Ribbens
5a7e8a980b feat: builds a way to inject custom React providers into admin UI
* fix: rich text textarea height

* feat: custom providers for admin panel

* docs: custom provider component
2022-03-28 11:23:22 -04:00
Lukas Chladek
45f70114e6 feat: export Plugin type from config types (#491)
This type is useful for plugin authors to correctly type their plugin.
2022-03-28 11:22:33 -04:00
Dan Ribbens
f442552858 chore: add security readme (#489) 2022-03-24 21:14:17 -04:00
Dan Ribbens
483e8934c9 Merge branch 'master' of github.com:payloadcms/payload 2022-03-17 11:38:28 -04:00
Dan Ribbens
dc9898e355 docs: remove versions payload beta version 2022-03-17 11:38:11 -04:00
James
2b71144015 chore: changelog 2022-03-16 15:30:16 -04:00
James
9b17b5c08c chore(release): v0.15.0 2022-03-16 15:03:22 -04:00
Dan Ribbens
647db5122e feat: add pagination argument to optimize graphql relationships and use in local api (#482) 2022-03-16 14:58:41 -04:00
Dan Ribbens
ad98b29398 feat: adds path to GraphQL errors (#457)
* feat: adds path to GraphQL errors

* feat: afterError hook complete and error handling types

* Revert "feat: afterError hook complete and error handling types"

This reverts commit 5517d16c58f516fd4663b1bff791dd7c78b1e721.

* fix: moves extra graphql error response to extensions
2022-03-16 13:11:30 -04:00
Dan Ribbens
ba1a8284ac docs: init options for email, local, and onInit (#474) 2022-03-16 13:10:45 -04:00
Dan Ribbens
26dbebb380 chore: improve test coverage for upload relationship (#475) 2022-03-16 13:10:22 -04:00
Dan Ribbens
f14e187545 feat: allow empty string radio and select option values (#479) 2022-03-16 13:09:37 -04:00
Jarrod Flesch
8fc4f7f806 fix: adjusts lte and gte types to match docs and codebase (#480) 2022-03-16 13:08:45 -04:00
Dan Ribbens
24aa475640 fix: further sanitize serverURL to prevent undefined in admin routes (#481) 2022-03-16 13:08:11 -04:00
James
0bfc589d47 chore: beta release 2022-03-10 10:02:34 -05:00
James
97f3178005 fix: ensures overrideAccess is false if undefined while populating 2022-03-10 09:49:01 -05:00
James
73f418bb5c feat: exposes data arg within create and update access control 2022-03-08 14:42:47 -05:00
James
7e5eeef122 chore: revises logic used to determine if hasWhereAccessResult 2022-03-08 14:42:28 -05:00
James
aee86c6136 chore: beta release 2022-03-07 10:56:21 -05:00
James
c9795133b3 feat: adds originalDoc to field access control 2022-03-07 10:53:57 -05:00
James
561c43c564 chore: beta release 2022-03-07 10:28:08 -05:00
James
f5535f613a fix: rare crash with link rte element 2022-03-07 10:23:50 -05:00
James
2e9a4c7d71 feat: improves rich text link 2022-03-03 16:29:38 -05:00
James
966c3c6471 feat: improves adding rich text voids to RTE 2022-03-03 15:17:02 -05:00
James
c75054f562 chore: beta release 2022-03-01 19:46:00 -05:00
James
fd0629e932 fix: #464, graphql upload access control 2022-03-01 19:44:03 -05:00
James
bddb65a7a1 chore: beta release 2022-03-01 19:43:33 -05:00
James
8e23a24f34 feat: #458, provides field hooks with sibling data 2022-03-01 18:57:17 -05:00
James
82f0beffce chore: beta release 2022-02-24 10:02:57 -05:00
James
f225ad349d Merge branch 'fix/csrf-no-server-url' of github.com:payloadcms/payload into fix/461-searching-relationship-fields 2022-02-23 16:31:16 -05:00
Dan Ribbens
7e69fcbc7d fix: optimizes relationship input search querying 2022-02-23 14:43:33 -05:00
Dan Ribbens
cbf43fa0d8 fix: prevents None from appearing in hasMany relationship select options 2022-02-23 14:42:01 -05:00
James
bac2a0a0bf chore: cleanup 2022-02-23 09:41:56 -05:00
James
08924a1934 fix: #461 2022-02-23 09:40:54 -05:00
James
cfca6d67f1 chore: type cleanup 2022-02-23 08:16:13 -05:00
Oran Epelbaum
a9b83c8798 fix: #459 - in Relationship field to multiple collections, when the value is null, options are not populated (#460) 2022-02-23 08:05:17 -05:00
James
96a9b75558 chore: cleans up comments 2022-02-20 12:42:05 -05:00
James
d03bda9e87 chore: beta release 2022-02-20 12:27:55 -05:00
James
08b3e8f18f fix: ensures empty hasMany relationships save as empty arrays 2022-02-20 12:22:42 -05:00
Dan Ribbens
40487347e3 fix: allow jwt to work without csrf in config 2022-02-16 12:35:17 -05:00
James
56c16d5c16 fix: #454, withCondition type usability 2022-02-15 12:52:11 -05:00
James
0e5cff1923 chore: beta release 2022-02-14 16:04:22 -05:00
Dan Ribbens
99b9afc81c chore: version documentation for local and graphql apis 2022-02-14 15:50:04 -05:00
Dan Ribbens
4072e7ee06 feat: add local api for versions on globals 2022-02-14 15:50:04 -05:00
Dan Ribbens
85221e6109 chore: add type for collection graphQL 2022-02-14 12:35:07 -05:00
Dan Ribbens
7e7b0589ef fix: config empty and sparse csrf is now allowed 2022-02-14 12:34:09 -05:00
James
c1e4515562 chore: releases beta 2022-02-13 19:11:49 -05:00
James
c9fda13e61 chore: passing global graphql tests 2022-02-13 19:05:21 -05:00
James
2db80d2af8 Merge branch 'feat/graphql-versions' of github.com:payloadcms/payload 2022-02-13 18:20:11 -05:00
Dan Ribbens
76077c539d WIP: globals graphql versions 2022-02-13 17:34:22 -05:00
Dan Ribbens
a5c8ea4e2e fix: version where input type 2022-02-11 15:50:42 -05:00
James
fa8a6b769b chore: simplifies buildVersionWhereInput 2022-02-11 15:00:16 -05:00
James
8422d0dfda Merge branch 'feat/graphql-versions' of github.com:payloadcms/payload into feat/graphql-versions 2022-02-11 14:50:48 -05:00
Dan Ribbens
fc24485455 fix: improves version config sanitization 2022-02-11 14:22:10 -05:00
Dan Ribbens
407bc35a31 chore: rename buildInputObject to withWhereAndOr 2022-02-11 13:45:27 -05:00
Dan Ribbens
26b13a81c3 feat: improve code coverage for graphql versions 2022-02-11 13:39:17 -05:00
James
d65e856ada docs: improves versions heading hierarchy 2022-02-11 12:09:21 -05:00
James
c0150ae846 feat: allows global access control to return query constraints 2022-02-11 11:35:55 -05:00
James
cc4dc59aa9 docs: completes version docs 2022-02-11 11:25:18 -05:00
Dan Ribbens
dca90c4aa9 feat: serverURL is no longer required (#437) 2022-02-11 08:32:37 -05:00
Jacob Fletcher
500fb1c5c4 feat: allows select input to receive new options (#435) 2022-02-10 18:43:20 -05:00
James
6fab8bfbef fix: #431 - relationship field not properly fetching option results 2022-02-10 18:23:40 -05:00
Dan Ribbens
b159e148db chore: rename publishVersion to restoreVersion (#438) 2022-02-10 16:35:03 -05:00
Dan Ribbens
7cfb2f7f02 feat: GraphQL version collection resolvers 2022-02-10 15:23:39 -05:00
Dan Ribbens
ee58471aed WIP: graphql revisions operations 2022-02-10 15:09:08 -05:00
James
48aa27ce70 fix: improperly typed local create method 2022-02-10 14:52:58 -05:00
James
13318ff360 feat: improves relationship field performance 2022-02-10 14:52:35 -05:00
James
964cbe1899 chore: adds comparison to most recently published doc 2022-02-10 12:11:59 -05:00
James
d15c48429b chore: improves version count accuracy 2022-02-10 11:17:19 -05:00
James
6e57040aaf chore: ensures version comparison does not allow to compare same version to itself 2022-02-09 18:04:21 -05:00
James
756981172f fix: ensures VersionCount is accurate 2022-02-09 18:00:54 -05:00
James
6898d6151b chore: fixes DocumentInfo types 2022-02-09 16:38:28 -05:00
James
a9b2f7f3f3 chore: improves copy on Versions view 2022-02-09 16:28:10 -05:00
James
e81ba84ca7 feat: improves versions UI count and list view 2022-02-09 16:23:39 -05:00
James
e2814b5404 chore: swaps placement of version comparisons 2022-02-09 13:56:08 -05:00
James
eaa4858580 docs: progress to versions 2022-02-09 13:26:44 -05:00
James
652bd4ab23 chore: cleans up duplicative versions 2022-02-09 13:26:20 -05:00
James
e2662336b1 chore: removes console log 2022-02-08 19:18:05 -05:00
James
d7b669d404 chore: simplifies array / block field components 2022-02-08 19:04:37 -05:00
James
760dee370f chore: improves opt-in viability for versions 2022-02-08 18:23:14 -05:00
James
f710b8c4f3 fix: adds key to RichText based on initialValue 2022-02-08 17:50:27 -05:00
James
4e773c7152 feat: optimization of unpublish, revert to saved 2022-02-08 17:44:39 -05:00
James
160ab54b85 feat: builds revert to saved, unpublish 2022-02-08 13:13:43 -05:00
James
7841f2a86b fix: ensures fetching published doc only retrieves published docs 2022-02-08 11:54:25 -05:00
James
ee9cd24e10 feat: uses debounce in autosave 2022-02-08 11:46:39 -05:00
James
eb4f9572b8 feat: implements versions in global ui 2022-02-08 11:15:26 -05:00
James
a59b14bd8c feat: implements versions in globals, adds tests 2022-02-07 17:46:51 -05:00
James
86890a2de4 tests: fixes outdated test 2022-02-07 16:44:56 -05:00
James
03c8445a6d fix: removes required from versions status field 2022-02-07 16:16:49 -05:00
James
c5854afb37 docs: stubs version docs 2022-02-07 16:16:38 -05:00
James
0ecd9ff0cb chore: optimizes demo and version operations 2022-02-07 16:11:19 -05:00
James
7397d63073 feat: builds global publishVersion 2022-02-06 20:34:52 -05:00
James
4656381205 Merge branch 'master' of github.com:payloadcms/payload 2022-02-06 15:02:19 -05:00
James
c286e757b3 docs: adds legacy-peer-deps to docs 2022-02-06 15:01:54 -05:00
James
3ca3f533d0 feat: updates dependencies 2022-02-06 14:57:56 -05:00
James
c38470c7b2 feat: allows access control to prevent reading of drafts 2022-02-06 14:46:34 -05:00
James
6dffeeb06f feat: initial drafts and versions merge 2022-02-06 12:13:52 -05:00
Elliot DeNolf
c8ecc168e2 chore: beta release 2022-02-05 13:44:38 -05:00
Elliot DeNolf
ff33453736 feat: add logMockCredentials email option 2022-02-05 13:28:48 -05:00
James
a657c584fc chore: beta release 2022-02-03 12:33:21 -05:00
James
414679d86a fix: #422, prevents loading duplicative relationship options 2022-02-03 12:30:28 -05:00
James
ac4e5985d9 docs: elaborate on safe payload.config re-use, references #416 2022-02-03 12:19:42 -05:00
James
99fea79710 chore: beta release 2022-02-03 12:09:46 -05:00
James
417e83cf71 chore: cleans up _payload from req.body 2022-02-03 12:07:18 -05:00
James
1a05fe448c fix: #424, unable to clear localized property vals 2022-02-03 12:07:05 -05:00
James
28846547af fix: #423, #391 - prevents loading edit views until data initializes 2022-02-03 11:49:15 -05:00
James
7fd4b22180 chore: ensures locale is initiated properly if present in query param 2022-02-03 11:47:21 -05:00
James
5681a2793d chore: cleanup textarea 2022-02-03 11:47:08 -05:00
James
3f538cb818 chore: beta release 2022-02-01 09:47:40 -05:00
James
9dc11b2b83 chore: rich text upload cleanup 2022-02-01 09:45:43 -05:00
James
bef02062e7 feat: exposes useLocale for reuse 2022-02-01 09:33:23 -05:00
James
9a393fa974 chore: beta release 2022-01-31 21:41:02 -05:00
James
72d1099085 chore: beta release 2022-01-31 21:33:49 -05:00
Dan Ribbens
5591eeafca feat: add before and after login components (#427) 2022-01-31 21:26:12 -05:00
James
0a6349e323 chore: beta release 2022-01-31 10:29:34 -05:00
James
dbb3c50222 feat: adds a way to customize express.static options 2022-01-31 10:27:26 -05:00
James
c97cbeb6fd chore: beta release 2022-01-24 22:50:28 -05:00
James
43fb317812 chore: removes unused form stringify functionality 2022-01-24 22:45:26 -05:00
James
89fca20a44 chore: beta release 2022-01-24 18:09:29 -05:00
Jarrod Flesch
8327b5aae5 fix: rte upload field population 2022-01-24 18:07:04 -05:00
James
8451233f95 chore: beta release 2022-01-24 12:13:27 -05:00
James
39438b8460 fix: ensures rte upload is populated when only upload is enabled 2022-01-24 12:11:05 -05:00
James
d887b6bdc5 chore: beta release 2022-01-24 10:50:27 -05:00
James
671077669e chore: removes stubbed test 2022-01-21 16:58:07 -05:00
James
a0efa25616 feat: improvements to rte upload 2022-01-21 16:56:24 -05:00
James
bf142ff746 chore: beta release 2022-01-21 16:46:56 -05:00
Jarrod Flesch
c8b00206d9 style: adjusts style of nested RTE inside edit fields 2022-01-21 15:38:06 -05:00
Jarrod Flesch
0e4eb906f2 feat: enhances rich text upload with custom field API
* feat: adds admin.upload.collections[collection-name].fields to the RTE to save specific data on upload elements

* chore: renames flatten to unflatten in reduceFieldsToValues, disables automatic arrow function return in eslint

* docs: adds documentation for upload.collections[collection-name].fields feature

* feat: adds recursion to richText field to populate relationship and upload nested fields

* chore: removes unused css

* fix: import path for createRichTextRelationshipPromise

* docs: updates docs to include images for the RTE upload docs
2022-01-21 10:15:51 -05:00
Jarrod Flesch
d54d511133 docs: updates docs to include images for the RTE upload docs 2022-01-19 17:37:29 -05:00
Jarrod Flesch
586cd4d6af fix: import path for createRichTextRelationshipPromise 2022-01-19 16:55:51 -05:00
Jarrod Flesch
1e6295a788 chore: removes unused css 2022-01-19 16:44:42 -05:00
Jarrod Flesch
42af22c2a1 feat: adds recursion to richText field to populate relationship and upload nested fields 2022-01-19 15:29:00 -05:00
Jarrod Flesch
e76f7c88a5 docs: adds documentation for upload.collections[collection-name].fields feature 2022-01-19 11:42:18 -05:00
Jarrod Flesch
f8af99b058 chore: renames flatten to unflatten in reduceFieldsToValues, disables automatic arrow function return in eslint 2022-01-19 11:22:27 -05:00
Jarrod Flesch
3adf44a241 feat: adds admin.upload.collections[collection-name].fields to the RTE to save specific data on upload elements 2022-01-19 11:21:08 -05:00
James
d07bb932ca chore: beta release 2022-01-14 12:15:54 -05:00
James
609b871fa2 fix: awaits beforeDelete hooks 2022-01-14 12:13:43 -05:00
James
7c7b546812 chore: beta release 2022-01-12 14:45:22 -05:00
James
20e5dfbb4a fix: ensures nested lists always render properly 2022-01-12 14:39:32 -05:00
James
d7c9d9f55b chore: beta release 2022-01-12 14:21:32 -05:00
James
5e42a835a1 chore: merge rich text indent 2022-01-12 14:17:23 -05:00
James Mikrut
7df50f9bf9 feat: adds indentation controls to rich text
* feat: rich text indent PoC

* fix: new slate version types

* feat: ensures only lowest rich text list is shown as active

* feat: adds icons for indentation

* docs: adds indent to rich text
2022-01-12 14:16:05 -05:00
James
c5de01bfc4 fix: new slate version types 2022-01-10 22:19:19 -05:00
James
2deed8b146 feat: rich text indent PoC 2022-01-10 22:15:14 -05:00
James
baa6258bba chore: beta release 2022-01-07 14:34:41 -05:00
James
ef4e6d32a9 fix: type error in useField 2022-01-07 14:22:59 -05:00
James
df3a83634f feat: exposes FieldWithPath type for reuse 2022-01-07 14:21:36 -05:00
James Mikrut
c67a68f9d8 Merge pull request #415 from oranoran/admin-classname
Added "className" property to admin + documented existing "style" property
2022-01-07 14:20:05 -05:00
Jarrod Flesch
8591d97fa5 Adjusts Point field docs and test variables (#382)
* fix: corrects the label order and removes confusion for the values saved on a Point field type

* fix: adjusts code to mirror the doc change, replaces [x, y] with [lng, lat] and add type names to Geolocation

* chore: add nested point field test cases

* fix: index true creates a 2dsphere spatial index on point fields

Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2022-01-05 17:46:01 -05:00
Dan Ribbens
d4f3bbd91c chore: beta release 2022-01-05 17:34:13 -05:00
James
dd5ed218a5 Merge branch 'master' of github.com:payloadcms/payload 2022-01-05 17:27:43 -05:00
James
d720509849 chore: beta release 2022-01-05 17:27:37 -05:00
Oran Epelbaum
5549926d2c Fixed saving of a cleared number value (#412)
* Fixed saving of a cleared number value

* fix: clearing saved number for a localized field

Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2022-01-05 17:24:14 -05:00
Oran Epelbaum
50dd65ef92 Added className property to admin, in addition to the existing style property. Also documented both properties. 2022-01-05 21:24:11 +02:00
James
ae44727fb9 fix: ensures multipart/form-data using _payload flattens field data before sending 2022-01-04 09:30:07 -05:00
James
07c3f757e6 chore: beta release 2022-01-03 17:22:37 -05:00
James
65b0ad7f08 feat: builds a way for multipart/form-data reqs to retain non-string values 2022-01-03 16:54:56 -05:00
James
433a52232b chore(release): v0.14.0 2022-01-03 10:14:33 -05:00
James
0ba508a87e fix: ensures versions have proper data 2021-12-31 17:42:42 -05:00
James
e835cbe0b1 fix: autosave 2021-12-31 17:35:31 -05:00
James
ed8abd94e6 feat: merges back in logic for non draft versions and draft versions 2021-12-31 17:35:27 -05:00
James
6bf7d82047 fix: bug with version count 2021-12-31 16:53:51 -05:00
James
01d07bcb9a feat: disables LeaveWithoutSaving if autosave enabled 2021-12-31 16:50:00 -05:00
James
1fb1eaab50 fix: bug in how find merges drafts 2021-12-31 16:47:57 -05:00
James
a7ecadaa52 fix: uses replace instead of push to autocreate a doc 2021-12-31 16:40:03 -05:00
James
c7c34188e1 fix: avoids console 404 on unpublished docs 2021-12-31 16:38:49 -05:00
James
5afabee1f2 separates version vs draft version functionality 2021-12-31 16:25:47 -05:00
James
c62707cd51 feat: working autosave 2021-12-31 14:32:18 -05:00
James
1e093e1eee feat: adds most recently published comparison doc 2021-12-31 14:29:41 -05:00
James
e4ee0f89eb chore: moves DocumentInfo up one level 2021-12-31 14:12:21 -05:00
James
b00517ec20 feat: working drafts 2021-12-31 14:02:16 -05:00
James
a2024b4f64 chore: removes old code 2021-12-31 13:58:08 -05:00
James
0463982b5b feat: styles multiple collection actions 2021-12-31 13:23:04 -05:00
James
4efc2cf71c feat: builds a way for multipart/form-data reqs to retain non-string values 2021-12-31 12:55:01 -05:00
James
cd0e172708 feat: reorders version creation 2021-12-31 12:45:02 -05:00
James
71c49bc5f2 feat: progress to saving drafts manually 2021-12-30 22:01:42 -05:00
James
f1840a5f6c chore: adds draft tests 2021-12-30 21:13:18 -05:00
James
b80d263e7f chore: passing tests 2021-12-30 21:07:03 -05:00
James
8f30c3bfef feat: uses DocumentInfo to fetch and maintain doc versions 2021-12-30 20:24:46 -05:00
James
7220ff7a8a feat: tests & autosave improvements 2021-12-30 16:37:49 -05:00
James
e910d8938f feat: functional autosave 2021-12-30 13:58:06 -05:00
James
be1da8507a feat: progress to drafts 2021-12-30 11:21:53 -05:00
James
13add5885d feat: progress to Autosave 2021-12-29 21:32:16 -05:00
James
aaab8b036c chore: merge 2021-12-29 16:50:30 -05:00
James
fd4319de06 chore: beta release 2021-12-29 16:49:22 -05:00
James
e5d9335596 chore: safely accesses req files 2021-12-29 16:47:37 -05:00
James
d70d33fb27 chore: merge master 2021-12-29 16:45:52 -05:00
James
932116e953 chore: beta release 2021-12-29 16:10:15 -05:00
James
5c3cfa4c93 fix: #408 2021-12-29 16:08:08 -05:00
James
2e6af97506 chore: beta release 2021-12-29 15:51:47 -05:00
James
e2c5d93751 fix: #408 2021-12-29 15:49:47 -05:00
James
2a8f564500 chore: beta release 2021-12-29 15:33:20 -05:00
James
a09570c78d fix: 407 2021-12-29 15:29:12 -05:00
James
546e6e56f1 chore: beta release 2021-12-29 15:29:05 -05:00
James
961787d681 fix: ensures searching relationships works with many pages of results 2021-12-29 15:09:08 -05:00
James
ec6453bb5f chore: beta release 2021-12-29 15:08:53 -05:00
James
9e091af67e fix: ensures row count is set properly in block fields 2021-12-29 11:03:20 -05:00
James
4119eec796 fix: cross-browser upload drag and drop 2021-12-29 10:56:36 -05:00
James
14e5d0977f feat: adds autosave to versions table 2021-12-28 21:41:43 -05:00
James
de48f4417a feat: builds autosave into existing update operation 2021-12-28 21:31:03 -05:00
James
b5fd917dda chore: de-duplicates upload logic 2021-12-28 20:47:58 -05:00
James
4fbddeeb46 feat: removes mongoose required 2021-12-28 19:56:34 -05:00
James
3a71afbd37 feat: renames revisions to versions 2021-12-28 19:41:36 -05:00
James
fdc6aeb47a Merge branch 'master' into feat/revisions 2021-12-28 12:40:09 -05:00
James
c54da719a1 chore: beta release 2021-12-28 12:40:05 -05:00
James
ba79fd42db fix: allows null in ImageSize width and height types 2021-12-28 11:56:10 -05:00
James
ffe8e17ac0 feat: exposes default Dashboard and Nav components for re-import 2021-12-28 11:25:13 -05:00
Elliot DeNolf
da7c0c984c fix: globals model typing 2021-12-26 23:52:05 -05:00
James
b59bb0bbc2 feat: progress to draft types 2021-12-26 17:04:13 -05:00
James
066b593d8f feat: scaffolds drafts / autosave config 2021-12-26 16:48:01 -05:00
James
23f4555ff6 chore: rolls back to displaying json in rich text diff 2021-12-23 11:35:11 -05:00
James
05288ee08c fix: ensures local findByID retains user 2021-12-23 11:29:45 -05:00
James
7bd60b5a3d feat: attempts to render rich text diffs more appropriately 2021-12-23 11:28:06 -05:00
James
0e093bf15e feat: finishes revision restore 2021-12-23 09:31:13 -05:00
James
210488ba4e feat: progress to revision restore 2021-12-22 16:25:19 -05:00
James
189bc21e48 feat: wires up restore 2021-12-22 16:02:15 -05:00
James
30ec146298 chore: typescript version compatibilities and improvements 2021-12-22 15:32:05 -05:00
James
2e946a0aac feat: progress to restore revision 2021-12-22 14:38:38 -05:00
James
8764a11b1d Merge branch 'feat/revisions' of github.com:payloadcms/payload into feat/revisions 2021-12-22 14:37:11 -05:00
Dan Ribbens
5eea398e43 feat: adds restore revisions to collections 2021-12-22 14:24:24 -05:00
James
35f35e6f42 Merge branch 'master' into feat/revisions 2021-12-22 14:21:43 -05:00
James
5eb03b675e chore: beta 2021-12-22 14:21:02 -05:00
James
140a3aa9ea fix: ensures getDataByPath works 2021-12-22 14:18:50 -05:00
James
a47977084f feat: builds remainder of diff field types 2021-12-22 13:26:24 -05:00
James
bddaefdae7 feat: builds group and iterable diffs 2021-12-21 20:18:53 -05:00
James
242584fd49 Merge branch 'master' into feat/revisions 2021-12-21 18:04:11 -05:00
James
35bf092813 chore: beta release 2021-12-21 17:59:39 -05:00
James
17b7ee29ac chore: updates pattern for before / after component injection 2021-12-21 14:45:57 -05:00
James
e337c62ba1 feat: builds custom routes API, Before/After Dashboard and Nav custom components 2021-12-21 12:27:22 -05:00
James
52edb5b77f feat: exports custom text and select inputs 2021-12-20 10:40:17 -05:00
James
01ae76ec29 chore: merge 2021-12-20 10:37:18 -05:00
James
9765fdb0ae chore: beta release 2021-12-14 16:15:14 -05:00
James Mikrut
3e40944e19 Merge pull request #394 from payloadcms/fix/393
fix: #393, ensures preview button gets up to date data
2021-12-14 10:27:58 -05:00
James
97388738de fix: #370, only performs password functions when auth enabled 2021-12-14 10:27:37 -05:00
James
a16b99b0c8 fix: #390, safari rich text link bug 2021-12-14 10:23:28 -05:00
James
2f47e39a9f fix: #393, ensures preview button gets up to date data 2021-12-14 10:10:13 -05:00
James
245e12e8b6 feat: renders diffs 2021-12-13 16:10:25 -05:00
James
f57223024a feat: allows selection of revisions in certain locales to compare 2021-12-13 14:09:13 -05:00
James
740d6b15e5 feat: further revisions views 2021-12-07 14:49:32 -05:00
James
40f93e9d64 feat: scaffold of individual Revision view 2021-12-01 12:51:37 -05:00
James
da5684df27 feat: abstracts revisions components for reuse in globals 2021-12-01 12:21:56 -05:00
James
1920a937b2 feat: builds revisions list view 2021-12-01 10:36:23 -05:00
James
b31f43f838 chore: merge 2021-12-01 05:18:34 -05:00
James
37f5fc3895 chore(release): v0.13.6 2021-11-30 13:34:13 -05:00
James
1d25c7fca7 Merge branch 'feat/form-onchange' of github.com:payloadcms/payload 2021-11-30 13:32:18 -05:00
Jacob Fletcher
925a33e560 fix: requires path in select, text, textarea, and upload components 2021-11-30 13:19:09 -05:00
James
6a33abbec2 chore(release): v0.13.5 2021-11-30 11:00:35 -05:00
Jacob Fletcher
ecabf130fd fix: select component rendered value 2021-11-30 10:50:32 -05:00
James
be2fdd1488 chore(release): v0.13.4 2021-11-30 09:55:44 -05:00
James
e4d03490a3 Merge branch 'feat/form-onchange' of github.com:payloadcms/payload 2021-11-30 09:54:04 -05:00
Jacob Fletcher
80c81ecfc6 Merge branch 'master' of github.com:payloadcms/payload into feat/form-onchange 2021-11-30 09:48:42 -05:00
Jacob Fletcher
f0fd859347 fix: prevents uncontrolled text field component 2021-11-30 09:28:07 -05:00
James
74f7101524 Merge branch 'feat/form-onchange' of github.com:payloadcms/payload 2021-11-30 08:48:14 -05:00
Jacob Fletcher
7e2b259816 fix: select component types 2021-11-29 18:27:14 -05:00
Jacob Fletcher
0b13eda1e5 fix: threads props through textarea component 2021-11-29 18:05:51 -05:00
Jacob Fletcher
c77bf3aa42 fix: passes hasMany through select component 2021-11-29 17:08:46 -05:00
Jacob Fletcher
86480b7482 feat: abstracts textarea component and improves event typing 2021-11-29 17:08:39 -05:00
Jacob Fletcher
f234f68019 feat: abstracts upload component 2021-11-29 17:08:32 -05:00
Jacob Fletcher
fa671378c7 feat: abstracts select component 2021-11-29 17:08:24 -05:00
Jacob Fletcher
615e3695f2 feat: abstracts input from text component 2021-11-29 17:08:09 -05:00
James
2faade7a03 chore(release): v0.13.3 2021-11-29 12:19:44 -05:00
James
89682cf034 chore: new yarn lock 2021-11-29 12:12:09 -05:00
James Mikrut
82c69a17b9 Merge pull request #372 from payloadcms/fix/sharp-m1-prebuilt
fix: upgrade sharp for prebuilt M1 binaries
2021-11-29 11:22:28 -05:00
James
f0f4dc12e5 chore(release): v0.13.2 2021-11-29 08:34:53 -05:00
James
727fbeceb4 fix: #373 2021-11-29 08:33:20 -05:00
James
5127826de0 chore(release): v0.13.1 2021-11-29 08:20:33 -05:00
James
ded891e390 fix: ensures sorting by _id instead of improper id 2021-11-29 08:18:59 -05:00
Elliot DeNolf
34f416aace fix: upgrade sharp for prebuilt M1 binaries 2021-11-28 20:21:46 -05:00
James
a589877698 feat: adds stepnav to revisions template 2021-11-28 17:11:24 -05:00
James
2176ce0cf7 chore: ensures tests pass 2021-11-28 17:03:20 -05:00
James
72537106a3 feat: scaffolds admin revisions 2021-11-28 16:37:21 -05:00
James
974fdd0bfd chore: tests revisions REST API 2021-11-27 12:24:56 -05:00
James
f56bbe814e fix: ensures revision hooks await promises 2021-11-27 12:13:41 -05:00
James
4a445f03e8 feat: scaffolds new revisions operations and rest routes 2021-11-27 12:09:45 -05:00
James
ec82b923f3 feat: creates global revisions 2021-11-27 11:07:34 -05:00
James
3d5be91f6c Merge branch 'master' into feat/revisions 2021-11-27 10:20:15 -05:00
James
bc753951a0 Merge branch 'master' of github.com:payloadcms/payload 2021-11-27 10:20:05 -05:00
James
d6d76d4088 feat: only adds list search query param if value is present 2021-11-27 10:19:50 -05:00
James
2a7459baf2 chore: test fixes 2021-11-27 10:03:50 -05:00
James
b13615f2bf fix: ensures unique is not set within revisions collections 2021-11-27 10:03:44 -05:00
James
c3f743af03 feat: ensures field hooks run on all locales when locale=all 2021-11-27 10:03:24 -05:00
James
f246252a42 fix: ensures revisions retain all locales 2021-11-27 10:03:04 -05:00
James
8df767e9a2 feat: ensures revisions are created and deleted accordingly 2021-11-26 19:54:35 -05:00
James
8ef1cc5373 chore: merge master 2021-11-26 18:00:59 -05:00
James Mikrut
70b58e2826 Update CHANGELOG.md 2021-11-26 17:14:57 -05:00
James
43a25195b7 chore(release): v0.13.0 2021-11-26 17:12:07 -05:00
James
e01173dd51 Merge branch 'master' of github.com:payloadcms/payload 2021-11-26 17:10:20 -05:00
James
77a208fff7 docs: typescript 2021-11-26 17:10:01 -05:00
James Mikrut
cef06e3c79 Merge pull request #367 from payloadcms/feat/form-onchange
Feat/form onchange
2021-11-25 10:39:02 -05:00
James
a0fb48c9a3 fix: #358 - reuploading with existing filenames 2021-11-25 10:34:03 -05:00
James
6b150e01d3 feat: further types field based functions 2021-11-25 09:54:12 -05:00
Elliot DeNolf
820b6ad4c7 feat: more typing of generics, better commenting of properties 2021-11-25 09:41:44 -05:00
Elliot DeNolf
bb18e8250c fix: typing for collection description 2021-11-25 09:41:44 -05:00
Elliot DeNolf
b99eb8ba73 feat: smarter generics 2021-11-25 09:41:44 -05:00
Elliot DeNolf
f258c5904e feat: type payload operation calls with generics 2021-11-25 09:41:44 -05:00
James
a3171c73d0 Merge branch 'master' into feat/revisions 2021-11-24 18:37:45 -05:00
James
57cab22387 chore: optimizes buildQuery legibility 2021-11-24 18:37:24 -05:00
James
7050b5285e fix: ensures non-localized relationships with many relationTos can be queried 2021-11-24 18:01:33 -05:00
James
38ee73ba2e chore: beta release 2021-11-24 17:20:10 -05:00
James
6d31aa8d86 Merge branch 'master' of github.com:payloadcms/payload into feat/revisions 2021-11-24 17:15:58 -05:00
Jarrod Flesch
96421b3d59 fix: ensures uploads can be fetched with CORS 2021-11-24 17:15:25 -05:00
Jacob Fletcher
0245747020 feat: renames useFieldType to useField 2021-11-24 15:37:36 -05:00
Jacob Fletcher
4affdc3a93 feat: supports custom onChange handling in text, select, and upload fields 2021-11-24 15:28:41 -05:00
James
ccbe9f5137 Merge branch 'master' of github.com:payloadcms/payload 2021-11-24 15:21:55 -05:00
James
23f7efe7d1 chore: changelog 2021-11-24 15:21:52 -05:00
Jarrod Flesch
051b7d45be feat: applies upload access control to all auto-generated image sizes 2021-11-24 15:19:21 -05:00
Jacob Fletcher
3540a188a4 Merge branch 'master' of github.com:payloadcms/payload into feat/form-onchange 2021-11-24 14:25:08 -05:00
James
da6e1df293 fix: allows sync or async preview urls 2021-11-24 13:20:13 -05:00
James
01429b6570 Merge branch 'feat/preview-async' of github.com:payloadcms/payload 2021-11-24 13:19:49 -05:00
James
cdd55a1c6b chore: adds tests for querying use cases 2021-11-24 13:18:10 -05:00
Jacob Fletcher
40ca3dae61 feat: migrates admin preview to async 2021-11-24 12:32:44 -05:00
James
07c8ac08e2 feat: indexes filenames 2021-11-24 11:35:07 -05:00
James
5d43262f42 feat: indexes filenames 2021-11-24 11:02:54 -05:00
James
bd373598b5 chore: beta release 2021-11-24 10:45:51 -05:00
James
26aaef8851 feat: merges type generation 2021-11-24 10:35:30 -05:00
James
6fd5ac2c08 feat: azure cosmos compatibility 2021-11-24 10:30:47 -05:00
James
763f32e22f chore: separates revisions from drafts 2021-11-23 17:14:06 -05:00
Elliot DeNolf
21a810c38c feat: add id fields to generated types 2021-11-23 16:43:59 -05:00
James
27fabf79bd Merge branch 'master' of github.com:payloadcms/payload into feat/revisions 2021-11-23 14:32:26 -05:00
James
91fae55d90 chore: updates type generation log message 2021-11-23 10:19:25 -05:00
James
d9e1b5ede3 fix: issue with querying by id and using comma-separated values 2021-11-23 10:18:30 -05:00
James
99a3386dd6 Merge branch 'master' of github.com:payloadcms/payload 2021-11-22 15:45:36 -05:00
James Mikrut
c49c9b0328 Merge pull request #361 from payloadcms/fix/description-type
fix: updates field description type to include react nodes
2021-11-22 12:22:20 -05:00
James Mikrut
d151003eb6 Merge pull request #364 from tejasahluwalia/fix/webp-support-admin-dashboard
fix: Include 'WebP' as image type for admin dashboard thumbnail component
2021-11-22 12:22:02 -05:00
Jacob Fletcher
3436e6173f wip: custom onchange events for text, select, and upload fields 2021-11-22 08:50:48 -05:00
Tejas Ahluwalia
b2fe27dda5 Include 'WebP' as image type
This is called in the useThumbail hook. Adding webp support for thumbnails in the admin Thumbnail component.
2021-11-21 00:05:10 +05:30
James
ed5a5ebe7e feat: finishes typing all fields 2021-11-16 21:15:49 -05:00
James
2ca76ba8ce feat: generates further field types 2021-11-16 21:01:57 -05:00
James
6dd1b0e033 feat: adds field types to type generation 2021-11-16 20:24:13 -05:00
James
5a965d2263 feat: baseline type generation 2021-11-16 18:49:42 -05:00
James
3ab9d9e740 Merge branch 'feature/ts-type-gen' of github.com:payloadcms/payload into feature/ts-type-gen 2021-11-16 18:17:31 -05:00
James
438b6b3e51 Merge branch 'master' of github.com:payloadcms/payload 2021-11-10 17:30:49 -05:00
James
40899c211b chore: beta release 2021-11-10 17:30:31 -05:00
James
b2c5b7e575 feat: ensures update hooks have access to full original docs even in spite of access control 2021-11-10 17:25:59 -05:00
Jacob Fletcher
291c193ad4 fix: updates field description type to include react nodes 2021-11-10 11:23:10 -05:00
Elliot DeNolf
7c6424ff35 chore: resolve conflicts 2021-11-09 20:00:21 -05:00
James Mikrut
a7525e2931 Merge pull request #355 from donstephan/donstephan-patch-1
Typo in docs for select field
2021-11-05 12:27:38 -04:00
Don Stephan
e7b1adf4ed Better english 2021-11-04 20:28:32 -05:00
Don Stephan
f67286be7b Typo in options label for select field 2021-11-04 20:13:17 -05:00
James
e3e41c3621 Merge branch 'feat/relationship-filter' 2021-11-01 23:16:11 -04:00
James
72fc413764 fix: ensures buildQuery works with fields as well as simultaneous or / and 2021-11-01 23:11:54 -04:00
James
463c4e60de feat: adds relationship filter field 2021-11-01 23:11:03 -04:00
James
e06df905c5 chore: beta release 2021-11-01 22:33:31 -04:00
James
8987ce1f69 chore: scaffolds relationship filter 2021-11-01 22:31:32 -04:00
James
7337169342 chore: adds query testing 2021-11-01 22:30:35 -04:00
James
bee18a5e99 chore: adds buildQuery testing 2021-11-01 22:30:16 -04:00
James
abf61d0734 fix: ensures richtext links retain proper formatting 2021-11-01 19:41:22 -04:00
James
20d4e72a95 fix: ensures 'like' query param remains functional in all cases 2021-11-01 19:05:09 -04:00
James
056f078615 chore: release beta 2021-11-01 17:12:08 -04:00
James
94c2b8d80b fix: #351 2021-11-01 17:10:11 -04:00
James
0eceb8d76c chore: improves demo collections for testing 2021-11-01 17:09:02 -04:00
James
37b21b0762 fix: ensures tquerying by relationship subpaths works 2021-11-01 17:07:42 -04:00
James
40b33d9f5e fix: bug with relationship cell when no doc is available 2021-11-01 17:07:05 -04:00
James Mikrut
7303312142 Merge pull request #349 from payloadcms/feat/query-improvements
feat: improves querying logic
2021-11-01 14:34:58 -04:00
James
57c0346a00 fix: ensures relationship field search can return more than 10 options 2021-11-01 14:34:46 -04:00
James
6b14984352 chore: removes non-functional buildQuery code 2021-10-27 13:08:42 -04:00
James
4c85747849 feat: improves querying logic 2021-10-27 00:49:27 -04:00
James
a870cc7036 chore(release): v0.12.3 2021-10-23 11:37:09 -04:00
James
b4c15ed3f3 fix: #348, relationship options appearing twice in admin ui 2021-10-23 11:34:23 -04:00
James
a0b38f6832 fix: ensures tooltips in email fields are positioned properly 2021-10-23 11:33:56 -04:00
James
ac53bac2f4 feat: revision access control config 2021-10-22 10:58:35 -04:00
James
fbbe590ea2 feat: scaffolds revisions tests 2021-10-22 10:58:14 -04:00
James
6ed11a5563 feat: adds base revision fields 2021-10-22 10:57:56 -04:00
James
d3f88a1bd9 fix: mobile styling to not found page 2021-10-22 10:23:06 -04:00
James
06861261fe feat: builds revisions models 2021-10-22 09:47:34 -04:00
James
83f41df82f chore(release): v0.12.2 2021-10-21 19:36:31 -04:00
James
5b36bd7b43 chore: dependencies 2021-10-21 19:35:22 -04:00
James
d443ea582c fix: improves paste html formatting 2021-10-21 19:33:50 -04:00
James
881952e1cc chore(release): v0.12.1 2021-10-21 18:40:01 -04:00
James
9d7feb9796 fix: rich text copy and paste now saves formatting properly 2021-10-21 18:38:34 -04:00
James
bc6c892e0a chore(release): v0.12.0 2021-10-21 13:22:21 -04:00
James
48315b0e67 Merge branch 'master' of github.com:payloadcms/payload 2021-10-21 13:20:37 -04:00
James
c35009f14c fix: bug where field hooks and access control couuld potentially compete 2021-10-21 13:20:23 -04:00
James Mikrut
935a483eaa Update overview.mdx 2021-10-21 09:27:42 -04:00
James
badbdca351 chore: changelog 2021-10-21 09:19:57 -04:00
James
c02e8f14c7 feat: exposes withCondition for re-use 2021-10-21 09:16:49 -04:00
James Mikrut
92cb30e921 Merge pull request #344 from payloadcms/feat/ui-field
feat: builds UI field
2021-10-20 19:33:03 -04:00
James
edb723a4fb feat: builds UI field 2021-10-20 16:56:07 -04:00
James Mikrut
dbac0724ad Update CHANGELOG.md 2021-10-20 09:27:58 -04:00
James
328585edbd chore(release): v0.11.0 2021-10-20 09:26:26 -04:00
James
914cca6b92 fix: #343 - upload rte element crashes admin when no upload collection present 2021-10-20 09:24:23 -04:00
James
e3b05f9076 chore: changelog, beta release 2021-10-19 10:35:38 -04:00
James
86e88d998f fix: #338, array / block fields with only nested array block fields break admin UI 2021-10-19 10:31:59 -04:00
James Mikrut
6d50afd864 Merge pull request #342 from payloadcms/feat/upload-url-field
feat: adds dynamic url field to upload-enabled collections
2021-10-19 10:30:38 -04:00
James
4527dda08c chore: ensures adminThumbnail uses new url field 2021-10-18 21:21:24 -04:00
James
cc4d1fd045 feat: adds dynamic url field to upload-enabled collections 2021-10-18 21:15:32 -04:00
James
3b99deda45 fix: #341 - searching on multiple relationship collections 2021-10-18 19:25:08 -04:00
James
900f05eefd feat: adds safety checks while querying on id with bad values 2021-10-18 19:23:24 -04:00
James
716c05f5d8 Merge branch 'master' of github.com:payloadcms/payload 2021-10-18 13:48:13 -04:00
James
b22c8963cb docs: accuracy 2021-10-18 13:48:02 -04:00
James
eb05b47c54 chore: changelog 2021-10-18 13:12:26 -04:00
James
ca91f47d32 feat: allows richText enter key break out functionality to be extended in custom elements 2021-10-18 13:08:57 -04:00
James Mikrut
5040ee629f Update README.md 2021-10-14 14:27:29 -04:00
Dan Ribbens
5be09ffc78 Merge branch 'master' of github.com:payloadcms/payload 2021-10-13 17:03:38 -04:00
Dan Ribbens
4c87123514 docs: fix typo 2021-10-13 17:03:21 -04:00
James
f57f81a3cb chore: publish beta 2021-10-13 16:19:38 -04:00
James
423ca01ab1 feat: improves richtext link 2021-10-13 16:14:00 -04:00
James
9eedce7345 Merge branch 'master' of github.com:payloadcms/payload 2021-10-13 09:19:48 -04:00
James
a2df67eccd fix: removes node 15 from CI 2021-10-13 09:19:39 -04:00
James Mikrut
3908c012f9 Update CHANGELOG.md 2021-10-12 21:36:10 -04:00
James
ecda271258 chore: rolls back ts / eslint updates 2021-10-12 21:35:07 -04:00
James
84f6a9d659 fix: more strict field typing 2021-10-12 21:18:12 -04:00
James
7d49302ffa fix: properly types row field 2021-10-12 19:42:37 -04:00
James
f3455aafe9 chore: changelog 2021-10-12 19:36:19 -04:00
James
fcd9c28871 fix: per page now properly modifies search query 2021-10-12 19:31:01 -04:00
James
a6fc1fdc58 feat: saves active list filters in URL, implements per-page control 2021-10-12 19:25:43 -04:00
James
630fa68714 Merge branch 'master' of github.com:payloadcms/payload 2021-10-12 11:08:37 -04:00
James
ef4f284fb0 Merge branch 'feature/per-page' of github.com:payloadcms/payload 2021-10-12 11:08:32 -04:00
James Mikrut
5a63f11ed7 Merge pull request #339 from payloadcms/fix/build-failure-code
fix: use proper error code on webpack build failure
2021-10-12 10:56:20 -04:00
Elliot DeNolf
6807637e25 wip(per-page): thread the needle, not working 2021-10-11 17:42:02 -04:00
Elliot DeNolf
d88ce2d342 feat(per-page): set and load from preferences 2021-10-11 17:09:44 -04:00
Dan Ribbens
b257e01c8d fix: make name required on field types (#337)
* fix: make name required on field types

* fix: improve typescript types
2021-10-11 15:52:18 -04:00
Elliot DeNolf
c132f2ff10 feat(per-page): add pagination to admin config 2021-10-11 11:34:25 -04:00
James
d0259ceecd chore(release): v0.10.11 2021-10-07 20:29:06 -04:00
James
fd4fbe8c8b fix: bug with local API and not passing array / block data 2021-10-07 20:25:42 -04:00
James
4432031341 chore(release): v0.10.10 2021-10-07 11:30:23 -04:00
Jarrod Flesch
932628bc14 Merge branch 'master' of github.com:payloadcms/payload 2021-10-07 10:58:39 -04:00
Jarrod Flesch
27117292f3 fix: deepObjectCopy returns Date object instead of empty object 2021-10-07 10:58:33 -04:00
Elliot DeNolf
3715e011c9 feat(admin): initial per page component 2021-10-06 21:39:12 -04:00
Elliot DeNolf
2eb81546c3 fix: use proper error code on webpack build failure 2021-10-06 10:30:56 -04:00
James
bbdeebd1d4 chore(release): v0.10.9 2021-10-05 18:13:04 -04:00
Jarrod Flesch
5056e18734 Merge branch 'master' of github.com:payloadcms/payload 2021-10-05 18:05:53 -04:00
Jarrod Flesch
e3229c55f3 fix: ensures field read access within login operation has id 2021-10-05 18:05:48 -04:00
James
78c3ab6c44 chore(release): v0.10.8 2021-10-04 18:07:57 -04:00
Jarrod Flesch
ffab6c46c1 fix: ensures update field access control receives id 2021-10-04 18:05:55 -04:00
James
8d6372ee4b chore(release): v0.10.7 2021-10-04 11:26:58 -04:00
James
ad2b47e725 docs: clarity 2021-10-04 11:25:12 -04:00
James
bba1f1ff62 Merge branch 'feat/index-sortable-fields' of github.com:payloadcms/payload 2021-10-04 11:22:13 -04:00
James
0a5a6071f0 chore: renames StrictPolicies to StrictAccess 2021-10-04 11:21:40 -04:00
James
1c69441f17 chore: adds tests for relationship population 2021-10-04 11:19:03 -04:00
James
a20110974d fix: ensures non populated relationships still retain IDs 2021-10-04 11:07:47 -04:00
Jarrod Flesch
d5d774877e Merge branch 'master' of github.com:payloadcms/payload into fix/relationship-access-missing-id 2021-10-01 17:08:37 -04:00
Jarrod Flesch
470d4345f9 fix: ensures relationship field access control receives id 2021-10-01 17:07:26 -04:00
Dan Ribbens
ad097820bf feat: add indexSortableField option to create indexes for sortable fields on all collections 2021-09-30 16:05:47 -04:00
James
fda9356749 chore(release): v0.10.6 2021-09-30 12:41:01 -04:00
James
60ff7afee0 Merge branch 'master' of github.com:payloadcms/payload 2021-09-30 12:36:06 -04:00
James
f42205307e fix: relationship + new slate incompatibility 2021-09-30 12:36:01 -04:00
Dan Ribbens
d498e37083 Merge pull request #330 from payloadcms/fix/debug-config-option
fix: allow debug in payload config
2021-09-28 15:54:25 -04:00
James Mikrut
f06808ac80 Update CHANGELOG.md 2021-09-28 14:38:04 -04:00
James
08b8f3b40a chore(release): v0.10.5 2021-09-28 14:36:58 -04:00
James
2e64fcf92e docs: rich text upload element 2021-09-28 14:32:34 -04:00
James
b4334b2339 chore: merge 2021-09-28 14:25:40 -04:00
James
15970550f7 fix: ensures that fields within non-required groups are correctly not required 2021-09-28 14:22:59 -04:00
James
08db431c0c feat: updates slate, finishes rte upload 2021-09-28 13:52:28 -04:00
Dan Ribbens
e0020bfc16 Merge pull request #329 from payloadcms/fix/localized-indexes
fix: index creation on localized field parent
2021-09-27 14:49:21 -04:00
Dan Ribbens
23e81971eb fix: index creation on localized field parent 2021-09-27 14:40:01 -04:00
Dan Ribbens
004ac8dd8f Merge pull request #328 from payloadcms/fix/query-estimate-count
fix: pagination estimatedCount limited to near query
2021-09-27 14:33:35 -04:00
Dan Ribbens
73bd69870c fix: pagination estimatedCount limited to near query 2021-09-27 13:12:00 -04:00
James
6f3edf9fbb feat: adds UploadGallery to rich text upload 2021-09-27 11:25:26 -04:00
James
85c6c303d5 feat: progress to rich text upload 2021-09-24 12:39:56 -04:00
James
aa769500c9 feat: adds rich text editor upload element 2021-09-23 20:42:44 -04:00
Dan Ribbens
65bf13d7c1 fix: allow debug in payload config 2021-09-23 14:56:21 -04:00
James Mikrut
dece5e68f3 Update CHANGELOG.md 2021-09-22 17:08:55 -04:00
James
9247d2986a chore(release): v0.10.4 2021-09-22 16:41:15 -04:00
James
8661115283 fix: allows image resizing if either width or height is larger 2021-09-22 16:38:30 -04:00
James
df36a6e7e6 chore: revision to overwriteExistingFields 2021-09-22 13:23:25 -04:00
James
dbbff4cfa4 feat: allows local update api to replace existing files with newly uploaded ones 2021-09-22 12:05:09 -04:00
James
3c65f63fef chore: changelog 2021-09-20 21:29:27 -04:00
James
c9cbd1cfd5 chore: bumps sass and node-sass 2021-09-20 21:15:49 -04:00
James
8a890fdc15 feat: adjusts empty group population to be virtual only 2021-09-15 18:06:09 -04:00
James
42ca800c88 Merge branch 'master' of github.com:payloadcms/payload 2021-09-15 17:48:50 -04:00
James
39a8e2c20f feat: defaults empty group fields to empty object 2021-09-15 17:48:35 -04:00
James
e39ece4823 feat: defaults empty group fields to empty object 2021-09-15 16:47:43 -04:00
James
8aa9347a84 Merge branch 'master' of github.com:payloadcms/payload 2021-09-15 16:39:53 -04:00
James
901ad498b4 feat: performance improvement while saving large docs 2021-09-15 16:39:43 -04:00
Dan Ribbens
c676631661 Merge pull request #315 from payloadcms/docs/fix-collection-hook-links
docs: fix links in collection hooks
2021-09-15 14:34:45 -04:00
Dan Ribbens
0171550528 test: check array and group items have id 2021-09-15 14:30:52 -04:00
James
7fc8f6dd3c docs: corrects refresh-token rest route 2021-09-15 13:46:55 -04:00
James
02e7fe3f1f fix: properly types optional req in local findByID 2021-09-15 13:46:08 -04:00
James
2b8f925e81 fix: array objects now properly save IDs 2021-09-15 13:45:49 -04:00
James
7e8df100bb feat: exposes Pill component for re-use 2021-09-13 12:56:03 -04:00
Dan Ribbens
d12bb5043a docs: fix links in collection hooks 2021-09-13 12:17:25 -04:00
James
03c0435e3b fix: date field error message position 2021-09-12 19:47:33 -04:00
Elliot DeNolf
fc844270d9 chore: update beta release script 2021-09-12 14:44:59 -04:00
Dan Ribbens
048103ccf2 chore(release): v0.10.0 2021-09-09 16:03:23 -04:00
Dan Ribbens
0334e9bc21 Merge pull request #313 from payloadcms/feat/custom-id
Feat/custom-id
2021-09-09 15:56:59 -04:00
Dan Ribbens
c7558d8652 fix: sanitize custom id number types 2021-09-09 15:46:04 -04:00
Dan Ribbens
4a0bb7bf74 Merge branch 'feat/custom-id' of github.com:payloadcms/payload into feat/custom-id 2021-09-09 11:56:10 -04:00
Dan Ribbens
fe1dc0b191 feat: add config validation for collections with custom id 2021-09-09 11:55:40 -04:00
Dan Ribbens
d0aaf4a412 feat: add config validation for collections with custom id 2021-09-09 11:24:50 -04:00
Jean-Baptiste
4b70a1225f feat: replace the collection idType option with an explicit id field 2021-09-09 11:24:47 -04:00
Jean-Baptiste
29529b2c56 fix: improve id type semantic and restrict possible types to text and number 2021-09-09 11:21:55 -04:00
Dan Ribbens
bc2a6e1575 feat: graphql support for custom id types 2021-09-09 11:20:06 -04:00
Dan Ribbens
114dc1b3fb fix: sort id columns 2021-09-09 11:20:06 -04:00
Dan Ribbens
dc96b90cba fix: admin UI collection id is required 2021-09-09 11:20:06 -04:00
Jean-Baptiste
af5f931340 update docs with id option 2021-09-09 11:20:06 -04:00
Jean-Baptiste
b3e41ae76d update assessment for consistence 2021-09-09 11:20:06 -04:00
Jean-Baptiste
3cc921acc9 feat: support custom ids 2021-09-09 11:20:02 -04:00
James Mikrut
3ffa480399 Merge pull request #308 from payloadcms/feat/field-type-point
Feat/field type point
2021-08-31 13:32:18 -04:00
James
64ad6a30a5 feat: frontend polish to point field 2021-08-31 13:29:17 -04:00
James
c878400876 Merge branch 'fix/hooks-transform-call-order' into feat/field-type-point 2021-08-31 13:24:58 -04:00
James
39f3619d03 Merge branch 'feat/field-type-point' of github.com:payloadcms/payload into feat/field-type-point 2021-08-31 13:11:32 -04:00
James Mikrut
fdd25ddb1a Merge pull request #311 from payloadcms/fix/option-value-empty-string
fix: config validation correctly prevents empty strings for option vals
2021-08-31 13:07:25 -04:00
James
8675481343 feat: allows user to pass req through local findByID 2021-08-31 13:01:26 -04:00
Dan Ribbens
41e7febf6a fix: config validation correctly prevents empty strings for option values 2021-08-31 11:43:07 -04:00
James
96629f1f01 fix: ensures hooks run before access 2021-08-30 17:10:06 -04:00
Dan Ribbens
d42d8f76ef fix: remove media directory to improve test run consistency 2021-08-25 17:41:24 -04:00
Dan Ribbens
34630757b9 docs: point field and near query 2021-08-25 16:55:47 -04:00
James
c187da00b1 fix: ensures proper order while transforming incoming and outgoing data 2021-08-25 15:38:46 -04:00
James
1d8b0e9724 Merge branch 'fix/hooks-transform-call-order' of github.com:payloadcms/payload into fix/hooks-transform-call-order 2021-08-25 14:29:39 -04:00
Dan Ribbens
f80646c598 fix: allow save of collection with an undefined point 2021-08-25 13:28:42 -04:00
Dan Ribbens
30f17509ea feat: point field localization and graphql 2021-08-24 17:28:08 -04:00
Dan Ribbens
7504155e17 feat: add point field type 2021-08-23 23:12:50 -04:00
James
468408ff41 chore(release): v0.9.5 2021-08-23 18:18:23 -04:00
James Mikrut
05eb3194cf Merge pull request #302 from payloadcms/fix/267-absolute-upload-staticDir-windows
fix: windows compatible absolute paths for staticDir
2021-08-23 18:13:50 -04:00
James
b0dc125604 fix: obscure conditional logic bug 2021-08-23 18:13:19 -04:00
Dan Ribbens
b21316b6cc fix: windows compatible absolute paths for staticDir 2021-08-18 14:30:58 -04:00
James
cb422bb4c6 docs: accuracy improvements 2021-08-12 23:05:21 -04:00
James
20a1ed7da8 chore(release): v0.9.4 2021-08-06 12:56:02 -04:00
James
8534eeea85 docs: typo 2021-08-06 12:53:45 -04:00
James
1d4f604270 chore(release): v0.9.3 2021-08-06 12:41:05 -04:00
James
a5ea0ff619 fix: args no longer optional in collection and global hooks 2021-08-06 12:38:31 -04:00
James
3cf01964de chore(release): v0.9.2 2021-08-06 12:26:18 -04:00
James Mikrut
2243070ac7 Merge pull request #272 from payloadcms/feat/disable-local-file-storage
feat: allow completely disabling local file storage
2021-08-06 12:23:37 -04:00
James
9661c6d40a feat: allow completely disabling local file storage 2021-08-06 12:18:20 -04:00
James
3ed8b010e9 Merge branch 'master' of github.com:payloadcms/payload 2021-08-06 11:38:28 -04:00
James
f61643ac32 chore: revises types in demo 2021-08-06 11:38:20 -04:00
James
d0982bf332 chore: adds test for req.payloadUploadSizes 2021-08-06 11:36:51 -04:00
James
4a44d20d90 chore: merges 2021-08-06 11:14:02 -04:00
James Mikrut
69ba06f5fc Merge pull request #250 from payloadcms/fix/row-admin-type
fix: row admin type
2021-08-06 11:12:27 -04:00
James Mikrut
c51ffedb6f Merge pull request #271 from payloadcms/feat/upload-resize-allow-null
feat: allows upload resizing to maintain aspect ratio
2021-08-06 11:12:11 -04:00
James
8a022e3c55 docs: adds detail about maintaining aspect ratio 2021-08-06 11:11:51 -04:00
James
dea54a4ccc feat: allows upload resizing to maintain aspect ratio 2021-08-06 11:08:48 -04:00
James
9c8935fd51 feat: exposes auto-sized uploads on payload req 2021-08-06 10:40:40 -04:00
James
907f8fd94d feat: reduces group heading from h2 to h3 2021-08-04 14:23:23 -04:00
James
bb7e069b2b chore(release): v0.9.1 2021-08-02 22:03:18 -04:00
James
65db8d9fc2 fix: relationship field access control in admin UI 2021-08-02 21:59:10 -04:00
James
4cc0ea1d81 fix: groups with failing conditions being incorrectly required on backend 2021-08-02 21:58:44 -04:00
James
01a191a139 feat: exposes collection after read hook type 2021-08-02 21:57:50 -04:00
James Mikrut
4b51e9d9a1 Update overview.mdx 2021-08-02 17:17:56 -04:00
James Mikrut
02c7ef11be Update CHANGELOG.md 2021-08-02 17:17:02 -04:00
James
387bfea008 chore(release): v0.9.0 2021-08-02 16:45:40 -04:00
James
8af39472e1 feat: removes sanitization of configs before plugins are instantiated 2021-08-02 16:38:52 -04:00
Elliot DeNolf
a105a486e8 chore(release): v0.8.2 2021-08-02 09:40:45 -04:00
James
33983deb37 fix: more advanced conditional logic edge cases 2021-08-02 09:19:25 -04:00
Elliot DeNolf
12cba62930 feat: export error types 2021-08-02 09:15:11 -04:00
James Mikrut
be69b5892a Update CHANGELOG.md 2021-07-29 07:49:03 -04:00
James Mikrut
cb6fbd7160 Update CHANGELOG.md 2021-07-29 07:48:38 -04:00
James
e6575600cb chore(release): v0.8.1 2021-07-29 07:17:30 -04:00
James
a002b7105f feat: improves plugin writability 2021-07-29 07:15:47 -04:00
Dan Ribbens
deef5202c1 fix: row admin type 2021-07-28 14:37:27 -04:00
James
dbc4115644 chore: updates changelog with breaking change 2021-07-27 20:40:40 -04:00
James
d672e704bf chore(release): v0.8.0 2021-07-27 20:33:42 -04:00
James Mikrut
dc1ecdfc53 Merge pull request #246 from payloadcms/feat/expose-validated-config-types
Feat/expose validated config types
2021-07-27 20:32:08 -04:00
James
aa81e04861 docs: typescript configs 2021-07-27 20:21:51 -04:00
James
5a7e5b921d feat: revises naming conventions of config types 2021-07-27 20:13:25 -04:00
James
c649362b95 fix: ensures text component is always controlled 2021-07-27 18:29:46 -04:00
James
f6fc0972e0 chore(release): v0.7.10 2021-07-27 17:57:59 -04:00
James
a1b3414dd0 chore: ensures tests can run locally on mac 2021-07-27 17:55:57 -04:00
James
a2fa30fad2 fix: jest debug testing 2021-07-27 17:55:14 -04:00
James Mikrut
2e42a34bc4 Merge pull request #244 from payloadcms/fix/conditional-field-children
feat: improves conditional logic performance and edge cases
2021-07-27 14:41:22 -04:00
James
9c4ff004a8 chore: merges master 2021-07-27 13:28:27 -04:00
Dan Ribbens
8f90caeb10 chore(release): v0.7.9 2021-07-27 13:15:35 -04:00
Dan Ribbens
6bd16a5cc7 chore: update package dependencies 2021-07-27 13:10:49 -04:00
Dan Ribbens
1344f3da3f Merge pull request #241 from payloadcms/feature/field-description
feat: field descriptions
2021-07-27 13:02:23 -04:00
Dan Ribbens
fe0098ccd9 feat: add component support to collection and global description 2021-07-27 12:53:43 -04:00
Dan Ribbens
e0933f612a feat: add component support to field description 2021-07-27 12:53:43 -04:00
Dan Ribbens
29a1108518 feat: add descriptions to every allowed field type, globals and collections 2021-07-27 12:53:43 -04:00
Dan Ribbens
4544711f0e feat: add admin description to collections and globals 2021-07-27 12:53:43 -04:00
Dan Ribbens
dac60a024b feat: add customizable admin field descriptions 2021-07-27 12:53:43 -04:00
Dan Ribbens
2ff0434656 Merge pull request #227 from payloadcms/chore/update-mongodb-memory-server
chore: bump mongodb-memory-server
2021-07-27 12:53:00 -04:00
Dan Ribbens
19880cfeb8 Merge pull request #237 from payloadcms/feature/config-validation-collection-field-naming
feat: config validation collection field naming
2021-07-27 12:51:37 -04:00
Dan Ribbens
bb63b4aad1 feat: add global slug and field names to schema validation errors 2021-07-26 23:21:19 -04:00
Dan Ribbens
ebfb72c8fa feat: add collection slug to schema validation errors 2021-07-26 23:21:19 -04:00
James
fedeaeafc9 fix: skipValidation logic 2021-07-26 22:45:31 -04:00
James
d43390f2a4 feat: improves conditional logic performance and edge cases 2021-07-26 22:25:11 -04:00
James
ea358a66e8 feat: improves group styling when there is no label 2021-07-26 14:33:26 -04:00
James
4d1249dd03 fix: missing richtext gutter 2021-07-26 14:33:03 -04:00
James
998122b071 chore(release): v0.7.8 2021-07-23 12:09:45 -04:00
James
cbac8887dd feat: fixes group label schema validation 2021-07-23 12:08:27 -04:00
James
bd0b1df560 chore(release): v0.7.7 2021-07-23 10:00:28 -04:00
James
266ccb3744 feat: only attempts to find config when payload is initialized 2021-07-23 09:56:29 -04:00
James
d418599038 Merge branch 'master' of github.com:payloadcms/payload 2021-07-23 09:50:07 -04:00
James
603a11c4d5 docs: renames plugins overview 2021-07-23 09:50:03 -04:00
James Mikrut
51419feb46 Merge pull request #232 from payloadcms/docs/fix-broken-links
docs: fix collections admin link
2021-07-22 09:11:41 -04:00
James Mikrut
f3cd3ae826 Merge pull request #238 from payloadcms/fix/#59
docs: accurately documents the props for the datepicker field
2021-07-22 09:11:26 -04:00
Jarrod Flesch
dcd8052498 fix: accurately documents the props for the datepicker field 2021-07-21 18:09:14 -04:00
Dan Ribbens
7e52de7daf docs: fix collections admin link 2021-07-15 15:04:47 -04:00
Dan Ribbens
d2e3cba22a chore: bump mongodb-memory-server to 7.2.0 and fix test runner 2021-07-10 17:02:11 -04:00
James
fe54837e73 chore: bumps mongodb-memory-server to dev dependencies 2021-07-06 20:53:58 -04:00
James
a7ea32acd6 chore(release): v0.7.6 2021-07-06 20:48:56 -04:00
James
f04ac74ecb chore: bumps mongodb-memory-server to dev dependency 2021-07-06 20:46:46 -04:00
James
b5642492f6 chore: updates mongodb-memory-server 2021-07-06 20:35:48 -04:00
James
3c7b93ba43 chore(release): v0.7.5 2021-07-06 20:23:01 -04:00
James Mikrut
f95b851c9b Merge pull request #221 from payloadcms/feat/richtext-list-optimizations
Feat/richtext list optimizations
2021-07-06 20:19:20 -04:00
James Mikrut
7b43c997bd Merge pull request #222 from payloadcms/docs/plugins
feat: adds plugins infrastructure
2021-07-06 20:19:02 -04:00
James
6b255315e0 feat: adds plugins infrastructure 2021-07-06 20:17:12 -04:00
James
91141ad62f feat: enables backspace to deactivate richtext list elements 2021-07-06 18:51:09 -04:00
James
538851325d fix: crash on bullet list de-selection 2021-07-06 18:28:22 -04:00
James
007591272f fix: updates demo richtext elements with proper SCSS 2021-07-06 15:15:08 -04:00
James
6a12ffc5fd docs: readability 2021-07-01 17:15:30 -04:00
James
fa4d043e74 Merge branch 'docs/spelling' of github.com:payloadcms/payload 2021-07-01 17:05:12 -04:00
James
08b4c25c70 Merge branch 'docs/relationship-field-variations' of github.com:payloadcms/payload 2021-07-01 17:04:57 -04:00
James
4d3d18132b chore(release): v0.7.4 2021-07-01 16:18:12 -04:00
James
84e31aed14 fix: adds proper scss stylesheets to payload/scss 2021-07-01 16:16:22 -04:00
Jessica Boezwinkle
55344a3644 docs: spelling error in rich text doc 2021-07-01 16:05:34 -04:00
Dan Ribbens
acfcd20bfa docs: relationship field where query examples 2021-07-01 15:54:05 -04:00
Dan Ribbens
b5d272fdbe docs: update relationship field with example variations 2021-07-01 14:50:11 -04:00
James
99d9e193ce chore(release): v0.7.3 2021-07-01 14:48:02 -04:00
James
4359178f7a docs: scss reusability 2021-07-01 14:45:31 -04:00
James
929b21d68b merge: field and scss exports 2021-07-01 14:43:56 -04:00
James
c81c638958 Merge branch 'fix/style-vars-imports' of github.com:payloadcms/payload 2021-07-01 14:39:51 -04:00
Dan Ribbens
5bea9ae126 feat: export all field prop types for custom components 2021-06-30 16:55:45 -04:00
Dan Ribbens
ea80fd68b1 fix: changes scss imports to allow vars imports to payload projects 2021-06-29 09:43:18 -04:00
James
e99359ef0d chore(release): v0.7.2 2021-06-22 17:17:17 -04:00
James Mikrut
19a224cdac Merge pull request #208 from payloadcms/feat/maxdepth-field-property
feat: adds maxDepth to relationships and upload fields
2021-06-22 17:14:38 -04:00
James
d6bc6f9f0e fix: safely stringifies ObjectIDs while populating relationships 2021-06-22 17:12:16 -04:00
James
59e66c4c91 Merge branch 'master' of github.com:payloadcms/payload 2021-06-22 16:36:38 -04:00
James
4933b34f6b fix: parses incoming numbers through query string for use in where clauses 2021-06-22 15:15:15 -04:00
Dan Ribbens
470866ae37 chore: adds test case for relation field maxDepth 2021-06-22 14:29:02 -04:00
Dan Ribbens
95c165018e fix: respect maxDepth 0 2021-06-22 14:14:00 -04:00
Dan Ribbens
880dabdcad feat: adds maxDepth to relationships and upload fields 2021-06-22 13:28:27 -04:00
Dan Ribbens
c2e6aae545 chore(release): v0.7.1 2021-06-21 13:55:40 -04:00
Dan Ribbens
3af2554eac fix: babel config file error 2021-06-21 13:52:38 -04:00
Dan Ribbens
045479b5ec chore(release): v0.7.0 2021-06-21 13:34:55 -04:00
James Mikrut
67c1e280eb feat: exposes babel config via payload/babel (#203)
* feat: exposes babel config via payload/config

* docs: adds info about re-using babel.config.js
2021-06-21 12:59:17 -04:00
Dan Ribbens
fb60bc79a1 feat: user preferences (#195)
* feat: adds preferences to rest api and graphql

* feat: admin panel saves user preferences on locales

* feat: admin panel saves user column preferences for collection lists

* feat: adds new id field to blocks and array items

* feat: exposes new DocumentInfo context and usePreferences hooks to admin panel

* docs: preferences api documentation and useage details

Co-authored-by: James <james@trbl.design>
2021-06-21 12:49:10 -04:00
Elliot DeNolf
dd40ab07fa fix: handle all scenarios in select cell 2021-06-08 09:17:28 -04:00
James Mikrut
530eb8bc70 Merge pull request #184 from payloadcms/chore/package-json-repository
* chore: add repository to package.json
* chore: add homepage to package.json
2021-05-24 08:56:17 -04:00
James
9ada08fafc chore(release): v0.6.10 2021-05-23 11:59:52 -04:00
James
b187c9ea65 chore: ensures backward node compatibility 2021-05-23 11:55:13 -04:00
James
c6ccc3477f chore: migrates sass features 2021-05-23 10:57:45 -04:00
Dan Ribbens
ee080f0d8b chore: add homepage to package.json 2021-05-19 13:45:13 -04:00
Dan Ribbens
db59da5950 chore: add repository to package.json 2021-05-19 13:34:40 -04:00
James Mikrut
39d23d65e5 Update CHANGELOG.md 2021-05-16 13:09:23 -04:00
James
deec08b566 chore(release): v0.6.9 2021-05-16 13:07:03 -04:00
James Mikrut
a2e57b09f2 fix: misc responsive improvements, date clipping in sidebar (#165), express-fileupload schema validation (#180)
* fix: misc responsive improvements
* fix: date clipping in sidebar
* fix: revises popup
* fix: admin _verified field not displaying proper field value
* fix: properly typed express-fileupload config options
2021-05-16 13:04:29 -04:00
Elliot DeNolf
fe7e2d54d2 chore(release): v0.6.8 2021-05-11 22:56:13 -04:00
Dan Ribbens
14106a36ad chore: bump node-sass (#175)
Co-authored-by: Elliot DeNolf <denolfe@gmail.com>
2021-05-11 22:50:20 -04:00
Elliot DeNolf
a5fcdf03ba feat: add mimeTypes validation for uploads 2021-05-11 22:21:03 -04:00
Elliot DeNolf
1c6f32f288 feat: restrict upload mime types in file picker 2021-05-11 22:21:03 -04:00
PatrikKozak
46c1a36fdb feat: disables user scalable in mobile (#177) 2021-05-10 14:53:19 -04:00
James
f9319bd055 chore: better organizes preview types 2021-05-10 09:45:43 -04:00
James
98c3315462 chore: updates demo to reflect preview changes 2021-05-10 09:25:46 -04:00
James
2d67448d8a feat: exposes locale within preview function 2021-05-10 09:24:00 -04:00
James
1612bc8d3a chore(release): v0.6.7 2021-05-06 20:50:01 -04:00
James
c8f1bd19e2 docs: adds * locale to docs 2021-05-06 19:58:06 -04:00
James Mikrut
99466fa41e feat: exposes component types 2021-05-06 19:57:06 -04:00
James
9aebeaf579 feat: allows group field gutter to be disabled 2021-05-04 18:48:51 -04:00
Ontopic
e791c5b7b3 feat: add ability to hide gutter for RichText fields
* Adding ability to hide gutter on RichText field

* Adding documentation for hideGutter

Co-authored-by: anon <no-reply@google.com>
2021-05-04 18:37:26 -04:00
Elliot DeNolf
e565fa6f1c feat: shrink image thumbnails on larger screens 2021-04-29 18:30:11 -04:00
Elliot DeNolf
670ccf2f58 feat: support global date format 2021-04-29 18:29:56 -04:00
Elliot DeNolf
cae24db0e1 chore(release): v0.6.6 2021-04-27 10:18:31 -04:00
Elliot DeNolf
8cfc039cd0 fix: support image resizing on M1 chip 2021-04-27 10:11:16 -04:00
Elliot DeNolf
382089b484 fix: handle rich text saving as empty string 2021-04-27 10:00:21 -04:00
Dan Ribbens
6f188b1fa6 fix: graphql returns compatible error format 2021-04-27 09:51:52 -04:00
Dan Ribbens
6caa696c37 chore: add graphql tests for error handling 2021-04-27 09:51:52 -04:00
Jarrod Flesch
2643e1a100 fix: removes incoming.data.length check, since data is typed as a keyed array when it is an instance of APIError 2021-04-27 09:51:52 -04:00
Dan Ribbens
a85bf9e836 fix: update operation can save password changes 2021-04-27 09:49:43 -04:00
Ontopic
f9906e1cdc docs: fix afterChange example 2021-04-27 09:49:15 -04:00
Elliot DeNolf
49ed6279c9 chore: add release-it rc script 2021-04-23 08:25:40 -04:00
James
5f8cad8389 chore(release): v0.6.5 2021-04-22 08:38:28 -04:00
James Mikrut
f17c6e4010 feat: builds plugin infrastructure (#149) 2021-04-22 08:36:54 -04:00
James
7b7071955e chore(release): v0.6.4 2021-04-21 12:23:36 -04:00
James
74430ea151 fix: allows _verificationToken to come back via showHiddenFields 2021-04-21 12:22:09 -04:00
James
d23f7f980d chore(release): v0.6.3 2021-04-21 11:36:19 -04:00
James
0eddbb0ea8 Merge branch 'master' of github.com:payloadcms/payload 2021-04-21 11:34:51 -04:00
James
9c95c75030 fix: safely parses incoming stringified richtext json 2021-04-21 09:52:10 -04:00
Elliot DeNolf
519c021525 fix: make admin field properties in joi schema match TS types 2021-04-20 10:13:20 -04:00
Elliot DeNolf
fa49811377 fix: properly label arrays/blocks with plural and singular 2021-04-20 09:07:58 -04:00
James
f25e9aca61 chore(release): v0.6.2 2021-04-19 19:51:52 -04:00
James
ddf25fbb65 feat: modifies relationship field to react to changing relationTo 2021-04-19 19:49:49 -04:00
James
21dc861461 chore(release): v0.6.1 2021-04-19 19:10:04 -04:00
James
280f809421 fix: graphql localized relationship bugs 2021-04-19 18:48:52 -04:00
James
035f6c63bb Merge branch 'master' of github.com:payloadcms/payload 2021-04-19 10:40:40 -04:00
James
16ca22b4cc fix: moves enableRichTextRelationship to proper spot 2021-04-19 10:40:31 -04:00
James
5f2073ae68 fix: cleans up duplicative columns 2021-04-19 10:23:20 -04:00
James
99704707dd feat: sets enableRichTextRelationship to true by default 2021-04-19 10:23:07 -04:00
James Mikrut
3678cecb69 Update CHANGELOG.md 2021-04-18 21:37:01 -04:00
James
5a52d4d4bb chore: updates changelog 2021-04-18 21:29:07 -04:00
James
7c2955ba70 chore(release): v0.6.0 2021-04-18 21:26:18 -04:00
James
4359a70a8b fix: ensures api keys are properly populated in admin 2021-04-18 20:58:33 -04:00
James
75a5b04705 fix: ensures first options are loaded only once 2021-04-18 20:40:24 -04:00
James
4b1979540d fix: clears richtext element on enter, refocuses on toolbar button click 2021-04-18 16:04:37 -04:00
James
20d7a01919 feat: improves margins in rich text 2021-04-18 15:47:53 -04:00
James
7db23f8ebb fix: upload useAsTitle set to filename by default 2021-04-18 15:43:35 -04:00
James Mikrut
353042467f feat: dynamically populates richtext relationships
* feat: adds relationship field to test searchable input

* fix: searching on relationship fields properly fetches results

* chore: more dry relationship field

* feat: sets default access control to requiring a user to be logged in

* feat: dynamically populates richtext relationships

* feat: allows depth param in graphql richText field

* feat: ensures relationship input is initialized with up to 3 related collections
2021-04-18 15:29:54 -04:00
James Mikrut
b86c3daa99 fix: searching on relationship fields properly fetches results
* feat: adds relationship field to test searchable input

* fix: searching on relationship fields properly fetches results

* chore: more dry relationship field
2021-04-18 15:27:34 -04:00
Elliot DeNolf
b383eb65c6 feat: autolabel fields when label is omitted (#42)
* feat: autolabel fields when omitted

* feat: handle autolabel in graphql mutation build

* feat: autolabel blocks

* test: add required slug field to blocks

* feat: handle graphql names when label is false

* feat: adds relationship field to test searchable input

* feat: handle block cell type labeling pluralization

* docs: remove all explicit labeling, no longer needed

* fix: falsey column labels, allows false array labels

* fix: client tests

* fix: auto-labels globals

* docs: globals auto-labeling and hooks clarification

* fix; proper object type naming

Co-authored-by: James <james@trbl.design>
2021-04-16 22:37:08 -04:00
Elliot DeNolf
21b2bd4b67 feat: improve uniqueness error handling 2021-04-16 18:37:50 -04:00
Elliot DeNolf
4ee4fae53b docs: remove incorrect code tags 2021-04-16 18:37:20 -04:00
James
2459c12f84 chore(release): v0.5.10 2021-04-14 13:44:08 -04:00
James Mikrut
e3f249b0de Merge pull request #137 from payloadcms/fix/graphql-me
fix: feeds collectionSlug through me auth for graphql
2021-04-14 13:42:24 -04:00
Jacob Fletcher
9ee2f9c0dc fix: feeds collectionSlug through me auth for graphql resolver 2021-04-14 12:41:40 -04:00
James
204b755201 chore(release): v0.5.9 2021-04-13 20:03:39 -04:00
James
27df7a4afc chore: bump config provider 2021-04-13 20:02:29 -04:00
James
fc5e5645f2 chore(release): v0.5.8 2021-04-13 14:56:38 -04:00
James
20f1e6cb04 fix: revises graphql import syntax 2021-04-13 14:55:06 -04:00
James
f2e3c1b1a8 chore(release): v0.5.7 2021-04-13 13:14:05 -04:00
James
224f175c7f chore: manually bumps version 2021-04-13 13:11:59 -04:00
Elliot DeNolf
776b9c9c30 feat: remove mimetype from upload cell type 2021-04-13 13:09:36 -04:00
Elliot DeNolf
414bc01b05 fix: make upload cell mimetype inline 2021-04-13 13:09:36 -04:00
James
a78fc974b8 fix: custom query / mutation types 2021-04-13 13:03:57 -04:00
James
5f56994b02 Merge branch 'master' of github.com:payloadcms/payload 2021-04-13 12:28:15 -04:00
James
282775c69a Merge branch 'feat/remember-conditional-values' of github.com:payloadcms/payload 2021-04-13 12:26:31 -04:00
James
523fd7b050 Merge branch 'fix/array-labeling' of github.com:payloadcms/payload 2021-04-13 12:25:57 -04:00
James Mikrut
c02c5a3f84 Merge pull request #135 from payloadcms/feat/auto-verify-first-register
feat: auto verifies first user registration
2021-04-13 12:24:33 -04:00
James
c977a7b4c5 chore: bumps type dependencies 2021-04-13 12:23:45 -04:00
James
0094837635 feat: prevents DraggableSections from re-mounting on doc save 2021-04-13 12:15:37 -04:00
Jacob Fletcher
e58b152d40 fix: clears verificationToken when _verified is true 2021-04-13 12:10:10 -04:00
Jacob Fletcher
01b0bf1bb3 chore: removes useUnmountEffect hook 2021-04-13 12:10:10 -04:00
Jacob Fletcher
8f720c000d feat: auto verifies first user registration 2021-04-13 12:10:01 -04:00
Jacob Fletcher
4d5db0520c Merge branch 'master' of github.com:payloadcms/payload into fix/config-joi-schema 2021-04-13 09:42:10 -04:00
Jacob Fletcher
afc9454465 fix: updates config schema for graphQL mutations and queries 2021-04-13 09:41:33 -04:00
Elliot DeNolf
cd02b1cef4 Merge pull request #132 from sampittko/patch-1
docs: fix typo in field types overview
2021-04-10 14:42:16 -04:00
Samuel Pitoňák
1008eada65 docs: fix typo in field types overview 2021-04-10 16:46:31 +02:00
Elliot DeNolf
ddf5df290c fix: handle add/remove labels for all usage of Array field type 2021-04-09 10:34:08 -04:00
Elliot DeNolf
000dee85bd fix: pagination calculation for current range 2021-04-06 23:32:13 -04:00
James
91d37fb41d feat: optimize save within Edit 2021-04-02 13:28:40 -04:00
James
31c41c22ec fix: ensures email is still prefilled in auth configs 2021-04-02 12:59:15 -04:00
James
dff72fbf2f fix: ensures failed conditions send path to form 2021-04-02 11:53:03 -04:00
James
988d0a4b08 feat: remembers conditional field values after removing / readding 2021-04-02 11:15:28 -04:00
764 changed files with 34315 additions and 12544 deletions

View File

@@ -28,8 +28,8 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
],
rules: {
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'import/no-unresolved': [
2,
{
@@ -38,17 +38,35 @@ module.exports = {
],
},
],
}
},
},
{
files: ['*.spec.ts'],
rules: {
'@typescript-eslint/no-use-before-define': 'off',
},
},
{
files: ['*.e2e.ts'],
rules: {
'@typescript-eslint/no-use-before-define': 'off',
'jest/expect-expect': 'off',
},
},
],
rules: {
"import/no-extraneous-dependencies": ["error", { "packageDir": "./" }],
'import/no-extraneous-dependencies': ['error', { packageDir: './' }],
'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'import/prefer-default-export': 'off',
'react/prop-types': 'off',
'react/require-default-props': 'off',
'react/no-unused-prop-types': 'off',
'no-console': 'warn',
'no-sparse-arrays': 'off',
'no-underscore-dangle': 'off',
'no-use-before-define': 'off',
'arrow-body-style': 0,
'@typescript-eslint/no-use-before-define': ['error'],
'import/extensions': [
'error',
'ignorePackages',

View File

@@ -1,5 +1,8 @@
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

View File

@@ -3,11 +3,11 @@ name: build
on: [push]
jobs:
build:
build_yarn:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
@@ -33,5 +33,33 @@ jobs:
- run: yarn build
- run: yarn test:client
- run: yarn test:int # In-memory db + api tests
- run: yarn demo:generate:types
env:
CI: true
install_npm:
runs-on: ubuntu-latest
strategy:
matrix:
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 }}

5
.gitignore vendored
View File

@@ -2,6 +2,8 @@ coverage
package-lock.json
dist
.idea
cypress/videos
cypress/screenshots
# Created by https://www.gitignore.io/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
@@ -228,3 +230,6 @@ build
# Ignore built components
components/index.js
components/styles.css
# Ignore generated
demo/generated-types.ts

25
.release-it.beta.json Normal file
View File

@@ -0,0 +1,25 @@
{
"preReleaseId": "beta",
"git": {
"requireCleanWorkingDir": false,
"commit": false,
"push": false,
"tag": false
},
"github": {
"release": false
},
"npm": {
"skipChecks": true,
"tag": "beta"
},
"hooks": {
"before:init": ["yarn", "yarn clean", "yarn test"]
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md"
}
}
}

17
.vscode/launch.json vendored
View File

@@ -18,6 +18,7 @@
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/babel-node",
"port": 9229,
"skipFiles": [
"<node_internals>/**"
@@ -54,6 +55,7 @@
"<node_internals>/**"
],
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/babel-node",
"outputCapture": "std",
"runtimeArgs": [
"--nolazy"
],
@@ -64,6 +66,19 @@
"name": "Launch Chrome against Localhost",
"url": "http://localhost:3000/admin",
"webRoot": "${workspaceFolder}"
}
},
{
"type": "node",
"request": "launch",
"name": "Debug Payload Generate Types",
"program": "${workspaceFolder}/src/bin/generateTypes.ts",
"env": {
"PAYLOAD_CONFIG_PATH": "demo/payload.config.ts",
},
"outFiles": [
"${workspaceFolder}/dist/**/*.js",
"!**/node_modules/**"
]
},
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,19 @@
<h1 align="center">Payload</h1>
<p align="center">A self-hosted, JavaScript headless CMS & application framework built with Express, MongoDB and React.</p>
<p align="center">A self-hosted, TypeScript / JavaScript headless CMS & application framework built with Express, MongoDB and React.</p>
<p align="center">
<a href="https://github.com/payloadcms/payload/actions">
<img src="https://github.com/payloadcms/payload/workflows/build/badge.svg">
<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">
<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">
<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" />
</a>
</p>

5
SECURITY.md Normal file
View File

@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
Please report any security issues or concerns to [info@payloadcms.com](mailto:info@payloadcms.com).

3
babel.js Normal file
View File

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

4
components/elements.ts Normal file
View File

@@ -0,0 +1,4 @@
export { default as Button } from '../dist/admin/components/elements/Button';
export { default as Card } from '../dist/admin/components/elements/Card';
export { default as Eyebrow } from '../dist/admin/components/elements/Eyebrow';
export { default as Nav } from '../dist/admin/components/elements/Nav';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

2
components/fields/Row.ts Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,14 +6,23 @@ export {
useFormModified,
} from '../dist/admin/components/forms/Form/context';
export { default as useFieldType } from '../dist/admin/components/forms/useFieldType';
export { default as useField } from '../dist/admin/components/forms/useField';
export { default as useFieldType } from '../dist/admin/components/forms/useField';
export { default as Form } from '../dist/admin/components/forms/Form';
export { default as Text } from '../dist/admin/components/forms/field-types/Text';
export { default as TextInput } from '../dist/admin/components/forms/field-types/Text/Input';
export { default as Group } from '../dist/admin/components/forms/field-types/Group';
export { default as Select } from '../dist/admin/components/forms/field-types/Select';
export { default as SelectInput } from '../dist/admin/components/forms/field-types/Select/Input';
export { default as Checkbox } from '../dist/admin/components/forms/field-types/Checkbox';
export { default as Submit } from '../dist/admin/components/forms/Submit';
export { default as Label } from '../dist/admin/components/forms/Label';
export { default as reduceFieldsToValues } from '../dist/admin/components/forms/Form/reduceFieldsToValues';
export { default as withCondition } from '../dist/admin/components/forms/withCondition';

1
components/hooks.ts Normal file
View File

@@ -0,0 +1 @@
export { useStepNav } from '../dist/admin/components/elements/StepNav';

2
components/icons.ts Normal file
View File

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

1
components/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from '../dist/admin/components';

View File

@@ -0,0 +1 @@
export { usePreferences } from '../dist/admin/components/utilities/Preferences';

2
components/templates.ts Normal file
View File

@@ -0,0 +1,2 @@
export { default as DefaultTemplate } from '../dist/admin/components/templates/Default';
export { default as MinimalTemplate } from '../dist/admin/components/templates/Minimal';

2
components/utilities.ts Normal file
View File

@@ -0,0 +1,2 @@
export { default as Meta } from '../dist/admin/components/utilities/Meta';
export { useLocale } from '../dist/admin/components/utilities/Locale';

View File

@@ -1,2 +0,0 @@
export { default as Edit } from '../dist/admin/components/views/collections/Edit/Default';
export { default as List } from '../dist/admin/components/views/collections/List/Default';

3
components/views/Cell.ts Normal file
View File

@@ -0,0 +1,3 @@
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';

View File

@@ -0,0 +1,3 @@
export { default as Dashboard } from '../../dist/admin/components/views/Dashboard/Default';
export type { Props } from '../../dist/admin/components/views/Dashboard/types';

3
components/views/Edit.ts Normal file
View File

@@ -0,0 +1,3 @@
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';

3
components/views/List.ts Normal file
View File

@@ -0,0 +1,3 @@
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';

8
cypress.json Normal file
View File

@@ -0,0 +1,8 @@
{
"$schema": "https://on.cypress.io/cypress.schema.json",
"testFiles": "**/*e2e.ts",
"ignoreTestFiles": "**/examples/*spec.js",
"viewportWidth": 1440,
"viewportHeight": 900,
"baseUrl": "http://localhost:3000"
}

16
cypress/cypress.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
export { };
declare global {
namespace Cypress {
interface Chainable<Subject> {
visitAdmin(): Chainable<any>
/**
* Login
*
* Creates user if not exists
*/
login(): Chainable<any>
apiLogin(): Chainable<any>
}
}
}

View File

@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@@ -0,0 +1,43 @@
import { adminURL } from './common/constants';
import { credentials } from './common/credentials';
describe('Collections', () => {
const collectionName = 'Admins';
before(() => {
cy.apiLogin();
});
beforeEach(() => {
cy.visitAdmin();
});
it('can view collection', () => {
cy.contains(collectionName).click();
cy.get('.collection-list__wrap')
.should('be.visible');
cy.get('.collection-list__header')
.contains(collectionName)
.should('be.visible');
cy.get('.table')
.contains(credentials.email)
.should('be.visible');
});
it('can create new', () => {
cy.contains(collectionName).click();
cy.contains('Create New').click();
cy.url().should('eq', `${adminURL}/collections/${collectionName.toLowerCase()}/create`);
});
it('can create new - plus button', () => {
cy.contains(collectionName)
.get('.card__actions')
.first()
.click();
cy.url().should('eq', `${adminURL}/collections/${collectionName.toLowerCase()}/create`);
});
});

View File

@@ -0,0 +1 @@
export const adminURL = 'http://localhost:3000/admin';

View File

@@ -0,0 +1,4 @@
export const credentials = {
email: 'test@test.com',
password: 'test123',
};

View File

@@ -0,0 +1,89 @@
/* eslint-disable jest/expect-expect */
import { adminURL } from './common/constants';
import { credentials } from './common/credentials';
const viewportSizes: Cypress.ViewportPreset[] = ['macbook-15', 'iphone-x', 'ipad-2'];
describe.skip('Payload Login', () => {
beforeEach(() => {
cy.clearCookies();
});
after(() => {
cy.apiLogin();
});
viewportSizes.forEach((viewportSize) => {
describe(`Login (${viewportSize})`, () => {
beforeEach(() => {
cy.visit(adminURL);
});
it('success', () => {
cy.viewport(viewportSize);
cy.get('#email').type(credentials.email);
cy.get('#password').type(credentials.password);
cy.get('form')
.contains('form', 'Login')
.should('be.visible')
.submit();
cy.get('.template-default')
.find('h3.dashboard__label')
.should('have.length', 2); // TODO: Should assert label content
cy.url().should('eq', adminURL);
});
it('bad Password', () => {
cy.viewport(viewportSize);
cy.visit(adminURL);
cy.get('#email').type(credentials.email);
cy.get('#password').type('badpassword');
cy.get('form')
.contains('form', 'Login')
.should('be.visible')
.submit();
cy.get('.Toastify')
.contains('The email or password provided is incorrect.')
.should('be.visible');
});
it('bad Password - Retry Success', () => {
cy.viewport(viewportSize);
cy.visit(adminURL);
cy.get('#email').type(credentials.email);
cy.get('#password').type('badpassword');
cy.get('form')
.contains('form', 'Login')
.should('be.visible')
.submit();
cy.get('.Toastify')
.contains('The email or password provided is incorrect.')
.should('be.visible');
// Dismiss notification
cy.wait(500);
cy.get('.Toastify__toast-body').click();
cy.wait(200);
cy.get('.Toastify__toast-body').should('not.be.visible');
cy.url().should('eq', `${adminURL}/login`);
cy.get('#password').clear().type(credentials.password);
cy.get('form')
.contains('form', 'Login')
.should('be.visible')
.submit();
cy.get('.template-default')
.find('h3.dashboard__label')
.should('have.length', 2); // TODO: Should assert label content
cy.url().should('eq', adminURL);
});
});
});
});

22
cypress/plugins/index.js Normal file
View File

@@ -0,0 +1,22 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

View File

@@ -0,0 +1,54 @@
import { adminURL } from '../integration/common/constants';
import { credentials } from '../integration/common/credentials';
Cypress.Commands.add('visitAdmin', () => {
cy.visit(adminURL);
});
Cypress.Commands.add('login', () => {
cy.clearCookies();
cy.visit(adminURL);
cy.get('#email').type(credentials.email);
cy.get('#password').type(credentials.password);
cy.get('body')
.then((body) => {
if (body.find('.dashboard__card-list').length) {
cy.get('.dashboard__card-list')
.should('be.visible');
}
if (body.find('#confirm-password').length) {
cy.get('#confirm-password').type(credentials.password);
cy.get('.rs__indicators').first()
.click();
cy.get('.rs__menu').first().contains('admin')
.click();
cy.get('form')
.contains('form', 'Create')
.should('be.visible')
.submit();
}
if (body.find('form').length) {
cy.get('form')
.contains('form', 'Login')
.should('be.visible')
.submit();
}
cy.get('.dashboard__card-list')
.should('be.visible');
});
});
Cypress.Commands.add('apiLogin', () => {
cy.api({
url: '/api/admins/login',
method: 'POST',
body: credentials,
failOnStatusCode: true,
}).should(({ status }) => {
cy.wrap(status).should('equal', 200);
});
});

25
cypress/support/index.ts Normal file
View File

@@ -0,0 +1,25 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
import '@bahmutov/cy-api';
// Import commands.js using ES2015 syntax:
import './commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')
Cypress.Cookies.defaults({
preserve: 'payload-token',
});

15
cypress/tsconfig.json Normal file
View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"es5",
"dom"
],
"types": [
"cypress"
]
},
"include": [
"**/*.ts"
]
}

View File

@@ -8,13 +8,6 @@ const Quote: Block = {
plural: 'Quotes',
},
fields: [
{
name: 'author',
label: 'Author',
type: 'relationship',
relationTo: 'public-users',
required: true,
},
{
name: 'quote',
label: 'Quote',

View File

@@ -0,0 +1,16 @@
// As this is the demo folder, we import Payload SCSS functions relatively.
@import '../../../../scss';
// In your own projects, you'd import as follows:
// @import '~payload/scss';
.after-dashboard {
margin-top: base(2);
&__cards {
list-style: none;
margin: 0;
padding: 0;
}
}

View File

@@ -0,0 +1,41 @@
import { useConfig } from '@payloadcms/config-provider';
import React from 'react';
import { useHistory } from 'react-router-dom';
// As this is the demo project, we import our dependencies from the `src` directory.
import Card from '../../../../src/admin/components/elements/Card';
// In your projects, you can import as follows:
// import { Card } from 'payload/components/elements';
import './index.scss';
const baseClass = 'after-dashboard';
const AfterDashboard: React.FC = () => {
const history = useHistory();
const { routes: { admin: adminRoute } } = useConfig();
return (
<div className={baseClass}>
<h3>Custom Routes &amp; Dashboard Components</h3>
<p>This is a custom component that is rendered within the built-in dashboard component after its contents are rendered. Below, there are two cards that link to custom routes.</p>
<ul className="dashboard__card-list">
<li>
<Card
title="Default Template"
onClick={() => history.push(`${adminRoute}/custom-default-route`)}
/>
</li>
<li>
<Card
title="Minimal Template"
onClick={() => history.push(`${adminRoute}/custom-minimal-route`)}
/>
</li>
</ul>
</div>
);
};
export default AfterDashboard;

View File

@@ -0,0 +1,40 @@
import { useConfig } from '@payloadcms/config-provider';
import React from 'react';
import { NavLink } from 'react-router-dom';
// As this is the demo project, we import our dependencies from the `src` directory.
import Chevron from '../../../../src/admin/components/icons/Chevron';
// In your projects, you can import as follows:
// import { Chevron } from 'payload/components/icons';
const baseClass = 'after-nav-links';
const AfterNavLinks: React.FC = () => {
const { routes: { admin: adminRoute } } = useConfig();
return (
<div className={baseClass}>
<span className="nav__label">Custom Routes</span>
<nav>
<NavLink
activeClassName="active"
to={`${adminRoute}/custom-default-route`}
>
<Chevron />
Default Template
</NavLink>
<NavLink
activeClassName="active"
to={`${adminRoute}/custom-minimal-route`}
>
<Chevron />
Minimal Template
</NavLink>
</nav>
</div>
);
};
export default AfterNavLinks;

View File

@@ -0,0 +1,24 @@
import React from 'react';
const BeforeLogin: React.FC = () => {
return (
<div>
<h3>Welcome</h3>
<p>
This demo is a set up to configure Payload for the develop and testing of features. To see a product demo of a Payload project
please visit:
{' '}
<a
href="https://demo.payloadcms.com"
target="_blank"
rel="noreferrer"
>
demo.payloadcms.com
</a>
.
</p>
</div>
);
};
export default BeforeLogin;

View File

@@ -0,0 +1,29 @@
import React, { createContext, useState, useContext } from 'react';
type CustomContext = {
getCustom
setCustom
}
const Context = createContext({} as CustomContext);
const CustomProvider: React.FC = ({ children }) => {
const [getCustom, setCustom] = useState({});
const value = {
getCustom,
setCustom,
};
console.log('custom provider called');
return (
<Context.Provider value={value}>
{children}
</Context.Provider>
);
};
export default CustomProvider;
export const useCustom = () => useContext(Context);

View File

@@ -0,0 +1,7 @@
import React from 'react';
const DemoUIFieldCell: React.FC = () => (
<p>Demo UI Field Cell</p>
);
export default DemoUIFieldCell;

View File

@@ -0,0 +1,7 @@
import React from 'react';
const DemoUIField: React.FC = () => (
<p>Demo UI Field</p>
);
export default DemoUIField;

View File

@@ -1,4 +1,4 @@
@import '../../../../../../../scss/vars.scss';
@import '../../../../../../../src/admin/scss/styles.scss';
.button-rich-text-button {
.btn {

View File

@@ -3,10 +3,15 @@ import { Modal, useModal } from '@faceless-ui/modal';
import { Transforms } from 'slate';
import { useSlate, ReactEditor } from 'slate-react';
import MinimalTemplate from '../../../../../../../src/admin/components/templates/Minimal';
import { ElementButton } from '../../../../../../../components/rich-text';
import ElementButton from '../../../../../../../src/admin/components/forms/field-types/RichText/elements/Button';
import X from '../../../../../../../src/admin/components/icons/X';
import Button from '../../../../../../../src/admin/components/elements/Button';
import { Form, Text, Checkbox, Select, Submit, reduceFieldsToValues } from '../../../../../../../components/forms';
import Form from '../../../../../../../src/admin/components/forms/Form';
import Submit from '../../../../../../../src/admin/components/forms/Submit';
import reduceFieldsToValues from '../../../../../../../src/admin/components/forms/Form/reduceFieldsToValues';
import Text from '../../../../../../../src/admin/components/forms/field-types/Text';
import Checkbox from '../../../../../../../src/admin/components/forms/field-types/Checkbox';
import Select from '../../../../../../../src/admin/components/forms/field-types/Select';
import './index.scss';

View File

@@ -1,4 +1,4 @@
@import '../../../../../../../scss/vars.scss';
@import '../../../../../../../src/admin/scss/styles.scss';
.rich-text-button {
margin: $baseline 0;

View File

@@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import './index.scss';
@@ -27,18 +26,4 @@ const ButtonElement: React.FC = ({ attributes, children, element }) => {
);
};
ButtonElement.defaultProps = {
attributes: {},
children: null,
};
ButtonElement.propTypes = {
attributes: PropTypes.shape({}),
children: PropTypes.node,
element: PropTypes.shape({
style: PropTypes.oneOf(['primary', 'secondary']),
label: PropTypes.string,
}).isRequired,
};
export default ButtonElement;

View File

@@ -1,8 +1,9 @@
import { RichTextCustomElement } from '../../../../../../src/fields/config/types';
import Button from './Button';
import Element from './Element';
import plugin from './plugin';
export default {
const button: RichTextCustomElement = {
name: 'button',
Button,
Element,
@@ -10,3 +11,5 @@ export default {
plugin,
],
};
export default button;

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { LeafButton } from '../../../../../../../components/rich-text';
import LeafButton from '../../../../../../../src/admin/components/forms/field-types/RichText/leaves/Button';
const Button = () => (
<LeafButton format="purple-background">

View File

@@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
const PurpleBackground: React.FC<any> = ({ attributes, children }) => (
<span
@@ -10,14 +9,4 @@ const PurpleBackground: React.FC<any> = ({ attributes, children }) => (
</span>
);
PurpleBackground.defaultProps = {
attributes: {},
children: null,
};
PurpleBackground.propTypes = {
attributes: PropTypes.shape({}),
children: PropTypes.node,
};
export default PurpleBackground;

View File

@@ -0,0 +1,64 @@
import React, { useEffect } from 'react';
import { Redirect } from 'react-router-dom';
import { useConfig } from '@payloadcms/config-provider';
// As this is the demo project, we import our dependencies from the `src` directory.
import DefaultTemplate from '../../../../../src/admin/components/templates/Default';
import Button from '../../../../../src/admin/components/elements/Button';
import Eyebrow from '../../../../../src/admin/components/elements/Eyebrow';
import { AdminView } from '../../../../../src/config/types';
import { useStepNav } from '../../../../../src/admin/components/elements/StepNav';
import Meta from '../../../../../src/admin/components/utilities/Meta';
// In your projects, you can import as follows:
// import { DefaultTemplate } from 'payload/components/templates';
// import { Button, Eyebrow } from 'payload/components/elements';
// import { AdminView } from 'payload/config';
// import { useStepNav } from 'payload/components/hooks';
// import { Meta } from 'payload/components/utilities';
const CustomDefaultRoute: AdminView = ({ user, canAccessAdmin }) => {
const { routes: { admin: adminRoute } } = useConfig();
const { setStepNav } = useStepNav();
// This effect will only run one time and will allow us
// to set the step nav to display our custom route name
useEffect(() => {
setStepNav([
{
label: 'Custom Route with Default Template',
},
]);
}, [setStepNav]);
// If an unauthorized user tries to navigate straight to this page,
// Boot 'em out
if (!user || (user && !canAccessAdmin)) {
return (
<Redirect to={`${adminRoute}/unauthorized`} />
);
}
return (
<DefaultTemplate>
<Meta
title="Custom Route with Default Template"
description="Building custom routes into Payload is easy."
keywords="Custom React Components, Payload, CMS"
/>
<Eyebrow />
<h1>Custom Route</h1>
<p>Here is a custom route that was added in the Payload config. It uses the Default Template, so the sidebar is rendered.</p>
<Button
el="link"
to={`${adminRoute}`}
buttonStyle="secondary"
>
Go to Dashboard
</Button>
</DefaultTemplate>
);
};
export default CustomDefaultRoute;

View File

@@ -0,0 +1,12 @@
// As this is the demo folder, we import Payload SCSS functions relatively.
@import '../../../../../scss';
// In your own projects, you'd import as follows:
// @import '~payload/scss';
.custom-minimal-route {
&__login-btn {
margin-right: base(.5);
}
}

View File

@@ -0,0 +1,41 @@
import React from 'react';
import { useConfig } from '@payloadcms/config-provider';
// As this is the demo project, we import our dependencies from the `src` directory.
import MinimalTemplate from '../../../../../src/admin/components/templates/Minimal';
import Button from '../../../../../src/admin/components/elements/Button';
// In your projects, you can import as follows:
// import { MinimalTemplate } from 'payload/components/templates';
// import { Button } from 'payload/components/elements';
import './index.scss';
const baseClass = 'custom-minimal-route';
const CustomMinimalRoute: React.FC = () => {
const { routes: { admin: adminRoute } } = useConfig();
return (
<MinimalTemplate className={baseClass}>
<h1>Custom Route</h1>
<p>Here is a custom route that was added in the Payload config.</p>
<Button
className={`${baseClass}__login-btn`}
el="link"
to={`${adminRoute}/login`}
>
Go to Login
</Button>
<Button
el="link"
to={`${adminRoute}`}
buttonStyle="secondary"
>
Go to Dashboard
</Button>
</MinimalTemplate>
);
};
export default CustomMinimalRoute;

View File

@@ -1,4 +1,4 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
import roles from '../access/roles';
import checkRole from '../access/checkRole';
@@ -7,7 +7,7 @@ const access = ({ req: { user } }) => {
return result;
};
const Admin: PayloadCollectionConfig = {
const Admin: CollectionConfig = {
slug: 'admins',
labels: {
singular: 'Admin',
@@ -44,23 +44,17 @@ const Admin: PayloadCollectionConfig = {
saveToJWT: true,
hasMany: true,
},
{
name: 'publicUser',
type: 'relationship',
hasMany: true,
relationTo: 'public-users',
},
{
name: 'apiKey',
type: 'text',
access: {
read: ({ req: { user } }) => {
if (checkRole(['admin'], user)) {
return true;
}
if (user) {
return {
email: user.email,
};
}
return false;
},
read: ({ req: { user } }) => checkRole(['admin'], user),
},
},
],

View File

@@ -1,25 +1,37 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
import checkRole from '../access/checkRole';
import Email from '../blocks/Email';
import Quote from '../blocks/Quote';
import NumberBlock from '../blocks/Number';
import CallToAction from '../blocks/CallToAction';
import CollectionDescription from '../customComponents/CollectionDescription';
import DemoUIField from '../client/components/DemoUIField/Field';
import DemoUIFieldCell from '../client/components/DemoUIField/Cell';
const AllFields: PayloadCollectionConfig = {
const AllFields: CollectionConfig = {
slug: 'all-fields',
labels: {
singular: 'All Fields',
plural: 'All Fields',
},
admin: {
defaultColumns: ['text', 'demo', 'createdAt'],
useAsTitle: 'text',
preview: (doc, token) => {
if (doc && doc.text) {
return `http://localhost:3000/previewable-posts/${doc.text}?preview=true&token=${token}`;
preview: (doc, { token }) => {
const { text } = doc;
if (doc && text) {
return `http://localhost:3000/previewable-posts/${text}?preview=true&token=${token}`;
}
return null;
},
description: CollectionDescription,
},
versions: {
maxPerDoc: 20,
retainDeleted: true,
drafts: false,
},
access: {
read: () => true,
@@ -38,11 +50,33 @@ const AllFields: PayloadCollectionConfig = {
read: ({ req: { user } }) => Boolean(user),
},
},
{
name: 'descriptionText',
type: 'text',
label: 'Text with text description',
defaultValue: 'Default Value',
admin: {
description: 'This text describes the field',
},
},
{
name: 'descriptionFunction',
type: 'text',
label: 'Text with function description',
defaultValue: 'Default Value',
maxLength: 20,
admin: {
description: ({ value }) => (typeof value === 'string' ? `${20 - value.length} characters left` : ''),
},
},
{
name: 'image',
type: 'upload',
label: 'Image',
relationTo: 'media',
admin: {
description: 'No selfies',
},
},
{
name: 'select',
@@ -85,20 +119,11 @@ const AllFields: PayloadCollectionConfig = {
required: true,
hasMany: true,
},
{
name: 'dateFieldExample',
label: 'Day and Time',
type: 'date',
admin: {
date: {
timeIntervals: 30,
},
},
},
{
name: 'dayOnlyDateFieldExample',
label: 'Day Only',
type: 'date',
required: true,
admin: {
date: {
pickerAppearance: 'dayOnly',
@@ -116,6 +141,11 @@ const AllFields: PayloadCollectionConfig = {
},
},
},
{
name: 'point',
label: 'Point Field (GeoJSON)',
type: 'point',
},
{
name: 'radioGroupExample',
label: 'Radio Group Example',
@@ -234,6 +264,9 @@ const AllFields: PayloadCollectionConfig = {
label: 'Relationship to One Collection',
name: 'relationship',
relationTo: 'conditions',
admin: {
description: 'Relates to description',
},
},
{
type: 'relationship',
@@ -252,6 +285,26 @@ const AllFields: PayloadCollectionConfig = {
type: 'textarea',
label: 'Textarea',
name: 'textarea',
admin: {
description: 'Hello textarea description',
},
},
{
name: 'richText',
type: 'richText',
label: 'Rich Text',
required: true,
},
{
type: 'ui',
name: 'demo',
admin: {
position: 'sidebar',
components: {
Field: DemoUIField,
Cell: DemoUIFieldCell,
},
},
},
{
name: 'slug',
@@ -273,29 +326,14 @@ const AllFields: PayloadCollectionConfig = {
},
},
{
name: 'richText',
type: 'richText',
label: 'Rich Text',
required: true,
name: 'dateFieldExample',
label: 'Day and Time',
type: 'date',
admin: {
elements: [
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'blockquote',
'ul',
'ol',
'link',
],
leaves: [
'bold',
'italic',
'underline',
'strikethrough',
],
position: 'sidebar',
date: {
timeIntervals: 30,
},
},
},
],

View File

@@ -1,12 +1,102 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
const AutoLabel: PayloadCollectionConfig = {
const AutoLabel: CollectionConfig = {
slug: 'auto-label',
fields: [{
name: 'text',
type: 'text',
label: 'Text',
}],
admin: {
useAsTitle: 'autoLabelField',
enableRichTextRelationship: true,
},
fields: [
{
name: 'autoLabelField',
type: 'text',
},
{
name: 'noLabel',
type: 'text',
label: false,
},
{
name: 'labelOverride',
type: 'text',
label: 'Custom Label',
},
{
name: 'testRelationship',
type: 'relationship',
relationTo: 'all-fields',
},
{
name: 'specialBlock',
type: 'blocks',
minRows: 1,
maxRows: 20,
// Will auto-label
// labels: {
// singular: 'Special Block',
// plural: 'Special Blocks',
// },
blocks: [
{
slug: 'number',
// Will auto-label
// labels: {
// singular: 'Number',
// plural: 'Numbers',
// },
fields: [
{
name: 'testNumber',
type: 'number',
},
],
},
],
},
{
name: 'noLabelBlock',
type: 'blocks',
label: false,
minRows: 1,
maxRows: 20,
blocks: [
{
slug: 'number',
// labels: {
// singular: 'Number',
// plural: 'Numbers',
// },
fields: [
{
name: 'testNumber',
type: 'number',
},
],
},
],
},
{
name: 'items',
type: 'array',
fields: [
{
name: 'itemName',
type: 'text',
},
],
},
{
name: 'noLabelArray',
type: 'array',
label: false,
fields: [
{
type: 'text',
name: 'textField',
},
],
},
],
};
export default AutoLabel;

View File

@@ -0,0 +1,69 @@
import { CollectionConfig } from '../../src/collections/config/types';
const Autosave: CollectionConfig = {
slug: 'autosave-posts',
labels: {
singular: 'Autosave Post',
plural: 'Autosave Posts',
},
admin: {
useAsTitle: 'title',
defaultColumns: [
'title',
'description',
'createdAt',
],
preview: () => 'https://payloadcms.com',
},
versions: {
maxPerDoc: 35,
retainDeleted: false,
drafts: {
autosave: {
interval: 2000,
},
},
},
access: {
read: ({ req: { user } }) => {
if (user) {
return true;
}
return {
or: [
{
_status: {
equals: 'published',
},
},
{
_status: {
exists: false,
},
},
],
};
},
readVersions: ({ req: { user } }) => Boolean(user),
},
fields: [
{
name: 'title',
label: 'Title',
type: 'text',
required: true,
unique: true,
localized: true,
},
{
name: 'description',
label: 'Description',
type: 'textarea',
required: true,
},
],
timestamps: true,
};
export default Autosave;

View File

@@ -1,10 +1,10 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
import Email from '../blocks/Email';
import Quote from '../blocks/Quote';
import NumberBlock from '../blocks/Number';
import CallToAction from '../blocks/CallToAction';
const Blocks: PayloadCollectionConfig = {
const Blocks: CollectionConfig = {
slug: 'blocks',
labels: {
singular: 'Blocks',
@@ -13,6 +13,9 @@ const Blocks: PayloadCollectionConfig = {
access: {
read: () => true,
},
versions: {
drafts: true,
},
fields: [
{
name: 'layout',

View File

@@ -1,6 +1,6 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
const Code: PayloadCollectionConfig = {
const Code: CollectionConfig = {
slug: 'code',
labels: {
singular: 'Code',
@@ -14,6 +14,7 @@ const Code: PayloadCollectionConfig = {
required: true,
admin: {
language: 'js',
description: 'javascript example',
},
},
],

View File

@@ -1,6 +1,10 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
import Email from '../blocks/Email';
import Quote from '../blocks/Quote';
import NumberBlock from '../blocks/Number';
import CallToAction from '../blocks/CallToAction';
const Conditions: PayloadCollectionConfig = {
const Conditions: CollectionConfig = {
slug: 'conditions',
labels: {
singular: 'Conditions',
@@ -49,6 +53,20 @@ const Conditions: PayloadCollectionConfig = {
condition: (_, siblings) => (siblings.number > 20 && siblings.enableTest === true) || (siblings.number < 20 && siblings.enableTest === false),
},
},
{
name: 'blocks',
label: 'Blocks',
labels: {
singular: 'Block',
plural: 'Blocks',
},
type: 'blocks',
blocks: [Email, NumberBlock, Quote, CallToAction],
required: true,
admin: {
condition: (_, siblings) => siblings?.enableTest === true,
},
},
],
};

View File

@@ -0,0 +1,61 @@
import React, { useCallback } from 'react';
import SelectInput from '../../../../../../../src/admin/components/forms/field-types/Select/Input';
import { Props as SelectFieldType } from '../../../../../../../src/admin/components/forms/field-types/Select/types';
import useField from '../../../../../../../src/admin/components/forms/useField';
const Select: React.FC<SelectFieldType> = (props) => {
const {
path,
name,
label,
options,
} = props;
const {
showError,
value,
setValue,
} = useField({
path,
});
const onChange = useCallback((incomingOption) => {
const { value: incomingValue } = incomingOption;
const sendToCRM = async () => {
try {
const req = await fetch('https://fake-crm.com', {
method: 'post',
body: JSON.stringify({
someKey: incomingValue,
}),
});
const res = await req.json();
if (res.ok) {
console.log('Successfully synced to CRM.'); // eslint-disable-line no-console
}
} catch (e) {
console.error(e);
}
};
sendToCRM();
setValue(incomingValue);
}, [
setValue,
]);
return (
<SelectInput
name={name}
label={label}
options={options}
value={value as string}
onChange={onChange}
showError={showError}
/>
);
};
export default Select;

View File

@@ -0,0 +1,44 @@
import React, { useCallback } from 'react';
import TextInput from '../../../../../../../src/admin/components/forms/field-types/Text/Input';
import { Props as TextFieldType } from '../../../../../../../src/admin/components/forms/field-types/Text/types';
import useField from '../../../../../../../src/admin/components/forms/useField';
const Text: React.FC<TextFieldType> = (props) => {
const {
path,
name,
label,
} = props;
const field = useField({
path,
enableDebouncedValue: true,
});
const {
showError,
value,
setValue,
} = field;
const onChange = useCallback((e) => {
const { value: incomingValue } = e.target;
const valueWithoutSpaces = incomingValue.replace(/\s/g, '');
setValue(valueWithoutSpaces);
}, [
setValue,
]);
return (
<TextInput
path={path}
name={name}
value={value as string || ''}
label={label}
onChange={onChange}
showError={showError}
/>
);
};
export default Text;

View File

@@ -0,0 +1,41 @@
import React, { useCallback } from 'react';
import TextAreaInput from '../../../../../../../src/admin/components/forms/field-types/Textarea/Input';
import { Props as TextFieldType } from '../../../../../../../src/admin/components/forms/field-types/Text/types';
import useField from '../../../../../../../src/admin/components/forms/useField';
const TextArea: React.FC<TextFieldType> = (props) => {
const {
path,
name,
label,
} = props;
const field = useField({
path,
});
const {
showError,
value,
setValue,
} = field;
const onChange = useCallback((e) => {
const { value: incomingValue } = e.target;
setValue(incomingValue);
}, [
setValue,
]);
return (
<TextAreaInput
name={name}
value={value as string || ''}
label={label}
onChange={onChange}
showError={showError}
/>
);
};
export default TextArea;

View File

@@ -0,0 +1,50 @@
import React, { useCallback } from 'react';
import TextInput from '../../../../../../../src/admin/components/forms/field-types/Text';
import { UIField as UIFieldType } from '../../../../../../../src/fields/config/types';
import SelectInput from '../../../../../../../src/admin/components/forms/field-types/Select';
const UIField: React.FC<UIFieldType> = () => {
const [textValue, setTextValue] = React.useState('');
const [selectValue, setSelectValue] = React.useState('');
const onTextChange = useCallback((incomingValue) => {
setTextValue(incomingValue);
}, [])
const onSelectChange = useCallback((incomingValue) => {
setSelectValue(incomingValue);
}, [])
return (
<div>
<TextInput
name="ui-text"
label="Presentation-only text field (does not submit)"
value={textValue as string}
onChange={onTextChange}
/>
<SelectInput
name="ui-select"
label="Presentation-only select field (does not submit)"
options={[
{
label: 'Option 1',
value: 'option-1'
},
{
label: 'Option 2',
value: 'option-2'
},
{
label: 'Option 3',
value: 'option-4'
}
]}
value={selectValue as string}
onChange={onSelectChange}
/>
</div>
)
};
export default UIField;

View File

@@ -0,0 +1,57 @@
import { useConfig } from '@payloadcms/config-provider';
import React, { useCallback } from 'react';
import UploadInput from '../../../../../../../src/admin/components/forms/field-types/Upload/Input';
import { Props as UploadFieldType } from '../../../../../../../src/admin/components/forms/field-types/Upload/types';
import useField from '../../../../../../../src/admin/components/forms/useField';
import { SanitizedCollectionConfig } from '../../../../../../../src/collections/config/types';
const Text: React.FC<UploadFieldType> = (props) => {
const {
path,
name,
label,
relationTo,
fieldTypes,
} = props;
const {
value,
setValue,
showError,
} = useField({
path,
});
const onChange = useCallback((incomingValue) => {
const incomingID = incomingValue?.id || incomingValue;
setValue(incomingID);
}, [setValue]);
const {
collections,
serverURL,
routes: {
api,
},
} = useConfig();
const collection = collections.find((coll) => coll.slug === relationTo) || undefined;
return (
<UploadInput
path={path}
relationTo={relationTo}
fieldTypes={fieldTypes}
name={name}
label={label}
value={value as string}
onChange={onChange}
showError={showError}
collection={collection as SanitizedCollectionConfig}
serverURL={serverURL}
api={api}
/>
);
};
export default Text;

View File

@@ -1,14 +1,20 @@
import { PayloadCollectionConfig } from '../../../src/collections/config/types';
import { CollectionConfig } from '../../../src/collections/config/types';
import DescriptionField from './components/fields/Description/Field';
import TextField from './components/fields/Text/Field';
import SelectField from './components/fields/Select/Field';
import TextAreaField from './components/fields/TextArea/Field';
import UploadField from './components/fields/Upload/Field';
import DescriptionCell from './components/fields/Description/Cell';
import DescriptionFilter from './components/fields/Description/Filter';
import NestedArrayField from './components/fields/NestedArrayCustomField/Field';
import GroupField from './components/fields/Group/Field';
import NestedGroupField from './components/fields/NestedGroupCustomField/Field';
import NestedText1Field from './components/fields/NestedText1/Field';
import UIField from './components/fields/UI/Field';
import ListView from './components/views/List';
import CustomDescriptionComponent from '../../customComponents/Description';
const CustomComponents: PayloadCollectionConfig = {
const CustomComponents: CollectionConfig = {
slug: 'custom-components',
labels: {
singular: 'Custom Component',
@@ -22,14 +28,113 @@ const CustomComponents: PayloadCollectionConfig = {
maxLength: 100,
required: true,
unique: true,
localized: true,
},
{
name: 'normalText',
label: 'Normal text field',
type: 'text',
// required: true,
},
{
name: 'customText',
label: 'Custom text field (removes whitespace)',
type: 'text',
// required: true,
admin: {
components: {
Field: TextField,
},
},
},
{
name: 'normalSelect',
label: 'Normal select field',
type: 'select',
options: [
{
label: 'Option 1',
value: '1',
},
{
label: 'Option 2',
value: '2',
},
{
label: 'Option 3',
value: '3',
},
],
},
{
name: 'customSelect',
label: 'Custom select field (syncs value with crm)',
type: 'select',
options: [
{
label: 'Option 1',
value: '1',
},
{
label: 'Option 2',
value: '2',
},
{
label: 'Option 3',
value: '3',
},
],
admin: {
components: {
Field: SelectField,
},
},
},
{
name: 'normalTextarea',
label: 'Normal textarea field',
type: 'textarea',
},
{
name: 'customTextarea',
label: 'Custom textarea field',
type: 'textarea',
admin: {
components: {
Field: TextAreaField,
},
},
},
{
name: 'ui',
label: 'UI',
type: 'ui',
admin: {
components: {
Field: UIField,
},
},
},
{
name: 'normalUpload',
label: 'Normal upload field',
type: 'upload',
relationTo: 'media',
},
{
name: 'customUpload',
label: 'Custom upload field',
type: 'upload',
relationTo: 'media',
admin: {
components: {
Field: UploadField,
},
},
},
{
name: 'description',
label: 'Description',
type: 'textarea',
required: true,
localized: true,
admin: {
components: {
Field: DescriptionField,
@@ -38,6 +143,14 @@ const CustomComponents: PayloadCollectionConfig = {
},
},
},
{
name: 'componentDescription',
label: 'Component ViewDescription',
type: 'text',
admin: {
description: CustomDescriptionComponent,
},
},
{
name: 'array',
label: 'Array',

View File

@@ -0,0 +1,22 @@
import { CollectionConfig } from '../../src/collections/config/types';
const CustomID: CollectionConfig = {
slug: 'custom-id',
labels: {
singular: 'CustomID',
plural: 'CustomIDs',
},
fields: [
{
name: 'id',
type: 'number',
},
{
name: 'name',
type: 'text',
required: true,
},
],
};
export default CustomID;

View File

@@ -1,11 +1,11 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
import checkRole from '../access/checkRole';
import Email from '../blocks/Email';
import Quote from '../blocks/Quote';
import NumberBlock from '../blocks/Number';
import CallToAction from '../blocks/CallToAction';
const DefaultValues: PayloadCollectionConfig = {
const DefaultValues: CollectionConfig = {
slug: 'default-values',
labels: {
singular: 'Default Value Test',
@@ -112,7 +112,8 @@ const DefaultValues: PayloadCollectionConfig = {
label: 'Group',
name: 'group',
defaultValue: {
nestedText1: 'neat',
nestedText2: 'nested default text 2',
nestedText3: 'neat',
},
fields: [
{
@@ -122,12 +123,16 @@ const DefaultValues: PayloadCollectionConfig = {
name: 'nestedText1',
label: 'Nested Text 1',
type: 'text',
defaultValue: 'nested default text 1',
}, {
defaultValue: 'this should take priority',
},
{
name: 'nestedText2',
label: 'Nested Text 2',
type: 'text',
defaultValue: 'nested default text 2',
},
{
name: 'nestedText3',
type: 'text',
},
],
},
@@ -143,6 +148,7 @@ const DefaultValues: PayloadCollectionConfig = {
defaultValue: [
{
arrayText1: 'Get out',
arrayText2: 'Get in',
},
],
fields: [
@@ -281,6 +287,42 @@ const DefaultValues: PayloadCollectionConfig = {
children: [{ text: 'Cookin now' }],
}],
},
{
type: 'array',
name: 'asyncArray',
defaultValue: () => {
return [{ child: 'ok' }];
},
fields: [
{
name: 'child',
type: 'text',
defaultValue: () => {
return 'async child';
},
},
],
},
{
name: 'asyncText',
type: 'text',
defaultValue: async (): Promise<string> => {
return new Promise((resolve) => setTimeout(() => {
resolve('asyncFunction');
}, 50));
},
},
{
name: 'function',
type: 'text',
defaultValue: (args): string => {
const { locale } = args;
if (locale === 'en') {
return 'function';
}
return '';
},
},
],
timestamps: true,
};

View File

@@ -1,4 +1,4 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
import checkRole from '../access/checkRole';
const access = ({ req: { user } }) => {
@@ -19,7 +19,7 @@ const access = ({ req: { user } }) => {
return false;
};
const Files: PayloadCollectionConfig = {
const Files: CollectionConfig = {
slug: 'files',
labels: {
singular: 'File',

View File

@@ -0,0 +1,90 @@
/* eslint-disable no-param-reassign */
import { CollectionConfig } from '../../src/collections/config/types';
const validateFieldTransformAction = (hook: string, value) => {
if (value !== undefined && value !== null && !Array.isArray(value)) {
console.error(hook, value);
throw new Error('Field transformAction should convert value to array [x, y] and not { coordinates: [x, y] }');
}
return value;
};
const Geolocation: CollectionConfig = {
slug: 'geolocation',
labels: {
singular: 'Geolocation',
plural: 'Geolocations',
},
access: {
read: () => true,
},
hooks: {
beforeRead: [
(operation) => operation.doc,
],
beforeChange: [
(operation) => {
operation.data.beforeChange = !operation.data.location?.coordinates;
return operation.data;
},
],
afterRead: [
(operation) => {
const { doc } = operation;
doc.afterReadHook = !doc.location?.coordinates;
return doc;
},
],
afterChange: [
(operation) => {
const { doc } = operation;
doc.afterChangeHook = !doc.location?.coordinates;
return doc;
},
],
afterDelete: [
(operation) => {
const { doc } = operation;
operation.doc.afterDeleteHook = !doc.location?.coordinates;
return doc;
},
],
},
fields: [
{
name: 'location',
type: 'point',
label: 'Location',
hooks: {
beforeValidate: [({ value }) => validateFieldTransformAction('beforeValidate', value)],
beforeChange: [({ value }) => validateFieldTransformAction('beforeChange', value)],
afterChange: [({ value }) => validateFieldTransformAction('afterChange', value)],
afterRead: [({ value }) => validateFieldTransformAction('afterRead', value)],
},
},
{
name: 'localizedPoint',
type: 'point',
label: 'Localized Point',
localized: true,
hooks: {
beforeValidate: [({ value }) => validateFieldTransformAction('beforeValidate', value)],
beforeChange: [({ value }) => validateFieldTransformAction('beforeChange', value)],
afterChange: [({ value }) => validateFieldTransformAction('afterChange', value)],
afterRead: [({ value }) => validateFieldTransformAction('afterRead', value)],
},
},
{
type: 'group',
name: 'group',
fields: [
{
name: 'point',
type: 'point',
},
],
},
],
};
export default Geolocation;

View File

@@ -1,6 +1,6 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
const HiddenFields: PayloadCollectionConfig = {
const HiddenFields: CollectionConfig = {
slug: 'hidden-fields',
labels: {
singular: 'Hidden Fields',
@@ -21,13 +21,21 @@ const HiddenFields: PayloadCollectionConfig = {
hidden: true,
},
required: true,
defaultValue: 'should be hidden from admin, visible in API',
},
{
name: 'hiddenAPI',
type: 'text',
label: 'Hidden on API',
hidden: true,
required: true, // this should not matter
required: true,
hooks: {
beforeValidate: [
({ value }) => {
return value || 'should be hidden from API';
},
],
},
},
],
};

View File

@@ -1,8 +1,10 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-param-reassign, no-console */
// If importing outside of demo project, should import CollectionAfterReadHook, CollectionBeforeChangeHook, etc
import { AfterChangeHook, AfterDeleteHook, AfterReadHook, BeforeChangeHook, BeforeDeleteHook, BeforeReadHook, CollectionConfig } from '../../src/collections/config/types';
import { FieldHook } from '../../src/fields/config/types';
import { Hook } from '../payload-types';
import { PayloadCollectionConfig } from '../../src/collections/config/types';
const Hooks: PayloadCollectionConfig = {
const Hooks: CollectionConfig = {
slug: 'hooks',
labels: {
singular: 'Hook',
@@ -19,51 +21,52 @@ const Hooks: PayloadCollectionConfig = {
},
hooks: {
beforeRead: [
(operation) => {
((operation) => {
if (operation.req.headers.hook === 'beforeRead') {
console.log('before reading Hooks document');
}
},
}) as BeforeReadHook<Hook>,
],
beforeChange: [
(operation) => {
((operation) => {
if (operation.req.headers.hook === 'beforeChange') {
operation.data.description += '-beforeChangeSuffix';
}
return operation.data;
},
}) as BeforeChangeHook<Hook>,
],
beforeDelete: [
(operation) => {
((operation) => {
if (operation.req.headers.hook === 'beforeDelete') {
// TODO: Find a better hook operation to assert against in tests
operation.req.headers.hook = 'afterDelete';
}
},
}) as BeforeDeleteHook,
],
afterRead: [
(operation) => {
const { doc } = operation;
((operation) => {
const { doc, findMany } = operation;
doc.afterReadHook = true;
doc.findMany = findMany;
return doc;
},
}) as AfterReadHook<Hook & { afterReadHook: boolean, findMany: boolean }>,
],
afterChange: [
(operation) => {
((operation) => {
if (operation.req.headers.hook === 'afterChange') {
operation.doc.afterChangeHook = true;
}
return operation.doc;
},
}) as AfterChangeHook<Hook & { afterChangeHook: boolean }>,
],
afterDelete: [
(operation) => {
((operation) => {
if (operation.req.headers.hook === 'afterDelete') {
operation.doc.afterDeleteHook = true;
}
return operation.doc;
},
}) as AfterDeleteHook,
],
},
fields: [
@@ -77,7 +80,7 @@ const Hooks: PayloadCollectionConfig = {
localized: true,
hooks: {
afterRead: [
({ value }) => (value ? value.toUpperCase() : null),
({ value }) => (value ? value.toUpperCase() : null) as FieldHook<Hook, 'title'>,
],
},
},

View File

@@ -0,0 +1,22 @@
import { CollectionConfig } from '../../src/collections/config/types';
const Images: CollectionConfig = {
slug: 'images',
admin: {
description: 'Used to test upload relationship queries',
},
labels: {
singular: 'Image',
plural: 'Images',
},
fields: [
{
name: 'upload',
type: 'upload',
relationTo: 'media',
},
],
timestamps: true,
};
export default Images;

View File

@@ -1,6 +1,6 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
const LocalOperations: PayloadCollectionConfig = {
const LocalOperations: CollectionConfig = {
slug: 'local-operations',
labels: {
singular: 'Local Operation',
@@ -15,7 +15,7 @@ const LocalOperations: PayloadCollectionConfig = {
});
const blocksGlobal = await req.payload.findGlobal({
global: 'blocks-global',
slug: 'blocks-global',
});
formattedData.localizedPosts = localizedPosts;

View File

@@ -1,6 +1,15 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
import { PayloadRequest } from '../../src/express/types';
import { Block } from '../../src/fields/config/types';
const validateLocalizationTransform = (hook: string, value, req: PayloadRequest) => {
if (req.locale !== 'all' && value !== undefined && typeof value !== 'string' && value !== null) {
console.error(hook, value);
throw new Error('Locale transformation should happen before hook is called');
}
return value;
};
const RichTextBlock: Block = {
slug: 'richTextBlock',
labels: {
@@ -12,11 +21,14 @@ const RichTextBlock: Block = {
name: 'content',
localized: true,
type: 'richText',
admin: {
hideGutter: true,
},
},
],
};
const LocalizedPosts: PayloadCollectionConfig = {
const LocalizedPosts: CollectionConfig = {
slug: 'localized-posts',
labels: {
singular: 'Localized Post',
@@ -43,6 +55,12 @@ const LocalizedPosts: PayloadCollectionConfig = {
required: true,
unique: true,
localized: true,
hooks: {
beforeValidate: [({ value, req }) => validateLocalizationTransform('beforeValidate', value, req)],
beforeChange: [({ value, req }) => validateLocalizationTransform('beforeChange', value, req)],
afterChange: [({ value, req }) => validateLocalizationTransform('afterChange', value, req)],
afterRead: [({ value, req }) => validateLocalizationTransform('afterRead', value, req)],
},
},
{
name: 'summary',
@@ -66,7 +84,6 @@ const LocalizedPosts: PayloadCollectionConfig = {
name: 'priority',
label: 'Priority',
type: 'number',
required: true,
localized: true,
},
{
@@ -80,6 +97,11 @@ const LocalizedPosts: PayloadCollectionConfig = {
name: 'text',
label: 'Text',
},
{
type: 'text',
name: 'demoHiddenField',
hidden: true,
},
],
},
{

View File

@@ -1,4 +1,4 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
import { FieldAccess } from '../../src/fields/config/types';
import checkRole from '../access/checkRole';
@@ -7,12 +7,12 @@ const PublicReadabilityAccess: FieldAccess = ({ req: { user }, siblingData }) =>
return true;
}
if (siblingData.allowPublicReadability) return true;
if (siblingData?.allowPublicReadability) return true;
return false;
};
const LocalizedArrays: PayloadCollectionConfig = {
const LocalizedArrays: CollectionConfig = {
slug: 'localized-arrays',
labels: {
singular: 'Localized Array',
@@ -24,7 +24,7 @@ const LocalizedArrays: PayloadCollectionConfig = {
fields: [
{
type: 'array',
label: 'Array',
label: false,
name: 'array',
localized: true,
required: true,

View File

@@ -1,6 +1,17 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig, BeforeChangeHook } from '../../src/collections/config/types';
const Media: PayloadCollectionConfig = {
const checkForUploadSizesHook: BeforeChangeHook = ({ req: { payloadUploadSizes }, data }) => {
if (typeof payloadUploadSizes === 'object') {
return {
...data,
foundUploadSizes: true,
};
}
return data;
};
const Media: CollectionConfig = {
slug: 'media',
labels: {
singular: 'Media',
@@ -11,12 +22,24 @@ const Media: PayloadCollectionConfig = {
},
admin: {
enableRichTextRelationship: true,
description: 'No selfies please',
},
hooks: {
beforeChange: [
checkForUploadSizesHook,
],
},
upload: {
staticURL: '/media',
staticDir: './media',
adminThumbnail: ({ doc }) => `/media/${doc.filename}`,
imageSizes: [
{
name: 'maintainedAspectRatio',
width: 1024,
height: null,
crop: 'center',
},
{
name: 'tablet',
width: 640,
@@ -35,6 +58,9 @@ const Media: PayloadCollectionConfig = {
height: 16,
},
],
staticOptions: {
maxAge: 21600000, // 6 hours in milliseconds
},
},
fields: [
{
@@ -44,6 +70,10 @@ const Media: PayloadCollectionConfig = {
required: true,
localized: true,
},
{
name: 'foundUploadSizes',
type: 'checkbox',
},
],
timestamps: true,
};

View File

@@ -1,6 +1,6 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
const NestedArray: PayloadCollectionConfig = {
const NestedArray: CollectionConfig = {
slug: 'nested-arrays',
labels: {
singular: 'Nested Array',

View File

@@ -1,6 +1,6 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
const Preview: PayloadCollectionConfig = {
const Preview: CollectionConfig = {
slug: 'previewable-post',
labels: {
singular: 'Previewable Post',
@@ -8,9 +8,13 @@ const Preview: PayloadCollectionConfig = {
},
admin: {
useAsTitle: 'title',
preview: (doc, token) => {
if (doc.title) {
return `http://localhost:3000/previewable-posts/${doc.title}?preview=true&token=${token}`;
preview: async (doc, { token }) => {
const { title } = doc;
if (title) {
const mockAsyncReq = await fetch(`http://localhost:3000/api/previewable-post?depth=0`)
const mockJSON = await mockAsyncReq.json();
const mockParam = mockJSON?.docs?.[0]?.title || '';
return `http://localhost:3000/previewable-posts/${title}?preview=true&token=${token}&mockParam=${mockParam}`;
}
return null;

View File

@@ -1,9 +1,9 @@
import checkRole from '../access/checkRole';
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
const access = ({ req: { user } }) => checkRole(['admin'], user);
const PublicUsers: PayloadCollectionConfig = {
const PublicUsers: CollectionConfig = {
slug: 'public-users',
labels: {
singular: 'Public User',

View File

@@ -1,6 +1,6 @@
import { PayloadCollectionConfig } from '../../src/collections/config/types';
import { CollectionConfig } from '../../src/collections/config/types';
const RelationshipA: PayloadCollectionConfig = {
const RelationshipA: CollectionConfig = {
slug: 'relationship-a',
access: {
read: () => true,
@@ -15,7 +15,6 @@ const RelationshipA: PayloadCollectionConfig = {
label: 'Post',
type: 'relationship',
relationTo: 'relationship-b',
localized: true,
},
{
name: 'LocalizedPost',
@@ -29,7 +28,7 @@ const RelationshipA: PayloadCollectionConfig = {
name: 'postLocalizedMultiple',
label: 'Localized Post Multiple',
type: 'relationship',
relationTo: ['localized-posts', 'all-fields'],
relationTo: ['localized-posts', 'all-fields', 'custom-id'],
hasMany: true,
localized: true,
},
@@ -41,6 +40,45 @@ const RelationshipA: PayloadCollectionConfig = {
localized: true,
hasMany: false,
},
{
name: 'postMaxDepth',
maxDepth: 0,
label: 'Post With MaxDepth',
type: 'relationship',
relationTo: 'relationship-b',
hasMany: false,
},
{
name: 'customID',
label: 'CustomID Relation',
type: 'relationship',
relationTo: 'custom-id',
hasMany: true,
localized: true,
},
{
name: 'filterRelationship',
type: 'relationship',
relationTo: 'relationship-b',
filterOptions: {
disableRelation: {
not_equals: true,
},
},
},
{
name: 'files',
type: 'upload',
relationTo: 'files',
filterOptions: {
type: { equals: 'Type 2' },
},
},
{
name: 'demoHiddenField',
type: 'text',
hidden: true,
},
],
timestamps: true,
};

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