Skip to content

Commit 6ef7e14

Browse files
dobromirtszdrawkuAleksandyr
authored
fix(lint): Silder and progressbar lint warnings and on event renaming (#9045)
* fix(lint): Silder and progressbar lint warnings and on event renaming * chore(*): fix onChange lint warning * chore(*): move migrations to 12.0 * chore(*): add migrations index file * chore(*): add migration-collection * chore(*): add progressbar migrations * chore(*): change version in migration-collection * chore(*): refactor progressbar migrations * chore(*): rename valueChanged event * chore(*): rename emitValueChanged method Co-authored-by: Zdravko Kolev <[email protected]> Co-authored-by: Aleksandar Kamenov <[email protected]>
1 parent 4a83d14 commit 6ef7e14

File tree

14 files changed

+179
-61
lines changed

14 files changed

+179
-61
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ All notable changes for each version of this project will be documented in this
121121
```
122122

123123

124+
### General:
125+
- `IgxSliderComponent`
126+
- **Breaking Change** - The following outputs are renamed:
127+
- `onValueChange` to `valueChange`
128+
- `onValueChanged` to `dragFinished`
129+
- `IgxCircularProgressBarComponent`
130+
- **Breaking Change** - The following outputs are renamed:
131+
- `onProgressChanged` to `progressChanged`
132+
- `IgxLinearProgressBarComponent`
133+
- **Breaking Change** - The following outputs are renamed:
134+
- `onProgressChanged` to `progressChanged`
135+
124136
## 11.1.1
125137

126138
### New Features

projects/igniteui-angular/migrations/update-12_0_0/changes/members.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,34 @@
3636
"IgxColumnActionsComponent"
3737
]
3838
},
39+
{
40+
"member": "onValueChange",
41+
"replaceWith": "valueChange",
42+
"definedIn": [
43+
"IgxSliderComponent"
44+
]
45+
},
46+
{
47+
"member": "onValueChanged",
48+
"replaceWith": "dragFinished",
49+
"definedIn": [
50+
"IgxSliderComponent"
51+
]
52+
},
53+
{
54+
"member": "onProgressChanged",
55+
"replaceWith": "progressChanged",
56+
"definedIn": [
57+
"IgxLinearProgressBarComponent"
58+
]
59+
},
60+
{
61+
"member": "onProgressChanged",
62+
"replaceWith": "progressChanged",
63+
"definedIn": [
64+
"IgxCircularProgressBarComponent"
65+
]
66+
},
3967
{
4068
"member": "onColumnChange",
4169
"replaceWith": "columnChange",

projects/igniteui-angular/migrations/update-12_0_0/changes/outputs.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,38 @@
152152
"selector": "igx-column-actions",
153153
"type": "component"
154154
}
155+
},
156+
{
157+
"name": "onValueChange",
158+
"replaceWith": "valueChange",
159+
"owner": {
160+
"selector": "igx-slider",
161+
"type": "component"
162+
}
163+
},
164+
{
165+
"name": "onValueChanged",
166+
"replaceWith": "dragFinished",
167+
"owner": {
168+
"selector": "igx-slider",
169+
"type": "component"
170+
}
171+
},
172+
{
173+
"name": "onProgressChanged",
174+
"replaceWith": "progressChanged",
175+
"owner": {
176+
"selector": "igx-linear-bar",
177+
"type": "component"
178+
}
179+
},
180+
{
181+
"name": "onProgressChanged",
182+
"replaceWith": "progressChanged",
183+
"owner": {
184+
"selector": "igx-circular-bar",
185+
"type": "component"
186+
}
155187
}
156188
]
157189
}

projects/igniteui-angular/migrations/update-12_0_0/index.spec.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,51 @@ $theme: igx-avatar-theme(
8989
);
9090
});
9191

92+
it('should replace onValueChange and onValueChanged with valueChange and dragFinished in igx-slider', async () => {
93+
appTree.create(
94+
`/testSrc/appPrefix/component/slider.component.html`,
95+
`<igx-slider
96+
(onValueChange)="someHandler($event)"
97+
(onValueChanged)="someHandler($event)"
98+
></igx-slider>`
99+
);
100+
101+
const tree = await schematicRunner.runSchematicAsync(migrationName, {}, appTree).toPromise();
102+
103+
expect(tree.readContent('/testSrc/appPrefix/component/slider.component.html')).toEqual(
104+
`<igx-slider
105+
(valueChange)="someHandler($event)"
106+
(dragFinished)="someHandler($event)"
107+
></igx-slider>`
108+
);
109+
});
110+
111+
it('should replace onProgressChanged with progressChanged in igx-linear-bar', async () => {
112+
appTree.create(
113+
`/testSrc/appPrefix/component/linear.component.html`,
114+
`<igx-linear-bar [value]="currentValue" (onProgressChanged)="progressChange($event)"></igx-linear-bar>`
115+
);
116+
117+
const tree = await schematicRunner.runSchematicAsync(migrationName, {}, appTree).toPromise();
118+
119+
expect(tree.readContent('/testSrc/appPrefix/component/linear.component.html')).toEqual(
120+
`<igx-linear-bar [value]="currentValue" (progressChanged)="progressChange($event)"></igx-linear-bar>`
121+
);
122+
});
123+
124+
it('should replace onProgressChanged with progressChanged in igx-circular-bar', async () => {
125+
appTree.create(
126+
`/testSrc/appPrefix/component/circular.component.html`,
127+
`<igx-circular-bar [value]="currentValue" (onProgressChanged)="progressChange($event)"></igx-circular-bar>`
128+
);
129+
130+
const tree = await schematicRunner.runSchematicAsync(migrationName, {}, appTree).toPromise();
131+
132+
expect(tree.readContent('/testSrc/appPrefix/component/circular.component.html')).toEqual(
133+
`<igx-circular-bar [value]="currentValue" (progressChanged)="progressChange($event)"></igx-circular-bar>`
134+
);
135+
});
136+
92137
// IgxTabs
93138
it('Should update igx-tab-group to igx-tab-item', async () => {
94139
appTree.create(

projects/igniteui-angular/src/lib/progressbar/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export class AppModule {}
2424
### Basic configuration
2525

2626
```html
27-
<igx-circular-bar [value]="currentValue" [max]="100" [animate]="true" [textVisibility]="false" (onProgressChanged)="progresChanged($event)"></igx-circular-bar>
27+
<igx-circular-bar [value]="currentValue" [max]="100" [animate]="true" [textVisibility]="false" (progressChanged)="progresChange($event)"></igx-circular-bar>
2828

29-
<igx-linear-bar type="warning" [text]="'Custom text'" [textAlign]="positionCenter" [textTop]="true" [striped]="true" [textVisibility]="true" (onProgressChanged)="progresChanged($event)"></igx-linear-bar>>
29+
<igx-linear-bar type="warning" [text]="'Custom text'" [textAlign]="positionCenter" [textTop]="true" [striped]="true" [textVisibility]="true" (progressChanged)="progresChange($event)"></igx-linear-bar>>
3030
```
3131

3232
# API Summary
@@ -58,4 +58,4 @@ export class AppModule {}
5858
|:----------|:------|
5959
| `getValue()` | Return passed value to progress bar to be in range between min(0) and max. |
6060
| `getPercentValue()` | Calculate the percentage based on passed value. |
61-
| `onProgressChanged` | Exposed event, that could be handled to track progress changing |
61+
| `progressChanged` | Exposed event, that could be handled to track progress changing |

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ export abstract class BaseProgressDirective {
5858
* //...
5959
* ```
6060
* ```html
61-
* <igx-circular-bar [value]="currentValue" (onProgressChanged)="progressChange($event)"></igx-circular-bar>
62-
* <igx-linear-bar [value]="currentValue" (onProgressChanged)="progressChange($event)"></igx-linear-bar>
61+
* <igx-circular-bar [value]="currentValue" (progressChanged)="progressChange($event)"></igx-circular-bar>
62+
* <igx-linear-bar [value]="currentValue" (progressChanged)="progressChange($event)"></igx-linear-bar>
6363
* ```
6464
*/
6565
@Output()
66-
public onProgressChanged = new EventEmitter<IChangeProgressEventArgs>();
66+
public progressChanged = new EventEmitter<IChangeProgressEventArgs>();
6767

6868
protected _initValue = 0;
6969
protected _contentInit = false;
@@ -88,7 +88,7 @@ export abstract class BaseProgressDirective {
8888
* ```
8989
*/
9090
@Input()
91-
get step(): number {
91+
public get step(): number {
9292
if (this._step) {
9393
return this._step;
9494
}
@@ -103,7 +103,7 @@ export abstract class BaseProgressDirective {
103103
* <igx-circular-bar [max]="200" [value]="0" [step]="1"></igx-circular-bar>
104104
* ```
105105
*/
106-
set step(val: number) {
106+
public set step(val: number) {
107107
this._step = Number(val);
108108
}
109109

@@ -143,7 +143,7 @@ export abstract class BaseProgressDirective {
143143
*/
144144
@HostBinding('attr.aria-valuemax')
145145
@Input()
146-
set max(maxNum: number) {
146+
public set max(maxNum: number) {
147147
this._max = maxNum;
148148
}
149149

@@ -158,7 +158,7 @@ export abstract class BaseProgressDirective {
158158
* }
159159
* ```
160160
*/
161-
get max() {
161+
public get max() {
162162
return this._max;
163163
}
164164

@@ -208,7 +208,7 @@ export abstract class BaseProgressDirective {
208208
this.updateProgressDirectly(newVal);
209209
}
210210

211-
this.onProgressChanged.emit(changedValues);
211+
this.progressChanged.emit(changedValues);
212212
}
213213

214214
/**
@@ -416,7 +416,7 @@ export class IgxLinearProgressBarComponent extends BaseProgressDirective impleme
416416
*/
417417
@HostBinding('attr.aria-valuenow')
418418
@Input()
419-
get value(): number {
419+
public get value(): number {
420420
return this._value;
421421
}
422422

@@ -426,7 +426,7 @@ export class IgxLinearProgressBarComponent extends BaseProgressDirective impleme
426426
* <igx-linear-bar [striped]="false" [max]="200" [value]="50"></igx-linear-bar>
427427
* ```
428428
*/
429-
set value(val) {
429+
public set value(val) {
430430
const valInRange = valueInRange(val, this.max);
431431
if (isNaN(valInRange) || this._value === val || this.indeterminate) {
432432
return;
@@ -567,7 +567,7 @@ export class IgxCircularProgressBarComponent extends BaseProgressDirective imple
567567
* ```
568568
*/
569569
@Input()
570-
get value(): number {
570+
public get value(): number {
571571
return this._value;
572572
}
573573

@@ -577,7 +577,7 @@ export class IgxCircularProgressBarComponent extends BaseProgressDirective imple
577577
* <igx-circular-bar [value]="50"></igx-circular-bar>
578578
* ```
579579
*/
580-
set value(val: number) {
580+
public set value(val: number) {
581581
const valInRange = valueInRange(val, this.max);
582582
if (isNaN(valInRange) || this._value === val || this.indeterminate) {
583583
return;

projects/igniteui-angular/src/lib/slider/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,5 @@ import { IgxSliderComponent } from "../../../src/main";
7676

7777
| Name | Description |
7878
| :--- | :--- |
79-
| onValueChange | This event is emitted when user has stopped interacting the thumb and value is changed. |
79+
| valueChange | This event is emitted when user has stopped interacting the thumb and value is changed. |
80+
| valueChanged | This event is emitted at the end of every slide interaction.

projects/igniteui-angular/src/lib/slider/slider.common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Directive } from '@angular/core';
2-
import { IBaseEventArgs, mkenum } from '../core/utils';
2+
import { mkenum } from '../core/utils';
33

44
/**
55
* Template directive that allows you to set a custom template representing the lower label value of the {@link IgxSliderComponent}

projects/igniteui-angular/src/lib/slider/slider.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
[step]="step"
5454
[templateRef]="thumbFromTemplateRef"
5555
[context]="context"
56-
(onChange)="onThumbChange()"
57-
(onHoverChange)="onHoverChange($event)"
56+
(thumbChange)="onThumbChange()"
57+
(hoverChange)="onHoverChange($event)"
5858
[deactiveState]="deactivateThumbLabel"
5959
[thumbLabelVisibilityDuration]="thumbLabelVisibilityDuration"></igx-thumb>
6060

@@ -78,8 +78,8 @@
7878
[step]="step"
7979
[templateRef]="thumbToTemplateRef"
8080
[context]="context"
81-
(onChange)="onThumbChange()"
82-
(onHoverChange)="onHoverChange($event)"
81+
(thumbChange)="onThumbChange()"
82+
(hoverChange)="onHoverChange($event)"
8383
[deactiveState]="deactivateThumbLabel"
8484
[thumbLabelVisibilityDuration]="thumbLabelVisibilityDuration"></igx-thumb>
8585
</div>

0 commit comments

Comments
 (0)