mirador-dl-plugin 0.13.0 → 1.0.0-alpha.1

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.
@@ -1,284 +1,243 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
- exports.default = undefined;
5
-
6
- var _react = require('react');
7
-
8
- var _react2 = _interopRequireDefault(_react);
9
-
10
- var _propTypes = require('prop-types');
11
-
12
- var _propTypes2 = _interopRequireDefault(_propTypes);
13
-
14
- var _Typography = require('@material-ui/core/Typography');
15
-
16
- var _Typography2 = _interopRequireDefault(_Typography);
17
-
18
- var _Link = require('@material-ui/core/Link');
19
-
20
- var _Link2 = _interopRequireDefault(_Link);
21
-
22
- var _List = require('@material-ui/core/List');
23
-
24
- var _List2 = _interopRequireDefault(_List);
25
-
26
- var _ListItem = require('@material-ui/core/ListItem');
27
-
28
- var _ListItem2 = _interopRequireDefault(_ListItem);
29
-
30
- var _uniqBy = require('lodash/uniqBy');
31
-
32
- var _uniqBy2 = _interopRequireDefault(_uniqBy);
33
-
34
- var _OSDReferences = require('mirador/dist/es/src/plugins/OSDReferences');
35
-
36
- var _RenderingDownloadLink = require('./RenderingDownloadLink');
37
-
38
- var _RenderingDownloadLink2 = _interopRequireDefault(_RenderingDownloadLink);
39
-
40
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
-
42
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43
-
44
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
45
-
46
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
47
-
48
- /**
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
9
+ var _mirador = require("mirador");
10
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
11
+ var _Link = _interopRequireDefault(require("@mui/material/Link"));
12
+ var _List = _interopRequireDefault(require("@mui/material/List"));
13
+ var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
14
+ var _RenderingDownloadLink = _interopRequireDefault(require("./RenderingDownloadLink"));
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
17
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
19
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
20
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
21
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
22
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
25
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
26
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
27
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
28
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
29
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
30
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /**
49
31
  * CanvasDownloadLinks ~
50
- */
51
- var CanvasDownloadLinks = function (_Component) {
52
- _inherits(CanvasDownloadLinks, _Component);
53
-
32
+ */
33
+ var CanvasDownloadLinks = exports["default"] = /*#__PURE__*/function (_Component) {
54
34
  function CanvasDownloadLinks() {
55
35
  _classCallCheck(this, CanvasDownloadLinks);
56
-
57
- return _possibleConstructorReturn(this, _Component.apply(this, arguments));
36
+ return _callSuper(this, CanvasDownloadLinks, arguments);
58
37
  }
59
-
60
- CanvasDownloadLinks.prototype.zoomedImageLabel = function zoomedImageLabel() {
61
- var bounds = this.currentBounds();
62
- return 'Zoomed region (' + Math.floor(bounds.width) + ' x ' + Math.floor(bounds.height) + 'px)';
63
- };
64
-
65
- CanvasDownloadLinks.prototype.fullImageLabel = function fullImageLabel() {
66
- var canvas = this.props.canvas;
67
-
68
-
69
- return 'Whole image (' + canvas.getWidth() + ' x ' + canvas.getHeight() + 'px)';
70
- };
71
-
72
- CanvasDownloadLinks.prototype.smallImageLabel = function smallImageLabel() {
73
- var canvas = this.props.canvas;
74
-
75
-
76
- return 'Whole image (1000 x ' + Math.floor(1000 * canvas.getHeight() / canvas.getWidth()) + 'px)';
77
- };
78
-
79
- CanvasDownloadLinks.prototype.zoomedImageUrl = function zoomedImageUrl() {
80
- var canvas = this.props.canvas;
81
-
82
- var bounds = this.currentBounds();
83
- var boundsUrl = canvas.getCanonicalImageUri().replace(/\/full\/.*\/0\//, '/' + bounds.x + ',' + bounds.y + ',' + bounds.width + ',' + bounds.height + '/full/0/');
84
-
85
- return boundsUrl + '?download=true';
86
- };
87
-
88
- CanvasDownloadLinks.prototype.imageUrlForSize = function imageUrlForSize(size) {
89
- var canvas = this.props.canvas;
90
-
91
-
92
- return canvas.getCanonicalImageUri(size.width) + '?download=true';
93
- };
94
-
95
- CanvasDownloadLinks.prototype.fullImageUrl = function fullImageUrl() {
96
- var canvas = this.props.canvas;
97
-
98
-
99
- return canvas.getCanonicalImageUri().replace(/\/full\/.*\/0\//, '/full/full/0/') + '?download=true';
100
- };
101
-
102
- CanvasDownloadLinks.prototype.thousandPixelWideImage = function thousandPixelWideImage() {
103
- var canvas = this.props.canvas;
104
-
105
-
106
- return canvas.getCanonicalImageUri('1000') + '?download=true';
107
- };
108
-
109
- CanvasDownloadLinks.prototype.osdViewport = function osdViewport() {
110
- var windowId = this.props.windowId;
111
-
112
-
113
- return _OSDReferences.OSDReferences.get(windowId).current.viewport;
114
- };
115
-
116
- CanvasDownloadLinks.prototype.currentBounds = function currentBounds() {
117
- var bounds = this.osdViewport().getBounds();
118
-
119
- return Object.keys(bounds).reduce(function (object, key) {
120
- object[key] = Math.ceil(bounds[key]); // eslint-disable-line no-param-reassign
121
- return object;
122
- }, {});
123
- };
124
-
125
- CanvasDownloadLinks.prototype.definedSizesRestrictsDownload = function definedSizesRestrictsDownload() {
126
- var infoResponse = this.props.infoResponse;
127
-
128
- if (!infoResponse.json) return false;
129
- var _infoResponse$json = infoResponse.json,
38
+ _inherits(CanvasDownloadLinks, _Component);
39
+ return _createClass(CanvasDownloadLinks, [{
40
+ key: "zoomedImageLabel",
41
+ value: function zoomedImageLabel() {
42
+ var t = this.props.t;
43
+ var bounds = this.currentBounds();
44
+ return t('mirador-dl-plugin.zoomed_region', {
45
+ width: Math.floor(bounds.width),
46
+ height: Math.floor(bounds.height)
47
+ });
48
+ }
49
+ }, {
50
+ key: "fullImageLabel",
51
+ value: function fullImageLabel() {
52
+ var _this$props = this.props,
53
+ canvas = _this$props.canvas,
54
+ t = _this$props.t;
55
+ return t('mirador-dl-plugin.whole_image', {
56
+ width: canvas.getWidth(),
57
+ height: canvas.getHeight()
58
+ });
59
+ }
60
+ }, {
61
+ key: "smallImageLabel",
62
+ value: function smallImageLabel() {
63
+ var _this$props2 = this.props,
64
+ canvas = _this$props2.canvas,
65
+ t = _this$props2.t;
66
+ var height = Math.floor(1000 * canvas.getHeight() / canvas.getWidth());
67
+ return t('mirador-dl-plugin.whole_image', {
68
+ width: 1000,
69
+ height: height
70
+ });
71
+ }
72
+ }, {
73
+ key: "zoomedImageUrl",
74
+ value: function zoomedImageUrl() {
75
+ var canvas = this.props.canvas;
76
+ var bounds = this.currentBounds();
77
+ var boundsUrl = canvas.getCanonicalImageUri().replace(/\/full\/.*\/0\//, "/".concat(bounds.x, ",").concat(bounds.y, ",").concat(bounds.width, ",").concat(bounds.height, "/full/0/"));
78
+ return "".concat(boundsUrl, "?download=true");
79
+ }
80
+ }, {
81
+ key: "imageUrlForSize",
82
+ value: function imageUrlForSize(size) {
83
+ var canvas = this.props.canvas;
84
+ return "".concat(canvas.getCanonicalImageUri(size.width), "?download=true");
85
+ }
86
+ }, {
87
+ key: "fullImageUrl",
88
+ value: function fullImageUrl() {
89
+ var canvas = this.props.canvas;
90
+ return "".concat(canvas.getCanonicalImageUri().replace(/\/full\/.*\/0\//, '/full/full/0/'), "?download=true");
91
+ }
92
+ }, {
93
+ key: "thousandPixelWideImage",
94
+ value: function thousandPixelWideImage() {
95
+ var canvas = this.props.canvas;
96
+ return "".concat(canvas.getCanonicalImageUri('1000'), "?download=true");
97
+ }
98
+ }, {
99
+ key: "osdViewport",
100
+ value: function osdViewport() {
101
+ var windowId = this.props.windowId;
102
+ return _mirador.OSDReferences.get(windowId).current.viewport;
103
+ }
104
+ }, {
105
+ key: "currentBounds",
106
+ value: function currentBounds() {
107
+ var bounds = this.osdViewport().getBounds();
108
+ return Object.keys(bounds).reduce(function (object, key) {
109
+ object[key] = Math.ceil(bounds[key]); // eslint-disable-line no-param-reassign
110
+ return object;
111
+ }, {});
112
+ }
113
+ }, {
114
+ key: "definedSizesRestrictsDownload",
115
+ value: function definedSizesRestrictsDownload() {
116
+ var infoResponse = this.props.infoResponse;
117
+ if (!infoResponse.json) return false;
118
+ var _infoResponse$json = infoResponse.json,
130
119
  height = _infoResponse$json.height,
131
120
  width = _infoResponse$json.width;
132
-
133
-
134
- if (this.definedSizes().length !== 1) return false;
135
-
136
- return this.definedSizes()[0].width <= width && this.definedSizes()[0].height <= height;
137
- };
138
-
139
- CanvasDownloadLinks.prototype.displayCurrentZoomLink = function displayCurrentZoomLink() {
140
- var _props = this.props,
141
- restrictDownloadOnSizeDefinition = _props.restrictDownloadOnSizeDefinition,
142
- infoResponse = _props.infoResponse,
143
- viewType = _props.viewType;
144
-
145
-
146
- if (viewType !== 'single') return false;
147
- if (restrictDownloadOnSizeDefinition && this.definedSizesRestrictsDownload()) return false;
148
- if (!(infoResponse && infoResponse.json)) return false;
149
-
150
- var bounds = this.currentBounds();
151
- return bounds.height < infoResponse.json.height && bounds.width < infoResponse.json.width && bounds.x >= 0 && bounds.y >= 0;
152
- };
153
-
154
- /**
155
- * This only returns unique sizes
156
- */
157
-
158
-
159
- CanvasDownloadLinks.prototype.definedSizes = function definedSizes() {
160
- var infoResponse = this.props.infoResponse;
161
-
162
- if (!(infoResponse && infoResponse.json && infoResponse.json.sizes)) return [];
163
-
164
- return (0, _uniqBy2.default)(infoResponse.json.sizes, function (size) {
165
- return '' + size.width + size.height;
166
- });
167
- };
168
-
169
- CanvasDownloadLinks.prototype.fullImageLink = function fullImageLink() {
170
- return _react2.default.createElement(
171
- _ListItem2.default,
172
- { disableGutters: true, divider: true, key: this.fullImageUrl() },
173
- _react2.default.createElement(
174
- _Link2.default,
175
- { href: this.fullImageUrl(), rel: 'noopener noreferrer', target: '_blank', variant: 'body1' },
176
- this.fullImageLabel()
177
- )
178
- );
179
- };
180
-
181
- CanvasDownloadLinks.prototype.thousandPixelWideLink = function thousandPixelWideLink() {
182
- var canvas = this.props.canvas;
183
-
184
-
185
- if (canvas.getWidth() < 1000) return '';
186
-
187
- return _react2.default.createElement(
188
- _ListItem2.default,
189
- { disableGutters: true, divider: true, key: this.thousandPixelWideImage() },
190
- _react2.default.createElement(
191
- _Link2.default,
192
- { href: this.thousandPixelWideImage(), rel: 'noopener noreferrer', target: '_blank', variant: 'body1' },
193
- this.smallImageLabel()
194
- )
195
- );
196
- };
197
-
198
- CanvasDownloadLinks.prototype.linksForDefinedSizes = function linksForDefinedSizes() {
199
- var _this2 = this;
200
-
201
- return this.definedSizes().map(function (size) {
202
- return _react2.default.createElement(
203
- _ListItem2.default,
204
- { disableGutters: true, divider: true, key: '' + size.width + size.height },
205
- _react2.default.createElement(
206
- _Link2.default,
207
- { href: _this2.imageUrlForSize(size), rel: 'noopener noreferrer', target: '_blank', variant: 'body1' },
208
- 'Whole image (' + size.width + ' x ' + size.height + 'px)'
209
- )
210
- );
211
- });
212
- };
213
-
214
- /**
215
- * Returns the rendered component
216
- */
217
-
218
-
219
- CanvasDownloadLinks.prototype.render = function render() {
220
- var _props2 = this.props,
221
- canvas = _props2.canvas,
222
- canvasLabel = _props2.canvasLabel,
223
- classes = _props2.classes;
224
-
225
-
226
- return _react2.default.createElement(
227
- _react2.default.Fragment,
228
- null,
229
- _react2.default.createElement(
230
- _Typography2.default,
231
- { noWrap: true, variant: 'h3', className: classes.h3 },
232
- canvasLabel
233
- ),
234
- _react2.default.createElement(
235
- _List2.default,
236
- null,
237
- this.displayCurrentZoomLink() && _react2.default.createElement(
238
- _ListItem2.default,
239
- { disableGutters: true, divider: true },
240
- _react2.default.createElement(
241
- _Link2.default,
242
- { href: this.zoomedImageUrl(), rel: 'noopener noreferrer', target: '_blank', variant: 'body1' },
243
- this.zoomedImageLabel()
244
- )
245
- ),
246
- this.definedSizes().length === 0 && [this.fullImageLink(), this.thousandPixelWideLink()],
247
- this.definedSizes().length > 0 && this.linksForDefinedSizes(),
248
- canvas.getRenderings().map(function (rendering) {
249
- return _react2.default.createElement(_RenderingDownloadLink2.default, { rendering: rendering, key: rendering.id });
121
+ if (this.definedSizes().length !== 1) return false;
122
+ return this.definedSizes()[0].width <= width && this.definedSizes()[0].height <= height;
123
+ }
124
+ }, {
125
+ key: "displayCurrentZoomLink",
126
+ value: function displayCurrentZoomLink() {
127
+ var _this$props3 = this.props,
128
+ restrictDownloadOnSizeDefinition = _this$props3.restrictDownloadOnSizeDefinition,
129
+ infoResponse = _this$props3.infoResponse,
130
+ viewType = _this$props3.viewType;
131
+ if (viewType !== 'single') return false;
132
+ if (restrictDownloadOnSizeDefinition && this.definedSizesRestrictsDownload()) return false;
133
+ if (!(infoResponse && infoResponse.json)) return false;
134
+ var bounds = this.currentBounds();
135
+ return bounds.height < infoResponse.json.height && bounds.width < infoResponse.json.width && bounds.x >= 0 && bounds.y >= 0;
136
+ }
137
+
138
+ /**
139
+ * This only returns unique sizes
140
+ */
141
+ }, {
142
+ key: "definedSizes",
143
+ value: function definedSizes() {
144
+ var infoResponse = this.props.infoResponse;
145
+ if (!(infoResponse && infoResponse.json && infoResponse.json.sizes)) return [];
146
+ return (0, _uniqBy["default"])(infoResponse.json.sizes, function (size) {
147
+ return "".concat(size.width).concat(size.height);
148
+ });
149
+ }
150
+ }, {
151
+ key: "fullImageLink",
152
+ value: function fullImageLink() {
153
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem["default"], {
154
+ disableGutters: true,
155
+ divider: true,
156
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link["default"], {
157
+ href: this.fullImageUrl(),
158
+ rel: "noopener noreferrer",
159
+ target: "_blank",
160
+ variant: "body1",
161
+ children: this.fullImageLabel()
250
162
  })
251
- )
252
- );
253
- };
254
-
255
- return CanvasDownloadLinks;
256
- }(_react.Component);
257
-
258
- exports.default = CanvasDownloadLinks;
259
-
260
-
261
- CanvasDownloadLinks.propTypes = process.env.NODE_ENV !== "production" ? {
262
- canvas: _propTypes2.default.shape({
263
- id: _propTypes2.default.string.isRequired,
264
- getCanonicalImageUri: _propTypes2.default.func.isRequired,
265
- getHeight: _propTypes2.default.func.isRequired,
266
- getRenderings: _propTypes2.default.func.isRequired,
267
- getWidth: _propTypes2.default.func.isRequired
268
- }).isRequired,
269
- canvasLabel: _propTypes2.default.string.isRequired, // canvasLabel is passed because we need access to redux
270
- classes: _propTypes2.default.shape({
271
- h3: _propTypes2.default.string
272
- }).isRequired,
273
- infoResponse: _propTypes2.default.shape({
274
- json: _propTypes2.default.shape({
275
- height: _propTypes2.default.number,
276
- sizes: _propTypes2.default.arrayOf(_propTypes2.default.shape({ height: _propTypes2.default.number, width: _propTypes2.default.number })),
277
- width: _propTypes2.default.number
278
- })
279
- }).isRequired,
280
- restrictDownloadOnSizeDefinition: _propTypes2.default.bool.isRequired,
281
- viewType: _propTypes2.default.string.isRequired,
282
- windowId: _propTypes2.default.string.isRequired
283
- } : {};
284
- module.exports = exports['default'];
163
+ }, this.fullImageUrl());
164
+ }
165
+ }, {
166
+ key: "thousandPixelWideLink",
167
+ value: function thousandPixelWideLink() {
168
+ var canvas = this.props.canvas;
169
+ if (canvas.getWidth() < 1000) return '';
170
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem["default"], {
171
+ disableGutters: true,
172
+ divider: true,
173
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link["default"], {
174
+ href: this.thousandPixelWideImage(),
175
+ rel: "noopener noreferrer",
176
+ target: "_blank",
177
+ variant: "body1",
178
+ children: this.smallImageLabel()
179
+ })
180
+ }, this.thousandPixelWideImage());
181
+ }
182
+ }, {
183
+ key: "linksForDefinedSizes",
184
+ value: function linksForDefinedSizes() {
185
+ var _this = this;
186
+ var t = this.props.t;
187
+ return this.definedSizes().map(function (size) {
188
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem["default"], {
189
+ disableGutters: true,
190
+ divider: true,
191
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link["default"], {
192
+ href: _this.imageUrlForSize(size),
193
+ rel: "noopener noreferrer",
194
+ target: "_blank",
195
+ variant: "body1",
196
+ children: t('mirador-dl-plugin.whole_image', {
197
+ width: size.width,
198
+ height: size.height
199
+ })
200
+ })
201
+ }, "".concat(size.width).concat(size.height));
202
+ });
203
+ }
204
+
205
+ /**
206
+ * Returns the rendered component
207
+ */
208
+ }, {
209
+ key: "render",
210
+ value: function render() {
211
+ var _this$props4 = this.props,
212
+ canvas = _this$props4.canvas,
213
+ canvasLabel = _this$props4.canvasLabel;
214
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
215
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography["default"], {
216
+ noWrap: true,
217
+ variant: "h3",
218
+ sx: {
219
+ marginTop: '20px'
220
+ },
221
+ children: canvasLabel
222
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_List["default"], {
223
+ children: [this.displayCurrentZoomLink() && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem["default"], {
224
+ disableGutters: true,
225
+ divider: true,
226
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link["default"], {
227
+ href: this.zoomedImageUrl(),
228
+ download: true,
229
+ rel: "noopener noreferrer",
230
+ target: "_blank",
231
+ variant: "body1",
232
+ children: this.zoomedImageLabel()
233
+ })
234
+ }), this.definedSizes().length === 0 && [this.fullImageLink(), this.thousandPixelWideLink()], this.definedSizes().length > 0 && this.linksForDefinedSizes(), canvas.getRenderings().map(function (rendering) {
235
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderingDownloadLink["default"], {
236
+ rendering: rendering
237
+ }, rendering.id);
238
+ })]
239
+ })]
240
+ });
241
+ }
242
+ }]);
243
+ }(_react.Component);
@@ -1,85 +1,35 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
- exports.default = undefined;
5
-
6
- var _react = require('react');
7
-
8
- var _react2 = _interopRequireDefault(_react);
9
-
10
- var _propTypes = require('prop-types');
11
-
12
- var _propTypes2 = _interopRequireDefault(_propTypes);
13
-
14
- var _List = require('@material-ui/core/List');
15
-
16
- var _List2 = _interopRequireDefault(_List);
17
-
18
- var _Typography = require('@material-ui/core/Typography');
19
-
20
- var _Typography2 = _interopRequireDefault(_Typography);
21
-
22
- var _RenderingDownloadLink = require('./RenderingDownloadLink');
23
-
24
- var _RenderingDownloadLink2 = _interopRequireDefault(_RenderingDownloadLink);
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
-
30
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
31
-
32
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
33
-
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = ManifestDownloadLinks;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactI18next = require("react-i18next");
9
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
10
+ var _List = _interopRequireDefault(require("@mui/material/List"));
11
+ var _RenderingDownloadLink = _interopRequireDefault(require("./RenderingDownloadLink"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
34
14
  /**
35
15
  * ManifestDownloadLinks ~
36
- */
37
- var ManifestDownloadLinks = function (_Component) {
38
- _inherits(ManifestDownloadLinks, _Component);
39
-
40
- function ManifestDownloadLinks() {
41
- _classCallCheck(this, ManifestDownloadLinks);
42
-
43
- return _possibleConstructorReturn(this, _Component.apply(this, arguments));
44
- }
45
-
46
- /**
47
- * Returns the rendered component
48
- */
49
- ManifestDownloadLinks.prototype.render = function render() {
50
- var _props = this.props,
51
- classes = _props.classes,
52
- renderings = _props.renderings;
53
-
54
-
55
- return _react2.default.createElement(
56
- _react2.default.Fragment,
57
- null,
58
- _react2.default.createElement(
59
- _Typography2.default,
60
- { variant: 'h3', className: classes.h3 },
61
- 'Other download options'
62
- ),
63
- _react2.default.createElement(
64
- _List2.default,
65
- null,
66
- renderings.map(function (rendering) {
67
- return _react2.default.createElement(_RenderingDownloadLink2.default, { rendering: rendering, key: rendering.id });
68
- })
69
- )
70
- );
71
- };
72
-
73
- return ManifestDownloadLinks;
74
- }(_react.Component);
75
-
76
- exports.default = ManifestDownloadLinks;
77
-
78
-
79
- ManifestDownloadLinks.propTypes = process.env.NODE_ENV !== "production" ? {
80
- classes: _propTypes2.default.shape({
81
- h3: _propTypes2.default.string
82
- }).isRequired,
83
- renderings: _propTypes2.default.array.isRequired // eslint-disable-line react/forbid-prop-types
84
- } : {};
85
- module.exports = exports['default'];
16
+ */function ManifestDownloadLinks(_ref) {
17
+ var renderings = _ref.renderings;
18
+ var _useTranslation = (0, _reactI18next.useTranslation)(),
19
+ t = _useTranslation.t;
20
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
21
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography["default"], {
22
+ variant: "h3",
23
+ sx: {
24
+ marginTop: '20px'
25
+ },
26
+ children: t('mirador-dl-plugin.other_download')
27
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_List["default"], {
28
+ children: renderings.map(function (rendering) {
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderingDownloadLink["default"], {
30
+ rendering: rendering
31
+ }, rendering.id);
32
+ })
33
+ })]
34
+ });
35
+ }