impaktapps-ui-builder 0.0.383 → 0.0.384
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 +232 -57
- 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/builder/build/buildPop.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildStepper.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.d.ts +6 -0
- package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +6 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/downloadFile.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +5 -0
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildPop.ts +43 -0
- package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildStepper.ts +42 -0
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +8 -0
- package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +3 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +22 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +7 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.ts +42 -33
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +8 -4
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +7 -3
- package/src/impaktapps-ui-builder/builder/services/component.ts +2 -0
- package/src/impaktapps-ui-builder/builder/services/utils.ts +1 -1
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +22 -7
- package/src/impaktapps-ui-builder/runtime/services/events.ts +26 -5
- package/src/impaktapps-ui-builder/runtime/services/service.ts +52 -35
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildPopUp: (config: any, componentScope: any) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildStepper: (config: any, componentScope: any) => any;
|
|
@@ -17,6 +17,11 @@ declare const _default: (funcParams: funcParamsProps) => {
|
|
|
17
17
|
getSelectOptions: (param: any) => Promise<any>;
|
|
18
18
|
onChange: () => Promise<void>;
|
|
19
19
|
updateConfigApiBody: (paramValue: any, apiBody: any) => Promise<any>;
|
|
20
|
+
onBack: (functionParameters: any) => Promise<void>;
|
|
21
|
+
onNext: (functionParameters: any) => Promise<void>;
|
|
22
|
+
onReset: (functionParameters: any) => Promise<void>;
|
|
23
|
+
callHandler: (eventType: string, functionParameters?: any) => Promise<void>;
|
|
20
24
|
downloadFile: (obj: any) => void;
|
|
25
|
+
download: (response: any, service: any) => void;
|
|
21
26
|
};
|
|
22
27
|
export default _default;
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ const FileInput = {
|
|
|
24
24
|
export const buildFileInput = (config,componentScope) => {
|
|
25
25
|
const box: any = _.cloneDeep(FileInput);
|
|
26
26
|
box.scope = componentScope;
|
|
27
|
-
box.config.main.
|
|
27
|
+
box.config.main.label = config.label
|
|
28
28
|
if(config.layout){
|
|
29
29
|
box.config.layout = createLayoutFormat(config.layout)
|
|
30
30
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createLayoutFormat } from "./buildConfig";
|
|
2
|
+
import WrapperSection from "./uischema/wrapperSection";
|
|
3
|
+
import _ from "lodash";
|
|
4
|
+
|
|
5
|
+
const PopUP = {
|
|
6
|
+
type: "Control",
|
|
7
|
+
scope: "#/properties/text",
|
|
8
|
+
options: {
|
|
9
|
+
widget: "PopUp",
|
|
10
|
+
},
|
|
11
|
+
config: {
|
|
12
|
+
layout: {
|
|
13
|
+
xs: 12,
|
|
14
|
+
sm: 12,
|
|
15
|
+
md: 12,
|
|
16
|
+
lg: 12,
|
|
17
|
+
},
|
|
18
|
+
main: {
|
|
19
|
+
label: "PopUp",
|
|
20
|
+
fullScreen:false,
|
|
21
|
+
fullWidth:false,
|
|
22
|
+
maxWidth:false,
|
|
23
|
+
alignItems:false,
|
|
24
|
+
spacing:2
|
|
25
|
+
},
|
|
26
|
+
style:{}
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
export const buildPopUp = (config,componentScope) =>{
|
|
30
|
+
const popup: any = _.cloneDeep(PopUP);
|
|
31
|
+
popup.scope = componentScope;
|
|
32
|
+
popup.config.main.title = config.label;
|
|
33
|
+
popup.config.main.fullScreen = config.fullScreen === "YES" ? true : false;
|
|
34
|
+
popup.config.main.fullWidth = config.fullWidth === "YES" ? true : false;
|
|
35
|
+
popup.config.main.maxWidth = config.maxWidth||false;
|
|
36
|
+
if (config.layout) {
|
|
37
|
+
popup.config.layout = createLayoutFormat(config.layout)
|
|
38
|
+
}
|
|
39
|
+
if (config.style) {
|
|
40
|
+
PopUP.config.style = JSON.parse(config.style)
|
|
41
|
+
}
|
|
42
|
+
return popup;
|
|
43
|
+
}
|
|
@@ -21,7 +21,7 @@ const RadioUiSchema = {
|
|
|
21
21
|
export const buildRadio = (config,componentScope) => {
|
|
22
22
|
const Radio: any = _.cloneDeep(RadioUiSchema);
|
|
23
23
|
Radio.scope = componentScope;
|
|
24
|
-
Radio.config.main.
|
|
24
|
+
Radio.config.main.label = config.label
|
|
25
25
|
if(config.layout){
|
|
26
26
|
Radio.config.layout = createLayoutFormat(config.layout)
|
|
27
27
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { createLayoutFormat } from "./buildConfig";
|
|
3
|
+
|
|
4
|
+
const Stepper = {
|
|
5
|
+
type: "Control",
|
|
6
|
+
scope: "#/properties/Stepper",
|
|
7
|
+
options: {
|
|
8
|
+
widget: "Stepper",
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
config: {
|
|
12
|
+
main: {
|
|
13
|
+
steps:[{label:"First"}, {label:"Second"},{label: "Third"}],
|
|
14
|
+
resetButton: false,
|
|
15
|
+
resetText: "Reset",
|
|
16
|
+
orientation: "vertical"
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
"elements":
|
|
20
|
+
[],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const buildStepper = (config, componentScope) => {
|
|
24
|
+
const stepper: any = _.cloneDeep(Stepper);
|
|
25
|
+
stepper.scope = componentScope;
|
|
26
|
+
stepper.config.main.resetButton = config.resetButton === "YES" ? true : false;
|
|
27
|
+
stepper.config.main.resetText = config.resetText || "ResetData";
|
|
28
|
+
stepper.config.main.completeText = config.completeText || "Complete Text";
|
|
29
|
+
stepper.config.main.orientation = config.orientation || "horizontal";
|
|
30
|
+
if (config.sectionLabels) {
|
|
31
|
+
stepper.config.main.label = config.sectionLabels.map((e, i: number) => {
|
|
32
|
+
return { label: e.label, id: i }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (config.layout) {
|
|
36
|
+
stepper.config.layout = createLayoutFormat(config.layout)
|
|
37
|
+
}
|
|
38
|
+
if (config.style) {
|
|
39
|
+
stepper.config.style = JSON.parse(config.style)
|
|
40
|
+
}
|
|
41
|
+
return stepper;
|
|
42
|
+
}
|
|
@@ -34,6 +34,8 @@ import { buildEmptyBox } from "./buildEmptyBox";
|
|
|
34
34
|
import { buildArray } from "./buildArray";
|
|
35
35
|
import { buildAdhaarField, buildPanField } from "./buildAadharCard";
|
|
36
36
|
import { buildFileInput } from "./buildFileInput";
|
|
37
|
+
import { buildStepper } from "./buildStepper";
|
|
38
|
+
import { buildPopUp } from "./buildPop";
|
|
37
39
|
export let schema = {
|
|
38
40
|
type: "object",
|
|
39
41
|
properties: {},
|
|
@@ -164,6 +166,12 @@ const buildUiSchema = (config: any) => {
|
|
|
164
166
|
let elements: any = {};
|
|
165
167
|
const componentScope = `#/properties/${config.name}`;
|
|
166
168
|
switch (config.type) {
|
|
169
|
+
case "Stepper":
|
|
170
|
+
elements = buildStepper(config, componentScope);
|
|
171
|
+
break;
|
|
172
|
+
case "PopUp":
|
|
173
|
+
elements = buildPopUp(config, componentScope);
|
|
174
|
+
break;
|
|
167
175
|
case "FileInput":
|
|
168
176
|
elements = buildFileInput(config, componentScope);
|
|
169
177
|
break;
|
|
@@ -5,5 +5,8 @@ export const buildWrapperSection = (config,componentScope) =>{
|
|
|
5
5
|
const wrapper: any = _.cloneDeep(WrapperSection);
|
|
6
6
|
wrapper.config.main.label = config.label;
|
|
7
7
|
wrapper.config.main.divider = config.divider === "YES" ? true : false;
|
|
8
|
+
if (config.style) {
|
|
9
|
+
wrapper.config.style = JSON.parse(config.style)
|
|
10
|
+
}
|
|
8
11
|
return wrapper;
|
|
9
12
|
}
|
|
@@ -160,6 +160,28 @@ const GraphSection = {
|
|
|
160
160
|
export const buildPropertiesSection = function (type: String) {
|
|
161
161
|
let uiSchema = _.cloneDeep(GraphSection);
|
|
162
162
|
switch (type) {
|
|
163
|
+
case "Stepper":
|
|
164
|
+
uiSchema.elements = [
|
|
165
|
+
getRadioInputField("resetButton", "Reset Button", ["YES", "NO"]),
|
|
166
|
+
getInputField("resetText", "Reset Text"),
|
|
167
|
+
getInputField("completeText", "Complete Text"),
|
|
168
|
+
getSelectField("orientation", "Orientation Type", [
|
|
169
|
+
{ label: "Horizontal", value: "horizontal" },
|
|
170
|
+
{ label: "Vertical", value: "vertical" },
|
|
171
|
+
]),
|
|
172
|
+
EmptyBox,
|
|
173
|
+
getArrayControl("sectionLabels", "label")
|
|
174
|
+
|
|
175
|
+
]
|
|
176
|
+
break;
|
|
177
|
+
case "PopUp":
|
|
178
|
+
uiSchema.elements = [
|
|
179
|
+
getRadioInputField("fullScreen", "FullScreen", ["YES", "NO"]),
|
|
180
|
+
getRadioInputField("fullWidth", "FullWidth", ["YES", "NO"]),
|
|
181
|
+
getInputField("maxWidth", "Max. Width"),
|
|
182
|
+
EmptyBox
|
|
183
|
+
]
|
|
184
|
+
break;
|
|
163
185
|
case "Text":
|
|
164
186
|
uiSchema.elements = [
|
|
165
187
|
getInputField("placeholder", "Placeholder"),
|
|
@@ -19,11 +19,13 @@ export const ComponentSchema: any = {
|
|
|
19
19
|
{ title: "LeaderBoard", const: "LeaderBoard" },
|
|
20
20
|
{ title: "MultipleSelect", const: "MultipleSelect" },
|
|
21
21
|
{ title: "PanCardText", const: "PanCardText" },
|
|
22
|
+
{ title: "Popup Container", const: "PopUp" },
|
|
22
23
|
{ title: "ProgressBar", const: "ProgressBar" },
|
|
23
24
|
{ title: "ProgressBar Card", const: "ProgressBarCard" },
|
|
24
25
|
{ title: "Select", const: "Select" },
|
|
25
26
|
{ title: "Slider", const: "Slider" },
|
|
26
27
|
{ title: "SpeedoMeter", const: "SpeedoMeter" },
|
|
28
|
+
{ title: "Stepper Container", const: "Stepper" },
|
|
27
29
|
{ title: "Radio", const: "Radio" },
|
|
28
30
|
{ title: "Rank", const: "Rank" },
|
|
29
31
|
{ title: "Rank Card", const: "RankCard" },
|
|
@@ -35,6 +37,11 @@ export const ComponentSchema: any = {
|
|
|
35
37
|
{ title: "Timer", const: "Timer" },
|
|
36
38
|
{ title: "Upload File", const: "UploadFile" },]
|
|
37
39
|
},
|
|
40
|
+
orientation:{
|
|
41
|
+
oneOf: [
|
|
42
|
+
{ title: "Horizontal", const: "horizontal" },
|
|
43
|
+
{ title: "Vertical", const: "vertical" },
|
|
44
|
+
]},
|
|
38
45
|
method: {
|
|
39
46
|
type: "string",
|
|
40
47
|
oneOf: [
|
|
@@ -1,39 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { template } from "lodash";
|
|
2
|
+
|
|
3
|
+
export const PageMasterSchema = {
|
|
4
|
+
type: "object",
|
|
5
|
+
properties: {
|
|
6
|
+
name: {
|
|
7
|
+
type: "string",
|
|
8
|
+
minLength: 6,
|
|
9
|
+
// pattern: '^page_\\w+$'
|
|
10
|
+
},
|
|
11
|
+
label: {
|
|
12
|
+
type: "string",
|
|
13
|
+
},
|
|
14
|
+
layout: {
|
|
15
|
+
type: "array",
|
|
16
|
+
items: {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {
|
|
19
|
+
layout_key: {
|
|
20
|
+
type: "string",
|
|
21
|
+
},
|
|
22
|
+
layout_value: {
|
|
23
|
+
type: "string",
|
|
23
24
|
},
|
|
24
25
|
},
|
|
25
26
|
},
|
|
27
|
+
},
|
|
28
|
+
template: {
|
|
29
|
+
oneOf: [
|
|
30
|
+
{ const: "template1", title: "template1" },
|
|
31
|
+
{ const: "template2", title: "template2" },
|
|
32
|
+
{ const: "template3", title: "template3" }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
26
35
|
sectionLabels: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
36
|
+
type: "array",
|
|
37
|
+
items: {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: {
|
|
40
|
+
label: {
|
|
41
|
+
type: "string",
|
|
42
|
+
}
|
|
35
43
|
},
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
required: ["template", "name"]
|
|
39
48
|
}
|
|
@@ -80,16 +80,20 @@ export const PageMasterUiSchema: any = {
|
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
type: "Control",
|
|
83
|
-
scope: "#/properties/
|
|
83
|
+
scope: "#/properties/template",
|
|
84
84
|
|
|
85
85
|
options: {
|
|
86
|
-
widget: "
|
|
86
|
+
widget: "SelectInputField",
|
|
87
87
|
},
|
|
88
88
|
config: {
|
|
89
89
|
layout: { xs: 11, sm: 11, md: 5.5, lg: 5.5 },
|
|
90
90
|
main: {
|
|
91
|
-
label: "
|
|
92
|
-
options: [
|
|
91
|
+
label: "Template",
|
|
92
|
+
options: [
|
|
93
|
+
{const:"template1",title:"template1"},
|
|
94
|
+
{const:"template2",title:"template2"},
|
|
95
|
+
{const:"template3",title:"template3"}
|
|
96
|
+
],
|
|
93
97
|
color: "secondary",
|
|
94
98
|
required: true,
|
|
95
99
|
},
|
|
@@ -39,12 +39,15 @@ export const EventSchema = {
|
|
|
39
39
|
type: "string",
|
|
40
40
|
oneOf: [
|
|
41
41
|
{ title: "Click Event", const: "onClick" },
|
|
42
|
-
{ title: "onStart", const: "onStart" },
|
|
43
42
|
{ title: "Load Event", const: "onLoad" },
|
|
44
|
-
{ title: "File Upload Event", const: "onUpload" },
|
|
45
|
-
{ title: "File Download Event", const: "onDownload" },
|
|
46
43
|
{ title: "Change Event", const: "onChange" },
|
|
47
44
|
{ title: "Success", const: "Success" },
|
|
45
|
+
{ title: "onStart", const: "onStart" },
|
|
46
|
+
|
|
47
|
+
{ title: "File Upload Event", const: "onUpload" },
|
|
48
|
+
{ title: "Back Event", const: "onBack" },
|
|
49
|
+
{ title: "Next Event", const: "onNext" },
|
|
50
|
+
{ title: "File Download Event", const: "onDownload" },
|
|
48
51
|
{ title: "Fail", const: "Fail" }
|
|
49
52
|
]
|
|
50
53
|
},
|
|
@@ -62,6 +65,7 @@ export const EventSchema = {
|
|
|
62
65
|
oneOf: [
|
|
63
66
|
{ title: "RankProvider", const: "RankProvider" },
|
|
64
67
|
{ title: "Download File", const: "downloadFile" },
|
|
68
|
+
{ title: "Download", const: "download" },
|
|
65
69
|
]
|
|
66
70
|
},
|
|
67
71
|
body: {
|
|
@@ -33,6 +33,8 @@ const sectionLabels = {
|
|
|
33
33
|
Radio:["Core", "Properties", "style", "Event","Validation"],
|
|
34
34
|
Text:["Core","Properties","style", "Event","Validation"],
|
|
35
35
|
TextArea:["Core","Properties","style", "Event","Validation"],
|
|
36
|
+
PopUp: ["Core", "Components","Properties", "style"],
|
|
37
|
+
Stepper: ["Core", "Components","Properties","Event", "style"],
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
|
|
@@ -65,7 +65,7 @@ export async function saveHandler(store, service, submitHandler, pageName?: stri
|
|
|
65
65
|
if (_.isEmpty(store.ctx.core.errors)) {
|
|
66
66
|
try {
|
|
67
67
|
const saveReturn = await submitHandler(store, service, config);
|
|
68
|
-
navigateHandler(store, true, pageName ? `/${pageName}?id=${
|
|
68
|
+
navigateHandler(store, true, pageName ? `/${pageName}?id=${id}` : "/PageMasterRecords")
|
|
69
69
|
} catch (err) {
|
|
70
70
|
navigateHandler(store, false)
|
|
71
71
|
}
|
|
@@ -1,17 +1,32 @@
|
|
|
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 doDownload = (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
|
+
url = url + `${i === 0?"?":"&"}${e}=${response?.params[e]}`
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
const link = document.createElement('a');
|
|
28
|
+
link.href = url;
|
|
29
|
+
document.body.appendChild(link);
|
|
30
|
+
link.click();
|
|
31
|
+
link.parentNode.removeChild(link);
|
|
32
|
+
};
|
|
@@ -44,9 +44,18 @@ async function executeEventsHandler(params: handlersProps) {
|
|
|
44
44
|
}
|
|
45
45
|
else if (params.config.Handler === "mergeFormdata") {
|
|
46
46
|
const result = await mergeFormdata(
|
|
47
|
-
params.parentEventOutput, params.componentName, params.config, params.store,params.service)
|
|
47
|
+
params.parentEventOutput, params.componentName, params.config, params.store, params.service)
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
|
+
else if (params.config.Handler === "onBackHandler") {
|
|
51
|
+
return params.store.functionParameters?.handleBack()
|
|
52
|
+
}
|
|
53
|
+
else if (params.config.Handler === "onNextHandler") {
|
|
54
|
+
return params.store.functionParameters?.handleNext()
|
|
55
|
+
}
|
|
56
|
+
else if (params.config.Handler === "onResetHandler") {
|
|
57
|
+
return params.store.functionParameters?.handleReset()
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
60
|
export async function executeRefreshHandler(params: handlersProps) {
|
|
52
61
|
const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups)
|
|
@@ -87,7 +96,7 @@ async function executeCustomHandler(params: handlersProps) {
|
|
|
87
96
|
return response;
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any,service:any) {
|
|
99
|
+
async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any) {
|
|
91
100
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
92
101
|
store.setSchema((pre) => {
|
|
93
102
|
return {
|
|
@@ -108,7 +117,7 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
|
|
|
108
117
|
...pre.properties?.[componentName],
|
|
109
118
|
type: "array",
|
|
110
119
|
items: {
|
|
111
|
-
oneOf: handlerResponse
|
|
120
|
+
oneOf: handlerResponse?.data
|
|
112
121
|
}
|
|
113
122
|
}
|
|
114
123
|
}
|
|
@@ -123,7 +132,7 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
|
|
|
123
132
|
else {
|
|
124
133
|
if (handlerResponse) {
|
|
125
134
|
store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse.data.data : handlerResponse.data } });
|
|
126
|
-
const demoData =
|
|
135
|
+
const demoData = await asyncOperation();
|
|
127
136
|
}
|
|
128
137
|
}
|
|
129
138
|
}
|
|
@@ -165,7 +174,7 @@ async function shouldEventExecute(params: handlersProps) {
|
|
|
165
174
|
if (startEvent?.length > 0) {
|
|
166
175
|
const response = await executeEventsHandler({ ...params, config: startEvent[0] });
|
|
167
176
|
return response;
|
|
168
|
-
}else{
|
|
177
|
+
} else {
|
|
169
178
|
return true
|
|
170
179
|
}
|
|
171
180
|
}
|
|
@@ -203,3 +212,15 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
|
203
212
|
return result;
|
|
204
213
|
}
|
|
205
214
|
|
|
215
|
+
|
|
216
|
+
function asyncOperation() {
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
setTimeout(() => {
|
|
219
|
+
const success = true;
|
|
220
|
+
if (success) {
|
|
221
|
+
resolve("Operation completed successfully!");
|
|
222
|
+
reject(new Error("Operation failed!"));
|
|
223
|
+
}
|
|
224
|
+
}, 50);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
import { downloadFile } from "./downloadFile";
|
|
1
|
+
import _, { isEmpty } from "lodash";
|
|
2
|
+
import { doDownload, downloadFile } from "./downloadFile";
|
|
3
3
|
import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
@@ -30,7 +30,10 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
30
30
|
return elem.eventType === "Success"
|
|
31
31
|
})
|
|
32
32
|
if (!(!!SuccessEvent) && event.eventType === "onLoad") {
|
|
33
|
-
event.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType,lazyLoading:eventConfig.lazyLoading==="YES"?true:false })
|
|
33
|
+
event.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false })
|
|
34
|
+
}
|
|
35
|
+
if (!(!!SuccessEvent) && (event.eventType === "onBack" || event.eventType === "onNext"|| event.eventType === "onReset")) {
|
|
36
|
+
event.events.push({ Handler: `${event.eventType}Handler`, eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false })
|
|
34
37
|
}
|
|
35
38
|
eventGroups[event.eventType][eventConfigObj.name].push({ ...event, type: compType })
|
|
36
39
|
});
|
|
@@ -59,7 +62,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
59
62
|
let executeEventsParameters: handlersProps = {
|
|
60
63
|
config: {}, componentName: "",
|
|
61
64
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
62
|
-
serviceHolder: {downloadFile}, eventGroups
|
|
65
|
+
serviceHolder: { downloadFile,download:doDownload }, eventGroups
|
|
63
66
|
};
|
|
64
67
|
return {
|
|
65
68
|
setPage: async function () {
|
|
@@ -76,54 +79,33 @@ export default (funcParams: funcParamsProps) => {
|
|
|
76
79
|
{ ...funcParams.schema.properties, ...pre.properties, }
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
|
-
|
|
82
|
+
)
|
|
80
83
|
funcParams.uiSchema.elements.push(notifyUiSchema);
|
|
81
84
|
funcParams.store.setUiSchema(funcParams.uiSchema);
|
|
82
|
-
await executeRefreshHandler(
|
|
85
|
+
await executeRefreshHandler({
|
|
83
86
|
config: {}, componentName: "",
|
|
84
87
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
85
88
|
serviceHolder: this, eventGroups
|
|
86
89
|
})
|
|
87
90
|
},
|
|
88
91
|
onClick: async function () {
|
|
89
|
-
|
|
90
|
-
for (const eventConfig of eventGroups?.onClick[path]) {
|
|
91
|
-
await executeEvents({
|
|
92
|
-
...executeEventsParameters,
|
|
93
|
-
config: eventConfig,
|
|
94
|
-
componentName: path
|
|
95
|
-
})
|
|
96
|
-
}
|
|
92
|
+
await this.callHandler("onClick")
|
|
97
93
|
},
|
|
98
|
-
onFileDownload:async ()
|
|
99
|
-
|
|
100
|
-
for (const eventConfig of eventGroups?.onDownload[path]) {
|
|
101
|
-
await executeEvents({
|
|
102
|
-
...executeEventsParameters,
|
|
103
|
-
config: eventConfig,
|
|
104
|
-
componentName: path
|
|
105
|
-
})
|
|
106
|
-
}
|
|
94
|
+
onFileDownload: async function () {
|
|
95
|
+
await this.callHandler("onDownload")
|
|
107
96
|
},
|
|
108
|
-
onFileUpload:async ()
|
|
109
|
-
|
|
110
|
-
for (const eventConfig of eventGroups?.onUpload[path]) {
|
|
111
|
-
await executeEvents({
|
|
112
|
-
...executeEventsParameters,
|
|
113
|
-
config: eventConfig,
|
|
114
|
-
componentName: path
|
|
115
|
-
})
|
|
116
|
-
}
|
|
97
|
+
onFileUpload: async function () {
|
|
98
|
+
await this.callHandler("onUpload")
|
|
117
99
|
},
|
|
118
100
|
onPaginationChange: async function (paginationValues) {
|
|
119
101
|
const apiBody = [
|
|
120
102
|
{ key: "size", value: paginationValues.pagination.pageSize },
|
|
121
|
-
{ key: "pageIndex", value: paginationValues.pagination.pageIndex
|
|
103
|
+
{ key: "pageIndex", value: paginationValues.pagination.pageIndex },
|
|
122
104
|
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
123
105
|
{ key: "filters", value: paginationValues.columnFilters || [] },
|
|
124
106
|
{ key: "globalFilter", value: paginationValues.globalFilter ?? '' }
|
|
125
107
|
]
|
|
126
|
-
const response =
|
|
108
|
+
const response = await this.updateConfigApiBody(paginationValues, apiBody);
|
|
127
109
|
return response?.data;
|
|
128
110
|
},
|
|
129
111
|
getSelectOptions: async function (param) {
|
|
@@ -175,7 +157,42 @@ export default (funcParams: funcParamsProps) => {
|
|
|
175
157
|
}
|
|
176
158
|
return LastCallResponse
|
|
177
159
|
},
|
|
178
|
-
|
|
160
|
+
onBack: async function (functionParameters) {
|
|
161
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
162
|
+
await this.callHandler("onBack", functionParameters)
|
|
163
|
+
if (eventGroups?.["onBack"]?.[path] === undefined) {
|
|
164
|
+
functionParameters?.handleBack()
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
onNext: async function (functionParameters) {
|
|
168
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
169
|
+
await this.callHandler("onNext", functionParameters)
|
|
170
|
+
if (eventGroups?.["onNext"]?.[path] === undefined) {
|
|
171
|
+
functionParameters?.handleNext()
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
onReset: async function (functionParameters) {
|
|
175
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
176
|
+
await this.callHandler("onReset", functionParameters)
|
|
177
|
+
if (eventGroups?.["onReset"]?.[path] === undefined) {
|
|
178
|
+
functionParameters?.handleReset()
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
callHandler: async function (eventType: string, functionParameters?: any) {
|
|
182
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
183
|
+
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
184
|
+
for (const eventConfig of eventGroups?.[eventType]?.[path]) {
|
|
185
|
+
executeEventsParameters.store.functionParameters = functionParameters
|
|
186
|
+
await executeEvents({
|
|
187
|
+
...executeEventsParameters,
|
|
188
|
+
config: eventConfig,
|
|
189
|
+
componentName: path
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
downloadFile: downloadFile,
|
|
195
|
+
download:doDownload,
|
|
179
196
|
};
|
|
180
197
|
};
|
|
181
198
|
|