Skip to content

17.0.0-beta.8 (@scion/workbench)

Compare
Choose a tag to compare
@github-actions github-actions released this 07 May 10:20
· 8 commits to master since this release

17.0.0-beta.8 (2024-05-07)

Bug Fixes

  • workbench/view: fix issues to prevent a view from closing (a280af9), closes #27 #344
  • workbench/view: update view properties when navigating an open view (02a24ff)

Code Refactoring

  • workbench/router: remove blank prefix from navigation extras (446fa51)
  • workbench/router: remove option to close view via workbench router link (88d1704)

Dependencies

  • workbench: require Angular version 17.0.6 or later to fix angular/angular#53239 (dd78d07)

Features

  • workbench/router: control workbench part to navigate views (0bf35a7)
  • workbench/router: provide API to modify the workbench layout (46ea446)
  • workbench/router: support navigation to children of the empty path route (da578a9), closes #487
  • workbench: provide function to set up the SCION Workbench (1a506ef)
  • workbench: support navigation of views in the initial layout (or perspective) (1ffd757), closes #445

BREAKING CHANGES

  • workbench/view: Interface and method for preventing closing of a view have changed.

    To migrate, implement the CanClose instead of the WorkbenchViewPreDestroy interface.

    Before migration:

    class YourComponent implements WorkbenchViewPreDestroy {
      public async onWorkbenchViewPreDestroy(): Promise<boolean> {
        // return `true` to close the view, otherwise `false`.
      }
    }

    After migration:

    class YourComponent implements CanClose {
      public async canClose(): Promise<boolean> {
        // return `true` to close the view, otherwise `false`.
      }
    }
  • workbench/router: Property blankInsertionIndex in WorkbenchNavigationExtras has been renamed.

    To migrate, update to the latest version of @scion/workbench-client and use WorkbenchNavigationExtras.position instead of WorkbenchNavigationExtras.blankInsertionIndex.

  • workbench/router: Property blankPartId in WorkbenchNavigationExtras has been renamed.

    To migrate, use WorkbenchNavigationExtras.partId instead of WorkbenchNavigationExtras.blankPartId.

  • workbench: Views in the initial layout (or perspective) must now be navigated.

    Previously, no explicit navigation was required because views and routes were coupled via route outlet and view id.

    Migrate the layout as follows:

    Explicitly navigate views, passing an empty array of commands and the view id as navigation hint.

    // Before Migration
    provideWorkbench({
      layout: (factory: WorkbenchLayoutFactory) => factory
        .addPart(MAIN_AREA)
        .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
        .addView('navigator', {partId: 'left', activateView: true}),
    });
    
    // After Migration
    provideWorkbench({
      layout: (factory: WorkbenchLayoutFactory) => factory
        .addPart(MAIN_AREA)
        .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
        .addView('navigator', {partId: 'left', activateView: true})
        // Navigate view, passing hint to match route.
        .navigateView('navigator', [], {hint: 'navigator'}),
    });

    Migrate the routes as follows:

    • Remove the outlet property;
    • Add canMatchWorkbenchView guard and initialize it with the hint passed to the navigation;
    // Before Migration
    provideRouter([
      {
        path: '',
        outlet: 'navigator',
        loadComponent: () => ...,
      },
    ]);
    
    // After Migration
    provideRouter([
      {
        path: '',
        // Match route only if navigated with specified hint.
        canMatch: [canMatchWorkbenchView('navigator')],
        loadComponent: () => ...,
      },
    ]);
  • workbench: Changed type of view id from string to ViewId.

    If storing the view id in a variable, change its type from string to ViewId.

  • workbench/router: Removed the option to close a view via the wbRouterLink directive.

    The router link can no longer be used to close a view. To close a view, use the WorkbenchView, the WorkbenchRouter, or the WorkbenchService instead.

    Examples:

    // Closing a view via `WorkbenchView` handle
    inject(WorkbenchView).close();
    
    // Closing view(s) via `WorkbenchRouter`
    inject(WorkbenchRouter).navigate(['path/*/view'], {close: true});
    
    // Closing view(s) via `WorkbenchService`
    inject(WorkbenchService).closeViews('view.1', 'view.2');
  • workbench: SCION Workbench requires Angular version 17.0.6 or later to fix angular/angular#53239