payload 0.13.13-beta.0 → 0.13.14-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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## [0.13.
|
|
1
|
+
## [0.13.14-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.14-beta.0) (2021-12-29)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0))
|
|
8
8
|
* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5))
|
|
9
9
|
* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257))
|
|
10
|
+
* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0))
|
|
10
11
|
* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4))
|
|
11
12
|
* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3))
|
|
13
|
+
* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7))
|
|
12
14
|
* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade))
|
|
13
15
|
|
|
14
16
|
|
|
@@ -18,7 +20,7 @@
|
|
|
18
20
|
* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7))
|
|
19
21
|
* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b))
|
|
20
22
|
|
|
21
|
-
## [0.13.
|
|
23
|
+
## [0.13.13-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.13-beta.0) (2021-12-28)
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
### Bug Fixes
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418))
|
|
27
29
|
* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0))
|
|
28
30
|
* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5))
|
|
31
|
+
* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257))
|
|
29
32
|
* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4))
|
|
30
33
|
* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3))
|
|
31
34
|
* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade))
|
|
@@ -37,21 +40,6 @@
|
|
|
37
40
|
* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7))
|
|
38
41
|
* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b))
|
|
39
42
|
|
|
40
|
-
## [0.13.11-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.11-beta.0) (2021-12-22)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Bug Fixes
|
|
44
|
-
|
|
45
|
-
* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418))
|
|
46
|
-
* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0))
|
|
47
|
-
* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5))
|
|
48
|
-
* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### Features
|
|
52
|
-
|
|
53
|
-
* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b))
|
|
54
|
-
* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7))
|
|
55
43
|
|
|
56
44
|
## [0.13.6](https://github.com/payloadcms/payload/compare/v0.13.5...v0.13.6) (2021-11-30)
|
|
57
45
|
|
|
@@ -92,6 +92,8 @@ const Blocks = (props) => {
|
|
|
92
92
|
const destinationIndex = result.destination.index;
|
|
93
93
|
moveRow(sourceIndex, destinationIndex);
|
|
94
94
|
}, [moveRow]);
|
|
95
|
+
// Get preferences, and once retrieved,
|
|
96
|
+
// Reset rows with preferences included
|
|
95
97
|
useEffect(() => {
|
|
96
98
|
const fetchPreferences = async () => {
|
|
97
99
|
var _a, _b;
|
|
@@ -101,6 +103,11 @@ const Blocks = (props) => {
|
|
|
101
103
|
};
|
|
102
104
|
fetchPreferences();
|
|
103
105
|
}, [formContext, path, preferencesKey, getPreference]);
|
|
106
|
+
// Set row count on mount and when form context is reset
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
const data = formContext.getDataByPath(path);
|
|
109
|
+
dispatchRows({ type: 'SET_ALL', data: data || [] });
|
|
110
|
+
}, [formContext, path]);
|
|
104
111
|
useEffect(() => {
|
|
105
112
|
setValue((rows === null || rows === void 0 ? void 0 : rows.length) || 0);
|
|
106
113
|
if ((rows === null || rows === void 0 ? void 0 : rows.length) === 0) {
|
|
@@ -19,7 +19,6 @@ const Upload = (props) => {
|
|
|
19
19
|
var _a, _b;
|
|
20
20
|
const inputRef = useRef(null);
|
|
21
21
|
const dropRef = useRef(null);
|
|
22
|
-
const [fileList, setFileList] = useState(undefined);
|
|
23
22
|
const [selectingFile, setSelectingFile] = useState(false);
|
|
24
23
|
const [dragging, setDragging] = useState(false);
|
|
25
24
|
const [dragCounter, setDragCounter] = useState(0);
|
|
@@ -33,15 +32,15 @@ const Upload = (props) => {
|
|
|
33
32
|
const handleDragIn = useCallback((e) => {
|
|
34
33
|
e.preventDefault();
|
|
35
34
|
e.stopPropagation();
|
|
36
|
-
setDragCounter(
|
|
35
|
+
setDragCounter((count) => count + 1);
|
|
37
36
|
if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
|
|
38
37
|
setDragging(true);
|
|
39
38
|
}
|
|
40
|
-
}, [
|
|
39
|
+
}, []);
|
|
41
40
|
const handleDragOut = useCallback((e) => {
|
|
42
41
|
e.preventDefault();
|
|
43
42
|
e.stopPropagation();
|
|
44
|
-
setDragCounter(
|
|
43
|
+
setDragCounter((count) => count - 1);
|
|
45
44
|
if (dragCounter > 1)
|
|
46
45
|
return;
|
|
47
46
|
setDragging(false);
|
|
@@ -51,7 +50,7 @@ const Upload = (props) => {
|
|
|
51
50
|
e.stopPropagation();
|
|
52
51
|
setDragging(false);
|
|
53
52
|
if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
|
|
54
|
-
|
|
53
|
+
setValue(e.dataTransfer.files[0]);
|
|
55
54
|
setDragging(false);
|
|
56
55
|
e.dataTransfer.clearData();
|
|
57
56
|
setDragCounter(0);
|
|
@@ -59,12 +58,14 @@ const Upload = (props) => {
|
|
|
59
58
|
else {
|
|
60
59
|
setDragging(false);
|
|
61
60
|
}
|
|
62
|
-
}, []);
|
|
61
|
+
}, [setValue]);
|
|
62
|
+
// Only called when input is interacted with directly
|
|
63
|
+
// Not called when drag + drop is used
|
|
64
|
+
// Or when input is cleared
|
|
63
65
|
const handleInputChange = useCallback(() => {
|
|
64
|
-
var _a, _b
|
|
66
|
+
var _a, _b;
|
|
65
67
|
setSelectingFile(false);
|
|
66
|
-
|
|
67
|
-
setValue(((_c = (_b = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _b === void 0 ? void 0 : _b.files) === null || _c === void 0 ? void 0 : _c[0]) || null);
|
|
68
|
+
setValue(((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]) || null);
|
|
68
69
|
}, [inputRef, setValue]);
|
|
69
70
|
useEffect(() => {
|
|
70
71
|
if (selectingFile) {
|
|
@@ -87,12 +88,7 @@ const Upload = (props) => {
|
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
90
|
return () => null;
|
|
90
|
-
}, [handleDragIn, handleDragOut, handleDrop,
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (inputRef.current && fileList !== undefined) {
|
|
93
|
-
inputRef.current.files = fileList;
|
|
94
|
-
}
|
|
95
|
-
}, [fileList]);
|
|
91
|
+
}, [handleDragIn, handleDragOut, handleDrop, value]);
|
|
96
92
|
useEffect(() => {
|
|
97
93
|
setReplacingFile(false);
|
|
98
94
|
}, [data]);
|
|
@@ -105,14 +101,12 @@ const Upload = (props) => {
|
|
|
105
101
|
React.createElement(Error, { showError: showError, message: errorMessage }),
|
|
106
102
|
(filename && !replacingFile) && (React.createElement(FileDetails, { doc: data, collection: collection, handleRemove: () => {
|
|
107
103
|
setReplacingFile(true);
|
|
108
|
-
setFileList(null);
|
|
109
104
|
setValue(null);
|
|
110
105
|
} })),
|
|
111
106
|
(!filename || replacingFile) && (React.createElement("div", { className: `${baseClass}__upload` },
|
|
112
107
|
value && (React.createElement("div", { className: `${baseClass}__file-selected` },
|
|
113
108
|
React.createElement("span", { className: `${baseClass}__filename` }, value.name),
|
|
114
109
|
React.createElement(Button, { icon: "x", round: true, buttonStyle: "icon-label", iconStyle: "with-border", onClick: () => {
|
|
115
|
-
setFileList(null);
|
|
116
110
|
setValue(null);
|
|
117
111
|
} }))),
|
|
118
112
|
!value && (React.createElement(React.Fragment, null,
|