Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(GridBase): Apply spec for server-side rendering for relative gri… #15556

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions projects/igniteui-angular/src/lib/grids/grid-base.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3363,12 +3363,26 @@ export abstract class IgxGridBaseDirective implements GridType,
private get hasZeroResultFilter(): boolean {
return this.filteredData && this.filteredData.length === 0;
}
protected get totalCalcWidth() {
return this.platform.isBrowser ? this.calcWidth : undefined;
}

protected get renderData() {
// omit data if not in the browser and size is %
return !this.platform.isBrowser && this.isPercentHeight ? undefined : this.data;
}

@HostBinding('style.display')
protected displayStyle = 'grid';

@HostBinding('style.grid-template-rows')
protected templateRows = 'auto auto auto 1fr auto auto';

/**
* @hidden @internal
*/
private get hasNoData(): boolean {
return !this.data || this.dataLength === 0;
return !this.data || this.dataLength === 0 || !this.platform.isBrowser;
}

/**
Expand Down Expand Up @@ -5168,7 +5182,8 @@ export abstract class IgxGridBaseDirective implements GridType,

/** @hidden @internal */
public get totalHeight() {
return this.calcHeight ? this.calcHeight + this.pinnedRowHeight : this.calcHeight;
const height = this.calcHeight ? this.calcHeight + this.pinnedRowHeight : this.calcHeight;
return this.platform.isBrowser ? height : undefined;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<div class="igx-grid__tbody-content" tabindex="0" [attr.role]="dataView.length ? null : 'row'" (keydown)="navigation.handleNavigation($event)" (focus)="navigation.focusTbody($event)"
(dragStop)="selectionService.dragMode = $event" (scroll)="preventContainerScroll($event)"
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
[style.height.px]="totalHeight" [style.width.px]="calcWidth || null" #tbody [attr.aria-activedescendant]="activeDescendant">
[style.height.px]="totalHeight" [style.width.px]="totalCalcWidth" [style.width]="!platform.isBrowser ? '100%' : undefined" #tbody [attr.aria-activedescendant]="activeDescendant">
@if (moving && columnInDrag && pinnedColumns.length <= 0) {
<span
[igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
Expand Down Expand Up @@ -70,7 +70,7 @@
}
}
</ng-template>
<ng-template igxGridFor let-rowData [igxGridForOf]="data
<ng-template igxGridFor let-rowData [igxGridForOf]="renderData
| gridTransaction:id:pipeTrigger
| visibleColumns:hasVisibleColumns
| gridFiltering:filteringExpressionsTree:filterStrategy:advancedFilteringExpressionsTree:id:pipeTrigger:filteringPipeTrigger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="igx-grid__tbody-content" tabindex="0" (focus)="navigation.focusTbody($event)"
(keydown)="navigation.handleNavigation($event)" (dragStop)="selectionService.dragMode = $event"
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode" [attr.aria-activedescendant]="activeDescendant" [attr.role]="dataView.length ? null : 'row'"
[style.height.px]="totalHeight" [style.width.px]="calcWidth" #tbody (scroll)="preventContainerScroll($event)">
[style.height.px]="totalHeight" [style.width.px]="totalCalcWidth" [style.width]="!platform.isBrowser ? '100%' : undefined" #tbody (scroll)="preventContainerScroll($event)">
@if (moving && columnInDrag && pinnedColumns.length <= 0) {
<span
[igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
Expand Down Expand Up @@ -54,7 +54,7 @@
</ng-template>
<ng-container *ngTemplateOutlet="hasPinnedRecords && isRowPinningToTop ? pinnedRecordsTemplate : null">
</ng-container>
<ng-template igxGridFor let-rowData let-rowIndex="index" [igxGridForOf]="data
<ng-template igxGridFor let-rowData let-rowIndex="index" [igxGridForOf]="renderData
| gridTransaction:id:pipeTrigger
| visibleColumns:hasVisibleColumns
| gridFiltering:filteringExpressionsTree:filterStrategy:advancedFilteringExpressionsTree:id:pipeTrigger:filteringPipeTrigger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div class="igx-grid__tbody-content" tabindex="0" [attr.role]="dataView.length ? null : 'row'" (keydown)="navigation.handleNavigation($event)" (focus)="navigation.focusTbody($event)"
(dragStop)="selectionService.dragMode = $event" (scroll)="preventContainerScroll($event)"
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
[style.height.px]="totalHeight" [style.width.px]="pivotContentCalcWidth || null" #tbody [attr.aria-activedescendant]="activeDescendant">
[style.height.px]="totalHeight" [style.width.px]="pivotContentCalcWidth || null" [style.width]="!platform.isBrowser ? '100%' : undefined" #tbody [attr.aria-activedescendant]="activeDescendant">
@if (hasMovableColumns && columnInDrag && pinnedColumns.length <= 0) {
<span [igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
class="igx-grid__scroll-on-drag-left"></span>
Expand All @@ -31,7 +31,7 @@
<span [igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
class="igx-grid__scroll-on-drag-pinned" [style.left.px]="pinnedWidth"></span>
}
<ng-template igxGridFor let-rowData [igxGridForOf]="data
<ng-template igxGridFor let-rowData [igxGridForOf]="renderData
| pivotGridFilter:pivotConfiguration:filterStrategy:advancedFilteringExpressionsTree:filteringPipeTrigger:pipeTrigger
| pivotGridSort:pivotConfiguration:sortStrategy:pipeTrigger
| pivotGridRow:pivotConfiguration:pivotValueCloneStrategy:expansionStates:pipeTrigger:sortingExpressions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,9 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni

/** @hidden @internal */
public get pivotContentCalcWidth() {
if (!this.platform.isBrowser) {
return undefined;
}
if (!this.visibleRowDimensions.length) {
return Math.max(0, this.calcWidth - this.pivotRowWidths);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="igx-grid__tbody-content" tabindex="0" (focus)="navigation.focusTbody($event)" (keydown)="navigation.handleNavigation($event)"
(dragStop)="selectionService.dragMode = $event" [attr.aria-activedescendant]="activeDescendant" [attr.role]="dataView.length ? null : 'row'"
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
[style.height.px]='totalHeight' [style.width.px]='calcWidth' #tbody (scroll)='preventContainerScroll($event)'>
[style.height.px]='totalHeight' [style.width.px]="totalCalcWidth" [style.width]="!platform.isBrowser ? '100%' : undefined" #tbody (scroll)='preventContainerScroll($event)'>
@if (moving && columnInDrag && pinnedColumns.length <= 0) {
<span
[igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
Expand Down Expand Up @@ -56,7 +56,7 @@
}
</ng-template>
<ng-container *ngTemplateOutlet="hasPinnedRecords && isRowPinningToTop ? pinnedRecordsTemplate : null"></ng-container>
<ng-template igxGridFor let-rowData [igxGridForOf]="data
<ng-template igxGridFor let-rowData [igxGridForOf]="renderData
| treeGridTransaction:pipeTrigger
| visibleColumns:hasVisibleColumns
| treeGridHierarchizing:primaryKey:foreignKey:childDataKey:pipeTrigger
Expand Down
Loading