e-virt-table 0.1.27 → 0.1.28

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
@@ -797,7 +797,7 @@ class ii {
797
797
  if (typeof c == "function" && (w = c), d) {
798
798
  const p = i[d];
799
799
  if (this.checkboxKeyMap.has(p)) {
800
- const y = this.checkboxKeyMap.get(p);
800
+ const y = this.checkboxKeyMap.get(p) || [];
801
801
  y.push(x), this.checkboxKeyMap.set(p, y);
802
802
  } else
803
803
  this.checkboxKeyMap.set(p, [x]);
@@ -824,7 +824,10 @@ class ii {
824
824
  * @param height
825
825
  */
826
826
  setRowHeight(t, e) {
827
- const i = this.rowIndexRowKeyMap.get(t), s = this.rowKeyMap.get(i);
827
+ const i = this.rowIndexRowKeyMap.get(t);
828
+ if (i === void 0)
829
+ return;
830
+ const s = this.rowKeyMap.get(i);
828
831
  s.height = e, s.item._height = e, this.clearBufferData();
829
832
  }
830
833
  /**
@@ -970,7 +973,7 @@ class ii {
970
973
  * @returns
971
974
  */
972
975
  getRowKeyForRowIndex(t) {
973
- return this.rowIndexRowKeyMap.get(t);
976
+ return this.rowIndexRowKeyMap.get(t) || "";
974
977
  }
975
978
  getRowKeyByItem(t) {
976
979
  return this.itemRowKeyMap.get(t);
@@ -988,7 +991,7 @@ class ii {
988
991
  if (!(this.rowIndexRowKeyMap.has(t) && this.colIndexKeyMap.get(e)))
989
992
  return null;
990
993
  const s = this.rowIndexRowKeyMap.get(t), r = this.colIndexKeyMap.get(e);
991
- return {
994
+ return s === void 0 || r === void 0 ? null : {
992
995
  rowKey: s,
993
996
  key: r,
994
997
  value: this.getItemValue(s, r)
@@ -1161,7 +1164,7 @@ class ii {
1161
1164
  if (!this.rowKeyMap.has(t))
1162
1165
  return !1;
1163
1166
  const { item: s } = this.rowKeyMap.get(t), r = s[i];
1164
- this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((a) => {
1167
+ this.checkboxKeyMap.has(r) && (this.checkboxKeyMap.get(r) || []).forEach((a) => {
1165
1168
  const h = this.rowKeyMap.get(a);
1166
1169
  h.check = e;
1167
1170
  });
@@ -1327,7 +1330,7 @@ class ii {
1327
1330
  if (i)
1328
1331
  return !0;
1329
1332
  const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), o = s == null ? void 0 : s.readonly, a = r == null ? void 0 : r.readonly, { BODY_CELL_READONLY_METHOD: h } = this.ctx.config;
1330
- if (typeof h == "function") {
1333
+ if (typeof h == "function" && r) {
1331
1334
  const d = h({
1332
1335
  row: s.item,
1333
1336
  rowIndex: s.rowIndex,
@@ -1348,7 +1351,10 @@ class ii {
1348
1351
  }
1349
1352
  getValidator(t, e) {
1350
1353
  return new Promise((i) => {
1351
- const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { BODY_CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
1354
+ const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { BODY_CELL_RULES_METHOD: o } = this.ctx.config;
1355
+ if (r === void 0)
1356
+ return i([]);
1357
+ const a = r.column;
1352
1358
  let h = a.rules;
1353
1359
  if (typeof o == "function") {
1354
1360
  const d = o({
@@ -1362,7 +1368,7 @@ class ii {
1362
1368
  }
1363
1369
  if (h) {
1364
1370
  let c = {}, d = {};
1365
- if (d[e] = this.getItemValue(t, e), Array.isArray(h) && h.length) {
1371
+ if (d[e] = this.getItemValue(t, e), Array.isArray(h)) {
1366
1372
  const x = h.map((u) => ({
1367
1373
  ...u,
1368
1374
  row: s.item,
@@ -2026,7 +2032,7 @@ class ee extends te {
2026
2032
  l(this, "render");
2027
2033
  l(this, "renderFooter");
2028
2034
  l(this, "style", {});
2029
- l(this, "rules", {});
2035
+ l(this, "rules", []);
2030
2036
  l(this, "message", "");
2031
2037
  l(this, "text", "");
2032
2038
  l(this, "displayText", "");
@@ -2052,13 +2058,13 @@ class ee extends te {
2052
2058
  l(this, "overflowTooltipShow", !0);
2053
2059
  l(this, "overflowTooltipMaxWidth", 500);
2054
2060
  l(this, "overflowTooltipPlacement", "top");
2055
- this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = c.key, this.type = c.type || "", this.editorType = c.editorType || "text", this.editorProps = c.editorProps || {}, this.cellType = f, this.align = c.align || "center", this.verticalAlign = c.verticalAlign || "middle", this.fixed = c.fixed, this.level = c.level || 0, this.operation = c.operation || !1, this.column = c, this.rules = c.rules || {}, this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = c.render, this.overflowTooltipShow = c.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = c.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = c.overflowTooltipPlacement || "top", this.renderFooter = c.renderFooter, this.hoverIconName = c.hoverIconName, this.formatter = c.formatter, this.formatterFooter = c.formatterFooter, this.update();
2061
+ this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = c.key, this.type = c.type || "", this.editorType = c.editorType || "text", this.editorProps = c.editorProps || {}, this.cellType = f, this.align = c.align || "center", this.verticalAlign = c.verticalAlign || "middle", this.fixed = c.fixed, this.level = c.level || 0, this.operation = c.operation || !1, this.column = c, this.rules = c.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = c.render, this.overflowTooltipShow = c.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = c.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = c.overflowTooltipPlacement || "top", this.renderFooter = c.renderFooter, this.hoverIconName = c.hoverIconName, this.formatter = c.formatter, this.formatterFooter = c.formatterFooter, this.update();
2056
2062
  }
2057
2063
  getValidationMessage() {
2058
2064
  const e = this.ctx.database.getValidationError(this.rowKey, this.key);
2059
2065
  if (Array.isArray(e) && e.length) {
2060
2066
  const [i] = e;
2061
- this.message = i.message;
2067
+ this.message = i.message || "";
2062
2068
  }
2063
2069
  return this.message;
2064
2070
  }
@@ -3005,7 +3011,7 @@ class Pt {
3005
3011
  } = this.ctx, a = s, h = i, c = e.height, d = e.width, f = t.height, x = this.ctx.footer.height;
3006
3012
  if (this.type === "vertical") {
3007
3013
  this.visibleDistance = h - r - c, this.distance = f - this.visibleDistance + x, this.trackX = a - r, this.trackY = 0, this.splitPoints = [this.trackX, c, this.trackX + r, c], this.trackWidth = r, this.trackHeight = h, this.barX = this.trackX - 0.5 + (r - o) / 2, this.barWidth = o;
3008
- const u = this.distance ? this.visibleDistance / f : 0;
3014
+ const u = this.distance ? this.visibleDistance / (f + x) : 0;
3009
3015
  let g = Math.floor(u * this.visibleDistance);
3010
3016
  g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = c + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3011
3017
  } else {
@@ -3315,7 +3321,7 @@ class se {
3315
3321
  l(this, "rowKey", "");
3316
3322
  l(this, "rowType", "body");
3317
3323
  l(this, "data");
3318
- this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = h, this.data = a, this.update();
3324
+ this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType = h, this.data = a, this.update();
3319
3325
  }
3320
3326
  update() {
3321
3327
  const { header: t } = this.ctx, e = [], i = [], s = [];
@@ -3853,7 +3859,7 @@ class ui {
3853
3859
  yArr: this.ctx.selector.yArrCopy,
3854
3860
  data: t
3855
3861
  }), this.ctx.emit("draw");
3856
- }).catch((i) => console.error("复制失败:", i)) : console.error("当前浏览器不支持Clipboard API");
3862
+ }).catch((i) => console.error("Copy Failure:", i)) : console.error("current browser does not support the Clipboard API");
3857
3863
  }
3858
3864
  clearSelectedData(t, e, i = !1) {
3859
3865
  let s = [];
@@ -3884,14 +3890,17 @@ class ui {
3884
3890
  }
3885
3891
  paste() {
3886
3892
  if (!navigator.clipboard) {
3887
- console.error("当前浏览器不支持Clipboard API");
3893
+ console.error("current browser does not support the Clipboard API");
3888
3894
  return;
3889
3895
  }
3890
3896
  const { ENABLE_PASTER: t } = this.ctx.config;
3891
3897
  if (this.ctx.selector.enable && t) {
3892
3898
  const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
3893
3899
  navigator.clipboard.readText().then(async (r) => {
3894
- let o = ti(r), a = [];
3900
+ console.log(typeof r);
3901
+ let o = ti(r);
3902
+ console.log(o);
3903
+ let a = [];
3895
3904
  for (let d = 0; d <= o.length - 1; d++) {
3896
3905
  const f = o[d].length;
3897
3906
  for (let x = 0; x <= f - 1; x++) {
@@ -3941,7 +3950,7 @@ class ui {
3941
3950
  c.push(this.ctx.database.getRowDataItemForRowKey(d));
3942
3951
  }), this.ctx.emit("pasteChange", a, c);
3943
3952
  }).catch((r) => {
3944
- console.error("获取剪贴板内容失败:", r);
3953
+ console.error("Failed to get the clipboard content:", r);
3945
3954
  });
3946
3955
  }
3947
3956
  }