@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,64 +1,71 @@
|
|
|
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 { CalendarMonths
|
|
16
|
-
import
|
|
17
|
-
var
|
|
18
|
-
day:
|
|
19
|
-
month:
|
|
20
|
-
year:
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 { CalendarMonths } from "./components/Calendar.mjs";
|
|
16
|
+
import RangePickerAbstract, { Apply, Reset } from "./components/RangePickerAbstract.mjs";
|
|
17
|
+
var dateParts = {
|
|
18
|
+
day: false,
|
|
19
|
+
month: true,
|
|
20
|
+
year: true
|
|
21
|
+
};
|
|
22
|
+
var MonthRangePickerRoot = /* @__PURE__ */ function(_RangePickerAbstract) {
|
|
23
|
+
_inherits(MonthRangePickerRoot2, _RangePickerAbstract);
|
|
24
|
+
var _super = _createSuper(MonthRangePickerRoot2);
|
|
25
|
+
function MonthRangePickerRoot2() {
|
|
26
|
+
var _this;
|
|
27
|
+
_classCallCheck(this, MonthRangePickerRoot2);
|
|
28
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
+
args[_key] = arguments[_key];
|
|
30
|
+
}
|
|
31
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "navigateStep", "year");
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "keyStep", "month");
|
|
34
|
+
_defineProperty(_assertThisInitialized(_this), "keyDiff", {
|
|
30
35
|
ArrowLeft: -1,
|
|
31
36
|
ArrowUp: -3,
|
|
32
37
|
ArrowRight: 1,
|
|
33
38
|
ArrowDown: 3
|
|
34
|
-
})
|
|
39
|
+
});
|
|
40
|
+
return _this;
|
|
35
41
|
}
|
|
36
|
-
|
|
42
|
+
_createClass(MonthRangePickerRoot2, [{
|
|
37
43
|
key: "getDefaultPeriods",
|
|
38
|
-
value: function() {
|
|
39
|
-
var
|
|
44
|
+
value: function getDefaultPeriods() {
|
|
45
|
+
var getI18nText = this.asProps.getI18nText;
|
|
46
|
+
var today = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
|
|
40
47
|
return [{
|
|
41
|
-
children:
|
|
42
|
-
value: [
|
|
48
|
+
children: getI18nText("lastMonth"),
|
|
49
|
+
value: [dayjs(today).subtract(1, "month").startOf("month").toDate(), dayjs(today).startOf("month").toDate()]
|
|
43
50
|
}, {
|
|
44
|
-
children:
|
|
45
|
-
value: [
|
|
51
|
+
children: getI18nText("last3Months"),
|
|
52
|
+
value: [dayjs(today).subtract(2, "month").startOf("month").toDate(), dayjs(today).startOf("month").toDate()]
|
|
46
53
|
}, {
|
|
47
|
-
children:
|
|
48
|
-
value: [
|
|
54
|
+
children: getI18nText("last6Months"),
|
|
55
|
+
value: [dayjs(today).subtract(5, "month").startOf("month").toDate(), dayjs(today).startOf("month").toDate()]
|
|
49
56
|
}, {
|
|
50
|
-
children:
|
|
51
|
-
value: [
|
|
57
|
+
children: getI18nText("last12Months"),
|
|
58
|
+
value: [dayjs(today).subtract(11, "month").startOf("month").toDate(), dayjs(today).startOf("month").toDate()]
|
|
52
59
|
}];
|
|
53
60
|
}
|
|
54
61
|
}, {
|
|
55
62
|
key: "getButtonTriggerProps",
|
|
56
|
-
value: function() {
|
|
57
|
-
var
|
|
58
|
-
return
|
|
63
|
+
value: function getButtonTriggerProps() {
|
|
64
|
+
var _this$asProps = this.asProps, value = _this$asProps.value, locale = _this$asProps.locale;
|
|
65
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MonthRangePickerRoot2.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
59
66
|
placeholder: "Select month period",
|
|
60
|
-
children:
|
|
61
|
-
locale
|
|
67
|
+
children: shortDateRangeFormat(value, {
|
|
68
|
+
locale,
|
|
62
69
|
month: "short",
|
|
63
70
|
year: "numeric"
|
|
64
71
|
})
|
|
@@ -66,57 +73,59 @@ var z = {
|
|
|
66
73
|
}
|
|
67
74
|
}, {
|
|
68
75
|
key: "getTriggerProps",
|
|
69
|
-
value: function() {
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
value: function getTriggerProps() {
|
|
77
|
+
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;
|
|
78
|
+
var value = visible ? [preselectedValue[0] || this.asProps.value[0], preselectedValue[1] || this.asProps.value[1]] : this.asProps.value;
|
|
79
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MonthRangePickerRoot2.prototype), "getButtonTriggerProps", this).call(this)), {}, {
|
|
80
|
+
value,
|
|
81
|
+
onChange,
|
|
82
|
+
onDisplayedPeriodChange,
|
|
83
|
+
locale,
|
|
84
|
+
parts: dateParts,
|
|
85
|
+
disabledDates: disabled,
|
|
86
|
+
disabledErrorText,
|
|
87
|
+
children: function children() {
|
|
88
|
+
return /* @__PURE__ */ React.createElement(InputTrigger.DateRange, null);
|
|
81
89
|
},
|
|
82
|
-
getI18nText
|
|
83
|
-
animationsDisabled
|
|
90
|
+
getI18nText,
|
|
91
|
+
animationsDisabled,
|
|
84
92
|
unit: this.keyStep
|
|
85
93
|
});
|
|
86
94
|
}
|
|
87
95
|
}, {
|
|
88
96
|
key: "getTitleProps",
|
|
89
|
-
value: function(
|
|
90
|
-
var
|
|
91
|
-
return
|
|
92
|
-
children: new Intl.DateTimeFormat(
|
|
97
|
+
value: function getTitleProps(props, index) {
|
|
98
|
+
var _this$asProps3 = this.asProps, displayedPeriod = _this$asProps3.displayedPeriod, locale = _this$asProps3.locale;
|
|
99
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MonthRangePickerRoot2.prototype), "getTitleProps", this).call(this, props, index)), {}, {
|
|
100
|
+
children: new Intl.DateTimeFormat(locale, {
|
|
93
101
|
year: "numeric"
|
|
94
|
-
}).format(
|
|
102
|
+
}).format(dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate())
|
|
95
103
|
});
|
|
96
104
|
}
|
|
97
|
-
}])
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
}]);
|
|
106
|
+
return MonthRangePickerRoot2;
|
|
107
|
+
}(RangePickerAbstract);
|
|
108
|
+
_defineProperty(MonthRangePickerRoot, "displayName", "MonthRangePicker");
|
|
109
|
+
_defineProperty(MonthRangePickerRoot, "defaultProps", function(props) {
|
|
110
|
+
return _objectSpread(_objectSpread({}, RangePickerAbstract.defaultProps(props)), {}, {
|
|
111
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MonthRangePicker.Trigger, null), /* @__PURE__ */ React.createElement(MonthRangePicker.Popper, null))
|
|
103
112
|
});
|
|
104
113
|
});
|
|
105
|
-
var
|
|
106
|
-
Trigger:
|
|
107
|
-
ButtonTrigger:
|
|
108
|
-
Popper
|
|
109
|
-
Header
|
|
110
|
-
Title
|
|
111
|
-
Prev
|
|
112
|
-
Next
|
|
113
|
-
Calendar:
|
|
114
|
-
Period
|
|
115
|
-
Apply
|
|
116
|
-
Reset
|
|
114
|
+
var MonthRangePicker = createComponent(MonthRangePickerRoot, {
|
|
115
|
+
Trigger: InputTrigger,
|
|
116
|
+
ButtonTrigger: Trigger,
|
|
117
|
+
Popper,
|
|
118
|
+
Header,
|
|
119
|
+
Title,
|
|
120
|
+
Prev,
|
|
121
|
+
Next,
|
|
122
|
+
Calendar: CalendarMonths,
|
|
123
|
+
Period,
|
|
124
|
+
Apply,
|
|
125
|
+
Reset
|
|
117
126
|
}, {
|
|
118
|
-
parent:
|
|
127
|
+
parent: CalendarMonths
|
|
119
128
|
});
|
|
120
129
|
export {
|
|
121
|
-
|
|
130
|
+
MonthRangePicker as default
|
|
122
131
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import createComponent, { assignProps } from "@semcore/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import BaseTrigger from "@semcore/base-trigger";
|
|
4
|
+
import addonTextChildren from "@semcore/utils/lib/addonTextChildren";
|
|
5
|
+
import Calendar from "@semcore/icon/Calendar/m";
|
|
6
|
+
var ButtonTriggerRoot = function ButtonTriggerRoot2(_ref2) {
|
|
7
|
+
var _ref = arguments[0];
|
|
8
|
+
var Children = _ref2.Children;
|
|
9
|
+
return /* @__PURE__ */ React.createElement(BaseTrigger, assignProps({}, _ref), /* @__PURE__ */ React.createElement(ButtonTrigger.Addon, {
|
|
10
|
+
tag: Calendar
|
|
11
|
+
}), addonTextChildren(Children, ButtonTrigger.Text, ButtonTrigger.Addon, true));
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
Text:
|
|
15
|
-
Addon:
|
|
13
|
+
ButtonTriggerRoot.displayName = "ButtonTrigger";
|
|
14
|
+
var ButtonTrigger = createComponent(ButtonTriggerRoot, {
|
|
15
|
+
Text: BaseTrigger.Text,
|
|
16
|
+
Addon: BaseTrigger.Addon
|
|
16
17
|
});
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
+
ButtonTrigger as default
|
|
19
20
|
};
|