e-virt-table 0.1.14 → 0.1.15
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 +175 -123
- 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/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/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.js +21 -6
- 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
|
// 清空历史
|
|
@@ -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) {
|
|
@@ -2936,6 +2959,9 @@ class Pt {
|
|
|
2936
2959
|
isPointInElement(t, e, i, s, r, o) {
|
|
2937
2960
|
return t >= i && t <= i + r && e >= s && e <= s + o;
|
|
2938
2961
|
}
|
|
2962
|
+
hasScrollbar() {
|
|
2963
|
+
return this.type === "vertical" ? this.barHeight > 0 : this.type === "horizontal" ? this.barWidth > 0 : !1;
|
|
2964
|
+
}
|
|
2939
2965
|
isOnScrollbar(t, e) {
|
|
2940
2966
|
return this.isPointInElement(t, e, this.barX, this.barY, this.barWidth, this.barHeight);
|
|
2941
2967
|
}
|
|
@@ -2944,7 +2970,7 @@ class Pt {
|
|
|
2944
2970
|
}
|
|
2945
2971
|
updateScroll(t) {
|
|
2946
2972
|
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
|
|
2973
|
+
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
2974
|
}
|
|
2949
2975
|
updatedSize() {
|
|
2950
2976
|
const {
|
|
@@ -3795,7 +3821,11 @@ class ui {
|
|
|
3795
3821
|
return;
|
|
3796
3822
|
const { value: t } = this.ctx.getSelectedData(), e = ei(t);
|
|
3797
3823
|
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("
|
|
3824
|
+
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
|
|
3825
|
+
xArr: this.ctx.selector.xArrCopy,
|
|
3826
|
+
yArr: this.ctx.selector.yArrCopy,
|
|
3827
|
+
data: t
|
|
3828
|
+
}), this.ctx.emit("draw");
|
|
3799
3829
|
}).catch((i) => console.error("复制失败:", i)) : console.error("当前浏览器不支持Clipboard API");
|
|
3800
3830
|
}
|
|
3801
3831
|
clearSelectedData(t, e, i = !1) {
|
|
@@ -3823,7 +3853,7 @@ class ui {
|
|
|
3823
3853
|
let o = [];
|
|
3824
3854
|
return r.forEach((a) => {
|
|
3825
3855
|
o.push(this.ctx.database.getRowDataItemForRowKey(a));
|
|
3826
|
-
}), this.ctx.emit("clearSelectedDataChange", s, o),
|
|
3856
|
+
}), this.ctx.emit("clearSelectedDataChange", s, o), s;
|
|
3827
3857
|
}
|
|
3828
3858
|
paste() {
|
|
3829
3859
|
if (!navigator.clipboard) {
|
|
@@ -3833,21 +3863,21 @@ class ui {
|
|
|
3833
3863
|
const { ENABLE_PASTER: t } = this.ctx.config;
|
|
3834
3864
|
if (this.ctx.selector.enable && t) {
|
|
3835
3865
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
3836
|
-
navigator.clipboard.readText().then((r) => {
|
|
3866
|
+
navigator.clipboard.readText().then(async (r) => {
|
|
3837
3867
|
let o = ti(r), a = [];
|
|
3838
|
-
for (let
|
|
3839
|
-
const
|
|
3840
|
-
for (let
|
|
3841
|
-
const
|
|
3842
|
-
|
|
3843
|
-
|
|
3868
|
+
for (let f = 0; f <= o.length - 1; f++) {
|
|
3869
|
+
const d = o[f].length;
|
|
3870
|
+
for (let x = 0; x <= d - 1; x++) {
|
|
3871
|
+
const u = f + e, g = x + i, w = o[f][x], p = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3872
|
+
u,
|
|
3873
|
+
g
|
|
3844
3874
|
);
|
|
3845
|
-
if (
|
|
3846
|
-
const { rowKey:
|
|
3847
|
-
this.ctx.database.getReadonly(
|
|
3848
|
-
rowKey:
|
|
3849
|
-
key:
|
|
3850
|
-
value:
|
|
3875
|
+
if (p) {
|
|
3876
|
+
const { rowKey: y, key: b } = p;
|
|
3877
|
+
this.ctx.database.getReadonly(y, b) || (s.add(y), a.push({
|
|
3878
|
+
rowKey: y,
|
|
3879
|
+
key: b,
|
|
3880
|
+
value: w,
|
|
3851
3881
|
row: {}
|
|
3852
3882
|
//内部有设置
|
|
3853
3883
|
}));
|
|
@@ -3855,23 +3885,34 @@ class ui {
|
|
|
3855
3885
|
}
|
|
3856
3886
|
}
|
|
3857
3887
|
if (this.isCut) {
|
|
3858
|
-
const
|
|
3888
|
+
const f = this.clearSelectedData(
|
|
3859
3889
|
this.ctx.selector.xArrCopy,
|
|
3860
3890
|
this.ctx.selector.yArrCopy,
|
|
3861
3891
|
!0
|
|
3862
3892
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3863
|
-
),
|
|
3864
|
-
|
|
3865
|
-
|
|
3893
|
+
), d = a.map((x) => `${x.rowKey}-${x.key}`);
|
|
3894
|
+
f.forEach((x) => {
|
|
3895
|
+
d.includes(`${x.rowKey}-${x.key}`) || a.unshift(x);
|
|
3866
3896
|
}), this.isCut = !1;
|
|
3867
3897
|
}
|
|
3868
3898
|
if (!a.length)
|
|
3869
3899
|
return;
|
|
3870
|
-
this.ctx.
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3900
|
+
const { BEFORE_PASTE_CHANGE_METHOD: l } = this.ctx.config;
|
|
3901
|
+
if (typeof l == "function") {
|
|
3902
|
+
const f = l, d = a.map((x) => ({
|
|
3903
|
+
rowKey: x.rowKey,
|
|
3904
|
+
key: x.key,
|
|
3905
|
+
value: x.value,
|
|
3906
|
+
oldValue: this.ctx.database.getItemValue(x.rowKey, x.key),
|
|
3907
|
+
row: this.ctx.database.getRowDataItemForRowKey(x.rowKey)
|
|
3908
|
+
}));
|
|
3909
|
+
a = await f(d);
|
|
3910
|
+
}
|
|
3911
|
+
this.clearCopyLine(), this.ctx.database.batchSetItemValue(a, !0);
|
|
3912
|
+
let c = [];
|
|
3913
|
+
s.forEach((f) => {
|
|
3914
|
+
c.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
3915
|
+
}), this.ctx.emit("pasteChange", a, c);
|
|
3875
3916
|
}).catch((r) => {
|
|
3876
3917
|
console.error("获取剪贴板内容失败:", r);
|
|
3877
3918
|
});
|
|
@@ -4044,35 +4085,46 @@ class gi {
|
|
|
4044
4085
|
/**
|
|
4045
4086
|
* 填充数据
|
|
4046
4087
|
*/
|
|
4047
|
-
autofillData() {
|
|
4088
|
+
async autofillData() {
|
|
4048
4089
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4049
|
-
for (let
|
|
4050
|
-
for (let
|
|
4051
|
-
const
|
|
4052
|
-
i.set(`${
|
|
4090
|
+
for (let x = 0; x <= e.yArr[1] - e.yArr[0]; x++)
|
|
4091
|
+
for (let u = 0; u <= e.xArr[1] - e.xArr[0]; u++) {
|
|
4092
|
+
const g = x + e.yArr[0], w = u + e.xArr[0];
|
|
4093
|
+
i.set(`${g}-${w}`, !0);
|
|
4053
4094
|
}
|
|
4054
4095
|
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
4055
4096
|
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:
|
|
4097
|
+
for (let x = 0; x <= l[1] - l[0]; x++)
|
|
4098
|
+
for (let u = 0; u <= a[1] - a[0]; u++) {
|
|
4099
|
+
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}`;
|
|
4100
|
+
if (y && !i.has(b)) {
|
|
4101
|
+
const { rowKey: m, key: E } = y;
|
|
4102
|
+
this.ctx.database.getReadonly(m, E) || (t.add(m), c.push({
|
|
4103
|
+
rowKey: m,
|
|
4104
|
+
key: E,
|
|
4105
|
+
value: p,
|
|
4065
4106
|
row: {}
|
|
4066
4107
|
}));
|
|
4067
4108
|
}
|
|
4068
4109
|
}
|
|
4069
4110
|
if (!c.length)
|
|
4070
4111
|
return;
|
|
4071
|
-
this.ctx.
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4112
|
+
const { BEFORE_AUTOFILL_CHANGE_METHOD: f } = this.ctx.config;
|
|
4113
|
+
if (typeof f == "function") {
|
|
4114
|
+
const x = f, u = c.map((g) => ({
|
|
4115
|
+
rowKey: g.rowKey,
|
|
4116
|
+
key: g.key,
|
|
4117
|
+
value: g.value,
|
|
4118
|
+
oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
|
|
4119
|
+
row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
|
|
4120
|
+
}));
|
|
4121
|
+
c = await x(u);
|
|
4122
|
+
}
|
|
4123
|
+
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.database.batchSetItemValue(c, !0);
|
|
4124
|
+
let d = [];
|
|
4125
|
+
t.forEach((x) => {
|
|
4126
|
+
d.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
4127
|
+
}), this.ctx.emit("autofillChange", c, d);
|
|
4076
4128
|
}
|
|
4077
4129
|
mouseenter(t) {
|
|
4078
4130
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4585,7 +4637,7 @@ function K(n) {
|
|
|
4585
4637
|
function ae(n) {
|
|
4586
4638
|
return gt() ? n instanceof Node || n instanceof H(n).Node : !1;
|
|
4587
4639
|
}
|
|
4588
|
-
function
|
|
4640
|
+
function F(n) {
|
|
4589
4641
|
return gt() ? n instanceof Element || n instanceof H(n).Element : !1;
|
|
4590
4642
|
}
|
|
4591
4643
|
function N(n) {
|
|
@@ -4600,7 +4652,7 @@ function lt(n) {
|
|
|
4600
4652
|
overflowX: e,
|
|
4601
4653
|
overflowY: i,
|
|
4602
4654
|
display: s
|
|
4603
|
-
} =
|
|
4655
|
+
} = X(n);
|
|
4604
4656
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4605
4657
|
}
|
|
4606
4658
|
function Si(n) {
|
|
@@ -4616,7 +4668,7 @@ function wt(n) {
|
|
|
4616
4668
|
});
|
|
4617
4669
|
}
|
|
4618
4670
|
function Ht(n) {
|
|
4619
|
-
const t = Dt(), e =
|
|
4671
|
+
const t = Dt(), e = F(n) ? X(n) : n;
|
|
4620
4672
|
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
4673
|
}
|
|
4622
4674
|
function Ai(n) {
|
|
@@ -4636,11 +4688,11 @@ function Dt() {
|
|
|
4636
4688
|
function Q(n) {
|
|
4637
4689
|
return ["html", "body", "#document"].includes(tt(n));
|
|
4638
4690
|
}
|
|
4639
|
-
function
|
|
4691
|
+
function X(n) {
|
|
4640
4692
|
return H(n).getComputedStyle(n);
|
|
4641
4693
|
}
|
|
4642
4694
|
function pt(n) {
|
|
4643
|
-
return
|
|
4695
|
+
return F(n) ? {
|
|
4644
4696
|
scrollLeft: n.scrollLeft,
|
|
4645
4697
|
scrollTop: n.scrollTop
|
|
4646
4698
|
} : {
|
|
@@ -4678,7 +4730,7 @@ function St(n) {
|
|
|
4678
4730
|
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
4679
4731
|
}
|
|
4680
4732
|
function le(n) {
|
|
4681
|
-
const t =
|
|
4733
|
+
const t = X(n);
|
|
4682
4734
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4683
4735
|
const s = N(n), r = s ? n.offsetWidth : e, o = s ? n.offsetHeight : i, a = ft(e) !== r || ft(i) !== o;
|
|
4684
4736
|
return a && (e = r, i = o), {
|
|
@@ -4688,7 +4740,7 @@ function le(n) {
|
|
|
4688
4740
|
};
|
|
4689
4741
|
}
|
|
4690
4742
|
function ce(n) {
|
|
4691
|
-
return
|
|
4743
|
+
return F(n) ? n : n.contextElement;
|
|
4692
4744
|
}
|
|
4693
4745
|
function Z(n) {
|
|
4694
4746
|
const t = ce(n);
|
|
@@ -4720,14 +4772,14 @@ function ot(n, t, e, i) {
|
|
|
4720
4772
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
4721
4773
|
const s = n.getBoundingClientRect(), r = ce(n);
|
|
4722
4774
|
let o = V(1);
|
|
4723
|
-
t && (i ?
|
|
4775
|
+
t && (i ? F(i) && (o = Z(i)) : o = Z(n));
|
|
4724
4776
|
const a = Mi(r, e, i) ? de(r) : V(0);
|
|
4725
4777
|
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
4778
|
if (r) {
|
|
4727
|
-
const x = H(r), u = i &&
|
|
4779
|
+
const x = H(r), u = i && F(i) ? H(i) : i;
|
|
4728
4780
|
let g = x, w = St(g);
|
|
4729
4781
|
for (; w && i && u !== g; ) {
|
|
4730
|
-
const p = Z(w), y = w.getBoundingClientRect(), b =
|
|
4782
|
+
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
4783
|
l *= p.x, c *= p.y, f *= p.x, d *= p.y, l += m, c += E, g = H(w), w = St(g);
|
|
4732
4784
|
}
|
|
4733
4785
|
}
|
|
@@ -4771,18 +4823,18 @@ function At(n, t) {
|
|
|
4771
4823
|
const e = pt(n).scrollLeft;
|
|
4772
4824
|
return t ? t.left + e : ot(K(n)).left + e;
|
|
4773
4825
|
}
|
|
4774
|
-
function
|
|
4826
|
+
function Fi(n) {
|
|
4775
4827
|
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
4828
|
let o = -e.scrollLeft + At(n);
|
|
4777
4829
|
const a = -e.scrollTop;
|
|
4778
|
-
return
|
|
4830
|
+
return X(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
|
|
4779
4831
|
width: s,
|
|
4780
4832
|
height: r,
|
|
4781
4833
|
x: o,
|
|
4782
4834
|
y: a
|
|
4783
4835
|
};
|
|
4784
4836
|
}
|
|
4785
|
-
function
|
|
4837
|
+
function Xi(n, t) {
|
|
4786
4838
|
const e = H(n), i = K(n), s = e.visualViewport;
|
|
4787
4839
|
let r = i.clientWidth, o = i.clientHeight, a = 0, l = 0;
|
|
4788
4840
|
if (s) {
|
|
@@ -4809,10 +4861,10 @@ function ki(n, t) {
|
|
|
4809
4861
|
function $t(n, t, e) {
|
|
4810
4862
|
let i;
|
|
4811
4863
|
if (t === "viewport")
|
|
4812
|
-
i =
|
|
4864
|
+
i = Xi(n, e);
|
|
4813
4865
|
else if (t === "document")
|
|
4814
|
-
i =
|
|
4815
|
-
else if (
|
|
4866
|
+
i = Fi(K(n));
|
|
4867
|
+
else if (F(t))
|
|
4816
4868
|
i = ki(t, e);
|
|
4817
4869
|
else {
|
|
4818
4870
|
const s = de(n);
|
|
@@ -4826,17 +4878,17 @@ function $t(n, t, e) {
|
|
|
4826
4878
|
}
|
|
4827
4879
|
function fe(n, t) {
|
|
4828
4880
|
const e = z(n);
|
|
4829
|
-
return e === t || !
|
|
4881
|
+
return e === t || !F(e) || Q(e) ? !1 : X(e).position === "fixed" || fe(e, t);
|
|
4830
4882
|
}
|
|
4831
4883
|
function Ni(n, t) {
|
|
4832
4884
|
const e = t.get(n);
|
|
4833
4885
|
if (e)
|
|
4834
4886
|
return e;
|
|
4835
|
-
let i = Tt(n, [], !1).filter((a) =>
|
|
4836
|
-
const r =
|
|
4887
|
+
let i = Tt(n, [], !1).filter((a) => F(a) && tt(a) !== "body"), s = null;
|
|
4888
|
+
const r = X(n).position === "fixed";
|
|
4837
4889
|
let o = r ? z(n) : n;
|
|
4838
|
-
for (;
|
|
4839
|
-
const a =
|
|
4890
|
+
for (; F(o) && !Q(o); ) {
|
|
4891
|
+
const a = X(o), l = Ht(o);
|
|
4840
4892
|
!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
4893
|
}
|
|
4842
4894
|
return t.set(n, i), i;
|
|
@@ -4896,10 +4948,10 @@ function Bi(n, t, e) {
|
|
|
4896
4948
|
};
|
|
4897
4949
|
}
|
|
4898
4950
|
function mt(n) {
|
|
4899
|
-
return
|
|
4951
|
+
return X(n).position === "static";
|
|
4900
4952
|
}
|
|
4901
4953
|
function qt(n, t) {
|
|
4902
|
-
if (!N(n) ||
|
|
4954
|
+
if (!N(n) || X(n).position === "fixed")
|
|
4903
4955
|
return null;
|
|
4904
4956
|
if (t)
|
|
4905
4957
|
return t(n);
|
|
@@ -4913,7 +4965,7 @@ function xe(n, t) {
|
|
|
4913
4965
|
if (!N(n)) {
|
|
4914
4966
|
let s = z(n);
|
|
4915
4967
|
for (; s && !Q(s); ) {
|
|
4916
|
-
if (
|
|
4968
|
+
if (F(s) && !mt(s))
|
|
4917
4969
|
return s;
|
|
4918
4970
|
s = z(s);
|
|
4919
4971
|
}
|
|
@@ -4937,7 +4989,7 @@ const Wi = async function(n) {
|
|
|
4937
4989
|
};
|
|
4938
4990
|
};
|
|
4939
4991
|
function Pi(n) {
|
|
4940
|
-
return
|
|
4992
|
+
return X(n).direction === "rtl";
|
|
4941
4993
|
}
|
|
4942
4994
|
const Vi = {
|
|
4943
4995
|
convertOffsetParentRelativeRectToViewportRelativeRect: Hi,
|
|
@@ -4948,7 +5000,7 @@ const Vi = {
|
|
|
4948
5000
|
getClientRects: Di,
|
|
4949
5001
|
getDimensions: Ki,
|
|
4950
5002
|
getScale: Z,
|
|
4951
|
-
isElement:
|
|
5003
|
+
isElement: F,
|
|
4952
5004
|
isRTL: Pi
|
|
4953
5005
|
}, ue = Oi, ge = Ti, we = _i, zi = Ri, pe = (n, t, e) => {
|
|
4954
5006
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
@@ -5592,8 +5644,8 @@ class Qi {
|
|
|
5592
5644
|
setItemValue(t, e, i, s = !0, r = !0, o = !1) {
|
|
5593
5645
|
this.ctx.database.setItemValue(t, e, i, s, r, o);
|
|
5594
5646
|
}
|
|
5595
|
-
batchSetItemValue(t, e = !0
|
|
5596
|
-
this.ctx.database.batchSetItemValue(t, e)
|
|
5647
|
+
batchSetItemValue(t, e = !0) {
|
|
5648
|
+
this.ctx.database.batchSetItemValue(t, e);
|
|
5597
5649
|
}
|
|
5598
5650
|
setItemValueByEditor(t, e, i, s = !0, r = !0) {
|
|
5599
5651
|
this.ctx.database.setItemValue(t, e, i, s, r, !0), this.editor.doneEdit();
|