cozy-viewer 16.0.0 → 16.2.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 +22 -0
- package/dist/Panel/Qualifications/QualificationListItemContact.js +45 -1
- package/dist/Panel/Qualifications/QualificationListItemDate.js +45 -1
- package/dist/Panel/Qualifications/QualificationListItemInformation.js +48 -2
- package/dist/Panel/Qualifications/QualificationListItemOther.js +45 -1
- package/dist/providers/DemoProvider.js +3 -1
- package/package.json +3 -3
- package/src/Panel/Qualifications/QualificationListItemContact.jsx +15 -1
- package/src/Panel/Qualifications/QualificationListItemDate.jsx +10 -1
- package/src/Panel/Qualifications/QualificationListItemInformation.jsx +12 -3
- package/src/Panel/Qualifications/QualificationListItemOther.jsx +10 -1
- package/src/providers/DemoProvider.jsx +4 -1
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
|
+
# [16.2.0](https://github.com/cozy/cozy-libs/compare/cozy-viewer@16.1.0...cozy-viewer@16.2.0) (2025-01-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **Viewer:** Add copyToClipboard on qualification click ([ff1c7dd](https://github.com/cozy/cozy-libs/commit/ff1c7dd0a747ce25c2d09a102b6f0964f1f00ef3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [16.1.0](https://github.com/cozy/cozy-libs/compare/cozy-viewer@16.0.0...cozy-viewer@16.1.0) (2025-01-30)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **Viewer:** Change employer name qualification icon ([c97da4d](https://github.com/cozy/cozy-libs/commit/c97da4d5425e215d9f4bd558eeca6e7745ac8368))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [16.0.0](https://github.com/cozy/cozy-libs/compare/cozy-viewer@15.1.1...cozy-viewer@16.0.0) (2025-01-30)
|
|
7
29
|
|
|
8
30
|
|
|
@@ -7,12 +7,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
10
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
15
|
|
|
12
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
17
|
|
|
14
18
|
var _paper = require("cozy-client/dist/models/paper");
|
|
15
19
|
|
|
20
|
+
var _Actions = require("cozy-ui/transpiled/react/ActionsMenu/Actions");
|
|
21
|
+
|
|
16
22
|
var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
|
|
17
23
|
|
|
18
24
|
var _IconButton = _interopRequireDefault(require("cozy-ui/transpiled/react/IconButton"));
|
|
@@ -29,6 +35,8 @@ var _ListItemSecondaryAction = _interopRequireDefault(require("cozy-ui/transpile
|
|
|
29
35
|
|
|
30
36
|
var _Spinner = _interopRequireDefault(require("cozy-ui/transpiled/react/Spinner"));
|
|
31
37
|
|
|
38
|
+
var _Alert = require("cozy-ui/transpiled/react/providers/Alert");
|
|
39
|
+
|
|
32
40
|
var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
|
|
33
41
|
|
|
34
42
|
var _QualificationListItemText = _interopRequireDefault(require("./QualificationListItemText"));
|
|
@@ -53,6 +61,9 @@ var QualificationListItemContact = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
53
61
|
contacts = _useReferencedContact.contacts,
|
|
54
62
|
isLoadingContacts = _useReferencedContact.isLoadingContacts;
|
|
55
63
|
|
|
64
|
+
var _useAlert = (0, _Alert.useAlert)(),
|
|
65
|
+
showAlert = _useAlert.showAlert;
|
|
66
|
+
|
|
56
67
|
if (isLoadingContacts) {
|
|
57
68
|
return /*#__PURE__*/_react.default.createElement(_ListItem.default, null, /*#__PURE__*/_react.default.createElement(_Spinner.default, {
|
|
58
69
|
color: "var(--secondaryTextColor)"
|
|
@@ -69,6 +80,38 @@ var QualificationListItemContact = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
69
80
|
lang: lang
|
|
70
81
|
});
|
|
71
82
|
var qualificationLabel = file.metadata.qualification.label;
|
|
83
|
+
|
|
84
|
+
var handleClick = /*#__PURE__*/function () {
|
|
85
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
86
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
87
|
+
while (1) switch (_context.prev = _context.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
if (formattedValue) {
|
|
90
|
+
_context.next = 2;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return _context.abrupt("return");
|
|
95
|
+
|
|
96
|
+
case 2:
|
|
97
|
+
_context.next = 4;
|
|
98
|
+
return (0, _Actions.copyToClipboard)().action(undefined, {
|
|
99
|
+
showAlert: showAlert,
|
|
100
|
+
copyValue: formattedValue
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
case 4:
|
|
104
|
+
case "end":
|
|
105
|
+
return _context.stop();
|
|
106
|
+
}
|
|
107
|
+
}, _callee);
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
return function handleClick() {
|
|
111
|
+
return _ref2.apply(this, arguments);
|
|
112
|
+
};
|
|
113
|
+
}();
|
|
114
|
+
|
|
72
115
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_IntentOpener.default, {
|
|
73
116
|
action: "OPEN",
|
|
74
117
|
doctype: "io.cozy.files.paper",
|
|
@@ -77,7 +120,8 @@ var QualificationListItemContact = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
77
120
|
},
|
|
78
121
|
disabled: !!formattedValue || isReadOnly
|
|
79
122
|
}, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
|
|
80
|
-
button:
|
|
123
|
+
button: !!formattedValue || !isReadOnly,
|
|
124
|
+
onClick: handleClick
|
|
81
125
|
}, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
82
126
|
icon: _People.default
|
|
83
127
|
})), /*#__PURE__*/_react.default.createElement(_QualificationListItemText.default, {
|
|
@@ -7,12 +7,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
10
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
15
|
|
|
12
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
17
|
|
|
14
18
|
var _paper = require("cozy-client/dist/models/paper");
|
|
15
19
|
|
|
20
|
+
var _Actions = require("cozy-ui/transpiled/react/ActionsMenu/Actions");
|
|
21
|
+
|
|
16
22
|
var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
|
|
17
23
|
|
|
18
24
|
var _IconButton = _interopRequireDefault(require("cozy-ui/transpiled/react/IconButton"));
|
|
@@ -31,6 +37,8 @@ var _ListItemSecondaryAction = _interopRequireDefault(require("cozy-ui/transpile
|
|
|
31
37
|
|
|
32
38
|
var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
|
|
33
39
|
|
|
40
|
+
var _Alert = require("cozy-ui/transpiled/react/providers/Alert");
|
|
41
|
+
|
|
34
42
|
var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
|
|
35
43
|
|
|
36
44
|
var _QualificationListItemText = _interopRequireDefault(require("./QualificationListItemText"));
|
|
@@ -53,6 +61,9 @@ var QualificationListItemDate = /*#__PURE__*/(0, _react.forwardRef)(function (_r
|
|
|
53
61
|
f = _useI18n.f,
|
|
54
62
|
lang = _useI18n.lang;
|
|
55
63
|
|
|
64
|
+
var _useAlert = (0, _Alert.useAlert)(),
|
|
65
|
+
showAlert = _useAlert.showAlert;
|
|
66
|
+
|
|
56
67
|
var name = formattedMetadataQualification.name,
|
|
57
68
|
value = formattedMetadataQualification.value;
|
|
58
69
|
var qualificationLabel = file.metadata.qualification.label;
|
|
@@ -64,6 +75,38 @@ var QualificationListItemDate = /*#__PURE__*/(0, _react.forwardRef)(function (_r
|
|
|
64
75
|
lang: lang
|
|
65
76
|
});
|
|
66
77
|
var isExpirationDate = name === 'expirationDate';
|
|
78
|
+
|
|
79
|
+
var handleClick = /*#__PURE__*/function () {
|
|
80
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
81
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
82
|
+
while (1) switch (_context.prev = _context.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
if (value) {
|
|
85
|
+
_context.next = 2;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return _context.abrupt("return");
|
|
90
|
+
|
|
91
|
+
case 2:
|
|
92
|
+
_context.next = 4;
|
|
93
|
+
return (0, _Actions.copyToClipboard)().action(undefined, {
|
|
94
|
+
showAlert: showAlert,
|
|
95
|
+
copyValue: value
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
case 4:
|
|
99
|
+
case "end":
|
|
100
|
+
return _context.stop();
|
|
101
|
+
}
|
|
102
|
+
}, _callee);
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
return function handleClick() {
|
|
106
|
+
return _ref2.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}();
|
|
109
|
+
|
|
67
110
|
return /*#__PURE__*/_react.default.createElement(_IntentOpener.default, {
|
|
68
111
|
action: "OPEN",
|
|
69
112
|
doctype: "io.cozy.files.paper",
|
|
@@ -72,7 +115,8 @@ var QualificationListItemDate = /*#__PURE__*/(0, _react.forwardRef)(function (_r
|
|
|
72
115
|
},
|
|
73
116
|
disabled: !!value || isReadOnly
|
|
74
117
|
}, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
|
|
75
|
-
button:
|
|
118
|
+
button: !!value || !isReadOnly,
|
|
119
|
+
onClick: handleClick
|
|
76
120
|
}, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
77
121
|
icon: _Calendar.default
|
|
78
122
|
})), /*#__PURE__*/_react.default.createElement(_QualificationListItemText.default, {
|
|
@@ -7,18 +7,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
10
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
15
|
|
|
12
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
17
|
|
|
14
18
|
var _paper = require("cozy-client/dist/models/paper");
|
|
15
19
|
|
|
20
|
+
var _Actions = require("cozy-ui/transpiled/react/ActionsMenu/Actions");
|
|
21
|
+
|
|
16
22
|
var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
|
|
17
23
|
|
|
18
24
|
var _IconButton = _interopRequireDefault(require("cozy-ui/transpiled/react/IconButton"));
|
|
19
25
|
|
|
20
26
|
var _Bell = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Bell"));
|
|
21
27
|
|
|
28
|
+
var _Company = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Company"));
|
|
29
|
+
|
|
22
30
|
var _Contract = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Contract"));
|
|
23
31
|
|
|
24
32
|
var _Dots = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Dots"));
|
|
@@ -39,6 +47,8 @@ var _ListItemSecondaryAction = _interopRequireDefault(require("cozy-ui/transpile
|
|
|
39
47
|
|
|
40
48
|
var _MidEllipsis = _interopRequireDefault(require("cozy-ui/transpiled/react/MidEllipsis"));
|
|
41
49
|
|
|
50
|
+
var _Alert = require("cozy-ui/transpiled/react/providers/Alert");
|
|
51
|
+
|
|
42
52
|
var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
|
|
43
53
|
|
|
44
54
|
var _QualificationListItemText = _interopRequireDefault(require("./QualificationListItemText"));
|
|
@@ -49,7 +59,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
49
59
|
|
|
50
60
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
51
61
|
|
|
52
|
-
var KNOWN_INFORMATION_METADATA_ICONS = [_Number.default, _Number.default, _Globe.default, _Euro.default, _Contract.default, _Euro.default,
|
|
62
|
+
var KNOWN_INFORMATION_METADATA_ICONS = [_Number.default, _Number.default, _Globe.default, _Euro.default, _Contract.default, _Euro.default, _Company.default, _Number.default, _Number.default, _Bell.default];
|
|
53
63
|
|
|
54
64
|
var makeInformationMetadataIcon = function makeInformationMetadataIcon(name) {
|
|
55
65
|
return KNOWN_INFORMATION_METADATA_ICONS[_paper.KNOWN_INFORMATION_METADATA_NAMES.findIndex(function (el) {
|
|
@@ -66,6 +76,9 @@ var QualificationListItemInformation = /*#__PURE__*/(0, _react.forwardRef)(funct
|
|
|
66
76
|
var _useI18n = (0, _I18n.useI18n)(),
|
|
67
77
|
lang = _useI18n.lang;
|
|
68
78
|
|
|
79
|
+
var _useAlert = (0, _Alert.useAlert)(),
|
|
80
|
+
showAlert = _useAlert.showAlert;
|
|
81
|
+
|
|
69
82
|
var name = formattedMetadataQualification.name,
|
|
70
83
|
value = formattedMetadataQualification.value;
|
|
71
84
|
var qualificationLabel = file.metadata.qualification.label;
|
|
@@ -82,6 +95,38 @@ var QualificationListItemInformation = /*#__PURE__*/(0, _react.forwardRef)(funct
|
|
|
82
95
|
var titleComponent = formattedTitle === name ? /*#__PURE__*/_react.default.createElement(_MidEllipsis.default, {
|
|
83
96
|
text: name
|
|
84
97
|
}) : formattedTitle;
|
|
98
|
+
|
|
99
|
+
var handleClick = /*#__PURE__*/function () {
|
|
100
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
101
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
102
|
+
while (1) switch (_context.prev = _context.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
if (value) {
|
|
105
|
+
_context.next = 2;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return _context.abrupt("return");
|
|
110
|
+
|
|
111
|
+
case 2:
|
|
112
|
+
_context.next = 4;
|
|
113
|
+
return (0, _Actions.copyToClipboard)().action(undefined, {
|
|
114
|
+
showAlert: showAlert,
|
|
115
|
+
copyValue: value
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
case 4:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
return function handleClick() {
|
|
126
|
+
return _ref2.apply(this, arguments);
|
|
127
|
+
};
|
|
128
|
+
}();
|
|
129
|
+
|
|
85
130
|
return /*#__PURE__*/_react.default.createElement(_IntentOpener.default, {
|
|
86
131
|
action: "OPEN",
|
|
87
132
|
doctype: "io.cozy.files.paper",
|
|
@@ -90,7 +135,8 @@ var QualificationListItemInformation = /*#__PURE__*/(0, _react.forwardRef)(funct
|
|
|
90
135
|
},
|
|
91
136
|
disabled: !!value || isReadOnly
|
|
92
137
|
}, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
|
|
93
|
-
button:
|
|
138
|
+
button: !!value || !isReadOnly,
|
|
139
|
+
onClick: handleClick
|
|
94
140
|
}, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
95
141
|
icon: InformationIcon
|
|
96
142
|
})), /*#__PURE__*/_react.default.createElement(_QualificationListItemText.default, {
|
|
@@ -7,12 +7,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
10
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
15
|
|
|
12
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
17
|
|
|
14
18
|
var _paper = require("cozy-client/dist/models/paper");
|
|
15
19
|
|
|
20
|
+
var _Actions = require("cozy-ui/transpiled/react/ActionsMenu/Actions");
|
|
21
|
+
|
|
16
22
|
var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
|
|
17
23
|
|
|
18
24
|
var _IconButton = _interopRequireDefault(require("cozy-ui/transpiled/react/IconButton"));
|
|
@@ -31,6 +37,8 @@ var _ListItemSecondaryAction = _interopRequireDefault(require("cozy-ui/transpile
|
|
|
31
37
|
|
|
32
38
|
var _MidEllipsis = _interopRequireDefault(require("cozy-ui/transpiled/react/MidEllipsis"));
|
|
33
39
|
|
|
40
|
+
var _Alert = require("cozy-ui/transpiled/react/providers/Alert");
|
|
41
|
+
|
|
34
42
|
var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
|
|
35
43
|
|
|
36
44
|
var _QualificationListItemText = _interopRequireDefault(require("./QualificationListItemText"));
|
|
@@ -50,6 +58,9 @@ var QualificationListItemOther = /*#__PURE__*/(0, _react.forwardRef)(function (_
|
|
|
50
58
|
var _useI18n = (0, _I18n.useI18n)(),
|
|
51
59
|
lang = _useI18n.lang;
|
|
52
60
|
|
|
61
|
+
var _useAlert = (0, _Alert.useAlert)(),
|
|
62
|
+
showAlert = _useAlert.showAlert;
|
|
63
|
+
|
|
53
64
|
var name = formattedMetadataQualification.name,
|
|
54
65
|
value = formattedMetadataQualification.value;
|
|
55
66
|
var qualificationLabel = file.metadata.qualification.label;
|
|
@@ -61,6 +72,38 @@ var QualificationListItemOther = /*#__PURE__*/(0, _react.forwardRef)(function (_
|
|
|
61
72
|
lang: lang,
|
|
62
73
|
name: name
|
|
63
74
|
});
|
|
75
|
+
|
|
76
|
+
var handleClick = /*#__PURE__*/function () {
|
|
77
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
78
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
79
|
+
while (1) switch (_context.prev = _context.next) {
|
|
80
|
+
case 0:
|
|
81
|
+
if (value) {
|
|
82
|
+
_context.next = 2;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return _context.abrupt("return");
|
|
87
|
+
|
|
88
|
+
case 2:
|
|
89
|
+
_context.next = 4;
|
|
90
|
+
return (0, _Actions.copyToClipboard)().action(undefined, {
|
|
91
|
+
showAlert: showAlert,
|
|
92
|
+
copyValue: value
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
case 4:
|
|
96
|
+
case "end":
|
|
97
|
+
return _context.stop();
|
|
98
|
+
}
|
|
99
|
+
}, _callee);
|
|
100
|
+
}));
|
|
101
|
+
|
|
102
|
+
return function handleClick() {
|
|
103
|
+
return _ref2.apply(this, arguments);
|
|
104
|
+
};
|
|
105
|
+
}();
|
|
106
|
+
|
|
64
107
|
return /*#__PURE__*/_react.default.createElement(_IntentOpener.default, {
|
|
65
108
|
action: "OPEN",
|
|
66
109
|
doctype: "io.cozy.files.paper",
|
|
@@ -69,7 +112,8 @@ var QualificationListItemOther = /*#__PURE__*/(0, _react.forwardRef)(function (_
|
|
|
69
112
|
},
|
|
70
113
|
disabled: !!value || isReadOnly
|
|
71
114
|
}, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
|
|
72
|
-
button:
|
|
115
|
+
button: !!value || !isReadOnly,
|
|
116
|
+
onClick: handleClick
|
|
73
117
|
}, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
74
118
|
icon: _File.default
|
|
75
119
|
})), /*#__PURE__*/_react.default.createElement(_QualificationListItemText.default, {
|
|
@@ -13,6 +13,8 @@ var _cozyClient = require("cozy-client");
|
|
|
13
13
|
|
|
14
14
|
var _cloudWallpaper = _interopRequireDefault(require("cozy-ui/docs/cloud-wallpaper.jpg"));
|
|
15
15
|
|
|
16
|
+
var _Alert = _interopRequireDefault(require("cozy-ui/transpiled/react/providers/Alert"));
|
|
17
|
+
|
|
16
18
|
var _Breakpoints = require("cozy-ui/transpiled/react/providers/Breakpoints");
|
|
17
19
|
|
|
18
20
|
var _I18n = _interopRequireDefault(require("cozy-ui/transpiled/react/providers/I18n"));
|
|
@@ -158,7 +160,7 @@ var DemoProvider = function DemoProvider(_ref2) {
|
|
|
158
160
|
return _index.locales[lang];
|
|
159
161
|
},
|
|
160
162
|
lang: lang
|
|
161
|
-
}, /*#__PURE__*/_react.default.createElement(Wrapper, wrapperProps, children))));
|
|
163
|
+
}, /*#__PURE__*/_react.default.createElement(_Alert.default, null, /*#__PURE__*/_react.default.createElement(Wrapper, wrapperProps, children)))));
|
|
162
164
|
};
|
|
163
165
|
|
|
164
166
|
var _default = exports.default = DemoProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-viewer",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.2.0",
|
|
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": "^53.1.1",
|
|
29
29
|
"cozy-device-helper": "2.0.0",
|
|
30
|
-
"cozy-harvest-lib": "^32.2.
|
|
30
|
+
"cozy-harvest-lib": "^32.2.29",
|
|
31
31
|
"cozy-intent": "^2.29.2",
|
|
32
32
|
"cozy-logger": "^1.16.1",
|
|
33
33
|
"cozy-sharing": "^21.2.1",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react": ">=16.12.0",
|
|
60
60
|
"react-dom": ">=16.12.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "08cc3fb1a28d3edc9411f4f0292fc04a131bc402"
|
|
63
63
|
}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
getTranslatedNameForContact,
|
|
6
6
|
formatContactValue
|
|
7
7
|
} from 'cozy-client/dist/models/paper'
|
|
8
|
+
import { copyToClipboard } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
8
9
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
9
10
|
import IconButton from 'cozy-ui/transpiled/react/IconButton'
|
|
10
11
|
import Dots from 'cozy-ui/transpiled/react/Icons/Dots'
|
|
@@ -13,6 +14,7 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
|
13
14
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
14
15
|
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/ListItemSecondaryAction'
|
|
15
16
|
import Spinner from 'cozy-ui/transpiled/react/Spinner'
|
|
17
|
+
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
16
18
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
17
19
|
|
|
18
20
|
import QualificationListItemText from './QualificationListItemText'
|
|
@@ -23,6 +25,7 @@ const QualificationListItemContact = forwardRef(
|
|
|
23
25
|
({ file, isReadOnly, toggleActionsMenu }, ref) => {
|
|
24
26
|
const { lang } = useI18n()
|
|
25
27
|
const { contacts, isLoadingContacts } = useReferencedContactName(file)
|
|
28
|
+
const { showAlert } = useAlert()
|
|
26
29
|
|
|
27
30
|
if (isLoadingContacts) {
|
|
28
31
|
return (
|
|
@@ -41,6 +44,14 @@ const QualificationListItemContact = forwardRef(
|
|
|
41
44
|
const formattedTitle = getTranslatedNameForContact({ lang })
|
|
42
45
|
const qualificationLabel = file.metadata.qualification.label
|
|
43
46
|
|
|
47
|
+
const handleClick = async () => {
|
|
48
|
+
if (!formattedValue) return
|
|
49
|
+
await copyToClipboard().action(undefined, {
|
|
50
|
+
showAlert,
|
|
51
|
+
copyValue: formattedValue
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
return (
|
|
45
56
|
<>
|
|
46
57
|
<IntentOpener
|
|
@@ -51,7 +62,10 @@ const QualificationListItemContact = forwardRef(
|
|
|
51
62
|
}}
|
|
52
63
|
disabled={!!formattedValue || isReadOnly}
|
|
53
64
|
>
|
|
54
|
-
<ListItem
|
|
65
|
+
<ListItem
|
|
66
|
+
button={!!formattedValue || !isReadOnly}
|
|
67
|
+
onClick={handleClick}
|
|
68
|
+
>
|
|
55
69
|
<ListItemIcon>
|
|
56
70
|
<Icon icon={PeopleIcon} />
|
|
57
71
|
</ListItemIcon>
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getTranslatedNameForDateMetadata,
|
|
8
8
|
formatDateMetadataValue
|
|
9
9
|
} from 'cozy-client/dist/models/paper'
|
|
10
|
+
import { copyToClipboard } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
10
11
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
11
12
|
import IconButton from 'cozy-ui/transpiled/react/IconButton'
|
|
12
13
|
import CalendarIcon from 'cozy-ui/transpiled/react/Icons/Calendar'
|
|
@@ -16,6 +17,7 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
|
16
17
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
17
18
|
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/ListItemSecondaryAction'
|
|
18
19
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
20
|
+
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
19
21
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
20
22
|
|
|
21
23
|
import QualificationListItemText from './QualificationListItemText'
|
|
@@ -28,6 +30,8 @@ const QualificationListItemDate = forwardRef(
|
|
|
28
30
|
ref
|
|
29
31
|
) => {
|
|
30
32
|
const { f, lang } = useI18n()
|
|
33
|
+
const { showAlert } = useAlert()
|
|
34
|
+
|
|
31
35
|
const { name, value } = formattedMetadataQualification
|
|
32
36
|
const qualificationLabel = file.metadata.qualification.label
|
|
33
37
|
const formattedTitle = getTranslatedNameForDateMetadata(name, { lang })
|
|
@@ -37,6 +41,11 @@ const QualificationListItemDate = forwardRef(
|
|
|
37
41
|
})
|
|
38
42
|
const isExpirationDate = name === 'expirationDate'
|
|
39
43
|
|
|
44
|
+
const handleClick = async () => {
|
|
45
|
+
if (!value) return
|
|
46
|
+
await copyToClipboard().action(undefined, { showAlert, copyValue: value })
|
|
47
|
+
}
|
|
48
|
+
|
|
40
49
|
return (
|
|
41
50
|
<IntentOpener
|
|
42
51
|
action="OPEN"
|
|
@@ -46,7 +55,7 @@ const QualificationListItemDate = forwardRef(
|
|
|
46
55
|
}}
|
|
47
56
|
disabled={!!value || isReadOnly}
|
|
48
57
|
>
|
|
49
|
-
<ListItem button={
|
|
58
|
+
<ListItem button={!!value || !isReadOnly} onClick={handleClick}>
|
|
50
59
|
<ListItemIcon>
|
|
51
60
|
<Icon icon={CalendarIcon} />
|
|
52
61
|
</ListItemIcon>
|
|
@@ -6,9 +6,11 @@ import {
|
|
|
6
6
|
formatInformationMetadataValue,
|
|
7
7
|
KNOWN_INFORMATION_METADATA_NAMES
|
|
8
8
|
} from 'cozy-client/dist/models/paper'
|
|
9
|
+
import { copyToClipboard } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
9
10
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
10
11
|
import IconButton from 'cozy-ui/transpiled/react/IconButton'
|
|
11
12
|
import BellIcon from 'cozy-ui/transpiled/react/Icons/Bell'
|
|
13
|
+
import CompanyIcon from 'cozy-ui/transpiled/react/Icons/Company'
|
|
12
14
|
import ContractIcon from 'cozy-ui/transpiled/react/Icons/Contract'
|
|
13
15
|
import Dots from 'cozy-ui/transpiled/react/Icons/Dots'
|
|
14
16
|
import EuroIcon from 'cozy-ui/transpiled/react/Icons/Euro'
|
|
@@ -19,11 +21,11 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
|
19
21
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
20
22
|
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/ListItemSecondaryAction'
|
|
21
23
|
import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis'
|
|
24
|
+
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
22
25
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
23
26
|
|
|
24
27
|
import QualificationListItemText from './QualificationListItemText'
|
|
25
28
|
import IntentOpener from '../../components/IntentOpener'
|
|
26
|
-
|
|
27
29
|
const KNOWN_INFORMATION_METADATA_ICONS = [
|
|
28
30
|
NumberIcon,
|
|
29
31
|
NumberIcon,
|
|
@@ -31,7 +33,7 @@ const KNOWN_INFORMATION_METADATA_ICONS = [
|
|
|
31
33
|
EuroIcon,
|
|
32
34
|
ContractIcon,
|
|
33
35
|
EuroIcon,
|
|
34
|
-
|
|
36
|
+
CompanyIcon,
|
|
35
37
|
NumberIcon,
|
|
36
38
|
NumberIcon,
|
|
37
39
|
BellIcon
|
|
@@ -48,6 +50,8 @@ const QualificationListItemInformation = forwardRef(
|
|
|
48
50
|
ref
|
|
49
51
|
) => {
|
|
50
52
|
const { lang } = useI18n()
|
|
53
|
+
const { showAlert } = useAlert()
|
|
54
|
+
|
|
51
55
|
const { name, value } = formattedMetadataQualification
|
|
52
56
|
const qualificationLabel = file.metadata.qualification.label
|
|
53
57
|
|
|
@@ -65,6 +69,11 @@ const QualificationListItemInformation = forwardRef(
|
|
|
65
69
|
const titleComponent =
|
|
66
70
|
formattedTitle === name ? <MidEllipsis text={name} /> : formattedTitle
|
|
67
71
|
|
|
72
|
+
const handleClick = async () => {
|
|
73
|
+
if (!value) return
|
|
74
|
+
await copyToClipboard().action(undefined, { showAlert, copyValue: value })
|
|
75
|
+
}
|
|
76
|
+
|
|
68
77
|
return (
|
|
69
78
|
<IntentOpener
|
|
70
79
|
action="OPEN"
|
|
@@ -74,7 +83,7 @@ const QualificationListItemInformation = forwardRef(
|
|
|
74
83
|
}}
|
|
75
84
|
disabled={!!value || isReadOnly}
|
|
76
85
|
>
|
|
77
|
-
<ListItem button={
|
|
86
|
+
<ListItem button={!!value || !isReadOnly} onClick={handleClick}>
|
|
78
87
|
<ListItemIcon>
|
|
79
88
|
<Icon icon={InformationIcon} />
|
|
80
89
|
</ListItemIcon>
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
getTranslatedNameForOtherMetadata,
|
|
6
6
|
formatOtherMetadataValue
|
|
7
7
|
} from 'cozy-client/dist/models/paper'
|
|
8
|
+
import { copyToClipboard } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
8
9
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
9
10
|
import IconButton from 'cozy-ui/transpiled/react/IconButton'
|
|
10
11
|
import Dots from 'cozy-ui/transpiled/react/Icons/Dots'
|
|
@@ -14,6 +15,7 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
|
14
15
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
15
16
|
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/ListItemSecondaryAction'
|
|
16
17
|
import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis'
|
|
18
|
+
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
17
19
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
18
20
|
|
|
19
21
|
import QualificationListItemText from './QualificationListItemText'
|
|
@@ -25,6 +27,8 @@ const QualificationListItemOther = forwardRef(
|
|
|
25
27
|
ref
|
|
26
28
|
) => {
|
|
27
29
|
const { lang } = useI18n()
|
|
30
|
+
const { showAlert } = useAlert()
|
|
31
|
+
|
|
28
32
|
const { name, value } = formattedMetadataQualification
|
|
29
33
|
const qualificationLabel = file.metadata.qualification.label
|
|
30
34
|
|
|
@@ -38,6 +42,11 @@ const QualificationListItemOther = forwardRef(
|
|
|
38
42
|
name
|
|
39
43
|
})
|
|
40
44
|
|
|
45
|
+
const handleClick = async () => {
|
|
46
|
+
if (!value) return
|
|
47
|
+
await copyToClipboard().action(undefined, { showAlert, copyValue: value })
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
return (
|
|
42
51
|
<IntentOpener
|
|
43
52
|
action="OPEN"
|
|
@@ -47,7 +56,7 @@ const QualificationListItemOther = forwardRef(
|
|
|
47
56
|
}}
|
|
48
57
|
disabled={!!value || isReadOnly}
|
|
49
58
|
>
|
|
50
|
-
<ListItem button={
|
|
59
|
+
<ListItem button={!!value || !isReadOnly} onClick={handleClick}>
|
|
51
60
|
<ListItemIcon>
|
|
52
61
|
<Icon icon={FileIcon} />
|
|
53
62
|
</ListItemIcon>
|
|
@@ -2,6 +2,7 @@ import React, { Fragment } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { CozyProvider } from 'cozy-client'
|
|
4
4
|
import CloudWallpaper from 'cozy-ui/docs/cloud-wallpaper.jpg'
|
|
5
|
+
import AlertProvider from 'cozy-ui/transpiled/react/providers/Alert'
|
|
5
6
|
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
6
7
|
import I18n from 'cozy-ui/transpiled/react/providers/I18n'
|
|
7
8
|
|
|
@@ -102,7 +103,9 @@ const DemoProvider = ({
|
|
|
102
103
|
<CozyProvider client={mockClient}>
|
|
103
104
|
<BreakpointsProvider>
|
|
104
105
|
<I18n dictRequire={lang => locales[lang]} lang={lang}>
|
|
105
|
-
<
|
|
106
|
+
<AlertProvider>
|
|
107
|
+
<Wrapper {...wrapperProps}>{children}</Wrapper>
|
|
108
|
+
</AlertProvider>
|
|
106
109
|
</I18n>
|
|
107
110
|
</BreakpointsProvider>
|
|
108
111
|
</CozyProvider>
|