@progress/kendo-react-pdf-viewer 9.5.0 → 10.0.0-develop.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/PDFViewer.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Fe=require("react"),c=require("prop-types"),m=require("@progress/kendo-react-buttons"),j=require("@progress/kendo-react-inputs"),qe=require("@progress/kendo-react-data-tools"),je=require("@progress/kendo-react-upload"),Ae=require("@progress/kendo-react-dropdowns"),Ve=require("@progress/kendo-react-indicators"),T=require("@progress/kendo-react-common"),Ue=require("@progress/kendo-react-intl"),f=require("@progress/kendo-svg-icons");require("pdfjs-dist/build/pdf.worker.min.mjs");const te=require("./package-metadata.js"),i=require("@progress/kendo-pdfviewer-common"),a=require("./messages.js");function We(n){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const C in n)if(C!=="default"){const w=Object.getOwnPropertyDescriptor(n,C);Object.defineProperty(p,C,w.get?w:{enumerable:!0,get:()=>n[C]})}}return p.default=n,Object.freeze(p)}const e=We(Fe),ne=["pager","spacer","zoomInOut","zoom","selection","spacer","search","open","download","print"],x={minZoom:.5,maxZoom:4,tools:[...ne],zoomRate:.25,zoomLevels:[{id:1,priority:1,value:1,text:"Actual width",type:"ActualWidth",locationString:a.actualWidth},{id:2,priority:2,value:1,text:"Fit to width",type:"FitToWidth",locationString:a.fitToWidth},{id:3,priority:3,value:1,text:"Fit to page",type:"FitToPage",locationString:a.fitToPage},{id:4,priority:4,value:.5,text:"50%",type:""},{id:5,priority:5,value:.75,text:"75%",type:""},{id:6,priority:100,value:1,text:"100%",type:""},{id:7,priority:7,value:1.25,text:"125%",type:""},{id:8,priority:8,value:1.5,text:"150%",type:""},{id:9,priority:9,value:2,text:"200%",type:""},{id:10,priority:10,value:3,text:"300%",type:""},{id:11,priority:11,value:4,text:"400%",type:""}],defaultZoom:i.DEFAULT_ZOOM_LEVEL},Ke=[".k-toolbar > button",".k-toolbar .k-combobox > input",".k-toolbar .k-button-group > button",".k-toolbar .k-pager > a",".k-toolbar .k-pager input"];let oe=0;function _e(){return oe++,oe}const He=(n,p)=>n.priority>p.priority?-1:n.priority<p.priority?1:0,A=e.forwardRef((n,p)=>{T.validatePackage(te.packageMetadata);const C=T.shouldShowValidationUI(te.packageMetadata),{zoom:w,zoomLevels:V=x.zoomLevels,defaultZoom:N=x.defaultZoom,minZoom:R=x.minZoom,maxZoom:B=x.maxZoom,zoomRate:z=x.zoomRate}=n,u=Ue.useLocalization(),s=e.useRef(null),[ae,L]=e.useState(N),h=w!==void 0?w:ae,Z=V.slice().sort(He).find(o=>o.value===h)||{text:h*100+"%",value:h,id:h,locationString:""};Z.locationString&&(Z.text=u.toLanguageString(Z.locationString,a.messages[Z.locationString]));const[d,O]=e.useState(!1),[re,b]=e.useState(!0),[I,U]=e.useState(0),[M,W]=e.useState(!0),[le,K]=e.useState(!1),[y,D]=e.useState(0),[k,S]=e.useState(0),[E,_]=e.useState(!1),[F,H]=e.useState(""),t=e.useMemo(()=>({}),[]);t.currentZoom=h,t.props=n;const G=e.useCallback(o=>{s.current&&s.current.style.setProperty("--scale-factor",String(o))},[]),v=e.useRef(null),P=e.useRef(null);e.useImperativeHandle(v,()=>({get element(){return P.current},props:n,get pages(){return t.pages},get document(){return t.document}}),[]),e.useImperativeHandle(p,()=>v.current);const ce=e.useCallback(()=>{if(t.props.onLoad){const o={target:v.current};t.props.onLoad.call(void 0,o)}},[]),J=e.useCallback((o,r,l)=>{if(n.onDownload){const g={target:v.current,blob:o,fileName:r,saveOptions:l};return n.onDownload.call(void 0,g)===!1}return!1},[n.onDownload]),se=e.useCallback(()=>{var o;t.scroller&&t.scroller.destroy(),t.scroller=new i.Scroller((o=s.current)==null?void 0:o.parentNode,{filter:".k-page",events:{}}),t.scroller.disablePanEventsTracking()},[]),ie=e.useCallback(o=>{const r=Array.from(o.querySelectorAll(".k-text-layer"));t.search=new i.SearchService({textContainers:r||[],highlightClass:"k-search-highlight",highlightMarkClass:"k-search-highlight-mark",charClass:"k-text-char"})},[]);t.done=e.useCallback(({pdfPages:o,pdfDoc:r,zoom:l})=>{t.document=r,t.pages=o,t.zoom=l,se(),b(!1),O(!0),ce(),s.current&&i.scrollToPage(s.current,0)},[]),t.error=e.useCallback(o=>{if(t.document=null,t.pages=[],b(!1),O(!1),n.onError){const r={error:typeof o=="string"?{message:o}:o,target:v.current};n.onError.call(void 0,r)}},[n.onError]),e.useEffect(()=>{s.current&&(n.url||n.data||n.arrayBuffer?(b(!0),i.removeChildren(s.current),i.loadPDF({url:n.url,data:n.data,arrayBuffer:n.arrayBuffer,dom:s.current,zoom:t.currentZoom,done:t.done,error:t.error}),G(t.currentZoom)):(t.document=null,t.pages=[],O(!1),b(!1),i.removeChildren(s.current)))},[n.url,n.data,n.arrayBuffer]);const Q=e.useCallback((o,r)=>{s.current&&(b(!0),i.removeChildren(s.current),i.reloadDocument({pdfDoc:o,zoom:r,dom:s.current,done:l=>{t.pages=l,t.zoom=r,b(!1)},error:t.error}))},[]);e.useEffect(()=>{G(h),s.current&&t.document&&h!==t.zoom&&Q(t.document,h)},[h,Q]),e.useEffect(()=>()=>{t.scroller&&t.scroller.destroy(),t.search&&t.search.destroy(),t.document=null,t.pages=[]},[]);const ue=e.useCallback(()=>{K(!0),ie(s.current)},[]),me=e.useCallback(o=>{const r=o.value,l=t.search.search({text:r,matchCase:E});S(l.length?1:0),D(l.length),H(r)},[E]),de=e.useCallback(()=>{const o=t.search.search({text:F,matchCase:!E});S(o.length?1:0),D(o.length),_(!E)},[E,F]),ge=e.useCallback(()=>{i.goToNextSearchMatch(t),S(k+1>y?1:k+1)},[k,y]),fe=e.useCallback(()=>{i.goToPreviousSearchMatch(t),S(k-1<1?y:k-1)},[k,y]),X=e.useCallback(()=>{t.search.destroy(),S(0),D(0),_(!1),H(""),K(!1)},[]),he=e.useCallback(o=>{o.key==="Enter"?(o.preventDefault(),i.goToNextSearchMatch(t),S(k+1>y?1:k+1)):o.key==="Escape"&&X()},[k,y]),ke=e.useCallback(o=>{if(s.current){const r=o.skip;i.scrollToPage(s.current,r);const l={page:r+1,target:v.current,syntheticEvent:o.syntheticEvent};n.onPageChange&&n.onPageChange.call(void 0,l)}U(o.skip)},[I,n.onPageChange]),ve=e.useCallback(o=>{if(P.current){const r=i.currentPage(P.current);if(r!==I){U(r);const l={page:r+1,target:v.current,syntheticEvent:o};n.onPageChange&&n.onPageChange.call(void 0,l)}}},[I,n.onPageChange]),be=e.useCallback(o=>{const r=Math.min(t.currentZoom+z,B);if(r!==t.currentZoom&&t.document&&(L(r),n.onZoom)){const l={zoom:r,target:v.current,syntheticEvent:o};n.onZoom.call(void 0,l)}},[z,B,n.onZoom]),ye=e.useCallback(o=>{const r=Math.max(t.currentZoom-z,R);if(r!==t.currentZoom&&t.document&&(L(r),n.onZoom)){const l={zoom:r,target:v.current,syntheticEvent:o};n.onZoom.call(void 0,l)}},[z,R,n.onZoom]),pe=e.useCallback(o=>{const r=o.value===null?{text:"100%",value:1,id:100}:{...o.value};if(r.value===void 0){const g=parseFloat(r.text);typeof g=="number"&&!Number.isNaN(g)?r.value=g/100:r.value=1}let l=r?i.calculateZoomLevel(r.value,r.type,t.currentZoom,s.current):1;if(l=Math.round(l*100)/100,t.currentZoom!==l&&t.document&&(L(l),n.onZoom)){const g={zoom:l,target:v.current,syntheticEvent:o.syntheticEvent};n.onZoom.call(void 0,g)}},[n.onZoom]),Ce=e.useCallback(()=>{t.scroller.disablePanEventsTracking(),W(!0)},[]),Se=e.useCallback(()=>{t.scroller.enablePanEventsTracking(),W(!1)},[]),Ee=e.useCallback(()=>{i.download({pdf:t.document,error:t.error},n.saveFileName,n.saveOptions,J)},[n.url,n.data,n.arrayBuffer,n.saveFileName,n.saveOptions,J]),xe=e.useCallback(()=>{b(!0);const o=l=>{t.error(typeof(l?l.message||l:null)=="string"?l.message||l:u.toLanguageString(a.popupBlocked,a.messages[a.popupBlocked]))},r=()=>{b(!1)};i.print(t.pages,r,o)},[]),we=e.useCallback(o=>{const r=o.newState;r[0]&&r[0].getRawFile&&r[0].getRawFile().arrayBuffer().then(g=>{if(s.current){b(!0),i.removeChildren(s.current);const q=t.props.zoom===void 0?N:t.props.zoom;i.loadPDF({arrayBuffer:g,dom:s.current,zoom:q,done:t.done,error:t.error}),L(q)}})},[N]),Ze=e.useCallback(o=>{const r=o.target;if(r instanceof Element&&r.parentNode){const l=r.closest(".k-toolbar"),g=l&&l.querySelector(".k-upload input");g&&g.click()}},[]),Y=re&&e.createElement("div",{className:"k-loader-container k-loader-container-md k-loader-top"},e.createElement("div",{className:"k-loader-container-overlay k-overlay-light"}),e.createElement("div",{className:"k-loader-container-inner "},e.createElement(Ve.Loader,{size:"large"}))),ze=e.createElement(m.ButtonGroup,{className:"k-toolbar-button-group k-button-group-solid"},e.createElement(m.Button,{className:"k-group-start",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.zoomOut,a.messages[a.zoomOut]),disabled:h<=R||!d,onClick:ye,icon:"zoom-out",svgIcon:f.zoomOutIcon}),e.createElement(m.Button,{className:"k-group-end",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.zoomIn,a.messages[a.zoomIn]),disabled:h>=B||!d,onClick:be,icon:"zoom-in",svgIcon:f.zoomInIcon})),Le=e.createElement(Ae.ComboBox,{className:"k-toolbar-combobox",disabled:!d,data:V.map(o=>({...o,text:o.locationString?u.toLanguageString(o.locationString,a.messages[o.locationString]):o.text})),dataItemKey:"id",textField:"text",value:d?Z:null,allowCustom:!0,onChange:pe,placeholder:u.toLanguageString(a.zoomLevel,a.messages[a.zoomLevel])}),Ie=e.createElement(qe.Pager,{disabled:!d,previousNext:!0,type:"input",skip:I,take:1,total:t.pages?t.pages.length:0,info:!1,onPageChange:ke}),Me=e.createElement(m.ToolbarSpacer,null),Pe=e.createElement(m.ButtonGroup,{className:"k-toolbar-button-group k-button-group-solid"},e.createElement(m.Button,{className:"k-group-start",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.enableSelection,a.messages[a.enableSelection]),icon:"pointer",svgIcon:f.pointerIcon,disabled:!d,togglable:!0,selected:M&&d,onClick:Ce}),e.createElement(m.Button,{className:"k-group-end",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.enablePanning,a.messages[a.enablePanning]),icon:"hand",svgIcon:f.handIcon,disabled:!d,togglable:!0,selected:!M&&d,onClick:Se})),Te=e.createElement(m.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.search,a.messages[a.search]),icon:"search",svgIcon:f.searchIcon,disabled:!d,onClick:ue}),Ne=e.createElement(e.Fragment,null,e.createElement(m.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.open,a.messages[a.open]),icon:"folder-open",svgIcon:f.folderOpenIcon,onClick:Ze}),e.createElement("div",{style:{display:"none"}},e.createElement(je.Upload,{restrictions:{allowedExtensions:[".pdf"]},onAdd:we,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".pdf,.PDF",withCredentials:!1}))),Re=e.createElement(m.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.download,a.messages[a.download]),icon:"download",svgIcon:f.downloadIcon,disabled:!d,onClick:Ee}),Be=e.createElement(m.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.print,a.messages[a.print]),icon:"print",svgIcon:f.printIcon,disabled:!d,onClick:xe}),Oe={pager:Ie,spacer:Me,zoomInOut:ze,zoom:Le,selection:Pe,search:Te,open:Ne,download:Re,print:Be},De=(n.tools||x.tools).map(o=>({...Oe[o],key:"toobar-tool-"+o+_e()})),$=e.createElement(m.Toolbar,{buttons:Ke},...De),ee=e.createElement("div",{className:T.classNames("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto",{"k-enable-text-select":M,"k-enable-panning":!M}),onScroll:ve},le&&e.createElement("div",{className:"k-search-panel k-pos-sticky k-top-center"},e.createElement(j.TextBox,{value:F,onChange:me,placeholder:u.toLanguageString(a.search,a.messages[a.search]),autoFocus:!0,onKeyDown:he,suffix:()=>e.createElement(e.Fragment,null,e.createElement(j.InputSeparator,null),e.createElement(j.InputSuffix,null,e.createElement(m.Button,{icon:"convert-lowercase",svgIcon:f.convertLowercaseIcon,title:u.toLanguageString(a.matchCase,a.messages[a.matchCase]),fillMode:"flat",togglable:!0,selected:E,onClick:de})))}),e.createElement("span",{className:"k-search-matches"},e.createElement("span",null,k)," ",u.toLanguageString(a.searchOf,a.messages[a.searchOf]),e.createElement("span",null,y)),e.createElement(m.Button,{title:u.toLanguageString(a.prevMatch,a.messages[a.prevMatch]),fillMode:"flat",icon:"arrow-up",svgIcon:f.arrowUpIcon,disabled:y===0,onClick:fe}),e.createElement(m.Button,{title:u.toLanguageString(a.nextMatch,a.messages[a.nextMatch]),fillMode:"flat",icon:"arrow-down",svgIcon:f.arrowDownIcon,disabled:y===0,onClick:ge}),e.createElement(m.Button,{title:u.toLanguageString(a.close,a.messages[a.close]),fillMode:"flat",icon:"x",svgIcon:f.xIcon,onClick:X})),e.createElement("div",{ref:s,className:"k-pdf-viewer-pages"}));return e.createElement("div",{className:"k-pdf-viewer",style:n.style,ref:P},n.onRenderLoader?n.onRenderLoader.call(void 0,Y||null):Y,n.onRenderToolbar?n.onRenderToolbar.call(void 0,$):$,n.onRenderContent?n.onRenderContent.call(void 0,ee):ee,C&&e.createElement(T.WatermarkOverlay,null))});A.displayName="KendoReactPDFViewer";A.propTypes={url:c.string,data:c.string,arrayBuffer:c.any,typedArray:c.any,style:c.object,saveFileName:c.string,saveOptions:c.object,tools:c.arrayOf(c.oneOf(ne).isRequired),zoomLevels:c.arrayOf(c.any),zoom:c.number,defaultZoom:c.number,minZoom:c.number,maxZoom:c.number,zoomRate:c.number,onError:c.func,onLoad:c.func,onDownload:c.func,onRenderToolbar:c.func,onRenderContent:c.func,onRenderLoader:c.func,onZoom:c.func};exports.PDFViewer=A;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const De=require("react"),c=require("prop-types"),m=require("@progress/kendo-react-buttons"),q=require("@progress/kendo-react-inputs"),Fe=require("@progress/kendo-react-data-tools"),qe=require("@progress/kendo-react-upload"),je=require("@progress/kendo-react-dropdowns"),Ae=require("@progress/kendo-react-indicators"),j=require("@progress/kendo-react-common"),Ve=require("@progress/kendo-react-intl"),f=require("@progress/kendo-svg-icons");require("pdfjs-dist/build/pdf.worker.min.mjs");const We=require("./package-metadata.js"),i=require("@progress/kendo-pdfviewer-common"),a=require("./messages.js");function Ke(n){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const C in n)if(C!=="default"){const w=Object.getOwnPropertyDescriptor(n,C);Object.defineProperty(p,C,w.get?w:{enumerable:!0,get:()=>n[C]})}}return p.default=n,Object.freeze(p)}const e=Ke(De),oe=["pager","spacer","zoomInOut","zoom","selection","spacer","search","open","download","print"],x={minZoom:.5,maxZoom:4,tools:[...oe],zoomRate:.25,zoomLevels:[{id:1,priority:1,value:1,text:"Actual width",type:"ActualWidth",locationString:a.actualWidth},{id:2,priority:2,value:1,text:"Fit to width",type:"FitToWidth",locationString:a.fitToWidth},{id:3,priority:3,value:1,text:"Fit to page",type:"FitToPage",locationString:a.fitToPage},{id:4,priority:4,value:.5,text:"50%",type:""},{id:5,priority:5,value:.75,text:"75%",type:""},{id:6,priority:100,value:1,text:"100%",type:""},{id:7,priority:7,value:1.25,text:"125%",type:""},{id:8,priority:8,value:1.5,text:"150%",type:""},{id:9,priority:9,value:2,text:"200%",type:""},{id:10,priority:10,value:3,text:"300%",type:""},{id:11,priority:11,value:4,text:"400%",type:""}],defaultZoom:i.DEFAULT_ZOOM_LEVEL},Ue=[".k-toolbar > button",".k-toolbar .k-combobox > input",".k-toolbar .k-button-group > button",".k-toolbar .k-pager > a",".k-toolbar .k-pager input"];let te=0;function _e(){return te++,te}const He=(n,p)=>n.priority>p.priority?-1:n.priority<p.priority?1:0,A=e.forwardRef((n,p)=>{const C=!j.validatePackage(We.packageMetadata,{component:"PDFViewer"}),{zoom:w,zoomLevels:V=x.zoomLevels,defaultZoom:T=x.defaultZoom,minZoom:N=x.minZoom,maxZoom:R=x.maxZoom,zoomRate:z=x.zoomRate}=n,u=Ve.useLocalization(),s=e.useRef(null),[ne,L]=e.useState(T),h=w!==void 0?w:ne,Z=V.slice().sort(He).find(o=>o.value===h)||{text:h*100+"%",value:h,id:h,locationString:""};Z.locationString&&(Z.text=u.toLanguageString(Z.locationString,a.messages[Z.locationString]));const[d,B]=e.useState(!1),[ae,b]=e.useState(!0),[P,W]=e.useState(0),[I,K]=e.useState(!0),[re,U]=e.useState(!1),[y,O]=e.useState(0),[k,E]=e.useState(0),[S,_]=e.useState(!1),[D,H]=e.useState(""),t=e.useMemo(()=>({}),[]);t.currentZoom=h,t.props=n;const G=e.useCallback(o=>{s.current&&s.current.style.setProperty("--scale-factor",String(o))},[]),v=e.useRef(null),M=e.useRef(null);e.useImperativeHandle(v,()=>({get element(){return M.current},props:n,get pages(){return t.pages},get document(){return t.document}}),[]),e.useImperativeHandle(p,()=>v.current);const le=e.useCallback(()=>{if(t.props.onLoad){const o={target:v.current};t.props.onLoad.call(void 0,o)}},[]),J=e.useCallback((o,r,l)=>{if(n.onDownload){const g={target:v.current,blob:o,fileName:r,saveOptions:l};return n.onDownload.call(void 0,g)===!1}return!1},[n.onDownload]),ce=e.useCallback(()=>{var o;t.scroller&&t.scroller.destroy(),t.scroller=new i.Scroller((o=s.current)==null?void 0:o.parentNode,{filter:".k-page",events:{}}),t.scroller.disablePanEventsTracking()},[]),se=e.useCallback(o=>{const r=Array.from(o.querySelectorAll(".k-text-layer"));t.search=new i.SearchService({textContainers:r||[],highlightClass:"k-search-highlight",highlightMarkClass:"k-search-highlight-mark",charClass:"k-text-char"})},[]);t.done=e.useCallback(({pdfPages:o,pdfDoc:r,zoom:l})=>{t.document=r,t.pages=o,t.zoom=l,ce(),b(!1),B(!0),le(),s.current&&i.scrollToPage(s.current,0)},[]),t.error=e.useCallback(o=>{if(t.document=null,t.pages=[],b(!1),B(!1),n.onError){const r={error:typeof o=="string"?{message:o}:o,target:v.current};n.onError.call(void 0,r)}},[n.onError]),e.useEffect(()=>{s.current&&(n.url||n.data||n.arrayBuffer?(b(!0),i.removeChildren(s.current),i.loadPDF({url:n.url,data:n.data,arrayBuffer:n.arrayBuffer,dom:s.current,zoom:t.currentZoom,done:t.done,error:t.error}),G(t.currentZoom)):(t.document=null,t.pages=[],B(!1),b(!1),i.removeChildren(s.current)))},[n.url,n.data,n.arrayBuffer]);const Q=e.useCallback((o,r)=>{s.current&&(b(!0),i.removeChildren(s.current),i.reloadDocument({pdfDoc:o,zoom:r,dom:s.current,done:l=>{t.pages=l,t.zoom=r,b(!1)},error:t.error}))},[]);e.useEffect(()=>{G(h),s.current&&t.document&&h!==t.zoom&&Q(t.document,h)},[h,Q]),e.useEffect(()=>()=>{t.scroller&&t.scroller.destroy(),t.search&&t.search.destroy(),t.document=null,t.pages=[]},[]);const ie=e.useCallback(()=>{U(!0),se(s.current)},[]),ue=e.useCallback(o=>{const r=o.value,l=t.search.search({text:r,matchCase:S});E(l.length?1:0),O(l.length),H(r)},[S]),me=e.useCallback(()=>{const o=t.search.search({text:D,matchCase:!S});E(o.length?1:0),O(o.length),_(!S)},[S,D]),de=e.useCallback(()=>{i.goToNextSearchMatch(t),E(k+1>y?1:k+1)},[k,y]),ge=e.useCallback(()=>{i.goToPreviousSearchMatch(t),E(k-1<1?y:k-1)},[k,y]),X=e.useCallback(()=>{t.search.destroy(),E(0),O(0),_(!1),H(""),U(!1)},[]),fe=e.useCallback(o=>{o.key==="Enter"?(o.preventDefault(),i.goToNextSearchMatch(t),E(k+1>y?1:k+1)):o.key==="Escape"&&X()},[k,y]),he=e.useCallback(o=>{if(s.current){const r=o.skip;i.scrollToPage(s.current,r);const l={page:r+1,target:v.current,syntheticEvent:o.syntheticEvent};n.onPageChange&&n.onPageChange.call(void 0,l)}W(o.skip)},[P,n.onPageChange]),ke=e.useCallback(o=>{if(M.current){const r=i.currentPage(M.current);if(r!==P){W(r);const l={page:r+1,target:v.current,syntheticEvent:o};n.onPageChange&&n.onPageChange.call(void 0,l)}}},[P,n.onPageChange]),ve=e.useCallback(o=>{const r=Math.min(t.currentZoom+z,R);if(r!==t.currentZoom&&t.document&&(L(r),n.onZoom)){const l={zoom:r,target:v.current,syntheticEvent:o};n.onZoom.call(void 0,l)}},[z,R,n.onZoom]),be=e.useCallback(o=>{const r=Math.max(t.currentZoom-z,N);if(r!==t.currentZoom&&t.document&&(L(r),n.onZoom)){const l={zoom:r,target:v.current,syntheticEvent:o};n.onZoom.call(void 0,l)}},[z,N,n.onZoom]),ye=e.useCallback(o=>{const r=o.value===null?{text:"100%",value:1,id:100}:{...o.value};if(r.value===void 0){const g=parseFloat(r.text);typeof g=="number"&&!Number.isNaN(g)?r.value=g/100:r.value=1}let l=r?i.calculateZoomLevel(r.value,r.type,t.currentZoom,s.current):1;if(l=Math.round(l*100)/100,t.currentZoom!==l&&t.document&&(L(l),n.onZoom)){const g={zoom:l,target:v.current,syntheticEvent:o.syntheticEvent};n.onZoom.call(void 0,g)}},[n.onZoom]),pe=e.useCallback(()=>{t.scroller.disablePanEventsTracking(),K(!0)},[]),Ce=e.useCallback(()=>{t.scroller.enablePanEventsTracking(),K(!1)},[]),Ee=e.useCallback(()=>{i.download({pdf:t.document,error:t.error},n.saveFileName,n.saveOptions,J)},[n.url,n.data,n.arrayBuffer,n.saveFileName,n.saveOptions,J]),Se=e.useCallback(()=>{b(!0);const o=l=>{t.error(typeof(l?l.message||l:null)=="string"?l.message||l:u.toLanguageString(a.popupBlocked,a.messages[a.popupBlocked]))},r=()=>{b(!1)};i.print(t.pages,r,o)},[]),xe=e.useCallback(o=>{const r=o.newState;r[0]&&r[0].getRawFile&&r[0].getRawFile().arrayBuffer().then(g=>{if(s.current){b(!0),i.removeChildren(s.current);const F=t.props.zoom===void 0?T:t.props.zoom;i.loadPDF({arrayBuffer:g,dom:s.current,zoom:F,done:t.done,error:t.error}),L(F)}})},[T]),we=e.useCallback(o=>{const r=o.target;if(r instanceof Element&&r.parentNode){const l=r.closest(".k-toolbar"),g=l&&l.querySelector(".k-upload input");g&&g.click()}},[]),Y=ae&&e.createElement("div",{className:"k-loader-container k-loader-container-md k-loader-top"},e.createElement("div",{className:"k-loader-container-overlay k-overlay-light"}),e.createElement("div",{className:"k-loader-container-inner "},e.createElement(Ae.Loader,{size:"large"}))),Ze=e.createElement(m.ButtonGroup,{className:"k-toolbar-button-group k-button-group-solid"},e.createElement(m.Button,{className:"k-group-start",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.zoomOut,a.messages[a.zoomOut]),disabled:h<=N||!d,onClick:be,icon:"zoom-out",svgIcon:f.zoomOutIcon}),e.createElement(m.Button,{className:"k-group-end",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.zoomIn,a.messages[a.zoomIn]),disabled:h>=R||!d,onClick:ve,icon:"zoom-in",svgIcon:f.zoomInIcon})),ze=e.createElement(je.ComboBox,{className:"k-toolbar-combobox",disabled:!d,data:V.map(o=>({...o,text:o.locationString?u.toLanguageString(o.locationString,a.messages[o.locationString]):o.text})),dataItemKey:"id",textField:"text",value:d?Z:null,allowCustom:!0,onChange:ye,placeholder:u.toLanguageString(a.zoomLevel,a.messages[a.zoomLevel])}),Le=e.createElement(Fe.Pager,{disabled:!d,previousNext:!0,type:"input",skip:P,take:1,total:t.pages?t.pages.length:0,info:!1,onPageChange:he}),Pe=e.createElement(m.ToolbarSpacer,null),Ie=e.createElement(m.ButtonGroup,{className:"k-toolbar-button-group k-button-group-solid"},e.createElement(m.Button,{className:"k-group-start",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.enableSelection,a.messages[a.enableSelection]),icon:"pointer",svgIcon:f.pointerIcon,disabled:!d,togglable:!0,selected:I&&d,onClick:pe}),e.createElement(m.Button,{className:"k-group-end",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.enablePanning,a.messages[a.enablePanning]),icon:"hand",svgIcon:f.handIcon,disabled:!d,togglable:!0,selected:!I&&d,onClick:Ce})),Me=e.createElement(m.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.search,a.messages[a.search]),icon:"search",svgIcon:f.searchIcon,disabled:!d,onClick:ie}),Te=e.createElement(e.Fragment,null,e.createElement(m.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.open,a.messages[a.open]),icon:"folder-open",svgIcon:f.folderOpenIcon,onClick:we}),e.createElement("div",{style:{display:"none"}},e.createElement(qe.Upload,{restrictions:{allowedExtensions:[".pdf"]},onAdd:xe,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".pdf,.PDF",withCredentials:!1}))),Ne=e.createElement(m.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.download,a.messages[a.download]),icon:"download",svgIcon:f.downloadIcon,disabled:!d,onClick:Ee}),Re=e.createElement(m.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:u.toLanguageString(a.print,a.messages[a.print]),icon:"print",svgIcon:f.printIcon,disabled:!d,onClick:Se}),Be={pager:Le,spacer:Pe,zoomInOut:Ze,zoom:ze,selection:Ie,search:Me,open:Te,download:Ne,print:Re},Oe=(n.tools||x.tools).map(o=>({...Be[o],key:"toobar-tool-"+o+_e()})),$=e.createElement(m.Toolbar,{buttons:Ue},...Oe),ee=e.createElement("div",{className:j.classNames("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto",{"k-enable-text-select":I,"k-enable-panning":!I}),onScroll:ke},re&&e.createElement("div",{className:"k-search-panel k-pos-sticky k-top-center"},e.createElement(q.TextBox,{value:D,onChange:ue,placeholder:u.toLanguageString(a.search,a.messages[a.search]),autoFocus:!0,onKeyDown:fe,suffix:()=>e.createElement(e.Fragment,null,e.createElement(q.InputSeparator,null),e.createElement(q.InputSuffix,null,e.createElement(m.Button,{icon:"convert-lowercase",svgIcon:f.convertLowercaseIcon,title:u.toLanguageString(a.matchCase,a.messages[a.matchCase]),fillMode:"flat",togglable:!0,selected:S,onClick:me})))}),e.createElement("span",{className:"k-search-matches"},e.createElement("span",null,k)," ",u.toLanguageString(a.searchOf,a.messages[a.searchOf]),e.createElement("span",null,y)),e.createElement(m.Button,{title:u.toLanguageString(a.prevMatch,a.messages[a.prevMatch]),fillMode:"flat",icon:"arrow-up",svgIcon:f.arrowUpIcon,disabled:y===0,onClick:ge}),e.createElement(m.Button,{title:u.toLanguageString(a.nextMatch,a.messages[a.nextMatch]),fillMode:"flat",icon:"arrow-down",svgIcon:f.arrowDownIcon,disabled:y===0,onClick:de}),e.createElement(m.Button,{title:u.toLanguageString(a.close,a.messages[a.close]),fillMode:"flat",icon:"x",svgIcon:f.xIcon,onClick:X})),e.createElement("div",{ref:s,className:"k-pdf-viewer-pages"}));return e.createElement("div",{className:"k-pdf-viewer",style:n.style,ref:M},n.onRenderLoader?n.onRenderLoader.call(void 0,Y||null):Y,n.onRenderToolbar?n.onRenderToolbar.call(void 0,$):$,n.onRenderContent?n.onRenderContent.call(void 0,ee):ee,C&&e.createElement(j.WatermarkOverlay,null))});A.displayName="KendoReactPDFViewer";A.propTypes={url:c.string,data:c.string,arrayBuffer:c.any,typedArray:c.any,style:c.object,saveFileName:c.string,saveOptions:c.object,tools:c.arrayOf(c.oneOf(oe).isRequired),zoomLevels:c.arrayOf(c.any),zoom:c.number,defaultZoom:c.number,minZoom:c.number,maxZoom:c.number,zoomRate:c.number,onError:c.func,onLoad:c.func,onDownload:c.func,onRenderToolbar:c.func,onRenderContent:c.func,onRenderLoader:c.func,onZoom:c.func};exports.PDFViewer=A;
package/PDFViewer.mjs CHANGED
@@ -7,20 +7,20 @@
7
7
  */
8
8
  import * as e from "react";
9
9
  import l from "prop-types";
10
- import { ButtonGroup as Q, Button as d, Toolbar as et, ToolbarSpacer as tt } from "@progress/kendo-react-buttons";
11
- import { TextBox as ot, InputSeparator as at, InputSuffix as nt } from "@progress/kendo-react-inputs";
12
- import { Pager as rt } from "@progress/kendo-react-data-tools";
13
- import { Upload as lt } from "@progress/kendo-react-upload";
14
- import { ComboBox as ct } from "@progress/kendo-react-dropdowns";
15
- import { Loader as st } from "@progress/kendo-react-indicators";
16
- import { validatePackage as it, shouldShowValidationUI as ut, classNames as mt, WatermarkOverlay as dt } from "@progress/kendo-react-common";
17
- import { useLocalization as gt } from "@progress/kendo-react-intl";
18
- import { zoomOutIcon as ft, zoomInIcon as ht, pointerIcon as vt, handIcon as bt, searchIcon as kt, folderOpenIcon as pt, downloadIcon as yt, printIcon as Ct, convertLowercaseIcon as Et, arrowUpIcon as St, arrowDownIcon as xt, xIcon as wt } from "@progress/kendo-svg-icons";
10
+ import { ButtonGroup as Q, Button as d, Toolbar as Ye, ToolbarSpacer as et } from "@progress/kendo-react-buttons";
11
+ import { TextBox as tt, InputSeparator as ot, InputSuffix as at } from "@progress/kendo-react-inputs";
12
+ import { Pager as nt } from "@progress/kendo-react-data-tools";
13
+ import { Upload as rt } from "@progress/kendo-react-upload";
14
+ import { ComboBox as lt } from "@progress/kendo-react-dropdowns";
15
+ import { Loader as ct } from "@progress/kendo-react-indicators";
16
+ import { validatePackage as st, classNames as it, WatermarkOverlay as ut } from "@progress/kendo-react-common";
17
+ import { useLocalization as mt } from "@progress/kendo-react-intl";
18
+ import { zoomOutIcon as dt, zoomInIcon as gt, pointerIcon as ft, handIcon as ht, searchIcon as vt, folderOpenIcon as bt, downloadIcon as kt, printIcon as pt, convertLowercaseIcon as yt, arrowUpIcon as Ct, arrowDownIcon as Et, xIcon as St } from "@progress/kendo-svg-icons";
19
19
  import "pdfjs-dist/build/pdf.worker.min.mjs";
20
- import { packageMetadata as X } from "./package-metadata.mjs";
21
- import { Scroller as Zt, SearchService as Lt, scrollToPage as Y, removeChildren as z, loadPDF as ee, reloadDocument as zt, goToNextSearchMatch as te, goToPreviousSearchMatch as It, currentPage as Nt, calculateZoomLevel as Tt, download as Mt, print as Pt, DEFAULT_ZOOM_LEVEL as Rt } from "@progress/kendo-pdfviewer-common";
22
- import { messages as i, zoomOut as oe, zoomIn as ae, zoomLevel as ne, enableSelection as re, enablePanning as le, search as I, open as ce, download as se, print as ie, matchCase as ue, searchOf as me, prevMatch as de, nextMatch as ge, close as fe, actualWidth as Ft, fitToWidth as Ot, fitToPage as Dt, popupBlocked as he } from "./messages.mjs";
23
- const be = [
20
+ import { packageMetadata as xt } from "./package-metadata.mjs";
21
+ import { Scroller as wt, SearchService as Zt, scrollToPage as X, removeChildren as z, loadPDF as Y, reloadDocument as Lt, goToNextSearchMatch as ee, goToPreviousSearchMatch as zt, currentPage as It, calculateZoomLevel as Nt, download as Tt, print as Mt, DEFAULT_ZOOM_LEVEL as Pt } from "@progress/kendo-pdfviewer-common";
22
+ import { messages as i, zoomOut as te, zoomIn as oe, zoomLevel as ae, enableSelection as ne, enablePanning as re, search as I, open as le, download as ce, print as se, matchCase as ie, searchOf as ue, prevMatch as me, nextMatch as de, close as ge, actualWidth as Rt, fitToWidth as Ft, fitToPage as Dt, popupBlocked as fe } from "./messages.mjs";
23
+ const ve = [
24
24
  "pager",
25
25
  "spacer",
26
26
  "zoomInOut",
@@ -34,11 +34,11 @@ const be = [
34
34
  ], y = {
35
35
  minZoom: 0.5,
36
36
  maxZoom: 4,
37
- tools: [...be],
37
+ tools: [...ve],
38
38
  zoomRate: 0.25,
39
39
  zoomLevels: [
40
- { id: 1, priority: 1, value: 1, text: "Actual width", type: "ActualWidth", locationString: Ft },
41
- { id: 2, priority: 2, value: 1, text: "Fit to width", type: "FitToWidth", locationString: Ot },
40
+ { id: 1, priority: 1, value: 1, text: "Actual width", type: "ActualWidth", locationString: Rt },
41
+ { id: 2, priority: 2, value: 1, text: "Fit to width", type: "FitToWidth", locationString: Ft },
42
42
  { id: 3, priority: 3, value: 1, text: "Fit to page", type: "FitToPage", locationString: Dt },
43
43
  { id: 4, priority: 4, value: 0.5, text: "50%", type: "" },
44
44
  { id: 5, priority: 5, value: 0.75, text: "75%", type: "" },
@@ -49,28 +49,27 @@ const be = [
49
49
  { id: 10, priority: 10, value: 3, text: "300%", type: "" },
50
50
  { id: 11, priority: 11, value: 4, text: "400%", type: "" }
51
51
  ],
52
- defaultZoom: Rt
53
- }, Bt = [
52
+ defaultZoom: Pt
53
+ }, Ot = [
54
54
  ".k-toolbar > button",
55
55
  ".k-toolbar .k-combobox > input",
56
56
  ".k-toolbar .k-button-group > button",
57
57
  ".k-toolbar .k-pager > a",
58
58
  ".k-toolbar .k-pager input"
59
59
  ];
60
- let ve = 0;
61
- function At() {
62
- return ve++, ve;
60
+ let he = 0;
61
+ function Bt() {
62
+ return he++, he;
63
63
  }
64
- const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1 : 0, ke = e.forwardRef((a, E) => {
65
- it(X);
66
- const pe = ut(X), {
67
- zoom: D,
64
+ const At = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1 : 0, be = e.forwardRef((a, E) => {
65
+ const ke = !st(xt, { component: "PDFViewer" }), {
66
+ zoom: O,
68
67
  zoomLevels: B = y.zoomLevels,
69
68
  defaultZoom: N = y.defaultZoom,
70
69
  minZoom: T = y.minZoom,
71
70
  maxZoom: M = y.maxZoom,
72
71
  zoomRate: S = y.zoomRate
73
- } = a, s = gt(), c = e.useRef(null), [ye, x] = e.useState(N), g = D !== void 0 ? D : ye, C = B.slice().sort(Vt).find((o) => o.value === g) || {
72
+ } = a, s = mt(), c = e.useRef(null), [pe, x] = e.useState(N), g = O !== void 0 ? O : pe, C = B.slice().sort(At).find((o) => o.value === g) || {
74
73
  text: g * 100 + "%",
75
74
  value: g,
76
75
  id: g,
@@ -80,7 +79,7 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
80
79
  C.locationString,
81
80
  i[C.locationString]
82
81
  ));
83
- const [u, P] = e.useState(!1), [Ce, v] = e.useState(!0), [w, A] = e.useState(0), [Z, V] = e.useState(!0), [Ee, W] = e.useState(!1), [b, R] = e.useState(0), [f, k] = e.useState(0), [p, K] = e.useState(!1), [F, U] = e.useState(""), t = e.useMemo(() => ({}), []);
82
+ const [u, P] = e.useState(!1), [ye, v] = e.useState(!0), [w, A] = e.useState(0), [Z, V] = e.useState(!0), [Ce, W] = e.useState(!1), [b, R] = e.useState(0), [f, k] = e.useState(0), [p, K] = e.useState(!1), [F, U] = e.useState(""), t = e.useMemo(() => ({}), []);
84
83
  t.currentZoom = g, t.props = a;
85
84
  const j = e.useCallback((o) => {
86
85
  c.current && c.current.style.setProperty("--scale-factor", String(o));
@@ -101,7 +100,7 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
101
100
  }),
102
101
  []
103
102
  ), e.useImperativeHandle(E, () => h.current);
104
- const Se = e.useCallback(() => {
103
+ const Ee = e.useCallback(() => {
105
104
  if (t.props.onLoad) {
106
105
  const o = { target: h.current };
107
106
  t.props.onLoad.call(void 0, o);
@@ -120,15 +119,15 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
120
119
  return !1;
121
120
  },
122
121
  [a.onDownload]
123
- ), xe = e.useCallback(() => {
122
+ ), Se = e.useCallback(() => {
124
123
  var o;
125
- t.scroller && t.scroller.destroy(), t.scroller = new Zt((o = c.current) == null ? void 0 : o.parentNode, {
124
+ t.scroller && t.scroller.destroy(), t.scroller = new wt((o = c.current) == null ? void 0 : o.parentNode, {
126
125
  filter: ".k-page",
127
126
  events: {}
128
127
  }), t.scroller.disablePanEventsTracking();
129
- }, []), we = e.useCallback((o) => {
128
+ }, []), xe = e.useCallback((o) => {
130
129
  const n = Array.from(o.querySelectorAll(".k-text-layer"));
131
- t.search = new Lt({
130
+ t.search = new Zt({
132
131
  textContainers: n || [],
133
132
  highlightClass: "k-search-highlight",
134
133
  highlightMarkClass: "k-search-highlight-mark",
@@ -136,7 +135,7 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
136
135
  });
137
136
  }, []);
138
137
  t.done = e.useCallback(({ pdfPages: o, pdfDoc: n, zoom: r }) => {
139
- t.document = n, t.pages = o, t.zoom = r, xe(), v(!1), P(!0), Se(), c.current && Y(c.current, 0);
138
+ t.document = n, t.pages = o, t.zoom = r, Se(), v(!1), P(!0), Ee(), c.current && X(c.current, 0);
140
139
  }, []), t.error = e.useCallback(
141
140
  (o) => {
142
141
  if (t.document = null, t.pages = [], v(!1), P(!1), a.onError) {
@@ -149,7 +148,7 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
149
148
  },
150
149
  [a.onError]
151
150
  ), e.useEffect(() => {
152
- c.current && (a.url || a.data || a.arrayBuffer ? (v(!0), z(c.current), ee({
151
+ c.current && (a.url || a.data || a.arrayBuffer ? (v(!0), z(c.current), Y({
153
152
  url: a.url,
154
153
  data: a.data,
155
154
  arrayBuffer: a.arrayBuffer,
@@ -160,7 +159,7 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
160
159
  }), j(t.currentZoom)) : (t.document = null, t.pages = [], P(!1), v(!1), z(c.current)));
161
160
  }, [a.url, a.data, a.arrayBuffer]);
162
161
  const H = e.useCallback((o, n) => {
163
- c.current && (v(!0), z(c.current), zt({
162
+ c.current && (v(!0), z(c.current), Lt({
164
163
  pdfDoc: o,
165
164
  zoom: n,
166
165
  dom: c.current,
@@ -175,33 +174,33 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
175
174
  }, [g, H]), e.useEffect(() => () => {
176
175
  t.scroller && t.scroller.destroy(), t.search && t.search.destroy(), t.document = null, t.pages = [];
177
176
  }, []);
178
- const Ze = e.useCallback(() => {
179
- W(!0), we(c.current);
180
- }, []), Le = e.useCallback(
177
+ const we = e.useCallback(() => {
178
+ W(!0), xe(c.current);
179
+ }, []), Ze = e.useCallback(
181
180
  (o) => {
182
181
  const n = o.value, r = t.search.search({ text: n, matchCase: p });
183
182
  k(r.length ? 1 : 0), R(r.length), U(n);
184
183
  },
185
184
  [p]
186
- ), ze = e.useCallback(() => {
185
+ ), Le = e.useCallback(() => {
187
186
  const o = t.search.search({ text: F, matchCase: !p });
188
187
  k(o.length ? 1 : 0), R(o.length), K(!p);
189
- }, [p, F]), Ie = e.useCallback(() => {
190
- te(t), k(f + 1 > b ? 1 : f + 1);
191
- }, [f, b]), Ne = e.useCallback(() => {
192
- It(t), k(f - 1 < 1 ? b : f - 1);
188
+ }, [p, F]), ze = e.useCallback(() => {
189
+ ee(t), k(f + 1 > b ? 1 : f + 1);
190
+ }, [f, b]), Ie = e.useCallback(() => {
191
+ zt(t), k(f - 1 < 1 ? b : f - 1);
193
192
  }, [f, b]), $ = e.useCallback(() => {
194
193
  t.search.destroy(), k(0), R(0), K(!1), U(""), W(!1);
195
- }, []), Te = e.useCallback(
194
+ }, []), Ne = e.useCallback(
196
195
  (o) => {
197
- o.key === "Enter" ? (o.preventDefault(), te(t), k(f + 1 > b ? 1 : f + 1)) : o.key === "Escape" && $();
196
+ o.key === "Enter" ? (o.preventDefault(), ee(t), k(f + 1 > b ? 1 : f + 1)) : o.key === "Escape" && $();
198
197
  },
199
198
  [f, b]
200
- ), Me = e.useCallback(
199
+ ), Te = e.useCallback(
201
200
  (o) => {
202
201
  if (c.current) {
203
202
  const n = o.skip;
204
- Y(c.current, n);
203
+ X(c.current, n);
205
204
  const r = {
206
205
  page: n + 1,
207
206
  target: h.current,
@@ -212,10 +211,10 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
212
211
  A(o.skip);
213
212
  },
214
213
  [w, a.onPageChange]
215
- ), Pe = e.useCallback(
214
+ ), Me = e.useCallback(
216
215
  (o) => {
217
216
  if (L.current) {
218
- const n = Nt(L.current);
217
+ const n = It(L.current);
219
218
  if (n !== w) {
220
219
  A(n);
221
220
  const r = {
@@ -228,7 +227,7 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
228
227
  }
229
228
  },
230
229
  [w, a.onPageChange]
231
- ), Re = e.useCallback(
230
+ ), Pe = e.useCallback(
232
231
  (o) => {
233
232
  const n = Math.min(t.currentZoom + S, M);
234
233
  if (n !== t.currentZoom && t.document && (x(n), a.onZoom)) {
@@ -241,7 +240,7 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
241
240
  }
242
241
  },
243
242
  [S, M, a.onZoom]
244
- ), Fe = e.useCallback(
243
+ ), Re = e.useCallback(
245
244
  (o) => {
246
245
  const n = Math.max(t.currentZoom - S, T);
247
246
  if (n !== t.currentZoom && t.document && (x(n), a.onZoom)) {
@@ -254,14 +253,14 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
254
253
  }
255
254
  },
256
255
  [S, T, a.onZoom]
257
- ), Oe = e.useCallback(
256
+ ), Fe = e.useCallback(
258
257
  (o) => {
259
258
  const n = o.value === null ? { text: "100%", value: 1, id: 100 } : { ...o.value };
260
259
  if (n.value === void 0) {
261
260
  const m = parseFloat(n.text);
262
261
  typeof m == "number" && !Number.isNaN(m) ? n.value = m / 100 : n.value = 1;
263
262
  }
264
- let r = n ? Tt(n.value, n.type, t.currentZoom, c.current) : 1;
263
+ let r = n ? Nt(n.value, n.type, t.currentZoom, c.current) : 1;
265
264
  if (r = Math.round(r * 100) / 100, t.currentZoom !== r && t.document && (x(r), a.onZoom)) {
266
265
  const m = {
267
266
  zoom: r,
@@ -274,10 +273,10 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
274
273
  [a.onZoom]
275
274
  ), De = e.useCallback(() => {
276
275
  t.scroller.disablePanEventsTracking(), V(!0);
277
- }, []), Be = e.useCallback(() => {
276
+ }, []), Oe = e.useCallback(() => {
278
277
  t.scroller.enablePanEventsTracking(), V(!1);
279
- }, []), Ae = e.useCallback(() => {
280
- Mt(
278
+ }, []), Be = e.useCallback(() => {
279
+ Tt(
281
280
  {
282
281
  pdf: t.document,
283
282
  error: t.error
@@ -286,51 +285,51 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
286
285
  a.saveOptions,
287
286
  q
288
287
  );
289
- }, [a.url, a.data, a.arrayBuffer, a.saveFileName, a.saveOptions, q]), Ve = e.useCallback(() => {
288
+ }, [a.url, a.data, a.arrayBuffer, a.saveFileName, a.saveOptions, q]), Ae = e.useCallback(() => {
290
289
  v(!0);
291
290
  const o = (r) => {
292
291
  t.error(
293
- typeof (r ? r.message || r : null) == "string" ? r.message || r : s.toLanguageString(he, i[he])
292
+ typeof (r ? r.message || r : null) == "string" ? r.message || r : s.toLanguageString(fe, i[fe])
294
293
  );
295
294
  }, n = () => {
296
295
  v(!1);
297
296
  };
298
- Pt(t.pages, n, o);
299
- }, []), We = e.useCallback(
297
+ Mt(t.pages, n, o);
298
+ }, []), Ve = e.useCallback(
300
299
  (o) => {
301
300
  const n = o.newState;
302
301
  n[0] && n[0].getRawFile && n[0].getRawFile().arrayBuffer().then((m) => {
303
302
  if (c.current) {
304
303
  v(!0), z(c.current);
305
- const O = t.props.zoom === void 0 ? N : t.props.zoom;
306
- ee({
304
+ const D = t.props.zoom === void 0 ? N : t.props.zoom;
305
+ Y({
307
306
  arrayBuffer: m,
308
307
  dom: c.current,
309
- zoom: O,
308
+ zoom: D,
310
309
  done: t.done,
311
310
  error: t.error
312
- }), x(O);
311
+ }), x(D);
313
312
  }
314
313
  });
315
314
  },
316
315
  [N]
317
- ), Ke = e.useCallback((o) => {
316
+ ), We = e.useCallback((o) => {
318
317
  const n = o.target;
319
318
  if (n instanceof Element && n.parentNode) {
320
319
  const r = n.closest(".k-toolbar"), m = r && r.querySelector(".k-upload input");
321
320
  m && m.click();
322
321
  }
323
- }, []), _ = Ce && /* @__PURE__ */ e.createElement("div", { className: "k-loader-container k-loader-container-md k-loader-top" }, /* @__PURE__ */ e.createElement("div", { className: "k-loader-container-overlay k-overlay-light" }), /* @__PURE__ */ e.createElement("div", { className: "k-loader-container-inner " }, /* @__PURE__ */ e.createElement(st, { size: "large" }))), Ue = /* @__PURE__ */ e.createElement(Q, { className: "k-toolbar-button-group k-button-group-solid" }, /* @__PURE__ */ e.createElement(
322
+ }, []), _ = ye && /* @__PURE__ */ e.createElement("div", { className: "k-loader-container k-loader-container-md k-loader-top" }, /* @__PURE__ */ e.createElement("div", { className: "k-loader-container-overlay k-overlay-light" }), /* @__PURE__ */ e.createElement("div", { className: "k-loader-container-inner " }, /* @__PURE__ */ e.createElement(ct, { size: "large" }))), Ke = /* @__PURE__ */ e.createElement(Q, { className: "k-toolbar-button-group k-button-group-solid" }, /* @__PURE__ */ e.createElement(
324
323
  d,
325
324
  {
326
325
  className: "k-group-start",
327
326
  fillMode: "flat",
328
327
  themeColor: "base",
329
- title: s.toLanguageString(oe, i[oe]),
328
+ title: s.toLanguageString(te, i[te]),
330
329
  disabled: g <= T || !u,
331
- onClick: Fe,
330
+ onClick: Re,
332
331
  icon: "zoom-out",
333
- svgIcon: ft
332
+ svgIcon: dt
334
333
  }
335
334
  ), /* @__PURE__ */ e.createElement(
336
335
  d,
@@ -338,14 +337,14 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
338
337
  className: "k-group-end",
339
338
  fillMode: "flat",
340
339
  themeColor: "base",
341
- title: s.toLanguageString(ae, i[ae]),
340
+ title: s.toLanguageString(oe, i[oe]),
342
341
  disabled: g >= M || !u,
343
- onClick: Re,
342
+ onClick: Pe,
344
343
  icon: "zoom-in",
345
- svgIcon: ht
344
+ svgIcon: gt
346
345
  }
347
- )), je = /* @__PURE__ */ e.createElement(
348
- ct,
346
+ )), Ue = /* @__PURE__ */ e.createElement(
347
+ lt,
349
348
  {
350
349
  className: "k-toolbar-combobox",
351
350
  disabled: !u,
@@ -357,11 +356,11 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
357
356
  textField: "text",
358
357
  value: u ? C : null,
359
358
  allowCustom: !0,
360
- onChange: Oe,
361
- placeholder: s.toLanguageString(ne, i[ne])
359
+ onChange: Fe,
360
+ placeholder: s.toLanguageString(ae, i[ae])
362
361
  }
363
- ), qe = /* @__PURE__ */ e.createElement(
364
- rt,
362
+ ), je = /* @__PURE__ */ e.createElement(
363
+ nt,
365
364
  {
366
365
  disabled: !u,
367
366
  previousNext: !0,
@@ -370,17 +369,17 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
370
369
  take: 1,
371
370
  total: t.pages ? t.pages.length : 0,
372
371
  info: !1,
373
- onPageChange: Me
372
+ onPageChange: Te
374
373
  }
375
- ), He = /* @__PURE__ */ e.createElement(tt, null), $e = /* @__PURE__ */ e.createElement(Q, { className: "k-toolbar-button-group k-button-group-solid" }, /* @__PURE__ */ e.createElement(
374
+ ), qe = /* @__PURE__ */ e.createElement(et, null), He = /* @__PURE__ */ e.createElement(Q, { className: "k-toolbar-button-group k-button-group-solid" }, /* @__PURE__ */ e.createElement(
376
375
  d,
377
376
  {
378
377
  className: "k-group-start",
379
378
  fillMode: "flat",
380
379
  themeColor: "base",
381
- title: s.toLanguageString(re, i[re]),
380
+ title: s.toLanguageString(ne, i[ne]),
382
381
  icon: "pointer",
383
- svgIcon: vt,
382
+ svgIcon: ft,
384
383
  disabled: !u,
385
384
  togglable: !0,
386
385
  selected: Z && u,
@@ -392,15 +391,15 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
392
391
  className: "k-group-end",
393
392
  fillMode: "flat",
394
393
  themeColor: "base",
395
- title: s.toLanguageString(le, i[le]),
394
+ title: s.toLanguageString(re, i[re]),
396
395
  icon: "hand",
397
- svgIcon: bt,
396
+ svgIcon: ht,
398
397
  disabled: !u,
399
398
  togglable: !0,
400
399
  selected: !Z && u,
401
- onClick: Be
400
+ onClick: Oe
402
401
  }
403
- )), _e = /* @__PURE__ */ e.createElement(
402
+ )), $e = /* @__PURE__ */ e.createElement(
404
403
  d,
405
404
  {
406
405
  className: "k-toolbar-button",
@@ -408,135 +407,135 @@ const Vt = (a, E) => a.priority > E.priority ? -1 : a.priority < E.priority ? 1
408
407
  themeColor: "base",
409
408
  title: s.toLanguageString(I, i[I]),
410
409
  icon: "search",
411
- svgIcon: kt,
410
+ svgIcon: vt,
412
411
  disabled: !u,
413
- onClick: Ze
412
+ onClick: we
414
413
  }
415
- ), Ge = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
414
+ ), _e = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
416
415
  d,
417
416
  {
418
417
  className: "k-toolbar-button",
419
418
  fillMode: "flat",
420
419
  themeColor: "base",
421
- title: s.toLanguageString(ce, i[ce]),
420
+ title: s.toLanguageString(le, i[le]),
422
421
  icon: "folder-open",
423
- svgIcon: pt,
424
- onClick: Ke
422
+ svgIcon: bt,
423
+ onClick: We
425
424
  }
426
425
  ), /* @__PURE__ */ e.createElement("div", { style: { display: "none" } }, /* @__PURE__ */ e.createElement(
427
- lt,
426
+ rt,
428
427
  {
429
428
  restrictions: { allowedExtensions: [".pdf"] },
430
- onAdd: We,
429
+ onAdd: Ve,
431
430
  autoUpload: !1,
432
431
  defaultFiles: [],
433
432
  multiple: !1,
434
433
  accept: ".pdf,.PDF",
435
434
  withCredentials: !1
436
435
  }
437
- ))), Je = /* @__PURE__ */ e.createElement(
436
+ ))), Ge = /* @__PURE__ */ e.createElement(
438
437
  d,
439
438
  {
440
439
  className: "k-toolbar-button",
441
440
  fillMode: "flat",
442
441
  themeColor: "base",
443
- title: s.toLanguageString(se, i[se]),
442
+ title: s.toLanguageString(ce, i[ce]),
444
443
  icon: "download",
445
- svgIcon: yt,
444
+ svgIcon: kt,
446
445
  disabled: !u,
447
- onClick: Ae
446
+ onClick: Be
448
447
  }
449
- ), Qe = /* @__PURE__ */ e.createElement(
448
+ ), Je = /* @__PURE__ */ e.createElement(
450
449
  d,
451
450
  {
452
451
  className: "k-toolbar-button",
453
452
  fillMode: "flat",
454
453
  themeColor: "base",
455
- title: s.toLanguageString(ie, i[ie]),
454
+ title: s.toLanguageString(se, i[se]),
456
455
  icon: "print",
457
- svgIcon: Ct,
456
+ svgIcon: pt,
458
457
  disabled: !u,
459
- onClick: Ve
458
+ onClick: Ae
460
459
  }
461
- ), Xe = {
462
- pager: qe,
463
- spacer: He,
464
- zoomInOut: Ue,
465
- zoom: je,
466
- selection: $e,
467
- search: _e,
468
- open: Ge,
469
- download: Je,
470
- print: Qe
471
- }, Ye = (a.tools || y.tools).map((o) => ({
472
- ...Xe[o],
473
- key: "toobar-tool-" + o + At()
474
- })), G = /* @__PURE__ */ e.createElement(et, { buttons: Bt }, ...Ye), J = /* @__PURE__ */ e.createElement(
460
+ ), Qe = {
461
+ pager: je,
462
+ spacer: qe,
463
+ zoomInOut: Ke,
464
+ zoom: Ue,
465
+ selection: He,
466
+ search: $e,
467
+ open: _e,
468
+ download: Ge,
469
+ print: Je
470
+ }, Xe = (a.tools || y.tools).map((o) => ({
471
+ ...Qe[o],
472
+ key: "toobar-tool-" + o + Bt()
473
+ })), G = /* @__PURE__ */ e.createElement(Ye, { buttons: Ot }, ...Xe), J = /* @__PURE__ */ e.createElement(
475
474
  "div",
476
475
  {
477
- className: mt("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto", {
476
+ className: it("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto", {
478
477
  "k-enable-text-select": Z,
479
478
  "k-enable-panning": !Z
480
479
  }),
481
- onScroll: Pe
480
+ onScroll: Me
482
481
  },
483
- Ee && /* @__PURE__ */ e.createElement("div", { className: "k-search-panel k-pos-sticky k-top-center" }, /* @__PURE__ */ e.createElement(
484
- ot,
482
+ Ce && /* @__PURE__ */ e.createElement("div", { className: "k-search-panel k-pos-sticky k-top-center" }, /* @__PURE__ */ e.createElement(
483
+ tt,
485
484
  {
486
485
  value: F,
487
- onChange: Le,
486
+ onChange: Ze,
488
487
  placeholder: s.toLanguageString(I, i[I]),
489
488
  autoFocus: !0,
490
- onKeyDown: Te,
491
- suffix: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(at, null), /* @__PURE__ */ e.createElement(nt, null, /* @__PURE__ */ e.createElement(
489
+ onKeyDown: Ne,
490
+ suffix: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(ot, null), /* @__PURE__ */ e.createElement(at, null, /* @__PURE__ */ e.createElement(
492
491
  d,
493
492
  {
494
493
  icon: "convert-lowercase",
495
- svgIcon: Et,
496
- title: s.toLanguageString(ue, i[ue]),
494
+ svgIcon: yt,
495
+ title: s.toLanguageString(ie, i[ie]),
497
496
  fillMode: "flat",
498
497
  togglable: !0,
499
498
  selected: p,
500
- onClick: ze
499
+ onClick: Le
501
500
  }
502
501
  )))
503
502
  }
504
- ), /* @__PURE__ */ e.createElement("span", { className: "k-search-matches" }, /* @__PURE__ */ e.createElement("span", null, f), " ", s.toLanguageString(me, i[me]), /* @__PURE__ */ e.createElement("span", null, b)), /* @__PURE__ */ e.createElement(
503
+ ), /* @__PURE__ */ e.createElement("span", { className: "k-search-matches" }, /* @__PURE__ */ e.createElement("span", null, f), " ", s.toLanguageString(ue, i[ue]), /* @__PURE__ */ e.createElement("span", null, b)), /* @__PURE__ */ e.createElement(
505
504
  d,
506
505
  {
507
- title: s.toLanguageString(de, i[de]),
506
+ title: s.toLanguageString(me, i[me]),
508
507
  fillMode: "flat",
509
508
  icon: "arrow-up",
510
- svgIcon: St,
509
+ svgIcon: Ct,
511
510
  disabled: b === 0,
512
- onClick: Ne
511
+ onClick: Ie
513
512
  }
514
513
  ), /* @__PURE__ */ e.createElement(
515
514
  d,
516
515
  {
517
- title: s.toLanguageString(ge, i[ge]),
516
+ title: s.toLanguageString(de, i[de]),
518
517
  fillMode: "flat",
519
518
  icon: "arrow-down",
520
- svgIcon: xt,
519
+ svgIcon: Et,
521
520
  disabled: b === 0,
522
- onClick: Ie
521
+ onClick: ze
523
522
  }
524
523
  ), /* @__PURE__ */ e.createElement(
525
524
  d,
526
525
  {
527
- title: s.toLanguageString(fe, i[fe]),
526
+ title: s.toLanguageString(ge, i[ge]),
528
527
  fillMode: "flat",
529
528
  icon: "x",
530
- svgIcon: wt,
529
+ svgIcon: St,
531
530
  onClick: $
532
531
  }
533
532
  )),
534
533
  /* @__PURE__ */ e.createElement("div", { ref: c, className: "k-pdf-viewer-pages" })
535
534
  );
536
- return /* @__PURE__ */ e.createElement("div", { className: "k-pdf-viewer", style: a.style, ref: L }, a.onRenderLoader ? a.onRenderLoader.call(void 0, _ || null) : _, a.onRenderToolbar ? a.onRenderToolbar.call(void 0, G) : G, a.onRenderContent ? a.onRenderContent.call(void 0, J) : J, pe && /* @__PURE__ */ e.createElement(dt, null));
535
+ return /* @__PURE__ */ e.createElement("div", { className: "k-pdf-viewer", style: a.style, ref: L }, a.onRenderLoader ? a.onRenderLoader.call(void 0, _ || null) : _, a.onRenderToolbar ? a.onRenderToolbar.call(void 0, G) : G, a.onRenderContent ? a.onRenderContent.call(void 0, J) : J, ke && /* @__PURE__ */ e.createElement(ut, null));
537
536
  });
538
- ke.displayName = "KendoReactPDFViewer";
539
- ke.propTypes = {
537
+ be.displayName = "KendoReactPDFViewer";
538
+ be.propTypes = {
540
539
  url: l.string,
541
540
  data: l.string,
542
541
  arrayBuffer: l.any,
@@ -544,7 +543,7 @@ ke.propTypes = {
544
543
  style: l.object,
545
544
  saveFileName: l.string,
546
545
  saveOptions: l.object,
547
- tools: l.arrayOf(l.oneOf(be).isRequired),
546
+ tools: l.arrayOf(l.oneOf(ve).isRequired),
548
547
  zoomLevels: l.arrayOf(l.any),
549
548
  zoom: l.number,
550
549
  defaultZoom: l.number,
@@ -560,5 +559,5 @@ ke.propTypes = {
560
559
  onZoom: l.func
561
560
  };
562
561
  export {
563
- ke as PDFViewer
562
+ be as PDFViewer
564
563
  };
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@progress/kendo-pdfviewer-common"),require("react"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-inputs"),require("@progress/kendo-react-data-tools"),require("@progress/kendo-react-upload"),require("@progress/kendo-react-dropdowns"),require("@progress/kendo-react-indicators"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl"),require("@progress/kendo-svg-icons"),require("pdfjs-dist/build/pdf.worker.min.mjs")):"function"==typeof define&&define.amd?define(["exports","@progress/kendo-pdfviewer-common","react","prop-types","@progress/kendo-react-buttons","@progress/kendo-react-inputs","@progress/kendo-react-data-tools","@progress/kendo-react-upload","@progress/kendo-react-dropdowns","@progress/kendo-react-indicators","@progress/kendo-react-common","@progress/kendo-react-intl","@progress/kendo-svg-icons","pdfjs-dist/build/pdf.worker.min.mjs"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactPdfViewer={},e.KendoPdfviewerCommon,e.React,e.PropTypes,e.KendoReactButtons,e.KendoReactInputs,e.KendoReactDataTools,e.KendoReactUpload,e.KendoReactDropdowns,e.KendoReactIndicators,e.KendoReactCommon,e.KendoReactIntl,e.KendoSvgIcons)}(this,(function(e,o,t,r,a,n,l,c,s,i,u,d,p){"use strict";function m(e){var o=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),o.default=e,Object.freeze(o)}var g=m(t);const f={name:"@progress/kendo-react-pdf-viewer",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:1673300081,version:"$VERSION",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"},v="pdfviewer.zoomIn",k="pdfviewer.zoomOut",b="pdfviewer.zoomLevel",h="pdfviewer.enableSelection",y="pdfviewer.enablePanning",C="pdfviewer.search",w="pdfviewer.open",E="pdfviewer.download",S="pdfviewer.print",x="pdfviewer.close",I="pdfviewer.matchCase",P="pdfviewer.prevMatch",N="pdfviewer.nextMatch",z="pdfviewer.actualWidth",L="pdfviewer.fitToWidth",R="pdfviewer.fitToPage",Z="pdfviewer.popupBlocked",T="pdfviewer.searchOf",O={[v]:"Zoom in",[k]:"Zoom out",[b]:"Choose zoom level",[h]:"Enable selection",[y]:"Enable panning",[C]:"Search",[w]:"Open",[E]:"Download",[T]:"of",[S]:"Print",[x]:"Close",[I]:"Match case",[P]:"Previous match",[N]:"Next match",[z]:"Actual width",[L]:"Fit to width",[R]:"Fit to page",[Z]:"Popup is blocked."},B=["pager","spacer","zoomInOut","zoom","selection","spacer","search","open","download","print"],D={minZoom:.5,maxZoom:4,tools:[...B],zoomRate:.25,zoomLevels:[{id:1,priority:1,value:1,text:"Actual width",type:"ActualWidth",locationString:z},{id:2,priority:2,value:1,text:"Fit to width",type:"FitToWidth",locationString:L},{id:3,priority:3,value:1,text:"Fit to page",type:"FitToPage",locationString:R},{id:4,priority:4,value:.5,text:"50%",type:""},{id:5,priority:5,value:.75,text:"75%",type:""},{id:6,priority:100,value:1,text:"100%",type:""},{id:7,priority:7,value:1.25,text:"125%",type:""},{id:8,priority:8,value:1.5,text:"150%",type:""},{id:9,priority:9,value:2,text:"200%",type:""},{id:10,priority:10,value:3,text:"300%",type:""},{id:11,priority:11,value:4,text:"400%",type:""}],defaultZoom:o.DEFAULT_ZOOM_LEVEL},M=[".k-toolbar > button",".k-toolbar .k-combobox > input",".k-toolbar .k-button-group > button",".k-toolbar .k-pager > a",".k-toolbar .k-pager input"];let F=0;const K=(e,o)=>e.priority>o.priority?-1:e.priority<o.priority?1:0,q=g.forwardRef(((e,t)=>{u.validatePackage(f);const r=u.shouldShowValidationUI(f),{zoom:m,zoomLevels:z=D.zoomLevels,defaultZoom:L=D.defaultZoom,minZoom:R=D.minZoom,maxZoom:B=D.maxZoom,zoomRate:q=D.zoomRate}=e,j=d.useLocalization(),A=g.useRef(null),[U,V]=g.useState(L),W=void 0!==m?m:U,_=z.slice().sort(K).find((e=>e.value===W))||{text:100*W+"%",value:W,id:W,locationString:""};_.locationString&&(_.text=j.toLanguageString(_.locationString,O[_.locationString]));const[G,H]=g.useState(!1),[$,J]=g.useState(!0),[Q,X]=g.useState(0),[Y,ee]=g.useState(!0),[oe,te]=g.useState(!1),[re,ae]=g.useState(0),[ne,le]=g.useState(0),[ce,se]=g.useState(!1),[ie,ue]=g.useState(""),de=g.useMemo((()=>({})),[]);de.currentZoom=W,de.props=e;const pe=g.useCallback((e=>{A.current&&A.current.style.setProperty("--scale-factor",String(e))}),[]),me=g.useRef(null),ge=g.useRef(null);g.useImperativeHandle(me,(()=>({get element(){return ge.current},props:e,get pages(){return de.pages},get document(){return de.document}})),[]),g.useImperativeHandle(t,(()=>me.current));const fe=g.useCallback((()=>{if(de.props.onLoad){const e={target:me.current};de.props.onLoad.call(void 0,e)}}),[]),ve=g.useCallback(((o,t,r)=>{if(e.onDownload){const a={target:me.current,blob:o,fileName:t,saveOptions:r};return!1===e.onDownload.call(void 0,a)}return!1}),[e.onDownload]),ke=g.useCallback((()=>{var e;de.scroller&&de.scroller.destroy(),de.scroller=new o.Scroller(null==(e=A.current)?void 0:e.parentNode,{filter:".k-page",events:{}}),de.scroller.disablePanEventsTracking()}),[]),be=g.useCallback((e=>{const t=Array.from(e.querySelectorAll(".k-text-layer"));de.search=new o.SearchService({textContainers:t||[],highlightClass:"k-search-highlight",highlightMarkClass:"k-search-highlight-mark",charClass:"k-text-char"})}),[]);de.done=g.useCallback((({pdfPages:e,pdfDoc:t,zoom:r})=>{de.document=t,de.pages=e,de.zoom=r,ke(),J(!1),H(!0),fe(),A.current&&o.scrollToPage(A.current,0)}),[]),de.error=g.useCallback((o=>{if(de.document=null,de.pages=[],J(!1),H(!1),e.onError){const t={error:"string"==typeof o?{message:o}:o,target:me.current};e.onError.call(void 0,t)}}),[e.onError]),g.useEffect((()=>{A.current&&(e.url||e.data||e.arrayBuffer?(J(!0),o.removeChildren(A.current),o.loadPDF({url:e.url,data:e.data,arrayBuffer:e.arrayBuffer,dom:A.current,zoom:de.currentZoom,done:de.done,error:de.error}),pe(de.currentZoom)):(de.document=null,de.pages=[],H(!1),J(!1),o.removeChildren(A.current)))}),[e.url,e.data,e.arrayBuffer]);const he=g.useCallback(((e,t)=>{A.current&&(J(!0),o.removeChildren(A.current),o.reloadDocument({pdfDoc:e,zoom:t,dom:A.current,done:e=>{de.pages=e,de.zoom=t,J(!1)},error:de.error}))}),[]);g.useEffect((()=>{pe(W),A.current&&de.document&&W!==de.zoom&&he(de.document,W)}),[W,he]),g.useEffect((()=>()=>{de.scroller&&de.scroller.destroy(),de.search&&de.search.destroy(),de.document=null,de.pages=[]}),[]);const ye=g.useCallback((()=>{te(!0),be(A.current)}),[]),Ce=g.useCallback((e=>{const o=e.value,t=de.search.search({text:o,matchCase:ce});le(t.length?1:0),ae(t.length),ue(o)}),[ce]),we=g.useCallback((()=>{const e=de.search.search({text:ie,matchCase:!ce});le(e.length?1:0),ae(e.length),se(!ce)}),[ce,ie]),Ee=g.useCallback((()=>{o.goToNextSearchMatch(de),le(ne+1>re?1:ne+1)}),[ne,re]),Se=g.useCallback((()=>{o.goToPreviousSearchMatch(de),le(ne-1<1?re:ne-1)}),[ne,re]),xe=g.useCallback((()=>{de.search.destroy(),le(0),ae(0),se(!1),ue(""),te(!1)}),[]),Ie=g.useCallback((e=>{"Enter"===e.key?(e.preventDefault(),o.goToNextSearchMatch(de),le(ne+1>re?1:ne+1)):"Escape"===e.key&&xe()}),[ne,re]),Pe=g.useCallback((t=>{if(A.current){const r=t.skip;o.scrollToPage(A.current,r);const a={page:r+1,target:me.current,syntheticEvent:t.syntheticEvent};e.onPageChange&&e.onPageChange.call(void 0,a)}X(t.skip)}),[Q,e.onPageChange]),Ne=g.useCallback((t=>{if(ge.current){const r=o.currentPage(ge.current);if(r!==Q){X(r);const o={page:r+1,target:me.current,syntheticEvent:t};e.onPageChange&&e.onPageChange.call(void 0,o)}}}),[Q,e.onPageChange]),ze=g.useCallback((o=>{const t=Math.min(de.currentZoom+q,B);if(t!==de.currentZoom&&de.document&&(V(t),e.onZoom)){const r={zoom:t,target:me.current,syntheticEvent:o};e.onZoom.call(void 0,r)}}),[q,B,e.onZoom]),Le=g.useCallback((o=>{const t=Math.max(de.currentZoom-q,R);if(t!==de.currentZoom&&de.document&&(V(t),e.onZoom)){const r={zoom:t,target:me.current,syntheticEvent:o};e.onZoom.call(void 0,r)}}),[q,R,e.onZoom]),Re=g.useCallback((t=>{const r=null===t.value?{text:"100%",value:1,id:100}:{...t.value};if(void 0===r.value){const e=parseFloat(r.text);"number"!=typeof e||Number.isNaN(e)?r.value=1:r.value=e/100}let a=r?o.calculateZoomLevel(r.value,r.type,de.currentZoom,A.current):1;if(a=Math.round(100*a)/100,de.currentZoom!==a&&de.document&&(V(a),e.onZoom)){const o={zoom:a,target:me.current,syntheticEvent:t.syntheticEvent};e.onZoom.call(void 0,o)}}),[e.onZoom]),Ze=g.useCallback((()=>{de.scroller.disablePanEventsTracking(),ee(!0)}),[]),Te=g.useCallback((()=>{de.scroller.enablePanEventsTracking(),ee(!1)}),[]),Oe=g.useCallback((()=>{o.download({pdf:de.document,error:de.error},e.saveFileName,e.saveOptions,ve)}),[e.url,e.data,e.arrayBuffer,e.saveFileName,e.saveOptions,ve]),Be=g.useCallback((()=>{J(!0);o.print(de.pages,(()=>{J(!1)}),(e=>{de.error("string"==typeof(e?e.message||e:null)?e.message||e:j.toLanguageString(Z,O[Z]))}))}),[]),De=g.useCallback((e=>{const t=e.newState;t[0]&&t[0].getRawFile&&t[0].getRawFile().arrayBuffer().then((e=>{if(A.current){J(!0),o.removeChildren(A.current);const t=void 0===de.props.zoom?L:de.props.zoom;o.loadPDF({arrayBuffer:e,dom:A.current,zoom:t,done:de.done,error:de.error}),V(t)}}))}),[L]),Me=g.useCallback((e=>{const o=e.target;if(o instanceof Element&&o.parentNode){const e=o.closest(".k-toolbar"),t=e&&e.querySelector(".k-upload input");t&&t.click()}}),[]),Fe=$&&g.createElement("div",{className:"k-loader-container k-loader-container-md k-loader-top"},g.createElement("div",{className:"k-loader-container-overlay k-overlay-light"}),g.createElement("div",{className:"k-loader-container-inner "},g.createElement(i.Loader,{size:"large"}))),Ke=g.createElement(a.ButtonGroup,{className:"k-toolbar-button-group k-button-group-solid"},g.createElement(a.Button,{className:"k-group-start",fillMode:"flat",themeColor:"base",title:j.toLanguageString(k,O[k]),disabled:W<=R||!G,onClick:Le,icon:"zoom-out",svgIcon:p.zoomOutIcon}),g.createElement(a.Button,{className:"k-group-end",fillMode:"flat",themeColor:"base",title:j.toLanguageString(v,O[v]),disabled:W>=B||!G,onClick:ze,icon:"zoom-in",svgIcon:p.zoomInIcon})),qe=g.createElement(s.ComboBox,{className:"k-toolbar-combobox",disabled:!G,data:z.map((e=>({...e,text:e.locationString?j.toLanguageString(e.locationString,O[e.locationString]):e.text}))),dataItemKey:"id",textField:"text",value:G?_:null,allowCustom:!0,onChange:Re,placeholder:j.toLanguageString(b,O[b])}),je={pager:g.createElement(l.Pager,{disabled:!G,previousNext:!0,type:"input",skip:Q,take:1,total:de.pages?de.pages.length:0,info:!1,onPageChange:Pe}),spacer:g.createElement(a.ToolbarSpacer,null),zoomInOut:Ke,zoom:qe,selection:g.createElement(a.ButtonGroup,{className:"k-toolbar-button-group k-button-group-solid"},g.createElement(a.Button,{className:"k-group-start",fillMode:"flat",themeColor:"base",title:j.toLanguageString(h,O[h]),icon:"pointer",svgIcon:p.pointerIcon,disabled:!G,togglable:!0,selected:Y&&G,onClick:Ze}),g.createElement(a.Button,{className:"k-group-end",fillMode:"flat",themeColor:"base",title:j.toLanguageString(y,O[y]),icon:"hand",svgIcon:p.handIcon,disabled:!G,togglable:!0,selected:!Y&&G,onClick:Te})),search:g.createElement(a.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:j.toLanguageString(C,O[C]),icon:"search",svgIcon:p.searchIcon,disabled:!G,onClick:ye}),open:g.createElement(g.Fragment,null,g.createElement(a.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:j.toLanguageString(w,O[w]),icon:"folder-open",svgIcon:p.folderOpenIcon,onClick:Me}),g.createElement("div",{style:{display:"none"}},g.createElement(c.Upload,{restrictions:{allowedExtensions:[".pdf"]},onAdd:De,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".pdf,.PDF",withCredentials:!1}))),download:g.createElement(a.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:j.toLanguageString(E,O[E]),icon:"download",svgIcon:p.downloadIcon,disabled:!G,onClick:Oe}),print:g.createElement(a.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:j.toLanguageString(S,O[S]),icon:"print",svgIcon:p.printIcon,disabled:!G,onClick:Be})},Ae=(e.tools||D.tools).map((e=>({...je[e],key:"toobar-tool-"+e+(F++,F)}))),Ue=g.createElement(a.Toolbar,{buttons:M},...Ae),Ve=g.createElement("div",{className:u.classNames("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto",{"k-enable-text-select":Y,"k-enable-panning":!Y}),onScroll:Ne},oe&&g.createElement("div",{className:"k-search-panel k-pos-sticky k-top-center"},g.createElement(n.TextBox,{value:ie,onChange:Ce,placeholder:j.toLanguageString(C,O[C]),autoFocus:!0,onKeyDown:Ie,suffix:()=>g.createElement(g.Fragment,null,g.createElement(n.InputSeparator,null),g.createElement(n.InputSuffix,null,g.createElement(a.Button,{icon:"convert-lowercase",svgIcon:p.convertLowercaseIcon,title:j.toLanguageString(I,O[I]),fillMode:"flat",togglable:!0,selected:ce,onClick:we})))}),g.createElement("span",{className:"k-search-matches"},g.createElement("span",null,ne)," ",j.toLanguageString(T,O[T]),g.createElement("span",null,re)),g.createElement(a.Button,{title:j.toLanguageString(P,O[P]),fillMode:"flat",icon:"arrow-up",svgIcon:p.arrowUpIcon,disabled:0===re,onClick:Se}),g.createElement(a.Button,{title:j.toLanguageString(N,O[N]),fillMode:"flat",icon:"arrow-down",svgIcon:p.arrowDownIcon,disabled:0===re,onClick:Ee}),g.createElement(a.Button,{title:j.toLanguageString(x,O[x]),fillMode:"flat",icon:"x",svgIcon:p.xIcon,onClick:xe})),g.createElement("div",{ref:A,className:"k-pdf-viewer-pages"}));return g.createElement("div",{className:"k-pdf-viewer",style:e.style,ref:ge},e.onRenderLoader?e.onRenderLoader.call(void 0,Fe||null):Fe,e.onRenderToolbar?e.onRenderToolbar.call(void 0,Ue):Ue,e.onRenderContent?e.onRenderContent.call(void 0,Ve):Ve,r&&g.createElement(u.WatermarkOverlay,null))}));q.displayName="KendoReactPDFViewer",q.propTypes={url:r.string,data:r.string,arrayBuffer:r.any,typedArray:r.any,style:r.object,saveFileName:r.string,saveOptions:r.object,tools:r.arrayOf(r.oneOf(B).isRequired),zoomLevels:r.arrayOf(r.any),zoom:r.number,defaultZoom:r.number,minZoom:r.number,maxZoom:r.number,zoomRate:r.number,onError:r.func,onLoad:r.func,onDownload:r.func,onRenderToolbar:r.func,onRenderContent:r.func,onRenderLoader:r.func,onZoom:r.func};const j=o.scrollToPage;Object.defineProperty(e,"currentPage",{enumerable:!0,get:function(){return o.currentPage}}),e.PDFViewer=q,e.scrollToPage=j}));
15
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@progress/kendo-pdfviewer-common"),require("react"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-inputs"),require("@progress/kendo-react-data-tools"),require("@progress/kendo-react-upload"),require("@progress/kendo-react-dropdowns"),require("@progress/kendo-react-indicators"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl"),require("@progress/kendo-svg-icons"),require("pdfjs-dist/build/pdf.worker.min.mjs")):"function"==typeof define&&define.amd?define(["exports","@progress/kendo-pdfviewer-common","react","prop-types","@progress/kendo-react-buttons","@progress/kendo-react-inputs","@progress/kendo-react-data-tools","@progress/kendo-react-upload","@progress/kendo-react-dropdowns","@progress/kendo-react-indicators","@progress/kendo-react-common","@progress/kendo-react-intl","@progress/kendo-svg-icons","pdfjs-dist/build/pdf.worker.min.mjs"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactPdfViewer={},e.KendoPdfviewerCommon,e.React,e.PropTypes,e.KendoReactButtons,e.KendoReactInputs,e.KendoReactDataTools,e.KendoReactUpload,e.KendoReactDropdowns,e.KendoReactIndicators,e.KendoReactCommon,e.KendoReactIntl,e.KendoSvgIcons)}(this,(function(e,o,t,r,a,n,l,c,s,i,u,d,p){"use strict";function m(e){var o=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),o.default=e,Object.freeze(o)}var g=m(t);const f={name:"@progress/kendo-react-pdf-viewer",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:1673300081,version:"$VERSION",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"},v="pdfviewer.zoomIn",k="pdfviewer.zoomOut",b="pdfviewer.zoomLevel",h="pdfviewer.enableSelection",y="pdfviewer.enablePanning",C="pdfviewer.search",w="pdfviewer.open",E="pdfviewer.download",S="pdfviewer.print",x="pdfviewer.close",I="pdfviewer.matchCase",P="pdfviewer.prevMatch",N="pdfviewer.nextMatch",z="pdfviewer.actualWidth",L="pdfviewer.fitToWidth",R="pdfviewer.fitToPage",Z="pdfviewer.popupBlocked",T="pdfviewer.searchOf",O={[v]:"Zoom in",[k]:"Zoom out",[b]:"Choose zoom level",[h]:"Enable selection",[y]:"Enable panning",[C]:"Search",[w]:"Open",[E]:"Download",[T]:"of",[S]:"Print",[x]:"Close",[I]:"Match case",[P]:"Previous match",[N]:"Next match",[z]:"Actual width",[L]:"Fit to width",[R]:"Fit to page",[Z]:"Popup is blocked."},B=["pager","spacer","zoomInOut","zoom","selection","spacer","search","open","download","print"],D={minZoom:.5,maxZoom:4,tools:[...B],zoomRate:.25,zoomLevels:[{id:1,priority:1,value:1,text:"Actual width",type:"ActualWidth",locationString:z},{id:2,priority:2,value:1,text:"Fit to width",type:"FitToWidth",locationString:L},{id:3,priority:3,value:1,text:"Fit to page",type:"FitToPage",locationString:R},{id:4,priority:4,value:.5,text:"50%",type:""},{id:5,priority:5,value:.75,text:"75%",type:""},{id:6,priority:100,value:1,text:"100%",type:""},{id:7,priority:7,value:1.25,text:"125%",type:""},{id:8,priority:8,value:1.5,text:"150%",type:""},{id:9,priority:9,value:2,text:"200%",type:""},{id:10,priority:10,value:3,text:"300%",type:""},{id:11,priority:11,value:4,text:"400%",type:""}],defaultZoom:o.DEFAULT_ZOOM_LEVEL},F=[".k-toolbar > button",".k-toolbar .k-combobox > input",".k-toolbar .k-button-group > button",".k-toolbar .k-pager > a",".k-toolbar .k-pager input"];let M=0;const K=(e,o)=>e.priority>o.priority?-1:e.priority<o.priority?1:0,q=g.forwardRef(((e,t)=>{const r=!u.validatePackage(f,{component:"PDFViewer"}),{zoom:m,zoomLevels:z=D.zoomLevels,defaultZoom:L=D.defaultZoom,minZoom:R=D.minZoom,maxZoom:B=D.maxZoom,zoomRate:q=D.zoomRate}=e,j=d.useLocalization(),A=g.useRef(null),[U,V]=g.useState(L),W=void 0!==m?m:U,_=z.slice().sort(K).find((e=>e.value===W))||{text:100*W+"%",value:W,id:W,locationString:""};_.locationString&&(_.text=j.toLanguageString(_.locationString,O[_.locationString]));const[G,H]=g.useState(!1),[$,J]=g.useState(!0),[Q,X]=g.useState(0),[Y,ee]=g.useState(!0),[oe,te]=g.useState(!1),[re,ae]=g.useState(0),[ne,le]=g.useState(0),[ce,se]=g.useState(!1),[ie,ue]=g.useState(""),de=g.useMemo((()=>({})),[]);de.currentZoom=W,de.props=e;const pe=g.useCallback((e=>{A.current&&A.current.style.setProperty("--scale-factor",String(e))}),[]),me=g.useRef(null),ge=g.useRef(null);g.useImperativeHandle(me,(()=>({get element(){return ge.current},props:e,get pages(){return de.pages},get document(){return de.document}})),[]),g.useImperativeHandle(t,(()=>me.current));const fe=g.useCallback((()=>{if(de.props.onLoad){const e={target:me.current};de.props.onLoad.call(void 0,e)}}),[]),ve=g.useCallback(((o,t,r)=>{if(e.onDownload){const a={target:me.current,blob:o,fileName:t,saveOptions:r};return!1===e.onDownload.call(void 0,a)}return!1}),[e.onDownload]),ke=g.useCallback((()=>{var e;de.scroller&&de.scroller.destroy(),de.scroller=new o.Scroller(null==(e=A.current)?void 0:e.parentNode,{filter:".k-page",events:{}}),de.scroller.disablePanEventsTracking()}),[]),be=g.useCallback((e=>{const t=Array.from(e.querySelectorAll(".k-text-layer"));de.search=new o.SearchService({textContainers:t||[],highlightClass:"k-search-highlight",highlightMarkClass:"k-search-highlight-mark",charClass:"k-text-char"})}),[]);de.done=g.useCallback((({pdfPages:e,pdfDoc:t,zoom:r})=>{de.document=t,de.pages=e,de.zoom=r,ke(),J(!1),H(!0),fe(),A.current&&o.scrollToPage(A.current,0)}),[]),de.error=g.useCallback((o=>{if(de.document=null,de.pages=[],J(!1),H(!1),e.onError){const t={error:"string"==typeof o?{message:o}:o,target:me.current};e.onError.call(void 0,t)}}),[e.onError]),g.useEffect((()=>{A.current&&(e.url||e.data||e.arrayBuffer?(J(!0),o.removeChildren(A.current),o.loadPDF({url:e.url,data:e.data,arrayBuffer:e.arrayBuffer,dom:A.current,zoom:de.currentZoom,done:de.done,error:de.error}),pe(de.currentZoom)):(de.document=null,de.pages=[],H(!1),J(!1),o.removeChildren(A.current)))}),[e.url,e.data,e.arrayBuffer]);const he=g.useCallback(((e,t)=>{A.current&&(J(!0),o.removeChildren(A.current),o.reloadDocument({pdfDoc:e,zoom:t,dom:A.current,done:e=>{de.pages=e,de.zoom=t,J(!1)},error:de.error}))}),[]);g.useEffect((()=>{pe(W),A.current&&de.document&&W!==de.zoom&&he(de.document,W)}),[W,he]),g.useEffect((()=>()=>{de.scroller&&de.scroller.destroy(),de.search&&de.search.destroy(),de.document=null,de.pages=[]}),[]);const ye=g.useCallback((()=>{te(!0),be(A.current)}),[]),Ce=g.useCallback((e=>{const o=e.value,t=de.search.search({text:o,matchCase:ce});le(t.length?1:0),ae(t.length),ue(o)}),[ce]),we=g.useCallback((()=>{const e=de.search.search({text:ie,matchCase:!ce});le(e.length?1:0),ae(e.length),se(!ce)}),[ce,ie]),Ee=g.useCallback((()=>{o.goToNextSearchMatch(de),le(ne+1>re?1:ne+1)}),[ne,re]),Se=g.useCallback((()=>{o.goToPreviousSearchMatch(de),le(ne-1<1?re:ne-1)}),[ne,re]),xe=g.useCallback((()=>{de.search.destroy(),le(0),ae(0),se(!1),ue(""),te(!1)}),[]),Ie=g.useCallback((e=>{"Enter"===e.key?(e.preventDefault(),o.goToNextSearchMatch(de),le(ne+1>re?1:ne+1)):"Escape"===e.key&&xe()}),[ne,re]),Pe=g.useCallback((t=>{if(A.current){const r=t.skip;o.scrollToPage(A.current,r);const a={page:r+1,target:me.current,syntheticEvent:t.syntheticEvent};e.onPageChange&&e.onPageChange.call(void 0,a)}X(t.skip)}),[Q,e.onPageChange]),Ne=g.useCallback((t=>{if(ge.current){const r=o.currentPage(ge.current);if(r!==Q){X(r);const o={page:r+1,target:me.current,syntheticEvent:t};e.onPageChange&&e.onPageChange.call(void 0,o)}}}),[Q,e.onPageChange]),ze=g.useCallback((o=>{const t=Math.min(de.currentZoom+q,B);if(t!==de.currentZoom&&de.document&&(V(t),e.onZoom)){const r={zoom:t,target:me.current,syntheticEvent:o};e.onZoom.call(void 0,r)}}),[q,B,e.onZoom]),Le=g.useCallback((o=>{const t=Math.max(de.currentZoom-q,R);if(t!==de.currentZoom&&de.document&&(V(t),e.onZoom)){const r={zoom:t,target:me.current,syntheticEvent:o};e.onZoom.call(void 0,r)}}),[q,R,e.onZoom]),Re=g.useCallback((t=>{const r=null===t.value?{text:"100%",value:1,id:100}:{...t.value};if(void 0===r.value){const e=parseFloat(r.text);"number"!=typeof e||Number.isNaN(e)?r.value=1:r.value=e/100}let a=r?o.calculateZoomLevel(r.value,r.type,de.currentZoom,A.current):1;if(a=Math.round(100*a)/100,de.currentZoom!==a&&de.document&&(V(a),e.onZoom)){const o={zoom:a,target:me.current,syntheticEvent:t.syntheticEvent};e.onZoom.call(void 0,o)}}),[e.onZoom]),Ze=g.useCallback((()=>{de.scroller.disablePanEventsTracking(),ee(!0)}),[]),Te=g.useCallback((()=>{de.scroller.enablePanEventsTracking(),ee(!1)}),[]),Oe=g.useCallback((()=>{o.download({pdf:de.document,error:de.error},e.saveFileName,e.saveOptions,ve)}),[e.url,e.data,e.arrayBuffer,e.saveFileName,e.saveOptions,ve]),Be=g.useCallback((()=>{J(!0);o.print(de.pages,(()=>{J(!1)}),(e=>{de.error("string"==typeof(e?e.message||e:null)?e.message||e:j.toLanguageString(Z,O[Z]))}))}),[]),De=g.useCallback((e=>{const t=e.newState;t[0]&&t[0].getRawFile&&t[0].getRawFile().arrayBuffer().then((e=>{if(A.current){J(!0),o.removeChildren(A.current);const t=void 0===de.props.zoom?L:de.props.zoom;o.loadPDF({arrayBuffer:e,dom:A.current,zoom:t,done:de.done,error:de.error}),V(t)}}))}),[L]),Fe=g.useCallback((e=>{const o=e.target;if(o instanceof Element&&o.parentNode){const e=o.closest(".k-toolbar"),t=e&&e.querySelector(".k-upload input");t&&t.click()}}),[]),Me=$&&g.createElement("div",{className:"k-loader-container k-loader-container-md k-loader-top"},g.createElement("div",{className:"k-loader-container-overlay k-overlay-light"}),g.createElement("div",{className:"k-loader-container-inner "},g.createElement(i.Loader,{size:"large"}))),Ke=g.createElement(a.ButtonGroup,{className:"k-toolbar-button-group k-button-group-solid"},g.createElement(a.Button,{className:"k-group-start",fillMode:"flat",themeColor:"base",title:j.toLanguageString(k,O[k]),disabled:W<=R||!G,onClick:Le,icon:"zoom-out",svgIcon:p.zoomOutIcon}),g.createElement(a.Button,{className:"k-group-end",fillMode:"flat",themeColor:"base",title:j.toLanguageString(v,O[v]),disabled:W>=B||!G,onClick:ze,icon:"zoom-in",svgIcon:p.zoomInIcon})),qe=g.createElement(s.ComboBox,{className:"k-toolbar-combobox",disabled:!G,data:z.map((e=>({...e,text:e.locationString?j.toLanguageString(e.locationString,O[e.locationString]):e.text}))),dataItemKey:"id",textField:"text",value:G?_:null,allowCustom:!0,onChange:Re,placeholder:j.toLanguageString(b,O[b])}),je={pager:g.createElement(l.Pager,{disabled:!G,previousNext:!0,type:"input",skip:Q,take:1,total:de.pages?de.pages.length:0,info:!1,onPageChange:Pe}),spacer:g.createElement(a.ToolbarSpacer,null),zoomInOut:Ke,zoom:qe,selection:g.createElement(a.ButtonGroup,{className:"k-toolbar-button-group k-button-group-solid"},g.createElement(a.Button,{className:"k-group-start",fillMode:"flat",themeColor:"base",title:j.toLanguageString(h,O[h]),icon:"pointer",svgIcon:p.pointerIcon,disabled:!G,togglable:!0,selected:Y&&G,onClick:Ze}),g.createElement(a.Button,{className:"k-group-end",fillMode:"flat",themeColor:"base",title:j.toLanguageString(y,O[y]),icon:"hand",svgIcon:p.handIcon,disabled:!G,togglable:!0,selected:!Y&&G,onClick:Te})),search:g.createElement(a.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:j.toLanguageString(C,O[C]),icon:"search",svgIcon:p.searchIcon,disabled:!G,onClick:ye}),open:g.createElement(g.Fragment,null,g.createElement(a.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:j.toLanguageString(w,O[w]),icon:"folder-open",svgIcon:p.folderOpenIcon,onClick:Fe}),g.createElement("div",{style:{display:"none"}},g.createElement(c.Upload,{restrictions:{allowedExtensions:[".pdf"]},onAdd:De,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".pdf,.PDF",withCredentials:!1}))),download:g.createElement(a.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:j.toLanguageString(E,O[E]),icon:"download",svgIcon:p.downloadIcon,disabled:!G,onClick:Oe}),print:g.createElement(a.Button,{className:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:j.toLanguageString(S,O[S]),icon:"print",svgIcon:p.printIcon,disabled:!G,onClick:Be})},Ae=(e.tools||D.tools).map((e=>({...je[e],key:"toobar-tool-"+e+(M++,M)}))),Ue=g.createElement(a.Toolbar,{buttons:F},...Ae),Ve=g.createElement("div",{className:u.classNames("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto",{"k-enable-text-select":Y,"k-enable-panning":!Y}),onScroll:Ne},oe&&g.createElement("div",{className:"k-search-panel k-pos-sticky k-top-center"},g.createElement(n.TextBox,{value:ie,onChange:Ce,placeholder:j.toLanguageString(C,O[C]),autoFocus:!0,onKeyDown:Ie,suffix:()=>g.createElement(g.Fragment,null,g.createElement(n.InputSeparator,null),g.createElement(n.InputSuffix,null,g.createElement(a.Button,{icon:"convert-lowercase",svgIcon:p.convertLowercaseIcon,title:j.toLanguageString(I,O[I]),fillMode:"flat",togglable:!0,selected:ce,onClick:we})))}),g.createElement("span",{className:"k-search-matches"},g.createElement("span",null,ne)," ",j.toLanguageString(T,O[T]),g.createElement("span",null,re)),g.createElement(a.Button,{title:j.toLanguageString(P,O[P]),fillMode:"flat",icon:"arrow-up",svgIcon:p.arrowUpIcon,disabled:0===re,onClick:Se}),g.createElement(a.Button,{title:j.toLanguageString(N,O[N]),fillMode:"flat",icon:"arrow-down",svgIcon:p.arrowDownIcon,disabled:0===re,onClick:Ee}),g.createElement(a.Button,{title:j.toLanguageString(x,O[x]),fillMode:"flat",icon:"x",svgIcon:p.xIcon,onClick:xe})),g.createElement("div",{ref:A,className:"k-pdf-viewer-pages"}));return g.createElement("div",{className:"k-pdf-viewer",style:e.style,ref:ge},e.onRenderLoader?e.onRenderLoader.call(void 0,Me||null):Me,e.onRenderToolbar?e.onRenderToolbar.call(void 0,Ue):Ue,e.onRenderContent?e.onRenderContent.call(void 0,Ve):Ve,r&&g.createElement(u.WatermarkOverlay,null))}));q.displayName="KendoReactPDFViewer",q.propTypes={url:r.string,data:r.string,arrayBuffer:r.any,typedArray:r.any,style:r.object,saveFileName:r.string,saveOptions:r.object,tools:r.arrayOf(r.oneOf(B).isRequired),zoomLevels:r.arrayOf(r.any),zoom:r.number,defaultZoom:r.number,minZoom:r.number,maxZoom:r.number,zoomRate:r.number,onError:r.func,onLoad:r.func,onDownload:r.func,onRenderToolbar:r.func,onRenderContent:r.func,onRenderLoader:r.func,onZoom:r.func};const j=o.scrollToPage;Object.defineProperty(e,"currentPage",{enumerable:!0,get:function(){return o.currentPage}}),e.PDFViewer=q,e.scrollToPage=j}));
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-pdf-viewer",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1741091225,version:"9.5.0",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"};exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-pdf-viewer",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1741180829,version:"10.0.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"};exports.packageMetadata=e;
@@ -10,8 +10,8 @@ const e = {
10
10
  productName: "KendoReact",
11
11
  productCode: "KENDOUIREACT",
12
12
  productCodes: ["KENDOUIREACT"],
13
- publishDate: 1741091225,
14
- version: "9.5.0",
13
+ publishDate: 1741180829,
14
+ version: "10.0.0-develop.1",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
16
16
  };
17
17
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-pdf-viewer",
3
- "version": "9.5.0",
3
+ "version": "10.0.0-develop.1",
4
4
  "description": "KendoReact PDFViewer package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -27,14 +27,14 @@
27
27
  "peerDependencies": {
28
28
  "@progress/kendo-file-saver": "^1.1.1",
29
29
  "@progress/kendo-licensing": "^1.5.0",
30
- "@progress/kendo-react-buttons": "9.5.0",
31
- "@progress/kendo-react-common": "9.5.0",
32
- "@progress/kendo-react-data-tools": "9.5.0",
33
- "@progress/kendo-react-dropdowns": "9.5.0",
34
- "@progress/kendo-react-indicators": "9.5.0",
35
- "@progress/kendo-react-inputs": "9.5.0",
36
- "@progress/kendo-react-intl": "9.5.0",
37
- "@progress/kendo-react-upload": "9.5.0",
30
+ "@progress/kendo-react-buttons": "10.0.0-develop.1",
31
+ "@progress/kendo-react-common": "10.0.0-develop.1",
32
+ "@progress/kendo-react-data-tools": "10.0.0-develop.1",
33
+ "@progress/kendo-react-dropdowns": "10.0.0-develop.1",
34
+ "@progress/kendo-react-indicators": "10.0.0-develop.1",
35
+ "@progress/kendo-react-inputs": "10.0.0-develop.1",
36
+ "@progress/kendo-react-intl": "10.0.0-develop.1",
37
+ "@progress/kendo-react-upload": "10.0.0-develop.1",
38
38
  "@progress/kendo-svg-icons": "^4.0.0",
39
39
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
40
40
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
@@ -61,7 +61,7 @@
61
61
  "package": {
62
62
  "productName": "KendoReact",
63
63
  "productCode": "KENDOUIREACT",
64
- "publishDate": 1741091225,
64
+ "publishDate": 1741180829,
65
65
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
66
66
  }
67
67
  },