@smartbit4all/ng-client 3.3.180 → 3.3.181

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.
@@ -10229,7 +10229,9 @@ class SmartGridComponent {
10229
10229
  async refresh() {
10230
10230
  this.setupToolbar();
10231
10231
  // will cause this.service.gridModelChanged to fire
10232
- await this.service.load(this.uuid, this.smartGrid.gridIdentifier);
10232
+ if (this.uuid) {
10233
+ await this.service.load(this.uuid, this.smartGrid.gridIdentifier);
10234
+ }
10233
10235
  }
10234
10236
  setupToolbar() {
10235
10237
  // check if toolbar is available _and_ need set up
@@ -15167,14 +15169,18 @@ class SmartFilterEditorService {
15167
15169
  this.reSubscribeToChange = new Subject();
15168
15170
  }
15169
15171
  async load() {
15170
- this.model = await this.service.load(this.config.uuid, this.config.identifier).toPromise();
15171
- this.modelChanged.next();
15172
+ if (this.config.uuid) {
15173
+ this.model = await this.service.load(this.config.uuid, this.config.identifier).toPromise();
15174
+ this.modelChanged.next();
15175
+ }
15172
15176
  }
15173
15177
  async peformWidgetAction(request) {
15174
- this.model = await this.service
15175
- .performWidgetAction(this.config.uuid, this.config.identifier, request)
15176
- .toPromise();
15177
- this.modelChanged.next();
15178
+ if (this.config.uuid) {
15179
+ this.model = await this.service
15180
+ .performWidgetAction(this.config.uuid, this.config.identifier, request)
15181
+ .toPromise();
15182
+ this.modelChanged.next();
15183
+ }
15178
15184
  }
15179
15185
  getModel() {
15180
15186
  return this.model;
@@ -15208,7 +15214,7 @@ class SmartComponentApiClient {
15208
15214
  this.renderer = renderer;
15209
15215
  this._destroy$ = new Subject();
15210
15216
  this.detectChange = new SmartSubject(this._destroy$);
15211
- this._ngAfterViewInitPerformed = false;
15217
+ this.componentModelLoaded = false;
15212
15218
  this.uiActionModels = [];
15213
15219
  this.dataChanged = new SmartSubject(this._destroy$);
15214
15220
  // Contained Widgets
@@ -15252,29 +15258,29 @@ class SmartComponentApiClient {
15252
15258
  firstUuid = false;
15253
15259
  }
15254
15260
  this._uuid = uuid;
15255
- if (uuid) {
15256
- this.getWidgets().forEach((ref, key) => {
15257
- if (ref instanceof SmartGridComponent) {
15258
- ref.uuid = uuid;
15259
- }
15260
- else if (ref instanceof SmartFilterEditorService) {
15261
- ref.config.uuid = uuid;
15262
- }
15263
- else if (!ref && !firstUuid) {
15264
- console.error(`Provided reference for ${key} is undefined on uuid change.`);
15261
+ this.getWidgets().forEach((ref, key) => {
15262
+ if (ref instanceof SmartGridComponent) {
15263
+ ref.uuid = this.componentModelLoaded ? uuid : undefined;
15264
+ }
15265
+ else if (ref instanceof SmartFilterEditorService) {
15266
+ ref.config.uuid = this.componentModelLoaded ? uuid : undefined;
15267
+ }
15268
+ else if (!ref && !firstUuid) {
15269
+ console.error(`Provided reference for ${key} is undefined on uuid change.`);
15270
+ }
15271
+ });
15272
+ if (!this.uuidOfPageHasBeenChangedSubscription) {
15273
+ this.uuidOfPageHasBeenChangedSubscription = this.viewContext.uuidOfPageHasBeenChanged
15274
+ .pipe(takeUntil(this._destroy$))
15275
+ .subscribe((pageName) => {
15276
+ if (pageName === this.pageName) {
15277
+ this.run();
15265
15278
  }
15266
15279
  });
15267
- if (!this.uuidOfPageHasBeenChangedSubscription) {
15268
- this.uuidOfPageHasBeenChangedSubscription = this.viewContext.uuidOfPageHasBeenChanged
15269
- .pipe(takeUntil(this._destroy$))
15270
- .subscribe((pageName) => {
15271
- if (pageName === this.pageName) {
15272
- this.run();
15273
- }
15274
- });
15275
- }
15276
15280
  }
15277
- this.viewContext.follow(this._uuid, this.detectChange);
15281
+ if (uuid) {
15282
+ this.viewContext.follow(this._uuid, this.detectChange);
15283
+ }
15278
15284
  }
15279
15285
  get model() {
15280
15286
  return this._model;
@@ -15505,9 +15511,15 @@ class SmartComponentApiClient {
15505
15511
  }
15506
15512
  }
15507
15513
  async load() {
15514
+ this.componentModelLoaded = false;
15508
15515
  this.uuid = this.viewContext.getUuidOfPage(this.pageName);
15509
15516
  // this.model = await this.viewContext.load(this.uuid);
15510
- await this.viewContext.load2(this.uuid);
15517
+ const change = await this.viewContext.load2(this.uuid);
15518
+ this.componentModelLoaded = true;
15519
+ this.model = change.result;
15520
+ if (this.model.widgets) {
15521
+ this.handleChangeWidgets(this.model.widgets);
15522
+ }
15511
15523
  }
15512
15524
  async executeUiAction(uiAction, options) {
15513
15525
  this.uiActionService.uiActionModel = {
@@ -15750,6 +15762,10 @@ class SmartComponentApiClient {
15750
15762
  }
15751
15763
  handleChanges(change) {
15752
15764
  try {
15765
+ if (!this.componentModelLoaded) {
15766
+ // initial load
15767
+ return;
15768
+ }
15753
15769
  if (change.changedWidgets) {
15754
15770
  this.handleChangeWidgets(change.changedWidgets);
15755
15771
  }