e-virt-table 0.1.14 → 0.1.16
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 +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +185 -129
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Autofill.js +17 -5
- package/dist/lib/Autofill.js.map +1 -1
- package/dist/lib/Cell.d.ts +1 -0
- package/dist/lib/Cell.js +1 -0
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +1 -0
- package/dist/lib/CellHeader.js +1 -0
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Config.d.ts +3 -1
- package/dist/lib/Config.js +12 -0
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Database.d.ts +3 -4
- package/dist/lib/Database.js +45 -21
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +1 -1
- package/dist/lib/EVirtTable.js +1 -4
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/EventBrowser.js +0 -2
- package/dist/lib/EventBrowser.js.map +1 -1
- package/dist/lib/History.js +0 -2
- package/dist/lib/History.js.map +1 -1
- package/dist/lib/Scroller.js +11 -1
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.d.ts +1 -0
- package/dist/lib/Selector.js +30 -7
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/types.d.ts +7 -4
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -131,7 +131,7 @@ function Ie(n, t, e) {
|
|
|
131
131
|
t(a, o);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Ft(n, t, e) {
|
|
135
135
|
var i = 0, s = n.length;
|
|
136
136
|
function r(o) {
|
|
137
137
|
if (o && o.length) {
|
|
@@ -149,7 +149,7 @@ function Oe(n) {
|
|
|
149
149
|
t.push.apply(t, n[e] || []);
|
|
150
150
|
}), t;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var Xt = /* @__PURE__ */ function(n) {
|
|
153
153
|
be(t, n);
|
|
154
154
|
function t(e, i) {
|
|
155
155
|
var s;
|
|
@@ -161,9 +161,9 @@ function Te(n, t, e, i, s) {
|
|
|
161
161
|
if (t.first) {
|
|
162
162
|
var r = new Promise(function(x, u) {
|
|
163
163
|
var g = function(y) {
|
|
164
|
-
return i(y), y.length ? u(new
|
|
164
|
+
return i(y), y.length ? u(new Xt(y, Ct(y))) : x(s);
|
|
165
165
|
}, w = Oe(n);
|
|
166
|
-
|
|
166
|
+
Ft(w, e, g);
|
|
167
167
|
});
|
|
168
168
|
return r.catch(function(x) {
|
|
169
169
|
return x;
|
|
@@ -172,11 +172,11 @@ function Te(n, t, e, i, s) {
|
|
|
172
172
|
var o = t.firstFields === !0 ? Object.keys(n) : t.firstFields || [], a = Object.keys(n), l = a.length, c = 0, f = [], d = new Promise(function(x, u) {
|
|
173
173
|
var g = function(p) {
|
|
174
174
|
if (f.push.apply(f, p), c++, c === l)
|
|
175
|
-
return i(f), f.length ? u(new
|
|
175
|
+
return i(f), f.length ? u(new Xt(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
177
|
a.length || (i(f), x(s)), a.forEach(function(w) {
|
|
178
178
|
var p = n[w];
|
|
179
|
-
o.indexOf(w) !== -1 ?
|
|
179
|
+
o.indexOf(w) !== -1 ? Ft(p, e, g) : Ie(p, e, g);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
return d.catch(function(x) {
|
|
@@ -304,9 +304,9 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
304
304
|
if (x ? d = "number" : u ? d = "string" : g && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
306
|
g && (f = e.length), u && (f = e.replace(c, "_").length), o ? f !== t.len && s.push(M(r.messages[d].len, t.fullField, t.len)) : a && !l && f < t.min ? s.push(M(r.messages[d].min, t.fullField, t.min)) : l && !a && f > t.max ? s.push(M(r.messages[d].max, t.fullField, t.max)) : a && l && (f < t.min || f > t.max) && s.push(M(r.messages[d].range, t.fullField, t.min, t.max));
|
|
307
|
-
}, j = "enum",
|
|
307
|
+
}, j = "enum", Fe = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(M(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
|
-
},
|
|
309
|
+
}, Xe = function(t, e, i, s, r) {
|
|
310
310
|
if (t.pattern) {
|
|
311
311
|
if (t.pattern instanceof RegExp)
|
|
312
312
|
t.pattern.lastIndex = 0, t.pattern.test(e) || s.push(M(r.messages.pattern.mismatch, t.fullField, e, t.pattern));
|
|
@@ -320,8 +320,8 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
320
320
|
whitespace: Le,
|
|
321
321
|
type: He,
|
|
322
322
|
range: De,
|
|
323
|
-
enum:
|
|
324
|
-
pattern:
|
|
323
|
+
enum: Fe,
|
|
324
|
+
pattern: Xe
|
|
325
325
|
}, ke = function(t, e, i, s, r) {
|
|
326
326
|
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
327
327
|
if (a) {
|
|
@@ -788,8 +788,8 @@ class ii {
|
|
|
788
788
|
*/
|
|
789
789
|
initData(t, e = 0) {
|
|
790
790
|
t.forEach((i, s) => {
|
|
791
|
-
let r = !1;
|
|
792
|
-
Array.isArray(i.children) && (r = !0, this.initData(i.children, e + 1));
|
|
791
|
+
let r = i._hasChildren || !1;
|
|
792
|
+
Array.isArray(i.children) && i.children.length && (r = !0, this.initData(i.children, e + 1));
|
|
793
793
|
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT: l, SELECTABLE_METHOD: c, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d != null ? `${d}` : Ut();
|
|
794
794
|
this.itemRowKeyMap.set(i, x);
|
|
795
795
|
const u = i._height || l, g = i._readonly;
|
|
@@ -1010,40 +1010,52 @@ class ii {
|
|
|
1010
1010
|
* @param history
|
|
1011
1011
|
* @returns
|
|
1012
1012
|
*/
|
|
1013
|
-
batchSetItemValue(t, e = !1) {
|
|
1013
|
+
async batchSetItemValue(t, e = !1) {
|
|
1014
1014
|
let i = [];
|
|
1015
1015
|
const s = /* @__PURE__ */ new Set();
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1016
|
+
let r = t;
|
|
1017
|
+
const { BEFORE_VALUE_CHANGE_METHOD: o } = this.ctx.config;
|
|
1018
|
+
if (typeof o == "function") {
|
|
1019
|
+
const f = o, d = t.map((u) => ({
|
|
1020
|
+
rowKey: u.rowKey,
|
|
1021
|
+
key: u.key,
|
|
1022
|
+
value: u.value,
|
|
1023
|
+
oldValue: this.getItemValue(u.rowKey, u.key),
|
|
1024
|
+
row: this.ctx.database.getRowDataItemForRowKey(u.rowKey)
|
|
1025
|
+
}));
|
|
1026
|
+
r = await f(d);
|
|
1027
|
+
}
|
|
1028
|
+
r.forEach((f) => {
|
|
1029
|
+
const { value: d, rowKey: x, key: u } = f, g = this.getItemValue(x, u);
|
|
1030
|
+
this.setItemValue(x, u, d), s.add(x), i.push({
|
|
1031
|
+
rowKey: x,
|
|
1032
|
+
key: u,
|
|
1033
|
+
oldValue: g,
|
|
1034
|
+
newValue: d
|
|
1023
1035
|
});
|
|
1024
1036
|
});
|
|
1025
|
-
let
|
|
1026
|
-
const
|
|
1027
|
-
const
|
|
1037
|
+
let a = [];
|
|
1038
|
+
const l = i.map((f) => {
|
|
1039
|
+
const d = this.ctx.database.getRowDataItemForRowKey(f.rowKey);
|
|
1028
1040
|
return {
|
|
1029
|
-
rowKey:
|
|
1030
|
-
key:
|
|
1031
|
-
value:
|
|
1032
|
-
row:
|
|
1041
|
+
rowKey: f.rowKey,
|
|
1042
|
+
key: f.key,
|
|
1043
|
+
value: f.newValue,
|
|
1044
|
+
row: d
|
|
1033
1045
|
};
|
|
1034
1046
|
});
|
|
1035
|
-
s.forEach((
|
|
1036
|
-
|
|
1047
|
+
s.forEach((f) => {
|
|
1048
|
+
a.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
1037
1049
|
});
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1050
|
+
const c = l.map(({ rowKey: f, key: d }) => this.getValidator(f, d));
|
|
1051
|
+
Promise.all(c).then(() => {
|
|
1040
1052
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1041
|
-
}), this.ctx.emit("change",
|
|
1053
|
+
}), this.ctx.emit("change", l, a), e && this.ctx.history.pushState({
|
|
1042
1054
|
changeList: i,
|
|
1043
1055
|
scrollX: this.ctx.scrollX,
|
|
1044
1056
|
scrollY: this.ctx.scrollY,
|
|
1045
1057
|
type: "multiple"
|
|
1046
|
-
}),
|
|
1058
|
+
}), this.ctx.emit("draw");
|
|
1047
1059
|
}
|
|
1048
1060
|
/**
|
|
1049
1061
|
*设置单一数据
|
|
@@ -1055,7 +1067,7 @@ class ii {
|
|
|
1055
1067
|
* @param isEditor 是否是编辑器
|
|
1056
1068
|
* @returns
|
|
1057
1069
|
*/
|
|
1058
|
-
setItemValue(t, e, i, s = !1, r = !1, o = !1) {
|
|
1070
|
+
async setItemValue(t, e, i, s = !1, r = !1, o = !1) {
|
|
1059
1071
|
if (!this.rowKeyMap.has(t))
|
|
1060
1072
|
return {};
|
|
1061
1073
|
const { item: a } = this.rowKeyMap.get(t);
|
|
@@ -1068,19 +1080,27 @@ class ii {
|
|
|
1068
1080
|
a[e] !== null && typeof a[e] == "object" && (l = JSON.parse(JSON.stringify(a[e])));
|
|
1069
1081
|
const c = `${t}_${e}`;
|
|
1070
1082
|
this.originalDataMap.has(c) || this.originalDataMap.set(c, l);
|
|
1071
|
-
const f = this.originalDataMap.get(c)
|
|
1072
|
-
let
|
|
1073
|
-
if (
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1083
|
+
const f = this.originalDataMap.get(c);
|
|
1084
|
+
let d = i;
|
|
1085
|
+
if (o) {
|
|
1086
|
+
const { BEFORE_VALUE_CHANGE_METHOD: x } = this.ctx.config;
|
|
1087
|
+
if (typeof x == "function") {
|
|
1088
|
+
const p = await x([
|
|
1089
|
+
{
|
|
1090
|
+
rowKey: t,
|
|
1091
|
+
key: e,
|
|
1092
|
+
value: i,
|
|
1093
|
+
oldValue: a[e],
|
|
1094
|
+
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
1095
|
+
}
|
|
1096
|
+
]);
|
|
1097
|
+
p && p.length && (d = p[0].value);
|
|
1098
|
+
}
|
|
1099
|
+
this.changedDataMap.set(c, d), a[e] = d;
|
|
1080
1100
|
const u = this.ctx.database.getRowDataItemForRowKey(t), g = {
|
|
1081
1101
|
rowKey: t,
|
|
1082
1102
|
key: e,
|
|
1083
|
-
value:
|
|
1103
|
+
value: d,
|
|
1084
1104
|
row: u
|
|
1085
1105
|
};
|
|
1086
1106
|
this.getValidator(t, e).then(() => {
|
|
@@ -1089,16 +1109,17 @@ class ii {
|
|
|
1089
1109
|
rowKey: t,
|
|
1090
1110
|
key: e,
|
|
1091
1111
|
oldValue: l,
|
|
1092
|
-
value:
|
|
1112
|
+
value: d,
|
|
1093
1113
|
originalValue: f,
|
|
1094
1114
|
row: u
|
|
1095
1115
|
});
|
|
1096
|
-
}
|
|
1116
|
+
} else
|
|
1117
|
+
this.changedDataMap.set(c, d), a[e] = d;
|
|
1097
1118
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1098
1119
|
rowKey: t,
|
|
1099
1120
|
key: e,
|
|
1100
1121
|
oldValue: l,
|
|
1101
|
-
value:
|
|
1122
|
+
value: d,
|
|
1102
1123
|
originalValue: this.originalDataMap.get(c),
|
|
1103
1124
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
1104
1125
|
}), s && this.ctx.history.pushState({
|
|
@@ -1110,12 +1131,12 @@ class ii {
|
|
|
1110
1131
|
rowKey: t,
|
|
1111
1132
|
key: e,
|
|
1112
1133
|
oldValue: l,
|
|
1113
|
-
newValue:
|
|
1134
|
+
newValue: d
|
|
1114
1135
|
}
|
|
1115
1136
|
]
|
|
1116
1137
|
}), r && this.ctx.emit("draw"), {
|
|
1117
1138
|
oldValue: l,
|
|
1118
|
-
newValue:
|
|
1139
|
+
newValue: d
|
|
1119
1140
|
};
|
|
1120
1141
|
}
|
|
1121
1142
|
/**
|
|
@@ -1440,7 +1461,7 @@ class si {
|
|
|
1440
1461
|
row: {}
|
|
1441
1462
|
})
|
|
1442
1463
|
);
|
|
1443
|
-
this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1), this.historyIndex -= 1
|
|
1464
|
+
this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1), this.historyIndex -= 1;
|
|
1444
1465
|
}
|
|
1445
1466
|
}
|
|
1446
1467
|
// 前进
|
|
@@ -1455,7 +1476,7 @@ class si {
|
|
|
1455
1476
|
row: {}
|
|
1456
1477
|
})
|
|
1457
1478
|
);
|
|
1458
|
-
this.ctx.database.batchSetItemValue(e, !1)
|
|
1479
|
+
this.ctx.database.batchSetItemValue(e, !1);
|
|
1459
1480
|
}
|
|
1460
1481
|
}
|
|
1461
1482
|
// 清空历史
|
|
@@ -1481,10 +1502,10 @@ class ri {
|
|
|
1481
1502
|
this.ctx.emit("resetHeader", t), this.ctx.emit("resize", t);
|
|
1482
1503
|
}
|
|
1483
1504
|
handleMouseDown(t) {
|
|
1484
|
-
t.
|
|
1505
|
+
t.button === 0 && (this.ctx.mousedown = !0), this.ctx.emit("mousedown", t);
|
|
1485
1506
|
}
|
|
1486
1507
|
handleMousemove(t) {
|
|
1487
|
-
|
|
1508
|
+
this.ctx.emit("mousemove", t);
|
|
1488
1509
|
}
|
|
1489
1510
|
handleMouseUp(t) {
|
|
1490
1511
|
t.button === 0 && (this.ctx.mousedown = !1), this.ctx.emit("mouseup", t);
|
|
@@ -1812,6 +1833,8 @@ class Wt {
|
|
|
1812
1833
|
h(this, "SELECTABLE_METHOD");
|
|
1813
1834
|
h(this, "EXPAND_LAZY_METHOD");
|
|
1814
1835
|
h(this, "BEFORE_VALUE_CHANGE_METHOD");
|
|
1836
|
+
h(this, "BEFORE_PASTE_CHANGE_METHOD");
|
|
1837
|
+
h(this, "BEFORE_AUTOFILL_CHANGE_METHOD");
|
|
1815
1838
|
Object.assign(this, t);
|
|
1816
1839
|
}
|
|
1817
1840
|
init(t) {
|
|
@@ -2262,7 +2285,8 @@ class ee extends te {
|
|
|
2262
2285
|
top: i,
|
|
2263
2286
|
width: `${this.visibleWidth}px`,
|
|
2264
2287
|
height: `${this.visibleHeight}px`,
|
|
2265
|
-
pointerEvents: "initial"
|
|
2288
|
+
pointerEvents: "initial",
|
|
2289
|
+
userSelect: "none"
|
|
2266
2290
|
};
|
|
2267
2291
|
}
|
|
2268
2292
|
draw() {
|
|
@@ -2527,7 +2551,8 @@ class ie extends te {
|
|
|
2527
2551
|
top: `${this.drawY + 1}px`,
|
|
2528
2552
|
width: `${this.width}px`,
|
|
2529
2553
|
height: `${this.height - 2}px`,
|
|
2530
|
-
pointerEvents: "initial"
|
|
2554
|
+
pointerEvents: "initial",
|
|
2555
|
+
userSelect: "none"
|
|
2531
2556
|
};
|
|
2532
2557
|
}
|
|
2533
2558
|
}
|
|
@@ -2936,6 +2961,9 @@ class Pt {
|
|
|
2936
2961
|
isPointInElement(t, e, i, s, r, o) {
|
|
2937
2962
|
return t >= i && t <= i + r && e >= s && e <= s + o;
|
|
2938
2963
|
}
|
|
2964
|
+
hasScrollbar() {
|
|
2965
|
+
return this.type === "vertical" ? this.barHeight > 0 : this.type === "horizontal" ? this.barWidth > 0 : !1;
|
|
2966
|
+
}
|
|
2939
2967
|
isOnScrollbar(t, e) {
|
|
2940
2968
|
return this.isPointInElement(t, e, this.barX, this.barY, this.barWidth, this.barHeight);
|
|
2941
2969
|
}
|
|
@@ -2944,7 +2972,7 @@ class Pt {
|
|
|
2944
2972
|
}
|
|
2945
2973
|
updateScroll(t) {
|
|
2946
2974
|
const e = t.deltaX, i = t.deltaY;
|
|
2947
|
-
this.type === "vertical" && t.shiftKey === !1 ? (this.scroll === 0 && i < 0 || this.scroll === this.distance && i > 0
|
|
2975
|
+
this.type === "vertical" && t.shiftKey === !1 ? (this.hasScrollbar() && !(this.scroll === 0 && i < 0 || this.scroll === this.distance && i > 0) && t.preventDefault(), this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance))) : this.type === "horizontal" && (t.shiftKey ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.scroll = Math.max(0, Math.min(this.scroll + e, this.distance)));
|
|
2948
2976
|
}
|
|
2949
2977
|
updatedSize() {
|
|
2950
2978
|
const {
|
|
@@ -3578,6 +3606,7 @@ class ui {
|
|
|
3578
3606
|
constructor(t) {
|
|
3579
3607
|
h(this, "isCut", !1);
|
|
3580
3608
|
h(this, "isMultipleRow", !1);
|
|
3609
|
+
h(this, "mousedownHeader", !1);
|
|
3581
3610
|
h(this, "ctx");
|
|
3582
3611
|
h(this, "adjustPositionX", "");
|
|
3583
3612
|
h(this, "adjustPositionY", "");
|
|
@@ -3591,7 +3620,7 @@ class ui {
|
|
|
3591
3620
|
"mousemove",
|
|
3592
3621
|
Zt((t) => {
|
|
3593
3622
|
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;
|
|
3594
|
-
(this.ctx.selectorMove || this.ctx.autofillMove) && (s ? this.
|
|
3623
|
+
(this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
|
|
3595
3624
|
}, 100)
|
|
3596
3625
|
), this.ctx.on("cellHoverChange", (t) => {
|
|
3597
3626
|
if (!this.ctx.autofillMove) {
|
|
@@ -3610,13 +3639,14 @@ class ui {
|
|
|
3610
3639
|
this.isMultipleRow = !1, this.click(e.shiftKey);
|
|
3611
3640
|
}
|
|
3612
3641
|
}), this.ctx.on("mouseup", () => {
|
|
3642
|
+
this.mousedownHeader = !1;
|
|
3613
3643
|
const t = setTimeout(() => {
|
|
3614
3644
|
this.ctx.adjustPositioning = !1, clearTimeout(t);
|
|
3615
3645
|
}, 0);
|
|
3616
3646
|
}), this.ctx.on("cellHeaderHoverChange", (t) => {
|
|
3617
3647
|
this.ctx.mousedown && this.selectCols(t);
|
|
3618
3648
|
}), this.ctx.on("cellHeaderMousedown", (t) => {
|
|
3619
|
-
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || this.selectCols(t));
|
|
3649
|
+
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || (this.mousedownHeader = !0, this.selectCols(t)));
|
|
3620
3650
|
}), this.ctx.on("keydown", (t) => {
|
|
3621
3651
|
if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
|
|
3622
3652
|
t.preventDefault(), this.paste();
|
|
@@ -3795,7 +3825,11 @@ class ui {
|
|
|
3795
3825
|
return;
|
|
3796
3826
|
const { value: t } = this.ctx.getSelectedData(), e = ei(t);
|
|
3797
3827
|
navigator.clipboard ? navigator.clipboard.writeText(e).then(() => {
|
|
3798
|
-
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("
|
|
3828
|
+
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
|
|
3829
|
+
xArr: this.ctx.selector.xArrCopy,
|
|
3830
|
+
yArr: this.ctx.selector.yArrCopy,
|
|
3831
|
+
data: t
|
|
3832
|
+
}), this.ctx.emit("draw");
|
|
3799
3833
|
}).catch((i) => console.error("复制失败:", i)) : console.error("当前浏览器不支持Clipboard API");
|
|
3800
3834
|
}
|
|
3801
3835
|
clearSelectedData(t, e, i = !1) {
|
|
@@ -3823,7 +3857,7 @@ class ui {
|
|
|
3823
3857
|
let o = [];
|
|
3824
3858
|
return r.forEach((a) => {
|
|
3825
3859
|
o.push(this.ctx.database.getRowDataItemForRowKey(a));
|
|
3826
|
-
}), this.ctx.emit("clearSelectedDataChange", s, o),
|
|
3860
|
+
}), this.ctx.emit("clearSelectedDataChange", s, o), s;
|
|
3827
3861
|
}
|
|
3828
3862
|
paste() {
|
|
3829
3863
|
if (!navigator.clipboard) {
|
|
@@ -3833,21 +3867,21 @@ class ui {
|
|
|
3833
3867
|
const { ENABLE_PASTER: t } = this.ctx.config;
|
|
3834
3868
|
if (this.ctx.selector.enable && t) {
|
|
3835
3869
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
3836
|
-
navigator.clipboard.readText().then((r) => {
|
|
3870
|
+
navigator.clipboard.readText().then(async (r) => {
|
|
3837
3871
|
let o = ti(r), a = [];
|
|
3838
|
-
for (let
|
|
3839
|
-
const
|
|
3840
|
-
for (let
|
|
3841
|
-
const
|
|
3842
|
-
|
|
3843
|
-
|
|
3872
|
+
for (let f = 0; f <= o.length - 1; f++) {
|
|
3873
|
+
const d = o[f].length;
|
|
3874
|
+
for (let x = 0; x <= d - 1; x++) {
|
|
3875
|
+
const u = f + e, g = x + i, w = o[f][x], p = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3876
|
+
u,
|
|
3877
|
+
g
|
|
3844
3878
|
);
|
|
3845
|
-
if (
|
|
3846
|
-
const { rowKey:
|
|
3847
|
-
this.ctx.database.getReadonly(
|
|
3848
|
-
rowKey:
|
|
3849
|
-
key:
|
|
3850
|
-
value:
|
|
3879
|
+
if (p) {
|
|
3880
|
+
const { rowKey: y, key: b } = p;
|
|
3881
|
+
this.ctx.database.getReadonly(y, b) || (s.add(y), a.push({
|
|
3882
|
+
rowKey: y,
|
|
3883
|
+
key: b,
|
|
3884
|
+
value: w,
|
|
3851
3885
|
row: {}
|
|
3852
3886
|
//内部有设置
|
|
3853
3887
|
}));
|
|
@@ -3855,23 +3889,34 @@ class ui {
|
|
|
3855
3889
|
}
|
|
3856
3890
|
}
|
|
3857
3891
|
if (this.isCut) {
|
|
3858
|
-
const
|
|
3892
|
+
const f = this.clearSelectedData(
|
|
3859
3893
|
this.ctx.selector.xArrCopy,
|
|
3860
3894
|
this.ctx.selector.yArrCopy,
|
|
3861
3895
|
!0
|
|
3862
3896
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3863
|
-
),
|
|
3864
|
-
|
|
3865
|
-
|
|
3897
|
+
), d = a.map((x) => `${x.rowKey}-${x.key}`);
|
|
3898
|
+
f.forEach((x) => {
|
|
3899
|
+
d.includes(`${x.rowKey}-${x.key}`) || a.unshift(x);
|
|
3866
3900
|
}), this.isCut = !1;
|
|
3867
3901
|
}
|
|
3868
3902
|
if (!a.length)
|
|
3869
3903
|
return;
|
|
3870
|
-
this.ctx.
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3904
|
+
const { BEFORE_PASTE_CHANGE_METHOD: l } = this.ctx.config;
|
|
3905
|
+
if (typeof l == "function") {
|
|
3906
|
+
const f = l, d = a.map((x) => ({
|
|
3907
|
+
rowKey: x.rowKey,
|
|
3908
|
+
key: x.key,
|
|
3909
|
+
value: x.value,
|
|
3910
|
+
oldValue: this.ctx.database.getItemValue(x.rowKey, x.key),
|
|
3911
|
+
row: this.ctx.database.getRowDataItemForRowKey(x.rowKey)
|
|
3912
|
+
}));
|
|
3913
|
+
a = await f(d);
|
|
3914
|
+
}
|
|
3915
|
+
this.clearCopyLine(), this.ctx.database.batchSetItemValue(a, !0);
|
|
3916
|
+
let c = [];
|
|
3917
|
+
s.forEach((f) => {
|
|
3918
|
+
c.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
3919
|
+
}), this.ctx.emit("pasteChange", a, c);
|
|
3875
3920
|
}).catch((r) => {
|
|
3876
3921
|
console.error("获取剪贴板内容失败:", r);
|
|
3877
3922
|
});
|
|
@@ -4044,35 +4089,46 @@ class gi {
|
|
|
4044
4089
|
/**
|
|
4045
4090
|
* 填充数据
|
|
4046
4091
|
*/
|
|
4047
|
-
autofillData() {
|
|
4092
|
+
async autofillData() {
|
|
4048
4093
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4049
|
-
for (let
|
|
4050
|
-
for (let
|
|
4051
|
-
const
|
|
4052
|
-
i.set(`${
|
|
4094
|
+
for (let x = 0; x <= e.yArr[1] - e.yArr[0]; x++)
|
|
4095
|
+
for (let u = 0; u <= e.xArr[1] - e.xArr[0]; u++) {
|
|
4096
|
+
const g = x + e.yArr[0], w = u + e.xArr[0];
|
|
4097
|
+
i.set(`${g}-${w}`, !0);
|
|
4053
4098
|
}
|
|
4054
4099
|
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
4055
4100
|
let c = [];
|
|
4056
|
-
for (let
|
|
4057
|
-
for (let
|
|
4058
|
-
const
|
|
4059
|
-
if (
|
|
4060
|
-
const { rowKey:
|
|
4061
|
-
this.ctx.database.getReadonly(
|
|
4062
|
-
rowKey:
|
|
4063
|
-
key:
|
|
4064
|
-
value:
|
|
4101
|
+
for (let x = 0; x <= l[1] - l[0]; x++)
|
|
4102
|
+
for (let u = 0; u <= a[1] - a[0]; u++) {
|
|
4103
|
+
const g = u + a[0], w = x + l[0], p = s[x % o][u % r], y = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), b = `${w}-${g}`;
|
|
4104
|
+
if (y && !i.has(b)) {
|
|
4105
|
+
const { rowKey: m, key: E } = y;
|
|
4106
|
+
this.ctx.database.getReadonly(m, E) || (t.add(m), c.push({
|
|
4107
|
+
rowKey: m,
|
|
4108
|
+
key: E,
|
|
4109
|
+
value: p,
|
|
4065
4110
|
row: {}
|
|
4066
4111
|
}));
|
|
4067
4112
|
}
|
|
4068
4113
|
}
|
|
4069
4114
|
if (!c.length)
|
|
4070
4115
|
return;
|
|
4071
|
-
this.ctx.
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4116
|
+
const { BEFORE_AUTOFILL_CHANGE_METHOD: f } = this.ctx.config;
|
|
4117
|
+
if (typeof f == "function") {
|
|
4118
|
+
const x = f, u = c.map((g) => ({
|
|
4119
|
+
rowKey: g.rowKey,
|
|
4120
|
+
key: g.key,
|
|
4121
|
+
value: g.value,
|
|
4122
|
+
oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
|
|
4123
|
+
row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
|
|
4124
|
+
}));
|
|
4125
|
+
c = await x(u);
|
|
4126
|
+
}
|
|
4127
|
+
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.database.batchSetItemValue(c, !0);
|
|
4128
|
+
let d = [];
|
|
4129
|
+
t.forEach((x) => {
|
|
4130
|
+
d.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
4131
|
+
}), this.ctx.emit("autofillChange", c, d);
|
|
4076
4132
|
}
|
|
4077
4133
|
mouseenter(t) {
|
|
4078
4134
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4585,7 +4641,7 @@ function K(n) {
|
|
|
4585
4641
|
function ae(n) {
|
|
4586
4642
|
return gt() ? n instanceof Node || n instanceof H(n).Node : !1;
|
|
4587
4643
|
}
|
|
4588
|
-
function
|
|
4644
|
+
function F(n) {
|
|
4589
4645
|
return gt() ? n instanceof Element || n instanceof H(n).Element : !1;
|
|
4590
4646
|
}
|
|
4591
4647
|
function N(n) {
|
|
@@ -4600,7 +4656,7 @@ function lt(n) {
|
|
|
4600
4656
|
overflowX: e,
|
|
4601
4657
|
overflowY: i,
|
|
4602
4658
|
display: s
|
|
4603
|
-
} =
|
|
4659
|
+
} = X(n);
|
|
4604
4660
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4605
4661
|
}
|
|
4606
4662
|
function Si(n) {
|
|
@@ -4616,7 +4672,7 @@ function wt(n) {
|
|
|
4616
4672
|
});
|
|
4617
4673
|
}
|
|
4618
4674
|
function Ht(n) {
|
|
4619
|
-
const t = Dt(), e =
|
|
4675
|
+
const t = Dt(), e = F(n) ? X(n) : n;
|
|
4620
4676
|
return e.transform !== "none" || e.perspective !== "none" || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((i) => (e.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (e.contain || "").includes(i));
|
|
4621
4677
|
}
|
|
4622
4678
|
function Ai(n) {
|
|
@@ -4636,11 +4692,11 @@ function Dt() {
|
|
|
4636
4692
|
function Q(n) {
|
|
4637
4693
|
return ["html", "body", "#document"].includes(tt(n));
|
|
4638
4694
|
}
|
|
4639
|
-
function
|
|
4695
|
+
function X(n) {
|
|
4640
4696
|
return H(n).getComputedStyle(n);
|
|
4641
4697
|
}
|
|
4642
4698
|
function pt(n) {
|
|
4643
|
-
return
|
|
4699
|
+
return F(n) ? {
|
|
4644
4700
|
scrollLeft: n.scrollLeft,
|
|
4645
4701
|
scrollTop: n.scrollTop
|
|
4646
4702
|
} : {
|
|
@@ -4678,7 +4734,7 @@ function St(n) {
|
|
|
4678
4734
|
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
4679
4735
|
}
|
|
4680
4736
|
function le(n) {
|
|
4681
|
-
const t =
|
|
4737
|
+
const t = X(n);
|
|
4682
4738
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4683
4739
|
const s = N(n), r = s ? n.offsetWidth : e, o = s ? n.offsetHeight : i, a = ft(e) !== r || ft(i) !== o;
|
|
4684
4740
|
return a && (e = r, i = o), {
|
|
@@ -4688,7 +4744,7 @@ function le(n) {
|
|
|
4688
4744
|
};
|
|
4689
4745
|
}
|
|
4690
4746
|
function ce(n) {
|
|
4691
|
-
return
|
|
4747
|
+
return F(n) ? n : n.contextElement;
|
|
4692
4748
|
}
|
|
4693
4749
|
function Z(n) {
|
|
4694
4750
|
const t = ce(n);
|
|
@@ -4720,14 +4776,14 @@ function ot(n, t, e, i) {
|
|
|
4720
4776
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
4721
4777
|
const s = n.getBoundingClientRect(), r = ce(n);
|
|
4722
4778
|
let o = V(1);
|
|
4723
|
-
t && (i ?
|
|
4779
|
+
t && (i ? F(i) && (o = Z(i)) : o = Z(n));
|
|
4724
4780
|
const a = Mi(r, e, i) ? de(r) : V(0);
|
|
4725
4781
|
let l = (s.left + a.x) / o.x, c = (s.top + a.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4726
4782
|
if (r) {
|
|
4727
|
-
const x = H(r), u = i &&
|
|
4783
|
+
const x = H(r), u = i && F(i) ? H(i) : i;
|
|
4728
4784
|
let g = x, w = St(g);
|
|
4729
4785
|
for (; w && i && u !== g; ) {
|
|
4730
|
-
const p = Z(w), y = w.getBoundingClientRect(), b =
|
|
4786
|
+
const p = Z(w), y = w.getBoundingClientRect(), b = X(w), m = y.left + (w.clientLeft + parseFloat(b.paddingLeft)) * p.x, E = y.top + (w.clientTop + parseFloat(b.paddingTop)) * p.y;
|
|
4731
4787
|
l *= p.x, c *= p.y, f *= p.x, d *= p.y, l += m, c += E, g = H(w), w = St(g);
|
|
4732
4788
|
}
|
|
4733
4789
|
}
|
|
@@ -4771,18 +4827,18 @@ function At(n, t) {
|
|
|
4771
4827
|
const e = pt(n).scrollLeft;
|
|
4772
4828
|
return t ? t.left + e : ot(K(n)).left + e;
|
|
4773
4829
|
}
|
|
4774
|
-
function
|
|
4830
|
+
function Fi(n) {
|
|
4775
4831
|
const t = K(n), e = pt(n), i = n.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
4776
4832
|
let o = -e.scrollLeft + At(n);
|
|
4777
4833
|
const a = -e.scrollTop;
|
|
4778
|
-
return
|
|
4834
|
+
return X(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
|
|
4779
4835
|
width: s,
|
|
4780
4836
|
height: r,
|
|
4781
4837
|
x: o,
|
|
4782
4838
|
y: a
|
|
4783
4839
|
};
|
|
4784
4840
|
}
|
|
4785
|
-
function
|
|
4841
|
+
function Xi(n, t) {
|
|
4786
4842
|
const e = H(n), i = K(n), s = e.visualViewport;
|
|
4787
4843
|
let r = i.clientWidth, o = i.clientHeight, a = 0, l = 0;
|
|
4788
4844
|
if (s) {
|
|
@@ -4809,10 +4865,10 @@ function ki(n, t) {
|
|
|
4809
4865
|
function $t(n, t, e) {
|
|
4810
4866
|
let i;
|
|
4811
4867
|
if (t === "viewport")
|
|
4812
|
-
i =
|
|
4868
|
+
i = Xi(n, e);
|
|
4813
4869
|
else if (t === "document")
|
|
4814
|
-
i =
|
|
4815
|
-
else if (
|
|
4870
|
+
i = Fi(K(n));
|
|
4871
|
+
else if (F(t))
|
|
4816
4872
|
i = ki(t, e);
|
|
4817
4873
|
else {
|
|
4818
4874
|
const s = de(n);
|
|
@@ -4826,17 +4882,17 @@ function $t(n, t, e) {
|
|
|
4826
4882
|
}
|
|
4827
4883
|
function fe(n, t) {
|
|
4828
4884
|
const e = z(n);
|
|
4829
|
-
return e === t || !
|
|
4885
|
+
return e === t || !F(e) || Q(e) ? !1 : X(e).position === "fixed" || fe(e, t);
|
|
4830
4886
|
}
|
|
4831
4887
|
function Ni(n, t) {
|
|
4832
4888
|
const e = t.get(n);
|
|
4833
4889
|
if (e)
|
|
4834
4890
|
return e;
|
|
4835
|
-
let i = Tt(n, [], !1).filter((a) =>
|
|
4836
|
-
const r =
|
|
4891
|
+
let i = Tt(n, [], !1).filter((a) => F(a) && tt(a) !== "body"), s = null;
|
|
4892
|
+
const r = X(n).position === "fixed";
|
|
4837
4893
|
let o = r ? z(n) : n;
|
|
4838
|
-
for (;
|
|
4839
|
-
const a =
|
|
4894
|
+
for (; F(o) && !Q(o); ) {
|
|
4895
|
+
const a = X(o), l = Ht(o);
|
|
4840
4896
|
!l && a.position === "fixed" && (s = null), (r ? !l && !s : !l && a.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || lt(o) && !l && fe(n, o)) ? i = i.filter((f) => f !== o) : s = a, o = z(o);
|
|
4841
4897
|
}
|
|
4842
4898
|
return t.set(n, i), i;
|
|
@@ -4896,10 +4952,10 @@ function Bi(n, t, e) {
|
|
|
4896
4952
|
};
|
|
4897
4953
|
}
|
|
4898
4954
|
function mt(n) {
|
|
4899
|
-
return
|
|
4955
|
+
return X(n).position === "static";
|
|
4900
4956
|
}
|
|
4901
4957
|
function qt(n, t) {
|
|
4902
|
-
if (!N(n) ||
|
|
4958
|
+
if (!N(n) || X(n).position === "fixed")
|
|
4903
4959
|
return null;
|
|
4904
4960
|
if (t)
|
|
4905
4961
|
return t(n);
|
|
@@ -4913,7 +4969,7 @@ function xe(n, t) {
|
|
|
4913
4969
|
if (!N(n)) {
|
|
4914
4970
|
let s = z(n);
|
|
4915
4971
|
for (; s && !Q(s); ) {
|
|
4916
|
-
if (
|
|
4972
|
+
if (F(s) && !mt(s))
|
|
4917
4973
|
return s;
|
|
4918
4974
|
s = z(s);
|
|
4919
4975
|
}
|
|
@@ -4937,7 +4993,7 @@ const Wi = async function(n) {
|
|
|
4937
4993
|
};
|
|
4938
4994
|
};
|
|
4939
4995
|
function Pi(n) {
|
|
4940
|
-
return
|
|
4996
|
+
return X(n).direction === "rtl";
|
|
4941
4997
|
}
|
|
4942
4998
|
const Vi = {
|
|
4943
4999
|
convertOffsetParentRelativeRectToViewportRelativeRect: Hi,
|
|
@@ -4948,7 +5004,7 @@ const Vi = {
|
|
|
4948
5004
|
getClientRects: Di,
|
|
4949
5005
|
getDimensions: Ki,
|
|
4950
5006
|
getScale: Z,
|
|
4951
|
-
isElement:
|
|
5007
|
+
isElement: F,
|
|
4952
5008
|
isRTL: Pi
|
|
4953
5009
|
}, ue = Oi, ge = Ti, we = _i, zi = Ri, pe = (n, t, e) => {
|
|
4954
5010
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
@@ -5592,8 +5648,8 @@ class Qi {
|
|
|
5592
5648
|
setItemValue(t, e, i, s = !0, r = !0, o = !1) {
|
|
5593
5649
|
this.ctx.database.setItemValue(t, e, i, s, r, o);
|
|
5594
5650
|
}
|
|
5595
|
-
batchSetItemValue(t, e = !0
|
|
5596
|
-
this.ctx.database.batchSetItemValue(t, e)
|
|
5651
|
+
batchSetItemValue(t, e = !0) {
|
|
5652
|
+
this.ctx.database.batchSetItemValue(t, e);
|
|
5597
5653
|
}
|
|
5598
5654
|
setItemValueByEditor(t, e, i, s = !0, r = !0) {
|
|
5599
5655
|
this.ctx.database.setItemValue(t, e, i, s, r, !0), this.editor.doneEdit();
|