@geelato/gl-ui-web-arco 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +55 -0
  2. package/dist/GlPdf-CP236wBj.js +891 -0
  3. package/dist/GlPdf-CP236wBj.js.gz +0 -0
  4. package/dist/gl-ui-web-arco.css +1 -0
  5. package/dist/gl-ui-web-arco.css.gz +0 -0
  6. package/dist/gl-ui-web-arco.js +21 -0
  7. package/dist/gl-ui-web-arco.js.gz +0 -0
  8. package/dist/main-D7ErSddl.js +164000 -0
  9. package/dist/main-D7ErSddl.js.gz +0 -0
  10. package/dist/pdfjs-Cvb5nkrC.js +26706 -0
  11. package/dist/pdfjs-Cvb5nkrC.js.gz +0 -0
  12. package/dist/types/api/SelectOptions.d.ts +41 -0
  13. package/dist/types/components/MetaHelper.d.ts +6 -0
  14. package/dist/types/components/gl-alert/GlAlert.vue.d.ts +27 -0
  15. package/dist/types/components/gl-button/GlButton.vue.d.ts +117 -0
  16. package/dist/types/components/gl-card/index.vue.d.ts +134 -0
  17. package/dist/types/components/gl-checkbox/GlCheckbox.vue.d.ts +19 -0
  18. package/dist/types/components/gl-color/GlColor.vue.d.ts +143 -0
  19. package/dist/types/components/gl-color-clipboard/GlColorClipboard.vue.d.ts +19 -0
  20. package/dist/types/components/gl-color-input/GlColorInput.vue.d.ts +37 -0
  21. package/dist/types/components/gl-comment/GlComment.vue.d.ts +80 -0
  22. package/dist/types/components/gl-comment/comment.vue.d.ts +72 -0
  23. package/dist/types/components/gl-comment/type.d.ts +30 -0
  24. package/dist/types/components/gl-countdown/GlCountdown.vue.d.ts +43 -0
  25. package/dist/types/components/gl-crontab/GlCrontab.vue.d.ts +39 -0
  26. package/dist/types/components/gl-crontab/tabs/day.vue.d.ts +30 -0
  27. package/dist/types/components/gl-crontab/tabs/hour.vue.d.ts +21 -0
  28. package/dist/types/components/gl-crontab/tabs/minute.vue.d.ts +21 -0
  29. package/dist/types/components/gl-crontab/tabs/mixin.d.ts +100 -0
  30. package/dist/types/components/gl-crontab/tabs/month.vue.d.ts +21 -0
  31. package/dist/types/components/gl-crontab/tabs/second.vue.d.ts +21 -0
  32. package/dist/types/components/gl-crontab/tabs/week.vue.d.ts +30 -0
  33. package/dist/types/components/gl-crontab/tabs/year.vue.d.ts +21 -0
  34. package/dist/types/components/gl-descriptions/GlDescriptions.vue.d.ts +36 -0
  35. package/dist/types/components/gl-dict/GlDict.vue.d.ts +444 -0
  36. package/dist/types/components/gl-dict/locale/en-US.d.ts +10 -0
  37. package/dist/types/components/gl-dict/locale/zh-CN.d.ts +10 -0
  38. package/dist/types/components/gl-divider/GlDevider.vue.d.ts +7 -0
  39. package/dist/types/components/gl-drag-verify/GlDragVerify.vue.d.ts +161 -0
  40. package/dist/types/components/gl-dropdown/GlDropdown.vue.d.ts +93 -0
  41. package/dist/types/components/gl-dynamic-select/GlDynamicSelect.vue.d.ts +582 -0
  42. package/dist/types/components/gl-email/GlEmailPreview.vue.d.ts +20 -0
  43. package/dist/types/components/gl-email/GlEmailSelect.vue.d.ts +1364 -0
  44. package/dist/types/components/gl-email/composables/index.d.ts +8 -0
  45. package/dist/types/components/gl-email/composables/useEmailData.d.ts +19 -0
  46. package/dist/types/components/gl-email/composables/useEmailForm.d.ts +57 -0
  47. package/dist/types/components/gl-email/composables/useEmailOperations.d.ts +15 -0
  48. package/dist/types/components/gl-email/composables/useEmailPreview.d.ts +10 -0
  49. package/dist/types/components/gl-email/composables/useEmailSchedule.d.ts +19 -0
  50. package/dist/types/components/gl-email/composables/useEmailValidation.d.ts +8 -0
  51. package/dist/types/components/gl-email/composables/useUserInfo.d.ts +18 -0
  52. package/dist/types/components/gl-email/locale/en-US.d.ts +51 -0
  53. package/dist/types/components/gl-email/locale/zh-CN.d.ts +51 -0
  54. package/dist/types/components/gl-email/types/index.d.ts +51 -0
  55. package/dist/types/components/gl-empty/GlEmpty.vue.d.ts +13 -0
  56. package/dist/types/components/gl-encode/GlEncode.vue.d.ts +152 -0
  57. package/dist/types/components/gl-entity-cascader/GlEntityCascader.vue.d.ts +26 -0
  58. package/dist/types/components/gl-entity-form/GlEntityForm.vue.d.ts +918 -0
  59. package/dist/types/components/gl-entity-form/composables/index.d.ts +16 -0
  60. package/dist/types/components/gl-entity-form/composables/useEmpty.d.ts +9 -0
  61. package/dist/types/components/gl-entity-form/composables/useFormCore.d.ts +560 -0
  62. package/dist/types/components/gl-entity-form/composables/useFormParams.d.ts +30 -0
  63. package/dist/types/components/gl-entity-form/composables/useFormValidation.d.ts +77 -0
  64. package/dist/types/components/gl-entity-table-plus/FilterManager.vue.d.ts +34 -0
  65. package/dist/types/components/gl-entity-table-plus/GlEntityTable.vue.d.ts +2910 -0
  66. package/dist/types/components/gl-entity-table-plus/GlEntityTableEdit.vue.d.ts +1322 -0
  67. package/dist/types/components/gl-entity-table-plus/GlEntityTableToolbar.vue.d.ts +471 -0
  68. package/dist/types/components/gl-entity-table-plus/constants.d.ts +292 -0
  69. package/dist/types/components/gl-entity-table-plus/index.vue.d.ts +3720 -0
  70. package/dist/types/components/gl-entity-table-plus/locale/en-US.d.ts +94 -0
  71. package/dist/types/components/gl-entity-table-plus/locale/zh-CN.d.ts +94 -0
  72. package/dist/types/components/gl-entity-table-plus/querySignature.d.ts +7 -0
  73. package/dist/types/components/gl-entity-table-plus/table.d.ts +137 -0
  74. package/dist/types/components/gl-entity-table-plus/useCellEditing.d.ts +55 -0
  75. package/dist/types/components/gl-entity-table-plus/useColumns.d.ts +20 -0
  76. package/dist/types/components/gl-entity-table-plus/useConvert.d.ts +5 -0
  77. package/dist/types/components/gl-entity-table-plus/useExport.d.ts +43 -0
  78. package/dist/types/components/gl-entity-table-plus/useFilters.d.ts +37 -0
  79. package/dist/types/components/gl-entity-table-plus/useLayout.d.ts +34 -0
  80. package/dist/types/components/gl-entity-table-plus/useMatch.d.ts +22 -0
  81. package/dist/types/components/gl-entity-table-plus/usePushedRecords.d.ts +39 -0
  82. package/dist/types/components/gl-entity-table-plus/useRow.d.ts +8 -0
  83. package/dist/types/components/gl-entity-table-plus/useRowHighlight.d.ts +33 -0
  84. package/dist/types/components/gl-entity-table-plus/useSelectedRecords.d.ts +25 -0
  85. package/dist/types/components/gl-entity-table-plus/useStore.d.ts +119 -0
  86. package/dist/types/components/gl-entity-table-plus/useSummary.d.ts +47 -0
  87. package/dist/types/components/gl-entity-table-plus/useTableDataAnalysis.d.ts +63 -0
  88. package/dist/types/components/gl-entity-table-plus/useTableHeight.d.ts +63 -0
  89. package/dist/types/components/gl-entity-table-plus/views/GlEntityCardView.vue.d.ts +76 -0
  90. package/dist/types/components/gl-entity-table-plus/views/GlEntityGalleryView.vue.d.ts +62 -0
  91. package/dist/types/components/gl-entity-table-plus/views/GlEntityPivotView.vue.d.ts +90 -0
  92. package/dist/types/components/gl-entity-table-plus/views/GlEntityTableStatView.vue.d.ts +127 -0
  93. package/dist/types/components/gl-entity-table-plus/views/GlEntityTableView.vue.d.ts +1150 -0
  94. package/dist/types/components/gl-entity-tree/GlBaseTree.vue.d.ts +944 -0
  95. package/dist/types/components/gl-entity-tree/GlEntityTree.vue.d.ts +1407 -0
  96. package/dist/types/components/gl-entity-tree/types.d.ts +11 -0
  97. package/dist/types/components/gl-flex-layout/GlFlexLayout.vue.d.ts +246 -0
  98. package/dist/types/components/gl-hidden-area/GlHiddenArea.vue.d.ts +109 -0
  99. package/dist/types/components/gl-iconfont-select/GlIconfontSelect.vue.d.ts +58 -0
  100. package/dist/types/components/gl-image/GlImage.vue.d.ts +554 -0
  101. package/dist/types/components/gl-import/GlImport.vue.d.ts +33 -0
  102. package/dist/types/components/gl-inst-runtime/GlInstRuntime.vue.d.ts +119 -0
  103. package/dist/types/components/gl-inst-runtime/GlInstsRuntime.vue.d.ts +100 -0
  104. package/dist/types/components/gl-layout-page/GlLayoutPage.vue.d.ts +224 -0
  105. package/dist/types/components/gl-layout-site/GlLayout.d.ts +24 -0
  106. package/dist/types/components/gl-layout-site/GlLayoutModeCollapse.vue.d.ts +19 -0
  107. package/dist/types/components/gl-layout-site/GlLayoutModeSidebar.vue.d.ts +41 -0
  108. package/dist/types/components/gl-layout-site/GlLayoutModeTopNav.vue.d.ts +19 -0
  109. package/dist/types/components/gl-layout-site/GlLayoutSite.vue.d.ts +26 -0
  110. package/dist/types/components/gl-layout-site/LayoutStore.d.ts +86 -0
  111. package/dist/types/components/gl-layout-site/ThemeSetting.vue.d.ts +19 -0
  112. package/dist/types/components/gl-list/GlList.vue.d.ts +104 -0
  113. package/dist/types/components/gl-metric-comparison-table/GlMetricComparisonTable.vue.d.ts +302 -0
  114. package/dist/types/components/gl-multi-components/GlMultiComponents.vue.d.ts +183 -0
  115. package/dist/types/components/gl-multi-components/locale/en-US.d.ts +5 -0
  116. package/dist/types/components/gl-multi-components/locale/zh-CN.d.ts +5 -0
  117. package/dist/types/components/gl-op-record/GlOpRecord.vue.d.ts +19 -0
  118. package/dist/types/components/gl-org-select/choose.vue.d.ts +124 -0
  119. package/dist/types/components/gl-org-select/index.vue.d.ts +178 -0
  120. package/dist/types/components/gl-org-select/tree.vue.d.ts +125 -0
  121. package/dist/types/components/gl-org-user-select/choose.vue.d.ts +428 -0
  122. package/dist/types/components/gl-org-user-select/index.vue.d.ts +178 -0
  123. package/dist/types/components/gl-org-user-select/list.vue.d.ts +133 -0
  124. package/dist/types/components/gl-page/GlPage.vue.d.ts +372 -0
  125. package/dist/types/components/gl-page-help/GlPageHelp.vue.d.ts +13 -0
  126. package/dist/types/components/gl-page-template/GlPageTemplateFlow.vue.d.ts +197 -0
  127. package/dist/types/components/gl-page-template/GlPageTemplateFlowApprove.vue.d.ts +19 -0
  128. package/dist/types/components/gl-page-template/ItemsManager.d.ts +23 -0
  129. package/dist/types/components/gl-page-template/locale/en-US.d.ts +25 -0
  130. package/dist/types/components/gl-page-template/locale/zh-CN.d.ts +25 -0
  131. package/dist/types/components/gl-page-template/state-wf/StateWFApprove.vue.d.ts +293 -0
  132. package/dist/types/components/gl-page-template/state-wf/StateWFTransfer.vue.d.ts +30 -0
  133. package/dist/types/components/gl-page-template/state-wf/stateWfApi.d.ts +114 -0
  134. package/dist/types/components/gl-pagination/GlPagination.vue.d.ts +19 -0
  135. package/dist/types/components/gl-pdf/GlPdf.vue.d.ts +90 -0
  136. package/dist/types/components/gl-popover/GlPopover.vue.d.ts +138 -0
  137. package/dist/types/components/gl-query/index.vue.d.ts +243 -0
  138. package/dist/types/components/gl-query/query.d.ts +47 -0
  139. package/dist/types/components/gl-rate/GlRate.vue.d.ts +19 -0
  140. package/dist/types/components/gl-ref-page/GlRefPage.vue.d.ts +171 -0
  141. package/dist/types/components/gl-regular-expression/GlRegularExpression.vue.d.ts +134 -0
  142. package/dist/types/components/gl-regular-expression/common.vue.d.ts +248 -0
  143. package/dist/types/components/gl-regular-expression/select.vue.d.ts +352 -0
  144. package/dist/types/components/gl-regular-expression/type.d.ts +17 -0
  145. package/dist/types/components/gl-row-col-layout/GlRowColLayout.vue.d.ts +189 -0
  146. package/dist/types/components/gl-select/GlSelect.vue.d.ts +83 -0
  147. package/dist/types/components/gl-slot/GlSlot.vue.d.ts +105 -0
  148. package/dist/types/components/gl-space/GlSpace.vue.d.ts +121 -0
  149. package/dist/types/components/gl-static-dict/GlStaticDict.vue.d.ts +32 -0
  150. package/dist/types/components/gl-static-dict/list.vue.d.ts +86 -0
  151. package/dist/types/components/gl-static-dict/type.d.ts +4 -0
  152. package/dist/types/components/gl-statistic/GlStatistic.vue.d.ts +65 -0
  153. package/dist/types/components/gl-table-select/GlTableSelect.vue.d.ts +474 -0
  154. package/dist/types/components/gl-table-select/GlTableSelectList.vue.d.ts +87 -0
  155. package/dist/types/components/gl-table-select/index.d.ts +4 -0
  156. package/dist/types/components/gl-tabs/GlDynamicTabs.vue.d.ts +226 -0
  157. package/dist/types/components/gl-tabs/GlTabs.vue.d.ts +152 -0
  158. package/dist/types/components/gl-tag/GlTag.vue.d.ts +122 -0
  159. package/dist/types/components/gl-text/GlText.vue.d.ts +152 -0
  160. package/dist/types/components/gl-textarea/GlTextarea.vue.d.ts +37 -0
  161. package/dist/types/components/gl-timeline/GlTimeline.vue.d.ts +110 -0
  162. package/dist/types/components/gl-timeline/type.d.ts +16 -0
  163. package/dist/types/components/gl-toolbar/index.vue.d.ts +65 -0
  164. package/dist/types/components/gl-toolbar/locale/en-US.d.ts +4 -0
  165. package/dist/types/components/gl-toolbar/locale/zh-CN.d.ts +4 -0
  166. package/dist/types/components/gl-toolbar/toolbar.d.ts +10 -0
  167. package/dist/types/components/gl-tooltip/GlTooltip.vue.d.ts +100 -0
  168. package/dist/types/components/gl-tree-select/GlTreeSelect.vue.d.ts +163 -0
  169. package/dist/types/components/gl-trigger-select/GlTriggerSelect.vue.d.ts +129 -0
  170. package/dist/types/components/gl-upload/GlUpload.vue.d.ts +559 -0
  171. package/dist/types/components/gl-upload/clipboard.vue.d.ts +370 -0
  172. package/dist/types/components/gl-upload/composables/useExternalDropArea.d.ts +11 -0
  173. package/dist/types/components/gl-upload/composables/useFileManager.d.ts +19 -0
  174. package/dist/types/components/gl-upload/locale/en-US.d.ts +10 -0
  175. package/dist/types/components/gl-upload/locale/zh-CN.d.ts +10 -0
  176. package/dist/types/components/gl-user-select/GlUserSelect.vue.d.ts +239 -0
  177. package/dist/types/components/gl-user-select/GlUserSelectInline.vue.d.ts +189 -0
  178. package/dist/types/components/gl-user-select/GlUserSelectPanel.vue.d.ts +97 -0
  179. package/dist/types/components/gl-user-select/GlUserSelectWorkflow.vue.d.ts +186 -0
  180. package/dist/types/components/gl-user-select/locale/en-US.d.ts +32 -0
  181. package/dist/types/components/gl-user-select/locale/zh-CN.d.ts +32 -0
  182. package/dist/types/components/gl-user-select/types.d.ts +62 -0
  183. package/dist/types/components/gl-workflow/GlWorkflowApprove.vue.d.ts +395 -0
  184. package/dist/types/components/gl-workflow/GlWorkflowModal.vue.d.ts +2086 -0
  185. package/dist/types/components/gl-workflow/GlWorkflowStart.vue.d.ts +19 -0
  186. package/dist/types/components/gl-workflow/GlWorkflowStartForm.vue.d.ts +294 -0
  187. package/dist/types/components/gl-workflow/GlWorkflowTasks.vue.d.ts +17 -0
  188. package/dist/types/components/gl-workflow/composables/useWorkflow.d.ts +99 -0
  189. package/dist/types/components/gl-workflow/index.d.ts +1075 -0
  190. package/dist/types/components/gl-workflow/types.d.ts +232 -0
  191. package/dist/types/composables/index.d.ts +3 -0
  192. package/dist/types/composables/useDropdownTriggerProps.d.ts +12 -0
  193. package/dist/types/composables/useStatus.d.ts +17 -0
  194. package/dist/types/composables/useTree.d.ts +31 -0
  195. package/dist/types/hooks/useEntityQuery.d.ts +8 -0
  196. package/dist/types/locale/en-US.d.ts +203 -0
  197. package/dist/types/locale/zh-CN.d.ts +203 -0
  198. package/dist/types/main.d.ts +16 -0
  199. package/dist/types/types/global.d.ts +64 -0
  200. package/package.json +78 -0
  201. package/src/main.ts +231 -0
@@ -0,0 +1,891 @@
1
+ import { defineComponent, ref, watch, onMounted, nextTick, onBeforeUnmount, computed, resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, toDisplayString, createElementVNode, createVNode, withDirectives, createTextVNode, vModelText, withModifiers, toRaw, markRaw } from "vue";
2
+ import { Message } from "@arco-design/web-vue";
3
+ import { useDebounceFn } from "@vueuse/core";
4
+ import { entityApi } from "@geelato/gl-runtime-core";
5
+ import { _ as _export_sfc } from "./main-D7ErSddl.js";
6
+ const _hoisted_1 = {
7
+ key: 0,
8
+ class: "gl-pdf-loading"
9
+ };
10
+ const _hoisted_2 = {
11
+ key: 1,
12
+ class: "gl-pdf-error"
13
+ };
14
+ const _hoisted_3 = {
15
+ key: 2,
16
+ class: "gl-pdf-body"
17
+ };
18
+ const _hoisted_4 = { class: "toolbar-left" };
19
+ const _hoisted_5 = ["disabled"];
20
+ const _hoisted_6 = ["max"];
21
+ const _hoisted_7 = ["disabled"];
22
+ const _hoisted_8 = { class: "toolbar-middle" };
23
+ const _hoisted_9 = { class: "scale-percent" };
24
+ const _hoisted_10 = { class: "toolbar-right" };
25
+ const _hoisted_11 = ["title"];
26
+ const __default__ = {
27
+ name: "GlPdf"
28
+ };
29
+ const _sfc_main = /* @__PURE__ */ defineComponent({
30
+ ...__default__,
31
+ props: {
32
+ // PDF文件的URL
33
+ url: {
34
+ type: String,
35
+ required: false,
36
+ default: ""
37
+ },
38
+ // 页面宽度,支持 '100%'、'200em'、'1024px' 等
39
+ width: {
40
+ type: String,
41
+ default: "800px"
42
+ },
43
+ // 页面高度,支持 '100%'、'200em'、'1024px' 等
44
+ height: {
45
+ type: String,
46
+ default: "600px"
47
+ },
48
+ // 初始页码
49
+ page: {
50
+ type: Number,
51
+ default: 1
52
+ },
53
+ // 缩放比例
54
+ scale: {
55
+ type: Number,
56
+ default: 1
57
+ },
58
+ // 是否显示外边框,默认不显示
59
+ bordered: {
60
+ type: Boolean,
61
+ default: false
62
+ }
63
+ },
64
+ emits: ["load", "error", "page-change"],
65
+ setup(__props, { expose: __expose, emit: __emit }) {
66
+ const props = __props;
67
+ const emits = __emit;
68
+ const loading = ref(false);
69
+ const error = ref(null);
70
+ const pdfInstance = ref(null);
71
+ const currentPage = ref(props.page);
72
+ const totalPages = ref(0);
73
+ const containerRef = ref(null);
74
+ const toolbarRef = ref(null);
75
+ const pdfBlobUrl = ref("");
76
+ const fileNameRef = ref("");
77
+ const scaleRef = ref(props.scale);
78
+ const rotationRef = ref(0);
79
+ const isFullscreen = ref(false);
80
+ const fitMode = ref(null);
81
+ const internalUrl = ref(props.url || "");
82
+ const canvasElements = /* @__PURE__ */ new Set();
83
+ const iframeElements = /* @__PURE__ */ new Set();
84
+ const unwatchFns = [];
85
+ let isComponentUnmounted = false;
86
+ const loadPdfJs = async () => {
87
+ loading.value = true;
88
+ error.value = null;
89
+ try {
90
+ const pdfjsLib = await import("./pdfjs-Cvb5nkrC.js").then((n) => n.p);
91
+ const workerUrl = (await import("./pdfjs-Cvb5nkrC.js").then((n) => n.a)).default;
92
+ pdfjsLib.GlobalWorkerOptions.workerSrc = workerUrl;
93
+ return pdfjsLib;
94
+ } catch (err) {
95
+ error.value = "Failed to load PDF.js library";
96
+ emits("error", err);
97
+ throw err;
98
+ }
99
+ };
100
+ const loadPdfDocument = async (pdfjsLib) => {
101
+ var _a, _b, _c, _d, _e, _f;
102
+ try {
103
+ if (!internalUrl.value) {
104
+ pdfInstance.value = null;
105
+ totalPages.value = 0;
106
+ if (containerRef.value) {
107
+ containerRef.value.innerHTML = "";
108
+ }
109
+ return;
110
+ }
111
+ if (pdfBlobUrl.value) {
112
+ try {
113
+ URL.revokeObjectURL(pdfBlobUrl.value);
114
+ pdfBlobUrl.value = "";
115
+ } catch (_) {
116
+ }
117
+ }
118
+ const authHeaders = ((_b = (_a = entityApi).getHeader) == null ? void 0 : _b.call(_a)) || {};
119
+ const extraHeaders = {};
120
+ try {
121
+ const { searchParams, pathname } = new URL(window.location.href);
122
+ if (pathname && /^\/[a-zA-Z]+\.html$/.test(pathname)) {
123
+ const appId = searchParams.get("appId") || "";
124
+ const tenantCode = searchParams.get("tenantCode") || "";
125
+ if (appId) extraHeaders["App-Id"] = appId;
126
+ if (tenantCode) extraHeaders["Tenant-Code"] = tenantCode;
127
+ }
128
+ } catch (_) {
129
+ }
130
+ const resp = await fetch(internalUrl.value, {
131
+ credentials: "include",
132
+ headers: {
133
+ Accept: "application/pdf,application/octet-stream;q=0.9,*/*;q=0.8",
134
+ ...authHeaders,
135
+ ...extraHeaders
136
+ }
137
+ });
138
+ if (!resp.ok) {
139
+ const msg = `HTTP ${resp.status} ${resp.statusText}`;
140
+ error.value = msg;
141
+ emits("error", new Error(msg));
142
+ return;
143
+ }
144
+ const contentTypeRaw = ((_d = (_c = resp.headers).get) == null ? void 0 : _d.call(_c, "content-type")) || "";
145
+ const contentType = contentTypeRaw.toLowerCase();
146
+ const headersObj = {};
147
+ try {
148
+ resp.headers.forEach((v, k) => {
149
+ headersObj[k] = v;
150
+ });
151
+ } catch (_) {
152
+ }
153
+ let sampleText;
154
+ try {
155
+ const respClone = resp.clone();
156
+ sampleText = await respClone.text();
157
+ } catch (_) {
158
+ sampleText = void 0;
159
+ }
160
+ const buffer = await resp.arrayBuffer();
161
+ const cdHeader = ((_f = (_e = resp.headers).get) == null ? void 0 : _f.call(_e, "content-disposition")) || "";
162
+ const parseContentDispositionFilename = (cd) => {
163
+ try {
164
+ const mStar = cd.match(/filename\*=\s*UTF-8''([^;\r\n]+)/i);
165
+ if (mStar && mStar[1]) return decodeURIComponent(mStar[1].trim());
166
+ const m = cd.match(/filename\s*=\s*"?([^";\r\n]+)"?/i);
167
+ if (m && m[1]) return m[1].trim();
168
+ } catch (_) {
169
+ }
170
+ return "";
171
+ };
172
+ const parseFilenameFromQuery = (u) => {
173
+ try {
174
+ const x = new URL(u, window.location.origin);
175
+ const sp = x.searchParams;
176
+ const val = sp.get("filename") || sp.get("fileName") || sp.get("name");
177
+ return val ? decodeURIComponent(val) : "";
178
+ } catch (_) {
179
+ return "";
180
+ }
181
+ };
182
+ const deriveFileNameFromUrl = (u) => {
183
+ try {
184
+ const x = new URL(u, window.location.origin);
185
+ const segs = x.pathname.split("/").filter(Boolean);
186
+ const last = segs.pop() || "";
187
+ return decodeURIComponent(last || "");
188
+ } catch (_) {
189
+ return "";
190
+ }
191
+ };
192
+ const ensurePdfExt = (name) => {
193
+ if (!name) return "";
194
+ return name.toLowerCase().endsWith(".pdf") ? name : `${name}.pdf`;
195
+ };
196
+ const fromQuery = parseFilenameFromQuery(internalUrl.value);
197
+ const fromCd = parseContentDispositionFilename(cdHeader);
198
+ const fromUrl = deriveFileNameFromUrl(internalUrl.value);
199
+ const picked = ensurePdfExt(fromQuery || fromCd || fromUrl);
200
+ if (picked) fileNameRef.value = picked;
201
+ let isPdfSig = false;
202
+ try {
203
+ const head = new Uint8Array(buffer.slice(0, 5));
204
+ const sig = String.fromCharCode(...head);
205
+ isPdfSig = sig.startsWith("%PDF-");
206
+ } catch (_) {
207
+ }
208
+ if (!isPdfSig || !contentType.includes("application/pdf")) {
209
+ const msg = `非PDF响应或结构无效(content-type: ${contentType || "未知"})`;
210
+ error.value = msg;
211
+ emits("error", {
212
+ type: "non-pdf",
213
+ url: internalUrl.value,
214
+ status: resp.status,
215
+ statusText: resp.statusText,
216
+ contentType,
217
+ headers: headersObj,
218
+ bodyPreview: sampleText ? sampleText.slice(0, 2e3) : void 0
219
+ });
220
+ return;
221
+ }
222
+ const loadingTask = pdfjsLib.getDocument({ data: buffer, disableWorker: true });
223
+ const doc = await loadingTask.promise;
224
+ pdfInstance.value = markRaw(doc);
225
+ try {
226
+ const blob = new Blob([buffer], { type: "application/pdf" });
227
+ pdfBlobUrl.value = URL.createObjectURL(blob);
228
+ } catch (_) {
229
+ pdfBlobUrl.value = "";
230
+ }
231
+ totalPages.value = toRaw(pdfInstance.value).numPages;
232
+ emits("load", { numPages: totalPages.value });
233
+ await nextTick();
234
+ renderPage(currentPage.value);
235
+ } catch (err) {
236
+ error.value = "Failed to load PDF document";
237
+ emits("error", err);
238
+ } finally {
239
+ loading.value = false;
240
+ }
241
+ };
242
+ const renderPage = async (pageNum) => {
243
+ if (!internalUrl.value || !pdfInstance.value || isComponentUnmounted) return;
244
+ if (!containerRef.value) {
245
+ containerRef.value = document.querySelector(".gl-pdf-content");
246
+ }
247
+ if (!containerRef.value) {
248
+ return;
249
+ }
250
+ try {
251
+ const doc = toRaw(pdfInstance.value);
252
+ const page = await doc.getPage(pageNum);
253
+ const viewport = page.getViewport({ scale: scaleRef.value, rotation: rotationRef.value });
254
+ containerRef.value.innerHTML = "";
255
+ const canvas = document.createElement("canvas");
256
+ const context = canvas.getContext("2d");
257
+ if (!context) {
258
+ throw new Error("Failed to get canvas context");
259
+ }
260
+ canvas.height = viewport.height;
261
+ canvas.width = viewport.width;
262
+ canvasElements.add(canvas);
263
+ const pageLayer = document.createElement("div");
264
+ pageLayer.style.position = "relative";
265
+ pageLayer.style.width = `${viewport.width}px`;
266
+ pageLayer.style.height = `${viewport.height}px`;
267
+ canvas.style.width = `${viewport.width}px`;
268
+ canvas.style.height = `${viewport.height}px`;
269
+ canvas.style.position = "absolute";
270
+ canvas.style.left = "0";
271
+ canvas.style.top = "0";
272
+ canvas.style.zIndex = "1";
273
+ const renderContext = {
274
+ canvasContext: context,
275
+ viewport
276
+ };
277
+ const renderTask = page.render(renderContext);
278
+ await renderTask.promise;
279
+ pageLayer.appendChild(canvas);
280
+ containerRef.value.appendChild(pageLayer);
281
+ } catch (err) {
282
+ emits("error", err);
283
+ try {
284
+ if (containerRef.value && pdfBlobUrl.value) {
285
+ containerRef.value.innerHTML = "";
286
+ const iframe = document.createElement("iframe");
287
+ iframe.src = pdfBlobUrl.value;
288
+ iframe.style.width = "100%";
289
+ iframe.style.height = "100%";
290
+ iframe.style.border = "none";
291
+ containerRef.value.appendChild(iframe);
292
+ iframeElements.add(iframe);
293
+ }
294
+ } catch (_) {
295
+ }
296
+ }
297
+ };
298
+ const prevPage = () => {
299
+ if (currentPage.value <= 1) return;
300
+ currentPage.value--;
301
+ renderPage(currentPage.value);
302
+ emits("page-change", currentPage.value);
303
+ };
304
+ const nextPage = () => {
305
+ if (currentPage.value >= totalPages.value) return;
306
+ currentPage.value++;
307
+ renderPage(currentPage.value);
308
+ emits("page-change", currentPage.value);
309
+ };
310
+ const goToPage = (pageNum) => {
311
+ if (pageNum < 1 || pageNum > totalPages.value) return;
312
+ currentPage.value = pageNum;
313
+ renderPage(currentPage.value);
314
+ emits("page-change", currentPage.value);
315
+ };
316
+ const stopWatchUrl = watch(() => props.url, (val) => {
317
+ if (!isComponentUnmounted) {
318
+ internalUrl.value = val || "";
319
+ initPdf();
320
+ }
321
+ });
322
+ unwatchFns.push(stopWatchUrl);
323
+ const stopWatchScale = watch(() => props.scale, () => {
324
+ if (!isComponentUnmounted) {
325
+ scaleRef.value = props.scale;
326
+ renderPage(currentPage.value);
327
+ }
328
+ });
329
+ unwatchFns.push(stopWatchScale);
330
+ const stopWatchCurrentPage = watch(() => currentPage.value, () => {
331
+ if (!isComponentUnmounted) {
332
+ renderPage(currentPage.value);
333
+ }
334
+ });
335
+ unwatchFns.push(stopWatchCurrentPage);
336
+ const stopWatchContainer = watch(containerRef, (el) => {
337
+ if (el && pdfInstance.value && !isComponentUnmounted) {
338
+ renderPage(currentPage.value);
339
+ }
340
+ });
341
+ unwatchFns.push(stopWatchContainer);
342
+ const doInitPdf = async () => {
343
+ try {
344
+ const pdfjsLib = await loadPdfJs();
345
+ try {
346
+ if (pdfInstance.value && typeof pdfInstance.value.destroy === "function") {
347
+ await pdfInstance.value.destroy();
348
+ pdfInstance.value = null;
349
+ }
350
+ } catch (_) {
351
+ }
352
+ await loadPdfDocument(pdfjsLib);
353
+ } catch (err) {
354
+ loading.value = false;
355
+ console.error("Failed to initialize PDF:", err);
356
+ }
357
+ };
358
+ const initPdf = useDebounceFn(doInitPdf, 200);
359
+ let syncToolbarHeightHandler = null;
360
+ onMounted(() => {
361
+ try {
362
+ syncToolbarHeightHandler = () => {
363
+ const el = toolbarRef.value || document.querySelector(".gl-pdf-toolbar");
364
+ const contentEl = containerRef.value || document.querySelector(".gl-pdf-content");
365
+ const h = (el == null ? void 0 : el.offsetHeight) || 50;
366
+ contentEl == null ? void 0 : contentEl.style.setProperty("--gl-pdf-toolbar-h", `${h}px`);
367
+ };
368
+ nextTick(syncToolbarHeightHandler);
369
+ window.addEventListener("resize", syncToolbarHeightHandler);
370
+ } catch (_) {
371
+ }
372
+ initPdf();
373
+ });
374
+ const clearCanvases = () => {
375
+ canvasElements.forEach((canvas) => {
376
+ try {
377
+ const context = canvas.getContext("2d");
378
+ if (context) {
379
+ context.clearRect(0, 0, canvas.width, canvas.height);
380
+ }
381
+ canvas.width = 0;
382
+ canvas.height = 0;
383
+ canvas.remove();
384
+ } catch (e) {
385
+ console.error("清理canvas失败:", e);
386
+ }
387
+ });
388
+ canvasElements.clear();
389
+ };
390
+ const clearIframes = () => {
391
+ iframeElements.forEach((iframe) => {
392
+ try {
393
+ iframe.src = "";
394
+ iframe.remove();
395
+ } catch (e) {
396
+ console.error("清理iframe失败:", e);
397
+ }
398
+ });
399
+ iframeElements.clear();
400
+ };
401
+ onBeforeUnmount(() => {
402
+ isComponentUnmounted = true;
403
+ unwatchFns.forEach((unwatch) => {
404
+ try {
405
+ unwatch();
406
+ } catch (e) {
407
+ console.error("停止watch失败:", e);
408
+ }
409
+ });
410
+ unwatchFns.length = 0;
411
+ if (syncToolbarHeightHandler) {
412
+ try {
413
+ window.removeEventListener("resize", syncToolbarHeightHandler);
414
+ syncToolbarHeightHandler = null;
415
+ } catch (e) {
416
+ console.error("移除resize监听器失败:", e);
417
+ }
418
+ }
419
+ clearCanvases();
420
+ clearIframes();
421
+ if (pdfBlobUrl.value) {
422
+ try {
423
+ URL.revokeObjectURL(pdfBlobUrl.value);
424
+ pdfBlobUrl.value = "";
425
+ } catch (e) {
426
+ console.error("清理Blob URL失败:", e);
427
+ }
428
+ }
429
+ if (pdfInstance.value && typeof pdfInstance.value.destroy === "function") {
430
+ try {
431
+ pdfInstance.value.destroy();
432
+ pdfInstance.value = null;
433
+ } catch (e) {
434
+ console.error("销毁PDF实例失败:", e);
435
+ }
436
+ }
437
+ if (containerRef.value) {
438
+ try {
439
+ containerRef.value.innerHTML = "";
440
+ containerRef.value = null;
441
+ } catch (e) {
442
+ console.error("清空容器失败:", e);
443
+ }
444
+ }
445
+ if (toolbarRef.value) {
446
+ toolbarRef.value = null;
447
+ }
448
+ });
449
+ const printPdf = async () => {
450
+ try {
451
+ const sanitizeTitle = (s) => (s || "").replace(/[<>&]/g, " ").slice(0, 200);
452
+ const ensureSuffixPdf = (s) => {
453
+ const t = (s || "").trim();
454
+ if (!t) return "document.pdf";
455
+ return t.toLowerCase().endsWith(".pdf") ? t : `${t}.pdf`;
456
+ };
457
+ const computePrintTitle = () => {
458
+ const fromState = fileNameRef.value && fileNameRef.value.trim();
459
+ const fromHostQuery = (() => {
460
+ try {
461
+ const sp = new URL(window.location.href).searchParams;
462
+ const v = sp.get("filename") || sp.get("fileName") || sp.get("name");
463
+ return v ? decodeURIComponent(v) : "";
464
+ } catch (_) {
465
+ return "";
466
+ }
467
+ })();
468
+ const fromUrl = (() => {
469
+ try {
470
+ const x = new URL(internalUrl.value, window.location.origin);
471
+ const segs = x.pathname.split("/").filter(Boolean);
472
+ const last = segs.pop() || "";
473
+ return last ? decodeURIComponent(last) : "";
474
+ } catch (_) {
475
+ return "";
476
+ }
477
+ })();
478
+ const nameBase = fromState || fromHostQuery || fromUrl || "document";
479
+ const name = ensureSuffixPdf(nameBase);
480
+ return sanitizeTitle(name);
481
+ };
482
+ let url = pdfBlobUrl.value;
483
+ if (!url && internalUrl.value) {
484
+ const resp = await fetch(internalUrl.value, { credentials: "include" });
485
+ if (resp.ok) {
486
+ const buf = await resp.arrayBuffer();
487
+ url = URL.createObjectURL(new Blob([buf], { type: "application/pdf" }));
488
+ }
489
+ }
490
+ if (!url) {
491
+ Message.error("无法获取可打印的 PDF 内容");
492
+ return;
493
+ }
494
+ const tryPrintInNewWindow = async () => {
495
+ return new Promise((resolve) => {
496
+ let w = null;
497
+ try {
498
+ w = window.open("", "_blank");
499
+ } catch (_) {
500
+ }
501
+ if (!w) {
502
+ resolve(false);
503
+ return;
504
+ }
505
+ try {
506
+ const title = computePrintTitle();
507
+ w.document.write("<html><head><title>" + title + '</title><style>@page{size:auto;margin:10mm;}body{margin:0;padding:0;}</style></head><body><iframe id="pdfFrame" style="position:fixed;left:-10000px;width:1px;height:1px;border:0;" aria-hidden="true"></iframe></body></html>');
508
+ w.document.close();
509
+ const frame = w.document.getElementById("pdfFrame");
510
+ if (frame) {
511
+ frame.src = url;
512
+ frame.onload = () => {
513
+ try {
514
+ w == null ? void 0 : w.focus();
515
+ w == null ? void 0 : w.print();
516
+ } catch (_) {
517
+ }
518
+ setTimeout(() => {
519
+ try {
520
+ w == null ? void 0 : w.close();
521
+ } catch (_) {
522
+ }
523
+ ;
524
+ resolve(true);
525
+ }, 800);
526
+ };
527
+ } else {
528
+ setTimeout(() => {
529
+ try {
530
+ w == null ? void 0 : w.focus();
531
+ w == null ? void 0 : w.print();
532
+ } catch (_) {
533
+ }
534
+ ;
535
+ resolve(true);
536
+ }, 600);
537
+ }
538
+ } catch (_) {
539
+ resolve(false);
540
+ }
541
+ });
542
+ };
543
+ const tryPrintInHiddenIframe = async () => {
544
+ return new Promise((resolve) => {
545
+ const iframe = document.createElement("iframe");
546
+ iframe.style.position = "fixed";
547
+ iframe.style.right = "-10000px";
548
+ iframe.style.bottom = "0";
549
+ iframe.style.width = "1px";
550
+ iframe.style.height = "1px";
551
+ iframe.style.opacity = "0.01";
552
+ iframe.style.border = "0";
553
+ iframe.setAttribute("aria-hidden", "true");
554
+ iframe.name = `gl-pdf-print-${Date.now()}`;
555
+ iframe.src = url;
556
+ document.body.appendChild(iframe);
557
+ const cleanup = () => {
558
+ try {
559
+ document.body.removeChild(iframe);
560
+ } catch (_) {
561
+ }
562
+ };
563
+ let doneTimer = null;
564
+ let settled = false;
565
+ const done = () => {
566
+ var _a, _b;
567
+ if (settled) return;
568
+ settled = true;
569
+ if (doneTimer) {
570
+ clearTimeout(doneTimer);
571
+ doneTimer = null;
572
+ }
573
+ iframe.onload = null;
574
+ try {
575
+ (_a = iframe.contentWindow) == null ? void 0 : _a.focus();
576
+ (_b = iframe.contentWindow) == null ? void 0 : _b.print();
577
+ } catch (_) {
578
+ }
579
+ setTimeout(() => {
580
+ cleanup();
581
+ resolve(true);
582
+ }, 1e3);
583
+ };
584
+ iframe.onload = done;
585
+ doneTimer = window.setTimeout(done, 800);
586
+ });
587
+ };
588
+ const tryImagePrint = async () => {
589
+ try {
590
+ const rawDoc = toRaw(pdfInstance.value);
591
+ if (rawDoc && typeof rawDoc.getPage === "function") {
592
+ const w = window.open("", "_blank");
593
+ if (!w) return false;
594
+ const title = computePrintTitle();
595
+ w.document.write("<html><head><title>" + title + "</title><style>@page{size:auto;margin:10mm;}body{margin:0;padding:0;}img{display:block;width:100%;page-break-after:always;}</style></head><body></body></html>");
596
+ const body = w.document.body;
597
+ let mq = null;
598
+ let changeHandler = null;
599
+ const cleanupMq = () => {
600
+ if (!mq || !changeHandler) return;
601
+ try {
602
+ if (mq.removeEventListener) mq.removeEventListener("change", changeHandler);
603
+ else if (mq.removeListener) mq.removeListener(changeHandler);
604
+ } catch (_) {
605
+ }
606
+ mq = null;
607
+ changeHandler = null;
608
+ };
609
+ const closeWin = () => {
610
+ cleanupMq();
611
+ try {
612
+ w.close();
613
+ } catch (_) {
614
+ }
615
+ };
616
+ let printed = false;
617
+ w.onafterprint = () => {
618
+ printed = true;
619
+ closeWin();
620
+ };
621
+ try {
622
+ mq = w.matchMedia && w.matchMedia("print");
623
+ changeHandler = (e) => {
624
+ if (!e.matches) setTimeout(closeWin, 100);
625
+ };
626
+ if (mq == null ? void 0 : mq.addEventListener) mq.addEventListener("change", changeHandler);
627
+ else if (mq == null ? void 0 : mq.addListener) mq.addListener(changeHandler);
628
+ } catch (_) {
629
+ }
630
+ ;
631
+ w.onfocus = () => {
632
+ if (printed) setTimeout(closeWin, 150);
633
+ };
634
+ const numPages = rawDoc.numPages || 1;
635
+ const baseScale = Math.min(2, Math.max(1, scaleRef.value));
636
+ const printScale = Math.min(2, Math.max(1, baseScale * (window.devicePixelRatio || 1)));
637
+ const imgPromises = [];
638
+ for (let i = 1; i <= numPages; i++) {
639
+ const page = await rawDoc.getPage(i);
640
+ const viewport = page.getViewport({ scale: printScale, rotation: rotationRef.value });
641
+ const canvas = document.createElement("canvas");
642
+ const ctx = canvas.getContext("2d");
643
+ if (!ctx) continue;
644
+ canvas.width = viewport.width;
645
+ canvas.height = viewport.height;
646
+ const renderTask = page.render({ canvasContext: ctx, viewport });
647
+ await renderTask.promise;
648
+ const img = w.document.createElement("img");
649
+ img.src = canvas.toDataURL("image/png");
650
+ body.appendChild(img);
651
+ imgPromises.push(new Promise((resolve) => {
652
+ if (img.complete) resolve();
653
+ else img.onload = () => resolve();
654
+ }));
655
+ }
656
+ await Promise.all(imgPromises);
657
+ try {
658
+ w.document.close();
659
+ } catch (_) {
660
+ }
661
+ try {
662
+ w.focus();
663
+ w.print();
664
+ } catch (_) {
665
+ }
666
+ return true;
667
+ }
668
+ } catch (_) {
669
+ }
670
+ return false;
671
+ };
672
+ const ok = await tryImagePrint() || await tryPrintInNewWindow() || await tryPrintInHiddenIframe();
673
+ if (!ok) {
674
+ Message.error("未能触发打印,请检查浏览器弹窗与打印权限");
675
+ }
676
+ try {
677
+ URL.revokeObjectURL(url);
678
+ } catch (_) {
679
+ }
680
+ } catch (e) {
681
+ console.error(e);
682
+ Message.error("打印失败,请稍后重试");
683
+ }
684
+ };
685
+ const rotateClockwise = () => {
686
+ rotationRef.value = (rotationRef.value + 90) % 360;
687
+ renderPage(currentPage.value);
688
+ };
689
+ const toggleFullscreen = async () => {
690
+ var _a, _b;
691
+ try {
692
+ const el = document.querySelector(".gl-pdf-container") || containerRef.value;
693
+ if (!document.fullscreenElement) {
694
+ await ((_a = el == null ? void 0 : el.requestFullscreen) == null ? void 0 : _a.call(el));
695
+ isFullscreen.value = true;
696
+ } else {
697
+ await ((_b = document.exitFullscreen) == null ? void 0 : _b.call(document));
698
+ isFullscreen.value = false;
699
+ }
700
+ } catch (_) {
701
+ }
702
+ };
703
+ const renderDebounced = useDebounceFn(() => {
704
+ renderPage(currentPage.value);
705
+ }, 50);
706
+ const onWheelZoom = (e) => {
707
+ e.preventDefault();
708
+ const step = 0.1;
709
+ if (e.deltaY > 0) {
710
+ scaleRef.value = Math.max(0.1, +(scaleRef.value - step).toFixed(2));
711
+ } else {
712
+ scaleRef.value = Math.min(4, +(scaleRef.value + step).toFixed(2));
713
+ }
714
+ fitMode.value = null;
715
+ renderDebounced();
716
+ };
717
+ const computeScaleToFit = async (mode) => {
718
+ if (!pdfInstance.value || !containerRef.value) return;
719
+ try {
720
+ const doc = toRaw(pdfInstance.value);
721
+ const page = await doc.getPage(currentPage.value);
722
+ const base = page.getViewport({ scale: 1, rotation: rotationRef.value });
723
+ const containerEl = containerRef.value;
724
+ const cw = containerEl.clientWidth;
725
+ let ch = containerEl.clientHeight;
726
+ if (!ch || ch === 0) {
727
+ const rect = containerEl.getBoundingClientRect();
728
+ ch = Math.max(0, Math.floor(rect.height));
729
+ }
730
+ const scaleW = cw / base.width;
731
+ const scaleH = ch / base.height;
732
+ const nextScale = mode === "width" ? scaleW : Math.min(scaleW, scaleH);
733
+ scaleRef.value = Math.max(0.1, Math.min(4, +nextScale.toFixed(3)));
734
+ fitMode.value = mode;
735
+ await nextTick();
736
+ renderPage(currentPage.value);
737
+ } catch (_) {
738
+ }
739
+ };
740
+ const applyFitWidth = () => {
741
+ computeScaleToFit("width");
742
+ };
743
+ const applyFitPage = () => {
744
+ computeScaleToFit("page");
745
+ };
746
+ const setPdf = (params) => {
747
+ if (!params || typeof params !== "object") return;
748
+ const nextUrl = params.url || "";
749
+ const nextPage2 = typeof params.page === "number" ? params.page : props.page;
750
+ internalUrl.value = nextUrl;
751
+ currentPage.value = nextPage2;
752
+ initPdf();
753
+ };
754
+ const setUrl = (url) => {
755
+ internalUrl.value = url || "";
756
+ currentPage.value = props.page;
757
+ initPdf();
758
+ };
759
+ const scalePercent = computed(() => `${Math.round(scaleRef.value * 100)}%`);
760
+ __expose({
761
+ prevPage,
762
+ nextPage,
763
+ goToPage,
764
+ setPdf,
765
+ setUrl
766
+ });
767
+ return (_ctx, _cache) => {
768
+ const _component_gl_iconfont = resolveComponent("gl-iconfont");
769
+ return openBlock(), createElementBlock("div", {
770
+ class: normalizeClass(["gl-pdf-container", { "gl-pdf-bordered": props.bordered }]),
771
+ style: normalizeStyle({ width: __props.width, height: __props.height })
772
+ }, [
773
+ loading.value ? (openBlock(), createElementBlock("div", _hoisted_1, " Loading PDF... ")) : error.value ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(error.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3, [
774
+ createElementVNode("div", {
775
+ class: "gl-pdf-toolbar",
776
+ ref_key: "toolbarRef",
777
+ ref: toolbarRef
778
+ }, [
779
+ createElementVNode("div", _hoisted_4, [
780
+ createElementVNode("button", {
781
+ class: "icon-btn",
782
+ title: "打印",
783
+ onClick: printPdf
784
+ }, [
785
+ createVNode(_component_gl_iconfont, {
786
+ type: "gl-print",
787
+ class: "gl-toolbar-icon"
788
+ })
789
+ ]),
790
+ createElementVNode("button", {
791
+ onClick: prevPage,
792
+ disabled: currentPage.value <= 1
793
+ }, "上一页", 8, _hoisted_5),
794
+ createElementVNode("span", null, [
795
+ withDirectives(createElementVNode("input", {
796
+ type: "number",
797
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentPage.value = $event),
798
+ min: 1,
799
+ max: totalPages.value,
800
+ onChange: _cache[1] || (_cache[1] = ($event) => goToPage(currentPage.value))
801
+ }, null, 40, _hoisted_6), [
802
+ [
803
+ vModelText,
804
+ currentPage.value,
805
+ void 0,
806
+ { number: true }
807
+ ]
808
+ ]),
809
+ createTextVNode(" / " + toDisplayString(totalPages.value), 1)
810
+ ]),
811
+ createElementVNode("button", {
812
+ onClick: nextPage,
813
+ disabled: currentPage.value >= totalPages.value
814
+ }, "下一页", 8, _hoisted_7)
815
+ ]),
816
+ createElementVNode("div", _hoisted_8, [
817
+ createElementVNode("button", {
818
+ onClick: _cache[2] || (_cache[2] = ($event) => {
819
+ scaleRef.value = Math.max(0.1, +(scaleRef.value - 0.1).toFixed(2));
820
+ renderPage(currentPage.value);
821
+ })
822
+ }, "-"),
823
+ createElementVNode("button", {
824
+ onClick: _cache[3] || (_cache[3] = ($event) => {
825
+ scaleRef.value = Math.min(4, +(scaleRef.value + 0.1).toFixed(2));
826
+ renderPage(currentPage.value);
827
+ })
828
+ }, "+"),
829
+ createElementVNode("span", _hoisted_9, toDisplayString(scalePercent.value), 1),
830
+ _cache[4] || (_cache[4] = createElementVNode("span", { class: "gl-pdf-toolbar-divider" }, null, -1)),
831
+ fitMode.value !== "width" ? (openBlock(), createElementBlock("button", {
832
+ key: 0,
833
+ class: "icon-btn",
834
+ title: "适应宽度",
835
+ onClick: applyFitWidth
836
+ }, [
837
+ createVNode(_component_gl_iconfont, {
838
+ type: "gl-adapt-width",
839
+ class: "gl-toolbar-icon"
840
+ })
841
+ ])) : (openBlock(), createElementBlock("button", {
842
+ key: 1,
843
+ class: "icon-btn",
844
+ title: "适应页面",
845
+ onClick: applyFitPage
846
+ }, [
847
+ createVNode(_component_gl_iconfont, {
848
+ type: "gl-adapt-page",
849
+ class: "gl-toolbar-icon"
850
+ })
851
+ ])),
852
+ createElementVNode("button", {
853
+ class: "icon-btn",
854
+ title: "旋转",
855
+ onClick: rotateClockwise
856
+ }, [
857
+ createVNode(_component_gl_iconfont, {
858
+ type: "gl-sync",
859
+ class: "gl-toolbar-icon"
860
+ })
861
+ ])
862
+ ]),
863
+ createElementVNode("div", _hoisted_10, [
864
+ createElementVNode("button", {
865
+ class: "icon-btn",
866
+ title: isFullscreen.value ? "退出最大化" : "最大化",
867
+ onClick: toggleFullscreen
868
+ }, [
869
+ createVNode(_component_gl_iconfont, {
870
+ type: isFullscreen.value ? "gl-fullscreen-exit" : "gl-fullscreen",
871
+ class: "gl-toolbar-icon"
872
+ }, null, 8, ["type"])
873
+ ], 8, _hoisted_11)
874
+ ])
875
+ ], 512),
876
+ createElementVNode("div", {
877
+ ref_key: "containerRef",
878
+ ref: containerRef,
879
+ class: "gl-pdf-content",
880
+ onWheel: withModifiers(onWheelZoom, ["prevent"]),
881
+ tabindex: "0"
882
+ }, null, 544)
883
+ ]))
884
+ ], 6);
885
+ };
886
+ }
887
+ });
888
+ const GlPdf = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8114b4d0"]]);
889
+ export {
890
+ GlPdf as default
891
+ };