@messaia/cdk 22.0.1-rc.29 → 22.0.1-rc.30
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.
package/fesm2022/messaia-cdk.mjs
CHANGED
|
@@ -20525,11 +20525,12 @@ class GenericListComponent extends BaseComponent {
|
|
|
20525
20525
|
}
|
|
20526
20526
|
}
|
|
20527
20527
|
/**
|
|
20528
|
-
* Navigates to the edit page.
|
|
20528
|
+
* Navigates to the edit page for the specified entity.
|
|
20529
20529
|
* @param entity - The entity to be edited.
|
|
20530
20530
|
* @param context - Additional context data.
|
|
20531
|
+
* @param returnToCurrentRoute - Whether to return to the current route after editing.
|
|
20531
20532
|
*/
|
|
20532
|
-
edit(entity, context) {
|
|
20533
|
+
edit(entity, context, returnToCurrentRoute = false) {
|
|
20533
20534
|
/* Check if entity is null */
|
|
20534
20535
|
if (entity === null || entity === undefined) {
|
|
20535
20536
|
throw new Error('Entity must be defined for editing.');
|
|
@@ -20541,16 +20542,17 @@ class GenericListComponent extends BaseComponent {
|
|
|
20541
20542
|
/* Call the custom onEdit function with the entity and context */
|
|
20542
20543
|
this.onEdit(entity, context);
|
|
20543
20544
|
}
|
|
20545
|
+
/* If onEdit is not provided, construct the edit route and navigate */
|
|
20544
20546
|
else {
|
|
20545
20547
|
/* If the item is not editable, log a warning and return */
|
|
20546
20548
|
if (this.canEditItem(entity) === false) {
|
|
20547
20549
|
this.log('This item is not editable.');
|
|
20548
20550
|
return;
|
|
20549
20551
|
}
|
|
20550
|
-
/*
|
|
20552
|
+
/* Check if there are query parameters in the current route */
|
|
20551
20553
|
const hasParams = Object.keys(this.route.snapshot.queryParams).length > 0;
|
|
20552
20554
|
/* Navigate to the edit page with the entity's id and optional query parameters */
|
|
20553
|
-
this.router.navigate([`${this.currentBaseRoute}/edit`, entity?.id], { queryParams: hasParams ? { returnUrl: this.currentRoute } : {}, relativeTo: this.route });
|
|
20555
|
+
this.router.navigate([`${this.currentBaseRoute}/edit`, entity?.id], { queryParams: hasParams || returnToCurrentRoute ? { returnUrl: this.currentRoute } : {}, relativeTo: this.route });
|
|
20554
20556
|
}
|
|
20555
20557
|
}
|
|
20556
20558
|
}
|
|
@@ -21502,13 +21504,31 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
21502
21504
|
*/
|
|
21503
21505
|
SaveAction = SaveAction;
|
|
21504
21506
|
/**
|
|
21505
|
-
*
|
|
21507
|
+
* The route to navigate to after saving and editing the form.
|
|
21506
21508
|
*/
|
|
21507
21509
|
editSaveAndCloseRoute = '../../';
|
|
21510
|
+
/**
|
|
21511
|
+
* The route to navigate to after saving and adding a new form.
|
|
21512
|
+
*/
|
|
21508
21513
|
addSaveAndCloseRoute = '../';
|
|
21514
|
+
/**
|
|
21515
|
+
* The route to navigate to after saving and editing the form.
|
|
21516
|
+
*/
|
|
21509
21517
|
addSaveAndEditRoute = '../edit/';
|
|
21518
|
+
/**
|
|
21519
|
+
* The route to navigate to after saving and creating a new form.
|
|
21520
|
+
*/
|
|
21510
21521
|
addSaveAndNewRoute = '../add';
|
|
21522
|
+
/**
|
|
21523
|
+
* The route to navigate to after saving and closing the form.
|
|
21524
|
+
*/
|
|
21511
21525
|
listRoute = this.addSaveAndCloseRoute;
|
|
21526
|
+
/**
|
|
21527
|
+
* The toolbar Back destination, preferring the decoded return URL over the list route.
|
|
21528
|
+
*/
|
|
21529
|
+
get backNavigationRoute() {
|
|
21530
|
+
return this.returnUrl || this.listRoute;
|
|
21531
|
+
}
|
|
21512
21532
|
/**
|
|
21513
21533
|
* The ID of the item to load.
|
|
21514
21534
|
*/
|