@eduardsson/ngx-daterange
Version:
Date-Range Selector for Angular
910 lines • 57.8 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('moment'), require('moment-range')) :
typeof define === 'function' && define.amd ? define('@eduardsson/ngx-daterange', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'moment', 'moment-range'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.eduardsson = global.eduardsson || {}, global.eduardsson["ngx-daterange"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.momentNs, global.momentRange));
})(this, (function (exports, core, common, forms, momentNs, momentRange) { 'use strict';
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var momentNs__namespace = /*#__PURE__*/_interopNamespace(momentNs);
/******************************************************************************
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 (Object.prototype.hasOwnProperty.call(b, p))
d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
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 };
}
}
var __createBinding = Object.create ? (function (o, m, k, k2) {
if (k2 === undefined)
k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function () { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function (o, m, k, k2) {
if (k2 === undefined)
k2 = k;
o[k2] = m[k];
});
function __exportStar(m, o) {
for (var p in m)
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
__createBinding(o, 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;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
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 __spreadArray(to, from, pack) {
if (pack || arguments.length === 2)
for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar)
ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
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;
}
;
var __setModuleDefault = Object.create ? (function (o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function (o, v) {
o["default"] = v;
};
function __importStar(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null)
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m")
throw new TypeError("Private method is not writable");
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
var moment$1 = momentNs__namespace;
var range = momentRange.extendMoment(moment$1).range;
var CalendarComponent = /** @class */ (function () {
function CalendarComponent() {
this.singleCalendar = false;
this.dateChanged = new core.EventEmitter();
this.monthChanged = new core.EventEmitter();
this.yearChanged = new core.EventEmitter();
}
Object.defineProperty(CalendarComponent.prototype, "monthText", {
get: function () {
return moment$1.monthsShort()[this.month];
},
enumerable: false,
configurable: true
});
CalendarComponent.prototype.ngOnChanges = function () {
this.createCalendarGridData();
};
CalendarComponent.prototype.getWeekDays = function () {
return moment$1.weekdaysShort(true);
};
CalendarComponent.prototype.getWeekNumbers = function (monthRange) {
var weekNumbers = [];
var weeks = Array.from(monthRange.by("weeks"));
for (var i = 0; i < weeks.length; i++) {
var week = weeks[i];
if (i < 6) {
weekNumbers.push(week.week());
}
else {
break;
}
}
return weekNumbers;
};
CalendarComponent.prototype.getWeeksRange = function (weeks) {
var weeksRange = [];
for (var i = 0; i < weeks.length; i++) {
var week = weeks[i];
var firstWeekDay = moment$1([this.year, this.month])
.week(week)
.startOf("week");
var lastWeekDay = moment$1([this.year, this.month])
.week(week)
.endOf("week");
if (i > 0 && week < weeks[i - 1]) {
firstWeekDay.add(1, "year");
lastWeekDay.add(1, "year");
}
weeksRange.push(range(firstWeekDay.week(week).startOf("week"), lastWeekDay.week(week).endOf("week")));
}
return weeksRange;
};
CalendarComponent.prototype.createCalendarGridData = function () {
var _this = this;
var firstDay = moment$1([this.year, this.month]).startOf("month");
var endDay = moment$1([this.year, this.month])
.endOf("month")
.endOf("week");
var monthRange = range(firstDay, endDay);
var weeksRange = this.getWeeksRange(this.getWeekNumbers(monthRange));
var weekList = [];
weeksRange.map(function (week) {
var daysList = [];
Array.from(week.by("days")).forEach(function (day) {
if (day.isSame(_this.minDate, "date")) {
day = _this.minDate;
}
else if (day.isSame(_this.maxDate, "date")) {
day = _this.maxDate;
}
daysList.push(day);
});
weekList.push(daysList);
});
this.weekList = weekList;
};
CalendarComponent.prototype.isDisabled = function (day) {
return (day.isBefore(this.minDate) ||
day.isAfter(this.maxDate) ||
(day.isBefore(this.selectedFromDate) && !this.isLeft));
};
CalendarComponent.prototype.isDateAvailable = function (day) {
if (this.isLeft) {
return (day.isSameOrBefore(this.selectedToDate, "date") &&
!day.isSameOrBefore(this.minDate, "date"));
}
return (day.isSameOrAfter(this.selectedFromDate, "date") &&
!day.isSameOrAfter(this.maxDate, "date"));
};
CalendarComponent.prototype.isSelectedDate = function (day) {
var date = this.isLeft ? this.selectedFromDate : this.selectedToDate;
return date && day.get("month") === this.month && day.isSame(date, "date");
};
CalendarComponent.prototype.isDateInRange = function (day) {
if (this.isLeft) {
if (!this.selectedToDate) {
return (this.selectedFromDate &&
day.get("month") === this.month &&
day.isSameOrAfter(this.selectedFromDate, "date"));
}
}
if (this.selectedFromDate) {
return (this.selectedToDate &&
day.get("month") === this.month &&
day.isSameOrBefore(this.selectedToDate, "date") &&
day.isSameOrAfter(this.selectedFromDate, "date"));
}
};
CalendarComponent.prototype.isDifferentMonth = function (day) {
return day.get("month") !== this.month;
};
CalendarComponent.prototype.dateSelected = function (event, data) {
this.dateChanged.emit({
day: data.day,
isLeft: this.isLeft
});
event.stopPropagation();
};
CalendarComponent.prototype.monthSelected = function (event, data) {
this.monthChanged.emit({
value: data.value,
isLeft: this.isLeft
});
event.stopPropagation();
};
CalendarComponent.prototype.yearSelected = function (event, data) {
this.yearChanged.emit({
value: data.value,
isLeft: this.isLeft
});
event.stopPropagation();
};
return CalendarComponent;
}());
CalendarComponent.decorators = [
{ type: core.Component, args: [{
changeDetection: core.ChangeDetectionStrategy.OnPush,
encapsulation: core.ViewEncapsulation.None,
selector: "calendar",
template: "<div class=\"row\">\n <div class=\"col text-center\">\n <div\n class=\"d-flex align-items-center calendar-pagination {{\n icons === 'material' ? 'material' : ''\n }}\"\n >\n <div>\n <button\n type=\"button\"\n class=\"btn btn-link btn-previous-year\"\n (click)=\"yearSelected($event, { value: -1 })\"\n >\n <i *ngIf=\"icons === 'material'\" class=\"material-icons\">first_page</i>\n <i\n *ngIf=\"icons === 'font-awesome'\"\n class=\"fas fa-angle-double-left\"\n ></i>\n <img\n *ngIf=\"icons === 'default'\"\n src=\"data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCA0MDcuNDM2IDQwNy40MzYiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQwNy40MzYgNDA3LjQzNjsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNnB4IiBoZWlnaHQ9IjE2cHgiPgo8Zz4KCTxwb2x5Z29uIHBvaW50cz0iMjY2LjQ1MiwyMS4xNzggMjQ1LjIwNCwwIDQyLjE0OSwyMDMuNzE4IDI0NS4yMDQsNDA3LjQzNiAyNjYuNDUyLDM4Ni4yNTggODQuNTA3LDIwMy43MTggICIgZmlsbD0iIzAwMDAwMCIvPgoJPHBvbHlnb24gcG9pbnRzPSIzNjUuMjg2LDIxLjE3OCAzNDQuMDM4LDAgMTQwLjk4MywyMDMuNzE4IDM0NC4wMzgsNDA3LjQzNiAzNjUuMjg2LDM4Ni4yNTggMTgzLjM0MSwyMDMuNzE4ICAiIGZpbGw9IiMwMDAwMDAiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K\"\n />\n </button>\n </div>\n <div>\n <button\n type=\"button\"\n class=\"btn btn-link btn-previous-month\"\n (click)=\"monthSelected($event, { value: -1 })\"\n >\n <i *ngIf=\"icons === 'material'\" class=\"material-icons\"\n >chevron_left</i\n >\n <i *ngIf=\"icons === 'font-awesome'\" class=\"fas fa-angle-left\"></i>\n <img\n *ngIf=\"icons === 'default'\"\n src=\"data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDQ0NC41MzEgNDQ0LjUzMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDQ0LjUzMSA0NDQuNTMxOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTIxMy4xMywyMjIuNDA5TDM1MS44OCw4My42NTNjNy4wNS03LjA0MywxMC41NjctMTUuNjU3LDEwLjU2Ny0yNS44NDFjMC0xMC4xODMtMy41MTgtMTguNzkzLTEwLjU2Ny0yNS44MzUgICBsLTIxLjQwOS0yMS40MTZDMzIzLjQzMiwzLjUyMSwzMTQuODE3LDAsMzA0LjYzNywwcy0xOC43OTEsMy41MjEtMjUuODQxLDEwLjU2MUw5Mi42NDksMTk2LjQyNSAgIGMtNy4wNDQsNy4wNDMtMTAuNTY2LDE1LjY1Ni0xMC41NjYsMjUuODQxczMuNTIxLDE4Ljc5MSwxMC41NjYsMjUuODM3bDE4Ni4xNDYsMTg1Ljg2NGM3LjA1LDcuMDQzLDE1LjY2LDEwLjU2NCwyNS44NDEsMTAuNTY0ICAgczE4Ljc5NS0zLjUyMSwyNS44MzQtMTAuNTY0bDIxLjQwOS0yMS40MTJjNy4wNS03LjAzOSwxMC41NjctMTUuNjA0LDEwLjU2Ny0yNS42OTdjMC0xMC4wODUtMy41MTgtMTguNzQ2LTEwLjU2Ny0yNS45NzggICBMMjEzLjEzLDIyMi40MDl6IiBmaWxsPSIjMDAwMDAwIi8+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPC9zdmc+Cg==\"\n />\n </button>\n </div>\n <div class=\"flex-grow-1 month-year\">{{ monthText }} {{ year }}</div>\n <div>\n <button\n type=\"button\"\n class=\"btn btn-link btn-next-month\"\n (click)=\"monthSelected($event, { value: 1 })\"\n >\n <i *ngIf=\"icons === 'material'\" class=\"material-icons\"\n >chevron_right</i\n >\n <i *ngIf=\"icons === 'font-awesome'\" class=\"fas fa-angle-right\"></i>\n <img\n *ngIf=\"icons === 'default'\"\n src=\"data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDQ0NC44MTkgNDQ0LjgxOSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDQ0LjgxOSA0NDQuODE5OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTM1Mi4wMjUsMTk2LjcxMkwxNjUuODg0LDEwLjg0OEMxNTkuMDI5LDMuNjE1LDE1MC40NjksMCwxNDAuMTg3LDBjLTEwLjI4MiwwLTE4Ljg0MiwzLjYxOS0yNS42OTcsMTAuODQ4TDkyLjc5MiwzMi4yNjQgICBjLTcuMDQ0LDcuMDQzLTEwLjU2NiwxNS42MDQtMTAuNTY2LDI1LjY5MmMwLDkuODk3LDMuNTIxLDE4LjU2LDEwLjU2NiwyNS45ODFsMTM4Ljc1MywxMzguNDczTDkyLjc4NiwzNjEuMTY4ICAgYy03LjA0Miw3LjA0My0xMC41NjQsMTUuNjA0LTEwLjU2NCwyNS42OTNjMCw5Ljg5NiwzLjUyMSwxOC41NjIsMTAuNTY0LDI1Ljk4bDIxLjcsMjEuNDEzICAgYzcuMDQzLDcuMDQzLDE1LjYxMiwxMC41NjQsMjUuNjk3LDEwLjU2NGMxMC4wODksMCwxOC42NTYtMy41MjEsMjUuNjk3LTEwLjU2NGwxODYuMTQ1LTE4NS44NjQgICBjNy4wNDYtNy40MjMsMTAuNTcxLTE2LjA4NCwxMC41NzEtMjUuOTgxQzM2Mi41OTcsMjEyLjMyMSwzNTkuMDcxLDIwMy43NTUsMzUyLjAyNSwxOTYuNzEyeiIgZmlsbD0iIzAwMDAwMCIvPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=\"\n />\n </button>\n </div>\n <div>\n <button\n type=\"button\"\n class=\"btn btn-link btn-next-year\"\n (click)=\"yearSelected($event, { value: 1 })\"\n >\n <i *ngIf=\"icons === 'material'\" class=\"material-icons\">last_page</i>\n <i\n *ngIf=\"icons === 'font-awesome'\"\n class=\"fas fa-angle-double-right\"\n ></i>\n <img\n *ngIf=\"icons === 'default'\"\n src=\"data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCA0MDcuNDM2IDQwNy40MzYiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQwNy40MzYgNDA3LjQzNjsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNnB4IiBoZWlnaHQ9IjE2cHgiPgo8Zz4KCTxwb2x5Z29uIHBvaW50cz0iMTYyLjIzMSwwIDE0MC45ODMsMjEuMTc4IDMyMi45MjksMjAzLjcxOCAxNDAuOTgzLDM4Ni4yNTggMTYyLjIzMSw0MDcuNDM2IDM2NS4yODYsMjAzLjcxOCAgIiBmaWxsPSIjMDAwMDAwIi8+Cgk8cG9seWdvbiBwb2ludHM9IjYzLjM5NywwIDQyLjE0OSwyMS4xNzggMjI0LjA5NSwyMDMuNzE4IDQyLjE0OSwzODYuMjU4IDYzLjM5Nyw0MDcuNDM2IDI2Ni40NTIsMjAzLjcxOCAgIiBmaWxsPSIjMDAwMDAwIi8+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPC9zdmc+Cg==\"\n />\n </button>\n </div>\n </div>\n </div>\n</div>\n\n<div class=\"row\">\n <div class=\"col\">\n <table class=\"table table-borderless mb-0\">\n <thead>\n <tr class=\"week-days\">\n <th *ngFor=\"let day of getWeekDays()\">{{ day }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let week of weekList; let i = index\">\n <td\n *ngFor=\"let day of weekList[i]\"\n (click)=\"dateSelected($event, { day: day })\"\n [ngClass]=\"{\n selected: isSelectedDate(day),\n 'in-selected-range': isDateInRange(day),\n disabled: isDisabled(day),\n 'different-month': isDifferentMonth(day)\n }\"\n >\n {{ day.format(\"D\") }}\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>\n",
styles: [".calendar.calendar-single .table td.in-selected-range{background-color:transparent}.calendar .calendar-pagination{font-size:16px;margin:.5rem -15px 0}.calendar .calendar-pagination.material .btn.btn-previous-year{padding-right:3px}.calendar .calendar-pagination.material .btn.btn-previous-month{padding-left:0}.calendar .calendar-pagination.material .btn.btn-next-month{padding-right:0}.calendar .calendar-pagination.material .btn.btn-next-year{padding-left:3px}.calendar .calendar-pagination .month-year{font-weight:600}.calendar .week-days{text-transform:uppercase}.calendar .table th,.calendar .table td{border-radius:0;color:#333;font-size:12px;height:36px;line-height:1;padding:0;text-align:center;vertical-align:middle}.calendar .table th{font-weight:400}.calendar .table td{border-radius:5px;cursor:pointer;font-weight:900;width:32px;max-width:32px}.calendar .table td:not(.disabled):not(.selected):hover{background-color:#eee;color:#333}.calendar .table td.selected{background-color:#003d79;border-radius:5px;color:#fff;font-size:12px}.calendar .table td.selected.in-selected-range{background-color:#003d79;border-radius:5px}.calendar .table td.selected:hover{background-color:#003d79}.calendar .table td.in-selected-range{background-color:#dfefff;border-radius:0;font-size:12px}.calendar .table td.disabled{background-color:transparent;color:#666;cursor:not-allowed;font-weight:400}.calendar .table td.different-month{color:#888;font-weight:500}.calendar .table td.different-month.disabled{color:#ccc}\n"]
},] }
];
CalendarComponent.propDecorators = {
month: [{ type: core.Input }],
year: [{ type: core.Input }],
selectedFromDate: [{ type: core.Input }],
selectedToDate: [{ type: core.Input }],
isLeft: [{ type: core.Input }],
format: [{ type: core.Input }],
minDate: [{ type: core.Input }],
maxDate: [{ type: core.Input }],
singleCalendar: [{ type: core.Input }],
icons: [{ type: core.Input }],
dateChanged: [{ type: core.Output }],
monthChanged: [{ type: core.Output }],
yearChanged: [{ type: core.Output }]
};
var defaultDateFormat = 'YYYY-MM-DD';
var defaultTimeFormat = 'HH:mm';
var defaultDateRangePickerOptions = {
autoApply: true,
clickOutsideAllowed: true,
disabled: false,
icons: 'default',
format: defaultDateFormat,
labelText: 'Date Range',
maxDate: null,
minDate: null,
position: 'left',
preDefinedRanges: [],
singleCalendar: false,
};
var moment = momentNs__namespace;
var instanceCount = 0;
var DateRangePickerComponent = /** @class */ (function () {
function DateRangePickerComponent() {
this.options = defaultDateRangePickerOptions;
this.controlName = "dateRange";
this.instanceId = null;
this.fromDate = null;
this.toDate = null;
this.rangeSelected = new core.EventEmitter();
this.range = "";
this.showCalendars = false;
if (!this.instanceId) {
// assign auto-id
this.instanceId = "dateRangePicker-" + instanceCount++;
}
}
Object.defineProperty(DateRangePickerComponent.prototype, "enableApplyButton", {
get: function () {
return (!this.options.autoApply &&
!this.options.singleCalendar &&
this.fromDate !== null &&
this.toDate !== null);
},
enumerable: false,
configurable: true
});
DateRangePickerComponent.prototype.handleClick = function (event) {
var target = event.target;
// close the DatePicker if clicking outside is not allowed
if (!this.options.clickOutsideAllowed) {
var containerElementClassRoot_1 = "dateRangePicker";
var targetPathClassNames = [""];
if (event["path"]) {
targetPathClassNames = event["path"].map(function (obj) { return obj.className || ""; });
}
else {
try {
targetPathClassNames = event
.composedPath()
.map(function (item) { return item.className || ""; });
}
catch (error) {
console.warn("Edge sux");
}
}
var targetExistsInPath = targetPathClassNames.some(function (className) {
if (typeof className === "string") {
return className && className.includes(containerElementClassRoot_1);
}
return false;
});
if (!targetExistsInPath) {
this.toggleCalendarVisibility(false);
}
}
// Close the DatePicker if the target input was clicked
if (target.id === this.instanceId) {
this.toggleCalendarVisibility(!this.showCalendars);
}
};
DateRangePickerComponent.prototype.ngOnInit = function () {
var _this = this;
// ensure dates in options are valid
this.validateOptionDates();
// ensure input dates are within the min/max dates in options
this.validateInputDates();
if (this.options.preDefinedRanges &&
this.options.preDefinedRanges.length > 0) {
this.defaultRanges = this.validateAndAssignPredefinedRanges(this.options.preDefinedRanges);
}
// assign values not present in options with default values
var optionsKeys = Object.keys(this.options);
var defaultValuesKeys = Object.keys(defaultDateRangePickerOptions);
defaultValuesKeys.forEach(function (key) {
if (!optionsKeys.includes(key)) {
_this.options[key] = defaultDateRangePickerOptions[key];
}
});
// update calendar grid
this.updateCalendar();
// create parent form group if it doesn't exist
if (!this.parentFormGroup) {
this.parentFormGroup = new forms.FormGroup({});
}
// add form control to parent form group
var value = this.formatRangeAsString();
var control = new forms.FormControl(value, this.options.validators);
if (this.options.disabled) {
control.disable();
}
this.parentFormGroup.addControl(this.controlName, control);
// set value of control
this.setRange();
};
DateRangePickerComponent.prototype.validateInputDates = function () {
if (this.fromDate &&
this.options.minDate &&
this.fromDate.isBefore(this.options.minDate, "date")) {
throw new RangeError("@Input fromDate is before the specified minDate in options");
}
if (this.toDate &&
this.options.maxDate &&
this.toDate.isAfter(this.options.maxDate, "date")) {
throw new RangeError("@Input toDate is after the specified maxDate in options");
}
};
DateRangePickerComponent.prototype.validateOptionDates = function () {
// validate maxDate isn't before minDate or vice versa
if (this.options) {
if (this.options.minDate && this.options.maxDate) {
if (this.options.minDate.isAfter(this.options.maxDate, "date")) {
throw new RangeError("minDate specified in options is after the maxDate");
}
else if (this.options.maxDate.isBefore(this.options.minDate, "date")) {
throw new RangeError("maxDate specified in options is before the minDate");
}
}
}
};
// assists CSS to fix small positioning bug with From:/To: date text
DateRangePickerComponent.prototype.checkChrome = function () {
return window["chrome"] ? "is-chrome" : "";
};
DateRangePickerComponent.prototype.toggleCalendarVisibility = function (value) {
this.showCalendars = value !== null ? value : !this.showCalendars;
};
DateRangePickerComponent.prototype.setFromToMonthYear = function (fromDate, toDate) {
var tempFromDate = fromDate || this.fromDate || this.options.startingFromDate || moment();
var tempToDate = toDate || this.toDate || this.options.startingToDate || moment();
this.fromMonth = tempFromDate.get("month");
this.fromYear = tempFromDate.get("year");
this.toMonth = tempToDate.get("month");
this.toYear = tempToDate.get("year");
};
DateRangePickerComponent.prototype.updateCalendar = function () {
// get month and year to show calendar
this.setFromToMonthYear();
this.setRange();
};
// update from/to based on selection
DateRangePickerComponent.prototype.dateChanged = function (changedData) {
var value = changedData.day;
var isLeft = changedData.isLeft;
if (isLeft) {
this.fromDate = value;
if (this.fromDate.isAfter(this.toDate, "date")) {
this.toDate = this.fromDate.clone();
}
}
else {
this.toDate = value;
if (this.toDate.isBefore(this.fromDate, "date")) {
this.fromDate = this.toDate.clone();
}
}
this.setFromToMonthYear(this.fromDate, this.toDate);
if (this.isAutoApply() &&
(this.options.singleCalendar || !isLeft) &&
this.fromDate) {
this.toggleCalendarVisibility(false);
this.setRange();
this.emitRangeSelected();
}
};
DateRangePickerComponent.prototype.emitRangeSelected = function (data) {
if (!data) {
data = this.options.singleCalendar
? { start: this.fromDate }
: { start: this.fromDate, end: this.toDate };
}
this.rangeSelected.emit(data);
};
DateRangePickerComponent.prototype.getMoment = function (value) {
return moment(value, this.options.format);
};
DateRangePickerComponent.prototype.formatRangeAsString = function () {
var range = "";
if (this.options.singleCalendar && this.fromDate) {
range = this.fromDate.format(this.options.format);
}
else if (!this.options.singleCalendar && this.fromDate && this.toDate) {
range = this.fromDate.format(this.options.format) + " - " + this.toDate.format(this.options.format);
}
return range;
};
DateRangePickerComponent.prototype.setRange = function () {
this.range = this.formatRangeAsString();
if (this.parentFormGroup) {
var control = this.parentFormGroup.get(this.controlName);
if (control) {
control.setValue(this.range);
control.updateValueAndValidity();
}
}
};
DateRangePickerComponent.prototype.setDateFromInput = function (event, isLeft) {
if (isLeft === void 0) { isLeft = false; }
var target = event.target;
try {
if (target.value) {
var day = this.getMoment(target.value);
if (!day.isBefore(this.options.minDate) &&
!day.isAfter(this.options.maxDate)) {
if (isLeft && !this.fromDate) {
this.fromDate = day;
}
if (!isLeft && !this.toDate) {
this.toDate = day;
}
this.dateChanged({
day: day,
isLeft: isLeft
});
this.setFromToMonthYear(this.fromDate, this.toDate);
}
else {
// assume nothing - reset values
this.fromDate = null;
this.toDate = null;
target.value = "";
target.focus();
}
}
this.emitRangeSelected();
}
catch (e) {
console.error(e);
}
};
DateRangePickerComponent.prototype.monthChanged = function (data) {
var temp;
if (data.isLeft) {
temp = moment([this.fromYear, this.fromMonth]).add(data.value, "months");
this.fromMonth = temp.get("month");
this.fromYear = temp.get("year");
}
else {
temp = moment([this.toYear, this.toMonth]).add(data.value, "months");
this.toMonth = temp.get("month");
this.toYear = temp.get("year");
}
};
DateRangePickerComponent.prototype.yearChanged = function (data) {
var temp;
if (data.isLeft) {
temp = moment([this.fromYear, this.fromMonth]).add(data.value, "year");
this.fromMonth = temp.get("month");
this.fromYear = temp.get("year");
}
else {
temp = moment([this.toYear, this.toMonth]).add(data.value, "year");
this.toMonth = temp.get("month");
this.toYear = temp.get("year");
}
};
DateRangePickerComponent.prototype.close = function (event) {
this.toggleCalendarVisibility(false);
event.stopPropagation();
};
DateRangePickerComponent.prototype.reset = function (event) {
this.fromDate = null;
this.toDate = null;
this.setRange();
event.stopPropagation();
};
DateRangePickerComponent.prototype.apply = function (event) {
this.toggleCalendarVisibility(false);
this.setRange();
this.emitRangeSelected();
event.stopPropagation();
};
DateRangePickerComponent.prototype.applyPredefinedRange = function (event, definedDateRange) {
// adjust to/from month/year so calendar months and years match range
this.setFromToMonthYear(definedDateRange.value.start, definedDateRange.value.end);
this.fromDate = definedDateRange.value.start;
this.toDate = definedDateRange.value.end;
if (this.options.autoApply) {
this.apply(event);
}
};
DateRangePickerComponent.prototype.validateAndAssignPredefinedRanges = function (ranges) {
var _this = this;
return ranges.filter(function (range) {
if (range.value.start.isAfter(range.value.end, "date")) {
throw new RangeError("Pre-defined range \"" + range.name + "\" start date cannot be after the end date for the range.");
}
if (_this.options.minDate &&
range.value.start.isBefore(_this.options.minDate)) {
throw new RangeError("Pre-defined range \"" + range.name + "\" start date is before the specified minDate in your options.");
}
if (_this.options.maxDate &&
range.value.end.isAfter(_this.options.maxDate)) {
throw new RangeError("Pre-defined range \"" + range.name + "\" end date is after the specified maxDate in your options.");
}
// add range to ranges
return true;
});
};
DateRangePickerComponent.prototype.isAutoApply = function () {
if (this.options.singleCalendar) {
return true;
}
else {
return this.options.autoApply;
}
};
return DateRangePickerComponent;
}());
DateRangePickerComponent.decorators = [
{ type: core.Component, args: [{
encapsulation: core.ViewEncapsulation.None,
selector: "date-range-picker",
template: "<div class=\"dateRangePicker-wrapper\" *ngIf=\"parentFormGroup\">\n <div #content>\n <ng-content></ng-content>\n </div>\n <div class=\"form-group\" [formGroup]=\"parentFormGroup\">\n <ng-container *ngIf=\"content.childNodes.length === 0\">\n <label [attr.for]=\"instanceId\">{{ options.labelText }}</label>\n <input [attr.id]=\"instanceId\" class=\"form-control\" type=\"text\" [formControlName]=\"controlName\">\n </ng-container>\n\n <div [ngClass]=\"{'dateRangePicker': true, 'invisible': !showCalendars, 'dateRangePicker-single': options.singleCalendar, 'is-chrome': checkChrome(), 'open-left': options.position === 'left', 'open-right': options.position === 'right' }\">\n <div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col\">\n\n <div class=\"row form-inputs mb-0\" *ngIf=\"!options.singleCalendar\">\n\n <div class=\"col\">\n <div class=\"\" *ngIf=\"options.icons !== 'default'\">\n <div [ngClass]=\"{ 'd-flex align-items-center input-with-icon': true, 'material': options.icons === 'material'}\">\n <i *ngIf=\"options.icons === 'material'\" class=\"material-icons\">event</i>\n <i *ngIf=\"options.icons === 'font-awesome'\" class=\"far fa-calendar-alt\"></i>\n <span *ngIf=\"fromDate\">From: </span>\n <input class=\"form-control\" [ngModel]=\"fromDate | formatMomentDate: options.format\" (blur)=\"setDateFromInput($event, true)\" type=\"text\" name=\"daterangepicker_start\" [ngModelOptions]=\"{ standalone: true }\" placeholder=\"Select From Date\" />\n </div>\n </div>\n\n <input *ngIf=\"options.icons === 'default'\" class=\"form-control\" [ngModel]=\"fromDate | formatMomentDate: options.format\" (blur)=\"setDateFromInput($event, true)\" type=\"text\" name=\"daterangepicker_start\" [ngModelOptions]=\"{standalone: true}\" placeholder=\"Select From Date\" />\n </div>\n\n <div class=\"col\">\n <div class=\"\" *ngIf=\"options.icons !== 'default'\">\n <div [ngClass]=\"{ 'd-flex align-items-center input-with-icon': true, 'material': options.icons === 'material'}\">\n <i *ngIf=\"options.icons === 'material'\" class=\"material-icons\">event</i>\n <i *ngIf=\"options.icons === 'font-awesome'\" class=\"far fa-calendar-alt\"></i>\n <span *ngIf=\"toDate\">To: </span>\n <input class=\"form-control\" [ngModel]=\"toDate | formatMomentDate: options.format\" (blur)=\"setDateFromInput($event)\" type=\"text\" name=\"daterangepicker_end\" [ngModelOptions]=\"{ standalone: true }\" placeholder=\"Select To Date\" />\n </div>\n </div>\n\n <input *ngIf=\"options.icons === 'default'\" class=\"form-control\" [ngModel]=\"toDate | formatMomentDate: options.format\" (blur)=\"setDateFromInput($event)\" name=\"daterangepicker_end\" [ngModelOptions]=\"{standalone: true}\" />\n </div>\n\n </div>\n\n <div class=\"row row-calendars\">\n <div class=\"col\">\n <calendar [ngClass]=\"{ 'calendar': true, 'calendar-single': options.singleCalendar }\" [isLeft]=\"true\" [month]=\"fromMonth\" [year]=\"fromYear\" (monthChanged)=monthChanged($event)\n (yearChanged)=\"yearChanged($event)\" (dateChanged)=\"dateChanged($event)\" [format]=\"options.format\" [selectedFromDate]=\"fromDate\"\n [selectedToDate]=\"toDate\" [minDate]=\"options.minDate\" [maxDate]=\"options.maxDate\" [singleCalendar]=\"options.singleCalendar\" [icons]=\"options.icons\"></calendar>\n </div>\n\n <div class=\"col\" *ngIf=\"!options.singleCalendar\">\n <calendar class=\"calendar\" [month]=\"toMonth\" [year]=\"toYear\" [format]=\"options.format\" (dateChanged)=\"dateChanged($event)\" (monthChanged)=\"monthChanged($event)\" (yearChanged)=yearChanged($event) [selectedFromDate]=\"fromDate\" [selectedToDate]=\"toDate\" [minDate]=\"options.minDate\" [maxDate]=\"options.maxDate\" [icons]=\"options.icons\"></calendar>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"row text-center my-3\" *ngIf=\"!options.singleCalendar\">\n <div class=\"col\">\n <div class=\"row mb-2\" *ngIf=\"options.preDefinedRanges && options.preDefinedRanges.length > 0\">\n <div class=\"col\">\n <button type=\"button\" *ngFor=\"let range of options.preDefinedRanges\" class=\"btn btn-link\" (click)=\"applyPredefinedRange($event, range)\">{{ range.name }}</button>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-outline-secondary btn-sm\" (click)=\"close($event)\">Close</button>\n <button type=\"button\" class=\"btn btn-outline-secondary btn-sm ml-3\" (click)=\"reset($event)\" *ngIf=\"this.range\">Reset</button>\n <button type=\"button\" class=\"btn btn-primary btn-sm ml-3\" [disabled]=\"!enableApplyButton\" (click)=\"apply($event)\" *ngIf=\"!isAutoApply()\">Apply</button>\n </div>\n </div>\n\n </div>\n </div>\n\n </div>\n</div>\n",
styles: [".dateRangePicker-wrapper{position:relative;border:none}.dateRangePicker-wrapper .dateRangePicker{background:#fff;border-radius:9px;box-shadow:0 0 10px #818b9080;font-family:\"Roboto\",Helvetica,Arial,sans-serif;overflow:visible;position:absolute;top:88px;z-index:3000}.dateRangePicker-wrapper .dateRangePicker.dateRangePicker-single{min-width:300px}@media screen and (min-width: 576px){.dateRangePicker-wrapper .dateRangePicker{min-width:600px}}.dateRangePicker-wrapper .dateRangePicker:before,.dateRangePicker-wrapper .dateRangePicker:after{content:\"\";height:0px;width:0px;border-bottom:10px solid #6E777C;border-left:10px solid transparent;border-right:10px solid transparent;position:absolute;top:-10px}.dateRangePicker-wrapper .dateRangePicker.open-left{left:0}.dateRangePicker-wrapper .dateRangePicker.open-left:before{left:10px}.dateRangePicker-wrapper .dateRangePicker.open-left:after{display:none}.dateRangePicker-wrapper .dateRangePicker.open-right{right:0}.dateRangePicker-wrapper .dateRangePicker.open-right:before{display:none}.dateRangePicker-wrapper .dateRangePicker.open-right:after{right:10px}.dateRangePicker-wrapper .dateRangePicker.is-chrome .form-inputs .input-with-icon span{position:relative;top:1px}.dateRangePicker-wrapper .dateRangePicker .btn,.dateRangePicker-wrapper .dateRangePicker .btn.btn-link{min-width:auto;width:auto}.dateRangePicker-wrapper .dateRangePicker .form-inputs{background-color:#6e777c;border-top-left-radius:8px;border-top-right-radius:8px;color:#fff;font-size:16px}.dateRangePicker-wrapper .dateRangePicker .form-inputs>.col{padding:.5rem 15px;min-width:270px}.dateRangePicker-wrapper .dateRangePicker .form-inputs .input-with-icon{display:flex;align-content:flex-start;align-items:center!important}.dateRangePicker-wrapper .dateRangePicker .form-inputs .input-with-icon i{color:#fff;margin-right:.5rem}.dateRangePicker-wrapper .dateRangePicker .form-inputs .input-with-icon i.material-icons{top:0}.dateRangePicker-wrapper .dateRangePicker .form-inputs .input-with-icon span{line-height:1}.dateRangePicker-wrapper .dateRangePicker .form-inputs .form-control{background:none;border:0 none;color:#fff;display:inline-block;padding:0;width:150px}.dateRangePicker-wrapper .dateRangePicker .form-inputs .form-control::-moz-placeholder{color:#fff}.dateRangePicker-wrapper .dateRangePicker .form-inputs .form-control::placeholder{color:#fff}.dateRangePicker-wrapper .dateRangePicker .form-inputs>div:nth-child(2),.dateRangePicker-wrapper .dateRangePicker .row-calendars>div:nth-child(2){border-left:solid 2px #C6D1D6}.dateRangePicker-wrapper i.material-icons{position:relative;top:2px}\n"]
},] }
];
DateRangePickerComponent.ctorParameters = function () { return []; };
DateRangePickerComponent.propDecorators = {
options: [{ type: core.Input }],
controlName: [{ type: core.Input }],
instanceId: [{ type: core.Input }],
parentFormGroup: [{ type: core.Input }],
fromDate: [{ type: core.Input }],
toDate: [{ type: core.Input }],
rangeSelected: [{ type: core.Output }],
handleClick: [{ type: core.HostListener, args: ["document:click", ["$event"],] }]
};
var FormatMomentDatePipe = /** @class */ (function () {
function FormatMomentDatePipe() {
}
FormatMomentDatePipe.prototype.transform = function (value, format) {
return value ? value.format(format) : '';
};
return FormatMomentDatePipe;
}());
FormatMomentDatePipe.decorators = [
{ type: core.Pipe, args: [{
name: 'formatMomentDate'
},] }
];
var declarations = [
CalendarComponent,
DateRangePickerComponent,
FormatMomentDatePipe,
];
var NgxDateRangeModule = /** @class */ (function () {
function NgxDateRangeModule() {
}
return NgxDateRangeModule;
}());
NgxDateRangeModule.decorators = [
{ type: core.NgModule, args: [{
declarations: __spreadArray([], __read(declarations)),
exports: __spreadArray([], __read(declarations)),
imports: [
common.CommonModule,
forms.FormsModule,
forms.ReactiveFormsModule,
]
},] }
];
/**
* Generated bundle index. Do not edit.
*/
exports.CalendarComponent = CalendarComponent;
exports.DateRangePickerComponent = DateRangePickerComponent;
exports.NgxDateRangeModule = NgxDateRangeModule;
exports["ɵa"] = FormatMomentDatePipe;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=eduardsson-ngx-daterange.umd.js.map