@progress/kendo-vue-pdf-viewer 9.2.0 → 9.2.1-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@progress/kendo-pdfviewer-common"),require("vue"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-vue-data-tools"),require("@progress/kendo-vue-upload"),require("@progress/kendo-vue-dropdowns"),require("@progress/kendo-vue-indicators"),require("@progress/kendo-vue-common"),require("@progress/kendo-svg-icons"),require("pdfjs-dist/build/pdf.worker.min.mjs")):"function"==typeof define&&define.amd?define(["exports","@progress/kendo-pdfviewer-common","vue","@progress/kendo-vue-buttons","@progress/kendo-vue-inputs","@progress/kendo-vue-data-tools","@progress/kendo-vue-upload","@progress/kendo-vue-dropdowns","@progress/kendo-vue-indicators","@progress/kendo-vue-common","@progress/kendo-svg-icons","pdfjs-dist/build/pdf.worker.min.mjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVuePdfViewer={},e.KendoPdfviewerCommon,e.Vue,e.KendoVueButtons,e.KendoVueInputs,e.KendoVueDatatools,e.KendoVueUpload,e.KendoVueDropdowns,e.KendoVueIndicators,e.KendoVueCommon,e.KendoSVGIcons)}(this,function(e,t,o,s,i,r,a,n,l,c,h){"use strict";const d={name:"@progress/kendo-vue-pdf-viewer",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:0,version:"9.2.0",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"},u="pdfviewer.zoomIn",p="pdfviewer.zoomOut",m="pdfviewer.zoomLevel",g="pdfviewer.enableSelection",f="pdfviewer.enablePanning",v="pdfviewer.search",k="pdfviewer.open",b="pdfviewer.download",w="pdfviewer.print",_="pdfviewer.close",y="pdfviewer.matchCase",C="pdfviewer.prevMatch",x="pdfviewer.nextMatch",z="pdfviewer.actualWidth",V="pdfviewer.fitToWidth",N="pdfviewer.fitToPage",S="pdfviewer.popupBlocked",E="pdfviewer.searchOf",D="pdfviewer.canvasAriaLabel",T="pdfviewer.searchPanelAriaLabel",Z={[u]:"Zoom in",[p]:"Zoom out",[m]:"Choose zoom level",[g]:"Enable selection",[f]:"Enable panning",[v]:"Search",[k]:"Open",[b]:"Download",[E]:"of",[w]:"Print",[_]:"Close",[y]:"Match case",[C]:"Previous match",[x]:"Next match",[z]:"Actual width",[V]:"Fit to width",[N]:"Fit to page",[S]:"Popup is blocked.",[D]:"PDF document container. Press Tab to navigate.",[T]:"Search"};const M=["pager","spacer","zoomInOut","zoom","selection","spacer","search","open","download","print"],P={minZoom:.5,maxZoom:4,tools:[...M],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:V},{id:3,priority:3,value:1,text:"Fit to page",type:"FitToPage",locationString:N},{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:t.DEFAULT_ZOOM_LEVEL},I=[".k-toolbar > button",".k-toolbar .k-combobox > input",".k-toolbar .k-button-group > button",".k-toolbar .k-pager > a",".k-toolbar .k-pager input"],$=(e,t)=>e.priority>t.priority?-1:e.priority<t.priority?1:0,O=o.defineComponent({name:"KendoPDFViewer",emits:{error:e=>!0,load:e=>!0,download:e=>!0,zoom:e=>!0,pagechange:e=>!0},props:{url:String,data:String,arrayBuffer:Object,typedArray:Object,dir:{type:String,validator:function(e){return[null,"ltr","rtl"].includes(e)}},saveFileName:String,saveOptions:Object,tools:{type:Array,default:()=>[...M]},zoomLevels:{type:Array,default:()=>P.zoomLevels},zoom:Number,defaultZoom:{type:Number,default:P.defaultZoom},minZoom:{type:Number,default:P.minZoom},maxZoom:{type:Number,default:P.maxZoom},zoomRate:{type:Number,default:P.zoomRate},toolbar:[String,Function,Object],content:[String,Function,Object],loader:[String,Function,Object]},inject:{kendoLocalizationService:{default:null}},data(){return{stateZoom:this.$props.defaultZoom,hasDocument:!1,loading:!0,skip:0,enabledSelection:!0,showSearch:!1,matches:0,currentMatch:0,matchCase:!1,searchText:"",showLicenseWatermark:!1,currentRtl:!1}},created(){c.validatePackage(d),this.showLicenseWatermark=c.shouldShowValidationUI(d),this._licenseMessage=c.getLicenseMessage(d),this._pagesEl=null,this._pdfViewerEl=null,this._scroller=null,this._search=null,this._document=null,this._pages=[],this._zoom=null},computed:{currentZoom(){return void 0===this.$props.zoom?this.stateZoom:this.$props.zoom},currentZoomLevel(){const e=this.$props.zoomLevels.slice().sort($).find(e=>e.value===this.currentZoom)||{text:100*this.currentZoom+"%",value:this.currentZoom,id:this.currentZoom,locationString:""};return e.locationString?{...e,text:this.localize(e.locationString)}:e},currentDir(){return void 0!==this.$props.dir?this.$props.dir:this.currentRtl?"rtl":"ltr"}},watch:{url(){this.loadDocument()},data(){this.loadDocument()},arrayBuffer(){this.loadDocument()},currentZoom(e,t){this.setScaleFactor(e),this._pagesEl&&this._document&&e!==this._zoom&&this.reload(this._document,e,this.skip)}},mounted(){this.currentRtl=c.isRtl(this._pdfViewerEl),this.loadDocument()},updated(){this.currentRtl=c.isRtl(this._pdfViewerEl)},beforeUnmount(){this._scroller&&this._scroller.destroy(),this._search&&this._search.destroy(),this._document=null,this._pages=[]},methods:{localize(e){const t=this.kendoLocalizationService;return t?t.toLanguageString(e,Z[e]):Z[e]},getTarget(){return{element:this._pdfViewerEl,props:this.$props,document:this._document,pages:this._pages}},setScaleFactor(e){this._pagesEl&&this._pagesEl.style.setProperty("--scale-factor",String(e))},loadDocument(){if(this._pagesEl)if(this.$props.url||this.$props.data||this.$props.arrayBuffer){this.loading=!0,t.removeChildren(this._pagesEl);const e=this._pagesEl;setTimeout(()=>{t.loadPDF({url:this.$props.url,data:this.$props.data,arrayBuffer:this.$props.arrayBuffer,dom:e,zoom:this.currentZoom,done:this.onDone,error:this.onError}),this.setScaleFactor(this.currentZoom)})}else this._document=null,this._pages=[],this.hasDocument=!1,this.loading=!1,t.removeChildren(this._pagesEl)},onDone({pdfPages:e,pdfDoc:o,zoom:s}){this._document=o,this._pages=e,this._zoom=s,this.initScroller(),this.loading=!1,this.hasDocument=!0,this.triggerOnLoad(),this._pagesEl&&t.scrollToPage(this._pagesEl,0)},onError(e){this._document=null,this._pages=[],this.loading=!1,this.hasDocument=!1;const t="string"==typeof e?{message:e}:e,o={error:null!=t?t:this.localize(S),target:this.getTarget()};this.$emit("error",o)},triggerOnLoad(){const e={target:this.getTarget()};this.$emit("load",e)},triggerOnDownload(e,t,o){const s={target:this.getTarget(),blob:e,fileName:t,saveOptions:o};return this.$emit("download",s),!1},initScroller(){var e;this._scroller&&this._scroller.destroy(),this._scroller=new t.Scroller(null==(e=this._pagesEl)?void 0:e.parentNode,{filter:".k-page",events:{}}),this._scroller.disablePanEventsTracking()},initSearch(e){const o=Array.from(e.querySelectorAll(".k-text-layer"));this._search=new t.SearchService({textContainers:o||[],highlightClass:"k-search-highlight",highlightMarkClass:"k-search-highlight-mark",charClass:"k-text-char"})},reload(e,o,s){this._pagesEl&&this._pdfViewerEl&&(this.loading=!0,t.removeChildren(this._pagesEl),t.reloadDocument({pdfDoc:e,zoom:o,dom:this._pagesEl,done:e=>{this._pages=e,this._zoom=o,this.loading=!1,this._pagesEl&&s>0&&t.scrollToPage(this._pagesEl,s)},error:this.onError}))},onSearchClick(){this.showSearch=!0,this.initSearch(this._pagesEl)},onSearchTextChange(e){const t=e.value,o=this._search.search({text:t,matchCase:this.matchCase});this.currentMatch=o.length?1:0,this.matches=o.length,this.searchText=t},onMatchCaseClick(){const e=this._search.search({text:this.searchText,matchCase:!this.matchCase});this.currentMatch=e.length?1:0,this.matches=e.length,this.matchCase=!this.matchCase},onNextMatch(){t.goToNextSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch+1>this.matches?1:this.currentMatch+1},onPrevMatch(){t.goToPreviousSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch-1<1?this.matches:this.currentMatch-1},onClose(){this._search.destroy(),this.currentMatch=0,this.matches=0,this.matchCase=!1,this.searchText="",this.showSearch=!1},onTextBoxKeyDown(e){"Enter"===e.key?(e.preventDefault(),t.goToNextSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch+1>this.matches?1:this.currentMatch+1):"Escape"===e.key&&this.onClose()},onPageChange(e){if(this._pagesEl){const o=e.skip;t.scrollToPage(this._pagesEl,o);const s={page:o+1,target:this.getTarget()};this.$emit("pagechange",s)}this.skip=e.skip},onScroll(e){if(this._pdfViewerEl){const e=t.currentPage(this._pdfViewerEl);if(e!==this.skip){this.skip=e;const t={page:e+1,target:this.getTarget()};this.$emit("pagechange",t)}}},onZoomIn(e){const t=Math.min(this.currentZoom+this.$props.zoomRate,this.$props.maxZoom);if(t!==this.currentZoom&&this._document){this.stateZoom=t;const e={zoom:t,target:this.getTarget()};this.$emit("zoom",e)}},onZoomOut(e){const t=Math.max(this.currentZoom-this.$props.zoomRate,this.$props.minZoom);if(t!==this.currentZoom&&this._document){this.stateZoom=t;const e={zoom:t,target:this.getTarget()};this.$emit("zoom",e)}},onZoomLevelChange(e){const o=null===e.value?{text:"100%",value:1}:{...e.value};if(void 0===o.value){const e=Number.parseFloat(o.text);"number"!=typeof e||Number.isNaN(e)?o.value=1:o.value=e/100}let s=o?t.calculateZoomLevel(o.value,o.type,this.currentZoom,this._pagesEl):1;if(s=Math.round(100*s)/100,this.currentZoom!==s&&this._document){this.stateZoom=s;const e={zoom:s,target:this.getTarget()};this.$emit("zoom",e)}},onTextSelection(){this._scroller.disablePanEventsTracking(),this.enabledSelection=!0},onPinning(){this._scroller.enablePanEventsTracking(),this.enabledSelection=!1},onDownloadClick(){t.download({pdf:this._document,error:this.onError},this.$props.saveFileName,this.$props.saveOptions,this.triggerOnDownload)},onPrintClick(){this.loading=!0;t.print(this._pages,()=>{this.loading=!1},e=>{this.loading=!1,this.onError(e)})},onAdd(e){var o;const s=e.newState;null!=(o=s[0])&&o.getRawFile&&s[0].getRawFile().arrayBuffer().then(e=>{if(this._pagesEl){this.loading=!0,t.removeChildren(this._pagesEl);const o=void 0===this.$props.zoom?this.$props.defaultZoom:this.$props.zoom;t.loadPDF({arrayBuffer:e,dom:this._pagesEl,zoom:o,done:this.onDone,error:this.onError}),this.stateZoom=o}})},onFileOpen(e){const t=e.target;if(t instanceof Element&&t.parentNode){const e=t.closest(".k-toolbar"),o=null==e?void 0:e.querySelector(".k-upload input");o&&o.click()}},renderLoader(){return this.loading?o.createVNode("div",{class:"k-loader-container k-loader-container-md k-loader-top"},[o.createVNode("div",{class:"k-overlay"},null),o.createVNode("div",{class:"k-loader-container-inner "},[o.createVNode(l.Loader,{size:"large"},null)])]):null},renderToolbar(){const e=o.createVNode(r.Pager,{previousNext:!0,type:"input",skip:this.skip,take:1,total:this._pages?this._pages.length:0,info:!1,onPagechange:this.onPageChange},null),t=o.createVNode(s.ToolbarSpacer,null,null),i=o.createVNode(s.ButtonGroup,{class:"k-toolbar-button-group k-button-group-solid"},{default:()=>[o.createVNode(s.Button,{class:"k-group-start",fillMode:"flat",themeColor:"base",title:this.localize(p),disabled:this.currentZoom<=this.$props.minZoom||!this.hasDocument,onClick:this.onZoomOut,icon:"zoom-out",svgIcon:h.zoomOutIcon},null),o.createVNode(s.Button,{class:"k-group-end",fillMode:"flat",themeColor:"base",title:this.localize(u),disabled:this.currentZoom>=this.$props.maxZoom||!this.hasDocument,onClick:this.onZoomIn,icon:"zoom-in",svgIcon:h.zoomInIcon},null)]}),l=o.createVNode(n.ComboBox,{class:"k-toolbar-combobox",disabled:!this.hasDocument,dataItems:this.$props.zoomLevels.map(e=>({...e,text:e.locationString?this.localize(e.locationString):e.text})),dataItemKey:"id",textField:"text",value:this.hasDocument?this.currentZoomLevel:null,allowCustom:!0,onChange:this.onZoomLevelChange,placeholder:this.localize(m)},null),c={pager:e,spacer:t,zoomInOut:i,zoom:l,selection:o.createVNode(s.ButtonGroup,{class:"k-toolbar-button-group k-button-group-solid"},{default:()=>[o.createVNode(s.Button,{class:"k-group-start",fillMode:"flat",themeColor:"base",title:this.localize(g),icon:"pointer",svgIcon:h.pointerIcon,disabled:!this.hasDocument,togglable:!0,selected:this.enabledSelection&&this.hasDocument,onClick:this.onTextSelection},null),o.createVNode(s.Button,{class:"k-group-end",fillMode:"flat",themeColor:"base",title:this.localize(f),icon:"hand",svgIcon:h.handIcon,disabled:!this.hasDocument,togglable:!0,selected:!this.enabledSelection&&this.hasDocument,onClick:this.onPinning},null)]}),search:o.createVNode(s.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(v),icon:"search",svgIcon:h.searchIcon,disabled:!this.hasDocument,onClick:this.onSearchClick,"aria-haspopup":"dialog"},null),open:o.createVNode("span",null,[o.createVNode(s.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(k),icon:"folder-open",svgIcon:h.folderOpenIcon,onClick:this.onFileOpen},null),o.createVNode("div",{style:{display:"none"}},[o.createVNode(a.Upload,{restrictions:{allowedExtensions:[".pdf"]},onAdd:this.onAdd,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".pdf,.PDF",withCredentials:!1},null)])]),download:o.createVNode(s.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(b),icon:"download",svgIcon:h.downloadIcon,disabled:!this.hasDocument,onClick:this.onDownloadClick},null),print:o.createVNode(s.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(w),icon:"print",svgIcon:h.printIcon,disabled:!this.hasDocument,onClick:this.onPrintClick},null)},d=(this.$props.tools||P.tools).map(e=>c[e]);return o.createVNode(s.Toolbar,{buttons:I,overflow:"none",class:"k-pdf-viewer-toolbar",dir:this.currentDir},function(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!o.isVNode(e)}(d)?d:{default:()=>[d]})},renderContent(){return o.createVNode("div",{class:c.classNames("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto",{"k-enable-text-select":this.enabledSelection,"k-enable-panning":!this.enabledSelection}),tabindex:0,role:"document","aria-label":this.localize(D),onScroll:this.onScroll},[this.showSearch?o.createVNode("div",{class:"k-search-panel k-pos-sticky k-top-center",role:"dialog","aria-label":this.localize(T)},[o.createVNode(i.TextBox,{value:this.searchText,onInput:this.onSearchTextChange,placeholder:this.localize(v),onKeydown:this.onTextBoxKeyDown,suffix:()=>o.createVNode(o.Fragment,null,[o.createVNode(i.InputSeparator,null,null),o.createVNode("span",{class:"k-input-suffix"},[o.createVNode(s.Button,{icon:"convert-lowercase",svgIcon:h.convertLowercaseIcon,title:this.localize(y),fillMode:"flat",togglable:!0,selected:this.matchCase,onClick:this.onMatchCaseClick},null)])])},null),o.createVNode("span",{class:"k-search-matches"},[o.createVNode("span",null,[this.currentMatch]),o.createTextVNode(" "),this.localize(E),o.createVNode("span",null,[this.matches])]),o.createVNode(s.Button,{title:this.localize(C),fillMode:"flat",icon:"arrow-up",svgIcon:h.arrowUpIcon,disabled:0===this.matches,onClick:this.onPrevMatch},null),o.createVNode(s.Button,{title:this.localize(x),fillMode:"flat",icon:"arrow-down",svgIcon:h.arrowDownIcon,disabled:0===this.matches,onClick:this.onNextMatch},null),o.createVNode(s.Button,{title:this.localize(_),fillMode:"flat",icon:"x",svgIcon:h.xIcon,onClick:this.onClose},null)]):null,o.createVNode("div",{ref:e=>{this._pagesEl=e},class:"k-pdf-viewer-pages"},null)])}},render(){const e=this.renderLoader(),t=this.renderToolbar(),s=this.renderContent(),i=c.templateRendering.call(this,this.$props.toolbar,c.getListeners.call(this)),r=c.templateRendering.call(this,this.$props.content,c.getListeners.call(this)),a=c.templateRendering.call(this,this.$props.loader,c.getListeners.call(this)),n=c.getTemplate.call(this,{h:o.h,template:i,defaultRendering:t,additionalProps:{defaultRendering:t}}),l=c.getTemplate.call(this,{h:o.h,template:r,defaultRendering:s,additionalProps:{defaultRendering:s}}),h=c.getTemplate.call(this,{h:o.h,template:a,defaultRendering:e,additionalProps:{defaultRendering:e}});return o.createVNode("div",{class:"k-pdf-viewer",dir:this.$props.dir,ref:e=>{this._pdfViewerEl=e}},[h,n,l,this.showLicenseWatermark?o.createVNode(c.WatermarkOverlay,{message:this._licenseMessage},null):null])}}),L=t.scrollToPage;Object.defineProperty(e,"currentPage",{enumerable:!0,get:function(){return t.currentPage}}),e.PDFViewer=O,e.scrollToPage=L});
15
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@progress/kendo-pdfviewer-common"),require("vue"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-vue-data-tools"),require("@progress/kendo-vue-upload"),require("@progress/kendo-vue-dropdowns"),require("@progress/kendo-vue-indicators"),require("@progress/kendo-vue-common"),require("@progress/kendo-svg-icons"),require("pdfjs-dist/build/pdf.worker.min.mjs")):"function"==typeof define&&define.amd?define(["exports","@progress/kendo-pdfviewer-common","vue","@progress/kendo-vue-buttons","@progress/kendo-vue-inputs","@progress/kendo-vue-data-tools","@progress/kendo-vue-upload","@progress/kendo-vue-dropdowns","@progress/kendo-vue-indicators","@progress/kendo-vue-common","@progress/kendo-svg-icons","pdfjs-dist/build/pdf.worker.min.mjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVuePdfViewer={},e.KendoPdfviewerCommon,e.Vue,e.KendoVueButtons,e.KendoVueInputs,e.KendoVueDatatools,e.KendoVueUpload,e.KendoVueDropdowns,e.KendoVueIndicators,e.KendoVueCommon,e.KendoSVGIcons)}(this,function(e,t,o,s,i,r,a,n,l,c,h){"use strict";const d={name:"@progress/kendo-vue-pdf-viewer",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:0,version:"9.2.1-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"},u="pdfviewer.zoomIn",p="pdfviewer.zoomOut",m="pdfviewer.zoomLevel",g="pdfviewer.enableSelection",f="pdfviewer.enablePanning",v="pdfviewer.search",k="pdfviewer.open",b="pdfviewer.download",w="pdfviewer.print",_="pdfviewer.close",y="pdfviewer.matchCase",C="pdfviewer.prevMatch",x="pdfviewer.nextMatch",z="pdfviewer.actualWidth",V="pdfviewer.fitToWidth",N="pdfviewer.fitToPage",S="pdfviewer.popupBlocked",E="pdfviewer.searchOf",D="pdfviewer.canvasAriaLabel",T="pdfviewer.searchPanelAriaLabel",Z={[u]:"Zoom in",[p]:"Zoom out",[m]:"Choose zoom level",[g]:"Enable selection",[f]:"Enable panning",[v]:"Search",[k]:"Open",[b]:"Download",[E]:"of",[w]:"Print",[_]:"Close",[y]:"Match case",[C]:"Previous match",[x]:"Next match",[z]:"Actual width",[V]:"Fit to width",[N]:"Fit to page",[S]:"Popup is blocked.",[D]:"PDF document container. Press Tab to navigate.",[T]:"Search"};const M=["pager","spacer","zoomInOut","zoom","selection","spacer","search","open","download","print"],P={minZoom:.5,maxZoom:4,tools:[...M],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:V},{id:3,priority:3,value:1,text:"Fit to page",type:"FitToPage",locationString:N},{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:t.DEFAULT_ZOOM_LEVEL},I=[".k-toolbar > button",".k-toolbar .k-combobox > input",".k-toolbar .k-button-group > button",".k-toolbar .k-pager > a",".k-toolbar .k-pager input"],$=(e,t)=>e.priority>t.priority?-1:e.priority<t.priority?1:0,O=o.defineComponent({name:"KendoPDFViewer",emits:{error:e=>!0,load:e=>!0,download:e=>!0,zoom:e=>!0,pagechange:e=>!0},props:{url:String,data:String,arrayBuffer:Object,typedArray:Object,dir:{type:String,validator:function(e){return[null,"ltr","rtl"].includes(e)}},saveFileName:String,saveOptions:Object,tools:{type:Array,default:()=>[...M]},zoomLevels:{type:Array,default:()=>P.zoomLevels},zoom:Number,defaultZoom:{type:Number,default:P.defaultZoom},minZoom:{type:Number,default:P.minZoom},maxZoom:{type:Number,default:P.maxZoom},zoomRate:{type:Number,default:P.zoomRate},toolbar:[String,Function,Object],content:[String,Function,Object],loader:[String,Function,Object]},inject:{kendoLocalizationService:{default:null}},data(){return{stateZoom:this.$props.defaultZoom,hasDocument:!1,loading:!0,skip:0,enabledSelection:!0,showSearch:!1,matches:0,currentMatch:0,matchCase:!1,searchText:"",showLicenseWatermark:!1,currentRtl:!1}},created(){c.validatePackage(d),this.showLicenseWatermark=c.shouldShowValidationUI(d),this._licenseMessage=c.getLicenseMessage(d),this._pagesEl=null,this._pdfViewerEl=null,this._scroller=null,this._search=null,this._document=null,this._pages=[],this._zoom=null},computed:{currentZoom(){return void 0===this.$props.zoom?this.stateZoom:this.$props.zoom},currentZoomLevel(){const e=this.$props.zoomLevels.slice().sort($).find(e=>e.value===this.currentZoom)||{text:100*this.currentZoom+"%",value:this.currentZoom,id:this.currentZoom,locationString:""};return e.locationString?{...e,text:this.localize(e.locationString)}:e},currentDir(){return void 0!==this.$props.dir?this.$props.dir:this.currentRtl?"rtl":"ltr"}},watch:{url(){this.loadDocument()},data(){this.loadDocument()},arrayBuffer(){this.loadDocument()},currentZoom(e,t){this.setScaleFactor(e),this._pagesEl&&this._document&&e!==this._zoom&&this.reload(this._document,e,this.skip)}},mounted(){this.currentRtl=c.isRtl(this._pdfViewerEl),this.loadDocument()},updated(){this.currentRtl=c.isRtl(this._pdfViewerEl)},beforeUnmount(){this._scroller&&this._scroller.destroy(),this._search&&this._search.destroy(),this._document=null,this._pages=[]},methods:{localize(e){const t=this.kendoLocalizationService;return t?t.toLanguageString(e,Z[e]):Z[e]},getTarget(){return{element:this._pdfViewerEl,props:this.$props,document:this._document,pages:this._pages}},setScaleFactor(e){this._pagesEl&&this._pagesEl.style.setProperty("--scale-factor",String(e))},loadDocument(){if(this._pagesEl)if(this.$props.url||this.$props.data||this.$props.arrayBuffer){this.loading=!0,t.removeChildren(this._pagesEl);const e=this._pagesEl;setTimeout(()=>{t.loadPDF({url:this.$props.url,data:this.$props.data,arrayBuffer:this.$props.arrayBuffer,dom:e,zoom:this.currentZoom,done:this.onDone,error:this.onError}),this.setScaleFactor(this.currentZoom)})}else this._document=null,this._pages=[],this.hasDocument=!1,this.loading=!1,t.removeChildren(this._pagesEl)},onDone({pdfPages:e,pdfDoc:o,zoom:s}){this._document=o,this._pages=e,this._zoom=s,this.initScroller(),this.loading=!1,this.hasDocument=!0,this.triggerOnLoad(),this._pagesEl&&t.scrollToPage(this._pagesEl,0)},onError(e){this._document=null,this._pages=[],this.loading=!1,this.hasDocument=!1;const t="string"==typeof e?{message:e}:e,o={error:null!=t?t:this.localize(S),target:this.getTarget()};this.$emit("error",o)},triggerOnLoad(){const e={target:this.getTarget()};this.$emit("load",e)},triggerOnDownload(e,t,o){const s={target:this.getTarget(),blob:e,fileName:t,saveOptions:o};return this.$emit("download",s),!1},initScroller(){var e;this._scroller&&this._scroller.destroy(),this._scroller=new t.Scroller(null==(e=this._pagesEl)?void 0:e.parentNode,{filter:".k-page",events:{}}),this._scroller.disablePanEventsTracking()},initSearch(e){const o=Array.from(e.querySelectorAll(".k-text-layer"));this._search=new t.SearchService({textContainers:o||[],highlightClass:"k-search-highlight",highlightMarkClass:"k-search-highlight-mark",charClass:"k-text-char"})},reload(e,o,s){this._pagesEl&&this._pdfViewerEl&&(this.loading=!0,t.removeChildren(this._pagesEl),t.reloadDocument({pdfDoc:e,zoom:o,dom:this._pagesEl,done:e=>{this._pages=e,this._zoom=o,this.loading=!1,this._pagesEl&&s>0&&t.scrollToPage(this._pagesEl,s)},error:this.onError}))},onSearchClick(){this.showSearch=!0,this.initSearch(this._pagesEl)},onSearchTextChange(e){const t=e.value,o=this._search.search({text:t,matchCase:this.matchCase});this.currentMatch=o.length?1:0,this.matches=o.length,this.searchText=t},onMatchCaseClick(){const e=this._search.search({text:this.searchText,matchCase:!this.matchCase});this.currentMatch=e.length?1:0,this.matches=e.length,this.matchCase=!this.matchCase},onNextMatch(){t.goToNextSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch+1>this.matches?1:this.currentMatch+1},onPrevMatch(){t.goToPreviousSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch-1<1?this.matches:this.currentMatch-1},onClose(){this._search.destroy(),this.currentMatch=0,this.matches=0,this.matchCase=!1,this.searchText="",this.showSearch=!1},onTextBoxKeyDown(e){"Enter"===e.key?(e.preventDefault(),t.goToNextSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch+1>this.matches?1:this.currentMatch+1):"Escape"===e.key&&this.onClose()},onPageChange(e){if(this._pagesEl){const o=e.skip;t.scrollToPage(this._pagesEl,o);const s={page:o+1,target:this.getTarget()};this.$emit("pagechange",s)}this.skip=e.skip},onScroll(e){if(this._pdfViewerEl){const e=t.currentPage(this._pdfViewerEl);if(e!==this.skip){this.skip=e;const t={page:e+1,target:this.getTarget()};this.$emit("pagechange",t)}}},onZoomIn(e){const t=Math.min(this.currentZoom+this.$props.zoomRate,this.$props.maxZoom);if(t!==this.currentZoom&&this._document){this.stateZoom=t;const e={zoom:t,target:this.getTarget()};this.$emit("zoom",e)}},onZoomOut(e){const t=Math.max(this.currentZoom-this.$props.zoomRate,this.$props.minZoom);if(t!==this.currentZoom&&this._document){this.stateZoom=t;const e={zoom:t,target:this.getTarget()};this.$emit("zoom",e)}},onZoomLevelChange(e){const o=null===e.value?{text:"100%",value:1}:{...e.value};if(void 0===o.value){const e=Number.parseFloat(o.text);"number"!=typeof e||Number.isNaN(e)?o.value=1:o.value=e/100}let s=o?t.calculateZoomLevel(o.value,o.type,this.currentZoom,this._pagesEl):1;if(s=Math.round(100*s)/100,this.currentZoom!==s&&this._document){this.stateZoom=s;const e={zoom:s,target:this.getTarget()};this.$emit("zoom",e)}},onTextSelection(){this._scroller.disablePanEventsTracking(),this.enabledSelection=!0},onPinning(){this._scroller.enablePanEventsTracking(),this.enabledSelection=!1},onDownloadClick(){t.download({pdf:this._document,error:this.onError},this.$props.saveFileName,this.$props.saveOptions,this.triggerOnDownload)},onPrintClick(){this.loading=!0;t.print(this._pages,()=>{this.loading=!1},e=>{this.loading=!1,this.onError(e)})},onAdd(e){var o;const s=e.newState;null!=(o=s[0])&&o.getRawFile&&s[0].getRawFile().arrayBuffer().then(e=>{if(this._pagesEl){this.loading=!0,t.removeChildren(this._pagesEl);const o=void 0===this.$props.zoom?this.$props.defaultZoom:this.$props.zoom;t.loadPDF({arrayBuffer:e,dom:this._pagesEl,zoom:o,done:this.onDone,error:this.onError}),this.stateZoom=o}})},onFileOpen(e){const t=e.target;if(t instanceof Element&&t.parentNode){const e=t.closest(".k-toolbar"),o=null==e?void 0:e.querySelector(".k-upload input");o&&o.click()}},renderLoader(){return this.loading?o.createVNode("div",{class:"k-loader-container k-loader-container-md k-loader-top"},[o.createVNode("div",{class:"k-overlay"},null),o.createVNode("div",{class:"k-loader-container-inner "},[o.createVNode(l.Loader,{size:"large"},null)])]):null},renderToolbar(){const e=o.createVNode(r.Pager,{previousNext:!0,type:"input",skip:this.skip,take:1,total:this._pages?this._pages.length:0,info:!1,onPagechange:this.onPageChange},null),t=o.createVNode(s.ToolbarSpacer,null,null),i=o.createVNode(s.ButtonGroup,{class:"k-toolbar-button-group k-button-group-solid"},{default:()=>[o.createVNode(s.Button,{class:"k-group-start",fillMode:"flat",themeColor:"base",title:this.localize(p),disabled:this.currentZoom<=this.$props.minZoom||!this.hasDocument,onClick:this.onZoomOut,icon:"zoom-out",svgIcon:h.zoomOutIcon},null),o.createVNode(s.Button,{class:"k-group-end",fillMode:"flat",themeColor:"base",title:this.localize(u),disabled:this.currentZoom>=this.$props.maxZoom||!this.hasDocument,onClick:this.onZoomIn,icon:"zoom-in",svgIcon:h.zoomInIcon},null)]}),l=o.createVNode(n.ComboBox,{class:"k-toolbar-combobox",disabled:!this.hasDocument,dataItems:this.$props.zoomLevels.map(e=>({...e,text:e.locationString?this.localize(e.locationString):e.text})),dataItemKey:"id",textField:"text",value:this.hasDocument?this.currentZoomLevel:null,allowCustom:!0,onChange:this.onZoomLevelChange,placeholder:this.localize(m)},null),c={pager:e,spacer:t,zoomInOut:i,zoom:l,selection:o.createVNode(s.ButtonGroup,{class:"k-toolbar-button-group k-button-group-solid"},{default:()=>[o.createVNode(s.Button,{class:"k-group-start",fillMode:"flat",themeColor:"base",title:this.localize(g),icon:"pointer",svgIcon:h.pointerIcon,disabled:!this.hasDocument,togglable:!0,selected:this.enabledSelection&&this.hasDocument,onClick:this.onTextSelection},null),o.createVNode(s.Button,{class:"k-group-end",fillMode:"flat",themeColor:"base",title:this.localize(f),icon:"hand",svgIcon:h.handIcon,disabled:!this.hasDocument,togglable:!0,selected:!this.enabledSelection&&this.hasDocument,onClick:this.onPinning},null)]}),search:o.createVNode(s.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(v),icon:"search",svgIcon:h.searchIcon,disabled:!this.hasDocument,onClick:this.onSearchClick,"aria-haspopup":"dialog"},null),open:o.createVNode("span",null,[o.createVNode(s.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(k),icon:"folder-open",svgIcon:h.folderOpenIcon,onClick:this.onFileOpen},null),o.createVNode("div",{style:{display:"none"}},[o.createVNode(a.Upload,{restrictions:{allowedExtensions:[".pdf"]},onAdd:this.onAdd,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".pdf,.PDF",withCredentials:!1},null)])]),download:o.createVNode(s.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(b),icon:"download",svgIcon:h.downloadIcon,disabled:!this.hasDocument,onClick:this.onDownloadClick},null),print:o.createVNode(s.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(w),icon:"print",svgIcon:h.printIcon,disabled:!this.hasDocument,onClick:this.onPrintClick},null)},d=(this.$props.tools||P.tools).map(e=>c[e]);return o.createVNode(s.Toolbar,{buttons:I,overflow:"none",class:"k-pdf-viewer-toolbar",dir:this.currentDir},function(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!o.isVNode(e)}(d)?d:{default:()=>[d]})},renderContent(){return o.createVNode("div",{class:c.classNames("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto",{"k-enable-text-select":this.enabledSelection,"k-enable-panning":!this.enabledSelection}),tabindex:0,role:"document","aria-label":this.localize(D),onScroll:this.onScroll},[this.showSearch?o.createVNode("div",{class:"k-search-panel k-pos-sticky k-top-center",role:"dialog","aria-label":this.localize(T)},[o.createVNode(i.TextBox,{value:this.searchText,onInput:this.onSearchTextChange,placeholder:this.localize(v),onKeydown:this.onTextBoxKeyDown,suffix:()=>o.createVNode(o.Fragment,null,[o.createVNode(i.InputSeparator,null,null),o.createVNode("span",{class:"k-input-suffix"},[o.createVNode(s.Button,{icon:"convert-lowercase",svgIcon:h.convertLowercaseIcon,title:this.localize(y),fillMode:"flat",togglable:!0,selected:this.matchCase,onClick:this.onMatchCaseClick},null)])])},null),o.createVNode("span",{class:"k-search-matches"},[o.createVNode("span",null,[this.currentMatch]),o.createTextVNode(" "),this.localize(E),o.createVNode("span",null,[this.matches])]),o.createVNode(s.Button,{title:this.localize(C),fillMode:"flat",icon:"arrow-up",svgIcon:h.arrowUpIcon,disabled:0===this.matches,onClick:this.onPrevMatch},null),o.createVNode(s.Button,{title:this.localize(x),fillMode:"flat",icon:"arrow-down",svgIcon:h.arrowDownIcon,disabled:0===this.matches,onClick:this.onNextMatch},null),o.createVNode(s.Button,{title:this.localize(_),fillMode:"flat",icon:"x",svgIcon:h.xIcon,onClick:this.onClose},null)]):null,o.createVNode("div",{ref:e=>{this._pagesEl=e},class:"k-pdf-viewer-pages"},null)])}},render(){const e=this.renderLoader(),t=this.renderToolbar(),s=this.renderContent(),i=c.templateRendering.call(this,this.$props.toolbar,c.getListeners.call(this)),r=c.templateRendering.call(this,this.$props.content,c.getListeners.call(this)),a=c.templateRendering.call(this,this.$props.loader,c.getListeners.call(this)),n=c.getTemplate.call(this,{h:o.h,template:i,defaultRendering:t,additionalProps:{defaultRendering:t}}),l=c.getTemplate.call(this,{h:o.h,template:r,defaultRendering:s,additionalProps:{defaultRendering:s}}),h=c.getTemplate.call(this,{h:o.h,template:a,defaultRendering:e,additionalProps:{defaultRendering:e}});return o.createVNode("div",{class:"k-pdf-viewer",dir:this.$props.dir,ref:e=>{this._pdfViewerEl=e}},[h,n,l,this.showLicenseWatermark?o.createVNode(c.WatermarkOverlay,{message:this._licenseMessage},null):null])}}),L=t.scrollToPage;Object.defineProperty(e,"currentPage",{enumerable:!0,get:function(){return t.currentPage}}),e.PDFViewer=O,e.scrollToPage=L});
@@ -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-vue-pdf-viewer",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate: 1786518860,version:"9.2.0",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"};exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-vue-pdf-viewer",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate: 1787574473,version:"9.2.1-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"};exports.packageMetadata=e;
@@ -10,8 +10,8 @@ const e = {
10
10
  productName: "Kendo UI for Vue",
11
11
  productCode: "KENDOUIVUE",
12
12
  productCodes: ["KENDOUIVUE"],
13
- publishDate: 1786518860,
14
- version: "9.2.0",
13
+ publishDate: 1787574473,
14
+ version: "9.2.1-develop.1",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-vue-ui/my-license/"
16
16
  };
17
17
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-vue-pdf-viewer",
3
- "version": "9.2.0",
3
+ "version": "9.2.1-develop.1",
4
4
  "description": "Kendo UI for Vue PDF Viewer",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -26,14 +26,14 @@
26
26
  "peerDependencies": {
27
27
  "@progress/kendo-file-saver": "^1.1.2",
28
28
  "@progress/kendo-licensing": "^1.7.2",
29
- "@progress/kendo-vue-buttons": "9.2.0",
30
- "@progress/kendo-vue-common": "9.2.0",
31
- "@progress/kendo-vue-data-tools": "9.2.0",
32
- "@progress/kendo-vue-dropdowns": "9.2.0",
33
- "@progress/kendo-vue-indicators": "9.2.0",
34
- "@progress/kendo-vue-inputs": "9.2.0",
35
- "@progress/kendo-vue-intl": "9.2.0",
36
- "@progress/kendo-vue-upload": "9.2.0",
29
+ "@progress/kendo-vue-buttons": "9.2.1-develop.1",
30
+ "@progress/kendo-vue-common": "9.2.1-develop.1",
31
+ "@progress/kendo-vue-data-tools": "9.2.1-develop.1",
32
+ "@progress/kendo-vue-dropdowns": "9.2.1-develop.1",
33
+ "@progress/kendo-vue-indicators": "9.2.1-develop.1",
34
+ "@progress/kendo-vue-inputs": "9.2.1-develop.1",
35
+ "@progress/kendo-vue-intl": "9.2.1-develop.1",
36
+ "@progress/kendo-vue-upload": "9.2.1-develop.1",
37
37
  "@progress/kendo-svg-icons": "^4.9.0 || ^5.0.0 < 5.4.0",
38
38
  "vue": "^3.0.2"
39
39
  },
@@ -57,7 +57,7 @@
57
57
  "package": {
58
58
  "productName": "Kendo UI for Vue",
59
59
  "productCode": "KENDOUIVUE",
60
- "publishDate": 1786518860,
60
+ "publishDate": 1787574473,
61
61
  "licensingDocsUrl": "https://www.telerik.com/kendo-vue-ui/my-license/"
62
62
  }
63
63
  },