cozy-ui 111.21.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 +14 -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/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/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,98 +0,0 @@
|
|
|
1
|
-
import cx from 'classnames';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
4
|
-
import BottomSheetContent from "cozy-ui/transpiled/react/Viewer/Footer/BottomSheetContent";
|
|
5
|
-
import { extractChildrenCompByName } from "cozy-ui/transpiled/react/Viewer/Footer/helpers";
|
|
6
|
-
import BottomSheet, { BottomSheetHeader } from "cozy-ui/transpiled/react/BottomSheet";
|
|
7
|
-
import { makeStyles } from "cozy-ui/transpiled/react/styles";
|
|
8
|
-
import PrintButton from "cozy-ui/transpiled/react/Viewer/components/PrintButton";
|
|
9
|
-
import { isValidForPanel } from "cozy-ui/transpiled/react/Viewer/helpers";
|
|
10
|
-
|
|
11
|
-
var FooterButtons = function FooterButtons(_ref) {
|
|
12
|
-
var file = _ref.file,
|
|
13
|
-
_ref$FooterActionButt = _ref.FooterActionButtonsWithFile,
|
|
14
|
-
FooterActionButtonsWithFile = _ref$FooterActionButt === void 0 ? {
|
|
15
|
-
FooterActionButtonsWithFile: FooterActionButtonsWithFile
|
|
16
|
-
} : _ref$FooterActionButt;
|
|
17
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, FooterActionButtonsWithFile, /*#__PURE__*/React.createElement(PrintButton, {
|
|
18
|
-
file: file,
|
|
19
|
-
variant: "button"
|
|
20
|
-
}));
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
var useStyles = makeStyles(function (theme) {
|
|
24
|
-
return {
|
|
25
|
-
footer: {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
width: 'calc(100% - 2rem)',
|
|
29
|
-
height: '100%',
|
|
30
|
-
paddingLeft: '1rem',
|
|
31
|
-
paddingRight: '1rem',
|
|
32
|
-
borderTop: "1px solid ".concat(theme.palette.divider),
|
|
33
|
-
columnGap: '0.5rem'
|
|
34
|
-
},
|
|
35
|
-
bottomSheetHeader: {
|
|
36
|
-
columnGap: '0.5rem'
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
var FooterContent = function FooterContent(_ref2) {
|
|
42
|
-
var file = _ref2.file,
|
|
43
|
-
toolbarRef = _ref2.toolbarRef,
|
|
44
|
-
children = _ref2.children,
|
|
45
|
-
isPublic = _ref2.isPublic;
|
|
46
|
-
var styles = useStyles();
|
|
47
|
-
var toolbarProps = useMemo(function () {
|
|
48
|
-
return {
|
|
49
|
-
ref: toolbarRef
|
|
50
|
-
};
|
|
51
|
-
}, [toolbarRef]);
|
|
52
|
-
var FooterActionButtonsWithFile = extractChildrenCompByName({
|
|
53
|
-
children: children,
|
|
54
|
-
file: file,
|
|
55
|
-
name: 'FooterActionButtons'
|
|
56
|
-
});
|
|
57
|
-
var bottomSheetSettings = {
|
|
58
|
-
isOpenMin: isPublic ? true : false,
|
|
59
|
-
mediumHeightRatio: isPublic ? undefined : 0.5
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
if (isValidForPanel({
|
|
63
|
-
file: file
|
|
64
|
-
})) {
|
|
65
|
-
return /*#__PURE__*/React.createElement(BottomSheet, {
|
|
66
|
-
toolbarProps: toolbarProps,
|
|
67
|
-
portalProps: {
|
|
68
|
-
disablePortal: true
|
|
69
|
-
},
|
|
70
|
-
settings: bottomSheetSettings
|
|
71
|
-
}, /*#__PURE__*/React.createElement(BottomSheetHeader, {
|
|
72
|
-
className: cx('u-ph-1 u-pb-1', styles.bottomSheetHeader)
|
|
73
|
-
}, /*#__PURE__*/React.createElement(FooterButtons, {
|
|
74
|
-
file: file,
|
|
75
|
-
FooterActionButtonsWithFile: FooterActionButtonsWithFile
|
|
76
|
-
})), /*#__PURE__*/React.createElement(BottomSheetContent, {
|
|
77
|
-
file: file,
|
|
78
|
-
isPublic: isPublic
|
|
79
|
-
}));
|
|
80
|
-
} // If `FooterActionButtons` hasn't children
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (!FooterActionButtonsWithFile) return null;
|
|
84
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
className: styles.footer
|
|
86
|
-
}, /*#__PURE__*/React.createElement(FooterButtons, {
|
|
87
|
-
file: file,
|
|
88
|
-
FooterActionButtonsWithFile: FooterActionButtonsWithFile
|
|
89
|
-
}));
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
FooterContent.propTypes = {
|
|
93
|
-
file: PropTypes.object.isRequired,
|
|
94
|
-
toolbarRef: PropTypes.object,
|
|
95
|
-
isPublic: PropTypes.bool,
|
|
96
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)])
|
|
97
|
-
};
|
|
98
|
-
export default FooterContent;
|
|
@@ -1,143 +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 from 'react';
|
|
5
|
-
import { useClient } from 'cozy-client';
|
|
6
|
-
import { getSharingLink } from 'cozy-client/dist/models/sharing';
|
|
7
|
-
import { isIOS, isMobileApp } from 'cozy-device-helper';
|
|
8
|
-
import { exportFilesNative } from "cozy-ui/transpiled/react/Viewer/Footer/helpers";
|
|
9
|
-
import Button from "cozy-ui/transpiled/react/Buttons";
|
|
10
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
11
|
-
import IconButton from "cozy-ui/transpiled/react/IconButton";
|
|
12
|
-
import ReplyIcon from "cozy-ui/transpiled/react/Icons/Reply";
|
|
13
|
-
import ShareIosIcon from "cozy-ui/transpiled/react/Icons/ShareIos";
|
|
14
|
-
import Alerter from "cozy-ui/transpiled/react/deprecated/Alerter";
|
|
15
|
-
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
|
16
|
-
var ForwardIcon = isIOS() ? ShareIosIcon : ReplyIcon;
|
|
17
|
-
|
|
18
|
-
var ForwardButton = function ForwardButton(_ref) {
|
|
19
|
-
var file = _ref.file,
|
|
20
|
-
variant = _ref.variant,
|
|
21
|
-
onClick = _ref.onClick;
|
|
22
|
-
|
|
23
|
-
var _useI18n = useI18n(),
|
|
24
|
-
t = _useI18n.t;
|
|
25
|
-
|
|
26
|
-
var client = useClient();
|
|
27
|
-
var icon = /*#__PURE__*/React.createElement(Icon, {
|
|
28
|
-
icon: ForwardIcon
|
|
29
|
-
});
|
|
30
|
-
var label = t('Viewer.actions.forward');
|
|
31
|
-
|
|
32
|
-
var onFileOpen = /*#__PURE__*/function () {
|
|
33
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
|
|
34
|
-
var url, shareData;
|
|
35
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
|
-
while (1) {
|
|
37
|
-
switch (_context.prev = _context.next) {
|
|
38
|
-
case 0:
|
|
39
|
-
if (!isMobileApp()) {
|
|
40
|
-
_context.next = 11;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
_context.prev = 1;
|
|
45
|
-
_context.next = 4;
|
|
46
|
-
return exportFilesNative(client, [file]);
|
|
47
|
-
|
|
48
|
-
case 4:
|
|
49
|
-
_context.next = 9;
|
|
50
|
-
break;
|
|
51
|
-
|
|
52
|
-
case 6:
|
|
53
|
-
_context.prev = 6;
|
|
54
|
-
_context.t0 = _context["catch"](1);
|
|
55
|
-
Alerter.info("Viewer.error.".concat(_context.t0), {
|
|
56
|
-
fileMime: file.mime
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
case 9:
|
|
60
|
-
_context.next = 22;
|
|
61
|
-
break;
|
|
62
|
-
|
|
63
|
-
case 11:
|
|
64
|
-
_context.prev = 11;
|
|
65
|
-
_context.next = 14;
|
|
66
|
-
return getSharingLink(client, [file.id]);
|
|
67
|
-
|
|
68
|
-
case 14:
|
|
69
|
-
url = _context.sent;
|
|
70
|
-
shareData = {
|
|
71
|
-
title: t('Viewer.share.title', {
|
|
72
|
-
name: file.name
|
|
73
|
-
}),
|
|
74
|
-
text: t('Viewer.share.text', {
|
|
75
|
-
name: file.name
|
|
76
|
-
}),
|
|
77
|
-
url: url
|
|
78
|
-
};
|
|
79
|
-
navigator.share(shareData);
|
|
80
|
-
_context.next = 22;
|
|
81
|
-
break;
|
|
82
|
-
|
|
83
|
-
case 19:
|
|
84
|
-
_context.prev = 19;
|
|
85
|
-
_context.t1 = _context["catch"](11);
|
|
86
|
-
Alerter.error('Viewer.share.error', {
|
|
87
|
-
error: _context.t1
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
case 22:
|
|
91
|
-
case "end":
|
|
92
|
-
return _context.stop();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, _callee, null, [[1, 6], [11, 19]]);
|
|
96
|
-
}));
|
|
97
|
-
|
|
98
|
-
return function onFileOpen(_x) {
|
|
99
|
-
return _ref2.apply(this, arguments);
|
|
100
|
-
};
|
|
101
|
-
}();
|
|
102
|
-
|
|
103
|
-
var handleClick = function handleClick() {
|
|
104
|
-
if (onClick) onClick();else onFileOpen(file);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
if (variant === 'iconButton') {
|
|
108
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
109
|
-
className: "u-white",
|
|
110
|
-
"aria-label": label,
|
|
111
|
-
onClick: handleClick
|
|
112
|
-
}, icon);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (variant === 'buttonIcon') {
|
|
116
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
117
|
-
variant: "secondary",
|
|
118
|
-
label: icon,
|
|
119
|
-
"aria-label": label,
|
|
120
|
-
onClick: handleClick
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
125
|
-
fullWidth: true,
|
|
126
|
-
variant: "secondary",
|
|
127
|
-
startIcon: icon,
|
|
128
|
-
"data-testid": "openFileButton",
|
|
129
|
-
label: label,
|
|
130
|
-
onClick: handleClick
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
ForwardButton.propTypes = {
|
|
135
|
-
file: PropTypes.object.isRequired,
|
|
136
|
-
variant: PropTypes.oneOf(['default', 'iconButton', 'buttonIcon']),
|
|
137
|
-
onClick: PropTypes.func
|
|
138
|
-
};
|
|
139
|
-
ForwardButton.defaultProptypes = {
|
|
140
|
-
variant: 'default'
|
|
141
|
-
};
|
|
142
|
-
export { exportFilesNative };
|
|
143
|
-
export default ForwardButton;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["file"];
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { useClient } from 'cozy-client';
|
|
7
|
-
import DownloadButton from "cozy-ui/transpiled/react/Viewer/Footer/DownloadButton";
|
|
8
|
-
import ForwardButton from "cozy-ui/transpiled/react/Viewer/Footer/ForwardButton";
|
|
9
|
-
import { shouldBeForwardButton } from "cozy-ui/transpiled/react/Viewer/Footer/helpers";
|
|
10
|
-
|
|
11
|
-
var ForwardOrDownloadButton = function ForwardOrDownloadButton(_ref) {
|
|
12
|
-
var file = _ref.file,
|
|
13
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
-
|
|
15
|
-
var client = useClient();
|
|
16
|
-
var FileActionButton = shouldBeForwardButton(client) ? ForwardButton : DownloadButton;
|
|
17
|
-
return /*#__PURE__*/React.createElement(FileActionButton, _extends({
|
|
18
|
-
file: file
|
|
19
|
-
}, props));
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
ForwardOrDownloadButton.propTypes = {
|
|
23
|
-
file: PropTypes.object
|
|
24
|
-
};
|
|
25
|
-
export default ForwardOrDownloadButton;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { useClient } from 'cozy-client';
|
|
5
|
-
import { ShareModal, ShareButton } from 'cozy-sharing';
|
|
6
|
-
import { SharingProvider } from 'cozy-sharing/dist/SharingProvider';
|
|
7
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
8
|
-
import IconButton from "cozy-ui/transpiled/react/IconButton";
|
|
9
|
-
import ShareIcon from "cozy-ui/transpiled/react/Icons/Share";
|
|
10
|
-
|
|
11
|
-
var Sharing = function Sharing(_ref) {
|
|
12
|
-
var file = _ref.file,
|
|
13
|
-
variant = _ref.variant;
|
|
14
|
-
var client = useClient();
|
|
15
|
-
|
|
16
|
-
var _useState = useState(false),
|
|
17
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
-
showShareModal = _useState2[0],
|
|
19
|
-
setShowShareModal = _useState2[1];
|
|
20
|
-
|
|
21
|
-
var SharingButton = variant === 'iconButton' ? /*#__PURE__*/React.createElement(IconButton, {
|
|
22
|
-
className: "u-white",
|
|
23
|
-
onClick: function onClick() {
|
|
24
|
-
return setShowShareModal(true);
|
|
25
|
-
}
|
|
26
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
27
|
-
icon: ShareIcon
|
|
28
|
-
})) : /*#__PURE__*/React.createElement(ShareButton, {
|
|
29
|
-
fullWidth: true,
|
|
30
|
-
useShortLabel: true,
|
|
31
|
-
docId: file.id,
|
|
32
|
-
onClick: function onClick() {
|
|
33
|
-
return setShowShareModal(true);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SharingProvider, {
|
|
37
|
-
client: client,
|
|
38
|
-
doctype: "io.cozy.files",
|
|
39
|
-
documentType: "Files"
|
|
40
|
-
}, showShareModal && /*#__PURE__*/React.createElement(ShareModal, {
|
|
41
|
-
document: file,
|
|
42
|
-
documentType: "Files",
|
|
43
|
-
sharingDesc: file.name,
|
|
44
|
-
onClose: function onClose() {
|
|
45
|
-
return setShowShareModal(false);
|
|
46
|
-
}
|
|
47
|
-
}), SharingButton));
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
Sharing.propTypes = {
|
|
51
|
-
file: PropTypes.object,
|
|
52
|
-
variant: PropTypes.oneOf(['default', 'iconButton'])
|
|
53
|
-
};
|
|
54
|
-
Sharing.defaultProptypes = {
|
|
55
|
-
variant: 'default'
|
|
56
|
-
};
|
|
57
|
-
export default Sharing;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import { isValidElement, Children, cloneElement } from 'react';
|
|
4
|
-
import { saveFileWithCordova } from 'cozy-client/dist/models/fsnative';
|
|
5
|
-
import { isIOS, isMobileApp } from 'cozy-device-helper';
|
|
6
|
-
import Alerter from "cozy-ui/transpiled/react/deprecated/Alerter";
|
|
7
|
-
export var shouldBeForwardButton = function shouldBeForwardButton(client) {
|
|
8
|
-
var _client$appMetadata;
|
|
9
|
-
|
|
10
|
-
var isDrive = (client === null || client === void 0 ? void 0 : (_client$appMetadata = client.appMetadata) === null || _client$appMetadata === void 0 ? void 0 : _client$appMetadata.slug) === 'drive';
|
|
11
|
-
if (isMobileApp() || navigator.share && !isDrive) return true;
|
|
12
|
-
return false;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var isMissingFileError = function isMissingFileError(error) {
|
|
16
|
-
return error.status === 404;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
var downloadFileError = function downloadFileError(error) {
|
|
20
|
-
return isMissingFileError(error) ? 'Viewer.error.downloadFile.missing' : 'Viewer.error.missing';
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* exportFilesNative - Triggers a prompt to download a file on mobile devices
|
|
24
|
-
*
|
|
25
|
-
* @param {CozyClient} client
|
|
26
|
-
* @param {array} files One or more files to download
|
|
27
|
-
* @param {string} filename The name of the file that will be saved
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export var exportFilesNative = /*#__PURE__*/function () {
|
|
32
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(client, files, filename) {
|
|
33
|
-
var downloadAllFiles, urls;
|
|
34
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
35
|
-
while (1) {
|
|
36
|
-
switch (_context2.prev = _context2.next) {
|
|
37
|
-
case 0:
|
|
38
|
-
downloadAllFiles = files.map( /*#__PURE__*/function () {
|
|
39
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
|
|
40
|
-
var response, blob, filenameToUse, localFile;
|
|
41
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) {
|
|
43
|
-
switch (_context.prev = _context.next) {
|
|
44
|
-
case 0:
|
|
45
|
-
_context.next = 2;
|
|
46
|
-
return client.collection('io.cozy.files').fetchFileContentById(file.id);
|
|
47
|
-
|
|
48
|
-
case 2:
|
|
49
|
-
response = _context.sent;
|
|
50
|
-
_context.next = 5;
|
|
51
|
-
return response.blob();
|
|
52
|
-
|
|
53
|
-
case 5:
|
|
54
|
-
blob = _context.sent;
|
|
55
|
-
filenameToUse = filename ? filename : file.name;
|
|
56
|
-
_context.next = 9;
|
|
57
|
-
return saveFileWithCordova(blob, filenameToUse);
|
|
58
|
-
|
|
59
|
-
case 9:
|
|
60
|
-
localFile = _context.sent;
|
|
61
|
-
return _context.abrupt("return", localFile.nativeURL);
|
|
62
|
-
|
|
63
|
-
case 11:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, _callee);
|
|
69
|
-
}));
|
|
70
|
-
|
|
71
|
-
return function (_x4) {
|
|
72
|
-
return _ref2.apply(this, arguments);
|
|
73
|
-
};
|
|
74
|
-
}());
|
|
75
|
-
_context2.prev = 1;
|
|
76
|
-
Alerter.info('Viewer.alert.preparing', {
|
|
77
|
-
duration: Math.min(downloadAllFiles.length * 2000, 6000)
|
|
78
|
-
});
|
|
79
|
-
_context2.next = 5;
|
|
80
|
-
return Promise.all(downloadAllFiles);
|
|
81
|
-
|
|
82
|
-
case 5:
|
|
83
|
-
urls = _context2.sent;
|
|
84
|
-
|
|
85
|
-
if (urls.length === 1 && isIOS()) {
|
|
86
|
-
// TODO
|
|
87
|
-
// It seems that files: is not well supported on iOS. url seems to work well
|
|
88
|
-
// at with one file. Need to check when severals
|
|
89
|
-
window.plugins.socialsharing.shareWithOptions({
|
|
90
|
-
url: urls[0]
|
|
91
|
-
}, function (result) {
|
|
92
|
-
if (result.completed === true) {
|
|
93
|
-
Alerter.success('Viewer.share.success');
|
|
94
|
-
}
|
|
95
|
-
}, function (error) {
|
|
96
|
-
throw error;
|
|
97
|
-
});
|
|
98
|
-
} else {
|
|
99
|
-
window.plugins.socialsharing.shareWithOptions({
|
|
100
|
-
files: urls
|
|
101
|
-
}, null, function (error) {
|
|
102
|
-
throw error;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
_context2.next = 12;
|
|
107
|
-
break;
|
|
108
|
-
|
|
109
|
-
case 9:
|
|
110
|
-
_context2.prev = 9;
|
|
111
|
-
_context2.t0 = _context2["catch"](1);
|
|
112
|
-
Alerter.error(downloadFileError(_context2.t0));
|
|
113
|
-
|
|
114
|
-
case 12:
|
|
115
|
-
case "end":
|
|
116
|
-
return _context2.stop();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}, _callee2, null, [[1, 9]]);
|
|
120
|
-
}));
|
|
121
|
-
|
|
122
|
-
return function exportFilesNative(_x, _x2, _x3) {
|
|
123
|
-
return _ref.apply(this, arguments);
|
|
124
|
-
};
|
|
125
|
-
}();
|
|
126
|
-
export var mapToAllChildren = function mapToAllChildren(children, cb) {
|
|
127
|
-
return Children.map(children, function (child) {
|
|
128
|
-
if (! /*#__PURE__*/isValidElement(child)) return child;
|
|
129
|
-
var grandchildren = child.props.children;
|
|
130
|
-
|
|
131
|
-
if (grandchildren) {
|
|
132
|
-
return /*#__PURE__*/cloneElement(child, {
|
|
133
|
-
children: mapToAllChildren(grandchildren, cb)
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return cb(child);
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
export var extractChildrenCompByName = function extractChildrenCompByName(_ref3) {
|
|
141
|
-
var children = _ref3.children,
|
|
142
|
-
file = _ref3.file,
|
|
143
|
-
name = _ref3.name;
|
|
144
|
-
var ChildrenComp = Children.toArray(children).find(function (child) {
|
|
145
|
-
return child.type.name === name || child.type.displayName === name;
|
|
146
|
-
}) || null;
|
|
147
|
-
var ChildrenCompWithFile = /*#__PURE__*/isValidElement(ChildrenComp) ? /*#__PURE__*/cloneElement(ChildrenComp, {
|
|
148
|
-
file: file
|
|
149
|
-
}) : null;
|
|
150
|
-
return ChildrenCompWithFile;
|
|
151
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { withClient } from 'cozy-client';
|
|
4
|
-
import Button from "cozy-ui/transpiled/react/deprecated/Button";
|
|
5
|
-
import { FileDoctype } from "cozy-ui/transpiled/react/proptypes";
|
|
6
|
-
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
|
7
|
-
import { downloadFile } from "cozy-ui/transpiled/react/Viewer/helpers";
|
|
8
|
-
|
|
9
|
-
var DownloadButton = function DownloadButton(_ref) {
|
|
10
|
-
var client = _ref.client,
|
|
11
|
-
file = _ref.file,
|
|
12
|
-
url = _ref.url;
|
|
13
|
-
|
|
14
|
-
var _useI18n = useI18n(),
|
|
15
|
-
t = _useI18n.t;
|
|
16
|
-
|
|
17
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
18
|
-
onClick: function onClick() {
|
|
19
|
-
return downloadFile({
|
|
20
|
-
client: client,
|
|
21
|
-
file: file,
|
|
22
|
-
url: url
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
label: t('Viewer.download')
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
DownloadButton.propTypes = {
|
|
30
|
-
client: PropTypes.object.isRequired,
|
|
31
|
-
file: FileDoctype,
|
|
32
|
-
url: PropTypes.string
|
|
33
|
-
};
|
|
34
|
-
export default withClient(DownloadButton);
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
3
|
-
import FileTypeBinIcon from "cozy-ui/transpiled/react/Icons/FileTypeBin";
|
|
4
|
-
import FileTypeCodeIcon from "cozy-ui/transpiled/react/Icons/FileTypeCode";
|
|
5
|
-
import FileTypeFilesIcon from "cozy-ui/transpiled/react/Icons/FileTypeFiles";
|
|
6
|
-
import FileTypePdfIcon from "cozy-ui/transpiled/react/Icons/FileTypePdf";
|
|
7
|
-
import FileTypeSheetIcon from "cozy-ui/transpiled/react/Icons/FileTypeSheet";
|
|
8
|
-
import FileTypeSlideIcon from "cozy-ui/transpiled/react/Icons/FileTypeSlide";
|
|
9
|
-
import FileTypeTextIcon from "cozy-ui/transpiled/react/Icons/FileTypeText";
|
|
10
|
-
import FileTypeZipIcon from "cozy-ui/transpiled/react/Icons/FileTypeZip";
|
|
11
|
-
|
|
12
|
-
var FileIcon = function FileIcon(_ref) {
|
|
13
|
-
var type = _ref.type;
|
|
14
|
-
var icon;
|
|
15
|
-
|
|
16
|
-
switch (type) {
|
|
17
|
-
case 'bin':
|
|
18
|
-
icon = FileTypeBinIcon;
|
|
19
|
-
break;
|
|
20
|
-
|
|
21
|
-
case 'code':
|
|
22
|
-
icon = FileTypeCodeIcon;
|
|
23
|
-
break;
|
|
24
|
-
|
|
25
|
-
case 'spreadsheet':
|
|
26
|
-
icon = FileTypeSheetIcon;
|
|
27
|
-
break;
|
|
28
|
-
|
|
29
|
-
case 'slide':
|
|
30
|
-
icon = FileTypeSlideIcon;
|
|
31
|
-
break;
|
|
32
|
-
|
|
33
|
-
case 'text':
|
|
34
|
-
icon = FileTypeTextIcon;
|
|
35
|
-
break;
|
|
36
|
-
|
|
37
|
-
case 'zip':
|
|
38
|
-
icon = FileTypeZipIcon;
|
|
39
|
-
break;
|
|
40
|
-
|
|
41
|
-
case 'pdf':
|
|
42
|
-
icon = FileTypePdfIcon;
|
|
43
|
-
break;
|
|
44
|
-
|
|
45
|
-
default:
|
|
46
|
-
icon = FileTypeFilesIcon;
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
51
|
-
icon: icon,
|
|
52
|
-
width: 160,
|
|
53
|
-
height: 140
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default FileIcon;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import DownloadButton from "cozy-ui/transpiled/react/Viewer/NoViewer/DownloadButton";
|
|
4
|
-
import FileIcon from "cozy-ui/transpiled/react/Viewer/NoViewer/FileIcon";
|
|
5
|
-
import { FileDoctype } from "cozy-ui/transpiled/react/proptypes";
|
|
6
|
-
var styles = {
|
|
7
|
-
"viewer-imageviewer": "styles__viewer-imageviewer___26k0p",
|
|
8
|
-
"viewer-noviewer": "styles__viewer-noviewer___auG-6",
|
|
9
|
-
"viewer-audioviewer": "styles__viewer-audioviewer___1OQPB",
|
|
10
|
-
"viewer-videoviewer": "styles__viewer-videoviewer___NhFoe",
|
|
11
|
-
"viewer-pdfviewer": "styles__viewer-pdfviewer___1gTP9",
|
|
12
|
-
"viewer-textviewer": "styles__viewer-textviewer___3u5Zw",
|
|
13
|
-
"viewer-canceled": "styles__viewer-canceled___pOA_O",
|
|
14
|
-
"viewer-textviewer-content": "styles__viewer-textviewer-content___PB-c3",
|
|
15
|
-
"viewer-filename": "styles__viewer-filename___3jZCt",
|
|
16
|
-
"viewer-pdfviewer-pdf": "styles__viewer-pdfviewer-pdf___16ID9",
|
|
17
|
-
"viewer-pdfviewer-page": "styles__viewer-pdfviewer-page___2RPuw",
|
|
18
|
-
"viewer-pdfviewer-toolbar": "styles__viewer-pdfviewer-toolbar___3NXOk",
|
|
19
|
-
"viewer-pdfMobile": "styles__viewer-pdfMobile___25FPg",
|
|
20
|
-
"viewer-pdfMobile--image": "styles__viewer-pdfMobile--image___3gpFL"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
var NoViewer = function NoViewer(_ref) {
|
|
24
|
-
var file = _ref.file,
|
|
25
|
-
url = _ref.url,
|
|
26
|
-
renderFallbackExtraContent = _ref.renderFallbackExtraContent;
|
|
27
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
className: styles['viewer-noviewer']
|
|
29
|
-
}, /*#__PURE__*/React.createElement(FileIcon, {
|
|
30
|
-
type: file.class
|
|
31
|
-
}), /*#__PURE__*/React.createElement("p", {
|
|
32
|
-
className: styles['viewer-filename']
|
|
33
|
-
}, file.name), renderFallbackExtraContent(file, url));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
NoViewer.propTypes = {
|
|
37
|
-
file: FileDoctype.isRequired,
|
|
38
|
-
renderFallbackExtraContent: PropTypes.func,
|
|
39
|
-
url: PropTypes.string
|
|
40
|
-
};
|
|
41
|
-
NoViewer.defaultProps = {
|
|
42
|
-
renderFallbackExtraContent: function renderFallbackExtraContent(file, url) {
|
|
43
|
-
return /*#__PURE__*/React.createElement(DownloadButton, {
|
|
44
|
-
file: file,
|
|
45
|
-
url: url
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
export default NoViewer;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './NoViewer';
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
var styles = {
|
|
4
|
-
"ActionMenuDesktop-ActionMenu": "styles__ActionMenuDesktop-ActionMenu___1iicy",
|
|
5
|
-
"ActionMenuDesktop-ActionMenu-link-disabled": "styles__ActionMenuDesktop-ActionMenu-link-disabled___3QHjm"
|
|
6
|
-
};
|
|
7
|
-
import AppLinker from "cozy-ui/transpiled/react/AppLinker";
|
|
8
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
9
|
-
import Copy from "cozy-ui/transpiled/react/Icons/Copy";
|
|
10
|
-
import Edit from "cozy-ui/transpiled/react/Icons/Rename";
|
|
11
|
-
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
12
|
-
import ActionMenu, { ActionMenuItem } from "cozy-ui/transpiled/react/deprecated/ActionMenu";
|
|
13
|
-
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
|
14
|
-
var ActionMenuDesktop = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
15
|
-
var onClose = _ref.onClose,
|
|
16
|
-
isEditable = _ref.isEditable,
|
|
17
|
-
actions = _ref.actions,
|
|
18
|
-
appLink = _ref.appLink,
|
|
19
|
-
appSlug = _ref.appSlug;
|
|
20
|
-
var handleCopy = actions.handleCopy,
|
|
21
|
-
handleEdit = actions.handleEdit;
|
|
22
|
-
|
|
23
|
-
var _useI18n = useI18n(),
|
|
24
|
-
t = _useI18n.t;
|
|
25
|
-
|
|
26
|
-
return /*#__PURE__*/React.createElement(ActionMenu, {
|
|
27
|
-
className: styles['ActionMenuDesktop-ActionMenu'],
|
|
28
|
-
onClose: onClose,
|
|
29
|
-
anchorElRef: ref
|
|
30
|
-
}, isEditable && /*#__PURE__*/React.createElement(AppLinker, {
|
|
31
|
-
app: {
|
|
32
|
-
slug: appSlug
|
|
33
|
-
},
|
|
34
|
-
href: appLink
|
|
35
|
-
}, function (_ref2) {
|
|
36
|
-
var _onClick = _ref2.onClick,
|
|
37
|
-
href = _ref2.href;
|
|
38
|
-
return /*#__PURE__*/React.createElement("a", {
|
|
39
|
-
href: href,
|
|
40
|
-
onClick: function onClick() {
|
|
41
|
-
return handleEdit(_onClick);
|
|
42
|
-
}
|
|
43
|
-
}, /*#__PURE__*/React.createElement(ActionMenuItem, {
|
|
44
|
-
left: /*#__PURE__*/React.createElement(Icon, {
|
|
45
|
-
icon: Edit,
|
|
46
|
-
color: "var(--iconTextColor)"
|
|
47
|
-
})
|
|
48
|
-
}, /*#__PURE__*/React.createElement(Typography, null, t("Viewer.panel.qualification.actions.edit"))));
|
|
49
|
-
}), /*#__PURE__*/React.createElement(ActionMenuItem, {
|
|
50
|
-
onClick: handleCopy,
|
|
51
|
-
left: /*#__PURE__*/React.createElement(Icon, {
|
|
52
|
-
icon: Copy,
|
|
53
|
-
color: "var(--iconTextColor)"
|
|
54
|
-
})
|
|
55
|
-
}, /*#__PURE__*/React.createElement(Typography, null, t("Viewer.panel.qualification.actions.copy"))));
|
|
56
|
-
});
|
|
57
|
-
ActionMenuDesktop.displayName = 'ActionMenuDesktop';
|
|
58
|
-
ActionMenuDesktop.propTypes = {
|
|
59
|
-
onClose: PropTypes.func,
|
|
60
|
-
isEditable: PropTypes.bool,
|
|
61
|
-
actions: PropTypes.shape({
|
|
62
|
-
handleCopy: PropTypes.func,
|
|
63
|
-
handleEdit: PropTypes.func
|
|
64
|
-
}),
|
|
65
|
-
appLink: PropTypes.string,
|
|
66
|
-
appSlug: PropTypes.string
|
|
67
|
-
};
|
|
68
|
-
export default ActionMenuDesktop;
|