- * ```
- */
-exports.default = {
- bind: function bind(el, binding, vnode) {
- nodeList.push(el);
- var id = seed++;
- el[ctx] = {
- id: id,
- documentHandler: createDocumentHandler(el, binding, vnode),
- methodName: binding.expression,
- bindingFn: binding.value
- };
- },
- update: function update(el, binding, vnode) {
- el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
- el[ctx].methodName = binding.expression;
- el[ctx].bindingFn = binding.value;
- },
- unbind: function unbind(el) {
- var len = nodeList.length;
-
- for (var i = 0; i < len; i++) {
- if (nodeList[i][ctx].id === el[ctx].id) {
- nodeList.splice(i, 1);
- break;
- }
- }
- delete el[ctx];
- }
-};
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/date-util.js":
-/*!*********************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/date-util.js ***!
- \*********************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.validateRangeInOneMonth = exports.extractTimeFormat = exports.extractDateFormat = exports.nextYear = exports.prevYear = exports.nextMonth = exports.prevMonth = exports.changeYearMonthAndClampDate = exports.timeWithinRange = exports.limitTimeRange = exports.clearMilliseconds = exports.clearTime = exports.modifyWithTimeString = exports.modifyTime = exports.modifyDate = exports.range = exports.getRangeMinutes = exports.getMonthDays = exports.getPrevMonthLastDays = exports.getRangeHours = exports.getWeekNumber = exports.getStartDateOfMonth = exports.nextDate = exports.prevDate = exports.getFirstDayOfMonth = exports.getDayCountOfYear = exports.getDayCountOfMonth = exports.parseDate = exports.formatDate = exports.isDateObject = exports.isDate = exports.toDate = exports.getI18nSettings = undefined;
-
-var _date = __webpack_require__(/*! element-ui/lib/utils/date */ "../../node_modules/element-ui/lib/utils/date.js");
-
-var _date2 = _interopRequireDefault(_date);
-
-var _locale = __webpack_require__(/*! element-ui/lib/locale */ "../../node_modules/element-ui/lib/locale/index.js");
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
-var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
-
-var newArray = function newArray(start, end) {
- var result = [];
- for (var i = start; i <= end; i++) {
- result.push(i);
- }
- return result;
-};
-
-var getI18nSettings = exports.getI18nSettings = function getI18nSettings() {
- return {
- dayNamesShort: weeks.map(function (week) {
- return (0, _locale.t)('el.datepicker.weeks.' + week);
- }),
- dayNames: weeks.map(function (week) {
- return (0, _locale.t)('el.datepicker.weeks.' + week);
- }),
- monthNamesShort: months.map(function (month) {
- return (0, _locale.t)('el.datepicker.months.' + month);
- }),
- monthNames: months.map(function (month, index) {
- return (0, _locale.t)('el.datepicker.month' + (index + 1));
- }),
- amPm: ['am', 'pm']
- };
-};
-
-var toDate = exports.toDate = function toDate(date) {
- return isDate(date) ? new Date(date) : null;
-};
-
-var isDate = exports.isDate = function isDate(date) {
- if (date === null || date === undefined) return false;
- if (isNaN(new Date(date).getTime())) return false;
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
- return true;
-};
-
-var isDateObject = exports.isDateObject = function isDateObject(val) {
- return val instanceof Date;
-};
-
-var formatDate = exports.formatDate = function formatDate(date, format) {
- date = toDate(date);
- if (!date) return '';
- return _date2.default.format(date, format || 'yyyy-MM-dd', getI18nSettings());
-};
-
-var parseDate = exports.parseDate = function parseDate(string, format) {
- return _date2.default.parse(string, format || 'yyyy-MM-dd', getI18nSettings());
-};
-
-var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) {
- if (month === 3 || month === 5 || month === 8 || month === 10) {
- return 30;
- }
-
- if (month === 1) {
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
- return 29;
- } else {
- return 28;
- }
- }
-
- return 31;
-};
-
-var getDayCountOfYear = exports.getDayCountOfYear = function getDayCountOfYear(year) {
- var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
- return isLeapYear ? 366 : 365;
-};
-
-var getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) {
- var temp = new Date(date.getTime());
- temp.setDate(1);
- return temp.getDay();
-};
-
-// see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
-// {prev, next} Date should work for Daylight Saving Time
-// Adding 24 * 60 * 60 * 1000 does not work in the above scenario
-var prevDate = exports.prevDate = function prevDate(date) {
- var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
-
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
-};
-
-var nextDate = exports.nextDate = function nextDate(date) {
- var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
-
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
-};
-
-var getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) {
- var result = new Date(year, month, 1);
- var day = result.getDay();
-
- if (day === 0) {
- return prevDate(result, 7);
- } else {
- return prevDate(result, day);
- }
-};
-
-var getWeekNumber = exports.getWeekNumber = function getWeekNumber(src) {
- if (!isDate(src)) return null;
- var date = new Date(src.getTime());
- date.setHours(0, 0, 0, 0);
- // Thursday in current week decides the year.
- date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
- // January 4 is always in week 1.
- var week1 = new Date(date.getFullYear(), 0, 4);
- // Adjust to Thursday in week 1 and count number of weeks from date to week 1.
- // Rounding should be fine for Daylight Saving Time. Its shift should never be more than 12 hours.
- return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
-};
-
-var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) {
- var hours = [];
- var disabledHours = [];
-
- (ranges || []).forEach(function (range) {
- var value = range.map(function (date) {
- return date.getHours();
- });
-
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
- });
-
- if (disabledHours.length) {
- for (var i = 0; i < 24; i++) {
- hours[i] = disabledHours.indexOf(i) === -1;
- }
- } else {
- for (var _i = 0; _i < 24; _i++) {
- hours[_i] = false;
- }
- }
-
- return hours;
-};
-
-var getPrevMonthLastDays = exports.getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
- if (amount <= 0) return [];
- var temp = new Date(date.getTime());
- temp.setDate(0);
- var lastDay = temp.getDate();
- return range(amount).map(function (_, index) {
- return lastDay - (amount - index - 1);
- });
-};
-
-var getMonthDays = exports.getMonthDays = function getMonthDays(date) {
- var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
- var days = temp.getDate();
- return range(days).map(function (_, index) {
- return index + 1;
- });
-};
-
-function setRangeData(arr, start, end, value) {
- for (var i = start; i < end; i++) {
- arr[i] = value;
- }
-}
-
-var getRangeMinutes = exports.getRangeMinutes = function getRangeMinutes(ranges, hour) {
- var minutes = new Array(60);
-
- if (ranges.length > 0) {
- ranges.forEach(function (range) {
- var start = range[0];
- var end = range[1];
- var startHour = start.getHours();
- var startMinute = start.getMinutes();
- var endHour = end.getHours();
- var endMinute = end.getMinutes();
- if (startHour === hour && endHour !== hour) {
- setRangeData(minutes, startMinute, 60, true);
- } else if (startHour === hour && endHour === hour) {
- setRangeData(minutes, startMinute, endMinute + 1, true);
- } else if (startHour !== hour && endHour === hour) {
- setRangeData(minutes, 0, endMinute + 1, true);
- } else if (startHour < hour && endHour > hour) {
- setRangeData(minutes, 0, 60, true);
- }
- });
- } else {
- setRangeData(minutes, 0, 60, true);
- }
- return minutes;
-};
-
-var range = exports.range = function range(n) {
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
- return Array.apply(null, { length: n }).map(function (_, n) {
- return n;
- });
-};
-
-var modifyDate = exports.modifyDate = function modifyDate(date, y, m, d) {
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
-};
-
-var modifyTime = exports.modifyTime = function modifyTime(date, h, m, s) {
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
-};
-
-var modifyWithTimeString = exports.modifyWithTimeString = function modifyWithTimeString(date, time) {
- if (date == null || !time) {
- return date;
- }
- time = parseDate(time, 'HH:mm:ss');
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
-};
-
-var clearTime = exports.clearTime = function clearTime(date) {
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
-};
-
-var clearMilliseconds = exports.clearMilliseconds = function clearMilliseconds(date) {
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
-};
-
-var limitTimeRange = exports.limitTimeRange = function limitTimeRange(date, ranges) {
- var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
-
- // TODO: refactory a more elegant solution
- if (ranges.length === 0) return date;
- var normalizeDate = function normalizeDate(date) {
- return _date2.default.parse(_date2.default.format(date, format), format);
- };
- var ndate = normalizeDate(date);
- var nranges = ranges.map(function (range) {
- return range.map(normalizeDate);
- });
- if (nranges.some(function (nrange) {
- return ndate >= nrange[0] && ndate <= nrange[1];
- })) return date;
-
- var minDate = nranges[0][0];
- var maxDate = nranges[0][0];
-
- nranges.forEach(function (nrange) {
- minDate = new Date(Math.min(nrange[0], minDate));
- maxDate = new Date(Math.max(nrange[1], minDate));
- });
-
- var ret = ndate < minDate ? minDate : maxDate;
- // preserve Year/Month/Date
- return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
-};
-
-var timeWithinRange = exports.timeWithinRange = function timeWithinRange(date, selectableRange, format) {
- var limitedDate = limitTimeRange(date, selectableRange, format);
- return limitedDate.getTime() === date.getTime();
-};
-
-var changeYearMonthAndClampDate = exports.changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
- // clamp date to the number of days in `year`, `month`
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
- var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
- return modifyDate(date, year, month, monthDate);
-};
-
-var prevMonth = exports.prevMonth = function prevMonth(date) {
- var year = date.getFullYear();
- var month = date.getMonth();
- return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
-};
-
-var nextMonth = exports.nextMonth = function nextMonth(date) {
- var year = date.getFullYear();
- var month = date.getMonth();
- return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
-};
-
-var prevYear = exports.prevYear = function prevYear(date) {
- var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
-
- var year = date.getFullYear();
- var month = date.getMonth();
- return changeYearMonthAndClampDate(date, year - amount, month);
-};
-
-var nextYear = exports.nextYear = function nextYear(date) {
- var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
-
- var year = date.getFullYear();
- var month = date.getMonth();
- return changeYearMonthAndClampDate(date, year + amount, month);
-};
-
-var extractDateFormat = exports.extractDateFormat = function extractDateFormat(format) {
- return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
-};
-
-var extractTimeFormat = exports.extractTimeFormat = function extractTimeFormat(format) {
- return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
-};
-
-var validateRangeInOneMonth = exports.validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
- return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
-};
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/date.js":
-/*!****************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/date.js ***!
- \****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-var __WEBPACK_AMD_DEFINE_RESULT__;
-
-/* Modified from https://github.com/taylorhakes/fecha
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Taylor Hakes
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*eslint-disable*/
-// 把 YYYY-MM-DD 改成了 yyyy-MM-dd
-(function (main) {
- 'use strict';
-
- /**
- * Parse or format dates
- * @class fecha
- */
-
- var fecha = {};
- var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
- var twoDigits = '\\d\\d?';
- var threeDigits = '\\d{3}';
- var fourDigits = '\\d{4}';
- var word = '[^\\s]+';
- var literal = /\[([^]*?)\]/gm;
- var noop = function noop() {};
-
- function regexEscape(str) {
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
- }
-
- function shorten(arr, sLen) {
- var newArr = [];
- for (var i = 0, len = arr.length; i < len; i++) {
- newArr.push(arr[i].substr(0, sLen));
- }
- return newArr;
- }
-
- function monthUpdate(arrName) {
- return function (d, v, i18n) {
- var index = i18n[arrName].indexOf(v.charAt(0).toUpperCase() + v.substr(1).toLowerCase());
- if (~index) {
- d.month = index;
- }
- };
- }
-
- function pad(val, len) {
- val = String(val);
- len = len || 2;
- while (val.length < len) {
- val = '0' + val;
- }
- return val;
- }
-
- var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
- var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
- var monthNamesShort = shorten(monthNames, 3);
- var dayNamesShort = shorten(dayNames, 3);
- fecha.i18n = {
- dayNamesShort: dayNamesShort,
- dayNames: dayNames,
- monthNamesShort: monthNamesShort,
- monthNames: monthNames,
- amPm: ['am', 'pm'],
- DoFn: function DoFn(D) {
- return D + ['th', 'st', 'nd', 'rd'][D % 10 > 3 ? 0 : (D - D % 10 !== 10) * D % 10];
- }
- };
-
- var formatFlags = {
- D: function D(dateObj) {
- return dateObj.getDay();
- },
- DD: function DD(dateObj) {
- return pad(dateObj.getDay());
- },
- Do: function Do(dateObj, i18n) {
- return i18n.DoFn(dateObj.getDate());
- },
- d: function d(dateObj) {
- return dateObj.getDate();
- },
- dd: function dd(dateObj) {
- return pad(dateObj.getDate());
- },
- ddd: function ddd(dateObj, i18n) {
- return i18n.dayNamesShort[dateObj.getDay()];
- },
- dddd: function dddd(dateObj, i18n) {
- return i18n.dayNames[dateObj.getDay()];
- },
- M: function M(dateObj) {
- return dateObj.getMonth() + 1;
- },
- MM: function MM(dateObj) {
- return pad(dateObj.getMonth() + 1);
- },
- MMM: function MMM(dateObj, i18n) {
- return i18n.monthNamesShort[dateObj.getMonth()];
- },
- MMMM: function MMMM(dateObj, i18n) {
- return i18n.monthNames[dateObj.getMonth()];
- },
- yy: function yy(dateObj) {
- return pad(String(dateObj.getFullYear()), 4).substr(2);
- },
- yyyy: function yyyy(dateObj) {
- return pad(dateObj.getFullYear(), 4);
- },
- h: function h(dateObj) {
- return dateObj.getHours() % 12 || 12;
- },
- hh: function hh(dateObj) {
- return pad(dateObj.getHours() % 12 || 12);
- },
- H: function H(dateObj) {
- return dateObj.getHours();
- },
- HH: function HH(dateObj) {
- return pad(dateObj.getHours());
- },
- m: function m(dateObj) {
- return dateObj.getMinutes();
- },
- mm: function mm(dateObj) {
- return pad(dateObj.getMinutes());
- },
- s: function s(dateObj) {
- return dateObj.getSeconds();
- },
- ss: function ss(dateObj) {
- return pad(dateObj.getSeconds());
- },
- S: function S(dateObj) {
- return Math.round(dateObj.getMilliseconds() / 100);
- },
- SS: function SS(dateObj) {
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
- },
- SSS: function SSS(dateObj) {
- return pad(dateObj.getMilliseconds(), 3);
- },
- a: function a(dateObj, i18n) {
- return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1];
- },
- A: function A(dateObj, i18n) {
- return dateObj.getHours() < 12 ? i18n.amPm[0].toUpperCase() : i18n.amPm[1].toUpperCase();
- },
- ZZ: function ZZ(dateObj) {
- var o = dateObj.getTimezoneOffset();
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
- }
- };
-
- var parseFlags = {
- d: [twoDigits, function (d, v) {
- d.day = v;
- }],
- Do: [twoDigits + word, function (d, v) {
- d.day = parseInt(v, 10);
- }],
- M: [twoDigits, function (d, v) {
- d.month = v - 1;
- }],
- yy: [twoDigits, function (d, v) {
- var da = new Date(),
- cent = +('' + da.getFullYear()).substr(0, 2);
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
- }],
- h: [twoDigits, function (d, v) {
- d.hour = v;
- }],
- m: [twoDigits, function (d, v) {
- d.minute = v;
- }],
- s: [twoDigits, function (d, v) {
- d.second = v;
- }],
- yyyy: [fourDigits, function (d, v) {
- d.year = v;
- }],
- S: ['\\d', function (d, v) {
- d.millisecond = v * 100;
- }],
- SS: ['\\d{2}', function (d, v) {
- d.millisecond = v * 10;
- }],
- SSS: [threeDigits, function (d, v) {
- d.millisecond = v;
- }],
- D: [twoDigits, noop],
- ddd: [word, noop],
- MMM: [word, monthUpdate('monthNamesShort')],
- MMMM: [word, monthUpdate('monthNames')],
- a: [word, function (d, v, i18n) {
- var val = v.toLowerCase();
- if (val === i18n.amPm[0]) {
- d.isPm = false;
- } else if (val === i18n.amPm[1]) {
- d.isPm = true;
- }
- }],
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
- var parts = (v + '').match(/([+-]|\d\d)/gi),
- minutes;
-
- if (parts) {
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
- }
- }]
- };
- parseFlags.dd = parseFlags.d;
- parseFlags.dddd = parseFlags.ddd;
- parseFlags.DD = parseFlags.D;
- parseFlags.mm = parseFlags.m;
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
- parseFlags.MM = parseFlags.M;
- parseFlags.ss = parseFlags.s;
- parseFlags.A = parseFlags.a;
-
- // Some common format strings
- fecha.masks = {
- default: 'ddd MMM dd yyyy HH:mm:ss',
- shortDate: 'M/D/yy',
- mediumDate: 'MMM d, yyyy',
- longDate: 'MMMM d, yyyy',
- fullDate: 'dddd, MMMM d, yyyy',
- shortTime: 'HH:mm',
- mediumTime: 'HH:mm:ss',
- longTime: 'HH:mm:ss.SSS'
- };
-
- /***
- * Format a date
- * @method format
- * @param {Date|number} dateObj
- * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
- */
- fecha.format = function (dateObj, mask, i18nSettings) {
- var i18n = i18nSettings || fecha.i18n;
-
- if (typeof dateObj === 'number') {
- dateObj = new Date(dateObj);
- }
-
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
- throw new Error('Invalid Date in fecha.format');
- }
-
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
-
- var literals = [];
-
- // Make literals inactive by replacing them with ??
- mask = mask.replace(literal, function ($0, $1) {
- literals.push($1);
- return '@@@';
- });
- // Apply formatting rules
- mask = mask.replace(token, function ($0) {
- return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1);
- });
- // Inline literal values back into the formatted value
- return mask.replace(/@@@/g, function () {
- return literals.shift();
- });
- };
-
- /**
- * Parse a date string into an object, changes - into /
- * @method parse
- * @param {string} dateStr Date string
- * @param {string} format Date parse format
- * @returns {Date|boolean}
- */
- fecha.parse = function (dateStr, format, i18nSettings) {
- var i18n = i18nSettings || fecha.i18n;
-
- if (typeof format !== 'string') {
- throw new Error('Invalid format in fecha.parse');
- }
-
- format = fecha.masks[format] || format;
-
- // Avoid regular expression denial of service, fail early for really long strings
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
- if (dateStr.length > 1000) {
- return null;
- }
-
- var dateInfo = {};
- var parseInfo = [];
- var literals = [];
- format = format.replace(literal, function ($0, $1) {
- literals.push($1);
- return '@@@';
- });
- var newFormat = regexEscape(format).replace(token, function ($0) {
- if (parseFlags[$0]) {
- var info = parseFlags[$0];
- parseInfo.push(info[1]);
- return '(' + info[0] + ')';
- }
-
- return $0;
- });
- newFormat = newFormat.replace(/@@@/g, function () {
- return literals.shift();
- });
- var matches = dateStr.match(new RegExp(newFormat, 'i'));
- if (!matches) {
- return null;
- }
-
- for (var i = 1; i < matches.length; i++) {
- parseInfo[i - 1](dateInfo, matches[i], i18n);
- }
-
- var today = new Date();
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
- dateInfo.hour = +dateInfo.hour + 12;
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
- dateInfo.hour = 0;
- }
-
- var date;
- if (dateInfo.timezoneOffset != null) {
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
- date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
- } else {
- date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
- }
- return date;
- };
-
- /* istanbul ignore next */
- if ( true && module.exports) {
- module.exports = fecha;
- } else if (true) {
- !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
- return fecha;
- }).call(exports, __webpack_require__, exports, module),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
-})(undefined);
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/dom.js":
-/*!***************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/dom.js ***!
- \***************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.isInContainer = exports.getScrollContainer = exports.isScroll = exports.getStyle = exports.once = exports.off = exports.on = undefined;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* istanbul ignore next */
-
-exports.hasClass = hasClass;
-exports.addClass = addClass;
-exports.removeClass = removeClass;
-exports.setStyle = setStyle;
-
-var _vue = __webpack_require__(/*! vue */ "../../node_modules/vue/dist/vue.common.js");
-
-var _vue2 = _interopRequireDefault(_vue);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var isServer = _vue2.default.prototype.$isServer;
-var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
-var MOZ_HACK_REGEXP = /^moz([A-Z])/;
-var ieVersion = isServer ? 0 : Number(document.documentMode);
-
-/* istanbul ignore next */
-var trim = function trim(string) {
- return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
-};
-/* istanbul ignore next */
-var camelCase = function camelCase(name) {
- return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
- return offset ? letter.toUpperCase() : letter;
- }).replace(MOZ_HACK_REGEXP, 'Moz$1');
-};
-
-/* istanbul ignore next */
-var on = exports.on = function () {
- if (!isServer && document.addEventListener) {
- return function (element, event, handler) {
- if (element && event && handler) {
- element.addEventListener(event, handler, false);
- }
- };
- } else {
- return function (element, event, handler) {
- if (element && event && handler) {
- element.attachEvent('on' + event, handler);
- }
- };
- }
-}();
-
-/* istanbul ignore next */
-var off = exports.off = function () {
- if (!isServer && document.removeEventListener) {
- return function (element, event, handler) {
- if (element && event) {
- element.removeEventListener(event, handler, false);
- }
- };
- } else {
- return function (element, event, handler) {
- if (element && event) {
- element.detachEvent('on' + event, handler);
- }
- };
- }
-}();
-
-/* istanbul ignore next */
-var once = exports.once = function once(el, event, fn) {
- var listener = function listener() {
- if (fn) {
- fn.apply(this, arguments);
- }
- off(el, event, listener);
- };
- on(el, event, listener);
-};
-
-/* istanbul ignore next */
-function hasClass(el, cls) {
- if (!el || !cls) return false;
- if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
- if (el.classList) {
- return el.classList.contains(cls);
- } else {
- return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
- }
-};
-
-/* istanbul ignore next */
-function addClass(el, cls) {
- if (!el) return;
- var curClass = el.className;
- var classes = (cls || '').split(' ');
-
- for (var i = 0, j = classes.length; i < j; i++) {
- var clsName = classes[i];
- if (!clsName) continue;
-
- if (el.classList) {
- el.classList.add(clsName);
- } else if (!hasClass(el, clsName)) {
- curClass += ' ' + clsName;
- }
- }
- if (!el.classList) {
- el.className = curClass;
- }
-};
-
-/* istanbul ignore next */
-function removeClass(el, cls) {
- if (!el || !cls) return;
- var classes = cls.split(' ');
- var curClass = ' ' + el.className + ' ';
-
- for (var i = 0, j = classes.length; i < j; i++) {
- var clsName = classes[i];
- if (!clsName) continue;
-
- if (el.classList) {
- el.classList.remove(clsName);
- } else if (hasClass(el, clsName)) {
- curClass = curClass.replace(' ' + clsName + ' ', ' ');
- }
- }
- if (!el.classList) {
- el.className = trim(curClass);
- }
-};
-
-/* istanbul ignore next */
-var getStyle = exports.getStyle = ieVersion < 9 ? function (element, styleName) {
- if (isServer) return;
- if (!element || !styleName) return null;
- styleName = camelCase(styleName);
- if (styleName === 'float') {
- styleName = 'styleFloat';
- }
- try {
- switch (styleName) {
- case 'opacity':
- try {
- return element.filters.item('alpha').opacity / 100;
- } catch (e) {
- return 1.0;
- }
- default:
- return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
- }
- } catch (e) {
- return element.style[styleName];
- }
-} : function (element, styleName) {
- if (isServer) return;
- if (!element || !styleName) return null;
- styleName = camelCase(styleName);
- if (styleName === 'float') {
- styleName = 'cssFloat';
- }
- try {
- var computed = document.defaultView.getComputedStyle(element, '');
- return element.style[styleName] || computed ? computed[styleName] : null;
- } catch (e) {
- return element.style[styleName];
- }
-};
-
-/* istanbul ignore next */
-function setStyle(element, styleName, value) {
- if (!element || !styleName) return;
-
- if ((typeof styleName === 'undefined' ? 'undefined' : _typeof(styleName)) === 'object') {
- for (var prop in styleName) {
- if (styleName.hasOwnProperty(prop)) {
- setStyle(element, prop, styleName[prop]);
- }
- }
- } else {
- styleName = camelCase(styleName);
- if (styleName === 'opacity' && ieVersion < 9) {
- element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
- } else {
- element.style[styleName] = value;
- }
- }
-};
-
-var isScroll = exports.isScroll = function isScroll(el, vertical) {
- if (isServer) return;
-
- var determinedDirection = vertical !== null || vertical !== undefined;
- var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow');
-
- return overflow.match(/(scroll|auto)/);
-};
-
-var getScrollContainer = exports.getScrollContainer = function getScrollContainer(el, vertical) {
- if (isServer) return;
-
- var parent = el;
- while (parent) {
- if ([window, document, document.documentElement].includes(parent)) {
- return window;
- }
- if (isScroll(parent, vertical)) {
- return parent;
- }
- parent = parent.parentNode;
- }
-
- return parent;
-};
-
-var isInContainer = exports.isInContainer = function isInContainer(el, container) {
- if (isServer || !el || !container) return false;
-
- var elRect = el.getBoundingClientRect();
- var containerRect = void 0;
-
- if ([window, document, document.documentElement, null, undefined].includes(container)) {
- containerRect = {
- top: 0,
- right: window.innerWidth,
- bottom: window.innerHeight,
- left: 0
- };
- } else {
- containerRect = container.getBoundingClientRect();
- }
-
- return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
-};
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/merge.js":
-/*!*****************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/merge.js ***!
- \*****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-
-exports.default = function (target) {
- for (var i = 1, j = arguments.length; i < j; i++) {
- var source = arguments[i] || {};
- for (var prop in source) {
- if (source.hasOwnProperty(prop)) {
- var value = source[prop];
- if (value !== undefined) {
- target[prop] = value;
- }
- }
- }
- }
-
- return target;
-};
-
-;
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/popper.js":
-/*!******************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/popper.js ***!
- \******************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-/**
- * @fileOverview Kickass library to create and place poppers near their reference elements.
- * @version {{version}}
- * @license
- * Copyright (c) 2016 Federico Zivolo and contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-//
-// Cross module loader
-// Supported: Node, AMD, Browser globals
-//
-;(function (root, factory) {
- if (true) {
- // AMD. Register as an anonymous module.
- !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
- __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
-})(undefined, function () {
-
- 'use strict';
-
- var root = window;
-
- // default options
- var DEFAULTS = {
- // placement of the popper
- placement: 'bottom',
-
- gpuAcceleration: true,
-
- // shift popper from its origin by the given amount of pixels (can be negative)
- offset: 0,
-
- // the element which will act as boundary of the popper
- boundariesElement: 'viewport',
-
- // amount of pixel used to define a minimum distance between the boundaries and the popper
- boundariesPadding: 5,
-
- // popper will try to prevent overflow following this order,
- // by default, then, it could overflow on the left and on top of the boundariesElement
- preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
-
- // the behavior used by flip to change the placement of the popper
- flipBehavior: 'flip',
-
- arrowElement: '[x-arrow]',
-
- arrowOffset: 0,
-
- // list of functions used to modify the offsets before they are applied to the popper
- modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
-
- modifiersIgnored: [],
-
- forceAbsolute: false
- };
-
- /**
- * Create a new Popper.js instance
- * @constructor Popper
- * @param {HTMLElement} reference - The reference element used to position the popper
- * @param {HTMLElement|Object} popper
- * The HTML element used as popper, or a configuration used to generate the popper.
- * @param {String} [popper.tagName='div'] The tag name of the generated popper.
- * @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
- * @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
- * @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
- * @param {String} [popper.content=''] The content of the popper, it can be text, html, or node; if it is not text, set `contentType` to `html` or `node`.
- * @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
- * @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
- * @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
- * @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
- * @param {Object} options
- * @param {String} [options.placement=bottom]
- * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
- * left(-start, -end)`
- *
- * @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
- * The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
- * its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
- * reference element.
- * By default, it will look for a child node of the popper with the `x-arrow` attribute.
- *
- * @param {Boolean} [options.gpuAcceleration=true]
- * When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
- * browser to use the GPU to accelerate the rendering.
- * If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
- *
- * @param {Number} [options.offset=0]
- * Amount of pixels the popper will be shifted (can be negative).
- *
- * @param {String|Element} [options.boundariesElement='viewport']
- * The element which will define the boundaries of the popper position, the popper will never be placed outside
- * of the defined boundaries (except if `keepTogether` is enabled)
- *
- * @param {Number} [options.boundariesPadding=5]
- * Additional padding for the boundaries
- *
- * @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
- * Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
- * this means that the last ones will never overflow
- *
- * @param {String|Array} [options.flipBehavior='flip']
- * The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
- * overlap its reference element. Defining `flip` as value, the placement will be flipped on
- * its axis (`right - left`, `top - bottom`).
- * You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
- * how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
- * then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
- *
- * @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
- * List of functions used to modify the data before they are applied to the popper, add your custom functions
- * to this array to edit the offsets and placement.
- * The function should reflect the @params and @returns of preventOverflow
- *
- * @param {Array} [options.modifiersIgnored=[]]
- * Put here any built-in modifier name you want to exclude from the modifiers list
- * The function should reflect the @params and @returns of preventOverflow
- *
- * @param {Boolean} [options.removeOnDestroy=false]
- * Set to true if you want to automatically remove the popper when you call the `destroy` method.
- */
- function Popper(reference, popper, options) {
- this._reference = reference.jquery ? reference[0] : reference;
- this.state = {};
-
- // if the popper variable is a configuration object, parse it to generate an HTMLElement
- // generate a default popper if is not defined
- var isNotDefined = typeof popper === 'undefined' || popper === null;
- var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
- if (isNotDefined || isConfig) {
- this._popper = this.parse(isConfig ? popper : {});
- }
- // otherwise, use the given HTMLElement as popper
- else {
- this._popper = popper.jquery ? popper[0] : popper;
- }
-
- // with {} we create a new object with the options inside it
- this._options = Object.assign({}, DEFAULTS, options);
-
- // refactoring modifiers' list
- this._options.modifiers = this._options.modifiers.map(function (modifier) {
- // remove ignored modifiers
- if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
-
- // set the x-placement attribute before everything else because it could be used to add margins to the popper
- // margins needs to be calculated to get the correct popper offsets
- if (modifier === 'applyStyle') {
- this._popper.setAttribute('x-placement', this._options.placement);
- }
-
- // return predefined modifier identified by string or keep the custom one
- return this.modifiers[modifier] || modifier;
- }.bind(this));
-
- // make sure to apply the popper position before any computation
- this.state.position = this._getPosition(this._popper, this._reference);
- setStyle(this._popper, { position: this.state.position, top: 0 });
-
- // fire the first update to position the popper in the right place
- this.update();
-
- // setup event listeners, they will take care of update the position in specific situations
- this._setupEventListeners();
- return this;
- }
-
- //
- // Methods
- //
- /**
- * Destroy the popper
- * @method
- * @memberof Popper
- */
- Popper.prototype.destroy = function () {
- this._popper.removeAttribute('x-placement');
- this._popper.style.left = '';
- this._popper.style.position = '';
- this._popper.style.top = '';
- this._popper.style[getSupportedPropertyName('transform')] = '';
- this._removeEventListeners();
-
- // remove the popper if user explicity asked for the deletion on destroy
- if (this._options.removeOnDestroy) {
- this._popper.remove();
- }
- return this;
- };
-
- /**
- * Updates the position of the popper, computing the new offsets and applying the new style
- * @method
- * @memberof Popper
- */
- Popper.prototype.update = function () {
- var data = { instance: this, styles: {} };
-
- // store placement inside the data object, modifiers will be able to edit `placement` if needed
- // and refer to _originalPlacement to know the original value
- data.placement = this._options.placement;
- data._originalPlacement = this._options.placement;
-
- // compute the popper and reference offsets and put them inside data.offsets
- data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
-
- // get boundaries
- data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
-
- data = this.runModifiers(data, this._options.modifiers);
-
- if (typeof this.state.updateCallback === 'function') {
- this.state.updateCallback(data);
- }
- };
-
- /**
- * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
- * @method
- * @memberof Popper
- * @param {Function} callback
- */
- Popper.prototype.onCreate = function (callback) {
- // the createCallbacks return as first argument the popper instance
- callback(this);
- return this;
- };
-
- /**
- * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
- * used to style popper and its arrow.
- * NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
- * @method
- * @memberof Popper
- * @param {Function} callback
- */
- Popper.prototype.onUpdate = function (callback) {
- this.state.updateCallback = callback;
- return this;
- };
-
- /**
- * Helper used to generate poppers from a configuration file
- * @method
- * @memberof Popper
- * @param config {Object} configuration
- * @returns {HTMLElement} popper
- */
- Popper.prototype.parse = function (config) {
- var defaultConfig = {
- tagName: 'div',
- classNames: ['popper'],
- attributes: [],
- parent: root.document.body,
- content: '',
- contentType: 'text',
- arrowTagName: 'div',
- arrowClassNames: ['popper__arrow'],
- arrowAttributes: ['x-arrow']
- };
- config = Object.assign({}, defaultConfig, config);
-
- var d = root.document;
-
- var popper = d.createElement(config.tagName);
- addClassNames(popper, config.classNames);
- addAttributes(popper, config.attributes);
- if (config.contentType === 'node') {
- popper.appendChild(config.content.jquery ? config.content[0] : config.content);
- } else if (config.contentType === 'html') {
- popper.innerHTML = config.content;
- } else {
- popper.textContent = config.content;
- }
-
- if (config.arrowTagName) {
- var arrow = d.createElement(config.arrowTagName);
- addClassNames(arrow, config.arrowClassNames);
- addAttributes(arrow, config.arrowAttributes);
- popper.appendChild(arrow);
- }
-
- var parent = config.parent.jquery ? config.parent[0] : config.parent;
-
- // if the given parent is a string, use it to match an element
- // if more than one element is matched, the first one will be used as parent
- // if no elements are matched, the script will throw an error
- if (typeof parent === 'string') {
- parent = d.querySelectorAll(config.parent);
- if (parent.length > 1) {
- console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
- }
- if (parent.length === 0) {
- throw 'ERROR: the given `parent` doesn\'t exists!';
- }
- parent = parent[0];
- }
- // if the given parent is a DOM nodes list or an array of nodes with more than one element,
- // the first one will be used as parent
- if (parent.length > 1 && parent instanceof Element === false) {
- console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
- parent = parent[0];
- }
-
- // append the generated popper to its parent
- parent.appendChild(popper);
-
- return popper;
-
- /**
- * Adds class names to the given element
- * @function
- * @ignore
- * @param {HTMLElement} target
- * @param {Array} classes
- */
- function addClassNames(element, classNames) {
- classNames.forEach(function (className) {
- element.classList.add(className);
- });
- }
-
- /**
- * Adds attributes to the given element
- * @function
- * @ignore
- * @param {HTMLElement} target
- * @param {Array} attributes
- * @example
- * addAttributes(element, [ 'data-info:foobar' ]);
- */
- function addAttributes(element, attributes) {
- attributes.forEach(function (attribute) {
- element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
- });
- }
- };
-
- /**
- * Helper used to get the position which will be applied to the popper
- * @method
- * @memberof Popper
- * @param config {HTMLElement} popper element
- * @param reference {HTMLElement} reference element
- * @returns {String} position
- */
- Popper.prototype._getPosition = function (popper, reference) {
- var container = getOffsetParent(reference);
-
- if (this._options.forceAbsolute) {
- return 'absolute';
- }
-
- // Decide if the popper will be fixed
- // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
- var isParentFixed = isFixed(reference, container);
- return isParentFixed ? 'fixed' : 'absolute';
- };
-
- /**
- * Get offsets to the popper
- * @method
- * @memberof Popper
- * @access private
- * @param {Element} popper - the popper element
- * @param {Element} reference - the reference element (the popper will be relative to this)
- * @returns {Object} An object containing the offsets which will be applied to the popper
- */
- Popper.prototype._getOffsets = function (popper, reference, placement) {
- placement = placement.split('-')[0];
- var popperOffsets = {};
-
- popperOffsets.position = this.state.position;
- var isParentFixed = popperOffsets.position === 'fixed';
-
- //
- // Get reference element position
- //
- var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
-
- //
- // Get popper sizes
- //
- var popperRect = getOuterSizes(popper);
-
- //
- // Compute offsets of popper
- //
-
- // depending by the popper placement we have to compute its offsets slightly differently
- if (['right', 'left'].indexOf(placement) !== -1) {
- popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
- if (placement === 'left') {
- popperOffsets.left = referenceOffsets.left - popperRect.width;
- } else {
- popperOffsets.left = referenceOffsets.right;
- }
- } else {
- popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
- if (placement === 'top') {
- popperOffsets.top = referenceOffsets.top - popperRect.height;
- } else {
- popperOffsets.top = referenceOffsets.bottom;
- }
- }
-
- // Add width and height to our offsets object
- popperOffsets.width = popperRect.width;
- popperOffsets.height = popperRect.height;
-
- return {
- popper: popperOffsets,
- reference: referenceOffsets
- };
- };
-
- /**
- * Setup needed event listeners used to update the popper position
- * @method
- * @memberof Popper
- * @access private
- */
- Popper.prototype._setupEventListeners = function () {
- // NOTE: 1 DOM access here
- this.state.updateBound = this.update.bind(this);
- root.addEventListener('resize', this.state.updateBound);
- // if the boundariesElement is window we don't need to listen for the scroll event
- if (this._options.boundariesElement !== 'window') {
- var target = getScrollParent(this._reference);
- // here it could be both `body` or `documentElement` thanks to Firefox, we then check both
- if (target === root.document.body || target === root.document.documentElement) {
- target = root;
- }
- target.addEventListener('scroll', this.state.updateBound);
- this.state.scrollTarget = target;
- }
- };
-
- /**
- * Remove event listeners used to update the popper position
- * @method
- * @memberof Popper
- * @access private
- */
- Popper.prototype._removeEventListeners = function () {
- // NOTE: 1 DOM access here
- root.removeEventListener('resize', this.state.updateBound);
- if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
- this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
- this.state.scrollTarget = null;
- }
- this.state.updateBound = null;
- };
-
- /**
- * Computed the boundaries limits and return them
- * @method
- * @memberof Popper
- * @access private
- * @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
- * @param {Number} padding - Boundaries padding
- * @param {Element} boundariesElement - Element used to define the boundaries
- * @returns {Object} Coordinates of the boundaries
- */
- Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
- // NOTE: 1 DOM access here
- var boundaries = {};
- var width, height;
- if (boundariesElement === 'window') {
- var body = root.document.body,
- html = root.document.documentElement;
-
- height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
- width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
-
- boundaries = {
- top: 0,
- right: width,
- bottom: height,
- left: 0
- };
- } else if (boundariesElement === 'viewport') {
- var offsetParent = getOffsetParent(this._popper);
- var scrollParent = getScrollParent(this._popper);
- var offsetParentRect = getOffsetRect(offsetParent);
-
- // Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
- var getScrollTopValue = function getScrollTopValue(element) {
- return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
- };
- var getScrollLeftValue = function getScrollLeftValue(element) {
- return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
- };
-
- // if the popper is fixed we don't have to substract scrolling from the boundaries
- var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
- var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
-
- boundaries = {
- top: 0 - (offsetParentRect.top - scrollTop),
- right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
- bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
- left: 0 - (offsetParentRect.left - scrollLeft)
- };
- } else {
- if (getOffsetParent(this._popper) === boundariesElement) {
- boundaries = {
- top: 0,
- left: 0,
- right: boundariesElement.clientWidth,
- bottom: boundariesElement.clientHeight
- };
- } else {
- boundaries = getOffsetRect(boundariesElement);
- }
- }
- boundaries.left += padding;
- boundaries.right -= padding;
- boundaries.top = boundaries.top + padding;
- boundaries.bottom = boundaries.bottom - padding;
- return boundaries;
- };
-
- /**
- * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
- * @method
- * @memberof Popper
- * @access public
- * @param {Object} data
- * @param {Array} modifiers
- * @param {Function} ends
- */
- Popper.prototype.runModifiers = function (data, modifiers, ends) {
- var modifiersToRun = modifiers.slice();
- if (ends !== undefined) {
- modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
- }
-
- modifiersToRun.forEach(function (modifier) {
- if (isFunction(modifier)) {
- data = modifier.call(this, data);
- }
- }.bind(this));
-
- return data;
- };
-
- /**
- * Helper used to know if the given modifier depends from another one.
- * @method
- * @memberof Popper
- * @param {String} requesting - name of requesting modifier
- * @param {String} requested - name of requested modifier
- * @returns {Boolean}
- */
- Popper.prototype.isModifierRequired = function (requesting, requested) {
- var index = getArrayKeyIndex(this._options.modifiers, requesting);
- return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
- return modifier === requested;
- }).length;
- };
-
- //
- // Modifiers
- //
-
- /**
- * Modifiers list
- * @namespace Popper.modifiers
- * @memberof Popper
- * @type {Object}
- */
- Popper.prototype.modifiers = {};
-
- /**
- * Apply the computed styles to the popper element
- * @method
- * @memberof Popper.modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @returns {Object} The same data object
- */
- Popper.prototype.modifiers.applyStyle = function (data) {
- // apply the final offsets to the popper
- // NOTE: 1 DOM access here
- var styles = {
- position: data.offsets.popper.position
- };
-
- // round top and left to avoid blurry text
- var left = Math.round(data.offsets.popper.left);
- var top = Math.round(data.offsets.popper.top);
-
- // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
- // we automatically use the supported prefixed version if needed
- var prefixedProperty;
- if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
- styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
- styles.top = 0;
- styles.left = 0;
- }
- // othwerise, we use the standard `left` and `top` properties
- else {
- styles.left = left;
- styles.top = top;
- }
-
- // any property present in `data.styles` will be applied to the popper,
- // in this way we can make the 3rd party modifiers add custom styles to it
- // Be aware, modifiers could override the properties defined in the previous
- // lines of this modifier!
- Object.assign(styles, data.styles);
-
- setStyle(this._popper, styles);
-
- // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
- // NOTE: 1 DOM access here
- this._popper.setAttribute('x-placement', data.placement);
-
- // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
- if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
- setStyle(data.arrowElement, data.offsets.arrow);
- }
-
- return data;
- };
-
- /**
- * Modifier used to shift the popper on the start or end of its reference element side
- * @method
- * @memberof Popper.modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @returns {Object} The data object, properly modified
- */
- Popper.prototype.modifiers.shift = function (data) {
- var placement = data.placement;
- var basePlacement = placement.split('-')[0];
- var shiftVariation = placement.split('-')[1];
-
- // if shift shiftVariation is specified, run the modifier
- if (shiftVariation) {
- var reference = data.offsets.reference;
- var popper = getPopperClientRect(data.offsets.popper);
-
- var shiftOffsets = {
- y: {
- start: { top: reference.top },
- end: { top: reference.top + reference.height - popper.height }
- },
- x: {
- start: { left: reference.left },
- end: { left: reference.left + reference.width - popper.width }
- }
- };
-
- var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
-
- data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
- }
-
- return data;
- };
-
- /**
- * Modifier used to make sure the popper does not overflows from it's boundaries
- * @method
- * @memberof Popper.modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @returns {Object} The data object, properly modified
- */
- Popper.prototype.modifiers.preventOverflow = function (data) {
- var order = this._options.preventOverflowOrder;
- var popper = getPopperClientRect(data.offsets.popper);
-
- var check = {
- left: function left() {
- var left = popper.left;
- if (popper.left < data.boundaries.left) {
- left = Math.max(popper.left, data.boundaries.left);
- }
- return { left: left };
- },
- right: function right() {
- var left = popper.left;
- if (popper.right > data.boundaries.right) {
- left = Math.min(popper.left, data.boundaries.right - popper.width);
- }
- return { left: left };
- },
- top: function top() {
- var top = popper.top;
- if (popper.top < data.boundaries.top) {
- top = Math.max(popper.top, data.boundaries.top);
- }
- return { top: top };
- },
- bottom: function bottom() {
- var top = popper.top;
- if (popper.bottom > data.boundaries.bottom) {
- top = Math.min(popper.top, data.boundaries.bottom - popper.height);
- }
- return { top: top };
- }
- };
-
- order.forEach(function (direction) {
- data.offsets.popper = Object.assign(popper, check[direction]());
- });
-
- return data;
- };
-
- /**
- * Modifier used to make sure the popper is always near its reference
- * @method
- * @memberof Popper.modifiers
- * @argument {Object} data - The data object generated by _update method
- * @returns {Object} The data object, properly modified
- */
- Popper.prototype.modifiers.keepTogether = function (data) {
- var popper = getPopperClientRect(data.offsets.popper);
- var reference = data.offsets.reference;
- var f = Math.floor;
-
- if (popper.right < f(reference.left)) {
- data.offsets.popper.left = f(reference.left) - popper.width;
- }
- if (popper.left > f(reference.right)) {
- data.offsets.popper.left = f(reference.right);
- }
- if (popper.bottom < f(reference.top)) {
- data.offsets.popper.top = f(reference.top) - popper.height;
- }
- if (popper.top > f(reference.bottom)) {
- data.offsets.popper.top = f(reference.bottom);
- }
-
- return data;
- };
-
- /**
- * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
- * Requires the `preventOverflow` modifier before it in order to work.
- * **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
- * @method
- * @memberof Popper.modifiers
- * @argument {Object} data - The data object generated by _update method
- * @returns {Object} The data object, properly modified
- */
- Popper.prototype.modifiers.flip = function (data) {
- // check if preventOverflow is in the list of modifiers before the flip modifier.
- // otherwise flip would not work as expected.
- if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
- console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
- return data;
- }
-
- if (data.flipped && data.placement === data._originalPlacement) {
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
- return data;
- }
-
- var placement = data.placement.split('-')[0];
- var placementOpposite = getOppositePlacement(placement);
- var variation = data.placement.split('-')[1] || '';
-
- var flipOrder = [];
- if (this._options.flipBehavior === 'flip') {
- flipOrder = [placement, placementOpposite];
- } else {
- flipOrder = this._options.flipBehavior;
- }
-
- flipOrder.forEach(function (step, index) {
- if (placement !== step || flipOrder.length === index + 1) {
- return;
- }
-
- placement = data.placement.split('-')[0];
- placementOpposite = getOppositePlacement(placement);
-
- var popperOffsets = getPopperClientRect(data.offsets.popper);
-
- // this boolean is used to distinguish right and bottom from top and left
- // they need different computations to get flipped
- var a = ['right', 'bottom'].indexOf(placement) !== -1;
-
- // using Math.floor because the reference offsets may contain decimals we are not going to consider here
- if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
- // we'll use this boolean to detect any flip loop
- data.flipped = true;
- data.placement = flipOrder[index + 1];
- if (variation) {
- data.placement += '-' + variation;
- }
- data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
-
- data = this.runModifiers(data, this._options.modifiers, this._flip);
- }
- }.bind(this));
- return data;
- };
-
- /**
- * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
- * The offsets will shift the popper on the side of its reference element.
- * @method
- * @memberof Popper.modifiers
- * @argument {Object} data - The data object generated by _update method
- * @returns {Object} The data object, properly modified
- */
- Popper.prototype.modifiers.offset = function (data) {
- var offset = this._options.offset;
- var popper = data.offsets.popper;
-
- if (data.placement.indexOf('left') !== -1) {
- popper.top -= offset;
- } else if (data.placement.indexOf('right') !== -1) {
- popper.top += offset;
- } else if (data.placement.indexOf('top') !== -1) {
- popper.left -= offset;
- } else if (data.placement.indexOf('bottom') !== -1) {
- popper.left += offset;
- }
- return data;
- };
-
- /**
- * Modifier used to move the arrows on the edge of the popper to make sure them are always between the popper and the reference element
- * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
- * @method
- * @memberof Popper.modifiers
- * @argument {Object} data - The data object generated by _update method
- * @returns {Object} The data object, properly modified
- */
- Popper.prototype.modifiers.arrow = function (data) {
- var arrow = this._options.arrowElement;
- var arrowOffset = this._options.arrowOffset;
-
- // if the arrowElement is a string, suppose it's a CSS selector
- if (typeof arrow === 'string') {
- arrow = this._popper.querySelector(arrow);
- }
-
- // if arrow element is not found, don't run the modifier
- if (!arrow) {
- return data;
- }
-
- // the arrow element must be child of its popper
- if (!this._popper.contains(arrow)) {
- console.warn('WARNING: `arrowElement` must be child of its popper element!');
- return data;
- }
-
- // arrow depends on keepTogether in order to work
- if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
- console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
- return data;
- }
-
- var arrowStyle = {};
- var placement = data.placement.split('-')[0];
- var popper = getPopperClientRect(data.offsets.popper);
- var reference = data.offsets.reference;
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
-
- var len = isVertical ? 'height' : 'width';
- var side = isVertical ? 'top' : 'left';
- var translate = isVertical ? 'translateY' : 'translateX';
- var altSide = isVertical ? 'left' : 'top';
- var opSide = isVertical ? 'bottom' : 'right';
- var arrowSize = getOuterSizes(arrow)[len];
-
- //
- // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
- //
-
- // top/left side
- if (reference[opSide] - arrowSize < popper[side]) {
- data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
- }
- // bottom/right side
- if (reference[side] + arrowSize > popper[opSide]) {
- data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
- }
-
- // compute center of the popper
- var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
-
- var sideValue = center - popper[side];
-
- // prevent arrow from being placed not contiguously to its popper
- sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
- arrowStyle[side] = sideValue;
- arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
-
- data.offsets.arrow = arrowStyle;
- data.arrowElement = arrow;
-
- return data;
- };
-
- //
- // Helpers
- //
-
- /**
- * Get the outer sizes of the given element (offset size + margins)
- * @function
- * @ignore
- * @argument {Element} element
- * @returns {Object} object containing width and height properties
- */
- function getOuterSizes(element) {
- // NOTE: 1 DOM access here
- var _display = element.style.display,
- _visibility = element.style.visibility;
- element.style.display = 'block';element.style.visibility = 'hidden';
- var calcWidthToForceRepaint = element.offsetWidth;
-
- // original method
- var styles = root.getComputedStyle(element);
- var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
- var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
- var result = { width: element.offsetWidth + y, height: element.offsetHeight + x };
-
- // reset element styles
- element.style.display = _display;element.style.visibility = _visibility;
- return result;
- }
-
- /**
- * Get the opposite placement of the given one/
- * @function
- * @ignore
- * @argument {String} placement
- * @returns {String} flipped placement
- */
- function getOppositePlacement(placement) {
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
- return placement.replace(/left|right|bottom|top/g, function (matched) {
- return hash[matched];
- });
- }
-
- /**
- * Given the popper offsets, generate an output similar to getBoundingClientRect
- * @function
- * @ignore
- * @argument {Object} popperOffsets
- * @returns {Object} ClientRect like output
- */
- function getPopperClientRect(popperOffsets) {
- var offsets = Object.assign({}, popperOffsets);
- offsets.right = offsets.left + offsets.width;
- offsets.bottom = offsets.top + offsets.height;
- return offsets;
- }
-
- /**
- * Given an array and the key to find, returns its index
- * @function
- * @ignore
- * @argument {Array} arr
- * @argument keyToFind
- * @returns index or null
- */
- function getArrayKeyIndex(arr, keyToFind) {
- var i = 0,
- key;
- for (key in arr) {
- if (arr[key] === keyToFind) {
- return i;
- }
- i++;
- }
- return null;
- }
-
- /**
- * Get CSS computed property of the given element
- * @function
- * @ignore
- * @argument {Eement} element
- * @argument {String} property
- */
- function getStyleComputedProperty(element, property) {
- // NOTE: 1 DOM access here
- var css = root.getComputedStyle(element, null);
- return css[property];
- }
-
- /**
- * Returns the offset parent of the given element
- * @function
- * @ignore
- * @argument {Element} element
- * @returns {Element} offset parent
- */
- function getOffsetParent(element) {
- // NOTE: 1 DOM access here
- var offsetParent = element.offsetParent;
- return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
- }
-
- /**
- * Returns the scrolling parent of the given element
- * @function
- * @ignore
- * @argument {Element} element
- * @returns {Element} offset parent
- */
- function getScrollParent(element) {
- var parent = element.parentNode;
-
- if (!parent) {
- return element;
- }
-
- if (parent === root.document) {
- // Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
- // greater than 0 and return the proper element
- if (root.document.body.scrollTop || root.document.body.scrollLeft) {
- return root.document.body;
- } else {
- return root.document.documentElement;
- }
- }
-
- // Firefox want us to check `-x` and `-y` variations as well
- if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
- // If the detected scrollParent is body, we perform an additional check on its parentNode
- // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
- // fixes issue #65
- return parent;
- }
- return getScrollParent(element.parentNode);
- }
-
- /**
- * Check if the given element is fixed or is inside a fixed parent
- * @function
- * @ignore
- * @argument {Element} element
- * @argument {Element} customContainer
- * @returns {Boolean} answer to "isFixed?"
- */
- function isFixed(element) {
- if (element === root.document.body) {
- return false;
- }
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
- return true;
- }
- return element.parentNode ? isFixed(element.parentNode) : element;
- }
-
- /**
- * Set the style to the given popper
- * @function
- * @ignore
- * @argument {Element} element - Element to apply the style to
- * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
- */
- function setStyle(element, styles) {
- function is_numeric(n) {
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
- }
- Object.keys(styles).forEach(function (prop) {
- var unit = '';
- // add unit if the value is numeric and is one of the following
- if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
- unit = 'px';
- }
- element.style[prop] = styles[prop] + unit;
- });
- }
-
- /**
- * Check if the given variable is a function
- * @function
- * @ignore
- * @argument {*} functionToCheck - variable to check
- * @returns {Boolean} answer to: is a function?
- */
- function isFunction(functionToCheck) {
- var getType = {};
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
- }
-
- /**
- * Get the position of the given element, relative to its offset parent
- * @function
- * @ignore
- * @param {Element} element
- * @return {Object} position - Coordinates of the element and its `scrollTop`
- */
- function getOffsetRect(element) {
- var elementRect = {
- width: element.offsetWidth,
- height: element.offsetHeight,
- left: element.offsetLeft,
- top: element.offsetTop
- };
-
- elementRect.right = elementRect.left + elementRect.width;
- elementRect.bottom = elementRect.top + elementRect.height;
-
- // position
- return elementRect;
- }
-
- /**
- * Get bounding client rect of given element
- * @function
- * @ignore
- * @param {HTMLElement} element
- * @return {Object} client rect
- */
- function getBoundingClientRect(element) {
- var rect = element.getBoundingClientRect();
-
- // whether the IE version is lower than 11
- var isIE = navigator.userAgent.indexOf("MSIE") != -1;
-
- // fix ie document bounding top always 0 bug
- var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
-
- return {
- left: rect.left,
- top: rectTop,
- right: rect.right,
- bottom: rect.bottom,
- width: rect.right - rect.left,
- height: rect.bottom - rectTop
- };
- }
-
- /**
- * Given an element and one of its parents, return the offset
- * @function
- * @ignore
- * @param {HTMLElement} element
- * @param {HTMLElement} parent
- * @return {Object} rect
- */
- function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
- var elementRect = getBoundingClientRect(element);
- var parentRect = getBoundingClientRect(parent);
-
- if (fixed) {
- var scrollParent = getScrollParent(parent);
- parentRect.top += scrollParent.scrollTop;
- parentRect.bottom += scrollParent.scrollTop;
- parentRect.left += scrollParent.scrollLeft;
- parentRect.right += scrollParent.scrollLeft;
- }
-
- var rect = {
- top: elementRect.top - parentRect.top,
- left: elementRect.left - parentRect.left,
- bottom: elementRect.top - parentRect.top + elementRect.height,
- right: elementRect.left - parentRect.left + elementRect.width,
- width: elementRect.width,
- height: elementRect.height
- };
- return rect;
- }
-
- /**
- * Get the prefixed supported property name
- * @function
- * @ignore
- * @argument {String} property (camelCase)
- * @returns {String} prefixed property (camelCase)
- */
- function getSupportedPropertyName(property) {
- var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
-
- for (var i = 0; i < prefixes.length; i++) {
- var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
- if (typeof root.document.body.style[toCheck] !== 'undefined') {
- return toCheck;
- }
- }
- return null;
- }
-
- /**
- * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
- * objects to a target object. It will return the target object.
- * This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
- * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
- * @function
- * @ignore
- */
- if (!Object.assign) {
- Object.defineProperty(Object, 'assign', {
- enumerable: false,
- configurable: true,
- writable: true,
- value: function value(target) {
- if (target === undefined || target === null) {
- throw new TypeError('Cannot convert first argument to object');
- }
-
- var to = Object(target);
- for (var i = 1; i < arguments.length; i++) {
- var nextSource = arguments[i];
- if (nextSource === undefined || nextSource === null) {
- continue;
- }
- nextSource = Object(nextSource);
-
- var keysArray = Object.keys(nextSource);
- for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
- var nextKey = keysArray[nextIndex];
- var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
- if (desc !== undefined && desc.enumerable) {
- to[nextKey] = nextSource[nextKey];
- }
- }
- }
- return to;
- }
- });
- }
-
- return Popper;
-});
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/popup/index.js":
-/*!***********************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/popup/index.js ***!
- \***********************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.PopupManager = undefined;
-
-var _vue = __webpack_require__(/*! vue */ "../../node_modules/vue/dist/vue.common.js");
-
-var _vue2 = _interopRequireDefault(_vue);
-
-var _merge = __webpack_require__(/*! element-ui/lib/utils/merge */ "../../node_modules/element-ui/lib/utils/merge.js");
-
-var _merge2 = _interopRequireDefault(_merge);
-
-var _popupManager = __webpack_require__(/*! element-ui/lib/utils/popup/popup-manager */ "../../node_modules/element-ui/lib/utils/popup/popup-manager.js");
-
-var _popupManager2 = _interopRequireDefault(_popupManager);
-
-var _scrollbarWidth = __webpack_require__(/*! ../scrollbar-width */ "../../node_modules/element-ui/lib/utils/scrollbar-width.js");
-
-var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
-
-var _dom = __webpack_require__(/*! ../dom */ "../../node_modules/element-ui/lib/utils/dom.js");
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var idSeed = 1;
-
-var scrollBarWidth = void 0;
-
-exports.default = {
- props: {
- visible: {
- type: Boolean,
- default: false
- },
- openDelay: {},
- closeDelay: {},
- zIndex: {},
- modal: {
- type: Boolean,
- default: false
- },
- modalFade: {
- type: Boolean,
- default: true
- },
- modalClass: {},
- modalAppendToBody: {
- type: Boolean,
- default: false
- },
- lockScroll: {
- type: Boolean,
- default: true
- },
- closeOnPressEscape: {
- type: Boolean,
- default: false
- },
- closeOnClickModal: {
- type: Boolean,
- default: false
- }
- },
-
- beforeMount: function beforeMount() {
- this._popupId = 'popup-' + idSeed++;
- _popupManager2.default.register(this._popupId, this);
- },
- beforeDestroy: function beforeDestroy() {
- _popupManager2.default.deregister(this._popupId);
- _popupManager2.default.closeModal(this._popupId);
-
- this.restoreBodyStyle();
- },
- data: function data() {
- return {
- opened: false,
- bodyPaddingRight: null,
- computedBodyPaddingRight: 0,
- withoutHiddenClass: true,
- rendered: false
- };
- },
-
-
- watch: {
- visible: function visible(val) {
- var _this = this;
-
- if (val) {
- if (this._opening) return;
- if (!this.rendered) {
- this.rendered = true;
- _vue2.default.nextTick(function () {
- _this.open();
- });
- } else {
- this.open();
- }
- } else {
- this.close();
- }
- }
- },
-
- methods: {
- open: function open(options) {
- var _this2 = this;
-
- if (!this.rendered) {
- this.rendered = true;
- }
-
- var props = (0, _merge2.default)({}, this.$props || this, options);
-
- if (this._closeTimer) {
- clearTimeout(this._closeTimer);
- this._closeTimer = null;
- }
- clearTimeout(this._openTimer);
-
- var openDelay = Number(props.openDelay);
- if (openDelay > 0) {
- this._openTimer = setTimeout(function () {
- _this2._openTimer = null;
- _this2.doOpen(props);
- }, openDelay);
- } else {
- this.doOpen(props);
- }
- },
- doOpen: function doOpen(props) {
- if (this.$isServer) return;
- if (this.willOpen && !this.willOpen()) return;
- if (this.opened) return;
-
- this._opening = true;
-
- var dom = this.$el;
-
- var modal = props.modal;
-
- var zIndex = props.zIndex;
- if (zIndex) {
- _popupManager2.default.zIndex = zIndex;
- }
-
- if (modal) {
- if (this._closing) {
- _popupManager2.default.closeModal(this._popupId);
- this._closing = false;
- }
- _popupManager2.default.openModal(this._popupId, _popupManager2.default.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
- if (props.lockScroll) {
- this.withoutHiddenClass = !(0, _dom.hasClass)(document.body, 'el-popup-parent--hidden');
- if (this.withoutHiddenClass) {
- this.bodyPaddingRight = document.body.style.paddingRight;
- this.computedBodyPaddingRight = parseInt((0, _dom.getStyle)(document.body, 'paddingRight'), 10);
- }
- scrollBarWidth = (0, _scrollbarWidth2.default)();
- var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
- var bodyOverflowY = (0, _dom.getStyle)(document.body, 'overflowY');
- if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
- document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px';
- }
- (0, _dom.addClass)(document.body, 'el-popup-parent--hidden');
- }
- }
-
- if (getComputedStyle(dom).position === 'static') {
- dom.style.position = 'absolute';
- }
-
- dom.style.zIndex = _popupManager2.default.nextZIndex();
- this.opened = true;
-
- this.onOpen && this.onOpen();
-
- this.doAfterOpen();
- },
- doAfterOpen: function doAfterOpen() {
- this._opening = false;
- },
- close: function close() {
- var _this3 = this;
-
- if (this.willClose && !this.willClose()) return;
-
- if (this._openTimer !== null) {
- clearTimeout(this._openTimer);
- this._openTimer = null;
- }
- clearTimeout(this._closeTimer);
-
- var closeDelay = Number(this.closeDelay);
-
- if (closeDelay > 0) {
- this._closeTimer = setTimeout(function () {
- _this3._closeTimer = null;
- _this3.doClose();
- }, closeDelay);
- } else {
- this.doClose();
- }
- },
- doClose: function doClose() {
- this._closing = true;
-
- this.onClose && this.onClose();
-
- if (this.lockScroll) {
- setTimeout(this.restoreBodyStyle, 200);
- }
-
- this.opened = false;
-
- this.doAfterClose();
- },
- doAfterClose: function doAfterClose() {
- _popupManager2.default.closeModal(this._popupId);
- this._closing = false;
- },
- restoreBodyStyle: function restoreBodyStyle() {
- if (this.modal && this.withoutHiddenClass) {
- document.body.style.paddingRight = this.bodyPaddingRight;
- (0, _dom.removeClass)(document.body, 'el-popup-parent--hidden');
- }
- this.withoutHiddenClass = true;
- }
- }
-};
-exports.PopupManager = _popupManager2.default;
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/popup/popup-manager.js":
-/*!*******************************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/popup/popup-manager.js ***!
- \*******************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-
-var _vue = __webpack_require__(/*! vue */ "../../node_modules/vue/dist/vue.common.js");
-
-var _vue2 = _interopRequireDefault(_vue);
-
-var _dom = __webpack_require__(/*! element-ui/lib/utils/dom */ "../../node_modules/element-ui/lib/utils/dom.js");
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var hasModal = false;
-var hasInitZIndex = false;
-var zIndex = void 0;
-
-var getModal = function getModal() {
- if (_vue2.default.prototype.$isServer) return;
- var modalDom = PopupManager.modalDom;
- if (modalDom) {
- hasModal = true;
- } else {
- hasModal = false;
- modalDom = document.createElement('div');
- PopupManager.modalDom = modalDom;
-
- modalDom.addEventListener('touchmove', function (event) {
- event.preventDefault();
- event.stopPropagation();
- });
-
- modalDom.addEventListener('click', function () {
- PopupManager.doOnModalClick && PopupManager.doOnModalClick();
- });
- }
-
- return modalDom;
-};
-
-var instances = {};
-
-var PopupManager = {
- modalFade: true,
-
- getInstance: function getInstance(id) {
- return instances[id];
- },
-
- register: function register(id, instance) {
- if (id && instance) {
- instances[id] = instance;
- }
- },
-
- deregister: function deregister(id) {
- if (id) {
- instances[id] = null;
- delete instances[id];
- }
- },
-
- nextZIndex: function nextZIndex() {
- return PopupManager.zIndex++;
- },
-
- modalStack: [],
-
- doOnModalClick: function doOnModalClick() {
- var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
- if (!topItem) return;
-
- var instance = PopupManager.getInstance(topItem.id);
- if (instance && instance.closeOnClickModal) {
- instance.close();
- }
- },
-
- openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
- if (_vue2.default.prototype.$isServer) return;
- if (!id || zIndex === undefined) return;
- this.modalFade = modalFade;
-
- var modalStack = this.modalStack;
-
- for (var i = 0, j = modalStack.length; i < j; i++) {
- var item = modalStack[i];
- if (item.id === id) {
- return;
- }
- }
-
- var modalDom = getModal();
-
- (0, _dom.addClass)(modalDom, 'v-modal');
- if (this.modalFade && !hasModal) {
- (0, _dom.addClass)(modalDom, 'v-modal-enter');
- }
- if (modalClass) {
- var classArr = modalClass.trim().split(/\s+/);
- classArr.forEach(function (item) {
- return (0, _dom.addClass)(modalDom, item);
- });
- }
- setTimeout(function () {
- (0, _dom.removeClass)(modalDom, 'v-modal-enter');
- }, 200);
-
- if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
- dom.parentNode.appendChild(modalDom);
- } else {
- document.body.appendChild(modalDom);
- }
-
- if (zIndex) {
- modalDom.style.zIndex = zIndex;
- }
- modalDom.tabIndex = 0;
- modalDom.style.display = '';
-
- this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
- },
-
- closeModal: function closeModal(id) {
- var modalStack = this.modalStack;
- var modalDom = getModal();
-
- if (modalStack.length > 0) {
- var topItem = modalStack[modalStack.length - 1];
- if (topItem.id === id) {
- if (topItem.modalClass) {
- var classArr = topItem.modalClass.trim().split(/\s+/);
- classArr.forEach(function (item) {
- return (0, _dom.removeClass)(modalDom, item);
- });
- }
-
- modalStack.pop();
- if (modalStack.length > 0) {
- modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
- }
- } else {
- for (var i = modalStack.length - 1; i >= 0; i--) {
- if (modalStack[i].id === id) {
- modalStack.splice(i, 1);
- break;
- }
- }
- }
- }
-
- if (modalStack.length === 0) {
- if (this.modalFade) {
- (0, _dom.addClass)(modalDom, 'v-modal-leave');
- }
- setTimeout(function () {
- if (modalStack.length === 0) {
- if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
- modalDom.style.display = 'none';
- PopupManager.modalDom = undefined;
- }
- (0, _dom.removeClass)(modalDom, 'v-modal-leave');
- }, 200);
- }
- }
-};
-
-Object.defineProperty(PopupManager, 'zIndex', {
- configurable: true,
- get: function get() {
- if (!hasInitZIndex) {
- zIndex = zIndex || (_vue2.default.prototype.$ELEMENT || {}).zIndex || 2000;
- hasInitZIndex = true;
- }
- return zIndex;
- },
- set: function set(value) {
- zIndex = value;
- }
-});
-
-var getTopPopup = function getTopPopup() {
- if (_vue2.default.prototype.$isServer) return;
- if (PopupManager.modalStack.length > 0) {
- var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
- if (!topPopup) return;
- var instance = PopupManager.getInstance(topPopup.id);
-
- return instance;
- }
-};
-
-if (!_vue2.default.prototype.$isServer) {
- // handle `esc` key when the popup is shown
- window.addEventListener('keydown', function (event) {
- if (event.keyCode === 27) {
- var topPopup = getTopPopup();
-
- if (topPopup && topPopup.closeOnPressEscape) {
- topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
- }
- }
- });
-}
-
-exports.default = PopupManager;
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/resize-event.js":
-/*!************************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/resize-event.js ***!
- \************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.removeResizeListener = exports.addResizeListener = undefined;
-
-var _resizeObserverPolyfill = __webpack_require__(/*! resize-observer-polyfill */ "../../node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js");
-
-var _resizeObserverPolyfill2 = _interopRequireDefault(_resizeObserverPolyfill);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var isServer = typeof window === 'undefined';
-
-/* istanbul ignore next */
-var resizeHandler = function resizeHandler(entries) {
- for (var _iterator = entries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
- var _ref;
-
- if (_isArray) {
- if (_i >= _iterator.length) break;
- _ref = _iterator[_i++];
- } else {
- _i = _iterator.next();
- if (_i.done) break;
- _ref = _i.value;
- }
-
- var entry = _ref;
-
- var listeners = entry.target.__resizeListeners__ || [];
- if (listeners.length) {
- listeners.forEach(function (fn) {
- fn();
- });
- }
- }
-};
-
-/* istanbul ignore next */
-var addResizeListener = exports.addResizeListener = function addResizeListener(element, fn) {
- if (isServer) return;
- if (!element.__resizeListeners__) {
- element.__resizeListeners__ = [];
- element.__ro__ = new _resizeObserverPolyfill2.default(resizeHandler);
- element.__ro__.observe(element);
- }
- element.__resizeListeners__.push(fn);
-};
-
-/* istanbul ignore next */
-var removeResizeListener = exports.removeResizeListener = function removeResizeListener(element, fn) {
- if (!element || !element.__resizeListeners__) return;
- element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
- if (!element.__resizeListeners__.length) {
- element.__ro__.disconnect();
- }
-};
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/scroll-into-view.js":
-/*!****************************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/scroll-into-view.js ***!
- \****************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.default = scrollIntoView;
-
-var _vue = __webpack_require__(/*! vue */ "../../node_modules/vue/dist/vue.common.js");
-
-var _vue2 = _interopRequireDefault(_vue);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function scrollIntoView(container, selected) {
- if (_vue2.default.prototype.$isServer) return;
-
- if (!selected) {
- container.scrollTop = 0;
- return;
- }
-
- var offsetParents = [];
- var pointer = selected.offsetParent;
- while (pointer && container !== pointer && container.contains(pointer)) {
- offsetParents.push(pointer);
- pointer = pointer.offsetParent;
- }
- var top = selected.offsetTop + offsetParents.reduce(function (prev, curr) {
- return prev + curr.offsetTop;
- }, 0);
- var bottom = top + selected.offsetHeight;
- var viewRectTop = container.scrollTop;
- var viewRectBottom = viewRectTop + container.clientHeight;
-
- if (top < viewRectTop) {
- container.scrollTop = top;
- } else if (bottom > viewRectBottom) {
- container.scrollTop = bottom - container.clientHeight;
- }
-}
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/scrollbar-width.js":
-/*!***************************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/scrollbar-width.js ***!
- \***************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-
-exports.default = function () {
- if (_vue2.default.prototype.$isServer) return 0;
- if (scrollBarWidth !== undefined) return scrollBarWidth;
-
- var outer = document.createElement('div');
- outer.className = 'el-scrollbar__wrap';
- outer.style.visibility = 'hidden';
- outer.style.width = '100px';
- outer.style.position = 'absolute';
- outer.style.top = '-9999px';
- document.body.appendChild(outer);
-
- var widthNoScroll = outer.offsetWidth;
- outer.style.overflow = 'scroll';
-
- var inner = document.createElement('div');
- inner.style.width = '100%';
- outer.appendChild(inner);
-
- var widthWithScroll = inner.offsetWidth;
- outer.parentNode.removeChild(outer);
- scrollBarWidth = widthNoScroll - widthWithScroll;
-
- return scrollBarWidth;
-};
-
-var _vue = __webpack_require__(/*! vue */ "../../node_modules/vue/dist/vue.common.js");
-
-var _vue2 = _interopRequireDefault(_vue);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var scrollBarWidth = void 0;
-
-;
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/shared.js":
-/*!******************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/shared.js ***!
- \******************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.isDef = isDef;
-exports.isKorean = isKorean;
-function isDef(val) {
- return val !== undefined && val !== null;
-}
-function isKorean(text) {
- var reg = /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi;
- return reg.test(text);
-}
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/types.js":
-/*!*****************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/types.js ***!
- \*****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.isString = isString;
-exports.isObject = isObject;
-exports.isHtmlElement = isHtmlElement;
-function isString(obj) {
- return Object.prototype.toString.call(obj) === '[object String]';
-}
-
-function isObject(obj) {
- return Object.prototype.toString.call(obj) === '[object Object]';
-}
-
-function isHtmlElement(node) {
- return node && node.nodeType === Node.ELEMENT_NODE;
-}
-
-var isFunction = exports.isFunction = function isFunction(functionToCheck) {
- var getType = {};
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
-};
-
-var isUndefined = exports.isUndefined = function isUndefined(val) {
- return val === void 0;
-};
-
-var isDefined = exports.isDefined = function isDefined(val) {
- return val !== undefined && val !== null;
-};
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/util.js":
-/*!****************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/util.js ***!
- \****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.isEmpty = exports.isEqual = exports.arrayEquals = exports.looseEqual = exports.capitalize = exports.kebabCase = exports.autoprefixer = exports.isFirefox = exports.isEdge = exports.isIE = exports.coerceTruthyValueToArray = exports.arrayFind = exports.arrayFindIndex = exports.escapeRegexpString = exports.valueEquals = exports.generateId = exports.getValueByPath = undefined;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-exports.noop = noop;
-exports.hasOwn = hasOwn;
-exports.toObject = toObject;
-exports.getPropByPath = getPropByPath;
-exports.rafThrottle = rafThrottle;
-exports.objToArray = objToArray;
-
-var _vue = __webpack_require__(/*! vue */ "../../node_modules/vue/dist/vue.common.js");
-
-var _vue2 = _interopRequireDefault(_vue);
-
-var _types = __webpack_require__(/*! element-ui/lib/utils/types */ "../../node_modules/element-ui/lib/utils/types.js");
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-function noop() {};
-
-function hasOwn(obj, key) {
- return hasOwnProperty.call(obj, key);
-};
-
-function extend(to, _from) {
- for (var key in _from) {
- to[key] = _from[key];
- }
- return to;
-};
-
-function toObject(arr) {
- var res = {};
- for (var i = 0; i < arr.length; i++) {
- if (arr[i]) {
- extend(res, arr[i]);
- }
- }
- return res;
-};
-
-var getValueByPath = exports.getValueByPath = function getValueByPath(object, prop) {
- prop = prop || '';
- var paths = prop.split('.');
- var current = object;
- var result = null;
- for (var i = 0, j = paths.length; i < j; i++) {
- var path = paths[i];
- if (!current) break;
-
- if (i === j - 1) {
- result = current[path];
- break;
- }
- current = current[path];
- }
- return result;
-};
-
-function getPropByPath(obj, path, strict) {
- var tempObj = obj;
- path = path.replace(/\[(\w+)\]/g, '.$1');
- path = path.replace(/^\./, '');
-
- var keyArr = path.split('.');
- var i = 0;
- for (var len = keyArr.length; i < len - 1; ++i) {
- if (!tempObj && !strict) break;
- var key = keyArr[i];
- if (key in tempObj) {
- tempObj = tempObj[key];
- } else {
- if (strict) {
- throw new Error('please transfer a valid prop path to form item!');
- }
- break;
- }
- }
- return {
- o: tempObj,
- k: keyArr[i],
- v: tempObj ? tempObj[keyArr[i]] : null
- };
-};
-
-var generateId = exports.generateId = function generateId() {
- return Math.floor(Math.random() * 10000);
-};
-
-var valueEquals = exports.valueEquals = function valueEquals(a, b) {
- // see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript
- if (a === b) return true;
- if (!(a instanceof Array)) return false;
- if (!(b instanceof Array)) return false;
- if (a.length !== b.length) return false;
- for (var i = 0; i !== a.length; ++i) {
- if (a[i] !== b[i]) return false;
- }
- return true;
-};
-
-var escapeRegexpString = exports.escapeRegexpString = function escapeRegexpString() {
- var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
- return String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
-};
-
-// TODO: use native Array.find, Array.findIndex when IE support is dropped
-var arrayFindIndex = exports.arrayFindIndex = function arrayFindIndex(arr, pred) {
- for (var i = 0; i !== arr.length; ++i) {
- if (pred(arr[i])) {
- return i;
- }
- }
- return -1;
-};
-
-var arrayFind = exports.arrayFind = function arrayFind(arr, pred) {
- var idx = arrayFindIndex(arr, pred);
- return idx !== -1 ? arr[idx] : undefined;
-};
-
-// coerce truthy value to array
-var coerceTruthyValueToArray = exports.coerceTruthyValueToArray = function coerceTruthyValueToArray(val) {
- if (Array.isArray(val)) {
- return val;
- } else if (val) {
- return [val];
- } else {
- return [];
- }
-};
-
-var isIE = exports.isIE = function isIE() {
- return !_vue2.default.prototype.$isServer && !isNaN(Number(document.documentMode));
-};
-
-var isEdge = exports.isEdge = function isEdge() {
- return !_vue2.default.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
-};
-
-var isFirefox = exports.isFirefox = function isFirefox() {
- return !_vue2.default.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
-};
-
-var autoprefixer = exports.autoprefixer = function autoprefixer(style) {
- if ((typeof style === 'undefined' ? 'undefined' : _typeof(style)) !== 'object') return style;
- var rules = ['transform', 'transition', 'animation'];
- var prefixes = ['ms-', 'webkit-'];
- rules.forEach(function (rule) {
- var value = style[rule];
- if (rule && value) {
- prefixes.forEach(function (prefix) {
- style[prefix + rule] = value;
- });
- }
- });
- return style;
-};
-
-var kebabCase = exports.kebabCase = function kebabCase(str) {
- var hyphenateRE = /([^-])([A-Z])/g;
- return str.replace(hyphenateRE, '$1-$2').replace(hyphenateRE, '$1-$2').toLowerCase();
-};
-
-var capitalize = exports.capitalize = function capitalize(str) {
- if (!(0, _types.isString)(str)) return str;
- return str.charAt(0).toUpperCase() + str.slice(1);
-};
-
-var looseEqual = exports.looseEqual = function looseEqual(a, b) {
- var isObjectA = (0, _types.isObject)(a);
- var isObjectB = (0, _types.isObject)(b);
- if (isObjectA && isObjectB) {
- return JSON.stringify(a) === JSON.stringify(b);
- } else if (!isObjectA && !isObjectB) {
- return String(a) === String(b);
- } else {
- return false;
- }
-};
-
-var arrayEquals = exports.arrayEquals = function arrayEquals(arrayA, arrayB) {
- arrayA = arrayA || [];
- arrayB = arrayB || [];
-
- if (arrayA.length !== arrayB.length) {
- return false;
- }
-
- for (var i = 0; i < arrayA.length; i++) {
- if (!looseEqual(arrayA[i], arrayB[i])) {
- return false;
- }
- }
-
- return true;
-};
-
-var isEqual = exports.isEqual = function isEqual(value1, value2) {
- if (Array.isArray(value1) && Array.isArray(value2)) {
- return arrayEquals(value1, value2);
- }
- return looseEqual(value1, value2);
-};
-
-var isEmpty = exports.isEmpty = function isEmpty(val) {
- // null or undefined
- if (val == null) return true;
-
- if (typeof val === 'boolean') return false;
-
- if (typeof val === 'number') return !val;
-
- if (val instanceof Error) return val.message === '';
-
- switch (Object.prototype.toString.call(val)) {
- // String or Array
- case '[object String]':
- case '[object Array]':
- return !val.length;
-
- // Map or Set or File
- case '[object File]':
- case '[object Map]':
- case '[object Set]':
- {
- return !val.size;
- }
- // Plain Object
- case '[object Object]':
- {
- return !Object.keys(val).length;
- }
- }
-
- return false;
-};
-
-function rafThrottle(fn) {
- var locked = false;
- return function () {
- var _this = this;
-
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- if (locked) return;
- locked = true;
- window.requestAnimationFrame(function (_) {
- fn.apply(_this, args);
- locked = false;
- });
- };
-}
-
-function objToArray(obj) {
- if (Array.isArray(obj)) {
- return obj;
- }
- return isEmpty(obj) ? [] : [obj];
-}
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/vdom.js":
-/*!****************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/vdom.js ***!
- \****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-exports.isVNode = isVNode;
-
-var _util = __webpack_require__(/*! element-ui/lib/utils/util */ "../../node_modules/element-ui/lib/utils/util.js");
-
-function isVNode(node) {
- return node !== null && (typeof node === 'undefined' ? 'undefined' : _typeof(node)) === 'object' && (0, _util.hasOwn)(node, 'componentOptions');
-};
-
-/***/ }),
-
-/***/ "../../node_modules/element-ui/lib/utils/vue-popper.js":
-/*!**********************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/element-ui/lib/utils/vue-popper.js ***!
- \**********************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-
-var _vue = __webpack_require__(/*! vue */ "../../node_modules/vue/dist/vue.common.js");
-
-var _vue2 = _interopRequireDefault(_vue);
-
-var _popup = __webpack_require__(/*! element-ui/lib/utils/popup */ "../../node_modules/element-ui/lib/utils/popup/index.js");
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var PopperJS = _vue2.default.prototype.$isServer ? function () {} : __webpack_require__(/*! ./popper */ "../../node_modules/element-ui/lib/utils/popper.js");
-var stop = function stop(e) {
- return e.stopPropagation();
-};
-
-/**
- * @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
- * @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
- * @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
- * @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
- * @param {Boolean} [visible=false] Visibility of the popup element.
- * @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
- */
-exports.default = {
- props: {
- transformOrigin: {
- type: [Boolean, String],
- default: true
- },
- placement: {
- type: String,
- default: 'bottom'
- },
- boundariesPadding: {
- type: Number,
- default: 5
- },
- reference: {},
- popper: {},
- offset: {
- default: 0
- },
- value: Boolean,
- visibleArrow: Boolean,
- arrowOffset: {
- type: Number,
- default: 35
- },
- appendToBody: {
- type: Boolean,
- default: true
- },
- popperOptions: {
- type: Object,
- default: function _default() {
- return {
- gpuAcceleration: false
- };
- }
- }
- },
-
- data: function data() {
- return {
- showPopper: false,
- currentPlacement: ''
- };
- },
-
-
- watch: {
- value: {
- immediate: true,
- handler: function handler(val) {
- this.showPopper = val;
- this.$emit('input', val);
- }
- },
-
- showPopper: function showPopper(val) {
- if (this.disabled) return;
- val ? this.updatePopper() : this.destroyPopper();
- this.$emit('input', val);
- }
- },
-
- methods: {
- createPopper: function createPopper() {
- var _this = this;
-
- if (this.$isServer) return;
- this.currentPlacement = this.currentPlacement || this.placement;
- if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
- return;
- }
-
- var options = this.popperOptions;
- var popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
- var reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
-
- if (!reference && this.$slots.reference && this.$slots.reference[0]) {
- reference = this.referenceElm = this.$slots.reference[0].elm;
- }
-
- if (!popper || !reference) return;
- if (this.visibleArrow) this.appendArrow(popper);
- if (this.appendToBody) document.body.appendChild(this.popperElm);
- if (this.popperJS && this.popperJS.destroy) {
- this.popperJS.destroy();
- }
-
- options.placement = this.currentPlacement;
- options.offset = this.offset;
- options.arrowOffset = this.arrowOffset;
- this.popperJS = new PopperJS(reference, popper, options);
- this.popperJS.onCreate(function (_) {
- _this.$emit('created', _this);
- _this.resetTransformOrigin();
- _this.$nextTick(_this.updatePopper);
- });
- if (typeof options.onUpdate === 'function') {
- this.popperJS.onUpdate(options.onUpdate);
- }
- this.popperJS._popper.style.zIndex = _popup.PopupManager.nextZIndex();
- this.popperElm.addEventListener('click', stop);
- },
- updatePopper: function updatePopper() {
- var popperJS = this.popperJS;
- if (popperJS) {
- popperJS.update();
- if (popperJS._popper) {
- popperJS._popper.style.zIndex = _popup.PopupManager.nextZIndex();
- }
- } else {
- this.createPopper();
- }
- },
- doDestroy: function doDestroy(forceDestroy) {
- /* istanbul ignore if */
- if (!this.popperJS || this.showPopper && !forceDestroy) return;
- this.popperJS.destroy();
- this.popperJS = null;
- },
- destroyPopper: function destroyPopper() {
- if (this.popperJS) {
- this.resetTransformOrigin();
- }
- },
- resetTransformOrigin: function resetTransformOrigin() {
- if (!this.transformOrigin) return;
- var placementMap = {
- top: 'bottom',
- bottom: 'top',
- left: 'right',
- right: 'left'
- };
- var placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
- var origin = placementMap[placement];
- this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === 'string' ? this.transformOrigin : ['top', 'bottom'].indexOf(placement) > -1 ? 'center ' + origin : origin + ' center';
- },
- appendArrow: function appendArrow(element) {
- var hash = void 0;
- if (this.appended) {
- return;
- }
-
- this.appended = true;
-
- for (var item in element.attributes) {
- if (/^_v-/.test(element.attributes[item].name)) {
- hash = element.attributes[item].name;
- break;
- }
- }
-
- var arrow = document.createElement('div');
-
- if (hash) {
- arrow.setAttribute(hash, '');
- }
- arrow.setAttribute('x-arrow', '');
- arrow.className = 'popper__arrow';
- element.appendChild(arrow);
- }
- },
-
- beforeDestroy: function beforeDestroy() {
- this.doDestroy(true);
- if (this.popperElm && this.popperElm.parentNode === document.body) {
- this.popperElm.removeEventListener('click', stop);
- document.body.removeChild(this.popperElm);
- }
- },
-
-
- // call destroy in keep-alive mode
- deactivated: function deactivated() {
- this.$options.beforeDestroy[0].call(this);
- }
-};
-
-/***/ }),
-
-/***/ "../../node_modules/es6-promise/auto.js":
-/*!*******************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/es6-promise/auto.js ***!
- \*******************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-// This file can be required in Browserify and Node.js for automatic polyfill
-// To use it: require('es6-promise/auto');
-
-module.exports = __webpack_require__(/*! ./ */ "../../node_modules/es6-promise/dist/es6-promise.js").polyfill();
-
-
-/***/ }),
-
-/***/ "../../node_modules/es6-promise/dist/es6-promise.js":
-/*!*******************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/es6-promise/dist/es6-promise.js ***!
- \*******************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-/* WEBPACK VAR INJECTION */(function(process, global) {/*!
- * @overview es6-promise - a tiny implementation of Promises/A+.
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
- * @license Licensed under MIT license
- * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
- * @version v4.2.8+1e68dce6
- */
-
-(function (global, factory) {
- true ? module.exports = factory() :
- undefined;
-}(this, (function () { 'use strict';
-
-function objectOrFunction(x) {
- var type = typeof x;
- return x !== null && (type === 'object' || type === 'function');
-}
-
-function isFunction(x) {
- return typeof x === 'function';
-}
-
-
-
-var _isArray = void 0;
-if (Array.isArray) {
- _isArray = Array.isArray;
-} else {
- _isArray = function (x) {
- return Object.prototype.toString.call(x) === '[object Array]';
- };
-}
-
-var isArray = _isArray;
-
-var len = 0;
-var vertxNext = void 0;
-var customSchedulerFn = void 0;
-
-var asap = function asap(callback, arg) {
- queue[len] = callback;
- queue[len + 1] = arg;
- len += 2;
- if (len === 2) {
- // If len is 2, that means that we need to schedule an async flush.
- // If additional callbacks are queued before the queue is flushed, they
- // will be processed by this flush that we are scheduling.
- if (customSchedulerFn) {
- customSchedulerFn(flush);
- } else {
- scheduleFlush();
- }
- }
-};
-
-function setScheduler(scheduleFn) {
- customSchedulerFn = scheduleFn;
-}
-
-function setAsap(asapFn) {
- asap = asapFn;
-}
-
-var browserWindow = typeof window !== 'undefined' ? window : undefined;
-var browserGlobal = browserWindow || {};
-var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
-var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
-
-// test for web worker but not in IE10
-var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
-
-// node
-function useNextTick() {
- // node version 0.10.x displays a deprecation warning when nextTick is used recursively
- // see https://github.com/cujojs/when/issues/410 for details
- return function () {
- return process.nextTick(flush);
- };
-}
-
-// vertx
-function useVertxTimer() {
- if (typeof vertxNext !== 'undefined') {
- return function () {
- vertxNext(flush);
- };
- }
-
- return useSetTimeout();
-}
-
-function useMutationObserver() {
- var iterations = 0;
- var observer = new BrowserMutationObserver(flush);
- var node = document.createTextNode('');
- observer.observe(node, { characterData: true });
-
- return function () {
- node.data = iterations = ++iterations % 2;
- };
-}
-
-// web worker
-function useMessageChannel() {
- var channel = new MessageChannel();
- channel.port1.onmessage = flush;
- return function () {
- return channel.port2.postMessage(0);
- };
-}
-
-function useSetTimeout() {
- // Store setTimeout reference so es6-promise will be unaffected by
- // other code modifying setTimeout (like sinon.useFakeTimers())
- var globalSetTimeout = setTimeout;
- return function () {
- return globalSetTimeout(flush, 1);
- };
-}
-
-var queue = new Array(1000);
-function flush() {
- for (var i = 0; i < len; i += 2) {
- var callback = queue[i];
- var arg = queue[i + 1];
-
- callback(arg);
-
- queue[i] = undefined;
- queue[i + 1] = undefined;
- }
-
- len = 0;
-}
-
-function attemptVertx() {
- try {
- var vertx = Function('return this')().require('vertx');
- vertxNext = vertx.runOnLoop || vertx.runOnContext;
- return useVertxTimer();
- } catch (e) {
- return useSetTimeout();
- }
-}
-
-var scheduleFlush = void 0;
-// Decide what async method to use to triggering processing of queued callbacks:
-if (isNode) {
- scheduleFlush = useNextTick();
-} else if (BrowserMutationObserver) {
- scheduleFlush = useMutationObserver();
-} else if (isWorker) {
- scheduleFlush = useMessageChannel();
-} else if (browserWindow === undefined && "function" === 'function') {
- scheduleFlush = attemptVertx();
-} else {
- scheduleFlush = useSetTimeout();
-}
-
-function then(onFulfillment, onRejection) {
- var parent = this;
-
- var child = new this.constructor(noop);
-
- if (child[PROMISE_ID] === undefined) {
- makePromise(child);
- }
-
- var _state = parent._state;
-
-
- if (_state) {
- var callback = arguments[_state - 1];
- asap(function () {
- return invokeCallback(_state, child, callback, parent._result);
- });
- } else {
- subscribe(parent, child, onFulfillment, onRejection);
- }
-
- return child;
-}
-
-/**
- `Promise.resolve` returns a promise that will become resolved with the
- passed `value`. It is shorthand for the following:
-
- ```javascript
- let promise = new Promise(function(resolve, reject){
- resolve(1);
- });
-
- promise.then(function(value){
- // value === 1
- });
- ```
-
- Instead of writing the above, your code now simply becomes the following:
-
- ```javascript
- let promise = Promise.resolve(1);
-
- promise.then(function(value){
- // value === 1
- });
- ```
-
- @method resolve
- @static
- @param {Any} value value that the returned promise will be resolved with
- Useful for tooling.
- @return {Promise} a promise that will become fulfilled with the given
- `value`
-*/
-function resolve$1(object) {
- /*jshint validthis:true */
- var Constructor = this;
-
- if (object && typeof object === 'object' && object.constructor === Constructor) {
- return object;
- }
-
- var promise = new Constructor(noop);
- resolve(promise, object);
- return promise;
-}
-
-var PROMISE_ID = Math.random().toString(36).substring(2);
-
-function noop() {}
-
-var PENDING = void 0;
-var FULFILLED = 1;
-var REJECTED = 2;
-
-function selfFulfillment() {
- return new TypeError("You cannot resolve a promise with itself");
-}
-
-function cannotReturnOwn() {
- return new TypeError('A promises callback cannot return that same promise.');
-}
-
-function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
- try {
- then$$1.call(value, fulfillmentHandler, rejectionHandler);
- } catch (e) {
- return e;
- }
-}
-
-function handleForeignThenable(promise, thenable, then$$1) {
- asap(function (promise) {
- var sealed = false;
- var error = tryThen(then$$1, thenable, function (value) {
- if (sealed) {
- return;
- }
- sealed = true;
- if (thenable !== value) {
- resolve(promise, value);
- } else {
- fulfill(promise, value);
- }
- }, function (reason) {
- if (sealed) {
- return;
- }
- sealed = true;
-
- reject(promise, reason);
- }, 'Settle: ' + (promise._label || ' unknown promise'));
-
- if (!sealed && error) {
- sealed = true;
- reject(promise, error);
- }
- }, promise);
-}
-
-function handleOwnThenable(promise, thenable) {
- if (thenable._state === FULFILLED) {
- fulfill(promise, thenable._result);
- } else if (thenable._state === REJECTED) {
- reject(promise, thenable._result);
- } else {
- subscribe(thenable, undefined, function (value) {
- return resolve(promise, value);
- }, function (reason) {
- return reject(promise, reason);
- });
- }
-}
-
-function handleMaybeThenable(promise, maybeThenable, then$$1) {
- if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
- handleOwnThenable(promise, maybeThenable);
- } else {
- if (then$$1 === undefined) {
- fulfill(promise, maybeThenable);
- } else if (isFunction(then$$1)) {
- handleForeignThenable(promise, maybeThenable, then$$1);
- } else {
- fulfill(promise, maybeThenable);
- }
- }
-}
-
-function resolve(promise, value) {
- if (promise === value) {
- reject(promise, selfFulfillment());
- } else if (objectOrFunction(value)) {
- var then$$1 = void 0;
- try {
- then$$1 = value.then;
- } catch (error) {
- reject(promise, error);
- return;
- }
- handleMaybeThenable(promise, value, then$$1);
- } else {
- fulfill(promise, value);
- }
-}
-
-function publishRejection(promise) {
- if (promise._onerror) {
- promise._onerror(promise._result);
- }
-
- publish(promise);
-}
-
-function fulfill(promise, value) {
- if (promise._state !== PENDING) {
- return;
- }
-
- promise._result = value;
- promise._state = FULFILLED;
-
- if (promise._subscribers.length !== 0) {
- asap(publish, promise);
- }
-}
-
-function reject(promise, reason) {
- if (promise._state !== PENDING) {
- return;
- }
- promise._state = REJECTED;
- promise._result = reason;
-
- asap(publishRejection, promise);
-}
-
-function subscribe(parent, child, onFulfillment, onRejection) {
- var _subscribers = parent._subscribers;
- var length = _subscribers.length;
-
-
- parent._onerror = null;
-
- _subscribers[length] = child;
- _subscribers[length + FULFILLED] = onFulfillment;
- _subscribers[length + REJECTED] = onRejection;
-
- if (length === 0 && parent._state) {
- asap(publish, parent);
- }
-}
-
-function publish(promise) {
- var subscribers = promise._subscribers;
- var settled = promise._state;
-
- if (subscribers.length === 0) {
- return;
- }
-
- var child = void 0,
- callback = void 0,
- detail = promise._result;
-
- for (var i = 0; i < subscribers.length; i += 3) {
- child = subscribers[i];
- callback = subscribers[i + settled];
-
- if (child) {
- invokeCallback(settled, child, callback, detail);
- } else {
- callback(detail);
- }
- }
-
- promise._subscribers.length = 0;
-}
-
-function invokeCallback(settled, promise, callback, detail) {
- var hasCallback = isFunction(callback),
- value = void 0,
- error = void 0,
- succeeded = true;
-
- if (hasCallback) {
- try {
- value = callback(detail);
- } catch (e) {
- succeeded = false;
- error = e;
- }
-
- if (promise === value) {
- reject(promise, cannotReturnOwn());
- return;
- }
- } else {
- value = detail;
- }
-
- if (promise._state !== PENDING) {
- // noop
- } else if (hasCallback && succeeded) {
- resolve(promise, value);
- } else if (succeeded === false) {
- reject(promise, error);
- } else if (settled === FULFILLED) {
- fulfill(promise, value);
- } else if (settled === REJECTED) {
- reject(promise, value);
- }
-}
-
-function initializePromise(promise, resolver) {
- try {
- resolver(function resolvePromise(value) {
- resolve(promise, value);
- }, function rejectPromise(reason) {
- reject(promise, reason);
- });
- } catch (e) {
- reject(promise, e);
- }
-}
-
-var id = 0;
-function nextId() {
- return id++;
-}
-
-function makePromise(promise) {
- promise[PROMISE_ID] = id++;
- promise._state = undefined;
- promise._result = undefined;
- promise._subscribers = [];
-}
-
-function validationError() {
- return new Error('Array Methods must be provided an Array');
-}
-
-var Enumerator = function () {
- function Enumerator(Constructor, input) {
- this._instanceConstructor = Constructor;
- this.promise = new Constructor(noop);
-
- if (!this.promise[PROMISE_ID]) {
- makePromise(this.promise);
- }
-
- if (isArray(input)) {
- this.length = input.length;
- this._remaining = input.length;
-
- this._result = new Array(this.length);
-
- if (this.length === 0) {
- fulfill(this.promise, this._result);
- } else {
- this.length = this.length || 0;
- this._enumerate(input);
- if (this._remaining === 0) {
- fulfill(this.promise, this._result);
- }
- }
- } else {
- reject(this.promise, validationError());
- }
- }
-
- Enumerator.prototype._enumerate = function _enumerate(input) {
- for (var i = 0; this._state === PENDING && i < input.length; i++) {
- this._eachEntry(input[i], i);
- }
- };
-
- Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
- var c = this._instanceConstructor;
- var resolve$$1 = c.resolve;
-
-
- if (resolve$$1 === resolve$1) {
- var _then = void 0;
- var error = void 0;
- var didError = false;
- try {
- _then = entry.then;
- } catch (e) {
- didError = true;
- error = e;
- }
-
- if (_then === then && entry._state !== PENDING) {
- this._settledAt(entry._state, i, entry._result);
- } else if (typeof _then !== 'function') {
- this._remaining--;
- this._result[i] = entry;
- } else if (c === Promise$1) {
- var promise = new c(noop);
- if (didError) {
- reject(promise, error);
- } else {
- handleMaybeThenable(promise, entry, _then);
- }
- this._willSettleAt(promise, i);
- } else {
- this._willSettleAt(new c(function (resolve$$1) {
- return resolve$$1(entry);
- }), i);
- }
- } else {
- this._willSettleAt(resolve$$1(entry), i);
- }
- };
-
- Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
- var promise = this.promise;
-
-
- if (promise._state === PENDING) {
- this._remaining--;
-
- if (state === REJECTED) {
- reject(promise, value);
- } else {
- this._result[i] = value;
- }
- }
-
- if (this._remaining === 0) {
- fulfill(promise, this._result);
- }
- };
-
- Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
- var enumerator = this;
-
- subscribe(promise, undefined, function (value) {
- return enumerator._settledAt(FULFILLED, i, value);
- }, function (reason) {
- return enumerator._settledAt(REJECTED, i, reason);
- });
- };
-
- return Enumerator;
-}();
-
-/**
- `Promise.all` accepts an array of promises, and returns a new promise which
- is fulfilled with an array of fulfillment values for the passed promises, or
- rejected with the reason of the first passed promise to be rejected. It casts all
- elements of the passed iterable to promises as it runs this algorithm.
-
- Example:
-
- ```javascript
- let promise1 = resolve(1);
- let promise2 = resolve(2);
- let promise3 = resolve(3);
- let promises = [ promise1, promise2, promise3 ];
-
- Promise.all(promises).then(function(array){
- // The array here would be [ 1, 2, 3 ];
- });
- ```
-
- If any of the `promises` given to `all` are rejected, the first promise
- that is rejected will be given as an argument to the returned promises's
- rejection handler. For example:
-
- Example:
-
- ```javascript
- let promise1 = resolve(1);
- let promise2 = reject(new Error("2"));
- let promise3 = reject(new Error("3"));
- let promises = [ promise1, promise2, promise3 ];
-
- Promise.all(promises).then(function(array){
- // Code here never runs because there are rejected promises!
- }, function(error) {
- // error.message === "2"
- });
- ```
-
- @method all
- @static
- @param {Array} entries array of promises
- @param {String} label optional string for labeling the promise.
- Useful for tooling.
- @return {Promise} promise that is fulfilled when all `promises` have been
- fulfilled, or rejected if any of them become rejected.
- @static
-*/
-function all(entries) {
- return new Enumerator(this, entries).promise;
-}
-
-/**
- `Promise.race` returns a new promise which is settled in the same way as the
- first passed promise to settle.
-
- Example:
-
- ```javascript
- let promise1 = new Promise(function(resolve, reject){
- setTimeout(function(){
- resolve('promise 1');
- }, 200);
- });
-
- let promise2 = new Promise(function(resolve, reject){
- setTimeout(function(){
- resolve('promise 2');
- }, 100);
- });
-
- Promise.race([promise1, promise2]).then(function(result){
- // result === 'promise 2' because it was resolved before promise1
- // was resolved.
- });
- ```
-
- `Promise.race` is deterministic in that only the state of the first
- settled promise matters. For example, even if other promises given to the
- `promises` array argument are resolved, but the first settled promise has
- become rejected before the other promises became fulfilled, the returned
- promise will become rejected:
-
- ```javascript
- let promise1 = new Promise(function(resolve, reject){
- setTimeout(function(){
- resolve('promise 1');
- }, 200);
- });
-
- let promise2 = new Promise(function(resolve, reject){
- setTimeout(function(){
- reject(new Error('promise 2'));
- }, 100);
- });
-
- Promise.race([promise1, promise2]).then(function(result){
- // Code here never runs
- }, function(reason){
- // reason.message === 'promise 2' because promise 2 became rejected before
- // promise 1 became fulfilled
- });
- ```
-
- An example real-world use case is implementing timeouts:
-
- ```javascript
- Promise.race([ajax('foo.json'), timeout(5000)])
- ```
-
- @method race
- @static
- @param {Array} promises array of promises to observe
- Useful for tooling.
- @return {Promise} a promise which settles in the same way as the first passed
- promise to settle.
-*/
-function race(entries) {
- /*jshint validthis:true */
- var Constructor = this;
-
- if (!isArray(entries)) {
- return new Constructor(function (_, reject) {
- return reject(new TypeError('You must pass an array to race.'));
- });
- } else {
- return new Constructor(function (resolve, reject) {
- var length = entries.length;
- for (var i = 0; i < length; i++) {
- Constructor.resolve(entries[i]).then(resolve, reject);
- }
- });
- }
-}
-
-/**
- `Promise.reject` returns a promise rejected with the passed `reason`.
- It is shorthand for the following:
-
- ```javascript
- let promise = new Promise(function(resolve, reject){
- reject(new Error('WHOOPS'));
- });
-
- promise.then(function(value){
- // Code here doesn't run because the promise is rejected!
- }, function(reason){
- // reason.message === 'WHOOPS'
- });
- ```
-
- Instead of writing the above, your code now simply becomes the following:
-
- ```javascript
- let promise = Promise.reject(new Error('WHOOPS'));
-
- promise.then(function(value){
- // Code here doesn't run because the promise is rejected!
- }, function(reason){
- // reason.message === 'WHOOPS'
- });
- ```
-
- @method reject
- @static
- @param {Any} reason value that the returned promise will be rejected with.
- Useful for tooling.
- @return {Promise} a promise rejected with the given `reason`.
-*/
-function reject$1(reason) {
- /*jshint validthis:true */
- var Constructor = this;
- var promise = new Constructor(noop);
- reject(promise, reason);
- return promise;
-}
-
-function needsResolver() {
- throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
-}
-
-function needsNew() {
- throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
-}
-
-/**
- Promise objects represent the eventual result of an asynchronous operation. The
- primary way of interacting with a promise is through its `then` method, which
- registers callbacks to receive either a promise's eventual value or the reason
- why the promise cannot be fulfilled.
-
- Terminology
- -----------
-
- - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- - `thenable` is an object or function that defines a `then` method.
- - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- - `exception` is a value that is thrown using the throw statement.
- - `reason` is a value that indicates why a promise was rejected.
- - `settled` the final resting state of a promise, fulfilled or rejected.
-
- A promise can be in one of three states: pending, fulfilled, or rejected.
-
- Promises that are fulfilled have a fulfillment value and are in the fulfilled
- state. Promises that are rejected have a rejection reason and are in the
- rejected state. A fulfillment value is never a thenable.
-
- Promises can also be said to *resolve* a value. If this value is also a
- promise, then the original promise's settled state will match the value's
- settled state. So a promise that *resolves* a promise that rejects will
- itself reject, and a promise that *resolves* a promise that fulfills will
- itself fulfill.
-
-
- Basic Usage:
- ------------
-
- ```js
- let promise = new Promise(function(resolve, reject) {
- // on success
- resolve(value);
-
- // on failure
- reject(reason);
- });
-
- promise.then(function(value) {
- // on fulfillment
- }, function(reason) {
- // on rejection
- });
- ```
-
- Advanced Usage:
- ---------------
-
- Promises shine when abstracting away asynchronous interactions such as
- `XMLHttpRequest`s.
-
- ```js
- function getJSON(url) {
- return new Promise(function(resolve, reject){
- let xhr = new XMLHttpRequest();
-
- xhr.open('GET', url);
- xhr.onreadystatechange = handler;
- xhr.responseType = 'json';
- xhr.setRequestHeader('Accept', 'application/json');
- xhr.send();
-
- function handler() {
- if (this.readyState === this.DONE) {
- if (this.status === 200) {
- resolve(this.response);
- } else {
- reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
- }
- }
- };
- });
- }
-
- getJSON('/posts.json').then(function(json) {
- // on fulfillment
- }, function(reason) {
- // on rejection
- });
- ```
-
- Unlike callbacks, promises are great composable primitives.
-
- ```js
- Promise.all([
- getJSON('/posts'),
- getJSON('/comments')
- ]).then(function(values){
- values[0] // => postsJSON
- values[1] // => commentsJSON
-
- return values;
- });
- ```
-
- @class Promise
- @param {Function} resolver
- Useful for tooling.
- @constructor
-*/
-
-var Promise$1 = function () {
- function Promise(resolver) {
- this[PROMISE_ID] = nextId();
- this._result = this._state = undefined;
- this._subscribers = [];
-
- if (noop !== resolver) {
- typeof resolver !== 'function' && needsResolver();
- this instanceof Promise ? initializePromise(this, resolver) : needsNew();
- }
- }
-
- /**
- The primary way of interacting with a promise is through its `then` method,
- which registers callbacks to receive either a promise's eventual value or the
- reason why the promise cannot be fulfilled.
- ```js
- findUser().then(function(user){
- // user is available
- }, function(reason){
- // user is unavailable, and you are given the reason why
- });
- ```
- Chaining
- --------
- The return value of `then` is itself a promise. This second, 'downstream'
- promise is resolved with the return value of the first promise's fulfillment
- or rejection handler, or rejected if the handler throws an exception.
- ```js
- findUser().then(function (user) {
- return user.name;
- }, function (reason) {
- return 'default name';
- }).then(function (userName) {
- // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
- // will be `'default name'`
- });
- findUser().then(function (user) {
- throw new Error('Found user, but still unhappy');
- }, function (reason) {
- throw new Error('`findUser` rejected and we're unhappy');
- }).then(function (value) {
- // never reached
- }, function (reason) {
- // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
- // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
- });
- ```
- If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
- ```js
- findUser().then(function (user) {
- throw new PedagogicalException('Upstream error');
- }).then(function (value) {
- // never reached
- }).then(function (value) {
- // never reached
- }, function (reason) {
- // The `PedgagocialException` is propagated all the way down to here
- });
- ```
- Assimilation
- ------------
- Sometimes the value you want to propagate to a downstream promise can only be
- retrieved asynchronously. This can be achieved by returning a promise in the
- fulfillment or rejection handler. The downstream promise will then be pending
- until the returned promise is settled. This is called *assimilation*.
- ```js
- findUser().then(function (user) {
- return findCommentsByAuthor(user);
- }).then(function (comments) {
- // The user's comments are now available
- });
- ```
- If the assimliated promise rejects, then the downstream promise will also reject.
- ```js
- findUser().then(function (user) {
- return findCommentsByAuthor(user);
- }).then(function (comments) {
- // If `findCommentsByAuthor` fulfills, we'll have the value here
- }, function (reason) {
- // If `findCommentsByAuthor` rejects, we'll have the reason here
- });
- ```
- Simple Example
- --------------
- Synchronous Example
- ```javascript
- let result;
- try {
- result = findResult();
- // success
- } catch(reason) {
- // failure
- }
- ```
- Errback Example
- ```js
- findResult(function(result, err){
- if (err) {
- // failure
- } else {
- // success
- }
- });
- ```
- Promise Example;
- ```javascript
- findResult().then(function(result){
- // success
- }, function(reason){
- // failure
- });
- ```
- Advanced Example
- --------------
- Synchronous Example
- ```javascript
- let author, books;
- try {
- author = findAuthor();
- books = findBooksByAuthor(author);
- // success
- } catch(reason) {
- // failure
- }
- ```
- Errback Example
- ```js
- function foundBooks(books) {
- }
- function failure(reason) {
- }
- findAuthor(function(author, err){
- if (err) {
- failure(err);
- // failure
- } else {
- try {
- findBoooksByAuthor(author, function(books, err) {
- if (err) {
- failure(err);
- } else {
- try {
- foundBooks(books);
- } catch(reason) {
- failure(reason);
- }
- }
- });
- } catch(error) {
- failure(err);
- }
- // success
- }
- });
- ```
- Promise Example;
- ```javascript
- findAuthor().
- then(findBooksByAuthor).
- then(function(books){
- // found books
- }).catch(function(reason){
- // something went wrong
- });
- ```
- @method then
- @param {Function} onFulfilled
- @param {Function} onRejected
- Useful for tooling.
- @return {Promise}
- */
-
- /**
- `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
- as the catch block of a try/catch statement.
- ```js
- function findAuthor(){
- throw new Error('couldn't find that author');
- }
- // synchronous
- try {
- findAuthor();
- } catch(reason) {
- // something went wrong
- }
- // async with promises
- findAuthor().catch(function(reason){
- // something went wrong
- });
- ```
- @method catch
- @param {Function} onRejection
- Useful for tooling.
- @return {Promise}
- */
-
-
- Promise.prototype.catch = function _catch(onRejection) {
- return this.then(null, onRejection);
- };
-
- /**
- `finally` will be invoked regardless of the promise's fate just as native
- try/catch/finally behaves
-
- Synchronous example:
-
- ```js
- findAuthor() {
- if (Math.random() > 0.5) {
- throw new Error();
- }
- return new Author();
- }
-
- try {
- return findAuthor(); // succeed or fail
- } catch(error) {
- return findOtherAuther();
- } finally {
- // always runs
- // doesn't affect the return value
- }
- ```
-
- Asynchronous example:
-
- ```js
- findAuthor().catch(function(reason){
- return findOtherAuther();
- }).finally(function(){
- // author was either found, or not
- });
- ```
-
- @method finally
- @param {Function} callback
- @return {Promise}
- */
-
-
- Promise.prototype.finally = function _finally(callback) {
- var promise = this;
- var constructor = promise.constructor;
-
- if (isFunction(callback)) {
- return promise.then(function (value) {
- return constructor.resolve(callback()).then(function () {
- return value;
- });
- }, function (reason) {
- return constructor.resolve(callback()).then(function () {
- throw reason;
- });
- });
- }
-
- return promise.then(callback, callback);
- };
-
- return Promise;
-}();
-
-Promise$1.prototype.then = then;
-Promise$1.all = all;
-Promise$1.race = race;
-Promise$1.resolve = resolve$1;
-Promise$1.reject = reject$1;
-Promise$1._setScheduler = setScheduler;
-Promise$1._setAsap = setAsap;
-Promise$1._asap = asap;
-
-/*global self*/
-function polyfill() {
- var local = void 0;
-
- if (typeof global !== 'undefined') {
- local = global;
- } else if (typeof self !== 'undefined') {
- local = self;
- } else {
- try {
- local = Function('return this')();
- } catch (e) {
- throw new Error('polyfill failed because global object is unavailable in this environment');
- }
- }
-
- var P = local.Promise;
-
- if (P) {
- var promiseToString = null;
- try {
- promiseToString = Object.prototype.toString.call(P.resolve());
- } catch (e) {
- // silently ignored
- }
-
- if (promiseToString === '[object Promise]' && !P.cast) {
- return;
- }
- }
-
- local.Promise = Promise$1;
-}
-
-// Strange compat..
-Promise$1.polyfill = polyfill;
-Promise$1.Promise = Promise$1;
-
-return Promise$1;
-
-})));
-
-
-
-//# sourceMappingURL=es6-promise.map
-
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../modules/OfflinePayments/node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../modules/OfflinePayments/node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
-
-/***/ }),
-
-/***/ "../../node_modules/flatpickr/dist/flatpickr.css":
-/*!****************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/flatpickr/dist/flatpickr.css ***!
- \****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-
-var content = __webpack_require__(/*! !../../../modules/OfflinePayments/node_modules/css-loader??ref--6-1!../../../modules/OfflinePayments/node_modules/postcss-loader/src??ref--6-2!./flatpickr.css */ "./node_modules/css-loader/index.js?!./node_modules/postcss-loader/src/index.js?!../../node_modules/flatpickr/dist/flatpickr.css");
-
-if(typeof content === 'string') content = [[module.i, content, '']];
-
-var transform;
-var insertInto;
-
-
-
-var options = {"hmr":true}
-
-options.transform = transform
-options.insertInto = undefined;
-
-var update = __webpack_require__(/*! ../../../modules/OfflinePayments/node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
-
-if(content.locals) module.exports = content.locals;
-
-if(false) {}
-
-/***/ }),
-
-/***/ "../../node_modules/flatpickr/dist/flatpickr.js":
-/*!***************************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/flatpickr/dist/flatpickr.js ***!
- \***************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-/* flatpickr v4.6.3, @license MIT */
-(function (global, factory) {
- true ? module.exports = factory() :
- undefined;
-}(this, function () { 'use strict';
-
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
-
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
-
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
-
- 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);
- };
-
- var HOOKS = [
- "onChange",
- "onClose",
- "onDayCreate",
- "onDestroy",
- "onKeyDown",
- "onMonthChange",
- "onOpen",
- "onParseConfig",
- "onReady",
- "onValueUpdate",
- "onYearChange",
- "onPreCalendarPosition",
- ];
- var defaults = {
- _disable: [],
- _enable: [],
- allowInput: false,
- altFormat: "F j, Y",
- altInput: false,
- altInputClass: "form-control input",
- animate: typeof window === "object" &&
- window.navigator.userAgent.indexOf("MSIE") === -1,
- ariaDateFormat: "F j, Y",
- clickOpens: true,
- closeOnSelect: true,
- conjunction: ", ",
- dateFormat: "Y-m-d",
- defaultHour: 12,
- defaultMinute: 0,
- defaultSeconds: 0,
- disable: [],
- disableMobile: false,
- enable: [],
- enableSeconds: false,
- enableTime: false,
- errorHandler: function (err) {
- return typeof console !== "undefined" && console.warn(err);
- },
- getWeek: function (givenDate) {
- var date = new Date(givenDate.getTime());
- date.setHours(0, 0, 0, 0);
- // Thursday in current week decides the year.
- date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
- // January 4 is always in week 1.
- var week1 = new Date(date.getFullYear(), 0, 4);
- // Adjust to Thursday in week 1 and count number of weeks from date to week1.
- return (1 +
- Math.round(((date.getTime() - week1.getTime()) / 86400000 -
- 3 +
- ((week1.getDay() + 6) % 7)) /
- 7));
- },
- hourIncrement: 1,
- ignoredFocusElements: [],
- inline: false,
- locale: "default",
- minuteIncrement: 5,
- mode: "single",
- monthSelectorType: "dropdown",
- nextArrow: "
",
- noCalendar: false,
- now: new Date(),
- onChange: [],
- onClose: [],
- onDayCreate: [],
- onDestroy: [],
- onKeyDown: [],
- onMonthChange: [],
- onOpen: [],
- onParseConfig: [],
- onReady: [],
- onValueUpdate: [],
- onYearChange: [],
- onPreCalendarPosition: [],
- plugins: [],
- position: "auto",
- positionElement: undefined,
- prevArrow: "
",
- shorthandCurrentMonth: false,
- showMonths: 1,
- static: false,
- time_24hr: false,
- weekNumbers: false,
- wrap: false
- };
-
- var english = {
- weekdays: {
- shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- longhand: [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday",
- ]
- },
- months: {
- shorthand: [
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec",
- ],
- longhand: [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December",
- ]
- },
- daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
- firstDayOfWeek: 0,
- ordinal: function (nth) {
- var s = nth % 100;
- if (s > 3 && s < 21)
- return "th";
- switch (s % 10) {
- case 1:
- return "st";
- case 2:
- return "nd";
- case 3:
- return "rd";
- default:
- return "th";
- }
- },
- rangeSeparator: " to ",
- weekAbbreviation: "Wk",
- scrollTitle: "Scroll to increment",
- toggleTitle: "Click to toggle",
- amPM: ["AM", "PM"],
- yearAriaLabel: "Year",
- hourAriaLabel: "Hour",
- minuteAriaLabel: "Minute",
- time_24hr: false
- };
-
- var pad = function (number) { return ("0" + number).slice(-2); };
- var int = function (bool) { return (bool === true ? 1 : 0); };
- /* istanbul ignore next */
- function debounce(func, wait, immediate) {
- if (immediate === void 0) { immediate = false; }
- var timeout;
- return function () {
- var context = this, args = arguments;
- timeout !== null && clearTimeout(timeout);
- timeout = window.setTimeout(function () {
- timeout = null;
- if (!immediate)
- func.apply(context, args);
- }, wait);
- if (immediate && !timeout)
- func.apply(context, args);
- };
- }
- var arrayify = function (obj) {
- return obj instanceof Array ? obj : [obj];
- };
-
- function toggleClass(elem, className, bool) {
- if (bool === true)
- return elem.classList.add(className);
- elem.classList.remove(className);
- }
- function createElement(tag, className, content) {
- var e = window.document.createElement(tag);
- className = className || "";
- content = content || "";
- e.className = className;
- if (content !== undefined)
- e.textContent = content;
- return e;
- }
- function clearNode(node) {
- while (node.firstChild)
- node.removeChild(node.firstChild);
- }
- function findParent(node, condition) {
- if (condition(node))
- return node;
- else if (node.parentNode)
- return findParent(node.parentNode, condition);
- return undefined; // nothing found
- }
- function createNumberInput(inputClassName, opts) {
- var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown");
- if (navigator.userAgent.indexOf("MSIE 9.0") === -1) {
- numInput.type = "number";
- }
- else {
- numInput.type = "text";
- numInput.pattern = "\\d*";
- }
- if (opts !== undefined)
- for (var key in opts)
- numInput.setAttribute(key, opts[key]);
- wrapper.appendChild(numInput);
- wrapper.appendChild(arrowUp);
- wrapper.appendChild(arrowDown);
- return wrapper;
- }
- function getEventTarget(event) {
- if (typeof event.composedPath === "function") {
- var path = event.composedPath();
- return path[0];
- }
- return event.target;
- }
-
- var doNothing = function () { return undefined; };
- var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
- var revFormat = {
- D: doNothing,
- F: function (dateObj, monthName, locale) {
- dateObj.setMonth(locale.months.longhand.indexOf(monthName));
- },
- G: function (dateObj, hour) {
- dateObj.setHours(parseFloat(hour));
- },
- H: function (dateObj, hour) {
- dateObj.setHours(parseFloat(hour));
- },
- J: function (dateObj, day) {
- dateObj.setDate(parseFloat(day));
- },
- K: function (dateObj, amPM, locale) {
- dateObj.setHours((dateObj.getHours() % 12) +
- 12 * int(new RegExp(locale.amPM[1], "i").test(amPM)));
- },
- M: function (dateObj, shortMonth, locale) {
- dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));
- },
- S: function (dateObj, seconds) {
- dateObj.setSeconds(parseFloat(seconds));
- },
- U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },
- W: function (dateObj, weekNum, locale) {
- var weekNumber = parseInt(weekNum);
- var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);
- date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);
- return date;
- },
- Y: function (dateObj, year) {
- dateObj.setFullYear(parseFloat(year));
- },
- Z: function (_, ISODate) { return new Date(ISODate); },
- d: function (dateObj, day) {
- dateObj.setDate(parseFloat(day));
- },
- h: function (dateObj, hour) {
- dateObj.setHours(parseFloat(hour));
- },
- i: function (dateObj, minutes) {
- dateObj.setMinutes(parseFloat(minutes));
- },
- j: function (dateObj, day) {
- dateObj.setDate(parseFloat(day));
- },
- l: doNothing,
- m: function (dateObj, month) {
- dateObj.setMonth(parseFloat(month) - 1);
- },
- n: function (dateObj, month) {
- dateObj.setMonth(parseFloat(month) - 1);
- },
- s: function (dateObj, seconds) {
- dateObj.setSeconds(parseFloat(seconds));
- },
- u: function (_, unixMillSeconds) {
- return new Date(parseFloat(unixMillSeconds));
- },
- w: doNothing,
- y: function (dateObj, year) {
- dateObj.setFullYear(2000 + parseFloat(year));
- }
- };
- var tokenRegex = {
- D: "(\\w+)",
- F: "(\\w+)",
- G: "(\\d\\d|\\d)",
- H: "(\\d\\d|\\d)",
- J: "(\\d\\d|\\d)\\w+",
- K: "",
- M: "(\\w+)",
- S: "(\\d\\d|\\d)",
- U: "(.+)",
- W: "(\\d\\d|\\d)",
- Y: "(\\d{4})",
- Z: "(.+)",
- d: "(\\d\\d|\\d)",
- h: "(\\d\\d|\\d)",
- i: "(\\d\\d|\\d)",
- j: "(\\d\\d|\\d)",
- l: "(\\w+)",
- m: "(\\d\\d|\\d)",
- n: "(\\d\\d|\\d)",
- s: "(\\d\\d|\\d)",
- u: "(.+)",
- w: "(\\d\\d|\\d)",
- y: "(\\d{2})"
- };
- var formats = {
- // get the date in UTC
- Z: function (date) { return date.toISOString(); },
- // weekday name, short, e.g. Thu
- D: function (date, locale, options) {
- return locale.weekdays.shorthand[formats.w(date, locale, options)];
- },
- // full month name e.g. January
- F: function (date, locale, options) {
- return monthToStr(formats.n(date, locale, options) - 1, false, locale);
- },
- // padded hour 1-12
- G: function (date, locale, options) {
- return pad(formats.h(date, locale, options));
- },
- // hours with leading zero e.g. 03
- H: function (date) { return pad(date.getHours()); },
- // day (1-30) with ordinal suffix e.g. 1st, 2nd
- J: function (date, locale) {
- return locale.ordinal !== undefined
- ? date.getDate() + locale.ordinal(date.getDate())
- : date.getDate();
- },
- // AM/PM
- K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },
- // shorthand month e.g. Jan, Sep, Oct, etc
- M: function (date, locale) {
- return monthToStr(date.getMonth(), true, locale);
- },
- // seconds 00-59
- S: function (date) { return pad(date.getSeconds()); },
- // unix timestamp
- U: function (date) { return date.getTime() / 1000; },
- W: function (date, _, options) {
- return options.getWeek(date);
- },
- // full year e.g. 2016
- Y: function (date) { return date.getFullYear(); },
- // day in month, padded (01-30)
- d: function (date) { return pad(date.getDate()); },
- // hour from 1-12 (am/pm)
- h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },
- // minutes, padded with leading zero e.g. 09
- i: function (date) { return pad(date.getMinutes()); },
- // day in month (1-30)
- j: function (date) { return date.getDate(); },
- // weekday name, full, e.g. Thursday
- l: function (date, locale) {
- return locale.weekdays.longhand[date.getDay()];
- },
- // padded month number (01-12)
- m: function (date) { return pad(date.getMonth() + 1); },
- // the month number (1-12)
- n: function (date) { return date.getMonth() + 1; },
- // seconds 0-59
- s: function (date) { return date.getSeconds(); },
- // Unix Milliseconds
- u: function (date) { return date.getTime(); },
- // number of the day of the week
- w: function (date) { return date.getDay(); },
- // last two digits of year e.g. 16 for 2016
- y: function (date) { return String(date.getFullYear()).substring(2); }
- };
-
- var createDateFormatter = function (_a) {
- var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
- return function (dateObj, frmt, overrideLocale) {
- var locale = overrideLocale || l10n;
- if (config.formatDate !== undefined) {
- return config.formatDate(dateObj, frmt, locale);
- }
- return frmt
- .split("")
- .map(function (c, i, arr) {
- return formats[c] && arr[i - 1] !== "\\"
- ? formats[c](dateObj, locale, config)
- : c !== "\\"
- ? c
- : "";
- })
- .join("");
- };
- };
- var createDateParser = function (_a) {
- var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
- return function (date, givenFormat, timeless, customLocale) {
- if (date !== 0 && !date)
- return undefined;
- var locale = customLocale || l10n;
- var parsedDate;
- var dateOrig = date;
- if (date instanceof Date)
- parsedDate = new Date(date.getTime());
- else if (typeof date !== "string" &&
- date.toFixed !== undefined // timestamp
- )
- // create a copy
- parsedDate = new Date(date);
- else if (typeof date === "string") {
- // date string
- var format = givenFormat || (config || defaults).dateFormat;
- var datestr = String(date).trim();
- if (datestr === "today") {
- parsedDate = new Date();
- timeless = true;
- }
- else if (/Z$/.test(datestr) ||
- /GMT$/.test(datestr) // datestrings w/ timezone
- )
- parsedDate = new Date(date);
- else if (config && config.parseDate)
- parsedDate = config.parseDate(date, format);
- else {
- parsedDate =
- !config || !config.noCalendar
- ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
- : new Date(new Date().setHours(0, 0, 0, 0));
- var matched = void 0, ops = [];
- for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
- var token_1 = format[i];
- var isBackSlash = token_1 === "\\";
- var escaped = format[i - 1] === "\\" || isBackSlash;
- if (tokenRegex[token_1] && !escaped) {
- regexStr += tokenRegex[token_1];
- var match = new RegExp(regexStr).exec(date);
- if (match && (matched = true)) {
- ops[token_1 !== "Y" ? "push" : "unshift"]({
- fn: revFormat[token_1],
- val: match[++matchIndex]
- });
- }
- }
- else if (!isBackSlash)
- regexStr += "."; // don't really care
- ops.forEach(function (_a) {
- var fn = _a.fn, val = _a.val;
- return (parsedDate = fn(parsedDate, val, locale) || parsedDate);
- });
- }
- parsedDate = matched ? parsedDate : undefined;
- }
- }
- /* istanbul ignore next */
- if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {
- config.errorHandler(new Error("Invalid date provided: " + dateOrig));
- return undefined;
- }
- if (timeless === true)
- parsedDate.setHours(0, 0, 0, 0);
- return parsedDate;
- };
- };
- /**
- * Compute the difference in dates, measured in ms
- */
- function compareDates(date1, date2, timeless) {
- if (timeless === void 0) { timeless = true; }
- if (timeless !== false) {
- return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -
- new Date(date2.getTime()).setHours(0, 0, 0, 0));
- }
- return date1.getTime() - date2.getTime();
- }
- var isBetween = function (ts, ts1, ts2) {
- return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
- };
- var duration = {
- DAY: 86400000
- };
-
- if (typeof Object.assign !== "function") {
- Object.assign = function (target) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
- if (!target) {
- throw TypeError("Cannot convert undefined or null to object");
- }
- var _loop_1 = function (source) {
- if (source) {
- Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });
- }
- };
- for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
- var source = args_1[_a];
- _loop_1(source);
- }
- return target;
- };
- }
-
- var DEBOUNCED_CHANGE_MS = 300;
- function FlatpickrInstance(element, instanceConfig) {
- var self = {
- config: __assign({}, defaults, flatpickr.defaultConfig),
- l10n: english
- };
- self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
- self._handlers = [];
- self.pluginElements = [];
- self.loadedPlugins = [];
- self._bind = bind;
- self._setHoursFromDate = setHoursFromDate;
- self._positionCalendar = positionCalendar;
- self.changeMonth = changeMonth;
- self.changeYear = changeYear;
- self.clear = clear;
- self.close = close;
- self._createElement = createElement;
- self.destroy = destroy;
- self.isEnabled = isEnabled;
- self.jumpToDate = jumpToDate;
- self.open = open;
- self.redraw = redraw;
- self.set = set;
- self.setDate = setDate;
- self.toggle = toggle;
- function setupHelperFunctions() {
- self.utils = {
- getDaysInMonth: function (month, yr) {
- if (month === void 0) { month = self.currentMonth; }
- if (yr === void 0) { yr = self.currentYear; }
- if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))
- return 29;
- return self.l10n.daysInMonth[month];
- }
- };
- }
- function init() {
- self.element = self.input = element;
- self.isOpen = false;
- parseConfig();
- setupLocale();
- setupInputs();
- setupDates();
- setupHelperFunctions();
- if (!self.isMobile)
- build();
- bindEvents();
- if (self.selectedDates.length || self.config.noCalendar) {
- if (self.config.enableTime) {
- setHoursFromDate(self.config.noCalendar
- ? self.latestSelectedDateObj || self.config.minDate
- : undefined);
- }
- updateValue(false);
- }
- setCalendarWidth();
- self.showTimeInput =
- self.selectedDates.length > 0 || self.config.noCalendar;
- var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
- /* TODO: investigate this further
-
- Currently, there is weird positioning behavior in safari causing pages
- to scroll up. https://github.com/chmln/flatpickr/issues/563
-
- However, most browsers are not Safari and positioning is expensive when used
- in scale. https://github.com/chmln/flatpickr/issues/1096
- */
- if (!self.isMobile && isSafari) {
- positionCalendar();
- }
- triggerEvent("onReady");
- }
- function bindToInstance(fn) {
- return fn.bind(self);
- }
- function setCalendarWidth() {
- var config = self.config;
- if (config.weekNumbers === false && config.showMonths === 1)
- return;
- else if (config.noCalendar !== true) {
- window.requestAnimationFrame(function () {
- if (self.calendarContainer !== undefined) {
- self.calendarContainer.style.visibility = "hidden";
- self.calendarContainer.style.display = "block";
- }
- if (self.daysContainer !== undefined) {
- var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;
- self.daysContainer.style.width = daysWidth + "px";
- self.calendarContainer.style.width =
- daysWidth +
- (self.weekWrapper !== undefined
- ? self.weekWrapper.offsetWidth
- : 0) +
- "px";
- self.calendarContainer.style.removeProperty("visibility");
- self.calendarContainer.style.removeProperty("display");
- }
- });
- }
- }
- /**
- * The handler for all events targeting the time inputs
- */
- function updateTime(e) {
- if (self.selectedDates.length === 0) {
- setDefaultTime();
- }
- if (e !== undefined && e.type !== "blur") {
- timeWrapper(e);
- }
- var prevValue = self._input.value;
- setHoursFromInputs();
- updateValue();
- if (self._input.value !== prevValue) {
- self._debouncedChange();
- }
- }
- function ampm2military(hour, amPM) {
- return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);
- }
- function military2ampm(hour) {
- switch (hour % 24) {
- case 0:
- case 12:
- return 12;
- default:
- return hour % 12;
- }
- }
- /**
- * Syncs the selected date object time with user's time input
- */
- function setHoursFromInputs() {
- if (self.hourElement === undefined || self.minuteElement === undefined)
- return;
- var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined
- ? (parseInt(self.secondElement.value, 10) || 0) % 60
- : 0;
- if (self.amPM !== undefined) {
- hours = ampm2military(hours, self.amPM.textContent);
- }
- var limitMinHours = self.config.minTime !== undefined ||
- (self.config.minDate &&
- self.minDateHasTime &&
- self.latestSelectedDateObj &&
- compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===
- 0);
- var limitMaxHours = self.config.maxTime !== undefined ||
- (self.config.maxDate &&
- self.maxDateHasTime &&
- self.latestSelectedDateObj &&
- compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===
- 0);
- if (limitMaxHours) {
- var maxTime = self.config.maxTime !== undefined
- ? self.config.maxTime
- : self.config.maxDate;
- hours = Math.min(hours, maxTime.getHours());
- if (hours === maxTime.getHours())
- minutes = Math.min(minutes, maxTime.getMinutes());
- if (minutes === maxTime.getMinutes())
- seconds = Math.min(seconds, maxTime.getSeconds());
- }
- if (limitMinHours) {
- var minTime = self.config.minTime !== undefined
- ? self.config.minTime
- : self.config.minDate;
- hours = Math.max(hours, minTime.getHours());
- if (hours === minTime.getHours())
- minutes = Math.max(minutes, minTime.getMinutes());
- if (minutes === minTime.getMinutes())
- seconds = Math.max(seconds, minTime.getSeconds());
- }
- setHours(hours, minutes, seconds);
- }
- /**
- * Syncs time input values with a date
- */
- function setHoursFromDate(dateObj) {
- var date = dateObj || self.latestSelectedDateObj;
- if (date)
- setHours(date.getHours(), date.getMinutes(), date.getSeconds());
- }
- function setDefaultHours() {
- var hours = self.config.defaultHour;
- var minutes = self.config.defaultMinute;
- var seconds = self.config.defaultSeconds;
- if (self.config.minDate !== undefined) {
- var minHr = self.config.minDate.getHours();
- var minMinutes = self.config.minDate.getMinutes();
- hours = Math.max(hours, minHr);
- if (hours === minHr)
- minutes = Math.max(minMinutes, minutes);
- if (hours === minHr && minutes === minMinutes)
- seconds = self.config.minDate.getSeconds();
- }
- if (self.config.maxDate !== undefined) {
- var maxHr = self.config.maxDate.getHours();
- var maxMinutes = self.config.maxDate.getMinutes();
- hours = Math.min(hours, maxHr);
- if (hours === maxHr)
- minutes = Math.min(maxMinutes, minutes);
- if (hours === maxHr && minutes === maxMinutes)
- seconds = self.config.maxDate.getSeconds();
- }
- setHours(hours, minutes, seconds);
- }
- /**
- * Sets the hours, minutes, and optionally seconds
- * of the latest selected date object and the
- * corresponding time inputs
- * @param {Number} hours the hour. whether its military
- * or am-pm gets inferred from config
- * @param {Number} minutes the minutes
- * @param {Number} seconds the seconds (optional)
- */
- function setHours(hours, minutes, seconds) {
- if (self.latestSelectedDateObj !== undefined) {
- self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);
- }
- if (!self.hourElement || !self.minuteElement || self.isMobile)
- return;
- self.hourElement.value = pad(!self.config.time_24hr
- ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)
- : hours);
- self.minuteElement.value = pad(minutes);
- if (self.amPM !== undefined)
- self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];
- if (self.secondElement !== undefined)
- self.secondElement.value = pad(seconds);
- }
- /**
- * Handles the year input and incrementing events
- * @param {Event} event the keyup or increment event
- */
- function onYearInput(event) {
- var year = parseInt(event.target.value) + (event.delta || 0);
- if (year / 1000 > 1 ||
- (event.key === "Enter" && !/[^\d]/.test(year.toString()))) {
- changeYear(year);
- }
- }
- /**
- * Essentially addEventListener + tracking
- * @param {Element} element the element to addEventListener to
- * @param {String} event the event name
- * @param {Function} handler the event handler
- */
- function bind(element, event, handler, options) {
- if (event instanceof Array)
- return event.forEach(function (ev) { return bind(element, ev, handler, options); });
- if (element instanceof Array)
- return element.forEach(function (el) { return bind(el, event, handler, options); });
- element.addEventListener(event, handler, options);
- self._handlers.push({
- element: element,
- event: event,
- handler: handler,
- options: options
- });
- }
- /**
- * A mousedown handler which mimics click.
- * Minimizes latency, since we don't need to wait for mouseup in most cases.
- * Also, avoids handling right clicks.
- *
- * @param {Function} handler the event handler
- */
- function onClick(handler) {
- return function (evt) {
- evt.which === 1 && handler(evt);
- };
- }
- function triggerChange() {
- triggerEvent("onChange");
- }
- /**
- * Adds all the necessary event listeners
- */
- function bindEvents() {
- if (self.config.wrap) {
- ["open", "close", "toggle", "clear"].forEach(function (evt) {
- Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) {
- return bind(el, "click", self[evt]);
- });
- });
- }
- if (self.isMobile) {
- setupMobile();
- return;
- }
- var debouncedResize = debounce(onResize, 50);
- self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);
- if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))
- bind(self.daysContainer, "mouseover", function (e) {
- if (self.config.mode === "range")
- onMouseOver(e.target);
- });
- bind(window.document.body, "keydown", onKeyDown);
- if (!self.config.inline && !self.config.static)
- bind(window, "resize", debouncedResize);
- if (window.ontouchstart !== undefined)
- bind(window.document, "touchstart", documentClick);
- else
- bind(window.document, "mousedown", onClick(documentClick));
- bind(window.document, "focus", documentClick, { capture: true });
- if (self.config.clickOpens === true) {
- bind(self._input, "focus", self.open);
- bind(self._input, "mousedown", onClick(self.open));
- }
- if (self.daysContainer !== undefined) {
- bind(self.monthNav, "mousedown", onClick(onMonthNavClick));
- bind(self.monthNav, ["keyup", "increment"], onYearInput);
- bind(self.daysContainer, "mousedown", onClick(selectDate));
- }
- if (self.timeContainer !== undefined &&
- self.minuteElement !== undefined &&
- self.hourElement !== undefined) {
- var selText = function (e) {
- return e.target.select();
- };
- bind(self.timeContainer, ["increment"], updateTime);
- bind(self.timeContainer, "blur", updateTime, { capture: true });
- bind(self.timeContainer, "mousedown", onClick(timeIncrement));
- bind([self.hourElement, self.minuteElement], ["focus", "click"], selText);
- if (self.secondElement !== undefined)
- bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); });
- if (self.amPM !== undefined) {
- bind(self.amPM, "mousedown", onClick(function (e) {
- updateTime(e);
- triggerChange();
- }));
- }
- }
- }
- /**
- * Set the calendar view to a particular date.
- * @param {Date} jumpDate the date to set the view to
- * @param {boolean} triggerChange if change events should be triggered
- */
- function jumpToDate(jumpDate, triggerChange) {
- var jumpTo = jumpDate !== undefined
- ? self.parseDate(jumpDate)
- : self.latestSelectedDateObj ||
- (self.config.minDate && self.config.minDate > self.now
- ? self.config.minDate
- : self.config.maxDate && self.config.maxDate < self.now
- ? self.config.maxDate
- : self.now);
- var oldYear = self.currentYear;
- var oldMonth = self.currentMonth;
- try {
- if (jumpTo !== undefined) {
- self.currentYear = jumpTo.getFullYear();
- self.currentMonth = jumpTo.getMonth();
- }
- }
- catch (e) {
- /* istanbul ignore next */
- e.message = "Invalid date supplied: " + jumpTo;
- self.config.errorHandler(e);
- }
- if (triggerChange && self.currentYear !== oldYear) {
- triggerEvent("onYearChange");
- buildMonthSwitch();
- }
- if (triggerChange &&
- (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {
- triggerEvent("onMonthChange");
- }
- self.redraw();
- }
- /**
- * The up/down arrow handler for time inputs
- * @param {Event} e the click event
- */
- function timeIncrement(e) {
- if (~e.target.className.indexOf("arrow"))
- incrementNumInput(e, e.target.classList.contains("arrowUp") ? 1 : -1);
- }
- /**
- * Increments/decrements the value of input associ-
- * ated with the up/down arrow by dispatching an
- * "increment" event on the input.
- *
- * @param {Event} e the click event
- * @param {Number} delta the diff (usually 1 or -1)
- * @param {Element} inputElem the input element
- */
- function incrementNumInput(e, delta, inputElem) {
- var target = e && e.target;
- var input = inputElem ||
- (target && target.parentNode && target.parentNode.firstChild);
- var event = createEvent("increment");
- event.delta = delta;
- input && input.dispatchEvent(event);
- }
- function build() {
- var fragment = window.document.createDocumentFragment();
- self.calendarContainer = createElement("div", "flatpickr-calendar");
- self.calendarContainer.tabIndex = -1;
- if (!self.config.noCalendar) {
- fragment.appendChild(buildMonthNav());
- self.innerContainer = createElement("div", "flatpickr-innerContainer");
- if (self.config.weekNumbers) {
- var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;
- self.innerContainer.appendChild(weekWrapper);
- self.weekNumbers = weekNumbers;
- self.weekWrapper = weekWrapper;
- }
- self.rContainer = createElement("div", "flatpickr-rContainer");
- self.rContainer.appendChild(buildWeekdays());
- if (!self.daysContainer) {
- self.daysContainer = createElement("div", "flatpickr-days");
- self.daysContainer.tabIndex = -1;
- }
- buildDays();
- self.rContainer.appendChild(self.daysContainer);
- self.innerContainer.appendChild(self.rContainer);
- fragment.appendChild(self.innerContainer);
- }
- if (self.config.enableTime) {
- fragment.appendChild(buildTime());
- }
- toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range");
- toggleClass(self.calendarContainer, "animate", self.config.animate === true);
- toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1);
- self.calendarContainer.appendChild(fragment);
- var customAppend = self.config.appendTo !== undefined &&
- self.config.appendTo.nodeType !== undefined;
- if (self.config.inline || self.config.static) {
- self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
- if (self.config.inline) {
- if (!customAppend && self.element.parentNode)
- self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);
- else if (self.config.appendTo !== undefined)
- self.config.appendTo.appendChild(self.calendarContainer);
- }
- if (self.config.static) {
- var wrapper = createElement("div", "flatpickr-wrapper");
- if (self.element.parentNode)
- self.element.parentNode.insertBefore(wrapper, self.element);
- wrapper.appendChild(self.element);
- if (self.altInput)
- wrapper.appendChild(self.altInput);
- wrapper.appendChild(self.calendarContainer);
- }
- }
- if (!self.config.static && !self.config.inline)
- (self.config.appendTo !== undefined
- ? self.config.appendTo
- : window.document.body).appendChild(self.calendarContainer);
- }
- function createDay(className, date, dayNumber, i) {
- var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", "flatpickr-day " + className, date.getDate().toString());
- dayElement.dateObj = date;
- dayElement.$i = i;
- dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
- if (className.indexOf("hidden") === -1 &&
- compareDates(date, self.now) === 0) {
- self.todayDateElem = dayElement;
- dayElement.classList.add("today");
- dayElement.setAttribute("aria-current", "date");
- }
- if (dateIsEnabled) {
- dayElement.tabIndex = -1;
- if (isDateSelected(date)) {
- dayElement.classList.add("selected");
- self.selectedDateElem = dayElement;
- if (self.config.mode === "range") {
- toggleClass(dayElement, "startRange", self.selectedDates[0] &&
- compareDates(date, self.selectedDates[0], true) === 0);
- toggleClass(dayElement, "endRange", self.selectedDates[1] &&
- compareDates(date, self.selectedDates[1], true) === 0);
- if (className === "nextMonthDay")
- dayElement.classList.add("inRange");
- }
- }
- }
- else {
- dayElement.classList.add("flatpickr-disabled");
- }
- if (self.config.mode === "range") {
- if (isDateInRange(date) && !isDateSelected(date))
- dayElement.classList.add("inRange");
- }
- if (self.weekNumbers &&
- self.config.showMonths === 1 &&
- className !== "prevMonthDay" &&
- dayNumber % 7 === 1) {
- self.weekNumbers.insertAdjacentHTML("beforeend", "
" + self.config.getWeek(date) + "");
- }
- triggerEvent("onDayCreate", dayElement);
- return dayElement;
- }
- function focusOnDayElem(targetNode) {
- targetNode.focus();
- if (self.config.mode === "range")
- onMouseOver(targetNode);
- }
- function getFirstAvailableDay(delta) {
- var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;
- var endMonth = delta > 0 ? self.config.showMonths : -1;
- for (var m = startMonth; m != endMonth; m += delta) {
- var month = self.daysContainer.children[m];
- var startIndex = delta > 0 ? 0 : month.children.length - 1;
- var endIndex = delta > 0 ? month.children.length : -1;
- for (var i = startIndex; i != endIndex; i += delta) {
- var c = month.children[i];
- if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj))
- return c;
- }
- }
- return undefined;
- }
- function getNextAvailableDay(current, delta) {
- var givenMonth = current.className.indexOf("Month") === -1
- ? current.dateObj.getMonth()
- : self.currentMonth;
- var endMonth = delta > 0 ? self.config.showMonths : -1;
- var loopDelta = delta > 0 ? 1 : -1;
- for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {
- var month = self.daysContainer.children[m];
- var startIndex = givenMonth - self.currentMonth === m
- ? current.$i + delta
- : delta < 0
- ? month.children.length - 1
- : 0;
- var numMonthDays = month.children.length;
- for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {
- var c = month.children[i];
- if (c.className.indexOf("hidden") === -1 &&
- isEnabled(c.dateObj) &&
- Math.abs(current.$i - i) >= Math.abs(delta))
- return focusOnDayElem(c);
- }
- }
- self.changeMonth(loopDelta);
- focusOnDay(getFirstAvailableDay(loopDelta), 0);
- return undefined;
- }
- function focusOnDay(current, offset) {
- var dayFocused = isInView(document.activeElement || document.body);
- var startElem = current !== undefined
- ? current
- : dayFocused
- ? document.activeElement
- : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)
- ? self.selectedDateElem
- : self.todayDateElem !== undefined && isInView(self.todayDateElem)
- ? self.todayDateElem
- : getFirstAvailableDay(offset > 0 ? 1 : -1);
- if (startElem === undefined)
- return self._input.focus();
- if (!dayFocused)
- return focusOnDayElem(startElem);
- getNextAvailableDay(startElem, offset);
- }
- function buildMonthDays(year, month) {
- var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;
- var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12);
- var daysInMonth = self.utils.getDaysInMonth(month), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay";
- var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;
- // prepend days from the ending of previous month
- for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
- days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
- }
- // Start at 1 since there is no 0th day
- for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
- days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex));
- }
- // append days from the next month
- for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&
- (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
- days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
- }
- //updateNavigationCurrentMonth();
- var dayContainer = createElement("div", "dayContainer");
- dayContainer.appendChild(days);
- return dayContainer;
- }
- function buildDays() {
- if (self.daysContainer === undefined) {
- return;
- }
- clearNode(self.daysContainer);
- // TODO: week numbers for each month
- if (self.weekNumbers)
- clearNode(self.weekNumbers);
- var frag = document.createDocumentFragment();
- for (var i = 0; i < self.config.showMonths; i++) {
- var d = new Date(self.currentYear, self.currentMonth, 1);
- d.setMonth(self.currentMonth + i);
- frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));
- }
- self.daysContainer.appendChild(frag);
- self.days = self.daysContainer.firstChild;
- if (self.config.mode === "range" && self.selectedDates.length === 1) {
- onMouseOver();
- }
- }
- function buildMonthSwitch() {
- if (self.config.showMonths > 1 ||
- self.config.monthSelectorType !== "dropdown")
- return;
- var shouldBuildMonth = function (month) {
- if (self.config.minDate !== undefined &&
- self.currentYear === self.config.minDate.getFullYear() &&
- month < self.config.minDate.getMonth()) {
- return false;
- }
- return !(self.config.maxDate !== undefined &&
- self.currentYear === self.config.maxDate.getFullYear() &&
- month > self.config.maxDate.getMonth());
- };
- self.monthsDropdownContainer.tabIndex = -1;
- self.monthsDropdownContainer.innerHTML = "";
- for (var i = 0; i < 12; i++) {
- if (!shouldBuildMonth(i))
- continue;
- var month = createElement("option", "flatpickr-monthDropdown-month");
- month.value = new Date(self.currentYear, i).getMonth().toString();
- month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);
- month.tabIndex = -1;
- if (self.currentMonth === i) {
- month.selected = true;
- }
- self.monthsDropdownContainer.appendChild(month);
- }
- }
- function buildMonth() {
- var container = createElement("div", "flatpickr-month");
- var monthNavFragment = window.document.createDocumentFragment();
- var monthElement;
- if (self.config.showMonths > 1 ||
- self.config.monthSelectorType === "static") {
- monthElement = createElement("span", "cur-month");
- }
- else {
- self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months");
- bind(self.monthsDropdownContainer, "change", function (e) {
- var target = e.target;
- var selectedMonth = parseInt(target.value, 10);
- self.changeMonth(selectedMonth - self.currentMonth);
- triggerEvent("onMonthChange");
- });
- buildMonthSwitch();
- monthElement = self.monthsDropdownContainer;
- }
- var yearInput = createNumberInput("cur-year", { tabindex: "-1" });
- var yearElement = yearInput.getElementsByTagName("input")[0];
- yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel);
- if (self.config.minDate) {
- yearElement.setAttribute("min", self.config.minDate.getFullYear().toString());
- }
- if (self.config.maxDate) {
- yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString());
- yearElement.disabled =
- !!self.config.minDate &&
- self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
- }
- var currentMonth = createElement("div", "flatpickr-current-month");
- currentMonth.appendChild(monthElement);
- currentMonth.appendChild(yearInput);
- monthNavFragment.appendChild(currentMonth);
- container.appendChild(monthNavFragment);
- return {
- container: container,
- yearElement: yearElement,
- monthElement: monthElement
- };
- }
- function buildMonths() {
- clearNode(self.monthNav);
- self.monthNav.appendChild(self.prevMonthNav);
- if (self.config.showMonths) {
- self.yearElements = [];
- self.monthElements = [];
- }
- for (var m = self.config.showMonths; m--;) {
- var month = buildMonth();
- self.yearElements.push(month.yearElement);
- self.monthElements.push(month.monthElement);
- self.monthNav.appendChild(month.container);
- }
- self.monthNav.appendChild(self.nextMonthNav);
- }
- function buildMonthNav() {
- self.monthNav = createElement("div", "flatpickr-months");
- self.yearElements = [];
- self.monthElements = [];
- self.prevMonthNav = createElement("span", "flatpickr-prev-month");
- self.prevMonthNav.innerHTML = self.config.prevArrow;
- self.nextMonthNav = createElement("span", "flatpickr-next-month");
- self.nextMonthNav.innerHTML = self.config.nextArrow;
- buildMonths();
- Object.defineProperty(self, "_hidePrevMonthArrow", {
- get: function () { return self.__hidePrevMonthArrow; },
- set: function (bool) {
- if (self.__hidePrevMonthArrow !== bool) {
- toggleClass(self.prevMonthNav, "flatpickr-disabled", bool);
- self.__hidePrevMonthArrow = bool;
- }
- }
- });
- Object.defineProperty(self, "_hideNextMonthArrow", {
- get: function () { return self.__hideNextMonthArrow; },
- set: function (bool) {
- if (self.__hideNextMonthArrow !== bool) {
- toggleClass(self.nextMonthNav, "flatpickr-disabled", bool);
- self.__hideNextMonthArrow = bool;
- }
- }
- });
- self.currentYearElement = self.yearElements[0];
- updateNavigationCurrentMonth();
- return self.monthNav;
- }
- function buildTime() {
- self.calendarContainer.classList.add("hasTime");
- if (self.config.noCalendar)
- self.calendarContainer.classList.add("noCalendar");
- self.timeContainer = createElement("div", "flatpickr-time");
- self.timeContainer.tabIndex = -1;
- var separator = createElement("span", "flatpickr-time-separator", ":");
- var hourInput = createNumberInput("flatpickr-hour", {
- "aria-label": self.l10n.hourAriaLabel
- });
- self.hourElement = hourInput.getElementsByTagName("input")[0];
- var minuteInput = createNumberInput("flatpickr-minute", {
- "aria-label": self.l10n.minuteAriaLabel
- });
- self.minuteElement = minuteInput.getElementsByTagName("input")[0];
- self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
- self.hourElement.value = pad(self.latestSelectedDateObj
- ? self.latestSelectedDateObj.getHours()
- : self.config.time_24hr
- ? self.config.defaultHour
- : military2ampm(self.config.defaultHour));
- self.minuteElement.value = pad(self.latestSelectedDateObj
- ? self.latestSelectedDateObj.getMinutes()
- : self.config.defaultMinute);
- self.hourElement.setAttribute("step", self.config.hourIncrement.toString());
- self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString());
- self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1");
- self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12");
- self.minuteElement.setAttribute("min", "0");
- self.minuteElement.setAttribute("max", "59");
- self.timeContainer.appendChild(hourInput);
- self.timeContainer.appendChild(separator);
- self.timeContainer.appendChild(minuteInput);
- if (self.config.time_24hr)
- self.timeContainer.classList.add("time24hr");
- if (self.config.enableSeconds) {
- self.timeContainer.classList.add("hasSeconds");
- var secondInput = createNumberInput("flatpickr-second");
- self.secondElement = secondInput.getElementsByTagName("input")[0];
- self.secondElement.value = pad(self.latestSelectedDateObj
- ? self.latestSelectedDateObj.getSeconds()
- : self.config.defaultSeconds);
- self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step"));
- self.secondElement.setAttribute("min", "0");
- self.secondElement.setAttribute("max", "59");
- self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":"));
- self.timeContainer.appendChild(secondInput);
- }
- if (!self.config.time_24hr) {
- // add self.amPM if appropriate
- self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj
- ? self.hourElement.value
- : self.config.defaultHour) > 11)]);
- self.amPM.title = self.l10n.toggleTitle;
- self.amPM.tabIndex = -1;
- self.timeContainer.appendChild(self.amPM);
- }
- return self.timeContainer;
- }
- function buildWeekdays() {
- if (!self.weekdayContainer)
- self.weekdayContainer = createElement("div", "flatpickr-weekdays");
- else
- clearNode(self.weekdayContainer);
- for (var i = self.config.showMonths; i--;) {
- var container = createElement("div", "flatpickr-weekdaycontainer");
- self.weekdayContainer.appendChild(container);
- }
- updateWeekdays();
- return self.weekdayContainer;
- }
- function updateWeekdays() {
- if (!self.weekdayContainer) {
- return;
- }
- var firstDayOfWeek = self.l10n.firstDayOfWeek;
- var weekdays = self.l10n.weekdays.shorthand.slice();
- if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
- weekdays = weekdays.splice(firstDayOfWeek, weekdays.length).concat(weekdays.splice(0, firstDayOfWeek));
- }
- for (var i = self.config.showMonths; i--;) {
- self.weekdayContainer.children[i].innerHTML = "\n
\n " + weekdays.join("") + "\n \n ";
- }
- }
- /* istanbul ignore next */
- function buildWeeks() {
- self.calendarContainer.classList.add("hasWeeks");
- var weekWrapper = createElement("div", "flatpickr-weekwrapper");
- weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
- var weekNumbers = createElement("div", "flatpickr-weeks");
- weekWrapper.appendChild(weekNumbers);
- return {
- weekWrapper: weekWrapper,
- weekNumbers: weekNumbers
- };
- }
- function changeMonth(value, isOffset) {
- if (isOffset === void 0) { isOffset = true; }
- var delta = isOffset ? value : value - self.currentMonth;
- if ((delta < 0 && self._hidePrevMonthArrow === true) ||
- (delta > 0 && self._hideNextMonthArrow === true))
- return;
- self.currentMonth += delta;
- if (self.currentMonth < 0 || self.currentMonth > 11) {
- self.currentYear += self.currentMonth > 11 ? 1 : -1;
- self.currentMonth = (self.currentMonth + 12) % 12;
- triggerEvent("onYearChange");
- buildMonthSwitch();
- }
- buildDays();
- triggerEvent("onMonthChange");
- updateNavigationCurrentMonth();
- }
- function clear(triggerChangeEvent, toInitial) {
- if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }
- if (toInitial === void 0) { toInitial = true; }
- self.input.value = "";
- if (self.altInput !== undefined)
- self.altInput.value = "";
- if (self.mobileInput !== undefined)
- self.mobileInput.value = "";
- self.selectedDates = [];
- self.latestSelectedDateObj = undefined;
- if (toInitial === true) {
- self.currentYear = self._initialDate.getFullYear();
- self.currentMonth = self._initialDate.getMonth();
- }
- self.showTimeInput = false;
- if (self.config.enableTime === true) {
- setDefaultHours();
- }
- self.redraw();
- if (triggerChangeEvent)
- // triggerChangeEvent is true (default) or an Event
- triggerEvent("onChange");
- }
- function close() {
- self.isOpen = false;
- if (!self.isMobile) {
- if (self.calendarContainer !== undefined) {
- self.calendarContainer.classList.remove("open");
- }
- if (self._input !== undefined) {
- self._input.classList.remove("active");
- }
- }
- triggerEvent("onClose");
- }
- function destroy() {
- if (self.config !== undefined)
- triggerEvent("onDestroy");
- for (var i = self._handlers.length; i--;) {
- var h = self._handlers[i];
- h.element.removeEventListener(h.event, h.handler, h.options);
- }
- self._handlers = [];
- if (self.mobileInput) {
- if (self.mobileInput.parentNode)
- self.mobileInput.parentNode.removeChild(self.mobileInput);
- self.mobileInput = undefined;
- }
- else if (self.calendarContainer && self.calendarContainer.parentNode) {
- if (self.config.static && self.calendarContainer.parentNode) {
- var wrapper = self.calendarContainer.parentNode;
- wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
- if (wrapper.parentNode) {
- while (wrapper.firstChild)
- wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
- wrapper.parentNode.removeChild(wrapper);
- }
- }
- else
- self.calendarContainer.parentNode.removeChild(self.calendarContainer);
- }
- if (self.altInput) {
- self.input.type = "text";
- if (self.altInput.parentNode)
- self.altInput.parentNode.removeChild(self.altInput);
- delete self.altInput;
- }
- if (self.input) {
- self.input.type = self.input._type;
- self.input.classList.remove("flatpickr-input");
- self.input.removeAttribute("readonly");
- self.input.value = "";
- }
- [
- "_showTimeInput",
- "latestSelectedDateObj",
- "_hideNextMonthArrow",
- "_hidePrevMonthArrow",
- "__hideNextMonthArrow",
- "__hidePrevMonthArrow",
- "isMobile",
- "isOpen",
- "selectedDateElem",
- "minDateHasTime",
- "maxDateHasTime",
- "days",
- "daysContainer",
- "_input",
- "_positionElement",
- "innerContainer",
- "rContainer",
- "monthNav",
- "todayDateElem",
- "calendarContainer",
- "weekdayContainer",
- "prevMonthNav",
- "nextMonthNav",
- "monthsDropdownContainer",
- "currentMonthElement",
- "currentYearElement",
- "navigationCurrentMonth",
- "selectedDateElem",
- "config",
- ].forEach(function (k) {
- try {
- delete self[k];
- }
- catch (_) { }
- });
- }
- function isCalendarElem(elem) {
- if (self.config.appendTo && self.config.appendTo.contains(elem))
- return true;
- return self.calendarContainer.contains(elem);
- }
- function documentClick(e) {
- if (self.isOpen && !self.config.inline) {
- var eventTarget_1 = getEventTarget(e);
- var isCalendarElement = isCalendarElem(eventTarget_1);
- var isInput = eventTarget_1 === self.input ||
- eventTarget_1 === self.altInput ||
- self.element.contains(eventTarget_1) ||
- // web components
- // e.path is not present in all browsers. circumventing typechecks
- (e.path &&
- e.path.indexOf &&
- (~e.path.indexOf(self.input) ||
- ~e.path.indexOf(self.altInput)));
- var lostFocus = e.type === "blur"
- ? isInput &&
- e.relatedTarget &&
- !isCalendarElem(e.relatedTarget)
- : !isInput &&
- !isCalendarElement &&
- !isCalendarElem(e.relatedTarget);
- var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {
- return elem.contains(eventTarget_1);
- });
- if (lostFocus && isIgnored) {
- if (self.timeContainer !== undefined &&
- self.minuteElement !== undefined &&
- self.hourElement !== undefined) {
- updateTime();
- }
- self.close();
- if (self.config.mode === "range" && self.selectedDates.length === 1) {
- self.clear(false);
- self.redraw();
- }
- }
- }
- }
- function changeYear(newYear) {
- if (!newYear ||
- (self.config.minDate && newYear < self.config.minDate.getFullYear()) ||
- (self.config.maxDate && newYear > self.config.maxDate.getFullYear()))
- return;
- var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;
- self.currentYear = newYearNum || self.currentYear;
- if (self.config.maxDate &&
- self.currentYear === self.config.maxDate.getFullYear()) {
- self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);
- }
- else if (self.config.minDate &&
- self.currentYear === self.config.minDate.getFullYear()) {
- self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);
- }
- if (isNewYear) {
- self.redraw();
- triggerEvent("onYearChange");
- buildMonthSwitch();
- }
- }
- function isEnabled(date, timeless) {
- if (timeless === void 0) { timeless = true; }
- var dateToCheck = self.parseDate(date, undefined, timeless); // timeless
- if ((self.config.minDate &&
- dateToCheck &&
- compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||
- (self.config.maxDate &&
- dateToCheck &&
- compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))
- return false;
- if (self.config.enable.length === 0 && self.config.disable.length === 0)
- return true;
- if (dateToCheck === undefined)
- return false;
- var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable;
- for (var i = 0, d = void 0; i < array.length; i++) {
- d = array[i];
- if (typeof d === "function" &&
- d(dateToCheck) // disabled by function
- )
- return bool;
- else if (d instanceof Date &&
- dateToCheck !== undefined &&
- d.getTime() === dateToCheck.getTime())
- // disabled by date
- return bool;
- else if (typeof d === "string" && dateToCheck !== undefined) {
- // disabled by date string
- var parsed = self.parseDate(d, undefined, true);
- return parsed && parsed.getTime() === dateToCheck.getTime()
- ? bool
- : !bool;
- }
- else if (
- // disabled by range
- typeof d === "object" &&
- dateToCheck !== undefined &&
- d.from &&
- d.to &&
- dateToCheck.getTime() >= d.from.getTime() &&
- dateToCheck.getTime() <= d.to.getTime())
- return bool;
- }
- return !bool;
- }
- function isInView(elem) {
- if (self.daysContainer !== undefined)
- return (elem.className.indexOf("hidden") === -1 &&
- self.daysContainer.contains(elem));
- return false;
- }
- function onKeyDown(e) {
- // e.key e.keyCode
- // "Backspace" 8
- // "Tab" 9
- // "Enter" 13
- // "Escape" (IE "Esc") 27
- // "ArrowLeft" (IE "Left") 37
- // "ArrowUp" (IE "Up") 38
- // "ArrowRight" (IE "Right") 39
- // "ArrowDown" (IE "Down") 40
- // "Delete" (IE "Del") 46
- var isInput = e.target === self._input;
- var allowInput = self.config.allowInput;
- var allowKeydown = self.isOpen && (!allowInput || !isInput);
- var allowInlineKeydown = self.config.inline && isInput && !allowInput;
- if (e.keyCode === 13 && isInput) {
- if (allowInput) {
- self.setDate(self._input.value, true, e.target === self.altInput
- ? self.config.altFormat
- : self.config.dateFormat);
- return e.target.blur();
- }
- else {
- self.open();
- }
- }
- else if (isCalendarElem(e.target) ||
- allowKeydown ||
- allowInlineKeydown) {
- var isTimeObj = !!self.timeContainer &&
- self.timeContainer.contains(e.target);
- switch (e.keyCode) {
- case 13:
- if (isTimeObj) {
- e.preventDefault();
- updateTime();
- focusAndClose();
- }
- else
- selectDate(e);
- break;
- case 27: // escape
- e.preventDefault();
- focusAndClose();
- break;
- case 8:
- case 46:
- if (isInput && !self.config.allowInput) {
- e.preventDefault();
- self.clear();
- }
- break;
- case 37:
- case 39:
- if (!isTimeObj && !isInput) {
- e.preventDefault();
- if (self.daysContainer !== undefined &&
- (allowInput === false ||
- (document.activeElement && isInView(document.activeElement)))) {
- var delta_1 = e.keyCode === 39 ? 1 : -1;
- if (!e.ctrlKey)
- focusOnDay(undefined, delta_1);
- else {
- e.stopPropagation();
- changeMonth(delta_1);
- focusOnDay(getFirstAvailableDay(1), 0);
- }
- }
- }
- else if (self.hourElement)
- self.hourElement.focus();
- break;
- case 38:
- case 40:
- e.preventDefault();
- var delta = e.keyCode === 40 ? 1 : -1;
- if ((self.daysContainer && e.target.$i !== undefined) ||
- e.target === self.input ||
- e.target === self.altInput) {
- if (e.ctrlKey) {
- e.stopPropagation();
- changeYear(self.currentYear - delta);
- focusOnDay(getFirstAvailableDay(1), 0);
- }
- else if (!isTimeObj)
- focusOnDay(undefined, delta * 7);
- }
- else if (e.target === self.currentYearElement) {
- changeYear(self.currentYear - delta);
- }
- else if (self.config.enableTime) {
- if (!isTimeObj && self.hourElement)
- self.hourElement.focus();
- updateTime(e);
- self._debouncedChange();
- }
- break;
- case 9:
- if (isTimeObj) {
- var elems = [
- self.hourElement,
- self.minuteElement,
- self.secondElement,
- self.amPM,
- ]
- .concat(self.pluginElements)
- .filter(function (x) { return x; });
- var i = elems.indexOf(e.target);
- if (i !== -1) {
- var target = elems[i + (e.shiftKey ? -1 : 1)];
- e.preventDefault();
- (target || self._input).focus();
- }
- }
- else if (!self.config.noCalendar &&
- self.daysContainer &&
- self.daysContainer.contains(e.target) &&
- e.shiftKey) {
- e.preventDefault();
- self._input.focus();
- }
- break;
- default:
- break;
- }
- }
- if (self.amPM !== undefined && e.target === self.amPM) {
- switch (e.key) {
- case self.l10n.amPM[0].charAt(0):
- case self.l10n.amPM[0].charAt(0).toLowerCase():
- self.amPM.textContent = self.l10n.amPM[0];
- setHoursFromInputs();
- updateValue();
- break;
- case self.l10n.amPM[1].charAt(0):
- case self.l10n.amPM[1].charAt(0).toLowerCase():
- self.amPM.textContent = self.l10n.amPM[1];
- setHoursFromInputs();
- updateValue();
- break;
- }
- }
- if (isInput || isCalendarElem(e.target)) {
- triggerEvent("onKeyDown", e);
- }
- }
- function onMouseOver(elem) {
- if (self.selectedDates.length !== 1 ||
- (elem &&
- (!elem.classList.contains("flatpickr-day") ||
- elem.classList.contains("flatpickr-disabled"))))
- return;
- var hoverDate = elem
- ? elem.dateObj.getTime()
- : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());
- var containsDisabled = false;
- var minRange = 0, maxRange = 0;
- for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {
- if (!isEnabled(new Date(t), true)) {
- containsDisabled =
- containsDisabled || (t > rangeStartDate && t < rangeEndDate);
- if (t < initialDate && (!minRange || t > minRange))
- minRange = t;
- else if (t > initialDate && (!maxRange || t < maxRange))
- maxRange = t;
- }
- }
- for (var m = 0; m < self.config.showMonths; m++) {
- var month = self.daysContainer.children[m];
- var _loop_1 = function (i, l) {
- var dayElem = month.children[i], date = dayElem.dateObj;
- var timestamp = date.getTime();
- var outOfRange = (minRange > 0 && timestamp < minRange) ||
- (maxRange > 0 && timestamp > maxRange);
- if (outOfRange) {
- dayElem.classList.add("notAllowed");
- ["inRange", "startRange", "endRange"].forEach(function (c) {
- dayElem.classList.remove(c);
- });
- return "continue";
- }
- else if (containsDisabled && !outOfRange)
- return "continue";
- ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) {
- dayElem.classList.remove(c);
- });
- if (elem !== undefined) {
- elem.classList.add(hoverDate <= self.selectedDates[0].getTime()
- ? "startRange"
- : "endRange");
- if (initialDate < hoverDate && timestamp === initialDate)
- dayElem.classList.add("startRange");
- else if (initialDate > hoverDate && timestamp === initialDate)
- dayElem.classList.add("endRange");
- if (timestamp >= minRange &&
- (maxRange === 0 || timestamp <= maxRange) &&
- isBetween(timestamp, initialDate, hoverDate))
- dayElem.classList.add("inRange");
- }
- };
- for (var i = 0, l = month.children.length; i < l; i++) {
- _loop_1(i, l);
- }
- }
- }
- function onResize() {
- if (self.isOpen && !self.config.static && !self.config.inline)
- positionCalendar();
- }
- function setDefaultTime() {
- self.setDate(self.config.minDate !== undefined
- ? new Date(self.config.minDate.getTime())
- : new Date(), true);
- setDefaultHours();
- updateValue();
- }
- function open(e, positionElement) {
- if (positionElement === void 0) { positionElement = self._positionElement; }
- if (self.isMobile === true) {
- if (e) {
- e.preventDefault();
- e.target && e.target.blur();
- }
- if (self.mobileInput !== undefined) {
- self.mobileInput.focus();
- self.mobileInput.click();
- }
- triggerEvent("onOpen");
- return;
- }
- if (self._input.disabled || self.config.inline)
- return;
- var wasOpen = self.isOpen;
- self.isOpen = true;
- if (!wasOpen) {
- self.calendarContainer.classList.add("open");
- self._input.classList.add("active");
- triggerEvent("onOpen");
- positionCalendar(positionElement);
- }
- if (self.config.enableTime === true && self.config.noCalendar === true) {
- if (self.selectedDates.length === 0) {
- setDefaultTime();
- }
- if (self.config.allowInput === false &&
- (e === undefined ||
- !self.timeContainer.contains(e.relatedTarget))) {
- setTimeout(function () { return self.hourElement.select(); }, 50);
- }
- }
- }
- function minMaxDateSetter(type) {
- return function (date) {
- var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat));
- var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"];
- if (dateObj !== undefined) {
- self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] =
- dateObj.getHours() > 0 ||
- dateObj.getMinutes() > 0 ||
- dateObj.getSeconds() > 0;
- }
- if (self.selectedDates) {
- self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });
- if (!self.selectedDates.length && type === "min")
- setHoursFromDate(dateObj);
- updateValue();
- }
- if (self.daysContainer) {
- redraw();
- if (dateObj !== undefined)
- self.currentYearElement[type] = dateObj.getFullYear().toString();
- else
- self.currentYearElement.removeAttribute(type);
- self.currentYearElement.disabled =
- !!inverseDateObj &&
- dateObj !== undefined &&
- inverseDateObj.getFullYear() === dateObj.getFullYear();
- }
- };
- }
- function parseConfig() {
- var boolOpts = [
- "wrap",
- "weekNumbers",
- "allowInput",
- "clickOpens",
- "time_24hr",
- "enableTime",
- "noCalendar",
- "altInput",
- "shorthandCurrentMonth",
- "inline",
- "static",
- "enableSeconds",
- "disableMobile",
- ];
- var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));
- var formats = {};
- self.config.parseDate = userConfig.parseDate;
- self.config.formatDate = userConfig.formatDate;
- Object.defineProperty(self.config, "enable", {
- get: function () { return self.config._enable; },
- set: function (dates) {
- self.config._enable = parseDateRules(dates);
- }
- });
- Object.defineProperty(self.config, "disable", {
- get: function () { return self.config._disable; },
- set: function (dates) {
- self.config._disable = parseDateRules(dates);
- }
- });
- var timeMode = userConfig.mode === "time";
- if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {
- var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;
- formats.dateFormat =
- userConfig.noCalendar || timeMode
- ? "H:i" + (userConfig.enableSeconds ? ":S" : "")
- : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : "");
- }
- if (userConfig.altInput &&
- (userConfig.enableTime || timeMode) &&
- !userConfig.altFormat) {
- var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;
- formats.altFormat =
- userConfig.noCalendar || timeMode
- ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K")
- : defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K");
- }
- if (!userConfig.altInputClass) {
- self.config.altInputClass =
- self.input.className + " " + self.config.altInputClass;
- }
- Object.defineProperty(self.config, "minDate", {
- get: function () { return self.config._minDate; },
- set: minMaxDateSetter("min")
- });
- Object.defineProperty(self.config, "maxDate", {
- get: function () { return self.config._maxDate; },
- set: minMaxDateSetter("max")
- });
- var minMaxTimeSetter = function (type) { return function (val) {
- self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S");
- }; };
- Object.defineProperty(self.config, "minTime", {
- get: function () { return self.config._minTime; },
- set: minMaxTimeSetter("min")
- });
- Object.defineProperty(self.config, "maxTime", {
- get: function () { return self.config._maxTime; },
- set: minMaxTimeSetter("max")
- });
- if (userConfig.mode === "time") {
- self.config.noCalendar = true;
- self.config.enableTime = true;
- }
- Object.assign(self.config, formats, userConfig);
- for (var i = 0; i < boolOpts.length; i++)
- self.config[boolOpts[i]] =
- self.config[boolOpts[i]] === true ||
- self.config[boolOpts[i]] === "true";
- HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {
- self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);
- });
- self.isMobile =
- !self.config.disableMobile &&
- !self.config.inline &&
- self.config.mode === "single" &&
- !self.config.disable.length &&
- !self.config.enable.length &&
- !self.config.weekNumbers &&
- /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
- for (var i = 0; i < self.config.plugins.length; i++) {
- var pluginConf = self.config.plugins[i](self) || {};
- for (var key in pluginConf) {
- if (HOOKS.indexOf(key) > -1) {
- self.config[key] = arrayify(pluginConf[key])
- .map(bindToInstance)
- .concat(self.config[key]);
- }
- else if (typeof userConfig[key] === "undefined")
- self.config[key] = pluginConf[key];
- }
- }
- triggerEvent("onParseConfig");
- }
- function setupLocale() {
- if (typeof self.config.locale !== "object" &&
- typeof flatpickr.l10ns[self.config.locale] === "undefined")
- self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale));
- self.l10n = __assign({}, flatpickr.l10ns["default"], (typeof self.config.locale === "object"
- ? self.config.locale
- : self.config.locale !== "default"
- ? flatpickr.l10ns[self.config.locale]
- : undefined));
- tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")";
- var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));
- if (userConfig.time_24hr === undefined &&
- flatpickr.defaultConfig.time_24hr === undefined) {
- self.config.time_24hr = self.l10n.time_24hr;
- }
- self.formatDate = createDateFormatter(self);
- self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
- }
- function positionCalendar(customPositionElement) {
- if (self.calendarContainer === undefined)
- return;
- triggerEvent("onPreCalendarPosition");
- var positionElement = customPositionElement || self._positionElement;
- var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" ||
- (configPosVertical !== "below" &&
- distanceFromBottom < calendarHeight &&
- inputBounds.top > calendarHeight);
- var top = window.pageYOffset +
- inputBounds.top +
- (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
- toggleClass(self.calendarContainer, "arrowTop", !showOnTop);
- toggleClass(self.calendarContainer, "arrowBottom", showOnTop);
- if (self.config.inline)
- return;
- var left = window.pageXOffset +
- inputBounds.left -
- (configPosHorizontal != null && configPosHorizontal === "center"
- ? (calendarWidth - inputBounds.width) / 2
- : 0);
- var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right);
- var rightMost = left + calendarWidth > window.document.body.offsetWidth;
- var centerMost = right + calendarWidth > window.document.body.offsetWidth;
- toggleClass(self.calendarContainer, "rightMost", rightMost);
- if (self.config.static)
- return;
- self.calendarContainer.style.top = top + "px";
- if (!rightMost) {
- self.calendarContainer.style.left = left + "px";
- self.calendarContainer.style.right = "auto";
- }
- else if (!centerMost) {
- self.calendarContainer.style.left = "auto";
- self.calendarContainer.style.right = right + "px";
- }
- else {
- var doc = document.styleSheets[0];
- // some testing environments don't have css support
- if (doc === undefined)
- return;
- var bodyWidth = window.document.body.offsetWidth;
- var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);
- var centerBefore = ".flatpickr-calendar.centerMost:before";
- var centerAfter = ".flatpickr-calendar.centerMost:after";
- var centerIndex = doc.cssRules.length;
- var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}";
- toggleClass(self.calendarContainer, "rightMost", false);
- toggleClass(self.calendarContainer, "centerMost", true);
- doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex);
- self.calendarContainer.style.left = centerLeft + "px";
- self.calendarContainer.style.right = "auto";
- }
- }
- function redraw() {
- if (self.config.noCalendar || self.isMobile)
- return;
- updateNavigationCurrentMonth();
- buildDays();
- }
- function focusAndClose() {
- self._input.focus();
- if (window.navigator.userAgent.indexOf("MSIE") !== -1 ||
- navigator.msMaxTouchPoints !== undefined) {
- // hack - bugs in the way IE handles focus keeps the calendar open
- setTimeout(self.close, 0);
- }
- else {
- self.close();
- }
- }
- function selectDate(e) {
- e.preventDefault();
- e.stopPropagation();
- var isSelectable = function (day) {
- return day.classList &&
- day.classList.contains("flatpickr-day") &&
- !day.classList.contains("flatpickr-disabled") &&
- !day.classList.contains("notAllowed");
- };
- var t = findParent(e.target, isSelectable);
- if (t === undefined)
- return;
- var target = t;
- var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));
- var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||
- selectedDate.getMonth() >
- self.currentMonth + self.config.showMonths - 1) &&
- self.config.mode !== "range";
- self.selectedDateElem = target;
- if (self.config.mode === "single")
- self.selectedDates = [selectedDate];
- else if (self.config.mode === "multiple") {
- var selectedIndex = isDateSelected(selectedDate);
- if (selectedIndex)
- self.selectedDates.splice(parseInt(selectedIndex), 1);
- else
- self.selectedDates.push(selectedDate);
- }
- else if (self.config.mode === "range") {
- if (self.selectedDates.length === 2) {
- self.clear(false, false);
- }
- self.latestSelectedDateObj = selectedDate;
- self.selectedDates.push(selectedDate);
- // unless selecting same date twice, sort ascendingly
- if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)
- self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
- }
- setHoursFromInputs();
- if (shouldChangeMonth) {
- var isNewYear = self.currentYear !== selectedDate.getFullYear();
- self.currentYear = selectedDate.getFullYear();
- self.currentMonth = selectedDate.getMonth();
- if (isNewYear) {
- triggerEvent("onYearChange");
- buildMonthSwitch();
- }
- triggerEvent("onMonthChange");
- }
- updateNavigationCurrentMonth();
- buildDays();
- updateValue();
- if (self.config.enableTime)
- setTimeout(function () { return (self.showTimeInput = true); }, 50);
- // maintain focus
- if (!shouldChangeMonth &&
- self.config.mode !== "range" &&
- self.config.showMonths === 1)
- focusOnDayElem(target);
- else if (self.selectedDateElem !== undefined &&
- self.hourElement === undefined) {
- self.selectedDateElem && self.selectedDateElem.focus();
- }
- if (self.hourElement !== undefined)
- self.hourElement !== undefined && self.hourElement.focus();
- if (self.config.closeOnSelect) {
- var single = self.config.mode === "single" && !self.config.enableTime;
- var range = self.config.mode === "range" &&
- self.selectedDates.length === 2 &&
- !self.config.enableTime;
- if (single || range) {
- focusAndClose();
- }
- }
- triggerChange();
- }
- var CALLBACKS = {
- locale: [setupLocale, updateWeekdays],
- showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
- minDate: [jumpToDate],
- maxDate: [jumpToDate]
- };
- function set(option, value) {
- if (option !== null && typeof option === "object") {
- Object.assign(self.config, option);
- for (var key in option) {
- if (CALLBACKS[key] !== undefined)
- CALLBACKS[key].forEach(function (x) { return x(); });
- }
- }
- else {
- self.config[option] = value;
- if (CALLBACKS[option] !== undefined)
- CALLBACKS[option].forEach(function (x) { return x(); });
- else if (HOOKS.indexOf(option) > -1)
- self.config[option] = arrayify(value);
- }
- self.redraw();
- updateValue(false);
- }
- function setSelectedDate(inputDate, format) {
- var dates = [];
- if (inputDate instanceof Array)
- dates = inputDate.map(function (d) { return self.parseDate(d, format); });
- else if (inputDate instanceof Date || typeof inputDate === "number")
- dates = [self.parseDate(inputDate, format)];
- else if (typeof inputDate === "string") {
- switch (self.config.mode) {
- case "single":
- case "time":
- dates = [self.parseDate(inputDate, format)];
- break;
- case "multiple":
- dates = inputDate
- .split(self.config.conjunction)
- .map(function (date) { return self.parseDate(date, format); });
- break;
- case "range":
- dates = inputDate
- .split(self.l10n.rangeSeparator)
- .map(function (date) { return self.parseDate(date, format); });
- break;
- default:
- break;
- }
- }
- else
- self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate)));
- self.selectedDates = dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); });
- if (self.config.mode === "range")
- self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
- }
- function setDate(date, triggerChange, format) {
- if (triggerChange === void 0) { triggerChange = false; }
- if (format === void 0) { format = self.config.dateFormat; }
- if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))
- return self.clear(triggerChange);
- setSelectedDate(date, format);
- self.showTimeInput = self.selectedDates.length > 0;
- self.latestSelectedDateObj =
- self.selectedDates[self.selectedDates.length - 1];
- self.redraw();
- jumpToDate();
- setHoursFromDate();
- if (self.selectedDates.length === 0) {
- self.clear(false);
- }
- updateValue(triggerChange);
- if (triggerChange)
- triggerEvent("onChange");
- }
- function parseDateRules(arr) {
- return arr
- .slice()
- .map(function (rule) {
- if (typeof rule === "string" ||
- typeof rule === "number" ||
- rule instanceof Date) {
- return self.parseDate(rule, undefined, true);
- }
- else if (rule &&
- typeof rule === "object" &&
- rule.from &&
- rule.to)
- return {
- from: self.parseDate(rule.from, undefined),
- to: self.parseDate(rule.to, undefined)
- };
- return rule;
- })
- .filter(function (x) { return x; }); // remove falsy values
- }
- function setupDates() {
- self.selectedDates = [];
- self.now = self.parseDate(self.config.now) || new Date();
- // Workaround IE11 setting placeholder as the input's value
- var preloadedDate = self.config.defaultDate ||
- ((self.input.nodeName === "INPUT" ||
- self.input.nodeName === "TEXTAREA") &&
- self.input.placeholder &&
- self.input.value === self.input.placeholder
- ? null
- : self.input.value);
- if (preloadedDate)
- setSelectedDate(preloadedDate, self.config.dateFormat);
- self._initialDate =
- self.selectedDates.length > 0
- ? self.selectedDates[0]
- : self.config.minDate &&
- self.config.minDate.getTime() > self.now.getTime()
- ? self.config.minDate
- : self.config.maxDate &&
- self.config.maxDate.getTime() < self.now.getTime()
- ? self.config.maxDate
- : self.now;
- self.currentYear = self._initialDate.getFullYear();
- self.currentMonth = self._initialDate.getMonth();
- if (self.selectedDates.length > 0)
- self.latestSelectedDateObj = self.selectedDates[0];
- if (self.config.minTime !== undefined)
- self.config.minTime = self.parseDate(self.config.minTime, "H:i");
- if (self.config.maxTime !== undefined)
- self.config.maxTime = self.parseDate(self.config.maxTime, "H:i");
- self.minDateHasTime =
- !!self.config.minDate &&
- (self.config.minDate.getHours() > 0 ||
- self.config.minDate.getMinutes() > 0 ||
- self.config.minDate.getSeconds() > 0);
- self.maxDateHasTime =
- !!self.config.maxDate &&
- (self.config.maxDate.getHours() > 0 ||
- self.config.maxDate.getMinutes() > 0 ||
- self.config.maxDate.getSeconds() > 0);
- Object.defineProperty(self, "showTimeInput", {
- get: function () { return self._showTimeInput; },
- set: function (bool) {
- self._showTimeInput = bool;
- if (self.calendarContainer)
- toggleClass(self.calendarContainer, "showTimeInput", bool);
- self.isOpen && positionCalendar();
- }
- });
- }
- function setupInputs() {
- self.input = self.config.wrap
- ? element.querySelector("[data-input]")
- : element;
- /* istanbul ignore next */
- if (!self.input) {
- self.config.errorHandler(new Error("Invalid input element specified"));
- return;
- }
- // hack: store previous type to restore it after destroy()
- self.input._type = self.input.type;
- self.input.type = "text";
- self.input.classList.add("flatpickr-input");
- self._input = self.input;
- if (self.config.altInput) {
- // replicate self.element
- self.altInput = createElement(self.input.nodeName, self.config.altInputClass);
- self._input = self.altInput;
- self.altInput.placeholder = self.input.placeholder;
- self.altInput.disabled = self.input.disabled;
- self.altInput.required = self.input.required;
- self.altInput.tabIndex = self.input.tabIndex;
- self.altInput.type = "text";
- self.input.setAttribute("type", "hidden");
- if (!self.config.static && self.input.parentNode)
- self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);
- }
- if (!self.config.allowInput)
- self._input.setAttribute("readonly", "readonly");
- self._positionElement = self.config.positionElement || self._input;
- }
- function setupMobile() {
- var inputType = self.config.enableTime
- ? self.config.noCalendar
- ? "time"
- : "datetime-local"
- : "date";
- self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
- self.mobileInput.step = self.input.getAttribute("step") || "any";
- self.mobileInput.tabIndex = 1;
- self.mobileInput.type = inputType;
- self.mobileInput.disabled = self.input.disabled;
- self.mobileInput.required = self.input.required;
- self.mobileInput.placeholder = self.input.placeholder;
- self.mobileFormatStr =
- inputType === "datetime-local"
- ? "Y-m-d\\TH:i:S"
- : inputType === "date"
- ? "Y-m-d"
- : "H:i:S";
- if (self.selectedDates.length > 0) {
- self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);
- }
- if (self.config.minDate)
- self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d");
- if (self.config.maxDate)
- self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d");
- self.input.type = "hidden";
- if (self.altInput !== undefined)
- self.altInput.type = "hidden";
- try {
- if (self.input.parentNode)
- self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
- }
- catch (_a) { }
- bind(self.mobileInput, "change", function (e) {
- self.setDate(e.target.value, false, self.mobileFormatStr);
- triggerEvent("onChange");
- triggerEvent("onClose");
- });
- }
- function toggle(e) {
- if (self.isOpen === true)
- return self.close();
- self.open(e);
- }
- function triggerEvent(event, data) {
- // If the instance has been destroyed already, all hooks have been removed
- if (self.config === undefined)
- return;
- var hooks = self.config[event];
- if (hooks !== undefined && hooks.length > 0) {
- for (var i = 0; hooks[i] && i < hooks.length; i++)
- hooks[i](self.selectedDates, self.input.value, self, data);
- }
- if (event === "onChange") {
- self.input.dispatchEvent(createEvent("change"));
- // many front-end frameworks bind to the input event
- self.input.dispatchEvent(createEvent("input"));
- }
- }
- function createEvent(name) {
- var e = document.createEvent("Event");
- e.initEvent(name, true, true);
- return e;
- }
- function isDateSelected(date) {
- for (var i = 0; i < self.selectedDates.length; i++) {
- if (compareDates(self.selectedDates[i], date) === 0)
- return "" + i;
- }
- return false;
- }
- function isDateInRange(date) {
- if (self.config.mode !== "range" || self.selectedDates.length < 2)
- return false;
- return (compareDates(date, self.selectedDates[0]) >= 0 &&
- compareDates(date, self.selectedDates[1]) <= 0);
- }
- function updateNavigationCurrentMonth() {
- if (self.config.noCalendar || self.isMobile || !self.monthNav)
- return;
- self.yearElements.forEach(function (yearElement, i) {
- var d = new Date(self.currentYear, self.currentMonth, 1);
- d.setMonth(self.currentMonth + i);
- if (self.config.showMonths > 1 ||
- self.config.monthSelectorType === "static") {
- self.monthElements[i].textContent =
- monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " ";
- }
- else {
- self.monthsDropdownContainer.value = d.getMonth().toString();
- }
- yearElement.value = d.getFullYear().toString();
- });
- self._hidePrevMonthArrow =
- self.config.minDate !== undefined &&
- (self.currentYear === self.config.minDate.getFullYear()
- ? self.currentMonth <= self.config.minDate.getMonth()
- : self.currentYear < self.config.minDate.getFullYear());
- self._hideNextMonthArrow =
- self.config.maxDate !== undefined &&
- (self.currentYear === self.config.maxDate.getFullYear()
- ? self.currentMonth + 1 > self.config.maxDate.getMonth()
- : self.currentYear > self.config.maxDate.getFullYear());
- }
- function getDateStr(format) {
- return self.selectedDates
- .map(function (dObj) { return self.formatDate(dObj, format); })
- .filter(function (d, i, arr) {
- return self.config.mode !== "range" ||
- self.config.enableTime ||
- arr.indexOf(d) === i;
- })
- .join(self.config.mode !== "range"
- ? self.config.conjunction
- : self.l10n.rangeSeparator);
- }
- /**
- * Updates the values of inputs associated with the calendar
- */
- function updateValue(triggerChange) {
- if (triggerChange === void 0) { triggerChange = true; }
- if (self.mobileInput !== undefined && self.mobileFormatStr) {
- self.mobileInput.value =
- self.latestSelectedDateObj !== undefined
- ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)
- : "";
- }
- self.input.value = getDateStr(self.config.dateFormat);
- if (self.altInput !== undefined) {
- self.altInput.value = getDateStr(self.config.altFormat);
- }
- if (triggerChange !== false)
- triggerEvent("onValueUpdate");
- }
- function onMonthNavClick(e) {
- var isPrevMonth = self.prevMonthNav.contains(e.target);
- var isNextMonth = self.nextMonthNav.contains(e.target);
- if (isPrevMonth || isNextMonth) {
- changeMonth(isPrevMonth ? -1 : 1);
- }
- else if (self.yearElements.indexOf(e.target) >= 0) {
- e.target.select();
- }
- else if (e.target.classList.contains("arrowUp")) {
- self.changeYear(self.currentYear + 1);
- }
- else if (e.target.classList.contains("arrowDown")) {
- self.changeYear(self.currentYear - 1);
- }
- }
- function timeWrapper(e) {
- e.preventDefault();
- var isKeyDown = e.type === "keydown", input = e.target;
- if (self.amPM !== undefined && e.target === self.amPM) {
- self.amPM.textContent =
- self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
- }
- var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta ||
- (isKeyDown ? (e.which === 38 ? 1 : -1) : 0);
- var newValue = curValue + step * delta;
- if (typeof input.value !== "undefined" && input.value.length === 2) {
- var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;
- if (newValue < min) {
- newValue =
- max +
- newValue +
- int(!isHourElem) +
- (int(isHourElem) && int(!self.amPM));
- if (isMinuteElem)
- incrementNumInput(undefined, -1, self.hourElement);
- }
- else if (newValue > max) {
- newValue =
- input === self.hourElement ? newValue - max - int(!self.amPM) : min;
- if (isMinuteElem)
- incrementNumInput(undefined, 1, self.hourElement);
- }
- if (self.amPM &&
- isHourElem &&
- (step === 1
- ? newValue + curValue === 23
- : Math.abs(newValue - curValue) > step)) {
- self.amPM.textContent =
- self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
- }
- input.value = pad(newValue);
- }
- }
- init();
- return self;
- }
- /* istanbul ignore next */
- function _flatpickr(nodeList, config) {
- // static list
- var nodes = Array.prototype.slice
- .call(nodeList)
- .filter(function (x) { return x instanceof HTMLElement; });
- var instances = [];
- for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- try {
- if (node.getAttribute("data-fp-omit") !== null)
- continue;
- if (node._flatpickr !== undefined) {
- node._flatpickr.destroy();
- node._flatpickr = undefined;
- }
- node._flatpickr = FlatpickrInstance(node, config || {});
- instances.push(node._flatpickr);
- }
- catch (e) {
- console.error(e);
- }
- }
- return instances.length === 1 ? instances[0] : instances;
- }
- /* istanbul ignore next */
- if (typeof HTMLElement !== "undefined" &&
- typeof HTMLCollection !== "undefined" &&
- typeof NodeList !== "undefined") {
- // browser env
- HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
- return _flatpickr(this, config);
- };
- HTMLElement.prototype.flatpickr = function (config) {
- return _flatpickr([this], config);
- };
- }
- /* istanbul ignore next */
- var flatpickr = function (selector, config) {
- if (typeof selector === "string") {
- return _flatpickr(window.document.querySelectorAll(selector), config);
- }
- else if (selector instanceof Node) {
- return _flatpickr([selector], config);
- }
- else {
- return _flatpickr(selector, config);
- }
- };
- /* istanbul ignore next */
- flatpickr.defaultConfig = {};
- flatpickr.l10ns = {
- en: __assign({}, english),
- "default": __assign({}, english)
- };
- flatpickr.localize = function (l10n) {
- flatpickr.l10ns["default"] = __assign({}, flatpickr.l10ns["default"], l10n);
- };
- flatpickr.setDefaults = function (config) {
- flatpickr.defaultConfig = __assign({}, flatpickr.defaultConfig, config);
- };
- flatpickr.parseDate = createDateParser({});
- flatpickr.formatDate = createDateFormatter({});
- flatpickr.compareDates = compareDates;
- /* istanbul ignore next */
- if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") {
- jQuery.fn.flatpickr = function (config) {
- return _flatpickr(this, config);
- };
- }
- // eslint-disable-next-line @typescript-eslint/camelcase
- Date.prototype.fp_incr = function (days) {
- return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days));
- };
- if (typeof window !== "undefined") {
- window.flatpickr = flatpickr;
- }
-
- return flatpickr;
-
-}));
-
-
-/***/ }),
-
-/***/ "../../node_modules/jquery/dist/jquery.js":
-/*!*********************************************************************************!*\
- !*** C:/xampp7.3/htdocs/GitHub/AkauntingGit/node_modules/jquery/dist/jquery.js ***!
- \*********************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- * jQuery JavaScript Library v3.4.1
- * https://jquery.com/
- *
- * Includes Sizzle.js
- * https://sizzlejs.com/
- *
- * Copyright JS Foundation and other contributors
- * Released under the MIT license
- * https://jquery.org/license
- *
- * Date: 2019-05-01T21:04Z
- */
-( function( global, factory ) {
-
- "use strict";
-
- if ( true && typeof module.exports === "object" ) {
-
- // For CommonJS and CommonJS-like environments where a proper `window`
- // is present, execute the factory and get jQuery.
- // For environments that do not have a `window` with a `document`
- // (such as Node.js), expose a factory as module.exports.
- // This accentuates the need for the creation of a real `window`.
- // e.g. var jQuery = require("jquery")(window);
- // See ticket #14549 for more info.
- module.exports = global.document ?
- factory( global, true ) :
- function( w ) {
- if ( !w.document ) {
- throw new Error( "jQuery requires a window with a document" );
- }
- return factory( w );
- };
- } else {
- factory( global );
- }
-
-// Pass this if window is not defined yet
-} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
-
-// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
-// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
-// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
-// enough that all such attempts are guarded in a try block.
-"use strict";
-
-var arr = [];
-
-var document = window.document;
-
-var getProto = Object.getPrototypeOf;
-
-var slice = arr.slice;
-
-var concat = arr.concat;
-
-var push = arr.push;
-
-var indexOf = arr.indexOf;
-
-var class2type = {};
-
-var toString = class2type.toString;
-
-var hasOwn = class2type.hasOwnProperty;
-
-var fnToString = hasOwn.toString;
-
-var ObjectFunctionString = fnToString.call( Object );
-
-var support = {};
-
-var isFunction = function isFunction( obj ) {
-
- // Support: Chrome <=57, Firefox <=52
- // In some browsers, typeof returns "function" for HTML