@teipublisher/pb-components 2.22.1 → 2.23.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/dist/demo/demos.json +2 -1
- package/dist/demo/pb-facsimile-3.html +71 -0
- package/dist/pb-components-bundle.js +74 -51
- package/dist/pb-elements.json +26 -0
- package/package.json +1 -1
- package/pb-elements.json +26 -0
- package/src/pb-facsimile.js +69 -9
- package/src/pb-grid.js +1 -1
package/dist/pb-elements.json
CHANGED
|
@@ -4149,6 +4149,12 @@
|
|
|
4149
4149
|
"type": "string",
|
|
4150
4150
|
"default": "\"\""
|
|
4151
4151
|
},
|
|
4152
|
+
{
|
|
4153
|
+
"name": "cors",
|
|
4154
|
+
"description": "CORS (Cross-Origin Resource Sharing) policy - wraps the OSD Viewer option -\nonly sensible values are 'anonymous' (default) or 'use-credentials'.",
|
|
4155
|
+
"type": "string",
|
|
4156
|
+
"default": "\"anonymous\""
|
|
4157
|
+
},
|
|
4152
4158
|
{
|
|
4153
4159
|
"name": "type",
|
|
4154
4160
|
"description": "Type of the source of the image to display: either 'iiif' or 'image'\n(for simple image links not served via IIIF).",
|
|
@@ -4196,6 +4202,12 @@
|
|
|
4196
4202
|
"type": "boolean",
|
|
4197
4203
|
"default": "false"
|
|
4198
4204
|
},
|
|
4205
|
+
{
|
|
4206
|
+
"name": "show-download-control",
|
|
4207
|
+
"description": "if true shows a 'download' button",
|
|
4208
|
+
"type": "boolean",
|
|
4209
|
+
"default": "false"
|
|
4210
|
+
},
|
|
4199
4211
|
{
|
|
4200
4212
|
"name": "contrain-during-pan",
|
|
4201
4213
|
"type": "boolean",
|
|
@@ -4276,6 +4288,13 @@
|
|
|
4276
4288
|
"type": "string",
|
|
4277
4289
|
"default": "\"\""
|
|
4278
4290
|
},
|
|
4291
|
+
{
|
|
4292
|
+
"name": "crossOriginPolicy",
|
|
4293
|
+
"attribute": "cors",
|
|
4294
|
+
"description": "CORS (Cross-Origin Resource Sharing) policy - wraps the OSD Viewer option -\nonly sensible values are 'anonymous' (default) or 'use-credentials'.",
|
|
4295
|
+
"type": "string",
|
|
4296
|
+
"default": "\"anonymous\""
|
|
4297
|
+
},
|
|
4279
4298
|
{
|
|
4280
4299
|
"name": "type",
|
|
4281
4300
|
"attribute": "type",
|
|
@@ -4336,6 +4355,13 @@
|
|
|
4336
4355
|
"type": "boolean",
|
|
4337
4356
|
"default": "false"
|
|
4338
4357
|
},
|
|
4358
|
+
{
|
|
4359
|
+
"name": "showDownloadButton",
|
|
4360
|
+
"attribute": "show-download-control",
|
|
4361
|
+
"description": "if true shows a 'download' button",
|
|
4362
|
+
"type": "boolean",
|
|
4363
|
+
"default": "false"
|
|
4364
|
+
},
|
|
4339
4365
|
{
|
|
4340
4366
|
"name": "constrainDuringPan",
|
|
4341
4367
|
"attribute": "contrain-during-pan",
|
package/package.json
CHANGED
package/pb-elements.json
CHANGED
|
@@ -4149,6 +4149,12 @@
|
|
|
4149
4149
|
"type": "string",
|
|
4150
4150
|
"default": "\"\""
|
|
4151
4151
|
},
|
|
4152
|
+
{
|
|
4153
|
+
"name": "cors",
|
|
4154
|
+
"description": "CORS (Cross-Origin Resource Sharing) policy - wraps the OSD Viewer option -\nonly sensible values are 'anonymous' (default) or 'use-credentials'.",
|
|
4155
|
+
"type": "string",
|
|
4156
|
+
"default": "\"anonymous\""
|
|
4157
|
+
},
|
|
4152
4158
|
{
|
|
4153
4159
|
"name": "type",
|
|
4154
4160
|
"description": "Type of the source of the image to display: either 'iiif' or 'image'\n(for simple image links not served via IIIF).",
|
|
@@ -4196,6 +4202,12 @@
|
|
|
4196
4202
|
"type": "boolean",
|
|
4197
4203
|
"default": "false"
|
|
4198
4204
|
},
|
|
4205
|
+
{
|
|
4206
|
+
"name": "show-download-control",
|
|
4207
|
+
"description": "if true shows a 'download' button",
|
|
4208
|
+
"type": "boolean",
|
|
4209
|
+
"default": "false"
|
|
4210
|
+
},
|
|
4199
4211
|
{
|
|
4200
4212
|
"name": "contrain-during-pan",
|
|
4201
4213
|
"type": "boolean",
|
|
@@ -4276,6 +4288,13 @@
|
|
|
4276
4288
|
"type": "string",
|
|
4277
4289
|
"default": "\"\""
|
|
4278
4290
|
},
|
|
4291
|
+
{
|
|
4292
|
+
"name": "crossOriginPolicy",
|
|
4293
|
+
"attribute": "cors",
|
|
4294
|
+
"description": "CORS (Cross-Origin Resource Sharing) policy - wraps the OSD Viewer option -\nonly sensible values are 'anonymous' (default) or 'use-credentials'.",
|
|
4295
|
+
"type": "string",
|
|
4296
|
+
"default": "\"anonymous\""
|
|
4297
|
+
},
|
|
4279
4298
|
{
|
|
4280
4299
|
"name": "type",
|
|
4281
4300
|
"attribute": "type",
|
|
@@ -4336,6 +4355,13 @@
|
|
|
4336
4355
|
"type": "boolean",
|
|
4337
4356
|
"default": "false"
|
|
4338
4357
|
},
|
|
4358
|
+
{
|
|
4359
|
+
"name": "showDownloadButton",
|
|
4360
|
+
"attribute": "show-download-control",
|
|
4361
|
+
"description": "if true shows a 'download' button",
|
|
4362
|
+
"type": "boolean",
|
|
4363
|
+
"default": "false"
|
|
4364
|
+
},
|
|
4339
4365
|
{
|
|
4340
4366
|
"name": "constrainDuringPan",
|
|
4341
4367
|
"attribute": "contrain-during-pan",
|
package/src/pb-facsimile.js
CHANGED
|
@@ -58,6 +58,13 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
58
58
|
type: Boolean,
|
|
59
59
|
attribute: 'show-full-page-control'
|
|
60
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* if true shows a 'download' button
|
|
63
|
+
*/
|
|
64
|
+
showDownloadButton:{
|
|
65
|
+
type: Boolean,
|
|
66
|
+
attribute: 'show-download-control'
|
|
67
|
+
},
|
|
61
68
|
/**
|
|
62
69
|
* Default zoom between: set to 0 to adjust to viewer size.
|
|
63
70
|
*/
|
|
@@ -138,6 +145,14 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
138
145
|
loaded: {
|
|
139
146
|
type: Boolean,
|
|
140
147
|
reflect: true
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* CORS (Cross-Origin Resource Sharing) policy - wraps the OSD Viewer option -
|
|
151
|
+
* only sensible values are 'anonymous' (default) or 'use-credentials'.
|
|
152
|
+
*/
|
|
153
|
+
crossOriginPolicy:{
|
|
154
|
+
type: String,
|
|
155
|
+
attribute: 'cors'
|
|
141
156
|
}
|
|
142
157
|
};
|
|
143
158
|
}
|
|
@@ -146,6 +161,7 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
146
161
|
super();
|
|
147
162
|
this._facsimiles = [];
|
|
148
163
|
this.baseUri = '';
|
|
164
|
+
this.crossOriginPolicy = 'anonymous';
|
|
149
165
|
this.type = 'iiif';
|
|
150
166
|
this.visibilityRatio = 1;
|
|
151
167
|
this.defaultZoomLevel = 0;
|
|
@@ -155,6 +171,7 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
155
171
|
this.showNavigationControl = false;
|
|
156
172
|
this.showFullPageControl = false;
|
|
157
173
|
this.showRotationControl = false;
|
|
174
|
+
this.showDownloadButton = false;
|
|
158
175
|
this.constrainDuringPan = false;
|
|
159
176
|
this.referenceStrip = false;
|
|
160
177
|
this.referenceStripSizeRatio = 0.2;
|
|
@@ -189,22 +206,31 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
189
206
|
}
|
|
190
207
|
|
|
191
208
|
firstUpdated() {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
209
|
+
try{
|
|
210
|
+
window.ESGlobalBridge.requestAvailability();
|
|
211
|
+
const path = resolveURL('../lib/openseadragon.min.js');
|
|
212
|
+
window.ESGlobalBridge.instance.load("openseadragon", path);
|
|
213
|
+
window.addEventListener(
|
|
214
|
+
"es-bridge-openseadragon-loaded",
|
|
215
|
+
this._initOpenSeadragon.bind(this),
|
|
216
|
+
{ once: true }
|
|
217
|
+
);
|
|
218
|
+
} catch (error){
|
|
219
|
+
console.error(error.message);
|
|
220
|
+
}
|
|
200
221
|
}
|
|
201
222
|
|
|
202
223
|
render() {
|
|
203
224
|
return html`
|
|
204
225
|
<slot name="before"></slot>
|
|
205
226
|
<!-- Openseadragon -->
|
|
227
|
+
|
|
206
228
|
<div id="viewer" part="image"></div>
|
|
207
229
|
<slot name="after"></slot>
|
|
230
|
+
${this.showDownloadButton ?
|
|
231
|
+
html`<a id="downloadBtn" title="Download">⇤</a>`:''
|
|
232
|
+
}
|
|
233
|
+
|
|
208
234
|
`;
|
|
209
235
|
}
|
|
210
236
|
|
|
@@ -227,6 +253,26 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
227
253
|
max-height: var(--pb-facsimile-height, auto);
|
|
228
254
|
width: 100%;
|
|
229
255
|
}
|
|
256
|
+
#downloadBtn{
|
|
257
|
+
position: absolute;
|
|
258
|
+
z-index: 100;
|
|
259
|
+
bottom:0.25rem;
|
|
260
|
+
width:1.35rem;
|
|
261
|
+
height:1.35rem;
|
|
262
|
+
transform:rotate(-90deg);
|
|
263
|
+
cursor: pointer;
|
|
264
|
+
border: thin solid #D7DDE8;
|
|
265
|
+
display: flex;
|
|
266
|
+
align-items: center;
|
|
267
|
+
justify-content: center;
|
|
268
|
+
border-radius:0.75rem;
|
|
269
|
+
background-image:linear-gradient(to left, #fafafa 0%, #D7DDE8 51%, #bbbbbb 100%);
|
|
270
|
+
font-size:1.2rem;
|
|
271
|
+
box-shadow: -2px 1px 5px 0px rgba(0,0,0,0.75);
|
|
272
|
+
}
|
|
273
|
+
#downloadBtn:hover{
|
|
274
|
+
background-image:radial-gradient( white, #efefef);
|
|
275
|
+
}
|
|
230
276
|
`;
|
|
231
277
|
}
|
|
232
278
|
|
|
@@ -248,8 +294,10 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
248
294
|
visibilityRatio: 1,
|
|
249
295
|
minZoomLevel: 1,
|
|
250
296
|
defaultZoomLevel: this.defaultZoomLevel,
|
|
251
|
-
constrainDuringPan: true
|
|
297
|
+
constrainDuringPan: true,
|
|
298
|
+
crossOriginPolicy: this.crossOriginPolicy
|
|
252
299
|
};
|
|
300
|
+
|
|
253
301
|
if (this.referenceStrip) {
|
|
254
302
|
options.showReferenceStrip = true;
|
|
255
303
|
options.referenceStripSizeRatio = this.referenceStripSizeRatio;
|
|
@@ -266,6 +314,18 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
266
314
|
this.emitTo('pb-facsimile-status', { status: 'fail' });
|
|
267
315
|
});
|
|
268
316
|
|
|
317
|
+
const download = this.shadowRoot.querySelector('#downloadBtn');
|
|
318
|
+
if(this.showDownloadButton){
|
|
319
|
+
download.addEventListener('click', (ev) => {
|
|
320
|
+
ev.preventDefault();
|
|
321
|
+
const currentImage = this.viewer.drawer.canvas.toDataURL("image/png");
|
|
322
|
+
const downloadLink = document.createElement('a');
|
|
323
|
+
downloadLink.href = currentImage;
|
|
324
|
+
downloadLink.download = 'download';
|
|
325
|
+
downloadLink.click();
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
269
329
|
/*
|
|
270
330
|
handling of full-screen view requires to hide/unhide the content of body to allow full screen viewer
|
|
271
331
|
to full-page functionality. Standard OSD completely deletes all body children disconnecting all event-handlers
|
package/src/pb-grid.js
CHANGED