@progress/kendo-react-pdf-viewer 14.3.0-develop.5 → 14.3.0-develop.6

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