impaktapps-ui-builder 0.0.596 → 0.0.751

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.
Files changed (82) hide show
  1. package/dist/impaktapps-ui-builder.es.js +2208 -1683
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +14 -14
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildCard.d.ts +1 -1
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildTable.d.ts +0 -1
  7. package/dist/src/impaktapps-ui-builder/builder/build/buildThoughtOfTheDay.d.ts +1 -0
  8. package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +1 -1
  9. package/dist/src/impaktapps-ui-builder/builder/build/uischema/apiSection.d.ts +1 -0
  10. package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +23 -0
  11. package/dist/src/impaktapps-ui-builder/builder/build/uischema/button.d.ts +0 -1
  12. package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +170 -82
  13. package/dist/src/impaktapps-ui-builder/builder/build/uischema/eventSection.d.ts +55 -2
  14. package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +52 -23
  15. package/dist/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.d.ts +10 -301
  16. package/dist/src/impaktapps-ui-builder/builder/build/uischema/progressBar.d.ts +6 -1
  17. package/dist/src/impaktapps-ui-builder/builder/build/uischema/tableSection.d.ts +50 -2
  18. package/dist/src/impaktapps-ui-builder/builder/build/uischema/{lazyLoadingTable.d.ts → thoughtOfTheDay.d.ts} +6 -4
  19. package/dist/src/impaktapps-ui-builder/builder/build/uischema/timer.d.ts +1 -14
  20. package/dist/src/impaktapps-ui-builder/builder/build/uischema/validationSections.d.ts +1 -1
  21. package/dist/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.d.ts +3 -0
  22. package/dist/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.d.ts +3 -0
  23. package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +8 -2
  24. package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +5 -0
  25. package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +5 -0
  26. package/dist/src/impaktapps-ui-builder/builder/services/utils.d.ts +4 -4
  27. package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -1
  28. package/package.json +5 -1
  29. package/src/impaktapps-ui-builder/builder/build/buildCard.ts +11 -7
  30. package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +1 -1
  31. package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +1 -1
  32. package/src/impaktapps-ui-builder/builder/build/buildHorizontalBarGraph.ts +21 -13
  33. package/src/impaktapps-ui-builder/builder/build/buildInputSlider.ts +1 -1
  34. package/src/impaktapps-ui-builder/builder/build/buildLeaderboard.ts +18 -13
  35. package/src/impaktapps-ui-builder/builder/build/buildLineGraph.ts +10 -2
  36. package/src/impaktapps-ui-builder/builder/build/buildPieGraph.ts +7 -16
  37. package/src/impaktapps-ui-builder/builder/build/buildProgressBar.ts +1 -1
  38. package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +1 -1
  39. package/src/impaktapps-ui-builder/builder/build/buildRankCard.ts +4 -10
  40. package/src/impaktapps-ui-builder/builder/build/buildSchema.ts +1 -1
  41. package/src/impaktapps-ui-builder/builder/build/buildStackBarGraph.ts +19 -4
  42. package/src/impaktapps-ui-builder/builder/build/buildTable.ts +23 -29
  43. package/src/impaktapps-ui-builder/builder/build/buildTextArea.ts +6 -0
  44. package/src/impaktapps-ui-builder/builder/build/buildThoughtOfTheDay.ts +22 -0
  45. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +27 -12
  46. package/src/impaktapps-ui-builder/builder/build/buildUplaodFile.ts +16 -19
  47. package/src/impaktapps-ui-builder/builder/build/uischema/apiSection.ts +10 -10
  48. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +111 -56
  49. package/src/impaktapps-ui-builder/builder/build/uischema/button.ts +1 -2
  50. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +188 -90
  51. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +11 -11
  52. package/src/impaktapps-ui-builder/builder/build/uischema/dateInputField.ts +3 -3
  53. package/src/impaktapps-ui-builder/builder/build/uischema/eventSection.ts +44 -0
  54. package/src/impaktapps-ui-builder/builder/build/uischema/file.ts +2 -2
  55. package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +13 -29
  56. package/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.ts +10 -367
  57. package/src/impaktapps-ui-builder/builder/build/uischema/multiSelect.ts +1 -1
  58. package/src/impaktapps-ui-builder/builder/build/uischema/progressBar.ts +1 -1
  59. package/src/impaktapps-ui-builder/builder/build/uischema/rankCard.ts +1 -1
  60. package/src/impaktapps-ui-builder/builder/build/uischema/refresh.ts +3 -3
  61. package/src/impaktapps-ui-builder/builder/build/uischema/runnerBoyProgressBar.ts +1 -1
  62. package/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.ts +1 -1
  63. package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +45 -1
  64. package/src/impaktapps-ui-builder/builder/build/uischema/textInputField.ts +1 -1
  65. package/src/impaktapps-ui-builder/builder/build/uischema/thoughtOfTheDay.ts +14 -0
  66. package/src/impaktapps-ui-builder/builder/build/uischema/timer.ts +2 -16
  67. package/src/impaktapps-ui-builder/builder/build/uischema/validationSections.ts +3 -3
  68. package/src/impaktapps-ui-builder/builder/build/uischema/valueTab.ts +3 -3
  69. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +37 -2
  70. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +283 -182
  71. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.ts +4 -1
  72. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +344 -130
  73. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +4 -1
  74. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +194 -80
  75. package/src/impaktapps-ui-builder/builder/services/component.ts +105 -26
  76. package/src/impaktapps-ui-builder/builder/services/event.ts +50 -9
  77. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +32 -14
  78. package/src/impaktapps-ui-builder/builder/services/utils.ts +13 -13
  79. package/src/impaktapps-ui-builder/lib/index.ts +1 -1
  80. package/src/impaktapps-ui-builder/runtime/services/events.ts +26 -23
  81. package/src/impaktapps-ui-builder/runtime/services/service.ts +61 -62
  82. package/src/impaktapps-ui-builder/builder/build/uischema/lazyLoadingTable.ts +0 -15
@@ -47,7 +47,7 @@ export const EventUiSchema: any = (theme) => {
47
47
  widget: "SelectInputField",
48
48
  },
49
49
  config: {
50
- layout: { xs: 11, sm: 4, md: 4, lg: 4 },
50
+ layout: { xs: 6, sm: 6, md: 4, lg: 4 },
51
51
  main: {
52
52
  label: "Event Type",
53
53
  type: "text",
@@ -106,6 +106,30 @@ export const EventUiSchema: any = (theme) => {
106
106
  },
107
107
  }
108
108
  },
109
+
110
+ {
111
+ widget: {
112
+ type: "Control",
113
+ scope: "#/properties/Paste_Event",
114
+
115
+ options: {
116
+ widget: "IconButton",
117
+ },
118
+ config: {
119
+ main: {
120
+ // color: "info",
121
+ onClick: "copyPasteElement",
122
+ size: "small",
123
+ icon: "PasteIcon",
124
+ iconLabel: "Paste",
125
+ styleDefault: true,
126
+ },
127
+ style: {
128
+ mt: "6px",
129
+ },
130
+ },
131
+ }
132
+ },
109
133
  ]
110
134
  },
111
135
  disableAction: true,
@@ -166,30 +190,88 @@ export const EventUiSchema: any = (theme) => {
166
190
  },
167
191
  },
168
192
  },
193
+
194
+ {
195
+ header: "Copy",
196
+ field: "Copy_Event",
197
+ flex: 1,
198
+ widget: {
199
+ type: "Control",
200
+ scope: "#/properties/Copy_Event",
201
+ options: {
202
+ widget: "IconButton",
203
+ },
204
+ config: {
205
+ main: {
206
+ icon: "FileCopyIcon",
207
+ // color: "error",
208
+ onClick: "copyPasteElement",
209
+ styleDefault: true,
210
+ },
211
+ },
212
+ },
213
+ },
169
214
  ]
170
215
  // }]
171
216
  }
172
217
  ],
173
218
  },
174
219
  {
175
- type: "Control",
176
- scope: "#/properties/EmptyBox",
177
- options: {
178
- widget: "EmptyBox",
179
- },
180
- config: {
181
- layout: { xs: 0, sm: 4, md: 4, lg: 4 },
182
- },
183
- },
184
- {
185
- type: "Control",
186
- scope: "#/properties/EmptyBox",
187
- options: {
188
- widget: "EmptyBox",
189
- },
220
+ type: "HorizontalLayout",
190
221
  config: {
191
- layout: { xs: 0, sm: 4, md: 4, lg: 4 },
222
+ layout:{xs:12,sm: 6}
192
223
  },
224
+ elements: [
225
+ {
226
+ type: "Control",
227
+ scope: "#/properties/RemoveItemButton",
228
+ options: {
229
+ widget: "IconButton",
230
+ },
231
+ config: {
232
+ layout: { xs: 1, sm: 1 },
233
+ main: {
234
+ onClick: "RemoveItemButton",
235
+ size: "large",
236
+ icon: "RejectIcon",
237
+ styleDefault: true,
238
+ },
239
+ style:{
240
+ marginLeft: "-10px"
241
+ }
242
+ },
243
+ },
244
+ {
245
+ type: "Control",
246
+ scope: "#/properties/copiedElementDetails",
247
+
248
+ options: {
249
+ widget: "Box",
250
+ },
251
+ config: {
252
+ layout: { xs: 6, sm: 6 },
253
+ main: {
254
+ heading: "No element copied",
255
+ },
256
+ style: {
257
+ color: "#535557",
258
+ marginLeft: "-10px",
259
+ fontSize: "12px",
260
+ marginTop: "4px"
261
+ },
262
+ },
263
+ },
264
+ {
265
+ type: "Control",
266
+ scope: "#/properties/EmptyBox",
267
+ options: {
268
+ widget: "EmptyBox",
269
+ },
270
+ config: {
271
+ layout: { xs: 1, sm: 5 },
272
+ },
273
+ },
274
+ ]
193
275
  },
194
276
  {
195
277
  type: "Control",
@@ -199,7 +281,7 @@ export const EventUiSchema: any = (theme) => {
199
281
  },
200
282
 
201
283
  config: {
202
- layout: 1.8,
284
+ layout: { xs: 4, sm: 2 },
203
285
  main: {
204
286
  name: "Ok",
205
287
  startIcon: "ApproveIcon",
@@ -222,7 +304,7 @@ export const EventUiSchema: any = (theme) => {
222
304
  },
223
305
 
224
306
  config: {
225
- layout: 1.8,
307
+ layout: { xs: 4, sm: 2 },
226
308
  main: {
227
309
  name: "Save & Exit",
228
310
  startIcon: "ApproveIcon",
@@ -247,28 +329,20 @@ export const EventUiSchema: any = (theme) => {
247
329
  layout: {
248
330
  xs: 12,
249
331
  sm: 12,
250
- md: 6,
251
- lg: 6,
332
+ md: 12,
333
+ lg: 12,
252
334
  },
253
335
  main: {
336
+ title: "WARNING!"
254
337
  },
255
338
  style: {
256
- "& .MuiPaper-root":{
257
- width: '30%',
258
- },
259
- "& .MuiTypography-root":{
260
- padding: 0
261
- },
262
- wrapperStyle: {
263
- width: { xs: "100%", sm: "100%", md: "98%" },
264
- }
265
339
  }
266
340
  },
267
341
  elements:
268
342
  [
269
343
  {
270
344
  type: "Control",
271
- scope: "#/properties/label",
345
+ scope: "#/properties/popupText",
272
346
  options: {
273
347
  widget: "Box",
274
348
  },
@@ -277,59 +351,97 @@ export const EventUiSchema: any = (theme) => {
277
351
  main: {
278
352
  heading: "Are you sure you want to delete ?",
279
353
  },
280
- style: {
281
- marginTop: "-40px"
354
+ style:{
355
+ marginTop: "-20px",
356
+ fontSize: "20px",
357
+ "&.MuiTypography-root": {
358
+ padding: "10px 30px 20px 30px",
359
+ textAlign: "center",
360
+ lineHeight: "1"
361
+ }
282
362
  }
283
363
  },
284
364
  },
285
365
  {
286
- type: "Control",
287
- scope: "#/properties/EmptyBox",
288
- options: {
289
- widget: "EmptyBox",
290
- },
366
+ type: "WrapperLayout",
291
367
  config: {
368
+ layout: 12,
292
369
  main: {},
293
- layout: { xs: 11, sm: 5.5, md: 5.5, lg: 5.5 },
294
- },
295
- },
296
- {
297
- type: "Control",
298
- scope: "#/properties/ConfirmDeleteEventButton",
299
- options: {
300
- widget: "Button",
370
+
301
371
  },
302
- config: {
303
- layout: 3,
304
- main: {
305
- name: "Yes",
306
- startIcon: "ApproveIcon",
307
- variant: "contained",
308
- color: "error",
309
- type: "text",
310
- onClick: "deleteEvent",
311
- size: "small",
372
+ elements: [
373
+ {
374
+ type: "Control",
375
+ scope: "#/properties/CancelDeleteEventButton",
376
+ options: {
377
+ widget: "Button",
378
+ },
379
+ config: {
380
+ layout: 6,
381
+ main: {
382
+ name: "No",
383
+ startIcon: "ApproveIcon",
384
+ variant: "contained",
385
+ color: "info",
386
+ type: "text",
387
+ onClick: "deletePopUpEvent",
388
+ size: "large",
389
+ },
390
+ style: {
391
+ position: "absolute",
392
+ bottom: 0,
393
+ left: 0,
394
+ width: "50%",
395
+ borderRadius: 0,
396
+ boxShadow: 0,
397
+ backgroundColor: "transparent",
398
+ color: theme.palette.primary.main,
399
+ borderTop: `0.5px solid ${theme.palette.grey[600]}`,
400
+ borderRight: `0.5px solid ${theme.palette.grey[600]}`,
401
+ "&:hover": {
402
+ color: theme.palette.primary.contrastText,
403
+ backgroundColor: theme.palette.primary.main,
404
+ boxShadow: "none"
405
+ }
406
+ }
407
+ },
312
408
  },
313
- },
314
- },
315
- {
316
- type: "Control",
317
- scope: "#/properties/CancelDeleteEventButton",
318
- options: {
319
- widget: "Button",
320
- },
321
- config: {
322
- layout: 3,
323
- main: {
324
- name: "No",
325
- startIcon: "ApproveIcon",
326
- variant: "contained",
327
- color: "info",
328
- type: "text",
329
- onClick: "deletePopUpEvent",
330
- size: "small",
409
+ {
410
+ type: "Control",
411
+ scope: "#/properties/ConfirmDeleteEventButton",
412
+ options: {
413
+ widget: "Button",
414
+ },
415
+ config: {
416
+ layout: 6,
417
+ main: {
418
+ name: "Yes",
419
+ startIcon: "ApproveIcon",
420
+ variant: "contained",
421
+ color: "error",
422
+ type: "text",
423
+ onClick: "deleteEvent",
424
+ size: "large",
425
+ },
426
+ style: {
427
+ position: "absolute",
428
+ bottom: 0,
429
+ right: 0,
430
+ width: "50%",
431
+ borderRadius: 0,
432
+ boxShadow: 0,
433
+ backgroundColor: "transparent",
434
+ color: theme.palette.error.main,
435
+ borderTop: `0.5px solid ${theme.palette.grey[600]}`,
436
+ "&:hover": {
437
+ color: theme.palette.error.contrastText,
438
+ backgroundColor: theme.palette.error.main,
439
+ boxShadow: "none"
440
+ }
441
+ }
442
+ },
331
443
  },
332
- },
444
+ ]
333
445
  },
334
446
  ]
335
447
  },
@@ -360,7 +472,7 @@ export const EventUiSchema: any = (theme) => {
360
472
  },
361
473
  elements: [
362
474
  {
363
-
475
+
364
476
  type: "Control",
365
477
  scope: "#/properties/FooterText",
366
478
  options: {
@@ -374,13 +486,14 @@ export const EventUiSchema: any = (theme) => {
374
486
  color: theme?.palette?.text.disabled || "#AFAFAF",
375
487
  fontSize: '12px',
376
488
  textAlign: 'center',
377
- lineHeight: 1,
489
+ lineHeight: 2,
378
490
  width: 'fit-content',
379
491
  left: '50%',
380
492
  position: 'relative',
381
493
  margin: 0,
382
494
  flexGrow: 1,
383
- height: 0
495
+ height: 0,
496
+ transform: "translate(-50%,0%)"
384
497
  }
385
498
  },
386
499
  },
@@ -402,7 +515,7 @@ export const EventUiSchema: any = (theme) => {
402
515
  height: 0,
403
516
  margin: 0,
404
517
  top: 0,
405
- right: '82px',
518
+ right: {xs: '12px', sm: '84px'},
406
519
  position: 'absolute',
407
520
  fontSize: '12px',
408
521
  cursor: 'pointer',
@@ -415,7 +528,7 @@ export const EventUiSchema: any = (theme) => {
415
528
  {
416
529
  type: "Control",
417
530
  scope: "#/properties/text",
418
-
531
+
419
532
  options: {
420
533
  widget: "Box",
421
534
  },
@@ -425,6 +538,7 @@ export const EventUiSchema: any = (theme) => {
425
538
  onClick: "backHandler"
426
539
  },
427
540
  style: {
541
+ display: {xs: 'none', sm: "flex"},
428
542
  textAlign: 'left',
429
543
  lineHeight: 1,
430
544
  height: 0,
@@ -1,4 +1,4 @@
1
- import _ from "lodash";
1
+ import _, { cloneDeep } from "lodash";
2
2
  import { ComponentSchema } from "../elements/UiSchema/Component/schema";
3
3
  import { componentBasicUiSchema } from "../elements/UiSchema/Component/uiSchema";
4
4
  import { CoreSection } from "../build/uischema/coreSection";
@@ -8,7 +8,7 @@ import { StyleSection } from "../build/uischema/styleSection";
8
8
  import { TableSection } from "../build/uischema/tableSection";
9
9
  import { ValueTab } from "../build/uischema/valueTab";
10
10
  import { ValidationSection } from "../build/uischema/validationSections";
11
- import { getFormdataFromLocalStorage, okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
11
+ import { getFormdataFromSessionStorage, okHandler, saveFormdataInSessionStorage, saveHandler } from "./utils";
12
12
  const sectionLabels = {
13
13
  Select: ["Core", "Properties", "Value", "Event", "Style", "Validation"],
14
14
  MultipleSelect: ["Core", "Properties", "Value", "Event", "Style", "Validation"],
@@ -38,12 +38,11 @@ const sectionLabels = {
38
38
  DataGrid: ["Core", "Components", "Properties", "Event", "Style"],
39
39
  InputSlider: ["Core", "Properties", "Event", "Style", "Validation"],
40
40
  TreeMap: ["Core", "Components", "Properties", "Event", "Style"],
41
- ColumnGroup: ["Core", "Components"]
41
+ ColumnGroup: ["Core", "Components"],
42
+ Thought: ["Core", "Properties", "Event", "Style", "Validation"]
42
43
  }
43
44
 
44
-
45
-
46
- export const refreshPage = (type: string, store: any) => {
45
+ export function refreshPage (type: string, store: any) {
47
46
  const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
48
47
  if (type) {
49
48
  const sectionUiSchema = {
@@ -58,7 +57,9 @@ export const refreshPage = (type: string, store: any) => {
58
57
  const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
59
58
  UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
60
59
  UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection(store.theme.myTheme), ValidationSection];
61
-
60
+ }
61
+ if (sessionStorage.getItem("copiedConfig") ) {
62
+ this.ElementPathSetter(UiSchema);
62
63
  }
63
64
  store.setUiSchema(UiSchema);
64
65
  }
@@ -76,10 +77,14 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
76
77
  refreshPage: refreshPage,
77
78
  getFormdata: function () {
78
79
  const path = store.searchParams?.get("path");
79
- return getFormdataFromLocalStorage(path)
80
+ return getFormdataFromSessionStorage(path)
80
81
  },
81
82
  getSchema: function () {
82
- return ComponentSchema;
83
+ const schema = _.cloneDeep(ComponentSchema);
84
+ if (sessionStorage.getItem("copiedConfig") ) {
85
+ schema.properties.RemoveItemButton.disabled = false;
86
+ }
87
+ return schema;
83
88
  },
84
89
  okHandler: () => okHandler(store),
85
90
  saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
@@ -95,7 +100,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
95
100
  const rowId = dynamicData.path.split(".")[1];
96
101
  const path = store.searchParams?.get("path");
97
102
  const id = store.searchParams?.get("id");
98
- saveFormdataInLocalStorage(store.ctx.core.data, path)
103
+ saveFormdataInSessionStorage(store.ctx.core.data, path)
99
104
  if (path) {
100
105
  const path = store.searchParams?.get("path");
101
106
  const finalPath = `${path}.elements[${rowId}]`
@@ -108,33 +113,33 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
108
113
  },
109
114
  deleteComponents: function (shouldUpdateDialog: boolean = true) {
110
115
  const path = store.searchParams?.get("path");
111
- const rowId = localStorage.getItem('rowId');
116
+ const rowId = sessionStorage.getItem('rowId');
112
117
  store.formData.elements.splice(rowId, 1);
113
- const response = saveFormdataInLocalStorage(store.ctx.core.data, path)
118
+ const response = saveFormdataInSessionStorage(store.ctx.core.data, path)
114
119
  const data = path ? _.get(response, path) : response;
115
120
  store.setFormdata(data);
116
121
  if (shouldUpdateDialog) {
117
122
  store.updateDialog("popUpComponentSection");
118
123
  }
119
- localStorage.removeItem('rowId');
124
+ sessionStorage.removeItem('rowId');
120
125
  },
121
126
  deleteEvent: function (shouldUpdateDialog: boolean = true) {
122
127
  const path = store.searchParams?.get("path");
123
- const rowId = localStorage.getItem('rowId');
128
+ const rowId = sessionStorage.getItem('rowId');
124
129
  store.formData.events.splice(rowId, 1);
125
- const response = saveFormdataInLocalStorage(store.ctx.core.data, path)
130
+ const response = saveFormdataInSessionStorage(store.ctx.core.data, path)
126
131
  store.setFormdata(_.get(response, path));
127
132
  if (shouldUpdateDialog) {
128
133
  store.updateDialog("popUpEventSection")
129
134
  }
130
- localStorage.removeItem('rowId');
135
+ sessionStorage.removeItem('rowId');
131
136
  },
132
137
  widgetAddClickHandler: function () {
133
138
  if (!Array.isArray(store.formData.elements)) {
134
139
  store.formData.elements = []
135
140
  }
136
141
  const path = store.searchParams?.get("path");
137
- saveFormdataInLocalStorage(store.ctx.core.data, path)
142
+ saveFormdataInSessionStorage(store.ctx.core.data, path)
138
143
  const finalPath = `${path}.elements[${store.formData.elements.length}]`
139
144
  store.searchParams.set("path", finalPath)
140
145
  store.setSearchParams(store.searchParams)
@@ -145,7 +150,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
145
150
  const rowId = dynamicData.path.split(".")[1];
146
151
  const path = store.searchParams?.get("path");
147
152
  const id = store.searchParams?.get("id");
148
- saveFormdataInLocalStorage(store.ctx.core.data, path)
153
+ saveFormdataInSessionStorage(store.ctx.core.data, path)
149
154
  const finalPath = `${path}.events[${rowId}]`
150
155
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
151
156
  },
@@ -155,7 +160,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
155
160
  if (!Array.isArray(store.formData.events)) {
156
161
  store.formData.events = []
157
162
  }
158
- saveFormdataInLocalStorage(store.ctx.core.data, path)
163
+ saveFormdataInSessionStorage(store.ctx.core.data, path)
159
164
  const finalPath = `${path}.events[${store.formData.events.length}]`
160
165
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
161
166
  },
@@ -164,20 +169,94 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
164
169
  },
165
170
  deletePopUpComponent: function () {
166
171
  const rowId = dynamicData.path.split(".")[1];
167
- localStorage.setItem('rowId', rowId);
172
+ sessionStorage.setItem('rowId',rowId);
168
173
  store.updateDialog("popUpComponentSection");
169
174
  },
170
175
  deletePopUpEvent: function () {
171
176
  const rowId = dynamicData.path.split(".")[1];
172
- localStorage.setItem('rowId', rowId);
177
+ sessionStorage.setItem('rowId',rowId);
173
178
  store.updateDialog("popUpEventSection");
174
179
  },
175
- }
176
- };
177
-
178
-
179
-
180
180
 
181
+ copyPasteElement: function(paramStore: any, setPage: any = this.setPage.bind(this) ){
182
+ const [actionType, elementType] = dynamicData.path.split('.').pop()?.split('_');
183
+ actionType === "Copy" ? this.CopyElement(paramStore, elementType) : this.PasteElement(setPage, elementType);
184
+ },
185
+ CopyElement: function(paramStore: any = store, elementType: string){
186
+ const schema = cloneDeep(paramStore.schema );
187
+ const uiSchema = cloneDeep(paramStore.uiSchema );
188
+ schema.properties.RemoveItemButton.disabled = false;
181
189
 
190
+ const rowId = dynamicData.path.split(".")[1];
191
+ const parentPathOfCopiedComponent = store.searchParams?.get("path");
192
+ const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
193
+ const copiedFormData = getFormdataFromSessionStorage(copiedElementPath);
182
194
 
195
+ this.ElementPathSetter(uiSchema,copiedFormData);
196
+ sessionStorage.setItem('copiedConfig',JSON.stringify(copiedFormData));
197
+ store.setSchema(schema);
198
+ store.setUiSchema(uiSchema);
199
+ },
200
+ PasteElement: function( setPage: any , elementType: string){
201
+ if (!sessionStorage.getItem("copiedConfig") ) {
202
+ store.setNotify({
203
+ FailMessage: "No item has been copied.",
204
+ Fail: true,
205
+ });
206
+ return;
207
+ }
208
+ const pastedElementParentPath = store.searchParams?.get("path");
209
+ if (!Array.isArray(store.formData.elements) ) {
210
+ store.formData.elements = []
211
+ }
212
+ if (!Array.isArray(store.formData.events)) {
213
+ store.formData.events = []
214
+ }
215
+ saveFormdataInSessionStorage(store.ctx.core.data, pastedElementParentPath);
216
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
217
+ const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
218
+ const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
183
219
 
220
+ const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
221
+ const notificationMessages = {
222
+ Event: " The event cannot be integrated into the component section.",
223
+ Component: "The component cannot be integrated into the event section."
224
+ };
225
+ if(copiedConfig.Handler && elementType === "Component"){
226
+ store.setNotify({
227
+ FailMessage: notificationMessages.Event,
228
+ Fail: true,
229
+ });
230
+ }
231
+ else if(copiedConfig.name && elementType === "Event"){
232
+ store.setNotify({
233
+ FailMessage: notificationMessages.Component,
234
+ Fail: true,
235
+ });
236
+ }
237
+ else{
238
+ saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
239
+ setPage();
240
+ }
241
+ },
242
+ RemoveItemButton: function(paramStore: any = store){
243
+ const schema = cloneDeep(paramStore.schema );
244
+ const uiSchema = cloneDeep(paramStore.uiSchema);
245
+ schema.properties.RemoveItemButton.disabled = true;
246
+ uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
247
+ sessionStorage.removeItem('copiedConfig');
248
+ store.setSchema(schema);
249
+ store.setUiSchema(uiSchema);
250
+ },
251
+ elementPathHandler: function(parentPath: string, rowId: any, elementType: string){
252
+ if(elementType === "Component"){
253
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
254
+ }
255
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
256
+ },
257
+ ElementPathSetter: function(uiSchema: any,copiedFormData?: any){
258
+ const formData = copiedFormData || JSON.parse(sessionStorage.getItem("copiedConfig"));
259
+ uiSchema.elements[2].elements[1].config.main.heading = `Copied Path: ${formData.pageName}`;
260
+ }
261
+ }
262
+ };