@react-pdf-viewer/properties
Advanced tools
Comparing version 2.7.2 to 2.8.0
@@ -83,3 +83,8 @@ 'use strict'; | ||
var label = _a.label, value = _a.value; | ||
return (React__namespace.createElement("dl", { className: "rpv-properties__item" }, | ||
var direction = React__namespace.useContext(core.ThemeContext).direction; | ||
var isRtl = direction === core.TextDirection.RightToLeft; | ||
return (React__namespace.createElement("dl", { className: core.classNames({ | ||
'rpv-properties__item': true, | ||
'rpv-properties__item--rtl': isRtl, | ||
}) }, | ||
React__namespace.createElement("dt", { className: "rpv-properties__item-label" }, | ||
@@ -86,0 +91,0 @@ label, |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-pdf-viewer/core");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(e),o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},a=function(e){var r=e.doc,o=e.render,a=n.useState(),i=a[0],l=a[1];return n.useEffect((function(){r.getMetadata().then((function(e){return Promise.resolve(e)})).then((function(e){return r.getDownloadInfo().then((function(t){return Promise.resolve({fileName:e.contentDispositionFilename||"",info:e.info,length:t.length})}))})).then((function(e){l(e)}))}),[]),i?o(i):n.createElement("div",{className:"rpv-properties__loader"},n.createElement(t.Spinner,null))},i=function(e){var t=e.label,r=e.value;return n.createElement("dl",{className:"rpv-properties__item"},n.createElement("dt",{className:"rpv-properties__item-label"},t,":"),n.createElement("dd",{className:"rpv-properties__item-value"},r||"-"))},l=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),c=function(e,t,r,n){var o=parseInt(e,10);return o>=t&&o<=r?o:n},u=function(e){var r=e.doc,o=e.fileName,u=e.onToggle,p=n.useContext(t.LocalizationContext).l10n,s=function(e){var t=function(e){var t=l.exec(e);if(!t)return null;var r=parseInt(t[1],10),n=c(t[2],1,12,1)-1,o=c(t[3],1,31,1),a=c(t[4],0,23,0),i=c(t[5],0,59,0),u=c(t[6],0,59,0),p=t[7]||"Z",s=c(t[8],0,23,0),f=c(t[9],0,59,0);switch(p){case"-":a+=s,i+=f;break;case"+":a-=s,i-=f}return new Date(Date.UTC(r,n,o,a,i,u))}(e);return t?t.toLocaleDateString()+", "+t.toLocaleTimeString():""};return n.createElement("div",{className:"rpv-properties__modal"},n.createElement(a,{doc:r,render:function(e){return n.createElement(n.Fragment,null,n.createElement("div",{className:"rpv-properties__modal-section"},n.createElement(i,{label:p&&p.properties?p.properties.fileName:"File name",value:e.fileName||(c=o,u=c.split("/").pop(),u?u.split("#")[0].split("?")[0]:c)}),n.createElement(i,{label:p&&p.properties?p.properties.fileSize:"File size",value:(a=e.length,l=Math.floor(Math.log(a)/Math.log(1024)),(a/Math.pow(1024,l)).toFixed(2)+" "+["B","kB","MB","GB","TB"][l])})),n.createElement(t.Separator,null),n.createElement("div",{className:"rpv-properties__modal-section"},n.createElement(i,{label:p&&p.properties?p.properties.title:"Title",value:e.info.Title}),n.createElement(i,{label:p&&p.properties?p.properties.author:"Author",value:e.info.Author}),n.createElement(i,{label:p&&p.properties?p.properties.subject:"Subject",value:e.info.Subject}),n.createElement(i,{label:p&&p.properties?p.properties.keywords:"Keywords",value:e.info.Keywords}),n.createElement(i,{label:p&&p.properties?p.properties.creator:"Creator",value:e.info.Creator}),n.createElement(i,{label:p&&p.properties?p.properties.creationDate:"Creation date",value:s(e.info.CreationDate)}),n.createElement(i,{label:p&&p.properties?p.properties.modificationDate:"Modification date",value:s(e.info.ModDate)})),n.createElement(t.Separator,null),n.createElement("div",{className:"rpv-properties__modal-section"},n.createElement(i,{label:p&&p.properties?p.properties.pdfProducer:"PDF producer",value:e.info.Producer}),n.createElement(i,{label:p&&p.properties?p.properties.pdfVersion:"PDF version",value:e.info.PDFFormatVersion}),n.createElement(i,{label:p&&p.properties?p.properties.pageCount:"Page count",value:""+r.numPages})));var a,l,c,u}}),n.createElement("div",{className:"rpv-properties__modal-footer"},n.createElement(t.Button,{onClick:u},p&&p.properties?p.properties.close:"Close")))},p=function(){return n.createElement(t.Icon,{size:16},n.createElement("path",{d:"M12,1.001c6.075,0,11,4.925,11,11s-4.925,11-11,11s-11-4.925-11-11S5.925,1.001,12,1.001z\n M14.5,17.005H13\n c-0.552,0-1-0.448-1-1v-6.5c0-0.276-0.224-0.5-0.5-0.5H10\n M11.745,6.504L11.745,6.504\n M11.745,6.5c-0.138,0-0.25,0.112-0.25,0.25\n S11.607,7,11.745,7s0.25-0.112,0.25-0.25S11.883,6.5,11.745,6.5"}))},s={left:0,top:8},f=function(e){var r=e.onClick,o=n.useContext(t.LocalizationContext).l10n,a=o&&o.properties?o.properties.showProperties:"Show properties";return n.createElement(t.Tooltip,{ariaControlsSuffix:"properties",position:t.Position.BottomCenter,target:n.createElement(t.MinimalButton,{ariaLabel:a,onClick:r},n.createElement(p,null)),content:function(){return a},offset:s})},m=function(e){var r=e.children,a=e.store,i=function(e){var t=n.useState(e.get("doc")),r=t[0],o=t[1],a=function(e){o(e)};return n.useEffect((function(){return e.subscribe("doc",a),function(){e.unsubscribe("doc",a)}}),[]),{currentDoc:r}}(a).currentDoc,l=a.get("fileName")||"",c=r||function(e){return n.createElement(f,o({},e))};return i?n.createElement(t.Modal,{ariaControlsSuffix:"properties",target:function(e){return c({onClick:e})},content:function(e){return n.createElement(u,{doc:i,fileName:l,onToggle:e})},closeOnClickOutside:!0,closeOnEscape:!0}):n.createElement(n.Fragment,null)},d=function(e){var r=e.onClick,o=n.useContext(t.LocalizationContext).l10n,a=o&&o.properties?o.properties.showProperties:"Show properties";return n.createElement(t.MenuItem,{icon:n.createElement(p,null),onClick:r},a)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-pdf-viewer/core");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(e),o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},a=function(e){var r=e.doc,o=e.render,a=n.useState(),i=a[0],l=a[1];return n.useEffect((function(){r.getMetadata().then((function(e){return Promise.resolve(e)})).then((function(e){return r.getDownloadInfo().then((function(t){return Promise.resolve({fileName:e.contentDispositionFilename||"",info:e.info,length:t.length})}))})).then((function(e){l(e)}))}),[]),i?o(i):n.createElement("div",{className:"rpv-properties__loader"},n.createElement(t.Spinner,null))},i=function(e){var r=e.label,o=e.value,a=n.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft;return n.createElement("dl",{className:t.classNames({"rpv-properties__item":!0,"rpv-properties__item--rtl":a})},n.createElement("dt",{className:"rpv-properties__item-label"},r,":"),n.createElement("dd",{className:"rpv-properties__item-value"},o||"-"))},l=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),c=function(e,t,r,n){var o=parseInt(e,10);return o>=t&&o<=r?o:n},s=function(e){var r=e.doc,o=e.fileName,s=e.onToggle,p=n.useContext(t.LocalizationContext).l10n,u=function(e){var t=function(e){var t=l.exec(e);if(!t)return null;var r=parseInt(t[1],10),n=c(t[2],1,12,1)-1,o=c(t[3],1,31,1),a=c(t[4],0,23,0),i=c(t[5],0,59,0),s=c(t[6],0,59,0),p=t[7]||"Z",u=c(t[8],0,23,0),f=c(t[9],0,59,0);switch(p){case"-":a+=u,i+=f;break;case"+":a-=u,i-=f}return new Date(Date.UTC(r,n,o,a,i,s))}(e);return t?t.toLocaleDateString()+", "+t.toLocaleTimeString():""};return n.createElement("div",{className:"rpv-properties__modal"},n.createElement(a,{doc:r,render:function(e){return n.createElement(n.Fragment,null,n.createElement("div",{className:"rpv-properties__modal-section"},n.createElement(i,{label:p&&p.properties?p.properties.fileName:"File name",value:e.fileName||(c=o,s=c.split("/").pop(),s?s.split("#")[0].split("?")[0]:c)}),n.createElement(i,{label:p&&p.properties?p.properties.fileSize:"File size",value:(a=e.length,l=Math.floor(Math.log(a)/Math.log(1024)),(a/Math.pow(1024,l)).toFixed(2)+" "+["B","kB","MB","GB","TB"][l])})),n.createElement(t.Separator,null),n.createElement("div",{className:"rpv-properties__modal-section"},n.createElement(i,{label:p&&p.properties?p.properties.title:"Title",value:e.info.Title}),n.createElement(i,{label:p&&p.properties?p.properties.author:"Author",value:e.info.Author}),n.createElement(i,{label:p&&p.properties?p.properties.subject:"Subject",value:e.info.Subject}),n.createElement(i,{label:p&&p.properties?p.properties.keywords:"Keywords",value:e.info.Keywords}),n.createElement(i,{label:p&&p.properties?p.properties.creator:"Creator",value:e.info.Creator}),n.createElement(i,{label:p&&p.properties?p.properties.creationDate:"Creation date",value:u(e.info.CreationDate)}),n.createElement(i,{label:p&&p.properties?p.properties.modificationDate:"Modification date",value:u(e.info.ModDate)})),n.createElement(t.Separator,null),n.createElement("div",{className:"rpv-properties__modal-section"},n.createElement(i,{label:p&&p.properties?p.properties.pdfProducer:"PDF producer",value:e.info.Producer}),n.createElement(i,{label:p&&p.properties?p.properties.pdfVersion:"PDF version",value:e.info.PDFFormatVersion}),n.createElement(i,{label:p&&p.properties?p.properties.pageCount:"Page count",value:""+r.numPages})));var a,l,c,s}}),n.createElement("div",{className:"rpv-properties__modal-footer"},n.createElement(t.Button,{onClick:s},p&&p.properties?p.properties.close:"Close")))},p=function(){return n.createElement(t.Icon,{size:16},n.createElement("path",{d:"M12,1.001c6.075,0,11,4.925,11,11s-4.925,11-11,11s-11-4.925-11-11S5.925,1.001,12,1.001z\n M14.5,17.005H13\n c-0.552,0-1-0.448-1-1v-6.5c0-0.276-0.224-0.5-0.5-0.5H10\n M11.745,6.504L11.745,6.504\n M11.745,6.5c-0.138,0-0.25,0.112-0.25,0.25\n S11.607,7,11.745,7s0.25-0.112,0.25-0.25S11.883,6.5,11.745,6.5"}))},u={left:0,top:8},f=function(e){var r=e.onClick,o=n.useContext(t.LocalizationContext).l10n,a=o&&o.properties?o.properties.showProperties:"Show properties";return n.createElement(t.Tooltip,{ariaControlsSuffix:"properties",position:t.Position.BottomCenter,target:n.createElement(t.MinimalButton,{ariaLabel:a,onClick:r},n.createElement(p,null)),content:function(){return a},offset:u})},m=function(e){var r=e.children,a=e.store,i=function(e){var t=n.useState(e.get("doc")),r=t[0],o=t[1],a=function(e){o(e)};return n.useEffect((function(){return e.subscribe("doc",a),function(){e.unsubscribe("doc",a)}}),[]),{currentDoc:r}}(a).currentDoc,l=a.get("fileName")||"",c=r||function(e){return n.createElement(f,o({},e))};return i?n.createElement(t.Modal,{ariaControlsSuffix:"properties",target:function(e){return c({onClick:e})},content:function(e){return n.createElement(s,{doc:i,fileName:l,onToggle:e})},closeOnClickOutside:!0,closeOnEscape:!0}):n.createElement(n.Fragment,null)},d=function(e){var r=e.onClick,o=n.useContext(t.LocalizationContext).l10n,a=o&&o.properties?o.properties.showProperties:"Show properties";return n.createElement(t.MenuItem,{icon:n.createElement(p,null),onClick:r},a)}; | ||
/*! ***************************************************************************** | ||
@@ -3,0 +3,0 @@ Copyright (c) Microsoft Corporation. |
{ | ||
"name": "@react-pdf-viewer/properties", | ||
"version": "2.7.2", | ||
"version": "2.8.0", | ||
"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.7.2" | ||
"@react-pdf-viewer/core": "2.8.0" | ||
}, | ||
@@ -52,3 +52,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "d5084b21f1e89e11ee45764849b8c61e4e6f4216" | ||
"gitHead": "5a7ff547bbdcf8b51c10907ad706e4edc397fc4f" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23067
307
+ Added@react-pdf-viewer/core@2.8.0(transitive)
- Removed@react-pdf-viewer/core@2.7.2(transitive)
Updated@react-pdf-viewer/core@2.8.0