dash-core-components 4.0.0-rc2 → 4.0.0-rc4
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/dash_core_components/async-datepicker.js +1 -1
- package/dash_core_components/async-datepicker.js.map +1 -1
- package/dash_core_components/async-dropdown.js +1 -2
- package/dash_core_components/async-dropdown.js.map +1 -1
- package/dash_core_components/async-graph.js +1 -1
- package/dash_core_components/async-graph.js.map +1 -1
- package/dash_core_components/async-highlight.js +1 -1
- package/dash_core_components/async-highlight.js.map +1 -1
- package/dash_core_components/async-markdown.js +1 -1
- package/dash_core_components/async-markdown.js.map +1 -1
- package/dash_core_components/async-mathjax.js +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +1 -1
- package/dash_core_components/async-upload.js.map +1 -1
- package/dash_core_components/dash_core_components-shared.js +1 -1
- package/dash_core_components/dash_core_components-shared.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/dash_core_components/proptypes.js +153 -14
- package/lib/components/Button.tsx +48 -0
- package/lib/components/Clipboard.react.js +1 -1
- package/lib/components/DatePickerRange.tsx +70 -0
- package/lib/components/DatePickerSingle.tsx +72 -0
- package/lib/components/Input.tsx +12 -233
- package/lib/components/RadioItems.tsx +3 -1
- package/lib/components/Tab.tsx +19 -0
- package/lib/components/Tabs.tsx +311 -0
- package/lib/components/css/button.css +55 -0
- package/lib/components/css/calendar.css +66 -0
- package/lib/components/css/datepickers.css +239 -0
- package/lib/components/css/dcc.css +1 -0
- package/lib/components/css/dropdown.css +19 -6
- package/lib/components/css/input.css +9 -3
- package/lib/components/css/sliders.css +41 -1
- package/lib/components/css/tabs.css +113 -0
- package/lib/fragments/DatePickerRange.tsx +448 -0
- package/lib/fragments/DatePickerSingle.tsx +248 -0
- package/lib/fragments/Dropdown.tsx +44 -19
- package/lib/fragments/Graph.react.js +18 -45
- package/lib/fragments/RangeSlider.tsx +24 -66
- package/lib/index.ts +6 -6
- package/lib/types.ts +660 -28
- package/lib/utils/DatePickerPersistence.ts +14 -0
- package/lib/utils/LazyLoader/datePickerRange.ts +4 -0
- package/lib/utils/LazyLoader/datePickerSingle.ts +4 -0
- package/lib/utils/calendar/Calendar.tsx +382 -0
- package/lib/utils/calendar/CalendarDay.tsx +75 -0
- package/lib/utils/calendar/CalendarDayPadding.tsx +15 -0
- package/lib/utils/calendar/CalendarMonth.tsx +247 -0
- package/lib/utils/calendar/CalendarMonthHeader.tsx +23 -0
- package/lib/utils/calendar/createMonthGrid.ts +28 -0
- package/lib/utils/calendar/helpers.ts +272 -0
- package/lib/utils/computeSliderMarkers.ts +71 -116
- package/lib/utils/optionRendering.tsx +22 -15
- package/lib/utils/sliderRendering.tsx +40 -2
- package/package.json +16 -13
- package/lib/components/DatePickerRange.react.js +0 -244
- package/lib/components/DatePickerSingle.react.js +0 -209
- package/lib/components/Dropdown.react.js.old +0 -228
- package/lib/components/Tab.react.js +0 -80
- package/lib/components/Tab.react.js.old +0 -79
- package/lib/components/Tabs.react.js +0 -295
- package/lib/components/Textarea.react.js.old +0 -287
- package/lib/fragments/DatePickerRange.react.js +0 -188
- package/lib/fragments/DatePickerSingle.react.js +0 -132
- package/lib/utils/DatePickerPersistence.js +0 -18
- package/lib/utils/LazyLoader/datePickerRange.js +0 -8
- package/lib/utils/LazyLoader/datePickerSingle.js +0 -8
- package/lib/utils/convertToMoment.js +0 -30
- package/lib/utils/optionTypes.js +0 -39
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
require("react-dates/initialize");
|
|
8
|
-
var _reactDates = require("react-dates");
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _uniqid = _interopRequireDefault(require("uniqid"));
|
|
11
|
-
var _DatePickerRange = require("../components/DatePickerRange.react");
|
|
12
|
-
var _convertToMoment3 = _interopRequireDefault(require("../utils/convertToMoment"));
|
|
13
|
-
var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"));
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
-
class DatePickerRange extends _react.Component {
|
|
22
|
-
constructor(props) {
|
|
23
|
-
super(props);
|
|
24
|
-
this.propsToState = this.propsToState.bind(this);
|
|
25
|
-
this.onDatesChange = this.onDatesChange.bind(this);
|
|
26
|
-
this.isOutsideRange = this.isOutsideRange.bind(this);
|
|
27
|
-
this.state = {
|
|
28
|
-
focused: false,
|
|
29
|
-
start_date_id: props.start_date_id || (0, _uniqid.default)(),
|
|
30
|
-
end_date_id: props.end_date_id || (0, _uniqid.default)()
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
propsToState(newProps) {
|
|
34
|
-
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
35
|
-
var state = {};
|
|
36
|
-
if (force || newProps.start_date !== this.props.start_date) {
|
|
37
|
-
state.start_date = newProps.start_date;
|
|
38
|
-
}
|
|
39
|
-
if (force || newProps.end_date !== this.props.end_date) {
|
|
40
|
-
state.end_date = newProps.end_date;
|
|
41
|
-
}
|
|
42
|
-
if (force || newProps.max_date_allowed !== this.props.max_date_allowed) {
|
|
43
|
-
state.max_date_allowed = (0, _convertToMoment3.default)(newProps, ['max_date_allowed']).max_date_allowed;
|
|
44
|
-
}
|
|
45
|
-
if (force || newProps.min_date_allowed !== this.props.min_date_allowed) {
|
|
46
|
-
state.min_date_allowed = (0, _convertToMoment3.default)(newProps, ['min_date_allowed']).min_date_allowed;
|
|
47
|
-
}
|
|
48
|
-
if (force || newProps.disabled_days !== this.props.disabled_days) {
|
|
49
|
-
state.disabled_days = (0, _convertToMoment3.default)(newProps, ['disabled_days']).disabled_days;
|
|
50
|
-
}
|
|
51
|
-
if (Object.keys(state).length) {
|
|
52
|
-
this.setState(state);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
UNSAFE_componentWillReceiveProps(newProps) {
|
|
56
|
-
this.propsToState(newProps);
|
|
57
|
-
}
|
|
58
|
-
UNSAFE_componentWillMount() {
|
|
59
|
-
this.propsToState(this.props, true);
|
|
60
|
-
}
|
|
61
|
-
onDatesChange(_ref) {
|
|
62
|
-
var start_date = _ref.startDate,
|
|
63
|
-
end_date = _ref.endDate;
|
|
64
|
-
var _this$props = this.props,
|
|
65
|
-
setProps = _this$props.setProps,
|
|
66
|
-
updatemode = _this$props.updatemode,
|
|
67
|
-
clearable = _this$props.clearable;
|
|
68
|
-
var oldMomentDates = (0, _convertToMoment3.default)(this.state, ['start_date', 'end_date']);
|
|
69
|
-
if (start_date && !start_date.isSame(oldMomentDates.start_date)) {
|
|
70
|
-
if (updatemode === 'singledate') {
|
|
71
|
-
setProps({
|
|
72
|
-
start_date: start_date.format('YYYY-MM-DD')
|
|
73
|
-
});
|
|
74
|
-
} else {
|
|
75
|
-
this.setState({
|
|
76
|
-
start_date: start_date.format('YYYY-MM-DD')
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (end_date && !end_date.isSame(oldMomentDates.end_date)) {
|
|
81
|
-
if (updatemode === 'singledate') {
|
|
82
|
-
setProps({
|
|
83
|
-
end_date: end_date.format('YYYY-MM-DD')
|
|
84
|
-
});
|
|
85
|
-
} else if (updatemode === 'bothdates') {
|
|
86
|
-
setProps({
|
|
87
|
-
start_date: this.state.start_date,
|
|
88
|
-
end_date: end_date.format('YYYY-MM-DD')
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (clearable && !start_date && !end_date && (oldMomentDates.start_date !== start_date || oldMomentDates.end_date !== end_date)) {
|
|
93
|
-
setProps({
|
|
94
|
-
start_date: null,
|
|
95
|
-
end_date: null
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
isOutsideRange(date) {
|
|
100
|
-
return this.state.min_date_allowed && date.isBefore(this.state.min_date_allowed) || this.state.max_date_allowed && date.isAfter(this.state.max_date_allowed) || this.state.disabled_days && this.state.disabled_days.some(d => date.isSame(d, 'day'));
|
|
101
|
-
}
|
|
102
|
-
render() {
|
|
103
|
-
var focusedInput = this.state.focusedInput;
|
|
104
|
-
var _this$props2 = this.props,
|
|
105
|
-
calendar_orientation = _this$props2.calendar_orientation,
|
|
106
|
-
clearable = _this$props2.clearable,
|
|
107
|
-
day_size = _this$props2.day_size,
|
|
108
|
-
disabled = _this$props2.disabled,
|
|
109
|
-
display_format = _this$props2.display_format,
|
|
110
|
-
end_date_placeholder_text = _this$props2.end_date_placeholder_text,
|
|
111
|
-
first_day_of_week = _this$props2.first_day_of_week,
|
|
112
|
-
is_RTL = _this$props2.is_RTL,
|
|
113
|
-
minimum_nights = _this$props2.minimum_nights,
|
|
114
|
-
month_format = _this$props2.month_format,
|
|
115
|
-
number_of_months_shown = _this$props2.number_of_months_shown,
|
|
116
|
-
reopen_calendar_on_clear = _this$props2.reopen_calendar_on_clear,
|
|
117
|
-
show_outside_days = _this$props2.show_outside_days,
|
|
118
|
-
start_date_placeholder_text = _this$props2.start_date_placeholder_text,
|
|
119
|
-
stay_open_on_select = _this$props2.stay_open_on_select,
|
|
120
|
-
with_full_screen_portal = _this$props2.with_full_screen_portal,
|
|
121
|
-
with_portal = _this$props2.with_portal,
|
|
122
|
-
id = _this$props2.id,
|
|
123
|
-
style = _this$props2.style,
|
|
124
|
-
className = _this$props2.className,
|
|
125
|
-
start_date_id = _this$props2.start_date_id,
|
|
126
|
-
end_date_id = _this$props2.end_date_id;
|
|
127
|
-
var _convertToMoment = (0, _convertToMoment3.default)(this.props, ['initial_visible_month']),
|
|
128
|
-
initial_visible_month = _convertToMoment.initial_visible_month;
|
|
129
|
-
var _convertToMoment2 = (0, _convertToMoment3.default)(this.state, ['start_date', 'end_date']),
|
|
130
|
-
start_date = _convertToMoment2.start_date,
|
|
131
|
-
end_date = _convertToMoment2.end_date;
|
|
132
|
-
var verticalFlag = calendar_orientation !== 'vertical';
|
|
133
|
-
var DatePickerWrapperStyles = _objectSpread({
|
|
134
|
-
position: 'relative',
|
|
135
|
-
display: 'inline-block'
|
|
136
|
-
}, style);
|
|
137
|
-
|
|
138
|
-
// the height in px of the top part of the calendar (that holds
|
|
139
|
-
// the name of the month)
|
|
140
|
-
var baselineHeight = 145;
|
|
141
|
-
return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
|
|
142
|
-
id: id,
|
|
143
|
-
style: DatePickerWrapperStyles,
|
|
144
|
-
className: className
|
|
145
|
-
}, /*#__PURE__*/_react.default.createElement(_reactDates.DateRangePicker, {
|
|
146
|
-
daySize: day_size,
|
|
147
|
-
disabled: disabled,
|
|
148
|
-
displayFormat: display_format,
|
|
149
|
-
enableOutsideDays: show_outside_days,
|
|
150
|
-
endDate: end_date,
|
|
151
|
-
endDatePlaceholderText: end_date_placeholder_text,
|
|
152
|
-
firstDayOfWeek: first_day_of_week,
|
|
153
|
-
focusedInput: focusedInput,
|
|
154
|
-
initialVisibleMonth: () => {
|
|
155
|
-
if (initial_visible_month) {
|
|
156
|
-
return initial_visible_month;
|
|
157
|
-
} else if (end_date && focusedInput === 'endDate') {
|
|
158
|
-
return end_date;
|
|
159
|
-
} else if (start_date && focusedInput === 'startDate') {
|
|
160
|
-
return start_date;
|
|
161
|
-
}
|
|
162
|
-
return start_date;
|
|
163
|
-
},
|
|
164
|
-
isOutsideRange: this.isOutsideRange,
|
|
165
|
-
isRTL: is_RTL,
|
|
166
|
-
keepOpenOnDateSelect: stay_open_on_select,
|
|
167
|
-
minimumNights: minimum_nights,
|
|
168
|
-
monthFormat: month_format,
|
|
169
|
-
numberOfMonths: number_of_months_shown,
|
|
170
|
-
onDatesChange: this.onDatesChange,
|
|
171
|
-
onFocusChange: focusedInput => this.setState({
|
|
172
|
-
focusedInput
|
|
173
|
-
}),
|
|
174
|
-
orientation: calendar_orientation,
|
|
175
|
-
reopenPickerOnClearDates: reopen_calendar_on_clear,
|
|
176
|
-
showClearDates: clearable,
|
|
177
|
-
startDate: start_date,
|
|
178
|
-
startDatePlaceholderText: start_date_placeholder_text,
|
|
179
|
-
withFullScreenPortal: with_full_screen_portal && verticalFlag,
|
|
180
|
-
withPortal: with_portal && verticalFlag,
|
|
181
|
-
startDateId: start_date_id || this.state.start_date_id,
|
|
182
|
-
endDateId: end_date_id || this.state.end_date_id,
|
|
183
|
-
verticalHeight: baselineHeight + day_size * 6 + 'px'
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
exports.default = DatePickerRange;
|
|
188
|
-
DatePickerRange.propTypes = _DatePickerRange.propTypes;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
require("react-dates/initialize");
|
|
8
|
-
var _reactDates = require("react-dates");
|
|
9
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _DatePickerSingle = require("../components/DatePickerSingle.react");
|
|
12
|
-
var _convertToMoment2 = _interopRequireDefault(require("../utils/convertToMoment"));
|
|
13
|
-
var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"));
|
|
14
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
-
class DatePickerSingle extends _react.Component {
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
this.propsToState = this.propsToState.bind(this);
|
|
25
|
-
this.isOutsideRange = this.isOutsideRange.bind(this);
|
|
26
|
-
this.onDateChange = this.onDateChange.bind(this);
|
|
27
|
-
this.state = {
|
|
28
|
-
focused: false
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
propsToState(newProps) {
|
|
32
|
-
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
33
|
-
var state = {};
|
|
34
|
-
if (force || newProps.max_date_allowed !== this.props.max_date_allowed) {
|
|
35
|
-
state.max_date_allowed = (0, _convertToMoment2.default)(newProps, ['max_date_allowed']).max_date_allowed;
|
|
36
|
-
}
|
|
37
|
-
if (force || newProps.min_date_allowed !== this.props.min_date_allowed) {
|
|
38
|
-
state.min_date_allowed = (0, _convertToMoment2.default)(newProps, ['min_date_allowed']).min_date_allowed;
|
|
39
|
-
}
|
|
40
|
-
if (force || newProps.disabled_days !== this.props.disabled_days) {
|
|
41
|
-
state.disabled_days = (0, _convertToMoment2.default)(newProps, ['disabled_days']).disabled_days;
|
|
42
|
-
}
|
|
43
|
-
if (Object.keys(state).length) {
|
|
44
|
-
this.setState(state);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
UNSAFE_componentWillReceiveProps(newProps) {
|
|
48
|
-
this.propsToState(newProps);
|
|
49
|
-
}
|
|
50
|
-
UNSAFE_componentWillMount() {
|
|
51
|
-
this.propsToState(this.props, true);
|
|
52
|
-
}
|
|
53
|
-
isOutsideRange(date) {
|
|
54
|
-
return this.state.min_date_allowed && date.isBefore(this.state.min_date_allowed) || this.state.max_date_allowed && date.isAfter(this.state.max_date_allowed) || this.state.disabled_days && this.state.disabled_days.some(d => date.isSame(d, 'day'));
|
|
55
|
-
}
|
|
56
|
-
onDateChange(date) {
|
|
57
|
-
var setProps = this.props.setProps;
|
|
58
|
-
var payload = {
|
|
59
|
-
date: date ? date.format('YYYY-MM-DD') : null
|
|
60
|
-
};
|
|
61
|
-
setProps(payload);
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
var focused = this.state.focused;
|
|
65
|
-
var _this$props = this.props,
|
|
66
|
-
calendar_orientation = _this$props.calendar_orientation,
|
|
67
|
-
clearable = _this$props.clearable,
|
|
68
|
-
day_size = _this$props.day_size,
|
|
69
|
-
disabled = _this$props.disabled,
|
|
70
|
-
display_format = _this$props.display_format,
|
|
71
|
-
first_day_of_week = _this$props.first_day_of_week,
|
|
72
|
-
is_RTL = _this$props.is_RTL,
|
|
73
|
-
month_format = _this$props.month_format,
|
|
74
|
-
number_of_months_shown = _this$props.number_of_months_shown,
|
|
75
|
-
placeholder = _this$props.placeholder,
|
|
76
|
-
reopen_calendar_on_clear = _this$props.reopen_calendar_on_clear,
|
|
77
|
-
show_outside_days = _this$props.show_outside_days,
|
|
78
|
-
stay_open_on_select = _this$props.stay_open_on_select,
|
|
79
|
-
with_full_screen_portal = _this$props.with_full_screen_portal,
|
|
80
|
-
with_portal = _this$props.with_portal,
|
|
81
|
-
id = _this$props.id,
|
|
82
|
-
style = _this$props.style,
|
|
83
|
-
className = _this$props.className;
|
|
84
|
-
var _convertToMoment = (0, _convertToMoment2.default)(this.props, ['date', 'initial_visible_month']),
|
|
85
|
-
date = _convertToMoment.date,
|
|
86
|
-
initial_visible_month = _convertToMoment.initial_visible_month;
|
|
87
|
-
var verticalFlag = calendar_orientation !== 'vertical';
|
|
88
|
-
var DatePickerWrapperStyles = _objectSpread({
|
|
89
|
-
position: 'relative',
|
|
90
|
-
display: 'inline-block'
|
|
91
|
-
}, style);
|
|
92
|
-
|
|
93
|
-
// the height in px of the top part of the calendar (that holds
|
|
94
|
-
// the name of the month)
|
|
95
|
-
var baselineHeight = 145;
|
|
96
|
-
return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
|
|
97
|
-
id: id,
|
|
98
|
-
style: DatePickerWrapperStyles,
|
|
99
|
-
className: className
|
|
100
|
-
}, /*#__PURE__*/_react.default.createElement(_reactDates.SingleDatePicker, {
|
|
101
|
-
date: date,
|
|
102
|
-
onDateChange: this.onDateChange,
|
|
103
|
-
focused: focused,
|
|
104
|
-
onFocusChange: _ref => {
|
|
105
|
-
var focused = _ref.focused;
|
|
106
|
-
return this.setState({
|
|
107
|
-
focused
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
initialVisibleMonth: () => date || initial_visible_month || (0, _moment.default)(),
|
|
111
|
-
isOutsideRange: this.isOutsideRange,
|
|
112
|
-
numberOfMonths: number_of_months_shown,
|
|
113
|
-
withPortal: with_portal && verticalFlag,
|
|
114
|
-
withFullScreenPortal: with_full_screen_portal && verticalFlag,
|
|
115
|
-
firstDayOfWeek: first_day_of_week,
|
|
116
|
-
enableOutsideDays: show_outside_days,
|
|
117
|
-
monthFormat: month_format,
|
|
118
|
-
displayFormat: display_format,
|
|
119
|
-
placeholder: placeholder,
|
|
120
|
-
showClearDate: clearable,
|
|
121
|
-
disabled: disabled,
|
|
122
|
-
keepOpenOnDateSelect: stay_open_on_select,
|
|
123
|
-
reopenPickerOnClearDate: reopen_calendar_on_clear,
|
|
124
|
-
isRTL: is_RTL,
|
|
125
|
-
orientation: calendar_orientation,
|
|
126
|
-
daySize: day_size,
|
|
127
|
-
verticalHeight: baselineHeight + day_size * 6 + 'px'
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.default = DatePickerSingle;
|
|
132
|
-
DatePickerSingle.propTypes = _DatePickerSingle.propTypes;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
8
|
-
var _ramda = require("ramda");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
var _default = exports.default = {
|
|
11
|
-
extract: propValue => {
|
|
12
|
-
if (!(0, _ramda.isNil)(propValue)) {
|
|
13
|
-
return (0, _moment.default)(propValue).startOf('day').format('YYYY-MM-DD');
|
|
14
|
-
}
|
|
15
|
-
return propValue;
|
|
16
|
-
},
|
|
17
|
-
apply: storedValue => storedValue
|
|
18
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
8
|
-
var _ramda = require("ramda");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
var _default = (newProps, momentProps) => {
|
|
11
|
-
var dest = {};
|
|
12
|
-
momentProps.forEach(key => {
|
|
13
|
-
var value = newProps[key];
|
|
14
|
-
if (value === null || value === undefined) {
|
|
15
|
-
dest[key] = null;
|
|
16
|
-
if (key === 'initial_visible_month') {
|
|
17
|
-
dest[key] = (0, _moment.default)(newProps.start_date || newProps.min_date_allowed || newProps.end_date || newProps.max_date_allowed || undefined);
|
|
18
|
-
}
|
|
19
|
-
} else if (Array.isArray(value)) {
|
|
20
|
-
dest[key] = value.map(d => (0, _moment.default)(d));
|
|
21
|
-
} else {
|
|
22
|
-
dest[key] = (0, _moment.default)(value);
|
|
23
|
-
if (key === 'max_date_allowed' && (0, _ramda.has)(key, dest)) {
|
|
24
|
-
dest[key].add(1, 'days');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return dest;
|
|
29
|
-
};
|
|
30
|
-
exports.default = _default;
|
package/lib/utils/optionTypes.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.sanitizeOptions = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _ramda = require("ramda");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
-
var sanitizeOptions = options => {
|
|
17
|
-
if ((0, _ramda.type)(options) === 'Object') {
|
|
18
|
-
return Object.entries(options).map(_ref => {
|
|
19
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
20
|
-
value = _ref2[0],
|
|
21
|
-
label = _ref2[1];
|
|
22
|
-
return {
|
|
23
|
-
label: /*#__PURE__*/_react.default.isValidElement(label) ? label : String(label),
|
|
24
|
-
value
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
if ((0, _ramda.type)(options) === 'Array') {
|
|
29
|
-
if (options.length > 0 && ['String', 'Number', 'Bool'].includes((0, _ramda.type)(options[0]))) {
|
|
30
|
-
return options.map(option => ({
|
|
31
|
-
label: String(option),
|
|
32
|
-
value: option
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
return options;
|
|
36
|
-
}
|
|
37
|
-
return options;
|
|
38
|
-
};
|
|
39
|
-
exports.sanitizeOptions = sanitizeOptions;
|