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