e-virt-table 1.0.1 → 1.0.3

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/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(":root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(":root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
2
  var me = Object.defineProperty;
3
3
  var Ee = (n, t, e) => t in n ? me(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
4
4
  var h = (n, t, e) => Ee(n, typeof t != "symbol" ? t + "" : t, e);
@@ -2694,21 +2694,22 @@ class hi {
2694
2694
  return !!(this.ctx.scrollerMove || this.ctx.scrollerFocus || s > this.ctx.stageHeight - o || r > this.ctx.stageWidth - o);
2695
2695
  }
2696
2696
  handleBodyEvent(t, e, i, s, r = !1) {
2697
- for (const o of i) {
2698
- const a = o.fixedCells.concat(o.noFixedCells);
2699
- for (const l of a) {
2700
- const c = l.getDrawX(), d = l.getDrawY();
2701
- if (r) {
2702
- if (t > c && t < c + l.visibleWidth && e > d && e < d + l.visibleHeight) {
2697
+ if (this.isInsideBody(e))
2698
+ for (const o of i) {
2699
+ const a = o.fixedCells.concat(o.noFixedCells);
2700
+ for (const l of a) {
2701
+ const c = l.getDrawX(), d = l.getDrawY();
2702
+ if (r) {
2703
+ if (t > c && t < c + l.visibleWidth && e > d && e < d + l.visibleHeight) {
2704
+ s(l);
2705
+ return;
2706
+ }
2707
+ } else if (t > c && t < c + l.width && e > d && e < d + l.height) {
2703
2708
  s(l);
2704
2709
  return;
2705
2710
  }
2706
- } else if (t > c && t < c + l.width && e > d && e < d + l.height) {
2707
- s(l);
2708
- return;
2709
2711
  }
2710
2712
  }
2711
- }
2712
2713
  }
2713
2714
  handleHeaderEvent(t, e, i, s) {
2714
2715
  for (const r of i) {
@@ -2719,6 +2720,9 @@ class hi {
2719
2720
  }
2720
2721
  }
2721
2722
  }
2723
+ isInsideBody(t) {
2724
+ return t > this.ctx.body.y && t < this.ctx.body.y + this.ctx.body.visibleHeight;
2725
+ }
2722
2726
  destroy() {
2723
2727
  this.resizeObserver.unobserve(this.ctx.stageElement);
2724
2728
  }
@@ -3010,7 +3014,7 @@ class Pt {
3010
3014
  config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
3011
3015
  } = this.ctx, a = s, l = i, c = e.height, d = e.width, f = t.height, x = this.ctx.footer.height;
3012
3016
  if (this.type === "vertical") {
3013
- this.visibleDistance = l - r - c, this.distance = f - this.visibleDistance + x, this.trackX = a - r, this.trackY = 0, this.splitPoints = [this.trackX, c, this.trackX + r, c], this.trackWidth = r, this.trackHeight = l, this.barX = this.trackX - 0.5 + (r - o) / 2, this.barWidth = o;
3017
+ this.visibleDistance = l - r - c, this.distance = f - this.visibleDistance + x, this.trackX = a - r, this.trackY = 0, this.splitPoints = [this.trackX, c, this.trackX + r, c], this.trackWidth = r, this.trackHeight = l, this.barX = this.trackX - 1 + (r - o) / 2, this.barWidth = o;
3014
3018
  const u = this.distance ? this.visibleDistance / (f + x) : 0;
3015
3019
  let g = Math.floor(u * this.visibleDistance);
3016
3020
  g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = c + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
@@ -3023,7 +3027,7 @@ class Pt {
3023
3027
  ], this.trackX = 0, this.trackY = l - r, this.trackWidth = a, this.trackHeight = r;
3024
3028
  const u = this.distance ? this.visibleDistance / d : 0;
3025
3029
  let g = Math.floor(u * this.visibleDistance);
3026
- this.barY = this.trackY - 0.5 + (r - o) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3030
+ this.barY = this.trackY - 1 + (r - o) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3027
3031
  }
3028
3032
  }
3029
3033
  draw() {
@@ -5676,7 +5680,7 @@ class Qi {
5676
5680
  this.ctx.off(t, e);
5677
5681
  }
5678
5682
  filterMethod(t) {
5679
- this.ctx.setScrollY(0), this.ctx.setScrollX(0), this.ctx.database.init(), this.ctx.database.setFilterMethod(t), this.ctx.emit("draw");
5683
+ this.ctx.setScrollY(0), this.ctx.setScrollX(0), this.ctx.database.init(), this.header.init(), this.ctx.database.setFilterMethod(t), this.ctx.emit("draw");
5680
5684
  }
5681
5685
  editCell(t, e) {
5682
5686
  this.editor.editCell(t, e);