ztxkutils 2.6.10 → 2.7.2
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/fileOperation.js +33 -9
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/useMutationObserver.d.ts +1 -0
- package/dist/hooks.js +15 -1
- package/dist/index.js +1 -1
- package/dist/request-90475df7.js +2735 -0
- package/dist/request.js +1 -1
- package/dist/stompClient.js +11 -7
- package/package.json +1 -1
package/dist/fileOperation.js
CHANGED
@@ -7,7 +7,10 @@ import { g as getToken } from './authority-fad2028d.js';
|
|
7
7
|
function downloadFile(apiUrl, fileId, fileName, authToken) {
|
8
8
|
var xhr = new XMLHttpRequest();
|
9
9
|
var token = getToken() || authToken;
|
10
|
-
|
10
|
+
var _apiUrl = apiUrl.endsWith('/')
|
11
|
+
? apiUrl.slice(0, apiUrl.length - 1)
|
12
|
+
: apiUrl;
|
13
|
+
xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token, true);
|
11
14
|
xhr.responseType = 'blob';
|
12
15
|
xhr.onload = function () {
|
13
16
|
if (xhr.status === 200 || xhr.status === 201) {
|
@@ -29,7 +32,10 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
|
|
29
32
|
var _a = otherOption || {}, authToken = _a.authToken, callbackAfter = _a.callbackAfter;
|
30
33
|
var xhr = new XMLHttpRequest();
|
31
34
|
var token = getToken() || authToken;
|
32
|
-
|
35
|
+
var _apiUrl = apiUrl.endsWith('/')
|
36
|
+
? apiUrl.slice(0, apiUrl.length - 1)
|
37
|
+
: apiUrl;
|
38
|
+
xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token, true);
|
33
39
|
xhr.responseType = 'blob';
|
34
40
|
xhr.onload = function () {
|
35
41
|
if (xhr.status === 200 || xhr.status === 201) {
|
@@ -57,7 +63,10 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
|
|
57
63
|
function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
|
58
64
|
var callbackAfter = (otherOption || {}).callbackAfter;
|
59
65
|
var xhr = new XMLHttpRequest();
|
60
|
-
|
66
|
+
var _apiUrl = apiUrl.endsWith('/')
|
67
|
+
? apiUrl.slice(0, apiUrl.length - 1)
|
68
|
+
: apiUrl;
|
69
|
+
xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId, true);
|
61
70
|
xhr.responseType = 'blob';
|
62
71
|
xhr.onload = function () {
|
63
72
|
if (xhr.status === 200 || xhr.status === 201) {
|
@@ -83,7 +92,10 @@ function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
|
|
83
92
|
*/
|
84
93
|
function createDownloadUrl(apiUrl, fileId, authToken) {
|
85
94
|
var token = getToken() || authToken;
|
86
|
-
|
95
|
+
var _apiUrl = apiUrl.endsWith('/')
|
96
|
+
? apiUrl.slice(0, apiUrl.length - 1)
|
97
|
+
: apiUrl;
|
98
|
+
return _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
|
87
99
|
}
|
88
100
|
/**
|
89
101
|
* @description 生成公共文件下载路径
|
@@ -91,7 +103,10 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
|
|
91
103
|
* @param {string} fileId 文件id
|
92
104
|
*/
|
93
105
|
function createPublicDownloadUrl(apiUrl, fileId) {
|
94
|
-
|
106
|
+
var _apiUrl = apiUrl.endsWith('/')
|
107
|
+
? apiUrl.slice(0, apiUrl.length - 1)
|
108
|
+
: apiUrl;
|
109
|
+
return _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId;
|
95
110
|
}
|
96
111
|
/**
|
97
112
|
* @description 文件预览方法
|
@@ -109,8 +124,11 @@ function previewFile(fileUrl, fileId, otherOption) {
|
|
109
124
|
token = getToken() || otherOption;
|
110
125
|
}
|
111
126
|
var titleName = otherOption === null || otherOption === void 0 ? void 0 : otherOption.titleName;
|
127
|
+
var _fileUrl = fileUrl.endsWith('/')
|
128
|
+
? fileUrl.slice(0, fileUrl.length - 1)
|
129
|
+
: fileUrl;
|
112
130
|
if (titleName) {
|
113
|
-
window.open(
|
131
|
+
window.open(_fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName));
|
114
132
|
}
|
115
133
|
else {
|
116
134
|
window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token);
|
@@ -125,11 +143,14 @@ function previewFile(fileUrl, fileId, otherOption) {
|
|
125
143
|
function createOriginalUrl(fileUrl, fileId, otherOption) {
|
126
144
|
var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
|
127
145
|
var titleName = otherOption === null || otherOption === void 0 ? void 0 : otherOption.titleName;
|
146
|
+
var _fileUrl = fileUrl.endsWith('/')
|
147
|
+
? fileUrl.slice(0, fileUrl.length - 1)
|
148
|
+
: fileUrl;
|
128
149
|
if (titleName) {
|
129
|
-
return
|
150
|
+
return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName);
|
130
151
|
}
|
131
152
|
else {
|
132
|
-
return
|
153
|
+
return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token;
|
133
154
|
}
|
134
155
|
}
|
135
156
|
/**
|
@@ -139,8 +160,11 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
|
|
139
160
|
* @param {string} scale 缩略倍数
|
140
161
|
*/
|
141
162
|
function createThumbnailUrl(apiUrl, fileId, scale, otherOption) {
|
163
|
+
var _apiUrl = apiUrl.endsWith('/')
|
164
|
+
? apiUrl.slice(0, apiUrl.length - 1)
|
165
|
+
: apiUrl;
|
142
166
|
var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
|
143
|
-
return
|
167
|
+
return _apiUrl + "/api/zmdms-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&Zmdms-Auth=bearer " + token;
|
144
168
|
}
|
145
169
|
|
146
170
|
export { createDownloadUrl, createOriginalUrl, createPublicDownloadUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, previewFile };
|
package/dist/hooks/index.d.ts
CHANGED
@@ -2,4 +2,5 @@ import useTableLinkage from './useTableLinkage';
|
|
2
2
|
import useFetchState from './useFetchState';
|
3
3
|
import useTableValidate from './useTableValidate';
|
4
4
|
import useScreenFull from './useScreenFull';
|
5
|
-
|
5
|
+
import useMutationObserver from './useMutationObserver';
|
6
|
+
export { useTableLinkage, useFetchState, useTableValidate, useScreenFull, useMutationObserver, };
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function useMutationObserver(dom: any, callback: any): void;
|
package/dist/hooks.js
CHANGED
@@ -393,4 +393,18 @@ function useScreenFull(toggleRef, elementRef) {
|
|
393
393
|
return isFull;
|
394
394
|
}
|
395
395
|
|
396
|
-
|
396
|
+
function useMutationObserver(dom, callback) {
|
397
|
+
useEffect(function () {
|
398
|
+
if (dom) {
|
399
|
+
var observer_1 = new MutationObserver(function (mutationsList, observer) {
|
400
|
+
callback && callback();
|
401
|
+
});
|
402
|
+
var config = { attributes: true, childList: true, subtree: true };
|
403
|
+
observer_1.observe(dom, config);
|
404
|
+
}
|
405
|
+
return function () {
|
406
|
+
};
|
407
|
+
}, [dom, callback]);
|
408
|
+
}
|
409
|
+
|
410
|
+
export { useFetchState, useMutationObserver, useScreenFull, useTableLinkage, useTableValidate };
|
package/dist/index.js
CHANGED
@@ -2,7 +2,7 @@ export { c as authority } from './authority-fad2028d.js';
|
|
2
2
|
export { d as dataModel } from './dataModel-1fbaff40.js';
|
3
3
|
export { t as tools } from './tools-4de9d743.js';
|
4
4
|
export { v as validate } from './validate-3e15dd74.js';
|
5
|
-
export { r as request } from './request-
|
5
|
+
export { r as request } from './request-90475df7.js';
|
6
6
|
export { r as reqUrl } from './reqUrl-b17264f9.js';
|
7
7
|
import './tslib.es6-f9459658.js';
|
8
8
|
import 'dayjs';
|