ls-pro-common 3.1.61 → 3.1.62
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/dist/common.css +43 -17
- package/dist/common.js +1 -1
- package/dist/common.min.css +43 -17
- package/dist/common.min.js +1 -1
- package/es/components/DtlLayout.d.ts +1 -1
- package/es/components/ViewOffice.js +35 -12
- package/es/components/common.less +9 -0
- package/es/http/bizAjax.d.ts +7 -2
- package/lib/components/DtlLayout.d.ts +1 -1
- package/lib/components/ViewOffice.js +35 -12
- package/lib/components/common.less +9 -0
- package/lib/http/bizAjax.d.ts +7 -2
- package/package.json +1 -1
|
@@ -4,10 +4,11 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
import React, { useState, useMemo } from 'react';
|
|
7
|
+
import React, { useState, useMemo, useRef } from 'react';
|
|
8
8
|
import { EyeOutlined } from '@ant-design/icons';
|
|
9
|
-
import { getCookie,
|
|
9
|
+
import { getCookie, getUrlQuery } from '../utils';
|
|
10
10
|
import { base64Encode } from 'ls-pro-tools';
|
|
11
|
+
import Loading from './Loading';
|
|
11
12
|
var ViewDocment = function ViewDocment(props) {
|
|
12
13
|
var _props$open = props.open,
|
|
13
14
|
open = _props$open === void 0 ? false : _props$open,
|
|
@@ -27,6 +28,15 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
27
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
29
|
visible = _useState2[0],
|
|
29
30
|
setVisible = _useState2[1];
|
|
31
|
+
var _useState3 = useState(false),
|
|
32
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
+
isZip = _useState4[0],
|
|
34
|
+
setIsZip = _useState4[1];
|
|
35
|
+
var _useState5 = useState(mode !== 'modal'),
|
|
36
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
37
|
+
loading = _useState6[0],
|
|
38
|
+
setLoading = _useState6[1];
|
|
39
|
+
var iframeRef = useRef(null);
|
|
30
40
|
var src = useMemo(function () {
|
|
31
41
|
var token = getCookie('token');
|
|
32
42
|
var filename = getUrlQuery('fileName', url); //文件名,上传的文件名为xxx?fileName=xxx.pdf
|
|
@@ -46,13 +56,13 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
46
56
|
filename = filename.replace(/[^a-zA-Z0-9\u4e00-\u9fa5.]/g, '');
|
|
47
57
|
href = href + (href.includes('?') ? '&' : '?') + 'fullfilename=' + filename;
|
|
48
58
|
}
|
|
59
|
+
if (filename.endsWith('.zip')) {
|
|
60
|
+
setIsZip(true);
|
|
61
|
+
}
|
|
49
62
|
var doc = base64Encode(href);
|
|
50
|
-
|
|
63
|
+
// 统一使用生产环境来预览文件
|
|
64
|
+
// const exportUrl = getCache('exportUrl');
|
|
51
65
|
var domain = 'https://download.lesoon.cloud';
|
|
52
|
-
// if (exportUrl && exportUrl.includes('//')) {
|
|
53
|
-
// // 如果配置了下载域名,则走下载域名,否则走原来域名
|
|
54
|
-
// domain = exportUrl;
|
|
55
|
-
// }
|
|
56
66
|
return domain + '/lesoon/lesoon-kkfileview-api/onlinePreview?url=' + doc;
|
|
57
67
|
}, [url]);
|
|
58
68
|
var triggerDom = /*#__PURE__*/React.createElement(React.Fragment, {
|
|
@@ -64,13 +74,14 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
64
74
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
65
75
|
while (1) switch (_context.prev = _context.next) {
|
|
66
76
|
case 0:
|
|
67
|
-
setVisible(
|
|
77
|
+
setVisible(true);
|
|
78
|
+
setLoading(true);
|
|
68
79
|
(_trigger$props = trigger.props) === null || _trigger$props === void 0 ? void 0 : (_trigger$props$onClic = _trigger$props.onClick) === null || _trigger$props$onClic === void 0 ? void 0 : _trigger$props$onClic.call(_trigger$props, e);
|
|
69
80
|
// 新页签打开
|
|
70
81
|
if (mode === 'urlOpen') {
|
|
71
82
|
window.open(src, '_blank');
|
|
72
83
|
}
|
|
73
|
-
case
|
|
84
|
+
case 4:
|
|
74
85
|
case "end":
|
|
75
86
|
return _context.stop();
|
|
76
87
|
}
|
|
@@ -85,7 +96,7 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
85
96
|
if (mode === 'urlOpen') {
|
|
86
97
|
return /*#__PURE__*/React.createElement(React.Fragment, null, props.children, triggerDom);
|
|
87
98
|
} else if (mode === 'iframe') {
|
|
88
|
-
/*#__PURE__*/React.createElement(React.Fragment, null, props.children, /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, props.children, /*#__PURE__*/React.createElement("div", {
|
|
89
100
|
className: "view-office-modal",
|
|
90
101
|
style: {
|
|
91
102
|
width: width,
|
|
@@ -109,9 +120,21 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
109
120
|
bodyStyle: {
|
|
110
121
|
height: height
|
|
111
122
|
},
|
|
112
|
-
footer: null
|
|
123
|
+
footer: null,
|
|
124
|
+
destroyOnClose: true
|
|
113
125
|
}, /*#__PURE__*/React.createElement("iframe", {
|
|
114
|
-
src: src
|
|
126
|
+
src: src,
|
|
127
|
+
onLoad: function onLoad() {
|
|
128
|
+
setLoading(false);
|
|
129
|
+
},
|
|
130
|
+
onError: function onError() {
|
|
131
|
+
setLoading(false);
|
|
132
|
+
setIsZip(false);
|
|
133
|
+
},
|
|
134
|
+
ref: iframeRef,
|
|
135
|
+
id: "view-office-iframe"
|
|
136
|
+
}), loading && /*#__PURE__*/React.createElement(Loading, {
|
|
137
|
+
className: "file-loading"
|
|
115
138
|
})));
|
|
116
139
|
};
|
|
117
140
|
export default ViewDocment;
|
|
@@ -516,7 +516,9 @@ a:hover {
|
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
.view-office-modal {
|
|
519
|
+
position: relative;
|
|
519
520
|
.ant-modal-body {
|
|
521
|
+
position: relative;
|
|
520
522
|
padding: 0;
|
|
521
523
|
}
|
|
522
524
|
iframe {
|
|
@@ -524,6 +526,13 @@ a:hover {
|
|
|
524
526
|
height: 100%;
|
|
525
527
|
border: none;
|
|
526
528
|
}
|
|
529
|
+
.file-loading {
|
|
530
|
+
position: absolute;
|
|
531
|
+
top: 0;
|
|
532
|
+
left: 0;
|
|
533
|
+
width: 100%;
|
|
534
|
+
height: 100%;
|
|
535
|
+
}
|
|
527
536
|
}
|
|
528
537
|
|
|
529
538
|
@import url('./antd-custom.less');
|
package/es/http/bizAjax.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export declare type OptionItemType = {
|
|
2
|
+
value: string | number;
|
|
3
|
+
label: string;
|
|
4
|
+
[key: string]: string | number;
|
|
5
|
+
};
|
|
1
6
|
/**
|
|
2
7
|
* 读取数据字典
|
|
3
8
|
*
|
|
@@ -9,7 +14,7 @@
|
|
|
9
14
|
* @param valueIsNumber 返回值是否为数字,默认false
|
|
10
15
|
* @returns Promise<Record<string,string>[]>
|
|
11
16
|
*/
|
|
12
|
-
export declare function getDict(dictCodes: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<
|
|
17
|
+
export declare function getDict(dictCodes: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<OptionItemType[]>;
|
|
13
18
|
/**
|
|
14
19
|
* 加载下拉框的数据源
|
|
15
20
|
*
|
|
@@ -24,7 +29,7 @@ export declare function getDict(dictCodes: string, showValue?: boolean, needGate
|
|
|
24
29
|
* @param valueIsNumber 返回值是否为数字,默认false
|
|
25
30
|
* @returns
|
|
26
31
|
*/
|
|
27
|
-
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<
|
|
32
|
+
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<OptionItemType[]>;
|
|
28
33
|
/**
|
|
29
34
|
* 获取用户资源Id对应的权限值
|
|
30
35
|
*
|
|
@@ -4,10 +4,11 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
import React, { useState, useMemo } from 'react';
|
|
7
|
+
import React, { useState, useMemo, useRef } from 'react';
|
|
8
8
|
import { EyeOutlined } from '@ant-design/icons';
|
|
9
|
-
import { getCookie,
|
|
9
|
+
import { getCookie, getUrlQuery } from '../utils';
|
|
10
10
|
import { base64Encode } from 'ls-pro-tools';
|
|
11
|
+
import Loading from './Loading';
|
|
11
12
|
var ViewDocment = function ViewDocment(props) {
|
|
12
13
|
var _props$open = props.open,
|
|
13
14
|
open = _props$open === void 0 ? false : _props$open,
|
|
@@ -27,6 +28,15 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
27
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
29
|
visible = _useState2[0],
|
|
29
30
|
setVisible = _useState2[1];
|
|
31
|
+
var _useState3 = useState(false),
|
|
32
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
+
isZip = _useState4[0],
|
|
34
|
+
setIsZip = _useState4[1];
|
|
35
|
+
var _useState5 = useState(mode !== 'modal'),
|
|
36
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
37
|
+
loading = _useState6[0],
|
|
38
|
+
setLoading = _useState6[1];
|
|
39
|
+
var iframeRef = useRef(null);
|
|
30
40
|
var src = useMemo(function () {
|
|
31
41
|
var token = getCookie('token');
|
|
32
42
|
var filename = getUrlQuery('fileName', url); //文件名,上传的文件名为xxx?fileName=xxx.pdf
|
|
@@ -46,13 +56,13 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
46
56
|
filename = filename.replace(/[^a-zA-Z0-9\u4e00-\u9fa5.]/g, '');
|
|
47
57
|
href = href + (href.includes('?') ? '&' : '?') + 'fullfilename=' + filename;
|
|
48
58
|
}
|
|
59
|
+
if (filename.endsWith('.zip')) {
|
|
60
|
+
setIsZip(true);
|
|
61
|
+
}
|
|
49
62
|
var doc = base64Encode(href);
|
|
50
|
-
|
|
63
|
+
// 统一使用生产环境来预览文件
|
|
64
|
+
// const exportUrl = getCache('exportUrl');
|
|
51
65
|
var domain = 'https://download.lesoon.cloud';
|
|
52
|
-
// if (exportUrl && exportUrl.includes('//')) {
|
|
53
|
-
// // 如果配置了下载域名,则走下载域名,否则走原来域名
|
|
54
|
-
// domain = exportUrl;
|
|
55
|
-
// }
|
|
56
66
|
return domain + '/lesoon/lesoon-kkfileview-api/onlinePreview?url=' + doc;
|
|
57
67
|
}, [url]);
|
|
58
68
|
var triggerDom = /*#__PURE__*/React.createElement(React.Fragment, {
|
|
@@ -64,13 +74,14 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
64
74
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
65
75
|
while (1) switch (_context.prev = _context.next) {
|
|
66
76
|
case 0:
|
|
67
|
-
setVisible(
|
|
77
|
+
setVisible(true);
|
|
78
|
+
setLoading(true);
|
|
68
79
|
(_trigger$props = trigger.props) === null || _trigger$props === void 0 ? void 0 : (_trigger$props$onClic = _trigger$props.onClick) === null || _trigger$props$onClic === void 0 ? void 0 : _trigger$props$onClic.call(_trigger$props, e);
|
|
69
80
|
// 新页签打开
|
|
70
81
|
if (mode === 'urlOpen') {
|
|
71
82
|
window.open(src, '_blank');
|
|
72
83
|
}
|
|
73
|
-
case
|
|
84
|
+
case 4:
|
|
74
85
|
case "end":
|
|
75
86
|
return _context.stop();
|
|
76
87
|
}
|
|
@@ -85,7 +96,7 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
85
96
|
if (mode === 'urlOpen') {
|
|
86
97
|
return /*#__PURE__*/React.createElement(React.Fragment, null, props.children, triggerDom);
|
|
87
98
|
} else if (mode === 'iframe') {
|
|
88
|
-
/*#__PURE__*/React.createElement(React.Fragment, null, props.children, /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, props.children, /*#__PURE__*/React.createElement("div", {
|
|
89
100
|
className: "view-office-modal",
|
|
90
101
|
style: {
|
|
91
102
|
width: width,
|
|
@@ -109,9 +120,21 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
109
120
|
bodyStyle: {
|
|
110
121
|
height: height
|
|
111
122
|
},
|
|
112
|
-
footer: null
|
|
123
|
+
footer: null,
|
|
124
|
+
destroyOnClose: true
|
|
113
125
|
}, /*#__PURE__*/React.createElement("iframe", {
|
|
114
|
-
src: src
|
|
126
|
+
src: src,
|
|
127
|
+
onLoad: function onLoad() {
|
|
128
|
+
setLoading(false);
|
|
129
|
+
},
|
|
130
|
+
onError: function onError() {
|
|
131
|
+
setLoading(false);
|
|
132
|
+
setIsZip(false);
|
|
133
|
+
},
|
|
134
|
+
ref: iframeRef,
|
|
135
|
+
id: "view-office-iframe"
|
|
136
|
+
}), loading && /*#__PURE__*/React.createElement(Loading, {
|
|
137
|
+
className: "file-loading"
|
|
115
138
|
})));
|
|
116
139
|
};
|
|
117
140
|
export default ViewDocment;
|
|
@@ -516,7 +516,9 @@ a:hover {
|
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
.view-office-modal {
|
|
519
|
+
position: relative;
|
|
519
520
|
.ant-modal-body {
|
|
521
|
+
position: relative;
|
|
520
522
|
padding: 0;
|
|
521
523
|
}
|
|
522
524
|
iframe {
|
|
@@ -524,6 +526,13 @@ a:hover {
|
|
|
524
526
|
height: 100%;
|
|
525
527
|
border: none;
|
|
526
528
|
}
|
|
529
|
+
.file-loading {
|
|
530
|
+
position: absolute;
|
|
531
|
+
top: 0;
|
|
532
|
+
left: 0;
|
|
533
|
+
width: 100%;
|
|
534
|
+
height: 100%;
|
|
535
|
+
}
|
|
527
536
|
}
|
|
528
537
|
|
|
529
538
|
@import url('./antd-custom.less');
|
package/lib/http/bizAjax.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export declare type OptionItemType = {
|
|
2
|
+
value: string | number;
|
|
3
|
+
label: string;
|
|
4
|
+
[key: string]: string | number;
|
|
5
|
+
};
|
|
1
6
|
/**
|
|
2
7
|
* 读取数据字典
|
|
3
8
|
*
|
|
@@ -9,7 +14,7 @@
|
|
|
9
14
|
* @param valueIsNumber 返回值是否为数字,默认false
|
|
10
15
|
* @returns Promise<Record<string,string>[]>
|
|
11
16
|
*/
|
|
12
|
-
export declare function getDict(dictCodes: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<
|
|
17
|
+
export declare function getDict(dictCodes: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<OptionItemType[]>;
|
|
13
18
|
/**
|
|
14
19
|
* 加载下拉框的数据源
|
|
15
20
|
*
|
|
@@ -24,7 +29,7 @@ export declare function getDict(dictCodes: string, showValue?: boolean, needGate
|
|
|
24
29
|
* @param valueIsNumber 返回值是否为数字,默认false
|
|
25
30
|
* @returns
|
|
26
31
|
*/
|
|
27
|
-
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<
|
|
32
|
+
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<OptionItemType[]>;
|
|
28
33
|
/**
|
|
29
34
|
* 获取用户资源Id对应的权限值
|
|
30
35
|
*
|