@messaia/cdk 13.0.0 → 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.
@@ -2539,7 +2539,7 @@ class GenericFormBaseComponent extends BaseComponent {
2539
2539
  /* Send the data to the server */
2540
2540
  this.create().subscribe({
2541
2541
  next: (response) => {
2542
- this.id = response.id;
2542
+ this.id = response === null || response === void 0 ? void 0 : response.id;
2543
2543
  this.onAfterSubmit(action, response);
2544
2544
  if (form) {
2545
2545
  Object.keys(form.controls).forEach(key => {
@@ -2599,15 +2599,7 @@ class GenericFormBaseComponent extends BaseComponent {
2599
2599
  isFormValid(form = null) {
2600
2600
  /* Print some debug information */
2601
2601
  if (this.debug) {
2602
- console.log('Form:', form);
2603
- Object.keys(form.controls).forEach(key => {
2604
- const controlErrors = form.controls[key].errors;
2605
- if (controlErrors != null) {
2606
- Object.keys(controlErrors).forEach(keyError => {
2607
- console.log('Key control: ' + key + ', keyError: ' + keyError + ', err value: ', controlErrors[keyError]);
2608
- });
2609
- }
2610
- });
2602
+ this.debugForm(form);
2611
2603
  }
2612
2604
  /* If the form ist not valid.. */
2613
2605
  if (!form.valid) {
@@ -2678,6 +2670,21 @@ class GenericFormBaseComponent extends BaseComponent {
2678
2670
  control.markAsTouched();
2679
2671
  }
2680
2672
  }
2673
+ /**
2674
+ * Shows form errors
2675
+ * @param form
2676
+ */
2677
+ debugForm(form = null) {
2678
+ console.log('Form:', form);
2679
+ Object.keys(form.controls).forEach(key => {
2680
+ const controlErrors = form.controls[key].errors;
2681
+ if (controlErrors != null) {
2682
+ Object.keys(controlErrors).forEach(keyError => {
2683
+ console.log('Key control: ' + key + ', keyError: ' + keyError + ', err value: ', controlErrors[keyError]);
2684
+ });
2685
+ }
2686
+ });
2687
+ }
2681
2688
  /**
2682
2689
  * Loads the previous URL in the history list.
2683
2690
  * @param action
@@ -4394,27 +4401,8 @@ class GenericListComponent extends BaseComponent {
4394
4401
  });
4395
4402
  }
4396
4403
  if (this.dynamicTable) {
4397
- /* Add checkbox column */
4398
- if (this.selectable) {
4399
- this.columns.unshift({ name: 'select', type: TableColumnType.Checkbox, disable: (row) => !this.selectableItem(row), cellNgClass: (row) => this.selectColumnNgClass(row) });
4400
- }
4401
- /* Add duplicate menu */
4402
- if (this.duplicable) {
4403
- this.actionMenus.unshift({ title: $localize `:@@duplicate:Duplicate`, event: (row) => this.duplicate(row) });
4404
- }
4405
- /* Add download menu */
4406
- if (this.downloadable) {
4407
- this.actionMenus.unshift({ title: $localize `:@@download:Download`, event: (row) => this.download(row), hide: (row) => !this.canDownloadItem(row) });
4408
- }
4409
- /* Add delete menu */
4410
- if (this.deleteable) {
4411
- this.toolbarMenus.unshift({ title: $localize `:@@deleteSelected:Delete selected`, event: (_) => this.deleteItems() });
4412
- this.actionMenus.unshift({ title: $localize `:@@delete:Delete`, event: (row) => this.deleteItem(row), hide: (row) => !this.canDeleteItem(row) });
4413
- }
4414
- /* Add edit menu */
4415
- if (this.editable) {
4416
- this.actionMenus.unshift({ title: $localize `:@@edit:Edit`, event: (row) => this.edit(row) });
4417
- }
4404
+ /* Add menu items for each row */
4405
+ this.addRowMenuItems();
4418
4406
  /* Check if the action column already exists */
4419
4407
  var actionColmun = (_b = this.columns) === null || _b === void 0 ? void 0 : _b.find(x => x.name == 'action');
4420
4408
  /* If so, just add the menu items to it */
@@ -4555,7 +4543,6 @@ class GenericListComponent extends BaseComponent {
4555
4543
  }
4556
4544
  /**
4557
4545
  * Deletes an item from the database.
4558
- * @param ids the IDs of the items to delete
4559
4546
  */
4560
4547
  deleteItems() {
4561
4548
  if (this.dataSource.selectionModel.hasValue()) {
@@ -4573,8 +4560,7 @@ class GenericListComponent extends BaseComponent {
4573
4560
  }
4574
4561
  /**
4575
4562
  * Toggles a property
4576
- * @param id
4577
- * @param enabled
4563
+ * @param item
4578
4564
  * @param property
4579
4565
  */
4580
4566
  toggle(item, property = 'enabled') {
@@ -4628,6 +4614,32 @@ class GenericListComponent extends BaseComponent {
4628
4614
  include(...inc) {
4629
4615
  inc === null || inc === void 0 ? void 0 : inc.forEach(x => this.includes.push(x));
4630
4616
  }
4617
+ /**
4618
+ * Add row menu items
4619
+ */
4620
+ addRowMenuItems() {
4621
+ /* Add checkbox column */
4622
+ if (this.selectable) {
4623
+ this.columns.unshift({ name: 'select', type: TableColumnType.Checkbox, disable: (row) => !this.selectableItem(row), cellNgClass: (row) => this.selectColumnNgClass(row) });
4624
+ }
4625
+ /* Add duplicate menu */
4626
+ if (this.duplicable) {
4627
+ this.actionMenus.unshift({ title: $localize `:@@duplicate:Duplicate`, event: (row) => this.duplicate(row) });
4628
+ }
4629
+ /* Add download menu */
4630
+ if (this.downloadable) {
4631
+ this.actionMenus.unshift({ title: $localize `:@@download:Download`, event: (row) => this.download(row), hide: (row) => !this.canDownloadItem(row) });
4632
+ }
4633
+ /* Add delete menu */
4634
+ if (this.deleteable) {
4635
+ this.toolbarMenus.unshift({ title: $localize `:@@deleteSelected:Delete selected`, event: (_) => this.deleteItems() });
4636
+ this.actionMenus.unshift({ title: $localize `:@@delete:Delete`, event: (row) => this.deleteItem(row), hide: (row) => !this.canDeleteItem(row) });
4637
+ }
4638
+ /* Add edit menu */
4639
+ if (this.editable) {
4640
+ this.actionMenus.unshift({ title: $localize `:@@edit:Edit`, event: (row) => this.edit(row) });
4641
+ }
4642
+ }
4631
4643
  /**
4632
4644
  * Check if the item is deleteable
4633
4645
  */
@@ -11417,6 +11429,14 @@ class GenericReactiveFormComponent extends GenericFormBaseComponent {
11417
11429
  this.form = this.formBuilder.formGroup(this.item, this.formBuilderConfig);
11418
11430
  this.onAfterFormBuild();
11419
11431
  }
11432
+ /**
11433
+ * Shows form errors
11434
+ * @param form
11435
+ */
11436
+ debugForm(form = null) {
11437
+ super.debugForm(form);
11438
+ console.log(this.form.getErrorSummary(false));
11439
+ }
11420
11440
  }
11421
11441
  /** @nocollapse */ /** @nocollapse */ GenericReactiveFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: GenericReactiveFormComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
11422
11442
  /** @nocollapse */ /** @nocollapse */ GenericReactiveFormComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.3", type: GenericReactiveFormComponent, usesInheritance: true, ngImport: i0 });