impaktapps-ui-builder 0.0.21 → 0.0.23

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.
@@ -147,142 +147,292 @@ const PageMasterUiSchema = {
147
147
  ]
148
148
  },
149
149
  {
150
- type: "WrapperLayout",
150
+ type: "TabLayout",
151
151
  config: {
152
152
  main: {
153
- label: "Page Components",
153
+ tabLabels: ["Components", "events"],
154
154
  divider: true
155
155
  },
156
156
  defaultStyle: true
157
157
  },
158
158
  elements: [
159
159
  {
160
- type: "Control",
161
- scope: "#/properties/elements",
162
- options: {
163
- widget: "Table"
164
- },
160
+ type: "WrapperLayout",
165
161
  config: {
166
162
  main: {
167
- disableAction: true,
168
- disableSelection: true,
169
- enableDrag: true
163
+ divider: true
164
+ },
165
+ wrapperStyle: {
166
+ border: "1px solid gray"
170
167
  }
171
168
  },
172
169
  elements: [
173
170
  {
174
- accessorKey: "name",
175
- header: "Name"
176
- },
177
- {
178
- accessorKey: "type",
179
- header: "Type"
171
+ type: "Control",
172
+ scope: "#/properties/heading",
173
+ options: {
174
+ widget: "Box"
175
+ },
176
+ config: {
177
+ layout: 8,
178
+ main: {
179
+ heading: "Components Table"
180
+ },
181
+ style: {
182
+ fontFamily: "Roboto",
183
+ fontWeight: "500",
184
+ paddingLeft: "-10px",
185
+ fontSize: "20px"
186
+ }
187
+ }
180
188
  },
181
189
  {
182
- header: "Edit",
183
- field: "Reject_Records",
184
- flex: 1,
185
- widget: {
186
- type: "Control",
187
- scope: "#/properties/RejectButton",
188
- options: {
189
- widget: "IconButton"
190
+ type: "Control",
191
+ scope: "#/properties/AddButton",
192
+ options: {
193
+ widget: "IconButton"
194
+ },
195
+ config: {
196
+ layout: 3,
197
+ main: {
198
+ icon: "AddIcon",
199
+ styleDefault: true,
200
+ size: "small",
201
+ onClick: "onAddClickHandler",
202
+ tooltipMessage: "Back"
190
203
  },
191
- config: {
192
- main: {
193
- icon: "EditIcon",
194
- color: "primary",
195
- onClick: "Edit_Components",
196
- tooltipMessage: "Reject This Record"
197
- }
204
+ style: {
205
+ float: "right"
198
206
  }
199
207
  }
200
208
  },
201
209
  {
202
- header: "Delete",
203
- field: "Reject_Records",
204
- flex: 1,
205
- widget: {
206
- type: "Control",
207
- scope: "#/properties/RejectButton",
208
- options: {
209
- widget: "IconButton"
210
+ type: "Control",
211
+ scope: "#/properties/elements",
212
+ options: {
213
+ widget: "Table"
214
+ },
215
+ config: {
216
+ main: {
217
+ disableAction: true,
218
+ disableSelection: true,
219
+ enableDrag: true
220
+ }
221
+ },
222
+ elements: [
223
+ {
224
+ accessorKey: "name",
225
+ header: "Name"
210
226
  },
211
- config: {
212
- main: {
213
- icon: "RejectIcon",
214
- color: "error",
215
- onClick: "Delete_Components",
216
- tooltipMessage: "Reject This Record"
227
+ {
228
+ accessorKey: "type",
229
+ header: "Type"
230
+ },
231
+ {
232
+ header: "Edit",
233
+ field: "Reject_Records",
234
+ flex: 1,
235
+ widget: {
236
+ type: "Control",
237
+ scope: "#/properties/RejectButton",
238
+ options: {
239
+ widget: "IconButton"
240
+ },
241
+ config: {
242
+ main: {
243
+ icon: "EditIcon",
244
+ color: "primary",
245
+ onClick: "Edit_Components",
246
+ tooltipMessage: "Reject This Record"
247
+ }
248
+ }
249
+ }
250
+ },
251
+ {
252
+ header: "Delete",
253
+ field: "Reject_Records",
254
+ flex: 1,
255
+ widget: {
256
+ type: "Control",
257
+ scope: "#/properties/RejectButton",
258
+ options: {
259
+ widget: "IconButton"
260
+ },
261
+ config: {
262
+ main: {
263
+ icon: "RejectIcon",
264
+ color: "error",
265
+ onClick: "Delete_Components",
266
+ tooltipMessage: "Reject This Record"
267
+ }
268
+ }
217
269
  }
218
270
  }
219
- }
271
+ ]
220
272
  }
221
273
  ]
222
274
  },
223
275
  {
224
- type: "Control",
225
- scope: "#/properties/btn",
226
- options: {
227
- widget: "EmptyBox"
228
- },
229
- config: {
230
- layout: { xs: 0, sm: 0, md: 8, lg: 7 }
231
- }
232
- },
233
- {
234
- type: "Control",
235
- scope: "#/properties/btn",
236
- options: {
237
- widget: "Button"
238
- },
276
+ type: "WrapperLayout",
239
277
  config: {
240
- layout: { xs: 12, sm: 12, md: 3, lg: 2.5 },
241
278
  main: {
242
- name: "Submit Page",
243
- startIcon: "ApproveIcon",
244
- variant: "contained",
245
- color: "info",
246
- type: "text",
247
- onClick: "submitPageHandler",
248
- size: "small"
279
+ divider: true
249
280
  },
250
- style: {
251
- marginBottom: "8px"
281
+ wrapperStyle: {
282
+ border: "1px solid gray"
252
283
  }
253
- }
254
- },
255
- {
256
- type: "Control",
257
- scope: "#/properties/btn",
258
- options: {
259
- widget: "Button"
260
284
  },
261
- config: {
262
- layout: { xs: 12, sm: 12, md: 2, lg: 1.5 },
263
- main: {
264
- name: "Add",
265
- startIcon: "ApproveIcon",
266
- variant: "contained",
267
- color: "info",
268
- type: "text",
269
- onClick: "onAddClickHandler",
270
- size: "small"
285
+ elements: [
286
+ {
287
+ type: "Control",
288
+ scope: "#/properties/heading",
289
+ options: {
290
+ widget: "Box"
291
+ },
292
+ config: {
293
+ layout: 8,
294
+ main: {
295
+ heading: "Event Table"
296
+ },
297
+ style: {
298
+ fontFamily: "Roboto",
299
+ fontWeight: "500",
300
+ paddingLeft: "-10px",
301
+ fontSize: "20px"
302
+ }
303
+ }
271
304
  },
272
- style: {
273
- marginBottom: "8px"
305
+ {
306
+ type: "Control",
307
+ scope: "#/properties/AddButton",
308
+ options: {
309
+ widget: "IconButton"
310
+ },
311
+ config: {
312
+ layout: 3,
313
+ main: {
314
+ icon: "AddIcon",
315
+ styleDefault: true,
316
+ size: "small",
317
+ onClick: "eventAddHandler",
318
+ tooltipMessage: "Back"
319
+ },
320
+ style: {
321
+ float: "right"
322
+ }
323
+ }
324
+ },
325
+ {
326
+ type: "Control",
327
+ scope: "#/properties/events",
328
+ options: {
329
+ widget: "Table"
330
+ },
331
+ config: {
332
+ main: {
333
+ disableAction: true,
334
+ disableSelection: true,
335
+ enableDrag: true
336
+ }
337
+ },
338
+ elements: [
339
+ {
340
+ accessorKey: "eventType",
341
+ header: "Event Type"
342
+ },
343
+ {
344
+ accessorKey: "Handler",
345
+ header: "Handler"
346
+ },
347
+ {
348
+ accessorKey: "Edit_Approve_Records",
349
+ header: "Edit Widget",
350
+ widget: {
351
+ type: "Control",
352
+ scope: "#/properties/Edit_Records",
353
+ options: {
354
+ widget: "IconButton"
355
+ },
356
+ config: {
357
+ main: {
358
+ color: "info",
359
+ size: "small",
360
+ icon: "EditIcon",
361
+ tooltipMessage: "Edit This Record",
362
+ onClick: "editEvent"
363
+ },
364
+ style: {
365
+ color: "#3949ab"
366
+ }
367
+ }
368
+ }
369
+ },
370
+ {
371
+ accessorKey: "Reject_Records",
372
+ header: "Delete",
373
+ widget: {
374
+ type: "Control",
375
+ scope: "#/properties/RejectButton",
376
+ options: {
377
+ widget: "IconButton"
378
+ },
379
+ config: {
380
+ main: {
381
+ icon: "RejectIcon",
382
+ color: "error",
383
+ tooltipMessage: "Reject This Record",
384
+ onClick: "deleteEvent"
385
+ }
386
+ }
387
+ }
388
+ }
389
+ ]
274
390
  }
275
- }
276
- },
277
- {
278
- type: "Control",
279
- scope: "#/properties/notify",
280
- options: {
281
- widget: "Notify"
282
- },
283
- layout: 6
391
+ ]
284
392
  }
285
393
  ]
394
+ },
395
+ {
396
+ type: "Control",
397
+ scope: "#/properties/btn",
398
+ options: {
399
+ widget: "EmptyBox"
400
+ },
401
+ config: {
402
+ layout: { xs: 0, sm: 0, md: 8, lg: 7 }
403
+ }
404
+ },
405
+ {
406
+ type: "Control",
407
+ scope: "#/properties/btn",
408
+ options: {
409
+ widget: "Button"
410
+ },
411
+ config: {
412
+ layout: 11.7,
413
+ main: {
414
+ name: "Submit Page",
415
+ startIcon: "ApproveIcon",
416
+ variant: "contained",
417
+ color: "info",
418
+ type: "text",
419
+ onClick: "submitPageHandler",
420
+ size: "small"
421
+ },
422
+ style: {
423
+ marginBottom: "8px",
424
+ width: { xs: "100%", sm: "100%", md: "25%", lg: "20%" },
425
+ float: "right"
426
+ }
427
+ }
428
+ },
429
+ {
430
+ type: "Control",
431
+ scope: "#/properties/notify",
432
+ options: {
433
+ widget: "Notify"
434
+ },
435
+ layout: 6
286
436
  }
287
437
  ]
288
438
  };
@@ -6132,19 +6282,19 @@ const getNavigationHistory = (config, path) => {
6132
6282
  }
6133
6283
  return void 0;
6134
6284
  };
6135
- const saveFormdataInLocalStorage = (formData, path) => {
6285
+ const saveFormdataInSessionStorage = (formData, path) => {
6136
6286
  let updatedFormdata;
6137
6287
  if (path) {
6138
- const pageFormdata = getFormdataFromLocalStorage();
6288
+ const pageFormdata = getFormdataFromSessionStorage();
6139
6289
  updatedFormdata = _.set(pageFormdata, path, buildConfig(formData));
6140
6290
  } else {
6141
6291
  updatedFormdata = buildConfig(formData);
6142
6292
  }
6143
- localStorage.setItem("pageFormdata", JSON.stringify(updatedFormdata));
6293
+ sessionStorage.setItem("pageFormdata", JSON.stringify(updatedFormdata));
6144
6294
  return updatedFormdata;
6145
6295
  };
6146
- const getFormdataFromLocalStorage = (path) => {
6147
- const pageFormdata = localStorage.getItem("pageFormdata") ? JSON.parse(localStorage.getItem("pageFormdata")) : void 0;
6296
+ const getFormdataFromSessionStorage = (path) => {
6297
+ const pageFormdata = sessionStorage.getItem("pageFormdata") ? JSON.parse(sessionStorage.getItem("pageFormdata")) : void 0;
6148
6298
  let returnValue;
6149
6299
  if (path) {
6150
6300
  returnValue = _.get(pageFormdata, path);
@@ -6886,7 +7036,7 @@ var Component = (store2, dynamicData2) => {
6886
7036
  getFormdata: async function() {
6887
7037
  var _a;
6888
7038
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
6889
- return getFormdataFromLocalStorage(path);
7039
+ return getFormdataFromSessionStorage(path);
6890
7040
  },
6891
7041
  getSchema: function() {
6892
7042
  return ComponentSchema;
@@ -6894,7 +7044,7 @@ var Component = (store2, dynamicData2) => {
6894
7044
  saveHandler: async function() {
6895
7045
  var _a;
6896
7046
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
6897
- saveFormdataInLocalStorage(store2.formData, path);
7047
+ saveFormdataInSessionStorage(store2.formData, path);
6898
7048
  store2.navigate(-1);
6899
7049
  store2.setNotify({
6900
7050
  SuccessMessage: "Save Successfully",
@@ -6912,7 +7062,7 @@ var Component = (store2, dynamicData2) => {
6912
7062
  const rowId = dynamicData2.path.split(".")[1];
6913
7063
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
6914
7064
  const id = (_b = store2.searchParams) == null ? void 0 : _b.get("id");
6915
- saveFormdataInLocalStorage(store2.formData, path);
7065
+ saveFormdataInSessionStorage(store2.formData, path);
6916
7066
  if (path) {
6917
7067
  const path2 = (_c = store2.searchParams) == null ? void 0 : _c.get("path");
6918
7068
  const finalPath = `${path2}.elements[${rowId}]`;
@@ -6928,7 +7078,7 @@ var Component = (store2, dynamicData2) => {
6928
7078
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
6929
7079
  const rowId = dynamicData2.path.split(".")[1];
6930
7080
  store2.formData.elements.splice(rowId, 1);
6931
- const response = saveFormdataInLocalStorage(store2.formData, path);
7081
+ const response = saveFormdataInSessionStorage(store2.formData, path);
6932
7082
  const data2 = path ? _.get(response, path) : response;
6933
7083
  store2.setFormdata(data2);
6934
7084
  },
@@ -6937,7 +7087,7 @@ var Component = (store2, dynamicData2) => {
6937
7087
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
6938
7088
  const rowId = dynamicData2.path.split(".")[1];
6939
7089
  store2.formData.events.splice(rowId, 1);
6940
- const response = saveFormdataInLocalStorage(store2.formData, path);
7090
+ const response = saveFormdataInSessionStorage(store2.formData, path);
6941
7091
  store2.setFormdata(_.get(response, path));
6942
7092
  },
6943
7093
  widgetAddClickHandler: async function() {
@@ -6946,7 +7096,7 @@ var Component = (store2, dynamicData2) => {
6946
7096
  store2.formData.elements = [];
6947
7097
  }
6948
7098
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
6949
- saveFormdataInLocalStorage(store2.formData, path);
7099
+ saveFormdataInSessionStorage(store2.formData, path);
6950
7100
  const finalPath = `${path}.elements[${store2.formData.elements.length}]`;
6951
7101
  store2.searchParams.set("path", finalPath);
6952
7102
  store2.setSearchParams(store2.searchParams);
@@ -6957,7 +7107,7 @@ var Component = (store2, dynamicData2) => {
6957
7107
  const rowId = dynamicData2.path.split(".")[1];
6958
7108
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
6959
7109
  const id = (_b = store2.searchParams) == null ? void 0 : _b.get("id");
6960
- saveFormdataInLocalStorage(store2.formData, path);
7110
+ saveFormdataInSessionStorage(store2.formData, path);
6961
7111
  const finalPath = `${path}.events[${rowId}]`;
6962
7112
  store2.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`);
6963
7113
  },
@@ -6968,7 +7118,7 @@ var Component = (store2, dynamicData2) => {
6968
7118
  if (!Array.isArray(store2.formData.events)) {
6969
7119
  store2.formData.events = [];
6970
7120
  }
6971
- saveFormdataInLocalStorage(store2.formData, path);
7121
+ saveFormdataInSessionStorage(store2.formData, path);
6972
7122
  const finalPath = `${path}.events[${store2.formData.events.length}]`;
6973
7123
  store2.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`);
6974
7124
  },
@@ -6991,11 +7141,11 @@ var pageMaster = (funcParams) => {
6991
7141
  getFormdata: async function() {
6992
7142
  var _a;
6993
7143
  (_a = store2.searchParams) == null ? void 0 : _a.get("id");
6994
- const formData = getFormdataFromLocalStorage();
7144
+ const formData = getFormdataFromSessionStorage();
6995
7145
  if (formData) {
6996
7146
  return formData;
6997
7147
  }
6998
- saveFormdataInLocalStorage(config);
7148
+ saveFormdataInSessionStorage(config);
6999
7149
  return config;
7000
7150
  },
7001
7151
  getUiSchema: async function() {
@@ -7005,7 +7155,7 @@ var pageMaster = (funcParams) => {
7005
7155
  return PageMasterSchema;
7006
7156
  },
7007
7157
  backHandler: () => {
7008
- localStorage.removeItem("pageFormdata");
7158
+ sessionStorage.removeItem("pageFormdata");
7009
7159
  store2.navigate("/PageMasterRecords");
7010
7160
  },
7011
7161
  onAddClickHandler: async function() {
@@ -7014,14 +7164,14 @@ var pageMaster = (funcParams) => {
7014
7164
  if (!Array.isArray(store2.formData.elements)) {
7015
7165
  store2.formData.elements = [];
7016
7166
  }
7017
- const response = saveFormdataInLocalStorage(store2.formData);
7167
+ const response = saveFormdataInSessionStorage(store2.formData);
7018
7168
  store2.navigate(
7019
7169
  `/Component?path=${`elements[${response == null ? void 0 : response.elements.length}]`}&id=${id}`
7020
7170
  );
7021
7171
  },
7022
7172
  submitPageHandler: async function() {
7023
7173
  submitHandler(store2, funcParams.service).then((saveReturn) => {
7024
- localStorage.removeItem("pageFormdata");
7174
+ sessionStorage.removeItem("pageFormdata");
7025
7175
  store2.navigate(-1);
7026
7176
  store2.setNotify({
7027
7177
  SuccessMessage: "Submit Successfully",
@@ -7030,7 +7180,31 @@ var pageMaster = (funcParams) => {
7030
7180
  });
7031
7181
  },
7032
7182
  Edit_Components: Component(store2, dynamicData2).editComponents,
7033
- Delete_Components: Component(store2, dynamicData2).deleteComponents
7183
+ Delete_Components: Component(store2, dynamicData2).deleteComponents,
7184
+ eventAddHandler: async function() {
7185
+ var _a;
7186
+ const id = (_a = store2.searchParams) == null ? void 0 : _a.get("id");
7187
+ if (!Array.isArray(store2.formData.events)) {
7188
+ store2.formData.events = [];
7189
+ }
7190
+ saveFormdataInSessionStorage(store2.formData);
7191
+ const finalPath = `events[${store2.formData.events.length}]`;
7192
+ store2.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`);
7193
+ },
7194
+ editEvent: async function() {
7195
+ var _a;
7196
+ const rowId = dynamicData2.path.split(".")[1];
7197
+ const id = (_a = store2.searchParams) == null ? void 0 : _a.get("id");
7198
+ saveFormdataInSessionStorage(store2.formData);
7199
+ const finalPath = `events[${rowId}]`;
7200
+ store2.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`);
7201
+ },
7202
+ deleteEvent: async function() {
7203
+ const rowId = dynamicData2.path.split(".")[1];
7204
+ store2.formData.events.splice(rowId, 1);
7205
+ const response = saveFormdataInSessionStorage(store2.formData);
7206
+ store2.setFormdata(response);
7207
+ }
7034
7208
  };
7035
7209
  };
7036
7210
  const EventSchema = {
@@ -7579,7 +7753,7 @@ var event = (store2, dynamicData2) => {
7579
7753
  if (!Array.isArray(store2.formData.events)) {
7580
7754
  store2.formData.events = [];
7581
7755
  }
7582
- saveFormdataInLocalStorage(store2.formData, path);
7756
+ saveFormdataInSessionStorage(store2.formData, path);
7583
7757
  const finalPath = `${path}.events[${(_c = (_b = store2.formData) == null ? void 0 : _b.events) == null ? void 0 : _c.length}]`;
7584
7758
  store2.searchParams.set("path", finalPath);
7585
7759
  store2.setSearchParams(store2.searchParams);
@@ -7589,7 +7763,7 @@ var event = (store2, dynamicData2) => {
7589
7763
  var _a;
7590
7764
  const rowId = dynamicData2.path.split(".")[1];
7591
7765
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
7592
- saveFormdataInLocalStorage(store2.formData, path);
7766
+ saveFormdataInSessionStorage(store2.formData, path);
7593
7767
  const finalPath = `${path}.events[${rowId}]`;
7594
7768
  store2.searchParams.set("path", finalPath);
7595
7769
  store2.setSearchParams(store2.searchParams);
@@ -7771,6 +7945,10 @@ async function mergeFormdata(handlerResponse, componentName2, eventConfig, store
7771
7945
  handlerResponse && store2.setFormdata((pre) => {
7772
7946
  return { ...pre, [componentName2]: { rows: handlerResponse.data } };
7773
7947
  });
7948
+ } else if (eventConfig.type === "page") {
7949
+ store2.setFormdata((pre) => {
7950
+ return { ...pre, ...handlerResponse.data };
7951
+ });
7774
7952
  } else {
7775
7953
  handlerResponse && store2.setFormdata((pre) => {
7776
7954
  return { ...pre, [componentName2]: handlerResponse.data };
@@ -7863,6 +8041,7 @@ const extractEvents = (eventConfig) => {
7863
8041
  var service = (funcParams) => {
7864
8042
  return {
7865
8043
  setPage: async function() {
8044
+ eventGroups = {};
7866
8045
  eventGroups = extractEvents(funcParams.config);
7867
8046
  await executeEvents(
7868
8047
  { Handler: "refresh", eventType: "onPageRefresh" },
@@ -10221,5 +10400,8 @@ const buildUiSchema = (config) => {
10221
10400
  }
10222
10401
  return elements;
10223
10402
  };
10224
- export { buildConfig, buildUiSchema, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService };
10403
+ var clearSessionStorage = () => {
10404
+ sessionStorage.removeItem("pageFormdata");
10405
+ };
10406
+ export { buildConfig, buildUiSchema, clearSessionStorage, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService };
10225
10407
  //# sourceMappingURL=impaktapps-ui-builder.es.js.map