UNPKG

angular-schedule

Version:

A simple and light schedule package for angular.

968 lines (937 loc) 54.7 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('rxjs/operators'), require('@angular/common')) : typeof define === 'function' && define.amd ? define('angular-schedule', ['exports', '@angular/core', 'rxjs', '@angular/cdk/overlay', '@angular/cdk/portal', 'rxjs/operators', '@angular/common'], factory) : (global = global || self, factory(global['angular-schedule'] = {}, global.ng.core, global.rxjs, global.ng.cdk.overlay, global.ng.cdk.portal, global.rxjs.operators, global.ng.common)); }(this, (function (exports, core, rxjs, overlay, portal, operators, common) { 'use strict'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /** * @fileoverview added by tsickle * Generated from: lib/scheduler.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var SchedulerService = /** @class */ (function () { function SchedulerService() { } SchedulerService.decorators = [ { type: core.Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ SchedulerService.ctorParameters = function () { return []; }; /** @nocollapse */ SchedulerService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function SchedulerService_Factory() { return new SchedulerService(); }, token: SchedulerService, providedIn: "root" }); return SchedulerService; }()); /** * @fileoverview added by tsickle * Generated from: lib/lib.config.token.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var USER_OPTIONS = new core.InjectionToken('scheduler user options'); /** * @fileoverview added by tsickle * Generated from: lib/scheduler.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var SchedulerComponent = /** @class */ (function () { function SchedulerComponent(libConfig, elementRef, overlay, viewContainerRef) { this.libConfig = libConfig; this.elementRef = elementRef; this.overlay = overlay; this.viewContainerRef = viewContainerRef; this.isSelecting = false; this.finishedSelecting = new core.EventEmitter(); this.editInfo = new core.EventEmitter(); this.excludedDay = new core.EventEmitter(); this.includedDay = new core.EventEmitter(); } /** * @param {?} changes * @return {?} */ SchedulerComponent.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { if (changes.showBy) { this.generateAllDates(); } }; /** * @return {?} */ SchedulerComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; /** * @return {?} */ SchedulerComponent.prototype.ngAfterViewInit = /** * @return {?} */ function () { this.scrollToToday(); }; /** * @return {?} */ SchedulerComponent.prototype.generateAllDates = /** * @return {?} */ function () { /** @type {?} */ var CURRENT_MONTH = new Date().getMonth(); /** @type {?} */ var CURRENT_YEAR = new Date().getFullYear(); /** @type {?} */ var MONTHS_IN_PAST = this.libConfig.monthsInPast || 4; /** @type {?} */ var MONTHS_IN_FUTURE = this.libConfig.monthsInFuture || 12; /** @type {?} */ var pastMonth = CURRENT_MONTH - MONTHS_IN_PAST < 0 ? CURRENT_MONTH - MONTHS_IN_PAST + 12 : CURRENT_MONTH - MONTHS_IN_PAST; /** @type {?} */ var pastYear = pastMonth >= 9 ? CURRENT_YEAR - 1 : CURRENT_YEAR; /** @type {?} */ var TO_DATE = this.calculateToDate(CURRENT_YEAR, CURRENT_MONTH, MONTHS_IN_FUTURE); /** @type {?} */ var DATEOBJ = []; while (pastYear <= TO_DATE.getFullYear()) { /** @type {?} */ var FRAME = pastYear === TO_DATE.getFullYear() ? TO_DATE.getMonth() : 11; if (this.showBy === 'day') { for (var index = pastMonth; index <= FRAME; index++) { DATEOBJ.push({ month: new Date(Date.UTC(pastYear, pastMonth, 1)), weekDays: this.generateDates(pastYear, pastMonth), }); pastMonth = pastMonth === 11 ? 0 : pastMonth + 1; } } else { DATEOBJ.push({ month: new Date(Date.UTC(pastYear, pastMonth, 1)), weekDays: this.generateMonths(pastYear, pastMonth, FRAME), }); for (var index = pastMonth; index <= FRAME; index++) { pastMonth = pastMonth === 11 ? 0 : pastMonth + 1; } } pastYear += 1; } this.days = DATEOBJ; }; /** * @param {?} year * @param {?} month * @param {?} toMonths * @return {?} */ SchedulerComponent.prototype.calculateToDate = /** * @param {?} year * @param {?} month * @param {?} toMonths * @return {?} */ function (year, month, toMonths) { /** @type {?} */ var NEW_MONTH = month + toMonths > 12 ? (month + toMonths) % 12 : month + toMonths; /** @type {?} */ var ADD_TO_YEAR = month + toMonths > 12 ? Math.floor((month + toMonths) / 12) : 0; return new Date(Date.UTC(year + ADD_TO_YEAR, NEW_MONTH, 1)); }; /** * @param {?} year * @param {?} month * @return {?} */ SchedulerComponent.prototype.generateDates = /** * @param {?} year * @param {?} month * @return {?} */ function (year, month) { /** @type {?} */ var DATEOBJ = new Date(Date.UTC(year, month, 1)); /** @type {?} */ var WEEKDAYS = []; while (DATEOBJ.getMonth() === month) { WEEKDAYS.push(new Date(DATEOBJ)); DATEOBJ.setDate(DATEOBJ.getDate() + 1); } return WEEKDAYS; }; /** * @param {?} day * @return {?} */ SchedulerComponent.prototype.excludeIncludeCheck = /** * @param {?} day * @return {?} */ function (day) { return false; }; /** * @param {?} start * @param {?} end * @param {?} current * @return {?} */ SchedulerComponent.prototype.calculateFromTo = /** * @param {?} start * @param {?} end * @param {?} current * @return {?} */ function (start, end, current) { /** @type {?} */ var FROM = new Date(start); /** @type {?} */ var TO = new Date(end); /** @type {?} */ var CHECK = new Date(current); /** @type {?} */ var SKIP_DAYS = this.libConfig.skipDays || [0, 6]; if (this.showBy === 'day') { return (CHECK >= FROM && CHECK <= TO && !SKIP_DAYS.includes(CHECK.getDay())); } return CHECK >= FROM && CHECK <= TO; }; /** * @param {?} start * @param {?} end * @param {?} current * @return {?} */ SchedulerComponent.prototype.isDayOff = /** * @param {?} start * @param {?} end * @param {?} current * @return {?} */ function (start, end, current) { /** @type {?} */ var FROM = new Date(start); /** @type {?} */ var TO = new Date(end); /** @type {?} */ var CHECK = new Date(current); /** @type {?} */ var SKIP_DAYS = this.libConfig.skipDays || [0, 6]; return (CHECK >= FROM && CHECK <= TO && SKIP_DAYS.includes(CHECK.getDay()) && this.showBy !== 'month'); }; /** * @param {?} ev * @return {?} */ SchedulerComponent.prototype.enter = /** * @param {?} ev * @return {?} */ function (ev) { if (this.isSelecting) { if (ev.target.classList.contains('selected')) { ev.target.classList.remove('selected'); if (ev.target.parentNode.nextSibling.lastChild.classList.contains('selected')) { ev.target.parentNode.nextSibling.lastChild.classList.remove('selected'); } } else { ev.target.classList.add('selected'); if (!ev.target.parentNode.previousSibling.lastChild.classList.contains('selected')) { ev.target.parentNode.previousSibling.lastChild.classList.add('selected'); } } } }; /** * @param {?} ev * @param {?} day * @param {?} user * @return {?} */ SchedulerComponent.prototype.startSelect = /** * @param {?} ev * @param {?} day * @param {?} user * @return {?} */ function (ev, day, user) { // tslint:disable-next-line:curly if (ev.button !== 0) return; this.startUser = user; this.isSelecting = true; ev.target.classList.add('selected'); this.startDay = day; }; /** * @param {?} ev * @param {?} endDay * @param {?} user * @return {?} */ SchedulerComponent.prototype.endSelect = /** * @param {?} ev * @param {?} endDay * @param {?} user * @return {?} */ function (ev, endDay, user) { if (this.startUser !== user) { throw "Start and end row doesn't match! You might have started selecting in one row and ended up in another one."; } // tslint:disable-next-line:curly if (ev.button !== 0) return; ev.target.classList.add('selected'); this.isSelecting = false; this.selections.forEach((/** * @param {?} el * @return {?} */ function (el) { return el.nativeElement.classList.remove('selected'); })); /** @type {?} */ var DATA = { endDay: ((/** @type {?} */ (endDay))).toISOString(), user: user, startDay: this.startDay.toISOString(), }; this.finishedSelecting.emit(DATA); }; /** * @param {?} ev * @return {?} */ SchedulerComponent.prototype.reCalc = /** * @param {?} ev * @return {?} */ function (ev) { if (this.isSelecting) { /** @type {?} */ var RECT = this.container.nativeElement.getBoundingClientRect(); /** @type {?} */ var X = ev.clientX - RECT.left; if (X > 1000) { this.container.nativeElement.scrollLeft += 40; } } }; /** * @return {?} */ SchedulerComponent.prototype.scrollToToday = /** * @return {?} */ function () { /** @type {?} */ var ELEM = (/** @type {?} */ (this.elementRef.nativeElement.querySelector('.bottomData__title.today'))); ELEM.scrollIntoView(); }; /** * @param {?} year * @param {?} month * @param {?} toMonth * @return {?} */ SchedulerComponent.prototype.generateMonths = /** * @param {?} year * @param {?} month * @param {?} toMonth * @return {?} */ function (year, month, toMonth) { /** @type {?} */ var counter = month; /** @type {?} */ var months = []; while (counter <= toMonth) { ((/** @type {?} */ (months))) = __spread(months, [new Date(Date.UTC(year, counter, 1))]); counter++; } return months; }; /** * @param {?} ev * @param {?} user * @param {?} project * @param {?} weekday * @return {?} */ SchedulerComponent.prototype.open = /** * @param {?} ev * @param {?} user * @param {?} project * @param {?} weekday * @return {?} */ function (ev, user, project, weekday) { var _this = this; if (this.showBy === 'day') { var x = ev.x, y = ev.y; ev.preventDefault(); this.close(); /** @type {?} */ var positionStrategy = this.overlay .position() .flexibleConnectedTo({ x: x, y: y }) .withPositions([ { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', }, ]); this.overlayRef = this.overlay.create({ positionStrategy: positionStrategy, scrollStrategy: this.overlay.scrollStrategies.close(), }); this.overlayRef.attach(new portal.TemplatePortal(this.userMenu, this.viewContainerRef, { $implicit: { user: user, project: project, weekday: weekday }, })); this.sub = rxjs.fromEvent(document, 'click') .pipe(operators.filter((/** * @param {?} event * @return {?} */ function (event) { /** @type {?} */ var clickTarget = (/** @type {?} */ (event.target)); return (!!_this.overlayRef && !_this.overlayRef.overlayElement.contains(clickTarget)); })), operators.take(1)) .subscribe((/** * @return {?} */ function () { return _this.close(); })); } }; /** * @return {?} */ SchedulerComponent.prototype.close = /** * @return {?} */ function () { this.sub && this.sub.unsubscribe(); if (this.overlayRef) { this.overlayRef.dispose(); this.overlayRef = null; } }; /** * @param {?} data * @return {?} */ SchedulerComponent.prototype.excludeDay = /** * @param {?} data * @return {?} */ function (data) { this.close(); this.excludedDay.emit(data); }; /** * @param {?} data * @return {?} */ SchedulerComponent.prototype.includeDay = /** * @param {?} data * @return {?} */ function (data) { this.close(); this.includedDay.emit(data); }; /** * @param {?} day * @return {?} */ SchedulerComponent.prototype.isToday = /** * @param {?} day * @return {?} */ function (day) { return new Date(day).toDateString() === new Date().toDateString(); }; /** * @param {?} index * @param {?} el * @return {?} */ SchedulerComponent.prototype.trackPersons = /** * @param {?} index * @param {?} el * @return {?} */ function (index, el) { return el.id; }; /** * @param {?} index * @return {?} */ SchedulerComponent.prototype.trackMonths = /** * @param {?} index * @return {?} */ function (index) { return index; }; /** * @param {?} index * @return {?} */ SchedulerComponent.prototype.trackDays = /** * @param {?} index * @return {?} */ function (index) { return index; }; /** * @param {?} index * @param {?} el * @return {?} */ SchedulerComponent.prototype.trackData = /** * @param {?} index * @param {?} el * @return {?} */ function (index, el) { return el.id; }; SchedulerComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngx-scheduler', template: "\n\t\t<button\n\t\t\t*ngIf=\"libConfig?.showToday\"\n\t\t\tclass=\"scrollToToday\"\n\t\t\t(click)=\"scrollToToday()\"\n\t\t>\n\t\t\t{{ todayButtonLabel || 'Today' }}\n\t\t</button>\n\t\t<div class=\"table\">\n\t\t\t<div class=\"left\">\n\t\t\t\t<div class=\"spacer\"></div>\n\t\t\t\t<div\n\t\t\t\t\t*ngFor=\"let person of persons; trackBy: trackPersons\"\n\t\t\t\t\t[ngStyle]=\"{\n\t\t\t\t\t\theight:\n\t\t\t\t\t\t\tperson.data.length * 30 >= 60\n\t\t\t\t\t\t\t\t? (person?.data.length + 3) * 30 + 'px'\n\t\t\t\t\t\t\t\t: '100px'\n\t\t\t\t\t}\"\n\t\t\t\t\tclass=\"who\"\n\t\t\t\t>\n\t\t\t\t\t<strong>{{ person?.name }}</strong>\n\t\t\t\t\t<br />\n\t\t\t\t\t<small [innerText]=\"person?.departments || ''\"></small>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div #container class=\"right\">\n\t\t\t\t<div class=\"header\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngFor=\"let day of days; trackBy: trackMonths\"\n\t\t\t\t\t\tclass=\"headerData\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div class=\"topData\">\n\t\t\t\t\t\t\t<strong\n\t\t\t\t\t\t\t\t>{{\n\t\t\t\t\t\t\t\t\tshowBy === 'day'\n\t\t\t\t\t\t\t\t\t\t? (day.month | date: 'MMM yyyy')\n\t\t\t\t\t\t\t\t\t\t: (day.month | date: 'yyyy')\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"bottomData\">\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclass=\"bottomData__title\"\n\t\t\t\t\t\t\t\t*ngFor=\"let weekday of day?.weekDays; trackBy: trackDays\"\n\t\t\t\t\t\t\t\t[class.today]=\"isToday(weekday)\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<strong>{{\n\t\t\t\t\t\t\t\t\tshowBy === 'day'\n\t\t\t\t\t\t\t\t\t\t? (weekday | date: 'dd EEE')\n\t\t\t\t\t\t\t\t\t\t: (weekday | date: 'MMMM')\n\t\t\t\t\t\t\t\t}}</strong>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"pos-rel\"\n\t\t\t\t\t\t*ngFor=\"let person of persons; let i = index; trackBy: trackPersons\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div *ngFor=\"let day of days; trackBy: trackMonths\" class=\"body\">\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclass=\"bodyData\"\n\t\t\t\t\t\t\t\t[ngStyle]=\"{\n\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\tperson?.data.length * 30 >= 60\n\t\t\t\t\t\t\t\t\t\t\t? (person?.data.length + 3) * 30 + 'px'\n\t\t\t\t\t\t\t\t\t\t\t: '100px',\n\t\t\t\t\t\t\t\t\t'background-color': isToday(weekday)\n\t\t\t\t\t\t\t\t\t\t? 'rgba(241, 229, 188, .5)'\n\t\t\t\t\t\t\t\t\t\t: '#fff'\n\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t*ngFor=\"let weekday of day?.weekDays; trackBy: trackDays\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\tclass=\"projectLabel\"\n\t\t\t\t\t\t\t\t\t*ngFor=\"let project of person?.data; trackBy: trackData\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t(contextmenu)=\"open($event, person.id, project, weekday)\"\n\t\t\t\t\t\t\t\t\t\t[showTooltip]=\"libConfig?.showTooltip\"\n\t\t\t\t\t\t\t\t\t\t[tooltip]=\"project?.description || ''\"\n\t\t\t\t\t\t\t\t\t\t[placement]=\"placement\"\n\t\t\t\t\t\t\t\t\t\t[delay]=\"delay\"\n\t\t\t\t\t\t\t\t\t\t[ngStyle]=\"{ backgroundColor: project?.color }\"\n\t\t\t\t\t\t\t\t\t\t*ngIf=\"\n\t\t\t\t\t\t\t\t\t\t\t(calculateFromTo(project?.from, project?.to, weekday) &&\n\t\t\t\t\t\t\t\t\t\t\t\t!project?.excludeDays.includes(weekday)) ||\n\t\t\t\t\t\t\t\t\t\t\tproject?.includeDays.includes(weekday)\n\t\t\t\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t\t\t\t\t(click)=\"\n\t\t\t\t\t\t\t\t\t\t\teditInfo.emit({ person: person?.id, project: project })\n\t\t\t\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t\t\t\t\t>{{ project?.name }} {{ project?.hours }}</span\n\t\t\t\t\t\t\t\t\t>\n\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t(contextmenu)=\"\n\t\t\t\t\t\t\t\t\t\t\topen($event, person.id, project, weekday);\n\t\t\t\t\t\t\t\t\t\t\t$event.preventDefault()\n\t\t\t\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t\t\t\t\t*ngIf=\"\n\t\t\t\t\t\t\t\t\t\t\t(isDayOff(project?.from, project?.to, weekday) &&\n\t\t\t\t\t\t\t\t\t\t\t\t!project?.includeDays.includes(weekday)) ||\n\t\t\t\t\t\t\t\t\t\t\tproject?.excludeDays.includes(weekday)\n\t\t\t\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t\t\t\t\tclass=\"dayOff\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{{ dayOffLabel || 'Day off' }}</span\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t#selectionDiv\n\t\t\t\t\t\t\t\t\tclass=\"selectionDiv\"\n\t\t\t\t\t\t\t\t\t(mousedown)=\"startSelect($event, weekday, person?.id)\"\n\t\t\t\t\t\t\t\t\t(mouseenter)=\"enter($event)\"\n\t\t\t\t\t\t\t\t\t(mousemove)=\"reCalc($event)\"\n\t\t\t\t\t\t\t\t\t(mouseup)=\"endSelect($event, weekday, person?.id)\"\n\t\t\t\t\t\t\t\t\t[ngStyle]=\"{\n\t\t\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\t\tperson.data.length * 30 >= 60\n\t\t\t\t\t\t\t\t\t\t\t\t? (person?.data.length + 3) * 30 -\n\t\t\t\t\t\t\t\t\t\t\t\t person?.data.length * 30 +\n\t\t\t\t\t\t\t\t\t\t\t\t 'px'\n\t\t\t\t\t\t\t\t\t\t\t\t: 100 - person?.data.length * 30 + 'px'\n\t\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<ng-template #userMenu let-data>\n\t\t\t<section class=\"user-menu\">\n\t\t\t\t<div\n\t\t\t\t\t*ngIf=\"\n\t\t\t\t\t\t(calculateFromTo(\n\t\t\t\t\t\t\tdata?.project?.from,\n\t\t\t\t\t\t\tdata?.project?.to,\n\t\t\t\t\t\t\tdata?.weekday\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t!data?.project?.excludeDays.includes(data?.weekday)) ||\n\t\t\t\t\t\tdata?.project?.includeDays.includes(data?.weekday)\n\t\t\t\t\t\"\n\t\t\t\t\t(click)=\"excludeDay(data)\"\n\t\t\t\t>\n\t\t\t\t\tExclude day\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\t*ngIf=\"\n\t\t\t\t\t\t(isDayOff(data?.project?.from, data?.project?.to, data?.weekday) &&\n\t\t\t\t\t\t\t!data?.project?.includeDays.includes(data?.weekday)) ||\n\t\t\t\t\t\tdata?.project?.excludeDays.includes(data?.weekday)\n\t\t\t\t\t\"\n\t\t\t\t\t(click)=\"includeDay(data)\"\n\t\t\t\t>\n\t\t\t\t\tInclude day\n\t\t\t\t</div>\n\t\t\t</section>\n\t\t</ng-template>\n\t", changeDetection: core.ChangeDetectionStrategy.OnPush, styles: ["\n\t\t\t* {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tborder-collapse: collapse;\n\t\t\t\t-webkit-user-select: none;\n\t\t\t\t-moz-user-select: none;\n\t\t\t\t-ms-user-select: none;\n\t\t\t\tuser-select: none;\n\t\t\t}\n\t\t\t.table {\n\t\t\t\tborder: 1px solid #d5d5d5;\n\t\t\t\tbackground-color: #f5f5f5;\n\t\t\t\tborder-spacing: 0;\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t\t.table .spacer {\n\t\t\t\twidth: 300px;\n\t\t\t\theight: 70px;\n\t\t\t\tborder: 1px solid #d5d5d5;\n\t\t\t}\n\t\t\t.table .who {\n\t\t\t\theight: 100px;\n\t\t\t\tpadding: 8px 16px;\n\t\t\t\tborder: 1px solid #d5d5d5;\n\t\t\t\tbackground-color: #fff;\n\t\t\t}\n\t\t\t.table .who strong {\n\t\t\t\tfont-size: 16px;\n\t\t\t\tcolor: #1a1a1a;\n\t\t\t}\n\n\t\t\t.table .right {\n\t\t\t\toverflow-x: auto;\n\t\t\t\toverflow-y: hidden;\n\t\t\t}\n\t\t\t.table .right .header {\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t\t.table .right .header .topData {\n\t\t\t\theight: 40px;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\tborder-right: 1px solid #d5d5d5;\n\t\t\t\tborder-left: 1px solid #d5d5d5;\n\t\t\t}\n\t\t\t.table .right .header .bottomData {\n\t\t\t\theight: 30px;\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t\t.table .right .header .bottomData__title {\n\t\t\t\tfont-size: 12px;\n\t\t\t\tfont-weight: 600;\n\t\t\t\tcolor: #1a1a1a;\n\t\t\t\tborder: 1px solid #d5d5d5;\n\t\t\t\twidth: 100px;\n\t\t\t\tmin-width: 100px;\n\t\t\t\tpadding: 9px;\n\t\t\t\ttext-align: left;\n\t\t\t}\n\n\t\t\t.pos-rel {\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t\t.selected {\n\t\t\t\tbackground-color: #f7f9fa;\n\t\t\t\tborder-bottom: 2px solid #dce2e6;\n\t\t\t\tborder-top: 2px solid #dce2e6;\n\t\t\t\tborder-left-color: transparent;\n\t\t\t\tborder-right-color: transparent;\n\t\t\t}\n\t\t\t.selected:first-of-type {\n\t\t\t\tborder-left-color: #dce2e6;\n\t\t\t}\n\t\t\t.body {\n\t\t\t\tdisplay: flex;\n\t\t\t\tposition: relative;\n\t\t\t}\n\t\t\t.bodyData {\n\t\t\t\tbackground-color: #fff;\n\t\t\t\tborder: 1px solid #d5d5d5;\n\t\t\t\theight: 100px;\n\t\t\t\twidth: 100px;\n\t\t\t\tmin-width: 100px;\n\t\t\t}\n\t\t\t.projectLabel {\n\t\t\t\tposition: relative;\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t\tdisplay: block;\n\t\t\t\theight: 25px;\n\t\t\t\t-webkit-user-select: none;\n\t\t\t\t-moz-user-select: none;\n\t\t\t\t-ms-user-select: none;\n\t\t\t\tuser-select: none;\n\t\t\t}\n\t\t\t.projectLabel span {\n\t\t\t\tcolor: #fff;\n\t\t\t\twidth: 100%;\n\t\t\t\tdisplay: block;\n\t\t\t\tpadding: 5px;\n\t\t\t\tfont-size: 12px;\n\t\t\t\t-webkit-user-select: none;\n\t\t\t\t-moz-user-select: none;\n\t\t\t\t-ms-user-select: none;\n\t\t\t\tuser-select: none;\n\t\t\t\tposition: relative;\n\t\t\t}\n\t\t\t.dayOff {\n\t\t\t\tbackground: #f2f0eb 0% 0% no-repeat padding-box;\n\t\t\t\tcolor: #27241d !important;\n\t\t\t}\n\t\t\t.today {\n\t\t\t\tbackground-color: rgba(241, 229, 188, 0.5);\n\t\t\t}\n\t\t\t.scrollToToday {\n\t\t\t\tbackground: #f2f0eb 0% 0% no-repeat padding-box;\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tborder: 0;\n\t\t\t\theight: 36px;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\tletter-spacing: 0px;\n\t\t\t\tcolor: #27241d;\n\t\t\t\tfont-size: 14px;\n\t\t\t\tline-height: 21px;\n\t\t\t\tpadding: 0 15px;\n\t\t\t\tmargin-bottom: 10px;\n\t\t\t}\n\n\t\t\t.ng-tooltip {\n\t\t\t\tposition: absolute;\n\t\t\t\tmax-width: 150px;\n\t\t\t\tfont-size: 14px;\n\t\t\t\ttext-align: center;\n\t\t\t\tcolor: #f8f8f2;\n\t\t\t\tpadding: 3px 8px;\n\t\t\t\tbackground: #282a36;\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tz-index: 1000;\n\t\t\t\topacity: 0;\n\t\t\t}\n\t\t\t.ng-tooltip:after {\n\t\t\t\tcontent: '';\n\t\t\t\tposition: absolute;\n\t\t\t\tborder-style: solid;\n\t\t\t}\n\t\t\t.ng-tooltip-top:after {\n\t\t\t\ttop: 100%;\n\t\t\t\tleft: 50%;\n\t\t\t\tmargin-left: -5px;\n\t\t\t\tborder-width: 5px;\n\t\t\t\tborder-color: black transparent transparent transparent;\n\t\t\t}\n\t\t\t.ng-tooltip-bottom:after {\n\t\t\t\tbottom: 100%;\n\t\t\t\tleft: 50%;\n\t\t\t\tmargin-left: -5px;\n\t\t\t\tborder-width: 5px;\n\t\t\t\tborder-color: transparent transparent black transparent;\n\t\t\t}\n\t\t\t.ng-tooltip-left:after {\n\t\t\t\ttop: 50%;\n\t\t\t\tleft: 100%;\n\t\t\t\tmargin-top: -5px;\n\t\t\t\tborder-width: 5px;\n\t\t\t\tborder-color: transparent transparent transparent black;\n\t\t\t}\n\t\t\t.ng-tooltip-right:after {\n\t\t\t\ttop: 50%;\n\t\t\t\tright: 100%;\n\t\t\t\tmargin-top: -5px;\n\t\t\t\tborder-width: 5px;\n\t\t\t\tborder-color: transparent black transparent transparent;\n\t\t\t}\n\t\t\t.ng-tooltip-show {\n\t\t\t\topacity: 1;\n\t\t\t}\n\t\t\t.my-menu {\n\t\t\t\tbackground-color: #fff;\n\t\t\t\tborder: 1px solid rosybrown;\n\t\t\t\tpadding: 20px;\n\t\t\t}\n\n\t\t\t.user-menu {\n\t\t\t\tbackground-color: #fafafa;\n\t\t\t\tpadding: 4pt;\n\t\t\t\tfont-size: 10pt;\n\t\t\t\tz-index: 1000;\n\t\t\t\tbox-shadow: 0 0 12pt rgba(0, 0, 0, 0.25);\n\t\t\t\tborder-radius: 4pt;\n\t\t\t\tpadding: 0.5em 0 0.5em 0;\n\t\t\t\tanimation: fadeIn 0.1s ease-out;\n\t\t\t\topacity: 1;\n\t\t\t\tdisplay: block;\n\t\t\t}\n\n\t\t\t.user-menu hr {\n\t\t\t\tborder: none;\n\t\t\t\tborder-bottom: 1px solid #eee;\n\t\t\t}\n\n\t\t\t.user-menu div {\n\t\t\t\tcursor: pointer;\n\t\t\t\tdisplay: block;\n\t\t\t\ttext-decoration: none;\n\t\t\t\tcolor: #333;\n\t\t\t\tpadding: 0.5em 2em 0.5em 0.75em;\n\t\t\t\tmax-width: 18em;\n\t\t\t\twhite-space: nowrap;\n\t\t\t\toverflow: hidden;\n\t\t\t\ttext-overflow: ellipsis;\n\t\t\t}\n\n\t\t\t.user-menu div:hover {\n\t\t\t\tbackground-color: #333;\n\t\t\t\tcolor: #fff;\n\t\t\t}\n\n\t\t\t.user-menu div::before {\n\t\t\t\tcontent: '';\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-right: 0.75em;\n\t\t\t\twidth: 0.5em;\n\t\t\t\theight: 1em;\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\n\t\t\t/* Animatinons */\n\t\t\t@-webkit-keyframes fadeIn {\n\t\t\t\tfrom {\n\t\t\t\t\topacity: 0;\n\t\t\t\t}\n\t\t\t\tto {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@keyframes fadeIn {\n\t\t\t\tfrom {\n\t\t\t\t\topacity: 0;\n\t\t\t\t}\n\t\t\t\tto {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@-webkit-keyframes fadeOut {\n\t\t\t\tfrom {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t\tto {\n\t\t\t\t\topacity: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@keyframes fadeOut {\n\t\t\t\tfrom {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t\tto {\n\t\t\t\t\topacity: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t.is-fadingIn {\n\t\t\t\t-webkit-animation: fadeIn 0.1s ease-out;\n\t\t\t\tanimation: fadeIn 0.1s ease-out;\n\t\t\t\topacity: 1;\n\t\t\t\tdisplay: block;\n\t\t\t}\n\n\t\t\t.is-fadingOut {\n\t\t\t\t-webkit-animation: fadeOut 0.1s ease-out;\n\t\t\t\tanimation: fadeOut 0.1s ease-out;\n\t\t\t\topacity: 0;\n\t\t\t\tdisplay: block;\n\t\t\t}\n\t\t"] }] } ]; /** @nocollapse */ SchedulerComponent.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: core.Inject, args: [USER_OPTIONS,] }] }, { type: core.ElementRef }, { type: overlay.Overlay }, { type: core.ViewContainerRef } ]; }; SchedulerComponent.propDecorators = { container: [{ type: core.ViewChild, args: ['container', { static: true },] }], userMenu: [{ type: core.ViewChild, args: ['userMenu', { static: true },] }], selections: [{ type: core.ViewChildren, args: ['selectionDiv',] }], persons: [{ type: core.Input }], showBy: [{ type: core.Input }], delay: [{ type: core.Input }], dayOffLabel: [{ type: core.Input }], todayButtonLabel: [{ type: core.Input }], placement: [{ type: core.Input }], finishedSelecting: [{ type: core.Output }], editInfo: [{ type: core.Output }], excludedDay: [{ type: core.Output }], includedDay: [{ type: core.Output }] }; return SchedulerComponent; }()); if (false) { /** @type {?} */ SchedulerComponent.prototype.days; /** @type {?} */ SchedulerComponent.prototype.isSelecting; /** @type {?} */ SchedulerComponent.prototype.startDay; /** @type {?} */ SchedulerComponent.prototype.startUser; /** @type {?} */ SchedulerComponent.prototype.sub; /** @type {?} */ SchedulerComponent.prototype.overlayRef; /** @type {?} */ SchedulerComponent.prototype.container; /** @type {?} */ SchedulerComponent.prototype.userMenu; /** @type {?} */ SchedulerComponent.prototype.selections; /** @type {?} */ SchedulerComponent.prototype.persons; /** @type {?} */ SchedulerComponent.prototype.showBy; /** @type {?} */ SchedulerComponent.prototype.delay; /** @type {?} */ SchedulerComponent.prototype.dayOffLabel; /** @type {?} */ SchedulerComponent.prototype.todayButtonLabel; /** @type {?} */ SchedulerComponent.prototype.placement; /** @type {?} */ SchedulerComponent.prototype.finishedSelecting; /** @type {?} */ SchedulerComponent.prototype.editInfo; /** @type {?} */ SchedulerComponent.prototype.excludedDay; /** @type {?} */ SchedulerComponent.prototype.includedDay; /** @type {?} */ SchedulerComponent.prototype.libConfig; /** * @type {?} * @private */ SchedulerComponent.prototype.elementRef; /** @type {?} */ SchedulerComponent.prototype.overlay; /** @type {?} */ SchedulerComponent.prototype.viewContainerRef; } /** * @fileoverview added by tsickle * Generated from: lib/tooltip.directive.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var TooltipDirective = /** @class */ (function () { function TooltipDirective(el, renderer) { this.el = el; this.renderer = renderer; this.offset = 10; } /** * @return {?} */ TooltipDirective.prototype.onMouseEnter = /** * @return {?} */ function () { if (!this.tooltip && this.tooltipTitle !== '' && this.showTooltip) { this.show(); } }; /** * @return {?} */ TooltipDirective.prototype.onMouseLeave = /** * @return {?} */ function () { if (this.tooltip) { this.hide(); } }; /** * @return {?} */ TooltipDirective.prototype.show = /** * @return {?} */ function () { this.create(); this.setPosition(); this.renderer.addClass(this.tooltip, 'ng-tooltip-show'); }; /** * @return {?} */ TooltipDirective.prototype.hide = /** * @return {?} */ function () { var _this = this; this.renderer.removeClass(this.tooltip, 'ng-tooltip-show'); window.setTimeout((/** * @return {?} */ function () { _this.renderer.removeChild(document.body, _this.tooltip); _this.tooltip = null; }), this.delay); }; /** * @return {?} */ TooltipDirective.prototype.create = /** * @return {?} */ function () { this.tooltip = this.renderer.createElement('span'); this.renderer.appendChild(this.tooltip, this.renderer.createText(this.tooltipTitle)); this.renderer.appendChild(document.body, this.tooltip); this.renderer.addClass(this.tooltip, 'ng-tooltip'); this.renderer.addClass(this.tooltip, "ng-tooltip-" + this.placement); this.renderer.setStyle(this.tooltip, '-webkit-transition', "opacity " + this.delay + "ms"); this.renderer.setStyle(this.tooltip, '-moz-transition', "opacity " + this.delay + "ms"); this.renderer.setStyle(this.tooltip, '-o-transition', "opacity " + this.delay + "ms"); this.renderer.setStyle(this.tooltip, 'transition', "opacity " + this.delay + "ms"); }; /** * @return {?} */ TooltipDirective.prototype.setPosition = /** * @return {?} */ function () { /** @type {?} */ var hostPos = this.el.nativeElement.getBoundingClientRect(); /** @type {?} */ var tooltipPos = this.tooltip.getBoundingClientRect(); /** @type {?} */ var scrollPos = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; /** @type {?} */ var top; /** @type {?} */ var left; if (this.placement === 'top') { top = hostPos.top - tooltipPos.height - this.offset; left = hostPos.left + (hostPos.width - tooltipPos.width) / 2; } if (this.placement === 'bottom') { top = hostPos.bottom + this.offset; left = hostPos.left + (hostPos.width - tooltipPos.width) / 2; } if (this.placement === 'left') { top = hostPos.top + (hostPos.height - tooltipPos.height) / 2; left = hostPos.left - tooltipPos.width - this.offset; } if (this.placement === 'right') { top = hostPos.top + (hostPos.height - tooltipPos.height) / 2; left = hostPos.right + this.offset; } this.renderer.setStyle(this.tooltip, 'top', top + scrollPos + "px"); this.renderer.setStyle(this.tooltip, 'left', left + "px"); }; TooltipDirective.decorators = [ { type: core.Directive, args: [{ selector: '[tooltip]', },] } ]; /** @nocollapse */ TooltipDirective.ctorParameters = function () { return [ { type: core.ElementRef }, { type: core.Renderer2 } ]; }; TooltipDirective.propDecorators = { tooltipTitle: [{ type: core.Input, args: ['tooltip',] }], placement: [{ type: core.Input }], delay: [{ type: core.Input }], showTooltip: [{ type: core.Input }], onMouseEnter: [{ type: core.HostListener, args: ['mouseenter',] }], onMouseLeave: [{ type: core.HostListener, args: ['mouseleave',] }] }; return TooltipDirective; }()); if (false) { /** @type {?} */ TooltipDirective.prototype.tooltipTitle; /** @type {?} */ TooltipDirective.prototype.placement; /** @type {?} */ TooltipDirective.prototype.delay; /** @type {?} */ TooltipDirective.prototype.showTooltip; /** @typ