e-virt-table 0.1.20 → 0.1.21

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
@@ -1436,13 +1436,15 @@ class si {
1436
1436
  }
1437
1437
  init() {
1438
1438
  this.ctx.on("keydown", (t) => {
1439
- if (t.ctrlKey && !t.shiftKey && t.code === "KeyZ" || t.metaKey && !t.shiftKey && t.code === "KeyZ") {
1440
- t.preventDefault(), this.ctx.clearSelector(), this.ctx.clearAutofill(), this.backState();
1441
- return;
1442
- }
1443
- if (t.ctrlKey && t.code === "KeyY" || t.ctrlKey && t.shiftKey && t.code === "KeyZ" || t.metaKey && t.shiftKey && t.code === "KeyZ") {
1444
- t.preventDefault(), this.ctx.clearSelector(), this.ctx.clearAutofill(), this.forwardState();
1445
- return;
1439
+ if (!this.ctx.editing) {
1440
+ if (t.ctrlKey && !t.shiftKey && t.code === "KeyZ" || t.metaKey && !t.shiftKey && t.code === "KeyZ") {
1441
+ t.preventDefault(), this.ctx.clearSelector(), this.ctx.clearAutofill(), this.backState();
1442
+ return;
1443
+ }
1444
+ if (t.ctrlKey && t.code === "KeyY" || t.ctrlKey && t.shiftKey && t.code === "KeyZ" || t.metaKey && t.shiftKey && t.code === "KeyZ") {
1445
+ t.preventDefault(), this.ctx.clearSelector(), this.ctx.clearAutofill(), this.forwardState();
1446
+ return;
1447
+ }
1446
1448
  }
1447
1449
  });
1448
1450
  }
@@ -1453,14 +1455,12 @@ class si {
1453
1455
  // 回退
1454
1456
  backState() {
1455
1457
  if (this.historyIndex >= 0) {
1456
- const { changeList: t, scrollX: e, scrollY: i } = this.history[this.historyIndex], s = t.map(
1457
- (r) => ({
1458
- rowKey: r.rowKey,
1459
- key: r.key,
1460
- value: r.oldValue,
1461
- row: {}
1462
- })
1463
- );
1458
+ const { changeList: t, scrollX: e, scrollY: i } = this.history[this.historyIndex], s = t.map((r) => ({
1459
+ rowKey: r.rowKey,
1460
+ key: r.key,
1461
+ value: r.oldValue,
1462
+ row: {}
1463
+ }));
1464
1464
  this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1), this.historyIndex -= 1;
1465
1465
  }
1466
1466
  }
@@ -1468,14 +1468,12 @@ class si {
1468
1468
  forwardState() {
1469
1469
  if (this.historyIndex < this.history.length - 1) {
1470
1470
  this.historyIndex += 1;
1471
- const { changeList: t } = this.history[this.historyIndex], e = t.map(
1472
- (i) => ({
1473
- rowKey: i.rowKey,
1474
- key: i.key,
1475
- value: i.newValue,
1476
- row: {}
1477
- })
1478
- );
1471
+ const { changeList: t } = this.history[this.historyIndex], e = t.map((i) => ({
1472
+ rowKey: i.rowKey,
1473
+ key: i.key,
1474
+ value: i.newValue,
1475
+ row: {}
1476
+ }));
1479
1477
  this.ctx.database.batchSetItemValue(e, !1);
1480
1478
  }
1481
1479
  }
@@ -3658,39 +3656,41 @@ class ui {
3658
3656
  }), this.ctx.on("cellHeaderMousedown", (t, e) => {
3659
3657
  this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || (e.preventDefault(), this.mousedownHeader = !0, this.selectCols(t)));
3660
3658
  }), this.ctx.on("keydown", (t) => {
3661
- if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
3662
- t.preventDefault(), this.paste();
3663
- return;
3664
- }
3665
- if (t.ctrlKey && t.code === "KeyC" || t.metaKey && t.code === "KeyC") {
3666
- t.preventDefault(), this.copy(), this.isCut = !1;
3667
- return;
3668
- }
3669
- if (t.ctrlKey && t.code === "KeyX" || t.metaKey && t.code === "KeyX") {
3670
- t.preventDefault(), this.isCut = !0, this.copy();
3671
- return;
3672
- }
3673
- if ((t.ctrlKey && t.code === "KeyA" || t.metaKey && t.code === "KeyA") && (t.preventDefault(), this.selectAll()), t.code === "ArrowLeft") {
3674
- t.preventDefault(), this.moveFocus("LEFT");
3675
- return;
3676
- }
3677
- if (t.code === "ArrowUp") {
3678
- t.preventDefault(), this.moveFocus("TOP");
3679
- return;
3680
- }
3681
- if (t.code === "ArrowRight" || t.code === "Tab") {
3682
- t.preventDefault(), this.moveFocus("RIGHT");
3683
- return;
3684
- }
3685
- if (t.code === "ArrowDown") {
3686
- t.preventDefault(), this.moveFocus("BOTTOM");
3687
- return;
3688
- }
3689
- if (t.code === "Delete" || t.code === "Backspace") {
3690
- t.preventDefault();
3691
- const { xArr: e, yArr: i } = this.ctx.selector;
3692
- this.clearSelectedData(e, i);
3693
- return;
3659
+ if (!this.ctx.editing) {
3660
+ if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
3661
+ t.preventDefault(), this.paste();
3662
+ return;
3663
+ }
3664
+ if (t.ctrlKey && t.code === "KeyC" || t.metaKey && t.code === "KeyC") {
3665
+ t.preventDefault(), this.copy(), this.isCut = !1;
3666
+ return;
3667
+ }
3668
+ if (t.ctrlKey && t.code === "KeyX" || t.metaKey && t.code === "KeyX") {
3669
+ t.preventDefault(), this.isCut = !0, this.copy();
3670
+ return;
3671
+ }
3672
+ if ((t.ctrlKey && t.code === "KeyA" || t.metaKey && t.code === "KeyA") && (t.preventDefault(), this.selectAll()), t.code === "ArrowLeft") {
3673
+ t.preventDefault(), this.moveFocus("LEFT");
3674
+ return;
3675
+ }
3676
+ if (t.code === "ArrowUp") {
3677
+ t.preventDefault(), this.moveFocus("TOP");
3678
+ return;
3679
+ }
3680
+ if (t.code === "ArrowRight" || t.code === "Tab") {
3681
+ t.preventDefault(), this.moveFocus("RIGHT");
3682
+ return;
3683
+ }
3684
+ if (t.code === "ArrowDown") {
3685
+ t.preventDefault(), this.moveFocus("BOTTOM");
3686
+ return;
3687
+ }
3688
+ if (t.code === "Delete" || t.code === "Backspace") {
3689
+ t.preventDefault(), console.log("删除");
3690
+ const { xArr: e, yArr: i } = this.ctx.selector;
3691
+ this.clearSelectedData(e, i);
3692
+ return;
3693
+ }
3694
3694
  }
3695
3695
  }), this.ctx.on("contextMenuClearSelected", () => {
3696
3696
  const { xArr: t, yArr: e } = this.ctx.selector;