@adyen/bento-vue2 1.76.2 → 1.77.0
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/@types/index.d.ts +300 -35
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date-picker.css +1 -1
- package/dist/assets/date-range-picker.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/dropdown-default-textbox.css +1 -1
- package/dist/assets/dropdown-tag.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/input-field-phone-number.css +1 -1
- package/dist/assets/input-field.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/pagination.css +1 -1
- package/dist/assets/payment-method.css +1 -1
- package/dist/assets/secondary-nav.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/tag.css +1 -1
- package/dist/assets/textarea.css +1 -1
- package/dist/assets/timeline-item.css +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{checkbox-group.CtNVRcmP.js → checkbox-group.C3RH5Gcg.js} +2 -2
- package/dist/chunks/{checkbox-group.CtNVRcmP.js.map → checkbox-group.C3RH5Gcg.js.map} +1 -1
- package/dist/chunks/{checkbox.nyUc0gLb.js → checkbox.itbBlXev.js} +3 -3
- package/dist/chunks/{checkbox.nyUc0gLb.js.map → checkbox.itbBlXev.js.map} +1 -1
- package/dist/chunks/{code-snippet.DFf3KMSi.js → code-snippet.BEbA1bIn.js} +2 -2
- package/dist/chunks/{code-snippet.DFf3KMSi.js.map → code-snippet.BEbA1bIn.js.map} +1 -1
- package/dist/chunks/{currency.AvvbekWO.js → currency.Cwhzzxw2.js} +2 -2
- package/dist/chunks/{currency.AvvbekWO.js.map → currency.Cwhzzxw2.js.map} +1 -1
- package/dist/chunks/{data-grid.C07AmPwV.js → data-grid.B-kBw540.js} +7 -7
- package/dist/chunks/{data-grid.C07AmPwV.js.map → data-grid.B-kBw540.js.map} +1 -1
- package/dist/chunks/date-picker.CKaQJcPa.js +168 -0
- package/dist/chunks/date-picker.CKaQJcPa.js.map +1 -0
- package/dist/chunks/date-picker.types.Ckt7zxGy.js +5 -0
- package/dist/chunks/date-picker.types.Ckt7zxGy.js.map +1 -0
- package/dist/chunks/date-range-picker.BtPxkPN0.js +942 -0
- package/dist/chunks/date-range-picker.BtPxkPN0.js.map +1 -0
- package/dist/chunks/{dropdown-default-textbox.yLeN0E2z.js → dropdown-default-textbox.BCOVaw-a.js} +10 -10
- package/dist/chunks/dropdown-default-textbox.BCOVaw-a.js.map +1 -0
- package/dist/chunks/dropdown-tag.BXMgDH3v.js +294 -0
- package/dist/chunks/dropdown-tag.BXMgDH3v.js.map +1 -0
- package/dist/chunks/{dropdown.RxD2TqnP.js → dropdown.-3x2IBDg.js} +305 -297
- package/dist/chunks/{dropdown.RxD2TqnP.js.map → dropdown.-3x2IBDg.js.map} +1 -1
- package/dist/chunks/es6.MoTTyETW.js.map +1 -1
- package/dist/chunks/{file-uploader.BGoCYrnw.js → file-uploader.BkTtqgvQ.js} +296 -295
- package/dist/chunks/{file-uploader.BGoCYrnw.js.map → file-uploader.BkTtqgvQ.js.map} +1 -1
- package/dist/chunks/{filter-bar.DVqgwt2p.js → filter-bar.BLnSnOlj.js} +201 -201
- package/dist/chunks/filter-bar.BLnSnOlj.js.map +1 -0
- package/dist/chunks/form-field.BBqLu-vs.js +10 -0
- package/dist/chunks/form-field.BBqLu-vs.js.map +1 -0
- package/dist/chunks/get-slot-text.Bjb9dTSV.js +12 -0
- package/dist/chunks/get-slot-text.Bjb9dTSV.js.map +1 -0
- package/dist/chunks/{header-with-views.jnhILkoQ.js → header-with-views.C6Y7mAkq.js} +3 -3
- package/dist/chunks/{header-with-views.jnhILkoQ.js.map → header-with-views.C6Y7mAkq.js.map} +1 -1
- package/dist/chunks/{input-field-password.CHn2GUcL.js → input-field-password.sthICA2L.js} +3 -3
- package/dist/chunks/{input-field-password.CHn2GUcL.js.map → input-field-password.sthICA2L.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.CpnfVw6w.js → input-field-phone-number.BjinuvOl.js} +5 -5
- package/dist/chunks/{input-field-phone-number.CpnfVw6w.js.map → input-field-phone-number.BjinuvOl.js.map} +1 -1
- package/dist/chunks/{input-field.sGmuIXiw.js → input-field.CwKD3p3q.js} +34 -34
- package/dist/chunks/input-field.CwKD3p3q.js.map +1 -0
- package/dist/chunks/link.D8qpqg3W.js.map +1 -1
- package/dist/chunks/{listbox-option-tag.Dl8GwHLT.js → listbox-option-tag.DkPz3wPc.js} +2 -2
- package/dist/chunks/{listbox-option-tag.Dl8GwHLT.js.map → listbox-option-tag.DkPz3wPc.js.map} +1 -1
- package/dist/chunks/{pagination.C0YW_A_o.js → pagination.BzyyZJy6.js} +7 -7
- package/dist/chunks/pagination.BzyyZJy6.js.map +1 -0
- package/dist/chunks/{payment-method.DtvfUnit.js → payment-method.CcASYR3B.js} +12 -12
- package/dist/chunks/payment-method.CcASYR3B.js.map +1 -0
- package/dist/chunks/payment-method.types.BqtH7RM2.js.map +1 -1
- package/dist/chunks/{radio-group.AcYMFudv.js → radio-group.B8ukv-pw.js} +3 -3
- package/dist/chunks/{radio-group.AcYMFudv.js.map → radio-group.B8ukv-pw.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.eYW8X_YP.js → rich-text-editor.DzH-Z5oi.js} +2 -2
- package/dist/chunks/{rich-text-editor.eYW8X_YP.js.map → rich-text-editor.DzH-Z5oi.js.map} +1 -1
- package/dist/chunks/{search-bar.D8SJsbze.js → search-bar.CgzPXP8r.js} +3 -3
- package/dist/chunks/{search-bar.D8SJsbze.js.map → search-bar.CgzPXP8r.js.map} +1 -1
- package/dist/chunks/{secondary-nav.BFiTQaag.js → secondary-nav.3eZKyb8K.js} +4 -4
- package/dist/chunks/secondary-nav.3eZKyb8K.js.map +1 -0
- package/dist/chunks/{summary-grid.types.B80533d1.js → summary-grid.types.CaYrtyVO.js} +2 -2
- package/dist/chunks/{summary-grid.types.B80533d1.js.map → summary-grid.types.CaYrtyVO.js.map} +1 -1
- package/dist/chunks/tag.BltIbSh3.js +44 -0
- package/dist/chunks/tag.BltIbSh3.js.map +1 -0
- package/dist/chunks/textarea.h-WF62HP.js +173 -0
- package/dist/chunks/textarea.h-WF62HP.js.map +1 -0
- package/dist/chunks/{timeline-item.CZBuknZ_.js → timeline-item.BLhS7uNF.js} +5 -5
- package/dist/chunks/timeline-item.BLhS7uNF.js.map +1 -0
- package/dist/chunks/{toggle.BJMXpHRu.js → toggle.D2wmNu7m.js} +2 -2
- package/dist/chunks/{toggle.BJMXpHRu.js.map → toggle.D2wmNu7m.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/currency.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +7 -6
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-picker.js +1 -1
- package/dist/dropdown.js +3 -3
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/index.js +247 -246
- package/dist/index.js.map +1 -1
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/payment-method.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/styles/bento-dark.css +4 -0
- package/dist/styles/bento-light.css +4 -0
- package/dist/styles/bento.css +4 -0
- package/dist/styles/legacy.css +4 -0
- package/dist/styles/styleguide.css +4 -0
- package/dist/summary-grid.js +1 -1
- package/dist/tag.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/toggle.js +1 -1
- package/dist/web-types.json +144 -6
- package/package.json +6 -6
- package/dist/chunks/date-picker.DImAYvoM.js +0 -158
- package/dist/chunks/date-picker.DImAYvoM.js.map +0 -1
- package/dist/chunks/date-range-picker.NAG_5i8I.js +0 -914
- package/dist/chunks/date-range-picker.NAG_5i8I.js.map +0 -1
- package/dist/chunks/dropdown-default-textbox.yLeN0E2z.js.map +0 -1
- package/dist/chunks/dropdown-tag.CpvU8eSZ.js +0 -260
- package/dist/chunks/dropdown-tag.CpvU8eSZ.js.map +0 -1
- package/dist/chunks/filter-bar.DVqgwt2p.js.map +0 -1
- package/dist/chunks/get-slot-text.BQS5Olxm.js +0 -12
- package/dist/chunks/get-slot-text.BQS5Olxm.js.map +0 -1
- package/dist/chunks/input-field.sGmuIXiw.js.map +0 -1
- package/dist/chunks/pagination.C0YW_A_o.js.map +0 -1
- package/dist/chunks/payment-method.DtvfUnit.js.map +0 -1
- package/dist/chunks/secondary-nav.BFiTQaag.js.map +0 -1
- package/dist/chunks/tag.BwKc2d2E.js +0 -44
- package/dist/chunks/tag.BwKc2d2E.js.map +0 -1
- package/dist/chunks/textarea.CIQuLWQ8.js +0 -165
- package/dist/chunks/textarea.CIQuLWQ8.js.map +0 -1
- package/dist/chunks/timeline-item.CZBuknZ_.js.map +0 -1
|
@@ -1,914 +0,0 @@
|
|
|
1
|
-
import { reactive as me, defineComponent as qe, ref as M, computed as b, onMounted as Le, toRaw as Te, toRef as ge, watch as ye } from "vue";
|
|
2
|
-
import { B as nt } from "./divider.CFbtmKeQ.js";
|
|
3
|
-
import { h as rt, B as st } from "./button-actions.B81vY51z.js";
|
|
4
|
-
import { B as Ye, d as lt } from "./typography.hlOAxsEn.js";
|
|
5
|
-
import { B as it } from "./input-field.sGmuIXiw.js";
|
|
6
|
-
import { B as ot } from "./dropdown.RxD2TqnP.js";
|
|
7
|
-
import { B as ut } from "./segmented-control.Cma_nu0G.js";
|
|
8
|
-
import { e as N, a as Se, g as pe } from "./differenceInMonths.C8FyCrav.js";
|
|
9
|
-
import { u as _e } from "./index.B6WW_F-J.js";
|
|
10
|
-
import { e as C, g as je, h as Ee, i as A, j as dt, k as he, l as ct, s as we, m as Dt, n as ie, o as Oe, b as W, u as mt, f as ne } from "./calendar.Fm_dfQC5.js";
|
|
11
|
-
import { d as de } from "./debounce.DUTu11PS.js";
|
|
12
|
-
import { u as ft } from "./use-has-slot.C9lQZ6nz.js";
|
|
13
|
-
import { f as Me, v as vt, D as E } from "./date-format.B8RU7D42.js";
|
|
14
|
-
import { t as Y, c as gt, n as yt } from "./getTimezoneOffsetInMilliseconds.BW7U6PxE.js";
|
|
15
|
-
import { c as Tt } from "./constructNow.CHWWeLPc.js";
|
|
16
|
-
import { n as $e } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
17
|
-
import { g as le } from "./generate-uid.NJ8tVoha.js";
|
|
18
|
-
import { u as pt } from "./use-form-layout-loading.D3lALhtC.js";
|
|
19
|
-
import "./index.Cl4_42j5.js";
|
|
20
|
-
import { D as _t } from "./dropdown-default-textbox.yLeN0E2z.js";
|
|
21
|
-
import { B as Rt } from "./directive.Cbdox5VL.js";
|
|
22
|
-
import { F as It, E as bt } from "./field-label.Auq-Pzho.js";
|
|
23
|
-
import { B as kt } from "./button-actions.types.BptAXjD8.js";
|
|
24
|
-
import "../assets/date-range-picker.css";
|
|
25
|
-
function Z(t) {
|
|
26
|
-
if (t == null)
|
|
27
|
-
return C(/* @__PURE__ */ new Date());
|
|
28
|
-
const [e, a, r] = t.split("-").map((o) => parseInt(o, 10));
|
|
29
|
-
return new Date(e, a - 1, r);
|
|
30
|
-
}
|
|
31
|
-
function Qe(t, e, a) {
|
|
32
|
-
return je(t, e * 3, a);
|
|
33
|
-
}
|
|
34
|
-
function St(t, e, a) {
|
|
35
|
-
return Qe(t, -1, a);
|
|
36
|
-
}
|
|
37
|
-
const Et = ({
|
|
38
|
-
firstDayOfWeek: t,
|
|
39
|
-
min: e,
|
|
40
|
-
max: a
|
|
41
|
-
}) => ({ getGranularCalendarLimits: (o) => {
|
|
42
|
-
if (!e && !a)
|
|
43
|
-
return { min: null, max: null };
|
|
44
|
-
let c = e ? C(e) : null, m = a ? N(a) : null;
|
|
45
|
-
if ((o == null ? void 0 : o.type) === "weekly") {
|
|
46
|
-
if (o.earliest)
|
|
47
|
-
c = C(o.earliest);
|
|
48
|
-
else if (c) {
|
|
49
|
-
const y = Ee(c, { weekStartsOn: t });
|
|
50
|
-
A(c, y) || (c = C(dt(he(c, { weekStartsOn: t }), 1)));
|
|
51
|
-
}
|
|
52
|
-
if (o.latest)
|
|
53
|
-
m = N(o.latest);
|
|
54
|
-
else if (m) {
|
|
55
|
-
const y = he(m, { weekStartsOn: t });
|
|
56
|
-
A(m, y) || (m = N(ct(Ee(m, { weekStartsOn: t }), 1)));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if ((o == null ? void 0 : o.type) === "monthly") {
|
|
60
|
-
if (o.earliest)
|
|
61
|
-
c = C(o.earliest);
|
|
62
|
-
else if (c) {
|
|
63
|
-
const y = we(c);
|
|
64
|
-
A(c, y) || (c = we(je(c, 1)));
|
|
65
|
-
}
|
|
66
|
-
if (o.latest)
|
|
67
|
-
m = N(o.latest);
|
|
68
|
-
else if (m) {
|
|
69
|
-
const y = Se(m);
|
|
70
|
-
A(m, y) || (m = Se(Dt(m, 1)));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if ((o == null ? void 0 : o.type) === "quarterly") {
|
|
74
|
-
if (o.earliest)
|
|
75
|
-
c = ie(o.earliest);
|
|
76
|
-
else if (c) {
|
|
77
|
-
const y = ie(c);
|
|
78
|
-
A(c, y) || (c = ie(Qe(c, 1)));
|
|
79
|
-
}
|
|
80
|
-
if (o.latest)
|
|
81
|
-
m = N(o.latest);
|
|
82
|
-
else if (m) {
|
|
83
|
-
const y = Oe(m);
|
|
84
|
-
A(m, y) || (m = Oe(St(m)));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return { min: c, max: m };
|
|
88
|
-
} }), ht = () => {
|
|
89
|
-
const t = me({
|
|
90
|
-
daily: null,
|
|
91
|
-
weekly: null,
|
|
92
|
-
monthly: null,
|
|
93
|
-
quarterly: null
|
|
94
|
-
});
|
|
95
|
-
return {
|
|
96
|
-
savedRanges: t,
|
|
97
|
-
saveRange: (r, o) => {
|
|
98
|
-
t[r] = o;
|
|
99
|
-
},
|
|
100
|
-
resetSavedRanges: () => {
|
|
101
|
-
t.daily = null, t.weekly = null, t.monthly = null, t.quarterly = null;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
var v = /* @__PURE__ */ ((t) => (t.CUSTOM_RANGE = "custom-range", t.INPUT = "input", t.ERROR = "error", t.FORM_DATE = "form-date", t.START_DATE_SELECTED = "start-date-selected", t))(v || {});
|
|
106
|
-
const wt = /[\d]/, Ot = /^\d{2}$/, Mt = /^\d{2}:\d{2}$/, Ct = (t) => {
|
|
107
|
-
const { selectionStart: e } = t.target, a = ["Backspace", "Tab", "ArrowLeft", "ArrowRight"], r = wt.test(t.key) || a.includes(t.key), o = [1, 2, 4, 5].includes(e) && t.key === ":";
|
|
108
|
-
!r && !o && t.preventDefault();
|
|
109
|
-
}, Ce = (t) => {
|
|
110
|
-
if (!t)
|
|
111
|
-
return t;
|
|
112
|
-
let e = t;
|
|
113
|
-
if (e.length === 1 && parseInt(t, 10) > 2)
|
|
114
|
-
return `0${e}:`;
|
|
115
|
-
const [a, r] = e.slice(-2);
|
|
116
|
-
return [2, 5].includes(e.length) && r === ":" && (e = `${e.slice(0, e.length - 2)}0${a}`), (Ot.test(e) || Mt.test(e)) && (e += ":"), e;
|
|
117
|
-
};
|
|
118
|
-
function Ft(t, e, a) {
|
|
119
|
-
const r = Y(t, a == null ? void 0 : a.in);
|
|
120
|
-
return r.setHours(e), r;
|
|
121
|
-
}
|
|
122
|
-
function xt(t, e, a) {
|
|
123
|
-
const r = Y(t, a == null ? void 0 : a.in);
|
|
124
|
-
return r.setMinutes(e), r;
|
|
125
|
-
}
|
|
126
|
-
function At(t, e, a) {
|
|
127
|
-
const r = Y(t, a == null ? void 0 : a.in);
|
|
128
|
-
return r.setSeconds(e), r;
|
|
129
|
-
}
|
|
130
|
-
function Fe(t, e) {
|
|
131
|
-
const a = Y(t, e == null ? void 0 : e.in);
|
|
132
|
-
return a.setMilliseconds(0), a;
|
|
133
|
-
}
|
|
134
|
-
function xe(t, e) {
|
|
135
|
-
return +Fe(t) == +Fe(e);
|
|
136
|
-
}
|
|
137
|
-
function ce(t, e) {
|
|
138
|
-
return +Y(t) == +Y(e);
|
|
139
|
-
}
|
|
140
|
-
function Ut(t, e) {
|
|
141
|
-
return A(
|
|
142
|
-
gt(t, t),
|
|
143
|
-
Tt(t)
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
function Ae(t, e, a) {
|
|
147
|
-
const r = Y(t, a == null ? void 0 : a.in);
|
|
148
|
-
return r.setMilliseconds(e), r;
|
|
149
|
-
}
|
|
150
|
-
const Bt = {
|
|
151
|
-
"en-US": {
|
|
152
|
-
customRange: "Custom range",
|
|
153
|
-
daily: "Daily",
|
|
154
|
-
dateFrom: "Date from",
|
|
155
|
-
dateTo: "Date to",
|
|
156
|
-
lastMonth: "Last month",
|
|
157
|
-
lastSevenDays: "Last 7 days",
|
|
158
|
-
lastThreeMonths: "Last three months",
|
|
159
|
-
monthly: "Monthly",
|
|
160
|
-
quarterly: "Quarterly",
|
|
161
|
-
timeFrom: "Time from",
|
|
162
|
-
timeTo: "Time to",
|
|
163
|
-
weekly: "Weekly"
|
|
164
|
-
},
|
|
165
|
-
"ja-JP": {
|
|
166
|
-
customRange: "カスタム範囲を選択",
|
|
167
|
-
daily: "毎日",
|
|
168
|
-
lastMonth: "先月",
|
|
169
|
-
lastSevenDays: "過去7日間",
|
|
170
|
-
monthly: "毎月",
|
|
171
|
-
weekly: "毎週"
|
|
172
|
-
},
|
|
173
|
-
"pt-BR": {
|
|
174
|
-
customRange: "Selecione um intervalo personalizado",
|
|
175
|
-
daily: "Diário",
|
|
176
|
-
lastMonth: "Último mês",
|
|
177
|
-
lastSevenDays: "Últimos 7 dias",
|
|
178
|
-
monthly: "Mensal",
|
|
179
|
-
weekly: "Semanal"
|
|
180
|
-
}
|
|
181
|
-
}, Ue = 300, Be = "customRange", Nt = qe({
|
|
182
|
-
i18n: { messages: Bt },
|
|
183
|
-
name: "date-range-picker-calendar",
|
|
184
|
-
components: {
|
|
185
|
-
BentoDropdown: ot,
|
|
186
|
-
BentoInputField: it,
|
|
187
|
-
BentoSegmentedControl: ut,
|
|
188
|
-
BentoTypography: Ye,
|
|
189
|
-
Calendar: W
|
|
190
|
-
},
|
|
191
|
-
props: {
|
|
192
|
-
/**
|
|
193
|
-
* Allows user to enter time values in the form
|
|
194
|
-
*/
|
|
195
|
-
allowTimeInput: { type: Boolean, default: !1 },
|
|
196
|
-
/**
|
|
197
|
-
* Ranges form persistance data
|
|
198
|
-
*/
|
|
199
|
-
dateFormData: {
|
|
200
|
-
type: Object,
|
|
201
|
-
default: () => ({ startDate: void 0, endDate: void 0, startTime: void 0, endTime: void 0 })
|
|
202
|
-
},
|
|
203
|
-
/**
|
|
204
|
-
* Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday
|
|
205
|
-
*/
|
|
206
|
-
firstDayOfWeek: W.props.firstDayOfWeek,
|
|
207
|
-
/**
|
|
208
|
-
* A list of available granularities.
|
|
209
|
-
* If present, the date picker will display a segmented control to change granularity.
|
|
210
|
-
*/
|
|
211
|
-
granularities: {
|
|
212
|
-
type: Array,
|
|
213
|
-
default: null
|
|
214
|
-
},
|
|
215
|
-
/**
|
|
216
|
-
* Indicate if a date should be disabled or not
|
|
217
|
-
*/
|
|
218
|
-
isDateDisabled: W.props.isDateDisabled,
|
|
219
|
-
/**
|
|
220
|
-
* Set a maximum number of dates to be selectable by the range.
|
|
221
|
-
*/
|
|
222
|
-
maxRange: W.props.maxRange,
|
|
223
|
-
/**
|
|
224
|
-
* Sets a minimum limit for selectable dates - dates before `min` will not be selectable
|
|
225
|
-
*/
|
|
226
|
-
min: W.props.min,
|
|
227
|
-
/**
|
|
228
|
-
* Sets a maximum limit for selectable dates - dates after `max` will not be selectable
|
|
229
|
-
*/
|
|
230
|
-
max: W.props.max,
|
|
231
|
-
/**
|
|
232
|
-
* Number of months rendered on pane
|
|
233
|
-
*/
|
|
234
|
-
numberOfMonths: W.props.numberOfMonths,
|
|
235
|
-
/**
|
|
236
|
-
* Displays the end date's month when the calendar is opened. Defaults to false i.e. the start date's month is displayed.
|
|
237
|
-
*/
|
|
238
|
-
showEndDateOnOpen: { type: Boolean, default: !1 },
|
|
239
|
-
/**
|
|
240
|
-
* Enables the custom range selector.
|
|
241
|
-
* If provided, must be an array that sets the custom range dropdown items. Items are of the structure:
|
|
242
|
-
* `label` - label of custom range item.
|
|
243
|
-
* `value` - a unique key of the custom range item.
|
|
244
|
-
* `data` - an object `{ startDate: Date; endDate: Date }` to set the date picker range to upon selecting.
|
|
245
|
-
*/
|
|
246
|
-
quickSelectRanges: {
|
|
247
|
-
type: Array,
|
|
248
|
-
default: void 0
|
|
249
|
-
},
|
|
250
|
-
/**
|
|
251
|
-
* Selected date
|
|
252
|
-
*/
|
|
253
|
-
value: { type: Object, default: void 0 },
|
|
254
|
-
/**
|
|
255
|
-
* The type of calendar to display. Defaults to showing days.
|
|
256
|
-
*/
|
|
257
|
-
variant: W.props.variant
|
|
258
|
-
},
|
|
259
|
-
emits: [
|
|
260
|
-
v.CUSTOM_RANGE,
|
|
261
|
-
v.INPUT,
|
|
262
|
-
v.ERROR,
|
|
263
|
-
v.FORM_DATE,
|
|
264
|
-
v.START_DATE_SELECTED
|
|
265
|
-
],
|
|
266
|
-
setup(t, { emit: e, slots: a }) {
|
|
267
|
-
var Re, Ie, be, ke;
|
|
268
|
-
const { locale: r, t: o } = _e(), c = pe(), m = M({}), y = b(() => t.variant === "month" ? "monthly" : "daily"), s = me({
|
|
269
|
-
startDate: (Re = t.value) == null ? void 0 : Re.startDate,
|
|
270
|
-
endDate: (Ie = t.value) == null ? void 0 : Ie.endDate,
|
|
271
|
-
range: (be = t.value) == null ? void 0 : be.range,
|
|
272
|
-
...t.granularities ? {
|
|
273
|
-
granularity: ((ke = t.value) == null ? void 0 : ke.granularity) || y.value
|
|
274
|
-
} : {}
|
|
275
|
-
});
|
|
276
|
-
function p(n) {
|
|
277
|
-
return n ? new Date(
|
|
278
|
-
n.getUTCFullYear(),
|
|
279
|
-
n.getUTCMonth(),
|
|
280
|
-
n.getUTCDate(),
|
|
281
|
-
n.getUTCHours(),
|
|
282
|
-
n.getUTCMinutes(),
|
|
283
|
-
n.getUTCSeconds()
|
|
284
|
-
) : null;
|
|
285
|
-
}
|
|
286
|
-
const k = b(() => {
|
|
287
|
-
var n, l;
|
|
288
|
-
return (
|
|
289
|
-
// eslint-disable-next-line consistent-return
|
|
290
|
-
((l = (n = t == null ? void 0 : t.quickSelectRanges) == null ? void 0 : n.find(({ value: d, data: u }) => {
|
|
291
|
-
var S;
|
|
292
|
-
if (!u.endDate) {
|
|
293
|
-
if (u.isRelativeToNow) {
|
|
294
|
-
const O = (S = m.value) == null ? void 0 : S[d];
|
|
295
|
-
return O ? ce(
|
|
296
|
-
p(O.startDate),
|
|
297
|
-
p(s.startDate)
|
|
298
|
-
) && ce(
|
|
299
|
-
p(O.endDate),
|
|
300
|
-
p(s.endDate)
|
|
301
|
-
) : (
|
|
302
|
-
// If not stored calculated dates, fall back to comparing the quick select item's value
|
|
303
|
-
// with the internal range's stored range identifier.
|
|
304
|
-
d === s.range
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
return ce(
|
|
308
|
-
p(u.startDate),
|
|
309
|
-
p(s.startDate)
|
|
310
|
-
) && ce(
|
|
311
|
-
p(s.endDate),
|
|
312
|
-
p(N(s.endDate))
|
|
313
|
-
) && Ut(p(s.endDate)) && (t.granularities ? u.granularity === s.granularity : !0);
|
|
314
|
-
}
|
|
315
|
-
if (t.allowTimeInput)
|
|
316
|
-
return xe(
|
|
317
|
-
p(u.startDate),
|
|
318
|
-
p(s.startDate)
|
|
319
|
-
) && xe(
|
|
320
|
-
p(u.endDate),
|
|
321
|
-
p(s.endDate)
|
|
322
|
-
) && (t.granularities ? u.granularity === s.granularity : !0);
|
|
323
|
-
if (u.endDate)
|
|
324
|
-
return A(u.startDate, s.startDate) && A(u.endDate, s.endDate) && (t.granularities ? u.granularity === s.granularity : !0);
|
|
325
|
-
})) == null ? void 0 : l.value) ?? Be
|
|
326
|
-
);
|
|
327
|
-
}), j = b(() => ({
|
|
328
|
-
"b-date-range-picker-calendar__form-input-wrapper": t.allowTimeInput
|
|
329
|
-
})), re = b(() => [
|
|
330
|
-
{ label: o("customRange"), value: Be },
|
|
331
|
-
...t.quickSelectRanges ? t.quickSelectRanges : []
|
|
332
|
-
]), _ = b(
|
|
333
|
-
() => {
|
|
334
|
-
var n;
|
|
335
|
-
return ((n = t.granularities) == null ? void 0 : n.find(({ type: l }) => l === s.granularity)) || null;
|
|
336
|
-
}
|
|
337
|
-
), ee = b(
|
|
338
|
-
() => {
|
|
339
|
-
var n;
|
|
340
|
-
return ((n = t.granularities) == null ? void 0 : n.map(({ type: l, disabled: d }) => ({
|
|
341
|
-
label: o(l),
|
|
342
|
-
value: l,
|
|
343
|
-
disabled: d
|
|
344
|
-
}))) ?? [];
|
|
345
|
-
}
|
|
346
|
-
), { getGranularCalendarLimits: h } = Et(t), T = b(
|
|
347
|
-
() => t.granularities ? h(_.value) : { min: t.min ? C(t.min) : null, max: t.max ? N(t.max) : null }
|
|
348
|
-
), {
|
|
349
|
-
adjustDateForQuarterly: K,
|
|
350
|
-
adjustDateForMonthly: F,
|
|
351
|
-
adjustDateForWeekly: $,
|
|
352
|
-
adjustStartDateInputForWeekly: P,
|
|
353
|
-
adjustEndDateInputForWeekly: Q,
|
|
354
|
-
adjustStartDateInputForMonthly: g,
|
|
355
|
-
adjustEndDateInputForMonthly: te,
|
|
356
|
-
adjustStartDateInputForQuarterly: ae,
|
|
357
|
-
adjustEndDateInputForQuarterly: z
|
|
358
|
-
} = mt(t.firstDayOfWeek), { savedRanges: U, saveRange: G, resetSavedRanges: w } = ht(), f = (n) => {
|
|
359
|
-
var l;
|
|
360
|
-
return n ? ne(n, E.NUMERIC_DATE_YEAR_FIRST, {
|
|
361
|
-
locale: c[(l = r.value) == null ? void 0 : l.substring(0, 2)] || c.enUS
|
|
362
|
-
}) : "";
|
|
363
|
-
}, R = (n) => {
|
|
364
|
-
var l;
|
|
365
|
-
return n ? ne(n, E.HOUR_MINUTE_SECONDS, {
|
|
366
|
-
locale: c[(l = r.value) == null ? void 0 : l.substring(0, 2)] || c.enUS
|
|
367
|
-
}) : "";
|
|
368
|
-
}, q = M(!1), J = M(!1), L = M(!1), H = M(!1), i = me({
|
|
369
|
-
startDate: t.dateFormData.startDate,
|
|
370
|
-
endDate: t.dateFormData.endDate,
|
|
371
|
-
startTime: t.dateFormData.startTime,
|
|
372
|
-
endTime: t.dateFormData.endTime
|
|
373
|
-
}), fe = (n, l) => {
|
|
374
|
-
let d = new Date(n);
|
|
375
|
-
const [u, S, O] = l.split(":");
|
|
376
|
-
return d = Ft(d, parseInt(u, 10)), d = xt(d, parseInt(S, 10)), d = At(d, parseInt(O, 10)), d;
|
|
377
|
-
}, ve = (n) => /^(?:[01]\d|2[01234]):(?:[012345]\d):(?:[012345]\d)$/.test(n), se = (n, l) => {
|
|
378
|
-
const d = () => {
|
|
379
|
-
if (l && I(l)) {
|
|
380
|
-
const u = fe(new Date(l), n);
|
|
381
|
-
if (t.min && u < Ae(t.min, 0) || t.max && u > Ae(t.max, 0))
|
|
382
|
-
return !1;
|
|
383
|
-
}
|
|
384
|
-
return !0;
|
|
385
|
-
};
|
|
386
|
-
return ve(n) && d();
|
|
387
|
-
}, B = (n, l) => !l || !ve(l) || t.variant === "month" ? n : fe(new Date(n), l), D = (n) => {
|
|
388
|
-
i.startTime = R(
|
|
389
|
-
t.min && t.allowTimeInput && A(t.min, n.startDate) ? t.min : C(n.startDate)
|
|
390
|
-
), i.endTime = R(
|
|
391
|
-
t.max && t.allowTimeInput && A(t.max, n.endDate) ? t.max : N(n.endDate)
|
|
392
|
-
), s.startDate = B(n.startDate, i.startTime), s.endDate = B(n.endDate, i.endTime), s.range = null, t.granularities && w(), e(v.INPUT, {
|
|
393
|
-
...s,
|
|
394
|
-
range: k.value
|
|
395
|
-
});
|
|
396
|
-
}, I = (n) => {
|
|
397
|
-
const l = (u) => t.min && C(u) < C(t.min) || t.max && C(u) > C(t.max) ? !1 : t.isDateDisabled ? !t.isDateDisabled(C(u)) : !0;
|
|
398
|
-
return /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(n) && l(new Date(n));
|
|
399
|
-
};
|
|
400
|
-
Le(() => {
|
|
401
|
-
q.value = !!(t.dateFormData.startDate && !I(t.dateFormData.startDate)), t.allowTimeInput ? L.value = !!(t.dateFormData.startTime && !se(t.dateFormData.startTime, t.dateFormData.startDate)) : L.value = !1, J.value = !!(t.dateFormData.endDate && !I(t.dateFormData.endDate)), t.allowTimeInput ? H.value = !!(t.dateFormData.endTime && !se(t.dateFormData.endTime, t.dateFormData.endDate)) : H.value = !1;
|
|
402
|
-
});
|
|
403
|
-
const X = (n) => {
|
|
404
|
-
var l;
|
|
405
|
-
i.startDate = f(n), i.startTime ? L.value && (i.startTime = (l = t.dateFormData) == null ? void 0 : l.startTime) : i.startTime = R(n), q.value = !1, L.value = !1, e(v.START_DATE_SELECTED, n);
|
|
406
|
-
}, V = (n) => {
|
|
407
|
-
var l;
|
|
408
|
-
i.endDate = f(n), i.endTime ? H.value && (i.endTime = (l = t.dateFormData) == null ? void 0 : l.endTime) : i.endTime = R(N(n)), J.value = !1, H.value = !1;
|
|
409
|
-
}, x = (n) => {
|
|
410
|
-
const l = t.value[n];
|
|
411
|
-
if (l)
|
|
412
|
-
return l;
|
|
413
|
-
if (t.dateFormData[n] && I(t.dateFormData[n]))
|
|
414
|
-
return new Date(t.dateFormData[n]);
|
|
415
|
-
}, oe = de((n) => {
|
|
416
|
-
var l;
|
|
417
|
-
if (I(n)) {
|
|
418
|
-
let d = n;
|
|
419
|
-
switch (q.value = !1, (l = _.value) == null ? void 0 : l.type) {
|
|
420
|
-
case "weekly":
|
|
421
|
-
d = P(
|
|
422
|
-
n,
|
|
423
|
-
f,
|
|
424
|
-
T.value.min,
|
|
425
|
-
T.value.max
|
|
426
|
-
), i.startDate = d;
|
|
427
|
-
break;
|
|
428
|
-
case "monthly":
|
|
429
|
-
d = g(
|
|
430
|
-
n,
|
|
431
|
-
f,
|
|
432
|
-
T.value.min,
|
|
433
|
-
T.value.max
|
|
434
|
-
), i.startDate = d;
|
|
435
|
-
break;
|
|
436
|
-
case "quarterly":
|
|
437
|
-
d = ae(
|
|
438
|
-
n,
|
|
439
|
-
f,
|
|
440
|
-
T.value.min,
|
|
441
|
-
T.value.max
|
|
442
|
-
), i.startDate = d;
|
|
443
|
-
break;
|
|
444
|
-
}
|
|
445
|
-
const u = Z(d);
|
|
446
|
-
s.startDate = B(u, i.startTime), s.endDate = B(
|
|
447
|
-
Z(i.endDate),
|
|
448
|
-
i.endTime
|
|
449
|
-
), I(i.endDate) && (s.endDate = B(
|
|
450
|
-
Z(i.endDate),
|
|
451
|
-
i.endTime
|
|
452
|
-
));
|
|
453
|
-
const S = x("endDate");
|
|
454
|
-
s.range = null, e(v.FORM_DATE, {
|
|
455
|
-
startDate: u,
|
|
456
|
-
endDate: S
|
|
457
|
-
}), e(v.INPUT, {
|
|
458
|
-
...s,
|
|
459
|
-
range: k.value
|
|
460
|
-
});
|
|
461
|
-
} else
|
|
462
|
-
q.value = !0, e(v.ERROR, { ...i });
|
|
463
|
-
}, Ue), Ge = (n) => {
|
|
464
|
-
i.startDate = Me(n), oe(i.startDate);
|
|
465
|
-
}, He = de((n) => {
|
|
466
|
-
var l;
|
|
467
|
-
if (I(n)) {
|
|
468
|
-
let d = n;
|
|
469
|
-
switch (J.value = !1, (l = _.value) == null ? void 0 : l.type) {
|
|
470
|
-
case "weekly":
|
|
471
|
-
d = Q(
|
|
472
|
-
n,
|
|
473
|
-
f,
|
|
474
|
-
T.value.min,
|
|
475
|
-
T.value.max
|
|
476
|
-
), i.endDate = d;
|
|
477
|
-
break;
|
|
478
|
-
case "monthly":
|
|
479
|
-
d = te(
|
|
480
|
-
n,
|
|
481
|
-
f,
|
|
482
|
-
T.value.min,
|
|
483
|
-
T.value.max
|
|
484
|
-
), i.endDate = d;
|
|
485
|
-
break;
|
|
486
|
-
case "quarterly":
|
|
487
|
-
d = z(
|
|
488
|
-
n,
|
|
489
|
-
f,
|
|
490
|
-
T.value.min,
|
|
491
|
-
T.value.max
|
|
492
|
-
), i.endDate = d;
|
|
493
|
-
break;
|
|
494
|
-
}
|
|
495
|
-
const u = Z(d);
|
|
496
|
-
s.endDate = B(u, i.endTime), I(i.startDate) && (s.startDate = B(
|
|
497
|
-
Z(i.startDate),
|
|
498
|
-
i.startTime
|
|
499
|
-
));
|
|
500
|
-
const S = x("startDate");
|
|
501
|
-
s.range = null, e(v.FORM_DATE, {
|
|
502
|
-
startDate: S,
|
|
503
|
-
endDate: u
|
|
504
|
-
}), e(v.INPUT, {
|
|
505
|
-
...s,
|
|
506
|
-
range: k.value
|
|
507
|
-
});
|
|
508
|
-
} else
|
|
509
|
-
J.value = !0, e(v.ERROR, { ...i });
|
|
510
|
-
}, Ue), Ve = (n) => {
|
|
511
|
-
i.endDate = Me(n), He(i.endDate);
|
|
512
|
-
}, We = (n) => {
|
|
513
|
-
vt(n);
|
|
514
|
-
}, Ke = de((n) => {
|
|
515
|
-
if (se(n, t.dateFormData.startDate)) {
|
|
516
|
-
L.value = !1, s.startDate = B(s.startDate, n);
|
|
517
|
-
const l = x("endDate");
|
|
518
|
-
e(v.FORM_DATE, {
|
|
519
|
-
startDate: s.startDate,
|
|
520
|
-
endDate: l,
|
|
521
|
-
startTime: n,
|
|
522
|
-
endTime: i.endTime ?? t.dateFormData.endTime
|
|
523
|
-
}), e(v.INPUT, {
|
|
524
|
-
...s,
|
|
525
|
-
range: k.value
|
|
526
|
-
});
|
|
527
|
-
} else
|
|
528
|
-
L.value = !0, e(v.ERROR, { ...i });
|
|
529
|
-
}), ze = de((n) => {
|
|
530
|
-
se(n, t.dateFormData.endDate) ? (H.value = !1, s.endDate = B(s.endDate, n), e(v.FORM_DATE, {
|
|
531
|
-
startDate: s.startDate,
|
|
532
|
-
endDate: s.endDate,
|
|
533
|
-
startTime: i.startTime ?? t.dateFormData.startTime,
|
|
534
|
-
endTime: n
|
|
535
|
-
}), e(v.INPUT, {
|
|
536
|
-
...s,
|
|
537
|
-
range: k.value
|
|
538
|
-
})) : (H.value = !0, e(v.ERROR, { ...i }));
|
|
539
|
-
}), Je = (n) => {
|
|
540
|
-
i.startTime = Ce(n), Ke(i.startTime);
|
|
541
|
-
}, Xe = (n) => {
|
|
542
|
-
i.endTime = Ce(n), ze(i.endTime);
|
|
543
|
-
}, Ze = (n) => {
|
|
544
|
-
Ct(n);
|
|
545
|
-
}, ue = (n, l, d, u) => {
|
|
546
|
-
s.startDate = n, s.endDate = l, d && (s.granularity = d), u && (s.range = u);
|
|
547
|
-
}, et = (n) => {
|
|
548
|
-
var d;
|
|
549
|
-
const l = (d = t.quickSelectRanges) == null ? void 0 : d.find(({ value: u }) => u === n);
|
|
550
|
-
if (l) {
|
|
551
|
-
w();
|
|
552
|
-
const u = l.data, S = u.endDate || (u.isRelativeToNow ? new Date(Date.now()) : N(new Date(Date.now()))), O = u.isRelativeToNow && u.timeDifference ? new Date(S.getTime() - u.timeDifference) : u.startDate;
|
|
553
|
-
i.endDate = f(S), i.startDate = f(O), ue(O, S, null, n), t.granularities && (s.granularity = u.granularity || y.value), i.startTime = R(O), i.endTime = R(S), s.startDate = O, s.endDate = S, u.isRelativeToNow && (m.value = {
|
|
554
|
-
...m.value,
|
|
555
|
-
[n]: {
|
|
556
|
-
startDate: O,
|
|
557
|
-
endDate: S
|
|
558
|
-
}
|
|
559
|
-
}), e(v.CUSTOM_RANGE, {
|
|
560
|
-
...l.data,
|
|
561
|
-
startDate: O,
|
|
562
|
-
endDate: S,
|
|
563
|
-
range: l.value
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
}, tt = {
|
|
567
|
-
weekly: $,
|
|
568
|
-
monthly: F,
|
|
569
|
-
quarterly: K
|
|
570
|
-
}, at = (n) => {
|
|
571
|
-
const l = s.granularity;
|
|
572
|
-
if (s.granularity = n, l && G(l, structuredClone(Te(s))), s.startDate && s.endDate) {
|
|
573
|
-
switch (n) {
|
|
574
|
-
case "quarterly":
|
|
575
|
-
case "monthly":
|
|
576
|
-
case "weekly": {
|
|
577
|
-
if (U[n]) {
|
|
578
|
-
ue(U[n].startDate, U[n].endDate, n);
|
|
579
|
-
break;
|
|
580
|
-
}
|
|
581
|
-
const { startDate: d, endDate: u } = tt[n](
|
|
582
|
-
s.startDate,
|
|
583
|
-
s.endDate,
|
|
584
|
-
T.value.min,
|
|
585
|
-
T.value.max
|
|
586
|
-
);
|
|
587
|
-
ue(d, u, n);
|
|
588
|
-
break;
|
|
589
|
-
}
|
|
590
|
-
case "daily":
|
|
591
|
-
U.daily && ue(U.daily.startDate, U.daily.endDate, n);
|
|
592
|
-
break;
|
|
593
|
-
}
|
|
594
|
-
i.startDate = f(s.startDate), i.endDate = f(s.endDate), e(v.INPUT, {
|
|
595
|
-
...s,
|
|
596
|
-
range: k.value
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
return {
|
|
601
|
-
// Values
|
|
602
|
-
internalRangeDate: s,
|
|
603
|
-
dateTextInput: i,
|
|
604
|
-
endDateError: J,
|
|
605
|
-
endTimeError: H,
|
|
606
|
-
granularityItems: ee,
|
|
607
|
-
selectedGranularity: _,
|
|
608
|
-
computedMinMax: T,
|
|
609
|
-
selectedRangeSelectorValue: k,
|
|
610
|
-
startDateError: q,
|
|
611
|
-
startTimeError: L,
|
|
612
|
-
quickSelectRangeDefaultItems: re,
|
|
613
|
-
formInputWrapperConditionalClasses: j,
|
|
614
|
-
// Methods
|
|
615
|
-
hasSlot: ft(a),
|
|
616
|
-
t: o,
|
|
617
|
-
// Events
|
|
618
|
-
onDateInput: D,
|
|
619
|
-
onDateInputKeyDown: We,
|
|
620
|
-
onEndDateInput: Ve,
|
|
621
|
-
onEndDateSelected: V,
|
|
622
|
-
onEndTimeInput: Xe,
|
|
623
|
-
onGranularityInput: at,
|
|
624
|
-
onRangeSelectorInput: et,
|
|
625
|
-
onStartDateInput: Ge,
|
|
626
|
-
onStartDateSelected: X,
|
|
627
|
-
onStartTimeInput: Je,
|
|
628
|
-
onTimeInputKeyDown: Ze
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
var Pt = function() {
|
|
633
|
-
var e = this, a = e._self._c;
|
|
634
|
-
return e._self._setupProxy, a("div", { staticClass: "b-date-range-picker-calendar" }, [a("div", { staticClass: "b-date-range-picker-calendar__form-container" }, [a("div", { staticClass: "b-date-range-picker-calendar__form" }, [e.hasSlot("title") ? [e._t("title")] : e._e(), e.quickSelectRanges ? a("bento-dropdown", { attrs: { "aria-label": e.t("customRange"), items: e.quickSelectRangeDefaultItems, value: e.selectedRangeSelectorValue }, on: { input: e.onRangeSelectorInput } }) : e._e(), e.granularities ? a("bento-segmented-control", { attrs: { items: e.granularityItems, "model-value": e.internalRangeDate.granularity, "full-width": "" }, on: { "update:model-value": e.onGranularityInput } }) : e._e(), a("div", [a("bento-typography", { staticClass: "b-date-range-picker-calendar__label", attrs: { stronger: "", el: "span" } }, [e._v(" From ")]), a("div", { class: e.formInputWrapperConditionalClasses }, [a("bento-input-field", { staticClass: "b-date-range-picker-calendar__form-input", attrs: { "aria-label": e.t("dateFrom"), value: e.dateTextInput.startDate, error: e.startDateError }, on: { input: e.onStartDateInput, keydown: e.onDateInputKeyDown }, scopedSlots: e._u([{ key: "description", fn: function() {
|
|
635
|
-
return [e._v("YYYY-MM-DD")];
|
|
636
|
-
}, proxy: !0 }]) }), e.allowTimeInput ? a("bento-input-field", { staticClass: "b-date-range-picker-calendar__form-input", attrs: { "aria-label": e.t("timeFrom"), value: e.dateTextInput.startTime, error: e.startTimeError }, on: { input: e.onStartTimeInput, keydown: e.onTimeInputKeyDown }, scopedSlots: e._u([{ key: "description", fn: function() {
|
|
637
|
-
return [e._v("HH:MM:SS")];
|
|
638
|
-
}, proxy: !0 }], null, !1, 3442289499) }) : e._e()], 1)], 1), a("div", [a("bento-typography", { staticClass: "b-date-range-picker-calendar__label", attrs: { stronger: "", el: "span" } }, [e._v(" To ")]), a("div", { class: e.formInputWrapperConditionalClasses }, [a("bento-input-field", { staticClass: "b-date-range-picker-calendar__form-input", attrs: { "aria-label": e.t("dateTo"), value: e.dateTextInput.endDate, error: e.endDateError }, on: { input: e.onEndDateInput, keydown: e.onDateInputKeyDown }, scopedSlots: e._u([{ key: "description", fn: function() {
|
|
639
|
-
return [e._v("YYYY-MM-DD")];
|
|
640
|
-
}, proxy: !0 }]) }), e.allowTimeInput ? a("bento-input-field", { staticClass: "b-date-range-picker-calendar__form-input", attrs: { "aria-label": e.t("timeTo"), value: e.dateTextInput.endTime, error: e.endTimeError }, on: { input: e.onEndTimeInput, keydown: e.onTimeInputKeyDown }, scopedSlots: e._u([{ key: "description", fn: function() {
|
|
641
|
-
return [e._v("HH:MM:SS")];
|
|
642
|
-
}, proxy: !0 }], null, !1, 3442289499) }) : e._e()], 1)], 1)], 2), e.hasSlot("actions") ? a("div", [e._t("actions")], 2) : e._e()]), a("div", { staticClass: "b-date-range-picker-calendar__calendars-container" }, [a("calendar", { attrs: { value: e.internalRangeDate, "first-day-of-week": e.firstDayOfWeek, "is-date-disabled": e.isDateDisabled, "max-range": e.maxRange, min: e.computedMinMax.min, max: e.computedMinMax.max, "number-of-months": e.numberOfMonths, "show-end-date-on-open": e.showEndDateOnOpen, granularity: e.selectedGranularity, variant: e.variant, "is-range": "" }, on: { input: e.onDateInput, "start-date-selected": e.onStartDateSelected, "end-date-selected": e.onEndDateSelected } })], 1)]);
|
|
643
|
-
}, qt = [], Lt = /* @__PURE__ */ $e(
|
|
644
|
-
Nt,
|
|
645
|
-
Pt,
|
|
646
|
-
qt,
|
|
647
|
-
!1,
|
|
648
|
-
null,
|
|
649
|
-
"5c731044"
|
|
650
|
-
);
|
|
651
|
-
const Yt = Lt.exports;
|
|
652
|
-
function Ne(t, e) {
|
|
653
|
-
const a = Y(t, e == null ? void 0 : e.in);
|
|
654
|
-
return Math.trunc(a.getMonth() / 3) + 1;
|
|
655
|
-
}
|
|
656
|
-
function Pe(t, e) {
|
|
657
|
-
return Y(t, e == null ? void 0 : e.in).getFullYear();
|
|
658
|
-
}
|
|
659
|
-
function jt(t, e, a) {
|
|
660
|
-
const [r, o] = yt(
|
|
661
|
-
a == null ? void 0 : a.in,
|
|
662
|
-
t,
|
|
663
|
-
e
|
|
664
|
-
);
|
|
665
|
-
return +ie(r) == +ie(o);
|
|
666
|
-
}
|
|
667
|
-
const $t = {
|
|
668
|
-
"en-US": {
|
|
669
|
-
apply: "Apply",
|
|
670
|
-
cancel: "Cancel",
|
|
671
|
-
dateRangePicker: "Date range picker {name}",
|
|
672
|
-
provideDateInAFormat: "Provide date in a YYYY-MM-DD format",
|
|
673
|
-
quarter: "Q{quarter} {year}",
|
|
674
|
-
selectDate: "Select a date",
|
|
675
|
-
selectDateRange: "Select a date range",
|
|
676
|
-
selectedDateIsNotAvailable: "Selected date is not available"
|
|
677
|
-
},
|
|
678
|
-
"ja-JP": {
|
|
679
|
-
apply: "適用",
|
|
680
|
-
cancel: "キャンセル",
|
|
681
|
-
selectDate: "日付を選択"
|
|
682
|
-
},
|
|
683
|
-
"pt-BR": {
|
|
684
|
-
apply: "Aplicar",
|
|
685
|
-
cancel: "Cancelar",
|
|
686
|
-
selectDate: "Selecione uma data"
|
|
687
|
-
}
|
|
688
|
-
}, Qt = ({
|
|
689
|
-
datePickerValue: t,
|
|
690
|
-
isDateIncorrect: e,
|
|
691
|
-
quickSelectRanges: a,
|
|
692
|
-
isMonthVariant: r,
|
|
693
|
-
withTimeInput: o,
|
|
694
|
-
placeholder: c
|
|
695
|
-
}) => {
|
|
696
|
-
var ee, h, T, K;
|
|
697
|
-
const { locale: m, t: y } = _e(), s = pe(), p = (F) => !!F && !isNaN(F.getTime()), k = (F, $) => {
|
|
698
|
-
var P;
|
|
699
|
-
return p(F) ? ne(F, $, {
|
|
700
|
-
locale: s[(P = m.value) == null ? void 0 : P.substring(0, 2)] || s.enUS
|
|
701
|
-
}) : void 0;
|
|
702
|
-
}, j = me({
|
|
703
|
-
startDate: k((ee = t.value) == null ? void 0 : ee.startDate, E.NUMERIC_DATE_YEAR_FIRST),
|
|
704
|
-
endDate: k((h = t.value) == null ? void 0 : h.endDate, E.NUMERIC_DATE_YEAR_FIRST),
|
|
705
|
-
startTime: k((T = t.value) == null ? void 0 : T.startDate, E.HOUR_MINUTE_SECONDS),
|
|
706
|
-
endTime: k((K = t.value) == null ? void 0 : K.endDate, E.HOUR_MINUTE_SECONDS)
|
|
707
|
-
});
|
|
708
|
-
return {
|
|
709
|
-
// Values
|
|
710
|
-
dateDisplayValue: b(() => {
|
|
711
|
-
var G;
|
|
712
|
-
if (e.value)
|
|
713
|
-
return `${j.startDate || ""} - ${j.endDate || ""}`;
|
|
714
|
-
if (!t.value || !t.value.startDate && !t.value.endDate)
|
|
715
|
-
return (c == null ? void 0 : c.value) || y("selectDateRange");
|
|
716
|
-
if ((G = a.value) != null && G.length) {
|
|
717
|
-
const w = a.value.find(({ value: f }) => {
|
|
718
|
-
var R;
|
|
719
|
-
return f === ((R = t.value) == null ? void 0 : R.range);
|
|
720
|
-
});
|
|
721
|
-
if (w)
|
|
722
|
-
return w.label;
|
|
723
|
-
}
|
|
724
|
-
if (t.value.granularity === "quarterly") {
|
|
725
|
-
const { startDate: w, endDate: f } = t.value, R = y("quarter", { quarter: Ne(w), year: Pe(w) });
|
|
726
|
-
if (jt(w, f))
|
|
727
|
-
return R;
|
|
728
|
-
const q = y("quarter", { quarter: Ne(f), year: Pe(f) });
|
|
729
|
-
return `${R} - ${q}`;
|
|
730
|
-
}
|
|
731
|
-
const { startDate: F, endDate: $, startTime: P, endTime: Q } = j, g = r != null && r.value ? E.LONG_MONTH_YEAR : E.FULL_DATE_MONTH_FIRST, te = k(Z(F), g), ae = k(Z($), g);
|
|
732
|
-
if (!o.value)
|
|
733
|
-
return `${te} - ${ae}`;
|
|
734
|
-
const z = [te, P].filter(Boolean).join(", "), U = [ae, Q].filter(Boolean).join(", ");
|
|
735
|
-
return `${z} - ${U}`;
|
|
736
|
-
}),
|
|
737
|
-
textInputDisplayValue: j,
|
|
738
|
-
// Methods
|
|
739
|
-
formatTextInputDisplayValue: () => ""
|
|
740
|
-
};
|
|
741
|
-
};
|
|
742
|
-
var De = /* @__PURE__ */ ((t) => (t.INPUT = "input", t))(De || {});
|
|
743
|
-
const Gt = {
|
|
744
|
-
i18n: { messages: $t },
|
|
745
|
-
name: "bento-date-range-picker"
|
|
746
|
-
}, Ht = /* @__PURE__ */ qe({
|
|
747
|
-
...Gt,
|
|
748
|
-
props: {
|
|
749
|
-
description: { default: void 0 },
|
|
750
|
-
disabled: { type: Boolean, default: !1 },
|
|
751
|
-
errorMessage: { default: null },
|
|
752
|
-
label: { default: void 0 },
|
|
753
|
-
optional: { type: Boolean, default: !1 },
|
|
754
|
-
placeholder: { default: null },
|
|
755
|
-
readonly: { type: Boolean, default: !1 },
|
|
756
|
-
required: { type: Boolean, default: !1 },
|
|
757
|
-
tooltipText: { default: null },
|
|
758
|
-
allowTimeInput: { type: Boolean },
|
|
759
|
-
firstDayOfWeek: { default: 1 },
|
|
760
|
-
granularities: null,
|
|
761
|
-
isDateDisabled: { default: void 0 },
|
|
762
|
-
showEndDateOnOpen: { type: Boolean, default: !1 },
|
|
763
|
-
quickSelectRanges: { default: void 0 },
|
|
764
|
-
maxRange: { default: null },
|
|
765
|
-
min: { default: null },
|
|
766
|
-
max: { default: null },
|
|
767
|
-
numberOfMonths: { default: void 0 },
|
|
768
|
-
value: { default: null },
|
|
769
|
-
variant: { default: void 0 },
|
|
770
|
-
hasActions: { type: Boolean, default: !1 }
|
|
771
|
-
},
|
|
772
|
-
emits: [De.INPUT],
|
|
773
|
-
setup(t, { emit: e }) {
|
|
774
|
-
const a = t, { locale: r, t: o } = _e(), c = pe(), m = le("bento-date-range-picker-container"), y = le("bento-date-range-picker-label"), s = le("bento-date-range-picker-description"), p = le("bento-date-range-picker-error"), k = le("bento-date-range-picker-date-error"), j = b(() => a.label || o("dateRangePicker", { name: m })), re = b(() => (a == null ? void 0 : a.quickSelectRanges) && a.quickSelectRanges.map((D) => {
|
|
775
|
-
const I = D.data.endDate ? void 0 : new Date(Date.now()).getTime() - D.data.startDate.getTime();
|
|
776
|
-
return {
|
|
777
|
-
...D,
|
|
778
|
-
data: {
|
|
779
|
-
...D.data,
|
|
780
|
-
// Adding timeDifference to calculate an up-to-date endDate on range selection
|
|
781
|
-
timeDifference: I
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
})), _ = M(!1), ee = M(null), h = M(!1), { isReadOnly: T } = pt(ge(a, "readonly"));
|
|
785
|
-
ye(
|
|
786
|
-
() => a.disabled,
|
|
787
|
-
() => {
|
|
788
|
-
a.disabled && h.value && (h.value = !1);
|
|
789
|
-
}
|
|
790
|
-
);
|
|
791
|
-
const K = b(() => a.hasActions ? !R.value && _.value : _.value), F = b(() => ({
|
|
792
|
-
"b-date-range-picker__description--error": !!a.errorMessage || K.value
|
|
793
|
-
})), $ = b(() => a.variant === "month"), P = b(() => a.allowTimeInput && a.variant !== "month"), { dateDisplayValue: Q, textInputDisplayValue: g, formatTextInputDisplayValue: te } = Qt({
|
|
794
|
-
datePickerValue: ge(a, "value"),
|
|
795
|
-
isDateIncorrect: _,
|
|
796
|
-
quickSelectRanges: re,
|
|
797
|
-
isMonthVariant: $,
|
|
798
|
-
withTimeInput: P,
|
|
799
|
-
placeholder: ge(a, "placeholder")
|
|
800
|
-
}), ae = b(
|
|
801
|
-
() => `${a.description ? s : ""} ${a.errorMessage ? p : ""} ${_.value ? k : ""}`.trim() || null
|
|
802
|
-
), z = () => {
|
|
803
|
-
h.value = !1;
|
|
804
|
-
}, U = () => {
|
|
805
|
-
h.value = !0;
|
|
806
|
-
}, G = M(Q.value), w = M(
|
|
807
|
-
// textInputDisplayValue is a reactive object
|
|
808
|
-
structuredClone(Te(g))
|
|
809
|
-
), f = M(a.value), R = M(!0), q = b(
|
|
810
|
-
() => a.hasActions ? w.value : g
|
|
811
|
-
), J = b(
|
|
812
|
-
() => a.hasActions ? G.value : Q.value
|
|
813
|
-
);
|
|
814
|
-
Le(() => {
|
|
815
|
-
if (a.hasActions || lt(
|
|
816
|
-
'BentoDateRangePicker "hasActions" property',
|
|
817
|
-
`Set the BentoDateRangePicker "hasActions" property true which will display the "Apply" and "Cancel" buttons.
|
|
818
|
-
This will be the default behavior in the v2 and "hasActions" will be removed.`,
|
|
819
|
-
"2.0.0"
|
|
820
|
-
), a.granularities && a.variant !== "month" && a.granularities.find(({ type: D }) => D === "quarterly"))
|
|
821
|
-
throw new Error('Quarterly granularity is only supported by BentoDateRangePicker with variant: "month"');
|
|
822
|
-
}), ye(
|
|
823
|
-
() => a.value,
|
|
824
|
-
() => {
|
|
825
|
-
G.value = Q.value, w.value = structuredClone(Te(g));
|
|
826
|
-
}
|
|
827
|
-
);
|
|
828
|
-
const L = b(() => [
|
|
829
|
-
{
|
|
830
|
-
title: o("apply"),
|
|
831
|
-
event: () => {
|
|
832
|
-
e(De.INPUT, f.value), z(), R.value = !0;
|
|
833
|
-
},
|
|
834
|
-
disabled: R.value
|
|
835
|
-
},
|
|
836
|
-
{
|
|
837
|
-
title: o("cancel"),
|
|
838
|
-
event: z
|
|
839
|
-
}
|
|
840
|
-
]);
|
|
841
|
-
return ye(f, (D) => {
|
|
842
|
-
if (a.hasActions) {
|
|
843
|
-
R.value = _.value;
|
|
844
|
-
return;
|
|
845
|
-
}
|
|
846
|
-
e(De.INPUT, D);
|
|
847
|
-
}), { __sfc: !0, emit: e, props: a, locale: r, t: o, locales: c, datePickerContainerId: m, labelId: y, descriptionId: s, errorId: p, dateErrorId: k, popoverAriaLabel: j, adjustedQuickSelectRanges: re, isDateIncorrect: _, inputContainerRef: ee, isDateRangePickerOpen: h, isReadOnly: T, shouldDisplayError: K, descriptionConditionalClasses: F, isMonthVariant: $, withTimeInput: P, dateDisplayValue: Q, textInputDisplayValue: g, formatTextInputDisplayValue: te, ariaDescribedBy: ae, closeDateRangePicker: z, openDateRangePicker: U, localDateDisplayValue: G, localTextInputDisplayValue: w, selectedDate: f, isApplyDisabled: R, displayedTextInputValue: q, displayedDateValue: J, rangePickerButtonActions: L, onDateRangePickerInput: (D) => {
|
|
848
|
-
_.value = !1;
|
|
849
|
-
const I = (X, V) => {
|
|
850
|
-
var x;
|
|
851
|
-
return X ? ne(X, V, {
|
|
852
|
-
locale: c[(x = r.value) == null ? void 0 : x.substring(0, 2)] || c.enUS
|
|
853
|
-
}) : void 0;
|
|
854
|
-
};
|
|
855
|
-
g.startDate = I(D.startDate, E.NUMERIC_DATE_YEAR_FIRST), g.endDate = I(D.endDate, E.NUMERIC_DATE_YEAR_FIRST), g.startTime = I(D.startDate, E.HOUR_MINUTE_SECONDS), g.endTime = I(D.endDate, E.HOUR_MINUTE_SECONDS), f.value = D;
|
|
856
|
-
}, clearDateRangePickerValue: async () => {
|
|
857
|
-
_.value && (_.value = !1), f.value = null;
|
|
858
|
-
}, onEnterPressedOverInput: () => {
|
|
859
|
-
if (!h.value) {
|
|
860
|
-
h.value = !0;
|
|
861
|
-
return;
|
|
862
|
-
}
|
|
863
|
-
_.value || (h.value = !1);
|
|
864
|
-
}, onDateRangePickerFormDateInputUpdate: (D) => {
|
|
865
|
-
_.value = !1, D.startTime && (g.startTime = D.startTime), D.endTime && (g.endTime = D.endTime);
|
|
866
|
-
}, onDateRangePickerError: (D) => {
|
|
867
|
-
_.value = !0, g.startDate = D.startDate, g.endDate = D.endDate, f.value = { startDate: null, endDate: null };
|
|
868
|
-
}, onRangeSelectorInput: (D) => {
|
|
869
|
-
if (D) {
|
|
870
|
-
const I = (V, x) => {
|
|
871
|
-
var oe;
|
|
872
|
-
return V ? ne(V, x, {
|
|
873
|
-
locale: c[(oe = r.value) == null ? void 0 : oe.substring(0, 2)] || c.enUS
|
|
874
|
-
}) : void 0;
|
|
875
|
-
}, X = (V) => {
|
|
876
|
-
var x;
|
|
877
|
-
return ne(V, E.NUMERIC_DATE_YEAR_FIRST, {
|
|
878
|
-
locale: c[(x = r.value) == null ? void 0 : x.substring(0, 2)] || c.enUS
|
|
879
|
-
});
|
|
880
|
-
};
|
|
881
|
-
g.startDate = X(D.startDate), g.endDate = X(D.endDate), g.startTime = I(
|
|
882
|
-
D.startDate,
|
|
883
|
-
E.HOUR_MINUTE_SECONDS
|
|
884
|
-
), g.endTime = I(D.endDate, E.HOUR_MINUTE_SECONDS), f.value = D;
|
|
885
|
-
}
|
|
886
|
-
}, BentoButtonActions: st, BentoButtonActionsLayout: kt, BentoDivider: nt, BentoPopover: rt, BentoTypography: Ye, DateRangePickerCalendar: Yt, DropdownInputDefault: _t, ErrorMessage: bt, FieldLabel: It, vBentoClickOutsideDirective: Rt };
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
var Vt = function() {
|
|
890
|
-
var e = this, a = e._self._c, r = e._self._setupProxy;
|
|
891
|
-
return a("div", { directives: [{ name: "bento-click-outside-directive", rawName: "v-bento-click-outside-directive", value: r.closeDateRangePicker, expression: "closeDateRangePicker" }], staticClass: "b-date-range-picker" }, [e.label ? a(r.FieldLabel, { attrs: { id: r.labelId, label: e.label, "tooltip-text": e.tooltipText, optional: e.optional, required: e.required } }) : e._e(), a("div", { on: { keydown: function(o) {
|
|
892
|
-
return !o.type.indexOf("key") && e._k(o.keyCode, "enter", 13, o.key, "Enter") ? null : r.onEnterPressedOverInput.apply(null, arguments);
|
|
893
|
-
} } }, [a(r.DropdownInputDefault, { ref: "inputContainerRef", attrs: { "always-combobox-is-input": "", ariaControls: r.datePickerContainerId, ariaExpanded: r.isDateRangePickerOpen, "aria-labelledby": e.label ? r.labelId : null, "aria-describedby": r.ariaDescribedBy, disabled: e.disabled, "is-invalid": !!e.errorMessage || r.shouldDisplayError, open: r.isDateRangePickerOpen, "display-value": r.displayedDateValue, readonly: r.isReadOnly }, on: { open: r.openDateRangePicker, clear: r.clearDateRangePickerValue, close: r.closeDateRangePicker } })], 1), r.shouldDisplayError ? a(r.ErrorMessage, { staticClass: "b-date-range-picker__error-message", attrs: { id: r.dateErrorId, "error-message": r.t("provideDateInAFormat") } }) : e._e(), e.errorMessage ? a(r.ErrorMessage, { staticClass: "b-date-range-picker__error-message", attrs: { id: r.errorId, "error-message": e.errorMessage } }) : e._e(), e.description ? a(r.BentoTypography, { staticClass: "b-date-range-picker__description", class: r.descriptionConditionalClasses, attrs: { id: r.descriptionId, el: "span" } }, [e._v(" " + e._s(e.description) + " ")]) : e._e(), r.inputContainerRef ? a(r.BentoPopover, { staticClass: "b-date-range-picker__container", attrs: { id: r.datePickerContainerId, open: r.isDateRangePickerOpen, "target-element": r.inputContainerRef, "aria-label": r.popoverAriaLabel, position: "bottom-start", "without-space": "", "fit-content": "", "trap-all": "" }, nativeOn: { keydown: function(o) {
|
|
894
|
-
return !o.type.indexOf("key") && e._k(o.keyCode, "esc", 27, o.key, ["Esc", "Escape"]) ? null : r.closeDateRangePicker.apply(null, arguments);
|
|
895
|
-
} } }, [a(r.DateRangePickerCalendar, { attrs: { "allow-time-input": r.withTimeInput, "quick-select-ranges": r.adjustedQuickSelectRanges, value: e.value, "first-day-of-week": e.firstDayOfWeek, granularities: e.granularities, "is-date-disabled": e.isDateDisabled, "max-range": e.maxRange, min: e.min, max: e.max, "number-of-months": e.numberOfMonths, "show-end-date-on-open": e.showEndDateOnOpen, "date-form-data": r.displayedTextInputValue, variant: e.variant }, on: { "custom-range": r.onRangeSelectorInput, input: r.onDateRangePickerInput, error: r.onDateRangePickerError, "form-date": r.onDateRangePickerFormDateInputUpdate }, scopedSlots: e._u([e.hasActions ? { key: "actions", fn: function() {
|
|
896
|
-
return [a(r.BentoDivider), a("div", { staticClass: "b-date-range-picker__footer" }, [a(r.BentoButtonActions, { attrs: { actions: r.rangePickerButtonActions, layout: r.BentoButtonActionsLayout.SPACE_BETWEEN } })], 1)];
|
|
897
|
-
}, proxy: !0 } : null], null, !0) })], 1) : e._e()], 1);
|
|
898
|
-
}, Wt = [], Kt = /* @__PURE__ */ $e(
|
|
899
|
-
Ht,
|
|
900
|
-
Vt,
|
|
901
|
-
Wt,
|
|
902
|
-
!1,
|
|
903
|
-
null,
|
|
904
|
-
"d01caa9e"
|
|
905
|
-
);
|
|
906
|
-
const pa = Kt.exports;
|
|
907
|
-
export {
|
|
908
|
-
pa as B,
|
|
909
|
-
Yt as D,
|
|
910
|
-
De as a,
|
|
911
|
-
Ut as b,
|
|
912
|
-
ce as i
|
|
913
|
-
};
|
|
914
|
-
//# sourceMappingURL=date-range-picker.NAG_5i8I.js.map
|