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.
@@ -172,13 +172,13 @@ const PageMasterUiSchema = (theme) => {
172
172
  {
173
173
  widget: {
174
174
  type: "Control",
175
- scope: "#/properties/Paste_Icon",
175
+ scope: "#/properties/Paste_Component",
176
176
  options: {
177
177
  widget: "IconButton"
178
178
  },
179
179
  config: {
180
180
  main: {
181
- onClick: "PasteComponent",
181
+ onClick: "copyPasteElement",
182
182
  size: "small",
183
183
  icon: "PasteIcon",
184
184
  iconLabel: "Paste",
@@ -255,14 +255,14 @@ const PageMasterUiSchema = (theme) => {
255
255
  flex: 1,
256
256
  widget: {
257
257
  type: "Control",
258
- scope: "#/properties/CopyComponent",
258
+ scope: "#/properties/Copy_Component",
259
259
  options: {
260
260
  widget: "IconButton"
261
261
  },
262
262
  config: {
263
263
  main: {
264
264
  icon: "FileCopyIcon",
265
- onClick: "CopyComponent",
265
+ onClick: "copyPasteElement",
266
266
  styleDefault: true
267
267
  }
268
268
  }
@@ -304,13 +304,13 @@ const PageMasterUiSchema = (theme) => {
304
304
  {
305
305
  widget: {
306
306
  type: "Control",
307
- scope: "#/properties/Paste_Icon",
307
+ scope: "#/properties/Paste_Event",
308
308
  options: {
309
309
  widget: "IconButton"
310
310
  },
311
311
  config: {
312
312
  main: {
313
- onClick: "PasteEvent",
313
+ onClick: "copyPasteElement",
314
314
  size: "small",
315
315
  icon: "PasteIcon",
316
316
  iconLabel: "Paste",
@@ -386,14 +386,14 @@ const PageMasterUiSchema = (theme) => {
386
386
  flex: 1,
387
387
  widget: {
388
388
  type: "Control",
389
- scope: "#/properties/CopyEvent",
389
+ scope: "#/properties/Copy_Event",
390
390
  options: {
391
391
  widget: "IconButton"
392
392
  },
393
393
  config: {
394
394
  main: {
395
395
  icon: "FileCopyIcon",
396
- onClick: "CopyEvent",
396
+ onClick: "copyPasteElement",
397
397
  styleDefault: true
398
398
  }
399
399
  }
@@ -7276,13 +7276,13 @@ const EventSection = (theme) => {
7276
7276
  {
7277
7277
  widget: {
7278
7278
  type: "Control",
7279
- scope: "#/properties/Paste_Icon",
7279
+ scope: "#/properties/Paste_Event",
7280
7280
  options: {
7281
7281
  widget: "IconButton"
7282
7282
  },
7283
7283
  config: {
7284
7284
  main: {
7285
- onClick: "PasteEvent",
7285
+ onClick: "copyPasteElement",
7286
7286
  size: "small",
7287
7287
  icon: "PasteIcon",
7288
7288
  iconLabel: "Paste",
@@ -7359,14 +7359,14 @@ const EventSection = (theme) => {
7359
7359
  flex: 1,
7360
7360
  widget: {
7361
7361
  type: "Control",
7362
- scope: "#/properties/CopyEvent",
7362
+ scope: "#/properties/Copy_Event",
7363
7363
  options: {
7364
7364
  widget: "IconButton"
7365
7365
  },
7366
7366
  config: {
7367
7367
  main: {
7368
7368
  icon: "FileCopyIcon",
7369
- onClick: "CopyEvent",
7369
+ onClick: "copyPasteElement",
7370
7370
  tooltipMessage: "Reject This Record",
7371
7371
  styleDefault: true
7372
7372
  }
@@ -7904,13 +7904,13 @@ const TableSection = (theme) => {
7904
7904
  {
7905
7905
  widget: {
7906
7906
  type: "Control",
7907
- scope: "#/properties/Paste_Icon",
7907
+ scope: "#/properties/Paste_Component",
7908
7908
  options: {
7909
7909
  widget: "IconButton"
7910
7910
  },
7911
7911
  config: {
7912
7912
  main: {
7913
- onClick: "PasteComponent",
7913
+ onClick: "copyPasteElement",
7914
7914
  size: "small",
7915
7915
  icon: "PasteIcon",
7916
7916
  iconLabel: "Paste",
@@ -7987,14 +7987,14 @@ const TableSection = (theme) => {
7987
7987
  flex: 1,
7988
7988
  widget: {
7989
7989
  type: "Control",
7990
- scope: "#/properties/CopyComponent",
7990
+ scope: "#/properties/Copy_Component",
7991
7991
  options: {
7992
7992
  widget: "IconButton"
7993
7993
  },
7994
7994
  config: {
7995
7995
  main: {
7996
7996
  icon: "FileCopyIcon",
7997
- onClick: "CopyComponent",
7997
+ onClick: "copyPasteElement",
7998
7998
  styleDefault: true,
7999
7999
  disabled: false
8000
8000
  }
@@ -8430,50 +8430,64 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
8430
8430
  sessionStorage.setItem("rowId", rowId);
8431
8431
  store2.updateDialog("popUpEventSection");
8432
8432
  },
8433
- CopyComponent: function(paramStore = store2) {
8434
- var _a;
8435
- if (sessionStorage.getItem("copiedConfig")) {
8436
- store2.setNotify({
8437
- FailMessage: "Element already copied. Cancel to copy again.",
8438
- Fail: true
8439
- });
8433
+ copyPasteElement: function(paramStore, setPage = this.setPage.bind(this)) {
8434
+ const path = dynamicData2.path.split(".")[2];
8435
+ const actionType = path.split("_")[0];
8436
+ const elementType = path.split("_")[1];
8437
+ if (actionType === "Copy") {
8438
+ this.CopyElement(paramStore, elementType);
8440
8439
  } else {
8441
- const schema2 = lodash.exports.cloneDeep(paramStore.schema);
8442
- const uiSchema = lodash.exports.cloneDeep(paramStore.uiSchema);
8443
- schema2.properties.RemoveItemButton.disabled = false;
8444
- const rowId = dynamicData2.path.split(".")[1];
8445
- const parentPathOfCopiedComponent = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
8446
- const copiedComponentPath = parentPathOfCopiedComponent ? `${parentPathOfCopiedComponent}.elements[${rowId}]` : `elements[${rowId}]`;
8447
- const formData = getFormdataFromSessionStorage(copiedComponentPath);
8448
- uiSchema.elements[2].elements[1].config.main.heading = `Copied Element: ${formData.name}`;
8449
- sessionStorage.setItem("copiedConfig", JSON.stringify(formData));
8450
- store2.setSchema(schema2);
8451
- store2.setUiSchema(uiSchema);
8440
+ this.PasteElement(setPage, elementType);
8452
8441
  }
8453
8442
  },
8454
- PasteComponent: function(paramStore = store2, setPage = this.setPage.bind(this)) {
8443
+ elementPathHandler: function(parentPath, rowId, elementType) {
8444
+ if (elementType === "component") {
8445
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
8446
+ }
8447
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
8448
+ },
8449
+ CopyElement: function(paramStore = store2, elementType) {
8450
+ var _a;
8451
+ const schema2 = lodash.exports.cloneDeep(paramStore.schema);
8452
+ const uiSchema = lodash.exports.cloneDeep(paramStore.uiSchema);
8453
+ schema2.properties.RemoveItemButton.disabled = false;
8454
+ const rowId = dynamicData2.path.split(".")[1];
8455
+ const parentPathOfCopiedComponent = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
8456
+ const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
8457
+ const formData = getFormdataFromSessionStorage(copiedElementPath);
8458
+ const elementHeading = elementType === "component" ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
8459
+ uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
8460
+ sessionStorage.setItem("copiedConfig", JSON.stringify(formData));
8461
+ store2.setSchema(schema2);
8462
+ store2.setUiSchema(uiSchema);
8463
+ },
8464
+ PasteElement: function(setPage, elementType) {
8455
8465
  var _a;
8456
8466
  if (!sessionStorage.getItem("copiedConfig")) {
8457
8467
  store2.setNotify({
8458
8468
  FailMessage: "No item has been copied.",
8459
8469
  Fail: true
8460
8470
  });
8471
+ return;
8472
+ }
8473
+ const pastedElementParentPath = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
8474
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
8475
+ const insertElementIndex = elementType === "component" ? formData.elements.length : formData.events.length;
8476
+ const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
8477
+ const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
8478
+ if (copiedConfig.Handler && elementType === "component") {
8479
+ store2.setNotify({
8480
+ FailMessage: "The pasted content is invalid; the event cannot be integrated into the component section.",
8481
+ Fail: true
8482
+ });
8483
+ } else if (copiedConfig.elements && elementType === "event") {
8484
+ store2.setNotify({
8485
+ FailMessage: "The pasted content is invalid; the component cannot be integrated into the event section.",
8486
+ Fail: true
8487
+ });
8461
8488
  } else {
8462
- const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
8463
- dynamicData2.path.split(".")[1];
8464
- const formData = getFormdataFromSessionStorage(path);
8465
- const insertComponentPath = formData.elements.length;
8466
- const finalPath = path ? `${path}.elements[${insertComponentPath}]` : `elements[${insertComponentPath}]`;
8467
- const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
8468
- if (copiedData.Handler) {
8469
- store2.setNotify({
8470
- FailMessage: "Pasting element not Valid",
8471
- Fail: true
8472
- });
8473
- } else {
8474
- saveFormdataInSessionStorage(copiedData, finalPath);
8475
- setPage();
8476
- }
8489
+ saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
8490
+ setPage();
8477
8491
  }
8478
8492
  },
8479
8493
  RemoveItemButton: function(paramStore = store2) {
@@ -8484,32 +8498,6 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
8484
8498
  sessionStorage.removeItem("copiedConfig");
8485
8499
  store2.setSchema(schema2);
8486
8500
  store2.setUiSchema(uiSchema);
8487
- },
8488
- CopyEvent: function(store22) {
8489
- var _a;
8490
- const rowId = dynamicData2.path.split(".")[1];
8491
- const path = (_a = store22.searchParams) == null ? void 0 : _a.get("path");
8492
- const updatedPath = path ? `${path}.events[${rowId}]` : `events[${rowId}]`;
8493
- const formData = getFormdataFromSessionStorage(updatedPath);
8494
- sessionStorage.setItem("copiedConfig", JSON.stringify(formData));
8495
- },
8496
- PasteEvent: function(store22) {
8497
- var _a;
8498
- const path = (_a = store22.searchParams) == null ? void 0 : _a.get("path");
8499
- const formData = getFormdataFromSessionStorage(path);
8500
- const insertComponentPath = formData.events.length;
8501
- const finalPath = `${path}.events[${insertComponentPath}]`;
8502
- const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
8503
- if (!copiedData.events) {
8504
- store22.setNotify({
8505
- FailMessage: "Pasting not Valid",
8506
- Fail: true
8507
- });
8508
- } else {
8509
- saveFormdataInSessionStorage(copiedData, finalPath);
8510
- sessionStorage.removeItem("copiedConfig");
8511
- this.setPage();
8512
- }
8513
8501
  }
8514
8502
  };
8515
8503
  };
@@ -8613,21 +8601,11 @@ var pageMaster = (funcParams) => {
8613
8601
  sessionStorage.setItem("rowId", rowId);
8614
8602
  store2.updateDialog("popUpPageMasterEvent");
8615
8603
  },
8616
- CopyComponent: function() {
8617
- Component(store2, dynamicData2, submitHandler, service2).CopyComponent(store2);
8618
- },
8619
- PasteComponent: function() {
8620
- const component = Component(store2, dynamicData2, submitHandler, service2);
8621
- component.PasteComponent(store2, this.setPage.bind(this));
8604
+ copyPasteElement: function() {
8605
+ Component(store2, dynamicData2, submitHandler, service2).copyPasteElement(store2, this.setPage.bind(this));
8622
8606
  },
8623
8607
  RemoveItemButton: function() {
8624
8608
  Component(store2, dynamicData2, submitHandler, service2).RemoveItemButton(store2);
8625
- },
8626
- CopyEvent: function() {
8627
- Component(store2, dynamicData2, submitHandler, service2).CopyEvent(store2);
8628
- },
8629
- PasteEvent: function() {
8630
- Component(store2, dynamicData2, submitHandler, service2).PasteEvent(store2);
8631
8609
  }
8632
8610
  };
8633
8611
  };
@@ -8819,13 +8797,13 @@ const EventUiSchema = (theme) => {
8819
8797
  {
8820
8798
  widget: {
8821
8799
  type: "Control",
8822
- scope: "#/properties/Paste_Icon",
8800
+ scope: "#/properties/Paste_Event",
8823
8801
  options: {
8824
8802
  widget: "IconButton"
8825
8803
  },
8826
8804
  config: {
8827
8805
  main: {
8828
- onClick: "PasteEvent",
8806
+ onClick: "copyPasteElement",
8829
8807
  size: "small",
8830
8808
  icon: "PasteIcon",
8831
8809
  iconLabel: "Paste",
@@ -8901,14 +8879,14 @@ const EventUiSchema = (theme) => {
8901
8879
  flex: 1,
8902
8880
  widget: {
8903
8881
  type: "Control",
8904
- scope: "#/properties/CopyEvent",
8882
+ scope: "#/properties/Copy_Event",
8905
8883
  options: {
8906
8884
  widget: "IconButton"
8907
8885
  },
8908
8886
  config: {
8909
8887
  main: {
8910
8888
  icon: "FileCopyIcon",
8911
- onClick: "CopyEvent",
8889
+ onClick: "copyPasteElement",
8912
8890
  styleDefault: true
8913
8891
  }
8914
8892
  }
@@ -9556,8 +9534,12 @@ var event = (store2, dynamicData2, submitHandler, service2, functionsName) => {
9556
9534
  sessionStorage.setItem("rowId", rowId);
9557
9535
  store2.updateDialog("popUpEvent");
9558
9536
  },
9559
- CopyEvent: Component(store2, dynamicData2, submitHandler, service2).CopyEvent,
9560
- PasteEvent: Component(store2, dynamicData2, submitHandler, service2).PasteEvent
9537
+ copyPasteElement: function() {
9538
+ Component(store2, dynamicData2, submitHandler, service2).copyPasteElement(store2, this.setPage.bind(this));
9539
+ },
9540
+ RemoveItemButton: function() {
9541
+ Component(store2, dynamicData2, submitHandler, service2).RemoveItemButton(store2);
9542
+ }
9561
9543
  };
9562
9544
  };
9563
9545
  const downloadFile$1 = (obj) => {