impaktapps-ui-builder 0.0.963-CopyComponent.8 → 0.0.963-copyElement.1000

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.
@@ -81,6 +81,7 @@ export declare const TableSection: (theme: any) => {
81
81
  onClick: string;
82
82
  tooltipMessage: string;
83
83
  styleDefault?: undefined;
84
+ disabled?: undefined;
84
85
  };
85
86
  style: {
86
87
  color: any;
@@ -105,6 +106,7 @@ export declare const TableSection: (theme: any) => {
105
106
  onClick: string;
106
107
  tooltipMessage: string;
107
108
  styleDefault?: undefined;
109
+ disabled?: undefined;
108
110
  };
109
111
  style?: undefined;
110
112
  };
@@ -125,6 +127,7 @@ export declare const TableSection: (theme: any) => {
125
127
  icon: string;
126
128
  onClick: string;
127
129
  styleDefault: boolean;
130
+ disabled: boolean;
128
131
  color?: undefined;
129
132
  tooltipMessage?: undefined;
130
133
  };
@@ -39,6 +39,12 @@ export declare const PageMasterSchema: {
39
39
  };
40
40
  };
41
41
  };
42
+ RemoveItemButton: {
43
+ disabled: boolean;
44
+ };
45
+ Paste_Icon: {
46
+ disabled: boolean;
47
+ };
42
48
  };
43
49
  required: string[];
44
50
  };
@@ -16,9 +16,9 @@ declare const _default: (store: any, dynamicData: any, submitHandler: any, servi
16
16
  backHandler: () => void;
17
17
  deletePopUpComponent: () => void;
18
18
  deletePopUpEvent: () => void;
19
- CopyComponent: () => void;
20
- PasteComponent: () => void;
21
- CopyEvent: () => void;
22
- PasteEvent: () => void;
19
+ CopyComponent: (store: any) => void;
20
+ PasteComponent: (store: any) => void;
21
+ CopyEvent: (store: any) => void;
22
+ PasteEvent: (store: any) => void;
23
23
  };
24
24
  export default _default;
@@ -87,7 +87,7 @@ declare const _default: (store: any, dynamicData: any, submitHandler: any, servi
87
87
  deleteEvent: () => Promise<void>;
88
88
  backHandler: () => void;
89
89
  deletePopUpEvent: () => void;
90
- CopyEvent: () => void;
91
- PasteEvent: () => void;
90
+ CopyEvent: (store: any) => void;
91
+ PasteEvent: (store: any) => void;
92
92
  };
93
93
  export default _default;
@@ -50,6 +50,12 @@ declare const _default: (funcParams: funcParamsProps) => {
50
50
  };
51
51
  };
52
52
  };
53
+ RemoveItemButton: {
54
+ disabled: boolean;
55
+ };
56
+ Paste_Icon: {
57
+ disabled: boolean;
58
+ };
53
59
  };
54
60
  required: string[];
55
61
  };
@@ -65,6 +71,7 @@ declare const _default: (funcParams: funcParamsProps) => {
65
71
  deletePopUpEvent: () => void;
66
72
  CopyComponent: () => void;
67
73
  PasteComponent: () => void;
74
+ RemoveItemButton: () => void;
68
75
  CopyEvent: () => void;
69
76
  PasteEvent: () => void;
70
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.963-CopyComponent.8",
3
+ "version": "0.0.963-copyElement.1000",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -36,6 +36,8 @@ export const EventSection = (theme)=>{
36
36
  }
37
37
  },
38
38
 
39
+
40
+ ////////////////////
39
41
  {
40
42
  widget: {
41
43
  type: "Control",
@@ -49,7 +51,7 @@ export const EventSection = (theme)=>{
49
51
  // color: "info",
50
52
  onClick: "PasteEvent",
51
53
  size: "small",
52
- icon: "SendIcon",
54
+ icon: "PasteIcon",
53
55
  iconLabel: "Paste",
54
56
  styleDefault: true,
55
57
  },
@@ -59,6 +61,9 @@ export const EventSection = (theme)=>{
59
61
  },
60
62
  }
61
63
  },
64
+
65
+
66
+ //////////////////////////
62
67
  ]
63
68
  },
64
69
  disableAction: true,
@@ -123,7 +128,7 @@ export const EventSection = (theme)=>{
123
128
  },
124
129
  },
125
130
 
126
-
131
+ ///////////////////////////////
127
132
  {
128
133
  header: "Copy",
129
134
  field: "Copy_Event",
@@ -145,6 +150,8 @@ export const EventSection = (theme)=>{
145
150
  },
146
151
  },
147
152
  },
153
+
154
+ ////////////////////////////////
148
155
  ]
149
156
  }]}
150
157
  return uiSchema
@@ -36,7 +36,7 @@ export const TableSection = (theme) => {
36
36
  }
37
37
  },
38
38
 
39
-
39
+ /////////////////////////////////////////
40
40
  {
41
41
  widget: {
42
42
  type: "Control",
@@ -50,7 +50,7 @@ export const TableSection = (theme) => {
50
50
  // color: "info",
51
51
  onClick: "PasteComponent",
52
52
  size: "small",
53
- icon: "SendIcon",
53
+ icon: "PasteIcon",
54
54
  iconLabel: "Paste",
55
55
  styleDefault: true,
56
56
  },
@@ -60,6 +60,8 @@ export const TableSection = (theme) => {
60
60
  },
61
61
  }
62
62
  },
63
+
64
+ /////////////////////////////////////////
63
65
  ]
64
66
  },
65
67
  disableAction: true,
@@ -122,7 +124,7 @@ export const TableSection = (theme) => {
122
124
  },
123
125
  },
124
126
 
125
-
127
+ ////////////////////////////////////////
126
128
  {
127
129
  header: "Copy",
128
130
  field: "Copy_Component",
@@ -139,10 +141,13 @@ export const TableSection = (theme) => {
139
141
  // color: "error",
140
142
  onClick: "CopyComponent",
141
143
  styleDefault: true,
144
+ disabled: false
142
145
  },
143
146
  },
144
147
  },
145
148
  },
149
+
150
+ ///////////////////////////////////////
146
151
  ]
147
152
  }]
148
153
  }
@@ -341,7 +341,15 @@ export const ComponentSchema: any = {
341
341
  name: {
342
342
  type: "string",
343
343
  },
344
- label: { type: 'string' }
344
+ label: { type: 'string' },
345
+
346
+ ////////////
347
+ RemoveItemButton:{
348
+ disabled: true,
349
+ },
350
+ Paste_Icon:{
351
+ disabled: true,
352
+ }
345
353
  },
346
354
 
347
355
  required: ["name",]
@@ -363,16 +363,65 @@ export const componentBasicUiSchema: any = (theme)=>{
363
363
  },
364
364
  },
365
365
  ]
366
- },
366
+ },
367
+
368
+ //////////////////////////////////////
369
+
367
370
  {
368
- type: "Control",
369
- scope: "#/properties/EmptyBox",
370
- options: {
371
- widget: "EmptyBox",
372
- },
371
+ type: "HorizontalLayout",
373
372
  config: {
374
- layout: { xs: 4, sm: 8 },
373
+ layout:{xs:12,sm: 6}
375
374
  },
375
+ elements: [
376
+ {
377
+ type: "Control",
378
+ scope: "#/properties/RemoveItemButton",
379
+ options: {
380
+ widget: "IconButton",
381
+ },
382
+ config: {
383
+ layout: { xs: 1, sm: 1 },
384
+ main: {
385
+ onClick: "RemoveCopiedConfig",
386
+ size: "large",
387
+ icon: "RejectIcon",
388
+ styleDefault: true,
389
+ },
390
+ style:{
391
+ marginLeft: "-10px"
392
+ }
393
+ },
394
+ },
395
+
396
+ {
397
+ type: "Control",
398
+ scope: "#/properties/copiedElementDetails",
399
+
400
+ options: {
401
+ widget: "Box",
402
+ },
403
+ config: {
404
+ layout: { xs: 6, sm: 6 },
405
+ main: {
406
+ heading: "No element copied",
407
+ },
408
+ style: {
409
+ color: "#a1a09d",
410
+ marginLeft: "-10px"
411
+ },
412
+ },
413
+ },
414
+ {
415
+ type: "Control",
416
+ scope: "#/properties/EmptyBox",
417
+ options: {
418
+ widget: "EmptyBox",
419
+ },
420
+ config: {
421
+ layout: { xs: 1, sm: 5 },
422
+ },
423
+ },
424
+ ]
376
425
  },
377
426
  {
378
427
  type: "Control",
@@ -40,7 +40,13 @@ export const PageMasterSchema = {
40
40
  }
41
41
  },
42
42
  },
43
- }
43
+ },
44
+ RemoveItemButton:{
45
+ disabled: true
46
+ },
47
+ Paste_Icon:{
48
+ disabled: true,
49
+ }
44
50
  },
45
51
  required:["template","name", "label"]
46
52
  }
@@ -141,7 +141,7 @@ export const PageMasterUiSchema: any = (theme) => {
141
141
  // color: "info",
142
142
  onClick: "PasteComponent",
143
143
  size: "small",
144
- icon: "SendIcon",
144
+ icon: "PasteIcon",
145
145
  iconLabel: "Paste",
146
146
  styleDefault: true,
147
147
  },
@@ -284,7 +284,7 @@ export const PageMasterUiSchema: any = (theme) => {
284
284
  // color: "info",
285
285
  onClick: "PasteEvent",
286
286
  size: "small",
287
- icon: "SendIcon",
287
+ icon: "PasteIcon",
288
288
  iconLabel: "Paste",
289
289
  styleDefault: true,
290
290
  },
@@ -384,14 +384,60 @@ export const PageMasterUiSchema: any = (theme) => {
384
384
  ],
385
385
  },
386
386
  {
387
- type: "Control",
388
- scope: "#/properties/btn",
389
- options: {
390
- widget: "EmptyBox",
391
- },
387
+ type: "HorizontalLayout",
392
388
  config: {
393
- layout: { xs: 8, sm: 10 },
394
- }
389
+ layout:{xs:12,sm: 6}
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: "RemoveCopiedConfig",
402
+ size: "large",
403
+ icon: "RejectIcon",
404
+ styleDefault: true,
405
+ },
406
+ style:{
407
+ marginLeft: "-10px"
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: "#a1a09d",
426
+ marginLeft: "-10px"
427
+ },
428
+ },
429
+ },
430
+ {
431
+ type: "Control",
432
+ scope: "#/properties/EmptyBox",
433
+ options: {
434
+ widget: "EmptyBox",
435
+ },
436
+ config: {
437
+ layout: { xs: 1, sm: 5 },
438
+ },
439
+ },
440
+ ]
395
441
  },
396
442
  {
397
443
  type: "Control",
@@ -120,7 +120,7 @@ export const EventUiSchema: any = (theme) => {
120
120
  // color: "info",
121
121
  onClick: "PasteEvent",
122
122
  size: "small",
123
- icon: "SendIcon",
123
+ icon: "PasteIcon",
124
124
  iconLabel: "Paste",
125
125
  styleDefault: true,
126
126
  },
@@ -217,14 +217,60 @@ export const EventUiSchema: any = (theme) => {
217
217
  ],
218
218
  },
219
219
  {
220
- type: "Control",
221
- scope: "#/properties/EmptyBox",
222
- options: {
223
- widget: "EmptyBox",
224
- },
220
+ type: "HorizontalLayout",
225
221
  config: {
226
- layout: { xs: 4, sm: 8 },
222
+ layout:{xs:12,sm: 6}
227
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: "RemoveCopiedConfig",
235
+ size: "large",
236
+ icon: "RejectIcon",
237
+ styleDefault: true,
238
+ },
239
+ style:{
240
+ marginLeft: "-10px"
241
+ }
242
+ },
243
+ },
244
+
245
+ {
246
+ type: "Control",
247
+ scope: "#/properties/copiedElementDetails",
248
+
249
+ options: {
250
+ widget: "Box",
251
+ },
252
+ config: {
253
+ layout: { xs: 6, sm: 6 },
254
+ main: {
255
+ heading: "No element copied",
256
+ },
257
+ style: {
258
+ color: "#a1a09d",
259
+ marginLeft: "-10px"
260
+ },
261
+ },
262
+ },
263
+ {
264
+ type: "Control",
265
+ scope: "#/properties/EmptyBox",
266
+ options: {
267
+ widget: "EmptyBox",
268
+ },
269
+ config: {
270
+ layout: { xs: 1, sm: 5 },
271
+ },
272
+ },
273
+ ]
228
274
  },
229
275
  {
230
276
  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";
@@ -60,6 +60,10 @@ export const refreshPage = (type: string, store: any) => {
60
60
  UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection(store.theme.myTheme), ValidationSection];
61
61
 
62
62
  }
63
+ if (sessionStorage.getItem("copiedConfig") ) {
64
+ const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
65
+ UiSchema.elements[4].element[1].config.main.heading = `Copied Element: ${formData.name}`;
66
+ }
63
67
  store.setUiSchema(UiSchema);
64
68
  }
65
69
 
@@ -174,15 +178,37 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
174
178
  },
175
179
 
176
180
 
177
- CopyComponent: function(){
178
- const rowId = dynamicData.path.split(".")[1];
179
- const parentPathOfCopiedComponent = store.searchParams?.get("path");
180
- const copiedComponentPath = parentPathOfCopiedComponent ? `${parentPathOfCopiedComponent}.elements[${rowId}]` : `elements[${rowId}]`;
181
- const formData = getFormdataFromSessionStorage(copiedComponentPath);
182
- sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
181
+
182
+
183
+ CopyComponent: function(store){
184
+ if (sessionStorage.getItem("copiedConfig") ) {
185
+ store.setNotify({
186
+ FailMessage: "Element already copied. Cancel to copy again.",
187
+ Fail: true,
188
+ });
189
+ }
190
+ else{
191
+ const schema = cloneDeep(store.schema);
192
+ const uiSchema = cloneDeep(store.uiSchema);
193
+ schema.properties.RemoveItemButton.disabled = false;
194
+
195
+ const rowId = dynamicData.path.split(".")[1];
196
+ const parentPathOfCopiedComponent = store.searchParams?.get("path");
197
+ const copiedComponentPath = parentPathOfCopiedComponent ? `${parentPathOfCopiedComponent}.elements[${rowId}]` : `elements[${rowId}]`;
198
+
199
+ const formData = getFormdataFromSessionStorage(copiedComponentPath);
200
+
201
+ uiSchema.elements[4].config.main.heading = `Copied Element: ${formData.name}`;
202
+
203
+ sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
204
+
205
+ store.setSchema(schema);
206
+ }
183
207
  },
184
208
 
185
- PasteComponent: function(){
209
+ PasteComponent: function(store){
210
+ // const schema = cloneDeep(store.schema);
211
+
186
212
  const path = store.searchParams?.get("path");
187
213
  const formData = getFormdataFromSessionStorage(path)
188
214
  const insertComponentPath = formData.elements.length;
@@ -190,19 +216,20 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
190
216
  const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
191
217
  if(!copiedData.elements){
192
218
  store.setNotify({
193
- FailMessage: "Pasting not Valid",
219
+ FailMessage: "Pasting element not Valid",
194
220
  Fail: true,
195
221
  });
196
222
  }
197
223
  else{
198
224
  saveFormdataInSessionStorage(copiedData, finalPath);
199
225
  sessionStorage.removeItem('copiedConfig');
226
+
200
227
  this.setPage();
201
228
  }
202
229
  },
203
230
 
204
231
 
205
- CopyEvent: function(){
232
+ CopyEvent: function(store){
206
233
  const rowId = dynamicData.path.split(".")[1];
207
234
  const path = store.searchParams?.get("path");
208
235
  const updatedPath = path ? `${path}.events[${rowId}]` : `events[${rowId}]`;
@@ -211,7 +238,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
211
238
  sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
212
239
  },
213
240
 
214
- PasteEvent: function(){
241
+ PasteEvent: function(store){
215
242
  const path = store.searchParams?.get("path");
216
243
  const formData = getFormdataFromSessionStorage(path)
217
244
  const insertComponentPath = formData.events.length;
@@ -34,7 +34,12 @@ 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
+ const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
40
+ UiSchema.elements[2].element[1].config.main.heading = `Copied Element: ${formData.name}`;
41
+ }
42
+ return UiSchema;
38
43
  },
39
44
  getSchema: () => {
40
45
  return PageMasterSchema;
@@ -103,12 +108,29 @@ export default (funcParams: funcParamsProps) => {
103
108
  },
104
109
 
105
110
 
106
- CopyComponent: Component(store, dynamicData, submitHandler, service).CopyComponent,
111
+ CopyComponent: function(){
112
+ Component(store, dynamicData, submitHandler, service).CopyComponent(store)
113
+ },
114
+
115
+
116
+ PasteComponent: function(){
117
+ Component(store, dynamicData, submitHandler, service).PasteComponent(store)
118
+ },
119
+
120
+ RemoveItemButton: function(){
121
+
122
+ },
123
+
107
124
 
108
- PasteComponent: Component(store, dynamicData, submitHandler, service).PasteComponent,
125
+ CopyEvent: function(){
126
+ Component(store, dynamicData, submitHandler, service).CopyEvent(store)
127
+ },
109
128
 
110
- CopyEvent: Component(store, dynamicData, submitHandler, service).CopyEvent,
111
- PasteEvent: Component(store, dynamicData, submitHandler, service).PasteEvent,
129
+
130
+ PasteEvent: function(){
131
+ Component(store, dynamicData, submitHandler, service).PasteEvent(store)
132
+ },
133
+
112
134
 
113
135
 
114
136
  // CopyComponent: function(){