@smartbit4all/ng-client 3.0.12 → 3.0.13

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.
@@ -10338,12 +10338,12 @@ class SmartGridService extends SmartdialogService {
10338
10338
  this.gridModelChanged.next();
10339
10339
  }
10340
10340
  updateGrid(gridModel, method) {
10341
- this.gridModel = gridModel;
10342
10341
  if (gridModel) {
10342
+ this.gridModel = gridModel;
10343
10343
  this.gridModelChanged.next();
10344
10344
  }
10345
10345
  else {
10346
- console.warn(`GridModel is undefined in service after ${method}!`);
10346
+ console.error(`GridModel is undefined in service after ${method}!`);
10347
10347
  }
10348
10348
  }
10349
10349
  }
@@ -10951,9 +10951,7 @@ class SmartGridComponent {
10951
10951
  this.isBlocked = true;
10952
10952
  this.service.gridModelChanged.subscribe(() => {
10953
10953
  // called after every service call (load, save, refresh, etc.)
10954
- if (this.service.gridModel) {
10955
- this.smartGrid.gridModel = this.service.gridModel;
10956
- }
10954
+ this.smartGrid.gridModel = this.service.gridModel;
10957
10955
  this.render();
10958
10956
  });
10959
10957
  }
@@ -10965,29 +10963,7 @@ class SmartGridComponent {
10965
10963
  this.uuid = changes['uuid'].currentValue;
10966
10964
  }
10967
10965
  if (this.afterViewInitExecuted && this.uuid && this.smartGrid) {
10968
- if (changes['smartGrid']) {
10969
- let prev = changes['smartGrid'].previousValue;
10970
- let curr = changes['smartGrid'].currentValue;
10971
- if (!prev.pageLoaded && curr.pageLoaded) {
10972
- if (!this.service.gridModel) {
10973
- // page just loaded, gridModel was empty
10974
- this.refresh();
10975
- } // otherwise gridModel already loaded
10976
- }
10977
- else if (prev.pageLoaded && !curr.pageLoaded) {
10978
- // page change in progress
10979
- // TODO a bit awkard to clear service.model from here..
10980
- this.service.gridModel = undefined;
10981
- // TODO call render to show grid placeholder?
10982
- }
10983
- else {
10984
- // something else changed in smartGrid -> refresh
10985
- this.refresh();
10986
- }
10987
- }
10988
- else {
10989
- this.refresh();
10990
- }
10966
+ this.refresh();
10991
10967
  }
10992
10968
  }
10993
10969
  ngOnDestroy() {
@@ -11000,7 +10976,7 @@ class SmartGridComponent {
11000
10976
  this.service.gridModel = this.smartGrid.gridModel;
11001
10977
  this.render();
11002
10978
  }
11003
- else if (this.uuid && this.smartGrid && !this.service.gridModel) {
10979
+ if (this.uuid && this.smartGrid && !this.dev) {
11004
10980
  this.refresh();
11005
10981
  }
11006
10982
  this.afterViewInitExecuted = true;
@@ -11106,13 +11082,15 @@ class SmartGridComponent {
11106
11082
  if (tableConfig.asyncOnExpand) {
11107
11083
  tableConfig.rowExpander = this;
11108
11084
  }
11109
- const selectionMode = this.smartGrid.gridModel.view?.descriptor?.selectionMode;
11085
+ const selectionMode = this.service.gridModel.view?.descriptor?.selectionMode;
11110
11086
  if (!tableConfig.selection &&
11111
11087
  !tableConfig.selectionProperty &&
11112
11088
  selectionMode !== GridSelectionMode.None) {
11113
11089
  const isMultiple = selectionMode === GridSelectionMode.Multiple;
11114
11090
  tableConfig.selectionProperty = 'id';
11115
- const selectedIds = this.smartGrid.gridModel.page.rows.filter((gridRow) => gridRow.selected).map((gridRow) => gridRow.id);
11091
+ const selectedIds = this.service.gridModel.page
11092
+ .rows.filter((gridRow) => gridRow.selected)
11093
+ .map((gridRow) => gridRow.id);
11116
11094
  tableConfig.selection = new SelectionModel(isMultiple, selectedIds);
11117
11095
  }
11118
11096
  this.smartTable = new SmartTable(tableConfig);
@@ -11219,8 +11197,8 @@ class SmartGridComponent {
11219
11197
  filterExpressionOrderByItem.order === FilterExpressionOrderBy.OrderEnum.Asc
11220
11198
  ? SmartTableOrder.ASC
11221
11199
  : SmartTableOrder.DESC;
11222
- if (this.smartGrid.gridModel.view.orderByList.length > 1) {
11223
- orderNumber = this.smartGrid.gridModel.view.orderByList.findIndex((filter) => filter.propertyName === descColumn.propertyName);
11200
+ if (this.service.gridModel.view.orderByList.length > 1) {
11201
+ orderNumber = this.service.gridModel.view.orderByList.findIndex((filter) => filter.propertyName === descColumn.propertyName);
11224
11202
  orderNumber++;
11225
11203
  }
11226
11204
  }
@@ -11362,12 +11340,10 @@ class SmartGridComponent {
11362
11340
  }
11363
11341
  async onSelect(rowId) {
11364
11342
  this.isBlocked = true;
11365
- if (this.service.gridModel) {
11366
- const row = this.service.gridModel.page.rows?.find((gridRow) => gridRow.id === rowId);
11367
- const viewContextChange = await this.service.select(this.smartGrid, row);
11368
- this.smartGrid.viewContextService.handleChanges(viewContextChange.changes);
11369
- this.refresh();
11370
- }
11343
+ const row = this.service.gridModel.page.rows?.find((gridRow) => gridRow.id === rowId);
11344
+ const viewContextChange = await this.service.select(this.smartGrid, row);
11345
+ this.smartGrid.viewContextService.handleChanges(viewContextChange.changes);
11346
+ this.refresh();
11371
11347
  }
11372
11348
  async onSelectAll(selected) {
11373
11349
  this.isBlocked = true;
@@ -11386,7 +11362,7 @@ class SmartGridComponent {
11386
11362
  config: {
11387
11363
  uuid: this.uuid,
11388
11364
  identifier: this.smartGrid.gridIdentifier,
11389
- view: this.smartGrid.gridModel.view,
11365
+ view: this.service.gridModel.view,
11390
11366
  },
11391
11367
  },
11392
11368
  };
@@ -12362,7 +12338,6 @@ let SmartComponentApiClient = class SmartComponentApiClient {
12362
12338
  this.dataChanged = new SmartSubject(this._destroy$);
12363
12339
  // Contained Widgets
12364
12340
  this.widgets = new WidgetMap();
12365
- this.smartGrids = new WidgetMap();
12366
12341
  this.formWidgets = new WidgetMap();
12367
12342
  this.detectChange.subscribe((change) => {
12368
12343
  this.handleChanges(change);
@@ -12383,10 +12358,6 @@ let SmartComponentApiClient = class SmartComponentApiClient {
12383
12358
  this._uuid = uuid;
12384
12359
  if (uuid) {
12385
12360
  this.widgets.widgets.forEach((ref, key) => {
12386
- let smartGrid = this.smartGrids.get(key);
12387
- if (smartGrid) {
12388
- smartGrid.pageLoaded = false;
12389
- }
12390
12361
  if (ref instanceof SmartGridComponent) {
12391
12362
  ref.uuid = uuid;
12392
12363
  }
@@ -12435,8 +12406,6 @@ let SmartComponentApiClient = class SmartComponentApiClient {
12435
12406
  _ngOnDestroy() {
12436
12407
  this.viewContext.unfollow(this.uuid);
12437
12408
  this.widgets.clearWidgets();
12438
- this.smartGrids.clearWidgets();
12439
- this.formWidgets.clearWidgets();
12440
12409
  this._destroy$.next();
12441
12410
  this._destroy$.complete();
12442
12411
  }
@@ -12444,9 +12413,6 @@ let SmartComponentApiClient = class SmartComponentApiClient {
12444
12413
  this.initData();
12445
12414
  this.initActions();
12446
12415
  // TODO: layout, valueSet, widgets
12447
- this.smartGrids.widgets.forEach((smartGrid) => {
12448
- smartGrid.pageLoaded = true;
12449
- });
12450
12416
  }
12451
12417
  initData() {
12452
12418
  if (this.model?.data) {
@@ -12535,7 +12501,6 @@ let SmartComponentApiClient = class SmartComponentApiClient {
12535
12501
  smartGrid.serviceToUse = this;
12536
12502
  smartGrid.viewContextService = this.viewContext;
12537
12503
  this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
12538
- this.smartGrids.addWidget(smartGrid.gridIdentifier, smartGrid);
12539
12504
  if (useAsDefaultGrid) {
12540
12505
  this.smartGrid = smartGrid;
12541
12506
  return this.smartGrid;