e-virt-table 0.1.7 → 0.1.9

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
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(':root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10px}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:"absolute";left:0;top:0;overflow:hidden;z-index:10}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(":root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
2
  var me = Object.defineProperty;
3
3
  var Ee = (n, t, e) => t in n ? me(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
4
4
  var h = (n, t, e) => Ee(n, typeof t != "symbol" ? t + "" : t, e);
@@ -917,6 +917,18 @@ class ii {
917
917
  const i = this.rowKeyMap.get(t);
918
918
  i.expand = e, this.clearBufferData(), this.ctx.emit("draw");
919
919
  }
920
+ setExpandRowKeys(t, e = !0) {
921
+ t.forEach((i) => {
922
+ const s = this.rowKeyMap.get(i);
923
+ s.expand = e;
924
+ }), this.clearBufferData(), this.ctx.emit("draw");
925
+ }
926
+ getExpandRowKeys() {
927
+ let t = [];
928
+ return this.rowKeyMap.forEach((e, i) => {
929
+ e.expand && t.push(i);
930
+ }), t;
931
+ }
920
932
  expandAll(t) {
921
933
  this.rowKeyMap.forEach((e) => {
922
934
  e.expand = t;
@@ -1022,7 +1034,7 @@ class ii {
1022
1034
  });
1023
1035
  return s.forEach((a) => {
1024
1036
  r.push(this.ctx.database.getRowDataItemForRowKey(a));
1025
- }), this.ctx.emit("change", o, r), e && this.ctx.history.pushState({
1037
+ }), this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData()), this.ctx.emit("change", o, r), e && this.ctx.history.pushState({
1026
1038
  changeList: i,
1027
1039
  scrollX: this.ctx.scrollX,
1028
1040
  scrollY: this.ctx.scrollY,
@@ -1051,27 +1063,36 @@ class ii {
1051
1063
  };
1052
1064
  a[e] !== null && typeof a[e] == "object" && (l = JSON.parse(JSON.stringify(a[e])));
1053
1065
  const c = `${t}​_${e}`;
1054
- if (this.originalDataMap.has(c) || this.originalDataMap.set(c, l), this.changedDataMap.set(c, i), a[e] = i, o) {
1055
- const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
1066
+ this.originalDataMap.has(c) || this.originalDataMap.set(c, l);
1067
+ const f = this.originalDataMap.get(c), { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
1068
+ let x = i;
1069
+ if (typeof d == "function" && (x = d({
1070
+ rowKey: t,
1071
+ key: e,
1072
+ oldValue: l,
1073
+ value: i,
1074
+ originalValue: f
1075
+ })), this.changedDataMap.set(c, x), a[e] = x, o) {
1076
+ const u = this.ctx.database.getRowDataItemForRowKey(t), g = {
1056
1077
  rowKey: t,
1057
1078
  key: e,
1058
- value: i,
1059
- row: f
1079
+ value: x,
1080
+ row: u
1060
1081
  };
1061
- this.ctx.emit("change", [d], [f]), this.ctx.emit("editChange", {
1082
+ this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData()), this.ctx.emit("change", [g], [u]), this.ctx.emit("editChange", {
1062
1083
  rowKey: t,
1063
1084
  key: e,
1064
1085
  oldValue: l,
1065
- value: i,
1066
- originalValue: this.originalDataMap.get(c),
1067
- row: f
1086
+ value: x,
1087
+ originalValue: f,
1088
+ row: u
1068
1089
  });
1069
1090
  }
1070
1091
  return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
1071
1092
  rowKey: t,
1072
1093
  key: e,
1073
1094
  oldValue: l,
1074
- value: i,
1095
+ value: x,
1075
1096
  originalValue: this.originalDataMap.get(c),
1076
1097
  row: this.ctx.database.getRowDataItemForRowKey(t)
1077
1098
  }), s && this.ctx.history.pushState({
@@ -1083,12 +1104,12 @@ class ii {
1083
1104
  rowKey: t,
1084
1105
  key: e,
1085
1106
  oldValue: l,
1086
- newValue: i
1107
+ newValue: x
1087
1108
  }
1088
1109
  ]
1089
1110
  }), this.getValidator(t, e), r && this.ctx.emit("draw"), {
1090
1111
  oldValue: l,
1091
- newValue: i
1112
+ newValue: x
1092
1113
  };
1093
1114
  }
1094
1115
  /**
@@ -1275,7 +1296,7 @@ class ii {
1275
1296
  return t ? (this.headerMap.set(t, e), !0) : !1;
1276
1297
  }
1277
1298
  getReadonly(t, e) {
1278
- const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), r = i == null ? void 0 : i.readonly, o = s == null ? void 0 : s.readonly, { CELL_READONLY_METHOD: a } = this.ctx.config;
1299
+ const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), r = i == null ? void 0 : i.readonly, o = s == null ? void 0 : s.readonly, { BODY_CELL_READONLY_METHOD: a } = this.ctx.config;
1279
1300
  if (typeof a == "function") {
1280
1301
  const c = a({
1281
1302
  row: i.item,
@@ -1292,9 +1313,12 @@ class ii {
1292
1313
  clearValidate() {
1293
1314
  this.validationErrorMap.clear();
1294
1315
  }
1316
+ hasValidationError() {
1317
+ return this.validationErrorMap.size !== 0;
1318
+ }
1295
1319
  getValidator(t, e) {
1296
1320
  return new Promise((i) => {
1297
- const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
1321
+ const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { BODY_CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
1298
1322
  let l = a.rules;
1299
1323
  if (typeof o == "function") {
1300
1324
  const f = o({
@@ -1326,7 +1350,7 @@ class ii {
1326
1350
  colIndex: r.colIndex
1327
1351
  };
1328
1352
  new nt(c).validate(f).then(() => {
1329
- this.setValidationError(t, e, []), i([]);
1353
+ this.clearValidationError(t, e), i([]), this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1330
1354
  }).catch(({ errors: x }) => {
1331
1355
  const u = x.map((g) => ({
1332
1356
  ...g,
@@ -1367,6 +1391,10 @@ class ii {
1367
1391
  const s = `${t}​_${e}`;
1368
1392
  this.validationErrorMap.set(s, i);
1369
1393
  }
1394
+ clearValidationError(t, e) {
1395
+ const i = `${t}​_${e}`;
1396
+ this.validationErrorMap.has(i) && this.validationErrorMap.delete(i);
1397
+ }
1370
1398
  getValidationError(t, e) {
1371
1399
  const i = `${t}​_${e}`;
1372
1400
  return this.validationErrorMap.get(i) || [];
@@ -1767,16 +1795,17 @@ class Wt {
1767
1795
  h(this, "HEADER_CELL_STYLE_METHOD");
1768
1796
  h(this, "BODY_CELL_STYLE_METHOD");
1769
1797
  h(this, "FOOTER_CELL_STYLE_METHOD");
1770
- h(this, "CELL_READONLY_METHOD");
1771
- h(this, "CELL_FORMATTER_METHOD");
1772
- h(this, "CELL_RULES_METHOD");
1773
- h(this, "CELL_TYPE_METHOD");
1774
- h(this, "CELL_EDITOR_TYPE_METHOD");
1775
- h(this, "CELL_RENDER_METHOD");
1776
- h(this, "CELL_HOVER_ICON_METHOD");
1798
+ h(this, "BODY_CELL_READONLY_METHOD");
1799
+ h(this, "BODY_CELL_FORMATTER_METHOD");
1800
+ h(this, "BODY_CELL_RULES_METHOD");
1801
+ h(this, "BODY_CELL_TYPE_METHOD");
1802
+ h(this, "BODY_CELL_EDITOR_TYPE_METHOD");
1803
+ h(this, "BODY_CELL_RENDER_METHOD");
1804
+ h(this, "BODY_CELL_HOVER_ICON_METHOD");
1777
1805
  h(this, "SPAN_METHOD");
1778
1806
  h(this, "SELECTABLE_METHOD");
1779
1807
  h(this, "EXPAND_LAZY_METHOD");
1808
+ h(this, "BEFORE_VALUE_CHANGE_METHOD");
1780
1809
  Object.assign(this, t);
1781
1810
  }
1782
1811
  init(t) {
@@ -1943,6 +1972,7 @@ class ee extends te {
1943
1972
  constructor(e, i, s, r, o, a, l, c, f, d = "body") {
1944
1973
  super(e, r, o, a, l, c.fixed, d);
1945
1974
  h(this, "formatter");
1975
+ h(this, "formatterFooter");
1946
1976
  h(this, "hoverIconName", "");
1947
1977
  h(this, "operation", !1);
1948
1978
  h(this, "align");
@@ -1970,6 +2000,7 @@ class ee extends te {
1970
2000
  h(this, "displayText", "");
1971
2001
  h(this, "visibleWidth", 0);
1972
2002
  h(this, "visibleHeight", 0);
2003
+ h(this, "isHasChanged", !1);
1973
2004
  h(this, "drawX", 0);
1974
2005
  h(this, "drawY", 0);
1975
2006
  h(this, "drawCellBgColor", "");
@@ -1989,7 +2020,7 @@ class ee extends te {
1989
2020
  h(this, "overflowTooltipShow", !0);
1990
2021
  h(this, "overflowTooltipMaxWidth", 500);
1991
2022
  h(this, "overflowTooltipPlacement", "top");
1992
- this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = c.key, this.type = c.type || "text", this.editorType = c.editorType || "text", this.cellType = d, this.align = c.align || "center", this.verticalAlign = c.verticalAlign || "middle", this.fixed = c.fixed, this.level = c.level, this.operation = c.operation || !1, this.column = c, this.rules = c.rules, this.row = f, 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.update();
2023
+ this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = c.key, this.type = c.type || "text", this.editorType = c.editorType || "text", this.cellType = d, this.align = c.align || "center", this.verticalAlign = c.verticalAlign || "middle", this.fixed = c.fixed, this.level = c.level, this.operation = c.operation || !1, this.column = c, this.rules = c.rules, this.row = f, 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();
1993
2024
  }
1994
2025
  getValidationMessage() {
1995
2026
  const e = this.ctx.database.getValidationError(this.rowKey, this.key);
@@ -2000,7 +2031,7 @@ class ee extends te {
2000
2031
  return this.message;
2001
2032
  }
2002
2033
  update() {
2003
- this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.drawTextX = this.drawX, this.drawTextY = this.drawY, this.updateSpan(), this.updateStyle(), this.updateType(), this.updateHoverIcon(), this.updateSelection(), this.updateTree(), this.updateEditorType(), this.updateRender(), this.getValidationMessage(), this.updateContainer(), this.text = this.getText(), this.displayText = this.getDisplayText();
2034
+ this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.drawTextX = this.drawX, this.drawTextY = this.drawY, this.isHasChanged = this.ctx.database.isHasChangedData(this.rowKey, this.key), this.updateSpan(), this.updateStyle(), this.updateType(), this.updateHoverIcon(), this.updateSelection(), this.updateTree(), this.updateEditorType(), this.updateRender(), this.getValidationMessage(), this.updateContainer(), this.text = this.getText(), this.displayText = this.getDisplayText();
2004
2035
  }
2005
2036
  updateSpan() {
2006
2037
  if (this.cellType === "footer")
@@ -2023,7 +2054,7 @@ class ee extends te {
2023
2054
  }
2024
2055
  }
2025
2056
  updateType() {
2026
- const { CELL_TYPE_METHOD: e } = this.ctx.config;
2057
+ const { BODY_CELL_TYPE_METHOD: e } = this.ctx.config;
2027
2058
  if (typeof e == "function") {
2028
2059
  const s = e({
2029
2060
  row: this.row,
@@ -2036,7 +2067,7 @@ class ee extends te {
2036
2067
  }
2037
2068
  }
2038
2069
  updateEditorType() {
2039
- const { CELL_EDITOR_TYPE_METHOD: e } = this.ctx.config;
2070
+ const { BODY_CELL_EDITOR_TYPE_METHOD: e } = this.ctx.config;
2040
2071
  if (typeof e == "function") {
2041
2072
  const s = e({
2042
2073
  row: this.row,
@@ -2049,7 +2080,7 @@ class ee extends te {
2049
2080
  }
2050
2081
  }
2051
2082
  updateRender() {
2052
- const { CELL_RENDER_METHOD: e } = this.ctx.config;
2083
+ const { BODY_CELL_RENDER_METHOD: e } = this.ctx.config;
2053
2084
  if (typeof e == "function") {
2054
2085
  const s = e({
2055
2086
  row: this.row,
@@ -2140,6 +2171,7 @@ class ee extends te {
2140
2171
  rowIndex: this.rowIndex,
2141
2172
  colIndex: this.colIndex,
2142
2173
  column: this.column,
2174
+ isHasChanged: this.isHasChanged,
2143
2175
  value: this.getValue()
2144
2176
  }) || {};
2145
2177
  b && (w = b), m && (y = m);
@@ -2155,7 +2187,7 @@ class ee extends te {
2155
2187
  }
2156
2188
  }
2157
2189
  updateHoverIcon() {
2158
- const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
2190
+ const { BODY_CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
2159
2191
  if (typeof e == "function") {
2160
2192
  const l = e({
2161
2193
  row: this.row,
@@ -2185,7 +2217,13 @@ class ee extends te {
2185
2217
  */
2186
2218
  getText() {
2187
2219
  if (this.cellType === "footer")
2188
- return this.row[this.key];
2220
+ return typeof this.formatterFooter == "function" ? this.formatterFooter({
2221
+ row: this.row,
2222
+ rowIndex: this.rowIndex,
2223
+ colIndex: this.colIndex,
2224
+ column: this.column,
2225
+ value: this.row[this.key]
2226
+ }) : this.row[this.key];
2189
2227
  if (typeof this.formatter == "function")
2190
2228
  return this.formatter({
2191
2229
  row: this.row,
@@ -2194,7 +2232,7 @@ class ee extends te {
2194
2232
  column: this.column,
2195
2233
  value: this.getValue()
2196
2234
  });
2197
- const { CELL_FORMATTER_METHOD: e } = this.ctx.config;
2235
+ const { BODY_CELL_FORMATTER_METHOD: e } = this.ctx.config;
2198
2236
  return typeof e == "function" ? e({
2199
2237
  row: this.row,
2200
2238
  rowIndex: this.rowIndex,
@@ -2217,7 +2255,8 @@ class ee extends te {
2217
2255
  left: e,
2218
2256
  top: i,
2219
2257
  width: `${this.visibleWidth}px`,
2220
- height: `${this.visibleHeight}px`
2258
+ height: `${this.visibleHeight}px`,
2259
+ pointerEvents: "initial"
2221
2260
  };
2222
2261
  }
2223
2262
  draw() {
@@ -2481,7 +2520,8 @@ class ie extends te {
2481
2520
  left: e,
2482
2521
  top: `${this.drawY + 1}px`,
2483
2522
  width: `${this.width}px`,
2484
- height: `${this.height - 2}px`
2523
+ height: `${this.height - 2}px`,
2524
+ pointerEvents: "initial"
2485
2525
  };
2486
2526
  }
2487
2527
  }
@@ -2580,13 +2620,13 @@ class hi {
2580
2620
  column: t.column,
2581
2621
  value: t.getValue()
2582
2622
  }).then((l) => {
2583
- this.ctx.database.setExpandChildren(t.rowKey, l), this.ctx.database.expandLoading(t.rowKey, !1);
2623
+ this.ctx.database.setExpandChildren(t.rowKey, l), this.ctx.database.expandLoading(t.rowKey, !1), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
2584
2624
  }).catch((l) => {
2585
2625
  this.ctx.database.expandLoading(t.rowKey, !1), console.error(l);
2586
2626
  }));
2587
2627
  else {
2588
2628
  const a = this.ctx.database.getIsExpand(t.rowKey);
2589
- this.ctx.database.expandItem(t.rowKey, !a), this.ctx.emit("expandChange");
2629
+ this.ctx.database.expandItem(t.rowKey, !a), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
2590
2630
  }
2591
2631
  }
2592
2632
  }
@@ -2665,6 +2705,8 @@ class li {
2665
2705
  // 自动填充移动中
2666
2706
  h(this, "selectorMove", !1);
2667
2707
  // 选择器移动中
2708
+ h(this, "adjustPositioning", !1);
2709
+ // 调整位置中
2668
2710
  h(this, "editing", !1);
2669
2711
  // 编辑中
2670
2712
  h(this, "scrollY", 0);
@@ -3560,6 +3602,10 @@ class ui {
3560
3602
  }
3561
3603
  this.isMultipleRow = !1, this.click(e.shiftKey);
3562
3604
  }
3605
+ }), this.ctx.on("mouseup", () => {
3606
+ const t = setTimeout(() => {
3607
+ this.ctx.adjustPositioning = !1, clearTimeout(t);
3608
+ }, 0);
3563
3609
  }), this.ctx.on("cellHeaderHoverChange", (t) => {
3564
3610
  this.ctx.mousedown && this.selectCols(t);
3565
3611
  }), this.ctx.on("cellHeaderMousedown", (t) => {
@@ -3742,7 +3788,7 @@ class ui {
3742
3788
  return;
3743
3789
  const { value: t } = this.ctx.getSelectedData(), e = ei(t);
3744
3790
  navigator.clipboard ? navigator.clipboard.writeText(e).then(() => {
3745
- this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("setCopy", this.ctx.selector), this.ctx.emit("drawView");
3791
+ this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("setCopy", this.ctx.selector), this.ctx.emit("draw");
3746
3792
  }).catch((i) => console.error("复制失败:", i)) : console.error("当前浏览器不支持Clipboard API");
3747
3793
  }
3748
3794
  clearSelectedData(t, e, i = !1) {
@@ -3770,7 +3816,7 @@ class ui {
3770
3816
  let o = [];
3771
3817
  return r.forEach((a) => {
3772
3818
  o.push(this.ctx.database.getRowDataItemForRowKey(a));
3773
- }), this.ctx.emit("clearSelectedDataChange", s, o), this.ctx.emit("drawView"), s;
3819
+ }), this.ctx.emit("clearSelectedDataChange", s, o), this.ctx.emit("draw"), s;
3774
3820
  }
3775
3821
  paste() {
3776
3822
  if (!navigator.clipboard) {
@@ -3818,7 +3864,7 @@ class ui {
3818
3864
  let l = [];
3819
3865
  s.forEach((c) => {
3820
3866
  l.push(this.ctx.database.getRowDataItemForRowKey(c));
3821
- }), this.ctx.emit("pasteChange", a, l), this.clearCopyLine(), this.ctx.emit("drawView");
3867
+ }), this.ctx.emit("pasteChange", a, l), this.clearCopyLine(), this.ctx.emit("draw");
3822
3868
  }).catch((r) => {
3823
3869
  console.error("获取剪贴板内容失败:", r);
3824
3870
  });
@@ -3850,7 +3896,7 @@ class ui {
3850
3896
  break;
3851
3897
  }
3852
3898
  const c = [i, i], f = [s, s], d = this.getCell(s, i);
3853
- d && (d.operation || this.isInSettingRange(d.rowIndex, d.colIndex) && (this.ctx.setFocusCell(d), this.setSelector(c, f), this.adjustBoundaryPosition(), this.ctx.emit("drawView")));
3899
+ d && (d.operation || this.isInSettingRange(d.rowIndex, d.colIndex) && (this.ctx.setFocusCell(d), this.setSelector(c, f), this.adjustBoundaryPosition(), this.ctx.emit("draw")));
3854
3900
  }
3855
3901
  stopAdjustPosition() {
3856
3902
  this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
@@ -3912,10 +3958,12 @@ class ui {
3912
3958
  if (!i || i.height > l.visibleHeight || i.width > l.visibleWidth - r - s)
3913
3959
  return;
3914
3960
  let u = 0;
3915
- if (x && (u = a.visibleHeight), i.fixed || !(i.drawX < r || i.drawX + i.width > e - s || i.drawY < this.ctx.header.height || i.drawY + i.height > t - u - d))
3961
+ x && (u = a.visibleHeight);
3962
+ const g = i.drawX < r, w = i.drawX + i.width > e - s, y = i.drawY < o.height, p = i.drawY + i.height > t - u - d;
3963
+ if (i.fixed && !(y || p) || !(g || w || y || p))
3916
3964
  return;
3917
- const g = r - i.drawX + 1, w = i.drawX + i.width - (e - s) + 1, y = o.height - i.drawY, p = i.drawY + i.height - (t - u - d);
3918
- w > 0 && !i.fixed ? this.ctx.setScrollX(c + w) : g > 0 && !i.fixed && this.ctx.setScrollX(c - g), y > 0 ? this.ctx.setScrollY(f - y) : p > 0 && this.ctx.setScrollY(f + p), this.ctx.emit("adjustBoundaryPosition", i);
3965
+ const b = r - i.drawX + 1, m = i.drawX + i.width - (e - s) + 1, E = o.height - i.drawY, C = i.drawY + i.height - (t - u - d);
3966
+ this.ctx.adjustPositioning = !0, m > 0 && !i.fixed ? this.ctx.setScrollX(c + m) : b > 0 && !i.fixed && this.ctx.setScrollX(c - b), E > 0 ? this.ctx.setScrollY(f - E) : C > 0 && this.ctx.setScrollY(f + C), this.ctx.emit("adjustBoundaryPosition", i);
3919
3967
  }
3920
3968
  destroy() {
3921
3969
  this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
@@ -5070,9 +5118,11 @@ class qi {
5070
5118
  }
5071
5119
  this.startEdit();
5072
5120
  }
5121
+ }), this.ctx.on("adjustBoundaryPosition", (t) => {
5122
+ this.cellTarget = t;
5073
5123
  }), this.ctx.on("cellClick", (t) => {
5074
5124
  var e, i;
5075
- t.rowKey === ((e = this.cellTarget) == null ? void 0 : e.rowKey) && t.key === ((i = this.cellTarget) == null ? void 0 : i.key) ? this.startEdit() : (this.doneEdit(), this.cellTarget = t, this.ctx.config.ENABLE_EDIT_SINGLE_CLICK && this.startEdit());
5125
+ this.ctx.adjustPositioning || (t.rowKey === ((e = this.cellTarget) == null ? void 0 : e.rowKey) && t.key === ((i = this.cellTarget) == null ? void 0 : i.key) ? this.startEdit() : (this.doneEdit(), this.cellTarget = t, this.ctx.config.ENABLE_EDIT_SINGLE_CLICK && this.startEdit()));
5076
5126
  });
5077
5127
  }
5078
5128
  initTextEditor() {
@@ -5594,6 +5644,9 @@ class Qi {
5594
5644
  r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
5595
5645
  });
5596
5646
  }
5647
+ hasValidationError() {
5648
+ return this.ctx.database.hasValidationError();
5649
+ }
5597
5650
  scrollTo(t, e) {
5598
5651
  this.scrollXTo(t), this.scrollYTo(e);
5599
5652
  }
@@ -5615,6 +5668,9 @@ class Qi {
5615
5668
  scrollYTo(t) {
5616
5669
  this.ctx.setScrollY(t);
5617
5670
  }
5671
+ setExpandRowKeys(t, e = !0) {
5672
+ this.ctx.database.setExpandRowKeys(t, e);
5673
+ }
5618
5674
  clearSelection() {
5619
5675
  this.ctx.database.clearSelection(), this.ctx.emit("draw");
5620
5676
  }