impaktapps-ui-builder 0.0.963-CopyComponent.1 → 0.0.963-CopyComponent.11

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.
@@ -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";
@@ -172,5 +172,154 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
172
172
  sessionStorage.setItem('rowId',rowId);
173
173
  store.updateDialog("popUpEventSection");
174
174
  },
175
+
176
+
177
+ CopyComponent: function(){
178
+ const schema = cloneDeep(store.schema);
179
+ const uiSchema = cloneDeep(store.uiSchema);
180
+ // schema.properties.CopyComponent.disabled = true;
181
+
182
+
183
+
184
+ const rowId = dynamicData.path.split(".")[1];
185
+ const parentPathOfCopiedComponent = store.searchParams?.get("path");
186
+ const copiedComponentPath = parentPathOfCopiedComponent ? `${parentPathOfCopiedComponent}.elements[${rowId}]` : `elements[${rowId}]`;
187
+
188
+
189
+ const formData = getFormdataFromSessionStorage(copiedComponentPath);
190
+
191
+ uiSchema.elements[4].config.main.heading = formData.name;
192
+
193
+
194
+ sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
195
+
196
+ // store.setSchema(schema);
197
+ store.setUiSchema(uiSchema);
198
+ },
199
+
200
+ PasteComponent: function(){
201
+ // const schema = cloneDeep(store.schema);
202
+
203
+ const path = store.searchParams?.get("path");
204
+ const formData = getFormdataFromSessionStorage(path)
205
+ const insertComponentPath = formData.elements.length;
206
+ const finalPath = `${path}.elements[${insertComponentPath}]`;
207
+ const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
208
+ if(!copiedData.elements){
209
+ store.setNotify({
210
+ FailMessage: "Pasting not Valid",
211
+ Fail: true,
212
+ });
213
+ }
214
+ else{
215
+ saveFormdataInSessionStorage(copiedData, finalPath);
216
+ sessionStorage.removeItem('copiedConfig');
217
+
218
+ // schema.properties.CopyComponent.disabled = false;
219
+
220
+ this.setPage();
221
+ }
222
+ },
223
+
224
+
225
+ CopyEvent: function(){
226
+ const rowId = dynamicData.path.split(".")[1];
227
+ const path = store.searchParams?.get("path");
228
+ const updatedPath = path ? `${path}.events[${rowId}]` : `events[${rowId}]`;
229
+
230
+ const formData = getFormdataFromSessionStorage(updatedPath);
231
+ sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
232
+ },
233
+
234
+ PasteEvent: function(){
235
+ const path = store.searchParams?.get("path");
236
+ const formData = getFormdataFromSessionStorage(path)
237
+ const insertComponentPath = formData.events.length;
238
+
239
+ const finalPath = `${path}.events[${insertComponentPath}]`;
240
+
241
+ const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
242
+ if(!copiedData.events){
243
+ store.setNotify({
244
+ FailMessage: "Pasting not Valid",
245
+ Fail: true,
246
+ });
247
+ }
248
+ else{
249
+ saveFormdataInSessionStorage(copiedData, finalPath);
250
+ sessionStorage.removeItem('copiedConfig');
251
+ this.setPage();
252
+ }
253
+ }
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+ // CopyComponent: function(){
263
+ // const rowId = dynamicData.path.split(".")[1];
264
+ // const path = store.searchParams?.get("path");
265
+
266
+ // // const updatedPath = `${path}.elements[${rowId}]`;
267
+ // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
268
+
269
+ // const formData = getFormdataFromSessionStorage(updatedPath);
270
+ // // sessionStorage.setItem('copiedComponent',formData);
271
+ // sessionStorage.setItem('copiedComponent',JSON.stringify(formData));
272
+
273
+ // },
274
+
275
+ // PasteComponent: function(){
276
+ // const path = store.searchParams?.get("path");
277
+ // const rowId = dynamicData.path.split(".")[1];
278
+ // // const updatedPath = `${path}.elements[${rowId}]`;
279
+ // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
280
+ // const formData = getFormdataFromSessionStorage(updatedPath)
281
+ // const insertComponentPath = formData.elements.length;
282
+
283
+ // const finalPath = `${updatedPath}.elements[${insertComponentPath}]`;
284
+
285
+ // // const copiedData = sessionStorage.getItem('copiedComponent');
286
+ // const copiedData = JSON.parse(sessionStorage.getItem("copiedComponent"));
287
+ // saveFormdataInSessionStorage(copiedData, finalPath);
288
+ // sessionStorage.removeItem('copiedComponent');
289
+ // this.setPage();
290
+
291
+ // },
292
+
293
+
294
+
295
+ // CopyEvent: function(){
296
+ // const rowId = dynamicData.path.split(".")[1];
297
+ // const path = store.searchParams?.get("path");
298
+
299
+ // // const updatedPath = `${path}.elements[${rowId}]`;
300
+ // const updatedPath = path ? `${path}.events[${rowId}]` : `events[${rowId}]`;
301
+
302
+ // const formData = getFormdataFromSessionStorage(updatedPath);
303
+ // // sessionStorage.setItem('copiedComponent',formData);
304
+ // sessionStorage.setItem('copiedComponent',JSON.stringify(formData));
305
+ // },
306
+
307
+ // PasteEvent: function(){
308
+ // const path = store.searchParams?.get("path");
309
+ // const rowId = dynamicData.path.split(".")[1];
310
+ // // const updatedPath = `${path}.elements[${rowId}]`;
311
+ // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
312
+ // const formData = getFormdataFromSessionStorage(updatedPath)
313
+ // const insertComponentPath = formData.elements.length;
314
+
315
+ // const finalPath = `${updatedPath}.events[${insertComponentPath}]`;
316
+
317
+ // // const copiedData = sessionStorage.getItem('copiedComponent');
318
+ // const copiedData = JSON.parse(sessionStorage.getItem("copiedComponent"));
319
+ // saveFormdataInSessionStorage(copiedData, finalPath);
320
+ // sessionStorage.removeItem('copiedComponent');
321
+ // this.setPage();
322
+ // }
323
+
175
324
  }
176
325
  };
@@ -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";
@@ -138,6 +138,30 @@ export default (
138
138
  const rowId = dynamicData.path.split(".")[1];
139
139
  sessionStorage.setItem('rowId',rowId);
140
140
  store.updateDialog("popUpEvent");
141
- }
141
+ },
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;
159
+
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
+ // }
142
166
  }
143
167
  };
@@ -102,29 +102,42 @@ export default (funcParams: funcParamsProps) => {
102
102
  store.updateDialog("popUpPageMasterEvent");
103
103
  },
104
104
 
105
- CopyComponent: function(){
106
- const rowId = dynamicData.path.split(".")[1];
107
- const path = store.searchParams?.get("path");
108
- const id = store.searchParams?.get("id");
109
105
 
110
- const formData = getFormdataFromSessionStorage(path);
111
- sessionStorage.setItem('copiedComponent',formData);
106
+ CopyComponent: Component(store, dynamicData, submitHandler, service).CopyComponent,
112
107
 
113
- },
108
+ PasteComponent: Component(store, dynamicData, submitHandler, service).PasteComponent,
109
+
110
+ CopyEvent: Component(store, dynamicData, submitHandler, service).CopyEvent,
111
+ PasteEvent: Component(store, dynamicData, submitHandler, service).PasteEvent,
112
+
113
+
114
+ // CopyComponent: function(){
115
+ // const rowId = dynamicData.path.split(".")[1];
116
+ // const path = store.searchParams?.get("path");
117
+ // const id = store.searchParams?.get("id");
118
+ // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
119
+
120
+ // const formData = getFormdataFromSessionStorage(updatedPath);
121
+ // sessionStorage.setItem('copiedComponent',JSON.stringify(formData));
122
+
123
+ // },
114
124
 
115
- PasteComponent: function(){
116
- const path = store.searchParams?.get("path");
117
- const rowId = dynamicData.path.split(".")[1];
118
- const updatedPath = `${path}.elements[${rowId}]`;
119
- const formData = getFormdataFromSessionStorage(updatedPath)
120
- const insertComponentPath = formData.elements.length;
125
+ // PasteComponent: function(){
126
+ // const path = store.searchParams?.get("path");
127
+ // const rowId = dynamicData.path.split(".")[1];
128
+ // // const updatedPath = `${path}.elements[${rowId}]`;
129
+ // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
130
+ // const formData = getFormdataFromSessionStorage(updatedPath)
131
+ // const insertComponentPath = formData.elements.length;
121
132
 
122
- const finalPath = `${updatedPath}.elements[${insertComponentPath}]`;
133
+ // const finalPath = `${updatedPath}.elements[${insertComponentPath}]`;
123
134
 
124
- const copiedData = sessionStorage.getItem('copiedComponent');
125
- saveFormdataInSessionStorage(copiedData, finalPath);
126
- sessionStorage.removeItem('copiedComponent')
135
+ // // const copiedData = sessionStorage.getItem('copiedComponent');
136
+ // const copiedData = JSON.parse(sessionStorage.getItem("copiedComponent"));
137
+ // saveFormdataInSessionStorage(copiedData, finalPath);
138
+ // sessionStorage.removeItem('copiedComponent');
127
139
 
128
- }
140
+ // this.setPage();
141
+ // }
129
142
  }
130
143
  };