xconcepts-stencil-pdfviewer
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -5,3 +5,3 @@ 'use strict'; | ||
const index = require('./index-c1a2f01c.js'); | ||
const index = require('./index-cb785df9.js'); | ||
@@ -18,3 +18,3 @@ /* | ||
return patchEsm().then(() => { | ||
return index.bootstrapLazy([["xc-pdf-viewer.cjs",[[1,"xc-pdf-viewer",{"src":[1],"filename":[1]}]]]], options); | ||
return index.bootstrapLazy([["xc-pdf-viewer.cjs",[[1,"xc-pdf-viewer",{"src":[1],"filename":[1],"hidePrint":[4,"hide-print"],"hideDownload":[4,"hide-download"],"isMobile":[4,"is-mobile"]}]]]], options); | ||
}); | ||
@@ -21,0 +21,0 @@ }; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const index = require('./index-c1a2f01c.js'); | ||
const index = require('./index-cb785df9.js'); | ||
@@ -997,2 +997,3 @@ function getDefaultExportFromCjs (x) { | ||
index.registerInstance(this, hostRef); | ||
this.download = index.createEvent(this, "download", 7); | ||
this.defaultFilename = "document.pdf"; | ||
@@ -1003,2 +1004,5 @@ this.page = 1; | ||
this.filename = undefined; | ||
this.hidePrint = false; | ||
this.hideDownload = false; | ||
this.isMobile = false; | ||
} | ||
@@ -1051,8 +1055,14 @@ async componentDidLoad() { | ||
handleDownload() { | ||
const link = document.createElement('a'); | ||
link.href = this.src; | ||
link.download = this.filename ? this.filename : this.defaultFilename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
if (!this.isMobile) { | ||
const link = document.createElement('a'); | ||
link.href = this.src; | ||
link.download = this.filename ? this.filename : this.defaultFilename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
this.download.emit(this.src); | ||
} | ||
else { | ||
this.download.emit(this.src); | ||
} | ||
} | ||
@@ -1075,4 +1085,21 @@ componentDidUpdate() { | ||
} | ||
renderPrintButton() { | ||
// console.log(this.hidePrint); | ||
if (this.hidePrint) { | ||
return ""; | ||
} | ||
else { | ||
return (index.h("button", { class: "tools", onClick: () => this.handlePrint() }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, index.h("path", { d: "M5 4.5C5 3.67 5.67 3 6.5 3h7c.83 0 1.5.67 1.5 1.5V5h.5A2.5 2.5 0 0118 7.5v5c0 .83-.67 1.5-1.5 1.5H15v1.5c0 .83-.67 1.5-1.5 1.5h-7A1.5 1.5 0 015 15.5V14H3.5A1.5 1.5 0 012 12.5v-5A2.5 2.5 0 014.5 5H5v-.5zM6 5h8v-.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V5zm-1 8v-1.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V13h1.5a.5.5 0 00.5-.5v-5c0-.83-.67-1.5-1.5-1.5h-11C3.67 6 3 6.67 3 7.5v5c0 .28.22.5.5.5H5zm1.5-2a.5.5 0 00-.5.5v4c0 .28.22.5.5.5h7a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5h-7z", "fill-rule": "nonzero" })))); | ||
} | ||
} | ||
renderDownloadButton() { | ||
if (this.hideDownload) { | ||
return ""; | ||
} | ||
else { | ||
return (index.h("button", { class: "tools", onClick: () => this.handleDownload() }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, index.h("path", { d: "M3 5c0-1.1.9-2 2-2h8.38a2 2 0 011.41.59l1.62 1.62A2 2 0 0117 6.62V15a2 2 0 01-2 2H5a2 2 0 01-2-2V5zm2-1a1 1 0 00-1 1v10a1 1 0 001 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 001-1V6.62a1 1 0 00-.3-.7L14.1 4.28a1 1 0 00-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 016 6.5V4H5zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 00.5-.5V4H7zm7 12v-4.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V16h8z" })))); | ||
} | ||
} | ||
render() { | ||
let toolbar = (index.h("div", { class: "pdf-toolbar" }, index.h("div", { class: "pdf-title" }, this.filename ? this.filename : this.defaultFilename), index.h("div", { class: "pdf-ms-auto" }, index.h("button", { class: "tools", onClick: () => this.handleZoomOut() }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, index.h("path", { d: "M3 10c0-.28.22-.5.5-.5h13a.5.5 0 010 1h-13A.5.5 0 013 10z" }))), index.h("button", { class: "tools", onClick: () => this.handleZoomIn() }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, index.h("path", { d: "M9.5 16.5a.5.5 0 001 0v-6h6a.5.5 0 000-1h-6v-6a.5.5 0 00-1 0v6h-6a.5.5 0 000 1h6v6z", "fill-rule": "nonzero" }))), index.h("button", { class: "tools", onClick: () => this.handlePrint() }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, index.h("path", { d: "M5 4.5C5 3.67 5.67 3 6.5 3h7c.83 0 1.5.67 1.5 1.5V5h.5A2.5 2.5 0 0118 7.5v5c0 .83-.67 1.5-1.5 1.5H15v1.5c0 .83-.67 1.5-1.5 1.5h-7A1.5 1.5 0 015 15.5V14H3.5A1.5 1.5 0 012 12.5v-5A2.5 2.5 0 014.5 5H5v-.5zM6 5h8v-.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V5zm-1 8v-1.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V13h1.5a.5.5 0 00.5-.5v-5c0-.83-.67-1.5-1.5-1.5h-11C3.67 6 3 6.67 3 7.5v5c0 .28.22.5.5.5H5zm1.5-2a.5.5 0 00-.5.5v4c0 .28.22.5.5.5h7a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5h-7z", "fill-rule": "nonzero" }))), index.h("button", { class: "tools", onClick: () => this.handleDownload() }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, index.h("path", { d: "M3 5c0-1.1.9-2 2-2h8.38a2 2 0 011.41.59l1.62 1.62A2 2 0 0117 6.62V15a2 2 0 01-2 2H5a2 2 0 01-2-2V5zm2-1a1 1 0 00-1 1v10a1 1 0 001 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 001-1V6.62a1 1 0 00-.3-.7L14.1 4.28a1 1 0 00-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 016 6.5V4H5zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 00.5-.5V4H7zm7 12v-4.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V16h8z" })))))); | ||
let toolbar = (index.h("div", { class: "pdf-toolbar" }, index.h("div", { class: "pdf-title" }, this.filename ? this.filename : this.defaultFilename), index.h("div", { class: "pdf-ms-auto" }, index.h("button", { class: "tools", onClick: () => this.handleZoomOut() }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, index.h("path", { d: "M3 10c0-.28.22-.5.5-.5h13a.5.5 0 010 1h-13A.5.5 0 013 10z" }))), index.h("button", { class: "tools", onClick: () => this.handleZoomIn() }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, index.h("path", { d: "M9.5 16.5a.5.5 0 001 0v-6h6a.5.5 0 000-1h-6v-6a.5.5 0 00-1 0v6h-6a.5.5 0 000 1h6v6z", "fill-rule": "nonzero" }))), this.renderPrintButton(), this.renderDownloadButton()))); | ||
return (index.h("div", { class: "pdf-container" }, index.h("div", { class: "pdf-v-flex" }, toolbar, index.h("div", { class: "pdf-canvas-container" }, index.h("div", { class: "pdf-canvas-container-inner" }, index.h("div", { class: "pdf-ab" }, index.h("div", { class: "pdf-rel", id: "xc-document-container" }))))))); | ||
@@ -1079,0 +1106,0 @@ } |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const index = require('./index-c1a2f01c.js'); | ||
const index = require('./index-cb785df9.js'); | ||
@@ -24,3 +24,3 @@ /* | ||
patchBrowser().then(options => { | ||
return index.bootstrapLazy([["xc-pdf-viewer.cjs",[[1,"xc-pdf-viewer",{"src":[1],"filename":[1]}]]]], options); | ||
return index.bootstrapLazy([["xc-pdf-viewer.cjs",[[1,"xc-pdf-viewer",{"src":[1],"filename":[1],"hidePrint":[4,"hide-print"],"hideDownload":[4,"hide-download"],"isMobile":[4,"is-mobile"]}]]]], options); | ||
}); | ||
@@ -27,0 +27,0 @@ |
@@ -10,2 +10,5 @@ import { h, getAssetPath } from '@stencil/core'; | ||
this.filename = undefined; | ||
this.hidePrint = false; | ||
this.hideDownload = false; | ||
this.isMobile = false; | ||
} | ||
@@ -58,8 +61,14 @@ async componentDidLoad() { | ||
handleDownload() { | ||
const link = document.createElement('a'); | ||
link.href = this.src; | ||
link.download = this.filename ? this.filename : this.defaultFilename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
if (!this.isMobile) { | ||
const link = document.createElement('a'); | ||
link.href = this.src; | ||
link.download = this.filename ? this.filename : this.defaultFilename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
this.download.emit(this.src); | ||
} | ||
else { | ||
this.download.emit(this.src); | ||
} | ||
} | ||
@@ -82,4 +91,21 @@ componentDidUpdate() { | ||
} | ||
renderPrintButton() { | ||
// console.log(this.hidePrint); | ||
if (this.hidePrint) { | ||
return ""; | ||
} | ||
else { | ||
return (h("button", { class: "tools", onClick: () => this.handlePrint() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M5 4.5C5 3.67 5.67 3 6.5 3h7c.83 0 1.5.67 1.5 1.5V5h.5A2.5 2.5 0 0118 7.5v5c0 .83-.67 1.5-1.5 1.5H15v1.5c0 .83-.67 1.5-1.5 1.5h-7A1.5 1.5 0 015 15.5V14H3.5A1.5 1.5 0 012 12.5v-5A2.5 2.5 0 014.5 5H5v-.5zM6 5h8v-.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V5zm-1 8v-1.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V13h1.5a.5.5 0 00.5-.5v-5c0-.83-.67-1.5-1.5-1.5h-11C3.67 6 3 6.67 3 7.5v5c0 .28.22.5.5.5H5zm1.5-2a.5.5 0 00-.5.5v4c0 .28.22.5.5.5h7a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5h-7z", "fill-rule": "nonzero" })))); | ||
} | ||
} | ||
renderDownloadButton() { | ||
if (this.hideDownload) { | ||
return ""; | ||
} | ||
else { | ||
return (h("button", { class: "tools", onClick: () => this.handleDownload() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 5c0-1.1.9-2 2-2h8.38a2 2 0 011.41.59l1.62 1.62A2 2 0 0117 6.62V15a2 2 0 01-2 2H5a2 2 0 01-2-2V5zm2-1a1 1 0 00-1 1v10a1 1 0 001 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 001-1V6.62a1 1 0 00-.3-.7L14.1 4.28a1 1 0 00-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 016 6.5V4H5zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 00.5-.5V4H7zm7 12v-4.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V16h8z" })))); | ||
} | ||
} | ||
render() { | ||
let toolbar = (h("div", { class: "pdf-toolbar" }, h("div", { class: "pdf-title" }, this.filename ? this.filename : this.defaultFilename), h("div", { class: "pdf-ms-auto" }, h("button", { class: "tools", onClick: () => this.handleZoomOut() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 10c0-.28.22-.5.5-.5h13a.5.5 0 010 1h-13A.5.5 0 013 10z" }))), h("button", { class: "tools", onClick: () => this.handleZoomIn() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M9.5 16.5a.5.5 0 001 0v-6h6a.5.5 0 000-1h-6v-6a.5.5 0 00-1 0v6h-6a.5.5 0 000 1h6v6z", "fill-rule": "nonzero" }))), h("button", { class: "tools", onClick: () => this.handlePrint() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M5 4.5C5 3.67 5.67 3 6.5 3h7c.83 0 1.5.67 1.5 1.5V5h.5A2.5 2.5 0 0118 7.5v5c0 .83-.67 1.5-1.5 1.5H15v1.5c0 .83-.67 1.5-1.5 1.5h-7A1.5 1.5 0 015 15.5V14H3.5A1.5 1.5 0 012 12.5v-5A2.5 2.5 0 014.5 5H5v-.5zM6 5h8v-.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V5zm-1 8v-1.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V13h1.5a.5.5 0 00.5-.5v-5c0-.83-.67-1.5-1.5-1.5h-11C3.67 6 3 6.67 3 7.5v5c0 .28.22.5.5.5H5zm1.5-2a.5.5 0 00-.5.5v4c0 .28.22.5.5.5h7a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5h-7z", "fill-rule": "nonzero" }))), h("button", { class: "tools", onClick: () => this.handleDownload() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 5c0-1.1.9-2 2-2h8.38a2 2 0 011.41.59l1.62 1.62A2 2 0 0117 6.62V15a2 2 0 01-2 2H5a2 2 0 01-2-2V5zm2-1a1 1 0 00-1 1v10a1 1 0 001 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 001-1V6.62a1 1 0 00-.3-.7L14.1 4.28a1 1 0 00-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 016 6.5V4H5zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 00.5-.5V4H7zm7 12v-4.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V16h8z" })))))); | ||
let toolbar = (h("div", { class: "pdf-toolbar" }, h("div", { class: "pdf-title" }, this.filename ? this.filename : this.defaultFilename), h("div", { class: "pdf-ms-auto" }, h("button", { class: "tools", onClick: () => this.handleZoomOut() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 10c0-.28.22-.5.5-.5h13a.5.5 0 010 1h-13A.5.5 0 013 10z" }))), h("button", { class: "tools", onClick: () => this.handleZoomIn() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M9.5 16.5a.5.5 0 001 0v-6h6a.5.5 0 000-1h-6v-6a.5.5 0 00-1 0v6h-6a.5.5 0 000 1h6v6z", "fill-rule": "nonzero" }))), this.renderPrintButton(), this.renderDownloadButton()))); | ||
return (h("div", { class: "pdf-container" }, h("div", { class: "pdf-v-flex" }, toolbar, h("div", { class: "pdf-canvas-container" }, h("div", { class: "pdf-canvas-container-inner" }, h("div", { class: "pdf-ab" }, h("div", { class: "pdf-rel", id: "xc-document-container" }))))))); | ||
@@ -135,7 +161,79 @@ } | ||
"reflect": false | ||
}, | ||
"hidePrint": { | ||
"type": "boolean", | ||
"mutable": false, | ||
"complexType": { | ||
"original": "boolean", | ||
"resolved": "boolean", | ||
"references": {} | ||
}, | ||
"required": false, | ||
"optional": false, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"attribute": "hide-print", | ||
"reflect": false, | ||
"defaultValue": "false" | ||
}, | ||
"hideDownload": { | ||
"type": "boolean", | ||
"mutable": false, | ||
"complexType": { | ||
"original": "boolean", | ||
"resolved": "boolean", | ||
"references": {} | ||
}, | ||
"required": false, | ||
"optional": false, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"attribute": "hide-download", | ||
"reflect": false, | ||
"defaultValue": "false" | ||
}, | ||
"isMobile": { | ||
"type": "boolean", | ||
"mutable": false, | ||
"complexType": { | ||
"original": "boolean", | ||
"resolved": "boolean", | ||
"references": {} | ||
}, | ||
"required": false, | ||
"optional": false, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"attribute": "is-mobile", | ||
"reflect": false, | ||
"defaultValue": "false" | ||
} | ||
}; | ||
} | ||
static get events() { | ||
return [{ | ||
"method": "download", | ||
"name": "download", | ||
"bubbles": true, | ||
"cancelable": true, | ||
"composed": true, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"complexType": { | ||
"original": "string", | ||
"resolved": "string", | ||
"references": {} | ||
} | ||
}]; | ||
} | ||
static get elementRef() { return "el"; } | ||
} | ||
//# sourceMappingURL=xc-pdf-viewer.js.map |
@@ -1,2 +0,2 @@ | ||
import { proxyCustomElement, HTMLElement as HTMLElement$1, getAssetPath, h } from '@stencil/core/internal/client'; | ||
import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, getAssetPath, h } from '@stencil/core/internal/client'; | ||
@@ -994,2 +994,3 @@ function getDefaultExportFromCjs (x) { | ||
this.__attachShadow(); | ||
this.download = createEvent(this, "download", 7); | ||
this.defaultFilename = "document.pdf"; | ||
@@ -1000,2 +1001,5 @@ this.page = 1; | ||
this.filename = undefined; | ||
this.hidePrint = false; | ||
this.hideDownload = false; | ||
this.isMobile = false; | ||
} | ||
@@ -1048,8 +1052,14 @@ async componentDidLoad() { | ||
handleDownload() { | ||
const link = document.createElement('a'); | ||
link.href = this.src; | ||
link.download = this.filename ? this.filename : this.defaultFilename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
if (!this.isMobile) { | ||
const link = document.createElement('a'); | ||
link.href = this.src; | ||
link.download = this.filename ? this.filename : this.defaultFilename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
this.download.emit(this.src); | ||
} | ||
else { | ||
this.download.emit(this.src); | ||
} | ||
} | ||
@@ -1072,4 +1082,21 @@ componentDidUpdate() { | ||
} | ||
renderPrintButton() { | ||
// console.log(this.hidePrint); | ||
if (this.hidePrint) { | ||
return ""; | ||
} | ||
else { | ||
return (h("button", { class: "tools", onClick: () => this.handlePrint() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M5 4.5C5 3.67 5.67 3 6.5 3h7c.83 0 1.5.67 1.5 1.5V5h.5A2.5 2.5 0 0118 7.5v5c0 .83-.67 1.5-1.5 1.5H15v1.5c0 .83-.67 1.5-1.5 1.5h-7A1.5 1.5 0 015 15.5V14H3.5A1.5 1.5 0 012 12.5v-5A2.5 2.5 0 014.5 5H5v-.5zM6 5h8v-.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V5zm-1 8v-1.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V13h1.5a.5.5 0 00.5-.5v-5c0-.83-.67-1.5-1.5-1.5h-11C3.67 6 3 6.67 3 7.5v5c0 .28.22.5.5.5H5zm1.5-2a.5.5 0 00-.5.5v4c0 .28.22.5.5.5h7a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5h-7z", "fill-rule": "nonzero" })))); | ||
} | ||
} | ||
renderDownloadButton() { | ||
if (this.hideDownload) { | ||
return ""; | ||
} | ||
else { | ||
return (h("button", { class: "tools", onClick: () => this.handleDownload() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 5c0-1.1.9-2 2-2h8.38a2 2 0 011.41.59l1.62 1.62A2 2 0 0117 6.62V15a2 2 0 01-2 2H5a2 2 0 01-2-2V5zm2-1a1 1 0 00-1 1v10a1 1 0 001 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 001-1V6.62a1 1 0 00-.3-.7L14.1 4.28a1 1 0 00-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 016 6.5V4H5zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 00.5-.5V4H7zm7 12v-4.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V16h8z" })))); | ||
} | ||
} | ||
render() { | ||
let toolbar = (h("div", { class: "pdf-toolbar" }, h("div", { class: "pdf-title" }, this.filename ? this.filename : this.defaultFilename), h("div", { class: "pdf-ms-auto" }, h("button", { class: "tools", onClick: () => this.handleZoomOut() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 10c0-.28.22-.5.5-.5h13a.5.5 0 010 1h-13A.5.5 0 013 10z" }))), h("button", { class: "tools", onClick: () => this.handleZoomIn() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M9.5 16.5a.5.5 0 001 0v-6h6a.5.5 0 000-1h-6v-6a.5.5 0 00-1 0v6h-6a.5.5 0 000 1h6v6z", "fill-rule": "nonzero" }))), h("button", { class: "tools", onClick: () => this.handlePrint() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M5 4.5C5 3.67 5.67 3 6.5 3h7c.83 0 1.5.67 1.5 1.5V5h.5A2.5 2.5 0 0118 7.5v5c0 .83-.67 1.5-1.5 1.5H15v1.5c0 .83-.67 1.5-1.5 1.5h-7A1.5 1.5 0 015 15.5V14H3.5A1.5 1.5 0 012 12.5v-5A2.5 2.5 0 014.5 5H5v-.5zM6 5h8v-.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V5zm-1 8v-1.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V13h1.5a.5.5 0 00.5-.5v-5c0-.83-.67-1.5-1.5-1.5h-11C3.67 6 3 6.67 3 7.5v5c0 .28.22.5.5.5H5zm1.5-2a.5.5 0 00-.5.5v4c0 .28.22.5.5.5h7a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5h-7z", "fill-rule": "nonzero" }))), h("button", { class: "tools", onClick: () => this.handleDownload() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 5c0-1.1.9-2 2-2h8.38a2 2 0 011.41.59l1.62 1.62A2 2 0 0117 6.62V15a2 2 0 01-2 2H5a2 2 0 01-2-2V5zm2-1a1 1 0 00-1 1v10a1 1 0 001 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 001-1V6.62a1 1 0 00-.3-.7L14.1 4.28a1 1 0 00-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 016 6.5V4H5zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 00.5-.5V4H7zm7 12v-4.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V16h8z" })))))); | ||
let toolbar = (h("div", { class: "pdf-toolbar" }, h("div", { class: "pdf-title" }, this.filename ? this.filename : this.defaultFilename), h("div", { class: "pdf-ms-auto" }, h("button", { class: "tools", onClick: () => this.handleZoomOut() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 10c0-.28.22-.5.5-.5h13a.5.5 0 010 1h-13A.5.5 0 013 10z" }))), h("button", { class: "tools", onClick: () => this.handleZoomIn() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M9.5 16.5a.5.5 0 001 0v-6h6a.5.5 0 000-1h-6v-6a.5.5 0 00-1 0v6h-6a.5.5 0 000 1h6v6z", "fill-rule": "nonzero" }))), this.renderPrintButton(), this.renderDownloadButton()))); | ||
return (h("div", { class: "pdf-container" }, h("div", { class: "pdf-v-flex" }, toolbar, h("div", { class: "pdf-canvas-container" }, h("div", { class: "pdf-canvas-container-inner" }, h("div", { class: "pdf-ab" }, h("div", { class: "pdf-rel", id: "xc-document-container" }))))))); | ||
@@ -1082,3 +1109,6 @@ } | ||
"src": [1], | ||
"filename": [1] | ||
"filename": [1], | ||
"hidePrint": [4, "hide-print"], | ||
"hideDownload": [4, "hide-download"], | ||
"isMobile": [4, "is-mobile"] | ||
}]); | ||
@@ -1085,0 +1115,0 @@ function defineCustomElement$1() { |
@@ -1,3 +0,3 @@ | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-e2a0b349.js'; | ||
export { s as setNonce } from './index-e2a0b349.js'; | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-851c5ebb.js'; | ||
export { s as setNonce } from './index-851c5ebb.js'; | ||
@@ -14,3 +14,3 @@ /* | ||
return patchEsm().then(() => { | ||
return bootstrapLazy([["xc-pdf-viewer",[[1,"xc-pdf-viewer",{"src":[1],"filename":[1]}]]]], options); | ||
return bootstrapLazy([["xc-pdf-viewer",[[1,"xc-pdf-viewer",{"src":[1],"filename":[1],"hidePrint":[4,"hide-print"],"hideDownload":[4,"hide-download"],"isMobile":[4,"is-mobile"]}]]]], options); | ||
}); | ||
@@ -17,0 +17,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { r as registerInstance, g as getAssetPath, h, a as getElement } from './index-e2a0b349.js'; | ||
import { r as registerInstance, c as createEvent, g as getAssetPath, h, a as getElement } from './index-851c5ebb.js'; | ||
@@ -992,2 +992,3 @@ function getDefaultExportFromCjs (x) { | ||
registerInstance(this, hostRef); | ||
this.download = createEvent(this, "download", 7); | ||
this.defaultFilename = "document.pdf"; | ||
@@ -998,2 +999,5 @@ this.page = 1; | ||
this.filename = undefined; | ||
this.hidePrint = false; | ||
this.hideDownload = false; | ||
this.isMobile = false; | ||
} | ||
@@ -1046,8 +1050,14 @@ async componentDidLoad() { | ||
handleDownload() { | ||
const link = document.createElement('a'); | ||
link.href = this.src; | ||
link.download = this.filename ? this.filename : this.defaultFilename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
if (!this.isMobile) { | ||
const link = document.createElement('a'); | ||
link.href = this.src; | ||
link.download = this.filename ? this.filename : this.defaultFilename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
this.download.emit(this.src); | ||
} | ||
else { | ||
this.download.emit(this.src); | ||
} | ||
} | ||
@@ -1070,4 +1080,21 @@ componentDidUpdate() { | ||
} | ||
renderPrintButton() { | ||
// console.log(this.hidePrint); | ||
if (this.hidePrint) { | ||
return ""; | ||
} | ||
else { | ||
return (h("button", { class: "tools", onClick: () => this.handlePrint() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M5 4.5C5 3.67 5.67 3 6.5 3h7c.83 0 1.5.67 1.5 1.5V5h.5A2.5 2.5 0 0118 7.5v5c0 .83-.67 1.5-1.5 1.5H15v1.5c0 .83-.67 1.5-1.5 1.5h-7A1.5 1.5 0 015 15.5V14H3.5A1.5 1.5 0 012 12.5v-5A2.5 2.5 0 014.5 5H5v-.5zM6 5h8v-.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V5zm-1 8v-1.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V13h1.5a.5.5 0 00.5-.5v-5c0-.83-.67-1.5-1.5-1.5h-11C3.67 6 3 6.67 3 7.5v5c0 .28.22.5.5.5H5zm1.5-2a.5.5 0 00-.5.5v4c0 .28.22.5.5.5h7a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5h-7z", "fill-rule": "nonzero" })))); | ||
} | ||
} | ||
renderDownloadButton() { | ||
if (this.hideDownload) { | ||
return ""; | ||
} | ||
else { | ||
return (h("button", { class: "tools", onClick: () => this.handleDownload() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 5c0-1.1.9-2 2-2h8.38a2 2 0 011.41.59l1.62 1.62A2 2 0 0117 6.62V15a2 2 0 01-2 2H5a2 2 0 01-2-2V5zm2-1a1 1 0 00-1 1v10a1 1 0 001 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 001-1V6.62a1 1 0 00-.3-.7L14.1 4.28a1 1 0 00-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 016 6.5V4H5zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 00.5-.5V4H7zm7 12v-4.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V16h8z" })))); | ||
} | ||
} | ||
render() { | ||
let toolbar = (h("div", { class: "pdf-toolbar" }, h("div", { class: "pdf-title" }, this.filename ? this.filename : this.defaultFilename), h("div", { class: "pdf-ms-auto" }, h("button", { class: "tools", onClick: () => this.handleZoomOut() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 10c0-.28.22-.5.5-.5h13a.5.5 0 010 1h-13A.5.5 0 013 10z" }))), h("button", { class: "tools", onClick: () => this.handleZoomIn() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M9.5 16.5a.5.5 0 001 0v-6h6a.5.5 0 000-1h-6v-6a.5.5 0 00-1 0v6h-6a.5.5 0 000 1h6v6z", "fill-rule": "nonzero" }))), h("button", { class: "tools", onClick: () => this.handlePrint() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M5 4.5C5 3.67 5.67 3 6.5 3h7c.83 0 1.5.67 1.5 1.5V5h.5A2.5 2.5 0 0118 7.5v5c0 .83-.67 1.5-1.5 1.5H15v1.5c0 .83-.67 1.5-1.5 1.5h-7A1.5 1.5 0 015 15.5V14H3.5A1.5 1.5 0 012 12.5v-5A2.5 2.5 0 014.5 5H5v-.5zM6 5h8v-.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V5zm-1 8v-1.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V13h1.5a.5.5 0 00.5-.5v-5c0-.83-.67-1.5-1.5-1.5h-11C3.67 6 3 6.67 3 7.5v5c0 .28.22.5.5.5H5zm1.5-2a.5.5 0 00-.5.5v4c0 .28.22.5.5.5h7a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5h-7z", "fill-rule": "nonzero" }))), h("button", { class: "tools", onClick: () => this.handleDownload() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 5c0-1.1.9-2 2-2h8.38a2 2 0 011.41.59l1.62 1.62A2 2 0 0117 6.62V15a2 2 0 01-2 2H5a2 2 0 01-2-2V5zm2-1a1 1 0 00-1 1v10a1 1 0 001 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 001-1V6.62a1 1 0 00-.3-.7L14.1 4.28a1 1 0 00-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 016 6.5V4H5zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 00.5-.5V4H7zm7 12v-4.5a.5.5 0 00-.5-.5h-7a.5.5 0 00-.5.5V16h8z" })))))); | ||
let toolbar = (h("div", { class: "pdf-toolbar" }, h("div", { class: "pdf-title" }, this.filename ? this.filename : this.defaultFilename), h("div", { class: "pdf-ms-auto" }, h("button", { class: "tools", onClick: () => this.handleZoomOut() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M3 10c0-.28.22-.5.5-.5h13a.5.5 0 010 1h-13A.5.5 0 013 10z" }))), h("button", { class: "tools", onClick: () => this.handleZoomIn() }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", class: "" }, h("path", { d: "M9.5 16.5a.5.5 0 001 0v-6h6a.5.5 0 000-1h-6v-6a.5.5 0 00-1 0v6h-6a.5.5 0 000 1h6v6z", "fill-rule": "nonzero" }))), this.renderPrintButton(), this.renderDownloadButton()))); | ||
return (h("div", { class: "pdf-container" }, h("div", { class: "pdf-v-flex" }, toolbar, h("div", { class: "pdf-canvas-container" }, h("div", { class: "pdf-canvas-container-inner" }, h("div", { class: "pdf-ab" }, h("div", { class: "pdf-rel", id: "xc-document-container" }))))))); | ||
@@ -1074,0 +1101,0 @@ } |
@@ -1,3 +0,3 @@ | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-e2a0b349.js'; | ||
export { s as setNonce } from './index-e2a0b349.js'; | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-851c5ebb.js'; | ||
export { s as setNonce } from './index-851c5ebb.js'; | ||
@@ -20,5 +20,5 @@ /* | ||
patchBrowser().then(options => { | ||
return bootstrapLazy([["xc-pdf-viewer",[[1,"xc-pdf-viewer",{"src":[1],"filename":[1]}]]]], options); | ||
return bootstrapLazy([["xc-pdf-viewer",[[1,"xc-pdf-viewer",{"src":[1],"filename":[1],"hidePrint":[4,"hide-print"],"hideDownload":[4,"hide-download"],"isMobile":[4,"is-mobile"]}]]]], options); | ||
}); | ||
//# sourceMappingURL=xconcepts-stencil-pdfviewer.js.map |
@@ -11,5 +11,12 @@ /* eslint-disable */ | ||
"filename": string; | ||
"hideDownload": boolean; | ||
"hidePrint": boolean; | ||
"isMobile": boolean; | ||
"src": string; | ||
} | ||
} | ||
export interface XcPdfViewerCustomEvent<T> extends CustomEvent<T> { | ||
detail: T; | ||
target: HTMLXcPdfViewerElement; | ||
} | ||
declare global { | ||
@@ -29,2 +36,6 @@ interface HTMLXcPdfViewerElement extends Components.XcPdfViewer, HTMLStencilElement { | ||
"filename"?: string; | ||
"hideDownload"?: boolean; | ||
"hidePrint"?: boolean; | ||
"isMobile"?: boolean; | ||
"onDownload"?: (event: XcPdfViewerCustomEvent<string>) => void; | ||
"src"?: string; | ||
@@ -31,0 +42,0 @@ } |
@@ -0,4 +1,9 @@ | ||
import { EventEmitter } from '../../stencil-public-runtime'; | ||
export declare class XcPdfViewer { | ||
src: string; | ||
filename: string; | ||
hidePrint: boolean; | ||
hideDownload: boolean; | ||
isMobile: boolean; | ||
download: EventEmitter<string>; | ||
defaultFilename: string; | ||
@@ -18,3 +23,5 @@ page: number; | ||
renderPage(): void; | ||
renderPrintButton(): any; | ||
renderDownloadButton(): any; | ||
render(): any; | ||
} |
@@ -1,2 +0,2 @@ | ||
import{p as a,b as e}from"./p-6ba8a916.js";export{s as setNonce}from"./p-6ba8a916.js";const o=()=>{const s=import.meta.url;const e={};if(s!==""){e.resourcesUrl=new URL(".",s).href}return a(e)};o().then((s=>e([["p-e0659a4a",[[1,"xc-pdf-viewer",{src:[1],filename:[1]}]]]],s))); | ||
import{p as e,b as i}from"./p-379a5383.js";export{s as setNonce}from"./p-379a5383.js";const o=()=>{const i=import.meta.url;const o={};if(i!==""){o.resourcesUrl=new URL(".",i).href}return e(o)};o().then((e=>i([["p-80e3a7b7",[[1,"xc-pdf-viewer",{src:[1],filename:[1],hidePrint:[4,"hide-print"],hideDownload:[4,"hide-download"],isMobile:[4,"is-mobile"]}]]]],e))); | ||
//# sourceMappingURL=xconcepts-stencil-pdfviewer.esm.js.map |
{ | ||
"name": "xconcepts-stencil-pdfviewer", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "PDF viewer created using stencil and pdfjs", | ||
@@ -41,2 +41,2 @@ "main": "dist/index.cjs.js", | ||
"license": "MIT" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24520185
174728
50