@bireturn/word-editor 1.0.0 → 1.0.2

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