|
1 |
| -# [18.0.0-beta.8](https://github.com/SchweizerischeBundesbahnen/scion-workbench/compare/18.0.0-beta.7...18.0.0-beta.8) (2024-10-28) |
| 1 | +# [18.0.0-beta.9](https://github.com/SchweizerischeBundesbahnen/scion-workbench/compare/18.0.0-beta.8...18.0.0-beta.9) (2024-11-25) |
2 | 2 |
|
3 | 3 |
|
4 | 4 | ### Bug Fixes
|
5 | 5 |
|
6 |
| -* **workbench/popup:** ensure the popup anchor not leaving view boundaries ([c629f49](https://github.com/SchweizerischeBundesbahnen/scion-workbench/commit/c629f49f3ba520c2cd700a008e4ed0af1c86e01f)) |
7 |
| -* **workbench/view:** ensure view overlays align with view boundaries when view position changes ([2998295](https://github.com/SchweizerischeBundesbahnen/scion-workbench/commit/29982951bf8290108d3b09104ebc456f3acb9f6c)) |
| 6 | +* **workbench/view:** invoke `CanClose` guard in view injection context ([07ba936](https://github.com/SchweizerischeBundesbahnen/scion-workbench/commit/07ba93604ec6862936a11badf6957d8582a0b687)), closes [#578](https://github.com/SchweizerischeBundesbahnen/scion-workbench/issues/578) |
| 7 | +* **workbench/view:** prevent `CanClose` guard from blocking workbench navigation ([12e9e91](https://github.com/SchweizerischeBundesbahnen/scion-workbench/commit/12e9e9140cf8db11c8fc188f463503ccaaf35195)), closes [#558](https://github.com/SchweizerischeBundesbahnen/scion-workbench/issues/558) |
| 8 | +* **workbench/view:** prevent closing views with a pending `CanClose` guard ([4326a63](https://github.com/SchweizerischeBundesbahnen/scion-workbench/commit/4326a63665ac8a40bfb040250f9a66c582aed7c6)) |
8 | 9 |
|
9 | 10 |
|
10 | 11 | ### Features
|
11 | 12 |
|
12 |
| -* **workbench:** prevent tracking unwanted dependencies in effects ([7a7eaf8](https://github.com/SchweizerischeBundesbahnen/scion-workbench/commit/7a7eaf847f3ed54dcc7eeab300cbde53700b8e46)) |
| 13 | +* **workbench/view:** add functional `CanClose` guard, deprecate class-based guard ([c2ee531](https://github.com/SchweizerischeBundesbahnen/scion-workbench/commit/c2ee531d483dbdbff72d468592908bb346002278)) |
13 | 14 |
|
14 | 15 |
|
15 |
| -### BREAKING CHANGES |
| 16 | +### Deprecations |
16 | 17 |
|
17 |
| -* **workbench:** SCION Workbench requires `@scion/toolkit` version `1.6.0` or later. |
18 |
| -* **workbench:** SCION Workbench requires `@scion/components` version `18.1.1` or later. |
19 |
| -* **workbench:** Calling following workbench methods in a reactive (tracking) context (e.g., `effect`) now throws an error. Migrate by using Angular's `untracked()` function. |
20 |
| - - `WorkbenchRouter.navigate` |
21 |
| - - `WorkbenchService.registerPerspective` |
22 |
| - - `WorkbenchService.switchPerspective` |
23 |
| - - `WorkbenchService.resetPerspective` |
24 |
| - - `WorkbenchService.closeViews` |
25 |
| - - `WorkbenchService.switchTheme` |
26 |
| - - `WorkbenchService.registerPartAction` |
27 |
| - - `WorkbenchService.registerViewMenuItem` |
28 |
| - - `WorkbenchLauncher.launch` |
29 |
| - - `WorkbenchDialogService.open` |
30 |
| - - `WorkbenchMessageBoxService.open` |
31 |
| - - `NotificationService.notify` |
32 |
| - - `PopupService.open` |
33 |
| - - `WorkbenchPart.activate` |
34 |
| - - `WorkbenchView.activate` |
35 |
| - - `WorkbenchView.close` |
36 |
| - - `WorkbenchView.move` |
37 |
| - - `WorkbenchView.registerMenuItem` |
38 |
| - - `WorkbenchDialog.close` |
39 |
| - - `Popup.close` |
40 |
| - |
41 |
| - **Migration Example** |
| 18 | +* **workbench/view:** The class-based `CanClose` guard has been deprecated in favor of a functional guard that can be registered on `WorkbenchView.canClose`. |
| 19 | + |
| 20 | + Migrate by registering a callback on `WorkbenchView.canClose` instead of implementing the `CanClose` interface. |
| 21 | + |
| 22 | + **Before migration:** |
42 | 23 | ```ts
|
43 |
| - import {effect, inject, untracked} from '@angular/core'; |
44 |
| - import {WorkbenchRouter} from '@scion/workbench'; |
| 24 | + import {CanClose} from '@scion/workbench'; |
| 25 | + import {Component} from '@angular/core'; |
45 | 26 |
|
46 |
| - const workbenchRouter = inject(WorkbenchRouter); |
| 27 | + @Component({}) |
| 28 | + export class ViewComponent implements CanClose { |
47 | 29 |
|
48 |
| - // Before |
49 |
| - effect(() => { |
50 |
| - if (someSignal()) { |
51 |
| - workbenchRouter.navigate(['path/to/view']); |
| 30 | + public canClose(): boolean { |
| 31 | + return true; |
52 | 32 | }
|
53 |
| - }); |
| 33 | + } |
| 34 | + ``` |
| 35 | + |
| 36 | + **After migration:** |
| 37 | + ```ts |
| 38 | + import {Component, inject} from '@angular/core'; |
| 39 | + import {WorkbenchView} from '@scion/workbench'; |
| 40 | + |
| 41 | + @Component({}) |
| 42 | + export class ViewComponent { |
54 | 43 |
|
55 |
| - // After |
56 |
| - effect(() => { |
57 |
| - if (someSignal()) { |
58 |
| - untracked(() => workbenchRouter.navigate(['path/to/view'])); |
| 44 | + constructor() { |
| 45 | + inject(WorkbenchView).canClose(() => { |
| 46 | + return true; |
| 47 | + }); |
59 | 48 | }
|
60 |
| - }); |
| 49 | + } |
61 | 50 | ```
|
62 |
| - |
63 |
| - |
64 |
| - |
0 commit comments