@danske/sapphire-angular 1.15.0 → 1.16.1

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.
@@ -1609,20 +1609,20 @@ class PopoverTriggerDirective {
1609
1609
  this.closed.next();
1610
1610
  this.changeDetectorRef.detectChanges();
1611
1611
  });
1612
- this.overlayRef
1613
- .outsidePointerEvents()
1614
- .pipe(takeUntil(merge(this.closed, this.destroyed)))
1615
- .subscribe((event) => {
1616
- if (
1617
- // If popover is opened on press start, an outside pointer event
1618
- // is emitted as the mouse is being released, which would immediately
1619
- // close the popover. Probably a bug in @angular/cdk/overlay.
1620
- !(this.openOnPressStart && this.isBeingPressed) &&
1621
- !this.elementRef.nativeElement.contains(event.target)) {
1622
- this.close();
1623
- }
1624
- });
1625
1612
  }
1613
+ this.overlayRef
1614
+ .outsidePointerEvents()
1615
+ .pipe(takeUntil(merge(this.closed, this.destroyed)))
1616
+ .subscribe((event) => {
1617
+ if (
1618
+ // If popover is opened on press start, an outside pointer event
1619
+ // is emitted as the mouse is being released, which would immediately
1620
+ // close the popover. Probably a bug in @angular/cdk/overlay.
1621
+ !(this.openOnPressStart && this.isBeingPressed) &&
1622
+ !this.elementRef.nativeElement.contains(event.target)) {
1623
+ this.close();
1624
+ }
1625
+ });
1626
1626
  this.overlayRef.attach(this.getContentPortal());
1627
1627
  this.changeDetectorRef.detectChanges();
1628
1628
  }
@@ -1894,7 +1894,17 @@ class PopoverComponent {
1894
1894
  // focus is going. So we asynchronously check if the focus is outside the trigger and close
1895
1895
  // in that case.
1896
1896
  setTimeout(() => {
1897
- if (!this.trigger?.elementRef.nativeElement.contains(document.activeElement)) {
1897
+ if (
1898
+ /**
1899
+ * If the focus is going to body, don't close the popover.
1900
+ * similar consideration in react-aria's useOverlay:
1901
+ * https://github.com/adobe/react-spectrum/blob/2bda4c971dd557be7ecc44614569a8281e6cb6dd/packages/%40react-aria/overlays/src/useOverlay.ts#L128-L130
1902
+ *
1903
+ * In addition to those scenarios, the focused element may get disabled in the popover,
1904
+ * which moves the focus to body.
1905
+ */
1906
+ document.activeElement !== document.body &&
1907
+ !this.trigger?.elementRef.nativeElement.contains(document.activeElement)) {
1898
1908
  this.trigger?.close();
1899
1909
  }
1900
1910
  });
@@ -5312,10 +5322,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
5312
5322
 
5313
5323
  class TableRowDirective {
5314
5324
  onRowClick() {
5315
- this.table.rowAction.emit({
5316
- index: this.table.rows?.toArray().findIndex((row) => row === this) ?? -1,
5317
- rowData: this.rowData,
5318
- });
5325
+ if (!this.disabled) {
5326
+ this.table.rowAction.emit({
5327
+ index: this.table.rows?.toArray().findIndex((row) => row === this) ?? -1,
5328
+ rowData: this.rowData,
5329
+ });
5330
+ }
5319
5331
  }
5320
5332
  getColumnHeadCell(cell) {
5321
5333
  const index = this.cells.toArray().indexOf(cell);
@@ -5325,16 +5337,26 @@ class TableRowDirective {
5325
5337
  this.table = table;
5326
5338
  this.cells = new QueryList();
5327
5339
  this.rowData = null;
5340
+ this.disabled = false;
5328
5341
  }
5329
5342
  }
5330
5343
  TableRowDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: TableRowDirective, deps: [{ token: forwardRef(() => TableComponent) }], target: i0.ɵɵFactoryTarget.Directive });
5331
- TableRowDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: TableRowDirective, selector: "tr[sp-table-tr]", inputs: { rowData: "rowData" }, host: { listeners: { "click": "onRowClick()" }, classAttribute: "sapphire-table__row" }, queries: [{ propertyName: "cells", predicate: TableCellDirective }], hostDirectives: [{ directive: UseComponentStyles }], ngImport: i0 });
5344
+ 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 });
5345
+ __decorate([
5346
+ CoerceBoolean
5347
+ ], TableRowDirective.prototype, "disabled", void 0);
5332
5348
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: TableRowDirective, decorators: [{
5333
5349
  type: Directive,
5334
5350
  args: [{
5335
5351
  selector: 'tr[sp-table-tr]',
5336
5352
  host: {
5337
5353
  class: 'sapphire-table__row',
5354
+ /**
5355
+ * We want the css hover styles to not be applied for the disabled rows.
5356
+ * The "js-hover" class basically means that we're taking over the hover
5357
+ * styles from css.
5358
+ */
5359
+ '[class.js-hover]': 'disabled',
5338
5360
  },
5339
5361
  hostDirectives: [UseComponentStyles],
5340
5362
  }]
@@ -5346,6 +5368,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
5346
5368
  args: [TableCellDirective]
5347
5369
  }], rowData: [{
5348
5370
  type: Input
5371
+ }], disabled: [{
5372
+ type: Input
5349
5373
  }], onRowClick: [{
5350
5374
  type: HostListener,
5351
5375
  args: ['click']
@@ -7939,5 +7963,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
7939
7963
  * Generated bundle index. Do not edit.
7940
7964
  */
7941
7965
 
7942
- export { BadgeComponent, BasicSelectComponent, BasicSingleSelectDirective, ButtonComponent, ButtonGroupComponent, ButtonIconDirective, CheckboxChange, CheckboxComponent, ConfirmationDialogComponent, ContextualHelpComponent, ContextualHelpContentDirective, ContextualHelpFooterDirective, ContextualHelpHeaderDirective, DEFAULT_BREAKPOINTS, DangerDialogComponent, DialogCloseButtonDirective, DialogComponent, DialogContentDirective, DialogFooterComponent, DialogFooterDirective, DialogHeaderComponent, DialogHeaderDirective, DialogTriggerDirective, FieldComponent, FieldControl, FieldErrorDirective, FieldLabelDirective, FieldNoteDirective, FieldNoteSuffixDirective, HeadingComponent, ICON_SIZE_PROVIDER, IconButtonComponent, IconComponent, InlinePanelComponent, LinkComponent, ListboxChild, ListboxComponent, ListboxInputDirective, MenuComponent, MenuItemComponent, MenuSectionComponent, MenuTriggerDirective, ModalService, MultiSelectDirective, NotificationBadgeComponent, OptionComponent, OptionIconDirective, OptionPrimaryTextDirective, OptionSecondaryTextDirective, POPOVER_TRIGGER, PaginationComponent, PanelBackButtonDirective, PanelCloseButtonDirective, PanelComponent, PanelContentComponent, PanelFooterComponent, PanelFooterDirective, PanelHeaderComponent, PanelHeaderDirective, PanelTriggerDirective, ParagraphComponent, PopoverCloseButtonDirective, PopoverComponent, PopoverTitleDirective, PopoverTriggerDirective, RadioComponent, RadioGroupComponent, SapphireBadgeModule, SapphireButtonModule, SapphireCheckboxModule, SapphireCheckboxRequiredValidator, SapphireContextualHelpModule, SapphireCoreModule, SapphireFieldModule, SapphireIconModule, SapphireLinkModule, SapphireListboxModule, SapphireMenuModule, SapphireModalModule, SapphireNotificationBadgeModule, SapphireOverlayContainer, SapphirePaginationChange, SapphirePaginationModule, SapphirePopoverModule, SapphireRadioChange, SapphireRadioModule, SapphireSegmentedTabsModule, SapphireSelectModule, SapphireSkeletonModule, SapphireSurfaceModule, SapphireSwitchChange, SapphireSwitchModule, SapphireSwitchRequiredValidator, SapphireTableModule, SapphireTextFieldModule, SapphireThemeModule, SapphireToggleButtonRequiredValidator, SapphireTooltipModule, SapphireTypographyModule, ScrollMonitorDirective, SearchableSelectDirective, SectionDirective, SegmentedTabComponent, SegmentedTabContentDirective, SegmentedTabLabelDirective, SegmentedTabsComponent, SelectComponent, SelectionTextDirective, SingleSelectDirective, SkeletonBlockDirective, SkeletonCircleDirective, SkeletonComponent, SkeletonTextDirective, SurfaceComponent, SwitchComponent, TableBodyDirective, TableCellDirective, TableComponent, TableDirective, TableHeadCellComponent, TableHeadDirective, TableRowDirective, TableSortDirective, TableSortHeaderDirective, TextFieldAffixDirective, TextFieldComponent, TextFieldInputDirective, TextFieldPostfixDirective, TextFieldPrefixDirective, TextFieldTextareaAutosizeDirective, ThemeBaseDirective, ThemeCheckDirective, ThemeDefault, ThemeDefaultDark, ThemeRootDirective, ToggleButtonComponent, TooltipComponent, TooltipDirective, TruncatedWithTooltipDirective, UseComponentStyles, UseComponentStylesOnHost, ViewEncapsulationProvider };
7966
+ export { BadgeComponent, BasicSelectComponent, BasicSingleSelectDirective, ButtonComponent, ButtonGroupComponent, ButtonIconDirective, CheckboxChange, CheckboxComponent, ConfirmationDialogComponent, ContextualHelpComponent, ContextualHelpContentDirective, ContextualHelpFooterDirective, ContextualHelpHeaderDirective, DEFAULT_BREAKPOINTS, DangerDialogComponent, DialogCloseButtonDirective, DialogComponent, DialogContentDirective, DialogFooterComponent, DialogFooterDirective, DialogHeaderComponent, DialogHeaderDirective, DialogTriggerDirective, FieldComponent, FieldControl, FieldErrorDirective, FieldLabelDirective, FieldNoteDirective, FieldNoteSuffixDirective, HeadingComponent, ICON_SIZE_PROVIDER, IconButtonComponent, IconComponent, InlinePanelComponent, LinkComponent, ListboxChild, ListboxComponent, ListboxInputDirective, MenuComponent, MenuItemComponent, MenuSectionComponent, MenuTriggerDirective, ModalCloseButtonDirective, ModalService, MultiSelectDirective, NotificationBadgeComponent, OptionComponent, OptionIconDirective, OptionPrimaryTextDirective, OptionSecondaryTextDirective, POPOVER_TRIGGER, PaginationComponent, PanelBackButtonDirective, PanelCloseButtonDirective, PanelComponent, PanelContentComponent, PanelFooterComponent, PanelFooterDirective, PanelHeaderComponent, PanelHeaderDirective, PanelTriggerDirective, ParagraphComponent, PopoverCloseButtonDirective, PopoverComponent, PopoverTitleDirective, PopoverTriggerDirective, RadioComponent, RadioGroupComponent, SapphireBadgeModule, SapphireButtonModule, SapphireCheckboxModule, SapphireCheckboxRequiredValidator, SapphireContextualHelpModule, SapphireCoreModule, SapphireFieldModule, SapphireIconModule, SapphireLinkModule, SapphireListboxModule, SapphireMenuModule, SapphireModalModule, SapphireNotificationBadgeModule, SapphireOverlayContainer, SapphirePaginationChange, SapphirePaginationModule, SapphirePopoverModule, SapphireRadioChange, SapphireRadioModule, SapphireSegmentedTabsModule, SapphireSelectModule, SapphireSkeletonModule, SapphireSurfaceModule, SapphireSwitchChange, SapphireSwitchModule, SapphireSwitchRequiredValidator, SapphireTableModule, SapphireTextFieldModule, SapphireThemeModule, SapphireToggleButtonRequiredValidator, SapphireTooltipModule, SapphireTypographyModule, ScrollMonitorDirective, SearchableSelectDirective, SectionDirective, SegmentedTabComponent, SegmentedTabContentDirective, SegmentedTabLabelDirective, SegmentedTabsComponent, SelectComponent, SelectionTextDirective, SingleSelectDirective, SkeletonBlockDirective, SkeletonCircleDirective, SkeletonComponent, SkeletonTextDirective, SurfaceComponent, SwitchComponent, TableBodyDirective, TableCellDirective, TableComponent, TableDirective, TableHeadCellComponent, TableHeadDirective, TableRowDirective, TableSortDirective, TableSortHeaderDirective, TextFieldAffixDirective, TextFieldComponent, TextFieldInputDirective, TextFieldPostfixDirective, TextFieldPrefixDirective, TextFieldTextareaAutosizeDirective, ThemeBaseDirective, ThemeCheckDirective, ThemeDefault, ThemeDefaultDark, ThemeRootDirective, ToggleButtonComponent, TooltipComponent, TooltipDirective, TruncatedWithTooltipDirective, UseComponentStyles, UseComponentStylesOnHost, ViewEncapsulationProvider };
7943
7967
  //# sourceMappingURL=danske-sapphire-angular.mjs.map