@messaia/cdk 13.0.2 → 13.0.3

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.
@@ -4381,27 +4381,8 @@ class GenericListComponent extends BaseComponent {
4381
4381
  });
4382
4382
  }
4383
4383
  if (this.dynamicTable) {
4384
- /* Add checkbox column */
4385
- if (this.selectable) {
4386
- this.columns.unshift({ name: 'select', type: TableColumnType.Checkbox, disable: (row) => !this.selectableItem(row), cellNgClass: (row) => this.selectColumnNgClass(row) });
4387
- }
4388
- /* Add duplicate menu */
4389
- if (this.duplicable) {
4390
- this.actionMenus.unshift({ title: $localize `:@@duplicate:Duplicate`, event: (row) => this.duplicate(row) });
4391
- }
4392
- /* Add download menu */
4393
- if (this.downloadable) {
4394
- this.actionMenus.unshift({ title: $localize `:@@download:Download`, event: (row) => this.download(row), hide: (row) => !this.canDownloadItem(row) });
4395
- }
4396
- /* Add delete menu */
4397
- if (this.deleteable) {
4398
- this.toolbarMenus.unshift({ title: $localize `:@@deleteSelected:Delete selected`, event: (_) => this.deleteItems() });
4399
- this.actionMenus.unshift({ title: $localize `:@@delete:Delete`, event: (row) => this.deleteItem(row), hide: (row) => !this.canDeleteItem(row) });
4400
- }
4401
- /* Add edit menu */
4402
- if (this.editable) {
4403
- this.actionMenus.unshift({ title: $localize `:@@edit:Edit`, event: (row) => this.edit(row) });
4404
- }
4384
+ /* Add menu items for each row */
4385
+ this.addRowMenuItems();
4405
4386
  /* Check if the action column already exists */
4406
4387
  var actionColmun = this.columns?.find(x => x.name == 'action');
4407
4388
  /* If so, just add the menu items to it */
@@ -4541,7 +4522,6 @@ class GenericListComponent extends BaseComponent {
4541
4522
  }
4542
4523
  /**
4543
4524
  * Deletes an item from the database.
4544
- * @param ids the IDs of the items to delete
4545
4525
  */
4546
4526
  deleteItems() {
4547
4527
  if (this.dataSource.selectionModel.hasValue()) {
@@ -4559,8 +4539,7 @@ class GenericListComponent extends BaseComponent {
4559
4539
  }
4560
4540
  /**
4561
4541
  * Toggles a property
4562
- * @param id
4563
- * @param enabled
4542
+ * @param item
4564
4543
  * @param property
4565
4544
  */
4566
4545
  toggle(item, property = 'enabled') {
@@ -4614,6 +4593,32 @@ class GenericListComponent extends BaseComponent {
4614
4593
  include(...inc) {
4615
4594
  inc?.forEach(x => this.includes.push(x));
4616
4595
  }
4596
+ /**
4597
+ * Add row menu items
4598
+ */
4599
+ addRowMenuItems() {
4600
+ /* Add checkbox column */
4601
+ if (this.selectable) {
4602
+ this.columns.unshift({ name: 'select', type: TableColumnType.Checkbox, disable: (row) => !this.selectableItem(row), cellNgClass: (row) => this.selectColumnNgClass(row) });
4603
+ }
4604
+ /* Add duplicate menu */
4605
+ if (this.duplicable) {
4606
+ this.actionMenus.unshift({ title: $localize `:@@duplicate:Duplicate`, event: (row) => this.duplicate(row) });
4607
+ }
4608
+ /* Add download menu */
4609
+ if (this.downloadable) {
4610
+ this.actionMenus.unshift({ title: $localize `:@@download:Download`, event: (row) => this.download(row), hide: (row) => !this.canDownloadItem(row) });
4611
+ }
4612
+ /* Add delete menu */
4613
+ if (this.deleteable) {
4614
+ this.toolbarMenus.unshift({ title: $localize `:@@deleteSelected:Delete selected`, event: (_) => this.deleteItems() });
4615
+ this.actionMenus.unshift({ title: $localize `:@@delete:Delete`, event: (row) => this.deleteItem(row), hide: (row) => !this.canDeleteItem(row) });
4616
+ }
4617
+ /* Add edit menu */
4618
+ if (this.editable) {
4619
+ this.actionMenus.unshift({ title: $localize `:@@edit:Edit`, event: (row) => this.edit(row) });
4620
+ }
4621
+ }
4617
4622
  /**
4618
4623
  * Check if the item is deleteable
4619
4624
  */