ztxkui 10.0.50 → 10.0.51

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.
@@ -0,0 +1,9 @@
1
+ interface IOptions {
2
+ apiUrl: string;
3
+ fileUrl: string;
4
+ fileName: string;
5
+ fileType: string;
6
+ fileId: string;
7
+ }
8
+ export default function flutterShare(options: IOptions): void;
9
+ export {};
@@ -0,0 +1,25 @@
1
+ import JsBridge from './flutterBridge';
2
+ export default function flutterShare(options) {
3
+ var apiUrl = options.apiUrl, fileUrl = options.fileUrl, fileName = options.fileName, _a = options.fileType, fileType = _a === void 0 ? 'pdf' : _a, fileId = options.fileId;
4
+ var jsBridgeObj = window.jsBridgeObj
5
+ ? window.jsBridgeObj
6
+ : new JsBridge({
7
+ ZT_API_BASEURL: apiUrl,
8
+ });
9
+ if (!window.jsBridgeObj) {
10
+ window.jsBridgeObj = jsBridgeObj;
11
+ }
12
+ // jsBridgeObj.shareFile({
13
+ // shareFileDownloadUrl: fileUrl,
14
+ // fileName: fileName,
15
+ // fileType: fileType,
16
+ // fileId: fileId,
17
+ // });
18
+ jsBridgeObj.previewFile({
19
+ uri: fileUrl,
20
+ fileName: fileName,
21
+ fileType: fileType,
22
+ fileId: fileId,
23
+ needToShare: true,
24
+ });
25
+ }
@@ -49,7 +49,7 @@ import { jsPDF } from 'jspdf';
49
49
  import html2canvas from 'html2canvas';
50
50
  import { uploadFile } from './service';
51
51
  import { getToken } from 'ztxkutils/dist/authority';
52
- import JsBridge from './flutterBridge';
52
+ import flutterShare from './flutterBridgeShare';
53
53
  function createDownloadUrl(apiUrl, fileId, otherOptions) {
54
54
  var token = getToken();
55
55
  var _apiUrl = apiUrl.endsWith('/')
@@ -86,13 +86,26 @@ export function fileShare(_a) {
86
86
  })) === null || _b === void 0 ? void 0 : _b.then(function (res) {
87
87
  var attachId = res.attachId;
88
88
  var url = createDownloadUrl(apiUrl, attachId);
89
- jsBridgeObj.previewFile({
90
- shareFileDownloadUrl: url,
89
+ // jsBridgeObj.shareFile({
90
+ // shareFileDownloadUrl: url,
91
+ // fileName: `${newFileName}.pdf`,
92
+ // fileType: 'pdf',
93
+ // fileId: attachId,
94
+ // });
95
+ flutterShare({
96
+ apiUrl: apiUrl,
97
+ fileUrl: url,
91
98
  fileName: newFileName + ".pdf",
92
99
  fileType: 'pdf',
93
100
  fileId: attachId,
94
- needToShare: true,
95
101
  });
102
+ // jsBridgeObj.previewFile({
103
+ // uri: url,
104
+ // fileName: `${newFileName}.pdf`,
105
+ // fileType: 'pdf',
106
+ // fileId: attachId,
107
+ // needToShare: true,
108
+ // });
96
109
  });
97
110
  }
98
111
  export function htmlToPdf(_a) {
@@ -40,7 +40,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  */
41
41
  import { message } from '../../index';
42
42
  import { getToken } from 'ztxkutils/dist/authority';
43
- import JsBridge from './flutterBridge';
43
+ // import JsBridge from './flutterBridge';
44
+ import flutterShare from './flutterBridgeShare';
44
45
  function createDownloadUrl(apiUrl, fileId, otherOptions) {
45
46
  var token = getToken();
46
47
  var _apiUrl = apiUrl.endsWith('/')
@@ -97,18 +98,25 @@ export function autoSealThenDownloadFilesHandle(request, formData, options) {
97
98
  ? fileNameStr === null || fileNameStr === void 0 ? void 0 : fileNameStr.replace(/"/g, '')
98
99
  : '';
99
100
  var url = createDownloadUrl(apiUrl, attachId);
100
- var jsBridgeObj = window.jsBridgeObj
101
- ? window.jsBridgeObj
102
- : new JsBridge({
103
- ZT_API_BASEURL: apiUrl,
104
- });
105
- jsBridgeObj === null || jsBridgeObj === void 0 ? void 0 : jsBridgeObj.previewFile({
106
- shareFileDownloadUrl: url,
101
+ flutterShare({
102
+ apiUrl: apiUrl,
103
+ fileUrl: url,
107
104
  fileName: fileName_1,
108
105
  fileType: 'pdf',
109
106
  fileId: attachId,
110
- needToShare: true,
111
107
  });
108
+ // const jsBridgeObj = (window as any).jsBridgeObj
109
+ // ? (window as any).jsBridgeObj
110
+ // : new JsBridge({
111
+ // ZT_API_BASEURL: apiUrl,
112
+ // });
113
+ // jsBridgeObj?.previewFile({
114
+ // shareFileDownloadUrl: url,
115
+ // fileName: fileName,
116
+ // fileType: 'pdf',
117
+ // fileId: attachId,
118
+ // needToShare: true,
119
+ // });
112
120
  }
113
121
  }).catch(function (err) {
114
122
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "10.0.50",
3
+ "version": "10.0.51",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",