e-virt-table 0.0.5 → 0.0.6

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
@@ -2824,35 +2824,15 @@ class Wt {
2824
2824
  return t >= i && t <= i + r && e >= s && e <= s + o;
2825
2825
  }
2826
2826
  isOnScrollbar(t, e) {
2827
- return this.isPointInElement(
2828
- t,
2829
- e,
2830
- this.barX,
2831
- this.barY,
2832
- this.barWidth,
2833
- this.barHeight
2834
- );
2827
+ return this.isPointInElement(t, e, this.barX, this.barY, this.barWidth, this.barHeight);
2835
2828
  }
2836
2829
  isOnTrack(t, e) {
2837
- return this.isPointInElement(
2838
- t,
2839
- e,
2840
- this.trackX,
2841
- this.trackY,
2842
- this.trackWidth,
2843
- this.trackHeight
2844
- );
2830
+ return this.isPointInElement(t, e, this.trackX, this.trackY, this.trackWidth, this.trackHeight);
2845
2831
  }
2846
2832
  updateScroll(t) {
2847
2833
  t.preventDefault();
2848
2834
  const e = t.deltaX, i = t.deltaY;
2849
- this.type === "vertical" && t.shiftKey === !1 ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.type === "horizontal" && (t.shiftKey ? this.scroll = Math.max(
2850
- 0,
2851
- Math.min(this.scroll + i, this.distance)
2852
- ) : this.scroll = Math.max(
2853
- 0,
2854
- Math.min(this.scroll + e, this.distance)
2855
- ));
2835
+ this.type === "vertical" && t.shiftKey === !1 ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.type === "horizontal" && (t.shiftKey ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.scroll = Math.max(0, Math.min(this.scroll + e, this.distance)));
2856
2836
  }
2857
2837
  updatedSize() {
2858
2838
  const {
@@ -2861,12 +2841,7 @@ class Wt {
2861
2841
  config: { SCROLLER_TRACK_SIZE: i = 0, SCROLLER_SIZE: s = 0 }
2862
2842
  } = this.ctx, r = this.ctx.target.width + 1, o = this.ctx.target.height, n = e.height, h = e.width, l = t.height, d = this.ctx.footer.height;
2863
2843
  if (this.type === "vertical") {
2864
- this.visibleDistance = o - i - n, this.distance = l - this.visibleDistance + d, this.trackX = r - i, this.trackY = 0, this.splitPoints = [
2865
- this.trackX,
2866
- n,
2867
- this.trackX + i,
2868
- n
2869
- ], this.trackWidth = i, this.trackHeight = o, this.barX = this.trackX + (i - s) / 2, this.barWidth = s;
2844
+ this.visibleDistance = o - i - n, this.distance = l - this.visibleDistance + d, this.trackX = r - i, this.trackY = 0, this.splitPoints = [this.trackX, n, this.trackX + i, n], this.trackWidth = i, this.trackHeight = o, this.barX = this.trackX + (i - s) / 2, this.barWidth = s;
2870
2845
  const f = this.distance ? this.visibleDistance / l : 0;
2871
2846
  let x = Math.floor(f * this.visibleDistance);
2872
2847
  x < 30 ? x = 30 : x > this.visibleDistance && (x = 0), this.barHeight = x, this.barY = n + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
@@ -2884,32 +2859,15 @@ class Wt {
2884
2859
  }
2885
2860
  draw() {
2886
2861
  const {
2887
- config: {
2888
- SCROLLER_FOCUS_COLOR: t,
2889
- SCROLLER_COLOR: e,
2890
- BORDER_COLOR: i,
2891
- SCROLLER_TRACK_COLOR: s
2892
- }
2862
+ config: { SCROLLER_FOCUS_COLOR: t, SCROLLER_COLOR: e, BORDER_COLOR: i, SCROLLER_TRACK_COLOR: s }
2893
2863
  } = this.ctx;
2894
- this.updatedSize(), this.ctx.paint.drawRect(
2895
- this.trackX,
2896
- this.trackY,
2897
- this.trackWidth,
2898
- this.trackHeight,
2899
- {
2900
- borderColor: i,
2901
- fillColor: s
2902
- }
2903
- ), this.ctx.paint.drawRect(
2904
- this.barX,
2905
- this.barY,
2906
- this.barWidth,
2907
- this.barHeight,
2908
- {
2909
- fillColor: this.isFocus || this.isDragging ? t : e,
2910
- radius: 4
2911
- }
2912
- ), this.splitPoints.length > 0 && this.ctx.paint.drawLine(this.splitPoints, {
2864
+ this.updatedSize(), this.ctx.paint.drawRect(this.trackX, this.trackY, this.trackWidth, this.trackHeight, {
2865
+ borderColor: i,
2866
+ fillColor: s
2867
+ }), this.ctx.paint.drawRect(this.barX, this.barY, this.barWidth, this.barHeight, {
2868
+ fillColor: this.isFocus || this.isDragging ? t : e,
2869
+ radius: 4
2870
+ }), this.splitPoints.length > 0 && this.ctx.paint.drawLine(this.splitPoints, {
2913
2871
  borderColor: i,
2914
2872
  borderWidth: 1
2915
2873
  }), this.ctx.scrollerFocus = this.isFocus;
@@ -2943,7 +2901,7 @@ class oi {
2943
2901
  draw() {
2944
2902
  this.verticalScrollbar.draw(), this.horizontalScrollbar.draw();
2945
2903
  const t = Math.floor(this.horizontalScrollbar.scroll), e = Math.floor(this.verticalScrollbar.scroll);
2946
- (t !== this.ctx.scrollX || e !== this.ctx.scrollY) && (this.ctx.scrollX = t, this.ctx.scrollY = e, this.ctx.emit("draw"), this.ctx.emit("onScroll", t, e), t !== this.ctx.scrollX && this.ctx.emit("onScrollX", t), e !== this.ctx.scrollY && this.ctx.emit("onScrollY", e));
2904
+ (t !== this.ctx.scrollX || e !== this.ctx.scrollY) && (this.ctx.emit("onScroll", t, e), t !== this.ctx.scrollX && this.ctx.emit("onScrollX", t), e !== this.ctx.scrollY && this.ctx.emit("onScrollY", e), this.ctx.scrollX = t, this.ctx.scrollY = e, this.ctx.emit("draw"));
2947
2905
  }
2948
2906
  setScroll(t, e) {
2949
2907
  this.horizontalScrollbar.scroll = t, this.verticalScrollbar.scroll = e, this.ctx.emit("draw");
@@ -2959,9 +2917,7 @@ class oi {
2959
2917
  i && this.setScrollX(i.x - e.visibleWidth / 2);
2960
2918
  }
2961
2919
  scrollToColIndex(t) {
2962
- const { header: e } = this.ctx, i = e.leafCellHeaders.find(
2963
- (s) => s.colIndex === t
2964
- );
2920
+ const { header: e } = this.ctx, i = e.leafCellHeaders.find((s) => s.colIndex === t);
2965
2921
  i && i.x > e.visibleWidth / 2 && this.setScrollX(i.x - e.visibleWidth / 2);
2966
2922
  }
2967
2923
  scrollToRowIndex(t) {