UNPKG

@pdftron/webviewer

Version:

[WebViewer](https://www.apryse.com/webviewer) is a powerful JavaScript Document SDK and UI Component Library that is a part of the [Apryse PDF SDK](https://www.apryse.com). It provides a slick, out-of-the-box responsive UI that interacts with the core lib

2 lines • 19.1 kB
(window.webpackJsonpWebViewerUI=window.webpackJsonpWebViewerUI||[]).push([[76],{1997:function(e,o,n){var t=n(36),a=n(1998);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var r={insert:function(e){if(!window.isApryseWebViewerWebComponent)return void document.head.appendChild(e);let o;o=document.getElementsByTagName("apryse-webviewer"),o.length||(o=function e(o,n=document){const t=[];return n.querySelectorAll(o).forEach(e=>t.push(e)),n.querySelectorAll("*").forEach(n=>{n.shadowRoot&&t.push(...e(o,n.shadowRoot))}),t}("apryse-webviewer"));const n=[];for(let t=0;t<o.length;t++){const a=o[t];if(0===t)a.shadowRoot.appendChild(e),e.onload=function(){n.length>0&&n.forEach(o=>{o.innerHTML=e.innerHTML})};else{const o=e.cloneNode(!0);a.shadowRoot.appendChild(o),n.push(o)}}},singleton:!1};t(a,r);e.exports=a.locals||{}},1998:function(e,o,n){(o=e.exports=n(37)(!1)).push([e.i,".open.SaveModal{visibility:visible}.closed.SaveModal{visibility:hidden}:host{display:inline-block;container-type:inline-size;width:100%;height:100%;overflow:hidden}@media(min-width:901px){.App:not(.is-web-component) .hide-in-desktop{display:none}}@container (min-width: 901px){.hide-in-desktop{display:none}}@media(min-width:641px)and (max-width:900px){.App:not(.is-in-desktop-only-mode):not(.is-web-component) .hide-in-tablet{display:none}}@container (min-width: 641px) and (max-width: 900px){.App.is-web-component:not(.is-in-desktop-only-mode) .hide-in-tablet{display:none}}@media(max-width:640px)and (min-width:431px){.App:not(.is-web-component) .hide-in-mobile{display:none}}@container (max-width: 640px) and (min-width: 431px){.App.is-web-component .hide-in-mobile{display:none}}@media(max-width:430px){.App:not(.is-web-component) .hide-in-small-mobile{display:none}}@container (max-width: 430px){.App.is-web-component .hide-in-small-mobile{display:none}}.always-hide{display:none}.SaveModal .footer .modal-button.confirm:hover,.SaveModal .modal-container .footer button:hover:not(:disabled){background:var(--primary-button-hover);border-color:var(--primary-button-hover);color:var(--gray-0)}.SaveModal .footer .modal-button.confirm{background:var(--primary-button);border-color:var(--primary-button);color:var(--primary-button-text)}.SaveModal .footer .modal-button.confirm.disabled,.SaveModal .modal-container .footer button:disabled{cursor:default;background:var(--disabled-button-color);color:var(--primary-button-text)}.SaveModal .footer .modal-button.confirm.disabled span,.SaveModal .modal-container .footer button:disabled span{color:var(--primary-button-text)}.SaveModal .footer .modal-button.cancel:hover,.SaveModal .footer .modal-button.secondary-btn-custom:hover{border:none;box-shadow:inset 0 0 0 1px var(--blue-6);color:var(--blue-6)}.SaveModal .footer .modal-button.cancel,.SaveModal .footer .modal-button.secondary-btn-custom{border:none;box-shadow:inset 0 0 0 1px var(--primary-button);color:var(--primary-button)}.SaveModal .footer .modal-button.cancel.disabled,.SaveModal .footer .modal-button.secondary-btn-custom.disabled{cursor:default;border:none;box-shadow:inset 0 0 0 1px rgba(43,115,171,.5);color:rgba(43,115,171,.5)}.SaveModal .footer .modal-button.cancel.disabled span,.SaveModal .footer .modal-button.secondary-btn-custom.disabled span{color:rgba(43,115,171,.5)}.SaveModal{position:fixed;inset-inline-start:0;inset-block-end:0;z-index:100;width:100%;height:100%;display:flex;justify-content:center;align-items:center;background:var(--modal-negative-space)}.SaveModal .modal-container .wrapper .modal-content{padding:10px}.SaveModal .footer{display:flex;flex-direction:row;justify-content:flex-end;width:100%;margin-top:13px}.SaveModal .footer.modal-footer{padding:16px;margin:0;border-top:1px solid var(--divider)}.SaveModal .footer .modal-button{display:flex;justify-content:center;align-items:center;padding:6px 18px;margin:8px 0 0;width:auto;width:-moz-fit-content;width:fit-content;border-radius:4px;height:30px;cursor:pointer}.SaveModal .footer .modal-button.confirm{margin-inline-start:4px}.SaveModal .footer .modal-button.secondary-btn-custom{border-radius:4px;padding:2px 20px 4px;cursor:pointer}@media(max-width:640px){.App:not(.is-in-desktop-only-mode):not(.is-web-component) .SaveModal .footer .modal-button{padding:23px 8px}}@container (max-width: 640px){.App.is-web-component:not(.is-in-desktop-only-mode) .SaveModal .footer .modal-button{padding:23px 8px}}.SaveModal .swipe-indicator{background:var(--swipe-indicator-bg);border-radius:2px;height:4px;width:38px;position:absolute;inset-block-start:12px;margin-inline-start:auto;margin-inline-end:auto;inset-inline-start:0;inset-inline-end:0}@media(min-width:641px){.App:not(.is-in-desktop-only-mode):not(.is-web-component) .SaveModal .swipe-indicator{display:none}}@container (min-width: 641px){.App.is-web-component:not(.is-in-desktop-only-mode) .SaveModal .swipe-indicator{display:none}}@media(max-width:640px){.App:not(.is-in-desktop-only-mode):not(.is-web-component) .SaveModal .swipe-indicator{width:32px}}@container (max-width: 640px){.App.is-web-component:not(.is-in-desktop-only-mode) .SaveModal .swipe-indicator{width:32px}}.SaveModal{flex-direction:column}.SaveModal .modal-container{overflow:visible;display:flex;flex-direction:column;justify-content:space-evenly;height:auto;width:480px;padding:0}.SaveModal .modal-container .header{border-bottom:1px solid var(--gray-5);padding:16px;height:64px;width:100%;display:flex;align-items:center;justify-content:space-between}.SaveModal .modal-container .header .header-text{font-size:var(--font-size-large);font-weight:var(--font-weight-bold)}.SaveModal .modal-container .header .Button{width:32px;height:32px}.SaveModal .modal-container .modal-body{padding:16px;display:flex;flex-direction:column;font-size:var(--font-size-default);font-family:var(--font-family);grid-gap:12px;gap:12px}.SaveModal .modal-container .modal-body .title{line-height:16px;font-weight:var(--font-weight-bold)}.SaveModal .modal-container .modal-body .input-container{align-items:baseline;display:flex;grid-gap:16px;gap:16px;height:32px;margin-bottom:20px}.SaveModal .modal-container .modal-body .input-container .label{justify-content:start;min-width:60px}.SaveModal .modal-container .modal-body .input-container .ui__input{border-color:var(--border)}.SaveModal .modal-container .modal-body .input-container .ui__input.ui__input--focused{box-shadow:none;border-color:var(--focus-border)}.SaveModal .modal-container .modal-body .input-container .ui__input.ui__input--message-warning{border-color:var(--error-border-color)}.SaveModal .modal-container .modal-body .input-container .ui__input.ui__input--message-warning .ui__icon svg{fill:var(--error-border-color)}.SaveModal .modal-container .modal-body .input-container .ui__input__messageText{color:var(--error-text-color);margin:8px 0;font-size:13px}.SaveModal .modal-container .modal-body .input-container input{padding:8px;height:32px;font-size:var(--font-size-default);flex:1 1 auto}.SaveModal .modal-container .modal-body .input-container .Dropdown__wrapper{height:32px;flex:1 1 auto}.SaveModal .modal-container .modal-body .input-container .Dropdown__wrapper .Dropdown{height:100%;width:100%!important}.SaveModal .modal-container .modal-body .input-container .Dropdown__wrapper .Dropdown .picked-option .picked-option-text{width:auto;flex:none}.SaveModal .modal-container .modal-body .input-container .Dropdown__wrapper .Dropdown .picked-option .arrow{flex:none}.SaveModal .modal-container .modal-body .radio-container{grid-gap:8px;gap:8px;height:90px;display:grid;grid-template-columns:repeat(2,1fr)}.SaveModal .modal-container .modal-body .radio-container .ui__choice--checked .ui__choice__input__check{border-color:var(--blue-5)}.SaveModal .modal-container .modal-body .radio-container .ui__choice__input__check{border-color:var(--gray-7)}.SaveModal .modal-container .modal-body .radio-container .page-number-input-container.error .page-number-input{border:1px solid var(--error-border-color)}.SaveModal .modal-container .modal-body .radio-container .page-number-input-container .page-number-input{width:208px}.SaveModal .modal-container .modal-body .radio-container .page-number-input-container .specifyPagesChoiceLabel{display:flex;margin-bottom:8px}.SaveModal .modal-container .modal-body .radio-container .page-number-input-container .specifyPagesChoiceLabel .specifyPagesExampleLabel{margin-inline-start:4px;color:var(--faded-text)}.SaveModal .modal-container .modal-body .radio-container .page-range-column{display:grid;grid-gap:16px;gap:16px;align-content:baseline}.SaveModal .modal-container .modal-body .radio-container .page-range-column.custom-page-ranges .ui__choice{align-items:unset}.SaveModal .modal-container .modal-body .checkbox-container{display:grid;grid-template-columns:repeat(2,1fr)}.SaveModal .modal-container .footer{padding:16px;display:flex;justify-content:flex-end;border-top:1px solid var(--gray-5)}.SaveModal .modal-container .footer button{border:none;border-radius:4px;background:var(--primary-button)!important;width:82px;height:32px;color:var(--primary-button-text)}",""]),o.locals={LEFT_HEADER_WIDTH:"41px",RIGHT_HEADER_WIDTH:"41px"}},2139:function(e,o,n){"use strict";n.r(o);n(9),n(10),n(14),n(38),n(83),n(21),n(46),n(20),n(12),n(269),n(44),n(22),n(18),n(26),n(16),n(40),n(24),n(41),n(42),n(8),n(57),n(17),n(19),n(11),n(13);var t=n(0),a=n.n(t),r=n(6),i=n(4),l=n(3),d=n(307),c=n(5),p=n(43),s=n(106),u=n(1595),m=n(1),b=n(15),f=n.n(b),v=n(72),g=n(481),h=n(186),y=n(62),x=n(59),w=n(566),S=n.n(w),E=n(383),M=n(164);n(1997);function _(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,o,n="function"==typeof Symbol?Symbol:{},t=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function r(n,t,a,r){var d=t&&t.prototype instanceof l?t:l,c=Object.create(d.prototype);return O(c,"_invoke",function(n,t,a){var r,l,d,c=0,p=a||[],s=!1,u={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(o,n){return r=o,l=0,d=e,u.n=n,i}};function m(n,t){for(l=n,d=t,o=0;!s&&c&&!a&&o<p.length;o++){var a,r=p[o],m=u.p,b=r[2];n>3?(a=b===t)&&(d=r[(l=r[4])?5:(l=3,3)],r[4]=r[5]=e):r[0]<=m&&((a=n<2&&m<r[1])?(l=0,u.v=t,u.n=r[1]):m<b&&(a=n<3||r[0]>t||t>b)&&(r[4]=n,r[5]=t,u.n=b,l=0))}if(a||n>1)return i;throw s=!0,t}return function(a,p,b){if(c>1)throw TypeError("Generator is already running");for(s&&1===p&&m(p,b),l=p,d=b;(o=l<2?e:d)||!s;){r||(l?l<3?(l>1&&(u.n=-1),m(l,d)):u.n=d:u.v=d);try{if(c=2,r){if(l||(a="next"),o=r[a]){if(!(o=o.call(r,d)))throw TypeError("iterator result is not an object");if(!o.done)return o;d=o.value,l<2&&(l=0)}else 1===l&&(o=r.return)&&o.call(r),l<2&&(d=TypeError("The iterator does not provide a '"+a+"' method"),l=1);r=e}else if((o=(s=u.n<0)?d:n.call(t,u))!==i)break}catch(o){r=e,l=1,d=o}finally{c=1}}return{value:o,done:s}}}(n,a,r),!0),c}var i={};function l(){}function d(){}function c(){}o=Object.getPrototypeOf;var p=[][t]?o(o([][t]())):(O(o={},t,(function(){return this})),o),s=c.prototype=l.prototype=Object.create(p);function u(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,O(e,a,"GeneratorFunction")),e.prototype=Object.create(s),e}return d.prototype=c,O(s,"constructor",c),O(c,"constructor",d),d.displayName="GeneratorFunction",O(c,a,"GeneratorFunction"),O(s),O(s,a,"Generator"),O(s,t,(function(){return this})),O(s,"toString",(function(){return"[object Generator]"})),(_=function(){return{w:r,m:u}})()}function O(e,o,n,t){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(O=function(e,o,n,t){if(o)a?a(e,o,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[o]=n;else{var r=function(o,n){O(e,o,(function(e){return this._invoke(o,n,e)}))};r("next",0),r("throw",1),r("return",2)}})(e,o,n,t)}function D(e,o,n,t,a,r,i){try{var l=e[r](i),d=l.value}catch(e){return void n(e)}l.done?o(d):Promise.resolve(d).then(t,a)}function k(e,o){return function(e){if(Array.isArray(e))return e}(e)||function(e,o){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var t,a,r,i,l=[],d=!0,c=!1;try{if(r=(n=n.call(e)).next,0===o){if(Object(n)!==n)return;d=!1}else for(;!(d=(t=r.call(n)).done)&&(l.push(t.value),l.length!==o);d=!0);}catch(e){c=!0,a=e}finally{try{if(!d&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return l}}(e,o)||function(e,o){if(e){if("string"==typeof e)return A(e,o);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,o):void 0}}(e,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,o){(null==o||o>e.length)&&(o=e.length);for(var n=0,t=Array(o);n<o;n++)t[n]=e[n];return t}var j="all",F="currentPage",I="currentView",T="specify",C={OFFICE:{label:"OFFICE (*.pptx,*.docx,*.xlsx)",extension:x.a.OFFICE},PDF:{label:"PDF (*.pdf)",extension:x.a.PDF},IMAGE:{label:"PNG (*.png)",extension:"png"},OFFICE_EDITOR:{label:"Word Document (*.docx)",extension:x.a.OFFICE},SPREADSHEET_EDITOR:{label:"Excel Document (*.xlsx)",extension:x.a.SPREADSHEET_EDITOR}},P=[".ppt",".xls"],N=function(){var e=Object(r.f)(),o=Object(r.d)(),n=Object(d.a)().t,b=Object(r.e)((function(e){return i.a.isElementOpen(e,c.a.SAVE_MODAL)})),w=Object(r.e)((function(e){return i.a.getActiveDocumentViewerKey(e)})),O=Object(r.e)(i.a.isSpreadsheetEditorModeEnabled),A=[C.PDF,C.IMAGE],N=k(Object(t.useState)(A),2),R=N[0],L=N[1],H=k(Object(t.useState)(""),2),z=H[0],G=H[1],V=k(Object(t.useState)(R[0]),2),W=V[0],B=V[1],U=k(Object(t.useState)(j),2),K=U[0],q=U[1],J=k(Object(t.useState)(),2),$=J[0],Q=J[1],X=k(Object(t.useState)(!0),2),Y=X[0],Z=X[1],ee=k(Object(t.useState)(!1),2),oe=ee[0],ne=ee[1],te=k(Object(t.useState)(1),2),ae=te[0],re=te[1],ie=k(Object(t.useState)(!1),2),le=ie[0],de=ie[1];Object(t.useEffect)((function(){var e=function(){var e,o=(e=_().m((function e(){var o,n,t,a,r,i;return _().w((function(e){for(;;)switch(e.n){case 0:if(!(o=m.a.getDocument(w))){e.n=4;break}if(B(C.PDF),L(A),n=o.getFilename(),t=n.substring(0,n.lastIndexOf("."))||n,G(t),(a=o.getType())!==x.a.OFFICE){e.n=2;break}return r=n.split("."),i=".".concat(r[r.length-1]),P.includes(i)||L([].concat(A,[C.OFFICE])),e.n=1,o.getDocumentCompletePromise();case 1:e.n=3;break;case 2:a===x.a.OFFICE_EDITOR?(L([C.OFFICE_EDITOR,C.PDF]),B(C.OFFICE_EDITOR)):a===x.a.SPREADSHEET_EDITOR&&(L([C.SPREADSHEET_EDITOR,C.PDF]),B(C.SPREADSHEET_EDITOR));case 3:re(m.a.getTotalPages(w));case 4:return e.a(2)}}),e)})),function(){var o=this,n=arguments;return new Promise((function(t,a){var r=e.apply(o,n);function i(e){D(r,t,a,i,l,"next",e)}function l(e){D(r,t,a,i,l,"throw",e)}i(void 0)}))});return function(){return o.apply(this,arguments)}}(),n=function(){G(""),re(0),L(A),B(A[0]),o(l.a.closeElement(c.a.SAVE_MODAL))};return e(),m.a.addEventListener("documentUnloaded",n,void 0,w),m.a.addEventListener("documentLoaded",e,void 0,w),function(){m.a.removeEventListener("documentUnloaded",n,w),m.a.removeEventListener("documentLoaded",e,w)}}),[w]),Object(t.useEffect)((function(){var e=m.a.getDocument(w);if(Object(y.p)()&&e){B(C.OFFICE_EDITOR);var o=e.getFilename(),n=o.substring(0,o.lastIndexOf("."))||o;G(n)}}),[b]);var ce=function(){return o(l.a.closeElement(c.a.SAVE_MODAL))},pe=Object(M.a)(ce),se=function(){return de(!1)},ue=function(){var n;m.a.getDocument(w)?z&&(n=K===T?null!=$&&$.length?$:[m.a.getCurrentPage(w)]:K===F||K===I?[m.a.getCurrentPage(w)]:S()(1,m.a.getTotalPages(w)+1,1),Object(h.a)(o,{includeAnnotations:Y,includeComments:oe,useDisplayAuthor:!0,filename:z||"untitled",downloadType:W.extension,pages:n,store:e},w),pe()):console.warn("Document is not loaded")},me=k(Object(t.useState)(!1),2),be=me[0],fe=me[1],ve=(le||!be)&&K===T||!z,ge="office"===W.extension||Object(y.p)()||O,he=a.a.createElement("div",{className:f()("page-number-input-container",{error:le})},a.a.createElement("label",{className:"specifyPagesChoiceLabel"},a.a.createElement("span",null,n("option.print.specifyPages")),K===T&&a.a.createElement("span",{className:"specifyPagesExampleLabel"},"- ",n("option.thumbnailPanel.multiSelectPagesExample"))),K===T&&a.a.createElement(g.a,{selectedPageNumbers:$,pageCount:ae,onBlurHandler:Q,onSelectedPageNumbersChange:function(e){be||fe(!0),e.length>0&&se()},onError:function(){return de(!0)}}));return a.a.createElement("div",{className:f()("SaveModal",{open:b,closed:!b}),"data-element":c.a.SAVE_MODAL},a.a.createElement(E.a,{isOpen:b,title:n("saveModal.saveAs"),closeHandler:ce,onCloseClick:ce,swipeToClose:!0},a.a.createElement("div",{className:"modal-body"},a.a.createElement("div",{className:"title"},n("saveModal.general")),a.a.createElement("div",{className:"input-container"},a.a.createElement("label",{htmlFor:"fileNameInput",className:"label"},n("saveModal.fileName")),a.a.createElement(u.a,{type:"text",id:"fileNameInput","data-testid":"fileNameInput",onChange:function(e){var o;G(null==e||null===(o=e.target)||void 0===o?void 0:o.value)},onKeyDown:function(e){"Enter"!==e.key||ve||ue()},value:z,fillWidth:!0,padMessageText:!0,messageText:""===z?n("saveModal.fileNameCannotBeEmpty"):"",message:""===z?"warning":"default"})),a.a.createElement("div",{className:"input-container"},a.a.createElement("div",{className:"label",id:"file-type-dropdown-label"},n("saveModal.fileType")),a.a.createElement(v.a,{id:"fileTypeDropdown",labelledById:"file-type-dropdown-label",items:R.map((function(e){return e.label})),onClickItem:function(e){B(R.find((function(o){return o.label===e}))),e===C.OFFICE.label&&q(j)},currentSelectionKey:W.label})),!ge&&a.a.createElement(a.a.Fragment,null,a.a.createElement("div",{className:"title"},n("saveModal.pageRange")),a.a.createElement("form",{className:"radio-container",onChange:function(e){e.target.classList.contains("page-number-input")||(q(e.target.value),le&&(fe(!1),se()))},onSubmit:function(e){return e.preventDefault()}},a.a.createElement("div",{className:"page-range-column"},a.a.createElement(s.a,{checked:K===j,radio:!0,name:"page-range-option",label:n("saveModal.all"),value:j}),a.a.createElement(s.a,{checked:K===F,radio:!0,name:"page-range-option",label:n("saveModal.currentPage"),value:F})),a.a.createElement("div",{className:"page-range-column custom-page-ranges"},a.a.createElement(s.a,{checked:K===T,radio:!0,name:"page-range-option",label:he,value:T}))),a.a.createElement("div",{className:"title"},n("saveModal.properties")),a.a.createElement("div",{className:"checkbox-container"},a.a.createElement(s.a,{checked:Y,name:"include-annotation-option",label:n("saveModal.includeAnnotation"),onChange:function(){return Z(!Y)}}),a.a.createElement(s.a,{checked:oe,name:"include-comment-option",label:n("saveModal.includeComments"),onChange:function(){return ne(!oe)}})))),a.a.createElement("div",{className:"footer"},a.a.createElement(p.a,{disabled:ve,onClick:ue,label:n("saveModal.save")}))))};o.default=N}}]); //# sourceMappingURL=chunk.76.js.map