@nocobase/plugin-file-previewer-office 2.1.0-alpha.45 → 2.1.0-alpha.46
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.
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/plugin-file-manager/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-previewer-office",["react","antd","@nocobase/client","@nocobase/plugin-file-manager/client"],t):"object"==typeof exports?exports["@nocobase/plugin-file-previewer-office"]=t(require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/plugin-file-manager/client")):e["@nocobase/plugin-file-previewer-office"]=t(e.react,e.antd,e["@nocobase/client"],e["@nocobase/plugin-file-manager/client"])}(self,function(e,t,n,o){return function(){var r={574:function(e,t,n){var o,r;void 0===(r="function"==typeof(o=function(){"use strict";function t(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){c(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function o(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,a=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(e,n,a){var c=i.URL||i.webkitURL,l=document.createElement("a");l.download=n=n||e.name||"download",l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?r(l):o(l.href)?t(e,n,a):r(l,l.target="_blank")):(l.href=c.createObjectURL(e),setTimeout(function(){c.revokeObjectURL(l.href)},4e4),setTimeout(function(){r(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,i){if(n=n||e.name||"download","string"!=typeof e){var a;navigator.msSaveOrOpenBlob((void 0===(a=i)?a={autoBom:!1}:"object"!=typeof a&&(console.warn("Deprecated: Expected third argument to be a object"),a={autoBom:!a}),a.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),n)}else if(o(e))t(e,n,i);else{var c=document.createElement("a");c.href=e,c.target="_blank",setTimeout(function(){r(c)})}}:function(e,n,o,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,o);var c="application/octet-stream"===e.type,l=/constructor/i.test(i.HTMLElement)||i.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||c&&l||a)&&"u">typeof FileReader){var s=new FileReader;s.onloadend=function(){var e=s.result;e=u?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},s.readAsDataURL(e)}else{var p=i.URL||i.webkitURL,f=p.createObjectURL(e);r?r.location=f:location.href=f,r=null,setTimeout(function(){p.revokeObjectURL(f)},4e4)}});i.saveAs=c.saveAs=c,e.exports=c})?o.apply(t,[]):o)||(e.exports=r)},342:function(e){"use strict";e.exports=n},609:function(e){"use strict";e.exports=o},59:function(e){"use strict";e.exports=t},155:function(t){"use strict";t.exports=e}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e].call(n.exports,n,n.exports,a),n.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(c=a.g.location+"");var c,l=a.g.document;if(!c&&l&&(l.currentScript&&"SCRIPT"===l.currentScript.tagName.toUpperCase()&&(c=l.currentScript.src),!c)){var u=l.getElementsByTagName("script");if(u.length)for(var s=u.length-1;s>-1&&(!c||!/^http(s?):/.test(c));)c=u[s--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");a.p=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var p={};return!function(){"use strict";var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-file-previewer-office/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var o=window.location.pathname||"/",r=o.indexOf("/v2/");e=r>=0?o.slice(0,r+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-file-previewer-office/dist/client/"}a.p=e}(),!function(){"use strict";a.r(p),a.d(p,{default:function(){return S},PluginFilePreviewerOfficeClient:function(){return j}});var e=a(155),t=a.n(e),n=a(59),o=a(574),r=a(342),i=a(609),c=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","application/vnd.oasis.opendocument.text"],l=["docx","xlsx","pptx","odt","doc","xls","ppt"],u=function(e){var t=("string"==typeof e?e:(null==e?void 0:e.extname)||(null==e?void 0:e.name)||(null==e?void 0:e.filename)||(null==e?void 0:e.url)||"").split("?")[0].split("#")[0],n=t.lastIndexOf(".");return -1!==n?t.slice(n+1).toLowerCase():""},s=function(e){var t="string"==typeof e?e:null==e?void 0:e.url;return t?t.startsWith("https://")||t.startsWith("http://")?t:"".concat(location.origin,"/").concat(t.replace(/^\//,"")):""},f=function(e){var t=s(e);if(!t)return"";var n=new URL("https://view.officeapps.live.com/op/embed.aspx");return n.searchParams.set("src",t),n.href},d=function(e){if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&e.mimetype&&c.includes(e.mimetype))return!0;var t=u(e);return!!t&&l.includes(t)},v=function(n){var o=n.file,r="string"==typeof o?o:null==o?void 0:o.url,i=(0,e.useMemo)(function(){return f(r)},[r]);return i?t().createElement("iframe",{src:i,width:"100%",height:"100%",style:{border:"none"}}):null},b=JSON.parse('{"UU":"@nocobase/plugin-file-previewer-office"}');function m(e,t,n,o,r,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(o,r)}function y(e,t,n){return(y=x()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&h(r,n.prototype),r}).apply(null,arguments)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t="function"==typeof Map?new Map:void 0;return(g=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return y(e,arguments,w(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)})(e)}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function O(i){var a,c=i.index,l=i.list,u=i.onSwitchIndex,s=(a=(0,r.useApp)(),function(e){return a.i18n.t(e,{ns:[b.UU,"client"]})}),p=l[c],d=(0,e.useMemo)(function(){return f(p)},[p]),v=(0,e.useCallback)(function(e){e.preventDefault(),e.stopPropagation(),window.open(d)},[d]),m=(0,e.useCallback)(function(e){e.preventDefault(),e.stopPropagation(),(0,o.saveAs)(p.url,"".concat(p.title).concat(p.extname))},[p.extname,p.title,p.url]),y=(0,e.useCallback)(function(){u(null)},[u]);return t().createElement(n.Modal,{open:null!=c,title:p.title,onCancel:y,footer:[t().createElement(n.Button,{key:"open",onClick:v},s("Open in new window")),t().createElement(n.Button,{key:"download",onClick:m},s("Download")),t().createElement(n.Button,{key:"close",onClick:y},s("Close"))],width:"85vw",centered:!0},t().createElement("div",{style:{width:"100%",height:"calc(85vh - 120px)",background:"white",display:"flex",flexDirection:"column"}},t().createElement("iframe",{src:d,style:{width:"100%",height:"100%",flex:"1 1 auto",border:"none"}})))}var j=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=w(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,x()?Reflect.construct(e,t||[],w(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&h(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,o,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,o=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){i.label=u[1];break}if(6===u[0]&&i.label<r[1]){i.label=r[1],r=u;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(u);break}r[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return r.attachmentFileTypes.add({match:d,Previewer:O}),i.filePreviewTypes.add({match:d,Previewer:(0,i.wrapWithModalPreviewer)(v)}),[2]})},function(){var t=this,n=arguments;return new Promise(function(o,r){var i=e.apply(t,n);function a(e){m(i,o,r,a,c,"next",e)}function c(e){m(i,o,r,a,c,"throw",e)}a(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,t),n}(g(r.Plugin)),S=j}(),p}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/plugin-file-manager/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-previewer-office",["react","antd","@nocobase/client","@nocobase/plugin-file-manager/client"],t):"object"==typeof exports?exports["@nocobase/plugin-file-previewer-office"]=t(require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/plugin-file-manager/client")):e["@nocobase/plugin-file-previewer-office"]=t(e.react,e.antd,e["@nocobase/client"],e["@nocobase/plugin-file-manager/client"])}(self,function(e,t,n,o){return function(){var r={574:function(e,t,n){var o,r;void 0===(r="function"==typeof(o=function(){"use strict";function t(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){c(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function o(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,a=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(e,n,a){var c=i.URL||i.webkitURL,l=document.createElement("a");l.download=n=n||e.name||"download",l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?r(l):o(l.href)?t(e,n,a):r(l,l.target="_blank")):(l.href=c.createObjectURL(e),setTimeout(function(){c.revokeObjectURL(l.href)},4e4),setTimeout(function(){r(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,i){if(n=n||e.name||"download","string"!=typeof e){var a;navigator.msSaveOrOpenBlob((void 0===(a=i)?a={autoBom:!1}:"object"!=typeof a&&(console.warn("Deprecated: Expected third argument to be a object"),a={autoBom:!a}),a.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),n)}else if(o(e))t(e,n,i);else{var c=document.createElement("a");c.href=e,c.target="_blank",setTimeout(function(){r(c)})}}:function(e,n,o,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,o);var c="application/octet-stream"===e.type,l=/constructor/i.test(i.HTMLElement)||i.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||c&&l||a)&&"u">typeof FileReader){var s=new FileReader;s.onloadend=function(){var e=s.result;e=u?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},s.readAsDataURL(e)}else{var p=i.URL||i.webkitURL,f=p.createObjectURL(e);r?r.location=f:location.href=f,r=null,setTimeout(function(){p.revokeObjectURL(f)},4e4)}});i.saveAs=c.saveAs=c,e.exports=c})?o.apply(t,[]):o)||(e.exports=r)},342:function(e){"use strict";e.exports=n},609:function(e){"use strict";e.exports=o},59:function(e){"use strict";e.exports=t},155:function(t){"use strict";t.exports=e}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e].call(n.exports,n,n.exports,a),n.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(c=a.g.location+"");var c,l=a.g.document;if(!c&&l&&(l.currentScript&&"SCRIPT"===l.currentScript.tagName.toUpperCase()&&(c=l.currentScript.src),!c)){var u=l.getElementsByTagName("script");if(u.length)for(var s=u.length-1;s>-1&&(!c||!/^http(s?):/.test(c));)c=u[s--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");a.p=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var p={};return!function(){"use strict";var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-file-previewer-office/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",r="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",c=i.indexOf(r);e=c>=0?i.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-file-previewer-office/dist/client/"}a.p=e}(),!function(){"use strict";a.r(p),a.d(p,{default:function(){return j},PluginFilePreviewerOfficeClient:function(){return _}});var e=a(155),t=a.n(e),n=a(59),o=a(574),r=a(342),i=a(609),c=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","application/vnd.oasis.opendocument.text"],l=["docx","xlsx","pptx","odt","doc","xls","ppt"],u=function(e){var t=("string"==typeof e?e:(null==e?void 0:e.extname)||(null==e?void 0:e.name)||(null==e?void 0:e.filename)||(null==e?void 0:e.url)||"").split("?")[0].split("#")[0],n=t.lastIndexOf(".");return -1!==n?t.slice(n+1).toLowerCase():""},s=function(e){var t="string"==typeof e?e:null==e?void 0:e.url;return t?t.startsWith("https://")||t.startsWith("http://")?t:"".concat(location.origin,"/").concat(t.replace(/^\//,"")):""},f=function(e){var t=s(e);if(!t)return"";var n=new URL("https://view.officeapps.live.com/op/embed.aspx");return n.searchParams.set("src",t),n.href},d=function(e){if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&e.mimetype&&c.includes(e.mimetype))return!0;var t=u(e);return!!t&&l.includes(t)},v=function(n){var o=n.file,r="string"==typeof o?o:null==o?void 0:o.url,i=(0,e.useMemo)(function(){return f(r)},[r]);return i?t().createElement("iframe",{src:i,width:"100%",height:"100%",style:{border:"none"}}):null},b=JSON.parse('{"UU":"@nocobase/plugin-file-previewer-office"}');function m(e,t,n,o,r,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(o,r)}function y(e,t,n){return(y=x()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&h(r,n.prototype),r}).apply(null,arguments)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t="function"==typeof Map?new Map:void 0;return(g=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return y(e,arguments,w(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)})(e)}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function O(i){var a,c=i.index,l=i.list,u=i.onSwitchIndex,s=(a=(0,r.useApp)(),function(e){return a.i18n.t(e,{ns:[b.UU,"client"]})}),p=l[c],d=(0,e.useMemo)(function(){return f(p)},[p]),v=(0,e.useCallback)(function(e){e.preventDefault(),e.stopPropagation(),window.open(d)},[d]),m=(0,e.useCallback)(function(e){e.preventDefault(),e.stopPropagation(),(0,o.saveAs)(p.url,"".concat(p.title).concat(p.extname))},[p.extname,p.title,p.url]),y=(0,e.useCallback)(function(){u(null)},[u]);return t().createElement(n.Modal,{open:null!=c,title:p.title,onCancel:y,footer:[t().createElement(n.Button,{key:"open",onClick:v},s("Open in new window")),t().createElement(n.Button,{key:"download",onClick:m},s("Download")),t().createElement(n.Button,{key:"close",onClick:y},s("Close"))],width:"85vw",centered:!0},t().createElement("div",{style:{width:"100%",height:"calc(85vh - 120px)",background:"white",display:"flex",flexDirection:"column"}},t().createElement("iframe",{src:d,style:{width:"100%",height:"100%",flex:"1 1 auto",border:"none"}})))}var _=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=w(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,x()?Reflect.construct(e,t||[],w(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&h(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,o,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,o=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){i.label=u[1];break}if(6===u[0]&&i.label<r[1]){i.label=r[1],r=u;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(u);break}r[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return r.attachmentFileTypes.add({match:d,Previewer:O}),i.filePreviewTypes.add({match:d,Previewer:(0,i.wrapWithModalPreviewer)(v)}),[2]})},function(){var t=this,n=arguments;return new Promise(function(o,r){var i=e.apply(t,n);function a(e){m(i,o,r,a,c,"next",e)}function c(e){m(i,o,r,a,c,"throw",e)}a(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,t),n}(g(r.Plugin)),j=_}(),p}()});
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-previewer-office/client-v2",["react","@nocobase/plugin-file-manager/client-v2","@nocobase/client-v2"],t):"object"==typeof exports?exports["@nocobase/plugin-file-previewer-office/client-v2"]=t(require("react"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2")):e["@nocobase/plugin-file-previewer-office/client-v2"]=t(e.react,e["@nocobase/plugin-file-manager/client-v2"],e["@nocobase/client-v2"])}(self,function(e,t,n){return function(){"use strict";var r={485:function(e){e.exports=n},936:function(e){e.exports=t},155:function(t){t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.g.importScripts&&(c=i.g.location+"");var c,
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-previewer-office/client-v2",["react","@nocobase/plugin-file-manager/client-v2","@nocobase/client-v2"],t):"object"==typeof exports?exports["@nocobase/plugin-file-previewer-office/client-v2"]=t(require("react"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2")):e["@nocobase/plugin-file-previewer-office/client-v2"]=t(e.react,e["@nocobase/plugin-file-manager/client-v2"],e["@nocobase/client-v2"])}(self,function(e,t,n){return function(){"use strict";var r={485:function(e){e.exports=n},936:function(e){e.exports=t},155:function(t){t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.g.importScripts&&(c=i.g.location+"");var c,a=i.g.document;if(!c&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(c=a.currentScript.src),!c)){var u=a.getElementsByTagName("script");if(u.length)for(var l=u.length-1;l>-1&&(!c||!/^http(s?):/.test(c));)c=u[l--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");i.p=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var p={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-file-previewer-office/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",a=c.indexOf(o);e=a>=0?c.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-file-previewer-office/dist/client-v2/"}i.p=e}(),!function(){i.r(p),i.d(p,{PluginFilePreviewerOfficeClientV2:function(){return g},default:function(){return w}});var e=i(485),t=i(936),n=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","application/vnd.oasis.opendocument.text"],r=["docx","xlsx","pptx","odt","doc","xls","ppt"],o=function(e){var t=("string"==typeof e?e:(null==e?void 0:e.extname)||(null==e?void 0:e.name)||(null==e?void 0:e.filename)||(null==e?void 0:e.url)||"").split("?")[0].split("#")[0],n=t.lastIndexOf(".");return -1!==n?t.slice(n+1).toLowerCase():""},c=function(e){var t="string"==typeof e?e:null==e?void 0:e.url;return t?t.startsWith("https://")||t.startsWith("http://")?t:"".concat(location.origin,"/").concat(t.replace(/^\//,"")):""},a=function(e){var t=c(e);if(!t)return"";var n=new URL("https://view.officeapps.live.com/op/embed.aspx");return n.searchParams.set("src",t),n.href},u=function(e){if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&e.mimetype&&n.includes(e.mimetype))return!0;var t=o(e);return!!t&&r.includes(t)},l=i(155),f=i.n(l),s=function(e){var t=e.file,n="string"==typeof t?t:null==t?void 0:t.url,r=(0,l.useMemo)(function(){return a(n)},[n]);return r?f().createElement("iframe",{src:r,width:"100%",height:"100%",style:{border:"none"}}):null};function v(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function d(e,t,n){return(d=m()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&y(o,n.prototype),o}).apply(null,arguments)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t="function"==typeof Map?new Map:void 0;return(h=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,b(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)})(e)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}var g=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=b(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,m()?Reflect.construct(e,t||[],b(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&y(r,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return t.filePreviewTypes.add({match:u,Previewer:(0,t.wrapWithModalPreviewer)(s)}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){v(i,r,o,c,a,"next",e)}function a(e){v(i,r,o,c,a,"throw",e)}c(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,n),r}(h(e.Plugin)),w=g}(),p}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"antd": "5.24.2",
|
|
13
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
14
|
-
"@nocobase/plugin-file-manager": "2.1.0-alpha.
|
|
15
|
-
"@nocobase/client-v2": "2.1.0-alpha.
|
|
16
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
17
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
13
|
+
"@nocobase/client": "2.1.0-alpha.46",
|
|
14
|
+
"@nocobase/plugin-file-manager": "2.1.0-alpha.46",
|
|
15
|
+
"@nocobase/client-v2": "2.1.0-alpha.46",
|
|
16
|
+
"@nocobase/flow-engine": "2.1.0-alpha.46",
|
|
17
|
+
"@nocobase/server": "2.1.0-alpha.46"
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "A plugin for previewing office files via Microsoft live preview service.",
|
|
7
7
|
"description.ru-RU": "Плагин для просмотра Office-файлов через Microsoft live preview service.",
|
|
8
8
|
"description.zh-CN": "基于微软在线服务预览 Office 文件的插件。",
|
|
9
|
-
"version": "2.1.0-alpha.
|
|
9
|
+
"version": "2.1.0-alpha.46",
|
|
10
10
|
"main": "dist/server/index.js",
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"@nocobase/client": "2.x",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"Collection fields"
|
|
21
21
|
],
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "42b269944cdd1908d7a848c0af4936fe94c03bb7"
|
|
24
24
|
}
|