impaktapps-ui-builder 0.0.412-mtreemap.2 → 0.0.412-mtreemap.21
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 +728 -366
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +13 -13
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.d.ts +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/button.d.ts +1 -6
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +12 -10
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/coreSection.d.ts +5 -5
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/file.d.ts +6 -6
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.d.ts +8 -5
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +4 -2
- package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +3 -2
- package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +3 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.ts +2 -2
- package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +4 -4
- package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildHorizontalBarGraph.ts +27 -26
- package/src/impaktapps-ui-builder/builder/build/buildPieGraph.ts +2 -0
- package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +2 -2
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +39 -38
- package/src/impaktapps-ui-builder/builder/build/uischema/button.ts +2 -7
- package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +10 -9
- package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +21 -28
- package/src/impaktapps-ui-builder/builder/build/uischema/dateInputField.ts +3 -8
- package/src/impaktapps-ui-builder/builder/build/uischema/eventSection.ts +155 -102
- package/src/impaktapps-ui-builder/builder/build/uischema/file.ts +2 -12
- package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.ts +9 -5
- package/src/impaktapps-ui-builder/builder/build/uischema/refresh.ts +14 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/valueTab.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.ts +1 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +0 -2
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +495 -283
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.ts +1 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +346 -208
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +70 -23
- package/src/impaktapps-ui-builder/builder/services/component.ts +39 -21
- package/src/impaktapps-ui-builder/builder/services/event.ts +16 -6
- package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +18 -2
- package/src/impaktapps-ui-builder/runtime/services/events.ts +28 -33
- package/src/impaktapps-ui-builder/runtime/services/service.ts +112 -4
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getSelectField } from "../../../build/uischema/buildPropertiesSection";
|
|
2
|
+
|
|
1
3
|
export const EventUiSchema: any = (theme) => {
|
|
2
4
|
const uiSchema = {
|
|
3
5
|
type: "HorizontalLayout",
|
|
@@ -106,33 +108,77 @@ export const EventUiSchema: any = (theme) => {
|
|
|
106
108
|
},
|
|
107
109
|
},
|
|
108
110
|
},
|
|
111
|
+
getSelectField("Handler", "Handler", [
|
|
112
|
+
{ label: "Custom", value: "custom" },
|
|
113
|
+
{ label: "Api", value: "api" },
|
|
114
|
+
{ label: "Inbuilt Function", value: "inBuiltFunction" },
|
|
115
|
+
{ label: "Refresh", value: "refresh" },
|
|
116
|
+
]),
|
|
109
117
|
{
|
|
110
118
|
type: "Control",
|
|
111
|
-
scope:
|
|
112
|
-
|
|
119
|
+
scope: "#/properties/EmptyBox",
|
|
113
120
|
options: {
|
|
114
|
-
widget: "
|
|
121
|
+
widget: "EmptyBox",
|
|
115
122
|
},
|
|
116
123
|
config: {
|
|
117
|
-
layout: { xs:
|
|
118
|
-
main: {
|
|
119
|
-
label: "Handler",
|
|
120
|
-
type: "text",
|
|
121
|
-
},
|
|
124
|
+
layout: { xs: 0, sm: 4, md: 4, lg: 4 },
|
|
122
125
|
},
|
|
123
126
|
},
|
|
124
|
-
{
|
|
125
|
-
type: "Control",
|
|
126
|
-
scope: "#/properties/emptyBox",
|
|
127
|
-
options: {
|
|
128
|
-
widget: "EmptyBox"
|
|
129
|
-
},
|
|
130
|
-
config: {
|
|
131
|
-
layout: { xs: 0, sm: 4 }
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
127
|
],
|
|
135
128
|
},
|
|
129
|
+
// {
|
|
130
|
+
// type: "WrapperLayout",
|
|
131
|
+
// config: {
|
|
132
|
+
// main: {
|
|
133
|
+
// // label: "Success Case Event",
|
|
134
|
+
// // divider: true,
|
|
135
|
+
// },
|
|
136
|
+
// wrapperStyle: {
|
|
137
|
+
// border: "1px solid gray"
|
|
138
|
+
// },
|
|
139
|
+
// },
|
|
140
|
+
// elements: [
|
|
141
|
+
// {
|
|
142
|
+
// type: "Control",
|
|
143
|
+
// scope: "#/properties/heading",
|
|
144
|
+
|
|
145
|
+
// options: {
|
|
146
|
+
// widget: "Box",
|
|
147
|
+
// },
|
|
148
|
+
// config: {
|
|
149
|
+
// layout: 8,
|
|
150
|
+
// main: {
|
|
151
|
+
// heading: "Response Event",
|
|
152
|
+
// },
|
|
153
|
+
// style: {
|
|
154
|
+
// fontFamily: "Roboto",
|
|
155
|
+
// fontWeight: "500",
|
|
156
|
+
// paddingLeft: "-10px",
|
|
157
|
+
// fontSize: "20px",
|
|
158
|
+
// },
|
|
159
|
+
// },
|
|
160
|
+
// },
|
|
161
|
+
// {
|
|
162
|
+
// type: "Control",
|
|
163
|
+
// scope: "#/properties/AddButton",
|
|
164
|
+
// options: {
|
|
165
|
+
// widget: "IconButton",
|
|
166
|
+
// },
|
|
167
|
+
// config: {
|
|
168
|
+
// layout: 3,
|
|
169
|
+
// main: {
|
|
170
|
+
// icon: "AddIcon",
|
|
171
|
+
// styleDefault: true,
|
|
172
|
+
// size: "small",
|
|
173
|
+
// onClick: "addEvent",
|
|
174
|
+
// tooltipMessage: "Back",
|
|
175
|
+
// },
|
|
176
|
+
// style: {
|
|
177
|
+
// float: "right",
|
|
178
|
+
// },
|
|
179
|
+
// },
|
|
180
|
+
// },
|
|
181
|
+
|
|
136
182
|
{
|
|
137
183
|
type: "Control",
|
|
138
184
|
scope: "#/properties/events",
|
|
@@ -195,7 +241,7 @@ export const EventUiSchema: any = (theme) => {
|
|
|
195
241
|
},
|
|
196
242
|
config: {
|
|
197
243
|
main: {
|
|
198
|
-
|
|
244
|
+
color: "info",
|
|
199
245
|
size: "small",
|
|
200
246
|
icon: "EditIcon",
|
|
201
247
|
tooltipMessage: "Edit This Record",
|
|
@@ -227,6 +273,7 @@ export const EventUiSchema: any = (theme) => {
|
|
|
227
273
|
},
|
|
228
274
|
},
|
|
229
275
|
]
|
|
276
|
+
// }]
|
|
230
277
|
}
|
|
231
278
|
],
|
|
232
279
|
},
|
|
@@ -323,7 +370,7 @@ export const EventUiSchema: any = (theme) => {
|
|
|
323
370
|
},
|
|
324
371
|
elements: [
|
|
325
372
|
{
|
|
326
|
-
|
|
373
|
+
|
|
327
374
|
type: "Control",
|
|
328
375
|
scope: "#/properties/FooterText",
|
|
329
376
|
options: {
|
|
@@ -378,7 +425,7 @@ export const EventUiSchema: any = (theme) => {
|
|
|
378
425
|
{
|
|
379
426
|
type: "Control",
|
|
380
427
|
scope: "#/properties/text",
|
|
381
|
-
|
|
428
|
+
|
|
382
429
|
options: {
|
|
383
430
|
widget: "Box",
|
|
384
431
|
},
|
|
@@ -410,5 +457,5 @@ export const EventUiSchema: any = (theme) => {
|
|
|
410
457
|
}
|
|
411
458
|
],
|
|
412
459
|
};
|
|
413
|
-
return uiSchema
|
|
414
|
-
}
|
|
460
|
+
return uiSchema;
|
|
461
|
+
}
|
|
@@ -43,25 +43,25 @@ const sectionLabels = {
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
export const refreshPage = (type:string,store:any) => {
|
|
46
|
+
export const refreshPage = (type: string, store: any) => {
|
|
47
47
|
const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
|
|
48
|
-
if(type){
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
if (type) {
|
|
49
|
+
const sectionUiSchema = {
|
|
50
|
+
Core: CoreSection,
|
|
51
|
+
Value: ValueTab,
|
|
52
|
+
Style: StyleSection,
|
|
53
|
+
Event: EventSection,
|
|
54
|
+
Components: TableSection,
|
|
55
|
+
Properties: buildPropertiesSection(type),
|
|
56
|
+
Validation: ValidationSection
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
|
|
60
|
+
UiSchema.elements[0].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
|
|
61
|
+
UiSchema.elements[0].elements = elements || [CoreSection, StyleSection, EventSection, ValidationSection];
|
|
62
|
+
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
UiSchema.elements[0].config.main.tabLabels = sectionLabels[type] || ["Core", "style","Event","Validation"];
|
|
61
|
-
UiSchema.elements[0].elements = elements || [CoreSection, StyleSection,EventSection,ValidationSection];
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
store.setUiSchema(UiSchema);
|
|
64
|
+
store.setUiSchema(UiSchema);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export default (store: any, dynamicData: any, submitHandler: any, service: any) => {
|
|
@@ -107,20 +107,28 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
|
|
|
107
107
|
store.navigate(`/Component?path=${`elements[${rowId}]`}&id=${id}`)
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
deleteComponents: function () {
|
|
110
|
+
deleteComponents: function (shouldUpdateDialog: boolean = true) {
|
|
111
111
|
const path = store.searchParams?.get("path");
|
|
112
|
-
const rowId =
|
|
112
|
+
const rowId = localStorage.getItem('rowId');
|
|
113
113
|
store.formData.elements.splice(rowId, 1);
|
|
114
114
|
const response = saveFormdataInLocalStorage(store.ctx.core.data, path)
|
|
115
115
|
const data = path ? _.get(response, path) : response;
|
|
116
116
|
store.setFormdata(data);
|
|
117
|
+
if(shouldUpdateDialog){
|
|
118
|
+
store.updateDialog("popUpComponentSection");
|
|
119
|
+
}
|
|
120
|
+
localStorage.removeItem('rowId');
|
|
117
121
|
},
|
|
118
|
-
deleteEvent: function () {
|
|
122
|
+
deleteEvent: function (shouldUpdateDialog: boolean = true) {
|
|
119
123
|
const path = store.searchParams?.get("path");
|
|
120
|
-
const rowId =
|
|
124
|
+
const rowId = localStorage.getItem('rowId');
|
|
121
125
|
store.formData.events.splice(rowId, 1);
|
|
122
126
|
const response = saveFormdataInLocalStorage(store.ctx.core.data, path)
|
|
123
127
|
store.setFormdata(_.get(response, path));
|
|
128
|
+
if(shouldUpdateDialog){
|
|
129
|
+
store.updateDialog("popUpEventSection")
|
|
130
|
+
}
|
|
131
|
+
localStorage.removeItem('rowId');
|
|
124
132
|
},
|
|
125
133
|
widgetAddClickHandler: function () {
|
|
126
134
|
if (!Array.isArray(store.formData.elements)) {
|
|
@@ -155,6 +163,16 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
|
|
|
155
163
|
backHandler: function () {
|
|
156
164
|
store.navigate(-1)
|
|
157
165
|
},
|
|
166
|
+
deletePopUpComponent: function(){
|
|
167
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
168
|
+
localStorage.setItem('rowId',rowId);
|
|
169
|
+
store.updateDialog("popUpComponentSection");
|
|
170
|
+
},
|
|
171
|
+
deletePopUpEvent: function(){
|
|
172
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
173
|
+
localStorage.setItem('rowId',rowId);
|
|
174
|
+
store.updateDialog("popUpEventSection");
|
|
175
|
+
},
|
|
158
176
|
}
|
|
159
177
|
};
|
|
160
178
|
|
|
@@ -28,12 +28,13 @@ export default (
|
|
|
28
28
|
const schema: any = _.cloneDeep(EventSchema)
|
|
29
29
|
if (handlerType) {
|
|
30
30
|
if (handlerType === "custom") {
|
|
31
|
-
uiSchema.elements[
|
|
32
|
-
uiSchema.elements[
|
|
31
|
+
uiSchema.elements[0].elements[0].elements[2] = getRadioInputField("isSync","Run in Sync",["Yes","No"])
|
|
32
|
+
// uiSchema.elements[0].elements[0].elements[3] = emptyBox;
|
|
33
33
|
uiSchema.elements[0].elements[0].elements[3] = getTextArea("eventCode", "Write Custom Code", false)
|
|
34
34
|
schema.required = ["eventType", "Handler", "eventCode"]
|
|
35
35
|
|
|
36
36
|
} else if (handlerType === "api") {
|
|
37
|
+
uiSchema.elements[0].elements[0].elements[2] = emptyBox;
|
|
37
38
|
uiSchema.elements[0].elements[0].elements[3] = APISection;
|
|
38
39
|
schema.required = ["eventType", "Handler", "method", "path"]
|
|
39
40
|
} else if (handlerType === "inBuiltFunction") {
|
|
@@ -42,9 +43,10 @@ export default (
|
|
|
42
43
|
{ label: "Download File", value: "downloadFile" },
|
|
43
44
|
{ label: "Download Blob File", value: "downloadBlobFile" }
|
|
44
45
|
])
|
|
45
|
-
uiSchema.elements[0].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true
|
|
46
|
+
uiSchema.elements[0].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true);
|
|
46
47
|
schema.required = ["eventType", "Handler", "inBuiltFunctionType"]
|
|
47
48
|
} else if (handlerType === "refresh") {
|
|
49
|
+
uiSchema.elements[0].elements[0].elements[2] = emptyBox;
|
|
48
50
|
uiSchema.elements[0].elements[0].elements[3] = refreshSectionUiSchema;
|
|
49
51
|
schema.properties.refreshElements.required = ["value"]
|
|
50
52
|
schema.properties.refreshElements.items.required = ["value"]
|
|
@@ -62,8 +64,8 @@ export default (
|
|
|
62
64
|
},
|
|
63
65
|
|
|
64
66
|
getFormData: Component(store, dynamicData, submitHandler, service).getFormdata,
|
|
65
|
-
getUiSchema:
|
|
66
|
-
return
|
|
67
|
+
getUiSchema: function () {
|
|
68
|
+
return EventUiSchema;
|
|
67
69
|
},
|
|
68
70
|
getSchema: () => {
|
|
69
71
|
return EventSchema;
|
|
@@ -99,9 +101,17 @@ export default (
|
|
|
99
101
|
this.setPage()
|
|
100
102
|
|
|
101
103
|
},
|
|
102
|
-
deleteEvent:
|
|
104
|
+
deleteEvent: async function () {
|
|
105
|
+
await Component(store, dynamicData, submitHandler, service).deleteEvent(false);
|
|
106
|
+
store.updateDialog("popUpEvent");
|
|
107
|
+
},
|
|
103
108
|
backHandler: function () {
|
|
104
109
|
store.navigate(-1)
|
|
105
110
|
},
|
|
111
|
+
deletePopUpEvent: function(){
|
|
112
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
113
|
+
localStorage.setItem('rowId',rowId);
|
|
114
|
+
store.updateDialog("popUpEvent");
|
|
115
|
+
}
|
|
106
116
|
}
|
|
107
117
|
};
|
|
@@ -62,7 +62,11 @@ export default (funcParams: funcParamsProps) => {
|
|
|
62
62
|
},
|
|
63
63
|
saveHandler: async () => await saveHandler(store, service, submitHandler),
|
|
64
64
|
Edit_Components: Component(store, dynamicData, submitHandler, service).editComponents,
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
Delete_Components: async function() {
|
|
67
|
+
await Component(store, dynamicData, submitHandler, service).deleteComponents(false);
|
|
68
|
+
store.updateDialog("popUpPageMasterComponent");
|
|
69
|
+
},
|
|
66
70
|
eventAddHandler: function () {
|
|
67
71
|
const id = store.searchParams?.get("id");
|
|
68
72
|
if (!Array.isArray(store.formData.events)) {
|
|
@@ -80,10 +84,22 @@ export default (funcParams: funcParamsProps) => {
|
|
|
80
84
|
store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
|
|
81
85
|
},
|
|
82
86
|
deleteEvent: function () {
|
|
83
|
-
const rowId =
|
|
87
|
+
const rowId = localStorage.getItem('rowId');
|
|
84
88
|
store.formData.events.splice(rowId, 1);
|
|
85
89
|
const response = saveFormdataInLocalStorage(store.ctx.core.data)
|
|
86
90
|
store.setFormdata(response);
|
|
91
|
+
store.updateDialog("popUpPageMasterEvent");
|
|
92
|
+
localStorage.removeItem('rowId');
|
|
93
|
+
},
|
|
94
|
+
deletePopUpComponent: function(){
|
|
95
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
96
|
+
localStorage.setItem('rowId',rowId);
|
|
97
|
+
store.updateDialog("popUpPageMasterComponent");
|
|
98
|
+
},
|
|
99
|
+
deletePopUpEvent: function(){
|
|
100
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
101
|
+
localStorage.setItem('rowId',rowId);
|
|
102
|
+
store.updateDialog("popUpPageMasterEvent");
|
|
87
103
|
},
|
|
88
104
|
}
|
|
89
105
|
};
|
|
@@ -3,7 +3,7 @@ import { handlersProps } from "./interface";
|
|
|
3
3
|
export const executeEvents = (params: handlersProps) => {
|
|
4
4
|
let nextEvent = [];
|
|
5
5
|
let finalResponse = null;
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
if (params.config.isSync !== "Yes") {
|
|
8
8
|
return shouldEventExecute(params)
|
|
9
9
|
.then((shouldExecute) => {
|
|
@@ -52,7 +52,7 @@ export const executeEvents = (params: handlersProps) => {
|
|
|
52
52
|
}
|
|
53
53
|
return finalResponse;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
function executeEventsHandler(params: handlersProps) {
|
|
57
57
|
if (params.config.Handler === "api") {
|
|
58
58
|
return executeApiRequest(params);
|
|
@@ -79,14 +79,14 @@ function executeEventsHandler(params: handlersProps) {
|
|
|
79
79
|
return params.store.functionParameters?.handleReset();
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
84
84
|
let result: string[] = [];
|
|
85
85
|
if (eventConfig?.refreshElements?.length > 0) {
|
|
86
86
|
result = eventConfig.refreshElements.map((e) => {
|
|
87
87
|
return e.value
|
|
88
88
|
})
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
} else {
|
|
91
91
|
if (eventGropus?.onLoad) {
|
|
92
92
|
result = Object.keys(eventGropus?.onLoad)
|
|
@@ -98,37 +98,23 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
|
98
98
|
}
|
|
99
99
|
export async function executeRefreshHandler(params: handlersProps) {
|
|
100
100
|
const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups);
|
|
101
|
-
|
|
102
|
-
// Create an array of promises for the components to refresh
|
|
103
101
|
return Promise.allSettled(compToRefresh.map(componentName => {
|
|
104
102
|
const eventConfigs = params.eventGroups.onLoad[componentName];
|
|
105
|
-
|
|
106
|
-
// If eventConfigs is undefined, return a resolved promise
|
|
107
103
|
if (!eventConfigs) {
|
|
108
|
-
return Promise.resolve();
|
|
104
|
+
return Promise.resolve();
|
|
109
105
|
}
|
|
110
|
-
|
|
111
|
-
// Create an array of promises for the defined eventConfigs
|
|
112
106
|
return Promise.allSettled(eventConfigs.map(compEventConfig => {
|
|
113
107
|
return executeEvents({ ...params, config: compEventConfig, componentName });
|
|
114
108
|
}));
|
|
115
109
|
}));
|
|
116
110
|
}
|
|
117
|
-
// export function executeRefreshHandler(params: handlersProps) {
|
|
118
|
-
// const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups);
|
|
119
|
-
// return Promise.all(compToRefresh.map(componentName => {
|
|
120
|
-
// return Promise.all(params.eventGroups.onLoad[componentName].map(compEventConfig => {
|
|
121
|
-
// return executeEvents({ ...params, config: compEventConfig, componentName });
|
|
122
|
-
// }));
|
|
123
|
-
// }))
|
|
124
|
-
// };
|
|
125
111
|
export function executeApiRequest(params: any) {
|
|
126
112
|
const initialBody = { ...params.userValue?.payload };
|
|
127
113
|
const initialHeaders = {
|
|
128
114
|
"X-Requested-With": "XMLHttpRequest",
|
|
129
115
|
"Access-Control-Allow-Origin": "*"
|
|
130
116
|
};
|
|
131
|
-
|
|
117
|
+
|
|
132
118
|
const payloadApi = buildApiPayload(params.config, initialBody, initialHeaders, params.store, params.dynamicData, params.userValue, params.service)
|
|
133
119
|
return params.service[params.config.method](
|
|
134
120
|
params.config.path,
|
|
@@ -138,7 +124,7 @@ export function executeApiRequest(params: any) {
|
|
|
138
124
|
return response;
|
|
139
125
|
});
|
|
140
126
|
};
|
|
141
|
-
|
|
127
|
+
|
|
142
128
|
function executeInBuiltFunctionHandler(params: handlersProps) {
|
|
143
129
|
let parameter = {};
|
|
144
130
|
if (params.config.funcParametersCode) {
|
|
@@ -149,7 +135,7 @@ function executeInBuiltFunctionHandler(params: handlersProps) {
|
|
|
149
135
|
params.serviceHolder[params.config.inBuiltFunctionType](params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service)
|
|
150
136
|
}
|
|
151
137
|
}
|
|
152
|
-
|
|
138
|
+
|
|
153
139
|
function executeCustomHandler(params: handlersProps) {
|
|
154
140
|
const makeFunc = eval(params.config.eventCode)
|
|
155
141
|
if (params.config.isSync !== "Yes") {
|
|
@@ -158,9 +144,9 @@ function executeCustomHandler(params: handlersProps) {
|
|
|
158
144
|
const response = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName)
|
|
159
145
|
return response;
|
|
160
146
|
}
|
|
161
|
-
|
|
147
|
+
|
|
162
148
|
}
|
|
163
|
-
|
|
149
|
+
|
|
164
150
|
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any, formDataHolder: any) {
|
|
165
151
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
166
152
|
store.setSchema((pre) => {
|
|
@@ -205,8 +191,8 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
|
|
|
205
191
|
}
|
|
206
192
|
}
|
|
207
193
|
}
|
|
208
|
-
|
|
209
|
-
const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
|
|
194
|
+
|
|
195
|
+
const buildBodyFormat = (body: any[], formData: any, userValue: any, store: any) => {
|
|
210
196
|
let finalBody = { ...userValue?.payload };
|
|
211
197
|
body.map((elem) => {
|
|
212
198
|
if (typeof elem?.value !== "string") {
|
|
@@ -215,6 +201,15 @@ const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
|
|
|
215
201
|
if (elem?.value?.startsWith("$userValue")) {
|
|
216
202
|
const finalpath = elem.value.substring(11);
|
|
217
203
|
finalBody[elem.key] = _.get(userValue, finalpath);;
|
|
204
|
+
} else if (elem?.value?.startsWith("$urlParams")) {
|
|
205
|
+
const finalpath = elem.value.substring(11);
|
|
206
|
+
const value = store?.searchParams?.get(finalpath);
|
|
207
|
+
finalBody[elem.key] = value;
|
|
208
|
+
}
|
|
209
|
+
else if (elem?.value?.startsWith("$local")) {
|
|
210
|
+
const finalpath = elem.value.substring(7);
|
|
211
|
+
const value = JSON.parse(localStorage.getItem(finalpath) || '""')
|
|
212
|
+
finalBody[elem.key] = value;
|
|
218
213
|
}
|
|
219
214
|
else if (elem?.value?.startsWith("$")) {
|
|
220
215
|
const finalpath = elem.value.substring(1);
|
|
@@ -231,7 +226,7 @@ const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
|
|
|
231
226
|
})
|
|
232
227
|
return finalBody;
|
|
233
228
|
}
|
|
234
|
-
|
|
229
|
+
|
|
235
230
|
const buildHeadersFormat = (headers: any[]) => {
|
|
236
231
|
const headerObj = {
|
|
237
232
|
// "Content-Type": "application/json",
|
|
@@ -242,10 +237,10 @@ const buildHeadersFormat = (headers: any[]) => {
|
|
|
242
237
|
})
|
|
243
238
|
return headerObj;
|
|
244
239
|
}
|
|
245
|
-
|
|
240
|
+
|
|
246
241
|
export function shouldEventExecute(params: handlersProps) {
|
|
247
242
|
const startEvent = params.config?.events?.filter(e => e.eventType === "onStart");
|
|
248
|
-
|
|
243
|
+
|
|
249
244
|
if (startEvent?.length > 0) {
|
|
250
245
|
if (startEvent[0]?.isSync !== "Yes") {
|
|
251
246
|
return executeEventsHandler({ ...params, config: startEvent[0] }).then((response) => {
|
|
@@ -262,14 +257,14 @@ export function shouldEventExecute(params: handlersProps) {
|
|
|
262
257
|
}
|
|
263
258
|
}
|
|
264
259
|
}
|
|
265
|
-
|
|
266
|
-
|
|
260
|
+
|
|
261
|
+
|
|
267
262
|
export function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service) {
|
|
268
263
|
if (compConfig?.headers) {
|
|
269
264
|
headers = buildHeadersFormat(compConfig.headers);
|
|
270
265
|
}
|
|
271
266
|
if (compConfig.body) {
|
|
272
|
-
body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData,
|
|
267
|
+
body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData,userValue, store) };
|
|
273
268
|
}
|
|
274
269
|
const promiseChain = { body, headers };
|
|
275
270
|
if (compConfig.apiBody) {
|
|
@@ -288,4 +283,4 @@ export function asyncOperation() {
|
|
|
288
283
|
}
|
|
289
284
|
}, 50);
|
|
290
285
|
});
|
|
291
|
-
}
|
|
286
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _, { isEmpty } from "lodash";
|
|
2
2
|
import { doDownload, downloadFile } from "./downloadFile";
|
|
3
|
-
import {
|
|
3
|
+
import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
6
6
|
let eventGroups: any = {};
|
|
@@ -89,6 +89,116 @@ export default (funcParams: funcParamsProps) => {
|
|
|
89
89
|
}
|
|
90
90
|
const config = pageData?.config;
|
|
91
91
|
const uiSchema = pageData?.uiSchema;
|
|
92
|
+
window.localStorage.setItem("pageName", config.label);
|
|
93
|
+
window.dispatchEvent(new Event('pageNameChanged'))
|
|
94
|
+
const theme = funcParams?.store?.theme?.myTheme;
|
|
95
|
+
uiSchema.elements.push(
|
|
96
|
+
|
|
97
|
+
{
|
|
98
|
+
type: "HorizontalLayout",
|
|
99
|
+
config: {
|
|
100
|
+
main: {
|
|
101
|
+
direction: 'row'
|
|
102
|
+
},
|
|
103
|
+
style: {
|
|
104
|
+
flexDirection: "row",
|
|
105
|
+
position: "absolute",
|
|
106
|
+
bottom: 0,
|
|
107
|
+
marginBottom: '-8px',
|
|
108
|
+
height: 'fit-content',
|
|
109
|
+
overflow: 'hidden',
|
|
110
|
+
zIndex: 1000,
|
|
111
|
+
width: 'inherit'
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
elements: [
|
|
115
|
+
{
|
|
116
|
+
|
|
117
|
+
type: "Control",
|
|
118
|
+
scope: "#/properties/FooterText",
|
|
119
|
+
options: {
|
|
120
|
+
widget: "Box",
|
|
121
|
+
},
|
|
122
|
+
config: {
|
|
123
|
+
main: {
|
|
124
|
+
heading: "Copywriter@ACT21.IO"
|
|
125
|
+
},
|
|
126
|
+
style: {
|
|
127
|
+
color: theme?.palette?.text.disabled || "#AFAFAF",
|
|
128
|
+
fontSize: '12px',
|
|
129
|
+
textAlign: 'center',
|
|
130
|
+
lineHeight: 1,
|
|
131
|
+
width: 'fit-content',
|
|
132
|
+
left: '50%',
|
|
133
|
+
position: 'relative',
|
|
134
|
+
margin: 0,
|
|
135
|
+
flexGrow: 1,
|
|
136
|
+
height: 0
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: "Control",
|
|
142
|
+
scope: "#/properties/backIcon",
|
|
143
|
+
options: {
|
|
144
|
+
widget: "Box",
|
|
145
|
+
},
|
|
146
|
+
config: {
|
|
147
|
+
main: {
|
|
148
|
+
iconName: 'PrevIcon',
|
|
149
|
+
onClick: "backHandler",
|
|
150
|
+
width: 'fit-content',
|
|
151
|
+
},
|
|
152
|
+
style: {
|
|
153
|
+
fill: theme.palette.primary.main,
|
|
154
|
+
width: 20,
|
|
155
|
+
height: 0,
|
|
156
|
+
margin: 0,
|
|
157
|
+
top: 0,
|
|
158
|
+
right: '82px',
|
|
159
|
+
position: 'absolute',
|
|
160
|
+
fontSize: '12px',
|
|
161
|
+
cursor: 'pointer',
|
|
162
|
+
':hover': {
|
|
163
|
+
fill: theme.palette.primary.dark,
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
type: "Control",
|
|
170
|
+
scope: "#/properties/text",
|
|
171
|
+
|
|
172
|
+
options: {
|
|
173
|
+
widget: "Box",
|
|
174
|
+
},
|
|
175
|
+
config: {
|
|
176
|
+
main: {
|
|
177
|
+
heading: "Previous Page",
|
|
178
|
+
onClick: "backHandler"
|
|
179
|
+
},
|
|
180
|
+
style: {
|
|
181
|
+
textAlign: 'left',
|
|
182
|
+
lineHeight: 1,
|
|
183
|
+
height: 0,
|
|
184
|
+
width: 'fit-content',
|
|
185
|
+
color: theme.palette.primary.main,
|
|
186
|
+
fontSize: "12px",
|
|
187
|
+
cursor: 'pointer',
|
|
188
|
+
marginLeft: '2px',
|
|
189
|
+
marginRight: 0,
|
|
190
|
+
top: 3,
|
|
191
|
+
right: '12px',
|
|
192
|
+
position: 'absolute',
|
|
193
|
+
':hover': {
|
|
194
|
+
color: theme.palette.primary.dark,
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
);
|
|
92
202
|
const schema = pageData?.schema ?? { type: "object", properties: {} };
|
|
93
203
|
eventGroups = {}
|
|
94
204
|
eventGroups = extractEvents(config);
|
|
@@ -101,10 +211,8 @@ export default (funcParams: funcParamsProps) => {
|
|
|
101
211
|
await executeRefreshHandler({
|
|
102
212
|
config: {}, componentName: "",
|
|
103
213
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
104
|
-
serviceHolder: this, eventGroups,formDataHolder
|
|
214
|
+
serviceHolder: this, eventGroups, formDataHolder
|
|
105
215
|
})
|
|
106
|
-
const jsonres = await fetch('https://jsonplaceholder.typicode.com/todos/1');
|
|
107
|
-
const result = await jsonres.json()
|
|
108
216
|
funcParams.store.setSchema(
|
|
109
217
|
(pre: any) => {
|
|
110
218
|
return {
|