@messaia/cdk 20.0.0-RC.5 → 20.0.0-RC.7

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.
@@ -1509,14 +1509,15 @@ class BaseComponent {
1509
1509
  /**
1510
1510
  * Shows a confirmation dialog to send some data.
1511
1511
  *
1512
- * @param message - The message to display in the dialog.
1513
- * @param observable - The observable instance to handle the data.
1514
- * @param successCallback - Optional callback to be invoked on successful operation.
1515
- * @param errorCallback - Optional callback to be invoked on an error.
1516
- * @param acceptButtonText - Optional text for the accept button.
1517
- * @param cancelButtonText - Optional text for the cancel button.
1518
- */
1519
- showConfirmationDialog(message, observabe, successCallback, errorCallback, acceptButtonText, cancelButtonText, dialogConfig) {
1512
+ * @param message - The message to display in the confirmation dialog.
1513
+ * @param observable - The Observable operation to execute upon confirmation.
1514
+ * @param successCallback - Optional callback invoked on successful completion of the Observable.
1515
+ * @param errorCallback - Optional callback invoked if the Observable errors.
1516
+ * @param acceptButtonText - Optional text for the accept button (default is localized "Yes").
1517
+ * @param cancelButtonText - Optional text for the cancel button (default is localized "Cancel").
1518
+ * @param dialogConfig - Optional Angular Material dialog configuration.
1519
+ */
1520
+ showConfirmationDialog = (message, observable, successCallback, errorCallback, acceptButtonText, cancelButtonText, dialogConfig) => {
1520
1521
  this.dialogService
1521
1522
  .openConfirm({
1522
1523
  message: message,
@@ -1526,7 +1527,7 @@ class BaseComponent {
1526
1527
  }, dialogConfig ?? { maxWidth: 480 })
1527
1528
  .afterClosed().subscribe((accept) => {
1528
1529
  if (accept) {
1529
- observabe.subscribe({
1530
+ observable.subscribe({
1530
1531
  next: (x) => {
1531
1532
  this.showMessage($localize `:@@snackbar.send.success:Data sent successfully.`);
1532
1533
  if (successCallback) {
@@ -1541,7 +1542,7 @@ class BaseComponent {
1541
1542
  });
1542
1543
  }
1543
1544
  });
1544
- }
1545
+ };
1545
1546
  /**
1546
1547
  * Opens a task dialog with the specified configuration.
1547
1548
  *
@@ -1572,12 +1573,12 @@ class BaseComponent {
1572
1573
  * },
1573
1574
  * });
1574
1575
  */
1575
- showTaskDialog(config, dialogConfig) {
1576
+ showTaskDialog = (config, dialogConfig) => {
1576
1577
  return this.openDialog(VdTaskDialogComponent, Object.assign(dialogConfig ?? {}, {
1577
1578
  data: new TaskDialogData(config),
1578
1579
  disableClose: true
1579
1580
  }));
1580
- }
1581
+ };
1581
1582
  /**
1582
1583
  * Opens a dialog of the specified type with the provided configuration.
1583
1584
  *
@@ -11352,9 +11353,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImpor
11352
11353
  args: [{ providedIn: 'root' }]
11353
11354
  }], ctorParameters: () => [{ type: i0.Compiler }] });
11354
11355
 
11356
+ /**
11357
+ * Represents a user-defined action that can be performed on an entity.
11358
+ * @template TEntity The type of the entity the action operates on.
11359
+ * @template TContext The type of the context in which the action is executed.
11360
+ */
11355
11361
  class ActionItem {
11356
11362
  /**
11357
- * The title of the action item.
11363
+ * Unique identifier for the action item.
11364
+ * @type {string}
11365
+ */
11366
+ id = '';
11367
+ /**
11368
+ * The display title of the action item.
11369
+ * Used in UI components like buttons or menus.
11358
11370
  * @type {string}
11359
11371
  */
11360
11372
  title;
@@ -17346,7 +17358,7 @@ class VdDynamicTableComponent {
17346
17358
  var actionColmun = this._columns?.find(x => x.name == 'action');
17347
17359
  /* If so, just add the menu items to it */
17348
17360
  if (actionColmun != null) {
17349
- actionColmun.menu ||= { icon: 'more_vert' };
17361
+ actionColmun.menu ||= { id: 'more', icon: 'more_vert' };
17350
17362
  this.rowMenuItems.forEach(y => actionColmun.menu.items?.unshift(y));
17351
17363
  }
17352
17364
  /* Otherwise add a new one */
@@ -17357,7 +17369,7 @@ class VdDynamicTableComponent {
17357
17369
  columnSets: ['action', 'common'],
17358
17370
  type: TableColumnType.Action,
17359
17371
  disabled: true,
17360
- menu: { icon: 'more_vert', items: this.rowMenuItems },
17372
+ menu: { id: 'more', icon: 'more_vert', items: this.rowMenuItems },
17361
17373
  configurable: false,
17362
17374
  stickyEnd: true
17363
17375
  }));
@@ -18350,6 +18362,7 @@ class GenericListComponent extends BaseComponent {
18350
18362
  * @type {ActionItem[]}
18351
18363
  */
18352
18364
  toolbarActions = [{
18365
+ id: 'refresh',
18353
18366
  icon: 'refresh',
18354
18367
  tooltip: $localize `:@@refreshList:Refresh the list`,
18355
18368
  event: () => this.loadList()
@@ -18859,6 +18872,7 @@ class GenericListComponent extends BaseComponent {
18859
18872
  /* Add 'Delete selected' menu item */
18860
18873
  if (this.deletable) {
18861
18874
  this.toolbarMenuItems.push({
18875
+ id: 'delete-selected',
18862
18876
  title: $localize `:@@deleteSelected:Delete selected`,
18863
18877
  icon: 'delete_forever',
18864
18878
  iconClass: 'tc-orange-800',
@@ -18870,6 +18884,7 @@ class GenericListComponent extends BaseComponent {
18870
18884
  /* Opens config dialog */
18871
18885
  if (this.configurable) {
18872
18886
  this.toolbarMenuItems.push({
18887
+ id: 'configure-table',
18873
18888
  title: $localize `:@@configureTable:Configure table`,
18874
18889
  icon: 'settings',
18875
18890
  event: () => this.openConfigDialog()
@@ -18878,6 +18893,7 @@ class GenericListComponent extends BaseComponent {
18878
18893
  /* Opens export dialog */
18879
18894
  if (this.exportable) {
18880
18895
  this.toolbarMenuItems.push({
18896
+ id: 'export-data',
18881
18897
  title: $localize `:@@exportData:Export data`,
18882
18898
  icon: 'download',
18883
18899
  iconClass: 'tc-blue-500',
@@ -18888,7 +18904,7 @@ class GenericListComponent extends BaseComponent {
18888
18904
  /* Sort the menu items by index */
18889
18905
  Utils.sortArray(this.toolbarMenuItems, 'index');
18890
18906
  /* Add the toolbar menu items to the the toolbar actions */
18891
- this.toolbarActions.push({ icon: 'more_vert', items: this.toolbarMenuItems });
18907
+ this.toolbarActions.push({ id: 'more', icon: 'more_vert', items: this.toolbarMenuItems });
18892
18908
  }
18893
18909
  }
18894
18910
  /**
@@ -18910,6 +18926,7 @@ class GenericListComponent extends BaseComponent {
18910
18926
  /* Add duplicate menu */
18911
18927
  if (this.duplicable) {
18912
18928
  this.rowMenuItems.unshift({
18929
+ id: 'duplicate',
18913
18930
  title: $localize `:@@duplicate:Duplicate`,
18914
18931
  icon: 'file_copy',
18915
18932
  event: (row) => this.duplicate(row),
@@ -18919,6 +18936,7 @@ class GenericListComponent extends BaseComponent {
18919
18936
  /* Add download menu */
18920
18937
  if (this.downloadable) {
18921
18938
  this.rowMenuItems.unshift({
18939
+ id: 'download',
18922
18940
  title: $localize `:@@download:Download`,
18923
18941
  icon: 'file_download',
18924
18942
  event: (row) => this.download(row),
@@ -18928,6 +18946,7 @@ class GenericListComponent extends BaseComponent {
18928
18946
  /* Add delete menu */
18929
18947
  if (this.deletable && this.canDelete) {
18930
18948
  this.rowMenuItems.unshift({
18949
+ id: 'delete',
18931
18950
  title: $localize `:@@delete:Delete`,
18932
18951
  icon: 'delete_forever',
18933
18952
  iconClass: 'tc-orange-800',
@@ -18938,6 +18957,7 @@ class GenericListComponent extends BaseComponent {
18938
18957
  /* Add edit menu */
18939
18958
  if (this.editable && this.canUpdate) {
18940
18959
  this.rowMenuItems.unshift({
18960
+ id: 'edit',
18941
18961
  title: $localize `:@@edit:Edit`,
18942
18962
  icon: 'edit_note',
18943
18963
  iconClass: 'tc-blue-400',
@@ -19171,14 +19191,16 @@ class GenericEmbeddedListComponent extends GenericListComponent {
19171
19191
  * Menu options for managing a list of items, including delete and more options.
19172
19192
  */
19173
19193
  itemListMenu = [
19194
+ /* Option to remove the selected item from the list */
19174
19195
  {
19175
- /* Option to remove the selected item from the list */
19196
+ id: 'delete',
19176
19197
  icon: 'delete_forever',
19177
19198
  event: (_, __, i) => this.removeItem(i),
19178
19199
  hide: (item) => (item?.id ?? 0) > 0
19179
19200
  },
19201
+ /* Action to show additional options for the item */
19180
19202
  {
19181
- /* Action to show additional options for the item */
19203
+ id: 'more',
19182
19204
  icon: 'more_vert',
19183
19205
  hide: (item) => (item?.id ?? 0) <= 0,
19184
19206
  items: this.rowMenuItems
@@ -19648,6 +19670,7 @@ class GenericFormBaseComponent extends BaseComponent {
19648
19670
  * Toolbar action buttons.
19649
19671
  */
19650
19672
  toolbarActions = [{
19673
+ id: 'refresh',
19651
19674
  icon: 'refresh',
19652
19675
  tooltip: $localize `:@@refreshPage:Refresh the page`,
19653
19676
  event: () => this.reloadPage(),
@@ -20068,6 +20091,7 @@ class GenericFormBaseComponent extends BaseComponent {
20068
20091
  /* Add 'Delete' menu item */
20069
20092
  if (this.deletable) {
20070
20093
  this.toolbarMenuItems.push({
20094
+ id: 'delete',
20071
20095
  title: $localize `:@@delete:Delete`,
20072
20096
  icon: 'delete_forever',
20073
20097
  iconClass: 'tc-orange-800',
@@ -20081,7 +20105,7 @@ class GenericFormBaseComponent extends BaseComponent {
20081
20105
  /* Sort the menu items by index */
20082
20106
  Utils.sortArray(this.toolbarMenuItems, 'index');
20083
20107
  /* Add the toolbar menu items to the the toolbar actions */
20084
- this.toolbarActions.push({ icon: 'more_vert', items: this.toolbarMenuItems });
20108
+ this.toolbarActions.push({ id: 'more', icon: 'more_vert', items: this.toolbarMenuItems });
20085
20109
  }
20086
20110
  }
20087
20111
  /**