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