xh-lab-rc 0.16.1 → 0.16.4
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.
|
@@ -12,8 +12,13 @@ interface PdfViewerProps {
|
|
|
12
12
|
onChangeBookmarkDatas?: (any: any) => void;
|
|
13
13
|
onTimeoutCallback?: () => void;
|
|
14
14
|
onCollected?: () => void;
|
|
15
|
+
onDownloaded?: () => void;
|
|
15
16
|
isColl?: boolean;
|
|
16
17
|
btnShowList?: Array<boolean>;
|
|
18
|
+
onRenameBtnClick?: () => void;
|
|
19
|
+
onMoveBtnClick?: () => void;
|
|
20
|
+
onDownBtnClick?: () => void;
|
|
21
|
+
onDeleteBtnClick?: () => void;
|
|
17
22
|
}
|
|
18
|
-
declare const LabPdfViewMobile: ({ src, pdfjsSrc, fileTypeName, fileTitle, isColl, timeout, showTop, onCollected, onTimeoutCallback, onChangeBookmarkDatas, btnShowList, }: PdfViewerProps) => React.JSX.Element;
|
|
23
|
+
declare const LabPdfViewMobile: ({ src, pdfjsSrc, fileTypeName, fileTitle, isColl, timeout, showTop, onCollected, onDownloaded, onTimeoutCallback, onChangeBookmarkDatas, onRenameBtnClick, onMoveBtnClick, onDownBtnClick, onDeleteBtnClick, btnShowList, }: PdfViewerProps) => React.JSX.Element;
|
|
19
24
|
export default LabPdfViewMobile;
|
|
@@ -6,11 +6,10 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
6
6
|
* @Author: wusum
|
|
7
7
|
* @Date: 2024-05-27 14:50:05
|
|
8
8
|
* @LastEditors: wusum
|
|
9
|
-
* @LastEditTime: 2024-
|
|
9
|
+
* @LastEditTime: 2024-08-15 11:01:54
|
|
10
10
|
*/
|
|
11
11
|
import { SearchBar, TabBar } from 'antd-mobile';
|
|
12
12
|
import { CloseOutline, DownlandOutline, LeftOutline, RightOutline, SearchOutline, StarOutline, UnorderedListOutline } from 'antd-mobile-icons';
|
|
13
|
-
import axios from 'axios';
|
|
14
13
|
import * as React from 'react';
|
|
15
14
|
import { useEffect, useState } from 'react';
|
|
16
15
|
import "./style.less";
|
|
@@ -28,10 +27,15 @@ var LabPdfViewMobile = function LabPdfViewMobile(_ref) {
|
|
|
28
27
|
_ref$showTop = _ref.showTop,
|
|
29
28
|
showTop = _ref$showTop === void 0 ? true : _ref$showTop,
|
|
30
29
|
onCollected = _ref.onCollected,
|
|
30
|
+
onDownloaded = _ref.onDownloaded,
|
|
31
31
|
onTimeoutCallback = _ref.onTimeoutCallback,
|
|
32
32
|
onChangeBookmarkDatas = _ref.onChangeBookmarkDatas,
|
|
33
|
+
onRenameBtnClick = _ref.onRenameBtnClick,
|
|
34
|
+
onMoveBtnClick = _ref.onMoveBtnClick,
|
|
35
|
+
onDownBtnClick = _ref.onDownBtnClick,
|
|
36
|
+
onDeleteBtnClick = _ref.onDeleteBtnClick,
|
|
33
37
|
_ref$btnShowList = _ref.btnShowList,
|
|
34
|
-
btnShowList = _ref$btnShowList === void 0 ? [true, true, false, false] : _ref$btnShowList;
|
|
38
|
+
btnShowList = _ref$btnShowList === void 0 ? [true, true, false, false, false] : _ref$btnShowList;
|
|
35
39
|
var fileSrc = src.replace(/\.(doc|docx|xls|xlsx)$/, '.pdf');
|
|
36
40
|
var isTimeout = false;
|
|
37
41
|
var isWork = false;
|
|
@@ -48,10 +52,14 @@ var LabPdfViewMobile = function LabPdfViewMobile(_ref) {
|
|
|
48
52
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
53
|
isShowFind = _useState6[0],
|
|
50
54
|
setIsShowFind = _useState6[1];
|
|
51
|
-
var _useState7 = useState(
|
|
55
|
+
var _useState7 = useState(false),
|
|
52
56
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
isShowOtherBtn = _useState8[0],
|
|
58
|
+
setIsShowOtherBtn = _useState8[1];
|
|
59
|
+
var _useState9 = useState(['0', '0']),
|
|
60
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
61
|
+
findCount = _useState10[0],
|
|
62
|
+
setFindCount = _useState10[1];
|
|
55
63
|
// 编排树形id
|
|
56
64
|
function addItemId(t, j) {
|
|
57
65
|
t.forEach(function (e, i) {
|
|
@@ -78,24 +86,11 @@ var LabPdfViewMobile = function LabPdfViewMobile(_ref) {
|
|
|
78
86
|
} // 切换Tab
|
|
79
87
|
function _downFileToLocal() {
|
|
80
88
|
_downFileToLocal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
81
|
-
var res, a;
|
|
82
89
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
83
90
|
while (1) switch (_context.prev = _context.next) {
|
|
84
91
|
case 0:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
responseType: 'blob'
|
|
88
|
-
});
|
|
89
|
-
case 2:
|
|
90
|
-
res = _context.sent;
|
|
91
|
-
// const blob = new Blob(res.data, {type: "application/pdf"})
|
|
92
|
-
a = document.createElement('a');
|
|
93
|
-
a.href = URL.createObjectURL(res.data);
|
|
94
|
-
a.download = "".concat(Date.now(), ".pdf");
|
|
95
|
-
a.click();
|
|
96
|
-
URL.revokeObjectURL(a.href);
|
|
97
|
-
a.remove();
|
|
98
|
-
case 9:
|
|
92
|
+
onDownloaded === null || onDownloaded === void 0 || onDownloaded();
|
|
93
|
+
case 1:
|
|
99
94
|
case "end":
|
|
100
95
|
return _context.stop();
|
|
101
96
|
}
|
|
@@ -106,10 +101,13 @@ var LabPdfViewMobile = function LabPdfViewMobile(_ref) {
|
|
|
106
101
|
function changeTabHandle(key) {
|
|
107
102
|
setIsShowBookMark(false);
|
|
108
103
|
setIsShowFind(false);
|
|
104
|
+
setIsShowOtherBtn(false);
|
|
109
105
|
if (key === 'title') {
|
|
110
106
|
setIsShowBookMark(true);
|
|
111
107
|
} else if (key === 'find') {
|
|
112
108
|
setIsShowFind(true);
|
|
109
|
+
} else if (key === 'op') {
|
|
110
|
+
setIsShowOtherBtn(!isShowOtherBtn);
|
|
113
111
|
} else if (key === 'down') {
|
|
114
112
|
downFileToLocal();
|
|
115
113
|
setIsShowBookMark(false);
|
|
@@ -146,6 +144,7 @@ var LabPdfViewMobile = function LabPdfViewMobile(_ref) {
|
|
|
146
144
|
iframeWindow.PDFViewerApplication.findBar.highlightAll.checked = true;
|
|
147
145
|
iframeWindow.PDFViewerApplication.findBar.dispatchEvent('highlightallchange');
|
|
148
146
|
if (value === '') {
|
|
147
|
+
setFindCount(['0', '0']);
|
|
149
148
|
return;
|
|
150
149
|
}
|
|
151
150
|
setTimeout(function () {
|
|
@@ -316,7 +315,49 @@ var LabPdfViewMobile = function LabPdfViewMobile(_ref) {
|
|
|
316
315
|
key: place.id,
|
|
317
316
|
place: place
|
|
318
317
|
});
|
|
319
|
-
}))))),
|
|
318
|
+
}))))), isShowOtherBtn && /*#__PURE__*/React.createElement("div", {
|
|
319
|
+
className: "other-btn-box"
|
|
320
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
321
|
+
onClick: function onClick() {
|
|
322
|
+
setIsShowOtherBtn(false);
|
|
323
|
+
onRenameBtnClick === null || onRenameBtnClick === void 0 || onRenameBtnClick();
|
|
324
|
+
}
|
|
325
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
326
|
+
style: {
|
|
327
|
+
width: 15
|
|
328
|
+
},
|
|
329
|
+
src: '/statics/image/icon-rename.png'
|
|
330
|
+
}), /*#__PURE__*/React.createElement("span", null, "\u91CD\u547D\u540D")), /*#__PURE__*/React.createElement("p", {
|
|
331
|
+
onClick: function onClick() {
|
|
332
|
+
setIsShowOtherBtn(false);
|
|
333
|
+
onMoveBtnClick === null || onMoveBtnClick === void 0 || onMoveBtnClick();
|
|
334
|
+
}
|
|
335
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
336
|
+
style: {
|
|
337
|
+
width: 15
|
|
338
|
+
},
|
|
339
|
+
src: '/statics/image/icon-move.png'
|
|
340
|
+
}), /*#__PURE__*/React.createElement("span", null, "\u79FB\u52A8\u5230")), /*#__PURE__*/React.createElement("p", {
|
|
341
|
+
onClick: function onClick() {
|
|
342
|
+
setIsShowOtherBtn(false);
|
|
343
|
+
onDownBtnClick === null || onDownBtnClick === void 0 || onDownBtnClick();
|
|
344
|
+
}
|
|
345
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
346
|
+
style: {
|
|
347
|
+
width: 15
|
|
348
|
+
},
|
|
349
|
+
src: '/statics/image/icon-download.png'
|
|
350
|
+
}), /*#__PURE__*/React.createElement("span", null, "\u4E0B\u8F7D")), /*#__PURE__*/React.createElement("p", {
|
|
351
|
+
onClick: function onClick() {
|
|
352
|
+
setIsShowOtherBtn(false);
|
|
353
|
+
onDeleteBtnClick === null || onDeleteBtnClick === void 0 || onDeleteBtnClick();
|
|
354
|
+
}
|
|
355
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
356
|
+
style: {
|
|
357
|
+
width: 15
|
|
358
|
+
},
|
|
359
|
+
src: '/statics/image/icon-delete.png'
|
|
360
|
+
}), /*#__PURE__*/React.createElement("span", null, "\u5220\u9664"))), isShowFind && /*#__PURE__*/React.createElement("div", {
|
|
320
361
|
className: "find-box"
|
|
321
362
|
}, /*#__PURE__*/React.createElement("div", {
|
|
322
363
|
className: "find",
|
|
@@ -345,7 +386,7 @@ var LabPdfViewMobile = function LabPdfViewMobile(_ref) {
|
|
|
345
386
|
},
|
|
346
387
|
fontSize: 16,
|
|
347
388
|
onClick: clickPreviousHandle
|
|
348
|
-
}), /*#__PURE__*/React.createElement("span", null, findCount[0]), "/", /*#__PURE__*/React.createElement("span", null, findCount[1]), /*#__PURE__*/React.createElement(RightOutline, {
|
|
389
|
+
}), /*#__PURE__*/React.createElement("span", null, (findCount === null || findCount === void 0 ? void 0 : findCount[0]) || '0'), "/", /*#__PURE__*/React.createElement("span", null, (findCount === null || findCount === void 0 ? void 0 : findCount[1]) || '0'), /*#__PURE__*/React.createElement(RightOutline, {
|
|
349
390
|
style: {
|
|
350
391
|
marginLeft: '10px'
|
|
351
392
|
},
|
|
@@ -356,21 +397,42 @@ var LabPdfViewMobile = function LabPdfViewMobile(_ref) {
|
|
|
356
397
|
onChange: changeTabHandle
|
|
357
398
|
}, btnShowList[0] && /*#__PURE__*/React.createElement(TabBar.Item, {
|
|
358
399
|
key: 'title',
|
|
359
|
-
icon: /*#__PURE__*/React.createElement(UnorderedListOutline,
|
|
400
|
+
icon: /*#__PURE__*/React.createElement(UnorderedListOutline, {
|
|
401
|
+
style: {
|
|
402
|
+
color: '#969ca6'
|
|
403
|
+
}
|
|
404
|
+
}),
|
|
360
405
|
title: '目录'
|
|
361
406
|
}), btnShowList[1] && /*#__PURE__*/React.createElement(TabBar.Item, {
|
|
362
407
|
key: 'find',
|
|
363
|
-
icon: /*#__PURE__*/React.createElement(SearchOutline,
|
|
408
|
+
icon: /*#__PURE__*/React.createElement(SearchOutline, {
|
|
409
|
+
style: {
|
|
410
|
+
color: '#969ca6'
|
|
411
|
+
}
|
|
412
|
+
}),
|
|
364
413
|
title: '查询'
|
|
365
414
|
}), btnShowList[2] && /*#__PURE__*/React.createElement(TabBar.Item, {
|
|
366
415
|
key: 'down',
|
|
367
|
-
icon: /*#__PURE__*/React.createElement(DownlandOutline,
|
|
416
|
+
icon: /*#__PURE__*/React.createElement(DownlandOutline, {
|
|
417
|
+
style: {
|
|
418
|
+
color: '#969ca6'
|
|
419
|
+
}
|
|
420
|
+
}),
|
|
368
421
|
title: '下载'
|
|
369
422
|
}), btnShowList[3] && /*#__PURE__*/React.createElement(TabBar.Item, {
|
|
423
|
+
key: 'op',
|
|
424
|
+
icon: /*#__PURE__*/React.createElement("img", {
|
|
425
|
+
style: {
|
|
426
|
+
width: 24
|
|
427
|
+
},
|
|
428
|
+
src: '/statics/image/icon-op.png'
|
|
429
|
+
}),
|
|
430
|
+
title: '操作'
|
|
431
|
+
}), btnShowList[4] && /*#__PURE__*/React.createElement(TabBar.Item, {
|
|
370
432
|
key: 'remark',
|
|
371
433
|
icon: /*#__PURE__*/React.createElement(StarOutline, {
|
|
372
434
|
style: {
|
|
373
|
-
color: isColl ? '#0069fd' : ''
|
|
435
|
+
color: isColl ? '#0069fd' : '#969ca6'
|
|
374
436
|
}
|
|
375
437
|
}),
|
|
376
438
|
title: '收藏'
|
|
@@ -104,6 +104,33 @@
|
|
|
104
104
|
align-items: center;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
|
|
108
|
+
.other-btn-box {
|
|
109
|
+
animation: animate-find linear 0.3s;
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
z-index: 2;
|
|
113
|
+
position: absolute;
|
|
114
|
+
bottom: 6px;
|
|
115
|
+
left: 0;
|
|
116
|
+
background-color: rgba(234, 234, 234, 100%);
|
|
117
|
+
border-radius: 8px;
|
|
118
|
+
width: 25%;
|
|
119
|
+
margin: 0 0 0 50%;
|
|
120
|
+
|
|
121
|
+
p {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: row;
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: flex-start;
|
|
126
|
+
font-size: 14px;
|
|
127
|
+
|
|
128
|
+
img {
|
|
129
|
+
margin-right: 5px;
|
|
130
|
+
margin-left: 15px;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
107
134
|
}
|
|
108
135
|
|
|
109
136
|
.bookmarks-box {
|
package/package.json
CHANGED
|
@@ -1,82 +1,80 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "xh-lab-rc",
|
|
3
|
-
"version": "0.16.
|
|
4
|
-
"description": " A react library for xinhelab",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"authors": []
|
|
82
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "xh-lab-rc",
|
|
3
|
+
"version": "0.16.4",
|
|
4
|
+
"description": " A react library for xinhelab",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"commitlint": {
|
|
12
|
+
"extends": [
|
|
13
|
+
"@commitlint/config-conventional"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"lint-staged": {
|
|
17
|
+
"*.{md,json}": [
|
|
18
|
+
"prettier --write --no-error-on-unmatched-pattern"
|
|
19
|
+
],
|
|
20
|
+
"*.{css,less}": [
|
|
21
|
+
"stylelint --fix",
|
|
22
|
+
"prettier --write"
|
|
23
|
+
],
|
|
24
|
+
"*.{js,jsx}": [
|
|
25
|
+
"eslint --fix",
|
|
26
|
+
"prettier --write"
|
|
27
|
+
],
|
|
28
|
+
"*.{ts,tsx}": [
|
|
29
|
+
"eslint --fix",
|
|
30
|
+
"prettier --parser=typescript --write"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@ant-design/icons": "^5.3.5",
|
|
35
|
+
"@babel/runtime": "^7.24.6",
|
|
36
|
+
"antd": "^5.15.3",
|
|
37
|
+
"antd-mobile": "^5.36.1",
|
|
38
|
+
"antd-mobile-icons": "^0.3.0",
|
|
39
|
+
"axios": "^1.7.2",
|
|
40
|
+
"classnames": "^2.5.1",
|
|
41
|
+
"dayjs": "^1.11.10"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@commitlint/cli": "^17.1.2",
|
|
45
|
+
"@commitlint/config-conventional": "^17.1.0",
|
|
46
|
+
"@types/react": "^18.0.0",
|
|
47
|
+
"@types/react-dom": "^18.0.0",
|
|
48
|
+
"@umijs/lint": "^4.0.0",
|
|
49
|
+
"dumi": "^2.2.13",
|
|
50
|
+
"eslint": "^8.23.0",
|
|
51
|
+
"father": "^4.1.0",
|
|
52
|
+
"husky": "^8.0.1",
|
|
53
|
+
"lint-staged": "^13.0.3",
|
|
54
|
+
"prettier": "^2.7.1",
|
|
55
|
+
"prettier-plugin-organize-imports": "^3.0.0",
|
|
56
|
+
"prettier-plugin-packagejson": "^2.2.18",
|
|
57
|
+
"react": "^18.0.0",
|
|
58
|
+
"react-dom": "^18.0.0",
|
|
59
|
+
"stylelint": "^14.9.1"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"react": "^16.3.0 || ^17.0.0 || ^18.0.0",
|
|
63
|
+
"react-dom": "^16.3.0 || ^17.0.0 || ^18.0.0"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public"
|
|
67
|
+
},
|
|
68
|
+
"authors": [],
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "father build",
|
|
71
|
+
"build:watch": "father dev",
|
|
72
|
+
"dev": "dumi dev",
|
|
73
|
+
"docs:build": "dumi build",
|
|
74
|
+
"doctor": "father doctor",
|
|
75
|
+
"lint": "npm run lint:es && npm run lint:css",
|
|
76
|
+
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
77
|
+
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
78
|
+
"start": "npm run dev"
|
|
79
|
+
}
|
|
80
|
+
}
|