Skip to content

Commit 16e7898

Browse files
authored
Merge branch 'master' into master
2 parents d4bcb15 + 3b6a429 commit 16e7898

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

src/dialog/dialog-config.interface.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ export interface DialogConfig {
1414
content: string | TemplateRef<any>;
1515
/**
1616
* Parameter for triggering `Dialog` display.
17-
* With the release of v2.0 the type will just be "click" or "hover".
1817
*/
1918
trigger: "click" | "hover" | "mouseenter";
19+
/**
20+
* Parameter for triggering the `Dialog` close event.
21+
*/
22+
closeTrigger: "mouseout" | "mouseleave";
2023
/**
2124
* Parameter defining the placement in which the `Dialog` appears.
2225
* @type {Placement}

src/dialog/dialog.directive.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,35 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
3636
static dialogCounter = 0;
3737
/**
3838
* Title for the dialog
39-
* @type {string}
4039
*/
4140
@Input() title = "";
4241
/**
4342
* Dialog body content.
44-
* @type {(string | TemplateRef<any>)}
4543
*/
4644
@Input() ibmDialog: string | TemplateRef<any>;
4745
/**
4846
* Defines how the Dialog is triggered.(Hover and click behave the same on mobile - both respond to a single tap)
49-
* @type {("click" | "hover" | "mouseenter")}
5047
*/
5148
@Input() trigger: "click" | "hover" | "mouseenter" = "click";
49+
/**
50+
* Defines how the Dialog close event is triggered.
51+
*
52+
* [See here](https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseleave_event)
53+
* for more on the difference between `mouseleave` and `mouseout`.
54+
*
55+
* Defaults to `click` when `trigger` is set to `click`.
56+
*/
57+
@Input() closeTrigger: "mouseout" | "mouseleave" = "mouseleave";
5258
/**
5359
* Placement of the dialog, usually relative to the element the directive is on.
5460
*/
5561
@Input() placement = "left";
5662
/**
5763
* Class to add to the dialog container
58-
* @type {string}
5964
*/
6065
@Input() wrapperClass: string;
6166
/**
6267
* Spacing between the dialog and it's triggering element
63-
* @type {number}
6468
*/
6569
@Input() gap = 0;
6670
/**
@@ -117,7 +121,6 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
117121

118122
/**
119123
* Overrides 'touchstart' event to trigger a toggle on the Dialog.
120-
* @param {any} evt
121124
*/
122125
@HostListener("touchstart", ["$event"])
123126
onTouchStart(evt) {
@@ -135,6 +138,7 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
135138
parentRef: this.elementRef,
136139
gap: this.gap,
137140
trigger: this.trigger,
141+
closeTrigger: this.closeTrigger,
138142
appendInline: this.appendInline,
139143
wrapperClass: this.wrapperClass,
140144
data: this.data
@@ -160,7 +164,7 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
160164
// bind events for hovering or clicking the host
161165
if (this.trigger === "hover" || this.trigger === "mouseenter") {
162166
fromEvent(this.elementRef.nativeElement, "mouseenter").subscribe(() => this.toggle());
163-
fromEvent(this.elementRef.nativeElement, "mouseout").subscribe(() => this.close());
167+
fromEvent(this.elementRef.nativeElement, this.closeTrigger).subscribe(() => this.close());
164168
fromEvent(this.elementRef.nativeElement, "focus").subscribe(() => this.open());
165169
fromEvent(this.elementRef.nativeElement, "blur").subscribe(() => this.close());
166170
} else {
@@ -231,7 +235,6 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
231235
/**
232236
* Empty method for child classes to override and specify additional init steps.
233237
* Run after DialogDirective completes it's ngOnInit.
234-
* @protected
235238
*/
236239
protected onDialogInit() {}
237240
}

src/slider/slider.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
7979
[step]="step"
8080
[min]="min"
8181
[max]="max"
82-
[value]="value">
82+
[value]="value.toString()">
8383
</div>
8484
<label [id]="topRangeId" class="bx--slider__range-label">
8585
<ng-content select="[maxLabel]"></ng-content>
@@ -179,7 +179,7 @@ export class Slider implements AfterViewInit, OnDestroy, ControlValueAccessor {
179179
protected eventSubscriptions: Array<Subscription> = [];
180180
protected slidAmount = 0;
181181
protected input: HTMLInputElement;
182-
protected _value = 0;
182+
protected _value = this.min;
183183
protected _disabled = false;
184184

185185
constructor(protected elementRef: ElementRef) {}
@@ -189,7 +189,10 @@ export class Slider implements AfterViewInit, OnDestroy, ControlValueAccessor {
189189
this.eventSubscriptions.push(fromEvent(document, "mousemove").subscribe(this.onMouseMove.bind(this)));
190190
this.eventSubscriptions.push(fromEvent(document, "mouseup").subscribe(this.onMouseUp.bind(this)));
191191

192-
// ODO: ontouchstart/ontouchmove/ontouchend
192+
// apply any values we got from before the view initialized
193+
this.value = this.value;
194+
195+
// TODO: ontouchstart/ontouchmove/ontouchend
193196

194197
// set up the optional input
195198
this.input = this.elementRef.nativeElement.querySelector("input:not([type=range])");

0 commit comments

Comments
 (0)