payload-canvas 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +333 -28
- package/dist/admin/ArrayRowLabel.d.ts +12 -0
- package/dist/admin/ArrayRowLabel.js +21 -0
- package/dist/admin/DocumentEditView.js +9 -2
- package/dist/admin/client.d.ts +1 -0
- package/dist/admin/client.js +2 -0
- package/dist/admin/editor/Editor.js +8 -1
- package/dist/admin/editor/Inspector.js +23 -17
- package/dist/admin/editor/Library.d.ts +2 -2
- package/dist/admin/editor/Library.js +7 -5
- package/dist/admin/editor/Outline.js +20 -12
- package/dist/admin/editor/Overlay.js +6 -4
- package/dist/admin/editor/actions.d.ts +7 -2
- package/dist/admin/editor/actions.js +44 -12
- package/dist/admin/editor/assistant/AssistantPanel.js +32 -20
- package/dist/admin/editor/comments/controller.d.ts +7 -0
- package/dist/admin/editor/comments/controller.js +12 -0
- package/dist/admin/editor/comments/useCommentFromURL.d.ts +2 -0
- package/dist/admin/editor/comments/useCommentFromURL.js +36 -0
- package/dist/admin/editor/dnd/smooth.js +1 -1
- package/dist/admin/editor/editor.scss +28 -0
- package/dist/admin/editor/fields/ArrayField.js +3 -3
- package/dist/admin/editor/fields/FormBlock.d.ts +20 -0
- package/dist/admin/editor/fields/FormBlock.js +167 -0
- package/dist/admin/editor/fields/FormFieldName.d.ts +25 -0
- package/dist/admin/editor/fields/FormFieldName.js +58 -0
- package/dist/admin/editor/fields/GroupField.d.ts +22 -2
- package/dist/admin/editor/fields/GroupField.js +30 -1
- package/dist/admin/editor/fields/MergeTags.d.ts +8 -0
- package/dist/admin/editor/fields/MergeTags.js +62 -0
- package/dist/admin/editor/fields/arrayRows.d.ts +0 -2
- package/dist/admin/editor/fields/arrayRows.js +0 -4
- package/dist/admin/editor/fields/fields.scss +150 -0
- package/dist/admin/editor/fields/values.d.ts +0 -2
- package/dist/admin/editor/fields/values.js +0 -14
- package/dist/admin/editor/icons.d.ts +3 -0
- package/dist/admin/editor/icons.js +3 -0
- package/dist/admin/editor/insert/InsertHandle.js +1 -1
- package/dist/admin/editor/insert/picker.d.ts +3 -2
- package/dist/admin/editor/insert/picker.js +9 -3
- package/dist/admin/editor/layout/LeftPanel.js +5 -3
- package/dist/admin/editor/layout/leftTabs.d.ts +15 -0
- package/dist/admin/editor/layout/leftTabs.js +18 -0
- package/dist/admin/editor/media/ImageEditor.d.ts +8 -2
- package/dist/admin/editor/media/ImageEditor.js +16 -10
- package/dist/admin/editor/media/media.scss +12 -2
- package/dist/admin/editor/media/model.d.ts +10 -1
- package/dist/admin/editor/media/model.js +19 -0
- package/dist/admin/editor/menu/blockMenu.js +3 -3
- package/dist/admin/editor/names.d.ts +9 -0
- package/dist/admin/editor/names.js +18 -0
- package/dist/admin/editor/regions/RegionFields.d.ts +6 -0
- package/dist/admin/editor/regions/RegionFields.js +122 -0
- package/dist/admin/editor/regions/RegionPane.js +5 -3
- package/dist/admin/editor/regions/RegionRows.js +2 -2
- package/dist/admin/editor/regions/required.d.ts +16 -0
- package/dist/admin/editor/regions/required.js +43 -0
- package/dist/admin/editor/renderField.d.ts +9 -2
- package/dist/admin/editor/renderField.js +86 -32
- package/dist/admin/editor/runtime.d.ts +3 -2
- package/dist/admin/editor/runtime.js +12 -18
- package/dist/admin/editor/styles/StylesPanel.js +4 -2
- package/dist/admin/editor/styles/context.js +9 -4
- package/dist/admin/editor/topbar/ContentModeToggle.js +1 -1
- package/dist/admin/editor/topbar/DocumentActions.js +4 -3
- package/dist/admin/editor/topbar/contentMode.scss +0 -9
- package/dist/admin/editor/topbar/topbar.scss +1 -41
- package/dist/admin/editor/ui/Tabs.d.ts +17 -0
- package/dist/admin/editor/ui/Tabs.js +17 -0
- package/dist/admin/forms/SubmissionCells.d.ts +6 -0
- package/dist/admin/forms/SubmissionCells.js +31 -0
- package/dist/admin/forms/SubmissionView.d.ts +5 -0
- package/dist/admin/forms/SubmissionView.js +106 -0
- package/dist/admin/forms/submissionData.d.ts +32 -0
- package/dist/admin/forms/submissionData.js +63 -0
- package/dist/admin/forms/submissions.scss +197 -0
- package/dist/admin/rsc.d.ts +2 -0
- package/dist/admin/rsc.js +5 -0
- package/dist/ai/endpoint.d.ts +5 -0
- package/dist/ai/endpoint.js +18 -8
- package/dist/ai/prompt.d.ts +8 -0
- package/dist/ai/prompt.js +30 -0
- package/dist/ai/tools.d.ts +6 -1
- package/dist/ai/tools.js +90 -6
- package/dist/blocks/builtins/carousel.js +10 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/index.js +1 -1
- package/dist/blocks/payload.d.ts +7 -0
- package/dist/blocks/payload.js +16 -2
- package/dist/comments/shared.d.ts +5 -0
- package/dist/comments/shared.js +5 -0
- package/dist/core/blocks.d.ts +17 -3
- package/dist/core/blocks.js +92 -10
- package/dist/core/classes.d.ts +5 -0
- package/dist/core/classes.js +26 -1
- package/dist/core/conditions.d.ts +7 -0
- package/dist/core/conditions.js +22 -0
- package/dist/core/dropTarget.d.ts +3 -2
- package/dist/core/dropTarget.js +7 -1
- package/dist/core/index.d.ts +6 -3
- package/dist/core/index.js +6 -3
- package/dist/core/payloadBlocks.js +25 -3
- package/dist/core/references.d.ts +7 -0
- package/dist/core/references.js +29 -11
- package/dist/core/regions.d.ts +14 -0
- package/dist/core/regions.js +17 -1
- package/dist/core/rowLabel.d.ts +8 -0
- package/dist/core/rowLabel.js +98 -0
- package/dist/core/starter.d.ts +10 -0
- package/dist/core/starter.js +40 -0
- package/dist/core/tree.js +4 -0
- package/dist/core/types.d.ts +96 -0
- package/dist/core/uniqueProps.d.ts +40 -0
- package/dist/core/uniqueProps.js +156 -0
- package/dist/core/validate.js +43 -3
- package/dist/forms/answers.d.ts +21 -0
- package/dist/forms/answers.js +82 -0
- package/dist/forms/blocks.d.ts +33 -0
- package/dist/forms/blocks.js +178 -0
- package/dist/forms/conditions.d.ts +78 -0
- package/dist/forms/conditions.js +184 -0
- package/dist/forms/emails.d.ts +23 -0
- package/dist/forms/emails.js +64 -0
- package/dist/forms/fieldConfigs.d.ts +35 -0
- package/dist/forms/fieldConfigs.js +167 -0
- package/dist/forms/fieldOps.d.ts +78 -0
- package/dist/forms/fieldOps.js +378 -0
- package/dist/forms/fieldSettings.d.ts +81 -0
- package/dist/forms/fieldSettings.js +239 -0
- package/dist/forms/files.d.ts +54 -0
- package/dist/forms/files.js +128 -0
- package/dist/forms/index.d.ts +16 -0
- package/dist/forms/index.js +18 -0
- package/dist/forms/mergeTags.d.ts +103 -0
- package/dist/forms/mergeTags.js +150 -0
- package/dist/forms/noScript.d.ts +60 -0
- package/dist/forms/noScript.js +109 -0
- package/dist/forms/pageForms.d.ts +99 -0
- package/dist/forms/pageForms.js +294 -0
- package/dist/forms/pageSync.d.ts +91 -0
- package/dist/forms/pageSync.js +325 -0
- package/dist/forms/rateLimit.d.ts +21 -0
- package/dist/forms/rateLimit.js +50 -0
- package/dist/forms/settings.d.ts +13 -0
- package/dist/forms/settings.js +92 -0
- package/dist/forms/spam.d.ts +100 -0
- package/dist/forms/spam.js +218 -0
- package/dist/forms/spamSettings.d.ts +43 -0
- package/dist/forms/spamSettings.js +25 -0
- package/dist/forms/submission.d.ts +34 -0
- package/dist/forms/submission.js +89 -0
- package/dist/forms/submissionsAdmin.d.ts +26 -0
- package/dist/forms/submissionsAdmin.js +108 -0
- package/dist/forms/summary.d.ts +60 -0
- package/dist/forms/summary.js +113 -0
- package/dist/forms/uploads.d.ts +41 -0
- package/dist/forms/uploads.js +132 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +8 -2
- package/dist/live/document.d.ts +12 -0
- package/dist/live/document.js +8 -1
- package/dist/live/endpoints.d.ts +1 -0
- package/dist/live/session.js +3 -1
- package/dist/live/storage.d.ts +13 -2
- package/dist/live/storage.js +18 -7
- package/dist/mcp/forms.d.ts +26 -0
- package/dist/mcp/forms.js +280 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.js +29 -10
- package/dist/mcp/shared.d.ts +1 -0
- package/dist/mcp/shared.js +1 -0
- package/dist/plugin/forms.d.ts +30 -0
- package/dist/plugin/forms.js +63 -0
- package/dist/plugin/formsSync.d.ts +138 -0
- package/dist/plugin/formsSync.js +345 -0
- package/dist/plugin/hook.d.ts +22 -0
- package/dist/plugin/hook.js +19 -7
- package/dist/plugin/index.d.ts +14 -0
- package/dist/plugin/index.js +99 -28
- package/dist/plugin/links.d.ts +21 -2
- package/dist/plugin/links.js +32 -3
- package/dist/plugin/references.d.ts +6 -0
- package/dist/plugin/references.js +12 -0
- package/dist/react/canvas/BuilderCanvas.d.ts +2 -0
- package/dist/react/canvas/BuilderCanvas.js +29 -6
- package/dist/react/canvas/inline/mapper.d.ts +6 -1
- package/dist/react/canvas/inline/mapper.js +35 -4
- package/dist/react/render/LayoutOutlet.d.ts +7 -3
- package/dist/react/render/LayoutOutlet.js +9 -4
- package/dist/react/render/RenderLayout.js +13 -7
- package/dist/react/render/resolve.d.ts +1 -0
- package/dist/react/render/resolve.js +5 -1
- package/dist/react/server.js +19 -0
- package/package.json +5 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// The right side of the top bar: the save state, Preview
|
|
3
|
+
// The right side of the top bar: the save state, the Preview and settings icon buttons, and Publish.
|
|
4
4
|
import { ConfirmationModal, useConfig, useDocumentDrawer, useModal, useRouteTransition } from '@payloadcms/ui';
|
|
5
5
|
import { useRouter } from 'next/navigation';
|
|
6
6
|
import { useCallback, useEffect, useEffectEvent, useRef, useState } from 'react';
|
|
@@ -80,7 +80,8 @@ export function PreviewButton() {
|
|
|
80
80
|
const href = previewUrl ?? url;
|
|
81
81
|
if (!href)
|
|
82
82
|
return null;
|
|
83
|
-
|
|
83
|
+
const label = previewUrl ? 'Preview the draft in a new tab' : 'Open the page in a new tab';
|
|
84
|
+
return (_jsx("a", { className: "builder-editor__icon-button", href: href, target: "_blank", rel: "noopener noreferrer", "aria-label": label, "data-tooltip": label, children: _jsx(Icon, { name: "external" }) }));
|
|
84
85
|
}
|
|
85
86
|
/**
|
|
86
87
|
* Opens the document's own edit form (title, slug, SEO, …) in Payload's document drawer. After
|
|
@@ -167,7 +168,7 @@ export function PageSettings() {
|
|
|
167
168
|
closeDrawer();
|
|
168
169
|
return true;
|
|
169
170
|
}, [admin, collection, closeDrawer]);
|
|
170
|
-
return (_jsxs(_Fragment, { children: [
|
|
171
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "builder-editor__icon-button", "aria-label": `${singular} settings`, "data-tooltip": `Title and other ${singular.toLowerCase()} settings`, onClick: () => runtime.doc.openSettings(), children: _jsx(Icon, { name: "settings" }) }), _jsx(DrawerWidth, { slug: drawerSlug, width: "min(720px, calc(100% - var(--gutter-h)))" }), _jsx(SettingsDrawerSlug, { value: drawerSlug, children: _jsx(SettingsDrawerReload, { value: reload, children: _jsx(RouterIntercept, { intercept: intercept, children: _jsx(DocumentDrawer, { disableActions: true, onSave: () => {
|
|
171
172
|
void runtime.doc.refresh();
|
|
172
173
|
runtime.regions?.reload();
|
|
173
174
|
} }, formKey) }) }) })] }));
|
|
@@ -452,48 +452,8 @@
|
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
-
.
|
|
456
|
-
display: inline-flex;
|
|
457
|
-
flex: none;
|
|
458
|
-
align-items: center;
|
|
459
|
-
gap: 6px;
|
|
460
|
-
height: 30px;
|
|
461
|
-
padding: 0 10px;
|
|
462
|
-
border: 1px solid var(--be-border);
|
|
463
|
-
border-radius: var(--be-radius-m);
|
|
464
|
-
background: transparent;
|
|
465
|
-
color: var(--theme-text);
|
|
466
|
-
font: inherit;
|
|
467
|
-
font-size: var(--be-text-m);
|
|
468
|
-
font-weight: var(--be-weight-medium);
|
|
469
|
-
text-decoration: none;
|
|
470
|
-
white-space: nowrap;
|
|
471
|
-
cursor: pointer;
|
|
472
|
-
transition: background-color 120ms ease, border-color 120ms ease;
|
|
473
|
-
|
|
474
|
-
&:hover {
|
|
475
|
-
border-color: var(--theme-elevation-250);
|
|
476
|
-
background: var(--be-hover);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
svg {
|
|
480
|
-
flex: none;
|
|
481
|
-
color: var(--theme-elevation-700);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// Laptop screens: icon-only buttons (the tooltip still names them).
|
|
455
|
+
// Laptop screens.
|
|
486
456
|
@media (max-width: 1700px) {
|
|
487
|
-
.builder-bar__button {
|
|
488
|
-
width: 30px;
|
|
489
|
-
padding: 0;
|
|
490
|
-
justify-content: center;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
.builder-bar__label {
|
|
494
|
-
display: none;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
457
|
// The avatars already say who is here; the "is editing" chip would push the save state.
|
|
498
458
|
.builder-editor__live-activity {
|
|
499
459
|
display: none;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type IconName } from '../icons.js';
|
|
2
|
+
export type TabsProps<T extends string> = {
|
|
3
|
+
value: T;
|
|
4
|
+
options: {
|
|
5
|
+
id: T;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
}[];
|
|
9
|
+
onChange: (id: T) => void;
|
|
10
|
+
/** `underline`: the inspector's main tabs. `segmented`: a switch, full width. */
|
|
11
|
+
variant?: 'segmented' | 'underline';
|
|
12
|
+
/** Names the tab list for screen readers. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** The DOM id of a tab's panel, for `aria-controls`. */
|
|
15
|
+
panelId?: (id: T) => string;
|
|
16
|
+
};
|
|
17
|
+
export declare function Tabs<T extends string>({ value, options, onChange, variant, label, panelId }: TabsProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Icon } from '../icons.js';
|
|
4
|
+
export function Tabs({ value, options, onChange, variant = 'underline', label, panelId }) {
|
|
5
|
+
const onKeyDown = (e) => {
|
|
6
|
+
const at = options.findIndex((o) => o.id === value);
|
|
7
|
+
const next = e.key === 'ArrowRight' ? (at + 1) % options.length : e.key === 'ArrowLeft' ? (at - 1 + options.length) % options.length : e.key === 'Home' ? 0 : e.key === 'End' ? options.length - 1 : -1;
|
|
8
|
+
if (next === -1)
|
|
9
|
+
return;
|
|
10
|
+
e.preventDefault();
|
|
11
|
+
onChange(options[next].id);
|
|
12
|
+
// The new tab takes the focus after it renders as selected.
|
|
13
|
+
const list = e.currentTarget.parentElement;
|
|
14
|
+
requestAnimationFrame(() => list?.querySelector('[aria-selected="true"]')?.focus());
|
|
15
|
+
};
|
|
16
|
+
return (_jsx("div", { "aria-label": label, className: variant === 'segmented' ? 'builder-editor__segmented builder-editor__segmented--full' : 'builder-editor__tabs', role: "tablist", children: options.map((option) => (_jsxs("button", { type: "button", role: "tab", "aria-selected": value === option.id, "aria-controls": panelId?.(option.id), tabIndex: value === option.id ? 0 : -1, className: variant === 'segmented' ? 'builder-editor__segment' : 'builder-editor__tab', onClick: () => onChange(option.id), onKeyDown: onKeyDown, children: [option.icon && _jsx(Icon, { name: option.icon, size: 13 }), option.label] }, option.id))) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DefaultServerCellComponentProps } from 'payload';
|
|
2
|
+
import './submissions.scss';
|
|
3
|
+
/** "Ada Lovelace · ada@example.com" and the start of the message below it. */
|
|
4
|
+
export declare function SubmissionSummaryCell(props: DefaultServerCellComponentProps): Promise<import("react").JSX.Element>;
|
|
5
|
+
/** "New" until someone opened the submission, then the date it was opened. */
|
|
6
|
+
export declare function SubmissionReadCell(props: DefaultServerCellComponentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// List cells of the submissions collection (forms/submissionsAdmin.ts): the message summary and
|
|
3
|
+
// the "New" badge. Server components: the summary reads the form's field types and labels.
|
|
4
|
+
import { Link } from '@payloadcms/ui';
|
|
5
|
+
import { formatAdminURL } from 'payload/shared';
|
|
6
|
+
import { shortAnswer, submissionSummary } from '../../forms/summary.js';
|
|
7
|
+
import { formatDateTime, formOf, formsSlugOf } from './submissionData.js';
|
|
8
|
+
import './submissions.scss';
|
|
9
|
+
/** The cell's content, linked to the document when it is the list's link column. */
|
|
10
|
+
function Linked({ props, children }) {
|
|
11
|
+
const { link, linkURL, payload, collectionConfig, rowData } = props;
|
|
12
|
+
if (!link || rowData?.id === undefined)
|
|
13
|
+
return _jsx(_Fragment, { children: children });
|
|
14
|
+
const href = linkURL ??
|
|
15
|
+
formatAdminURL({ adminRoute: payload.config.routes.admin, path: `/collections/${collectionConfig.slug}/${String(rowData.id)}`, relative: true });
|
|
16
|
+
return (_jsx(Link, { href: href, prefetch: false, children: children }));
|
|
17
|
+
}
|
|
18
|
+
/** "Ada Lovelace · ada@example.com" and the start of the message below it. */
|
|
19
|
+
export async function SubmissionSummaryCell(props) {
|
|
20
|
+
const { payload, collectionConfig, rowData } = props;
|
|
21
|
+
const form = await formOf(payload, formsSlugOf(collectionConfig), rowData?.form);
|
|
22
|
+
const summary = submissionSummary(rowData?.submissionData, form?.fields);
|
|
23
|
+
const line = summary.line ? shortAnswer(summary.line, 70) : 'Empty message';
|
|
24
|
+
const text = summary.text && summary.text !== summary.line ? shortAnswer(summary.text, 90) : null;
|
|
25
|
+
return (_jsx(Linked, { props: props, children: _jsxs("span", { className: "form-submission-cell", children: [_jsx("span", { className: "form-submission-cell__line", children: line }), text ? _jsx("span", { className: "form-submission-cell__text", children: text }) : null] }) }));
|
|
26
|
+
}
|
|
27
|
+
/** "New" until someone opened the submission, then the date it was opened. */
|
|
28
|
+
export function SubmissionReadCell(props) {
|
|
29
|
+
const opened = formatDateTime(props.cellData, props.i18n?.language);
|
|
30
|
+
return (_jsx(Linked, { props: props, children: opened ? _jsx("span", { className: "form-submission-cell__opened", children: opened }) : _jsx("span", { className: "form-submission-badge", children: "New" }) }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { UIFieldServerProps } from 'payload';
|
|
2
|
+
import './submissions.scss';
|
|
3
|
+
/** Context flag of the read-date update, for hooks that should ignore it. */
|
|
4
|
+
export declare const SUBMISSION_READ_CONTEXT = "formSubmissionRead";
|
|
5
|
+
export declare function SubmissionView({ id, payload, collectionSlug, field, i18n, req, user }: UIFieldServerProps): Promise<import("react").JSX.Element | null>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The detail view of a form submission (a `ui` field, see forms/submissionsAdmin.ts): the form,
|
|
3
|
+
// who sent it and when, the answers as a table with the form's labels, the files, and
|
|
4
|
+
// "Reply by email". Opening it sets `readAt` once, so the list's "New" badge goes away.
|
|
5
|
+
import { Button } from '@payloadcms/ui';
|
|
6
|
+
import { replyMailto, safePageUrl, submissionAnswers, submissionSummary } from '../../forms/summary.js';
|
|
7
|
+
import { SUBMISSION_PAGE_FIELD, SUBMISSION_READ_FIELD } from '../../forms/submissionsAdmin.js';
|
|
8
|
+
import { fileSize, formatDateTime, formOf, formsSlugOf, thumbnailOf } from './submissionData.js';
|
|
9
|
+
import './submissions.scss';
|
|
10
|
+
/** A collection's config by slug. Loose: an app's generated types allow only its own slugs. */
|
|
11
|
+
const collectionConfigOf = (payload, slug) => payload.collections[slug]?.config;
|
|
12
|
+
/** Context flag of the read-date update, for hooks that should ignore it. */
|
|
13
|
+
export const SUBMISSION_READ_CONTEXT = 'formSubmissionRead';
|
|
14
|
+
/**
|
|
15
|
+
* Sets the read date the first time a signed-in admin user opens the submission. The plugin's
|
|
16
|
+
* submissions refuse updates, so this writes only that field, with access off.
|
|
17
|
+
*/
|
|
18
|
+
async function markRead(payload, collection, doc, user) {
|
|
19
|
+
if (doc[SUBMISSION_READ_FIELD] || !user || user.collection !== payload.config.admin.user)
|
|
20
|
+
return null;
|
|
21
|
+
const config = collectionConfigOf(payload, collection);
|
|
22
|
+
if (!config?.flattenedFields.some((field) => field.name === SUBMISSION_READ_FIELD))
|
|
23
|
+
return null;
|
|
24
|
+
const now = new Date().toISOString();
|
|
25
|
+
try {
|
|
26
|
+
await payload.update({
|
|
27
|
+
collection: collection,
|
|
28
|
+
id: doc.id,
|
|
29
|
+
data: { [SUBMISSION_READ_FIELD]: now },
|
|
30
|
+
depth: 0,
|
|
31
|
+
overrideAccess: true,
|
|
32
|
+
context: { [SUBMISSION_READ_CONTEXT]: true },
|
|
33
|
+
});
|
|
34
|
+
return now;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
payload.logger.error({ err: error, msg: `[payload-canvas] Could not mark form submission ${String(doc.id)} as read` });
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const asMedia = (value) => (value && typeof value === 'object' ? value : null);
|
|
42
|
+
/** The files of the submission: the attachments field and the plugin's own uploads, with the question they answer. */
|
|
43
|
+
function filesOf(doc, attachments, answers) {
|
|
44
|
+
const out = [];
|
|
45
|
+
const labelOf = (name) => answers.find((a) => a.name === name)?.label ?? name ?? null;
|
|
46
|
+
const attached = attachments ? doc[attachments] : null;
|
|
47
|
+
for (const [index, value] of (Array.isArray(attached) ? attached : []).entries()) {
|
|
48
|
+
out.push({ key: `a${index}`, label: null, media: asMedia(value), id: asMedia(value)?.id ?? value });
|
|
49
|
+
}
|
|
50
|
+
for (const [row, upload] of (doc.submissionUploads ?? []).entries()) {
|
|
51
|
+
const values = Array.isArray(upload?.value) ? upload.value : [upload?.value];
|
|
52
|
+
for (const [index, value] of values.entries()) {
|
|
53
|
+
if (value === null || value === undefined)
|
|
54
|
+
continue;
|
|
55
|
+
out.push({ key: `u${row}-${index}`, label: labelOf(upload?.field), media: asMedia(value), id: asMedia(value)?.id ?? value });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
function AnswerValue({ answer }) {
|
|
61
|
+
if (answer.value.trim() === '')
|
|
62
|
+
return _jsx("span", { className: "form-submission__empty", children: "No answer" });
|
|
63
|
+
const mailto = replyMailto(answer.value);
|
|
64
|
+
if (mailto)
|
|
65
|
+
return _jsx("a", { href: mailto, children: answer.value.trim() });
|
|
66
|
+
return _jsx("span", { className: "form-submission__text", children: answer.display });
|
|
67
|
+
}
|
|
68
|
+
/** A page address for people: the path of a URL on this site, else the whole address. */
|
|
69
|
+
function pageLabel(url) {
|
|
70
|
+
try {
|
|
71
|
+
const parsed = new URL(url, 'http://local');
|
|
72
|
+
return parsed.host === 'local' ? `${parsed.pathname}${parsed.search}` : `${parsed.host}${parsed.pathname}`;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return url;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export async function SubmissionView({ id, payload, collectionSlug, field, i18n, req, user }) {
|
|
79
|
+
if (id === undefined || id === null || !collectionSlug)
|
|
80
|
+
return null;
|
|
81
|
+
const custom = (field.admin?.custom ?? {});
|
|
82
|
+
const viewer = (user ?? req?.user ?? null);
|
|
83
|
+
const doc = (await payload
|
|
84
|
+
.findByID({ collection: collectionSlug, id, depth: 1, overrideAccess: false, user: viewer })
|
|
85
|
+
.catch(() => null));
|
|
86
|
+
if (!doc)
|
|
87
|
+
return null;
|
|
88
|
+
const config = collectionConfigOf(payload, collectionSlug);
|
|
89
|
+
const form = await formOf(payload, formsSlugOf(config), doc.form);
|
|
90
|
+
const answers = submissionAnswers(form?.fields, doc.submissionData);
|
|
91
|
+
const summary = submissionSummary(doc.submissionData, form?.fields);
|
|
92
|
+
const formTitle = form?.title?.trim() || 'Form';
|
|
93
|
+
const mailto = replyMailto(summary.email, { subject: `Re: ${formTitle}` });
|
|
94
|
+
const page = safePageUrl(doc[SUBMISSION_PAGE_FIELD]);
|
|
95
|
+
const sent = formatDateTime(doc.createdAt, i18n?.language);
|
|
96
|
+
const files = filesOf(doc, custom.attachments ?? null, answers);
|
|
97
|
+
const readAt = await markRead(payload, collectionSlug, doc, viewer);
|
|
98
|
+
const opened = formatDateTime(doc[SUBMISSION_READ_FIELD] ?? readAt, i18n?.language);
|
|
99
|
+
return (_jsxs("div", { className: "form-submission", children: [_jsxs("header", { className: "form-submission__head", children: [_jsxs("div", { className: "form-submission__heading", children: [_jsx("p", { className: "form-submission__form", children: formTitle }), _jsx("h2", { className: "form-submission__title", children: summary.line ?? 'Message' }), _jsxs("p", { className: "form-submission__meta", children: [sent ? _jsxs(_Fragment, { children: ["Sent ", sent] }) : null, page ? (_jsxs(_Fragment, { children: [sent ? ' from ' : 'Sent from ', _jsx("a", { href: page, target: "_blank", rel: "noreferrer", children: pageLabel(page) })] })) : null, opened && !readAt ? _jsxs(_Fragment, { children: [" \u00B7 Opened ", opened] }) : null] })] }), mailto ? (_jsx(Button, { el: "anchor", url: mailto, buttonStyle: "primary", size: "medium", margin: false, children: "Reply by email" })) : null] }), answers.length > 0 ? (_jsx("table", { className: "form-submission__answers", children: _jsx("tbody", { children: answers.map((answer) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: answer.label }), _jsx("td", { children: _jsx(AnswerValue, { answer: answer }) })] }, answer.name))) }) })) : (_jsx("p", { className: "form-submission__empty", children: "This message has no answers." })), files.length > 0 ? (_jsxs("section", { className: "form-submission__files-section", children: [_jsx("h3", { className: "form-submission__subtitle", children: "Files" }), _jsx("ul", { className: "form-submission__files", children: files.map(({ key, label, media, id: fileId }) => {
|
|
100
|
+
const thumb = media ? thumbnailOf(media) : null;
|
|
101
|
+
const name = media?.filename ?? `File ${String(fileId)}`;
|
|
102
|
+
const size = fileSize(media?.filesize);
|
|
103
|
+
const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: "form-submission__thumb", children: thumb ? _jsx("img", { src: thumb, alt: "" }) : _jsx("span", { "aria-hidden": "true", children: name.split('.').pop()?.slice(0, 4).toUpperCase() || 'FILE' }) }), _jsxs("span", { className: "form-submission__file-text", children: [_jsx("span", { className: "form-submission__file-name", children: name }), label || size ? _jsx("span", { className: "form-submission__file-meta", children: [label, size].filter(Boolean).join(' · ') }) : null] })] }));
|
|
104
|
+
return (_jsx("li", { children: media?.url ? (_jsx("a", { className: "form-submission__file", href: media.url, target: "_blank", rel: "noreferrer", children: body })) : (_jsx("span", { className: "form-submission__file", children: body })) }, key));
|
|
105
|
+
}) })] })) : null] }));
|
|
106
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Payload, SanitizedCollectionConfig } from 'payload';
|
|
2
|
+
import type { SubmissionFormField } from '../../forms/summary.js';
|
|
3
|
+
export type FormDoc = {
|
|
4
|
+
id?: string | number;
|
|
5
|
+
title?: string | null;
|
|
6
|
+
fields?: SubmissionFormField[] | null;
|
|
7
|
+
};
|
|
8
|
+
/** The id of a relationship value (an id or a populated document). */
|
|
9
|
+
export declare function idOf(value: unknown): string | number | null;
|
|
10
|
+
/** The forms collection the submissions' `form` relationship points at. */
|
|
11
|
+
export declare function formsSlugOf(collection: SanitizedCollectionConfig | undefined): string;
|
|
12
|
+
/** A form by id, once per request (a list shows many submissions of the same form). Null when it is gone. */
|
|
13
|
+
export declare const loadForm: (payload: Payload, slug: string, id: string | number) => Promise<FormDoc | null>;
|
|
14
|
+
/** The form of a submission: the populated document, else loaded by id. */
|
|
15
|
+
export declare function formOf(payload: Payload, slug: string, value: unknown): Promise<FormDoc | null>;
|
|
16
|
+
/** "9 Nov 2026, 14:05" in the admin's language. */
|
|
17
|
+
export declare function formatDateTime(value: unknown, language: string | undefined): string | null;
|
|
18
|
+
export type MediaLike = {
|
|
19
|
+
id?: string | number;
|
|
20
|
+
filename?: string | null;
|
|
21
|
+
url?: string | null;
|
|
22
|
+
mimeType?: string | null;
|
|
23
|
+
thumbnailURL?: string | null;
|
|
24
|
+
filesize?: number | null;
|
|
25
|
+
sizes?: Record<string, {
|
|
26
|
+
url?: string | null;
|
|
27
|
+
} | undefined> | null;
|
|
28
|
+
};
|
|
29
|
+
/** A small picture of an upload: its thumbnail size, the upload's thumbnail, or the image itself. */
|
|
30
|
+
export declare function thumbnailOf(doc: MediaLike): string | null;
|
|
31
|
+
/** "12 KB", "1.4 MB". */
|
|
32
|
+
export declare function fileSize(bytes: unknown): string | null;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Server helpers of the submissions admin: the form's fields (cached per request), dates and files.
|
|
2
|
+
import { cache } from 'react';
|
|
3
|
+
/** The id of a relationship value (an id or a populated document). */
|
|
4
|
+
export function idOf(value) {
|
|
5
|
+
if (typeof value === 'string' || typeof value === 'number')
|
|
6
|
+
return value;
|
|
7
|
+
if (value && typeof value === 'object' && 'id' in value)
|
|
8
|
+
return idOf(value.id);
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
/** The forms collection the submissions' `form` relationship points at. */
|
|
12
|
+
export function formsSlugOf(collection) {
|
|
13
|
+
const field = collection?.flattenedFields.find((f) => f.name === 'form');
|
|
14
|
+
return field && 'relationTo' in field && typeof field.relationTo === 'string' ? field.relationTo : 'forms';
|
|
15
|
+
}
|
|
16
|
+
/** A form by id, once per request (a list shows many submissions of the same form). Null when it is gone. */
|
|
17
|
+
export const loadForm = cache(async (payload, slug, id) => {
|
|
18
|
+
try {
|
|
19
|
+
return (await payload.findByID({ collection: slug, id, depth: 0, overrideAccess: true }));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/** The form of a submission: the populated document, else loaded by id. */
|
|
26
|
+
export async function formOf(payload, slug, value) {
|
|
27
|
+
if (value && typeof value === 'object' && Array.isArray(value.fields))
|
|
28
|
+
return value;
|
|
29
|
+
const id = idOf(value);
|
|
30
|
+
return id === null ? null : loadForm(payload, slug, id);
|
|
31
|
+
}
|
|
32
|
+
/** "9 Nov 2026, 14:05" in the admin's language. */
|
|
33
|
+
export function formatDateTime(value, language) {
|
|
34
|
+
if (typeof value !== 'string' && !(value instanceof Date))
|
|
35
|
+
return null;
|
|
36
|
+
const date = new Date(value);
|
|
37
|
+
if (Number.isNaN(date.getTime()))
|
|
38
|
+
return null;
|
|
39
|
+
try {
|
|
40
|
+
return new Intl.DateTimeFormat(language || 'en', { dateStyle: 'medium', timeStyle: 'short' }).format(date);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return date.toISOString();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** A small picture of an upload: its thumbnail size, the upload's thumbnail, or the image itself. */
|
|
47
|
+
export function thumbnailOf(doc) {
|
|
48
|
+
for (const candidate of [doc.sizes?.thumbnail?.url, doc.thumbnailURL]) {
|
|
49
|
+
if (typeof candidate === 'string' && candidate)
|
|
50
|
+
return candidate;
|
|
51
|
+
}
|
|
52
|
+
return doc.mimeType?.startsWith('image/') && doc.url ? doc.url : null;
|
|
53
|
+
}
|
|
54
|
+
/** "12 KB", "1.4 MB". */
|
|
55
|
+
export function fileSize(bytes) {
|
|
56
|
+
if (typeof bytes !== 'number' || !Number.isFinite(bytes) || bytes < 0)
|
|
57
|
+
return null;
|
|
58
|
+
if (bytes < 1024)
|
|
59
|
+
return `${bytes} B`;
|
|
60
|
+
if (bytes < 1024 * 1024)
|
|
61
|
+
return `${Math.round(bytes / 1024)} KB`;
|
|
62
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
63
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// The form submissions admin: the detail view (SubmissionView.tsx) and the list cells
|
|
2
|
+
// (SubmissionCells.tsx). Payload CSS variables only, no Tailwind (it would leak into the admin).
|
|
3
|
+
|
|
4
|
+
@layer payload-default {
|
|
5
|
+
.form-submission {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: calc(var(--base) * 1.25);
|
|
9
|
+
margin-bottom: calc(var(--base) * 1.5);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.form-submission__head {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
gap: var(--base);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.form-submission__heading {
|
|
21
|
+
min-width: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.form-submission__form {
|
|
25
|
+
margin: 0 0 calc(var(--base) * 0.25);
|
|
26
|
+
color: var(--theme-elevation-500);
|
|
27
|
+
font-size: 0.8125rem;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.form-submission__title {
|
|
32
|
+
margin: 0;
|
|
33
|
+
overflow-wrap: anywhere;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.form-submission__meta {
|
|
37
|
+
margin: calc(var(--base) * 0.25) 0 0;
|
|
38
|
+
color: var(--theme-elevation-600);
|
|
39
|
+
|
|
40
|
+
a {
|
|
41
|
+
color: inherit;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.form-submission__answers {
|
|
46
|
+
width: 100%;
|
|
47
|
+
border-collapse: collapse;
|
|
48
|
+
border: 1px solid var(--theme-elevation-150);
|
|
49
|
+
border-radius: var(--style-radius-m);
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
|
|
52
|
+
th,
|
|
53
|
+
td {
|
|
54
|
+
padding: calc(var(--base) * 0.6) calc(var(--base) * 0.75);
|
|
55
|
+
border-bottom: 1px solid var(--theme-elevation-100);
|
|
56
|
+
text-align: left;
|
|
57
|
+
vertical-align: top;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
tr:last-child th,
|
|
61
|
+
tr:last-child td {
|
|
62
|
+
border-bottom: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
th {
|
|
66
|
+
width: 32%;
|
|
67
|
+
color: var(--theme-elevation-600);
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
background: var(--theme-elevation-50);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
td {
|
|
73
|
+
color: var(--theme-elevation-1000);
|
|
74
|
+
overflow-wrap: anywhere;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.form-submission__text {
|
|
79
|
+
white-space: pre-wrap;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.form-submission__empty {
|
|
83
|
+
margin: 0;
|
|
84
|
+
color: var(--theme-elevation-400);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.form-submission__subtitle {
|
|
88
|
+
margin: 0 0 calc(var(--base) * 0.5);
|
|
89
|
+
font-size: 1rem;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.form-submission__files {
|
|
93
|
+
display: grid;
|
|
94
|
+
grid-template-columns: repeat(auto-fill, minmax(calc(var(--base) * 14), 1fr));
|
|
95
|
+
gap: calc(var(--base) * 0.5);
|
|
96
|
+
margin: 0;
|
|
97
|
+
padding: 0;
|
|
98
|
+
list-style: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.form-submission__file {
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: calc(var(--base) * 0.6);
|
|
105
|
+
padding: calc(var(--base) * 0.4);
|
|
106
|
+
border: 1px solid var(--theme-elevation-150);
|
|
107
|
+
border-radius: var(--style-radius-m);
|
|
108
|
+
color: inherit;
|
|
109
|
+
text-decoration: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
a.form-submission__file:hover {
|
|
113
|
+
border-color: var(--theme-elevation-300);
|
|
114
|
+
background: var(--theme-elevation-50);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.form-submission__thumb {
|
|
118
|
+
display: grid;
|
|
119
|
+
flex: none;
|
|
120
|
+
place-items: center;
|
|
121
|
+
width: calc(var(--base) * 2.75);
|
|
122
|
+
height: calc(var(--base) * 2.75);
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
border-radius: var(--style-radius-s);
|
|
125
|
+
background: var(--theme-elevation-100);
|
|
126
|
+
color: var(--theme-elevation-600);
|
|
127
|
+
font-size: 0.6875rem;
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
|
|
130
|
+
img {
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
object-fit: cover;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.form-submission__file-text {
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
min-width: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.form-submission__file-name {
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
text-overflow: ellipsis;
|
|
146
|
+
white-space: nowrap;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.form-submission__file-meta {
|
|
150
|
+
color: var(--theme-elevation-500);
|
|
151
|
+
font-size: 0.75rem;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// List cells.
|
|
155
|
+
.form-submission-cell {
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
min-width: 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.form-submission-cell__line {
|
|
162
|
+
font-weight: 500;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.form-submission-cell__text,
|
|
166
|
+
.form-submission-cell__opened {
|
|
167
|
+
color: var(--theme-elevation-500);
|
|
168
|
+
font-size: 0.8125rem;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Same size as the starter's Status badges (Draft, Published): 12px text, a dot, 2px 8px padding.
|
|
172
|
+
// Payload flips these scales in dark mode, so the same steps work in both themes.
|
|
173
|
+
.form-submission-badge {
|
|
174
|
+
display: inline-flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: 6px;
|
|
177
|
+
// List cells make their children block boxes: keep the badge as wide as its text.
|
|
178
|
+
width: fit-content;
|
|
179
|
+
padding: 2px 8px;
|
|
180
|
+
border-radius: 999px;
|
|
181
|
+
background: var(--theme-success-100);
|
|
182
|
+
color: var(--theme-success-750);
|
|
183
|
+
font-size: 12px;
|
|
184
|
+
font-weight: 500;
|
|
185
|
+
line-height: 18px;
|
|
186
|
+
white-space: nowrap;
|
|
187
|
+
|
|
188
|
+
&::before {
|
|
189
|
+
content: '';
|
|
190
|
+
width: 6px;
|
|
191
|
+
height: 6px;
|
|
192
|
+
border-radius: 50%;
|
|
193
|
+
background: currentColor;
|
|
194
|
+
opacity: 0.8;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
package/dist/admin/rsc.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ export { BuilderView } from './server/BuilderView.js';
|
|
|
2
2
|
export { BuilderRedirect } from './server/BuilderRedirect.js';
|
|
3
3
|
export { LayoutDiff } from './diff/LayoutDiff.js';
|
|
4
4
|
export { NoDiff } from './diff/NoDiff.js';
|
|
5
|
+
export { SubmissionView } from './forms/SubmissionView.js';
|
|
6
|
+
export { SubmissionReadCell, SubmissionSummaryCell } from './forms/SubmissionCells.js';
|
package/dist/admin/rsc.js
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
// 'payload-canvas/rsc#BuilderRedirect' — the document's `/builder` path, redirects to it
|
|
4
4
|
// 'payload-canvas/rsc#LayoutDiff' — the layout field in Versions > compare, in plain words
|
|
5
5
|
// 'payload-canvas/rsc#NoDiff' — no row in Versions > compare (the generated CSS)
|
|
6
|
+
// 'payload-canvas/rsc#SubmissionView' — a form submission: answers with the form's labels, files, reply link; marks it read
|
|
7
|
+
// 'payload-canvas/rsc#SubmissionSummaryCell' — the submissions list's Message column
|
|
8
|
+
// 'payload-canvas/rsc#SubmissionReadCell' — the submissions list's "New" badge / opened date
|
|
6
9
|
export { BuilderView } from './server/BuilderView.js';
|
|
7
10
|
export { BuilderRedirect } from './server/BuilderRedirect.js';
|
|
8
11
|
export { LayoutDiff } from './diff/LayoutDiff.js';
|
|
9
12
|
export { NoDiff } from './diff/NoDiff.js';
|
|
13
|
+
export { SubmissionView } from './forms/SubmissionView.js';
|
|
14
|
+
export { SubmissionReadCell, SubmissionSummaryCell } from './forms/SubmissionCells.js';
|
package/dist/ai/endpoint.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ export type AiEndpointOptions = {
|
|
|
30
30
|
images?: ImageService;
|
|
31
31
|
/** The AI settings global: its chat key is read on every request and wins over the adapter's own key. Null: off. */
|
|
32
32
|
settings?: AiSettingsRuntime | null;
|
|
33
|
+
/** The form builder: the forms collection and its field types. The assistant edits a form's fields there. */
|
|
34
|
+
forms?: {
|
|
35
|
+
slug: string;
|
|
36
|
+
blocks: BlockDefinition[];
|
|
37
|
+
} | null;
|
|
33
38
|
/** Tests: replaces the update-access check (default: Payload's docAccessOperation). */
|
|
34
39
|
canUpdate?: (req: PayloadRequest, collection: string, id: string | number, field: string) => Promise<boolean>;
|
|
35
40
|
};
|