@adyen/bento-vue3 1.77.0 → 1.78.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 +145 -99
- 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/checkbox-group.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date-range-picker.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/index.css +1 -0
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/radio-group.css +1 -1
- package/dist/assets/selection-card-group.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chunks/checkbox-group.D56nUmre.js +176 -0
- package/dist/chunks/checkbox-group.D56nUmre.js.map +1 -0
- package/dist/chunks/{code-snippet.ByoBEM00.js → code-snippet.D1iNH2rn.js} +2 -2
- package/dist/chunks/{code-snippet.ByoBEM00.js.map → code-snippet.D1iNH2rn.js.map} +1 -1
- package/dist/chunks/{data-grid.CMIG82Xt.js → data-grid.D70AFJkA.js} +573 -568
- package/dist/chunks/data-grid.D70AFJkA.js.map +1 -0
- package/dist/chunks/{date-picker.CsGq3iSK.js → date-picker.De5ox4c1.js} +15 -15
- package/dist/chunks/{date-picker.CsGq3iSK.js.map → date-picker.De5ox4c1.js.map} +1 -1
- package/dist/chunks/date-range-picker.qXIfFq69.js +1100 -0
- package/dist/chunks/date-range-picker.qXIfFq69.js.map +1 -0
- package/dist/chunks/date-range-picker.types.Ckt7zxGy.js +5 -0
- package/dist/chunks/date-range-picker.types.Ckt7zxGy.js.map +1 -0
- package/dist/chunks/{dropdown-tag.B90dpg8J.js → dropdown-tag.D63up7xm.js} +2 -2
- package/dist/chunks/{dropdown-tag.B90dpg8J.js.map → dropdown-tag.D63up7xm.js.map} +1 -1
- package/dist/chunks/{dropdown.DYDHM__3.js → dropdown.cUORKsFC.js} +19 -19
- package/dist/chunks/{dropdown.DYDHM__3.js.map → dropdown.cUORKsFC.js.map} +1 -1
- package/dist/chunks/es6.MoTTyETW.js.map +1 -1
- package/dist/chunks/{filter-bar.CmF92iAr.js → filter-bar.CnKxMs_L.js} +84 -84
- package/dist/chunks/filter-bar.CnKxMs_L.js.map +1 -0
- package/dist/chunks/{header-with-views.xPfeOz0Y.js → header-with-views.C773fdiL.js} +2 -2
- package/dist/chunks/{header-with-views.xPfeOz0Y.js.map → header-with-views.C773fdiL.js.map} +1 -1
- package/dist/chunks/{input-field-password.BZBYVyAb.js → input-field-password.COET8hlJ.js} +3 -3
- package/dist/chunks/{input-field-password.BZBYVyAb.js.map → input-field-password.COET8hlJ.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.a8Mw5PAW.js → input-field-phone-number.rBDPxxxe.js} +3 -3
- package/dist/chunks/{input-field-phone-number.a8Mw5PAW.js.map → input-field-phone-number.rBDPxxxe.js.map} +1 -1
- package/dist/chunks/{input-field.CYGGIK48.js → input-field.GEIdI0nu.js} +2 -2
- package/dist/chunks/{input-field.CYGGIK48.js.map → input-field.GEIdI0nu.js.map} +1 -1
- package/dist/chunks/{pagination.CYdGcyMA.js → pagination.BZbMpRHw.js} +2 -2
- package/dist/chunks/{pagination.CYdGcyMA.js.map → pagination.BZbMpRHw.js.map} +1 -1
- package/dist/chunks/{radio-group.B_8R6vGx.js → radio-group.D3GbOHUx.js} +102 -101
- package/dist/chunks/radio-group.D3GbOHUx.js.map +1 -0
- package/dist/chunks/{search-bar.D3Ri_RUK.js → search-bar.eP4fk79T.js} +3 -3
- package/dist/chunks/{search-bar.D3Ri_RUK.js.map → search-bar.eP4fk79T.js.map} +1 -1
- package/dist/chunks/{secondary-nav.CAb20jWW.js → secondary-nav.CKA07_TU.js} +2 -2
- package/dist/chunks/{secondary-nav.CAb20jWW.js.map → secondary-nav.CKA07_TU.js.map} +1 -1
- package/dist/chunks/selection-card-group.B8Uoar3X.js +415 -0
- package/dist/chunks/{selection-card-group.F8alOPtl.js.map → selection-card-group.B8Uoar3X.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker.js +5 -4
- package/dist/date-range-picker.js.map +1 -1
- package/dist/dropdown.js +2 -2
- package/dist/filter-bar.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/index.js +381 -356
- 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/pagination.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/styles/bento-dark.css +5 -0
- package/dist/styles/bento-light.css +5 -0
- package/dist/styles/bento.css +5 -0
- package/dist/styles/legacy.css +5 -0
- package/dist/styles/styleguide.css +5 -0
- package/dist/web-types.json +1 -1
- package/package.json +6 -6
- package/dist/chunks/checkbox-group.COUx8Ne8.js +0 -192
- package/dist/chunks/checkbox-group.COUx8Ne8.js.map +0 -1
- package/dist/chunks/data-grid.CMIG82Xt.js.map +0 -1
- package/dist/chunks/date-range-picker.C19CWG27.js +0 -1149
- package/dist/chunks/date-range-picker.C19CWG27.js.map +0 -1
- package/dist/chunks/filter-bar.CmF92iAr.js.map +0 -1
- package/dist/chunks/radio-group.B_8R6vGx.js.map +0 -1
- package/dist/chunks/selection-card-group.F8alOPtl.js +0 -412
|
@@ -0,0 +1,1100 @@
|
|
|
1
|
+
import { reactive as Me, defineComponent as la, useSlots as Ia, ref as A, computed as b, onMounted as oa, createElementBlock as _e, openBlock as F, createElementVNode as ne, createCommentVNode as U, normalizeClass as we, renderSlot as Le, createBlock as J, unref as D, createVNode as X, withCtx as z, createTextVNode as ie, toRaw as Ce, toRef as je, watch as Fe, withDirectives as ha, withKeys as He, toDisplayString as Sa, createSlots as _a } from "vue";
|
|
2
|
+
import { g as wa } from "./index.E60QniEu.js";
|
|
3
|
+
import { B as Ma } from "./divider.DnKNNyWB.js";
|
|
4
|
+
import { h as Oa, B as Fa } from "./button-actions.BQ3AFQqt.js";
|
|
5
|
+
import { B as Ae, d as Qe } from "./typography.yBEME_Gu.js";
|
|
6
|
+
import { e as V, a as Ge, g as Ue } from "./differenceInMonths.C8FyCrav.js";
|
|
7
|
+
import { g as ge } from "./generate-uid.NJ8tVoha.js";
|
|
8
|
+
import { u as Ne } from "./index.pdBj0KQU.js";
|
|
9
|
+
import { e as N, g as ia, h as We, i as x, j as Ca, k as Ke, l as Aa, s as ze, m as Ua, n as Te, o as Je, b as K, u as Na, f as ve } from "./calendar.Tm7Cvpwu.js";
|
|
10
|
+
import { f as Xe, v as Ba, D as S } from "./date-format.B8RU7D42.js";
|
|
11
|
+
import { t as Z, c as xa, n as qa } from "./getTimezoneOffsetInMilliseconds.BW7U6PxE.js";
|
|
12
|
+
import { u as Pa } from "./use-form-layout-loading.D3lALhtC.js";
|
|
13
|
+
import { B as $a } from "./directive.Cbdox5VL.js";
|
|
14
|
+
import { u as Va } from "./form-field.BBqLu-vs.js";
|
|
15
|
+
import { D as Ya } from "./dropdown-default-textbox._KEBXjKT.js";
|
|
16
|
+
import { B as Ie } from "./input-field.GEIdI0nu.js";
|
|
17
|
+
import { B as La } from "./dropdown.cUORKsFC.js";
|
|
18
|
+
import { B as ja } from "./segmented-control.BCHGDSrf.js";
|
|
19
|
+
import { d as he } from "./debounce.DUTu11PS.js";
|
|
20
|
+
import { u as Ha } from "./use-has-slot.B7eQSabc.js";
|
|
21
|
+
import { c as Qa } from "./constructNow.CHWWeLPc.js";
|
|
22
|
+
import { _ as ua } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
23
|
+
import { F as Ga, E as Ze } from "./field-label.C97CrBI_.js";
|
|
24
|
+
import { B as Wa } from "./button-actions.types.BptAXjD8.js";
|
|
25
|
+
import "../assets/date-range-picker.css";
|
|
26
|
+
function ue(t) {
|
|
27
|
+
if (t == null)
|
|
28
|
+
return N(/* @__PURE__ */ new Date());
|
|
29
|
+
const [o, u, r] = t.split("-").map((e) => parseInt(e, 10));
|
|
30
|
+
return new Date(o, u - 1, r);
|
|
31
|
+
}
|
|
32
|
+
function da(t, o, u) {
|
|
33
|
+
return ia(t, o * 3, u);
|
|
34
|
+
}
|
|
35
|
+
function Ka(t, o, u) {
|
|
36
|
+
return da(t, -1, u);
|
|
37
|
+
}
|
|
38
|
+
const za = ({
|
|
39
|
+
firstDayOfWeek: t,
|
|
40
|
+
min: o,
|
|
41
|
+
max: u
|
|
42
|
+
}) => ({ getGranularCalendarLimits: (e) => {
|
|
43
|
+
if (!o && !u)
|
|
44
|
+
return { min: null, max: null };
|
|
45
|
+
let d = o ? N(o) : null, f = u ? V(u) : null;
|
|
46
|
+
if ((e == null ? void 0 : e.type) === "weekly") {
|
|
47
|
+
if (e.earliest)
|
|
48
|
+
d = N(e.earliest);
|
|
49
|
+
else if (d) {
|
|
50
|
+
const y = We(d, { weekStartsOn: t });
|
|
51
|
+
x(d, y) || (d = N(Ca(Ke(d, { weekStartsOn: t }), 1)));
|
|
52
|
+
}
|
|
53
|
+
if (e.latest)
|
|
54
|
+
f = V(e.latest);
|
|
55
|
+
else if (f) {
|
|
56
|
+
const y = Ke(f, { weekStartsOn: t });
|
|
57
|
+
x(f, y) || (f = V(Aa(We(f, { weekStartsOn: t }), 1)));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if ((e == null ? void 0 : e.type) === "monthly") {
|
|
61
|
+
if (e.earliest)
|
|
62
|
+
d = N(e.earliest);
|
|
63
|
+
else if (d) {
|
|
64
|
+
const y = ze(d);
|
|
65
|
+
x(d, y) || (d = ze(ia(d, 1)));
|
|
66
|
+
}
|
|
67
|
+
if (e.latest)
|
|
68
|
+
f = V(e.latest);
|
|
69
|
+
else if (f) {
|
|
70
|
+
const y = Ge(f);
|
|
71
|
+
x(f, y) || (f = Ge(Ua(f, 1)));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if ((e == null ? void 0 : e.type) === "quarterly") {
|
|
75
|
+
if (e.earliest)
|
|
76
|
+
d = Te(e.earliest);
|
|
77
|
+
else if (d) {
|
|
78
|
+
const y = Te(d);
|
|
79
|
+
x(d, y) || (d = Te(da(d, 1)));
|
|
80
|
+
}
|
|
81
|
+
if (e.latest)
|
|
82
|
+
f = V(e.latest);
|
|
83
|
+
else if (f) {
|
|
84
|
+
const y = Je(f);
|
|
85
|
+
x(f, y) || (f = Je(Ka(f)));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { min: d, max: f };
|
|
89
|
+
} }), Ja = () => {
|
|
90
|
+
const t = Me({
|
|
91
|
+
daily: null,
|
|
92
|
+
weekly: null,
|
|
93
|
+
monthly: null,
|
|
94
|
+
quarterly: null
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
savedRanges: t,
|
|
98
|
+
saveRange: (r, e) => {
|
|
99
|
+
t[r] = e;
|
|
100
|
+
},
|
|
101
|
+
resetSavedRanges: () => {
|
|
102
|
+
t.daily = null, t.weekly = null, t.monthly = null, t.quarterly = null;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
var T = /* @__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))(T || {});
|
|
107
|
+
const Xa = /[\d]/, Za = /^\d{2}$/, et = /^\d{2}:\d{2}$/, at = (t) => {
|
|
108
|
+
const { selectionStart: o } = t.target, u = ["Backspace", "Tab", "ArrowLeft", "ArrowRight"], r = Xa.test(t.key) || u.includes(t.key), e = [1, 2, 4, 5].includes(o) && t.key === ":";
|
|
109
|
+
!r && !e && t.preventDefault();
|
|
110
|
+
}, ea = (t) => {
|
|
111
|
+
if (!t)
|
|
112
|
+
return t;
|
|
113
|
+
let o = t;
|
|
114
|
+
if (o.length === 1 && parseInt(t, 10) > 2)
|
|
115
|
+
return `0${o}:`;
|
|
116
|
+
const [u, r] = o.slice(-2);
|
|
117
|
+
return [2, 5].includes(o.length) && r === ":" && (o = `${o.slice(0, o.length - 2)}0${u}`), (Za.test(o) || et.test(o)) && (o += ":"), o;
|
|
118
|
+
};
|
|
119
|
+
function tt(t, o, u) {
|
|
120
|
+
const r = Z(t, u == null ? void 0 : u.in);
|
|
121
|
+
return r.setHours(o), r;
|
|
122
|
+
}
|
|
123
|
+
function nt(t, o, u) {
|
|
124
|
+
const r = Z(t, u == null ? void 0 : u.in);
|
|
125
|
+
return r.setMinutes(o), r;
|
|
126
|
+
}
|
|
127
|
+
function rt(t, o, u) {
|
|
128
|
+
const r = Z(t, u == null ? void 0 : u.in);
|
|
129
|
+
return r.setSeconds(o), r;
|
|
130
|
+
}
|
|
131
|
+
function aa(t, o) {
|
|
132
|
+
const u = Z(t, o == null ? void 0 : o.in);
|
|
133
|
+
return u.setMilliseconds(0), u;
|
|
134
|
+
}
|
|
135
|
+
function ta(t, o) {
|
|
136
|
+
return +aa(t) == +aa(o);
|
|
137
|
+
}
|
|
138
|
+
function Se(t, o) {
|
|
139
|
+
return +Z(t) == +Z(o);
|
|
140
|
+
}
|
|
141
|
+
function st(t, o) {
|
|
142
|
+
return x(
|
|
143
|
+
xa(t, t),
|
|
144
|
+
Qa(t)
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
function na(t, o, u) {
|
|
148
|
+
const r = Z(t, u == null ? void 0 : u.in);
|
|
149
|
+
return r.setMilliseconds(o), r;
|
|
150
|
+
}
|
|
151
|
+
const ca = {
|
|
152
|
+
"en-US": {
|
|
153
|
+
customRange: "Custom range",
|
|
154
|
+
daily: "Daily",
|
|
155
|
+
dateFrom: "Date from",
|
|
156
|
+
dateTo: "Date to",
|
|
157
|
+
lastMonth: "Last month",
|
|
158
|
+
lastSevenDays: "Last 7 days",
|
|
159
|
+
lastThreeMonths: "Last three months",
|
|
160
|
+
monthly: "Monthly",
|
|
161
|
+
quarterly: "Quarterly",
|
|
162
|
+
timeFrom: "Time from",
|
|
163
|
+
timeTo: "Time to",
|
|
164
|
+
weekly: "Weekly"
|
|
165
|
+
},
|
|
166
|
+
"ja-JP": {
|
|
167
|
+
customRange: "カスタム範囲を選択",
|
|
168
|
+
daily: "毎日",
|
|
169
|
+
lastMonth: "先月",
|
|
170
|
+
lastSevenDays: "過去7日間",
|
|
171
|
+
monthly: "毎月",
|
|
172
|
+
weekly: "毎週"
|
|
173
|
+
},
|
|
174
|
+
"pt-BR": {
|
|
175
|
+
customRange: "Selecione um intervalo personalizado",
|
|
176
|
+
daily: "Diário",
|
|
177
|
+
lastMonth: "Último mês",
|
|
178
|
+
lastSevenDays: "Últimos 7 dias",
|
|
179
|
+
monthly: "Mensal",
|
|
180
|
+
weekly: "Semanal"
|
|
181
|
+
}
|
|
182
|
+
}, lt = { class: "b-date-range-picker-calendar" }, ot = { class: "b-date-range-picker-calendar__form" }, it = { key: 0 }, ut = {
|
|
183
|
+
key: 0,
|
|
184
|
+
class: "b-date-range-picker-calendar__calendars-container",
|
|
185
|
+
"data-testid": "date-range-picker-calendar-calendar-container"
|
|
186
|
+
}, dt = {
|
|
187
|
+
name: "date-range-picker-calendar",
|
|
188
|
+
i18n: { messages: ca }
|
|
189
|
+
}, ct = /* @__PURE__ */ la({
|
|
190
|
+
...dt,
|
|
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: K.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: K.props.isDateDisabled,
|
|
219
|
+
/**
|
|
220
|
+
* Set a maximum number of dates to be selectable by the range.
|
|
221
|
+
*/
|
|
222
|
+
maxRange: K.props.maxRange,
|
|
223
|
+
/**
|
|
224
|
+
* Sets a minimum limit for selectable dates - dates before `min` will not be selectable
|
|
225
|
+
*/
|
|
226
|
+
min: K.props.min,
|
|
227
|
+
/**
|
|
228
|
+
* Sets a maximum limit for selectable dates - dates after `max` will not be selectable
|
|
229
|
+
*/
|
|
230
|
+
max: K.props.max,
|
|
231
|
+
/**
|
|
232
|
+
* Number of months rendered on pane
|
|
233
|
+
*/
|
|
234
|
+
numberOfMonths: {
|
|
235
|
+
type: K.props.numberOfMonths.type,
|
|
236
|
+
default: K.props.numberOfMonths.default,
|
|
237
|
+
validator: (t) => t >= 0
|
|
238
|
+
},
|
|
239
|
+
/**
|
|
240
|
+
* Displays the end date's month when the calendar is opened. Defaults to false i.e. the start date's month is displayed.
|
|
241
|
+
*/
|
|
242
|
+
showEndDateOnOpen: { type: Boolean, default: !1 },
|
|
243
|
+
/**
|
|
244
|
+
* Enables the custom range selector.
|
|
245
|
+
* If provided, must be an array that sets the custom range dropdown items. Items are of the structure:
|
|
246
|
+
* `label` - label of custom range item.
|
|
247
|
+
* `value` - a unique key of the custom range item.
|
|
248
|
+
* `data` - an object `{ startDate: Date; endDate: Date }` to set the date picker range to upon selecting.
|
|
249
|
+
*/
|
|
250
|
+
quickSelectRanges: {
|
|
251
|
+
type: Array,
|
|
252
|
+
default: void 0
|
|
253
|
+
},
|
|
254
|
+
/**
|
|
255
|
+
* Selected date
|
|
256
|
+
*/
|
|
257
|
+
value: { type: Object, default: void 0 },
|
|
258
|
+
/**
|
|
259
|
+
* The type of calendar to display. Defaults to showing days.
|
|
260
|
+
*/
|
|
261
|
+
variant: K.props.variant
|
|
262
|
+
},
|
|
263
|
+
emits: [
|
|
264
|
+
T.CUSTOM_RANGE,
|
|
265
|
+
T.INPUT,
|
|
266
|
+
T.ERROR,
|
|
267
|
+
T.FORM_DATE,
|
|
268
|
+
T.START_DATE_SELECTED
|
|
269
|
+
],
|
|
270
|
+
setup(t, { emit: o }) {
|
|
271
|
+
var Pe, $e, Ve, Ye;
|
|
272
|
+
const r = "customRange", e = t, d = o, f = Ia(), y = Ha(f), { locale: ee, t: C } = Ne({ messages: ca }), _ = Ue(), B = A({}), pe = b(() => e.variant === "month" ? "monthly" : "daily"), ye = b(() => e.numberOfMonths === 0), s = Me({
|
|
273
|
+
startDate: (Pe = e.value) == null ? void 0 : Pe.startDate,
|
|
274
|
+
endDate: ($e = e.value) == null ? void 0 : $e.endDate,
|
|
275
|
+
range: (Ve = e.value) == null ? void 0 : Ve.range,
|
|
276
|
+
...e.granularities ? {
|
|
277
|
+
granularity: ((Ye = e.value) == null ? void 0 : Ye.granularity) || pe.value
|
|
278
|
+
} : {}
|
|
279
|
+
});
|
|
280
|
+
function E(a) {
|
|
281
|
+
return a ? new Date(
|
|
282
|
+
a.getUTCFullYear(),
|
|
283
|
+
a.getUTCMonth(),
|
|
284
|
+
a.getUTCDate(),
|
|
285
|
+
a.getUTCHours(),
|
|
286
|
+
a.getUTCMinutes(),
|
|
287
|
+
a.getUTCSeconds()
|
|
288
|
+
) : null;
|
|
289
|
+
}
|
|
290
|
+
const g = b(() => {
|
|
291
|
+
var a, n;
|
|
292
|
+
return (
|
|
293
|
+
// eslint-disable-next-line consistent-return
|
|
294
|
+
((n = (a = e == null ? void 0 : e.quickSelectRanges) == null ? void 0 : a.find(({ value: m, data: c }) => {
|
|
295
|
+
var I;
|
|
296
|
+
if (!c.endDate) {
|
|
297
|
+
if (c.isRelativeToNow) {
|
|
298
|
+
const O = (I = B.value) == null ? void 0 : I[m];
|
|
299
|
+
return O ? Se(
|
|
300
|
+
E(O.startDate),
|
|
301
|
+
E(s.startDate)
|
|
302
|
+
) && Se(
|
|
303
|
+
E(O.endDate),
|
|
304
|
+
E(s.endDate)
|
|
305
|
+
) : (
|
|
306
|
+
// If not stored calculated dates, fall back to comparing the quick select item's value
|
|
307
|
+
// with the internal range's stored range identifier.
|
|
308
|
+
m === s.range
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
return Se(E(c.startDate), E(s.startDate)) && Se(
|
|
312
|
+
E(s.endDate),
|
|
313
|
+
E(V(s.endDate))
|
|
314
|
+
) && st(E(s.endDate)) && (e.granularities ? c.granularity === s.granularity : !0);
|
|
315
|
+
}
|
|
316
|
+
if (e.allowTimeInput)
|
|
317
|
+
return ta(E(c.startDate), E(s.startDate)) && ta(E(c.endDate), E(s.endDate)) && (e.granularities ? c.granularity === s.granularity : !0);
|
|
318
|
+
if (c.endDate)
|
|
319
|
+
return x(c.startDate, s.startDate) && x(c.endDate, s.endDate) && (e.granularities ? c.granularity === s.granularity : !0);
|
|
320
|
+
})) == null ? void 0 : n.value) ?? r
|
|
321
|
+
);
|
|
322
|
+
}), Y = b(() => ({
|
|
323
|
+
"b-date-range-picker-calendar__form-input-wrapper": e.allowTimeInput
|
|
324
|
+
})), R = b(() => [
|
|
325
|
+
{ label: C("customRange"), value: r },
|
|
326
|
+
...e.quickSelectRanges ? e.quickSelectRanges : []
|
|
327
|
+
]), q = b(
|
|
328
|
+
() => {
|
|
329
|
+
var a;
|
|
330
|
+
return ((a = e.granularities) == null ? void 0 : a.find(({ type: n }) => n === s.granularity)) || null;
|
|
331
|
+
}
|
|
332
|
+
), L = b(
|
|
333
|
+
() => {
|
|
334
|
+
var a;
|
|
335
|
+
return ((a = e.granularities) == null ? void 0 : a.map(({ type: n, disabled: m }) => ({
|
|
336
|
+
label: C(n),
|
|
337
|
+
value: n,
|
|
338
|
+
disabled: m
|
|
339
|
+
}))) ?? [];
|
|
340
|
+
}
|
|
341
|
+
), { getGranularCalendarLimits: de } = za(e), v = b(
|
|
342
|
+
() => e.granularities ? de(q.value) : { min: e.min ? N(e.min) : null, max: e.max ? V(e.max) : null }
|
|
343
|
+
), {
|
|
344
|
+
adjustDateForQuarterly: ce,
|
|
345
|
+
adjustDateForMonthly: me,
|
|
346
|
+
adjustDateForWeekly: De,
|
|
347
|
+
adjustStartDateInputForWeekly: re,
|
|
348
|
+
adjustEndDateInputForWeekly: k,
|
|
349
|
+
adjustStartDateInputForMonthly: P,
|
|
350
|
+
adjustEndDateInputForMonthly: M,
|
|
351
|
+
adjustStartDateInputForQuarterly: j,
|
|
352
|
+
adjustEndDateInputForQuarterly: fe
|
|
353
|
+
} = Na(e.firstDayOfWeek), { savedRanges: H, saveRange: ae, resetSavedRanges: se } = Ja(), w = (a) => {
|
|
354
|
+
var n;
|
|
355
|
+
return a ? ve(a, S.NUMERIC_DATE_YEAR_FIRST, {
|
|
356
|
+
locale: _[(n = ee.value) == null ? void 0 : n.substring(0, 2)] || _.enUS
|
|
357
|
+
}) : "";
|
|
358
|
+
}, te = (a) => {
|
|
359
|
+
var n;
|
|
360
|
+
return a ? ve(a, S.HOUR_MINUTE_SECONDS, {
|
|
361
|
+
locale: _[(n = ee.value) == null ? void 0 : n.substring(0, 2)] || _.enUS
|
|
362
|
+
}) : "";
|
|
363
|
+
}, le = A(!1), oe = A(!1), Q = A(!1), G = A(!1), i = Me({
|
|
364
|
+
startDate: e.dateFormData.startDate,
|
|
365
|
+
endDate: e.dateFormData.endDate,
|
|
366
|
+
startTime: e.dateFormData.startTime,
|
|
367
|
+
endTime: e.dateFormData.endTime
|
|
368
|
+
}), be = (a, n) => {
|
|
369
|
+
let m = new Date(a);
|
|
370
|
+
const [c, I, O] = n.split(":");
|
|
371
|
+
return m = tt(m, parseInt(c, 10)), m = nt(m, parseInt(I, 10)), m = rt(m, parseInt(O, 10)), m;
|
|
372
|
+
}, Re = (a) => /^(?:[01]\d|2[01234]):(?:[012345]\d):(?:[012345]\d)$/.test(a), l = (a, n) => {
|
|
373
|
+
const m = () => {
|
|
374
|
+
if (n && h(n)) {
|
|
375
|
+
const c = be(new Date(n), a);
|
|
376
|
+
if (e.min && c < na(e.min, 0) || e.max && c > na(e.max, 0))
|
|
377
|
+
return !1;
|
|
378
|
+
}
|
|
379
|
+
return !0;
|
|
380
|
+
};
|
|
381
|
+
return Re(a) && m();
|
|
382
|
+
}, p = (a, n) => !n || !Re(n) || e.variant === "month" ? a : be(new Date(a), n), $ = (a) => {
|
|
383
|
+
i.startTime = te(
|
|
384
|
+
e.min && e.allowTimeInput && x(e.min, a.startDate) ? e.min : N(a.startDate)
|
|
385
|
+
), i.endTime = te(
|
|
386
|
+
e.max && e.allowTimeInput && x(e.max, a.endDate) ? e.max : V(a.endDate)
|
|
387
|
+
), s.startDate = p(a.startDate, i.startTime), s.endDate = p(a.endDate, i.endTime), s.range = null, e.granularities && se(), d(T.INPUT, {
|
|
388
|
+
...s,
|
|
389
|
+
range: g.value
|
|
390
|
+
});
|
|
391
|
+
}, h = (a) => {
|
|
392
|
+
const n = (c) => e.min && N(c) < N(e.min) || e.max && N(c) > N(e.max) ? !1 : e.isDateDisabled ? !e.isDateDisabled(N(c)) : !0;
|
|
393
|
+
return /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(a) && n(new Date(a));
|
|
394
|
+
};
|
|
395
|
+
oa(() => {
|
|
396
|
+
le.value = !!(e.dateFormData.startDate && !h(e.dateFormData.startDate)), e.allowTimeInput ? Q.value = !!(e.dateFormData.startTime && !l(e.dateFormData.startTime, e.dateFormData.startDate)) : Q.value = !1, oe.value = !!(e.dateFormData.endDate && !h(e.dateFormData.endDate)), e.allowTimeInput ? G.value = !!(e.dateFormData.endTime && !l(e.dateFormData.endTime, e.dateFormData.endDate)) : G.value = !1;
|
|
397
|
+
});
|
|
398
|
+
const W = (a) => {
|
|
399
|
+
var n;
|
|
400
|
+
i.startDate = w(a), i.startTime ? Q.value && (i.startTime = (n = e.dateFormData) == null ? void 0 : n.startTime) : i.startTime = te(a), le.value = !1, Q.value = !1, d(T.START_DATE_SELECTED, a);
|
|
401
|
+
}, ke = (a) => {
|
|
402
|
+
var n;
|
|
403
|
+
i.endDate = w(a), i.endTime ? G.value && (i.endTime = (n = e.dateFormData) == null ? void 0 : n.endTime) : i.endTime = te(V(a)), oe.value = !1, G.value = !1;
|
|
404
|
+
}, Oe = (a) => {
|
|
405
|
+
const n = e.value[a];
|
|
406
|
+
if (n)
|
|
407
|
+
return n;
|
|
408
|
+
if (e.dateFormData[a] && h(e.dateFormData[a]))
|
|
409
|
+
return new Date(e.dateFormData[a]);
|
|
410
|
+
}, ma = he((a) => {
|
|
411
|
+
var n;
|
|
412
|
+
if (h(a)) {
|
|
413
|
+
let m = a;
|
|
414
|
+
switch (le.value = !1, (n = q.value) == null ? void 0 : n.type) {
|
|
415
|
+
case "weekly":
|
|
416
|
+
m = re(
|
|
417
|
+
a,
|
|
418
|
+
w,
|
|
419
|
+
v.value.min,
|
|
420
|
+
v.value.max
|
|
421
|
+
), i.startDate = m;
|
|
422
|
+
break;
|
|
423
|
+
case "monthly":
|
|
424
|
+
m = P(
|
|
425
|
+
a,
|
|
426
|
+
w,
|
|
427
|
+
v.value.min,
|
|
428
|
+
v.value.max
|
|
429
|
+
), i.startDate = m;
|
|
430
|
+
break;
|
|
431
|
+
case "quarterly":
|
|
432
|
+
m = j(
|
|
433
|
+
a,
|
|
434
|
+
w,
|
|
435
|
+
v.value.min,
|
|
436
|
+
v.value.max
|
|
437
|
+
), i.startDate = m;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
const c = ue(m);
|
|
441
|
+
s.startDate = p(c, i.startTime), s.endDate = p(
|
|
442
|
+
ue(i.endDate),
|
|
443
|
+
i.endTime
|
|
444
|
+
), h(i.endDate) && (s.endDate = p(
|
|
445
|
+
ue(i.endDate),
|
|
446
|
+
i.endTime
|
|
447
|
+
));
|
|
448
|
+
const I = Oe("endDate");
|
|
449
|
+
s.range = null, d(T.FORM_DATE, {
|
|
450
|
+
startDate: c,
|
|
451
|
+
endDate: I
|
|
452
|
+
}), d(T.INPUT, {
|
|
453
|
+
...s,
|
|
454
|
+
range: g.value
|
|
455
|
+
});
|
|
456
|
+
} else
|
|
457
|
+
le.value = !0, d(T.ERROR, { ...i });
|
|
458
|
+
}, 300), Da = (a) => {
|
|
459
|
+
i.startDate = Xe(a), ma(i.startDate);
|
|
460
|
+
}, fa = he((a) => {
|
|
461
|
+
var n;
|
|
462
|
+
if (h(a)) {
|
|
463
|
+
let m = a;
|
|
464
|
+
switch (oe.value = !1, (n = q.value) == null ? void 0 : n.type) {
|
|
465
|
+
case "weekly":
|
|
466
|
+
m = k(
|
|
467
|
+
a,
|
|
468
|
+
w,
|
|
469
|
+
v.value.min,
|
|
470
|
+
v.value.max
|
|
471
|
+
), i.endDate = m;
|
|
472
|
+
break;
|
|
473
|
+
case "monthly":
|
|
474
|
+
m = M(
|
|
475
|
+
a,
|
|
476
|
+
w,
|
|
477
|
+
v.value.min,
|
|
478
|
+
v.value.max
|
|
479
|
+
), i.endDate = m;
|
|
480
|
+
break;
|
|
481
|
+
case "quarterly":
|
|
482
|
+
m = fe(
|
|
483
|
+
a,
|
|
484
|
+
w,
|
|
485
|
+
v.value.min,
|
|
486
|
+
v.value.max
|
|
487
|
+
), i.endDate = m;
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
const c = ue(m);
|
|
491
|
+
s.endDate = p(c, i.endTime), h(i.startDate) && (s.startDate = p(
|
|
492
|
+
ue(i.startDate),
|
|
493
|
+
i.startTime
|
|
494
|
+
));
|
|
495
|
+
const I = Oe("startDate");
|
|
496
|
+
s.range = null, d(T.FORM_DATE, {
|
|
497
|
+
startDate: I,
|
|
498
|
+
endDate: c
|
|
499
|
+
}), d(T.INPUT, {
|
|
500
|
+
...s,
|
|
501
|
+
range: g.value
|
|
502
|
+
});
|
|
503
|
+
} else
|
|
504
|
+
oe.value = !0, d(T.ERROR, { ...i });
|
|
505
|
+
}, 300), va = (a) => {
|
|
506
|
+
i.endDate = Xe(a), fa(i.endDate);
|
|
507
|
+
}, xe = (a) => {
|
|
508
|
+
Ba(a);
|
|
509
|
+
}, pa = he((a) => {
|
|
510
|
+
if (l(a, e.dateFormData.startDate)) {
|
|
511
|
+
Q.value = !1, s.startDate = p(s.startDate, a);
|
|
512
|
+
const n = Oe("endDate");
|
|
513
|
+
d(T.FORM_DATE, {
|
|
514
|
+
startDate: s.startDate,
|
|
515
|
+
endDate: n,
|
|
516
|
+
startTime: a,
|
|
517
|
+
endTime: i.endTime ?? e.dateFormData.endTime
|
|
518
|
+
}), d(T.INPUT, {
|
|
519
|
+
...s,
|
|
520
|
+
range: g.value
|
|
521
|
+
});
|
|
522
|
+
} else
|
|
523
|
+
Q.value = !0, d(T.ERROR, { ...i });
|
|
524
|
+
}), ya = he((a) => {
|
|
525
|
+
l(a, e.dateFormData.endDate) ? (G.value = !1, s.endDate = p(s.endDate, a), d(T.FORM_DATE, {
|
|
526
|
+
startDate: s.startDate,
|
|
527
|
+
endDate: s.endDate,
|
|
528
|
+
startTime: i.startTime ?? e.dateFormData.startTime,
|
|
529
|
+
endTime: a
|
|
530
|
+
}), d(T.INPUT, {
|
|
531
|
+
...s,
|
|
532
|
+
range: g.value
|
|
533
|
+
})) : (G.value = !0, d(T.ERROR, { ...i }));
|
|
534
|
+
}), ga = (a) => {
|
|
535
|
+
i.startTime = ea(a), pa(i.startTime);
|
|
536
|
+
}, Ta = (a) => {
|
|
537
|
+
i.endTime = ea(a), ya(i.endTime);
|
|
538
|
+
}, qe = (a) => {
|
|
539
|
+
at(a);
|
|
540
|
+
}, Ee = (a, n, m, c) => {
|
|
541
|
+
s.startDate = a, s.endDate = n, m && (s.granularity = m), c && (s.range = c);
|
|
542
|
+
}, ba = (a) => {
|
|
543
|
+
var m;
|
|
544
|
+
const n = (m = e.quickSelectRanges) == null ? void 0 : m.find(({ value: c }) => c === a);
|
|
545
|
+
if (n) {
|
|
546
|
+
se();
|
|
547
|
+
const c = n.data, I = c.endDate || (c.isRelativeToNow ? new Date(Date.now()) : V(new Date(Date.now()))), O = c.isRelativeToNow && c.timeDifference ? new Date(I.getTime() - c.timeDifference) : c.startDate;
|
|
548
|
+
i.endDate = w(I), i.startDate = w(O), Ee(O, I, null, a), e.granularities && (s.granularity = c.granularity || pe.value), i.startTime = te(O), i.endTime = te(I), s.startDate = O, s.endDate = I, c.isRelativeToNow && (B.value = {
|
|
549
|
+
...B.value,
|
|
550
|
+
[a]: {
|
|
551
|
+
startDate: O,
|
|
552
|
+
endDate: I
|
|
553
|
+
}
|
|
554
|
+
}), d(T.CUSTOM_RANGE, {
|
|
555
|
+
...n.data,
|
|
556
|
+
startDate: O,
|
|
557
|
+
endDate: I,
|
|
558
|
+
range: n.value
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}, Ra = {
|
|
562
|
+
weekly: De,
|
|
563
|
+
monthly: me,
|
|
564
|
+
quarterly: ce
|
|
565
|
+
}, ka = (a) => {
|
|
566
|
+
const n = s.granularity;
|
|
567
|
+
if (s.granularity = a, n && ae(n, structuredClone(Ce(s))), s.startDate && s.endDate) {
|
|
568
|
+
switch (a) {
|
|
569
|
+
case "quarterly":
|
|
570
|
+
case "monthly":
|
|
571
|
+
case "weekly": {
|
|
572
|
+
if (H[a]) {
|
|
573
|
+
Ee(H[a].startDate, H[a].endDate, a);
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
const { startDate: m, endDate: c } = Ra[a](
|
|
577
|
+
s.startDate,
|
|
578
|
+
s.endDate,
|
|
579
|
+
v.value.min,
|
|
580
|
+
v.value.max
|
|
581
|
+
);
|
|
582
|
+
Ee(m, c, a);
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
case "daily":
|
|
586
|
+
H.daily && Ee(H.daily.startDate, H.daily.endDate, a);
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
589
|
+
i.startDate = w(s.startDate), i.endDate = w(s.endDate), d(T.INPUT, {
|
|
590
|
+
...s,
|
|
591
|
+
range: g.value
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
}, Ea = b(() => ({
|
|
595
|
+
"b-date-range-picker-calendar__form-container--no-calendars": ye.value
|
|
596
|
+
}));
|
|
597
|
+
return (a, n) => (F(), _e("div", lt, [
|
|
598
|
+
ne("div", {
|
|
599
|
+
class: we(["b-date-range-picker-calendar__form-container", Ea.value]),
|
|
600
|
+
"data-testid": "date-range-picker-calendar-form-container"
|
|
601
|
+
}, [
|
|
602
|
+
ne("div", ot, [
|
|
603
|
+
D(y)("title") ? Le(a.$slots, "title", { key: 0 }, void 0, !0) : U("", !0),
|
|
604
|
+
t.quickSelectRanges ? (F(), J(La, {
|
|
605
|
+
key: 1,
|
|
606
|
+
"aria-label": D(C)("customRange"),
|
|
607
|
+
items: R.value,
|
|
608
|
+
"model-value": g.value,
|
|
609
|
+
"onUpdate:modelValue": ba
|
|
610
|
+
}, null, 8, ["aria-label", "items", "model-value"])) : U("", !0),
|
|
611
|
+
t.granularities ? (F(), J(D(ja), {
|
|
612
|
+
key: 2,
|
|
613
|
+
items: L.value,
|
|
614
|
+
"model-value": s.granularity,
|
|
615
|
+
"full-width": "",
|
|
616
|
+
"onUpdate:modelValue": ka
|
|
617
|
+
}, null, 8, ["items", "model-value"])) : U("", !0),
|
|
618
|
+
ne("div", null, [
|
|
619
|
+
X(D(Ae), {
|
|
620
|
+
stronger: "",
|
|
621
|
+
el: "span",
|
|
622
|
+
class: "b-date-range-picker-calendar__label"
|
|
623
|
+
}, {
|
|
624
|
+
default: z(() => n[0] || (n[0] = [
|
|
625
|
+
ie(" From ")
|
|
626
|
+
])),
|
|
627
|
+
_: 1
|
|
628
|
+
}),
|
|
629
|
+
ne("div", {
|
|
630
|
+
class: we(Y.value)
|
|
631
|
+
}, [
|
|
632
|
+
X(D(Ie), {
|
|
633
|
+
"aria-label": D(C)("dateFrom"),
|
|
634
|
+
value: i.startDate,
|
|
635
|
+
error: le.value,
|
|
636
|
+
class: "b-date-range-picker-calendar__form-input",
|
|
637
|
+
onInput: Da,
|
|
638
|
+
onKeydown: xe
|
|
639
|
+
}, {
|
|
640
|
+
description: z(() => n[1] || (n[1] = [
|
|
641
|
+
ie("YYYY-MM-DD")
|
|
642
|
+
])),
|
|
643
|
+
_: 1
|
|
644
|
+
}, 8, ["aria-label", "value", "error"]),
|
|
645
|
+
t.allowTimeInput ? (F(), J(D(Ie), {
|
|
646
|
+
key: 0,
|
|
647
|
+
"aria-label": D(C)("timeFrom"),
|
|
648
|
+
value: i.startTime,
|
|
649
|
+
error: Q.value,
|
|
650
|
+
class: "b-date-range-picker-calendar__form-input",
|
|
651
|
+
onInput: ga,
|
|
652
|
+
onKeydown: qe
|
|
653
|
+
}, {
|
|
654
|
+
description: z(() => n[2] || (n[2] = [
|
|
655
|
+
ie("HH:MM:SS")
|
|
656
|
+
])),
|
|
657
|
+
_: 1
|
|
658
|
+
}, 8, ["aria-label", "value", "error"])) : U("", !0)
|
|
659
|
+
], 2)
|
|
660
|
+
]),
|
|
661
|
+
ne("div", null, [
|
|
662
|
+
X(D(Ae), {
|
|
663
|
+
stronger: "",
|
|
664
|
+
el: "span",
|
|
665
|
+
class: "b-date-range-picker-calendar__label"
|
|
666
|
+
}, {
|
|
667
|
+
default: z(() => n[3] || (n[3] = [
|
|
668
|
+
ie(" To ")
|
|
669
|
+
])),
|
|
670
|
+
_: 1
|
|
671
|
+
}),
|
|
672
|
+
ne("div", {
|
|
673
|
+
class: we(Y.value)
|
|
674
|
+
}, [
|
|
675
|
+
X(D(Ie), {
|
|
676
|
+
class: "b-date-range-picker-calendar__form-input",
|
|
677
|
+
"aria-label": D(C)("dateTo"),
|
|
678
|
+
value: i.endDate,
|
|
679
|
+
error: oe.value,
|
|
680
|
+
onInput: va,
|
|
681
|
+
onKeydown: xe
|
|
682
|
+
}, {
|
|
683
|
+
description: z(() => n[4] || (n[4] = [
|
|
684
|
+
ie("YYYY-MM-DD")
|
|
685
|
+
])),
|
|
686
|
+
_: 1
|
|
687
|
+
}, 8, ["aria-label", "value", "error"]),
|
|
688
|
+
t.allowTimeInput ? (F(), J(D(Ie), {
|
|
689
|
+
key: 0,
|
|
690
|
+
"aria-label": D(C)("timeTo"),
|
|
691
|
+
value: i.endTime,
|
|
692
|
+
error: G.value,
|
|
693
|
+
class: "b-date-range-picker-calendar__form-input",
|
|
694
|
+
onInput: Ta,
|
|
695
|
+
onKeydown: qe
|
|
696
|
+
}, {
|
|
697
|
+
description: z(() => n[5] || (n[5] = [
|
|
698
|
+
ie("HH:MM:SS")
|
|
699
|
+
])),
|
|
700
|
+
_: 1
|
|
701
|
+
}, 8, ["aria-label", "value", "error"])) : U("", !0)
|
|
702
|
+
], 2)
|
|
703
|
+
])
|
|
704
|
+
]),
|
|
705
|
+
D(y)("actions") ? (F(), _e("div", it, [
|
|
706
|
+
Le(a.$slots, "actions", {}, void 0, !0)
|
|
707
|
+
])) : U("", !0)
|
|
708
|
+
], 2),
|
|
709
|
+
ye.value ? U("", !0) : (F(), _e("div", ut, [
|
|
710
|
+
X(D(K), {
|
|
711
|
+
value: s,
|
|
712
|
+
"first-day-of-week": t.firstDayOfWeek,
|
|
713
|
+
"is-date-disabled": t.isDateDisabled,
|
|
714
|
+
"max-range": t.maxRange,
|
|
715
|
+
min: v.value.min,
|
|
716
|
+
max: v.value.max,
|
|
717
|
+
"number-of-months": t.numberOfMonths,
|
|
718
|
+
"show-end-date-on-open": t.showEndDateOnOpen,
|
|
719
|
+
granularity: q.value,
|
|
720
|
+
variant: t.variant,
|
|
721
|
+
"is-range": "",
|
|
722
|
+
onInput: $,
|
|
723
|
+
onStartDateSelected: W,
|
|
724
|
+
onEndDateSelected: ke
|
|
725
|
+
}, null, 8, ["value", "first-day-of-week", "is-date-disabled", "max-range", "min", "max", "number-of-months", "show-end-date-on-open", "granularity", "variant"])
|
|
726
|
+
]))
|
|
727
|
+
]));
|
|
728
|
+
}
|
|
729
|
+
}), mt = /* @__PURE__ */ ua(ct, [["__scopeId", "data-v-0ee847ca"]]);
|
|
730
|
+
function ra(t, o) {
|
|
731
|
+
const u = Z(t, o == null ? void 0 : o.in);
|
|
732
|
+
return Math.trunc(u.getMonth() / 3) + 1;
|
|
733
|
+
}
|
|
734
|
+
function sa(t, o) {
|
|
735
|
+
return Z(t, o == null ? void 0 : o.in).getFullYear();
|
|
736
|
+
}
|
|
737
|
+
function Dt(t, o, u) {
|
|
738
|
+
const [r, e] = qa(
|
|
739
|
+
u == null ? void 0 : u.in,
|
|
740
|
+
t,
|
|
741
|
+
o
|
|
742
|
+
);
|
|
743
|
+
return +Te(r) == +Te(e);
|
|
744
|
+
}
|
|
745
|
+
const Be = {
|
|
746
|
+
"en-US": {
|
|
747
|
+
apply: "Apply",
|
|
748
|
+
cancel: "Cancel",
|
|
749
|
+
dateRangePicker: "Date range picker {name}",
|
|
750
|
+
provideDateInAFormat: "Provide date in a YYYY-MM-DD format",
|
|
751
|
+
quarter: "Q{quarter} {year}",
|
|
752
|
+
selectDate: "Select a date",
|
|
753
|
+
selectDateRange: "Select a date range",
|
|
754
|
+
selectedDateIsNotAvailable: "Selected date is not available"
|
|
755
|
+
},
|
|
756
|
+
"ja-JP": {
|
|
757
|
+
apply: "適用",
|
|
758
|
+
cancel: "キャンセル",
|
|
759
|
+
selectDate: "日付を選択"
|
|
760
|
+
},
|
|
761
|
+
"pt-BR": {
|
|
762
|
+
apply: "Aplicar",
|
|
763
|
+
cancel: "Cancelar",
|
|
764
|
+
selectDate: "Selecione uma data"
|
|
765
|
+
}
|
|
766
|
+
}, ft = ({
|
|
767
|
+
datePickerValue: t,
|
|
768
|
+
isDateIncorrect: o,
|
|
769
|
+
quickSelectRanges: u,
|
|
770
|
+
isMonthVariant: r,
|
|
771
|
+
withTimeInput: e,
|
|
772
|
+
placeholder: d
|
|
773
|
+
}) => {
|
|
774
|
+
var s, E, g, Y;
|
|
775
|
+
const { locale: f, t: y } = Ne({ messages: Be }), ee = Ue(), C = (R) => !!R && !isNaN(R.getTime()), _ = (R, q) => {
|
|
776
|
+
var L;
|
|
777
|
+
return C(R) ? ve(R, q, {
|
|
778
|
+
locale: ee[(L = f.value) == null ? void 0 : L.substring(0, 2)] || ee.enUS
|
|
779
|
+
}) : void 0;
|
|
780
|
+
}, B = Me({
|
|
781
|
+
startDate: _((s = t.value) == null ? void 0 : s.startDate, S.NUMERIC_DATE_YEAR_FIRST),
|
|
782
|
+
endDate: _((E = t.value) == null ? void 0 : E.endDate, S.NUMERIC_DATE_YEAR_FIRST),
|
|
783
|
+
startTime: _((g = t.value) == null ? void 0 : g.startDate, S.HOUR_MINUTE_SECONDS),
|
|
784
|
+
endTime: _((Y = t.value) == null ? void 0 : Y.endDate, S.HOUR_MINUTE_SECONDS)
|
|
785
|
+
});
|
|
786
|
+
return {
|
|
787
|
+
// Values
|
|
788
|
+
dateDisplayValue: b(() => {
|
|
789
|
+
var k;
|
|
790
|
+
if (o.value)
|
|
791
|
+
return `${B.startDate || ""} - ${B.endDate || ""}`;
|
|
792
|
+
if (!t.value || !t.value.startDate && !t.value.endDate)
|
|
793
|
+
return (d == null ? void 0 : d.value) || y("selectDateRange");
|
|
794
|
+
if ((k = u.value) != null && k.length) {
|
|
795
|
+
const P = u.value.find(({ value: M }) => {
|
|
796
|
+
var j;
|
|
797
|
+
return M === ((j = t.value) == null ? void 0 : j.range);
|
|
798
|
+
});
|
|
799
|
+
if (P)
|
|
800
|
+
return P.label;
|
|
801
|
+
}
|
|
802
|
+
if (t.value.granularity === "quarterly") {
|
|
803
|
+
const { startDate: P, endDate: M } = t.value, j = y("quarter", { quarter: ra(P), year: sa(P) });
|
|
804
|
+
if (Dt(P, M))
|
|
805
|
+
return j;
|
|
806
|
+
const fe = y("quarter", { quarter: ra(M), year: sa(M) });
|
|
807
|
+
return `${j} - ${fe}`;
|
|
808
|
+
}
|
|
809
|
+
const { startDate: R, endDate: q, startTime: L, endTime: de } = B, v = r != null && r.value ? S.LONG_MONTH_YEAR : S.FULL_DATE_MONTH_FIRST, ce = _(ue(R), v), me = _(ue(q), v);
|
|
810
|
+
if (!e.value)
|
|
811
|
+
return `${ce} - ${me}`;
|
|
812
|
+
const De = [ce, L].filter(Boolean).join(", "), re = [me, de].filter(Boolean).join(", ");
|
|
813
|
+
return `${De} - ${re}`;
|
|
814
|
+
}),
|
|
815
|
+
textInputDisplayValue: B,
|
|
816
|
+
// Methods
|
|
817
|
+
formatTextInputDisplayValue: () => ""
|
|
818
|
+
};
|
|
819
|
+
}, vt = { class: "b-date-range-picker" }, pt = { class: "b-date-range-picker__footer" }, yt = {
|
|
820
|
+
i18n: { messages: Be },
|
|
821
|
+
name: "bento-date-range-picker",
|
|
822
|
+
model: { prop: "modelValue" }
|
|
823
|
+
}, gt = /* @__PURE__ */ la({
|
|
824
|
+
...yt,
|
|
825
|
+
props: {
|
|
826
|
+
allowTimeInput: { type: Boolean },
|
|
827
|
+
firstDayOfWeek: { default: 1 },
|
|
828
|
+
granularities: {},
|
|
829
|
+
isDateDisabled: { type: Function, default: void 0 },
|
|
830
|
+
showEndDateOnOpen: { type: Boolean, default: !1 },
|
|
831
|
+
quickSelectRanges: { default: void 0 },
|
|
832
|
+
maxRange: { default: null },
|
|
833
|
+
min: { default: null },
|
|
834
|
+
max: { default: null },
|
|
835
|
+
numberOfMonths: { default: void 0 },
|
|
836
|
+
modelValue: { default: null },
|
|
837
|
+
value: { default: null },
|
|
838
|
+
variant: { default: void 0 },
|
|
839
|
+
hasActions: { type: Boolean, default: !1 },
|
|
840
|
+
description: { default: void 0 },
|
|
841
|
+
disabled: { type: Boolean, default: !1 },
|
|
842
|
+
errorMessage: { default: null },
|
|
843
|
+
label: { default: void 0 },
|
|
844
|
+
optional: { type: Boolean, default: !1 },
|
|
845
|
+
placeholder: { default: null },
|
|
846
|
+
readonly: { type: Boolean, default: !1 },
|
|
847
|
+
required: { type: Boolean, default: !1 },
|
|
848
|
+
tooltipText: { default: null }
|
|
849
|
+
},
|
|
850
|
+
emits: ["update:model-value", "input"],
|
|
851
|
+
setup(t, { emit: o }) {
|
|
852
|
+
const u = o, r = t, { locale: e, t: d } = Ne({ messages: Be }), f = Ue(), y = ge("bento-date-range-picker-container"), ee = ge("bento-date-range-picker-label"), C = ge("bento-date-range-picker-description"), _ = ge("bento-date-range-picker-error"), B = ge("bento-date-range-picker-date-error"), pe = b(() => r.label || d("dateRangePicker", { name: y })), ye = wa({
|
|
853
|
+
none: 0,
|
|
854
|
+
one: 710,
|
|
855
|
+
// width of date range picker with one panes
|
|
856
|
+
two: 1030,
|
|
857
|
+
// width of date range picker with two panes
|
|
858
|
+
three: 1290
|
|
859
|
+
// width of date range picker with three panes
|
|
860
|
+
}), s = b(() => {
|
|
861
|
+
const l = ye.active().value, p = {
|
|
862
|
+
none: 0,
|
|
863
|
+
one: 1,
|
|
864
|
+
two: 2
|
|
865
|
+
};
|
|
866
|
+
if (l in p) {
|
|
867
|
+
const $ = p[l];
|
|
868
|
+
return r.numberOfMonths === void 0 ? $ : Math.min(r.numberOfMonths, $);
|
|
869
|
+
}
|
|
870
|
+
return r.numberOfMonths;
|
|
871
|
+
}), E = b(() => (r == null ? void 0 : r.quickSelectRanges) && r.quickSelectRanges.map((l) => {
|
|
872
|
+
const p = l.data.endDate ? void 0 : new Date(Date.now()).getTime() - l.data.startDate.getTime();
|
|
873
|
+
return {
|
|
874
|
+
...l,
|
|
875
|
+
data: {
|
|
876
|
+
...l.data,
|
|
877
|
+
// Adding timeDifference to calculate an up-to-date endDate on range selection
|
|
878
|
+
timeDifference: p
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
})), g = A(!1), Y = A(null), R = A(!1), { isReadOnly: q } = Pa(je(r, "readonly")), { emitValue: L } = Va(u);
|
|
882
|
+
Fe(
|
|
883
|
+
() => r.disabled,
|
|
884
|
+
() => {
|
|
885
|
+
r.disabled && R.value && (R.value = !1);
|
|
886
|
+
}
|
|
887
|
+
);
|
|
888
|
+
const de = b(() => r.modelValue || r.value), v = b(() => r.hasActions ? !se.value && g.value : g.value), ce = b(() => ({
|
|
889
|
+
"b-date-range-picker__description--error": !!r.errorMessage || v.value
|
|
890
|
+
})), me = b(() => r.variant === "month"), De = b(() => r.allowTimeInput && r.variant !== "month"), { dateDisplayValue: re, textInputDisplayValue: k } = ft({
|
|
891
|
+
datePickerValue: de,
|
|
892
|
+
isDateIncorrect: g,
|
|
893
|
+
quickSelectRanges: E,
|
|
894
|
+
isMonthVariant: me,
|
|
895
|
+
withTimeInput: De,
|
|
896
|
+
placeholder: je(r, "placeholder")
|
|
897
|
+
}), P = b(
|
|
898
|
+
() => `${r.description ? C : ""} ${r.errorMessage ? _ : ""} ${g.value ? B : ""}`.trim() || null
|
|
899
|
+
), M = () => {
|
|
900
|
+
R.value = !1;
|
|
901
|
+
}, j = () => {
|
|
902
|
+
R.value = !0;
|
|
903
|
+
}, fe = A(re.value), H = A(
|
|
904
|
+
// textInputDisplayValue is a reactive object
|
|
905
|
+
structuredClone(Ce(k))
|
|
906
|
+
), ae = A(r.modelValue ?? r.value), se = A(!0), w = b(
|
|
907
|
+
() => r.hasActions ? H.value : k
|
|
908
|
+
), te = b(
|
|
909
|
+
() => r.hasActions ? fe.value : re.value
|
|
910
|
+
);
|
|
911
|
+
oa(() => {
|
|
912
|
+
if (r.hasActions || Qe(
|
|
913
|
+
'BentoDateRangePicker "hasActions" property',
|
|
914
|
+
`Set the BentoDateRangePicker "hasActions" property true which will display the "Apply" and "Cancel" buttons.
|
|
915
|
+
This will be the default behavior in the v2 and "hasActions" will be removed.`,
|
|
916
|
+
"2.0.0"
|
|
917
|
+
), r.value && Qe(
|
|
918
|
+
'BentoDateRangePicker "value" property',
|
|
919
|
+
'The use of "value" prop in "BentoDateRangePicker" is no longer supported. Use the "v-model" or "model-value" property instead.',
|
|
920
|
+
"2.0.0"
|
|
921
|
+
), r.granularities && r.variant !== "month" && r.granularities.find(({ type: l }) => l === "quarterly"))
|
|
922
|
+
throw new Error('Quarterly granularity is only supported by BentoDateRangePicker with variant: "month"');
|
|
923
|
+
}), Fe([() => r.value, () => r.modelValue], () => {
|
|
924
|
+
fe.value = re.value, H.value = structuredClone(Ce(k));
|
|
925
|
+
});
|
|
926
|
+
const le = b(() => [
|
|
927
|
+
{
|
|
928
|
+
title: d("apply"),
|
|
929
|
+
event: () => {
|
|
930
|
+
L(ae.value), M(), se.value = !0;
|
|
931
|
+
},
|
|
932
|
+
disabled: se.value
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
title: d("cancel"),
|
|
936
|
+
event: M
|
|
937
|
+
}
|
|
938
|
+
]);
|
|
939
|
+
Fe(ae, (l) => {
|
|
940
|
+
if (r.hasActions) {
|
|
941
|
+
se.value = g.value;
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
L(l);
|
|
945
|
+
});
|
|
946
|
+
const oe = (l) => {
|
|
947
|
+
g.value = !1;
|
|
948
|
+
const p = ($, h) => {
|
|
949
|
+
var W;
|
|
950
|
+
return $ ? ve($, h, {
|
|
951
|
+
locale: f[(W = e.value) == null ? void 0 : W.substring(0, 2)] || f.enUS
|
|
952
|
+
}) : void 0;
|
|
953
|
+
};
|
|
954
|
+
k.startDate = p(l.startDate, S.NUMERIC_DATE_YEAR_FIRST), k.endDate = p(l.endDate, S.NUMERIC_DATE_YEAR_FIRST), k.startTime = p(l.startDate, S.HOUR_MINUTE_SECONDS), k.endTime = p(l.endDate, S.HOUR_MINUTE_SECONDS), ae.value = l;
|
|
955
|
+
}, Q = async () => {
|
|
956
|
+
g.value && (g.value = !1), ae.value = null;
|
|
957
|
+
}, G = () => {
|
|
958
|
+
if (!R.value) {
|
|
959
|
+
R.value = !0;
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
g.value || (R.value = !1);
|
|
963
|
+
}, i = (l) => {
|
|
964
|
+
g.value = !1, l.startTime && (k.startTime = l.startTime), l.endTime && (k.endTime = l.endTime);
|
|
965
|
+
}, be = (l) => {
|
|
966
|
+
g.value = !0, k.startDate = l.startDate, k.endDate = l.endDate, ae.value = { startDate: null, endDate: null };
|
|
967
|
+
}, Re = (l) => {
|
|
968
|
+
if (l) {
|
|
969
|
+
const p = (h, W) => {
|
|
970
|
+
var ke;
|
|
971
|
+
return h ? ve(h, W, {
|
|
972
|
+
locale: f[(ke = e.value) == null ? void 0 : ke.substring(0, 2)] || f.enUS
|
|
973
|
+
}) : void 0;
|
|
974
|
+
}, $ = (h) => {
|
|
975
|
+
var W;
|
|
976
|
+
return ve(h, S.NUMERIC_DATE_YEAR_FIRST, {
|
|
977
|
+
locale: f[(W = e.value) == null ? void 0 : W.substring(0, 2)] || f.enUS
|
|
978
|
+
});
|
|
979
|
+
};
|
|
980
|
+
k.startDate = $(l.startDate), k.endDate = $(l.endDate), k.startTime = p(
|
|
981
|
+
l.startDate,
|
|
982
|
+
S.HOUR_MINUTE_SECONDS
|
|
983
|
+
), k.endTime = p(l.endDate, S.HOUR_MINUTE_SECONDS), ae.value = l;
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
return (l, p) => ha((F(), _e("div", vt, [
|
|
987
|
+
l.label ? (F(), J(D(Ga), {
|
|
988
|
+
key: 0,
|
|
989
|
+
id: D(ee),
|
|
990
|
+
label: l.label,
|
|
991
|
+
"tooltip-text": l.tooltipText,
|
|
992
|
+
optional: l.optional,
|
|
993
|
+
required: l.required
|
|
994
|
+
}, null, 8, ["id", "label", "tooltip-text", "optional", "required"])) : U("", !0),
|
|
995
|
+
ne("div", {
|
|
996
|
+
onKeydown: He(G, ["enter"])
|
|
997
|
+
}, [
|
|
998
|
+
X(D(Ya), {
|
|
999
|
+
ref_key: "inputContainerRef",
|
|
1000
|
+
ref: Y,
|
|
1001
|
+
"always-combobox-is-input": "",
|
|
1002
|
+
ariaControls: D(y),
|
|
1003
|
+
ariaExpanded: R.value,
|
|
1004
|
+
"aria-labelledby": l.label ? D(ee) : null,
|
|
1005
|
+
"aria-describedby": P.value,
|
|
1006
|
+
disabled: l.disabled,
|
|
1007
|
+
"is-invalid": !!l.errorMessage || v.value,
|
|
1008
|
+
open: R.value,
|
|
1009
|
+
"display-value": te.value,
|
|
1010
|
+
readonly: D(q),
|
|
1011
|
+
onOpen: j,
|
|
1012
|
+
onClear: Q,
|
|
1013
|
+
onClose: M
|
|
1014
|
+
}, null, 8, ["ariaControls", "ariaExpanded", "aria-labelledby", "aria-describedby", "disabled", "is-invalid", "open", "display-value", "readonly"])
|
|
1015
|
+
], 32),
|
|
1016
|
+
v.value ? (F(), J(D(Ze), {
|
|
1017
|
+
key: 1,
|
|
1018
|
+
id: D(B),
|
|
1019
|
+
"error-message": D(d)("provideDateInAFormat"),
|
|
1020
|
+
class: "b-date-range-picker__error-message"
|
|
1021
|
+
}, null, 8, ["id", "error-message"])) : U("", !0),
|
|
1022
|
+
l.errorMessage ? (F(), J(D(Ze), {
|
|
1023
|
+
key: 2,
|
|
1024
|
+
id: D(_),
|
|
1025
|
+
"error-message": l.errorMessage,
|
|
1026
|
+
class: "b-date-range-picker__error-message"
|
|
1027
|
+
}, null, 8, ["id", "error-message"])) : U("", !0),
|
|
1028
|
+
l.description ? (F(), J(D(Ae), {
|
|
1029
|
+
key: 3,
|
|
1030
|
+
id: D(C),
|
|
1031
|
+
class: we(["b-date-range-picker__description", ce.value]),
|
|
1032
|
+
el: "span"
|
|
1033
|
+
}, {
|
|
1034
|
+
default: z(() => [
|
|
1035
|
+
ie(Sa(l.description), 1)
|
|
1036
|
+
]),
|
|
1037
|
+
_: 1
|
|
1038
|
+
}, 8, ["id", "class"])) : U("", !0),
|
|
1039
|
+
Y.value ? (F(), J(D(Oa), {
|
|
1040
|
+
key: 4,
|
|
1041
|
+
id: D(y),
|
|
1042
|
+
class: "b-date-range-picker__container",
|
|
1043
|
+
open: R.value,
|
|
1044
|
+
"target-element": Y.value,
|
|
1045
|
+
"aria-label": pe.value,
|
|
1046
|
+
position: "bottom-start",
|
|
1047
|
+
"without-space": "",
|
|
1048
|
+
"fit-content": "",
|
|
1049
|
+
"trap-all": "",
|
|
1050
|
+
onKeydown: He(M, ["esc", "native"])
|
|
1051
|
+
}, {
|
|
1052
|
+
default: z(() => [
|
|
1053
|
+
X(D(mt), {
|
|
1054
|
+
"allow-time-input": De.value,
|
|
1055
|
+
"quick-select-ranges": E.value,
|
|
1056
|
+
value: de.value,
|
|
1057
|
+
"first-day-of-week": l.firstDayOfWeek,
|
|
1058
|
+
granularities: l.granularities,
|
|
1059
|
+
"is-date-disabled": l.isDateDisabled,
|
|
1060
|
+
"max-range": l.maxRange,
|
|
1061
|
+
min: l.min,
|
|
1062
|
+
max: l.max,
|
|
1063
|
+
"number-of-months": s.value,
|
|
1064
|
+
"show-end-date-on-open": l.showEndDateOnOpen,
|
|
1065
|
+
"date-form-data": w.value,
|
|
1066
|
+
variant: l.variant,
|
|
1067
|
+
onCustomRange: Re,
|
|
1068
|
+
onInput: oe,
|
|
1069
|
+
onError: be,
|
|
1070
|
+
onFormDate: i
|
|
1071
|
+
}, _a({ _: 2 }, [
|
|
1072
|
+
l.hasActions ? {
|
|
1073
|
+
name: "actions",
|
|
1074
|
+
fn: z(() => [
|
|
1075
|
+
X(D(Ma)),
|
|
1076
|
+
ne("div", pt, [
|
|
1077
|
+
X(D(Fa), {
|
|
1078
|
+
actions: le.value,
|
|
1079
|
+
layout: D(Wa).SPACE_BETWEEN
|
|
1080
|
+
}, null, 8, ["actions", "layout"])
|
|
1081
|
+
])
|
|
1082
|
+
]),
|
|
1083
|
+
key: "0"
|
|
1084
|
+
} : void 0
|
|
1085
|
+
]), 1032, ["allow-time-input", "quick-select-ranges", "value", "first-day-of-week", "granularities", "is-date-disabled", "max-range", "min", "max", "number-of-months", "show-end-date-on-open", "date-form-data", "variant"])
|
|
1086
|
+
]),
|
|
1087
|
+
_: 1
|
|
1088
|
+
}, 8, ["id", "open", "target-element", "aria-label"])) : U("", !0)
|
|
1089
|
+
])), [
|
|
1090
|
+
[D($a), M]
|
|
1091
|
+
]);
|
|
1092
|
+
}
|
|
1093
|
+
}), Lt = /* @__PURE__ */ ua(gt, [["__scopeId", "data-v-c4bf2c5f"]]);
|
|
1094
|
+
export {
|
|
1095
|
+
Lt as B,
|
|
1096
|
+
mt as D,
|
|
1097
|
+
st as a,
|
|
1098
|
+
Se as i
|
|
1099
|
+
};
|
|
1100
|
+
//# sourceMappingURL=date-range-picker.qXIfFq69.js.map
|