impaktapps-ui-builder 0.0.963-copyElement.1015 → 0.0.963-copyElement.1017

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,85 +8430,73 @@ 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 actionType = dynamicData2.tableButtonPath.split("_")[0];
8435
+ const elementType = dynamicData2.tableButtonPath.split("_")[1];
8436
+ if (actionType === "Copy") {
8437
+ this.CopyElement(paramStore, elementType);
8440
8438
  } 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);
8439
+ this.PasteElement(setPage, elementType);
8452
8440
  }
8453
8441
  },
8454
- PasteComponent: function(paramStore = store2, setPage = this.setPage.bind(this)) {
8442
+ elementPathHandler: function(parentPath, rowId, elementType) {
8443
+ if (elementType === "component") {
8444
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
8445
+ }
8446
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
8447
+ },
8448
+ CopyElement: function(paramStore = store2, elementType) {
8449
+ var _a;
8450
+ const schema2 = lodash.exports.cloneDeep(paramStore.schema);
8451
+ const uiSchema = lodash.exports.cloneDeep(paramStore.uiSchema);
8452
+ schema2.properties.RemoveItemButton.disabled = false;
8453
+ const rowId = dynamicData2.path.split(".")[1];
8454
+ const parentPathOfCopiedComponent = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
8455
+ const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
8456
+ const formData = getFormdataFromSessionStorage(copiedElementPath);
8457
+ const elementHeading = elementType === "component" ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
8458
+ uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
8459
+ sessionStorage.setItem("copiedConfig", JSON.stringify(formData));
8460
+ store2.setSchema(schema2);
8461
+ store2.setUiSchema(uiSchema);
8462
+ },
8463
+ PasteElement: function(setPage, elementType) {
8455
8464
  var _a;
8456
8465
  if (!sessionStorage.getItem("copiedConfig")) {
8457
8466
  store2.setNotify({
8458
8467
  FailMessage: "No item has been copied.",
8459
8468
  Fail: true
8460
8469
  });
8470
+ return;
8471
+ }
8472
+ const pastedElementParentPath = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
8473
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
8474
+ const insertElementIndex = elementType === "component" ? formData.elements.length : formData.events.length;
8475
+ const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
8476
+ const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
8477
+ if (copiedConfig.Handler && elementType === "component") {
8478
+ store2.setNotify({
8479
+ FailMessage: "The pasted content is invalid; the event cannot be integrated into the component section.",
8480
+ Fail: true
8481
+ });
8482
+ } else if (copiedConfig.elements && elementType === "event") {
8483
+ store2.setNotify({
8484
+ FailMessage: "The pasted content is invalid; the component cannot be integrated into the event section.",
8485
+ Fail: true
8486
+ });
8461
8487
  } 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
- }
8488
+ saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
8489
+ setPage();
8477
8490
  }
8478
8491
  },
8479
8492
  RemoveItemButton: function(paramStore = store2) {
8480
8493
  const schema2 = lodash.exports.cloneDeep(paramStore.schema);
8481
8494
  const uiSchema = lodash.exports.cloneDeep(paramStore.uiSchema);
8482
8495
  schema2.properties.RemoveItemButton.disabled = true;
8496
+ uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
8483
8497
  sessionStorage.removeItem("copiedConfig");
8484
8498
  store2.setSchema(schema2);
8485
8499
  store2.setUiSchema(uiSchema);
8486
- },
8487
- CopyEvent: function(store22) {
8488
- var _a;
8489
- const rowId = dynamicData2.path.split(".")[1];
8490
- const path = (_a = store22.searchParams) == null ? void 0 : _a.get("path");
8491
- const updatedPath = path ? `${path}.events[${rowId}]` : `events[${rowId}]`;
8492
- const formData = getFormdataFromSessionStorage(updatedPath);
8493
- sessionStorage.setItem("copiedConfig", JSON.stringify(formData));
8494
- },
8495
- PasteEvent: function(store22) {
8496
- var _a;
8497
- const path = (_a = store22.searchParams) == null ? void 0 : _a.get("path");
8498
- const formData = getFormdataFromSessionStorage(path);
8499
- const insertComponentPath = formData.events.length;
8500
- const finalPath = `${path}.events[${insertComponentPath}]`;
8501
- const copiedData = JSON.parse(sessionStorage.getItem("copiedConfig"));
8502
- if (!copiedData.events) {
8503
- store22.setNotify({
8504
- FailMessage: "Pasting not Valid",
8505
- Fail: true
8506
- });
8507
- } else {
8508
- saveFormdataInSessionStorage(copiedData, finalPath);
8509
- sessionStorage.removeItem("copiedConfig");
8510
- this.setPage();
8511
- }
8512
8500
  }
8513
8501
  };
8514
8502
  };
@@ -8612,21 +8600,11 @@ var pageMaster = (funcParams) => {
8612
8600
  sessionStorage.setItem("rowId", rowId);
8613
8601
  store2.updateDialog("popUpPageMasterEvent");
8614
8602
  },
8615
- CopyComponent: function() {
8616
- Component(store2, dynamicData2, submitHandler, service2).CopyComponent(store2);
8617
- },
8618
- PasteComponent: function() {
8619
- const component = Component(store2, dynamicData2, submitHandler, service2);
8620
- component.PasteComponent(store2, this.setPage.bind(this));
8603
+ copyPasteElement: function() {
8604
+ Component(store2, dynamicData2, submitHandler, service2).copyPasteElement(store2, this.setPage.bind(this));
8621
8605
  },
8622
8606
  RemoveItemButton: function() {
8623
8607
  Component(store2, dynamicData2, submitHandler, service2).RemoveItemButton(store2);
8624
- },
8625
- CopyEvent: function() {
8626
- Component(store2, dynamicData2, submitHandler, service2).CopyEvent(store2);
8627
- },
8628
- PasteEvent: function() {
8629
- Component(store2, dynamicData2, submitHandler, service2).PasteEvent(store2);
8630
8608
  }
8631
8609
  };
8632
8610
  };
@@ -8818,13 +8796,13 @@ const EventUiSchema = (theme) => {
8818
8796
  {
8819
8797
  widget: {
8820
8798
  type: "Control",
8821
- scope: "#/properties/Paste_Icon",
8799
+ scope: "#/properties/Paste_Event",
8822
8800
  options: {
8823
8801
  widget: "IconButton"
8824
8802
  },
8825
8803
  config: {
8826
8804
  main: {
8827
- onClick: "PasteEvent",
8805
+ onClick: "copyPasteElement",
8828
8806
  size: "small",
8829
8807
  icon: "PasteIcon",
8830
8808
  iconLabel: "Paste",
@@ -8900,14 +8878,14 @@ const EventUiSchema = (theme) => {
8900
8878
  flex: 1,
8901
8879
  widget: {
8902
8880
  type: "Control",
8903
- scope: "#/properties/CopyEvent",
8881
+ scope: "#/properties/Copy_Event",
8904
8882
  options: {
8905
8883
  widget: "IconButton"
8906
8884
  },
8907
8885
  config: {
8908
8886
  main: {
8909
8887
  icon: "FileCopyIcon",
8910
- onClick: "CopyEvent",
8888
+ onClick: "copyPasteElement",
8911
8889
  styleDefault: true
8912
8890
  }
8913
8891
  }
@@ -9555,8 +9533,12 @@ var event = (store2, dynamicData2, submitHandler, service2, functionsName) => {
9555
9533
  sessionStorage.setItem("rowId", rowId);
9556
9534
  store2.updateDialog("popUpEvent");
9557
9535
  },
9558
- CopyEvent: Component(store2, dynamicData2, submitHandler, service2).CopyEvent,
9559
- PasteEvent: Component(store2, dynamicData2, submitHandler, service2).PasteEvent
9536
+ copyPasteElement: function() {
9537
+ Component(store2, dynamicData2, submitHandler, service2).copyPasteElement(store2, this.setPage.bind(this));
9538
+ },
9539
+ RemoveItemButton: function() {
9540
+ Component(store2, dynamicData2, submitHandler, service2).RemoveItemButton(store2);
9541
+ }
9560
9542
  };
9561
9543
  };
9562
9544
  const downloadFile$1 = (obj) => {