@semcore/date-picker 4.55.1-prerelease.2 → 4.55.1-prerelease.5
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/CHANGELOG.md +2 -2
- package/lib/esm/DatePicker.mjs +147 -0
- package/lib/esm/DateRangeComparator.mjs +213 -0
- package/lib/esm/DateRangePicker.mjs +111 -0
- package/lib/esm/MonthDateRangeComparator.mjs +249 -0
- package/lib/esm/MonthPicker.mjs +99 -0
- package/lib/esm/MonthRangePicker.mjs +122 -0
- package/lib/esm/components/ButtonTrigger.mjs +19 -0
- package/lib/esm/components/Calendar.mjs +407 -0
- package/lib/esm/components/DateRangeComparatorAbstract.mjs +500 -0
- package/lib/esm/components/InputTrigger.mjs +650 -0
- package/lib/esm/components/PickerAbstract.mjs +231 -0
- package/lib/esm/components/RangePickerAbstract.mjs +352 -0
- package/lib/esm/components/index.mjs +130 -0
- package/lib/esm/index.mjs +15 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +35 -0
- package/lib/esm/translations/de.json.mjs +62 -0
- package/lib/esm/translations/en.json.mjs +70 -0
- package/lib/esm/translations/es.json.mjs +62 -0
- package/lib/esm/translations/fr.json.mjs +62 -0
- package/lib/esm/translations/it.json.mjs +62 -0
- package/lib/esm/translations/ja.json.mjs +62 -0
- package/lib/esm/translations/ko.json.mjs +62 -0
- package/lib/esm/translations/nl.json.mjs +62 -0
- package/lib/esm/translations/pl.json.mjs +62 -0
- package/lib/esm/translations/pt.json.mjs +62 -0
- package/lib/esm/translations/ru.json.mjs +27 -0
- package/lib/esm/translations/sv.json.mjs +62 -0
- package/lib/esm/translations/tr.json.mjs +62 -0
- package/lib/esm/translations/vi.json.mjs +62 -0
- package/lib/esm/translations/zh.json.mjs +62 -0
- package/lib/esm/utils/cronTabScheduler.mjs +84 -0
- package/lib/esm/utils/datesIntersects.mjs +16 -0
- package/lib/esm/utils/formatDate.mjs +21 -0
- package/lib/esm/utils/includesDate.mjs +14 -0
- package/lib/esm/utils/shortDateRangeFormat.mjs +38 -0
- package/package.json +16 -16
- package/vite.config.ts +1 -1
- package/lib/esm/_virtual/_commonjsHelpers.mjs +0 -8
- package/lib/esm/_virtual/isBetween.mjs +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,9 @@ CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangel
|
|
|
4
4
|
|
|
5
5
|
## [4.55.1] - 2025-03-18
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Fixed
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- `dayjs` external setting in vite config.
|
|
10
10
|
|
|
11
11
|
## [4.55.0] - 2025-03-14
|
|
12
12
|
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import n from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import k from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import C from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import m from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import u from "@babel/runtime/helpers/esm/get";
|
|
6
|
+
import g from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
+
import _ from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
import b from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
+
import s from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
+
import B, { sstyled as I, assignProps as A, Component as $ } from "@semcore/core";
|
|
11
|
+
import i from "react";
|
|
12
|
+
import v from "dayjs";
|
|
13
|
+
import { Box as R } from "@semcore/flex-box";
|
|
14
|
+
import F from "@semcore/button";
|
|
15
|
+
import H from "@semcore/divider";
|
|
16
|
+
import M from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
17
|
+
import { InputTrigger as E, Trigger as j, Popper as z, Header as N, Title as O, Prev as Y, Next as L } from "./components/index.mjs";
|
|
18
|
+
import { CalendarDays as D } from "./components/Calendar.mjs";
|
|
19
|
+
import x from "./components/PickerAbstract.mjs";
|
|
20
|
+
import { formatDDMMYY as U } from "./utils/formatDate.mjs";
|
|
21
|
+
import { includesDate as q } from "./utils/includesDate.mjs";
|
|
22
|
+
import { localizedMessages as G } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
23
|
+
var T = /* @__PURE__ */ function(p) {
|
|
24
|
+
_(r, p);
|
|
25
|
+
var c = b(r);
|
|
26
|
+
function r() {
|
|
27
|
+
var a;
|
|
28
|
+
k(this, r);
|
|
29
|
+
for (var e = arguments.length, t = new Array(e), o = 0; o < e; o++)
|
|
30
|
+
t[o] = arguments[o];
|
|
31
|
+
return a = c.call.apply(c, [this].concat(t)), s(m(a), "navigateStep", "month"), s(m(a), "keyStep", "day"), s(m(a), "keyDiff", {
|
|
32
|
+
ArrowLeft: -1,
|
|
33
|
+
ArrowUp: -7,
|
|
34
|
+
ArrowRight: 1,
|
|
35
|
+
ArrowDown: 7
|
|
36
|
+
}), s(m(a), "handlerToday", function() {
|
|
37
|
+
a.handlers.value(new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)));
|
|
38
|
+
}), a;
|
|
39
|
+
}
|
|
40
|
+
return C(r, [{
|
|
41
|
+
key: "getButtonTriggerProps",
|
|
42
|
+
value: function() {
|
|
43
|
+
var e = this.asProps, t = e.value, o = e.locale;
|
|
44
|
+
return n(n({}, u(g(r.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
45
|
+
placeholder: "Select date",
|
|
46
|
+
children: t ? U(t, o) : null
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "getTriggerProps",
|
|
51
|
+
value: function() {
|
|
52
|
+
var e = this.asProps, t = e.value, o = e.onChange, l = e.onDisplayedPeriodChange, h = e.locale, f = e.disabled, P = e.disabledErrorText, y = e.getI18nText, S = e.animationsDisabled;
|
|
53
|
+
return n(n({}, u(g(r.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
54
|
+
value: t,
|
|
55
|
+
onChange: o,
|
|
56
|
+
onDisplayedPeriodChange: l,
|
|
57
|
+
locale: h,
|
|
58
|
+
disabledDates: f,
|
|
59
|
+
disabledErrorText: P,
|
|
60
|
+
children: function() {
|
|
61
|
+
return /* @__PURE__ */ i.createElement(E.SingleDateInput, null);
|
|
62
|
+
},
|
|
63
|
+
getI18nText: y,
|
|
64
|
+
animationsDisabled: S,
|
|
65
|
+
unit: this.keyStep
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "getPopperProps",
|
|
70
|
+
value: function() {
|
|
71
|
+
return n(n({}, u(g(r.prototype), "getPopperProps", this).call(this)), {}, {
|
|
72
|
+
children: /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(d.Header, null), /* @__PURE__ */ i.createElement(d.Calendar, null), /* @__PURE__ */ i.createElement(H, {
|
|
73
|
+
ml: -4,
|
|
74
|
+
mt: 4,
|
|
75
|
+
w: "calc(100% + 32px)"
|
|
76
|
+
}), /* @__PURE__ */ i.createElement(d.Today, null))
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "getTitleProps",
|
|
81
|
+
value: function() {
|
|
82
|
+
var e = this.asProps, t = e.displayedPeriod, o = e.locale;
|
|
83
|
+
return n(n({}, u(g(r.prototype), "getTitleProps", this).call(this)), {}, {
|
|
84
|
+
children: new Intl.DateTimeFormat(o, {
|
|
85
|
+
month: "long",
|
|
86
|
+
year: "numeric"
|
|
87
|
+
}).format(v(t).startOf("month").toDate())
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "getTodayProps",
|
|
92
|
+
value: function() {
|
|
93
|
+
var e = this.asProps, t = e.i18n, o = e.locale, l = e.disabled;
|
|
94
|
+
return {
|
|
95
|
+
i18n: t,
|
|
96
|
+
locale: o,
|
|
97
|
+
onClick: this.handlerToday,
|
|
98
|
+
disabled: l.some(q(v(), "day"))
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}]), r;
|
|
102
|
+
}(x);
|
|
103
|
+
s(T, "displayName", "DatePicker");
|
|
104
|
+
s(T, "defaultProps", function(p) {
|
|
105
|
+
return n(n({}, x.defaultProps(p)), {}, {
|
|
106
|
+
children: /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(d.Trigger, null), /* @__PURE__ */ i.createElement(d.Popper, null))
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
var w = /* @__PURE__ */ function(p) {
|
|
110
|
+
_(r, p);
|
|
111
|
+
var c = b(r);
|
|
112
|
+
function r() {
|
|
113
|
+
return k(this, r), c.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
return C(r, [{
|
|
116
|
+
key: "render",
|
|
117
|
+
value: function() {
|
|
118
|
+
var e = this.asProps, t, o = R, l = this.asProps, h = l.styles, f = l.getI18nText, P = l.disabled, y = l.onClick;
|
|
119
|
+
return t = I(h), /* @__PURE__ */ i.createElement(o, t.cn("SToday", n({}, A({
|
|
120
|
+
__excludeProps: ["onClick"]
|
|
121
|
+
}, e))), /* @__PURE__ */ i.createElement(F, t.cn("Button", {
|
|
122
|
+
use: "tertiary",
|
|
123
|
+
children: f("today"),
|
|
124
|
+
disabled: P,
|
|
125
|
+
onClick: y
|
|
126
|
+
})));
|
|
127
|
+
}
|
|
128
|
+
}]), r;
|
|
129
|
+
}($);
|
|
130
|
+
s(w, "enhance", [M(G)]);
|
|
131
|
+
var d = B(T, {
|
|
132
|
+
Trigger: E,
|
|
133
|
+
ButtonTrigger: j,
|
|
134
|
+
Popper: z,
|
|
135
|
+
Header: N,
|
|
136
|
+
Title: O,
|
|
137
|
+
Prev: Y,
|
|
138
|
+
Next: L,
|
|
139
|
+
Calendar: D,
|
|
140
|
+
Today: w
|
|
141
|
+
}, {
|
|
142
|
+
parent: D
|
|
143
|
+
});
|
|
144
|
+
export {
|
|
145
|
+
T as DatePickerRoot,
|
|
146
|
+
d as default
|
|
147
|
+
};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import y from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import D from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import f from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import h from "@babel/runtime/helpers/esm/get";
|
|
5
|
+
import S from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
+
import I from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _ from "@babel/runtime/helpers/esm/createSuper";
|
|
8
|
+
import g from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
import p from "@babel/runtime/helpers/esm/objectSpread2";
|
|
10
|
+
import w, { sstyled as m, assignProps as F } from "@semcore/core";
|
|
11
|
+
import e from "react";
|
|
12
|
+
import { Popper as T, Header as b, Title as k, Prev as A, Next as B, Period as H } from "./components/index.mjs";
|
|
13
|
+
import { CalendarDays as E } from "./components/Calendar.mjs";
|
|
14
|
+
import { Flex as c, Box as P } from "@semcore/flex-box";
|
|
15
|
+
import x from "@semcore/divider";
|
|
16
|
+
import v, { Header as O, Apply as M, Reset as V, Trigger as N, CompareToggle as $, Body as j, Footer as z } from "./components/DateRangeComparatorAbstract.mjs";
|
|
17
|
+
import u from "./components/InputTrigger.mjs";
|
|
18
|
+
function d(t) {
|
|
19
|
+
var n = arguments[0], l, r = t.styles, o = P, i = P;
|
|
20
|
+
return l = m(r), /* @__PURE__ */ e.createElement(o, l.cn("SComparatorRangeInput", p({}, F({
|
|
21
|
+
"data-name": "SComparatorRangeInput",
|
|
22
|
+
tag: u,
|
|
23
|
+
unit: "date",
|
|
24
|
+
__excludeProps: ["role", "aria-haspopup", "aria-expanded", "onChange", "value", "id"]
|
|
25
|
+
}, n))), /* @__PURE__ */ e.createElement(u.DateRange, null, /* @__PURE__ */ e.createElement(i, l.cn("SRangeIndicator", {
|
|
26
|
+
range: t.range,
|
|
27
|
+
disabled: t.disabled,
|
|
28
|
+
w: 12,
|
|
29
|
+
h: 12,
|
|
30
|
+
ml: 2
|
|
31
|
+
})), /* @__PURE__ */ e.createElement(u.DateRange.Indicator, null), /* @__PURE__ */ e.createElement(u.DateRange.FromMaskedInput, null), /* @__PURE__ */ e.createElement(u.DateRange.RangeSep, null), /* @__PURE__ */ e.createElement(u.DateRange.ToMaskedInput, null)));
|
|
32
|
+
}
|
|
33
|
+
d.Indicator = u.Indicator;
|
|
34
|
+
d.MaskedInput = u.MaskedInput;
|
|
35
|
+
d.Addon = u.Addon;
|
|
36
|
+
d.SingleDateInput = u.SingleDateInput;
|
|
37
|
+
d.DateRange = u.DateRange;
|
|
38
|
+
d.DateRangeFromInput = u.DateRangeFromInput;
|
|
39
|
+
d.DateRangeToInput = u.DateRangeToInput;
|
|
40
|
+
var R = /* @__PURE__ */ function(t) {
|
|
41
|
+
I(l, t);
|
|
42
|
+
var n = _(l);
|
|
43
|
+
function l() {
|
|
44
|
+
var r;
|
|
45
|
+
y(this, l);
|
|
46
|
+
for (var o = arguments.length, i = new Array(o), s = 0; s < o; s++)
|
|
47
|
+
i[s] = arguments[s];
|
|
48
|
+
return r = n.call.apply(n, [this].concat(i)), g(f(r), "navigateStep", "month"), g(f(r), "keyStep", "day"), g(f(r), "keyDiff", {
|
|
49
|
+
ArrowLeft: -1,
|
|
50
|
+
ArrowUp: -7,
|
|
51
|
+
ArrowRight: 1,
|
|
52
|
+
ArrowDown: 7
|
|
53
|
+
}), r;
|
|
54
|
+
}
|
|
55
|
+
return D(l, [{
|
|
56
|
+
key: "getRangeInput",
|
|
57
|
+
value: function() {
|
|
58
|
+
return /* @__PURE__ */ e.createElement(a.RangeInput.DateRange, null);
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "getRangeCalendarProps",
|
|
62
|
+
value: function() {
|
|
63
|
+
return {
|
|
64
|
+
children: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(c, {
|
|
65
|
+
direction: "column"
|
|
66
|
+
}, /* @__PURE__ */ e.createElement(a.CalendarHeader, {
|
|
67
|
+
tag: c
|
|
68
|
+
}, /* @__PURE__ */ e.createElement(a.Prev, null), /* @__PURE__ */ e.createElement(a.Title, null)), /* @__PURE__ */ e.createElement(a.Calendar, null)), /* @__PURE__ */ e.createElement(c, {
|
|
69
|
+
direction: "column"
|
|
70
|
+
}, /* @__PURE__ */ e.createElement(a.CalendarHeader, {
|
|
71
|
+
tag: c
|
|
72
|
+
}, /* @__PURE__ */ e.createElement(a.Title, null), /* @__PURE__ */ e.createElement(a.Next, null)), /* @__PURE__ */ e.createElement(a.Calendar, null)))
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "getPopperProps",
|
|
77
|
+
value: function() {
|
|
78
|
+
return p(p({}, h(S(l.prototype), "getPopperProps", this).call(this)), {}, {
|
|
79
|
+
children: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(a.Header, null), /* @__PURE__ */ e.createElement(a.Body, {
|
|
80
|
+
showButtons: !0
|
|
81
|
+
}))
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "getHeaderProps",
|
|
86
|
+
value: function() {
|
|
87
|
+
return {
|
|
88
|
+
children: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(a.ValueDateRange, null), /* @__PURE__ */ e.createElement(a.CompareToggle, null), /* @__PURE__ */ e.createElement(a.CompareDateRange, null))
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "getBodyProps",
|
|
93
|
+
value: function(o) {
|
|
94
|
+
var i = o.showButtons;
|
|
95
|
+
return {
|
|
96
|
+
children: /* @__PURE__ */ e.createElement(c, null, /* @__PURE__ */ e.createElement(a.RangeCalendar, null), /* @__PURE__ */ e.createElement(a.Periods, {
|
|
97
|
+
showButtons: i
|
|
98
|
+
}))
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "getPeriodsProps",
|
|
103
|
+
value: function(o) {
|
|
104
|
+
var i = o.showButtons, s = o.unclearable, C = s === void 0 ? !1 : s;
|
|
105
|
+
return {
|
|
106
|
+
children: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(a.Periods.Divider, null), /* @__PURE__ */ e.createElement(a.Periods.Column, null, /* @__PURE__ */ e.createElement(a.Periods.Options, null), i && /* @__PURE__ */ e.createElement(a.Periods.Controls, null, /* @__PURE__ */ e.createElement(a.Apply, null), !C && /* @__PURE__ */ e.createElement(a.Reset, null))))
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "getFooterProps",
|
|
111
|
+
value: function(o) {
|
|
112
|
+
var i = o.unclearable, s = i === void 0 ? !1 : i;
|
|
113
|
+
return {
|
|
114
|
+
children: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(a.Apply, null), !s && /* @__PURE__ */ e.createElement(a.Reset, null))
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}]), l;
|
|
118
|
+
}(v);
|
|
119
|
+
g(R, "displayName", "DateRangeComparator");
|
|
120
|
+
g(R, "defaultProps", function(t) {
|
|
121
|
+
return p(p({}, v.defaultProps(t)), {}, {
|
|
122
|
+
children: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(a.Trigger, null), /* @__PURE__ */ e.createElement(a.Popper, null))
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
function L(t) {
|
|
126
|
+
var n, l = t.Root, r = t.styles;
|
|
127
|
+
return n = m(r), /* @__PURE__ */ e.createElement(l, n.cn("SValueDateRange", {
|
|
128
|
+
render: a.RangeInput,
|
|
129
|
+
range: "value"
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
function U(t) {
|
|
133
|
+
var n, l = t.Root, r = t.styles;
|
|
134
|
+
return n = m(r), /* @__PURE__ */ e.createElement(l, n.cn("SSecondaryDateRange", {
|
|
135
|
+
render: a.RangeInput,
|
|
136
|
+
range: "compare"
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
function q(t) {
|
|
140
|
+
var n, l = t.Root, r = t.Children, o = t.styles;
|
|
141
|
+
return n = m(o), /* @__PURE__ */ e.createElement(l, n.cn("SRangeCalendar", {
|
|
142
|
+
render: c,
|
|
143
|
+
gap: 8
|
|
144
|
+
}), /* @__PURE__ */ e.createElement(r, n.cn("Children", {})));
|
|
145
|
+
}
|
|
146
|
+
function G(t) {
|
|
147
|
+
var n, l = t.Root, r = t.styles;
|
|
148
|
+
return n = m(r), /* @__PURE__ */ e.createElement(l, n.cn("SPeriods", {
|
|
149
|
+
render: c
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
function J(t) {
|
|
153
|
+
var n, l = t.Root, r = t.styles;
|
|
154
|
+
return n = m(r), /* @__PURE__ */ e.createElement(l, n.cn("SPeriodsDivider", {
|
|
155
|
+
orientation: "vertical",
|
|
156
|
+
h: "auto",
|
|
157
|
+
render: x
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
function K(t) {
|
|
161
|
+
var n, l = t.Root, r = t.styles;
|
|
162
|
+
return n = m(r), /* @__PURE__ */ e.createElement(l, n.cn("SPeriodsColumn", {
|
|
163
|
+
render: c,
|
|
164
|
+
direction: "column",
|
|
165
|
+
justifyContent: "space-between"
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
function Q(t) {
|
|
169
|
+
var n, l = t.styles, r = t.Root;
|
|
170
|
+
return n = m(l), /* @__PURE__ */ e.createElement(r, n.cn("SPeriodsOptions", {
|
|
171
|
+
render: a.Period,
|
|
172
|
+
p: 2
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
function W(t) {
|
|
176
|
+
var n, l = t.styles, r = t.Root;
|
|
177
|
+
return n = m(l), /* @__PURE__ */ e.createElement(r, n.cn("SPeriodsControls", {
|
|
178
|
+
render: c,
|
|
179
|
+
p: 4,
|
|
180
|
+
gap: 2
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
var a = w(R, {
|
|
184
|
+
Popper: T,
|
|
185
|
+
CalendarHeader: b,
|
|
186
|
+
Title: k,
|
|
187
|
+
Header: O,
|
|
188
|
+
Prev: A,
|
|
189
|
+
Next: B,
|
|
190
|
+
Calendar: E,
|
|
191
|
+
Period: H,
|
|
192
|
+
Apply: M,
|
|
193
|
+
Reset: V,
|
|
194
|
+
Trigger: N,
|
|
195
|
+
ValueDateRange: L,
|
|
196
|
+
CompareToggle: $,
|
|
197
|
+
CompareDateRange: U,
|
|
198
|
+
Body: j,
|
|
199
|
+
RangeCalendar: q,
|
|
200
|
+
Periods: [G, {
|
|
201
|
+
Divider: J,
|
|
202
|
+
Column: K,
|
|
203
|
+
Options: Q,
|
|
204
|
+
Controls: W
|
|
205
|
+
}],
|
|
206
|
+
Footer: z,
|
|
207
|
+
RangeInput: d
|
|
208
|
+
}, {
|
|
209
|
+
parent: E
|
|
210
|
+
});
|
|
211
|
+
export {
|
|
212
|
+
a as default
|
|
213
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import i from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import w from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import x from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import u from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import d from "@babel/runtime/helpers/esm/get";
|
|
6
|
+
import m from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
+
import A from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
import E from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
+
import l from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
+
import s from "react";
|
|
11
|
+
import n from "dayjs";
|
|
12
|
+
import I from "@semcore/core";
|
|
13
|
+
import S from "./utils/shortDateRangeFormat.mjs";
|
|
14
|
+
import { InputTrigger as P, Trigger as B, Popper as j, Header as F, Title as H, Prev as M, Next as N, Period as V } from "./components/index.mjs";
|
|
15
|
+
import { CalendarDays as h } from "./components/Calendar.mjs";
|
|
16
|
+
import v, { Apply as W, Reset as $ } from "./components/RangePickerAbstract.mjs";
|
|
17
|
+
var c = /* @__PURE__ */ function(p) {
|
|
18
|
+
A(o, p);
|
|
19
|
+
var g = E(o);
|
|
20
|
+
function o() {
|
|
21
|
+
var a;
|
|
22
|
+
w(this, o);
|
|
23
|
+
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
24
|
+
t[r] = arguments[r];
|
|
25
|
+
return a = g.call.apply(g, [this].concat(t)), l(u(a), "navigateStep", "month"), l(u(a), "keyStep", "day"), l(u(a), "keyDiff", {
|
|
26
|
+
ArrowLeft: -1,
|
|
27
|
+
ArrowUp: -7,
|
|
28
|
+
ArrowRight: 1,
|
|
29
|
+
ArrowDown: 7
|
|
30
|
+
}), a;
|
|
31
|
+
}
|
|
32
|
+
return x(o, [{
|
|
33
|
+
key: "getDefaultPeriods",
|
|
34
|
+
value: function() {
|
|
35
|
+
var e = this.asProps.getI18nText, t = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
|
|
36
|
+
return [{
|
|
37
|
+
children: e("last2Days"),
|
|
38
|
+
value: [n(t).subtract(1, "day").toDate(), t]
|
|
39
|
+
}, {
|
|
40
|
+
children: e("lastWeek"),
|
|
41
|
+
value: [n(t).subtract(6, "day").toDate(), t]
|
|
42
|
+
}, {
|
|
43
|
+
children: e("last2Weeks"),
|
|
44
|
+
value: [n(t).subtract(13, "day").toDate(), t]
|
|
45
|
+
}, {
|
|
46
|
+
children: e("lastMonth"),
|
|
47
|
+
value: [n(t).subtract(1, "month").toDate(), t]
|
|
48
|
+
}, {
|
|
49
|
+
children: e("last2Months"),
|
|
50
|
+
value: [n(t).subtract(2, "month").toDate(), t]
|
|
51
|
+
}];
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "getButtonTriggerProps",
|
|
55
|
+
value: function() {
|
|
56
|
+
var e = this.asProps, t = e.value, r = e.locale;
|
|
57
|
+
return i(i({}, d(m(o.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
58
|
+
placeholder: "Select date period",
|
|
59
|
+
children: S(t, {
|
|
60
|
+
locale: r,
|
|
61
|
+
day: "numeric",
|
|
62
|
+
month: "short",
|
|
63
|
+
year: "numeric"
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "getTriggerProps",
|
|
69
|
+
value: function() {
|
|
70
|
+
var e = this.asProps, t = e.visible, r = e.preselectedValue, D = e.onChange, y = e.onDisplayedPeriodChange, T = e.locale, b = e.disabled, R = e.disabledErrorText, k = e.getI18nText, C = e.animationsDisabled, _ = t ? [r[0] || this.asProps.value[0], r[1] || this.asProps.value[1]] : this.asProps.value;
|
|
71
|
+
return i(i({}, d(m(o.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
72
|
+
value: _,
|
|
73
|
+
onChange: D,
|
|
74
|
+
onDisplayedPeriodChange: y,
|
|
75
|
+
locale: T,
|
|
76
|
+
disabledDates: b,
|
|
77
|
+
disabledErrorText: R,
|
|
78
|
+
children: function() {
|
|
79
|
+
return /* @__PURE__ */ s.createElement(P.DateRange, null);
|
|
80
|
+
},
|
|
81
|
+
getI18nText: k,
|
|
82
|
+
animationsDisabled: C,
|
|
83
|
+
unit: this.keyStep
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}]), o;
|
|
87
|
+
}(v);
|
|
88
|
+
l(c, "displayName", "DateRangePicker");
|
|
89
|
+
l(c, "defaultProps", function(p) {
|
|
90
|
+
return i(i({}, v.defaultProps(p)), {}, {
|
|
91
|
+
children: /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(f.Trigger, null), /* @__PURE__ */ s.createElement(f.Popper, null))
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var f = I(c, {
|
|
95
|
+
Trigger: P,
|
|
96
|
+
ButtonTrigger: B,
|
|
97
|
+
Popper: j,
|
|
98
|
+
Header: F,
|
|
99
|
+
Title: H,
|
|
100
|
+
Prev: M,
|
|
101
|
+
Next: N,
|
|
102
|
+
Calendar: h,
|
|
103
|
+
Period: V,
|
|
104
|
+
Apply: W,
|
|
105
|
+
Reset: $
|
|
106
|
+
}, {
|
|
107
|
+
parent: h
|
|
108
|
+
});
|
|
109
|
+
export {
|
|
110
|
+
f as default
|
|
111
|
+
};
|