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