@datorama/core 22.5.5 → 22.6.2

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.
@@ -10637,11 +10637,19 @@ function deepmerge(target, source, optionsArgument = { arrayMerge: useDestinatio
10637
10637
  * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
10638
10638
  */
10639
10639
  let DatoGridV2NoDataOverlayComponent = class DatoGridV2NoDataOverlayComponent {
10640
- constructor(gridQuery, gridService) {
10640
+ constructor(gridQuery, gridService, element) {
10641
10641
  this.gridQuery = gridQuery;
10642
10642
  this.gridService = gridService;
10643
+ this.element = element;
10643
10644
  this.config = {};
10644
10645
  }
10646
+ get showImage() {
10647
+ const elParent = this.element.nativeElement.parentElement;
10648
+ if (elParent.classList.contains('ag-overlay-wrapper')) {
10649
+ return elParent.offsetHeight >= 390;
10650
+ }
10651
+ return true;
10652
+ }
10645
10653
  ngOnInit() {
10646
10654
  this.filterActive$ = this.gridQuery.filterActive$;
10647
10655
  this.hasError$ = this.gridQuery.isServerSide ? this.gridQuery.serverSideError$ : of(false);
@@ -10674,7 +10682,8 @@ let DatoGridV2NoDataOverlayComponent = class DatoGridV2NoDataOverlayComponent {
10674
10682
  };
10675
10683
  DatoGridV2NoDataOverlayComponent.ctorParameters = () => [
10676
10684
  { type: GridQuery },
10677
- { type: GridService }
10685
+ { type: GridService },
10686
+ { type: ElementRef }
10678
10687
  ];
10679
10688
  __decorate([
10680
10689
  Input(),
@@ -10683,11 +10692,11 @@ __decorate([
10683
10692
  DatoGridV2NoDataOverlayComponent = __decorate([
10684
10693
  Component({
10685
10694
  selector: 'dato-grid-v2-no-data-overlay',
10686
- template: "<div class=\"container d-flex-column align-center\">\n <ng-container *ngIf=\"(hasError$ | async) === false; else error\">\n <ng-container *ngIf=\"(filterActive$ | async) === true; else noData\">\n <ng-container *ngTemplateOutlet=\"imgNText; context: {$implicit: mergedConfig.noResult }\"></ng-container>\n <div class=\"d-flex items-center\">\n <div class=\"dato-simple primary-400-color\">{{'core.try-to-adjust-or' | translate}}&nbsp;</div>\n <dato-link (click)=\"clearFilters()\">{{ 'core.clear-filters' | translate }}</dato-link>\n </div>\n </ng-container>\n <ng-template #noData>\n <ng-container *ngTemplateOutlet=\"imgNText; context: {$implicit: mergedConfig.noData}\"></ng-container>\n <ng-content select=\"[no-data-content]\"></ng-content>\n </ng-template>\n\n </ng-container>\n <ng-template #error>\n <ng-container *ngTemplateOutlet=\"imgNText; context: {$implicit: mergedConfig.serverSideError}\"></ng-container>\n <div #errorContent><ng-content select=\"[server-error-content]\"></ng-content></div>\n <div class=\"dato-simple primary-400-color\" *ngIf=\"errorContent.children.length === 0\">{{'core.try-to-refresh-or-contact' | translate}}&nbsp;</div>\n </ng-template>\n</div>\n\n<ng-template #imgNText let-view>\n <img class=\"mb-30\" [datoStaticSrc]=\"view.icon\">\n <div class=\"dato-simple-bold primary-500-color mb-3\">{{ view.text | translate }}</div>\n</ng-template>\n",
10695
+ template: "<div class=\"container d-flex-column align-center\">\n <ng-container *ngIf=\"(hasError$ | async) === false; else error\">\n <ng-container *ngIf=\"(filterActive$ | async) === true; else noData\">\n <ng-container *ngTemplateOutlet=\"imgNText; context: {$implicit: mergedConfig.noResult }\"></ng-container>\n <div class=\"d-flex items-center\">\n <div class=\"dato-simple primary-400-color\">{{'core.try-to-adjust-or' | translate}}&nbsp;</div>\n <dato-link (click)=\"clearFilters()\">{{ 'core.clear-filters' | translate }}</dato-link>\n </div>\n </ng-container>\n <ng-template #noData>\n <ng-container *ngTemplateOutlet=\"imgNText; context: {$implicit: mergedConfig.noData}\"></ng-container>\n <ng-content select=\"[no-data-content]\"></ng-content>\n </ng-template>\n\n </ng-container>\n <ng-template #error>\n <ng-container *ngTemplateOutlet=\"imgNText; context: {$implicit: mergedConfig.serverSideError}\"></ng-container>\n <div #errorContent><ng-content select=\"[server-error-content]\"></ng-content></div>\n <div class=\"dato-simple primary-400-color\" *ngIf=\"errorContent.children.length === 0\">{{'core.try-to-refresh-or-contact' | translate}}&nbsp;</div>\n </ng-template>\n</div>\n\n<ng-template #imgNText let-view>\n <img class=\"mb-30\" [datoStaticSrc]=\"view.icon\" *ngIf=\"showImage && view.icon\">\n <div class=\"dato-simple-bold primary-500-color mb-3\">{{ view.text | translate }}</div>\n</ng-template>\n",
10687
10696
  changeDetection: ChangeDetectionStrategy.OnPush,
10688
10697
  styles: [":host{pointer-events:all}"]
10689
10698
  }),
10690
- __metadata("design:paramtypes", [GridQuery, GridService])
10699
+ __metadata("design:paramtypes", [GridQuery, GridService, ElementRef])
10691
10700
  ], DatoGridV2NoDataOverlayComponent);
10692
10701
 
10693
10702
  /**
@@ -12713,15 +12722,30 @@ let GridService = class GridService {
12713
12722
  }
12714
12723
  setGridSort(gridSort) {
12715
12724
  if (this.api && gridSort) {
12716
- const { sort, sortIndex } = gridSort;
12725
+ const { sort, sortIndex, colId } = gridSort;
12717
12726
  if (!isNil(sortIndex)) {
12718
- const columns = this.api.columns.getAllGridColumns();
12719
- if (columns) {
12720
- const column = columns[sortIndex];
12721
- if (column) {
12722
- const sortToApply = { colId: column.getColId(), sort };
12723
- this.updateSettings({ sort: sortToApply });
12724
- this.api.grid.setSortModel([sortToApply]);
12727
+ const gridColumns = this.api.columns.getAllGridColumns();
12728
+ if (gridColumns) {
12729
+ const primaryColumns = this.api.columns.getPrimaryColumns();
12730
+ const primaryColumn = primaryColumns.find(col => col.getColId() === colId);
12731
+ if (primaryColumn) {
12732
+ /** Column is no pivot value column */
12733
+ const columnById = gridColumns.find((col) => {
12734
+ return col.getColDef().showRowGroup || col.getColId() === colId;
12735
+ });
12736
+ if (columnById) {
12737
+ const sortToApply = { colId: columnById.getColId(), sort };
12738
+ this.updateSettings({ sort: sortToApply });
12739
+ this.api.grid.setSortModel([sortToApply]);
12740
+ }
12741
+ }
12742
+ else {
12743
+ const columnByIndex = gridColumns[sortIndex];
12744
+ if (columnByIndex) {
12745
+ const sortToApply = { colId: columnByIndex.getColId(), sort };
12746
+ this.updateSettings({ sort: sortToApply });
12747
+ this.api.grid.setSortModel([sortToApply]);
12748
+ }
12725
12749
  }
12726
12750
  }
12727
12751
  }
@@ -22670,7 +22694,7 @@ function fixNgLeaks() {
22670
22694
  };
22671
22695
  }
22672
22696
 
22673
- window.coreVersion = '22.5.5';
22697
+ window.coreVersion = '22.6.2';
22674
22698
 
22675
22699
  /**
22676
22700
  * @license