Theme Assets

This commit is contained in:
2025-11-20 23:10:06 -06:00
parent c6c900464c
commit 26b49edfb4
3151 changed files with 629141 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
.flatpickr-confirm {
height: 40px;
max-height: 0px;
visibility: hidden;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
background: rgba(0,0,0,0.06)
}
.flatpickr-confirm svg path {
fill: inherit;
}
.flatpickr-confirm.darkTheme {
color: white;
fill: white;
}
.flatpickr-confirm.visible {
max-height: 40px;
visibility: visible
}

View File

@@ -0,0 +1,104 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.confirmDatePlugin = factory());
}(this, (function () { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function getEventTarget(event) {
try {
if (typeof event.composedPath === "function") {
var path = event.composedPath();
return path[0];
}
return event.target;
}
catch (error) {
return event.target;
}
}
var defaultConfig = {
confirmIcon: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='17' height='17' viewBox='0 0 17 17'> <g> </g> <path d='M15.418 1.774l-8.833 13.485-4.918-4.386 0.666-0.746 4.051 3.614 8.198-12.515 0.836 0.548z' fill='#000000' /> </svg>",
confirmText: "OK ",
showAlways: false,
theme: "light",
};
function confirmDatePlugin(pluginConfig) {
var config = __assign(__assign({}, defaultConfig), pluginConfig);
var confirmContainer;
var confirmButtonCSSClass = "flatpickr-confirm";
return function (fp) {
if (fp.config.noCalendar || fp.isMobile)
return {};
return __assign({ onKeyDown: function (_, __, ___, e) {
var eventTarget = getEventTarget(e);
var isTargetLastFocusableElement = (!fp.config.time_24hr && eventTarget === fp.amPM) ||
(fp.config.time_24hr &&
((fp.config.enableSeconds && eventTarget === fp.secondElement) ||
(!fp.config.enableSeconds && eventTarget === fp.minuteElement)));
if (fp.config.enableTime &&
e.key === "Tab" &&
isTargetLastFocusableElement) {
e.preventDefault();
confirmContainer.focus();
}
else if (e.key === "Enter" && eventTarget === confirmContainer)
fp.close();
},
onReady: function () {
confirmContainer = fp._createElement("div", confirmButtonCSSClass + " " + (config.showAlways ? "visible" : "") + " " + config.theme + "Theme", config.confirmText);
confirmContainer.tabIndex = -1;
confirmContainer.innerHTML += config.confirmIcon;
confirmContainer.addEventListener("click", fp.close);
fp.calendarContainer.appendChild(confirmContainer);
fp.loadedPlugins.push("confirmDate");
} }, (!config.showAlways
? {
onChange: function (_, dateStr) {
var showCondition = fp.config.enableTime ||
fp.config.mode === "multiple" ||
fp.loadedPlugins.indexOf("monthSelect") !== -1;
var localConfirmContainer = fp.calendarContainer.querySelector("." + confirmButtonCSSClass);
if (!localConfirmContainer)
return;
if (dateStr &&
!fp.config.inline &&
showCondition &&
localConfirmContainer)
return localConfirmContainer.classList.add("visible");
localConfirmContainer.classList.remove("visible");
},
}
: {}));
};
}
return confirmDatePlugin;
})));

View File

@@ -0,0 +1,31 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.labelPlugin = factory());
}(this, (function () { 'use strict';
function labelPlugin() {
return function (fp) {
return {
onReady: function () {
var id = fp.input.id;
if (!id) {
return;
}
if (fp.mobileInput) {
fp.input.removeAttribute("id");
fp.mobileInput.id = id;
}
else if (fp.altInput) {
fp.input.removeAttribute("id");
fp.altInput.id = id;
}
fp.loadedPlugins.push("labelPlugin");
},
};
};
}
return labelPlugin;
})));

View File

@@ -0,0 +1,349 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.minMaxTimePlugin = factory());
}(this, (function () { 'use strict';
var pad = function (number, length) {
if (length === void 0) { length = 2; }
return ("000" + number).slice(length * -1);
};
var int = function (bool) { return (bool === true ? 1 : 0); };
var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
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, padded (0001-9999)
Y: function (date) { return pad(date.getFullYear(), 4); },
// 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 defaults = {
_disable: [],
allowInput: false,
allowInvalidPreload: 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",
autoFillDefaultTime: true,
clickOpens: true,
closeOnSelect: true,
conjunction: ", ",
dateFormat: "Y-m-d",
defaultHour: 12,
defaultMinute: 0,
defaultSeconds: 0,
disable: [],
disableMobile: false,
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: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",
noCalendar: false,
now: new Date(),
onChange: [],
onClose: [],
onDayCreate: [],
onDestroy: [],
onKeyDown: [],
onMonthChange: [],
onOpen: [],
onParseConfig: [],
onReady: [],
onValueUpdate: [],
onYearChange: [],
onPreCalendarPosition: [],
plugins: [],
position: "auto",
positionElement: undefined,
prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",
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",
monthAriaLabel: "Month",
hourAriaLabel: "Hour",
minuteAriaLabel: "Minute",
time_24hr: false,
};
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("");
};
};
/**
* 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();
}
/**
* Compute the difference in times, measured in ms
*/
function compareTimes(date1, date2) {
return (3600 * (date1.getHours() - date2.getHours()) +
60 * (date1.getMinutes() - date2.getMinutes()) +
date1.getSeconds() -
date2.getSeconds());
}
var calculateSecondsSinceMidnight = function (hours, minutes, seconds) {
return hours * 3600 + minutes * 60 + seconds;
};
var parseSeconds = function (secondsSinceMidnight) {
var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60;
return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60];
};
function minMaxTimePlugin(config) {
if (config === void 0) { config = {}; }
var state = {
formatDate: createDateFormatter({}),
tableDateFormat: config.tableDateFormat || "Y-m-d",
defaults: {
minTime: undefined,
maxTime: undefined,
},
};
function findDateTimeLimit(date) {
if (config.table !== undefined) {
return config.table[state.formatDate(date, state.tableDateFormat)];
}
return config.getTimeLimits && config.getTimeLimits(date);
}
return function (fp) {
return {
onReady: function () {
state.formatDate = this.formatDate;
state.defaults = {
minTime: this.config.minTime && state.formatDate(this.config.minTime, "H:i"),
maxTime: this.config.maxTime && state.formatDate(this.config.maxTime, "H:i"),
};
fp.loadedPlugins.push("minMaxTime");
},
onChange: function () {
var latest = this.latestSelectedDateObj;
var matchingTimeLimit = latest && findDateTimeLimit(latest);
if (latest && matchingTimeLimit !== undefined) {
this.set(matchingTimeLimit);
fp.config.minTime.setFullYear(latest.getFullYear());
fp.config.maxTime.setFullYear(latest.getFullYear());
fp.config.minTime.setMonth(latest.getMonth());
fp.config.maxTime.setMonth(latest.getMonth());
fp.config.minTime.setDate(latest.getDate());
fp.config.maxTime.setDate(latest.getDate());
if (fp.config.minTime > fp.config.maxTime) {
var minBound = calculateSecondsSinceMidnight(fp.config.minTime.getHours(), fp.config.minTime.getMinutes(), fp.config.minTime.getSeconds());
var maxBound = calculateSecondsSinceMidnight(fp.config.maxTime.getHours(), fp.config.maxTime.getMinutes(), fp.config.maxTime.getSeconds());
var currentTime = calculateSecondsSinceMidnight(latest.getHours(), latest.getMinutes(), latest.getSeconds());
if (currentTime > maxBound && currentTime < minBound) {
var result = parseSeconds(minBound);
fp.setDate(new Date(latest.getTime()).setHours(result[0], result[1], result[2]), false);
}
}
else {
if (compareDates(latest, fp.config.maxTime, false) > 0) {
fp.setDate(new Date(latest.getTime()).setHours(fp.config.maxTime.getHours(), fp.config.maxTime.getMinutes(), fp.config.maxTime.getSeconds(), fp.config.maxTime.getMilliseconds()), false);
}
else if (compareDates(latest, fp.config.minTime, false) < 0) {
fp.setDate(new Date(latest.getTime()).setHours(fp.config.minTime.getHours(), fp.config.minTime.getMinutes(), fp.config.minTime.getSeconds(), fp.config.minTime.getMilliseconds()), false);
}
}
}
else {
var newMinMax = state.defaults || {
minTime: undefined,
maxTime: undefined,
};
this.set(newMinMax);
if (!latest)
return;
var _a = fp.config, minTime = _a.minTime, maxTime = _a.maxTime;
if (minTime && compareTimes(latest, minTime) < 0) {
fp.setDate(new Date(latest.getTime()).setHours(minTime.getHours(), minTime.getMinutes(), minTime.getSeconds(), minTime.getMilliseconds()), false);
}
else if (maxTime && compareTimes(latest, maxTime) > 0) {
fp.setDate(new Date(latest.getTime()).setHours(maxTime.getHours(), maxTime.getMinutes(), maxTime.getSeconds(), maxTime.getMilliseconds()));
}
//
}
},
};
};
}
return minMaxTimePlugin;
})));

View File

@@ -0,0 +1,69 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.momentPlugin = factory());
}(this, (function () { 'use strict';
function getEventTarget(event) {
try {
if (typeof event.composedPath === "function") {
var path = event.composedPath();
return path[0];
}
return event.target;
}
catch (error) {
return event.target;
}
}
function momentPlugin(config) {
var moment = config.moment;
return function (fp) {
function captureIncrement(e) {
var event = e;
event.stopPropagation();
var date = moment(fp.selectedDates[0]);
var input = getEventTarget(event);
var unit = Array.from(input.classList)
.filter(function (name) { return name.startsWith("flatpickr-"); })
.map(function (name) { return name.substring(10); })[0];
var step = parseFloat(input.getAttribute("step"));
date.add(step * event.delta, unit);
fp.setDate(date.toDate());
}
return {
parseDate: function (datestr, format) {
return moment(datestr, format, true).toDate();
},
formatDate: function (date, format) {
// locale can also be used
var momentDate = moment(date);
if (typeof fp.config.locale === "string") {
momentDate.locale(fp.config.locale);
}
return momentDate.format(format);
},
onReady: function () {
[fp.hourElement, fp.minuteElement, fp.secondElement].forEach(function (element) {
return element &&
element.addEventListener("increment", captureIncrement, {
capture: true,
});
});
},
onDestroy: function () {
[fp.hourElement, fp.minuteElement, fp.secondElement].forEach(function (element) {
return element &&
element.removeEventListener("increment", captureIncrement, {
capture: true,
});
});
},
};
};
}
return momentPlugin;
})));

View File

@@ -0,0 +1,301 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.monthSelectPlugin = factory());
}(this, (function () { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
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 monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
function clearNode(node) {
while (node.firstChild)
node.removeChild(node.firstChild);
}
function getEventTarget(event) {
try {
if (typeof event.composedPath === "function") {
var path = event.composedPath();
return path[0];
}
return event.target;
}
catch (error) {
return event.target;
}
}
var defaultConfig = {
shorthand: false,
dateFormat: "F Y",
altFormat: "F Y",
theme: "light",
};
function monthSelectPlugin(pluginConfig) {
var config = __assign(__assign({}, defaultConfig), pluginConfig);
return function (fp) {
fp.config.dateFormat = config.dateFormat;
fp.config.altFormat = config.altFormat;
var self = { monthsContainer: null };
function clearUnnecessaryDOMElements() {
if (!fp.rContainer)
return;
clearNode(fp.rContainer);
for (var index = 0; index < fp.monthElements.length; index++) {
var element = fp.monthElements[index];
if (!element.parentNode)
continue;
element.parentNode.removeChild(element);
}
}
function build() {
if (!fp.rContainer)
return;
self.monthsContainer = fp._createElement("div", "flatpickr-monthSelect-months");
self.monthsContainer.tabIndex = -1;
buildMonths();
fp.rContainer.appendChild(self.monthsContainer);
fp.calendarContainer.classList.add("flatpickr-monthSelect-theme-" + config.theme);
}
function buildMonths() {
if (!self.monthsContainer)
return;
clearNode(self.monthsContainer);
var frag = document.createDocumentFragment();
for (var i = 0; i < 12; i++) {
var month = fp.createDay("flatpickr-monthSelect-month", new Date(fp.currentYear, i), 0, i);
if (month.dateObj.getMonth() === new Date().getMonth() &&
month.dateObj.getFullYear() === new Date().getFullYear())
month.classList.add("today");
month.textContent = monthToStr(i, config.shorthand, fp.l10n);
month.addEventListener("click", selectMonth);
frag.appendChild(month);
}
self.monthsContainer.appendChild(frag);
if (fp.config.minDate &&
fp.currentYear === fp.config.minDate.getFullYear())
fp.prevMonthNav.classList.add("flatpickr-disabled");
else
fp.prevMonthNav.classList.remove("flatpickr-disabled");
if (fp.config.maxDate &&
fp.currentYear === fp.config.maxDate.getFullYear())
fp.nextMonthNav.classList.add("flatpickr-disabled");
else
fp.nextMonthNav.classList.remove("flatpickr-disabled");
}
function bindEvents() {
fp._bind(fp.prevMonthNav, "click", function (e) {
e.preventDefault();
e.stopPropagation();
fp.changeYear(fp.currentYear - 1);
selectYear();
buildMonths();
});
fp._bind(fp.nextMonthNav, "click", function (e) {
e.preventDefault();
e.stopPropagation();
fp.changeYear(fp.currentYear + 1);
selectYear();
buildMonths();
});
fp._bind(self.monthsContainer, "mouseover", function (e) {
if (fp.config.mode === "range")
fp.onMouseOver(getEventTarget(e), "flatpickr-monthSelect-month");
});
}
function setCurrentlySelected() {
if (!fp.rContainer)
return;
if (!fp.selectedDates.length)
return;
var currentlySelected = fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected");
for (var index = 0; index < currentlySelected.length; index++) {
currentlySelected[index].classList.remove("selected");
}
var targetMonth = fp.selectedDates[0].getMonth();
var month = fp.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child(" + (targetMonth + 1) + ")");
if (month) {
month.classList.add("selected");
}
}
function selectYear() {
var selectedDate = fp.selectedDates[0];
if (selectedDate) {
selectedDate = new Date(selectedDate);
selectedDate.setFullYear(fp.currentYear);
if (fp.config.minDate && selectedDate < fp.config.minDate) {
selectedDate = fp.config.minDate;
}
if (fp.config.maxDate && selectedDate > fp.config.maxDate) {
selectedDate = fp.config.maxDate;
}
fp.currentYear = selectedDate.getFullYear();
}
fp.currentYearElement.value = String(fp.currentYear);
if (fp.rContainer) {
var months = fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month");
months.forEach(function (month) {
month.dateObj.setFullYear(fp.currentYear);
if ((fp.config.minDate && month.dateObj < fp.config.minDate) ||
(fp.config.maxDate && month.dateObj > fp.config.maxDate)) {
month.classList.add("flatpickr-disabled");
}
else {
month.classList.remove("flatpickr-disabled");
}
});
}
setCurrentlySelected();
}
function selectMonth(e) {
e.preventDefault();
e.stopPropagation();
var eventTarget = getEventTarget(e);
if (!(eventTarget instanceof Element))
return;
if (eventTarget.classList.contains("flatpickr-disabled"))
return;
if (eventTarget.classList.contains("notAllowed"))
return; // necessary??
setMonth(eventTarget.dateObj);
if (fp.config.closeOnSelect) {
var single = fp.config.mode === "single";
var range = fp.config.mode === "range" && fp.selectedDates.length === 2;
if (single || range)
fp.close();
}
}
function setMonth(date) {
var selectedDate = new Date(fp.currentYear, date.getMonth(), date.getDate());
var selectedDates = [];
switch (fp.config.mode) {
case "single":
selectedDates = [selectedDate];
break;
case "multiple":
selectedDates.push(selectedDate);
break;
case "range":
if (fp.selectedDates.length === 2) {
selectedDates = [selectedDate];
}
else {
selectedDates = fp.selectedDates.concat([selectedDate]);
selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
}
break;
}
fp.setDate(selectedDates, true);
setCurrentlySelected();
}
var shifts = {
37: -1,
39: 1,
40: 3,
38: -3,
};
function onKeyDown(_, __, ___, e) {
var shouldMove = shifts[e.keyCode] !== undefined;
if (!shouldMove && e.keyCode !== 13) {
return;
}
if (!fp.rContainer || !self.monthsContainer)
return;
var currentlySelected = fp.rContainer.querySelector(".flatpickr-monthSelect-month.selected");
var index = Array.prototype.indexOf.call(self.monthsContainer.children, document.activeElement);
if (index === -1) {
var target = currentlySelected || self.monthsContainer.firstElementChild;
target.focus();
index = target.$i;
}
if (shouldMove) {
self.monthsContainer.children[(12 + index + shifts[e.keyCode]) % 12].focus();
}
else if (e.keyCode === 13 &&
self.monthsContainer.contains(document.activeElement)) {
setMonth(document.activeElement.dateObj);
}
}
function closeHook() {
var _a;
if (((_a = fp.config) === null || _a === void 0 ? void 0 : _a.mode) === "range" && fp.selectedDates.length === 1)
fp.clear(false);
if (!fp.selectedDates.length)
buildMonths();
}
// Help the prev/next year nav honor config.minDate (see 3fa5a69)
function stubCurrentMonth() {
config._stubbedCurrentMonth = fp._initialDate.getMonth();
fp._initialDate.setMonth(config._stubbedCurrentMonth);
fp.currentMonth = config._stubbedCurrentMonth;
}
function unstubCurrentMonth() {
if (!config._stubbedCurrentMonth)
return;
fp._initialDate.setMonth(config._stubbedCurrentMonth);
fp.currentMonth = config._stubbedCurrentMonth;
delete config._stubbedCurrentMonth;
}
function destroyPluginInstance() {
if (self.monthsContainer !== null) {
var months = self.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month");
for (var index = 0; index < months.length; index++) {
months[index].removeEventListener("click", selectMonth);
}
}
}
return {
onParseConfig: function () {
fp.config.enableTime = false;
},
onValueUpdate: setCurrentlySelected,
onKeyDown: onKeyDown,
onReady: [
stubCurrentMonth,
clearUnnecessaryDOMElements,
build,
bindEvents,
setCurrentlySelected,
function () {
fp.config.onClose.push(closeHook);
fp.loadedPlugins.push("monthSelect");
},
],
onDestroy: [
unstubCurrentMonth,
destroyPluginInstance,
function () {
fp.config.onClose = fp.config.onClose.filter(function (hook) { return hook !== closeHook; });
},
],
};
};
}
return monthSelectPlugin;
})));

View File

@@ -0,0 +1,117 @@
.flatpickr-monthSelect-months {
margin: 10px 1px 3px 1px;
flex-wrap: wrap;
}
.flatpickr-monthSelect-month {
background: none;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #393939;
cursor: pointer;
display: inline-block;
font-weight: 400;
margin: 0.5px;
justify-content: center;
padding: 10px;
position: relative;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
text-align: center;
width: 33%;
}
.flatpickr-monthSelect-month.flatpickr-disabled {
color: #eee;
}
.flatpickr-monthSelect-month.flatpickr-disabled:hover,
.flatpickr-monthSelect-month.flatpickr-disabled:focus {
cursor: not-allowed;
background: none !important;
}
.flatpickr-monthSelect-theme-dark {
background: #3f4458;
}
.flatpickr-monthSelect-theme-dark .flatpickr-current-month input.cur-year {
color: #fff;
}
.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-prev-month,
.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-next-month {
color: #fff;
fill: #fff;
}
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month {
color: rgba(255, 255, 255, 0.95);
}
.flatpickr-monthSelect-month.today {
border-color: #959ea9;
}
.flatpickr-monthSelect-month.inRange,
.flatpickr-monthSelect-month.inRange.today,
.flatpickr-monthSelect-month:hover,
.flatpickr-monthSelect-month:focus {
background: #e6e6e6;
cursor: pointer;
outline: 0;
border-color: #e6e6e6;
}
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.inRange,
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:hover,
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:focus {
background: #646c8c;
border-color: #646c8c;
}
.flatpickr-monthSelect-month.today:hover,
.flatpickr-monthSelect-month.today:focus {
background: #959ea9;
border-color: #959ea9;
color: #fff;
}
.flatpickr-monthSelect-month.selected,
.flatpickr-monthSelect-month.startRange,
.flatpickr-monthSelect-month.endRange {
background-color: #569ff7;
box-shadow: none;
color: #fff;
border-color: #569ff7;
}
.flatpickr-monthSelect-month.startRange {
border-radius: 50px 0 0 50px;
}
.flatpickr-monthSelect-month.endRange {
border-radius: 0 50px 50px 0;
}
.flatpickr-monthSelect-month.startRange.endRange {
border-radius: 50px;
}
.flatpickr-monthSelect-month.inRange {
border-radius: 0;
box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
}
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected,
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.startRange,
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.endRange {
background: #80cbc4;
-webkit-box-shadow: none;
box-shadow: none;
color: #fff;
border-color: #80cbc4;
}

View File

@@ -0,0 +1,179 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.rangePlugin = factory());
}(this, (function () { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function rangePlugin(config) {
if (config === void 0) { config = {}; }
return function (fp) {
var dateFormat = "", secondInput, _secondInputFocused, _prevDates;
var createSecondInput = function () {
if (config.input) {
secondInput =
config.input instanceof Element
? config.input
: window.document.querySelector(config.input);
if (!secondInput) {
fp.config.errorHandler(new Error("Invalid input element specified"));
return;
}
if (fp.config.wrap) {
secondInput = secondInput.querySelector("[data-input]");
}
}
else {
secondInput = fp._input.cloneNode();
secondInput.removeAttribute("id");
secondInput._flatpickr = undefined;
}
if (secondInput.value) {
var parsedDate = fp.parseDate(secondInput.value);
if (parsedDate)
fp.selectedDates.push(parsedDate);
}
secondInput.setAttribute("data-fp-omit", "");
if (fp.config.clickOpens) {
fp._bind(secondInput, ["focus", "click"], function () {
if (fp.selectedDates[1]) {
fp.latestSelectedDateObj = fp.selectedDates[1];
fp._setHoursFromDate(fp.selectedDates[1]);
fp.jumpToDate(fp.selectedDates[1]);
}
_secondInputFocused = true;
fp.isOpen = false;
fp.open(undefined, config.position === "left" ? fp._input : secondInput);
});
fp._bind(fp._input, ["focus", "click"], function (e) {
e.preventDefault();
fp.isOpen = false;
fp.open();
});
}
if (fp.config.allowInput)
fp._bind(secondInput, "keydown", function (e) {
if (e.key === "Enter") {
fp.setDate([fp.selectedDates[0], secondInput.value], true, dateFormat);
secondInput.click();
}
});
if (!config.input)
fp._input.parentNode &&
fp._input.parentNode.insertBefore(secondInput, fp._input.nextSibling);
};
var plugin = {
onParseConfig: function () {
fp.config.mode = "range";
dateFormat = fp.config.altInput
? fp.config.altFormat
: fp.config.dateFormat;
},
onReady: function () {
createSecondInput();
fp.config.ignoredFocusElements.push(secondInput);
if (fp.config.allowInput) {
fp._input.removeAttribute("readonly");
secondInput.removeAttribute("readonly");
}
else {
secondInput.setAttribute("readonly", "readonly");
}
fp._bind(fp._input, "focus", function () {
fp.latestSelectedDateObj = fp.selectedDates[0];
fp._setHoursFromDate(fp.selectedDates[0]);
_secondInputFocused = false;
fp.jumpToDate(fp.selectedDates[0]);
});
if (fp.config.allowInput)
fp._bind(fp._input, "keydown", function (e) {
if (e.key === "Enter")
fp.setDate([fp._input.value, fp.selectedDates[1]], true, dateFormat);
});
fp.setDate(fp.selectedDates, false);
plugin.onValueUpdate(fp.selectedDates);
fp.loadedPlugins.push("range");
},
onPreCalendarPosition: function () {
if (_secondInputFocused) {
fp._positionElement = secondInput;
setTimeout(function () {
fp._positionElement = fp._input;
}, 0);
}
},
onChange: function () {
if (!fp.selectedDates.length) {
setTimeout(function () {
if (fp.selectedDates.length)
return;
secondInput.value = "";
_prevDates = [];
}, 10);
}
if (_secondInputFocused) {
setTimeout(function () {
secondInput.focus();
}, 0);
}
},
onDestroy: function () {
if (!config.input)
secondInput.parentNode &&
secondInput.parentNode.removeChild(secondInput);
},
onValueUpdate: function (selDates) {
var _a, _b, _c;
if (!secondInput)
return;
_prevDates =
!_prevDates || selDates.length >= _prevDates.length
? __spreadArrays(selDates) : _prevDates;
if (_prevDates.length > selDates.length) {
var newSelectedDate = selDates[0];
var newDates = _secondInputFocused
? [_prevDates[0], newSelectedDate]
: [newSelectedDate, _prevDates[1]];
if (newDates[0].getTime() > newDates[1].getTime()) {
if (_secondInputFocused) {
newDates[0] = newDates[1];
}
else {
newDates[1] = newDates[0];
}
}
fp.setDate(newDates, false);
_prevDates = __spreadArrays(newDates);
}
_a = fp.selectedDates.map(function (d) { return fp.formatDate(d, dateFormat); }), _b = _a[0], fp._input.value = _b === void 0 ? "" : _b, _c = _a[1], secondInput.value = _c === void 0 ? "" : _c;
},
};
return plugin;
};
}
return rangePlugin;
})));

View File

@@ -0,0 +1,93 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.scrollPlugin = factory());
}(this, (function () { 'use strict';
function getEventTarget(event) {
try {
if (typeof event.composedPath === "function") {
var path = event.composedPath();
return path[0];
}
return event.target;
}
catch (error) {
return event.target;
}
}
if (typeof window.CustomEvent !== "function") {
var CustomEvent = function (typeArg, eventInitDict) {
eventInitDict = eventInitDict || {
bubbles: false,
cancelable: false,
detail: undefined,
};
var evt = document.createEvent("CustomEvent");
evt.initCustomEvent(typeArg, eventInitDict.bubbles, eventInitDict.cancelable, eventInitDict.detail);
return evt;
};
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
}
function delta(e) {
return Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY));
}
var scroll = function (e) {
e.preventDefault();
var ev = new CustomEvent("increment", {
bubbles: true,
});
ev.delta = delta(e);
getEventTarget(e).dispatchEvent(ev);
};
function scrollMonth(fp) {
return function (e) {
e.preventDefault();
var mDelta = delta(e);
fp.changeMonth(mDelta);
};
}
function scrollPlugin() {
return function (fp) {
var monthScroller = scrollMonth(fp);
return {
onReady: function () {
if (fp.timeContainer) {
fp.timeContainer.addEventListener("wheel", scroll);
}
if (fp.yearElements) {
fp.yearElements.forEach(function (yearElem) {
return yearElem.addEventListener("wheel", scroll);
});
}
if (fp.monthElements) {
fp.monthElements.forEach(function (monthElem) {
return monthElem.addEventListener("wheel", monthScroller);
});
}
fp.loadedPlugins.push("scroll");
},
onDestroy: function () {
if (fp.timeContainer) {
fp.timeContainer.removeEventListener("wheel", scroll);
}
if (fp.yearElements) {
fp.yearElements.forEach(function (yearElem) {
return yearElem.removeEventListener("wheel", scroll);
});
}
if (fp.monthElements) {
fp.monthElements.forEach(function (monthElem) {
return monthElem.removeEventListener("wheel", monthScroller);
});
}
},
};
};
}
return scrollPlugin;
})));

View File

@@ -0,0 +1,99 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.weekSelect = factory());
}(this, (function () { 'use strict';
function getEventTarget(event) {
try {
if (typeof event.composedPath === "function") {
var path = event.composedPath();
return path[0];
}
return event.target;
}
catch (error) {
return event.target;
}
}
function weekSelectPlugin() {
return function (fp) {
function onDayHover(event) {
var day = getEventTarget(event);
if (!day.classList.contains("flatpickr-day"))
return;
var days = fp.days.childNodes;
var dayIndex = day.$i;
var dayIndSeven = dayIndex / 7;
var weekStartDay = days[7 * Math.floor(dayIndSeven)]
.dateObj;
var weekEndDay = days[7 * Math.ceil(dayIndSeven + 0.01) - 1].dateObj;
for (var i = days.length; i--;) {
var day_1 = days[i];
var date = day_1.dateObj;
if (date > weekEndDay || date < weekStartDay)
day_1.classList.remove("inRange");
else
day_1.classList.add("inRange");
}
}
function highlightWeek() {
var selDate = fp.latestSelectedDateObj;
if (selDate !== undefined &&
selDate.getMonth() === fp.currentMonth &&
selDate.getFullYear() === fp.currentYear) {
fp.weekStartDay = fp.days.childNodes[7 * Math.floor(fp.selectedDateElem.$i / 7)].dateObj;
fp.weekEndDay = fp.days.childNodes[7 * Math.ceil(fp.selectedDateElem.$i / 7 + 0.01) - 1].dateObj;
}
var days = fp.days.childNodes;
for (var i = days.length; i--;) {
var date = days[i].dateObj;
if (date >= fp.weekStartDay && date <= fp.weekEndDay)
days[i].classList.add("week", "selected");
}
}
function clearHover() {
var days = fp.days.childNodes;
for (var i = days.length; i--;)
days[i].classList.remove("inRange");
}
function onReady() {
if (fp.daysContainer !== undefined)
fp.daysContainer.addEventListener("mouseover", onDayHover);
}
function onDestroy() {
if (fp.daysContainer !== undefined)
fp.daysContainer.removeEventListener("mouseover", onDayHover);
}
return {
onValueUpdate: highlightWeek,
onMonthChange: highlightWeek,
onYearChange: highlightWeek,
onOpen: highlightWeek,
onClose: clearHover,
onParseConfig: function () {
fp.config.mode = "single";
fp.config.enableTime = false;
fp.config.dateFormat = fp.config.dateFormat
? fp.config.dateFormat
: "\\W\\e\\e\\k #W, Y";
fp.config.altFormat = fp.config.altFormat
? fp.config.altFormat
: "\\W\\e\\e\\k #W, Y";
},
onReady: [
onReady,
highlightWeek,
function () {
fp.loadedPlugins.push("weekSelect");
},
],
onDestroy: onDestroy,
};
};
}
return weekSelectPlugin;
})));