@koi-br/ocr-web-sdk 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koi-br/ocr-web-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "一个支持多种Office文件格式预览的Vue3组件SDK,包括PDF、Word、Excel、图片、OFD、TIF等格式",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -306,7 +306,7 @@ import {
306
306
  Button as AButton,
307
307
  Tooltip as ATooltip,
308
308
  Dropdown as ADropdown,
309
- Option as ADoption,
309
+ Doption as ADoption,
310
310
  } from "@arco-design/web-vue";
311
311
 
312
312
  // 定义组件名称
@@ -8,10 +8,9 @@
8
8
  <p class="preview-loading-title">正在加载文档...</p>
9
9
  </div>
10
10
  <!-- 工具栏 -->
11
- <div class="preview-toolbar preview-toolbar-right">
11
+ <div class="preview-toolbar preview-toolbar-right" v-if="isDownload">
12
12
  <div class="toolbar-group">
13
13
  <ATooltip
14
- v-if="isDownload"
15
14
  mini
16
15
  position="bottom"
17
16
  content="下载"
@@ -213,5 +212,6 @@ defineExpose({
213
212
  // 样式已统一到公共样式文件,这里只保留组件特定样式
214
213
  :deep(.docx-wrapper) {
215
214
  background-color: #fff;
215
+ padding: 0px;
216
216
  }
217
217
  </style>
package/preview/index.vue CHANGED
@@ -28,6 +28,7 @@
28
28
  ref="pdfPreviewRef"
29
29
  :pdf-url="fileUrl"
30
30
  :is-download="props.isDownload"
31
+ v-bind="props.pdfProps || {}"
31
32
  @download="handleDownload"
32
33
  />
33
34
 
@@ -38,6 +39,7 @@
38
39
  :url="fileUrl"
39
40
  :original-id="originalId"
40
41
  :is-download="props.isDownload"
42
+ v-bind="props.imageProps || {}"
41
43
  @original="handleOriginal"
42
44
  @download="handleDownload"
43
45
  />
@@ -48,6 +50,7 @@
48
50
  ref="tifPreviewRe"
49
51
  :url="fileUrl"
50
52
  :is-download="props.isDownload"
53
+ v-bind="props.tifProps || {}"
51
54
  @download="handleDownload"
52
55
  />
53
56
 
@@ -57,6 +60,7 @@
57
60
  ref="docxPreviewRef"
58
61
  :url="fileUrl"
59
62
  :is-download="props.isDownload"
63
+ v-bind="props.docxProps || {}"
60
64
  @download="handleDownload"
61
65
  />
62
66
 
@@ -66,6 +70,7 @@
66
70
  ref="ofdPreviewRef"
67
71
  :url="fileUrl"
68
72
  :is-download="props.isDownload"
73
+ v-bind="props.ofdProps || {}"
69
74
  @download="handleDownload"
70
75
  />
71
76
 
@@ -75,6 +80,7 @@
75
80
  ref="xlsxPreviewRef"
76
81
  :url="fileUrl"
77
82
  :is-download="props.isDownload"
83
+ v-bind="props.xlsxProps || {}"
78
84
  @download="handleDownload"
79
85
  />
80
86
 
@@ -107,6 +113,36 @@ const props = defineProps({
107
113
  isDownload: {
108
114
  type: Boolean,
109
115
  default: false
116
+ },
117
+ // PDF 预览组件的 props
118
+ pdfProps: {
119
+ type: Object,
120
+ default: () => ({})
121
+ },
122
+ // 图片预览组件的 props
123
+ imageProps: {
124
+ type: Object,
125
+ default: () => ({})
126
+ },
127
+ // TIF 预览组件的 props
128
+ tifProps: {
129
+ type: Object,
130
+ default: () => ({})
131
+ },
132
+ // Word 预览组件的 props
133
+ docxProps: {
134
+ type: Object,
135
+ default: () => ({})
136
+ },
137
+ // OFD 预览组件的 props
138
+ ofdProps: {
139
+ type: Object,
140
+ default: () => ({})
141
+ },
142
+ // Excel 预览组件的 props
143
+ xlsxProps: {
144
+ type: Object,
145
+ default: () => ({})
110
146
  }
111
147
  });
112
148
 
@@ -286,6 +322,7 @@ const preview = async (file, fileName, options = {}) => {
286
322
 
287
323
  fileType.value = type;
288
324
  fileUrl.value = URL.createObjectURL(file);
325
+ downloadUrl.value = fileUrl.value; // 设置下载 URL,用于下载功能
289
326
  downloading.value = false;
290
327
  progress.value = 100;
291
328
  return;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="preview-container">
3
3
  <!-- 工具栏 -->
4
- <div v-if="props.isDownload" class="preview-toolbar preview-toolbar-right">
4
+ <div class="preview-toolbar preview-toolbar-right" v-if="isDownload">
5
5
  <div class="toolbar-group">
6
6
  <ATooltip
7
7
  mini