Skip to content

Commit eb13fd4

Browse files
authored
Merge branch 'master' into mkirova/fix-10664
2 parents 2f94356 + 269ea7c commit eb13fd4

File tree

137 files changed

+2179
-1299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+2179
-1299
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
All notable changes for each version of this project will be documented in this file.
44

5+
## 13.1.0
6+
### New Features
7+
- `igxTooltipTarget` directive now allows specifying a plain text tooltip without adding an additional DOM element decorated with the `igxTooltip` directive. This is achieved via the newly introduced `tooltip` string input.
8+
```html
9+
<button igxTooltipTarget [tooltip]="'Infragistics Inc. HQ'">
10+
info
11+
</button>
12+
```
13+
### General
14+
15+
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
16+
- **Breaking Change** - `movable` property of `IgxColumnComponent` is now deprecated and will be removed in future version. Instead, use the newly exposed `moving` property on grid-level:
17+
```html
18+
<igx-grid [data]="data" [moving]="true">
19+
<igx-column field="Name"></igx-column>
20+
<igx-column field="Age"></igx-column>
21+
</igx-grid>
22+
```
23+
24+
## 13.0.5
25+
26+
### New Features
27+
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
28+
- Added `dataCloneStrategy` input, which allows users provide their own implementation of how data objects are cloned when row and/or batch editing is enabled. The custom strategy should implement the `IDataCloneStrategy` interface.
29+
530
## 13.0.1
631

732
### New Features

projects/igniteui-angular/migrations/migration-collection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@
110110
"version": "13.0.0-alpha",
111111
"description": "Updates Ignite UI for Angular from v12.2.x to v13.0.0",
112112
"factory": "./update-13_0_0"
113+
},
114+
"migration-23": {
115+
"version": "13.1.0",
116+
"description": "Updates Ignite UI for Angular from v13.0.x to v13.1.0",
117+
"factory": "./update-13_1_0"
113118
}
114119
}
115120
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import * as path from 'path';
2+
3+
import { EmptyTree } from '@angular-devkit/schematics';
4+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
5+
6+
const version = '13.1.0';
7+
8+
describe(`Update to ${version}`, () => {
9+
let appTree: UnitTestTree;
10+
const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
11+
const configJson = {
12+
defaultProject: 'testProj',
13+
projects: {
14+
testProj: {
15+
sourceRoot: '/testSrc'
16+
}
17+
},
18+
schematics: {
19+
'@schematics/angular:component': {
20+
prefix: 'appPrefix'
21+
}
22+
}
23+
};
24+
25+
beforeEach(() => {
26+
appTree = new UnitTestTree(new EmptyTree());
27+
appTree.create('/angular.json', JSON.stringify(configJson));
28+
});
29+
30+
const migrationName = 'migration-23';
31+
32+
it('should remove columns` movable prop and enable grid`s moving prop if there is movable columns', async () => {
33+
appTree.create(
34+
`/testSrc/appPrefix/component/test.component.html`,
35+
`
36+
<igx-grid>
37+
<igx-column [movable]="true"></igx-column>
38+
<igx-column></igx-column>
39+
</igx-grid>
40+
`
41+
);
42+
43+
const tree = await schematicRunner
44+
.runSchematicAsync(migrationName, {}, appTree)
45+
.toPromise();
46+
47+
expect(
48+
tree.readContent('/testSrc/appPrefix/component/test.component.html')
49+
).toEqual(
50+
`
51+
<igx-grid [moving]="true">
52+
<igx-column ></igx-column>
53+
<igx-column></igx-column>
54+
</igx-grid>
55+
`
56+
);
57+
});
58+
59+
it('should remove columns` movable prop and don`t set the grid`s moving prop if there isn`t movable columns', async () => {
60+
appTree.create(
61+
`/testSrc/appPrefix/component/test.component.html`,
62+
`
63+
<igx-grid>
64+
<igx-column [movable]="false"></igx-column>
65+
<igx-column></igx-column>
66+
</igx-grid>
67+
`
68+
);
69+
70+
const tree = await schematicRunner
71+
.runSchematicAsync(migrationName, {}, appTree)
72+
.toPromise();
73+
74+
expect(
75+
tree.readContent('/testSrc/appPrefix/component/test.component.html')
76+
).toEqual(
77+
`
78+
<igx-grid>
79+
<igx-column ></igx-column>
80+
<igx-column></igx-column>
81+
</igx-grid>
82+
`
83+
);
84+
});
85+
86+
87+
});
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { Element } from '@angular/compiler';
2+
import {
3+
Rule,
4+
SchematicContext,
5+
Tree
6+
} from '@angular-devkit/schematics';
7+
import { UpdateChanges } from '../common/UpdateChanges';
8+
import { nativeImport } from '../common/import-helper.js';
9+
import { FileChange, findElementNodes, getAttribute, getSourceOffset, hasAttribute, parseFile } from '../common/util';
10+
11+
const version = '13.1.0';
12+
13+
export default (): Rule => async (host: Tree, context: SchematicContext) => {
14+
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
15+
const { HtmlParser } = await nativeImport('@angular/compiler') as typeof import('@angular/compiler');
16+
17+
const update = new UpdateChanges(__dirname, host, context);
18+
const GRID_TAGS = ['igx-grid', 'igx-tree-grid', 'igx-hierarchical-grid', 'igx-row-island'];
19+
const prop = ['[movable]'];
20+
const changes = new Map<string, FileChange[]>();
21+
22+
const gridsToMigrate = new Set<any>();
23+
24+
const applyChanges = () => {
25+
for (const [path, change] of changes.entries()) {
26+
let buffer = host.read(path).toString();
27+
28+
change.sort((c, c1) => c.position - c1.position)
29+
.reverse()
30+
.forEach(c => buffer = c.apply(buffer));
31+
32+
host.overwrite(path, buffer);
33+
}
34+
};
35+
36+
const addChange = (path: string, change: FileChange) => {
37+
if (changes.has(path)) {
38+
changes.get(path).push(change);
39+
} else {
40+
changes.set(path, [change]);
41+
}
42+
};
43+
44+
// migrate movable on column-level to moving on grid-level for grid, tree grid, hierarchical grid and row island
45+
for (const path of update.templateFiles) {
46+
const grids = findElementNodes(parseFile(new HtmlParser(), host, path), GRID_TAGS);
47+
grids.forEach(grid => {
48+
const grid_elem = grid as Element;
49+
const columns = grid_elem.children.filter(column => (column as Element).name === 'igx-column' && hasAttribute(column as Element, prop));
50+
columns.map(node => getSourceOffset(node as Element))
51+
.forEach(offset => {
52+
const { startTag, file, node } = offset;
53+
const { name, value } = getAttribute(node, prop)[0];
54+
if (value === 'true') {
55+
gridsToMigrate.add(grid_elem);
56+
}
57+
const repTxt = file.content.substring(startTag.start, startTag.end);
58+
const property = `${name}="${value}"`;
59+
const removePropTxt = repTxt.replace(property, '');
60+
addChange(file.url, new FileChange(startTag.start, removePropTxt, repTxt, 'replace'));
61+
});
62+
});
63+
64+
Array.from(gridsToMigrate).map(node => getSourceOffset(node as Element)).forEach(offset => {
65+
const { startTag, file } = offset;
66+
addChange(file.url, new FileChange(startTag.end - 1, ' [moving]="true"'));
67+
});
68+
}
69+
70+
applyChanges();
71+
changes.clear();
72+
};

projects/igniteui-angular/src/lib/carousel/carousel-base.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AnimationBuilder, AnimationPlayer, AnimationReferenceMetadata, useAnimation } from '@angular/animations';
2-
import { EventEmitter } from '@angular/core';
2+
import { ChangeDetectorRef, EventEmitter } from '@angular/core';
33
import { fadeIn } from '../animations/fade';
44
import { slideInLeft } from '../animations/slide';
55
import { mkenum } from '../core/utils';
@@ -49,7 +49,7 @@ export abstract class IgxCarouselComponentBase {
4949
/** @hidden */
5050
protected newDuration = 0;
5151

52-
constructor(private builder: AnimationBuilder) {
52+
constructor(private builder: AnimationBuilder, private cdr: ChangeDetectorRef) {
5353
}
5454

5555
/** @hidden */
@@ -86,6 +86,7 @@ export abstract class IgxCarouselComponentBase {
8686
if (this.animationStarted(this.enterAnimationPlayer)) {
8787
this.enterAnimationPlayer.reset();
8888
this.enterAnimationDone.emit();
89+
this.cdr.markForCheck();
8990
}
9091
}
9192

@@ -155,6 +156,7 @@ export abstract class IgxCarouselComponentBase {
155156
this.newDuration = 0;
156157
this.previousItem.previous = false;
157158
this.enterAnimationDone.emit();
159+
this.cdr.markForCheck();
158160
});
159161
this.previousItem.previous = true;
160162
this.enterAnimationPlayer.play();

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import {
1818
TemplateRef,
1919
ViewChild,
2020
ContentChild,
21-
Injectable
21+
Injectable,
22+
ChangeDetectorRef
2223
} from '@angular/core';
2324
import { IgxIconModule } from '../icon/public_api';
2425
import { IBaseEventArgs, mkenum, PlatformUtil } from '../core/utils';
@@ -534,9 +535,9 @@ export class IgxCarouselComponent extends IgxCarouselComponentBase implements On
534535
this.restartInterval();
535536
}
536537

537-
constructor(private element: ElementRef, private iterableDiffers: IterableDiffers,
538+
constructor(cdr: ChangeDetectorRef, private element: ElementRef, private iterableDiffers: IterableDiffers,
538539
builder: AnimationBuilder, private platformUtil: PlatformUtil) {
539-
super(builder);
540+
super(builder, cdr);
540541
this.differ = this.iterableDiffers.find([]).create(null);
541542
}
542543

projects/igniteui-angular/src/lib/core/styles/components/tabs/_tabs-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,12 @@
280280
%tabs-header-content {
281281
flex: 1 1 auto;
282282
overflow: hidden;
283+
scroll-behavior: smooth;
283284
}
284285

285286
%tabs-header-wrapper {
286287
position: relative;
287288
flex-grow: 1;
288-
transition: transform .2s $tabs-animation-function;
289289

290290
@if $bootstrap-theme or $indigo-theme {
291291
&::after {

projects/igniteui-angular/src/lib/core/styles/themes/_index.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@
494494
$warn: igx-color($palette, 'warn'),
495495
$error: igx-color($palette, 'error'),
496496
$surface: if($surface != #fff, $surface, #fff),
497-
$grays: if($grays != rgba(0, 0, 0, .38), $grays, #000),
497+
$grays: if($grays != #9e9e9e, $grays, #000),
498498
);
499499

500500
@include igx-theme(
@@ -526,7 +526,7 @@
526526
$warn: igx-color($palette, 'warn'),
527527
$error: igx-color($palette, 'error'),
528528
$surface: if($surface != #fff, $surface, #222),
529-
$grays: if($grays != rgba(0, 0, 0, .38), $grays, #fff),
529+
$grays: if($grays != #9e9e9e, $grays, #fff),
530530
);
531531

532532
@include igx-theme(
@@ -637,7 +637,7 @@
637637
$palette: igx-palette(
638638
$primary,
639639
$secondary,
640-
$surface: if($surface != #f8f9fa, $surface, #222),
640+
$surface: if($surface != white, $surface, #222),
641641
$grays: #fff
642642
),
643643
$schema: $dark-bootstrap-schema,
@@ -691,7 +691,7 @@
691691
$palette: igx-palette(
692692
$primary,
693693
$secondary,
694-
$surface: if($surface != #2a2b2f, $surface, #2a2b2f),
694+
$surface: if($surface != white, $surface, #2a2b2f),
695695
$grays: #fff
696696
),
697697
$schema: $dark-indigo-schema,

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,22 @@ export const cloneHierarchicalArray = (array: any[], childDataKey: any): any[] =
8181
return result;
8282
};
8383

84+
/**
85+
* Creates an object with prototype from provided source and copies
86+
* all properties descriptors from provided source
87+
* @param obj Source to copy prototype and descriptors from
88+
* @returns New object with cloned prototype and property descriptors
89+
*/
90+
export const copyDescriptors = (obj) => {
91+
if (obj) {
92+
return Object.create(
93+
Object.getPrototypeOf(obj),
94+
Object.getOwnPropertyDescriptors(obj)
95+
);
96+
}
97+
}
98+
99+
84100
/**
85101
* Deep clones all first level keys of Obj2 and merges them to Obj1
86102
*
@@ -164,7 +180,7 @@ export const uniqueDates = (columnValues: any[]) => columnValues.reduce((a, c) =
164180
* @returns true if provided variable is Object
165181
* @hidden
166182
*/
167-
export const isObject = (value: any): boolean => value && value.toString() === '[object Object]';
183+
export const isObject = (value: any): boolean => !!(value && value.toString() === '[object Object]');
168184

169185
/**
170186
* Checks if provided variable is Date
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { cloneValue } from "../core/utils";
2+
3+
export interface IDataCloneStrategy {
4+
clone(data: any): any;
5+
}
6+
7+
export class DefaultDataCloneStrategy implements IDataCloneStrategy {
8+
public clone(data: any): any {
9+
return cloneValue(data);
10+
}
11+
}

0 commit comments

Comments
 (0)