@smartbit4all/ng-client 7.3.22 → 7.3.24

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.
@@ -16629,6 +16629,10 @@ class SmarttreeService {
16629
16629
  syncTree() {
16630
16630
  throw new Error('syncTree method not implemented.');
16631
16631
  }
16632
+ /** Whether the tree was downloaded for another view than the one its page shows now. */
16633
+ isDownloadedForAnotherView() {
16634
+ return false;
16635
+ }
16632
16636
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SmarttreeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
16633
16637
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SmarttreeService, providedIn: 'root' }); }
16634
16638
  }
@@ -16704,9 +16708,15 @@ class SmartTreeComponent {
16704
16708
  // The backend knows this widget by its treeId, which is set when the service is created —
16705
16709
  // not by smartTreeModel.identifier, which only exists after the first successful
16706
16710
  // syncTree, so a tree that has not finished downloading would be unreachable. (#28361)
16711
+ const treeService = this.treeService;
16707
16712
  registerSmartWidget(injectSmartComponent(), {
16708
16713
  identifier: () => this.treeService()?.treeId,
16709
16714
  reload: () => this.treeService().initialize(),
16715
+ // A page opened again keeps this component under a new view uuid, and the server's tree
16716
+ // state of the new view knows none of the node identifiers downloaded for the old one.
16717
+ get reloadDuringInitialSync() {
16718
+ return treeService()?.isDownloadedForAnotherView() ?? false;
16719
+ },
16710
16720
  });
16711
16721
  }
16712
16722
  ngOnInit() {
@@ -18242,6 +18252,10 @@ class SmarttreeGenericService extends SmarttreeService {
18242
18252
  }
18243
18253
  async initialize() {
18244
18254
  if (this.viewContext.hasViewContextUuid()) {
18255
+ if (this.isDownloadedForAnotherView()) {
18256
+ // The selection is a node of the other view's tree, unknown to this view's tree state.
18257
+ this.selectedNode = undefined;
18258
+ }
18245
18259
  await this.downloadTree().then((rootNodes) => {
18246
18260
  if (!deepEqual(this.treeFromBackend, rootNodes)) {
18247
18261
  this.treeFromBackend = rootNodes;
@@ -18257,7 +18271,11 @@ class SmarttreeGenericService extends SmarttreeService {
18257
18271
  if (uiActions) {
18258
18272
  this.constructUiActionModels(uiActions);
18259
18273
  }
18260
- if (!rootNodes) {
18274
+ if (rootNodes) {
18275
+ // Recorded only for a received tree, so that a download without one is repeated.
18276
+ this.downloadedViewUuid = uuid;
18277
+ }
18278
+ else {
18261
18279
  console.error('RootNodes are undefined!');
18262
18280
  }
18263
18281
  return rootNodes ?? [];
@@ -18306,6 +18324,10 @@ class SmarttreeGenericService extends SmarttreeService {
18306
18324
  this.syncTree();
18307
18325
  //this.viewContext.getAndSyncViewContext(this.viewContext.getViewContextUuid());
18308
18326
  }
18327
+ isDownloadedForAnotherView() {
18328
+ return (this.downloadedViewUuid !== undefined &&
18329
+ this.downloadedViewUuid !== this.viewContext.getUuidOfPage(this.pageName));
18330
+ }
18309
18331
  async updateTreeOnTheFly() {
18310
18332
  await this.initialize();
18311
18333
  }
@@ -18809,7 +18831,10 @@ class SmartComponentApiClient {
18809
18831
  this.uiActionDescriptorService = inject.get(UiActionDescriptorService);
18810
18832
  // After the slot is claimed above, so the execution finds this client as its component.
18811
18833
  this.execution = runInInjectionContext(inject, injectUiActionExecution);
18812
- this.keybindingHost = (inject.get(ElementRef, null) ?? element)?.nativeElement;
18834
+ // Hosts rarely pass these to super(), and the backend style of the view needs them.
18835
+ this.element ??= inject.get(ElementRef, null) ?? undefined;
18836
+ this.renderer ??= inject.get(Renderer2, null) ?? undefined;
18837
+ this.keybindingHost = this.element?.nativeElement;
18813
18838
  }
18814
18839
  _ngOnInit() {
18815
18840
  this.run();