cozy-ui 111.20.0 → 112.0.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 +21 -0
- package/package.json +3 -2
- package/react/FileImageLoader/Readme.md +66 -3
- package/react/FileImageLoader/index.jsx +3 -3
- package/react/FileImageLoader/index.spec.jsx +1 -1
- package/react/Skeletons/ListItemSkeleton.jsx +4 -3
- package/react/Skeletons/Readme.md +12 -3
- package/react/hooks/useClientErrors.jsx +140 -0
- package/react/hooks/useClientErrors.spec.jsx +102 -0
- package/react/index.js +0 -1
- package/transpiled/react/FileImageLoader/index.js +3 -3
- package/transpiled/react/Skeletons/ListItemSkeleton.js +7 -3
- package/transpiled/react/hooks/useClientErrors.js +167 -0
- package/transpiled/react/index.js +0 -1
- package/transpiled/react/stylesheet.css +1 -1
- package/react/Viewer/Footer/BottomSheetContent.jsx +0 -29
- package/react/Viewer/Footer/DownloadButton.jsx +0 -67
- package/react/Viewer/Footer/FooterActionButtons.jsx +0 -22
- package/react/Viewer/Footer/FooterActionButtons.spec.jsx +0 -30
- package/react/Viewer/Footer/FooterContent.jsx +0 -99
- package/react/Viewer/Footer/ForwardButton.jsx +0 -95
- package/react/Viewer/Footer/ForwardButton.spec.jsx +0 -87
- package/react/Viewer/Footer/ForwardOrDownloadButton.jsx +0 -24
- package/react/Viewer/Footer/Sharing.jsx +0 -60
- package/react/Viewer/Footer/helpers.js +0 -107
- package/react/Viewer/Footer/helpers.spec.js +0 -77
- package/react/Viewer/NoViewer/DownloadButton.jsx +0 -28
- package/react/Viewer/NoViewer/FileIcon.jsx +0 -46
- package/react/Viewer/NoViewer/NoViewer.jsx +0 -29
- package/react/Viewer/NoViewer/NoViewer.spec.jsx +0 -44
- package/react/Viewer/NoViewer/__snapshots__/NoViewer.spec.jsx.snap +0 -82
- package/react/Viewer/NoViewer/index.jsx +0 -1
- package/react/Viewer/Panel/ActionMenuDesktop.jsx +0 -66
- package/react/Viewer/Panel/ActionMenuMobile.jsx +0 -74
- package/react/Viewer/Panel/ActionMenuWrapper.jsx +0 -104
- package/react/Viewer/Panel/Certifications.jsx +0 -62
- package/react/Viewer/Panel/PanelContent.jsx +0 -49
- package/react/Viewer/Panel/Qualification.jsx +0 -114
- package/react/Viewer/Panel/QualificationListItemContact.jsx +0 -85
- package/react/Viewer/Panel/QualificationListItemDate.jsx +0 -77
- package/react/Viewer/Panel/QualificationListItemInformation.jsx +0 -68
- package/react/Viewer/Panel/QualificationListItemInformation.spec.jsx +0 -73
- package/react/Viewer/Panel/QualificationListItemOther.jsx +0 -61
- package/react/Viewer/Panel/QualificationListItemText.jsx +0 -30
- package/react/Viewer/Panel/getPanelBlocks.jsx +0 -56
- package/react/Viewer/Panel/getPanelBlocks.spec.jsx +0 -79
- package/react/Viewer/Panel/styles.styl +0 -13
- package/react/Viewer/Readme.md +0 -352
- package/react/Viewer/Viewer.jsx +0 -134
- package/react/Viewer/ViewerContainer.jsx +0 -169
- package/react/Viewer/ViewerExposer.js +0 -3
- package/react/Viewer/ViewerInformationsWrapper.jsx +0 -69
- package/react/Viewer/ViewerInformationsWrapper.spec.jsx +0 -63
- package/react/Viewer/ViewerWithCustomPanelAndFooter.jsx +0 -55
- package/react/Viewer/ViewersByFile/AudioViewer.jsx +0 -21
- package/react/Viewer/ViewersByFile/AudioViewer.spec.jsx +0 -39
- package/react/Viewer/ViewersByFile/BlankPaperViewer.jsx +0 -46
- package/react/Viewer/ViewersByFile/ImageViewer.jsx +0 -330
- package/react/Viewer/ViewersByFile/ImageViewer.spec.jsx +0 -70
- package/react/Viewer/ViewersByFile/NoNetworkViewer.jsx +0 -17
- package/react/Viewer/ViewersByFile/OnlyOfficeViewer.jsx +0 -28
- package/react/Viewer/ViewersByFile/PdfJsViewer.jsx +0 -210
- package/react/Viewer/ViewersByFile/PdfJsViewer.spec.jsx +0 -160
- package/react/Viewer/ViewersByFile/PdfMobileViewer.jsx +0 -106
- package/react/Viewer/ViewersByFile/PdfMobileViewer.spec.jsx +0 -76
- package/react/Viewer/ViewersByFile/ShortcutViewer.jsx +0 -38
- package/react/Viewer/ViewersByFile/ShortcutViewer.spec.jsx +0 -32
- package/react/Viewer/ViewersByFile/TextViewer.jsx +0 -126
- package/react/Viewer/ViewersByFile/TextViewer.spec.jsx +0 -118
- package/react/Viewer/ViewersByFile/VideoViewer.jsx +0 -13
- package/react/Viewer/ViewersByFile/VideoViewer.spec.jsx +0 -39
- package/react/Viewer/ViewersByFile/__snapshots__/AudioViewer.spec.jsx.snap +0 -43
- package/react/Viewer/ViewersByFile/__snapshots__/ShortcutViewer.spec.jsx.snap +0 -57
- package/react/Viewer/ViewersByFile/__snapshots__/TextViewer.spec.jsx.snap +0 -100
- package/react/Viewer/ViewersByFile/__snapshots__/VideoViewer.spec.jsx.snap +0 -19
- package/react/Viewer/ViewersByFile/styles.styl +0 -87
- package/react/Viewer/assets/IlluGenericNewPage.svg +0 -10
- package/react/Viewer/components/ExpirationAlert.jsx +0 -86
- package/react/Viewer/components/ExpirationAnnotation.jsx +0 -40
- package/react/Viewer/components/Footer.jsx +0 -13
- package/react/Viewer/components/InformationPanel.jsx +0 -26
- package/react/Viewer/components/Navigation.jsx +0 -39
- package/react/Viewer/components/PdfToolbarButton.jsx +0 -26
- package/react/Viewer/components/PrintButton.jsx +0 -90
- package/react/Viewer/components/Toolbar.jsx +0 -111
- package/react/Viewer/components/ToolbarButtons.jsx +0 -11
- package/react/Viewer/components/ToolbarFilePath.jsx +0 -61
- package/react/Viewer/components/ViewerByFile.jsx +0 -112
- package/react/Viewer/components/ViewerByFile.spec.jsx +0 -100
- package/react/Viewer/components/ViewerControls.jsx +0 -190
- package/react/Viewer/components/ViewerControls.spec.jsx +0 -54
- package/react/Viewer/components/ViewerSpinner.jsx +0 -17
- package/react/Viewer/components/styles.styl +0 -93
- package/react/Viewer/helpers.js +0 -131
- package/react/Viewer/helpers.spec.js +0 -136
- package/react/Viewer/hoc/withFileUrl.jsx +0 -93
- package/react/Viewer/hoc/withViewerLocales.jsx +0 -4
- package/react/Viewer/hooks/useReferencedContactName.jsx +0 -26
- package/react/Viewer/index.jsx +0 -12
- package/react/Viewer/locales/en.json +0 -66
- package/react/Viewer/locales/fr.json +0 -66
- package/react/Viewer/locales/index.js +0 -4
- package/react/Viewer/proptypes.js +0 -12
- package/react/Viewer/providers/ActionMenuProvider.jsx +0 -35
- package/react/Viewer/queries.js +0 -20
- package/react/Viewer/styles.styl +0 -22
- package/react/Viewer/vars.styl +0 -6
- package/transpiled/react/Viewer/Footer/BottomSheetContent.js +0 -28
- package/transpiled/react/Viewer/Footer/DownloadButton.js +0 -91
- package/transpiled/react/Viewer/Footer/FooterActionButtons.js +0 -21
- package/transpiled/react/Viewer/Footer/FooterContent.js +0 -98
- package/transpiled/react/Viewer/Footer/ForwardButton.js +0 -143
- package/transpiled/react/Viewer/Footer/ForwardOrDownloadButton.js +0 -25
- package/transpiled/react/Viewer/Footer/Sharing.js +0 -57
- package/transpiled/react/Viewer/Footer/helpers.js +0 -151
- package/transpiled/react/Viewer/NoViewer/DownloadButton.js +0 -34
- package/transpiled/react/Viewer/NoViewer/FileIcon.js +0 -57
- package/transpiled/react/Viewer/NoViewer/NoViewer.js +0 -49
- package/transpiled/react/Viewer/NoViewer/index.js +0 -1
- package/transpiled/react/Viewer/Panel/ActionMenuDesktop.js +0 -68
- package/transpiled/react/Viewer/Panel/ActionMenuMobile.js +0 -70
- package/transpiled/react/Viewer/Panel/ActionMenuWrapper.js +0 -129
- package/transpiled/react/Viewer/Panel/Certifications.js +0 -56
- package/transpiled/react/Viewer/Panel/PanelContent.js +0 -48
- package/transpiled/react/Viewer/Panel/Qualification.js +0 -119
- package/transpiled/react/Viewer/Panel/QualificationListItemContact.js +0 -96
- package/transpiled/react/Viewer/Panel/QualificationListItemDate.js +0 -64
- package/transpiled/react/Viewer/Panel/QualificationListItemInformation.js +0 -59
- package/transpiled/react/Viewer/Panel/QualificationListItemOther.js +0 -53
- package/transpiled/react/Viewer/Panel/QualificationListItemText.js +0 -29
- package/transpiled/react/Viewer/Panel/getPanelBlocks.js +0 -62
- package/transpiled/react/Viewer/Viewer.js +0 -172
- package/transpiled/react/Viewer/ViewerContainer.js +0 -189
- package/transpiled/react/Viewer/ViewerExposer.js +0 -2
- package/transpiled/react/Viewer/ViewerInformationsWrapper.js +0 -49
- package/transpiled/react/Viewer/ViewerWithCustomPanelAndFooter.js +0 -56
- package/transpiled/react/Viewer/ViewersByFile/AudioViewer.js +0 -41
- package/transpiled/react/Viewer/ViewersByFile/BlankPaperViewer.js +0 -74
- package/transpiled/react/Viewer/ViewersByFile/ImageViewer.js +0 -367
- package/transpiled/react/Viewer/ViewersByFile/NoNetworkViewer.js +0 -38
- package/transpiled/react/Viewer/ViewersByFile/OnlyOfficeViewer.js +0 -29
- package/transpiled/react/Viewer/ViewersByFile/PdfJsViewer.js +0 -254
- package/transpiled/react/Viewer/ViewersByFile/PdfMobileViewer.js +0 -153
- package/transpiled/react/Viewer/ViewersByFile/ShortcutViewer.js +0 -42
- package/transpiled/react/Viewer/ViewersByFile/TextViewer.js +0 -219
- package/transpiled/react/Viewer/ViewersByFile/VideoViewer.js +0 -33
- package/transpiled/react/Viewer/assets/IlluGenericNewPage.svg +0 -10
- package/transpiled/react/Viewer/components/ExpirationAlert.js +0 -100
- package/transpiled/react/Viewer/components/ExpirationAnnotation.js +0 -41
- package/transpiled/react/Viewer/components/Footer.js +0 -29
- package/transpiled/react/Viewer/components/InformationPanel.js +0 -23
- package/transpiled/react/Viewer/components/Navigation.js +0 -47
- package/transpiled/react/Viewer/components/PdfToolbarButton.js +0 -28
- package/transpiled/react/Viewer/components/PrintButton.js +0 -137
- package/transpiled/react/Viewer/components/Toolbar.js +0 -115
- package/transpiled/react/Viewer/components/ToolbarButtons.js +0 -9
- package/transpiled/react/Viewer/components/ToolbarFilePath.js +0 -71
- package/transpiled/react/Viewer/components/ViewerByFile.js +0 -105
- package/transpiled/react/Viewer/components/ViewerControls.js +0 -226
- package/transpiled/react/Viewer/components/ViewerSpinner.js +0 -17
- package/transpiled/react/Viewer/helpers.js +0 -147
- package/transpiled/react/Viewer/hoc/withFileUrl.js +0 -207
- package/transpiled/react/Viewer/hoc/withViewerLocales.js +0 -3
- package/transpiled/react/Viewer/hooks/useReferencedContactName.js +0 -32
- package/transpiled/react/Viewer/index.js +0 -11
- package/transpiled/react/Viewer/locales/index.js +0 -136
- package/transpiled/react/Viewer/proptypes.js +0 -14
- package/transpiled/react/Viewer/providers/ActionMenuProvider.js +0 -34
- package/transpiled/react/Viewer/queries.js +0 -26
- /package/react/{Viewer/providers/EncryptedProvider.jsx → providers/Encrypted/index.jsx} +0 -0
- /package/transpiled/react/{Viewer/providers/EncryptedProvider.js → providers/Encrypted/index.js} +0 -0
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import AppLinker from "cozy-ui/transpiled/react/AppLinker";
|
|
4
|
-
import BottomSheet, { BottomSheetItem } from "cozy-ui/transpiled/react/BottomSheet";
|
|
5
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
6
|
-
import Copy from "cozy-ui/transpiled/react/Icons/Copy";
|
|
7
|
-
import Edit from "cozy-ui/transpiled/react/Icons/Rename";
|
|
8
|
-
import List from "cozy-ui/transpiled/react/List";
|
|
9
|
-
import ListItem from "cozy-ui/transpiled/react/ListItem";
|
|
10
|
-
import ListItemIcon from "cozy-ui/transpiled/react/ListItemIcon";
|
|
11
|
-
import ListItemText from "cozy-ui/transpiled/react/ListItemText";
|
|
12
|
-
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
|
13
|
-
|
|
14
|
-
var ActionMenuMobile = function ActionMenuMobile(_ref) {
|
|
15
|
-
var onClose = _ref.onClose,
|
|
16
|
-
isEditable = _ref.isEditable,
|
|
17
|
-
actions = _ref.actions,
|
|
18
|
-
appLink = _ref.appLink,
|
|
19
|
-
appSlug = _ref.appSlug;
|
|
20
|
-
|
|
21
|
-
var _useI18n = useI18n(),
|
|
22
|
-
t = _useI18n.t;
|
|
23
|
-
|
|
24
|
-
var handleCopy = actions.handleCopy,
|
|
25
|
-
handleEdit = actions.handleEdit;
|
|
26
|
-
return /*#__PURE__*/React.createElement(BottomSheet, {
|
|
27
|
-
backdrop: true,
|
|
28
|
-
onClose: onClose
|
|
29
|
-
}, /*#__PURE__*/React.createElement(BottomSheetItem, {
|
|
30
|
-
disableGutters: true
|
|
31
|
-
}, /*#__PURE__*/React.createElement(List, null, isEditable && /*#__PURE__*/React.createElement(AppLinker, {
|
|
32
|
-
app: {
|
|
33
|
-
slug: appSlug
|
|
34
|
-
},
|
|
35
|
-
href: appLink
|
|
36
|
-
}, function (_ref2) {
|
|
37
|
-
var _onClick = _ref2.onClick,
|
|
38
|
-
href = _ref2.href;
|
|
39
|
-
return /*#__PURE__*/React.createElement(ListItem, {
|
|
40
|
-
button: true,
|
|
41
|
-
component: "a",
|
|
42
|
-
href: href,
|
|
43
|
-
onClick: function onClick() {
|
|
44
|
-
return handleEdit(_onClick);
|
|
45
|
-
}
|
|
46
|
-
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
47
|
-
icon: Edit
|
|
48
|
-
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
49
|
-
primary: t("Viewer.panel.qualification.actions.edit")
|
|
50
|
-
}));
|
|
51
|
-
}), /*#__PURE__*/React.createElement(ListItem, {
|
|
52
|
-
button: true,
|
|
53
|
-
onClick: handleCopy
|
|
54
|
-
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
55
|
-
icon: Copy
|
|
56
|
-
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
57
|
-
primary: t("Viewer.panel.qualification.actions.copyClipboard")
|
|
58
|
-
})))));
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
ActionMenuMobile.propTypes = {
|
|
62
|
-
onClose: PropTypes.func,
|
|
63
|
-
isEditable: PropTypes.bool,
|
|
64
|
-
actions: PropTypes.shape({
|
|
65
|
-
handleCopy: PropTypes.func,
|
|
66
|
-
handleEdit: PropTypes.func
|
|
67
|
-
}),
|
|
68
|
-
appLink: PropTypes.string
|
|
69
|
-
};
|
|
70
|
-
export default ActionMenuMobile;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import React, { forwardRef } from 'react';
|
|
5
|
-
import { useAppLinkWithStoreFallback, useClient } from 'cozy-client';
|
|
6
|
-
import ActionMenuDesktop from "cozy-ui/transpiled/react/Viewer/Panel/ActionMenuDesktop";
|
|
7
|
-
import ActionMenuMobile from "cozy-ui/transpiled/react/Viewer/Panel/ActionMenuMobile";
|
|
8
|
-
import { useAlert } from "cozy-ui/transpiled/react/providers/Alert";
|
|
9
|
-
import useBreakpoints from "cozy-ui/transpiled/react/providers/Breakpoints";
|
|
10
|
-
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
|
11
|
-
import { buildEditAttributePath, isEditableAttribute, getCurrentModel } from "cozy-ui/transpiled/react/Viewer/helpers";
|
|
12
|
-
import useActionMenuContext from "cozy-ui/transpiled/react/Viewer/providers/ActionMenuProvider";
|
|
13
|
-
var mespapiersAppSlug = 'mespapiers';
|
|
14
|
-
var ActionMenuWrapper = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
15
|
-
var onClose = _ref.onClose,
|
|
16
|
-
file = _ref.file,
|
|
17
|
-
optionFile = _ref.optionFile;
|
|
18
|
-
var name = optionFile.name,
|
|
19
|
-
value = optionFile.value;
|
|
20
|
-
var editPathByModelProps = useActionMenuContext();
|
|
21
|
-
|
|
22
|
-
var _useBreakpoints = useBreakpoints(),
|
|
23
|
-
isMobile = _useBreakpoints.isMobile;
|
|
24
|
-
|
|
25
|
-
var _useI18n = useI18n(),
|
|
26
|
-
t = _useI18n.t;
|
|
27
|
-
|
|
28
|
-
var _useAlert = useAlert(),
|
|
29
|
-
showAlert = _useAlert.showAlert;
|
|
30
|
-
|
|
31
|
-
var client = useClient();
|
|
32
|
-
var currentModel = getCurrentModel(name);
|
|
33
|
-
var editPath = buildEditAttributePath(editPathByModelProps, currentModel, optionFile.name);
|
|
34
|
-
|
|
35
|
-
var _useAppLinkWithStoreF = useAppLinkWithStoreFallback(mespapiersAppSlug, client, editPath),
|
|
36
|
-
fetchStatus = _useAppLinkWithStoreF.fetchStatus,
|
|
37
|
-
url = _useAppLinkWithStoreF.url;
|
|
38
|
-
|
|
39
|
-
var isAppLinkLoaded = fetchStatus === 'loaded';
|
|
40
|
-
var isEditable = Boolean(editPath) && isEditableAttribute(name, file);
|
|
41
|
-
|
|
42
|
-
var handleCopy = /*#__PURE__*/function () {
|
|
43
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
44
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
45
|
-
while (1) {
|
|
46
|
-
switch (_context.prev = _context.next) {
|
|
47
|
-
case 0:
|
|
48
|
-
_context.prev = 0;
|
|
49
|
-
_context.next = 3;
|
|
50
|
-
return navigator.clipboard.writeText(value);
|
|
51
|
-
|
|
52
|
-
case 3:
|
|
53
|
-
showAlert({
|
|
54
|
-
message: t("Viewer.snackbar.copiedToClipboard.success"),
|
|
55
|
-
severity: 'success',
|
|
56
|
-
variant: 'filled',
|
|
57
|
-
icon: false
|
|
58
|
-
});
|
|
59
|
-
_context.next = 9;
|
|
60
|
-
break;
|
|
61
|
-
|
|
62
|
-
case 6:
|
|
63
|
-
_context.prev = 6;
|
|
64
|
-
_context.t0 = _context["catch"](0);
|
|
65
|
-
showAlert({
|
|
66
|
-
message: t("Viewer.snackbar.copiedToClipboard.error"),
|
|
67
|
-
severity: 'error',
|
|
68
|
-
variant: 'filled',
|
|
69
|
-
icon: false
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
case 9:
|
|
73
|
-
onClose();
|
|
74
|
-
|
|
75
|
-
case 10:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, _callee, null, [[0, 6]]);
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
return function handleCopy() {
|
|
84
|
-
return _ref2.apply(this, arguments);
|
|
85
|
-
};
|
|
86
|
-
}();
|
|
87
|
-
|
|
88
|
-
var handleEdit = function handleEdit(cb) {
|
|
89
|
-
if (isAppLinkLoaded) {
|
|
90
|
-
onClose();
|
|
91
|
-
cb && cb();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
if (isMobile) {
|
|
96
|
-
return /*#__PURE__*/React.createElement(ActionMenuMobile, {
|
|
97
|
-
onClose: onClose,
|
|
98
|
-
isEditable: isEditable,
|
|
99
|
-
actions: {
|
|
100
|
-
handleCopy: handleCopy,
|
|
101
|
-
handleEdit: handleEdit
|
|
102
|
-
},
|
|
103
|
-
appLink: url,
|
|
104
|
-
appSlug: mespapiersAppSlug
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return /*#__PURE__*/React.createElement(ActionMenuDesktop, {
|
|
109
|
-
ref: ref,
|
|
110
|
-
onClose: onClose,
|
|
111
|
-
isEditable: isEditable,
|
|
112
|
-
actions: {
|
|
113
|
-
handleCopy: handleCopy,
|
|
114
|
-
handleEdit: handleEdit
|
|
115
|
-
},
|
|
116
|
-
appLink: url,
|
|
117
|
-
appSlug: mespapiersAppSlug
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
ActionMenuWrapper.displayName = 'ActionMenuWrapper';
|
|
121
|
-
ActionMenuWrapper.propTypes = {
|
|
122
|
-
onClose: PropTypes.func,
|
|
123
|
-
file: PropTypes.object,
|
|
124
|
-
optionFile: PropTypes.shape({
|
|
125
|
-
name: PropTypes.string,
|
|
126
|
-
value: PropTypes.string
|
|
127
|
-
})
|
|
128
|
-
};
|
|
129
|
-
export default ActionMenuWrapper;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import has from 'lodash/has';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import Icon, { iconPropType } from "cozy-ui/transpiled/react/Icon";
|
|
5
|
-
import CarbonCopyIcon from "cozy-ui/transpiled/react/Icons/CarbonCopy";
|
|
6
|
-
import SafeIcon from "cozy-ui/transpiled/react/Icons/Safe";
|
|
7
|
-
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
8
|
-
import { Media, Img, Bd } from "cozy-ui/transpiled/react/deprecated/Media";
|
|
9
|
-
import { withViewerLocales } from "cozy-ui/transpiled/react/Viewer/hoc/withViewerLocales";
|
|
10
|
-
|
|
11
|
-
var Certification = function Certification(_ref) {
|
|
12
|
-
var icon = _ref.icon,
|
|
13
|
-
title = _ref.title,
|
|
14
|
-
caption = _ref.caption;
|
|
15
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
-
className: "u-ph-2 u-pv-1"
|
|
17
|
-
}, /*#__PURE__*/React.createElement(Media, {
|
|
18
|
-
className: "u-mb-half",
|
|
19
|
-
align: "top"
|
|
20
|
-
}, /*#__PURE__*/React.createElement(Img, {
|
|
21
|
-
className: "u-mr-half"
|
|
22
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
23
|
-
icon: icon
|
|
24
|
-
})), /*#__PURE__*/React.createElement(Bd, null, /*#__PURE__*/React.createElement(Typography, {
|
|
25
|
-
variant: "body1"
|
|
26
|
-
}, title))), /*#__PURE__*/React.createElement(Typography, {
|
|
27
|
-
variant: "caption"
|
|
28
|
-
}, caption));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
Certification.propTypes = {
|
|
32
|
-
icon: iconPropType.isRequired,
|
|
33
|
-
title: PropTypes.string.isRequired,
|
|
34
|
-
caption: PropTypes.string.isRequired
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
var Certifications = function Certifications(_ref2) {
|
|
38
|
-
var file = _ref2.file,
|
|
39
|
-
t = _ref2.t;
|
|
40
|
-
var hasCarbonCopy = has(file, 'metadata.carbonCopy');
|
|
41
|
-
var hasElectronicSafe = has(file, 'metadata.electronicSafe');
|
|
42
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, hasCarbonCopy && /*#__PURE__*/React.createElement(Certification, {
|
|
43
|
-
icon: CarbonCopyIcon,
|
|
44
|
-
title: t('Viewer.panel.certifications.carbonCopy.title'),
|
|
45
|
-
caption: t('Viewer.panel.certifications.carbonCopy.caption')
|
|
46
|
-
}), hasElectronicSafe && /*#__PURE__*/React.createElement(Certification, {
|
|
47
|
-
icon: SafeIcon,
|
|
48
|
-
title: t('Viewer.panel.certifications.electronicSafe.title'),
|
|
49
|
-
caption: t('Viewer.panel.certifications.electronicSafe.caption')
|
|
50
|
-
}));
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
Certifications.propTypes = {
|
|
54
|
-
file: PropTypes.object.isRequired
|
|
55
|
-
};
|
|
56
|
-
export default withViewerLocales(Certifications);
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import cx from 'classnames';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import getPanelBlocks, { getPanelBlocksSpecs } from "cozy-ui/transpiled/react/Viewer/Panel/getPanelBlocks";
|
|
5
|
-
import Paper from "cozy-ui/transpiled/react/Paper";
|
|
6
|
-
import Stack from "cozy-ui/transpiled/react/Stack";
|
|
7
|
-
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
8
|
-
import { withViewerLocales } from "cozy-ui/transpiled/react/Viewer/hoc/withViewerLocales";
|
|
9
|
-
|
|
10
|
-
var PanelContent = function PanelContent(_ref) {
|
|
11
|
-
var file = _ref.file,
|
|
12
|
-
isPublic = _ref.isPublic,
|
|
13
|
-
t = _ref.t;
|
|
14
|
-
var panelBlocks = getPanelBlocks({
|
|
15
|
-
panelBlocksSpecs: getPanelBlocksSpecs(isPublic),
|
|
16
|
-
file: file
|
|
17
|
-
});
|
|
18
|
-
return /*#__PURE__*/React.createElement(Stack, {
|
|
19
|
-
spacing: "s",
|
|
20
|
-
className: cx('u-flex u-flex-column u-h-100')
|
|
21
|
-
}, /*#__PURE__*/React.createElement(Paper, {
|
|
22
|
-
className: "u-flex u-flex-items-center u-h-3 u-ph-2 u-flex-shrink-0",
|
|
23
|
-
elevation: 2,
|
|
24
|
-
square: true
|
|
25
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
26
|
-
variant: "h4"
|
|
27
|
-
}, t('Viewer.panel.title'))), panelBlocks.map(function (PanelBlock, index) {
|
|
28
|
-
return /*#__PURE__*/React.createElement(Paper, {
|
|
29
|
-
key: index,
|
|
30
|
-
className: cx({
|
|
31
|
-
'u-flex-grow-1': index === panelBlocks.length - 1
|
|
32
|
-
}),
|
|
33
|
-
elevation: 2,
|
|
34
|
-
square: true
|
|
35
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
36
|
-
variant: "h4",
|
|
37
|
-
className: "u-pv-1"
|
|
38
|
-
}, /*#__PURE__*/React.createElement(PanelBlock, {
|
|
39
|
-
file: file
|
|
40
|
-
})));
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
PanelContent.propTypes = {
|
|
45
|
-
file: PropTypes.object.isRequired,
|
|
46
|
-
isPublic: PropTypes.bool
|
|
47
|
-
};
|
|
48
|
-
export default withViewerLocales(PanelContent);
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React, { useRef, useState, createRef, useMemo, useEffect } from 'react';
|
|
4
|
-
import { isExpiringSoon, formatMetadataQualification, KNOWN_BILLS_ATTRIBUTES_NAMES, getMetadataQualificationType } from 'cozy-client/dist/models/paper';
|
|
5
|
-
import ActionMenuWrapper from "cozy-ui/transpiled/react/Viewer/Panel/ActionMenuWrapper";
|
|
6
|
-
import QualificationListItemContact from "cozy-ui/transpiled/react/Viewer/Panel/QualificationListItemContact";
|
|
7
|
-
import QualificationListItemDate from "cozy-ui/transpiled/react/Viewer/Panel/QualificationListItemDate";
|
|
8
|
-
import QualificationListItemInformation from "cozy-ui/transpiled/react/Viewer/Panel/QualificationListItemInformation";
|
|
9
|
-
import QualificationListItemOther from "cozy-ui/transpiled/react/Viewer/Panel/QualificationListItemOther";
|
|
10
|
-
import List from "cozy-ui/transpiled/react/List";
|
|
11
|
-
import ExpirationAlert from "cozy-ui/transpiled/react/Viewer/components/ExpirationAlert";
|
|
12
|
-
import { withViewerLocales } from "cozy-ui/transpiled/react/Viewer/hoc/withViewerLocales";
|
|
13
|
-
var ComponentFromMetadataQualificationType = {
|
|
14
|
-
contact: QualificationListItemContact,
|
|
15
|
-
date: QualificationListItemDate,
|
|
16
|
-
information: QualificationListItemInformation,
|
|
17
|
-
other: QualificationListItemOther,
|
|
18
|
-
bills: QualificationListItemInformation
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
var isExpirationAlertHidden = function isExpirationAlertHidden(file) {
|
|
22
|
-
var _file$metadata$hideEx, _file$metadata;
|
|
23
|
-
|
|
24
|
-
return (_file$metadata$hideEx = file === null || file === void 0 ? void 0 : (_file$metadata = file.metadata) === null || _file$metadata === void 0 ? void 0 : _file$metadata.hideExpirationAlert) !== null && _file$metadata$hideEx !== void 0 ? _file$metadata$hideEx : false;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
var Qualification = function Qualification(_ref) {
|
|
28
|
-
var _file$bills2;
|
|
29
|
-
|
|
30
|
-
var file = _ref.file;
|
|
31
|
-
var _file$metadata2 = file.metadata,
|
|
32
|
-
metadata = _file$metadata2 === void 0 ? {} : _file$metadata2;
|
|
33
|
-
var actionBtnRef = useRef([]);
|
|
34
|
-
|
|
35
|
-
var _useState = useState({
|
|
36
|
-
id: '',
|
|
37
|
-
name: '',
|
|
38
|
-
value: ''
|
|
39
|
-
}),
|
|
40
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
-
optionFile = _useState2[0],
|
|
42
|
-
setOptionFile = _useState2[1];
|
|
43
|
-
|
|
44
|
-
var hideActionsMenu = function hideActionsMenu() {
|
|
45
|
-
setOptionFile({
|
|
46
|
-
id: '',
|
|
47
|
-
name: '',
|
|
48
|
-
value: ''
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var _toggleActionsMenu = function toggleActionsMenu(id, name, value) {
|
|
53
|
-
setOptionFile(function (prev) {
|
|
54
|
-
if (prev.value) return {
|
|
55
|
-
id: '',
|
|
56
|
-
name: '',
|
|
57
|
-
value: ''
|
|
58
|
-
};
|
|
59
|
-
return {
|
|
60
|
-
id: id,
|
|
61
|
-
name: name,
|
|
62
|
-
value: value
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var formattedMetadataQualification = useMemo(function () {
|
|
68
|
-
var _file$bills, _file$bills$data;
|
|
69
|
-
|
|
70
|
-
var relatedBills = (_file$bills = file.bills) === null || _file$bills === void 0 ? void 0 : (_file$bills$data = _file$bills.data) === null || _file$bills$data === void 0 ? void 0 : _file$bills$data[0];
|
|
71
|
-
|
|
72
|
-
if (relatedBills) {
|
|
73
|
-
var formattedBillsMetadata = KNOWN_BILLS_ATTRIBUTES_NAMES.map(function (attrName) {
|
|
74
|
-
return {
|
|
75
|
-
name: attrName,
|
|
76
|
-
value: relatedBills[attrName]
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
return formatMetadataQualification(metadata).concat(formattedBillsMetadata);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return formatMetadataQualification(metadata);
|
|
83
|
-
}, [metadata, (_file$bills2 = file.bills) === null || _file$bills2 === void 0 ? void 0 : _file$bills2.data]);
|
|
84
|
-
useEffect(function () {
|
|
85
|
-
actionBtnRef.current = formattedMetadataQualification.map(function (_, idx) {
|
|
86
|
-
var _actionBtnRef$current;
|
|
87
|
-
|
|
88
|
-
return (_actionBtnRef$current = actionBtnRef.current[idx]) !== null && _actionBtnRef$current !== void 0 ? _actionBtnRef$current : /*#__PURE__*/createRef();
|
|
89
|
-
});
|
|
90
|
-
}, [formattedMetadataQualification]);
|
|
91
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, isExpiringSoon(file) && !isExpirationAlertHidden(file) && /*#__PURE__*/React.createElement(ExpirationAlert, {
|
|
92
|
-
file: file
|
|
93
|
-
}), /*#__PURE__*/React.createElement(List, {
|
|
94
|
-
className: "u-pv-1"
|
|
95
|
-
}, formattedMetadataQualification.map(function (meta, idx) {
|
|
96
|
-
var name = meta.name;
|
|
97
|
-
var metadataQualificationType = getMetadataQualificationType(name);
|
|
98
|
-
var QualificationListItemComp = ComponentFromMetadataQualificationType[metadataQualificationType];
|
|
99
|
-
return /*#__PURE__*/React.createElement(QualificationListItemComp, {
|
|
100
|
-
key: idx,
|
|
101
|
-
file: file,
|
|
102
|
-
ref: actionBtnRef.current[idx],
|
|
103
|
-
formattedMetadataQualification: meta,
|
|
104
|
-
toggleActionsMenu: function toggleActionsMenu(val) {
|
|
105
|
-
return _toggleActionsMenu(idx, name, val);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}), optionFile.name && /*#__PURE__*/React.createElement(ActionMenuWrapper, {
|
|
109
|
-
onClose: hideActionsMenu,
|
|
110
|
-
file: file,
|
|
111
|
-
optionFile: optionFile,
|
|
112
|
-
ref: actionBtnRef.current[optionFile.id]
|
|
113
|
-
})));
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
Qualification.propTypes = {
|
|
117
|
-
file: PropTypes.object.isRequired
|
|
118
|
-
};
|
|
119
|
-
export default withViewerLocales(Qualification);
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React, { useRef, useState } from 'react';
|
|
4
|
-
import { getTranslatedNameForContact, formatContactValue } from 'cozy-client/dist/models/paper';
|
|
5
|
-
import ActionMenuWrapper from "cozy-ui/transpiled/react/Viewer/Panel/ActionMenuWrapper";
|
|
6
|
-
import QualificationListItemText from "cozy-ui/transpiled/react/Viewer/Panel/QualificationListItemText";
|
|
7
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
8
|
-
import IconButton from "cozy-ui/transpiled/react/IconButton";
|
|
9
|
-
import Dots from "cozy-ui/transpiled/react/Icons/Dots";
|
|
10
|
-
import ListItem from "cozy-ui/transpiled/react/ListItem";
|
|
11
|
-
import ListItemSecondaryAction from "cozy-ui/transpiled/react/ListItemSecondaryAction";
|
|
12
|
-
import Spinner from "cozy-ui/transpiled/react/Spinner";
|
|
13
|
-
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
|
14
|
-
import useReferencedContactName from "cozy-ui/transpiled/react/Viewer/hooks/useReferencedContactName";
|
|
15
|
-
|
|
16
|
-
var QualificationListItemContact = function QualificationListItemContact(_ref) {
|
|
17
|
-
var file = _ref.file;
|
|
18
|
-
|
|
19
|
-
var _useI18n = useI18n(),
|
|
20
|
-
lang = _useI18n.lang;
|
|
21
|
-
|
|
22
|
-
var actionBtnRef = useRef();
|
|
23
|
-
|
|
24
|
-
var _useState = useState({
|
|
25
|
-
name: '',
|
|
26
|
-
value: ''
|
|
27
|
-
}),
|
|
28
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
optionFile = _useState2[0],
|
|
30
|
-
setOptionFile = _useState2[1];
|
|
31
|
-
|
|
32
|
-
var hideActionsMenu = function hideActionsMenu() {
|
|
33
|
-
return setOptionFile({
|
|
34
|
-
name: '',
|
|
35
|
-
value: ''
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
var toggleActionsMenu = function toggleActionsMenu(name, value) {
|
|
40
|
-
return setOptionFile(function (prev) {
|
|
41
|
-
if (prev.value) return {
|
|
42
|
-
name: '',
|
|
43
|
-
value: ''
|
|
44
|
-
};
|
|
45
|
-
return {
|
|
46
|
-
name: name,
|
|
47
|
-
value: value
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var _useReferencedContact = useReferencedContactName(file),
|
|
53
|
-
contacts = _useReferencedContact.contacts,
|
|
54
|
-
isLoadingContacts = _useReferencedContact.isLoadingContacts;
|
|
55
|
-
|
|
56
|
-
if (isLoadingContacts) {
|
|
57
|
-
return /*#__PURE__*/React.createElement(ListItem, {
|
|
58
|
-
className: "u-pl-2 u-pr-3"
|
|
59
|
-
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
60
|
-
color: "var(--secondaryTextColor)"
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var formattedTitle = getTranslatedNameForContact({
|
|
65
|
-
lang: lang
|
|
66
|
-
});
|
|
67
|
-
var formattedValue = formatContactValue(contacts);
|
|
68
|
-
|
|
69
|
-
if (!isLoadingContacts && !formattedValue) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ListItem, {
|
|
74
|
-
className: "u-ph-2"
|
|
75
|
-
}, /*#__PURE__*/React.createElement(QualificationListItemText, {
|
|
76
|
-
primary: formattedTitle,
|
|
77
|
-
secondary: formattedValue
|
|
78
|
-
}), /*#__PURE__*/React.createElement(ListItemSecondaryAction, null, /*#__PURE__*/React.createElement(IconButton, {
|
|
79
|
-
ref: actionBtnRef,
|
|
80
|
-
onClick: function onClick() {
|
|
81
|
-
return toggleActionsMenu('contact', formattedValue);
|
|
82
|
-
}
|
|
83
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
84
|
-
icon: Dots
|
|
85
|
-
})))), optionFile.value && /*#__PURE__*/React.createElement(ActionMenuWrapper, {
|
|
86
|
-
onClose: hideActionsMenu,
|
|
87
|
-
file: file,
|
|
88
|
-
optionFile: optionFile,
|
|
89
|
-
ref: actionBtnRef
|
|
90
|
-
}));
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
QualificationListItemContact.propTypes = {
|
|
94
|
-
file: PropTypes.object.isRequired
|
|
95
|
-
};
|
|
96
|
-
export default QualificationListItemContact;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import { isExpired, isExpiringSoon, getTranslatedNameForDateMetadata, formatDateMetadataValue } from 'cozy-client/dist/models/paper';
|
|
4
|
-
import QualificationListItemText from "cozy-ui/transpiled/react/Viewer/Panel/QualificationListItemText";
|
|
5
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
6
|
-
import IconButton from "cozy-ui/transpiled/react/IconButton";
|
|
7
|
-
import Dots from "cozy-ui/transpiled/react/Icons/Dots";
|
|
8
|
-
import ListItem from "cozy-ui/transpiled/react/ListItem";
|
|
9
|
-
import ListItemSecondaryAction from "cozy-ui/transpiled/react/ListItemSecondaryAction";
|
|
10
|
-
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
11
|
-
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
|
12
|
-
import ExpirationAnnotation from "cozy-ui/transpiled/react/Viewer/components/ExpirationAnnotation";
|
|
13
|
-
var QualificationListItemDate = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14
|
-
var file = _ref.file,
|
|
15
|
-
formattedMetadataQualification = _ref.formattedMetadataQualification,
|
|
16
|
-
toggleActionsMenu = _ref.toggleActionsMenu;
|
|
17
|
-
|
|
18
|
-
var _useI18n = useI18n(),
|
|
19
|
-
f = _useI18n.f,
|
|
20
|
-
lang = _useI18n.lang;
|
|
21
|
-
|
|
22
|
-
var name = formattedMetadataQualification.name,
|
|
23
|
-
value = formattedMetadataQualification.value;
|
|
24
|
-
var formattedTitle = getTranslatedNameForDateMetadata(name, {
|
|
25
|
-
lang: lang
|
|
26
|
-
});
|
|
27
|
-
var formattedDate = formatDateMetadataValue(value, {
|
|
28
|
-
f: f,
|
|
29
|
-
lang: lang
|
|
30
|
-
});
|
|
31
|
-
var isExpirationDate = name === 'expirationDate';
|
|
32
|
-
return /*#__PURE__*/React.createElement(ListItem, {
|
|
33
|
-
className: "u-pl-2 u-pr-3"
|
|
34
|
-
}, /*#__PURE__*/React.createElement(QualificationListItemText, {
|
|
35
|
-
primary: formattedTitle,
|
|
36
|
-
secondary: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
37
|
-
component: "span",
|
|
38
|
-
variant: "inherit"
|
|
39
|
-
}, formattedDate), isExpirationDate && (isExpired(file) || isExpiringSoon(file)) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
40
|
-
component: "span",
|
|
41
|
-
variant: "inherit"
|
|
42
|
-
}, ' · '), /*#__PURE__*/React.createElement(ExpirationAnnotation, {
|
|
43
|
-
file: file
|
|
44
|
-
}))),
|
|
45
|
-
disabled: !value
|
|
46
|
-
}), /*#__PURE__*/React.createElement(ListItemSecondaryAction, null, /*#__PURE__*/React.createElement(IconButton, {
|
|
47
|
-
ref: ref,
|
|
48
|
-
onClick: function onClick() {
|
|
49
|
-
return toggleActionsMenu(formattedDate);
|
|
50
|
-
}
|
|
51
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
52
|
-
icon: Dots
|
|
53
|
-
}))));
|
|
54
|
-
});
|
|
55
|
-
QualificationListItemDate.displayName = 'QualificationListItemDate';
|
|
56
|
-
QualificationListItemDate.propTypes = {
|
|
57
|
-
file: PropTypes.object.isRequired,
|
|
58
|
-
formattedMetadataQualification: PropTypes.shape({
|
|
59
|
-
name: PropTypes.string,
|
|
60
|
-
value: PropTypes.string
|
|
61
|
-
}).isRequired,
|
|
62
|
-
toggleActionsMenu: PropTypes.func.isRequired
|
|
63
|
-
};
|
|
64
|
-
export default QualificationListItemDate;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import { getTranslatedNameForInformationMetadata, formatInformationMetadataValue } from 'cozy-client/dist/models/paper';
|
|
4
|
-
import QualificationListItemText from "cozy-ui/transpiled/react/Viewer/Panel/QualificationListItemText";
|
|
5
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
6
|
-
import IconButton from "cozy-ui/transpiled/react/IconButton";
|
|
7
|
-
import Dots from "cozy-ui/transpiled/react/Icons/Dots";
|
|
8
|
-
import ListItem from "cozy-ui/transpiled/react/ListItem";
|
|
9
|
-
import ListItemSecondaryAction from "cozy-ui/transpiled/react/ListItemSecondaryAction";
|
|
10
|
-
import MidEllipsis from "cozy-ui/transpiled/react/MidEllipsis";
|
|
11
|
-
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
|
12
|
-
var QualificationListItemInformation = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
13
|
-
var formattedMetadataQualification = _ref.formattedMetadataQualification,
|
|
14
|
-
file = _ref.file,
|
|
15
|
-
toggleActionsMenu = _ref.toggleActionsMenu;
|
|
16
|
-
|
|
17
|
-
var _useI18n = useI18n(),
|
|
18
|
-
lang = _useI18n.lang;
|
|
19
|
-
|
|
20
|
-
var name = formattedMetadataQualification.name,
|
|
21
|
-
value = formattedMetadataQualification.value;
|
|
22
|
-
var qualificationLabel = file.metadata.qualification.label;
|
|
23
|
-
var formattedTitle = getTranslatedNameForInformationMetadata(name, {
|
|
24
|
-
lang: lang,
|
|
25
|
-
qualificationLabel: qualificationLabel
|
|
26
|
-
});
|
|
27
|
-
var formattedValue = formatInformationMetadataValue(value, {
|
|
28
|
-
lang: lang,
|
|
29
|
-
name: name,
|
|
30
|
-
qualificationLabel: qualificationLabel
|
|
31
|
-
});
|
|
32
|
-
var titleComponent = formattedTitle === name ? /*#__PURE__*/React.createElement(MidEllipsis, {
|
|
33
|
-
text: name
|
|
34
|
-
}) : formattedTitle;
|
|
35
|
-
return /*#__PURE__*/React.createElement(ListItem, {
|
|
36
|
-
className: "u-pl-2 u-pr-3"
|
|
37
|
-
}, /*#__PURE__*/React.createElement(QualificationListItemText, {
|
|
38
|
-
primary: titleComponent,
|
|
39
|
-
secondary: formattedValue,
|
|
40
|
-
disabled: !value
|
|
41
|
-
}), /*#__PURE__*/React.createElement(ListItemSecondaryAction, null, /*#__PURE__*/React.createElement(IconButton, {
|
|
42
|
-
ref: ref,
|
|
43
|
-
onClick: function onClick() {
|
|
44
|
-
return toggleActionsMenu(value);
|
|
45
|
-
},
|
|
46
|
-
"data-testid": "toggleActionsMenuBtn"
|
|
47
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
48
|
-
icon: Dots
|
|
49
|
-
}))));
|
|
50
|
-
});
|
|
51
|
-
QualificationListItemInformation.displayName = 'QualificationListItemNumber';
|
|
52
|
-
QualificationListItemInformation.propTypes = {
|
|
53
|
-
formattedMetadataQualification: PropTypes.shape({
|
|
54
|
-
name: PropTypes.string,
|
|
55
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
56
|
-
}).isRequired,
|
|
57
|
-
toggleActionsMenu: PropTypes.func.isRequired
|
|
58
|
-
};
|
|
59
|
-
export default QualificationListItemInformation;
|