impaktapps-ui-builder 0.0.968 → 0.0.970-test.2

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 (25) hide show
  1. package/dist/impaktapps-ui-builder.es.js +523 -75
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +15 -15
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/uischema/eventSection.d.ts +55 -2
  6. package/dist/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.d.ts +0 -15
  7. package/dist/src/impaktapps-ui-builder/builder/build/uischema/tableSection.d.ts +50 -2
  8. package/dist/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.d.ts +3 -0
  9. package/dist/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.d.ts +3 -0
  10. package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +8 -2
  11. package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +5 -0
  12. package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +5 -0
  13. package/package.json +1 -1
  14. package/src/impaktapps-ui-builder/builder/build/uischema/eventSection.ts +47 -0
  15. package/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.ts +6 -7
  16. package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +45 -1
  17. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +4 -1
  18. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +98 -50
  19. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.ts +4 -1
  20. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +149 -9
  21. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +4 -1
  22. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +96 -6
  23. package/src/impaktapps-ui-builder/builder/services/component.ts +85 -6
  24. package/src/impaktapps-ui-builder/builder/services/event.ts +18 -3
  25. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +20 -2
@@ -127,6 +127,30 @@ export const PageMasterUiSchema: any = (theme) => {
127
127
  },
128
128
  }
129
129
  },
130
+
131
+ {
132
+ widget: {
133
+ type: "Control",
134
+ scope: "#/properties/Paste_Component",
135
+
136
+ options: {
137
+ widget: "IconButton",
138
+ },
139
+ config: {
140
+ main: {
141
+ // color: "info",
142
+ onClick: "copyPasteElement",
143
+ size: "small",
144
+ icon: "PasteIcon",
145
+ iconLabel: "Paste",
146
+ styleDefault: true,
147
+ },
148
+ style: {
149
+ mt: "6px",
150
+ },
151
+ },
152
+ }
153
+ },
130
154
  ]
131
155
  },
132
156
  disableAction: true,
@@ -187,7 +211,30 @@ export const PageMasterUiSchema: any = (theme) => {
187
211
  },
188
212
  },
189
213
  },
190
- }
214
+ },
215
+
216
+ {
217
+ header: "Copy",
218
+ field: "Copy_Component",
219
+ flex: 1,
220
+ widget: {
221
+ type: "Control",
222
+ scope: "#/properties/Copy_Component",
223
+ options: {
224
+ widget: "IconButton",
225
+ },
226
+ config: {
227
+ main: {
228
+ icon: "FileCopyIcon",
229
+ // color: "error",
230
+ onClick: "copyPasteElement",
231
+ styleDefault: true,
232
+ },
233
+ },
234
+ },
235
+ },
236
+
237
+
191
238
  ]
192
239
  },
193
240
  {
@@ -223,6 +270,30 @@ export const PageMasterUiSchema: any = (theme) => {
223
270
  },
224
271
  }
225
272
  },
273
+
274
+ {
275
+ widget: {
276
+ type: "Control",
277
+ scope: "#/properties/Paste_Event",
278
+
279
+ options: {
280
+ widget: "IconButton",
281
+ },
282
+ config: {
283
+ main: {
284
+ // color: "info",
285
+ onClick: "copyPasteElement",
286
+ size: "small",
287
+ icon: "PasteIcon",
288
+ iconLabel: "Paste",
289
+ styleDefault: true,
290
+ },
291
+ style: {
292
+ mt: "6px",
293
+ },
294
+ },
295
+ }
296
+ },
226
297
  ]
227
298
  },
228
299
 
@@ -284,6 +355,28 @@ export const PageMasterUiSchema: any = (theme) => {
284
355
  },
285
356
  },
286
357
  },
358
+
359
+
360
+ {
361
+ header: "Copy",
362
+ field: "Copy_Event",
363
+ flex: 1,
364
+ widget: {
365
+ type: "Control",
366
+ scope: "#/properties/Copy_Event",
367
+ options: {
368
+ widget: "IconButton",
369
+ },
370
+ config: {
371
+ main: {
372
+ icon: "FileCopyIcon",
373
+ // color: "error",
374
+ onClick: "copyPasteElement",
375
+ styleDefault: true,
376
+ },
377
+ },
378
+ },
379
+ },
287
380
  ]
288
381
  // }]
289
382
  },
@@ -291,14 +384,61 @@ export const PageMasterUiSchema: any = (theme) => {
291
384
  ],
292
385
  },
293
386
  {
294
- type: "Control",
295
- scope: "#/properties/btn",
296
- options: {
297
- widget: "EmptyBox",
298
- },
387
+ type: "HorizontalLayout",
299
388
  config: {
300
- layout: { xs: 8, sm: 10 },
301
- }
389
+ layout:{xs:12,sm: 9}
390
+ },
391
+ elements: [
392
+ {
393
+ type: "Control",
394
+ scope: "#/properties/RemoveItemButton",
395
+ options: {
396
+ widget: "IconButton",
397
+ },
398
+ config: {
399
+ layout: { xs: 1, sm: 1 },
400
+ main: {
401
+ onClick: "RemoveItemButton",
402
+ size: "large",
403
+ icon: "RejectIcon",
404
+ styleDefault: true,
405
+ },
406
+ style:{
407
+ marginLeft: "-5px"
408
+ }
409
+ },
410
+ },
411
+
412
+ {
413
+ type: "Control",
414
+ scope: "#/properties/copiedElementDetails",
415
+
416
+ options: {
417
+ widget: "Box",
418
+ },
419
+ config: {
420
+ layout: { xs: 6, sm: 6 },
421
+ main: {
422
+ heading: "No element copied",
423
+ },
424
+ style: {
425
+ color: "#535557",
426
+ marginLeft: "-30px",
427
+ fontSize: "12px"
428
+ },
429
+ },
430
+ },
431
+ {
432
+ type: "Control",
433
+ scope: "#/properties/EmptyBox",
434
+ options: {
435
+ widget: "EmptyBox",
436
+ },
437
+ config: {
438
+ layout: { xs: 1, sm: 5 },
439
+ },
440
+ },
441
+ ]
302
442
  },
303
443
  {
304
444
  type: "Control",
@@ -306,7 +446,7 @@ export const PageMasterUiSchema: any = (theme) => {
306
446
  options: {
307
447
  widget: "Button",
308
448
  },
309
-
449
+
310
450
  config: {
311
451
  layout: { xs: 4, sm: 2 },
312
452
  main: {
@@ -83,7 +83,10 @@ export const EventSchema = {
83
83
  },
84
84
  },
85
85
  },
86
- }
86
+ },
87
+ RemoveItemButton:{
88
+ disabled: true,
89
+ },
87
90
  },
88
91
  required:["eventType","Handler"]
89
92
  }
@@ -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,20 +190,86 @@ 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
- },
220
+ type: "HorizontalLayout",
180
221
  config: {
181
- layout: { xs: 4, sm: 8 },
222
+ layout:{xs:12,sm: 6}
182
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
+ },
260
+ },
261
+ },
262
+ {
263
+ type: "Control",
264
+ scope: "#/properties/EmptyBox",
265
+ options: {
266
+ widget: "EmptyBox",
267
+ },
268
+ config: {
269
+ layout: { xs: 1, sm: 5 },
270
+ },
271
+ },
272
+ ]
183
273
  },
184
274
  {
185
275
  type: "Control",
@@ -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";
@@ -41,9 +41,7 @@ const sectionLabels = {
41
41
  ColumnGroup: ["Core", "Components"]
42
42
  }
43
43
 
44
-
45
-
46
- export const refreshPage = (type: string, store: any) => {
44
+ export function refreshPage (type: string, store: any) {
47
45
  const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
48
46
  if (type) {
49
47
  const sectionUiSchema = {
@@ -58,7 +56,9 @@ export const refreshPage = (type: string, store: any) => {
58
56
  const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
59
57
  UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
60
58
  UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection(store.theme.myTheme), ValidationSection];
61
-
59
+ }
60
+ if (sessionStorage.getItem("copiedConfig") ) {
61
+ this.ElementPathSetter(UiSchema);
62
62
  }
63
63
  store.setUiSchema(UiSchema);
64
64
  }
@@ -79,7 +79,11 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
79
79
  return getFormdataFromSessionStorage(path)
80
80
  },
81
81
  getSchema: function () {
82
- return ComponentSchema;
82
+ const schema = _.cloneDeep(ComponentSchema);
83
+ if (sessionStorage.getItem("copiedConfig") ) {
84
+ schema.properties.RemoveItemButton.disabled = false;
85
+ }
86
+ return schema;
83
87
  },
84
88
  okHandler: () => okHandler(store),
85
89
  saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
@@ -172,5 +176,80 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
172
176
  sessionStorage.setItem('rowId',rowId);
173
177
  store.updateDialog("popUpEventSection");
174
178
  },
179
+
180
+ copyPasteElement: function(paramStore: any, setPage: any = this.setPage.bind(this) ){
181
+ const [actionType, elementType] = dynamicData.path.split('.').pop()?.split('_');
182
+ actionType === "Copy" ? this.CopyElement(paramStore, elementType) : this.PasteElement(setPage, elementType);
183
+ },
184
+ CopyElement: function(paramStore: any = store, elementType: string){
185
+ const schema = cloneDeep(paramStore.schema );
186
+ const uiSchema = cloneDeep(paramStore.uiSchema );
187
+ schema.properties.RemoveItemButton.disabled = false;
188
+
189
+ const rowId = dynamicData.path.split(".")[1];
190
+ const parentPathOfCopiedComponent = store.searchParams?.get("path");
191
+ const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
192
+ const copiedFormData = getFormdataFromSessionStorage(copiedElementPath);
193
+
194
+ this.ElementPathSetter(uiSchema,copiedFormData);
195
+ sessionStorage.setItem('copiedConfig',JSON.stringify(copiedFormData));
196
+ store.setSchema(schema);
197
+ store.setUiSchema(uiSchema);
198
+ },
199
+ PasteElement: function( setPage: any , elementType: string){
200
+ if (!sessionStorage.getItem("copiedConfig") ) {
201
+ store.setNotify({
202
+ FailMessage: "No item has been copied.",
203
+ Fail: true,
204
+ });
205
+ return;
206
+ }
207
+ const pastedElementParentPath = store.searchParams?.get("path");
208
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
209
+ const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
210
+ const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
211
+
212
+ const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
213
+ const notificationMessages = {
214
+ Event: "The pasted content is invalid; the event cannot be integrated into the component section.",
215
+ Component: "The pasted content is invalid; the component cannot be integrated into the event section."
216
+ };
217
+ if(copiedConfig.Handler && elementType === "Component"){
218
+ store.setNotify({
219
+ FailMessage: notificationMessages.Event,
220
+ Fail: true,
221
+ });
222
+ }
223
+ else if(copiedConfig.name && elementType === "Event"){
224
+ store.setNotify({
225
+ FailMessage: notificationMessages.Component,
226
+ Fail: true,
227
+ });
228
+ }
229
+ else{
230
+ saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
231
+ setPage();
232
+ }
233
+ },
234
+ RemoveItemButton: function(paramStore: any = store){
235
+ const schema = cloneDeep(paramStore.schema );
236
+ const uiSchema = cloneDeep(paramStore.uiSchema);
237
+ schema.properties.RemoveItemButton.disabled = true;
238
+ uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
239
+ sessionStorage.removeItem('copiedConfig');
240
+ store.setSchema(schema);
241
+ store.setUiSchema(uiSchema);
242
+ },
243
+ elementPathHandler: function(parentPath: string, rowId: any, elementType: string){
244
+ if(elementType === "Component"){
245
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
246
+ }
247
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
248
+ },
249
+ ElementPathSetter: function(uiSchema: any,copiedFormData?: any){
250
+ const formData = copiedFormData || JSON.parse(sessionStorage.getItem("copiedConfig"));
251
+ const elementHeading = formData.name ? `Copied Path: ${formData.pageName} >${formData.name}` : `Copied Path: ${formData.pageName} >${formData.eventType}`;
252
+ uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
253
+ }
175
254
  }
176
255
  };
@@ -1,7 +1,7 @@
1
1
  import { EventSchema } from "../elements/UiSchema/event/schema";
2
2
  import { EventUiSchema } from "../elements/UiSchema/event/uiSchema";
3
3
  import Component from "./component";
4
- import { okHandler, saveFormdataInSessionStorage, saveHandler } from "./utils";
4
+ import { okHandler, saveFormdataInSessionStorage, saveHandler, getFormdataFromSessionStorage } from "./utils";
5
5
  import { APISection } from "../build/uischema/apiSection";
6
6
  import { getRadioInputField, getSelectField, getTextArea } from "../build/uischema/buildPropertiesSection";
7
7
  import { refreshSectionUiSchema } from "../build/uischema/refresh";
@@ -85,6 +85,10 @@ export default (
85
85
  ...functionsName
86
86
  ]
87
87
  }
88
+ if (sessionStorage.getItem("copiedConfig") ) {
89
+ Component(store, dynamicData, submitHandler, service).ElementPathSetter(uiSchema);
90
+ schema.properties.RemoveItemButton.disabled = false;
91
+ }
88
92
  store.setSchema(schema)
89
93
  store.setUiSchema(uiSchema)
90
94
  },
@@ -94,7 +98,11 @@ export default (
94
98
  return EventUiSchema;
95
99
  },
96
100
  getSchema: () => {
97
- return EventSchema;
101
+ const schema = _.cloneDeep(EventSchema);
102
+ if (sessionStorage.getItem("copiedConfig") ) {
103
+ schema.properties.RemoveItemButton.disabled = false;
104
+ }
105
+ return schema;
98
106
  },
99
107
  okHandler: () => okHandler(store),
100
108
  saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
@@ -138,6 +146,13 @@ export default (
138
146
  const rowId = dynamicData.path.split(".")[1];
139
147
  sessionStorage.setItem('rowId',rowId);
140
148
  store.updateDialog("popUpEvent");
141
- }
149
+ },
150
+ copyPasteElement: function(){
151
+ Component(store, dynamicData, submitHandler, service).copyPasteElement(store,this.setPage.bind(this));
152
+ },
153
+ RemoveItemButton: function(){
154
+ Component(store, dynamicData, submitHandler, service).RemoveItemButton(store)
155
+ },
156
+
142
157
  }
143
158
  };
@@ -34,10 +34,18 @@ export default (funcParams: funcParamsProps) => {
34
34
  return config
35
35
  },
36
36
  getUiSchema: function () {
37
- return PageMasterUiSchema(store.theme.myTheme);
37
+ const UiSchema = _.cloneDeep(PageMasterUiSchema(store.theme.myTheme));
38
+ if (sessionStorage.getItem("copiedConfig") ) {
39
+ Component(store, dynamicData, submitHandler, service).ElementPathSetter(UiSchema)
40
+ }
41
+ return UiSchema;
38
42
  },
39
43
  getSchema: () => {
40
- return PageMasterSchema;
44
+ const schema = _.cloneDeep(PageMasterSchema);
45
+ if (sessionStorage.getItem("copiedConfig") ) {
46
+ schema.properties.RemoveItemButton.disabled = false;
47
+ }
48
+ return schema;
41
49
  },
42
50
  backHandler: () => {
43
51
  sessionStorage.removeItem("pageFormdata")
@@ -101,5 +109,15 @@ export default (funcParams: funcParamsProps) => {
101
109
  sessionStorage.setItem('rowId',rowId);
102
110
  store.updateDialog("popUpPageMasterEvent");
103
111
  },
112
+
113
+
114
+ copyPasteElement: function(){
115
+ Component(store, dynamicData, submitHandler, service).copyPasteElement(store,this.setPage.bind(this));
116
+ },
117
+
118
+ RemoveItemButton: function(){
119
+ Component(store, dynamicData, submitHandler, service).RemoveItemButton(store)
120
+ },
121
+
104
122
  }
105
123
  };