@guodun/antdv 1.7.6 → 1.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.mjs +152 -146
  2. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +415 -295
  3. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1040 -993
  4. package/dist/es/components/pro-contract-template-designer/src/composables/use-auto-pagination.mjs +141 -47
  5. package/dist/es/components/pro-contract-template-designer/src/composables/use-draft-cache-session.mjs +1 -1
  6. package/dist/es/components/pro-contract-template-designer/src/composables/use-page-authoring.mjs +22 -21
  7. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-authoring.mjs +37 -36
  8. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +125 -75
  9. package/dist/es/components/pro-contract-template-designer/src/utils/authoring-search.mjs +34 -13
  10. package/dist/es/components/pro-contract-template-designer/src/utils/caret-viewport.mjs +41 -0
  11. package/dist/es/components/pro-contract-template-designer/src/utils/document-outline.mjs +24 -1
  12. package/dist/es/components/pro-contract-template-designer/src/utils/editor-snapshot-cache.mjs +15 -0
  13. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  14. package/dist/es/index.mjs +21 -21
  15. package/dist/es/node_modules/@tiptap/pm/dist/transform/index.mjs +1 -0
  16. package/dist/es/node_modules/prosemirror-transform/dist/index.mjs +161 -67
  17. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.cjs +1 -1
  18. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  19. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  20. package/dist/lib/components/pro-contract-template-designer/src/composables/use-auto-pagination.cjs +1 -1
  21. package/dist/lib/components/pro-contract-template-designer/src/composables/use-draft-cache-session.cjs +1 -1
  22. package/dist/lib/components/pro-contract-template-designer/src/composables/use-page-authoring.cjs +1 -1
  23. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-authoring.cjs +1 -1
  24. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
  25. package/dist/lib/components/pro-contract-template-designer/src/utils/authoring-search.cjs +1 -1
  26. package/dist/lib/components/pro-contract-template-designer/src/utils/caret-viewport.cjs +1 -0
  27. package/dist/lib/components/pro-contract-template-designer/src/utils/document-outline.cjs +1 -1
  28. package/dist/lib/components/pro-contract-template-designer/src/utils/editor-snapshot-cache.cjs +1 -0
  29. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  30. package/dist/lib/index.cjs +1 -1
  31. package/dist/lib/node_modules/@tiptap/pm/dist/transform/index.cjs +1 -0
  32. package/dist/lib/node_modules/prosemirror-transform/dist/index.cjs +2 -2
  33. package/dist/theme/icon.css +1 -1
  34. package/dist/theme/index.css +1 -1
  35. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.d.ts +1 -0
  36. package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +28 -0
  37. package/dist/types/components/pro-contract-template-designer/src/composables/use-auto-pagination.d.ts +25 -2
  38. package/dist/types/components/pro-contract-template-designer/src/composables/use-draft-cache-session.d.ts +1 -1
  39. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +10 -1
  40. package/dist/types/components/pro-contract-template-designer/src/utils/authoring-search.d.ts +5 -0
  41. package/dist/types/components/pro-contract-template-designer/src/utils/caret-viewport.d.ts +18 -0
  42. package/dist/types/components/pro-contract-template-designer/src/utils/document-outline.d.ts +6 -0
  43. package/dist/types/components/pro-contract-template-designer/src/utils/editor-snapshot-cache.d.ts +16 -0
  44. package/package.json +3 -3
  45. package/dist/theme/dept-selector.css +0 -1
  46. package/dist/theme/pro-selector-group.css +0 -1
  47. package/dist/theme/role-selector.css +0 -1
@@ -1,71 +1,165 @@
1
1
  import { createBlankPage as e } from "./use-template-designer.mjs";
2
- import { nextTick as t } from "vue";
2
+ import { nextTick as t, toRaw as n, watch as r } from "vue";
3
3
  //#region src/components/pro-contract-template-designer/src/composables/use-auto-pagination.ts
4
- function n(e) {
4
+ function i(e) {
5
5
  return {
6
6
  type: "doc",
7
7
  content: e.length ? e : [{ type: "paragraph" }]
8
8
  };
9
9
  }
10
- function r(e) {
10
+ function a(e) {
11
11
  return e.replace(/<p>\s*(<br>)?\s*<\/p>/gi, "").trim().length === 0;
12
12
  }
13
- function i(e, t, i) {
14
- let a = e.contentJson?.content, o = [...t, ...a?.length ? a : []], s = r(e.contentHtml || "") ? "" : e.contentHtml;
13
+ function o(e, t, n) {
14
+ let r = e.contentJson?.content, o = [...t, ...r?.length ? r : []], s = a(e.contentHtml || "") ? "" : e.contentHtml;
15
15
  return {
16
16
  ...e,
17
- contentHtml: `${i}${s}`,
18
- contentJson: n(o)
17
+ contentHtml: `${n}${s}`,
18
+ contentJson: i(o)
19
19
  };
20
20
  }
21
- function a(r) {
22
- function a(e = r.activePageId.value) {
23
- if (r.readonlyState.value) return;
24
- let n = r.templateValue.value.pages.findIndex((e) => e.id === r.pendingPaginationPageId.value), i = r.templateValue.value.pages.findIndex((t) => t.id === e);
25
- (!r.pendingPaginationPageId.value || n < 0 || i >= 0 && i < n) && (r.pendingPaginationPageId.value = e), !r.isAutoPaginating.value && t(() => o());
21
+ function s(s) {
22
+ let c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = !1, p = !1, m = 0, h, g, _ = r(s.readonlyState, (e) => {
23
+ e && T();
24
+ }, { flush: "sync" });
25
+ function v(e) {
26
+ let t = /* @__PURE__ */ new Set();
27
+ for (let [r, i] of Array.from(d)) {
28
+ if (e && i.sourceId !== e) continue;
29
+ d.delete(r);
30
+ let o = s.templateValue.value.pages.find((e) => e.id === r), c = o?.contentJson?.content, l = !c?.length || c.length === 1 && c[0].type === "paragraph" && !c[0].content?.length, u = s.pageRefs.get(r), f = u?.isUntouchedPaginationBlank?.(i.page);
31
+ i.generation === m && o && (n(o) === i.page || f === !0) && l && a(o.contentHtml || "") && !u?.isComposing?.() && f !== !1 && t.add(r);
32
+ }
33
+ let r = s.templateValue.value.pages;
34
+ if (r.length && r.every((e) => t.has(e.id)) && t.delete(r[0].id), t.size) {
35
+ for (let e of Array.from(t)) c.delete(e), l.delete(e), u.delete(e);
36
+ s.applyPagesChange(s.templateValue.value.pages.filter((e) => !t.has(e.id))), y();
37
+ }
38
+ return t;
39
+ }
40
+ function y() {
41
+ s.pendingPaginationPageId.value = c.values().next().value ?? l.values().next().value ?? "";
42
+ }
43
+ function b() {
44
+ f || p || s.isAutoPaginating.value || s.readonlyState.value || (f = !0, t(() => {
45
+ f = !1, p || w();
46
+ }));
47
+ }
48
+ function x(e = s.activePageId.value) {
49
+ if (!(p || s.readonlyState.value || !e)) {
50
+ l.delete(e);
51
+ for (let t of Array.from(l)) {
52
+ let n = s.templateValue.value.pages.findIndex((e) => e.id === t);
53
+ s.templateValue.value.pages[n + 1]?.id === e && (l.delete(t), c.add(t));
54
+ }
55
+ c.add(e), y(), b();
56
+ }
57
+ }
58
+ function S() {
59
+ if (p || s.readonlyState.value) return;
60
+ let e = m, t = new Set(s.templateValue.value.pages.map((e) => e.id));
61
+ for (let n of Array.from(d.values())) if (t.has(n.sourceId) || v(n.sourceId), p || e !== m || s.readonlyState.value) return;
62
+ c.clear(), l.clear();
63
+ let n = new Set(s.templateValue.value.pages.map((e) => e.id));
64
+ for (let e of Array.from(u.keys())) n.has(e) || u.delete(e);
65
+ for (let e of Array.from(n)) c.add(e);
66
+ y(), b();
67
+ }
68
+ function C() {
69
+ return new Promise((e) => {
70
+ g = e, h = setTimeout(() => {
71
+ h = void 0, g = void 0, e();
72
+ }, 0);
73
+ });
26
74
  }
27
- async function o() {
28
- if (!r.isAutoPaginating.value) {
29
- r.isAutoPaginating.value = !0;
30
- try {
31
- let a = r.pendingPaginationPageId.value;
32
- r.pendingPaginationPageId.value = "";
33
- let o = 0, s = Math.max(40, r.normalizedMaxPages.value + 1);
34
- for (; o < s;) {
35
- await t();
36
- let s = r.syncPageEditors().pages, c = Math.max(0, s.findIndex((e) => e.id === a)), l = !1;
37
- for (let t = c; t < s.length; t += 1) {
38
- let o = s[t];
39
- if (t === s.length - 1 && s.length >= r.normalizedMaxPages.value && r.pageRefs.get(o.id)?.hasOverflowContent()) {
40
- r.notifyPageLimit("auto-pagination");
41
- break;
75
+ async function w() {
76
+ if (p || s.readonlyState.value || s.isAutoPaginating.value) return;
77
+ let n = m;
78
+ s.isAutoPaginating.value = !0;
79
+ let r = performance.now();
80
+ try {
81
+ for (; c.size && !p && n === m && !s.readonlyState.value && (await t(), !(p || n !== m || s.readonlyState.value));) {
82
+ let t = c.values().next().value;
83
+ c.delete(t);
84
+ let a = s.templateValue.value.pages, f = a.findIndex((e) => e.id === t), h = s.pageRefs.get(t), g = a[f + 1], _ = g && s.pageRefs.get(g.id);
85
+ if (f < 0) {
86
+ u.delete(t), v(t);
87
+ continue;
88
+ }
89
+ if (!h || h.isReady?.() === !1 || h.isComposing?.() || _?.isComposing?.()) {
90
+ l.add(t);
91
+ continue;
92
+ }
93
+ let b = u.get(t);
94
+ if (b && (u.delete(t), h.restorePaginationSelection?.(b.selection, b.contentHtml), p || n !== m || s.readonlyState.value)) break;
95
+ if (g && d.get(g.id)?.sourceId === t && a.length > s.normalizedMaxPages.value) {
96
+ let e = v(t);
97
+ if (p || n !== m || s.readonlyState.value) break;
98
+ if (e.has(g.id)) {
99
+ c.add(t), y();
100
+ continue;
101
+ }
102
+ }
103
+ if ((!_ || _.isReady?.() === !1) && (g || a.length < s.normalizedMaxPages.value) && h.hasOverflowSelection?.() === !0) {
104
+ if (l.add(t), !g) {
105
+ let r = e(a.length + 1, s.getPageSize(a[f]));
106
+ d.set(r.id, {
107
+ sourceId: t,
108
+ generation: n,
109
+ page: r
110
+ }), s.applyPagesChange([...s.templateValue.value.pages, r]);
111
+ }
112
+ y();
113
+ continue;
114
+ }
115
+ if (Array.from(d.values()).some((e) => e.sourceId === t) && !h.hasOverflowContent()) {
116
+ if (v(t), p || n !== m || s.readonlyState.value) break;
117
+ y();
118
+ continue;
119
+ }
120
+ if (!g && a.length >= s.normalizedMaxPages.value) h.hasOverflowContent() && s.notifyPageLimit("auto-pagination");
121
+ else {
122
+ let t = s.captureViewport?.();
123
+ try {
124
+ let t = h.splitOverflowContent();
125
+ if (t) {
126
+ if (p || n !== m || s.readonlyState.value) break;
127
+ g && d.delete(g.id);
128
+ let r = g ? _?.prependContent(t.overflowContent) ?? o(g, t.overflowContent, t.overflowHtml) : e(a.length + 1, s.getPageSize(t.page), t.overflowHtml, i(t.overflowContent));
129
+ if (p || n !== m || s.readonlyState.value) break;
130
+ let h = s.templateValue.value.pages.slice(), v = h[f];
131
+ if (v.contentHtml === a[f].contentHtml && v.contentJson === a[f].contentJson && (h[f] = t.page), g ? h[f + 1] = r : h.push(r), s.applyPagesChange(h), p || n !== m || s.readonlyState.value || (t.selection && (_?.isReady?.() !== !1 && _?.restorePaginationSelection ? _.restorePaginationSelection(t.selection, r.contentHtml) : u.set(r.id, {
132
+ selection: t.selection,
133
+ contentHtml: r.contentHtml
134
+ })), p || n !== m || s.readonlyState.value)) break;
135
+ let y = r.id;
136
+ l.delete(y), c.add(y);
42
137
  }
43
- let c = r.pageRefs.get(o.id)?.splitOverflowContent();
44
- if (!c) continue;
45
- let u = r.syncPageEditors().pages, d = u.findIndex((e) => e.id === o.id);
46
- if (d < 0) break;
47
- u[d] = c.page;
48
- let f = u[d + 1];
49
- f ? u[d + 1] = r.pageRefs.get(f.id)?.prependContent(c.overflowContent) ?? i(f, c.overflowContent, c.overflowHtml) : u.push(e(u.length + 1, r.getPageSize(c.page), c.overflowHtml, n(c.overflowContent))), r.commitBodyChange({
50
- ...r.templateValue.value,
51
- pages: u
52
- }), a = u[d + 1]?.id ?? c.page.id, l = !0;
53
- break;
138
+ } finally {
139
+ t?.();
54
140
  }
55
- if (!l) break;
56
- o += 1;
57
141
  }
58
- } finally {
59
- r.isAutoPaginating.value = !1, r.pendingPaginationPageId.value && t(() => o());
142
+ y(), c.size && performance.now() - r >= (s.timeBudgetMs ?? 8) && (await C(), r = performance.now());
60
143
  }
144
+ } finally {
145
+ s.isAutoPaginating.value = !1, y(), c.size && b();
61
146
  }
62
147
  }
148
+ function T() {
149
+ v(), m += 1, u.clear(), c.clear(), l.clear(), h !== void 0 && clearTimeout(h), h = void 0, g?.(), g = void 0, y();
150
+ }
151
+ function E() {
152
+ _(), p = !0, T();
153
+ }
63
154
  return {
64
- scheduleAutoPaginate: a,
65
- runAutoPagination: o,
66
- createDocContent: n,
67
- prependOverflowToPageData: i
155
+ scheduleAutoPaginate: x,
156
+ scheduleFullPagination: S,
157
+ runAutoPagination: w,
158
+ resetPagination: T,
159
+ disposePagination: E,
160
+ createDocContent: i,
161
+ prependOverflowToPageData: o
68
162
  };
69
163
  }
70
164
  //#endregion
71
- export { a as useAutoPagination };
165
+ export { s as useAutoPagination };
@@ -76,7 +76,7 @@ function g(g) {
76
76
  let e = s(i(), y());
77
77
  if (e.valueSerialized && (_ = e.valueSerialized), e.value) {
78
78
  let n = g.commit(t(e.value, g.pageSize()));
79
- g.activePageId.value = n.pages[0]?.id ?? "", g.selectedVariableKey.value = "", g.scheduleAutoPaginate(g.activePageId.value), g.updateDraftCacheStatus(e.status);
79
+ g.activePageId.value = n.pages[0]?.id ?? "", g.selectedVariableKey.value = "", g.scheduleFullPagination(), g.updateDraftCacheStatus(e.status);
80
80
  return;
81
81
  }
82
82
  e.status.type !== "idle" && e.status.type !== "invalid" && g.updateDraftCacheStatus(e.status);
@@ -1,29 +1,30 @@
1
- import { findContractHeadingPosition as e, findContractTextMatches as t, replaceContractTextMatches as n } from "../utils/authoring-search.mjs";
1
+ import { createContractTextMatchCache as e, findContractHeadingPosition as t, replaceContractTextMatches as n } from "../utils/authoring-search.mjs";
2
2
  import { createContractTextSearchPlugin as r, updateContractTextSearch as i } from "../extensions/authoring-search.mjs";
3
- import { watch as a } from "vue";
3
+ import { onScopeDispose as a, watch as o } from "vue";
4
4
  //#region src/components/pro-contract-template-designer/src/composables/use-page-authoring.ts
5
- function o(o) {
6
- a(o.editor, (e) => {
7
- !e || e.isDestroyed || (e.registerPlugin(r()), i(e, o.search()));
8
- }, { immediate: !0 }), a(o.search, (e) => {
9
- let t = o.editor();
5
+ function s(s) {
6
+ let c = e();
7
+ a(() => c.clear()), o(s.editor, (e) => {
8
+ c.clear(), !(!e || e.isDestroyed) && (e.registerPlugin(r()), i(e, s.search()));
9
+ }, { immediate: !0 }), o(s.search, (e) => {
10
+ let t = s.editor();
10
11
  t && !t.isDestroyed && i(t, e);
11
12
  }, { deep: !0 });
12
- function s(e, n) {
13
- let r = o.editor();
14
- return r ? t(r.view.state.doc, e, n) : [];
13
+ function l(e, t) {
14
+ let n = s.editor();
15
+ return n && !n.isDestroyed ? c.read(n.view.state.doc, e, t) : [];
15
16
  }
16
- function c(e) {
17
- let t = o.editor();
17
+ function u(e) {
18
+ let t = s.editor();
18
19
  if (!t || e.from < 1 || e.to > t.state.doc.content.size) return !1;
19
20
  let n = t.view.state.selection;
20
21
  return (n.from !== e.from || n.to !== e.to) && t.commands.setTextSelection(e), t.commands.scrollIntoView(), !0;
21
22
  }
22
- function l(e, t, r) {
23
- return n(o.editor(), o.readonly(), e, t, r);
23
+ function d(e, t, r) {
24
+ return n(s.editor(), s.readonly(), e, t, r);
24
25
  }
25
- function u(t) {
26
- let n = o.editor(), r = n && e(n.state.doc, t);
26
+ function f(e) {
27
+ let n = s.editor(), r = n && t(n.state.doc, e);
27
28
  if (!n || r === void 0) return !1;
28
29
  n.chain().setTextSelection(r).focus(void 0, { scrollIntoView: !1 }).run();
29
30
  let i = n.view.nodeDOM(r - 1);
@@ -33,11 +34,11 @@ function o(o) {
33
34
  }), !0;
34
35
  }
35
36
  return {
36
- findText: s,
37
- revealSearchMatch: c,
38
- replaceSearchMatches: l,
39
- focusHeading: u
37
+ findText: l,
38
+ revealSearchMatch: u,
39
+ replaceSearchMatches: d,
40
+ focusHeading: f
40
41
  };
41
42
  }
42
43
  //#endregion
43
- export { o as usePageAuthoring };
44
+ export { s as usePageAuthoring };
@@ -2,56 +2,57 @@ import { resolveContractAuthoringShortcut as e } from "../utils/authoring-shortc
2
2
  import { computed as t, nextTick as n, shallowRef as r, watch as i } from "vue";
3
3
  //#region src/components/pro-contract-template-designer/src/composables/use-template-authoring.ts
4
4
  function a(a) {
5
- let o = r(), s = r(""), c = r(""), l = r(!1), u = r(0), d = r(""), f = t(() => o.value === "find" || o.value === "replace"), p = !1, m = r(0);
5
+ let o = r(), s = r(""), c = r(""), l = r(!1), u = r(0), d = r(""), f = t(() => o.value === "find" || o.value === "replace"), p = !1, m, h = r(0);
6
6
  i([a.fileId, () => JSON.stringify(a.pages().map((e) => e.id))], async () => {
7
- await n(), m.value += 1;
7
+ await n(), h.value += 1;
8
8
  }, { flush: "post" });
9
- let h = t(() => (a.fileId(), m.value, a.pages().flatMap((e, t) => (e.contentHtml, s.value ? (a.pageRefs.get(e.id)?.findText(s.value, l.value) ?? []).map((n) => ({
9
+ let g = t(() => !f.value || !s.value ? [] : (a.fileId(), h.value, a.pages().flatMap((e, t) => (e.contentHtml, (a.pageRefs.get(e.id)?.findText(s.value, l.value) ?? []).map((n) => ({
10
10
  ...n,
11
11
  pageId: e.id,
12
12
  pageIndex: t
13
- })) : [])))), g = t(() => h.value[u.value]), _ = t(() => f.value ? s.value : "");
14
- function v() {
15
- let e = g.value;
16
- !f.value || !e || (a.activatePage(e.pageId, !1), a.pageRefs.get(e.pageId)?.revealSearchMatch(e));
13
+ })))))), _ = t(() => g.value[u.value]), v = t(() => f.value ? s.value : "");
14
+ function y() {
15
+ let e = _.value;
16
+ !f.value || !e || (m = e, a.activatePage(e.pageId, !1), a.pageRefs.get(e.pageId)?.revealSearchMatch(e));
17
17
  }
18
18
  i([
19
19
  s,
20
20
  l,
21
21
  a.fileId
22
22
  ], () => {
23
- p = !0, u.value = 0, d.value = "";
24
- }, { flush: "sync" }), i(h, (e, t) => {
25
- let n = t[u.value], r = !p && n ? e.findIndex((e) => e.pageId === n.pageId && e.from === n.from && e.to === n.to) : -1;
26
- u.value = p ? 0 : r >= 0 ? r : Math.min(u.value, Math.max(0, e.length - 1)), p = !1, v();
23
+ p = !0, m = void 0, u.value = 0, d.value = "";
24
+ }, { flush: "sync" }), i(g, (e, t) => {
25
+ if (!f.value) return;
26
+ let n = t[u.value] ?? m, r = !p && n ? e.findIndex((e) => e.pageId === n.pageId && e.from === n.from && e.to === n.to) : -1;
27
+ u.value = p ? 0 : r >= 0 ? r : Math.min(u.value, Math.max(0, e.length - 1)), p = !1, y();
27
28
  }, { flush: "post" });
28
- async function y(e) {
29
- a.beforeOpen(), o.value = e, await n(), v(), a.focusPanel();
29
+ async function b(e) {
30
+ a.beforeOpen(), o.value = e, await n(), y(), a.focusPanel();
30
31
  }
31
- function b(e = !0) {
32
+ function x(e = !0) {
32
33
  let t = o.value;
33
- o.value = void 0, e && t && n(() => a.focusTrigger(t));
34
+ f.value && (m = _.value), o.value = void 0, e && t && n(() => a.focusTrigger(t));
34
35
  }
35
- function x(e) {
36
- h.value.length && (u.value = (u.value + e + h.value.length) % h.value.length, v());
36
+ function S(e) {
37
+ g.value.length && (u.value = (u.value + e + g.value.length) % g.value.length, y());
37
38
  }
38
- async function S() {
39
- let e = g.value;
39
+ async function C() {
40
+ let e = _.value;
40
41
  if (a.readonly() || !e) return;
41
42
  let t = a.pageRefs.get(e.pageId)?.replaceSearchMatches({
42
43
  query: s.value,
43
44
  matchCase: l.value
44
45
  }, c.value, [e]) ?? 0;
45
46
  if (d.value = t ? "已替换 1 处,可在该页撤销" : "未修改正文:内容已变化或替换文字相同", await n(), t) {
46
- let t = h.value.findIndex((t) => t.pageIndex > e.pageIndex || t.pageId === e.pageId && t.from >= e.from + c.value.length);
47
+ let t = g.value.findIndex((t) => t.pageIndex > e.pageIndex || t.pageId === e.pageId && t.from >= e.from + c.value.length);
47
48
  u.value = Math.max(0, t);
48
49
  }
49
- v();
50
+ y();
50
51
  }
51
- async function C() {
52
- if (a.readonly() || !h.value.length) return;
52
+ async function w() {
53
+ if (a.readonly() || !g.value.length) return;
53
54
  let e = /* @__PURE__ */ new Map();
54
- for (let t of h.value) {
55
+ for (let t of g.value) {
55
56
  let n = e.get(t.pageId) ?? [];
56
57
  n.push(t), e.set(t.pageId, n);
57
58
  }
@@ -63,29 +64,29 @@ function a(a) {
63
64
  }, c.value, i) ?? 0;
64
65
  t += e, e && (r += 1);
65
66
  }
66
- d.value = t ? `已在本文件 ${r} 页替换 ${t} 处,可逐页撤销` : "未修改正文:内容已变化或替换文字相同", u.value = 0, await n(), v();
67
+ d.value = t ? `已在本文件 ${r} 页替换 ${t} 处,可逐页撤销` : "未修改正文:内容已变化或替换文字相同", u.value = 0, await n(), y();
67
68
  }
68
- function w(t) {
69
+ function T(t) {
69
70
  let n = e(t, a.root());
70
- !n || (n === "next" || n === "previous") && !f.value || (t.preventDefault(), t.stopPropagation(), n === "next" || n === "previous" ? x(n === "next" ? 1 : -1) : y(n));
71
+ !n || (n === "next" || n === "previous") && !f.value || (t.preventDefault(), t.stopPropagation(), n === "next" || n === "previous" ? S(n === "next" ? 1 : -1) : b(n));
71
72
  }
72
73
  return {
73
74
  panel: o,
74
75
  query: s,
75
76
  replacement: c,
76
77
  matchCase: l,
77
- matches: h,
78
+ matches: g,
78
79
  currentIndex: u,
79
- currentMatch: g,
80
+ currentMatch: _,
80
81
  feedback: d,
81
- highlightQuery: _,
82
+ highlightQuery: v,
82
83
  searchOpen: f,
83
- open: y,
84
- close: b,
85
- navigate: x,
86
- replaceCurrent: S,
87
- replaceAll: C,
88
- handleKeydown: w
84
+ open: b,
85
+ close: x,
86
+ navigate: S,
87
+ replaceCurrent: C,
88
+ replaceAll: w,
89
+ handleKeydown: T
89
90
  };
90
91
  }
91
92
  //#endregion