Skip to content

Commit d4edaa0

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Merge from master.
2 parents 5658c5b + 064a961 commit d4edaa0

29 files changed

+2883
-1163
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ master, 9.1.x ]
8+
branches: [ master, 9.1.x, 10.0.x ]
99
pull_request:
10-
branches: [ master, 9.1.x ]
10+
branches: [ master, 9.1.x, 10.0.x ]
1111

1212
jobs:
1313
build:

CHANGELOG.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,26 @@ All notable changes for each version of this project will be documented in this
55
## 10.1.0
66

77
### General
8+
- `igxCombo`
9+
- **Behavioral Change** - Change default positioning strategy from `ConnectedPositioningStrategy` to `AutoPositionStrategy`. The [`Auto`](https://www.infragistics.com/products/ignite-ui-angular/angular/components/overlay_position.html#auto) strategy will initially try to show the element like the Connected strategy does. If the element goes out of the viewport Auto will flip the starting point and the direction, i.e. if the direction is 'bottom', it will switch it to 'top' and so on. If after flipping direction the content goes out of the view, auto strategy will revert to initial start point and direction and will push the content into the view. Note after pushing the content it may hide the combo's input.
810
- `igxGrid`
911
- Added `onScroll` event, which is emitted when the grid is scrolled vertically or horizontally.
1012
- `igxTreeGrid`
1113
- Removed `onDataPreLoad` event as it is specific for remote virtualization implementation, which is not supported for the `igxTreeGrid`. A more generic `onScroll` event is exposed and can be used instead.
1214

15+
### New Features
16+
- `IgxGridState` directive
17+
- Added support for expansion states, column selection and row pinning.
18+
- Added support for `IgxTreeGrid` and `IgxHierarchicalGrid` (including child grids)
19+
- `IgxColumn`
20+
- Added `byHeader` parameter to the `autosize` method which specifies if the autosizing should be based only on the header content width.
21+
- `IgxToast`
22+
- `message` property has been deprecated. You can place the *message text* in the toast content or pass it as parameter to `show` method instead.
23+
- An optional string parameter `message` has been added to `show()` method.
24+
- `IgxSnackbar`
25+
- `message` property has been deprecated. You can place the *message text* in the snackbar content or pass it as parameter to `show` method instead.
26+
- An optional string parameter `message` has been added to `show()` method.
27+
1328
## 10.0.0
1429

1530
### General
@@ -18,9 +33,9 @@ All notable changes for each version of this project will be documented in this
1833
- `igx-select`, `igx-combo`, `igx-drop-down`
1934
- **Behavioral Change** - The select, combo, and dropdown items now have display block and text-overflow ellipsis enabled by default.
2035
- `IgxTransaction` - The `onStateUpdate` now emits with information of its origin. The emitted value is of type `StateUpdateEvent`, which has two properties:
21-
- `origin` - it can vary within the values of the `TransactionEventOrigin` interface;
36+
- `origin` - it can vary within the values of the `TransactionEventOrigin` interface;
2237
- `actions` - contains information about the transactions, that caused the emission of the event.
23-
- `IgxPaginator` - The input `overlaySettings` was introduced, which allows applying custom overlay settings for the component.
38+
- `IgxPaginator` - The input `overlaySettings` was introduced, which allows applying custom overlay settings for the component.
2439

2540
### New Features
2641
- `IgxGrid`
@@ -43,6 +58,7 @@ All notable changes for each version of this project will be documented in this
4358
- `IgxHierarchicalGrid`
4459
- `onGridInitialized` - New output has been exposed. Emitted after a grid is being initialized for the corresponding row island.
4560
- **Behavioral Change** - When moving a column `DropPosition.None` is now acting like `DropPosition.AfterDropTarget`.
61+
4662
## 9.1.0
4763

4864
### General
@@ -164,9 +180,9 @@ All notable changes for each version of this project will be documented in this
164180
```typescript
165181
public pinningConfiguration: IPinningConfig = { columns: ColumnPinningPosition.End };
166182
```
167-
- Added new properties for paging:
168-
- `totalRecords` set to alter the pages count based on total remote records. Keep in mind that If you are using paging and all the data is passed to the grid, the value of totalRecords property will be set by default to the length of the provided data source. If totalRecords is set, it will take precedent over the default length based on the data source.
169-
- `pagingMode` - accepts `GridPagingMode` enumeration. If the paging mode is set to remote the grid will not paginate the passed data source, if the paging mode is set to local (which is the default value) the grid will paginate the data source based on the page, perPage and totalRecords values.
183+
- Added new properties for paging:
184+
- `totalRecords` set to alter the pages count based on total remote records. Keep in mind that If you are using paging and all the data is passed to the grid, the value of totalRecords property will be set by default to the length of the provided data source. If totalRecords is set, it will take precedent over the default length based on the data source.
185+
- `pagingMode` - accepts `GridPagingMode` enumeration. If the paging mode is set to remote the grid will not paginate the passed data source, if the paging mode is set to local (which is the default value) the grid will paginate the data source based on the page, perPage and totalRecords values.
170186
- Added functionality for column selection.
171187
- `columnSelection` property has been added. It accepts GridSelection mode enumeration. Grid selection mode could be none, single or multiple.
172188
- `selected` property has been added to the IgxColumnComponent; Allows you to set whether the column is selected.

gulpfile.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ module.exports.copySchematics = (cb) => {
137137
const typedocBuildTheme = (cb) => {
138138
spawnSync(`typedoc`, [TYPEDOC.PROJECT_PATH,
139139
"--tsconfig",
140-
"tsconfig.base.json"], { stdio: 'inherit', shell: true });
140+
path.join(__dirname,"tsconfig.base.json")], { stdio: 'inherit', shell: true });
141141
cb();
142142
};
143143
typedocBuildTheme.displayName = 'typedoc-build:theme';
@@ -180,13 +180,26 @@ const TYPEDOC = {
180180
};
181181

182182
function typedocBuildExportFn(cb) {
183-
spawnSync('typedoc', [TYPEDOC.PROJECT_PATH, "--generate-json", TYPEDOC.EXPORT_JSON_PATH, "--tags", "--params"],
183+
spawnSync('typedoc', [
184+
TYPEDOC.PROJECT_PATH,
185+
"--generate-json",
186+
TYPEDOC.EXPORT_JSON_PATH,
187+
"--tags",
188+
"--params",
189+
"--tsconfig",
190+
path.join(__dirname,"tsconfig.base.json")],
184191
{ stdio: 'inherit', shell: true });
185192
cb();
186193
}
187194

188195
function typedocImportJsonFn(cb) {
189-
spawnSync('typedoc', [TYPEDOC.PROJECT_PATH, "--generate-from-json", TYPEDOC.EXPORT_JSON_PATH, "--warns"],
196+
spawnSync('typedoc', [
197+
TYPEDOC.PROJECT_PATH,
198+
"--generate-from-json",
199+
TYPEDOC.EXPORT_JSON_PATH,
200+
"--warns",
201+
"--tsconfig",
202+
path.join(__dirname,"tsconfig.base.json")],
190203
{ stdio: 'inherit', shell: true});
191204
cb();
192205
}
@@ -212,7 +225,7 @@ function typedocBuildDocsJA (cb) {
212225
'--localize',
213226
'jp',
214227
"--tsconfig",
215-
"tsconfig.base.json"], { stdio: 'inherit', shell: true });
228+
path.join(__dirname,"tsconfig.base.json")], { stdio: 'inherit', shell: true });
216229

217230
cb();
218231
}
@@ -223,7 +236,7 @@ function typedocBuildDocsEN (cb) {
223236
'--localize',
224237
'en',
225238
"--tsconfig",
226-
"tsconfig.base.json"], { stdio: 'inherit', shell: true});
239+
path.join(__dirname,"tsconfig.base.json")], { stdio: 'inherit', shell: true});
227240

228241
cb();
229242
}

projects/igniteui-angular/src/lib/combo/combo.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ConnectedPositioningStrategy } from './../services/overlay/position/connected-positioning-strategy';
21
import { CommonModule } from '@angular/common';
32
import {
43
AfterViewInit, ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, HostBinding, HostListener,
@@ -30,7 +29,7 @@ import { IgxInputGroupModule, IgxInputGroupComponent } from '../input-group/inpu
3029
import { IgxComboItemComponent } from './combo-item.component';
3130
import { IgxComboDropDownComponent } from './combo-dropdown.component';
3231
import { IgxComboFilteringPipe, IgxComboGroupingPipe } from './combo.pipes';
33-
import { OverlaySettings, AbsoluteScrollStrategy } from '../services/public_api';
32+
import { OverlaySettings, AbsoluteScrollStrategy, AutoPositionStrategy } from '../services/public_api';
3433
import { Subject } from 'rxjs';
3534
import { takeUntil } from 'rxjs/operators';
3635
import { DisplayDensityBase, DisplayDensityToken, IDisplayDensityOptions } from '../core/density';
@@ -156,7 +155,7 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
156155
private _onTouchedCallback: () => void = noop;
157156
private _overlaySettings: OverlaySettings = {
158157
scrollStrategy: new AbsoluteScrollStrategy(),
159-
positionStrategy: new ConnectedPositioningStrategy(),
158+
positionStrategy: new AutoPositionStrategy(),
160159
modal: false,
161160
closeOnOutsideClick: true,
162161
excludePositionTarget: true

projects/igniteui-angular/src/lib/directives/for-of/base.helper.component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class VirtualHelperBaseDirective implements OnDestroy, AfterViewInit {
2020
public destroyed;
2121

2222
private _afterViewInit = false;
23+
private _scrollNativeSize: number;
2324

2425
ngAfterViewInit() {
2526
this._afterViewInit = true;
@@ -29,7 +30,9 @@ export class VirtualHelperBaseDirective implements OnDestroy, AfterViewInit {
2930
onScroll(event) {
3031
this.scrollAmount = event.target.scrollTop || event.target.scrollLeft;
3132
}
32-
constructor(public elementRef: ElementRef, public cdr: ChangeDetectorRef) { }
33+
constructor(public elementRef: ElementRef, public cdr: ChangeDetectorRef) {
34+
this._scrollNativeSize = this.calculateScrollNativeSize();
35+
}
3336

3437
get nativeElement() {
3538
return this.elementRef.nativeElement;
@@ -54,6 +57,10 @@ export class VirtualHelperBaseDirective implements OnDestroy, AfterViewInit {
5457
}
5558

5659
public get scrollNativeSize() {
60+
return this._scrollNativeSize;
61+
}
62+
63+
public calculateScrollNativeSize() {
5764
const div = document.createElement('div');
5865
const style = div.style;
5966
style.width = '100px';

projects/igniteui-angular/src/lib/grids/columns/column.component.ts

Lines changed: 95 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,44 @@ export class IgxColumnComponent implements AfterContentInit {
439439
@WatchColumnChanges()
440440
@Input()
441441
public maxWidth: string;
442+
443+
/**
444+
* @hidden
445+
*/
446+
get maxWidthPx() {
447+
const gridAvailableSize = this.grid.calcWidth;
448+
const isPercentageWidth = this.maxWidth && typeof this.maxWidth === 'string' && this.maxWidth.indexOf('%') !== -1;
449+
return isPercentageWidth ? parseFloat(this.maxWidth) / 100 * gridAvailableSize : parseFloat(this.maxWidth);
450+
}
451+
452+
/**
453+
* @hidden
454+
*/
455+
get maxWidthPercent() {
456+
const gridAvailableSize = this.grid.calcWidth;
457+
const isPercentageWidth = this.maxWidth && typeof this.maxWidth === 'string' && this.maxWidth.indexOf('%') !== -1;
458+
return isPercentageWidth ? parseFloat(this.maxWidth) : parseFloat(this.maxWidth) / gridAvailableSize * 100;
459+
}
460+
461+
/**
462+
* @hidden
463+
*/
464+
get minWidthPx() {
465+
const gridAvailableSize = this.grid.calcWidth;
466+
const isPercentageWidth = this.minWidth && typeof this.minWidth === 'string' && this.minWidth.indexOf('%') !== -1;
467+
return isPercentageWidth ? parseFloat(this.minWidth) / 100 * gridAvailableSize : parseFloat(this.minWidth);
468+
}
469+
470+
/**
471+
* @hidden
472+
*/
473+
get minWidthPercent() {
474+
const gridAvailableSize = this.grid.calcWidth;
475+
const isPercentageWidth = this.minWidth && typeof this.minWidth === 'string' && this.minWidth.indexOf('%') !== -1;
476+
return isPercentageWidth ? parseFloat(this.minWidth) : parseFloat(this.minWidth) / gridAvailableSize * 100;
477+
}
478+
479+
442480
/**
443481
* Sets/gets the minimum `width` of the column.
444482
* Default value is `88`;
@@ -1750,14 +1788,34 @@ export class IgxColumnComponent implements AfterContentInit {
17501788
* column.autosize();
17511789
* ```
17521790
* @memberof IgxColumnComponent
1791+
* @param byHeader Set if column should be autized based only on the header content
17531792
*/
1754-
public autosize() {
1793+
public autosize(byHeader = false) {
17551794
if (!this.columnGroup) {
1756-
this.width = this.getLargestCellWidth();
1795+
const size = this.getAutoSize(byHeader);
1796+
this.width = size;
17571797
this.grid.reflow();
17581798
}
17591799
}
17601800

1801+
/**
1802+
* @hidden
1803+
*/
1804+
public getAutoSize(byHeader = false) {
1805+
const size = !byHeader ? this.getLargestCellWidth() :
1806+
(Object.values(this.getHeaderCellWidths()).reduce((a, b) => a + b) + 'px');
1807+
const gridAvailableSize = this.grid.calcWidth;
1808+
let newWidth;
1809+
const isPercentageWidth = this.width && typeof this.width === 'string' && this.width.indexOf('%') !== -1;
1810+
if (isPercentageWidth) {
1811+
const percentageSize = parseFloat(size) / gridAvailableSize * 100;
1812+
newWidth = percentageSize + '%';
1813+
} else {
1814+
newWidth = size;
1815+
}
1816+
return newWidth;
1817+
}
1818+
17611819
/**
17621820
* @hidden
17631821
*/
@@ -1769,6 +1827,36 @@ export class IgxColumnComponent implements AfterContentInit {
17691827
return this._calcWidth;
17701828
}
17711829

1830+
1831+
/**
1832+
* @hidden
1833+
* Returns the width and padding of a header cell.
1834+
*/
1835+
public getHeaderCellWidths() {
1836+
const range = this.grid.document.createRange();
1837+
let headerWidth;
1838+
if (this.headerTemplate && this.headerCell.elementRef.nativeElement.children[0].children.length > 0) {
1839+
headerWidth = Math.max(...Array.from(this.headerCell.elementRef.nativeElement.children[0].children)
1840+
.map((child) => getNodeSizeViaRange(range, child)));
1841+
} else {
1842+
headerWidth = getNodeSizeViaRange(range, this.headerCell.elementRef.nativeElement.children[0]);
1843+
}
1844+
1845+
if (this.sortable || this.filterable) {
1846+
headerWidth += this.headerCell.elementRef.nativeElement.children[1].getBoundingClientRect().width;
1847+
}
1848+
1849+
const headerStyle = this.grid.document.defaultView.getComputedStyle(this.headerCell.elementRef.nativeElement);
1850+
const headerPadding = parseFloat(headerStyle.paddingLeft) + parseFloat(headerStyle.paddingRight) +
1851+
parseFloat(headerStyle.borderRightWidth);
1852+
1853+
// Take into consideration the header group element, since column pinning applies borders to it if its not a columnGroup.
1854+
const headerGroupStyle = this.grid.document.defaultView.getComputedStyle(this.headerGroup.element.nativeElement);
1855+
const borderSize = !this.parent ? parseFloat(headerGroupStyle.borderRightWidth) + parseFloat(headerGroupStyle.borderLeftWidth) : 0;
1856+
1857+
return { width: Math.ceil(headerWidth), padding: Math.ceil(headerPadding + borderSize)};
1858+
}
1859+
17721860
/**
17731861
* @hidden
17741862
* Returns the size (in pixels) of the longest currently visible cell, including the header cell.
@@ -1795,29 +1883,14 @@ export class IgxColumnComponent implements AfterContentInit {
17951883
const index = cellsContentWidths.indexOf(Math.max(...cellsContentWidths));
17961884
const cellStyle = this.grid.document.defaultView.getComputedStyle(this.cells[index].nativeElement);
17971885
const cellPadding = parseFloat(cellStyle.paddingLeft) + parseFloat(cellStyle.paddingRight) +
1798-
parseFloat(cellStyle.borderRightWidth);
1886+
parseFloat(cellStyle.borderLeftWidth) + parseFloat(cellStyle.borderRightWidth);
17991887

18001888
largest.set(Math.max(...cellsContentWidths), cellPadding);
18011889
}
18021890

18031891
if (this.headerCell) {
1804-
let headerCell;
1805-
if (this.headerTemplate && this.headerCell.elementRef.nativeElement.children[0].children.length > 0) {
1806-
headerCell = Math.max(...Array.from(this.headerCell.elementRef.nativeElement.children[0].children)
1807-
.map((child) => getNodeSizeViaRange(range, child)));
1808-
} else {
1809-
headerCell = getNodeSizeViaRange(range, this.headerCell.elementRef.nativeElement.children[0]);
1810-
}
1811-
1812-
if (this.sortable || this.filterable) {
1813-
headerCell += this.headerCell.elementRef.nativeElement.children[1].getBoundingClientRect().width;
1814-
}
1815-
1816-
const headerStyle = this.grid.document.defaultView.getComputedStyle(this.headerCell.elementRef.nativeElement);
1817-
const headerPadding = parseFloat(headerStyle.paddingLeft) + parseFloat(headerStyle.paddingRight) +
1818-
parseFloat(headerStyle.borderRightWidth);
1819-
largest.set(headerCell, headerPadding);
1820-
1892+
const headerCellWidths = this.getHeaderCellWidths();
1893+
largest.set(headerCellWidths.width, headerCellWidths.padding);
18211894
}
18221895

18231896
const largestCell = Math.max(...Array.from(largest.keys()));
@@ -1863,14 +1936,14 @@ export class IgxColumnComponent implements AfterContentInit {
18631936
const colWidth = this.width;
18641937
const isPercentageWidth = colWidth && typeof colWidth === 'string' && colWidth.indexOf('%') !== -1;
18651938
if (isPercentageWidth) {
1866-
this._calcWidth = parseInt(colWidth, 10) / 100 * grid.calcWidth;
1939+
this._calcWidth = parseFloat(colWidth) / 100 * grid.calcWidth;
18671940
} else if (!colWidth) {
18681941
// no width
18691942
this._calcWidth = this.defaultWidth || grid.getPossibleColumnWidth();
18701943
} else {
18711944
this._calcWidth = this.width;
18721945
}
1873-
this.calcPixelWidth = parseInt(this._calcWidth, 10);
1946+
this.calcPixelWidth = parseFloat(this._calcWidth);
18741947
}
18751948

18761949
/**

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3555,7 +3555,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
35553555
if (this.hasColumnLayouts) {
35563556
return '';
35573557
}
3558-
const colWidth = parseInt(column.calcWidth, 10);
3558+
const colWidth = parseFloat(column.calcWidth);
35593559
const minWidth = this.defaultHeaderGroupMinWidth;
35603560

35613561
if (colWidth < minWidth) {

0 commit comments

Comments
 (0)