All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.easypoijs.web-office-sdk-v1.1.2.umd.js Maven / Gradle / Ivy

There is a newer version: 3.0.0-M4
Show newest version
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).WebOfficeSDK={})}(this,function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=0&&e._handleList.splice(n,1),window.removeEventListener("message",t,!1)},e.empty=function(){for(;e._handleList.length;)window.removeEventListener("message",e._handleList.shift(),!1)},e.parse=function(e){return"object"==typeof e?e:e?JSON.parse(e):e},e._handleList=[],e}();var i,a,c,s=this;!function(e){e.unknown="unknown",e.spreadsheet="s",e.writer="w",e.presentation="p",e.pdf="f"}(i||(i={})),function(e){e.wps="w",e.et="s",e.presentation="p",e.pdf="f"}(a||(a={})),function(e){e.nomal="nomal",e.simple="simple"}(c||(c={}));var u,p,l=(u=0,function(){return++u}),f=function(e,t,n){if(void 0===n&&(n=!0),!p){var r=function(e){p.style.cssText+="height: "+e.clientHeight+"px; width: "+e.clientWidth+"px"}.bind(null,t);(p=document.createElement("iframe")).classList.add("web-office-iframe");var o={id:"office-iframe",src:e,scrolling:"no",frameborder:"0",allowfullscreen:"allowfullscreen",webkitallowfullscreen:"true",mozallowfullscreen:"true"};for(var i in t?(o.style="width: "+t.clientWidth+"px; height: "+t.clientHeight+"px;",n&&window.addEventListener("resize",r)):((t=document.createElement("div")).classList.add("web-office-default-container"),function(e){var t=document.createElement("style");document.head.appendChild(t);var n=t.sheet;n.insertRule(e,n.cssRules.length)}(".web-office-default-container {position: absolute; padding: 0;  margin: 0; width: 100vw; height: 100vh; left: 0; top: 0;}"),document.body.appendChild(t),o.style="width: 100vw; height: 100vh;"),o)p.setAttribute(i,o[i]);t.appendChild(p),p.destroy=function(){p.parentNode.removeChild(p),p=null,window.removeEventListener("resize",r)}}return p};var d=function(e){f().contentWindow.postMessage(JSON.stringify(e),"*")};function v(e,t,n){return new Promise(function(r){var i=l(),a=function(e){var t=o.parse(e.data);t.eventName===n&&t.msgId===i&&(r(t.data),o.remove(a))};o.add(a),d({eventName:t,data:e,msgId:i})})}var b=function(e){return v(e,"wps.jssdk.api","wps.api.reply")},h=function(e){return v(e,"api.basic","api.basic.reply")},m=function(e,i,a,c){return n(s,void 0,void 0,function(){var s,u,p,f,v,b,h,m;return r(this,function(y){switch(y.label){case 0:return s=l(),f=new Promise(function(e,t){u=e,p=t}),v={},i.args?[4,w(i.args)]:[3,2];case 1:b=y.sent(),h=b[0],m=b[1],i.args=h,v=m,y.label=2;case 2:return function(e){var n=e[0],r=e[1];"function"==typeof(n=t({},n)).data&&(n.data=n.data());r(),d(n)}([{eventName:e,data:i,msgId:s},function(){var t=this,i=function(l){return n(t,void 0,void 0,function(){var t,n,f;return r(this,function(r){switch(r.label){case 0:return"api.callback"===(t=o.parse(l.data)).eventName&&t.callbackId&&v[t.callbackId]?[4,v[t.callbackId].apply(v,t.data.args)]:[3,2];case 1:n=r.sent(),d({eventName:"api.callback.reply",result:n,callbackId:t.callbackId}),r.label=2;case 2:return t.eventName===e+".reply"&&t.msgId===s&&(t.error?((f=new Error("")).stack=t.error+"\n"+a,c&&c(),p(f)):u(t.result),o.remove(i)),[2]}})})};return o.add(i),f}]),[2,f]}})})};function w(e){return n(this,void 0,void 0,function(){var t,n,o,i,a,c,s;return r(this,function(r){switch(r.label){case 0:t={},n=[],e=e.slice(0),r.label=1;case 1:return e.length?(o=void 0,[4,e.shift()]):[3,3];case 2:if(i=r.sent(),function(e){if(!e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(o))for(a in o={},i)"function"==typeof(c=i[a])&&(s=l(),t[s]=c,c={callbackId:s}),o[a]=c;else"function"==typeof i?(s=l(),t[s]=i,o={callbackId:s}):o=i;return n.push(o),[3,1];case 3:return[2,[n,t]]}})})}var y=function(e,n){void 0===n&&(n=!0);var r=t({},e),o=r.headers,i=void 0===o?{}:o,a=r.subscriptions,s=void 0===a?{}:a,u=r.mode,p=void 0===u?c.nomal:u,l=i.backBtn,f=void 0===l?{}:l,d=i.shareBtn,v=void 0===d?{}:d,b=i.otherMenuBtn,h=void 0===b?{}:b,m=function(e,t){e.subscribe&&"function"==typeof e.subscribe&&(e.callback=t,s[t]=e.subscribe,n&&delete e.subscribe)};if(m(f,"wpsconfig_back_btn"),m(v,"wpsconfig_share_btn"),m(h,"wpsconfig_other_menu_btn"),h.items&&Array.isArray(h.items)){var w=[];h.items.forEach(function(e,t){switch(void 0===e&&(e={}),e.type){case"export_img":e.type=1,e.callback="export_img";break;case"export_pdf":e.type=1,e.callback="export_pdf";break;case"save_version":e.type=1,e.callback="save_version";break;case"about_wps":e.type=1,e.callback="about_wps";break;case"split_line":e.type=2;break;case"custom":e.type=3,m(e,"wpsconfig_other_menu_btn_"+t),w.push(e)}}),w.length&&(k||O)&&(h.items=w)}if(r.url=r.url||r.wpsUrl,(p===c.simple||r.commonOptions&&!1===r.commonOptions.isShowTopArea)&&r.url&&(r.url+="&simple&hidecmb"),r.debug&&r.url&&(r.url+="&debugger"),r.wordOptions&&(r.wpsOptions=r.wordOptions),r.excelOptions&&(r.etOptions=r.excelOptions),r.pptOptions&&(r.wppOptions=r.pptOptions),"object"==typeof s.print){var y="wpsconfig_print";"function"==typeof s.print.subscribe&&(s[y]=s.print.subscribe,r.print={callback:y},void 0!==s.print.custom&&(r.print.custom=s.print.custom)),delete s.print}"function"==typeof s.exportPdf&&(s[y="wpsconfig_export_pdf"]=s.exportPdf,r.exportPdf={callback:y},delete s.exportPdf);return r.commandBars&&j(r.commandBars,!1),t({},r,{subscriptions:s})},g=function(e){void 0===e&&(e="");var t="";if(!t&&e){var n=e.toLowerCase();-1!==n.indexOf("/office/s/")&&(t=i.spreadsheet),-1!==n.indexOf("/office/w/")&&(t=i.writer),-1!==n.indexOf("/office/p/")&&(t=i.presentation),-1!==n.indexOf("/office/f/")&&(t=i.pdf)}if(!t){var r=e.match(/[\?&]type=([a-z]+)/)||[];t=a[r[1]]||""}return t};function j(e,t){void 0===t&&(t=!0);var n=e.map(function(e){var t=e.attributes;if(!Array.isArray(t)){var n=[];for(var r in t)if(t.hasOwnProperty(r)){var o={name:r,value:t[r]};n.push(o)}e.attributes=n}return e});return t&&d({eventName:"setCommandBars",data:n}),n}var I=window.navigator.userAgent.toLowerCase(),k=/Android|webOS|iPhone|iPod|BlackBerry|iPad/i.test(I),O=function(){try{return-1!==window._parent.location.search.indexOf("from=wxminiprogram")}catch(e){return!1}}();function _(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var x=0,E=new Set;function C(e){return++x,!e&&function(e){E.forEach(function(t){return t(e)})}(x),x}function P(e,a){var c,s=this,u=a.Events,p=a.Enum,l=a.Props,f=l[0],v=l[1],b={objId:x};switch(function e(n,r,o){r=r.slice(0);var i=function(){var i=r.shift();!i.alias&&~S.indexOf(i.prop)&&r.push(t({},i,{alias:i.prop+"Async"})),Object.defineProperty(n,i.alias||i.prop,{get:function(){var r=this,a=1===i.cache,c=a&&this["__"+i.prop+"CacheValue"];if(c)return c;var s=new Error(""),u=s.stack.split("\n").slice(2).join("\n"),p=C(a),l=function(){for(var e,r=[],a=0;a




© 2015 - 2024 Weber Informatics LLC | Privacy Policy