@progress/kendo-react-pdf-viewer 10.2.0-develop.5 → 10.2.0-develop.7
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/dist/cdn/js/kendo-react-pdf-viewer.js +1 -1
- package/index.d.mts +111 -1
- package/index.d.ts +111 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -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:"10.2.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",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="string"==typeof o?{message:o}:o,r={error:null!=t?t:j.toLanguageString(Z,O[Z]),target:me.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}),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=>{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?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}));
|
|
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:"10.2.0-develop.7",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="string"==typeof o?{message:o}:o,r={error:null!=t?t:j.toLanguageString(Z,O[Z]),target:me.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}),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=>{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?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}));
|
package/index.d.mts
CHANGED
|
@@ -112,41 +112,86 @@ export declare interface PDFViewerHandle {
|
|
|
112
112
|
*/
|
|
113
113
|
export declare interface PDFViewerProps {
|
|
114
114
|
/**
|
|
115
|
-
* Represents the
|
|
115
|
+
* Represents the URL of the PDF file.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```jsx
|
|
119
|
+
* <PDFViewer url="https://example.com/sample.pdf" />
|
|
120
|
+
* ```
|
|
116
121
|
*/
|
|
117
122
|
url?: string;
|
|
118
123
|
/**
|
|
119
124
|
* Represents the data of the PDF file in Base64 format.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```jsx
|
|
128
|
+
* <PDFViewer data="JVBERi0xLjQKJ..." />
|
|
129
|
+
* ```
|
|
120
130
|
*/
|
|
121
131
|
data?: string;
|
|
122
132
|
/**
|
|
123
133
|
* Represents the raw binary data buffer of the PDF file.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```jsx
|
|
137
|
+
* <PDFViewer arrayBuffer={new ArrayBuffer(1024)} />
|
|
138
|
+
* ```
|
|
124
139
|
*/
|
|
125
140
|
arrayBuffer?: ArrayBuffer;
|
|
126
141
|
/**
|
|
127
142
|
* Represents the data of the PDF file in typed array format.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```jsx
|
|
146
|
+
* <PDFViewer typedArray={new Uint8Array([0x25, 0x50, 0x44, 0x46])} />
|
|
147
|
+
* ```
|
|
128
148
|
*/
|
|
129
149
|
typedArray?: TypedArray;
|
|
130
150
|
/**
|
|
131
151
|
* Represents the additional styles which will be added to the PDF Viewer component.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```jsx
|
|
155
|
+
* <PDFViewer style={{ height: '500px' }} />
|
|
156
|
+
* ```
|
|
132
157
|
*/
|
|
133
158
|
style?: React_2.CSSProperties;
|
|
134
159
|
/**
|
|
135
160
|
* Represents the file name used to save the file when the user clicks the download tool.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```jsx
|
|
164
|
+
* <PDFViewer saveFileName="document.pdf" />
|
|
165
|
+
* ```
|
|
136
166
|
*/
|
|
137
167
|
saveFileName?: string;
|
|
138
168
|
/**
|
|
139
169
|
* Represents the options for saving the file when the user clicks the download tool.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```jsx
|
|
173
|
+
* <PDFViewer saveOptions={{ forceProxy: true }} />
|
|
174
|
+
* ```
|
|
140
175
|
*/
|
|
141
176
|
saveOptions?: SaveOptions;
|
|
142
177
|
/**
|
|
143
178
|
* Represents the tools collection rendered in the toolbar.
|
|
144
179
|
*
|
|
145
180
|
* @default - ['pager', 'spacer', 'zoomInOut', 'zoom', 'selection', 'spacer', 'search', 'open', 'download', 'print']
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```jsx
|
|
184
|
+
* <PDFViewer tools={['pager', 'zoom']} />
|
|
185
|
+
* ```
|
|
146
186
|
*/
|
|
147
187
|
tools?: PDFViewerTool[];
|
|
148
188
|
/**
|
|
149
189
|
* Represents the zoom levels populated in the ComboBox component.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```jsx
|
|
193
|
+
* <PDFViewer zoomLevels={[{ id: 1, value: 1, text: '100%' }]} />
|
|
194
|
+
* ```
|
|
150
195
|
*/
|
|
151
196
|
zoomLevels?: {
|
|
152
197
|
id: number;
|
|
@@ -158,54 +203,119 @@ export declare interface PDFViewerProps {
|
|
|
158
203
|
}[];
|
|
159
204
|
/**
|
|
160
205
|
* Represents the zoom value of the document.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```jsx
|
|
209
|
+
* <PDFViewer zoom={1.5} />
|
|
210
|
+
* ```
|
|
161
211
|
*/
|
|
162
212
|
zoom?: number;
|
|
163
213
|
/**
|
|
164
214
|
* Represents the default zoom value.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```jsx
|
|
218
|
+
* <PDFViewer defaultZoom={1} />
|
|
219
|
+
* ```
|
|
165
220
|
*/
|
|
166
221
|
defaultZoom?: number;
|
|
167
222
|
/**
|
|
168
223
|
* Represents the minimum zoom value.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```jsx
|
|
227
|
+
* <PDFViewer minZoom={0.5} />
|
|
228
|
+
* ```
|
|
169
229
|
*/
|
|
170
230
|
minZoom?: number;
|
|
171
231
|
/**
|
|
172
232
|
* Represents the maximum zoom value.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```jsx
|
|
236
|
+
* <PDFViewer maxZoom={4} />
|
|
237
|
+
* ```
|
|
173
238
|
*/
|
|
174
239
|
maxZoom?: number;
|
|
175
240
|
/**
|
|
176
241
|
* Represents the zoom rate value.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```jsx
|
|
245
|
+
* <PDFViewer zoomRate={0.25} />
|
|
246
|
+
* ```
|
|
177
247
|
*/
|
|
178
248
|
zoomRate?: number;
|
|
179
249
|
/**
|
|
180
250
|
* Fires when an error occurs.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```jsx
|
|
254
|
+
* <PDFViewer onError={(event) => console.log(event.error)} />
|
|
255
|
+
* ```
|
|
181
256
|
*/
|
|
182
257
|
onError?: (event: ErrorEvent_2) => void;
|
|
183
258
|
/**
|
|
184
259
|
* Fires when a PDF document has been loaded.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```jsx
|
|
263
|
+
* <PDFViewer onLoad={() => console.log('Document loaded')} />
|
|
264
|
+
* ```
|
|
185
265
|
*/
|
|
186
266
|
onLoad?: (event: LoadEvent) => void;
|
|
187
267
|
/**
|
|
188
268
|
* Fires when the download tool has been clicked. To prevent the download, return `false`.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```jsx
|
|
272
|
+
* <PDFViewer onDownload={(event) => console.log(event.fileName)} />
|
|
273
|
+
* ```
|
|
189
274
|
*/
|
|
190
275
|
onDownload?: (event: DownloadEvent) => boolean | void;
|
|
191
276
|
/**
|
|
192
277
|
* Fires when the zoom has changed.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```jsx
|
|
281
|
+
* <PDFViewer onZoom={(event) => console.log(event.zoom)} />
|
|
282
|
+
* ```
|
|
193
283
|
*/
|
|
194
284
|
onZoom?: (event: ZoomEvent) => void;
|
|
195
285
|
/**
|
|
196
286
|
* Fires when the page has changed.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```jsx
|
|
290
|
+
* <PDFViewer onPageChange={(event) => console.log(event.page)} />
|
|
291
|
+
* ```
|
|
197
292
|
*/
|
|
198
293
|
onPageChange?: (event: PageEvent) => void;
|
|
199
294
|
/**
|
|
200
295
|
* Fires when the toolbar component is about to be rendered. Use it to override the default appearance of the toolbar.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```jsx
|
|
299
|
+
* <PDFViewer onRenderToolbar={(defaultRendering) => <CustomToolbar />} />
|
|
300
|
+
* ```
|
|
201
301
|
*/
|
|
202
302
|
onRenderToolbar?: (defaultRendering: React_2.ReactElement<ToolbarProps>) => React_2.ReactNode;
|
|
203
303
|
/**
|
|
204
304
|
* Fires when the content component is about to be rendered. Use it to override the default appearance of the content.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```jsx
|
|
308
|
+
* <PDFViewer onRenderContent={(defaultRendering) => <CustomContent />} />
|
|
309
|
+
* ```
|
|
205
310
|
*/
|
|
206
311
|
onRenderContent?: (defaultRendering: React_2.ReactElement<HTMLDivElement>) => React_2.ReactNode;
|
|
207
312
|
/**
|
|
208
313
|
* Fires when the loading indication component is about to be rendered. Use it to override the default appearance of the loading.
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```jsx
|
|
317
|
+
* <PDFViewer onRenderLoader={(defaultRendering) => <CustomLoader />} />
|
|
318
|
+
* ```
|
|
209
319
|
*/
|
|
210
320
|
onRenderLoader?: (defaultRendering: React_2.ReactElement<HTMLDivElement> | null) => React_2.ReactNode;
|
|
211
321
|
}
|
package/index.d.ts
CHANGED
|
@@ -112,41 +112,86 @@ export declare interface PDFViewerHandle {
|
|
|
112
112
|
*/
|
|
113
113
|
export declare interface PDFViewerProps {
|
|
114
114
|
/**
|
|
115
|
-
* Represents the
|
|
115
|
+
* Represents the URL of the PDF file.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```jsx
|
|
119
|
+
* <PDFViewer url="https://example.com/sample.pdf" />
|
|
120
|
+
* ```
|
|
116
121
|
*/
|
|
117
122
|
url?: string;
|
|
118
123
|
/**
|
|
119
124
|
* Represents the data of the PDF file in Base64 format.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```jsx
|
|
128
|
+
* <PDFViewer data="JVBERi0xLjQKJ..." />
|
|
129
|
+
* ```
|
|
120
130
|
*/
|
|
121
131
|
data?: string;
|
|
122
132
|
/**
|
|
123
133
|
* Represents the raw binary data buffer of the PDF file.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```jsx
|
|
137
|
+
* <PDFViewer arrayBuffer={new ArrayBuffer(1024)} />
|
|
138
|
+
* ```
|
|
124
139
|
*/
|
|
125
140
|
arrayBuffer?: ArrayBuffer;
|
|
126
141
|
/**
|
|
127
142
|
* Represents the data of the PDF file in typed array format.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```jsx
|
|
146
|
+
* <PDFViewer typedArray={new Uint8Array([0x25, 0x50, 0x44, 0x46])} />
|
|
147
|
+
* ```
|
|
128
148
|
*/
|
|
129
149
|
typedArray?: TypedArray;
|
|
130
150
|
/**
|
|
131
151
|
* Represents the additional styles which will be added to the PDF Viewer component.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```jsx
|
|
155
|
+
* <PDFViewer style={{ height: '500px' }} />
|
|
156
|
+
* ```
|
|
132
157
|
*/
|
|
133
158
|
style?: React_2.CSSProperties;
|
|
134
159
|
/**
|
|
135
160
|
* Represents the file name used to save the file when the user clicks the download tool.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```jsx
|
|
164
|
+
* <PDFViewer saveFileName="document.pdf" />
|
|
165
|
+
* ```
|
|
136
166
|
*/
|
|
137
167
|
saveFileName?: string;
|
|
138
168
|
/**
|
|
139
169
|
* Represents the options for saving the file when the user clicks the download tool.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```jsx
|
|
173
|
+
* <PDFViewer saveOptions={{ forceProxy: true }} />
|
|
174
|
+
* ```
|
|
140
175
|
*/
|
|
141
176
|
saveOptions?: SaveOptions;
|
|
142
177
|
/**
|
|
143
178
|
* Represents the tools collection rendered in the toolbar.
|
|
144
179
|
*
|
|
145
180
|
* @default - ['pager', 'spacer', 'zoomInOut', 'zoom', 'selection', 'spacer', 'search', 'open', 'download', 'print']
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```jsx
|
|
184
|
+
* <PDFViewer tools={['pager', 'zoom']} />
|
|
185
|
+
* ```
|
|
146
186
|
*/
|
|
147
187
|
tools?: PDFViewerTool[];
|
|
148
188
|
/**
|
|
149
189
|
* Represents the zoom levels populated in the ComboBox component.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```jsx
|
|
193
|
+
* <PDFViewer zoomLevels={[{ id: 1, value: 1, text: '100%' }]} />
|
|
194
|
+
* ```
|
|
150
195
|
*/
|
|
151
196
|
zoomLevels?: {
|
|
152
197
|
id: number;
|
|
@@ -158,54 +203,119 @@ export declare interface PDFViewerProps {
|
|
|
158
203
|
}[];
|
|
159
204
|
/**
|
|
160
205
|
* Represents the zoom value of the document.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```jsx
|
|
209
|
+
* <PDFViewer zoom={1.5} />
|
|
210
|
+
* ```
|
|
161
211
|
*/
|
|
162
212
|
zoom?: number;
|
|
163
213
|
/**
|
|
164
214
|
* Represents the default zoom value.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```jsx
|
|
218
|
+
* <PDFViewer defaultZoom={1} />
|
|
219
|
+
* ```
|
|
165
220
|
*/
|
|
166
221
|
defaultZoom?: number;
|
|
167
222
|
/**
|
|
168
223
|
* Represents the minimum zoom value.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```jsx
|
|
227
|
+
* <PDFViewer minZoom={0.5} />
|
|
228
|
+
* ```
|
|
169
229
|
*/
|
|
170
230
|
minZoom?: number;
|
|
171
231
|
/**
|
|
172
232
|
* Represents the maximum zoom value.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```jsx
|
|
236
|
+
* <PDFViewer maxZoom={4} />
|
|
237
|
+
* ```
|
|
173
238
|
*/
|
|
174
239
|
maxZoom?: number;
|
|
175
240
|
/**
|
|
176
241
|
* Represents the zoom rate value.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```jsx
|
|
245
|
+
* <PDFViewer zoomRate={0.25} />
|
|
246
|
+
* ```
|
|
177
247
|
*/
|
|
178
248
|
zoomRate?: number;
|
|
179
249
|
/**
|
|
180
250
|
* Fires when an error occurs.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```jsx
|
|
254
|
+
* <PDFViewer onError={(event) => console.log(event.error)} />
|
|
255
|
+
* ```
|
|
181
256
|
*/
|
|
182
257
|
onError?: (event: ErrorEvent_2) => void;
|
|
183
258
|
/**
|
|
184
259
|
* Fires when a PDF document has been loaded.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```jsx
|
|
263
|
+
* <PDFViewer onLoad={() => console.log('Document loaded')} />
|
|
264
|
+
* ```
|
|
185
265
|
*/
|
|
186
266
|
onLoad?: (event: LoadEvent) => void;
|
|
187
267
|
/**
|
|
188
268
|
* Fires when the download tool has been clicked. To prevent the download, return `false`.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```jsx
|
|
272
|
+
* <PDFViewer onDownload={(event) => console.log(event.fileName)} />
|
|
273
|
+
* ```
|
|
189
274
|
*/
|
|
190
275
|
onDownload?: (event: DownloadEvent) => boolean | void;
|
|
191
276
|
/**
|
|
192
277
|
* Fires when the zoom has changed.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```jsx
|
|
281
|
+
* <PDFViewer onZoom={(event) => console.log(event.zoom)} />
|
|
282
|
+
* ```
|
|
193
283
|
*/
|
|
194
284
|
onZoom?: (event: ZoomEvent) => void;
|
|
195
285
|
/**
|
|
196
286
|
* Fires when the page has changed.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```jsx
|
|
290
|
+
* <PDFViewer onPageChange={(event) => console.log(event.page)} />
|
|
291
|
+
* ```
|
|
197
292
|
*/
|
|
198
293
|
onPageChange?: (event: PageEvent) => void;
|
|
199
294
|
/**
|
|
200
295
|
* Fires when the toolbar component is about to be rendered. Use it to override the default appearance of the toolbar.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```jsx
|
|
299
|
+
* <PDFViewer onRenderToolbar={(defaultRendering) => <CustomToolbar />} />
|
|
300
|
+
* ```
|
|
201
301
|
*/
|
|
202
302
|
onRenderToolbar?: (defaultRendering: React_2.ReactElement<ToolbarProps>) => React_2.ReactNode;
|
|
203
303
|
/**
|
|
204
304
|
* Fires when the content component is about to be rendered. Use it to override the default appearance of the content.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```jsx
|
|
308
|
+
* <PDFViewer onRenderContent={(defaultRendering) => <CustomContent />} />
|
|
309
|
+
* ```
|
|
205
310
|
*/
|
|
206
311
|
onRenderContent?: (defaultRendering: React_2.ReactElement<HTMLDivElement>) => React_2.ReactNode;
|
|
207
312
|
/**
|
|
208
313
|
* Fires when the loading indication component is about to be rendered. Use it to override the default appearance of the loading.
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```jsx
|
|
317
|
+
* <PDFViewer onRenderLoader={(defaultRendering) => <CustomLoader />} />
|
|
318
|
+
* ```
|
|
209
319
|
*/
|
|
210
320
|
onRenderLoader?: (defaultRendering: React_2.ReactElement<HTMLDivElement> | null) => React_2.ReactNode;
|
|
211
321
|
}
|
package/package-metadata.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 e={name:"@progress/kendo-react-pdf-viewer",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
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: 1744786238,version:"10.2.0-develop.7",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;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = {
|
|
|
10
10
|
productName: "KendoReact",
|
|
11
11
|
productCode: "KENDOUIREACT",
|
|
12
12
|
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "10.2.0-develop.
|
|
13
|
+
publishDate: 1744786238,
|
|
14
|
+
version: "10.2.0-develop.7",
|
|
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": "10.2.0-develop.
|
|
3
|
+
"version": "10.2.0-develop.7",
|
|
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.1",
|
|
30
|
-
"@progress/kendo-react-buttons": "10.2.0-develop.
|
|
31
|
-
"@progress/kendo-react-common": "10.2.0-develop.
|
|
32
|
-
"@progress/kendo-react-data-tools": "10.2.0-develop.
|
|
33
|
-
"@progress/kendo-react-dropdowns": "10.2.0-develop.
|
|
34
|
-
"@progress/kendo-react-indicators": "10.2.0-develop.
|
|
35
|
-
"@progress/kendo-react-inputs": "10.2.0-develop.
|
|
36
|
-
"@progress/kendo-react-intl": "10.2.0-develop.
|
|
37
|
-
"@progress/kendo-react-upload": "10.2.0-develop.
|
|
30
|
+
"@progress/kendo-react-buttons": "10.2.0-develop.7",
|
|
31
|
+
"@progress/kendo-react-common": "10.2.0-develop.7",
|
|
32
|
+
"@progress/kendo-react-data-tools": "10.2.0-develop.7",
|
|
33
|
+
"@progress/kendo-react-dropdowns": "10.2.0-develop.7",
|
|
34
|
+
"@progress/kendo-react-indicators": "10.2.0-develop.7",
|
|
35
|
+
"@progress/kendo-react-inputs": "10.2.0-develop.7",
|
|
36
|
+
"@progress/kendo-react-intl": "10.2.0-develop.7",
|
|
37
|
+
"@progress/kendo-react-upload": "10.2.0-develop.7",
|
|
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":
|
|
64
|
+
"publishDate": 1744786238,
|
|
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
|
},
|