iking-web-ui-pro 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(l,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(l=typeof globalThis<"u"?globalThis:l||self,u(l.index={},l.vue))})(this,function(l,u){"use strict";const g=(n,e)=>{if(n.install=o=>{for(const s of[n,...Object.values(e??{})])o.component(s.name,s)},e)for(const[o,s]of Object.entries(e))n[o]=s;return n};function _(n,e,o,s){function r(t){return t instanceof o?t:new o(function(c){c(t)})}return new(o||(o=Promise))(function(t,c){function d(a){try{i(s.next(a))}catch(p){c(p)}}function f(a){try{i(s.throw(a))}catch(p){c(p)}}function i(a){a.done?t(a.value):r(a.value).then(d,f)}i((s=s.apply(n,e||[])).next())})}function y(n,e){var o={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},s,r,t,c;return c={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function d(i){return function(a){return f([i,a])}}function f(i){if(s)throw new TypeError("Generator is already executing.");for(;c&&(c=0,i[0]&&(o=0)),o;)try{if(s=1,r&&(t=i[0]&2?r.return:i[0]?r.throw||((t=r.return)&&t.call(r),0):r.next)&&!(t=t.call(r,i[1])).done)return t;switch(r=0,t&&(i=[i[0]&2,t.value]),i[0]){case 0:case 1:t=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(t=o.trys,!(t=t.length>0&&t[t.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!t||i[1]>t[0]&&i[1]<t[3])){o.label=i[1];break}if(i[0]===6&&o.label<t[1]){o.label=t[1],t=i;break}if(t&&o.label<t[2]){o.label=t[2],o.ops.push(i);break}t[2]&&o.ops.pop(),o.trys.pop();continue}i=e.call(n,o)}catch(a){i=[6,a],r=0}finally{s=t=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var w=function(n,e){return _(void 0,void 0,void 0,function(){return y(this,function(o){return[2,new Promise(function(s,r){try{if(window.DocsAPI)return s(null);var t=document.getElementById(e);if(t)var c=setInterval(function(){var f=t.getAttribute("loading");if(!f){if(clearInterval(c),window.DocsAPI)return s(null);var i=v(e,n,s,r);t.remove(),document.body.appendChild(i)}},500);else{var d=v(e,n,s,r);document.body.appendChild(d)}}catch(f){console.error(f)}})]})})},v=function(n,e,o,s){var r=document.createElement("script");return r.id=n,r.type="text/javascript",r.src=e,r.async=!0,r.onload=function(){r.removeAttribute("loading"),o(null)},r.onerror=function(t){r.removeAttribute("loading"),s(t)},r.setAttribute("loading",""),r},h=u.defineComponent({name:"DocumentEditor",props:{id:{type:String,required:!0},documentServerUrl:{type:String,required:!0},config:{type:Object,required:!0},document_fileType:String,document_title:String,documentType:String,editorConfig_lang:String,height:String,type:String,width:String,onLoadComponentError:Function,events_onAppReady:Function,events_onDocumentStateChange:Function,events_onMetaChange:Function,events_onDocumentReady:Function,events_onInfo:Function,events_onWarning:Function,events_onError:Function,events_onRequestSharingSettings:Function,events_onRequestRename:Function,events_onMakeActionLink:Function,events_onRequestInsertImage:Function,events_onRequestSaveAs:Function,events_onRequestMailMergeRecipients:Function,events_onRequestCompareFile:Function,events_onRequestEditRights:Function,events_onRequestHistory:Function,events_onRequestHistoryClose:Function,events_onRequestHistoryData:Function,events_onRequestRestore:Function,events_onRequestSelectSpreadsheet:Function,events_onRequestSelectDocument:Function},mounted:function(){var n=this,e=this.documentServerUrl;e.endsWith("/")||(e+="/");var o="".concat(e,"web-apps/apps/api/documents/api.js");w(o,"onlyoffice-api-script").then(function(){return n.onLoad()}).catch(function(){n.onError(-2)})},unmounted:function(){var n,e=this.id||"";!((n=window==null?void 0:window.DocEditor)===null||n===void 0)&&n.instances[e]&&(window.DocEditor.instances[e].destroyEditor(),window.DocEditor.instances[e]=void 0)},watch:{config:{handler:function(n,e){this.onChangeProps()},deep:!0},document_fileType:function(n,e){this.onChangeProps()},document_title:function(n,e){this.onChangeProps()},documentType:function(n,e){this.onChangeProps()},editorConfig_lang:function(n,e){this.onChangeProps()},height:function(n,e){this.onChangeProps()},type:function(n,e){this.onChangeProps()},width:function(n,e){this.onChangeProps()}},methods:{onLoad:function(){var n,e;try{var o=this.id||"";if(window.DocsAPI||this.onError(-3),!((n=window==null?void 0:window.DocEditor)===null||n===void 0)&&n.instances[o]){console.log("Skip loading. Instance already exists",o);return}!((e=window==null?void 0:window.DocEditor)===null||e===void 0)&&e.instances||(window.DocEditor={instances:{}});var s=Object.assign({document:{fileType:this.document_fileType,title:this.document_title},documentType:this.documentType,editorConfig:{lang:this.editorConfig_lang},events:{onAppReady:this.onAppReady,onDocumentStateChange:this.events_onDocumentStateChange,onMetaChange:this.events_onMetaChange,onDocumentReady:this.events_onDocumentReady,onInfo:this.events_onInfo,onWarning:this.events_onWarning,onError:this.events_onError,onRequestSharingSettings:this.events_onRequestSharingSettings,onRequestRename:this.events_onRequestRename,onMakeActionLink:this.events_onMakeActionLink,onRequestInsertImage:this.events_onRequestInsertImage,onRequestSaveAs:this.events_onRequestSaveAs,onRequestMailMergeRecipients:this.events_onRequestMailMergeRecipients,onRequestCompareFile:this.events_onRequestCompareFile,onRequestEditRights:this.events_onRequestEditRights,onRequestHistory:this.events_onRequestHistory,onRequestHistoryClose:this.events_onRequestHistoryClose,onRequestHistoryData:this.events_onRequestHistoryData,onRequestRestore:this.events_onRequestRestore,onRequestSelectSpreadsheet:this.events_onRequestSelectSpreadsheet,onRequestSelectDocument:this.events_onRequestSelectDocument},height:this.height,type:this.type,width:this.width},this.config||{}),r=window.DocsAPI.DocEditor(o,s);window.DocEditor.instances[o]=r}catch(t){console.error(t),this.onError(-1)}},onError:function(n){var e;switch(n){case-2:e="Error load DocsAPI from "+this.documentServerUrl;break;case-3:e="DocsAPI is not defined";break;default:e="Unknown error loading component",n=-1}typeof this.onLoadComponentError>"u"?console.error(e):this.onLoadComponentError(n,e)},onAppReady:function(){var n=this.id||"";this.events_onAppReady(window.DocEditor.instances[n])},onChangeProps:function(){var n,e=this.id||"";!((n=window==null?void 0:window.DocEditor)===null||n===void 0)&&n.instances[e]&&(window.DocEditor.instances[e].destroyEditor(),window.DocEditor.instances[e]=void 0,console.log("Important props have been changed. Load new Editor."),this.onLoad())}}});const R=["id"];function S(n,e,o,s,r,t){return u.openBlock(),u.createElementBlock("div",{id:n.id},null,8,R)}h.render=S,h.__file="src/components/DocumentEditor.vue";const q=u.defineComponent({__name:"IkOnlyOffice",props:{documentServerUrl:{type:String,default:""},mode:{type:String,default:""},configOptions:{type:Object,default:()=>{}},officeHeight:{type:String,default:"100%"},token:{type:String,default:""}},setup(n){var r,t,c,d;const e=n,o=u.ref({width:"100%",height:"100%",document:(r=e.configOptions)==null?void 0:r.document,documentType:(t=e.configOptions)==null?void 0:t.documentType,editorConfig:{callbackUrl:(d=(c=e.configOptions)==null?void 0:c.editorConfig)==null?void 0:d.callbackUrl,lang:"zh-CN",mode:e.mode,customization:{forcesave:!0,autosave:!0}},permissions:{comment:!0,commentGroups:{edit:["Group1"],remove:["Group1"],view:""},copy:!0,deleteCommentAuthorOnly:!0,download:!0,edit:!0,editCommentAuthorOnly:!0,fillForms:!0,modifyContentControl:!0,modifyFilter:!0,print:!0,review:!0,reviewGroups:["Group1","Group2","Group3"],userInfoGroups:["Group1"]},mode:e.mode,token:e.token}),s=()=>{console.info("文档加载完成")};return(f,i)=>(u.openBlock(),u.createElementBlock("div",{style:u.normalizeStyle({height:e.officeHeight})},[u.createVNode(u.unref(h),{id:`${new Date().getTime()}`,ref:"editorRef","document-server-url":n.documentServerUrl,config:o.value,events_onDocumentReady:s},null,8,["id","document-server-url","config"])],4))}}),E="",m=g(((n,e)=>{const o=n.__vccOpts||n;for(const[s,r]of e)o[s]=r;return o})(q,[["__scopeId","data-v-ea0a8f6d"]]));l.IkOnlyOffice=m,l.default=m,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(d,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(d=typeof globalThis<"u"?globalThis:d||self,c(d.index={},d.vue))})(this,function(d,c){"use strict";const g=(e,n)=>{if(e.install=t=>{for(const r of[e,...Object.values(n??{})])t.component(r.name,r)},n)for(const[t,r]of Object.entries(n))e[t]=r;return e};function m(e,n,t,r){function s(o){return o instanceof t?o:new t(function(a){a(o)})}return new(t||(t=Promise))(function(o,a){function l(u){try{i(r.next(u))}catch(v){a(v)}}function f(u){try{i(r.throw(u))}catch(v){a(v)}}function i(u){u.done?o(u.value):s(u.value).then(l,f)}i((r=r.apply(e,n||[])).next())})}function w(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(u){return f([i,u])}}function f(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(t=0)),t;)try{if(r=1,s&&(o=i[0]&2?s.return:i[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,i[1])).done)return o;switch(s=0,o&&(i=[i[0]&2,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return t.label++,{value:i[1],done:!1};case 5:t.label++,s=i[1],i=[0];continue;case 7:i=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){t=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){t.label=i[1];break}if(i[0]===6&&t.label<o[1]){t.label=o[1],o=i;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(i);break}o[2]&&t.ops.pop(),t.trys.pop();continue}i=n.call(e,t)}catch(u){i=[6,u],s=0}finally{r=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var y=function(e,n){return m(void 0,void 0,void 0,function(){return w(this,function(t){return[2,new Promise(function(r,s){try{if(window.DocsAPI)return r(null);var o=document.getElementById(n);if(o)var a=setInterval(function(){var f=o.getAttribute("loading");if(!f){if(clearInterval(a),window.DocsAPI)return r(null);var i=p(n,e,r,s);o.remove(),document.body.appendChild(i)}},500);else{var l=p(n,e,r,s);document.body.appendChild(l)}}catch(f){console.error(f)}})]})})},p=function(e,n,t,r){var s=document.createElement("script");return s.id=e,s.type="text/javascript",s.src=n,s.async=!0,s.onload=function(){s.removeAttribute("loading"),t(null)},s.onerror=function(o){s.removeAttribute("loading"),r(o)},s.setAttribute("loading",""),s},h=c.defineComponent({name:"DocumentEditor",props:{id:{type:String,required:!0},documentServerUrl:{type:String,required:!0},config:{type:Object,required:!0},document_fileType:String,document_title:String,documentType:String,editorConfig_lang:String,height:String,type:String,width:String,onLoadComponentError:Function,events_onAppReady:Function,events_onDocumentStateChange:Function,events_onMetaChange:Function,events_onDocumentReady:Function,events_onInfo:Function,events_onWarning:Function,events_onError:Function,events_onRequestSharingSettings:Function,events_onRequestRename:Function,events_onMakeActionLink:Function,events_onRequestInsertImage:Function,events_onRequestSaveAs:Function,events_onRequestMailMergeRecipients:Function,events_onRequestCompareFile:Function,events_onRequestEditRights:Function,events_onRequestHistory:Function,events_onRequestHistoryClose:Function,events_onRequestHistoryData:Function,events_onRequestRestore:Function,events_onRequestSelectSpreadsheet:Function,events_onRequestSelectDocument:Function},mounted:function(){var e=this,n=this.documentServerUrl;n.endsWith("/")||(n+="/");var t="".concat(n,"web-apps/apps/api/documents/api.js");y(t,"onlyoffice-api-script").then(function(){return e.onLoad()}).catch(function(){e.onError(-2)})},unmounted:function(){var e,n=this.id||"";!((e=window==null?void 0:window.DocEditor)===null||e===void 0)&&e.instances[n]&&(window.DocEditor.instances[n].destroyEditor(),window.DocEditor.instances[n]=void 0)},watch:{config:{handler:function(e,n){this.onChangeProps()},deep:!0},document_fileType:function(e,n){this.onChangeProps()},document_title:function(e,n){this.onChangeProps()},documentType:function(e,n){this.onChangeProps()},editorConfig_lang:function(e,n){this.onChangeProps()},height:function(e,n){this.onChangeProps()},type:function(e,n){this.onChangeProps()},width:function(e,n){this.onChangeProps()}},methods:{onLoad:function(){var e,n;try{var t=this.id||"";if(window.DocsAPI||this.onError(-3),!((e=window==null?void 0:window.DocEditor)===null||e===void 0)&&e.instances[t]){console.log("Skip loading. Instance already exists",t);return}!((n=window==null?void 0:window.DocEditor)===null||n===void 0)&&n.instances||(window.DocEditor={instances:{}});var r=Object.assign({document:{fileType:this.document_fileType,title:this.document_title},documentType:this.documentType,editorConfig:{lang:this.editorConfig_lang},events:{onAppReady:this.onAppReady,onDocumentStateChange:this.events_onDocumentStateChange,onMetaChange:this.events_onMetaChange,onDocumentReady:this.events_onDocumentReady,onInfo:this.events_onInfo,onWarning:this.events_onWarning,onError:this.events_onError,onRequestSharingSettings:this.events_onRequestSharingSettings,onRequestRename:this.events_onRequestRename,onMakeActionLink:this.events_onMakeActionLink,onRequestInsertImage:this.events_onRequestInsertImage,onRequestSaveAs:this.events_onRequestSaveAs,onRequestMailMergeRecipients:this.events_onRequestMailMergeRecipients,onRequestCompareFile:this.events_onRequestCompareFile,onRequestEditRights:this.events_onRequestEditRights,onRequestHistory:this.events_onRequestHistory,onRequestHistoryClose:this.events_onRequestHistoryClose,onRequestHistoryData:this.events_onRequestHistoryData,onRequestRestore:this.events_onRequestRestore,onRequestSelectSpreadsheet:this.events_onRequestSelectSpreadsheet,onRequestSelectDocument:this.events_onRequestSelectDocument},height:this.height,type:this.type,width:this.width},this.config||{}),s=window.DocsAPI.DocEditor(t,r);window.DocEditor.instances[t]=s}catch(o){console.error(o),this.onError(-1)}},onError:function(e){var n;switch(e){case-2:n="Error load DocsAPI from "+this.documentServerUrl;break;case-3:n="DocsAPI is not defined";break;default:n="Unknown error loading component",e=-1}typeof this.onLoadComponentError>"u"?console.error(n):this.onLoadComponentError(e,n)},onAppReady:function(){var e=this.id||"";this.events_onAppReady(window.DocEditor.instances[e])},onChangeProps:function(){var e,n=this.id||"";!((e=window==null?void 0:window.DocEditor)===null||e===void 0)&&e.instances[n]&&(window.DocEditor.instances[n].destroyEditor(),window.DocEditor.instances[n]=void 0,console.log("Important props have been changed. Load new Editor."),this.onLoad())}}});const R=["id"];function S(e,n,t,r,s,o){return c.openBlock(),c.createElementBlock("div",{id:e.id},null,8,R)}h.render=S,h.__file="src/components/DocumentEditor.vue";const q=c.defineComponent({__name:"IkOnlyOffice",props:{documentServerUrl:{type:String,default:""},configOptions:{type:Object,default:()=>{}},officeHeight:{type:String,default:"100%"}},setup(e){const n=e,t=c.ref({width:"100%",height:"100%",...n.configOptions||{}}),r=()=>{console.info("文档加载完成",n.configOptions)};return(s,o)=>(c.openBlock(),c.createElementBlock("div",{style:c.normalizeStyle({height:n.officeHeight})},[c.createVNode(c.unref(h),{id:`${new Date().getTime()}`,ref:"editorRef","document-server-url":e.documentServerUrl,config:t.value,events_onDocumentReady:r},null,8,["id","document-server-url","config"])],4))}}),E="",_=g(((e,n)=>{const t=e.__vccOpts||e;for(const[r,s]of n)t[r]=s;return t})(q,[["__scopeId","data-v-fe959cd8"]]));d.IkOnlyOffice=_,d.default=_,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});