Skip to content

Commit 25765e9

Browse files
committed
Merge remote-tracking branch 'origin/master' into dmdimitrov/query-builder-improvements
# Conflicts: # package-lock.json # package.json # projects/igniteui-angular/package.json
2 parents 4f8ec92 + a34e44c commit 25765e9

Some content is hidden

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

49 files changed

+830
-437
lines changed

.vscode/launch.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,13 @@
2727
// "cwd": "<absolute directory of the project, having an old version of igniteui-angular, on which the migrations are applied>",
2828
"cwd": "C:\\Users\\User\\Desktop\\ng_proj\\test_migrations",
2929
"args": [
30-
"-r",
31-
32-
// you need to install ts-node for the test project
33-
"ts-node/register",
34-
3530
// "<path/to/ng>", "g",
3631
"${env:AppData}/npm/node_modules/@angular/cli/bin/ng", "g",
3732

38-
// "<../../relative/path/from/cwd/to>/igniteui-angular/projects/igniteui-angular/migrations/migration-collection.json:migration-<number>
39-
"../../../../../work/git/igniteui-angular/projects/igniteui-angular/migrations/migration-collection.json:migration-24"
33+
// "<../../relative/path/from/cwd/to>/igniteui-angular/dist/igniteui-angular/migrations/migration-collection.json:migration-<number>
34+
"../../../../../work/git/igniteui-angular/dist/igniteui-angular/migrations/migration-collection.json:migration-23"
4035
],
41-
"env": {
42-
"TS_NODE_PROJECT": "${workspaceFolder}/projects/igniteui-angular/migrations/tsconfig.json"
43-
}
36+
"preLaunchTask": "buildMigrations"
4437
},
4538
{
4639
"name": "Run schematics",

.vscode/tasks.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "build:schematics",
7+
"problemMatcher": [],
8+
"label": "buildSchematics",
9+
"detail": "Build schematics"
10+
},
11+
{
12+
"type": "npm",
13+
"script": "build:migrations -- --sourceMap",
14+
"dependsOn": [
15+
"buildSchematics"
16+
],
17+
"problemMatcher": [],
18+
"label": "buildMigrationsSourceMap",
19+
"detail": "Build migrations with sourceMap for debugging"
20+
},
21+
{
22+
"type": "shell",
23+
"command": "node ./scripts/migrations-sourcemap-shift.mjs",
24+
"dependsOn": [
25+
"buildMigrationsSourceMap"
26+
],
27+
"problemMatcher": [],
28+
"label": "buildMigrations",
29+
"detail": "Build migrations with sourceMap for debugging"
30+
},
31+
]
32+
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ For Firefox users, we provide limited scrollbar styling options through the foll
4848
- **Behavioral Changes** - the `keyboardSupport` input property now defaults to `false`.
4949
- **Deprecation** - the `keyboardSupport` input property has been deprecated and will be removed in a future version. Keyboard navigation with `ArrowLeft`, `ArrowRight`, `Home`, and `End` keys will be supported when focusing the indicators' container via ` Tab`/`Shift+Tab`.
5050

51+
- `IgxBadge`
52+
- **Breaking Change** The `$border-width` property has been removed from the badge theme.
53+
- New outlined variant of the badge component has been added. Users can switch to `outlined` by adding the newly created `outlined` property to a badge.
54+
5155
## 18.1.0
5256
### New Features
5357
- `IgxPivotGrid`

angular.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,13 @@
264264
"polyfills": [
265265
"projects/igniteui-angular-elements/src/polyfills.ts"
266266
],
267-
"tsConfig": "projects/igniteui-angular-elements/tsconfig.app.json",
267+
"tsConfig": "projects/igniteui-angular-elements/tsconfig.main.json",
268268
"inlineStyleLanguage": "scss",
269269
"assets": [
270270
"projects/igniteui-angular-elements/src/favicon.ico",
271271
"projects/igniteui-angular-elements/src/assets",
272-
"projects/igniteui-angular-elements/src/index.js"
272+
"projects/igniteui-angular-elements/src/index.js",
273+
"projects/igniteui-angular-elements/src/index.bundle.js"
273274
],
274275
"styles": [
275276
"projects/igniteui-angular-elements/src/styles.scss"
@@ -318,6 +319,10 @@
318319
"extractLicenses": false,
319320
"sourceMap": true,
320321
"namedChunks": true
322+
},
323+
"dev-app": {
324+
"browser": "projects/igniteui-angular-elements/src/main.app.ts",
325+
"tsConfig": "projects/igniteui-angular-elements/tsconfig.app.json"
321326
}
322327
},
323328
"defaultConfiguration": "production"
@@ -326,10 +331,10 @@
326331
"builder": "@angular-devkit/build-angular:dev-server",
327332
"configurations": {
328333
"production": {
329-
"buildTarget": "igniteui-angular-elements:build:production"
334+
"buildTarget": "igniteui-angular-elements:build:production,dev-app"
330335
},
331336
"development": {
332-
"buildTarget": "igniteui-angular-elements:build:development"
337+
"buildTarget": "igniteui-angular-elements:build:development,dev-app"
333338
}
334339
},
335340
"defaultConfiguration": "development"

projects/igniteui-angular-elements/esbuild.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as esbuild from 'esbuild';
33
const ROOT = 'dist/igniteui-angular-elements/browser';
44
const config = {
55
// logLevel: 'verbose',
6-
entryPoints: [`${ROOT}/index.js`],
6+
entryPoints: [`${ROOT}/index.bundle.js`],
77
bundle: true,
88
minify: false, // temporary disabled due to Webpack issues https://github.com/webpack/webpack/issues/16262
99
outfile: `${ROOT}/elements.js`,

projects/igniteui-angular-elements/src/analyzer/component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as ts from 'typescript';
22
import type { ComponentMetadata, ContentQuery } from './types';
3-
import { asString, first, getDecoratorName, getDecorators, getProvidedAs, getTypeExpressionIdentifier, isMethod, isOverride, isProperty, isPublic, isReadOnly } from './utils';
3+
import { asString, first, getDecoratorName, getDecorators, getProvidedAs, getSelector, getTypeExpressionIdentifier, isMethod, isOverride, isProperty, isPublic, isReadOnly } from './utils';
44

55

66
const isInput = (dec: ts.Decorator) => getDecoratorName(dec).includes('Input');
@@ -42,6 +42,7 @@ export class AnalyzerComponent {
4242
public get metadata(): ComponentMetadata<string> {
4343
let parents = this.parents;
4444
let provideAs!: ts.Type;
45+
const selector = getSelector(this.node as ts.ClassDeclaration, ['igx-', 'igc-']);
4546

4647
if (parents.length) {
4748
parents = this.standaloneParents;
@@ -53,6 +54,7 @@ export class AnalyzerComponent {
5354
}
5455

5556
return {
57+
selector,
5658
parents,
5759
contentQueries: this.parseQueryProps(),
5860
methods: this.publicMethods.map(m => ({ name: m.name })),

projects/igniteui-angular-elements/src/analyzer/elements.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const registerComponents = [
3838
export var registerConfig = [
3939
{
4040
component: IgxActionStripComponent,
41+
selector: "igc-action-strip",
4142
parents: [
4243
IgxGridComponent,
4344
IgxTreeGridComponent,
@@ -58,6 +59,7 @@ export var registerConfig = [
5859
},
5960
{
6061
component: IgxColumnComponent,
62+
selector: "igc-column",
6163
parents: [
6264
IgxGridComponent,
6365
IgxTreeGridComponent,
@@ -113,6 +115,7 @@ export var registerConfig = [
113115
},
114116
{
115117
component: IgxColumnGroupComponent,
118+
selector: "igc-column-group",
116119
parents: [
117120
IgxGridComponent,
118121
IgxTreeGridComponent,
@@ -173,6 +176,7 @@ export var registerConfig = [
173176
},
174177
{
175178
component: IgxColumnLayoutComponent,
179+
selector: "igc-column-layout",
176180
parents: [IgxGridComponent],
177181
contentQueries: [
178182
{
@@ -227,6 +231,7 @@ export var registerConfig = [
227231
},
228232
{
229233
component: IgxGridComponent,
234+
selector: "igc-grid",
230235
parents: [],
231236
contentQueries: [
232237
{
@@ -395,6 +400,7 @@ export var registerConfig = [
395400
},
396401
{
397402
component: IgxGridEditingActionsComponent,
403+
selector: "igc-grid-editing-actions",
398404
parents: [IgxActionStripComponent],
399405
contentQueries: [],
400406
additionalProperties: [{ name: "hasChildren" }],
@@ -404,6 +410,7 @@ export var registerConfig = [
404410
},
405411
{
406412
component: IgxGridPinningActionsComponent,
413+
selector: "igc-grid-pinning-actions",
407414
parents: [IgxActionStripComponent],
408415
contentQueries: [],
409416
additionalProperties: [],
@@ -413,6 +420,7 @@ export var registerConfig = [
413420
},
414421
{
415422
component: IgxGridStateComponent,
423+
selector: "igc-grid-state",
416424
parents: [
417425
IgxGridComponent,
418426
IgxTreeGridComponent,
@@ -430,20 +438,23 @@ export var registerConfig = [
430438
},
431439
{
432440
component: IgxGridToolbarActionsComponent,
441+
selector: "igc-grid-toolbar-actions",
433442
parents: [IgxGridToolbarComponent],
434443
contentQueries: [],
435444
additionalProperties: [],
436445
methods: [],
437446
},
438447
{
439448
component: IgxGridToolbarAdvancedFilteringComponent,
449+
selector: "igc-grid-toolbar-advanced-filtering",
440450
parents: [IgxGridToolbarComponent],
441451
contentQueries: [],
442452
additionalProperties: [],
443453
methods: [],
444454
},
445455
{
446456
component: IgxGridToolbarComponent,
457+
selector: "igc-grid-toolbar",
447458
parents: [
448459
IgxGridComponent,
449460
IgxTreeGridComponent,
@@ -460,6 +471,7 @@ export var registerConfig = [
460471
},
461472
{
462473
component: IgxGridToolbarExporterComponent,
474+
selector: "igc-grid-toolbar-exporter",
463475
parents: [IgxGridToolbarComponent],
464476
contentQueries: [],
465477
additionalProperties: [],
@@ -468,6 +480,7 @@ export var registerConfig = [
468480
},
469481
{
470482
component: IgxGridToolbarHidingComponent,
483+
selector: "igc-grid-toolbar-hiding",
471484
parents: [IgxGridToolbarComponent],
472485
contentQueries: [],
473486
additionalProperties: [],
@@ -477,6 +490,7 @@ export var registerConfig = [
477490
},
478491
{
479492
component: IgxGridToolbarPinningComponent,
493+
selector: "igc-grid-toolbar-pinning",
480494
parents: [IgxGridToolbarComponent],
481495
contentQueries: [],
482496
additionalProperties: [],
@@ -486,13 +500,15 @@ export var registerConfig = [
486500
},
487501
{
488502
component: IgxGridToolbarTitleComponent,
503+
selector: "igc-grid-toolbar-title",
489504
parents: [IgxGridToolbarComponent],
490505
contentQueries: [],
491506
additionalProperties: [],
492507
methods: [],
493508
},
494509
{
495510
component: IgxHierarchicalGridComponent,
511+
selector: "igc-hierarchical-grid",
496512
parents: [],
497513
contentQueries: [
498514
{
@@ -665,6 +681,7 @@ export var registerConfig = [
665681
},
666682
{
667683
component: IgxPaginatorComponent,
684+
selector: "igc-paginator",
668685
parents: [
669686
IgxGridComponent,
670687
IgxTreeGridComponent,
@@ -684,6 +701,7 @@ export var registerConfig = [
684701
},
685702
{
686703
component: IgxPivotDataSelectorComponent,
704+
selector: "igc-pivot-data-selector",
687705
parents: [],
688706
contentQueries: [],
689707
additionalProperties: [{ name: "animationSettings", writable: true }],
@@ -697,6 +715,7 @@ export var registerConfig = [
697715
},
698716
{
699717
component: IgxPivotGridComponent,
718+
selector: "igc-pivot-grid",
700719
parents: [],
701720
contentQueries: [
702721
{
@@ -809,6 +828,7 @@ export var registerConfig = [
809828
},
810829
{
811830
component: IgxRowIslandComponent,
831+
selector: "igc-row-island",
812832
parents: [IgxHierarchicalGridComponent, IgxRowIslandComponent],
813833
contentQueries: [
814834
{
@@ -957,6 +977,7 @@ export var registerConfig = [
957977
},
958978
{
959979
component: IgxTreeGridComponent,
980+
selector: "igc-tree-grid",
960981
parents: [],
961982
contentQueries: [
962983
{

projects/igniteui-angular-elements/src/analyzer/printer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export class AnalyzerPrinter {
7171
private createMetaLiteralObject([type, meta]: readonly [ts.InterfaceType, ComponentMetadata]) {
7272
const properties = [
7373
ts.factory.createPropertyAssignment('component', ts.factory.createIdentifier(type.symbol.name)),
74+
ts.factory.createPropertyAssignment('selector', ts.factory.createStringLiteral(meta.selector)),
7475
ts.factory.createPropertyAssignment('parents', ts.factory.createArrayLiteralExpression(meta.parents.map(x => ts.factory.createIdentifier(x.symbol.name)))),
7576
ts.factory.createPropertyAssignment('contentQueries', ts.factory.createArrayLiteralExpression(meta.contentQueries.map(x => this.createContentQueryLiteral(x)))),
7677
ts.factory.createPropertyAssignment('additionalProperties', ts.factory.createArrayLiteralExpression(meta.additionalProperties.map(x => this.createPropertyLiteral(x)))),

projects/igniteui-angular-elements/src/analyzer/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type ContentQuery = {
1111
}
1212

1313
export type ComponentMetadata<T = ts.InterfaceType> = {
14+
selector: string;
1415
parents: T[],
1516
contentQueries: ContentQuery[],
1617
methods: MethodInfo[],

projects/igniteui-angular-elements/src/analyzer/utils.ts

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ export function asString(x?: ts.Symbol) {
9696
return x ? x.escapedName.toString() : '';
9797
}
9898

99+
/** Get the properties of the `@Component({ ...properties })` decorator object param */
100+
function getDecoratorProps(component: ts.ClassDeclaration): ts.NodeArray<ts.ObjectLiteralElementLike> | null {
101+
const expression = getDecorators(component)?.find(x => getDecoratorName(x) === 'Component')?.expression;
102+
103+
if (!expression || !ts.isCallExpression(expression))
104+
return null;
105+
106+
const args = [...expression.arguments];
107+
108+
if (!ts.isObjectLiteralExpression(args[0]))
109+
return null;
110+
111+
const literal = args[0];
112+
return literal?.properties;
113+
}
99114

100115
/**
101116
* Looks through the component decorator for providers that match the existing class to a different type/token, such as:
@@ -113,18 +128,8 @@ export function asString(x?: ts.Symbol) {
113128
* @returns Alternative type/token the component is provided as OR null
114129
*/
115130
export function getProvidedAs(component: ts.ClassDeclaration, type: ts.InterfaceType) {
116-
const expression = getDecorators(component)?.find(x => getDecoratorName(x) === 'Component')?.expression;
117-
118-
if (!expression || !ts.isCallExpression(expression))
119-
return null;
120-
121-
const args = [...expression.arguments];
122-
123-
if (!ts.isObjectLiteralExpression(args[0]))
124-
return null;
125-
126-
const literal = args[0];
127-
const providers = literal?.properties.find(x => x.name?.getText() === 'providers');
131+
const properties = getDecoratorProps(component);
132+
const providers = properties?.find(x => x.name?.getText() === 'providers');
128133
if (!(providers && ts.isPropertyAssignment(providers) && ts.isArrayLiteralExpression(providers.initializer)))
129134
return null;
130135

@@ -141,6 +146,21 @@ export function getProvidedAs(component: ts.ClassDeclaration, type: ts.Interface
141146

142147
}
143148

149+
/**
150+
* Get the selector from the component decorator
151+
* @param component The component node
152+
* @param replace Find and replace pair
153+
* @returns The transformed selector as OR null
154+
*/
155+
export function getSelector(component: ts.ClassDeclaration, replace: [string, string]) {
156+
const properties = getDecoratorProps(component);
157+
const selector = properties?.find(x => x.name?.getText() === 'selector');
158+
if (!(selector && ts.isPropertyAssignment(selector) && ts.isStringLiteral(selector.initializer)))
159+
return null;
160+
161+
return selector.initializer.text.replace(replace[0], replace[1]);
162+
}
163+
144164

145165
/**
146166
* Get type identifier from expression, unpacking Angular's `forwardRef` if needed.

0 commit comments

Comments
 (0)