mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-02 06:54:19 +00:00
2 lines
13 KiB
JavaScript
Vendored
2 lines
13 KiB
JavaScript
Vendored
/*! For license information please see 192.js.LICENSE.txt */
|
|
"use strict";(self.webpackChunkDooTask=self.webpackChunkDooTask||[]).push([[192],{46376:(t,e,r)=>{r.d(e,{Z:()=>i});var n=r(1519),o=r.n(n)()((function(t){return t[1]}));o.push([t.id,".component-only-office[data-v-4a2f2bcd]{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.component-only-office .placeholder[data-v-4a2f2bcd]{flex:1;height:100%;width:100%}.component-only-office .office-loading[data-v-4a2f2bcd]{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:2}",""]);const i=o},27832:(t,e,r)=>{r.d(e,{Z:()=>i});var n=r(1519),o=r.n(n)()((function(t){return t[1]}));o.push([t.id,".component-only-office .load-error{align-items:center;display:flex;left:50%;padding:8px;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:1}.component-only-office .load-error .ivu-alert-icon{margin-left:4px;margin-right:8px;position:static}",""]);const i=o},61192:(t,e,r)=>{r.r(e),r.d(e,{default:()=>b});var n=r(20629),o=r(62065),i=r(33875);function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(){c=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function f(t,e,r,o){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),c=new j(o||[]);return n(a,"_invoke",{value:k(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var d={};function p(){}function y(){}function v(){}var m={};u(m,i,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(T([])));w&&w!==e&&r.call(w,i)&&(m=w);var b=v.prototype=p.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function o(n,i,c,s){var l=h(t[n],t,i);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==a(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,c,s)}),(function(t){o("throw",t,c,s)})):e.resolve(f).then((function(t){u.value=t,c(u)}),(function(t){return o("throw",t,c,s)}))}s(l.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function k(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return A()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===d)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function O(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=h(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function T(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:A}}function A(){return{value:void 0,done:!0}}return y.prototype=v,n(b,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:y,configurable:!0}),y.displayName=u(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u(t,l,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(E.prototype),u(E.prototype,s,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new E(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),u(b,l,"Generator"),u(b,i,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=T,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function s(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){s(i,n,o,a,c,"next",t)}function c(t){s(i,n,o,a,c,"throw",t)}a(void 0)}))}}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function f(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){h(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const d={name:"OnlyOffice",components:{IFrame:o.Z},props:{id:{type:String,default:function(){return"office_"+Math.round(1e4*Math.random())}},code:{type:String,default:""},historyId:{type:Number,default:0},value:{type:[Object,Array],default:function(){return{}}},readOnly:{type:Boolean,default:!1},documentKey:Function},data:function(){return{loading:!1,loadError:!1,docEditor:null}},beforeDestroy:function(){null!==this.docEditor&&(this.docEditor.destroyEditor(),this.docEditor=null)},computed:f(f({},(0,n.rn)(["userInfo","themeIsDark"])),{},{fileType:function(){return this.getType(this.value.type)},fileName:function(){return this.value.name},fileUrl:function(){var t,e=this.code||this.value.id;return $A.leftExists(e,"msgFile_")?t="dialog/msg/download/?msg_id=".concat($A.leftDelete(e,"msgFile_"),"&token=").concat(this.userToken):$A.leftExists(e,"taskFile_")?t="project/task/filedown/?file_id=".concat($A.leftDelete(e,"taskFile_"),"&token=").concat(this.userToken):(t="file/content/?id=".concat(e,"&token=").concat(this.userToken),this.historyId>0&&(t+="&history_id=".concat(this.historyId))),t},previewUrl:function(){return $A.apiUrl(this.fileUrl)+"&down=preview"}}),watch:{"value.id":{handler:function(t){var e=this;t&&$A.isDesktop()&&(this.loading=!0,this.loadError=!1,$A.loadScript($A.apiUrl("../office/web-apps/apps/api/documents/api.js"),(function(t){if(e.loading=!1,null===t)if(e.documentKey){var r=e.documentKey();r&&r.then?r.then(e.loadFile):e.loadFile()}else e.handleClose();else e.loadError=!0})))},immediate:!0},previewUrl:{handler:function(){$A.isDesktop()||(this.loading=!0)},immediate:!0}},methods:{onFrameLoad:function(){this.loading=!1},getType:function(t){switch(t){case"word":return"docx";case"excel":return"xlsx";case"ppt":return"pptx"}return t},loadFile:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";null!==this.docEditor&&(this.docEditor.destroyEditor(),this.docEditor=null);var r="zh";switch(i.AX){case"CN":case"TC":r="zh";break;default:r="en"}var n=this.code||this.value.id,o=$A.strExists(this.fileName,".")?this.fileName:this.fileName+"."+this.fileType,a="".concat(this.fileType,"-").concat(e||n);this.historyId>0&&(a+="-".concat(this.historyId));var s,u={document:{fileType:this.fileType,title:o,key:a,url:"http://nginx/api/".concat(this.fileUrl)},editorConfig:{mode:"edit",lang:r,user:{id:String(this.userInfo.userid),name:this.userInfo.nickname},customization:{uiTheme:this.themeIsDark?"theme-dark":"theme-classic-light",forcesave:!0,help:!1},callbackUrl:"http://nginx/api/file/content/office?id=".concat(n,"&token=").concat(this.userToken)},events:{onDocumentReady:this.onDocumentReady}};/\/hideenOfficeTitle\//.test(window.navigator.userAgent)&&(u.document.title=" "),(s=l(c().mark((function e(r){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.readOnly||t.historyId>0)){e.next=13;break}if(u.editorConfig.mode="view",u.editorConfig.callbackUrl=null,u.editorConfig.user.id){e.next=13;break}return e.next=6,$A.IDBInt("officeViewer");case 6:if(n=e.sent){e.next=11;break}return n=$A.randNum(1e3,99999),e.next=11,$A.IDBSet("officeViewer",n);case 11:u.editorConfig.user.id="viewer_"+n,u.editorConfig.user.name="Viewer_"+n;case 13:t.$nextTick((function(){t.docEditor=new DocsAPI.DocEditor(t.id,u)}));case 14:case"end":return e.stop()}}),e)}))),function(t){return s.apply(this,arguments)})()},onDocumentReady:function(){this.$emit("on-document-ready",this.docEditor)}}};var p=r(93379),y=r.n(p),v=r(46376),m={insert:"head",singleton:!1};y()(v.Z,m);v.Z.locals;var g=r(27832),w={insert:"head",singleton:!1};y()(g.Z,w);g.Z.locals;const b=(0,r(51900).Z)(d,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"component-only-office"},[t.$A.isDesktop()?[t.loadError?e("Alert",{staticClass:"load-error",attrs:{type:"error","show-icon":""}},[t._v(t._s(t.$L("组件加载失败!")))]):t._e(),t._v(" "),e("div",{staticClass:"placeholder",attrs:{id:t.id}})]:e("IFrame",{staticClass:"preview-iframe",attrs:{src:t.previewUrl},on:{"on-load":t.onFrameLoad}}),t._v(" "),t.loading?e("div",{staticClass:"office-loading"},[e("Loading")],1):t._e()],2)}),[],!1,null,"4a2f2bcd",null).exports}}]); |