@semcore/date-picker 4.57.0 → 4.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/components/Calendar.js +24 -22
- package/lib/cjs/components/Calendar.js.map +1 -1
- package/lib/cjs/components/DateRangeComparatorAbstract.js +32 -30
- package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/cjs/components/InputTrigger.js +32 -30
- package/lib/cjs/components/InputTrigger.js.map +1 -1
- package/lib/cjs/components/PickerAbstract.js +32 -30
- package/lib/cjs/components/PickerAbstract.js.map +1 -1
- package/lib/cjs/components/RangePickerAbstract.js +32 -30
- package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
- package/lib/es6/components/Calendar.js +24 -22
- package/lib/es6/components/Calendar.js.map +1 -1
- package/lib/es6/components/DateRangeComparatorAbstract.js +32 -30
- package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/es6/components/InputTrigger.js +32 -30
- package/lib/es6/components/InputTrigger.js.map +1 -1
- package/lib/es6/components/PickerAbstract.js +32 -30
- package/lib/es6/components/PickerAbstract.js.map +1 -1
- package/lib/es6/components/RangePickerAbstract.js +32 -30
- package/lib/es6/components/RangePickerAbstract.js.map +1 -1
- package/lib/esm/DatePicker.mjs +114 -103
- package/lib/esm/DateRangeComparator.mjs +166 -149
- package/lib/esm/DateRangePicker.mjs +85 -77
- package/lib/esm/MonthDateRangeComparator.mjs +187 -169
- package/lib/esm/MonthPicker.mjs +78 -71
- package/lib/esm/MonthRangePicker.mjs +94 -85
- package/lib/esm/components/ButtonTrigger.mjs +16 -15
- package/lib/esm/components/Calendar.mjs +409 -287
- package/lib/esm/components/DateRangeComparatorAbstract.mjs +458 -330
- package/lib/esm/components/InputTrigger.mjs +762 -519
- package/lib/esm/components/PickerAbstract.mjs +196 -149
- package/lib/esm/components/RangePickerAbstract.mjs +310 -221
- package/lib/esm/components/index.mjs +127 -109
- package/lib/esm/index.mjs +13 -13
- package/lib/esm/style/calendar.shadow.css +259 -0
- package/lib/esm/style/date-picker.shadow.css +179 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +32 -32
- package/lib/esm/translations/de.json.mjs +83 -56
- package/lib/esm/translations/en.json.mjs +95 -64
- package/lib/esm/translations/es.json.mjs +83 -56
- package/lib/esm/translations/fr.json.mjs +83 -56
- package/lib/esm/translations/it.json.mjs +83 -56
- package/lib/esm/translations/ja.json.mjs +83 -56
- package/lib/esm/translations/ko.json.mjs +83 -56
- package/lib/esm/translations/nl.json.mjs +83 -56
- package/lib/esm/translations/pl.json.mjs +83 -56
- package/lib/esm/translations/pt.json.mjs +83 -56
- package/lib/esm/translations/ru.json.mjs +35 -24
- package/lib/esm/translations/sv.json.mjs +83 -56
- package/lib/esm/translations/tr.json.mjs +83 -56
- package/lib/esm/translations/vi.json.mjs +83 -56
- package/lib/esm/translations/zh.json.mjs +83 -56
- package/lib/esm/utils/cronTabScheduler.mjs +58 -52
- package/lib/esm/utils/datesIntersects.mjs +15 -11
- package/lib/esm/utils/formatDate.mjs +25 -18
- package/lib/esm/utils/includesDate.mjs +13 -9
- package/lib/esm/utils/shortDateRangeFormat.mjs +53 -31
- package/package.json +15 -15
|
@@ -1,213 +1,230 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { Popper
|
|
13
|
-
import { CalendarDays
|
|
14
|
-
import { Flex
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _get from "@babel/runtime/helpers/esm/get";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
10
|
+
import createComponent, { sstyled, assignProps } from "@semcore/core";
|
|
11
|
+
import React from "react";
|
|
12
|
+
import { Popper, Header, Title, Prev, Next, Period } from "./components/index.mjs";
|
|
13
|
+
import { CalendarDays } from "./components/Calendar.mjs";
|
|
14
|
+
import { Flex, Box } from "@semcore/flex-box";
|
|
15
|
+
import Divider from "@semcore/divider";
|
|
16
|
+
import DateRangeComparatorAbstract, { Header as Header$1, Apply, Reset, Trigger, CompareToggle, Body, Footer } from "./components/DateRangeComparatorAbstract.mjs";
|
|
17
|
+
import InputTrigger from "./components/InputTrigger.mjs";
|
|
18
|
+
function RangeInput(props) {
|
|
19
|
+
var _ref = arguments[0], _ref2;
|
|
20
|
+
var styles = props.styles;
|
|
21
|
+
var SComparatorRangeInput = Box;
|
|
22
|
+
var SRangeIndicator = Box;
|
|
23
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SComparatorRangeInput, _ref2.cn("SComparatorRangeInput", _objectSpread({}, assignProps({
|
|
21
24
|
"data-name": "SComparatorRangeInput",
|
|
22
|
-
tag:
|
|
23
|
-
unit: "date",
|
|
24
|
-
__excludeProps: ["role", "aria-haspopup", "aria-expanded", "onChange", "value", "id"]
|
|
25
|
-
},
|
|
26
|
-
range:
|
|
27
|
-
disabled:
|
|
28
|
-
w: 12,
|
|
29
|
-
h: 12,
|
|
30
|
-
ml: 2
|
|
31
|
-
})), /* @__PURE__ */
|
|
25
|
+
"tag": InputTrigger,
|
|
26
|
+
"unit": "date",
|
|
27
|
+
"__excludeProps": ["role", "aria-haspopup", "aria-expanded", "onChange", "value", "id"]
|
|
28
|
+
}, _ref))), /* @__PURE__ */ React.createElement(InputTrigger.DateRange, null, /* @__PURE__ */ React.createElement(SRangeIndicator, _ref2.cn("SRangeIndicator", {
|
|
29
|
+
"range": props.range,
|
|
30
|
+
"disabled": props.disabled,
|
|
31
|
+
"w": 12,
|
|
32
|
+
"h": 12,
|
|
33
|
+
"ml": 2
|
|
34
|
+
})), /* @__PURE__ */ React.createElement(InputTrigger.DateRange.Indicator, null), /* @__PURE__ */ React.createElement(InputTrigger.DateRange.FromMaskedInput, null), /* @__PURE__ */ React.createElement(InputTrigger.DateRange.RangeSep, null), /* @__PURE__ */ React.createElement(InputTrigger.DateRange.ToMaskedInput, null)));
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
for (var
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
RangeInput.Indicator = InputTrigger.Indicator;
|
|
37
|
+
RangeInput.MaskedInput = InputTrigger.MaskedInput;
|
|
38
|
+
RangeInput.Addon = InputTrigger.Addon;
|
|
39
|
+
RangeInput.SingleDateInput = InputTrigger.SingleDateInput;
|
|
40
|
+
RangeInput.DateRange = InputTrigger.DateRange;
|
|
41
|
+
RangeInput.DateRangeFromInput = InputTrigger.DateRangeFromInput;
|
|
42
|
+
RangeInput.DateRangeToInput = InputTrigger.DateRangeToInput;
|
|
43
|
+
var DateRangeComparatorRoot = /* @__PURE__ */ function(_RangeComparatorAbstr) {
|
|
44
|
+
_inherits(DateRangeComparatorRoot2, _RangeComparatorAbstr);
|
|
45
|
+
var _super = _createSuper(DateRangeComparatorRoot2);
|
|
46
|
+
function DateRangeComparatorRoot2() {
|
|
47
|
+
var _this;
|
|
48
|
+
_classCallCheck(this, DateRangeComparatorRoot2);
|
|
49
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
|
+
args[_key] = arguments[_key];
|
|
51
|
+
}
|
|
52
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "navigateStep", "month");
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "keyStep", "day");
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "keyDiff", {
|
|
49
56
|
ArrowLeft: -1,
|
|
50
57
|
ArrowUp: -7,
|
|
51
58
|
ArrowRight: 1,
|
|
52
59
|
ArrowDown: 7
|
|
53
|
-
})
|
|
60
|
+
});
|
|
61
|
+
return _this;
|
|
54
62
|
}
|
|
55
|
-
|
|
63
|
+
_createClass(DateRangeComparatorRoot2, [{
|
|
56
64
|
key: "getRangeInput",
|
|
57
|
-
value: function() {
|
|
58
|
-
return /* @__PURE__ */
|
|
65
|
+
value: function getRangeInput() {
|
|
66
|
+
return /* @__PURE__ */ React.createElement(DateRangeComparator.RangeInput.DateRange, null);
|
|
59
67
|
}
|
|
60
68
|
}, {
|
|
61
69
|
key: "getRangeCalendarProps",
|
|
62
|
-
value: function() {
|
|
70
|
+
value: function getRangeCalendarProps() {
|
|
63
71
|
return {
|
|
64
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Flex, {
|
|
65
73
|
direction: "column"
|
|
66
|
-
}, /* @__PURE__ */
|
|
67
|
-
tag:
|
|
68
|
-
}, /* @__PURE__ */
|
|
74
|
+
}, /* @__PURE__ */ React.createElement(DateRangeComparator.CalendarHeader, {
|
|
75
|
+
tag: Flex
|
|
76
|
+
}, /* @__PURE__ */ React.createElement(DateRangeComparator.Prev, null), /* @__PURE__ */ React.createElement(DateRangeComparator.Title, null)), /* @__PURE__ */ React.createElement(DateRangeComparator.Calendar, null)), /* @__PURE__ */ React.createElement(Flex, {
|
|
69
77
|
direction: "column"
|
|
70
|
-
}, /* @__PURE__ */
|
|
71
|
-
tag:
|
|
72
|
-
}, /* @__PURE__ */
|
|
78
|
+
}, /* @__PURE__ */ React.createElement(DateRangeComparator.CalendarHeader, {
|
|
79
|
+
tag: Flex
|
|
80
|
+
}, /* @__PURE__ */ React.createElement(DateRangeComparator.Title, null), /* @__PURE__ */ React.createElement(DateRangeComparator.Next, null)), /* @__PURE__ */ React.createElement(DateRangeComparator.Calendar, null)))
|
|
73
81
|
};
|
|
74
82
|
}
|
|
75
83
|
}, {
|
|
76
84
|
key: "getPopperProps",
|
|
77
|
-
value: function() {
|
|
78
|
-
return
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
showButtons:
|
|
85
|
+
value: function getPopperProps() {
|
|
86
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DateRangeComparatorRoot2.prototype), "getPopperProps", this).call(this)), {}, {
|
|
87
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DateRangeComparator.Header, null), /* @__PURE__ */ React.createElement(DateRangeComparator.Body, {
|
|
88
|
+
showButtons: true
|
|
81
89
|
}))
|
|
82
90
|
});
|
|
83
91
|
}
|
|
84
92
|
}, {
|
|
85
93
|
key: "getHeaderProps",
|
|
86
|
-
value: function() {
|
|
94
|
+
value: function getHeaderProps() {
|
|
87
95
|
return {
|
|
88
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DateRangeComparator.ValueDateRange, null), /* @__PURE__ */ React.createElement(DateRangeComparator.CompareToggle, null), /* @__PURE__ */ React.createElement(DateRangeComparator.CompareDateRange, null))
|
|
89
97
|
};
|
|
90
98
|
}
|
|
91
99
|
}, {
|
|
92
100
|
key: "getBodyProps",
|
|
93
|
-
value: function(
|
|
94
|
-
var
|
|
101
|
+
value: function getBodyProps(_ref11) {
|
|
102
|
+
var showButtons = _ref11.showButtons;
|
|
95
103
|
return {
|
|
96
|
-
children: /* @__PURE__ */
|
|
97
|
-
showButtons
|
|
104
|
+
children: /* @__PURE__ */ React.createElement(Flex, null, /* @__PURE__ */ React.createElement(DateRangeComparator.RangeCalendar, null), /* @__PURE__ */ React.createElement(DateRangeComparator.Periods, {
|
|
105
|
+
showButtons
|
|
98
106
|
}))
|
|
99
107
|
};
|
|
100
108
|
}
|
|
101
109
|
}, {
|
|
102
110
|
key: "getPeriodsProps",
|
|
103
|
-
value: function(
|
|
104
|
-
var
|
|
111
|
+
value: function getPeriodsProps(_ref12) {
|
|
112
|
+
var showButtons = _ref12.showButtons, _ref12$unclearable = _ref12.unclearable, unclearable = _ref12$unclearable === void 0 ? false : _ref12$unclearable;
|
|
105
113
|
return {
|
|
106
|
-
children: /* @__PURE__ */
|
|
114
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DateRangeComparator.Periods.Divider, null), /* @__PURE__ */ React.createElement(DateRangeComparator.Periods.Column, null, /* @__PURE__ */ React.createElement(DateRangeComparator.Periods.Options, null), showButtons && /* @__PURE__ */ React.createElement(DateRangeComparator.Periods.Controls, null, /* @__PURE__ */ React.createElement(DateRangeComparator.Apply, null), !unclearable && /* @__PURE__ */ React.createElement(DateRangeComparator.Reset, null))))
|
|
107
115
|
};
|
|
108
116
|
}
|
|
109
117
|
}, {
|
|
110
118
|
key: "getFooterProps",
|
|
111
|
-
value: function(
|
|
112
|
-
var
|
|
119
|
+
value: function getFooterProps(_ref13) {
|
|
120
|
+
var _ref13$unclearable = _ref13.unclearable, unclearable = _ref13$unclearable === void 0 ? false : _ref13$unclearable;
|
|
113
121
|
return {
|
|
114
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DateRangeComparator.Apply, null), !unclearable && /* @__PURE__ */ React.createElement(DateRangeComparator.Reset, null))
|
|
115
123
|
};
|
|
116
124
|
}
|
|
117
|
-
}])
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
}]);
|
|
126
|
+
return DateRangeComparatorRoot2;
|
|
127
|
+
}(DateRangeComparatorAbstract);
|
|
128
|
+
_defineProperty(DateRangeComparatorRoot, "displayName", "DateRangeComparator");
|
|
129
|
+
_defineProperty(DateRangeComparatorRoot, "defaultProps", function(props) {
|
|
130
|
+
return _objectSpread(_objectSpread({}, DateRangeComparatorAbstract.defaultProps(props)), {}, {
|
|
131
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DateRangeComparator.Trigger, null), /* @__PURE__ */ React.createElement(DateRangeComparator.Popper, null))
|
|
123
132
|
});
|
|
124
133
|
});
|
|
125
|
-
function
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
function ValueDateRange(props) {
|
|
135
|
+
var _ref3;
|
|
136
|
+
var SValueDateRange = props.Root, styles = props.styles;
|
|
137
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SValueDateRange, _ref3.cn("SValueDateRange", {
|
|
138
|
+
"render": DateRangeComparator.RangeInput,
|
|
139
|
+
"range": "value"
|
|
130
140
|
}));
|
|
131
141
|
}
|
|
132
|
-
function
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
function CompareDateRange(props) {
|
|
143
|
+
var _ref4;
|
|
144
|
+
var SSecondaryDateRange = props.Root, styles = props.styles;
|
|
145
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SSecondaryDateRange, _ref4.cn("SSecondaryDateRange", {
|
|
146
|
+
"render": DateRangeComparator.RangeInput,
|
|
147
|
+
"range": "compare"
|
|
137
148
|
}));
|
|
138
149
|
}
|
|
139
|
-
function
|
|
140
|
-
var
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
150
|
+
function RangeCalendar(props) {
|
|
151
|
+
var _ref5;
|
|
152
|
+
var SRangeCalendar = props.Root, Children = props.Children, styles = props.styles;
|
|
153
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SRangeCalendar, _ref5.cn("SRangeCalendar", {
|
|
154
|
+
"render": Flex,
|
|
155
|
+
"gap": 8
|
|
156
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref5.cn("Children", {})));
|
|
145
157
|
}
|
|
146
|
-
function
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
158
|
+
function Periods(props) {
|
|
159
|
+
var _ref6;
|
|
160
|
+
var SPeriods = props.Root, styles = props.styles;
|
|
161
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriods, _ref6.cn("SPeriods", {
|
|
162
|
+
"render": Flex
|
|
150
163
|
}));
|
|
151
164
|
}
|
|
152
|
-
function
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
function PeriodsDivider(props) {
|
|
166
|
+
var _ref7;
|
|
167
|
+
var SPeriodsDivider = props.Root, styles = props.styles;
|
|
168
|
+
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriodsDivider, _ref7.cn("SPeriodsDivider", {
|
|
169
|
+
"orientation": "vertical",
|
|
170
|
+
"h": "auto",
|
|
171
|
+
"render": Divider
|
|
158
172
|
}));
|
|
159
173
|
}
|
|
160
|
-
function
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
174
|
+
function PeriodsColumn(props) {
|
|
175
|
+
var _ref8;
|
|
176
|
+
var SPeriodsColumn = props.Root, styles = props.styles;
|
|
177
|
+
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriodsColumn, _ref8.cn("SPeriodsColumn", {
|
|
178
|
+
"render": Flex,
|
|
179
|
+
"direction": "column",
|
|
180
|
+
"justifyContent": "space-between"
|
|
166
181
|
}));
|
|
167
182
|
}
|
|
168
|
-
function
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
183
|
+
function PeriodsOptions(props) {
|
|
184
|
+
var _ref9;
|
|
185
|
+
var styles = props.styles, SPeriodsOptions = props.Root;
|
|
186
|
+
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriodsOptions, _ref9.cn("SPeriodsOptions", {
|
|
187
|
+
"render": DateRangeComparator.Period,
|
|
188
|
+
"p": 2
|
|
173
189
|
}));
|
|
174
190
|
}
|
|
175
|
-
function
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
191
|
+
function PeriodsControls(props) {
|
|
192
|
+
var _ref10;
|
|
193
|
+
var styles = props.styles, SPeriodsControls = props.Root;
|
|
194
|
+
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriodsControls, _ref10.cn("SPeriodsControls", {
|
|
195
|
+
"render": Flex,
|
|
196
|
+
"p": 4,
|
|
197
|
+
"gap": 2
|
|
181
198
|
}));
|
|
182
199
|
}
|
|
183
|
-
var
|
|
184
|
-
Popper
|
|
185
|
-
CalendarHeader:
|
|
186
|
-
Title
|
|
187
|
-
Header:
|
|
188
|
-
Prev
|
|
189
|
-
Next
|
|
190
|
-
Calendar:
|
|
191
|
-
Period
|
|
192
|
-
Apply
|
|
193
|
-
Reset
|
|
194
|
-
Trigger
|
|
195
|
-
ValueDateRange
|
|
196
|
-
CompareToggle
|
|
197
|
-
CompareDateRange
|
|
198
|
-
Body
|
|
199
|
-
RangeCalendar
|
|
200
|
-
Periods: [
|
|
201
|
-
Divider:
|
|
202
|
-
Column:
|
|
203
|
-
Options:
|
|
204
|
-
Controls:
|
|
200
|
+
var DateRangeComparator = createComponent(DateRangeComparatorRoot, {
|
|
201
|
+
Popper,
|
|
202
|
+
CalendarHeader: Header,
|
|
203
|
+
Title,
|
|
204
|
+
Header: Header$1,
|
|
205
|
+
Prev,
|
|
206
|
+
Next,
|
|
207
|
+
Calendar: CalendarDays,
|
|
208
|
+
Period,
|
|
209
|
+
Apply,
|
|
210
|
+
Reset,
|
|
211
|
+
Trigger,
|
|
212
|
+
ValueDateRange,
|
|
213
|
+
CompareToggle,
|
|
214
|
+
CompareDateRange,
|
|
215
|
+
Body,
|
|
216
|
+
RangeCalendar,
|
|
217
|
+
Periods: [Periods, {
|
|
218
|
+
Divider: PeriodsDivider,
|
|
219
|
+
Column: PeriodsColumn,
|
|
220
|
+
Options: PeriodsOptions,
|
|
221
|
+
Controls: PeriodsControls
|
|
205
222
|
}],
|
|
206
|
-
Footer
|
|
207
|
-
RangeInput
|
|
223
|
+
Footer,
|
|
224
|
+
RangeInput
|
|
208
225
|
}, {
|
|
209
|
-
parent:
|
|
226
|
+
parent: CalendarDays
|
|
210
227
|
});
|
|
211
228
|
export {
|
|
212
|
-
|
|
229
|
+
DateRangeComparator as default
|
|
213
230
|
};
|
|
@@ -1,63 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { InputTrigger
|
|
15
|
-
import { CalendarDays
|
|
16
|
-
import
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
for (var
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _get from "@babel/runtime/helpers/esm/get";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import dayjs from "dayjs";
|
|
12
|
+
import createComponent from "@semcore/core";
|
|
13
|
+
import shortDateRangeFormat from "./utils/shortDateRangeFormat.mjs";
|
|
14
|
+
import { InputTrigger, Trigger, Popper, Header, Title, Prev, Next, Period } from "./components/index.mjs";
|
|
15
|
+
import { CalendarDays } from "./components/Calendar.mjs";
|
|
16
|
+
import RangePickerAbstract, { Apply, Reset } from "./components/RangePickerAbstract.mjs";
|
|
17
|
+
var DateRangePickerRoot = /* @__PURE__ */ function(_RangePickerAbstract) {
|
|
18
|
+
_inherits(DateRangePickerRoot2, _RangePickerAbstract);
|
|
19
|
+
var _super = _createSuper(DateRangePickerRoot2);
|
|
20
|
+
function DateRangePickerRoot2() {
|
|
21
|
+
var _this;
|
|
22
|
+
_classCallCheck(this, DateRangePickerRoot2);
|
|
23
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
+
args[_key] = arguments[_key];
|
|
25
|
+
}
|
|
26
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
27
|
+
_defineProperty(_assertThisInitialized(_this), "navigateStep", "month");
|
|
28
|
+
_defineProperty(_assertThisInitialized(_this), "keyStep", "day");
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "keyDiff", {
|
|
26
30
|
ArrowLeft: -1,
|
|
27
31
|
ArrowUp: -7,
|
|
28
32
|
ArrowRight: 1,
|
|
29
33
|
ArrowDown: 7
|
|
30
|
-
})
|
|
34
|
+
});
|
|
35
|
+
return _this;
|
|
31
36
|
}
|
|
32
|
-
|
|
37
|
+
_createClass(DateRangePickerRoot2, [{
|
|
33
38
|
key: "getDefaultPeriods",
|
|
34
|
-
value: function() {
|
|
35
|
-
var
|
|
39
|
+
value: function getDefaultPeriods() {
|
|
40
|
+
var getI18nText = this.asProps.getI18nText;
|
|
41
|
+
var today = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
|
|
36
42
|
return [{
|
|
37
|
-
children:
|
|
38
|
-
value: [
|
|
43
|
+
children: getI18nText("last2Days"),
|
|
44
|
+
value: [dayjs(today).subtract(1, "day").toDate(), today]
|
|
39
45
|
}, {
|
|
40
|
-
children:
|
|
41
|
-
value: [
|
|
46
|
+
children: getI18nText("lastWeek"),
|
|
47
|
+
value: [dayjs(today).subtract(6, "day").toDate(), today]
|
|
42
48
|
}, {
|
|
43
|
-
children:
|
|
44
|
-
value: [
|
|
49
|
+
children: getI18nText("last2Weeks"),
|
|
50
|
+
value: [dayjs(today).subtract(13, "day").toDate(), today]
|
|
45
51
|
}, {
|
|
46
|
-
children:
|
|
47
|
-
value: [
|
|
52
|
+
children: getI18nText("lastMonth"),
|
|
53
|
+
value: [dayjs(today).subtract(1, "month").toDate(), today]
|
|
48
54
|
}, {
|
|
49
|
-
children:
|
|
50
|
-
value: [
|
|
55
|
+
children: getI18nText("last2Months"),
|
|
56
|
+
value: [dayjs(today).subtract(2, "month").toDate(), today]
|
|
51
57
|
}];
|
|
52
58
|
}
|
|
53
59
|
}, {
|
|
54
60
|
key: "getButtonTriggerProps",
|
|
55
|
-
value: function() {
|
|
56
|
-
var
|
|
57
|
-
return
|
|
61
|
+
value: function getButtonTriggerProps() {
|
|
62
|
+
var _this$asProps = this.asProps, value = _this$asProps.value, locale = _this$asProps.locale;
|
|
63
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DateRangePickerRoot2.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
58
64
|
placeholder: "Select date period",
|
|
59
|
-
children:
|
|
60
|
-
locale
|
|
65
|
+
children: shortDateRangeFormat(value, {
|
|
66
|
+
locale,
|
|
61
67
|
day: "numeric",
|
|
62
68
|
month: "short",
|
|
63
69
|
year: "numeric"
|
|
@@ -66,46 +72,48 @@ var c = /* @__PURE__ */ function(p) {
|
|
|
66
72
|
}
|
|
67
73
|
}, {
|
|
68
74
|
key: "getTriggerProps",
|
|
69
|
-
value: function() {
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
value: function getTriggerProps() {
|
|
76
|
+
var _this$asProps2 = this.asProps, visible = _this$asProps2.visible, preselectedValue = _this$asProps2.preselectedValue, onChange = _this$asProps2.onChange, onDisplayedPeriodChange = _this$asProps2.onDisplayedPeriodChange, locale = _this$asProps2.locale, disabled = _this$asProps2.disabled, disabledErrorText = _this$asProps2.disabledErrorText, getI18nText = _this$asProps2.getI18nText, animationsDisabled = _this$asProps2.animationsDisabled;
|
|
77
|
+
var value = visible ? [preselectedValue[0] || this.asProps.value[0], preselectedValue[1] || this.asProps.value[1]] : this.asProps.value;
|
|
78
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DateRangePickerRoot2.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
79
|
+
value,
|
|
80
|
+
onChange,
|
|
81
|
+
onDisplayedPeriodChange,
|
|
82
|
+
locale,
|
|
83
|
+
disabledDates: disabled,
|
|
84
|
+
disabledErrorText,
|
|
85
|
+
children: function children() {
|
|
86
|
+
return /* @__PURE__ */ React.createElement(InputTrigger.DateRange, null);
|
|
80
87
|
},
|
|
81
|
-
getI18nText
|
|
82
|
-
animationsDisabled
|
|
88
|
+
getI18nText,
|
|
89
|
+
animationsDisabled,
|
|
83
90
|
unit: this.keyStep
|
|
84
91
|
});
|
|
85
92
|
}
|
|
86
|
-
}])
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
}]);
|
|
94
|
+
return DateRangePickerRoot2;
|
|
95
|
+
}(RangePickerAbstract);
|
|
96
|
+
_defineProperty(DateRangePickerRoot, "displayName", "DateRangePicker");
|
|
97
|
+
_defineProperty(DateRangePickerRoot, "defaultProps", function(props) {
|
|
98
|
+
return _objectSpread(_objectSpread({}, RangePickerAbstract.defaultProps(props)), {}, {
|
|
99
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DateRangePicker.Trigger, null), /* @__PURE__ */ React.createElement(DateRangePicker.Popper, null))
|
|
92
100
|
});
|
|
93
101
|
});
|
|
94
|
-
var
|
|
95
|
-
Trigger:
|
|
96
|
-
ButtonTrigger:
|
|
97
|
-
Popper
|
|
98
|
-
Header
|
|
99
|
-
Title
|
|
100
|
-
Prev
|
|
101
|
-
Next
|
|
102
|
-
Calendar:
|
|
103
|
-
Period
|
|
104
|
-
Apply
|
|
105
|
-
Reset
|
|
102
|
+
var DateRangePicker = createComponent(DateRangePickerRoot, {
|
|
103
|
+
Trigger: InputTrigger,
|
|
104
|
+
ButtonTrigger: Trigger,
|
|
105
|
+
Popper,
|
|
106
|
+
Header,
|
|
107
|
+
Title,
|
|
108
|
+
Prev,
|
|
109
|
+
Next,
|
|
110
|
+
Calendar: CalendarDays,
|
|
111
|
+
Period,
|
|
112
|
+
Apply,
|
|
113
|
+
Reset
|
|
106
114
|
}, {
|
|
107
|
-
parent:
|
|
115
|
+
parent: CalendarDays
|
|
108
116
|
});
|
|
109
117
|
export {
|
|
110
|
-
|
|
118
|
+
DateRangePicker as default
|
|
111
119
|
};
|