Skip to content

Commit be16e52

Browse files
authored
Merge branch 'main' into main
2 parents 81b7f86 + cf43c5c commit be16e52

File tree

816 files changed

+11225
-9921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

816 files changed

+11225
-9921
lines changed

.github/workflows/main.yml

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- opened
77
- reopened
88
- synchronize
9+
- labeled
910
push:
1011
branches:
1112
- main
@@ -363,7 +364,7 @@ jobs:
363364
run: pnpm exec playwright install-deps chromium
364365

365366
- name: E2E Tests
366-
run: PLAYWRIGHT_JSON_OUTPUT_NAME=results_${{ matrix.suite }}.json pnpm test:e2e:prod:ci ${{ matrix.suite }}
367+
run: PLAYWRIGHT_JSON_OUTPUT_NAME=results_${{ matrix.suite }}.json pnpm test:e2e:prod:ci:noturbo ${{ matrix.suite }}
367368
env:
368369
PLAYWRIGHT_JSON_OUTPUT_NAME: results_${{ matrix.suite }}.json
369370
NEXT_TELEMETRY_DISABLED: 1
@@ -383,6 +384,142 @@ jobs:
383384
# report-tag: ${{ matrix.suite }}
384385
# job-summary: true
385386

387+
tests-e2e-turbo:
388+
runs-on: ubuntu-24.04
389+
needs: [changes, build]
390+
if: >-
391+
needs.changes.outputs.needs_tests == 'true' &&
392+
(
393+
contains(github.event.pull_request.labels.*.name, 'run-e2e-turbo') ||
394+
github.event.label.name == 'run-e2e-turbo'
395+
)
396+
name: e2e-turbo-${{ matrix.suite }}
397+
strategy:
398+
fail-fast: false
399+
matrix:
400+
# find test -type f -name 'e2e.spec.ts' | sort | xargs dirname | xargs -I {} basename {}
401+
suite:
402+
- _community
403+
- access-control
404+
- admin__e2e__general
405+
- admin__e2e__list-view
406+
- admin__e2e__document-view
407+
- admin-bar
408+
- admin-root
409+
- auth
410+
- auth-basic
411+
- bulk-edit
412+
- joins
413+
- field-error-states
414+
- fields-relationship
415+
- fields__collections__Array
416+
- fields__collections__Blocks
417+
- fields__collections__Blocks#config.blockreferences.ts
418+
- fields__collections__Checkbox
419+
- fields__collections__Collapsible
420+
- fields__collections__ConditionalLogic
421+
- fields__collections__CustomID
422+
- fields__collections__Date
423+
- fields__collections__Email
424+
- fields__collections__Indexed
425+
- fields__collections__JSON
426+
- fields__collections__Number
427+
- fields__collections__Point
428+
- fields__collections__Radio
429+
- fields__collections__Relationship
430+
- fields__collections__Row
431+
- fields__collections__Select
432+
- fields__collections__Tabs
433+
- fields__collections__Tabs2
434+
- fields__collections__Text
435+
- fields__collections__UI
436+
- fields__collections__Upload
437+
- hooks
438+
- lexical__collections__Lexical__e2e__main
439+
- lexical__collections__Lexical__e2e__blocks
440+
- lexical__collections__Lexical__e2e__blocks#config.blockreferences.ts
441+
- lexical__collections__RichText
442+
- query-presets
443+
- form-state
444+
- live-preview
445+
- localization
446+
- locked-documents
447+
- i18n
448+
- plugin-cloud-storage
449+
- plugin-form-builder
450+
- plugin-import-export
451+
- plugin-nested-docs
452+
- plugin-seo
453+
- sort
454+
- versions
455+
- uploads
456+
env:
457+
SUITE_NAME: ${{ matrix.suite }}
458+
steps:
459+
- uses: actions/checkout@v4
460+
461+
- name: Node setup
462+
uses: ./.github/actions/setup
463+
with:
464+
node-version: ${{ env.NODE_VERSION }}
465+
pnpm-version: ${{ env.PNPM_VERSION }}
466+
pnpm-run-install: false
467+
pnpm-restore-cache: false # Full build is restored below
468+
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
469+
470+
- name: Restore build
471+
uses: actions/cache@v4
472+
with:
473+
path: ./*
474+
key: ${{ github.sha }}-${{ github.run_number }}
475+
476+
- name: Start LocalStack
477+
run: pnpm docker:start
478+
if: ${{ matrix.suite == 'plugin-cloud-storage' }}
479+
480+
- name: Store Playwright's Version
481+
run: |
482+
# Extract the version number using a more targeted regex pattern with awk
483+
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --depth=0 | awk '/@playwright\/test/ {print $2}')
484+
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
485+
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
486+
487+
- name: Cache Playwright Browsers for Playwright's Version
488+
id: cache-playwright-browsers
489+
uses: actions/cache@v4
490+
with:
491+
path: ~/.cache/ms-playwright
492+
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
493+
494+
- name: Setup Playwright - Browsers and Dependencies
495+
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
496+
run: pnpm exec playwright install --with-deps chromium
497+
498+
- name: Setup Playwright - Dependencies-only
499+
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
500+
run: pnpm exec playwright install-deps chromium
501+
502+
- name: E2E Tests
503+
run: PLAYWRIGHT_JSON_OUTPUT_NAME=results_${{ matrix.suite }}.json pnpm test:e2e:prod:ci ${{ matrix.suite }}
504+
env:
505+
PLAYWRIGHT_JSON_OUTPUT_NAME: results_${{ matrix.suite }}.json
506+
NEXT_TELEMETRY_DISABLED: 1
507+
508+
- uses: actions/upload-artifact@v4
509+
if: always()
510+
with:
511+
name: test-results-turbo${{ matrix.suite }}
512+
path: test/test-results/
513+
if-no-files-found: ignore
514+
retention-days: 1
515+
516+
# Disabled until this is fixed: https://github.com/daun/playwright-report-summary/issues/156
517+
# - uses: daun/playwright-report-summary@v3
518+
# with:
519+
# report-file: results_${{ matrix.suite }}.json
520+
# report-tag: ${{ matrix.suite }}
521+
# job-summary: true
522+
386523
# Build listed templates with packed local packages
387524
build-templates:
388525
runs-on: ubuntu-24.04

docs/admin/overview.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ The following options are available:
9797
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
9898
| **`avatar`** | Set account profile picture. Options: `gravatar`, `default` or a custom React component. |
9999
| **`autoLogin`** | Used to automate log-in for dev and demonstration convenience. [More details](../authentication/overview). |
100-
| **`buildPath`** | Specify an absolute path for where to store the built Admin bundle used in production. Defaults to `path.resolve(process.cwd(), 'build')`. |
101100
| **`components`** | Component overrides that affect the entirety of the Admin Panel. [More details](../custom-components/overview). |
102101
| **`custom`** | Any custom properties you wish to pass to the Admin Panel. |
103102
| **`dateFormat`** | The date format that will be used for all dates within the Admin Panel. Any valid [date-fns](https://date-fns.org/) format pattern can be used. |

docs/admin/react-hooks.mdx

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -981,25 +981,46 @@ const MyComponent: React.FC = () => {
981981

982982
## useTableColumns
983983

984-
Returns methods to manipulate table columns
984+
Returns properties and methods to manipulate table columns:
985+
| Property | Description |
986+
| ------------------------ | ------------------------------------------------------------------------------------------ |
987+
| **`columns`** | The current state of columns including their active status and configuration |
988+
| **`LinkedCellOverride`** | A component override for linked cells in the table |
989+
| **`moveColumn`** | A method to reorder columns. Accepts `{ fromIndex: number, toIndex: number }` as arguments |
990+
| **`resetColumnsState`** | A method to reset columns back to their default configuration as defined in the collection config |
991+
| **`setActiveColumns`** | A method to set specific columns to active state while preserving the existing column order. Accepts an array of column names to activate |
992+
| **`toggleColumn`** | A method to toggle a single column's visibility. Accepts a column name as string |
985993

986994
```tsx
987995
'use client'
988996
import { useTableColumns } from '@payloadcms/ui'
989997

990998
const MyComponent: React.FC = () => {
991999
// highlight-start
992-
const { setActiveColumns } = useTableColumns()
1000+
const { setActiveColumns, resetColumnsState } = useTableColumns()
9931001

994-
const resetColumns = () => {
995-
setActiveColumns(['id', 'createdAt', 'updatedAt'])
1002+
const activateSpecificColumns = () => {
1003+
// Only activates the id and createdAt columns
1004+
// Other columns retain their current active/inactive state
1005+
// The original column order is preserved
1006+
setActiveColumns(['id', 'createdAt'])
1007+
}
1008+
1009+
const resetToDefaults = () => {
1010+
// Resets to the default columns defined in the collection config
1011+
resetColumnsState()
9961012
}
9971013
// highlight-end
9981014

9991015
return (
1000-
<button type="button" onClick={resetColumns}>
1001-
Reset columns
1002-
</button>
1016+
<div>
1017+
<button type="button" onClick={activateSpecificColumns}>
1018+
Activate Specific Columns
1019+
</button>
1020+
<button type="button" onClick={resetToDefaults}>
1021+
Reset To Defaults
1022+
</button>
1023+
</div>
10031024
)
10041025
}
10051026
```

docs/authentication/jwt.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Example:
2323
```ts
2424
const user = await fetch('http://localhost:3000/api/users/login', {
2525
method: 'POST',
26+
headers: {
27+
'Content-Type': 'application/json',
28+
},
2629
body: JSON.stringify({
2730
2831
password: 'password',

docs/authentication/overview.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ export default buildConfig({
151151
prefillOnly: true,
152152
}
153153
: false,
154-
}
155-
154+
},
155+
156156
// highlight-end
157157
})
158158
```

docs/configuration/collections.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,15 @@ export const MyCollection: CollectionConfig = {
194194

195195
The following options are available:
196196

197-
| Option | Description |
198-
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
199-
| `SaveButton` | Replace the default Save Button within the Edit View. [Drafts](../versions/drafts) must be disabled. [More details](../custom-components/edit-view#savebutton). |
200-
| `SaveDraftButton` | Replace the default Save Draft Button within the Edit View. [Drafts](../versions/drafts) must be enabled and autosave must be disabled. [More details](../custom-components/edit-view#savedraftbutton). |
201-
| `PublishButton` | Replace the default Publish Button within the Edit View. [Drafts](../versions/drafts) must be enabled. [More details](../custom-components/edit-view#publishbutton). |
202-
| `PreviewButton` | Replace the default Preview Button within the Edit View. [Preview](../admin/preview) must be enabled. [More details](../custom-components/edit-view#previewbutton). |
203-
| `Upload` | Replace the default Upload component within the Edit View. [Upload](../upload/overview) must be enabled. [More details](../custom-components/edit-view#upload). |
197+
| Option | Description |
198+
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
199+
| `beforeDocumentControls` | Inject custom components before the Save / Publish buttons. [More details](../custom-components/edit-view#beforedocumentcontrols). |
200+
| `editMenuItems` | Inject custom components within the 3-dot menu dropdown located in the document controls bar. [More details](../custom-components/edit-view#editmenuitems). |
201+
| `SaveButton` | Replace the default Save Button within the Edit View. [Drafts](../versions/drafts) must be disabled. [More details](../custom-components/edit-view#savebutton). |
202+
| `SaveDraftButton` | Replace the default Save Draft Button within the Edit View. [Drafts](../versions/drafts) must be enabled and autosave must be disabled. [More details](../custom-components/edit-view#savedraftbutton). |
203+
| `PublishButton` | Replace the default Publish Button within the Edit View. [Drafts](../versions/drafts) must be enabled. [More details](../custom-components/edit-view#publishbutton). |
204+
| `PreviewButton` | Replace the default Preview Button within the Edit View. [Preview](../admin/preview) must be enabled. [More details](../custom-components/edit-view#previewbutton). |
205+
| `Upload` | Replace the default Upload component within the Edit View. [Upload](../upload/overview) must be enabled. [More details](../custom-components/edit-view#upload). |
204206

205207
<Banner type="success">
206208
**Note:** For details on how to build Custom Components, see [Building Custom

0 commit comments

Comments
 (0)