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.SelectRaw = exports.Select = 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 _Button = require("../button/Button");
|
17
15
|
|
@@ -21,35 +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; }
|
35
|
-
|
36
|
-
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
37
|
-
|
38
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
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
|
47
|
-
|
48
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
49
|
-
|
50
|
-
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; } }
|
51
|
-
|
52
|
-
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); }
|
53
27
|
|
54
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; }
|
55
29
|
|
@@ -66,283 +40,231 @@ PlusIcon.defaultProps = {
|
|
66
40
|
viewBox: "0 0 24 24"
|
67
41
|
};
|
68
42
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
var _super = _createSuper(SelectRaw);
|
73
|
-
|
74
|
-
function SelectRaw(props) {
|
75
|
-
var _this;
|
76
|
-
|
77
|
-
_classCallCheck(this, SelectRaw);
|
78
|
-
|
79
|
-
_this = _super.call(this, props);
|
80
|
-
|
81
|
-
_defineProperty(_assertThisInitialized(_this), "removeItemClick", function (item) {
|
82
|
-
return function () {
|
83
|
-
var newValues = _this.props.selectedValues.filter(function (sv) {
|
84
|
-
return sv.value !== item.value;
|
85
|
-
});
|
43
|
+
class SelectRaw extends _BaseInput.BaseInput {
|
44
|
+
constructor(props) {
|
45
|
+
super(props);
|
86
46
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
47
|
+
_defineProperty(this, "removeItemClick", item => () => {
|
48
|
+
const newValues = this.props.selectedValues.filter(sv => sv.value !== item.value);
|
49
|
+
this.handleValid(newValues);
|
50
|
+
this.props.onSelectedValuesChange && this.props.onSelectedValuesChange(newValues);
|
91
51
|
});
|
92
52
|
|
93
|
-
|
94
|
-
|
53
|
+
const val = !props.value ? props.defaultEmpty ? '' : props.values && props.values.length > 0 ? props.values[0] : '' : props.value;
|
54
|
+
this.state = Object.assign(this.state, {
|
95
55
|
value: val
|
96
56
|
});
|
97
|
-
|
98
|
-
return _this;
|
57
|
+
this.handleChangeCustom = this.handleChangeCustom.bind(this);
|
99
58
|
}
|
100
59
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
this.props.multiple && this.handleValid(this.props.selectedValues);
|
105
|
-
}
|
106
|
-
}, {
|
107
|
-
key: "componentDidUpdate",
|
108
|
-
value: function componentDidUpdate(oldProps) {
|
109
|
-
if (oldProps.value !== this.props.value || oldProps.validators !== this.props.validators || oldProps.customValidators !== this.props.customValidators || oldProps.required !== this.props.required || oldProps.selectedValues !== this.props.selectedValues) {
|
110
|
-
if (this.props.multiple) {
|
111
|
-
this.handleValid(this.props.selectedValues);
|
112
|
-
} else {
|
113
|
-
this.handleValueChange(this.props.value, true, [], this.props);
|
114
|
-
}
|
115
|
-
}
|
116
|
-
}
|
117
|
-
}, {
|
118
|
-
key: "render",
|
119
|
-
value: function render() {
|
120
|
-
var _this2 = this;
|
121
|
-
|
122
|
-
var finalValues = this.props.multiple ? this.props.values.filter(function (item) {
|
123
|
-
return _this2.props.selectedValues.findIndex(function (t) {
|
124
|
-
return t.value === item.value;
|
125
|
-
}) < 0;
|
126
|
-
}) : this.props.values;
|
127
|
-
return /*#__PURE__*/React.createElement(_InputGroup.default, {
|
128
|
-
title: this.props.title,
|
129
|
-
tooltip: this.props.tooltip
|
130
|
-
}, /*#__PURE__*/React.createElement("div", {
|
131
|
-
className: 'input__base select-input ' + this.getValidationClass() + ' ' + (this.props.className ? this.props.className : '') + ' ' + (this.props.readOnly ? 'readonly' : '') + ' ' + (this.props.multiple ? 'multiple' : ''),
|
132
|
-
ref: this.containerRef
|
133
|
-
}, this.renderSelectedValues(), finalValues.length > 0 && (this.props.multiple && !this.props.readOnly || !this.props.multiple) && /*#__PURE__*/React.createElement("div", {
|
134
|
-
className: "select-input__select__wrapper"
|
135
|
-
}, !this.props.multiple && !this.props.readOnly || this.props.multiple ? /*#__PURE__*/React.createElement("select", _extends({}, this.props.id && {
|
136
|
-
id: this.props.id
|
137
|
-
}, {
|
138
|
-
ref: this.inputRef,
|
139
|
-
disabled: this.getDisabled(),
|
140
|
-
required: this.props.required,
|
141
|
-
onChange: this.handleChangeCustom,
|
142
|
-
value: this.state.value,
|
143
|
-
className: 'select-input__select ' + (this.state.value !== '' || this.props.selectedValues && this.props.selectedValues.length > 0 ? 'filled' : ''),
|
144
|
-
onBlur: this.handleBlur,
|
145
|
-
onFocus: this.handleFocus,
|
146
|
-
tabIndex: 0
|
147
|
-
}), this.props.defaultEmpty && /*#__PURE__*/React.createElement("option", {
|
148
|
-
key: -1,
|
149
|
-
disabled: true,
|
150
|
-
value: "",
|
151
|
-
style: {
|
152
|
-
display: 'none'
|
153
|
-
}
|
154
|
-
}), finalValues.map(function (value, index) {
|
155
|
-
return /*#__PURE__*/React.createElement("option", {
|
156
|
-
key: index,
|
157
|
-
value: value.value
|
158
|
-
}, value.label ? value.label : value.value);
|
159
|
-
})) : /*#__PURE__*/React.createElement("span", {
|
160
|
-
className: 'select-input__select ' + (this.state.value !== '' || this.props.selectedValues && this.props.selectedValues.length > 0 ? 'filled' : '')
|
161
|
-
}, this.renderReadonly()), /*#__PURE__*/React.createElement("span", {
|
162
|
-
className: "highlight"
|
163
|
-
}), /*#__PURE__*/React.createElement("span", {
|
164
|
-
className: "bar"
|
165
|
-
}), this.renderDefaultValidation(), this.props.label && finalValues.length > 0 && /*#__PURE__*/React.createElement("label", null, this.renderLabel()))));
|
166
|
-
}
|
167
|
-
}, {
|
168
|
-
key: "handleValueChange",
|
169
|
-
value: function handleValueChange(value) {
|
170
|
-
var isValid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
171
|
-
var errors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
172
|
-
var props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.props;
|
173
|
-
var initializing = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
60
|
+
componentDidMount() {
|
61
|
+
this.props.multiple && this.handleValid(this.props.selectedValues);
|
62
|
+
}
|
174
63
|
|
175
|
-
|
176
|
-
|
177
|
-
|
64
|
+
componentDidUpdate(oldProps) {
|
65
|
+
if (oldProps.value !== this.props.value || oldProps.validators !== this.props.validators || oldProps.customValidators !== this.props.customValidators || oldProps.required !== this.props.required || oldProps.selectedValues !== this.props.selectedValues) {
|
66
|
+
if (this.props.multiple) {
|
178
67
|
this.handleValid(this.props.selectedValues);
|
68
|
+
} else {
|
69
|
+
this.handleValueChange(this.props.value, true, [], this.props);
|
179
70
|
}
|
180
|
-
|
181
|
-
return {
|
182
|
-
isValid: true,
|
183
|
-
errors: []
|
184
|
-
};
|
185
71
|
}
|
186
|
-
}
|
187
|
-
key: "handleBlur",
|
188
|
-
value: function handleBlur(e) {
|
189
|
-
this.props.onBlur && this.props.onBlur();
|
190
|
-
var state = {
|
191
|
-
focused: false
|
192
|
-
};
|
193
|
-
|
194
|
-
if (!this.state.touched && this.props.touchOn === 'blur') {
|
195
|
-
state = Object.assign(state, {
|
196
|
-
touched: true
|
197
|
-
});
|
72
|
+
}
|
198
73
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
74
|
+
render() {
|
75
|
+
const finalValues = this.props.multiple ? this.props.values.filter(item => this.props.selectedValues.findIndex(t => t.value === item.value) < 0) : this.props.values;
|
76
|
+
return /*#__PURE__*/React.createElement(_InputGroup.default, {
|
77
|
+
title: this.props.title,
|
78
|
+
tooltip: this.props.tooltip
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
80
|
+
className: 'input__base select-input ' + this.getValidationClass() + ' ' + (this.props.className ? this.props.className : '') + ' ' + (this.props.readOnly ? 'readonly' : '') + ' ' + (this.props.multiple ? 'multiple' : ''),
|
81
|
+
ref: this.containerRef
|
82
|
+
}, this.renderSelectedValues(), finalValues.length > 0 && (this.props.multiple && !this.props.readOnly || !this.props.multiple) && /*#__PURE__*/React.createElement("div", {
|
83
|
+
className: "select-input__select__wrapper"
|
84
|
+
}, !this.props.multiple && !this.props.readOnly || this.props.multiple ? /*#__PURE__*/React.createElement("select", _extends({}, this.props.id && {
|
85
|
+
id: this.props.id
|
86
|
+
}, {
|
87
|
+
ref: this.inputRef,
|
88
|
+
disabled: this.getDisabled(),
|
89
|
+
required: this.props.required,
|
90
|
+
onChange: this.handleChangeCustom,
|
91
|
+
value: this.state.value,
|
92
|
+
className: 'select-input__select ' + (this.state.value !== '' || this.props.selectedValues && this.props.selectedValues.length > 0 ? 'filled' : ''),
|
93
|
+
onBlur: this.handleBlur,
|
94
|
+
onFocus: this.handleFocus,
|
95
|
+
tabIndex: 0
|
96
|
+
}), this.props.defaultEmpty && /*#__PURE__*/React.createElement("option", {
|
97
|
+
key: -1,
|
98
|
+
disabled: true,
|
99
|
+
value: "",
|
100
|
+
style: {
|
101
|
+
display: 'none'
|
204
102
|
}
|
103
|
+
}), finalValues.map((value, index) => /*#__PURE__*/React.createElement("option", {
|
104
|
+
key: index,
|
105
|
+
value: value.value
|
106
|
+
}, value.label ? value.label : value.value))) : /*#__PURE__*/React.createElement("span", {
|
107
|
+
className: 'select-input__select ' + (this.state.value !== '' || this.props.selectedValues && this.props.selectedValues.length > 0 ? 'filled' : '')
|
108
|
+
}, this.renderReadonly()), /*#__PURE__*/React.createElement("span", {
|
109
|
+
className: "highlight"
|
110
|
+
}), /*#__PURE__*/React.createElement("span", {
|
111
|
+
className: "bar"
|
112
|
+
}), this.renderDefaultValidation(), this.props.label && finalValues.length > 0 && /*#__PURE__*/React.createElement("label", null, this.renderLabel()))));
|
113
|
+
}
|
205
114
|
|
206
|
-
|
115
|
+
handleValueChange(value) {
|
116
|
+
let isValid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
117
|
+
let errors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
118
|
+
let props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.props;
|
119
|
+
let initializing = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
120
|
+
|
121
|
+
if (!this.props.multiple) {
|
122
|
+
return super.handleValueChange(value, isValid, errors, props, initializing);
|
123
|
+
} else if (!initializing) {
|
124
|
+
this.handleValid(this.props.selectedValues);
|
207
125
|
}
|
208
|
-
}, {
|
209
|
-
key: "handleFocus",
|
210
|
-
value: function handleFocus(e) {
|
211
|
-
this.props.onFocus && this.props.onFocus(e);
|
212
|
-
var state = {
|
213
|
-
focused: true
|
214
|
-
};
|
215
|
-
|
216
|
-
if (!this.state.touched && this.props.touchOn === 'focus') {
|
217
|
-
state = Object.assign(state, {
|
218
|
-
touched: true
|
219
|
-
});
|
220
126
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
127
|
+
return {
|
128
|
+
isValid: true,
|
129
|
+
errors: []
|
130
|
+
};
|
131
|
+
}
|
132
|
+
|
133
|
+
handleBlur(e) {
|
134
|
+
this.props.onBlur && this.props.onBlur();
|
135
|
+
let state = {
|
136
|
+
focused: false
|
137
|
+
};
|
138
|
+
|
139
|
+
if (!this.state.touched && this.props.touchOn === 'blur') {
|
140
|
+
state = Object.assign(state, {
|
141
|
+
touched: true
|
142
|
+
});
|
227
143
|
|
228
|
-
this.
|
144
|
+
if (!this.props.multiple) {
|
145
|
+
this.handleValueChange(this.state.value);
|
146
|
+
} else {
|
147
|
+
this.handleValid(this.props.selectedValues);
|
148
|
+
}
|
229
149
|
}
|
230
|
-
}, {
|
231
|
-
key: "handleChangeCustom",
|
232
|
-
value: function handleChangeCustom(event) {
|
233
|
-
if (this.props.multiple) {
|
234
|
-
var value = event.target.value;
|
235
|
-
var val = this.props.values.filter(function (item) {
|
236
|
-
return item.value === value;
|
237
|
-
})[0];
|
238
|
-
|
239
|
-
if (!val) {
|
240
|
-
if (!isNaN(Number(value))) {
|
241
|
-
var valNumber = Number(value);
|
242
|
-
val = this.props.values.filter(function (item) {
|
243
|
-
return item.value === valNumber;
|
244
|
-
})[0];
|
245
|
-
}
|
246
|
-
}
|
247
150
|
|
248
|
-
|
151
|
+
this.setState(state);
|
152
|
+
}
|
249
153
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
154
|
+
handleFocus(e) {
|
155
|
+
this.props.onFocus && this.props.onFocus(e);
|
156
|
+
let state = {
|
157
|
+
focused: true
|
158
|
+
};
|
159
|
+
|
160
|
+
if (!this.state.touched && this.props.touchOn === 'focus') {
|
161
|
+
state = Object.assign(state, {
|
162
|
+
touched: true
|
163
|
+
});
|
164
|
+
|
165
|
+
if (!this.props.multiple) {
|
166
|
+
this.handleValueChange(this.state.value);
|
257
167
|
} else {
|
258
|
-
this.
|
168
|
+
this.handleValid(this.props.selectedValues);
|
259
169
|
}
|
260
170
|
}
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
171
|
+
|
172
|
+
this.setState(state);
|
173
|
+
}
|
174
|
+
|
175
|
+
handleChangeCustom(event) {
|
176
|
+
if (this.props.multiple) {
|
177
|
+
let value = event.target.value;
|
178
|
+
let val = this.props.values.filter(item => item.value === value)[0];
|
179
|
+
|
180
|
+
if (!val) {
|
181
|
+
if (!isNaN(Number(value))) {
|
182
|
+
let valNumber = Number(value);
|
183
|
+
val = this.props.values.filter(item => item.value === valNumber)[0];
|
273
184
|
}
|
274
185
|
}
|
275
186
|
|
276
|
-
|
277
|
-
this.props.customValidators.forEach(function (customValidator) {
|
278
|
-
var _this3$state;
|
187
|
+
let newValues = this.props.selectedValues.concat(val);
|
279
188
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
if (isValid && !validInner) {
|
286
|
-
isValid = validInner;
|
287
|
-
}
|
189
|
+
if (val) {
|
190
|
+
this.props.onSelectedValuesChange && this.props.onSelectedValuesChange(newValues);
|
191
|
+
this.handleValid(newValues);
|
192
|
+
this.setState({
|
193
|
+
value: ''
|
288
194
|
});
|
289
195
|
}
|
196
|
+
} else {
|
197
|
+
this.handleChange(event);
|
198
|
+
}
|
199
|
+
}
|
290
200
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
201
|
+
handleValid(newValues) {
|
202
|
+
let isValid = true;
|
203
|
+
let errors = [];
|
204
|
+
|
205
|
+
if (this.props.required) {
|
206
|
+
if (newValues.length === 0) {
|
207
|
+
isValid = false;
|
208
|
+
errors.push(this.getTranslations(_BaseInput.defaultBaseTranslations).required);
|
295
209
|
}
|
296
210
|
}
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
211
|
+
|
212
|
+
if (this.props.customValidators) {
|
213
|
+
this.props.customValidators.forEach(customValidator => {
|
214
|
+
var _this$state;
|
215
|
+
|
216
|
+
let validInner = false;
|
217
|
+
validInner = customValidator.Validate((_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.value, this.props.required, error => errors.push(error));
|
218
|
+
|
219
|
+
if (isValid && !validInner) {
|
220
|
+
isValid = validInner;
|
221
|
+
}
|
222
|
+
});
|
306
223
|
}
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
return this.props.multiple ? this.props.selectedValues.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
313
|
-
className: "select-input__selectedValue__wrapper"
|
314
|
-
}, this.props.selectedValues.map(function (item, index) {
|
315
|
-
return /*#__PURE__*/React.createElement("div", {
|
316
|
-
className: "select-input__selectedValue",
|
317
|
-
key: index
|
318
|
-
}, item.label ? item.label : item.value, !_this5.props.readOnly && /*#__PURE__*/React.createElement(_Button.Button, {
|
319
|
-
disabled: item.forceSelected,
|
320
|
-
circular: true,
|
321
|
-
blank: true,
|
322
|
-
onClick: _this5.removeItemClick(item),
|
323
|
-
className: "ml-1 transform-rotate--45 line-height--0 p-0"
|
324
|
-
}, /*#__PURE__*/React.createElement(PlusIcon, null)));
|
325
|
-
})) : this.props.readOnly && /*#__PURE__*/React.createElement("div", {
|
326
|
-
className: "select-input__selectedValue__wrapper"
|
327
|
-
}, /*#__PURE__*/React.createElement("div", {
|
328
|
-
className: "select-input__selectedValue"
|
329
|
-
}, this.props.readonlyEmptyPlaceholder)) : null;
|
224
|
+
|
225
|
+
if (isValid) {
|
226
|
+
this.setValid();
|
227
|
+
} else {
|
228
|
+
this.setInvalid(errors);
|
330
229
|
}
|
331
|
-
}
|
230
|
+
}
|
231
|
+
|
232
|
+
renderReadonly() {
|
233
|
+
const value = this.props.values.filter(item => item.value.toString() === this.state.value)[0];
|
234
|
+
return value ? value.label ? value.label : value.value : '';
|
235
|
+
}
|
236
|
+
|
237
|
+
renderSelectedValues() {
|
238
|
+
return this.props.multiple ? this.props.selectedValues.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
239
|
+
className: "select-input__selectedValue__wrapper"
|
240
|
+
}, this.props.selectedValues.map((item, index) => /*#__PURE__*/React.createElement("div", {
|
241
|
+
className: "select-input__selectedValue",
|
242
|
+
key: index
|
243
|
+
}, item.label ? item.label : item.value, !this.props.readOnly && /*#__PURE__*/React.createElement(_Button.Button, {
|
244
|
+
disabled: item.forceSelected,
|
245
|
+
circular: true,
|
246
|
+
blank: true,
|
247
|
+
onClick: this.removeItemClick(item),
|
248
|
+
className: "ml-1 transform-rotate--45 line-height--0 p-0"
|
249
|
+
}, /*#__PURE__*/React.createElement(PlusIcon, null))))) : this.props.readOnly && /*#__PURE__*/React.createElement("div", {
|
250
|
+
className: "select-input__selectedValue__wrapper"
|
251
|
+
}, /*#__PURE__*/React.createElement("div", {
|
252
|
+
className: "select-input__selectedValue"
|
253
|
+
}, this.props.readonlyEmptyPlaceholder)) : null;
|
254
|
+
}
|
332
255
|
|
333
|
-
|
334
|
-
}(_BaseInput2.BaseInput);
|
256
|
+
}
|
335
257
|
|
336
258
|
exports.SelectRaw = SelectRaw;
|
337
259
|
|
338
|
-
_defineProperty(SelectRaw, "defaultProps", Object.assign({},
|
260
|
+
_defineProperty(SelectRaw, "defaultProps", Object.assign({}, _BaseInput.BaseInput.defaultProps, {
|
339
261
|
defaultEmpty: true,
|
340
262
|
multiple: false,
|
341
263
|
readOnly: false,
|
342
264
|
readonlyEmptyPlaceholder: 'N/A'
|
343
265
|
}));
|
344
266
|
|
345
|
-
|
267
|
+
const Select = (0, _withThemeContext.withThemeContext)((0, _withFormContext.withFormContext)(SelectRaw), 'select');
|
346
268
|
exports.Select = Select;
|
347
269
|
var _default = Select;
|
348
270
|
exports.default = _default;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/components/select/Select.tsx"],"names":["PlusIcon","SelectRaw","props","item","newValues","selectedValues","filter","sv","value","handleValid","onSelectedValuesChange","val","defaultEmpty","values","length","state","Object","assign","handleChangeCustom","bind","multiple","oldProps","validators","customValidators","required","handleValueChange","finalValues","findIndex","t","title","tooltip","getValidationClass","className","readOnly","containerRef","renderSelectedValues","id","inputRef","getDisabled","handleBlur","handleFocus","display","map","index","label","renderReadonly","renderDefaultValidation","renderLabel","isValid","errors","initializing","e","onBlur","focused","touched","touchOn","setState","onFocus","event","target","isNaN","Number","valNumber","concat","handleChange","push","getTranslations","defaultBaseTranslations","forEach","customValidator","validInner","Validate","error","setValid","setInvalid","toString","forceSelected","removeItemClick","readonlyEmptyPlaceholder","BaseInput","defaultProps","Select"],"mappings":";;;;;;;;;AACA;;AAGA;;AAEA;;AAOA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAVYA,Q,YAAAA,Q;;;;;;AAAAA,Q;;;;;;;IA+BCC,S;;;;;AAYX,qBAAYC,KAAZ,EAAgC;AAAA;;AAAA;;AAC9B,8BAAMA,KAAN;;AAD8B,sEA2QN,UAACC,IAAD;AAAA,aAAuB,YAAM;AACrD,YAAMC,SAAS,GAAG,MAAKF,KAAL,CAAWG,cAAX,CAA0BC,MAA1B,CAChB,UAAAC,EAAE;AAAA,iBAAIA,EAAE,CAACC,KAAH,KAAaL,IAAI,CAACK,KAAtB;AAAA,SADc,CAAlB;;AAGA,cAAKC,WAAL,CAAiBL,SAAjB;;AACA,cAAKF,KAAL,CAAWQ,sBAAX,IACE,MAAKR,KAAL,CAAWQ,sBAAX,CAAkCN,SAAlC,CADF;AAED,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AA,OAAO,EAAE,MAAI,CAACC,eAAL,CAAqB1E,IAArB,CAJX;AAKE,UAAA,SAAS,EAAC;AALZ,wBAOE,oBAAC,QAAD,OAPF,CAHJ,CAD6B;AAAA,OAA9B,CADH,CADF,GAoBE,KAAKD,KAAL,CAAW+B,QAAX,iBACE;AAAK,QAAA,SAAS,EAAC;AAAf,sBACE;AAAK,QAAA,SAAS,EAAC;AAAf,SACG,KAAK/B,KAAL,CAAW4E,wBADd,CADF,CAtBC,GA6BH,IA7BJ;AA8BD;;;;EArR4BC,qB;;;;gBAAlB9E,S,kBAKkBe,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB8D,sBAAUC,YAA5B,EAA0C;AACrEpE,EAAAA,YAAY,EAAE,IADuD;AAErEQ,EAAAA,QAAQ,EAAE,KAF2D;AAGrEa,EAAAA,QAAQ,EAAE,KAH2D;AAIrE6C,EAAAA,wBAAwB,EAAE;AAJ2C,CAA1C,C;;AA4RxB,IAAMG,MAAM,GAAG,wCAGpB,sCAA6BhF,SAA7B,CAHoB,EAGqB,QAHrB,CAAf;;eAKQgF,M","sourcesContent":["// Libs\r\nimport * as React from 'react';\r\n\r\n// Misc\r\nimport InputGroup from '../inputGroup/InputGroup';\r\nimport * as PlusIcon from 'material-design-icons/content/svg/production/ic_add_circle_outline_24px.svg';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n ValidationError,\r\n defaultBaseTranslations,\r\n} from '../base/input/BaseInput';\r\nimport { Button } from '../button/Button';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\n\r\nexport interface SelectValue {\r\n value: number | string;\r\n label?: string;\r\n forceSelected?: boolean;\r\n}\r\n\r\nexport interface SelectProps extends BaseInputProps<HTMLSelectElement> {\r\n values?: SelectValue[];\r\n defaultEmpty?: boolean;\r\n multiple?: boolean;\r\n selectedValues?: SelectValue[];\r\n onSelectedValuesChange?: (newValues: SelectValue[]) => void;\r\n inputRef?: (input: HTMLSelectElement) => void;\r\n readOnly?: boolean;\r\n readonlyEmptyPlaceholder?: string;\r\n}\r\n\r\nexport interface SelectState extends BaseInputState {}\r\n\r\nexport class SelectRaw extends BaseInput<\r\n SelectProps,\r\n SelectState,\r\n HTMLSelectElement\r\n> {\r\n public static defaultProps = Object.assign({}, BaseInput.defaultProps, {\r\n defaultEmpty: true,\r\n multiple: false,\r\n readOnly: false,\r\n readonlyEmptyPlaceholder: 'N/A',\r\n });\r\n\r\n constructor(props: SelectProps) {\r\n super(props);\r\n const val = !props.value\r\n ? props.defaultEmpty\r\n ? ''\r\n : props.values && props.values.length > 0\r\n ? props.values[0]\r\n : ''\r\n : props.value;\r\n this.state = Object.assign(this.state, { value: val });\r\n this.handleChangeCustom = this.handleChangeCustom.bind(this);\r\n }\r\n\r\n public componentDidMount() {\r\n this.props.multiple && this.handleValid(this.props.selectedValues);\r\n }\r\n\r\n public componentDidUpdate(oldProps: SelectProps) {\r\n if (\r\n oldProps.value !== this.props.value ||\r\n oldProps.validators !== this.props.validators ||\r\n oldProps.customValidators !== this.props.customValidators ||\r\n oldProps.required !== this.props.required ||\r\n oldProps.selectedValues !== this.props.selectedValues\r\n ) {\r\n if (this.props.multiple) {\r\n this.handleValid(this.props.selectedValues);\r\n } else {\r\n this.handleValueChange(this.props.value, true, [], this.props);\r\n }\r\n }\r\n }\r\n\r\n public render() {\r\n const finalValues = this.props.multiple\r\n ? this.props.values.filter(\r\n item =>\r\n this.props.selectedValues.findIndex(t => t.value === item.value) < 0\r\n )\r\n : this.props.values;\r\n return (\r\n <InputGroup title={this.props.title} tooltip={this.props.tooltip}>\r\n <div\r\n className={\r\n 'input__base select-input ' +\r\n this.getValidationClass() +\r\n ' ' +\r\n (this.props.className ? this.props.className : '') +\r\n ' ' +\r\n (this.props.readOnly ? 'readonly' : '') +\r\n ' ' +\r\n (this.props.multiple ? 'multiple' : '')\r\n }\r\n ref={this.containerRef}\r\n >\r\n {this.renderSelectedValues()}\r\n {finalValues.length > 0 &&\r\n ((this.props.multiple && !this.props.readOnly) ||\r\n !this.props.multiple) && (\r\n <div className=\"select-input__select__wrapper\">\r\n {(!this.props.multiple && !this.props.readOnly) ||\r\n this.props.multiple ? (\r\n <select\r\n {...(this.props.id && {\r\n id: this.props.id,\r\n })}\r\n ref={this.inputRef}\r\n disabled={this.getDisabled()}\r\n required={this.props.required}\r\n onChange={this.handleChangeCustom}\r\n value={this.state.value}\r\n className={\r\n 'select-input__select ' +\r\n (this.state.value !== '' ||\r\n (this.props.selectedValues &&\r\n this.props.selectedValues.length > 0)\r\n ? 'filled'\r\n : '')\r\n }\r\n onBlur={this.handleBlur}\r\n onFocus={this.handleFocus}\r\n tabIndex={0}\r\n >\r\n {this.props.defaultEmpty && (\r\n <option\r\n key={-1}\r\n disabled={true}\r\n value=\"\"\r\n style={{ display: 'none' }}\r\n />\r\n )}\r\n {finalValues.map((value, index) => (\r\n <option key={index} value={value.value}>\r\n {value.label ? value.label : value.value}\r\n </option>\r\n ))}\r\n </select>\r\n ) : (\r\n <span\r\n className={\r\n 'select-input__select ' +\r\n (this.state.value !== '' ||\r\n (this.props.selectedValues &&\r\n this.props.selectedValues.length > 0)\r\n ? 'filled'\r\n : '')\r\n }\r\n >\r\n {this.renderReadonly()}\r\n </span>\r\n )}\r\n <span className=\"highlight\" />\r\n <span className=\"bar\" />\r\n {this.renderDefaultValidation()}\r\n {this.props.label && finalValues.length > 0 && (\r\n <label>{this.renderLabel()}</label>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n </InputGroup>\r\n );\r\n }\r\n\r\n protected handleValueChange(\r\n value: string,\r\n isValid: boolean = true,\r\n errors: ValidationError[] = [],\r\n props: SelectProps = this.props,\r\n initializing: boolean = false\r\n ) {\r\n if (!this.props.multiple) {\r\n return super.handleValueChange(\r\n value,\r\n isValid,\r\n errors,\r\n props,\r\n initializing\r\n );\r\n } else if (!initializing) {\r\n this.handleValid(this.props.selectedValues);\r\n }\r\n return {\r\n isValid: true,\r\n errors: [],\r\n };\r\n }\r\n\r\n protected handleBlur(e: React.FocusEvent<HTMLSelectElement>) {\r\n this.props.onBlur && this.props.onBlur();\r\n let state = { focused: false };\r\n if (!this.state.touched && this.props.touchOn === 'blur') {\r\n state = Object.assign(state, { touched: true });\r\n if (!this.props.multiple) {\r\n this.handleValueChange(this.state.value);\r\n } else {\r\n this.handleValid(this.props.selectedValues);\r\n }\r\n }\r\n this.setState(state);\r\n }\r\n\r\n protected handleFocus(e: React.FocusEvent<HTMLSelectElement>) {\r\n this.props.onFocus && this.props.onFocus(e);\r\n let state = { focused: true };\r\n if (!this.state.touched && this.props.touchOn === 'focus') {\r\n state = Object.assign(state, { touched: true });\r\n if (!this.props.multiple) {\r\n this.handleValueChange(this.state.value);\r\n } else {\r\n this.handleValid(this.props.selectedValues);\r\n }\r\n }\r\n this.setState(state);\r\n }\r\n\r\n private handleChangeCustom(event: React.ChangeEvent<HTMLSelectElement>) {\r\n if (this.props.multiple) {\r\n let value = event.target.value;\r\n let val = this.props.values.filter(item => item.value === value)[0];\r\n if (!val) {\r\n if (!isNaN(Number(value))) {\r\n let valNumber = Number(value);\r\n val = this.props.values.filter(item => item.value === valNumber)[0];\r\n }\r\n }\r\n let newValues = this.props.selectedValues.concat(val);\r\n if (val) {\r\n this.props.onSelectedValuesChange &&\r\n this.props.onSelectedValuesChange(newValues);\r\n this.handleValid(newValues);\r\n this.setState({ value: '' });\r\n }\r\n } else {\r\n this.handleChange(event);\r\n }\r\n }\r\n\r\n private handleValid(newValues: SelectValue[]) {\r\n let isValid = true;\r\n let errors: ValidationError[] = [];\r\n if (this.props.required) {\r\n if (newValues.length === 0) {\r\n isValid = false;\r\n errors.push(this.getTranslations(defaultBaseTranslations).required);\r\n }\r\n }\r\n if (this.props.customValidators) {\r\n this.props.customValidators.forEach(customValidator => {\r\n let validInner = false;\r\n validInner = customValidator.Validate(\r\n this.state?.value,\r\n this.props.required,\r\n error => errors.push(error)\r\n );\r\n if (isValid && !validInner) {\r\n isValid = validInner;\r\n }\r\n });\r\n }\r\n if (isValid) {\r\n this.setValid();\r\n } else {\r\n this.setInvalid(errors);\r\n }\r\n }\r\n\r\n private renderReadonly() {\r\n const value = this.props.values.filter(\r\n item => item.value.toString() === this.state.value\r\n )[0];\r\n return value ? (value.label ? value.label : value.value) : '';\r\n }\r\n\r\n private renderSelectedValues() {\r\n return this.props.multiple ? (\r\n this.props.selectedValues.length > 0 ? (\r\n <div className=\"select-input__selectedValue__wrapper\">\r\n {this.props.selectedValues.map((item, index) => (\r\n <div className=\"select-input__selectedValue\" key={index}>\r\n {item.label ? item.label : item.value}\r\n {!this.props.readOnly && (\r\n <Button\r\n disabled={item.forceSelected}\r\n circular={true}\r\n blank={true}\r\n onClick={this.removeItemClick(item)}\r\n className=\"ml-1 transform-rotate--45 line-height--0 p-0\"\r\n >\r\n <PlusIcon />\r\n </Button>\r\n )}\r\n </div>\r\n ))}\r\n </div>\r\n ) : (\r\n this.props.readOnly && (\r\n <div className=\"select-input__selectedValue__wrapper\">\r\n <div className=\"select-input__selectedValue\">\r\n {this.props.readonlyEmptyPlaceholder}\r\n </div>\r\n </div>\r\n )\r\n )\r\n ) : null;\r\n }\r\n\r\n private removeItemClick = (item: SelectValue) => () => {\r\n const newValues = this.props.selectedValues.filter(\r\n sv => sv.value !== item.value\r\n );\r\n this.handleValid(newValues);\r\n this.props.onSelectedValuesChange &&\r\n this.props.onSelectedValuesChange(newValues);\r\n };\r\n}\r\n\r\nexport const Select = withThemeContext<\r\n SelectProps,\r\n InstanceType<typeof SelectRaw>\r\n>(withFormContext<SelectProps>(SelectRaw), 'select');\r\n\r\nexport default Select;\r\n"],"file":"Select.js"}
|
1
|
+
{"version":3,"file":"Select.js","names":["PlusIcon","SelectRaw","BaseInput","constructor","props","item","newValues","selectedValues","filter","sv","value","handleValid","onSelectedValuesChange","val","defaultEmpty","values","length","state","Object","assign","handleChangeCustom","bind","componentDidMount","multiple","componentDidUpdate","oldProps","validators","customValidators","required","handleValueChange","render","finalValues","findIndex","t","title","tooltip","getValidationClass","className","readOnly","containerRef","renderSelectedValues","id","inputRef","getDisabled","handleBlur","handleFocus","display","map","index","label","renderReadonly","renderDefaultValidation","renderLabel","isValid","errors","initializing","e","onBlur","focused","touched","touchOn","setState","onFocus","event","target","isNaN","Number","valNumber","concat","handleChange","push","getTranslations","defaultBaseTranslations","forEach","customValidator","validInner","Validate","error","setValid","setInvalid","toString","forceSelected","removeItemClick","readonlyEmptyPlaceholder","defaultProps","Select","withThemeContext","withFormContext"],"sources":["../../../src/lib/components/select/Select.tsx"],"sourcesContent":["// Libs\r\nimport * as React from 'react';\r\n\r\n// Misc\r\nimport InputGroup from '../inputGroup/InputGroup';\r\nimport * as PlusIcon from 'material-design-icons/content/svg/production/ic_add_circle_outline_24px.svg';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n ValidationError,\r\n defaultBaseTranslations,\r\n} from '../base/input/BaseInput';\r\nimport { Button } from '../button/Button';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\n\r\nexport interface SelectValue {\r\n value: number | string;\r\n label?: string;\r\n forceSelected?: boolean;\r\n}\r\n\r\nexport interface SelectProps extends BaseInputProps<HTMLSelectElement> {\r\n values?: SelectValue[];\r\n defaultEmpty?: boolean;\r\n multiple?: boolean;\r\n selectedValues?: SelectValue[];\r\n onSelectedValuesChange?: (newValues: SelectValue[]) => void;\r\n inputRef?: (input: HTMLSelectElement) => void;\r\n readOnly?: boolean;\r\n readonlyEmptyPlaceholder?: string;\r\n}\r\n\r\nexport interface SelectState extends BaseInputState {}\r\n\r\nexport class SelectRaw extends BaseInput<\r\n SelectProps,\r\n SelectState,\r\n HTMLSelectElement\r\n> {\r\n public static defaultProps = Object.assign({}, BaseInput.defaultProps, {\r\n defaultEmpty: true,\r\n multiple: false,\r\n readOnly: false,\r\n readonlyEmptyPlaceholder: 'N/A',\r\n });\r\n\r\n constructor(props: SelectProps) {\r\n super(props);\r\n const val = !props.value\r\n ? props.defaultEmpty\r\n ? ''\r\n : props.values && props.values.length > 0\r\n ? props.values[0]\r\n : ''\r\n : props.value;\r\n this.state = Object.assign(this.state, { value: val });\r\n this.handleChangeCustom = this.handleChangeCustom.bind(this);\r\n }\r\n\r\n public componentDidMount() {\r\n this.props.multiple && this.handleValid(this.props.selectedValues);\r\n }\r\n\r\n public componentDidUpdate(oldProps: SelectProps) {\r\n if (\r\n oldProps.value !== this.props.value ||\r\n oldProps.validators !== this.props.validators ||\r\n oldProps.customValidators !== this.props.customValidators ||\r\n oldProps.required !== this.props.required ||\r\n oldProps.selectedValues !== this.props.selectedValues\r\n ) {\r\n if (this.props.multiple) {\r\n this.handleValid(this.props.selectedValues);\r\n } else {\r\n this.handleValueChange(this.props.value, true, [], this.props);\r\n }\r\n }\r\n }\r\n\r\n public render() {\r\n const finalValues = this.props.multiple\r\n ? this.props.values.filter(\r\n item =>\r\n this.props.selectedValues.findIndex(t => t.value === item.value) < 0\r\n )\r\n : this.props.values;\r\n return (\r\n <InputGroup title={this.props.title} tooltip={this.props.tooltip}>\r\n <div\r\n className={\r\n 'input__base select-input ' +\r\n this.getValidationClass() +\r\n ' ' +\r\n (this.props.className ? this.props.className : '') +\r\n ' ' +\r\n (this.props.readOnly ? 'readonly' : '') +\r\n ' ' +\r\n (this.props.multiple ? 'multiple' : '')\r\n }\r\n ref={this.containerRef}\r\n >\r\n {this.renderSelectedValues()}\r\n {finalValues.length > 0 &&\r\n ((this.props.multiple && !this.props.readOnly) ||\r\n !this.props.multiple) && (\r\n <div className=\"select-input__select__wrapper\">\r\n {(!this.props.multiple && !this.props.readOnly) ||\r\n this.props.multiple ? (\r\n <select\r\n {...(this.props.id && {\r\n id: this.props.id,\r\n })}\r\n ref={this.inputRef}\r\n disabled={this.getDisabled()}\r\n required={this.props.required}\r\n onChange={this.handleChangeCustom}\r\n value={this.state.value}\r\n className={\r\n 'select-input__select ' +\r\n (this.state.value !== '' ||\r\n (this.props.selectedValues &&\r\n this.props.selectedValues.length > 0)\r\n ? 'filled'\r\n : '')\r\n }\r\n onBlur={this.handleBlur}\r\n onFocus={this.handleFocus}\r\n tabIndex={0}\r\n >\r\n {this.props.defaultEmpty && (\r\n <option\r\n key={-1}\r\n disabled={true}\r\n value=\"\"\r\n style={{ display: 'none' }}\r\n />\r\n )}\r\n {finalValues.map((value, index) => (\r\n <option key={index} value={value.value}>\r\n {value.label ? value.label : value.value}\r\n </option>\r\n ))}\r\n </select>\r\n ) : (\r\n <span\r\n className={\r\n 'select-input__select ' +\r\n (this.state.value !== '' ||\r\n (this.props.selectedValues &&\r\n this.props.selectedValues.length > 0)\r\n ? 'filled'\r\n : '')\r\n }\r\n >\r\n {this.renderReadonly()}\r\n </span>\r\n )}\r\n <span className=\"highlight\" />\r\n <span className=\"bar\" />\r\n {this.renderDefaultValidation()}\r\n {this.props.label && finalValues.length > 0 && (\r\n <label>{this.renderLabel()}</label>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n </InputGroup>\r\n );\r\n }\r\n\r\n protected handleValueChange(\r\n value: string,\r\n isValid: boolean = true,\r\n errors: ValidationError[] = [],\r\n props: SelectProps = this.props,\r\n initializing: boolean = false\r\n ) {\r\n if (!this.props.multiple) {\r\n return super.handleValueChange(\r\n value,\r\n isValid,\r\n errors,\r\n props,\r\n initializing\r\n );\r\n } else if (!initializing) {\r\n this.handleValid(this.props.selectedValues);\r\n }\r\n return {\r\n isValid: true,\r\n errors: [],\r\n };\r\n }\r\n\r\n protected handleBlur(e: React.FocusEvent<HTMLSelectElement>) {\r\n this.props.onBlur && this.props.onBlur();\r\n let state = { focused: false };\r\n if (!this.state.touched && this.props.touchOn === 'blur') {\r\n state = Object.assign(state, { touched: true });\r\n if (!this.props.multiple) {\r\n this.handleValueChange(this.state.value);\r\n } else {\r\n this.handleValid(this.props.selectedValues);\r\n }\r\n }\r\n this.setState(state);\r\n }\r\n\r\n protected handleFocus(e: React.FocusEvent<HTMLSelectElement>) {\r\n this.props.onFocus && this.props.onFocus(e);\r\n let state = { focused: true };\r\n if (!this.state.touched && this.props.touchOn === 'focus') {\r\n state = Object.assign(state, { touched: true });\r\n if (!this.props.multiple) {\r\n this.handleValueChange(this.state.value);\r\n } else {\r\n this.handleValid(this.props.selectedValues);\r\n }\r\n }\r\n this.setState(state);\r\n }\r\n\r\n private handleChangeCustom(event: React.ChangeEvent<HTMLSelectElement>) {\r\n if (this.props.multiple) {\r\n let value = event.target.value;\r\n let val = this.props.values.filter(item => item.value === value)[0];\r\n if (!val) {\r\n if (!isNaN(Number(value))) {\r\n let valNumber = Number(value);\r\n val = this.props.values.filter(item => item.value === valNumber)[0];\r\n }\r\n }\r\n let newValues = this.props.selectedValues.concat(val);\r\n if (val) {\r\n this.props.onSelectedValuesChange &&\r\n this.props.onSelectedValuesChange(newValues);\r\n this.handleValid(newValues);\r\n this.setState({ value: '' });\r\n }\r\n } else {\r\n this.handleChange(event);\r\n }\r\n }\r\n\r\n private handleValid(newValues: SelectValue[]) {\r\n let isValid = true;\r\n let errors: ValidationError[] = [];\r\n if (this.props.required) {\r\n if (newValues.length === 0) {\r\n isValid = false;\r\n errors.push(this.getTranslations(defaultBaseTranslations).required);\r\n }\r\n }\r\n if (this.props.customValidators) {\r\n this.props.customValidators.forEach(customValidator => {\r\n let validInner = false;\r\n validInner = customValidator.Validate(\r\n this.state?.value,\r\n this.props.required,\r\n error => errors.push(error)\r\n );\r\n if (isValid && !validInner) {\r\n isValid = validInner;\r\n }\r\n });\r\n }\r\n if (isValid) {\r\n this.setValid();\r\n } else {\r\n this.setInvalid(errors);\r\n }\r\n }\r\n\r\n private renderReadonly() {\r\n const value = this.props.values.filter(\r\n item => item.value.toString() === this.state.value\r\n )[0];\r\n return value ? (value.label ? value.label : value.value) : '';\r\n }\r\n\r\n private renderSelectedValues() {\r\n return this.props.multiple ? (\r\n this.props.selectedValues.length > 0 ? (\r\n <div className=\"select-input__selectedValue__wrapper\">\r\n {this.props.selectedValues.map((item, index) => (\r\n <div className=\"select-input__selectedValue\" key={index}>\r\n {item.label ? item.label : item.value}\r\n {!this.props.readOnly && (\r\n <Button\r\n disabled={item.forceSelected}\r\n circular={true}\r\n blank={true}\r\n onClick={this.removeItemClick(item)}\r\n className=\"ml-1 transform-rotate--45 line-height--0 p-0\"\r\n >\r\n <PlusIcon />\r\n </Button>\r\n )}\r\n </div>\r\n ))}\r\n </div>\r\n ) : (\r\n this.props.readOnly && (\r\n <div className=\"select-input__selectedValue__wrapper\">\r\n <div className=\"select-input__selectedValue\">\r\n {this.props.readonlyEmptyPlaceholder}\r\n </div>\r\n </div>\r\n )\r\n )\r\n ) : null;\r\n }\r\n\r\n private removeItemClick = (item: SelectValue) => () => {\r\n const newValues = this.props.selectedValues.filter(\r\n sv => sv.value !== item.value\r\n );\r\n this.handleValid(newValues);\r\n this.props.onSelectedValuesChange &&\r\n this.props.onSelectedValuesChange(newValues);\r\n };\r\n}\r\n\r\nexport const Select = withThemeContext<\r\n SelectProps,\r\n InstanceType<typeof SelectRaw>\r\n>(withFormContext<SelectProps>(SelectRaw), 'select');\r\n\r\nexport default Select;\r\n"],"mappings":";;;;;;;AACA;;AAGA;;AAEA;;AAOA;;AACA;;AACA;;;;;;;;;;;;IAVYA,Q,YAAAA,Q;;;;;;AAAAA,Q;;;;;;;AA+BL,MAAMC,SAAN,SAAwBC,oBAAxB,CAIL;EAQAC,WAAW,CAACC,KAAD,EAAqB;IAC9B,MAAMA,KAAN;;IAD8B,yCA2QLC,IAAD,IAAuB,MAAM;MACrD,MAAMC,SAAS,GAAG,KAAKF,KAAL,CAAWG,cAAX,CAA0BC,MAA1B,CAChBC,EAAE,IAAIA,EAAE,CAACC,KAAH,KAAaL,IAAI,CAACK,KADR,CAAlB;MAGA,KAAKC,WAAL,CAAiBL,SAAjB;MACA,KAAKF,KAAL,CAAWQ,sBAAX,IACE,KAAKR,KAAL,CAAWQ,sBAAX,CAAkCN,SAAlC,CADF;IAED,CAlR+B;;I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