e-virt-table 1.0.5 → 1.0.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.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +55 -41
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Body.js +8 -4
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Cell.js +1 -1
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/Context.d.ts +1 -0
- package/dist/lib/Context.js +8 -17
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/Database.js +1 -0
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.js +4 -4
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +18 -5
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/EventBrowser.d.ts +2 -0
- package/dist/lib/EventBrowser.js +11 -1
- package/dist/lib/EventBrowser.js.map +1 -1
- package/dist/lib/EventTable.js +1 -1
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Scroller.js +1 -0
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.js +9 -1
- package/dist/lib/Selector.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1266,7 +1266,7 @@ class Tt extends se {
|
|
|
1266
1266
|
borderWidth: 1
|
|
1267
1267
|
});
|
|
1268
1268
|
const [n, h] = i, [c, d] = s;
|
|
1269
|
-
!(n === h && c === d) && this.colIndex >= n && this.colIndex <= h && this.rowIndex >= c && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.
|
|
1269
|
+
!(n === h && c === d) && this.colIndex >= n && this.colIndex <= h && this.rowIndex >= c && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.width, this.height, {
|
|
1270
1270
|
borderColor: "transparent",
|
|
1271
1271
|
fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)"
|
|
1272
1272
|
}), this.operation && this.rowIndex >= c && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
|
|
@@ -1355,7 +1355,7 @@ class ni {
|
|
|
1355
1355
|
this.data = i, this.footerData = r, this.columns = s, this.setLoading(!0), this.init();
|
|
1356
1356
|
}
|
|
1357
1357
|
init() {
|
|
1358
|
-
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear(), this.itemRowKeyMap = /* @__PURE__ */ new WeakMap(), this.initData(this.data);
|
|
1358
|
+
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear(), this.itemRowKeyMap = /* @__PURE__ */ new WeakMap(), this.initData(this.data), this.getData();
|
|
1359
1359
|
}
|
|
1360
1360
|
/**
|
|
1361
1361
|
* 清除缓存数据
|
|
@@ -2248,7 +2248,7 @@ class li {
|
|
|
2248
2248
|
this.ctx = t, this.init();
|
|
2249
2249
|
}
|
|
2250
2250
|
init() {
|
|
2251
|
-
this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(this.ctx.stageElement, "click", this.handleClick.bind(this)), this.bind(window, "keydown", this.handleKeydown.bind(this)), this.bind(this.ctx.stageElement, "wheel", this.handleWheel.bind(this)), this.bind(this.ctx.stageElement, "touchstart", this.handleTouchstart.bind(this)), this.bind(this.ctx.stageElement, "touchend", this.handleTouchend.bind(this)), this.bind(this.ctx.stageElement, "touchmove", this.handleTouchmove.bind(this)), this.bind(this.ctx.stageElement, "contextmenu", this.handleContextMenu.bind(this)), this.bind(this.ctx.stageElement, "mousedown", this.handleMouseDown.bind(this)), this.bind(this.ctx.stageElement, "dblclick", this.handleDblclick.bind(this)), this.bind(this.ctx.stageElement, "mouseover", this.handleMouseover.bind(this)), this.bind(this.ctx.stageElement, "mouseout", this.handleMouseout.bind(this));
|
|
2251
|
+
this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(this.ctx.stageElement, "click", this.handleClick.bind(this)), this.bind(window, "keydown", this.handleKeydown.bind(this)), this.bind(this.ctx.stageElement, "wheel", this.handleWheel.bind(this)), this.bind(this.ctx.stageElement, "touchstart", this.handleTouchstart.bind(this)), this.bind(this.ctx.stageElement, "touchend", this.handleTouchend.bind(this)), this.bind(this.ctx.stageElement, "touchmove", this.handleTouchmove.bind(this)), this.bind(this.ctx.stageElement, "contextmenu", this.handleContextMenu.bind(this)), this.bind(this.ctx.stageElement, "mousedown", this.handleMouseDown.bind(this)), this.bind(this.ctx.stageElement, "dblclick", this.handleDblclick.bind(this)), this.bind(this.ctx.stageElement, "mouseover", this.handleMouseover.bind(this)), this.bind(this.ctx.stageElement, "mouseout", this.handleMouseout.bind(this)), this.bind(this.ctx.containerElement, "focusin", this.handleFocusin.bind(this)), this.bind(this.ctx.containerElement, "focusout", this.handleFocusout.bind(this));
|
|
2252
2252
|
}
|
|
2253
2253
|
destroy() {
|
|
2254
2254
|
this.eventTasks.forEach((t, e) => {
|
|
@@ -2293,11 +2293,17 @@ class li {
|
|
|
2293
2293
|
this.ctx.isInsideTargetContainer = !0, this.ctx.emit("mouseover", t);
|
|
2294
2294
|
}
|
|
2295
2295
|
handleMouseout(t) {
|
|
2296
|
-
this.ctx.
|
|
2296
|
+
this.ctx.emit("mouseout", t);
|
|
2297
2297
|
}
|
|
2298
2298
|
handleDblclick(t) {
|
|
2299
2299
|
this.ctx.emit("dblclick", t);
|
|
2300
2300
|
}
|
|
2301
|
+
handleFocusin(t) {
|
|
2302
|
+
this.ctx.isInsideTargetContainer = !0, this.ctx.emit("focusin", t);
|
|
2303
|
+
}
|
|
2304
|
+
handleFocusout(t) {
|
|
2305
|
+
this.ctx.isInsideTargetContainer = !1, this.ctx.emit("focusout", t);
|
|
2306
|
+
}
|
|
2301
2307
|
bind(t, e, i, s) {
|
|
2302
2308
|
t.addEventListener(e, i, s), this.eventTasks.set(e, i);
|
|
2303
2309
|
}
|
|
@@ -2866,7 +2872,7 @@ class fi {
|
|
|
2866
2872
|
init() {
|
|
2867
2873
|
this.resizeObserver = new ResizeObserver(() => {
|
|
2868
2874
|
this.ctx.emit("resetHeader"), this.ctx.emit("resizeObserver");
|
|
2869
|
-
}), this.resizeObserver.observe(this.ctx.
|
|
2875
|
+
}), this.resizeObserver.observe(this.ctx.containerElement), this.ctx.on("mousedown", (t) => {
|
|
2870
2876
|
if (t.button !== 0 || this.isBusy(t))
|
|
2871
2877
|
return;
|
|
2872
2878
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
|
|
@@ -3141,7 +3147,7 @@ class xi {
|
|
|
3141
3147
|
} else
|
|
3142
3148
|
this.database.setItemValue(t, e, i, s, r, !0);
|
|
3143
3149
|
}
|
|
3144
|
-
batchSetItemValueByEditor(t, e) {
|
|
3150
|
+
batchSetItemValueByEditor(t, e = !0) {
|
|
3145
3151
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
3146
3152
|
const i = [];
|
|
3147
3153
|
t.forEach((s) => {
|
|
@@ -3161,13 +3167,10 @@ class xi {
|
|
|
3161
3167
|
this.focusCell !== t && (((e = this.focusCell) == null ? void 0 : e.rowKey) !== t.rowKey && (this.focusCell = t, this.emit("rowFocusChange", t)), this.focusCell = t, this.emit("cellFocusChange", t));
|
|
3162
3168
|
}
|
|
3163
3169
|
clearSelector() {
|
|
3164
|
-
this.selector =
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
xArrCopy: [-1, -1],
|
|
3169
|
-
yArrCopy: [-1, -1]
|
|
3170
|
-
};
|
|
3170
|
+
this.selector.enable = !1, this.selector.xArr = [-1, -1], this.selector.yArr = [-1, -1];
|
|
3171
|
+
}
|
|
3172
|
+
clearSelectorCopy() {
|
|
3173
|
+
this.selector.xArrCopy = [-1, -1], this.selector.yArrCopy = [-1, -1];
|
|
3171
3174
|
}
|
|
3172
3175
|
clearAutofill() {
|
|
3173
3176
|
this.autofill = {
|
|
@@ -3411,7 +3414,7 @@ class ui {
|
|
|
3411
3414
|
(t !== this.ctx.scrollX || e !== this.ctx.scrollY) && (this.ctx.emit("onScroll", t, e), t !== this.ctx.scrollX && this.ctx.emit("onScrollX", t), e !== this.ctx.scrollY && this.ctx.emit("onScrollY", e), this.ctx.scrollX = t, this.ctx.scrollY = e, this.ctx.emit("draw"));
|
|
3412
3415
|
}
|
|
3413
3416
|
setScroll(t, e) {
|
|
3414
|
-
this.horizontalScrollbar.scroll = t, this.verticalScrollbar.scroll = e, this.ctx.emit("draw");
|
|
3417
|
+
this.horizontalScrollbar.scroll = t, this.verticalScrollbar.scroll = e, this.ctx.emit("draw"), this.ctx.emit("onScroll", t, e);
|
|
3415
3418
|
}
|
|
3416
3419
|
setScrollX(t) {
|
|
3417
3420
|
this.horizontalScrollbar.scroll = t, this.ctx.emit("draw");
|
|
@@ -3872,17 +3875,25 @@ class wi {
|
|
|
3872
3875
|
}
|
|
3873
3876
|
update() {
|
|
3874
3877
|
this.init();
|
|
3875
|
-
const {
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3878
|
+
const {
|
|
3879
|
+
header: t,
|
|
3880
|
+
database: e,
|
|
3881
|
+
scrollY: i,
|
|
3882
|
+
config: { CELL_HEIGHT: s }
|
|
3883
|
+
} = this.ctx, r = i, { data: o, positions: n } = e.getData();
|
|
3884
|
+
this.ctx.maxRowIndex = o.length - 1;
|
|
3885
|
+
let h = this.binarySearch(n, r), c = this.binarySearch(n, r + this.visibleHeight);
|
|
3886
|
+
if (c === -1 && (c = this.ctx.maxRowIndex), h === -1 && c === this.ctx.maxRowIndex) {
|
|
3887
|
+
const f = Math.floor(this.visibleHeight / s);
|
|
3888
|
+
h = this.ctx.maxRowIndex - f;
|
|
3884
3889
|
}
|
|
3885
|
-
this.
|
|
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
|
+
const d = [];
|
|
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);
|
|
3894
|
+
d.push(w);
|
|
3895
|
+
}
|
|
3896
|
+
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
3886
3897
|
}
|
|
3887
3898
|
draw() {
|
|
3888
3899
|
this.renderRows.forEach((t) => {
|
|
@@ -3974,7 +3985,11 @@ class yi {
|
|
|
3974
3985
|
this.ctx = t, this.init();
|
|
3975
3986
|
}
|
|
3976
3987
|
init() {
|
|
3977
|
-
this.ctx.on(
|
|
3988
|
+
this.ctx.on("focusout", () => {
|
|
3989
|
+
this.ctx.clearSelector(), this.ctx.emit("draw");
|
|
3990
|
+
}), this.ctx.on("setMoveFocus", (t) => {
|
|
3991
|
+
this.moveFocus(t);
|
|
3992
|
+
}), this.ctx.on(
|
|
3978
3993
|
"mousemove",
|
|
3979
3994
|
Jt((t) => {
|
|
3980
3995
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget() && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
|
|
@@ -4031,7 +4046,7 @@ class yi {
|
|
|
4031
4046
|
t.preventDefault(), this.moveFocus("RIGHT");
|
|
4032
4047
|
return;
|
|
4033
4048
|
}
|
|
4034
|
-
if (t.code === "ArrowDown") {
|
|
4049
|
+
if (t.code === "ArrowDown" || t.code === "Enter") {
|
|
4035
4050
|
t.preventDefault(), this.moveFocus("BOTTOM");
|
|
4036
4051
|
return;
|
|
4037
4052
|
}
|
|
@@ -5617,13 +5632,17 @@ class Zi {
|
|
|
5617
5632
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5618
5633
|
}
|
|
5619
5634
|
init() {
|
|
5620
|
-
this.ctx.on("
|
|
5635
|
+
this.ctx.on("focusout", () => {
|
|
5636
|
+
this.ctx.editing || (this.cellTarget = null);
|
|
5637
|
+
}), this.ctx.on("onScroll", () => {
|
|
5621
5638
|
this.enable && this.doneEdit();
|
|
5622
5639
|
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
5623
5640
|
this.enable && this.doneEdit(), this.cellTarget = null;
|
|
5624
5641
|
}), this.ctx.on("keydown", (t) => {
|
|
5642
|
+
if (!this.ctx.isTarget())
|
|
5643
|
+
return;
|
|
5625
5644
|
const e = t.key, i = t.ctrlKey, s = t.altKey, r = t.shiftKey, o = t.metaKey;
|
|
5626
|
-
|
|
5645
|
+
i || s || r || o || [
|
|
5627
5646
|
// "Enter",
|
|
5628
5647
|
"Escape",
|
|
5629
5648
|
"Tab",
|
|
@@ -5649,14 +5668,9 @@ class Zi {
|
|
|
5649
5668
|
"F9",
|
|
5650
5669
|
"F10",
|
|
5651
5670
|
"F11",
|
|
5652
|
-
"F12"
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
t.preventDefault(), this.startEdit();
|
|
5656
|
-
return;
|
|
5657
|
-
}
|
|
5658
|
-
this.startEdit();
|
|
5659
|
-
}
|
|
5671
|
+
"F12",
|
|
5672
|
+
"Enter"
|
|
5673
|
+
].includes(e) || this.startEdit();
|
|
5660
5674
|
}), this.ctx.on("adjustBoundaryPosition", (t) => {
|
|
5661
5675
|
this.cellTarget = t;
|
|
5662
5676
|
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
@@ -5698,7 +5712,7 @@ class Zi {
|
|
|
5698
5712
|
` + s, this.inputEl.selectionStart = this.inputEl.selectionEnd = e + 1, this.autoSize();
|
|
5699
5713
|
return;
|
|
5700
5714
|
}
|
|
5701
|
-
(t.code === "Escape" || t.code === "Enter") && (t.preventDefault(), this.inputEl.blur());
|
|
5715
|
+
(t.code === "Escape" || t.code === "Enter") && (t.preventDefault(), this.inputEl.blur(), this.ctx.emit("setMoveFocus", "BOTTOM"));
|
|
5702
5716
|
}
|
|
5703
5717
|
}), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
5704
5718
|
this.doneEdit();
|
|
@@ -6110,7 +6124,7 @@ class ss {
|
|
|
6110
6124
|
createContainer(t, e, i, s, r) {
|
|
6111
6125
|
t.className = "e-virt-table-container";
|
|
6112
6126
|
const o = document.createElement("div"), n = document.createElement("canvas"), h = e || document.createElement("div");
|
|
6113
|
-
o.className = "e-virt-table-stage", n.className = "e-virt-table-canvas", h.className = "e-virt-table-overlayer";
|
|
6127
|
+
o.className = "e-virt-table-stage", t.tabIndex = 0, n.className = "e-virt-table-canvas", h.className = "e-virt-table-overlayer";
|
|
6114
6128
|
const c = i || document.createElement("div");
|
|
6115
6129
|
c.className = "e-virt-table-editor";
|
|
6116
6130
|
const d = s, f = r;
|
|
@@ -6225,10 +6239,10 @@ class ss {
|
|
|
6225
6239
|
return this.ctx.database.hasValidationError();
|
|
6226
6240
|
}
|
|
6227
6241
|
scrollTo(t, e) {
|
|
6228
|
-
this.
|
|
6242
|
+
this.scroller.setScroll(t, e);
|
|
6229
6243
|
}
|
|
6230
6244
|
scrollXTo(t) {
|
|
6231
|
-
this.
|
|
6245
|
+
this.scroller.setScrollX(t);
|
|
6232
6246
|
}
|
|
6233
6247
|
scrollToColkey(t) {
|
|
6234
6248
|
this.scroller.scrollToColkey(t);
|
|
@@ -6243,7 +6257,7 @@ class ss {
|
|
|
6243
6257
|
this.scroller.scrollToRowIndex(t);
|
|
6244
6258
|
}
|
|
6245
6259
|
scrollYTo(t) {
|
|
6246
|
-
this.
|
|
6260
|
+
this.scroller.setScrollY(t);
|
|
6247
6261
|
}
|
|
6248
6262
|
setExpandRowKeys(t, e = !0) {
|
|
6249
6263
|
this.ctx.database.setExpandRowKeys(t, e);
|