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