Skip to content

Commit 1448b2e

Browse files
committed
BREAKING drop fixed option
It is no longer possible to force the FAB to stay open at all times
1 parent 82d9e7a commit 1448b2e

File tree

4 files changed

+12
-39
lines changed

4 files changed

+12
-39
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ or adapt the bindings to your needs:
4444

4545
### eco-fab-speed-dial
4646

47-
BREA| Property | Type | Default | Description |
48-
| ----------- | ------------------------------- | ------- | -------------------------------------------------------------------------------------- |
49-
| `open` | `boolean` | `false` | Indicates if this FAB Speed Dial is opened |
50-
| `direction` | `up`, `down`, `left` or `right` | `up` | The direction to open the action buttons |
51-
| `fixed` | `boolean` | `false` | Indicates if this FAB Speed Dial is fixed (user cannot change the open state on click) |
47+
| Property | Type | Default | Description |
48+
| ----------- | ------------------------------- | ------- | ------------------------------------------ |
49+
| `open` | `boolean` | `false` | Indicates if this FAB Speed Dial is opened |
50+
| `direction` | `up`, `down`, `left` or `right` | `up` | The direction to open the action buttons |
5251

5352
### eco-fab-speed-dial-trigger
5453

projects/fab-speed-dial/src/lib/fab-speed-dial.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,6 @@ export class EcoFabSpeedDialComponent implements OnDestroy {
151151

152152
private documentClickUnlistener: (() => void) | null = null;
153153

154-
/**
155-
* Whether this speed dial is fixed on screen (user cannot change it by clicking)
156-
*/
157-
public readonly fixed = input(false);
158-
private readonly processFixed = effect(() => {
159-
this.processOutsideClickState();
160-
});
161-
162154
/**
163155
* Whether this speed dial is opened
164156
*/
@@ -197,7 +189,7 @@ export class EcoFabSpeedDialComponent implements OnDestroy {
197189
}
198190

199191
protected onClick(): void {
200-
if (!this.fixed() && this.open()) {
192+
if (this.open()) {
201193
this.open.set(false);
202194
}
203195
}
@@ -221,7 +213,7 @@ export class EcoFabSpeedDialComponent implements OnDestroy {
221213
}
222214

223215
private processOutsideClickState(): void {
224-
if (!this.fixed() && this.open()) {
216+
if (this.open()) {
225217
this.setDocumentClickListener();
226218
} else {
227219
this.unsetDocumentClickListener();
@@ -261,9 +253,7 @@ export class EcoFabSpeedDialTriggerComponent {
261253
public readonly spin = input(false);
262254

263255
protected onClick(event: Event): void {
264-
if (!this.parent.fixed()) {
265-
this.parent.toggle();
266-
event.stopPropagation();
267-
}
256+
this.parent.toggle();
257+
event.stopPropagation();
268258
}
269259
}

src/app/app.component.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
<mat-radio-button value="right">Right</mat-radio-button>
2424
</mat-radio-group>
2525
</p>
26-
<p>
27-
<mat-slide-toggle [(ngModel)]="fixed">Fixed</mat-slide-toggle>
28-
</p>
2926
<p>
3027
<mat-slide-toggle [(ngModel)]="spin">Enable Spinning</mat-slide-toggle>
3128
</p>
@@ -40,7 +37,7 @@
4037

4138
<mat-card-content class="mat-body-1">
4239
<mat-slide-toggle [(ngModel)]="open" (click)="stopPropagation($event)">Open</mat-slide-toggle>
43-
<eco-fab-speed-dial [(open)]="open" [direction]="direction" [fixed]="fixed">
40+
<eco-fab-speed-dial [(open)]="open" [direction]="direction">
4441
<eco-fab-speed-dial-trigger [spin]="spin">
4542
<button mat-fab (click)="doAction('trigger')">
4643
<mat-icon class="spin180" fontIcon="add" />
@@ -74,7 +71,7 @@
7471
</mat-card-header>
7572

7673
<mat-card-content class="mat-body-1">
77-
<eco-fab-speed-dial #myFab [direction]="direction" [fixed]="fixed">
74+
<eco-fab-speed-dial #myFab [direction]="direction">
7875
<eco-fab-speed-dial-trigger [spin]="spin">
7976
<button mat-fab (click)="doAction('trigger')">
8077
<mat-icon class="spin360" fontIcon="check" />
@@ -94,7 +91,7 @@
9491
</eco-fab-speed-dial-actions>
9592
</eco-fab-speed-dial>
9693

97-
<eco-fab-speed-dial #myFab2 [direction]="direction" [fixed]="fixed">
94+
<eco-fab-speed-dial #myFab2 [direction]="direction">
9895
<eco-fab-speed-dial-trigger [spin]="spin">
9996
<button mat-fab (click)="doAction('trigger')">
10097
<mat-icon class="spin360" fontIcon="check" />
@@ -120,7 +117,7 @@
120117
</eco-fab-speed-dial-actions>
121118
</eco-fab-speed-dial>
122119

123-
<eco-fab-speed-dial #myFab3 [direction]="direction" [fixed]="fixed">
120+
<eco-fab-speed-dial #myFab3 [direction]="direction">
124121
<eco-fab-speed-dial-trigger [spin]="spin">
125122
<button mat-fab (click)="doAction('trigger')">
126123
<mat-icon class="spin360" fontIcon="check" />

src/app/app.component.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,10 @@ import {MatToolbarModule} from '@angular/material/toolbar';
3131
],
3232
})
3333
export class AppComponent {
34-
private _fixed = false;
35-
3634
public open = false;
3735
public spin = false;
3836
public direction: Direction = 'up';
3937

40-
public get fixed(): boolean {
41-
return this._fixed;
42-
}
43-
44-
public set fixed(fixed: boolean) {
45-
this._fixed = fixed;
46-
if (this._fixed) {
47-
this.open = true;
48-
}
49-
}
50-
5138
public stopPropagation(event: Event): void {
5239
// Prevent the click to propagate to document and trigger
5340
// the FAB to be closed automatically right before we toggle it ourselves

0 commit comments

Comments
 (0)