impaktapps-ui-builder 0.0.963-copyElement.1025 → 0.0.963-copyElement.1027

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,7 +1,7 @@
1
- export declare const refreshPage: (type: string, store: any) => void;
1
+ export declare function refreshPage(type: string, store: any): void;
2
2
  declare const _default: (store: any, dynamicData: any, submitHandler: any, service: any) => {
3
3
  setPage: () => Promise<void>;
4
- refreshPage: (type: string, store: any) => void;
4
+ refreshPage: typeof refreshPage;
5
5
  getFormdata: () => any;
6
6
  getSchema: () => any;
7
7
  okHandler: () => void;
@@ -17,9 +17,10 @@ declare const _default: (store: any, dynamicData: any, submitHandler: any, servi
17
17
  deletePopUpComponent: () => void;
18
18
  deletePopUpEvent: () => void;
19
19
  copyPasteElement: (paramStore: any, setPage?: any) => void;
20
- elementPathHandler: (parentPath: string, rowId: any, elementType: string) => string;
21
20
  CopyElement: (paramStore: any, elementType: string) => void;
22
21
  PasteElement: (setPage: any, elementType: string) => void;
23
22
  RemoveItemButton: (paramStore?: any) => void;
23
+ elementPathHandler: (parentPath: string, rowId: any, elementType: string) => string;
24
+ ElementPathSetter: (uiSchema: any) => void;
24
25
  };
25
26
  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.1025",
3
+ "version": "0.0.963-copyElement.1027",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -35,9 +35,6 @@ export const EventSection = (theme)=>{
35
35
  },
36
36
  }
37
37
  },
38
-
39
-
40
- ////////////////////
41
38
  {
42
39
  widget: {
43
40
  type: "Control",
@@ -35,8 +35,6 @@ export const TableSection = (theme) => {
35
35
  },
36
36
  }
37
37
  },
38
-
39
- /////////////////////////////////////////
40
38
  {
41
39
  widget: {
42
40
  type: "Control",
@@ -60,8 +58,6 @@ export const TableSection = (theme) => {
60
58
  },
61
59
  }
62
60
  },
63
-
64
- /////////////////////////////////////////
65
61
  ]
66
62
  },
67
63
  disableAction: true,
@@ -123,8 +119,6 @@ export const TableSection = (theme) => {
123
119
  },
124
120
  },
125
121
  },
126
-
127
- ////////////////////////////////////////
128
122
  {
129
123
  header: "Copy",
130
124
  field: "Copy_Component",
@@ -146,8 +140,6 @@ export const TableSection = (theme) => {
146
140
  },
147
141
  },
148
142
  },
149
-
150
- ///////////////////////////////////////
151
143
  ]
152
144
  }]
153
145
  }
@@ -342,11 +342,9 @@ export const ComponentSchema: any = {
342
342
  type: "string",
343
343
  },
344
344
  label: { type: 'string' },
345
-
346
345
  RemoveItemButton:{
347
346
  disabled: true,
348
347
  },
349
-
350
348
  },
351
349
 
352
350
  required: ["name",]
@@ -178,7 +178,6 @@ export const componentBasicUiSchema: any = (theme)=>{
178
178
  },
179
179
  ],
180
180
  },
181
-
182
181
  {
183
182
  type: "HorizontalLayout",
184
183
  config: {
@@ -463,9 +462,6 @@ export const componentBasicUiSchema: any = (theme)=>{
463
462
  },
464
463
  ]
465
464
  },
466
-
467
- //////////////////////////////////////
468
-
469
465
  {
470
466
  type: "Control",
471
467
  scope: "#/properties/notify",
@@ -43,10 +43,7 @@ export const PageMasterSchema = {
43
43
  },
44
44
  RemoveItemButton:{
45
45
  disabled: true
46
- },
47
- // Paste_Icon:{
48
- // disabled: true,
49
- // }
46
+ }
50
47
  },
51
48
  required:["template","name", "label"]
52
49
  }
@@ -271,8 +271,6 @@ export const PageMasterUiSchema: any = (theme) => {
271
271
  }
272
272
  },
273
273
 
274
- /////////////////
275
-
276
274
  {
277
275
  widget: {
278
276
  type: "Control",
@@ -441,7 +439,6 @@ export const PageMasterUiSchema: any = (theme) => {
441
439
  },
442
440
  ]
443
441
  },
444
-
445
442
  {
446
443
  type: "Control",
447
444
  scope: "#/properties/btn",
@@ -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,13 +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
-
62
59
  }
63
60
  if (sessionStorage.getItem("copiedConfig") ) {
64
- const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
65
- const elementHeading = formData.name ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
66
- UiSchema.elements[2].elements[1].config.main.heading = elementHeading;
67
- // UiSchema.elements[2].elements[1].config.main.heading = `Copied Element: ${formData.name}`;
61
+ this.ElementPathSetter(UiSchema);
68
62
  }
69
63
  store.setUiSchema(UiSchema);
70
64
  }
@@ -184,50 +178,25 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
184
178
  },
185
179
 
186
180
  copyPasteElement: function(paramStore: any, setPage: any = this.setPage.bind(this) ){
187
-
188
- // Paste_Event // Paste_Component //Copy_Event //Copy_Component
189
- // elements.0.Copy_Component
190
- // Paste_Component.Paste_Component
191
- const path = dynamicData.path.split('.').pop();
192
- const actionType = path?.split('_')[0];
193
- const elementType = path?.split('_')[1];
194
-
195
- if(actionType === "Copy"){
196
- this.CopyElement(paramStore, elementType);
197
- }else{
198
- this.PasteElement(setPage, elementType);
199
- }
200
- },
201
-
202
-
203
- elementPathHandler: function(parentPath: string, rowId, elementType: string){
204
- if(elementType === "Component"){
205
- return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
206
- }
207
- return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
181
+ const [actionType, elementType] = dynamicData.path.split('.').pop()?.split('_');
182
+ actionType === "Copy" ? this.CopyElement(paramStore, elementType) : this.PasteElement(setPage, elementType);
208
183
  },
209
-
210
184
  CopyElement: function(paramStore: any = store, elementType: string){
211
-
212
185
  const schema = cloneDeep(paramStore.schema );
213
186
  const uiSchema = cloneDeep(paramStore.uiSchema );
214
187
  schema.properties.RemoveItemButton.disabled = false;
188
+
215
189
  const rowId = dynamicData.path.split(".")[1];
216
190
  const parentPathOfCopiedComponent = store.searchParams?.get("path");
217
-
218
191
  const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
219
-
220
192
  const formData = getFormdataFromSessionStorage(copiedElementPath);
221
- const elementHeading = elementType === "Component" ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
222
- uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
193
+
194
+ this.ElementPathSetter(uiSchema);
223
195
  sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
224
196
  store.setSchema(schema);
225
197
  store.setUiSchema(uiSchema);
226
198
  },
227
-
228
-
229
-
230
- PasteElement: function( setPage , elementType: string){
199
+ PasteElement: function( setPage: any , elementType: string){
231
200
  if (!sessionStorage.getItem("copiedConfig") ) {
232
201
  store.setNotify({
233
202
  FailMessage: "No item has been copied.",
@@ -241,15 +210,19 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
241
210
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
242
211
 
243
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
+ };
244
217
  if(copiedConfig.Handler && elementType === "Component"){
245
218
  store.setNotify({
246
- FailMessage: "The pasted content is invalid; the event cannot be integrated into the component section.",
219
+ FailMessage: notificationMessages.Event,
247
220
  Fail: true,
248
221
  });
249
222
  }
250
223
  else if(copiedConfig.name && elementType === "Event"){
251
224
  store.setNotify({
252
- FailMessage: "The pasted content is invalid; the component cannot be integrated into the event section.",
225
+ FailMessage: notificationMessages.Component,
253
226
  Fail: true,
254
227
  });
255
228
  }
@@ -257,10 +230,8 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
257
230
  saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
258
231
  setPage();
259
232
  }
260
- },
261
-
262
-
263
- RemoveItemButton: function(paramStore = store){
233
+ },
234
+ RemoveItemButton: function(paramStore: any = store){
264
235
  const schema = cloneDeep(paramStore.schema );
265
236
  const uiSchema = cloneDeep(paramStore.uiSchema);
266
237
  schema.properties.RemoveItemButton.disabled = true;
@@ -269,6 +240,18 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
269
240
  store.setSchema(schema);
270
241
  store.setUiSchema(uiSchema);
271
242
  },
272
-
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){
250
+ const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
251
+ const completePath = formData.pageName.split('>').map(item => item.trim());
252
+ const componentName = completePath[completePath.length - 2];
253
+ const elementHeading = formData.name ? `Copied Element: ${formData.name}` : `Copied Event: ${componentName} Event Type: ${formData.eventType} `;
254
+ uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
255
+ }
273
256
  }
274
257
  };
@@ -93,10 +93,7 @@ export default (
93
93
  getUiSchema: function () {
94
94
  const UiSchema = _.cloneDeep(EventUiSchema(store.theme.myTheme))
95
95
  if (sessionStorage.getItem("copiedConfig") ) {
96
- const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
97
- const elementHeading = formData.elements ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
98
- UiSchema.elements[2].elements[1].config.main.heading = elementHeading;
99
- // UiSchema.elements[2].elements[1].config.main.heading = `Copied Element: ${formData.name}`;
96
+ Component(store, dynamicData, submitHandler, service).ElementPathSetter(UiSchema);
100
97
  }
101
98
  store.setUiSchema(UiSchema);
102
99
  return EventUiSchema;
@@ -147,11 +144,9 @@ export default (
147
144
  sessionStorage.setItem('rowId',rowId);
148
145
  store.updateDialog("popUpEvent");
149
146
  },
150
-
151
147
  copyPasteElement: function(){
152
148
  Component(store, dynamicData, submitHandler, service).copyPasteElement(store,this.setPage.bind(this));
153
149
  },
154
-
155
150
  RemoveItemButton: function(){
156
151
  Component(store, dynamicData, submitHandler, service).RemoveItemButton(store)
157
152
  },
@@ -36,10 +36,7 @@ export default (funcParams: funcParamsProps) => {
36
36
  getUiSchema: function () {
37
37
  const UiSchema = _.cloneDeep(PageMasterUiSchema(store.theme.myTheme));
38
38
  if (sessionStorage.getItem("copiedConfig") ) {
39
- const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
40
- const elementHeading = formData.name ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
41
- UiSchema.elements[2].elements[1].config.main.heading = elementHeading;
42
- // UiSchema.elements[2].elements[1].config.main.heading = `Copied Element: ${formData.name}`;
39
+ Component(store, dynamicData, submitHandler, service).ElementPathSetter(UiSchema)
43
40
  }
44
41
  return UiSchema;
45
42
  },