@smartbit4all/ng-client 6.0.39 → 6.0.41

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.
@@ -16533,6 +16533,7 @@ class SmartGridComponent {
16533
16533
  this.defaultPageSizeOptions = [5, 10, 25, 50];
16534
16534
  this.componentLibrary = ComponentLibrary;
16535
16535
  this._destroy$ = new Subject();
16536
+ this.destroyed = false;
16536
16537
  this.dev = false;
16537
16538
  this.defaultActionToolbarId = SmartGridToolbarActionsUtil.defaultActionToolbarId;
16538
16539
  this.expandedRows = {};
@@ -16590,6 +16591,7 @@ class SmartGridComponent {
16590
16591
  }
16591
16592
  }
16592
16593
  ngOnDestroy() {
16594
+ this.destroyed = true;
16593
16595
  this._destroy$.next();
16594
16596
  this._destroy$.complete();
16595
16597
  }
@@ -16597,6 +16599,11 @@ class SmartGridComponent {
16597
16599
  if (this.uuid && this.smartGrid) {
16598
16600
  this.refresh();
16599
16601
  }
16602
+ else {
16603
+ // Layout-embedded grids have no uuid of their own, but their toolbars
16604
+ // still need their real ids as soon as the view exists.
16605
+ this.setupToolbar();
16606
+ }
16600
16607
  this.afterViewInitExecuted = true;
16601
16608
  }
16602
16609
  /**
@@ -16634,19 +16641,38 @@ class SmartGridComponent {
16634
16641
  return [];
16635
16642
  }
16636
16643
  setupToolbar() {
16644
+ let idChanged = false;
16637
16645
  // check if toolbar is available _and_ need set up
16638
16646
  if (this.toolbar && this.smartGrid) {
16639
16647
  let toolbarId = this.smartGrid?.gridIdentifier + '_toolbar';
16640
16648
  if (toolbarId !== this.toolbar.id) {
16641
16649
  this.toolbar.id = toolbarId;
16650
+ idChanged = true;
16642
16651
  }
16643
16652
  }
16644
- if (this._headerToolbar && this.smartGrid) {
16653
+ // the getter resolves the header toolbar for both component libraries
16654
+ // (own ViewChild for PrimeNG, the dynamically created table's for Material)
16655
+ const headerToolbar = this.headerToolbar;
16656
+ if (headerToolbar && this.smartGrid) {
16645
16657
  let headerToolbarId = this.smartGrid?.gridIdentifier + '_headerToolbar';
16646
- if (headerToolbarId !== this._headerToolbar.id) {
16647
- this._headerToolbar.id = headerToolbarId;
16658
+ if (headerToolbarId !== headerToolbar.id) {
16659
+ headerToolbar.id = headerToolbarId;
16660
+ idChanged = true;
16648
16661
  }
16649
16662
  }
16663
+ if (idChanged) {
16664
+ // The owning SmartComponent may have distributed the ui-actions while
16665
+ // these toolbars still had their placeholder id — redistribute.
16666
+ this.notifyActionsOwner();
16667
+ }
16668
+ }
16669
+ /**
16670
+ * Asks the SmartComponent owning this grid to redistribute its ui-actions.
16671
+ * Needed whenever a toolbar id becomes real only after the actions were
16672
+ * bucketed (layout-embedded grids, dynamically rendered Material tables).
16673
+ */
16674
+ notifyActionsOwner() {
16675
+ this.smartGrid?.serviceToUse?.initActions?.();
16650
16676
  }
16651
16677
  get headerToolbar() {
16652
16678
  if (this.compLib === ComponentLibrary.PRIMENG) {
@@ -16718,6 +16744,16 @@ class SmartGridComponent {
16718
16744
  this.renderTree();
16719
16745
  }
16720
16746
  this.isBlocked = false;
16747
+ // The Material table (and its header toolbar) is created dynamically just
16748
+ // above — fix the toolbar ids and redistribute the ui-actions once its
16749
+ // bindings have been checked.
16750
+ setTimeout(() => {
16751
+ if (this.destroyed) {
16752
+ return;
16753
+ }
16754
+ this.setupToolbar();
16755
+ this.notifyActionsOwner();
16756
+ });
16721
16757
  }
16722
16758
  clearTable() {
16723
16759
  this.vcRefTable?.clear();
@@ -22454,7 +22490,7 @@ class SmartComponentLayoutComponent {
22454
22490
  const widgets = this.layoutService.render({
22455
22491
  layoutDefinitions: this.smartComponentLayout?.form,
22456
22492
  });
22457
- if (this.gridRow && !this.gridRow.valueSet) {
22493
+ if (this.gridRow && !this.gridRow.valueSets && this.parentSmartComponent?.model) {
22458
22494
  this.gridRow.valueSets = this.parentSmartComponent.model.valueSets;
22459
22495
  }
22460
22496
  this.smartForm = {