Theme Assets
This commit is contained in:
143
assets/vendor/flatpickr/esm/utils/dates.js
vendored
Normal file
143
assets/vendor/flatpickr/esm/utils/dates.js
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
import { tokenRegex, revFormat, formats, } from "./formatting";
|
||||
import { defaults } from "../types/options";
|
||||
import { english } from "../l10n/default";
|
||||
export var createDateFormatter = function (_a) {
|
||||
var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;
|
||||
return function (dateObj, frmt, overrideLocale) {
|
||||
var locale = overrideLocale || l10n;
|
||||
if (config.formatDate !== undefined && !isMobile) {
|
||||
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("");
|
||||
};
|
||||
};
|
||||
export 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)
|
||||
parsedDate = new Date(date);
|
||||
else if (typeof date === "string") {
|
||||
var format = givenFormat || (config || defaults).dateFormat;
|
||||
var datestr = String(date).trim();
|
||||
if (datestr === "today") {
|
||||
parsedDate = new Date();
|
||||
timeless = true;
|
||||
}
|
||||
else if (config && config.parseDate) {
|
||||
parsedDate = config.parseDate(date, format);
|
||||
}
|
||||
else if (/Z$/.test(datestr) ||
|
||||
/GMT$/.test(datestr)) {
|
||||
parsedDate = new Date(date);
|
||||
}
|
||||
else {
|
||||
var matched = void 0, ops = [];
|
||||
for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
|
||||
var token = format[i];
|
||||
var isBackSlash = token === "\\";
|
||||
var escaped = format[i - 1] === "\\" || isBackSlash;
|
||||
if (tokenRegex[token] && !escaped) {
|
||||
regexStr += tokenRegex[token];
|
||||
var match = new RegExp(regexStr).exec(date);
|
||||
if (match && (matched = true)) {
|
||||
ops[token !== "Y" ? "push" : "unshift"]({
|
||||
fn: revFormat[token],
|
||||
val: match[++matchIndex],
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (!isBackSlash)
|
||||
regexStr += ".";
|
||||
}
|
||||
parsedDate =
|
||||
!config || !config.noCalendar
|
||||
? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
|
||||
: new Date(new Date().setHours(0, 0, 0, 0));
|
||||
ops.forEach(function (_a) {
|
||||
var fn = _a.fn, val = _a.val;
|
||||
return (parsedDate = fn(parsedDate, val, locale) || parsedDate);
|
||||
});
|
||||
parsedDate = matched ? parsedDate : undefined;
|
||||
}
|
||||
}
|
||||
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;
|
||||
};
|
||||
};
|
||||
export 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();
|
||||
}
|
||||
export function compareTimes(date1, date2) {
|
||||
return (3600 * (date1.getHours() - date2.getHours()) +
|
||||
60 * (date1.getMinutes() - date2.getMinutes()) +
|
||||
date1.getSeconds() -
|
||||
date2.getSeconds());
|
||||
}
|
||||
export var isBetween = function (ts, ts1, ts2) {
|
||||
return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
|
||||
};
|
||||
export var calculateSecondsSinceMidnight = function (hours, minutes, seconds) {
|
||||
return hours * 3600 + minutes * 60 + seconds;
|
||||
};
|
||||
export var parseSeconds = function (secondsSinceMidnight) {
|
||||
var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60;
|
||||
return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60];
|
||||
};
|
||||
export var duration = {
|
||||
DAY: 86400000,
|
||||
};
|
||||
export function getDefaultHours(config) {
|
||||
var hours = config.defaultHour;
|
||||
var minutes = config.defaultMinute;
|
||||
var seconds = config.defaultSeconds;
|
||||
if (config.minDate !== undefined) {
|
||||
var minHour = config.minDate.getHours();
|
||||
var minMinutes = config.minDate.getMinutes();
|
||||
var minSeconds = config.minDate.getSeconds();
|
||||
if (hours < minHour) {
|
||||
hours = minHour;
|
||||
}
|
||||
if (hours === minHour && minutes < minMinutes) {
|
||||
minutes = minMinutes;
|
||||
}
|
||||
if (hours === minHour && minutes === minMinutes && seconds < minSeconds)
|
||||
seconds = config.minDate.getSeconds();
|
||||
}
|
||||
if (config.maxDate !== undefined) {
|
||||
var maxHr = config.maxDate.getHours();
|
||||
var maxMinutes = config.maxDate.getMinutes();
|
||||
hours = Math.min(hours, maxHr);
|
||||
if (hours === maxHr)
|
||||
minutes = Math.min(maxMinutes, minutes);
|
||||
if (hours === maxHr && minutes === maxMinutes)
|
||||
seconds = config.maxDate.getSeconds();
|
||||
}
|
||||
return { hours: hours, minutes: minutes, seconds: seconds };
|
||||
}
|
||||
54
assets/vendor/flatpickr/esm/utils/dom.js
vendored
Normal file
54
assets/vendor/flatpickr/esm/utils/dom.js
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
export function toggleClass(elem, className, bool) {
|
||||
if (bool === true)
|
||||
return elem.classList.add(className);
|
||||
elem.classList.remove(className);
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export function clearNode(node) {
|
||||
while (node.firstChild)
|
||||
node.removeChild(node.firstChild);
|
||||
}
|
||||
export function findParent(node, condition) {
|
||||
if (condition(node))
|
||||
return node;
|
||||
else if (node.parentNode)
|
||||
return findParent(node.parentNode, condition);
|
||||
return undefined;
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export function getEventTarget(event) {
|
||||
try {
|
||||
if (typeof event.composedPath === "function") {
|
||||
var path = event.composedPath();
|
||||
return path[0];
|
||||
}
|
||||
return event.target;
|
||||
}
|
||||
catch (error) {
|
||||
return event.target;
|
||||
}
|
||||
}
|
||||
134
assets/vendor/flatpickr/esm/utils/formatting.js
vendored
Normal file
134
assets/vendor/flatpickr/esm/utils/formatting.js
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
import { int, pad } from "../utils";
|
||||
var doNothing = function () { return undefined; };
|
||||
export var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
|
||||
export var revFormat = {
|
||||
D: doNothing,
|
||||
F: function (dateObj, monthName, locale) {
|
||||
dateObj.setMonth(locale.months.longhand.indexOf(monthName));
|
||||
},
|
||||
G: function (dateObj, hour) {
|
||||
dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + 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((dateObj.getHours() >= 12 ? 12 : 0) + 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));
|
||||
},
|
||||
};
|
||||
export var tokenRegex = {
|
||||
D: "",
|
||||
F: "",
|
||||
G: "(\\d\\d|\\d)",
|
||||
H: "(\\d\\d|\\d)",
|
||||
J: "(\\d\\d|\\d)\\w+",
|
||||
K: "",
|
||||
M: "",
|
||||
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: "",
|
||||
m: "(\\d\\d|\\d)",
|
||||
n: "(\\d\\d|\\d)",
|
||||
s: "(\\d\\d|\\d)",
|
||||
u: "(.+)",
|
||||
w: "(\\d\\d|\\d)",
|
||||
y: "(\\d{2})",
|
||||
};
|
||||
export var formats = {
|
||||
Z: function (date) { return date.toISOString(); },
|
||||
D: function (date, locale, options) {
|
||||
return locale.weekdays.shorthand[formats.w(date, locale, options)];
|
||||
},
|
||||
F: function (date, locale, options) {
|
||||
return monthToStr(formats.n(date, locale, options) - 1, false, locale);
|
||||
},
|
||||
G: function (date, locale, options) {
|
||||
return pad(formats.h(date, locale, options));
|
||||
},
|
||||
H: function (date) { return pad(date.getHours()); },
|
||||
J: function (date, locale) {
|
||||
return locale.ordinal !== undefined
|
||||
? date.getDate() + locale.ordinal(date.getDate())
|
||||
: date.getDate();
|
||||
},
|
||||
K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },
|
||||
M: function (date, locale) {
|
||||
return monthToStr(date.getMonth(), true, locale);
|
||||
},
|
||||
S: function (date) { return pad(date.getSeconds()); },
|
||||
U: function (date) { return date.getTime() / 1000; },
|
||||
W: function (date, _, options) {
|
||||
return options.getWeek(date);
|
||||
},
|
||||
Y: function (date) { return pad(date.getFullYear(), 4); },
|
||||
d: function (date) { return pad(date.getDate()); },
|
||||
h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },
|
||||
i: function (date) { return pad(date.getMinutes()); },
|
||||
j: function (date) { return date.getDate(); },
|
||||
l: function (date, locale) {
|
||||
return locale.weekdays.longhand[date.getDay()];
|
||||
},
|
||||
m: function (date) { return pad(date.getMonth() + 1); },
|
||||
n: function (date) { return date.getMonth() + 1; },
|
||||
s: function (date) { return date.getSeconds(); },
|
||||
u: function (date) { return date.getTime(); },
|
||||
w: function (date) { return date.getDay(); },
|
||||
y: function (date) { return String(date.getFullYear()).substring(2); },
|
||||
};
|
||||
17
assets/vendor/flatpickr/esm/utils/index.js
vendored
Normal file
17
assets/vendor/flatpickr/esm/utils/index.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export var pad = function (number, length) {
|
||||
if (length === void 0) { length = 2; }
|
||||
return ("000" + number).slice(length * -1);
|
||||
};
|
||||
export var int = function (bool) { return (bool === true ? 1 : 0); };
|
||||
export function debounce(fn, wait) {
|
||||
var t;
|
||||
return function () {
|
||||
var _this = this;
|
||||
var args = arguments;
|
||||
clearTimeout(t);
|
||||
t = setTimeout(function () { return fn.apply(_this, args); }, wait);
|
||||
};
|
||||
}
|
||||
export var arrayify = function (obj) {
|
||||
return obj instanceof Array ? obj : [obj];
|
||||
};
|
||||
22
assets/vendor/flatpickr/esm/utils/polyfills.js
vendored
Normal file
22
assets/vendor/flatpickr/esm/utils/polyfills.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user