Skip to content

Commit 167fc39

Browse files
authored
feat: add 'right' as an option for popover fixed position (#550)
* feat: add `right` as an option for popover fixed position
1 parent ba0c2af commit 167fc39

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

projects/components/src/overlay/overlay.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class OverlayService {
3030
parentInjector: injector,
3131
position: {
3232
type: PopoverPositionType.Fixed,
33-
location: PopoverFixedPositionLocation.RightUnderHeader
33+
location: config.position ?? PopoverFixedPositionLocation.RightUnderHeader
3434
},
3535
data: metadata
3636
});

projects/components/src/overlay/sheet/sheet.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { InjectionToken } from '@angular/core';
22
import { Observable } from 'rxjs';
3+
import { PopoverFixedPositionLocation } from '../../popover/popover';
34
import { OverlayConfig } from './../overlay';
45

56
export interface SheetOverlayConfig<TData = unknown> extends OverlayConfig {
67
size: SheetSize;
78
data?: TData;
9+
position?: PopoverFixedPositionLocation.Right | PopoverFixedPositionLocation.RightUnderHeader;
810
}
911

1012
export const enum SheetSize {

projects/components/src/popover/popover-position-builder.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ export class PopoverPositionBuilder {
107107
switch (popoverPosition.location) {
108108
case PopoverFixedPositionLocation.Centered:
109109
return globalPosition.centerHorizontally().centerVertically();
110+
case PopoverFixedPositionLocation.Right:
111+
return globalPosition.right('0').top('0');
110112
case PopoverFixedPositionLocation.RightUnderHeader:
111113
default:
112114
return globalPosition.right('0').top(this.headerHeight ?? '0');

projects/components/src/popover/popover.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ export const enum PopoverRelativePositionLocation {
6464

6565
export const enum PopoverFixedPositionLocation {
6666
RightUnderHeader,
67-
Centered
67+
Centered,
68+
Right
6869
}
6970

7071
export const POPOVER_DATA = new InjectionToken<unknown>('POPOVER_DATA');

0 commit comments

Comments
 (0)