Skip to content

Commit 24f153a

Browse files
committed
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular into ha-mutliview-calendar-2
2 parents 74eeda2 + 09823db commit 24f153a

File tree

6 files changed

+44
-29
lines changed

6 files changed

+44
-29
lines changed

.travis.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
sudo: required
2-
dist: trusty
2+
dist: xenial
3+
addons:
4+
apt:
5+
sources:
6+
- google-chrome
7+
packages:
8+
- google-chrome-stable
9+
services:
10+
- xvfb
311
language: node_js
412
node_js:
513
- '10.12.0'
614
before_install:
715
- export NG_CLI_ANALYTICS=false
8-
- export CHROME_BIN=/usr/bin/google-chrome
916
- export DISPLAY=:99.0
10-
- sh -e /etc/init.d/xvfb start
11-
- sudo apt-get -qq update
12-
- sudo apt-get install -y libappindicator1 fonts-liberation
13-
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
14-
- sudo dpkg -i google-chrome*.deb
15-
- sleep 3
1617
before_script:
1718
# more heap mem per https://github.com/angular/angular-cli/issues/12645, https://github.com/npm/npm/issues/12238#issuecomment-367147962
1819
- export NODE_OPTIONS="--max_old_space_size=4096"

projects/igniteui-angular/src/lib/core/styles/components/chip/_chip-theme.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/// Chip Theme
88
/// @param {Map} $palette [$default-palette] - The palette used as basis for styling the component.
9-
/// @param {Color} $border-radius [null] - The chip border-radius.
9+
/// @param {String} $border-radius [null] - The chip border-radius.
1010
///
1111
/// @param {Color} $text-color [null] - The chip text color.
1212
/// @param {Color} $background [null] - The chip background color.

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

+20-18
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,23 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
372372
@Output()
373373
public dragEnd = new EventEmitter<IDragBaseEventArgs>();
374374

375+
/**
376+
* Event triggered when the draggable element is clicked.
377+
* ```html
378+
* <div igxDrag (dragClick)="onDragClick()">
379+
* <span>Drag Me!</span>
380+
* </div>
381+
* ```
382+
* ```typescript
383+
* public onDragClick(){
384+
* alert("The element has been clicked!");
385+
* }
386+
* ```
387+
* @memberof IgxDragDirective
388+
*/
389+
@Output()
390+
public dragClick = new EventEmitter<IDragBaseEventArgs>();
391+
375392
/**
376393
* Event triggered when the drag ghost element is created.
377394
* ```html
@@ -423,24 +440,6 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
423440
@Output()
424441
public transitioned = new EventEmitter<IDragBaseEventArgs>();
425442

426-
/**
427-
* @deprecated
428-
* Event triggered when the draggable element is clicked.
429-
* ```html
430-
* <div igxDrag (dragClicked)="dragClicked()">
431-
* <span>Drag Me!</span>
432-
* </div>
433-
* ```
434-
* ```typescript
435-
* public dragClicked(){
436-
* alert("The element has been clicked!");
437-
* }
438-
* ```
439-
* @memberof IgxDragDirective
440-
*/
441-
@Output()
442-
public dragClicked = new EventEmitter<IDragBaseEventArgs>();
443-
444443
/**
445444
* @hidden
446445
*/
@@ -1046,6 +1045,9 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
10461045
if (!this.animInProgress) {
10471046
this.onTransitionEnd(null);
10481047
}
1048+
} else {
1049+
// Trigger our own click event because when there is no ghost, native click cannot be prevented when dragging.
1050+
this.dragClick.emit(eventArgs);
10491051
}
10501052
}
10511053

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

+8
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ describe('General igxDrag/igxDrop', () => {
190190

191191
spyOn(firstDrag.ghostCreate, 'emit');
192192
spyOn(firstDrag.ghostDestroy, 'emit');
193+
spyOn(firstDrag.dragClick, 'emit');
193194
expect(document.getElementsByClassName('dragElem').length).toEqual(3);
194195

195196
// Step 1.
@@ -199,6 +200,7 @@ describe('General igxDrag/igxDrop', () => {
199200

200201
expect(firstDrag.ghostCreate.emit).not.toHaveBeenCalled();
201202
expect(firstDrag.ghostDestroy.emit).not.toHaveBeenCalled();
203+
expect(firstDrag.dragClick.emit).not.toHaveBeenCalled();
202204

203205
// Step 2.
204206
UIInteractions.simulatePointerEvent('pointermove', firstElement, startingX + 10, startingY + 10);
@@ -209,6 +211,7 @@ describe('General igxDrag/igxDrop', () => {
209211
expect(document.getElementsByClassName('dragElem').length).toEqual(3);
210212
expect(firstDrag.ghostCreate.emit).not.toHaveBeenCalled();
211213
expect(firstDrag.ghostDestroy.emit).not.toHaveBeenCalled();
214+
expect(firstDrag.dragClick.emit).not.toHaveBeenCalled();
212215

213216
// Step 3.
214217
// We need to trigger the pointerup on the ghostElement because this is the element we move and is under the mouse
@@ -220,6 +223,7 @@ describe('General igxDrag/igxDrop', () => {
220223
expect(document.getElementsByClassName('dragElem').length).toEqual(3);
221224
expect(firstDrag.ghostCreate.emit).not.toHaveBeenCalled();
222225
expect(firstDrag.ghostDestroy.emit).not.toHaveBeenCalled();
226+
expect(firstDrag.dragClick.emit).toHaveBeenCalled();
223227
}));
224228

225229
it('should position ghost at the same position relative to the mouse when drag started.', (async() => {
@@ -454,6 +458,7 @@ describe('General igxDrag/igxDrop', () => {
454458
firstDrag.dragTolerance = 25;
455459

456460
spyOn(firstDrag.dragStart, 'emit');
461+
spyOn(firstDrag.dragClick, 'emit');
457462

458463
// Step 1.
459464
UIInteractions.simulatePointerEvent('pointerdown', firstElement, startingX, startingY);
@@ -471,6 +476,7 @@ describe('General igxDrag/igxDrop', () => {
471476
expect(firstElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left);
472477
expect(firstElement.getBoundingClientRect().top).toEqual(dragDirsRects[0].top);
473478
expect(firstDrag.dragStart.emit).not.toHaveBeenCalled();
479+
expect(firstDrag.dragClick.emit).not.toHaveBeenCalled();
474480

475481
// Step 3.
476482
UIInteractions.simulatePointerEvent('pointermove', firstElement, startingX + 20, startingY + 20);
@@ -481,6 +487,7 @@ describe('General igxDrag/igxDrop', () => {
481487
expect(firstElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left);
482488
expect(firstElement.getBoundingClientRect().top).toEqual(dragDirsRects[0].top);
483489
expect(firstDrag.dragStart.emit).not.toHaveBeenCalled();
490+
expect(firstDrag.dragClick.emit).not.toHaveBeenCalled();
484491

485492
// Step 4.
486493
UIInteractions.simulatePointerEvent('pointerup', firstElement, startingX + 20, startingY + 20);
@@ -490,6 +497,7 @@ describe('General igxDrag/igxDrop', () => {
490497
expect(firstElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left);
491498
expect(firstElement.getBoundingClientRect().top).toEqual(dragDirsRects[0].top);
492499
expect(firstDrag.dragStart.emit).not.toHaveBeenCalled();
500+
expect(firstDrag.dragClick.emit).toHaveBeenCalled();
493501
}));
494502

495503
it('should correctly apply dragTolerance of 0 when it is set to 0 and ghost is disabled.', (async() => {

src/app/drag-drop/drag-drop.sample.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h4 class="sample-title">No ghost dragging:</h4>
66
<div [style.height.px]="100">
77
<div [igxDrag]="{ dragged: false }" [ghost]="false" class="dialog" [dragChannel]="['Suspect']"
8-
(dragStart)="draggedElem = true" (dragEnd)="draggedElem = false">
8+
(dragStart)="draggedElem = true" (dragEnd)="draggedElem = false" (dragClick)="dragClick($event)">
99
<span *ngIf="!draggedElem">Drag me</span>
1010
<span *ngIf="draggedElem">Weeeee</span>
1111
</div>
@@ -15,7 +15,7 @@ <h4 class="sample-title">Ghost and base templating:</h4>
1515
<div #ghostHost [style.height.px]="100">
1616
<div [igxDrag]="{ id: 'customGhost'}" [dragChannel]="'Suspect'" [ghostTemplate]="dragGhost"
1717
[ngClass]="customDragged ? 'dragWithGhostPlaceholder' : 'dragWithGhostDefault'"
18-
(dragStart)="customDragged = true" (dragEnd)="customDragged = false">
18+
(dragStart)="customDragged = true" (dragEnd)="customDragged = false" (dragClick)="dragClick($event)">
1919
<span *ngIf="!customDragged">Drag me</span>
2020
<ng-template #dragGhost>
2121
<div class="customGhost">

src/app/drag-drop/drag-drop.sample.ts

+4
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,8 @@ export class DragDropSampleComponent {
365365
}
366366
});
367367
}
368+
369+
public dragClick() {
370+
console.log('click');
371+
}
368372
}

0 commit comments

Comments
 (0)