@toolspack/ttd-pdfjs 0.1.3 → 0.1.5
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/.eslintignore +5 -5
- package/.eslintrc.js +52 -52
- package/.vscode/extensions.json +5 -0
- package/README.md +47 -45
- package/lib/ttd-pdfjs.common.js +9167 -9029
- package/lib/ttd-pdfjs.umd.js +9167 -9029
- package/lib/ttd-pdfjs.umd.min.js +5 -5
- package/package.json +41 -40
- package/postcss.config.js +1 -1
- package/src/App.vue +99 -99
- package/src/main.js +17 -16
- package/src/packages/index.js +7 -5
- package/src/packages/pdfjs/{PdfView216.vue → PdfView.vue} +421 -415
- package/src/packages/pdfjs/SwitchPage.vue +203 -198
- package/src/packages/utils/index.js +16 -16
- package/src/styles/base.scss +3 -3
- package/src/styles/common.scss +22 -22
- package/src/styles/components/el-pagination.scss +21 -21
- package/src/styles/components/file-group.scss +4 -4
- package/src/styles/components/message.scss +53 -53
- package/src/styles/components/reset.scss +8 -8
- package/src/styles/components/table.scss +35 -35
- package/src/styles/input.less +59 -59
package/.eslintignore
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
node_modules
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
pdf.worker.js
|
|
5
|
-
pdf.worker.min.js
|
|
1
|
+
node_modules
|
|
2
|
+
node_modules/pdfjs-dist
|
|
3
|
+
public
|
|
4
|
+
pdf.worker.js
|
|
5
|
+
pdf.worker.min.js
|
|
6
6
|
**/ttd-pdfjs
|
package/.eslintrc.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: {
|
|
4
|
-
node: true,
|
|
5
|
-
},
|
|
6
|
-
extends: [
|
|
7
|
-
'plugin:vue/essential',
|
|
8
|
-
'@vue/airbnb',
|
|
9
|
-
],
|
|
10
|
-
rules: {
|
|
11
|
-
'template-curly-spacing': 'off',
|
|
12
|
-
semi: 0,
|
|
13
|
-
'no-unused-vars': 0,
|
|
14
|
-
'consistent-return': 0,
|
|
15
|
-
'max-len': 0,
|
|
16
|
-
'func-names': 0,
|
|
17
|
-
'no-console': 'off',
|
|
18
|
-
'no-control-regex': 'off',
|
|
19
|
-
'comma-dangle': ['error', 'always-multiline'],
|
|
20
|
-
'no-mixed-spaces-and-tabs': 'off',
|
|
21
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
22
|
-
'no-alert': 0,
|
|
23
|
-
'no-underscore-dangle': 0,
|
|
24
|
-
'no-await-in-loop': 0,
|
|
25
|
-
'no-restricted-syntax': 0,
|
|
26
|
-
'prefer-destructuring': 0,
|
|
27
|
-
'import/no-cycle': 0,
|
|
28
|
-
'import/prefer-default-export': 0,
|
|
29
|
-
camelcase: 'off',
|
|
30
|
-
'guard-for-in': 0,
|
|
31
|
-
'no-param-reassign': 0,
|
|
32
|
-
'no-plusplus': 0,
|
|
33
|
-
'no-unused-expressions': 0,
|
|
34
|
-
"linebreak-
|
|
35
|
-
'react/jsx-filename-extension': [0, { extensions: ['.js', '.jsx'] }],
|
|
36
|
-
},
|
|
37
|
-
settings: {
|
|
38
|
-
'import/resolver': {
|
|
39
|
-
node: {
|
|
40
|
-
paths: ['src'],
|
|
41
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
globals: {
|
|
46
|
-
PDFCtrl: true,
|
|
47
|
-
require: true,
|
|
48
|
-
},
|
|
49
|
-
parserOptions: {
|
|
50
|
-
parser: 'babel-eslint',
|
|
51
|
-
},
|
|
52
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true,
|
|
5
|
+
},
|
|
6
|
+
extends: [
|
|
7
|
+
'plugin:vue/essential',
|
|
8
|
+
'@vue/airbnb',
|
|
9
|
+
],
|
|
10
|
+
rules: {
|
|
11
|
+
'template-curly-spacing': 'off',
|
|
12
|
+
semi: 0,
|
|
13
|
+
'no-unused-vars': 0,
|
|
14
|
+
'consistent-return': 0,
|
|
15
|
+
'max-len': 0,
|
|
16
|
+
'func-names': 0,
|
|
17
|
+
'no-console': 'off',
|
|
18
|
+
'no-control-regex': 'off',
|
|
19
|
+
'comma-dangle': ['error', 'always-multiline'],
|
|
20
|
+
'no-mixed-spaces-and-tabs': 'off',
|
|
21
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
22
|
+
'no-alert': 0,
|
|
23
|
+
'no-underscore-dangle': 0,
|
|
24
|
+
'no-await-in-loop': 0,
|
|
25
|
+
'no-restricted-syntax': 0,
|
|
26
|
+
'prefer-destructuring': 0,
|
|
27
|
+
'import/no-cycle': 0,
|
|
28
|
+
'import/prefer-default-export': 0,
|
|
29
|
+
camelcase: 'off',
|
|
30
|
+
'guard-for-in': 0,
|
|
31
|
+
'no-param-reassign': 0,
|
|
32
|
+
'no-plusplus': 0,
|
|
33
|
+
'no-unused-expressions': 0,
|
|
34
|
+
"linebreak-style": 0,
|
|
35
|
+
'react/jsx-filename-extension': [0, { extensions: ['.js', '.jsx'] }],
|
|
36
|
+
},
|
|
37
|
+
settings: {
|
|
38
|
+
'import/resolver': {
|
|
39
|
+
node: {
|
|
40
|
+
paths: ['src'],
|
|
41
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
globals: {
|
|
46
|
+
PDFCtrl: true,
|
|
47
|
+
require: true,
|
|
48
|
+
},
|
|
49
|
+
parserOptions: {
|
|
50
|
+
parser: 'babel-eslint',
|
|
51
|
+
},
|
|
52
|
+
}
|
package/README.md
CHANGED
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
# ttd-pdfjs
|
|
2
|
-
|
|
3
|
-
--target: 构建目标,默认为应用模式。这里修改为 lib 启用库模式。
|
|
4
|
-
|
|
5
|
-
--dest : 输出目录,默认 dist。这里我们改成 lib
|
|
6
|
-
|
|
7
|
-
[entry]: 最后一个参数为入口文件,默认为 src/App.vue。这里我们指定编译 packages/ 组件库目录。
|
|
8
|
-
|
|
9
|
-
# 调试方法
|
|
10
|
-
修改 package.json的main
|
|
11
|
-
"main": "lib/ttd-pdfjs.umd.min.js",
|
|
12
|
-
"main": "src/packages/index.js",
|
|
13
|
-
执行 npm link ,
|
|
14
|
-
然后在开发项目就可以用 npm link @toolspack/ttd-pdfjs(项目名或文件夹名称) 来使用 本组件
|
|
15
|
-
|
|
16
|
-
# 发布项目
|
|
17
|
-
(不能和上次版本一样) npm run lib (打包), 打包完成后,执行npm publish
|
|
18
|
-
|
|
19
|
-
1. 首先2.8.335版本之前引入方式
|
|
20
|
-
import pdfJS from "pdfjs-dist";
|
|
21
|
-
import workerSrc from 'pdfjs-dist/build/pdf.worker.entry'
|
|
22
|
-
pdfJS.workerSrc = workerSrc;
|
|
23
|
-
//或者使用
|
|
24
|
-
import pdfJS from 'pdfjs-dist/es5/build/pdf.js'
|
|
25
|
-
2. 2.8.335版本之后引入方式
|
|
26
|
-
// 注意导入的写法
|
|
27
|
-
import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js'
|
|
28
|
-
PdfJs.workerSrc = require('pdfjs-dist/build/pdf.worker.entry')
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
0.0.0: pdfjs-dist2.16.105 单独打包
|
|
32
|
-
0.0.1: 修复bug
|
|
33
|
-
0.0.2: 升级pdfjs-dist 到: 3.11.174
|
|
34
|
-
0.0.3: cmapurl改用本地化
|
|
35
|
-
0.0.4: 优化destroy,清空canvas
|
|
36
|
-
0.0.5: 使用legacy目录否则 chrome88 报错(structuredClone is not defined)
|
|
37
|
-
0.0.6: 使用legacy目录 渲染有字体显示不完整情况,升级corejs 解决
|
|
38
|
-
0.0.7: closepdf 方法中的 canvas判空
|
|
39
|
-
0.0.8: 添加 updateScale
|
|
40
|
-
0.0.9: bug fixed
|
|
41
|
-
0.0.10: 修复渲染镜像的问题
|
|
42
|
-
0.1.0: 添加旋转 功能
|
|
43
|
-
0.1.1: 因为可以缩放了,pdf做小高度 调整到100
|
|
44
|
-
0.1.2: 旋转初始值 修改为undefined,(0 会导致 错误的旋转)
|
|
45
|
-
0.1.3: switch-page 媒体查询 优化布局
|
|
1
|
+
# ttd-pdfjs
|
|
2
|
+
|
|
3
|
+
--target: 构建目标,默认为应用模式。这里修改为 lib 启用库模式。
|
|
4
|
+
|
|
5
|
+
--dest : 输出目录,默认 dist。这里我们改成 lib
|
|
6
|
+
|
|
7
|
+
[entry]: 最后一个参数为入口文件,默认为 src/App.vue。这里我们指定编译 packages/ 组件库目录。
|
|
8
|
+
|
|
9
|
+
# 调试方法
|
|
10
|
+
修改 package.json的main
|
|
11
|
+
"main": "lib/ttd-pdfjs.umd.min.js",
|
|
12
|
+
"main": "src/packages/index.js",
|
|
13
|
+
执行 npm link ,
|
|
14
|
+
然后在开发项目就可以用 npm link @toolspack/ttd-pdfjs(项目名或文件夹名称) 来使用 本组件
|
|
15
|
+
|
|
16
|
+
# 发布项目
|
|
17
|
+
(不能和上次版本一样) npm run lib (打包), 打包完成后,执行npm publish
|
|
18
|
+
|
|
19
|
+
1. 首先2.8.335版本之前引入方式
|
|
20
|
+
import pdfJS from "pdfjs-dist";
|
|
21
|
+
import workerSrc from 'pdfjs-dist/build/pdf.worker.entry'
|
|
22
|
+
pdfJS.workerSrc = workerSrc;
|
|
23
|
+
//或者使用
|
|
24
|
+
import pdfJS from 'pdfjs-dist/es5/build/pdf.js'
|
|
25
|
+
2. 2.8.335版本之后引入方式
|
|
26
|
+
// 注意导入的写法
|
|
27
|
+
import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js'
|
|
28
|
+
PdfJs.workerSrc = require('pdfjs-dist/build/pdf.worker.entry')
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
0.0.0: pdfjs-dist2.16.105 单独打包
|
|
32
|
+
0.0.1: 修复bug
|
|
33
|
+
0.0.2: 升级pdfjs-dist 到: 3.11.174
|
|
34
|
+
0.0.3: cmapurl改用本地化
|
|
35
|
+
0.0.4: 优化destroy,清空canvas
|
|
36
|
+
0.0.5: 使用legacy目录否则 chrome88 报错(structuredClone is not defined)
|
|
37
|
+
0.0.6: 使用legacy目录 渲染有字体显示不完整情况,升级corejs 解决
|
|
38
|
+
0.0.7: closepdf 方法中的 canvas判空
|
|
39
|
+
0.0.8: 添加 updateScale
|
|
40
|
+
0.0.9: bug fixed
|
|
41
|
+
0.0.10: 修复渲染镜像的问题
|
|
42
|
+
0.1.0: 添加旋转 功能
|
|
43
|
+
0.1.1: 因为可以缩放了,pdf做小高度 调整到100
|
|
44
|
+
0.1.2: 旋转初始值 修改为undefined,(0 会导致 错误的旋转)
|
|
45
|
+
0.1.3: switch-page 媒体查询 优化布局
|
|
46
|
+
0.1.4: 给容器加min-width: 688px
|
|
47
|
+
0.1.5: pef-view 添加 样式
|