2 lines
114 KiB
JavaScript
2 lines
114 KiB
JavaScript
|
webpackJsonp([1],{0:function(e,t,n){n("+prg"),e.exports=n("lVK7")},1:function(e,t){},2:function(e,t){},"3lb1":function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var o=n("GiK3"),s=n.n(o),l=n("nCbI"),c=n("F8kA"),h=n("thjQ"),u=n.n(h),d=n("ydjI"),f=n("r/a0"),p=(n.n(f),n("V5xO")),m=n("HACt"),b=n("mihT"),g=n("mjy5"),_=n("eDYK"),y=n("DlSv"),w=n("JI0G"),v=n("VyOR"),E=function(e){return u()("Enter the new file name",{content:{element:"input",attributes:{placeholder:e}}})},x=function(e){if(p.a.isDirty()){var t="Recent changes have not been saved";return u()(t,{timer:1e3}),e.returnValue=t}},k=s.a.createElement(c.d,null,s.a.createElement(c.c,{to:"/"})),C=s.a.createElement(c.d,null,s.a.createElement(c.c,{to:"/"})),S=function(e){function t(n){r(this,t);var a=i(this,e.call(this,n));return a.hfoe=a.handleFileOrEntry.bind(a),a.flipViz=a.flip_viz.bind(a),a.force=a.force.bind(a),a.state={viz:!0},a}return a(t,e),t.prototype.componentDidMount=function(){window.removeEventListener("beforeunload",x),window.addEventListener("beforeunload",x,!0)},t.prototype.flip_viz=function(){this.setState({viz:!this.state.viz}),this.forceUpdate()},t.prototype.force=function(){this.toolbar&&this.toolbar.force()},t.prototype.erase=function(){if(!p.a.isDirty())return p.a.reset();u()("Are you sure you want to close "+p.a.fname+"?",{buttons:["No","Yes"]}).then(function(e){e&&p.a.reset()})},t.prototype.renameFile=function(){E(p.a.fname).then(function(e){e&&p.a.setName(e)})},t.prototype.handleFile=function(e){return e instanceof File?this.handleOneFile(e):u()("Please drop only one file")},t.prototype.handleOneFile=function(e){var t=function(){var t=new FileReader;t.onload=function(t){var n=t.target.result;try{p.a.setBStr(n,function(e){u()("Error:"+(e.message||e))}),p.a.setName(e.name)}catch(t){u()("Error:"+(t.message||t))}},t.readAsBinaryString(e)},n=[];if(e.size>v.a&&n.push("File size "+e.size+" exceeds limit."),n.length>0){n.push("Operations may be slow. Shall we proceed?");var r=document.createElement("div");r.innerHTML=n.join("<br/>\n"),u()({content:r,buttons:["No","Yes"]}).then(function(e){e&&t()})}else t()},t.prototype.handleEntry=function(e,t){!function(e,t,n){var r=new FileReader;if(r.onload=function(e){var n=e.target.result;t(null,n)},n&&n.size>0&&e.size>n.size)return t(new Error("File size "+e.size+" exceeds limit"),null);r.readAsArrayBuffer(e)}(t,function(t,n){if(t)return u()("Error: "+t.message);p.a.setContentAB(e,n)},{size:v.a})},t.prototype.handleFileOrEntry=function(e){var t=this;if(p.a.isEmpty())return this.handleFile(e);if(!(e instanceof File))return u()("Please drop only one file");var n=this.props.match&&null!=this.props.match.params.idx?this.props.match.params.idx:-1,r={buttons:{open:"Open",add:"Add File"}},i=p.a.getFixedName(n);n>-1&&(r.buttons.update="Update contents"),u()(p.a.fname+" "+(i&&"("+i+")")+" is open. What do you want to do with "+e.name+"?",r).then(function(r){switch(r){case"open":if(!p.a.isDirty())return p.a.reset(),t.handleFile(e);u()("There are unsaved changes. Are you sure you want to close "+p.a.fname+"?",{buttons:["No","Yes"]}).then(function(n){n&&(p.a.reset(),t.handleFile(e))});break;case"add":var i="";p.a.find(e.name)?(i=p.a.addNewFile(),u()("File "+e.name+" exists! New file: "+i)):i=p.a.addNewFile(e.name);var a=p.a.getIdByName(i);t.handleEntry(a,e);break;case"update":t.handleEntry(n,e)}})},t.prototype.newEntry=function(){var e=p.a.addNewFile();u()("New File: "+e)},t.prototype.exportFile=function(){p.a.exportBStr(p.a.fname||"SheetJS.cfb")},t.prototype.deleteEntry=function(e){u()("A
|
||
|
//# sourceMappingURL=app.8297993e.js.map
|