@bireturn/word-editor 1.0.2 → 1.0.3
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/lib/word-editor.css +1 -1
- package/lib/word-editor.es.js +1307 -1275
- package/lib/word-editor.umd.js +2 -2
- package/package.json +1 -1
package/lib/word-editor.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var rn = Object.defineProperty;
|
|
2
2
|
var cn = (i, e, t) => e in i ? rn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
-
var
|
|
4
|
-
import { computed as ke, ref as
|
|
3
|
+
var V = (i, e, t) => cn(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { computed as ke, ref as se, onMounted as ct, onUnmounted as et, openBlock as f, createElementBlock as p, normalizeStyle as j, createElementVNode as ce, Fragment as Y, renderList as oe, normalizeClass as Ee, createBlock as Fe, resolveDynamicComponent as Ze, toDisplayString as ie, unref as Ae, createCommentVNode as ve, render as Ot, h as dn, defineComponent as un, getCurrentInstance as hn, watch as Be, nextTick as xe, createVNode as J, createTextVNode as Le, isVNode as fn, renderSlot as gn, resolveComponent as pn, withCtx as lt, reactive as Bt, provide as vn, inject as mn } from "vue";
|
|
5
5
|
import { DynamicScroller as yn, DynamicScrollerItem as _n } from "vue-virtual-scroller";
|
|
6
|
-
import { ChevronRight as Ht, MoreHorizontal as yt, Download as
|
|
6
|
+
import { ChevronRight as Ht, MoreHorizontal as yt, Download as at, Upload as bn, Save as xn, RotateCcw as kn, History as wn, Settings as Cn, Info as Mn, Globe as In, Lock as En, Share as Sn, ShieldCheck as Tn, Search as Fn, Filter as An, SortDesc as Pn, SortAsc as $n, Minus as Ln, Plus as _t, Eye as bt, FileText as ot, Grid as Rn, Type as xt, FileDown as kt, Layers as wt, Edit as On, Move as Bn, Copy as Hn, Trash2 as Ct, Clipboard as Mt, PlusCircle as It, ArrowDown as Et, Navigation as St, ChevronDown as Dn, PanelLeftOpen as zn, ListTree as Nn, PanelLeftClose as Vn } from "lucide-vue-next";
|
|
7
7
|
const jn = { class: "we-vt-context-menu--option-wrapper modern-menu-wrapper" }, Kn = ["onMouseenter", "onMouseleave"], qn = ["onClick"], Wn = { class: "we-vt-context-menu--link-content menu-label" }, Un = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "we-vt-context-menu--submenu modern-submenu"
|
|
@@ -30,39 +30,39 @@ const jn = { class: "we-vt-context-menu--option-wrapper modern-menu-wrapper" },
|
|
|
30
30
|
},
|
|
31
31
|
emits: ["close", "menuClick"],
|
|
32
32
|
setup(i, { emit: e }) {
|
|
33
|
-
const t = e,
|
|
33
|
+
const t = e, a = i, o = ke(() => {
|
|
34
34
|
var W, B;
|
|
35
35
|
return {
|
|
36
|
-
left: `${(W =
|
|
37
|
-
top: `${(B =
|
|
36
|
+
left: `${(W = a.e) == null ? void 0 : W.pageX}px`,
|
|
37
|
+
top: `${(B = a.e) == null ? void 0 : B.pageY}px`
|
|
38
38
|
};
|
|
39
|
-
}),
|
|
40
|
-
let
|
|
41
|
-
const
|
|
39
|
+
}), u = se([]), P = se(null);
|
|
40
|
+
let S = null;
|
|
41
|
+
const z = se(), A = (W, B, T) => {
|
|
42
42
|
if (W.children && W.children.length > 0) {
|
|
43
43
|
B && B.preventDefault() && B.stopPropagation();
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
W.disabled || (
|
|
47
|
-
},
|
|
46
|
+
W.disabled || (T ? t("menuClick", { ...W, parent: T.code }, a.row) : t("menuClick", W, a.row)), B && B.preventDefault() && B.stopPropagation();
|
|
47
|
+
}, Z = (W) => {
|
|
48
48
|
let B = W.target;
|
|
49
|
-
for (; B && B !=
|
|
49
|
+
for (; B && B != z.value; )
|
|
50
50
|
B = B.parentNode;
|
|
51
|
-
B !=
|
|
52
|
-
},
|
|
53
|
-
W.currentTarget.classList.add("link--active"),
|
|
54
|
-
|
|
51
|
+
B != z.value && t("close");
|
|
52
|
+
}, N = (W, B) => {
|
|
53
|
+
W.currentTarget.classList.add("link--active"), S && (clearTimeout(S), S = null), B.children && B.children.length > 0 ? P.value = B.code : S = setTimeout(() => {
|
|
54
|
+
P.value = null;
|
|
55
55
|
}, 100);
|
|
56
56
|
}, q = (W, B) => {
|
|
57
|
-
W.currentTarget.classList.remove("link--active"), B.children && B.children.length > 0 && (
|
|
58
|
-
|
|
57
|
+
W.currentTarget.classList.remove("link--active"), B.children && B.children.length > 0 && (S = setTimeout(() => {
|
|
58
|
+
P.value === B.code && (P.value = null);
|
|
59
59
|
}, 300));
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
},
|
|
60
|
+
}, Q = (W) => {
|
|
61
|
+
S && (clearTimeout(S), S = null), W.currentTarget.classList.add("link--active");
|
|
62
|
+
}, ee = (W) => {
|
|
63
63
|
W.currentTarget.classList.remove("link--active");
|
|
64
|
-
},
|
|
65
|
-
const B = W.code || "",
|
|
64
|
+
}, be = (W) => {
|
|
65
|
+
const B = W.code || "", T = (W.name || "").toLowerCase(), K = {
|
|
66
66
|
// 添加操作 - 根据具体类型使用不同图标
|
|
67
67
|
"add-current": St,
|
|
68
68
|
// 添加(当前位置)
|
|
@@ -86,16 +86,16 @@ const jn = { class: "we-vt-context-menu--option-wrapper modern-menu-wrapper" },
|
|
|
86
86
|
// 导出此节点所在节
|
|
87
87
|
export_part_chapter: kt,
|
|
88
88
|
// 导出此节点所在章
|
|
89
|
-
export_full:
|
|
89
|
+
export_full: at,
|
|
90
90
|
// 完整导出
|
|
91
91
|
// 文件格式
|
|
92
|
-
pdf:
|
|
92
|
+
pdf: ot,
|
|
93
93
|
// PDF格式
|
|
94
94
|
word: xt,
|
|
95
95
|
// WORD格式
|
|
96
96
|
excel: Rn,
|
|
97
97
|
// Excel格式
|
|
98
|
-
txt:
|
|
98
|
+
txt: ot,
|
|
99
99
|
// 文本格式
|
|
100
100
|
// 视图操作
|
|
101
101
|
view: bt,
|
|
@@ -137,83 +137,83 @@ const jn = { class: "we-vt-context-menu--option-wrapper modern-menu-wrapper" },
|
|
|
137
137
|
// 保存
|
|
138
138
|
upload: bn,
|
|
139
139
|
// 上传
|
|
140
|
-
download:
|
|
140
|
+
download: at,
|
|
141
141
|
// 下载
|
|
142
142
|
more: yt
|
|
143
143
|
// 更多
|
|
144
144
|
};
|
|
145
|
-
return
|
|
145
|
+
return K[B] ? K[B] : T.includes("添加") || T.includes("add") ? T.includes("当前") || T.includes("current") ? St : T.includes("下") || T.includes("next") ? Et : T.includes("子") || T.includes("child") ? It : _t : T.includes("导出") || T.includes("export") ? T.includes("节") || T.includes("section") ? wt : T.includes("章") || T.includes("chapter") ? kt : at : T.includes("粘贴") || T.includes("paste") ? Mt : T.includes("删除") || T.includes("delete") ? Ct : T.includes("pdf") ? ot : T.includes("word") ? xt : yt;
|
|
146
146
|
};
|
|
147
|
-
return
|
|
148
|
-
var W, B,
|
|
149
|
-
(W =
|
|
150
|
-
options: (
|
|
151
|
-
row:
|
|
152
|
-
})),
|
|
153
|
-
}),
|
|
154
|
-
document.removeEventListener("click",
|
|
155
|
-
}), (W, B) => (
|
|
147
|
+
return ct(() => {
|
|
148
|
+
var W, B, T, K, y, _, r;
|
|
149
|
+
(W = a.menuConfig) != null && W.visibleMethod && typeof ((B = a.menuConfig) == null ? void 0 : B.visibleMethod) == "function" && ((y = a.menuConfig) == null || y.visibleMethod({
|
|
150
|
+
options: (K = (T = a.menuConfig) == null ? void 0 : T.body) == null ? void 0 : K.options,
|
|
151
|
+
row: a.row
|
|
152
|
+
})), u.value = (((r = (_ = a.menuConfig) == null ? void 0 : _.body) == null ? void 0 : r.options) || []).flat(), document.addEventListener("click", Z, !0);
|
|
153
|
+
}), et(() => {
|
|
154
|
+
document.removeEventListener("click", Z, !0);
|
|
155
|
+
}), (W, B) => (f(), p("div", {
|
|
156
156
|
class: "we-vt-table--context-menu-wrapper virtual-table-menu modern-virtual-menu",
|
|
157
157
|
ref_key: "contextMenuRef",
|
|
158
|
-
ref:
|
|
159
|
-
style:
|
|
158
|
+
ref: z,
|
|
159
|
+
style: j([{ display: "inline-block" }, o.value])
|
|
160
160
|
}, [
|
|
161
|
-
|
|
162
|
-
(
|
|
163
|
-
class:
|
|
164
|
-
"link--disabled":
|
|
165
|
-
"has-children":
|
|
161
|
+
ce("ul", jn, [
|
|
162
|
+
(f(!0), p(Y, null, oe(u.value, (T) => (f(), p("li", {
|
|
163
|
+
class: Ee({
|
|
164
|
+
"link--disabled": T.disabled,
|
|
165
|
+
"has-children": T.children && T.children.length > 0,
|
|
166
166
|
"modern-menu-item": !0
|
|
167
167
|
}),
|
|
168
|
-
key:
|
|
169
|
-
onMouseenter: (
|
|
170
|
-
onMouseleave: (
|
|
168
|
+
key: T.code,
|
|
169
|
+
onMouseenter: (K) => N(K, T),
|
|
170
|
+
onMouseleave: (K) => q(K, T)
|
|
171
171
|
}, [
|
|
172
|
-
|
|
172
|
+
ce("a", {
|
|
173
173
|
class: "we-vt-context-menu--link modern-menu-link",
|
|
174
|
-
onClick: (
|
|
174
|
+
onClick: (K) => A(T, K)
|
|
175
175
|
}, [
|
|
176
|
-
(
|
|
176
|
+
(f(), Fe(Ze(be(T)), {
|
|
177
177
|
size: 16,
|
|
178
178
|
class: "menu-icon"
|
|
179
179
|
})),
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
ce("span", Wn, ie(T.name), 1),
|
|
181
|
+
T.children && T.children.length > 0 ? (f(), Fe(Ae(Ht), {
|
|
182
182
|
key: 0,
|
|
183
183
|
size: 14,
|
|
184
184
|
class: "submenu-arrow"
|
|
185
|
-
})) :
|
|
185
|
+
})) : ve("", !0)
|
|
186
186
|
], 8, qn),
|
|
187
|
-
|
|
188
|
-
(
|
|
189
|
-
key:
|
|
190
|
-
class:
|
|
191
|
-
"link--disabled":
|
|
187
|
+
T.children && T.children.length > 0 && P.value === T.code ? (f(), p("ul", Un, [
|
|
188
|
+
(f(!0), p(Y, null, oe(T.children, (K) => (f(), p("li", {
|
|
189
|
+
key: K.code,
|
|
190
|
+
class: Ee({
|
|
191
|
+
"link--disabled": K.disabled,
|
|
192
192
|
"modern-submenu-item": !0
|
|
193
193
|
}),
|
|
194
|
-
onMouseenter:
|
|
195
|
-
onMouseleave:
|
|
194
|
+
onMouseenter: Q,
|
|
195
|
+
onMouseleave: ee
|
|
196
196
|
}, [
|
|
197
|
-
|
|
197
|
+
ce("a", {
|
|
198
198
|
class: "we-vt-context-menu--link modern-submenu-link",
|
|
199
|
-
onClick: (
|
|
199
|
+
onClick: (y) => A(K, y, T)
|
|
200
200
|
}, [
|
|
201
|
-
(
|
|
201
|
+
(f(), Fe(Ze(be(K)), {
|
|
202
202
|
size: 14,
|
|
203
203
|
class: "submenu-icon"
|
|
204
204
|
})),
|
|
205
|
-
|
|
205
|
+
ce("span", Jn, ie(K.name), 1)
|
|
206
206
|
], 8, Gn)
|
|
207
207
|
], 34))), 128))
|
|
208
|
-
])) :
|
|
208
|
+
])) : ve("", !0)
|
|
209
209
|
], 42, Kn))), 128))
|
|
210
210
|
])
|
|
211
211
|
], 4));
|
|
212
212
|
}
|
|
213
213
|
}, Dt = Symbol("component_container");
|
|
214
214
|
function Yn(i, e, t) {
|
|
215
|
-
const
|
|
216
|
-
return document.body.appendChild(o),
|
|
215
|
+
const a = dn(i, { ...e }, t), o = document.createElement("div");
|
|
216
|
+
return document.body.appendChild(o), a[Dt] = o, Ot(a, o), a.component;
|
|
217
217
|
}
|
|
218
218
|
function Zn(i) {
|
|
219
219
|
var t;
|
|
@@ -230,52 +230,52 @@ const Qn = (i) => {
|
|
|
230
230
|
}, Qn(i), i;
|
|
231
231
|
};
|
|
232
232
|
function ti(i, e, t) {
|
|
233
|
-
const
|
|
233
|
+
const a = (t == null ? void 0 : t.keyField) || (t == null ? void 0 : t.rowField) || "node_id", o = (t == null ? void 0 : t.parentField) || "parent_id", u = (t == null ? void 0 : t.parentField) || "order";
|
|
234
234
|
if (!(i != null && i.length))
|
|
235
235
|
return i;
|
|
236
|
-
const
|
|
237
|
-
i.forEach((
|
|
238
|
-
const
|
|
239
|
-
|
|
236
|
+
const P = {};
|
|
237
|
+
i.forEach((Z) => {
|
|
238
|
+
const N = Z[o];
|
|
239
|
+
P[N] || (P[N] = []), P[N].push(Z);
|
|
240
240
|
});
|
|
241
|
-
function
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
(
|
|
241
|
+
function S(Z) {
|
|
242
|
+
const N = P[Z] || [];
|
|
243
|
+
N.sort(
|
|
244
|
+
(Q, ee) => Q[u] && ee[u] ? Q[u] - ee[u] : 0
|
|
245
245
|
);
|
|
246
246
|
const q = [];
|
|
247
|
-
return
|
|
248
|
-
q.push(
|
|
247
|
+
return N.forEach((Q) => {
|
|
248
|
+
q.push(Q), q.push(...S(Q[a]));
|
|
249
249
|
}), q;
|
|
250
250
|
}
|
|
251
|
-
let
|
|
251
|
+
let z = [];
|
|
252
252
|
if (Array.isArray(e))
|
|
253
|
-
|
|
253
|
+
z = e;
|
|
254
254
|
else {
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
255
|
+
const Z = new Set(i.map((Q) => Q[a])), N = i.filter((Q) => !Z.has(Q[o]));
|
|
256
|
+
if (N.length === 0)
|
|
257
257
|
throw new Error("无法确定根节点:可能存在循环引用或数据不完整");
|
|
258
258
|
const q = {};
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
q[
|
|
262
|
-
}),
|
|
263
|
-
}
|
|
264
|
-
let
|
|
265
|
-
return
|
|
266
|
-
|
|
267
|
-
}),
|
|
259
|
+
N.forEach((Q) => {
|
|
260
|
+
const ee = Q[o];
|
|
261
|
+
q[ee] = (q[ee] || 0) + 1;
|
|
262
|
+
}), z = Object.entries(q).map(([Q]) => Q);
|
|
263
|
+
}
|
|
264
|
+
let A = [];
|
|
265
|
+
return z.forEach((Z) => {
|
|
266
|
+
A = A.concat(S(Z));
|
|
267
|
+
}), A;
|
|
268
268
|
}
|
|
269
269
|
function Tt(i, e, t) {
|
|
270
|
-
let
|
|
270
|
+
let a;
|
|
271
271
|
for (; i && i.nodeType && i !== document; ) {
|
|
272
272
|
if (i.className && i.className.split && i.className.split(" ").indexOf(e) > -1)
|
|
273
|
-
return
|
|
273
|
+
return a = i, a;
|
|
274
274
|
if (i === t)
|
|
275
275
|
return null;
|
|
276
276
|
i = i.parentNode;
|
|
277
277
|
}
|
|
278
|
-
return
|
|
278
|
+
return a;
|
|
279
279
|
}
|
|
280
280
|
function ni(i) {
|
|
281
281
|
return typeof i == "function" || Object.prototype.toString.call(i) === "[object Object]" && !fn(i);
|
|
@@ -352,30 +352,30 @@ const ii = /* @__PURE__ */ un({
|
|
|
352
352
|
setup(i, {
|
|
353
353
|
emit: e,
|
|
354
354
|
slots: t,
|
|
355
|
-
expose:
|
|
355
|
+
expose: a
|
|
356
356
|
}) {
|
|
357
357
|
var vt;
|
|
358
|
-
const o = hn(),
|
|
359
|
-
let
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
const q =
|
|
363
|
-
|
|
364
|
-
const
|
|
358
|
+
const o = hn(), u = se(), P = se(!1), S = se(null), z = se(null), A = se([]);
|
|
359
|
+
let Z = /* @__PURE__ */ new Map();
|
|
360
|
+
const N = /* @__PURE__ */ new Map();
|
|
361
|
+
se(0);
|
|
362
|
+
const q = se([]);
|
|
363
|
+
se([]);
|
|
364
|
+
const Q = se(/* @__PURE__ */ new Set()), ee = se(/* @__PURE__ */ new Set()), be = se(null), W = 2, B = /* @__PURE__ */ new WeakMap(), T = se(null), K = se(""), y = /* @__PURE__ */ new Set(), _ = ke(() => {
|
|
365
365
|
try {
|
|
366
|
-
return Array.isArray(
|
|
366
|
+
return Array.isArray(A.value) ? A.value : [];
|
|
367
367
|
} catch {
|
|
368
368
|
return [];
|
|
369
369
|
}
|
|
370
|
-
}),
|
|
371
|
-
var
|
|
370
|
+
}), r = (n) => {
|
|
371
|
+
var g, d, h;
|
|
372
372
|
if (!n) return 30;
|
|
373
373
|
if (n.height) return n.height;
|
|
374
|
-
const
|
|
374
|
+
const l = `${n.content_type}_${((g = n.content) == null ? void 0 : g.length) || 0}_${((d = n.title) == null ? void 0 : d.length) || 0}_${n._editing ? 1 : 0}`;
|
|
375
375
|
if (B.has(n)) {
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
return
|
|
376
|
+
const x = B.get(n);
|
|
377
|
+
if (x.key === l)
|
|
378
|
+
return x.height;
|
|
379
379
|
}
|
|
380
380
|
let s = 30;
|
|
381
381
|
switch (n.content_type) {
|
|
@@ -386,173 +386,173 @@ const ii = /* @__PURE__ */ un({
|
|
|
386
386
|
s = n.rowHeight || 35;
|
|
387
387
|
break;
|
|
388
388
|
case "table":
|
|
389
|
-
const
|
|
390
|
-
s = Math.max(100,
|
|
389
|
+
const w = ((n.content || "").match(/<tr/g) || []).length;
|
|
390
|
+
s = Math.max(100, w * 35 + 30);
|
|
391
391
|
break;
|
|
392
392
|
case "flowchart":
|
|
393
393
|
s = 200;
|
|
394
394
|
break;
|
|
395
395
|
default: {
|
|
396
|
-
const
|
|
396
|
+
const m = (n.content || "").length, v = (n.title || "").length, k = m + v, L = ((h = (n.content || "").match(/[\u4e00-\u9fa5]/g)) == null ? void 0 : h.length) || 0, R = k - L, F = L * 12 + R * 6, H = Math.max(1, Math.ceil(F / 760));
|
|
397
397
|
s = Math.max(20, H * 18), n._editing && (s += 20);
|
|
398
398
|
break;
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
return B.set(n, {
|
|
402
|
-
key:
|
|
402
|
+
key: l,
|
|
403
403
|
height: s
|
|
404
404
|
}), s;
|
|
405
|
-
},
|
|
406
|
-
if (
|
|
407
|
-
const n =
|
|
405
|
+
}, D = ke(() => {
|
|
406
|
+
if (_.value.length === 0) return 30;
|
|
407
|
+
const n = _.value.slice(0, Math.min(100, _.value.length));
|
|
408
408
|
if (n.length === 0) return 30;
|
|
409
|
-
const
|
|
409
|
+
const l = n.reduce((g, d) => g + r(d), 0) / n.length, s = Math.max(20, Math.floor(l * 0.6));
|
|
410
410
|
return Math.min(s, 60);
|
|
411
411
|
});
|
|
412
|
-
let
|
|
413
|
-
const $ = (n,
|
|
412
|
+
let c;
|
|
413
|
+
const $ = (n, l) => {
|
|
414
414
|
e("menu-click", {
|
|
415
415
|
menu: n,
|
|
416
|
-
row:
|
|
417
|
-
}),
|
|
416
|
+
row: l
|
|
417
|
+
}), c == null || c.onClose(), c = null;
|
|
418
418
|
}, M = (n) => {
|
|
419
|
-
var s,
|
|
420
|
-
if (!((
|
|
421
|
-
|
|
422
|
-
let
|
|
423
|
-
for (;
|
|
424
|
-
|
|
425
|
-
if ((
|
|
426
|
-
const
|
|
427
|
-
|
|
419
|
+
var s, g, d, h, x;
|
|
420
|
+
if (!((d = (g = (s = i.menuConfig) == null ? void 0 : s.body) == null ? void 0 : g.options) != null && d.length)) return;
|
|
421
|
+
c == null || c.onClose(), c = null;
|
|
422
|
+
let l = n.target;
|
|
423
|
+
for (; l && (l != null && l.getAttribute) && !(l != null && l.getAttribute("data-id")) && l !== ((h = u.value) == null ? void 0 : h.$el); )
|
|
424
|
+
l = l.parentNode;
|
|
425
|
+
if ((x = l == null ? void 0 : l.getAttribute) != null && x.call(l, "data-id")) {
|
|
426
|
+
const w = l.getAttribute("data-id"), m = Ce(w);
|
|
427
|
+
m && (c = ei({
|
|
428
428
|
e: n,
|
|
429
|
-
row:
|
|
429
|
+
row: m,
|
|
430
430
|
menuConfig: i.menuConfig,
|
|
431
431
|
onMenuClick: $
|
|
432
432
|
}), n.preventDefault(), n.stopPropagation());
|
|
433
433
|
}
|
|
434
|
-
},
|
|
435
|
-
var s,
|
|
436
|
-
if (!
|
|
434
|
+
}, C = (n) => {
|
|
435
|
+
var s, g, d;
|
|
436
|
+
if (!S.value)
|
|
437
437
|
return;
|
|
438
|
-
let
|
|
439
|
-
for (;
|
|
440
|
-
if (
|
|
438
|
+
let l = n.target;
|
|
439
|
+
for (; l && (l != null && l.getAttribute) && !(l != null && l.getAttribute("data-id")) && l !== ((s = u.value) == null ? void 0 : s.$el); )
|
|
440
|
+
if (l = l.parentNode, l != null && l.classList && ["el-popper", "ck-body-wrapper"].some((h) => l.classList.contains(h)))
|
|
441
441
|
return;
|
|
442
|
-
((
|
|
443
|
-
row:
|
|
442
|
+
((g = l == null ? void 0 : l.getAttribute) == null ? void 0 : g.call(l, "data-id")) != ((d = S.value) == null ? void 0 : d.node_id) && (S.value._editing = !1, e("edit-closed", {
|
|
443
|
+
row: S.value,
|
|
444
444
|
column: {},
|
|
445
445
|
$table: o == null ? void 0 : o.exposed
|
|
446
|
-
}),
|
|
446
|
+
}), S.value = null);
|
|
447
447
|
};
|
|
448
|
-
((vt = i.editConfig) == null ? void 0 : vt.trigger) === "dblclick" && Be(() =>
|
|
449
|
-
document.removeEventListener("click",
|
|
450
|
-
document.addEventListener("click",
|
|
448
|
+
((vt = i.editConfig) == null ? void 0 : vt.trigger) === "dblclick" && Be(() => S.value, (n) => {
|
|
449
|
+
document.removeEventListener("click", C, !0), n && setTimeout(() => {
|
|
450
|
+
document.addEventListener("click", C, !0);
|
|
451
451
|
}, 200);
|
|
452
452
|
});
|
|
453
|
-
const
|
|
453
|
+
const I = (n) => JSON.stringify(n.map((l) => {
|
|
454
454
|
var s;
|
|
455
455
|
return {
|
|
456
|
-
id:
|
|
457
|
-
content: ((s =
|
|
458
|
-
type:
|
|
459
|
-
editing:
|
|
456
|
+
id: l[i.rowConfig.keyField],
|
|
457
|
+
content: ((s = l.content) == null ? void 0 : s.length) || 0,
|
|
458
|
+
type: l.content_type,
|
|
459
|
+
editing: l._editing
|
|
460
460
|
};
|
|
461
|
-
})),
|
|
461
|
+
})), O = () => {
|
|
462
462
|
if (!i.pageConfig.enabled) {
|
|
463
463
|
q.value = [{
|
|
464
|
-
items:
|
|
464
|
+
items: A.value,
|
|
465
465
|
startIndex: 0,
|
|
466
|
-
endIndex:
|
|
466
|
+
endIndex: A.value.length
|
|
467
467
|
}];
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
470
|
if (i.pageData && Object.keys(i.pageData).length) {
|
|
471
|
-
const n = [],
|
|
472
|
-
|
|
473
|
-
s.set(String(
|
|
474
|
-
}), Object.keys(i.pageData).sort((
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
}),
|
|
480
|
-
items:
|
|
481
|
-
pageNumber: parseInt(
|
|
482
|
-
height:
|
|
471
|
+
const n = [], l = i.rowConfig.keyField || "node_id", s = /* @__PURE__ */ new Map();
|
|
472
|
+
A.value.forEach((d) => {
|
|
473
|
+
s.set(String(d[l]), d);
|
|
474
|
+
}), Object.keys(i.pageData).sort((d, h) => parseInt(d) - parseInt(h)).forEach((d) => {
|
|
475
|
+
const h = i.pageData[d], x = [];
|
|
476
|
+
h.forEach((w) => {
|
|
477
|
+
const m = s.get(String(w));
|
|
478
|
+
m && x.push(m);
|
|
479
|
+
}), x.length > 0 && n.push({
|
|
480
|
+
items: x,
|
|
481
|
+
pageNumber: parseInt(d),
|
|
482
|
+
height: x.reduce((w, m) => w + r(m), 0)
|
|
483
483
|
});
|
|
484
484
|
}), q.value = n;
|
|
485
485
|
} else {
|
|
486
486
|
const {
|
|
487
487
|
pageHeight: n,
|
|
488
|
-
margin:
|
|
489
|
-
} = i.pageConfig, s = n -
|
|
490
|
-
let
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
(
|
|
494
|
-
items: [...
|
|
495
|
-
startIndex:
|
|
496
|
-
endIndex:
|
|
497
|
-
height:
|
|
498
|
-
pageNumber:
|
|
499
|
-
}),
|
|
500
|
-
items: [...
|
|
501
|
-
startIndex:
|
|
502
|
-
endIndex:
|
|
503
|
-
height:
|
|
504
|
-
pageNumber:
|
|
505
|
-
}),
|
|
506
|
-
}),
|
|
507
|
-
items:
|
|
508
|
-
startIndex:
|
|
509
|
-
endIndex:
|
|
510
|
-
height:
|
|
511
|
-
pageNumber:
|
|
512
|
-
}), q.value =
|
|
488
|
+
margin: l
|
|
489
|
+
} = i.pageConfig, s = n - l * 2, g = [];
|
|
490
|
+
let d = [], h = 0, x = 0, w = 1;
|
|
491
|
+
A.value.forEach((m, v) => {
|
|
492
|
+
const k = r(m);
|
|
493
|
+
(m.layer || 0) <= 2 && d.length > 0 ? (g.push({
|
|
494
|
+
items: [...d],
|
|
495
|
+
startIndex: x,
|
|
496
|
+
endIndex: v,
|
|
497
|
+
height: h,
|
|
498
|
+
pageNumber: w++
|
|
499
|
+
}), d = [m], h = k, x = v) : h + k > s && d.length > 0 ? (g.push({
|
|
500
|
+
items: [...d],
|
|
501
|
+
startIndex: x,
|
|
502
|
+
endIndex: v,
|
|
503
|
+
height: h,
|
|
504
|
+
pageNumber: w++
|
|
505
|
+
}), d = [m], h = Math.min(k, s), x = v) : (d.push(m), h += k);
|
|
506
|
+
}), d.length > 0 && g.push({
|
|
507
|
+
items: d,
|
|
508
|
+
startIndex: x,
|
|
509
|
+
endIndex: A.value.length,
|
|
510
|
+
height: h,
|
|
511
|
+
pageNumber: w
|
|
512
|
+
}), q.value = g;
|
|
513
513
|
}
|
|
514
|
-
},
|
|
514
|
+
}, b = () => {
|
|
515
515
|
try {
|
|
516
|
-
const n = Array.isArray(i.data) ? i.data : [],
|
|
517
|
-
if (!(
|
|
516
|
+
const n = Array.isArray(i.data) ? i.data : [], l = I(n);
|
|
517
|
+
if (!(l !== K.value) && A.value.length > 0)
|
|
518
518
|
return;
|
|
519
|
-
|
|
520
|
-
const
|
|
521
|
-
const
|
|
522
|
-
if (!
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
...
|
|
526
|
-
index:
|
|
527
|
-
_editing:
|
|
528
|
-
_original: (
|
|
529
|
-
...
|
|
519
|
+
K.value = l;
|
|
520
|
+
const g = (i.treeConfig ? ti(n, void 0, i.treeConfig) : n).map((h, x) => {
|
|
521
|
+
const w = h[i.rowConfig.keyField], m = N.get(w);
|
|
522
|
+
if (!m || m.content !== h.content || m.content_type !== h.content_type) {
|
|
523
|
+
y.add(w);
|
|
524
|
+
const v = {
|
|
525
|
+
...h,
|
|
526
|
+
index: x,
|
|
527
|
+
_editing: h._editing || !1,
|
|
528
|
+
_original: (m == null ? void 0 : m._original) || {
|
|
529
|
+
...h
|
|
530
530
|
}
|
|
531
531
|
// 保留原始数据,避免重复深拷贝
|
|
532
532
|
};
|
|
533
|
-
return
|
|
533
|
+
return N.set(w, v), v;
|
|
534
534
|
}
|
|
535
|
-
return
|
|
535
|
+
return m.index = x, m;
|
|
536
536
|
});
|
|
537
|
-
|
|
538
|
-
const
|
|
539
|
-
for (const [
|
|
540
|
-
|
|
537
|
+
A.value = g, O();
|
|
538
|
+
const d = new Set(g.map((h) => h[i.rowConfig.keyField]));
|
|
539
|
+
for (const [h] of N)
|
|
540
|
+
d.has(h) || (N.delete(h), y.delete(h));
|
|
541
541
|
} catch {
|
|
542
|
-
|
|
542
|
+
A.value = [], q.value = [], N.clear(), y.clear();
|
|
543
543
|
}
|
|
544
544
|
};
|
|
545
|
-
Be(() => i.data, (n,
|
|
545
|
+
Be(() => i.data, (n, l) => {
|
|
546
546
|
try {
|
|
547
547
|
if (!Array.isArray(n))
|
|
548
548
|
return;
|
|
549
|
-
|
|
550
|
-
if (
|
|
551
|
-
|
|
549
|
+
xe(() => {
|
|
550
|
+
if (b(), i.pageConfig.enabled) {
|
|
551
|
+
ee.value.clear(), Q.value.clear();
|
|
552
552
|
for (let s = 0; s < Math.min(3, q.value.length); s++)
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
553
|
+
ee.value.add(s);
|
|
554
|
+
xe(() => {
|
|
555
|
+
ne();
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
558
|
});
|
|
@@ -563,102 +563,102 @@ const ii = /* @__PURE__ */ un({
|
|
|
563
563
|
immediate: !1
|
|
564
564
|
}), Be(() => i.pageData, () => {
|
|
565
565
|
if (i.pageConfig.enabled) {
|
|
566
|
-
|
|
566
|
+
O(), ee.value.clear(), Q.value.clear();
|
|
567
567
|
for (let n = 0; n < Math.min(3, q.value.length); n++)
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
568
|
+
ee.value.add(n);
|
|
569
|
+
xe(() => {
|
|
570
|
+
ne();
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
573
|
}, {
|
|
574
574
|
deep: !0
|
|
575
575
|
}), Be(() => i.pageConfig, () => {
|
|
576
576
|
if (i.pageConfig.enabled) {
|
|
577
|
-
|
|
577
|
+
O(), ee.value.clear(), Q.value.clear();
|
|
578
578
|
for (let n = 0; n < Math.min(3, q.value.length); n++)
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
579
|
+
ee.value.add(n);
|
|
580
|
+
xe(() => {
|
|
581
|
+
ne();
|
|
582
582
|
});
|
|
583
583
|
}
|
|
584
584
|
}, {
|
|
585
585
|
deep: !0
|
|
586
|
-
}), Be(
|
|
587
|
-
row:
|
|
586
|
+
}), Be(z, () => e("current-change", {
|
|
587
|
+
row: z.value
|
|
588
588
|
}));
|
|
589
|
-
let
|
|
590
|
-
const
|
|
591
|
-
window.ResizeObserver && (
|
|
592
|
-
var
|
|
593
|
-
for (const
|
|
594
|
-
const
|
|
595
|
-
if (!
|
|
596
|
-
const
|
|
597
|
-
if (!
|
|
598
|
-
const
|
|
599
|
-
if (Math.abs(
|
|
600
|
-
const
|
|
601
|
-
B.set(
|
|
602
|
-
...
|
|
603
|
-
height:
|
|
589
|
+
let ge = null;
|
|
590
|
+
const de = () => {
|
|
591
|
+
window.ResizeObserver && (ge = new ResizeObserver((n) => {
|
|
592
|
+
var l, s;
|
|
593
|
+
for (const g of n) {
|
|
594
|
+
const d = (l = g.target.dataset) == null ? void 0 : l.id;
|
|
595
|
+
if (!d) continue;
|
|
596
|
+
const h = Ce(d);
|
|
597
|
+
if (!h) continue;
|
|
598
|
+
const x = g.contentRect.height, w = ((s = B.get(h)) == null ? void 0 : s.height) || 0;
|
|
599
|
+
if (Math.abs(w - x) > 5) {
|
|
600
|
+
const m = B.get(h) || {};
|
|
601
|
+
B.set(h, {
|
|
602
|
+
...m,
|
|
603
|
+
height: x
|
|
604
604
|
}), requestAnimationFrame(() => {
|
|
605
|
-
var
|
|
606
|
-
const
|
|
607
|
-
(
|
|
605
|
+
var k;
|
|
606
|
+
const v = g.target.__vueParentComponent;
|
|
607
|
+
(k = v == null ? void 0 : v.proxy) != null && k.updateSize && v.proxy.updateSize();
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
}),
|
|
611
|
+
}), xe(() => {
|
|
612
612
|
var s;
|
|
613
|
-
const n = (s =
|
|
613
|
+
const n = (s = u.value) == null ? void 0 : s.$el;
|
|
614
614
|
if (!n) return;
|
|
615
|
-
n.querySelectorAll("[data-id]").forEach((
|
|
616
|
-
|
|
615
|
+
n.querySelectorAll("[data-id]").forEach((g) => {
|
|
616
|
+
g.dataset.id && ge.observe(g);
|
|
617
617
|
});
|
|
618
618
|
}));
|
|
619
|
-
},
|
|
620
|
-
|
|
621
|
-
},
|
|
622
|
-
i.pageConfig.enabled && (
|
|
623
|
-
n.forEach((
|
|
624
|
-
const s = parseInt(
|
|
625
|
-
if (
|
|
626
|
-
|
|
627
|
-
for (let
|
|
628
|
-
|
|
619
|
+
}, le = () => {
|
|
620
|
+
T.value && (T.value.disconnect(), T.value = null), ge && (ge.disconnect(), ge = null);
|
|
621
|
+
}, ne = () => {
|
|
622
|
+
i.pageConfig.enabled && (be.value && be.value.disconnect(), be.value = new IntersectionObserver((n) => {
|
|
623
|
+
n.forEach((l) => {
|
|
624
|
+
const s = parseInt(l.target.dataset.pageIndex);
|
|
625
|
+
if (l.isIntersecting) {
|
|
626
|
+
Q.value.add(s);
|
|
627
|
+
for (let g = Math.max(0, s - W); g <= Math.min(q.value.length - 1, s + W); g++)
|
|
628
|
+
ee.value.add(g);
|
|
629
629
|
} else
|
|
630
|
-
|
|
631
|
-
|
|
630
|
+
Q.value.delete(s), setTimeout(() => {
|
|
631
|
+
Q.value.has(s) || Array.from(Q.value).some((d) => Math.abs(d - s) <= W * 2) || ee.value.delete(s);
|
|
632
632
|
}, 3e3);
|
|
633
633
|
});
|
|
634
634
|
}, {
|
|
635
635
|
root: null,
|
|
636
636
|
rootMargin: "100px",
|
|
637
637
|
threshold: 0.01
|
|
638
|
-
}),
|
|
638
|
+
}), xe(() => {
|
|
639
639
|
const n = document.querySelector(".a4-pages-container");
|
|
640
640
|
n && n.querySelectorAll(".a4-page-placeholder").forEach((s) => {
|
|
641
|
-
|
|
641
|
+
be.value.observe(s);
|
|
642
642
|
});
|
|
643
643
|
}));
|
|
644
644
|
};
|
|
645
|
-
|
|
646
|
-
|
|
645
|
+
ct(() => {
|
|
646
|
+
b(), xe(() => {
|
|
647
647
|
var n;
|
|
648
|
-
if (
|
|
649
|
-
for (let
|
|
650
|
-
|
|
651
|
-
}),
|
|
652
|
-
}),
|
|
648
|
+
if (de(), ue.setup(), ne(), ((n = i.editConfig) == null ? void 0 : n.trigger) === "contenteditable" && (document.addEventListener("selectionchange", dt), document.addEventListener("mouseup", ut)), i.pageConfig.enabled)
|
|
649
|
+
for (let l = 0; l < Math.min(3, q.value.length); l++)
|
|
650
|
+
ee.value.add(l);
|
|
651
|
+
}), P.value = !0;
|
|
652
|
+
}), et(() => {
|
|
653
653
|
var n;
|
|
654
|
-
|
|
654
|
+
le(), ue.cleanup(), be.value && (be.value.disconnect(), be.value = null), ((n = i.editConfig) == null ? void 0 : n.trigger) === "contenteditable" && (document.removeEventListener("selectionchange", dt), document.removeEventListener("mouseup", ut)), fe && clearTimeout(fe), Z = /* @__PURE__ */ new Map(), N.clear(), ee.value.clear(), Q.value.clear();
|
|
655
655
|
});
|
|
656
|
-
const
|
|
656
|
+
const ue = {
|
|
657
657
|
handlers: /* @__PURE__ */ new Map(),
|
|
658
658
|
setup() {
|
|
659
|
-
|
|
660
|
-
var
|
|
661
|
-
const n = (
|
|
659
|
+
xe(() => {
|
|
660
|
+
var l;
|
|
661
|
+
const n = (l = u.value) == null ? void 0 : l.$el;
|
|
662
662
|
n && (n.addEventListener("click", this.handleClick.bind(this), {
|
|
663
663
|
passive: !0
|
|
664
664
|
}), n.addEventListener("dblclick", this.handleDblClick.bind(this), {
|
|
@@ -667,51 +667,51 @@ const ii = /* @__PURE__ */ un({
|
|
|
667
667
|
});
|
|
668
668
|
},
|
|
669
669
|
handleClick(n) {
|
|
670
|
-
const
|
|
671
|
-
if (!
|
|
672
|
-
const s =
|
|
673
|
-
|
|
670
|
+
const l = n.target.closest("[data-id]");
|
|
671
|
+
if (!l) return;
|
|
672
|
+
const s = l.dataset.id, g = Ce(s);
|
|
673
|
+
g && Ke(g);
|
|
674
674
|
},
|
|
675
675
|
handleDblClick(n) {
|
|
676
|
-
var
|
|
677
|
-
if (!((
|
|
678
|
-
const
|
|
679
|
-
if (!
|
|
680
|
-
const s =
|
|
681
|
-
|
|
676
|
+
var d;
|
|
677
|
+
if (!((d = i.editConfig) != null && d.trigger) === "dblclick") return;
|
|
678
|
+
const l = n.target.closest("[data-id]");
|
|
679
|
+
if (!l) return;
|
|
680
|
+
const s = l.dataset.id, g = Ce(s);
|
|
681
|
+
g && Oe(g);
|
|
682
682
|
},
|
|
683
683
|
cleanup() {
|
|
684
|
-
var
|
|
685
|
-
const n = (s = (
|
|
684
|
+
var l, s;
|
|
685
|
+
const n = (s = (l = u.value) == null ? void 0 : l.$el) == null ? void 0 : s.querySelector(".virtual-table-wrapper");
|
|
686
686
|
n && (n.removeEventListener("click", this.handleClick), n.removeEventListener("dblclick", this.handleDblClick));
|
|
687
687
|
}
|
|
688
|
-
},
|
|
689
|
-
|
|
690
|
-
},
|
|
691
|
-
let
|
|
692
|
-
const
|
|
688
|
+
}, me = (n) => {
|
|
689
|
+
Ke(n);
|
|
690
|
+
}, re = (n) => Oe(n);
|
|
691
|
+
let E = null, X;
|
|
692
|
+
const Ne = ({
|
|
693
693
|
row: n,
|
|
694
|
-
column:
|
|
695
|
-
}, s,
|
|
696
|
-
var
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
var
|
|
700
|
-
|
|
701
|
-
let
|
|
702
|
-
if (!
|
|
694
|
+
column: l
|
|
695
|
+
}, s, g) => {
|
|
696
|
+
var x, w;
|
|
697
|
+
const d = g || s.target, h = Tt(d, "virtual-table-cell", (x = u.value) == null ? void 0 : x.$el);
|
|
698
|
+
E === h && X && (clearTimeout(X), E = null), ((w = S.value) == null ? void 0 : w[i.rowConfig.keyField]) != (n == null ? void 0 : n[i.rowConfig.keyField]) && setTimeout(() => {
|
|
699
|
+
var v, k;
|
|
700
|
+
S.value = n;
|
|
701
|
+
let m = (v = d == null ? void 0 : d.getAttribute) == null ? void 0 : v.call(d, "field");
|
|
702
|
+
if (!m) {
|
|
703
703
|
try {
|
|
704
|
-
const
|
|
705
|
-
let
|
|
706
|
-
|
|
707
|
-
const F = (
|
|
708
|
-
F && (
|
|
704
|
+
const L = document.getSelection();
|
|
705
|
+
let R = L == null ? void 0 : L.anchorNode;
|
|
706
|
+
R && R.nodeType === 3 && (R = R.parentElement);
|
|
707
|
+
const F = (k = R == null ? void 0 : R.closest) == null ? void 0 : k.call(R, "[field]");
|
|
708
|
+
F && (m = F.getAttribute("field"));
|
|
709
709
|
} catch {
|
|
710
710
|
}
|
|
711
|
-
if (!
|
|
712
|
-
for (const
|
|
713
|
-
if (
|
|
714
|
-
|
|
711
|
+
if (!m && (s != null && s.composedPath)) {
|
|
712
|
+
for (const L of s.composedPath())
|
|
713
|
+
if (L != null && L.getAttribute && L.getAttribute("field")) {
|
|
714
|
+
m = L.getAttribute("field");
|
|
715
715
|
break;
|
|
716
716
|
}
|
|
717
717
|
}
|
|
@@ -719,134 +719,134 @@ const ii = /* @__PURE__ */ un({
|
|
|
719
719
|
e("edit-activated", {
|
|
720
720
|
row: n,
|
|
721
721
|
column: {
|
|
722
|
-
...
|
|
723
|
-
field:
|
|
722
|
+
...l,
|
|
723
|
+
field: m
|
|
724
724
|
},
|
|
725
725
|
$table: o == null ? void 0 : o.exposed
|
|
726
726
|
});
|
|
727
727
|
}, 200);
|
|
728
|
-
},
|
|
728
|
+
}, ye = ({
|
|
729
729
|
row: n,
|
|
730
|
-
column:
|
|
731
|
-
}, s,
|
|
732
|
-
var
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
var
|
|
736
|
-
const
|
|
737
|
-
let
|
|
738
|
-
if (!
|
|
730
|
+
column: l
|
|
731
|
+
}, s, g) => {
|
|
732
|
+
var h;
|
|
733
|
+
const d = g || s.target;
|
|
734
|
+
E = Tt(d, "virtual-table-cell", (h = u.value) == null ? void 0 : h.$el), X && clearTimeout(X), X = setTimeout(() => {
|
|
735
|
+
var m, v, k, L, R;
|
|
736
|
+
const x = n.content_type;
|
|
737
|
+
let w = (m = d == null ? void 0 : d.getAttribute) == null ? void 0 : m.call(d, "field");
|
|
738
|
+
if (!w) {
|
|
739
739
|
try {
|
|
740
740
|
const F = document.getSelection();
|
|
741
741
|
let H = F == null ? void 0 : F.anchorNode;
|
|
742
742
|
H && H.nodeType === 3 && (H = H.parentElement);
|
|
743
|
-
const
|
|
744
|
-
|
|
743
|
+
const te = (v = H == null ? void 0 : H.closest) == null ? void 0 : v.call(H, "[field]");
|
|
744
|
+
te && (w = te.getAttribute("field"));
|
|
745
745
|
} catch {
|
|
746
746
|
}
|
|
747
|
-
if (!
|
|
747
|
+
if (!w && (s != null && s.composedPath)) {
|
|
748
748
|
for (const F of s.composedPath())
|
|
749
749
|
if (F != null && F.getAttribute && F.getAttribute("field")) {
|
|
750
|
-
|
|
750
|
+
w = F.getAttribute("field");
|
|
751
751
|
break;
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
|
-
if (
|
|
756
|
-
if (
|
|
755
|
+
if (x !== "table") {
|
|
756
|
+
if (x === "text") {
|
|
757
757
|
let F = null, H = null;
|
|
758
|
-
if ((
|
|
758
|
+
if ((k = d == null ? void 0 : d.getAttribute) != null && k.call(d, "field") ? F = d : (L = d == null ? void 0 : d.closest) != null && L.call(d, "[field]") && (F = d.closest("[field]")), F && (H = F.textContent), w && H !== void 0 && H !== null) {
|
|
759
759
|
H = H.trim();
|
|
760
|
-
const
|
|
761
|
-
H !==
|
|
760
|
+
const te = ((R = n[w]) == null ? void 0 : R.trim()) || "";
|
|
761
|
+
H !== te && (n[w] = H);
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
765
|
e("edit-closed", {
|
|
766
766
|
row: n,
|
|
767
767
|
column: {
|
|
768
|
-
...
|
|
769
|
-
field:
|
|
768
|
+
...l,
|
|
769
|
+
field: w
|
|
770
770
|
},
|
|
771
771
|
$table: o == null ? void 0 : o.exposed
|
|
772
772
|
});
|
|
773
773
|
}, 50);
|
|
774
774
|
};
|
|
775
|
-
let
|
|
776
|
-
const
|
|
777
|
-
var
|
|
778
|
-
((
|
|
779
|
-
},
|
|
780
|
-
var
|
|
781
|
-
if (((
|
|
782
|
-
if (
|
|
783
|
-
let
|
|
784
|
-
!
|
|
785
|
-
target:
|
|
786
|
-
},
|
|
775
|
+
let U = null, fe = null;
|
|
776
|
+
const Re = (n) => {
|
|
777
|
+
var l;
|
|
778
|
+
((l = i.editConfig) == null ? void 0 : l.trigger) === "contenteditable" && Ve("focusin", n);
|
|
779
|
+
}, Pe = (n) => {
|
|
780
|
+
var l, s, g, d, h;
|
|
781
|
+
if (((l = i.editConfig) == null ? void 0 : l.trigger) === "contenteditable")
|
|
782
|
+
if (U != null && U.cellEl) {
|
|
783
|
+
let x = U.fieldEl;
|
|
784
|
+
!x && U.field && (x = (g = (s = U.cellEl) == null ? void 0 : s.querySelector) == null ? void 0 : g.call(s, `[field="${U.field}"]`)), x || (x = ((h = (d = U.cellEl).querySelector) == null ? void 0 : h.call(d, "[field]")) || U.cellEl), ye(U, {
|
|
785
|
+
target: x
|
|
786
|
+
}, x), U = null;
|
|
787
787
|
} else
|
|
788
|
-
|
|
789
|
-
},
|
|
790
|
-
var s,
|
|
788
|
+
Ve("focusout", n);
|
|
789
|
+
}, Ve = (n, l) => {
|
|
790
|
+
var s, g, d, h, x, w;
|
|
791
791
|
try {
|
|
792
|
-
const
|
|
793
|
-
let
|
|
794
|
-
|
|
795
|
-
const
|
|
796
|
-
if (!
|
|
797
|
-
const
|
|
798
|
-
n === "focusin" ? (
|
|
792
|
+
const m = document.getSelection();
|
|
793
|
+
let v = m == null ? void 0 : m.anchorNode;
|
|
794
|
+
v && v.nodeType === 3 && (v = v.parentElement);
|
|
795
|
+
const k = (s = v == null ? void 0 : v.closest) == null ? void 0 : s.call(v, ".virtual-table-cell"), L = (g = v == null ? void 0 : v.closest) == null ? void 0 : g.call(v, ".virtual-table-row");
|
|
796
|
+
if (!k || !L) return;
|
|
797
|
+
const R = L.getAttribute("data-id"), F = k.getAttribute("data-prop"), H = Ce(R), te = $e.value.find((pe) => `${pe.prop}` == `${F}`) || {}, he = ((d = v == null ? void 0 : v.closest) == null ? void 0 : d.call(v, "[field]")) || null, G = ((h = he == null ? void 0 : he.getAttribute) == null ? void 0 : h.call(he, "field")) || void 0;
|
|
798
|
+
n === "focusin" ? (U = {
|
|
799
799
|
row: H,
|
|
800
|
-
column:
|
|
801
|
-
cellEl:
|
|
802
|
-
rowEl:
|
|
803
|
-
fieldEl:
|
|
804
|
-
field:
|
|
805
|
-
},
|
|
800
|
+
column: te,
|
|
801
|
+
cellEl: k,
|
|
802
|
+
rowEl: L,
|
|
803
|
+
fieldEl: he,
|
|
804
|
+
field: G
|
|
805
|
+
}, Ne({
|
|
806
806
|
row: H,
|
|
807
|
-
column:
|
|
808
|
-
},
|
|
807
|
+
column: te
|
|
808
|
+
}, l, he || ((x = v == null ? void 0 : v.closest) == null ? void 0 : x.call(v, "[field]")))) : ye({
|
|
809
809
|
row: H,
|
|
810
|
-
column:
|
|
811
|
-
},
|
|
810
|
+
column: te
|
|
811
|
+
}, l, he || ((w = v == null ? void 0 : v.closest) == null ? void 0 : w.call(v, "[field]")));
|
|
812
812
|
} catch {
|
|
813
813
|
}
|
|
814
814
|
}, dt = () => {
|
|
815
815
|
var n;
|
|
816
|
-
((n = i.editConfig) == null ? void 0 : n.trigger) === "contenteditable" && (
|
|
817
|
-
var
|
|
816
|
+
((n = i.editConfig) == null ? void 0 : n.trigger) === "contenteditable" && (fe && clearTimeout(fe), fe = setTimeout(() => {
|
|
817
|
+
var l, s, g, d, h, x, w, m, v, k, L, R, F, H;
|
|
818
818
|
try {
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
821
|
-
const
|
|
822
|
-
let
|
|
823
|
-
|
|
824
|
-
const
|
|
825
|
-
if (!
|
|
826
|
-
const
|
|
827
|
-
if (!
|
|
828
|
-
if (
|
|
829
|
-
let ae =
|
|
830
|
-
!ae &&
|
|
819
|
+
const te = document.getSelection();
|
|
820
|
+
if (te.rangeCount === 0) return;
|
|
821
|
+
const he = te.getRangeAt(0);
|
|
822
|
+
let G = he.startContainer;
|
|
823
|
+
G.nodeType === 3 && (G = G.parentElement);
|
|
824
|
+
const pe = (l = G == null ? void 0 : G.closest) == null ? void 0 : l.call(G, ".virtual-table-cell"), Me = (s = G == null ? void 0 : G.closest) == null ? void 0 : s.call(G, ".virtual-table-row");
|
|
825
|
+
if (!pe || !Me) return;
|
|
826
|
+
const nt = Me.getAttribute("data-id"), it = pe.getAttribute("data-prop"), Se = Ce(nt), _e = $e.value.find((ae) => `${ae.prop}` == `${it}`) || {};
|
|
827
|
+
if (!U || ((g = U.row) == null ? void 0 : g[i.rowConfig.keyField]) !== (Se == null ? void 0 : Se[i.rowConfig.keyField]) || ((d = U.column) == null ? void 0 : d.prop) !== (_e == null ? void 0 : _e.prop)) {
|
|
828
|
+
if (U) {
|
|
829
|
+
let ae = U.fieldEl;
|
|
830
|
+
!ae && U.field && (ae = (x = (h = U.cellEl) == null ? void 0 : h.querySelector) == null ? void 0 : x.call(h, `[field="${U.field}"]`)), ae || (ae = ((m = (w = U.cellEl) == null ? void 0 : w.querySelector) == null ? void 0 : m.call(w, "[field]")) || U.cellEl), ye(U, {
|
|
831
831
|
target: ae
|
|
832
832
|
}, ae);
|
|
833
833
|
}
|
|
834
|
-
|
|
834
|
+
U = {
|
|
835
835
|
row: Se,
|
|
836
|
-
column:
|
|
837
|
-
cellEl:
|
|
838
|
-
rowEl:
|
|
839
|
-
fieldEl: ((
|
|
840
|
-
field: ((
|
|
841
|
-
},
|
|
836
|
+
column: _e,
|
|
837
|
+
cellEl: pe,
|
|
838
|
+
rowEl: Me,
|
|
839
|
+
fieldEl: ((v = G == null ? void 0 : G.closest) == null ? void 0 : v.call(G, "[field]")) || null,
|
|
840
|
+
field: ((R = (L = ((k = G == null ? void 0 : G.closest) == null ? void 0 : k.call(G, "[field]")) || null) == null ? void 0 : L.getAttribute) == null ? void 0 : R.call(L, "field")) || void 0
|
|
841
|
+
}, Ne({
|
|
842
842
|
row: Se,
|
|
843
|
-
column:
|
|
843
|
+
column: _e
|
|
844
844
|
}, {
|
|
845
|
-
target:
|
|
846
|
-
},
|
|
845
|
+
target: pe
|
|
846
|
+
}, pe);
|
|
847
847
|
}
|
|
848
|
-
if (
|
|
849
|
-
const ae =
|
|
848
|
+
if (te.toString()) {
|
|
849
|
+
const ae = he.endContainer.nodeType === 3 ? he.endContainer.parentElement : he.endContainer, Ge = (F = ae == null ? void 0 : ae.closest) == null ? void 0 : F.call(ae, ".virtual-table-cell"), Je = (H = ae == null ? void 0 : ae.closest) == null ? void 0 : H.call(ae, ".virtual-table-row");
|
|
850
850
|
}
|
|
851
851
|
} catch {
|
|
852
852
|
}
|
|
@@ -854,27 +854,27 @@ const ii = /* @__PURE__ */ un({
|
|
|
854
854
|
}, ut = () => {
|
|
855
855
|
var n;
|
|
856
856
|
((n = i.editConfig) == null ? void 0 : n.trigger) === "contenteditable" && setTimeout(() => {
|
|
857
|
-
var
|
|
858
|
-
const
|
|
859
|
-
if (!
|
|
860
|
-
const s =
|
|
857
|
+
var g, d, h, x;
|
|
858
|
+
const l = document.getSelection();
|
|
859
|
+
if (!l) return;
|
|
860
|
+
const s = l.toString();
|
|
861
861
|
if (s) {
|
|
862
|
-
const
|
|
863
|
-
let
|
|
862
|
+
const w = l.rangeCount > 0 ? l.getRangeAt(0) : null;
|
|
863
|
+
let m = null, v = null;
|
|
864
864
|
try {
|
|
865
|
-
if (
|
|
866
|
-
let
|
|
867
|
-
(
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
rowId:
|
|
871
|
-
prop:
|
|
865
|
+
if (w) {
|
|
866
|
+
let k = w.startContainer;
|
|
867
|
+
(k == null ? void 0 : k.nodeType) === 3 && (k = k.parentElement);
|
|
868
|
+
const L = (g = k == null ? void 0 : k.closest) == null ? void 0 : g.call(k, ".virtual-table-cell"), R = (d = k == null ? void 0 : k.closest) == null ? void 0 : d.call(k, ".virtual-table-row");
|
|
869
|
+
m = L && R ? {
|
|
870
|
+
rowId: R.getAttribute("data-id"),
|
|
871
|
+
prop: L.getAttribute("data-prop")
|
|
872
872
|
} : null;
|
|
873
|
-
let F =
|
|
873
|
+
let F = w.endContainer;
|
|
874
874
|
(F == null ? void 0 : F.nodeType) === 3 && (F = F.parentElement);
|
|
875
|
-
const H = (
|
|
876
|
-
|
|
877
|
-
rowId:
|
|
875
|
+
const H = (h = F == null ? void 0 : F.closest) == null ? void 0 : h.call(F, ".virtual-table-cell"), te = (x = F == null ? void 0 : F.closest) == null ? void 0 : x.call(F, ".virtual-table-row");
|
|
876
|
+
v = H && te ? {
|
|
877
|
+
rowId: te.getAttribute("data-id"),
|
|
878
878
|
prop: H.getAttribute("data-prop")
|
|
879
879
|
} : null;
|
|
880
880
|
}
|
|
@@ -882,160 +882,160 @@ const ii = /* @__PURE__ */ un({
|
|
|
882
882
|
}
|
|
883
883
|
e("selection-change", {
|
|
884
884
|
text: s,
|
|
885
|
-
selection:
|
|
886
|
-
range:
|
|
887
|
-
start:
|
|
888
|
-
end:
|
|
885
|
+
selection: l,
|
|
886
|
+
range: w,
|
|
887
|
+
start: m,
|
|
888
|
+
end: v
|
|
889
889
|
});
|
|
890
890
|
}
|
|
891
891
|
}, 10);
|
|
892
|
-
}, Vt = (n) => (n == null ? void 0 : n._editing) === !0, jt = (n) => n != null && n.parent_id ?
|
|
892
|
+
}, Vt = (n) => (n == null ? void 0 : n._editing) === !0, jt = (n) => n != null && n.parent_id ? Z.get(n.parent_id) : null, Kt = (n) => {
|
|
893
893
|
var s;
|
|
894
|
-
const
|
|
895
|
-
return
|
|
894
|
+
const l = A.value.findIndex((g) => g[i.rowConfig.keyField] == n[i.rowConfig.keyField]);
|
|
895
|
+
return l < 1 ? null : ((s = A.value[l - 1]) == null ? void 0 : s.layer) === n.layer ? A.value[l - 1] : null;
|
|
896
896
|
}, qt = (n) => {
|
|
897
|
-
const
|
|
898
|
-
return
|
|
899
|
-
},
|
|
897
|
+
const l = A.value.findIndex((s) => s[i.rowConfig.keyField] == n[i.rowConfig.keyField]);
|
|
898
|
+
return l >= A.value.length - 1 ? null : A.value[l + 1];
|
|
899
|
+
}, Ce = (n) => {
|
|
900
900
|
if (!n) return null;
|
|
901
|
-
let
|
|
902
|
-
return
|
|
901
|
+
let l = N.get(n);
|
|
902
|
+
return l || (typeof n == "number" ? N.get(`${n}`) : typeof n == "string" && /^\d+$/.test(n) ? N.get(Number(n)) : null);
|
|
903
903
|
};
|
|
904
|
-
let
|
|
904
|
+
let je = null;
|
|
905
905
|
const Wt = (n) => {
|
|
906
|
-
|
|
907
|
-
var
|
|
908
|
-
const
|
|
906
|
+
je && cancelAnimationFrame(je), je = requestAnimationFrame(() => {
|
|
907
|
+
var g;
|
|
908
|
+
const l = i.rowConfig.keyField, s = n[l];
|
|
909
909
|
if (i.pageConfig.enabled) {
|
|
910
|
-
let
|
|
911
|
-
for (let
|
|
912
|
-
if (q.value[
|
|
913
|
-
|
|
910
|
+
let d = -1;
|
|
911
|
+
for (let h = 0; h < q.value.length; h++)
|
|
912
|
+
if (q.value[h].items.some((m) => m[l] === s)) {
|
|
913
|
+
d = h;
|
|
914
914
|
break;
|
|
915
915
|
}
|
|
916
|
-
if (
|
|
917
|
-
for (let
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
if (!
|
|
922
|
-
const
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
let
|
|
926
|
-
for (;
|
|
927
|
-
|
|
928
|
-
const
|
|
929
|
-
let
|
|
930
|
-
|
|
931
|
-
const F =
|
|
932
|
-
const
|
|
933
|
-
const mt =
|
|
934
|
-
|
|
935
|
-
|
|
916
|
+
if (d !== -1) {
|
|
917
|
+
for (let h = Math.max(0, d - 1); h <= Math.min(q.value.length - 1, d + 1); h++)
|
|
918
|
+
ee.value.has(h) || ee.value.add(h);
|
|
919
|
+
xe(() => {
|
|
920
|
+
const h = document.querySelector(".a4-pages-container");
|
|
921
|
+
if (!h) return;
|
|
922
|
+
const x = (w = 0) => {
|
|
923
|
+
const m = h.querySelector(`[data-id="${s}"]`);
|
|
924
|
+
if (m) {
|
|
925
|
+
let v = 0, k = m;
|
|
926
|
+
for (; k && k !== h; )
|
|
927
|
+
v += k.offsetTop, k = k.offsetParent;
|
|
928
|
+
const L = h.clientHeight;
|
|
929
|
+
let R = v - L * 0.3;
|
|
930
|
+
R = Math.max(0, R);
|
|
931
|
+
const F = h.scrollTop, H = Math.abs(R - F), te = (he) => {
|
|
932
|
+
const G = h.scrollTop, pe = he - G, Me = Math.min(800, Math.max(300, H * 0.5)), nt = performance.now(), it = (_e) => _e < 0.5 ? 4 * _e * _e * _e : 1 - Math.pow(-2 * _e + 2, 3) / 2, Se = (_e) => {
|
|
933
|
+
const mt = _e - nt, ae = Math.min(mt / Me, 1), Ge = it(ae), Je = G + pe * Ge;
|
|
934
|
+
h.scrollTop = Je, ae < 1 ? requestAnimationFrame(Se) : setTimeout(() => {
|
|
935
|
+
h.scrollTop = he;
|
|
936
936
|
}, 50);
|
|
937
937
|
};
|
|
938
938
|
requestAnimationFrame(Se);
|
|
939
939
|
};
|
|
940
|
-
H > 3e3 ?
|
|
941
|
-
top:
|
|
940
|
+
H > 3e3 ? h.scrollTo({
|
|
941
|
+
top: R,
|
|
942
942
|
behavior: "instant"
|
|
943
|
-
}) :
|
|
944
|
-
|
|
943
|
+
}) : te(R), m.classList.add("row--highlight"), setTimeout(() => {
|
|
944
|
+
m.classList.remove("row--highlight");
|
|
945
945
|
}, 1500);
|
|
946
|
-
} else
|
|
946
|
+
} else w < 10 && setTimeout(() => x(w + 1), 150);
|
|
947
947
|
};
|
|
948
|
-
setTimeout(
|
|
948
|
+
setTimeout(x, 200);
|
|
949
949
|
});
|
|
950
950
|
}
|
|
951
951
|
} else {
|
|
952
|
-
const
|
|
953
|
-
|
|
952
|
+
const d = A.value.findIndex((h) => h[l] === s);
|
|
953
|
+
d !== -1 && ((g = u.value) != null && g.scrollToItem) && u.value.scrollToItem(d);
|
|
954
954
|
}
|
|
955
|
-
|
|
955
|
+
je = null;
|
|
956
956
|
});
|
|
957
|
-
},
|
|
957
|
+
}, Ke = (n) => {
|
|
958
958
|
if (n) {
|
|
959
|
-
if (!
|
|
960
|
-
setTimeout(() =>
|
|
959
|
+
if (!P.value) {
|
|
960
|
+
setTimeout(() => Ke(n), 200);
|
|
961
961
|
return;
|
|
962
962
|
}
|
|
963
|
-
|
|
964
|
-
|
|
963
|
+
z.value = n, z.value !== S.value && S.value && (S.value._editing = !1, setTimeout(() => {
|
|
964
|
+
S.value = null;
|
|
965
965
|
}, 200));
|
|
966
966
|
}
|
|
967
|
-
}, Oe = (n,
|
|
968
|
-
var
|
|
969
|
-
if (!((
|
|
967
|
+
}, Oe = (n, l) => new Promise((s) => {
|
|
968
|
+
var g, d;
|
|
969
|
+
if (!((g = i == null ? void 0 : i.editConfig) != null && g.beforeEditMethod && typeof ((d = i == null ? void 0 : i.editConfig) == null ? void 0 : d.beforeEditMethod) == "function" && !i.editConfig.beforeEditMethod({
|
|
970
970
|
row: n
|
|
971
971
|
}))) {
|
|
972
|
-
if (!n || !
|
|
972
|
+
if (!n || !P.value) {
|
|
973
973
|
setTimeout(() => Oe(n), 200);
|
|
974
974
|
return;
|
|
975
975
|
}
|
|
976
|
-
n !==
|
|
977
|
-
|
|
978
|
-
row:
|
|
976
|
+
n !== S.value && (A.value.forEach((h) => {
|
|
977
|
+
h._editing && e("edit-closed", {
|
|
978
|
+
row: h,
|
|
979
979
|
column: {
|
|
980
|
-
field:
|
|
980
|
+
field: l
|
|
981
981
|
},
|
|
982
982
|
$table: o == null ? void 0 : o.exposed
|
|
983
|
-
}),
|
|
983
|
+
}), h._editing = !1;
|
|
984
984
|
}), n._editing = !0, setTimeout(() => {
|
|
985
|
-
|
|
985
|
+
S.value = n, e("edit-activated", {
|
|
986
986
|
row: n,
|
|
987
987
|
column: {
|
|
988
|
-
field:
|
|
988
|
+
field: l
|
|
989
989
|
},
|
|
990
990
|
$table: o == null ? void 0 : o.exposed
|
|
991
991
|
}), s(!0);
|
|
992
992
|
}));
|
|
993
993
|
}
|
|
994
|
-
}), Ut = (n) => Oe(n),
|
|
995
|
-
if (
|
|
996
|
-
const n = Array.from(
|
|
994
|
+
}), Ut = (n) => Oe(n), tt = () => {
|
|
995
|
+
if (O(), i.pageConfig.enabled) {
|
|
996
|
+
const n = Array.from(Q.value);
|
|
997
997
|
if (n.length > 0) {
|
|
998
|
-
const
|
|
999
|
-
for (let s = Math.max(0,
|
|
1000
|
-
|
|
998
|
+
const l = Math.min(...n);
|
|
999
|
+
for (let s = Math.max(0, l - 1); s <= Math.min(q.value.length - 1, l + 2); s++)
|
|
1000
|
+
ee.value.add(s);
|
|
1001
1001
|
} else
|
|
1002
|
-
for (let
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1002
|
+
for (let l = 0; l < Math.min(3, q.value.length); l++)
|
|
1003
|
+
ee.value.add(l);
|
|
1004
|
+
xe(() => {
|
|
1005
|
+
ne();
|
|
1006
1006
|
});
|
|
1007
1007
|
}
|
|
1008
|
-
|
|
1009
|
-
!i.pageConfig.enabled &&
|
|
1008
|
+
xe(() => {
|
|
1009
|
+
!i.pageConfig.enabled && u.value && u.value.$forceUpdate && u.value.$forceUpdate();
|
|
1010
1010
|
});
|
|
1011
|
-
}, Gt = (n,
|
|
1012
|
-
let
|
|
1013
|
-
if (
|
|
1014
|
-
const
|
|
1015
|
-
for (
|
|
1016
|
-
|
|
1011
|
+
}, Gt = (n, l) => new Promise((s) => {
|
|
1012
|
+
let g = -1;
|
|
1013
|
+
if (l == -1) {
|
|
1014
|
+
const d = Ce(n.parent_id);
|
|
1015
|
+
for (g = A.value.findIndex((h) => h[i.rowConfig.keyField] == d[i.rowConfig.keyField]) + 1; A.value[g].parent_id == d[i.rowConfig.keyField]; )
|
|
1016
|
+
g += 1;
|
|
1017
1017
|
} else
|
|
1018
|
-
|
|
1019
|
-
|
|
1018
|
+
g = A.value.findIndex((d) => d[i.rowConfig.keyField] == l[i.rowConfig.keyField]);
|
|
1019
|
+
Z.set(n.node_id, n), N.set(n[i.rowConfig.keyField], n), A.value.splice(g, 0, n), tt(), s({
|
|
1020
1020
|
row: n
|
|
1021
1021
|
});
|
|
1022
|
-
}), Jt = (n,
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1022
|
+
}), Jt = (n, l) => new Promise((s) => {
|
|
1023
|
+
const g = A.value.findIndex((d) => d[i.rowConfig.keyField] == l[i.rowConfig.keyField]) + 1;
|
|
1024
|
+
Z.set(n.node_id, n), N.set(n[i.rowConfig.keyField], n), A.value.splice(g, 0, n), tt(), s({
|
|
1025
1025
|
row: n
|
|
1026
1026
|
});
|
|
1027
1027
|
}), ht = (n) => {
|
|
1028
|
-
const
|
|
1029
|
-
if (
|
|
1028
|
+
const l = A.value.findIndex((s) => s[i.rowConfig.keyField] == n[i.rowConfig.keyField] || s === n);
|
|
1029
|
+
if (l > -1) {
|
|
1030
1030
|
const s = n[i.rowConfig.keyField];
|
|
1031
|
-
|
|
1031
|
+
Z.delete(n.node_id), N.delete(s), A.value.splice(l, 1), tt();
|
|
1032
1032
|
}
|
|
1033
|
-
}, Xt = (n,
|
|
1033
|
+
}, Xt = (n, l) => {
|
|
1034
1034
|
if (!n || !n[i.rowConfig.keyField]) return !1;
|
|
1035
1035
|
const s = n._original;
|
|
1036
|
-
return s ?
|
|
1037
|
-
}, Yt = (n) => n && n[i.rowConfig.keyField] && !n._original, Zt = (n,
|
|
1038
|
-
n && n[i.rowConfig.keyField] && (
|
|
1036
|
+
return s ? l ? n[l] !== s[l] : Object.keys(s).some((g) => s[g] !== n[g]) : !1;
|
|
1037
|
+
}, Yt = (n) => n && n[i.rowConfig.keyField] && !n._original, Zt = (n, l) => {
|
|
1038
|
+
n && n[i.rowConfig.keyField] && (l && Object.assign(n, l), n._original = {
|
|
1039
1039
|
...n,
|
|
1040
1040
|
_editing: void 0,
|
|
1041
1041
|
_X_ROW_CHILD: void 0,
|
|
@@ -1043,37 +1043,37 @@ const ii = /* @__PURE__ */ un({
|
|
|
1043
1043
|
});
|
|
1044
1044
|
}, Qt = (n) => {
|
|
1045
1045
|
if (n && n[i.rowConfig.keyField]) {
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1046
|
+
const l = Ce(n[i.rowConfig.keyField]);
|
|
1047
|
+
l._original ? Object.assign(l, l._original) : ht(l);
|
|
1048
1048
|
}
|
|
1049
1049
|
}, en = () => {
|
|
1050
1050
|
}, tn = () => {
|
|
1051
|
-
|
|
1051
|
+
z.value = {};
|
|
1052
1052
|
}, ft = (n) => {
|
|
1053
|
-
var s,
|
|
1054
|
-
let
|
|
1055
|
-
if (
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1058
|
-
for (let
|
|
1059
|
-
const
|
|
1060
|
-
if (
|
|
1061
|
-
|
|
1053
|
+
var s, g, d;
|
|
1054
|
+
let l = A.value.findIndex((h) => h[i.rowConfig.keyField] == n[i.rowConfig.keyField]);
|
|
1055
|
+
if (l > -1 && i.treeConfig) {
|
|
1056
|
+
const h = ((s = i.treeConfig) == null ? void 0 : s.keyField) || ((g = i.treeConfig) == null ? void 0 : g.rowField) || "node_id", x = ((d = i.treeConfig) == null ? void 0 : d.parentField) || "parent_id", w = [], m = /* @__PURE__ */ new Map();
|
|
1057
|
+
m.set(n[h], !0);
|
|
1058
|
+
for (let v = l + 1; v < A.value.length; v++) {
|
|
1059
|
+
const k = A.value[v];
|
|
1060
|
+
if (k && m.has(k[x]))
|
|
1061
|
+
w.push(k), m.set(k[h]);
|
|
1062
1062
|
else
|
|
1063
1063
|
break;
|
|
1064
1064
|
}
|
|
1065
|
-
return
|
|
1065
|
+
return w;
|
|
1066
1066
|
}
|
|
1067
1067
|
return [];
|
|
1068
1068
|
};
|
|
1069
|
-
|
|
1069
|
+
a({
|
|
1070
1070
|
isEditByRow: Vt,
|
|
1071
1071
|
getParentRow: jt,
|
|
1072
1072
|
getSiblingRow: Kt,
|
|
1073
1073
|
getNextRow: qt,
|
|
1074
|
-
getRowById:
|
|
1074
|
+
getRowById: Ce,
|
|
1075
1075
|
scrollToRow: Wt,
|
|
1076
|
-
setCurrentRow:
|
|
1076
|
+
setCurrentRow: Ke,
|
|
1077
1077
|
setEditRow: Oe,
|
|
1078
1078
|
setEditCell: Ut,
|
|
1079
1079
|
insertAt: Gt,
|
|
@@ -1087,18 +1087,18 @@ const ii = /* @__PURE__ */ un({
|
|
|
1087
1087
|
clearCurrentRow: tn,
|
|
1088
1088
|
getAllChilds: ft
|
|
1089
1089
|
});
|
|
1090
|
-
const
|
|
1091
|
-
var
|
|
1092
|
-
return ((
|
|
1090
|
+
const $e = ke(() => t.default().filter((n) => {
|
|
1091
|
+
var l;
|
|
1092
|
+
return ((l = n.type) == null ? void 0 : l.name) === "VirtualTableColumn";
|
|
1093
1093
|
}).map((n) => {
|
|
1094
|
-
var
|
|
1094
|
+
var l, s, g;
|
|
1095
1095
|
return {
|
|
1096
|
-
prop: (
|
|
1096
|
+
prop: (l = n.props) == null ? void 0 : l.prop,
|
|
1097
1097
|
title: (s = n.props) == null ? void 0 : s.title,
|
|
1098
|
-
width: (
|
|
1098
|
+
width: (g = n.props) == null ? void 0 : g.width,
|
|
1099
1099
|
slots: n.children
|
|
1100
1100
|
};
|
|
1101
|
-
})),
|
|
1101
|
+
})), qe = (n) => {
|
|
1102
1102
|
try {
|
|
1103
1103
|
return n === 0 ? {
|
|
1104
1104
|
width: "0px"
|
|
@@ -1107,154 +1107,154 @@ const ii = /* @__PURE__ */ un({
|
|
|
1107
1107
|
} : {
|
|
1108
1108
|
flex: "1 1 100%"
|
|
1109
1109
|
};
|
|
1110
|
-
} catch (
|
|
1111
|
-
return console.warn("[VirtualTable] computeColumnWidth error:",
|
|
1110
|
+
} catch (l) {
|
|
1111
|
+
return console.warn("[VirtualTable] computeColumnWidth error:", l), {
|
|
1112
1112
|
flex: "1 1 100%"
|
|
1113
1113
|
};
|
|
1114
1114
|
}
|
|
1115
1115
|
}, gt = ke(() => {
|
|
1116
1116
|
var n;
|
|
1117
|
-
return (n = i.treeConfig) != null && n.childCurrent &&
|
|
1118
|
-
}), pt =
|
|
1117
|
+
return (n = i.treeConfig) != null && n.childCurrent && z.value ? ft(z.value).map((l) => l[i.rowConfig.keyField]) : [];
|
|
1118
|
+
}), pt = se({
|
|
1119
1119
|
viewStartIndex: 0,
|
|
1120
1120
|
viewEndIndex: 0,
|
|
1121
1121
|
visibleStartIndex: 0,
|
|
1122
1122
|
visibleEndIndex: 0
|
|
1123
1123
|
});
|
|
1124
|
-
let
|
|
1125
|
-
const nn = (n,
|
|
1126
|
-
|
|
1124
|
+
let We = null, Ue = null;
|
|
1125
|
+
const nn = (n, l) => {
|
|
1126
|
+
We && cancelAnimationFrame(We), We = requestAnimationFrame(() => {
|
|
1127
1127
|
e("scroll-end", {
|
|
1128
1128
|
...pt.value
|
|
1129
|
-
}),
|
|
1129
|
+
}), We = null;
|
|
1130
1130
|
});
|
|
1131
|
-
},
|
|
1132
|
-
|
|
1131
|
+
}, ln = (n, l, s, g) => {
|
|
1132
|
+
Ue && cancelAnimationFrame(Ue), Ue = requestAnimationFrame(() => {
|
|
1133
1133
|
pt.value = {
|
|
1134
1134
|
viewStartIndex: n,
|
|
1135
|
-
viewEndIndex:
|
|
1135
|
+
viewEndIndex: l,
|
|
1136
1136
|
visibleStartIndex: s,
|
|
1137
|
-
visibleEndIndex:
|
|
1138
|
-
},
|
|
1137
|
+
visibleEndIndex: g
|
|
1138
|
+
}, Ue = null;
|
|
1139
1139
|
});
|
|
1140
|
-
},
|
|
1141
|
-
var
|
|
1140
|
+
}, an = (n, l) => {
|
|
1141
|
+
var w, m;
|
|
1142
1142
|
const {
|
|
1143
1143
|
pageHeight: s,
|
|
1144
|
-
margin:
|
|
1145
|
-
showPageBorder:
|
|
1146
|
-
pageBorderPadding:
|
|
1147
|
-
pageBorderStyle:
|
|
1144
|
+
margin: g,
|
|
1145
|
+
showPageBorder: d,
|
|
1146
|
+
pageBorderPadding: h,
|
|
1147
|
+
pageBorderStyle: x
|
|
1148
1148
|
} = i.pageConfig;
|
|
1149
|
-
return
|
|
1150
|
-
pageNumber: n.pageNumber ||
|
|
1151
|
-
pageIndex:
|
|
1152
|
-
}) : null,
|
|
1149
|
+
return ee.value.has(l) ? J(Y, null, [i.pageConfig.showPageHeader && t["page-header"] ? (w = t["page-header"]) == null ? void 0 : w.call(t, {
|
|
1150
|
+
pageNumber: n.pageNumber || l + 1,
|
|
1151
|
+
pageIndex: l
|
|
1152
|
+
}) : null, l === 0 && i.showHeader ? J("div", {
|
|
1153
1153
|
class: "a4-table-header"
|
|
1154
|
-
}, [
|
|
1154
|
+
}, [J("div", {
|
|
1155
1155
|
class: "virtual-table-header we-vt-table--header we-vt-table--header-wrapper"
|
|
1156
|
-
}, [
|
|
1157
|
-
var
|
|
1158
|
-
return
|
|
1156
|
+
}, [$e.value.map((v) => {
|
|
1157
|
+
var k, L, R;
|
|
1158
|
+
return J("div", {
|
|
1159
1159
|
class: "we-vt-header--column",
|
|
1160
|
-
key:
|
|
1161
|
-
style:
|
|
1162
|
-
}, [
|
|
1160
|
+
key: v.prop,
|
|
1161
|
+
style: qe(v.width)
|
|
1162
|
+
}, [J("div", {
|
|
1163
1163
|
class: "we-vt-cell"
|
|
1164
|
-
}, [(
|
|
1165
|
-
column:
|
|
1166
|
-
}) :
|
|
1167
|
-
})])]) : null,
|
|
1164
|
+
}, [(k = v.slots) != null && k.header ? (R = (L = v.slots) == null ? void 0 : L.header) == null ? void 0 : R.call(L, {
|
|
1165
|
+
column: v
|
|
1166
|
+
}) : v.title])]);
|
|
1167
|
+
})])]) : null, J("div", {
|
|
1168
1168
|
class: "a4-page-content",
|
|
1169
1169
|
style: {
|
|
1170
|
-
minHeight: `${s -
|
|
1171
|
-
...
|
|
1172
|
-
border:
|
|
1173
|
-
padding: `${
|
|
1170
|
+
minHeight: `${s - g * 2}px`,
|
|
1171
|
+
...d ? {
|
|
1172
|
+
border: x,
|
|
1173
|
+
padding: `${h}px`
|
|
1174
1174
|
} : {}
|
|
1175
1175
|
}
|
|
1176
|
-
}, [n.items.map((
|
|
1177
|
-
var
|
|
1178
|
-
return
|
|
1179
|
-
key:
|
|
1180
|
-
"data-id":
|
|
1176
|
+
}, [n.items.map((v) => {
|
|
1177
|
+
var k, L;
|
|
1178
|
+
return J("div", {
|
|
1179
|
+
key: v[i.rowConfig.keyField],
|
|
1180
|
+
"data-id": v[i.rowConfig.keyField],
|
|
1181
1181
|
class: {
|
|
1182
1182
|
"virtual-table-row": !0,
|
|
1183
1183
|
"we-vt-body--row": !0,
|
|
1184
|
-
"row--current":
|
|
1184
|
+
"row--current": v[i.rowConfig.keyField] === ((k = z.value) == null ? void 0 : k[i.rowConfig.keyField]) || ((L = i.treeConfig) == null ? void 0 : L.childCurrent) && gt.value.includes(v[i.rowConfig.keyField])
|
|
1185
1185
|
},
|
|
1186
1186
|
style: {
|
|
1187
1187
|
width: "100%"
|
|
1188
1188
|
},
|
|
1189
|
-
onClick: () =>
|
|
1190
|
-
onDblclick: () =>
|
|
1191
|
-
}, [
|
|
1192
|
-
var F, H,
|
|
1193
|
-
return
|
|
1194
|
-
key:
|
|
1189
|
+
onClick: () => me(v),
|
|
1190
|
+
onDblclick: () => re(v)
|
|
1191
|
+
}, [$e.value.map((R) => {
|
|
1192
|
+
var F, H, te, he, G, pe, Me;
|
|
1193
|
+
return J("div", {
|
|
1194
|
+
key: R.prop,
|
|
1195
1195
|
class: "virtual-table-cell we-vt-cell",
|
|
1196
|
-
style:
|
|
1197
|
-
"data-prop":
|
|
1198
|
-
}, [
|
|
1199
|
-
row:
|
|
1200
|
-
column:
|
|
1201
|
-
})) : ((
|
|
1202
|
-
row:
|
|
1203
|
-
column:
|
|
1196
|
+
style: qe(R.width),
|
|
1197
|
+
"data-prop": R.prop
|
|
1198
|
+
}, [v._editing && ((F = i.editConfig) == null ? void 0 : F.trigger) === "dblclick" ? ((H = R.slots) == null ? void 0 : H.edit) && ((he = (te = R.slots) == null ? void 0 : te.edit) == null ? void 0 : he.call(te, {
|
|
1199
|
+
row: v,
|
|
1200
|
+
column: R
|
|
1201
|
+
})) : ((G = R.slots) == null ? void 0 : G.default) && ((Me = (pe = R.slots) == null ? void 0 : pe.default) == null ? void 0 : Me.call(pe, {
|
|
1202
|
+
row: v,
|
|
1203
|
+
column: R
|
|
1204
1204
|
}))]);
|
|
1205
1205
|
})]);
|
|
1206
|
-
})]), t["page-footer"] ? (
|
|
1207
|
-
pageNumber: n.pageNumber ||
|
|
1208
|
-
pageIndex:
|
|
1209
|
-
}) :
|
|
1206
|
+
})]), t["page-footer"] ? (m = t["page-footer"]) == null ? void 0 : m.call(t, {
|
|
1207
|
+
pageNumber: n.pageNumber || l + 1,
|
|
1208
|
+
pageIndex: l
|
|
1209
|
+
}) : J("div", {
|
|
1210
1210
|
class: "a4-page-footer",
|
|
1211
1211
|
contenteditable: "false"
|
|
1212
|
-
}, [
|
|
1212
|
+
}, [J("span", {
|
|
1213
1213
|
class: "page-number",
|
|
1214
1214
|
contenteditable: "false"
|
|
1215
|
-
}, [n.pageNumber ||
|
|
1215
|
+
}, [n.pageNumber || l + 1, Le(" / "), q.value.length])])]) : J("div", {
|
|
1216
1216
|
class: "a4-page-loading"
|
|
1217
|
-
}, [
|
|
1217
|
+
}, [J("div", {
|
|
1218
1218
|
class: "loading-spinner"
|
|
1219
|
-
}, null),
|
|
1219
|
+
}, null), J("div", {
|
|
1220
1220
|
class: "loading-text"
|
|
1221
|
-
}, [
|
|
1221
|
+
}, [Le("加载中...")])]);
|
|
1222
1222
|
}, on = () => {
|
|
1223
|
-
var
|
|
1223
|
+
var x;
|
|
1224
1224
|
const {
|
|
1225
1225
|
pageHeight: n,
|
|
1226
|
-
pageWidth:
|
|
1226
|
+
pageWidth: l,
|
|
1227
1227
|
margin: s,
|
|
1228
|
-
gap:
|
|
1229
|
-
showPageBorder:
|
|
1230
|
-
pageBorderPadding:
|
|
1228
|
+
gap: g,
|
|
1229
|
+
showPageBorder: d,
|
|
1230
|
+
pageBorderPadding: h
|
|
1231
1231
|
} = i.pageConfig;
|
|
1232
|
-
return
|
|
1232
|
+
return J("div", {
|
|
1233
1233
|
class: "virtual-table we-vt-table we-vt-table--render-default border--none"
|
|
1234
|
-
}, [
|
|
1234
|
+
}, [J("div", {
|
|
1235
1235
|
class: "a4-pages-container",
|
|
1236
|
-
contenteditable: ((
|
|
1236
|
+
contenteditable: ((x = i.editConfig) == null ? void 0 : x.trigger) === "contenteditable" ? "true" : void 0,
|
|
1237
1237
|
onContextmenu: M,
|
|
1238
|
-
onFocusin:
|
|
1239
|
-
onFocusout:
|
|
1240
|
-
}, [q.value.map((
|
|
1241
|
-
const
|
|
1242
|
-
return
|
|
1243
|
-
key: `page-${
|
|
1244
|
-
class:
|
|
1245
|
-
"data-page-index":
|
|
1238
|
+
onFocusin: Re,
|
|
1239
|
+
onFocusout: Pe
|
|
1240
|
+
}, [q.value.map((w, m) => {
|
|
1241
|
+
const v = ee.value.has(m);
|
|
1242
|
+
return J("div", {
|
|
1243
|
+
key: `page-${m}`,
|
|
1244
|
+
class: v ? "a4-page" : "a4-page-placeholder",
|
|
1245
|
+
"data-page-index": m,
|
|
1246
1246
|
style: {
|
|
1247
|
-
width: `${
|
|
1247
|
+
width: `${l}px`,
|
|
1248
1248
|
// 不设置minHeight,让内容自然决定高度
|
|
1249
|
-
marginBottom: `${
|
|
1250
|
-
padding:
|
|
1249
|
+
marginBottom: `${g}px`,
|
|
1250
|
+
padding: v ? `${d ? s - h : s}px` : "0",
|
|
1251
1251
|
boxSizing: "border-box",
|
|
1252
1252
|
// 使用relative定位,确保内部元素定位正确
|
|
1253
1253
|
position: "relative",
|
|
1254
1254
|
// 确保内容能够正常撑开
|
|
1255
1255
|
overflow: "visible"
|
|
1256
1256
|
}
|
|
1257
|
-
}, [
|
|
1257
|
+
}, [J("div", {
|
|
1258
1258
|
style: {
|
|
1259
1259
|
position: "absolute",
|
|
1260
1260
|
top: 0,
|
|
@@ -1264,31 +1264,31 @@ const ii = /* @__PURE__ */ un({
|
|
|
1264
1264
|
visibility: "hidden",
|
|
1265
1265
|
pointerEvents: "none"
|
|
1266
1266
|
}
|
|
1267
|
-
}, null),
|
|
1267
|
+
}, null), an(w, m)]);
|
|
1268
1268
|
})])]);
|
|
1269
1269
|
}, sn = () => {
|
|
1270
1270
|
var n;
|
|
1271
|
-
return
|
|
1271
|
+
return J("div", {
|
|
1272
1272
|
class: "virtual-table we-vt-table we-vt-table--render-default border--none"
|
|
1273
|
-
}, [i.showHeader ?
|
|
1273
|
+
}, [i.showHeader ? J("div", {
|
|
1274
1274
|
class: "virtual-table-header we-vt-table--header we-vt-table--header-wrapper"
|
|
1275
|
-
}, [
|
|
1276
|
-
var s,
|
|
1277
|
-
return
|
|
1275
|
+
}, [$e.value.map((l) => {
|
|
1276
|
+
var s, g, d;
|
|
1277
|
+
return J("div", {
|
|
1278
1278
|
class: "we-vt-header--column",
|
|
1279
|
-
key:
|
|
1280
|
-
style:
|
|
1281
|
-
}, [
|
|
1279
|
+
key: l.prop,
|
|
1280
|
+
style: qe(l.width)
|
|
1281
|
+
}, [J("div", {
|
|
1282
1282
|
class: "we-vt-cell"
|
|
1283
|
-
}, [(s =
|
|
1284
|
-
column:
|
|
1285
|
-
}) :
|
|
1283
|
+
}, [(s = l.slots) != null && s.header ? (d = (g = l.slots) == null ? void 0 : g.header) == null ? void 0 : d.call(g, {
|
|
1284
|
+
column: l
|
|
1285
|
+
}) : l.title]), J("div", {
|
|
1286
1286
|
class: "we-vt-resizable is--line"
|
|
1287
1287
|
}, null)]);
|
|
1288
|
-
})]) : void 0,
|
|
1289
|
-
ref:
|
|
1290
|
-
items:
|
|
1291
|
-
minItemSize:
|
|
1288
|
+
})]) : void 0, J(yn, {
|
|
1289
|
+
ref: u,
|
|
1290
|
+
items: _.value,
|
|
1291
|
+
minItemSize: D.value,
|
|
1292
1292
|
keyField: i.rowConfig.keyField,
|
|
1293
1293
|
emitUpdate: !1,
|
|
1294
1294
|
buffer: 300,
|
|
@@ -1296,59 +1296,59 @@ const ii = /* @__PURE__ */ un({
|
|
|
1296
1296
|
contenteditable: ((n = i.editConfig) == null ? void 0 : n.trigger) === "contenteditable" ? "true" : void 0,
|
|
1297
1297
|
onContextmenu: M,
|
|
1298
1298
|
onScrollend: nn,
|
|
1299
|
-
onUpdate:
|
|
1300
|
-
onFocusin:
|
|
1301
|
-
onFocusout:
|
|
1299
|
+
onUpdate: ln,
|
|
1300
|
+
onFocusin: Re,
|
|
1301
|
+
onFocusout: Pe
|
|
1302
1302
|
}, {
|
|
1303
1303
|
default: ({
|
|
1304
|
-
item:
|
|
1304
|
+
item: l,
|
|
1305
1305
|
index: s,
|
|
1306
|
-
active:
|
|
1306
|
+
active: g
|
|
1307
1307
|
}) => {
|
|
1308
|
-
var
|
|
1309
|
-
let
|
|
1310
|
-
return
|
|
1311
|
-
key:
|
|
1312
|
-
item:
|
|
1313
|
-
active:
|
|
1314
|
-
sizeDependencies: [(
|
|
1315
|
-
"data-id":
|
|
1308
|
+
var h, x, w;
|
|
1309
|
+
let d;
|
|
1310
|
+
return J(_n, {
|
|
1311
|
+
key: l[i.rowConfig.keyField],
|
|
1312
|
+
item: l,
|
|
1313
|
+
active: g,
|
|
1314
|
+
sizeDependencies: [(h = l.content) == null ? void 0 : h.length, l._editing, l.content_type],
|
|
1315
|
+
"data-id": l[i.rowConfig.keyField],
|
|
1316
1316
|
"data-index": s,
|
|
1317
|
-
"data-active":
|
|
1317
|
+
"data-active": g,
|
|
1318
1318
|
class: {
|
|
1319
1319
|
"virtual-table-row": !0,
|
|
1320
1320
|
"we-vt-body--row": !0,
|
|
1321
|
-
"row--current":
|
|
1322
|
-
((
|
|
1321
|
+
"row--current": l[i.rowConfig.keyField] === ((x = z.value) == null ? void 0 : x[i.rowConfig.keyField]) || // 如果是树,并且配置了childCurrent高亮子节点
|
|
1322
|
+
((w = i.treeConfig) == null ? void 0 : w.childCurrent) && gt.value.includes(l[i.rowConfig.keyField])
|
|
1323
1323
|
}
|
|
1324
|
-
}, ni(
|
|
1325
|
-
var
|
|
1326
|
-
return
|
|
1327
|
-
key:
|
|
1324
|
+
}, ni(d = $e.value.map((m) => {
|
|
1325
|
+
var v, k, L, R, F, H, te;
|
|
1326
|
+
return J("div", {
|
|
1327
|
+
key: m.prop,
|
|
1328
1328
|
class: "virtual-table-cell we-vt-cell",
|
|
1329
|
-
style:
|
|
1330
|
-
"data-prop":
|
|
1331
|
-
}, [
|
|
1332
|
-
row:
|
|
1333
|
-
column:
|
|
1334
|
-
})) : ((F =
|
|
1335
|
-
row:
|
|
1336
|
-
column:
|
|
1329
|
+
style: qe(m.width),
|
|
1330
|
+
"data-prop": m.prop
|
|
1331
|
+
}, [l._editing && ((v = i.editConfig) == null ? void 0 : v.trigger) === "dblclick" ? ((k = m.slots) == null ? void 0 : k.edit) && ((R = (L = m.slots) == null ? void 0 : L.edit) == null ? void 0 : R.call(L, {
|
|
1332
|
+
row: l,
|
|
1333
|
+
column: m
|
|
1334
|
+
})) : ((F = m.slots) == null ? void 0 : F.default) && ((te = (H = m.slots) == null ? void 0 : H.default) == null ? void 0 : te.call(H, {
|
|
1335
|
+
row: l,
|
|
1336
|
+
column: m
|
|
1337
1337
|
}))]);
|
|
1338
|
-
})) ?
|
|
1339
|
-
default: () => [
|
|
1338
|
+
})) ? d : {
|
|
1339
|
+
default: () => [d]
|
|
1340
1340
|
});
|
|
1341
1341
|
}
|
|
1342
1342
|
})]);
|
|
1343
1343
|
};
|
|
1344
1344
|
return () => i.pageConfig.enabled ? on() : sn();
|
|
1345
1345
|
}
|
|
1346
|
-
}),
|
|
1346
|
+
}), ze = (i, e) => {
|
|
1347
1347
|
const t = i.__vccOpts || i;
|
|
1348
|
-
for (const [
|
|
1349
|
-
t[
|
|
1348
|
+
for (const [a, o] of e)
|
|
1349
|
+
t[a] = o;
|
|
1350
1350
|
return t;
|
|
1351
|
-
},
|
|
1351
|
+
}, li = /* @__PURE__ */ ze(ii, [["__scopeId", "data-v-274d8f6d"]]), ai = {
|
|
1352
1352
|
name: "VirtualTableColumn",
|
|
1353
1353
|
props: {
|
|
1354
1354
|
prop: String,
|
|
@@ -1356,10 +1356,10 @@ const ii = /* @__PURE__ */ un({
|
|
|
1356
1356
|
width: [String, Number]
|
|
1357
1357
|
}
|
|
1358
1358
|
};
|
|
1359
|
-
function oi(i, e, t,
|
|
1359
|
+
function oi(i, e, t, a, o, u) {
|
|
1360
1360
|
return gn(i.$slots, "default");
|
|
1361
1361
|
}
|
|
1362
|
-
const si = /* @__PURE__ */
|
|
1362
|
+
const si = /* @__PURE__ */ ze(ai, [["render", oi]]), ri = { class: "catalog-node" }, ci = ["title"], di = { class: "catalog-node__text" }, ui = {
|
|
1363
1363
|
key: 0,
|
|
1364
1364
|
class: "catalog-node__children"
|
|
1365
1365
|
}, hi = {
|
|
@@ -1371,43 +1371,43 @@ const si = /* @__PURE__ */ De(li, [["render", oi]]), ri = { class: "catalog-node
|
|
|
1371
1371
|
},
|
|
1372
1372
|
emits: ["navigate"],
|
|
1373
1373
|
setup(i, { emit: e }) {
|
|
1374
|
-
const t = i,
|
|
1375
|
-
function
|
|
1376
|
-
|
|
1374
|
+
const t = i, a = e, o = se(!0), u = ke(() => t.item.children && t.item.children.length > 0);
|
|
1375
|
+
function P(S) {
|
|
1376
|
+
S.stopPropagation(), o.value = !o.value;
|
|
1377
1377
|
}
|
|
1378
|
-
return (
|
|
1379
|
-
const
|
|
1380
|
-
return
|
|
1381
|
-
|
|
1382
|
-
class:
|
|
1383
|
-
style:
|
|
1378
|
+
return (S, z) => {
|
|
1379
|
+
const A = pn("CatalogNode", !0);
|
|
1380
|
+
return f(), p("div", ri, [
|
|
1381
|
+
ce("div", {
|
|
1382
|
+
class: Ee(["catalog-node__label", { "is-active": i.activeId === i.item.nodeId }]),
|
|
1383
|
+
style: j({ paddingLeft: 10 + i.depth * 14 + "px" }),
|
|
1384
1384
|
title: i.item.name,
|
|
1385
|
-
onClick:
|
|
1385
|
+
onClick: z[0] || (z[0] = (Z) => a("navigate", i.item))
|
|
1386
1386
|
}, [
|
|
1387
|
-
|
|
1387
|
+
ce("span", {
|
|
1388
1388
|
class: "catalog-node__toggle",
|
|
1389
|
-
onClick:
|
|
1389
|
+
onClick: P
|
|
1390
1390
|
}, [
|
|
1391
|
-
|
|
1391
|
+
u.value ? (f(), Fe(Ze(o.value ? Ae(Dn) : Ae(Ht)), {
|
|
1392
1392
|
key: 0,
|
|
1393
1393
|
size: 14
|
|
1394
|
-
})) :
|
|
1394
|
+
})) : ve("", !0)
|
|
1395
1395
|
]),
|
|
1396
|
-
|
|
1396
|
+
ce("span", di, ie(i.item.name || "(无标题)"), 1)
|
|
1397
1397
|
], 14, ci),
|
|
1398
|
-
|
|
1399
|
-
(
|
|
1400
|
-
key:
|
|
1401
|
-
item:
|
|
1398
|
+
u.value && o.value ? (f(), p("div", ui, [
|
|
1399
|
+
(f(!0), p(Y, null, oe(i.item.children, (Z) => (f(), Fe(A, {
|
|
1400
|
+
key: Z.nodeId,
|
|
1401
|
+
item: Z,
|
|
1402
1402
|
depth: i.depth + 1,
|
|
1403
1403
|
"active-id": i.activeId,
|
|
1404
|
-
onNavigate:
|
|
1404
|
+
onNavigate: z[1] || (z[1] = (N) => a("navigate", N))
|
|
1405
1405
|
}, null, 8, ["item", "depth", "active-id"]))), 128))
|
|
1406
|
-
])) :
|
|
1406
|
+
])) : ve("", !0)
|
|
1407
1407
|
]);
|
|
1408
1408
|
};
|
|
1409
1409
|
}
|
|
1410
|
-
}, fi = /* @__PURE__ */
|
|
1410
|
+
}, fi = /* @__PURE__ */ ze(hi, [["__scopeId", "data-v-75ca10a3"]]), gi = {
|
|
1411
1411
|
key: 0,
|
|
1412
1412
|
class: "catalog catalog--collapsed"
|
|
1413
1413
|
}, pi = {
|
|
@@ -1423,44 +1423,44 @@ const si = /* @__PURE__ */ De(li, [["render", oi]]), ri = { class: "catalog-node
|
|
|
1423
1423
|
},
|
|
1424
1424
|
emits: ["navigate"],
|
|
1425
1425
|
setup(i, { emit: e }) {
|
|
1426
|
-
const t = e,
|
|
1427
|
-
function
|
|
1428
|
-
o.value =
|
|
1426
|
+
const t = e, a = se(!1), o = se("");
|
|
1427
|
+
function u(P) {
|
|
1428
|
+
o.value = P.nodeId, t("navigate", P);
|
|
1429
1429
|
}
|
|
1430
|
-
return (
|
|
1431
|
-
|
|
1430
|
+
return (P, S) => a.value ? (f(), p("div", gi, [
|
|
1431
|
+
ce("button", {
|
|
1432
1432
|
class: "catalog__icon-btn",
|
|
1433
1433
|
title: "展开目录",
|
|
1434
|
-
onClick:
|
|
1434
|
+
onClick: S[0] || (S[0] = (z) => a.value = !1)
|
|
1435
1435
|
}, [
|
|
1436
|
-
|
|
1436
|
+
J(Ae(zn), { size: 18 })
|
|
1437
1437
|
])
|
|
1438
|
-
])) : (
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1438
|
+
])) : (f(), p("div", pi, [
|
|
1439
|
+
ce("div", vi, [
|
|
1440
|
+
ce("span", mi, [
|
|
1441
|
+
J(Ae(Nn), { size: 16 }),
|
|
1442
|
+
S[2] || (S[2] = Le(" 目录 ", -1))
|
|
1443
1443
|
]),
|
|
1444
|
-
|
|
1444
|
+
ce("button", {
|
|
1445
1445
|
class: "catalog__icon-btn",
|
|
1446
1446
|
title: "收起目录",
|
|
1447
|
-
onClick:
|
|
1447
|
+
onClick: S[1] || (S[1] = (z) => a.value = !0)
|
|
1448
1448
|
}, [
|
|
1449
|
-
|
|
1449
|
+
J(Ae(Vn), { size: 18 })
|
|
1450
1450
|
])
|
|
1451
1451
|
]),
|
|
1452
|
-
|
|
1453
|
-
(
|
|
1454
|
-
key:
|
|
1455
|
-
item:
|
|
1452
|
+
ce("div", yi, [
|
|
1453
|
+
(f(!0), p(Y, null, oe(i.items, (z) => (f(), Fe(fi, {
|
|
1454
|
+
key: z.nodeId,
|
|
1455
|
+
item: z,
|
|
1456
1456
|
"active-id": o.value,
|
|
1457
|
-
onNavigate:
|
|
1457
|
+
onNavigate: u
|
|
1458
1458
|
}, null, 8, ["item", "active-id"]))), 128)),
|
|
1459
|
-
i.items.length ?
|
|
1459
|
+
i.items.length ? ve("", !0) : (f(), p("div", _i, " 暂无目录 "))
|
|
1460
1460
|
])
|
|
1461
1461
|
]));
|
|
1462
1462
|
}
|
|
1463
|
-
}, xi = /* @__PURE__ */
|
|
1463
|
+
}, xi = /* @__PURE__ */ ze(bi, [["__scopeId", "data-v-c64a3b3a"]]), ki = {
|
|
1464
1464
|
first: 1,
|
|
1465
1465
|
second: 2,
|
|
1466
1466
|
third: 3,
|
|
@@ -1474,25 +1474,25 @@ function wi(i) {
|
|
|
1474
1474
|
function Ci(i) {
|
|
1475
1475
|
const e = [];
|
|
1476
1476
|
for (const o of i || []) {
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1477
|
+
const u = wi(o);
|
|
1478
|
+
u && e.push({
|
|
1479
1479
|
id: o.node_id,
|
|
1480
1480
|
nodeId: o.node_id,
|
|
1481
1481
|
name: (o.content || "").trim(),
|
|
1482
|
-
level:
|
|
1482
|
+
level: u,
|
|
1483
1483
|
children: []
|
|
1484
1484
|
});
|
|
1485
1485
|
}
|
|
1486
1486
|
if (!e.length) return [];
|
|
1487
|
-
const t = (o,
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1490
|
-
},
|
|
1487
|
+
const t = (o, u) => {
|
|
1488
|
+
const P = u.children[u.children.length - 1];
|
|
1489
|
+
P && o.level > P.level ? t(o, P) : u.children.push(o);
|
|
1490
|
+
}, a = [];
|
|
1491
1491
|
for (const o of e) {
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1492
|
+
const u = a[a.length - 1];
|
|
1493
|
+
u && o.level > u.level ? t(o, u) : a.push(o);
|
|
1494
1494
|
}
|
|
1495
|
-
return
|
|
1495
|
+
return a;
|
|
1496
1496
|
}
|
|
1497
1497
|
const Mi = {
|
|
1498
1498
|
first: 0,
|
|
@@ -1504,45 +1504,45 @@ const Mi = {
|
|
|
1504
1504
|
seventh: 6,
|
|
1505
1505
|
eighth: 7
|
|
1506
1506
|
};
|
|
1507
|
-
function
|
|
1508
|
-
let t = "",
|
|
1507
|
+
function Xe(i, e) {
|
|
1508
|
+
let t = "", a = i;
|
|
1509
1509
|
const o = e ? 65 : 97;
|
|
1510
|
-
for (;
|
|
1511
|
-
const
|
|
1512
|
-
t = String.fromCharCode(o +
|
|
1510
|
+
for (; a > 0; ) {
|
|
1511
|
+
const u = (a - 1) % 26;
|
|
1512
|
+
t = String.fromCharCode(o + u) + t, a = Math.floor((a - 1) / 26);
|
|
1513
1513
|
}
|
|
1514
1514
|
return t;
|
|
1515
1515
|
}
|
|
1516
1516
|
const Ft = [
|
|
1517
1517
|
(i) => i.toString(),
|
|
1518
1518
|
// first:数字
|
|
1519
|
-
(i) =>
|
|
1519
|
+
(i) => Xe(i, !0),
|
|
1520
1520
|
// second:大写字母
|
|
1521
1521
|
(i) => `(${i})`,
|
|
1522
1522
|
// third:括号数字
|
|
1523
|
-
(i) => `(${
|
|
1523
|
+
(i) => `(${Xe(i, !1)})`,
|
|
1524
1524
|
// fourth:括号小写字母
|
|
1525
1525
|
(i) => `${i})`,
|
|
1526
1526
|
// fifth:数字+右括号
|
|
1527
|
-
(i) => `${
|
|
1527
|
+
(i) => `${Xe(i, !1)})`,
|
|
1528
1528
|
// sixth:小写字母+右括号
|
|
1529
1529
|
(i) => `<${i}>`,
|
|
1530
1530
|
// seventh:数字+尖括号
|
|
1531
|
-
(i) => `<${
|
|
1531
|
+
(i) => `<${Xe(i, !1)}>`
|
|
1532
1532
|
// eighth:小写字母+尖括号
|
|
1533
1533
|
];
|
|
1534
1534
|
function Ii() {
|
|
1535
1535
|
const i = new Array(8).fill(0);
|
|
1536
1536
|
return {
|
|
1537
1537
|
next(e, t) {
|
|
1538
|
-
const
|
|
1539
|
-
if (
|
|
1540
|
-
i[
|
|
1541
|
-
for (let
|
|
1538
|
+
const a = Mi[e];
|
|
1539
|
+
if (a == null) return "";
|
|
1540
|
+
i[a]++;
|
|
1541
|
+
for (let u = a + 1; u < i.length; u++) i[u] = 0;
|
|
1542
1542
|
if (t != null && t !== "")
|
|
1543
1543
|
return `${t} `;
|
|
1544
|
-
const o = Ft[Math.min(
|
|
1545
|
-
return `${o(i[
|
|
1544
|
+
const o = Ft[Math.min(a, Ft.length - 1)];
|
|
1545
|
+
return `${o(i[a])}. `;
|
|
1546
1546
|
}
|
|
1547
1547
|
};
|
|
1548
1548
|
}
|
|
@@ -1555,10 +1555,7 @@ const Ei = { class: "editor-layout word-editor-scope" }, Si = { class: "editor-c
|
|
|
1555
1555
|
}, Ai = ["href"], Pi = ["src"], $i = ["checked"], Li = ["checked"], Ri = {
|
|
1556
1556
|
key: 4,
|
|
1557
1557
|
class: "ctrl-input"
|
|
1558
|
-
}, Oi = ["checked"], Bi = ["checked"], Hi = {
|
|
1559
|
-
key: 8,
|
|
1560
|
-
class: "doc-tab"
|
|
1561
|
-
}, Di = { key: 0 }, zi = ["colspan", "rowspan"], Ni = { key: 0 }, Vi = ["src"], ji = ["href"], Ki = ["checked"], qi = ["checked"], Wi = ["checked"], lt = 14, Me = 1123, At = 760, Pt = 756, Ui = {
|
|
1558
|
+
}, Oi = ["checked"], Bi = ["checked"], Hi = { key: 0 }, Di = ["colspan", "rowspan"], zi = { key: 0 }, Ni = ["src"], Vi = ["href"], ji = ["checked"], Ki = ["checked"], qi = ["checked"], He = 14, Ie = 1123, At = 760, Pt = 756, Wi = {
|
|
1562
1559
|
__name: "index",
|
|
1563
1560
|
props: {
|
|
1564
1561
|
// 文档结构数据(IElement[]),来源由使用方决定
|
|
@@ -1573,268 +1570,295 @@ const Ei = { class: "editor-layout word-editor-scope" }, Si = { class: "editor-c
|
|
|
1573
1570
|
}
|
|
1574
1571
|
},
|
|
1575
1572
|
setup(i) {
|
|
1576
|
-
const e = i, t = ke(() => e.data || []),
|
|
1577
|
-
let
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
const
|
|
1581
|
-
for (const r of
|
|
1582
|
-
const
|
|
1583
|
-
if (!
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1573
|
+
const e = i, t = ke(() => e.data || []), a = se(null), o = se({});
|
|
1574
|
+
let u = null;
|
|
1575
|
+
ct(() => {
|
|
1576
|
+
u = new ResizeObserver((y) => {
|
|
1577
|
+
const _ = {};
|
|
1578
|
+
for (const r of y) {
|
|
1579
|
+
const D = r.target._rowKey;
|
|
1580
|
+
if (!D) continue;
|
|
1581
|
+
const c = Math.round(r.contentRect.height);
|
|
1582
|
+
c > (o.value[D] || 0) && (_[D] = c);
|
|
1586
1583
|
}
|
|
1587
|
-
Object.keys(
|
|
1584
|
+
Object.keys(_).length && (o.value = { ...o.value, ..._ });
|
|
1588
1585
|
});
|
|
1589
|
-
}),
|
|
1590
|
-
|
|
1586
|
+
}), et(() => {
|
|
1587
|
+
u == null || u.disconnect(), u = null;
|
|
1591
1588
|
});
|
|
1592
|
-
function
|
|
1593
|
-
!
|
|
1589
|
+
function P(y, _) {
|
|
1590
|
+
!y || !u || (y._rowKey = _, u.observe(y));
|
|
1594
1591
|
}
|
|
1595
|
-
const
|
|
1592
|
+
const S = {
|
|
1596
1593
|
left: "left",
|
|
1597
1594
|
center: "center",
|
|
1598
1595
|
right: "right",
|
|
1599
1596
|
alignment: "justify",
|
|
1600
1597
|
justify: "justify"
|
|
1601
1598
|
};
|
|
1602
|
-
function
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1599
|
+
function z(y) {
|
|
1600
|
+
const _ = [];
|
|
1601
|
+
let r = !1;
|
|
1602
|
+
const D = (c) => {
|
|
1603
|
+
if (r) {
|
|
1604
|
+
if (c && c.value != null && /^[\n\u200B]+$/.test(c.value)) {
|
|
1605
|
+
_.push(c);
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
r = !1, _.push({ ...c, _coverBreakBefore: !0 });
|
|
1609
|
+
} else
|
|
1610
|
+
_.push(c);
|
|
1605
1611
|
};
|
|
1606
|
-
for (const
|
|
1607
|
-
if (
|
|
1608
|
-
|
|
1609
|
-
|
|
1612
|
+
for (const c of y || []) {
|
|
1613
|
+
if (c && c.type === "pageBreak") {
|
|
1614
|
+
r = !0;
|
|
1615
|
+
continue;
|
|
1616
|
+
}
|
|
1617
|
+
if (c && c.type === "area") {
|
|
1618
|
+
const $ = z(c.valueList || []);
|
|
1619
|
+
for (const M of $) D(M);
|
|
1610
1620
|
} else
|
|
1611
|
-
|
|
1612
|
-
|
|
1621
|
+
D(c);
|
|
1622
|
+
}
|
|
1623
|
+
return _;
|
|
1613
1624
|
}
|
|
1614
|
-
function
|
|
1615
|
-
const
|
|
1616
|
-
let
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1619
|
-
},
|
|
1620
|
-
if (
|
|
1621
|
-
const I =
|
|
1622
|
-
|
|
1623
|
-
for (let
|
|
1625
|
+
function A(y) {
|
|
1626
|
+
const _ = z(y), r = [];
|
|
1627
|
+
let D = [], c = 0, $ = null;
|
|
1628
|
+
const M = (I) => {
|
|
1629
|
+
D.length && (r.push({ type: "paragraph", elements: [...D], rowFlex: I }), D = []);
|
|
1630
|
+
}, C = () => {
|
|
1631
|
+
if (c === 0) return;
|
|
1632
|
+
const I = $;
|
|
1633
|
+
M(I);
|
|
1634
|
+
for (let O = 1; O < c; O++)
|
|
1624
1635
|
r.push({ type: "paragraph", elements: [], rowFlex: I });
|
|
1625
|
-
|
|
1636
|
+
c = 0, $ = null;
|
|
1626
1637
|
};
|
|
1627
|
-
for (const I of
|
|
1638
|
+
for (const I of _ || [])
|
|
1628
1639
|
if (I.type === "table")
|
|
1629
|
-
|
|
1640
|
+
C(), M(), r.push({ type: "table", el: I });
|
|
1630
1641
|
else if (I.type === "title")
|
|
1631
|
-
|
|
1642
|
+
C(), M(), r.push({ type: "title", el: I });
|
|
1632
1643
|
else if (I.type === "list") {
|
|
1633
|
-
|
|
1634
|
-
const
|
|
1635
|
-
let
|
|
1636
|
-
for (const
|
|
1637
|
-
|
|
1638
|
-
` ||
|
|
1639
|
-
(
|
|
1644
|
+
C(), M();
|
|
1645
|
+
const O = [];
|
|
1646
|
+
let b = [];
|
|
1647
|
+
for (const ge of I.valueList || [])
|
|
1648
|
+
ge.value === `
|
|
1649
|
+
` || ge.value === "" ? (O.push([...b]), b = []) : b.push(ge);
|
|
1650
|
+
(b.length || O.length === 0) && O.push([...b]), r.push({ type: "list", listType: I.listType || "ul", listStyle: I.listStyle || "disc", items: O });
|
|
1640
1651
|
} else if (I.listId) {
|
|
1641
|
-
|
|
1642
|
-
const
|
|
1643
|
-
r.push({ type: "list", listType: I.listType || "ul", listStyle: I.listStyle || "disc", items: [
|
|
1644
|
-
} else I.value != null && /^[\n\u200B]+$/.test(I.value) ? (
|
|
1645
|
-
return
|
|
1652
|
+
C(), M();
|
|
1653
|
+
const O = I.value === "" || I.value === "" ? [] : [I];
|
|
1654
|
+
r.push({ type: "list", listType: I.listType || "ul", listStyle: I.listStyle || "disc", items: [O] });
|
|
1655
|
+
} else I.value != null && /^[\n\u200B]+$/.test(I.value) ? (c += I.value.length, I.rowFlex && ($ = I.rowFlex)) : (C(), D.push(I));
|
|
1656
|
+
return C(), M(), r;
|
|
1646
1657
|
}
|
|
1647
|
-
function
|
|
1648
|
-
const
|
|
1649
|
-
return !
|
|
1658
|
+
function Z(y) {
|
|
1659
|
+
const _ = (y == null ? void 0 : y.width) || 0;
|
|
1660
|
+
return !_ || _ <= Pt ? 1 : Pt / _;
|
|
1650
1661
|
}
|
|
1651
|
-
function
|
|
1652
|
-
const
|
|
1653
|
-
if (!r) return
|
|
1654
|
-
const
|
|
1655
|
-
return
|
|
1662
|
+
function N(y) {
|
|
1663
|
+
const _ = y.filter((O) => O.type === "image").reduce((O, b) => O + (b.height || b.width || 0), 0), r = y.filter((O) => O.type !== "image").map((O) => O.value || "").join("");
|
|
1664
|
+
if (!r) return _ || 20;
|
|
1665
|
+
const D = y.reduce((O, b) => Math.max(O, b.size || 0), 0) || 14, c = D + 6, $ = (r.match(/[一-龥]/g) || []).length, M = r.length - $, C = $ * D + M * (D * 0.5), I = Math.max(1, Math.ceil(C / At));
|
|
1666
|
+
return _ + Math.max(c, I * c);
|
|
1656
1667
|
}
|
|
1657
|
-
function q(
|
|
1658
|
-
if (!
|
|
1659
|
-
const
|
|
1668
|
+
function q(y) {
|
|
1669
|
+
if (!y || !y.length) return [[]];
|
|
1670
|
+
const _ = [];
|
|
1660
1671
|
let r = [];
|
|
1661
|
-
for (const
|
|
1662
|
-
|
|
1663
|
-
return r.length &&
|
|
1672
|
+
for (const D of y)
|
|
1673
|
+
D.type === "image" && (D.width || 0) >= At ? (r.length && (_.push(r), r = []), _.push([D])) : r.push(D);
|
|
1674
|
+
return r.length && _.push(r), _.length ? _ : [[]];
|
|
1664
1675
|
}
|
|
1665
|
-
function
|
|
1666
|
-
if (
|
|
1667
|
-
const
|
|
1668
|
-
|
|
1669
|
-
(
|
|
1670
|
-
const I =
|
|
1676
|
+
function Q(y) {
|
|
1677
|
+
if (y.length === 0) return [];
|
|
1678
|
+
const _ = new Array(y.length).fill(0);
|
|
1679
|
+
y.forEach(($, M) => {
|
|
1680
|
+
($.tdList || []).forEach((C) => {
|
|
1681
|
+
const I = C.rowspan || 1;
|
|
1671
1682
|
if (I > 1) {
|
|
1672
|
-
const
|
|
1673
|
-
|
|
1674
|
-
for (let
|
|
1675
|
-
|
|
1683
|
+
const O = Math.min(M + I - 1, y.length - 1);
|
|
1684
|
+
_[M] = Math.max(_[M], O);
|
|
1685
|
+
for (let b = 1; b < I && M + b < y.length; b++)
|
|
1686
|
+
_[M + b] = Math.max(_[M + b], O);
|
|
1676
1687
|
}
|
|
1677
1688
|
});
|
|
1678
1689
|
});
|
|
1679
1690
|
const r = [];
|
|
1680
|
-
let
|
|
1681
|
-
for (let
|
|
1682
|
-
|
|
1683
|
-
return
|
|
1691
|
+
let D = 0, c = 0;
|
|
1692
|
+
for (let $ = 0; $ < y.length; $++)
|
|
1693
|
+
c = Math.max(c, _[$]), c <= $ && (r.push(y.slice(D, $ + 1)), D = $ + 1, c = 0);
|
|
1694
|
+
return D < y.length && r.push(y.slice(D)), r;
|
|
1684
1695
|
}
|
|
1685
|
-
const
|
|
1686
|
-
const
|
|
1696
|
+
const ee = ke(() => {
|
|
1697
|
+
const y = A(t.value), _ = [];
|
|
1687
1698
|
let r = 0;
|
|
1688
|
-
const
|
|
1689
|
-
let
|
|
1690
|
-
const
|
|
1691
|
-
var I,
|
|
1692
|
-
return !!((I =
|
|
1699
|
+
const D = Ii(), c = { first: 0, second: 1, third: 2, fourth: 3, fifth: 4, sixth: 5, seventh: 6, eighth: 7 };
|
|
1700
|
+
let $ = -1;
|
|
1701
|
+
const M = (C) => {
|
|
1702
|
+
var I, O, b;
|
|
1703
|
+
return !!((I = C.el) != null && I._coverBreakBefore || (b = (O = C.elements) == null ? void 0 : O[0]) != null && b._coverBreakBefore);
|
|
1693
1704
|
};
|
|
1694
|
-
return
|
|
1695
|
-
var
|
|
1696
|
-
const
|
|
1697
|
-
if (
|
|
1698
|
-
const
|
|
1699
|
-
var
|
|
1700
|
-
return (
|
|
1705
|
+
return y.forEach((C, I) => {
|
|
1706
|
+
var b, ge, we;
|
|
1707
|
+
const O = M(C);
|
|
1708
|
+
if (O && (r = 0), C.type === "title") {
|
|
1709
|
+
const de = C.el.valueList || [], le = D.next(C.el.level, (b = C.el.extension) == null ? void 0 : b.startIndex), ne = de.some((E) => {
|
|
1710
|
+
var X;
|
|
1711
|
+
return (X = E.extension) == null ? void 0 : X.isIndex;
|
|
1701
1712
|
});
|
|
1702
|
-
let
|
|
1703
|
-
if (!
|
|
1704
|
-
const
|
|
1705
|
-
|
|
1713
|
+
let ue = de;
|
|
1714
|
+
if (!ne && le) {
|
|
1715
|
+
const E = de[0] || {};
|
|
1716
|
+
ue = [
|
|
1706
1717
|
{
|
|
1707
|
-
value:
|
|
1708
|
-
size:
|
|
1709
|
-
bold:
|
|
1710
|
-
italic:
|
|
1711
|
-
color:
|
|
1712
|
-
font:
|
|
1718
|
+
value: le,
|
|
1719
|
+
size: E.size,
|
|
1720
|
+
bold: E.bold,
|
|
1721
|
+
italic: E.italic,
|
|
1722
|
+
color: E.color,
|
|
1723
|
+
font: E.font,
|
|
1713
1724
|
extension: { isIndex: !0 }
|
|
1714
1725
|
},
|
|
1715
|
-
...
|
|
1726
|
+
...de
|
|
1716
1727
|
];
|
|
1717
1728
|
}
|
|
1718
|
-
const
|
|
1719
|
-
r = r +
|
|
1729
|
+
const me = ue.map((E) => E.value || "").join(""), re = N(ue);
|
|
1730
|
+
r = r + re > Ie && r > 0 ? re : r + re, $ = c[C.el.level] ?? 0, _.push({
|
|
1720
1731
|
node_id: `blk_${I}_0`,
|
|
1721
|
-
layer:
|
|
1732
|
+
layer: O ? 1 : 100,
|
|
1722
1733
|
blockType: "title",
|
|
1723
|
-
level:
|
|
1724
|
-
titleEl:
|
|
1725
|
-
titleValueList:
|
|
1734
|
+
level: C.el.level,
|
|
1735
|
+
titleEl: C.el,
|
|
1736
|
+
titleValueList: ue,
|
|
1726
1737
|
content_type: "text",
|
|
1727
|
-
content:
|
|
1728
|
-
height:
|
|
1729
|
-
indentPx:
|
|
1738
|
+
content: me,
|
|
1739
|
+
height: re,
|
|
1740
|
+
indentPx: $ * 20
|
|
1730
1741
|
});
|
|
1731
|
-
} else if (
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
const
|
|
1735
|
-
r = r +
|
|
1736
|
-
node_id: `blk_${I}_${
|
|
1737
|
-
layer:
|
|
1742
|
+
} else if (C.type === "paragraph") {
|
|
1743
|
+
const de = q(C.elements), le = $ >= 0 ? ($ + 1) * 20 : 0;
|
|
1744
|
+
de.forEach((ne, ue) => {
|
|
1745
|
+
const me = ne.map((E) => E.value || "").join(""), re = N(ne);
|
|
1746
|
+
r = r + re > Ie && r > 0 ? re : r + re, _.push({
|
|
1747
|
+
node_id: `blk_${I}_${ue}`,
|
|
1748
|
+
layer: O && ue === 0 ? 1 : 100,
|
|
1738
1749
|
blockType: "paragraph",
|
|
1739
|
-
elements:
|
|
1740
|
-
rowFlex:
|
|
1750
|
+
elements: ne,
|
|
1751
|
+
rowFlex: C.rowFlex,
|
|
1741
1752
|
content_type: "text",
|
|
1742
|
-
content:
|
|
1743
|
-
height:
|
|
1744
|
-
indentPx:
|
|
1753
|
+
content: me,
|
|
1754
|
+
height: re,
|
|
1755
|
+
indentPx: le
|
|
1745
1756
|
});
|
|
1746
1757
|
});
|
|
1747
|
-
} else if (
|
|
1748
|
-
const
|
|
1749
|
-
|
|
1750
|
-
const
|
|
1751
|
-
(
|
|
1758
|
+
} else if (C.type === "table") {
|
|
1759
|
+
const de = !!((ge = C.el.extension) != null && ge.isTitleTable), le = ((we = C.el.extension) == null ? void 0 : we.elementType) === "signOff", ne = de || le ? 0 : $ >= 0 ? ($ + 1) * 20 : 0, ue = Q(C.el.trList || []), me = ue.length;
|
|
1760
|
+
ue.forEach((re, E) => {
|
|
1761
|
+
const X = `blk_${I}_${E}`, Ne = re.reduce(
|
|
1762
|
+
(U, fe) => U + (fe.height || fe.minHeight || 35),
|
|
1752
1763
|
0
|
|
1753
|
-
),
|
|
1754
|
-
if (
|
|
1755
|
-
const
|
|
1756
|
-
for (let
|
|
1757
|
-
const
|
|
1758
|
-
r =
|
|
1759
|
-
node_id: `blk_${I}_${
|
|
1760
|
-
layer:
|
|
1764
|
+
), ye = Math.max(Ne, o.value[X] || 0);
|
|
1765
|
+
if (ye > Ie) {
|
|
1766
|
+
const U = Math.ceil(ye / Ie);
|
|
1767
|
+
for (let fe = 0; fe < U; fe++) {
|
|
1768
|
+
const Re = fe * Ie, Pe = Math.min(Ie, ye - Re), Ve = fe > 0 || r > 0;
|
|
1769
|
+
r = Pe, _.push({
|
|
1770
|
+
node_id: `blk_${I}_${E}_s${fe}`,
|
|
1771
|
+
layer: O && E === 0 && fe === 0 ? 1 : 100,
|
|
1761
1772
|
blockType: "table-row-group",
|
|
1762
1773
|
content_type: "table-row",
|
|
1763
|
-
rowHeight:
|
|
1764
|
-
trGroup:
|
|
1765
|
-
tableEl:
|
|
1766
|
-
tableRowFlex:
|
|
1767
|
-
isFirst:
|
|
1768
|
-
isLast:
|
|
1769
|
-
isPageBreak:
|
|
1770
|
-
sliceOffset:
|
|
1771
|
-
sliceHeight:
|
|
1772
|
-
_baseKey:
|
|
1773
|
-
height:
|
|
1774
|
-
indentPx:
|
|
1774
|
+
rowHeight: ye,
|
|
1775
|
+
trGroup: re,
|
|
1776
|
+
tableEl: C.el,
|
|
1777
|
+
tableRowFlex: C.el.rowFlex || null,
|
|
1778
|
+
isFirst: E === 0 && fe === 0,
|
|
1779
|
+
isLast: E === me - 1 && fe === U - 1,
|
|
1780
|
+
isPageBreak: Ve,
|
|
1781
|
+
sliceOffset: Re,
|
|
1782
|
+
sliceHeight: Pe,
|
|
1783
|
+
_baseKey: fe === 0 ? X : void 0,
|
|
1784
|
+
height: Pe,
|
|
1785
|
+
indentPx: ne
|
|
1775
1786
|
});
|
|
1776
1787
|
}
|
|
1777
1788
|
} else {
|
|
1778
|
-
const
|
|
1779
|
-
r = r +
|
|
1780
|
-
node_id: `blk_${I}_${
|
|
1781
|
-
layer:
|
|
1789
|
+
const U = E > 0 && r + ye > Ie;
|
|
1790
|
+
r = r + ye > Ie ? ye : r + ye, _.push({
|
|
1791
|
+
node_id: `blk_${I}_${E}`,
|
|
1792
|
+
layer: O && E === 0 ? 1 : 100,
|
|
1782
1793
|
blockType: "table-row-group",
|
|
1783
1794
|
content_type: "table-row",
|
|
1784
|
-
rowHeight:
|
|
1785
|
-
trGroup:
|
|
1786
|
-
tableEl:
|
|
1787
|
-
tableRowFlex:
|
|
1788
|
-
isFirst:
|
|
1789
|
-
isLast:
|
|
1790
|
-
isPageBreak:
|
|
1791
|
-
indentPx:
|
|
1795
|
+
rowHeight: ye,
|
|
1796
|
+
trGroup: re,
|
|
1797
|
+
tableEl: C.el,
|
|
1798
|
+
tableRowFlex: C.el.rowFlex || null,
|
|
1799
|
+
isFirst: E === 0,
|
|
1800
|
+
isLast: E === me - 1,
|
|
1801
|
+
isPageBreak: U,
|
|
1802
|
+
indentPx: ne
|
|
1792
1803
|
});
|
|
1793
1804
|
}
|
|
1794
1805
|
});
|
|
1795
|
-
} else if (
|
|
1796
|
-
const
|
|
1797
|
-
let
|
|
1798
|
-
for (const
|
|
1799
|
-
|
|
1800
|
-
|
|
1806
|
+
} else if (C.type === "list") {
|
|
1807
|
+
const de = Math.round(18);
|
|
1808
|
+
let le = 0;
|
|
1809
|
+
for (const ne of C.items)
|
|
1810
|
+
le += ne.length ? N(ne) : de;
|
|
1811
|
+
le = Math.max(le, de), r = r + le > Ie && r > 0 ? le : r + le, _.push({
|
|
1801
1812
|
node_id: `blk_${I}_0`,
|
|
1802
|
-
layer:
|
|
1813
|
+
layer: O ? 1 : 100,
|
|
1803
1814
|
blockType: "list",
|
|
1804
|
-
listType:
|
|
1805
|
-
listStyle:
|
|
1806
|
-
items:
|
|
1807
|
-
height:
|
|
1808
|
-
indentPx:
|
|
1815
|
+
listType: C.listType,
|
|
1816
|
+
listStyle: C.listStyle,
|
|
1817
|
+
items: C.items,
|
|
1818
|
+
height: le,
|
|
1819
|
+
indentPx: $ >= 0 ? ($ + 1) * 20 : 0
|
|
1809
1820
|
});
|
|
1810
1821
|
}
|
|
1811
|
-
}),
|
|
1812
|
-
}),
|
|
1813
|
-
function W(
|
|
1814
|
-
var
|
|
1815
|
-
(
|
|
1822
|
+
}), _;
|
|
1823
|
+
}), be = ke(() => Ci(ee.value));
|
|
1824
|
+
function W(y) {
|
|
1825
|
+
var _;
|
|
1826
|
+
(_ = a.value) == null || _.scrollToRow({ node_id: y.nodeId });
|
|
1816
1827
|
}
|
|
1817
|
-
function B(
|
|
1818
|
-
var
|
|
1819
|
-
const
|
|
1820
|
-
return
|
|
1828
|
+
function B(y) {
|
|
1829
|
+
var $, M;
|
|
1830
|
+
const _ = y.elements || [], r = (($ = _.find((C) => C.rowFlex)) == null ? void 0 : $.rowFlex) || y.rowFlex, D = { textAlign: S[r] || "left" }, c = (M = _.find((C) => C.rowMargin)) == null ? void 0 : M.rowMargin;
|
|
1831
|
+
return c && (D.lineHeight = c), D;
|
|
1821
1832
|
}
|
|
1822
|
-
function
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1833
|
+
function T(y) {
|
|
1834
|
+
var $;
|
|
1835
|
+
const _ = A(y.value);
|
|
1836
|
+
let r = 0, D = 0, c = !1;
|
|
1837
|
+
for (const M of _)
|
|
1838
|
+
if (M.type === "paragraph") {
|
|
1839
|
+
if (!M.elements.length) continue;
|
|
1840
|
+
r++;
|
|
1841
|
+
for (const C of M.elements)
|
|
1842
|
+
(C.type === "image" || C.type === "table") && (c = !0), D += (C.value || "").length;
|
|
1843
|
+
} else M.type === "list" ? (r += (($ = M.items) == null ? void 0 : $.length) || 1, c = !0) : (r++, c = !0);
|
|
1844
|
+
return r > 1 || D > 30 || c ? "top" : y.verticalAlign || "middle";
|
|
1827
1845
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1846
|
+
function K(y) {
|
|
1847
|
+
const _ = {};
|
|
1848
|
+
y.font && (_.fontFamily = y.font), _.fontSize = (y.size || He) + "px", y.bold != null && (_.fontWeight = y.bold ? "bold" : "normal"), y.italic != null && (_.fontStyle = y.italic ? "italic" : "normal"), y.color && (_.color = y.color), y.highlight && y.highlight !== "rgb(255, 255, 255)" && y.highlight !== "#ffffff" && (_.backgroundColor = y.highlight);
|
|
1849
|
+
const r = [y.underline && "underline", y.strikeout && "line-through"].filter(Boolean).join(" ");
|
|
1850
|
+
return r && (_.textDecoration = r), y.letterSpacing && (_.letterSpacing = y.letterSpacing + "px"), _;
|
|
1851
|
+
}
|
|
1852
|
+
return (y, _) => (f(), p("div", Ei, [
|
|
1853
|
+
J(xi, {
|
|
1854
|
+
items: be.value,
|
|
1831
1855
|
onNavigate: W
|
|
1832
1856
|
}, null, 8, ["items"]),
|
|
1833
|
-
|
|
1834
|
-
i.loading ? (
|
|
1857
|
+
ce("div", Si, [
|
|
1858
|
+
i.loading ? (f(), p("div", Ti, " 加载中… ")) : (f(), Fe(Ae(li), {
|
|
1835
1859
|
key: 1,
|
|
1836
1860
|
ref_key: "virtualTableRef",
|
|
1837
|
-
ref:
|
|
1861
|
+
ref: a,
|
|
1838
1862
|
"show-header": !1,
|
|
1839
1863
|
"row-config": { keyField: "node_id" },
|
|
1840
1864
|
"page-config": {
|
|
@@ -1848,287 +1872,295 @@ const Ei = { class: "editor-layout word-editor-scope" }, Si = { class: "editor-c
|
|
|
1848
1872
|
pageBorderPadding: 5,
|
|
1849
1873
|
pageBorderStyle: "1px solid #333"
|
|
1850
1874
|
},
|
|
1851
|
-
data:
|
|
1875
|
+
data: ee.value
|
|
1852
1876
|
}, {
|
|
1853
|
-
default:
|
|
1854
|
-
|
|
1855
|
-
default:
|
|
1856
|
-
var
|
|
1877
|
+
default: lt(() => [
|
|
1878
|
+
J(Ae(si), null, {
|
|
1879
|
+
default: lt(({ row: r }) => {
|
|
1880
|
+
var D;
|
|
1857
1881
|
return [
|
|
1858
|
-
r.blockType === "title" ? (
|
|
1882
|
+
r.blockType === "title" ? (f(), p("p", {
|
|
1859
1883
|
key: 0,
|
|
1860
|
-
class:
|
|
1861
|
-
style:
|
|
1884
|
+
class: Ee(["doc-title", `doc-title--${r.level}`]),
|
|
1885
|
+
style: j({ paddingLeft: r.indentPx ? r.indentPx + "px" : void 0 })
|
|
1862
1886
|
}, [
|
|
1863
|
-
(
|
|
1864
|
-
key:
|
|
1865
|
-
style: K(
|
|
1866
|
-
},
|
|
1867
|
-
], 6)) : r.blockType === "paragraph" ? (
|
|
1887
|
+
(f(!0), p(Y, null, oe(r.titleValueList || [], (c, $) => (f(), p("span", {
|
|
1888
|
+
key: $,
|
|
1889
|
+
style: j(K(c))
|
|
1890
|
+
}, ie(c.value), 5))), 128))
|
|
1891
|
+
], 6)) : r.blockType === "paragraph" ? (f(), p("p", {
|
|
1868
1892
|
key: 1,
|
|
1869
1893
|
class: "doc-para",
|
|
1870
|
-
style:
|
|
1894
|
+
style: j({ ...B(r), paddingLeft: r.indentPx ? r.indentPx + "px" : void 0 })
|
|
1871
1895
|
}, [
|
|
1872
|
-
r.elements.length ?
|
|
1873
|
-
(
|
|
1874
|
-
var
|
|
1875
|
-
return
|
|
1876
|
-
!
|
|
1896
|
+
r.elements.length ? ve("", !0) : (f(), p("span", Fi, " ")),
|
|
1897
|
+
(f(!0), p(Y, null, oe(r.elements, (c, $) => {
|
|
1898
|
+
var M, C, I, O, b, ge, we, de, le, ne, ue, me, re;
|
|
1899
|
+
return f(), p(Y, { key: $ }, [
|
|
1900
|
+
!c.type || c.type === "text" ? (f(), p("span", {
|
|
1877
1901
|
key: 0,
|
|
1878
|
-
style: K(
|
|
1879
|
-
},
|
|
1902
|
+
style: j(K(c))
|
|
1903
|
+
}, ie(c.value), 5)) : c.type === "hyperlink" ? (f(), p("a", {
|
|
1880
1904
|
key: 1,
|
|
1881
|
-
href:
|
|
1905
|
+
href: c.url,
|
|
1882
1906
|
class: "doc-link",
|
|
1883
1907
|
target: "_blank",
|
|
1884
1908
|
rel: "noopener"
|
|
1885
1909
|
}, [
|
|
1886
|
-
(
|
|
1887
|
-
key:
|
|
1888
|
-
style: K(
|
|
1889
|
-
},
|
|
1890
|
-
], 8, Ai)) :
|
|
1910
|
+
(f(!0), p(Y, null, oe(c.valueList || [], (E, X) => (f(), p("span", {
|
|
1911
|
+
key: X,
|
|
1912
|
+
style: j(K(E))
|
|
1913
|
+
}, ie(E.value), 5))), 128))
|
|
1914
|
+
], 8, Ai)) : c.type === "image" ? (f(), p("img", {
|
|
1891
1915
|
key: 2,
|
|
1892
|
-
src:
|
|
1916
|
+
src: c.value,
|
|
1893
1917
|
class: "doc-image",
|
|
1894
|
-
style:
|
|
1895
|
-
width:
|
|
1896
|
-
height:
|
|
1918
|
+
style: j({
|
|
1919
|
+
width: c.width ? c.width + "px" : "auto",
|
|
1920
|
+
height: c.height ? c.height + "px" : "auto"
|
|
1897
1921
|
})
|
|
1898
|
-
}, null, 12, Pi)) :
|
|
1899
|
-
((
|
|
1922
|
+
}, null, 12, Pi)) : c.type === "control" ? (f(), p(Y, { key: 3 }, [
|
|
1923
|
+
((M = c.control) == null ? void 0 : M.type) === "text" ? (f(), p("span", {
|
|
1900
1924
|
key: 0,
|
|
1901
|
-
style:
|
|
1925
|
+
style: j({ fontSize: (c.control.size || 12) + "px" })
|
|
1902
1926
|
}, [
|
|
1903
|
-
(
|
|
1904
|
-
key:
|
|
1905
|
-
style: K(
|
|
1906
|
-
},
|
|
1907
|
-
], 4)) : ((
|
|
1927
|
+
(f(!0), p(Y, null, oe(c.control.value || [], (E, X) => (f(), p("span", {
|
|
1928
|
+
key: X,
|
|
1929
|
+
style: j(K(E))
|
|
1930
|
+
}, ie(E.value), 5))), 128))
|
|
1931
|
+
], 4)) : ((C = c.control) == null ? void 0 : C.type) === "input" ? (f(), p("span", {
|
|
1908
1932
|
key: 1,
|
|
1909
1933
|
class: "ctrl-input",
|
|
1910
|
-
style:
|
|
1911
|
-
minWidth: (
|
|
1912
|
-
fontSize: (
|
|
1934
|
+
style: j({
|
|
1935
|
+
minWidth: (c.control.minWidth || 60) + "px",
|
|
1936
|
+
fontSize: (c.control.size || 12) + "px"
|
|
1913
1937
|
})
|
|
1914
1938
|
}, [
|
|
1915
|
-
(
|
|
1916
|
-
], 4)) : ((I =
|
|
1939
|
+
(f(!0), p(Y, null, oe(c.control.value || [], (E, X) => (f(), p("span", { key: X }, ie(E.value), 1))), 128))
|
|
1940
|
+
], 4)) : ((I = c.control) == null ? void 0 : I.type) === "radio" ? (f(), p("span", {
|
|
1917
1941
|
key: 2,
|
|
1918
|
-
class:
|
|
1919
|
-
style:
|
|
1942
|
+
class: Ee(["ctrl-options", { "ctrl-options--vertical": ((b = (O = c.control.extension) == null ? void 0 : O.elementAttributes) == null ? void 0 : b.layout) === "vertical" }]),
|
|
1943
|
+
style: j({ fontSize: (c.control.size || He) + "px" })
|
|
1920
1944
|
}, [
|
|
1921
|
-
(
|
|
1922
|
-
key:
|
|
1945
|
+
(f(!0), p(Y, null, oe(c.control.valueSets || [], (E, X) => (f(), p("label", {
|
|
1946
|
+
key: X,
|
|
1923
1947
|
class: "ctrl-option"
|
|
1924
1948
|
}, [
|
|
1925
|
-
|
|
1949
|
+
ce("input", {
|
|
1926
1950
|
type: "radio",
|
|
1927
1951
|
disabled: "",
|
|
1928
|
-
checked:
|
|
1952
|
+
checked: c.control.code === E.code
|
|
1929
1953
|
}, null, 8, $i),
|
|
1930
|
-
|
|
1954
|
+
Le(" " + ie(E.value), 1)
|
|
1931
1955
|
]))), 128))
|
|
1932
|
-
], 6)) : ((
|
|
1956
|
+
], 6)) : ((ge = c.control) == null ? void 0 : ge.type) === "checkbox" ? (f(), p("span", {
|
|
1933
1957
|
key: 3,
|
|
1934
|
-
class:
|
|
1935
|
-
style:
|
|
1958
|
+
class: Ee(["ctrl-options", { "ctrl-options--vertical": ((de = (we = c.control.extension) == null ? void 0 : we.elementAttributes) == null ? void 0 : de.layout) === "vertical" }]),
|
|
1959
|
+
style: j({ fontSize: (c.control.size || He) + "px" })
|
|
1936
1960
|
}, [
|
|
1937
|
-
(
|
|
1938
|
-
key:
|
|
1961
|
+
(f(!0), p(Y, null, oe(c.control.valueSets || [], (E, X) => (f(), p("label", {
|
|
1962
|
+
key: X,
|
|
1939
1963
|
class: "ctrl-option"
|
|
1940
1964
|
}, [
|
|
1941
|
-
|
|
1965
|
+
ce("input", {
|
|
1942
1966
|
type: "checkbox",
|
|
1943
1967
|
disabled: "",
|
|
1944
|
-
checked: (
|
|
1968
|
+
checked: (c.control.code || "").split(",").includes(E.code)
|
|
1945
1969
|
}, null, 8, Li),
|
|
1946
|
-
|
|
1970
|
+
Le(" " + ie(E.value), 1)
|
|
1947
1971
|
]))), 128))
|
|
1948
|
-
], 6)) : ((
|
|
1949
|
-
], 64)) :
|
|
1972
|
+
], 6)) : ((le = c.control) == null ? void 0 : le.type) === "select" ? (f(), p("span", Ri, ie(((ue = (ne = c.control.value) == null ? void 0 : ne[0]) == null ? void 0 : ue.value) || c.control.placeholder || ""), 1)) : ve("", !0)
|
|
1973
|
+
], 64)) : c.type === "checkbox" ? (f(), p("input", {
|
|
1950
1974
|
key: 4,
|
|
1951
1975
|
type: "checkbox",
|
|
1952
|
-
checked: !!((
|
|
1976
|
+
checked: !!((me = c.checkbox) != null && me.value),
|
|
1953
1977
|
disabled: "",
|
|
1954
1978
|
class: "el-check"
|
|
1955
|
-
}, null, 8, Oi)) :
|
|
1979
|
+
}, null, 8, Oi)) : c.type === "radio" ? (f(), p("input", {
|
|
1956
1980
|
key: 5,
|
|
1957
1981
|
type: "radio",
|
|
1958
|
-
checked: !!((
|
|
1982
|
+
checked: !!((re = c.radio) != null && re.value),
|
|
1959
1983
|
disabled: "",
|
|
1960
1984
|
class: "el-check"
|
|
1961
|
-
}, null, 8, Bi)) :
|
|
1985
|
+
}, null, 8, Bi)) : c.type === "superscript" ? (f(), p("sup", {
|
|
1962
1986
|
key: 6,
|
|
1963
|
-
style: K(
|
|
1964
|
-
},
|
|
1987
|
+
style: j(K(c))
|
|
1988
|
+
}, ie(c.value), 5)) : c.type === "subscript" ? (f(), p("sub", {
|
|
1965
1989
|
key: 7,
|
|
1966
|
-
style: K(
|
|
1967
|
-
},
|
|
1990
|
+
style: j(K(c))
|
|
1991
|
+
}, ie(c.value), 5)) : c.type === "tab" ? (f(), p("span", {
|
|
1992
|
+
key: 8,
|
|
1993
|
+
class: "doc-tab",
|
|
1994
|
+
style: j({ width: (c.size || He) + "px" })
|
|
1995
|
+
}, null, 4)) : ve("", !0)
|
|
1968
1996
|
], 64);
|
|
1969
1997
|
}), 128))
|
|
1970
|
-
], 4)) : r.blockType === "list" ? (
|
|
1998
|
+
], 4)) : r.blockType === "list" ? (f(), Fe(Ze(r.listType === "ol" ? "ol" : "ul"), {
|
|
1971
1999
|
key: 2,
|
|
1972
2000
|
class: "doc-list",
|
|
1973
|
-
style:
|
|
2001
|
+
style: j({ listStyleType: r.listStyle === "decimal" ? "decimal" : r.listStyle === "lower-alpha" ? "lower-alpha" : "disc", paddingLeft: r.indentPx ? r.indentPx + 24 + "px" : void 0 })
|
|
1974
2002
|
}, {
|
|
1975
|
-
default:
|
|
1976
|
-
(
|
|
1977
|
-
key:
|
|
2003
|
+
default: lt(() => [
|
|
2004
|
+
(f(!0), p(Y, null, oe(r.items, (c, $) => (f(), p("li", {
|
|
2005
|
+
key: $,
|
|
1978
2006
|
class: "doc-list-item"
|
|
1979
2007
|
}, [
|
|
1980
|
-
(
|
|
1981
|
-
|
|
2008
|
+
(f(!0), p(Y, null, oe(c, (M, C) => (f(), p(Y, { key: C }, [
|
|
2009
|
+
!M.type || M.type === "text" ? (f(), p("span", {
|
|
1982
2010
|
key: 0,
|
|
1983
|
-
style: K(
|
|
1984
|
-
},
|
|
2011
|
+
style: j(K(M))
|
|
2012
|
+
}, ie(M.value), 5)) : M.type === "superscript" ? (f(), p("sup", {
|
|
1985
2013
|
key: 1,
|
|
1986
|
-
style: K(
|
|
1987
|
-
},
|
|
2014
|
+
style: j(K(M))
|
|
2015
|
+
}, ie(M.value), 5)) : M.type === "subscript" ? (f(), p("sub", {
|
|
1988
2016
|
key: 2,
|
|
1989
|
-
style: K(
|
|
1990
|
-
},
|
|
2017
|
+
style: j(K(M))
|
|
2018
|
+
}, ie(M.value), 5)) : ve("", !0)
|
|
1991
2019
|
], 64))), 128))
|
|
1992
2020
|
]))), 128))
|
|
1993
2021
|
]),
|
|
1994
2022
|
_: 2
|
|
1995
|
-
}, 1032, ["style"])) : r.blockType === "table-row-group" ? (
|
|
2023
|
+
}, 1032, ["style"])) : r.blockType === "table-row-group" ? (f(), p("div", {
|
|
1996
2024
|
key: 3,
|
|
1997
|
-
class:
|
|
1998
|
-
style:
|
|
2025
|
+
class: Ee(["doc-table-row-wrap", { "is-first": r.isFirst, "is-last": r.isLast, "is-page-break": r.isPageBreak }]),
|
|
2026
|
+
style: j({
|
|
1999
2027
|
display: r.tableRowFlex ? "flex" : void 0,
|
|
2000
2028
|
justifyContent: r.tableRowFlex === "right" ? "flex-end" : r.tableRowFlex === "center" ? "center" : r.tableRowFlex === "left" ? "flex-start" : void 0,
|
|
2001
2029
|
paddingLeft: r.indentPx ? r.indentPx + "px" : void 0
|
|
2002
2030
|
})
|
|
2003
2031
|
}, [
|
|
2004
|
-
|
|
2005
|
-
style:
|
|
2032
|
+
ce("div", {
|
|
2033
|
+
style: j({
|
|
2006
2034
|
overflow: r.sliceHeight != null ? "hidden" : void 0,
|
|
2007
2035
|
height: r.sliceHeight != null ? (r.isLast ? r.sliceHeight + 1 : r.sliceHeight) + "px" : void 0,
|
|
2008
2036
|
width: r.tableEl.width ? "max-content" : "100%"
|
|
2009
2037
|
})
|
|
2010
2038
|
}, [
|
|
2011
|
-
|
|
2012
|
-
ref: r._baseKey ? (
|
|
2013
|
-
class:
|
|
2014
|
-
style:
|
|
2015
|
-
width: r.tableEl.width ? r.tableEl.width *
|
|
2039
|
+
ce("table", {
|
|
2040
|
+
ref: r._baseKey ? (c) => P(c, r._baseKey) : void 0,
|
|
2041
|
+
class: Ee(["doc-table", { "doc-table--no-border": r.tableEl.borderType === "empty" }]),
|
|
2042
|
+
style: j({
|
|
2043
|
+
width: r.tableEl.width ? r.tableEl.width * Z(r.tableEl) + "px" : "100%",
|
|
2016
2044
|
transform: r.sliceOffset ? `translateY(-${r.sliceOffset}px)` : void 0
|
|
2017
2045
|
})
|
|
2018
2046
|
}, [
|
|
2019
|
-
(
|
|
2020
|
-
(
|
|
2021
|
-
key:
|
|
2022
|
-
style:
|
|
2047
|
+
(D = r.tableEl.colgroup) != null && D.length ? (f(), p("colgroup", Hi, [
|
|
2048
|
+
(f(!0), p(Y, null, oe(r.tableEl.colgroup, (c, $) => (f(), p("col", {
|
|
2049
|
+
key: $,
|
|
2050
|
+
style: j({ width: c.width * Z(r.tableEl) + "px" })
|
|
2023
2051
|
}, null, 4))), 128))
|
|
2024
|
-
])) :
|
|
2025
|
-
|
|
2026
|
-
(
|
|
2027
|
-
key:
|
|
2028
|
-
style:
|
|
2052
|
+
])) : ve("", !0),
|
|
2053
|
+
ce("tbody", null, [
|
|
2054
|
+
(f(!0), p(Y, null, oe(r.trGroup, (c, $) => (f(), p("tr", {
|
|
2055
|
+
key: $,
|
|
2056
|
+
style: j({ height: (c.height || c.minHeight || 30) + "px" })
|
|
2029
2057
|
}, [
|
|
2030
|
-
(
|
|
2031
|
-
key:
|
|
2032
|
-
colspan:
|
|
2033
|
-
rowspan:
|
|
2034
|
-
style:
|
|
2035
|
-
backgroundColor:
|
|
2036
|
-
verticalAlign:
|
|
2037
|
-
width:
|
|
2038
|
-
height:
|
|
2058
|
+
(f(!0), p(Y, null, oe(c.tdList || [], (M, C) => (f(), p("td", {
|
|
2059
|
+
key: C,
|
|
2060
|
+
colspan: M.colspan || 1,
|
|
2061
|
+
rowspan: M.rowspan || 1,
|
|
2062
|
+
style: j({
|
|
2063
|
+
backgroundColor: M.backgroundColor || void 0,
|
|
2064
|
+
verticalAlign: T(M),
|
|
2065
|
+
width: M.width ? M.width * Z(r.tableEl) + "px" : void 0,
|
|
2066
|
+
height: M.height ? M.height + "px" : void 0
|
|
2039
2067
|
})
|
|
2040
2068
|
}, [
|
|
2041
|
-
(
|
|
2042
|
-
I.type === "paragraph" ? (
|
|
2069
|
+
(f(!0), p(Y, null, oe(A(M.value), (I, O) => (f(), p(Y, { key: O }, [
|
|
2070
|
+
I.type === "paragraph" ? (f(), p("p", {
|
|
2043
2071
|
key: 0,
|
|
2044
2072
|
class: "cell-para",
|
|
2045
|
-
style:
|
|
2073
|
+
style: j(B(I))
|
|
2046
2074
|
}, [
|
|
2047
|
-
I.elements.length ?
|
|
2048
|
-
(
|
|
2049
|
-
var
|
|
2050
|
-
return
|
|
2051
|
-
!
|
|
2075
|
+
I.elements.length ? ve("", !0) : (f(), p("span", zi, " ")),
|
|
2076
|
+
(f(!0), p(Y, null, oe(I.elements, (b, ge) => {
|
|
2077
|
+
var we, de, le, ne, ue, me, re;
|
|
2078
|
+
return f(), p(Y, { key: ge }, [
|
|
2079
|
+
!b.type || b.type === "text" ? (f(), p("span", {
|
|
2052
2080
|
key: 0,
|
|
2053
|
-
style: K(b
|
|
2054
|
-
},
|
|
2081
|
+
style: j(K(b))
|
|
2082
|
+
}, ie(b.value), 5)) : b.type === "image" ? (f(), p("img", {
|
|
2055
2083
|
key: 1,
|
|
2056
|
-
src:
|
|
2084
|
+
src: b.value,
|
|
2057
2085
|
class: "doc-image",
|
|
2058
|
-
style:
|
|
2059
|
-
width:
|
|
2060
|
-
height:
|
|
2086
|
+
style: j({
|
|
2087
|
+
width: b.width ? b.width + "px" : "auto",
|
|
2088
|
+
height: b.height ? b.height + "px" : "auto"
|
|
2061
2089
|
})
|
|
2062
|
-
}, null, 12,
|
|
2090
|
+
}, null, 12, Ni)) : b.type === "hyperlink" ? (f(), p("a", {
|
|
2063
2091
|
key: 2,
|
|
2064
|
-
href:
|
|
2092
|
+
href: b.url,
|
|
2065
2093
|
class: "doc-link",
|
|
2066
2094
|
target: "_blank"
|
|
2067
2095
|
}, [
|
|
2068
|
-
(
|
|
2069
|
-
key:
|
|
2070
|
-
style: K(
|
|
2071
|
-
},
|
|
2072
|
-
], 8,
|
|
2073
|
-
((
|
|
2096
|
+
(f(!0), p(Y, null, oe(b.valueList || [], (E, X) => (f(), p("span", {
|
|
2097
|
+
key: X,
|
|
2098
|
+
style: j(K(E))
|
|
2099
|
+
}, ie(E.value), 5))), 128))
|
|
2100
|
+
], 8, Vi)) : b.type === "control" ? (f(), p(Y, { key: 3 }, [
|
|
2101
|
+
((we = b.control) == null ? void 0 : we.type) === "text" ? (f(), p("span", {
|
|
2074
2102
|
key: 0,
|
|
2075
|
-
style:
|
|
2103
|
+
style: j({ fontSize: (b.control.size || 12) + "px" })
|
|
2076
2104
|
}, [
|
|
2077
|
-
(
|
|
2078
|
-
key:
|
|
2079
|
-
style: K(
|
|
2080
|
-
},
|
|
2081
|
-
], 4)) : ((
|
|
2105
|
+
(f(!0), p(Y, null, oe(b.control.value || [], (E, X) => (f(), p("span", {
|
|
2106
|
+
key: X,
|
|
2107
|
+
style: j(K(E))
|
|
2108
|
+
}, ie(E.value), 5))), 128))
|
|
2109
|
+
], 4)) : ((de = b.control) == null ? void 0 : de.type) === "input" ? (f(), p("span", {
|
|
2082
2110
|
key: 1,
|
|
2083
2111
|
class: "ctrl-input",
|
|
2084
|
-
style:
|
|
2112
|
+
style: j({ fontSize: (b.control.size || 12) + "px" })
|
|
2085
2113
|
}, [
|
|
2086
|
-
(
|
|
2087
|
-
], 4)) : ((
|
|
2114
|
+
(f(!0), p(Y, null, oe(b.control.value || [], (E, X) => (f(), p("span", { key: X }, ie(E.value), 1))), 128))
|
|
2115
|
+
], 4)) : ((le = b.control) == null ? void 0 : le.type) === "radio" ? (f(), p("span", {
|
|
2088
2116
|
key: 2,
|
|
2089
|
-
class:
|
|
2117
|
+
class: Ee(["ctrl-options", { "ctrl-options--vertical": ((ue = (ne = b.control.extension) == null ? void 0 : ne.elementAttributes) == null ? void 0 : ue.layout) === "vertical" }])
|
|
2090
2118
|
}, [
|
|
2091
|
-
(
|
|
2092
|
-
key:
|
|
2119
|
+
(f(!0), p(Y, null, oe(b.control.valueSets || [], (E, X) => (f(), p("label", {
|
|
2120
|
+
key: X,
|
|
2093
2121
|
class: "ctrl-option"
|
|
2094
2122
|
}, [
|
|
2095
|
-
|
|
2123
|
+
ce("input", {
|
|
2096
2124
|
type: "radio",
|
|
2097
2125
|
disabled: "",
|
|
2098
|
-
checked:
|
|
2099
|
-
}, null, 8,
|
|
2100
|
-
|
|
2126
|
+
checked: b.control.code === E.code
|
|
2127
|
+
}, null, 8, ji),
|
|
2128
|
+
Le(ie(E.value), 1)
|
|
2101
2129
|
]))), 128))
|
|
2102
|
-
], 2)) :
|
|
2103
|
-
], 64)) :
|
|
2130
|
+
], 2)) : ve("", !0)
|
|
2131
|
+
], 64)) : b.type === "checkbox" ? (f(), p("input", {
|
|
2104
2132
|
key: 4,
|
|
2105
2133
|
type: "checkbox",
|
|
2106
|
-
checked: !!((
|
|
2134
|
+
checked: !!((me = b.checkbox) != null && me.value),
|
|
2107
2135
|
disabled: "",
|
|
2108
2136
|
class: "el-check"
|
|
2109
|
-
}, null, 8,
|
|
2137
|
+
}, null, 8, Ki)) : b.type === "radio" ? (f(), p("input", {
|
|
2110
2138
|
key: 5,
|
|
2111
2139
|
type: "radio",
|
|
2112
|
-
checked: !!((
|
|
2140
|
+
checked: !!((re = b.radio) != null && re.value),
|
|
2113
2141
|
disabled: "",
|
|
2114
2142
|
class: "el-check"
|
|
2115
|
-
}, null, 8,
|
|
2143
|
+
}, null, 8, qi)) : b.type === "superscript" ? (f(), p("sup", {
|
|
2116
2144
|
key: 6,
|
|
2117
|
-
style: K(b
|
|
2118
|
-
},
|
|
2145
|
+
style: j(K(b))
|
|
2146
|
+
}, ie(b.value), 5)) : b.type === "subscript" ? (f(), p("sub", {
|
|
2119
2147
|
key: 7,
|
|
2120
|
-
style: K(b
|
|
2121
|
-
},
|
|
2148
|
+
style: j(K(b))
|
|
2149
|
+
}, ie(b.value), 5)) : b.type === "tab" ? (f(), p("span", {
|
|
2150
|
+
key: 8,
|
|
2151
|
+
class: "doc-tab",
|
|
2152
|
+
style: j({ width: (b.size || He) + "px" })
|
|
2153
|
+
}, null, 4)) : ve("", !0)
|
|
2122
2154
|
], 64);
|
|
2123
2155
|
}), 128))
|
|
2124
|
-
], 4)) :
|
|
2156
|
+
], 4)) : ve("", !0)
|
|
2125
2157
|
], 64))), 128))
|
|
2126
|
-
], 12,
|
|
2158
|
+
], 12, Di))), 128))
|
|
2127
2159
|
], 4))), 128))
|
|
2128
2160
|
])
|
|
2129
2161
|
], 6)
|
|
2130
2162
|
], 4)
|
|
2131
|
-
], 6)) :
|
|
2163
|
+
], 6)) : ve("", !0)
|
|
2132
2164
|
];
|
|
2133
2165
|
}),
|
|
2134
2166
|
_: 1
|
|
@@ -2139,16 +2171,16 @@ const Ei = { class: "editor-layout word-editor-scope" }, Si = { class: "editor-c
|
|
|
2139
2171
|
])
|
|
2140
2172
|
]));
|
|
2141
2173
|
}
|
|
2142
|
-
},
|
|
2143
|
-
function
|
|
2174
|
+
}, Ui = /* @__PURE__ */ ze(Wi, [["__scopeId", "data-v-fbf35559"]]), $t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
2175
|
+
function Ye(i = 10) {
|
|
2144
2176
|
const e = crypto.getRandomValues(new Uint8Array(i));
|
|
2145
2177
|
return Array.from(e).map((t) => $t[t % $t.length]).join("");
|
|
2146
2178
|
}
|
|
2147
|
-
class
|
|
2179
|
+
class Qe {
|
|
2148
2180
|
constructor(e) {
|
|
2149
|
-
|
|
2181
|
+
V(this, "data");
|
|
2150
2182
|
this.data = Bt({
|
|
2151
|
-
id:
|
|
2183
|
+
id: Ye(),
|
|
2152
2184
|
version: 1,
|
|
2153
2185
|
sections: [this.createEmptySection()],
|
|
2154
2186
|
pageWidth: 595,
|
|
@@ -2163,13 +2195,13 @@ class Ye {
|
|
|
2163
2195
|
// ─── 工厂方法 ─────────────────────────────────────────────────────────────
|
|
2164
2196
|
createEmptySection() {
|
|
2165
2197
|
return {
|
|
2166
|
-
id:
|
|
2198
|
+
id: Ye(),
|
|
2167
2199
|
paragraphs: [this.createEmptyParagraph()]
|
|
2168
2200
|
};
|
|
2169
2201
|
}
|
|
2170
2202
|
createEmptyParagraph(e) {
|
|
2171
2203
|
return {
|
|
2172
|
-
id:
|
|
2204
|
+
id: Ye(),
|
|
2173
2205
|
type: "paragraph",
|
|
2174
2206
|
format: e ?? {},
|
|
2175
2207
|
children: []
|
|
@@ -2177,7 +2209,7 @@ class Ye {
|
|
|
2177
2209
|
}
|
|
2178
2210
|
createTextElement(e, t) {
|
|
2179
2211
|
return {
|
|
2180
|
-
id:
|
|
2212
|
+
id: Ye(),
|
|
2181
2213
|
type: "text",
|
|
2182
2214
|
value: e,
|
|
2183
2215
|
format: t ?? {}
|
|
@@ -2194,15 +2226,15 @@ class Ye {
|
|
|
2194
2226
|
/** 获取所有段落(展开所有 section) */
|
|
2195
2227
|
getAllParagraphs() {
|
|
2196
2228
|
const e = [];
|
|
2197
|
-
return this.data.sections.forEach((t,
|
|
2198
|
-
t.paragraphs.forEach((o,
|
|
2199
|
-
e.push({ paragraph: o, sectionIndex:
|
|
2229
|
+
return this.data.sections.forEach((t, a) => {
|
|
2230
|
+
t.paragraphs.forEach((o, u) => {
|
|
2231
|
+
e.push({ paragraph: o, sectionIndex: a, paragraphIndex: u });
|
|
2200
2232
|
});
|
|
2201
2233
|
}), e;
|
|
2202
2234
|
}
|
|
2203
2235
|
getParagraphAt(e, t) {
|
|
2204
|
-
var
|
|
2205
|
-
return ((
|
|
2236
|
+
var a;
|
|
2237
|
+
return ((a = this.data.sections[e]) == null ? void 0 : a.paragraphs[t]) ?? null;
|
|
2206
2238
|
}
|
|
2207
2239
|
getElementAt(e) {
|
|
2208
2240
|
const t = this.getParagraphAt(e.sectionIndex, e.paragraphIndex);
|
|
@@ -2210,64 +2242,64 @@ class Ye {
|
|
|
2210
2242
|
}
|
|
2211
2243
|
// ─── 原子修改方法(由 Command 调用)─────────────────────────────────────
|
|
2212
2244
|
/** 在指定位置插入文本(拆分/合并 text element) */
|
|
2213
|
-
insertText(e, t,
|
|
2245
|
+
insertText(e, t, a) {
|
|
2214
2246
|
const o = this.getParagraphAt(e.sectionIndex, e.paragraphIndex);
|
|
2215
2247
|
if (!o) return;
|
|
2216
|
-
const
|
|
2217
|
-
if (
|
|
2218
|
-
|
|
2248
|
+
const u = o.children[e.elementIndex];
|
|
2249
|
+
if (u && u.type === "text")
|
|
2250
|
+
u.value = u.value.slice(0, e.offset) + t + u.value.slice(e.offset);
|
|
2219
2251
|
else {
|
|
2220
|
-
const
|
|
2221
|
-
o.children.splice(e.elementIndex, 0,
|
|
2252
|
+
const P = this.createTextElement(t, a);
|
|
2253
|
+
o.children.splice(e.elementIndex, 0, P);
|
|
2222
2254
|
}
|
|
2223
2255
|
this.bumpVersion();
|
|
2224
2256
|
}
|
|
2225
2257
|
/** 删除指定范围内容 */
|
|
2226
2258
|
deleteAt(e, t) {
|
|
2227
|
-
const
|
|
2228
|
-
if (!
|
|
2229
|
-
const o =
|
|
2230
|
-
!o || o.type !== "text" || (o.value = o.value.slice(0, e.offset) + o.value.slice(e.offset + t), o.value === "" &&
|
|
2259
|
+
const a = this.getParagraphAt(e.sectionIndex, e.paragraphIndex);
|
|
2260
|
+
if (!a) return;
|
|
2261
|
+
const o = a.children[e.elementIndex];
|
|
2262
|
+
!o || o.type !== "text" || (o.value = o.value.slice(0, e.offset) + o.value.slice(e.offset + t), o.value === "" && a.children.splice(e.elementIndex, 1), this.bumpVersion());
|
|
2231
2263
|
}
|
|
2232
2264
|
/** 在段落后插入新段落 */
|
|
2233
|
-
insertParagraph(e, t,
|
|
2265
|
+
insertParagraph(e, t, a) {
|
|
2234
2266
|
const o = this.data.sections[e];
|
|
2235
2267
|
if (!o) throw new Error(`Section ${e} not found`);
|
|
2236
|
-
const
|
|
2237
|
-
return o.paragraphs.splice(t + 1, 0,
|
|
2268
|
+
const u = this.createEmptyParagraph(a);
|
|
2269
|
+
return o.paragraphs.splice(t + 1, 0, u), this.bumpVersion(), u;
|
|
2238
2270
|
}
|
|
2239
2271
|
/** 合并两个相邻段落 */
|
|
2240
2272
|
mergeParagraphs(e, t) {
|
|
2241
|
-
const
|
|
2242
|
-
if (!
|
|
2243
|
-
const o =
|
|
2244
|
-
!o || !
|
|
2273
|
+
const a = this.data.sections[e];
|
|
2274
|
+
if (!a) return;
|
|
2275
|
+
const o = a.paragraphs[t], u = a.paragraphs[t + 1];
|
|
2276
|
+
!o || !u || (o.children.push(...u.children), a.paragraphs.splice(t + 1, 1), this.bumpVersion());
|
|
2245
2277
|
}
|
|
2246
2278
|
/** 更新段落格式 */
|
|
2247
|
-
updateParagraphFormat(e, t,
|
|
2279
|
+
updateParagraphFormat(e, t, a) {
|
|
2248
2280
|
const o = this.getParagraphAt(e, t);
|
|
2249
|
-
o && (o.format = { ...o.format, ...
|
|
2281
|
+
o && (o.format = { ...o.format, ...a }, this.bumpVersion());
|
|
2250
2282
|
}
|
|
2251
2283
|
/** 更新元素格式 */
|
|
2252
2284
|
updateElementFormat(e, t) {
|
|
2253
|
-
const
|
|
2254
|
-
|
|
2285
|
+
const a = this.getElementAt(e);
|
|
2286
|
+
a && (a.format = { ...a.format, ...t }, this.bumpVersion());
|
|
2255
2287
|
}
|
|
2256
2288
|
/** 批量更新选区内元素格式 */
|
|
2257
|
-
updateRangeFormat(e, t,
|
|
2289
|
+
updateRangeFormat(e, t, a) {
|
|
2258
2290
|
const o = this.getAllParagraphs();
|
|
2259
|
-
let
|
|
2260
|
-
for (const { paragraph:
|
|
2261
|
-
const
|
|
2262
|
-
if (
|
|
2263
|
-
for (let
|
|
2264
|
-
const q =
|
|
2265
|
-
if (!(
|
|
2266
|
-
if (
|
|
2267
|
-
q.format = { ...q.format, ...
|
|
2291
|
+
let u = !1;
|
|
2292
|
+
for (const { paragraph: P, sectionIndex: S, paragraphIndex: z } of o) {
|
|
2293
|
+
const A = S === e.sectionIndex && z === e.paragraphIndex, Z = S === t.sectionIndex && z === t.paragraphIndex;
|
|
2294
|
+
if (A && (u = !0), u)
|
|
2295
|
+
for (let N = 0; N < P.children.length; N++) {
|
|
2296
|
+
const q = P.children[N];
|
|
2297
|
+
if (!(A && N < e.elementIndex)) {
|
|
2298
|
+
if (Z && N > t.elementIndex) break;
|
|
2299
|
+
q.format = { ...q.format, ...a };
|
|
2268
2300
|
}
|
|
2269
2301
|
}
|
|
2270
|
-
if (
|
|
2302
|
+
if (Z) break;
|
|
2271
2303
|
}
|
|
2272
2304
|
this.bumpVersion();
|
|
2273
2305
|
}
|
|
@@ -2280,26 +2312,26 @@ class Ye {
|
|
|
2280
2312
|
}
|
|
2281
2313
|
/** 从 JSON 恢复 */
|
|
2282
2314
|
static fromJSON(e) {
|
|
2283
|
-
const t = JSON.parse(e),
|
|
2284
|
-
return Object.assign(
|
|
2315
|
+
const t = JSON.parse(e), a = new Qe();
|
|
2316
|
+
return Object.assign(a.data, t), a;
|
|
2285
2317
|
}
|
|
2286
2318
|
}
|
|
2287
|
-
function Te(i = 0, e = 0, t = 0,
|
|
2288
|
-
return { sectionIndex: i, paragraphIndex: e, elementIndex: t, offset:
|
|
2319
|
+
function Te(i = 0, e = 0, t = 0, a = 0) {
|
|
2320
|
+
return { sectionIndex: i, paragraphIndex: e, elementIndex: t, offset: a };
|
|
2289
2321
|
}
|
|
2290
2322
|
function Lt(i, e) {
|
|
2291
2323
|
return i.sectionIndex === e.sectionIndex && i.paragraphIndex === e.paragraphIndex && i.elementIndex === e.elementIndex && i.offset === e.offset;
|
|
2292
2324
|
}
|
|
2293
|
-
class
|
|
2325
|
+
class rt {
|
|
2294
2326
|
constructor(e) {
|
|
2295
|
-
|
|
2327
|
+
V(this, "_selection", Bt({
|
|
2296
2328
|
anchor: Te(),
|
|
2297
2329
|
focus: Te(),
|
|
2298
2330
|
isCollapsed: !0
|
|
2299
2331
|
}));
|
|
2300
|
-
|
|
2332
|
+
V(this, "_docModel");
|
|
2301
2333
|
/** 是否有选区(非光标) */
|
|
2302
|
-
|
|
2334
|
+
V(this, "hasSelection", ke(() => !this._selection.isCollapsed));
|
|
2303
2335
|
this._docModel = e;
|
|
2304
2336
|
}
|
|
2305
2337
|
get selection() {
|
|
@@ -2316,32 +2348,32 @@ class st {
|
|
|
2316
2348
|
e ? this._selection.anchor = { ...this._selection.focus } : this._selection.focus = { ...this._selection.anchor }, this._selection.isCollapsed = !0;
|
|
2317
2349
|
}
|
|
2318
2350
|
selectAll() {
|
|
2319
|
-
const e = this._docModel.data.sections, t = e[e.length - 1],
|
|
2351
|
+
const e = this._docModel.data.sections, t = e[e.length - 1], a = t == null ? void 0 : t.paragraphs[t.paragraphs.length - 1], o = a == null ? void 0 : a.children[a.children.length - 1], u = (o == null ? void 0 : o.type) === "text" ? o.value.length : 0;
|
|
2320
2352
|
this._selection.anchor = Te(0, 0, 0, 0), this._selection.focus = Te(
|
|
2321
2353
|
e.length - 1,
|
|
2322
2354
|
((t == null ? void 0 : t.paragraphs.length) ?? 1) - 1,
|
|
2323
|
-
((
|
|
2324
|
-
|
|
2355
|
+
((a == null ? void 0 : a.children.length) ?? 0) === 0 ? 0 : ((a == null ? void 0 : a.children.length) ?? 1) - 1,
|
|
2356
|
+
u
|
|
2325
2357
|
), this._selection.isCollapsed = !1;
|
|
2326
2358
|
}
|
|
2327
2359
|
// ─── 移动光标 ─────────────────────────────────────────────────────────────
|
|
2328
2360
|
/** 光标向前移动一个字符 */
|
|
2329
2361
|
moveForward(e = !1) {
|
|
2330
|
-
const t = this._selection.focus,
|
|
2331
|
-
if (!
|
|
2332
|
-
const o =
|
|
2362
|
+
const t = this._selection.focus, a = this._docModel.getParagraphAt(t.sectionIndex, t.paragraphIndex);
|
|
2363
|
+
if (!a) return;
|
|
2364
|
+
const o = a.children[t.elementIndex];
|
|
2333
2365
|
if ((o == null ? void 0 : o.type) === "text" && t.offset < o.value.length) {
|
|
2334
|
-
const
|
|
2335
|
-
this._applyMove(
|
|
2366
|
+
const P = { ...t, offset: t.offset + 1 };
|
|
2367
|
+
this._applyMove(P, e);
|
|
2336
2368
|
return;
|
|
2337
2369
|
}
|
|
2338
|
-
if (t.elementIndex <
|
|
2339
|
-
const
|
|
2340
|
-
this._applyMove(
|
|
2370
|
+
if (t.elementIndex < a.children.length - 1) {
|
|
2371
|
+
const P = { ...t, elementIndex: t.elementIndex + 1, offset: 0 };
|
|
2372
|
+
this._applyMove(P, e);
|
|
2341
2373
|
return;
|
|
2342
2374
|
}
|
|
2343
|
-
const
|
|
2344
|
-
|
|
2375
|
+
const u = this._getNextParagraphPoint(t);
|
|
2376
|
+
u && this._applyMove(u, e);
|
|
2345
2377
|
}
|
|
2346
2378
|
/** 光标向后移动一个字符 */
|
|
2347
2379
|
moveBackward(e = !1) {
|
|
@@ -2352,12 +2384,12 @@ class st {
|
|
|
2352
2384
|
return;
|
|
2353
2385
|
}
|
|
2354
2386
|
if (t.elementIndex > 0) {
|
|
2355
|
-
const o = this._docModel.getParagraphAt(t.sectionIndex, t.paragraphIndex),
|
|
2356
|
-
this._applyMove(
|
|
2387
|
+
const o = this._docModel.getParagraphAt(t.sectionIndex, t.paragraphIndex), u = o == null ? void 0 : o.children[t.elementIndex - 1], P = (u == null ? void 0 : u.type) === "text" ? u.value.length : 0, S = { ...t, elementIndex: t.elementIndex - 1, offset: P };
|
|
2388
|
+
this._applyMove(S, e);
|
|
2357
2389
|
return;
|
|
2358
2390
|
}
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2391
|
+
const a = this._getPrevParagraphPoint(t);
|
|
2392
|
+
a && this._applyMove(a, e);
|
|
2361
2393
|
}
|
|
2362
2394
|
_applyMove(e, t) {
|
|
2363
2395
|
t ? (this._selection.focus = e, this._selection.isCollapsed = Lt(this._selection.anchor, e)) : (this._selection.anchor = { ...e }, this._selection.focus = { ...e }, this._selection.isCollapsed = !0);
|
|
@@ -2370,14 +2402,14 @@ class st {
|
|
|
2370
2402
|
if (e.paragraphIndex > 0) {
|
|
2371
2403
|
const t = this._docModel.getParagraphAt(e.sectionIndex, e.paragraphIndex - 1);
|
|
2372
2404
|
if (!t) return null;
|
|
2373
|
-
const
|
|
2374
|
-
return Te(e.sectionIndex, e.paragraphIndex - 1, Math.max(
|
|
2405
|
+
const a = t.children.length - 1, o = t.children[a], u = (o == null ? void 0 : o.type) === "text" ? o.value.length : 0;
|
|
2406
|
+
return Te(e.sectionIndex, e.paragraphIndex - 1, Math.max(a, 0), u);
|
|
2375
2407
|
}
|
|
2376
2408
|
if (e.sectionIndex > 0) {
|
|
2377
2409
|
const t = this._docModel.data.sections[e.sectionIndex - 1];
|
|
2378
2410
|
if (!t) return null;
|
|
2379
|
-
const
|
|
2380
|
-
return Te(e.sectionIndex - 1,
|
|
2411
|
+
const a = t.paragraphs.length - 1, o = t.paragraphs[a], u = ((o == null ? void 0 : o.children.length) ?? 0) - 1, P = o == null ? void 0 : o.children[u], S = (P == null ? void 0 : P.type) === "text" ? P.value.length : 0;
|
|
2412
|
+
return Te(e.sectionIndex - 1, a, Math.max(u, 0), S);
|
|
2381
2413
|
}
|
|
2382
2414
|
return null;
|
|
2383
2415
|
}
|
|
@@ -2387,26 +2419,26 @@ class st {
|
|
|
2387
2419
|
* 渲染时每个元素需附带 data-si/data-pi/data-ei 属性
|
|
2388
2420
|
*/
|
|
2389
2421
|
static domToModelPoint(e, t) {
|
|
2390
|
-
let
|
|
2391
|
-
for (;
|
|
2392
|
-
const o =
|
|
2393
|
-
if (o !== null &&
|
|
2422
|
+
let a = e instanceof Element ? e : e.parentElement;
|
|
2423
|
+
for (; a; ) {
|
|
2424
|
+
const o = a.getAttribute("data-si"), u = a.getAttribute("data-pi"), P = a.getAttribute("data-ei");
|
|
2425
|
+
if (o !== null && u !== null && P !== null)
|
|
2394
2426
|
return {
|
|
2395
2427
|
sectionIndex: parseInt(o),
|
|
2396
|
-
paragraphIndex: parseInt(
|
|
2397
|
-
elementIndex: parseInt(
|
|
2428
|
+
paragraphIndex: parseInt(u),
|
|
2429
|
+
elementIndex: parseInt(P),
|
|
2398
2430
|
offset: t
|
|
2399
2431
|
};
|
|
2400
|
-
|
|
2432
|
+
a = a.parentElement;
|
|
2401
2433
|
}
|
|
2402
2434
|
return null;
|
|
2403
2435
|
}
|
|
2404
2436
|
}
|
|
2405
|
-
const
|
|
2406
|
-
class
|
|
2437
|
+
const Gi = 200;
|
|
2438
|
+
class Ji {
|
|
2407
2439
|
constructor() {
|
|
2408
|
-
|
|
2409
|
-
|
|
2440
|
+
V(this, "_undoStack", []);
|
|
2441
|
+
V(this, "_redoStack", []);
|
|
2410
2442
|
}
|
|
2411
2443
|
get canUndo() {
|
|
2412
2444
|
return this._undoStack.length > 0;
|
|
@@ -2419,14 +2451,14 @@ class Xi {
|
|
|
2419
2451
|
* 支持合并连续同类命令(如连续输入文字)
|
|
2420
2452
|
*/
|
|
2421
2453
|
push(e) {
|
|
2422
|
-
var
|
|
2454
|
+
var a, o;
|
|
2423
2455
|
this._redoStack = [];
|
|
2424
2456
|
const t = this._undoStack[this._undoStack.length - 1];
|
|
2425
|
-
if (t && ((
|
|
2457
|
+
if (t && ((a = e.canMergeWith) != null && a.call(e, t))) {
|
|
2426
2458
|
(o = t.merge) == null || o.call(t, e);
|
|
2427
2459
|
return;
|
|
2428
2460
|
}
|
|
2429
|
-
this._undoStack.push(e), this._undoStack.length >
|
|
2461
|
+
this._undoStack.push(e), this._undoStack.length > Gi && this._undoStack.shift();
|
|
2430
2462
|
}
|
|
2431
2463
|
undo() {
|
|
2432
2464
|
const e = this._undoStack.pop();
|
|
@@ -2440,13 +2472,13 @@ class Xi {
|
|
|
2440
2472
|
this._undoStack = [], this._redoStack = [];
|
|
2441
2473
|
}
|
|
2442
2474
|
}
|
|
2443
|
-
class
|
|
2444
|
-
constructor(e, t,
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
this.docModel = e, this.selectionManager = t, this._point = { ...
|
|
2475
|
+
class Xi {
|
|
2476
|
+
constructor(e, t, a, o, u) {
|
|
2477
|
+
V(this, "name", "insertText");
|
|
2478
|
+
V(this, "_point");
|
|
2479
|
+
V(this, "_text");
|
|
2480
|
+
V(this, "_format");
|
|
2481
|
+
this.docModel = e, this.selectionManager = t, this._point = { ...a }, this._text = o, this._format = u;
|
|
2450
2482
|
}
|
|
2451
2483
|
execute() {
|
|
2452
2484
|
this.docModel.insertText(this._point, this._text, this._format), this.selectionManager.setCursor({
|
|
@@ -2467,55 +2499,55 @@ class Yi {
|
|
|
2467
2499
|
this._text += t._text;
|
|
2468
2500
|
}
|
|
2469
2501
|
}
|
|
2470
|
-
class
|
|
2502
|
+
class Yi {
|
|
2471
2503
|
constructor(e, t) {
|
|
2472
|
-
|
|
2473
|
-
|
|
2504
|
+
V(this, "name", "insertParagraph");
|
|
2505
|
+
V(this, "_insertedParagraphId", null);
|
|
2474
2506
|
this.docModel = e, this.selectionManager = t;
|
|
2475
2507
|
}
|
|
2476
2508
|
execute() {
|
|
2477
|
-
var
|
|
2478
|
-
const { focus: e } = this.selectionManager.selection, { sectionIndex: t, paragraphIndex:
|
|
2509
|
+
var z, A;
|
|
2510
|
+
const { focus: e } = this.selectionManager.selection, { sectionIndex: t, paragraphIndex: a } = e, o = this.docModel.getParagraphAt(t, a);
|
|
2479
2511
|
if (!o) return;
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2512
|
+
const u = e.elementIndex, P = o.children.splice(u), S = this.docModel.createEmptyParagraph(o.format);
|
|
2513
|
+
S.children.push(...P), this._insertedParagraphId = S.id, this.docModel.data.sections[t].paragraphs.splice(a + 1, 0, S), (A = (z = this.docModel).bumpVersion) == null || A.call(z), this.selectionManager.setCursor({
|
|
2482
2514
|
sectionIndex: t,
|
|
2483
|
-
paragraphIndex:
|
|
2515
|
+
paragraphIndex: a + 1,
|
|
2484
2516
|
elementIndex: 0,
|
|
2485
2517
|
offset: 0
|
|
2486
2518
|
});
|
|
2487
2519
|
}
|
|
2488
2520
|
undo() {
|
|
2489
|
-
const { focus: e } = this.selectionManager.selection, { sectionIndex: t, paragraphIndex:
|
|
2490
|
-
|
|
2521
|
+
const { focus: e } = this.selectionManager.selection, { sectionIndex: t, paragraphIndex: a } = e;
|
|
2522
|
+
a !== 0 && (this.docModel.mergeParagraphs(t, a - 1), this.selectionManager.setCursor({
|
|
2491
2523
|
sectionIndex: t,
|
|
2492
|
-
paragraphIndex:
|
|
2524
|
+
paragraphIndex: a - 1,
|
|
2493
2525
|
elementIndex: 0,
|
|
2494
2526
|
offset: 0
|
|
2495
2527
|
}));
|
|
2496
2528
|
}
|
|
2497
2529
|
}
|
|
2498
2530
|
class Rt {
|
|
2499
|
-
constructor(e, t,
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
this.docModel = e, this.selectionManager = t, this.name =
|
|
2531
|
+
constructor(e, t, a) {
|
|
2532
|
+
V(this, "name");
|
|
2533
|
+
V(this, "_deletedText", "");
|
|
2534
|
+
this.docModel = e, this.selectionManager = t, this.name = a === "backward" ? "deleteBackward" : "deleteForward";
|
|
2503
2535
|
}
|
|
2504
2536
|
execute() {
|
|
2505
2537
|
const { focus: e, isCollapsed: t } = this.selectionManager.selection;
|
|
2506
2538
|
if (t)
|
|
2507
2539
|
if (this.name === "deleteBackward")
|
|
2508
2540
|
if (e.offset > 0) {
|
|
2509
|
-
const
|
|
2510
|
-
(o == null ? void 0 : o.type) === "text" && (this._deletedText = o.value[e.offset - 1] ?? ""), this.docModel.deleteAt(
|
|
2541
|
+
const a = { ...e, offset: e.offset - 1 }, o = this.docModel.getElementAt(e);
|
|
2542
|
+
(o == null ? void 0 : o.type) === "text" && (this._deletedText = o.value[e.offset - 1] ?? ""), this.docModel.deleteAt(a, 1), this.selectionManager.setCursor(a);
|
|
2511
2543
|
} else (e.paragraphIndex > 0 || e.elementIndex > 0) && (this.docModel.mergeParagraphs(e.sectionIndex, e.paragraphIndex - 1), this.selectionManager.setCursor({
|
|
2512
2544
|
...e,
|
|
2513
2545
|
paragraphIndex: e.paragraphIndex - 1
|
|
2514
2546
|
}));
|
|
2515
2547
|
else {
|
|
2516
|
-
const
|
|
2517
|
-
if ((
|
|
2518
|
-
this._deletedText =
|
|
2548
|
+
const a = this.docModel.getElementAt(e);
|
|
2549
|
+
if ((a == null ? void 0 : a.type) === "text" && e.offset < a.value.length)
|
|
2550
|
+
this._deletedText = a.value[e.offset], this.docModel.deleteAt(e, 1);
|
|
2519
2551
|
else {
|
|
2520
2552
|
const o = this.docModel.data.sections[e.sectionIndex];
|
|
2521
2553
|
o && e.paragraphIndex < o.paragraphs.length - 1 && this.docModel.mergeParagraphs(e.sectionIndex, e.paragraphIndex);
|
|
@@ -2529,21 +2561,21 @@ class Rt {
|
|
|
2529
2561
|
}
|
|
2530
2562
|
}
|
|
2531
2563
|
}
|
|
2532
|
-
class
|
|
2533
|
-
constructor(e, t,
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
this.docModel = e, this.selectionManager = t, this._value = o, this.name =
|
|
2564
|
+
class De {
|
|
2565
|
+
constructor(e, t, a, o) {
|
|
2566
|
+
V(this, "name");
|
|
2567
|
+
V(this, "_prevFormat", {});
|
|
2568
|
+
this.docModel = e, this.selectionManager = t, this._value = o, this.name = a;
|
|
2537
2569
|
}
|
|
2538
2570
|
execute() {
|
|
2539
|
-
const { anchor: e, focus: t } = this.selectionManager.selection,
|
|
2540
|
-
if (!
|
|
2571
|
+
const { anchor: e, focus: t } = this.selectionManager.selection, a = this._getFormatKey();
|
|
2572
|
+
if (!a) return;
|
|
2541
2573
|
const o = {};
|
|
2542
2574
|
if (this._isToggle()) {
|
|
2543
|
-
const
|
|
2544
|
-
o[
|
|
2575
|
+
const u = this._getCurrentValue(a);
|
|
2576
|
+
o[a] = !u;
|
|
2545
2577
|
} else
|
|
2546
|
-
o[
|
|
2578
|
+
o[a] = this._value;
|
|
2547
2579
|
this.docModel.updateRangeFormat(e, t, o);
|
|
2548
2580
|
}
|
|
2549
2581
|
undo() {
|
|
@@ -2567,14 +2599,14 @@ class He {
|
|
|
2567
2599
|
}
|
|
2568
2600
|
_getCurrentValue(e) {
|
|
2569
2601
|
var o;
|
|
2570
|
-
const { focus: t } = this.selectionManager.selection,
|
|
2571
|
-
return (o =
|
|
2602
|
+
const { focus: t } = this.selectionManager.selection, a = this.docModel.getElementAt(t);
|
|
2603
|
+
return (o = a == null ? void 0 : a.format) == null ? void 0 : o[e];
|
|
2572
2604
|
}
|
|
2573
2605
|
}
|
|
2574
|
-
class
|
|
2575
|
-
constructor(e, t,
|
|
2576
|
-
|
|
2577
|
-
this.docModel = e, this.selectionManager = t, this._formatKey =
|
|
2606
|
+
class st {
|
|
2607
|
+
constructor(e, t, a, o) {
|
|
2608
|
+
V(this, "name", "textAlign");
|
|
2609
|
+
this.docModel = e, this.selectionManager = t, this._formatKey = a, this._value = o;
|
|
2578
2610
|
}
|
|
2579
2611
|
execute() {
|
|
2580
2612
|
const { focus: e } = this.selectionManager.selection, t = {};
|
|
@@ -2583,22 +2615,22 @@ class ot {
|
|
|
2583
2615
|
undo() {
|
|
2584
2616
|
}
|
|
2585
2617
|
}
|
|
2586
|
-
class
|
|
2587
|
-
constructor(e, t,
|
|
2588
|
-
|
|
2589
|
-
this.docModel = e, this.selectionManager = t, this.historyManager =
|
|
2618
|
+
class Zi {
|
|
2619
|
+
constructor(e, t, a) {
|
|
2620
|
+
V(this, "_factories", /* @__PURE__ */ new Map());
|
|
2621
|
+
this.docModel = e, this.selectionManager = t, this.historyManager = a, this._registerBuiltinCommands();
|
|
2590
2622
|
}
|
|
2591
2623
|
// ─── 注册内置命令 ─────────────────────────────────────────────────────────
|
|
2592
2624
|
_registerBuiltinCommands() {
|
|
2593
2625
|
this.register("insertText", (t) => {
|
|
2594
|
-
const { focus:
|
|
2595
|
-
return new
|
|
2596
|
-
}), this.register("insertParagraph", () => new
|
|
2597
|
-
this.register(t, () => new
|
|
2598
|
-
}), this.register("fontSize", (t) => new
|
|
2626
|
+
const { focus: a } = this.selectionManager.selection;
|
|
2627
|
+
return new Xi(this.docModel, this.selectionManager, a, t);
|
|
2628
|
+
}), this.register("insertParagraph", () => new Yi(this.docModel, this.selectionManager)), this.register("deleteBackward", () => new Rt(this.docModel, this.selectionManager, "backward")), this.register("deleteForward", () => new Rt(this.docModel, this.selectionManager, "forward")), this.register("undo", () => null), this.register("redo", () => null), ["bold", "italic", "underline", "strikethrough", "superscript", "subscript"].forEach((t) => {
|
|
2629
|
+
this.register(t, () => new De(this.docModel, this.selectionManager, t));
|
|
2630
|
+
}), this.register("fontSize", (t) => new De(this.docModel, this.selectionManager, "fontSize", t)), this.register("fontFamily", (t) => new De(this.docModel, this.selectionManager, "fontFamily", t)), this.register("color", (t) => new De(this.docModel, this.selectionManager, "color", t)), this.register("backgroundColor", (t) => new De(this.docModel, this.selectionManager, "backgroundColor", t)), this.register("textAlign", (t) => new st(this.docModel, this.selectionManager, "textAlign", t)), this.register("lineHeight", (t) => new st(this.docModel, this.selectionManager, "lineHeight", t)), this.register("heading", (t) => new st(this.docModel, this.selectionManager, "heading", t)), this.register("selectAll", () => (this.selectionManager.selectAll(), null)), this.register("setSelection", (t) => {
|
|
2599
2631
|
if (t) {
|
|
2600
|
-
const
|
|
2601
|
-
this.selectionManager.setSelection(
|
|
2632
|
+
const a = t;
|
|
2633
|
+
this.selectionManager.setSelection(a.anchor, a.focus);
|
|
2602
2634
|
}
|
|
2603
2635
|
return null;
|
|
2604
2636
|
});
|
|
@@ -2616,27 +2648,27 @@ class Qi {
|
|
|
2616
2648
|
this.historyManager.redo();
|
|
2617
2649
|
return;
|
|
2618
2650
|
}
|
|
2619
|
-
const
|
|
2620
|
-
if (!
|
|
2651
|
+
const a = this._factories.get(e);
|
|
2652
|
+
if (!a) {
|
|
2621
2653
|
console.warn(`[CommandManager] 未注册命令: ${e}`);
|
|
2622
2654
|
return;
|
|
2623
2655
|
}
|
|
2624
|
-
const o =
|
|
2656
|
+
const o = a(t);
|
|
2625
2657
|
o && (o.execute(), this.historyManager.push(o));
|
|
2626
2658
|
}
|
|
2627
2659
|
}
|
|
2628
|
-
class
|
|
2660
|
+
class Qi {
|
|
2629
2661
|
constructor(e, t) {
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2662
|
+
V(this, "_el", null);
|
|
2663
|
+
V(this, "_commandManager");
|
|
2664
|
+
V(this, "_selectionManager");
|
|
2665
|
+
V(this, "_composing", !1);
|
|
2634
2666
|
// 正在 IME 输入中
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2667
|
+
V(this, "_boundKeydown");
|
|
2668
|
+
V(this, "_boundBeforeInput");
|
|
2669
|
+
V(this, "_boundCompositionStart");
|
|
2670
|
+
V(this, "_boundCompositionEnd");
|
|
2671
|
+
V(this, "_boundSelectionChange");
|
|
2640
2672
|
this._commandManager = e, this._selectionManager = t, this._boundKeydown = this._onKeydown.bind(this), this._boundBeforeInput = this._onBeforeInput.bind(this), this._boundCompositionStart = () => {
|
|
2641
2673
|
this._composing = !0;
|
|
2642
2674
|
}, this._boundCompositionEnd = this._onCompositionEnd.bind(this), this._boundSelectionChange = this._onSelectionChange.bind(this);
|
|
@@ -2649,8 +2681,8 @@ class ea {
|
|
|
2649
2681
|
}
|
|
2650
2682
|
// ─── 事件处理 ─────────────────────────────────────────────────────────────
|
|
2651
2683
|
_onKeydown(e) {
|
|
2652
|
-
const t = e.key,
|
|
2653
|
-
if (
|
|
2684
|
+
const t = e.key, a = e.ctrlKey || e.metaKey, o = e.shiftKey;
|
|
2685
|
+
if (a)
|
|
2654
2686
|
switch (t) {
|
|
2655
2687
|
case "z":
|
|
2656
2688
|
e.preventDefault(), o ? this._commandManager.exec("redo") : this._commandManager.exec("undo");
|
|
@@ -2698,24 +2730,24 @@ class ea {
|
|
|
2698
2730
|
_onSelectionChange() {
|
|
2699
2731
|
const e = window.getSelection();
|
|
2700
2732
|
if (!e || !this._el) return;
|
|
2701
|
-
const t = e.anchorNode,
|
|
2702
|
-
if (!t || !
|
|
2703
|
-
const o =
|
|
2704
|
-
o &&
|
|
2733
|
+
const t = e.anchorNode, a = e.focusNode;
|
|
2734
|
+
if (!t || !a || !this._el.contains(t) && !this._el.contains(a)) return;
|
|
2735
|
+
const o = rt.domToModelPoint(t, e.anchorOffset), u = rt.domToModelPoint(a, e.focusOffset);
|
|
2736
|
+
o && u && this._selectionManager.setSelection(o, u);
|
|
2705
2737
|
}
|
|
2706
2738
|
}
|
|
2707
|
-
class
|
|
2739
|
+
class el {
|
|
2708
2740
|
constructor(e = {}) {
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2741
|
+
V(this, "docModel");
|
|
2742
|
+
V(this, "selection");
|
|
2743
|
+
V(this, "history");
|
|
2744
|
+
V(this, "commands");
|
|
2745
|
+
V(this, "input");
|
|
2746
|
+
V(this, "_readonly");
|
|
2747
|
+
V(this, "_plugins", []);
|
|
2748
|
+
V(this, "_inputEl", null);
|
|
2717
2749
|
var t;
|
|
2718
|
-
this._readonly = e.readonly ?? !1, this.docModel = new
|
|
2750
|
+
this._readonly = e.readonly ?? !1, this.docModel = new Qe(e.initialDocument), this.selection = new rt(this.docModel), this.history = new Ji(), this.commands = new Zi(this.docModel, this.selection, this.history), this.input = new Qi(this.commands, this.selection), (t = e.plugins) == null || t.forEach((a) => this.use(a));
|
|
2719
2751
|
}
|
|
2720
2752
|
// ─── 公共 API ─────────────────────────────────────────────────────────────
|
|
2721
2753
|
/**
|
|
@@ -2749,7 +2781,7 @@ class ta {
|
|
|
2749
2781
|
}
|
|
2750
2782
|
/** 从 JSON 加载文档(清空历史) */
|
|
2751
2783
|
loadJSON(e) {
|
|
2752
|
-
const t =
|
|
2784
|
+
const t = Qe.fromJSON(e);
|
|
2753
2785
|
Object.assign(this.docModel.data, t.data), this.history.clear();
|
|
2754
2786
|
}
|
|
2755
2787
|
get isReadonly() {
|
|
@@ -2760,28 +2792,28 @@ class ta {
|
|
|
2760
2792
|
}
|
|
2761
2793
|
}
|
|
2762
2794
|
const Nt = Symbol("editor");
|
|
2763
|
-
function
|
|
2764
|
-
const e = new
|
|
2765
|
-
return vn(Nt, e),
|
|
2795
|
+
function ol(i) {
|
|
2796
|
+
const e = new el(i);
|
|
2797
|
+
return vn(Nt, e), et(() => {
|
|
2766
2798
|
e.unmount();
|
|
2767
2799
|
}), e;
|
|
2768
2800
|
}
|
|
2769
|
-
function
|
|
2801
|
+
function sl() {
|
|
2770
2802
|
const i = mn(Nt);
|
|
2771
2803
|
if (!i)
|
|
2772
2804
|
throw new Error("[useEditor] 必须在 EditorContainer 组件内使用");
|
|
2773
2805
|
return i;
|
|
2774
2806
|
}
|
|
2775
|
-
const
|
|
2807
|
+
const tl = Ui, rl = {
|
|
2776
2808
|
install(i) {
|
|
2777
|
-
i.component("EditorContainer",
|
|
2809
|
+
i.component("EditorContainer", tl);
|
|
2778
2810
|
}
|
|
2779
2811
|
};
|
|
2780
2812
|
export {
|
|
2781
|
-
|
|
2782
|
-
|
|
2813
|
+
el as Editor,
|
|
2814
|
+
tl as EditorContainer,
|
|
2783
2815
|
Nt as EditorKey,
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2816
|
+
ol as createEditor,
|
|
2817
|
+
rl as default,
|
|
2818
|
+
sl as useEditor
|
|
2787
2819
|
};
|