e-virt-table 1.2.14 → 1.2.15

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
@@ -131,7 +131,7 @@ function Le(l, t, e) {
131
131
  t(n, o);
132
132
  });
133
133
  }
134
- function Bt(l, t, e) {
134
+ function Ft(l, t, e) {
135
135
  var i = 0, s = l.length;
136
136
  function r(o) {
137
137
  if (o && o.length) {
@@ -149,7 +149,7 @@ function Te(l) {
149
149
  t.push.apply(t, l[e] || []);
150
150
  }), t;
151
151
  }
152
- var Ft = /* @__PURE__ */ function(l) {
152
+ var Bt = /* @__PURE__ */ function(l) {
153
153
  Re(t, l);
154
154
  function t(e, i) {
155
155
  var s;
@@ -161,9 +161,9 @@ function Ae(l, t, e, i, s) {
161
161
  if (t.first) {
162
162
  var r = new Promise(function(x, g) {
163
163
  var p = function(m) {
164
- return i(m), m.length ? g(new Ft(m, bt(m))) : x(s);
164
+ return i(m), m.length ? g(new Bt(m, bt(m))) : x(s);
165
165
  }, u = Te(l);
166
- Bt(u, e, p);
166
+ Ft(u, e, p);
167
167
  });
168
168
  return r.catch(function(x) {
169
169
  return x;
@@ -172,11 +172,11 @@ function Ae(l, t, e, i, s) {
172
172
  var o = t.firstFields === !0 ? Object.keys(l) : t.firstFields || [], n = Object.keys(l), h = n.length, c = 0, d = [], f = new Promise(function(x, g) {
173
173
  var p = function(w) {
174
174
  if (d.push.apply(d, w), c++, c === h)
175
- return i(d), d.length ? g(new Ft(d, bt(d))) : x(s);
175
+ return i(d), d.length ? g(new Bt(d, bt(d))) : x(s);
176
176
  };
177
177
  n.length || (i(d), x(s)), n.forEach(function(u) {
178
178
  var w = l[u];
179
- o.indexOf(u) !== -1 ? Bt(w, e, p) : Le(w, e, p);
179
+ o.indexOf(u) !== -1 ? Ft(w, e, p) : Le(w, e, p);
180
180
  });
181
181
  });
182
182
  return f.catch(function(x) {
@@ -292,14 +292,14 @@ var Zt = function(t, e, i, s, r, o) {
292
292
  hex: function(t) {
293
293
  return typeof t == "string" && !!t.match(Kt.hex);
294
294
  }
295
- }, Be = function(t, e, i, s, r) {
295
+ }, Fe = function(t, e, i, s, r) {
296
296
  if (t.required && e === void 0) {
297
297
  Zt(t, e, i, s, r);
298
298
  return;
299
299
  }
300
300
  var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], n = t.type;
301
301
  o.indexOf(n) > -1 ? et[n](e) || s.push(D(r.messages.types[n], t.fullField, t.type)) : n && typeof e !== t.type && s.push(D(r.messages.types[n], t.fullField, t.type));
302
- }, Fe = function(t, e, i, s, r) {
302
+ }, Be = function(t, e, i, s, r) {
303
303
  var o = typeof t.len == "number", n = typeof t.min == "number", h = typeof t.max == "number", c = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, d = e, f = null, x = typeof e == "number", g = typeof e == "string", p = Array.isArray(e);
304
304
  if (x ? f = "number" : g ? f = "string" : p && (f = "array"), !f)
305
305
  return !1;
@@ -318,8 +318,8 @@ var Zt = function(t, e, i, s, r, o) {
318
318
  }, S = {
319
319
  required: Zt,
320
320
  whitespace: De,
321
- type: Be,
322
- range: Fe,
321
+ type: Fe,
322
+ range: Be,
323
323
  enum: Ne,
324
324
  pattern: ke
325
325
  }, Ke = function(t, e, i, s, r) {
@@ -2945,6 +2945,8 @@ class oe extends re {
2945
2945
  a(this, "key");
2946
2946
  a(this, "required", !1);
2947
2947
  a(this, "readonly", !1);
2948
+ a(this, "ellipsis", !1);
2949
+ a(this, "overflowTooltipShow", !0);
2948
2950
  a(this, "children", []);
2949
2951
  a(this, "column");
2950
2952
  a(this, "colIndex");
@@ -2955,6 +2957,8 @@ class oe extends re {
2955
2957
  a(this, "style", {});
2956
2958
  a(this, "drawX", 0);
2957
2959
  a(this, "drawY", 0);
2960
+ a(this, "visibleWidth", 0);
2961
+ a(this, "visibleHeight", 0);
2958
2962
  a(this, "drawCellBgColor", "");
2959
2963
  a(this, "drawTextColor", "");
2960
2964
  a(this, "drawImageX", 0);
@@ -2963,7 +2967,7 @@ class oe extends re {
2963
2967
  a(this, "drawImageHeight", 0);
2964
2968
  a(this, "drawImageName", "");
2965
2969
  a(this, "drawImageSource");
2966
- this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = n, this.colIndex = i, this.key = h.key, this.minWidth = h.minWidth, this.maxWidth = h.maxWidth, this.type = h.type || "", this.editorType = h.editorType || "text", this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.text = h.title, this.column = h, this.colspan = h.colspan || 1, this.widthFillDisable = h.widthFillDisable || !1, this.rowspan = h.rowspan || 1, this.rules = h.rules, this.readonly = h.readonly || !1, this.required = h.required || !1, this.rowKey = Jt(), this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
2970
+ this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = n, this.visibleWidth = o, this.visibleHeight = n, this.colIndex = i, this.key = h.key, this.minWidth = h.minWidth, this.maxWidth = h.maxWidth, this.type = h.type || "", this.editorType = h.editorType || "text", this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.text = h.title, this.column = h, this.colspan = h.colspan || 1, this.widthFillDisable = h.widthFillDisable || !1, this.rowspan = h.rowspan || 1, this.rules = h.rules, this.readonly = h.readonly || !1, this.required = h.required || !1, this.rowKey = Jt(), this.overflowTooltipShow = h.overflowTooltipHeaderShow !== !1, this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
2967
2971
  }
2968
2972
  /**
2969
2973
  * 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
@@ -3002,7 +3006,7 @@ class oe extends re {
3002
3006
  e.drawRect(n, h, this.width, this.height, {
3003
3007
  borderColor: o ? i : "transparent",
3004
3008
  fillColor: this.drawCellBgColor
3005
- }), e.drawText(c, n, h, this.width, this.height, {
3009
+ }), this.ellipsis = e.drawText(c, n, h, this.width, this.height, {
3006
3010
  font: r,
3007
3011
  padding: s,
3008
3012
  color: this.drawTextColor,
@@ -3116,13 +3120,13 @@ class ui {
3116
3120
  this.ctx.isPointer = !1, this.ctx.stageElement.style.cursor === "pointer" && (this.ctx.stageElement.style.cursor = "default");
3117
3121
  const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
3118
3122
  this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
3119
- this.ctx.emit("cellHeaderMouseenter", s, t), this.ctx.hoverCellHeader && this.ctx.hoverCellHeader !== s && this.ctx.emit("cellHeaderMouseleave", this.ctx.hoverCellHeader, t), this.imageEnterAndLeave(s, t), this.ctx.hoverCellHeader !== s && (this.ctx.hoverCellHeader = s, this.ctx.emit("cellHeaderHoverChange", s));
3123
+ this.ctx.emit("cellHeaderMouseenter", s, t), this.ctx.hoverCellHeader && this.ctx.hoverCellHeader !== s && this.ctx.emit("cellHeaderMouseleave", this.ctx.hoverCellHeader, t), this.imageEnterAndLeave(s, t), this.ctx.hoverCellHeader !== s && (this.ctx.hoverCellHeader = s, this.visibleHoverCell = void 0, this.ctx.emit("cellHeaderHoverChange", s, t));
3120
3124
  }), this.handleBodyEvent(
3121
3125
  i,
3122
3126
  e,
3123
3127
  this.ctx.body.renderRows,
3124
3128
  (s) => {
3125
- this.selectionEnterAndLeave(s, t), this.visibleHoverCell !== s && (this.ctx.emit("visibleCellMouseleave", s, t), this.visibleHoverCell = s, this.ctx.emit("visibleCellHoverChange", s, t));
3129
+ this.selectionEnterAndLeave(s, t), this.visibleHoverCell !== s && (this.ctx.emit("visibleCellMouseleave", s, t), this.visibleHoverCell = s, this.ctx.hoverCellHeader = void 0, this.ctx.emit("visibleCellHoverChange", s, t));
3126
3130
  },
3127
3131
  !0
3128
3132
  ), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
@@ -3716,7 +3720,7 @@ class pi {
3716
3720
  this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
3717
3721
  const s = te(i), r = _t(i);
3718
3722
  this.height = t * s, this.width = r.reduce((f, x) => {
3719
- const { width: g = 100, maxWidth: p, minWidth: u } = x;
3723
+ const g = x.width || 100, { maxWidth: p, minWidth: u } = x;
3720
3724
  return p && g > p ? f + p : u && g < u ? f + u : f + g;
3721
3725
  }, 0), this.visibleHeight = this.height;
3722
3726
  const o = ei(ee(i, s));
@@ -5422,7 +5426,7 @@ function V(l) {
5422
5426
  function ce(l) {
5423
5427
  return gt() ? l instanceof Node || l instanceof X(l).Node : !1;
5424
5428
  }
5425
- function B(l) {
5429
+ function F(l) {
5426
5430
  return gt() ? l instanceof Element || l instanceof X(l).Element : !1;
5427
5431
  }
5428
5432
  function K(l) {
@@ -5437,7 +5441,7 @@ function ht(l) {
5437
5441
  overflowX: e,
5438
5442
  overflowY: i,
5439
5443
  display: s
5440
- } = F(l);
5444
+ } = B(l);
5441
5445
  return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
5442
5446
  }
5443
5447
  function Xi(l) {
@@ -5453,10 +5457,10 @@ function wt(l) {
5453
5457
  });
5454
5458
  }
5455
5459
  function Dt(l) {
5456
- const t = Xt(), e = B(l) ? F(l) : l;
5460
+ const t = Xt(), e = F(l) ? B(l) : l;
5457
5461
  return e.transform !== "none" || e.perspective !== "none" || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((i) => (e.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (e.contain || "").includes(i));
5458
5462
  }
5459
- function Bi(l) {
5463
+ function Fi(l) {
5460
5464
  let t = $(l);
5461
5465
  for (; K(t) && !Q(t); ) {
5462
5466
  if (Dt(t))
@@ -5473,11 +5477,11 @@ function Xt() {
5473
5477
  function Q(l) {
5474
5478
  return ["html", "body", "#document"].includes(tt(l));
5475
5479
  }
5476
- function F(l) {
5480
+ function B(l) {
5477
5481
  return X(l).getComputedStyle(l);
5478
5482
  }
5479
5483
  function pt(l) {
5480
- return B(l) ? {
5484
+ return F(l) ? {
5481
5485
  scrollLeft: l.scrollLeft,
5482
5486
  scrollTop: l.scrollTop
5483
5487
  } : {
@@ -5515,7 +5519,7 @@ function Lt(l) {
5515
5519
  return l.parent && Object.getPrototypeOf(l.parent) ? l.frameElement : null;
5516
5520
  }
5517
5521
  function fe(l) {
5518
- const t = F(l);
5522
+ const t = B(l);
5519
5523
  let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
5520
5524
  const s = K(l), r = s ? l.offsetWidth : e, o = s ? l.offsetHeight : i, n = ft(e) !== r || ft(i) !== o;
5521
5525
  return n && (e = r, i = o), {
@@ -5525,7 +5529,7 @@ function fe(l) {
5525
5529
  };
5526
5530
  }
5527
5531
  function xe(l) {
5528
- return B(l) ? l : l.contextElement;
5532
+ return F(l) ? l : l.contextElement;
5529
5533
  }
5530
5534
  function Z(l) {
5531
5535
  const t = xe(l);
@@ -5542,10 +5546,10 @@ function Z(l) {
5542
5546
  y: n
5543
5547
  };
5544
5548
  }
5545
- const Fi = /* @__PURE__ */ z(0);
5549
+ const Bi = /* @__PURE__ */ z(0);
5546
5550
  function ue(l) {
5547
5551
  const t = X(l);
5548
- return !Xt() || !t.visualViewport ? Fi : {
5552
+ return !Xt() || !t.visualViewport ? Bi : {
5549
5553
  x: t.visualViewport.offsetLeft,
5550
5554
  y: t.visualViewport.offsetTop
5551
5555
  };
@@ -5557,14 +5561,14 @@ function ot(l, t, e, i) {
5557
5561
  t === void 0 && (t = !1), e === void 0 && (e = !1);
5558
5562
  const s = l.getBoundingClientRect(), r = xe(l);
5559
5563
  let o = z(1);
5560
- t && (i ? B(i) && (o = Z(i)) : o = Z(l));
5564
+ t && (i ? F(i) && (o = Z(i)) : o = Z(l));
5561
5565
  const n = Ni(r, e, i) ? ue(r) : z(0);
5562
5566
  let h = (s.left + n.x) / o.x, c = (s.top + n.y) / o.y, d = s.width / o.x, f = s.height / o.y;
5563
5567
  if (r) {
5564
- const x = X(r), g = i && B(i) ? X(i) : i;
5568
+ const x = X(r), g = i && F(i) ? X(i) : i;
5565
5569
  let p = x, u = Lt(p);
5566
5570
  for (; u && i && g !== p; ) {
5567
- const w = Z(u), m = u.getBoundingClientRect(), C = F(u), y = m.left + (u.clientLeft + parseFloat(C.paddingLeft)) * w.x, b = m.top + (u.clientTop + parseFloat(C.paddingTop)) * w.y;
5571
+ const w = Z(u), m = u.getBoundingClientRect(), C = B(u), y = m.left + (u.clientLeft + parseFloat(C.paddingLeft)) * w.x, b = m.top + (u.clientTop + parseFloat(C.paddingTop)) * w.y;
5568
5572
  h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += y, c += b, p = X(u), u = Lt(p);
5569
5573
  }
5570
5574
  }
@@ -5612,7 +5616,7 @@ function Yi(l) {
5612
5616
  const t = V(l), e = pt(l), i = l.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
5613
5617
  let o = -e.scrollLeft + Tt(l);
5614
5618
  const n = -e.scrollTop;
5615
- return F(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
5619
+ return B(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
5616
5620
  width: s,
5617
5621
  height: r,
5618
5622
  x: o,
@@ -5649,7 +5653,7 @@ function Gt(l, t, e) {
5649
5653
  i = Vi(l, e);
5650
5654
  else if (t === "document")
5651
5655
  i = Yi(V(l));
5652
- else if (B(t))
5656
+ else if (F(t))
5653
5657
  i = Wi(t, e);
5654
5658
  else {
5655
5659
  const s = ue(l);
@@ -5663,17 +5667,17 @@ function Gt(l, t, e) {
5663
5667
  }
5664
5668
  function ge(l, t) {
5665
5669
  const e = $(l);
5666
- return e === t || !B(e) || Q(e) ? !1 : F(e).position === "fixed" || ge(e, t);
5670
+ return e === t || !F(e) || Q(e) ? !1 : B(e).position === "fixed" || ge(e, t);
5667
5671
  }
5668
5672
  function Pi(l, t) {
5669
5673
  const e = t.get(l);
5670
5674
  if (e)
5671
5675
  return e;
5672
- let i = St(l, [], !1).filter((n) => B(n) && tt(n) !== "body"), s = null;
5673
- const r = F(l).position === "fixed";
5676
+ let i = St(l, [], !1).filter((n) => F(n) && tt(n) !== "body"), s = null;
5677
+ const r = B(l).position === "fixed";
5674
5678
  let o = r ? $(l) : l;
5675
- for (; B(o) && !Q(o); ) {
5676
- const n = F(o), h = Dt(o);
5679
+ for (; F(o) && !Q(o); ) {
5680
+ const n = B(o), h = Dt(o);
5677
5681
  !h && n.position === "fixed" && (s = null), (r ? !h && !s : !h && n.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || ht(o) && !h && ge(l, o)) ? i = i.filter((d) => d !== o) : s = n, o = $(o);
5678
5682
  }
5679
5683
  return t.set(l, i), i;
@@ -5733,10 +5737,10 @@ function qi(l, t, e) {
5733
5737
  };
5734
5738
  }
5735
5739
  function yt(l) {
5736
- return F(l).position === "static";
5740
+ return B(l).position === "static";
5737
5741
  }
5738
5742
  function jt(l, t) {
5739
- if (!K(l) || F(l).position === "fixed")
5743
+ if (!K(l) || B(l).position === "fixed")
5740
5744
  return null;
5741
5745
  if (t)
5742
5746
  return t(l);
@@ -5750,7 +5754,7 @@ function we(l, t) {
5750
5754
  if (!K(l)) {
5751
5755
  let s = $(l);
5752
5756
  for (; s && !Q(s); ) {
5753
- if (B(s) && !yt(s))
5757
+ if (F(s) && !yt(s))
5754
5758
  return s;
5755
5759
  s = $(s);
5756
5760
  }
@@ -5759,7 +5763,7 @@ function we(l, t) {
5759
5763
  let i = jt(l, t);
5760
5764
  for (; i && Xi(i) && yt(i); )
5761
5765
  i = jt(i, t);
5762
- return i && Q(i) && yt(i) && !Dt(i) ? e : i || Bi(l) || e;
5766
+ return i && Q(i) && yt(i) && !Dt(i) ? e : i || Fi(l) || e;
5763
5767
  }
5764
5768
  const Gi = async function(l) {
5765
5769
  const t = this.getOffsetParent || we, e = this.getDimensions, i = await e(l.floating);
@@ -5774,7 +5778,7 @@ const Gi = async function(l) {
5774
5778
  };
5775
5779
  };
5776
5780
  function ji(l) {
5777
- return F(l).direction === "rtl";
5781
+ return B(l).direction === "rtl";
5778
5782
  }
5779
5783
  const Ui = {
5780
5784
  convertOffsetParentRelativeRectToViewportRelativeRect: ki,
@@ -5785,7 +5789,7 @@ const Ui = {
5785
5789
  getClientRects: Ki,
5786
5790
  getDimensions: $i,
5787
5791
  getScale: Z,
5788
- isElement: B,
5792
+ isElement: F,
5789
5793
  isRTL: ji
5790
5794
  }, pe = Hi, me = Di, ye = Ai, Zi = Ti, Ee = (l, t, e) => {
5791
5795
  const i = /* @__PURE__ */ new Map(), s = {
@@ -5833,17 +5837,22 @@ let Ji = class {
5833
5837
  Object.assign(this.arrowEl.style, h), Object.assign(this.floatingEl.style, n), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
5834
5838
  }
5835
5839
  init() {
5836
- this.ctx.on("mousemove", (t) => {
5837
- if (!this.ctx.isTarget(t))
5838
- return;
5839
- const e = this.ctx.containerElement.getBoundingClientRect();
5840
- e && (t.clientX < e.x || t.clientX > e.x + e.width || t.clientY < e.y || t.clientY > e.y + e.height) && this.hide();
5840
+ this.floatingEl.addEventListener("mouseleave", () => {
5841
+ this.hide();
5842
+ }), this.ctx.on("mouseout", (t) => {
5843
+ this.floatingEl.contains(t.relatedTarget) || this.hide();
5844
+ }), this.ctx.on("onScroll", () => {
5845
+ this.hide();
5841
5846
  }), this.ctx.on("startEdit", () => {
5842
5847
  this.hide();
5843
5848
  }), this.ctx.on("visibleCellHoverChange", (t, e) => {
5844
5849
  this.floatingEl.contains(e.target) || (t.ellipsis || t.message) && this.show(t);
5845
5850
  }), this.ctx.on("visibleCellMouseleave", (t, e) => {
5846
5851
  this.floatingEl.contains(e.target) || this.hide();
5852
+ }), this.ctx.on("cellHeaderMouseleave", (t, e) => {
5853
+ this.floatingEl.contains(e.target) || this.hide();
5854
+ }), this.ctx.on("cellHeaderHoverChange", (t, e) => {
5855
+ this.floatingEl.contains(e.target) || t.ellipsis && this.show(t);
5847
5856
  });
5848
5857
  }
5849
5858
  show(t) {