impaktapps-ui-builder 0.0.412-hj → 0.0.412-i

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.
@@ -228,7 +228,7 @@ export const EventUiSchema: any = {
228
228
  icon: "RejectIcon",
229
229
  color: "error",
230
230
  tooltipMessage: "Reject This Record",
231
- onClick: "deleteEvent",
231
+ onClick: "deletePopUpEvent",
232
232
  },
233
233
  },
234
234
  },
@@ -238,6 +238,92 @@ export const EventUiSchema: any = {
238
238
  }
239
239
  ],
240
240
  },
241
+ {
242
+ type: "Control",
243
+ scope: "#/properties/popUpEvent",
244
+ options: {
245
+ widget: "PopUp"
246
+ },
247
+ config: {
248
+ layout: {
249
+ xs: 12,
250
+ sm: 12,
251
+ md: 12,
252
+ lg: 12,
253
+ },
254
+ main: {
255
+ },
256
+ },
257
+ elements:
258
+ [
259
+ {
260
+ type: "Control",
261
+ scope: "#/properties/label",
262
+ options: {
263
+ widget: "Box",
264
+ },
265
+ config: {
266
+ layout: 12,
267
+ main: {
268
+ heading: "Are you sure you want to delete ?",
269
+ },
270
+ style:{
271
+ marginTop: "-40px"
272
+ }
273
+ },
274
+ },
275
+ {
276
+ type: "Control",
277
+ scope: "#/properties/EmptyBox",
278
+ options: {
279
+ widget: "EmptyBox",
280
+ },
281
+ config: {
282
+ main:{},
283
+ layout: { xs: 11, sm: 5.5, md: 5.5, lg: 5.5 },
284
+ },
285
+ },
286
+ {
287
+ type: "Control",
288
+ scope: "#/properties/ConfirmDeleteEventButton",
289
+ options: {
290
+ widget: "Button",
291
+ },
292
+ config: {
293
+ layout: 3,
294
+ main: {
295
+ name: "Yes",
296
+ startIcon: "ApproveIcon",
297
+ variant: "contained",
298
+ color: "info",
299
+ type: "text",
300
+ onClick: "deleteEvent",
301
+ size: "small",
302
+ },
303
+ },
304
+ },
305
+ {
306
+ type: "Control",
307
+ scope: "#/properties/CancelDeleteEventButton",
308
+ options: {
309
+ widget: "Button",
310
+ },
311
+ config: {
312
+ layout: 3,
313
+ main: {
314
+ name: "No",
315
+ startIcon: "ApproveIcon",
316
+ variant: "contained",
317
+ color: "info",
318
+ type: "text",
319
+ onClick: "deletePopUpEvent",
320
+ size: "small",
321
+ },
322
+ },
323
+ },
324
+ ]
325
+ },
326
+
241
327
  {
242
328
  type: "Control",
243
329
  scope: "#/properties/proc",
@@ -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 = dynamicData.path.split(".")[1];
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 = dynamicData.path.split(".")[1];
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
 
@@ -99,9 +99,17 @@ export default (
99
99
  this.setPage()
100
100
 
101
101
  },
102
- deleteEvent: Component(store, dynamicData, submitHandler, service).deleteEvent,
102
+ deleteEvent: async function () {
103
+ await Component(store, dynamicData, submitHandler, service).deleteEvent(false);
104
+ store.updateDialog("popUpEvent");
105
+ },
103
106
  backHandler: function () {
104
107
  store.navigate(-1)
105
108
  },
109
+ deletePopUpEvent: function(){
110
+ const rowId = dynamicData.path.split(".")[1];
111
+ localStorage.setItem('rowId',rowId);
112
+ store.updateDialog("popUpEvent");
113
+ }
106
114
  }
107
115
  };
@@ -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
- Delete_Components: Component(store, dynamicData, submitHandler, service).deleteComponents,
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 = dynamicData.path.split(".")[1];
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
  };
@@ -98,16 +98,16 @@ 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
-
101
+
102
102
  // Create an array of promises for the components to refresh
103
103
  return Promise.allSettled(compToRefresh.map(componentName => {
104
104
  const eventConfigs = params.eventGroups.onLoad[componentName];
105
-
105
+
106
106
  // If eventConfigs is undefined, return a resolved promise
107
107
  if (!eventConfigs) {
108
108
  return Promise.resolve(); // Resolve immediately if there are no events to load
109
109
  }
110
-
110
+
111
111
  // Create an array of promises for the defined eventConfigs
112
112
  return Promise.allSettled(eventConfigs.map(compEventConfig => {
113
113
  return executeEvents({ ...params, config: compEventConfig, componentName });
@@ -206,7 +206,7 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
206
206
  }
207
207
  }
208
208
 
209
- const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
209
+ const buildBodyFormat = (body: any[], formData: any, userValue: any, store: any) => {
210
210
  let finalBody = { ...userValue?.payload };
211
211
  body.map((elem) => {
212
212
  if (typeof elem?.value !== "string") {
@@ -215,6 +215,15 @@ const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
215
215
  if (elem?.value?.startsWith("$userValue")) {
216
216
  const finalpath = elem.value.substring(11);
217
217
  finalBody[elem.key] = _.get(userValue, finalpath);;
218
+ } else if (elem?.value?.startsWith("$urlParams")) {
219
+ const finalpath = elem.value.substring(11);
220
+ const value = store?.searchParams?.get(finalpath);
221
+ finalBody[elem.key] = value;
222
+ }
223
+ else if (elem?.value?.startsWith("$local")) {
224
+ const finalpath = elem.value.substring(7);
225
+ const value = JSON.parse(localStorage.getItem(finalpath) || '""')
226
+ finalBody[elem.key] = value;
218
227
  }
219
228
  else if (elem?.value?.startsWith("$")) {
220
229
  const finalpath = elem.value.substring(1);
@@ -269,7 +278,7 @@ export function buildApiPayload(compConfig: any, body: any, headers: any, store:
269
278
  headers = buildHeadersFormat(compConfig.headers);
270
279
  }
271
280
  if (compConfig.body) {
272
- body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData, userValue) };
281
+ body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData,userValue, store) };
273
282
  }
274
283
  const promiseChain = { body, headers };
275
284
  if (compConfig.apiBody) {