@getflip/swirl-components-react 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_commonjsHelpers-44457d8d.ba94af77.js +37 -0
- package/dist/a11y-dialog.esm-d7a94c8c.bd6ae411.js +99 -0
- package/dist/bodyScrollLock.esm-ce6356d8.2c600fb9.js +93 -0
- package/dist/{flip-action-list-item.entry.0f7f7d1d.js → flip-action-list-item.entry.8a7c3ed5.js} +3 -2
- package/dist/{flip-action-list-section.entry.e3180209.js → flip-action-list-section.entry.da0cdb9e.js} +1 -1
- package/dist/{flip-action-list.entry.6281e19f.js → flip-action-list.entry.b8a1ea41.js} +2 -2
- package/dist/{flip-avatar-group.entry.649a0faa.js → flip-avatar-group.entry.b0e66358.js} +3 -2
- package/dist/{flip-avatar.entry.8261b415.js → flip-avatar.entry.6a8f2e19.js} +3 -2
- package/dist/{flip-badge.entry.d0a48796.js → flip-badge.entry.a6d07965.js} +3 -2
- package/dist/{flip-banner.entry.f03180a7.js → flip-banner.entry.f53786a0.js} +3 -2
- package/dist/{flip-button-group.entry.e48f9cab.js → flip-button-group.entry.0342e82d.js} +1 -1
- package/dist/flip-button.entry.b752e108.js +33 -0
- package/dist/{flip-checkbox.entry.03f73a8f.js → flip-checkbox.entry.ade04b9c.js} +5 -4
- package/dist/{flip-chip.entry.232a1cad.js → flip-chip.entry.42861041.js} +3 -2
- package/dist/flip-date-input.entry.adafe713.js +5473 -0
- package/dist/flip-date-picker_3.entry.4a72cca9.js +1272 -0
- package/dist/{flip-description-list-item.entry.460331a8.js → flip-description-list-item.entry.0844c111.js} +1 -1
- package/dist/{flip-description-list.entry.489d5885.js → flip-description-list.entry.cdb5ba16.js} +1 -1
- package/dist/flip-dialog.entry.cdfca16a.js +45 -0
- package/dist/flip-empty-state.entry.77f9c8ed.js +15 -0
- package/dist/{flip-file-uploader.entry.bbfb166b.js → flip-file-uploader.entry.43c0b766.js} +3 -2
- package/dist/flip-file-viewer-audio_6.entry.c9978e1a.js +16174 -0
- package/dist/flip-file-viewer.entry.85af31ff.js +95 -0
- package/dist/flip-form-control.entry.ec90cfb9.js +58 -0
- package/dist/flip-form-group.entry.6256d521.js +18 -0
- package/dist/flip-heading.entry.472e3005.js +18 -0
- package/dist/{flip-icon-add-photo.entry.b807c3bc.js → flip-icon-add-photo.entry.d8ca058c.js} +1 -1
- package/dist/{flip-icon-add.entry.df6780ff.js → flip-icon-add.entry.79a8d7e6.js} +1 -1
- package/dist/{flip-icon-admin-panel-settings.entry.5afd720c.js → flip-icon-admin-panel-settings.entry.abfc03bf.js} +1 -1
- package/dist/{flip-icon-arrow-back.entry.43439868.js → flip-icon-arrow-back.entry.eff9e6a3.js} +1 -1
- package/dist/{flip-icon-arrow-forward.entry.1f80c674.js → flip-icon-arrow-forward.entry.b0017297.js} +1 -1
- package/dist/flip-icon-arrow-left.entry.234146e1.js +15 -0
- package/dist/{flip-icon-arrow-right-small.entry.5bb4f048.js → flip-icon-arrow-right-small.entry.dd9ec828.js} +1 -1
- package/dist/flip-icon-arrow-right.entry.d4a36d98.js +15 -0
- package/dist/{flip-icon-attachment.entry.e7a4173b.js → flip-icon-attachment.entry.d41db045.js} +1 -1
- package/dist/flip-icon-cancel.entry.c5b57f7f.js +15 -0
- package/dist/{flip-icon-chat-bubble.entry.60ca55cf.js → flip-icon-chat-bubble.entry.32859e94.js} +1 -1
- package/dist/{flip-icon-check-circle.entry.36b7fab2.js → flip-icon-check-circle.entry.cf0be0f3.js} +1 -1
- package/dist/{flip-icon-check-small.entry.26aa4c8e.js → flip-icon-check-small.entry.c28df931.js} +1 -1
- package/dist/{flip-icon-check-strong.entry.bf6545d9.js → flip-icon-check-strong.entry.756abe1c.js} +1 -1
- package/dist/{flip-icon-check.entry.88a7260b.js → flip-icon-check.entry.71f246f6.js} +1 -1
- package/dist/{flip-icon-chevron-left.entry.1eab612e.js → flip-icon-chevron-left.entry.76299ff3.js} +1 -1
- package/dist/{flip-icon-chevron-right.entry.b55b235e.js → flip-icon-chevron-right.entry.56cd2638.js} +1 -1
- package/dist/{flip-icon-close-small.entry.2c855d87.js → flip-icon-close-small.entry.d5bce874.js} +1 -1
- package/dist/{flip-icon-close.entry.8b5754bd.js → flip-icon-close.entry.1c183b2c.js} +1 -1
- package/dist/{flip-icon-cloud-upload.entry.943d15aa.js → flip-icon-cloud-upload.entry.780eefd8.js} +1 -1
- package/dist/{flip-icon-comment.entry.966dd929.js → flip-icon-comment.entry.9c85f2af.js} +1 -1
- package/dist/{flip-icon-copy.entry.a762687c.js → flip-icon-copy.entry.33ed327d.js} +1 -1
- package/dist/{flip-icon-date-range.entry.c3029ef5.js → flip-icon-date-range.entry.739ecf4e.js} +1 -1
- package/dist/{flip-icon-delete.entry.9a13cea4.js → flip-icon-delete.entry.f3cba347.js} +1 -1
- package/dist/{flip-icon-description.entry.c16ff02b.js → flip-icon-description.entry.d0f9e65c.js} +1 -1
- package/dist/{flip-icon-download.entry.3b48f816.js → flip-icon-download.entry.9adb287e.js} +1 -1
- package/dist/{flip-icon-edit.entry.86590692.js → flip-icon-edit.entry.7b9f186f.js} +1 -1
- package/dist/{flip-icon-emoji-mood.entry.5f75c0e7.js → flip-icon-emoji-mood.entry.e0b32fe1.js} +1 -1
- package/dist/{flip-icon-emoji-satisfied.entry.a24e9f8b.js → flip-icon-emoji-satisfied.entry.5ef82f25.js} +1 -1
- package/dist/{flip-icon-error.entry.0a68ce3b.js → flip-icon-error_3.entry.87fcf907.js} +30 -6
- package/dist/flip-icon-expand-less_3.entry.8f8fb508.js +35 -0
- package/dist/{flip-icon-expand-more.entry.d3b47154.js → flip-icon-expand-more.entry.d2c9bf62.js} +1 -1
- package/dist/{flip-icon-file.entry.9edd9ac5.js → flip-icon-file.entry.0d1868a4.js} +1 -1
- package/dist/{flip-icon-folder-shared.entry.a79740f8.js → flip-icon-folder-shared.entry.f1f4317b.js} +1 -1
- package/dist/flip-icon-fullscreen-exit.entry.168a2e77.js +15 -0
- package/dist/flip-icon-fullscreen.entry.d78bc3a4.js +15 -0
- package/dist/{flip-icon-group-assign.entry.ef36d758.js → flip-icon-group-assign.entry.2116431e.js} +1 -1
- package/dist/{flip-icon-groups-custom.entry.99781f2b.js → flip-icon-groups-custom.entry.415539b5.js} +1 -1
- package/dist/{flip-icon-groups.entry.33d1e274.js → flip-icon-groups.entry.25ce8212.js} +1 -1
- package/dist/{flip-icon-image.entry.e653564c.js → flip-icon-image.entry.ce484f72.js} +1 -1
- package/dist/{flip-icon-info.entry.c0153488.js → flip-icon-info.entry.3f6c72bb.js} +1 -1
- package/dist/{flip-icon-inventory.entry.394f2024.js → flip-icon-inventory.entry.fc8b1c79.js} +1 -1
- package/dist/{flip-icon-like.entry.db6411bc.js → flip-icon-like.entry.34ea69dc.js} +1 -1
- package/dist/{flip-icon-link.entry.35fba400.js → flip-icon-link.entry.94b7dd90.js} +1 -1
- package/dist/{flip-icon-lock.entry.73ad40b7.js → flip-icon-lock.entry.3e9c3e72.js} +1 -1
- package/dist/{flip-icon-logout.entry.bfdaf585.js → flip-icon-logout.entry.57363229.js} +1 -1
- package/dist/{flip-icon-mail.entry.10764728.js → flip-icon-mail.entry.b37d0b32.js} +1 -1
- package/dist/{flip-icon-manage-accounts.entry.13926348.js → flip-icon-manage-accounts.entry.fb4e9a6b.js} +1 -1
- package/dist/{flip-icon-mention.entry.43a08812.js → flip-icon-mention.entry.2bfbfa63.js} +1 -1
- package/dist/{flip-icon-message.entry.e45d5f55.js → flip-icon-message.entry.2df9486d.js} +1 -1
- package/dist/{flip-icon-more-horizontal.entry.175a91a7.js → flip-icon-more-horizontal.entry.7f45f170.js} +1 -1
- package/dist/{flip-icon-more-vertikal.entry.855f16e5.js → flip-icon-more-vertikal.entry.8045a647.js} +1 -1
- package/dist/{flip-icon-notifications-active.entry.0591ff75.js → flip-icon-notifications-active.entry.f03b2fc4.js} +1 -1
- package/dist/{flip-icon-notifications-off.entry.59926148.js → flip-icon-notifications-off.entry.dd8c68fd.js} +1 -1
- package/dist/{flip-icon-notifications.entry.b3b4169c.js → flip-icon-notifications.entry.edc9821c.js} +1 -1
- package/dist/flip-icon-open-in-new.entry.ff63ea33.js +15 -0
- package/dist/{flip-icon-people-alt.entry.b9304d1e.js → flip-icon-people-alt.entry.aad60933.js} +1 -1
- package/dist/{flip-icon-person-off.entry.26c00153.js → flip-icon-person-off.entry.59a3c96c.js} +1 -1
- package/dist/{flip-icon-person.entry.ed4eca20.js → flip-icon-person.entry.e69d335c.js} +1 -1
- package/dist/{flip-icon-phone.entry.add9f8fc.js → flip-icon-phone.entry.d3656af0.js} +1 -1
- package/dist/{flip-icon-poll.entry.37836068.js → flip-icon-poll.entry.16e1615e.js} +1 -1
- package/dist/flip-icon-print.entry.16e54d5b.js +15 -0
- package/dist/{flip-icon-recieved.entry.850deffd.js → flip-icon-recieved.entry.7a850323.js} +1 -1
- package/dist/flip-icon-remove.entry.88fa105e.js +15 -0
- package/dist/{flip-icon-search-strong.entry.fec41c91.js → flip-icon-search-strong.entry.fd001082.js} +1 -1
- package/dist/{flip-icon-cancel_2.entry.99f63020.js → flip-icon-search.entry.2efaf023.js} +3 -13
- package/dist/{flip-icon-send.entry.e687d6bb.js → flip-icon-send.entry.6a4cd99f.js} +1 -1
- package/dist/{flip-icon-settings.entry.2e503ce9.js → flip-icon-settings.entry.44aec164.js} +1 -1
- package/dist/{flip-icon-time-filled.entry.27c31492.js → flip-icon-time-filled.entry.bced668e.js} +1 -1
- package/dist/{flip-icon-time-outlined.entry.c1a0b4dd.js → flip-icon-time-outlined.entry.36bb857d.js} +1 -1
- package/dist/{flip-icon-user-assign.entry.10daebb0.js → flip-icon-user-assign.entry.f55379f5.js} +1 -1
- package/dist/{flip-icon-video-camera.entry.984108e1.js → flip-icon-video-camera.entry.23798820.js} +1 -1
- package/dist/{flip-icon-warning.entry.f8cdae30.js → flip-icon-warning.entry.ac7a7e4c.js} +1 -1
- package/dist/{flip-link.entry.2f2bd6f0.js → flip-link.entry.31692150.js} +1 -1
- package/dist/flip-list.entry.1eac3a62.js +18 -0
- package/dist/flip-modal.entry.5df13219.js +61 -0
- package/dist/flip-option-list-item.entry.f911c3b8.js +30 -0
- package/dist/flip-option-list-section.entry.0f67d7d7.js +15 -0
- package/dist/flip-option-list.entry.32d7928a.js +95 -0
- package/dist/flip-pagination.entry.278034c1.js +27 -0
- package/dist/flip-progress-indicator.entry.99e10b2c.js +18 -0
- package/dist/flip-radio-group.entry.7cc7a065.js +35 -0
- package/dist/{flip-radio.entry.9f9bc376.js → flip-radio.entry.eacccab0.js} +6 -5
- package/dist/{flip-resource-list-file-item.entry.f74d3bd3.js → flip-resource-list-file-item.entry.4fd698ae.js} +4 -3
- package/dist/{flip-resource-list-item.entry.96075846.js → flip-resource-list-item.entry.d9efc26d.js} +4 -3
- package/dist/{flip-resource-list.entry.d85444bc.js → flip-resource-list.entry.dca2afcd.js} +1 -1
- package/dist/{flip-search.entry.52636549.js → flip-search.entry.7a786fe8.js} +3 -2
- package/dist/{flip-stack.entry.90b930f5.js → flip-stack.entry.a2afebf5.js} +3 -2
- package/dist/{flip-switch.entry.6b0e71bc.js → flip-switch.entry.9e81c9b0.js} +3 -2
- package/dist/{flip-tab.entry.56a0d1cd.js → flip-tab.entry.b64631a4.js} +6 -5
- package/dist/{flip-tabs.entry.0c8b74db.js → flip-tabs.entry.a42a1989.js} +3 -2
- package/dist/{flip-tag.entry.202b87db.js → flip-tag.entry.c888703b.js} +3 -2
- package/dist/flip-text-input.entry.8deff49d.js +55 -0
- package/dist/flip-text.entry.4bcd3eae.js +18 -0
- package/dist/{flip-theme-provider.entry.6402a4bc.js → flip-theme-provider.entry.1b167993.js} +1 -1
- package/dist/{flip-thumbnail.entry.9c3af9fe.js → flip-thumbnail.entry.5f2effe1.js} +3 -2
- package/dist/{flip-toast-provider.entry.cbe2040b.js → flip-toast-provider.entry.870ddb2c.js} +1 -1
- package/dist/{flip-toast.entry.647ec44c.js → flip-toast.entry.f8bc132d.js} +3 -2
- package/dist/{flip-tooltip.entry.f43ae208.js → flip-tooltip.entry.e4e0b3a6.js} +1 -1
- package/dist/flip-video-thumbnail.entry.855576fe.js +83 -0
- package/dist/{flip-visually-hidden.entry.70e706df.js → flip-visually-hidden.entry.8d93e0bb.js} +1 -1
- package/dist/index-6d2e18c6.289636d4.js +37 -0
- package/dist/index.b70d4c92.js +1359 -0
- package/dist/index.d.ts +1 -0
- package/dist/stencil-generated/index.d.ts +136 -0
- package/dist/stencil-generated/react-component-lib/createComponent.d.ts +10 -0
- package/dist/stencil-generated/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/dist/stencil-generated/react-component-lib/index.d.ts +2 -0
- package/dist/stencil-generated/react-component-lib/interfaces.d.ts +29 -0
- package/dist/stencil-generated/react-component-lib/utils/attachProps.d.ts +12 -0
- package/dist/stencil-generated/react-component-lib/utils/case.d.ts +2 -0
- package/dist/stencil-generated/react-component-lib/utils/index.d.ts +10 -0
- package/dist/swirl-components-react.js +132 -102
- package/dist/swirl-components-react.umd.cjs +137 -17
- package/dist/utils-b46bcd4f.79126bb2.js +30 -0
- package/dist/vite-env.d.ts +1 -0
- package/package.json +5 -3
- package/dist/flip-button.entry.d68ba496.js +0 -32
- package/dist/flip-dialog.entry.cbf334d1.js +0 -139
- package/dist/flip-icon-expand-less.entry.d099c577.js +0 -15
- package/dist/flip-icon-today.entry.4d38a769.js +0 -15
- package/dist/flip-icon-visibility-off.entry.6a6e6a24.js +0 -15
- package/dist/flip-icon-visibility.entry.0d16fd8e.js +0 -15
- package/dist/flip-inline-error_2.entry.17e93f00.js +0 -28
- package/dist/flip-popover.entry.6309d3d5.js +0 -179
- package/dist/flip-radio-group.entry.afff6fac.js +0 -35
- package/dist/index-3c78bcaf.2675909b.js +0 -48
- package/dist/main.c9b46168.js +0 -1329
- package/dist/utils-03e3261c.f5223801.js +0 -16
|
@@ -0,0 +1,1272 @@
|
|
|
1
|
+
import { r as ie, c as _e, h as b, H as ue, F as te, g as Me } from "./index.b70d4c92.js";
|
|
2
|
+
import { c as me, a as $e, g as xe } from "./_commonjsHelpers-44457d8d.ba94af77.js";
|
|
3
|
+
import { c as Se, s as Te, f as Ve, a as Fe } from "./floating-ui.dom.esm-1a4e8b8a.87557233.js";
|
|
4
|
+
import { e as de, d as He } from "./bodyScrollLock.esm-ce6356d8.2c600fb9.js";
|
|
5
|
+
import { c as Ee } from "./index-6d2e18c6.289636d4.js";
|
|
6
|
+
import { i as ce, q as pe } from "./utils-b46bcd4f.79126bb2.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import "react-dom";
|
|
9
|
+
var Ae = me(function(m, v) {
|
|
10
|
+
(function($, T) {
|
|
11
|
+
m.exports = T();
|
|
12
|
+
})($e, function() {
|
|
13
|
+
return function() {
|
|
14
|
+
var $ = { d: function(r, e) {
|
|
15
|
+
for (var t in e)
|
|
16
|
+
$.o(e, t) && !$.o(r, t) && Object.defineProperty(r, t, { enumerable: !0, get: e[t] });
|
|
17
|
+
}, o: function(r, e) {
|
|
18
|
+
return Object.prototype.hasOwnProperty.call(r, e);
|
|
19
|
+
} }, T = {};
|
|
20
|
+
$.d(T, { default: function() {
|
|
21
|
+
return E;
|
|
22
|
+
} });
|
|
23
|
+
var l = { days: "days", months: "months", years: "years", day: "day", month: "month", year: "year", eventChangeViewDate: "changeViewDate", eventChangeCurrentView: "changeCurrentView", eventChangeFocusDate: "changeFocusDate", eventChangeSelectedDate: "changeSelectedDate", eventChangeTime: "changeTime", eventChangeLastSelectedDate: "changeLastSelectedDate", actionSelectDate: "selectDate", actionUnselectDate: "unselectDate", cssClassWeekend: "-weekend-" }, se = { classes: "", inline: !1, locale: { days: ["\u0412\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435", "\u041F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A", "\u0412\u0442\u043E\u0440\u043D\u0438\u043A", "\u0421\u0440\u0435\u0434\u0430", "\u0427\u0435\u0442\u0432\u0435\u0440\u0433", "\u041F\u044F\u0442\u043D\u0438\u0446\u0430", "\u0421\u0443\u0431\u0431\u043E\u0442\u0430"], daysShort: ["\u0412\u043E\u0441", "\u041F\u043E\u043D", "\u0412\u0442\u043E", "\u0421\u0440\u0435", "\u0427\u0435\u0442", "\u041F\u044F\u0442", "\u0421\u0443\u0431"], daysMin: ["\u0412\u0441", "\u041F\u043D", "\u0412\u0442", "\u0421\u0440", "\u0427\u0442", "\u041F\u0442", "\u0421\u0431"], months: ["\u042F\u043D\u0432\u0430\u0440\u044C", "\u0424\u0435\u0432\u0440\u0430\u043B\u044C", "\u041C\u0430\u0440\u0442", "\u0410\u043F\u0440\u0435\u043B\u044C", "\u041C\u0430\u0439", "\u0418\u044E\u043D\u044C", "\u0418\u044E\u043B\u044C", "\u0410\u0432\u0433\u0443\u0441\u0442", "\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C", "\u041E\u043A\u0442\u044F\u0431\u0440\u044C", "\u041D\u043E\u044F\u0431\u0440\u044C", "\u0414\u0435\u043A\u0430\u0431\u0440\u044C"], monthsShort: ["\u042F\u043D\u0432", "\u0424\u0435\u0432", "\u041C\u0430\u0440", "\u0410\u043F\u0440", "\u041C\u0430\u0439", "\u0418\u044E\u043D", "\u0418\u044E\u043B", "\u0410\u0432\u0433", "\u0421\u0435\u043D", "\u041E\u043A\u0442", "\u041D\u043E\u044F", "\u0414\u0435\u043A"], today: "\u0421\u0435\u0433\u043E\u0434\u043D\u044F", clear: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C", dateFormat: "dd.MM.yyyy", timeFormat: "HH:mm", firstDay: 1 }, startDate: new Date(), firstDay: "", weekends: [6, 0], dateFormat: "", altField: "", altFieldDateFormat: "T", toggleSelected: !0, keyboardNav: !0, selectedDates: !1, container: "", isMobile: !1, visible: !1, position: "bottom left", offset: 12, view: l.days, minView: l.days, showOtherMonths: !0, selectOtherMonths: !0, moveToOtherMonthsOnSelect: !0, showOtherYears: !0, selectOtherYears: !0, moveToOtherYearsOnSelect: !0, minDate: "", maxDate: "", disableNavWhenOutOfRange: !0, multipleDates: !1, multipleDatesSeparator: ", ", range: !1, dynamicRange: !0, buttons: !1, monthsField: "monthsShort", showEvent: "focus", autoClose: !1, prevHtml: '<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>', nextHtml: '<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>', navTitles: { days: "MMMM, <i>yyyy</i>", months: "yyyy", years: "yyyy1 - yyyy2" }, timepicker: !1, onlyTimepicker: !1, dateTimeSeparator: " ", timeFormat: "", minHours: 0, maxHours: 24, minMinutes: 0, maxMinutes: 59, hoursStep: 1, minutesStep: 1, onSelect: !1, onChangeViewDate: !1, onChangeView: !1, onRenderCell: !1, onShow: !1, onHide: !1, onClickDayName: !1 };
|
|
24
|
+
function w(r) {
|
|
25
|
+
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : document;
|
|
26
|
+
return typeof r == "string" ? e.querySelector(r) : r;
|
|
27
|
+
}
|
|
28
|
+
function _() {
|
|
29
|
+
let { tagName: r = "div", className: e = "", innerHtml: t = "", id: i = "", attrs: a = {} } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = document.createElement(r);
|
|
30
|
+
return e && n.classList.add(...e.split(" ")), i && (n.id = i), t && (n.innerHTML = t), a && G(n, a), n;
|
|
31
|
+
}
|
|
32
|
+
function G(r, e) {
|
|
33
|
+
for (let [t, i] of Object.entries(e))
|
|
34
|
+
i !== void 0 && r.setAttribute(t, i);
|
|
35
|
+
return r;
|
|
36
|
+
}
|
|
37
|
+
function ae(r) {
|
|
38
|
+
return new Date(r.getFullYear(), r.getMonth() + 1, 0).getDate();
|
|
39
|
+
}
|
|
40
|
+
function y(r) {
|
|
41
|
+
let e = r.getHours(), t = e % 12 == 0 ? 12 : e % 12;
|
|
42
|
+
return { year: r.getFullYear(), month: r.getMonth(), fullMonth: r.getMonth() + 1 < 10 ? "0" + (r.getMonth() + 1) : r.getMonth() + 1, date: r.getDate(), fullDate: r.getDate() < 10 ? "0" + r.getDate() : r.getDate(), day: r.getDay(), hours: e, fullHours: P(e), hours12: t, fullHours12: P(t), minutes: r.getMinutes(), fullMinutes: r.getMinutes() < 10 ? "0" + r.getMinutes() : r.getMinutes() };
|
|
43
|
+
}
|
|
44
|
+
function P(r) {
|
|
45
|
+
return r < 10 ? "0" + r : r;
|
|
46
|
+
}
|
|
47
|
+
function A(r) {
|
|
48
|
+
let e = 10 * Math.floor(r.getFullYear() / 10);
|
|
49
|
+
return [e, e + 9];
|
|
50
|
+
}
|
|
51
|
+
function V() {
|
|
52
|
+
let r = [];
|
|
53
|
+
for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
|
|
54
|
+
t[i] = arguments[i];
|
|
55
|
+
return t.forEach((a) => {
|
|
56
|
+
if (typeof a == "object")
|
|
57
|
+
for (let n in a)
|
|
58
|
+
a[n] && r.push(n);
|
|
59
|
+
else
|
|
60
|
+
a && r.push(a);
|
|
61
|
+
}), r.join(" ");
|
|
62
|
+
}
|
|
63
|
+
function D(r, e) {
|
|
64
|
+
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : l.days;
|
|
65
|
+
if (!r || !e)
|
|
66
|
+
return !1;
|
|
67
|
+
let i = y(r), a = y(e);
|
|
68
|
+
return { [l.days]: i.date === a.date && i.month === a.month && i.year === a.year, [l.months]: i.month === a.month && i.year === a.year, [l.years]: i.year === a.year }[t];
|
|
69
|
+
}
|
|
70
|
+
function F(r, e, t) {
|
|
71
|
+
let i = X(r, !1).getTime(), a = X(e, !1).getTime();
|
|
72
|
+
return t ? i >= a : i > a;
|
|
73
|
+
}
|
|
74
|
+
function B(r, e) {
|
|
75
|
+
return !F(r, e, !0);
|
|
76
|
+
}
|
|
77
|
+
function X(r) {
|
|
78
|
+
let e = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1], t = new Date(r.getTime());
|
|
79
|
+
return typeof e != "boolean" || e || ge(t), t;
|
|
80
|
+
}
|
|
81
|
+
function ge(r) {
|
|
82
|
+
return r.setHours(0, 0, 0, 0), r;
|
|
83
|
+
}
|
|
84
|
+
function C(r, e, t) {
|
|
85
|
+
r.length ? r.forEach((i) => {
|
|
86
|
+
i.addEventListener(e, t);
|
|
87
|
+
}) : r.addEventListener(e, t);
|
|
88
|
+
}
|
|
89
|
+
function U(r, e) {
|
|
90
|
+
return !(!r || r === document || r instanceof DocumentFragment) && (r.matches(e) ? r : U(r.parentNode, e));
|
|
91
|
+
}
|
|
92
|
+
function R(r, e, t) {
|
|
93
|
+
return r > t ? t : r < e ? e : r;
|
|
94
|
+
}
|
|
95
|
+
function Z(r) {
|
|
96
|
+
for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++)
|
|
97
|
+
t[i - 1] = arguments[i];
|
|
98
|
+
return t.filter((a) => a).forEach((a) => {
|
|
99
|
+
for (let [n, s] of Object.entries(a))
|
|
100
|
+
if (s !== void 0 && s.toString() === "[object Object]") {
|
|
101
|
+
let o = r[n] !== void 0 ? r[n].toString() : void 0, h = s.toString(), d = Array.isArray(s) ? [] : {};
|
|
102
|
+
r[n] = r[n] ? o !== h ? d : r[n] : d, Z(r[n], s);
|
|
103
|
+
} else
|
|
104
|
+
r[n] = s;
|
|
105
|
+
}), r;
|
|
106
|
+
}
|
|
107
|
+
function x(r) {
|
|
108
|
+
let e = r;
|
|
109
|
+
return r instanceof Date || (e = new Date(r)), isNaN(e.getTime()) && (console.log('Unable to convert value "'.concat(r, '" to Date object')), e = !1), e;
|
|
110
|
+
}
|
|
111
|
+
function Q(r) {
|
|
112
|
+
let e = "\\s|\\.|-|/|\\\\|,|\\$|\\!|\\?|:|;";
|
|
113
|
+
return new RegExp("(^|>|" + e + ")(" + r + ")($|<|" + e + ")", "g");
|
|
114
|
+
}
|
|
115
|
+
function L(r, e, t) {
|
|
116
|
+
return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
117
|
+
}
|
|
118
|
+
class ve {
|
|
119
|
+
constructor() {
|
|
120
|
+
let { type: e, date: t, dp: i, opts: a, body: n } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
121
|
+
L(this, "focus", () => {
|
|
122
|
+
this.$cell.classList.add("-focus-"), this.focused = !0;
|
|
123
|
+
}), L(this, "removeFocus", () => {
|
|
124
|
+
this.$cell.classList.remove("-focus-"), this.focused = !1;
|
|
125
|
+
}), L(this, "select", () => {
|
|
126
|
+
this.$cell.classList.add("-selected-"), this.selected = !0;
|
|
127
|
+
}), L(this, "removeSelect", () => {
|
|
128
|
+
this.$cell.classList.remove("-selected-", "-range-from-", "-range-to-"), this.selected = !1;
|
|
129
|
+
}), L(this, "onChangeSelectedDate", () => {
|
|
130
|
+
this.isDisabled || (this._handleSelectedStatus(), this.opts.range && this._handleRangeStatus());
|
|
131
|
+
}), L(this, "onChangeFocusDate", (s) => {
|
|
132
|
+
if (!s)
|
|
133
|
+
return void (this.focused && this.removeFocus());
|
|
134
|
+
let o = D(s, this.date, this.type);
|
|
135
|
+
o ? this.focus() : !o && this.focused && this.removeFocus(), this.opts.range && this._handleRangeStatus();
|
|
136
|
+
}), L(this, "render", () => (this.$cell.innerHTML = this._getHtml(), this.$cell.adpCell = this, this.$cell)), this.type = e, this.singleType = this.type.slice(0, -1), this.date = t, this.dp = i, this.opts = a, this.body = n, this.customData = !1, this.init();
|
|
137
|
+
}
|
|
138
|
+
init() {
|
|
139
|
+
let { range: e, onRenderCell: t } = this.opts;
|
|
140
|
+
t && (this.customData = t({ date: this.date, cellType: this.singleType, datepicker: this.dp })), this._createElement(), this._bindDatepickerEvents(), this._handleInitialFocusStatus(), this.dp.hasSelectedDates && (this._handleSelectedStatus(), e && this._handleRangeStatus());
|
|
141
|
+
}
|
|
142
|
+
_bindDatepickerEvents() {
|
|
143
|
+
this.dp.on(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.on(l.eventChangeFocusDate, this.onChangeFocusDate);
|
|
144
|
+
}
|
|
145
|
+
unbindDatepickerEvents() {
|
|
146
|
+
this.dp.off(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.off(l.eventChangeFocusDate, this.onChangeFocusDate);
|
|
147
|
+
}
|
|
148
|
+
_createElement() {
|
|
149
|
+
var e;
|
|
150
|
+
let { year: t, month: i, date: a } = y(this.date), n = ((e = this.customData) === null || e === void 0 ? void 0 : e.attrs) || {};
|
|
151
|
+
this.$cell = _({ className: this._getClassName(), attrs: { "data-year": t, "data-month": i, "data-date": a, ...n } });
|
|
152
|
+
}
|
|
153
|
+
_getClassName() {
|
|
154
|
+
var e, t;
|
|
155
|
+
let i = new Date(), { selectOtherMonths: a, selectOtherYears: n } = this.opts, { minDate: s, maxDate: o } = this.dp, { day: h } = y(this.date), d = this._isOutOfMinMaxRange(), c = (e = this.customData) === null || e === void 0 ? void 0 : e.disabled, p = V("air-datepicker-cell", "-".concat(this.singleType, "-"), { "-current-": D(i, this.date, this.type), "-min-date-": s && D(s, this.date, this.type), "-max-date-": o && D(o, this.date, this.type) }), u = "";
|
|
156
|
+
switch (this.type) {
|
|
157
|
+
case l.days:
|
|
158
|
+
u = V({ "-weekend-": this.dp.isWeekend(h), "-other-month-": this.isOtherMonth, "-disabled-": this.isOtherMonth && !a || d || c });
|
|
159
|
+
break;
|
|
160
|
+
case l.months:
|
|
161
|
+
u = V({ "-disabled-": d || c });
|
|
162
|
+
break;
|
|
163
|
+
case l.years:
|
|
164
|
+
u = V({ "-other-decade-": this.isOtherDecade, "-disabled-": d || this.isOtherDecade && !n || c });
|
|
165
|
+
}
|
|
166
|
+
return V(p, u, (t = this.customData) === null || t === void 0 ? void 0 : t.classes);
|
|
167
|
+
}
|
|
168
|
+
_getHtml() {
|
|
169
|
+
var e;
|
|
170
|
+
let { year: t, month: i, date: a } = y(this.date), { showOtherMonths: n, showOtherYears: s } = this.opts;
|
|
171
|
+
if ((e = this.customData) !== null && e !== void 0 && e.html)
|
|
172
|
+
return this.customData.html;
|
|
173
|
+
switch (this.type) {
|
|
174
|
+
case l.days:
|
|
175
|
+
return !n && this.isOtherMonth ? "" : a;
|
|
176
|
+
case l.months:
|
|
177
|
+
return this.dp.locale[this.opts.monthsField][i];
|
|
178
|
+
case l.years:
|
|
179
|
+
return !s && this.isOtherDecade ? "" : t;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
_isOutOfMinMaxRange() {
|
|
183
|
+
let { minDate: e, maxDate: t } = this.dp, { type: i, date: a } = this, { month: n, year: s, date: o } = y(a), h = i === l.days, d = i === l.years, c = !!e && new Date(s, d ? e.getMonth() : n, h ? o : e.getDate()), p = !!t && new Date(s, d ? t.getMonth() : n, h ? o : t.getDate());
|
|
184
|
+
return e && t ? B(c, e) || F(p, t) : e ? B(c, e) : t ? F(p, t) : void 0;
|
|
185
|
+
}
|
|
186
|
+
destroy() {
|
|
187
|
+
this.unbindDatepickerEvents();
|
|
188
|
+
}
|
|
189
|
+
_handleRangeStatus() {
|
|
190
|
+
let { rangeDateFrom: e, rangeDateTo: t } = this.dp, i = V({ "-in-range-": e && t && (a = this.date, n = e, s = t, F(a, n) && B(a, s)), "-range-from-": e && D(this.date, e, this.type), "-range-to-": t && D(this.date, t, this.type) });
|
|
191
|
+
var a, n, s;
|
|
192
|
+
this.$cell.classList.remove("-range-from-", "-range-to-", "-in-range-"), i && this.$cell.classList.add(...i.split(" "));
|
|
193
|
+
}
|
|
194
|
+
_handleSelectedStatus() {
|
|
195
|
+
let e = this.dp._checkIfDateIsSelected(this.date, this.type);
|
|
196
|
+
e ? this.select() : !e && this.selected && this.removeSelect();
|
|
197
|
+
}
|
|
198
|
+
_handleInitialFocusStatus() {
|
|
199
|
+
D(this.dp.focusDate, this.date, this.type) && this.focus();
|
|
200
|
+
}
|
|
201
|
+
get isDisabled() {
|
|
202
|
+
return this.$cell.matches(".-disabled-");
|
|
203
|
+
}
|
|
204
|
+
get isOtherMonth() {
|
|
205
|
+
return this.dp.isOtherMonth(this.date);
|
|
206
|
+
}
|
|
207
|
+
get isOtherDecade() {
|
|
208
|
+
return this.dp.isOtherDecade(this.date);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function M(r, e, t) {
|
|
212
|
+
return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
213
|
+
}
|
|
214
|
+
let fe = { [l.days]: '<div class="air-datepicker-body--day-names"></div>' + '<div class="air-datepicker-body--cells -'.concat(l.days, '-"></div>'), [l.months]: '<div class="air-datepicker-body--cells -'.concat(l.months, '-"></div>'), [l.years]: '<div class="air-datepicker-body--cells -'.concat(l.years, '-"></div>') };
|
|
215
|
+
const j = ".air-datepicker-cell";
|
|
216
|
+
class ne {
|
|
217
|
+
constructor(e) {
|
|
218
|
+
let { dp: t, type: i, opts: a } = e;
|
|
219
|
+
M(this, "handleClick", (n) => {
|
|
220
|
+
let s = n.target.closest(j).adpCell;
|
|
221
|
+
if (s.isDisabled)
|
|
222
|
+
return;
|
|
223
|
+
if (!this.dp.isMinViewReached)
|
|
224
|
+
return void this.dp.down();
|
|
225
|
+
let o = this.dp._checkIfDateIsSelected(s.date, s.type);
|
|
226
|
+
o ? this.dp._handleAlreadySelectedDates(o, s.date) : this.dp.selectDate(s.date);
|
|
227
|
+
}), M(this, "handleDayNameClick", (n) => {
|
|
228
|
+
let s = n.target.getAttribute("data-day-index");
|
|
229
|
+
this.opts.onClickDayName({ dayIndex: Number(s), datepicker: this.dp });
|
|
230
|
+
}), M(this, "onChangeCurrentView", (n) => {
|
|
231
|
+
n !== this.type ? this.hide() : (this.show(), this.render());
|
|
232
|
+
}), M(this, "onMouseOverCell", (n) => {
|
|
233
|
+
let s = U(n.target, j);
|
|
234
|
+
this.dp.setFocusDate(!!s && s.adpCell.date);
|
|
235
|
+
}), M(this, "onMouseOutCell", () => {
|
|
236
|
+
this.dp.setFocusDate(!1);
|
|
237
|
+
}), M(this, "onClickBody", (n) => {
|
|
238
|
+
let { onClickDayName: s } = this.opts, o = n.target;
|
|
239
|
+
o.closest(j) && this.handleClick(n), s && o.closest(".air-datepicker-body--day-name") && this.handleDayNameClick(n);
|
|
240
|
+
}), M(this, "onMouseDown", (n) => {
|
|
241
|
+
this.pressed = !0;
|
|
242
|
+
let s = U(n.target, j), o = s && s.adpCell;
|
|
243
|
+
D(o.date, this.dp.rangeDateFrom) && (this.rangeFromFocused = !0), D(o.date, this.dp.rangeDateTo) && (this.rangeToFocused = !0);
|
|
244
|
+
}), M(this, "onMouseMove", (n) => {
|
|
245
|
+
if (!this.pressed || !this.dp.isMinViewReached)
|
|
246
|
+
return;
|
|
247
|
+
n.preventDefault();
|
|
248
|
+
let s = U(n.target, j), o = s && s.adpCell, { selectedDates: h, rangeDateTo: d, rangeDateFrom: c } = this.dp;
|
|
249
|
+
if (!o || o.isDisabled)
|
|
250
|
+
return;
|
|
251
|
+
let { date: p } = o;
|
|
252
|
+
if (h.length === 2) {
|
|
253
|
+
if (this.rangeFromFocused && !F(p, d)) {
|
|
254
|
+
let { hours: u, minutes: f } = y(c);
|
|
255
|
+
p.setHours(u), p.setMinutes(f), this.dp.rangeDateFrom = p, this.dp.replaceDate(c, p);
|
|
256
|
+
}
|
|
257
|
+
if (this.rangeToFocused && !B(p, c)) {
|
|
258
|
+
let { hours: u, minutes: f } = y(d);
|
|
259
|
+
p.setHours(u), p.setMinutes(f), this.dp.rangeDateTo = p, this.dp.replaceDate(d, p);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}), M(this, "onMouseUp", () => {
|
|
263
|
+
this.pressed = !1, this.rangeFromFocused = !1, this.rangeToFocused = !1;
|
|
264
|
+
}), M(this, "onChangeViewDate", (n, s) => {
|
|
265
|
+
if (!this.isVisible)
|
|
266
|
+
return;
|
|
267
|
+
let o = A(n), h = A(s);
|
|
268
|
+
switch (this.dp.currentView) {
|
|
269
|
+
case l.days:
|
|
270
|
+
if (D(n, s, l.months))
|
|
271
|
+
return;
|
|
272
|
+
break;
|
|
273
|
+
case l.months:
|
|
274
|
+
if (D(n, s, l.years))
|
|
275
|
+
return;
|
|
276
|
+
break;
|
|
277
|
+
case l.years:
|
|
278
|
+
if (o[0] === h[0] && o[1] === h[1])
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
this.render();
|
|
282
|
+
}), M(this, "render", () => {
|
|
283
|
+
this.destroyCells(), this._generateCells(), this.cells.forEach((n) => {
|
|
284
|
+
this.$cells.appendChild(n.render());
|
|
285
|
+
});
|
|
286
|
+
}), this.dp = t, this.type = i, this.opts = a, this.cells = [], this.$el = "", this.pressed = !1, this.isVisible = !0, this.init();
|
|
287
|
+
}
|
|
288
|
+
init() {
|
|
289
|
+
this._buildBaseHtml(), this.type === l.days && this.renderDayNames(), this.render(), this._bindEvents(), this._bindDatepickerEvents();
|
|
290
|
+
}
|
|
291
|
+
_bindEvents() {
|
|
292
|
+
let { range: e, dynamicRange: t } = this.opts;
|
|
293
|
+
C(this.$el, "mouseover", this.onMouseOverCell), C(this.$el, "mouseout", this.onMouseOutCell), C(this.$el, "click", this.onClickBody), e && t && (C(this.$el, "mousedown", this.onMouseDown), C(this.$el, "mousemove", this.onMouseMove), C(window.document, "mouseup", this.onMouseUp));
|
|
294
|
+
}
|
|
295
|
+
_bindDatepickerEvents() {
|
|
296
|
+
this.dp.on(l.eventChangeViewDate, this.onChangeViewDate), this.dp.on(l.eventChangeCurrentView, this.onChangeCurrentView);
|
|
297
|
+
}
|
|
298
|
+
_buildBaseHtml() {
|
|
299
|
+
this.$el = _({ className: "air-datepicker-body -".concat(this.type, "-"), innerHtml: fe[this.type] }), this.$names = w(".air-datepicker-body--day-names", this.$el), this.$cells = w(".air-datepicker-body--cells", this.$el);
|
|
300
|
+
}
|
|
301
|
+
_getDayNamesHtml() {
|
|
302
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dp.locale.firstDay, t = "", i = this.dp.isWeekend, { onClickDayName: a } = this.opts, n = e, s = 0;
|
|
303
|
+
for (; s < 7; ) {
|
|
304
|
+
let o = n % 7, h = V("air-datepicker-body--day-name", { [l.cssClassWeekend]: i(o), "-clickable-": !!a }), d = this.dp.locale.daysMin[o];
|
|
305
|
+
t += '<div class="'.concat(h, `" data-day-index='`).concat(o, "'>").concat(d, "</div>"), s++, n++;
|
|
306
|
+
}
|
|
307
|
+
return t;
|
|
308
|
+
}
|
|
309
|
+
_getDaysCells() {
|
|
310
|
+
let { viewDate: e, locale: { firstDay: t } } = this.dp, i = ae(e), { year: a, month: n } = y(e), s = new Date(a, n, 1), o = new Date(a, n, i), h = s.getDay() - t, d = 6 - o.getDay() + t;
|
|
311
|
+
h = h < 0 ? h + 7 : h, d = d > 6 ? d - 7 : d;
|
|
312
|
+
let c = function(z, Y) {
|
|
313
|
+
let { year: W, month: K, date: q } = y(z);
|
|
314
|
+
return new Date(W, K, q - Y);
|
|
315
|
+
}(s, h), p = i + h + d, u = c.getDate(), { year: f, month: k } = y(c), S = 0;
|
|
316
|
+
for (; S < p; ) {
|
|
317
|
+
let z = new Date(f, k, u + S);
|
|
318
|
+
this._generateCell(z), S++;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
_generateCell(e) {
|
|
322
|
+
let { type: t, dp: i, opts: a } = this, n = new ve({ type: t, dp: i, opts: a, date: e, body: this });
|
|
323
|
+
return this.cells.push(n), n;
|
|
324
|
+
}
|
|
325
|
+
_generateDayCells() {
|
|
326
|
+
this._getDaysCells();
|
|
327
|
+
}
|
|
328
|
+
_generateMonthCells() {
|
|
329
|
+
let { year: e } = this.dp.parsedViewDate, t = 0;
|
|
330
|
+
for (; t < 12; )
|
|
331
|
+
this.cells.push(this._generateCell(new Date(e, t))), t++;
|
|
332
|
+
}
|
|
333
|
+
_generateYearCells() {
|
|
334
|
+
let e = A(this.dp.viewDate), t = e[0] - 1, i = e[1] + 1, a = t;
|
|
335
|
+
for (; a <= i; )
|
|
336
|
+
this.cells.push(this._generateCell(new Date(a, 0))), a++;
|
|
337
|
+
}
|
|
338
|
+
renderDayNames() {
|
|
339
|
+
this.$names.innerHTML = this._getDayNamesHtml();
|
|
340
|
+
}
|
|
341
|
+
_generateCells() {
|
|
342
|
+
switch (this.type) {
|
|
343
|
+
case l.days:
|
|
344
|
+
this._generateDayCells();
|
|
345
|
+
break;
|
|
346
|
+
case l.months:
|
|
347
|
+
this._generateMonthCells();
|
|
348
|
+
break;
|
|
349
|
+
case l.years:
|
|
350
|
+
this._generateYearCells();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
show() {
|
|
354
|
+
this.isVisible = !0, this.$el.classList.remove("-hidden-");
|
|
355
|
+
}
|
|
356
|
+
hide() {
|
|
357
|
+
this.isVisible = !1, this.$el.classList.add("-hidden-");
|
|
358
|
+
}
|
|
359
|
+
destroyCells() {
|
|
360
|
+
this.cells.forEach((e) => e.destroy()), this.cells = [], this.$cells.innerHTML = "";
|
|
361
|
+
}
|
|
362
|
+
destroy() {
|
|
363
|
+
this.destroyCells(), this.dp.off(l.eventChangeViewDate, this.onChangeViewDate), this.dp.off(l.eventChangeCurrentView, this.onChangeCurrentView);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function O(r, e, t) {
|
|
367
|
+
return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
368
|
+
}
|
|
369
|
+
class ye {
|
|
370
|
+
constructor(e) {
|
|
371
|
+
let { dp: t, opts: i } = e;
|
|
372
|
+
O(this, "onClickNav", (a) => {
|
|
373
|
+
let n = U(a.target, ".air-datepicker-nav--action");
|
|
374
|
+
if (!n)
|
|
375
|
+
return;
|
|
376
|
+
let s = n.dataset.action;
|
|
377
|
+
this.dp[s]();
|
|
378
|
+
}), O(this, "onChangeViewDate", () => {
|
|
379
|
+
this.render(), this._resetNavStatus(), this.handleNavStatus();
|
|
380
|
+
}), O(this, "onChangeCurrentView", () => {
|
|
381
|
+
this.render(), this._resetNavStatus(), this.handleNavStatus();
|
|
382
|
+
}), O(this, "onClickNavTitle", () => {
|
|
383
|
+
this.dp.isFinalView || this.dp.up();
|
|
384
|
+
}), O(this, "update", () => {
|
|
385
|
+
let { prevHtml: a, nextHtml: n } = this.opts;
|
|
386
|
+
this.$prev.innerHTML = a, this.$next.innerHTML = n, this._resetNavStatus(), this.render(), this.handleNavStatus();
|
|
387
|
+
}), O(this, "renderDelay", () => {
|
|
388
|
+
setTimeout(this.render);
|
|
389
|
+
}), O(this, "render", () => {
|
|
390
|
+
this.$title.innerHTML = this._getTitle(), function(a, n) {
|
|
391
|
+
for (let s in n)
|
|
392
|
+
n[s] ? a.classList.add(s) : a.classList.remove(s);
|
|
393
|
+
}(this.$title, { "-disabled-": this.dp.isFinalView });
|
|
394
|
+
}), this.dp = t, this.opts = i, this.init();
|
|
395
|
+
}
|
|
396
|
+
init() {
|
|
397
|
+
this._createElement(), this._buildBaseHtml(), this._defineDOM(), this.render(), this.handleNavStatus(), this._bindEvents(), this._bindDatepickerEvents();
|
|
398
|
+
}
|
|
399
|
+
_defineDOM() {
|
|
400
|
+
this.$title = w(".air-datepicker-nav--title", this.$el), this.$prev = w('[data-action="prev"]', this.$el), this.$next = w('[data-action="next"]', this.$el);
|
|
401
|
+
}
|
|
402
|
+
_bindEvents() {
|
|
403
|
+
this.$el.addEventListener("click", this.onClickNav), this.$title.addEventListener("click", this.onClickNavTitle);
|
|
404
|
+
}
|
|
405
|
+
_bindDatepickerEvents() {
|
|
406
|
+
this.dp.on(l.eventChangeViewDate, this.onChangeViewDate), this.dp.on(l.eventChangeCurrentView, this.onChangeCurrentView), this.isNavIsFunction && (this.dp.on(l.eventChangeSelectedDate, this.renderDelay), this.dp.opts.timepicker && this.dp.on(l.eventChangeTime, this.render));
|
|
407
|
+
}
|
|
408
|
+
destroy() {
|
|
409
|
+
this.dp.off(l.eventChangeViewDate, this.onChangeViewDate), this.dp.off(l.eventChangeCurrentView, this.onChangeCurrentView), this.isNavIsFunction && (this.dp.off(l.eventChangeSelectedDate, this.renderDelay), this.dp.opts.timepicker && this.dp.off(l.eventChangeTime, this.render));
|
|
410
|
+
}
|
|
411
|
+
_createElement() {
|
|
412
|
+
this.$el = _({ tagName: "nav", className: "air-datepicker-nav" });
|
|
413
|
+
}
|
|
414
|
+
_getTitle() {
|
|
415
|
+
let { dp: e, opts: t } = this, i = t.navTitles[e.currentView];
|
|
416
|
+
return typeof i == "function" ? i(e) : e.formatDate(e.viewDate, i);
|
|
417
|
+
}
|
|
418
|
+
handleNavStatus() {
|
|
419
|
+
let { disableNavWhenOutOfRange: e } = this.opts, { minDate: t, maxDate: i } = this.dp;
|
|
420
|
+
if (!t && !i || !e)
|
|
421
|
+
return;
|
|
422
|
+
let { year: a, month: n } = this.dp.parsedViewDate, s = !!t && y(t), o = !!i && y(i);
|
|
423
|
+
switch (this.dp.currentView) {
|
|
424
|
+
case l.days:
|
|
425
|
+
t && s.month >= n && s.year >= a && this._disableNav("prev"), i && o.month <= n && o.year <= a && this._disableNav("next");
|
|
426
|
+
break;
|
|
427
|
+
case l.months:
|
|
428
|
+
t && s.year >= a && this._disableNav("prev"), i && o.year <= a && this._disableNav("next");
|
|
429
|
+
break;
|
|
430
|
+
case l.years: {
|
|
431
|
+
let h = A(this.dp.viewDate);
|
|
432
|
+
t && s.year >= h[0] && this._disableNav("prev"), i && o.year <= h[1] && this._disableNav("next");
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
_disableNav(e) {
|
|
438
|
+
w('[data-action="' + e + '"]', this.$el).classList.add("-disabled-");
|
|
439
|
+
}
|
|
440
|
+
_resetNavStatus() {
|
|
441
|
+
(function(e) {
|
|
442
|
+
for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), a = 1; a < t; a++)
|
|
443
|
+
i[a - 1] = arguments[a];
|
|
444
|
+
e.length ? e.forEach((n) => {
|
|
445
|
+
n.classList.remove(...i);
|
|
446
|
+
}) : e.classList.remove(...i);
|
|
447
|
+
})(this.$el.querySelectorAll(".air-datepicker-nav--action"), "-disabled-");
|
|
448
|
+
}
|
|
449
|
+
_buildBaseHtml() {
|
|
450
|
+
let { prevHtml: e, nextHtml: t } = this.opts;
|
|
451
|
+
this.$el.innerHTML = '<div class="air-datepicker-nav--action" data-action="prev">'.concat(e, "</div>") + '<div class="air-datepicker-nav--title"></div>' + '<div class="air-datepicker-nav--action" data-action="next">'.concat(t, "</div>");
|
|
452
|
+
}
|
|
453
|
+
get isNavIsFunction() {
|
|
454
|
+
let { navTitles: e } = this.opts;
|
|
455
|
+
return Object.keys(e).find((t) => typeof e[t] == "function");
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
var re = { today: { content: (r) => r.locale.today, onClick: (r) => r.setViewDate(new Date()) }, clear: { content: (r) => r.locale.clear, onClick: (r) => r.clear() } };
|
|
459
|
+
class De {
|
|
460
|
+
constructor(e) {
|
|
461
|
+
let { dp: t, opts: i } = e;
|
|
462
|
+
this.dp = t, this.opts = i, this.init();
|
|
463
|
+
}
|
|
464
|
+
init() {
|
|
465
|
+
this.createElement(), this.render();
|
|
466
|
+
}
|
|
467
|
+
createElement() {
|
|
468
|
+
this.$el = _({ className: "air-datepicker-buttons" });
|
|
469
|
+
}
|
|
470
|
+
destroy() {
|
|
471
|
+
this.$el.parentNode.removeChild(this.$el);
|
|
472
|
+
}
|
|
473
|
+
clearHtml() {
|
|
474
|
+
return this.$el.innerHTML = "", this;
|
|
475
|
+
}
|
|
476
|
+
generateButtons() {
|
|
477
|
+
let { buttons: e } = this.opts;
|
|
478
|
+
Array.isArray(e) || (e = [e]), e.forEach((t) => {
|
|
479
|
+
let i = t;
|
|
480
|
+
typeof t == "string" && re[t] && (i = re[t]);
|
|
481
|
+
let a = this.createButton(i);
|
|
482
|
+
i.onClick && this.attachEventToButton(a, i.onClick), this.$el.appendChild(a);
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
attachEventToButton(e, t) {
|
|
486
|
+
e.addEventListener("click", () => {
|
|
487
|
+
t(this.dp);
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
createButton(e) {
|
|
491
|
+
let { content: t, className: i, tagName: a = "button", attrs: n = {} } = e, s = typeof t == "function" ? t(this.dp) : t;
|
|
492
|
+
return _({ tagName: a, innerHtml: "<span tabindex='-1'>".concat(s, "</span>"), className: V("air-datepicker-button", i), attrs: n });
|
|
493
|
+
}
|
|
494
|
+
render() {
|
|
495
|
+
this.generateButtons();
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
function N(r, e, t) {
|
|
499
|
+
return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
500
|
+
}
|
|
501
|
+
class be {
|
|
502
|
+
constructor() {
|
|
503
|
+
let { opts: e, dp: t } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
504
|
+
N(this, "toggleTimepickerIsActive", (a) => {
|
|
505
|
+
this.dp.timepickerIsActive = a;
|
|
506
|
+
}), N(this, "onChangeSelectedDate", (a) => {
|
|
507
|
+
let { date: n, updateTime: s = !1 } = a;
|
|
508
|
+
n && (this.setMinMaxTime(n), this.setCurrentTime(!!s && n), this.addTimeToDate(n));
|
|
509
|
+
}), N(this, "onChangeLastSelectedDate", (a) => {
|
|
510
|
+
a && (this.setTime(a), this.render());
|
|
511
|
+
}), N(this, "onChangeInputRange", (a) => {
|
|
512
|
+
let n = a.target;
|
|
513
|
+
this[n.getAttribute("name")] = n.value, this.updateText(), this.dp.trigger(l.eventChangeTime, { hours: this.hours, minutes: this.minutes });
|
|
514
|
+
}), N(this, "onMouseEnterLeave", (a) => {
|
|
515
|
+
let n = a.target.getAttribute("name"), s = this.$minutesText;
|
|
516
|
+
n === "hours" && (s = this.$hoursText), s.classList.toggle("-focus-");
|
|
517
|
+
}), N(this, "onFocus", () => {
|
|
518
|
+
this.toggleTimepickerIsActive(!0);
|
|
519
|
+
}), N(this, "onBlur", () => {
|
|
520
|
+
this.toggleTimepickerIsActive(!1);
|
|
521
|
+
}), this.opts = e, this.dp = t;
|
|
522
|
+
let { timeFormat: i } = this.dp.locale;
|
|
523
|
+
i && (i.match(Q("h")) || i.match(Q("hh"))) && (this.ampm = !0), this.init();
|
|
524
|
+
}
|
|
525
|
+
init() {
|
|
526
|
+
this.setTime(this.dp.lastSelectedDate || this.dp.viewDate), this.createElement(), this.buildHtml(), this.defineDOM(), this.render(), this.bindDatepickerEvents(), this.bindDOMEvents();
|
|
527
|
+
}
|
|
528
|
+
bindDatepickerEvents() {
|
|
529
|
+
this.dp.on(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.on(l.eventChangeLastSelectedDate, this.onChangeLastSelectedDate);
|
|
530
|
+
}
|
|
531
|
+
bindDOMEvents() {
|
|
532
|
+
let e = "input";
|
|
533
|
+
navigator.userAgent.match(/trident/gi) && (e = "change"), C(this.$ranges, e, this.onChangeInputRange), C(this.$ranges, "mouseenter", this.onMouseEnterLeave), C(this.$ranges, "mouseleave", this.onMouseEnterLeave), C(this.$ranges, "focus", this.onFocus), C(this.$ranges, "mousedown", this.onFocus), C(this.$ranges, "blur", this.onBlur);
|
|
534
|
+
}
|
|
535
|
+
createElement() {
|
|
536
|
+
this.$el = _({ className: V("air-datepicker-time", { "-am-pm-": this.dp.ampm }) });
|
|
537
|
+
}
|
|
538
|
+
destroy() {
|
|
539
|
+
this.dp.off(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.off(l.eventChangeLastSelectedDate, this.onChangeLastSelectedDate), this.$el.parentNode.removeChild(this.$el);
|
|
540
|
+
}
|
|
541
|
+
buildHtml() {
|
|
542
|
+
let { ampm: e, hours: t, displayHours: i, minutes: a, minHours: n, minMinutes: s, maxHours: o, maxMinutes: h, dayPeriod: d, opts: { hoursStep: c, minutesStep: p } } = this;
|
|
543
|
+
this.$el.innerHTML = '<div class="air-datepicker-time--current">' + ' <span class="air-datepicker-time--current-hours">'.concat(P(i), "</span>") + ' <span class="air-datepicker-time--current-colon">:</span>' + ' <span class="air-datepicker-time--current-minutes">'.concat(P(a), "</span>") + " ".concat(e ? "<span class='air-datepicker-time--current-ampm'>".concat(d, "</span>") : "") + '</div><div class="air-datepicker-time--sliders"> <div class="air-datepicker-time--row">' + ' <input type="range" name="hours" value="'.concat(t, '" min="').concat(n, '" max="').concat(o, '" step="').concat(c, '"/>') + ' </div> <div class="air-datepicker-time--row">' + ' <input type="range" name="minutes" value="'.concat(a, '" min="').concat(s, '" max="').concat(h, '" step="').concat(p, '"/>') + " </div></div>";
|
|
544
|
+
}
|
|
545
|
+
defineDOM() {
|
|
546
|
+
let e = (t) => w(t, this.$el);
|
|
547
|
+
this.$ranges = this.$el.querySelectorAll('[type="range"]'), this.$hours = e('[name="hours"]'), this.$minutes = e('[name="minutes"]'), this.$hoursText = e(".air-datepicker-time--current-hours"), this.$minutesText = e(".air-datepicker-time--current-minutes"), this.$ampm = e(".air-datepicker-time--current-ampm");
|
|
548
|
+
}
|
|
549
|
+
setTime(e) {
|
|
550
|
+
this.setMinMaxTime(e), this.setCurrentTime(e);
|
|
551
|
+
}
|
|
552
|
+
addTimeToDate(e) {
|
|
553
|
+
e && (e.setHours(this.hours), e.setMinutes(this.minutes));
|
|
554
|
+
}
|
|
555
|
+
setMinMaxTime(e) {
|
|
556
|
+
if (this.setMinMaxTimeFromOptions(), e) {
|
|
557
|
+
let { minDate: t, maxDate: i } = this.dp;
|
|
558
|
+
t && D(e, t) && this.setMinTimeFromMinDate(t), i && D(e, i) && this.setMaxTimeFromMaxDate(i);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
setCurrentTime(e) {
|
|
562
|
+
let { hours: t, minutes: i } = e ? y(e) : this;
|
|
563
|
+
this.hours = R(t, this.minHours, this.maxHours), this.minutes = R(i, this.minMinutes, this.maxMinutes);
|
|
564
|
+
}
|
|
565
|
+
setMinMaxTimeFromOptions() {
|
|
566
|
+
let { minHours: e, minMinutes: t, maxHours: i, maxMinutes: a } = this.opts;
|
|
567
|
+
this.minHours = R(e, 0, 23), this.minMinutes = R(t, 0, 59), this.maxHours = R(i, 0, 23), this.maxMinutes = R(a, 0, 59);
|
|
568
|
+
}
|
|
569
|
+
setMinTimeFromMinDate(e) {
|
|
570
|
+
let { lastSelectedDate: t } = this.dp;
|
|
571
|
+
this.minHours = e.getHours(), t && t.getHours() > e.getHours() ? this.minMinutes = this.opts.minMinutes : this.minMinutes = e.getMinutes();
|
|
572
|
+
}
|
|
573
|
+
setMaxTimeFromMaxDate(e) {
|
|
574
|
+
let { lastSelectedDate: t } = this.dp;
|
|
575
|
+
this.maxHours = e.getHours(), t && t.getHours() < e.getHours() ? this.maxMinutes = this.opts.maxMinutes : this.maxMinutes = e.getMinutes();
|
|
576
|
+
}
|
|
577
|
+
getDayPeriod(e, t) {
|
|
578
|
+
let i = e, a = Number(e);
|
|
579
|
+
e instanceof Date && (i = y(e), a = Number(i.hours));
|
|
580
|
+
let n = "am";
|
|
581
|
+
if (t || this.ampm) {
|
|
582
|
+
switch (!0) {
|
|
583
|
+
case a === 12:
|
|
584
|
+
case a > 11:
|
|
585
|
+
n = "pm";
|
|
586
|
+
}
|
|
587
|
+
a = a % 12 == 0 ? 12 : a % 12;
|
|
588
|
+
}
|
|
589
|
+
return { hours: a, dayPeriod: n };
|
|
590
|
+
}
|
|
591
|
+
updateSliders() {
|
|
592
|
+
G(this.$hours, { min: this.minHours, max: this.maxHours }).value = this.hours, G(this.$minutes, { min: this.minMinutes, max: this.maxMinutes }).value = this.minutes;
|
|
593
|
+
}
|
|
594
|
+
updateText() {
|
|
595
|
+
this.$hoursText.innerHTML = P(this.displayHours), this.$minutesText.innerHTML = P(this.minutes), this.ampm && (this.$ampm.innerHTML = this.dayPeriod);
|
|
596
|
+
}
|
|
597
|
+
set hours(e) {
|
|
598
|
+
this._hours = e;
|
|
599
|
+
let { hours: t, dayPeriod: i } = this.getDayPeriod(e);
|
|
600
|
+
this.displayHours = t, this.dayPeriod = i;
|
|
601
|
+
}
|
|
602
|
+
get hours() {
|
|
603
|
+
return this._hours;
|
|
604
|
+
}
|
|
605
|
+
render() {
|
|
606
|
+
this.updateSliders(), this.updateText();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
function I(r, e, t) {
|
|
610
|
+
return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
611
|
+
}
|
|
612
|
+
class we {
|
|
613
|
+
constructor(e) {
|
|
614
|
+
let { dp: t, opts: i } = e;
|
|
615
|
+
I(this, "pressedKeys", /* @__PURE__ */ new Set()), I(this, "hotKeys", /* @__PURE__ */ new Map([[[["Control", "ArrowRight"], ["Control", "ArrowUp"]], (a) => a.month++], [[["Control", "ArrowLeft"], ["Control", "ArrowDown"]], (a) => a.month--], [[["Shift", "ArrowRight"], ["Shift", "ArrowUp"]], (a) => a.year++], [[["Shift", "ArrowLeft"], ["Shift", "ArrowDown"]], (a) => a.year--], [[["Alt", "ArrowRight"], ["Alt", "ArrowUp"]], (a) => a.year += 10], [[["Alt", "ArrowLeft"], ["Alt", "ArrowDown"]], (a) => a.year -= 10], [["Control", "Shift", "ArrowUp"], (a, n) => n.up()]])), I(this, "handleHotKey", (a) => {
|
|
616
|
+
let n = this.hotKeys.get(a), s = y(this.getInitialFocusDate());
|
|
617
|
+
n(s, this.dp);
|
|
618
|
+
let { year: o, month: h, date: d } = s, c = ae(new Date(o, h));
|
|
619
|
+
c < d && (d = c);
|
|
620
|
+
let p = this.dp.getClampedDate(new Date(o, h, d));
|
|
621
|
+
this.dp.setFocusDate(p, { viewDateTransition: !0 });
|
|
622
|
+
}), I(this, "isHotKeyPressed", () => {
|
|
623
|
+
let a = !1, n = this.pressedKeys.size, s = (o) => this.pressedKeys.has(o);
|
|
624
|
+
for (let [o] of this.hotKeys) {
|
|
625
|
+
if (a)
|
|
626
|
+
break;
|
|
627
|
+
if (Array.isArray(o[0]))
|
|
628
|
+
o.forEach((h) => {
|
|
629
|
+
a || n !== h.length || (a = h.every(s) && o);
|
|
630
|
+
});
|
|
631
|
+
else {
|
|
632
|
+
if (n !== o.length)
|
|
633
|
+
continue;
|
|
634
|
+
a = o.every(s) && o;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return a;
|
|
638
|
+
}), I(this, "isArrow", (a) => a >= 37 && a <= 40), I(this, "onKeyDown", (a) => {
|
|
639
|
+
let { key: n, which: s } = a, { dp: o, dp: { focusDate: h }, opts: d } = this;
|
|
640
|
+
this.registerKey(n);
|
|
641
|
+
let c = this.isHotKeyPressed();
|
|
642
|
+
if (c)
|
|
643
|
+
return a.preventDefault(), void this.handleHotKey(c);
|
|
644
|
+
if (this.isArrow(s))
|
|
645
|
+
return a.preventDefault(), void this.focusNextCell(n);
|
|
646
|
+
if (n === "Enter") {
|
|
647
|
+
if (o.currentView !== d.minView)
|
|
648
|
+
return void o.down();
|
|
649
|
+
if (h) {
|
|
650
|
+
let p = o._checkIfDateIsSelected(h);
|
|
651
|
+
return void (p ? o._handleAlreadySelectedDates(p, h) : o.selectDate(h));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
n === "Escape" && this.dp.hide();
|
|
655
|
+
}), I(this, "onKeyUp", (a) => {
|
|
656
|
+
this.removeKey(a.key);
|
|
657
|
+
}), this.dp = t, this.opts = i, this.init();
|
|
658
|
+
}
|
|
659
|
+
init() {
|
|
660
|
+
this.bindKeyboardEvents();
|
|
661
|
+
}
|
|
662
|
+
bindKeyboardEvents() {
|
|
663
|
+
let { $el: e } = this.dp;
|
|
664
|
+
e.addEventListener("keydown", this.onKeyDown), e.addEventListener("keyup", this.onKeyUp);
|
|
665
|
+
}
|
|
666
|
+
destroy() {
|
|
667
|
+
let { $el: e } = this.dp;
|
|
668
|
+
e.removeEventListener("keydown", this.onKeyDown), e.removeEventListener("keyup", this.onKeyUp), this.hotKeys = null, this.pressedKeys = null;
|
|
669
|
+
}
|
|
670
|
+
getInitialFocusDate() {
|
|
671
|
+
let { focusDate: e, currentView: t, selectedDates: i, parsedViewDate: { year: a, month: n } } = this.dp, s = e || i[i.length - 1];
|
|
672
|
+
if (!s)
|
|
673
|
+
switch (t) {
|
|
674
|
+
case l.days:
|
|
675
|
+
s = new Date(a, n, new Date().getDate());
|
|
676
|
+
break;
|
|
677
|
+
case l.months:
|
|
678
|
+
s = new Date(a, n, 1);
|
|
679
|
+
break;
|
|
680
|
+
case l.years:
|
|
681
|
+
s = new Date(a, 0, 1);
|
|
682
|
+
}
|
|
683
|
+
return s;
|
|
684
|
+
}
|
|
685
|
+
focusNextCell(e) {
|
|
686
|
+
let t = this.getInitialFocusDate(), { currentView: i } = this.dp, { days: a, months: n, years: s } = l, o = y(t), h = o.year, d = o.month, c = o.date;
|
|
687
|
+
switch (e) {
|
|
688
|
+
case "ArrowLeft":
|
|
689
|
+
i === a && (c -= 1), i === n && (d -= 1), i === s && (h -= 1);
|
|
690
|
+
break;
|
|
691
|
+
case "ArrowUp":
|
|
692
|
+
i === a && (c -= 7), i === n && (d -= 3), i === s && (h -= 4);
|
|
693
|
+
break;
|
|
694
|
+
case "ArrowRight":
|
|
695
|
+
i === a && (c += 1), i === n && (d += 1), i === s && (h += 1);
|
|
696
|
+
break;
|
|
697
|
+
case "ArrowDown":
|
|
698
|
+
i === a && (c += 7), i === n && (d += 3), i === s && (h += 4);
|
|
699
|
+
}
|
|
700
|
+
let p = this.dp.getClampedDate(new Date(h, d, c));
|
|
701
|
+
this.dp.setFocusDate(p, { viewDateTransition: !0 });
|
|
702
|
+
}
|
|
703
|
+
registerKey(e) {
|
|
704
|
+
this.pressedKeys.add(e);
|
|
705
|
+
}
|
|
706
|
+
removeKey(e) {
|
|
707
|
+
this.pressedKeys.delete(e);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
let ke = { on(r, e) {
|
|
711
|
+
this.__events || (this.__events = {}), this.__events[r] ? this.__events[r].push(e) : this.__events[r] = [e];
|
|
712
|
+
}, off(r, e) {
|
|
713
|
+
this.__events && this.__events[r] && (this.__events[r] = this.__events[r].filter((t) => t !== e));
|
|
714
|
+
}, removeAllEvents() {
|
|
715
|
+
this.__events = {};
|
|
716
|
+
}, trigger(r) {
|
|
717
|
+
for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++)
|
|
718
|
+
t[i - 1] = arguments[i];
|
|
719
|
+
this.__events && this.__events[r] && this.__events[r].forEach((a) => {
|
|
720
|
+
a(...t);
|
|
721
|
+
});
|
|
722
|
+
} };
|
|
723
|
+
function g(r, e, t) {
|
|
724
|
+
return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
725
|
+
}
|
|
726
|
+
let ee = "", J = "", H = "", oe = !1;
|
|
727
|
+
class E {
|
|
728
|
+
constructor(e, t) {
|
|
729
|
+
var i = this;
|
|
730
|
+
if (g(this, "viewIndexes", [l.days, l.months, l.years]), g(this, "next", () => {
|
|
731
|
+
let { year: s, month: o } = this.parsedViewDate;
|
|
732
|
+
switch (this.currentView) {
|
|
733
|
+
case l.days:
|
|
734
|
+
this.setViewDate(new Date(s, o + 1, 1));
|
|
735
|
+
break;
|
|
736
|
+
case l.months:
|
|
737
|
+
this.setViewDate(new Date(s + 1, o, 1));
|
|
738
|
+
break;
|
|
739
|
+
case l.years:
|
|
740
|
+
this.setViewDate(new Date(s + 10, 0, 1));
|
|
741
|
+
}
|
|
742
|
+
}), g(this, "prev", () => {
|
|
743
|
+
let { year: s, month: o } = this.parsedViewDate;
|
|
744
|
+
switch (this.currentView) {
|
|
745
|
+
case l.days:
|
|
746
|
+
this.setViewDate(new Date(s, o - 1, 1));
|
|
747
|
+
break;
|
|
748
|
+
case l.months:
|
|
749
|
+
this.setViewDate(new Date(s - 1, o, 1));
|
|
750
|
+
break;
|
|
751
|
+
case l.years:
|
|
752
|
+
this.setViewDate(new Date(s - 10, 0, 1));
|
|
753
|
+
}
|
|
754
|
+
}), g(this, "_finishHide", () => {
|
|
755
|
+
this.hideAnimation = !1, this._destroyComponents(), this.$container.removeChild(this.$datepicker);
|
|
756
|
+
}), g(this, "setPosition", function(s) {
|
|
757
|
+
let o = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
|
|
758
|
+
if (typeof (s = s || i.opts.position) == "function")
|
|
759
|
+
return void (i.customHide = s({ $datepicker: i.$datepicker, $target: i.$el, $pointer: i.$pointer, isViewChange: o, done: i._finishHide }));
|
|
760
|
+
let h, d, { isMobile: c } = i.opts, p = i.$el.getBoundingClientRect(), u = i.$el.getBoundingClientRect(), f = i.$datepicker.offsetParent, k = i.$el.offsetParent, S = i.$datepicker.getBoundingClientRect(), z = s.split(" "), Y = window.scrollY, W = window.scrollX, K = i.opts.offset, q = z[0], Ce = z[1];
|
|
761
|
+
if (c)
|
|
762
|
+
i.$datepicker.style.cssText = "left: 50%; top: 50%";
|
|
763
|
+
else {
|
|
764
|
+
if (f === k && f !== document.body && (u = { top: i.$el.offsetTop, left: i.$el.offsetLeft, width: p.width, height: i.$el.offsetHeight }, Y = 0, W = 0), f !== k && f !== document.body) {
|
|
765
|
+
let le = f.getBoundingClientRect();
|
|
766
|
+
u = { top: p.top - le.top, left: p.left - le.left, width: p.width, height: p.height }, Y = 0, W = 0;
|
|
767
|
+
}
|
|
768
|
+
switch (q) {
|
|
769
|
+
case "top":
|
|
770
|
+
h = u.top - S.height - K;
|
|
771
|
+
break;
|
|
772
|
+
case "right":
|
|
773
|
+
d = u.left + u.width + K;
|
|
774
|
+
break;
|
|
775
|
+
case "bottom":
|
|
776
|
+
h = u.top + u.height + K;
|
|
777
|
+
break;
|
|
778
|
+
case "left":
|
|
779
|
+
d = u.left - S.width - K;
|
|
780
|
+
}
|
|
781
|
+
switch (Ce) {
|
|
782
|
+
case "top":
|
|
783
|
+
h = u.top;
|
|
784
|
+
break;
|
|
785
|
+
case "right":
|
|
786
|
+
d = u.left + u.width - S.width;
|
|
787
|
+
break;
|
|
788
|
+
case "bottom":
|
|
789
|
+
h = u.top + u.height - S.height;
|
|
790
|
+
break;
|
|
791
|
+
case "left":
|
|
792
|
+
d = u.left;
|
|
793
|
+
break;
|
|
794
|
+
case "center":
|
|
795
|
+
/left|right/.test(q) ? h = u.top + u.height / 2 - S.height / 2 : d = u.left + u.width / 2 - S.width / 2;
|
|
796
|
+
}
|
|
797
|
+
i.$datepicker.style.cssText = "left: ".concat(d + W, "px; top: ").concat(h + Y, "px");
|
|
798
|
+
}
|
|
799
|
+
}), g(this, "_setInputValue", () => {
|
|
800
|
+
let { opts: s, $altField: o, locale: { dateFormat: h } } = this, { altFieldDateFormat: d, altField: c } = s;
|
|
801
|
+
c && o && (o.value = this._getInputValue(d)), this.$el.value = this._getInputValue(h);
|
|
802
|
+
}), g(this, "_getInputValue", (s) => {
|
|
803
|
+
let { selectedDates: o, opts: h } = this, { multipleDates: d, multipleDatesSeparator: c } = h;
|
|
804
|
+
if (!o.length)
|
|
805
|
+
return "";
|
|
806
|
+
let p = typeof s == "function", u = p ? s(d ? o : o[0]) : o.map((f) => this.formatDate(f, s));
|
|
807
|
+
return u = p ? u : u.join(c), u;
|
|
808
|
+
}), g(this, "_checkIfDateIsSelected", function(s) {
|
|
809
|
+
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l.days, h = !1;
|
|
810
|
+
return i.selectedDates.some((d) => {
|
|
811
|
+
let c = D(s, d, o);
|
|
812
|
+
return h = c && d, c;
|
|
813
|
+
}), h;
|
|
814
|
+
}), g(this, "_scheduleCallAfterTransition", (s) => {
|
|
815
|
+
this._cancelScheduledCall(), s && s(!1), this._onTransitionEnd = () => {
|
|
816
|
+
s && s(!0);
|
|
817
|
+
}, this.$datepicker.addEventListener("transitionend", this._onTransitionEnd, { once: !0 });
|
|
818
|
+
}), g(this, "_cancelScheduledCall", () => {
|
|
819
|
+
this.$datepicker.removeEventListener("transitionend", this._onTransitionEnd);
|
|
820
|
+
}), g(this, "setViewDate", (s) => {
|
|
821
|
+
if (!((s = x(s)) instanceof Date) || D(s, this.viewDate))
|
|
822
|
+
return;
|
|
823
|
+
let o = this.viewDate;
|
|
824
|
+
this.viewDate = s;
|
|
825
|
+
let { onChangeViewDate: h } = this.opts;
|
|
826
|
+
if (h) {
|
|
827
|
+
let { month: d, year: c } = this.parsedViewDate;
|
|
828
|
+
h({ month: d, year: c, decade: this.curDecade });
|
|
829
|
+
}
|
|
830
|
+
this.trigger(l.eventChangeViewDate, s, o);
|
|
831
|
+
}), g(this, "setFocusDate", function(s) {
|
|
832
|
+
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
833
|
+
(!s || (s = x(s)) instanceof Date) && (i.focusDate = s, i.opts.range && s && i._handleRangeOnFocus(), i.trigger(l.eventChangeFocusDate, s, o));
|
|
834
|
+
}), g(this, "setCurrentView", (s) => {
|
|
835
|
+
if (this.viewIndexes.includes(s)) {
|
|
836
|
+
if (this.currentView = s, this.elIsInput && this.visible && this.setPosition(void 0, !0), this.trigger(l.eventChangeCurrentView, s), !this.views[s]) {
|
|
837
|
+
let o = this.views[s] = new ne({ dp: this, opts: this.opts, type: s });
|
|
838
|
+
this.shouldUpdateDOM && this.$content.appendChild(o.$el);
|
|
839
|
+
}
|
|
840
|
+
this.opts.onChangeView && this.opts.onChangeView(s);
|
|
841
|
+
}
|
|
842
|
+
}), g(this, "_updateLastSelectedDate", (s) => {
|
|
843
|
+
this.lastSelectedDate = s, this.trigger(l.eventChangeLastSelectedDate, s);
|
|
844
|
+
}), g(this, "destroy", () => {
|
|
845
|
+
let { showEvent: s, isMobile: o } = this.opts, h = this.$datepicker.parentNode;
|
|
846
|
+
h && h.removeChild(this.$datepicker), this.$el.removeEventListener(s, this._onFocus), this.$el.removeEventListener("blur", this._onBlur), window.removeEventListener("resize", this._onResize), o && this._removeMobileAttributes(), this.keyboardNav && this.keyboardNav.destroy(), this.views = null, this.nav = null, this.$datepicker = null, this.opts = null, this.$customContainer = null, this.viewDate = null, this.focusDate = null, this.selectedDates = null, this.rangeDateFrom = null, this.rangeDateTo = null;
|
|
847
|
+
}), g(this, "update", (s) => {
|
|
848
|
+
let o = Z({}, this.opts);
|
|
849
|
+
Z(this.opts, s);
|
|
850
|
+
let { timepicker: h, buttons: d, range: c, selectedDates: p, isMobile: u } = this.opts, f = this.visible || this.treatAsInline;
|
|
851
|
+
this._createMinMaxDates(), this._limitViewDateByMaxMinDates(), this._handleLocale(), !o.selectedDates && p && this.selectDate(p), s.view && this.setCurrentView(s.view), this._setInputValue(), o.range && !c ? (this.rangeDateTo = !1, this.rangeDateFrom = !1) : !o.range && c && this.selectedDates.length && (this.rangeDateFrom = this.selectedDates[0], this.rangeDateTo = this.selectedDates[1]), o.timepicker && !h ? (f && this.timepicker.destroy(), this.timepicker = !1, this.$timepicker.parentNode.removeChild(this.$timepicker)) : !o.timepicker && h && this._addTimepicker(), !o.buttons && d ? this._addButtons() : o.buttons && !d ? (this.buttons.destroy(), this.$buttons.parentNode.removeChild(this.$buttons)) : f && o.buttons && d && this.buttons.clearHtml().render(), !o.isMobile && u ? (this.treatAsInline || H || this._createMobileOverlay(), this._addMobileAttributes(), this.visible && this._showMobileOverlay()) : o.isMobile && !u && (this._removeMobileAttributes(), this.visible && (H.classList.remove("-active-"), typeof this.opts.position != "function" && this.setPosition())), f && (this.nav.update(), this.views[this.currentView].render(), this.currentView === l.days && this.views[this.currentView].renderDayNames());
|
|
852
|
+
}), g(this, "isOtherMonth", (s) => {
|
|
853
|
+
let { month: o } = y(s);
|
|
854
|
+
return o !== this.parsedViewDate.month;
|
|
855
|
+
}), g(this, "isOtherYear", (s) => {
|
|
856
|
+
let { year: o } = y(s);
|
|
857
|
+
return o !== this.parsedViewDate.year;
|
|
858
|
+
}), g(this, "isOtherDecade", (s) => {
|
|
859
|
+
let { year: o } = y(s), [h, d] = A(this.viewDate);
|
|
860
|
+
return o < h || o > d;
|
|
861
|
+
}), g(this, "_onChangeSelectedDate", (s) => {
|
|
862
|
+
let { silent: o } = s;
|
|
863
|
+
setTimeout(() => {
|
|
864
|
+
this._setInputValue(), this.opts.onSelect && !o && this._triggerOnSelect();
|
|
865
|
+
});
|
|
866
|
+
}), g(this, "_onChangeFocusedDate", function(s) {
|
|
867
|
+
let { viewDateTransition: o } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
868
|
+
if (!s)
|
|
869
|
+
return;
|
|
870
|
+
let h = !1;
|
|
871
|
+
o && (h = i.isOtherMonth(s) || i.isOtherYear(s) || i.isOtherDecade(s)), h && i.setViewDate(s);
|
|
872
|
+
}), g(this, "_onChangeTime", (s) => {
|
|
873
|
+
let { hours: o, minutes: h } = s, d = new Date(), { lastSelectedDate: c, opts: { onSelect: p } } = this, u = c;
|
|
874
|
+
c || (u = d);
|
|
875
|
+
let f = this.getCell(u, this.currentViewSingular), k = f && f.adpCell;
|
|
876
|
+
k && k.isDisabled || (u.setHours(o), u.setMinutes(h), c ? (this._setInputValue(), p && this._triggerOnSelect()) : this.selectDate(u));
|
|
877
|
+
}), g(this, "_onFocus", (s) => {
|
|
878
|
+
this.visible || this.show();
|
|
879
|
+
}), g(this, "_onBlur", (s) => {
|
|
880
|
+
this.inFocus || !this.visible || this.opts.isMobile || this.hide();
|
|
881
|
+
}), g(this, "_onMouseDown", (s) => {
|
|
882
|
+
this.inFocus = !0;
|
|
883
|
+
}), g(this, "_onMouseUp", (s) => {
|
|
884
|
+
this.inFocus = !1, this.$el.focus();
|
|
885
|
+
}), g(this, "_onResize", () => {
|
|
886
|
+
this.visible && typeof this.opts.position != "function" && this.setPosition();
|
|
887
|
+
}), g(this, "_onClickOverlay", () => {
|
|
888
|
+
this.visible && this.hide();
|
|
889
|
+
}), g(this, "isWeekend", (s) => this.opts.weekends.includes(s)), g(this, "getClampedDate", (s) => {
|
|
890
|
+
let { minDate: o, maxDate: h } = this, d = s;
|
|
891
|
+
return h && F(s, h) ? d = h : o && B(s, o) && (d = o), d;
|
|
892
|
+
}), this.$el = w(e), !this.$el)
|
|
893
|
+
return;
|
|
894
|
+
this.$datepicker = _({ className: "air-datepicker" }), this.opts = Z({}, se, t), this.$customContainer = !!this.opts.container && w(this.opts.container), this.$altField = w(this.opts.altField || !1), ee || (ee = w("body"));
|
|
895
|
+
let { view: a, startDate: n } = this.opts;
|
|
896
|
+
n || (this.opts.startDate = new Date()), this.$el.nodeName === "INPUT" && (this.elIsInput = !0), this.inited = !1, this.visible = !1, this.viewDate = x(this.opts.startDate), this.focusDate = !1, this.initialReadonly = this.$el.getAttribute("readonly"), this.customHide = !1, this.currentView = a, this.selectedDates = [], this.views = {}, this.keys = [], this.rangeDateFrom = "", this.rangeDateTo = "", this.timepickerIsActive = !1, this.treatAsInline = this.opts.inline || !this.elIsInput, this.init();
|
|
897
|
+
}
|
|
898
|
+
init() {
|
|
899
|
+
let { opts: e, treatAsInline: t, opts: { inline: i, isMobile: a, selectedDates: n, keyboardNav: s, onlyTimepicker: o } } = this;
|
|
900
|
+
var h;
|
|
901
|
+
oe || i || !this.elIsInput || (oe = !0, J = _({ className: h = E.defaultContainerId, id: h }), ee.appendChild(J)), !a || H || t || this._createMobileOverlay(), this._handleLocale(), this._bindSubEvents(), this._createMinMaxDates(), this._limitViewDateByMaxMinDates(), this.elIsInput && (i || this._bindEvents(), s && !o && (this.keyboardNav = new we({ dp: this, opts: e }))), n && this.selectDate(n, { silent: !0 }), this.opts.visible && !t && this.show(), a && !t && this.$el.setAttribute("readonly", !0), t && this._createComponents();
|
|
902
|
+
}
|
|
903
|
+
_createMobileOverlay() {
|
|
904
|
+
H = _({ className: "air-datepicker-overlay" }), J.appendChild(H);
|
|
905
|
+
}
|
|
906
|
+
_createComponents() {
|
|
907
|
+
let { opts: e, treatAsInline: t, opts: { inline: i, buttons: a, timepicker: n, position: s, classes: o, onlyTimepicker: h, isMobile: d } } = this;
|
|
908
|
+
this._buildBaseHtml(), this.elIsInput && (i || this._setPositionClasses(s)), !i && this.elIsInput || this.$datepicker.classList.add("-inline-"), o && this.$datepicker.classList.add(...o.split(" ")), h && this.$datepicker.classList.add("-only-timepicker-"), d && !t && this._addMobileAttributes(), this.views[this.currentView] = new ne({ dp: this, type: this.currentView, opts: e }), this.nav = new ye({ dp: this, opts: e }), n && this._addTimepicker(), a && this._addButtons(), this.$content.appendChild(this.views[this.currentView].$el), this.$nav.appendChild(this.nav.$el);
|
|
909
|
+
}
|
|
910
|
+
_destroyComponents() {
|
|
911
|
+
for (let e in this.views)
|
|
912
|
+
this.views[e].destroy();
|
|
913
|
+
this.views = {}, this.nav.destroy(), this.timepicker && this.timepicker.destroy();
|
|
914
|
+
}
|
|
915
|
+
_addMobileAttributes() {
|
|
916
|
+
H.addEventListener("click", this._onClickOverlay), this.$datepicker.classList.add("-is-mobile-"), this.$el.setAttribute("readonly", !0);
|
|
917
|
+
}
|
|
918
|
+
_removeMobileAttributes() {
|
|
919
|
+
H.removeEventListener("click", this._onClickOverlay), this.$datepicker.classList.remove("-is-mobile-"), this.initialReadonly || this.initialReadonly === "" || this.$el.removeAttribute("readonly");
|
|
920
|
+
}
|
|
921
|
+
_createMinMaxDates() {
|
|
922
|
+
let { minDate: e, maxDate: t } = this.opts;
|
|
923
|
+
this.minDate = !!e && x(e), this.maxDate = !!t && x(t);
|
|
924
|
+
}
|
|
925
|
+
_addTimepicker() {
|
|
926
|
+
this.$timepicker = _({ className: "air-datepicker--time" }), this.$datepicker.appendChild(this.$timepicker), this.timepicker = new be({ dp: this, opts: this.opts }), this.$timepicker.appendChild(this.timepicker.$el);
|
|
927
|
+
}
|
|
928
|
+
_addButtons() {
|
|
929
|
+
this.$buttons = _({ className: "air-datepicker--buttons" }), this.$datepicker.appendChild(this.$buttons), this.buttons = new De({ dp: this, opts: this.opts }), this.$buttons.appendChild(this.buttons.$el);
|
|
930
|
+
}
|
|
931
|
+
_bindSubEvents() {
|
|
932
|
+
this.on(l.eventChangeSelectedDate, this._onChangeSelectedDate), this.on(l.eventChangeFocusDate, this._onChangeFocusedDate), this.on(l.eventChangeTime, this._onChangeTime);
|
|
933
|
+
}
|
|
934
|
+
_buildBaseHtml() {
|
|
935
|
+
let { inline: e } = this.opts;
|
|
936
|
+
var t, i;
|
|
937
|
+
this.elIsInput ? e ? (t = this.$datepicker, (i = this.$el).parentNode.insertBefore(t, i.nextSibling)) : this.$container.appendChild(this.$datepicker) : this.$el.appendChild(this.$datepicker), this.$datepicker.innerHTML = '<i class="air-datepicker--pointer"></i><div class="air-datepicker--navigation"></div><div class="air-datepicker--content"></div>', this.$content = w(".air-datepicker--content", this.$datepicker), this.$pointer = w(".air-datepicker--pointer", this.$datepicker), this.$nav = w(".air-datepicker--navigation", this.$datepicker);
|
|
938
|
+
}
|
|
939
|
+
_handleLocale() {
|
|
940
|
+
let { locale: e, dateFormat: t, firstDay: i, timepicker: a, onlyTimepicker: n, timeFormat: s, dateTimeSeparator: o } = this.opts;
|
|
941
|
+
var h;
|
|
942
|
+
this.locale = (h = e, JSON.parse(JSON.stringify(h))), t && (this.locale.dateFormat = t), s !== void 0 && s !== "" && (this.locale.timeFormat = s);
|
|
943
|
+
let { timeFormat: d } = this.locale;
|
|
944
|
+
if (i !== "" && (this.locale.firstDay = i), a && typeof t != "function") {
|
|
945
|
+
let c = d ? o : "";
|
|
946
|
+
this.locale.dateFormat = [this.locale.dateFormat, d || ""].join(c);
|
|
947
|
+
}
|
|
948
|
+
n && typeof t != "function" && (this.locale.dateFormat = this.locale.timeFormat);
|
|
949
|
+
}
|
|
950
|
+
_setPositionClasses(e) {
|
|
951
|
+
if (typeof e == "function")
|
|
952
|
+
return void this.$datepicker.classList.add("-custom-position-");
|
|
953
|
+
let t = (e = e.split(" "))[0], i = e[1], a = "air-datepicker -".concat(t, "-").concat(i, "- -from-").concat(t, "-");
|
|
954
|
+
this.$datepicker.classList.add(...a.split(" "));
|
|
955
|
+
}
|
|
956
|
+
_bindEvents() {
|
|
957
|
+
this.$el.addEventListener(this.opts.showEvent, this._onFocus), this.$el.addEventListener("blur", this._onBlur), this.$datepicker.addEventListener("mousedown", this._onMouseDown), this.$datepicker.addEventListener("mouseup", this._onMouseUp), window.addEventListener("resize", this._onResize);
|
|
958
|
+
}
|
|
959
|
+
_limitViewDateByMaxMinDates() {
|
|
960
|
+
let { viewDate: e, minDate: t, maxDate: i } = this;
|
|
961
|
+
i && F(e, i) && this.setViewDate(i), t && B(e, t) && this.setViewDate(t);
|
|
962
|
+
}
|
|
963
|
+
formatDate() {
|
|
964
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.viewDate, t = arguments.length > 1 ? arguments[1] : void 0;
|
|
965
|
+
if (e = x(e), !(e instanceof Date))
|
|
966
|
+
return;
|
|
967
|
+
let i = t, a = this.locale, n = y(e), s = A(e), o = E.replacer, h = "am";
|
|
968
|
+
this.opts.timepicker && this.timepicker && (h = this.timepicker.getDayPeriod(e).dayPeriod);
|
|
969
|
+
let d = { T: e.getTime(), m: n.minutes, mm: n.fullMinutes, h: n.hours12, hh: n.fullHours12, H: n.hours, HH: n.fullHours, aa: h, AA: h.toUpperCase(), E: a.daysShort[n.day], EEEE: a.days[n.day], d: n.date, dd: n.fullDate, M: n.month + 1, MM: n.fullMonth, MMM: a.monthsShort[n.month], MMMM: a.months[n.month], yy: n.year.toString().slice(-2), yyyy: n.year, yyyy1: s[0], yyyy2: s[1] };
|
|
970
|
+
for (let [c, p] of Object.entries(d))
|
|
971
|
+
i = o(i, Q(c), p);
|
|
972
|
+
return i;
|
|
973
|
+
}
|
|
974
|
+
down(e) {
|
|
975
|
+
this._handleUpDownActions(e, "down");
|
|
976
|
+
}
|
|
977
|
+
up(e) {
|
|
978
|
+
this._handleUpDownActions(e, "up");
|
|
979
|
+
}
|
|
980
|
+
selectDate(e) {
|
|
981
|
+
let t, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, { currentView: a, parsedViewDate: n, selectedDates: s } = this, { updateTime: o } = i, { moveToOtherMonthsOnSelect: h, moveToOtherYearsOnSelect: d, multipleDates: c, range: p, autoClose: u } = this.opts, f = s.length;
|
|
982
|
+
if (Array.isArray(e))
|
|
983
|
+
return e.forEach((k) => {
|
|
984
|
+
this.selectDate(k, i);
|
|
985
|
+
}), new Promise((k) => {
|
|
986
|
+
setTimeout(k);
|
|
987
|
+
});
|
|
988
|
+
if ((e = x(e)) instanceof Date) {
|
|
989
|
+
if (a === l.days && e.getMonth() !== n.month && h && (t = new Date(e.getFullYear(), e.getMonth(), 1)), a === l.years && e.getFullYear() !== n.year && d && (t = new Date(e.getFullYear(), 0, 1)), t && this.setViewDate(t), c && !p) {
|
|
990
|
+
if (f === c)
|
|
991
|
+
return;
|
|
992
|
+
this._checkIfDateIsSelected(e) || s.push(e);
|
|
993
|
+
} else if (p)
|
|
994
|
+
switch (f) {
|
|
995
|
+
case 1:
|
|
996
|
+
s.push(e), this.rangeDateTo || (this.rangeDateTo = e), F(this.rangeDateFrom, this.rangeDateTo) && (this.rangeDateTo = this.rangeDateFrom, this.rangeDateFrom = e), this.selectedDates = [this.rangeDateFrom, this.rangeDateTo];
|
|
997
|
+
break;
|
|
998
|
+
case 2:
|
|
999
|
+
this.selectedDates = [e], this.rangeDateFrom = e, this.rangeDateTo = "";
|
|
1000
|
+
break;
|
|
1001
|
+
default:
|
|
1002
|
+
this.selectedDates = [e], this.rangeDateFrom = e;
|
|
1003
|
+
}
|
|
1004
|
+
else
|
|
1005
|
+
this.selectedDates = [e];
|
|
1006
|
+
return this.trigger(l.eventChangeSelectedDate, { action: l.actionSelectDate, silent: i == null ? void 0 : i.silent, date: e, updateTime: o }), this._updateLastSelectedDate(e), u && !this.timepickerIsActive && this.visible && (c || p ? p && f === 1 && this.hide() : this.hide()), new Promise((k) => {
|
|
1007
|
+
setTimeout(k);
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
unselectDate(e) {
|
|
1012
|
+
let t = this.selectedDates, i = this;
|
|
1013
|
+
if ((e = x(e)) instanceof Date)
|
|
1014
|
+
return t.some((a, n) => {
|
|
1015
|
+
if (D(a, e))
|
|
1016
|
+
return t.splice(n, 1), i.selectedDates.length ? i._updateLastSelectedDate(i.selectedDates[i.selectedDates.length - 1]) : (i.rangeDateFrom = "", i.rangeDateTo = "", i._updateLastSelectedDate(!1)), this.trigger(l.eventChangeSelectedDate, { action: l.actionUnselectDate, date: e }), !0;
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
replaceDate(e, t) {
|
|
1020
|
+
let i = this.selectedDates.find((n) => D(n, e, this.currentView)), a = this.selectedDates.indexOf(i);
|
|
1021
|
+
a < 0 || D(this.selectedDates[a], t, this.currentView) || (this.selectedDates[a] = t, this.trigger(l.eventChangeSelectedDate, { action: l.actionSelectDate, date: t, updateTime: !0 }), this._updateLastSelectedDate(t));
|
|
1022
|
+
}
|
|
1023
|
+
clear() {
|
|
1024
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1025
|
+
return this.selectedDates = [], this.rangeDateFrom = !1, this.rangeDateTo = !1, this.trigger(l.eventChangeSelectedDate, { action: l.actionUnselectDate, silent: e.silent }), new Promise((t) => {
|
|
1026
|
+
setTimeout(t);
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
show() {
|
|
1030
|
+
let { onShow: e, isMobile: t } = this.opts;
|
|
1031
|
+
this._cancelScheduledCall(), this.visible || this.hideAnimation || this._createComponents(), this.setPosition(this.opts.position), this.$datepicker.classList.add("-active-"), this.visible = !0, e && this._scheduleCallAfterTransition(e), t && this._showMobileOverlay();
|
|
1032
|
+
}
|
|
1033
|
+
hide() {
|
|
1034
|
+
let { onHide: e, isMobile: t } = this.opts, i = this._hasTransition();
|
|
1035
|
+
this.visible = !1, this.hideAnimation = !0, this.$datepicker.classList.remove("-active-"), this.customHide && this.customHide(), this.elIsInput && this.$el.blur(), this._scheduleCallAfterTransition((a) => {
|
|
1036
|
+
!this.customHide && (a && i || !a && !i) && this._finishHide(), e && e(a);
|
|
1037
|
+
}), t && H.classList.remove("-active-");
|
|
1038
|
+
}
|
|
1039
|
+
_triggerOnSelect() {
|
|
1040
|
+
let e = [], t = [], { selectedDates: i, locale: a, opts: { onSelect: n, multipleDates: s, range: o } } = this, h = s || o, d = typeof a.dateFormat == "function";
|
|
1041
|
+
i.length && (e = i.map(X), t = d ? s ? a.dateFormat(e) : e.map((c) => a.dateFormat(c)) : e.map((c) => this.formatDate(c, a.dateFormat))), n({ date: h ? e : e[0], formattedDate: h ? t : t[0], datepicker: this });
|
|
1042
|
+
}
|
|
1043
|
+
_handleAlreadySelectedDates(e, t) {
|
|
1044
|
+
let { range: i, toggleSelected: a } = this.opts;
|
|
1045
|
+
i ? a ? this.unselectDate(t) : this.selectedDates.length !== 2 && this.selectDate(t) : a && this.unselectDate(t), a || this._updateLastSelectedDate(e);
|
|
1046
|
+
}
|
|
1047
|
+
_handleUpDownActions(e, t) {
|
|
1048
|
+
if (!((e = x(e || this.focusDate || this.viewDate)) instanceof Date))
|
|
1049
|
+
return;
|
|
1050
|
+
let i = t === "up" ? this.viewIndex + 1 : this.viewIndex - 1;
|
|
1051
|
+
i > 2 && (i = 2), i < 0 && (i = 0), this.setViewDate(new Date(e.getFullYear(), e.getMonth(), 1)), this.setCurrentView(this.viewIndexes[i]);
|
|
1052
|
+
}
|
|
1053
|
+
_handleRangeOnFocus() {
|
|
1054
|
+
this.selectedDates.length === 1 && (F(this.selectedDates[0], this.focusDate) ? (this.rangeDateTo = this.selectedDates[0], this.rangeDateFrom = this.focusDate) : (this.rangeDateTo = this.focusDate, this.rangeDateFrom = this.selectedDates[0]));
|
|
1055
|
+
}
|
|
1056
|
+
getCell(e) {
|
|
1057
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l.day;
|
|
1058
|
+
if (!((e = x(e)) instanceof Date))
|
|
1059
|
+
return;
|
|
1060
|
+
let { year: i, month: a, date: n } = y(e), s = '[data-year="'.concat(i, '"]'), o = '[data-month="'.concat(a, '"]'), h = '[data-date="'.concat(n, '"]'), d = { [l.day]: "".concat(s).concat(o).concat(h), [l.month]: "".concat(s).concat(o), [l.year]: "".concat(s) };
|
|
1061
|
+
return this.views[this.currentView].$el.querySelector(d[t]);
|
|
1062
|
+
}
|
|
1063
|
+
_showMobileOverlay() {
|
|
1064
|
+
H.classList.add("-active-");
|
|
1065
|
+
}
|
|
1066
|
+
_hasTransition() {
|
|
1067
|
+
return window.getComputedStyle(this.$datepicker).getPropertyValue("transition-duration").split(", ").reduce((e, t) => parseFloat(t) + e, 0) > 0;
|
|
1068
|
+
}
|
|
1069
|
+
get shouldUpdateDOM() {
|
|
1070
|
+
return this.visible || this.treatAsInline;
|
|
1071
|
+
}
|
|
1072
|
+
get parsedViewDate() {
|
|
1073
|
+
return y(this.viewDate);
|
|
1074
|
+
}
|
|
1075
|
+
get currentViewSingular() {
|
|
1076
|
+
return this.currentView.slice(0, -1);
|
|
1077
|
+
}
|
|
1078
|
+
get curDecade() {
|
|
1079
|
+
return A(this.viewDate);
|
|
1080
|
+
}
|
|
1081
|
+
get viewIndex() {
|
|
1082
|
+
return this.viewIndexes.indexOf(this.currentView);
|
|
1083
|
+
}
|
|
1084
|
+
get isFinalView() {
|
|
1085
|
+
return this.currentView === l.years;
|
|
1086
|
+
}
|
|
1087
|
+
get hasSelectedDates() {
|
|
1088
|
+
return this.selectedDates.length > 0;
|
|
1089
|
+
}
|
|
1090
|
+
get isMinViewReached() {
|
|
1091
|
+
return this.currentView === this.opts.minView || this.currentView === l.days;
|
|
1092
|
+
}
|
|
1093
|
+
get $container() {
|
|
1094
|
+
return this.$customContainer || J;
|
|
1095
|
+
}
|
|
1096
|
+
static replacer(e, t, i) {
|
|
1097
|
+
return e.replace(t, function(a, n, s, o) {
|
|
1098
|
+
return n + i + o;
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
var he;
|
|
1103
|
+
return g(E, "defaults", se), g(E, "version", "3.3.0"), g(E, "defaultContainerId", "air-datepicker-global-container"), he = E.prototype, Object.assign(he, ke), T.default;
|
|
1104
|
+
}();
|
|
1105
|
+
});
|
|
1106
|
+
}), Le = me(function(m, v) {
|
|
1107
|
+
Object.defineProperty(v, "__esModule", {
|
|
1108
|
+
value: !0
|
|
1109
|
+
}), v.default = void 0;
|
|
1110
|
+
var $ = {
|
|
1111
|
+
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
1112
|
+
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
1113
|
+
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
1114
|
+
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
1115
|
+
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
|
1116
|
+
today: "Today",
|
|
1117
|
+
clear: "Clear",
|
|
1118
|
+
dateFormat: "MM/dd/yyyy",
|
|
1119
|
+
timeFormat: "hh:mm aa",
|
|
1120
|
+
firstDay: 0
|
|
1121
|
+
};
|
|
1122
|
+
v.default = $;
|
|
1123
|
+
});
|
|
1124
|
+
const Oe = /* @__PURE__ */ xe(Le), Ne = ':host{display:block}:host *{box-sizing:border-box}.date-picker{padding:var(--s-space-8) var(--s-space-16);background-color:var(--s-surface-overlay-default);font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm);letter-spacing:var(--s-letter-spacing-tighter)}@media (min-width: 768px){.date-picker{max-width:17.5rem}}.air-datepicker--pointer{display:none}.air-datepicker-nav{display:flex;margin-bottom:var(--s-space-8);align-items:center;gap:var(--s-space-4)}.air-datepicker-nav--action{position:relative;display:inline-flex;width:2.5rem;height:2.5rem;justify-content:center;align-items:center;border-radius:50%;color:var(--s-icon-highlight);cursor:pointer;order:2}.air-datepicker-nav--action:hover{background-color:var(--s-surface-overlay-hovered)}.air-datepicker-nav--title{padding:var(--s-space-8);flex-grow:1;border-radius:var(--s-border-radius-s);font-size:var(--s-font-size-base);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);text-align:left;cursor:pointer;order:0}.air-datepicker-nav--title i{font-style:normal}.air-datepicker-body--day-names{display:flex;margin-bottom:var(--s-space-8);justify-content:space-between;align-items:center}.air-datepicker-body--day-name{display:inline-flex;flex-basis:calc(100 / 7 * 1%);justify-content:center;align-items:center;color:var(--s-text-subdued);aspect-ratio:1}.air-datepicker-body--cells{position:relative;z-index:1;display:flex;flex-wrap:wrap;justify-content:space-between}.air-datepicker-body--cells.-months-{gap:var(--s-space-2)}.air-datepicker-cell{position:relative;display:inline-flex;flex-basis:calc(100 / 7 * 1%);justify-content:center;align-items:center;font-weight:var(--s-font-weight-medium);cursor:pointer;aspect-ratio:1}.air-datepicker-cell:not(.-month-):not(.-year-):not(.-in-range-):hover:before{position:absolute;z-index:-1;border-radius:50%;background-color:var(--s-surface-overlay-hovered);content:"";inset:0}.air-datepicker-cell.-month-,.air-datepicker-cell.-year-{height:2.5rem;flex-basis:calc(100 / 3 * 1% - var(--s-space-2) * 2);border-radius:var(--s-border-radius-s);aspect-ratio:auto}.air-datepicker-cell.-month-.-in-range-:before,.air-datepicker-cell.-year-.-in-range-:before{border-radius:var(--s-border-radius-s)}.air-datepicker-cell.-month-:hover:not(.-in-range-):not(.-selected-),.air-datepicker-cell.-year-:hover:not(.-in-range-):not(.-selected-){background-color:var(--s-surface-overlay-hovered)}.air-datepicker-cell.-other-month-{color:var(--s-text-subdued)}.air-datepicker-cell.-current-:not(.-month-):not(.-year-):after{position:absolute;z-index:-1;border:var(--s-border-width-default) solid var(--s-border-highlight);border-radius:50%;content:"";inset:0}.air-datepicker-cell.-selected-{color:var(--s-text-on-surface-highlight)}.air-datepicker-cell.-selected-.-year-,.air-datepicker-cell.-selected-.-month-{background-color:var(--s-surface-highlight-default)}.air-datepicker-cell.-selected-:not(.-month-):not(.-year-):not(.-in-range-):before{position:absolute;z-index:-1;border-radius:50%;background-color:var(--s-surface-highlight-default);content:"";inset:0}.air-datepicker-cell.-disabled-{color:var(--s-text-subdued);cursor:default}.air-datepicker-cell.-disabled-:hover{background-color:transparent}.air-datepicker-cell.-in-range-:before{position:absolute;z-index:-1;top:0.0625rem;right:0;bottom:0.0625rem;left:0;border-radius:0;background-color:var(--s-surface-highlight-default);content:"";opacity:0.2}.air-datepicker-cell.-range-from-:not(.-month-):not(.-year-):not(.-range-to-):hover{color:var(--s-text-on-surface-highlight)}.air-datepicker-cell.-range-from-:not(.-month-):not(.-year-):not(.-range-to-):before{position:absolute;z-index:-1;border-radius:50%;background-color:var(--s-surface-highlight-default);content:"";inset:0}.air-datepicker-cell.-range-from-:not(.-month-):not(.-year-):not(.-range-to-):after{position:absolute;z-index:-1;top:0.0625rem;right:0;bottom:0.0625rem;left:50%;border-radius:0;background-color:var(--s-surface-highlight-default);content:"";opacity:0.2}.air-datepicker-cell.-range-to-:not(.-month-):not(.-year-):not(.-range-from-):hover{color:var(--s-text-on-surface-highlight)}.air-datepicker-cell.-range-to-:not(.-month-):not(.-year-):not(.-range-from-):before{position:absolute;z-index:-1;border-radius:50%;background-color:var(--s-surface-highlight-default);content:"";inset:0}.air-datepicker-cell.-range-to-:not(.-month-):not(.-year-):not(.-range-from-):after{position:absolute;z-index:-1;top:0.0625rem;right:50%;bottom:0.0625rem;left:0;border-radius:0;background-color:var(--s-surface-highlight-default);content:"";opacity:0.2}.-hidden-{display:none}', Ie = class {
|
|
1125
|
+
constructor(m) {
|
|
1126
|
+
ie(this, m), this.valueChange = _e(this, "valueChange", 3), this.locale = Oe, this.onClick = (v) => {
|
|
1127
|
+
v.stopPropagation(), v.preventDefault();
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
watchProps() {
|
|
1131
|
+
this.init();
|
|
1132
|
+
}
|
|
1133
|
+
componentDidLoad() {
|
|
1134
|
+
this.init();
|
|
1135
|
+
}
|
|
1136
|
+
disconnectedCallback() {
|
|
1137
|
+
var m;
|
|
1138
|
+
(m = this.picker) === null || m === void 0 || m.destroy();
|
|
1139
|
+
}
|
|
1140
|
+
init() {
|
|
1141
|
+
var m;
|
|
1142
|
+
(m = this.picker) === null || m === void 0 || m.destroy(), this.picker = new Ae(this.containerEl, {
|
|
1143
|
+
classes: "date-picker",
|
|
1144
|
+
inline: !0,
|
|
1145
|
+
locale: this.locale,
|
|
1146
|
+
maxDate: this.maxDate,
|
|
1147
|
+
minDate: this.minDate,
|
|
1148
|
+
minView: "days",
|
|
1149
|
+
nextHtml: "<flip-icon-chevron-right></flip-icon-chevron-right>",
|
|
1150
|
+
onSelect: ({ date: v }) => {
|
|
1151
|
+
this.valueChange.emit(v);
|
|
1152
|
+
},
|
|
1153
|
+
prevHtml: "<flip-icon-chevron-left></flip-icon-chevron-left>",
|
|
1154
|
+
range: this.range,
|
|
1155
|
+
selectedDates: this.value === void 0 ? void 0 : Array.isArray(this.value) ? this.value : [this.value],
|
|
1156
|
+
startDate: this.startDate,
|
|
1157
|
+
toggleSelected: !this.range,
|
|
1158
|
+
view: "days"
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
render() {
|
|
1162
|
+
return b(ue, { onClick: this.onClick }, b("div", { ref: (m) => this.containerEl = m }));
|
|
1163
|
+
}
|
|
1164
|
+
static get watchers() {
|
|
1165
|
+
return {
|
|
1166
|
+
locale: ["watchProps"],
|
|
1167
|
+
maxDate: ["watchProps"],
|
|
1168
|
+
minDate: ["watchProps"],
|
|
1169
|
+
range: ["watchProps"],
|
|
1170
|
+
startDate: ["watchProps"],
|
|
1171
|
+
value: ["watchProps"]
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
Ie.style = Ne;
|
|
1176
|
+
const Pe = ":host{display:inline-flex}", Be = class {
|
|
1177
|
+
constructor(m) {
|
|
1178
|
+
ie(this, m), this.size = 24;
|
|
1179
|
+
}
|
|
1180
|
+
render() {
|
|
1181
|
+
return b("svg", { class: "flip-icon", fill: "none", height: this.size, part: "icon", viewBox: `0 0 ${this.size} ${this.size}`, width: this.size, xmlns: "http://www.w3.org/2000/svg" }, this.size === 16 && b(te, null, b("path", { d: "M6 11C5.53333 11 5.13889 10.8389 4.81667 10.5167C4.49444 10.1945 4.33333 9.80004 4.33333 9.33337C4.33333 8.86671 4.49444 8.47226 4.81667 8.15004C5.13889 7.82782 5.53333 7.66671 6 7.66671C6.46667 7.66671 6.86111 7.82782 7.18333 8.15004C7.50556 8.47226 7.66667 8.86671 7.66667 9.33337C7.66667 9.80004 7.50556 10.1945 7.18333 10.5167C6.86111 10.8389 6.46667 11 6 11ZM3.33333 14.6667C2.96667 14.6667 2.65267 14.5363 2.39133 14.2754C2.13044 14.014 2 13.7 2 13.3334V4.00004C2 3.63337 2.13044 3.3196 2.39133 3.05871C2.65267 2.79737 2.96667 2.66671 3.33333 2.66671H4V2.00004C4 1.81115 4.06378 1.65271 4.19133 1.52471C4.31933 1.39715 4.47778 1.33337 4.66667 1.33337C4.85556 1.33337 5.014 1.39715 5.142 1.52471C5.26956 1.65271 5.33333 1.81115 5.33333 2.00004V2.66671H10.6667V2.00004C10.6667 1.81115 10.7307 1.65271 10.8587 1.52471C10.9862 1.39715 11.1444 1.33337 11.3333 1.33337C11.5222 1.33337 11.6804 1.39715 11.808 1.52471C11.936 1.65271 12 1.81115 12 2.00004V2.66671H12.6667C13.0333 2.66671 13.3473 2.79737 13.6087 3.05871C13.8696 3.3196 14 3.63337 14 4.00004V13.3334C14 13.7 13.8696 14.014 13.6087 14.2754C13.3473 14.5363 13.0333 14.6667 12.6667 14.6667H3.33333ZM3.33333 13.3334H12.6667V6.66671H3.33333V13.3334Z", fill: "currentColor" })), this.size === 24 && b(te, null, b("path", { d: "M9 16.5C8.3 16.5 7.70833 16.2583 7.225 15.775C6.74167 15.2917 6.5 14.7 6.5 14C6.5 13.3 6.74167 12.7083 7.225 12.225C7.70833 11.7417 8.3 11.5 9 11.5C9.7 11.5 10.2917 11.7417 10.775 12.225C11.2583 12.7083 11.5 13.3 11.5 14C11.5 14.7 11.2583 15.2917 10.775 15.775C10.2917 16.2583 9.7 16.5 9 16.5ZM5 22C4.45 22 3.979 21.8043 3.587 21.413C3.19567 21.021 3 20.55 3 20V6C3 5.45 3.19567 4.97933 3.587 4.588C3.979 4.196 4.45 4 5 4H6V3C6 2.71667 6.09567 2.479 6.287 2.287C6.479 2.09567 6.71667 2 7 2C7.28333 2 7.521 2.09567 7.713 2.287C7.90433 2.479 8 2.71667 8 3V4H16V3C16 2.71667 16.096 2.479 16.288 2.287C16.4793 2.09567 16.7167 2 17 2C17.2833 2 17.5207 2.09567 17.712 2.287C17.904 2.479 18 2.71667 18 3V4H19C19.55 4 20.021 4.196 20.413 4.588C20.8043 4.97933 21 5.45 21 6V20C21 20.55 20.8043 21.021 20.413 21.413C20.021 21.8043 19.55 22 19 22H5ZM5 20H19V10H5V20Z", fill: "currentColor" })), this.size === 28 && b(te, null, b("path", { d: "M10.5 19.25C9.68333 19.25 8.99306 18.9681 8.42917 18.4042C7.86528 17.8403 7.58333 17.15 7.58333 16.3334C7.58333 15.5167 7.86528 14.8264 8.42917 14.2625C8.99306 13.6987 9.68333 13.4167 10.5 13.4167C11.3167 13.4167 12.0069 13.6987 12.5708 14.2625C13.1347 14.8264 13.4167 15.5167 13.4167 16.3334C13.4167 17.15 13.1347 17.8403 12.5708 18.4042C12.0069 18.9681 11.3167 19.25 10.5 19.25ZM5.83333 25.6667C5.19167 25.6667 4.64217 25.4384 4.18483 24.9819C3.72828 24.5245 3.5 23.975 3.5 23.3334V7.00004C3.5 6.35837 3.72828 5.80926 4.18483 5.35271C4.64217 4.89537 5.19167 4.66671 5.83333 4.66671H7V3.50004C7 3.16949 7.11161 2.89221 7.33483 2.66821C7.55883 2.44499 7.83611 2.33337 8.16667 2.33337C8.49722 2.33337 8.7745 2.44499 8.9985 2.66821C9.22172 2.89221 9.33333 3.16949 9.33333 3.50004V4.66671H18.6667V3.50004C18.6667 3.16949 18.7787 2.89221 19.0027 2.66821C19.2259 2.44499 19.5028 2.33337 19.8333 2.33337C20.1639 2.33337 20.4408 2.44499 20.664 2.66821C20.888 2.89221 21 3.16949 21 3.50004V4.66671H22.1667C22.8083 4.66671 23.3578 4.89537 23.8152 5.35271C24.2717 5.80926 24.5 6.35837 24.5 7.00004V23.3334C24.5 23.975 24.2717 24.5245 23.8152 24.9819C23.3578 25.4384 22.8083 25.6667 22.1667 25.6667H5.83333ZM5.83333 23.3334H22.1667V11.6667H5.83333V23.3334Z", fill: "currentColor" })));
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
Be.style = Pe;
|
|
1185
|
+
const Re = ":host{position:relative;z-index:var(--s-z-40);display:inline-flex}:host *{box-sizing:border-box}.popover--active:not(.popover--closing) .popover__backdrop{-webkit-animation:0.15s popover-fade-in;animation:0.15s popover-fade-in}@media (prefers-reduced-motion){.popover--active:not(.popover--closing) .popover__backdrop{-webkit-animation:none;animation:none}}.popover--active:not(.popover--closing) .popover__content{-webkit-animation:0.15s popover-slide-in;animation:0.15s popover-slide-in}@media (min-width: 768px){.popover--active:not(.popover--closing) .popover__content{transform-origin:top left;-webkit-animation:0.15s popover-fade-scale-in;animation:0.15s popover-fade-scale-in}}@media (prefers-reduced-motion){.popover--active:not(.popover--closing) .popover__content{-webkit-animation:none;animation:none}}.popover--closing .popover__backdrop{-webkit-animation:0.15s popover-fade-out;animation:0.15s popover-fade-out;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (prefers-reduced-motion){.popover--closing .popover__backdrop{-webkit-animation:none;animation:none}}.popover--closing .popover__content{-webkit-animation:0.15s popover-slide-out;animation:0.15s popover-slide-out;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 768px){.popover--closing .popover__content{-webkit-animation:0.15s popover-fade-out;animation:0.15s popover-fade-out}}@media (prefers-reduced-motion){.popover--closing .popover__content{-webkit-animation:none;animation:none}}.popover--inactive .popover__content{display:none}.popover__backdrop{position:fixed;z-index:0;background-color:rgba(0, 0, 0, 0.2);-webkit-animation:0.15s popover-backdrop-fade-in;animation:0.15s popover-backdrop-fade-in;inset:0}@media (prefers-reduced-motion){.popover__backdrop{-webkit-animation:none;animation:none}}@media (min-width: 768px){.popover__backdrop{display:none}}.popover__content{position:fixed;z-index:2;right:0;bottom:0;left:0;overflow:hidden;border-top-left-radius:var(--s-border-radius-xl);border-top-right-radius:var(--s-border-radius-xl);background-color:var(--s-surface-overlay-default)}@media (min-width: 768px){.popover__content{right:unset;bottom:unset;left:unset;max-width:22.5rem;border-radius:var(--s-border-radius-xl);-webkit-animation:none;animation:none;box-shadow:0.125rem 0.25rem 2.5rem rgba(0, 0, 0, 0.14)}}.popover__scroll-container{overflow-x:hidden;overflow-y:auto;width:100%;max-height:90vh;padding-top:var(--s-space-24);padding-bottom:var(--s-space-24);overscroll-behavior:contain}@media (min-width: 768px){.popover__scroll-container{max-height:22rem;padding-top:var(--s-space-8);padding-bottom:var(--s-space-8)}}.popover__handle{position:absolute;top:var(--s-space-8);left:50%;width:2.5rem;height:0.375rem;border-radius:0.1875rem;background-color:var(--s-border-default);transform:translatex(-50%)}@media (min-width: 768px){.popover__handle{display:none}}@-webkit-keyframes popover-slide-in{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes popover-slide-in{from{transform:translateY(100%)}to{transform:translateY(0)}}@-webkit-keyframes popover-slide-out{from{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes popover-slide-out{from{transform:translateY(0)}to{transform:translateY(100%)}}@-webkit-keyframes popover-fade-in{from{opacity:0}to{opacity:1}}@keyframes popover-fade-in{from{opacity:0}to{opacity:1}}@-webkit-keyframes popover-fade-out{from{opacity:1}to{opacity:0}}@keyframes popover-fade-out{from{opacity:1}to{opacity:0}}@-webkit-keyframes popover-fade-scale-in{from{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@keyframes popover-fade-scale-in{from{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}", ze = class {
|
|
1186
|
+
constructor(m) {
|
|
1187
|
+
ie(this, m), this.placement = "bottom-start", this.active = !1, this.closing = !1, this.onFocusOut = (v) => {
|
|
1188
|
+
if (!this.active)
|
|
1189
|
+
return;
|
|
1190
|
+
const $ = v.relatedTarget || v.target;
|
|
1191
|
+
!this.el.contains($) && this.close();
|
|
1192
|
+
}, this.toggle = (v) => {
|
|
1193
|
+
v.stopPropagation(), this.active ? this.close() : this.open();
|
|
1194
|
+
}, this.onKeydown = (v) => {
|
|
1195
|
+
v.code === "Escape" && this.active && this.close();
|
|
1196
|
+
}, this.reposition = async () => {
|
|
1197
|
+
const v = ce();
|
|
1198
|
+
if (!(!Boolean(this.triggerEl) || !Boolean(this.contentContainer))) {
|
|
1199
|
+
if (v) {
|
|
1200
|
+
this.position = void 0;
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
this.position = await Se(this.triggerEl, this.contentContainer, {
|
|
1204
|
+
middleware: [Te(), Ve()],
|
|
1205
|
+
placement: this.placement,
|
|
1206
|
+
strategy: "fixed"
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
}, this.onCloseButtonClick = () => {
|
|
1210
|
+
this.close();
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
componentDidLoad() {
|
|
1214
|
+
this.connectTrigger(), this.updateChildMenuItems(), this.updateTriggerAttributes();
|
|
1215
|
+
}
|
|
1216
|
+
disconnectedCallback() {
|
|
1217
|
+
de(this.scrollContainer);
|
|
1218
|
+
}
|
|
1219
|
+
onWindowClick(m) {
|
|
1220
|
+
const v = m.target;
|
|
1221
|
+
this.el.contains(v) || this.close();
|
|
1222
|
+
}
|
|
1223
|
+
async close() {
|
|
1224
|
+
var m;
|
|
1225
|
+
this.closing || (this.disableAutoUpdate && this.disableAutoUpdate(), this.closing = !0, setTimeout(() => {
|
|
1226
|
+
this.active = !1, this.closing = !1, this.updateTriggerAttributes();
|
|
1227
|
+
}, 150), this.unlockBodyScroll(), (m = this.triggerEl) === null || m === void 0 || m.focus());
|
|
1228
|
+
}
|
|
1229
|
+
async open() {
|
|
1230
|
+
this.active = !0, this.updateChildMenuItems(), this.updateTriggerAttributes(), requestAnimationFrame(async () => {
|
|
1231
|
+
await this.reposition(), this.childMenuItems.length > 0 ? this.childMenuItems[0].focus() : this.contentContainer.focus(), this.disableAutoUpdate && this.disableAutoUpdate(), this.disableAutoUpdate = Fe(this.triggerEl, this.contentContainer, this.reposition), this.scrollContainer.scrollTop = 0, this.lockBodyScroll();
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
connectTrigger() {
|
|
1235
|
+
var m;
|
|
1236
|
+
const v = pe(document.body, `#${this.trigger}`)[0];
|
|
1237
|
+
this.triggerEl = (v == null ? void 0 : v.children[0]) || ((m = v == null ? void 0 : v.shadowRoot) === null || m === void 0 ? void 0 : m.children[0]) || v, Boolean(this.triggerEl) && this.triggerEl.addEventListener("click", this.toggle);
|
|
1238
|
+
}
|
|
1239
|
+
updateTriggerAttributes() {
|
|
1240
|
+
!Boolean(this.triggerEl) || (this.triggerEl.setAttribute("aria-controls", this.popoverId), this.triggerEl.setAttribute("aria-expanded", String(this.active)), this.triggerEl.setAttribute("aria-haspopup", "dialog"));
|
|
1241
|
+
}
|
|
1242
|
+
updateChildMenuItems() {
|
|
1243
|
+
this.childMenuItems = pe(this.el, '[role="menuitem"]');
|
|
1244
|
+
}
|
|
1245
|
+
lockBodyScroll() {
|
|
1246
|
+
!ce() || He(this.scrollContainer);
|
|
1247
|
+
}
|
|
1248
|
+
unlockBodyScroll() {
|
|
1249
|
+
de(this.scrollContainer);
|
|
1250
|
+
}
|
|
1251
|
+
render() {
|
|
1252
|
+
var m, v;
|
|
1253
|
+
const $ = Ee("popover", {
|
|
1254
|
+
"popover--closing": this.closing,
|
|
1255
|
+
"popover--active": this.active,
|
|
1256
|
+
"popover--inactive": !this.active
|
|
1257
|
+
});
|
|
1258
|
+
return b(ue, { id: this.popoverId, onFocusout: this.onFocusOut }, b("div", { class: $, onKeyDown: this.onKeydown }, b("div", { "aria-hidden": this.active ? "false" : "true", "aria-label": this.label, class: "popover__content", role: "dialog", tabindex: "-1", ref: (T) => this.contentContainer = T, style: {
|
|
1259
|
+
top: Boolean(this.position) ? `${(m = this.position) === null || m === void 0 ? void 0 : m.y}px` : "",
|
|
1260
|
+
left: Boolean(this.position) ? `${(v = this.position) === null || v === void 0 ? void 0 : v.x}px` : ""
|
|
1261
|
+
} }, b("span", { class: "popover__handle" }), b("div", { class: "popover__scroll-container", ref: (T) => this.scrollContainer = T }, b("slot", null))), this.active && b("div", { class: "popover__backdrop", onClick: this.onCloseButtonClick })));
|
|
1262
|
+
}
|
|
1263
|
+
get el() {
|
|
1264
|
+
return Me(this);
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
ze.style = Re;
|
|
1268
|
+
export {
|
|
1269
|
+
Ie as flip_date_picker,
|
|
1270
|
+
Be as flip_icon_today,
|
|
1271
|
+
ze as flip_popover
|
|
1272
|
+
};
|