@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,249 +1,267 @@
|
|
|
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 { CalendarMonths
|
|
14
|
-
import { Flex
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
var
|
|
20
|
-
day:
|
|
21
|
-
month:
|
|
22
|
-
year:
|
|
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 { CalendarMonths } from "./components/Calendar.mjs";
|
|
14
|
+
import { Flex, Box } from "@semcore/flex-box";
|
|
15
|
+
import dayjs from "dayjs";
|
|
16
|
+
import Divider from "@semcore/divider";
|
|
17
|
+
import DateRangeComparatorAbstract, { Header as Header$1, Apply, Reset, Trigger, CompareToggle, Body, Footer } from "./components/DateRangeComparatorAbstract.mjs";
|
|
18
|
+
import InputTrigger from "./components/InputTrigger.mjs";
|
|
19
|
+
var dateParts = {
|
|
20
|
+
day: false,
|
|
21
|
+
month: true,
|
|
22
|
+
year: true
|
|
23
23
|
};
|
|
24
|
-
function
|
|
25
|
-
var
|
|
26
|
-
|
|
24
|
+
function RangeInput(props) {
|
|
25
|
+
var _ref = arguments[0], _ref2;
|
|
26
|
+
var styles = props.styles;
|
|
27
|
+
var SComparatorRangeInput = Box;
|
|
28
|
+
var SRangeIndicator = Box;
|
|
29
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SComparatorRangeInput, _ref2.cn("SComparatorRangeInput", _objectSpread({}, assignProps({
|
|
27
30
|
"data-name": "SComparatorRangeInput",
|
|
28
|
-
tag:
|
|
29
|
-
parts:
|
|
30
|
-
unit: "month",
|
|
31
|
-
__excludeProps: ["role", "aria-haspopup", "aria-expanded", "onChange", "value", "id"]
|
|
32
|
-
},
|
|
33
|
-
range:
|
|
34
|
-
disabled:
|
|
35
|
-
w: 12,
|
|
36
|
-
h: 12,
|
|
37
|
-
ml: 2
|
|
38
|
-
})), /* @__PURE__ */
|
|
31
|
+
"tag": InputTrigger,
|
|
32
|
+
"parts": dateParts,
|
|
33
|
+
"unit": "month",
|
|
34
|
+
"__excludeProps": ["role", "aria-haspopup", "aria-expanded", "onChange", "value", "id"]
|
|
35
|
+
}, _ref))), /* @__PURE__ */ React.createElement(InputTrigger.DateRange, null, /* @__PURE__ */ React.createElement(SRangeIndicator, _ref2.cn("SRangeIndicator", {
|
|
36
|
+
"range": props.range,
|
|
37
|
+
"disabled": props.disabled,
|
|
38
|
+
"w": 12,
|
|
39
|
+
"h": 12,
|
|
40
|
+
"ml": 2
|
|
41
|
+
})), /* @__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)));
|
|
39
42
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
function
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
for (var
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
RangeInput.Indicator = InputTrigger.Indicator;
|
|
44
|
+
RangeInput.MaskedInput = InputTrigger.MaskedInput;
|
|
45
|
+
RangeInput.Addon = InputTrigger.Addon;
|
|
46
|
+
RangeInput.SingleDateInput = InputTrigger.SingleDateInput;
|
|
47
|
+
RangeInput.DateRange = InputTrigger.DateRange;
|
|
48
|
+
RangeInput.DateRangeFromInput = InputTrigger.DateRangeFromInput;
|
|
49
|
+
RangeInput.DateRangeToInput = InputTrigger.DateRangeToInput;
|
|
50
|
+
var MonthDateRangeComparatorRoot = /* @__PURE__ */ function(_RangeComparatorAbstr) {
|
|
51
|
+
_inherits(MonthDateRangeComparatorRoot2, _RangeComparatorAbstr);
|
|
52
|
+
var _super = _createSuper(MonthDateRangeComparatorRoot2);
|
|
53
|
+
function MonthDateRangeComparatorRoot2() {
|
|
54
|
+
var _this;
|
|
55
|
+
_classCallCheck(this, MonthDateRangeComparatorRoot2);
|
|
56
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
|
+
args[_key] = arguments[_key];
|
|
58
|
+
}
|
|
59
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
60
|
+
_defineProperty(_assertThisInitialized(_this), "navigateStep", "year");
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "keyStep", "month");
|
|
62
|
+
_defineProperty(_assertThisInitialized(_this), "keyDiff", {
|
|
56
63
|
ArrowLeft: -1,
|
|
57
64
|
ArrowUp: -3,
|
|
58
65
|
ArrowRight: 1,
|
|
59
66
|
ArrowDown: 3
|
|
60
|
-
})
|
|
67
|
+
});
|
|
68
|
+
_defineProperty(_assertThisInitialized(_this), "triggerFormattingProps", {
|
|
61
69
|
month: "short",
|
|
62
70
|
year: "numeric"
|
|
63
|
-
})
|
|
71
|
+
});
|
|
72
|
+
return _this;
|
|
64
73
|
}
|
|
65
|
-
|
|
74
|
+
_createClass(MonthDateRangeComparatorRoot2, [{
|
|
66
75
|
key: "getTitleProps",
|
|
67
|
-
value: function(
|
|
68
|
-
var
|
|
69
|
-
return
|
|
70
|
-
children: new Intl.DateTimeFormat(
|
|
76
|
+
value: function getTitleProps(props, index) {
|
|
77
|
+
var _this$asProps = this.asProps, displayedPeriod = _this$asProps.displayedPeriod, locale = _this$asProps.locale;
|
|
78
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MonthDateRangeComparatorRoot2.prototype), "getTitleProps", this).call(this, props, index)), {}, {
|
|
79
|
+
children: new Intl.DateTimeFormat(locale, {
|
|
71
80
|
year: "numeric"
|
|
72
|
-
}).format(
|
|
81
|
+
}).format(dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate())
|
|
73
82
|
});
|
|
74
83
|
}
|
|
75
84
|
}, {
|
|
76
85
|
key: "getRangeInput",
|
|
77
|
-
value: function() {
|
|
78
|
-
return /* @__PURE__ */
|
|
86
|
+
value: function getRangeInput() {
|
|
87
|
+
return /* @__PURE__ */ React.createElement(MonthDateRangeComparator.RangeInput.DateRange, null);
|
|
79
88
|
}
|
|
80
89
|
}, {
|
|
81
90
|
key: "getRangeCalendarProps",
|
|
82
|
-
value: function() {
|
|
91
|
+
value: function getRangeCalendarProps() {
|
|
83
92
|
return {
|
|
84
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Flex, {
|
|
85
94
|
direction: "column"
|
|
86
|
-
}, /* @__PURE__ */
|
|
87
|
-
tag:
|
|
88
|
-
}, /* @__PURE__ */
|
|
95
|
+
}, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.CalendarHeader, {
|
|
96
|
+
tag: Flex
|
|
97
|
+
}, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Prev, null), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Title, null)), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Calendar, null)), /* @__PURE__ */ React.createElement(Flex, {
|
|
89
98
|
direction: "column"
|
|
90
|
-
}, /* @__PURE__ */
|
|
91
|
-
tag:
|
|
92
|
-
}, /* @__PURE__ */
|
|
99
|
+
}, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.CalendarHeader, {
|
|
100
|
+
tag: Flex
|
|
101
|
+
}, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Title, null), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Next, null)), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Calendar, null)))
|
|
93
102
|
};
|
|
94
103
|
}
|
|
95
104
|
}, {
|
|
96
105
|
key: "getValueDateRangeProps",
|
|
97
|
-
value: function() {
|
|
98
|
-
var
|
|
99
|
-
return
|
|
100
|
-
w:
|
|
106
|
+
value: function getValueDateRangeProps() {
|
|
107
|
+
var props = _get(_getPrototypeOf(MonthDateRangeComparatorRoot2.prototype), "getValueDateRangeProps", this).call(this);
|
|
108
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
109
|
+
w: props.w - 60
|
|
101
110
|
});
|
|
102
111
|
}
|
|
103
112
|
}, {
|
|
104
113
|
key: "getCompareDateRangeProps",
|
|
105
|
-
value: function() {
|
|
106
|
-
var
|
|
107
|
-
return
|
|
108
|
-
w:
|
|
114
|
+
value: function getCompareDateRangeProps() {
|
|
115
|
+
var props = _get(_getPrototypeOf(MonthDateRangeComparatorRoot2.prototype), "getCompareDateRangeProps", this).call(this);
|
|
116
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
117
|
+
w: props.w - 60
|
|
109
118
|
});
|
|
110
119
|
}
|
|
111
120
|
}, {
|
|
112
121
|
key: "getPopperProps",
|
|
113
|
-
value: function() {
|
|
114
|
-
return
|
|
115
|
-
children: /* @__PURE__ */
|
|
116
|
-
showButtons:
|
|
122
|
+
value: function getPopperProps() {
|
|
123
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MonthDateRangeComparatorRoot2.prototype), "getPopperProps", this).call(this)), {}, {
|
|
124
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Header, null), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Body, {
|
|
125
|
+
showButtons: true
|
|
117
126
|
}))
|
|
118
127
|
});
|
|
119
128
|
}
|
|
120
129
|
}, {
|
|
121
130
|
key: "getHeaderProps",
|
|
122
|
-
value: function() {
|
|
131
|
+
value: function getHeaderProps() {
|
|
123
132
|
return {
|
|
124
|
-
children: /* @__PURE__ */
|
|
133
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.ValueDateRange, null), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.CompareToggle, null), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.CompareDateRange, null))
|
|
125
134
|
};
|
|
126
135
|
}
|
|
127
136
|
}, {
|
|
128
137
|
key: "getBodyProps",
|
|
129
|
-
value: function(
|
|
130
|
-
var
|
|
138
|
+
value: function getBodyProps(_ref11) {
|
|
139
|
+
var showButtons = _ref11.showButtons;
|
|
131
140
|
return {
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
-
showButtons
|
|
141
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.RangeCalendar, null), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Periods, {
|
|
142
|
+
showButtons
|
|
134
143
|
}))
|
|
135
144
|
};
|
|
136
145
|
}
|
|
137
146
|
}, {
|
|
138
147
|
key: "getPeriodsProps",
|
|
139
|
-
value: function(
|
|
140
|
-
var
|
|
148
|
+
value: function getPeriodsProps(_ref12) {
|
|
149
|
+
var showButtons = _ref12.showButtons, _ref12$unclearable = _ref12.unclearable, unclearable = _ref12$unclearable === void 0 ? false : _ref12$unclearable;
|
|
141
150
|
return {
|
|
142
|
-
children: /* @__PURE__ */
|
|
151
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Periods.Divider, null), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Periods.Column, null, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Periods.Options, null), showButtons && /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Periods.Controls, null, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Apply, null), !unclearable && /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Reset, null))))
|
|
143
152
|
};
|
|
144
153
|
}
|
|
145
154
|
}, {
|
|
146
155
|
key: "getFooterProps",
|
|
147
|
-
value: function(
|
|
148
|
-
var
|
|
156
|
+
value: function getFooterProps(_ref13) {
|
|
157
|
+
var _ref13$unclearable = _ref13.unclearable, unclearable = _ref13$unclearable === void 0 ? false : _ref13$unclearable;
|
|
149
158
|
return {
|
|
150
|
-
children: /* @__PURE__ */
|
|
159
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Apply, null), !unclearable && /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Reset, null))
|
|
151
160
|
};
|
|
152
161
|
}
|
|
153
|
-
}])
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
162
|
+
}]);
|
|
163
|
+
return MonthDateRangeComparatorRoot2;
|
|
164
|
+
}(DateRangeComparatorAbstract);
|
|
165
|
+
_defineProperty(MonthDateRangeComparatorRoot, "displayName", "MonthDateRangeComparator");
|
|
166
|
+
_defineProperty(MonthDateRangeComparatorRoot, "defaultProps", function(props) {
|
|
167
|
+
return _objectSpread(_objectSpread({}, DateRangeComparatorAbstract.defaultProps(props)), {}, {
|
|
168
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Trigger, null), /* @__PURE__ */ React.createElement(MonthDateRangeComparator.Popper, null))
|
|
159
169
|
});
|
|
160
170
|
});
|
|
161
|
-
function
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
function ValueDateRange(props) {
|
|
172
|
+
var _ref3;
|
|
173
|
+
var SValueDateRange = props.Root, styles = props.styles;
|
|
174
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SValueDateRange, _ref3.cn("SValueDateRange", {
|
|
175
|
+
"render": MonthDateRangeComparator.RangeInput,
|
|
176
|
+
"range": "value"
|
|
166
177
|
}));
|
|
167
178
|
}
|
|
168
|
-
function
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
function CompareDateRange(props) {
|
|
180
|
+
var _ref4;
|
|
181
|
+
var SCompareDateRange = props.Root, styles = props.styles;
|
|
182
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SCompareDateRange, _ref4.cn("SCompareDateRange", {
|
|
183
|
+
"render": MonthDateRangeComparator.RangeInput,
|
|
184
|
+
"range": "compare"
|
|
173
185
|
}));
|
|
174
186
|
}
|
|
175
|
-
function
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
187
|
+
function RangeCalendar(props) {
|
|
188
|
+
var _ref5;
|
|
189
|
+
var SRangeCalendar = props.Root, Children = props.Children, styles = props.styles;
|
|
190
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SRangeCalendar, _ref5.cn("SRangeCalendar", {
|
|
191
|
+
"render": Flex,
|
|
192
|
+
"gap": 8
|
|
193
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref5.cn("Children", {})));
|
|
181
194
|
}
|
|
182
|
-
function
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
function Periods(props) {
|
|
196
|
+
var _ref6;
|
|
197
|
+
var SPeriods = props.Root, styles = props.styles;
|
|
198
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriods, _ref6.cn("SPeriods", {
|
|
199
|
+
"render": Flex
|
|
186
200
|
}));
|
|
187
201
|
}
|
|
188
|
-
function
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
202
|
+
function PeriodsDivider(props) {
|
|
203
|
+
var _ref7;
|
|
204
|
+
var SPeriodsDivider = props.Root, styles = props.styles;
|
|
205
|
+
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriodsDivider, _ref7.cn("SPeriodsDivider", {
|
|
206
|
+
"orientation": "vertical",
|
|
207
|
+
"h": "auto",
|
|
208
|
+
"render": Divider
|
|
194
209
|
}));
|
|
195
210
|
}
|
|
196
|
-
function
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
211
|
+
function PeriodsColumn(props) {
|
|
212
|
+
var _ref8;
|
|
213
|
+
var SPeriodsColumn = props.Root, styles = props.styles;
|
|
214
|
+
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriodsColumn, _ref8.cn("SPeriodsColumn", {
|
|
215
|
+
"render": Flex,
|
|
216
|
+
"direction": "column",
|
|
217
|
+
"justifyContent": "space-between",
|
|
218
|
+
"p": 1
|
|
203
219
|
}));
|
|
204
220
|
}
|
|
205
|
-
function
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
|
|
221
|
+
function PeriodsOptions(props) {
|
|
222
|
+
var _ref9;
|
|
223
|
+
var styles = props.styles, SPeriodsList = props.Root;
|
|
224
|
+
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriodsList, _ref9.cn("SPeriodsList", {
|
|
225
|
+
"render": MonthDateRangeComparator.Period
|
|
209
226
|
}));
|
|
210
227
|
}
|
|
211
|
-
function
|
|
212
|
-
var
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
228
|
+
function PeriodsControls(props) {
|
|
229
|
+
var _ref10;
|
|
230
|
+
var styles = props.styles, SPeriodsControls = props.Root;
|
|
231
|
+
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SPeriodsControls, _ref10.cn("SPeriodsControls", {
|
|
232
|
+
"render": Flex,
|
|
233
|
+
"p": 4,
|
|
234
|
+
"gap": 2
|
|
217
235
|
}));
|
|
218
236
|
}
|
|
219
|
-
var
|
|
220
|
-
Popper
|
|
221
|
-
CalendarHeader:
|
|
222
|
-
Title
|
|
223
|
-
Header:
|
|
224
|
-
Prev
|
|
225
|
-
Next
|
|
226
|
-
Calendar:
|
|
227
|
-
Period
|
|
228
|
-
Apply
|
|
229
|
-
Reset
|
|
230
|
-
Trigger
|
|
231
|
-
ValueDateRange
|
|
232
|
-
CompareToggle
|
|
233
|
-
CompareDateRange
|
|
234
|
-
Body
|
|
235
|
-
RangeCalendar
|
|
236
|
-
Periods: [
|
|
237
|
-
Divider:
|
|
238
|
-
Column:
|
|
239
|
-
Options:
|
|
240
|
-
Controls:
|
|
237
|
+
var MonthDateRangeComparator = createComponent(MonthDateRangeComparatorRoot, {
|
|
238
|
+
Popper,
|
|
239
|
+
CalendarHeader: Header,
|
|
240
|
+
Title,
|
|
241
|
+
Header: Header$1,
|
|
242
|
+
Prev,
|
|
243
|
+
Next,
|
|
244
|
+
Calendar: CalendarMonths,
|
|
245
|
+
Period,
|
|
246
|
+
Apply,
|
|
247
|
+
Reset,
|
|
248
|
+
Trigger,
|
|
249
|
+
ValueDateRange,
|
|
250
|
+
CompareToggle,
|
|
251
|
+
CompareDateRange,
|
|
252
|
+
Body,
|
|
253
|
+
RangeCalendar,
|
|
254
|
+
Periods: [Periods, {
|
|
255
|
+
Divider: PeriodsDivider,
|
|
256
|
+
Column: PeriodsColumn,
|
|
257
|
+
Options: PeriodsOptions,
|
|
258
|
+
Controls: PeriodsControls
|
|
241
259
|
}],
|
|
242
|
-
Footer
|
|
243
|
-
RangeInput
|
|
260
|
+
Footer,
|
|
261
|
+
RangeInput
|
|
244
262
|
}, {
|
|
245
|
-
parent:
|
|
263
|
+
parent: CalendarMonths
|
|
246
264
|
});
|
|
247
265
|
export {
|
|
248
|
-
|
|
266
|
+
MonthDateRangeComparator as default
|
|
249
267
|
};
|
package/lib/esm/MonthPicker.mjs
CHANGED
|
@@ -1,99 +1,106 @@
|
|
|
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 { InputTrigger
|
|
14
|
-
import { CalendarMonths
|
|
15
|
-
import
|
|
16
|
-
var
|
|
17
|
-
day:
|
|
18
|
-
month:
|
|
19
|
-
year:
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 { InputTrigger, Trigger, Popper, Header, Title, Prev, Next } from "./components/index.mjs";
|
|
14
|
+
import { CalendarMonths } from "./components/Calendar.mjs";
|
|
15
|
+
import PickerAbstract from "./components/PickerAbstract.mjs";
|
|
16
|
+
var dateParts = {
|
|
17
|
+
day: false,
|
|
18
|
+
month: true,
|
|
19
|
+
year: true
|
|
20
|
+
};
|
|
21
|
+
var MonthPickerRoot = /* @__PURE__ */ function(_PickerAbstract) {
|
|
22
|
+
_inherits(MonthPickerRoot2, _PickerAbstract);
|
|
23
|
+
var _super = _createSuper(MonthPickerRoot2);
|
|
24
|
+
function MonthPickerRoot2() {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, MonthPickerRoot2);
|
|
27
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
+
args[_key] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "navigateStep", "year");
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "keyStep", "month");
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "keyDiff", {
|
|
29
34
|
ArrowLeft: -1,
|
|
30
35
|
ArrowUp: -3,
|
|
31
36
|
ArrowRight: 1,
|
|
32
37
|
ArrowDown: 3
|
|
33
|
-
})
|
|
38
|
+
});
|
|
39
|
+
return _this;
|
|
34
40
|
}
|
|
35
|
-
|
|
41
|
+
_createClass(MonthPickerRoot2, [{
|
|
36
42
|
key: "getButtonTriggerProps",
|
|
37
|
-
value: function() {
|
|
38
|
-
var
|
|
39
|
-
return
|
|
43
|
+
value: function getButtonTriggerProps() {
|
|
44
|
+
var _this$asProps = this.asProps, value = _this$asProps.value, locale = _this$asProps.locale;
|
|
45
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MonthPickerRoot2.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
40
46
|
placeholder: "Select month",
|
|
41
|
-
children:
|
|
47
|
+
children: value ? new Intl.DateTimeFormat(locale, {
|
|
42
48
|
month: "short",
|
|
43
49
|
year: "numeric"
|
|
44
|
-
}).format(
|
|
50
|
+
}).format(dayjs(value).toDate()) : null
|
|
45
51
|
});
|
|
46
52
|
}
|
|
47
53
|
}, {
|
|
48
54
|
key: "getTriggerProps",
|
|
49
|
-
value: function() {
|
|
50
|
-
var
|
|
51
|
-
return
|
|
52
|
-
value
|
|
53
|
-
onChange
|
|
54
|
-
onDisplayedPeriodChange
|
|
55
|
-
locale
|
|
56
|
-
parts:
|
|
57
|
-
disabledDates:
|
|
58
|
-
disabledErrorText
|
|
59
|
-
children: function() {
|
|
60
|
-
return /* @__PURE__ */
|
|
55
|
+
value: function getTriggerProps() {
|
|
56
|
+
var _this$asProps2 = this.asProps, value = _this$asProps2.value, 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;
|
|
57
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MonthPickerRoot2.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
58
|
+
value,
|
|
59
|
+
onChange,
|
|
60
|
+
onDisplayedPeriodChange,
|
|
61
|
+
locale,
|
|
62
|
+
parts: dateParts,
|
|
63
|
+
disabledDates: disabled,
|
|
64
|
+
disabledErrorText,
|
|
65
|
+
children: function children() {
|
|
66
|
+
return /* @__PURE__ */ React.createElement(InputTrigger.SingleDateInput, null);
|
|
61
67
|
},
|
|
62
|
-
getI18nText
|
|
63
|
-
animationsDisabled
|
|
68
|
+
getI18nText,
|
|
69
|
+
animationsDisabled,
|
|
64
70
|
unit: this.keyStep
|
|
65
71
|
});
|
|
66
72
|
}
|
|
67
73
|
}, {
|
|
68
74
|
key: "getTitleProps",
|
|
69
|
-
value: function() {
|
|
70
|
-
var
|
|
71
|
-
return
|
|
72
|
-
children: new Intl.DateTimeFormat(
|
|
75
|
+
value: function getTitleProps() {
|
|
76
|
+
var _this$asProps3 = this.asProps, displayedPeriod = _this$asProps3.displayedPeriod, locale = _this$asProps3.locale;
|
|
77
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MonthPickerRoot2.prototype), "getTitleProps", this).call(this)), {}, {
|
|
78
|
+
children: new Intl.DateTimeFormat(locale, {
|
|
73
79
|
year: "numeric"
|
|
74
|
-
}).format(
|
|
80
|
+
}).format(dayjs(displayedPeriod).startOf("year").toDate())
|
|
75
81
|
});
|
|
76
82
|
}
|
|
77
|
-
}])
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
}]);
|
|
84
|
+
return MonthPickerRoot2;
|
|
85
|
+
}(PickerAbstract);
|
|
86
|
+
_defineProperty(MonthPickerRoot, "displayName", "MonthPicker");
|
|
87
|
+
_defineProperty(MonthPickerRoot, "defaultProps", function(props) {
|
|
88
|
+
return _objectSpread(_objectSpread({}, PickerAbstract.defaultProps(props)), {}, {
|
|
89
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MonthPicker.Trigger, null), /* @__PURE__ */ React.createElement(MonthPicker.Popper, null))
|
|
83
90
|
});
|
|
84
91
|
});
|
|
85
|
-
var
|
|
86
|
-
Trigger:
|
|
87
|
-
ButtonTrigger:
|
|
88
|
-
Popper
|
|
89
|
-
Header
|
|
90
|
-
Title
|
|
91
|
-
Prev
|
|
92
|
-
Next
|
|
93
|
-
Calendar:
|
|
92
|
+
var MonthPicker = createComponent(MonthPickerRoot, {
|
|
93
|
+
Trigger: InputTrigger,
|
|
94
|
+
ButtonTrigger: Trigger,
|
|
95
|
+
Popper,
|
|
96
|
+
Header,
|
|
97
|
+
Title,
|
|
98
|
+
Prev,
|
|
99
|
+
Next,
|
|
100
|
+
Calendar: CalendarMonths
|
|
94
101
|
}, {
|
|
95
|
-
parent:
|
|
102
|
+
parent: CalendarMonths
|
|
96
103
|
});
|
|
97
104
|
export {
|
|
98
|
-
|
|
105
|
+
MonthPicker as default
|
|
99
106
|
};
|