impaktapps-ui-builder 0.0.377 → 0.0.378
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/impaktapps-ui-builder.es.js +15 -6
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +12 -12
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/downloadFile.d.ts +1 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +26 -16
- package/src/impaktapps-ui-builder/runtime/services/events.ts +1 -1
- package/src/impaktapps-ui-builder/runtime/services/service.ts +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const downloadFile: (obj: any) => void;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const clickDownloadLink: (response: any, service: any) => void;
|
|
@@ -22,6 +22,6 @@ declare const _default: (funcParams: funcParamsProps) => {
|
|
|
22
22
|
onReset: (functionParameters: any) => Promise<void>;
|
|
23
23
|
callHandler: (eventType: string, functionParameters?: any) => Promise<void>;
|
|
24
24
|
downloadFile: (obj: any) => void;
|
|
25
|
-
download: (response: any) => void;
|
|
25
|
+
download: (response: any, service: any) => void;
|
|
26
26
|
};
|
|
27
27
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,27 +1,37 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const downloadFile = (obj: any) => {
|
|
2
2
|
const typeArr = obj.name.split(".");
|
|
3
3
|
const data = obj.data;
|
|
4
4
|
const finalData = window.atob(data);
|
|
5
|
-
let file
|
|
6
|
-
file = new File([finalData],
|
|
7
|
-
|
|
5
|
+
let file;
|
|
6
|
+
file = new File([finalData], typeArr[typeArr.length - 1]);
|
|
7
|
+
|
|
8
8
|
const url = URL.createObjectURL(file);
|
|
9
9
|
const link = document.createElement("a");
|
|
10
|
-
link.href = typeArr[typeArr.length - 1] === 'pdf' ?'data:application/octet-stream;base64,' + data: url;
|
|
10
|
+
link.href = typeArr[typeArr.length - 1] === 'pdf' ? 'data:application/octet-stream;base64,' + data : url;
|
|
11
11
|
link.download = `${obj.name}`;
|
|
12
12
|
document.body.appendChild(link);
|
|
13
13
|
link.click();
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
URL.revokeObjectURL(url);
|
|
16
16
|
document.body.removeChild(link);
|
|
17
|
-
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const clickDownloadLink = (response: any, service) => {
|
|
20
|
+
let url = `${service.defaults.baseURL}/${response.path}`;
|
|
21
|
+
if (response?.params) {
|
|
22
|
+
const keysArray = Object.keys(response?.params);
|
|
23
|
+
keysArray.map((e, i) => {
|
|
24
|
+
if (i === 0) {
|
|
25
|
+
url = url + `?${e}=${response?.params[e]}`
|
|
26
|
+
} else {
|
|
27
|
+
url = url + `&${e}=${response?.params[e]}`
|
|
28
|
+
}
|
|
18
29
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
const link = document.createElement('a');
|
|
33
|
+
link.href = url;
|
|
34
|
+
document.body.appendChild(link);
|
|
35
|
+
link.click();
|
|
36
|
+
link.parentNode.removeChild(link);
|
|
37
|
+
};
|
|
@@ -87,7 +87,7 @@ async function executeInBuiltFunctionHandler(params: handlersProps) {
|
|
|
87
87
|
const makeFunc = eval(params.config.funcParametersCode)
|
|
88
88
|
parameter = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service);
|
|
89
89
|
}
|
|
90
|
-
params.serviceHolder[params.config.inBuiltFunctionType](parameter)
|
|
90
|
+
params.serviceHolder[params.config.inBuiltFunctionType](parameter,params.service)
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
async function executeCustomHandler(params: handlersProps) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _, { isEmpty } from "lodash";
|
|
2
|
-
import {
|
|
2
|
+
import { clickDownloadLink, downloadFile } from "./downloadFile";
|
|
3
3
|
import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
@@ -62,7 +62,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
62
62
|
let executeEventsParameters: handlersProps = {
|
|
63
63
|
config: {}, componentName: "",
|
|
64
64
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
65
|
-
serviceHolder: { downloadFile ,download}, eventGroups
|
|
65
|
+
serviceHolder: { downloadFile ,download:clickDownloadLink}, eventGroups
|
|
66
66
|
};
|
|
67
67
|
return {
|
|
68
68
|
setPage: async function () {
|
|
@@ -192,7 +192,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
192
192
|
}
|
|
193
193
|
},
|
|
194
194
|
downloadFile: downloadFile,
|
|
195
|
-
download:
|
|
195
|
+
download:clickDownloadLink,
|
|
196
196
|
};
|
|
197
197
|
};
|
|
198
198
|
|