e-virt-table 1.1.0 → 1.1.1

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
@@ -143,7 +143,7 @@ function Xt(a, t, e) {
143
143
  }
144
144
  r([]);
145
145
  }
146
- function Le(a) {
146
+ function Ae(a) {
147
147
  var t = [];
148
148
  return Object.keys(a).forEach(function(e) {
149
149
  t.push.apply(t, a[e] || []);
@@ -157,12 +157,12 @@ var kt = /* @__PURE__ */ function(a) {
157
157
  }
158
158
  return t;
159
159
  }(/* @__PURE__ */ Ct(Error));
160
- function Ae(a, t, e, i, s) {
160
+ function Te(a, t, e, i, s) {
161
161
  if (t.first) {
162
162
  var r = new Promise(function(x, u) {
163
163
  var p = function(y) {
164
164
  return i(y), y.length ? u(new kt(y, bt(y))) : x(s);
165
- }, g = Le(a);
165
+ }, g = Ae(a);
166
166
  Xt(g, e, p);
167
167
  });
168
168
  return r.catch(function(x) {
@@ -183,7 +183,7 @@ function Ae(a, t, e, i, s) {
183
183
  return x;
184
184
  }), f;
185
185
  }
186
- function Te(a) {
186
+ function Le(a) {
187
187
  return !!(a && a.message !== void 0);
188
188
  }
189
189
  function Me(a, t) {
@@ -197,7 +197,7 @@ function Me(a, t) {
197
197
  function Nt(a, t) {
198
198
  return function(e) {
199
199
  var i;
200
- return a.fullFields ? i = Me(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 = Me(t, a.fullFields) : i = t[e.field || a.fullField], Le(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
@@ -570,7 +570,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
570
570
  });
571
571
  });
572
572
  var p = {};
573
- return Ae(x, h, function(g, w) {
573
+ return Te(x, h, function(g, w) {
574
574
  var y = g.rule, E = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
575
575
  E = E && (y.required || !y.required && g.value), y.field = g.field;
576
576
  function m(R, S) {
@@ -583,27 +583,27 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
583
583
  R === void 0 && (R = []);
584
584
  var S = Array.isArray(R) ? R : [R];
585
585
  !h.suppressWarning && S.length && a.warning("async-validator:", S), S.length && y.message !== void 0 && (S = [].concat(y.message));
586
- var L = S.map(Nt(y, n));
587
- if (h.first && L.length)
588
- return p[y.field] = 1, w(L);
586
+ var A = S.map(Nt(y, n));
587
+ if (h.first && A.length)
588
+ return p[y.field] = 1, w(A);
589
589
  if (!E)
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)) : h.error && (L = [h.error(y, D(h.messages.required, y.field))]), w(L);
593
+ return y.message !== void 0 ? A = [].concat(y.message).map(Nt(y, n)) : h.error && (A = [h.error(y, D(h.messages.required, y.field))]), w(A);
594
594
  var I = {};
595
595
  y.defaultField && Object.keys(g.value).map(function(O) {
596
596
  I[O] = y.defaultField;
597
597
  }), I = G({}, I, g.rule.fields);
598
598
  var v = {};
599
599
  Object.keys(I).forEach(function(O) {
600
- var M = I[O], T = Array.isArray(M) ? M : [M];
601
- v[O] = T.map(m.bind(null, O));
600
+ var M = I[O], L = Array.isArray(M) ? M : [M];
601
+ v[O] = L.map(m.bind(null, O));
602
602
  });
603
- var A = new a(v);
604
- A.messages(h.messages), g.rule.options && (g.rule.options.messages = h.messages, g.rule.options.error = h.error), A.validate(g.value, g.rule.options || h, function(O) {
603
+ var T = new a(v);
604
+ T.messages(h.messages), g.rule.options && (g.rule.options.messages = h.messages, g.rule.options.error = h.error), T.validate(g.value, g.rule.options || h, function(O) {
605
605
  var M = [];
606
- L && L.length && M.push.apply(M, L), O && O.length && M.push.apply(M, O), w(M.length ? M : null);
606
+ A && A.length && M.push.apply(M, A), O && O.length && M.push.apply(M, O), w(M.length ? M : null);
607
607
  });
608
608
  }
609
609
  }
@@ -843,7 +843,7 @@ class se {
843
843
  getRightFixedX() {
844
844
  }
845
845
  }
846
- class Tt extends se {
846
+ class Lt extends se {
847
847
  constructor(e, i, s, r, o, n, h, c, d, f = "body") {
848
848
  super(e, r, o, n, h, f, c.fixed);
849
849
  l(this, "formatter");
@@ -1630,6 +1630,7 @@ class ni {
1630
1630
  rowKey: d.rowKey,
1631
1631
  key: d.key,
1632
1632
  value: d.newValue,
1633
+ oldValue: d.oldValue,
1633
1634
  row: f
1634
1635
  };
1635
1636
  });
@@ -1689,6 +1690,7 @@ class ni {
1689
1690
  const u = this.ctx.database.getRowDataItemForRowKey(t), p = {
1690
1691
  rowKey: t,
1691
1692
  key: e,
1693
+ oldValue: h,
1692
1694
  value: f,
1693
1695
  row: u
1694
1696
  };
@@ -2047,16 +2049,16 @@ class ni {
2047
2049
  }
2048
2050
  ]
2049
2051
  };
2050
- let w = e, y = e, E = n, m = n, C = [], b = 0, R = 0, S = 0, L = 0;
2052
+ let w = e, y = e, E = n, m = n, C = [], b = 0, R = 0, S = 0, A = 0;
2051
2053
  if (d !== 1 && p) {
2052
- L = x;
2053
- const I = h.reduce((v, A) => {
2054
- const O = this.getItemValue(s, A) ?? "";
2054
+ A = x;
2055
+ const I = h.reduce((v, T) => {
2056
+ const O = this.getItemValue(s, T) ?? "";
2055
2057
  return `${v}${O}`;
2056
2058
  }, "");
2057
2059
  for (let v = e - 1; v >= 0; v--) {
2058
- const A = this.rowIndexRowKeyMap.get(v) || "", O = h.reduce((M, T) => {
2059
- const N = this.getItemValue(A, T) ?? "";
2060
+ const T = this.rowIndexRowKeyMap.get(v) || "", O = h.reduce((M, L) => {
2061
+ const N = this.getItemValue(T, L) ?? "";
2060
2062
  return `${M}${N}`;
2061
2063
  }, "");
2062
2064
  if (I === O)
@@ -2065,8 +2067,8 @@ class ni {
2065
2067
  break;
2066
2068
  }
2067
2069
  for (let v = e; v <= this.ctx.maxRowIndex; v++) {
2068
- const A = this.rowIndexRowKeyMap.get(v) || "", O = h.reduce((M, T) => {
2069
- const N = this.getItemValue(A, T) ?? "";
2070
+ const T = this.rowIndexRowKeyMap.get(v) || "", O = h.reduce((M, L) => {
2071
+ const N = this.getItemValue(T, L) ?? "";
2070
2072
  return `${M}${N}`;
2071
2073
  }, "");
2072
2074
  if (I === O)
@@ -2075,17 +2077,17 @@ class ni {
2075
2077
  break;
2076
2078
  }
2077
2079
  for (let v = w; v < e; v++) {
2078
- const { height: A } = this.positions[v];
2079
- b += A;
2080
+ const { height: T } = this.positions[v];
2081
+ b += T;
2080
2082
  }
2081
2083
  for (let v = w; v <= y; v++) {
2082
- const { height: A } = this.positions[v];
2083
- S += A;
2084
- const O = this.rowIndexRowKeyMap.get(v) || "", { item: M } = this.rowKeyMap.get(O), T = this.getItemValue(O, i);
2084
+ const { height: T } = this.positions[v];
2085
+ S += T;
2086
+ const O = this.rowIndexRowKeyMap.get(v) || "", { item: M } = this.rowKeyMap.get(O), L = this.getItemValue(O, i);
2085
2087
  C.push({
2086
2088
  rowKey: O,
2087
2089
  key: i,
2088
- value: T,
2090
+ value: L,
2089
2091
  row: M
2090
2092
  });
2091
2093
  }
@@ -2096,8 +2098,8 @@ class ni {
2096
2098
  const v = this.getColumnByColIndex(I);
2097
2099
  if (!v)
2098
2100
  break;
2099
- const A = this.getItemValue(s, i), O = this.getItemValue(s, v.key);
2100
- if (A === O && c.includes(v.key))
2101
+ const T = this.getItemValue(s, i), O = this.getItemValue(s, v.key);
2102
+ if (T === O && c.includes(v.key))
2101
2103
  E = I;
2102
2104
  else
2103
2105
  break;
@@ -2106,8 +2108,8 @@ class ni {
2106
2108
  const v = this.getColumnByColIndex(I);
2107
2109
  if (!v)
2108
2110
  break;
2109
- const A = this.getItemValue(s, i), O = this.getItemValue(s, v.key);
2110
- if (A === O && c.includes(v.key))
2111
+ const T = this.getItemValue(s, i), O = this.getItemValue(s, v.key);
2112
+ if (T === O && c.includes(v.key))
2111
2113
  m = I;
2112
2114
  else
2113
2115
  break;
@@ -2122,7 +2124,7 @@ class ni {
2122
2124
  const v = this.getColumnByColIndex(I);
2123
2125
  if (!v)
2124
2126
  break;
2125
- L += v.width || 100, C.push({
2127
+ A += v.width || 100, C.push({
2126
2128
  rowKey: s,
2127
2129
  key: v.key,
2128
2130
  value: this.getItemValue(s, v.key),
@@ -2136,7 +2138,7 @@ class ni {
2136
2138
  rowspan: d,
2137
2139
  colspan: u,
2138
2140
  height: S,
2139
- width: L,
2141
+ width: A,
2140
2142
  offsetTop: b,
2141
2143
  offsetLeft: R,
2142
2144
  dataList: C
@@ -2171,7 +2173,7 @@ class ni {
2171
2173
  // 获取虚拟单元格
2172
2174
  getVirtualBodyCell(t, e) {
2173
2175
  const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
2174
- return !i || !s ? void 0 : new Tt(this.ctx, t, e, 0, 0, 0, 0, i, s, "body");
2176
+ return !i || !s ? void 0 : new Lt(this.ctx, t, e, 0, 0, 0, 0, i, s, "body");
2175
2177
  }
2176
2178
  hasMergeCell(t, e) {
2177
2179
  let i = !1;
@@ -2248,7 +2250,9 @@ class li {
2248
2250
  this.ctx = t, this.init();
2249
2251
  }
2250
2252
  init() {
2251
- this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(this.ctx.stageElement, "click", this.handleClick.bind(this)), this.bind(window, "keydown", this.handleKeydown.bind(this)), this.bind(this.ctx.stageElement, "wheel", this.handleWheel.bind(this)), this.bind(this.ctx.stageElement, "touchstart", this.handleTouchstart.bind(this)), this.bind(this.ctx.stageElement, "touchend", this.handleTouchend.bind(this)), this.bind(this.ctx.stageElement, "touchmove", this.handleTouchmove.bind(this)), this.bind(this.ctx.stageElement, "contextmenu", this.handleContextMenu.bind(this)), this.bind(this.ctx.stageElement, "mousedown", this.handleMouseDown.bind(this)), this.bind(this.ctx.stageElement, "dblclick", this.handleDblclick.bind(this)), this.bind(this.ctx.stageElement, "mouseover", this.handleMouseover.bind(this)), this.bind(this.ctx.stageElement, "mouseout", this.handleMouseout.bind(this)), this.bind(this.ctx.containerElement, "focusin", this.handleFocusin.bind(this)), this.bind(this.ctx.containerElement, "focusout", this.handleFocusout.bind(this));
2253
+ this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(window, "mousedown", (t) => {
2254
+ this.ctx.containerElement.contains(t.target) || this.ctx.emit("outsideMousedown", t);
2255
+ }), this.bind(this.ctx.stageElement, "click", this.handleClick.bind(this)), this.bind(window, "keydown", this.handleKeydown.bind(this)), this.bind(this.ctx.stageElement, "wheel", this.handleWheel.bind(this)), this.bind(this.ctx.stageElement, "touchstart", this.handleTouchstart.bind(this)), this.bind(this.ctx.stageElement, "touchend", this.handleTouchend.bind(this)), this.bind(this.ctx.stageElement, "touchmove", this.handleTouchmove.bind(this)), this.bind(this.ctx.stageElement, "contextmenu", this.handleContextMenu.bind(this)), this.bind(this.ctx.stageElement, "mousedown", this.handleMouseDown.bind(this)), this.bind(this.ctx.stageElement, "dblclick", this.handleDblclick.bind(this)), this.bind(this.ctx.stageElement, "mouseover", this.handleMouseover.bind(this)), this.bind(this.ctx.stageElement, "mouseout", this.handleMouseout.bind(this));
2252
2256
  }
2253
2257
  destroy() {
2254
2258
  this.eventTasks.forEach((t, e) => {
@@ -2272,7 +2276,7 @@ class li {
2272
2276
  }
2273
2277
  handleKeydown(t) {
2274
2278
  const { ENABLE_KEYBOARD: e } = this.ctx.config;
2275
- e && this.ctx.isTarget() && this.ctx.emit("keydown", t);
2279
+ e && this.ctx.isTarget(t) && this.ctx.emit("keydown", t);
2276
2280
  }
2277
2281
  handleWheel(t) {
2278
2282
  this.ctx.emit("wheel", t);
@@ -2290,20 +2294,14 @@ class li {
2290
2294
  this.ctx.emit("contextMenu", t);
2291
2295
  }
2292
2296
  handleMouseover(t) {
2293
- this.ctx.isInsideTargetContainer = !0, this.ctx.emit("mouseover", t);
2297
+ this.ctx.isMouseoverTargetContainer = !0, this.ctx.emit("mouseover", t);
2294
2298
  }
2295
2299
  handleMouseout(t) {
2296
- this.ctx.emit("mouseout", t);
2300
+ this.ctx.isMouseoverTargetContainer = !1, this.ctx.emit("mouseout", t);
2297
2301
  }
2298
2302
  handleDblclick(t) {
2299
2303
  this.ctx.emit("dblclick", t);
2300
2304
  }
2301
- handleFocusin(t) {
2302
- this.ctx.isInsideTargetContainer = !0, this.ctx.emit("focusin", t);
2303
- }
2304
- handleFocusout(t) {
2305
- this.ctx.isInsideTargetContainer = !1, this.ctx.emit("focusout", t);
2306
- }
2307
2305
  bind(t, e, i, s) {
2308
2306
  t.addEventListener(e, i, s), this.eventTasks.set(e, i);
2309
2307
  }
@@ -2974,11 +2972,11 @@ class fi {
2974
2972
  */
2975
2973
  imageEnterAndLeave(t, e) {
2976
2974
  const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s;
2977
- o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight ? (this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof Tt && ["selection", "index-selection"].includes(t.type) && (this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed"))) : (this.ctx.isPointer = !1, this.ctx.stageElement.style.cursor === "pointer" && (this.ctx.stageElement.style.cursor = "default"));
2975
+ o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight ? (this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof Lt && ["selection", "index-selection"].includes(t.type) && (this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed"))) : (this.ctx.isPointer = !1, this.ctx.stageElement.style.cursor === "pointer" && (this.ctx.stageElement.style.cursor = "default"));
2978
2976
  }
2979
2977
  isBusy(t) {
2980
2978
  const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
2981
- if (!this.ctx.isTarget() || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
2979
+ if (!this.ctx.isTarget(t) || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
2982
2980
  return !0;
2983
2981
  const { SCROLLER_TRACK_SIZE: o } = this.ctx.config;
2984
2982
  return !!(this.ctx.scrollerMove || this.ctx.scrollerFocus || s > this.ctx.stageHeight - o || r > this.ctx.stageWidth - o);
@@ -3033,7 +3031,7 @@ class xi {
3033
3031
  l(this, "stageHeight", 0);
3034
3032
  l(this, "paint");
3035
3033
  l(this, "icons");
3036
- l(this, "isInsideTargetContainer", !1);
3034
+ l(this, "isMouseoverTargetContainer", !1);
3037
3035
  l(this, "mousedown", !1);
3038
3036
  l(this, "isPointer", !1);
3039
3037
  l(this, "rowResizing", !1);
@@ -3167,7 +3165,7 @@ class xi {
3167
3165
  this.focusCell !== t && (((e = this.focusCell) == null ? void 0 : e.rowKey) !== t.rowKey && (this.focusCell = t, this.emit("rowFocusChange", t)), this.focusCell = t, this.emit("cellFocusChange", t));
3168
3166
  }
3169
3167
  clearSelector() {
3170
- this.selector.enable = !1, this.selector.xArr = [-1, -1], this.selector.yArr = [-1, -1];
3168
+ this.selector.enable = !1, this.selector.xArr = [-1, -1], this.selector.yArr = [-1, -1], this.emit("clearSelector");
3171
3169
  }
3172
3170
  clearSelectorCopy() {
3173
3171
  this.selector.xArrCopy = [-1, -1], this.selector.yArrCopy = [-1, -1];
@@ -3219,8 +3217,8 @@ class xi {
3219
3217
  const s = this.body.height - this.body.visibleHeight + i;
3220
3218
  e < 0 ? e = 0 : e > s && (e = s), this.emit("setScrollY", e);
3221
3219
  }
3222
- isTarget() {
3223
- return this.isInsideTargetContainer;
3220
+ isTarget(t) {
3221
+ return !!this.containerElement.contains(t.target);
3224
3222
  }
3225
3223
  getOffset(t) {
3226
3224
  const { left: e, top: i } = this.containerElement.getBoundingClientRect();
@@ -3288,7 +3286,7 @@ class Pt {
3288
3286
  this.clientX = i, this.clientY = e, this.dragStart = this.scroll;
3289
3287
  }
3290
3288
  onMouseDown(t) {
3291
- if (!(t.target instanceof Element) || !this.ctx.isTarget())
3289
+ if (!(t.target instanceof Element) || !this.ctx.isTarget(t))
3292
3290
  return;
3293
3291
  if (this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize")
3294
3292
  return !0;
@@ -3510,7 +3508,7 @@ class gi {
3510
3508
  config: { ENABLE_RESIZE_COLUMN: t }
3511
3509
  } = this.ctx;
3512
3510
  t && (this.ctx.on("mousedown", (e) => {
3513
- this.ctx.isTarget() && (this.clientX = e.clientX, this.resizeTarget ? (this.isResizing = !0, this.ctx.columnResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
3511
+ this.ctx.isTarget(e) && (this.clientX = e.clientX, this.resizeTarget ? (this.isResizing = !0, this.ctx.columnResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
3514
3512
  }), this.ctx.on("mouseup", () => {
3515
3513
  this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeColumn(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.isResizing = !1, this.ctx.columnResizing = !1, this.clientX = 0;
3516
3514
  }), this.ctx.on("mousemove", (e) => {
@@ -3531,7 +3529,7 @@ class gi {
3531
3529
  for (const o of r) {
3532
3530
  const { offsetX: n, offsetY: h } = this.ctx.getOffset(e), c = n, d = o.getDrawX();
3533
3531
  c > d + o.width - 5 && c < d + o.width + 4 && c < i - 4 && // 视窗中最后一列不允许调整宽
3534
- o.colspan <= 1 && this.ctx.isTarget() && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
3532
+ o.colspan <= 1 && this.ctx.isTarget(e) && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
3535
3533
  }
3536
3534
  }
3537
3535
  }));
@@ -3667,7 +3665,7 @@ class oe {
3667
3665
  update() {
3668
3666
  const { header: t } = this.ctx, e = [], i = [], s = [];
3669
3667
  t.renderLeafCellHeaders.forEach((r) => {
3670
- const o = new Tt(
3668
+ const o = new Lt(
3671
3669
  this.ctx,
3672
3670
  this.rowIndex,
3673
3671
  r.colIndex,
@@ -3786,7 +3784,7 @@ class wi {
3786
3784
  this.ctx.rowResizing = !1;
3787
3785
  }, 0), this.clientY = 0;
3788
3786
  }), this.ctx.on("mousedown", (e) => {
3789
- this.ctx.isTarget() && (this.clientY = e.clientY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
3787
+ this.ctx.isTarget(e) && (this.clientY = e.clientY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
3790
3788
  }), this.ctx.on("mousemove", (e) => {
3791
3789
  if (this.ctx.editing) return;
3792
3790
  const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, n = e.clientY, {
@@ -3985,14 +3983,12 @@ class yi {
3985
3983
  this.ctx = t, this.init();
3986
3984
  }
3987
3985
  init() {
3988
- this.ctx.on("focusout", () => {
3989
- this.ctx.clearSelector(), this.ctx.emit("drawView");
3990
- }), this.ctx.on("setMoveFocus", (t) => {
3986
+ this.ctx.on("setMoveFocus", (t) => {
3991
3987
  this.moveFocus(t);
3992
3988
  }), this.ctx.on(
3993
3989
  "mousemove",
3994
3990
  Jt((t) => {
3995
- const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget() && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
3991
+ const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget(t) && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
3996
3992
  (this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
3997
3993
  }, 100)
3998
3994
  ), this.ctx.on("cellHoverChange", (t) => {
@@ -4004,7 +4000,7 @@ class yi {
4004
4000
  this.isMultipleRow || this.mouseenter();
4005
4001
  }
4006
4002
  }), this.ctx.on("cellMousedown", (t, e) => {
4007
- if (this.ctx.isTarget() && this.ctx.stageElement.style.cursor !== "pointer" && !this.ctx.isPointer && this.ctx.stageElement.style.cursor !== "crosshair") {
4003
+ if (this.ctx.isTarget(e) && this.ctx.stageElement.style.cursor !== "pointer" && !this.ctx.isPointer && this.ctx.stageElement.style.cursor !== "crosshair") {
4008
4004
  if (t.operation) {
4009
4005
  this.isMultipleRow = !0, this.selectRows(t);
4010
4006
  return;
@@ -4414,7 +4410,7 @@ class yi {
4414
4410
  break;
4415
4411
  }
4416
4412
  const c = [i, i], d = [s, s], f = this.getCell(s, i);
4417
- f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(c, d), this.adjustBoundaryPosition(), this.ctx.emit("draw")));
4413
+ f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(c, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
4418
4414
  }
4419
4415
  stopAdjustPosition() {
4420
4416
  this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
@@ -4479,11 +4475,11 @@ class yi {
4479
4475
  const { drawX: g, drawY: w, width: y, height: E, fixed: m } = i, C = r - g + 1, b = i.drawX + y - (e - s) + 1;
4480
4476
  let R = o.height - w, S = E;
4481
4477
  S > h.visibleHeight && (S = h.visibleHeight);
4482
- let L = 0;
4483
- x && (u === "top" ? R = o.height + n.height - w : L = n.visibleHeight);
4484
- const I = w + S - (t - L - f);
4485
- let v = c, A = d;
4486
- b > 0 && !m ? v = Math.floor(c + b) : C > 0 && !m && (v = Math.floor(c - C)), R > 0 ? A = Math.floor(d - R) : I > 0 && (A = Math.floor(d + I)), (Math.abs(c - v) > 2 || Math.abs(d - A) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(v, A), this.ctx.emit("adjustBoundaryPosition", i));
4478
+ let A = 0;
4479
+ x && (u === "top" ? R = o.height + n.height - w : A = n.visibleHeight);
4480
+ const I = w + S - (t - A - f);
4481
+ let v = c, T = d;
4482
+ b > 0 && !m ? v = Math.floor(c + b) : C > 0 && !m && (v = Math.floor(c - C)), R > 0 ? T = Math.floor(d - R) : I > 0 && (T = Math.floor(d + I)), (Math.abs(c - v) > 2 || Math.abs(d - T) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(v, T), this.ctx.emit("adjustBoundaryPosition", i));
4487
4483
  }
4488
4484
  destroy() {
4489
4485
  this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
@@ -4553,14 +4549,14 @@ class mi {
4553
4549
  o = [Math.max(p, E), Math.min(g, m)], n = [Math.max(w, C), Math.min(y, b)];
4554
4550
  const { BEFORE_SET_AUTOFILL_METHOD: R } = this.ctx.config;
4555
4551
  if (typeof R == "function") {
4556
- const L = R({
4552
+ const A = R({
4557
4553
  focusCell: this.ctx.focusCell,
4558
4554
  xArr: o,
4559
4555
  yArr: n
4560
4556
  });
4561
- if (!L)
4557
+ if (!A)
4562
4558
  return;
4563
- o = L.xArr, n = L.yArr;
4559
+ o = A.xArr, n = A.yArr;
4564
4560
  }
4565
4561
  this.ctx.autofill.xArr = o, this.ctx.autofill.yArr = n, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
4566
4562
  }
@@ -4914,12 +4910,12 @@ const Si = (a) => ({
4914
4910
  }, u = Ht(s), p = Mt(u), g = await o.getDimensions(c), w = u === "y", y = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", C = r.reference[p] + r.reference[u] - x[u] - r.floating[p], b = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c));
4915
4911
  let S = R ? R[m] : 0;
4916
4912
  (!S || !await (o.isElement == null ? void 0 : o.isElement(R))) && (S = n.floating[m] || r.floating[p]);
4917
- const L = C / 2 - b / 2, I = S / 2 - g[p] / 2 - 1, v = rt(f[y], I), A = rt(f[E], I), O = v, M = S - g[p] - A, T = S / 2 - g[p] / 2 + L, N = _t(O, T, M), Y = !h.arrow && lt(s) != null && T !== N && r.reference[p] / 2 - (T < O ? v : A) - g[p] / 2 < 0, K = Y ? T < O ? T - O : T - M : 0;
4913
+ const A = C / 2 - b / 2, I = S / 2 - g[p] / 2 - 1, v = rt(f[y], I), T = rt(f[E], I), O = v, M = S - g[p] - T, L = S / 2 - g[p] / 2 + A, N = _t(O, L, M), Y = !h.arrow && lt(s) != null && L !== N && r.reference[p] / 2 - (L < O ? v : T) - g[p] / 2 < 0, K = Y ? L < O ? L - O : L - M : 0;
4918
4914
  return {
4919
4915
  [u]: x[u] + K,
4920
4916
  data: {
4921
4917
  [u]: N,
4922
- centerOffset: T - N - K,
4918
+ centerOffset: L - N - K,
4923
4919
  ...Y && {
4924
4920
  alignmentOffset: K
4925
4921
  }
@@ -4927,7 +4923,7 @@ const Si = (a) => ({
4927
4923
  reset: Y
4928
4924
  };
4929
4925
  }
4930
- }), Li = function(a) {
4926
+ }), Ai = function(a) {
4931
4927
  return a === void 0 && (a = {}), {
4932
4928
  name: "flip",
4933
4929
  options: a,
@@ -4953,22 +4949,22 @@ const Si = (a) => ({
4953
4949
  return {};
4954
4950
  const y = q(s), E = J(n), m = q(n) === n, C = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), b = x || (m || !g ? [xt(n)] : vi(n)), R = p !== "none";
4955
4951
  !x && R && b.push(...Ii(n, g, p, C));
4956
- const S = [n, ...b], L = await le(t, w), I = [];
4952
+ const S = [n, ...b], A = await le(t, w), I = [];
4957
4953
  let v = ((i = r.flip) == null ? void 0 : i.overflows) || [];
4958
- if (d && I.push(L[y]), f) {
4959
- const T = bi(s, o, C);
4960
- I.push(L[T[0]], L[T[1]]);
4954
+ if (d && I.push(A[y]), f) {
4955
+ const L = bi(s, o, C);
4956
+ I.push(A[L[0]], A[L[1]]);
4961
4957
  }
4962
4958
  if (v = [...v, {
4963
4959
  placement: s,
4964
4960
  overflows: I
4965
- }], !I.every((T) => T <= 0)) {
4966
- var A, O;
4967
- const T = (((A = r.flip) == null ? void 0 : A.index) || 0) + 1, N = S[T];
4961
+ }], !I.every((L) => L <= 0)) {
4962
+ var T, O;
4963
+ const L = (((T = r.flip) == null ? void 0 : T.index) || 0) + 1, N = S[L];
4968
4964
  if (N)
4969
4965
  return {
4970
4966
  data: {
4971
- index: T,
4967
+ index: L,
4972
4968
  overflows: v
4973
4969
  },
4974
4970
  reset: {
@@ -5007,7 +5003,7 @@ const Si = (a) => ({
5007
5003
  }
5008
5004
  };
5009
5005
  };
5010
- async function Ai(a, t) {
5006
+ async function Ti(a, t) {
5011
5007
  const {
5012
5008
  placement: e,
5013
5009
  platform: i,
@@ -5034,7 +5030,7 @@ async function Ai(a, t) {
5034
5030
  y: u * d
5035
5031
  };
5036
5032
  }
5037
- const Ti = function(a) {
5033
+ const Li = function(a) {
5038
5034
  return a === void 0 && (a = 0), {
5039
5035
  name: "offset",
5040
5036
  options: a,
@@ -5045,7 +5041,7 @@ const Ti = function(a) {
5045
5041
  y: r,
5046
5042
  placement: o,
5047
5043
  middlewareData: n
5048
- } = t, h = await Ai(t, a);
5044
+ } = t, h = await Ti(t, a);
5049
5045
  return o === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
5050
5046
  x: s + h.x,
5051
5047
  y: r + h.y,
@@ -5214,12 +5210,12 @@ function St(a, t, e) {
5214
5210
  t === void 0 && (t = []), e === void 0 && (e = !0);
5215
5211
  const s = ce(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = F(s);
5216
5212
  if (r) {
5217
- const n = Lt(o);
5213
+ const n = At(o);
5218
5214
  return t.concat(o, o.visualViewport || [], ht(s) ? s : [], n && e ? St(n) : []);
5219
5215
  }
5220
5216
  return t.concat(s, St(s, [], e));
5221
5217
  }
5222
- function Lt(a) {
5218
+ function At(a) {
5223
5219
  return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
5224
5220
  }
5225
5221
  function de(a) {
@@ -5270,10 +5266,10 @@ function ot(a, t, e, i) {
5270
5266
  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;
5271
5267
  if (r) {
5272
5268
  const x = F(r), u = i && X(i) ? F(i) : i;
5273
- let p = x, g = Lt(p);
5269
+ let p = x, g = At(p);
5274
5270
  for (; g && i && u !== p; ) {
5275
5271
  const w = Z(g), y = g.getBoundingClientRect(), E = k(g), m = y.left + (g.clientLeft + parseFloat(E.paddingLeft)) * w.x, C = y.top + (g.clientTop + parseFloat(E.paddingTop)) * w.y;
5276
- h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += C, p = F(g), g = Lt(p);
5272
+ h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += C, p = F(g), g = At(p);
5277
5273
  }
5278
5274
  }
5279
5275
  return ut({
@@ -5312,13 +5308,13 @@ function ki(a) {
5312
5308
  function Ni(a) {
5313
5309
  return Array.from(a.getClientRects());
5314
5310
  }
5315
- function At(a, t) {
5311
+ function Tt(a, t) {
5316
5312
  const e = pt(a).scrollLeft;
5317
5313
  return t ? t.left + e : ot(V(a)).left + e;
5318
5314
  }
5319
5315
  function Ki(a) {
5320
5316
  const t = V(a), e = pt(a), i = a.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
5321
- let o = -e.scrollLeft + At(a);
5317
+ let o = -e.scrollLeft + Tt(a);
5322
5318
  const n = -e.scrollTop;
5323
5319
  return k(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
5324
5320
  width: s,
@@ -5425,12 +5421,12 @@ function zi(a, t, e) {
5425
5421
  if ((tt(t) !== "body" || ht(s)) && (n = pt(t)), i) {
5426
5422
  const u = ot(t, !0, r, t);
5427
5423
  h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
5428
- } else s && (h.x = At(s));
5424
+ } else s && (h.x = Tt(s));
5429
5425
  let c = 0, d = 0;
5430
5426
  if (s && !i && !r) {
5431
5427
  const u = s.getBoundingClientRect();
5432
5428
  d = u.top + n.scrollTop, c = u.left + n.scrollLeft - // RTL <body> scrollbar.
5433
- At(s, u);
5429
+ Tt(s, u);
5434
5430
  }
5435
5431
  const f = o.left + n.scrollLeft - h.x - c, x = o.top + n.scrollTop - h.y - d;
5436
5432
  return {
@@ -5495,7 +5491,7 @@ const qi = {
5495
5491
  getScale: Z,
5496
5492
  isElement: X,
5497
5493
  isRTL: Gi
5498
- }, we = Ti, pe = Mi, ye = Li, ji = Si, me = (a, t, e) => {
5494
+ }, we = Li, pe = Mi, ye = Ai, ji = Si, me = (a, t, e) => {
5499
5495
  const i = /* @__PURE__ */ new Map(), s = {
5500
5496
  platform: qi,
5501
5497
  ...e
@@ -5542,7 +5538,7 @@ let Ui = class {
5542
5538
  }
5543
5539
  init() {
5544
5540
  this.ctx.on("mousemove", (t) => {
5545
- if (!this.ctx.isTarget())
5541
+ if (!this.ctx.isTarget(t))
5546
5542
  return;
5547
5543
  const e = this.ctx.containerElement.getBoundingClientRect();
5548
5544
  e && (t.clientX < e.x || t.clientX > e.x + e.width || t.clientY < e.y || t.clientY > e.y + e.height) && this.hide();
@@ -5633,14 +5629,18 @@ class Zi {
5633
5629
  this.ctx = t, this.initTextEditor(), this.init();
5634
5630
  }
5635
5631
  init() {
5636
- this.ctx.on("focusout", (t) => {
5637
- t.target !== this.ctx.stageElement && (this.ctx.editing && this.doneEdit(), this.cellTarget = null);
5632
+ this.ctx.on("outsideMousedown", () => {
5633
+ this.cellTarget && this.cellTarget.editorType === "text" && this.clearEditor();
5634
+ }), this.ctx.on("moveFocus", (t) => {
5635
+ this.cellTarget = t;
5636
+ const { xArr: e, yArr: i } = this.ctx.selector;
5637
+ this.selectorArrStr = JSON.stringify(e) + JSON.stringify(i);
5638
5638
  }), this.ctx.on("onScroll", () => {
5639
5639
  this.enable && this.doneEdit();
5640
5640
  }), this.ctx.on("cellHeaderMousedown", () => {
5641
5641
  this.enable && this.doneEdit(), this.cellTarget = null;
5642
5642
  }), this.ctx.on("keydown", (t) => {
5643
- if (!this.ctx.isTarget())
5643
+ if (!this.ctx.isTarget(t))
5644
5644
  return;
5645
5645
  if (t.code === "Escape" && this.ctx.editing) {
5646
5646
  this.cancel = !0;
@@ -5656,9 +5656,7 @@ class Zi {
5656
5656
  return;
5657
5657
  }
5658
5658
  if (t.code === "Enter" && this.ctx.editing) {
5659
- t.preventDefault(), this.doneEdit();
5660
- const { focusCell: h } = this.ctx;
5661
- if (h && (this.ctx.emit("setSelectorCell", h), this.cellTarget = h), t.shiftKey) {
5659
+ if (t.preventDefault(), this.doneEdit(), t.shiftKey) {
5662
5660
  this.ctx.emit("setMoveFocus", "TOP");
5663
5661
  return;
5664
5662
  }
@@ -5726,7 +5724,9 @@ class Zi {
5726
5724
  return !(e < r || e > o || t < n || t > h);
5727
5725
  }
5728
5726
  initTextEditor() {
5729
- this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.editorEl = this.ctx.editorElement, this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
5727
+ this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
5728
+ this.doneEdit(), this.cellTarget = null;
5729
+ }), this.editorEl = this.ctx.editorElement, this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
5730
5730
  }
5731
5731
  autoSize() {
5732
5732
  this.inputEl.style.height = "auto";
@@ -5759,7 +5759,7 @@ class Zi {
5759
5759
  (this.inputEl.scrollHeight > n || o < d.height) && this.autoSize();
5760
5760
  }
5761
5761
  doneEditByInput() {
5762
- if (this.cellTarget && (this.editorEl.style.display = "none", this.cellTarget.editorType === "text")) {
5762
+ if (this.cellTarget && this.cellTarget.editorType === "text") {
5763
5763
  const { rowKey: t, key: e } = this.cellTarget, i = this.cellTarget.getValue(), s = this.inputEl.value;
5764
5764
  s !== i && !(s === "" && i === null) && !this.cancel && this.ctx.setItemValueByEditor(t, e, s, !0), this.inputEl.value = "";
5765
5765
  }
@@ -5793,7 +5793,10 @@ class Zi {
5793
5793
  r && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
5794
5794
  }
5795
5795
  doneEdit() {
5796
- this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.emit("drawView"));
5796
+ this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.containerElement.focus(), this.editorEl.style.display = "none", this.ctx.emit("drawView"));
5797
+ }
5798
+ clearEditor() {
5799
+ this.doneEdit(), this.cellTarget = null, this.selectorArrStr = "", this.ctx.clearSelector(), this.ctx.emit("drawView");
5797
5800
  }
5798
5801
  destroy() {
5799
5802
  var t;
@@ -6193,6 +6196,9 @@ class ss {
6193
6196
  setItemValueByEditor(t, e, i, s = !0, r = !0) {
6194
6197
  this.ctx.setItemValueByEditor(t, e, i, s, r), this.editor.doneEdit();
6195
6198
  }
6199
+ clearEditor() {
6200
+ this.editor.clearEditor();
6201
+ }
6196
6202
  doLayout() {
6197
6203
  this.ctx.emit("draw");
6198
6204
  }
@@ -6205,6 +6211,26 @@ class ss {
6205
6211
  clearValidate() {
6206
6212
  this.ctx.database.clearValidate(), this.ctx.emit("draw");
6207
6213
  }
6214
+ validateFields(t, e = !0) {
6215
+ return new Promise(async (i, s) => {
6216
+ let r = [];
6217
+ for (let o = 0; o < t.length; o++) {
6218
+ const { rowKey: n, key: h } = t[o], c = await this.ctx.database.getValidator(n, h);
6219
+ Array.isArray(c) && c.length && r.push(c);
6220
+ }
6221
+ if (r.length) {
6222
+ if (s(r), e) {
6223
+ const [o] = r;
6224
+ if (Array.isArray(o) && o.length) {
6225
+ const [n] = o, { rowKey: h, key: c } = n;
6226
+ this.scrollToRowkey(h), this.scrollToColkey(c);
6227
+ }
6228
+ }
6229
+ this.ctx.emit("draw");
6230
+ } else
6231
+ i([]), this.ctx.emit("draw");
6232
+ });
6233
+ }
6208
6234
  async validate(t = !0) {
6209
6235
  return this.editor.doneEdit(), new Promise(async (e, i) => {
6210
6236
  try {