e-virt-table 0.0.5 → 0.0.7

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 Oe(a, t, e, i, s) {
186
186
  function _e(a) {
187
187
  return !!(a && a.message !== void 0);
188
188
  }
189
- function Se(a, t) {
189
+ function Te(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 Se(a, t) {
197
197
  function Nt(a, t) {
198
198
  return function(e) {
199
199
  var i;
200
- return a.fullFields ? i = Se(t, a.fullFields) : i = t[e.field || a.fullField], _e(e) ? (e.field = e.field || a.fullField, e.fieldValue = i, e) : {
200
+ return a.fullFields ? i = Te(t, a.fullFields) : i = t[e.field || a.fullField], _e(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 Kt(a, t) {
216
216
  }
217
217
  var Gt = function(t, e, i, s, r, o) {
218
218
  t.required && (!i.hasOwnProperty(t.field) || I(e, o || t.type)) && s.push(H(r.messages.required, t.fullField));
219
- }, Te = function(t, e, i, s, r) {
219
+ }, Se = function(t, e, i, s, r) {
220
220
  (/^\s+$/.test(e) || e === "") && s.push(H(r.messages.whitespace, t.fullField));
221
221
  }, lt, Le = function() {
222
222
  if (lt)
@@ -317,7 +317,7 @@ var Gt = function(t, e, i, s, r, o) {
317
317
  }
318
318
  }, v = {
319
319
  required: Gt,
320
- whitespace: Te,
320
+ whitespace: Se,
321
321
  type: Ae,
322
322
  range: He,
323
323
  enum: Me,
@@ -573,17 +573,17 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
573
573
  return Oe(x, h, function(g, w) {
574
574
  var p = g.rule, E = (p.type === "object" || p.type === "array") && (typeof p.fields == "object" || typeof p.defaultField == "object");
575
575
  E = E && (p.required || !p.required && g.value), p.field = g.field;
576
- function m(R, T) {
577
- return $({}, T, {
576
+ function m(R, S) {
577
+ return $({}, S, {
578
578
  fullField: p.fullField + "." + R,
579
579
  fullFields: p.fullFields ? [].concat(p.fullFields, [R]) : [R]
580
580
  });
581
581
  }
582
582
  function b(R) {
583
583
  R === void 0 && (R = []);
584
- var T = Array.isArray(R) ? R : [R];
585
- !h.suppressWarning && T.length && a.warning("async-validator:", T), T.length && p.message !== void 0 && (T = [].concat(p.message));
586
- var L = T.map(Nt(p, n));
584
+ var S = Array.isArray(R) ? R : [R];
585
+ !h.suppressWarning && S.length && a.warning("async-validator:", S), S.length && p.message !== void 0 && (S = [].concat(p.message));
586
+ var L = S.map(Nt(p, n));
587
587
  if (h.first && L.length)
588
588
  return y[p.field] = 1, w(L);
589
589
  if (!E)
@@ -597,13 +597,13 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
597
597
  }), A = $({}, A, g.rule.fields);
598
598
  var D = {};
599
599
  Object.keys(A).forEach(function(O) {
600
- var S = A[O], _ = Array.isArray(S) ? S : [S];
600
+ var T = A[O], _ = Array.isArray(T) ? T : [T];
601
601
  D[O] = _.map(m.bind(null, O));
602
602
  });
603
603
  var B = new a(D);
604
604
  B.messages(h.messages), g.rule.options && (g.rule.options.messages = h.messages, g.rule.options.error = h.error), B.validate(g.value, g.rule.options || h, function(O) {
605
- var S = [];
606
- L && L.length && S.push.apply(S, L), O && O.length && S.push.apply(S, O), w(S.length ? S : null);
605
+ var T = [];
606
+ L && L.length && T.push.apply(T, L), O && O.length && T.push.apply(T, O), w(T.length ? T : null);
607
607
  });
608
608
  }
609
609
  }
@@ -1681,6 +1681,8 @@ class Bt {
1681
1681
  // 启用单点击立马编辑
1682
1682
  c(this, "ENABLE_EDIT_TEXT_ENTER", !0);
1683
1683
  // 启用文本编辑器回车键确认
1684
+ c(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
1685
+ // 启用点击选择器编辑
1684
1686
  c(this, "ENABLE_SELECTOR_SINGLE", !1);
1685
1687
  c(this, "ENABLE_SELECTOR_SPAN_COL", !0);
1686
1688
  c(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
@@ -2521,7 +2523,7 @@ class si {
2521
2523
  const d = l.getDrawX(), f = l.getDrawY();
2522
2524
  if (i > d && i < d + l.visibleWidth && e > f && e < f + l.visibleHeight && (this.imageEnterAndLeave(l, t), this.visibleHoverCell !== l && (this.ctx.emit("visibleCellMouseleave", l, t), this.visibleHoverCell = l, this.ctx.emit("visibleCellHoverChange", l, t))), i > d && i < d + l.width && e > f && e < f + l.height) {
2523
2525
  if (this.ctx.emit("cellMouseenter", l, t), this.ctx.hoverCell && this.ctx.hoverCell !== l && this.ctx.emit("cellMouseleave", this.ctx.hoverCell, t), this.ctx.hoverCell === l) return;
2524
- ((o = this.ctx.hoverCell) == null ? void 0 : o.rowKey) !== l.rowKey && (this.ctx.hoverCell = l, this.ctx.hoverRow = this.ctx.body.renderRows[l.rowIndex], this.ctx.emit("rowHoverChange", this.ctx.hoverRow, l, t), this.ctx.emit("draw")), this.ctx.hoverCell = l, this.ctx.emit("cellHoverChange", l, t);
2526
+ ((o = this.ctx.hoverCell) == null ? void 0 : o.rowKey) !== l.rowKey && (this.ctx.hoverCell = l, this.ctx.hoverRow = this.ctx.body.renderRows.find((x) => x.rowKey === l.rowKey), this.ctx.emit("rowHoverChange", this.ctx.hoverRow, l, t), this.ctx.emit("draw")), this.ctx.hoverCell = l, this.ctx.emit("cellHoverChange", l, t);
2525
2527
  return;
2526
2528
  }
2527
2529
  }
@@ -2824,35 +2826,15 @@ class Wt {
2824
2826
  return t >= i && t <= i + r && e >= s && e <= s + o;
2825
2827
  }
2826
2828
  isOnScrollbar(t, e) {
2827
- return this.isPointInElement(
2828
- t,
2829
- e,
2830
- this.barX,
2831
- this.barY,
2832
- this.barWidth,
2833
- this.barHeight
2834
- );
2829
+ return this.isPointInElement(t, e, this.barX, this.barY, this.barWidth, this.barHeight);
2835
2830
  }
2836
2831
  isOnTrack(t, e) {
2837
- return this.isPointInElement(
2838
- t,
2839
- e,
2840
- this.trackX,
2841
- this.trackY,
2842
- this.trackWidth,
2843
- this.trackHeight
2844
- );
2832
+ return this.isPointInElement(t, e, this.trackX, this.trackY, this.trackWidth, this.trackHeight);
2845
2833
  }
2846
2834
  updateScroll(t) {
2847
2835
  t.preventDefault();
2848
2836
  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
- ));
2837
+ 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
2838
  }
2857
2839
  updatedSize() {
2858
2840
  const {
@@ -2861,12 +2843,7 @@ class Wt {
2861
2843
  config: { SCROLLER_TRACK_SIZE: i = 0, SCROLLER_SIZE: s = 0 }
2862
2844
  } = 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
2845
  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;
2846
+ 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
2847
  const f = this.distance ? this.visibleDistance / l : 0;
2871
2848
  let x = Math.floor(f * this.visibleDistance);
2872
2849
  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 +2861,15 @@ class Wt {
2884
2861
  }
2885
2862
  draw() {
2886
2863
  const {
2887
- config: {
2888
- SCROLLER_FOCUS_COLOR: t,
2889
- SCROLLER_COLOR: e,
2890
- BORDER_COLOR: i,
2891
- SCROLLER_TRACK_COLOR: s
2892
- }
2864
+ config: { SCROLLER_FOCUS_COLOR: t, SCROLLER_COLOR: e, BORDER_COLOR: i, SCROLLER_TRACK_COLOR: s }
2893
2865
  } = 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, {
2866
+ this.updatedSize(), this.ctx.paint.drawRect(this.trackX, this.trackY, this.trackWidth, this.trackHeight, {
2867
+ borderColor: i,
2868
+ fillColor: s
2869
+ }), this.ctx.paint.drawRect(this.barX, this.barY, this.barWidth, this.barHeight, {
2870
+ fillColor: this.isFocus || this.isDragging ? t : e,
2871
+ radius: 4
2872
+ }), this.splitPoints.length > 0 && this.ctx.paint.drawLine(this.splitPoints, {
2913
2873
  borderColor: i,
2914
2874
  borderWidth: 1
2915
2875
  }), this.ctx.scrollerFocus = this.isFocus;
@@ -2943,7 +2903,7 @@ class oi {
2943
2903
  draw() {
2944
2904
  this.verticalScrollbar.draw(), this.horizontalScrollbar.draw();
2945
2905
  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));
2906
+ (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
2907
  }
2948
2908
  setScroll(t, e) {
2949
2909
  this.horizontalScrollbar.scroll = t, this.verticalScrollbar.scroll = e, this.ctx.emit("draw");
@@ -2959,9 +2919,7 @@ class oi {
2959
2919
  i && this.setScrollX(i.x - e.visibleWidth / 2);
2960
2920
  }
2961
2921
  scrollToColIndex(t) {
2962
- const { header: e } = this.ctx, i = e.leafCellHeaders.find(
2963
- (s) => s.colIndex === t
2964
- );
2922
+ const { header: e } = this.ctx, i = e.leafCellHeaders.find((s) => s.colIndex === t);
2965
2923
  i && i.x > e.visibleWidth / 2 && this.setScrollX(i.x - e.visibleWidth / 2);
2966
2924
  }
2967
2925
  scrollToRowIndex(t) {
@@ -3342,9 +3300,11 @@ class ai {
3342
3300
  config: { ENABLE_RESIZE_ROW: t }
3343
3301
  } = this.ctx;
3344
3302
  t && (this.ctx.on("mouseup", () => {
3345
- this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeRow(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.resizeDiff = 0, this.isResizing = !1, this.ctx.rowResizing = !1, this.offsetY = 0;
3303
+ this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeRow(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.resizeDiff = 0, this.isResizing = !1, setTimeout(() => {
3304
+ this.ctx.rowResizing = !1;
3305
+ }, 0), this.offsetY = 0;
3346
3306
  }), this.ctx.on("mousedown", (e) => {
3347
- this.ctx.isTarget(e.target) && (this.offsetY = e.offsetY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
3307
+ this.ctx.isTarget(e.target) && (this.offsetY = e.offsetY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
3348
3308
  }), this.ctx.on("mousemove", (e) => {
3349
3309
  if (this.ctx.editing) return;
3350
3310
  const i = e.offsetY, s = e.offsetX, {
@@ -4274,9 +4234,9 @@ const mi = (a) => ({
4274
4234
  x: e,
4275
4235
  y: i
4276
4236
  }, u = Mt(s), y = Ht(u), g = await o.getDimensions(l), w = u === "y", p = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", b = r.reference[y] + r.reference[u] - x[u] - r.floating[y], C = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l));
4277
- let T = R ? R[m] : 0;
4278
- (!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = n.floating[m] || r.floating[y]);
4279
- const L = b / 2 - C / 2, A = T / 2 - g[y] / 2 - 1, D = rt(f[p], A), B = rt(f[E], A), O = D, S = T - g[y] - B, _ = T / 2 - g[y] / 2 + L, G = Ot(O, _, S), K = !h.arrow && ct(s) != null && _ !== G && r.reference[y] / 2 - (_ < O ? D : B) - g[y] / 2 < 0, X = K ? _ < O ? _ - O : _ - S : 0;
4237
+ let S = R ? R[m] : 0;
4238
+ (!S || !await (o.isElement == null ? void 0 : o.isElement(R))) && (S = n.floating[m] || r.floating[y]);
4239
+ const L = b / 2 - C / 2, A = S / 2 - g[y] / 2 - 1, D = rt(f[p], A), B = rt(f[E], A), O = D, T = S - g[y] - B, _ = S / 2 - g[y] / 2 + L, G = Ot(O, _, T), K = !h.arrow && ct(s) != null && _ !== G && r.reference[y] / 2 - (_ < O ? D : B) - g[y] / 2 < 0, X = K ? _ < O ? _ - O : _ - T : 0;
4280
4240
  return {
4281
4241
  [u]: x[u] + X,
4282
4242
  data: {
@@ -4315,7 +4275,7 @@ const mi = (a) => ({
4315
4275
  return {};
4316
4276
  const p = q(s), E = J(n), m = q(n) === n, b = await (h.isRTL == null ? void 0 : h.isRTL(l.floating)), C = x || (m || !g ? [xt(n)] : ui(n)), R = y !== "none";
4317
4277
  !x && R && C.push(...wi(n, g, y, b));
4318
- const T = [n, ...C], L = await re(t, w), A = [];
4278
+ const S = [n, ...C], L = await re(t, w), A = [];
4319
4279
  let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
4320
4280
  if (d && A.push(L[p]), f) {
4321
4281
  const _ = xi(s, o, b);
@@ -4326,7 +4286,7 @@ const mi = (a) => ({
4326
4286
  overflows: A
4327
4287
  }], !A.every((_) => _ <= 0)) {
4328
4288
  var B, O;
4329
- const _ = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G = T[_];
4289
+ const _ = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G = S[_];
4330
4290
  if (G)
4331
4291
  return {
4332
4292
  data: {
@@ -4341,8 +4301,8 @@ const mi = (a) => ({
4341
4301
  if (!K)
4342
4302
  switch (u) {
4343
4303
  case "bestFit": {
4344
- var S;
4345
- const X = (S = D.filter((W) => {
4304
+ var T;
4305
+ const X = (T = D.filter((W) => {
4346
4306
  if (R) {
4347
4307
  const P = J(W.placement);
4348
4308
  return P === E || // Create a bias to the `y` side axis due to horizontal
@@ -4350,7 +4310,7 @@ const mi = (a) => ({
4350
4310
  P === "y";
4351
4311
  }
4352
4312
  return !0;
4353
- }).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, we) => P + we, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : S[0];
4313
+ }).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, we) => P + we, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : T[0];
4354
4314
  X && (K = X);
4355
4315
  break;
4356
4316
  }
@@ -4571,17 +4531,17 @@ function ne(a) {
4571
4531
  const t = z(a);
4572
4532
  return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) && ht(t) ? t : ne(t);
4573
4533
  }
4574
- function St(a, t, e) {
4534
+ function Tt(a, t, e) {
4575
4535
  var i;
4576
4536
  t === void 0 && (t = []), e === void 0 && (e = !0);
4577
4537
  const s = ne(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = M(s);
4578
4538
  if (r) {
4579
- const n = Tt(o);
4580
- return t.concat(o, o.visualViewport || [], ht(s) ? s : [], n && e ? St(n) : []);
4539
+ const n = St(o);
4540
+ return t.concat(o, o.visualViewport || [], ht(s) ? s : [], n && e ? Tt(n) : []);
4581
4541
  }
4582
- return t.concat(s, St(s, [], e));
4542
+ return t.concat(s, Tt(s, [], e));
4583
4543
  }
4584
- function Tt(a) {
4544
+ function St(a) {
4585
4545
  return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
4586
4546
  }
4587
4547
  function ae(a) {
@@ -4632,10 +4592,10 @@ function ot(a, t, e, i) {
4632
4592
  let h = (s.left + n.x) / o.x, l = (s.top + n.y) / o.y, d = s.width / o.x, f = s.height / o.y;
4633
4593
  if (r) {
4634
4594
  const x = M(r), u = i && k(i) ? M(i) : i;
4635
- let y = x, g = Tt(y);
4595
+ let y = x, g = St(y);
4636
4596
  for (; g && i && u !== y; ) {
4637
4597
  const w = Z(g), p = g.getBoundingClientRect(), E = F(g), m = p.left + (g.clientLeft + parseFloat(E.paddingLeft)) * w.x, b = p.top + (g.clientTop + parseFloat(E.paddingTop)) * w.y;
4638
- h *= w.x, l *= w.y, d *= w.x, f *= w.y, h += m, l += b, y = M(g), g = Tt(y);
4598
+ h *= w.x, l *= w.y, d *= w.x, f *= w.y, h += m, l += b, y = M(g), g = St(y);
4639
4599
  }
4640
4600
  }
4641
4601
  return ut({
@@ -4645,7 +4605,7 @@ function ot(a, t, e, i) {
4645
4605
  y: l
4646
4606
  });
4647
4607
  }
4648
- function Si(a) {
4608
+ function Ti(a) {
4649
4609
  let {
4650
4610
  elements: t,
4651
4611
  rect: e,
@@ -4671,7 +4631,7 @@ function Si(a) {
4671
4631
  y: e.y * l.y - h.scrollTop * l.y + d.y
4672
4632
  };
4673
4633
  }
4674
- function Ti(a) {
4634
+ function Si(a) {
4675
4635
  return Array.from(a.getClientRects());
4676
4636
  }
4677
4637
  function Lt(a, t) {
@@ -4739,7 +4699,7 @@ function Mi(a, t) {
4739
4699
  const e = t.get(a);
4740
4700
  if (e)
4741
4701
  return e;
4742
- let i = St(a, [], !1).filter((n) => k(n) && tt(n) !== "body"), s = null;
4702
+ let i = Tt(a, [], !1).filter((n) => k(n) && tt(n) !== "body"), s = null;
4743
4703
  const r = F(a).position === "fixed";
4744
4704
  let o = r ? z(a) : a;
4745
4705
  for (; k(o) && !Q(o); ) {
@@ -4847,12 +4807,12 @@ function Ni(a) {
4847
4807
  return F(a).direction === "rtl";
4848
4808
  }
4849
4809
  const Ki = {
4850
- convertOffsetParentRelativeRectToViewportRelativeRect: Si,
4810
+ convertOffsetParentRelativeRectToViewportRelativeRect: Ti,
4851
4811
  getDocumentElement: Y,
4852
4812
  getClippingRect: Di,
4853
4813
  getOffsetParent: de,
4854
4814
  getElementRects: Xi,
4855
- getClientRects: Ti,
4815
+ getClientRects: Si,
4856
4816
  getDimensions: ki,
4857
4817
  getScale: Z,
4858
4818
  isElement: k,
@@ -5093,11 +5053,28 @@ class Wi {
5093
5053
  s !== i && !(s === "" && i === null) && this.ctx.database.setItemValue(t, e, s, !0, !0, !0), this.inputEl.textContent = null, this.editorEl.style.left = "-10000px", this.editorEl.style.top = "-10000px";
5094
5054
  }
5095
5055
  startEdit() {
5096
- const t = this.ctx.focusCell;
5097
- if (!t || ["index", "index-selection", "selection"].includes(t.type) || this.enable)
5056
+ const { ENABLE_EDIT_CLICK_SELECTOR: t } = this.ctx.config;
5057
+ if (!t)
5058
+ return;
5059
+ const e = this.ctx.focusCell;
5060
+ if (!e || ["index", "index-selection", "selection"].includes(e.type) || this.enable)
5098
5061
  return;
5099
- const { rowKey: e, key: i } = t, s = this.ctx.database.getReadonly(e, i);
5100
- t && !s && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = t, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
5062
+ const { rowKey: i, key: s } = e, r = this.ctx.database.getReadonly(i, s);
5063
+ e && !r && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
5064
+ }
5065
+ editCell(t, e) {
5066
+ const i = this.ctx.body.renderRows.find((l) => l.rowIndex === t);
5067
+ if (!i)
5068
+ return;
5069
+ const s = i.cells.find((l) => l.colIndex === e);
5070
+ if (!s)
5071
+ return;
5072
+ this.ctx.emit("setSelectorCell", s);
5073
+ const r = this.ctx.focusCell;
5074
+ if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
5075
+ return;
5076
+ const { rowKey: o, key: n } = r, h = this.ctx.database.getReadonly(o, n);
5077
+ r && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
5101
5078
  }
5102
5079
  doneEdit() {
5103
5080
  this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.target.focus(), this.ctx.editing = !1, this.cellTarget = null, this.ctx.emit("draw"));
@@ -5469,6 +5446,9 @@ class Gi {
5469
5446
  filterMethod(t) {
5470
5447
  this.ctx.setScrollY(0), this.ctx.setScrollX(0), this.ctx.database.init(), this.ctx.database.setFilterMethod(t), this.ctx.emit("draw");
5471
5448
  }
5449
+ editCell(t, e) {
5450
+ this.editor.editCell(t, e);
5451
+ }
5472
5452
  setItemValue(t, e, i, s = !0, r = !0, o = !1) {
5473
5453
  this.ctx.database.setItemValue(t, e, i, s, r, o);
5474
5454
  }