impaktapps-ui-builder 0.0.963-copyElement.1016 → 0.0.963-copyElement.1018

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.
@@ -16,10 +16,10 @@ declare const _default: (store: any, dynamicData: any, submitHandler: any, servi
16
16
  backHandler: () => void;
17
17
  deletePopUpComponent: () => void;
18
18
  deletePopUpEvent: () => void;
19
- CopyComponent: (paramStore?: any) => void;
20
- PasteComponent: (paramStore?: any, setPage?: any) => void;
19
+ copyPasteElement: (paramStore: any, setPage?: any) => void;
20
+ elementPathHandler: (parentPath: string, rowId: any, elementType: string) => string;
21
+ CopyElement: (paramStore: any, elementType: string) => void;
22
+ PasteElement: (setPage: any, elementType: string) => void;
21
23
  RemoveItemButton: (paramStore?: any) => void;
22
- CopyEvent: (store: any) => void;
23
- PasteEvent: (store: any) => void;
24
24
  };
25
25
  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: (store: any) => void;
91
- PasteEvent: (store: any) => void;
90
+ copyPasteElement: () => void;
91
+ RemoveItemButton: () => void;
92
92
  };
93
93
  export default _default;
@@ -66,10 +66,7 @@ declare const _default: (funcParams: funcParamsProps) => {
66
66
  deleteEvent: () => void;
67
67
  deletePopUpComponent: () => void;
68
68
  deletePopUpEvent: () => void;
69
- CopyComponent: () => void;
70
- PasteComponent: () => void;
69
+ copyPasteElement: () => void;
71
70
  RemoveItemButton: () => void;
72
- CopyEvent: () => void;
73
- PasteEvent: () => void;
74
71
  };
75
72
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.963-copyElement.1016",
3
+ "version": "0.0.963-copyElement.1018",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -41,7 +41,7 @@ export const EventSection = (theme)=>{
41
41
  {
42
42
  widget: {
43
43
  type: "Control",
44
- scope: "#/properties/Paste_Icon",
44
+ scope: "#/properties/Paste_Event",
45
45
 
46
46
  options: {
47
47
  widget: "IconButton",
@@ -49,7 +49,7 @@ export const EventSection = (theme)=>{
49
49
  config: {
50
50
  main: {
51
51
  // color: "info",
52
- onClick: "PasteEvent",
52
+ onClick: "copyPasteElement",
53
53
  size: "small",
54
54
  icon: "PasteIcon",
55
55
  iconLabel: "Paste",
@@ -127,15 +127,13 @@ export const EventSection = (theme)=>{
127
127
  },
128
128
  },
129
129
  },
130
-
131
- ///////////////////////////////
132
130
  {
133
131
  header: "Copy",
134
132
  field: "Copy_Event",
135
133
  flex: 1,
136
134
  widget: {
137
135
  type: "Control",
138
- scope: "#/properties/CopyEvent",
136
+ scope: "#/properties/Copy_Event",
139
137
  options: {
140
138
  widget: "IconButton",
141
139
  },
@@ -143,15 +141,13 @@ export const EventSection = (theme)=>{
143
141
  main: {
144
142
  icon: "FileCopyIcon",
145
143
  // color: "error",
146
- onClick: "CopyEvent",
144
+ onClick: "copyPasteElement",
147
145
  tooltipMessage: "Reject This Record",
148
146
  styleDefault: true,
149
147
  },
150
148
  },
151
149
  },
152
150
  },
153
-
154
- ////////////////////////////////
155
151
  ]
156
152
  }]}
157
153
  return uiSchema
@@ -40,7 +40,7 @@ export const TableSection = (theme) => {
40
40
  {
41
41
  widget: {
42
42
  type: "Control",
43
- scope: "#/properties/Paste_Icon",
43
+ scope: "#/properties/Paste_Component",
44
44
 
45
45
  options: {
46
46
  widget: "IconButton",
@@ -48,7 +48,7 @@ export const TableSection = (theme) => {
48
48
  config: {
49
49
  main: {
50
50
  // color: "info",
51
- onClick: "PasteComponent",
51
+ onClick: "copyPasteElement",
52
52
  size: "small",
53
53
  icon: "PasteIcon",
54
54
  iconLabel: "Paste",
@@ -131,7 +131,7 @@ export const TableSection = (theme) => {
131
131
  flex: 1,
132
132
  widget: {
133
133
  type: "Control",
134
- scope: "#/properties/CopyComponent",
134
+ scope: "#/properties/Copy_Component",
135
135
  options: {
136
136
  widget: "IconButton",
137
137
  },
@@ -139,7 +139,7 @@ export const TableSection = (theme) => {
139
139
  main: {
140
140
  icon: "FileCopyIcon",
141
141
  // color: "error",
142
- onClick: "CopyComponent",
142
+ onClick: "copyPasteElement",
143
143
  styleDefault: true,
144
144
  disabled: false
145
145
  },
@@ -131,7 +131,7 @@ export const PageMasterUiSchema: any = (theme) => {
131
131
  {
132
132
  widget: {
133
133
  type: "Control",
134
- scope: "#/properties/Paste_Icon",
134
+ scope: "#/properties/Paste_Component",
135
135
 
136
136
  options: {
137
137
  widget: "IconButton",
@@ -139,7 +139,7 @@ export const PageMasterUiSchema: any = (theme) => {
139
139
  config: {
140
140
  main: {
141
141
  // color: "info",
142
- onClick: "PasteComponent",
142
+ onClick: "copyPasteElement",
143
143
  size: "small",
144
144
  icon: "PasteIcon",
145
145
  iconLabel: "Paste",
@@ -219,7 +219,7 @@ export const PageMasterUiSchema: any = (theme) => {
219
219
  flex: 1,
220
220
  widget: {
221
221
  type: "Control",
222
- scope: "#/properties/CopyComponent",
222
+ scope: "#/properties/Copy_Component",
223
223
  options: {
224
224
  widget: "IconButton",
225
225
  },
@@ -227,7 +227,7 @@ export const PageMasterUiSchema: any = (theme) => {
227
227
  main: {
228
228
  icon: "FileCopyIcon",
229
229
  // color: "error",
230
- onClick: "CopyComponent",
230
+ onClick: "copyPasteElement",
231
231
  styleDefault: true,
232
232
  },
233
233
  },
@@ -271,10 +271,12 @@ export const PageMasterUiSchema: any = (theme) => {
271
271
  }
272
272
  },
273
273
 
274
+ /////////////////
275
+
274
276
  {
275
277
  widget: {
276
278
  type: "Control",
277
- scope: "#/properties/Paste_Icon",
279
+ scope: "#/properties/Paste_Event",
278
280
 
279
281
  options: {
280
282
  widget: "IconButton",
@@ -282,7 +284,7 @@ export const PageMasterUiSchema: any = (theme) => {
282
284
  config: {
283
285
  main: {
284
286
  // color: "info",
285
- onClick: "PasteEvent",
287
+ onClick: "copyPasteElement",
286
288
  size: "small",
287
289
  icon: "PasteIcon",
288
290
  iconLabel: "Paste",
@@ -363,7 +365,7 @@ export const PageMasterUiSchema: any = (theme) => {
363
365
  flex: 1,
364
366
  widget: {
365
367
  type: "Control",
366
- scope: "#/properties/CopyEvent",
368
+ scope: "#/properties/Copy_Event",
367
369
  options: {
368
370
  widget: "IconButton",
369
371
  },
@@ -371,7 +373,7 @@ export const PageMasterUiSchema: any = (theme) => {
371
373
  main: {
372
374
  icon: "FileCopyIcon",
373
375
  // color: "error",
374
- onClick: "CopyEvent",
376
+ onClick: "copyPasteElement",
375
377
  styleDefault: true,
376
378
  },
377
379
  },
@@ -110,7 +110,7 @@ export const EventUiSchema: any = (theme) => {
110
110
  {
111
111
  widget: {
112
112
  type: "Control",
113
- scope: "#/properties/Paste_Icon",
113
+ scope: "#/properties/Paste_Event",
114
114
 
115
115
  options: {
116
116
  widget: "IconButton",
@@ -118,7 +118,7 @@ export const EventUiSchema: any = (theme) => {
118
118
  config: {
119
119
  main: {
120
120
  // color: "info",
121
- onClick: "PasteEvent",
121
+ onClick: "copyPasteElement",
122
122
  size: "small",
123
123
  icon: "PasteIcon",
124
124
  iconLabel: "Paste",
@@ -197,7 +197,7 @@ export const EventUiSchema: any = (theme) => {
197
197
  flex: 1,
198
198
  widget: {
199
199
  type: "Control",
200
- scope: "#/properties/CopyEvent",
200
+ scope: "#/properties/Copy_Event",
201
201
  options: {
202
202
  widget: "IconButton",
203
203
  },
@@ -205,7 +205,7 @@ export const EventUiSchema: any = (theme) => {
205
205
  main: {
206
206
  icon: "FileCopyIcon",
207
207
  // color: "error",
208
- onClick: "CopyEvent",
208
+ onClick: "copyPasteElement",
209
209
  styleDefault: true,
210
210
  },
211
211
  },
@@ -181,182 +181,91 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
181
181
  store.updateDialog("popUpEventSection");
182
182
  },
183
183
 
184
-
184
+ copyPasteElement: function(paramStore: any, setPage: any = this.setPage.bind(this) ){
185
+
186
+ // Paste_Event // Paste_Component //Copy_Event //Copy_Component
187
+ // elements.0.Copy_Component
188
+ const path = dynamicData.path.split('.')[2];
189
+ const actionType = path.split('_')[0];
190
+ const elementType = path.split('_')[1];
191
+
192
+ if(actionType === "Copy"){
193
+ this.CopyElement(paramStore, elementType);
194
+ }else{
195
+ this.PasteElement(setPage, elementType);
196
+ }
197
+ },
185
198
 
186
199
 
187
- CopyComponent: function(paramStore = store){
188
- if (sessionStorage.getItem("copiedConfig") ) {
189
- store.setNotify({
190
- FailMessage: "Element already copied. Cancel to copy again.",
191
- Fail: true,
192
- });
200
+ elementPathHandler: function(parentPath: string, rowId, elementType: string){
201
+ if(elementType === "component"){
202
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
193
203
  }
194
- else{
195
- const schema = cloneDeep(paramStore.schema );
196
- const uiSchema = cloneDeep(paramStore.uiSchema );
197
- schema.properties.RemoveItemButton.disabled = false;
198
- // schema.properties.Paste_Icon.disabled = false;
199
-
200
- const rowId = dynamicData.path.split(".")[1];
201
- const parentPathOfCopiedComponent = store.searchParams?.get("path");
202
- const copiedComponentPath = parentPathOfCopiedComponent ? `${parentPathOfCopiedComponent}.elements[${rowId}]` : `elements[${rowId}]`;
204
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
205
+ },
203
206
 
204
- const formData = getFormdataFromSessionStorage(copiedComponentPath);
207
+ CopyElement: function(paramStore: any = store, elementType: string){
205
208
 
206
- uiSchema.elements[2].elements[1].config.main.heading = `Copied Element: ${formData.name}`;
209
+ const schema = cloneDeep(paramStore.schema );
210
+ const uiSchema = cloneDeep(paramStore.uiSchema );
211
+ schema.properties.RemoveItemButton.disabled = false;
212
+ const rowId = dynamicData.path.split(".")[1];
213
+ const parentPathOfCopiedComponent = store.searchParams?.get("path");
214
+
215
+ const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
216
+
217
+ const formData = getFormdataFromSessionStorage(copiedElementPath);
218
+ const elementHeading = elementType === "component" ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
219
+ uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
220
+ sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
221
+ store.setSchema(schema);
222
+ store.setUiSchema(uiSchema);
223
+ },
207
224
 
208
- sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
209
225
 
210
- store.setSchema(schema);
211
- store.setUiSchema(uiSchema);
212
- }
213
- },
214
226
 
215
- PasteComponent: function(paramStore = store, setPage = this.setPage.bind(this)){
227
+ PasteElement: function( setPage , elementType: string){
216
228
  if (!sessionStorage.getItem("copiedConfig") ) {
217
229
  store.setNotify({
218
230
  FailMessage: "No item has been copied.",
219
231
  Fail: true,
220
232
  });
233
+ return;
221
234
  }
222
- else{
223
- const path = store.searchParams?.get("path");
224
- const rowId = dynamicData.path.split(".")[1];
225
-
226
- const formData = getFormdataFromSessionStorage(path)
227
- const insertComponentPath = formData.elements.length;
228
- // const finalPath = `${path}.elements[${insertComponentPath}]`;
229
-
230
- const finalPath = path ? `${path}.elements[${insertComponentPath}]` : `elements[${insertComponentPath}]`;
235
+ const pastedElementParentPath = store.searchParams?.get("path");
236
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
237
+ const insertElementIndex = elementType === "component" ? formData.elements.length : formData.events.length;
238
+ const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
231
239
 
232
- const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
233
- if(copiedData.Handler){
234
- store.setNotify({
235
- FailMessage: "Pasting element not Valid",
236
- Fail: true,
237
- });
238
- }
239
- else{
240
- saveFormdataInSessionStorage(copiedData, finalPath);
241
- // sessionStorage.removeItem('copiedConfig');
242
- setPage();
243
- }
240
+ const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
241
+ if(copiedConfig.Handler && elementType === "component"){
242
+ store.setNotify({
243
+ FailMessage: "The pasted content is invalid; the event cannot be integrated into the component section.",
244
+ Fail: true,
245
+ });
246
+ }
247
+ else if(copiedConfig.elements && elementType === "event"){
248
+ store.setNotify({
249
+ FailMessage: "The pasted content is invalid; the component cannot be integrated into the event section.",
250
+ Fail: true,
251
+ });
252
+ }
253
+ else{
254
+ saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
255
+ setPage();
244
256
  }
245
- // const schema = cloneDeep(store.schema);
246
-
247
-
248
257
  },
249
258
 
259
+
250
260
  RemoveItemButton: function(paramStore = store){
251
261
  const schema = cloneDeep(paramStore.schema );
252
262
  const uiSchema = cloneDeep(paramStore.uiSchema);
253
263
  schema.properties.RemoveItemButton.disabled = true;
254
264
  uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
255
- // schema.properties.Paste_Icon.disabled = true;
256
265
  sessionStorage.removeItem('copiedConfig');
257
266
  store.setSchema(schema);
258
267
  store.setUiSchema(uiSchema);
259
268
  },
260
269
 
261
-
262
- CopyEvent: function(store){
263
- const rowId = dynamicData.path.split(".")[1];
264
- const path = store.searchParams?.get("path");
265
- const updatedPath = path ? `${path}.events[${rowId}]` : `events[${rowId}]`;
266
-
267
- const formData = getFormdataFromSessionStorage(updatedPath);
268
- sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
269
- },
270
-
271
- PasteEvent: function(store){
272
- const path = store.searchParams?.get("path");
273
- const formData = getFormdataFromSessionStorage(path)
274
- const insertComponentPath = formData.events.length;
275
-
276
- const finalPath = `${path}.events[${insertComponentPath}]`;
277
-
278
- const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
279
- if(!copiedData.events){
280
- store.setNotify({
281
- FailMessage: "Pasting not Valid",
282
- Fail: true,
283
- });
284
- }
285
- else{
286
- saveFormdataInSessionStorage(copiedData, finalPath);
287
- sessionStorage.removeItem('copiedConfig');
288
- this.setPage();
289
- }
290
- }
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
- // CopyComponent: function(){
300
- // const rowId = dynamicData.path.split(".")[1];
301
- // const path = store.searchParams?.get("path");
302
-
303
- // // const updatedPath = `${path}.elements[${rowId}]`;
304
- // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
305
-
306
- // const formData = getFormdataFromSessionStorage(updatedPath);
307
- // // sessionStorage.setItem('copiedComponent',formData);
308
- // sessionStorage.setItem('copiedComponent',JSON.stringify(formData));
309
-
310
- // },
311
-
312
- // PasteComponent: function(){
313
- // const path = store.searchParams?.get("path");
314
- // const rowId = dynamicData.path.split(".")[1];
315
- // // const updatedPath = `${path}.elements[${rowId}]`;
316
- // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
317
- // const formData = getFormdataFromSessionStorage(updatedPath)
318
- // const insertComponentPath = formData.elements.length;
319
-
320
- // const finalPath = `${updatedPath}.elements[${insertComponentPath}]`;
321
-
322
- // // const copiedData = sessionStorage.getItem('copiedComponent');
323
- // const copiedData = JSON.parse(sessionStorage.getItem("copiedComponent"));
324
- // saveFormdataInSessionStorage(copiedData, finalPath);
325
- // sessionStorage.removeItem('copiedComponent');
326
- // this.setPage();
327
-
328
- // },
329
-
330
-
331
-
332
- // CopyEvent: function(){
333
- // const rowId = dynamicData.path.split(".")[1];
334
- // const path = store.searchParams?.get("path");
335
-
336
- // // const updatedPath = `${path}.elements[${rowId}]`;
337
- // const updatedPath = path ? `${path}.events[${rowId}]` : `events[${rowId}]`;
338
-
339
- // const formData = getFormdataFromSessionStorage(updatedPath);
340
- // // sessionStorage.setItem('copiedComponent',formData);
341
- // sessionStorage.setItem('copiedComponent',JSON.stringify(formData));
342
- // },
343
-
344
- // PasteEvent: function(){
345
- // const path = store.searchParams?.get("path");
346
- // const rowId = dynamicData.path.split(".")[1];
347
- // // const updatedPath = `${path}.elements[${rowId}]`;
348
- // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
349
- // const formData = getFormdataFromSessionStorage(updatedPath)
350
- // const insertComponentPath = formData.elements.length;
351
-
352
- // const finalPath = `${updatedPath}.events[${insertComponentPath}]`;
353
-
354
- // // const copiedData = sessionStorage.getItem('copiedComponent');
355
- // const copiedData = JSON.parse(sessionStorage.getItem("copiedComponent"));
356
- // saveFormdataInSessionStorage(copiedData, finalPath);
357
- // sessionStorage.removeItem('copiedComponent');
358
- // this.setPage();
359
- // }
360
-
361
270
  }
362
271
  };
@@ -140,28 +140,13 @@ export default (
140
140
  store.updateDialog("popUpEvent");
141
141
  },
142
142
 
143
- CopyEvent: Component(store, dynamicData, submitHandler, service).CopyEvent,
144
- PasteEvent: Component(store, dynamicData, submitHandler, service).PasteEvent,
145
-
146
- // CopyEvent: function(){
147
- // const rowId = dynamicData.path.split(".")[1];
148
- // const path = store.searchParams?.get("path");
149
- // const updatedPath = path ? `${path}.events[${rowId}]` : `events[${rowId}]`;
150
-
151
- // const formData = getFormdataFromSessionStorage(updatedPath);
152
- // sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
153
- // },
154
-
155
- // PasteEvent: function(){
156
- // const path = store.searchParams?.get("path");
157
- // const formData = getFormdataFromSessionStorage(path)
158
- // const insertComponentPath = formData.events.length;
143
+ copyPasteElement: function(){
144
+ Component(store, dynamicData, submitHandler, service).copyPasteElement(store,this.setPage.bind(this));
145
+ },
146
+
147
+ RemoveItemButton: function(){
148
+ Component(store, dynamicData, submitHandler, service).RemoveItemButton(store)
149
+ },
159
150
 
160
- // const finalPath = `${path}.events[${insertComponentPath}]`;
161
- // const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
162
- // saveFormdataInSessionStorage(copiedData, finalPath);
163
- // sessionStorage.removeItem('copiedConfig');
164
- // this.setPage();
165
- // }
166
151
  }
167
152
  };
@@ -112,61 +112,13 @@ export default (funcParams: funcParamsProps) => {
112
112
  },
113
113
 
114
114
 
115
- CopyComponent: function(){
116
- Component(store, dynamicData, submitHandler, service).CopyComponent(store)
117
- },
118
-
119
-
120
- PasteComponent: function(){
121
- // Component(store, dynamicData, submitHandler, service).PasteComponent(store,this.setPage)
122
- const component = Component(store, dynamicData, submitHandler, service);
123
- component.PasteComponent(store, this.setPage.bind(this));
115
+ copyPasteElement: function(){
116
+ Component(store, dynamicData, submitHandler, service).copyPasteElement(store,this.setPage.bind(this));
124
117
  },
125
118
 
126
119
  RemoveItemButton: function(){
127
120
  Component(store, dynamicData, submitHandler, service).RemoveItemButton(store)
128
121
  },
129
-
130
- CopyEvent: function(){
131
- Component(store, dynamicData, submitHandler, service).CopyEvent(store)
132
- },
133
-
134
-
135
- PasteEvent: function(){
136
- Component(store, dynamicData, submitHandler, service).PasteEvent(store)
137
- },
138
-
139
122
 
140
-
141
-
142
-
143
- // CopyComponent: function(){
144
- // const rowId = dynamicData.path.split(".")[1];
145
- // const path = store.searchParams?.get("path");
146
- // const id = store.searchParams?.get("id");
147
- // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
148
-
149
- // const formData = getFormdataFromSessionStorage(updatedPath);
150
- // sessionStorage.setItem('copiedComponent',JSON.stringify(formData));
151
-
152
- // },
153
-
154
- // PasteComponent: function(){
155
- // const path = store.searchParams?.get("path");
156
- // const rowId = dynamicData.path.split(".")[1];
157
- // // const updatedPath = `${path}.elements[${rowId}]`;
158
- // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
159
- // const formData = getFormdataFromSessionStorage(updatedPath)
160
- // const insertComponentPath = formData.elements.length;
161
-
162
- // const finalPath = `${updatedPath}.elements[${insertComponentPath}]`;
163
-
164
- // // const copiedData = sessionStorage.getItem('copiedComponent');
165
- // const copiedData = JSON.parse(sessionStorage.getItem("copiedComponent"));
166
- // saveFormdataInSessionStorage(copiedData, finalPath);
167
- // sessionStorage.removeItem('copiedComponent');
168
-
169
- // this.setPage();
170
- // }
171
123
  }
172
124
  };