@syncfusion/ej2-pdfviewer
Advanced tools
Comparing version 24.2.7 to 24.2.8
/*! | ||
* filename: index.d.ts | ||
* version : 24.2.7 | ||
* version : 24.2.8 | ||
* Copyright Syncfusion Inc. 2001 - 2023. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"_from": "@syncfusion/ej2-pdfviewer@*", | ||
"_id": "@syncfusion/ej2-pdfviewer@24.2.6", | ||
"_id": "@syncfusion/ej2-pdfviewer@24.2.7", | ||
"_inBundle": false, | ||
"_integrity": "sha512-OnaEzwdqnq5p7joFquGPnyA/dEzlmEJGPWrH3c0Wh2lHaKWBVKdcK4YLdw9LlgfajD4SvFWXcCup0ghThQUw6A==", | ||
"_integrity": "sha512-Vf6vYi2lsCRVx6HrC3c+t1TOzL1n/2qwfDe3TP1JtnXohCIcp+g5rATmc9Q5t5c6lzOx0R6iH1M8WeIRJ/5Yfg==", | ||
"_location": "/@syncfusion/ej2-pdfviewer", | ||
@@ -26,4 +26,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdfviewer/-/ej2-pdfviewer-24.2.6.tgz", | ||
"_shasum": "a413d081b560d79dc83ffdd8da4af26ecba8d2cc", | ||
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdfviewer/-/ej2-pdfviewer-24.2.7.tgz", | ||
"_shasum": "ded25b3ee0064850a27e6cab5a679241cd34967a", | ||
"_spec": "@syncfusion/ej2-pdfviewer@*", | ||
@@ -42,11 +42,11 @@ "_where": "/jenkins/workspace/elease-automation_release_24.1.1/packages/included", | ||
"@syncfusion/ej2-data": "~24.2.3", | ||
"@syncfusion/ej2-drawings": "~24.2.7", | ||
"@syncfusion/ej2-dropdowns": "~24.2.7", | ||
"@syncfusion/ej2-drawings": "~24.2.8", | ||
"@syncfusion/ej2-dropdowns": "~24.2.8", | ||
"@syncfusion/ej2-inplace-editor": "~24.2.7", | ||
"@syncfusion/ej2-inputs": "~24.2.7", | ||
"@syncfusion/ej2-lists": "~24.2.4", | ||
"@syncfusion/ej2-navigations": "~24.2.4", | ||
"@syncfusion/ej2-lists": "~24.2.8", | ||
"@syncfusion/ej2-navigations": "~24.2.8", | ||
"@syncfusion/ej2-notifications": "~24.2.4", | ||
"@syncfusion/ej2-pdf": "~24.2.7", | ||
"@syncfusion/ej2-popups": "~24.2.5" | ||
"@syncfusion/ej2-pdf": "~24.2.8", | ||
"@syncfusion/ej2-popups": "~24.2.8" | ||
}, | ||
@@ -77,4 +77,4 @@ "deprecated": false, | ||
"typings": "index.d.ts", | ||
"version": "24.2.7", | ||
"version": "24.2.8", | ||
"sideEffects": false | ||
} |
@@ -36,3 +36,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { createElement } from '@syncfusion/ej2-base'; | ||
import { createElement, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
import { LineTool, PolygonDrawingTool } from '../drawing/tools'; | ||
@@ -262,3 +262,5 @@ import { findObjectsUnderMouse } from '../drawing/action'; | ||
var pageDiv = document.getElementById(this_2.pdfViewer.element.id + '_pageDiv_' + pageIndex); | ||
pageDiv.appendChild(aTag); | ||
if (!isNullOrUndefined(pageDiv)) { | ||
pageDiv.appendChild(aTag); | ||
} | ||
} | ||
@@ -265,0 +267,0 @@ }; |
@@ -328,2 +328,7 @@ import { PdfViewer } from '../index'; | ||
/** | ||
* @private | ||
* @returns {void} | ||
*/ | ||
calculateCommentPanelWidth(): void; | ||
/** | ||
* @param {MouseEvent} event - The event. | ||
@@ -330,0 +335,0 @@ * @returns {void} |
@@ -71,2 +71,3 @@ import { DrawingElement, PointModel } from "@syncfusion/ej2-drawings"; | ||
private isAddFormFieldProgrammatically; | ||
private isAddFormFieldUi; | ||
private increasedSize; | ||
@@ -73,0 +74,0 @@ private defaultZoomValue; |
@@ -50,2 +50,5 @@ /** | ||
this.pdfViewerBase.updateScrollTop(pageNumber - 1); | ||
if (this.pdfViewer.enableThumbnail) { | ||
this.pdfViewer.thumbnailViewModule.updateScrollTopForThumbnail(pageNumber - 1); | ||
} | ||
} | ||
@@ -52,0 +55,0 @@ if (this.pdfViewer.magnificationModule) { |
@@ -15,2 +15,8 @@ import { PdfViewer, PdfViewerBase } from '../index'; | ||
private thumbnailTopMargin; | ||
private thumbnailTop; | ||
private list; | ||
/** | ||
* @private | ||
*/ | ||
thumbnailPageSize: any[]; | ||
private thumbnailRequestHandler; | ||
@@ -37,2 +43,3 @@ /** | ||
createThumbnailContainer(): void; | ||
private thumbnailOnScroll; | ||
/** | ||
@@ -53,7 +60,28 @@ * Open the thumbnail pane of the PdfViewer. | ||
*/ | ||
createRequestForThumbnails(): Promise<any>; | ||
private requestCreation; | ||
createRequestForThumbnails(): void; | ||
/** | ||
* Checks if thumbnails have been requested for the given page number. | ||
* @param pageNumber The page number to check. | ||
* @returns True if thumbnails have been requested, otherwise false. | ||
*/ | ||
private thumbnailsRequestedForPage; | ||
/** | ||
* @param {number} pageNumber - Specify the pageNumber. | ||
* @returns {void} | ||
* @private | ||
*/ | ||
updateScrollTopForThumbnail(pageNumber: number): void; | ||
/** | ||
* @private | ||
* @returns {void} | ||
*/ | ||
private renderThumbnailEmptyPage; | ||
/** | ||
* @private | ||
* @returns {void} | ||
*/ | ||
renderViewPortThumbnailImage(prox?: ThumbnailView): void; | ||
/** | ||
* @private | ||
*/ | ||
thumbnailOnMessage(event: any): void; | ||
@@ -65,2 +93,3 @@ /** | ||
updateThumbnailCollection(data: any): void; | ||
private renderDiv; | ||
/** | ||
@@ -71,2 +100,8 @@ * @param pageNumber | ||
gotoThumbnailImage(pageNumber: number): void; | ||
/** | ||
* Determines if there is a need to request thumbnails based on the current page number. | ||
* @param currentPageNumber The current page number. | ||
* @returns The page number to request thumbnails for. | ||
*/ | ||
private determineThumbnailsRequest; | ||
private checkThumbnailScroll; | ||
@@ -76,2 +111,3 @@ private getPageNumberFromID; | ||
private renderThumbnailImage; | ||
private createRequestForThumbnail; | ||
private renderServerThumbnailImage; | ||
@@ -116,2 +152,5 @@ private renderClientThumbnailImage; | ||
private backtrackBeforeAllVisibleElements; | ||
/** | ||
* @private | ||
*/ | ||
private getThumbnailElement; | ||
@@ -121,2 +160,10 @@ /** | ||
*/ | ||
private getThumbnailLinkElement; | ||
/** | ||
* @private | ||
*/ | ||
private getThumbnailImageElement; | ||
/** | ||
* @private | ||
*/ | ||
destroy(): void; | ||
@@ -123,0 +170,0 @@ /** |
@@ -20,6 +20,28 @@ /* eslint-disable */ | ||
this.thumbnailTopMargin = 10; | ||
this.thumbnailTop = 8; | ||
this.list = []; | ||
/** | ||
* @private | ||
*/ | ||
this.thumbnailPageSize = []; | ||
/** | ||
* @private | ||
*/ | ||
this.isThumbnailClicked = false; | ||
this.thumbnailOnScroll = function (event) { | ||
var _loop_1 = function (i) { | ||
var scrollPosition = _this.pdfViewerBase.navigationPane.sideBarContent.scrollTop; | ||
var index = _this.thumbnailPageSize.findIndex(function (page) { return page.top >= scrollPosition; }); | ||
if (index !== -1) { | ||
var number = Math.floor((index) / 50) * 50; | ||
_this.updateScrollTopForThumbnail(number); | ||
return "break"; | ||
} | ||
}; | ||
for (var i = 0; i < _this.thumbnailPageSize.length; i++) { | ||
var state_1 = _loop_1(i); | ||
if (state_1 === "break") | ||
break; | ||
} | ||
}; | ||
/** | ||
@@ -103,5 +125,7 @@ * @param event | ||
ThumbnailView.prototype.createThumbnailContainer = function () { | ||
var proxy = this; | ||
// eslint-disable-next-line max-len | ||
this.thumbnailView = createElement('div', { id: this.pdfViewer.element.id + '_thumbnail_view', className: 'e-pv-thumbnail-view e-pv-thumbnail-row' }); | ||
this.pdfViewerBase.navigationPane.sideBarContent.appendChild(this.thumbnailView); | ||
this.pdfViewerBase.navigationPane.sideBarContent.addEventListener('scrollend', this.thumbnailOnScroll); | ||
}; | ||
@@ -136,42 +160,137 @@ /** | ||
// eslint-disable-next-line | ||
var isIE = !!document.documentMode; | ||
if (!isIE) { | ||
// eslint-disable-next-line | ||
return new Promise( | ||
// eslint-disable-next-line | ||
function (renderThumbnailImage, reject) { | ||
proxy.requestCreation(proxy); | ||
}); | ||
for (var i = 0; i < proxy.pdfViewer.pageCount; i++) { | ||
proxy.renderThumbnailEmptyPage(i); | ||
} | ||
else { | ||
this.requestCreation(proxy); | ||
return null; | ||
if (proxy.pdfViewer.isThumbnailViewOpen) { | ||
proxy.pdfViewerBase.navigationPane.isThumbnailOpen = true; // eslint-disable-next-line max-len | ||
proxy.pdfViewerBase.navigationPane.sideBarTitle.textContent = proxy.pdfViewer.localeObj.getConstant('Page Thumbnails'); | ||
document.getElementById(proxy.pdfViewer.element.id + '_thumbnail_view').style.display = 'flex'; | ||
var bookmarkContent = proxy.pdfViewer.element.querySelector('.e-pv-bookmark-view'); | ||
if (bookmarkContent) { | ||
bookmarkContent.style.display = 'none'; | ||
} | ||
proxy.pdfViewerBase.navigationPane.setThumbnailSelectionIconTheme(); | ||
proxy.pdfViewerBase.navigationPane.updateViewerContainerOnExpand(); | ||
proxy.pdfViewerBase.navigationPane.isBookmarkOpen = false; | ||
} | ||
}; | ||
ThumbnailView.prototype.requestCreation = function (proxy) { | ||
/** | ||
* Checks if thumbnails have been requested for the given page number. | ||
* @param pageNumber The page number to check. | ||
* @returns True if thumbnails have been requested, otherwise false. | ||
*/ | ||
ThumbnailView.prototype.thumbnailsRequestedForPage = function (pageNumber) { | ||
for (var _i = 0, _a = this.list; _i < _a.length; _i++) { | ||
var requestedPage = _a[_i]; | ||
if (pageNumber === requestedPage) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
/** | ||
* @param {number} pageNumber - Specify the pageNumber. | ||
* @returns {void} | ||
* @private | ||
*/ | ||
ThumbnailView.prototype.updateScrollTopForThumbnail = function (pageNumber) { | ||
var _this = this; | ||
var step = 50; | ||
var number = Math.floor((pageNumber + 1) / step) * step; | ||
var lastNum = this.pdfViewer.thumbnailViewModule.thumbnailLimit; | ||
var numbers = [number, number - step, number + step, lastNum]; | ||
numbers.forEach(function (num) { | ||
if (num < 0) { | ||
return; | ||
} | ||
if (!_this.thumbnailsRequestedForPage(num)) { | ||
_this.renderThumbnailImage(null, num); | ||
} | ||
}); | ||
}; | ||
/** | ||
* @private | ||
* @returns {void} | ||
*/ | ||
ThumbnailView.prototype.renderThumbnailEmptyPage = function (pageIndex) { | ||
if (this.thumbnailView) { | ||
// eslint-disable-next-line max-len | ||
var pageLink = createElement('a', { id: 'page_' + pageIndex, attrs: { 'aria-label': 'Thumbnail of Page' + (pageIndex + 1), 'tabindex': '-1', 'role': 'link' }, className: 'e-pv-thumbnail-anchor-node' }); | ||
// eslint-disable-next-line max-len | ||
var thumbnail = createElement('div', { id: this.pdfViewer.element.id + '_thumbnail_' + pageIndex, className: 'e-pv-thumbnail e-pv-thumbnail-column' }); | ||
// eslint-disable-next-line max-len | ||
this.thumbnailSelectionRing = createElement('div', { id: this.pdfViewer.element.id + '_thumbnail_Selection_Ring_' + pageIndex, className: 'e-pv-thumbnail-selection-ring' }); | ||
thumbnail.appendChild(this.thumbnailSelectionRing); | ||
// eslint-disable-next-line max-len | ||
var thumbnailPageNumber = createElement('div', { id: this.pdfViewer.element.id + '_thumbnail_pagenumber_' + pageIndex, className: 'e-pv-thumbnail-number' }); | ||
thumbnailPageNumber.textContent = (pageIndex + 1).toString(); | ||
thumbnail.appendChild(thumbnailPageNumber); | ||
var height = 180; | ||
// eslint-disable-next-line max-len | ||
this.thumbnailImage = createElement('img', { id: this.pdfViewer.element.id + '_thumbnail_image_' + pageIndex, className: 'e-pv-thumbnail-image' }); | ||
if (this.pdfViewerBase.pageSize[pageIndex] && (this.pdfViewerBase.pageSize[pageIndex].height < this.pdfViewerBase.pageSize[pageIndex].width)) { | ||
this.thumbnailImage.style.height = '86px'; | ||
this.thumbnailImage.style.width = '126px'; | ||
thumbnail.style.height = '100px'; | ||
thumbnail.style.width = '140px'; | ||
thumbnailPageNumber.style.left = '18px'; | ||
pageLink.style.marginRight = '41px'; | ||
thumbnail.style.marginLeft = '-5px'; | ||
thumbnail.style.marginRight = '0px'; | ||
height = 140; | ||
} | ||
if (pageIndex !== 0) { | ||
this.thumbnailTop = this.thumbnailPageSize[pageIndex - 1].top + this.thumbnailPageSize[pageIndex - 1].height; | ||
var thumbnailSize = { height: height, top: this.thumbnailTop }; | ||
this.thumbnailPageSize[pageIndex] = thumbnailSize; | ||
} | ||
else { | ||
var thumbnailSize = { height: height, top: this.thumbnailTop }; | ||
this.thumbnailPageSize[pageIndex] = thumbnailSize; | ||
} | ||
this.thumbnailSelectionRing.appendChild(this.thumbnailImage); | ||
pageLink.appendChild(thumbnail); | ||
this.thumbnailView.appendChild(pageLink); | ||
this.wireUpEvents(); | ||
if (pageIndex === 0) { | ||
this.setMouseFocusToFirstPage(); | ||
} | ||
this.pdfViewerBase.navigationPane.enableThumbnailButton(); | ||
} | ||
}; | ||
/** | ||
* @private | ||
* @returns {void} | ||
*/ | ||
ThumbnailView.prototype.renderViewPortThumbnailImage = function (prox) { | ||
var proxy = prox ? prox : this; | ||
// Removed the condition to skip multiple request for thumbnail image. | ||
proxy.startIndex = proxy.thumbnailLimit; | ||
// eslint-disable-next-line max-len | ||
this.list.push(proxy.startIndex); | ||
// eslint-disable-next-line max-len | ||
if (proxy.startIndex >= 100) | ||
this.renderDiv(); | ||
proxy.thumbnailLimit = proxy.startIndex + proxy.thumbnailThreshold < proxy.pdfViewer.pageCount ? proxy.startIndex + proxy.thumbnailThreshold : proxy.pdfViewer.pageCount; | ||
var digitalSignaturePresent = false; | ||
for (var i = proxy.startIndex; i < proxy.thumbnailLimit; i++) { | ||
if (proxy.pdfViewerBase.digitalSignaturePresent(i)) { | ||
digitalSignaturePresent = true; | ||
if (!this.pdfViewerBase.clientSideRendering) { | ||
var digitalSignaturePresent = false; | ||
for (var i = proxy.startIndex; i < proxy.thumbnailLimit; i++) { | ||
if (proxy.pdfViewerBase.digitalSignaturePresent(i)) { | ||
digitalSignaturePresent = true; | ||
} | ||
} | ||
} | ||
var digitalSignatureList = ""; | ||
if (digitalSignaturePresent) { | ||
digitalSignatureList = proxy.pdfViewerBase.digitalSignaturePages.toString(); | ||
} | ||
// eslint-disable-next-line max-len | ||
var jsonObject = { startPage: proxy.startIndex.toString(), endPage: proxy.thumbnailLimit.toString(), sizeX: "99.7", sizeY: "141", hashId: proxy.pdfViewerBase.hashId, action: 'RenderThumbnailImages', elementId: proxy.pdfViewer.element.id, uniqueId: proxy.pdfViewerBase.documentId, digitalSignaturePresent: digitalSignaturePresent, digitalSignaturePageList: digitalSignatureList }; | ||
if (this.pdfViewerBase.jsonDocumentId) { | ||
// eslint-disable-next-line | ||
jsonObject.documentId = this.pdfViewerBase.jsonDocumentId; | ||
} | ||
if (!this.pdfViewerBase.clientSideRendering) { | ||
var digitalSignatureList = ""; | ||
if (digitalSignaturePresent) { | ||
digitalSignatureList = proxy.pdfViewerBase.digitalSignaturePages.toString(); | ||
} | ||
// eslint-disable-next-line max-len | ||
var jsonObject = { startPage: proxy.startIndex.toString(), endPage: proxy.thumbnailLimit.toString(), sizeX: "99.7", sizeY: "141", hashId: proxy.pdfViewerBase.hashId, action: 'RenderThumbnailImages', elementId: proxy.pdfViewer.element.id, uniqueId: proxy.pdfViewerBase.documentId, digitalSignaturePresent: digitalSignaturePresent, digitalSignaturePageList: digitalSignatureList }; | ||
if (this.pdfViewerBase.jsonDocumentId) { | ||
// eslint-disable-next-line | ||
jsonObject.documentId = this.pdfViewerBase.jsonDocumentId; | ||
} | ||
this.thumbnailRequestHandler = new AjaxHandler(this.pdfViewer); | ||
this.thumbnailRequestHandler.url = proxy.pdfViewer.serviceUrl + '/' + proxy.pdfViewer.serverActionSettings.renderThumbnail; | ||
this.thumbnailRequestHandler.responseType = 'json'; | ||
if (proxy.thumbnailLimit > 0 && !isNullOrUndefined(proxy.pdfViewerBase.hashId)) { | ||
if ((proxy.startIndex.toString() !== proxy.thumbnailLimit.toString()) && proxy.thumbnailLimit > 0 && !isNullOrUndefined(proxy.pdfViewerBase.hashId)) { | ||
this.pdfViewerBase.requestCollection.push(this.thumbnailRequestHandler); | ||
@@ -200,7 +319,10 @@ this.thumbnailRequestHandler.send(jsonObject); | ||
else { | ||
for (var pageIndex = proxy.startIndex; pageIndex < proxy.thumbnailLimit; pageIndex++) { | ||
this.pdfViewerBase.pdfViewerRunner.postMessage({ | ||
pageIndex: pageIndex, | ||
message: 'renderThumbnail' | ||
}); | ||
for (var count = proxy.startIndex; count < proxy.thumbnailLimit; count++) { | ||
var currentPageImage = this.getThumbnailImageElement(count); | ||
if (currentPageImage && currentPageImage.src === '') { | ||
this.pdfViewerBase.pdfViewerRunner.postMessage({ | ||
pageIndex: count, | ||
message: 'renderThumbnail' | ||
}); | ||
} | ||
} | ||
@@ -223,10 +345,5 @@ } | ||
var imageUrl = canvas.toDataURL(); | ||
var data = ({ | ||
thumbnailImage: imageUrl, | ||
startPage: this.startIndex, | ||
endPage: this.thumbnailLimit, | ||
uniqueId: this.pdfViewerBase.documentId, | ||
pageIndex: pageIndex | ||
}); | ||
this.updateThumbnailCollection(data); | ||
var currentPageImage = this.getThumbnailImageElement(pageIndex); | ||
if (currentPageImage) | ||
currentPageImage.src = imageUrl; | ||
} | ||
@@ -254,15 +371,27 @@ }; | ||
proxy.renderThumbnailImage(data); | ||
if (proxy.pdfViewer.isThumbnailViewOpen) { | ||
proxy.pdfViewerBase.navigationPane.isThumbnailOpen = true; | ||
// eslint-disable-next-line max-len | ||
proxy.pdfViewerBase.navigationPane.sideBarTitle.textContent = proxy.pdfViewer.localeObj.getConstant('Page Thumbnails'); | ||
document.getElementById(proxy.pdfViewer.element.id + '_thumbnail_view').style.display = 'flex'; | ||
var bookmarkContent = proxy.pdfViewer.element.querySelector('.e-pv-bookmark-view'); | ||
if (bookmarkContent) { | ||
bookmarkContent.style.display = 'none'; | ||
} | ||
proxy.pdfViewerBase.navigationPane.setThumbnailSelectionIconTheme(); | ||
proxy.pdfViewerBase.navigationPane.updateViewerContainerOnExpand(); | ||
proxy.pdfViewerBase.navigationPane.isBookmarkOpen = false; | ||
} | ||
} | ||
}; | ||
ThumbnailView.prototype.renderDiv = function () { | ||
if (this.pdfViewerBase.pageSize.length === this.pdfViewerBase.pageCount) { | ||
for (var i = 100; i < this.pdfViewer.pageCount; i++) { | ||
var thumbnail = document.getElementById(this.pdfViewer.element.id + '_thumbnail_' + i); | ||
var pageLink = document.getElementById('page_' + i); | ||
var thumbnailPageNumber = document.getElementById(this.pdfViewer.element.id + '_thumbnail_pagenumber_' + i); | ||
var currentPageImage = this.getThumbnailImageElement(i); | ||
var height = 180; | ||
if (this.pdfViewerBase.pageSize[i] && (this.pdfViewerBase.pageSize[i].height < this.pdfViewerBase.pageSize[i].width)) { | ||
currentPageImage.style.height = '86px'; | ||
currentPageImage.style.width = '126px'; | ||
thumbnail.style.height = '100px'; | ||
thumbnail.style.width = '140px'; | ||
thumbnailPageNumber.style.left = '18px'; | ||
pageLink.style.marginRight = '41px'; | ||
thumbnail.style.marginLeft = '-5px'; | ||
thumbnail.style.marginRight = '0px'; | ||
height = 140; | ||
} | ||
this.thumbnailTop = this.thumbnailPageSize[i - 1].top + this.thumbnailPageSize[i - 1].height; | ||
var thumbnailSize = { height: height, top: this.thumbnailTop }; | ||
this.thumbnailPageSize[i] = thumbnailSize; | ||
} | ||
@@ -283,2 +412,5 @@ } | ||
if (shouldScroll) { | ||
if (this.pdfViewerBase.pageSize) { | ||
this.renderDiv(); | ||
} | ||
if (thumbnailDiv.offsetTop <= 0) { | ||
@@ -305,2 +437,22 @@ offsetTop = thumbnailDiv.parentElement.offsetTop + thumbnailDiv.clientTop - this.thumbnailTopMargin; | ||
}; | ||
/** | ||
* Determines if there is a need to request thumbnails based on the current page number. | ||
* @param currentPageNumber The current page number. | ||
* @returns The page number to request thumbnails for. | ||
*/ | ||
ThumbnailView.prototype.determineThumbnailsRequest = function (currentPageNumber) { | ||
var pageCount = this.pdfViewer.pageCount; | ||
var batchSize = 50; // Assuming thumbnails are requested in batches of 50 | ||
var numberOfBatches = Math.ceil(pageCount / batchSize); | ||
if (this.list.length === numberOfBatches) { | ||
return pageCount; | ||
} | ||
for (var i = 0; i < this.list.length; i++) { | ||
if (currentPageNumber === this.list[i]) { | ||
currentPageNumber += batchSize; | ||
i = -1; // Resetting i to -1 to start from the beginning of the list again | ||
} | ||
} | ||
return currentPageNumber !== undefined && currentPageNumber < pageCount ? currentPageNumber : pageCount; | ||
}; | ||
ThumbnailView.prototype.checkThumbnailScroll = function (pageNumber) { | ||
@@ -349,7 +501,8 @@ var shouldScroll = false; | ||
// eslint-disable-next-line | ||
ThumbnailView.prototype.renderThumbnailImage = function (data) { | ||
if (this.thumbnailView) { | ||
ThumbnailView.prototype.renderThumbnailImage = function (data, pageNumber) { | ||
if (this.thumbnailView && data) { | ||
this.pdfViewerBase.clientSideRendering ? this.renderClientThumbnailImage(data) : this.renderServerThumbnailImage(data); | ||
} | ||
this.pdfViewerBase.navigationPane.enableThumbnailButton(); | ||
this.thumbnailLimit = this.determineThumbnailsRequest(!isNullOrUndefined(pageNumber) ? pageNumber : this.thumbnailLimit); | ||
if (this.thumbnailLimit !== this.pdfViewerBase.pageCount && this.thumbnailView) { | ||
@@ -359,13 +512,30 @@ // eslint-disable-next-line | ||
if (!isIE) { | ||
Promise.all([this.createRequestForThumbnails()]); | ||
Promise.all([this.createRequestForThumbnail()]); | ||
} | ||
else { | ||
this.createRequestForThumbnails(); | ||
this.createRequestForThumbnail(); | ||
} | ||
} | ||
}; | ||
ThumbnailView.prototype.createRequestForThumbnail = function () { | ||
var proxy = this; | ||
// eslint-disable-next-line | ||
var isIE = !!document.documentMode; | ||
if (!isIE) { | ||
// eslint-disable-next-line | ||
return new Promise( | ||
// eslint-disable-next-line | ||
function (renderThumbnailImage, reject) { | ||
proxy.renderViewPortThumbnailImage(proxy); | ||
}); | ||
} | ||
else { | ||
this.renderViewPortThumbnailImage(proxy); | ||
return null; | ||
} | ||
}; | ||
// eslint-disable-next-line | ||
ThumbnailView.prototype.renderServerThumbnailImage = function (data) { | ||
var startPage = (data && isNaN(data.startPage)) ? data.startPage : this.startIndex; | ||
var endPage = (data && isNaN(data.endPage)) ? data.endPage : this.thumbnailLimit; | ||
var startPage = !isNullOrUndefined(data && (data.startPage)) ? data.startPage : this.startIndex; | ||
var endPage = !isNullOrUndefined(data && (data.endPage)) ? data.endPage : this.thumbnailLimit; | ||
for (var i = startPage; i < endPage; i++) { | ||
@@ -382,24 +552,19 @@ this.thumbnailImageRender(i, data); | ||
ThumbnailView.prototype.thumbnailImageRender = function (pageIndex, data) { | ||
if (this.pdfViewer.isThumbnailViewOpen) { | ||
// eslint-disable-next-line max-len | ||
this.pdfViewerBase.navigationPane.sideBarContentContainer.style.display = 'block'; | ||
} | ||
// eslint-disable-next-line max-len | ||
var pageLink = createElement('a', { id: 'page_' + pageIndex, attrs: { 'aria-label': 'Thumbnail of Page' + (pageIndex + 1), 'role': 'link' }, className: 'e-pv-thumbnail-anchor-node' }); | ||
// eslint-disable-next-line max-len | ||
var thumbnail = createElement('div', { id: this.pdfViewer.element.id + '_thumbnail_' + pageIndex, className: 'e-pv-thumbnail e-pv-thumbnail-column' }); | ||
// eslint-disable-next-line max-len | ||
this.thumbnailSelectionRing = createElement('div', { id: this.pdfViewer.element.id + '_thumbnail_Selection_Ring_' + pageIndex, className: 'e-pv-thumbnail-selection-ring' }); | ||
thumbnail.appendChild(this.thumbnailSelectionRing); | ||
// eslint-disable-next-line max-len | ||
var thumbnailPageNumber = createElement('div', { id: this.pdfViewer.element.id + '_thumbnail_pagenumber_' + pageIndex, className: 'e-pv-thumbnail-number' }); | ||
thumbnailPageNumber.textContent = (pageIndex + 1).toString(); | ||
thumbnail.appendChild(thumbnailPageNumber); | ||
// eslint-disable-next-line max-len | ||
this.thumbnailImage = createElement('img', { id: this.pdfViewer.element.id + '_thumbnail_image_' + pageIndex, className: 'e-pv-thumbnail-image', attrs: { 'tabindex': '0', "aria-label": "Thumbnail of Page" + (pageIndex + 1) } }); | ||
// eslint-disable-next-line max-len | ||
this.thumbnailImage.src = this.pdfViewerBase.clientSideRendering || typeof data.thumbnailImage === 'string' || data.thumbnailImage instanceof String ? data.thumbnailImage : data.thumbnailImage[pageIndex]; | ||
this.thumbnailImage.alt = this.pdfViewer.element.id + '_thumbnail_page_' + pageIndex; | ||
var thumbnail = document.getElementById(this.pdfViewer.element.id + '_thumbnail_' + pageIndex); | ||
var pageLink = document.getElementById('page_' + pageIndex); | ||
var thumbnailPageNumber = document.getElementById(this.pdfViewer.element.id + '_thumbnail_pagenumber_' + pageIndex); | ||
var currentPageImage = this.getThumbnailImageElement(pageIndex); | ||
currentPageImage.src = this.pdfViewerBase.clientSideRendering || typeof data.thumbnailImage === 'string' || data.thumbnailImage instanceof String ? data.thumbnailImage : data.thumbnailImage[pageIndex]; | ||
currentPageImage.alt = this.pdfViewer.element.id + '_thumbnail_page_' + pageIndex; | ||
if (this.pdfViewerBase.pageSize[pageIndex] && (this.pdfViewerBase.pageSize[pageIndex].height < this.pdfViewerBase.pageSize[pageIndex].width)) { | ||
this.thumbnailImage.style.height = '86px'; | ||
this.thumbnailImage.style.width = '126px'; | ||
currentPageImage.style.height = '86px'; | ||
currentPageImage.style.width = '126px'; | ||
thumbnail.style.height = '100px'; | ||
thumbnail.style.width = '140px'; | ||
pageLink.style.left = '-25px'; | ||
// pageLink.style.left = '-25px'; | ||
thumbnailPageNumber.style.left = '18px'; | ||
@@ -410,9 +575,2 @@ pageLink.style.marginRight = '41px'; | ||
} | ||
this.thumbnailSelectionRing.appendChild(this.thumbnailImage); | ||
pageLink.appendChild(thumbnail); | ||
this.thumbnailView.appendChild(pageLink); | ||
this.wireUpEvents(); | ||
if (pageIndex === 0) { | ||
this.setMouseFocusToFirstPage(); | ||
} | ||
}; | ||
@@ -491,2 +649,5 @@ ThumbnailView.prototype.wireUpEvents = function () { | ||
this.thumbnailLimit = 0; | ||
this.list = []; | ||
this.thumbnailPageSize = []; | ||
this.thumbnailTop = 0; | ||
if (this.pdfViewerBase.navigationPane) { | ||
@@ -627,2 +788,5 @@ if (this.pdfViewerBase.navigationPane.sideBarContentContainer) { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
ThumbnailView.prototype.getThumbnailElement = function (index) { | ||
@@ -635,2 +799,19 @@ var thumbnailChild = this.thumbnailView.children[index]; | ||
*/ | ||
ThumbnailView.prototype.getThumbnailLinkElement = function (index) { | ||
var thumbnailChild = this.thumbnailView.children[index]; | ||
return thumbnailChild; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
ThumbnailView.prototype.getThumbnailImageElement = function (index) { | ||
var thumbnailChild = this.thumbnailView.children[index]; | ||
if (thumbnailChild) | ||
return thumbnailChild.children[0].children[0].children[0]; | ||
else | ||
return null; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
ThumbnailView.prototype.destroy = function () { | ||
@@ -637,0 +818,0 @@ this.clear(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
68412686
253903
3