Skip to content

Commit cecdfd2

Browse files
authored
Merge pull request #7433 from IgniteUI/mkirova/fix-7296
chore(*): Apply changes so that chip does not use deprecated prop in 9.0.x.
2 parents 6864ac0 + 6fa1a60 commit cecdfd2

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

projects/igniteui-angular/src/lib/chips/chip.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
[attr.tabindex]="chipTabindex"
33
(keydown)="onChipKeyDown($event)"
44
[igxDrag]="{chip: this}"
5-
[hideBaseOnDrag]="hideBaseOnDrag"
5+
[style.visibility]='hideBaseElement ? "hidden" : "visible"'
66
[ghostClass]="ghostClass"
77
(dragStart)="onChipDragStart($event)"
8+
(ghostCreate)="onChipGhostCreate()"
9+
(ghostDestroy)="onChipGhostDestroy()"
810
(dragEnd)="onChipDragEnd()"
911
(transitioned)="onChipMoveEnd($event)"
1012
(dragClick)="onChipDragClicked($event)"

projects/igniteui-angular/src/lib/chips/chip.component.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,12 @@ export class IgxChipComponent extends DisplayDensityBase {
437437
return !this.disabled ? 0 : '';
438438
}
439439

440+
/**
441+
* @hidden
442+
* @internal
443+
*/
444+
public hideBaseElement = false;
445+
440446
protected _selected = false;
441447
protected _selectedItemClass = 'igx-chip__item--selected';
442448
protected _movedWhileRemoving = false;
@@ -608,6 +614,22 @@ export class IgxChipComponent extends DisplayDensityBase {
608614
}
609615
}
610616

617+
/**
618+
* @hidden
619+
* @internal
620+
*/
621+
public onChipGhostCreate() {
622+
this.hideBaseElement = this.hideBaseOnDrag;
623+
}
624+
625+
/**
626+
* @hidden
627+
* @internal
628+
*/
629+
public onChipGhostDestroy() {
630+
this.hideBaseElement = false;
631+
}
632+
611633
/**
612634
* @hidden
613635
* @internal

projects/igniteui-angular/src/lib/directives/drag-drop/drag-drop.directive.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ export class IgxDragLocation {
152152
export class IgxDragDirective implements AfterContentInit, OnDestroy {
153153

154154
protected ghostContext: any = null;
155+
protected _hideBaseOnDrag = false;
156+
protected _animateOnRelease = false;
155157

156158
/**
157159
* - Save data inside the `igxDrag` directive. This can be set when instancing `igxDrag` on an element.
@@ -232,7 +234,12 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
232234
@DeprecateProperty(`'hideBaseOnDrag' @Input property is deprecated and will be removed in future major versions.
233235
Alternatives to it are using the new no ghost dragging and custom base styling.`)
234236
@Input()
235-
public hideBaseOnDrag = false;
237+
get hideBaseOnDrag() {
238+
return this._hideBaseOnDrag;
239+
}
240+
set hideBaseOnDrag(val) {
241+
this._hideBaseOnDrag = val;
242+
}
236243

237244
/**
238245
* @deprecated Please use provided transition functions in future.
@@ -249,7 +256,12 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
249256
@DeprecateProperty(`'animateOnRelease' @Input property is deprecated and will be removed in future major versions.
250257
Please use 'transitionToOrigin' or 'transitionTo' methods instead.`)
251258
@Input()
252-
public animateOnRelease = false;
259+
get animateOnRelease() {
260+
return this._animateOnRelease;
261+
}
262+
set animateOnRelease(val) {
263+
this._animateOnRelease = val;
264+
}
253265

254266
/**
255267
* An @Input property that specifies a template for the ghost element created when dragging starts and `ghost` is true.
@@ -1011,7 +1023,7 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
10111023
if (this._dragStarted) {
10121024
if (this._lastDropArea && this._lastDropArea !== this.element.nativeElement ) {
10131025
this.dispatchDropEvent(event.pageX, event.pageY, event);
1014-
} else if (this.animateOnRelease) {
1026+
} else if (this._animateOnRelease) {
10151027
this.transitionToOrigin();
10161028
}
10171029

@@ -1056,7 +1068,7 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
10561068
this.zone.run(() => {
10571069
this.dragEnd.emit(eventArgs);
10581070
});
1059-
if (this.animateOnRelease) {
1071+
if (this._animateOnRelease) {
10601072
this.transitionToOrigin();
10611073
} else if (!this.animInProgress) {
10621074
this.onTransitionEnd(null);
@@ -1146,7 +1158,7 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
11461158
});
11471159

11481160
// Hide the base after the ghostElement is created, because otherwise the ghostElement will be not visible.
1149-
if (this.hideBaseOnDrag) {
1161+
if (this._hideBaseOnDrag) {
11501162
this.visible = false;
11511163
}
11521164

@@ -1239,7 +1251,7 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
12391251
return;
12401252
}
12411253

1242-
if (this.hideBaseOnDrag) {
1254+
if (this._hideBaseOnDrag) {
12431255
this.visible = true;
12441256
}
12451257
this.ghostElement.parentNode.removeChild(this.ghostElement);

0 commit comments

Comments
 (0)