payload 1.1.12 → 1.1.14
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/dist/admin/components/forms/field-types/Relationship/AddNew/index.js +3 -4
- package/dist/admin/components/forms/field-types/RichText/elements/upload/Button/index.js +4 -4
- package/dist/admin/components/forms/field-types/Upload/SelectExisting/index.js +4 -4
- package/dist/admin/components/views/Global/index.scss +4 -5
- package/dist/admin/index.js +1 -1
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ import './index.scss';
|
|
|
11
11
|
const baseClass = 'relationship-add-new';
|
|
12
12
|
export const AddNewRelation = ({ path, hasMany, relationTo, value, setValue, dispatchOptions }) => {
|
|
13
13
|
const relatedCollections = useRelatedCollections(relationTo);
|
|
14
|
-
const { toggleModal,
|
|
14
|
+
const { toggleModal, isModalOpen } = useModal();
|
|
15
15
|
const { permissions } = useAuth();
|
|
16
16
|
const [hasPermission, setHasPermission] = useState(false);
|
|
17
17
|
const [modalCollection, setModalCollection] = useState();
|
|
@@ -59,11 +59,10 @@ export const AddNewRelation = ({ path, hasMany, relationTo, value, setValue, dis
|
|
|
59
59
|
}
|
|
60
60
|
}, [permissions, relatedCollections]);
|
|
61
61
|
useEffect(() => {
|
|
62
|
-
|
|
63
|
-
if (!((_a = modalState[modalSlug]) === null || _a === void 0 ? void 0 : _a.isOpen)) {
|
|
62
|
+
if (!isModalOpen(modalSlug)) {
|
|
64
63
|
setModalCollection(undefined);
|
|
65
64
|
}
|
|
66
|
-
}, [
|
|
65
|
+
}, [isModalOpen, modalSlug]);
|
|
67
66
|
return hasPermission ? (React.createElement("div", { className: baseClass, id: `${path}-add-new` },
|
|
68
67
|
relatedCollections.length === 1 && (React.createElement(Button, { className: `${baseClass}__add-button`, onClick: () => openModal(relatedCollections[0]), buttonStyle: "none", tooltip: `Add new ${relatedCollections[0].labels.singular}` },
|
|
69
68
|
React.createElement(Plus, null))),
|
|
@@ -33,8 +33,8 @@ const insertUpload = (editor, { value, relationTo }) => {
|
|
|
33
33
|
ReactEditor.focus(editor);
|
|
34
34
|
};
|
|
35
35
|
const UploadButton = ({ path }) => {
|
|
36
|
-
var _a, _b
|
|
37
|
-
const { toggleModal,
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const { toggleModal, isModalOpen } = useModal();
|
|
38
38
|
const editor = useSlate();
|
|
39
39
|
const { serverURL, routes: { api }, collections } = useConfig();
|
|
40
40
|
const [availableCollections] = useState(() => collections.filter(({ admin: { enableRichTextRelationship }, upload }) => (Boolean(upload) && enableRichTextRelationship)));
|
|
@@ -54,7 +54,7 @@ const UploadButton = ({ path }) => {
|
|
|
54
54
|
const [page, setPage] = useState(null);
|
|
55
55
|
const modalSlug = `${path}-add-upload`;
|
|
56
56
|
const moreThanOneAvailableCollection = availableCollections.length > 1;
|
|
57
|
-
const isOpen = (
|
|
57
|
+
const isOpen = isModalOpen(modalSlug);
|
|
58
58
|
// If modal is open, get active page of upload gallery
|
|
59
59
|
const apiURL = isOpen ? `${serverURL}${api}/${modalCollection.slug}` : null;
|
|
60
60
|
const [{ data }, { setParams }] = usePayloadAPI(apiURL, {});
|
|
@@ -129,6 +129,6 @@ const UploadButton = ({ path }) => {
|
|
|
129
129
|
"of",
|
|
130
130
|
' ',
|
|
131
131
|
data.totalDocs),
|
|
132
|
-
React.createElement(PerPage, { limits: (
|
|
132
|
+
React.createElement(PerPage, { limits: (_b = (_a = modalCollection === null || modalCollection === void 0 ? void 0 : modalCollection.admin) === null || _a === void 0 ? void 0 : _a.pagination) === null || _b === void 0 ? void 0 : _b.limits, limit: limit, modifySearchParams: false, handleChange: setLimit }))))))))));
|
|
133
133
|
};
|
|
134
134
|
export default UploadButton;
|
|
@@ -18,13 +18,13 @@ import ViewDescription from '../../../../elements/ViewDescription';
|
|
|
18
18
|
import './index.scss';
|
|
19
19
|
const baseClass = 'select-existing-upload-modal';
|
|
20
20
|
const SelectExistingUploadModal = (props) => {
|
|
21
|
-
var _a, _b
|
|
21
|
+
var _a, _b;
|
|
22
22
|
const { setValue, collection, collection: { slug: collectionSlug, admin: { description, pagination: { defaultLimit, }, } = {}, } = {}, slug: modalSlug, path, filterOptions, } = props;
|
|
23
23
|
const { serverURL, routes: { api } } = useConfig();
|
|
24
24
|
const { id } = useDocumentInfo();
|
|
25
25
|
const { user } = useAuth();
|
|
26
26
|
const { getData, getSiblingData } = useForm();
|
|
27
|
-
const { toggleModal,
|
|
27
|
+
const { toggleModal, isModalOpen } = useModal();
|
|
28
28
|
const [fields] = useState(() => formatFields(collection));
|
|
29
29
|
const [limit, setLimit] = useState(defaultLimit);
|
|
30
30
|
const [sort, setSort] = useState(null);
|
|
@@ -34,7 +34,7 @@ const SelectExistingUploadModal = (props) => {
|
|
|
34
34
|
const classes = [
|
|
35
35
|
baseClass,
|
|
36
36
|
].filter(Boolean).join(' ');
|
|
37
|
-
const isOpen = (
|
|
37
|
+
const isOpen = isModalOpen(modalSlug);
|
|
38
38
|
const apiURL = isOpen ? `${serverURL}${api}/${collectionSlug}` : null;
|
|
39
39
|
const [{ data }, { setParams }] = usePayloadAPI(apiURL, {});
|
|
40
40
|
useEffect(() => {
|
|
@@ -94,6 +94,6 @@ const SelectExistingUploadModal = (props) => {
|
|
|
94
94
|
"of",
|
|
95
95
|
' ',
|
|
96
96
|
data.totalDocs),
|
|
97
|
-
React.createElement(PerPage, { limits: (
|
|
97
|
+
React.createElement(PerPage, { limits: (_b = (_a = collection === null || collection === void 0 ? void 0 : collection.admin) === null || _a === void 0 ? void 0 : _a.pagination) === null || _b === void 0 ? void 0 : _b.limits, limit: limit, modifySearchParams: false, handleChange: setLimit }))))))));
|
|
98
98
|
};
|
|
99
99
|
export default SelectExistingUploadModal;
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
min-height: 100%;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
&__collection-actions,
|
|
72
71
|
&__document-actions,
|
|
73
72
|
&__meta,
|
|
74
73
|
&__sidebar-fields {
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
&__document-actions--
|
|
90
|
+
&__document-actions--has-2 {
|
|
92
91
|
display: flex;
|
|
93
92
|
|
|
94
93
|
>* {
|
|
@@ -106,8 +105,8 @@
|
|
|
106
105
|
.form-submit {
|
|
107
106
|
.btn {
|
|
108
107
|
width: 100%;
|
|
109
|
-
padding-left: base(
|
|
110
|
-
padding-right: base(
|
|
108
|
+
padding-left: base(.5);
|
|
109
|
+
padding-right: base(.5);
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
}
|
|
@@ -215,4 +214,4 @@
|
|
|
215
214
|
height: auto;
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
|
-
}
|
|
217
|
+
}
|
package/dist/admin/index.js
CHANGED
|
@@ -28,7 +28,7 @@ const Index = () => (React.createElement(React.Fragment, null,
|
|
|
28
28
|
} },
|
|
29
29
|
React.createElement(ScrollInfoProvider, null,
|
|
30
30
|
React.createElement(Router, null,
|
|
31
|
-
React.createElement(ModalProvider, { classPrefix: "payload", zIndex:
|
|
31
|
+
React.createElement(ModalProvider, { classPrefix: "payload", zIndex: "var(--z-modal)", transTime: 0 },
|
|
32
32
|
React.createElement(AuthProvider, null,
|
|
33
33
|
React.createElement(PreferencesProvider, null,
|
|
34
34
|
React.createElement(ThemeProvider, null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "Node, React and MongoDB Headless CMS and Application Framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@babel/preset-typescript": "^7.12.1",
|
|
87
87
|
"@babel/register": "^7.11.5",
|
|
88
88
|
"@date-io/date-fns": "^2.10.6",
|
|
89
|
-
"@faceless-ui/modal": "^2.0.
|
|
89
|
+
"@faceless-ui/modal": "^2.0.1",
|
|
90
90
|
"@faceless-ui/scroll-info": "^1.2.3",
|
|
91
91
|
"@faceless-ui/window-info": "^2.0.2",
|
|
92
92
|
"@types/is-plain-object": "^2.0.4",
|