cozy-viewer 13.2.4 → 13.2.6
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 +22 -0
- package/dist/Panel/Qualification.js +4 -5
- package/dist/ViewerContainer.js +4 -3
- package/package.json +3 -3
- package/src/Panel/Qualification.jsx +5 -5
- package/src/ViewerContainer.jsx +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [13.2.6](https://github.com/cozy/cozy-libs/compare/cozy-viewer@13.2.5...cozy-viewer@13.2.6) (2025-01-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Viewer:** Now wait all sharing fetch before checking write access ([3657ac3](https://github.com/cozy/cozy-libs/commit/3657ac3b3243abef7b70ebd5fe16d183646ec085))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [13.2.5](https://github.com/cozy/cozy-libs/compare/cozy-viewer@13.2.4...cozy-viewer@13.2.5) (2025-01-21)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **Viewer:** Now Qualification panel is editable on write share ([ce63d47](https://github.com/cozy/cozy-libs/commit/ce63d47a3cc11c55cb1d3790188ce4a88f91f09a))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [13.2.4](https://github.com/cozy/cozy-libs/compare/cozy-viewer@13.2.3...cozy-viewer@13.2.4) (2025-01-20)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package cozy-viewer
|
|
@@ -59,7 +59,6 @@ var ComponentFromMetadataQualificationType = {
|
|
|
59
59
|
|
|
60
60
|
var Qualification = function Qualification(_ref) {
|
|
61
61
|
var file = _ref.file,
|
|
62
|
-
isPublic = _ref.isPublic,
|
|
63
62
|
isReadOnly = _ref.isReadOnly;
|
|
64
63
|
var _file$metadata = file.metadata,
|
|
65
64
|
metadata = _file$metadata === void 0 ? {} : _file$metadata;
|
|
@@ -116,13 +115,13 @@ var Qualification = function Qualification(_ref) {
|
|
|
116
115
|
file: file
|
|
117
116
|
}), (0, _qualification.hasSupportedQualification)(file) ? /*#__PURE__*/_react.default.createElement(_QualificationListItemQualification.default, {
|
|
118
117
|
file: file,
|
|
119
|
-
isReadOnly:
|
|
118
|
+
isReadOnly: isReadOnly,
|
|
120
119
|
onClick: function onClick() {
|
|
121
120
|
return setShowQualifModal(true);
|
|
122
121
|
}
|
|
123
122
|
}) : /*#__PURE__*/_react.default.createElement(_QualificationListItemQualificationEmpty.default, {
|
|
124
123
|
file: file,
|
|
125
|
-
isReadOnly:
|
|
124
|
+
isReadOnly: isReadOnly,
|
|
126
125
|
onClick: function onClick() {
|
|
127
126
|
return setShowQualifModal(true);
|
|
128
127
|
}
|
|
@@ -140,7 +139,7 @@ var Qualification = function Qualification(_ref) {
|
|
|
140
139
|
key: idx
|
|
141
140
|
}, /*#__PURE__*/_react.default.createElement(QualificationListItemComp, {
|
|
142
141
|
file: file,
|
|
143
|
-
isReadOnly:
|
|
142
|
+
isReadOnly: isReadOnly,
|
|
144
143
|
ref: actionBtnRef.current[idx],
|
|
145
144
|
formattedMetadataQualification: meta,
|
|
146
145
|
toggleActionsMenu: function toggleActionsMenu(val) {
|
|
@@ -154,7 +153,7 @@ var Qualification = function Qualification(_ref) {
|
|
|
154
153
|
ref: actionBtnRef.current[optionFile.id],
|
|
155
154
|
file: file,
|
|
156
155
|
optionFile: optionFile,
|
|
157
|
-
isReadOnly:
|
|
156
|
+
isReadOnly: isReadOnly,
|
|
158
157
|
onClose: hideActionsMenu
|
|
159
158
|
})));
|
|
160
159
|
};
|
package/dist/ViewerContainer.js
CHANGED
|
@@ -95,7 +95,8 @@ var ViewerContainer = function ViewerContainer(props) {
|
|
|
95
95
|
|
|
96
96
|
var _useSharingContext = (0, _cozySharing.useSharingContext)(),
|
|
97
97
|
hasWriteAccess = _useSharingContext.hasWriteAccess,
|
|
98
|
-
hasSharedParent = _useSharingContext.hasSharedParent
|
|
98
|
+
hasSharedParent = _useSharingContext.hasSharedParent,
|
|
99
|
+
allLoaded = _useSharingContext.allLoaded;
|
|
99
100
|
|
|
100
101
|
var currentFile = files[currentIndex];
|
|
101
102
|
var fileCount = files.length;
|
|
@@ -134,7 +135,7 @@ var ViewerContainer = function ViewerContainer(props) {
|
|
|
134
135
|
break;
|
|
135
136
|
|
|
136
137
|
case 6:
|
|
137
|
-
_context.t0 = !hasWriteAccess(hasSharedParent(currentFile.path) ? currentFile.dir_id : currentFile._id);
|
|
138
|
+
_context.t0 = allLoaded ? !hasWriteAccess(hasSharedParent(currentFile.path) ? currentFile.dir_id : currentFile._id) : true;
|
|
138
139
|
|
|
139
140
|
case 7:
|
|
140
141
|
res = _context.t0;
|
|
@@ -153,7 +154,7 @@ var ViewerContainer = function ViewerContainer(props) {
|
|
|
153
154
|
}();
|
|
154
155
|
|
|
155
156
|
getIsReadOnly();
|
|
156
|
-
}, [client, currentFile, hasWriteAccess, hasSharedParent, isPublic]);
|
|
157
|
+
}, [client, currentFile, hasWriteAccess, hasSharedParent, allLoaded, isPublic]);
|
|
157
158
|
return /*#__PURE__*/_react.default.createElement(_Alert.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
158
159
|
id: "viewer-wrapper",
|
|
159
160
|
className: (0, _classnames.default)(styles['viewer-wrapper'], className)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-viewer",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.6",
|
|
4
4
|
"description": "Cozy-Viewer provides a component to show files in a viewer.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"babel-preset-cozy-app": "^2.8.1",
|
|
28
28
|
"cozy-client": "^52.1.0",
|
|
29
29
|
"cozy-device-helper": "2.0.0",
|
|
30
|
-
"cozy-harvest-lib": "^32.2.
|
|
30
|
+
"cozy-harvest-lib": "^32.2.16",
|
|
31
31
|
"cozy-intent": "^2.29.1",
|
|
32
32
|
"cozy-logger": "^1.16.1",
|
|
33
33
|
"cozy-sharing": "^19.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react": ">=16.12.0",
|
|
60
60
|
"react-dom": ">=16.12.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "3fc2e4bd5776c7094fc9b8a5288b68e9e1cf054e"
|
|
63
63
|
}
|
|
@@ -34,7 +34,7 @@ const ComponentFromMetadataQualificationType = {
|
|
|
34
34
|
bills: QualificationListItemInformation
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const Qualification = ({ file,
|
|
37
|
+
const Qualification = ({ file, isReadOnly }) => {
|
|
38
38
|
const { metadata = {} } = file
|
|
39
39
|
const actionBtnRef = useRef([])
|
|
40
40
|
const [showQualifModal, setShowQualifModal] = useState(false)
|
|
@@ -75,13 +75,13 @@ const Qualification = ({ file, isPublic, isReadOnly }) => {
|
|
|
75
75
|
{hasSupportedQualification(file) ? (
|
|
76
76
|
<QualificationListItemQualification
|
|
77
77
|
file={file}
|
|
78
|
-
isReadOnly={
|
|
78
|
+
isReadOnly={isReadOnly}
|
|
79
79
|
onClick={() => setShowQualifModal(true)}
|
|
80
80
|
/>
|
|
81
81
|
) : (
|
|
82
82
|
<QualificationListItemQualificationEmpty
|
|
83
83
|
file={file}
|
|
84
|
-
isReadOnly={
|
|
84
|
+
isReadOnly={isReadOnly}
|
|
85
85
|
onClick={() => setShowQualifModal(true)}
|
|
86
86
|
/>
|
|
87
87
|
)}
|
|
@@ -109,7 +109,7 @@ const Qualification = ({ file, isPublic, isReadOnly }) => {
|
|
|
109
109
|
<Fragment key={idx}>
|
|
110
110
|
<QualificationListItemComp
|
|
111
111
|
file={file}
|
|
112
|
-
isReadOnly={
|
|
112
|
+
isReadOnly={isReadOnly}
|
|
113
113
|
ref={actionBtnRef.current[idx]}
|
|
114
114
|
formattedMetadataQualification={meta}
|
|
115
115
|
toggleActionsMenu={val => toggleActionsMenu(idx, name, val)}
|
|
@@ -123,7 +123,7 @@ const Qualification = ({ file, isPublic, isReadOnly }) => {
|
|
|
123
123
|
ref={actionBtnRef.current[optionFile.id]}
|
|
124
124
|
file={file}
|
|
125
125
|
optionFile={optionFile}
|
|
126
|
-
isReadOnly={
|
|
126
|
+
isReadOnly={isReadOnly}
|
|
127
127
|
onClose={hideActionsMenu}
|
|
128
128
|
/>
|
|
129
129
|
)}
|
package/src/ViewerContainer.jsx
CHANGED
|
@@ -35,7 +35,7 @@ const ViewerContainer = props => {
|
|
|
35
35
|
const [isReadOnly, setIsReadOnly] = useState(true)
|
|
36
36
|
const client = useClient()
|
|
37
37
|
useExtendI18n(locales)
|
|
38
|
-
const { hasWriteAccess, hasSharedParent } = useSharingContext()
|
|
38
|
+
const { hasWriteAccess, hasSharedParent, allLoaded } = useSharingContext()
|
|
39
39
|
|
|
40
40
|
const currentFile = files[currentIndex]
|
|
41
41
|
const fileCount = files.length
|
|
@@ -59,17 +59,26 @@ const ViewerContainer = props => {
|
|
|
59
59
|
document: currentFile,
|
|
60
60
|
client
|
|
61
61
|
})
|
|
62
|
-
:
|
|
62
|
+
: allLoaded
|
|
63
|
+
? !hasWriteAccess(
|
|
63
64
|
hasSharedParent(currentFile.path)
|
|
64
65
|
? currentFile.dir_id
|
|
65
66
|
: currentFile._id
|
|
66
67
|
)
|
|
68
|
+
: true
|
|
67
69
|
|
|
68
70
|
setIsReadOnly(res)
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
getIsReadOnly()
|
|
72
|
-
}, [
|
|
74
|
+
}, [
|
|
75
|
+
client,
|
|
76
|
+
currentFile,
|
|
77
|
+
hasWriteAccess,
|
|
78
|
+
hasSharedParent,
|
|
79
|
+
allLoaded,
|
|
80
|
+
isPublic
|
|
81
|
+
])
|
|
73
82
|
|
|
74
83
|
return (
|
|
75
84
|
<AlertProvider>
|