@toolspack/ttd-pdfjs 0.1.4 → 0.1.6

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": "@toolspack/ttd-pdfjs",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "main": "lib/ttd-pdfjs.umd.min.js",
6
6
  "scripts": {
@@ -10,30 +10,32 @@
10
10
  "lint": "vue-cli-service lint --max-warnings 100"
11
11
  },
12
12
  "dependencies": {
13
- "babel-cli": "^6.26.0",
14
- "babel-laoder": "0.0.1-security",
15
- "babel-polyfill": "^6.26.0",
16
- "core-js": "^3.34.0",
13
+ "babel-loader": "^10.0.0",
17
14
  "element-ui": "^2.15.14",
18
- "less": "^3.8.1",
19
- "less-loader": "^4.1.0",
20
15
  "pdfjs-dist": "3.11.174",
21
16
  "vue": "^2.6.12"
22
17
  },
23
18
  "devDependencies": {
24
19
  "@babel/plugin-proposal-class-properties": "^7.18.6",
20
+ "@babel/plugin-transform-modules-commonjs": "^7.26.3",
25
21
  "@vue/cli-plugin-babel": "~4.5.11",
26
22
  "@vue/cli-plugin-eslint": "~4.5.11",
27
23
  "@vue/cli-service": "^4.5.11",
28
24
  "@vue/eslint-config-airbnb": "^5.3.0",
25
+ "babel-cli": "^6.26.0",
29
26
  "babel-eslint": "^10.1.0",
30
27
  "babel-plugin-component": "^1.1.1",
28
+ "babel-polyfill": "^6.26.0",
31
29
  "babel-preset-es2015": "^6.24.1",
30
+ "core-js": "^3.34.0",
32
31
  "eslint": "^6.7.2",
33
32
  "eslint-plugin-import": "^2.22.1",
34
33
  "eslint-plugin-node": "^11.1.0",
35
34
  "eslint-plugin-promise": "^4.2.1",
36
35
  "eslint-plugin-vue": "^6.2.2",
36
+ "file-loader": "^6.2.0",
37
+ "less": "^3.8.1",
38
+ "less-loader": "^4.1.0",
37
39
  "vue-template-compiler": "^2.6.12"
38
40
  }
39
41
  }
package/src/App.vue CHANGED
@@ -20,7 +20,7 @@
20
20
  </template>
21
21
 
22
22
  <script>
23
- import PdfView from './packages/pdfjs/PdfView216.vue'
23
+ import PdfView from './packages/pdfjs/PdfView.vue'
24
24
 
25
25
  const mybaseUrl = 'https://petx.totodi.com/'
26
26
 
package/src/main.js CHANGED
@@ -6,11 +6,11 @@ import App from './App.vue';
6
6
 
7
7
  Vue.config.productionTip = false;
8
8
 
9
- Vue.component(Button.name, Button);
10
- Vue.component(Input.name, Input);
11
- Vue.component(Upload.name, Upload);
12
- Vue.component(Select.name, Select);
13
- Vue.component(Option.name, Option);
9
+ Vue.use(Button);
10
+ Vue.use(Input);
11
+ Vue.use(Upload);
12
+ Vue.use(Select);
13
+ Vue.use(Option);
14
14
 
15
15
  new Vue({
16
16
  render: (h) => h(App),
@@ -1,5 +1,7 @@
1
- import PdfView216 from './pdfjs/PdfView216.vue'
1
+ import PdfView from './pdfjs/PdfView.vue'
2
+ import SwitchPage from './pdfjs/SwitchPage.vue'
2
3
 
3
4
  export default {
4
- PdfView216,
5
+ PdfView,
6
+ SwitchPage,
5
7
  }
@@ -5,7 +5,7 @@
5
5
  :page="page" :zoomEnable="zoomEnable" :rotateEnable="rotateEnable"
6
6
  @page="onChangePage" @zoom="onScale" @rotate="onRotate"></switch-page>
7
7
  </div>
8
- <div class="pdf-view-area-wapper" :width="pdfWidth">
8
+ <div class="pdf-view-area-wapper">
9
9
  <div>
10
10
  <div
11
11
  class="center pdf-view-area"
@@ -55,18 +55,20 @@ if (getChromeVersion()) {
55
55
  }
56
56
  }
57
57
 
58
- // const PDFJS = require('pdfjs-dist/legacy/build/pdf.js')
59
58
  const PDFJS = require('pdfjs-dist')
60
59
 
61
60
  const defautScale = 1.0
62
61
  // PDFJS.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/legacy/build/pdf.worker.min.js')
62
+ // eslint-disable-next-line
63
63
  PDFJS.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.min.js')
64
64
  // https://unpkg.com/pdfjs-dist@2.16.105/cmaps/
65
- // const cMapUrl = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@3.11.174/cmaps/'
66
65
  // 使用代理的cmaps,会导致加载很慢,改用本地
67
-
66
+ // const cMapUrl = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@3.11.174/cmaps/'
68
67
  const cMapUrl = 'https://wsp.totodi.com/staticfiles_web/web/pdfjs/cmaps/'
69
68
 
69
+ PDFJS.cMapPacked = true
70
+ PDFJS.cMapUrl = cMapUrl
71
+
70
72
  export const maxscale = 3
71
73
  export const minscale = 0.2
72
74
 
@@ -173,7 +175,10 @@ export default {
173
175
  vm.isready = true
174
176
 
175
177
  const { canvas } = vm.$refs
176
- this.style.width = `${viewport.width + 2}px`;
178
+ if (!canvas) {
179
+ return false
180
+ }
181
+ this.style.width = `${viewport.width + 18}px`;
177
182
  this.pdfWidth = `${viewport.width}px`;
178
183
  canvas.height = viewport.height
179
184
  canvas.width = viewport.width
@@ -374,6 +379,7 @@ export default {
374
379
  width: 100%;
375
380
  display: flex;
376
381
  flex-direction: column;
382
+ box-sizing: border-box;
377
383
  min-width: 688px;
378
384
  }
379
385
  .pdf-view-control {
@@ -385,10 +391,12 @@ export default {
385
391
  overflow: auto;
386
392
  width: 100%;
387
393
  flex-shrink: 0%;
394
+ box-sizing: border-box;
388
395
  }
389
396
  .pdf-view-area {
390
397
  position: relative;
391
398
  min-height: 100px;
399
+ box-sizing: border-box;
392
400
  .canvasstyle {
393
401
  display: block;
394
402
  margin: 0 auto;
@@ -32,7 +32,7 @@
32
32
  </template>
33
33
 
34
34
  <script>
35
- import { maxscale, minscale } from './PdfView216.vue'
35
+ import { maxscale, minscale } from './PdfView.vue'
36
36
 
37
37
  export const EnumOptions = [
38
38
  // { label: '自动缩放', value: '' },
@@ -194,5 +194,10 @@ export default {
194
194
  display: none;
195
195
  }
196
196
  }
197
+ @container (max-width: 731px) {
198
+ .hidden-text {
199
+ display: none;
200
+ }
201
+ }
197
202
  }
198
203
  </style>