e-virt-table 0.0.16 → 0.0.18

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
@@ -186,7 +186,7 @@ function Se(a, t, e, i, s) {
186
186
  function Te(a) {
187
187
  return !!(a && a.message !== void 0);
188
188
  }
189
- function Le(a, t) {
189
+ function Ae(a, t) {
190
190
  for (var e = a, i = 0; i < t.length; i++) {
191
191
  if (e == null)
192
192
  return e;
@@ -197,7 +197,7 @@ function Le(a, t) {
197
197
  function Nt(a, t) {
198
198
  return function(e) {
199
199
  var i;
200
- return a.fullFields ? i = Le(t, a.fullFields) : i = t[e.field || a.fullField], Te(e) ? (e.field = e.field || a.fullField, e.fieldValue = i, e) : {
200
+ return a.fullFields ? i = Ae(t, a.fullFields) : i = t[e.field || a.fullField], Te(e) ? (e.field = e.field || a.fullField, e.fieldValue = i, e) : {
201
201
  message: typeof e == "function" ? e() : e,
202
202
  fieldValue: i,
203
203
  field: e.field || a.fullField
@@ -216,7 +216,7 @@ function Yt(a, t) {
216
216
  }
217
217
  var Ut = function(t, e, i, s, o, r) {
218
218
  t.required && (!i.hasOwnProperty(t.field) || _(e, r || t.type)) && s.push(M(o.messages.required, t.fullField));
219
- }, Ae = function(t, e, i, s, o) {
219
+ }, Le = function(t, e, i, s, o) {
220
220
  (/^\s+$/.test(e) || e === "") && s.push(M(o.messages.whitespace, t.fullField));
221
221
  }, ht, Me = function() {
222
222
  if (ht)
@@ -317,7 +317,7 @@ var Ut = function(t, e, i, s, o, r) {
317
317
  }
318
318
  }, v = {
319
319
  required: Ut,
320
- whitespace: Ae,
320
+ whitespace: Le,
321
321
  type: He,
322
322
  range: De,
323
323
  enum: Xe,
@@ -583,27 +583,27 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
583
583
  R === void 0 && (R = []);
584
584
  var T = Array.isArray(R) ? R : [R];
585
585
  !l.suppressWarning && T.length && a.warning("async-validator:", T), T.length && y.message !== void 0 && (T = [].concat(y.message));
586
- var L = T.map(Nt(y, n));
587
- if (l.first && L.length)
588
- return p[y.field] = 1, w(L);
586
+ var A = T.map(Nt(y, n));
587
+ if (l.first && A.length)
588
+ return p[y.field] = 1, w(A);
589
589
  if (!C)
590
- w(L);
590
+ w(A);
591
591
  else {
592
592
  if (y.required && !g.value)
593
- return y.message !== void 0 ? L = [].concat(y.message).map(Nt(y, n)) : l.error && (L = [l.error(y, M(l.messages.required, y.field))]), w(L);
594
- var A = {};
593
+ return y.message !== void 0 ? A = [].concat(y.message).map(Nt(y, n)) : l.error && (A = [l.error(y, M(l.messages.required, y.field))]), w(A);
594
+ var L = {};
595
595
  y.defaultField && Object.keys(g.value).map(function(I) {
596
- A[I] = y.defaultField;
597
- }), A = $({}, A, g.rule.fields);
596
+ L[I] = y.defaultField;
597
+ }), L = $({}, L, g.rule.fields);
598
598
  var D = {};
599
- Object.keys(A).forEach(function(I) {
600
- var S = A[I], O = Array.isArray(S) ? S : [S];
599
+ Object.keys(L).forEach(function(I) {
600
+ var S = L[I], O = Array.isArray(S) ? S : [S];
601
601
  D[I] = O.map(m.bind(null, I));
602
602
  });
603
603
  var B = new a(D);
604
604
  B.messages(l.messages), g.rule.options && (g.rule.options.messages = l.messages, g.rule.options.error = l.error), B.validate(g.value, g.rule.options || l, function(I) {
605
605
  var S = [];
606
- L && L.length && S.push.apply(S, L), I && I.length && S.push.apply(S, I), w(S.length ? S : null);
606
+ A && A.length && S.push.apply(S, A), I && I.length && S.push.apply(S, I), w(S.length ? S : null);
607
607
  });
608
608
  }
609
609
  }
@@ -647,7 +647,7 @@ nt.register = function(t, e) {
647
647
  nt.warning = jt;
648
648
  nt.messages = Rt;
649
649
  nt.validators = it;
650
- function At() {
650
+ function Lt() {
651
651
  return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(a) {
652
652
  const t = Math.random() * 16 | 0;
653
653
  return (a === "x" ? t : t & 3 | 8).toString(16);
@@ -790,7 +790,7 @@ class ii {
790
790
  t.forEach((i, s) => {
791
791
  let o = !1;
792
792
  Array.isArray(i.children) && (o = !0, this.initData(i.children, e + 1));
793
- const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: l, SELECTABLE_METHOD: h, CHECKBOX_KEY: f } = this.ctx.config, d = i[r], x = d ?? At();
793
+ const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: l, SELECTABLE_METHOD: h, CHECKBOX_KEY: f } = this.ctx.config, d = i[r], x = d ?? Lt();
794
794
  this.itemRowKeyMap.set(i, x);
795
795
  const u = i._height || l, p = i._readonly;
796
796
  let g = !0;
@@ -2402,7 +2402,7 @@ class ie extends te {
2402
2402
  c(this, "drawImageHeight", 0);
2403
2403
  c(this, "drawImageName", "");
2404
2404
  c(this, "drawImageSource");
2405
- this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = n, this.colIndex = i, this.key = l.key, this.type = l.type, this.editorType = l.editorType || "text", this.align = l.align || "center", this.verticalAlign = l.verticalAlign || "middle", this.fixed = l.fixed, this.level = l.level, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan, this.widthFillDisable = l.widthFillDisable, this.rowspan = l.rowspan, this.rules = l.rules, this.readonly = l.readonly, this.required = l.required, this.rowKey = At(), this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
2405
+ this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = n, this.colIndex = i, this.key = l.key, this.type = l.type, this.editorType = l.editorType || "text", this.align = l.align || "center", this.verticalAlign = l.verticalAlign || "middle", this.fixed = l.fixed, this.level = l.level, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan, this.widthFillDisable = l.widthFillDisable, this.rowspan = l.rowspan, this.rules = l.rules, this.readonly = l.readonly, this.required = l.required, this.rowKey = Lt(), this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
2406
2406
  }
2407
2407
  /**
2408
2408
  * 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
@@ -2650,7 +2650,7 @@ class li {
2650
2650
  c(this, "eventBus");
2651
2651
  c(this, "eventBrowser");
2652
2652
  c(this, "eventTable");
2653
- c(this, "uuid", At());
2653
+ c(this, "uuid", Lt());
2654
2654
  c(this, "targetContainer");
2655
2655
  c(this, "target");
2656
2656
  c(this, "paint");
@@ -3706,7 +3706,7 @@ class ui {
3706
3706
  }
3707
3707
  click(t = !1) {
3708
3708
  const { focusCell: e, clickCell: i } = this.ctx;
3709
- if (e)
3709
+ if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
3710
3710
  if (this.ctx.selector.enable = !0, i && t) {
3711
3711
  const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: n } = e, l = Math.min(r, s), h = Math.max(r, s), f = Math.min(n, o), d = Math.max(n, o), x = [l, h], u = [f, d];
3712
3712
  this.setSelector(x, u);
@@ -3846,16 +3846,23 @@ class ui {
3846
3846
  break;
3847
3847
  }
3848
3848
  const h = [i, i], f = [s, s], d = this.getCell(s, i);
3849
- if (d) {
3850
- if (d.operation)
3851
- return;
3852
- this.ctx.setFocusCell(d);
3853
- }
3854
- this.setSelector(h, f), this.adjustBoundaryPosition(), this.ctx.emit("draw");
3849
+ d && (d.operation || this.isInSettingRange(d.rowIndex, d.colIndex) && (this.ctx.setFocusCell(d), this.setSelector(h, f), this.adjustBoundaryPosition(), this.ctx.emit("draw")));
3855
3850
  }
3856
3851
  stopAdjustPosition() {
3857
3852
  this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
3858
3853
  }
3854
+ // 判断是否在设置范围内
3855
+ isInSettingRange(t, e) {
3856
+ const {
3857
+ SELECTOR_AREA_MIN_X: i,
3858
+ SELECTOR_AREA_MAX_X: s,
3859
+ SELECTOR_AREA_MIN_Y: o,
3860
+ SELECTOR_AREA_MAX_Y: r,
3861
+ SELECTOR_AREA_MAX_X_OFFSET: n,
3862
+ SELECTOR_AREA_MAX_Y_OFFSET: l
3863
+ } = this.ctx.config, h = i, f = s || this.ctx.maxColIndex - n, d = o, x = r || this.ctx.maxRowIndex - l;
3864
+ return !(e < h || e > f || t < d || t > x);
3865
+ }
3859
3866
  /**
3860
3867
  * 调整滚动条位置,让到达边界时自动滚动
3861
3868
  */
@@ -4290,7 +4297,7 @@ const Ri = (a) => ({
4290
4297
  }, u = Ht(s), p = Mt(u), g = await r.getDimensions(h), w = u === "y", y = w ? "top" : "left", C = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", E = o.reference[p] + o.reference[u] - x[u] - o.floating[p], b = x[u] - o.reference[u], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
4291
4298
  let T = R ? R[m] : 0;
4292
4299
  (!T || !await (r.isElement == null ? void 0 : r.isElement(R))) && (T = n.floating[m] || o.floating[p]);
4293
- const L = E / 2 - b / 2, A = T / 2 - g[p] / 2 - 1, D = rt(d[y], A), B = rt(d[C], A), I = D, S = T - g[p] - B, O = T / 2 - g[p] / 2 + L, G = It(I, O, S), Y = !l.arrow && ct(s) != null && O !== G && o.reference[p] / 2 - (O < I ? D : B) - g[p] / 2 < 0, k = Y ? O < I ? O - I : O - S : 0;
4300
+ const A = E / 2 - b / 2, L = T / 2 - g[p] / 2 - 1, D = rt(d[y], L), B = rt(d[C], L), I = D, S = T - g[p] - B, O = T / 2 - g[p] / 2 + A, G = It(I, O, S), Y = !l.arrow && ct(s) != null && O !== G && o.reference[p] / 2 - (O < I ? D : B) - g[p] / 2 < 0, k = Y ? O < I ? O - I : O - S : 0;
4294
4301
  return {
4295
4302
  [u]: x[u] + k,
4296
4303
  data: {
@@ -4329,16 +4336,16 @@ const Ri = (a) => ({
4329
4336
  return {};
4330
4337
  const y = q(s), C = J(n), m = q(n) === n, E = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), b = x || (m || !g ? [xt(n)] : mi(n)), R = p !== "none";
4331
4338
  !x && R && b.push(...Ci(n, g, p, E));
4332
- const T = [n, ...b], L = await ne(t, w), A = [];
4339
+ const T = [n, ...b], A = await ne(t, w), L = [];
4333
4340
  let D = ((i = o.flip) == null ? void 0 : i.overflows) || [];
4334
- if (f && A.push(L[y]), d) {
4341
+ if (f && L.push(A[y]), d) {
4335
4342
  const O = yi(s, r, E);
4336
- A.push(L[O[0]], L[O[1]]);
4343
+ L.push(A[O[0]], A[O[1]]);
4337
4344
  }
4338
4345
  if (D = [...D, {
4339
4346
  placement: s,
4340
- overflows: A
4341
- }], !A.every((O) => O <= 0)) {
4347
+ overflows: L
4348
+ }], !L.every((O) => O <= 0)) {
4342
4349
  var B, I;
4343
4350
  const O = (((B = o.flip) == null ? void 0 : B.index) || 0) + 1, G = T[O];
4344
4351
  if (G)
@@ -4540,7 +4547,7 @@ function Dt(a) {
4540
4547
  const t = Xt(), e = X(a) ? F(a) : a;
4541
4548
  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));
4542
4549
  }
4543
- function Li(a) {
4550
+ function Ai(a) {
4544
4551
  let t = V(a);
4545
4552
  for (; N(t) && !Q(t); ) {
4546
4553
  if (Dt(t))
@@ -4626,10 +4633,10 @@ function Z(a) {
4626
4633
  y: n
4627
4634
  };
4628
4635
  }
4629
- const Ai = /* @__PURE__ */ z(0);
4636
+ const Li = /* @__PURE__ */ z(0);
4630
4637
  function de(a) {
4631
4638
  const t = H(a);
4632
- return !Xt() || !t.visualViewport ? Ai : {
4639
+ return !Xt() || !t.visualViewport ? Li : {
4633
4640
  x: t.visualViewport.offsetLeft,
4634
4641
  y: t.visualViewport.offsetTop
4635
4642
  };
@@ -4688,13 +4695,13 @@ function Hi(a) {
4688
4695
  function Di(a) {
4689
4696
  return Array.from(a.getClientRects());
4690
4697
  }
4691
- function Lt(a, t) {
4698
+ function At(a, t) {
4692
4699
  const e = pt(a).scrollLeft;
4693
4700
  return t ? t.left + e : ot(K(a)).left + e;
4694
4701
  }
4695
4702
  function Xi(a) {
4696
4703
  const t = K(a), e = pt(a), i = a.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
4697
- let r = -e.scrollLeft + Lt(a);
4704
+ let r = -e.scrollLeft + At(a);
4698
4705
  const n = -e.scrollTop;
4699
4706
  return F(i).direction === "rtl" && (r += U(t.clientWidth, i.clientWidth) - s), {
4700
4707
  width: s,
@@ -4801,12 +4808,12 @@ function Bi(a, t, e) {
4801
4808
  if ((tt(t) !== "body" || lt(s)) && (n = pt(t)), i) {
4802
4809
  const u = ot(t, !0, o, t);
4803
4810
  l.x = u.x + t.clientLeft, l.y = u.y + t.clientTop;
4804
- } else s && (l.x = Lt(s));
4811
+ } else s && (l.x = At(s));
4805
4812
  let h = 0, f = 0;
4806
4813
  if (s && !i && !o) {
4807
4814
  const u = s.getBoundingClientRect();
4808
4815
  f = u.top + n.scrollTop, h = u.left + n.scrollLeft - // RTL <body> scrollbar.
4809
- Lt(s, u);
4816
+ At(s, u);
4810
4817
  }
4811
4818
  const d = r.left + n.scrollLeft - l.x - h, x = r.top + n.scrollTop - l.y - f;
4812
4819
  return {
@@ -4843,7 +4850,7 @@ function xe(a, t) {
4843
4850
  let i = Gt(a, t);
4844
4851
  for (; i && Ti(i) && mt(i); )
4845
4852
  i = Gt(i, t);
4846
- return i && Q(i) && mt(i) && !Dt(i) ? e : i || Li(a) || e;
4853
+ return i && Q(i) && mt(i) && !Dt(i) ? e : i || Ai(a) || e;
4847
4854
  }
4848
4855
  const Wi = async function(a) {
4849
4856
  const t = this.getOffsetParent || xe, e = this.getDimensions, i = await e(a.floating);