e-virt-table 1.3.17 → 1.3.19

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
@@ -775,13 +775,17 @@ class vt extends qt {
775
775
  getOverlayerViewsStyle() {
776
776
  let e = this.drawX - this.ctx.fixedLeftWidth, i = this.drawY - this.ctx.body.y;
777
777
  if (this.fixed === "left" ? e = this.drawX : this.fixed === "right" && (e = this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)), this.cellType === "footer" && this.ctx.config.FOOTER_FIXED && (i = this.drawY - this.ctx.footer.y), this.autoRowHeight && this.render && this.verticalAlign === "middle") {
778
- const s = this.ctx.database.getOverlayerAutoHeight(this.rowIndex, this.colIndex);
779
- if (s < this.visibleHeight && s > 0) {
780
- const o = (this.visibleHeight - s) / 2;
781
- i = i + o;
778
+ const o = this.ctx.database.getOverlayerAutoHeight(this.rowIndex, this.colIndex);
779
+ if (o < this.visibleHeight && o > 0) {
780
+ const r = (this.visibleHeight - o) / 2;
781
+ i = i + r;
782
782
  }
783
783
  }
784
- return this.autoRowHeight && this.ctx.database.getOverlayerAutoHeight(this.rowIndex, this.colIndex) === 0 && (e = -99999, i = -99999), {
784
+ this.autoRowHeight && this.ctx.database.getOverlayerAutoHeight(this.rowIndex, this.colIndex) === 0 && (e = -99999, i = -99999);
785
+ let s = {};
786
+ return this.rowspan === 0 && (s = {
787
+ display: "none"
788
+ }), {
785
789
  position: "absolute",
786
790
  overflow: "hidden",
787
791
  left: `${Math.round(e - 1)}px`,
@@ -791,7 +795,8 @@ class vt extends qt {
791
795
  // height: `${this.visibleHeight}px`,
792
796
  // minHeight: `${this.visibleHeight}px`,
793
797
  pointerEvents: "initial",
794
- userSelect: "none"
798
+ userSelect: "none",
799
+ ...s
795
800
  };
796
801
  }
797
802
  drawContainer() {
@@ -1929,37 +1934,39 @@ class be {
1929
1934
  return this.validationErrorMap.size !== 0;
1930
1935
  }
1931
1936
  getValidator(t, e) {
1932
- return new Promise((i) => {
1933
- const s = this.rowKeyMap.get(t), o = this.headerMap.get(e), { BODY_CELL_RULES_METHOD: r } = this.ctx.config;
1934
- if (s === void 0 || o === void 0)
1935
- return i([]);
1936
- const a = o.column;
1937
- let l = a.rules;
1938
- if (typeof r == "function") {
1939
- const d = r({
1940
- row: s.item,
1941
- rowIndex: s.rowIndex,
1942
- colIndex: o.colIndex,
1943
- column: a,
1937
+ return this.ctx.database.getReadonly(t, e) ? new Promise((s) => {
1938
+ s([]);
1939
+ }) : new Promise((s) => {
1940
+ const o = this.rowKeyMap.get(t), r = this.headerMap.get(e), { BODY_CELL_RULES_METHOD: a } = this.ctx.config;
1941
+ if (o === void 0 || r === void 0)
1942
+ return s([]);
1943
+ const l = r.column;
1944
+ let h = l.rules;
1945
+ if (typeof a == "function") {
1946
+ const f = a({
1947
+ row: o.item,
1948
+ rowIndex: o.rowIndex,
1949
+ colIndex: r.colIndex,
1950
+ column: l,
1944
1951
  value: this.getItemValue(t, e)
1945
1952
  });
1946
- d && (l = d);
1953
+ f && (h = f);
1947
1954
  }
1948
- if (l) {
1949
- const h = {
1950
- row: s.item,
1951
- rowIndex: s.rowIndex,
1952
- colIndex: o.colIndex,
1953
- column: a,
1955
+ if (h) {
1956
+ const d = {
1957
+ row: o.item,
1958
+ rowIndex: o.rowIndex,
1959
+ colIndex: r.colIndex,
1960
+ column: l,
1954
1961
  key: e,
1955
1962
  rowKey: t,
1956
1963
  value: this.getItemValue(t, e),
1957
1964
  field: e,
1958
1965
  fieldValue: this.getItemValue(t, e)
1959
- }, f = new ue(l).validate(h);
1960
- this.setValidationError(t, e, f), i(f);
1966
+ }, u = new ue(h).validate(d);
1967
+ this.setValidationError(t, e, u), s(u);
1961
1968
  } else
1962
- this.clearValidationError(t, e), i([]);
1969
+ this.clearValidationError(t, e), s([]);
1963
1970
  });
1964
1971
  }
1965
1972
  getHeightByRowIndexRowSpan(t, e) {
@@ -3479,7 +3486,7 @@ class Le {
3479
3486
  });
3480
3487
  }
3481
3488
  hoverIconClick(t) {
3482
- t.hoverIconName && this.ctx.isPointer && this.ctx.emit("hoverIconClick", t);
3489
+ t.hoverIconName && this.ctx.isPointer && !this.ctx.disableHoverIconClick && this.ctx.emit("hoverIconClick", t);
3483
3490
  }
3484
3491
  /**
3485
3492
  *选中点击
@@ -4640,7 +4647,7 @@ class Jt {
4640
4647
  updateCalculatedHeight() {
4641
4648
  const t = this.calculatedHeightCells.map((e) => {
4642
4649
  const i = e.getAutoHeight(), { key: s, height: o = -1 } = this.ctx.database.getMaxRowHeightItem(this.rowKey) || {};
4643
- return i > o ? this.ctx.database.setMaxRowHeightItem(this.rowKey, e.key, i) : i !== 0 && e.key === s && i < o && this.ctx.database.setMaxRowHeightItem(this.rowKey, e.key, i), i;
4650
+ return i > o ? this.ctx.database.setMaxRowHeightItem(this.rowKey, e.key, i) : e.key === s && i < o && this.ctx.database.setMaxRowHeightItem(this.rowKey, e.key, i), i;
4644
4651
  });
4645
4652
  return this.calculatedHeight = t.length ? Math.max(...t) : -1, this.calculatedHeight;
4646
4653
  }
@@ -5008,7 +5015,9 @@ class Be {
5008
5015
  }
5009
5016
  window.getComputedStyle(e.target).userSelect !== "text" && e.preventDefault(), this.isMultipleRow = !1, this.click(e.shiftKey), this.ctx.emit("selectorClick", t);
5010
5017
  }), this.ctx.on("mouseup", () => {
5011
- this.ctx.selectorMove = !1, this.ctx.stopAdjustPosition(), this.ctx.adjustPositioning = !1, this.ctx.disableHoverIconClick = !1;
5018
+ this.ctx.selectorMove = !1, this.ctx.stopAdjustPosition(), this.ctx.adjustPositioning = !1, setTimeout(() => {
5019
+ this.ctx.disableHoverIconClick = !1;
5020
+ }, 0);
5012
5021
  }), this.ctx.on("cellHeaderHoverChange", (t) => {
5013
5022
  this.ctx.mousedown && this.selectCols(t);
5014
5023
  }), this.ctx.on("cellHoverChange", (t) => {
@@ -6732,13 +6741,13 @@ class Oi {
6732
6741
  this.ctx.on("outsideMousedown", () => {
6733
6742
  this.cellTarget && this.cellTarget.editorType === "text" && this.clearEditor();
6734
6743
  }), this.ctx.on("moveFocus", (t) => {
6735
- this.cellTarget = t;
6744
+ this.cellTarget = t, this.resetEditorStyle();
6736
6745
  const { xArr: e, yArr: i } = this.ctx.selector;
6737
6746
  this.selectorArrStr = JSON.stringify(e) + JSON.stringify(i);
6738
6747
  }), this.ctx.on("onScroll", () => {
6739
6748
  this.enable && this.doneEdit();
6740
6749
  }), this.ctx.on("hoverIconClick", (t) => {
6741
- this.ctx.disableHoverIconClick || this.editCell(t.rowIndex, t.colIndex);
6750
+ this.editCell(t.rowIndex, t.colIndex);
6742
6751
  }), this.ctx.on("cellMousedown", () => {
6743
6752
  this.inputEl.focus({ preventScroll: !0 });
6744
6753
  }), this.ctx.on("keydown", (t) => {
@@ -6820,7 +6829,7 @@ class Oi {
6820
6829
  return;
6821
6830
  }
6822
6831
  }
6823
- if (this.selectorArrStr = s, this.doneEdit(), this.cellTarget = t, this.ctx.config.ENABLE_EDIT_SINGLE_CLICK) {
6832
+ if (this.selectorArrStr = s, this.doneEdit(), this.cellTarget = t, this.resetEditorStyle(), this.ctx.config.ENABLE_EDIT_SINGLE_CLICK) {
6824
6833
  if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.onlyMergeCell) {
6825
6834
  this.startEdit();
6826
6835
  return;
@@ -6839,6 +6848,8 @@ class Oi {
6839
6848
  this.inputEl = document.createElement("textarea"), this.inputEl.id = "e-virt-table-editor-textarea", this.inputEl.setAttribute("rows", "1"), this.inputEl.setAttribute("tabindex", "-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);
6840
6849
  }
6841
6850
  autoSize() {
6851
+ if (!this.ctx.editing)
6852
+ return;
6842
6853
  const t = this.inputEl.value;
6843
6854
  this.cellTarget && this.cellTarget.type === "number" && t !== "" && (this.ctx.emit("cellHideTooltip"), /^-?\d+(\.\d+)?$/.test(t) || this.ctx.emit("cellShowTooltip", this.cellTarget, this.ctx.config.NUMBER_ERROR_TIP)), this.inputEl.style.height = "auto";
6844
6855
  let e = this.inputEl.scrollHeight, i = this.ctx.body.visibleHeight;
@@ -6897,15 +6908,13 @@ class Oi {
6897
6908
  o && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget), this.ctx.emit("draw"));
6898
6909
  }
6899
6910
  doneEdit() {
6900
- if (!this.enable)
6901
- return;
6902
- const {
6903
- header: t,
6904
- config: { CELL_HEIGHT: e }
6905
- } = this.ctx;
6906
- this.doneEditByInput(), this.ctx.emit("cellHideTooltip"), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.inputEl.style.display = "inline-block", this.editorEl.style.left = "0px", this.editorEl.style.top = `${t.height}px`, this.editorEl.style.maxHeight = `${e}px`, this.editorEl.style.zIndex = "-1", setTimeout(() => {
6911
+ this.enable && (this.doneEditByInput(), this.ctx.emit("cellHideTooltip"), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.resetEditorStyle(), setTimeout(() => {
6907
6912
  this.inputEl.focus({ preventScroll: !0 });
6908
- }, 0), this.ctx.emit("draw");
6913
+ }, 0), this.ctx.emit("draw"));
6914
+ }
6915
+ resetEditorStyle() {
6916
+ const t = this.cellTarget;
6917
+ t && (this.editorEl.style.left = `${t.drawX}px`, this.editorEl.style.top = `${t.drawY}px`, this.editorEl.style.maxHeight = `${t.visibleHeight}px`, this.editorEl.style.zIndex = "-1");
6909
6918
  }
6910
6919
  clearEditor() {
6911
6920
  this.doneEdit(), this.cellTarget = null, this.selectorArrStr = "", this.ctx.clearSelector(), this.ctx.focusCell = void 0, this.ctx.emit("draw");
@@ -7916,7 +7925,9 @@ class Xi {
7916
7925
  }
7917
7926
  }
7918
7927
  getValidations() {
7919
- return new Promise(async (t, e) => {
7928
+ return this.ctx.config.DISABLED ? new Promise((t) => {
7929
+ t([]);
7930
+ }) : new Promise(async (t, e) => {
7920
7931
  const i = this.ctx.database.getAllRowsData(), s = this.ctx.header.leafCellHeaders;
7921
7932
  let o = [];
7922
7933
  for (let r = 0; r < i.length; r++)
@@ -8017,6 +8028,9 @@ class Xi {
8017
8028
  clearChangeData() {
8018
8029
  this.ctx.database.clearChangeData(), this.ctx.emit("draw");
8019
8030
  }
8031
+ getReadonly(t, e) {
8032
+ return this.ctx.database.getReadonly(t, e);
8033
+ }
8020
8034
  /**
8021
8035
  * 销毁
8022
8036
  */