guestbell-forms 2.0.297 → 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 +135 -177
- 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 +190 -216
- 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,17 +1,15 @@
|
|
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
|
});
|
8
|
-
exports.default = exports.
|
6
|
+
exports.default = exports.allTimeSpanUnits = exports.TimeSpanUnit = exports.TimeSpanRaw = exports.TimeSpan = void 0;
|
9
7
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
11
9
|
|
12
10
|
var _InputGroup = _interopRequireDefault(require("../inputGroup/InputGroup"));
|
13
11
|
|
14
|
-
var
|
12
|
+
var _BaseInput = require("../base/input/BaseInput");
|
15
13
|
|
16
14
|
var _withFormContext = require("../form/withFormContext");
|
17
15
|
|
@@ -21,31 +19,11 @@ var _withThemeContext = require("../themeProvider/withThemeContext");
|
|
21
19
|
|
22
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
21
|
|
24
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
25
|
-
|
26
|
-
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; }
|
27
|
-
|
28
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
29
|
-
|
30
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
31
|
-
|
32
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
33
|
-
|
34
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
22
|
+
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); }
|
35
23
|
|
36
|
-
function
|
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; }
|
37
25
|
|
38
|
-
function
|
39
|
-
|
40
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
41
|
-
|
42
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
43
|
-
|
44
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
45
|
-
|
46
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
47
|
-
|
48
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
26
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
49
27
|
|
50
28
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
51
29
|
|
@@ -64,7 +42,7 @@ ArrowIcon.defaultProps = {
|
|
64
42
|
|
65
43
|
var classNames = require('classnames');
|
66
44
|
|
67
|
-
|
45
|
+
let TimeSpanUnit;
|
68
46
|
exports.TimeSpanUnit = TimeSpanUnit;
|
69
47
|
|
70
48
|
(function (TimeSpanUnit) {
|
@@ -77,7 +55,7 @@ exports.TimeSpanUnit = TimeSpanUnit;
|
|
77
55
|
TimeSpanUnit[TimeSpanUnit["Year"] = 32] = "Year";
|
78
56
|
})(TimeSpanUnit || (exports.TimeSpanUnit = TimeSpanUnit = {}));
|
79
57
|
|
80
|
-
|
58
|
+
const allTimeSpanUnits = TimeSpanUnit.Day | TimeSpanUnit.Hour | TimeSpanUnit.Millisecond | TimeSpanUnit.Minute | TimeSpanUnit.Second | TimeSpanUnit.Year;
|
81
59
|
exports.allTimeSpanUnits = allTimeSpanUnits;
|
82
60
|
|
83
61
|
function getValues(enumeration) {
|
@@ -92,330 +70,298 @@ function getValues(enumeration) {
|
|
92
70
|
return values;
|
93
71
|
}
|
94
72
|
|
95
|
-
|
96
|
-
|
97
|
-
var TimeSpanRaw = /*#__PURE__*/function (_BaseInput) {
|
98
|
-
_inherits(TimeSpanRaw, _BaseInput);
|
73
|
+
const allUnits = getValues(TimeSpanUnit);
|
99
74
|
|
100
|
-
|
75
|
+
class TimeSpanRaw extends _BaseInput.BaseInput {
|
76
|
+
constructor(props) {
|
77
|
+
super(props);
|
101
78
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
_classCallCheck(this, TimeSpanRaw);
|
106
|
-
|
107
|
-
_this = _super.call(this, props);
|
108
|
-
|
109
|
-
_defineProperty(_assertThisInitialized(_this), "onBlur", function (e) {
|
110
|
-
_this.commitState();
|
111
|
-
|
112
|
-
_this.handleBlur(e);
|
79
|
+
_defineProperty(this, "onBlur", e => {
|
80
|
+
this.commitState();
|
81
|
+
this.handleBlur(e);
|
113
82
|
});
|
114
83
|
|
115
|
-
_defineProperty(
|
84
|
+
_defineProperty(this, "removeUnitClick", e => {
|
116
85
|
var _this$props$timeSpan;
|
117
86
|
|
118
87
|
e.preventDefault();
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
var newDate = (0, _moment.duration)((((_this$props$timeSpan = _this.props.timeSpan) === null || _this$props$timeSpan === void 0 ? void 0 : _this$props$timeSpan.asMilliseconds()) || 0) + diff, 'millisecond');
|
124
|
-
|
125
|
-
_this.handleLimits(newDate);
|
88
|
+
const unit = Number(e.currentTarget.dataset.unit);
|
89
|
+
const diff = -1 * this.oneUnitInMs(unit);
|
90
|
+
const newDate = (0, _moment.duration)((((_this$props$timeSpan = this.props.timeSpan) === null || _this$props$timeSpan === void 0 ? void 0 : _this$props$timeSpan.asMilliseconds()) || 0) + diff, 'millisecond');
|
91
|
+
this.handleLimits(newDate);
|
126
92
|
});
|
127
93
|
|
128
|
-
_defineProperty(
|
94
|
+
_defineProperty(this, "onUnitChanged", e => {
|
129
95
|
// this.handleHoursChange(e.target.value);
|
130
|
-
|
131
|
-
|
132
|
-
_this.setState({
|
96
|
+
const unit = Number(e.currentTarget.dataset.unit);
|
97
|
+
this.setState({
|
133
98
|
currentUnitText: e.target.value,
|
134
99
|
currentUnit: unit
|
135
100
|
});
|
136
101
|
});
|
137
102
|
|
138
|
-
_defineProperty(
|
103
|
+
_defineProperty(this, "onKeyDown", e => {
|
139
104
|
if (e.key === 'Enter') {
|
140
|
-
|
105
|
+
this.commitState();
|
141
106
|
}
|
142
107
|
});
|
143
108
|
|
144
|
-
_defineProperty(
|
109
|
+
_defineProperty(this, "addUnitClick", e => {
|
145
110
|
var _this$props$timeSpan2;
|
146
111
|
|
147
112
|
e.preventDefault();
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
var newDate = (0, _moment.duration)((((_this$props$timeSpan2 = _this.props.timeSpan) === null || _this$props$timeSpan2 === void 0 ? void 0 : _this$props$timeSpan2.asMilliseconds()) || 0) + diff, 'milliseconds');
|
153
|
-
|
154
|
-
_this.handleLimits(newDate);
|
113
|
+
const unit = Number(e.currentTarget.dataset.unit);
|
114
|
+
const diff = this.oneUnitInMs(unit);
|
115
|
+
const newDate = (0, _moment.duration)((((_this$props$timeSpan2 = this.props.timeSpan) === null || _this$props$timeSpan2 === void 0 ? void 0 : _this$props$timeSpan2.asMilliseconds()) || 0) + diff, 'milliseconds');
|
116
|
+
this.handleLimits(newDate);
|
155
117
|
});
|
156
118
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
119
|
+
this.removeUnitClick = this.removeUnitClick.bind(this);
|
120
|
+
this.addUnitClick = this.addUnitClick.bind(this);
|
121
|
+
this.onUnitChanged = this.onUnitChanged.bind(this);
|
122
|
+
}
|
123
|
+
|
124
|
+
render() {
|
125
|
+
const {
|
126
|
+
timeSpan,
|
127
|
+
validUnits,
|
128
|
+
initialUnits,
|
129
|
+
units: _units
|
130
|
+
} = this.props;
|
131
|
+
|
132
|
+
const units = _units || this.getUnits(timeSpan, validUnits, initialUnits);
|
133
|
+
|
134
|
+
const unitsArr = allUnits.filter(u => (units & u) !== 0).reverse();
|
135
|
+
return /*#__PURE__*/React.createElement(_InputGroup.default, {
|
136
|
+
title: this.props.title,
|
137
|
+
tooltip: this.props.tooltip
|
138
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, this.props.id && {
|
139
|
+
id: this.props.id
|
140
|
+
}, {
|
141
|
+
className: 'input__base timeSpan-input ' + this.getValidationClass() + ' ' + (this.props.className ? this.props.className : ''),
|
142
|
+
ref: this.containerRef
|
143
|
+
}), unitsArr.map(unit => /*#__PURE__*/React.createElement("div", {
|
144
|
+
className: "",
|
145
|
+
key: unit
|
146
|
+
}, /*#__PURE__*/React.createElement("div", {
|
147
|
+
className: "timeSpan-input__arrows__container"
|
148
|
+
}, /*#__PURE__*/React.createElement("button", _extends({
|
149
|
+
className: "plus",
|
150
|
+
onClick: this.addUnitClick
|
151
|
+
}, this.props.id && {
|
152
|
+
id: this.props.id + '-add-hours-button'
|
153
|
+
}, {
|
154
|
+
"data-unit": unit,
|
155
|
+
tabIndex: 0
|
156
|
+
}), /*#__PURE__*/React.createElement(ArrowIcon, null)), /*#__PURE__*/React.createElement("div", {
|
157
|
+
className: "input-padding"
|
158
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, this.props.id && {
|
159
|
+
id: this.props.id + '-' + unit + '-input'
|
160
|
+
}, {
|
161
|
+
disabled: this.getDisabled(),
|
162
|
+
required: this.props.required,
|
163
|
+
className: classNames('timeSpan-input__time', {
|
164
|
+
filled: this.state.value,
|
165
|
+
'timeSpan-input__time--ms': unit === TimeSpanUnit.Millisecond
|
166
|
+
}),
|
167
|
+
onChange: this.onUnitChanged,
|
168
|
+
value: this.state.currentUnit === unit ? this.state.currentUnitText : this.getValue(timeSpan, unit),
|
169
|
+
onBlur: this.onBlur,
|
170
|
+
onFocus: this.handleFocus,
|
171
|
+
type: "number",
|
172
|
+
"data-unit": unit,
|
173
|
+
onKeyDown: this.onKeyDown
|
174
|
+
})), /*#__PURE__*/React.createElement("span", {
|
175
|
+
className: "highlight"
|
176
|
+
})), /*#__PURE__*/React.createElement("button", _extends({
|
177
|
+
className: "minus",
|
178
|
+
onClick: this.removeUnitClick
|
179
|
+
}, this.props.id && {
|
180
|
+
id: this.props.id + '-subtract-hours-button'
|
181
|
+
}, {
|
182
|
+
"data-unit": unit,
|
183
|
+
tabIndex: 0
|
184
|
+
}), /*#__PURE__*/React.createElement(ArrowIcon, null))), this.props.unitToString(unit))), this.renderDefaultValidation(), /*#__PURE__*/React.createElement("span", {
|
185
|
+
className: "highlight"
|
186
|
+
}), /*#__PURE__*/React.createElement("span", {
|
187
|
+
className: 'bar ' + (this.state.focused ? 'focused' : '')
|
188
|
+
}), this.props.label && /*#__PURE__*/React.createElement("label", {
|
189
|
+
className: classNames('timeSpan-input__label label--focused')
|
190
|
+
}, this.renderLabel())));
|
161
191
|
}
|
162
192
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
var _this2 = this;
|
167
|
-
|
168
|
-
var _this$props = this.props,
|
169
|
-
timeSpan = _this$props.timeSpan,
|
170
|
-
validUnits = _this$props.validUnits,
|
171
|
-
initialUnits = _this$props.initialUnits,
|
172
|
-
_units = _this$props.units;
|
173
|
-
|
174
|
-
var units = _units || this.getUnits(timeSpan, validUnits, initialUnits);
|
175
|
-
|
176
|
-
var unitsArr = allUnits.filter(function (u) {
|
177
|
-
return (units & u) !== 0;
|
178
|
-
}).reverse();
|
179
|
-
return /*#__PURE__*/React.createElement(_InputGroup.default, {
|
180
|
-
title: this.props.title,
|
181
|
-
tooltip: this.props.tooltip
|
182
|
-
}, /*#__PURE__*/React.createElement("div", _extends({}, this.props.id && {
|
183
|
-
id: this.props.id
|
184
|
-
}, {
|
185
|
-
className: 'input__base timeSpan-input ' + this.getValidationClass() + ' ' + (this.props.className ? this.props.className : ''),
|
186
|
-
ref: this.containerRef
|
187
|
-
}), unitsArr.map(function (unit) {
|
188
|
-
return /*#__PURE__*/React.createElement("div", {
|
189
|
-
className: "",
|
190
|
-
key: unit
|
191
|
-
}, /*#__PURE__*/React.createElement("div", {
|
192
|
-
className: "timeSpan-input__arrows__container"
|
193
|
-
}, /*#__PURE__*/React.createElement("button", _extends({
|
194
|
-
className: "plus",
|
195
|
-
onClick: _this2.addUnitClick
|
196
|
-
}, _this2.props.id && {
|
197
|
-
id: _this2.props.id + '-add-hours-button'
|
198
|
-
}, {
|
199
|
-
"data-unit": unit,
|
200
|
-
tabIndex: 0
|
201
|
-
}), /*#__PURE__*/React.createElement(ArrowIcon, null)), /*#__PURE__*/React.createElement("div", {
|
202
|
-
className: "input-padding"
|
203
|
-
}, /*#__PURE__*/React.createElement("input", _extends({}, _this2.props.id && {
|
204
|
-
id: _this2.props.id + '-' + unit + '-input'
|
205
|
-
}, {
|
206
|
-
disabled: _this2.getDisabled(),
|
207
|
-
required: _this2.props.required,
|
208
|
-
className: classNames('timeSpan-input__time', {
|
209
|
-
filled: _this2.state.value,
|
210
|
-
'timeSpan-input__time--ms': unit === TimeSpanUnit.Millisecond
|
211
|
-
}),
|
212
|
-
onChange: _this2.onUnitChanged,
|
213
|
-
value: _this2.state.currentUnit === unit ? _this2.state.currentUnitText : _this2.getValue(timeSpan, unit),
|
214
|
-
onBlur: _this2.onBlur,
|
215
|
-
onFocus: _this2.handleFocus,
|
216
|
-
type: "number",
|
217
|
-
"data-unit": unit,
|
218
|
-
onKeyDown: _this2.onKeyDown
|
219
|
-
})), /*#__PURE__*/React.createElement("span", {
|
220
|
-
className: "highlight"
|
221
|
-
})), /*#__PURE__*/React.createElement("button", _extends({
|
222
|
-
className: "minus",
|
223
|
-
onClick: _this2.removeUnitClick
|
224
|
-
}, _this2.props.id && {
|
225
|
-
id: _this2.props.id + '-subtract-hours-button'
|
226
|
-
}, {
|
227
|
-
"data-unit": unit,
|
228
|
-
tabIndex: 0
|
229
|
-
}), /*#__PURE__*/React.createElement(ArrowIcon, null))), _this2.props.unitToString(unit));
|
230
|
-
}), this.renderDefaultValidation(), /*#__PURE__*/React.createElement("span", {
|
231
|
-
className: "highlight"
|
232
|
-
}), /*#__PURE__*/React.createElement("span", {
|
233
|
-
className: 'bar ' + (this.state.focused ? 'focused' : '')
|
234
|
-
}), this.props.label && /*#__PURE__*/React.createElement("label", {
|
235
|
-
className: classNames('timeSpan-input__label label--focused')
|
236
|
-
}, this.renderLabel())));
|
193
|
+
getUnits(time, validUnits, initialUnits) {
|
194
|
+
if (time === null || time === undefined) {
|
195
|
+
return initialUnits;
|
237
196
|
}
|
238
|
-
}, {
|
239
|
-
key: "getUnits",
|
240
|
-
value: function getUnits(time, validUnits, initialUnits) {
|
241
|
-
if (time === null || time === undefined) {
|
242
|
-
return initialUnits;
|
243
|
-
}
|
244
197
|
|
245
|
-
|
246
|
-
|
198
|
+
const ms = time.asMilliseconds();
|
199
|
+
let units = TimeSpanUnit.Millisecond | TimeSpanUnit.Second;
|
247
200
|
|
248
|
-
|
249
|
-
|
250
|
-
|
201
|
+
if (ms >= 1000) {
|
202
|
+
units += TimeSpanUnit.Minute;
|
203
|
+
}
|
251
204
|
|
252
|
-
|
253
|
-
|
254
|
-
|
205
|
+
if (ms >= 60000) {
|
206
|
+
units += TimeSpanUnit.Hour;
|
207
|
+
}
|
255
208
|
|
256
|
-
|
257
|
-
|
258
|
-
|
209
|
+
if (ms >= 60 * 60000) {
|
210
|
+
units += TimeSpanUnit.Day;
|
211
|
+
}
|
259
212
|
|
260
|
-
|
261
|
-
|
262
|
-
|
213
|
+
if (ms >= 24 * 60 * 60000) {
|
214
|
+
units += TimeSpanUnit.Year;
|
215
|
+
}
|
216
|
+
|
217
|
+
const tagMask = allTimeSpanUnits & ~validUnits;
|
218
|
+
units &= ~tagMask;
|
219
|
+
return units || initialUnits;
|
220
|
+
}
|
263
221
|
|
264
|
-
|
265
|
-
|
266
|
-
return
|
222
|
+
getValue(time, unit) {
|
223
|
+
if (!time || !unit) {
|
224
|
+
return 0;
|
267
225
|
}
|
268
|
-
}, {
|
269
|
-
key: "getValue",
|
270
|
-
value: function getValue(time, unit) {
|
271
|
-
if (!time || !unit) {
|
272
|
-
return 0;
|
273
|
-
}
|
274
226
|
|
275
|
-
|
276
|
-
|
277
|
-
|
227
|
+
switch (unit) {
|
228
|
+
case TimeSpanUnit.Millisecond:
|
229
|
+
return Math.floor(time.get('millisecond'));
|
278
230
|
|
279
|
-
|
280
|
-
|
231
|
+
case TimeSpanUnit.Second:
|
232
|
+
return Math.floor(time.get('second'));
|
281
233
|
|
282
|
-
|
283
|
-
|
234
|
+
case TimeSpanUnit.Minute:
|
235
|
+
return Math.floor(time.get('minute'));
|
284
236
|
|
285
|
-
|
286
|
-
|
237
|
+
case TimeSpanUnit.Hour:
|
238
|
+
return Math.floor(time.get('hour'));
|
287
239
|
|
288
|
-
|
289
|
-
|
240
|
+
case TimeSpanUnit.Day:
|
241
|
+
return Math.floor(time.get('day'));
|
290
242
|
|
291
|
-
|
292
|
-
|
243
|
+
case TimeSpanUnit.Year:
|
244
|
+
return Math.floor(time.get('year'));
|
293
245
|
|
294
|
-
|
295
|
-
return 0;
|
296
|
-
}
|
297
|
-
}
|
298
|
-
}, {
|
299
|
-
key: "oneUnitInMs",
|
300
|
-
value: function oneUnitInMs(unit) {
|
301
|
-
if (!unit) {
|
246
|
+
default:
|
302
247
|
return 0;
|
303
|
-
|
248
|
+
}
|
249
|
+
}
|
304
250
|
|
305
|
-
|
306
|
-
|
307
|
-
|
251
|
+
oneUnitInMs(unit) {
|
252
|
+
if (!unit) {
|
253
|
+
return 0;
|
254
|
+
}
|
308
255
|
|
309
|
-
|
310
|
-
|
256
|
+
switch (unit) {
|
257
|
+
case TimeSpanUnit.Millisecond:
|
258
|
+
return 1;
|
311
259
|
|
312
|
-
|
313
|
-
|
260
|
+
case TimeSpanUnit.Second:
|
261
|
+
return 1000;
|
314
262
|
|
315
|
-
|
316
|
-
|
263
|
+
case TimeSpanUnit.Minute:
|
264
|
+
return 60000;
|
317
265
|
|
318
|
-
|
319
|
-
|
266
|
+
case TimeSpanUnit.Hour:
|
267
|
+
return 3600000;
|
320
268
|
|
321
|
-
|
322
|
-
|
269
|
+
case TimeSpanUnit.Day:
|
270
|
+
return 24 * 3600000;
|
323
271
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
}, {
|
329
|
-
key: "maxOfUnit",
|
330
|
-
value: function maxOfUnit(unit) {
|
331
|
-
if (!unit) {
|
272
|
+
case TimeSpanUnit.Year:
|
273
|
+
return 24 * 365 * 3600000;
|
274
|
+
|
275
|
+
default:
|
332
276
|
return 0;
|
333
|
-
|
277
|
+
}
|
278
|
+
}
|
334
279
|
|
335
|
-
|
336
|
-
|
337
|
-
|
280
|
+
maxOfUnit(unit) {
|
281
|
+
if (!unit) {
|
282
|
+
return 0;
|
283
|
+
}
|
338
284
|
|
339
|
-
|
340
|
-
|
285
|
+
switch (unit) {
|
286
|
+
case TimeSpanUnit.Millisecond:
|
287
|
+
return 1000;
|
341
288
|
|
342
|
-
|
343
|
-
|
289
|
+
case TimeSpanUnit.Second:
|
290
|
+
return 60;
|
344
291
|
|
345
|
-
|
346
|
-
|
292
|
+
case TimeSpanUnit.Minute:
|
293
|
+
return 60;
|
347
294
|
|
348
|
-
|
349
|
-
|
295
|
+
case TimeSpanUnit.Hour:
|
296
|
+
return 24;
|
350
297
|
|
351
|
-
|
352
|
-
|
298
|
+
case TimeSpanUnit.Day:
|
299
|
+
return 365;
|
353
300
|
|
354
|
-
|
355
|
-
|
356
|
-
}
|
357
|
-
}
|
358
|
-
}, {
|
359
|
-
key: "commitState",
|
360
|
-
value: function commitState() {
|
361
|
-
if (this.state.currentUnit) {
|
362
|
-
var num = Number(this.state.currentUnitText);
|
363
|
-
|
364
|
-
if (!isNaN(num)) {
|
365
|
-
var newOfUnitMs = num * this.oneUnitInMs(this.state.currentUnit);
|
366
|
-
var oldOfUnitMs = this.getValue(this.props.timeSpan, this.state.currentUnit) * this.oneUnitInMs(this.state.currentUnit);
|
367
|
-
var maxOfUnitMs = this.maxOfUnit(this.state.currentUnit) * this.oneUnitInMs(this.state.currentUnit);
|
368
|
-
var moreThanMax = maxOfUnitMs < newOfUnitMs;
|
369
|
-
var diff = newOfUnitMs - oldOfUnitMs;
|
370
|
-
|
371
|
-
if (moreThanMax) {
|
372
|
-
this.handleLimits((0, _moment.duration)(newOfUnitMs, 'millisecond'));
|
373
|
-
} else {
|
374
|
-
var _this$props$timeSpan3;
|
375
|
-
|
376
|
-
this.handleLimits((0, _moment.duration)((((_this$props$timeSpan3 = this.props.timeSpan) === null || _this$props$timeSpan3 === void 0 ? void 0 : _this$props$timeSpan3.asMilliseconds()) || 0) + diff, 'millisecond'));
|
377
|
-
}
|
378
|
-
}
|
301
|
+
case TimeSpanUnit.Year:
|
302
|
+
return 9999;
|
379
303
|
|
380
|
-
|
381
|
-
|
382
|
-
currentUnitText: undefined
|
383
|
-
});
|
384
|
-
}
|
304
|
+
default:
|
305
|
+
return 0;
|
385
306
|
}
|
386
|
-
}
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
307
|
+
}
|
308
|
+
|
309
|
+
commitState() {
|
310
|
+
if (this.state.currentUnit) {
|
311
|
+
var num = Number(this.state.currentUnitText);
|
312
|
+
|
313
|
+
if (!isNaN(num)) {
|
314
|
+
const newOfUnitMs = num * this.oneUnitInMs(this.state.currentUnit);
|
315
|
+
const oldOfUnitMs = this.getValue(this.props.timeSpan, this.state.currentUnit) * this.oneUnitInMs(this.state.currentUnit);
|
316
|
+
const maxOfUnitMs = this.maxOfUnit(this.state.currentUnit) * this.oneUnitInMs(this.state.currentUnit);
|
317
|
+
const moreThanMax = maxOfUnitMs < newOfUnitMs;
|
318
|
+
const diff = newOfUnitMs - oldOfUnitMs;
|
319
|
+
|
320
|
+
if (moreThanMax) {
|
321
|
+
this.handleLimits((0, _moment.duration)(newOfUnitMs, 'millisecond'));
|
322
|
+
} else {
|
323
|
+
var _this$props$timeSpan3;
|
324
|
+
|
325
|
+
this.handleLimits((0, _moment.duration)((((_this$props$timeSpan3 = this.props.timeSpan) === null || _this$props$timeSpan3 === void 0 ? void 0 : _this$props$timeSpan3.asMilliseconds()) || 0) + diff, 'millisecond'));
|
393
326
|
}
|
394
327
|
}
|
395
328
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
329
|
+
this.setState({
|
330
|
+
currentUnit: undefined,
|
331
|
+
currentUnitText: undefined
|
332
|
+
});
|
333
|
+
}
|
334
|
+
}
|
335
|
+
|
336
|
+
handleLimits(time) {
|
337
|
+
if (this.props.min) {
|
338
|
+
if (time.asMilliseconds() - this.props.min.asMilliseconds() <= 0) {
|
339
|
+
this.props.timeSpanChange(this.props.min.clone());
|
340
|
+
return;
|
401
341
|
}
|
342
|
+
}
|
402
343
|
|
403
|
-
|
344
|
+
if (this.props.max) {
|
345
|
+
if (this.props.max.asMilliseconds() - time.asMilliseconds() <= 0) {
|
346
|
+
this.props.timeSpanChange(this.props.max.clone());
|
347
|
+
return;
|
348
|
+
}
|
404
349
|
}
|
405
|
-
}]);
|
406
350
|
|
407
|
-
|
408
|
-
}
|
351
|
+
this.props.timeSpanChange(time);
|
352
|
+
}
|
353
|
+
|
354
|
+
}
|
409
355
|
|
410
356
|
exports.TimeSpanRaw = TimeSpanRaw;
|
411
357
|
|
412
|
-
_defineProperty(TimeSpanRaw, "defaultProps", Object.assign({},
|
358
|
+
_defineProperty(TimeSpanRaw, "defaultProps", Object.assign({}, _BaseInput.BaseInput.defaultProps, {
|
413
359
|
type: 'time',
|
414
360
|
placeholder: '',
|
415
361
|
validUnits: allTimeSpanUnits,
|
416
362
|
initialUnits: allTimeSpanUnits,
|
417
363
|
units: TimeSpanUnit.Dynamic,
|
418
|
-
unitToString:
|
364
|
+
unitToString: unit => {
|
419
365
|
switch (unit) {
|
420
366
|
case TimeSpanUnit.Millisecond:
|
421
367
|
return 'ms';
|
@@ -442,7 +388,7 @@ _defineProperty(TimeSpanRaw, "defaultProps", Object.assign({}, _BaseInput2.BaseI
|
|
442
388
|
min: (0, _moment.duration)(0)
|
443
389
|
}));
|
444
390
|
|
445
|
-
|
391
|
+
const TimeSpan = (0, _withThemeContext.withThemeContext)((0, _withFormContext.withFormContext)(TimeSpanRaw), 'timeSpan');
|
446
392
|
exports.TimeSpan = TimeSpan;
|
447
393
|
var _default = TimeSpan;
|
448
394
|
exports.default = _default;
|