guestbell-forms 2.0.298 → 2.0.299
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/build/components/InputHeader/InputHeader.js +258 -323
- package/build/components/InputHeader/InputHeader.js.map +1 -1
- package/build/components/InputHeader/InputHeaderContext.js +6 -8
- package/build/components/InputHeader/InputHeaderContext.js.map +1 -1
- package/build/components/InputHeader/index.js +4 -6
- package/build/components/InputHeader/index.js.map +1 -1
- package/build/components/InputHeader/withInputHeaderContext.js +9 -13
- package/build/components/InputHeader/withInputHeaderContext.js.map +1 -1
- package/build/components/base/input/BaseInput.js +334 -418
- package/build/components/base/input/BaseInput.js.map +1 -1
- package/build/components/base/input/index.js +1 -1
- package/build/components/base/input/index.js.map +1 -1
- package/build/components/bookingCalendar/BookingCalendar.js +68 -85
- package/build/components/bookingCalendar/BookingCalendar.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.js +40 -71
- package/build/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarControls/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarControls/classes.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarControls/index.js +2 -2
- package/build/components/bookingCalendar/bookingCalendarControls/index.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.js +22 -41
- package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarDatePicker/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarDatePicker/classes.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarDatePicker/index.js +2 -2
- package/build/components/bookingCalendar/bookingCalendarDatePicker/index.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarGrid/BookingCalendarGrid.js +20 -24
- package/build/components/bookingCalendar/bookingCalendarGrid/BookingCalendarGrid.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarGrid/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarGrid/classes.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarItem/BookingCalendarItem.js +9 -12
- package/build/components/bookingCalendar/bookingCalendarItem/BookingCalendarItem.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarItem/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarItem/classes.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarItem/index.js +2 -2
- package/build/components/bookingCalendar/bookingCalendarItem/index.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLane/BookingCalendarLane.js +23 -28
- package/build/components/bookingCalendar/bookingCalendarLane/BookingCalendarLane.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLane/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarLane/classes.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLane/index.js +2 -2
- package/build/components/bookingCalendar/bookingCalendarLane/index.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/BookingCalendarLaneHeader.js +6 -6
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/BookingCalendarLaneHeader.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/classes.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/index.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/index.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeader.js +12 -16
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeader.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeaderRenderItem.js +27 -31
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeaderRenderItem.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/classes.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/index.js +2 -2
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/index.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarRenderItem/BookingCalendarRenderItem.js +19 -19
- package/build/components/bookingCalendar/bookingCalendarRenderItem/BookingCalendarRenderItem.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarRenderItem/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarRenderItem/classes.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarRenderItem/index.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarRenderItem/index.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js +133 -175
- package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarTimeAxis/BookingCalendarTimeAxis.js +17 -19
- package/build/components/bookingCalendar/bookingCalendarTimeAxis/BookingCalendarTimeAxis.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarTimeAxis/classes.js +1 -1
- package/build/components/bookingCalendar/bookingCalendarTimeAxis/classes.js.map +1 -1
- package/build/components/bookingCalendar/classes.js +1 -1
- package/build/components/bookingCalendar/classes.js.map +1 -1
- package/build/components/bookingCalendar/common.js +5 -7
- package/build/components/bookingCalendar/common.js.map +1 -1
- package/build/components/bookingCalendar/index.js +3 -3
- package/build/components/bookingCalendar/index.js.map +1 -1
- package/build/components/bookingCalendar/utils.js +143 -205
- package/build/components/bookingCalendar/utils.js.map +1 -1
- package/build/components/button/Button.js +101 -123
- package/build/components/button/Button.js.map +1 -1
- package/build/components/button/index.js +4 -6
- package/build/components/button/index.js.map +1 -1
- package/build/components/checkbox/Checkbox.js +102 -145
- package/build/components/checkbox/Checkbox.js.map +1 -1
- package/build/components/checkbox/index.js +4 -6
- package/build/components/checkbox/index.js.map +1 -1
- package/build/components/dropdown/Dropdown.js +41 -57
- package/build/components/dropdown/Dropdown.js.map +1 -1
- package/build/components/dropdown/index.js +4 -6
- package/build/components/dropdown/index.js.map +1 -1
- package/build/components/dynamicSubmit/DynamicSubmit.js +81 -123
- package/build/components/dynamicSubmit/DynamicSubmit.js.map +1 -1
- package/build/components/dynamicSubmit/index.js +4 -6
- package/build/components/dynamicSubmit/index.js.map +1 -1
- package/build/components/form/Form.js +139 -193
- package/build/components/form/Form.js.map +1 -1
- package/build/components/form/FormContext.js +6 -8
- package/build/components/form/FormContext.js.map +1 -1
- package/build/components/form/FormValidationSummary.js +57 -105
- package/build/components/form/FormValidationSummary.js.map +1 -1
- package/build/components/form/index.js +5 -7
- package/build/components/form/index.js.map +1 -1
- package/build/components/form/withFormContext.js +9 -13
- package/build/components/form/withFormContext.js.map +1 -1
- package/build/components/inputGroup/InputGroup.js +16 -48
- package/build/components/inputGroup/InputGroup.js.map +1 -1
- package/build/components/inputGroup/index.js +4 -6
- package/build/components/inputGroup/index.js.map +1 -1
- package/build/components/money/Money.js +137 -211
- package/build/components/money/Money.js.map +1 -1
- package/build/components/money/index.js +4 -6
- package/build/components/money/index.js.map +1 -1
- package/build/components/numberInput/NumberInput.js +106 -144
- package/build/components/numberInput/NumberInput.js.map +1 -1
- package/build/components/numberInput/index.js +4 -6
- package/build/components/numberInput/index.js.map +1 -1
- package/build/components/openingHours/openingHoursDay/OpeningHoursDay.js +162 -220
- package/build/components/openingHours/openingHoursDay/OpeningHoursDay.js.map +1 -1
- package/build/components/openingHours/openingHoursDay/index.js +4 -6
- package/build/components/openingHours/openingHoursDay/index.js.map +1 -1
- package/build/components/openingHours/openingHoursSpecial/OpeningHoursSpecial.js +114 -191
- package/build/components/openingHours/openingHoursSpecial/OpeningHoursSpecial.js.map +1 -1
- package/build/components/openingHours/openingHoursSpecial/index.js +4 -6
- package/build/components/openingHours/openingHoursSpecial/index.js.map +1 -1
- package/build/components/openingHours/openingHoursWeek/OpeningHoursWeek.js +150 -209
- package/build/components/openingHours/openingHoursWeek/OpeningHoursWeek.js.map +1 -1
- package/build/components/openingHours/openingHoursWeek/index.js +4 -6
- package/build/components/openingHours/openingHoursWeek/index.js.map +1 -1
- package/build/components/openingHours/utils/OpeningHoursUtil.js +51 -76
- package/build/components/openingHours/utils/OpeningHoursUtil.js.map +1 -1
- package/build/components/radio/Radio.js +38 -75
- package/build/components/radio/Radio.js.map +1 -1
- package/build/components/radio/index.js +4 -6
- package/build/components/radio/index.js.map +1 -1
- package/build/components/radioContainer/RadioContainer.js +19 -49
- package/build/components/radioContainer/RadioContainer.js.map +1 -1
- package/build/components/radioContainer/index.js +4 -6
- package/build/components/radioContainer/index.js.map +1 -1
- package/build/components/select/Select.js +186 -264
- package/build/components/select/Select.js.map +1 -1
- package/build/components/select/index.js +4 -6
- package/build/components/select/index.js.map +1 -1
- package/build/components/submit/Submit.js +50 -87
- package/build/components/submit/Submit.js.map +1 -1
- package/build/components/submit/index.js +4 -6
- package/build/components/submit/index.js.map +1 -1
- package/build/components/submit/subComponents/SubmitValidationSummary.js +5 -7
- package/build/components/submit/subComponents/SubmitValidationSummary.js.map +1 -1
- package/build/components/tags/Tags.js +365 -565
- package/build/components/tags/Tags.js.map +1 -1
- package/build/components/tags/index.js +4 -6
- package/build/components/tags/index.js.map +1 -1
- package/build/components/tags/subComponents/TagsSuggestions.js +29 -30
- package/build/components/tags/subComponents/TagsSuggestions.js.map +1 -1
- package/build/components/text/Text.js +95 -138
- package/build/components/text/Text.js.map +1 -1
- package/build/components/text/index.js +4 -6
- package/build/components/text/index.js.map +1 -1
- package/build/components/textArea/TextArea.js +52 -91
- package/build/components/textArea/TextArea.js.map +1 -1
- package/build/components/textArea/index.js +4 -6
- package/build/components/textArea/index.js.map +1 -1
- package/build/components/themeProvider/ThemeContext.js +6 -8
- package/build/components/themeProvider/ThemeContext.js.map +1 -1
- package/build/components/themeProvider/ThemeProvider.js +3 -5
- package/build/components/themeProvider/ThemeProvider.js.map +1 -1
- package/build/components/themeProvider/index.js +4 -6
- package/build/components/themeProvider/index.js.map +1 -1
- package/build/components/themeProvider/withThemeContext.js +10 -14
- package/build/components/themeProvider/withThemeContext.js.map +1 -1
- package/build/components/time/Time.js +184 -228
- package/build/components/time/Time.js.map +1 -1
- package/build/components/time/index.js +4 -6
- package/build/components/time/index.js.map +1 -1
- package/build/components/timeSpan/TimeSpan.js +226 -280
- package/build/components/timeSpan/TimeSpan.js.map +1 -1
- package/build/components/timeSpan/index.js +4 -6
- package/build/components/timeSpan/index.js.map +1 -1
- package/build/components/utils/Guid.js +3 -5
- package/build/components/utils/Guid.js.map +1 -1
- package/build/components/utils/ShallowEqual.js +5 -11
- package/build/components/utils/ShallowEqual.js.map +1 -1
- package/build/components/utils/TimeUtil.js +8 -22
- package/build/components/utils/TimeUtil.js.map +1 -1
- package/build/components/utils/Typescript.js.map +1 -1
- package/build/dist/guestbell-forms.css +0 -6
- package/build/dist/guestbell-forms.css.map +1 -1
- package/build/dist/guestbell-forms.min.css +1 -1
- package/build/dist/guestbell-forms.min.js +1 -1
- package/build/dist/guestbell-forms.min.js.map +1 -1
- package/build/dist/report.html +2 -2
- package/build/index.js +23 -23
- package/build/index.js.map +1 -1
- package/build/types/ElementOverrideProp.js.map +1 -1
- package/build/types/Theme.js.map +1 -1
- package/build/types/ThemeOverrides.js.map +1 -1
- package/build/validators/EmailValidator.js +8 -22
- package/build/validators/EmailValidator.js.map +1 -1
- package/build/validators/LatitudeValidator.js +13 -27
- package/build/validators/LatitudeValidator.js.map +1 -1
- package/build/validators/LongitudeValidator.js +13 -27
- package/build/validators/LongitudeValidator.js.map +1 -1
- package/build/validators/NumberValidator.js +27 -39
- package/build/validators/NumberValidator.js.map +1 -1
- package/build/validators/UrlValidator.js +9 -23
- package/build/validators/UrlValidator.js.map +1 -1
- package/build/validators/base.js.map +1 -1
- package/build/validators/index.js +6 -6
- package/build/validators/index.js.map +1 -1
- package/package.json +8 -5
- package/tsconfig.json +0 -1
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
@@ -17,24 +15,12 @@ var _ = require(".");
|
|
17
15
|
|
18
16
|
var _Button = require("../../button/Button");
|
19
17
|
|
20
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
21
19
|
|
22
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
23
21
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
23
|
|
26
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
27
|
-
|
28
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
29
|
-
|
30
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
31
|
-
|
32
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
33
|
-
|
34
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
35
|
-
|
36
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
37
|
-
|
38
24
|
var LeftArrowLongIcon = function LeftArrowLongIcon(props) {
|
39
25
|
return /*#__PURE__*/React.createElement("svg", props, /*#__PURE__*/React.createElement("path", {
|
40
26
|
d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
|
@@ -101,52 +87,39 @@ UnfoldLessIcon.defaultProps = {
|
|
101
87
|
};
|
102
88
|
|
103
89
|
function BookingCalendarControls(props) {
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
} : _props$filterBookings;
|
90
|
+
const {
|
91
|
+
className,
|
92
|
+
monthLabelClassName,
|
93
|
+
buttonsContainerClassName,
|
94
|
+
zoomBookingsButtonClassName,
|
95
|
+
zoomLevelsContainerClassName,
|
96
|
+
zoomLevels,
|
97
|
+
step,
|
98
|
+
from,
|
99
|
+
till,
|
100
|
+
onRangeChange,
|
101
|
+
items,
|
102
|
+
filterBookingsToZoom = () => true
|
103
|
+
} = props;
|
119
104
|
|
120
105
|
if (!step || !from || !till) {
|
121
106
|
return null;
|
122
107
|
}
|
123
108
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
}, [filterBookingsToZoom, items]);
|
139
|
-
var onZoomBookingsClick = React.useCallback(function () {
|
140
|
-
var _Math$min, _Math$max;
|
141
|
-
|
142
|
-
var minFromMs = (_Math$min = Math.min.apply(Math, _toConsumableArray(filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.filter(filterBookingsToZoom).map(function (a) {
|
143
|
-
return a.from.valueOf();
|
144
|
-
})))) !== null && _Math$min !== void 0 ? _Math$min : from === null || from === void 0 ? void 0 : from.valueOf();
|
145
|
-
var minFrom = from.clone().add(from.valueOf() - minFromMs, 'ms');
|
146
|
-
var maxTillMs = (_Math$max = Math.max.apply(Math, _toConsumableArray(filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.filter(filterBookingsToZoom).map(function (a) {
|
147
|
-
return a.till.valueOf();
|
148
|
-
})))) !== null && _Math$max !== void 0 ? _Math$max : till === null || till === void 0 ? void 0 : till.valueOf();
|
149
|
-
var maxTill = till.clone().add(till.valueOf() - maxTillMs, 'ms');
|
109
|
+
const onStepFactory = React.useCallback(_step => () => onRangeChange({
|
110
|
+
from: from.clone().add(_step),
|
111
|
+
till: till.clone().add(_step)
|
112
|
+
}), [from, till, onRangeChange]);
|
113
|
+
const onBigStepLeftClick = React.useCallback(onStepFactory((0, _moment.duration)(-7, 'days')), [onStepFactory, till, from]);
|
114
|
+
const onSmallStepLeftClick = React.useCallback(onStepFactory((0, _moment.duration)(-1, 'day')), [onStepFactory, step]);
|
115
|
+
const onBigStepRightClick = React.useCallback(onStepFactory((0, _moment.duration)(7, 'days')), [onStepFactory, till, from]);
|
116
|
+
const onSmallStepRightClick = React.useCallback(onStepFactory((0, _moment.duration)(1, 'day')), [onStepFactory, step]);
|
117
|
+
const filteredItems = React.useMemo(() => items === null || items === void 0 ? void 0 : items.filter(filterBookingsToZoom), [filterBookingsToZoom, items]);
|
118
|
+
const onZoomBookingsClick = React.useCallback(() => {
|
119
|
+
const minFromMs = Math.min(...(filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.filter(filterBookingsToZoom).map(a => a.from.valueOf()))) ?? (from === null || from === void 0 ? void 0 : from.valueOf());
|
120
|
+
const minFrom = from.clone().add(from.valueOf() - minFromMs, 'ms');
|
121
|
+
const maxTillMs = Math.max(...(filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.filter(filterBookingsToZoom).map(a => a.till.valueOf()))) ?? (till === null || till === void 0 ? void 0 : till.valueOf());
|
122
|
+
const maxTill = till.clone().add(till.valueOf() - maxTillMs, 'ms');
|
150
123
|
onRangeChange({
|
151
124
|
from: minFrom,
|
152
125
|
till: maxTill
|
@@ -158,20 +131,16 @@ function BookingCalendarControls(props) {
|
|
158
131
|
className: (0, _classnames.default)(_.bookingCalendarControlsDefaultClasses.monthLabelClassName, monthLabelClassName)
|
159
132
|
}, from.format('MMMM'), ", ", from.format('YYYY')), (zoomLevels === null || zoomLevels === void 0 ? void 0 : zoomLevels.length) > 0 && /*#__PURE__*/React.createElement("div", {
|
160
133
|
className: (0, _classnames.default)(_.bookingCalendarControlsDefaultClasses.zoomLevelsContainerClassName, zoomLevelsContainerClassName)
|
161
|
-
}, zoomLevels.map(
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
});
|
172
|
-
}
|
173
|
-
}, level.label);
|
174
|
-
})), /*#__PURE__*/React.createElement("div", {
|
134
|
+
}, zoomLevels.map((level, index) => /*#__PURE__*/React.createElement(_Button.Button, {
|
135
|
+
type: till.valueOf() - from.valueOf() === level.step.asMilliseconds() ? 'primary' : undefined // blank={true}
|
136
|
+
,
|
137
|
+
noShadow: true,
|
138
|
+
key: index,
|
139
|
+
onClick: () => onRangeChange({
|
140
|
+
from: from.clone().startOf('day'),
|
141
|
+
till: from.clone().startOf('day').add(level.step)
|
142
|
+
})
|
143
|
+
}, level.label))), /*#__PURE__*/React.createElement("div", {
|
175
144
|
className: (0, _classnames.default)(_.bookingCalendarControlsDefaultClasses.buttonsContainerClassName, buttonsContainerClassName)
|
176
145
|
}, /*#__PURE__*/React.createElement(_Button.Button, {
|
177
146
|
noShadow: true,
|
package/build/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.tsx"],"names":["LeftArrowLongIcon","LeftArrowIcon","RightArrowLongIcon","RightArrowIcon","UnfoldLessIcon","BookingCalendarControls","props","className","monthLabelClassName","buttonsContainerClassName","zoomBookingsButtonClassName","zoomLevelsContainerClassName","zoomLevels","step","from","till","onRangeChange","items","filterBookingsToZoom","onStepFactory","React","useCallback","_step","clone","add","onBigStepLeftClick","onSmallStepLeftClick","onBigStepRightClick","onSmallStepRightClick","filteredItems","useMemo","filter","onZoomBookingsClick","minFromMs","Math","min","map","a","valueOf","minFrom","maxTillMs","max","maxTill","bookingCalendarControlsDefaultClasses","format","length","level","index","asMilliseconds","undefined","startOf","label"],"mappings":";;;;;;;;;AAAA;;AACA;;AA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BAFS,CADb;AAKE,IAAA,QAAQ,EAAE,IALZ;AAME,IAAA,QAAQ,EAAE,EAACmB,aAAD,aAACA,aAAD,eAACA,aAAa,CAAEgB,MAAhB,CANZ;AAOE,IAAA,OAAO,EAAEb;AAPX,kBASE,oBAAC,cAAD,OATF,CAlBF,CA7CF,CADF;AA8ED","sourcesContent":["import classNames from 'classnames';\r\nimport * as React from 'react';\r\nimport {\r\n BookingCalendarDateRange,\r\n BookingCalendarItemT,\r\n ZoomLevel,\r\n} from '../common';\r\nimport { duration, Duration, Moment } from 'moment';\r\nimport { BookingCalendarControlsClasses } from './classes';\r\nimport { bookingCalendarControlsDefaultClasses } from '.';\r\nimport { Button } from '../../button/Button';\r\nimport * as LeftArrowLongIcon from 'material-design-icons/navigation/svg/production/ic_arrow_back_24px.svg';\r\nimport * as LeftArrowIcon from 'material-design-icons/hardware/svg/production/ic_keyboard_arrow_left_24px.svg';\r\nimport * as RightArrowLongIcon from 'material-design-icons/navigation/svg/production/ic_arrow_forward_24px.svg';\r\nimport * as RightArrowIcon from 'material-design-icons/hardware/svg/production/ic_keyboard_arrow_right_24px.svg';\r\nimport * as UnfoldLessIcon from 'material-design-icons/navigation/svg/production/ic_unfold_less_24px.svg';\r\n\r\nexport interface BookingCalendarControlsProps<T extends BookingCalendarItemT>\r\n extends BookingCalendarControlsClasses {\r\n items: T[];\r\n step: Duration;\r\n from: Moment;\r\n till: Moment;\r\n zoomLevels?: ZoomLevel[];\r\n onRangeChange?: (range: BookingCalendarDateRange) => void;\r\n filterBookingsToZoom?: (booking: T) => boolean;\r\n}\r\n\r\nexport function BookingCalendarControls<T extends BookingCalendarItemT>(\r\n props: BookingCalendarControlsProps<T>\r\n) {\r\n const {\r\n className,\r\n monthLabelClassName,\r\n buttonsContainerClassName,\r\n zoomBookingsButtonClassName,\r\n zoomLevelsContainerClassName,\r\n zoomLevels,\r\n step,\r\n from,\r\n till,\r\n onRangeChange,\r\n items,\r\n filterBookingsToZoom = () => true,\r\n } = props;\r\n if (!step || !from || !till) {\r\n return null;\r\n }\r\n const onStepFactory = React.useCallback(\r\n (_step: Duration) => () =>\r\n onRangeChange({\r\n from: from.clone().add(_step),\r\n till: till.clone().add(_step),\r\n }),\r\n [from, till, onRangeChange]\r\n );\r\n const onBigStepLeftClick = React.useCallback(\r\n onStepFactory(duration(-7, 'days')),\r\n [onStepFactory, till, from]\r\n );\r\n const onSmallStepLeftClick = React.useCallback(\r\n onStepFactory(duration(-1, 'day')),\r\n [onStepFactory, step]\r\n );\r\n const onBigStepRightClick = React.useCallback(\r\n onStepFactory(duration(7, 'days')),\r\n [onStepFactory, till, from]\r\n );\r\n const onSmallStepRightClick = React.useCallback(\r\n onStepFactory(duration(1, 'day')),\r\n [onStepFactory, step]\r\n );\r\n const filteredItems = React.useMemo(\r\n () => items?.filter(filterBookingsToZoom),\r\n [filterBookingsToZoom, items]\r\n );\r\n const onZoomBookingsClick = React.useCallback(() => {\r\n const minFromMs =\r\n Math.min(\r\n ...filteredItems\r\n ?.filter(filterBookingsToZoom)\r\n .map(a => a.from.valueOf())\r\n ) ?? from?.valueOf();\r\n const minFrom = from.clone().add(from.valueOf() - minFromMs, 'ms');\r\n const maxTillMs =\r\n Math.max(\r\n ...filteredItems\r\n ?.filter(filterBookingsToZoom)\r\n .map(a => a.till.valueOf())\r\n ) ?? till?.valueOf();\r\n const maxTill = till.clone().add(till.valueOf() - maxTillMs, 'ms');\r\n onRangeChange({\r\n from: minFrom,\r\n till: maxTill,\r\n });\r\n }, [from, till, filteredItems]);\r\n return (\r\n <div\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.className,\r\n className\r\n )}\r\n >\r\n <div\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.monthLabelClassName,\r\n monthLabelClassName\r\n )}\r\n >\r\n {from.format('MMMM')}, {from.format('YYYY')}\r\n </div>\r\n {zoomLevels?.length > 0 && (\r\n <div\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.zoomLevelsContainerClassName,\r\n zoomLevelsContainerClassName\r\n )}\r\n >\r\n {zoomLevels.map((level, index) => (\r\n <Button\r\n type={\r\n till.valueOf() - from.valueOf() === level.step.asMilliseconds()\r\n ? 'primary'\r\n : undefined\r\n }\r\n // blank={true}\r\n noShadow={true}\r\n key={index}\r\n onClick={() =>\r\n onRangeChange({\r\n from: from.clone().startOf('day'),\r\n till: from.clone()\r\n .startOf('day')\r\n .add(level.step),\r\n })\r\n }\r\n >\r\n {level.label}\r\n </Button>\r\n ))}\r\n </div>\r\n )}\r\n <div\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.buttonsContainerClassName,\r\n buttonsContainerClassName\r\n )}\r\n >\r\n <Button noShadow={true} onClick={onBigStepLeftClick}>\r\n <LeftArrowLongIcon />\r\n </Button>\r\n <Button noShadow={true} onClick={onSmallStepLeftClick}>\r\n <LeftArrowIcon />\r\n </Button>\r\n <Button noShadow={true} onClick={onSmallStepRightClick}>\r\n <RightArrowIcon />\r\n </Button>\r\n <Button noShadow={true} onClick={onBigStepRightClick}>\r\n <RightArrowLongIcon />\r\n </Button>\r\n <Button\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.zoomBookingsButtonClassName,\r\n zoomBookingsButtonClassName\r\n )}\r\n noShadow={true}\r\n disabled={!filteredItems?.length}\r\n onClick={onZoomBookingsClick}\r\n >\r\n <UnfoldLessIcon />\r\n </Button>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"file":"BookingCalendarControls.js"}
|
1
|
+
{"version":3,"file":"BookingCalendarControls.js","names":["LeftArrowLongIcon","LeftArrowIcon","RightArrowLongIcon","RightArrowIcon","UnfoldLessIcon","BookingCalendarControls","props","className","monthLabelClassName","buttonsContainerClassName","zoomBookingsButtonClassName","zoomLevelsContainerClassName","zoomLevels","step","from","till","onRangeChange","items","filterBookingsToZoom","onStepFactory","React","useCallback","_step","clone","add","onBigStepLeftClick","duration","onSmallStepLeftClick","onBigStepRightClick","onSmallStepRightClick","filteredItems","useMemo","filter","onZoomBookingsClick","minFromMs","Math","min","map","a","valueOf","minFrom","maxTillMs","max","maxTill","classNames","bookingCalendarControlsDefaultClasses","format","length","level","index","asMilliseconds","undefined","startOf","label"],"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.tsx"],"sourcesContent":["import classNames from 'classnames';\r\nimport * as React from 'react';\r\nimport {\r\n BookingCalendarDateRange,\r\n BookingCalendarItemT,\r\n ZoomLevel,\r\n} from '../common';\r\nimport { duration, Duration, Moment } from 'moment';\r\nimport { BookingCalendarControlsClasses } from './classes';\r\nimport { bookingCalendarControlsDefaultClasses } from '.';\r\nimport { Button } from '../../button/Button';\r\nimport * as LeftArrowLongIcon from 'material-design-icons/navigation/svg/production/ic_arrow_back_24px.svg';\r\nimport * as LeftArrowIcon from 'material-design-icons/hardware/svg/production/ic_keyboard_arrow_left_24px.svg';\r\nimport * as RightArrowLongIcon from 'material-design-icons/navigation/svg/production/ic_arrow_forward_24px.svg';\r\nimport * as RightArrowIcon from 'material-design-icons/hardware/svg/production/ic_keyboard_arrow_right_24px.svg';\r\nimport * as UnfoldLessIcon from 'material-design-icons/navigation/svg/production/ic_unfold_less_24px.svg';\r\n\r\nexport interface BookingCalendarControlsProps<T extends BookingCalendarItemT>\r\n extends BookingCalendarControlsClasses {\r\n items: T[];\r\n step: Duration;\r\n from: Moment;\r\n till: Moment;\r\n zoomLevels?: ZoomLevel[];\r\n onRangeChange?: (range: BookingCalendarDateRange) => void;\r\n filterBookingsToZoom?: (booking: T) => boolean;\r\n}\r\n\r\nexport function BookingCalendarControls<T extends BookingCalendarItemT>(\r\n props: BookingCalendarControlsProps<T>\r\n) {\r\n const {\r\n className,\r\n monthLabelClassName,\r\n buttonsContainerClassName,\r\n zoomBookingsButtonClassName,\r\n zoomLevelsContainerClassName,\r\n zoomLevels,\r\n step,\r\n from,\r\n till,\r\n onRangeChange,\r\n items,\r\n filterBookingsToZoom = () => true,\r\n } = props;\r\n if (!step || !from || !till) {\r\n return null;\r\n }\r\n const onStepFactory = React.useCallback(\r\n (_step: Duration) => () =>\r\n onRangeChange({\r\n from: from.clone().add(_step),\r\n till: till.clone().add(_step),\r\n }),\r\n [from, till, onRangeChange]\r\n );\r\n const onBigStepLeftClick = React.useCallback(\r\n onStepFactory(duration(-7, 'days')),\r\n [onStepFactory, till, from]\r\n );\r\n const onSmallStepLeftClick = React.useCallback(\r\n onStepFactory(duration(-1, 'day')),\r\n [onStepFactory, step]\r\n );\r\n const onBigStepRightClick = React.useCallback(\r\n onStepFactory(duration(7, 'days')),\r\n [onStepFactory, till, from]\r\n );\r\n const onSmallStepRightClick = React.useCallback(\r\n onStepFactory(duration(1, 'day')),\r\n [onStepFactory, step]\r\n );\r\n const filteredItems = React.useMemo(\r\n () => items?.filter(filterBookingsToZoom),\r\n [filterBookingsToZoom, items]\r\n );\r\n const onZoomBookingsClick = React.useCallback(() => {\r\n const minFromMs =\r\n Math.min(\r\n ...filteredItems\r\n ?.filter(filterBookingsToZoom)\r\n .map(a => a.from.valueOf())\r\n ) ?? from?.valueOf();\r\n const minFrom = from.clone().add(from.valueOf() - minFromMs, 'ms');\r\n const maxTillMs =\r\n Math.max(\r\n ...filteredItems\r\n ?.filter(filterBookingsToZoom)\r\n .map(a => a.till.valueOf())\r\n ) ?? till?.valueOf();\r\n const maxTill = till.clone().add(till.valueOf() - maxTillMs, 'ms');\r\n onRangeChange({\r\n from: minFrom,\r\n till: maxTill,\r\n });\r\n }, [from, till, filteredItems]);\r\n return (\r\n <div\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.className,\r\n className\r\n )}\r\n >\r\n <div\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.monthLabelClassName,\r\n monthLabelClassName\r\n )}\r\n >\r\n {from.format('MMMM')}, {from.format('YYYY')}\r\n </div>\r\n {zoomLevels?.length > 0 && (\r\n <div\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.zoomLevelsContainerClassName,\r\n zoomLevelsContainerClassName\r\n )}\r\n >\r\n {zoomLevels.map((level, index) => (\r\n <Button\r\n type={\r\n till.valueOf() - from.valueOf() === level.step.asMilliseconds()\r\n ? 'primary'\r\n : undefined\r\n }\r\n // blank={true}\r\n noShadow={true}\r\n key={index}\r\n onClick={() =>\r\n onRangeChange({\r\n from: from.clone().startOf('day'),\r\n till: from.clone()\r\n .startOf('day')\r\n .add(level.step),\r\n })\r\n }\r\n >\r\n {level.label}\r\n </Button>\r\n ))}\r\n </div>\r\n )}\r\n <div\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.buttonsContainerClassName,\r\n buttonsContainerClassName\r\n )}\r\n >\r\n <Button noShadow={true} onClick={onBigStepLeftClick}>\r\n <LeftArrowLongIcon />\r\n </Button>\r\n <Button noShadow={true} onClick={onSmallStepLeftClick}>\r\n <LeftArrowIcon />\r\n </Button>\r\n <Button noShadow={true} onClick={onSmallStepRightClick}>\r\n <RightArrowIcon />\r\n </Button>\r\n <Button noShadow={true} onClick={onBigStepRightClick}>\r\n <RightArrowLongIcon />\r\n </Button>\r\n <Button\r\n className={classNames(\r\n bookingCalendarControlsDefaultClasses.zoomBookingsButtonClassName,\r\n zoomBookingsButtonClassName\r\n )}\r\n noShadow={true}\r\n disabled={!filteredItems?.length}\r\n onClick={onZoomBookingsClick}\r\n >\r\n <UnfoldLessIcon />\r\n </Button>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;AAEA;;AACA;;;;;;;;IACYA,iB,YAAAA,iB;;;;;;AAAAA,iB;;;;;;;IACAC,a,YAAAA,a;;;;;;AAAAA,a;;;;;;;IACAC,kB,YAAAA,kB;;;;;;AAAAA,kB;;;;;;;IACAC,c,YAAAA,c;;;;;;AAAAA,c;;;;;;;IACAC,c,YAAAA,c;;;;;;AAAAA,c;;;;;;;AAaL,SAASC,uBAAT,CACLC,KADK,EAEL;EACA,MAAM;IACJC,SADI;IAEJC,mBAFI;IAGJC,yBAHI;IAIJC,2BAJI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gBACE,oBAAC,aAAD,OADF,CATF,eAYE,oBAAC,cAAD;IAAQ,QAAQ,EAAE,IAAlB;IAAwB,OAAO,EAAEE;EAAjC,gBACE,oBAAC,cAAD,OADF,CAZF,eAeE,oBAAC,cAAD;IAAQ,QAAQ,EAAE,IAAlB;IAAwB,OAAO,EAAED;EAAjC,gBACE,oBAAC,kBAAD,OADF,CAfF,eAkBE,oBAAC,cAAD;IACE,SAAS,EAAE,IAAAgB,mBAAA,EACTC,uCAAA,CAAsCnC,2BAD7B,EAETA,2BAFS,CADb;IAKE,QAAQ,EAAE,IALZ;IAME,QAAQ,EAAE,EAACoB,aAAD,aAACA,aAAD,eAACA,aAAa,CAAEiB,MAAhB,CANZ;IAOE,OAAO,EAAEd;EAPX,gBASE,oBAAC,cAAD,OATF,CAlBF,CA7CF,CADF;AA8ED"}
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.bookingCalendarControlsDefaultClasses = void 0;
|
7
|
-
|
7
|
+
const bookingCalendarControlsDefaultClasses = {
|
8
8
|
className: 'bookingCalendar__controls',
|
9
9
|
monthLabelClassName: 'bookingCalendar__controls__monthLabel',
|
10
10
|
buttonsContainerClassName: 'bookingCalendar__controls__buttonsContainer',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"classes.js","names":["bookingCalendarControlsDefaultClasses","className","monthLabelClassName","buttonsContainerClassName","zoomLevelsContainerClassName","zoomBookingsButtonClassName"],"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarControls/classes.ts"],"sourcesContent":["export interface BookingCalendarControlsClasses {\r\n className?: string;\r\n monthLabelClassName?: string;\r\n zoomLevelsContainerClassName?: string;\r\n buttonsContainerClassName?: string;\r\n zoomBookingsButtonClassName?: string;\r\n}\r\n\r\nexport const bookingCalendarControlsDefaultClasses: BookingCalendarControlsClasses = {\r\n className: 'bookingCalendar__controls',\r\n monthLabelClassName: 'bookingCalendar__controls__monthLabel',\r\n buttonsContainerClassName: 'bookingCalendar__controls__buttonsContainer',\r\n zoomLevelsContainerClassName:\r\n 'bookingCalendar__controls__zoomLevelsContainer',\r\n zoomBookingsButtonClassName: 'bookingCalendar__controls__zoomBookingsButton',\r\n};\r\n"],"mappings":";;;;;;AAQO,MAAMA,qCAAqE,GAAG;EACnFC,SAAS,EAAE,2BADwE;EAEnFC,mBAAmB,EAAE,uCAF8D;EAGnFC,yBAAyB,EAAE,6CAHwD;EAInFC,4BAA4B,EAC1B,gDALiF;EAMnFC,2BAA2B,EAAE;AANsD,CAA9E"}
|
@@ -11,7 +11,7 @@ Object.keys(_BookingCalendarControls).forEach(function (key) {
|
|
11
11
|
if (key in exports && exports[key] === _BookingCalendarControls[key]) return;
|
12
12
|
Object.defineProperty(exports, key, {
|
13
13
|
enumerable: true,
|
14
|
-
get: function
|
14
|
+
get: function () {
|
15
15
|
return _BookingCalendarControls[key];
|
16
16
|
}
|
17
17
|
});
|
@@ -24,7 +24,7 @@ Object.keys(_classes).forEach(function (key) {
|
|
24
24
|
if (key in exports && exports[key] === _classes[key]) return;
|
25
25
|
Object.defineProperty(exports, key, {
|
26
26
|
enumerable: true,
|
27
|
-
get: function
|
27
|
+
get: function () {
|
28
28
|
return _classes[key];
|
29
29
|
}
|
30
30
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarControls/index.ts"],"
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarControls/index.ts"],"sourcesContent":["export * from './BookingCalendarControls';\r\nexport * from './classes';\r\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.js
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
@@ -19,21 +17,9 @@ var _ = require("..");
|
|
19
17
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
19
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
23
|
-
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
-
|
26
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
27
|
-
|
28
|
-
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."); }
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
29
21
|
|
30
|
-
function
|
31
|
-
|
32
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
33
|
-
|
34
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
35
|
-
|
36
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
37
23
|
|
38
24
|
var EventIcon = function EventIcon(props) {
|
39
25
|
return /*#__PURE__*/React.createElement("svg", props, /*#__PURE__*/React.createElement("path", {
|
@@ -50,27 +36,23 @@ EventIcon.defaultProps = {
|
|
50
36
|
|
51
37
|
try {
|
52
38
|
var DatePicker = require('react-datepicker').default;
|
53
|
-
} catch
|
39
|
+
} catch {
|
54
40
|
DatePicker = undefined;
|
55
41
|
} // import DatePicker from 'react-datepicker';
|
56
42
|
|
57
43
|
|
58
44
|
function BookingCalendarDatePicker(props) {
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
setShownModal = _React$useState2[1];
|
71
|
-
|
72
|
-
var calendarRef = React.useRef();
|
73
|
-
var onButtonClick = React.useCallback(function () {
|
45
|
+
const {
|
46
|
+
className,
|
47
|
+
buttonClassName,
|
48
|
+
from,
|
49
|
+
till,
|
50
|
+
onRangeChange,
|
51
|
+
getNewMomentFunction = _.defaultGetNewMomentFunction
|
52
|
+
} = props;
|
53
|
+
const [shownModal, setShownModal] = React.useState();
|
54
|
+
const calendarRef = React.useRef();
|
55
|
+
const onButtonClick = React.useCallback(() => {
|
74
56
|
setShownModal('start');
|
75
57
|
calendarRef.current.setOpen(true);
|
76
58
|
}, []);
|
@@ -91,10 +73,10 @@ function BookingCalendarDatePicker(props) {
|
|
91
73
|
endDate: till === null || till === void 0 ? void 0 : till.toDate(),
|
92
74
|
shouldCloseOnSelect: shownModal === 'end' //dateFormat={DAY_FORMAT}
|
93
75
|
,
|
94
|
-
onChange:
|
76
|
+
onChange: dt => {
|
95
77
|
if (shownModal !== 'end') {
|
96
|
-
|
97
|
-
|
78
|
+
const dtm = getNewMomentFunction(dt);
|
79
|
+
let validTill = till.clone();
|
98
80
|
|
99
81
|
if (dtm.isAfter(till)) {
|
100
82
|
validTill = dtm.clone().add(1, 'day');
|
@@ -106,17 +88,16 @@ function BookingCalendarDatePicker(props) {
|
|
106
88
|
});
|
107
89
|
setShownModal('end');
|
108
90
|
} else {
|
109
|
-
|
110
|
-
|
111
|
-
var validFrom = from.clone();
|
91
|
+
let dtm = getNewMomentFunction(dt).startOf('day').add(1, 'day');
|
92
|
+
let validFrom = from.clone();
|
112
93
|
|
113
|
-
if (
|
114
|
-
validFrom =
|
94
|
+
if (dtm.isBefore(from)) {
|
95
|
+
validFrom = dtm.clone().add(-1, 'day');
|
115
96
|
}
|
116
97
|
|
117
98
|
onRangeChange({
|
118
99
|
from: validFrom,
|
119
|
-
till:
|
100
|
+
till: dtm
|
120
101
|
});
|
121
102
|
setShownModal(null);
|
122
103
|
}
|
package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"BookingCalendarDatePicker.js","names":["EventIcon","DatePicker","require","default","undefined","BookingCalendarDatePicker","props","className","buttonClassName","from","till","onRangeChange","getNewMomentFunction","defaultGetNewMomentFunction","shownModal","setShownModal","React","useState","calendarRef","useRef","onButtonClick","useCallback","current","setOpen","classNames","bookingCalendarDatePickerDefaultClasses","toDate","dt","dtm","validTill","clone","isAfter","add","startOf","validFrom","isBefore"],"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport classNames from 'classnames';\r\nimport {\r\n BookingCalendarDatePickerClasses,\r\n bookingCalendarDatePickerDefaultClasses,\r\n} from './classes';\r\nimport { Moment } from 'moment';\r\nimport {\r\n BookingCalendarDateRange,\r\n BookingCalendarItemT,\r\n GetNewMomentFunctionType,\r\n} from '../common';\r\nimport { Button } from '../../button/Button';\r\nimport * as EventIcon from 'material-design-icons/action/svg/production/ic_event_24px.svg';\r\ntry {\r\n var DatePicker = require('react-datepicker').default;\r\n} catch {\r\n DatePicker = undefined;\r\n}\r\n// import DatePicker from 'react-datepicker';\r\nimport { defaultGetNewMomentFunction } from '..';\r\n\r\nexport interface BookingCalendarDatePickerBaseProps<\r\n T extends BookingCalendarItemT\r\n> {\r\n from: Moment;\r\n till: Moment;\r\n onRangeChange?: (range: BookingCalendarDateRange) => void;\r\n getNewMomentFunction?: GetNewMomentFunctionType;\r\n}\r\n\r\nexport interface BookingCalendarDatePickerProps<T extends BookingCalendarItemT>\r\n extends BookingCalendarDatePickerClasses,\r\n BookingCalendarDatePickerBaseProps<T> {}\r\n\r\nexport function BookingCalendarDatePicker<T extends BookingCalendarItemT>(\r\n props: BookingCalendarDatePickerProps<T>\r\n) {\r\n const {\r\n className,\r\n buttonClassName,\r\n from,\r\n till,\r\n onRangeChange,\r\n getNewMomentFunction = defaultGetNewMomentFunction,\r\n } = props;\r\n const [shownModal, setShownModal] = React.useState<null | 'start' | 'end'>();\r\n const calendarRef = React.useRef<typeof DatePicker>();\r\n const onButtonClick = React.useCallback(() => {\r\n setShownModal('start');\r\n calendarRef.current.setOpen(true);\r\n }, []);\r\n return (\r\n <div\r\n className={classNames(\r\n bookingCalendarDatePickerDefaultClasses.className,\r\n className\r\n )}\r\n >\r\n <Button\r\n className={classNames(\r\n bookingCalendarDatePickerDefaultClasses.buttonClassName,\r\n buttonClassName\r\n )}\r\n noShadow={true}\r\n onClick={onButtonClick}\r\n >\r\n <EventIcon />\r\n </Button>\r\n <DatePicker\r\n ref={calendarRef}\r\n customInput={<span />}\r\n selected={from?.toDate()}\r\n // selectsRange={true}\r\n selectsStart={shownModal !== 'end'}\r\n selectsEnd={shownModal === 'end'}\r\n startDate={from?.toDate()}\r\n endDate={till?.toDate()}\r\n shouldCloseOnSelect={shownModal === 'end'}\r\n //dateFormat={DAY_FORMAT}\r\n onChange={(dt: Date) => {\r\n if (shownModal !== 'end') {\r\n const dtm = getNewMomentFunction(dt);\r\n let validTill = till.clone();\r\n if (dtm.isAfter(till)) {\r\n validTill = dtm.clone().add(1, 'day');\r\n }\r\n onRangeChange({ from: dtm, till: validTill });\r\n setShownModal('end');\r\n } else {\r\n let dtm = getNewMomentFunction(dt)\r\n .startOf('day')\r\n .add(1, 'day');\r\n let validFrom = from.clone();\r\n if (dtm.isBefore(from)) {\r\n validFrom = dtm.clone().add(-1, 'day');\r\n }\r\n onRangeChange({ from: validFrom, till: dtm });\r\n setShownModal(null);\r\n }\r\n }}\r\n withPortal={true}\r\n />\r\n </div>\r\n );\r\n}\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAUA;;AAQA;;;;;;;;IAPYA,S,YAAAA,S;;;;;;AAAAA,S;;;;;;;AACZ,IAAI;EACF,IAAIC,UAAU,GAAGC,OAAO,CAAC,kBAAD,CAAP,CAA4BC,OAA7C;AACD,CAFD,CAEE,MAAM;EACNF,UAAU,GAAGG,SAAb;AACD,C,CACD;;;AAgBO,SAASC,yBAAT,CACLC,KADK,EAEL;EACA,MAAM;IACJC,SADI;IAEJC,eAFI;IAGJC,IAHI;IAIJC,IAJI;IAKJC,aALI;IAMJC,oBAAoB,GAAGC;EANnB,IAOFP,KAPJ;EAQA,MAAM,CAACQ,UAAD,EAAaC,aAAb,IAA8BC,KAAK,CAACC,QAAN,EAApC;EACA,MAAMC,WAAW,GAAGF,KAAK,CAACG,MAAN,EAApB;EACA,MAAMC,aAAa,GAAGJ,KAAK,CAACK,WAAN,CAAkB,MAAM;IAC5CN,aAAa,CAAC,OAAD,CAAb;IACAG,WAAW,CAACI,OAAZ,CAAoBC,OAApB,CAA4B,IAA5B;EACD,CAHqB,EAGnB,EAHmB,CAAtB;EAIA,oBACE;IACE,SAAS,EAAE,IAAAC,mBAAA,EACTC,gDAAA,CAAwClB,SAD/B,EAETA,SAFS;EADb,gBAME,oBAAC,cAAD;IACE,SAAS,EAAE,IAAAiB,mBAAA,EACTC,gDAAA,CAAwCjB,eAD/B,EAETA,eAFS,CADb;IAKE,QAAQ,EAAE,IALZ;IAME,OAAO,EAAEY;EANX,gBAQE,oBAAC,SAAD,OARF,CANF,eAgBE,oBAAC,UAAD;IACE,GAAG,EAAEF,WADP;IAEE,WAAW,eAAE,iCAFf;IAGE,QAAQ,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B,CAAD,CAAb;QACAb,aAAa,CAAC,IAAD,CAAb;MACD;IACF,CA/BH;IAgCE,UAAU,EAAE;EAhCd,EAhBF,CADF;AAqDD"}
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.bookingCalendarDatePickerDefaultClasses = void 0;
|
7
|
-
|
7
|
+
const bookingCalendarDatePickerDefaultClasses = {
|
8
8
|
className: 'bookingCalendar__datePicker',
|
9
9
|
buttonClassName: 'bookingCalendar__datePicker__button'
|
10
10
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"classes.js","names":["bookingCalendarDatePickerDefaultClasses","className","buttonClassName"],"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarDatePicker/classes.ts"],"sourcesContent":["export interface BookingCalendarDatePickerClasses {\r\n className?: string;\r\n buttonClassName?: string;\r\n}\r\n\r\nexport const bookingCalendarDatePickerDefaultClasses: BookingCalendarDatePickerClasses = {\r\n className: 'bookingCalendar__datePicker',\r\n buttonClassName: 'bookingCalendar__datePicker__button',\r\n};\r\n"],"mappings":";;;;;;AAKO,MAAMA,uCAAyE,GAAG;EACvFC,SAAS,EAAE,6BAD4E;EAEvFC,eAAe,EAAE;AAFsE,CAAlF"}
|
@@ -11,7 +11,7 @@ Object.keys(_BookingCalendarDatePicker).forEach(function (key) {
|
|
11
11
|
if (key in exports && exports[key] === _BookingCalendarDatePicker[key]) return;
|
12
12
|
Object.defineProperty(exports, key, {
|
13
13
|
enumerable: true,
|
14
|
-
get: function
|
14
|
+
get: function () {
|
15
15
|
return _BookingCalendarDatePicker[key];
|
16
16
|
}
|
17
17
|
});
|
@@ -24,7 +24,7 @@ Object.keys(_classes).forEach(function (key) {
|
|
24
24
|
if (key in exports && exports[key] === _classes[key]) return;
|
25
25
|
Object.defineProperty(exports, key, {
|
26
26
|
enumerable: true,
|
27
|
-
get: function
|
27
|
+
get: function () {
|
28
28
|
return _classes[key];
|
29
29
|
}
|
30
30
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarDatePicker/index.ts"],"
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarDatePicker/index.ts"],"sourcesContent":["export * from './BookingCalendarDatePicker';\r\nexport * from './classes';\r\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
@@ -15,34 +13,32 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
15
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
19
17
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
21
19
|
|
22
20
|
function BookingCalendarGrid(props) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
32
|
-
}, [dataRowsCount]);
|
21
|
+
const {
|
22
|
+
className,
|
23
|
+
gridItemClassName,
|
24
|
+
containerRef,
|
25
|
+
dataRowsCount,
|
26
|
+
items
|
27
|
+
} = props;
|
28
|
+
const style = React.useMemo(() => ({
|
29
|
+
gridRowEnd: `span ${dataRowsCount}`
|
30
|
+
}), [dataRowsCount]);
|
33
31
|
return /*#__PURE__*/React.createElement("div", {
|
34
32
|
className: (0, _classnames.default)(_classes.bookingCalendarGridDefaultClasses.className, className),
|
35
33
|
style: style,
|
36
34
|
ref: containerRef
|
37
|
-
}, items.map(
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
});
|
46
|
-
}));
|
35
|
+
}, items.map((item, key) => /*#__PURE__*/React.createElement("div", {
|
36
|
+
className: (0, _classnames.default)(_classes.bookingCalendarGridDefaultClasses.gridItemClassName, gridItemClassName),
|
37
|
+
key: key,
|
38
|
+
style: {
|
39
|
+
left: `${item.left * 100}%`,
|
40
|
+
opacity: 0.7 * item.opacity + 0.1
|
41
|
+
}
|
42
|
+
})));
|
47
43
|
}
|
48
44
|
//# sourceMappingURL=BookingCalendarGrid.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"BookingCalendarGrid.js","names":["BookingCalendarGrid","props","className","gridItemClassName","containerRef","dataRowsCount","items","style","React","useMemo","gridRowEnd","classNames","bookingCalendarGridDefaultClasses","map","item","key","left","opacity"],"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarGrid/BookingCalendarGrid.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport {\r\n BookingCalendarGridClasses,\r\n bookingCalendarGridDefaultClasses,\r\n} from './classes';\r\nimport classNames from 'classnames';\r\nimport { GridItem } from '../utils';\r\n\r\nexport interface BookingCalendarGridProps extends BookingCalendarGridClasses {\r\n items: GridItem[];\r\n containerRef: (elem: HTMLElement) => void;\r\n dataRowsCount: number;\r\n}\r\n\r\nexport function BookingCalendarGrid(props: BookingCalendarGridProps) {\r\n const {\r\n className,\r\n gridItemClassName,\r\n containerRef,\r\n dataRowsCount,\r\n items,\r\n } = props;\r\n const style = React.useMemo(() => ({ gridRowEnd: `span ${dataRowsCount}` }), [\r\n dataRowsCount,\r\n ]);\r\n return (\r\n <div\r\n className={classNames(\r\n bookingCalendarGridDefaultClasses.className,\r\n className\r\n )}\r\n style={style}\r\n ref={containerRef}\r\n >\r\n {items.map((item, key) => (\r\n <div\r\n className={classNames(\r\n bookingCalendarGridDefaultClasses.gridItemClassName,\r\n gridItemClassName\r\n )}\r\n key={key}\r\n style={{\r\n left: `${item.left * 100}%`,\r\n opacity: 0.7 * item.opacity + 0.1,\r\n }}\r\n />\r\n ))}\r\n </div>\r\n );\r\n}\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;;;;;;;AASO,SAASA,mBAAT,CAA6BC,KAA7B,EAA8D;EACnE,MAAM;IACJC,SADI;IAEJC,iBAFI;IAGJC,YAHI;IAIJC,aAJI;IAKJC;EALI,IAMFL,KANJ;EAOA,MAAMM,KAAK,GAAGC,KAAK,CAACC,OAAN,CAAc,OAAO;IAAEC,UAAU,EAAG,QAAOL,aAAc;EAApC,CAAP,CAAd,EAA+D,CAC3EA,aAD2E,CAA/D,CAAd;EAGA,oBACE;IACE,SAAS,EAAE,IAAAM,mBAAA,EACTC,0CAAA,CAAkCV,SADzB,EAETA,SAFS,CADb;IAKE,KAAK,EAAEK,KALT;IAME,GAAG,EAAEH;EANP,GAQGE,KAAK,CAACO,GAAN,CAAU,CAACC,IAAD,EAAOC,GAAP,kBACT;IACE,SAAS,EAAE,IAAAJ,mBAAA,EACTC,0CAAA,CAAkCT,iBADzB,EAETA,iBAFS,CADb;IAKE,GAAG,EAAEY,GALP;IAME,KAAK,EAAE;MACLC,IAAI,EAAG,GAAEF,IAAI,CAACE,IAAL,GAAY,GAAI,GADpB;MAELC,OAAO,EAAE,MAAMH,IAAI,CAACG,OAAX,GAAqB;IAFzB;EANT,EADD,CARH,CADF;AAwBD"}
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.bookingCalendarGridDefaultClasses = void 0;
|
7
|
-
|
7
|
+
const bookingCalendarGridDefaultClasses = {
|
8
8
|
className: 'bookingCalendar__grid',
|
9
9
|
gridItemClassName: 'bookingCalendar__grid__item'
|
10
10
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"classes.js","names":["bookingCalendarGridDefaultClasses","className","gridItemClassName"],"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarGrid/classes.ts"],"sourcesContent":["export interface BookingCalendarGridClasses {\r\n className?: string;\r\n gridItemClassName?: string;\r\n}\r\n\r\nexport const bookingCalendarGridDefaultClasses: BookingCalendarGridClasses = {\r\n className: 'bookingCalendar__grid',\r\n gridItemClassName: 'bookingCalendar__grid__item',\r\n};\r\n"],"mappings":";;;;;;AAKO,MAAMA,iCAA6D,GAAG;EAC3EC,SAAS,EAAE,uBADgE;EAE3EC,iBAAiB,EAAE;AAFwD,CAAtE"}
|
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
@@ -19,19 +17,18 @@ var _classes = require("./classes");
|
|
19
17
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
19
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
23
21
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
23
|
|
26
24
|
function BookingCalendarItem(props) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}, [marginStart, width]);
|
25
|
+
const {
|
26
|
+
className,
|
27
|
+
marginStart,
|
28
|
+
width,
|
29
|
+
BookingCalendarRenderItem = _BookingCalendarRenderItem.BookingCalendarRenderItem
|
30
|
+
} = props;
|
31
|
+
const style = React.useMemo(() => (0, _utils.getItemPositionStyle)(marginStart, width), [marginStart, width]);
|
35
32
|
return /*#__PURE__*/React.createElement("div", {
|
36
33
|
className: (0, _classnames.default)(_classes.bookingCalendarItemDefaultClasses.className, className),
|
37
34
|
style: style
|