@danske/sapphire-angular 1.19.1 → 1.19.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.
@@ -1116,7 +1116,7 @@ class CheckboxComponent extends _CheckboxMixinBase {
1116
1116
  }
1117
1117
  _onInputClick($event) {
1118
1118
  $event.stopPropagation();
1119
- if (!this.disabled && !this.readonly && !this.indeterminate) {
1119
+ if (!this.disabled && !this.readonly) {
1120
1120
  this._selected = !this._selected;
1121
1121
  // Emit our custom change event if the native input emitted one.
1122
1122
  // It is important to only emit it, if the native input triggered one, because
@@ -5766,18 +5766,28 @@ class TableHeadCellComponent {
5766
5766
  * Horizontal alignment of content in the cell.
5767
5767
  */
5768
5768
  this.align = 'left';
5769
+ /**
5770
+ * Applies the styles for selection cell. A selection cell is the first cell in a row, containing
5771
+ * a checkbox.
5772
+ */
5773
+ this.selectionCell = false;
5769
5774
  }
5770
5775
  }
5771
5776
  TableHeadCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: TableHeadCellComponent, deps: [{ token: forwardRef(() => TableComponent) }, { token: TableSortHeaderDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component });
5772
- TableHeadCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0", type: TableHeadCellComponent, selector: "th[sp-table-th]", inputs: { align: "align", width: "width", minWidth: "minWidth", maxWidth: "maxWidth" }, host: { properties: { "class.sapphire-table__cell--alignLeft": "align === 'left'", "class.sapphire-table__cell--alignCenter": "align === 'center'", "class.sapphire-table__cell--alignRight": "align === 'right'", "style.width": "this.width", "style.min-width": "this.minWidth", "style.max-width": "this.maxWidth" }, classAttribute: "sapphire-table__headCell" }, hostDirectives: [{ directive: UseComponentStyles }], ngImport: i0, template: "<div class=\"sapphire-table__headCell_container\" _spUseComponentStyles>\n <span *ngIf=\"tableSortHeader && align === 'right'\">\n <ng-container *ngTemplateOutlet=\"sortIcon\"></ng-container>\n </span>\n <span [spTruncatedWithTooltip]=\"cellOverflow === 'truncate'\">\n <ng-content></ng-content>\n </span>\n <span *ngIf=\"tableSortHeader && align !== 'right'\">\n <ng-container *ngTemplateOutlet=\"sortIcon\"></ng-container>\n </span>\n</div>\n\n<ng-template #sortIcon>\n <span\n *ngIf=\"tableSortHeader\"\n aria-hidden=\"true\"\n [class.sapphire-table-sortableIcon]=\"\n tableSortHeader.tableSort.sortDescriptor.column !==\n tableSortHeader.sortHeader\n \"\n [class.sapphire-table-sortedIcon]=\"\n tableSortHeader.tableSort.sortDescriptor.column ===\n tableSortHeader.sortHeader\n \"\n _spUseComponentStyles\n >\n <sp-icon\n [name]=\"\n tableSortHeader.tableSort.sortDescriptor.column ===\n tableSortHeader.sortHeader &&\n tableSortHeader.tableSort.sortDescriptor.direction === 'descending'\n ? 'caretDownMedium'\n : 'caretUpMedium'\n \"\n ></sp-icon>\n </span>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "sp-icon", inputs: ["name", "size"] }, { kind: "directive", type: TruncatedWithTooltipDirective, selector: "[spTruncatedWithTooltip]", inputs: ["spTruncatedWithTooltip"] }, { kind: "directive", type: UseComponentStyles, selector: "[_spUseComponentStyles]" }] });
5777
+ TableHeadCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0", type: TableHeadCellComponent, selector: "th[sp-table-th]", inputs: { align: "align", width: "width", minWidth: "minWidth", maxWidth: "maxWidth", selectionCell: "selectionCell" }, host: { properties: { "class.sapphire-table__headCell": "!selectionCell", "class.sapphire-table__cell": "selectionCell", "class.sapphire-table__cell--alignLeft": "align === 'left'", "class.sapphire-table__cell--alignCenter": "align === 'center'", "class.sapphire-table__cell--alignRight": "align === 'right'", "class.sapphire-table__selectionCell": "selectionCell", "style.width": "this.width", "style.min-width": "this.minWidth", "style.max-width": "this.maxWidth" } }, hostDirectives: [{ directive: UseComponentStyles }], ngImport: i0, template: "<div\n *ngIf=\"!selectionCell\"\n class=\"sapphire-table__headCell_container\"\n _spUseComponentStyles\n>\n <span *ngIf=\"tableSortHeader && align === 'right'\">\n <ng-container *ngTemplateOutlet=\"sortIcon\"></ng-container>\n </span>\n <span [spTruncatedWithTooltip]=\"cellOverflow === 'truncate'\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n <span *ngIf=\"tableSortHeader && align !== 'right'\">\n <ng-container *ngTemplateOutlet=\"sortIcon\"></ng-container>\n </span>\n</div>\n<ng-container *ngIf=\"selectionCell\"\n ><ng-container *ngTemplateOutlet=\"content\"></ng-container\n></ng-container>\n\n<ng-template #content><ng-content></ng-content></ng-template>\n\n<ng-template #sortIcon>\n <span\n *ngIf=\"tableSortHeader\"\n aria-hidden=\"true\"\n [class.sapphire-table-sortableIcon]=\"\n tableSortHeader.tableSort.sortDescriptor.column !==\n tableSortHeader.sortHeader\n \"\n [class.sapphire-table-sortedIcon]=\"\n tableSortHeader.tableSort.sortDescriptor.column ===\n tableSortHeader.sortHeader\n \"\n _spUseComponentStyles\n >\n <sp-icon\n [name]=\"\n tableSortHeader.tableSort.sortDescriptor.column ===\n tableSortHeader.sortHeader &&\n tableSortHeader.tableSort.sortDescriptor.direction === 'descending'\n ? 'caretDownMedium'\n : 'caretUpMedium'\n \"\n ></sp-icon>\n </span>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "sp-icon", inputs: ["name", "size"] }, { kind: "directive", type: TruncatedWithTooltipDirective, selector: "[spTruncatedWithTooltip]", inputs: ["spTruncatedWithTooltip"] }, { kind: "directive", type: UseComponentStyles, selector: "[_spUseComponentStyles]" }] });
5778
+ __decorate([
5779
+ CoerceBoolean
5780
+ ], TableHeadCellComponent.prototype, "selectionCell", void 0);
5773
5781
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: TableHeadCellComponent, decorators: [{
5774
5782
  type: Component,
5775
5783
  args: [{ selector: 'th[sp-table-th]', host: {
5776
- class: 'sapphire-table__headCell',
5784
+ '[class.sapphire-table__headCell]': '!selectionCell',
5785
+ '[class.sapphire-table__cell]': 'selectionCell',
5777
5786
  '[class.sapphire-table__cell--alignLeft]': "align === 'left'",
5778
5787
  '[class.sapphire-table__cell--alignCenter]': "align === 'center'",
5779
5788
  '[class.sapphire-table__cell--alignRight]': "align === 'right'",
5780
- }, hostDirectives: [UseComponentStyles], template: "<div class=\"sapphire-table__headCell_container\" _spUseComponentStyles>\n <span *ngIf=\"tableSortHeader && align === 'right'\">\n <ng-container *ngTemplateOutlet=\"sortIcon\"></ng-container>\n </span>\n <span [spTruncatedWithTooltip]=\"cellOverflow === 'truncate'\">\n <ng-content></ng-content>\n </span>\n <span *ngIf=\"tableSortHeader && align !== 'right'\">\n <ng-container *ngTemplateOutlet=\"sortIcon\"></ng-container>\n </span>\n</div>\n\n<ng-template #sortIcon>\n <span\n *ngIf=\"tableSortHeader\"\n aria-hidden=\"true\"\n [class.sapphire-table-sortableIcon]=\"\n tableSortHeader.tableSort.sortDescriptor.column !==\n tableSortHeader.sortHeader\n \"\n [class.sapphire-table-sortedIcon]=\"\n tableSortHeader.tableSort.sortDescriptor.column ===\n tableSortHeader.sortHeader\n \"\n _spUseComponentStyles\n >\n <sp-icon\n [name]=\"\n tableSortHeader.tableSort.sortDescriptor.column ===\n tableSortHeader.sortHeader &&\n tableSortHeader.tableSort.sortDescriptor.direction === 'descending'\n ? 'caretDownMedium'\n : 'caretUpMedium'\n \"\n ></sp-icon>\n </span>\n</ng-template>\n" }]
5789
+ '[class.sapphire-table__selectionCell]': 'selectionCell',
5790
+ }, hostDirectives: [UseComponentStyles], template: "<div\n *ngIf=\"!selectionCell\"\n class=\"sapphire-table__headCell_container\"\n _spUseComponentStyles\n>\n <span *ngIf=\"tableSortHeader && align === 'right'\">\n <ng-container *ngTemplateOutlet=\"sortIcon\"></ng-container>\n </span>\n <span [spTruncatedWithTooltip]=\"cellOverflow === 'truncate'\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n <span *ngIf=\"tableSortHeader && align !== 'right'\">\n <ng-container *ngTemplateOutlet=\"sortIcon\"></ng-container>\n </span>\n</div>\n<ng-container *ngIf=\"selectionCell\"\n ><ng-container *ngTemplateOutlet=\"content\"></ng-container\n></ng-container>\n\n<ng-template #content><ng-content></ng-content></ng-template>\n\n<ng-template #sortIcon>\n <span\n *ngIf=\"tableSortHeader\"\n aria-hidden=\"true\"\n [class.sapphire-table-sortableIcon]=\"\n tableSortHeader.tableSort.sortDescriptor.column !==\n tableSortHeader.sortHeader\n \"\n [class.sapphire-table-sortedIcon]=\"\n tableSortHeader.tableSort.sortDescriptor.column ===\n tableSortHeader.sortHeader\n \"\n _spUseComponentStyles\n >\n <sp-icon\n [name]=\"\n tableSortHeader.tableSort.sortDescriptor.column ===\n tableSortHeader.sortHeader &&\n tableSortHeader.tableSort.sortDescriptor.direction === 'descending'\n ? 'caretDownMedium'\n : 'caretUpMedium'\n \"\n ></sp-icon>\n </span>\n</ng-template>\n" }]
5781
5791
  }], ctorParameters: function () {
5782
5792
  return [{ type: TableComponent, decorators: [{
5783
5793
  type: Inject,
@@ -5802,6 +5812,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
5802
5812
  args: ['style.max-width']
5803
5813
  }, {
5804
5814
  type: Input
5815
+ }], selectionCell: [{
5816
+ type: Input
5805
5817
  }] } });
5806
5818
 
5807
5819
  class SapphireTooltipModule {
@@ -5859,6 +5871,11 @@ class TableCellDirective {
5859
5871
  this.table = table;
5860
5872
  this.truncatedWithTooltipDirective = truncatedWithTooltipDirective;
5861
5873
  this.tableRow = tableRow;
5874
+ /**
5875
+ * Applies the styles for selection cell.
5876
+ * A selection cell is the first cell in a row, containing a checkbox.
5877
+ */
5878
+ this.selectionCell = false;
5862
5879
  this.isFirstCellInRow = false;
5863
5880
  }
5864
5881
  ngAfterContentChecked() {
@@ -5869,7 +5886,10 @@ class TableCellDirective {
5869
5886
  }
5870
5887
  }
5871
5888
  TableCellDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: TableCellDirective, deps: [{ token: forwardRef(() => TableComponent) }, { token: TruncatedWithTooltipDirective }, { token: forwardRef(() => TableRowDirective) }], target: i0.ɵɵFactoryTarget.Directive });
5872
- TableCellDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: TableCellDirective, selector: "td[sp-table-td]", inputs: { align: "align" }, host: { properties: { "class.sapphire-table__cell--alignLeft": "align === 'left'", "class.sapphire-table__cell--alignCenter": "align === 'center'", "class.sapphire-table__cell--alignRight": "align === 'right'", "attr.role": "this.role", "attr.align": "this.align", "style.width": "this.width", "style.min-width": "this.minWidth", "style.max-width": "this.maxWidth" }, classAttribute: "sapphire-table__cell" }, hostDirectives: [{ directive: TruncatedWithTooltipDirective }, { directive: UseComponentStyles }], ngImport: i0 });
5889
+ TableCellDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: TableCellDirective, selector: "td[sp-table-td]", inputs: { align: "align", selectionCell: "selectionCell" }, host: { properties: { "class.sapphire-table__cell--alignLeft": "align === 'left'", "class.sapphire-table__cell--alignCenter": "align === 'center'", "class.sapphire-table__cell--alignRight": "align === 'right'", "class.sapphire-table__selectionCell": "selectionCell", "attr.role": "this.role", "attr.align": "this.align", "style.width": "this.width", "style.min-width": "this.minWidth", "style.max-width": "this.maxWidth" }, classAttribute: "sapphire-table__cell" }, hostDirectives: [{ directive: TruncatedWithTooltipDirective }, { directive: UseComponentStyles }], ngImport: i0 });
5890
+ __decorate([
5891
+ CoerceBoolean
5892
+ ], TableCellDirective.prototype, "selectionCell", void 0);
5873
5893
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: TableCellDirective, decorators: [{
5874
5894
  type: Directive,
5875
5895
  args: [{
@@ -5880,6 +5900,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
5880
5900
  '[class.sapphire-table__cell--alignLeft]': "align === 'left'",
5881
5901
  '[class.sapphire-table__cell--alignCenter]': "align === 'center'",
5882
5902
  '[class.sapphire-table__cell--alignRight]': "align === 'right'",
5903
+ '[class.sapphire-table__selectionCell]': 'selectionCell',
5883
5904
  },
5884
5905
  }]
5885
5906
  }], ctorParameters: function () {
@@ -5898,6 +5919,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
5898
5919
  args: ['attr.align']
5899
5920
  }, {
5900
5921
  type: Input
5922
+ }], selectionCell: [{
5923
+ type: Input
5901
5924
  }], width: [{
5902
5925
  type: HostBinding,
5903
5926
  args: ['style.width']
@@ -5929,13 +5952,20 @@ class TableRowDirective {
5929
5952
  this.cells = new QueryList();
5930
5953
  this.rowData = null;
5931
5954
  this.disabled = false;
5955
+ /**
5956
+ * Applies selected row styles, and marks the row as selected for assistive technology.
5957
+ */
5958
+ this.selected = false;
5932
5959
  }
5933
5960
  }
5934
5961
  TableRowDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: TableRowDirective, deps: [{ token: forwardRef(() => TableComponent) }], target: i0.ɵɵFactoryTarget.Directive });
5935
- TableRowDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: TableRowDirective, selector: "tr[sp-table-tr]", inputs: { rowData: "rowData", disabled: "disabled" }, host: { listeners: { "click": "onRowClick()" }, properties: { "class.js-hover": "disabled" }, classAttribute: "sapphire-table__row" }, queries: [{ propertyName: "cells", predicate: TableCellDirective }], hostDirectives: [{ directive: UseComponentStyles }], ngImport: i0 });
5962
+ TableRowDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: TableRowDirective, selector: "tr[sp-table-tr]", inputs: { rowData: "rowData", disabled: "disabled", selected: "selected" }, host: { listeners: { "click": "onRowClick()" }, properties: { "class.sapphire-table__row--selected": "selected", "attr.aria-selected": "selected || null", "class.js-hover": "disabled" }, classAttribute: "sapphire-table__row" }, queries: [{ propertyName: "cells", predicate: TableCellDirective }], hostDirectives: [{ directive: UseComponentStyles }], ngImport: i0 });
5936
5963
  __decorate([
5937
5964
  CoerceBoolean
5938
5965
  ], TableRowDirective.prototype, "disabled", void 0);
5966
+ __decorate([
5967
+ CoerceBoolean
5968
+ ], TableRowDirective.prototype, "selected", void 0);
5939
5969
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: TableRowDirective, decorators: [{
5940
5970
  type: Directive,
5941
5971
  args: [{
@@ -5947,6 +5977,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
5947
5977
  * The "js-hover" class basically means that we're taking over the hover
5948
5978
  * styles from css.
5949
5979
  */
5980
+ '[class.sapphire-table__row--selected]': 'selected',
5981
+ '[attr.aria-selected]': 'selected || null',
5950
5982
  '[class.js-hover]': 'disabled',
5951
5983
  },
5952
5984
  hostDirectives: [UseComponentStyles],
@@ -5963,6 +5995,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
5963
5995
  type: Input
5964
5996
  }], disabled: [{
5965
5997
  type: Input
5998
+ }], selected: [{
5999
+ type: Input
5966
6000
  }], onRowClick: [{
5967
6001
  type: HostListener,
5968
6002
  args: ['click']
@@ -6484,11 +6518,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
6484
6518
  *
6485
6519
  */
6486
6520
  class ThemeRootDirective {
6487
- constructor(elementRef, theme) {
6521
+ constructor(elementRef, themeRef, parentTheme) {
6522
+ const theme = parentTheme || themeRef.theme;
6488
6523
  theme.applyOnDomNode(elementRef.nativeElement);
6489
6524
  }
6490
6525
  }
6491
- ThemeRootDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ThemeRootDirective, deps: [{ token: i0.ElementRef }, { token: ThemeBaseDirective }], target: i0.ɵɵFactoryTarget.Directive });
6526
+ ThemeRootDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ThemeRootDirective, deps: [{ token: i0.ElementRef }, { token: TopLevelThemeRef }, { token: ThemeBaseDirective, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
6492
6527
  ThemeRootDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: ThemeRootDirective, isStandalone: true, selector: "[sp-theme-root]", ngImport: i0 });
6493
6528
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ThemeRootDirective, decorators: [{
6494
6529
  type: Directive,
@@ -6496,7 +6531,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
6496
6531
  selector: '[sp-theme-root]',
6497
6532
  standalone: true,
6498
6533
  }]
6499
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ThemeBaseDirective }]; } });
6534
+ }], ctorParameters: function () {
6535
+ return [{ type: i0.ElementRef }, { type: TopLevelThemeRef }, { type: ThemeBaseDirective, decorators: [{
6536
+ type: Optional
6537
+ }, {
6538
+ type: SkipSelf
6539
+ }] }];
6540
+ } });
6500
6541
 
6501
6542
  /**
6502
6543
  * - Makes sure currently applied theme is applied on overlays which are rendered as portal
@@ -7066,10 +7107,9 @@ class DialogTriggerDirective extends ModalTriggerDirective {
7066
7107
  this.modalService = modalService;
7067
7108
  }
7068
7109
  open() {
7069
- if (!this.templateRef) {
7070
- throw new Error('Template referenced by modal trigger not found.');
7110
+ if (this.templateRef) {
7111
+ this.dialogRef = this.modalService.openDialog(this.templateRef, this);
7071
7112
  }
7072
- this.dialogRef = this.modalService.openDialog(this.templateRef, this);
7073
7113
  }
7074
7114
  }
7075
7115
  DialogTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: DialogTriggerDirective, deps: [{ token: ModalService }], target: i0.ɵɵFactoryTarget.Directive });