feat: breaking: richtext adapter (#3311)

BREAKING: requires user to install @payloacms-richtext-slate and specify a `config.editor` property

* chore: move slate stuff into packages/richtext-slate

* chore: fieldTypes stuff

* chore: fix richtext-slate tsconfig

* chore: add clean:unix command

* chore: fix up things

* chore: undo subpath imports being hoisted up

* chore: fix incorrect imports

* chore: improve AdapterArguments type

* chore: remove unused richTextToHTML and stringifyRichText files

* fix: core-dev scss imports

* chore: fix publishConfig exports for richtext-slate

* chore: adjust joi schema for richtext field

* chore: various fixes

* chore: handle afterRead population in richText adapter

* chore: handle more after-read promise stuff

* chore: fix joi validation

* chore: add richtext adapter to tests

* chore: merge adapter props with field props

* chore: index.tsx => index.ts

* chore: rename `adapter` to `editor`

* chore: fix e2e tests not running due to importing a constant from a file (`Tabs`) which imports createSlate.

This fails because createSlate imports React components.

* chore: remove unnecessary import

* chore: improve various typings

* chore: improve typings for List view Cell components

* feat: richText adapter cell component

* chore: add missing types packages for packages/richtext-slate

* chore: add new adapter interface properties to joi schema

* chore: withMergedProps utility which replaces getSlateCellComponent and getSlateFieldComponent

* feat: added config.defaultEditor property which is now required. field.editor is no longer required and overrides config.defaultEditor

* docs: mention editor and defaultEditor property in the docs

* chore: fix incorrectly formatted JSX in docs files breaking mdx parser

* chore: fix various errors

* chore: auto-generated pointer files
This commit is contained in:
Alessio Gravili
2023-09-19 11:03:31 +02:00
committed by GitHub
parent 835efdf400
commit a81401cf77
210 changed files with 2754 additions and 2319 deletions

View File

@@ -26,6 +26,7 @@ Payload is a _config-based_, code-first CMS and application framework. The Paylo
| `cors` | Either a whitelist array of URLS to allow CORS requests from, or a wildcard string (`'*'`) to accept incoming requests from any domain. |
| `globals` | An array of all Globals that Payload will manage. For more on Globals and their configs, [click here](/docs/configuration/globals). |
| `admin` | Base Payload admin configuration. Specify custom components, control metadata, set the Admin user collection, and [more](/docs/admin/overview#admin-options). |
| `editor` | Default richText editor which will be used by richText fields. |
| `localization` | Opt-in and control how Payload handles the translation of your content into multiple locales. [More](/docs/configuration/localization) |
| `graphQL` | Manage GraphQL-specific functionality here. Define your own queries and mutations, manage query complexity limits, and [more](/docs/graphql/overview#graphql-options). |
| `cookiePrefix` | A string that will be prefixed to all cookies that Payload sets. |

View File

@@ -21,13 +21,7 @@ keywords: rich text, fields, config, configuration, documentation, Content Manag
The Admin component is built on the powerful [`slatejs`](https://docs.slatejs.org/) editor and is meant to be as extensible and customizable as possible.
<Banner type="success">
<strong>
Consistent with Payload's goal of making you learn as little of Payload as possible, customizing
and using the Rich Text Editor does not involve learning how to develop for a <em>Payload</em>{' '}
rich text editor.
</strong>{' '}
Instead, you can invest your time and effort into learning Slate, an open-source tool that will
allow you to apply your learnings elsewhere as well.
<strong>Consistent with Payload's goal of making you learn as little of Payload as possible, customizing and using the Rich Text Editor does not involve learning how to develop for a <em>Payload</em> rich text editor.</strong> Instead, you can invest your time and effort into learning Slate, an open-source tool that will allow you to apply your learnings elsewhere as well.
</Banner>
### Config
@@ -45,6 +39,7 @@ The Admin component is built on the powerful [`slatejs`](https://docs.slatejs.or
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`editor`** | RichText editor which will be used by this field. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._

View File

@@ -36,10 +36,7 @@ When you initialize Payload, you provide it with a `secret` property. This prope
Because _**you**_ are in complete control of who can do what with your data, you should double and triple-check that you wield that power responsibly before deploying to Production.
<Banner type="error">
<strong>
By default, all Access Control functions require that a user is successfully logged in to
Payload to create, read, update, or delete data.
</strong>{' '}
<strong>By default, all Access Control functions require that a user is successfully logged in to Payload to create, read, update, or delete data.</strong>{' '}
But, if you allow public user registration, for example, you will want to make sure that your
access control functions are more strict - permitting <strong>only appropriate users</strong> to
perform appropriate actions.

View File

@@ -9,9 +9,7 @@ keywords: query, documents, overview, documentation, Content Management System,
Payload provides an extremely granular querying language through all APIs. Each API takes the same syntax and fully supports all options.
<Banner>
<strong>
Here, "querying" relates to filtering or searching through documents within a Collection.
</strong>{' '}
<strong>Here, "querying" relates to filtering or searching through documents within a Collection.</strong>{' '}
You can build queries to pass to Find operations as well as to [restrict which documents certain
users can access](/docs/access-control/overview) via access control functions.
</Banner>

View File

@@ -2,6 +2,8 @@ export { default as Banner } from './dist/admin/components/elements/Banner';
export { default as Button } from './dist/admin/components/elements/Button';
export { default as Pill } from './dist/admin/components/elements/Pill';
export { default as Popup } from './dist/admin/components/elements/Popup';
export { ShimmerEffect } from './dist/admin/components/elements/ShimmerEffect';
export { default as Tooltip } from './dist/admin/components/elements/Tooltip';
export { default as Check } from './dist/admin/components/icons/Check';
export { default as Chevron } from './dist/admin/components/icons/Chevron';
export { default as Menu } from './dist/admin/components/icons/Menu';

View File

@@ -21,6 +21,12 @@ _export(exports, {
Popup: function() {
return _Popup.default;
},
ShimmerEffect: function() {
return _ShimmerEffect.ShimmerEffect;
},
Tooltip: function() {
return _Tooltip.default;
},
Check: function() {
return _Check.default;
},
@@ -44,6 +50,8 @@ const _Banner = /*#__PURE__*/ _interop_require_default(require("./dist/admin/com
const _Button = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Button"));
const _Pill = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Pill"));
const _Popup = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Popup"));
const _ShimmerEffect = require("./dist/admin/components/elements/ShimmerEffect");
const _Tooltip = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Tooltip"));
const _Check = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Check"));
const _Chevron = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Chevron"));
const _Menu = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Menu"));
@@ -56,4 +64,4 @@ function _interop_require_default(obj) {
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9u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Y0FBSzs7SUFFaEJDLGFBQWE7ZUFBYkEsNEJBQWE7O0lBQ0ZDLE9BQU87ZUFBUEEsZ0JBQU87O0lBQ1BDLEtBQUs7ZUFBTEEsY0FBSzs7SUFDTEMsT0FBTztlQUFQQSxnQkFBTzs7SUFDUEMsSUFBSTtlQUFKQSxhQUFJOztJQUNKQyxNQUFNO2VBQU5BLGVBQU07O0lBQ05DLENBQUM7ZUFBREEsVUFBQzs7SUFDREMsZUFBZTtlQUFmQSxnQkFBZTs7OytEQWREOytEQUNBOzZEQUVGOzhEQUVDOytCQUVIO2dFQUNLOzhEQUNGO2dFQUNFOzZEQUNIOytEQUNFOzBEQUNMO2dFQUNjIn0=

View File

@@ -1,6 +1,10 @@
export { default as Button } from '../dist/admin/components/elements/Button';
export { default as Card } from '../dist/admin/components/elements/Card';
export { DocumentDrawer, DocumentDrawerToggler, baseClass as DocumentDrawerBaseClass, useDocumentDrawer, } from '../dist/admin/components/elements/DocumentDrawer';
export { Drawer, DrawerToggler, formatDrawerSlug } from '../dist/admin/components/elements/Drawer';
export { useDrawerSlug } from '../dist/admin/components/elements/Drawer/useDrawerSlug';
export { default as Eyebrow } from '../dist/admin/components/elements/Eyebrow';
export { Gutter } from '../dist/admin/components/elements/Gutter';
export { ListDrawer, ListDrawerToggler, baseClass as ListDrawerBaseClass, formatListDrawerSlug, useListDrawer, } from '../dist/admin/components/elements/ListDrawer';
export { default as Nav } from '../dist/admin/components/elements/Nav';
//# sourceMappingURL=elements.d.ts.map

View File

@@ -15,20 +15,63 @@ _export(exports, {
Card: function() {
return _Card.default;
},
DocumentDrawer: function() {
return _DocumentDrawer.DocumentDrawer;
},
DocumentDrawerToggler: function() {
return _DocumentDrawer.DocumentDrawerToggler;
},
DocumentDrawerBaseClass: function() {
return _DocumentDrawer.baseClass;
},
useDocumentDrawer: function() {
return _DocumentDrawer.useDocumentDrawer;
},
Drawer: function() {
return _Drawer.Drawer;
},
DrawerToggler: function() {
return _Drawer.DrawerToggler;
},
formatDrawerSlug: function() {
return _Drawer.formatDrawerSlug;
},
useDrawerSlug: function() {
return _useDrawerSlug.useDrawerSlug;
},
Eyebrow: function() {
return _Eyebrow.default;
},
Gutter: function() {
return _Gutter.Gutter;
},
ListDrawer: function() {
return _ListDrawer.ListDrawer;
},
ListDrawerToggler: function() {
return _ListDrawer.ListDrawerToggler;
},
ListDrawerBaseClass: function() {
return _ListDrawer.baseClass;
},
formatListDrawerSlug: function() {
return _ListDrawer.formatListDrawerSlug;
},
useListDrawer: function() {
return _ListDrawer.useListDrawer;
},
Nav: function() {
return _Nav.default;
}
});
const _Button = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/elements/Button"));
const _Card = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/elements/Card"));
const _DocumentDrawer = require("../dist/admin/components/elements/DocumentDrawer");
const _Drawer = require("../dist/admin/components/elements/Drawer");
const _useDrawerSlug = require("../dist/admin/components/elements/Drawer/useDrawerSlug");
const _Eyebrow = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/elements/Eyebrow"));
const _Gutter = require("../dist/admin/components/elements/Gutter");
const _ListDrawer = require("../dist/admin/components/elements/ListDrawer");
const _Nav = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/elements/Nav"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
@@ -36,4 +79,4 @@ function _interop_require_default(obj) {
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZWxlbWVudHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBCdXR0b24gfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2VsZW1lbnRzL0J1dHRvbidcbmV4cG9ydCB7IGRlZmF1bHQgYXMgQ2FyZCB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWV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2VyVG9nZ2xlciIsImZvcm1hdERyYXdlclNsdWciLCJ1c2VEcmF3ZXJTbHVnIiwiRXllYnJvdyIsIkd1dHRlciIsIkxpc3REcmF3ZXIiLCJMaXN0RHJhd2VyVG9nZ2xlciIsIkxpc3REcmF3ZXJCYXNlQ2xhc3MiLCJmb3JtYXRMaXN0RHJhd2VyU2x1ZyIsInVzZUxpc3REcmF3ZXIiLCJOYXYiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0lBQW9CQSxNQUFNO2VBQU5BLGVBQU07O0lBQ05DLElBQUk7ZUFBSkEsYUFBSTs7SUFFdEJDLGNBQWM7ZUFBZEEsOEJBQWM7O0lBQ2RDLHFCQUFxQjtlQUFyQkEscUNBQXFCOztJQUNSQyx1QkFBdUI7ZUFBcENDLHlCQUFTOztJQUNUQyxpQkFBaUI7ZUFBakJBLGlDQUFpQjs7SUFFVkMsTUFBTTtlQUFOQSxjQUFNOztJQUFFQyxhQUFhO2VBQWJBLHFCQUFhOztJQUFFQyxnQkFBZ0I7ZUFBaEJBLHdCQUFnQjs7SUFDdkNDLGFBQWE7ZUFBYkEsNEJBQWE7O0lBRUZDLE9BQU87ZUFBUEEsZ0JBQU87O0lBRWxCQyxNQUFNO2VBQU5BLGNBQU07O0lBRWJDLFVBQVU7ZUFBVkEsc0JBQVU7O0lBQ1ZDLGlCQUFpQjtlQUFqQkEsNkJBQWlCOztJQUNKQyxtQkFBbUI7ZUFBaENWLHFCQUFTOztJQUNUVyxvQkFBb0I7ZUFBcEJBLGdDQUFvQjs7SUFDcEJDLGFBQWE7ZUFBYkEseUJBQWE7O0lBRUtDLEdBQUc7ZUFBSEEsWUFBRzs7OytEQXJCVzs2REFDRjtnQ0FNekI7d0JBQ2lEOytCQUMxQjtnRUFFSzt3QkFFWjs0QkFPaEI7NERBQ3dCIn0=

View File

@@ -1,2 +1,3 @@
export { default as RelationshipComponent } from '../../dist/admin/components/forms/field-types/Relationship';
export type { Option, Props, ValueWithRelation, } from '../../dist/admin/components/forms/field-types/Relationship/types';
//# sourceMappingURL=Relationship.d.ts.map

View File

@@ -2,5 +2,17 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RelationshipComponent", {
enumerable: true,
get: function() {
return _Relationship.default;
}
});
const _Relationship = /*#__PURE__*/ _interop_require_default(require("../../dist/admin/components/forms/field-types/Relationship"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZmllbGRzL1JlbGF0aW9uc2hpcC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBkZWZhdWx0IGFzIFJlbGF0aW9uc2hpcENvbXBvbmVudCB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvUmVsYXRpb25zaGlwJ1xuZXhwb3J0IHR5cGUge1xuICBPcHRpb24sXG4gIFByb3BzLFxuICBWYWx1ZVdpdGhSZWxhdGlvbixcbn0gZnJvbSAnLi4vLi4vLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9maWVsZC10eXBlcy9SZWxhdGlvbnNoaXAvdHlwZXMnXG4iXSwibmFtZXMiOlsiUmVsYXRpb25zaGlwQ29tcG9uZW50Il0sIm1hcHBpbmdzIjoiOzs7OytCQUFvQkE7OztlQUFBQSxxQkFBcUI7OztxRUFBUSJ9

View File

@@ -1,2 +1,2 @@
export type { Props } from '../../dist/admin/components/forms/field-types/RichText/types';
export type { RichTextFieldProps } from '../../dist/admin/components/forms/field-types/RichText/types';
//# sourceMappingURL=RichText.d.ts.map

View File

@@ -1,2 +1,3 @@
export { default as SelectComponent } from '../../dist/admin/components/forms/field-types/Select';
export type { Props } from '../../dist/admin/components/forms/field-types/Select/types';
//# sourceMappingURL=Select.d.ts.map

View File

@@ -2,5 +2,17 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "SelectComponent", {
enumerable: true,
get: function() {
return _Select.default;
}
});
const _Select = /*#__PURE__*/ _interop_require_default(require("../../dist/admin/components/forms/field-types/Select"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZmllbGRzL1NlbGVjdC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBkZWZhdWx0IGFzIFNlbGVjdENvbXBvbmVudCB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvU2VsZWN0J1xuZXhwb3J0IHR5cGUgeyBQcm9wcyB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvU2VsZWN0L3R5cGVzJ1xuIl0sIm5hbWVzIjpbIlNlbGVjdENvbXBvbmVudCJdLCJtYXBwaW5ncyI6Ijs7OzsrQkFBb0JBOzs7ZUFBQUEsZUFBZTs7OytEQUFRIn0=

View File

@@ -1,3 +1,5 @@
export { default as Error } from '../dist/admin/components/forms/Error';
export { default as FieldDescription } from '../dist/admin/components/forms/FieldDescription';
export { default as Form } from '../dist/admin/components/forms/Form';
export { useAllFormFields, useForm, useFormFields, useFormModified, useFormProcessing, useFormSubmitted,
/**
@@ -7,7 +9,9 @@ useWatchForm, } from '../dist/admin/components/forms/Form/context';
export { default as getSiblingData } from '../dist/admin/components/forms/Form/getSiblingData';
export { default as reduceFieldsToValues } from '../dist/admin/components/forms/Form/reduceFieldsToValues';
export { default as Label } from '../dist/admin/components/forms/Label';
export { default as RenderFields } from '../dist/admin/components/forms/RenderFields';
export { default as Submit } from '../dist/admin/components/forms/Submit';
export { default as FormSubmit } from '../dist/admin/components/forms/Submit';
export { default as Checkbox } from '../dist/admin/components/forms/field-types/Checkbox';
export { default as Group } from '../dist/admin/components/forms/field-types/Group';
export { default as Select } from '../dist/admin/components/forms/field-types/Select';

View File

@@ -9,6 +9,12 @@ function _export(target, all) {
});
}
_export(exports, {
Error: function() {
return _Error.default;
},
FieldDescription: function() {
return _FieldDescription.default;
},
Form: function() {
return _Form.default;
},
@@ -44,9 +50,15 @@ _export(exports, {
Label: function() {
return _Label.default;
},
RenderFields: function() {
return _RenderFields.default;
},
Submit: function() {
return _Submit.default;
},
FormSubmit: function() {
return _Submit.default;
},
Checkbox: function() {
return _Checkbox.default;
},
@@ -75,11 +87,14 @@ _export(exports, {
return _withCondition.default;
}
});
const _Error = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/Error"));
const _FieldDescription = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/FieldDescription"));
const _Form = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/Form"));
const _context = require("../dist/admin/components/forms/Form/context");
const _getSiblingData = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/Form/getSiblingData"));
const _reduceFieldsToValues = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/Form/reduceFieldsToValues"));
const _Label = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/Label"));
const _RenderFields = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/RenderFields"));
const _Submit = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/Submit"));
const _Checkbox = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/field-types/Checkbox"));
const _Group = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/field-types/Group"));
@@ -95,4 +110,4 @@ function _interop_require_default(obj) {
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZm9ybXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBGb3JtIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9Gb3JtJ1xuXG5leHBvcnQge1xuICB1c2VBbGxGb3JtRmllbGRzLFxuICB1c2VGb3JtLFxuICB1c2VGb3JtRmllbGRzLFxuICB1c2VGb3JtTW9kaWZpZWQsXG4gIHVzZUZvcm1Qcm9jZXNzaW5nLFxuICB1c2VGb3JtU3VibWl0dGVkLFxuICAvKipcbiAgICogQGRlcHJlY2F0ZWQgdXNlV2F0Y2hGb3JtIGlzIG5vIGxvbmdlciBwcmVmZXJyZWQuIElmIHlvdSBuZWVkIGFsbCBmb3JtIGZpZWxkcywgcHJlZmVyIGB1c2VBbGxGb3JtRmllbGRzYC5cbiAgICovXG4gIHVzZVdhdGNoRm9ybSxcbn0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9Gb3JtL2NvbnRleHQnXG5cbmV4cG9ydCB7IGRlZmF1bHQgYXMgZ2V0U2libGluZ0RhdGEgfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL0Zvcm0vZ2V0U2libGluZ0RhdGEnXG5cbmV4cG9ydCB7IGRlZmF1bHQgYXMgcmVkdWNlRmllbGRzVG9WYWx1ZXMgfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL0Zvcm0vcmVkdWNlRmllbGRzVG9WYWx1ZXMnXG5cbmV4cG9ydCB7IGRlZmF1bHQgYXMgTGFiZ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2QkFBb0I7O0lBRXBCQyxLQUFLO2VBQUxBLGNBQUs7O0lBRUxDLFlBQVk7ZUFBWkEscUJBQVk7O0lBQ1pDLE1BQU07ZUFBTkEsZUFBTTs7SUFFTkMsVUFBVTtlQUFWQSxlQUFVOztJQUNWQyxRQUFRO2VBQVJBLGlCQUFROztJQUNSQyxLQUFLO2VBQUxBLGNBQUs7O0lBRUxDLE1BQU07ZUFBTkEsZUFBTTs7SUFDTkMsV0FBVztlQUFYQSxjQUFXOztJQUVYQyxJQUFJO2VBQUpBLGFBQUk7O0lBQ0pDLFNBQVM7ZUFBVEEsZUFBUzs7SUFJVEMsWUFBWTtlQUFaQSxpQkFBWTs7SUFFWkMsUUFBUTtlQUFSQSxpQkFBUTs7SUFDUkMsYUFBYTtlQUFiQSxzQkFBYTs7OzhEQTFDQTt5RUFFVzs2REFFWjt5QkFhekI7dUVBRW1DOzZFQUNNOzhEQUVmO3FFQUVPOytEQUNOO2lFQUdFOzhEQUNIOytEQUVDOzhEQUNLOzZEQUVQOytEQUNLO2lFQUlHO3NFQUdDIn0=

View File

@@ -0,0 +1,7 @@
export { default as AccountGraphic } from '../dist/admin/components/graphics/Account';
export { default as DefaultBlockImageGraphic } from '../dist/admin/components/graphics/DefaultBlockImage';
export { default as FileGraphic } from '../dist/admin/components/graphics/File';
export { default as IconGraphic } from '../dist/admin/components/graphics/Icon';
export { default as LogoGraphic } from '../dist/admin/components/graphics/Logo';
export { default as SearchGraphic } from '../dist/admin/components/graphics/Search';
//# sourceMappingURL=graphics.d.ts.map

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AccountGraphic: function() {
return _Account.default;
},
DefaultBlockImageGraphic: function() {
return _DefaultBlockImage.default;
},
FileGraphic: function() {
return _File.default;
},
IconGraphic: function() {
return _Icon.default;
},
LogoGraphic: function() {
return _Logo.default;
},
SearchGraphic: function() {
return _Search.default;
}
});
const _Account = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/Account"));
const _DefaultBlockImage = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/DefaultBlockImage"));
const _File = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/File"));
const _Icon = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/Icon"));
const _Logo = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/Logo"));
const _Search = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/Search"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZ3JhcGhpY3MudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBBY2NvdW50R3JhcGhpYyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZ3JhcGhpY3MvQWNjb3VudCdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgRGVmYXVsdEJsb2NrSW1hZ2VHcmFwaGljIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9ncmFwaGljcy9EZWZhdWx0QmxvY2tJbWFnZSdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgRmlsZUdyYXBoaWMgfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2dyYXBoaWNzL0ZpbGUnXG5leHBvcnQgeyBkZWZhdWx0IGFzIEljb25HcmFwaGljIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9ncmFwaGljcy9JY29uJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBMb2dvR3JhcGhpYyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZ3JhcGhpY3MvTG9nbydcbmV4cG9ydCB7IGRlZmF1bHQgYXMgU2VhcmNoR3JhcGhpYyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZ3JhcGhpY3MvU2VhcmNoJ1xuIl0sIm5hbWVzIjpbIkFjY291bnRHcmFwaGljIiwiRGVmYXVsdEJsb2NrSW1hZ2VHcmFwaGljIiwiRmlsZUdyYXBoaWMiLCJJY29uR3JhcGhpYyIsIkxvZ29HcmFwaGljIiwiU2VhcmNoR3JhcGhpYyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7SUFBb0JBLGNBQWM7ZUFBZEEsZ0JBQWM7O0lBQ2RDLHdCQUF3QjtlQUF4QkEsMEJBQXdCOztJQUN4QkMsV0FBVztlQUFYQSxhQUFXOztJQUNYQyxXQUFXO2VBQVhBLGFBQVc7O0lBQ1hDLFdBQVc7ZUFBWEEsYUFBVzs7SUFDWEMsYUFBYTtlQUFiQSxlQUFhOzs7Z0VBTFM7MEVBQ1U7NkRBQ2I7NkRBQ0E7NkRBQ0E7K0RBQ0UifQ==

View File

@@ -1,2 +1,13 @@
export { useStepNav } from '../dist/admin/components/elements/StepNav';
export { default as useDebounce } from '../dist/admin/hooks/useDebounce';
export { useDebouncedCallback } from '../dist/admin/hooks/useDebouncedCallback';
export { useDelay } from '../dist/admin/hooks/useDelay';
export { useDelayedRender } from '../dist/admin/hooks/useDelayedRender';
export { default as useHotkey } from '../dist/admin/hooks/useHotkey';
export { default as useIntersect } from '../dist/admin/hooks/useIntersect';
export { default as useMountEffect } from '../dist/admin/hooks/useMountEffect';
export { default as usePayloadAPI } from '../dist/admin/hooks/usePayloadAPI';
export { default as useThrottledEffect } from '../dist/admin/hooks/useThrottledEffect';
export { default as useThumbnail } from '../dist/admin/hooks/useThumbnail';
export { default as useTitle, formatUseAsTitle } from '../dist/admin/hooks/useTitle';
//# sourceMappingURL=hooks.d.ts.map

View File

@@ -2,12 +2,108 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useStepNav", {
enumerable: true,
get: function() {
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
useStepNav: function() {
return _StepNav.useStepNav;
},
useDebounce: function() {
return _useDebounce.default;
},
useDebouncedCallback: function() {
return _useDebouncedCallback.useDebouncedCallback;
},
useDelay: function() {
return _useDelay.useDelay;
},
useDelayedRender: function() {
return _useDelayedRender.useDelayedRender;
},
useHotkey: function() {
return _useHotkey.default;
},
useIntersect: function() {
return _useIntersect.default;
},
useMountEffect: function() {
return _useMountEffect.default;
},
usePayloadAPI: function() {
return _usePayloadAPI.default;
},
useThrottledEffect: function() {
return _useThrottledEffect.default;
},
useThumbnail: function() {
return _useThumbnail.default;
},
useTitle: function() {
return _useTitle.default;
},
formatUseAsTitle: function() {
return _useTitle.formatUseAsTitle;
}
});
const _StepNav = require("../dist/admin/components/elements/StepNav");
const _useDebounce = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useDebounce"));
const _useDebouncedCallback = require("../dist/admin/hooks/useDebouncedCallback");
const _useDelay = require("../dist/admin/hooks/useDelay");
const _useDelayedRender = require("../dist/admin/hooks/useDelayedRender");
const _useHotkey = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useHotkey"));
const _useIntersect = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useIntersect"));
const _useMountEffect = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useMountEffect"));
const _usePayloadAPI = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/usePayloadAPI"));
const _useThrottledEffect = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useThrottledEffect"));
const _useThumbnail = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useThumbnail"));
const _useTitle = /*#__PURE__*/ _interop_require_wildcard(require("../dist/admin/hooks/useTitle"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvaG9va3MudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgdXNlU3RlcE5hdiB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvU3RlcE5hdidcbiJdLCJuYW1lcyI6WyJ1c2VTdGVwTmF2Il0sIm1hcHBpbmdzIjoiOzs7OytCQUFTQTs7O2VBQUFBLG1CQUFVOzs7eUJBQVEifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvaG9va3MudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgdXNlU3RlcE5hdiB9IGZyb20gJy4uLy4uL2FkbWluL2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RVc2VBc1RpdGxlIH0gZnJvbSAnLi4vLi4vYWRtaW4vaG9va3MvdXNlVGl0bGUnXG4iXSwibmFtZXMiOlsidXNlU3RlcE5hdiIsInVzZURlYm91bmNlIiwidXNlRGVib3VuY2VkQ2FsbGJhY2siLCJ1c2VEZWxheSIsInVzZURlbGF5ZWRSZW5kZXIiLCJ1c2VIb3RrZXkiLCJ1c2VJbnRlcnNlY3QiLCJ1c2VNb3VudEVmZmVjdCIsInVzZVBheWxvYWRBUEkiLCJ1c2VUaHJvdHRsZWRFZmZlY3QiLCJ1c2VUaHVtYm5haWwiLCJ1c2VUaXRsZSIsImZvcm1hdFVzZUFzVGl0bGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0lBQVNBLFVBQVU7ZUFBVkEsbUJBQVU7O0lBQ0NDLFdBQVc7ZUFBWEEsb0JBQVc7O0lBQ3RCQyxvQkFBb0I7ZUFBcEJBLDBDQUFvQjs7SUFDcEJDLFFBQVE7ZUFBUkEsa0JBQVE7O0lBQ1JDLGdCQUFnQjtlQUFoQkEsa0NBQWdCOztJQUNMQyxTQUFTO2VBQVRBLGtCQUFTOztJQUNUQyxZQUFZO2VBQVpBLHFCQUFZOztJQUNaQyxjQUFjO2VBQWRBLHVCQUFjOztJQUNkQyxhQUFhO2VBQWJBLHNCQUFhOztJQUNiQyxrQkFBa0I7ZUFBbEJBLDJCQUFrQjs7SUFDbEJDLFlBQVk7ZUFBWkEscUJBQVk7O0lBQ1pDLFFBQVE7ZUFBUkEsaUJBQVE7O0lBQUVDLGdCQUFnQjtlQUFoQkEsMEJBQWdCOzs7eUJBWG5CO29FQUNZO3NDQUNGOzBCQUNaO2tDQUNRO2tFQUNJO3FFQUNHO3VFQUNFO3NFQUNEOzJFQUNLO3FFQUNOO2tFQUNjIn0=

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,9 @@
export { default as buildStateFromSchema } from '../dist/admin/components/forms/Form/buildStateFromSchema';
export { useAuth } from '../dist/admin/components/utilities/Auth';
export { useConfig } from '../dist/admin/components/utilities/Config';
export { useDocumentInfo } from '../dist/admin/components/utilities/DocumentInfo';
export { useEditDepth } from '../dist/admin/components/utilities/EditDepth';
export { useLocale } from '../dist/admin/components/utilities/Locale';
export { default as Meta } from '../dist/admin/components/utilities/Meta';
export { withMergedProps } from '../dist/admin/components/utilities/WithMergedProps';
//# sourceMappingURL=utilities.d.ts.map

View File

@@ -9,6 +9,9 @@ function _export(target, all) {
});
}
_export(exports, {
buildStateFromSchema: function() {
return _buildStateFromSchema.default;
},
useAuth: function() {
return _Auth.useAuth;
},
@@ -26,18 +29,23 @@ _export(exports, {
},
Meta: function() {
return _Meta.default;
},
withMergedProps: function() {
return _WithMergedProps.withMergedProps;
}
});
const _buildStateFromSchema = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/Form/buildStateFromSchema"));
const _Auth = require("../dist/admin/components/utilities/Auth");
const _Config = require("../dist/admin/components/utilities/Config");
const _DocumentInfo = require("../dist/admin/components/utilities/DocumentInfo");
const _EditDepth = require("../dist/admin/components/utilities/EditDepth");
const _Locale = require("../dist/admin/components/utilities/Locale");
const _Meta = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/utilities/Meta"));
const _WithMergedProps = require("../dist/admin/components/utilities/WithMergedProps");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvdXRpbGl0aWVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IHVzZUF1dGggfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL3V0aWxpdGllcy9BdXRoJ1xuZXhwb3J0IHsgdXNlQ29uZmlnIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy91dGlsaXRpZXMvQ29uZmlnJ1xuZXhwb3J0I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FZOztJQUNaQyxTQUFTO2VBQVRBLGlCQUFTOztJQUNFQyxJQUFJO2VBQUpBLGFBQUk7O0lBQ2ZDLGVBQWU7ZUFBZkEsZ0NBQWU7Ozs2RUFQd0I7c0JBQ3hCO3dCQUNFOzhCQUNNOzJCQUNIO3dCQUNIOzZEQUNNO2lDQUNBIn0=

View File

@@ -1,5 +1,6 @@
export { buildConfig } from './dist/config/build';
export * from './dist/config/types';
export { type FieldTypes, fieldTypes } from './dist/admin/components/forms/field-types';
export { defaults } from './dist/config/defaults';
export { sanitizeConfig } from './dist/config/sanitize';
//# sourceMappingURL=config.d.ts.map

View File

@@ -12,6 +12,9 @@ _export(exports, {
buildConfig: function() {
return _build.buildConfig;
},
fieldTypes: function() {
return _fieldtypes.fieldTypes;
},
defaults: function() {
return _defaults.defaults;
},
@@ -21,6 +24,7 @@ _export(exports, {
});
const _build = require("./dist/config/build");
_export_star(require("./dist/config/types"), exports);
const _fieldtypes = require("./dist/admin/components/forms/field-types");
const _defaults = require("./dist/config/defaults");
const _sanitize = require("./dist/config/sanitize");
function _export_star(from, to) {
@@ -37,4 +41,4 @@ function _export_star(from, to) {
return from;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRzL2NvbmZpZy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBidWlsZENvbmZpZyB9IGZyb20gJy4uL2NvbmZpZy9idWlsZCdcbmV4cG9ydCAqIGZyb20gJy4uL2NvbmZpZy90eXBlcydcblxuZXhwb3J0IHsgZGVmYXVsdHMgfSBmcm9tICcuLi9jb25maWcvZGVmYXVsdHMnXG5cbmV4cG9ydCB7IHNhbml0aXplQ29uZmlnIH0gZnJvbSAnLi4vY29uZmlnL3Nhbml0aXplJ1xuIl0sIm5hbWVzIjpbImJ1aWxkQ29uZmlnIiwiZGVmYXVsdHMiLCJzYW5pdGl6ZUNvbmZpZyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7SUFBU0EsV0FBVztlQUFYQSxrQkFBVzs7SUFHWEMsUUFBUTtlQUFSQSxrQkFBUTs7SUFFUkMsY0FBYztlQUFkQSx3QkFBYzs7O3VCQUxLO3FCQUNkOzBCQUVXOzBCQUVNIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRzL2NvbmZpZy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBidWlsZENvbmZpZyB9IGZyb20gJy4uL2NvbmZpZy9idWlsZCdcbmV4cG9ydCAqIGZyb20gJy4uL2NvbmZpZy90eXBlcydcblxuZXhwb3J0IHsgdHlwZSBGaWVsZFR5cGVzLCBmaWVsZFR5cGVzIH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9maWVsZC10eXBlcydcblxuZXhwb3J0IHsgZGVmYXVsdHMgfSBmcm9tICcuLi9jb25maWcvZGVmYXVsdHMnXG5leHBvcnQgeyBzYW5pdGl6ZUNvbmZpZyB9IGZyb20gJy4uL2NvbmZpZy9zYW5pdGl6ZSdcbiJdLCJuYW1lcyI6WyJidWlsZENvbmZpZyIsImZpZWxkVHlwZXMiLCJkZWZhdWx0cyIsInNhbml0aXplQ29uZmlnIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztJQUFTQSxXQUFXO2VBQVhBLGtCQUFXOztJQUdNQyxVQUFVO2VBQVZBLHNCQUFVOztJQUUzQkMsUUFBUTtlQUFSQSxrQkFBUTs7SUFDUkMsY0FBYztlQUFkQSx3QkFBYzs7O3VCQU5LO3FCQUNkOzRCQUU4QjswQkFFbkI7MEJBQ00ifQ==

View File

@@ -14,14 +14,15 @@
"require": "./src/index.ts",
"types": "./src/index.ts"
},
"./scss": {
"import": "./src/exports/scss.scss",
"require": "./src/exports/scss.scss",
"default": "./src/exports/scss.scss"
},
"./*": {
"import": "./src/exports/*.ts",
"require": "./src/exports/*.ts",
"types": "./src/exports/*.ts"
},
"./scss": {
"import": "./src/exports/scss.scss",
"require": "./src/exports/scss.scss"
}
},
"scripts": {
@@ -129,10 +130,8 @@
"scheduler": "0.23.0",
"scmp": "2.1.0",
"sharp": "0.31.3",
"slate": "0.91.4",
"slate-history": "0.86.0",
"slate-hyperscript": "0.81.3",
"slate-react": "0.92.0",
"swc-loader": "0.2.3",
"terser-webpack-plugin": "5.3.9",
"ts-essentials": "7.0.3",
"use-context-selector": "1.4.1",
"uuid": "8.3.2"

View File

@@ -9,7 +9,7 @@ import Form from '../../forms/Form'
import { useForm } from '../../forms/Form/context'
import RenderFields from '../../forms/RenderFields'
import FormSubmit from '../../forms/Submit'
import fieldTypes from '../../forms/field-types'
import { fieldTypes } from '../../forms/field-types'
import X from '../../icons/X'
import { useAuth } from '../../utilities/Auth'
import { useConfig } from '../../utilities/Config'

View File

@@ -3,7 +3,7 @@ import equal from 'deep-equal'
import type { FieldAction, Fields, FormField } from './types'
import deepCopyObject from '../../../../utilities/deepCopyObject'
import { deepCopyObject } from '../../../../utilities/deepCopyObject'
import getSiblingData from './getSiblingData'
import reduceFieldsToValues from './reduceFieldsToValues'
import { flattenRows, separateRows } from './rows'

View File

@@ -69,12 +69,12 @@ export const filterFields = (args: {
if (FieldComponent) {
acc.push({
name: 'name' in field ? field.name : '',
FieldComponent,
field,
fieldIsPresentational,
fieldPermissions,
isFieldAffectingData,
name: 'name' in field ? field.name : '',
readOnly,
})
}

View File

@@ -1,16 +1,15 @@
import React, { Suspense, lazy } from 'react'
import React from 'react'
import type { Props } from './types'
import type { RichTextField } from '../../../../../fields/config/types'
import type { RichTextAdapter } from './types'
import { ShimmerEffect } from '../../../elements/ShimmerEffect'
import { useConfig } from '../../../utilities/Config'
// @ts-expect-error Just TypeScript being broken // TODO: Open TypeScript issue
const RichText = lazy(() => import('./RichText'))
const RichText: React.FC<RichTextField> = (props) => {
const config = useConfig()
// eslint-disable-next-line react/destructuring-assignment
const editor: RichTextAdapter = props.editor || config.editor
return <editor.FieldComponent {...props} />
}
const RichTextField: React.FC<Props> = (props) => (
<Suspense fallback={<ShimmerEffect height="35vh" />}>
<RichText {...props} />
</Suspense>
)
export default RichTextField
export default RichText

View File

@@ -1,17 +1,24 @@
import type { PayloadRequest } from '../../../../../express/types'
import type { RichTextField } from '../../../../../fields/config/types'
import type { CellComponentProps } from '../../../views/collections/List/Cell/types'
export type Props = Omit<RichTextField, 'type'> & {
export type RichTextFieldProps<AdapterProps = unknown> = Omit<
RichTextField<AdapterProps>,
'type'
> & {
path?: string
}
export type TextNode = { [x: string]: unknown; text: string }
export type ElementNode = { children: (ElementNode | TextNode)[]; type?: string }
export function nodeIsTextNode(node: ElementNode | TextNode): node is TextNode {
return 'text' in node
}
export interface RichTextAdapter {
component: React.FC<Props>
export type RichTextAdapter<AdapterProps = unknown> = {
CellComponent: React.FC<CellComponentProps<RichTextField<AdapterProps>>>
FieldComponent: React.FC<RichTextFieldProps<AdapterProps>>
afterReadPromise?: (data: {
currentDepth?: number
depth: number
field: RichTextField<AdapterProps>
overrideAccess?: boolean
req: PayloadRequest
showHiddenFields: boolean
siblingDoc: Record<string, unknown>
}) => Promise<void> | null
}

View File

@@ -50,7 +50,7 @@ export type FieldTypes = {
upload: React.ComponentType<any>
}
const fieldTypes: FieldTypes = {
export const fieldTypes: FieldTypes = {
array,
blocks,
checkbox,
@@ -76,5 +76,3 @@ const fieldTypes: FieldTypes = {
ui,
upload,
}
export default fieldTypes

View File

@@ -0,0 +1,36 @@
import { deepMerge } from 'payload/utilities'
import React from 'react'
/**
* Creates a higher-order component (HOC) that merges predefined properties (`toMergeIntoProps`)
* with any properties passed to the resulting component.
*
* Use this when you want to pre-specify some props for a component, while also allowing users to
* pass in their own props. The HOC ensures the passed props and predefined props are combined before
* rendering the original component.
*
* @example
* const PredefinedComponent = getMergedPropsComponent({
* Component: OriginalComponent,
* toMergeIntoProps: { someExtraValue: 5 }
* });
* // Using <PredefinedComponent customProp="value" /> will result in
* // <OriginalComponent customProp="value" someExtraValue={5} />
*
* @returns A higher-order component with combined properties.
*/
export function withMergedProps<ToMergeIntoProps, CompleteReturnProps>({
Component,
toMergeIntoProps,
}: {
Component: React.FC<CompleteReturnProps>
toMergeIntoProps: ToMergeIntoProps
}): React.FC<CompleteReturnProps> {
// A wrapper around the args.Component to inject the args.toMergeArgs as props, which are merged with the passed props
const MergedPropsComponent: React.FC<CompleteReturnProps> = (passedProps) => {
const mergedProps = deepMerge(toMergeIntoProps, passedProps)
return <Component {...mergedProps} />
}
return MergedPropsComponent
}

View File

@@ -12,7 +12,7 @@ import ReactSelect from '../../elements/ReactSelect'
import Form from '../../forms/Form'
import Label from '../../forms/Label'
import RenderFields from '../../forms/RenderFields'
import fieldTypes from '../../forms/field-types'
import { fieldTypes } from '../../forms/field-types'
import LeaveWithoutSaving from '../../modals/LeaveWithoutSaving'
import { useAuth } from '../../utilities/Auth'
import Meta from '../../utilities/Meta'

View File

@@ -7,7 +7,7 @@ import type { Props } from './types'
import Form from '../../forms/Form'
import RenderFields from '../../forms/RenderFields'
import FormSubmit from '../../forms/Submit'
import fieldTypes from '../../forms/field-types'
import { fieldTypes } from '../../forms/field-types'
import MinimalTemplate from '../../templates/Minimal'
import { useAuth } from '../../utilities/Auth'
import { useConfig } from '../../utilities/Config'

View File

@@ -8,7 +8,7 @@ import { DocumentControls } from '../../../elements/DocumentControls'
import { Gutter } from '../../../elements/Gutter'
import ViewDescription from '../../../elements/ViewDescription'
import RenderFields from '../../../forms/RenderFields'
import fieldTypes from '../../../forms/field-types'
import { fieldTypes } from '../../../forms/field-types'
import LeaveWithoutSaving from '../../../modals/LeaveWithoutSaving'
import Meta from '../../../utilities/Meta'
import './index.scss'

View File

@@ -1,112 +0,0 @@
import { Text } from 'slate'
export const richTextToHTML = (content: unknown): string => {
if (Array.isArray(content)) {
return content.reduce((output, node) => {
const isTextNode = Text.isText(node)
const { bold, code, italic, strikethrough, text, underline } = node
if (isTextNode) {
// convert straight single quotations to curly
// "\u201C" is starting double curly
// "\u201D" is ending double curly
let html = text?.replace(/'/g, '\u2019') // single quotes
if (bold) {
html = `<strong>${html}</strong>`
}
if (code) {
html = `<code>${html}</code>`
}
if (italic) {
html = `<em>${html}</em>`
}
if (underline) {
html = `<span style="text-decoration: underline;">${html}</span>`
}
if (strikethrough) {
html = `<span style="text-decoration: line-through;">${html}</span>`
}
return `${output}${html}`
}
if (node) {
let nodeHTML
switch (node.type) {
case 'h1':
nodeHTML = `<h1>${richTextToHTML(node.children)}</h1>`
break
case 'h2':
nodeHTML = `<h2>${richTextToHTML(node.children)}</h2>`
break
case 'h3':
nodeHTML = `<h3>${richTextToHTML(node.children)}</h3>`
break
case 'h4':
nodeHTML = `<h4>${richTextToHTML(node.children)}</h4>`
break
case 'h5':
nodeHTML = `<h5>${richTextToHTML(node.children)}</h5>`
break
case 'h6':
nodeHTML = `<h6>${richTextToHTML(node.children)}</h6>`
break
case 'blockquote':
nodeHTML = `<blockquote>${richTextToHTML(node.children)}</blockquote>`
break
case 'ul':
nodeHTML = `<ul>${richTextToHTML(node.children)}</ul>`
break
case 'ol':
nodeHTML = `<ol>${richTextToHTML(node.children)}</ol>`
break
case 'li':
nodeHTML = `<li>${richTextToHTML(node.children)}</li>`
break
case 'link':
nodeHTML = `<a href="${node.url}">${richTextToHTML(node.children)}</a>`
break
case 'relationship':
nodeHTML = `<strong>Relationship to ${node.relationTo}: ${node.value}</strong><br/>`
break
case 'upload':
nodeHTML = `<strong>${node.relationTo} Upload: ${node.value}</strong><br/>`
break
case 'p':
case undefined:
nodeHTML = `<p>${richTextToHTML(node.children)}</p>`
break
default:
nodeHTML = `<strong>${node.type}</strong>:<br/>${JSON.stringify(node)}`
break
}
return `${output}${nodeHTML}\n`
}
return output
}, '')
}
return ''
}

View File

@@ -1,63 +0,0 @@
import { Text } from 'slate'
export const stringifyRichText = (content: unknown): string => {
if (Array.isArray(content)) {
return content.reduce((output, node) => {
const isTextNode = Text.isText(node)
const { text } = node
if (isTextNode) {
// convert straight single quotations to curly
// "\u201C" is starting double curly
// "\u201D" is ending double curly
const sanitizedText = text?.replace(/'/g, '\u2019') // single quotes
return `${output}${sanitizedText}`
}
if (node) {
let nodeHTML
switch (node.type) {
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
case 'li':
case 'p':
case undefined:
nodeHTML = `${stringifyRichText(node.children)}\n`
break
case 'ul':
case 'ol':
nodeHTML = `${stringifyRichText(node.children)}\n\n`
break
case 'link':
nodeHTML = `${stringifyRichText(node.children)}`
break
case 'relationship':
nodeHTML = `Relationship to ${node.relationTo}: ${node?.value?.id}\n\n`
break
case 'upload':
nodeHTML = `${node.relationTo} Upload: ${node?.value?.id}\n\n`
break
default:
nodeHTML = `${node.type}: ${JSON.stringify(node)}\n\n`
break
}
return `${output}${nodeHTML}`
}
return output
}, '')
}
return ''
}

View File

@@ -8,7 +8,7 @@ import { DocumentControls } from '../../../../elements/DocumentControls'
import { Gutter } from '../../../../elements/Gutter'
import RenderFields from '../../../../forms/RenderFields'
import { filterFields } from '../../../../forms/RenderFields/filterFields'
import fieldTypes from '../../../../forms/field-types'
import { fieldTypes } from '../../../../forms/field-types'
import LeaveWithoutSaving from '../../../../modals/LeaveWithoutSaving'
import Meta from '../../../../utilities/Meta'
import Auth from '../Auth'

View File

@@ -2,15 +2,14 @@ import React from 'react'
import { useTranslation } from 'react-i18next'
import type { ArrayField } from '../../../../../../../../fields/config/types'
import type { CellComponentProps } from '../../types'
import { getTranslation } from '../../../../../../../../utilities/getTranslation'
type Props = {
data: Record<string, unknown>
field: ArrayField
}
const ArrayCell: React.FC<Props> = ({ data, field }) => {
const ArrayCell: React.FC<CellComponentProps<ArrayField, Record<string, unknown>>> = ({
data,
field,
}) => {
const { i18n, t } = useTranslation('general')
const arrayFields = data ?? []
const label = `${arrayFields.length} ${getTranslation(field?.labels?.plural || t('rows'), i18n)}`

View File

@@ -2,15 +2,11 @@ import React from 'react'
import { useTranslation } from 'react-i18next'
import type { BlockField } from '../../../../../../../../fields/config/types'
import type { CellComponentProps } from '../../types'
import { getTranslation } from '../../../../../../../../utilities/getTranslation'
type Props = {
data: any
field: BlockField
}
const BlocksCell: React.FC<Props> = ({ data, field }: Props) => {
const BlocksCell: React.FC<CellComponentProps<BlockField, any>> = ({ data, field }) => {
const { i18n, t } = useTranslation('fields')
const selectedBlocks = data ? data.map(({ blockType }) => blockType) : []
const blockLabels = field.blocks.map((s) => ({

View File

@@ -1,9 +1,12 @@
import React from 'react'
import type { CheckboxField } from '../../../../../../../../exports/types'
import type { CellComponentProps } from '../../types'
import './index.scss'
// Handles boolean values
const Checkbox = ({ data }) => (
const Checkbox: React.FC<CellComponentProps<CheckboxField>> = ({ data }) => (
<code className="bool-cell">
<span>{JSON.stringify(data)}</span>
</code>

View File

@@ -1,8 +1,11 @@
import React from 'react'
import type { CodeField } from '../../../../../../../../exports/types'
import type { CellComponentProps } from '../../types'
import './index.scss'
const CodeCell = ({ data }) => {
const CodeCell: React.FC<CellComponentProps<CodeField, string>> = ({ data }) => {
const textToShow = data.length > 100 ? `${data.substring(0, 100)}\u2026` : data
return (

View File

@@ -1,10 +1,13 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import type { DateField } from '../../../../../../../../exports/types'
import type { CellComponentProps } from '../../types'
import { formatDate } from '../../../../../../../utilities/formatDate'
import { useConfig } from '../../../../../../utilities/Config'
const DateCell = ({ data, field }) => {
const DateCell: React.FC<CellComponentProps<DateField, any>> = ({ data, field }) => {
const {
admin: { dateFormat: dateFormatFromConfig },
} = useConfig()

View File

@@ -1,11 +1,13 @@
import React from 'react'
import type { CellComponentProps } from '../../types'
import Thumbnail from '../../../../../../elements/Thumbnail'
import './index.scss'
const baseClass = 'file'
const File = ({ collection, data, rowData }) => {
const File: React.FC<CellComponentProps<any, any>> = ({ collection, data, rowData }) => {
return (
<div className={baseClass}>
<Thumbnail

View File

@@ -1,8 +1,11 @@
import React from 'react'
import type { JSONField } from '../../../../../../../../exports/types'
import type { CellComponentProps } from '../../types'
import './index.scss'
const JSONCell = ({ data }) => {
const JSONCell: React.FC<CellComponentProps<JSONField, string>> = ({ data }) => {
const textToShow = data.length > 100 ? `${data.substring(0, 100)}\u2026` : data
return (

View File

@@ -1,7 +1,8 @@
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import type { Props as DefaultCellProps } from '../../types'
import type { RelationshipField } from '../../../../../../../../exports/types'
import type { CellComponentProps } from '../../types'
import { getTranslation } from '../../../../../../../../utilities/getTranslation'
import useIntersect from '../../../../../../../hooks/useIntersect'
@@ -14,10 +15,7 @@ type Value = { relationTo: string; value: number | string }
const baseClass = 'relationship-cell'
const totalToShow = 3
const RelationshipCell: React.FC<{
data: DefaultCellProps['cellData']
field: DefaultCellProps['field']
}> = (props) => {
const RelationshipCell: React.FC<CellComponentProps<RelationshipField>> = (props) => {
const { data: cellData, field } = props
const config = useConfig()
const { collections, routes } = config

View File

@@ -1,10 +1,17 @@
import React from 'react'
const RichTextCell = ({ data }) => {
const flattenedText = data?.map((i) => i?.children?.map((c) => c.text)).join(' ')
const textToShow =
flattenedText?.length > 100 ? `${flattenedText.slice(0, 100)}\u2026` : flattenedText
return <span>{textToShow}</span>
import type { RichTextField } from '../../../../../../../../fields/config/types'
import type { RichTextAdapter } from '../../../../../../forms/field-types/RichText/types'
import type { CellComponentProps } from '../../types'
import { useConfig } from '../../../../../../utilities/Config'
const RichTextCell: React.FC<CellComponentProps<RichTextField>> = (props) => {
const config = useConfig()
// eslint-disable-next-line react/destructuring-assignment
const editor: RichTextAdapter = props.field.editor || config.editor
return <editor.CellComponent {...props} />
}
export default RichTextCell

View File

@@ -2,16 +2,12 @@ import React from 'react'
import { useTranslation } from 'react-i18next'
import type { OptionObject, SelectField } from '../../../../../../../../fields/config/types'
import type { CellComponentProps } from '../../types'
import { optionsAreObjects } from '../../../../../../../../fields/config/types'
import { getTranslation } from '../../../../../../../../utilities/getTranslation'
type Props = {
data: any
field: SelectField
}
const SelectCell: React.FC<Props> = ({ data, field }: Props) => {
const SelectCell: React.FC<CellComponentProps<SelectField, any>> = ({ data, field }) => {
const { i18n } = useTranslation()
const findLabel = (items: string[]) =>
items

View File

@@ -1,6 +1,9 @@
import React from 'react'
const TextareaCell = ({ data }) => {
import type { TextareaField } from '../../../../../../../../exports/types'
import type { CellComponentProps } from '../../types'
const TextareaCell: React.FC<CellComponentProps<TextareaField, string>> = ({ data }) => {
const textToShow = data?.length > 100 ? `${data.substr(0, 100)}\u2026` : data
return <span>{textToShow}</span>
}

View File

@@ -2,7 +2,7 @@ import React from 'react'
import { useTranslation } from 'react-i18next'
import { Link } from 'react-router-dom'
import type { Props } from './types'
import type { CellComponentProps, Props } from './types'
import { fieldAffectsData } from '../../../../../../fields/config/types'
import { getTranslation } from '../../../../../../utilities/getTranslation'
@@ -52,7 +52,7 @@ const DefaultCell: React.FC<Props> = (props) => {
}
}
let CellComponent = cellData && cellComponents[field.type]
let CellComponent: React.FC<CellComponentProps> = cellData && cellComponents[field.type]
if (!CellComponent) {
if (collection.upload && fieldAffectsData(field) && field.name === 'filename') {
@@ -100,16 +100,18 @@ const Cell: React.FC<Props> = (props) => {
<RenderCustomComponent
CustomComponent={CustomCell}
DefaultComponent={DefaultCell}
componentProps={{
cellData,
className,
colIndex,
collection,
field,
link,
onClick,
rowData,
}}
componentProps={
{
cellData,
className,
colIndex,
collection,
field,
link,
onClick,
rowData,
} as Props
}
/>
)
}

View File

@@ -13,3 +13,11 @@ export type Props = {
[path: string]: unknown
}
}
export type CellComponentProps<Field = FieldAffectingData | UIField, Data = unknown> = Pick<
Props,
'collection' | 'rowData'
> & {
data: Data
field: Field
}

View File

@@ -2,7 +2,7 @@ import path from 'path'
import type { Config } from './types'
export const defaults: Omit<Config, 'db'> = {
export const defaults: Omit<Config, 'db' | 'editor'> = {
admin: {
avatar: 'default',
buildPath: path.resolve(process.cwd(), './build'),

View File

@@ -81,6 +81,11 @@ export default joi.object({
debug: joi.boolean(),
defaultDepth: joi.number().min(0).max(30),
defaultMaxTextLength: joi.number(),
editor: joi.object().required().keys({
CellComponent: component.required(),
FieldComponent: component.required(),
afterReadPromise: joi.func().required(),
}),
email: joi.object(),
endpoints: endpointsSchema,
express: joi.object().keys({

View File

@@ -9,6 +9,7 @@ import type React from 'react'
import type { DeepRequired } from 'ts-essentials'
import type { Configuration } from 'webpack'
import type { RichTextAdapter } from '../admin/components/forms/field-types/RichText/types'
import type { User } from '../auth/types'
import type { PayloadBundler } from '../bundlers/types'
import type {
@@ -303,6 +304,7 @@ export type Config = {
prefillOnly?: boolean
}
| false
/** Set account profile picture. Options: gravatar, default or a custom React component. */
avatar?: 'default' | 'gravatar' | React.ComponentType<any>
/**
@@ -428,12 +430,12 @@ export type Config = {
* @default "payload"
*/
cookiePrefix?: string
/** Either a whitelist array of URLS to allow CORS requests from, or a wildcard string ('*') to accept incoming requests from any domain. */
cors?: '*' | string[]
/** A whitelist array of URLs to allow Payload cookies to be accepted from as a form of CSRF protection. */
csrf?: string[]
/** Extension point to add your custom data. */
custom?: Record<string, any>
/** Pass in a database adapter for use on this project. */
@@ -454,6 +456,8 @@ export type Config = {
* @default 40000
*/
defaultMaxTextLength?: number
/** Default richtext editor to use for richText fields */
editor: RichTextAdapter
/**
* Email configuration options. This value is overridden by `email` in Payload.init if passed.
*

View File

@@ -8,7 +8,7 @@ import type { EntityPolicies } from './types'
import QueryError from '../../errors/QueryError'
import { validOperators } from '../../types/constants'
import deepCopyObject from '../../utilities/deepCopyObject'
import { deepCopyObject } from '../../utilities/deepCopyObject'
import flattenFields from '../../utilities/flattenTopLevelFields'
import { validateSearchParam } from './validateSearchParams'

View File

@@ -4,6 +4,9 @@ export { default as Button } from '../admin/components/elements/Button'
export { default as Pill } from '../admin/components/elements/Pill'
export { default as Popup } from '../admin/components/elements/Popup'
export { ShimmerEffect } from '../admin/components/elements/ShimmerEffect'
export { default as Tooltip } from '../admin/components/elements/Tooltip'
export { default as Check } from '../admin/components/icons/Check'
export { default as Chevron } from '../admin/components/icons/Chevron'
export { default as Menu } from '../admin/components/icons/Menu'

View File

@@ -1,5 +1,22 @@
export { default as Button } from '../../admin/components/elements/Button'
export { default as Card } from '../../admin/components/elements/Card'
export {
DocumentDrawer,
DocumentDrawerToggler,
baseClass as DocumentDrawerBaseClass,
useDocumentDrawer,
} from '../../admin/components/elements/DocumentDrawer'
export { Drawer, DrawerToggler, formatDrawerSlug } from '../../admin/components/elements/Drawer'
export { useDrawerSlug } from '../../admin/components/elements/Drawer/useDrawerSlug'
export { default as Eyebrow } from '../../admin/components/elements/Eyebrow'
export { Gutter } from '../../admin/components/elements/Gutter'
export {
ListDrawer,
ListDrawerToggler,
baseClass as ListDrawerBaseClass,
formatListDrawerSlug,
useListDrawer,
} from '../../admin/components/elements/ListDrawer'
export { default as Nav } from '../../admin/components/elements/Nav'

View File

@@ -1,3 +1,4 @@
export { default as RelationshipComponent } from '../../../admin/components/forms/field-types/Relationship'
export type {
Option,
Props,

View File

@@ -1 +1 @@
export type { Props } from '../../../admin/components/forms/field-types/RichText/types'
export type { RichTextFieldProps } from '../../../admin/components/forms/field-types/RichText/types'

View File

@@ -1 +1,2 @@
export { default as SelectComponent } from '../../../admin/components/forms/field-types/Select'
export type { Props } from '../../../admin/components/forms/field-types/Select/types'

View File

@@ -1,3 +1,7 @@
export { default as Error } from '../../admin/components/forms/Error'
export { default as FieldDescription } from '../../admin/components/forms/FieldDescription'
export { default as Form } from '../../admin/components/forms/Form'
export {
@@ -14,25 +18,26 @@ export {
} from '../../admin/components/forms/Form/context'
export { default as getSiblingData } from '../../admin/components/forms/Form/getSiblingData'
export { default as reduceFieldsToValues } from '../../admin/components/forms/Form/reduceFieldsToValues'
export { default as Label } from '../../admin/components/forms/Label'
export { default as RenderFields } from '../../admin/components/forms/RenderFields'
export { default as Submit } from '../../admin/components/forms/Submit'
export { default as FormSubmit } from '../../admin/components/forms/Submit'
export { default as Checkbox } from '../../admin/components/forms/field-types/Checkbox'
export { default as Group } from '../../admin/components/forms/field-types/Group'
export { default as Select } from '../../admin/components/forms/field-types/Select'
export { default as Select } from '../../admin/components/forms/field-types/Select'
export { default as SelectInput } from '../../admin/components/forms/field-types/Select/Input'
export { default as Text } from '../../admin/components/forms/field-types/Text'
export { default as TextInput } from '../../admin/components/forms/field-types/Text/Input'
/**
* @deprecated This method is now called useField. The useFieldType alias will be removed in an upcoming version.
*/
export { default as useFieldType } from '../../admin/components/forms/useField'
export { default as useField } from '../../admin/components/forms/useField'
export { default as useField } from '../../admin/components/forms/useField'
export { default as withCondition } from '../../admin/components/forms/withCondition'

View File

@@ -0,0 +1,6 @@
export { default as AccountGraphic } from '../../admin/components/graphics/Account'
export { default as DefaultBlockImageGraphic } from '../../admin/components/graphics/DefaultBlockImage'
export { default as FileGraphic } from '../../admin/components/graphics/File'
export { default as IconGraphic } from '../../admin/components/graphics/Icon'
export { default as LogoGraphic } from '../../admin/components/graphics/Logo'
export { default as SearchGraphic } from '../../admin/components/graphics/Search'

View File

@@ -1 +1,12 @@
export { useStepNav } from '../../admin/components/elements/StepNav'
export { default as useDebounce } from '../../admin/hooks/useDebounce'
export { useDebouncedCallback } from '../../admin/hooks/useDebouncedCallback'
export { useDelay } from '../../admin/hooks/useDelay'
export { useDelayedRender } from '../../admin/hooks/useDelayedRender'
export { default as useHotkey } from '../../admin/hooks/useHotkey'
export { default as useIntersect } from '../../admin/hooks/useIntersect'
export { default as useMountEffect } from '../../admin/hooks/useMountEffect'
export { default as usePayloadAPI } from '../../admin/hooks/usePayloadAPI'
export { default as useThrottledEffect } from '../../admin/hooks/useThrottledEffect'
export { default as useThumbnail } from '../../admin/hooks/useThumbnail'
export { default as useTitle, formatUseAsTitle } from '../../admin/hooks/useTitle'

View File

@@ -1,3 +0,0 @@
export { default as ElementButton } from '../../admin/components/forms/field-types/RichText/elements/Button'
export { default as toggleElement } from '../../admin/components/forms/field-types/RichText/elements/toggle'
export { default as LeafButton } from '../../admin/components/forms/field-types/RichText/leaves/Button'

View File

@@ -1,6 +1,8 @@
export { default as buildStateFromSchema } from '../../admin/components/forms/Form/buildStateFromSchema'
export { useAuth } from '../../admin/components/utilities/Auth'
export { useConfig } from '../../admin/components/utilities/Config'
export { useDocumentInfo } from '../../admin/components/utilities/DocumentInfo'
export { useEditDepth } from '../../admin/components/utilities/EditDepth'
export { useLocale } from '../../admin/components/utilities/Locale'
export { default as Meta } from '../../admin/components/utilities/Meta'
export { withMergedProps } from '../../admin/components/utilities/WithMergedProps'

View File

@@ -1,6 +1,7 @@
export { buildConfig } from '../config/build'
export * from '../config/types'
export { defaults } from '../config/defaults'
export { type FieldTypes, fieldTypes } from '../admin/components/forms/field-types'
export { defaults } from '../config/defaults'
export { sanitizeConfig } from '../config/sanitize'

View File

@@ -1,5 +1,19 @@
export * from './../types'
export type {
CreateFormData,
Fields,
FormField,
FormFieldsContext,
} from '../admin/components/forms/Form/types'
export type {
RichTextAdapter,
RichTextFieldProps,
} from '../admin/components/forms/field-types/RichText/types'
export type { CellComponentProps } from '../admin/components/views/collections/List/Cell/types'
export {
CustomPublishButtonProps,
CustomSaveButtonProps,
@@ -22,6 +36,7 @@ export {
BeforeOperationHook as CollectionBeforeOperationHook,
BeforeReadHook as CollectionBeforeReadHook,
BeforeValidateHook as CollectionBeforeValidateHook,
Collection,
CollectionConfig,
SanitizedCollectionConfig,
TypeWithID,
@@ -67,11 +82,7 @@ export {
RadioField,
RelationshipField,
RelationshipValue,
RichTextCustomElement,
RichTextCustomLeaf,
RichTextElement,
RichTextField,
RichTextLeaf,
RowAdmin,
RowField,
SelectField,
@@ -101,7 +112,6 @@ export {
tabHasName,
valueIsValueWithRelation,
} from './../fields/config/types'
export {
AfterChangeHook as GlobalAfterChangeHook,
AfterReadHook as GlobalAfterReadHook,

View File

@@ -1,7 +1,11 @@
export { extractTranslations } from '../translations/extractTranslations'
export { i18nInit } from '../translations/init'
export { combineMerge } from '../utilities/combineMerge'
export { configToJSONSchema, entityToJSONSchema } from '../utilities/configToJSONSchema'
export { createArrayFromCommaDelineated } from '../utilities/createArrayFromCommaDelineated';
export { deepCopyObject } from '../utilities/deepCopyObject'
export { deepMerge } from '../utilities/deepMerge'
export { default as flattenTopLevelFields } from '../utilities/flattenTopLevelFields'
export { getTranslation } from '../utilities/getTranslation'

View File

@@ -61,13 +61,14 @@ export const baseField = joi
.default()
export const idField = baseField.keys({
localized: joi.invalid(true),
name: joi.string().valid('id'),
localized: joi.invalid(true),
required: joi.not(false, 0).default(true),
type: joi.string().valid('text', 'number'),
})
export const text = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
autoComplete: joi.string(),
placeholder: joi
@@ -78,11 +79,11 @@ export const text = baseField.keys({
defaultValue: joi.alternatives().try(joi.string(), joi.func()),
maxLength: joi.number(),
minLength: joi.number(),
name: joi.string().required(),
type: joi.string().valid('text').required(),
})
export const number = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
autoComplete: joi.string(),
placeholder: joi.string(),
@@ -94,11 +95,11 @@ export const number = baseField.keys({
maxRows: joi.number().when('hasMany', { is: joi.not(true), then: joi.forbidden() }),
min: joi.number(),
minRows: joi.number().when('hasMany', { is: joi.not(true), then: joi.forbidden() }),
name: joi.string().required(),
type: joi.string().valid('number').required(),
})
export const textarea = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
placeholder: joi.string(),
rows: joi.number(),
@@ -107,11 +108,11 @@ export const textarea = baseField.keys({
defaultValue: joi.alternatives().try(joi.string(), joi.func()),
maxLength: joi.number(),
minLength: joi.number(),
name: joi.string().required(),
type: joi.string().valid('textarea').required(),
})
export const email = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
autoComplete: joi.string(),
placeholder: joi.string(),
@@ -119,27 +120,27 @@ export const email = baseField.keys({
defaultValue: joi.alternatives().try(joi.string(), joi.func()),
maxLength: joi.number(),
minLength: joi.number(),
name: joi.string().required(),
type: joi.string().valid('email').required(),
})
export const code = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
editorOptions: joi.object().unknown(), // Editor['options'] @monaco-editor/react
language: joi.string(),
}),
defaultValue: joi.alternatives().try(joi.string(), joi.func()),
name: joi.string().required(),
type: joi.string().valid('code').required(),
})
export const json = baseField.keys({
defaultValue: joi.alternatives().try(joi.array(), joi.object()),
name: joi.string().required(),
defaultValue: joi.alternatives().try(joi.array(), joi.object()),
type: joi.string().valid('json').required(),
})
export const select = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
isClearable: joi.boolean().default(false),
isSortable: joi.boolean().default(false),
@@ -148,7 +149,6 @@ export const select = baseField.keys({
.alternatives()
.try(joi.string().allow(''), joi.array().items(joi.string().allow('')), joi.func()),
hasMany: joi.boolean().default(false),
name: joi.string().required(),
options: joi
.array()
.min(1)
@@ -168,11 +168,11 @@ export const select = baseField.keys({
})
export const radio = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
layout: joi.string().valid('vertical', 'horizontal'),
}),
defaultValue: joi.alternatives().try(joi.string().allow(''), joi.func()),
name: joi.string().required(),
options: joi
.array()
.min(1)
@@ -206,6 +206,7 @@ export const collapsible = baseField.keys({
})
const tab = baseField.keys({
name: joi.string().when('localized', { is: joi.exist(), then: joi.required() }),
description: joi.alternatives().try(joi.string(), componentSchema),
fields: joi.array().items(joi.link('#field')).required(),
interfaceName: joi.string().when('name', { not: joi.exist(), then: joi.forbidden() }),
@@ -214,7 +215,6 @@ const tab = baseField.keys({
.try(joi.string(), joi.object().pattern(joi.string(), [joi.string()]))
.when('name', { is: joi.not(), then: joi.required() }),
localized: joi.boolean(),
name: joi.string().when('localized', { is: joi.exist(), then: joi.required() }),
saveToJWT: joi.alternatives().try(joi.boolean(), joi.string()),
})
@@ -229,17 +229,18 @@ export const tabs = baseField.keys({
})
export const group = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
hideGutter: joi.boolean().default(true),
}),
defaultValue: joi.alternatives().try(joi.object(), joi.func()),
fields: joi.array().items(joi.link('#field')),
interfaceName: joi.string(),
name: joi.string().required(),
type: joi.string().valid('group').required(),
})
export const array = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields
.keys({
components: baseAdminComponentFields
@@ -262,32 +263,32 @@ export const array = baseField.keys({
}),
maxRows: joi.number(),
minRows: joi.number(),
name: joi.string().required(),
type: joi.string().valid('array').required(),
})
export const upload = baseField.keys({
name: joi.string().required(),
defaultValue: joi.alternatives().try(joi.object(), joi.func()),
filterOptions: joi.alternatives().try(joi.object(), joi.func()),
maxDepth: joi.number(),
name: joi.string().required(),
relationTo: joi.string().required(),
type: joi.string().valid('upload').required(),
})
export const checkbox = baseField.keys({
defaultValue: joi.alternatives().try(joi.boolean(), joi.func()),
name: joi.string().required(),
defaultValue: joi.alternatives().try(joi.boolean(), joi.func()),
type: joi.string().valid('checkbox').required(),
})
export const point = baseField.keys({
defaultValue: joi.alternatives().try(joi.array().items(joi.number()).max(2).min(2), joi.func()),
name: joi.string().required(),
defaultValue: joi.alternatives().try(joi.array().items(joi.number()).max(2).min(2), joi.func()),
type: joi.string().valid('point').required(),
})
export const relationship = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
allowCreate: joi.boolean().default(true),
isSortable: joi.boolean().default(false),
@@ -306,12 +307,12 @@ export const relationship = baseField.keys({
.when('hasMany', { is: joi.not(true), then: joi.forbidden() })
.warning('deprecated', { message: 'Use minRows instead.' }),
minRows: joi.number().when('hasMany', { is: joi.not(true), then: joi.forbidden() }),
name: joi.string().required(),
relationTo: joi.alternatives().try(joi.string().required(), joi.array().items(joi.string())),
type: joi.string().valid('relationship').required(),
})
export const blocks = baseField.keys({
name: joi.string().required(),
blocks: joi
.array()
.items(
@@ -346,55 +347,23 @@ export const blocks = baseField.keys({
}),
maxRows: joi.number(),
minRows: joi.number(),
name: joi.string().required(),
type: joi.string().valid('blocks').required(),
})
export const richText = baseField.keys({
admin: baseAdminFields.keys({
elements: joi.array().items(
joi.alternatives().try(
joi.string(),
joi.object({
Button: componentSchema,
Element: componentSchema,
name: joi.string().required(),
plugins: joi.array().items(componentSchema),
}),
),
),
hideGutter: joi.boolean().default(true),
leaves: joi.array().items(
joi.alternatives().try(
joi.string(),
joi.object({
Button: componentSchema,
Leaf: componentSchema,
name: joi.string().required(),
plugins: joi.array().items(componentSchema),
}),
),
),
link: joi.object({
fields: joi.alternatives(joi.array().items(joi.link('#field')), joi.func()),
}),
placeholder: joi.string(),
rtl: joi.boolean(),
upload: joi.object({
collections: joi.object().pattern(
joi.string(),
joi.object().keys({
fields: joi.array().items(joi.link('#field')),
}),
),
}),
}),
defaultValue: joi.alternatives().try(joi.array().items(joi.object()), joi.func()),
name: joi.string().required(),
admin: baseAdminFields.default(),
defaultValue: joi.alternatives().try(joi.array().items(joi.object()), joi.func()),
editor: joi.object().keys({
CellComponent: componentSchema.required(),
FieldComponent: componentSchema.required(),
afterReadPromise: joi.func().required(),
}),
type: joi.string().valid('richText').required(),
})
export const date = baseField.keys({
name: joi.string().required(),
admin: baseAdminFields.keys({
date: joi.object({
displayFormat: joi.string(),
@@ -410,11 +379,11 @@ export const date = baseField.keys({
placeholder: joi.string(),
}),
defaultValue: joi.alternatives().try(joi.string(), joi.func()),
name: joi.string().required(),
type: joi.string().valid('date').required(),
})
export const ui = joi.object().keys({
name: joi.string().required(),
admin: joi
.object()
.keys({
@@ -432,7 +401,6 @@ export const ui = joi.object().keys({
.default(),
custom: joi.object().pattern(joi.string(), joi.any()),
label: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [joi.string()])),
name: joi.string().required(),
type: joi.string().valid('ui').required(),
})

View File

@@ -1,16 +1,15 @@
/* eslint-disable no-use-before-define */
import type { EditorProps } from '@monaco-editor/react'
import type { i18n as Ii18n, TFunction } from 'i18next'
import type { TFunction } from 'i18next'
import type { CSSProperties } from 'react'
import type { Editor } from 'slate'
import monacoeditor from 'monaco-editor' // IMPORTANT - DO NOT REMOVE: This is required for pnpm's default isolated mode to work - even though the import is not used. This is due to a typescript bug: https://github.com/microsoft/TypeScript/issues/47663#issuecomment-1519138189. (tsbugisolatedmode)
import type { ConditionalDateProps } from '../../admin/components/elements/DatePicker/types'
import type { Description } from '../../admin/components/forms/FieldDescription/types'
import type { RowLabel } from '../../admin/components/forms/RowLabel/types'
import type { RichTextAdapter } from '../../admin/components/forms/field-types/RichText/types'
import type { User } from '../../auth'
import type { TypeWithID } from '../../collections/config/types'
import type { SanitizedConfig } from '../../config/types'
import type { PayloadRequest, RequestContext } from '../../express/types'
import type { Payload } from '../../payload'
import type { Operation, Where } from '../../types'
@@ -396,68 +395,11 @@ export type RelationshipValue =
| ValueWithRelation[]
| (number | string)
type RichTextPlugin = (editor: Editor) => Editor
export type RichTextCustomElement = {
Button: React.ComponentType<any>
Element: React.ComponentType<any>
name: string
plugins?: RichTextPlugin[]
}
export type RichTextCustomLeaf = {
Button: React.ComponentType<any>
Leaf: React.ComponentType<any>
name: string
plugins?: RichTextPlugin[]
}
export type RichTextElement =
| 'blockquote'
| 'h1'
| 'h2'
| 'h3'
| 'h4'
| 'h5'
| 'h6'
| 'indent'
| 'link'
| 'ol'
| 'relationship'
| 'textAlign'
| 'ul'
| 'upload'
| RichTextCustomElement
export type RichTextLeaf =
| 'bold'
| 'code'
| 'italic'
| 'strikethrough'
| 'underline'
| RichTextCustomLeaf
export type RichTextField = FieldBase & {
admin?: Admin & {
elements?: RichTextElement[]
hideGutter?: boolean
leaves?: RichTextLeaf[]
link?: {
fields?:
| ((args: { config: SanitizedConfig; defaultFields: Field[]; i18n: Ii18n }) => Field[])
| Field[]
}
placeholder?: Record<string, string> | string
rtl?: boolean
upload?: {
collections: {
[collection: string]: {
fields: Field[]
}
}
}
}
export type RichTextField<AdapterProps = unknown> = FieldBase & {
admin?: Admin
editor?: RichTextAdapter<AdapterProps>
type: 'richText'
}
} & AdapterProps
export type ArrayField = FieldBase & {
admin?: Admin & {

View File

@@ -2,7 +2,7 @@ import type { SanitizedCollectionConfig } from '../../../collections/config/type
import type { PayloadRequest, RequestContext } from '../../../express/types'
import type { SanitizedGlobalConfig } from '../../../globals/config/types'
import deepCopyObject from '../../../utilities/deepCopyObject'
import { deepCopyObject } from '../../../utilities/deepCopyObject'
import { traverseFields } from './traverseFields'
type Args<T> = {

View File

@@ -2,7 +2,7 @@ import type { SanitizedCollectionConfig } from '../../../collections/config/type
import type { PayloadRequest, RequestContext } from '../../../express/types'
import type { SanitizedGlobalConfig } from '../../../globals/config/types'
import deepCopyObject from '../../../utilities/deepCopyObject'
import { deepCopyObject } from '../../../utilities/deepCopyObject'
import { traverseFields } from './traverseFields'
type Args = {

View File

@@ -1,9 +1,9 @@
/* eslint-disable no-param-reassign */
import type { RichTextAdapter } from '../../../admin/components/forms/field-types/RichText/types'
import type { PayloadRequest, RequestContext } from '../../../express/types'
import type { Field, TabAsField } from '../../config/types'
import { fieldAffectsData, tabHasName } from '../../config/types'
import richTextRelationshipPromise from '../../richText/richTextRelationshipPromise'
import relationshipPopulationPromise from './relationshipPopulationPromise'
import { traverseFields } from './traverseFields'
@@ -128,23 +128,21 @@ export const promise = async ({
}
case 'richText': {
if (
field.admin?.elements?.includes('relationship') ||
field.admin?.elements?.includes('upload') ||
field.admin?.elements?.includes('link') ||
!field?.admin?.elements
) {
populationPromises.push(
richTextRelationshipPromise({
currentDepth,
depth,
field,
overrideAccess,
req,
showHiddenFields,
siblingDoc,
}),
)
const editor: RichTextAdapter = field?.editor || req?.payload?.config?.editor
if (editor?.afterReadPromise) {
const afterReadPromise = editor.afterReadPromise({
currentDepth,
depth,
field,
overrideAccess,
req,
showHiddenFields,
siblingDoc,
})
if (afterReadPromise) {
populationPromises.push(afterReadPromise)
}
}
break
@@ -221,9 +219,9 @@ export const promise = async ({
const result = overrideAccess
? true
: await field.access.read({
id: doc.id as number | string,
data: doc,
doc,
id: doc.id as number | string,
req,
siblingData: siblingDoc,
})

View File

@@ -4,7 +4,7 @@ import type { SanitizedGlobalConfig } from '../../../globals/config/types'
import type { Operation } from '../../../types'
import { ValidationError } from '../../../errors'
import deepCopyObject from '../../../utilities/deepCopyObject'
import { deepCopyObject } from '../../../utilities/deepCopyObject'
import { traverseFields } from './traverseFields'
type Args<T> = {

View File

@@ -2,7 +2,7 @@ import type { SanitizedCollectionConfig } from '../../../collections/config/type
import type { PayloadRequest, RequestContext } from '../../../express/types'
import type { SanitizedGlobalConfig } from '../../../globals/config/types'
import deepCopyObject from '../../../utilities/deepCopyObject'
import { deepCopyObject } from '../../../utilities/deepCopyObject'
import { traverseFields } from './traverseFields'
type Args<T> = {

View File

@@ -1,156 +0,0 @@
import type { PayloadRequest } from '../../express/types'
import type { RichTextField } from '../config/types'
import { populate } from './populate'
import { recurseNestedFields } from './recurseNestedFields'
type Args = {
currentDepth?: number
depth: number
field: RichTextField
overrideAccess?: boolean
req: PayloadRequest
showHiddenFields: boolean
siblingDoc: Record<string, unknown>
}
type RecurseRichTextArgs = {
children: unknown[]
currentDepth: number
depth: number
field: RichTextField
overrideAccess: boolean
promises: Promise<void>[]
req: PayloadRequest
showHiddenFields: boolean
}
export const recurseRichText = ({
children,
currentDepth = 0,
depth,
field,
overrideAccess = false,
promises,
req,
showHiddenFields,
}: RecurseRichTextArgs): void => {
if (Array.isArray(children)) {
;(children as any[]).forEach((element) => {
if (depth && currentDepth <= depth) {
if ((element.type === 'relationship' || element.type === 'upload') && element?.value?.id) {
const collection = req.payload.collections[element?.relationTo]
if (collection) {
promises.push(
populate({
collection,
currentDepth,
data: element,
depth,
field,
id: element.value.id,
key: 'value',
overrideAccess,
req,
showHiddenFields,
}),
)
}
if (
element.type === 'upload' &&
Array.isArray(field.admin?.upload?.collections?.[element?.relationTo]?.fields)
) {
recurseNestedFields({
currentDepth,
data: element.fields || {},
depth,
fields: field.admin.upload.collections[element.relationTo].fields,
overrideAccess,
promises,
req,
showHiddenFields,
})
}
}
if (element.type === 'link') {
if (element?.doc?.value && element?.doc?.relationTo) {
const collection = req.payload.collections[element?.doc?.relationTo]
if (collection) {
promises.push(
populate({
collection,
currentDepth,
data: element.doc,
depth,
field,
id: element.doc.value,
key: 'value',
overrideAccess,
req,
showHiddenFields,
}),
)
}
}
if (Array.isArray(field.admin?.link?.fields)) {
recurseNestedFields({
currentDepth,
data: element.fields || {},
depth,
fields: field.admin?.link?.fields,
overrideAccess,
promises,
req,
showHiddenFields,
})
}
}
}
if (element?.children) {
recurseRichText({
children: element.children,
currentDepth,
depth,
field,
overrideAccess,
promises,
req,
showHiddenFields,
})
}
})
}
}
const richTextRelationshipPromise = async ({
currentDepth,
depth,
field,
overrideAccess,
req,
showHiddenFields,
siblingDoc,
}: Args): Promise<void> => {
const promises = []
recurseRichText({
children: siblingDoc[field.name] as unknown[],
currentDepth,
depth,
field,
overrideAccess,
promises,
req,
showHiddenFields,
})
await Promise.all(promises)
}
export default richTextRelationshipPromise

View File

@@ -11,7 +11,6 @@ import type {
RadioField,
RelationshipField,
RelationshipValue,
RichTextField,
SelectField,
TextField,
TextareaField,
@@ -23,7 +22,6 @@ import canUseDOM from '../utilities/canUseDOM'
import { getIDType } from '../utilities/getIDType'
import { isValidID } from '../utilities/isValidID'
import { fieldAffectsData } from './config/types'
import defaultRichTextValue from './richText/defaultValue'
export const number: Validate<unknown, unknown, NumberField> = (
value: number | number[],
@@ -186,16 +184,6 @@ export const json: Validate<unknown, unknown, JSONField & { jsonError?: string }
return true
}
export const richText: Validate<unknown, unknown, RichTextField> = (value, { required, t }) => {
if (required) {
const stringifiedDefaultValue = JSON.stringify(defaultRichTextValue)
if (value && JSON.stringify(value) !== stringifiedDefaultValue) return true
return t('validation:required')
}
return true
}
export const checkbox: Validate<unknown, unknown, CheckboxField> = (
value: boolean,
{ required, t },
@@ -519,7 +507,6 @@ export default {
point,
radio,
relationship,
richText,
select,
text,
textarea,

View File

@@ -18,6 +18,7 @@ import { DateTimeResolver, EmailAddressResolver } from 'graphql-scalars'
/* eslint-disable no-use-before-define */
import { GraphQLJSON } from 'graphql-type-json'
import type { RichTextAdapter } from '../../admin/components/forms/field-types/RichText/types'
import type {
ArrayField,
BlockField,
@@ -44,7 +45,6 @@ import type {
import type { Payload } from '../../payload'
import { tabHasName } from '../../fields/config/types'
import createRichTextRelationshipPromise from '../../fields/richText/richTextRelationshipPromise'
import { toWords } from '../../utilities/formatLabels'
import combineParentName from '../utilities/combineParentName'
import formatName from '../utilities/formatName'
@@ -79,10 +79,10 @@ type Args = {
}
function buildObjectType({
name,
baseFields = {},
fields,
forceNullable,
name,
parentName,
payload,
}: Args): GraphQLObjectType {
@@ -94,9 +94,9 @@ function buildObjectType({
if (!payload.types.arrayTypes[interfaceName]) {
// eslint-disable-next-line no-param-reassign
payload.types.arrayTypes[interfaceName] = buildObjectType({
name: interfaceName,
fields: field.fields,
forceNullable: isFieldNullable(field, forceNullable),
name: interfaceName,
parentName: interfaceName,
payload,
})
@@ -116,6 +116,7 @@ function buildObjectType({
block?.interfaceName || block?.graphQL?.singularName || toWords(block.slug, true)
// eslint-disable-next-line no-param-reassign
payload.types.blockTypes[block.slug] = buildObjectType({
name: interfaceName,
fields: [
...block.fields,
{
@@ -124,7 +125,6 @@ function buildObjectType({
},
],
forceNullable,
name: interfaceName,
parentName: interfaceName,
payload,
})
@@ -179,9 +179,9 @@ function buildObjectType({
if (!payload.types.groupTypes[interfaceName]) {
// eslint-disable-next-line no-param-reassign
payload.types.groupTypes[interfaceName] = buildObjectType({
name: interfaceName,
fields: field.fields,
forceNullable: isFieldNullable(field, forceNullable),
name: interfaceName,
parentName: interfaceName,
payload,
})
@@ -258,6 +258,7 @@ function buildObjectType({
const types = relationTo.map((relation) => payload.collections[relation].graphQL.type)
type = new GraphQLObjectType({
name: `${relationshipName}_Relationship`,
fields: {
relationTo: {
type: relationToType,
@@ -272,7 +273,6 @@ function buildObjectType({
}),
},
},
name: `${relationshipName}_Relationship`,
})
} else {
;({ type } = payload.collections[relationTo].graphQL)
@@ -427,9 +427,10 @@ function buildObjectType({
async resolve(parent, args, context) {
let depth = payload.config.defaultDepth
if (typeof args.depth !== 'undefined') depth = args.depth
const editor: RichTextAdapter = field?.editor || payload?.config?.editor
if (depth > 0) {
await createRichTextRelationshipPromise({
if (editor?.afterReadPromise) {
await editor?.afterReadPromise({
depth,
field,
req: context.req,
@@ -474,9 +475,9 @@ function buildObjectType({
if (!payload.types.tabTypes[interfaceName]) {
// eslint-disable-next-line no-param-reassign
payload.types.tabTypes[interfaceName] = buildObjectType({
name: interfaceName,
fields: tab.fields,
forceNullable,
name: interfaceName,
parentName: interfaceName,
payload,
})
@@ -581,6 +582,7 @@ function buildObjectType({
}
const objectSchema = {
name,
fields: () =>
fields.reduce((objectTypeConfig, field) => {
const fieldSchema = fieldToSchemaMap[field.type]
@@ -594,7 +596,6 @@ function buildObjectType({
...fieldSchema(objectTypeConfig, field),
}
}, baseFields),
name,
}
const newlyCreatedBlockType = new GraphQLObjectType(objectSchema)

View File

@@ -8,7 +8,7 @@ import type { Field, FieldAffectingData, Option } from '../fields/config/types'
import type { SanitizedGlobalConfig } from '../globals/config/types'
import { fieldAffectsData, tabHasName } from '../fields/config/types'
import deepCopyObject from './deepCopyObject'
import { deepCopyObject } from './deepCopyObject'
import { toWords } from './formatLabels'
const propertyIsRequired = (field: Field) => {

View File

@@ -1,4 +1,4 @@
const deepCopyObject = (inObject) => {
export const deepCopyObject = (inObject) => {
if (inObject instanceof Date) return inObject
if (inObject instanceof Set) return new Set(inObject)
@@ -21,5 +21,3 @@ const deepCopyObject = (inObject) => {
return outObject
}
export default deepCopyObject

View File

@@ -0,0 +1,15 @@
export function deepMerge(obj1, obj2) {
const output = { ...obj1 }
for (const key in obj2) {
if (Object.prototype.hasOwnProperty.call(obj2, key)) {
if (typeof obj2[key] === 'object' && !Array.isArray(obj2[key]) && obj1[key]) {
output[key] = deepMerge(obj1[key], obj2[key])
} else {
output[key] = obj2[key]
}
}
}
return output
}

View File

@@ -1,10 +1,13 @@
export * from './dist/types';
export type { CreateFormData, Fields, FormField, FormFieldsContext, } from './dist/admin/components/forms/Form/types';
export type { RichTextAdapter, RichTextFieldProps, } from './dist/admin/components/forms/field-types/RichText/types';
export type { CellComponentProps } from './dist/admin/components/views/collections/List/Cell/types';
export { CustomPublishButtonProps, CustomSaveButtonProps, CustomSaveDraftButtonProps, } from './dist/admin/components/elements/types';
export { RowLabel } from './dist/admin/components/forms/RowLabel/types';
export { AfterChangeHook as CollectionAfterChangeHook, AfterDeleteHook as CollectionAfterDeleteHook, AfterForgotPasswordHook as CollectionAfterForgotPasswordHook, AfterLoginHook as CollectionAfterLoginHook, AfterOperationHook as CollectionAfterOperationHook, AfterReadHook as CollectionAfterReadHook, BeforeChangeHook as CollectionBeforeChangeHook, BeforeDeleteHook as CollectionBeforeDeleteHook, BeforeDuplicate, BeforeLoginHook as CollectionBeforeLoginHook, BeforeOperationHook as CollectionBeforeOperationHook, BeforeReadHook as CollectionBeforeReadHook, BeforeValidateHook as CollectionBeforeValidateHook, CollectionConfig, SanitizedCollectionConfig, TypeWithID, } from './dist/collections/config/types';
export { AfterChangeHook as CollectionAfterChangeHook, AfterDeleteHook as CollectionAfterDeleteHook, AfterForgotPasswordHook as CollectionAfterForgotPasswordHook, AfterLoginHook as CollectionAfterLoginHook, AfterOperationHook as CollectionAfterOperationHook, AfterReadHook as CollectionAfterReadHook, BeforeChangeHook as CollectionBeforeChangeHook, BeforeDeleteHook as CollectionBeforeDeleteHook, BeforeDuplicate, BeforeLoginHook as CollectionBeforeLoginHook, BeforeOperationHook as CollectionBeforeOperationHook, BeforeReadHook as CollectionBeforeReadHook, BeforeValidateHook as CollectionBeforeValidateHook, Collection, CollectionConfig, SanitizedCollectionConfig, TypeWithID, } from './dist/collections/config/types';
export { Access, AccessArgs } from './dist/config/types';
export { DatabaseAdapter } from './dist/database/types';
export { ArrayField, Block, BlockField, CheckboxField, CodeField, CollapsibleField, Condition, DateField, EmailField, Field, FieldAccess, FieldAffectingData, FieldBase, FieldHook, FieldHookArgs, FieldPresentationalOnly, FieldWithMany, FieldWithMaxDepth, FieldWithPath, FieldWithSubFields, FilterOptions, FilterOptionsProps, GroupField, HookName, JSONField, Labels, NamedTab, NonPresentationalField, NumberField, Option, OptionObject, PointField, RadioField, RelationshipField, RelationshipValue, RichTextCustomElement, RichTextCustomLeaf, RichTextElement, RichTextField, RichTextLeaf, RowAdmin, RowField, SelectField, Tab, TabAsField, TabsAdmin, TabsField, TextField, TextareaField, UIField, UnnamedTab, UploadField, Validate, ValidateOptions, ValueWithRelation, fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsLocalized, fieldIsPresentationalOnly, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation, } from './dist/fields/config/types';
export { ArrayField, Block, BlockField, CheckboxField, CodeField, CollapsibleField, Condition, DateField, EmailField, Field, FieldAccess, FieldAffectingData, FieldBase, FieldHook, FieldHookArgs, FieldPresentationalOnly, FieldWithMany, FieldWithMaxDepth, FieldWithPath, FieldWithSubFields, FilterOptions, FilterOptionsProps, GroupField, HookName, JSONField, Labels, NamedTab, NonPresentationalField, NumberField, Option, OptionObject, PointField, RadioField, RelationshipField, RelationshipValue, RichTextField, RowAdmin, RowField, SelectField, Tab, TabAsField, TabsAdmin, TabsField, TextField, TextareaField, UIField, UnnamedTab, UploadField, Validate, ValidateOptions, ValueWithRelation, fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsLocalized, fieldIsPresentationalOnly, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation, } from './dist/fields/config/types';
export { AfterChangeHook as GlobalAfterChangeHook, AfterReadHook as GlobalAfterReadHook, BeforeChangeHook as GlobalBeforeChangeHook, BeforeReadHook as GlobalBeforeReadHook, BeforeValidateHook as GlobalBeforeValidateHook, GlobalConfig, SanitizedGlobalConfig, } from './dist/globals/config/types';
export { validOperators } from './dist/types/constants';
//# sourceMappingURL=types.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,10 @@
export { extractTranslations } from './dist/translations/extractTranslations';
export { i18nInit } from './dist/translations/init';
export { combineMerge } from './dist/utilities/combineMerge';
export { configToJSONSchema, entityToJSONSchema } from './dist/utilities/configToJSONSchema';
export { createArrayFromCommaDelineated } from './dist/utilities/createArrayFromCommaDelineated';
export { deepCopyObject } from './dist/utilities/deepCopyObject';
export { deepMerge } from './dist/utilities/deepMerge';
export { default as flattenTopLevelFields } from './dist/utilities/flattenTopLevelFields';
export { getTranslation } from './dist/utilities/getTranslation';
//# sourceMappingURL=utilities.d.ts.map

View File

@@ -9,6 +9,9 @@ function _export(target, all) {
});
}
_export(exports, {
extractTranslations: function() {
return _extractTranslations.extractTranslations;
},
i18nInit: function() {
return _init.i18nInit;
},
@@ -24,19 +27,32 @@ _export(exports, {
createArrayFromCommaDelineated: function() {
return _createArrayFromCommaDelineated.createArrayFromCommaDelineated;
},
deepCopyObject: function() {
return _deepCopyObject.deepCopyObject;
},
deepMerge: function() {
return _deepMerge.deepMerge;
},
flattenTopLevelFields: function() {
return _flattenTopLevelFields.default;
},
getTranslation: function() {
return _getTranslation.getTranslation;
}
});
const _extractTranslations = require("./dist/translations/extractTranslations");
const _init = require("./dist/translations/init");
const _combineMerge = require("./dist/utilities/combineMerge");
const _configToJSONSchema = require("./dist/utilities/configToJSONSchema");
const _createArrayFromCommaDelineated = require("./dist/utilities/createArrayFromCommaDelineated");
const _deepCopyObject = require("./dist/utilities/deepCopyObject");
const _deepMerge = require("./dist/utilities/deepMerge");
const _flattenTopLevelFields = /*#__PURE__*/ _interop_require_default(require("./dist/utilities/flattenTopLevelFields"));
const _getTranslation = require("./dist/utilities/getTranslation");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRzL3V0aWxpdGllcy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBpMThuSW5pdCB9IGZ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VsaW5lYXRlZCIsImRlZXBDb3B5T2JqZWN0IiwiZGVlcE1lcmdlIiwiZmxhdHRlblRvcExldmVsRmllbGRzIiwiZ2V0VHJhbnNsYXRpb24iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0lBQVNBLG1CQUFtQjtlQUFuQkEsd0NBQW1COztJQUNuQkMsUUFBUTtlQUFSQSxjQUFROztJQUVSQyxZQUFZO2VBQVpBLDBCQUFZOztJQUNaQyxrQkFBa0I7ZUFBbEJBLHNDQUFrQjs7SUFBRUMsa0JBQWtCO2VBQWxCQSxzQ0FBa0I7O0lBQ3RDQyw4QkFBOEI7ZUFBOUJBLDhEQUE4Qjs7SUFFOUJDLGNBQWM7ZUFBZEEsOEJBQWM7O0lBQ2RDLFNBQVM7ZUFBVEEsb0JBQVM7O0lBQ0VDLHFCQUFxQjtlQUFyQkEsOEJBQXFCOztJQUNoQ0MsY0FBYztlQUFkQSw4QkFBYzs7O3FDQVZhO3NCQUNYOzhCQUVJO29DQUMwQjtnREFDUjtnQ0FFaEI7MkJBQ0w7OEVBQ3VCO2dDQUNsQiJ9

View File

@@ -0,0 +1,10 @@
.tmp
**/.git
**/.hg
**/.pnp.*
**/.svn
**/.yarn/**
**/build
**/dist/**
**/node_modules
**/temp

View File

@@ -0,0 +1,15 @@
/** @type {import('prettier').Config} */
module.exports = {
extends: ['@payloadcms'],
overrides: [
{
extends: ['plugin:@typescript-eslint/disable-type-checked'],
files: ['*.js', '*.cjs', '*.json', '*.md', '*.yml', '*.yaml'],
},
],
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
root: true,
}

View File

@@ -0,0 +1,10 @@
.tmp
**/.git
**/.hg
**/.pnp.*
**/.svn
**/.yarn/**
**/build
**/dist/**
**/node_modules
**/temp

View File

@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"sourceMaps": "inline",
"jsc": {
"target": "esnext",
"parser": {
"syntax": "typescript",
"tsx": true,
"dts": true
}
},
"module": {
"type": "commonjs"
}
}

View File

@@ -0,0 +1,44 @@
{
"name": "@payloadcms/richtext-slate",
"description": "The officially supported Slate richtext adapter for Payload",
"author": "Payload CMS, Inc.",
"dependencies": {
"@faceless-ui/modal": "2.0.1",
"i18next": "22.5.1",
"is-hotkey": "0.2.0",
"react": "18.2.0",
"react-i18next": "11.18.6",
"slate": "0.91.4",
"slate-history": "0.86.0",
"slate-hyperscript": "0.81.3",
"slate-react": "0.92.0"
},
"devDependencies": {
"@payloadcms/eslint-config": "workspace:*",
"@types/node": "20.5.7",
"@types/react": "18.2.15",
"payload": "workspace:*"
},
"exports": {
".": {
"default": "./src/index.ts",
"types": "./src/index.ts"
}
},
"license": "MIT",
"main": "./src/index.ts",
"publishConfig": {
"exports": null,
"main": "./dist/index.js",
"registry": "https://registry.npmjs.org/",
"types": "./dist/index.d.ts"
},
"repository": "https://github.com/payloadcms/payload",
"scripts": {
"build": "pnpm build:swc && pnpm build:types",
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
"build:types": "tsc --emitDeclarationOnly --outDir dist"
},
"types": "./src/index.ts",
"version": "0.0.1"
}

View File

@@ -0,0 +1,16 @@
import type { CellComponentProps, RichTextField } from 'payload/types'
import React from 'react'
import type { AdapterArguments } from '../types'
const RichTextCell: React.FC<CellComponentProps<RichTextField<AdapterArguments>, any>> = ({
data,
}) => {
const flattenedText = data?.map((i) => i?.children?.map((c) => c.text)).join(' ')
const textToShow =
flattenedText?.length > 100 ? `${flattenedText.slice(0, 100)}\u2026` : flattenedText
return <span>{textToShow}</span>
}
export default RichTextCell

View File

@@ -1,4 +1,4 @@
export default [
export const defaultRichTextValue = [
{
children: [{ text: '' }],
},

View File

@@ -1,13 +1,13 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
import type { Collection } from '../../collections/config/types'
import type { PayloadRequest } from '../../express/types'
import type { Field, RichTextField } from '../config/types'
import type { PayloadRequest } from 'payload/types'
import type { Collection, Field, RichTextField } from 'payload/types'
import type { AdapterArguments } from '../types'
type Arguments = {
currentDepth?: number
data: unknown
depth: number
field: RichTextField
field: RichTextField<AdapterArguments>
key: number | string
overrideAccess?: boolean
req: PayloadRequest

View File

@@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
import type { PayloadRequest } from '../../express/types'
import type { Field } from '../config/types'
import type { Field, PayloadRequest } from 'payload/types'
import { fieldAffectsData, fieldHasSubFields, fieldIsArrayType } from 'payload/types'
import { fieldAffectsData, fieldHasSubFields, fieldIsArrayType } from '../config/types'
import { populate } from './populate'
import { recurseRichText } from './richTextRelationshipPromise'

View File

@@ -0,0 +1,148 @@
import type { PayloadRequest, RichTextAdapter, RichTextField } from 'payload/types'
import type { AdapterArguments } from '../types'
import { populate } from './populate'
import { recurseNestedFields } from './recurseNestedFields'
export type Args = Parameters<RichTextAdapter<AdapterArguments>['afterReadPromise']>[0]
type RecurseRichTextArgs = {
children: unknown[]
currentDepth: number
depth: number
field: RichTextField<AdapterArguments>
overrideAccess: boolean
promises: Promise<void>[]
req: PayloadRequest
showHiddenFields: boolean
}
export const recurseRichText = ({
children,
currentDepth = 0,
depth,
field,
overrideAccess = false,
promises,
req,
showHiddenFields,
}: RecurseRichTextArgs): void => {
if (depth <= 0 || currentDepth > depth) {
return
}
if (Array.isArray(children)) {
;(children as any[]).forEach((element) => {
if ((element.type === 'relationship' || element.type === 'upload') && element?.value?.id) {
const collection = req.payload.collections[element?.relationTo]
if (collection) {
promises.push(
populate({
collection,
currentDepth,
data: element,
depth,
field,
id: element.value.id,
key: 'value',
overrideAccess,
req,
showHiddenFields,
}),
)
}
if (
element.type === 'upload' &&
Array.isArray(field.admin?.upload?.collections?.[element?.relationTo]?.fields)
) {
recurseNestedFields({
currentDepth,
data: element.fields || {},
depth,
fields: field.admin.upload.collections[element.relationTo].fields,
overrideAccess,
promises,
req,
showHiddenFields,
})
}
}
if (element.type === 'link') {
if (element?.doc?.value && element?.doc?.relationTo) {
const collection = req.payload.collections[element?.doc?.relationTo]
if (collection) {
promises.push(
populate({
collection,
currentDepth,
data: element.doc,
depth,
field,
id: element.doc.value,
key: 'value',
overrideAccess,
req,
showHiddenFields,
}),
)
}
}
if (Array.isArray(field.admin?.link?.fields)) {
recurseNestedFields({
currentDepth,
data: element.fields || {},
depth,
fields: field.admin?.link?.fields,
overrideAccess,
promises,
req,
showHiddenFields,
})
}
}
if (element?.children) {
recurseRichText({
children: element.children,
currentDepth,
depth,
field,
overrideAccess,
promises,
req,
showHiddenFields,
})
}
})
}
}
export const richTextRelationshipPromise = async ({
currentDepth,
depth,
field,
overrideAccess,
req,
showHiddenFields,
siblingDoc,
}: Args): Promise<void> => {
const promises = []
recurseRichText({
children: siblingDoc[field.name] as unknown[],
currentDepth,
depth,
field,
overrideAccess,
promises,
req,
showHiddenFields,
})
await Promise.all(promises)
}

View File

@@ -0,0 +1,18 @@
import type { RichTextField, Validate } from 'payload/types'
import type { AdapterArguments } from '../types'
import { defaultRichTextValue } from './defaultValue'
export const richText: Validate<unknown, unknown, RichTextField<AdapterArguments>> = (
value,
{ required, t },
) => {
if (required) {
const stringifiedDefaultValue = JSON.stringify(defaultRichTextValue)
if (value && JSON.stringify(value) !== stringifiedDefaultValue) return true
return t('validation:required')
}
return true
}

View File

@@ -3,24 +3,19 @@ import type { HistoryEditor } from 'slate-history'
import type { ReactEditor } from 'slate-react'
import isHotkey from 'is-hotkey'
import { Error, FieldDescription, Label, useField, withCondition } from 'payload/components/forms'
import { useEditDepth } from 'payload/components/utilities'
import { getTranslation } from 'payload/utilities'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Node, Element as SlateElement, Text, Transforms, createEditor } from 'slate'
import { withHistory } from 'slate-history'
import { Editable, Slate, withReact } from 'slate-react'
import type { RichTextElement, RichTextLeaf } from '../../../../../fields/config/types'
import type { ElementNode, Props, TextNode } from './types'
import type { ElementNode, FieldProps, RichTextElement, RichTextLeaf, TextNode } from '../types'
import defaultValue from '../../../../../fields/richText/defaultValue'
import { richText } from '../../../../../fields/validations'
import { getTranslation } from '../../../../../utilities/getTranslation'
import { useEditDepth } from '../../../utilities/EditDepth'
import Error from '../../Error'
import FieldDescription from '../../FieldDescription'
import Label from '../../Label'
import useField from '../../useField'
import withCondition from '../../withCondition'
import { defaultRichTextValue } from '../data/defaultValue'
import { richText } from '../data/validation'
import elementTypes from './elements'
import listTypes from './elements/listTypes'
import enablePlugins from './enablePlugins'
@@ -58,7 +53,7 @@ declare module 'slate' {
}
}
const RichText: React.FC<Props> = (props) => {
const RichText: React.FC<FieldProps> = (props) => {
const {
admin: {
className,
@@ -69,7 +64,16 @@ const RichText: React.FC<Props> = (props) => {
readOnly,
style,
width,
} = {},
} = {
className: undefined,
condition: undefined,
description: undefined,
hideGutter: undefined,
placeholder: undefined,
readOnly: undefined,
style: undefined,
width: undefined,
},
admin,
defaultValue: defaultValueFromProps,
label,
@@ -235,7 +239,7 @@ const RichText: React.FC<Props> = (props) => {
})
if (ops && Array.isArray(ops) && ops.length > 0) {
if (!readOnly && val !== defaultValue && val !== value) {
if (!readOnly && val !== defaultRichTextValue && val !== value) {
setValue(val)
}
}
@@ -305,7 +309,7 @@ const RichText: React.FC<Props> = (props) => {
}
}
if (!valueToRender) valueToRender = defaultValueFromProps || defaultValue
if (!valueToRender) valueToRender = defaultValueFromProps || defaultRichTextValue
return (
<div

View File

@@ -1,4 +1,4 @@
@import '../../../../scss/styles.scss';
@import 'payload/scss';
.rich-text__button {
position: relative;

View File

@@ -1,11 +1,11 @@
import type { ElementType } from 'react'
import { Tooltip } from 'payload/components'
import React, { useCallback, useState } from 'react'
import { useSlate } from 'slate-react'
import type { ButtonProps } from './types'
import Tooltip from '../../../../elements/Tooltip'
import '../buttons.scss'
import isElementActive from './isActive'
import toggleElement from './toggle'

View File

@@ -1,9 +1,8 @@
import type { SanitizedCollectionConfig } from 'payload/types'
import { useConfig } from 'payload/components/utilities'
import * as React from 'react'
import type { SanitizedCollectionConfig } from '../../../../../../collections/config/types'
import { useConfig } from '../../../../utilities/Config'
type options = { uploads: boolean }
type FilteredCollectionsT = (

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