impaktapps-ui-builder 0.0.412-mtreemap.3 → 0.0.412-mtreemap.30
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 +1189 -585
- 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/eventSection.d.ts +2 -2
- 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/tableSection.d.ts +25 -1
- 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/buildStackBarGraph.ts +1 -5
- package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +2 -2
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +48 -66
- 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 +107 -103
- package/src/impaktapps-ui-builder/builder/build/uischema/file.ts +2 -12
- package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +1 -118
- 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 +93 -137
- 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 +487 -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 +515 -204
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +104 -98
- 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 -34
- package/src/impaktapps-ui-builder/runtime/services/service.ts +112 -4
|
@@ -1,81 +1,10 @@
|
|
|
1
|
+
import { getSelectField } from "../../../build/uischema/buildPropertiesSection";
|
|
2
|
+
|
|
1
3
|
export const EventUiSchema: any = (theme) => {
|
|
2
4
|
const uiSchema = {
|
|
3
5
|
type: "HorizontalLayout",
|
|
4
6
|
heading: "Component",
|
|
5
7
|
elements: [
|
|
6
|
-
// {
|
|
7
|
-
// type: "WrapperLayout",
|
|
8
|
-
// config: {
|
|
9
|
-
// main: {
|
|
10
|
-
// rowSpacing: 1,
|
|
11
|
-
// header: true
|
|
12
|
-
// },
|
|
13
|
-
// defaultStyle: true
|
|
14
|
-
// },
|
|
15
|
-
// elements: [
|
|
16
|
-
// {
|
|
17
|
-
// type: "Control",
|
|
18
|
-
// scope: "#/properties/Component",
|
|
19
|
-
|
|
20
|
-
// options: {
|
|
21
|
-
// widget: "Box",
|
|
22
|
-
// },
|
|
23
|
-
// config: {
|
|
24
|
-
// layout: {xs:12,sm:12,md:2},
|
|
25
|
-
// main: {
|
|
26
|
-
// heading: "Component",
|
|
27
|
-
// },
|
|
28
|
-
// style:{
|
|
29
|
-
// "float":"left",
|
|
30
|
-
// }
|
|
31
|
-
// },
|
|
32
|
-
// },
|
|
33
|
-
|
|
34
|
-
// {
|
|
35
|
-
// type: "Control",
|
|
36
|
-
// scope: "#/properties/pageName",
|
|
37
|
-
|
|
38
|
-
// options: {
|
|
39
|
-
// widget: "Box",
|
|
40
|
-
// },
|
|
41
|
-
// config: {
|
|
42
|
-
// layout: {xs:7,sm:7,md:9},
|
|
43
|
-
// main: {
|
|
44
|
-
// heading: " ",
|
|
45
|
-
// },
|
|
46
|
-
// style: {
|
|
47
|
-
// float: "right",
|
|
48
|
-
// width:"auto",
|
|
49
|
-
// fontSize:"12px",
|
|
50
|
-
// color:"gray",
|
|
51
|
-
// paddingTop:"10px"
|
|
52
|
-
// },
|
|
53
|
-
// },
|
|
54
|
-
// },
|
|
55
|
-
|
|
56
|
-
// {
|
|
57
|
-
// type: "Control",
|
|
58
|
-
// scope: "#/properties/Back_Button",
|
|
59
|
-
|
|
60
|
-
// options: {
|
|
61
|
-
// widget: "IconButton",
|
|
62
|
-
// },
|
|
63
|
-
// config: {
|
|
64
|
-
// layout: {xs:2,sm:2,md:0.5},
|
|
65
|
-
// main: {
|
|
66
|
-
// icon: "BackIcon",
|
|
67
|
-
// styleDefault: true,
|
|
68
|
-
// size: "small",
|
|
69
|
-
// onClick: "backHandler",
|
|
70
|
-
// tooltipMessage: "Back",
|
|
71
|
-
// },
|
|
72
|
-
// style: {
|
|
73
|
-
// float: "right",
|
|
74
|
-
// },
|
|
75
|
-
// },
|
|
76
|
-
// },
|
|
77
|
-
// ],
|
|
78
|
-
// },
|
|
79
8
|
{
|
|
80
9
|
type: "TabLayout",
|
|
81
10
|
config: {
|
|
@@ -106,31 +35,22 @@ export const EventUiSchema: any = (theme) => {
|
|
|
106
35
|
},
|
|
107
36
|
},
|
|
108
37
|
},
|
|
38
|
+
getSelectField("Handler", "Handler", [
|
|
39
|
+
{ label: "Custom", value: "custom" },
|
|
40
|
+
{ label: "Api", value: "api" },
|
|
41
|
+
{ label: "Inbuilt Function", value: "inBuiltFunction" },
|
|
42
|
+
{ label: "Refresh", value: "refresh" },
|
|
43
|
+
]),
|
|
109
44
|
{
|
|
110
45
|
type: "Control",
|
|
111
|
-
scope:
|
|
112
|
-
|
|
46
|
+
scope: "#/properties/EmptyBox",
|
|
113
47
|
options: {
|
|
114
|
-
widget: "
|
|
48
|
+
widget: "EmptyBox",
|
|
115
49
|
},
|
|
116
50
|
config: {
|
|
117
|
-
layout: { xs:
|
|
118
|
-
main: {
|
|
119
|
-
label: "Handler",
|
|
120
|
-
type: "text",
|
|
121
|
-
},
|
|
51
|
+
layout: { xs: 0, sm: 4, md: 4, lg: 4 },
|
|
122
52
|
},
|
|
123
53
|
},
|
|
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
54
|
],
|
|
135
55
|
},
|
|
136
56
|
{
|
|
@@ -195,14 +115,14 @@ export const EventUiSchema: any = (theme) => {
|
|
|
195
115
|
},
|
|
196
116
|
config: {
|
|
197
117
|
main: {
|
|
198
|
-
|
|
118
|
+
color: "info",
|
|
199
119
|
size: "small",
|
|
200
120
|
icon: "EditIcon",
|
|
201
121
|
tooltipMessage: "Edit This Record",
|
|
202
122
|
onClick: "editEvent",
|
|
203
123
|
},
|
|
204
124
|
style: {
|
|
205
|
-
color:
|
|
125
|
+
color: theme.palette.primary.main,
|
|
206
126
|
},
|
|
207
127
|
},
|
|
208
128
|
},
|
|
@@ -221,12 +141,13 @@ export const EventUiSchema: any = (theme) => {
|
|
|
221
141
|
icon: "RejectIcon",
|
|
222
142
|
color: "error",
|
|
223
143
|
tooltipMessage: "Reject This Record",
|
|
224
|
-
onClick: "
|
|
144
|
+
onClick: "deletePopUpEvent",
|
|
225
145
|
},
|
|
226
146
|
},
|
|
227
147
|
},
|
|
228
148
|
},
|
|
229
149
|
]
|
|
150
|
+
// }]
|
|
230
151
|
}
|
|
231
152
|
],
|
|
232
153
|
},
|
|
@@ -296,6 +217,91 @@ export const EventUiSchema: any = (theme) => {
|
|
|
296
217
|
},
|
|
297
218
|
},
|
|
298
219
|
},
|
|
220
|
+
{
|
|
221
|
+
type: "Control",
|
|
222
|
+
scope: "#/properties/popUpEvent",
|
|
223
|
+
options: {
|
|
224
|
+
widget: "PopUp"
|
|
225
|
+
},
|
|
226
|
+
config: {
|
|
227
|
+
layout: {
|
|
228
|
+
xs: 12,
|
|
229
|
+
sm: 12,
|
|
230
|
+
md: 6,
|
|
231
|
+
lg: 6,
|
|
232
|
+
},
|
|
233
|
+
main: {
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
elements:
|
|
237
|
+
[
|
|
238
|
+
{
|
|
239
|
+
type: "Control",
|
|
240
|
+
scope: "#/properties/label",
|
|
241
|
+
options: {
|
|
242
|
+
widget: "Box",
|
|
243
|
+
},
|
|
244
|
+
config: {
|
|
245
|
+
layout: 12,
|
|
246
|
+
main: {
|
|
247
|
+
heading: "Are you sure you want to delete ?",
|
|
248
|
+
},
|
|
249
|
+
style: {
|
|
250
|
+
marginTop: "-40px"
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: "Control",
|
|
256
|
+
scope: "#/properties/EmptyBox",
|
|
257
|
+
options: {
|
|
258
|
+
widget: "EmptyBox",
|
|
259
|
+
},
|
|
260
|
+
config: {
|
|
261
|
+
main: {},
|
|
262
|
+
layout: { xs: 11, sm: 5.5, md: 5.5, lg: 5.5 },
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
type: "Control",
|
|
267
|
+
scope: "#/properties/ConfirmDeleteEventButton",
|
|
268
|
+
options: {
|
|
269
|
+
widget: "Button",
|
|
270
|
+
},
|
|
271
|
+
config: {
|
|
272
|
+
layout: 3,
|
|
273
|
+
main: {
|
|
274
|
+
name: "Yes",
|
|
275
|
+
startIcon: "ApproveIcon",
|
|
276
|
+
variant: "contained",
|
|
277
|
+
color: "info",
|
|
278
|
+
type: "text",
|
|
279
|
+
onClick: "deleteEvent",
|
|
280
|
+
size: "small",
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
type: "Control",
|
|
286
|
+
scope: "#/properties/CancelDeleteEventButton",
|
|
287
|
+
options: {
|
|
288
|
+
widget: "Button",
|
|
289
|
+
},
|
|
290
|
+
config: {
|
|
291
|
+
layout: 3,
|
|
292
|
+
main: {
|
|
293
|
+
name: "No",
|
|
294
|
+
startIcon: "ApproveIcon",
|
|
295
|
+
variant: "contained",
|
|
296
|
+
color: "info",
|
|
297
|
+
type: "text",
|
|
298
|
+
onClick: "deletePopUpEvent",
|
|
299
|
+
size: "small",
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
]
|
|
304
|
+
},
|
|
299
305
|
{
|
|
300
306
|
type: "Control",
|
|
301
307
|
scope: "#/properties/notify",
|
|
@@ -323,7 +329,7 @@ export const EventUiSchema: any = (theme) => {
|
|
|
323
329
|
},
|
|
324
330
|
elements: [
|
|
325
331
|
{
|
|
326
|
-
|
|
332
|
+
|
|
327
333
|
type: "Control",
|
|
328
334
|
scope: "#/properties/FooterText",
|
|
329
335
|
options: {
|
|
@@ -378,7 +384,7 @@ export const EventUiSchema: any = (theme) => {
|
|
|
378
384
|
{
|
|
379
385
|
type: "Control",
|
|
380
386
|
scope: "#/properties/text",
|
|
381
|
-
|
|
387
|
+
|
|
382
388
|
options: {
|
|
383
389
|
widget: "Box",
|
|
384
390
|
},
|
|
@@ -410,5 +416,5 @@ export const EventUiSchema: any = (theme) => {
|
|
|
410
416
|
}
|
|
411
417
|
],
|
|
412
418
|
};
|
|
413
|
-
return uiSchema
|
|
414
|
-
}
|
|
419
|
+
return uiSchema;
|
|
420
|
+
}
|
|
@@ -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(store.theme.myTheme),
|
|
54
|
+
Components: TableSection(store.theme.myTheme),
|
|
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,56 +79,41 @@ 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)
|
|
93
93
|
result.push(result[0]);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
console.log(result);
|
|
97
96
|
return result;
|
|
98
97
|
}
|
|
99
98
|
export async function executeRefreshHandler(params: handlersProps) {
|
|
100
99
|
const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups);
|
|
101
|
-
|
|
102
|
-
// Create an array of promises for the components to refresh
|
|
103
100
|
return Promise.allSettled(compToRefresh.map(componentName => {
|
|
104
101
|
const eventConfigs = params.eventGroups.onLoad[componentName];
|
|
105
|
-
|
|
106
|
-
// If eventConfigs is undefined, return a resolved promise
|
|
107
102
|
if (!eventConfigs) {
|
|
108
|
-
return Promise.resolve();
|
|
103
|
+
return Promise.resolve();
|
|
109
104
|
}
|
|
110
|
-
|
|
111
|
-
// Create an array of promises for the defined eventConfigs
|
|
112
105
|
return Promise.allSettled(eventConfigs.map(compEventConfig => {
|
|
113
106
|
return executeEvents({ ...params, config: compEventConfig, componentName });
|
|
114
107
|
}));
|
|
115
108
|
}));
|
|
116
109
|
}
|
|
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
110
|
export function executeApiRequest(params: any) {
|
|
126
111
|
const initialBody = { ...params.userValue?.payload };
|
|
127
112
|
const initialHeaders = {
|
|
128
113
|
"X-Requested-With": "XMLHttpRequest",
|
|
129
114
|
"Access-Control-Allow-Origin": "*"
|
|
130
115
|
};
|
|
131
|
-
|
|
116
|
+
|
|
132
117
|
const payloadApi = buildApiPayload(params.config, initialBody, initialHeaders, params.store, params.dynamicData, params.userValue, params.service)
|
|
133
118
|
return params.service[params.config.method](
|
|
134
119
|
params.config.path,
|
|
@@ -138,7 +123,7 @@ export function executeApiRequest(params: any) {
|
|
|
138
123
|
return response;
|
|
139
124
|
});
|
|
140
125
|
};
|
|
141
|
-
|
|
126
|
+
|
|
142
127
|
function executeInBuiltFunctionHandler(params: handlersProps) {
|
|
143
128
|
let parameter = {};
|
|
144
129
|
if (params.config.funcParametersCode) {
|
|
@@ -149,7 +134,7 @@ function executeInBuiltFunctionHandler(params: handlersProps) {
|
|
|
149
134
|
params.serviceHolder[params.config.inBuiltFunctionType](params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service)
|
|
150
135
|
}
|
|
151
136
|
}
|
|
152
|
-
|
|
137
|
+
|
|
153
138
|
function executeCustomHandler(params: handlersProps) {
|
|
154
139
|
const makeFunc = eval(params.config.eventCode)
|
|
155
140
|
if (params.config.isSync !== "Yes") {
|
|
@@ -158,9 +143,9 @@ function executeCustomHandler(params: handlersProps) {
|
|
|
158
143
|
const response = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName)
|
|
159
144
|
return response;
|
|
160
145
|
}
|
|
161
|
-
|
|
146
|
+
|
|
162
147
|
}
|
|
163
|
-
|
|
148
|
+
|
|
164
149
|
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any, formDataHolder: any) {
|
|
165
150
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
166
151
|
store.setSchema((pre) => {
|
|
@@ -205,8 +190,8 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
|
|
|
205
190
|
}
|
|
206
191
|
}
|
|
207
192
|
}
|
|
208
|
-
|
|
209
|
-
const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
|
|
193
|
+
|
|
194
|
+
const buildBodyFormat = (body: any[], formData: any, userValue: any, store: any) => {
|
|
210
195
|
let finalBody = { ...userValue?.payload };
|
|
211
196
|
body.map((elem) => {
|
|
212
197
|
if (typeof elem?.value !== "string") {
|
|
@@ -215,6 +200,15 @@ const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
|
|
|
215
200
|
if (elem?.value?.startsWith("$userValue")) {
|
|
216
201
|
const finalpath = elem.value.substring(11);
|
|
217
202
|
finalBody[elem.key] = _.get(userValue, finalpath);;
|
|
203
|
+
} else if (elem?.value?.startsWith("$urlParams")) {
|
|
204
|
+
const finalpath = elem.value.substring(11);
|
|
205
|
+
const value = store?.searchParams?.get(finalpath);
|
|
206
|
+
finalBody[elem.key] = value;
|
|
207
|
+
}
|
|
208
|
+
else if (elem?.value?.startsWith("$local")) {
|
|
209
|
+
const finalpath = elem.value.substring(7);
|
|
210
|
+
const value = JSON.parse(localStorage.getItem(finalpath) || '""')
|
|
211
|
+
finalBody[elem.key] = value;
|
|
218
212
|
}
|
|
219
213
|
else if (elem?.value?.startsWith("$")) {
|
|
220
214
|
const finalpath = elem.value.substring(1);
|
|
@@ -231,7 +225,7 @@ const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
|
|
|
231
225
|
})
|
|
232
226
|
return finalBody;
|
|
233
227
|
}
|
|
234
|
-
|
|
228
|
+
|
|
235
229
|
const buildHeadersFormat = (headers: any[]) => {
|
|
236
230
|
const headerObj = {
|
|
237
231
|
// "Content-Type": "application/json",
|
|
@@ -242,10 +236,10 @@ const buildHeadersFormat = (headers: any[]) => {
|
|
|
242
236
|
})
|
|
243
237
|
return headerObj;
|
|
244
238
|
}
|
|
245
|
-
|
|
239
|
+
|
|
246
240
|
export function shouldEventExecute(params: handlersProps) {
|
|
247
241
|
const startEvent = params.config?.events?.filter(e => e.eventType === "onStart");
|
|
248
|
-
|
|
242
|
+
|
|
249
243
|
if (startEvent?.length > 0) {
|
|
250
244
|
if (startEvent[0]?.isSync !== "Yes") {
|
|
251
245
|
return executeEventsHandler({ ...params, config: startEvent[0] }).then((response) => {
|
|
@@ -262,14 +256,14 @@ export function shouldEventExecute(params: handlersProps) {
|
|
|
262
256
|
}
|
|
263
257
|
}
|
|
264
258
|
}
|
|
265
|
-
|
|
266
|
-
|
|
259
|
+
|
|
260
|
+
|
|
267
261
|
export function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service) {
|
|
268
262
|
if (compConfig?.headers) {
|
|
269
263
|
headers = buildHeadersFormat(compConfig.headers);
|
|
270
264
|
}
|
|
271
265
|
if (compConfig.body) {
|
|
272
|
-
body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData,
|
|
266
|
+
body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData,userValue, store) };
|
|
273
267
|
}
|
|
274
268
|
const promiseChain = { body, headers };
|
|
275
269
|
if (compConfig.apiBody) {
|
|
@@ -288,4 +282,4 @@ export function asyncOperation() {
|
|
|
288
282
|
}
|
|
289
283
|
}, 50);
|
|
290
284
|
});
|
|
291
|
-
}
|
|
285
|
+
}
|