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.
@@ -8291,7 +8291,7 @@ const sectionLabels = {
8291
8291
  TreeMap: ["Core", "Components", "Properties", "Event", "Style"],
8292
8292
  ColumnGroup: ["Core", "Components"]
8293
8293
  };
8294
- const refreshPage = (type, store2) => {
8294
+ function refreshPage(type, store2) {
8295
8295
  var _a;
8296
8296
  const UiSchema = _.cloneDeep(componentBasicUiSchema(store2.theme.myTheme));
8297
8297
  if (type) {
@@ -8309,12 +8309,10 @@ const refreshPage = (type, store2) => {
8309
8309
  UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection(store2.theme.myTheme), ValidationSection];
8310
8310
  }
8311
8311
  if (sessionStorage.getItem("copiedConfig")) {
8312
- const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
8313
- const elementHeading = formData.name ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
8314
- UiSchema.elements[2].elements[1].config.main.heading = elementHeading;
8312
+ this.ElementPathSetter(UiSchema);
8315
8313
  }
8316
8314
  store2.setUiSchema(UiSchema);
8317
- };
8315
+ }
8318
8316
  var Component = (store2, dynamicData2, submitHandler, service2) => {
8319
8317
  return {
8320
8318
  setPage: async function() {
@@ -8432,20 +8430,9 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
8432
8430
  store2.updateDialog("popUpEventSection");
8433
8431
  },
8434
8432
  copyPasteElement: function(paramStore, setPage = this.setPage.bind(this)) {
8435
- const path = dynamicData2.path.split(".").pop();
8436
- const actionType = path == null ? void 0 : path.split("_")[0];
8437
- const elementType = path == null ? void 0 : path.split("_")[1];
8438
- if (actionType === "Copy") {
8439
- this.CopyElement(paramStore, elementType);
8440
- } else {
8441
- this.PasteElement(setPage, elementType);
8442
- }
8443
- },
8444
- elementPathHandler: function(parentPath, rowId, elementType) {
8445
- if (elementType === "Component") {
8446
- return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
8447
- }
8448
- return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
8433
+ var _a;
8434
+ const [actionType, elementType] = (_a = dynamicData2.path.split(".").pop()) == null ? void 0 : _a.split("_");
8435
+ actionType === "Copy" ? this.CopyElement(paramStore, elementType) : this.PasteElement(setPage, elementType);
8449
8436
  },
8450
8437
  CopyElement: function(paramStore = store2, elementType) {
8451
8438
  var _a;
@@ -8456,10 +8443,7 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
8456
8443
  const parentPathOfCopiedComponent = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
8457
8444
  const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
8458
8445
  const formData = getFormdataFromSessionStorage(copiedElementPath);
8459
- const completePath = formData.pageName.split(">").map((item) => item.trim());
8460
- const componentName = completePath[completePath.length - 2];
8461
- const elementHeading = elementType === "Component" ? `Copied Element: ${formData.name}` : `Copied Event: ${componentName} -> ${formData.eventType} `;
8462
- uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
8446
+ this.ElementPathSetter(uiSchema);
8463
8447
  sessionStorage.setItem("copiedConfig", JSON.stringify(formData));
8464
8448
  store2.setSchema(schema2);
8465
8449
  store2.setUiSchema(uiSchema);
@@ -8478,14 +8462,18 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
8478
8462
  const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
8479
8463
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
8480
8464
  const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
8465
+ const notificationMessages = {
8466
+ Event: "The pasted content is invalid; the event cannot be integrated into the component section.",
8467
+ Component: "The pasted content is invalid; the component cannot be integrated into the event section."
8468
+ };
8481
8469
  if (copiedConfig.Handler && elementType === "Component") {
8482
8470
  store2.setNotify({
8483
- FailMessage: "The pasted content is invalid; the event cannot be integrated into the component section.",
8471
+ FailMessage: notificationMessages.Event,
8484
8472
  Fail: true
8485
8473
  });
8486
8474
  } else if (copiedConfig.name && elementType === "Event") {
8487
8475
  store2.setNotify({
8488
- FailMessage: "The pasted content is invalid; the component cannot be integrated into the event section.",
8476
+ FailMessage: notificationMessages.Component,
8489
8477
  Fail: true
8490
8478
  });
8491
8479
  } else {
@@ -8501,6 +8489,19 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
8501
8489
  sessionStorage.removeItem("copiedConfig");
8502
8490
  store2.setSchema(schema2);
8503
8491
  store2.setUiSchema(uiSchema);
8492
+ },
8493
+ elementPathHandler: function(parentPath, rowId, elementType) {
8494
+ if (elementType === "Component") {
8495
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
8496
+ }
8497
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
8498
+ },
8499
+ ElementPathSetter: function(uiSchema) {
8500
+ const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
8501
+ const completePath = formData.pageName.split(">").map((item) => item.trim());
8502
+ const componentName = completePath[completePath.length - 2];
8503
+ const elementHeading = formData.name ? `Copied Element: ${formData.name}` : `Copied Event: ${componentName} Event Type: ${formData.eventType} `;
8504
+ uiSchema.elements[2].elements[1].config.main.heading = elementHeading;
8504
8505
  }
8505
8506
  };
8506
8507
  };
@@ -8529,9 +8530,7 @@ var pageMaster = (funcParams) => {
8529
8530
  getUiSchema: function() {
8530
8531
  const UiSchema = _.cloneDeep(PageMasterUiSchema(store2.theme.myTheme));
8531
8532
  if (sessionStorage.getItem("copiedConfig")) {
8532
- const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
8533
- const elementHeading = formData.name ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
8534
- UiSchema.elements[2].elements[1].config.main.heading = elementHeading;
8533
+ Component(store2, dynamicData2, submitHandler, service2).ElementPathSetter(UiSchema);
8535
8534
  }
8536
8535
  return UiSchema;
8537
8536
  },
@@ -9496,9 +9495,7 @@ var event = (store2, dynamicData2, submitHandler, service2, functionsName) => {
9496
9495
  getUiSchema: function() {
9497
9496
  const UiSchema = _.cloneDeep(EventUiSchema(store2.theme.myTheme));
9498
9497
  if (sessionStorage.getItem("copiedConfig")) {
9499
- const formData = JSON.parse(sessionStorage.getItem("copiedConfig"));
9500
- const elementHeading = formData.name ? `Copied Element: ${formData.name}` : `Copied Event: ${formData.eventType} `;
9501
- UiSchema.elements[2].elements[1].config.main.heading = elementHeading;
9498
+ Component(store2, dynamicData2, submitHandler, service2).ElementPathSetter(UiSchema);
9502
9499
  }
9503
9500
  store2.setUiSchema(UiSchema);
9504
9501
  return EventUiSchema;