cozy-ui-plus 14.0.4 → 14.0.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
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [14.0.6](https://github.com/cozy/cozy-libs/compare/cozy-ui-plus@14.0.5...cozy-ui-plus@14.0.6) (2026-10-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package cozy-ui-plus
|
|
9
|
+
|
|
10
|
+
## [14.0.5](https://github.com/cozy/cozy-libs/compare/cozy-ui-plus@14.0.4...cozy-ui-plus@14.0.5) (2026-10-20)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package cozy-ui-plus
|
|
13
|
+
|
|
6
14
|
## [14.0.4](https://github.com/cozy/cozy-libs/compare/cozy-ui-plus@14.0.3...cozy-ui-plus@14.0.4) (2026-10-19)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package cozy-ui-plus
|
|
@@ -35,8 +35,6 @@ var _file = require("cozy-client/dist/models/file");
|
|
|
35
35
|
|
|
36
36
|
var _cozyLogger = _interopRequireDefault(require("cozy-logger"));
|
|
37
37
|
|
|
38
|
-
var _Encrypted = require("cozy-ui/transpiled/react/providers/Encrypted");
|
|
39
|
-
|
|
40
38
|
var _checkImageSource = require("./checkImageSource");
|
|
41
39
|
|
|
42
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -364,11 +362,6 @@ var FileImageLoader = /*#__PURE__*/function (_Component) {
|
|
|
364
362
|
var _this$props5 = this.props,
|
|
365
363
|
render = _this$props5.render,
|
|
366
364
|
renderFallback = _this$props5.renderFallback;
|
|
367
|
-
|
|
368
|
-
if (this.context && this.context.url) {
|
|
369
|
-
return render(this.context.url);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
365
|
if (src) return render(src);else if (renderFallback) return renderFallback();else return null;
|
|
373
366
|
}
|
|
374
367
|
}]);
|
|
@@ -376,7 +369,6 @@ var FileImageLoader = /*#__PURE__*/function (_Component) {
|
|
|
376
369
|
}(_react.Component);
|
|
377
370
|
|
|
378
371
|
exports.FileImageLoader = FileImageLoader;
|
|
379
|
-
(0, _defineProperty2.default)(FileImageLoader, "contextType", _Encrypted.EncryptedContext);
|
|
380
372
|
FileImageLoader.propTypes = {
|
|
381
373
|
file: _propTypes.default.object.isRequired,
|
|
382
374
|
render: _propTypes.default.func.isRequired,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui-plus",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.6",
|
|
4
4
|
"description": "Cozy-ui-plus is an extension of cozy-ui and provides components based on cozy-client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"cozy-intent": "^2.31.1",
|
|
39
39
|
"cozy-interapp": "^0.21.0",
|
|
40
40
|
"cozy-logger": "^1.18.1",
|
|
41
|
-
"cozy-sharing": "^40.
|
|
41
|
+
"cozy-sharing": "^40.1.1",
|
|
42
42
|
"cozy-stack-client": "^60.21.1",
|
|
43
43
|
"cozy-ui": "^138.1.0",
|
|
44
44
|
"jest": "30.3.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"react-dom": "^16 || ^17 || ^18",
|
|
79
79
|
"twake-i18n": ">=0.3.0"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "e846871f99f90ba769173affd41b16d9bd134824"
|
|
82
82
|
}
|
|
@@ -12,15 +12,12 @@ const LOADED = 'LOADED'
|
|
|
12
12
|
const FAILED = 'FAILED'
|
|
13
13
|
const GET_LINK = 'GET_LINK'
|
|
14
14
|
|
|
15
|
-
import { EncryptedContext } from 'cozy-ui/transpiled/react/providers/Encrypted'
|
|
16
|
-
|
|
17
15
|
import { checkImageSource } from './checkImageSource'
|
|
18
16
|
|
|
19
17
|
export class FileImageLoader extends Component {
|
|
20
18
|
state = {
|
|
21
19
|
src: null
|
|
22
20
|
}
|
|
23
|
-
static contextType = EncryptedContext
|
|
24
21
|
_mounted = false
|
|
25
22
|
|
|
26
23
|
componentDidMount() {
|
|
@@ -161,9 +158,6 @@ export class FileImageLoader extends Component {
|
|
|
161
158
|
const { src } = this.state
|
|
162
159
|
|
|
163
160
|
const { render, renderFallback } = this.props
|
|
164
|
-
if (this.context && this.context.url) {
|
|
165
|
-
return render(this.context.url)
|
|
166
|
-
}
|
|
167
161
|
if (src) return render(src)
|
|
168
162
|
else if (renderFallback) return renderFallback()
|
|
169
163
|
else return null
|
|
@@ -3,7 +3,6 @@ import React from 'react'
|
|
|
3
3
|
|
|
4
4
|
import { createMockClient } from 'cozy-client'
|
|
5
5
|
import logger from 'cozy-logger'
|
|
6
|
-
import EncryptedProvider from 'cozy-ui/transpiled/react/providers/Encrypted'
|
|
7
6
|
|
|
8
7
|
import { FileImageLoader } from '.'
|
|
9
8
|
import { checkImageSource } from './checkImageSource'
|
|
@@ -38,26 +37,22 @@ const file = {
|
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
const setup = ({ file
|
|
40
|
+
const setup = ({ file }) => {
|
|
42
41
|
const root = render(
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
)}
|
|
58
|
-
client={client}
|
|
59
|
-
/>
|
|
60
|
-
</EncryptedProvider>
|
|
42
|
+
<FileImageLoader
|
|
43
|
+
file={file}
|
|
44
|
+
linkType="large"
|
|
45
|
+
key={file.id}
|
|
46
|
+
render={src => <img alt={file.name} src={src} data-testid="img_image" />}
|
|
47
|
+
renderFallback={() => (
|
|
48
|
+
<img
|
|
49
|
+
alt="render fallback"
|
|
50
|
+
src="http://url.img_image_render_fallback/"
|
|
51
|
+
data-testid="img_image_renderFallback"
|
|
52
|
+
/>
|
|
53
|
+
)}
|
|
54
|
+
client={client}
|
|
55
|
+
/>
|
|
61
56
|
)
|
|
62
57
|
|
|
63
58
|
return { root }
|
|
@@ -79,18 +74,6 @@ describe('FileImageLoader', () => {
|
|
|
79
74
|
expect(img.src).toEqual(file.links.large)
|
|
80
75
|
})
|
|
81
76
|
|
|
82
|
-
it('should use URL when set', async () => {
|
|
83
|
-
const url = 'blob:http://theimageblob'
|
|
84
|
-
const { root } = setup({ file, url })
|
|
85
|
-
const { getByTestId } = root
|
|
86
|
-
checkImageSource.mockResolvedValue('ok')
|
|
87
|
-
await waitFor(() => getByTestId('img_image'))
|
|
88
|
-
|
|
89
|
-
const img = getByTestId('img_image')
|
|
90
|
-
expect(img.src).toEqual(url)
|
|
91
|
-
expect(getMock).not.toHaveBeenCalled()
|
|
92
|
-
})
|
|
93
|
-
|
|
94
77
|
it('should makes a request to fetch links if the links is not right anymore', async () => {
|
|
95
78
|
const file = {
|
|
96
79
|
_id: 'image',
|