mirador-dl-plugin 0.12.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.
- package/README.md +19 -7
- package/es/CanvasDownloadLinks.js +224 -240
- package/es/ManifestDownloadLinks.js +26 -60
- package/es/MiradorDownloadDialog.js +99 -158
- package/es/RenderingDownloadLink.js +44 -51
- package/es/index.js +3 -5
- package/es/miradorDownloadPlugin.js +49 -84
- package/es/translations.js +39 -0
- package/lib/CanvasDownloadLinks.js +236 -277
- package/lib/ManifestDownloadLinks.js +33 -83
- package/lib/MiradorDownloadDialog.js +112 -203
- package/lib/RenderingDownloadLink.js +54 -76
- package/lib/index.js +22 -18
- package/lib/miradorDownloadPlugin.js +58 -110
- package/lib/translations.js +45 -0
- package/package.json +60 -31
- package/umd/mirador-dl-plugin.js +3 -21812
- package/umd/mirador-dl-plugin.js.LICENSE.txt +58 -0
- package/umd/mirador-dl-plugin.js.map +1 -0
- package/umd/mirador-dl-plugin.min.js +0 -42
- package/umd/mirador-dl-plugin.min.js.map +0 -1
|
@@ -1,284 +1,243 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
}
|