e-virt-table 1.0.9 → 1.1.0

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
@@ -159,28 +159,28 @@ var kt = /* @__PURE__ */ function(a) {
159
159
  }(/* @__PURE__ */ Ct(Error));
160
160
  function Ae(a, t, e, i, s) {
161
161
  if (t.first) {
162
- var r = new Promise(function(u, x) {
162
+ var r = new Promise(function(x, u) {
163
163
  var p = function(y) {
164
- return i(y), y.length ? x(new kt(y, bt(y))) : u(s);
164
+ return i(y), y.length ? u(new kt(y, bt(y))) : x(s);
165
165
  }, g = Le(a);
166
166
  Xt(g, e, p);
167
167
  });
168
- return r.catch(function(u) {
169
- return u;
168
+ return r.catch(function(x) {
169
+ return x;
170
170
  }), r;
171
171
  }
172
- var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), h = n.length, c = 0, d = [], f = new Promise(function(u, x) {
172
+ var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), h = n.length, c = 0, d = [], f = new Promise(function(x, u) {
173
173
  var p = function(w) {
174
174
  if (d.push.apply(d, w), c++, c === h)
175
- return i(d), d.length ? x(new kt(d, bt(d))) : u(s);
175
+ return i(d), d.length ? u(new kt(d, bt(d))) : x(s);
176
176
  };
177
- n.length || (i(d), u(s)), n.forEach(function(g) {
177
+ n.length || (i(d), x(s)), n.forEach(function(g) {
178
178
  var w = a[g];
179
179
  o.indexOf(g) !== -1 ? Xt(w, e, p) : Se(w, e, p);
180
180
  });
181
181
  });
182
- return f.catch(function(u) {
183
- return u;
182
+ return f.catch(function(x) {
183
+ return x;
184
184
  }), f;
185
185
  }
186
186
  function Te(a) {
@@ -242,7 +242,7 @@ var Ut = function(t, e, i, s, r, o) {
242
242
  }, h.v6 = function(m) {
243
243
  return m && m.exact ? n : new RegExp("" + t(m) + s + t(m), "g");
244
244
  };
245
- var c = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = h.v4().source, u = h.v6().source, x = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", p = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", g = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', E = "(?:" + c + "|www\\.)" + d + "(?:localhost|" + f + "|" + u + "|" + x + p + g + ")" + w + y;
245
+ var c = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = h.v4().source, x = h.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", p = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", g = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', E = "(?:" + c + "|www\\.)" + d + "(?:localhost|" + f + "|" + x + "|" + u + p + g + ")" + w + y;
246
246
  return ct = new RegExp("(?:^" + E + "$)", "i"), ct;
247
247
  }, Bt = {
248
248
  // http://emailregex.com/
@@ -300,10 +300,10 @@ var Ut = function(t, e, i, s, r, o) {
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
302
  }, Xe = function(t, e, i, s, r) {
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, u = typeof e == "number", x = typeof e == "string", p = Array.isArray(e);
304
- if (u ? f = "number" : x ? f = "string" : p && (f = "array"), !f)
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", u = typeof e == "string", p = Array.isArray(e);
304
+ if (x ? f = "number" : u ? f = "string" : p && (f = "array"), !f)
305
305
  return !1;
306
- p && (d = e.length), x && (d = e.replace(c, "_").length), o ? d !== t.len && s.push(D(r.messages[f].len, t.fullField, t.len)) : n && !h && d < t.min ? s.push(D(r.messages[f].min, t.fullField, t.min)) : h && !n && d > t.max ? s.push(D(r.messages[f].max, t.fullField, t.max)) : n && h && (d < t.min || d > t.max) && s.push(D(r.messages[f].range, t.fullField, t.min, t.max));
306
+ p && (d = e.length), u && (d = e.replace(c, "_").length), o ? d !== t.len && s.push(D(r.messages[f].len, t.fullField, t.len)) : n && !h && d < t.min ? s.push(D(r.messages[f].min, t.fullField, t.min)) : h && !n && d > t.max ? s.push(D(r.messages[f].max, t.fullField, t.max)) : n && h && (d < t.min || d > t.max) && s.push(D(r.messages[f].range, t.fullField, t.min, t.max));
307
307
  }, j = "enum", ke = function(t, e, i, s, r) {
308
308
  t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(D(r.messages[j], t.fullField, t[j].join(", ")));
309
309
  }, Ne = function(t, e, i, s, r) {
@@ -554,14 +554,14 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
554
554
  f === Rt && (f = vt()), Kt(f, h.messages), h.messages = f;
555
555
  } else
556
556
  h.messages = this.messages();
557
- var u = {}, x = h.keys || Object.keys(this.rules);
558
- x.forEach(function(g) {
557
+ var x = {}, u = h.keys || Object.keys(this.rules);
558
+ u.forEach(function(g) {
559
559
  var w = o.rules[g], y = n[g];
560
560
  w.forEach(function(E) {
561
561
  var m = E;
562
562
  typeof m.transform == "function" && (n === i && (n = G({}, n)), y = n[g] = m.transform(y)), typeof m == "function" ? m = {
563
563
  validator: m
564
- } : m = G({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field = g, m.fullField = m.fullField || g, m.type = o.getType(m), u[g] = u[g] || [], u[g].push({
564
+ } : m = G({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field = g, m.fullField = m.fullField || g, m.type = o.getType(m), x[g] = x[g] || [], x[g].push({
565
565
  rule: m,
566
566
  value: y,
567
567
  source: n,
@@ -570,7 +570,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
570
570
  });
571
571
  });
572
572
  var p = {};
573
- return Ae(u, h, function(g, w) {
573
+ return Ae(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) {
@@ -1015,21 +1015,21 @@ class Tt extends se {
1015
1015
  const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
1016
1016
  let r, o = 0, n = "";
1017
1017
  if (this.type === "tree" && s === "body") {
1018
- const h = this.ctx.database.getRowForRowKey(i), { expand: c = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = h || {};
1018
+ const h = this.ctx.database.getRowForRowKey(i), { expand: c = !1, hasChildren: d = !1, expandLoading: f = !1, level: x = 0 } = h || {};
1019
1019
  if (this.rowExpand = c, this.rowHasChildren = d, f) {
1020
1020
  const g = this.ctx.icons.get("loading");
1021
- n = "loading", r = g, o = u * 8;
1021
+ n = "loading", r = g, o = x * 8;
1022
1022
  } else if (d) {
1023
1023
  const g = this.ctx.icons.get("expand"), w = this.ctx.icons.get("shrink");
1024
- r = c ? w : g, n = c ? "shrink" : "expand", o = u * 8;
1024
+ r = c ? w : g, n = c ? "shrink" : "expand", o = x * 8;
1025
1025
  } else
1026
- o = u * 8;
1027
- let x = 20, p = 20;
1026
+ o = x * 8;
1027
+ let u = 20, p = 20;
1028
1028
  if (r) {
1029
1029
  let g = this.drawX + o + e, w = this.drawY + (this.visibleHeight - p) / 2;
1030
- this.ctx.paint.drawImage(r, g, w, x, p), this.drawImageX = g, this.drawImageY = w, this.drawImageWidth = x, this.drawImageHeight = p, this.drawImageName = n, this.drawImageSource = r;
1030
+ this.ctx.paint.drawImage(r, g, w, u, p), this.drawImageX = g, this.drawImageY = w, this.drawImageWidth = u, this.drawImageHeight = p, this.drawImageName = n, this.drawImageSource = r;
1031
1031
  }
1032
- this.align = "left", this.drawTextX = o + this.drawX + x - 0.5;
1032
+ this.align = "left", this.drawTextX = o + this.drawX + u - 0.5;
1033
1033
  }
1034
1034
  }
1035
1035
  updateContainer() {
@@ -1060,9 +1060,9 @@ class Tt extends se {
1060
1060
  this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = y, this.drawTextColor = E;
1061
1061
  return;
1062
1062
  }
1063
- let u = "transparent";
1064
- const x = this.ctx.focusCell, p = this.ctx.hoverCell;
1065
- d && (p == null ? void 0 : p.rowKey) === this.rowKey && (u = f), h && (x == null ? void 0 : x.rowKey) === this.rowKey && (u = c), this.drawCellSkyBgColor = u;
1063
+ let x = "transparent";
1064
+ const u = this.ctx.focusCell, p = this.ctx.hoverCell;
1065
+ d && (p == null ? void 0 : p.rowKey) === this.rowKey && (x = f), h && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = c), this.drawCellSkyBgColor = x;
1066
1066
  let g = e, w = o;
1067
1067
  if (["index", "index-selection", "selection"].includes(this.type)) {
1068
1068
  this.drawCellBgColor = e, this.drawTextColor = o;
@@ -1084,9 +1084,9 @@ class Tt extends se {
1084
1084
  updateSelection() {
1085
1085
  const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex: h, rowKey: c } = this;
1086
1086
  if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(n)) {
1087
- const d = this.ctx.database.getRowSelection(c), f = this.ctx.database.getRowSelectable(c), { CHECKBOX_SIZE: u = 0 } = this.ctx.config, x = this.drawX + (e - u) / 2, p = this.drawY + (i - u) / 2;
1087
+ const d = this.ctx.database.getRowSelection(c), f = this.ctx.database.getRowSelectable(c), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, p = this.drawY + (i - x) / 2;
1088
1088
  let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
1089
- d && f ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = x, this.drawImageY = p, this.drawImageWidth = u, this.drawImageHeight = u, this.drawImageName = w, this.drawImageSource = g) : g && n === "selection" && (this.drawImageX = x, this.drawImageY = p, this.drawImageWidth = u, this.drawImageHeight = u, this.drawImageName = w, this.drawImageSource = g);
1089
+ d && f ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g) : g && n === "selection" && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g);
1090
1090
  }
1091
1091
  }
1092
1092
  updateHoverIcon() {
@@ -1231,8 +1231,8 @@ class Tt extends se {
1231
1231
  const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: r } = this.ctx.config;
1232
1232
  if (!s || !i)
1233
1233
  return;
1234
- const { xArr: o, yArr: n } = this.ctx.selector, h = o[1], c = n[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
1235
- d === h && f === c && this.ctx.paint.drawRect(u + this.width - 6, x + this.height - 6, 6, 6, {
1234
+ const { xArr: o, yArr: n } = this.ctx.selector, h = o[1], c = n[1], { colIndex: d, rowIndex: f, drawX: x, drawY: u } = this;
1235
+ d === h && f === c && this.ctx.paint.drawRect(x + this.width - 6, u + this.height - 6, 6, 6, {
1236
1236
  borderColor: r,
1237
1237
  fillColor: e
1238
1238
  });
@@ -1297,35 +1297,35 @@ class Tt extends se {
1297
1297
  const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this;
1298
1298
  let h = i + 0.5, c = s + 0.5, d = this.height;
1299
1299
  o === 0 && (c = this.y + 1, d = d - 1), n === this.ctx.maxColIndex && (h = h - 1);
1300
- const { xArr: f, yArr: u, lineDash: x = [], borderWidth: p = 1, borderColor: g, fillColor: w } = e, y = f[0], E = f[1], m = u[0], C = u[1];
1300
+ const { xArr: f, yArr: x, lineDash: u = [], borderWidth: p = 1, borderColor: g, fillColor: w } = e, y = f[0], E = f[1], m = x[0], C = x[1];
1301
1301
  n >= y && n <= E && o === m && this.ctx.paint.drawLine([h, c, h + r - 2, c], {
1302
1302
  borderColor: g,
1303
1303
  fillColor: w,
1304
1304
  borderWidth: p,
1305
1305
  lineCap: "round",
1306
1306
  lineJoin: "round",
1307
- lineDash: x
1307
+ lineDash: u
1308
1308
  }), n >= y && n <= E && o === C && this.ctx.paint.drawLine([h, c + d - 1.5, h + r, c + d - 1.5], {
1309
1309
  borderColor: g,
1310
1310
  fillColor: w,
1311
1311
  borderWidth: p,
1312
1312
  lineCap: "round",
1313
1313
  lineJoin: "round",
1314
- lineDash: x
1314
+ lineDash: u
1315
1315
  }), n === y && o >= m && o <= C && this.ctx.paint.drawLine([h, c, h, c + d - 1], {
1316
1316
  borderColor: g,
1317
1317
  fillColor: w,
1318
1318
  borderWidth: p,
1319
1319
  lineCap: "round",
1320
1320
  lineJoin: "round",
1321
- lineDash: x
1321
+ lineDash: u
1322
1322
  }), n === E && o >= m && o <= C && this.ctx.paint.drawLine([h + r - 1.5, c, h + r - 1.5, c + d - 1.5], {
1323
1323
  borderColor: g,
1324
1324
  fillColor: w,
1325
1325
  borderWidth: p,
1326
1326
  lineCap: "round",
1327
1327
  lineJoin: "round",
1328
- lineDash: x
1328
+ lineDash: u
1329
1329
  });
1330
1330
  }
1331
1331
  }
@@ -1372,24 +1372,24 @@ class ni {
1372
1372
  t.forEach((i, s) => {
1373
1373
  let r = i._hasChildren || !1;
1374
1374
  Array.isArray(i.children) && i.children.length && (r = !0, this.initData(i.children, e + 1));
1375
- const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: h, SELECTABLE_METHOD: c, CHECKBOX_KEY: d } = this.ctx.config, f = i[o], u = f != null ? `${f}` : Zt();
1376
- this.itemRowKeyMap.set(i, u);
1377
- const x = i._height || h, p = i._readonly;
1375
+ const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: h, SELECTABLE_METHOD: c, CHECKBOX_KEY: d } = this.ctx.config, f = i[o], x = f != null ? `${f}` : Zt();
1376
+ this.itemRowKeyMap.set(i, x);
1377
+ const u = i._height || h, p = i._readonly;
1378
1378
  let g = !0;
1379
1379
  if (typeof c == "function" && (g = c), d) {
1380
1380
  const w = i[d];
1381
1381
  if (this.checkboxKeyMap.has(w)) {
1382
1382
  const y = this.checkboxKeyMap.get(w) || [];
1383
- y.push(u), this.checkboxKeyMap.set(w, y);
1383
+ y.push(x), this.checkboxKeyMap.set(w, y);
1384
1384
  } else
1385
- this.checkboxKeyMap.set(w, [u]);
1385
+ this.checkboxKeyMap.set(w, [x]);
1386
1386
  }
1387
- this.rowKeyMap.set(u, {
1387
+ this.rowKeyMap.set(x, {
1388
1388
  readonly: p,
1389
1389
  index: s,
1390
1390
  rowIndex: s,
1391
1391
  level: e,
1392
- height: x,
1392
+ height: u,
1393
1393
  check: !1,
1394
1394
  selectable: g,
1395
1395
  expand: n,
@@ -1605,20 +1605,20 @@ class ni {
1605
1605
  let r = t;
1606
1606
  const { BEFORE_VALUE_CHANGE_METHOD: o } = this.ctx.config;
1607
1607
  if (typeof o == "function") {
1608
- const d = o, f = t.map((x) => ({
1609
- rowKey: x.rowKey,
1610
- key: x.key,
1611
- value: x.value,
1612
- oldValue: this.getItemValue(x.rowKey, x.key),
1613
- row: this.ctx.database.getRowDataItemForRowKey(x.rowKey)
1608
+ const d = o, f = t.map((u) => ({
1609
+ rowKey: u.rowKey,
1610
+ key: u.key,
1611
+ value: u.value,
1612
+ oldValue: this.getItemValue(u.rowKey, u.key),
1613
+ row: this.ctx.database.getRowDataItemForRowKey(u.rowKey)
1614
1614
  }));
1615
1615
  r = await d(f);
1616
1616
  }
1617
1617
  r.forEach((d) => {
1618
- const { value: f, rowKey: u, key: x } = d, p = this.getItemValue(u, x);
1619
- this.setItemValue(u, x, f), s.add(u), i.push({
1620
- rowKey: u,
1621
- key: x,
1618
+ const { value: f, rowKey: x, key: u } = d, p = this.getItemValue(x, u);
1619
+ this.setItemValue(x, u, f), s.add(x), i.push({
1620
+ rowKey: x,
1621
+ key: u,
1622
1622
  oldValue: p,
1623
1623
  newValue: f
1624
1624
  });
@@ -1672,9 +1672,9 @@ class ni {
1672
1672
  const d = this.originalDataMap.get(c);
1673
1673
  let f = i;
1674
1674
  if (o) {
1675
- const { BEFORE_VALUE_CHANGE_METHOD: u } = this.ctx.config;
1676
- if (typeof u == "function") {
1677
- const w = await u([
1675
+ const { BEFORE_VALUE_CHANGE_METHOD: x } = this.ctx.config;
1676
+ if (typeof x == "function") {
1677
+ const w = await x([
1678
1678
  {
1679
1679
  rowKey: t,
1680
1680
  key: e,
@@ -1686,21 +1686,21 @@ class ni {
1686
1686
  w && w.length && (f = w[0].value);
1687
1687
  }
1688
1688
  this.changedDataMap.set(c, f), n[e] = f;
1689
- const x = this.ctx.database.getRowDataItemForRowKey(t), p = {
1689
+ const u = this.ctx.database.getRowDataItemForRowKey(t), p = {
1690
1690
  rowKey: t,
1691
1691
  key: e,
1692
1692
  value: f,
1693
- row: x
1693
+ row: u
1694
1694
  };
1695
1695
  this.getValidator(t, e).then(() => {
1696
1696
  this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1697
- }), this.ctx.emit("change", [p], [x]), this.ctx.emit("editChange", {
1697
+ }), this.ctx.emit("change", [p], [u]), this.ctx.emit("editChange", {
1698
1698
  rowKey: t,
1699
1699
  key: e,
1700
1700
  oldValue: h,
1701
1701
  value: f,
1702
1702
  originalValue: d,
1703
- row: x
1703
+ row: u
1704
1704
  });
1705
1705
  } else
1706
1706
  this.changedDataMap.set(c, f), n[e] = f;
@@ -1971,14 +1971,14 @@ class ni {
1971
1971
  if (h) {
1972
1972
  let c = {}, d = {};
1973
1973
  if (d[e] = this.getItemValue(t, e), Array.isArray(h)) {
1974
- const u = h.map((x) => ({
1975
- ...x,
1974
+ const x = h.map((u) => ({
1975
+ ...u,
1976
1976
  row: s.item,
1977
1977
  column: n,
1978
1978
  rowIndex: s.rowIndex,
1979
1979
  colIndex: r.colIndex
1980
1980
  }));
1981
- c[e] = u;
1981
+ c[e] = x;
1982
1982
  } else
1983
1983
  c[e] = {
1984
1984
  ...h,
@@ -1989,15 +1989,15 @@ class ni {
1989
1989
  };
1990
1990
  new nt(c).validate(d).then(() => {
1991
1991
  this.clearValidationError(t, e), i([]);
1992
- }).catch(({ errors: u }) => {
1993
- const x = u.map((p) => ({
1992
+ }).catch(({ errors: x }) => {
1993
+ const u = x.map((p) => ({
1994
1994
  ...p,
1995
1995
  column: n,
1996
1996
  key: e,
1997
1997
  row: s.item,
1998
1998
  rowKey: t
1999
1999
  }));
2000
- this.setValidationError(t, e, x), i(x);
2000
+ this.setValidationError(t, e, u), i(u);
2001
2001
  });
2002
2002
  } else
2003
2003
  i([]);
@@ -2023,19 +2023,19 @@ class ni {
2023
2023
  relationColKeys: c,
2024
2024
  rowspan: d,
2025
2025
  height: f,
2026
- width: u,
2027
- colspan: x,
2026
+ width: x,
2027
+ colspan: u,
2028
2028
  mergeRow: p,
2029
2029
  mergeCol: g
2030
2030
  } = t;
2031
- if (d === 1 && x === 1)
2031
+ if (d === 1 && u === 1)
2032
2032
  return {
2033
2033
  xArr: [n, n],
2034
2034
  yArr: [e, e],
2035
2035
  rowspan: d,
2036
- colspan: x,
2036
+ colspan: u,
2037
2037
  height: f,
2038
- width: u,
2038
+ width: x,
2039
2039
  offsetTop: 0,
2040
2040
  offsetLeft: 0,
2041
2041
  dataList: [
@@ -2049,7 +2049,7 @@ class ni {
2049
2049
  };
2050
2050
  let w = e, y = e, E = n, m = n, C = [], b = 0, R = 0, S = 0, L = 0;
2051
2051
  if (d !== 1 && p) {
2052
- L = u;
2052
+ L = x;
2053
2053
  const I = h.reduce((v, A) => {
2054
2054
  const O = this.getItemValue(s, A) ?? "";
2055
2055
  return `${v}${O}`;
@@ -2090,7 +2090,7 @@ class ni {
2090
2090
  });
2091
2091
  }
2092
2092
  }
2093
- if (x !== 1 && g) {
2093
+ if (u !== 1 && g) {
2094
2094
  S = f;
2095
2095
  for (let I = n - 1; I >= 0; I--) {
2096
2096
  const v = this.getColumnByColIndex(I);
@@ -2134,7 +2134,7 @@ class ni {
2134
2134
  xArr: [E, m],
2135
2135
  yArr: [w, y],
2136
2136
  rowspan: d,
2137
- colspan: x,
2137
+ colspan: u,
2138
2138
  height: S,
2139
2139
  width: L,
2140
2140
  offsetTop: b,
@@ -2424,8 +2424,8 @@ class ci {
2424
2424
  if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o), h === 0)
2425
2425
  this.ctx.rect(t - 0.5, e - 0.5, i, s);
2426
2426
  else {
2427
- const [c, d, f, u] = typeof h == "number" ? [h, h, h, h] : h;
2428
- this.ctx.moveTo(t + c, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - u, u), this.ctx.arcTo(t, e, t + c, e, c);
2427
+ const [c, d, f, x] = typeof h == "number" ? [h, h, h, h] : h;
2428
+ this.ctx.moveTo(t + c, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + c, e, c);
2429
2429
  }
2430
2430
  n !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
2431
2431
  }
@@ -2449,12 +2449,12 @@ class ci {
2449
2449
  verticalAlign: f = "middle"
2450
2450
  } = o;
2451
2451
  this.ctx.font = n, this.ctx.fillStyle = c, this.ctx.textBaseline = f, this.ctx.textAlign = h;
2452
- let u = 0;
2453
- f === "top" ? u = i + d : f === "bottom" ? u = i + r - d : u = i + (r + 1) / 2;
2454
2452
  let x = 0;
2455
- h === "left" ? x = e + d : h === "right" ? x = e + s - d : x = e + s / 2;
2453
+ f === "top" ? x = i + d : f === "bottom" ? x = i + r - d : x = i + (r + 1) / 2;
2454
+ let u = 0;
2455
+ h === "left" ? u = e + d : h === "right" ? u = e + s - d : u = e + s / 2;
2456
2456
  const { _text: p, ellipsis: g } = this.handleEllipsis(t, s, d, n);
2457
- return this.ctx.fillText(p, x, u), this.ctx.restore(), g;
2457
+ return this.ctx.fillText(p, u, x), this.ctx.restore(), g;
2458
2458
  }
2459
2459
  handleEllipsis(t, e, i = 0, s = "12px Arial") {
2460
2460
  let r = !1, o = t;
@@ -2832,8 +2832,8 @@ class re extends se {
2832
2832
  const { width: e, height: i, type: s } = this;
2833
2833
  if (["index-selection", "selection"].includes(s)) {
2834
2834
  const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: h = 0 } = this.ctx.config, c = this.drawX + (e - h) / 2, d = this.drawY + (i - h) / 2;
2835
- let f = this.ctx.icons.get("checkbox-uncheck"), u = "checkbox-uncheck";
2836
- r ? (f = this.ctx.icons.get("checkbox-indeterminate"), u = "checkbox-indeterminate") : o && n ? (f = this.ctx.icons.get("checkbox-check"), u = "checkbox-check") : o && n ? (f = this.ctx.icons.get("checkbox-check-disabled"), u = "checkbox-check-disabled") : !o && n ? (f = this.ctx.icons.get("checkbox-uncheck"), u = "checkbox-uncheck") : (f = this.ctx.icons.get("checkbox-disabled"), u = "checkbox-disabled"), f && (this.drawImageX = c, this.drawImageY = d, this.drawImageWidth = h, this.drawImageHeight = h, this.drawImageName = u, this.drawImageSource = f, this.ctx.paint.drawImage(
2835
+ let f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
2836
+ r ? (f = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && n ? (f = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && n ? (f = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && n ? (f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (f = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), f && (this.drawImageX = c, this.drawImageY = d, this.drawImageWidth = h, this.drawImageHeight = h, this.drawImageName = x, this.drawImageSource = f, this.ctx.paint.drawImage(
2837
2837
  this.drawImageSource,
2838
2838
  this.drawImageX,
2839
2839
  this.drawImageY,
@@ -3341,11 +3341,11 @@ class Pt {
3341
3341
  stageHeight: i,
3342
3342
  stageWidth: s,
3343
3343
  config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
3344
- } = this.ctx, n = s, h = i, c = e.height, d = e.width, f = t.height, u = this.ctx.footer.height;
3344
+ } = this.ctx, n = s, h = i, c = e.height, d = e.width, f = t.height, x = this.ctx.footer.height;
3345
3345
  if (this.type === "vertical") {
3346
- this.visibleDistance = h - r - c, this.distance = f - this.visibleDistance + u, this.trackX = n - r, this.trackY = 0, this.splitPoints = [this.trackX, c, this.trackX + r, c], this.trackWidth = r, this.trackHeight = h, this.barX = this.trackX - 1 + (r - o) / 2, this.barWidth = o;
3347
- const x = this.distance ? this.visibleDistance / (f + u) : 0;
3348
- let p = Math.floor(x * this.visibleDistance);
3346
+ this.visibleDistance = h - r - c, this.distance = f - this.visibleDistance + x, this.trackX = n - r, this.trackY = 0, this.splitPoints = [this.trackX, c, this.trackX + r, c], this.trackWidth = r, this.trackHeight = h, this.barX = this.trackX - 1 + (r - o) / 2, this.barWidth = o;
3347
+ const u = this.distance ? this.visibleDistance / (f + x) : 0;
3348
+ let p = Math.floor(u * this.visibleDistance);
3349
3349
  p < 30 ? p = 30 : p > this.visibleDistance && (p = 0), this.barHeight = p, this.barY = c + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3350
3350
  } else {
3351
3351
  this.visibleDistance = n - r, this.distance = d - this.visibleDistance, this.splitPoints = [
@@ -3354,8 +3354,8 @@ class Pt {
3354
3354
  n - r,
3355
3355
  h
3356
3356
  ], this.trackX = 0, this.trackY = h - r, this.trackWidth = n, this.trackHeight = r;
3357
- const x = this.distance ? this.visibleDistance / d : 0;
3358
- let p = Math.floor(x * this.visibleDistance);
3357
+ const u = this.distance ? this.visibleDistance / d : 0;
3358
+ let p = Math.floor(u * this.visibleDistance);
3359
3359
  this.barY = this.trackY - 1 + (r - o) / 2, p < 30 ? p = 30 : p >= this.visibleDistance && (p = 0), this.barWidth = p, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3360
3360
  }
3361
3361
  }
@@ -3489,7 +3489,7 @@ class gi {
3489
3489
  } = this.ctx, i = this.ctx.database.getColumns();
3490
3490
  this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
3491
3491
  const s = Qt(i), r = It(i);
3492
- this.height = t * s, this.width = r.reduce((f, u) => f + ((u == null ? void 0 : u.width) || 100), 0), this.visibleHeight = this.height;
3492
+ this.height = t * s, this.width = r.reduce((f, x) => f + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
3493
3493
  const o = ti(te(i, s));
3494
3494
  this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
3495
3495
  const n = this.ctx.containerElement.getBoundingClientRect();
@@ -3500,9 +3500,9 @@ class gi {
3500
3500
  this.resizeAllColumn(f);
3501
3501
  }
3502
3502
  const c = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
3503
- this.ctx.fixedLeftWidth = c.reduce((f, u) => f + u.width, 0);
3503
+ this.ctx.fixedLeftWidth = c.reduce((f, x) => f + x.width, 0);
3504
3504
  const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
3505
- this.ctx.fixedRightWidth = d.reduce((f, u) => f + u.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
3505
+ this.ctx.fixedRightWidth = d.reduce((f, x) => f + x.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
3506
3506
  }
3507
3507
  // 调整表头的宽度
3508
3508
  initResizeColumn() {
@@ -3587,7 +3587,7 @@ class gi {
3587
3587
  for (let o = 0; o < i; o++) {
3588
3588
  const n = t[o], h = r * (n.rowspan || 0), c = r * (n.level || 0);
3589
3589
  let d = n.width || 100;
3590
- n.children && (d = It(n.children).reduce((x, p) => x + ((p == null ? void 0 : p.width) || 100), 0));
3590
+ n.children && (d = It(n.children).reduce((u, p) => u + ((p == null ? void 0 : p.width) || 100), 0));
3591
3591
  const f = new re(this.ctx, this.columnIndex, s, c, d, h, n);
3592
3592
  this.ctx.database.setHeader(n.key, f), this.allCellHeaders.push(f), n.children || (this.leafCellHeaders.push(f), f.column.widthFillDisable || this.resizeNum++), n.fixed === "left" ? this.fixedLeftCellHeaders.push(f) : n.fixed === "right" ? this.fixedRightCellHeaders.push(f) : this.centerCellHeaders.push(f), !n.children && this.columnIndex++, n.children && this.render(n.children, s), s += d;
3593
3593
  }
@@ -3740,14 +3740,14 @@ class wi {
3740
3740
  MAX_HEIGHT: c = 0,
3741
3741
  ENABLE_OFFSET_HEIGHT: d = 0,
3742
3742
  OFFSET_HEIGHT: f = 0,
3743
- FOOTER_POSITION: u
3743
+ FOOTER_POSITION: x
3744
3744
  }
3745
3745
  } = this.ctx;
3746
3746
  if (!e.width)
3747
3747
  return;
3748
- this.x = 0, u === "top" && r ? this.y = e.height + i.height : this.y = e.height;
3749
- const { data: x, sumHeight: p } = s.getData();
3750
- this.height = p, this.data = x;
3748
+ this.x = 0, x === "top" && r ? this.y = e.height + i.height : this.y = e.height;
3749
+ const { data: u, sumHeight: p } = s.getData();
3750
+ this.height = p, this.data = u;
3751
3751
  const { top: g } = t.getBoundingClientRect();
3752
3752
  this.width = e.width, this.visibleWidth = this.ctx.stageWidth - o;
3753
3753
  const w = this.ctx.footer.height;
@@ -3769,7 +3769,7 @@ class wi {
3769
3769
  "There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
3770
3770
  ))) : this.data.length && n ? m = n : this.data.length && c && E > c ? m = c : m = E, m > 0 && (this.ctx.stageHeight = Math.floor(m), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
3771
3771
  let C = this.ctx.stageHeight - e.height - o;
3772
- r ? this.visibleHeight = C - w : this.visibleHeight = C, this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = x;
3772
+ r ? this.visibleHeight = C - w : this.visibleHeight = C, this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = u;
3773
3773
  const b = window.devicePixelRatio || 1, R = this.ctx.stageWidth * b, S = this.ctx.stageHeight * b;
3774
3774
  t.width = Math.floor(R), t.height = Math.floor(S), this.ctx.canvasElement.setAttribute(
3775
3775
  "style",
@@ -3796,18 +3796,18 @@ class wi {
3796
3796
  } = this.ctx;
3797
3797
  if (this.isResizing && this.resizeTarget) {
3798
3798
  const f = this.resizeTarget.height;
3799
- let u = n - this.clientY;
3800
- u + f < d && (u = -(f - d)), this.resizeDiff = u, this.ctx.emit("draw");
3799
+ let x = n - this.clientY;
3800
+ x + f < d && (x = -(f - d)), this.resizeDiff = x, this.ctx.emit("draw");
3801
3801
  } else {
3802
3802
  if (this.resizeTarget = null, this.isMouseDown || this.ctx.stageElement.style.cursor === "crosshair")
3803
3803
  return;
3804
3804
  this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
3805
3805
  for (let f = 0; f < this.renderRows.length; f++) {
3806
- const u = this.renderRows[f];
3807
- if (r > u.y - c + u.height - 1.5 && r < u.y - c + u.height + 1.5 && r < h - 4)
3808
- for (let p = 0; p < u.cells.length; p++) {
3809
- const g = u.cells[p];
3810
- o > g.drawX + 10 && o < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = u);
3806
+ const x = this.renderRows[f];
3807
+ if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r < h - 4)
3808
+ for (let p = 0; p < x.cells.length; p++) {
3809
+ const g = x.cells[p];
3810
+ o > g.drawX + 10 && o < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
3811
3811
  }
3812
3812
  }
3813
3813
  }
@@ -3890,7 +3890,7 @@ class wi {
3890
3890
  this.headIndex = Math.max(0, h), this.tailIndex = Math.min(this.ctx.maxRowIndex, c + 1), this.visibleRows = o.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
3891
3891
  const d = [];
3892
3892
  for (let f = 0; f < this.visibleRows.length; f++) {
3893
- const u = this.headIndex + f, x = this.visibleRows[f], { height: p, top: g } = this.ctx.database.getPositionForRowIndex(u), w = new oe(this.ctx, u, 0, g + this.y, t.width, p, x);
3893
+ const x = this.headIndex + f, u = this.visibleRows[f], { height: p, top: g } = this.ctx.database.getPositionForRowIndex(x), w = new oe(this.ctx, x, 0, g + this.y, t.width, p, u);
3894
3894
  d.push(w);
3895
3895
  }
3896
3896
  this.renderRows = d, this.ctx.body.renderRows = d;
@@ -3986,7 +3986,7 @@ class yi {
3986
3986
  }
3987
3987
  init() {
3988
3988
  this.ctx.on("focusout", () => {
3989
- this.ctx.clearSelector(), this.ctx.emit("draw");
3989
+ this.ctx.clearSelector(), this.ctx.emit("drawView");
3990
3990
  }), this.ctx.on("setMoveFocus", (t) => {
3991
3991
  this.moveFocus(t);
3992
3992
  }), this.ctx.on(
@@ -4038,7 +4038,7 @@ class yi {
4038
4038
  t.preventDefault(), this.moveFocus("LEFT");
4039
4039
  return;
4040
4040
  }
4041
- if (t.code === "ArrowUp") {
4041
+ if (t.code === "ArrowUp" || t.shiftKey && t.code === "Enter") {
4042
4042
  t.preventDefault(), this.moveFocus("TOP");
4043
4043
  return;
4044
4044
  }
@@ -4046,7 +4046,7 @@ class yi {
4046
4046
  t.preventDefault(), this.moveFocus("RIGHT");
4047
4047
  return;
4048
4048
  }
4049
- if (t.code === "ArrowDown" || t.code === "Enter") {
4049
+ if (t.code === "ArrowDown" || !t.shiftKey && t.code === "Enter") {
4050
4050
  t.preventDefault(), this.moveFocus("BOTTOM");
4051
4051
  return;
4052
4052
  }
@@ -4091,16 +4091,16 @@ class yi {
4091
4091
  SELECTOR_AREA_MIN_Y: c,
4092
4092
  SELECTOR_AREA_MAX_Y: d,
4093
4093
  SELECTOR_AREA_MAX_X_OFFSET: f,
4094
- SELECTOR_AREA_MAX_Y_OFFSET: u
4095
- } = this.ctx.config, x = n, p = h || this.ctx.maxColIndex - f, g = c, w = d || this.ctx.maxRowIndex - u;
4094
+ SELECTOR_AREA_MAX_Y_OFFSET: x
4095
+ } = this.ctx.config, u = n, p = h || this.ctx.maxColIndex - f, g = c, w = d || this.ctx.maxRowIndex - x;
4096
4096
  let [y, E] = r, [m, C] = o;
4097
- if (y < x || E > p || m < g || C > w)
4097
+ if (y < u || E > p || m < g || C > w)
4098
4098
  return;
4099
4099
  if (this.ctx.stageElement.focus(), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
4100
4100
  const R = this.adjustMergeCells(r, o);
4101
4101
  m = R.yArr[0], C = R.yArr[1], y = R.xArr[0], E = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
4102
4102
  }
4103
- y === E && m === C ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, r = [Math.max(x, y), Math.min(p, E)], o = [Math.max(g, m), Math.min(w, C)];
4103
+ y === E && m === C ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, r = [Math.max(u, y), Math.min(p, E)], o = [Math.max(g, m), Math.min(w, C)];
4104
4104
  const { BEFORE_SET_SELECTOR_METHOD: b } = this.ctx.config;
4105
4105
  if (typeof b == "function") {
4106
4106
  const S = b({
@@ -4142,16 +4142,16 @@ class yi {
4142
4142
  minX: r,
4143
4143
  maxX: o
4144
4144
  }
4145
- ), f = [d.minX, d.maxX], u = [c.minY, c.maxY];
4146
- let x = !1;
4145
+ ), f = [d.minX, d.maxX], x = [c.minY, c.maxY];
4146
+ let u = !1;
4147
4147
  if (d.minX !== d.maxX || c.minY !== c.maxY) {
4148
- const g = JSON.stringify(f) + JSON.stringify(u), w = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
4149
- x = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === g;
4148
+ const g = JSON.stringify(f) + JSON.stringify(x), w = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
4149
+ u = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === g;
4150
4150
  }
4151
4151
  return {
4152
4152
  xArr: f,
4153
- yArr: u,
4154
- onlyMergeCell: x
4153
+ yArr: x,
4154
+ onlyMergeCell: u
4155
4155
  };
4156
4156
  }
4157
4157
  selectCols(t) {
@@ -4188,8 +4188,8 @@ class yi {
4188
4188
  SELECTOR_AREA_MAX_Y: o,
4189
4189
  SELECTOR_AREA_MAX_X_OFFSET: n,
4190
4190
  SELECTOR_AREA_MAX_Y_OFFSET: h
4191
- } = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, u = o || this.ctx.maxRowIndex - h, x = [c, d], p = [f, u];
4192
- this.setSelector(x, p);
4191
+ } = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, x = o || this.ctx.maxRowIndex - h, u = [c, d], p = [f, x];
4192
+ this.setSelector(u, p);
4193
4193
  }
4194
4194
  }
4195
4195
  selectRows(t, e = !0) {
@@ -4225,8 +4225,8 @@ class yi {
4225
4225
  const { focusCell: e, clickCell: i } = this.ctx;
4226
4226
  if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
4227
4227
  if (this.ctx.selector.enable = !0, i && t) {
4228
- const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, h = Math.min(o, s), c = Math.max(o, s), d = Math.min(n, r), f = Math.max(n, r), u = [h, c], x = [d, f];
4229
- this.setSelector(u, x);
4228
+ const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, h = Math.min(o, s), c = Math.max(o, s), d = Math.min(n, r), f = Math.max(n, r), x = [h, c], u = [d, f];
4229
+ this.setSelector(x, u);
4230
4230
  } else {
4231
4231
  this.ctx.emit("cellSelectedClick", e);
4232
4232
  const s = [e.colIndex, e.colIndex], r = [e.rowIndex, e.rowIndex];
@@ -4294,10 +4294,10 @@ class yi {
4294
4294
  for (let h = 0; h <= t[1] - t[0]; h++) {
4295
4295
  const c = n + e[0], d = h + t[0], f = this.ctx.database.getItemValueForRowIndexAndColIndex(c, d);
4296
4296
  if (f) {
4297
- const { rowKey: u, key: x } = f;
4298
- this.ctx.database.getReadonly(u, x) || (r.add(u), s.push({
4299
- rowKey: u,
4300
- key: x,
4297
+ const { rowKey: x, key: u } = f;
4298
+ this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
4299
+ rowKey: x,
4300
+ key: u,
4301
4301
  value: null,
4302
4302
  row: {}
4303
4303
  //内部有设置
@@ -4326,18 +4326,18 @@ class yi {
4326
4326
  let o = ii(r);
4327
4327
  const n = [i, i + o[0].length - 1], h = [e, e + o.length - 1], c = o.length === 1 && o[0].length === 1;
4328
4328
  if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
4329
- const x = {
4329
+ const u = {
4330
4330
  code: "ERR_MERGED_CELLS_PASTE",
4331
4331
  message: "Merged cells cannot span paste data"
4332
4332
  };
4333
- this.ctx.hasEvent("error") ? this.ctx.emit("error", x) : alert(x.message);
4333
+ this.ctx.hasEvent("error") ? this.ctx.emit("error", u) : alert(u.message);
4334
4334
  return;
4335
4335
  }
4336
4336
  let d = [];
4337
- for (let x = 0; x <= o.length - 1; x++) {
4338
- const p = o[x].length;
4337
+ for (let u = 0; u <= o.length - 1; u++) {
4338
+ const p = o[u].length;
4339
4339
  for (let g = 0; g <= p - 1; g++) {
4340
- const w = x + e, y = g + i, E = o[x][g], m = this.ctx.database.getItemValueForRowIndexAndColIndex(
4340
+ const w = u + e, y = g + i, E = o[u][g], m = this.ctx.database.getItemValueForRowIndexAndColIndex(
4341
4341
  w,
4342
4342
  y
4343
4343
  );
@@ -4354,13 +4354,13 @@ class yi {
4354
4354
  }
4355
4355
  }
4356
4356
  if (this.isCut) {
4357
- const x = this.clearSelectedData(
4357
+ const u = this.clearSelectedData(
4358
4358
  this.ctx.selector.xArrCopy,
4359
4359
  this.ctx.selector.yArrCopy,
4360
4360
  !0
4361
4361
  // 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
4362
4362
  ), p = d.map((g) => `${g.rowKey}-${g.key}`);
4363
- x.forEach((g) => {
4363
+ u.forEach((g) => {
4364
4364
  p.includes(`${g.rowKey}-${g.key}`) || d.unshift(g);
4365
4365
  }), this.isCut = !1;
4366
4366
  }
@@ -4368,21 +4368,21 @@ class yi {
4368
4368
  return;
4369
4369
  const { BEFORE_PASTE_DATA_METHOD: f } = this.ctx.config;
4370
4370
  if (typeof f == "function") {
4371
- const x = f, p = d.map((g) => ({
4371
+ const u = f, p = d.map((g) => ({
4372
4372
  rowKey: g.rowKey,
4373
4373
  key: g.key,
4374
4374
  value: g.value,
4375
4375
  oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
4376
4376
  row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
4377
4377
  }));
4378
- if (d = await x(p, n, h), d && !d.length)
4378
+ if (d = await u(p, n, h), d && !d.length)
4379
4379
  return;
4380
4380
  }
4381
4381
  this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(d, !0);
4382
- let u = [];
4383
- s.forEach((x) => {
4384
- u.push(this.ctx.database.getRowDataItemForRowKey(x));
4385
- }), this.ctx.emit("pasteChange", d, u);
4382
+ let x = [];
4383
+ s.forEach((u) => {
4384
+ x.push(this.ctx.database.getRowDataItemForRowKey(u));
4385
+ }), this.ctx.emit("pasteChange", d, x);
4386
4386
  }).catch((r) => {
4387
4387
  console.error("Failed to get the clipboard content:", r);
4388
4388
  });
@@ -4428,8 +4428,8 @@ class yi {
4428
4428
  SELECTOR_AREA_MAX_Y: o,
4429
4429
  SELECTOR_AREA_MAX_X_OFFSET: n,
4430
4430
  SELECTOR_AREA_MAX_Y_OFFSET: h
4431
- } = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, u = o || this.ctx.maxRowIndex - h;
4432
- return !(e < c || e > d || t < f || t > u);
4431
+ } = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, x = o || this.ctx.maxRowIndex - h;
4432
+ return !(e < c || e > d || t < f || t > x);
4433
4433
  }
4434
4434
  /**
4435
4435
  * 调整滚动条位置,让到达边界时自动滚动
@@ -4471,7 +4471,7 @@ class yi {
4471
4471
  body: h,
4472
4472
  scrollX: c,
4473
4473
  scrollY: d,
4474
- config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: p }
4474
+ config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION: u, ENABLE_MERGE_CELL_LINK: p }
4475
4475
  } = this.ctx;
4476
4476
  if (!i)
4477
4477
  return;
@@ -4480,7 +4480,7 @@ class yi {
4480
4480
  let R = o.height - w, S = E;
4481
4481
  S > h.visibleHeight && (S = h.visibleHeight);
4482
4482
  let L = 0;
4483
- u && (x === "top" ? R = o.height + n.height - w : L = n.visibleHeight);
4483
+ x && (u === "top" ? R = o.height + n.height - w : L = n.visibleHeight);
4484
4484
  const I = w + S - (t - L - f);
4485
4485
  let v = c, A = d;
4486
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));
@@ -4497,9 +4497,9 @@ class mi {
4497
4497
  init() {
4498
4498
  this.ctx.on("cellMouseenter", (t, e) => {
4499
4499
  this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
4500
- const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, n = r[1], h = o[1], { colIndex: c, rowIndex: d, drawX: f, drawY: u, width: x, height: p } = t;
4500
+ const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, n = r[1], h = o[1], { colIndex: c, rowIndex: d, drawX: f, drawY: x, width: u, height: p } = t;
4501
4501
  if (this.ctx.config.ENABLE_AUTOFILL && c === n && d === h) {
4502
- const w = f + x - 6, y = u + p - 6;
4502
+ const w = f + u - 6, y = x + p - 6;
4503
4503
  i > w && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
4504
4504
  }
4505
4505
  this.mouseenter(t);
@@ -4544,9 +4544,9 @@ class mi {
4544
4544
  SELECTOR_AREA_MAX_X: c,
4545
4545
  SELECTOR_AREA_MIN_Y: d,
4546
4546
  SELECTOR_AREA_MAX_Y: f,
4547
- SELECTOR_AREA_MAX_X_OFFSET: u,
4548
- SELECTOR_AREA_MAX_Y_OFFSET: x
4549
- } = this.ctx.config, p = h, g = c || this.ctx.maxColIndex - u, w = d, y = f || this.ctx.maxRowIndex - x;
4547
+ SELECTOR_AREA_MAX_X_OFFSET: x,
4548
+ SELECTOR_AREA_MAX_Y_OFFSET: u
4549
+ } = this.ctx.config, p = h, g = c || this.ctx.maxColIndex - x, w = d, y = f || this.ctx.maxRowIndex - u;
4550
4550
  let [E, m] = o, [C, b] = n;
4551
4551
  if (E < p || C < w)
4552
4552
  return;
@@ -4570,24 +4570,24 @@ class mi {
4570
4570
  */
4571
4571
  async autofillData() {
4572
4572
  const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
4573
- for (let x = 0; x <= e.yArr[1] - e.yArr[0]; x++)
4573
+ for (let u = 0; u <= e.yArr[1] - e.yArr[0]; u++)
4574
4574
  for (let p = 0; p <= e.xArr[1] - e.xArr[0]; p++) {
4575
- const g = x + e.yArr[0], w = p + e.xArr[0];
4575
+ const g = u + e.yArr[0], w = p + e.xArr[0];
4576
4576
  i.set(`${g}-${w}`, !0);
4577
4577
  }
4578
4578
  const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr, c = r === 1 && o === 1;
4579
4579
  if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
4580
- const x = {
4580
+ const u = {
4581
4581
  code: "ERR_MERGED_CELLS_AUTOFILL",
4582
4582
  message: "Merged cells cannot span autofill data"
4583
4583
  };
4584
- this.ctx.hasEvent("error") ? this.ctx.emit("error", x) : alert(x.message);
4584
+ this.ctx.hasEvent("error") ? this.ctx.emit("error", u) : alert(u.message);
4585
4585
  return;
4586
4586
  }
4587
4587
  let d = [];
4588
- for (let x = 0; x <= h[1] - h[0]; x++)
4588
+ for (let u = 0; u <= h[1] - h[0]; u++)
4589
4589
  for (let p = 0; p <= n[1] - n[0]; p++) {
4590
- const g = p + n[0], w = x + h[0], y = s[x % o][p % r], E = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), m = `${w}-${g}`;
4590
+ const g = p + n[0], w = u + h[0], y = s[u % o][p % r], E = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), m = `${w}-${g}`;
4591
4591
  if (E && !i.has(m)) {
4592
4592
  const { rowKey: C, key: b } = E;
4593
4593
  this.ctx.database.getReadonly(C, b) || (t.add(C), d.push({
@@ -4603,21 +4603,21 @@ class mi {
4603
4603
  this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
4604
4604
  const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
4605
4605
  if (typeof f == "function") {
4606
- const x = f, p = d.map((g) => ({
4606
+ const u = f, p = d.map((g) => ({
4607
4607
  rowKey: g.rowKey,
4608
4608
  key: g.key,
4609
4609
  value: g.value,
4610
4610
  oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
4611
4611
  row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
4612
4612
  }));
4613
- if (d = await x(p, n, h), d && !d.length)
4613
+ if (d = await u(p, n, h), d && !d.length)
4614
4614
  return;
4615
4615
  }
4616
4616
  this.ctx.batchSetItemValueByEditor(d, !0);
4617
- let u = [];
4618
- t.forEach((x) => {
4619
- u.push(this.ctx.database.getRowDataItemForRowKey(x));
4620
- }), this.ctx.emit("autofillChange", d, u);
4617
+ let x = [];
4618
+ t.forEach((u) => {
4619
+ x.push(this.ctx.database.getRowDataItemForRowKey(u));
4620
+ }), this.ctx.emit("autofillChange", d, x);
4621
4621
  }
4622
4622
  mouseenter(t) {
4623
4623
  if (["index", "selection", "index-selection"].includes(t.type))
@@ -4741,48 +4741,48 @@ function zt(a, t, e) {
4741
4741
  reference: i,
4742
4742
  floating: s
4743
4743
  } = a;
4744
- const r = J(t), o = Ht(t), n = Mt(o), h = q(t), c = r === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, u = i[n] / 2 - s[n] / 2;
4745
- let x;
4744
+ const r = J(t), o = Ht(t), n = Mt(o), h = q(t), c = r === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, x = i[n] / 2 - s[n] / 2;
4745
+ let u;
4746
4746
  switch (h) {
4747
4747
  case "top":
4748
- x = {
4748
+ u = {
4749
4749
  x: d,
4750
4750
  y: i.y - s.height
4751
4751
  };
4752
4752
  break;
4753
4753
  case "bottom":
4754
- x = {
4754
+ u = {
4755
4755
  x: d,
4756
4756
  y: i.y + i.height
4757
4757
  };
4758
4758
  break;
4759
4759
  case "right":
4760
- x = {
4760
+ u = {
4761
4761
  x: i.x + i.width,
4762
4762
  y: f
4763
4763
  };
4764
4764
  break;
4765
4765
  case "left":
4766
- x = {
4766
+ u = {
4767
4767
  x: i.x - s.width,
4768
4768
  y: f
4769
4769
  };
4770
4770
  break;
4771
4771
  default:
4772
- x = {
4772
+ u = {
4773
4773
  x: i.x,
4774
4774
  y: i.y
4775
4775
  };
4776
4776
  }
4777
4777
  switch (lt(t)) {
4778
4778
  case "start":
4779
- x[o] -= u * (e && c ? -1 : 1);
4779
+ u[o] -= x * (e && c ? -1 : 1);
4780
4780
  break;
4781
4781
  case "end":
4782
- x[o] += u * (e && c ? -1 : 1);
4782
+ u[o] += x * (e && c ? -1 : 1);
4783
4783
  break;
4784
4784
  }
4785
- return x;
4785
+ return u;
4786
4786
  }
4787
4787
  const Oi = async (a, t, e) => {
4788
4788
  const {
@@ -4798,7 +4798,7 @@ const Oi = async (a, t, e) => {
4798
4798
  }), {
4799
4799
  x: d,
4800
4800
  y: f
4801
- } = zt(c, i, h), u = i, x = {}, p = 0;
4801
+ } = zt(c, i, h), x = i, u = {}, p = 0;
4802
4802
  for (let g = 0; g < n.length; g++) {
4803
4803
  const {
4804
4804
  name: w,
@@ -4812,9 +4812,9 @@ const Oi = async (a, t, e) => {
4812
4812
  x: d,
4813
4813
  y: f,
4814
4814
  initialPlacement: i,
4815
- placement: u,
4815
+ placement: x,
4816
4816
  strategy: s,
4817
- middlewareData: x,
4817
+ middlewareData: u,
4818
4818
  rects: c,
4819
4819
  platform: o,
4820
4820
  elements: {
@@ -4822,27 +4822,27 @@ const Oi = async (a, t, e) => {
4822
4822
  floating: t
4823
4823
  }
4824
4824
  });
4825
- d = E ?? d, f = m ?? f, x = {
4826
- ...x,
4825
+ d = E ?? d, f = m ?? f, u = {
4826
+ ...u,
4827
4827
  [w]: {
4828
- ...x[w],
4828
+ ...u[w],
4829
4829
  ...C
4830
4830
  }
4831
- }, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (u = b.placement), b.rects && (c = b.rects === !0 ? await o.getElementRects({
4831
+ }, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (x = b.placement), b.rects && (c = b.rects === !0 ? await o.getElementRects({
4832
4832
  reference: a,
4833
4833
  floating: t,
4834
4834
  strategy: s
4835
4835
  }) : b.rects), {
4836
4836
  x: d,
4837
4837
  y: f
4838
- } = zt(c, u, h)), g = -1);
4838
+ } = zt(c, x, h)), g = -1);
4839
4839
  }
4840
4840
  return {
4841
4841
  x: d,
4842
4842
  y: f,
4843
- placement: u,
4843
+ placement: x,
4844
4844
  strategy: s,
4845
- middlewareData: x
4845
+ middlewareData: u
4846
4846
  };
4847
4847
  };
4848
4848
  async function le(a, t) {
@@ -4859,9 +4859,9 @@ async function le(a, t) {
4859
4859
  boundary: c = "clippingAncestors",
4860
4860
  rootBoundary: d = "viewport",
4861
4861
  elementContext: f = "floating",
4862
- altBoundary: u = !1,
4863
- padding: x = 0
4864
- } = at(t, a), p = ae(x), w = n[u ? f === "floating" ? "reference" : "floating" : f], y = ut(await r.getClippingRect({
4862
+ altBoundary: x = !1,
4863
+ padding: u = 0
4864
+ } = at(t, a), p = ae(u), w = n[x ? f === "floating" ? "reference" : "floating" : f], y = ut(await r.getClippingRect({
4865
4865
  element: (e = await (r.isElement == null ? void 0 : r.isElement(w))) == null || e ? w : w.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(n.floating)),
4866
4866
  boundary: c,
4867
4867
  rootBoundary: d,
@@ -4908,17 +4908,17 @@ const Si = (a) => ({
4908
4908
  } = at(a, t) || {};
4909
4909
  if (c == null)
4910
4910
  return {};
4911
- const f = ae(d), u = {
4911
+ const f = ae(d), x = {
4912
4912
  x: e,
4913
4913
  y: i
4914
- }, x = Ht(s), p = Mt(x), g = await o.getDimensions(c), w = x === "y", y = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", C = r.reference[p] + r.reference[x] - u[x] - r.floating[p], b = u[x] - r.reference[x], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c));
4914
+ }, 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
4915
  let S = R ? R[m] : 0;
4916
4916
  (!S || !await (o.isElement == null ? void 0 : o.isElement(R))) && (S = n.floating[m] || r.floating[p]);
4917
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;
4918
4918
  return {
4919
- [x]: u[x] + K,
4919
+ [u]: x[u] + K,
4920
4920
  data: {
4921
- [x]: N,
4921
+ [u]: N,
4922
4922
  centerOffset: T - N - K,
4923
4923
  ...Y && {
4924
4924
  alignmentOffset: K
@@ -4943,16 +4943,16 @@ const Si = (a) => ({
4943
4943
  } = t, {
4944
4944
  mainAxis: d = !0,
4945
4945
  crossAxis: f = !0,
4946
- fallbackPlacements: u,
4947
- fallbackStrategy: x = "bestFit",
4946
+ fallbackPlacements: x,
4947
+ fallbackStrategy: u = "bestFit",
4948
4948
  fallbackAxisSideDirection: p = "none",
4949
4949
  flipAlignment: g = !0,
4950
4950
  ...w
4951
4951
  } = at(a, t);
4952
4952
  if ((e = r.arrow) != null && e.alignmentOffset)
4953
4953
  return {};
4954
- const y = q(s), E = J(n), m = q(n) === n, C = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), b = u || (m || !g ? [xt(n)] : vi(n)), R = p !== "none";
4955
- !u && R && b.push(...Ii(n, g, p, C));
4954
+ 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
+ !x && R && b.push(...Ii(n, g, p, C));
4956
4956
  const S = [n, ...b], L = await le(t, w), I = [];
4957
4957
  let v = ((i = r.flip) == null ? void 0 : i.overflows) || [];
4958
4958
  if (d && I.push(L[y]), f) {
@@ -4977,7 +4977,7 @@ const Si = (a) => ({
4977
4977
  };
4978
4978
  let Y = (O = v.filter((K) => K.overflows[0] <= 0).sort((K, W) => K.overflows[1] - W.overflows[1])[0]) == null ? void 0 : O.placement;
4979
4979
  if (!Y)
4980
- switch (x) {
4980
+ switch (u) {
4981
4981
  case "bestFit": {
4982
4982
  var M;
4983
4983
  const K = (M = v.filter((W) => {
@@ -5014,8 +5014,8 @@ async function Ai(a, t) {
5014
5014
  elements: s
5015
5015
  } = a, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), n = lt(e), h = J(e) === "y", c = ["left", "top"].includes(o) ? -1 : 1, d = r && h ? -1 : 1, f = at(t, a);
5016
5016
  let {
5017
- mainAxis: u,
5018
- crossAxis: x,
5017
+ mainAxis: x,
5018
+ crossAxis: u,
5019
5019
  alignmentAxis: p
5020
5020
  } = typeof f == "number" ? {
5021
5021
  mainAxis: f,
@@ -5026,12 +5026,12 @@ async function Ai(a, t) {
5026
5026
  crossAxis: f.crossAxis || 0,
5027
5027
  alignmentAxis: f.alignmentAxis
5028
5028
  };
5029
- return n && typeof p == "number" && (x = n === "end" ? p * -1 : p), h ? {
5030
- x: x * d,
5031
- y: u * c
5029
+ return n && typeof p == "number" && (u = n === "end" ? p * -1 : p), h ? {
5030
+ x: u * d,
5031
+ y: x * c
5032
5032
  } : {
5033
- x: u * c,
5034
- y: x * d
5033
+ x: x * c,
5034
+ y: u * d
5035
5035
  };
5036
5036
  }
5037
5037
  const Ti = function(a) {
@@ -5084,11 +5084,11 @@ const Ti = function(a) {
5084
5084
  } = at(a, t), c = {
5085
5085
  x: e,
5086
5086
  y: i
5087
- }, d = await le(t, h), f = J(q(s)), u = ne(f);
5088
- let x = c[u], p = c[f];
5087
+ }, d = await le(t, h), f = J(q(s)), x = ne(f);
5088
+ let u = c[x], p = c[f];
5089
5089
  if (r) {
5090
- const w = u === "y" ? "top" : "left", y = u === "y" ? "bottom" : "right", E = x + d[w], m = x - d[y];
5091
- x = _t(E, x, m);
5090
+ const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", E = u + d[w], m = u - d[y];
5091
+ u = _t(E, u, m);
5092
5092
  }
5093
5093
  if (o) {
5094
5094
  const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", E = p + d[w], m = p - d[y];
@@ -5096,7 +5096,7 @@ const Ti = function(a) {
5096
5096
  }
5097
5097
  const g = n.fn({
5098
5098
  ...t,
5099
- [u]: x,
5099
+ [x]: u,
5100
5100
  [f]: p
5101
5101
  });
5102
5102
  return {
@@ -5105,7 +5105,7 @@ const Ti = function(a) {
5105
5105
  x: g.x - e,
5106
5106
  y: g.y - i,
5107
5107
  enabled: {
5108
- [u]: r,
5108
+ [x]: r,
5109
5109
  [f]: o
5110
5110
  }
5111
5111
  }
@@ -5269,9 +5269,9 @@ function ot(a, t, e, i) {
5269
5269
  const n = Xi(r, e, i) ? xe(r) : z(0);
5270
5270
  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
5271
  if (r) {
5272
- const u = F(r), x = i && X(i) ? F(i) : i;
5273
- let p = u, g = Lt(p);
5274
- for (; g && i && x !== p; ) {
5272
+ const x = F(r), u = i && X(i) ? F(i) : i;
5273
+ let p = x, g = Lt(p);
5274
+ for (; g && i && u !== p; ) {
5275
5275
  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
5276
  h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += C, p = F(g), g = Lt(p);
5277
5277
  }
@@ -5299,8 +5299,8 @@ function ki(a) {
5299
5299
  }, c = z(1);
5300
5300
  const d = z(0), f = B(i);
5301
5301
  if ((f || !f && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), B(i))) {
5302
- const u = ot(i);
5303
- c = Z(i), d.x = u.x + i.clientLeft, d.y = u.y + i.clientTop;
5302
+ const x = ot(i);
5303
+ c = Z(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
5304
5304
  }
5305
5305
  return {
5306
5306
  width: e.width * c.x,
@@ -5423,19 +5423,19 @@ function zi(a, t, e) {
5423
5423
  const h = z(0);
5424
5424
  if (i || !i && !r)
5425
5425
  if ((tt(t) !== "body" || ht(s)) && (n = pt(t)), i) {
5426
- const x = ot(t, !0, r, t);
5427
- h.x = x.x + t.clientLeft, h.y = x.y + t.clientTop;
5426
+ const u = ot(t, !0, r, t);
5427
+ h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
5428
5428
  } else s && (h.x = At(s));
5429
5429
  let c = 0, d = 0;
5430
5430
  if (s && !i && !r) {
5431
- const x = s.getBoundingClientRect();
5432
- d = x.top + n.scrollTop, c = x.left + n.scrollLeft - // RTL <body> scrollbar.
5433
- At(s, x);
5431
+ const u = s.getBoundingClientRect();
5432
+ d = u.top + n.scrollTop, c = u.left + n.scrollLeft - // RTL <body> scrollbar.
5433
+ At(s, u);
5434
5434
  }
5435
- const f = o.left + n.scrollLeft - h.x - c, u = o.top + n.scrollTop - h.y - d;
5435
+ const f = o.left + n.scrollLeft - h.x - c, x = o.top + n.scrollTop - h.y - d;
5436
5436
  return {
5437
5437
  x: f,
5438
- y: u,
5438
+ y: x,
5439
5439
  width: o.width,
5440
5440
  height: o.height
5441
5441
  };
@@ -5587,26 +5587,26 @@ let Ui = class {
5587
5587
  top: `${c}px`,
5588
5588
  left: `${h}px`
5589
5589
  }), f.arrow) {
5590
- const u = f.arrow;
5590
+ const x = f.arrow;
5591
5591
  ["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
5592
- top: `${u.y}px`,
5592
+ top: `${x.y}px`,
5593
5593
  bottom: "",
5594
5594
  left: "",
5595
5595
  right: "-5px"
5596
5596
  }) : ["right", "right-start", "right-end"].includes(d) ? Object.assign(this.arrowEl.style, {
5597
- top: `${u.y}px`,
5597
+ top: `${x.y}px`,
5598
5598
  bottom: "",
5599
5599
  left: "-5px",
5600
5600
  right: ""
5601
5601
  }) : ["bottom", "bottom-start", "bottom-end"].includes(d) ? Object.assign(this.arrowEl.style, {
5602
5602
  top: "-5px",
5603
5603
  bottom: "",
5604
- left: `${u.x}px`,
5604
+ left: `${x.x}px`,
5605
5605
  right: ""
5606
5606
  }) : ["top", "top-start", "top-end"].includes(d) && Object.assign(this.arrowEl.style, {
5607
5607
  top: "",
5608
5608
  bottom: "-5px",
5609
- left: `${u.x}px`,
5609
+ left: `${x.x}px`,
5610
5610
  right: ""
5611
5611
  });
5612
5612
  }
@@ -5629,11 +5629,12 @@ class Zi {
5629
5629
  l(this, "ctx");
5630
5630
  l(this, "drawY", 0);
5631
5631
  l(this, "drawX", 0);
5632
+ l(this, "cancel", !1);
5632
5633
  this.ctx = t, this.initTextEditor(), this.init();
5633
5634
  }
5634
5635
  init() {
5635
- this.ctx.on("focusout", () => {
5636
- this.ctx.editing || (this.cellTarget = null);
5636
+ this.ctx.on("focusout", (t) => {
5637
+ t.target !== this.ctx.stageElement && (this.ctx.editing && this.doneEdit(), this.cellTarget = null);
5637
5638
  }), this.ctx.on("onScroll", () => {
5638
5639
  this.enable && this.doneEdit();
5639
5640
  }), this.ctx.on("cellHeaderMousedown", () => {
@@ -5641,9 +5642,32 @@ class Zi {
5641
5642
  }), this.ctx.on("keydown", (t) => {
5642
5643
  if (!this.ctx.isTarget())
5643
5644
  return;
5645
+ if (t.code === "Escape" && this.ctx.editing) {
5646
+ this.cancel = !0;
5647
+ const { focusCell: h } = this.ctx;
5648
+ h && (this.ctx.emit("setSelectorCell", h), this.cellTarget = h), this.doneEdit();
5649
+ return;
5650
+ }
5651
+ if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
5652
+ t.preventDefault();
5653
+ const h = this.inputEl.selectionStart, c = this.inputEl.value.substring(0, h), d = this.inputEl.value.substring(h);
5654
+ this.inputEl.value = c + `
5655
+ ` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = h + 1, this.autoSize();
5656
+ return;
5657
+ }
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) {
5662
+ this.ctx.emit("setMoveFocus", "TOP");
5663
+ return;
5664
+ }
5665
+ this.ctx.emit("setMoveFocus", "BOTTOM");
5666
+ return;
5667
+ }
5644
5668
  const e = t.key, i = t.ctrlKey, s = t.altKey, r = t.shiftKey, o = t.metaKey;
5645
5669
  i || s || r || o || [
5646
- // "Enter",
5670
+ "Enter",
5647
5671
  "Escape",
5648
5672
  "Tab",
5649
5673
  "Backspace",
@@ -5668,9 +5692,8 @@ class Zi {
5668
5692
  "F9",
5669
5693
  "F10",
5670
5694
  "F11",
5671
- "F12",
5672
- "Enter"
5673
- ].includes(e) || this.startEdit();
5695
+ "F12"
5696
+ ].includes(e) || this.startEdit(!0);
5674
5697
  }), this.ctx.on("adjustBoundaryPosition", (t) => {
5675
5698
  this.cellTarget = t;
5676
5699
  const { xArr: e, yArr: i } = this.ctx.selector;
@@ -5703,20 +5726,7 @@ class Zi {
5703
5726
  return !(e < r || e > o || t < n || t > h);
5704
5727
  }
5705
5728
  initTextEditor() {
5706
- this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("keydown", (t) => {
5707
- if (!t.isComposing && this.enable) {
5708
- if (t.stopPropagation(), (t.altKey || t.metaKey) && t.code === "Enter") {
5709
- t.preventDefault();
5710
- const e = this.inputEl.selectionStart, i = this.inputEl.value.substring(0, e), s = this.inputEl.value.substring(e);
5711
- this.inputEl.value = i + `
5712
- ` + s, this.inputEl.selectionStart = this.inputEl.selectionEnd = e + 1, this.autoSize();
5713
- return;
5714
- }
5715
- (t.code === "Escape" || t.code === "Enter") && (t.preventDefault(), this.inputEl.blur(), this.ctx.emit("setMoveFocus", "BOTTOM"));
5716
- }
5717
- }), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
5718
- this.doneEdit();
5719
- }), this.editorEl = this.ctx.editorElement, this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
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);
5720
5730
  }
5721
5731
  autoSize() {
5722
5732
  this.inputEl.style.height = "auto";
@@ -5730,42 +5740,43 @@ class Zi {
5730
5740
  } = this.ctx, n = i - s.height - o;
5731
5741
  this.editorEl.style.bottom = "auto", this.drawY < r.height && (this.editorEl.style.top = `${r.height - 1}px`), this.drawY + t > n && (this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = "auto", this.editorEl.style.bottom = `${i - n}px`), this.inputEl.style.height = `${t}px`;
5732
5742
  }
5733
- startEditByInput(t) {
5734
- const e = t.getValue(), { editorType: i } = t;
5743
+ startEditByInput(t, e = !1) {
5744
+ const i = e ? null : t.getValue(), { editorType: s } = t;
5735
5745
  this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
5736
- let { drawX: s, drawY: r, height: o, width: n } = t;
5737
- this.drawX = s, this.drawY = r;
5746
+ let { drawX: r, drawY: o, height: n, width: h } = t;
5747
+ this.drawX = r, this.drawY = o;
5738
5748
  const {
5739
- config: { CELL_PADDING: h },
5740
- header: c
5749
+ config: { CELL_PADDING: c },
5750
+ header: d
5741
5751
  } = this.ctx;
5742
- let d = this.ctx.body.visibleHeight;
5743
- if (o > d && (o = d), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${s - 1}px`, this.editorEl.style.top = `${r - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${d}px`, i === "text") {
5744
- this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${n - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${d}px`, this.inputEl.style.width = `${n - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, e !== null && (this.inputEl.value = e), this.inputEl.focus();
5745
- const f = this.inputEl.value.length;
5746
- this.inputEl.setSelectionRange(f, f);
5752
+ let f = this.ctx.body.visibleHeight;
5753
+ if (n > f && (n = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${r - 1}px`, this.editorEl.style.top = `${o - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
5754
+ this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${h - 1}px`, this.inputEl.style.minHeight = `${n - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${h - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${c}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus();
5755
+ const x = this.inputEl.value.length;
5756
+ this.inputEl.setSelectionRange(x, x);
5747
5757
  } else
5748
5758
  this.inputEl.style.display = "none";
5749
- (this.inputEl.scrollHeight > o || r < c.height) && this.autoSize();
5759
+ (this.inputEl.scrollHeight > n || o < d.height) && this.autoSize();
5750
5760
  }
5751
5761
  doneEditByInput() {
5752
5762
  if (this.cellTarget && (this.editorEl.style.display = "none", this.cellTarget.editorType === "text")) {
5753
5763
  const { rowKey: t, key: e } = this.cellTarget, i = this.cellTarget.getValue(), s = this.inputEl.value;
5754
- s !== i && !(s === "" && i === null) && this.ctx.setItemValueByEditor(t, e, s, !0), this.inputEl.value = "";
5764
+ s !== i && !(s === "" && i === null) && !this.cancel && this.ctx.setItemValueByEditor(t, e, s, !0), this.inputEl.value = "";
5755
5765
  }
5756
5766
  }
5757
- startEdit() {
5758
- const { ENABLE_EDIT_CLICK_SELECTOR: t } = this.ctx.config;
5759
- if (!t)
5767
+ startEdit(t = !1) {
5768
+ this.cancel = !1;
5769
+ const { ENABLE_EDIT_CLICK_SELECTOR: e } = this.ctx.config;
5770
+ if (!e)
5760
5771
  return;
5761
- const e = this.ctx.focusCell;
5762
- if (!e || ["index", "index-selection", "selection"].includes(e.type) || this.enable)
5772
+ const i = this.ctx.focusCell;
5773
+ if (!i || ["index", "index-selection", "selection"].includes(i.type) || this.enable)
5763
5774
  return;
5764
- const { rowKey: i, key: s, editorType: r } = e;
5765
- if (r === "none")
5775
+ const { rowKey: s, key: r, editorType: o } = i;
5776
+ if (o === "none")
5766
5777
  return;
5767
- const o = this.ctx.database.getReadonly(i, s);
5768
- e && !o && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
5778
+ const n = this.ctx.database.getReadonly(s, r);
5779
+ i && !n && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
5769
5780
  }
5770
5781
  editCell(t, e) {
5771
5782
  const i = this.ctx.body.renderRows.find((c) => c.rowIndex === t);
@@ -5846,7 +5857,7 @@ class Qi {
5846
5857
  n.forEach((w) => {
5847
5858
  w.render && (w.fixed === "left" ? c.push(w) : w.fixed === "right" ? d.push(w) : h.push(w));
5848
5859
  });
5849
- const f = e - i, u = {
5860
+ const f = e - i, x = {
5850
5861
  key: "left",
5851
5862
  style: {
5852
5863
  position: "absolute",
@@ -5857,7 +5868,7 @@ class Qi {
5857
5868
  height: `${o}px`
5858
5869
  },
5859
5870
  cells: c
5860
- }, x = {
5871
+ }, u = {
5861
5872
  key: "center",
5862
5873
  style: {
5863
5874
  position: "absolute",
@@ -5889,7 +5900,7 @@ class Qi {
5889
5900
  width: `${r}px`,
5890
5901
  height: `${o}px`
5891
5902
  },
5892
- views: [u, x, p]
5903
+ views: [x, u, p]
5893
5904
  };
5894
5905
  }
5895
5906
  getBody() {
@@ -5904,7 +5915,7 @@ class Qi {
5904
5915
  fixedLeftWidth: r,
5905
5916
  fixedRightWidth: o,
5906
5917
  config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: h }
5907
- } = this.ctx, { visibleWidth: c, visibleHeight: d } = this.ctx.body, f = o - n, u = {
5918
+ } = this.ctx, { visibleWidth: c, visibleHeight: d } = this.ctx.body, f = o - n, x = {
5908
5919
  key: "left",
5909
5920
  style: {
5910
5921
  position: "absolute",
@@ -5915,7 +5926,7 @@ class Qi {
5915
5926
  height: `${d}px`
5916
5927
  },
5917
5928
  cells: e
5918
- }, x = {
5929
+ }, u = {
5919
5930
  key: "center",
5920
5931
  style: {
5921
5932
  position: "absolute",
@@ -5947,7 +5958,7 @@ class Qi {
5947
5958
  width: `${c}px`,
5948
5959
  height: `${d}px`
5949
5960
  },
5950
- views: [u, x, p]
5961
+ views: [x, u, p]
5951
5962
  };
5952
5963
  }
5953
5964
  getFooter() {
@@ -5972,7 +5983,7 @@ class Qi {
5972
5983
  height: `${c}px`
5973
5984
  },
5974
5985
  cells: e
5975
- }, u = {
5986
+ }, x = {
5976
5987
  key: "center",
5977
5988
  style: {
5978
5989
  position: "absolute",
@@ -5983,7 +5994,7 @@ class Qi {
5983
5994
  height: `${c}px`
5984
5995
  },
5985
5996
  cells: t
5986
- }, x = {
5997
+ }, u = {
5987
5998
  key: "right",
5988
5999
  style: {
5989
6000
  position: "absolute",
@@ -6004,7 +6015,7 @@ class Qi {
6004
6015
  width: `${h}px`,
6005
6016
  height: `${c}px`
6006
6017
  },
6007
- views: [f, u, x]
6018
+ views: [f, x, u]
6008
6019
  };
6009
6020
  }
6010
6021
  }
@@ -6021,7 +6032,7 @@ class ts {
6021
6032
  e.preventDefault();
6022
6033
  const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n, h] = s, { rowIndex: c, colIndex: d } = t;
6023
6034
  c >= n && c <= h && d >= r && d <= o || this.ctx.emit("setSelectorCell", t, e);
6024
- const u = {
6035
+ const x = {
6025
6036
  getBoundingClientRect: () => ({
6026
6037
  width: 0,
6027
6038
  height: 0,
@@ -6034,11 +6045,11 @@ class ts {
6034
6045
  }),
6035
6046
  contextElement: document.body
6036
6047
  };
6037
- me(u, this.contextMenuEl, {
6048
+ me(x, this.contextMenuEl, {
6038
6049
  placement: "right-start",
6039
6050
  middleware: [we(), pe(), ye()]
6040
- }).then(({ x, y: p }) => {
6041
- this.show(x, p);
6051
+ }).then(({ x: u, y: p }) => {
6052
+ this.show(u, p);
6042
6053
  });
6043
6054
  }), this.ctx.on("click", this.hide.bind(this)), this.ctx.on("onScroll", this.hide.bind(this)), this.ctx.on("resize", this.hide.bind(this));
6044
6055
  }