guestbell-forms 2.0.298 → 2.0.300
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,11 +1,9 @@
|
|
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.
|
6
|
+
exports.defaultBaseTranslations = exports.default = exports.BaseInput = void 0;
|
9
7
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
11
9
|
|
@@ -21,68 +19,38 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
29
|
-
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
31
|
-
|
32
|
-
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); }
|
33
|
-
|
34
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35
|
-
|
36
|
-
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); } }
|
37
|
-
|
38
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
39
|
-
|
40
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
41
|
-
|
42
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
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); }
|
43
23
|
|
44
|
-
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; }
|
45
25
|
|
46
|
-
function
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
47
27
|
|
48
|
-
function
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
49
29
|
|
50
|
-
function
|
51
|
-
|
52
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
30
|
+
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); }
|
53
31
|
|
54
32
|
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; }
|
55
33
|
|
56
|
-
|
34
|
+
const defaultBaseTranslations = {
|
57
35
|
required: 'Required'
|
58
36
|
};
|
59
37
|
exports.defaultBaseTranslations = defaultBaseTranslations;
|
60
38
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
function BaseInput(props) {
|
67
|
-
var _this;
|
68
|
-
|
69
|
-
var subscribe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
70
|
-
|
71
|
-
_classCallCheck(this, BaseInput);
|
39
|
+
class BaseInput extends React.Component {
|
40
|
+
constructor(props) {
|
41
|
+
let subscribe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
42
|
+
super(props);
|
72
43
|
|
73
|
-
|
44
|
+
_defineProperty(this, "componentId", (0, _Guid.default)());
|
74
45
|
|
75
|
-
_defineProperty(
|
46
|
+
_defineProperty(this, "inputRef", void 0);
|
76
47
|
|
77
|
-
_defineProperty(
|
48
|
+
_defineProperty(this, "containerRef", void 0);
|
78
49
|
|
79
|
-
_defineProperty(
|
50
|
+
_defineProperty(this, "lastValidation", void 0);
|
80
51
|
|
81
|
-
|
82
|
-
|
83
|
-
var res = _this.handleValueChange(_this.props.value, true, [], props, true);
|
84
|
-
|
85
|
-
_this.state = {
|
52
|
+
const res = this.handleValueChange(this.props.value, true, [], props, true);
|
53
|
+
this.state = {
|
86
54
|
isValid: res.isValid,
|
87
55
|
errors: res.errors,
|
88
56
|
value: props.value ? props.value : '',
|
@@ -91,191 +59,187 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
91
59
|
focused: false,
|
92
60
|
handleValueChangeEnabled: true
|
93
61
|
};
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
62
|
+
this.containerRef = /*#__PURE__*/React.createRef();
|
63
|
+
this.inputRef = /*#__PURE__*/React.createRef();
|
64
|
+
this.handleChange = this.handleChange.bind(this);
|
65
|
+
this.handleBlur = this.handleBlur.bind(this);
|
66
|
+
this.handleFocus = this.handleFocus.bind(this);
|
67
|
+
this.setValid = this.setValid.bind(this);
|
68
|
+
this.focus = this.focus.bind(this);
|
69
|
+
this.scrollTo = this.scrollTo.bind(this);
|
70
|
+
this.setInvalid = this.setInvalid.bind(this);
|
71
|
+
this.disableComponent = this.disableComponent.bind(this);
|
72
|
+
this.enableComponent = this.enableComponent.bind(this);
|
73
|
+
this.touch = this.touch.bind(this);
|
74
|
+
this.unTouch = this.unTouch.bind(this);
|
107
75
|
|
108
76
|
if (subscribe) {
|
109
|
-
|
77
|
+
this.subscribeSelf(props);
|
110
78
|
}
|
111
|
-
|
112
|
-
return _this;
|
113
79
|
}
|
114
80
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
if (!this.props.ignoreContext) {
|
119
|
-
this.props.formContext && this.props.formContext.unSubscribe(this.componentId);
|
120
|
-
}
|
81
|
+
componentWillUnmount() {
|
82
|
+
if (!this.props.ignoreContext) {
|
83
|
+
this.props.formContext && this.props.formContext.unSubscribe(this.componentId);
|
121
84
|
}
|
122
|
-
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
}
|
128
|
-
}
|
129
|
-
}, {
|
130
|
-
key: "scrollTo",
|
131
|
-
value: function scrollTo() {
|
132
|
-
var domNode = ReactDOM.findDOMNode(this.containerRef.current);
|
133
|
-
domNode && domNode.scrollIntoView({
|
134
|
-
behavior: 'smooth'
|
135
|
-
});
|
85
|
+
}
|
86
|
+
|
87
|
+
componentDidUpdate(oldProps, oldState) {
|
88
|
+
if (oldProps.value !== this.props.value || oldProps.validators !== this.props.validators || oldProps.customValidators !== this.props.customValidators || oldProps.required !== this.props.required) {
|
89
|
+
this.handleValueChange(this.props.value, true, [], this.props);
|
136
90
|
}
|
137
|
-
}
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
91
|
+
}
|
92
|
+
|
93
|
+
scrollTo() {
|
94
|
+
const domNode = ReactDOM.findDOMNode(this.containerRef.current);
|
95
|
+
domNode && domNode.scrollIntoView({
|
96
|
+
behavior: 'smooth'
|
97
|
+
});
|
98
|
+
}
|
99
|
+
|
100
|
+
touch() {
|
101
|
+
this.setState({
|
102
|
+
touched: true
|
103
|
+
});
|
104
|
+
this.handleValueChange(this.state.value || '');
|
105
|
+
}
|
106
|
+
|
107
|
+
unTouch() {
|
108
|
+
this.setState({
|
109
|
+
touched: false
|
110
|
+
});
|
111
|
+
}
|
112
|
+
|
113
|
+
disableComponent() {
|
114
|
+
this.setState({
|
115
|
+
disabled: true
|
116
|
+
});
|
117
|
+
}
|
118
|
+
|
119
|
+
enableComponent() {
|
120
|
+
this.setState({
|
121
|
+
disabled: false
|
122
|
+
});
|
123
|
+
}
|
124
|
+
|
125
|
+
focus() {
|
126
|
+
if (this.inputRef) {
|
127
|
+
const domNode = ReactDOM.findDOMNode(this.inputRef.current);
|
128
|
+
domNode && domNode.focus();
|
144
129
|
}
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
130
|
+
|
131
|
+
this.touch();
|
132
|
+
}
|
133
|
+
|
134
|
+
shouldComponentUpdate(nextProps, nextState) {
|
135
|
+
let shouldUpdate = !(0, _ShallowEqual.shallowEqual)(this.props, nextProps, !this.props.reRendersWhenContextChanges ? 'formContext' : undefined) || !(0, _ShallowEqual.shallowEqual)(this.state, nextState);
|
136
|
+
return shouldUpdate;
|
137
|
+
}
|
138
|
+
|
139
|
+
getValidationClass(extraErrors) {
|
140
|
+
if (!this.props.showValidation || !this.state.touched) {
|
141
|
+
return 'validation__success';
|
151
142
|
}
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
143
|
+
|
144
|
+
return this.state.isValid && (!this.props.errors || this.props.errors.length === 0) && (!this.state.errors || this.state.errors.length === 0) && (!extraErrors || extraErrors.length === 0) ? 'validation__success' : 'validation__error';
|
145
|
+
}
|
146
|
+
|
147
|
+
renderDefaultValidation(extraErrors) {
|
148
|
+
if (this.props.disabled) {
|
149
|
+
return null;
|
158
150
|
}
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
this.setState({
|
163
|
-
disabled: false
|
164
|
-
});
|
151
|
+
|
152
|
+
if (!this.props.showValidation) {
|
153
|
+
return null;
|
165
154
|
}
|
166
|
-
}, {
|
167
|
-
key: "focus",
|
168
|
-
value: function focus() {
|
169
|
-
if (this.inputRef) {
|
170
|
-
var domNode = ReactDOM.findDOMNode(this.inputRef.current);
|
171
|
-
domNode && domNode.focus();
|
172
|
-
}
|
173
155
|
|
174
|
-
|
156
|
+
let finalErrors = this.state.errors;
|
157
|
+
|
158
|
+
if (!finalErrors) {
|
159
|
+
finalErrors = [];
|
175
160
|
}
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
var shouldUpdate = !(0, _ShallowEqual.shallowEqual)(this.props, nextProps, !this.props.reRendersWhenContextChanges ? 'formContext' : undefined) || !(0, _ShallowEqual.shallowEqual)(this.state, nextState);
|
180
|
-
return shouldUpdate;
|
161
|
+
|
162
|
+
if (extraErrors) {
|
163
|
+
finalErrors = finalErrors.concat(extraErrors);
|
181
164
|
}
|
182
|
-
}, {
|
183
|
-
key: "getValidationClass",
|
184
|
-
value: function getValidationClass(extraErrors) {
|
185
|
-
if (!this.props.showValidation || !this.state.touched) {
|
186
|
-
return 'validation__success';
|
187
|
-
}
|
188
165
|
|
189
|
-
|
166
|
+
if (this.props.errors) {
|
167
|
+
finalErrors = finalErrors.concat(this.props.errors);
|
190
168
|
}
|
191
|
-
}, {
|
192
|
-
key: "renderDefaultValidation",
|
193
|
-
value: function renderDefaultValidation(extraErrors) {
|
194
|
-
if (this.props.disabled) {
|
195
|
-
return null;
|
196
|
-
}
|
197
169
|
|
198
|
-
|
199
|
-
return null;
|
200
|
-
}
|
170
|
+
finalErrors = finalErrors.filter(i => i);
|
201
171
|
|
202
|
-
|
172
|
+
if (finalErrors.length > 0) {
|
173
|
+
this.lastValidation = finalErrors.map((item, index) => /*#__PURE__*/React.createElement("li", {
|
174
|
+
key: index,
|
175
|
+
className: "validation__item"
|
176
|
+
}, item));
|
177
|
+
}
|
203
178
|
|
204
|
-
|
205
|
-
|
206
|
-
|
179
|
+
return /*#__PURE__*/React.createElement("div", {
|
180
|
+
className: "validation__container"
|
181
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
182
|
+
className: "validation__ul"
|
183
|
+
}, this.lastValidation));
|
184
|
+
}
|
207
185
|
|
208
|
-
|
209
|
-
|
210
|
-
|
186
|
+
handleChange(event, isValid) {
|
187
|
+
let errors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
188
|
+
let value = event.target.value;
|
211
189
|
|
212
|
-
|
213
|
-
|
190
|
+
if (!this.props.onTheFlightValidate || this.props.onTheFlightValidate && this.props.onTheFlightValidate(value)) {
|
191
|
+
const res = this.handleValueChange(value, isValid, errors);
|
192
|
+
|
193
|
+
if (this.props.onChange) {
|
194
|
+
this.props.onChange(event, res.isValid);
|
214
195
|
}
|
196
|
+
}
|
197
|
+
}
|
215
198
|
|
216
|
-
|
217
|
-
|
199
|
+
subscribeSelf(props) {
|
200
|
+
if (!props.ignoreContext && props.formContext) {
|
201
|
+
props.formContext.subscribe(this.componentId, {
|
202
|
+
componentApi: {
|
203
|
+
disableComponent: this.disableComponent,
|
204
|
+
enableComponent: this.enableComponent,
|
205
|
+
touch: this.touch,
|
206
|
+
unTouch: this.unTouch,
|
207
|
+
scrollTo: this.scrollTo,
|
208
|
+
focus: this.focus
|
209
|
+
},
|
210
|
+
validation: {
|
211
|
+
isValid: this.state.isValid,
|
212
|
+
errors: this.state.errors,
|
213
|
+
name: this.props.validationName ? this.props.validationName : this.props.title ? this.props.title : this.props.label
|
214
|
+
}
|
218
215
|
});
|
216
|
+
}
|
217
|
+
}
|
219
218
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
}, item);
|
226
|
-
});
|
227
|
-
}
|
219
|
+
handleBlur(e) {
|
220
|
+
this.props.onBlur && this.props.onBlur();
|
221
|
+
let state = {
|
222
|
+
focused: false
|
223
|
+
};
|
228
224
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
225
|
+
if (!this.state.touched && this.props.touchOn === 'blur') {
|
226
|
+
state = Object.assign(state, {
|
227
|
+
touched: true
|
228
|
+
});
|
229
|
+
this.handleValueChange(this.state.value);
|
234
230
|
}
|
235
|
-
}, {
|
236
|
-
key: "handleChange",
|
237
|
-
value: function handleChange(event, isValid) {
|
238
|
-
var errors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
239
|
-
var value = event.target.value;
|
240
231
|
|
241
|
-
|
242
|
-
|
232
|
+
this.setState(state);
|
233
|
+
}
|
243
234
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
}, {
|
250
|
-
key: "subscribeSelf",
|
251
|
-
value: function subscribeSelf(props) {
|
252
|
-
if (!props.ignoreContext && props.formContext) {
|
253
|
-
props.formContext.subscribe(this.componentId, {
|
254
|
-
componentApi: {
|
255
|
-
disableComponent: this.disableComponent,
|
256
|
-
enableComponent: this.enableComponent,
|
257
|
-
touch: this.touch,
|
258
|
-
unTouch: this.unTouch,
|
259
|
-
scrollTo: this.scrollTo,
|
260
|
-
focus: this.focus
|
261
|
-
},
|
262
|
-
validation: {
|
263
|
-
isValid: this.state.isValid,
|
264
|
-
errors: this.state.errors,
|
265
|
-
name: this.props.validationName ? this.props.validationName : this.props.title ? this.props.title : this.props.label
|
266
|
-
}
|
267
|
-
});
|
268
|
-
}
|
269
|
-
}
|
270
|
-
}, {
|
271
|
-
key: "handleBlur",
|
272
|
-
value: function handleBlur(e) {
|
273
|
-
this.props.onBlur && this.props.onBlur();
|
274
|
-
var state = {
|
275
|
-
focused: false
|
235
|
+
handleFocus(e) {
|
236
|
+
if (!this.props.disabled) {
|
237
|
+
this.props.onFocus && this.props.onFocus(e);
|
238
|
+
let state = {
|
239
|
+
focused: true
|
276
240
|
};
|
277
241
|
|
278
|
-
if (!this.state.touched && this.props.touchOn === '
|
242
|
+
if (!this.state.touched && this.props.touchOn === 'focus') {
|
279
243
|
state = Object.assign(state, {
|
280
244
|
touched: true
|
281
245
|
});
|
@@ -284,244 +248,196 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
284
248
|
|
285
249
|
this.setState(state);
|
286
250
|
}
|
287
|
-
}
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
var state = {
|
293
|
-
focused: true
|
294
|
-
};
|
295
|
-
|
296
|
-
if (!this.state.touched && this.props.touchOn === 'focus') {
|
297
|
-
state = Object.assign(state, {
|
298
|
-
touched: true
|
299
|
-
});
|
300
|
-
this.handleValueChange(this.state.value);
|
301
|
-
}
|
251
|
+
}
|
252
|
+
|
253
|
+
getDisabled() {
|
254
|
+
return this.state.disabled ? this.state.disabled : this.props.disabled;
|
255
|
+
}
|
302
256
|
|
303
|
-
|
257
|
+
setValid() {
|
258
|
+
this.setState(() => ({
|
259
|
+
isValid: true,
|
260
|
+
errors: []
|
261
|
+
}), () => {
|
262
|
+
if (!this.props.ignoreContext) {
|
263
|
+
this.props.formContext && this.props.formContext.updateCallback(this.componentId, {
|
264
|
+
validation: {
|
265
|
+
isValid: true,
|
266
|
+
errors: []
|
267
|
+
}
|
268
|
+
});
|
304
269
|
}
|
305
|
-
}
|
306
|
-
}
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
};
|
321
|
-
}, function () {
|
322
|
-
if (!_this2.props.ignoreContext) {
|
323
|
-
_this2.props.formContext && _this2.props.formContext.updateCallback(_this2.componentId, {
|
324
|
-
validation: {
|
325
|
-
isValid: true,
|
326
|
-
errors: []
|
327
|
-
}
|
328
|
-
});
|
329
|
-
}
|
330
|
-
});
|
331
|
-
}
|
332
|
-
}, {
|
333
|
-
key: "setInvalid",
|
334
|
-
value: function setInvalid() {
|
335
|
-
var _this3 = this;
|
336
|
-
|
337
|
-
var errors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
338
|
-
this.setState(function () {
|
339
|
-
return {
|
340
|
-
isValid: false,
|
341
|
-
errors: errors
|
342
|
-
};
|
343
|
-
}, function () {
|
344
|
-
if (!_this3.props.ignoreContext) {
|
345
|
-
_this3.props.formContext && _this3.props.formContext.updateCallback(_this3.componentId, {
|
346
|
-
validation: {
|
347
|
-
isValid: false,
|
348
|
-
errors: errors
|
349
|
-
}
|
350
|
-
});
|
351
|
-
}
|
352
|
-
});
|
353
|
-
}
|
354
|
-
}, {
|
355
|
-
key: "renderLabel",
|
356
|
-
value: function renderLabel() {
|
357
|
-
var touchable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
358
|
-
|
359
|
-
if (!this.props.tooltip || this.props.tooltip && this.props.title) {
|
360
|
-
return /*#__PURE__*/React.createElement("span", {
|
361
|
-
className: (0, _classnames.default)('w-100', {
|
362
|
-
'label--no-touch': !touchable
|
363
|
-
})
|
364
|
-
}, this.props.label);
|
270
|
+
});
|
271
|
+
}
|
272
|
+
|
273
|
+
setInvalid() {
|
274
|
+
let errors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
275
|
+
this.setState(() => ({
|
276
|
+
isValid: false,
|
277
|
+
errors
|
278
|
+
}), () => {
|
279
|
+
if (!this.props.ignoreContext) {
|
280
|
+
this.props.formContext && this.props.formContext.updateCallback(this.componentId, {
|
281
|
+
validation: {
|
282
|
+
isValid: false,
|
283
|
+
errors: errors
|
284
|
+
}
|
285
|
+
});
|
365
286
|
}
|
287
|
+
});
|
288
|
+
}
|
366
289
|
|
367
|
-
|
368
|
-
|
369
|
-
|
290
|
+
renderLabel() {
|
291
|
+
let touchable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
292
|
+
|
293
|
+
if (!this.props.tooltip || this.props.tooltip && this.props.title) {
|
294
|
+
return /*#__PURE__*/React.createElement("span", {
|
295
|
+
className: (0, _classnames.default)('w-100', {
|
296
|
+
'label--no-touch': !touchable
|
297
|
+
})
|
298
|
+
}, this.props.label);
|
370
299
|
}
|
371
|
-
}, {
|
372
|
-
key: "renderTitle",
|
373
|
-
value: function renderTitle() {
|
374
|
-
if (!this.props.tooltip) {
|
375
|
-
return this.props.title;
|
376
|
-
}
|
377
300
|
|
378
|
-
|
301
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
302
|
+
className: touchable ? '' : 'label--no-touch'
|
303
|
+
}, this.props.label), this.renderTooltip());
|
304
|
+
}
|
305
|
+
|
306
|
+
renderTitle() {
|
307
|
+
if (!this.props.tooltip) {
|
308
|
+
return this.props.title;
|
379
309
|
}
|
380
|
-
}, {
|
381
|
-
key: "handleValueChange",
|
382
|
-
value: function handleValueChange(value) {
|
383
|
-
var isValid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
384
|
-
var errors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
385
|
-
var props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.props;
|
386
|
-
var initializing = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
387
|
-
|
388
|
-
if (!initializing && !this.state.handleValueChangeEnabled) {
|
389
|
-
return {
|
390
|
-
isValid: isValid,
|
391
|
-
errors: []
|
392
|
-
};
|
393
|
-
}
|
394
310
|
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
311
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, this.props.title, this.renderTooltip());
|
312
|
+
}
|
313
|
+
|
314
|
+
handleValueChange(value) {
|
315
|
+
let isValid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
316
|
+
let errors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
317
|
+
let props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.props;
|
318
|
+
let initializing = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
319
|
+
|
320
|
+
if (!initializing && !this.state.handleValueChangeEnabled) {
|
321
|
+
return {
|
322
|
+
isValid,
|
323
|
+
errors: []
|
324
|
+
};
|
325
|
+
}
|
326
|
+
|
327
|
+
if (props.required && !value) {
|
328
|
+
const translations = this.getTranslations(defaultBaseTranslations);
|
329
|
+
errors.push(translations.required);
|
330
|
+
isValid = false;
|
331
|
+
} else {
|
332
|
+
if (!props.required && !value) {
|
333
|
+
isValid = true;
|
399
334
|
} else {
|
400
|
-
if (
|
335
|
+
if (props.validators) {
|
401
336
|
isValid = true;
|
402
|
-
|
403
|
-
|
404
|
-
isValid = true;
|
405
|
-
props.validators.forEach(function (validator) {
|
406
|
-
var validInner = false;
|
407
|
-
|
408
|
-
switch (validator) {
|
409
|
-
case 'email':
|
410
|
-
validInner = new Validators.EmailValidator().Validate(value, props.required, function (error) {
|
411
|
-
return errors.push(error);
|
412
|
-
});
|
413
|
-
break;
|
414
|
-
|
415
|
-
case 'number':
|
416
|
-
validInner = new Validators.NumberValidator().Validate(value, props.required, function (error) {
|
417
|
-
return errors.push(error);
|
418
|
-
});
|
419
|
-
break;
|
420
|
-
|
421
|
-
case 'latitude':
|
422
|
-
validInner = new Validators.LatitudeValidator().Validate(value, props.required, function (error) {
|
423
|
-
return errors.push(error);
|
424
|
-
});
|
425
|
-
break;
|
426
|
-
|
427
|
-
case 'longitude':
|
428
|
-
validInner = new Validators.LongitudeValidator().Validate(value, props.required, function (error) {
|
429
|
-
return errors.push(error);
|
430
|
-
});
|
431
|
-
break;
|
432
|
-
|
433
|
-
case 'url':
|
434
|
-
validInner = new Validators.UrlValidator().Validate(value, props.required, function (error) {
|
435
|
-
return errors.push(error);
|
436
|
-
});
|
437
|
-
break;
|
438
|
-
|
439
|
-
default:
|
440
|
-
throw new Error("Validator ".concat(validator, " not implemented"));
|
441
|
-
}
|
442
|
-
|
443
|
-
if (isValid && !validInner) {
|
444
|
-
isValid = validInner;
|
445
|
-
}
|
446
|
-
});
|
447
|
-
}
|
337
|
+
props.validators.forEach(validator => {
|
338
|
+
let validInner = false;
|
448
339
|
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
return errors.push(error);
|
454
|
-
});
|
455
|
-
|
456
|
-
if (isValid && !validInner) {
|
457
|
-
isValid = validInner;
|
458
|
-
}
|
459
|
-
});
|
460
|
-
}
|
461
|
-
}
|
462
|
-
}
|
340
|
+
switch (validator) {
|
341
|
+
case 'email':
|
342
|
+
validInner = new Validators.EmailValidator().Validate(value, props.required, error => errors.push(error));
|
343
|
+
break;
|
463
344
|
|
464
|
-
|
345
|
+
case 'number':
|
346
|
+
validInner = new Validators.NumberValidator().Validate(value, props.required, error => errors.push(error));
|
347
|
+
break;
|
465
348
|
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
isValid: isValid,
|
470
|
-
errors: errors
|
471
|
-
});
|
349
|
+
case 'latitude':
|
350
|
+
validInner = new Validators.LatitudeValidator().Validate(value, props.required, error => errors.push(error));
|
351
|
+
break;
|
472
352
|
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
353
|
+
case 'longitude':
|
354
|
+
validInner = new Validators.LongitudeValidator().Validate(value, props.required, error => errors.push(error));
|
355
|
+
break;
|
356
|
+
|
357
|
+
case 'url':
|
358
|
+
validInner = new Validators.UrlValidator().Validate(value, props.required, error => errors.push(error));
|
359
|
+
break;
|
360
|
+
|
361
|
+
default:
|
362
|
+
throw new Error(`Validator ${validator} not implemented`);
|
363
|
+
}
|
364
|
+
|
365
|
+
if (isValid && !validInner) {
|
366
|
+
isValid = validInner;
|
478
367
|
}
|
479
368
|
});
|
480
369
|
}
|
481
|
-
}
|
482
370
|
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
}, "?");
|
494
|
-
|
495
|
-
if (this.props.tooltip) {
|
496
|
-
var _document;
|
497
|
-
|
498
|
-
var Tippy = require('@tippy.js/react').default;
|
499
|
-
|
500
|
-
return /*#__PURE__*/React.createElement(Tippy, _extends({
|
501
|
-
content: this.props.tooltip,
|
502
|
-
placement: "bottom",
|
503
|
-
animation: "scale-subtle",
|
504
|
-
arrow: false,
|
505
|
-
duration: 200,
|
506
|
-
delay: [75, 0],
|
507
|
-
distance: 8,
|
508
|
-
interactive: true,
|
509
|
-
appendTo: (_document = document) === null || _document === void 0 ? void 0 : _document.body,
|
510
|
-
trigger: "mouseenter focus"
|
511
|
-
}, this.props.tooltipProps), content);
|
371
|
+
if (props.customValidators) {
|
372
|
+
props.customValidators.forEach(customValidator => {
|
373
|
+
let validInner = false;
|
374
|
+
validInner = customValidator.Validate(value, props.required, error => errors.push(error));
|
375
|
+
|
376
|
+
if (isValid && !validInner) {
|
377
|
+
isValid = validInner;
|
378
|
+
}
|
379
|
+
});
|
380
|
+
}
|
512
381
|
}
|
382
|
+
}
|
383
|
+
|
384
|
+
props.onErrorsChanged && props.onErrorsChanged(errors);
|
385
|
+
|
386
|
+
if (!initializing) {
|
387
|
+
this.setState({
|
388
|
+
value,
|
389
|
+
isValid,
|
390
|
+
errors
|
391
|
+
});
|
513
392
|
|
514
|
-
|
393
|
+
if (!props.ignoreContext) {
|
394
|
+
props.formContext && props.formContext.updateCallback(this.componentId, {
|
395
|
+
validation: {
|
396
|
+
isValid: isValid,
|
397
|
+
errors: errors
|
398
|
+
}
|
399
|
+
});
|
400
|
+
}
|
515
401
|
}
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
402
|
+
|
403
|
+
return {
|
404
|
+
isValid,
|
405
|
+
errors
|
406
|
+
};
|
407
|
+
}
|
408
|
+
|
409
|
+
renderTooltip() {
|
410
|
+
let content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : /*#__PURE__*/React.createElement("span", {
|
411
|
+
className: "label--help-icon"
|
412
|
+
}, "?");
|
413
|
+
|
414
|
+
if (this.props.tooltip) {
|
415
|
+
var _document;
|
416
|
+
|
417
|
+
const Tippy = require('@tippy.js/react').default;
|
418
|
+
|
419
|
+
return /*#__PURE__*/React.createElement(Tippy, _extends({
|
420
|
+
content: this.props.tooltip,
|
421
|
+
placement: "bottom",
|
422
|
+
animation: "scale-subtle",
|
423
|
+
arrow: false,
|
424
|
+
duration: 200,
|
425
|
+
delay: [75, 0],
|
426
|
+
distance: 8,
|
427
|
+
interactive: true,
|
428
|
+
appendTo: (_document = document) === null || _document === void 0 ? void 0 : _document.body,
|
429
|
+
trigger: "mouseenter focus"
|
430
|
+
}, this.props.tooltipProps), content);
|
520
431
|
}
|
521
|
-
}]);
|
522
432
|
|
523
|
-
|
524
|
-
}
|
433
|
+
return content;
|
434
|
+
}
|
435
|
+
|
436
|
+
getTranslations(_defaultTranslations) {
|
437
|
+
return _objectSpread(_objectSpread({}, _defaultTranslations), this.props.translations);
|
438
|
+
}
|
439
|
+
|
440
|
+
}
|
525
441
|
|
526
442
|
exports.BaseInput = BaseInput;
|
527
443
|
|