mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
SQL Operations Studio Public Preview 1 (0.23) release source code
This commit is contained in:
26
src/sql/parts/grid/directives/mousedown.directive.ts
Normal file
26
src/sql/parts/grid/directives/mousedown.directive.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
import { ElementRef, Directive, Inject, Output, EventEmitter, forwardRef } from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[mousedown]'
|
||||
})
|
||||
export class MouseDownDirective {
|
||||
@Output('mousedown') onMouseDown = new EventEmitter();
|
||||
|
||||
constructor(@Inject(forwardRef(() => ElementRef)) private _el: ElementRef) {
|
||||
const self = this;
|
||||
setTimeout(() => {
|
||||
let $gridCanvas = $(this._el.nativeElement).find('.grid-canvas');
|
||||
$gridCanvas.on('mousedown', () => {
|
||||
self.onMouseDown.emit();
|
||||
});
|
||||
let jQueryCast: any = $;
|
||||
let mouseDownFuncs: any[] = jQueryCast._data($gridCanvas[0], 'events')['mousedown'];
|
||||
// reverse the event array so that our event fires first.
|
||||
mouseDownFuncs.reverse();
|
||||
});
|
||||
}
|
||||
}
|
||||
24
src/sql/parts/grid/directives/scroll.directive.ts
Normal file
24
src/sql/parts/grid/directives/scroll.directive.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
import { ElementRef, Directive, Input, Output, EventEmitter, forwardRef,
|
||||
Inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@Directive({
|
||||
selector: '[onScroll]'
|
||||
})
|
||||
export class ScrollDirective {
|
||||
@Input() scrollEnabled: boolean = true;
|
||||
@Output('onScroll') onScroll = new EventEmitter();
|
||||
|
||||
constructor(@Inject(forwardRef(() => ElementRef)) private _el: ElementRef) {
|
||||
const self = this;
|
||||
Observable.fromEvent(this._el.nativeElement, 'scroll').subscribe((event) => {
|
||||
if (self.scrollEnabled) {
|
||||
self.onScroll.emit(self._el.nativeElement.scrollTop);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user