@plotdb/sheet 0.4.1 → 0.4.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.
- package/CHANGELOG.md +5 -0
- package/index.js +29 -10
- package/index.min.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -943,20 +943,29 @@
|
|
|
943
943
|
};
|
|
944
944
|
},
|
|
945
945
|
cell: function(opt){
|
|
946
|
-
var x, y, ref$, base;
|
|
946
|
+
var r, x, y, ref$, base;
|
|
947
947
|
opt == null && (opt = {});
|
|
948
|
+
r = opt.roughly;
|
|
948
949
|
if (opt.col != null) {
|
|
949
950
|
if (opt.col < this.frozen.col) {
|
|
950
951
|
x = opt.col;
|
|
951
952
|
} else if (opt.col - this.pos.col < this.frozen.col) {
|
|
952
|
-
|
|
953
|
+
if (r) {
|
|
954
|
+
x = this.frozen.col;
|
|
955
|
+
} else {
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
953
958
|
} else {
|
|
954
959
|
x = opt.col - this.pos.col;
|
|
955
960
|
}
|
|
956
961
|
if (opt.row < this.frozen.row) {
|
|
957
962
|
y = opt.row;
|
|
958
963
|
} else if (opt.row - this.pos.row < this.frozen.row) {
|
|
959
|
-
|
|
964
|
+
if (r) {
|
|
965
|
+
y = this.frozen.row;
|
|
966
|
+
} else {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
960
969
|
} else {
|
|
961
970
|
y = opt.row - this.pos.row;
|
|
962
971
|
}
|
|
@@ -986,7 +995,7 @@
|
|
|
986
995
|
: this._editing = !!v;
|
|
987
996
|
},
|
|
988
997
|
renderSelection: function(sel, o){
|
|
989
|
-
var ref$, sc, ec, sr, er, rbox, c0, c1, c2, c3, c4, b0, b1, b2, b3, b4, x1, y1, x2, y2, w, h, snode, sbox, dom;
|
|
998
|
+
var ref$, sc, ec, sr, er, rbox, c0, c1, c2, c3, c4, b0, b1, b2, b3, b4, x1, y1, colOut, rowOut, x2, y2, w, h, snode, sbox, dom;
|
|
990
999
|
o == null && (o = {});
|
|
991
1000
|
if (!sel) {
|
|
992
1001
|
sel = this.les;
|
|
@@ -1005,19 +1014,23 @@
|
|
|
1005
1014
|
});
|
|
1006
1015
|
c1 = this.cell({
|
|
1007
1016
|
col: sc,
|
|
1008
|
-
row: sr
|
|
1017
|
+
row: sr,
|
|
1018
|
+
roughly: true
|
|
1009
1019
|
});
|
|
1010
1020
|
c2 = this.cell({
|
|
1011
1021
|
col: sc,
|
|
1012
|
-
row: er
|
|
1022
|
+
row: er,
|
|
1023
|
+
roughly: true
|
|
1013
1024
|
});
|
|
1014
1025
|
c3 = this.cell({
|
|
1015
1026
|
col: ec,
|
|
1016
|
-
row: sr
|
|
1027
|
+
row: sr,
|
|
1028
|
+
roughly: true
|
|
1017
1029
|
});
|
|
1018
1030
|
c4 = this.cell({
|
|
1019
1031
|
col: ec,
|
|
1020
|
-
row: er
|
|
1032
|
+
row: er,
|
|
1033
|
+
roughly: true
|
|
1021
1034
|
});
|
|
1022
1035
|
ref$ = [c0, c1, c2, c3, c4].map(function(it){
|
|
1023
1036
|
if (it) {
|
|
@@ -1030,8 +1043,14 @@
|
|
|
1030
1043
|
b0.height = 0;
|
|
1031
1044
|
x1 = (b1 || b2 || b0).x - rbox.x;
|
|
1032
1045
|
y1 = (b1 || b3 || b0).y - rbox.y;
|
|
1033
|
-
|
|
1034
|
-
|
|
1046
|
+
colOut = ec - this.pos.col < this.frozen.col;
|
|
1047
|
+
rowOut = er - this.pos.row < this.frozen.row;
|
|
1048
|
+
x2 = (b3 || b4 || b0).x + (colOut
|
|
1049
|
+
? 0
|
|
1050
|
+
: (b3 || b4 || b0).width) - rbox.x;
|
|
1051
|
+
y2 = (b2 || b4 || b0).y + (rowOut
|
|
1052
|
+
? 0
|
|
1053
|
+
: (b2 || b4 || b0).height) - rbox.y;
|
|
1035
1054
|
w = x2 - x1 + 1;
|
|
1036
1055
|
h = y2 - y1 + 1;
|
|
1037
1056
|
if (ec == null) {
|
package/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){var a,u,r,t;function o(t,e){var i,o={}.hasOwnProperty;for(i in e)o.call(e,i)&&(t[i]=e[i]);return t}a=function(t){return Papa.parse(t).data},u=function(t,e,i){for(var o=t;t&&t!==i;)t=t.parentNode;if(t!==i)return null;if(!e)return t;for(t=o;t&&t!==i&&(!t.matches||t.matches&&!t.matches(e));)t=t.parentNode;return t!==i||i.matches&&i.matches(e)?t:null},r=function(t){for(var e=Math.floor(Math.log(25*(t+1)+1)/Math.log(26))-1,i=t-((Math.pow(26,1+e)-1)/25-1),o="",n=0;n<=e;++n)o="ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(i%26)+o,i=(i-i%26)/26;return o},(t=function(t){var e,i=this;return this.opt=t=null==t?{}:t,this.root="string"==typeof t.root?document.querySelector(t.root):t.root,this.evtHandler={},this._data=t.data||[],this._size={row:(e=o({row:[],col:[]},t.size)).row,col:e.col},this.cls={row:(e=o({row:[],col:[]},t.class)).row,col:e.col},this._editing=null==t.editing||!!t.editing,this.dim={col:(t.dim||(t.dim={})).col||30,row:(t.dim||(t.dim={})).row||30},this.frozen={col:(e=o({col:0,row:0},t.frozen||{})).col,row:e.row},this.idx={col:(e=o({row:!0,col:!0},t.idx||{})).col,row:e.row},this.fixed={col:(e=o({col:0,row:0},t.fixed||{})).col,row:e.row},this.xif={row:[this.idx.row?1:0,0,0],col:[this.idx.col?1:0,0,0]},["row","col"].map(function(t){return i.xif[t][1]=i.xif[t][0]+i.fixed[t],i.xif[t][2]=i.xif[t][1]+i.frozen[t]}),this.fix={row:this.xif.row[2],col:this.xif.col[2]},this.pos={col:0,row:0},this.scrollPos={x:0,y:0},this.sel={cut:{}},this.les={},this.editing={},this.dom=Object.fromEntries(["sheet","inner","caret","range","edit","layout","range-cut"].map(function(t){var e;e=document.createElement("div");return e.classList.add(t),[t,e]})),this.dom.sheet.setAttribute("tabindex",-1),this.dom.textarea=document.createElement("textarea"),this.root.appendChild(this.dom.sheet),["inner","caret","range","edit","layout","range-cut"].map(function(t){return i.dom.sheet.appendChild(i.dom[t])}),this.dom.edit.appendChild(this.dom.textarea),this._init(),this}).prototype=o(Object.create(Object.prototype),{on:function(t,e){var i;return((i=this.evtHandler)[t]||(i[t]=[])).push(e)},fire:function(t){for(var e,i,o,n,r=[],s=[],l=1,h=arguments.length;l<h;++l)s.push(arguments[l]);for(e=s,l=0,o=(i=this.evtHandler[t]||[]).length;l<o;++l)n=i[l],r.push(n.apply(this,e));return r},_init:function(){for(var t,e,i,o,d,f=this,n=0,r=this.dim.row;n<r;++n)for(t=n,e=0,i=this.dim.col;e<i;++e)o=e,this.addCell(o,t);return this.regrid(),this.dom.textarea.addEventListener("mousedown",function(t){return t.stopPropagation()}),(d=this.dom.sheet).addEventListener("mousedown",function(t){var e,i,o;if(f.edited(),e=u(t.target,".cell",d))return(o={row:(i=f.index(e)).row,col:i.col}).col<0||o.row<0?(t.shiftKey&&f.les.start||(f.les.node=f.cell(f.les.start),f.les.start={col:0<(i=o.col)?i:0,row:0<(i=o.row)?i:0}),f.les.end={col:0<=o.col?o.col:void 0,row:0<=o.row?o.row:void 0},void f.renderSelection()):(t.shiftKey&&f.les.start?f.les.end=o:(f.les.start=f.les.end=o,f.les.node=e),f.renderSelection())}),d.addEventListener("mousemove",function(t){var e;if(!f.editing.on&&t.buttons&&(e=u(t.target,".cell",d)))return e={row:(e=f.index(e)).row,col:e.col},f.les.end={col:0<=e.col?e.col:void 0,row:0<=e.row?e.row:void 0},f.renderSelection()}),d.addEventListener("dblclick",function(t){if(t=u(t.target,".cell",d))return f.edit({node:t,quick:!1})}),document.body.addEventListener("paste",function(t){var e,i,o,n,r,s,l,h,c;if(u(document.activeElement,".sheet",d)&&f.les.start&&(n=t.clipboardData.getData("text"),e=a(n),f.set({row:f.les.start.row,col:f.les.start.col,data:e,range:!0}),f.sel.cut)){if(f._toText({sel:f.sel.cut})===n){for(i=(e=f._bound({sel:f.sel.cut})).sc,o=e.ec,n=e.sr,r=e.er,s=n;s<=r;++s)for(l=s,h=i;h<=o;++h)c=h,f.set({row:l,col:c,data:""});navigator.clipboard.writeText("")}return f.sel.cut=null,f.dom["range-cut"].classList.toggle("show",!1)}}),d.addEventListener("keydown",function(t){var e,i,o,n,r,s,l,h,c,d,a,u=t.keyCode;if(67===t.keyCode&&(t.metaKey||t.ctrlKey))return f.copy();if(88===t.keyCode&&(t.metaKey||t.ctrlKey))return f.copy({cut:!0});if(f.eventInScope(t)){if(8===u){if(!f.les.node)return;for(e=f._bound(),i=e.sc,o=e.ec,n=e.sr,r=e.er,l=[],h=n;h<=r;++h){for(c=[],d=i;d<=o;++d)c.push("");l.push(c)}s=l,f.set({row:n,col:i,data:s,range:!0})}return 189===u&&(t.metaKey||t.ctrlKey)?f.les.node?(e=f._bound({defined:!1}),i=e.sc,o=e.ec,n=e.sr,r=e.er,null==o&&(a=f._data.splice(n,r-n+1)),null==r&&(a=f._data.map(function(t){return t.splice(i,o-i+1)})),f.fire("change",{row:n,col:i,data:a,range:!0}),f.les.end=f.les.start,f.renderSelection(),void f.render()):void 0:!(a=function(){switch(u){case 37:return{y:0,x:-1};case 38:return{y:-1,x:0};case 39:return{y:0,x:1};case 40:return{y:1,x:0};default:return null}}())||f.editing.on&&!f.editing.quick?void 0:(f.move(a),t.stopPropagation(),t.preventDefault(),f.dom.sheet.focus())}}),d.addEventListener("keypress",function(t){if(31!==t.keyCode||!t.metaKey&&!t.ctrlKey)return f.les.node&&!f.editing.on?f.edit({node:f.les.node,quick:13!==t.keyCode}):void 0}),this.dom.textarea.addEventListener("keydown",function(t){var e,i,o;return 27===t.keyCode?(f.edited({cancel:!0}),t.stopPropagation(),t.preventDefault(),void f.dom.sheet.focus()):13!==t.keyCode||t.altKey||t.metaKey?13===t.keyCode&&(t.altKey||t.metaKey)?(f.dom.textarea.value+="\n",f.dom.layout.textContent=f.dom.textarea.value+" ",e=f.dom.layout.getBoundingClientRect(),i=f.editing.node.getBoundingClientRect(),(o=f.dom.textarea.style).width=Math.max(e.width,i.width+1)+"px",o.height=Math.max(e.height,i.height+1)+"px",o):void 0:(f.move({y:1,x:0}),t.stopPropagation(),t.preventDefault(),void f.dom.sheet.focus())}),document.addEventListener("wheel",function(t){var e,i,o,n,r=f.eventInScope(t);return(null==f.opt.scrollLock||f.opt.scrollLock)&&Math.abs(t.deltaX)>Math.abs(t.deltaY)&&(!r&&t.target!==document.body||t.preventDefault()),!!r&&(e=f.scrollPos,i=(n=[t.deltaX,t.deltaY])[0],o=n[1],i=(n=Math.abs(i)>Math.abs(o)?[i,0]:[0,o])[0],o=n[1],r=(n=[e.x,e.y])[0],n=n[1],e.x+=i/30,e.y+=o/30,i=Math.round(e.x)-Math.round(r),0<(o=Math.round(e.y)-Math.round(n))?f._md(o):o<0?f._mu(o):0<i?f._mr(i):i<0&&f._ml(i),f.renderSelection(),t.preventDefault())},{passive:!1})},_bound:function(t){var e,i=(r=(n=(r=[(o=(t=null==t?{}:t).sel||this.les).start,o.end])[0]).col<(e=r[1]).col||null==e.col?[n.col,e.col]:[e.col,n.col])[0],o=r[1],n=(r=n.row<e.row||null==e.row?[n.row,e.row]:[e.row,n.row])[0],r=r[1];return null!=t.defined&&!t.defined||(null==o&&(o=Math.max.apply(Math,this._data.map(function(t){return t.length}))),null==r&&(r=this._data.length)),{sc:i,ec:o,sr:n,er:r}},_toText:function(t){var e,i,o,n,r,s,l,h,c,d,t=t.sel;if(!t||!t.start)return"";for(e=[],o=(i=this._bound({sel:t})).sc,n=i.ec,t=i.sr,r=i.er,s=t;s<=r;++s){for(l=s,h=[],c=o;c<=n;++c)d=c,"object"!=typeof(d=null==(d=((i=this._data)[l]||(i[l]=[]))[d])?"":d)&&h.push('"'+(""+d||"").replace(/"/g,'""')+'"');e.push(h.join("\t"))}return e.join("\n")},copy:function(t){var e;if(null==t&&(t={}),this.les.start)return e=this._toText({sel:this.les}),navigator.clipboard.writeText(e),t.cut?(this.sel.cut={start:this.les.start,end:this.les.end},this.renderSelection(this.sel.cut,{cut:!0})):void 0},eventInScope:function(t){return u(t.target,".sheet",this.dom.sheet)===this.dom.sheet},size:function(t){return null==t?this._size:(this._size={row:(t=o({row:[],col:[]},t)).row,col:t.col},this.regrid())},regrid:function(){var e=this;return this.dom.inner.style.gridTemplateColumns="repeat("+this.xif.col[1]+", max-content) "+function(){for(var t=[],e=0,i=this.frozen.col;e<i;++e)t.push(e);return t}.call(this).map(function(t){return e._size.col[t]||"max-content"}).join(" ")+" "+function(){for(var t=[],e=this.xif.col[2],i=this.dim.col;e<i;++e)t.push(e);return t}.call(this).map(function(t){return e._size.col[t+e.pos.col-e.xif.col[1]]||"max-content"}).join(" "),this.dom.inner.style.gridTemplateRows="repeat("+this.xif.row[1]+", max-content) "+function(){for(var t=[],e=0,i=this.frozen.row;e<i;++e)t.push(e);return t}.call(this).map(function(t){return e._size.row[t]||"max-content"}).join(" ")+" "+function(){for(var t=[],e=this.xif.row[2],i=this.dim.row;e<i;++e)t.push(e);return t}.call(this).map(function(t){return e._size.row[t+e.pos.row-e.xif.row[1]]||"max-content"}).join(" ")},addCell:function(t,e){var i=document.createElement("div");return this.dom.inner.insertBefore(i,this.dom.inner.childNodes[e*this.dim.col+t]),this._content({x:t,y:e,n:i})},set:function(t){var e,i,o,n,r,s,l,h,c=t.row,d=t.col,a=t.data,t=t.range;if(t)for(i=0,o=a.length;i<o;++i)for(r=0,s=a[n=i].length;r<s;++r)l=r,((e=this._data)[h=n+c]||(e[h]=[]))[l+d]=a[n][l],this._content({y:n+c-this.pos.row+this.xif.row[1],x:l+d-this.pos.col+this.xif.col[1]});else((e=this._data)[c]||(e[c]=[]))[d]=a,this._content({y:c-this.pos.row+this.xif.row[1],x:d-this.pos.col+this.xif.col[1]});return this.fire("change",{row:c,col:d,data:a,range:!!t})},_content:function(t){var e,i,o=t.x,n=t.y,t=t.n;if(t=t||this.dom.inner.childNodes[o+n*this.dim.col])return e=(i=o<this.xif.col[0]&&n<this.xif.col[0]?["","cell idx"]:o<this.xif.col[0]?[n<this.xif.row[1]?" ":n<this.xif.row[2]?n-this.xif.row[1]+1:n-this.xif.row[1]+this.pos.row+1,"cell idx"]:n<this.xif.row[0]?[o<this.xif.col[1]?" ":o<this.xif.col[2]?r(o-this.xif.col[1]):r(o-this.xif.col[1]+this.pos.col),"cell idx"]:o<this.xif.col[1]||n<this.xif.row[1]?[null,"cell fixed"]:o<this.xif.col[2]&&n<this.xif.row[2]?[((i=this._data)[e=n-this.xif.row[1]]||(i[e]=[]))[o-this.xif.col[1]],"cell frozen fixed"]:o<this.xif.col[2]?[((i=this._data)[e=this.pos.row+n-this.xif.row[1]]||(i[e]=[]))[o-this.xif.col[1]],"cell frozen"]:n<this.xif.row[2]?[((i=this._data)[e=n-this.xif.row[1]]||(i[e]=[]))[this.pos.col+o-this.xif.col[1]],"cell frozen"]:[((i=this._data)[e=this.pos.row+n-this.xif.row[1]]||(i[e]=[]))[this.pos.col+o-this.xif.col[1]],"cell"])[0],i=i[1],null==e&&(e=""),n=o>=this.xif.col[0]&&n>=this.xif.row[0]?(this.cls.col[this.pos.col+o-this.xif.col[1]]||"")+" "+(this.cls.row[this.pos.row+n-this.xif.row[1]]||""):"",t.className=i+" "+n,null!==e?"object"!=typeof e?t.textContent=e:"dom"===e.type?(t.textContent="",t.appendChild(e.node)):void 0:void 0},_md:function(t){var e,i,o,n,r,s,l,h,c;for(null==t&&(t=1),e=this.dom.inner,o=i=0<(i=(t=Math.round(Math.abs(t)))-(this.dim.row-this.fix.row))?i:0;o<t;++o)for(n=o,r=0,s=this.dim.col;r<s&&(l=r,h=this.dim.col*this.fix.row,e.childNodes[h]);++r)e.removeChild(e.childNodes[h]);for(o=i;o<t;++o)for(n=o,r=0,s=this.dim.col;r<s;++r)l=r,c=document.createElement("div"),this._content({x:l,y:this.dim.row+n,n:c}),e.appendChild(c);return this.pos.row+=t},_mu:function(t){var e,i,o,n,r,s,l,h,c,d,a=[];if(null==t&&(t=1),e=this.dom.inner,!(this.pos.row<=0)){for(n=i=0<(o=(t=(t=Math.round(Math.abs(t)))>=this.pos.row?this.pos.row:t)-(this.dim.row-this.xif.row[2]))?o:0;n<t;++n)for(r=n,s=0,l=this.dim.col;s<l&&(h=s,e.childNodes.length);++s)e.removeChild(e.childNodes[e.childNodes.length-1]);for(this.pos.row-=t,n=i;n<t;++n){for(r=n,c=[],s=0,l=this.dim.col;s<l;++s)h=s,d=document.createElement("div"),this._content({x:h,y:r+this.xif.row[2],n:d}),c.push(e.insertBefore(d,e.childNodes[h+(r-i)*this.dim.col+this.dim.col*this.xif.row[2]]));a.push(c)}return a}},_mr:function(t){var e,i,o,n,r,s,l,h;for(null==t&&(t=1),e=this.dom.inner,o=0<(i=(t=Math.round(Math.abs(t)))-(this.dim.col-this.fix.col))?i:0;o<t;++o)for(n=o,r=0,s=this.dim.row;r<s;++r)l=r,e.removeChild(e.childNodes[l*this.dim.col+this.fix.col]),h=document.createElement("div"),this._content({x:this.dim.col+n,y:l,n:h}),e.insertBefore(h,e.childNodes[(l+1)*this.dim.col-1]);return this.pos.col+=t,this.regrid()},_ml:function(t){var e,i,o,n,r,s,l,h,c;if(null==t&&(t=1),e=this.dom.inner,(t=Math.round(Math.abs(t)))>=this.pos.col&&(t=this.pos.col),!(this.pos.col<=0||t<=0)){for(i=0<(o=t-(this.dim.col-this.xif.col[2]))?o:0,this.pos.col-=t,n=i;n<t;++n)for(r=n,s=0,l=this.dim.row;s<l;++s)h=s,e.removeChild(e.childNodes[(h+1)*this.dim.col-1]),c=document.createElement("div"),this._content({x:r+this.xif.col[2],y:h,n:c}),e.insertBefore(c,e.childNodes[h*this.dim.col+this.xif.col[2]+r-i]);return this.regrid()}},goto:function(t){return o(this.pos,t=null==t?{row:0,col:0}:t),this.render()},render:function(){for(var t,e,i,o,n,r=[],s=0,l=this.dim.row;s<l;++s){for(t=s,e=[],i=0,o=this.dim.col;i<o;++i)n=i,e.push(this._content({x:n,y:t}));r.push(e)}return r},move:function(t){var e,i,o,n;if(null==t&&(t={}),this.editing.on&&this.edited(),(t.node=this.les.node)&&(n=this.cell(t))){if(e=this.index(n),i=n.getBoundingClientRect(),o=this.dom.sheet.getBoundingClientRect(),i.x+i.width>o.x+o.width&&this._mr(1),i.y+i.height>o.y+o.height&&this._md(1),0===e.x){if(0===this.pos.col)return;this._ml(1)}if(0===e.y){if(0===this.pos.row)return;this._mu(1)}if(n=this.cell(t))return this.les.node=n,this.les.start=this.les.end={col:(n=this.index(n)).col,row:n.row},this.renderSelection()}},edit:function(t){var e,i,o,n,r,s=t.node,l=t.quick;if(this._editing&&!(!(r=this.index(s))||r.col<0||r.row<0))return(e=this.editing).node=s,e.quick=l,e.on=!0,this.dom.layout.textContent=s.textContent,i=this.dom.layout.getBoundingClientRect(),o=s.getBoundingClientRect(),n=this.dom.sheet.getBoundingClientRect(),t=(e=[this.dom.sheet.scrollLeft,this.dom.sheet.scrollTop])[0],r=e[1],(e=this.dom.edit.style).left=o.x-n.x+t-2+"px",e.top=o.y-n.y+r-2+"px",e.width="fit-content",e.height="fit-content",this.dom.edit.classList.toggle("show",!0),(e=this.dom.textarea.style).width=Math.max(i.width,o.width+1)+"px",e.height=Math.max(i.height,o.height+1)+"px",this.dom.textarea.value=s=!l&&s.textContent||"",this.dom.textarea.focus(),this.dom.textarea.setSelectionRange(s.length,s.length)},edited:function(t){if(null==t&&(t={}),this.editing.on)return t.cancel||this.set({row:this.les.start.row,col:this.les.start.col,data:this.dom.textarea.value||""}),this.dom.edit.classList.toggle("show",!1),(t=this.editing).node=null,t.on=!1,t},index:function(t){var e=Array.from(this.dom.inner.childNodes).indexOf(t);return e<0?null:{x:t=e%this.dim.col,y:e=(e-t)/this.dim.col,col:t<this.xif.col[1]?-1:t<this.xif.col[2]?t-this.xif.col[1]:t-this.xif.col[1]+this.pos.col,row:e<this.xif.row[1]?-1:e<this.xif.row[2]?e-this.xif.row[1]:e-this.xif.row[1]+this.pos.row}},cell:function(t){var e,i,o;if(null!=(t=null==t?{}:t).col){if(t.col<this.frozen.col)e=t.col;else{if(t.col-this.pos.col<this.frozen.col)return null;e=t.col-this.pos.col}if(t.row<this.frozen.row)i=t.row;else{if(t.row-this.pos.row<this.frozen.row)return null;i=t.row-this.pos.row}return i=(o=[e+this.xif.col[1],i+this.xif.row[1]])[1],(e=o[0])<0||i<0||e>=this.dim.col||i>=this.dim.row?null:this.dom.inner.childNodes[i*this.dim.col+e]}if(!(o=t.node?this.index(t.node):{y:0,x:0}))throw new Error("node not found in sheet");return i=o.y+(t.y||0),e=o.x+(t.x||0),this.dom.inner.childNodes[i*this.dim.col+e]},editing:function(t){return null==t?this._editing:this._editing=!!t},renderSelection:function(t,e){var i,o,n,r,s,l,h,c,d,a;if(null==e&&(e={}),(t=t||this.les).start)return r=(i=this._bound({defined:!1,sel:t})).sc,a=i.ec,s=i.sr,d=i.er,o=this.dom.inner.getBoundingClientRect(),c=(i=[this.cell({col:this.pos.col+this.frozen.col,row:this.pos.row+this.frozen.row}),this.cell({col:r,row:s}),this.cell({col:r,row:d}),this.cell({col:a,row:s}),this.cell({col:a,row:d})].map(function(t){return t?t.getBoundingClientRect():null}))[0],l=i[1],n=i[2],h=i[3],r=i[4],c.width=0,c.height=0,s=(l||n||c).x-o.x,l=(l||h||c).y-o.y,h=(h||r||c).x+(h||r||c).width-o.x-s+1,c=(n||r||c).y+(n||r||c).height-o.y-l+1,null==a&&(h=this.root.getBoundingClientRect().width),null==d&&(c=this.root.getBoundingClientRect().height),d=(a=this.cell(t.start))?a.getBoundingClientRect():null,(i=(a=e.cut?this.dom["range-cut"]:this.dom.range).style).left=s+"px",i.top=l+"px",i.width=h+"px",i.height=c+"px",a.classList.toggle("show",!0),e.cut?void 0:(d&&((i=this.dom.caret.style).left=d.x-o.x-1+"px",i.top=d.y-o.y-1+"px",i.width=d.width+2+"px",i.height=d.height+2+"px",i.zIndex=t.start.row+this.xif.row[1]<this.xif.row[2]&&t.start.col+this.xif.col[1]<this.xif.col[2]?101:t.start.row+this.xif.row[1]<this.xif.row[2]||t.start.col+this.xif.col[1]<this.xif.col[2]?20:15),this.dom.caret.classList.toggle("show",!!d))},data:function(t){return null==t?this._data:(this._data=t,this.render())}}),"undefined"!=typeof module&&null!==module?module.exports=t:"undefined"!=typeof window&&null!==window&&(window.sheet=t)}.call(this);
|
|
1
|
+
!function(){var a,u,s,t;function o(t,e){var i,o={}.hasOwnProperty;for(i in e)o.call(e,i)&&(t[i]=e[i]);return t}a=function(t){return Papa.parse(t).data},u=function(t,e,i){for(var o=t;t&&t!==i;)t=t.parentNode;if(t!==i)return null;if(!e)return t;for(t=o;t&&t!==i&&(!t.matches||t.matches&&!t.matches(e));)t=t.parentNode;return t!==i||i.matches&&i.matches(e)?t:null},s=function(t){for(var e=Math.floor(Math.log(25*(t+1)+1)/Math.log(26))-1,i=t-((Math.pow(26,1+e)-1)/25-1),o="",r=0;r<=e;++r)o="ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(i%26)+o,i=(i-i%26)/26;return o},(t=function(t){var e,i=this;return this.opt=t=null==t?{}:t,this.root="string"==typeof t.root?document.querySelector(t.root):t.root,this.evtHandler={},this._data=t.data||[],this._size={row:(e=o({row:[],col:[]},t.size)).row,col:e.col},this.cls={row:(e=o({row:[],col:[]},t.class)).row,col:e.col},this._editing=null==t.editing||!!t.editing,this.dim={col:(t.dim||(t.dim={})).col||30,row:(t.dim||(t.dim={})).row||30},this.frozen={col:(e=o({col:0,row:0},t.frozen||{})).col,row:e.row},this.idx={col:(e=o({row:!0,col:!0},t.idx||{})).col,row:e.row},this.fixed={col:(e=o({col:0,row:0},t.fixed||{})).col,row:e.row},this.xif={row:[this.idx.row?1:0,0,0],col:[this.idx.col?1:0,0,0]},["row","col"].map(function(t){return i.xif[t][1]=i.xif[t][0]+i.fixed[t],i.xif[t][2]=i.xif[t][1]+i.frozen[t]}),this.fix={row:this.xif.row[2],col:this.xif.col[2]},this.pos={col:0,row:0},this.scrollPos={x:0,y:0},this.sel={cut:{}},this.les={},this.editing={},this.dom=Object.fromEntries(["sheet","inner","caret","range","edit","layout","range-cut"].map(function(t){var e;e=document.createElement("div");return e.classList.add(t),[t,e]})),this.dom.sheet.setAttribute("tabindex",-1),this.dom.textarea=document.createElement("textarea"),this.root.appendChild(this.dom.sheet),["inner","caret","range","edit","layout","range-cut"].map(function(t){return i.dom.sheet.appendChild(i.dom[t])}),this.dom.edit.appendChild(this.dom.textarea),this._init(),this}).prototype=o(Object.create(Object.prototype),{on:function(t,e){var i;return((i=this.evtHandler)[t]||(i[t]=[])).push(e)},fire:function(t){for(var e,i,o,r,s=[],n=[],l=1,h=arguments.length;l<h;++l)n.push(arguments[l]);for(e=n,l=0,o=(i=this.evtHandler[t]||[]).length;l<o;++l)r=i[l],s.push(r.apply(this,e));return s},_init:function(){for(var t,e,i,o,d,f=this,r=0,s=this.dim.row;r<s;++r)for(t=r,e=0,i=this.dim.col;e<i;++e)o=e,this.addCell(o,t);return this.regrid(),this.dom.textarea.addEventListener("mousedown",function(t){return t.stopPropagation()}),(d=this.dom.sheet).addEventListener("mousedown",function(t){var e,i,o;if(f.edited(),e=u(t.target,".cell",d))return(o={row:(i=f.index(e)).row,col:i.col}).col<0||o.row<0?(t.shiftKey&&f.les.start||(f.les.node=f.cell(f.les.start),f.les.start={col:0<(i=o.col)?i:0,row:0<(i=o.row)?i:0}),f.les.end={col:0<=o.col?o.col:void 0,row:0<=o.row?o.row:void 0},void f.renderSelection()):(t.shiftKey&&f.les.start?f.les.end=o:(f.les.start=f.les.end=o,f.les.node=e),f.renderSelection())}),d.addEventListener("mousemove",function(t){var e;if(!f.editing.on&&t.buttons&&(e=u(t.target,".cell",d)))return e={row:(e=f.index(e)).row,col:e.col},f.les.end={col:0<=e.col?e.col:void 0,row:0<=e.row?e.row:void 0},f.renderSelection()}),d.addEventListener("dblclick",function(t){if(t=u(t.target,".cell",d))return f.edit({node:t,quick:!1})}),document.body.addEventListener("paste",function(t){var e,i,o,r,s,n,l,h,c;if(u(document.activeElement,".sheet",d)&&f.les.start&&(r=t.clipboardData.getData("text"),e=a(r),f.set({row:f.les.start.row,col:f.les.start.col,data:e,range:!0}),f.sel.cut)){if(f._toText({sel:f.sel.cut})===r){for(i=(e=f._bound({sel:f.sel.cut})).sc,o=e.ec,r=e.sr,s=e.er,n=r;n<=s;++n)for(l=n,h=i;h<=o;++h)c=h,f.set({row:l,col:c,data:""});navigator.clipboard.writeText("")}return f.sel.cut=null,f.dom["range-cut"].classList.toggle("show",!1)}}),d.addEventListener("keydown",function(t){var e,i,o,r,s,n,l,h,c,d,a,u=t.keyCode;if(67===t.keyCode&&(t.metaKey||t.ctrlKey))return f.copy();if(88===t.keyCode&&(t.metaKey||t.ctrlKey))return f.copy({cut:!0});if(f.eventInScope(t)){if(8===u){if(!f.les.node)return;for(e=f._bound(),i=e.sc,o=e.ec,r=e.sr,s=e.er,l=[],h=r;h<=s;++h){for(c=[],d=i;d<=o;++d)c.push("");l.push(c)}n=l,f.set({row:r,col:i,data:n,range:!0})}return 189===u&&(t.metaKey||t.ctrlKey)?f.les.node?(e=f._bound({defined:!1}),i=e.sc,o=e.ec,r=e.sr,s=e.er,null==o&&(a=f._data.splice(r,s-r+1)),null==s&&(a=f._data.map(function(t){return t.splice(i,o-i+1)})),f.fire("change",{row:r,col:i,data:a,range:!0}),f.les.end=f.les.start,f.renderSelection(),void f.render()):void 0:!(a=function(){switch(u){case 37:return{y:0,x:-1};case 38:return{y:-1,x:0};case 39:return{y:0,x:1};case 40:return{y:1,x:0};default:return null}}())||f.editing.on&&!f.editing.quick?void 0:(f.move(a),t.stopPropagation(),t.preventDefault(),f.dom.sheet.focus())}}),d.addEventListener("keypress",function(t){if(31!==t.keyCode||!t.metaKey&&!t.ctrlKey)return f.les.node&&!f.editing.on?f.edit({node:f.les.node,quick:13!==t.keyCode}):void 0}),this.dom.textarea.addEventListener("keydown",function(t){var e,i,o;return 27===t.keyCode?(f.edited({cancel:!0}),t.stopPropagation(),t.preventDefault(),void f.dom.sheet.focus()):13!==t.keyCode||t.altKey||t.metaKey?13===t.keyCode&&(t.altKey||t.metaKey)?(f.dom.textarea.value+="\n",f.dom.layout.textContent=f.dom.textarea.value+" ",e=f.dom.layout.getBoundingClientRect(),i=f.editing.node.getBoundingClientRect(),(o=f.dom.textarea.style).width=Math.max(e.width,i.width+1)+"px",o.height=Math.max(e.height,i.height+1)+"px",o):void 0:(f.move({y:1,x:0}),t.stopPropagation(),t.preventDefault(),void f.dom.sheet.focus())}),document.addEventListener("wheel",function(t){var e,i,o,r,s=f.eventInScope(t);return(null==f.opt.scrollLock||f.opt.scrollLock)&&Math.abs(t.deltaX)>Math.abs(t.deltaY)&&(!s&&t.target!==document.body||t.preventDefault()),!!s&&(e=f.scrollPos,i=(r=[t.deltaX,t.deltaY])[0],o=r[1],i=(r=Math.abs(i)>Math.abs(o)?[i,0]:[0,o])[0],o=r[1],s=(r=[e.x,e.y])[0],r=r[1],e.x+=i/30,e.y+=o/30,i=Math.round(e.x)-Math.round(s),0<(o=Math.round(e.y)-Math.round(r))?f._md(o):o<0?f._mu(o):0<i?f._mr(i):i<0&&f._ml(i),f.renderSelection(),t.preventDefault())},{passive:!1})},_bound:function(t){var e,i=(s=(r=(s=[(o=(t=null==t?{}:t).sel||this.les).start,o.end])[0]).col<(e=s[1]).col||null==e.col?[r.col,e.col]:[e.col,r.col])[0],o=s[1],r=(s=r.row<e.row||null==e.row?[r.row,e.row]:[e.row,r.row])[0],s=s[1];return null!=t.defined&&!t.defined||(null==o&&(o=Math.max.apply(Math,this._data.map(function(t){return t.length}))),null==s&&(s=this._data.length)),{sc:i,ec:o,sr:r,er:s}},_toText:function(t){var e,i,o,r,s,n,l,h,c,d,t=t.sel;if(!t||!t.start)return"";for(e=[],o=(i=this._bound({sel:t})).sc,r=i.ec,t=i.sr,s=i.er,n=t;n<=s;++n){for(l=n,h=[],c=o;c<=r;++c)d=c,"object"!=typeof(d=null==(d=((i=this._data)[l]||(i[l]=[]))[d])?"":d)&&h.push('"'+(""+d||"").replace(/"/g,'""')+'"');e.push(h.join("\t"))}return e.join("\n")},copy:function(t){var e;if(null==t&&(t={}),this.les.start)return e=this._toText({sel:this.les}),navigator.clipboard.writeText(e),t.cut?(this.sel.cut={start:this.les.start,end:this.les.end},this.renderSelection(this.sel.cut,{cut:!0})):void 0},eventInScope:function(t){return u(t.target,".sheet",this.dom.sheet)===this.dom.sheet},size:function(t){return null==t?this._size:(this._size={row:(t=o({row:[],col:[]},t)).row,col:t.col},this.regrid())},regrid:function(){var e=this;return this.dom.inner.style.gridTemplateColumns="repeat("+this.xif.col[1]+", max-content) "+function(){for(var t=[],e=0,i=this.frozen.col;e<i;++e)t.push(e);return t}.call(this).map(function(t){return e._size.col[t]||"max-content"}).join(" ")+" "+function(){for(var t=[],e=this.xif.col[2],i=this.dim.col;e<i;++e)t.push(e);return t}.call(this).map(function(t){return e._size.col[t+e.pos.col-e.xif.col[1]]||"max-content"}).join(" "),this.dom.inner.style.gridTemplateRows="repeat("+this.xif.row[1]+", max-content) "+function(){for(var t=[],e=0,i=this.frozen.row;e<i;++e)t.push(e);return t}.call(this).map(function(t){return e._size.row[t]||"max-content"}).join(" ")+" "+function(){for(var t=[],e=this.xif.row[2],i=this.dim.row;e<i;++e)t.push(e);return t}.call(this).map(function(t){return e._size.row[t+e.pos.row-e.xif.row[1]]||"max-content"}).join(" ")},addCell:function(t,e){var i=document.createElement("div");return this.dom.inner.insertBefore(i,this.dom.inner.childNodes[e*this.dim.col+t]),this._content({x:t,y:e,n:i})},set:function(t){var e,i,o,r,s,n,l,h,c=t.row,d=t.col,a=t.data,t=t.range;if(t)for(i=0,o=a.length;i<o;++i)for(s=0,n=a[r=i].length;s<n;++s)l=s,((e=this._data)[h=r+c]||(e[h]=[]))[l+d]=a[r][l],this._content({y:r+c-this.pos.row+this.xif.row[1],x:l+d-this.pos.col+this.xif.col[1]});else((e=this._data)[c]||(e[c]=[]))[d]=a,this._content({y:c-this.pos.row+this.xif.row[1],x:d-this.pos.col+this.xif.col[1]});return this.fire("change",{row:c,col:d,data:a,range:!!t})},_content:function(t){var e,i,o=t.x,r=t.y,t=t.n;if(t=t||this.dom.inner.childNodes[o+r*this.dim.col])return e=(i=o<this.xif.col[0]&&r<this.xif.col[0]?["","cell idx"]:o<this.xif.col[0]?[r<this.xif.row[1]?" ":r<this.xif.row[2]?r-this.xif.row[1]+1:r-this.xif.row[1]+this.pos.row+1,"cell idx"]:r<this.xif.row[0]?[o<this.xif.col[1]?" ":o<this.xif.col[2]?s(o-this.xif.col[1]):s(o-this.xif.col[1]+this.pos.col),"cell idx"]:o<this.xif.col[1]||r<this.xif.row[1]?[null,"cell fixed"]:o<this.xif.col[2]&&r<this.xif.row[2]?[((i=this._data)[e=r-this.xif.row[1]]||(i[e]=[]))[o-this.xif.col[1]],"cell frozen fixed"]:o<this.xif.col[2]?[((i=this._data)[e=this.pos.row+r-this.xif.row[1]]||(i[e]=[]))[o-this.xif.col[1]],"cell frozen"]:r<this.xif.row[2]?[((i=this._data)[e=r-this.xif.row[1]]||(i[e]=[]))[this.pos.col+o-this.xif.col[1]],"cell frozen"]:[((i=this._data)[e=this.pos.row+r-this.xif.row[1]]||(i[e]=[]))[this.pos.col+o-this.xif.col[1]],"cell"])[0],i=i[1],null==e&&(e=""),r=o>=this.xif.col[0]&&r>=this.xif.row[0]?(this.cls.col[this.pos.col+o-this.xif.col[1]]||"")+" "+(this.cls.row[this.pos.row+r-this.xif.row[1]]||""):"",t.className=i+" "+r,null!==e?"object"!=typeof e?t.textContent=e:"dom"===e.type?(t.textContent="",t.appendChild(e.node)):void 0:void 0},_md:function(t){var e,i,o,r,s,n,l,h,c;for(null==t&&(t=1),e=this.dom.inner,o=i=0<(i=(t=Math.round(Math.abs(t)))-(this.dim.row-this.fix.row))?i:0;o<t;++o)for(r=o,s=0,n=this.dim.col;s<n&&(l=s,h=this.dim.col*this.fix.row,e.childNodes[h]);++s)e.removeChild(e.childNodes[h]);for(o=i;o<t;++o)for(r=o,s=0,n=this.dim.col;s<n;++s)l=s,c=document.createElement("div"),this._content({x:l,y:this.dim.row+r,n:c}),e.appendChild(c);return this.pos.row+=t},_mu:function(t){var e,i,o,r,s,n,l,h,c,d,a=[];if(null==t&&(t=1),e=this.dom.inner,!(this.pos.row<=0)){for(r=i=0<(o=(t=(t=Math.round(Math.abs(t)))>=this.pos.row?this.pos.row:t)-(this.dim.row-this.xif.row[2]))?o:0;r<t;++r)for(s=r,n=0,l=this.dim.col;n<l&&(h=n,e.childNodes.length);++n)e.removeChild(e.childNodes[e.childNodes.length-1]);for(this.pos.row-=t,r=i;r<t;++r){for(s=r,c=[],n=0,l=this.dim.col;n<l;++n)h=n,d=document.createElement("div"),this._content({x:h,y:s+this.xif.row[2],n:d}),c.push(e.insertBefore(d,e.childNodes[h+(s-i)*this.dim.col+this.dim.col*this.xif.row[2]]));a.push(c)}return a}},_mr:function(t){var e,i,o,r,s,n,l,h;for(null==t&&(t=1),e=this.dom.inner,o=0<(i=(t=Math.round(Math.abs(t)))-(this.dim.col-this.fix.col))?i:0;o<t;++o)for(r=o,s=0,n=this.dim.row;s<n;++s)l=s,e.removeChild(e.childNodes[l*this.dim.col+this.fix.col]),h=document.createElement("div"),this._content({x:this.dim.col+r,y:l,n:h}),e.insertBefore(h,e.childNodes[(l+1)*this.dim.col-1]);return this.pos.col+=t,this.regrid()},_ml:function(t){var e,i,o,r,s,n,l,h,c;if(null==t&&(t=1),e=this.dom.inner,(t=Math.round(Math.abs(t)))>=this.pos.col&&(t=this.pos.col),!(this.pos.col<=0||t<=0)){for(i=0<(o=t-(this.dim.col-this.xif.col[2]))?o:0,this.pos.col-=t,r=i;r<t;++r)for(s=r,n=0,l=this.dim.row;n<l;++n)h=n,e.removeChild(e.childNodes[(h+1)*this.dim.col-1]),c=document.createElement("div"),this._content({x:s+this.xif.col[2],y:h,n:c}),e.insertBefore(c,e.childNodes[h*this.dim.col+this.xif.col[2]+s-i]);return this.regrid()}},goto:function(t){return o(this.pos,t=null==t?{row:0,col:0}:t),this.render()},render:function(){for(var t,e,i,o,r,s=[],n=0,l=this.dim.row;n<l;++n){for(t=n,e=[],i=0,o=this.dim.col;i<o;++i)r=i,e.push(this._content({x:r,y:t}));s.push(e)}return s},move:function(t){var e,i,o,r;if(null==t&&(t={}),this.editing.on&&this.edited(),(t.node=this.les.node)&&(r=this.cell(t))){if(e=this.index(r),i=r.getBoundingClientRect(),o=this.dom.sheet.getBoundingClientRect(),i.x+i.width>o.x+o.width&&this._mr(1),i.y+i.height>o.y+o.height&&this._md(1),0===e.x){if(0===this.pos.col)return;this._ml(1)}if(0===e.y){if(0===this.pos.row)return;this._mu(1)}if(r=this.cell(t))return this.les.node=r,this.les.start=this.les.end={col:(r=this.index(r)).col,row:r.row},this.renderSelection()}},edit:function(t){var e,i,o,r,s,n=t.node,l=t.quick;if(this._editing&&!(!(s=this.index(n))||s.col<0||s.row<0))return(e=this.editing).node=n,e.quick=l,e.on=!0,this.dom.layout.textContent=n.textContent,i=this.dom.layout.getBoundingClientRect(),o=n.getBoundingClientRect(),r=this.dom.sheet.getBoundingClientRect(),t=(e=[this.dom.sheet.scrollLeft,this.dom.sheet.scrollTop])[0],s=e[1],(e=this.dom.edit.style).left=o.x-r.x+t-2+"px",e.top=o.y-r.y+s-2+"px",e.width="fit-content",e.height="fit-content",this.dom.edit.classList.toggle("show",!0),(e=this.dom.textarea.style).width=Math.max(i.width,o.width+1)+"px",e.height=Math.max(i.height,o.height+1)+"px",this.dom.textarea.value=n=!l&&n.textContent||"",this.dom.textarea.focus(),this.dom.textarea.setSelectionRange(n.length,n.length)},edited:function(t){if(null==t&&(t={}),this.editing.on)return t.cancel||this.set({row:this.les.start.row,col:this.les.start.col,data:this.dom.textarea.value||""}),this.dom.edit.classList.toggle("show",!1),(t=this.editing).node=null,t.on=!1,t},index:function(t){var e=Array.from(this.dom.inner.childNodes).indexOf(t);return e<0?null:{x:t=e%this.dim.col,y:e=(e-t)/this.dim.col,col:t<this.xif.col[1]?-1:t<this.xif.col[2]?t-this.xif.col[1]:t-this.xif.col[1]+this.pos.col,row:e<this.xif.row[1]?-1:e<this.xif.row[2]?e-this.xif.row[1]:e-this.xif.row[1]+this.pos.row}},cell:function(t){var e,i,o,r=(t=null==t?{}:t).roughly;if(null!=t.col){if(t.col<this.frozen.col)e=t.col;else if(t.col-this.pos.col<this.frozen.col){if(!r)return null;e=this.frozen.col}else e=t.col-this.pos.col;if(t.row<this.frozen.row)i=t.row;else if(t.row-this.pos.row<this.frozen.row){if(!r)return null;i=this.frozen.row}else i=t.row-this.pos.row;return i=(o=[e+this.xif.col[1],i+this.xif.row[1]])[1],(e=o[0])<0||i<0||e>=this.dim.col||i>=this.dim.row?null:this.dom.inner.childNodes[i*this.dim.col+e]}if(!(o=t.node?this.index(t.node):{y:0,x:0}))throw new Error("node not found in sheet");return i=o.y+(t.y||0),e=o.x+(t.x||0),this.dom.inner.childNodes[i*this.dim.col+e]},editing:function(t){return null==t?this._editing:this._editing=!!t},renderSelection:function(t,e){var i,o,r,s,n,l,h,c,d,a,u,f;if(null==e&&(e={}),(t=t||this.les).start)return l=(i=this._bound({defined:!1,sel:t})).sc,f=i.ec,h=i.sr,u=i.er,o=this.dom.inner.getBoundingClientRect(),a=(i=[this.cell({col:this.pos.col+this.frozen.col,row:this.pos.row+this.frozen.row}),this.cell({col:l,row:h,roughly:!0}),this.cell({col:l,row:u,roughly:!0}),this.cell({col:f,row:h,roughly:!0}),this.cell({col:f,row:u,roughly:!0})].map(function(t){return t?t.getBoundingClientRect():null}))[0],c=i[1],r=i[2],d=i[3],s=i[4],a.width=0,a.height=0,n=(c||r||a).x-o.x,l=(c||d||a).y-o.y,h=f-this.pos.col<this.frozen.col,c=u-this.pos.row<this.frozen.row,d=(d||s||a).x+(h?0:(d||s||a).width)-o.x-n+1,a=(r||s||a).y+(c?0:(r||s||a).height)-o.y-l+1,null==f&&(d=this.root.getBoundingClientRect().width),null==u&&(a=this.root.getBoundingClientRect().height),u=(f=this.cell(t.start))?f.getBoundingClientRect():null,(i=(f=e.cut?this.dom["range-cut"]:this.dom.range).style).left=n+"px",i.top=l+"px",i.width=d+"px",i.height=a+"px",f.classList.toggle("show",!0),e.cut?void 0:(u&&((i=this.dom.caret.style).left=u.x-o.x-1+"px",i.top=u.y-o.y-1+"px",i.width=u.width+2+"px",i.height=u.height+2+"px",i.zIndex=t.start.row+this.xif.row[1]<this.xif.row[2]&&t.start.col+this.xif.col[1]<this.xif.col[2]?101:t.start.row+this.xif.row[1]<this.xif.row[2]||t.start.col+this.xif.col[1]<this.xif.col[2]?20:15),this.dom.caret.classList.toggle("show",!!u))},data:function(t){return null==t?this._data:(this._data=t,this.render())}}),"undefined"!=typeof module&&null!==module?module.exports=t:"undefined"!=typeof window&&null!==window&&(window.sheet=t)}.call(this);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"zbryikt","name":"@plotdb/sheet","license":"MIT","description":"spreadsheet","version":"0.4.
|
|
1
|
+
{"author":"zbryikt","name":"@plotdb/sheet","license":"MIT","description":"spreadsheet","version":"0.4.2","style":"index.min.css","browser":"index.min.js","main":"index.min.js","homepage":"https://github.com/plotdb/sheet","repository":{"type":"git","url":"https://github.com/plotdb/sheet"},"engines":{"node":">=10.14.1","npm":">=6.4.1"},"scripts":{"start":"npx server -r web -o true","deploy":"npx deploy web/static"},"devDependencies":{"@loadingio/debounce.js":"1.0.1","@loadingio/ldquery":"^3.0.4","@plotdb/csscope":"^4.0.8","@plotdb/datadom":"^0.2.0","@plotdb/json0":"^0.0.5","@plotdb/rescope":"^4.1.7","body-parser":"^1.19.0","bootstrap":"^4.5.2","@loadingio/bootstrap.ext":"^0.0.9","bootstrap.native":"^3.0.13","dompurify":"^2.2.6","fedep":"^1.1.7","jsoneditor":"^9.1.1","ldcover":"^3.2.1","ldiconfont":"^0.2.3","ldview":"^1.2.1","livescript":"^1.6.0","proxise":"^1.0.1","sharedb-wrapper":"^1.0.0","stylus":"^0.55.0","@zbryikt/template":"^2.3.38","uglify-js":"^3.13.1","uglifycss":"^0.0.29"},"frontendDependencies":{"root":"web/static/assets/lib","modules":["bootstrap","@loadingio/bootstrap.ext","bootstrap.native","@loadingio/ldquery","@loadingio/debounce.js","dompurify","ldview","ldcover","jsoneditor","ldiconfont","proxise","@plotdb/datadom","@plotdb/csscope","@plotdb/rescope","sharedb-wrapper","@plotdb/json0"]}}
|