@bireturn/word-editor 1.0.8 → 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 +919 -908
- package/lib/word-editor.umd.js +2 -2
- package/package.json +1 -1
package/lib/word-editor.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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
3
|
var N = (t, e, n) => bn(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { computed as
|
|
5
|
-
import { DynamicScroller as
|
|
6
|
-
import { ChevronRight as
|
|
7
|
-
const
|
|
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
|
+
import { DynamicScroller as En, DynamicScrollerItem as Sn } from "vue-virtual-scroller";
|
|
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
|
+
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"
|
|
10
|
-
},
|
|
10
|
+
}, ii = ["onClick"], li = { class: "we-vt-context-menu--link-content submenu-label" }, oi = {
|
|
11
11
|
__name: "ContextMenu",
|
|
12
12
|
props: {
|
|
13
13
|
// 事件
|
|
@@ -30,243 +30,243 @@ const Qn = { 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 D,
|
|
33
|
+
const n = e, l = t, o = de(() => {
|
|
34
|
+
var D, T;
|
|
35
35
|
return {
|
|
36
36
|
left: `${(D = l.e) == null ? void 0 : D.pageX}px`,
|
|
37
|
-
top: `${(
|
|
37
|
+
top: `${(T = l.e) == null ? void 0 : T.pageY}px`
|
|
38
38
|
};
|
|
39
|
-
}), s =
|
|
39
|
+
}), s = te([]), v = te(null);
|
|
40
40
|
let m = null;
|
|
41
|
-
const y =
|
|
41
|
+
const y = te(), r = (D, T, h) => {
|
|
42
42
|
if (D.children && D.children.length > 0) {
|
|
43
|
-
|
|
43
|
+
T && T.preventDefault() && T.stopPropagation();
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
D.disabled || (h ? n("menuClick", { ...D, parent: h.code }, l.row) : n("menuClick", D, l.row)),
|
|
46
|
+
D.disabled || (h ? n("menuClick", { ...D, parent: h.code }, l.row) : n("menuClick", D, l.row)), T && T.preventDefault() && T.stopPropagation();
|
|
47
47
|
}, M = (D) => {
|
|
48
|
-
let
|
|
49
|
-
for (;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
D.currentTarget.classList.add("link--active"), m && (clearTimeout(m), m = null),
|
|
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
54
|
v.value = null;
|
|
55
55
|
}, 100);
|
|
56
|
-
},
|
|
57
|
-
D.currentTarget.classList.remove("link--active"),
|
|
58
|
-
v.value ===
|
|
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
60
|
}, B = (D) => {
|
|
61
61
|
m && (clearTimeout(m), m = null), D.currentTarget.classList.add("link--active");
|
|
62
|
-
},
|
|
62
|
+
}, W = (D) => {
|
|
63
63
|
D.currentTarget.classList.remove("link--active");
|
|
64
|
-
},
|
|
65
|
-
const
|
|
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
|
-
copy:
|
|
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
|
-
excel:
|
|
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
|
-
collapse:
|
|
107
|
+
collapse: jn,
|
|
108
108
|
// 折叠
|
|
109
109
|
// 排序和过滤
|
|
110
|
-
"sort-asc":
|
|
110
|
+
"sort-asc": Vn,
|
|
111
111
|
// 升序
|
|
112
|
-
"sort-desc":
|
|
112
|
+
"sort-desc": Nn,
|
|
113
113
|
// 降序
|
|
114
|
-
filter:
|
|
114
|
+
filter: zn,
|
|
115
115
|
// 过滤
|
|
116
|
-
search:
|
|
116
|
+
search: Dn,
|
|
117
117
|
// 搜索
|
|
118
118
|
// 权限操作
|
|
119
|
-
permission:
|
|
119
|
+
permission: Bn,
|
|
120
120
|
// 权限设置
|
|
121
|
-
share:
|
|
121
|
+
share: On,
|
|
122
122
|
// 分享
|
|
123
|
-
lock:
|
|
123
|
+
lock: Hn,
|
|
124
124
|
// 锁定
|
|
125
|
-
unlock:
|
|
125
|
+
unlock: Rn,
|
|
126
126
|
// 解锁
|
|
127
127
|
// 其他操作
|
|
128
|
-
info:
|
|
128
|
+
info: Ln,
|
|
129
129
|
// 信息
|
|
130
|
-
settings:
|
|
130
|
+
settings: $n,
|
|
131
131
|
// 设置
|
|
132
|
-
history:
|
|
132
|
+
history: Pn,
|
|
133
133
|
// 历史
|
|
134
|
-
refresh:
|
|
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 D,
|
|
149
|
-
(D = l.menuConfig) != null && D.visibleMethod && typeof ((
|
|
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
|
-
})), s.value = (((
|
|
153
|
-
}),
|
|
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
154
|
document.removeEventListener("click", M, !0);
|
|
155
|
-
}), (D,
|
|
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
158
|
ref: y,
|
|
159
159
|
style: V([{ display: "inline-block" }, o.value])
|
|
160
160
|
}, [
|
|
161
|
-
|
|
162
|
-
(u(!0), g(
|
|
163
|
-
class:
|
|
161
|
+
ne("ul", Zn, [
|
|
162
|
+
(u(!0), g(G, null, Q(s.value, (h) => (u(), g("li", {
|
|
163
|
+
class: Pe({
|
|
164
164
|
"link--disabled": h.disabled,
|
|
165
165
|
"has-children": h.children && h.children.length > 0,
|
|
166
166
|
"modern-menu-item": !0
|
|
167
167
|
}),
|
|
168
168
|
key: h.code,
|
|
169
|
-
onMouseenter: (
|
|
170
|
-
onMouseleave: (
|
|
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
|
-
h.children && h.children.length > 0 ? (u(),
|
|
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
|
-
})) :
|
|
186
|
-
], 8,
|
|
187
|
-
h.children && h.children.length > 0 && v.value === h.code ? (u(), g("ul",
|
|
188
|
-
(u(!0), g(
|
|
189
|
-
key:
|
|
190
|
-
class:
|
|
191
|
-
"link--disabled":
|
|
185
|
+
})) : ve("", !0)
|
|
186
|
+
], 8, ei),
|
|
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
194
|
onMouseenter: B,
|
|
195
|
-
onMouseleave:
|
|
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
|
-
|
|
206
|
-
], 8,
|
|
205
|
+
ne("span", li, Y(F.name), 1)
|
|
206
|
+
], 8, ii)
|
|
207
207
|
], 34))), 128))
|
|
208
|
-
])) :
|
|
209
|
-
], 42,
|
|
208
|
+
])) : ve("", !0)
|
|
209
|
+
], 42, Qn))), 128))
|
|
210
210
|
])
|
|
211
211
|
], 4));
|
|
212
212
|
}
|
|
213
|
-
},
|
|
214
|
-
function
|
|
215
|
-
const l =
|
|
216
|
-
return document.body.appendChild(o), l[
|
|
213
|
+
}, Jt = Symbol("component_container");
|
|
214
|
+
function ai(t, e, n) {
|
|
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
|
-
function
|
|
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
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
},
|
|
223
|
+
let Xt;
|
|
224
|
+
const ri = (t) => {
|
|
225
|
+
Xt = ai(oi, t, null);
|
|
226
|
+
}, ci = function(t) {
|
|
227
227
|
const e = t.onClose;
|
|
228
228
|
return t.onClose = () => {
|
|
229
|
-
e && e.call(),
|
|
230
|
-
},
|
|
229
|
+
e && e.call(), si(Xt);
|
|
230
|
+
}, ri(t), t;
|
|
231
231
|
};
|
|
232
|
-
function
|
|
232
|
+
function di(t, e, n) {
|
|
233
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
236
|
const v = {};
|
|
237
237
|
t.forEach((M) => {
|
|
238
|
-
const
|
|
239
|
-
v[
|
|
238
|
+
const x = M[o];
|
|
239
|
+
v[x] || (v[x] = []), v[x].push(M);
|
|
240
240
|
});
|
|
241
241
|
function m(M) {
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
(B,
|
|
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
251
|
let y = [];
|
|
252
252
|
if (Array.isArray(e))
|
|
253
253
|
y = e;
|
|
254
254
|
else {
|
|
255
|
-
const M = new Set(t.map((B) => B[l])),
|
|
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
|
-
}), y = Object.entries(
|
|
258
|
+
const $ = {};
|
|
259
|
+
x.forEach((B) => {
|
|
260
|
+
const W = B[o];
|
|
261
|
+
$[W] = ($[W] || 0) + 1;
|
|
262
|
+
}), y = Object.entries($).map(([B]) => B);
|
|
263
263
|
}
|
|
264
264
|
let r = [];
|
|
265
265
|
return y.forEach((M) => {
|
|
266
266
|
r = r.concat(m(M));
|
|
267
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)
|
|
@@ -277,10 +277,10 @@ function Rt(t, e, n) {
|
|
|
277
277
|
}
|
|
278
278
|
return l;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function ui(t) {
|
|
281
281
|
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !wn(t);
|
|
282
282
|
}
|
|
283
|
-
const
|
|
283
|
+
const hi = /* @__PURE__ */ xn({
|
|
284
284
|
name: "VirtualTable",
|
|
285
285
|
props: {
|
|
286
286
|
data: {
|
|
@@ -360,26 +360,26 @@ const fi = /* @__PURE__ */ _n({
|
|
|
360
360
|
slots: n,
|
|
361
361
|
expose: l
|
|
362
362
|
}) {
|
|
363
|
-
var
|
|
364
|
-
const o = kn(), s =
|
|
363
|
+
var Mt;
|
|
364
|
+
const o = kn(), s = te(), v = te(!1), m = te(null), y = te(null), r = te([]);
|
|
365
365
|
let M = /* @__PURE__ */ new Map();
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
const B =
|
|
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
372
|
return Array.isArray(r.value) ? r.value : [];
|
|
373
373
|
} catch {
|
|
374
374
|
return [];
|
|
375
375
|
}
|
|
376
|
-
}),
|
|
376
|
+
}), X = (i) => {
|
|
377
377
|
var p, d, f;
|
|
378
378
|
if (!i) return 30;
|
|
379
379
|
if (i.height) return i.height;
|
|
380
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 (
|
|
382
|
-
const k =
|
|
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,45 +399,45 @@ const fi = /* @__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
|
-
},
|
|
412
|
-
if (
|
|
413
|
-
const i =
|
|
411
|
+
}, ue = de(() => {
|
|
412
|
+
if (E.value.length === 0) return 30;
|
|
413
|
+
const i = E.value.slice(0, Math.min(100, E.value.length));
|
|
414
414
|
if (i.length === 0) return 30;
|
|
415
|
-
const a = i.reduce((p, d) => p +
|
|
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
|
-
},
|
|
423
|
+
}), z == null || z.onClose(), z = null;
|
|
424
|
+
}, Ce = (i) => {
|
|
425
425
|
var c, p, d, f, k;
|
|
426
426
|
if (!((d = (p = (c = t.menuConfig) == null ? void 0 : c.body) == null ? void 0 : p.options) != null && d.length)) return;
|
|
427
|
-
|
|
427
|
+
z == null || z.onClose(), z = null;
|
|
428
428
|
let a = i.target;
|
|
429
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
|
-
},
|
|
440
|
+
}, Je = (i) => {
|
|
441
441
|
var c, p, d;
|
|
442
442
|
if (!m.value)
|
|
443
443
|
return;
|
|
@@ -451,12 +451,12 @@ const fi = /* @__PURE__ */ _n({
|
|
|
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,9 +464,9 @@ const fi = /* @__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
|
-
|
|
469
|
+
$.value = [{
|
|
470
470
|
items: r.value,
|
|
471
471
|
startIndex: 0,
|
|
472
472
|
endIndex: r.value.length
|
|
@@ -485,50 +485,50 @@ const fi = /* @__PURE__ */ _n({
|
|
|
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
496
|
} = t.pageConfig, d = Math.max(100, i - a * 2 - c - 20), f = [];
|
|
497
|
-
let k = [], w = 0, b = 0,
|
|
498
|
-
r.value.forEach((C,
|
|
499
|
-
const
|
|
497
|
+
let k = [], w = 0, b = 0, _ = 1;
|
|
498
|
+
r.value.forEach((C, A) => {
|
|
499
|
+
const R = X(C);
|
|
500
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(
|
|
511
|
+
pageNumber: _++
|
|
512
|
+
}), k = [C], w = Math.min(R, d), b = A) : (k.push(C), w += R);
|
|
513
513
|
}), k.length > 0 && f.push({
|
|
514
514
|
items: k,
|
|
515
515
|
startIndex: b,
|
|
516
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 p = (t.treeConfig ?
|
|
528
|
-
const w = f[t.rowConfig.keyField], b =
|
|
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
529
|
if (!b || b.content !== f.content || b.content_type !== f.content_type) {
|
|
530
|
-
|
|
531
|
-
const
|
|
530
|
+
P.add(w);
|
|
531
|
+
const _ = {
|
|
532
532
|
...f,
|
|
533
533
|
index: k,
|
|
534
534
|
_editing: f._editing || !1,
|
|
@@ -537,29 +537,29 @@ const fi = /* @__PURE__ */ _n({
|
|
|
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
|
-
r.value = p,
|
|
544
|
+
r.value = p, he();
|
|
545
545
|
const d = new Set(p.map((f) => f[t.rowConfig.keyField]));
|
|
546
|
-
for (const [f] of
|
|
547
|
-
d.has(f) || (
|
|
546
|
+
for (const [f] of x)
|
|
547
|
+
d.has(f) || (x.delete(f), P.delete(f));
|
|
548
548
|
} catch {
|
|
549
|
-
r.value = [],
|
|
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
|
});
|
|
@@ -570,22 +570,22 @@ const fi = /* @__PURE__ */ _n({
|
|
|
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
|
}, {
|
|
@@ -593,77 +593,77 @@ const fi = /* @__PURE__ */ _n({
|
|
|
593
593
|
}), Ke(y, () => e("current-change", {
|
|
594
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
600
|
for (const p of i) {
|
|
601
601
|
const d = (a = p.target.dataset) == null ? void 0 : a.id;
|
|
602
602
|
if (!d) continue;
|
|
603
|
-
const f =
|
|
603
|
+
const f = Ae(d);
|
|
604
604
|
if (!f) continue;
|
|
605
|
-
const k = p.contentRect.height, w = ((c =
|
|
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
620
|
const i = (c = s.value) == null ? void 0 : c.$el;
|
|
621
621
|
if (!i) return;
|
|
622
622
|
i.querySelectorAll("[data-id]").forEach((p) => {
|
|
623
|
-
p.dataset.id &&
|
|
623
|
+
p.dataset.id && Me.observe(p);
|
|
624
624
|
});
|
|
625
625
|
}));
|
|
626
|
-
},
|
|
627
|
-
h.value && (h.value.disconnect(), h.value = null),
|
|
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
633
|
B.value.add(c);
|
|
634
|
-
for (let p = Math.max(0, c - D); p <= Math.min(
|
|
635
|
-
|
|
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
637
|
B.value.delete(c), setTimeout(() => {
|
|
638
|
-
B.value.has(c) || Array.from(B.value).some((d) => Math.abs(d - c) <= D * 2) ||
|
|
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
|
-
|
|
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
658
|
}), v.value = !0;
|
|
659
|
-
}),
|
|
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
668
|
const i = (a = s.value) == null ? void 0 : a.$el;
|
|
669
669
|
i && (i.addEventListener("click", this.handleClick.bind(this), {
|
|
@@ -676,15 +676,15 @@ const fi = /* @__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, p =
|
|
680
|
-
p &&
|
|
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, p =
|
|
687
|
+
const c = a.dataset.id, p = Ae(c);
|
|
688
688
|
p && Ve(p);
|
|
689
689
|
},
|
|
690
690
|
cleanup() {
|
|
@@ -692,33 +692,33 @@ const fi = /* @__PURE__ */ _n({
|
|
|
692
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
702
|
}, c, p) => {
|
|
703
703
|
var k, w;
|
|
704
|
-
const d = p || c.target, f =
|
|
705
|
-
|
|
706
|
-
var
|
|
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
707
|
m.value = i;
|
|
708
|
-
let b = (
|
|
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 fi = /* @__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
738
|
}, c, p) => {
|
|
739
739
|
var f;
|
|
740
740
|
const d = p || c.target;
|
|
741
|
-
|
|
742
|
-
var b,
|
|
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,86 +779,86 @@ const fi = /* @__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
|
-
},
|
|
785
|
+
((a = t.editConfig) == null ? void 0 : a.trigger) === "contenteditable" && ee("focusin", i);
|
|
786
|
+
}, oe = (i) => {
|
|
787
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
|
-
},
|
|
795
|
+
ee("focusout", i);
|
|
796
|
+
}, ee = (i, a) => {
|
|
797
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, p, d, f, k, w, b,
|
|
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
864
|
var p, d, f, k;
|
|
@@ -867,22 +867,22 @@ const fi = /* @__PURE__ */ _n({
|
|
|
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 fi = /* @__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
901
|
const a = r.value.findIndex((p) => p[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
|
|
902
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
904
|
const a = r.value.findIndex((c) => c[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
|
|
905
905
|
return a >= r.value.length - 1 ? null : r.value[a + 1];
|
|
906
|
-
},
|
|
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
|
-
|
|
913
|
+
Ze && cancelAnimationFrame(Ze), Ze = requestAnimationFrame(() => {
|
|
914
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 f = 0; f <
|
|
919
|
-
if (
|
|
918
|
+
for (let f = 0; f < $.value.length; f++)
|
|
919
|
+
if ($.value[f].items.some((b) => b[a] === c)) {
|
|
920
920
|
d = f;
|
|
921
921
|
break;
|
|
922
922
|
}
|
|
923
923
|
if (d !== -1) {
|
|
924
|
-
for (let f = Math.max(0, d - 1); f <= Math.min(
|
|
925
|
-
|
|
926
|
-
|
|
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
927
|
const f = document.querySelector(".a4-pages-container");
|
|
928
928
|
if (!f) return;
|
|
929
929
|
const k = (w = 0) => {
|
|
930
930
|
const b = f.querySelector(`[data-id="${c}"]`);
|
|
931
931
|
if (b) {
|
|
932
|
-
let
|
|
932
|
+
let _ = 0, C = b;
|
|
933
933
|
for (; C && C !== f; )
|
|
934
|
-
|
|
935
|
-
const
|
|
936
|
-
let
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
const
|
|
940
|
-
const je =
|
|
941
|
-
f.scrollTop =
|
|
942
|
-
f.scrollTop =
|
|
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);
|
|
@@ -959,12 +959,12 @@ const fi = /* @__PURE__ */ _n({
|
|
|
959
959
|
const d = r.value.findIndex((f) => f[a] === c);
|
|
960
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
966
|
if (!v.value) {
|
|
967
|
-
setTimeout(() =>
|
|
967
|
+
setTimeout(() => Qe(i), 200);
|
|
968
968
|
return;
|
|
969
969
|
}
|
|
970
970
|
y.value = i, y.value !== m.value && m.value && (m.value._editing = !1, setTimeout(() => {
|
|
@@ -998,44 +998,44 @@ const fi = /* @__PURE__ */ _n({
|
|
|
998
998
|
}), c(!0);
|
|
999
999
|
}));
|
|
1000
1000
|
}
|
|
1001
|
-
}), ln = (i) => Ve(i),
|
|
1002
|
-
if (
|
|
1001
|
+
}), ln = (i) => Ve(i), ut = () => {
|
|
1002
|
+
if (he(), t.pageConfig.enabled) {
|
|
1003
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
|
-
|
|
1015
|
+
Se(() => {
|
|
1016
1016
|
!t.pageConfig.enabled && s.value && s.value.$forceUpdate && s.value.$forceUpdate();
|
|
1017
1017
|
});
|
|
1018
1018
|
}, on = (i, a) => new Promise((c) => {
|
|
1019
1019
|
let p = -1;
|
|
1020
1020
|
if (a == -1) {
|
|
1021
|
-
const d =
|
|
1021
|
+
const d = Ae(i.parent_id);
|
|
1022
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
1023
|
p += 1;
|
|
1024
1024
|
} else
|
|
1025
1025
|
p = r.value.findIndex((d) => d[t.rowConfig.keyField] == a[t.rowConfig.keyField]);
|
|
1026
|
-
M.set(i.node_id, i),
|
|
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
1030
|
const p = r.value.findIndex((d) => d[t.rowConfig.keyField] == a[t.rowConfig.keyField]) + 1;
|
|
1031
|
-
M.set(i.node_id, i),
|
|
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
|
-
}),
|
|
1034
|
+
}), xt = (i) => {
|
|
1035
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
|
-
M.delete(i.node_id),
|
|
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;
|
|
@@ -1050,20 +1050,20 @@ const fi = /* @__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
1058
|
y.value = {};
|
|
1059
|
-
},
|
|
1059
|
+
}, kt = (i) => {
|
|
1060
1060
|
var c, p, d;
|
|
1061
1061
|
let a = r.value.findIndex((f) => f[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
|
|
1062
1062
|
if (a > -1 && t.treeConfig) {
|
|
1063
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
1064
|
b.set(i[f], !0);
|
|
1065
|
-
for (let
|
|
1066
|
-
const C = r.value[
|
|
1065
|
+
for (let _ = a + 1; _ < r.value.length; _++) {
|
|
1066
|
+
const C = r.value[_];
|
|
1067
1067
|
if (C && b.has(C[k]))
|
|
1068
1068
|
w.push(C), b.set(C[f]);
|
|
1069
1069
|
else
|
|
@@ -1074,13 +1074,13 @@ const fi = /* @__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:
|
|
1083
|
+
setCurrentRow: Qe,
|
|
1084
1084
|
setEditRow: Ve,
|
|
1085
1085
|
setEditCell: ln,
|
|
1086
1086
|
insertAt: on,
|
|
@@ -1089,12 +1089,12 @@ const fi = /* @__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) => {
|
|
@@ -1105,7 +1105,7 @@ const fi = /* @__PURE__ */ _n({
|
|
|
1105
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,33 +1119,33 @@ const fi = /* @__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 && y.value ?
|
|
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
1138
|
}, gn = (i, a, c, p) => {
|
|
1139
|
-
|
|
1140
|
-
|
|
1139
|
+
nt && cancelAnimationFrame(nt), nt = requestAnimationFrame(() => {
|
|
1140
|
+
Ct.value = {
|
|
1141
1141
|
viewStartIndex: i,
|
|
1142
1142
|
viewEndIndex: a,
|
|
1143
1143
|
visibleStartIndex: c,
|
|
1144
1144
|
visibleEndIndex: p
|
|
1145
|
-
},
|
|
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
1151
|
margin: p,
|
|
@@ -1154,34 +1154,35 @@ const fi = /* @__PURE__ */ _n({
|
|
|
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 ? {
|
|
@@ -1189,55 +1190,55 @@ const fi = /* @__PURE__ */ _n({
|
|
|
1189
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 {
|
|
@@ -1248,26 +1249,26 @@ const fi = /* @__PURE__ */ _n({
|
|
|
1248
1249
|
showPageBorder: d,
|
|
1249
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
1269
|
marginBottom: `${p}px`,
|
|
1269
|
-
padding:
|
|
1270
|
-
paddingBottom:
|
|
1270
|
+
padding: _ ? `${d ? c - f : c}px` : "0",
|
|
1271
|
+
paddingBottom: _ ? "12px" : "0",
|
|
1271
1272
|
boxSizing: "border-box",
|
|
1272
1273
|
position: "relative"
|
|
1273
1274
|
}
|
|
@@ -1275,37 +1276,37 @@ const fi = /* @__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
|
+
}, [Oe.value.map((a) => {
|
|
1283
1284
|
var c, p, d;
|
|
1284
|
-
return
|
|
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
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
|
+
})]) : void 0, q(En, {
|
|
1296
1297
|
ref: s,
|
|
1297
|
-
items:
|
|
1298
|
-
minItemSize:
|
|
1298
|
+
items: E.value,
|
|
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,
|
|
@@ -1314,7 +1315,7 @@ const fi = /* @__PURE__ */ _n({
|
|
|
1314
1315
|
}) => {
|
|
1315
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
1321
|
active: p,
|
|
@@ -1326,19 +1327,19 @@ const fi = /* @__PURE__ */ _n({
|
|
|
1326
1327
|
"virtual-table-row": !0,
|
|
1327
1328
|
"we-vt-body--row": !0,
|
|
1328
1329
|
"row--current": a[t.rowConfig.keyField] === ((k = y.value) == null ? void 0 : k[t.rowConfig.keyField]) || // 如果是树,并且配置了childCurrent高亮子节点
|
|
1329
|
-
((w = t.treeConfig) == null ? void 0 : w.childCurrent) &&
|
|
1330
|
+
((w = t.treeConfig) == null ? void 0 : w.childCurrent) && wt.value.includes(a[t.rowConfig.keyField])
|
|
1330
1331
|
}
|
|
1331
|
-
},
|
|
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 fi = /* @__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
|
-
},
|
|
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 fi = /* @__PURE__ */ _n({
|
|
|
1363
1364
|
width: [String, Number]
|
|
1364
1365
|
}
|
|
1365
1366
|
};
|
|
1366
|
-
function
|
|
1367
|
+
function pi(t, e, n, l, o, s) {
|
|
1367
1368
|
return Cn(t.$slots, "default");
|
|
1368
1369
|
}
|
|
1369
|
-
const
|
|
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,96 +1379,96 @@ const mi = /* @__PURE__ */ ze(pi, [["render", vi]]), yi = { class: "catalog-node
|
|
|
1378
1379
|
},
|
|
1379
1380
|
emits: ["navigate"],
|
|
1380
1381
|
setup(t, { emit: e }) {
|
|
1381
|
-
const n = t, l = e, o =
|
|
1382
|
+
const n = t, l = e, o = te(!0), s = de(() => n.item.children && n.item.children.length > 0);
|
|
1382
1383
|
function v(m) {
|
|
1383
1384
|
m.stopPropagation(), o.value = !o.value;
|
|
1384
1385
|
}
|
|
1385
1386
|
return (m, y) => {
|
|
1386
1387
|
const r = Mn("CatalogNode", !0);
|
|
1387
|
-
return u(), g("div",
|
|
1388
|
-
|
|
1389
|
-
class:
|
|
1388
|
+
return u(), g("div", mi, [
|
|
1389
|
+
ne("div", {
|
|
1390
|
+
class: Pe(["catalog-node__label", { "is-active": t.activeId === t.item.nodeId }]),
|
|
1390
1391
|
style: V({ paddingLeft: 10 + t.depth * 14 + "px" }),
|
|
1391
1392
|
title: t.item.name,
|
|
1392
1393
|
onClick: y[0] || (y[0] = (M) => l("navigate", t.item))
|
|
1393
1394
|
}, [
|
|
1394
|
-
|
|
1395
|
+
ne("span", {
|
|
1395
1396
|
class: "catalog-node__toggle",
|
|
1396
1397
|
onClick: v
|
|
1397
1398
|
}, [
|
|
1398
|
-
s.value ? (u(),
|
|
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
|
-
], 14,
|
|
1404
|
+
ne("span", bi, Y(t.item.name || "(无标题)"), 1)
|
|
1405
|
+
], 14, yi),
|
|
1405
1406
|
s.value && o.value ? (u(), g("div", _i, [
|
|
1406
|
-
(u(!0), g(
|
|
1407
|
+
(u(!0), g(G, null, Q(t.item.children, (M) => (u(), Fe(r, {
|
|
1407
1408
|
key: M.nodeId,
|
|
1408
1409
|
item: M,
|
|
1409
1410
|
depth: t.depth + 1,
|
|
1410
1411
|
"active-id": t.activeId,
|
|
1411
|
-
onNavigate: y[1] || (y[1] = (
|
|
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
|
-
},
|
|
1418
|
+
}, ki = /* @__PURE__ */ Ne(xi, [["__scopeId", "data-v-ac882917"]]), wi = {
|
|
1418
1419
|
key: 0,
|
|
1419
1420
|
class: "catalog catalog--collapsed"
|
|
1420
|
-
},
|
|
1421
|
+
}, Ci = {
|
|
1421
1422
|
key: 1,
|
|
1422
1423
|
class: "catalog"
|
|
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
|
+
const n = e, l = te(!1), o = te("");
|
|
1434
1435
|
function s(v) {
|
|
1435
1436
|
o.value = v.nodeId, n("navigate", v);
|
|
1436
1437
|
}
|
|
1437
|
-
return (v, m) => l.value ? (u(), g("div",
|
|
1438
|
-
|
|
1438
|
+
return (v, m) => l.value ? (u(), g("div", wi, [
|
|
1439
|
+
ne("button", {
|
|
1439
1440
|
class: "catalog__icon-btn",
|
|
1440
1441
|
title: "展开目录",
|
|
1441
1442
|
onClick: m[0] || (m[0] = (y) => l.value = !1)
|
|
1442
1443
|
}, [
|
|
1443
|
-
|
|
1444
|
+
q(K(Jn), { size: 18 })
|
|
1444
1445
|
])
|
|
1445
|
-
])) : (u(), g("div",
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
m[2] || (m[2] =
|
|
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
1455
|
onClick: m[1] || (m[1] = (y) => l.value = !0)
|
|
1455
1456
|
}, [
|
|
1456
|
-
|
|
1457
|
+
q(K(Yn), { size: 18 })
|
|
1457
1458
|
])
|
|
1458
1459
|
]),
|
|
1459
|
-
|
|
1460
|
-
(u(!0), g(
|
|
1460
|
+
ne("div", Ei, [
|
|
1461
|
+
(u(!0), g(G, null, Q(t.items, (y) => (u(), Fe(ki, {
|
|
1461
1462
|
key: y.nodeId,
|
|
1462
1463
|
item: y,
|
|
1463
1464
|
"active-id": o.value,
|
|
1464
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,
|
|
@@ -1475,13 +1476,13 @@ const mi = /* @__PURE__ */ ze(pi, [["render", vi]]), yi = { class: "catalog-node
|
|
|
1475
1476
|
fifth: 5,
|
|
1476
1477
|
sixth: 6
|
|
1477
1478
|
};
|
|
1478
|
-
function
|
|
1479
|
-
return t.blockType !== "title" || !t.level ? 0 :
|
|
1479
|
+
function Pi(t) {
|
|
1480
|
+
return t.blockType !== "title" || !t.level ? 0 : Ai[t.level] || 1;
|
|
1480
1481
|
}
|
|
1481
|
-
function
|
|
1482
|
+
function $i(t) {
|
|
1482
1483
|
const e = [];
|
|
1483
1484
|
for (const o of t || []) {
|
|
1484
|
-
const s =
|
|
1485
|
+
const s = Pi(o);
|
|
1485
1486
|
s && e.push({
|
|
1486
1487
|
id: o.node_id,
|
|
1487
1488
|
nodeId: o.node_id,
|
|
@@ -1501,7 +1502,7 @@ function Li(t) {
|
|
|
1501
1502
|
}
|
|
1502
1503
|
return l;
|
|
1503
1504
|
}
|
|
1504
|
-
const
|
|
1505
|
+
const Li = {
|
|
1505
1506
|
first: 0,
|
|
1506
1507
|
second: 1,
|
|
1507
1508
|
third: 2,
|
|
@@ -1511,7 +1512,7 @@ const Ri = {
|
|
|
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; ) {
|
|
@@ -1520,47 +1521,47 @@ function it(t, e) {
|
|
|
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
|
-
function
|
|
1542
|
+
function Ri() {
|
|
1542
1543
|
const t = new Array(8).fill(0);
|
|
1543
1544
|
return {
|
|
1544
1545
|
next(e, n) {
|
|
1545
|
-
const l =
|
|
1546
|
+
const l = Li[e];
|
|
1546
1547
|
if (l == null) return "";
|
|
1547
1548
|
t[l]++;
|
|
1548
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 We = 14,
|
|
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,19 +1580,24 @@ function Xt(t) {
|
|
|
1579
1580
|
continue;
|
|
1580
1581
|
}
|
|
1581
1582
|
if (o && o.type === "area") {
|
|
1582
|
-
const s =
|
|
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
|
}
|
|
1595
|
+
const Oi = (t) => t == null ? void 0 : t.some((e) => e._isCover);
|
|
1590
1596
|
function Ge(t) {
|
|
1591
|
-
const e =
|
|
1597
|
+
const e = Zt(t), n = [];
|
|
1592
1598
|
let l = [], o = 0, s = null;
|
|
1593
1599
|
const v = (y) => {
|
|
1594
|
-
l.length && (n.push({ type: "paragraph", elements: [...l], rowFlex: y }), l = []);
|
|
1600
|
+
l.length && (n.push({ type: "paragraph", elements: [...l], rowFlex: y, _isCover: Oi(l) }), l = []);
|
|
1595
1601
|
}, m = () => {
|
|
1596
1602
|
if (o === 0) return;
|
|
1597
1603
|
const y = s;
|
|
@@ -1602,16 +1608,16 @@ function Ge(t) {
|
|
|
1602
1608
|
};
|
|
1603
1609
|
for (const y of e || [])
|
|
1604
1610
|
if (y.type === "table")
|
|
1605
|
-
m(), v(), n.push({ type: "table", el: y });
|
|
1611
|
+
m(), v(), n.push({ type: "table", el: y, _isCover: !!y._isCover });
|
|
1606
1612
|
else if (y.type === "title")
|
|
1607
|
-
m(), v(), n.push({ type: "title", el: y });
|
|
1613
|
+
m(), v(), n.push({ type: "title", el: y, _isCover: !!y._isCover });
|
|
1608
1614
|
else if (y.type === "list") {
|
|
1609
1615
|
m(), v();
|
|
1610
1616
|
const r = [];
|
|
1611
1617
|
let M = [];
|
|
1612
|
-
for (const
|
|
1613
|
-
|
|
1614
|
-
` ||
|
|
1618
|
+
for (const x of y.valueList || [])
|
|
1619
|
+
x.value === `
|
|
1620
|
+
` || x.value === "" ? (r.push([...M]), M = []) : M.push(x);
|
|
1615
1621
|
(M.length || r.length === 0) && r.push([...M]), n.push({ type: "list", listType: y.listType || "ul", listStyle: y.listStyle || "disc", items: r });
|
|
1616
1622
|
} else if (y.listId) {
|
|
1617
1623
|
m(), v();
|
|
@@ -1620,10 +1626,10 @@ function Ge(t) {
|
|
|
1620
1626
|
} else y.value != null && /^[\n200B]+$/.test(y.value) ? (o += y.value.length, y.rowFlex && (s = y.rowFlex)) : (m(), l.push(y));
|
|
1621
1627
|
return m(), v(), n;
|
|
1622
1628
|
}
|
|
1623
|
-
function
|
|
1629
|
+
function ze(t) {
|
|
1624
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((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 /
|
|
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));
|
|
1627
1633
|
return e + Math.max(o, y * o);
|
|
1628
1634
|
}
|
|
1629
1635
|
function Bi(t) {
|
|
@@ -1631,10 +1637,10 @@ function Bi(t) {
|
|
|
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
1646
|
t.forEach((s, v) => {
|
|
@@ -1654,13 +1660,13 @@ function Bt(t) {
|
|
|
1654
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
|
|
1667
|
+
function Nt(t) {
|
|
1662
1668
|
var s, v;
|
|
1663
|
-
const e = t.elements || [], n = ((s = e.find((m) => m.rowFlex)) == null ? void 0 : s.rowFlex) || t.rowFlex, l = { textAlign:
|
|
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
1672
|
function Di(t) {
|
|
@@ -1676,14 +1682,14 @@ function Di(t) {
|
|
|
1676
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
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
1691
|
const zi = 5;
|
|
1686
|
-
function
|
|
1692
|
+
function Vt(t, e = !1) {
|
|
1687
1693
|
var l, o;
|
|
1688
1694
|
let n = 0;
|
|
1689
1695
|
for (const s of t)
|
|
@@ -1691,12 +1697,12 @@ function zt(t, e = !1) {
|
|
|
1691
1697
|
const v = ((l = s.el) == null ? void 0 : l.trList) || [];
|
|
1692
1698
|
n += v.reduce((m, y) => m + (y.height || y.minHeight || 35), 0);
|
|
1693
1699
|
} else if (s.type === "title")
|
|
1694
|
-
n +=
|
|
1700
|
+
n += ze(s.titleValueList || ((o = s.el) == null ? void 0 : o.valueList) || []);
|
|
1695
1701
|
else if (s.type === "paragraph")
|
|
1696
|
-
n +=
|
|
1702
|
+
n += ze(s.elements || []);
|
|
1697
1703
|
else if (s.type === "list") {
|
|
1698
1704
|
const v = Math.round(18), m = (s.items || []).reduce(
|
|
1699
|
-
(y, r) => y + (r.length ?
|
|
1705
|
+
(y, r) => y + (r.length ? ze(r) : v),
|
|
1700
1706
|
0
|
|
1701
1707
|
);
|
|
1702
1708
|
n += Math.max(m, v);
|
|
@@ -1722,47 +1728,47 @@ const Ni = {
|
|
|
1722
1728
|
}
|
|
1723
1729
|
},
|
|
1724
1730
|
setup(t) {
|
|
1725
|
-
const e = t, n =
|
|
1731
|
+
const e = t, n = mt("bindTableObserver", null), l = mt("resolveImageUrl", null);
|
|
1726
1732
|
function o(v) {
|
|
1727
1733
|
if (!v) return "";
|
|
1728
1734
|
const m = (l == null ? void 0 : l.value) || l;
|
|
1729
1735
|
return typeof m == "function" ? m(v) : v;
|
|
1730
1736
|
}
|
|
1731
|
-
const s =
|
|
1737
|
+
const s = de(() => e.isHeaderFooter ? 0 : e.block.indentPx ?? 0);
|
|
1732
1738
|
return (v, m) => {
|
|
1733
1739
|
var y;
|
|
1734
1740
|
return t.block.blockType === "title" ? (u(), g("p", {
|
|
1735
1741
|
key: 0,
|
|
1736
|
-
class:
|
|
1742
|
+
class: Pe(["doc-title", `doc-title--${t.block.level}`]),
|
|
1737
1743
|
style: V({ paddingLeft: s.value ? s.value + "px" : void 0 })
|
|
1738
1744
|
}, [
|
|
1739
|
-
(u(!0), g(
|
|
1745
|
+
(u(!0), g(G, null, Q(t.block.titleValueList || [], (r, M) => (u(), g("span", {
|
|
1740
1746
|
key: M,
|
|
1741
|
-
style: V(K(
|
|
1742
|
-
},
|
|
1747
|
+
style: V(K(_e)(r))
|
|
1748
|
+
}, Y(r.value), 5))), 128))
|
|
1743
1749
|
], 6)) : t.block.blockType === "paragraph" ? (u(), g("p", {
|
|
1744
1750
|
key: 1,
|
|
1745
1751
|
class: "doc-para",
|
|
1746
|
-
style: V({ ...K(
|
|
1752
|
+
style: V({ ...K(Nt)(t.block), paddingLeft: s.value ? s.value + "px" : void 0 })
|
|
1747
1753
|
}, [
|
|
1748
|
-
t.block.elements.length ?
|
|
1749
|
-
(u(!0), g(
|
|
1750
|
-
var
|
|
1751
|
-
return u(), g(
|
|
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 }, [
|
|
1752
1758
|
!r.type || r.type === "text" ? (u(), g("span", {
|
|
1753
1759
|
key: 0,
|
|
1754
|
-
style: V(K(
|
|
1755
|
-
},
|
|
1760
|
+
style: V(K(_e)(r))
|
|
1761
|
+
}, Y(r.value), 5)) : r.type === "hyperlink" ? (u(), g("a", {
|
|
1756
1762
|
key: 1,
|
|
1757
1763
|
href: r.url,
|
|
1758
1764
|
class: "doc-link",
|
|
1759
1765
|
target: "_blank",
|
|
1760
1766
|
rel: "noopener"
|
|
1761
1767
|
}, [
|
|
1762
|
-
(u(!0), g(
|
|
1763
|
-
key:
|
|
1764
|
-
style: V(K(
|
|
1765
|
-
},
|
|
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))
|
|
1766
1772
|
], 8, Vi)) : r.type === "image" ? (u(), g("img", {
|
|
1767
1773
|
key: 2,
|
|
1768
1774
|
src: o(r.value),
|
|
@@ -1771,16 +1777,16 @@ const Ni = {
|
|
|
1771
1777
|
width: r.width ? r.width + "px" : "auto",
|
|
1772
1778
|
height: r.height ? r.height + "px" : "auto"
|
|
1773
1779
|
})
|
|
1774
|
-
}, null, 12, ji)) : r.type === "control" ? (u(), g(
|
|
1775
|
-
((
|
|
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", {
|
|
1776
1782
|
key: 0,
|
|
1777
1783
|
style: V({ fontSize: (r.control.size || 12) + "px" })
|
|
1778
1784
|
}, [
|
|
1779
|
-
(u(!0), g(
|
|
1780
|
-
key:
|
|
1781
|
-
style: V(K(
|
|
1782
|
-
},
|
|
1783
|
-
], 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", {
|
|
1784
1790
|
key: 1,
|
|
1785
1791
|
class: "ctrl-input",
|
|
1786
1792
|
style: V({
|
|
@@ -1788,237 +1794,240 @@ const Ni = {
|
|
|
1788
1794
|
fontSize: (r.control.size || 12) + "px"
|
|
1789
1795
|
})
|
|
1790
1796
|
}, [
|
|
1791
|
-
(u(!0), g(
|
|
1797
|
+
(u(!0), g(G, null, Q(r.control.value || [], (z, ie) => (u(), g("span", { key: ie }, Y(z.value), 1))), 128))
|
|
1792
1798
|
], 4)) : ((B = r.control) == null ? void 0 : B.type) === "radio" ? (u(), g("span", {
|
|
1793
1799
|
key: 2,
|
|
1794
|
-
class:
|
|
1800
|
+
class: Pe(["ctrl-options", { "ctrl-options--vertical": ((I = (W = r.control.extension) == null ? void 0 : W.elementAttributes) == null ? void 0 : I.layout) === "vertical" }]),
|
|
1795
1801
|
style: V({ fontSize: (r.control.size || K(We)) + "px" })
|
|
1796
1802
|
}, [
|
|
1797
|
-
(u(!0), g(
|
|
1798
|
-
key:
|
|
1803
|
+
(u(!0), g(G, null, Q(r.control.valueSets || [], (z, ie) => (u(), g("label", {
|
|
1804
|
+
key: ie,
|
|
1799
1805
|
class: "ctrl-option"
|
|
1800
1806
|
}, [
|
|
1801
|
-
|
|
1807
|
+
ne("input", {
|
|
1802
1808
|
type: "radio",
|
|
1803
1809
|
disabled: "",
|
|
1804
|
-
checked: r.control.code ===
|
|
1810
|
+
checked: r.control.code === z.code
|
|
1805
1811
|
}, null, 8, Ki),
|
|
1806
|
-
|
|
1812
|
+
Le(" " + Y(z.value), 1)
|
|
1807
1813
|
]))), 128))
|
|
1808
1814
|
], 6)) : ((D = r.control) == null ? void 0 : D.type) === "checkbox" ? (u(), g("span", {
|
|
1809
1815
|
key: 3,
|
|
1810
|
-
class:
|
|
1816
|
+
class: Pe(["ctrl-options", { "ctrl-options--vertical": ((h = (T = r.control.extension) == null ? void 0 : T.elementAttributes) == null ? void 0 : h.layout) === "vertical" }]),
|
|
1811
1817
|
style: V({ fontSize: (r.control.size || K(We)) + "px" })
|
|
1812
1818
|
}, [
|
|
1813
|
-
(u(!0), g(
|
|
1814
|
-
key:
|
|
1819
|
+
(u(!0), g(G, null, Q(r.control.valueSets || [], (z, ie) => (u(), g("label", {
|
|
1820
|
+
key: ie,
|
|
1815
1821
|
class: "ctrl-option"
|
|
1816
1822
|
}, [
|
|
1817
|
-
|
|
1823
|
+
ne("input", {
|
|
1818
1824
|
type: "checkbox",
|
|
1819
1825
|
disabled: "",
|
|
1820
|
-
checked: (r.control.code || "").split(",").includes(
|
|
1826
|
+
checked: (r.control.code || "").split(",").includes(z.code)
|
|
1821
1827
|
}, null, 8, Ui),
|
|
1822
|
-
|
|
1828
|
+
Le(" " + Y(z.value), 1)
|
|
1823
1829
|
]))), 128))
|
|
1824
|
-
], 6)) : ((
|
|
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)
|
|
1825
1831
|
], 64)) : r.type === "checkbox" ? (u(), g("input", {
|
|
1826
1832
|
key: 4,
|
|
1827
1833
|
type: "checkbox",
|
|
1828
|
-
checked: !!((
|
|
1834
|
+
checked: !!((X = r.checkbox) != null && X.value),
|
|
1829
1835
|
disabled: "",
|
|
1830
1836
|
class: "el-check"
|
|
1831
1837
|
}, null, 8, Wi)) : r.type === "radio" ? (u(), g("input", {
|
|
1832
1838
|
key: 5,
|
|
1833
1839
|
type: "radio",
|
|
1834
|
-
checked: !!((
|
|
1840
|
+
checked: !!((ue = r.radio) != null && ue.value),
|
|
1835
1841
|
disabled: "",
|
|
1836
1842
|
class: "el-check"
|
|
1837
1843
|
}, null, 8, Gi)) : r.type === "superscript" ? (u(), g("sup", {
|
|
1838
1844
|
key: 6,
|
|
1839
|
-
style: V(K(
|
|
1840
|
-
},
|
|
1845
|
+
style: V(K(_e)(r))
|
|
1846
|
+
}, Y(r.value), 5)) : r.type === "subscript" ? (u(), g("sub", {
|
|
1841
1847
|
key: 7,
|
|
1842
|
-
style: V(K(
|
|
1843
|
-
},
|
|
1848
|
+
style: V(K(_e)(r))
|
|
1849
|
+
}, Y(r.value), 5)) : r.type === "tab" ? (u(), g("span", {
|
|
1844
1850
|
key: 8,
|
|
1845
1851
|
class: "doc-tab",
|
|
1846
1852
|
style: V({ width: (r.size || K(We)) + "px" })
|
|
1847
|
-
}, null, 4)) :
|
|
1853
|
+
}, null, 4)) : ve("", !0)
|
|
1848
1854
|
], 64);
|
|
1849
1855
|
}), 128))
|
|
1850
|
-
], 4)) : t.block.blockType === "list" ? (u(),
|
|
1856
|
+
], 4)) : t.block.blockType === "list" ? (u(), Fe(at(t.block.listType === "ol" ? "ol" : "ul"), {
|
|
1851
1857
|
key: 2,
|
|
1852
1858
|
class: "doc-list",
|
|
1853
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 })
|
|
1854
1860
|
}, {
|
|
1855
1861
|
default: qe(() => [
|
|
1856
|
-
(u(!0), g(
|
|
1862
|
+
(u(!0), g(G, null, Q(t.block.items, (r, M) => (u(), g("li", {
|
|
1857
1863
|
key: M,
|
|
1858
1864
|
class: "doc-list-item"
|
|
1859
1865
|
}, [
|
|
1860
|
-
(u(!0), g(
|
|
1861
|
-
!
|
|
1866
|
+
(u(!0), g(G, null, Q(r, (x, $) => (u(), g(G, { key: $ }, [
|
|
1867
|
+
!x.type || x.type === "text" ? (u(), g("span", {
|
|
1862
1868
|
key: 0,
|
|
1863
|
-
style: V(K(
|
|
1864
|
-
},
|
|
1869
|
+
style: V(K(_e)(x))
|
|
1870
|
+
}, Y(x.value), 5)) : x.type === "superscript" ? (u(), g("sup", {
|
|
1865
1871
|
key: 1,
|
|
1866
|
-
style: V(K(
|
|
1867
|
-
},
|
|
1872
|
+
style: V(K(_e)(x))
|
|
1873
|
+
}, Y(x.value), 5)) : x.type === "subscript" ? (u(), g("sub", {
|
|
1868
1874
|
key: 2,
|
|
1869
|
-
style: V(K(
|
|
1870
|
-
},
|
|
1875
|
+
style: V(K(_e)(x))
|
|
1876
|
+
}, Y(x.value), 5)) : ve("", !0)
|
|
1871
1877
|
], 64))), 128))
|
|
1872
1878
|
]))), 128))
|
|
1873
1879
|
]),
|
|
1874
1880
|
_: 1
|
|
1875
1881
|
}, 8, ["style"])) : t.block.blockType === "table-row-group" ? (u(), g("div", {
|
|
1876
1882
|
key: 3,
|
|
1877
|
-
class:
|
|
1883
|
+
class: Pe(["doc-table-row-wrap", { "is-first": t.block.isFirst, "is-last": t.block.isLast, "is-page-break": t.block.isPageBreak }]),
|
|
1878
1884
|
style: V({
|
|
1879
1885
|
display: t.block.tableRowFlex ? "flex" : void 0,
|
|
1880
1886
|
justifyContent: t.block.tableRowFlex === "right" ? "flex-end" : t.block.tableRowFlex === "center" ? "center" : t.block.tableRowFlex === "left" ? "flex-start" : void 0,
|
|
1881
1887
|
paddingLeft: s.value ? s.value + "px" : void 0
|
|
1882
1888
|
})
|
|
1883
1889
|
}, [
|
|
1884
|
-
|
|
1890
|
+
ne("div", {
|
|
1885
1891
|
style: V({
|
|
1886
1892
|
overflow: t.block.sliceHeight != null ? "hidden" : void 0,
|
|
1887
1893
|
height: t.block.sliceHeight != null ? (t.block.isLast ? t.block.sliceHeight + 1 : t.block.sliceHeight) + "px" : void 0,
|
|
1888
1894
|
width: t.block.tableEl.width ? "max-content" : "100%"
|
|
1889
1895
|
})
|
|
1890
1896
|
}, [
|
|
1891
|
-
|
|
1897
|
+
ne("table", {
|
|
1892
1898
|
ref: t.block._baseKey && K(n) ? (r) => K(n)(r, t.block._baseKey) : void 0,
|
|
1893
|
-
class:
|
|
1899
|
+
class: Pe(["doc-table", { "doc-table--no-border": t.block.tableEl.borderType === "empty", "doc-table--header-footer": t.isHeaderFooter }]),
|
|
1894
1900
|
style: V({
|
|
1895
|
-
width: t.block.tableEl.width ? (t.isHeaderFooter ? t.block.tableEl.width : t.block.tableEl.width * K(
|
|
1901
|
+
width: t.block.tableEl.width ? (t.isHeaderFooter ? t.block.tableEl.width : t.block.tableEl.width * K(gt)(t.block.tableEl)) + "px" : "100%",
|
|
1896
1902
|
transform: t.block.sliceOffset ? `translateY(-${t.block.sliceOffset}px)` : void 0
|
|
1897
1903
|
})
|
|
1898
1904
|
}, [
|
|
1899
1905
|
(y = t.block.tableEl.colgroup) != null && y.length ? (u(), g("colgroup", Ji, [
|
|
1900
|
-
(u(!0), g(
|
|
1906
|
+
(u(!0), g(G, null, Q(t.block.tableEl.colgroup, (r, M) => (u(), g("col", {
|
|
1901
1907
|
key: M,
|
|
1902
|
-
style: V({ width: (t.isHeaderFooter ? r.width : r.width * K(
|
|
1908
|
+
style: V({ width: (t.isHeaderFooter ? r.width : r.width * K(gt)(t.block.tableEl)) + "px" })
|
|
1903
1909
|
}, null, 4))), 128))
|
|
1904
|
-
])) :
|
|
1905
|
-
|
|
1906
|
-
(u(!0), g(
|
|
1910
|
+
])) : ve("", !0),
|
|
1911
|
+
ne("tbody", null, [
|
|
1912
|
+
(u(!0), g(G, null, Q(t.block.trGroup, (r, M) => (u(), g("tr", {
|
|
1907
1913
|
key: M,
|
|
1908
1914
|
style: V({ height: (r.height || r.minHeight || 30) + "px" })
|
|
1909
1915
|
}, [
|
|
1910
|
-
(u(!0), g(
|
|
1911
|
-
key:
|
|
1912
|
-
colspan:
|
|
1913
|
-
rowspan:
|
|
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,
|
|
1914
1920
|
style: V({
|
|
1915
|
-
backgroundColor:
|
|
1916
|
-
verticalAlign: K(Di)(
|
|
1917
|
-
width:
|
|
1918
|
-
height:
|
|
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
|
|
1919
1925
|
})
|
|
1920
1926
|
}, [
|
|
1921
|
-
(u(!0), g(
|
|
1927
|
+
(u(!0), g(G, null, Q(K(Ge)(x.value), (B, W) => (u(), g(G, { key: W }, [
|
|
1922
1928
|
B.type === "paragraph" ? (u(), g("p", {
|
|
1923
1929
|
key: 0,
|
|
1924
1930
|
class: "cell-para",
|
|
1925
|
-
style: V(K(
|
|
1931
|
+
style: V(K(Nt)(B))
|
|
1926
1932
|
}, [
|
|
1927
|
-
B.elements.length ?
|
|
1928
|
-
(u(!0), g(
|
|
1929
|
-
var
|
|
1930
|
-
return u(), g(
|
|
1931
|
-
!
|
|
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", {
|
|
1932
1938
|
key: 0,
|
|
1933
|
-
style: V(K(
|
|
1934
|
-
},
|
|
1939
|
+
style: V(K(_e)(I))
|
|
1940
|
+
}, Y(I.value), 5)) : I.type === "image" ? (u(), g("img", {
|
|
1935
1941
|
key: 1,
|
|
1936
|
-
src: o(
|
|
1942
|
+
src: o(I.value),
|
|
1937
1943
|
class: "doc-image",
|
|
1938
1944
|
style: V({
|
|
1939
|
-
width:
|
|
1940
|
-
height:
|
|
1945
|
+
width: I.width ? I.width + "px" : "auto",
|
|
1946
|
+
height: I.height ? I.height + "px" : "auto"
|
|
1941
1947
|
})
|
|
1942
|
-
}, null, 12, Zi)) :
|
|
1948
|
+
}, null, 12, Zi)) : I.type === "hyperlink" ? (u(), g("a", {
|
|
1943
1949
|
key: 2,
|
|
1944
|
-
href:
|
|
1950
|
+
href: I.url,
|
|
1945
1951
|
class: "doc-link",
|
|
1946
1952
|
target: "_blank"
|
|
1947
1953
|
}, [
|
|
1948
|
-
(u(!0), g(
|
|
1949
|
-
key:
|
|
1950
|
-
style: V(K(
|
|
1951
|
-
},
|
|
1952
|
-
], 8, Qi)) :
|
|
1953
|
-
((
|
|
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", {
|
|
1954
1960
|
key: 0,
|
|
1955
|
-
style: V({ fontSize: (
|
|
1961
|
+
style: V({ fontSize: (I.control.size || 12) + "px" })
|
|
1956
1962
|
}, [
|
|
1957
|
-
(u(!0), g(
|
|
1958
|
-
key:
|
|
1959
|
-
style: V(K(
|
|
1960
|
-
},
|
|
1961
|
-
], 4)) : ((h =
|
|
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", {
|
|
1962
1968
|
key: 1,
|
|
1963
1969
|
class: "ctrl-input",
|
|
1964
|
-
style: V({ fontSize: (
|
|
1970
|
+
style: V({ fontSize: (I.control.size || 12) + "px" })
|
|
1965
1971
|
}, [
|
|
1966
|
-
(u(!0), g(
|
|
1967
|
-
], 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", {
|
|
1968
1974
|
key: 2,
|
|
1969
|
-
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" }])
|
|
1970
1976
|
}, [
|
|
1971
|
-
(u(!0), g(
|
|
1972
|
-
key:
|
|
1977
|
+
(u(!0), g(G, null, Q(I.control.valueSets || [], (z, ie) => (u(), g("label", {
|
|
1978
|
+
key: ie,
|
|
1973
1979
|
class: "ctrl-option"
|
|
1974
1980
|
}, [
|
|
1975
|
-
|
|
1981
|
+
ne("input", {
|
|
1976
1982
|
type: "radio",
|
|
1977
1983
|
disabled: "",
|
|
1978
|
-
checked:
|
|
1984
|
+
checked: I.control.code === z.code
|
|
1979
1985
|
}, null, 8, el),
|
|
1980
|
-
|
|
1986
|
+
Le(Y(z.value), 1)
|
|
1981
1987
|
]))), 128))
|
|
1982
|
-
], 2)) :
|
|
1983
|
-
], 64)) :
|
|
1988
|
+
], 2)) : ve("", !0)
|
|
1989
|
+
], 64)) : I.type === "checkbox" ? (u(), g("input", {
|
|
1984
1990
|
key: 4,
|
|
1985
1991
|
type: "checkbox",
|
|
1986
|
-
checked: !!((
|
|
1992
|
+
checked: !!((X = I.checkbox) != null && X.value),
|
|
1987
1993
|
disabled: "",
|
|
1988
1994
|
class: "el-check"
|
|
1989
|
-
}, null, 8, tl)) :
|
|
1995
|
+
}, null, 8, tl)) : I.type === "radio" ? (u(), g("input", {
|
|
1990
1996
|
key: 5,
|
|
1991
1997
|
type: "radio",
|
|
1992
|
-
checked: !!((
|
|
1998
|
+
checked: !!((ue = I.radio) != null && ue.value),
|
|
1993
1999
|
disabled: "",
|
|
1994
2000
|
class: "el-check"
|
|
1995
|
-
}, null, 8, nl)) :
|
|
2001
|
+
}, null, 8, nl)) : I.type === "superscript" ? (u(), g("sup", {
|
|
1996
2002
|
key: 6,
|
|
1997
|
-
style: V(K(
|
|
1998
|
-
},
|
|
2003
|
+
style: V(K(_e)(I))
|
|
2004
|
+
}, Y(I.value), 5)) : I.type === "subscript" ? (u(), g("sub", {
|
|
1999
2005
|
key: 7,
|
|
2000
|
-
style: V(K(
|
|
2001
|
-
},
|
|
2006
|
+
style: V(K(_e)(I))
|
|
2007
|
+
}, Y(I.value), 5)) : I.type === "tab" ? (u(), g("span", {
|
|
2002
2008
|
key: 8,
|
|
2003
2009
|
class: "doc-tab",
|
|
2004
|
-
style: V({ width: (
|
|
2005
|
-
}, null, 4)) :
|
|
2010
|
+
style: V({ width: (I.size || K(We)) + "px" })
|
|
2011
|
+
}, null, 4)) : ve("", !0)
|
|
2006
2012
|
], 64);
|
|
2007
2013
|
}), 128))
|
|
2008
|
-
], 4)) :
|
|
2014
|
+
], 4)) : ve("", !0)
|
|
2009
2015
|
], 64))), 128))
|
|
2010
2016
|
], 12, Xi))), 128))
|
|
2011
2017
|
], 4))), 128))
|
|
2012
2018
|
])
|
|
2013
2019
|
], 6)
|
|
2014
2020
|
], 4)
|
|
2015
|
-
], 6)) :
|
|
2021
|
+
], 6)) : ve("", !0);
|
|
2016
2022
|
};
|
|
2017
2023
|
}
|
|
2018
|
-
},
|
|
2024
|
+
}, pt = /* @__PURE__ */ Ne(il, [["__scopeId", "data-v-88bdb013"]]), ll = { class: "editor-layout word-editor-scope" }, ol = { class: "editor-container" }, al = {
|
|
2019
2025
|
key: 0,
|
|
2020
2026
|
class: "editor-loading"
|
|
2021
|
-
}, sl = {
|
|
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 = {
|
|
2022
2031
|
__name: "index",
|
|
2023
2032
|
props: {
|
|
2024
2033
|
// 文档结构数据(IElement[]),来源由使用方决定
|
|
@@ -2038,245 +2047,247 @@ const Ni = {
|
|
|
2038
2047
|
}
|
|
2039
2048
|
},
|
|
2040
2049
|
setup(t) {
|
|
2041
|
-
const e = t, n =
|
|
2050
|
+
const e = t, n = de(() => {
|
|
2042
2051
|
const h = e.data;
|
|
2043
2052
|
return h ? !Array.isArray(h) && h.main ? h.main : Array.isArray(h) ? h : [] : [];
|
|
2044
|
-
}), l =
|
|
2053
|
+
}), l = te(null), o = te({});
|
|
2045
2054
|
let s = null;
|
|
2046
|
-
|
|
2055
|
+
_t(() => {
|
|
2047
2056
|
s = new ResizeObserver((h) => {
|
|
2048
|
-
const
|
|
2049
|
-
for (const
|
|
2050
|
-
const
|
|
2051
|
-
if (!
|
|
2052
|
-
const
|
|
2053
|
-
|
|
2057
|
+
const F = {};
|
|
2058
|
+
for (const P of h) {
|
|
2059
|
+
const E = P.target._rowKey;
|
|
2060
|
+
if (!E) continue;
|
|
2061
|
+
const X = Math.round(P.contentRect.height);
|
|
2062
|
+
X > (o.value[E] || 0) && (F[E] = X);
|
|
2054
2063
|
}
|
|
2055
|
-
Object.keys(
|
|
2064
|
+
Object.keys(F).length && (o.value = { ...o.value, ...F });
|
|
2056
2065
|
});
|
|
2057
|
-
}),
|
|
2066
|
+
}), rt(() => {
|
|
2058
2067
|
s == null || s.disconnect(), s = null;
|
|
2059
2068
|
});
|
|
2060
|
-
function v(h,
|
|
2061
|
-
!h || !s || (h._rowKey =
|
|
2069
|
+
function v(h, F) {
|
|
2070
|
+
!h || !s || (h._rowKey = F, s.observe(h));
|
|
2062
2071
|
}
|
|
2063
|
-
|
|
2064
|
-
const m =
|
|
2065
|
-
() => Math.max(100, dl - ul * 2 -
|
|
2066
|
-
), y =
|
|
2067
|
-
const h = Ge(n.value),
|
|
2068
|
-
let
|
|
2069
|
-
const
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
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);
|
|
2074
2085
|
};
|
|
2075
|
-
return h.forEach((
|
|
2076
|
-
var
|
|
2077
|
-
const me =
|
|
2078
|
-
if (me && (
|
|
2079
|
-
const
|
|
2080
|
-
var
|
|
2081
|
-
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;
|
|
2082
2093
|
});
|
|
2083
|
-
let
|
|
2084
|
-
if (!
|
|
2085
|
-
const
|
|
2086
|
-
|
|
2094
|
+
let Ie = fe;
|
|
2095
|
+
if (!ke && se) {
|
|
2096
|
+
const ge = fe[0] || {};
|
|
2097
|
+
Ie = [
|
|
2087
2098
|
{
|
|
2088
|
-
value:
|
|
2089
|
-
size:
|
|
2090
|
-
bold:
|
|
2091
|
-
italic:
|
|
2092
|
-
color:
|
|
2093
|
-
font:
|
|
2099
|
+
value: se,
|
|
2100
|
+
size: ge.size,
|
|
2101
|
+
bold: ge.bold,
|
|
2102
|
+
italic: ge.italic,
|
|
2103
|
+
color: ge.color,
|
|
2104
|
+
font: ge.font,
|
|
2094
2105
|
extension: { isIndex: !0 }
|
|
2095
2106
|
},
|
|
2096
|
-
...
|
|
2107
|
+
...fe
|
|
2097
2108
|
];
|
|
2098
2109
|
}
|
|
2099
|
-
const
|
|
2100
|
-
|
|
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({
|
|
2101
2112
|
node_id: `blk_${he}_0`,
|
|
2102
2113
|
layer: me ? 1 : 100,
|
|
2103
2114
|
blockType: "title",
|
|
2104
|
-
level:
|
|
2105
|
-
titleEl:
|
|
2106
|
-
titleValueList:
|
|
2115
|
+
level: H.el.level,
|
|
2116
|
+
titleEl: H.el,
|
|
2117
|
+
titleValueList: Ie,
|
|
2107
2118
|
content_type: "text",
|
|
2108
|
-
content:
|
|
2109
|
-
height:
|
|
2110
|
-
indentPx:
|
|
2119
|
+
content: we,
|
|
2120
|
+
height: le,
|
|
2121
|
+
indentPx: Ce * 20
|
|
2111
2122
|
});
|
|
2112
|
-
} else if (
|
|
2113
|
-
const
|
|
2114
|
-
|
|
2115
|
-
const
|
|
2116
|
-
|
|
2117
|
-
node_id: `blk_${he}_${
|
|
2118
|
-
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,
|
|
2119
2130
|
blockType: "paragraph",
|
|
2120
|
-
elements:
|
|
2121
|
-
rowFlex:
|
|
2131
|
+
elements: ke,
|
|
2132
|
+
rowFlex: H.rowFlex,
|
|
2122
2133
|
content_type: "text",
|
|
2123
|
-
content:
|
|
2124
|
-
height:
|
|
2125
|
-
indentPx:
|
|
2134
|
+
content: we,
|
|
2135
|
+
height: le,
|
|
2136
|
+
indentPx: se
|
|
2126
2137
|
});
|
|
2127
2138
|
});
|
|
2128
|
-
} else if (
|
|
2129
|
-
const
|
|
2130
|
-
if (
|
|
2131
|
-
const
|
|
2132
|
-
(
|
|
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),
|
|
2133
2144
|
0
|
|
2134
|
-
), Ee = `blk_${he}_0`,
|
|
2135
|
-
if (
|
|
2136
|
-
const
|
|
2137
|
-
for (let
|
|
2138
|
-
const
|
|
2139
|
-
|
|
2140
|
-
node_id: `blk_${he}_0_s${
|
|
2141
|
-
layer: me &&
|
|
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({
|
|
2151
|
+
node_id: `blk_${he}_0_s${ee}`,
|
|
2152
|
+
layer: me && ee === 0 ? 1 : 100,
|
|
2142
2153
|
blockType: "table-row-group",
|
|
2143
2154
|
content_type: "table-row",
|
|
2144
|
-
rowHeight:
|
|
2145
|
-
trGroup:
|
|
2146
|
-
tableEl:
|
|
2147
|
-
tableRowFlex:
|
|
2148
|
-
isFirst:
|
|
2149
|
-
isLast:
|
|
2150
|
-
isPageBreak:
|
|
2151
|
-
sliceOffset:
|
|
2152
|
-
sliceHeight:
|
|
2153
|
-
_baseKey:
|
|
2154
|
-
height:
|
|
2155
|
-
indentPx:
|
|
2155
|
+
rowHeight: be,
|
|
2156
|
+
trGroup: ye,
|
|
2157
|
+
tableEl: H.el,
|
|
2158
|
+
tableRowFlex: H.el.rowFlex || null,
|
|
2159
|
+
isFirst: ee === 0,
|
|
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
|
|
2156
2167
|
});
|
|
2157
2168
|
}
|
|
2158
2169
|
} else {
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2170
|
+
const oe = E > 0;
|
|
2171
|
+
E = E + be > P ? be : E + be, ue({
|
|
2161
2172
|
node_id: `blk_${he}_0`,
|
|
2162
2173
|
layer: me ? 1 : 100,
|
|
2163
2174
|
blockType: "table-row-group",
|
|
2164
2175
|
content_type: "table-row",
|
|
2165
|
-
rowHeight:
|
|
2166
|
-
trGroup:
|
|
2167
|
-
tableEl:
|
|
2168
|
-
tableRowFlex:
|
|
2176
|
+
rowHeight: be,
|
|
2177
|
+
trGroup: ye,
|
|
2178
|
+
tableEl: H.el,
|
|
2179
|
+
tableRowFlex: H.el.rowFlex || null,
|
|
2169
2180
|
isFirst: !0,
|
|
2170
2181
|
isLast: !0,
|
|
2171
|
-
isPageBreak:
|
|
2172
|
-
indentPx:
|
|
2182
|
+
isPageBreak: oe,
|
|
2183
|
+
indentPx: we
|
|
2173
2184
|
});
|
|
2174
2185
|
}
|
|
2175
2186
|
} else
|
|
2176
|
-
|
|
2177
|
-
const Ee = `blk_${he}_${
|
|
2178
|
-
(
|
|
2187
|
+
le.forEach((ye, O) => {
|
|
2188
|
+
const Ee = `blk_${he}_${O}`, be = ye.reduce(
|
|
2189
|
+
(ee, re) => ee + (re.height || re.minHeight || 35),
|
|
2179
2190
|
0
|
|
2180
|
-
),
|
|
2181
|
-
if (
|
|
2182
|
-
const
|
|
2183
|
-
for (let
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2186
|
-
node_id: `blk_${he}_${
|
|
2187
|
-
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,
|
|
2188
2199
|
blockType: "table-row-group",
|
|
2189
2200
|
content_type: "table-row",
|
|
2190
|
-
rowHeight:
|
|
2191
|
-
trGroup:
|
|
2192
|
-
tableEl:
|
|
2193
|
-
tableRowFlex:
|
|
2194
|
-
isFirst:
|
|
2195
|
-
isLast:
|
|
2196
|
-
isPageBreak:
|
|
2197
|
-
sliceOffset:
|
|
2198
|
-
sliceHeight:
|
|
2199
|
-
_baseKey:
|
|
2200
|
-
height:
|
|
2201
|
-
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
|
|
2202
2213
|
});
|
|
2203
2214
|
}
|
|
2204
2215
|
} else {
|
|
2205
|
-
const
|
|
2206
|
-
|
|
2207
|
-
node_id: `blk_${he}_${
|
|
2208
|
-
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,
|
|
2209
2220
|
blockType: "table-row-group",
|
|
2210
2221
|
content_type: "table-row",
|
|
2211
|
-
rowHeight:
|
|
2212
|
-
trGroup:
|
|
2213
|
-
tableEl:
|
|
2214
|
-
tableRowFlex:
|
|
2215
|
-
isFirst:
|
|
2216
|
-
isLast:
|
|
2217
|
-
isPageBreak:
|
|
2218
|
-
indentPx:
|
|
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,
|
|
2228
|
+
isPageBreak: ee,
|
|
2229
|
+
indentPx: we
|
|
2219
2230
|
});
|
|
2220
2231
|
}
|
|
2221
2232
|
});
|
|
2222
|
-
} else if (
|
|
2223
|
-
const
|
|
2224
|
-
let
|
|
2225
|
-
for (const
|
|
2226
|
-
|
|
2227
|
-
|
|
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({
|
|
2228
2239
|
node_id: `blk_${he}_0`,
|
|
2229
2240
|
layer: me ? 1 : 100,
|
|
2230
2241
|
blockType: "list",
|
|
2231
|
-
listType:
|
|
2232
|
-
listStyle:
|
|
2233
|
-
items:
|
|
2234
|
-
height:
|
|
2235
|
-
indentPx:
|
|
2242
|
+
listType: H.listType,
|
|
2243
|
+
listStyle: H.listStyle,
|
|
2244
|
+
items: H.items,
|
|
2245
|
+
height: se,
|
|
2246
|
+
indentPx: Ce >= 0 ? (Ce + 1) * 20 : 0
|
|
2236
2247
|
});
|
|
2237
2248
|
}
|
|
2238
|
-
}),
|
|
2239
|
-
}), r =
|
|
2240
|
-
var
|
|
2241
|
-
const h = (
|
|
2249
|
+
}), F;
|
|
2250
|
+
}), r = de(() => {
|
|
2251
|
+
var F;
|
|
2252
|
+
const h = (F = e.data) == null ? void 0 : F.header;
|
|
2242
2253
|
return h != null && h.length ? Ge(h) : [];
|
|
2243
|
-
}), M =
|
|
2244
|
-
var
|
|
2245
|
-
const h = (
|
|
2254
|
+
}), M = de(() => {
|
|
2255
|
+
var F;
|
|
2256
|
+
const h = (F = e.data) == null ? void 0 : F.footer;
|
|
2246
2257
|
return h != null && h.length ? Ge(h) : [];
|
|
2247
|
-
}),
|
|
2248
|
-
function
|
|
2249
|
-
var
|
|
2250
|
-
const
|
|
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";
|
|
2251
2262
|
return {
|
|
2252
|
-
blockType:
|
|
2263
|
+
blockType: F ? "table-row-group" : h.type,
|
|
2253
2264
|
elements: h.elements,
|
|
2254
2265
|
rowFlex: h.rowFlex,
|
|
2255
|
-
level: (
|
|
2256
|
-
titleValueList: ((
|
|
2266
|
+
level: (P = h.el) == null ? void 0 : P.level,
|
|
2267
|
+
titleValueList: ((E = h.el) == null ? void 0 : E.valueList) || h.titleValueList,
|
|
2257
2268
|
listType: h.listType,
|
|
2258
2269
|
listStyle: h.listStyle,
|
|
2259
2270
|
items: h.items,
|
|
2260
2271
|
indentPx: 0,
|
|
2261
|
-
trGroup:
|
|
2262
|
-
tableEl:
|
|
2272
|
+
trGroup: F ? zt(h.el.trList).flat() : void 0,
|
|
2273
|
+
tableEl: F ? h.el : void 0,
|
|
2263
2274
|
isFirst: !0,
|
|
2264
2275
|
isLast: !0,
|
|
2265
|
-
tableRowFlex: ((
|
|
2276
|
+
tableRowFlex: ((X = h.el) == null ? void 0 : X.rowFlex) || null
|
|
2266
2277
|
};
|
|
2267
2278
|
}
|
|
2268
|
-
const D =
|
|
2269
|
-
function
|
|
2270
|
-
var
|
|
2271
|
-
(
|
|
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 });
|
|
2272
2283
|
}
|
|
2273
|
-
return (h,
|
|
2274
|
-
|
|
2284
|
+
return (h, F) => (u(), g("div", ll, [
|
|
2285
|
+
q(Ti, {
|
|
2275
2286
|
items: D.value,
|
|
2276
|
-
onNavigate:
|
|
2287
|
+
onNavigate: T
|
|
2277
2288
|
}, null, 8, ["items"]),
|
|
2278
|
-
|
|
2279
|
-
t.loading ? (u(), g("div", al, " 加载中… ")) : (u(),
|
|
2289
|
+
ne("div", ol, [
|
|
2290
|
+
t.loading ? (u(), g("div", al, " 加载中… ")) : (u(), Fe(K(fi), {
|
|
2280
2291
|
key: 1,
|
|
2281
2292
|
ref_key: "virtualTableRef",
|
|
2282
2293
|
ref: l,
|
|
@@ -2292,16 +2303,16 @@ const Ni = {
|
|
|
2292
2303
|
showPageBorder: !0,
|
|
2293
2304
|
pageBorderPadding: 5,
|
|
2294
2305
|
pageBorderStyle: "1px solid #333",
|
|
2295
|
-
headerHeight:
|
|
2296
|
-
footerHeight:
|
|
2306
|
+
headerHeight: x.value,
|
|
2307
|
+
footerHeight: $.value,
|
|
2297
2308
|
showPageNumber: !0
|
|
2298
2309
|
},
|
|
2299
2310
|
data: y.value
|
|
2300
|
-
},
|
|
2311
|
+
}, In({
|
|
2301
2312
|
default: qe(() => [
|
|
2302
|
-
|
|
2303
|
-
default: qe(({ row:
|
|
2304
|
-
|
|
2313
|
+
q(K(vi), null, {
|
|
2314
|
+
default: qe(({ row: P }) => [
|
|
2315
|
+
q(pt, { block: P }, null, 8, ["block"])
|
|
2305
2316
|
]),
|
|
2306
2317
|
_: 1
|
|
2307
2318
|
})
|
|
@@ -2310,27 +2321,27 @@ const Ni = {
|
|
|
2310
2321
|
}, [
|
|
2311
2322
|
B.value ? {
|
|
2312
2323
|
name: "page-header",
|
|
2313
|
-
fn: qe(() => [
|
|
2314
|
-
|
|
2315
|
-
(u(!0), g(
|
|
2316
|
-
key:
|
|
2317
|
-
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),
|
|
2318
2329
|
"is-header-footer": !0
|
|
2319
2330
|
}, null, 8, ["block"]))), 128))
|
|
2320
|
-
])
|
|
2331
|
+
]))
|
|
2321
2332
|
]),
|
|
2322
2333
|
key: "0"
|
|
2323
2334
|
} : void 0,
|
|
2324
|
-
|
|
2335
|
+
W.value ? {
|
|
2325
2336
|
name: "page-footer",
|
|
2326
|
-
fn: qe(({ pageNumber:
|
|
2327
|
-
|
|
2328
|
-
(u(!0), g(
|
|
2329
|
-
key:
|
|
2330
|
-
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),
|
|
2331
2342
|
"is-header-footer": !0
|
|
2332
2343
|
}, null, 8, ["block"]))), 128)),
|
|
2333
|
-
|
|
2344
|
+
ne("div", cl, " 第" + Y(P) + "页 / 共" + Y(E) + "页 ", 1)
|
|
2334
2345
|
])
|
|
2335
2346
|
]),
|
|
2336
2347
|
key: "1"
|
|
@@ -2339,16 +2350,16 @@ const Ni = {
|
|
|
2339
2350
|
])
|
|
2340
2351
|
]));
|
|
2341
2352
|
}
|
|
2342
|
-
}, gl = /* @__PURE__ */
|
|
2343
|
-
function
|
|
2353
|
+
}, gl = /* @__PURE__ */ Ne(fl, [["__scopeId", "data-v-9ff2db2b"]]), jt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
2354
|
+
function ot(t = 10) {
|
|
2344
2355
|
const e = crypto.getRandomValues(new Uint8Array(t));
|
|
2345
|
-
return Array.from(e).map((n) =>
|
|
2356
|
+
return Array.from(e).map((n) => jt[n % jt.length]).join("");
|
|
2346
2357
|
}
|
|
2347
|
-
class
|
|
2358
|
+
class st {
|
|
2348
2359
|
constructor(e) {
|
|
2349
2360
|
N(this, "data");
|
|
2350
|
-
this.data =
|
|
2351
|
-
id:
|
|
2361
|
+
this.data = Wt({
|
|
2362
|
+
id: ot(),
|
|
2352
2363
|
version: 1,
|
|
2353
2364
|
sections: [this.createEmptySection()],
|
|
2354
2365
|
pageWidth: 595,
|
|
@@ -2363,13 +2374,13 @@ class at {
|
|
|
2363
2374
|
// ─── 工厂方法 ─────────────────────────────────────────────────────────────
|
|
2364
2375
|
createEmptySection() {
|
|
2365
2376
|
return {
|
|
2366
|
-
id:
|
|
2377
|
+
id: ot(),
|
|
2367
2378
|
paragraphs: [this.createEmptyParagraph()]
|
|
2368
2379
|
};
|
|
2369
2380
|
}
|
|
2370
2381
|
createEmptyParagraph(e) {
|
|
2371
2382
|
return {
|
|
2372
|
-
id:
|
|
2383
|
+
id: ot(),
|
|
2373
2384
|
type: "paragraph",
|
|
2374
2385
|
format: e ?? {},
|
|
2375
2386
|
children: []
|
|
@@ -2377,7 +2388,7 @@ class at {
|
|
|
2377
2388
|
}
|
|
2378
2389
|
createTextElement(e, n) {
|
|
2379
2390
|
return {
|
|
2380
|
-
id:
|
|
2391
|
+
id: ot(),
|
|
2381
2392
|
type: "text",
|
|
2382
2393
|
value: e,
|
|
2383
2394
|
format: n ?? {}
|
|
@@ -2460,11 +2471,11 @@ class at {
|
|
|
2460
2471
|
for (const { paragraph: v, sectionIndex: m, paragraphIndex: y } of o) {
|
|
2461
2472
|
const r = m === e.sectionIndex && y === e.paragraphIndex, M = m === n.sectionIndex && y === n.paragraphIndex;
|
|
2462
2473
|
if (r && (s = !0), s)
|
|
2463
|
-
for (let
|
|
2464
|
-
const
|
|
2465
|
-
if (!(r &&
|
|
2466
|
-
if (M &&
|
|
2467
|
-
|
|
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 };
|
|
2468
2479
|
}
|
|
2469
2480
|
}
|
|
2470
2481
|
if (M) break;
|
|
@@ -2480,26 +2491,26 @@ class at {
|
|
|
2480
2491
|
}
|
|
2481
2492
|
/** 从 JSON 恢复 */
|
|
2482
2493
|
static fromJSON(e) {
|
|
2483
|
-
const n = JSON.parse(e), l = new
|
|
2494
|
+
const n = JSON.parse(e), l = new st();
|
|
2484
2495
|
return Object.assign(l.data, n), l;
|
|
2485
2496
|
}
|
|
2486
2497
|
}
|
|
2487
|
-
function
|
|
2498
|
+
function $e(t = 0, e = 0, n = 0, l = 0) {
|
|
2488
2499
|
return { sectionIndex: t, paragraphIndex: e, elementIndex: n, offset: l };
|
|
2489
2500
|
}
|
|
2490
|
-
function
|
|
2501
|
+
function Kt(t, e) {
|
|
2491
2502
|
return t.sectionIndex === e.sectionIndex && t.paragraphIndex === e.paragraphIndex && t.elementIndex === e.elementIndex && t.offset === e.offset;
|
|
2492
2503
|
}
|
|
2493
|
-
class
|
|
2504
|
+
class bt {
|
|
2494
2505
|
constructor(e) {
|
|
2495
|
-
N(this, "_selection",
|
|
2496
|
-
anchor:
|
|
2497
|
-
focus:
|
|
2506
|
+
N(this, "_selection", Wt({
|
|
2507
|
+
anchor: $e(),
|
|
2508
|
+
focus: $e(),
|
|
2498
2509
|
isCollapsed: !0
|
|
2499
2510
|
}));
|
|
2500
2511
|
N(this, "_docModel");
|
|
2501
2512
|
/** 是否有选区(非光标) */
|
|
2502
|
-
N(this, "hasSelection",
|
|
2513
|
+
N(this, "hasSelection", de(() => !this._selection.isCollapsed));
|
|
2503
2514
|
this._docModel = e;
|
|
2504
2515
|
}
|
|
2505
2516
|
get selection() {
|
|
@@ -2510,14 +2521,14 @@ class mt {
|
|
|
2510
2521
|
this._selection.anchor = { ...e }, this._selection.focus = { ...e }, this._selection.isCollapsed = !0;
|
|
2511
2522
|
}
|
|
2512
2523
|
setSelection(e, n) {
|
|
2513
|
-
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);
|
|
2514
2525
|
}
|
|
2515
2526
|
collapse(e = !0) {
|
|
2516
2527
|
e ? this._selection.anchor = { ...this._selection.focus } : this._selection.focus = { ...this._selection.anchor }, this._selection.isCollapsed = !0;
|
|
2517
2528
|
}
|
|
2518
2529
|
selectAll() {
|
|
2519
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;
|
|
2520
|
-
this._selection.anchor =
|
|
2531
|
+
this._selection.anchor = $e(0, 0, 0, 0), this._selection.focus = $e(
|
|
2521
2532
|
e.length - 1,
|
|
2522
2533
|
((n == null ? void 0 : n.paragraphs.length) ?? 1) - 1,
|
|
2523
2534
|
((l == null ? void 0 : l.children.length) ?? 0) === 0 ? 0 : ((l == null ? void 0 : l.children.length) ?? 1) - 1,
|
|
@@ -2560,24 +2571,24 @@ class mt {
|
|
|
2560
2571
|
l && this._applyMove(l, e);
|
|
2561
2572
|
}
|
|
2562
2573
|
_applyMove(e, n) {
|
|
2563
|
-
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);
|
|
2564
2575
|
}
|
|
2565
2576
|
_getNextParagraphPoint(e) {
|
|
2566
2577
|
const n = this._docModel.data.sections[e.sectionIndex];
|
|
2567
|
-
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;
|
|
2568
2579
|
}
|
|
2569
2580
|
_getPrevParagraphPoint(e) {
|
|
2570
2581
|
if (e.paragraphIndex > 0) {
|
|
2571
2582
|
const n = this._docModel.getParagraphAt(e.sectionIndex, e.paragraphIndex - 1);
|
|
2572
2583
|
if (!n) return null;
|
|
2573
2584
|
const l = n.children.length - 1, o = n.children[l], s = (o == null ? void 0 : o.type) === "text" ? o.value.length : 0;
|
|
2574
|
-
return
|
|
2585
|
+
return $e(e.sectionIndex, e.paragraphIndex - 1, Math.max(l, 0), s);
|
|
2575
2586
|
}
|
|
2576
2587
|
if (e.sectionIndex > 0) {
|
|
2577
2588
|
const n = this._docModel.data.sections[e.sectionIndex - 1];
|
|
2578
2589
|
if (!n) return null;
|
|
2579
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;
|
|
2580
|
-
return
|
|
2591
|
+
return $e(e.sectionIndex - 1, l, Math.max(s, 0), m);
|
|
2581
2592
|
}
|
|
2582
2593
|
return null;
|
|
2583
2594
|
}
|
|
@@ -2695,7 +2706,7 @@ class yl {
|
|
|
2695
2706
|
}));
|
|
2696
2707
|
}
|
|
2697
2708
|
}
|
|
2698
|
-
class
|
|
2709
|
+
class Ut {
|
|
2699
2710
|
constructor(e, n, l) {
|
|
2700
2711
|
N(this, "name");
|
|
2701
2712
|
N(this, "_deletedText", "");
|
|
@@ -2771,7 +2782,7 @@ class Ue {
|
|
|
2771
2782
|
return (o = l == null ? void 0 : l.format) == null ? void 0 : o[e];
|
|
2772
2783
|
}
|
|
2773
2784
|
}
|
|
2774
|
-
class
|
|
2785
|
+
class vt {
|
|
2775
2786
|
constructor(e, n, l, o) {
|
|
2776
2787
|
N(this, "name", "textAlign");
|
|
2777
2788
|
this.docModel = e, this.selectionManager = n, this._formatKey = l, this._value = o;
|
|
@@ -2793,9 +2804,9 @@ class bl {
|
|
|
2793
2804
|
this.register("insertText", (n) => {
|
|
2794
2805
|
const { focus: l } = this.selectionManager.selection;
|
|
2795
2806
|
return new ml(this.docModel, this.selectionManager, l, n);
|
|
2796
|
-
}), this.register("insertParagraph", () => new yl(this.docModel, this.selectionManager)), this.register("deleteBackward", () => new
|
|
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) => {
|
|
2797
2808
|
this.register(n, () => new Ue(this.docModel, this.selectionManager, n));
|
|
2798
|
-
}), 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
|
|
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) => {
|
|
2799
2810
|
if (n) {
|
|
2800
2811
|
const l = n;
|
|
2801
2812
|
this.selectionManager.setSelection(l.anchor, l.focus);
|
|
@@ -2825,7 +2836,7 @@ class bl {
|
|
|
2825
2836
|
o && (o.execute(), this.historyManager.push(o));
|
|
2826
2837
|
}
|
|
2827
2838
|
}
|
|
2828
|
-
class
|
|
2839
|
+
class _l {
|
|
2829
2840
|
constructor(e, n) {
|
|
2830
2841
|
N(this, "_el", null);
|
|
2831
2842
|
N(this, "_commandManager");
|
|
@@ -2900,11 +2911,11 @@ class xl {
|
|
|
2900
2911
|
if (!e || !this._el) return;
|
|
2901
2912
|
const n = e.anchorNode, l = e.focusNode;
|
|
2902
2913
|
if (!n || !l || !this._el.contains(n) && !this._el.contains(l)) return;
|
|
2903
|
-
const o =
|
|
2914
|
+
const o = bt.domToModelPoint(n, e.anchorOffset), s = bt.domToModelPoint(l, e.focusOffset);
|
|
2904
2915
|
o && s && this._selectionManager.setSelection(o, s);
|
|
2905
2916
|
}
|
|
2906
2917
|
}
|
|
2907
|
-
class
|
|
2918
|
+
class xl {
|
|
2908
2919
|
constructor(e = {}) {
|
|
2909
2920
|
N(this, "docModel");
|
|
2910
2921
|
N(this, "selection");
|
|
@@ -2915,7 +2926,7 @@ class _l {
|
|
|
2915
2926
|
N(this, "_plugins", []);
|
|
2916
2927
|
N(this, "_inputEl", null);
|
|
2917
2928
|
var n;
|
|
2918
|
-
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));
|
|
2919
2930
|
}
|
|
2920
2931
|
// ─── 公共 API ─────────────────────────────────────────────────────────────
|
|
2921
2932
|
/**
|
|
@@ -2949,7 +2960,7 @@ class _l {
|
|
|
2949
2960
|
}
|
|
2950
2961
|
/** 从 JSON 加载文档(清空历史) */
|
|
2951
2962
|
loadJSON(e) {
|
|
2952
|
-
const n =
|
|
2963
|
+
const n = st.fromJSON(e);
|
|
2953
2964
|
Object.assign(this.docModel.data, n.data), this.history.clear();
|
|
2954
2965
|
}
|
|
2955
2966
|
get isReadonly() {
|
|
@@ -2959,15 +2970,15 @@ class _l {
|
|
|
2959
2970
|
return ["undo", "redo", "selectAll", "setSelection"].includes(e);
|
|
2960
2971
|
}
|
|
2961
2972
|
}
|
|
2962
|
-
const
|
|
2973
|
+
const Qt = Symbol("editor");
|
|
2963
2974
|
function El(t) {
|
|
2964
|
-
const e = new
|
|
2965
|
-
return
|
|
2975
|
+
const e = new xl(t);
|
|
2976
|
+
return yt(Qt, e), rt(() => {
|
|
2966
2977
|
e.unmount();
|
|
2967
2978
|
}), e;
|
|
2968
2979
|
}
|
|
2969
2980
|
function Sl() {
|
|
2970
|
-
const t =
|
|
2981
|
+
const t = mt(Qt);
|
|
2971
2982
|
if (!t)
|
|
2972
2983
|
throw new Error("[useEditor] 必须在 EditorContainer 组件内使用");
|
|
2973
2984
|
return t;
|
|
@@ -2978,9 +2989,9 @@ const kl = gl, Fl = {
|
|
|
2978
2989
|
}
|
|
2979
2990
|
};
|
|
2980
2991
|
export {
|
|
2981
|
-
|
|
2992
|
+
xl as Editor,
|
|
2982
2993
|
kl as EditorContainer,
|
|
2983
|
-
|
|
2994
|
+
Qt as EditorKey,
|
|
2984
2995
|
El as createEditor,
|
|
2985
2996
|
Fl as default,
|
|
2986
2997
|
Sl as useEditor
|