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 • 14.3 kB
(window.webpackJsonpWebViewerUI=window.webpackJsonpWebViewerUI||[]).push([[4],{1585:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return r}));n(22);var o=function(e,t,n){return{icon:t,label:n,title:n,option:e,dataElement:"".concat(e[0].toUpperCase()+e.slice(1),"Button")}},i={OPENFILE:"openFile",RENAME:"rename",SETDEST:"setDestination",DOWNLOAD:"download",DELETE:"delete",OPENFORMFIELDPANEL:"openFormFieldPanel",MOVE_UP:"moveUp",MOVE_DOWN:"moveDown",MOVE_LEFT:"moveLeft",MOVE_RIGHT:"moveRight"},r=[o(i.OPENFORMFIELDPANEL,"icon-edit-form-field","action.edit"),o(i.OPENFILE,"icon-portfolio-file","portfolio.openFile"),o(i.RENAME,"ic_edit_page_24px","action.rename"),o(i.SETDEST,"icon-thumbtack","action.setDestination"),o(i.DOWNLOAD,"icon-download","action.download"),o(i.DELETE,"icon-delete-line","action.delete"),o(i.MOVE_UP,"icon-page-move-up","action.moveUp"),o(i.MOVE_DOWN,"icon-page-move-down","action.moveDown"),o(i.MOVE_LEFT,"icon-page-move-left","action.moveLeft"),o(i.MOVE_RIGHT,"icon-page-move-right","action.moveRight")]},1647:function(e,t,n){"use strict";n(9),n(10),n(14),n(38),n(21),n(20),n(12),n(44),n(22),n(18),n(16),n(8),n(57),n(17),n(19),n(11),n(13);var o=n(0),i=n.n(o),r=n(2),l=n.n(r),a=n(15),c=n.n(a),s=n(307),u=n(96),p=n(43),d=n(106),m=n(51);n(1728);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,r,l,a=[],c=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);c=!0);}catch(e){s=!0,i=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);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)?h(e,t):void 0}}(e,t)||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 h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}var b=function(e,t){var n=f(Object(o.useState)(1),2),i=n[0],r=n[1];return Object(o.useEffect)((function(){for(var n=-1,o=null==e?void 0:e.current;o;)n++,o=o.parentElement.closest(t);r(n)}),[e]),i};n(32),n(34),n(27),n(46),n(33),n(29),n(49),n(24),n(48),n(50),n(35),n(31);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function w(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=g(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==g(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=function(e,t,n,o,i){var r=w(w(w(w(w(w(w(w(w({},i.DELETE,(function(){return n})),i.DOWNLOAD,(function(){return"portfolio"!==t})),i.OPENFILE,(function(){return"portfolio"!==t})),i.SETDEST,(function(){return"outline"!==t})),i.OPENFORMFIELDPANEL,(function(){return["portfolio","bookmark","outline"].includes(t)})),i.MOVE_LEFT,(function(){return"outline"!==t})),i.MOVE_RIGHT,(function(){return"outline"!==t})),i.MOVE_UP,(function(){return"outline"!==t&&"portfolio"!==t})),i.MOVE_DOWN,(function(){return"outline"!==t&&"portfolio"!==t}));return e.map((function(e){var n=e.option,i=!!r[n]&&r[n]();return y(y({},e),{},{hidden:i,dataElement:"".concat(t).concat(e.dataElement),onClick:function(){return o(e.option)}})}))},x=n(1585),O=n(131),C=n(6),k=n(3);function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,r,l,a=[],c=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);c=!0);}catch(e){s=!0,i=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return D(e,t);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)?D(e,t):void 0}}(e,t)||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 D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}var N=function(e){var t=e.children,n=i.a.Children.toArray(t);return 0===n.length?null:i.a.createElement("ul",{className:"panel-list-children"},n.map((function(e,t){var n;return i.a.createElement("li",{key:null!==(n=null==e?void 0:e.key)&&void 0!==n?n:t},e)})))};N.propTypes={children:l.a.oneOfType([l.a.arrayOf(l.a.node),l.a.node])};var M=i.a.memo((function(e){var t=e.iconGlyph,n=e.labelHeader,o=e.onDoubleClick,r=e.onClick,l=e.useI18String,a=e.textColor,s=e.isActive;return i.a.createElement(i.a.Fragment,null,t&&i.a.createElement("div",{className:"panel-list-icon-container"},i.a.createElement(m.a,{glyph:t})),i.a.createElement("div",{className:"panel-list-text-container"},i.a.createElement("div",{className:"panel-list-label-header"},i.a.createElement(p.a,{style:{color:a||"inherit"},ariaLabel:n,label:n,onDoubleClick:o,onClick:r,className:c()({"set-focus":s}),useI18String:l}))))}));M.displayName="PanelItemContent",M.propTypes={iconGlyph:l.a.string,labelHeader:l.a.string.isRequired,onDoubleClick:l.a.func,onClick:l.a.func,useI18String:l.a.bool,textColor:l.a.string,isActive:l.a.bool};var j=function(e){var t=e.checkboxOptions,n=e.children,r=e.contentMenuFlyoutOptions,l=void 0===r?{}:r,a=e.contextMenuMoreButtonOptions,m=void 0===a?{}:a,f=e.description,h=e.enableMoreOptionsContextMenuFlyout,g=e.iconGlyph,v=e.labelHeader,y=e.useI18String,w=void 0===y||y,D=e.onDoubleClick,j=void 0===D?function(){}:D,I=e.onClick,A=void 0===I?function(){}:I,P=e.expanded,T=e.setIsExpandedHandler,F=e.textColor,L=e.isActive,R=e.virtualizedChildrenRenderer,_=e.virtualizedChildrenCount,B=Object(o.useRef)(),V=b(B),H=S(Object(o.useState)(null!=P&&P),2),U=H[0],W=H[1],G=Object(s.a)().t,z=Object(C.d)(),q=l.shouldHideDeleteButton,J=void 0!==q&&q,$=l.currentFlyout,K=l.flyoutSelector,Q=l.type,X=l.handleOnClick,Y=m.flyoutToggleElement,Z=m.moreOptionsDataElement,ee=t&&!t.disabled||!1;Object(o.useEffect)((function(){W(P)}),[P]);var te=i.a.Children.count(n),ne=null!=_?_:te;return i.a.createElement("div",{"data-element":"panelListItem",className:"panel-list-item",ref:B},i.a.createElement("div",{className:c()({"panel-list-grid":!0,"grid-with-2-rows":f,"grid-with-1-row":!f,"grid-with-3-columns":!g&&!t,"grid-with-4-columns":g||t,"grid-with-5-columns":g&&t})},i.a.createElement("div",{className:c()("panel-list-row".concat(t?" with-checkbox":""),"focusable-container")},ee&&i.a.createElement("div",{style:{"--checkbox-left":"".concat(-32*V+4,"px")},className:"checkbox"},i.a.createElement(d.a,{role:"checkbox",id:null==t?void 0:t.id,"aria-label":null==t?void 0:t.ariaLabel,"aria-checked":null==t?void 0:t.checked,checked:null==t?void 0:t.checked,onChange:null==t?void 0:t.onChange})),i.a.createElement("div",{onClick:function(e){e.stopPropagation(),W(!U),T&&T(!U)},className:c()({"chevron-container":!0,toggled:U,visible:ne>0})},i.a.createElement(p.a,{img:Object(O.a)(),className:"panel-list-button",ariaExpanded:U,ariaLabel:"".concat(G(U?"action.collapse":"action.expand")," ").concat(v)})),i.a.createElement(M,{iconGlyph:g,labelHeader:v,onDoubleClick:j,onClick:A,useI18String:w,textColor:F,isActive:L}),h&&i.a.createElement("div",{className:"panel-list-more-options"},i.a.createElement(u.a,{className:"toggle-more-button",title:"".concat(G("option.searchPanel.moreOptions")," ").concat(v),toggleElement:Y,dataElement:Z,img:"icon-tool-more",disabled:!1,onClick:function(e){e.stopPropagation();var t={dataElement:K,className:"MoreOptionsContextMenuFlyout",items:E(x.a,Q,J,X,x.b)};z($?k.a.updateFlyout(K,t):k.a.addFlyout(t)),z(k.a.setFlyoutToggleElement(Z)),z(k.a.toggleElement(K))}}))),f&&i.a.createElement("div",{className:"panel-list-description"},f)),U&&ne>0&&(R?R():i.a.createElement(N,null,n)))};j.propTypes={checkboxOptions:l.a.shape({id:l.a.string,checked:l.a.bool,onChange:l.a.func,ariaLabel:l.a.string,disabled:l.a.bool}),useI18String:l.a.bool,iconGlyph:l.a.string,labelHeader:l.a.string.isRequired,description:l.a.string,enableMoreOptionsContextMenuFlyout:l.a.bool,children:l.a.node,onDoubleClick:l.a.func,onClick:l.a.func,expanded:l.a.bool,textColor:l.a.string,setIsExpandedHandler:l.a.func,contentMenuFlyoutOptions:l.a.shape({shouldHideDeleteButton:l.a.bool,currentFlyout:l.a.object,flyoutSelector:l.a.string,type:l.a.string,handleOnClick:l.a.func}),contextMenuMoreButtonOptions:l.a.shape({flyoutToggleElement:l.a.string,moreOptionsDataElement:l.a.string}),isActive:l.a.bool,virtualizedChildrenRenderer:l.a.func,virtualizedChildrenCount:l.a.number};t.a=j},1728:function(e,t,n){var o=n(36),i=n(1729);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={insert:function(e){if(!window.isApryseWebViewerWebComponent)return void document.head.appendChild(e);let t;t=document.getElementsByTagName("apryse-webviewer"),t.length||(t=function e(t,n=document){const o=[];return n.querySelectorAll(t).forEach(e=>o.push(e)),n.querySelectorAll("*").forEach(n=>{n.shadowRoot&&o.push(...e(t,n.shadowRoot))}),o}("apryse-webviewer"));const n=[];for(let o=0;o<t.length;o++){const i=t[o];if(0===o)i.shadowRoot.appendChild(e),e.onload=function(){n.length>0&&n.forEach(t=>{t.innerHTML=e.innerHTML})};else{const t=e.cloneNode(!0);i.shadowRoot.appendChild(t),n.push(t)}}},singleton:!1};o(i,r);e.exports=i.locals||{}},1729:function(e,t,n){(e.exports=n(37)(!1)).push([e.i,'.panel-list-item{width:100%;display:flex;flex-direction:column;position:relative;box-sizing:border-box;list-style-type:none}.panel-list-item ul{list-style-type:none;margin:0}.panel-list-item li::marker{content:"";margin:0}.panel-list-grid{display:grid;align-items:center;grid-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:8px;margin-bottom:8px}.panel-list-grid.grid-with-1-row{grid-template-rows:auto}.panel-list-grid.grid-with-2-rows{grid-template-rows:auto auto}.panel-list-grid.grid-with-3-columns{grid-template-columns:auto minmax(0,1fr) auto}.panel-list-grid.grid-with-4-columns{grid-template-columns:auto auto minmax(0,1fr) auto}.panel-list-grid.grid-with-5-columns{grid-template-columns:auto auto auto minmax(0,1fr) auto}.panel-list-grid:hover .panel-list-more-options,.panel-list-grid[focus-within] .panel-list-more-options{visibility:visible}.panel-list-grid:focus-within .panel-list-more-options,.panel-list-grid:hover .panel-list-more-options{visibility:visible}.panel-list-row{display:contents}.panel-list-row.with-checkbox{padding-inline-start:32px}.panel-list-row .checkbox{margin:0;position:relative;inset-inline-start:0;inset-inline-start:var(--checkbox-left,0)}.panel-list-row .chevron-container{min-width:24px;transition:transform .1s ease;visibility:hidden}.panel-list-row .chevron-container.toggled{transform:rotate(90deg)}[dir=rtl] .panel-list-row .chevron-container.toggled{transform:rotate(-90deg)}.panel-list-row .chevron-container.visible{visibility:visible}.panel-list-row .chevron-container:hover{cursor:pointer;border:none;border-radius:4px;box-shadow:inset 0 0 0 1px var(--blue-6);color:var(--blue-6);background-color:var(--faded-component-background)}.panel-list-row .chevron-container .Button{width:24px;height:24px}.panel-list-row .chevron-container .Button .Icon{width:12px;height:12px}.panel-list-row .panel-list-icon-container .Icon{width:24px;height:24px}.panel-list-row .panel-list-text-container{grid-area:1/-3/auto/-2;display:flex;flex-direction:row;height:24px}.panel-list-row .panel-list-text-container .panel-list-label-header{align-content:center;margin:0;width:100%}.panel-list-row .panel-list-text-container .panel-list-label-header .set-focus{color:#2c73ab}.panel-list-row .panel-list-text-container .panel-list-label-header .Button{display:flex;width:auto;max-width:100%;height:100%;padding:2px 0 2px 4px;justify-content:start}.panel-list-row .panel-list-text-container .panel-list-label-header .Button:focus{color:#2c73ab}.panel-list-row .panel-list-text-container .panel-list-label-header .Button:hover{cursor:pointer;border:none;border-radius:4px;box-shadow:unset;color:var(--blue-6)}.panel-list-row .panel-list-text-container .panel-list-label-header .Button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;flex-grow:1}.panel-list-row .panel-list-more-options{grid-area:1/-2/auto/-1;display:flex;justify-content:flex-end;margin-inline-start:2px;visibility:hidden}.panel-list-row .panel-list-more-options .Button{width:24px;height:24px;min-width:24px}.panel-list-row .panel-list-more-options .Button:focus{color:var(--blue-6)}.panel-list-row .panel-list-more-options .Button .Icon{width:12px;height:12px}.panel-list-description{grid-area:2/-3/auto/-2;display:flex;align-items:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding:2px 0 2px 4px;height:24px}.panel-list-children{padding-inline-start:32px}',""])}}]); //# sourceMappingURL=chunk.4.js.map