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