Skip to content

Commit 797907b

Browse files
authored
Merge branch 'master' into simeonoff/css-var-refs
2 parents ba36da8 + 7af5952 commit 797907b

File tree

92 files changed

+2778
-611
lines changed

Some content is hidden

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

92 files changed

+2778
-611
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"no-shadow": "off",
2525
"@typescript-eslint/no-shadow": ["error"],
2626
"no-unused-vars": "off",
27-
"@typescript-eslint/no-unused-vars": ["warn"],
27+
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "_" }],
2828
"@typescript-eslint/consistent-type-definitions": "error",
2929
"@typescript-eslint/dot-notation": "off",
3030
"@typescript-eslint/explicit-member-accessibility": [

.vscode/launch.json

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@
1717
"env": {
1818
"TS_NODE_PROJECT": "projects/igniteui-angular/migrations/tsconfig.json"
1919
}
20+
},
21+
{
22+
"name": "Run migration",
23+
"request": "launch",
24+
"type": "node",
25+
"cwd": "<directory to apply migrations in>",
26+
"args": [
27+
"-r",
28+
"ts-node/register",
29+
"path/to/ng", "g",
30+
"path/to/igniteui-angular/projects/igniteui-angular/migrations/migration-collection.json:migration-<number>"
31+
],
32+
"env": {
33+
"TS_NODE_PROJECT": "path/to/igniteui-angular/projects/igniteui-angular/migrations/tsconfig.json"
34+
}
2035
}
2136
]
2237
}

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,41 @@
22

33
All notable changes for each version of this project will be documented in this file.
44
## 11.1.0
5+
### General
6+
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
7+
- The following new events are introduced: `sorting`, `filtering`, `columnPinned`, `columnVisibilityChanging`.
8+
- **Behavioral Change** -
9+
- `onColumnPinning` to emit `IPinColumnCancellableEventArgs` instead of `IPinColumnEventArgs`.
510

611
### New Features
712
- `IgxDropDown`
813
- The `igx-drop-down-item` now allows for `igxPrefix`, `igxSuffix` and `igx-divider` directives to be passed as `ng-content` and they will be renderer accordingly in the item's content.
914
- `IgxGrid`
1015
- Added support for exporting grouped data.
16+
- `IgxInput` now supports `type="file"` and its styling upon all themes.
17+
_Note: validation of file type input is not yet supported._
18+
1119
### General
1220
- `IgxDialog`
1321
- The dialog content has been moved inside the dialog window container in the template. This means that if you have added something in-between the opening and closing tags of the dialog, you may have to adjust its styling a bit since that content is now rendered inside a container that has padding on it.
1422
- `IgxCalendar`
1523
- A new string enumeration `IgxCalendarView` is exported. Either the new one or the current `CalendarView` can be used. `CalendarView` will be deprecated in a future release.
24+
- `onSelection` is now `selected`
25+
- `onViewChanging` is now `viewChanging`
26+
- `onDateSelection` is now `dateSelection`
27+
- `onYearSelection` is now `yearSelection`
28+
- `onMonthSelection` is now `monthSelection`
29+
- `IgxYearsViewComponent`
30+
- `onSelection` is now `selected`
31+
- `onYearSelection` is now `yearSelection`
32+
- `IgxDaysViewComponent`
33+
- `onDateSelection` is now `dateSelection`
34+
- `onViewChanging` is now `viewChanging`
35+
- `IgxMonthsViewComponent`
36+
- `onSelection` is now `selected`
37+
- `onMonthSelection` is now `monthSelection`
38+
- `IgxMonthPickerComponent`
39+
- `onSelection` is now `selected`
1640
- `IgxRadioGroup`
1741
- Added new property `alignment` that determines the radio group alignment. Available options are `horizontal` (default) and `vertical`.
1842
- `IgxDialog`
@@ -30,6 +54,9 @@ All notable changes for each version of this project will be documented in this
3054
- Added new property `theme` that allows you to set the theme explicitly and at runtime.
3155
- `IgxSnackbar`
3256
- `show` and `hide` methods have been deprecated. `open` and `close` should be used instead.
57+
- `IgxGrid`, `IgxHierarchicalGrid`, `IgxTreeGrid`
58+
- Added new property `selectRowOnClick` that determines whether clicking over a row will change its selection state or not. Set to `true` by default.
59+
- `GridPagingMode` enum members rename - `local` to `Local` and `remote` to `Remote`. Example: `GridPagingMode.Local`.
3360

3461
## 11.0.4
3562

projects/igniteui-angular/migrations/common/ServerHost.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Tree } from '@angular-devkit/schematics';
22
import * as ts from 'typescript/lib/tsserverlibrary';
3+
import { CUSTOM_TS_PLUGIN_NAME } from './tsUtils';
34

45
export class ServerHost implements ts.server.ServerHost {
56
readonly args: string[];
@@ -72,9 +73,11 @@ export class ServerHost implements ts.server.ServerHost {
7273

7374
public require(initialPath: string, moduleName: string) {
7475
try {
75-
const modulePath = require.resolve(moduleName, {
76-
paths: [initialPath],
77-
});
76+
const paths = [initialPath];
77+
if (moduleName === CUSTOM_TS_PLUGIN_NAME) {
78+
paths.push(__dirname);
79+
}
80+
const modulePath = require.resolve(moduleName, { paths });
7881
return {
7982
module: require(modulePath),
8083
error: undefined,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as tss from 'typescript/lib/tsserverlibrary';
2+
3+
export interface TSLanguageService extends tss.LanguageService {
4+
getTypeScriptLanguageService(): tss.LanguageService;
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { TSLanguageService } from './TSLanguageService';
2+
3+
const init = (modules: { typescript: typeof import('typescript/lib/tsserverlibrary') }) => {
4+
const ts = modules.typescript;
5+
let tsLanguageService = null;
6+
7+
/**
8+
* Returns a cached version of the TSLS.
9+
* Useful if other global or local plugins modify it.
10+
*/
11+
const getTypeScriptLanguageService = (): ts.LanguageService => tsLanguageService;
12+
13+
const create = (info: ts.server.PluginCreateInfo): TSLanguageService => {
14+
tsLanguageService = info.languageService;
15+
return {
16+
...info.languageService,
17+
getTypeScriptLanguageService
18+
};
19+
};
20+
21+
return { create };
22+
};
23+
24+
export = init;

projects/igniteui-angular/migrations/common/tsUtils.ts

+70-51
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import { Tree } from '@angular-devkit/schematics';
55
import { MemberChange } from './schema';
66
import { escapeRegExp } from './util';
77
import { Logger } from './tsLogger';
8+
import { TSLanguageService } from './tsPlugin/TSLanguageService';
89

910
export const IG_PACKAGE_NAME = 'igniteui-angular';
1011
export const NG_LANG_SERVICE_PACKAGE_NAME = '@angular/language-service';
12+
export const CUSTOM_TS_PLUGIN_NAME = './tsPlugin';
1113

12-
/** Returns an source file */
14+
/** Returns a source file */
1315
// export function getFileSource(sourceText: string): ts.SourceFile {
1416
// return ts.createSourceFile('', sourceText, ts.ScriptTarget.Latest, true);
1517
// }
@@ -128,9 +130,9 @@ export const findMatches = (content: string, change: MemberChange): number[] =>
128130
};
129131

130132
export const replaceMatch = (content: string, toReplace: string, replaceWith: string, index: number): string =>
131-
content.substring(0, index) +
132-
replaceWith +
133-
content.substring(index + toReplace.length, content.length);
133+
content.substring(0, index) +
134+
replaceWith +
135+
content.substring(index + toReplace.length, content.length);
134136

135137
//#region Language Service
136138

@@ -190,7 +192,7 @@ export const createProjectService = (serverHost: tss.server.ServerHost): tss.ser
190192
useSingleInferredProject: true,
191193
useInferredProjectPerProjectRoot: true,
192194
/* will load only global plug-ins */
193-
globalPlugins: [NG_LANG_SERVICE_PACKAGE_NAME],
195+
globalPlugins: [CUSTOM_TS_PLUGIN_NAME, NG_LANG_SERVICE_PACKAGE_NAME],
194196
allowLocalPluginLoads: false,
195197
typingsInstaller: tss.server.nullTypingsInstaller
196198
});
@@ -204,6 +206,10 @@ export const createProjectService = (serverHost: tss.server.ServerHost): tss.ser
204206
}
205207
]
206208
});
209+
projectService.configurePlugin({
210+
pluginName: CUSTOM_TS_PLUGIN_NAME,
211+
configuration: {}
212+
});
207213
projectService.configurePlugin({
208214
pluginName: NG_LANG_SERVICE_PACKAGE_NAME,
209215
configuration: {
@@ -214,6 +220,19 @@ export const createProjectService = (serverHost: tss.server.ServerHost): tss.ser
214220
return projectService;
215221
};
216222

223+
/**
224+
* Attempts to get type definitions using the TypeScript Language Service.
225+
* Can fall back to a cached version of the TSLS.
226+
*/
227+
const getTypeDefinitions = (langServ: tss.LanguageService, entryPath: string, definition: tss.DefinitionInfo): any =>
228+
/*
229+
getTypeScriptLanguageService is attached by us to the Typescript Language Service
230+
via a custom made plugin, it's sole purpose is to cache the language service and return it
231+
before any other plugins modify it
232+
*/
233+
langServ.getTypeDefinitionAtPosition(entryPath, definition.textSpan.start)
234+
|| (langServ as TSLanguageService).getTypeScriptLanguageService().getTypeDefinitionAtPosition(entryPath, definition.textSpan.start);
235+
217236
/**
218237
* Get type information about a TypeScript identifier
219238
*
@@ -222,61 +241,61 @@ export const createProjectService = (serverHost: tss.server.ServerHost): tss.ser
222241
* @param position Index of identifier
223242
*/
224243
export const getTypeDefinitionAtPosition =
225-
(langServ: tss.LanguageService, entryPath: string, position: number): tss.DefinitionInfo | null => {
226-
const definition = langServ.getDefinitionAndBoundSpan(entryPath, position)?.definitions[0];
227-
if (!definition) {
228-
return null;
229-
}
230-
231-
// if the definition's kind is a reference, the identifier is a template variable referred in an internal/external template
232-
if (definition.kind.toString() === 'reference') {
233-
return langServ.getDefinitionAndBoundSpan(entryPath, definition.textSpan.start).definitions[0];
234-
}
235-
let typeDefs = langServ.getTypeDefinitionAtPosition(entryPath, definition.textSpan.start);
236-
// if there are no type definitions found, the identifier is a ts property, referred in an internal/external template
237-
// or is a reference in a decorator
238-
if (!typeDefs) {
239-
/*
240-
normally, the tsserver will consider non .ts files as external to the project
241-
however, we load .html files which we can handle with the Angular language service
242-
here we're only looking for definitions in a .ts source file
243-
we call the getSourceFile function which accesses a map of files, previously loaded by the tsserver
244-
at this point the map contains all .html files that we've included
245-
we have to ignore them, since the language service will attempt to parse them as .ts files
246-
*/
247-
if (!definition.fileName.endsWith('.ts')) {
244+
(langServ: tss.LanguageService, entryPath: string, position: number): tss.DefinitionInfo | null => {
245+
const definition = langServ.getDefinitionAndBoundSpan(entryPath, position)?.definitions[0];
246+
if (!definition) {
248247
return null;
249248
}
250249

251-
const sourceFile = langServ.getProgram().getSourceFile(definition.fileName);
252-
if (!sourceFile) {
253-
return null;
250+
// if the definition's kind is a reference, the identifier is a template variable referred in an internal/external template
251+
if (definition.kind.toString() === 'reference') {
252+
return langServ.getDefinitionAndBoundSpan(entryPath, definition.textSpan.start).definitions[0];
254253
}
254+
let typeDefs = getTypeDefinitions(langServ, entryPath, definition);
255+
// if there are no type definitions found, the identifier is a ts property, referred in an internal/external template
256+
// or is a reference in a decorator
257+
if (!typeDefs) {
258+
/*
259+
normally, the tsserver will consider non .ts files as external to the project
260+
however, we load .html files which we can handle with the Angular language service
261+
here we're only looking for definitions in a .ts source file
262+
we call the getSourceFile function which accesses a map of files, previously loaded by the tsserver
263+
at this point the map contains all .html files that we've included
264+
we have to ignore them, since the language service will attempt to parse them as .ts files
265+
*/
266+
if (!definition.fileName.endsWith('.ts')) {
267+
return null;
268+
}
255269

256-
const classDeclaration = sourceFile
257-
.statements
258-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
259-
.filter(<(a: tss.Statement) => a is tss.ClassDeclaration>(m => m.kind === tss.SyntaxKind.ClassDeclaration))
260-
.find(m => m.name.getText() === definition.containerName);
270+
const sourceFile = langServ.getProgram().getSourceFile(definition.fileName);
271+
if (!sourceFile) {
272+
return null;
273+
}
261274

262-
// there must be at least one class declaration in the .ts file and the property must belong to it
263-
if (!classDeclaration) {
264-
return null;
265-
}
275+
const classDeclaration = sourceFile
276+
.statements
277+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
278+
.filter(<(a: tss.Statement) => a is tss.ClassDeclaration>(m => m.kind === tss.SyntaxKind.ClassDeclaration))
279+
.find(m => m.name.getText() === definition.containerName);
266280

267-
const member: ts.ClassElement = classDeclaration.members.find(m => m.name.getText() === definition.name);
268-
if (!member?.name) {
269-
return null;
270-
}
281+
// there must be at least one class declaration in the .ts file and the property must belong to it
282+
if (!classDeclaration) {
283+
return null;
284+
}
271285

272-
typeDefs = langServ.getTypeDefinitionAtPosition(definition.fileName, member.name.getStart() + 1);
273-
}
274-
if (typeDefs?.length) {
275-
return typeDefs[0];
276-
}
286+
const member: ts.ClassElement = classDeclaration.members.find(m => m.name.getText() === definition.name);
287+
if (!member?.name) {
288+
return null;
289+
}
277290

278-
return null;
279-
};
291+
typeDefs = langServ.getTypeDefinitionAtPosition(definition.fileName, member.name.getStart() + 1);
292+
}
293+
if (typeDefs?.length) {
294+
return typeDefs[0];
295+
}
296+
297+
return null;
298+
};
280299

281300
export const isMemberIgniteUI =
282301
(change: MemberChange, langServ: tss.LanguageService, entryPath: string, matchPosition: number): boolean => {

0 commit comments

Comments
 (0)