impaktapps-ui-builder 0.0.963-copyElement.1026 → 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.1026",
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,54 +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
193
 
222
- const completePath = formData.pageName.split('>').map(item => item.trim());
223
- const componentName = completePath[completePath.length - 2];
224
-
225
- const elementHeading = elementType === "Component" ? `Copied Element: ${formData.name}` : `Copied Event: ${componentName} -> ${formData.eventType} `;
226
- uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
194
+ this.ElementPathSetter(uiSchema);
227
195
  sessionStorage.setItem('copiedConfig',JSON.stringify(formData));
228
196
  store.setSchema(schema);
229
197
  store.setUiSchema(uiSchema);
230
198
  },
231
-
232
-
233
-
234
- PasteElement: function( setPage , elementType: string){
199
+ PasteElement: function( setPage: any , elementType: string){
235
200
  if (!sessionStorage.getItem("copiedConfig") ) {
236
201
  store.setNotify({
237
202
  FailMessage: "No item has been copied.",
@@ -245,15 +210,19 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
245
210
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
246
211
 
247
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
+ };
248
217
  if(copiedConfig.Handler && elementType === "Component"){
249
218
  store.setNotify({
250
- FailMessage: "The pasted content is invalid; the event cannot be integrated into the component section.",
219
+ FailMessage: notificationMessages.Event,
251
220
  Fail: true,
252
221
  });
253
222
  }
254
223
  else if(copiedConfig.name && elementType === "Event"){
255
224
  store.setNotify({
256
- FailMessage: "The pasted content is invalid; the component cannot be integrated into the event section.",
225
+ FailMessage: notificationMessages.Component,
257
226
  Fail: true,
258
227
  });
259
228
  }
@@ -261,10 +230,8 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
261
230
  saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
262
231
  setPage();
263
232
  }
264
- },
265
-
266
-
267
- RemoveItemButton: function(paramStore = store){
233
+ },
234
+ RemoveItemButton: function(paramStore: any = store){
268
235
  const schema = cloneDeep(paramStore.schema );
269
236
  const uiSchema = cloneDeep(paramStore.uiSchema);
270
237
  schema.properties.RemoveItemButton.disabled = true;
@@ -273,6 +240,18 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
273
240
  store.setSchema(schema);
274
241
  store.setUiSchema(uiSchema);
275
242
  },
276
-
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
+ }
277
256
  }
278
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.name ? `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
  },