payload 0.14.18-beta.0 → 0.14.19-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -3
- package/dist/admin/components/forms/field-types/Textarea/index.js +1 -1
- package/dist/admin/components/utilities/Locale/index.js +2 -2
- package/dist/admin/components/views/Account/Default.js +8 -9
- package/dist/admin/components/views/Global/Default.js +6 -4
- package/dist/admin/components/views/Global/index.js +2 -1
- package/dist/admin/components/views/Global/types.d.ts +1 -0
- package/dist/admin/components/views/collections/Edit/Default.js +23 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
## [0.14.
|
|
1
|
+
## [0.14.19-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.19-beta.0) (2022-02-03)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
+
* [#423](https://github.com/payloadcms/payload/issues/423), [#391](https://github.com/payloadcms/payload/issues/391) - prevents loading edit views until data initializes ([2884654](https://github.com/payloadcms/payload/commit/28846547afc7e7bb8accc5dbe9f3b98593f332fa))
|
|
6
7
|
* awaits beforeDelete hooks ([609b871](https://github.com/payloadcms/payload/commit/609b871fa274e8b6d9eaf301e52ab42179aad9b7))
|
|
7
8
|
* ensures multipart/form-data using _payload flattens field data before sending ([ae44727](https://github.com/payloadcms/payload/commit/ae44727fb9734fc3801f7249fa9e78668311c09e))
|
|
8
9
|
* ensures nested lists always render properly ([20e5dfb](https://github.com/payloadcms/payload/commit/20e5dfbb4ab8dab320d60772f5195c5faffe38d3))
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
* exposes useLocale for reuse ([bef0206](https://github.com/payloadcms/payload/commit/bef02062e769d1b0279c51af748f06d41c924c8a))
|
|
27
28
|
* rich text indent PoC ([2deed8b](https://github.com/payloadcms/payload/commit/2deed8b1464931c4bc76a288923b307cf04b6a4a))
|
|
28
29
|
|
|
29
|
-
## [0.14.
|
|
30
|
+
## [0.14.18-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.18-beta.0) (2022-02-01)
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
### Bug Fixes
|
|
@@ -51,9 +52,9 @@
|
|
|
51
52
|
* builds a way for multipart/form-data reqs to retain non-string values ([65b0ad7](https://github.com/payloadcms/payload/commit/65b0ad7f084a9c279a1e4fb799542f97c645653d))
|
|
52
53
|
* enhances rich text upload with custom field API ([0e4eb90](https://github.com/payloadcms/payload/commit/0e4eb906f2881dca518fea6b41e460bc57da9801))
|
|
53
54
|
* exposes FieldWithPath type for reuse ([df3a836](https://github.com/payloadcms/payload/commit/df3a83634fcb64724ef239600e3af4fc295fee4f))
|
|
55
|
+
* exposes useLocale for reuse ([bef0206](https://github.com/payloadcms/payload/commit/bef02062e769d1b0279c51af748f06d41c924c8a))
|
|
54
56
|
* rich text indent PoC ([2deed8b](https://github.com/payloadcms/payload/commit/2deed8b1464931c4bc76a288923b307cf04b6a4a))
|
|
55
57
|
|
|
56
|
-
|
|
57
58
|
# [0.14.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.14.0) (2022-01-03)
|
|
58
59
|
|
|
59
60
|
|
|
@@ -2,8 +2,8 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import useField from '../../useField';
|
|
3
3
|
import withCondition from '../../withCondition';
|
|
4
4
|
import { textarea } from '../../../../../fields/validations';
|
|
5
|
-
import './index.scss';
|
|
6
5
|
import TextareaInput from './Input';
|
|
6
|
+
import './index.scss';
|
|
7
7
|
const Textarea = (props) => {
|
|
8
8
|
const { path: pathFromProps, name, required, validate = textarea, admin: { readOnly, style, className, width, placeholder, rows, description, condition, } = {}, label, minLength, maxLength, } = props;
|
|
9
9
|
const path = pathFromProps || name;
|
|
@@ -7,9 +7,9 @@ export const LocaleProvider = ({ children }) => {
|
|
|
7
7
|
const { localization } = useConfig();
|
|
8
8
|
const { user } = useAuth();
|
|
9
9
|
const defaultLocale = (localization && localization.defaultLocale) ? localization.defaultLocale : 'en';
|
|
10
|
-
const [locale, setLocale] = useState(defaultLocale);
|
|
11
|
-
const { getPreference, setPreference } = usePreferences();
|
|
12
10
|
const searchParams = useSearchParams();
|
|
11
|
+
const [locale, setLocale] = useState((searchParams === null || searchParams === void 0 ? void 0 : searchParams.locale) || defaultLocale);
|
|
12
|
+
const { getPreference, setPreference } = usePreferences();
|
|
13
13
|
const localeFromParams = searchParams.locale;
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
if (!localization) {
|
|
@@ -25,19 +25,18 @@ const DefaultAccount = (props) => {
|
|
|
25
25
|
baseClass,
|
|
26
26
|
].filter(Boolean).join(' ');
|
|
27
27
|
return (React.createElement("div", { className: classes },
|
|
28
|
-
React.createElement(
|
|
28
|
+
isLoading && (React.createElement(Loading, null)),
|
|
29
|
+
!isLoading && (React.createElement(Form, { className: `${baseClass}__form`, method: "put", action: action, initialState: initialState, disabled: !hasSavePermission },
|
|
29
30
|
React.createElement("div", { className: `${baseClass}__main` },
|
|
30
31
|
React.createElement(Meta, { title: "Account", description: "Account of current user", keywords: "Account, Dashboard, Payload, CMS" }),
|
|
31
32
|
React.createElement(Eyebrow, null),
|
|
32
33
|
React.createElement(LeaveWithoutSaving, null),
|
|
33
34
|
React.createElement("div", { className: `${baseClass}__edit` },
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
React.createElement(Auth, { useAPIKey: auth.useAPIKey, collection: collection, email: data === null || data === void 0 ? void 0 : data.email, operation: "update" }),
|
|
40
|
-
React.createElement(RenderFields, { operation: "update", permissions: permissions.fields, readOnly: !hasSavePermission, filter: (field) => { var _a; return ((_a = field === null || field === void 0 ? void 0 : field.admin) === null || _a === void 0 ? void 0 : _a.position) !== 'sidebar'; }, fieldTypes: fieldTypes, fieldSchema: fields }))))),
|
|
35
|
+
React.createElement("header", { className: `${baseClass}__header` },
|
|
36
|
+
React.createElement("h1", null,
|
|
37
|
+
React.createElement(RenderTitle, { ...{ data, useAsTitle, fallback: '[Untitled]' } }))),
|
|
38
|
+
React.createElement(Auth, { useAPIKey: auth.useAPIKey, collection: collection, email: data === null || data === void 0 ? void 0 : data.email, operation: "update" }),
|
|
39
|
+
React.createElement(RenderFields, { operation: "update", permissions: permissions.fields, readOnly: !hasSavePermission, filter: (field) => { var _a; return ((_a = field === null || field === void 0 ? void 0 : field.admin) === null || _a === void 0 ? void 0 : _a.position) !== 'sidebar'; }, fieldTypes: fieldTypes, fieldSchema: fields }))),
|
|
41
40
|
React.createElement("div", { className: `${baseClass}__sidebar-wrap` },
|
|
42
41
|
React.createElement("div", { className: `${baseClass}__sidebar` },
|
|
43
42
|
React.createElement("div", { className: `${baseClass}__sidebar-sticky-wrap` },
|
|
@@ -65,6 +64,6 @@ const DefaultAccount = (props) => {
|
|
|
65
64
|
React.createElement("div", null, format(new Date(data.updatedAt), dateFormat)))),
|
|
66
65
|
data.createdAt && (React.createElement("li", null,
|
|
67
66
|
React.createElement("div", { className: `${baseClass}__label` }, "Created"),
|
|
68
|
-
React.createElement("div", null, format(new Date(data.createdAt), dateFormat)))))))))))));
|
|
67
|
+
React.createElement("div", null, format(new Date(data.createdAt), dateFormat))))))))))))));
|
|
69
68
|
};
|
|
70
69
|
export default DefaultAccount;
|
|
@@ -10,17 +10,19 @@ import CopyToClipboard from '../../elements/CopyToClipboard';
|
|
|
10
10
|
import Meta from '../../utilities/Meta';
|
|
11
11
|
import fieldTypes from '../../forms/field-types';
|
|
12
12
|
import LeaveWithoutSaving from '../../modals/LeaveWithoutSaving';
|
|
13
|
-
import './index.scss';
|
|
14
13
|
import ViewDescription from '../../elements/ViewDescription';
|
|
14
|
+
import Loading from '../../elements/Loading';
|
|
15
|
+
import './index.scss';
|
|
15
16
|
const baseClass = 'global-edit';
|
|
16
17
|
const DefaultGlobalView = (props) => {
|
|
17
18
|
var _a;
|
|
18
19
|
const { admin: { dateFormat } } = useConfig();
|
|
19
|
-
const { global, data, onSave, permissions, action, apiURL, initialState, } = props;
|
|
20
|
+
const { global, data, onSave, permissions, action, apiURL, initialState, isLoading, } = props;
|
|
20
21
|
const { fields, preview, label, admin: { description, } = {}, } = global;
|
|
21
22
|
const hasSavePermission = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.update) === null || _a === void 0 ? void 0 : _a.permission;
|
|
22
23
|
return (React.createElement("div", { className: baseClass },
|
|
23
|
-
React.createElement(
|
|
24
|
+
isLoading && (React.createElement(Loading, null)),
|
|
25
|
+
!isLoading && (React.createElement(Form, { className: `${baseClass}__form`, method: "post", action: action, onSuccess: onSave, disabled: !hasSavePermission, initialState: initialState },
|
|
24
26
|
React.createElement("div", { className: `${baseClass}__main` },
|
|
25
27
|
React.createElement(Meta, { title: label, description: label, keywords: `${label}, Payload, CMS` }),
|
|
26
28
|
React.createElement(Eyebrow, null),
|
|
@@ -51,6 +53,6 @@ const DefaultGlobalView = (props) => {
|
|
|
51
53
|
React.createElement("a", { href: apiURL, target: "_blank", rel: "noopener noreferrer" }, apiURL))),
|
|
52
54
|
data.updatedAt && (React.createElement("li", null,
|
|
53
55
|
React.createElement("div", { className: `${baseClass}__label` }, "Last Modified"),
|
|
54
|
-
React.createElement("div", null, format(new Date(data.updatedAt), dateFormat))))))))))));
|
|
56
|
+
React.createElement("div", null, format(new Date(data.updatedAt), dateFormat)))))))))))));
|
|
55
57
|
};
|
|
56
58
|
export default DefaultGlobalView;
|
|
@@ -29,7 +29,7 @@ const GlobalView = (props) => {
|
|
|
29
29
|
data: json.doc,
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
-
const [{ data }] = usePayloadAPI(`${serverURL}${api}/globals/${slug}`, { initialParams: { 'fallback-locale': 'null', depth: 0 } });
|
|
32
|
+
const [{ data, isLoading }] = usePayloadAPI(`${serverURL}${api}/globals/${slug}`, { initialParams: { 'fallback-locale': 'null', depth: 0 } });
|
|
33
33
|
const dataToRender = (locationState === null || locationState === void 0 ? void 0 : locationState.data) || data;
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
const nav = [{
|
|
@@ -48,6 +48,7 @@ const GlobalView = (props) => {
|
|
|
48
48
|
return (React.createElement(DocumentInfoProvider, { slug: slug, type: "global" },
|
|
49
49
|
React.createElement(NegativeFieldGutterProvider, { allow: true },
|
|
50
50
|
React.createElement(RenderCustomComponent, { DefaultComponent: DefaultGlobal, CustomComponent: CustomEdit, componentProps: {
|
|
51
|
+
isLoading,
|
|
51
52
|
data: dataToRender,
|
|
52
53
|
permissions: globalPermissions,
|
|
53
54
|
initialState,
|
|
@@ -31,20 +31,20 @@ const DefaultEditView = (props) => {
|
|
|
31
31
|
].filter(Boolean).join(' ');
|
|
32
32
|
const operation = isEditing ? 'update' : 'create';
|
|
33
33
|
return (React.createElement("div", { className: classes },
|
|
34
|
-
React.createElement(
|
|
34
|
+
isLoading && (React.createElement(Loading, null)),
|
|
35
|
+
!isLoading && (React.createElement(Form, { className: `${baseClass}__form`, method: id ? 'put' : 'post', action: action, onSuccess: onSave, disabled: !hasSavePermission, initialState: initialState },
|
|
35
36
|
React.createElement("div", { className: `${baseClass}__main` },
|
|
36
37
|
React.createElement(Meta, { title: `${isEditing ? 'Editing' : 'Creating'} - ${collection.labels.singular}`, description: `${isEditing ? 'Editing' : 'Creating'} - ${collection.labels.singular}`, keywords: `${collection.labels.singular}, Payload, CMS` }),
|
|
37
38
|
React.createElement(Eyebrow, null),
|
|
38
39
|
React.createElement(LeaveWithoutSaving, null),
|
|
39
40
|
React.createElement("div", { className: `${baseClass}__edit` },
|
|
40
|
-
|
|
41
|
-
!isLoading && (React.createElement(React.Fragment, null,
|
|
41
|
+
React.createElement(React.Fragment, null,
|
|
42
42
|
React.createElement("header", { className: `${baseClass}__header` },
|
|
43
43
|
React.createElement("h1", null,
|
|
44
44
|
React.createElement(RenderTitle, { ...{ data, useAsTitle, fallback: '[Untitled]' } }))),
|
|
45
45
|
auth && (React.createElement(Auth, { useAPIKey: auth.useAPIKey, requirePassword: !isEditing, verify: auth.verify, collection: collection, email: data === null || data === void 0 ? void 0 : data.email, operation: operation })),
|
|
46
46
|
upload && (React.createElement(Upload, { data: data, collection: collection })),
|
|
47
|
-
React.createElement(RenderFields, { operation: operation, readOnly: !hasSavePermission, permissions: permissions.fields, filter: (field) => { var _a, _b; return (!((_a = field === null || field === void 0 ? void 0 : field.admin) === null || _a === void 0 ? void 0 : _a.position) || (((_b = field === null || field === void 0 ? void 0 : field.admin) === null || _b === void 0 ? void 0 : _b.position) !== 'sidebar')); }, fieldTypes: fieldTypes, fieldSchema: fields }))))
|
|
47
|
+
React.createElement(RenderFields, { operation: operation, readOnly: !hasSavePermission, permissions: permissions.fields, filter: (field) => { var _a, _b; return (!((_a = field === null || field === void 0 ? void 0 : field.admin) === null || _a === void 0 ? void 0 : _a.position) || (((_b = field === null || field === void 0 ? void 0 : field.admin) === null || _b === void 0 ? void 0 : _b.position) !== 'sidebar')); }, fieldTypes: fieldTypes, fieldSchema: fields })))),
|
|
48
48
|
React.createElement("div", { className: `${baseClass}__sidebar-wrap` },
|
|
49
49
|
React.createElement("div", { className: `${baseClass}__sidebar` },
|
|
50
50
|
React.createElement("div", { className: `${baseClass}__sidebar-sticky-wrap` },
|
|
@@ -59,25 +59,24 @@ const DefaultEditView = (props) => {
|
|
|
59
59
|
React.createElement("div", { className: `${baseClass}__document-actions${(preview && isEditing) ? ` ${baseClass}__document-actions--with-preview` : ''}` },
|
|
60
60
|
isEditing && (React.createElement(PreviewButton, { generatePreviewURL: preview, data: data })),
|
|
61
61
|
hasSavePermission && (React.createElement(FormSubmit, null, "Save"))),
|
|
62
|
-
|
|
63
|
-
React.createElement(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
React.createElement("
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
React.createElement("
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
React.createElement("div", null, format(new Date(data.createdAt), dateFormat))))))))))))))));
|
|
62
|
+
React.createElement("div", { className: `${baseClass}__sidebar-fields` },
|
|
63
|
+
React.createElement(RenderFields, { operation: isEditing ? 'update' : 'create', readOnly: !hasSavePermission, permissions: permissions.fields, filter: (field) => { var _a; return ((_a = field === null || field === void 0 ? void 0 : field.admin) === null || _a === void 0 ? void 0 : _a.position) === 'sidebar'; }, fieldTypes: fieldTypes, fieldSchema: fields })),
|
|
64
|
+
isEditing && (React.createElement("ul", { className: `${baseClass}__meta` },
|
|
65
|
+
React.createElement("li", { className: `${baseClass}__api-url` },
|
|
66
|
+
React.createElement("span", { className: `${baseClass}__label` },
|
|
67
|
+
"API URL",
|
|
68
|
+
' ',
|
|
69
|
+
React.createElement(CopyToClipboard, { value: apiURL })),
|
|
70
|
+
React.createElement("a", { href: apiURL, target: "_blank", rel: "noopener noreferrer" }, apiURL)),
|
|
71
|
+
React.createElement("li", null,
|
|
72
|
+
React.createElement("div", { className: `${baseClass}__label` }, "ID"),
|
|
73
|
+
React.createElement("div", null, id)),
|
|
74
|
+
timestamps && (React.createElement(React.Fragment, null,
|
|
75
|
+
data.updatedAt && (React.createElement("li", null,
|
|
76
|
+
React.createElement("div", { className: `${baseClass}__label` }, "Last Modified"),
|
|
77
|
+
React.createElement("div", null, format(new Date(data.updatedAt), dateFormat)))),
|
|
78
|
+
data.createdAt && (React.createElement("li", null,
|
|
79
|
+
React.createElement("div", { className: `${baseClass}__label` }, "Created"),
|
|
80
|
+
React.createElement("div", null, format(new Date(data.createdAt), dateFormat)))))))))))))));
|
|
82
81
|
};
|
|
83
82
|
export default DefaultEditView;
|