impaktapps-ui-builder 0.0.963-CopyComponent.6 → 0.0.963-CopyComponent.7

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.
@@ -102,34 +102,62 @@ export default (funcParams: funcParamsProps) => {
102
102
  store.updateDialog("popUpPageMasterEvent");
103
103
  },
104
104
 
105
+
105
106
  CopyComponent: function(){
106
107
  const rowId = dynamicData.path.split(".")[1];
107
- const path = store.searchParams?.get("path");
108
- const id = store.searchParams?.get("id");
109
- const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
108
+ const parentPathOfCopiedComponent = store.searchParams?.get("path");
109
+ const copiedComponentPath = parentPathOfCopiedComponent ? `${parentPathOfCopiedComponent}.elements[${rowId}]` : `elements[${rowId}]`;
110
110
 
111
- const formData = getFormdataFromSessionStorage(updatedPath);
112
- sessionStorage.setItem('copiedComponent',JSON.stringify(formData));
111
+ const formData = getFormdataFromSessionStorage(copiedComponentPath);
112
+ sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
113
113
 
114
114
  },
115
-
115
+
116
116
  PasteComponent: function(){
117
117
  const path = store.searchParams?.get("path");
118
- const rowId = dynamicData.path.split(".")[1];
119
- // const updatedPath = `${path}.elements[${rowId}]`;
120
- const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
121
- const formData = getFormdataFromSessionStorage(updatedPath)
118
+ const formData = getFormdataFromSessionStorage(path)
122
119
  const insertComponentPath = formData.elements.length;
123
120
 
124
- const finalPath = `${updatedPath}.elements[${insertComponentPath}]`;
125
-
126
- // const copiedData = sessionStorage.getItem('copiedComponent');
127
- const copiedData = JSON.parse(sessionStorage.getItem("copiedComponent"));
121
+ const finalPath = `${path}.elements[${insertComponentPath}]`;
122
+ const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
123
+ if(!copiedData.elements){
124
+ store.setNotify({
125
+ FailMessage: "Pasting not Valid",
126
+ Fail: true,
127
+ });
128
+ }
128
129
  saveFormdataInSessionStorage(copiedData, finalPath);
129
- sessionStorage.removeItem('copiedComponent');
130
-
130
+ sessionStorage.removeItem('copiedConfig');
131
131
  this.setPage();
132
-
133
132
  }
133
+
134
+ // CopyComponent: function(){
135
+ // const rowId = dynamicData.path.split(".")[1];
136
+ // const path = store.searchParams?.get("path");
137
+ // const id = store.searchParams?.get("id");
138
+ // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
139
+
140
+ // const formData = getFormdataFromSessionStorage(updatedPath);
141
+ // sessionStorage.setItem('copiedComponent',JSON.stringify(formData));
142
+
143
+ // },
144
+
145
+ // PasteComponent: function(){
146
+ // const path = store.searchParams?.get("path");
147
+ // const rowId = dynamicData.path.split(".")[1];
148
+ // // const updatedPath = `${path}.elements[${rowId}]`;
149
+ // const updatedPath = path ? `${path}.elements[${rowId}]` : `elements[${rowId}]`;
150
+ // const formData = getFormdataFromSessionStorage(updatedPath)
151
+ // const insertComponentPath = formData.elements.length;
152
+
153
+ // const finalPath = `${updatedPath}.elements[${insertComponentPath}]`;
154
+
155
+ // // const copiedData = sessionStorage.getItem('copiedComponent');
156
+ // const copiedData = JSON.parse(sessionStorage.getItem("copiedComponent"));
157
+ // saveFormdataInSessionStorage(copiedData, finalPath);
158
+ // sessionStorage.removeItem('copiedComponent');
159
+
160
+ // this.setPage();
161
+ // }
134
162
  }
135
163
  };