Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-pdf-viewer/get-file

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf-viewer/get-file - npm Package Compare versions

Comparing version 2.6.0 to 2.6.1

20

lib/cjs/get-file.js

@@ -32,3 +32,6 @@ 'use strict';

return (React__namespace.createElement(core.Icon, { size: 16 },
React__namespace.createElement("path", { d: "M17.5,11.5c3.314,0,6,2.686,6,6s-2.686,6-6,6s-6-2.686-6-6S14.186,11.5,17.5,11.5z\n M17.5,14.5v6\n M17.5,20.5\n l-2.25-2.25\n M17.5,20.5l2.25-2.25\n M10.5,23.5h-9c-0.552,0-1-0.448-1-1v-21c0-0.552,0.448-1,1-1h13.293\n c0.265,0,0.52,0.105,0.707,0.293L19.207,4.5C19.395,4.687,19.5,4.942,19.5,5.207V8.5" })));
React__namespace.createElement("path", { d: "M11.5 19.5L11.5 5" }),
React__namespace.createElement("path", { d: "M17 14L11.5 19.5 6 14" }),
React__namespace.createElement("path", { d: "M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5" }),
React__namespace.createElement("path", { d: "M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5" })));
};

@@ -72,5 +75,3 @@

var downloadFile = function (file, saveAs) {
var blobUrl = typeof file.data === 'string'
? ''
: URL.createObjectURL(new Blob([file.data], { type: 'application/pdf' }));
var blobUrl = typeof file.data === 'string' ? '' : URL.createObjectURL(new Blob([file.data], { type: 'application/pdf' }));
var link = document.createElement('a');

@@ -126,6 +127,11 @@ link.style.display = 'none';

var store = React__namespace.useMemo(function () { return core.createStore({}); }, []);
var defaultFileNameGenerator = function (file) { return (typeof file.data === 'object') ? 'document.pdf' : getFileName(file.name); };
var DownloadDecorator = function (downloadProps) { return (React__namespace.createElement(Download, __assign({}, downloadProps, { fileNameGenerator: props ? (props.fileNameGenerator || defaultFileNameGenerator) : defaultFileNameGenerator, store: store }))); };
var defaultFileNameGenerator = function (file) {
return typeof file.data === 'object' ? 'document.pdf' : getFileName(file.name);
};
var DownloadDecorator = function (downloadProps) { return (React__namespace.createElement(Download, __assign({}, downloadProps, { fileNameGenerator: props ? props.fileNameGenerator || defaultFileNameGenerator : defaultFileNameGenerator, store: store }))); };
var DownloadButtonDecorator = function () { return (React__namespace.createElement(DownloadDecorator, null, function (props) { return React__namespace.createElement(DownloadButton, __assign({}, props)); })); };
var DownloadMenuItemDecorator = function (props) { return (React__namespace.createElement(DownloadDecorator, null, function (p) { return React__namespace.createElement(DownloadMenuItem, { onClick: function () { p.onClick(); props.onClick(); } }); })); };
var DownloadMenuItemDecorator = function (props) { return (React__namespace.createElement(DownloadDecorator, null, function (p) { return (React__namespace.createElement(DownloadMenuItem, { onClick: function () {
p.onClick();
props.onClick();
} })); })); };
return {

@@ -132,0 +138,0 @@ onViewerStateChange: function (viewerState) {

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-pdf-viewer/core");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o=n(e),r=function(){return o.createElement(t.Icon,{size:16},o.createElement("path",{d:"M17.5,11.5c3.314,0,6,2.686,6,6s-2.686,6-6,6s-6-2.686-6-6S14.186,11.5,17.5,11.5z\n M17.5,14.5v6\n M17.5,20.5\n l-2.25-2.25\n M17.5,20.5l2.25-2.25\n M10.5,23.5h-9c-0.552,0-1-0.448-1-1v-21c0-0.552,0.448-1,1-1h13.293\n c0.265,0,0.52,0.105,0.707,0.293L19.207,4.5C19.395,4.687,19.5,4.942,19.5,5.207V8.5"}))},c=function(){return(c=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},i={left:0,top:8},l=function(e){var n=e.onClick,c=o.useContext(t.LocalizationContext),l=c&&c.download?c.download.download:"Download";return o.createElement(t.Tooltip,{position:t.Position.BottomCenter,target:o.createElement(t.MinimalButton,{onClick:n},o.createElement(r,null)),content:function(){return l},offset:i})},a=function(e){var t=e.children,n=e.fileNameGenerator,r=e.store,c=o.useState(r.get("file")),i=c[0],a=c[1],u=function(e){a(e)};o.useEffect((function(){return r.subscribe("file",u),function(){r.unsubscribe("file",u)}}),[]);return(t||function(e){return o.createElement(l,{onClick:e.onClick})})({onClick:function(){var e,t,o,r;i&&(e=i,t=n(i),o="string"==typeof e.data?"":URL.createObjectURL(new Blob([e.data],{type:"application/pdf"})),(r=document.createElement("a")).style.display="none",r.href=o||e.name,r.setAttribute("download",t),document.body.appendChild(r),r.click(),document.body.removeChild(r),o&&URL.revokeObjectURL(o))}})},u=function(e){var n=e.onClick,c=o.useContext(t.LocalizationContext),i=c&&c.download?c.download.download:"Download";return o.createElement(t.MenuItem,{icon:o.createElement(r,null),onClick:n},i)};exports.DownloadIcon=r,exports.getFilePlugin=function(e){var n=o.useMemo((function(){return t.createStore({})}),[]),r=function(e){return"object"==typeof e.data?"document.pdf":(t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t);var t,n},i=function(t){return o.createElement(a,c({},t,{fileNameGenerator:e&&e.fileNameGenerator||r,store:n}))};return{onViewerStateChange:function(e){return n.update("file",e.file),e},Download:i,DownloadButton:function(){return o.createElement(i,null,(function(e){return o.createElement(l,c({},e))}))},DownloadMenuItem:function(e){return o.createElement(i,null,(function(t){return o.createElement(u,{onClick:function(){t.onClick(),e.onClick()}})}))}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-pdf-viewer/core");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o=n(e),r=function(){return o.createElement(t.Icon,{size:16},o.createElement("path",{d:"M11.5 19.5L11.5 5"}),o.createElement("path",{d:"M17 14L11.5 19.5 6 14"}),o.createElement("path",{d:"M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5"}),o.createElement("path",{d:"M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5"}))},a=function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},c={left:0,top:8},l=function(e){var n=e.onClick,a=o.useContext(t.LocalizationContext),l=a&&a.download?a.download.download:"Download";return o.createElement(t.Tooltip,{position:t.Position.BottomCenter,target:o.createElement(t.MinimalButton,{onClick:n},o.createElement(r,null)),content:function(){return l},offset:c})},i=function(e){var t=e.children,n=e.fileNameGenerator,r=e.store,a=o.useState(r.get("file")),c=a[0],i=a[1],u=function(e){i(e)};o.useEffect((function(){return r.subscribe("file",u),function(){r.unsubscribe("file",u)}}),[]);return(t||function(e){return o.createElement(l,{onClick:e.onClick})})({onClick:function(){var e,t,o,r;c&&(e=c,t=n(c),o="string"==typeof e.data?"":URL.createObjectURL(new Blob([e.data],{type:"application/pdf"})),(r=document.createElement("a")).style.display="none",r.href=o||e.name,r.setAttribute("download",t),document.body.appendChild(r),r.click(),document.body.removeChild(r),o&&URL.revokeObjectURL(o))}})},u=function(e){var n=e.onClick,a=o.useContext(t.LocalizationContext),c=a&&a.download?a.download.download:"Download";return o.createElement(t.MenuItem,{icon:o.createElement(r,null),onClick:n},c)};exports.DownloadIcon=r,exports.getFilePlugin=function(e){var n=o.useMemo((function(){return t.createStore({})}),[]),r=function(e){return"object"==typeof e.data?"document.pdf":(t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t);var t,n},c=function(t){return o.createElement(i,a({},t,{fileNameGenerator:e&&e.fileNameGenerator||r,store:n}))};return{onViewerStateChange:function(e){return n.update("file",e.file),e},Download:c,DownloadButton:function(){return o.createElement(c,null,(function(e){return o.createElement(l,a({},e))}))},DownloadMenuItem:function(e){return o.createElement(c,null,(function(t){return o.createElement(u,{onClick:function(){t.onClick(),e.onClick()}})}))}}};
{
"name": "@react-pdf-viewer/get-file",
"version": "2.6.0",
"version": "2.6.1",
"description": "A React component to view a PDF document",

@@ -36,3 +36,3 @@ "license": "https://react-pdf-viewer.dev/license",

"dependencies": {
"@react-pdf-viewer/core": "2.6.0"
"@react-pdf-viewer/core": "2.6.1"
},

@@ -50,3 +50,3 @@ "peerDependencies": {

},
"gitHead": "91d6279570bd3d4672b131100392afd6e8658892"
"gitHead": "500247f24514da033bf92266f6903decaffebb68"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc