Skip to content

Commit e728fc1

Browse files
authored
Merge pull request #10427 from IgniteUI/mevtimov/fix-10365-master
Remove deprecateDecorators
2 parents e1ca089 + 91d049c commit e728fc1

File tree

17 files changed

+86
-215
lines changed

17 files changed

+86
-215
lines changed

.github/CONTRIBUTING.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,27 @@ Write migrations.
170170

171171
## Deprecating methods
172172
When a method is deprecated a few steps have to be done:
173-
1. Add deprecation warning message by decorating the method with `@DeprecateMethod` decorator from `deprecateDecorators.ts` file.
173+
1. Add the `@deprecated` tag at the begging of the method description followed by the version in which the method has been deprecated and what can be used instead. Example:
174+
```ts
175+
/**
176+
* @deprecated in version 12.1.0. Use 'data' instead
177+
*
178+
* The data record that populates the row
179+
*/
180+
public getRowData(): any {
181+
return this.data;
182+
}
183+
```
174184
2. Ensure that the deprecated method is no longer used in IgniteUI for Angular codebase, samples and documentation snippets.
175185
3. Write migrations.
176186

177187
## Deprecating class properties
178188
When a class property is deprecated a few steps have to be done:
179-
1. Add deprecation warning message by decorating the property with `@DeprecateProperty` decorator from `deprecateDecorators.ts` file.
189+
1. Add the `@deprecated` tag at the begging of the property description followed by the version in which the property has been deprecated and what can be used instead.
180190
2. Ensure that the deprecated property is no longer used in IgniteUI for Angular codebase, samples and documentation snippets.
181191
3. Write migrations.
182192

183-
NOTE: TypeScript disallows decorating both the get and set accessor for a single member. Instead, all decorators for the member must be applied to the first accessor specified in document order. This is because decorators apply to a Property Descriptor, which combines both the get and set accessor, not each declaration separately.
193+
NOTE: TypeScript disallows adding descriptions to both the get and set accessor for a single member. Instead, the description for the member must be applied to the first accessor specified in document order. Having this in mind the `@deprecated` tag is applied only once.
184194

185195
# Testing a PR
186196
In order to test a pull request that is awaiting test, perform the following actions.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { filter, Rule, SchematicContext, Tree } from '@angular-devkit/schematics
22
import { getWorkspace, getWorkspacePath, getProjectPaths } from './util';
33

44
/**
5-
* Filter tree to project source dirs
6-
*
75
* @deprecated Temporary
6+
*
7+
* Filter tree to project source dirs
88
*/
99
export const filterSourceDirs = (host: Tree, context: SchematicContext): Rule => {
1010
const configPath = getWorkspacePath(host);

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, HostBinding, Input } from '@angular/core';
22
import { IgxGridActionsBaseDirective } from './grid-actions-base.directive';
3-
import { showMessage } from '../../core/deprecateDecorators';
3+
import { showMessage } from '../../core/utils';
44
import { addRow, addChild } from '@igniteui/material-icons-extended';
55

66
@Component({

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import { ToggleAnimationSettings } from '../expansion-panel/toggle-animation-com
1313

1414
export interface BannerEventArgs extends IBaseEventArgs {
1515
/**
16-
* @deprecated
17-
* To get a reference to the banner, use `owner` instead.
16+
* @deprecated in 12.1.0. To get a reference to the banner, use `owner` instead
1817
*/
1918
banner: IgxBannerComponent;
2019
event?: Event;

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

-115
This file was deleted.

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

+12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ import {
2525
swingOutLefttFwd, swingOutRightBck, swingOutRightFwd, swingOutTopBck, swingOutTopFwd
2626
} from '../animations/main';
2727
import { setImmediate } from './setImmediate';
28+
import { isDevMode } from '@angular/core';
29+
30+
/**
31+
* @hidden
32+
*/
33+
export const showMessage = (message: string, isMessageShown: boolean): boolean => {
34+
if (!isMessageShown && isDevMode()) {
35+
console.warn(message);
36+
}
37+
38+
return true;
39+
};
2840

2941
export const mkenum = <T extends { [index: string]: U }, U extends string>(x: T) => x;
3042

projects/igniteui-angular/src/lib/directives/radio/radio-group.directive.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { IgxRippleModule } from '../ripple/ripple.directive';
1616
import { takeUntil } from 'rxjs/operators';
1717
import { noop, Subject } from 'rxjs';
1818
import { mkenum } from '../../core/utils';
19-
import { DeprecateProperty } from '../../core/deprecateDecorators';
2019

2120
/**
2221
* Determines the Radio Group alignment
@@ -129,16 +128,15 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
129128
}
130129

131130
/**
132-
* An @Input property that allows you to disable the radio group. By default it's false.
133-
*
134131
* @deprecated in version 12.2.0
135132
*
133+
* An input property that allows you to disable the radio group. By default it's false.
134+
*
136135
* @example
137136
* ```html
138137
* <igx-radio-group disabled></igx-radio-group>
139138
* ```
140139
*/
141-
@DeprecateProperty('`disabled` is deprecated.')
142140
@Input()
143141
public get disabled(): boolean {
144142
return this._disabled;
@@ -149,10 +147,10 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
149147
}
150148

151149
/**
152-
* Sets/gets the position of the `label` in the child radio buttons.
153-
*
154150
* @deprecated in version 12.2.0
155151
*
152+
* Sets/gets the position of the `label` in the child radio buttons.
153+
*
156154
* @remarks
157155
* If not set, `labelPosition` will have value `"after"`.
158156
*
@@ -161,7 +159,6 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
161159
* <igx-radio-group labelPosition = "before"></igx-radio-group>
162160
* ```
163161
*/
164-
@DeprecateProperty('`labelPosition` is deprecated.')
165162
@Input()
166163
public get labelPosition(): RadioLabelPosition | string {
167164
return this._labelPosition;

projects/igniteui-angular/src/lib/drop-down/drop-down-item.base.ts

-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { IDropDownBase, IGX_DROPDOWN_BASE } from './drop-down.common';
22
import { Directive, Input, HostBinding, HostListener, ElementRef, Optional, Inject, DoCheck, Output, EventEmitter } from '@angular/core';
33
import { IgxSelectionAPIService } from '../core/selection';
4-
import { showMessage } from '../core/deprecateDecorators';
54
import { IgxDropDownGroupComponent } from './drop-down-group.component';
65

76
let NEXT_ID = 0;
8-
let warningShown = false;
97

108
/**
119
* An abstract class defining a drop-down item:
@@ -57,10 +55,6 @@ export class IgxDropDownItemBaseDirective implements DoCheck {
5755
@Input()
5856
public get index(): number {
5957
if (this._index === null) {
60-
warningShown = showMessage(
61-
'IgxDropDownItemBaseDirective: Automatic index is deprecated.' +
62-
'Bind in the template instead using `<igx-drop-down-item [index]="i"` instead.`',
63-
warningShown);
6458
return this.itemIndex;
6559
}
6660
return this._index;

projects/igniteui-angular/src/lib/grids/cell.component.ts

-14
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { GridBaseAPIService } from './api.service';
1919
import { PlatformUtil } from '../core/utils';
2020
import { IgxGridBaseDirective } from './grid-base.directive';
2121
import { IgxGridSelectionService, ISelectionNode } from './selection/selection.service';
22-
import { DeprecateMethod } from '../core/deprecateDecorators';
2322
import { HammerGesturesManager } from '../core/touch';
2423
import { ColumnType } from './common/column.interface';
2524
import { RowType } from './common/row.interface';
@@ -662,19 +661,6 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
662661
private touchManager: HammerGesturesManager,
663662
protected platformUtil: PlatformUtil) { }
664663

665-
/**
666-
* @deprecated
667-
* Gets whether the cell is selected.
668-
* ```typescript
669-
* let isCellSelected = thid.cell.isCellSelected();
670-
* ```
671-
* @memberof IgxGridCellComponent
672-
*/
673-
@DeprecateMethod(`'isCellSelected' is deprecated. Use 'selected' property instead.`)
674-
public isCellSelected() {
675-
return this.selectionService.selected(this.selectionNode);
676-
}
677-
678664
/**
679665
* @hidden
680666
* @internal

0 commit comments

Comments
 (0)