@guodun/antdv 1.4.1 → 1.4.3

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 (135) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +304 -293
  2. package/dist/es/components/contract-signing-location/src/coordinates.mjs +23 -23
  3. package/dist/es/components/contract-signing-location/src/location-rules.mjs +20 -10
  4. package/dist/es/components/contract-signing-location/src/page-layout.mjs +12 -9
  5. package/dist/es/components/contract-signing-location/src/template-source.mjs +2 -0
  6. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +208 -180
  7. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.mjs +2 -1
  8. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.mjs +5 -0
  9. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.mjs +690 -0
  10. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.mjs +5 -0
  11. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +253 -0
  12. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.mjs +5 -0
  13. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.mjs +87 -0
  14. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.mjs +5 -0
  15. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.mjs +98 -0
  16. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.mjs +5 -0
  17. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.mjs +550 -0
  18. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.mjs +5 -0
  19. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.mjs +117 -0
  20. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.mjs +5 -0
  21. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.mjs +96 -0
  22. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +51 -26
  23. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +56 -33
  24. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.mjs +5 -0
  25. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.mjs +29 -0
  26. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.mjs +5 -0
  27. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.mjs +179 -0
  28. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.mjs +5 -0
  29. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.mjs +390 -0
  30. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +332 -263
  31. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1442 -2287
  32. package/dist/es/components/pro-contract-template-designer/src/composables/use-auto-pagination.mjs +71 -0
  33. package/dist/es/components/pro-contract-template-designer/src/composables/use-designer-files.mjs +11 -0
  34. package/dist/es/components/pro-contract-template-designer/src/composables/use-draft-cache-session.mjs +111 -0
  35. package/dist/es/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.mjs +79 -0
  36. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +189 -160
  37. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-files.mjs +35 -22
  38. package/dist/es/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.mjs +71 -0
  39. package/dist/es/components/pro-contract-template-designer/src/constants.mjs +71 -10
  40. package/dist/es/components/pro-contract-template-designer/src/extensions/editor-extensions.mjs +1 -0
  41. package/dist/es/components/pro-contract-template-designer/src/utils/block-style.mjs +43 -0
  42. package/dist/es/components/pro-contract-template-designer/src/utils/context-menu-viewport.mjs +13 -0
  43. package/dist/es/components/pro-contract-template-designer/src/utils/editor-state.mjs +7 -0
  44. package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +398 -0
  45. package/dist/es/components/pro-contract-template-designer/src/utils/serialize-fingerprint.mjs +6 -0
  46. package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +88 -72
  47. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  48. package/dist/es/index.mjs +20 -20
  49. package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
  50. package/dist/lib/components/contract-signing-location/src/coordinates.cjs +1 -1
  51. package/dist/lib/components/contract-signing-location/src/location-rules.cjs +1 -1
  52. package/dist/lib/components/contract-signing-location/src/page-layout.cjs +1 -1
  53. package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
  54. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +1 -1
  55. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.cjs +1 -1
  56. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.cjs +1 -0
  57. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.cjs +1 -0
  58. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.cjs +1 -0
  59. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -0
  60. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.cjs +1 -0
  61. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.cjs +1 -0
  62. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.cjs +1 -0
  63. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.cjs +1 -0
  64. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.cjs +1 -0
  65. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.cjs +1 -0
  66. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.cjs +1 -0
  67. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.cjs +1 -0
  68. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.cjs +1 -0
  69. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.cjs +1 -0
  70. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
  71. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.cjs +1 -1
  72. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.cjs +1 -0
  73. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.cjs +1 -0
  74. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.cjs +1 -0
  75. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.cjs +1 -0
  76. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.cjs +1 -0
  77. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.cjs +1 -0
  78. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  79. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  80. package/dist/lib/components/pro-contract-template-designer/src/composables/use-auto-pagination.cjs +1 -0
  81. package/dist/lib/components/pro-contract-template-designer/src/composables/use-designer-files.cjs +1 -0
  82. package/dist/lib/components/pro-contract-template-designer/src/composables/use-draft-cache-session.cjs +1 -0
  83. package/dist/lib/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.cjs +1 -0
  84. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
  85. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-files.cjs +2 -2
  86. package/dist/lib/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.cjs +1 -0
  87. package/dist/lib/components/pro-contract-template-designer/src/constants.cjs +1 -1
  88. package/dist/lib/components/pro-contract-template-designer/src/extensions/editor-extensions.cjs +1 -1
  89. package/dist/lib/components/pro-contract-template-designer/src/utils/block-style.cjs +1 -0
  90. package/dist/lib/components/pro-contract-template-designer/src/utils/context-menu-viewport.cjs +1 -0
  91. package/dist/lib/components/pro-contract-template-designer/src/utils/editor-state.cjs +1 -0
  92. package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -0
  93. package/dist/lib/components/pro-contract-template-designer/src/utils/serialize-fingerprint.cjs +1 -0
  94. package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
  95. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  96. package/dist/lib/index.cjs +1 -1
  97. package/dist/theme/icon.css +1 -1
  98. package/dist/theme/index.css +1 -1
  99. package/dist/types/components/contract-signing-location/src/coordinates.d.ts +2 -2
  100. package/dist/types/components/contract-signing-location/src/page-layout.d.ts +2 -2
  101. package/dist/types/components/contract-signing-location/src/template-source.d.ts +2 -0
  102. package/dist/types/components/contract-signing-location/src/types.d.ts +3 -0
  103. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +3 -0
  104. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.d.ts +1 -0
  105. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.d.ts +104 -0
  106. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +60 -0
  107. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.d.ts +27 -0
  108. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.d.ts +13 -0
  109. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.d.ts +28 -0
  110. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.d.ts +77 -0
  111. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.d.ts +36 -0
  112. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.d.ts +5 -1
  113. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererHeader.vue.d.ts +4 -4
  114. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererToolbar.vue.d.ts +4 -4
  115. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.d.ts +12 -0
  116. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.d.ts +43 -0
  117. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.d.ts +77 -0
  118. package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +30 -32
  119. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +456 -12
  120. package/dist/types/components/pro-contract-template-designer/src/composables/use-auto-pagination.d.ts +43 -0
  121. package/dist/types/components/pro-contract-template-designer/src/composables/use-designer-files.d.ts +22 -0
  122. package/dist/types/components/pro-contract-template-designer/src/composables/use-draft-cache-session.d.ts +41 -0
  123. package/dist/types/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.d.ts +49 -0
  124. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +15 -1
  125. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-files.d.ts +13 -0
  126. package/dist/types/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.d.ts +19 -0
  127. package/dist/types/components/pro-contract-template-designer/src/constants.d.ts +7 -1
  128. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +89 -0
  129. package/dist/types/components/pro-contract-template-designer/src/utils/block-style.d.ts +4 -0
  130. package/dist/types/components/pro-contract-template-designer/src/utils/context-menu-viewport.d.ts +25 -0
  131. package/dist/types/components/pro-contract-template-designer/src/utils/editor-state.d.ts +8 -0
  132. package/dist/types/components/pro-contract-template-designer/src/utils/page-decorations.d.ts +90 -0
  133. package/dist/types/components/pro-contract-template-designer/src/utils/serialize-fingerprint.d.ts +8 -0
  134. package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +4 -1
  135. package/package.json +3 -3
@@ -1,98 +1,50 @@
1
1
  import { isContractTemplateFieldType as e } from "./types.mjs";
2
- import { ContractTemplateLocationRuleBuildError as t, SIGNING_PLACEMENT_MIME as n, SIGNING_PLACEMENT_TYPE_LABELS as r, applySigningPlacementPatch as i, buildContractLocationRules as a, buildSigningPlacementLocationRules as o, canMutateSigningPlacements as s, clampSigningPlacement as ee, createSigningPlacement as te, getSigningPlacementDefaultSize as ne, resolveSigningPlacementToolItems as re, scaleSigningPlacementToPage as ie, serializeSigningPlacementDragPayload as ae } from "./utils/signing-placement.mjs";
3
- import { CONTRACT_TEXT_STYLE_PRESETS as oe, DEFAULT_CONTRACT_FONT_FAMILY as se, DEFAULT_FONT_SIZE_PRESETS as ce, DEFAULT_TEXT_ALIGN_OPTIONS as le, resolveFontFamilyOptions as ue } from "./constants.mjs";
4
- import { DEFAULT_FIELD_STYLE as de, DEFAULT_FIELD_TYPES as fe, DEFAULT_PAGE_SIZE as pe, buildTemplatePreviewPages as me, cloneTemplateValue as c, collectTemplateLocationRuleExportErrors as he, constrainTemplatePageSizes as ge, createBlankPage as _e, createBlankTemplate as ve, createDefaultPage as ye, createTemplateVariable as be, exportTemplateValue as xe, getFieldOption as Se, getPageSizeKey as Ce, normalizeContractTemplateMaxPages as we, normalizePageSizeOptions as Te, normalizeTemplateValue as Ee, resolvePageSize as De, syncTemplateVariablesWithPages as Oe, validateTemplateValue as ke } from "./composables/use-template-designer.mjs";
5
- import { isSafeContractImageUrl as Ae } from "./utils/image-url.mjs";
6
- import { useFitWidthZoom as je } from "./composables/use-fit-width-zoom.mjs";
7
- import { MAX_CONTRACT_IMAGE_DIMENSION as Me, normalizeContractImageDimension as Ne, processContractImageFile as Pe } from "./utils/content-image.mjs";
2
+ import { ContractTemplateLocationRuleBuildError as t, SIGNING_PLACEMENT_TYPE_LABELS as n, buildContractLocationRules as r, buildSigningPlacementLocationRules as i, createSigningPlacement as a, resolveSigningPlacementToolItems as o, scaleSigningPlacementToPage as ee } from "./utils/signing-placement.mjs";
3
+ import { CONTRACT_BLOCK_STYLES as te, DEFAULT_CONTRACT_FONT_FAMILY as ne, DEFAULT_FONT_SIZE_PRESETS as re, DEFAULT_TEXT_ALIGN_OPTIONS as ie, resolveFontFamilyOptions as ae } from "./constants.mjs";
4
+ import { collectPageDecorationVariableKeys as oe, normalizePageDecorations as se, resolvePageDecorationPreset as ce, resolvePageDecorationValidationPath as le, rewritePageDecorationVariableTokens as ue } from "./utils/page-decorations.mjs";
5
+ import { DEFAULT_FIELD_STYLE as de, DEFAULT_FIELD_TYPES as s, DEFAULT_PAGE_SIZE as fe, buildTemplatePreviewPages as pe, cloneTemplateValue as c, collectTemplateLocationRuleExportErrors as me, collectTemplateValueVariableKeys as he, constrainTemplatePageSizes as ge, createBlankPage as _e, createBlankTemplate as ve, createDefaultPage as ye, createTemplateVariable as be, exportTemplateValue as xe, getFieldOption as Se, getPageSizeKey as Ce, normalizeContractTemplateMaxPages as we, normalizePageSizeOptions as Te, normalizeTemplateValue as Ee, resolvePageSize as De, syncTemplateVariablesWithPages as Oe, validateContractTemplateVariableKey as ke, validateTemplateValue as Ae } from "./composables/use-template-designer.mjs";
6
+ import { isSafeContractImageUrl as je } from "./utils/image-url.mjs";
7
+ import { useFitWidthZoom as Me } from "./composables/use-fit-width-zoom.mjs";
8
+ import { normalizeContractImageDimension as Ne, processContractImageFile as Pe } from "./utils/content-image.mjs";
8
9
  import { inferContextVariableLabel as Fe, resolveContextVariableWidth as Ie } from "./utils/context-variable.mjs";
9
10
  import Le from "./DesignerPage.mjs";
10
- import Re from "./ContractTemplatePreviewPage.mjs";
11
- import ze from "./TableContextMenu.mjs";
12
- import Be from "./TableSizePicker.mjs";
13
- import { DEFAULT_DRAFT_CACHE_INTERVAL as Ve, DEFAULT_DRAFT_CACHE_KEY as He, DEFAULT_DRAFT_CACHE_MAX_BYTES as l, clearTemplateDraftCache as Ue, createDraftCacheStatus as We, formatDraftCacheSavedAt as Ge, getBrowserDraftCacheStorage as Ke, isBlankTemplateDraftValue as qe, isBlankTemplateFilesDraftValue as Je, loadTemplateDraftCache as Ye, loadTemplateFilesDraftCache as Xe, saveTemplateDraftCache as Ze, saveTemplateFilesDraftCache as Qe } from "./composables/use-template-draft-cache.mjs";
14
- import { cloneContractTemplateFiles as u, createContractTemplateFile as $e, exportContractTemplateFiles as et, moveContractTemplateFile as tt, normalizeContractTemplateFiles as nt, removeContractTemplateFile as rt, renameContractTemplateFile as it, replaceContractTemplateFile as at, resolveContractTemplateActiveFileId as ot } from "./composables/use-template-files.mjs";
15
- import { resolveFieldTypeIcon as st, resolveSigningPlacementTypeIcon as ct } from "./utils/template-tool-icons.mjs";
16
- import lt from "./ContractTemplateFileBar.mjs";
17
- import ut from "./ContractTemplateDesignerSidebar.mjs";
18
- import dt from "./ContractTemplateDesignerInspector.mjs";
19
- import { CONTRACT_TEMPLATE_TOOLBAR_OVERFLOW_PRIORITY as ft, resolveContractTemplateToolbarOverflowKeys as pt } from "./utils/toolbar-overflow.mjs";
20
- import { Fragment as mt, Teleport as ht, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, nextTick as y, normalizeClass as b, normalizeStyle as gt, onBeforeUnmount as _t, onMounted as vt, openBlock as x, ref as S, renderList as yt, resolveDynamicComponent as bt, toDisplayString as C, unref as w, vShow as xt, watch as St, withCtx as T, withDirectives as Ct, withModifiers as wt } from "vue";
21
- import { Alert as Tt, Button as E, Input as Et, InputNumber as Dt, Modal as Ot, Popover as kt, Select as At, Switch as jt, Tooltip as D } from "ant-design-vue";
22
- import { useElementSize as Mt } from "@vueuse/core";
23
- import { AlignCenterOutlined as Nt, AlignLeftOutlined as Pt, AlignRightOutlined as Ft, AuditOutlined as It, BoldOutlined as Lt, ClearOutlined as Rt, ColumnWidthOutlined as zt, CopyOutlined as Bt, DatabaseOutlined as Vt, DeleteOutlined as Ht, DownOutlined as Ut, EllipsisOutlined as Wt, EyeOutlined as Gt, FileAddOutlined as Kt, FormatPainterOutlined as qt, FullscreenExitOutlined as Jt, FullscreenOutlined as Yt, ItalicOutlined as Xt, MinusOutlined as Zt, OrderedListOutlined as Qt, PictureOutlined as $t, PlusOutlined as en, RedoOutlined as tn, ReloadOutlined as nn, ScissorOutlined as rn, TableOutlined as an, UnderlineOutlined as on, UndoOutlined as sn, UnorderedListOutlined as cn, ZoomInOutlined as ln, ZoomOutOutlined as un } from "@ant-design/icons-vue";
11
+ import Re from "./TableContextMenu.mjs";
12
+ import ze from "./ContractTemplateDesignerWorkspaceHeader.mjs";
13
+ import Be from "./ContractTemplateDesignerToolbar.mjs";
14
+ import Ve from "./ContractTemplateTextContextMenu.mjs";
15
+ import He from "./ContractTemplateTextBubbleMenu.mjs";
16
+ import Ue from "./ContractTemplateImageContextMenu.mjs";
17
+ import We from "./ContractTemplatePreviewModal.mjs";
18
+ import Ge from "./ContractTemplateSubmitDataModal.mjs";
19
+ import { DEFAULT_DRAFT_CACHE_INTERVAL as Ke, DEFAULT_DRAFT_CACHE_KEY as qe, DEFAULT_DRAFT_CACHE_MAX_BYTES as l, createDraftCacheStatus as Je, formatDraftCacheSavedAt as Ye } from "./composables/use-template-draft-cache.mjs";
20
+ import { useAutoPagination as Xe } from "./composables/use-auto-pagination.mjs";
21
+ import { resolveSetActiveFileIdOptions as Ze } from "./composables/use-designer-files.mjs";
22
+ import { cloneContractTemplateFiles as u, constrainContractTemplateFiles as Qe, createContractTemplateFile as $e, exportContractTemplateFiles as et, moveContractTemplateFile as tt, normalizeContractTemplateFiles as nt, removeContractTemplateFile as rt, renameContractTemplateFile as it, replaceContractTemplateFile as at, resolveContractTemplateActiveFileId as ot } from "./composables/use-template-files.mjs";
23
+ import { useDraftCacheSession as st } from "./composables/use-draft-cache-session.mjs";
24
+ import { cloneSigningPlacement as ct, useSigningPlacementEditor as lt } from "./composables/use-signing-placement-editor.mjs";
25
+ import { resolveFieldTypeIcon as ut, resolveSigningPlacementTypeIcon as dt } from "./utils/template-tool-icons.mjs";
26
+ import ft from "./ContractTemplateFileBar.mjs";
27
+ import pt from "./ContractTemplateDesignerSidebar.mjs";
28
+ import mt from "./ContractTemplateDesignerInspector.mjs";
29
+ import ht from "./ContractTemplatePageDecorationsStudio.mjs";
30
+ import { serializeFingerprint as d } from "./utils/serialize-fingerprint.mjs";
31
+ import { isSameEditorState as gt } from "./utils/editor-state.mjs";
32
+ import { clampContextMenuPosition as _t, clampContextMenuToElement as vt } from "./utils/context-menu-viewport.mjs";
33
+ import { Fragment as yt, Teleport as bt, computed as f, createBlock as xt, createCommentVNode as St, createElementBlock as Ct, createElementVNode as p, createVNode as m, defineComponent as h, nextTick as g, normalizeClass as wt, normalizeStyle as Tt, onBeforeUnmount as Et, onMounted as Dt, openBlock as _, ref as v, renderList as Ot, toDisplayString as kt, unref as y, useId as At, vShow as jt, watch as b, withCtx as Mt, withDirectives as Nt } from "vue";
34
+ import { Alert as Pt, Modal as Ft, Tooltip as It } from "ant-design-vue";
35
+ import { useElementSize as Lt } from "@vueuse/core";
36
+ import { CompressOutlined as Rt, DownOutlined as zt } from "@ant-design/icons-vue";
24
37
  //#region src/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue?vue&type=script&setup=true&lang.ts
25
- var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { class: "gd-contract-template-designer__workspace-meta" }, pn = { class: "gd-contract-template-designer__workspace-actions" }, mn = { class: "gd-contract-template-designer__workspace-controls" }, hn = { class: "gd-contract-template-designer__zoom" }, gn = { class: "gd-contract-template-designer__workspace-buttons" }, _n = { class: "gd-contract-template-designer__toolbar" }, vn = { class: "gd-contract-template-designer__toolbar-group" }, yn = { class: "gd-contract-template-designer__toolbar-group gd-contract-template-designer__toolbar-group--style" }, bn = { class: "gd-contract-template-designer__toolbar-group gd-contract-template-designer__toolbar-group--format" }, xn = {
26
- class: "gd-contract-template-designer__toolbar-group gd-contract-template-designer__toolbar-group--insert",
27
- "data-toolbar-overflow-key": "insert"
28
- }, Sn = { class: "gd-contract-template-designer__popover gd-contract-template-designer__control-insert-popover" }, Cn = { class: "gd-contract-template-designer__text-menu-control-options" }, wn = ["aria-label", "onClick"], Tn = { class: "gd-contract-template-designer__popover gd-contract-template-designer__image-insert-popover" }, En = {
29
- class: "gd-contract-template-designer__image-size-fields",
30
- role: "group",
31
- "aria-label": "图片尺寸"
32
- }, Dn = {
33
- class: "gd-contract-template-designer__toolbar-group gd-contract-template-designer__toolbar-group--typography",
34
- "data-toolbar-overflow-key": "typography"
35
- }, On = ["value", "disabled"], kn = {
36
- class: "gd-contract-template-designer__toolbar-group gd-contract-template-designer__toolbar-group--cleanup",
37
- "data-toolbar-overflow-key": "cleanup"
38
- }, An = {
39
- class: "gd-contract-template-designer__toolbar-group gd-contract-template-designer__toolbar-group--table",
40
- "data-toolbar-overflow-key": "table"
41
- }, jn = { class: "gd-contract-template-designer__popover" }, Mn = { class: "gd-contract-template-designer__switch-row" }, Nn = { class: "gd-contract-template-designer__popover" }, Pn = { class: "gd-contract-template-designer__table-actions" }, Fn = {
42
- class: "gd-contract-template-designer__toolbar-more-panel",
43
- role: "menu",
44
- "aria-label": "更多编辑工具"
45
- }, In = { class: "gd-contract-template-designer__toolbar-more-section" }, Ln = { class: "gd-contract-template-designer__toolbar-more-section" }, Rn = { class: "gd-contract-template-designer__toolbar-more-section" }, zn = { class: "gd-contract-template-designer__toolbar-more-section" }, Bn = {
46
- key: 0,
38
+ var Bt = {
39
+ key: 2,
47
40
  class: "gd-contract-template-designer__validation"
48
- }, Vn = {
41
+ }, Vt = {
49
42
  key: 0,
50
43
  class: "gd-contract-template-designer__validation-list"
51
- }, Hn = ["onClick"], Un = {
52
- class: "gd-contract-template-designer__image-size-fields",
53
- role: "group",
54
- "aria-label": "图片尺寸"
55
- }, Wn = { class: "gd-contract-template-designer__popover-actions" }, Gn = {
56
- class: "gd-contract-template-designer__text-menu-row",
57
- role: "group",
58
- "aria-label": "编辑历史与剪贴板"
59
- }, Kn = {
60
- key: 0,
61
- class: "gd-contract-template-designer__text-menu-quick-insert",
62
- role: "group",
63
- "aria-label": "光标处插入"
64
- }, qn = {
65
- class: "gd-contract-template-designer__text-menu-row gd-contract-template-designer__text-menu-row--controls",
66
- role: "group",
67
- "aria-label": "文字样式"
68
- }, Jn = ["value"], Yn = ["aria-label"], Xn = { class: "gd-contract-template-designer__text-menu-control-head" }, Zn = { class: "gd-contract-template-designer__text-menu-control-options" }, Qn = ["aria-label", "onClick"], $n = ["disabled"], er = {
69
- class: "gd-contract-template-designer__text-menu-bind-list",
70
- role: "listbox",
71
- "aria-label": "已有正文控件"
72
- }, tr = ["onClick"], nr = { class: "gd-contract-template-designer__text-menu-bind-item-label" }, rr = { class: "gd-contract-template-designer__text-menu-bind-item-meta" }, ir = {
73
- key: 0,
74
- class: "gd-contract-template-designer__text-menu-bind-empty"
75
- }, ar = {
76
- class: "gd-contract-template-designer__text-menu-row",
77
- role: "group",
78
- "aria-label": "常用格式与列表"
79
- }, or = {
80
- class: "gd-contract-template-designer__text-menu-row gd-contract-template-designer__text-menu-row--cleanup",
81
- role: "group",
82
- "aria-label": "清理格式"
83
- }, sr = {
44
+ }, Ht = ["onClick"], Ut = {
84
45
  class: "gd-contract-template-designer__sr-status",
85
46
  "aria-live": "polite"
86
- }, cr = {
87
- key: 0,
88
- class: "gd-contract-template-designer__preview-layout"
89
- }, lr = {
90
- class: "gd-contract-template-designer__preview-file-nav",
91
- "aria-label": "合同文件预览切换"
92
- }, ur = ["aria-current", "onClick"], dr = {
93
- key: 0,
94
- class: "gd-contract-template-designer__preview-file"
95
- }, fr = { class: "gd-contract-template-designer__preview-file-title" }, pr = { class: "gd-contract-template-designer__submit-data" }, mr = .5, hr = 1.5, gr = .1, _r = 128, vr = 108, yr = 48, br = 24, xr = 10, Sr = 48, Cr = 304, wr = 300, Tr = 288, Er = 196, O = 12, Dr = 43, Or = 6, kr = 4, Ar = /* @__PURE__ */ v({
47
+ }, Wt = .5, Gt = 1.5, Kt = .1, qt = 120, Jt = 128, Yt = 108, Xt = 48, Zt = 24, Qt = 10, $t = 48, en = 8, tn = /* @__PURE__ */ h({
96
48
  name: "ProContractTemplateDesigner",
97
49
  __name: "ProContractTemplateDesigner",
98
50
  props: {
@@ -108,12 +60,12 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
108
60
  default: !1
109
61
  },
110
62
  height: { default: 760 },
111
- pageSize: { default: () => pe },
63
+ pageSize: { default: () => fe },
112
64
  pageSizeOptions: {},
113
65
  maxPages: { default: 20 },
114
66
  imageCompression: { type: [Object, Boolean] },
115
67
  imageUpload: {},
116
- variableTypes: { default: () => fe },
68
+ variableTypes: { default: () => s },
117
69
  defaultVariableStyle: { default: () => de },
118
70
  fontFamilies: { default: void 0 },
119
71
  fontFamilyMode: { default: "append" },
@@ -133,8 +85,8 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
133
85
  type: Boolean,
134
86
  default: !0
135
87
  },
136
- draftCacheKey: { default: He },
137
- draftCacheInterval: { default: Ve },
88
+ draftCacheKey: { default: qe },
89
+ draftCacheInterval: { default: Ke },
138
90
  draftCacheMaxBytes: { default: l },
139
91
  showDraftCacheStatus: {
140
92
  type: Boolean,
@@ -161,62 +113,62 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
161
113
  "signing-placement-remove",
162
114
  "signing-placement-select"
163
115
  ],
164
- setup(fe, { expose: Ve, emit: He }) {
165
- let l = fe, v = He, Ar = d(() => ({ height: typeof l.height == "number" ? `${l.height}px` : l.height })), jr = S(), Mr = S(), Nr = S(), Pr = S(), Fr = S(), Ir = S(), Lr = S(), Rr = S(), zr = S(), Br = S();
166
- function Vr(e) {
116
+ setup(s, { expose: Ke, emit: qe }) {
117
+ let l = s, h = qe, tn = f(() => ({ height: typeof l.height == "number" ? `${l.height}px` : l.height })), nn = v(), rn = v(), an = v(), on = v(), sn = v(), cn = `gd-contract-template-page-decorations-studio-${At()}`, ln = `gd-contract-template-workspace-chrome-${At()}`, un = v(), dn = v();
118
+ function fn(e) {
167
119
  if (!e || !Array.isArray(e.pages) || !Array.isArray(e.signingPlacements)) return [];
168
120
  try {
169
- return ke(e).filter((e) => e.type === "signing-placement");
121
+ return Ae(e).filter((e) => e.type === "signing-placement");
170
122
  } catch {
171
123
  return [];
172
124
  }
173
125
  }
174
- function Hr(e, t) {
175
- return Object.fromEntries(e.map((e, n) => [e.id, Vr(t?.[n]?.template ?? e.template)]));
176
- }
177
- function Ur(e, t) {
178
- let n = /* @__PURE__ */ new Map();
179
- return {
180
- files: e.map((e) => {
181
- let r = ge(e.template, t);
182
- return r.resizedSigningPlacementIds.length && n.set(e.id, r.resizedSigningPlacementIds), {
183
- ...e,
184
- template: r.value
185
- };
186
- }),
187
- resizedSigningPlacementIds: n
188
- };
126
+ function pn(e, t) {
127
+ return Object.fromEntries(e.map((e, n) => [e.id, fn(t?.[n]?.template ?? e.template)]));
189
128
  }
190
- let Wr = "", Gr = "", Kr = S(!1), k = d(() => Kr.value || Array.isArray(l.files)), qr = nt(l.files, l.modelValue, l.pageSize), Jr = Ur(qr, l.pageSizeOptions), Yr = k.value ? Jr.files : qr, Xr = ot(Yr, l.activeFileId), A = S(Yr), j = S(Xr), Zr = Yr.find((e) => e.id === Xr) ?? Yr[0], M = S(Hr(Yr, Array.isArray(l.files) ? l.files : l.modelValue ? [{ template: l.modelValue }] : void 0)), N = S(M.value[Xr] ?? Vr(Zr?.template)), Qr = Ee(Zr?.template ?? l.modelValue, l.pageSize), $r = ge(Qr, l.pageSizeOptions), P = S($r.value);
191
- if (k.value) {
192
- if (A.value = at(A.value, j.value, $r.value), JSON.stringify(A.value) !== JSON.stringify(qr)) {
193
- let e = u(A.value);
194
- Wr = JSON.stringify(e), v("update:files", e), v("files-change", u(e));
129
+ let mn = "", hn = "", gn = v(!1), x = f(() => gn.value || Array.isArray(l.files)), _n = nt(l.files, l.modelValue, l.pageSize), vn = Qe(_n, l.pageSizeOptions), yn = x.value ? vn.files : _n, bn = ot(yn, l.activeFileId), S = v(yn), C = v(bn), xn = yn.find((e) => e.id === bn) ?? yn[0], w = v(pn(yn, Array.isArray(l.files) ? l.files : l.modelValue ? [{ template: l.modelValue }] : void 0)), T = v(w.value[bn] ?? fn(xn?.template)), Sn = Ee(xn?.template ?? l.modelValue, l.pageSize), Cn = ge(Sn, l.pageSizeOptions), E = v(Cn.value);
130
+ if (x.value) {
131
+ if (S.value = at(S.value, C.value, Cn.value), d(S.value) !== d(_n)) {
132
+ let e = u(S.value);
133
+ mn = d(e), h("update:files", e), h("files-change", u(e));
195
134
  }
196
- } else l.modelValue && JSON.stringify($r.value) !== JSON.stringify(Qr) && (Gr = JSON.stringify($r.value), v("update:modelValue", c($r.value)), v("change", c($r.value)), Xa($r.resizedSigningPlacementIds, $r.value));
197
- let F = S(""), I = S(""), L = S(P.value.pages[0]?.id ?? ""), ei = S(!1), ti = S([]), R = /* @__PURE__ */ new Map(), ni = S(!1), ri = S(""), ii = S(!1), ai = S(), oi = S(), si = S(""), ci = S(!1), li = S(""), ui = S(1), di = S(!1), fi = S(!1), pi = S(!1), mi = S(!1), hi = S({}), gi = S(), _i = S(""), vi = S(!1), yi = S(!1), bi = S(!1), xi = S(!1), Si = S(""), Ci = S(), wi = S(), Ti = S(""), Ei = S(!1), z = S(), Di = S(), Oi = S(!1), ki = S(""), B = S(), Ai = S(), V = S(), ji = S(), Mi = S(), Ni = S(), Pi = S(""), Fi = S(We("idle", "暂无本地草稿")), Ii = S({
135
+ } else l.modelValue && d(Cn.value) !== d(Sn) && (hn = d(Cn.value), h("update:modelValue", c(Cn.value)), h("change", c(Cn.value)), Ui(Cn.resizedSigningPlacementIds, Cn.value));
136
+ let D = v(""), O = v(""), k = v(E.value.pages[0]?.id ?? ""), A = v(!1), j = v([]), M = /* @__PURE__ */ new Map(), wn = v(!1), Tn = v(""), En = v(!1), Dn = v(), On = v(), kn = v(""), An = v(!1), jn = v(""), N = v(1), P = v(!1), Mn = v(!1), Nn = v(!1), Pn = v(!1), Fn = v(!1), In = v(), F = v(!1), Ln = v("header"), Rn = v(!1), zn = v({}), Bn = v(""), I = v(!1), L = v(!1), Vn = v(!1), Hn = v(!1), Un = v(""), Wn = v(), Gn = v(), Kn = v(""), qn = v(!1), R = v(), Jn = v(), z = v(), Yn = v(), Xn = v(!1), Zn, Qn = v(!1), $n, er = v(!1), tr = v(""), B = v(), nr = v(), V = v(), rr = v(), ir = v(), ar = v(), H = v(""), U = v(Je("idle", "暂无本地草稿")), or = v({
198
137
  rows: 3,
199
138
  cols: 3,
200
139
  withHeaderRow: !0
201
- }), Li, Ri, zi = "", H = d(() => l.readonly || l.disabled), Bi = d(() => !!l.enableDraftCache && !H.value), Vi = d(() => A.value.find((e) => e.id === j.value) ?? A.value[0]), Hi = d(() => l.draftCacheKey), Ui = d(() => P.value.variables.find((e) => e.key === F.value)), U = d(() => P.value.signingPlacements ?? []), Wi = d(() => ai.value ? me(ai.value) : []), Gi = d(() => (oi.value ?? []).map((e) => ({
140
+ }), sr = /* @__PURE__ */ new WeakSet(), cr = [".gd-contract-template-designer__page-decorations-select-popup", ".gd-contract-template-designer__page-decorations-dropdown-popup"].join(","), lr, ur, dr = !1, fr = !1, pr, W = f(() => l.readonly || l.disabled), mr = f(() => !!(R.value || B.value || V.value || I.value || L.value || Rn.value || Vn.value || Hn.value)), hr = f(() => !!l.enableDraftCache && !W.value), gr = f(() => S.value.find((e) => e.id === C.value) ?? S.value[0]), _r = f(() => l.draftCacheKey), G = f(() => E.value.variables.find((e) => e.key === D.value)), K = f(() => E.value.signingPlacements ?? []), vr = f(() => Dn.value ? pe(Dn.value) : []), yr = f(() => (On.value ?? []).map((e) => ({
202
141
  file: e,
203
- pages: me(e.template)
204
- }))), Ki = d(() => Gi.value.find((e) => e.file.id === si.value) ?? Gi.value[0]), qi = d(() => U.value.find((e) => e.id === I.value)), Ji = d(() => U.value.map((e) => {
205
- let t = P.value.pages.findIndex((t) => t.id === e.pageId);
142
+ pages: pe(e.template)
143
+ }))), br = f(() => yr.value.find((e) => e.file.id === kn.value) ?? yr.value[0]), xr = f(() => K.value.find((e) => e.id === O.value)), Sr = f(() => K.value.map((e) => {
144
+ let t = E.value.pages.findIndex((t) => t.id === e.pageId);
206
145
  return {
207
146
  placement: e,
208
- label: r[e.type],
209
- detail: `${r[e.type]} · 第 ${Math.max(0, t) + 1} 页`
147
+ label: n[e.type],
148
+ detail: `${n[e.type]} · 第 ${Math.max(0, t) + 1} 页`
149
+ };
150
+ })), Cr = f(() => {
151
+ let e = xr.value?.pageId;
152
+ return Vi(E.value.pages.find((t) => t.id === e));
153
+ }), q = f(() => E.value.pages.find((e) => e.id === k.value) ?? E.value.pages[0]), wr = f(() => De(q.value?.pageSize, E.value.pageSize)), Tr = f(() => A.value && j.value.length === 0), Er = f(() => A.value ? Tr.value ? "校验通过,正文变量与变量配置一致" : `发现 ${j.value.length} 个校验问题` : ""), Dr = f(() => {
154
+ let e = q.value?.title || "合同正文";
155
+ return `${x.value && gr.value ? `${gr.value.name} · ` : ""}${e} · ${wr.value.label} · 共 ${E.value.pages.length} 页`;
156
+ }), Or = f(() => ({
157
+ none: "无装饰",
158
+ "page-number": "标准页码",
159
+ "internal-review": "内部审阅",
160
+ draft: "草稿",
161
+ custom: "自定义"
162
+ })[ce(E.value.pageDecorations)]), kr = f(() => {
163
+ let e = se(E.value.pageDecorations);
164
+ return {
165
+ header: e.header.enabled,
166
+ footer: e.footer.enabled,
167
+ watermark: e.watermark.enabled
210
168
  };
211
- })), Yi = d(() => {
212
- let e = qi.value?.pageId;
213
- return X(P.value.pages.find((t) => t.id === e));
214
- }), W = d(() => P.value.pages.find((e) => e.id === L.value) ?? P.value.pages[0]), Xi = d(() => De(W.value?.pageSize, P.value.pageSize)), Zi = d(() => ei.value && ti.value.length === 0), Qi = d(() => ei.value ? Zi.value ? "校验通过,正文变量与变量配置一致" : `发现 ${ti.value.length} 个校验问题` : ""), $i = d(() => {
215
- let e = W.value?.title || "合同正文";
216
- return `${k.value && Vi.value ? `${Vi.value.name} · ` : ""}${e} · ${Xi.value.label} · 共 ${P.value.pages.length} 页`;
217
- }), ea = d(() => {
218
- switch (Fi.value.type) {
219
- case "saved": return `草稿已缓存 ${Ge(Fi.value.savedAt)}`;
169
+ }), Ar = f(() => Object.values(kr.value).filter(Boolean).length), jr = f(() => {
170
+ switch (U.value.type) {
171
+ case "saved": return `草稿已缓存 ${Ye(U.value.savedAt)}`;
220
172
  case "restored": return "已恢复本地草稿";
221
173
  case "too-large": return "草稿过大,未缓存";
222
174
  case "unavailable":
@@ -225,52 +177,23 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
225
177
  case "cleared": return "草稿缓存已清理";
226
178
  default: return "";
227
179
  }
228
- }), ta = d(() => ({
229
- "is-success": Fi.value.type === "saved" || Fi.value.type === "restored",
230
- "is-warning": Fi.value.type === "too-large",
231
- "is-error": Fi.value.type === "unavailable" || Fi.value.type === "read-failed" || Fi.value.type === "write-failed"
232
- })), na = d(() => `${Math.round(ui.value * 100)}%`), ra = d(() => ue(l.fontFamilies, l.fontFamilyMode)), ia = d(() => ra.value.map((e) => ({
180
+ }), Mr = f(() => ({
181
+ "is-success": U.value.type === "saved" || U.value.type === "restored",
182
+ "is-warning": U.value.type === "too-large",
183
+ "is-error": U.value.type === "unavailable" || U.value.type === "read-failed" || U.value.type === "write-failed"
184
+ })), Nr = f(() => `${Math.round(N.value * 100)}%`), Pr = f(() => ae(l.fontFamilies, l.fontFamilyMode)), Fr = f(() => Pr.value.map((e) => ({
233
185
  label: e.label,
234
186
  value: e.value
235
- }))), aa = d(() => oe.map((e) => ({
187
+ }))), Ir = ie, Lr = [...te.map((e) => ({
236
188
  label: e.label,
237
- value: e.key
238
- }))), oa = le, sa = [
239
- {
240
- label: "正文",
241
- value: "paragraph"
242
- },
243
- {
244
- label: "H1",
245
- value: 1
246
- },
247
- {
248
- label: "H2",
249
- value: 2
250
- },
251
- {
252
- label: "H3",
253
- value: 3
254
- },
255
- {
256
- label: "H4",
257
- value: 4
258
- },
259
- {
260
- label: "H5",
261
- value: 5
262
- },
263
- {
264
- label: "H6",
265
- value: 6
266
- }
267
- ], ca = [{
189
+ value: e.format
190
+ }))], Rr = [{
268
191
  label: "实线",
269
192
  value: "solid"
270
193
  }, {
271
194
  label: "虚线",
272
195
  value: "dashed"
273
- }], la = [
196
+ }], zr = [
274
197
  {
275
198
  label: "完整显示",
276
199
  value: "contain"
@@ -283,89 +206,164 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
283
206
  label: "拉伸填充",
284
207
  value: "fill"
285
208
  }
286
- ], ua = d(() => Te(l.pageSizeOptions)), da = d(() => ua.value.map((e) => ({
209
+ ], Br = f(() => Te(l.pageSizeOptions)), Vr = f(() => Br.value.map((e) => ({
287
210
  label: `${e.label} · ${e.width} × ${e.height}`,
288
211
  value: Ce(e)
289
- }))), fa = d(() => Ce(Xi.value)), pa = d(() => re({ showSigningPlacementTools: l.showSigningPlacementTools })), ma = d(() => l.variableTypes.filter((t) => e(t?.type))), ha = d(() => ma.value.map((e) => ({
212
+ }))), Hr = f(() => Ce(wr.value)), Ur = f(() => o({ showSigningPlacementTools: l.showSigningPlacementTools })), Wr = f(() => l.variableTypes.filter((t) => e(t?.type))), Gr = f(() => Wr.value.map((e) => ({
290
213
  ...e,
291
- icon: st(e.type)
292
- }))), ga = d(() => we(l.maxPages)), _a = d(() => P.value.pages.length >= ga.value), va = d(() => {
293
- let e = ki.value.trim().toLowerCase(), t = P.value.variables;
214
+ icon: ut(e.type)
215
+ }))), Kr = f(() => we(l.maxPages)), qr = f(() => E.value.pages.length >= Kr.value), Jr = f(() => {
216
+ let e = he(E.value);
217
+ return Array.from(oe(E.value.pageDecorations)).filter((t) => !e.has(t));
218
+ }), { scheduleAutoPaginate: J } = Xe({
219
+ templateValue: E,
220
+ readonlyState: W,
221
+ isAutoPaginating: wn,
222
+ pendingPaginationPageId: Tn,
223
+ activePageId: k,
224
+ normalizedMaxPages: Kr,
225
+ pageRefs: M,
226
+ syncPageEditors: Ei,
227
+ commitBodyChange: zi,
228
+ getPageSize: Vi,
229
+ notifyPageLimit: Yi
230
+ }), { insertSigningPlacement: Yr, handleSigningPlacementDrop: Xr, insertSigningPlacementTool: Zr, handleSigningPlacementDragStart: Qr, updateSigningPlacement: $r, patchSelectedSigningPlacement: ei, duplicateSigningPlacement: ti, removeSigningPlacement: ni } = lt({
231
+ templateValue: E,
232
+ signingPlacements: K,
233
+ selectedSigningPlacement: xr,
234
+ selectedSigningPlacementId: O,
235
+ selectedPage: q,
236
+ activePageId: k,
237
+ readonly: () => l.readonly,
238
+ disabled: () => l.disabled,
239
+ showSigningPlacementTools: () => !!l.showSigningPlacementTools,
240
+ getPageSize: Vi,
241
+ getVisiblePosition: (e, t) => M.get(e)?.getVisibleSigningPlacementPosition(t),
242
+ commitSigningPlacements: qi,
243
+ selectSigningPlacement: Q,
244
+ emitAdd: (e) => h("signing-placement-add", e),
245
+ emitChange: (e) => h("signing-placement-change", e),
246
+ emitRemove: (e) => h("signing-placement-remove", e)
247
+ }), { saveDraftCache: ri, loadDraftCache: ii, clearDraftCache: ai, restoreDraftCacheIfNeeded: oi, stopDraftCacheTimer: si, restartDraftCacheTimer: ci, resetDraftFingerprint: li } = st({
248
+ draftCacheWritable: hr,
249
+ multipleFilesMode: x,
250
+ filesValue: S,
251
+ activeFileIdValue: C,
252
+ templateValue: E,
253
+ draftCacheKey: _r,
254
+ draftCacheInterval: () => l.draftCacheInterval,
255
+ draftCacheMaxBytes: () => l.draftCacheMaxBytes,
256
+ pageSize: () => l.pageSize,
257
+ pageSizeOptions: () => l.pageSizeOptions,
258
+ syncActiveFileSnapshot: Y,
259
+ syncPageEditors: Ei,
260
+ setActiveFileId: Ni,
261
+ emitFilesChange: Mi,
262
+ commit: X,
263
+ setSigningPlacementInputErrorsByFile: (e) => {
264
+ w.value = e;
265
+ },
266
+ buildSigningPlacementInputErrorsByFile: pn,
267
+ updateDraftCacheStatus: Pi,
268
+ scheduleAutoPaginate: J,
269
+ activePageId: k,
270
+ selectedVariableKey: D
271
+ }), ui = f(() => {
272
+ let e = tr.value.trim().toLowerCase(), t = E.value.variables;
294
273
  return e ? t.filter((t) => t.label.toLowerCase().includes(e) || t.key.toLowerCase().includes(e)) : t;
295
- }), ya = d(() => Math.max(yr, Xi.value.width - _r)), ba = d(() => Math.max(br, Xi.value.height - vr)), G = d(() => hi.value[L.value] ?? Oa()), xa = d(() => G.value.currentHeadingLevel ?? "paragraph"), Sa = d(() => G.value.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif"), Ca = d(() => G.value.fontSize ?? de.fontSize ?? 14), wa = d(() => G.value.textColor || de.color || "#1f2937"), Ta = d(() => Ui.value?.style?.fontFamily || de.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif"), Ea = d(() => {
296
- let e = ce.map((e) => ({
274
+ }), di = f(() => Math.max(Xt, wr.value.width - Jt)), fi = f(() => Math.max(Zt, wr.value.height - Yt)), pi = f(() => zn.value[k.value] ?? xi()), mi = f(() => pi.value.hasMixedBlockFormats ? void 0 : pi.value.currentHeadingLevel ?? "paragraph"), hi = f(() => pi.value.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif"), gi = f(() => pi.value.fontSize ?? de.fontSize ?? 14), _i = f(() => pi.value.textColor || de.color || "#1f2937"), vi = f(() => G.value?.style?.fontFamily || de.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif"), yi = f(() => {
275
+ let e = re.map((e) => ({
297
276
  label: `${e}px`,
298
277
  value: e
299
- })), t = Na(Ca.value), n = Na(_i.value), r = /* @__PURE__ */ new Map();
300
- return n && !ce.includes(n) && r.set(n, {
278
+ })), t = Ti(gi.value), n = Ti(Bn.value), r = /* @__PURE__ */ new Map();
279
+ return n && !re.includes(n) && r.set(n, {
301
280
  label: `使用 ${n}px`,
302
281
  value: n
303
- }), t && !ce.includes(t) && r.set(t, {
282
+ }), t && !re.includes(t) && r.set(t, {
304
283
  label: n === t ? `使用 ${t}px` : `${t}px`,
305
284
  value: t
306
285
  }), [...Array.from(r.values()), ...e];
307
286
  });
308
- St(() => l.modelValue, (e) => {
309
- if (!e || k.value) return;
310
- let t = Ee(e, l.pageSize), n = ge(t, l.pageSizeOptions), r = n.value, i = JSON.stringify(r) !== JSON.stringify(P.value), a = JSON.stringify(r), o = a === Gr;
311
- o && (Gr = ""), (i || !o) && (N.value = Vr(e), M.value = {
312
- ...M.value,
313
- [j.value]: N.value
314
- }, P.value = r, A.value = at(A.value, j.value, r), L.value = r.pages[0]?.id ?? "", F.value = "", I.value = "", mo(L.value)), JSON.stringify(r) !== JSON.stringify(t) && (Gr = a, v("update:modelValue", c(r)), v("change", c(r)), Xa(n.resizedSigningPlacementIds, r));
315
- }, { deep: !0 }), St(() => l.files, (e) => {
287
+ b(() => l.modelValue, (e) => {
288
+ if (!e || x.value) return;
289
+ let t = Ee(e, l.pageSize), n = ge(t, l.pageSizeOptions), r = n.value, i = d(r) !== d(E.value), a = d(r), o = a === hn;
290
+ o && (hn = ""), (i || !o) && (T.value = fn(e), w.value = {
291
+ ...w.value,
292
+ [C.value]: T.value
293
+ }, E.value = r, S.value = at(S.value, C.value, r), k.value = r.pages[0]?.id ?? "", D.value = "", O.value = "", J(k.value)), d(r) !== d(t) && (hn = a, h("update:modelValue", c(r)), h("change", c(r)), Ui(n.resizedSigningPlacementIds, r));
294
+ }, { deep: !0 }), b(() => l.files, (e) => {
316
295
  if (!Array.isArray(e)) return;
317
- let t = nt(e, void 0, l.pageSize), n = Ur(t, l.pageSizeOptions).files, r = JSON.stringify(n), i = JSON.stringify(A.value), a = r === Wr;
318
- a || (M.value = Hr(n, e)), a && (Wr = "");
319
- let o = ot(n, l.activeFileId || j.value);
320
- if (r === i ? o !== j.value && Ia(o, !1, !1) : (A.value = n, Ia(o, !1, !1, !0, !1)), r !== JSON.stringify(t)) {
296
+ let t = nt(e, void 0, l.pageSize), n = Qe(t, l.pageSizeOptions).files, r = d(n), i = d(S.value), a = r === mn;
297
+ a || (w.value = pn(n, e)), a && (mn = "");
298
+ let o = ot(n, l.activeFileId || C.value);
299
+ if (r === i ? o !== C.value && Ni(o, {
300
+ syncCurrent: !1,
301
+ shouldEmit: !1
302
+ }) : (S.value = n, Ni(o, {
303
+ syncCurrent: !1,
304
+ shouldEmit: !1,
305
+ forceRefresh: !0,
306
+ persistCurrentErrors: !1
307
+ })), r !== d(t)) {
321
308
  let e = u(n);
322
- Wr = JSON.stringify(e), v("update:files", e), v("files-change", u(e));
309
+ mn = d(e), h("update:files", e), h("files-change", u(e));
323
310
  }
324
- }, { deep: !0 }), St(() => l.activeFileId, (e) => {
325
- !k.value || !e || e === j.value || Ia(e, !0, !1);
311
+ }, { deep: !0 }), b(() => l.activeFileId, (e) => {
312
+ !x.value || !e || e === C.value || Ni(e, {
313
+ syncCurrent: !0,
314
+ shouldEmit: !1
315
+ });
326
316
  });
327
- function Da(e, t) {
328
- let n = JSON.stringify(A.value);
329
- K(!1);
330
- let { files: r, resizedSigningPlacementIds: i } = Ur(nt(A.value, void 0, e), t), a = JSON.stringify(r) !== n, o = r.find((e) => e.id === j.value);
331
- o && JSON.stringify(o.template) !== JSON.stringify(P.value) && (P.value = c(o.template), N.value = [...M.value[j.value] ?? []]), a && (ei.value = !1, ti.value = [], Fa(r, ""));
332
- let s = i.get(j.value);
333
- return s?.length && o && Xa(s, o.template), a;
334
- }
335
- St([() => l.pageSize, () => l.pageSizeOptions], ([e, t]) => {
336
- if (k.value) {
337
- Da(e, t), mo(L.value);
317
+ function bi(e, t) {
318
+ let n = d(S.value);
319
+ Y(!1);
320
+ let { files: r, resizedSigningPlacementIds: i } = Qe(nt(S.value, void 0, e), t), a = d(r) !== n, o = r.find((e) => e.id === C.value);
321
+ o && d(o.template) !== d(E.value) && (E.value = c(o.template), T.value = [...w.value[C.value] ?? []]), a && (A.value = !1, j.value = [], Mi(r, ""));
322
+ let ee = i.get(C.value);
323
+ return ee?.length && o && Ui(ee, o.template), a;
324
+ }
325
+ b([() => l.pageSize, () => l.pageSizeOptions], ([e, t]) => {
326
+ if (x.value) {
327
+ bi(e, t), J(k.value);
338
328
  return;
339
329
  }
340
- let n = ge(Ee(P.value, e), t);
341
- JSON.stringify(n.value) !== JSON.stringify(P.value) && q(n.value), mo(L.value);
342
- }, { deep: !0 }), St(ga, () => {
343
- mo(P.value.pages[0]?.id);
344
- }), St(H, (e) => {
345
- e && ($(), vi.value = !1, yi.value = !1);
346
- }), St(U, (e) => {
347
- I.value && !e.some((e) => e.id === I.value) && (I.value = "", v("signing-placement-select", void 0));
348
- }, { deep: !0 }), St(() => [
330
+ let n = ge(Ee(E.value, e), t);
331
+ d(n.value) !== d(E.value) && X(n.value), J(k.value);
332
+ }, { deep: !0 }), b(Kr, () => {
333
+ J(E.value.pages[0]?.id);
334
+ }), b(W, (e) => {
335
+ e && ($(), I.value = !1, L.value = !1);
336
+ }), b(k, () => {
337
+ z.value = void 0;
338
+ }), b([
339
+ mr,
340
+ F,
341
+ En
342
+ ], () => {
343
+ cs();
344
+ }), b(K, (e) => {
345
+ O.value && !e.some((e) => e.id === O.value) && (O.value = "", h("signing-placement-select", void 0));
346
+ }, { deep: !0 }), b(() => [
349
347
  l.enableDraftCache,
350
- Hi.value,
348
+ _r.value,
351
349
  l.draftCacheInterval,
352
- H.value
350
+ W.value
353
351
  ], () => {
354
- zi = "", Wa();
355
- }), St(di, (e) => {
352
+ li(), ci();
353
+ }), b(P, (e) => {
356
354
  if (!(typeof document > "u")) {
357
355
  if (e) {
358
- Li = document.body.style.overflow, document.body.style.overflow = "hidden";
356
+ lr = document.body.style.overflow, document.body.style.overflow = "hidden";
359
357
  return;
360
358
  }
361
- document.body.style.overflow = Li ?? "", Li = void 0;
359
+ document.body.style.overflow = lr ?? "", lr = void 0;
362
360
  }
363
- }), vt(() => {
364
- Ha(), Wa(), mo(L.value), window.addEventListener("pointerdown", Ec, !0), window.addEventListener("keydown", Oc), window.addEventListener("resize", $), window.addEventListener("scroll", $, !0);
365
- }), _t(() => {
366
- di.value && typeof document < "u" && (document.body.style.overflow = Li ?? ""), window.removeEventListener("pointerdown", Ec, !0), window.removeEventListener("keydown", Oc), window.removeEventListener("resize", $), window.removeEventListener("scroll", $, !0), Ua();
361
+ }), Dt(() => {
362
+ oi(), ci(), J(k.value), window.addEventListener("pointerdown", gs, !0), window.addEventListener("pointerup", ps), window.addEventListener("keydown", ys, !0), window.addEventListener("keydown", bs), window.addEventListener("resize", ms), window.addEventListener("scroll", _s, !0);
363
+ }), Et(() => {
364
+ Oi(), dr = !0, P.value && typeof document < "u" && (document.body.style.overflow = lr ?? ""), window.removeEventListener("pointerdown", gs, !0), window.removeEventListener("pointerup", ps), window.removeEventListener("keydown", ys, !0), window.removeEventListener("keydown", bs), window.removeEventListener("resize", ms), window.removeEventListener("scroll", _s, !0), $n !== void 0 && cancelAnimationFrame($n), si();
367
365
  });
368
- function Oa() {
366
+ function xi() {
369
367
  return {
370
368
  isFocused: !1,
371
369
  canUndo: !1,
@@ -377,36 +375,34 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
377
375
  isOrderedList: !1,
378
376
  isTableActive: !1,
379
377
  textAlign: "left",
380
- fontFamily: se,
378
+ fontFamily: ne,
381
379
  fontSize: de.fontSize ?? 14,
382
380
  textColor: de.color ?? "#1f2937",
383
- selectionText: ""
381
+ selectionText: "",
382
+ hasMixedBlockFormats: !1
384
383
  };
385
384
  }
386
- function ka(e) {
385
+ function Si(e) {
387
386
  return e === "left" || e === "center" || e === "right";
388
387
  }
389
- function Aa(e) {
388
+ function Ci(e) {
390
389
  return typeof e == "number" && Number.isInteger(e) && e >= 1 && e <= 6;
391
390
  }
392
- function ja(e) {
393
- return typeof e == "string" && oe.some((t) => t.key === e);
394
- }
395
- function Ma(e, t = Ca.value) {
391
+ function wi(e, t = gi.value) {
396
392
  let n = Number(e);
397
- return Number.isFinite(n) ? Math.min(Sr, Math.max(xr, Math.round(n))) : t;
393
+ return Number.isFinite(n) ? Math.min($t, Math.max(Qt, Math.round(n))) : t;
398
394
  }
399
- function Na(e) {
395
+ function Ti(e) {
400
396
  let t = String(e || "").trim().match(/(\d+(\.\d+)?)/);
401
397
  if (!t) return;
402
398
  let n = Number(t[1]);
403
- if (Number.isFinite(n)) return Math.min(Sr, Math.max(xr, Math.round(n)));
399
+ if (Number.isFinite(n)) return Math.min($t, Math.max(Qt, Math.round(n)));
404
400
  }
405
- function Pa(e = P.value) {
401
+ function Ei(e = E.value) {
406
402
  return {
407
403
  ...e,
408
404
  pages: e.pages.map((e) => {
409
- let t = R.get(e.id);
405
+ let t = M.get(e.id);
410
406
  return {
411
407
  ...e,
412
408
  contentHtml: t?.getHTML() ?? e.contentHtml,
@@ -415,408 +411,241 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
415
411
  })
416
412
  };
417
413
  }
418
- function K(e = !1) {
419
- let t = c(Pa());
420
- if (!k.value) return t;
421
- let n = A.value.find((e) => e.id === j.value)?.template, r = JSON.stringify(n) !== JSON.stringify(t), i = at(A.value, j.value, t);
422
- return A.value = i, r && e && Fa(i), t;
414
+ function Di() {
415
+ fr = !1, pr &&= (clearTimeout(pr), void 0);
416
+ }
417
+ function Oi() {
418
+ let e = fr;
419
+ Di(), e && ji();
420
+ }
421
+ function ki() {
422
+ fr = !0, pr && clearTimeout(pr), pr = setTimeout(() => {
423
+ pr = void 0, !(!fr || dr) && (fr = !1, ji());
424
+ }, qt);
425
+ }
426
+ function Ai(e) {
427
+ let t = E.value.pages, n = t.findIndex((t) => t.id === e.id);
428
+ if (n < 0) return;
429
+ let r = t[n];
430
+ if (r.contentHtml === e.contentHtml && r.contentJson === e.contentJson && r.title === e.title && r.pageSize === e.pageSize) return;
431
+ let i = t.slice();
432
+ i[n] = e, E.value = {
433
+ ...E.value,
434
+ pages: i
435
+ };
436
+ }
437
+ function ji() {
438
+ let e = Oe(Ei());
439
+ D.value && !e.variables.some((e) => e.key === D.value) && (D.value = ""), X(e);
440
+ }
441
+ function Y(e = !1) {
442
+ Oi();
443
+ let t = c(Ei());
444
+ if (!x.value) return t;
445
+ let n = S.value.find((e) => e.id === C.value)?.template, r = d(n) !== d(t), i = at(S.value, C.value, t);
446
+ return S.value = i, r && e && Mi(i), t;
423
447
  }
424
- function Fa(e, t = j.value) {
425
- if (!k.value) return;
448
+ function Mi(e, t = C.value) {
449
+ if (!x.value) return;
426
450
  let n = u(e);
427
- A.value = n, Wr = JSON.stringify(n), v("update:files", u(n)), v("files-change", u(n));
451
+ S.value = n, mn = d(n), h("update:files", u(n)), h("files-change", u(n));
428
452
  let r = n.find((e) => e.id === t);
429
- r && v("file-change", u([r])[0]);
430
- }
431
- function Ia(e, t = !0, n = !0, r = !1, i = !0) {
432
- let a = ot(A.value, e), o = a !== j.value;
433
- if (i && k.value && j.value && (M.value = {
434
- ...M.value,
435
- [j.value]: [...N.value]
436
- }), t && K(!0), !o && !r) return;
437
- let s = A.value.find((e) => e.id === a);
438
- s && (j.value = a, P.value = c(s.template), N.value = [...M.value[a] ?? []], F.value = "", I.value = "", L.value = P.value.pages[0]?.id ?? "", hi.value = {}, R.clear(), ri.value = "", ei.value = !1, ti.value = [], ii.value = !1, ai.value = void 0, oi.value = void 0, zi = "", n && o && v("update:activeFileId", a), t && o && Bi.value && Ra(), y(() => {
439
- mo(L.value);
453
+ r && h("file-change", u([r])[0]);
454
+ }
455
+ function Ni(e, t = {}) {
456
+ let { syncCurrent: n, shouldEmit: r, forceRefresh: i, persistCurrentErrors: a } = Ze(t), o = ot(S.value, e), ee = o !== C.value;
457
+ if (a && x.value && C.value && (w.value = {
458
+ ...w.value,
459
+ [C.value]: [...T.value]
460
+ }), n ? Y(!0) : Di(), !ee && !i) return;
461
+ let te = S.value.find((e) => e.id === o);
462
+ te && (C.value = o, E.value = c(te.template), T.value = [...w.value[o] ?? []], D.value = "", O.value = "", k.value = E.value.pages[0]?.id ?? "", zn.value = {}, M.clear(), Tn.value = "", A.value = !1, j.value = [], En.value = !1, Dn.value = void 0, On.value = void 0, li(), r && ee && h("update:activeFileId", o), n && ee && hr.value && ri(), g(() => {
463
+ J(k.value);
440
464
  }));
441
465
  }
442
- function q(e) {
466
+ function X(e) {
467
+ Di();
443
468
  let t = ge(Ee(e, l.pageSize), l.pageSizeOptions), n = t.value;
444
- return P.value = n, ei.value = !1, ti.value = [], k.value ? Fa(at(A.value, j.value, n)) : (A.value = at(A.value, j.value, n), Gr = JSON.stringify(n), v("update:modelValue", c(n)), v("change", c(n))), Xa(t.resizedSigningPlacementIds, n), n;
445
- }
446
- function La(e, t = e.type !== "unchanged") {
447
- Fi.value = e, t && v("draft-cache-change", { ...e });
448
- }
449
- function Ra() {
450
- if (!Bi.value) {
451
- let e = We("unavailable", "草稿缓存未启用");
452
- return La(e), e;
453
- }
454
- let e = Ke();
455
- k.value && K(!1);
456
- let t = k.value ? Qe({
457
- storage: e,
458
- key: Hi.value,
459
- value: {
460
- files: u(A.value),
461
- activeFileId: j.value
462
- },
463
- maxBytes: l.draftCacheMaxBytes,
464
- previousValueSerialized: zi
465
- }) : Ze({
466
- storage: e,
467
- key: Hi.value,
468
- value: c(Pa()),
469
- maxBytes: l.draftCacheMaxBytes,
470
- previousValueSerialized: zi
471
- });
472
- return t.valueSerialized && (zi = t.valueSerialized), t.status.type !== "unchanged" && La(t.status), t.status;
473
- }
474
- function za() {
475
- if (k.value) {
476
- let e = Xe(Ke(), Hi.value);
477
- e.valueSerialized && (zi = e.valueSerialized), e.status.type !== "idle" && La(e.status);
478
- let t = ot(e.value?.files ?? [], e.value?.activeFileId), n = e.value?.files.find((e) => e.id === t)?.template;
479
- return n ? c(n) : void 0;
480
- }
481
- let e = Ye(Ke(), Hi.value);
482
- return e.valueSerialized && (zi = e.valueSerialized), e.status.type !== "idle" && La(e.status), e.value ? c(e.value) : void 0;
483
- }
484
- function Ba() {
485
- let e = Ue(Ke(), Hi.value);
486
- zi = "", La(e);
487
- }
488
- function Va() {
489
- return { ...Fi.value };
490
- }
491
- function Ha() {
492
- if (!Bi.value) return;
493
- if (k.value) {
494
- if (!Je({
495
- files: u(A.value),
496
- activeFileId: j.value
497
- })) return;
498
- let e = Xe(Ke(), Hi.value);
499
- if (e.valueSerialized && (zi = e.valueSerialized), e.value) {
500
- let t = Ur(nt(e.value.files, void 0, l.pageSize), l.pageSizeOptions);
501
- A.value = t.files, M.value = Hr(t.files, e.value.files), Ia(ot(A.value, e.value.activeFileId), !1, !0, !0, !1), Fa(A.value, ""), La(e.status);
502
- return;
503
- }
504
- e.status.type !== "idle" && e.status.type !== "invalid" && La(e.status);
505
- return;
506
- }
507
- if (!qe(P.value)) return;
508
- let e = Ye(Ke(), Hi.value);
509
- if (e.valueSerialized && (zi = e.valueSerialized), e.value) {
510
- L.value = q(e.value).pages[0]?.id ?? "", F.value = "", mo(L.value), La(e.status);
511
- return;
512
- }
513
- e.status.type !== "idle" && e.status.type !== "invalid" && La(e.status);
469
+ return E.value = n, A.value = !1, j.value = [], x.value ? Mi(at(S.value, C.value, n)) : (S.value = at(S.value, C.value, n), hn = d(n), h("update:modelValue", c(n)), h("change", c(n))), Ui(t.resizedSigningPlacementIds, n), n;
514
470
  }
515
- function Ua() {
516
- Ri &&= (clearInterval(Ri), void 0);
471
+ function Pi(e, t = e.type !== "unchanged") {
472
+ U.value = e, t && h("draft-cache-change", { ...e });
517
473
  }
518
- function Wa() {
519
- if (Ua(), !Bi.value || typeof window > "u") return;
520
- let e = Math.max(1e3, Math.round(Number(l.draftCacheInterval) || 5e3));
521
- Ri = window.setInterval(() => {
522
- Ra();
523
- }, e);
474
+ function Fi() {
475
+ return { ...U.value };
524
476
  }
525
- function Ga(e, t) {
526
- t ? R.set(e, t) : R.delete(e);
477
+ function Ii(e, t) {
478
+ t ? M.set(e, t) : M.delete(e);
527
479
  }
528
- function J(e, t = W.value?.id ?? L.value) {
529
- H.value || R.get(t)?.runCommand(e);
480
+ function Z(e, t = q.value?.id ?? k.value) {
481
+ W.value || M.get(t)?.runCommand(e);
530
482
  }
531
- function Y(e) {
532
- J(e), $();
483
+ function Li(e) {
484
+ Z(e), $();
533
485
  }
534
- function Ka(e) {
535
- let t = z.value?.pageId;
536
- t && (R.get(t)?.focus(), Pi.value = typeof document < "u" && document.execCommand(e) ? `${e === "copy" ? "已复制" : e === "cut" ? "已剪切" : "已粘贴"}` : "浏览器未授权剪贴板操作,请使用系统快捷键。", $());
486
+ function Ri(e) {
487
+ let t = R.value?.pageId;
488
+ t && (M.get(t)?.focus(), H.value = typeof document < "u" && document.execCommand(e) ? `${e === "copy" ? "已复制" : e === "cut" ? "已剪切" : "已粘贴"}` : "浏览器未授权剪贴板操作,请使用系统快捷键。", $());
537
489
  }
538
- function qa(e) {
539
- let t = q(Oe(e));
540
- return F.value && !t.variables.some((e) => e.key === F.value) && (F.value = ""), t;
541
- }
542
- function Ja(e) {
543
- qa({
544
- ...P.value,
545
- pages: P.value.pages.map((t) => t.id === e.id ? e : t)
546
- }), mo(e.id);
490
+ function zi(e) {
491
+ let t = X(Oe(e));
492
+ return D.value && !t.variables.some((e) => e.key === D.value) && (D.value = ""), t;
547
493
  }
548
- function X(e) {
549
- return De(e?.pageSize, P.value.pageSize);
494
+ function Bi(e) {
495
+ Ai(e), ki(), J(e.id);
550
496
  }
551
- function Ya(e) {
552
- return U.value.filter((t) => t.pageId === e);
497
+ function Vi(e) {
498
+ return De(e?.pageSize, E.value.pageSize);
553
499
  }
554
- function Z(e) {
555
- return {
556
- ...e,
557
- ...e.sealTypes ? { sealTypes: [...e.sealTypes] } : {}
558
- };
500
+ function Hi(e) {
501
+ return K.value.filter((t) => t.pageId === e);
559
502
  }
560
- function Xa(e, t = P.value) {
503
+ function Ui(e, t = E.value) {
561
504
  let n = new Set(e);
562
- n.size && (Qa(n), (t.signingPlacements ?? []).filter((e) => n.has(e.id)).forEach((e) => v("signing-placement-change", Z(e))));
505
+ n.size && (Gi(n), (t.signingPlacements ?? []).filter((e) => n.has(e.id)).forEach((e) => h("signing-placement-change", ct(e))));
563
506
  }
564
507
  function Q(e) {
565
- let t = e ? U.value.find((t) => t.id === e) : void 0;
566
- I.value = t?.id ?? "", t && (F.value = "", L.value = t.pageId), v("signing-placement-select", t ? Z(t) : void 0);
508
+ let t = e ? K.value.find((t) => t.id === e) : void 0;
509
+ O.value = t?.id ?? "", t && (D.value = "", k.value = t.pageId), h("signing-placement-select", t ? ct(t) : void 0);
567
510
  }
568
- function Za(e) {
511
+ function Wi(e) {
569
512
  Q(e.id);
570
513
  }
571
- function Qa(e) {
514
+ function Gi(e) {
572
515
  let t = new Set(e);
573
516
  if (!t.size) return;
574
- let n = N.value.filter((e) => e.type !== "signing-placement" || !t.has(e.id));
575
- N.value = n, M.value = {
576
- ...M.value,
577
- [j.value]: n
517
+ let n = T.value.filter((e) => e.type !== "signing-placement" || !t.has(e.id));
518
+ T.value = n, w.value = {
519
+ ...w.value,
520
+ [C.value]: n
578
521
  };
579
522
  }
580
- function $a(e) {
581
- let t = N.value.filter((t) => t.type !== "signing-placement" || t.pageId !== e);
582
- N.value = t, M.value = {
583
- ...M.value,
584
- [j.value]: t
523
+ function Ki(e) {
524
+ let t = T.value.filter((t) => t.type !== "signing-placement" || t.pageId !== e);
525
+ T.value = t, w.value = {
526
+ ...w.value,
527
+ [C.value]: t
585
528
  };
586
529
  }
587
- function eo(e, t = []) {
588
- return Qa(t), q({
589
- ...P.value,
530
+ function qi(e, t = []) {
531
+ return Gi(t), X({
532
+ ...E.value,
590
533
  signingPlacements: e
591
534
  });
592
535
  }
593
- function to(e, t = W.value?.id ?? P.value.pages[0]?.id, n) {
594
- if (!s(l.readonly, l.disabled) || !t) return;
595
- let r = P.value.pages.find((e) => e.id === t);
596
- if (!r) return;
597
- let i = te(e, t, X(r), { ...n ?? R.get(t)?.getVisibleSigningPlacementPosition(e) });
598
- return eo([...U.value, i]), L.value = t, Q(i.id), v("signing-placement-add", Z(i)), i;
599
- }
600
- function no(e, t, n, r) {
601
- if (!l.showSigningPlacementTools) return;
602
- let i = ne(t.type);
603
- to(t.type, e, {
604
- x: n - i.width / 2,
605
- y: r - i.height / 2
606
- });
607
- }
608
- function ro(e) {
609
- return to(e.type);
610
- }
611
- function io(e, t) {
612
- if (!s(l.readonly, l.disabled)) {
613
- e.preventDefault();
614
- return;
615
- }
616
- e.dataTransfer?.setData(n, ae(t)), e.dataTransfer && (e.dataTransfer.effectAllowed = "copy");
617
- }
618
- function ao(e) {
619
- if (!s(l.readonly, l.disabled)) return;
620
- let t = P.value.pages.find((t) => t.id === e.pageId);
621
- if (!t) return;
622
- let n = ee({
623
- ...e,
624
- ...e.type === "seal" ? {} : { sealTypes: void 0 }
625
- }, X(t));
626
- eo(U.value.map((e) => e.id === n.id ? n : e), [n.id]), I.value = n.id, v("signing-placement-change", Z(n));
627
- }
628
- function oo(e) {
629
- let t = qi.value;
630
- if (!t) return;
631
- let n = P.value.pages.find((e) => e.id === t.pageId);
632
- n && ao(i(t, e, X(n)));
633
- }
634
- function so(e = qi.value) {
635
- if (!s(l.readonly, l.disabled) || !e) return;
636
- let t = P.value.pages.find((t) => t.id === e.pageId);
637
- if (!t) return;
638
- let n = te(e.type, e.pageId, X(t), {
639
- ...Z(e),
640
- id: void 0,
641
- x: e.x + 16,
642
- y: e.y + 16
643
- });
644
- eo([...U.value, n]), Q(n.id), v("signing-placement-add", Z(n));
645
- }
646
- function co(e = qi.value) {
647
- !s(l.readonly, l.disabled) || !e || (eo(U.value.filter((t) => t.id !== e.id), [e.id]), I.value === e.id && Q(), v("signing-placement-remove", Z(e)));
648
- }
649
- function lo(e) {
650
- if (H.value || !W.value) return;
651
- let t = ua.value.find((t) => Ce(t) === e);
536
+ function Ji(e) {
537
+ if (W.value || !q.value) return;
538
+ let t = Br.value.find((t) => Ce(t) === e);
652
539
  if (!t) return;
653
- let n = W.value.id, r = X(W.value), i = De(t, P.value.pageSize), a = U.value.map((e) => e.pageId === n ? ie(e, r, i) : e);
654
- Qa(a.filter((e) => e.pageId === n).map((e) => e.id)), q({
655
- ...P.value,
656
- pages: P.value.pages.map((e) => e.id === n ? {
540
+ let n = q.value.id, r = Vi(q.value), i = De(t, E.value.pageSize), a = K.value.map((e) => e.pageId === n ? ee(e, r, i) : e);
541
+ Gi(a.filter((e) => e.pageId === n).map((e) => e.id)), X({
542
+ ...E.value,
543
+ pages: E.value.pages.map((e) => e.id === n ? {
657
544
  ...e,
658
545
  pageSize: i
659
546
  } : e),
660
547
  signingPlacements: a
661
- }), a.filter((e) => e.pageId === n).forEach((e) => v("signing-placement-change", Z(e))), mo(n);
662
- }
663
- function uo(e) {
664
- return {
665
- type: "doc",
666
- content: e.length ? e : [{ type: "paragraph" }]
667
- };
668
- }
669
- function fo(e) {
670
- return e.replace(/<p>\s*(<br>)?\s*<\/p>/gi, "").trim().length === 0;
671
- }
672
- function po(e, t, n) {
673
- let r = e.contentJson?.content, i = [...t, ...r?.length ? r : []], a = fo(e.contentHtml || "") ? "" : e.contentHtml;
674
- return {
675
- ...e,
676
- contentHtml: `${n}${a}`,
677
- contentJson: uo(i)
678
- };
548
+ }), a.filter((e) => e.pageId === n).forEach((e) => h("signing-placement-change", ct(e))), J(n);
679
549
  }
680
- function mo(e = L.value) {
681
- if (H.value) return;
682
- let t = P.value.pages.findIndex((e) => e.id === ri.value), n = P.value.pages.findIndex((t) => t.id === e);
683
- (!ri.value || t < 0 || n >= 0 && n < t) && (ri.value = e), !ni.value && y(() => go());
684
- }
685
- function ho(e) {
686
- let t = ga.value;
687
- Pi.value = `合同最多支持 ${t} 页`, v("page-limit", t, e);
688
- }
689
- async function go() {
690
- if (!ni.value) {
691
- ni.value = !0;
692
- try {
693
- let e = ri.value;
694
- ri.value = "";
695
- let t = 0, n = Math.max(40, ga.value + 1);
696
- for (; t < n;) {
697
- await y();
698
- let n = Pa().pages, r = Math.max(0, n.findIndex((t) => t.id === e)), i = !1;
699
- for (let t = r; t < n.length; t += 1) {
700
- let r = n[t];
701
- if (t === n.length - 1 && n.length >= ga.value && R.get(r.id)?.hasOverflowContent()) {
702
- ho("auto-pagination");
703
- break;
704
- }
705
- let a = R.get(r.id)?.splitOverflowContent();
706
- if (!a) continue;
707
- let o = Pa().pages, s = o.findIndex((e) => e.id === r.id);
708
- if (s < 0) break;
709
- o[s] = a.page;
710
- let ee = o[s + 1];
711
- ee ? o[s + 1] = R.get(ee.id)?.prependContent(a.overflowContent) ?? po(ee, a.overflowContent, a.overflowHtml) : o.push(_e(o.length + 1, X(a.page), a.overflowHtml, uo(a.overflowContent))), qa({
712
- ...P.value,
713
- pages: o
714
- }), e = o[s + 1]?.id ?? a.page.id, i = !0;
715
- break;
716
- }
717
- if (!i) break;
718
- t += 1;
719
- }
720
- } finally {
721
- ni.value = !1, ri.value && y(() => go());
722
- }
723
- }
550
+ function Yi(e) {
551
+ let t = Kr.value;
552
+ H.value = `合同最多支持 ${t} 页`, h("page-limit", t, e);
724
553
  }
725
- function _o() {
726
- if (H.value) return;
727
- if (_a.value) {
728
- ho("add");
554
+ function Xi() {
555
+ if (W.value) return;
556
+ if (qr.value) {
557
+ Yi("add");
729
558
  return;
730
559
  }
731
- let e = ye(P.value.pages.length + 1, Xi.value);
732
- q({
733
- ...P.value,
734
- pages: [...P.value.pages, e]
735
- }), L.value = e.id;
736
- }
737
- function vo(e) {
738
- if (H.value) return;
739
- if (_a.value) {
740
- ho("duplicate");
560
+ let e = ye(E.value.pages.length + 1, wr.value);
561
+ X({
562
+ ...E.value,
563
+ pages: [...E.value.pages, e]
564
+ }), k.value = e.id;
565
+ }
566
+ function Zi(e) {
567
+ if (W.value) return;
568
+ if (qr.value) {
569
+ Yi("duplicate");
741
570
  return;
742
571
  }
743
- let t = P.value.pages.findIndex((t) => t.id === e.id);
572
+ let t = E.value.pages.findIndex((t) => t.id === e.id);
744
573
  if (t < 0) return;
745
574
  let n = c({
746
575
  pages: [e],
747
576
  variables: [],
748
- pageSize: P.value.pageSize,
577
+ pageSize: E.value.pageSize,
749
578
  signingPlacements: []
750
- }).pages[0], r = _e(t + 2, X(e), n.contentHtml, n.contentJson);
579
+ }).pages[0], r = _e(t + 2, Vi(e), n.contentHtml, n.contentJson);
751
580
  r.title = `${e.title || `第 ${t + 1} 页`}副本`;
752
- let i = [...P.value.pages];
581
+ let i = [...E.value.pages];
753
582
  i.splice(t + 1, 0, r);
754
- let a = Ya(e.id).map((e) => te(e.type, r.id, X(r), {
755
- ...Z(e),
583
+ let o = Hi(e.id).map((e) => a(e.type, r.id, Vi(r), {
584
+ ...ct(e),
756
585
  id: void 0,
757
586
  pageId: r.id
758
587
  }));
759
- q({
760
- ...P.value,
588
+ X({
589
+ ...E.value,
761
590
  pages: i,
762
- signingPlacements: [...U.value, ...a]
763
- }), L.value = r.id, a.forEach((e) => v("signing-placement-add", Z(e))), a[0] && Q(a[0].id);
591
+ signingPlacements: [...K.value, ...o]
592
+ }), k.value = r.id, o.forEach((e) => h("signing-placement-add", ct(e))), o[0] && Q(o[0].id);
764
593
  }
765
- function yo(e) {
766
- if (H.value || P.value.pages.length <= 1) return;
767
- let t = P.value.pages.findIndex((t) => t.id === e.id);
594
+ function Qi(e) {
595
+ if (W.value || E.value.pages.length <= 1) return;
596
+ let t = E.value.pages.findIndex((t) => t.id === e.id);
768
597
  if (t < 0) return;
769
- let n = Ya(e.id);
770
- $a(e.id);
771
- let r = P.value.pages.filter((t) => t.id !== e.id), i = qa({
772
- ...P.value,
598
+ let n = Hi(e.id);
599
+ Ki(e.id);
600
+ let r = E.value.pages.filter((t) => t.id !== e.id), i = zi({
601
+ ...E.value,
773
602
  pages: r,
774
- signingPlacements: U.value.filter((t) => t.pageId !== e.id)
603
+ signingPlacements: K.value.filter((t) => t.pageId !== e.id)
775
604
  });
776
- L.value = i.pages[Math.min(t, i.pages.length - 1)]?.id ?? "", n.some((e) => e.id === I.value) && Q(), n.forEach((e) => v("signing-placement-remove", Z(e)));
605
+ k.value = i.pages[Math.min(t, i.pages.length - 1)]?.id ?? "", n.some((e) => e.id === O.value) && Q(), n.forEach((e) => h("signing-placement-remove", ct(e)));
777
606
  }
778
- function bo(e) {
779
- if (H.value || P.value.pages.length <= 1) return;
780
- let t = Ya(e.id).length;
607
+ function $i(e) {
608
+ if (W.value || E.value.pages.length <= 1) return;
609
+ let t = Hi(e.id).length;
781
610
  if (!t) {
782
- yo(e);
611
+ Qi(e);
783
612
  return;
784
613
  }
785
- Ot.confirm({
614
+ Ft.confirm({
786
615
  title: "删除合同页面",
787
616
  content: `此页包含 ${t} 个签署位置,删除页面会同时移除这些位置,是否继续?`,
788
617
  okText: "确认删除",
789
618
  okType: "danger",
790
619
  cancelText: "取消",
791
620
  onOk: () => {
792
- yo(e);
621
+ Qi(e);
793
622
  }
794
623
  });
795
624
  }
796
- function xo(e) {
797
- let t = new Set(P.value.variables.map((e) => e.key)), n = 1;
625
+ function ea(e) {
626
+ let t = new Set(E.value.variables.map((e) => e.key)), n = 1;
798
627
  for (; t.has(`${e}_${n}`);) n += 1;
799
628
  return `${e}_${n}`;
800
629
  }
801
- function So(e) {
630
+ function ta(e) {
802
631
  let t = e.type ?? "text";
803
632
  return be({
804
633
  ...e,
805
634
  type: t,
806
- key: e.key || xo(t),
635
+ key: e.key || ea(t),
807
636
  label: e.label || Se(t, l.variableTypes).label
808
637
  }, l.variableTypes, l.defaultVariableStyle);
809
638
  }
810
- function Co(e, t = W.value?.id ?? P.value.pages[0].id, n) {
811
- if (H.value) return e;
812
- let r = R.get(t)?.insertVariable(e, n), i = !P.value.variables.some((t) => t.key === e.key);
813
- return q({
814
- ...P.value,
815
- pages: r ? P.value.pages.map((e) => e.id === r.id ? r : e) : P.value.pages,
816
- variables: i ? [...P.value.variables, e] : P.value.variables
817
- }), F.value = e.key, Q(), L.value = t, i && v("variable-add", e), mo(t), e;
639
+ function na(e, t = q.value?.id ?? E.value.pages[0].id, n) {
640
+ if (W.value) return e;
641
+ let r = M.get(t)?.insertVariable(e, n), i = !E.value.variables.some((t) => t.key === e.key);
642
+ return X({
643
+ ...E.value,
644
+ pages: r ? E.value.pages.map((e) => e.id === r.id ? r : e) : E.value.pages,
645
+ variables: i ? [...E.value.variables, e] : E.value.variables
646
+ }), D.value = e.key, Q(), k.value = t, i && h("variable-add", e), J(t), e;
818
647
  }
819
- function wo(e) {
648
+ function ra(e) {
820
649
  let { width: t, height: n, ...r } = e, i = Ne(t), a = Ne(n);
821
650
  return {
822
651
  ...r,
@@ -824,709 +653,815 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
824
653
  ...a === void 0 ? {} : { height: a }
825
654
  };
826
655
  }
827
- function To(e = {}) {
828
- let t = Ne(Ci.value), n = Ne(wi.value);
656
+ function ia(e = {}) {
657
+ let t = Ne(Wn.value), n = Ne(Gn.value);
829
658
  return {
830
659
  ...e,
831
660
  ...t === void 0 ? {} : { width: t },
832
661
  ...n === void 0 ? {} : { height: n }
833
662
  };
834
663
  }
835
- function Eo() {
836
- Si.value = "", Ci.value = void 0, wi.value = void 0, Ti.value = "";
664
+ function aa() {
665
+ Un.value = "", Wn.value = void 0, Gn.value = void 0, Kn.value = "";
837
666
  }
838
- function Do(e, t = W.value?.id ?? P.value.pages[0]?.id, n) {
839
- let r = wo({
667
+ function oa(e, t = q.value?.id ?? E.value.pages[0]?.id, n) {
668
+ let r = ra({
840
669
  ...e,
841
670
  src: e.src.trim()
842
671
  });
843
- if (!(H.value || !t || !Ae(r.src) || !r.src || !R.get(t)?.insertContentImage(r, n))) return L.value = t, F.value = "", Q(), r.src;
672
+ if (!(W.value || !t || !je(r.src) || !r.src || !M.get(t)?.insertContentImage(r, n))) return k.value = t, D.value = "", Q(), r.src;
844
673
  }
845
- function Oo(e) {
674
+ function sa(e) {
846
675
  return e instanceof Error ? e : /* @__PURE__ */ Error("图片处理失败");
847
676
  }
848
- async function ko(e, t) {
849
- t === "toolbar" && (Ei.value = !0, Ti.value = "");
677
+ async function ca(e, t) {
678
+ t === "toolbar" && (qn.value = !0, Kn.value = "");
850
679
  try {
851
- return (await Pe(e, {
680
+ let n = await Pe(e, {
852
681
  source: t,
853
682
  compression: l.imageCompression,
854
683
  upload: l.imageUpload
855
- })).src;
684
+ });
685
+ return dr ? void 0 : n.src;
856
686
  } catch (e) {
857
- let n = Oo(e);
858
- t === "toolbar" && (Ti.value = n.message), Pi.value = n.message, v("image-error", n, t);
687
+ let n = sa(e);
688
+ t === "toolbar" && (Kn.value = n.message), H.value = n.message, h("image-error", n, t);
859
689
  return;
860
690
  } finally {
861
- t === "toolbar" && (Ei.value = !1);
691
+ t === "toolbar" && (qn.value = !1);
862
692
  }
863
693
  }
864
- async function Ao(e) {
865
- return await ko(e, "paste") ?? null;
694
+ async function la(e) {
695
+ return await ca(e, "paste") ?? null;
866
696
  }
867
- async function jo(e, t = {}) {
868
- if (H.value) return;
869
- let n = W.value?.id ?? P.value.pages[0]?.id, r = n ? R.get(n)?.getSelectionRange() : void 0, i = typeof e == "string" ? e.trim() : await ko(e, "toolbar");
870
- if (!i || !Ae(i)) {
871
- typeof e == "string" && (Ti.value = "请输入安全的图片 URL");
697
+ async function ua(e, t = {}) {
698
+ if (W.value) return;
699
+ let n = q.value?.id ?? E.value.pages[0]?.id, r = n ? M.get(n)?.getSelectionRange() : void 0, i = typeof e == "string" ? e.trim() : await ca(e, "toolbar");
700
+ if (dr) return;
701
+ if (!i || !je(i)) {
702
+ typeof e == "string" && (Kn.value = "请输入安全的图片 URL");
872
703
  return;
873
704
  }
874
- let a = Do({
705
+ if (n && !M.has(n)) return;
706
+ let a = oa({
875
707
  ...t,
876
708
  src: i
877
709
  }, n, r);
878
- return a && (xi.value = !1, Eo(), Pi.value = "已插入图片"), a;
710
+ return a && (Hn.value = !1, aa(), H.value = "已插入图片"), a;
879
711
  }
880
- function Mo() {
881
- H.value || Ei.value || ($(), Ti.value = "", Br.value && (Br.value.value = ""), Br.value?.click());
712
+ function da() {
713
+ W.value || qn.value || ($(), Kn.value = "", dn.value && (dn.value.value = ""), dn.value?.click());
882
714
  }
883
- async function No(e) {
715
+ async function fa(e) {
884
716
  let t = e.target.files?.[0];
885
- t && await jo(t, To({ alt: t.name }));
717
+ t && await ua(t, ia({ alt: t.name }));
886
718
  }
887
- async function Po() {
888
- let e = Si.value;
889
- await jo(e, To());
719
+ async function pa() {
720
+ let e = Un.value;
721
+ await ua(e, ia());
890
722
  }
891
- function Fo(e) {
892
- $o(e), bi.value = !1;
723
+ function ma(e) {
724
+ Pa(e), Vn.value = !1;
893
725
  }
894
- function Io() {
895
- $(), _o();
726
+ function ha() {
727
+ $(), Xi();
896
728
  }
897
- function Lo(e, t, n, r) {
898
- $(), Co(So({ type: t }), e, {
729
+ function ga(e, t, n, r) {
730
+ $(), na(ta({ type: t }), e, {
899
731
  left: n,
900
732
  top: r
901
733
  });
902
734
  }
903
- function Ro(e) {
904
- $(), F.value = e, Q();
735
+ function _a(e) {
736
+ $(), D.value = e, Q();
905
737
  }
906
- function zo(e) {
907
- let t = P.value.variables.find((t) => t.id === e.id), n = [...P.value.pages], r = t?.key ?? e.key, i = "";
908
- R.forEach((t, a) => {
909
- let o = t.updateVariable(e, r);
738
+ function va(e) {
739
+ let t = E.value.variables.find((t) => t.id === e.id);
740
+ if (!t) return;
741
+ let n = e.key.trim();
742
+ if (n !== t.key) {
743
+ let t = ke(n, E.value.variables, e.id);
744
+ if (t) {
745
+ H.value = t;
746
+ return;
747
+ }
748
+ }
749
+ e = {
750
+ ...e,
751
+ key: n
752
+ };
753
+ let r = [...E.value.pages], i = t.key, a = "";
754
+ M.forEach((t, n) => {
755
+ let o = t.updateVariable(e, i);
910
756
  if (o) {
911
- i ||= a;
912
- let e = n.findIndex((e) => e.id === a);
913
- e >= 0 && (n[e] = o);
757
+ a ||= n;
758
+ let e = r.findIndex((e) => e.id === n);
759
+ e >= 0 && (r[e] = o);
914
760
  }
915
- }), q({
916
- ...P.value,
917
- pages: n,
918
- variables: P.value.variables.map((t) => t.id === e.id ? e : t)
919
- }), F.value = e.key, mo(i || L.value);
920
- }
921
- function Bo(e) {
922
- Ui.value && zo({
923
- ...Ui.value,
761
+ }), X({
762
+ ...E.value,
763
+ pages: r,
764
+ variables: E.value.variables.map((t) => t.id === e.id ? e : t),
765
+ ...i !== e.key && E.value.pageDecorations ? { pageDecorations: ue(E.value.pageDecorations, i, e.key) } : {}
766
+ }), D.value = e.key, J(a || k.value);
767
+ }
768
+ function ya(e) {
769
+ G.value && va({
770
+ ...G.value,
924
771
  ...e,
925
772
  style: {
926
- ...Ui.value.style,
773
+ ...G.value.style,
927
774
  ...e.style
928
775
  }
929
776
  });
930
777
  }
931
- function Vo(e) {
932
- (e === "left" || e === "center" || e === "right") && Bo({ style: { textAlign: e } });
778
+ function ba(e) {
779
+ W.value || !G.value || ya({ key: e });
933
780
  }
934
- function Ho(e) {
935
- (e === "solid" || e === "dashed") && Bo({ style: { borderStyle: e } });
781
+ function xa(e) {
782
+ W.value || (X({
783
+ ...E.value,
784
+ pageDecorations: se(e)
785
+ }), J(E.value.pages[0]?.id));
936
786
  }
937
- function Uo(e) {
938
- (e === "contain" || e === "cover" || e === "fill") && Bo({ style: { objectFit: e } });
787
+ function Sa(e) {
788
+ (e === "left" || e === "center" || e === "right") && ya({ style: { textAlign: e } });
939
789
  }
940
- function Wo(e) {
941
- Bo({ style: e });
790
+ function Ca(e) {
791
+ (e === "solid" || e === "dashed") && ya({ style: { borderStyle: e } });
942
792
  }
943
- function Go(e) {
944
- Wo({ fontFamily: String(e || "").trim() || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif" });
793
+ function wa(e) {
794
+ (e === "contain" || e === "cover" || e === "fill") && ya({ style: { objectFit: e } });
945
795
  }
946
- function Ko(e) {
947
- Wo({ fontSize: Ma(e, Ui.value?.style?.fontSize ?? 14) });
796
+ function Ta(e) {
797
+ ya({ style: e });
948
798
  }
949
- function qo(e) {
950
- Ui.value && Bo({
799
+ function Ea(e) {
800
+ Ta({ fontFamily: String(e || "").trim() || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif" });
801
+ }
802
+ function Da(e) {
803
+ Ta({ fontSize: wi(e, G.value?.style?.fontSize ?? 14) });
804
+ }
805
+ function Oa(e) {
806
+ G.value && ya({
951
807
  multiline: e,
952
- rows: Ui.value.rows || 3,
953
- lineHeight: Ui.value.lineHeight || 28,
808
+ rows: G.value.rows || 3,
809
+ lineHeight: G.value.lineHeight || 28,
954
810
  style: e ? { underline: !0 } : void 0
955
811
  });
956
812
  }
957
- function Jo(e) {
958
- Ui.value && Bo({
813
+ function ka(e) {
814
+ G.value && ya({
959
815
  rows: Number(e || 3),
960
- lineHeight: Ui.value.lineHeight || 28
816
+ lineHeight: G.value.lineHeight || 28
961
817
  });
962
818
  }
963
- function Yo(e) {
964
- if (H.value) return;
965
- let t = [...P.value.pages];
966
- R.forEach((n, r) => {
819
+ function Aa(e) {
820
+ if (W.value) return;
821
+ let t = [...E.value.pages];
822
+ M.forEach((n, r) => {
967
823
  let i = n.removeVariable(e.key);
968
824
  if (i) {
969
825
  let e = t.findIndex((e) => e.id === r);
970
826
  e >= 0 && (t[e] = i);
971
827
  }
972
- }), q({
973
- ...P.value,
828
+ }), X({
829
+ ...E.value,
974
830
  pages: t,
975
- variables: P.value.variables.filter((t) => t.id !== e.id)
976
- }), F.value = "", I.value = "";
831
+ variables: E.value.variables.filter((t) => t.id !== e.id),
832
+ ...E.value.pageDecorations ? { pageDecorations: ue(E.value.pageDecorations, e.key) } : {}
833
+ }), D.value = "", O.value = "";
977
834
  }
978
- function Xo(e) {
979
- let t = (e.trim() || "variable").replace(/\s+/g, "_"), n = new Set(P.value.variables.map((e) => e.key));
835
+ function ja(e) {
836
+ let t = (e.trim() || "variable").replace(/\s+/g, "_"), n = new Set(E.value.variables.map((e) => e.key));
980
837
  if (!n.has(t)) return t;
981
838
  let r = 2;
982
839
  for (; n.has(`${t}_${r}`);) r += 1;
983
840
  return `${t}_${r}`;
984
841
  }
985
- function Zo(e) {
986
- H.value || Co(be({
842
+ function Ma(e) {
843
+ W.value || na(be({
987
844
  ...e,
988
845
  id: void 0,
989
- key: Xo(`${e.key || e.type}_copy`),
846
+ key: ja(`${e.key || e.type}_copy`),
990
847
  label: `${e.label}副本`,
991
848
  style: { ...e.style }
992
849
  }, l.variableTypes, l.defaultVariableStyle));
993
850
  }
994
- function Qo(e) {
995
- return H.value ? void 0 : Co(P.value.variables.find((t) => t.key === e.key) ?? be(e, l.variableTypes, l.defaultVariableStyle));
851
+ function Na(e) {
852
+ return W.value ? void 0 : na(E.value.variables.find((t) => t.key === e.key) ?? be(e, l.variableTypes, l.defaultVariableStyle));
996
853
  }
997
- function $o(e) {
998
- if (!H.value) return Co(So({ type: e }));
854
+ function Pa(e) {
855
+ if (!W.value) return na(ta({ type: e }));
999
856
  }
1000
- function es(t) {
1001
- if (H.value || !e(t)) return;
1002
- let n = z.value, r = ma.value.find((e) => e.type === t);
857
+ function Fa(t) {
858
+ if (W.value || !e(t)) return;
859
+ let n = R.value, r = Wr.value.find((e) => e.type === t);
1003
860
  if (!n || !r) return;
1004
- let i = Fe(n.leadingText) || r.label, a = Ie(n.selectionWidth, yr, ya.value), o = ts();
1005
- Co(So({
861
+ let i = Fe(n.leadingText) || r.label, a = Ie(n.selectionWidth, Xt, di.value), o = Ia();
862
+ na(ta({
1006
863
  type: t,
1007
864
  label: i,
1008
865
  ...a ? { width: a } : {},
1009
866
  ...o ? { style: o } : {}
1010
- }), n.pageId), Pi.value = n.hasSelection ? `已将选中内容替换为${r.label}控件` : `已插入${r.label}控件`, $();
867
+ }), n.pageId), H.value = n.hasSelection ? `已将选中内容替换为${r.label}控件` : `已插入${r.label}控件`, $();
1011
868
  }
1012
- function ts() {
1013
- let e = G.value, t = {};
869
+ function Ia() {
870
+ let e = pi.value, t = {};
1014
871
  return e.isUnderline && (t.underline = !0), typeof e.fontSize == "number" && Number.isFinite(e.fontSize) && (t.fontSize = e.fontSize), e.fontFamily && (t.fontFamily = e.fontFamily), e.textColor && (t.color = e.textColor), Object.keys(t).length ? t : void 0;
1015
872
  }
1016
- function ns(e) {
1017
- if (H.value) return;
1018
- let t = z.value;
1019
- t && (Co(e, t.pageId), Pi.value = `已绑定到${e.label},沿用原控件尺寸`, $());
873
+ function La(e) {
874
+ if (W.value) return;
875
+ let t = R.value;
876
+ t && (na(e, t.pageId), H.value = `已绑定到${e.label},沿用原控件尺寸`, $());
1020
877
  }
1021
- function rs(t) {
1022
- return Se(t.type && e(t.type) ? t.type : "text", ma.value).label;
878
+ function Ra(t) {
879
+ return Se(t.type && e(t.type) ? t.type : "text", Wr.value).label;
1023
880
  }
1024
- function is() {
1025
- P.value.variables.length && (Oi.value = !0, y(() => {
1026
- yc(), Di.value?.querySelector(".gd-contract-template-designer__text-menu-bind-search input")?.focus();
881
+ function za() {
882
+ E.value.variables.length && (er.value = !0, g(() => {
883
+ Qo(), Jn.value?.focusBindSearch();
1027
884
  }));
1028
885
  }
1029
- function as(e, t) {
886
+ function Ba(e, t) {
1030
887
  e.dataTransfer?.setData("application/x-gd-contract-variable", t), e.dataTransfer && (e.dataTransfer.effectAllowed = "copy");
1031
888
  }
1032
- function os(e) {
1033
- return ui.value = Math.round(Math.min(hr, Math.max(mr, Number.isFinite(e) ? e : 1)) * 100) / 100, ui.value;
1034
- }
1035
- let { width: ss } = Mt(Mr), { width: cs } = Mt(Pr), ls = d(() => Math.max(...P.value.pages.map((e) => X(e).width), pe.width) + 10), us = S([]), ds = /* @__PURE__ */ new Map(), fs = 0, ps = d(() => us.value.length > 0);
1036
- function ms(e) {
1037
- return us.value.includes(e);
1038
- }
1039
- function hs(e, t) {
1040
- let n = us.value;
1041
- n.length === e.length && e.every((e) => n.includes(e)) || (us.value = e, e.length || (mi.value = !1), !(t >= kr) && y(() => gs(t + 1)));
889
+ function Va(e) {
890
+ return N.value = Math.round(Math.min(Gt, Math.max(Wt, Number.isFinite(e) ? e : 1)) * 100) / 100, N.value;
1042
891
  }
1043
- function gs(e = 0) {
1044
- let t = Pr.value;
1045
- if (!t) return;
1046
- if (typeof window < "u" && window.matchMedia("(max-width: 760px)").matches) {
1047
- hs([], e);
1048
- return;
1049
- }
1050
- let n = t.clientWidth;
1051
- if (n <= 0) return;
1052
- let r = Fr.value, i = 0;
1053
- for (let e of Array.from(t.children)) {
1054
- if (!(e instanceof HTMLElement)) continue;
1055
- if (e === r) {
1056
- e.offsetWidth > 0 && (fs = e.offsetWidth);
1057
- continue;
1058
- }
1059
- let t = e.dataset.toolbarOverflowKey;
1060
- if (t) {
1061
- e.offsetWidth > 0 && ds.set(t, e.offsetWidth);
1062
- continue;
1063
- }
1064
- i += e.offsetWidth;
1065
- }
1066
- let a = Object.fromEntries(ft.map((e) => [e, ds.get(e) ?? 0]));
1067
- hs(pt({
1068
- availableWidth: n,
1069
- fixedWidth: i,
1070
- groupWidths: a,
1071
- moreWidth: fs || Dr,
1072
- buffer: Or
1073
- }), e);
1074
- }
1075
- St([
1076
- cs,
1077
- xa,
1078
- gi,
1079
- Sa,
1080
- Ca,
1081
- H
1082
- ], () => {
1083
- y(() => gs());
1084
- }, { immediate: !0 }), vt(() => {
1085
- y(() => gs()), typeof document < "u" && document.fonts?.ready && document.fonts.ready.then(() => {
1086
- Pr.value && y(() => gs());
1087
- });
1088
- });
1089
- let { fitWidth: _s, applyAutoFit: vs, markUserAdjusted: ys } = je({
1090
- viewportWidth: ss,
1091
- widestPageWidth: ls,
892
+ let { width: Ha } = Lt(rn), { fitWidth: Ua, applyAutoFit: Wa, markUserAdjusted: Ga, userAdjusted: Ka } = Me({
893
+ viewportWidth: Ha,
894
+ widestPageWidth: f(() => Math.max(...E.value.pages.map((e) => Vi(e).width), fe.width) + 10),
1092
895
  padding: 48,
1093
- minZoom: mr,
1094
- maxZoom: hr,
1095
- getZoom: () => ui.value,
1096
- applyZoom: os
896
+ minZoom: Wt,
897
+ maxZoom: Gt,
898
+ getZoom: () => N.value,
899
+ applyZoom: Va
1097
900
  });
1098
- function bs(e) {
1099
- return ys(), os(e);
901
+ function qa(e) {
902
+ return Ga(), Va(e);
1100
903
  }
1101
- function xs() {
1102
- return vs();
904
+ function Ja() {
905
+ return Wa();
1103
906
  }
1104
- function Ss() {
1105
- return ui.value;
907
+ function Ya() {
908
+ return N.value;
1106
909
  }
1107
- function Cs() {
1108
- bs(ui.value + gr);
910
+ function Xa() {
911
+ qa(N.value + Kt);
1109
912
  }
1110
- function ws() {
1111
- bs(ui.value - gr);
913
+ function Za() {
914
+ qa(N.value - Kt);
1112
915
  }
1113
- function Ts(e) {
1114
- let t = e.target instanceof HTMLElement ? e.target : null;
1115
- t && (t.closest(".gd-contract-template-designer__toolbar-more, .ant-popover, .ant-select-dropdown") || (mi.value = !1));
916
+ function Qa() {
917
+ $(), I.value = !1, L.value = !1, Rn.value = !1, P.value = !P.value;
1116
918
  }
1117
- St(mi, (e) => {
1118
- typeof document > "u" || (e ? document.addEventListener("mousedown", Ts, !0) : document.removeEventListener("mousedown", Ts, !0));
1119
- }), _t(() => {
1120
- typeof document < "u" && document.removeEventListener("mousedown", Ts, !0);
919
+ b(Ha, (e) => {
920
+ Fn.value && !Ka.value && e > 0 && Ua();
1121
921
  });
1122
- function Es() {
1123
- $(), vi.value = !1, yi.value = !1, mi.value = !1, di.value = !di.value;
922
+ function $a(e) {
923
+ Pn.value ? un.value?.focus() : e();
924
+ }
925
+ function eo() {
926
+ $(), as(), F.value = !1, ur = {
927
+ fullscreen: P.value,
928
+ sidebar: Mn.value,
929
+ inspector: Nn.value,
930
+ chrome: Pn.value,
931
+ zoom: N.value,
932
+ userAdjusted: Ka.value
933
+ }, P.value = !0, Mn.value = !0, Nn.value = !0, Pn.value = !0, Fn.value = !0, g(() => {
934
+ W.value ? In.value?.focus() : M.get(k.value)?.focus();
935
+ });
1124
936
  }
1125
- function Ds() {
1126
- $();
1127
- let e = K(!1);
1128
- k.value ? (oi.value = u(A.value), ai.value = void 0, si.value = j.value || A.value[0]?.id || "") : (ai.value = c(e), oi.value = void 0, si.value = ""), ii.value = !0;
937
+ function to() {
938
+ let e = ur;
939
+ Fn.value = !1, ur = void 0, e && (P.value = e.fullscreen, Mn.value = e.sidebar, Nn.value = e.inspector, Pn.value = e.chrome, e.userAdjusted ? qa(e.zoom) : Wa(), g(() => $a(() => on.value?.focusImmersive())));
940
+ }
941
+ function no() {
942
+ Fn.value ? to() : eo();
943
+ }
944
+ function ro() {
945
+ $(), z.value = void 0;
946
+ let e = Y(!1);
947
+ x.value ? (On.value = u(S.value), Dn.value = void 0, kn.value = C.value || S.value[0]?.id || "") : (Dn.value = c(e), On.value = void 0, kn.value = ""), En.value = !0;
1129
948
  }
1130
- function Os() {
1131
- ii.value = !1, ai.value = void 0, oi.value = void 0, si.value = "";
949
+ function io() {
950
+ En.value = !1, Dn.value = void 0, On.value = void 0, kn.value = "";
1132
951
  }
1133
- function ks() {
1134
- return Qs();
952
+ function ao() {
953
+ return Mo();
1135
954
  }
1136
- function As() {
955
+ function oo() {
1137
956
  $();
1138
- let e = ks();
1139
- return li.value = JSON.stringify(e, null, 2), ci.value = !0, e;
1140
- }
1141
- function js() {
1142
- ci.value = !1;
1143
- }
1144
- function Ms() {
1145
- $(), vi.value = !1, yi.value = !1;
1146
- let e = U.value.map(Z);
1147
- N.value = [], M.value = {
1148
- ...M.value,
1149
- [j.value]: []
957
+ let e = ao();
958
+ return jn.value = JSON.stringify(e, null, 2), An.value = !0, e;
959
+ }
960
+ function so() {
961
+ An.value = !1;
962
+ }
963
+ function co() {
964
+ $(), z.value = void 0, I.value = !1, L.value = !1;
965
+ let e = K.value.map(ct);
966
+ T.value = [], w.value = {
967
+ ...w.value,
968
+ [C.value]: []
1150
969
  };
1151
- let t = !!I.value;
1152
- F.value = "", I.value = "", L.value = "", ii.value = !1, ai.value = void 0, oi.value = void 0, ci.value = !1, li.value = "", hi.value = {}, ri.value = "";
1153
- let n = q(ve(pe));
1154
- return t && v("signing-placement-select", void 0), e.forEach((e) => v("signing-placement-remove", e)), L.value = n.pages[0]?.id ?? "", c(n);
970
+ let t = !!O.value;
971
+ D.value = "", O.value = "", k.value = "", En.value = !1, Dn.value = void 0, On.value = void 0, An.value = !1, jn.value = "", zn.value = {}, Tn.value = "";
972
+ let n = X(ve(fe));
973
+ return t && h("signing-placement-select", void 0), e.forEach((e) => h("signing-placement-remove", e)), k.value = n.pages[0]?.id ?? "", c(n);
1155
974
  }
1156
- function Ns() {
1157
- H.value || ($(), Ot.confirm({
975
+ function lo() {
976
+ W.value || ($(), Ft.confirm({
1158
977
  title: "清空合同内容",
1159
978
  content: "将清空全部合同正文、页面、模板变量和签署位置,仅保留一个空白 A4 合同页。此操作不可撤销。",
1160
979
  okText: "确认清空",
1161
980
  okType: "danger",
1162
981
  cancelText: "取消",
1163
982
  onOk: () => {
1164
- Ms();
983
+ co();
1165
984
  }
1166
985
  }));
1167
986
  }
1168
- function Ps(e) {
1169
- let t = Pa().pages, n = t.find((e) => e.id === L.value);
987
+ function uo(e) {
988
+ let t = Ei().pages, n = t.find((e) => e.id === k.value);
1170
989
  return (n ? [n, ...t.filter((e) => e.id !== n.id)] : t).find((t) => t.contentHtml.includes(`data-key="${e.key}"`) || t.contentHtml.includes(`data-key='${e.key}'`));
1171
990
  }
1172
- function Fs(e) {
1173
- $(), F.value = e.key, Q();
1174
- let t = Ps(e);
1175
- t && (L.value = t.id, y(() => {
1176
- R.get(t.id)?.scrollIntoVariable(e.key);
991
+ function fo(e) {
992
+ $(), D.value = e.key, Q();
993
+ let t = uo(e);
994
+ t && (k.value = t.id, g(() => {
995
+ M.get(t.id)?.scrollIntoVariable(e.key);
1177
996
  }));
1178
997
  }
1179
- function Is(e) {
1180
- let t = P.value.variables.find((t) => t.key === e || t.id === e);
1181
- t && Fs(t);
998
+ function po(e) {
999
+ let t = E.value.variables.find((t) => t.key === e || t.id === e);
1000
+ t && fo(t);
1182
1001
  }
1183
- function Ls(e) {
1184
- let t = U.value.find((t) => t.id === e);
1185
- t && ($(), F.value = "", L.value = t.pageId, Q(t.id), y(() => {
1186
- R.get(t.pageId)?.scrollIntoSigningPlacement(t.id);
1002
+ function mo(e) {
1003
+ let t = K.value.find((t) => t.id === e);
1004
+ t && ($(), D.value = "", k.value = t.pageId, Q(t.id), g(() => {
1005
+ M.get(t.pageId)?.scrollIntoSigningPlacement(t.id);
1187
1006
  }));
1188
1007
  }
1189
- function Rs(e, t = !0) {
1190
- $(), L.value = e, t && y(() => {
1191
- R.get(e)?.scrollIntoPage();
1008
+ function ho(e, t = !0) {
1009
+ $(), k.value = e, t && g(() => {
1010
+ M.get(e)?.scrollIntoPage();
1192
1011
  });
1193
1012
  }
1194
- function zs(e) {
1195
- P.value.pages.some((t) => t.id === e) && Rs(e);
1013
+ function go(e) {
1014
+ E.value.pages.some((t) => t.id === e) && ho(e);
1196
1015
  }
1197
- function Bs() {
1198
- return c(Pa());
1016
+ function _o() {
1017
+ if (F.value) {
1018
+ vo();
1019
+ return;
1020
+ }
1021
+ F.value = !0;
1199
1022
  }
1200
- function Vs(e) {
1201
- N.value = Vr(e), M.value = {
1202
- ...M.value,
1203
- [j.value]: N.value
1204
- };
1205
- let t = q(Ee(e, l.pageSize));
1206
- t.signingPlacements?.some((e) => e.id === I.value) || Q(), mo(t.pages[0]?.id);
1207
- }
1208
- function Hs() {
1209
- let e = K(!1);
1210
- return k.value ? u(A.value) : u(at(A.value, j.value, e));
1211
- }
1212
- function Us(e, t) {
1213
- let n = Ur(nt(e, void 0, l.pageSize), l.pageSizeOptions), r = A.value;
1214
- Kr.value = !0, K(!1), A.value = n.files, M.value = Hr(n.files, e), Ia(ot(A.value, t ?? j.value), !1, !0, !0, !1), JSON.stringify(r) !== JSON.stringify(A.value) && Fa(A.value, "");
1215
- }
1216
- function Ws(e) {
1217
- if (H.value) return;
1218
- Kr.value = !0, K(!0);
1219
- let t = $e(e || `合同文件 ${A.value.length + 1}`, l.pageSize);
1220
- return A.value = [...A.value, t], M.value = {
1221
- ...M.value,
1222
- [t.id]: []
1223
- }, Fa(A.value, ""), v("file-add", u([t])[0]), Ia(t.id, !1, !0, !0), u([t])[0];
1023
+ function vo() {
1024
+ F.value = !1, g(() => $a(() => on.value?.focusPageDecorations()));
1224
1025
  }
1225
- function Gs(e) {
1226
- !k.value && !A.value.some((t) => t.id === e) || (Kr.value = !0, Ia(e));
1026
+ function yo() {
1027
+ return Oi(), c(Ei());
1227
1028
  }
1228
- function Ks(e, t) {
1229
- if (H.value) return;
1230
- Kr.value = !0, K(!1);
1231
- let n = it(A.value, e, t), r = n.find((t) => t.id === e);
1232
- if (r) return A.value = n, Fa(n, e), u([r])[0];
1029
+ function bo(e) {
1030
+ T.value = fn(e), w.value = {
1031
+ ...w.value,
1032
+ [C.value]: T.value
1033
+ };
1034
+ let t = X(Ee(e, l.pageSize));
1035
+ t.signingPlacements?.some((e) => e.id === O.value) || Q(), J(t.pages[0]?.id);
1036
+ }
1037
+ function xo() {
1038
+ let e = Y(!1);
1039
+ return x.value ? u(S.value) : u(at(S.value, C.value, e));
1040
+ }
1041
+ function So(e, t) {
1042
+ let n = Qe(nt(e, void 0, l.pageSize), l.pageSizeOptions), r = S.value;
1043
+ gn.value = !0, Y(!1), S.value = n.files, w.value = pn(n.files, e), Ni(ot(S.value, t ?? C.value), {
1044
+ syncCurrent: !1,
1045
+ shouldEmit: !0,
1046
+ forceRefresh: !0,
1047
+ persistCurrentErrors: !1
1048
+ }), d(r) !== d(S.value) && Mi(S.value, "");
1049
+ }
1050
+ function Co(e) {
1051
+ if (W.value) return;
1052
+ gn.value = !0, Y(!0);
1053
+ let t = $e(e || `合同文件 ${S.value.length + 1}`, l.pageSize);
1054
+ return S.value = [...S.value, t], w.value = {
1055
+ ...w.value,
1056
+ [t.id]: []
1057
+ }, Mi(S.value, ""), h("file-add", u([t])[0]), Ni(t.id, {
1058
+ syncCurrent: !1,
1059
+ shouldEmit: !0,
1060
+ forceRefresh: !0
1061
+ }), u([t])[0];
1233
1062
  }
1234
- function qs(e) {
1235
- if (H.value || A.value.length <= 1) return;
1236
- Kr.value = !0, K(!1);
1237
- let t = A.value.find((t) => t.id === e);
1063
+ function wo(e) {
1064
+ !x.value && !S.value.some((t) => t.id === e) || (gn.value = !0, Ni(e));
1065
+ }
1066
+ function To(e, t) {
1067
+ if (W.value) return;
1068
+ gn.value = !0, Y(!1);
1069
+ let n = it(S.value, e, t), r = n.find((t) => t.id === e);
1070
+ if (r) return S.value = n, Mi(n, e), u([r])[0];
1071
+ }
1072
+ function Eo(e) {
1073
+ if (W.value || S.value.length <= 1) return;
1074
+ gn.value = !0, Y(!1);
1075
+ let t = S.value.find((t) => t.id === e);
1238
1076
  if (!t) return;
1239
- let n = rt(A.value, e);
1240
- if (n.length === A.value.length) return;
1241
- A.value = n;
1242
- let { [e]: r, ...i } = M.value;
1243
- M.value = i, Fa(n, ""), v("file-remove", u([t])[0]);
1077
+ let n = rt(S.value, e);
1078
+ if (n.length === S.value.length) return;
1079
+ S.value = n;
1080
+ let { [e]: r, ...i } = w.value;
1081
+ w.value = i, Mi(n, ""), h("file-remove", u([t])[0]);
1244
1082
  let a = t.template.signingPlacements ?? [];
1245
- return a.forEach((e) => v("signing-placement-remove", Z(e))), a.some((e) => e.id === I.value) && v("signing-placement-select", void 0), j.value === e && Ia(ot(n, n[0]?.id), !1, !0, !0, !1), u([t])[0];
1246
- }
1247
- function Js(e) {
1248
- if (H.value || A.value.length <= 1) return;
1249
- let t = A.value.find((t) => t.id === e);
1083
+ return a.forEach((e) => h("signing-placement-remove", ct(e))), a.some((e) => e.id === O.value) && h("signing-placement-select", void 0), C.value === e && Ni(ot(n, n[0]?.id), {
1084
+ syncCurrent: !1,
1085
+ shouldEmit: !0,
1086
+ forceRefresh: !0,
1087
+ persistCurrentErrors: !1
1088
+ }), u([t])[0];
1089
+ }
1090
+ function Do(e) {
1091
+ if (W.value || S.value.length <= 1) return;
1092
+ let t = S.value.find((t) => t.id === e);
1250
1093
  if (!t) return;
1251
1094
  let n = t.template.signingPlacements?.length ?? 0;
1252
- Ot.confirm({
1095
+ Ft.confirm({
1253
1096
  title: "删除合同文件",
1254
1097
  content: n ? `“${t.name}”包含 ${n} 个签署位置,删除后文件内正文、变量和签署位置都会移除,是否继续?` : `删除“${t.name}”后,其正文和变量将无法恢复,是否继续?`,
1255
1098
  okText: "确认删除",
1256
1099
  okType: "danger",
1257
1100
  cancelText: "取消",
1258
1101
  onOk: () => {
1259
- qs(e);
1102
+ Eo(e);
1260
1103
  }
1261
1104
  });
1262
1105
  }
1263
- function Ys(e, t) {
1264
- if (H.value) return;
1265
- Kr.value = !0, K(!1);
1266
- let n = A.value.findIndex((t) => t.id === e), r = tt(A.value, e, t), i = r.findIndex((t) => t.id === e), a = r[i];
1267
- if (!(!a || n === i)) return A.value = r, Fa(r, ""), v("file-move", u([a])[0], n, i), u([a])[0];
1268
- }
1269
- function Xs() {
1270
- K(!1);
1271
- let e = rc(k.value ? A.value.flatMap((e) => {
1272
- let t = ke(e.template, { maxPages: ga.value });
1273
- return [...M.value[e.id] ?? [], ...t].map((t) => ({
1106
+ function Oo(e, t) {
1107
+ if (W.value) return;
1108
+ gn.value = !0, Y(!1);
1109
+ let n = S.value.findIndex((t) => t.id === e), r = tt(S.value, e, t), i = r.findIndex((t) => t.id === e), a = r[i];
1110
+ if (!(!a || n === i)) return S.value = r, Mi(r, ""), h("file-move", u([a])[0], n, i), u([a])[0];
1111
+ }
1112
+ function ko() {
1113
+ Y(!1);
1114
+ let e = Lo(x.value ? S.value.flatMap((e) => {
1115
+ let t = Ae(e.template, { maxPages: Kr.value });
1116
+ return [...w.value[e.id] ?? [], ...t].map((t) => ({
1274
1117
  ...t,
1275
1118
  fileId: e.id
1276
1119
  }));
1277
- }) : [...N.value, ...ke(Pa(), { maxPages: ga.value })]);
1278
- return ti.value = e, ei.value = !0, v("validate", e), e;
1120
+ }) : [...T.value, ...Ae(Ei(), { maxPages: Kr.value })]);
1121
+ return j.value = e, A.value = !0, h("validate", e), e;
1279
1122
  }
1280
- function Zs(e) {
1281
- if (e.fileId && e.fileId !== j.value) {
1282
- Gs(e.fileId), y(() => Zs({
1123
+ function Ao(e) {
1124
+ if (e.fileId && e.fileId !== C.value) {
1125
+ wo(e.fileId), g(() => Ao({
1283
1126
  ...e,
1284
1127
  fileId: void 0
1285
1128
  }));
1286
1129
  return;
1287
1130
  }
1131
+ let t = le(e);
1132
+ if (t) {
1133
+ F.value = !0, g(() => sn.value?.focusField(t));
1134
+ return;
1135
+ }
1288
1136
  if (e.type === "signing-placement") {
1289
- let t = U.value.find((t) => t.id === e.id);
1137
+ let t = K.value.find((t) => t.id === e.id);
1290
1138
  if (t) {
1291
- Rs(t.pageId), Q(t.id);
1139
+ ho(t.pageId), Q(t.id);
1292
1140
  return;
1293
1141
  }
1294
1142
  }
1295
1143
  if (e.variableKey) {
1296
- Is(e.variableKey);
1144
+ po(e.variableKey);
1297
1145
  return;
1298
1146
  }
1299
1147
  if (e.pageId) {
1300
- zs(e.pageId);
1148
+ go(e.pageId);
1301
1149
  return;
1302
1150
  }
1303
- let t = P.value.variables.find((t) => t.id === e.id || t.key === e.id);
1304
- if (t) {
1305
- Fs(t);
1151
+ let n = E.value.variables.find((t) => t.id === e.id || t.key === e.id);
1152
+ if (n) {
1153
+ fo(n);
1306
1154
  return;
1307
1155
  }
1308
- P.value.pages.some((t) => t.id === e.id) && Rs(e.id);
1156
+ E.value.pages.some((t) => t.id === e.id) && ho(e.id);
1309
1157
  }
1310
- function Qs() {
1311
- return xe(Pa());
1158
+ function jo(e) {
1159
+ return le(e) ? "页面装饰" : e.type === "signing-placement" ? "签署位置" : e.type === "variable" ? "变量" : "字段";
1312
1160
  }
1313
- function $s() {
1314
- let e = K(!1);
1315
- return et(k.value ? A.value : at(A.value, j.value, e));
1161
+ function Mo() {
1162
+ return Oi(), xe(Ei());
1163
+ }
1164
+ function No() {
1165
+ let e = Y(!1);
1166
+ return et(x.value ? S.value : at(S.value, C.value, e));
1316
1167
  }
1317
- function ec(e) {
1318
- let n = Pa();
1168
+ function Po(e) {
1169
+ let n = Ei();
1319
1170
  try {
1320
- let r = he(n, N.value);
1171
+ let r = me(n, T.value);
1321
1172
  if (r.length) throw new t(r);
1322
1173
  return e(n);
1323
1174
  } catch (e) {
1324
- throw e instanceof t && (ti.value = [...e.errors], ei.value = !0, v("validate", [...e.errors])), e;
1175
+ throw e instanceof t && (j.value = [...e.errors], A.value = !0, h("validate", [...e.errors])), e;
1325
1176
  }
1326
1177
  }
1327
- function tc(e) {
1328
- return ec((t) => o(t, e));
1178
+ function Fo(e) {
1179
+ return Po((t) => i(t, e));
1329
1180
  }
1330
- function nc(e) {
1331
- return ec((t) => a(t, e));
1181
+ function Io(e) {
1182
+ return Po((t) => r(t, e));
1332
1183
  }
1333
- function rc(e) {
1184
+ function Lo(e) {
1334
1185
  let t = /* @__PURE__ */ new Set();
1335
1186
  return e.filter((e) => {
1336
1187
  let n = `${e.fileId ?? ""}|${e.code ?? ""}|${e.id}|${e.pageId ?? ""}|${e.message}`;
1337
1188
  return t.has(n) ? !1 : (t.add(n), !0);
1338
1189
  });
1339
1190
  }
1340
- function ic(e) {
1341
- ti.value = [...e], ei.value = !0;
1191
+ function Ro(e) {
1192
+ j.value = [...e], A.value = !0;
1342
1193
  }
1343
- function ac() {
1344
- ti.value = [], ei.value = !1;
1194
+ function zo() {
1195
+ j.value = [], A.value = !1;
1345
1196
  }
1346
- function oc() {
1347
- R.get(W.value?.id ?? L.value)?.focus();
1197
+ function Bo() {
1198
+ M.get(q.value?.id ?? k.value)?.focus();
1348
1199
  }
1349
- function sc(e) {
1350
- ka(e) && J({
1200
+ function Vo(e) {
1201
+ Si(e) && Z({
1351
1202
  type: "set-text-align",
1352
1203
  value: e
1353
1204
  });
1354
1205
  }
1355
- function cc(e) {
1356
- if (e === "paragraph") {
1357
- J({ type: "set-paragraph" });
1358
- return;
1359
- }
1360
- Aa(e) && J({
1361
- type: "set-heading",
1362
- level: e
1206
+ function Ho(e) {
1207
+ (e === "paragraph" || Ci(e)) && Z({
1208
+ type: "apply-block-style",
1209
+ format: e
1363
1210
  });
1364
1211
  }
1365
- function lc(e) {
1366
- let t = Na(e);
1367
- t && (J({
1212
+ function Uo(e) {
1213
+ let t = Ti(e);
1214
+ t && (Z({
1368
1215
  type: "set-font-size",
1369
1216
  value: t
1370
- }), _i.value = "");
1217
+ }), Bn.value = "");
1371
1218
  }
1372
- function uc(e) {
1219
+ function Wo(e) {
1373
1220
  let t = String(e || "").trim();
1374
1221
  if (!t) {
1375
- J({ type: "unset-font-family" });
1222
+ Z({ type: "unset-font-family" });
1376
1223
  return;
1377
1224
  }
1378
- J({
1225
+ Z({
1379
1226
  type: "set-font-family",
1380
1227
  value: t
1381
1228
  });
1382
1229
  }
1383
- function dc(e) {
1384
- fc(e.target?.value ?? "");
1230
+ function Go(e) {
1231
+ Ko(e.target?.value ?? "");
1385
1232
  }
1386
- function fc(e) {
1233
+ function Ko(e) {
1387
1234
  let t = e.trim();
1388
- t && J({
1235
+ t && Z({
1389
1236
  type: "set-color",
1390
1237
  value: t
1391
1238
  });
1392
1239
  }
1393
- function pc(e) {
1394
- _i.value = e;
1395
- }
1396
- function mc() {
1397
- _i.value.trim() && lc(_i.value);
1240
+ function qo(e) {
1241
+ Bn.value = e;
1398
1242
  }
1399
- function hc(e) {
1400
- e.key === "Enter" && (e.preventDefault(), mc());
1243
+ function Jo() {
1244
+ Bn.value.trim() && Uo(Bn.value);
1401
1245
  }
1402
- function gc(e) {
1403
- e || (mc(), _i.value = "");
1246
+ function Yo(e) {
1247
+ e.key === "Enter" && (e.preventDefault(), Jo());
1404
1248
  }
1405
- function _c(e) {
1406
- ja(e) && (J({
1407
- type: "apply-text-style-preset",
1408
- preset: e
1409
- }), gi.value = void 0, $());
1249
+ function Xo(e) {
1250
+ e || (Jo(), Bn.value = "");
1410
1251
  }
1411
- function vc(e) {
1412
- if (H.value) return;
1413
- L.value = e.pageId, vi.value = !1, yi.value = !1, B.value = void 0, V.value = void 0, Oi.value = !1, ki.value = "";
1414
- let t = Math.max(O, Math.min(e.clientX, window.innerWidth - Cr)), n = Math.max(O, Math.min(e.clientY, window.innerHeight - wr));
1415
- z.value = {
1252
+ function Zo(e) {
1253
+ if (W.value) return;
1254
+ k.value = e.pageId, I.value = !1, L.value = !1, B.value = void 0, V.value = void 0, er.value = !1, tr.value = "";
1255
+ let t = _t(e.clientX, e.clientY, 304, 300);
1256
+ R.value = {
1416
1257
  pageId: e.pageId,
1417
- x: t,
1418
- y: n,
1258
+ x: t.x,
1259
+ y: t.y,
1419
1260
  hasSelection: e.hasSelection,
1420
1261
  selectionWidth: e.selectionWidth,
1421
1262
  leadingText: e.leadingText
1422
- }, y(() => {
1423
- yc(), Di.value?.querySelector("button:not(:disabled)")?.focus();
1263
+ }, g(() => {
1264
+ Qo(), Jn.value?.focusFirstButton();
1424
1265
  });
1425
1266
  }
1426
- function yc() {
1427
- let e = Di.value, t = z.value;
1267
+ function Qo() {
1268
+ let e = Jn.value?.getMenuElement(), t = R.value;
1428
1269
  if (!e || !t) return;
1429
- let n = e.getBoundingClientRect();
1430
- z.value = {
1270
+ let n = vt(t.x, t.y, e);
1271
+ R.value = {
1431
1272
  ...t,
1432
- x: Math.max(O, Math.min(t.x, window.innerWidth - n.width - O)),
1433
- y: Math.max(O, Math.min(t.y, window.innerHeight - n.height - O))
1273
+ x: n.x,
1274
+ y: n.y
1434
1275
  };
1435
1276
  }
1436
- function bc(e) {
1437
- H.value || (L.value = e.pageId, vi.value = !1, yi.value = !1, z.value = void 0, V.value = void 0, B.value = {
1277
+ function $o(e) {
1278
+ if (W.value) return;
1279
+ k.value = e.pageId, I.value = !1, L.value = !1, R.value = void 0, V.value = void 0;
1280
+ let t = _t(e.clientX, e.clientY, 248, 400);
1281
+ B.value = {
1438
1282
  ...e,
1439
- x: Math.max(8, Math.min(e.clientX, window.innerWidth - 248)),
1440
- y: Math.max(8, Math.min(e.clientY, window.innerHeight - 400))
1441
- }, y(() => {
1442
- let e = Ai.value?.getMenuElement(), t = B.value;
1283
+ x: t.x,
1284
+ y: t.y
1285
+ }, g(() => {
1286
+ let e = nr.value?.getMenuElement(), t = B.value;
1443
1287
  if (e && t) {
1444
- let n = e.getBoundingClientRect();
1288
+ let n = vt(t.x, t.y, e);
1445
1289
  B.value = {
1446
1290
  ...t,
1447
- x: Math.max(8, Math.min(t.x, window.innerWidth - n.width - 8)),
1448
- y: Math.max(8, Math.min(t.y, window.innerHeight - n.height - 8))
1291
+ x: n.x,
1292
+ y: n.y
1449
1293
  };
1450
1294
  }
1451
- Ai.value?.focusFirstItem();
1452
- }));
1295
+ nr.value?.focusFirstItem();
1296
+ });
1453
1297
  }
1454
- function xc(e) {
1455
- H.value || (L.value = e.pageId, vi.value = !1, yi.value = !1, z.value = void 0, B.value = void 0, Mi.value = e.image.width, Ni.value = e.image.height, F.value = "", I.value && Q(), V.value = {
1298
+ function es(e) {
1299
+ if (W.value) return;
1300
+ k.value = e.pageId, I.value = !1, L.value = !1, R.value = void 0, B.value = void 0, ir.value = e.image.width, ar.value = e.image.height, D.value = "", O.value && Q();
1301
+ let t = _t(e.clientX, e.clientY, 288, 196);
1302
+ V.value = {
1456
1303
  pageId: e.pageId,
1457
1304
  image: e.image,
1458
- x: Math.max(O, Math.min(e.clientX, window.innerWidth - Tr)),
1459
- y: Math.max(O, Math.min(e.clientY, window.innerHeight - Er))
1460
- }, y(() => {
1461
- Sc(), ji.value?.querySelector("input, button:not(:disabled)")?.focus();
1462
- }));
1305
+ x: t.x,
1306
+ y: t.y
1307
+ }, g(() => {
1308
+ ts(), rr.value?.getMenuElement()?.querySelector("input, button:not(:disabled)")?.focus();
1309
+ });
1463
1310
  }
1464
- function Sc() {
1465
- let e = ji.value, t = V.value;
1311
+ function ts() {
1312
+ let e = rr.value?.getMenuElement(), t = V.value;
1466
1313
  if (!e || !t) return;
1467
- let n = e.getBoundingClientRect();
1314
+ let n = vt(t.x, t.y, e);
1468
1315
  V.value = {
1469
1316
  ...t,
1470
- x: Math.max(O, Math.min(t.x, window.innerWidth - n.width - O)),
1471
- y: Math.max(O, Math.min(t.y, window.innerHeight - n.height - O))
1317
+ x: n.x,
1318
+ y: n.y
1472
1319
  };
1473
1320
  }
1474
- function Cc() {
1321
+ function ns() {
1475
1322
  let e = V.value;
1476
- !e || H.value || (R.get(e.pageId)?.updateSelectedContentImage({
1477
- width: Ne(Mi.value),
1478
- height: Ne(Ni.value)
1479
- }) && (Pi.value = "已更新图片尺寸"), $());
1323
+ !e || W.value || (M.get(e.pageId)?.updateSelectedContentImage({
1324
+ width: Ne(ir.value),
1325
+ height: Ne(ar.value)
1326
+ }) && (H.value = "已更新图片尺寸"), $());
1480
1327
  }
1481
- function wc() {
1328
+ function rs() {
1482
1329
  let e = V.value;
1483
- !e || H.value || (R.get(e.pageId)?.updateSelectedContentImage({
1330
+ !e || W.value || (M.get(e.pageId)?.updateSelectedContentImage({
1484
1331
  width: void 0,
1485
1332
  height: void 0
1486
- }) && (Pi.value = "已恢复图片自然尺寸"), $());
1333
+ }) && (H.value = "已恢复图片自然尺寸"), $());
1487
1334
  }
1488
- function Tc(e) {
1489
- e.type === "table" ? bc(e) : e.type === "image" ? xc(e) : vc(e);
1335
+ function is(e) {
1336
+ e.type === "table" ? $o(e) : e.type === "image" ? es(e) : Zo(e);
1490
1337
  }
1491
1338
  function $() {
1492
- z.value = void 0, B.value = void 0, V.value = void 0, Oi.value = !1, ki.value = "";
1339
+ R.value = void 0, B.value = void 0, V.value = void 0, er.value = !1, tr.value = "";
1340
+ }
1341
+ function as() {
1342
+ I.value = !1, L.value = !1, Rn.value = !1, Vn.value = !1, Hn.value = !1;
1343
+ }
1344
+ function os() {
1345
+ as(), Pn.value = !Pn.value, g(() => $a(() => on.value?.focusChromeToggle()));
1346
+ }
1347
+ let ss = [
1348
+ ".gd-contract-template-designer__context-menu",
1349
+ ".gd-contract-template-designer__bubble-menu",
1350
+ ".gd-contract-template-designer__bubble-menu-popup"
1351
+ ].join(",");
1352
+ function cs() {
1353
+ let e = W.value || Qn.value || Xn.value || mr.value || F.value || En.value, t = k.value, n = e ? void 0 : M.get(t)?.getSelectionViewportRect();
1354
+ if (!n) {
1355
+ z.value = void 0;
1356
+ return;
1357
+ }
1358
+ let r = n.top - 40 - en, i = r >= 12 ? r : n.bottom + en, a = _t((n.left + n.right) / 2 - 380 / 2, i, 380, 40);
1359
+ z.value = {
1360
+ pageId: t,
1361
+ x: a.x,
1362
+ y: a.y
1363
+ }, g(() => ls(n));
1364
+ }
1365
+ function ls(e) {
1366
+ let t = Yn.value?.getMenuElement(), n = z.value;
1367
+ if (!t || !n) return;
1368
+ let r = t.getBoundingClientRect(), i = e.top - r.height - en, a = i >= 12 ? i : e.bottom + en, o = vt((e.left + e.right) / 2 - r.width / 2, a, t);
1369
+ z.value = {
1370
+ ...n,
1371
+ x: o.x,
1372
+ y: o.y
1373
+ };
1493
1374
  }
1494
- function Ec(e) {
1495
- !z.value && !B.value && !V.value || (e.target instanceof HTMLElement ? e.target : null)?.closest(".gd-contract-template-designer__context-menu") || $();
1375
+ function us() {
1376
+ let e = z.value?.pageId ?? k.value, t = M.get(e)?.getSelectionRange();
1377
+ Zn = t ? {
1378
+ pageId: e,
1379
+ ...t
1380
+ } : void 0, Xn.value = !0, z.value = void 0;
1381
+ }
1382
+ function ds(e) {
1383
+ if (!Xn.value) return;
1384
+ let t = Zn, n = M.get(e)?.getSelectionRange();
1385
+ t && n && t.pageId === e && t.from === n.from && t.to === n.to || (Xn.value = !1, Zn = void 0);
1386
+ }
1387
+ function fs() {
1388
+ !z.value || $n !== void 0 || ($n = requestAnimationFrame(() => {
1389
+ $n = void 0, cs();
1390
+ }));
1496
1391
  }
1497
- function Dc(e) {
1498
- let t = jr.value;
1392
+ function ps() {
1393
+ Qn.value && (Qn.value = !1, cs());
1394
+ }
1395
+ function ms() {
1396
+ $(), fs();
1397
+ }
1398
+ function hs(e, t) {
1399
+ M.get(z.value?.pageId ?? k.value)?.requestTextContextMenu(e, t);
1400
+ }
1401
+ function gs(e) {
1402
+ let t = e.target instanceof HTMLElement ? e.target : null;
1403
+ t?.closest(".ProseMirror") && (Qn.value = !0, z.value = void 0), !(!R.value && !B.value && !V.value && !z.value) && (t?.closest(ss) || ($(), z.value && us()));
1404
+ }
1405
+ function _s(e) {
1406
+ (e.target instanceof Element ? e.target : null)?.closest(ss) || ($(), fs());
1407
+ }
1408
+ function vs(e) {
1409
+ let t = nn.value;
1499
1410
  if (!t || typeof document > "u") return !1;
1500
1411
  let n = e.target instanceof Node ? e.target : void 0, r = document.activeElement;
1501
1412
  return !!(n && t.contains(n) || r && t.contains(r) || n instanceof Element && n.closest(".gd-contract-template-designer__context-menu"));
1502
1413
  }
1503
- function Oc(e) {
1414
+ function ys(e) {
1415
+ if (e.key !== "Escape" || !F.value || typeof document > "u") return;
1416
+ let t = nn.value?.querySelector(".gd-contract-template-designer__page-decorations-studio");
1417
+ if (!t) return;
1418
+ let n = e.target instanceof Element ? e.target : null, r = document.activeElement instanceof Element ? document.activeElement : null, i = !!(n?.closest(cr) || r?.closest(cr)), a = !!(n && t.contains(n) || r && t.contains(r)), o = !!t.querySelector(".ant-select-open, .ant-dropdown-open");
1419
+ if (i || a && o) {
1420
+ sr.add(e);
1421
+ return;
1422
+ }
1423
+ !mr.value && (a || e.target === document) && (e.preventDefault(), e.stopPropagation(), vo());
1424
+ }
1425
+ function bs(e) {
1504
1426
  if ((e.ctrlKey || e.metaKey) && !e.altKey && e.key.toLowerCase() === "s") {
1505
- if (!Bi.value || !Dc(e)) return;
1506
- e.preventDefault(), Ra();
1427
+ if (!hr.value || !vs(e)) return;
1428
+ e.preventDefault(), ri();
1507
1429
  return;
1508
1430
  }
1509
- e.key === "Escape" && ($(), vi.value = !1, yi.value = !1, di.value = !1);
1431
+ if (e.key === "Escape") {
1432
+ if (sr.has(e)) {
1433
+ sr.delete(e);
1434
+ return;
1435
+ }
1436
+ let t = mr.value, n = t || F.value;
1437
+ if (!t && F.value && vo(), $(), as(), n && e.stopPropagation(), !n) {
1438
+ if (z.value) {
1439
+ us(), e.stopPropagation();
1440
+ return;
1441
+ }
1442
+ Fn.value ? to() : P.value = !1;
1443
+ }
1444
+ }
1510
1445
  }
1511
- function kc(e, t) {
1512
- e === L.value && t.selectedContentImage && (F.value = "", I.value && Q());
1513
- let n = hi.value[e];
1514
- n && JSON.stringify(n) === JSON.stringify(t) || (hi.value = {
1515
- ...hi.value,
1446
+ function xs(e, t) {
1447
+ e === k.value && t.selectedContentImage && (D.value = "", O.value && Q()), e === k.value && (ds(e), cs());
1448
+ let n = zn.value[e];
1449
+ n && gt(n, t) || (zn.value = {
1450
+ ...zn.value,
1516
1451
  [e]: t
1517
1452
  });
1518
1453
  }
1519
- function Ac(e = Ii.value.rows, t = Ii.value.cols) {
1520
- J({
1454
+ function Ss(e = or.value.rows, t = or.value.cols) {
1455
+ Z({
1521
1456
  type: "insert-table",
1522
1457
  options: {
1523
1458
  rows: Math.min(10, Math.max(1, Math.round(Number(e) || 3))),
1524
1459
  cols: Math.min(10, Math.max(1, Math.round(Number(t) || 3))),
1525
- withHeaderRow: !!Ii.value.withHeaderRow
1460
+ withHeaderRow: !!or.value.withHeaderRow
1526
1461
  }
1527
- }), vi.value = !1, $();
1462
+ }), I.value = !1, $();
1528
1463
  }
1529
- let jc = {
1464
+ let Cs = {
1530
1465
  "delete-table-row": {
1531
1466
  label: "删除当前行",
1532
1467
  countKey: "deleteRow"
@@ -1540,34 +1475,34 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
1540
1475
  countKey: "deleteTable"
1541
1476
  }
1542
1477
  };
1543
- function Mc(e) {
1478
+ function ws(e) {
1544
1479
  let t = B.value;
1545
1480
  if (!t) return;
1546
1481
  let n = () => {
1547
- J(e, t.pageId), $();
1548
- }, r = jc[e.type];
1482
+ Z(e, t.pageId), $();
1483
+ }, r = Cs[e.type];
1549
1484
  if (!r) {
1550
1485
  n();
1551
1486
  return;
1552
1487
  }
1553
1488
  let i = t.affectedVariableCounts[r.countKey];
1554
- $(), Ot.confirm({
1489
+ $(), Ft.confirm({
1555
1490
  title: r.label,
1556
1491
  content: i ? `此操作将移除 ${i} 个正文变量节点,是否继续?` : "此操作将修改表格结构,是否继续?",
1557
1492
  okText: "确认",
1558
1493
  okType: "danger",
1559
1494
  cancelText: "取消",
1560
1495
  onOk: n,
1561
- onCancel: () => R.get(t.pageId)?.focus()
1496
+ onCancel: () => M.get(t.pageId)?.focus()
1562
1497
  });
1563
1498
  }
1564
- function Nc(e) {
1565
- let t = Ai.value?.getMenuElement();
1499
+ function Ts(e) {
1500
+ let t = nr.value?.getMenuElement();
1566
1501
  if (!t) return;
1567
1502
  if (e.key === "Escape") {
1568
- e.preventDefault();
1503
+ e.preventDefault(), e.stopPropagation();
1569
1504
  let t = B.value?.pageId;
1570
- $(), R.get(t ?? "")?.focus();
1505
+ $(), M.get(t ?? "")?.focus();
1571
1506
  return;
1572
1507
  }
1573
1508
  let n = Array.from(t.querySelectorAll("button:not(:disabled)"));
@@ -1585,120 +1520,123 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
1585
1520
  let r = (Math.max(0, n.indexOf(document.activeElement)) + (e.key === "ArrowUp" || e.key === "ArrowLeft" ? -1 : 1) + n.length) % n.length;
1586
1521
  e.preventDefault(), n[r]?.focus();
1587
1522
  }
1588
- function Pc(e) {
1523
+ function Es(e) {
1589
1524
  if (e.key !== "Escape") return;
1590
- e.preventDefault();
1591
- let t = z.value?.pageId;
1592
- $(), R.get(t ?? "")?.focus();
1525
+ e.preventDefault(), e.stopPropagation();
1526
+ let t = R.value?.pageId;
1527
+ $(), M.get(t ?? "")?.focus();
1593
1528
  }
1594
- function Fc(e) {
1529
+ function Ds(e) {
1595
1530
  if (e.key !== "Escape") return;
1596
- e.preventDefault();
1531
+ e.preventDefault(), e.stopPropagation();
1597
1532
  let t = V.value?.pageId;
1598
- $(), R.get(t ?? "")?.focus();
1599
- }
1600
- function Ic(e) {
1601
- J({ type: e }), yi.value = !1, $();
1602
- }
1603
- return Ve({
1604
- getValue: Bs,
1605
- setValue: Vs,
1606
- getFiles: Hs,
1607
- setFiles: Us,
1608
- addFile: Ws,
1609
- selectFile: Gs,
1610
- renameFile: Ks,
1611
- removeFile: qs,
1612
- moveFile: Ys,
1613
- validate: Xs,
1614
- exportTemplate: Qs,
1615
- exportFiles: $s,
1616
- getSubmitData: ks,
1617
- clearTemplate: Ms,
1618
- saveDraftCache: Ra,
1619
- loadDraftCache: za,
1620
- clearDraftCache: Ba,
1621
- getDraftCacheStatus: Va,
1622
- insertVariable: Qo,
1623
- insertImage: jo,
1624
- focus: oc,
1625
- openPreview: Ds,
1626
- closePreview: Os,
1627
- openSubmitDataViewer: As,
1628
- closeSubmitDataViewer: js,
1629
- setServerValidationErrors: ic,
1630
- clearValidationErrors: ac,
1631
- scrollToVariable: Is,
1632
- scrollToSigningPlacement: Ls,
1633
- scrollToPage: zs,
1634
- setZoom: bs,
1635
- resetZoom: xs,
1636
- getZoom: Ss,
1637
- fitWidth: _s,
1638
- insertSigningPlacement: to,
1533
+ $(), M.get(t ?? "")?.focus();
1534
+ }
1535
+ function Os(e) {
1536
+ Z({ type: e }), L.value = !1, $();
1537
+ }
1538
+ return Ke({
1539
+ getValue: yo,
1540
+ setValue: bo,
1541
+ getFiles: xo,
1542
+ setFiles: So,
1543
+ addFile: Co,
1544
+ selectFile: wo,
1545
+ renameFile: To,
1546
+ removeFile: Eo,
1547
+ moveFile: Oo,
1548
+ validate: ko,
1549
+ exportTemplate: Mo,
1550
+ exportFiles: No,
1551
+ getSubmitData: ao,
1552
+ clearTemplate: co,
1553
+ saveDraftCache: ri,
1554
+ loadDraftCache: ii,
1555
+ clearDraftCache: ai,
1556
+ getDraftCacheStatus: Fi,
1557
+ insertVariable: Na,
1558
+ insertImage: ua,
1559
+ focus: Bo,
1560
+ openPreview: ro,
1561
+ closePreview: io,
1562
+ openSubmitDataViewer: oo,
1563
+ closeSubmitDataViewer: so,
1564
+ setServerValidationErrors: Ro,
1565
+ clearValidationErrors: zo,
1566
+ scrollToVariable: po,
1567
+ scrollToSigningPlacement: mo,
1568
+ scrollToPage: go,
1569
+ setZoom: qa,
1570
+ resetZoom: Ja,
1571
+ getZoom: Ya,
1572
+ fitWidth: Ua,
1573
+ insertSigningPlacement: Yr,
1639
1574
  selectSigningPlacement: Q,
1640
- buildLocationRules: tc,
1641
- buildContractLocationRules: nc
1642
- }), (e, t) => (x(), m("div", {
1575
+ buildLocationRules: Fo,
1576
+ buildContractLocationRules: Io
1577
+ }), (e, t) => (_(), Ct("div", {
1643
1578
  ref_key: "designerElement",
1644
- ref: jr,
1645
- class: b(["gd-contract-template-designer", {
1646
- "is-disabled": fe.disabled,
1647
- "is-readonly": H.value,
1648
- "is-fullscreen": di.value
1579
+ ref: nn,
1580
+ class: wt(["gd-contract-template-designer", {
1581
+ "is-disabled": s.disabled,
1582
+ "is-readonly": W.value,
1583
+ "is-fullscreen": P.value,
1584
+ "is-immersive": Fn.value
1649
1585
  }]),
1650
- style: gt(Ar.value)
1586
+ style: Tt(tn.value)
1651
1587
  }, [
1652
- k.value ? (x(), f(lt, {
1588
+ x.value ? (_(), xt(ft, {
1653
1589
  key: 0,
1654
- files: A.value,
1655
- "active-file-id": j.value,
1656
- readonly: H.value,
1657
- onSelect: Gs,
1658
- onAdd: t[0] ||= (e) => Ws(),
1659
- onRename: Ks,
1660
- onRemove: Js,
1661
- onMove: Ys
1590
+ files: S.value,
1591
+ "active-file-id": C.value,
1592
+ readonly: W.value,
1593
+ onSelect: wo,
1594
+ onAdd: t[0] ||= (e) => Co(),
1595
+ onRename: To,
1596
+ onRemove: Do,
1597
+ onMove: Oo
1662
1598
  }, null, 8, [
1663
1599
  "files",
1664
1600
  "active-file-id",
1665
1601
  "readonly"
1666
- ])) : p("", !0),
1667
- h("div", { class: b(["gd-contract-template-designer__layout", {
1668
- "is-sidebar-collapsed": fi.value,
1669
- "is-inspector-collapsed": pi.value
1602
+ ])) : St("", !0),
1603
+ p("div", { class: wt(["gd-contract-template-designer__layout", {
1604
+ "is-sidebar-collapsed": Mn.value,
1605
+ "is-inspector-collapsed": Nn.value
1670
1606
  }]) }, [
1671
- _(ut, {
1672
- collapsed: fi.value,
1673
- pages: P.value.pages,
1674
- variables: P.value.variables,
1675
- "signing-placement-navigation-items": Ji.value,
1676
- "active-page-id": L.value,
1677
- "selected-variable-key": F.value,
1678
- "selected-signing-placement-id": I.value,
1679
- "normalized-max-pages": ga.value,
1680
- "page-limit-reached": _a.value,
1681
- "selected-page": W.value,
1682
- "selected-page-size": Xi.value,
1683
- "normalized-page-size-options": ua.value,
1684
- "page-size-options": da.value,
1685
- "selected-page-size-option-value": fa.value,
1607
+ m(pt, {
1608
+ collapsed: Mn.value,
1609
+ pages: E.value.pages,
1610
+ variables: E.value.variables,
1611
+ "decoration-variable-keys": Jr.value,
1612
+ "signing-placement-navigation-items": Sr.value,
1613
+ "active-page-id": k.value,
1614
+ "selected-variable-key": D.value,
1615
+ "selected-signing-placement-id": O.value,
1616
+ "normalized-max-pages": Kr.value,
1617
+ "page-limit-reached": qr.value,
1618
+ "selected-page": q.value,
1619
+ "selected-page-size": wr.value,
1620
+ "normalized-page-size-options": Br.value,
1621
+ "page-size-options": Vr.value,
1622
+ "selected-page-size-option-value": Hr.value,
1686
1623
  "show-signing-placement-tools": l.showSigningPlacementTools,
1687
- readonly: H.value,
1688
- "get-page-size": X,
1689
- "get-page-signing-placements": Ya,
1690
- onToggle: t[1] ||= (e) => fi.value = !fi.value,
1691
- onAddPage: _o,
1692
- onActivatePage: Rs,
1693
- onDuplicatePage: vo,
1694
- onRemovePage: bo,
1695
- onPatchPageFormat: lo,
1696
- onScrollToVariable: Fs,
1697
- onScrollToSigningPlacement: Ls
1624
+ readonly: W.value,
1625
+ "get-page-size": Vi,
1626
+ "get-page-signing-placements": Hi,
1627
+ onToggle: t[1] ||= (e) => Mn.value = !Mn.value,
1628
+ onAddPage: Xi,
1629
+ onActivatePage: ho,
1630
+ onDuplicatePage: Zi,
1631
+ onRemovePage: $i,
1632
+ onPatchPageFormat: Ji,
1633
+ onScrollToVariable: fo,
1634
+ onScrollToSigningPlacement: mo
1698
1635
  }, null, 8, [
1699
1636
  "collapsed",
1700
1637
  "pages",
1701
1638
  "variables",
1639
+ "decoration-variable-keys",
1702
1640
  "signing-placement-navigation-items",
1703
1641
  "active-page-id",
1704
1642
  "selected-variable-key",
@@ -1713,749 +1651,218 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
1713
1651
  "show-signing-placement-tools",
1714
1652
  "readonly"
1715
1653
  ]),
1716
- h("main", {
1654
+ p("main", {
1717
1655
  ref_key: "workspaceElement",
1718
- ref: Nr,
1656
+ ref: an,
1719
1657
  class: "gd-contract-template-designer__workspace"
1720
1658
  }, [
1721
- h("header", dn, [h("div", fn, [h("strong", null, C($i.value), 1), fe.showDraftCacheStatus && ea.value ? (x(), m("small", {
1659
+ Nt(p("div", {
1660
+ id: ln,
1661
+ class: "gd-contract-template-designer__workspace-chrome"
1662
+ }, [m(ze, {
1663
+ ref_key: "workspaceHeaderElement",
1664
+ ref: on,
1665
+ summary: Dr.value,
1666
+ "draft-cache-status-text": jr.value,
1667
+ "draft-cache-status-class": Mr.value,
1668
+ "show-draft-cache-status": s.showDraftCacheStatus,
1669
+ "show-clear-button": s.showClearButton,
1670
+ "show-submit-data-viewer": s.showSubmitDataViewer,
1671
+ readonly: W.value,
1672
+ "zoom-percent": Nr.value,
1673
+ "zoom-out-disabled": N.value <= Wt,
1674
+ "zoom-in-disabled": N.value >= Gt,
1675
+ "is-fullscreen": P.value,
1676
+ immersive: Fn.value,
1677
+ "page-decorations-open": F.value,
1678
+ "page-decorations-studio-id": cn,
1679
+ "page-decorations-preset-label": Or.value,
1680
+ "page-decorations-enabled-count": Ar.value,
1681
+ "page-decorations-enabled-states": kr.value,
1682
+ "chrome-controls-id": ln,
1683
+ onZoomOut: Za,
1684
+ onZoomIn: Xa,
1685
+ onFitWidth: y(Ua),
1686
+ onResetZoom: Ja,
1687
+ onToggleFullscreen: Qa,
1688
+ onToggleImmersive: no,
1689
+ onClear: lo,
1690
+ onValidate: ko,
1691
+ onPreview: ro,
1692
+ onSubmitData: oo,
1693
+ onTogglePageDecorations: _o,
1694
+ onToggleChrome: os
1695
+ }, null, 8, [
1696
+ "summary",
1697
+ "draft-cache-status-text",
1698
+ "draft-cache-status-class",
1699
+ "show-draft-cache-status",
1700
+ "show-clear-button",
1701
+ "show-submit-data-viewer",
1702
+ "readonly",
1703
+ "zoom-percent",
1704
+ "zoom-out-disabled",
1705
+ "zoom-in-disabled",
1706
+ "is-fullscreen",
1707
+ "immersive",
1708
+ "page-decorations-open",
1709
+ "page-decorations-preset-label",
1710
+ "page-decorations-enabled-count",
1711
+ "page-decorations-enabled-states",
1712
+ "onFitWidth"
1713
+ ]), m(Be, {
1714
+ "variable-insert-popover-open": Vn.value,
1715
+ "onUpdate:variableInsertPopoverOpen": t[2] ||= (e) => Vn.value = e,
1716
+ "image-insert-popover-open": Hn.value,
1717
+ "onUpdate:imageInsertPopoverOpen": t[3] ||= (e) => Hn.value = e,
1718
+ "image-insert-url": Un.value,
1719
+ "onUpdate:imageInsertUrl": t[4] ||= (e) => Un.value = e,
1720
+ "image-insert-width": Wn.value,
1721
+ "onUpdate:imageInsertWidth": t[5] ||= (e) => Wn.value = e,
1722
+ "image-insert-height": Gn.value,
1723
+ "onUpdate:imageInsertHeight": t[6] ||= (e) => Gn.value = e,
1724
+ "table-insert-popover-open": I.value,
1725
+ "onUpdate:tableInsertPopoverOpen": t[7] ||= (e) => I.value = e,
1726
+ "table-actions-popover-open": L.value,
1727
+ "onUpdate:tableActionsPopoverOpen": t[8] ||= (e) => L.value = e,
1728
+ "table-insert-draft": or.value,
1729
+ "onUpdate:tableInsertDraft": t[9] ||= (e) => or.value = e,
1730
+ "toolbar-more-open": Rn.value,
1731
+ "onUpdate:toolbarMoreOpen": t[10] ||= (e) => Rn.value = e,
1732
+ readonly: W.value,
1733
+ "editor-state": pi.value,
1734
+ "current-block-format": mi.value,
1735
+ "block-format-options": Lr,
1736
+ "font-family-select-options": Fr.value,
1737
+ "current-editor-font-family": hi.value,
1738
+ "font-size-preset-options": yi.value,
1739
+ "current-editor-font-size": gi.value,
1740
+ "editor-font-size-search-value": Bn.value,
1741
+ "current-editor-text-color": _i.value,
1742
+ "body-control-tool-items": Gr.value,
1743
+ "page-limit-reached": qr.value,
1744
+ "normalized-max-pages": Kr.value,
1745
+ "image-processing": qn.value,
1746
+ "image-insert-error": Kn.value,
1747
+ onCommand: t[11] ||= (e) => Z(e),
1748
+ onPatchBlockFormat: Ho,
1749
+ onPatchFontFamily: Wo,
1750
+ onPatchFontSize: Uo,
1751
+ onPatchColor: Go,
1752
+ onPatchTextAlign: Vo,
1753
+ onInsertVariable: ma,
1754
+ onOpenImageFile: da,
1755
+ onInsertImageUrl: pa,
1756
+ onAddPage: Xi,
1757
+ onInsertTable: Ss,
1758
+ onTableAction: Os,
1759
+ onFontSizeSearch: qo,
1760
+ onFontSizeCommit: Jo,
1761
+ onFontSizeDropdownChange: Xo,
1762
+ onFontSizeKeydown: Yo
1763
+ }, null, 8, [
1764
+ "variable-insert-popover-open",
1765
+ "image-insert-popover-open",
1766
+ "image-insert-url",
1767
+ "image-insert-width",
1768
+ "image-insert-height",
1769
+ "table-insert-popover-open",
1770
+ "table-actions-popover-open",
1771
+ "table-insert-draft",
1772
+ "toolbar-more-open",
1773
+ "readonly",
1774
+ "editor-state",
1775
+ "current-block-format",
1776
+ "font-family-select-options",
1777
+ "current-editor-font-family",
1778
+ "font-size-preset-options",
1779
+ "current-editor-font-size",
1780
+ "editor-font-size-search-value",
1781
+ "current-editor-text-color",
1782
+ "body-control-tool-items",
1783
+ "page-limit-reached",
1784
+ "normalized-max-pages",
1785
+ "image-processing",
1786
+ "image-insert-error"
1787
+ ])], 512), [[jt, !Pn.value]]),
1788
+ Pn.value ? (_(), xt(y(It), {
1722
1789
  key: 0,
1723
- class: b(["gd-contract-template-designer__draft-cache-status", ta.value])
1724
- }, C(ea.value), 3)) : p("", !0)]), h("div", pn, [h("div", mn, [h("div", hn, [
1725
- _(w(D), { title: "缩小" }, {
1726
- default: T(() => [_(w(E), {
1727
- size: "small",
1728
- class: "gd-contract-template-designer__icon-button",
1729
- disabled: ui.value <= mr,
1730
- "aria-label": "缩小",
1731
- onClick: ws
1732
- }, {
1733
- default: T(() => [_(w(un), { "aria-hidden": "true" })]),
1734
- _: 1
1735
- }, 8, ["disabled"])]),
1736
- _: 1
1737
- }),
1738
- h("span", null, C(na.value), 1),
1739
- _(w(D), { title: "放大" }, {
1740
- default: T(() => [_(w(E), {
1741
- size: "small",
1742
- class: "gd-contract-template-designer__icon-button",
1743
- disabled: ui.value >= hr,
1744
- "aria-label": "放大",
1745
- onClick: Cs
1746
- }, {
1747
- default: T(() => [_(w(ln), { "aria-hidden": "true" })]),
1748
- _: 1
1749
- }, 8, ["disabled"])]),
1750
- _: 1
1751
- }),
1752
- _(w(D), { title: "适应宽度" }, {
1753
- default: T(() => [_(w(E), {
1754
- size: "small",
1755
- class: "gd-contract-template-designer__icon-button",
1756
- "aria-label": "适应宽度",
1757
- onClick: w(_s)
1758
- }, {
1759
- default: T(() => [_(w(zt), { "aria-hidden": "true" })]),
1760
- _: 1
1761
- }, 8, ["onClick"])]),
1762
- _: 1
1763
- }),
1764
- _(w(D), { title: "重置缩放" }, {
1765
- default: T(() => [_(w(E), {
1766
- size: "small",
1767
- class: "gd-contract-template-designer__icon-button",
1768
- "aria-label": "重置缩放",
1769
- onClick: xs
1770
- }, {
1771
- default: T(() => [_(w(nn), { "aria-hidden": "true" })]),
1772
- _: 1
1773
- })]),
1774
- _: 1
1775
- }),
1776
- _(w(D), { title: di.value ? "退出全屏" : "全屏显示" }, {
1777
- default: T(() => [_(w(E), {
1778
- size: "small",
1779
- class: "gd-contract-template-designer__icon-button",
1780
- "aria-label": di.value ? "退出全屏" : "全屏显示",
1781
- onClick: Es
1782
- }, {
1783
- default: T(() => [di.value ? (x(), f(w(Jt), {
1784
- key: 0,
1785
- "aria-hidden": "true"
1786
- })) : (x(), f(w(Yt), {
1787
- key: 1,
1788
- "aria-hidden": "true"
1789
- }))]),
1790
- _: 1
1791
- }, 8, ["aria-label"])]),
1792
- _: 1
1793
- }, 8, ["title"])
1794
- ])]), h("div", gn, [
1795
- fe.showClearButton ? (x(), f(w(D), {
1796
- key: 0,
1797
- title: "清空合同"
1798
- }, {
1799
- default: T(() => [_(w(E), {
1800
- size: "small",
1801
- danger: "",
1802
- class: "gd-contract-template-designer__icon-button",
1803
- disabled: H.value,
1804
- "aria-label": "清空合同",
1805
- onClick: Ns
1806
- }, {
1807
- default: T(() => [_(w(Ht), { "aria-hidden": "true" })]),
1808
- _: 1
1809
- }, 8, ["disabled"])]),
1810
- _: 1
1811
- })) : p("", !0),
1812
- _(w(D), { title: "校验" }, {
1813
- default: T(() => [_(w(E), {
1814
- size: "small",
1815
- class: "gd-contract-template-designer__icon-button",
1816
- "aria-label": "校验",
1817
- onClick: Xs
1818
- }, {
1819
- default: T(() => [_(w(It), { "aria-hidden": "true" })]),
1820
- _: 1
1821
- })]),
1822
- _: 1
1823
- }),
1824
- _(w(D), { title: "预览" }, {
1825
- default: T(() => [_(w(E), {
1826
- size: "small",
1827
- type: "primary",
1828
- class: "gd-contract-template-designer__icon-button",
1829
- "aria-label": "预览",
1830
- onClick: Ds
1831
- }, {
1832
- default: T(() => [_(w(Gt), { "aria-hidden": "true" })]),
1833
- _: 1
1834
- })]),
1835
- _: 1
1836
- }),
1837
- fe.showSubmitDataViewer ? (x(), f(w(D), {
1838
- key: 1,
1839
- title: "数据查看"
1840
- }, {
1841
- default: T(() => [_(w(E), {
1842
- size: "small",
1843
- class: "gd-contract-template-designer__icon-button",
1844
- "aria-label": "数据查看",
1845
- onClick: As
1846
- }, {
1847
- default: T(() => [_(w(Vt), { "aria-hidden": "true" })]),
1848
- _: 1
1849
- })]),
1850
- _: 1
1851
- })) : p("", !0)
1852
- ])])]),
1853
- h("header", _n, [h("div", {
1854
- ref_key: "toolbarMainElement",
1855
- ref: Pr,
1856
- class: "gd-contract-template-designer__toolbar-section gd-contract-template-designer__toolbar-section--main"
1790
+ title: "展开工具区"
1791
+ }, {
1792
+ default: Mt(() => [p("button", {
1793
+ ref_key: "workspaceChromeHandleElement",
1794
+ ref: un,
1795
+ type: "button",
1796
+ class: "gd-contract-template-designer__workspace-chrome-handle",
1797
+ "aria-label": "展开工具区",
1798
+ "aria-expanded": !1,
1799
+ "aria-controls": ln,
1800
+ onClick: os
1801
+ }, [m(y(zt), { "aria-hidden": "true" })], 512)]),
1802
+ _: 1
1803
+ })) : St("", !0),
1804
+ Fn.value && !F.value ? (_(), Ct("button", {
1805
+ key: 1,
1806
+ ref_key: "immersiveExitElement",
1807
+ ref: In,
1808
+ type: "button",
1809
+ class: "gd-contract-template-designer__immersive-exit",
1810
+ "aria-label": "退出沉浸写作",
1811
+ onClick: to
1857
1812
  }, [
1858
- h("div", vn, [_(w(D), { title: "撤销" }, {
1859
- default: T(() => [_(w(E), {
1860
- size: "small",
1861
- class: "gd-contract-template-designer__icon-button",
1862
- disabled: H.value || !G.value.canUndo,
1863
- "aria-label": "撤销",
1864
- onClick: t[2] ||= (e) => J({ type: "undo" })
1865
- }, {
1866
- default: T(() => [_(w(sn), { "aria-hidden": "true" })]),
1867
- _: 1
1868
- }, 8, ["disabled"])]),
1869
- _: 1
1870
- }), _(w(D), { title: "重做" }, {
1871
- default: T(() => [_(w(E), {
1872
- size: "small",
1873
- class: "gd-contract-template-designer__icon-button",
1874
- disabled: H.value || !G.value.canRedo,
1875
- "aria-label": "重做",
1876
- onClick: t[3] ||= (e) => J({ type: "redo" })
1877
- }, {
1878
- default: T(() => [_(w(tn), { "aria-hidden": "true" })]),
1879
- _: 1
1880
- }, 8, ["disabled"])]),
1881
- _: 1
1882
- })]),
1883
- h("div", yn, [_(w(At), {
1884
- value: gi.value,
1885
- "onUpdate:value": t[4] ||= (e) => gi.value = e,
1886
- class: "gd-contract-template-designer__toolbar-select",
1887
- options: aa.value,
1888
- placeholder: "合同样式",
1889
- disabled: H.value,
1890
- onChange: _c
1891
- }, null, 8, [
1892
- "value",
1893
- "options",
1894
- "disabled"
1895
- ]), _(w(At), {
1896
- class: "gd-contract-template-designer__toolbar-select",
1897
- value: xa.value,
1898
- options: sa,
1899
- disabled: H.value,
1900
- onChange: cc
1901
- }, null, 8, ["value", "disabled"])]),
1902
- h("div", bn, [
1903
- _(w(D), { title: "加粗" }, {
1904
- default: T(() => [_(w(E), {
1905
- size: "small",
1906
- class: "gd-contract-template-designer__icon-button",
1907
- type: G.value.isBold ? "primary" : "default",
1908
- disabled: H.value,
1909
- "aria-label": "加粗",
1910
- onClick: t[5] ||= (e) => J({ type: "toggle-bold" })
1911
- }, {
1912
- default: T(() => [_(w(Lt), { "aria-hidden": "true" })]),
1913
- _: 1
1914
- }, 8, ["type", "disabled"])]),
1915
- _: 1
1916
- }),
1917
- _(w(D), { title: "斜体" }, {
1918
- default: T(() => [_(w(E), {
1919
- size: "small",
1920
- class: "gd-contract-template-designer__icon-button",
1921
- type: G.value.isItalic ? "primary" : "default",
1922
- disabled: H.value,
1923
- "aria-label": "斜体",
1924
- onClick: t[6] ||= (e) => J({ type: "toggle-italic" })
1925
- }, {
1926
- default: T(() => [_(w(Xt), { "aria-hidden": "true" })]),
1927
- _: 1
1928
- }, 8, ["type", "disabled"])]),
1929
- _: 1
1930
- }),
1931
- _(w(D), { title: "下划线" }, {
1932
- default: T(() => [_(w(E), {
1933
- size: "small",
1934
- class: "gd-contract-template-designer__icon-button",
1935
- type: G.value.isUnderline ? "primary" : "default",
1936
- disabled: H.value,
1937
- "aria-label": "下划线",
1938
- onClick: t[7] ||= (e) => J({ type: "toggle-underline" })
1939
- }, {
1940
- default: T(() => [_(w(on), { "aria-hidden": "true" })]),
1941
- _: 1
1942
- }, 8, ["type", "disabled"])]),
1943
- _: 1
1944
- }),
1945
- _(w(D), { title: "编号列表" }, {
1946
- default: T(() => [_(w(E), {
1947
- size: "small",
1948
- class: "gd-contract-template-designer__icon-button",
1949
- type: G.value.isOrderedList ? "primary" : "default",
1950
- disabled: H.value,
1951
- "aria-label": "编号列表",
1952
- onClick: t[8] ||= (e) => J({ type: "toggle-ordered-list" })
1953
- }, {
1954
- default: T(() => [_(w(Qt), { "aria-hidden": "true" })]),
1955
- _: 1
1956
- }, 8, ["type", "disabled"])]),
1957
- _: 1
1958
- }),
1959
- _(w(D), { title: "项目列表" }, {
1960
- default: T(() => [_(w(E), {
1961
- size: "small",
1962
- class: "gd-contract-template-designer__icon-button",
1963
- type: G.value.isBulletList ? "primary" : "default",
1964
- disabled: H.value,
1965
- "aria-label": "项目列表",
1966
- onClick: t[9] ||= (e) => J({ type: "toggle-bullet-list" })
1967
- }, {
1968
- default: T(() => [_(w(cn), { "aria-hidden": "true" })]),
1969
- _: 1
1970
- }, 8, ["type", "disabled"])]),
1971
- _: 1
1972
- })
1973
- ]),
1974
- (x(), f(ht, {
1975
- disabled: !ms("insert") || !Ir.value,
1976
- to: Ir.value || "body"
1977
- }, [h("div", xn, [
1978
- _(w(kt), {
1979
- open: bi.value,
1980
- "onUpdate:open": t[10] ||= (e) => bi.value = e,
1981
- trigger: "click",
1982
- placement: "bottom"
1983
- }, {
1984
- content: T(() => [h("div", Sn, [t[62] ||= h("strong", null, "插入正文控件", -1), h("div", Cn, [(x(!0), m(mt, null, yt(ha.value, (e) => (x(), f(w(D), {
1985
- key: e.type,
1986
- title: `插入${e.label}控件`
1987
- }, {
1988
- default: T(() => [h("button", {
1989
- type: "button",
1990
- class: "gd-contract-template-designer__text-menu-control-option",
1991
- "aria-label": `插入${e.label}控件`,
1992
- onClick: (t) => Fo(e.type)
1993
- }, [(x(), f(bt(e.icon), { "aria-hidden": "true" })), h("span", null, C(e.label), 1)], 8, wn)]),
1994
- _: 2
1995
- }, 1032, ["title"]))), 128))])])]),
1996
- default: T(() => [_(w(D), { title: "插入正文控件" }, {
1997
- default: T(() => [_(w(E), {
1998
- size: "small",
1999
- class: "gd-contract-template-designer__icon-button",
2000
- disabled: H.value,
2001
- "aria-label": "插入正文控件"
2002
- }, {
2003
- default: T(() => [_(w(en), { "aria-hidden": "true" })]),
2004
- _: 1
2005
- }, 8, ["disabled"])]),
2006
- _: 1
2007
- })]),
2008
- _: 1
2009
- }, 8, ["open"]),
2010
- _(w(kt), {
2011
- open: xi.value,
2012
- "onUpdate:open": t[14] ||= (e) => xi.value = e,
2013
- trigger: "click",
2014
- placement: "bottom"
2015
- }, {
2016
- content: T(() => [h("div", Tn, [
2017
- t[67] ||= h("strong", null, "插入正文图片", -1),
2018
- _(w(E), {
2019
- block: "",
2020
- loading: Ei.value,
2021
- disabled: H.value,
2022
- onClick: Mo
2023
- }, {
2024
- default: T(() => [_(w($t), { "aria-hidden": "true" }), t[63] ||= g(" 本地图片 ", -1)]),
2025
- _: 1
2026
- }, 8, ["loading", "disabled"]),
2027
- _(w(Et), {
2028
- value: Si.value,
2029
- "onUpdate:value": t[11] ||= (e) => Si.value = e,
2030
- "allow-clear": "",
2031
- disabled: H.value || Ei.value,
2032
- placeholder: "https:// 或 data:image/...",
2033
- "aria-label": "图片 URL",
2034
- onPressEnter: Po
2035
- }, null, 8, ["value", "disabled"]),
2036
- h("div", En, [h("label", null, [t[64] ||= h("span", null, "宽度", -1), _(w(Dt), {
2037
- value: Ci.value,
2038
- "onUpdate:value": t[12] ||= (e) => Ci.value = e,
2039
- min: w(16),
2040
- max: w(Me),
2041
- disabled: H.value || Ei.value,
2042
- placeholder: "自然",
2043
- "aria-label": "图片宽度"
2044
- }, null, 8, [
2045
- "value",
2046
- "min",
2047
- "max",
2048
- "disabled"
2049
- ])]), h("label", null, [t[65] ||= h("span", null, "高度", -1), _(w(Dt), {
2050
- value: wi.value,
2051
- "onUpdate:value": t[13] ||= (e) => wi.value = e,
2052
- min: w(16),
2053
- max: w(Me),
2054
- disabled: H.value || Ei.value,
2055
- placeholder: "自然",
2056
- "aria-label": "图片高度"
2057
- }, null, 8, [
2058
- "value",
2059
- "min",
2060
- "max",
2061
- "disabled"
2062
- ])])]),
2063
- _(w(E), {
2064
- type: "primary",
2065
- block: "",
2066
- disabled: H.value || Ei.value || !Si.value.trim(),
2067
- onClick: Po
2068
- }, {
2069
- default: T(() => [...t[66] ||= [g(" 插入 URL ", -1)]]),
2070
- _: 1
2071
- }, 8, ["disabled"]),
2072
- Ti.value ? (x(), f(w(Tt), {
2073
- key: 0,
2074
- type: "error",
2075
- "show-icon": "",
2076
- message: Ti.value
2077
- }, null, 8, ["message"])) : p("", !0)
2078
- ])]),
2079
- default: T(() => [_(w(D), { title: "插入图片" }, {
2080
- default: T(() => [_(w(E), {
2081
- size: "small",
2082
- class: "gd-contract-template-designer__icon-button",
2083
- disabled: H.value,
2084
- "aria-label": "插入图片"
2085
- }, {
2086
- default: T(() => [_(w($t), { "aria-hidden": "true" })]),
2087
- _: 1
2088
- }, 8, ["disabled"])]),
2089
- _: 1
2090
- })]),
2091
- _: 1
2092
- }, 8, ["open"]),
2093
- _(w(D), { title: "插入分隔线" }, {
2094
- default: T(() => [_(w(E), {
2095
- size: "small",
2096
- class: "gd-contract-template-designer__icon-button",
2097
- disabled: H.value,
2098
- "aria-label": "插入分隔线",
2099
- onClick: t[15] ||= (e) => J({ type: "insert-horizontal-rule" })
2100
- }, {
2101
- default: T(() => [_(w(Zt), { "aria-hidden": "true" })]),
2102
- _: 1
2103
- }, 8, ["disabled"])]),
2104
- _: 1
2105
- }),
2106
- _(w(D), { title: _a.value ? `已达 ${ga.value} 页上限` : "新增页面" }, {
2107
- default: T(() => [_(w(E), {
2108
- size: "small",
2109
- class: "gd-contract-template-designer__icon-button",
2110
- disabled: H.value || _a.value,
2111
- "aria-label": "新增页面",
2112
- onClick: _o
2113
- }, {
2114
- default: T(() => [_(w(Kt), { "aria-hidden": "true" })]),
2115
- _: 1
2116
- }, 8, ["disabled"])]),
2117
- _: 1
2118
- }, 8, ["title"])
2119
- ])], 8, ["disabled", "to"])),
2120
- (x(), f(ht, {
2121
- disabled: !ms("typography") || !Lr.value,
2122
- to: Lr.value || "body"
2123
- }, [h("div", Dn, [
2124
- _(w(At), {
2125
- class: "gd-contract-template-designer__toolbar-select is-wide",
2126
- value: Sa.value,
2127
- options: ia.value,
2128
- disabled: H.value,
2129
- onChange: uc
2130
- }, null, 8, [
2131
- "value",
2132
- "options",
2133
- "disabled"
2134
- ]),
2135
- _(w(At), {
2136
- class: "gd-contract-template-designer__toolbar-select",
2137
- value: Ca.value,
2138
- options: Ea.value,
2139
- "show-search": "",
2140
- "filter-option": !1,
2141
- "search-value": _i.value,
2142
- disabled: H.value,
2143
- onBlur: mc,
2144
- onChange: lc,
2145
- onDropdownVisibleChange: gc,
2146
- onInputKeyDown: hc,
2147
- onSearch: pc
2148
- }, null, 8, [
2149
- "value",
2150
- "options",
2151
- "search-value",
2152
- "disabled"
2153
- ]),
2154
- h("input", {
2155
- class: "gd-contract-template-designer__color",
2156
- type: "color",
2157
- value: wa.value,
2158
- disabled: H.value,
2159
- onInput: dc
2160
- }, null, 40, On),
2161
- _(w(D), { title: "左对齐" }, {
2162
- default: T(() => [_(w(E), {
2163
- size: "small",
2164
- class: b(["gd-contract-template-designer__icon-button", { "is-selected": G.value.textAlign === "left" }]),
2165
- type: G.value.textAlign === "left" ? "primary" : "default",
2166
- disabled: H.value,
2167
- "aria-label": "左对齐",
2168
- onClick: t[16] ||= (e) => sc("left")
2169
- }, {
2170
- default: T(() => [_(w(Pt), { "aria-hidden": "true" })]),
2171
- _: 1
2172
- }, 8, [
2173
- "class",
2174
- "type",
2175
- "disabled"
2176
- ])]),
2177
- _: 1
2178
- }),
2179
- _(w(D), { title: "居中对齐" }, {
2180
- default: T(() => [_(w(E), {
2181
- size: "small",
2182
- class: b(["gd-contract-template-designer__icon-button", { "is-selected": G.value.textAlign === "center" }]),
2183
- type: G.value.textAlign === "center" ? "primary" : "default",
2184
- disabled: H.value,
2185
- "aria-label": "居中对齐",
2186
- onClick: t[17] ||= (e) => sc("center")
2187
- }, {
2188
- default: T(() => [_(w(Nt), { "aria-hidden": "true" })]),
2189
- _: 1
2190
- }, 8, [
2191
- "class",
2192
- "type",
2193
- "disabled"
2194
- ])]),
2195
- _: 1
2196
- }),
2197
- _(w(D), { title: "右对齐" }, {
2198
- default: T(() => [_(w(E), {
2199
- size: "small",
2200
- class: b(["gd-contract-template-designer__icon-button", { "is-selected": G.value.textAlign === "right" }]),
2201
- type: G.value.textAlign === "right" ? "primary" : "default",
2202
- disabled: H.value,
2203
- "aria-label": "右对齐",
2204
- onClick: t[18] ||= (e) => sc("right")
2205
- }, {
2206
- default: T(() => [_(w(Ft), { "aria-hidden": "true" })]),
2207
- _: 1
2208
- }, 8, [
2209
- "class",
2210
- "type",
2211
- "disabled"
2212
- ])]),
2213
- _: 1
2214
- })
2215
- ])], 8, ["disabled", "to"])),
2216
- (x(), f(ht, {
2217
- disabled: !ms("cleanup") || !Rr.value,
2218
- to: Rr.value || "body"
2219
- }, [h("div", kn, [_(w(D), { title: "清文字" }, {
2220
- default: T(() => [_(w(E), {
2221
- size: "small",
2222
- class: "gd-contract-template-designer__icon-button",
2223
- disabled: H.value,
2224
- "aria-label": "清文字",
2225
- onClick: t[19] ||= (e) => J({ type: "clear-text-format" })
2226
- }, {
2227
- default: T(() => [_(w(Rt), { "aria-hidden": "true" })]),
2228
- _: 1
2229
- }, 8, ["disabled"])]),
2230
- _: 1
2231
- }), _(w(D), { title: "清段落" }, {
2232
- default: T(() => [_(w(E), {
2233
- size: "small",
2234
- class: "gd-contract-template-designer__icon-button",
2235
- disabled: H.value,
2236
- "aria-label": "清段落",
2237
- onClick: t[20] ||= (e) => J({ type: "clear-block-format" })
2238
- }, {
2239
- default: T(() => [_(w(qt), { "aria-hidden": "true" })]),
2240
- _: 1
2241
- }, 8, ["disabled"])]),
2242
- _: 1
2243
- })])], 8, ["disabled", "to"])),
2244
- (x(), f(ht, {
2245
- disabled: !ms("table") || !zr.value,
2246
- to: zr.value || "body"
2247
- }, [h("div", An, [_(w(kt), {
2248
- open: vi.value,
2249
- "onUpdate:open": t[24] ||= (e) => vi.value = e,
2250
- trigger: "click",
2251
- placement: "bottom"
2252
- }, {
2253
- content: T(() => [h("div", jn, [
2254
- t[69] ||= h("strong", null, "插入表格", -1),
2255
- _(Be, {
2256
- disabled: H.value,
2257
- onSelect: t[21] ||= (e) => Ac(e.rows, e.cols),
2258
- onClose: t[22] ||= (e) => vi.value = !1
2259
- }, null, 8, ["disabled"]),
2260
- h("label", Mn, [t[68] ||= h("span", null, "表头行", -1), _(w(jt), {
2261
- checked: Ii.value.withHeaderRow,
2262
- "onUpdate:checked": t[23] ||= (e) => Ii.value.withHeaderRow = e,
2263
- disabled: H.value
2264
- }, null, 8, ["checked", "disabled"])])
2265
- ])]),
2266
- default: T(() => [_(w(D), { title: "插入表格" }, {
2267
- default: T(() => [_(w(E), {
2268
- size: "small",
2269
- class: "gd-contract-template-designer__icon-button",
2270
- disabled: H.value,
2271
- "aria-label": "插入表格"
2272
- }, {
2273
- default: T(() => [_(w(an), { "aria-hidden": "true" })]),
2274
- _: 1
2275
- }, 8, ["disabled"])]),
2276
- _: 1
2277
- })]),
2278
- _: 1
2279
- }, 8, ["open"]), _(w(kt), {
2280
- open: yi.value,
2281
- "onUpdate:open": t[34] ||= (e) => yi.value = e,
2282
- trigger: "click",
2283
- placement: "bottom"
2284
- }, {
2285
- content: T(() => [h("div", Nn, [t[79] ||= h("strong", null, "表格操作", -1), h("div", Pn, [
2286
- _(w(E), {
2287
- size: "small",
2288
- disabled: H.value,
2289
- onClick: t[25] ||= (e) => Ic("add-table-row-before")
2290
- }, {
2291
- default: T(() => [...t[70] ||= [g(" 上方插行 ", -1)]]),
2292
- _: 1
2293
- }, 8, ["disabled"]),
2294
- _(w(E), {
2295
- size: "small",
2296
- disabled: H.value,
2297
- onClick: t[26] ||= (e) => Ic("add-table-row-after")
2298
- }, {
2299
- default: T(() => [...t[71] ||= [g(" 下方插行 ", -1)]]),
2300
- _: 1
2301
- }, 8, ["disabled"]),
2302
- _(w(E), {
2303
- size: "small",
2304
- disabled: H.value,
2305
- onClick: t[27] ||= (e) => Ic("add-table-column-before")
2306
- }, {
2307
- default: T(() => [...t[72] ||= [g(" 左侧插列 ", -1)]]),
2308
- _: 1
2309
- }, 8, ["disabled"]),
2310
- _(w(E), {
2311
- size: "small",
2312
- disabled: H.value,
2313
- onClick: t[28] ||= (e) => Ic("add-table-column-after")
2314
- }, {
2315
- default: T(() => [...t[73] ||= [g(" 右侧插列 ", -1)]]),
2316
- _: 1
2317
- }, 8, ["disabled"]),
2318
- _(w(E), {
2319
- size: "small",
2320
- disabled: H.value,
2321
- onClick: t[29] ||= (e) => Ic("delete-table-row")
2322
- }, {
2323
- default: T(() => [...t[74] ||= [g(" 删除当前行 ", -1)]]),
2324
- _: 1
2325
- }, 8, ["disabled"]),
2326
- _(w(E), {
2327
- size: "small",
2328
- disabled: H.value,
2329
- onClick: t[30] ||= (e) => Ic("delete-table-column")
2330
- }, {
2331
- default: T(() => [...t[75] ||= [g(" 删除当前列 ", -1)]]),
2332
- _: 1
2333
- }, 8, ["disabled"]),
2334
- _(w(E), {
2335
- size: "small",
2336
- disabled: H.value,
2337
- onClick: t[31] ||= (e) => Ic("toggle-table-header-row")
2338
- }, {
2339
- default: T(() => [...t[76] ||= [g(" 切换表头行 ", -1)]]),
2340
- _: 1
2341
- }, 8, ["disabled"]),
2342
- _(w(E), {
2343
- size: "small",
2344
- disabled: H.value,
2345
- onClick: t[32] ||= (e) => Ic("toggle-table-header-column")
2346
- }, {
2347
- default: T(() => [...t[77] ||= [g(" 切换表头列 ", -1)]]),
2348
- _: 1
2349
- }, 8, ["disabled"]),
2350
- _(w(E), {
2351
- danger: "",
2352
- size: "small",
2353
- disabled: H.value,
2354
- onClick: t[33] ||= (e) => Ic("delete-table")
2355
- }, {
2356
- default: T(() => [...t[78] ||= [g(" 删除表格 ", -1)]]),
2357
- _: 1
2358
- }, 8, ["disabled"])
2359
- ])])]),
2360
- default: T(() => [_(w(D), { title: "表格操作" }, {
2361
- default: T(() => [_(w(E), {
2362
- size: "small",
2363
- class: "gd-contract-template-designer__icon-button",
2364
- disabled: H.value || !G.value.isTableActive,
2365
- "aria-label": "表格操作"
2366
- }, {
2367
- default: T(() => [_(w(an), { "aria-hidden": "true" })]),
2368
- _: 1
2369
- }, 8, ["disabled"])]),
2370
- _: 1
2371
- })]),
2372
- _: 1
2373
- }, 8, ["open"])])], 8, ["disabled", "to"])),
2374
- Ct(h("div", {
2375
- ref_key: "toolbarMoreElement",
2376
- ref: Fr,
2377
- class: "gd-contract-template-designer__toolbar-more"
2378
- }, [_(w(D), { title: "更多工具" }, {
2379
- default: T(() => [_(w(E), {
2380
- size: "small",
2381
- class: b(["gd-contract-template-designer__icon-button", { "is-selected": mi.value }]),
2382
- "aria-label": "更多工具",
2383
- "aria-haspopup": "true",
2384
- "aria-expanded": mi.value,
2385
- onClick: t[35] ||= wt((e) => mi.value = !mi.value, ["stop"])
2386
- }, {
2387
- default: T(() => [_(w(Wt), { "aria-hidden": "true" })]),
2388
- _: 1
2389
- }, 8, ["class", "aria-expanded"])]),
2390
- _: 1
2391
- }), Ct(h("div", Fn, [
2392
- Ct(h("div", In, [t[80] ||= h("span", { class: "gd-contract-template-designer__toolbar-more-title" }, "插入", -1), h("div", {
2393
- ref_key: "toolbarInsertSlotElement",
2394
- ref: Ir,
2395
- class: "gd-contract-template-designer__toolbar-more-slot"
2396
- }, null, 512)], 512), [[xt, ms("insert")]]),
2397
- Ct(h("div", Ln, [t[81] ||= h("span", { class: "gd-contract-template-designer__toolbar-more-title" }, "文字排版", -1), h("div", {
2398
- ref_key: "toolbarTypographySlotElement",
2399
- ref: Lr,
2400
- class: "gd-contract-template-designer__toolbar-more-slot"
2401
- }, null, 512)], 512), [[xt, ms("typography")]]),
2402
- Ct(h("div", Rn, [t[82] ||= h("span", { class: "gd-contract-template-designer__toolbar-more-title" }, "清除格式", -1), h("div", {
2403
- ref_key: "toolbarCleanupSlotElement",
2404
- ref: Rr,
2405
- class: "gd-contract-template-designer__toolbar-more-slot"
2406
- }, null, 512)], 512), [[xt, ms("cleanup")]]),
2407
- Ct(h("div", zn, [t[83] ||= h("span", { class: "gd-contract-template-designer__toolbar-more-title" }, "表格", -1), h("div", {
2408
- ref_key: "toolbarTableSlotElement",
2409
- ref: zr,
2410
- class: "gd-contract-template-designer__toolbar-more-slot"
2411
- }, null, 512)], 512), [[xt, ms("table")]])
2412
- ], 512), [[xt, mi.value]])], 512), [[xt, ps.value]])
2413
- ], 512)]),
2414
- ei.value ? (x(), m("section", Bn, [_(w(Tt), {
2415
- type: Zi.value ? "success" : "error",
2416
- message: Qi.value,
1813
+ m(y(Rt), { "aria-hidden": "true" }),
1814
+ t[25] ||= p("span", { class: "gd-contract-template-designer__immersive-exit-label" }, "退出沉浸", -1),
1815
+ t[26] ||= p("kbd", null, "Esc", -1)
1816
+ ], 512)) : St("", !0),
1817
+ A.value ? (_(), Ct("section", Bt, [m(y(Pt), {
1818
+ type: Tr.value ? "success" : "error",
1819
+ message: Er.value,
2417
1820
  "show-icon": ""
2418
- }, null, 8, ["type", "message"]), ti.value.length ? (x(), m("div", Vn, [(x(!0), m(mt, null, yt(ti.value, (e) => (x(), m("button", {
1821
+ }, null, 8, ["type", "message"]), j.value.length ? (_(), Ct("div", Vt, [(_(!0), Ct(yt, null, Ot(j.value, (e) => (_(), Ct("button", {
2419
1822
  key: `${e.id}-${e.message}`,
2420
1823
  type: "button",
2421
1824
  class: "gd-contract-template-designer__validation-item",
2422
- onClick: (t) => Zs(e)
2423
- }, [h("span", null, C(e.message), 1), h("small", null, C(e.type === "signing-placement" ? "签署位置" : e.type === "variable" ? "变量" : "字段"), 1)], 8, Hn))), 128))])) : p("", !0)])) : p("", !0),
2424
- h("div", {
1825
+ onClick: (t) => Ao(e)
1826
+ }, [p("span", null, kt(e.message), 1), p("small", null, kt(jo(e)), 1)], 8, Ht))), 128))])) : St("", !0)])) : St("", !0),
1827
+ p("div", {
2425
1828
  ref_key: "canvasElement",
2426
- ref: Mr,
1829
+ ref: rn,
2427
1830
  class: "gd-contract-template-designer__canvas"
2428
- }, [(x(!0), m(mt, null, yt(P.value.pages, (e, n) => (x(), f(Le, {
2429
- key: `${j.value}:${e.id}`,
1831
+ }, [(_(!0), Ct(yt, null, Ot(E.value.pages, (e, n) => (_(), xt(Le, {
1832
+ key: `${C.value}:${e.id}`,
2430
1833
  ref_for: !0,
2431
- ref: (t) => Ga(e.id, t),
1834
+ ref: (t) => Ii(e.id, t),
2432
1835
  page: e,
2433
1836
  "page-index": n,
2434
- "page-size": X(e),
2435
- variables: P.value.variables,
2436
- "selected-variable-key": F.value,
2437
- "signing-placements": l.showSigningPlacementTools ? Ya(e.id) : [],
2438
- "selected-signing-placement-id": I.value,
2439
- active: L.value === e.id,
2440
- readonly: fe.readonly,
2441
- disabled: fe.disabled,
2442
- zoom: ui.value,
2443
- "process-image-file": Ao,
2444
- onPageUpdate: Ja,
2445
- onVariableDrop: Lo,
2446
- onVariableSelect: Ro,
2447
- onSigningPlacementDrop: no,
2448
- onSigningPlacementSelect: Za,
2449
- onSigningPlacementMove: ao,
2450
- onSigningPlacementRemove: co,
2451
- onEditorFocus: t[36] ||= (e) => Rs(e, !1),
2452
- onEditorStateChange: kc,
2453
- onEditorContextMenu: Tc,
2454
- onVariableMoveBlocked: t[37] ||= (e) => Pi.value = "变量只能在当前页内移动,跨页移动尚未支持。"
1837
+ "page-size": Vi(e),
1838
+ "page-decorations": E.value.pageDecorations,
1839
+ "total-pages": E.value.pages.length,
1840
+ variables: E.value.variables,
1841
+ "selected-variable-key": D.value,
1842
+ "signing-placements": l.showSigningPlacementTools ? Hi(e.id) : [],
1843
+ "selected-signing-placement-id": O.value,
1844
+ active: k.value === e.id,
1845
+ readonly: s.readonly,
1846
+ disabled: s.disabled,
1847
+ zoom: N.value,
1848
+ "process-image-file": la,
1849
+ onPageUpdate: Bi,
1850
+ onVariableDrop: ga,
1851
+ onVariableSelect: _a,
1852
+ onSigningPlacementDrop: y(Xr),
1853
+ onSigningPlacementSelect: Wi,
1854
+ onSigningPlacementMove: y($r),
1855
+ onSigningPlacementRemove: y(ni),
1856
+ onEditorFocus: t[12] ||= (e) => ho(e, !1),
1857
+ onEditorStateChange: xs,
1858
+ onEditorContextMenu: is,
1859
+ onVariableMoveBlocked: t[13] ||= (e) => H.value = "变量只能在当前页内移动,跨页移动尚未支持。"
2455
1860
  }, null, 8, [
2456
1861
  "page",
2457
1862
  "page-index",
2458
1863
  "page-size",
1864
+ "page-decorations",
1865
+ "total-pages",
2459
1866
  "variables",
2460
1867
  "selected-variable-key",
2461
1868
  "signing-placements",
@@ -2463,51 +1870,79 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
2463
1870
  "active",
2464
1871
  "readonly",
2465
1872
  "disabled",
2466
- "zoom"
2467
- ]))), 128))], 512)
1873
+ "zoom",
1874
+ "onSigningPlacementDrop",
1875
+ "onSigningPlacementMove",
1876
+ "onSigningPlacementRemove"
1877
+ ]))), 128))], 512),
1878
+ Nt(m(ht, {
1879
+ ref_key: "pageDecorationsStudioElement",
1880
+ ref: sn,
1881
+ id: cn,
1882
+ open: F.value,
1883
+ decorations: E.value.pageDecorations,
1884
+ variables: E.value.variables,
1885
+ "font-family-options": Fr.value,
1886
+ readonly: s.readonly,
1887
+ disabled: s.disabled,
1888
+ "active-tab": Ln.value,
1889
+ "onUpdate:activeTab": t[14] ||= (e) => Ln.value = e,
1890
+ onChange: xa,
1891
+ onClose: vo
1892
+ }, null, 8, [
1893
+ "open",
1894
+ "decorations",
1895
+ "variables",
1896
+ "font-family-options",
1897
+ "readonly",
1898
+ "disabled",
1899
+ "active-tab"
1900
+ ]), [[jt, F.value]])
2468
1901
  ], 512),
2469
- _(dt, {
2470
- collapsed: pi.value,
2471
- readonly: fe.readonly,
2472
- disabled: fe.disabled,
1902
+ m(mt, {
1903
+ collapsed: Nn.value,
1904
+ readonly: s.readonly,
1905
+ disabled: s.disabled,
2473
1906
  "show-signing-placement-tools": l.showSigningPlacementTools,
2474
- "body-control-tool-items": ha.value,
2475
- "signing-placement-tools": pa.value,
2476
- "signing-placements": U.value,
2477
- "selected-signing-placement": qi.value,
2478
- "selected-signing-placement-page-size": Yi.value,
2479
- "selected-variable": Ui.value,
2480
- "current-variable-font-family": Ta.value,
2481
- "font-family-select-options": ia.value,
2482
- "text-align-options": w(oa),
2483
- "border-style-options": ca,
2484
- "object-fit-options": la,
2485
- "selected-variable-width-max": ya.value,
2486
- "selected-variable-height-max": ba.value,
2487
- "min-font-size": xr,
2488
- "max-font-size": Sr,
2489
- "default-multiline-rows": w(3),
2490
- "resolve-signing-placement-type-icon": w(ct),
2491
- "signing-placement-type-labels": w(r),
2492
- onToggle: t[38] ||= (e) => pi.value = !pi.value,
2493
- onVariableDragStart: as,
2494
- onInsertVariable: $o,
2495
- onSigningPlacementDragStart: io,
2496
- onInsertSigningPlacement: ro,
2497
- onPatchSigningPlacement: oo,
2498
- onDuplicateSigningPlacement: t[39] ||= (e) => so(),
2499
- onRemoveSigningPlacement: t[40] ||= (e) => co(),
2500
- onDuplicateVariable: Zo,
2501
- onRemoveVariable: Yo,
2502
- onPatchVariable: Bo,
2503
- onPatchStyle: Wo,
2504
- onPatchMultiline: qo,
2505
- onPatchRows: Jo,
2506
- onPatchFontFamily: Go,
2507
- onPatchFontSize: Ko,
2508
- onPatchTextAlign: Vo,
2509
- onPatchBorderStyle: Ho,
2510
- onPatchObjectFit: Uo
1907
+ "body-control-tool-items": Gr.value,
1908
+ "signing-placement-tools": Ur.value,
1909
+ "signing-placements": K.value,
1910
+ "selected-signing-placement": xr.value,
1911
+ "selected-signing-placement-page-size": Cr.value,
1912
+ "selected-variable": G.value,
1913
+ variables: E.value.variables,
1914
+ "current-variable-font-family": vi.value,
1915
+ "font-family-select-options": Fr.value,
1916
+ "text-align-options": y(Ir),
1917
+ "border-style-options": Rr,
1918
+ "object-fit-options": zr,
1919
+ "selected-variable-width-max": di.value,
1920
+ "selected-variable-height-max": fi.value,
1921
+ "min-font-size": Qt,
1922
+ "max-font-size": $t,
1923
+ "default-multiline-rows": y(3),
1924
+ "resolve-signing-placement-type-icon": y(dt),
1925
+ "signing-placement-type-labels": y(n),
1926
+ onToggle: t[15] ||= (e) => Nn.value = !Nn.value,
1927
+ onVariableDragStart: Ba,
1928
+ onInsertVariable: Pa,
1929
+ onSigningPlacementDragStart: y(Qr),
1930
+ onInsertSigningPlacement: y(Zr),
1931
+ onPatchSigningPlacement: y(ei),
1932
+ onDuplicateSigningPlacement: t[16] ||= (e) => y(ti)(),
1933
+ onRemoveSigningPlacement: t[17] ||= (e) => y(ni)(),
1934
+ onDuplicateVariable: Ma,
1935
+ onRemoveVariable: Aa,
1936
+ onPatchVariable: ya,
1937
+ onRenameVariable: ba,
1938
+ onPatchStyle: Ta,
1939
+ onPatchMultiline: Oa,
1940
+ onPatchRows: ka,
1941
+ onPatchFontFamily: Ea,
1942
+ onPatchFontSize: Da,
1943
+ onPatchTextAlign: Sa,
1944
+ onPatchBorderStyle: Ca,
1945
+ onPatchObjectFit: wa
2511
1946
  }, null, 8, [
2512
1947
  "collapsed",
2513
1948
  "readonly",
@@ -2519,6 +1954,7 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
2519
1954
  "selected-signing-placement",
2520
1955
  "selected-signing-placement-page-size",
2521
1956
  "selected-variable",
1957
+ "variables",
2522
1958
  "current-variable-font-family",
2523
1959
  "font-family-select-options",
2524
1960
  "text-align-options",
@@ -2526,455 +1962,174 @@ var dn = { class: "gd-contract-template-designer__workspace-header" }, fn = { cl
2526
1962
  "selected-variable-height-max",
2527
1963
  "default-multiline-rows",
2528
1964
  "resolve-signing-placement-type-icon",
2529
- "signing-placement-type-labels"
1965
+ "signing-placement-type-labels",
1966
+ "onSigningPlacementDragStart",
1967
+ "onInsertSigningPlacement",
1968
+ "onPatchSigningPlacement"
2530
1969
  ])
2531
1970
  ], 2),
2532
- (x(), f(ht, { to: "body" }, [
2533
- B.value ? (x(), f(ze, {
1971
+ (_(), xt(bt, { to: "body" }, [
1972
+ B.value ? (_(), xt(Re, {
2534
1973
  key: 0,
2535
1974
  ref_key: "tableContextMenuElement",
2536
- ref: Ai,
1975
+ ref: nr,
2537
1976
  capabilities: B.value.capabilities,
2538
1977
  "active-alignment": B.value.activeAlignment,
2539
- style: gt({
1978
+ style: Tt({
2540
1979
  left: `${B.value.x}px`,
2541
1980
  top: `${B.value.y}px`
2542
1981
  }),
2543
- onExecute: Mc,
2544
- onKeydown: Nc
1982
+ onExecute: ws,
1983
+ onKeydown: Ts
2545
1984
  }, null, 8, [
2546
1985
  "capabilities",
2547
1986
  "active-alignment",
2548
1987
  "style"
2549
- ])) : p("", !0),
2550
- V.value ? (x(), m("div", {
1988
+ ])) : St("", !0),
1989
+ V.value ? (_(), xt(Ue, {
2551
1990
  key: 1,
2552
1991
  ref_key: "imageContextMenuElement",
2553
- ref: ji,
2554
- class: "gd-contract-template-designer__context-menu gd-contract-template-designer__image-context-menu",
2555
- style: gt({
2556
- left: `${V.value.x}px`,
2557
- top: `${V.value.y}px`
2558
- }),
2559
- role: "dialog",
2560
- "aria-label": "图片尺寸",
2561
- onKeydown: Fc
2562
- }, [
2563
- t[88] ||= h("div", { class: "gd-contract-template-designer__image-context-title" }, [h("strong", null, "图片尺寸"), h("span", null, "单位:px;留空可恢复自然尺寸")], -1),
2564
- h("div", Un, [h("label", null, [t[84] ||= h("span", null, "宽度", -1), _(w(Dt), {
2565
- value: Mi.value,
2566
- "onUpdate:value": t[41] ||= (e) => Mi.value = e,
2567
- min: w(16),
2568
- max: w(Me),
2569
- disabled: H.value,
2570
- placeholder: "自然",
2571
- "aria-label": "图片宽度"
2572
- }, null, 8, [
2573
- "value",
2574
- "min",
2575
- "max",
2576
- "disabled"
2577
- ])]), h("label", null, [t[85] ||= h("span", null, "高度", -1), _(w(Dt), {
2578
- value: Ni.value,
2579
- "onUpdate:value": t[42] ||= (e) => Ni.value = e,
2580
- min: w(16),
2581
- max: w(Me),
2582
- disabled: H.value,
2583
- placeholder: "自然",
2584
- "aria-label": "图片高度"
2585
- }, null, 8, [
2586
- "value",
2587
- "min",
2588
- "max",
2589
- "disabled"
2590
- ])])]),
2591
- h("div", Wn, [_(w(E), {
2592
- size: "small",
2593
- onClick: wc
2594
- }, {
2595
- default: T(() => [...t[86] ||= [g("恢复自然尺寸", -1)]]),
2596
- _: 1
2597
- }), _(w(E), {
2598
- size: "small",
2599
- type: "primary",
2600
- onClick: Cc
2601
- }, {
2602
- default: T(() => [...t[87] ||= [g("应用", -1)]]),
2603
- _: 1
2604
- })])
2605
- ], 36)) : p("", !0),
2606
- z.value ? (x(), m("div", {
1992
+ ref: rr,
1993
+ width: ir.value,
1994
+ "onUpdate:width": t[18] ||= (e) => ir.value = e,
1995
+ height: ar.value,
1996
+ "onUpdate:height": t[19] ||= (e) => ar.value = e,
1997
+ x: V.value.x,
1998
+ y: V.value.y,
1999
+ readonly: W.value,
2000
+ onRestore: rs,
2001
+ onApply: ns,
2002
+ onKeydown: Ds
2003
+ }, null, 8, [
2004
+ "width",
2005
+ "height",
2006
+ "x",
2007
+ "y",
2008
+ "readonly"
2009
+ ])) : St("", !0),
2010
+ R.value ? (_(), xt(Ve, {
2607
2011
  key: 2,
2608
2012
  ref_key: "textContextMenuElement",
2609
- ref: Di,
2610
- class: "gd-contract-template-designer__context-menu gd-contract-template-designer__text-context-menu",
2611
- style: gt({
2612
- left: `${z.value.x}px`,
2613
- top: `${z.value.y}px`
2614
- }),
2615
- role: "toolbar",
2616
- "aria-label": "正文快捷操作",
2617
- onKeydown: Pc
2618
- }, [
2619
- h("div", Gn, [
2620
- _(w(D), { title: "撤销" }, {
2621
- default: T(() => [_(w(E), {
2622
- size: "small",
2623
- class: "gd-contract-template-designer__text-menu-icon-button",
2624
- disabled: !G.value.canUndo,
2625
- "aria-label": "撤销",
2626
- onClick: t[43] ||= (e) => Y({ type: "undo" })
2627
- }, {
2628
- default: T(() => [_(w(sn), { "aria-hidden": "true" })]),
2629
- _: 1
2630
- }, 8, ["disabled"])]),
2631
- _: 1
2632
- }),
2633
- _(w(D), { title: "重做" }, {
2634
- default: T(() => [_(w(E), {
2635
- size: "small",
2636
- class: "gd-contract-template-designer__text-menu-icon-button",
2637
- disabled: !G.value.canRedo,
2638
- "aria-label": "重做",
2639
- onClick: t[44] ||= (e) => Y({ type: "redo" })
2640
- }, {
2641
- default: T(() => [_(w(tn), { "aria-hidden": "true" })]),
2642
- _: 1
2643
- }, 8, ["disabled"])]),
2644
- _: 1
2645
- }),
2646
- t[89] ||= h("span", {
2647
- class: "gd-contract-template-designer__text-menu-divider",
2648
- "aria-hidden": "true"
2649
- }, null, -1),
2650
- z.value.hasSelection ? (x(), f(w(D), {
2651
- key: 0,
2652
- title: "复制"
2653
- }, {
2654
- default: T(() => [_(w(E), {
2655
- size: "small",
2656
- class: "gd-contract-template-designer__text-menu-icon-button",
2657
- "aria-label": "复制",
2658
- onClick: t[45] ||= (e) => Ka("copy")
2659
- }, {
2660
- default: T(() => [_(w(Bt), { "aria-hidden": "true" })]),
2661
- _: 1
2662
- })]),
2663
- _: 1
2664
- })) : p("", !0),
2665
- z.value.hasSelection ? (x(), f(w(D), {
2666
- key: 1,
2667
- title: "剪切"
2668
- }, {
2669
- default: T(() => [_(w(E), {
2670
- size: "small",
2671
- class: "gd-contract-template-designer__text-menu-icon-button",
2672
- "aria-label": "剪切",
2673
- onClick: t[46] ||= (e) => Ka("cut")
2674
- }, {
2675
- default: T(() => [_(w(rn), { "aria-hidden": "true" })]),
2676
- _: 1
2677
- })]),
2678
- _: 1
2679
- })) : p("", !0),
2680
- _(w(D), { title: "粘贴" }, {
2681
- default: T(() => [_(w(E), {
2682
- size: "small",
2683
- class: "gd-contract-template-designer__text-menu-icon-button",
2684
- "aria-label": "粘贴",
2685
- onClick: t[47] ||= (e) => Ka("paste")
2686
- }, {
2687
- default: T(() => [_(w(Bt), { "aria-hidden": "true" })]),
2688
- _: 1
2689
- })]),
2690
- _: 1
2691
- })
2692
- ]),
2693
- z.value.hasSelection ? p("", !0) : (x(), m("div", Kn, [
2694
- _(w(E), {
2695
- size: "small",
2696
- onClick: Mo
2697
- }, {
2698
- default: T(() => [_(w($t), { "aria-hidden": "true" }), t[90] ||= h("span", null, "图片", -1)]),
2699
- _: 1
2700
- }),
2701
- _(w(E), {
2702
- size: "small",
2703
- onClick: t[48] ||= (e) => Y({
2704
- type: "insert-table",
2705
- options: Ii.value
2706
- })
2707
- }, {
2708
- default: T(() => [_(w(an), { "aria-hidden": "true" }), t[91] ||= h("span", null, "表格", -1)]),
2709
- _: 1
2710
- }),
2711
- _(w(E), {
2712
- size: "small",
2713
- onClick: t[49] ||= (e) => Y({ type: "insert-horizontal-rule" })
2714
- }, {
2715
- default: T(() => [_(w(Zt), { "aria-hidden": "true" }), t[92] ||= h("span", null, "分隔线", -1)]),
2716
- _: 1
2717
- }),
2718
- _(w(E), {
2719
- size: "small",
2720
- disabled: _a.value,
2721
- onClick: Io
2722
- }, {
2723
- default: T(() => [_(w(Kt), { "aria-hidden": "true" }), t[93] ||= h("span", null, "新页面", -1)]),
2724
- _: 1
2725
- }, 8, ["disabled"]),
2726
- _(w(E), {
2727
- size: "small",
2728
- onClick: t[50] ||= (e) => Y({ type: "select-all" })
2729
- }, {
2730
- default: T(() => [...t[94] ||= [h("span", null, "全选正文", -1)]]),
2731
- _: 1
2732
- })
2733
- ])),
2734
- h("div", qn, [
2735
- _(w(At), {
2736
- class: "gd-contract-template-designer__context-menu-field gd-contract-template-designer__text-menu-font-size",
2737
- value: Ca.value,
2738
- options: Ea.value,
2739
- "show-search": "",
2740
- "filter-option": !1,
2741
- "search-value": _i.value,
2742
- onBlur: mc,
2743
- onChange: lc,
2744
- onDropdownVisibleChange: gc,
2745
- onInputKeyDown: hc,
2746
- onSearch: pc
2747
- }, null, 8, [
2748
- "value",
2749
- "options",
2750
- "search-value"
2751
- ]),
2752
- _(w(At), {
2753
- class: "gd-contract-template-designer__context-menu-field gd-contract-template-designer__text-menu-alignment",
2754
- value: G.value.textAlign,
2755
- options: w(oa),
2756
- onChange: sc
2757
- }, null, 8, ["value", "options"]),
2758
- _(w(D), { title: "文字颜色" }, {
2759
- default: T(() => [h("input", {
2760
- class: "gd-contract-template-designer__context-menu-color",
2761
- type: "color",
2762
- "aria-label": "文字颜色",
2763
- value: wa.value,
2764
- onInput: t[51] ||= (e) => fc(e.target.value)
2765
- }, null, 40, Jn)]),
2766
- _: 1
2767
- })
2768
- ]),
2769
- h("div", {
2770
- class: "gd-contract-template-designer__text-menu-control-group",
2771
- role: "group",
2772
- "aria-label": z.value.hasSelection ? "转换为正文控件" : "插入正文控件"
2773
- }, [
2774
- h("div", Xn, [h("strong", null, C(z.value.hasSelection ? "转换为正文控件" : "插入正文控件"), 1), h("span", null, C(z.value.hasSelection ? "替换选中内容" : "在光标处插入"), 1)]),
2775
- h("div", Zn, [(x(!0), m(mt, null, yt(ha.value, (e) => (x(), f(w(D), {
2776
- key: e.type,
2777
- title: z.value.hasSelection ? `转换为${e.label}控件` : `插入${e.label}控件`
2778
- }, {
2779
- default: T(() => [h("button", {
2780
- type: "button",
2781
- class: "gd-contract-template-designer__text-menu-control-option",
2782
- "aria-label": z.value.hasSelection ? `转换为${e.label}控件` : `插入${e.label}控件`,
2783
- onClick: (t) => es(e.type)
2784
- }, [(x(), f(bt(e.icon), { "aria-hidden": "true" })), h("span", null, C(e.label), 1)], 8, Qn)]),
2785
- _: 2
2786
- }, 1032, ["title"]))), 128))]),
2787
- Oi.value ? (x(), m(mt, { key: 1 }, [_(w(Et), {
2788
- value: ki.value,
2789
- "onUpdate:value": t[52] ||= (e) => ki.value = e,
2790
- class: "gd-contract-template-designer__text-menu-bind-search",
2791
- size: "small",
2792
- "allow-clear": "",
2793
- placeholder: "搜索已有控件",
2794
- "aria-label": "搜索已有控件"
2795
- }, null, 8, ["value"]), h("div", er, [(x(!0), m(mt, null, yt(va.value, (e) => (x(), m("button", {
2796
- key: e.id,
2797
- type: "button",
2798
- class: "gd-contract-template-designer__text-menu-bind-item",
2799
- role: "option",
2800
- onClick: (t) => ns(e)
2801
- }, [h("span", nr, C(e.label), 1), h("span", rr, C(rs(e)) + " · " + C(e.key), 1)], 8, tr))), 128)), va.value.length ? p("", !0) : (x(), m("p", ir, " 暂无已有控件 "))])], 64)) : (x(), m("button", {
2802
- key: 0,
2803
- type: "button",
2804
- class: "gd-contract-template-designer__text-menu-bind-toggle",
2805
- disabled: !P.value.variables.length,
2806
- "aria-expanded": !1,
2807
- "aria-label": "绑定已有控件",
2808
- onClick: is
2809
- }, [t[95] ||= h("span", null, "绑定已有", -1), _(w(Ut), { "aria-hidden": "true" })], 8, $n))
2810
- ], 8, Yn),
2811
- h("div", ar, [
2812
- _(w(D), { title: "加粗" }, {
2813
- default: T(() => [_(w(E), {
2814
- size: "small",
2815
- class: b(["gd-contract-template-designer__text-menu-icon-button", { "is-selected": G.value.isBold }]),
2816
- "aria-pressed": G.value.isBold,
2817
- "aria-label": "加粗",
2818
- onClick: t[53] ||= (e) => Y({ type: "toggle-bold" })
2819
- }, {
2820
- default: T(() => [_(w(Lt), { "aria-hidden": "true" })]),
2821
- _: 1
2822
- }, 8, ["class", "aria-pressed"])]),
2823
- _: 1
2824
- }),
2825
- _(w(D), { title: "斜体" }, {
2826
- default: T(() => [_(w(E), {
2827
- size: "small",
2828
- class: b(["gd-contract-template-designer__text-menu-icon-button", { "is-selected": G.value.isItalic }]),
2829
- "aria-pressed": G.value.isItalic,
2830
- "aria-label": "斜体",
2831
- onClick: t[54] ||= (e) => Y({ type: "toggle-italic" })
2832
- }, {
2833
- default: T(() => [_(w(Xt), { "aria-hidden": "true" })]),
2834
- _: 1
2835
- }, 8, ["class", "aria-pressed"])]),
2836
- _: 1
2837
- }),
2838
- _(w(D), { title: "下划线" }, {
2839
- default: T(() => [_(w(E), {
2840
- size: "small",
2841
- class: b(["gd-contract-template-designer__text-menu-icon-button", { "is-selected": G.value.isUnderline }]),
2842
- "aria-pressed": G.value.isUnderline,
2843
- "aria-label": "下划线",
2844
- onClick: t[55] ||= (e) => Y({ type: "toggle-underline" })
2845
- }, {
2846
- default: T(() => [_(w(on), { "aria-hidden": "true" })]),
2847
- _: 1
2848
- }, 8, ["class", "aria-pressed"])]),
2849
- _: 1
2850
- }),
2851
- t[96] ||= h("span", {
2852
- class: "gd-contract-template-designer__text-menu-divider",
2853
- "aria-hidden": "true"
2854
- }, null, -1),
2855
- _(w(D), { title: "有序列表" }, {
2856
- default: T(() => [_(w(E), {
2857
- size: "small",
2858
- class: b(["gd-contract-template-designer__text-menu-icon-button", { "is-selected": G.value.isOrderedList }]),
2859
- "aria-pressed": G.value.isOrderedList,
2860
- "aria-label": "有序列表",
2861
- onClick: t[56] ||= (e) => Y({ type: "toggle-ordered-list" })
2862
- }, {
2863
- default: T(() => [_(w(Qt), { "aria-hidden": "true" })]),
2864
- _: 1
2865
- }, 8, ["class", "aria-pressed"])]),
2866
- _: 1
2867
- }),
2868
- _(w(D), { title: "无序列表" }, {
2869
- default: T(() => [_(w(E), {
2870
- size: "small",
2871
- class: b(["gd-contract-template-designer__text-menu-icon-button", { "is-selected": G.value.isBulletList }]),
2872
- "aria-pressed": G.value.isBulletList,
2873
- "aria-label": "无序列表",
2874
- onClick: t[57] ||= (e) => Y({ type: "toggle-bullet-list" })
2875
- }, {
2876
- default: T(() => [_(w(cn), { "aria-hidden": "true" })]),
2877
- _: 1
2878
- }, 8, ["class", "aria-pressed"])]),
2879
- _: 1
2880
- })
2881
- ]),
2882
- h("div", or, [_(w(D), { title: "清除文字格式" }, {
2883
- default: T(() => [_(w(E), {
2884
- size: "small",
2885
- class: "gd-contract-template-designer__text-menu-clear-action",
2886
- "aria-label": "清除文字格式",
2887
- onClick: t[58] ||= (e) => Y({ type: "clear-text-format" })
2888
- }, {
2889
- default: T(() => [_(w(Rt), { "aria-hidden": "true" }), t[97] ||= h("span", null, "清文字", -1)]),
2890
- _: 1
2891
- })]),
2892
- _: 1
2893
- }), _(w(D), { title: "清除段落格式" }, {
2894
- default: T(() => [_(w(E), {
2895
- size: "small",
2896
- class: "gd-contract-template-designer__text-menu-clear-action",
2897
- "aria-label": "清除段落格式",
2898
- onClick: t[59] ||= (e) => Y({ type: "clear-block-format" })
2899
- }, {
2900
- default: T(() => [_(w(qt), { "aria-hidden": "true" }), t[98] ||= h("span", null, "清段落", -1)]),
2901
- _: 1
2902
- })]),
2903
- _: 1
2904
- })])
2905
- ], 36)) : p("", !0)
2013
+ ref: Jn,
2014
+ "bind-open": er.value,
2015
+ "onUpdate:bindOpen": t[20] ||= (e) => er.value = e,
2016
+ "bind-keyword": tr.value,
2017
+ "onUpdate:bindKeyword": t[21] ||= (e) => tr.value = e,
2018
+ x: R.value.x,
2019
+ y: R.value.y,
2020
+ "has-selection": R.value.hasSelection,
2021
+ "editor-state": pi.value,
2022
+ "font-size-preset-options": yi.value,
2023
+ "current-editor-font-size": gi.value,
2024
+ "editor-font-size-search-value": Bn.value,
2025
+ "text-align-options": y(Ir),
2026
+ "current-editor-text-color": _i.value,
2027
+ "body-control-tool-items": Gr.value,
2028
+ "text-menu-bindable-variables": ui.value,
2029
+ "page-limit-reached": qr.value,
2030
+ "table-insert-draft": or.value,
2031
+ "variables-count": E.value.variables.length,
2032
+ "resolve-bind-variable-type-label": Ra,
2033
+ onCommand: Li,
2034
+ onClipboard: Ri,
2035
+ onOpenImage: da,
2036
+ onAddPage: ha,
2037
+ onInsertVariable: Fa,
2038
+ onBindVariable: La,
2039
+ onOpenBindPanel: za,
2040
+ onKeydown: Es,
2041
+ onPatchFontSize: Uo,
2042
+ onPatchTextAlign: Vo,
2043
+ onPatchColor: Ko,
2044
+ onFontSizeSearch: qo,
2045
+ onFontSizeCommit: Jo,
2046
+ onFontSizeDropdownChange: Xo,
2047
+ onFontSizeKeydown: Yo
2048
+ }, null, 8, [
2049
+ "bind-open",
2050
+ "bind-keyword",
2051
+ "x",
2052
+ "y",
2053
+ "has-selection",
2054
+ "editor-state",
2055
+ "font-size-preset-options",
2056
+ "current-editor-font-size",
2057
+ "editor-font-size-search-value",
2058
+ "text-align-options",
2059
+ "current-editor-text-color",
2060
+ "body-control-tool-items",
2061
+ "text-menu-bindable-variables",
2062
+ "page-limit-reached",
2063
+ "table-insert-draft",
2064
+ "variables-count"
2065
+ ])) : St("", !0),
2066
+ z.value ? (_(), xt(He, {
2067
+ key: 3,
2068
+ ref_key: "textBubbleElement",
2069
+ ref: Yn,
2070
+ x: z.value.x,
2071
+ y: z.value.y,
2072
+ "editor-state": pi.value,
2073
+ "font-size-preset-options": yi.value,
2074
+ "current-editor-font-size": gi.value,
2075
+ "editor-font-size-search-value": Bn.value,
2076
+ "current-editor-text-color": _i.value,
2077
+ "text-align-options": y(Ir),
2078
+ onCommand: Z,
2079
+ onPatchFontSize: Uo,
2080
+ onPatchTextAlign: Vo,
2081
+ onPatchColor: Ko,
2082
+ onFontSizeSearch: qo,
2083
+ onFontSizeCommit: Jo,
2084
+ onFontSizeDropdownChange: Xo,
2085
+ onFontSizeKeydown: Yo,
2086
+ onMore: hs
2087
+ }, null, 8, [
2088
+ "x",
2089
+ "y",
2090
+ "editor-state",
2091
+ "font-size-preset-options",
2092
+ "current-editor-font-size",
2093
+ "editor-font-size-search-value",
2094
+ "current-editor-text-color",
2095
+ "text-align-options"
2096
+ ])) : St("", !0)
2906
2097
  ])),
2907
- h("input", {
2098
+ p("input", {
2908
2099
  ref_key: "imageFileInputElement",
2909
- ref: Br,
2100
+ ref: dn,
2910
2101
  class: "gd-contract-template-designer__hidden-file-input",
2911
2102
  type: "file",
2912
2103
  accept: "image/png,image/jpeg,image/webp,image/gif,image/bmp",
2913
2104
  tabindex: "-1",
2914
2105
  "aria-hidden": "true",
2915
- onChange: No
2106
+ onChange: fa
2916
2107
  }, null, 544),
2917
- h("span", sr, C(Pi.value), 1),
2918
- _(w(Ot), {
2919
- open: ii.value,
2920
- "onUpdate:open": t[60] ||= (e) => ii.value = e,
2921
- title: "模板预览",
2922
- width: "min(1440px, calc(100vw - 32px))",
2923
- centered: "",
2924
- footer: null,
2925
- "wrap-class-name": "gd-contract-template-designer__preview-modal",
2926
- onCancel: Os
2927
- }, {
2928
- default: T(() => [h("div", { class: b(["gd-contract-template-designer__preview", { "is-multi-file": Gi.value.length > 0 }]) }, [Gi.value.length ? (x(), m("div", cr, [h("nav", lr, [t[99] ||= h("span", { class: "gd-contract-template-designer__preview-file-nav-title" }, "合同文件", -1), (x(!0), m(mt, null, yt(Gi.value, (e) => (x(), m("button", {
2929
- key: e.file.id,
2930
- type: "button",
2931
- class: b(["gd-contract-template-designer__preview-file-tab", { "is-active": e.file.id === Ki.value?.file.id }]),
2932
- "aria-current": e.file.id === Ki.value?.file.id ? "page" : void 0,
2933
- onClick: (t) => si.value = e.file.id
2934
- }, [
2935
- _(w(Kt), { "aria-hidden": "true" }),
2936
- h("span", null, C(e.file.name), 1),
2937
- h("small", null, C(e.pages.length) + " 页", 1)
2938
- ], 10, ur))), 128))]), Ki.value ? (x(), m("section", dr, [h("h3", fr, C(Ki.value.file.name), 1), (x(!0), m(mt, null, yt(Ki.value.pages, (e) => (x(), f(Re, {
2939
- key: `${Ki.value.file.id}:${e.page.id}`,
2940
- page: e.page,
2941
- "fallback-page-size": Ki.value.file.template.pageSize,
2942
- "content-html": e.contentHtml,
2943
- "signing-placements": e.signingPlacements
2944
- }, null, 8, [
2945
- "page",
2946
- "fallback-page-size",
2947
- "content-html",
2948
- "signing-placements"
2949
- ]))), 128))])) : p("", !0)])) : (x(!0), m(mt, { key: 1 }, yt(Wi.value, (e) => (x(), f(Re, {
2950
- key: e.page.id,
2951
- page: e.page,
2952
- "fallback-page-size": ai.value?.pageSize ?? w(pe),
2953
- "content-html": e.contentHtml,
2954
- "signing-placements": e.signingPlacements
2955
- }, null, 8, [
2956
- "page",
2957
- "fallback-page-size",
2958
- "content-html",
2959
- "signing-placements"
2960
- ]))), 128))], 2)]),
2961
- _: 1
2962
- }, 8, ["open"]),
2963
- _(w(Ot), {
2964
- open: ci.value,
2965
- "onUpdate:open": t[61] ||= (e) => ci.value = e,
2966
- title: "提交数据查看",
2967
- width: "min(960px, calc(100vw - 48px))",
2968
- centered: "",
2969
- footer: null,
2970
- "wrap-class-name": "gd-contract-template-designer__submit-data-modal",
2971
- onCancel: js
2972
- }, {
2973
- default: T(() => [h("pre", pr, C(li.value), 1)]),
2974
- _: 1
2975
- }, 8, ["open"])
2108
+ p("span", Ut, kt(H.value), 1),
2109
+ m(We, {
2110
+ open: En.value,
2111
+ "onUpdate:open": t[22] ||= (e) => En.value = e,
2112
+ "preview-pages": vr.value,
2113
+ "preview-file-groups": yr.value,
2114
+ "preview-active-group": br.value,
2115
+ "preview-snapshot": Dn.value,
2116
+ onCancel: io,
2117
+ onSelectFile: t[23] ||= (e) => kn.value = e
2118
+ }, null, 8, [
2119
+ "open",
2120
+ "preview-pages",
2121
+ "preview-file-groups",
2122
+ "preview-active-group",
2123
+ "preview-snapshot"
2124
+ ]),
2125
+ m(Ge, {
2126
+ open: An.value,
2127
+ "onUpdate:open": t[24] ||= (e) => An.value = e,
2128
+ json: jn.value,
2129
+ onCancel: so
2130
+ }, null, 8, ["open", "json"])
2976
2131
  ], 6));
2977
2132
  }
2978
2133
  });
2979
2134
  //#endregion
2980
- export { Ar as default };
2135
+ export { tn as default };