iguazio.dashboard-react-controls 0.0.39 → 1.2.0
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/dist/components/Backdrop/Backdrop.js +4 -11
- package/dist/components/Button/Button.js +25 -28
- package/dist/components/ConfirmDialog/ConfirmDialog.js +10 -24
- package/dist/components/FormCheckBox/FormCheckBox.js +25 -25
- package/dist/components/FormChipCell/FormChip/FormChip.js +33 -33
- package/dist/components/FormChipCell/FormChipCell.js +66 -109
- package/dist/components/FormChipCell/FormChipCellView.js +19 -37
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.js +58 -90
- package/dist/components/FormChipCell/NewChipInput/NewChipInput.js +24 -22
- package/dist/components/FormChipCell/formChipCell.util.js +0 -1
- package/dist/components/FormCombobox/FormCombobox.js +82 -140
- package/dist/components/FormInput/FormInput.js +110 -175
- package/dist/components/FormInput/InputNumberButtons/InputNumberButtons.js +6 -21
- package/dist/components/FormKeyValueTable/FormKeyValueTable.js +23 -39
- package/dist/components/FormRadio/FormRadio.js +23 -22
- package/dist/components/FormSelect/FormSelect.js +56 -92
- package/dist/components/FormSelect/FormSelect.test.js +19 -35
- package/dist/components/FormTextarea/FormTextarea.js +44 -69
- package/dist/components/Modal/Modal.js +8 -21
- package/dist/components/Modal/Modal.scss +2 -2
- package/dist/components/PopUpDialog/PopUpDialog.js +28 -43
- package/dist/components/RoundedIcon/RoundedIcon.js +7 -18
- package/dist/components/RoundedIcon/roundedIcon.scss +2 -2
- package/dist/components/Tip/Tip.js +25 -40
- package/dist/components/Tip/Tip.test.js +36 -45
- package/dist/components/Tooltip/Tooltip.js +40 -64
- package/dist/components/TooltipTemplate/ProducerTooltipTemplate.js +2 -8
- package/dist/components/TooltipTemplate/TextTooltipTemplate.js +2 -12
- package/dist/components/Wizard/Wizard.js +35 -57
- package/dist/components/Wizard/Wizard.scss +1 -3
- package/dist/components/Wizard/WizardSteps/WizardSteps.js +4 -16
- package/dist/components/Wizard/WizardSteps/WizardSteps.scss +1 -0
- package/dist/components/index.js +0 -18
- package/dist/constants.js +4 -6
- package/dist/elements/FormActionButton/FormActionButton.js +6 -12
- package/dist/elements/FormRowActions/FormRowActions.js +6 -18
- package/dist/elements/HiddenChipsBlock/HiddenChipsBlock.js +37 -55
- package/dist/elements/OptionsMenu/OptionsMenu.js +4 -14
- package/dist/elements/SelectOption/SelectOption.js +6 -18
- package/dist/elements/SelectOption/SelectOption.test.js +19 -12
- package/dist/elements/SelectOption/selectOption.scss +5 -2
- package/dist/elements/ValidationTemplate/ValidationTemplate.js +2 -11
- package/dist/elements/index.js +0 -6
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useDebounce.js +1 -5
- package/dist/hooks/useDetectOutsideClick.js +4 -8
- package/dist/hooks/useFormTable.hook.js +31 -41
- package/dist/images/archive-icon.svg +3 -0
- package/dist/images/arrow.svg +1 -1
- package/dist/images/close.svg +2 -2
- package/dist/images/collapse.svg +2 -2
- package/dist/images/copy-to-clipboard-icon.svg +3 -0
- package/dist/images/deploy-icon.svg +4 -0
- package/dist/images/edit.svg +1 -1
- package/dist/images/edit_old.svg +3 -0
- package/dist/images/expand.svg +2 -2
- package/dist/images/eye-icon.svg +3 -0
- package/dist/images/link-icon.svg +5 -0
- package/dist/images/monitor-icon.svg +3 -0
- package/dist/images/refresh.svg +1 -1
- package/dist/images/tag-icon.svg +4 -0
- package/dist/images/unarchive-icon.svg +3 -0
- package/dist/images/yaml.svg +2 -3
- package/dist/images/yaml_old.svg +4 -0
- package/dist/index.js +0 -13
- package/dist/scss/borders.scss +1 -1
- package/dist/scss/colors.scss +2 -0
- package/dist/scss/common.scss +7 -3
- package/dist/scss/mixins.scss +6 -19
- package/dist/scss/shadows.scss +3 -3
- package/dist/scss/variables.scss +2 -0
- package/dist/types.js +19 -49
- package/dist/utils/common.util.js +3 -13
- package/dist/utils/form.util.js +20 -24
- package/dist/utils/generateChipsList.util.js +0 -3
- package/dist/utils/getFirstScrollableParent.util.js +0 -5
- package/dist/utils/validation.util.js +72 -94
- package/package.json +104 -104
- package/dist/images/eye.svg +0 -4
|
@@ -1,151 +1,124 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _reactFinalForm = require("react-final-form");
|
|
13
|
-
|
|
14
10
|
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
-
|
|
20
13
|
var _elements = require("../../elements");
|
|
21
|
-
|
|
22
14
|
var _PopUpDialog = _interopRequireDefault(require("../PopUpDialog/PopUpDialog"));
|
|
23
|
-
|
|
24
15
|
var _TextTooltipTemplate = _interopRequireDefault(require("../TooltipTemplate/TextTooltipTemplate"));
|
|
25
|
-
|
|
26
16
|
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
27
|
-
|
|
28
17
|
var _validation = require("../../utils/validation.util");
|
|
29
|
-
|
|
30
18
|
var _hooks = require("../../hooks");
|
|
31
|
-
|
|
32
19
|
var _types = require("../../types");
|
|
33
|
-
|
|
34
20
|
var _arrow = require("../../images/arrow.svg");
|
|
35
|
-
|
|
36
21
|
var _search = require("../../images/search.svg");
|
|
37
|
-
|
|
38
22
|
var _warning = require("../../images/warning.svg");
|
|
39
|
-
|
|
40
23
|
var _invalid = require("../../images/invalid.svg");
|
|
41
|
-
|
|
42
24
|
require("./formCombobox.scss");
|
|
43
|
-
|
|
44
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
45
|
-
|
|
46
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
|
-
|
|
48
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
49
|
-
|
|
50
28
|
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; }
|
|
51
|
-
|
|
52
29
|
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; }
|
|
53
|
-
|
|
54
30
|
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; }
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
|
|
31
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
33
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
58
34
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
59
|
-
|
|
60
35
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
61
|
-
|
|
62
36
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
37
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
38
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
39
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
|
|
40
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
41
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
42
|
+
an addition restriction as set forth herein. You may not use this
|
|
43
|
+
file except in compliance with the License. You may obtain a copy of
|
|
44
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
45
|
+
Unless required by applicable law or agreed to in writing, software
|
|
46
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
47
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
48
|
+
implied. See the License for the specific language governing
|
|
49
|
+
permissions and limitations under the License.
|
|
50
|
+
In addition, you may not use the software for any purposes that are
|
|
51
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
52
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
53
|
+
such restriction.
|
|
54
|
+
*/
|
|
70
55
|
var FormCombobox = function FormCombobox(_ref) {
|
|
71
56
|
var comboboxClassName = _ref.comboboxClassName,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
57
|
+
density = _ref.density,
|
|
58
|
+
disabled = _ref.disabled,
|
|
59
|
+
hideSearchInput = _ref.hideSearchInput,
|
|
60
|
+
inputDefaultValue = _ref.inputDefaultValue,
|
|
61
|
+
inputPlaceholder = _ref.inputPlaceholder,
|
|
62
|
+
invalidText = _ref.invalidText,
|
|
63
|
+
label = _ref.label,
|
|
64
|
+
maxSuggestedMatches = _ref.maxSuggestedMatches,
|
|
65
|
+
name = _ref.name,
|
|
66
|
+
onBlur = _ref.onBlur,
|
|
67
|
+
onChange = _ref.onChange,
|
|
68
|
+
onFocus = _ref.onFocus,
|
|
69
|
+
required = _ref.required,
|
|
70
|
+
rules = _ref.rules,
|
|
71
|
+
selectDefaultValue = _ref.selectDefaultValue,
|
|
72
|
+
selectOptions = _ref.selectOptions,
|
|
73
|
+
selectPlaceholder = _ref.selectPlaceholder,
|
|
74
|
+
suggestionList = _ref.suggestionList,
|
|
75
|
+
validator = _ref.validator,
|
|
76
|
+
withoutBorder = _ref.withoutBorder;
|
|
93
77
|
var _useField = (0, _reactFinalForm.useField)(name),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
78
|
+
input = _useField.input,
|
|
79
|
+
meta = _useField.meta;
|
|
97
80
|
var _useState = (0, _react.useState)(inputDefaultValue),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
81
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
82
|
+
inputValue = _useState2[0],
|
|
83
|
+
setInputValue = _useState2[1];
|
|
102
84
|
var _useState3 = (0, _react.useState)(selectDefaultValue),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
85
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
86
|
+
selectValue = _useState4[0],
|
|
87
|
+
setSelectValue = _useState4[1];
|
|
107
88
|
var _useState5 = (0, _react.useState)({
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
89
|
+
left: '0px'
|
|
90
|
+
}),
|
|
91
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
92
|
+
dropdownStyle = _useState6[0],
|
|
93
|
+
setDropdownStyle = _useState6[1];
|
|
114
94
|
var _useState7 = (0, _react.useState)(false),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
95
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
96
|
+
showSelectDropdown = _useState8[0],
|
|
97
|
+
setShowSelectDropdown = _useState8[1];
|
|
119
98
|
var _useState9 = (0, _react.useState)(false),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
99
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
100
|
+
showSuggestionList = _useState10[0],
|
|
101
|
+
setShowSuggestionList = _useState10[1];
|
|
124
102
|
var _useState11 = (0, _react.useState)(suggestionList),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
103
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
104
|
+
dropdownList = _useState12[0],
|
|
105
|
+
setDropdownList = _useState12[1];
|
|
129
106
|
var _useState13 = (0, _react.useState)(false),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
107
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
108
|
+
searchIsFocused = _useState14[0],
|
|
109
|
+
setSearchIsFocused = _useState14[1];
|
|
134
110
|
var _useState15 = (0, _react.useState)(false),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
111
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
112
|
+
isInvalid = _useState16[0],
|
|
113
|
+
setIsInvalid = _useState16[1];
|
|
139
114
|
var _useState17 = (0, _react.useState)(rules),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
115
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
116
|
+
validationRules = _useState18[0],
|
|
117
|
+
setValidationRules = _useState18[1];
|
|
144
118
|
var _useState19 = (0, _react.useState)(false),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
119
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
120
|
+
showValidationRules = _useState20[0],
|
|
121
|
+
setShowValidationRules = _useState20[1];
|
|
149
122
|
var comboboxRef = (0, _react.useRef)();
|
|
150
123
|
var selectRef = (0, _react.useRef)();
|
|
151
124
|
var inputRef = (0, _react.useRef)();
|
|
@@ -185,10 +158,8 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
185
158
|
onBlur && onBlur(input.value);
|
|
186
159
|
}
|
|
187
160
|
}, [input, onBlur]);
|
|
188
|
-
|
|
189
161
|
var handleScroll = function handleScroll(event) {
|
|
190
162
|
if (comboboxRef.current.contains(event.target)) return;
|
|
191
|
-
|
|
192
163
|
if (!event.target.closest('.pop-up-dialog') && !event.target.classList.contains('form-field-combobox')) {
|
|
193
164
|
setShowValidationRules(false);
|
|
194
165
|
setShowSelectDropdown(false);
|
|
@@ -196,7 +167,6 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
196
167
|
inputRef.current.blur();
|
|
197
168
|
}
|
|
198
169
|
};
|
|
199
|
-
|
|
200
170
|
(0, _react.useEffect)(function () {
|
|
201
171
|
window.addEventListener('click', handleOutsideClick);
|
|
202
172
|
return function () {
|
|
@@ -207,44 +177,37 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
207
177
|
if (showValidationRules || showSelectDropdown || showSuggestionList) {
|
|
208
178
|
window.addEventListener('scroll', handleScroll, true);
|
|
209
179
|
}
|
|
210
|
-
|
|
211
180
|
return function () {
|
|
212
181
|
window.removeEventListener('scroll', handleScroll, true);
|
|
213
182
|
};
|
|
214
183
|
}, [showSelectDropdown, showSuggestionList, showValidationRules]);
|
|
215
|
-
|
|
216
184
|
var getValidationRules = function getValidationRules() {
|
|
217
185
|
return validationRules.map(function (_ref2) {
|
|
218
186
|
var _ref2$isValid = _ref2.isValid,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
187
|
+
isValid = _ref2$isValid === void 0 ? false : _ref2$isValid,
|
|
188
|
+
label = _ref2.label,
|
|
189
|
+
name = _ref2.name;
|
|
222
190
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.ValidationTemplate, {
|
|
223
191
|
valid: isValid,
|
|
224
192
|
validationMessage: label
|
|
225
193
|
}, name);
|
|
226
194
|
});
|
|
227
195
|
};
|
|
228
|
-
|
|
229
196
|
var handleInputChange = function handleInputChange(event) {
|
|
230
197
|
var target = event.target;
|
|
231
198
|
setDropdownStyle({
|
|
232
199
|
left: "".concat(target.selectionStart < 30 ? target.selectionStart : 30, "ch")
|
|
233
200
|
});
|
|
234
|
-
|
|
235
201
|
if (searchIsFocused) {
|
|
236
202
|
setSearchIsFocused(false);
|
|
237
203
|
}
|
|
238
|
-
|
|
239
204
|
setInputValue(target.value);
|
|
240
205
|
input.onChange("".concat(selectValue.id).concat(target.value));
|
|
241
206
|
onChange && onChange(selectValue.id, target.value);
|
|
242
|
-
|
|
243
207
|
if (dropdownList.length > 0) {
|
|
244
208
|
setShowSuggestionList(true);
|
|
245
209
|
}
|
|
246
210
|
};
|
|
247
|
-
|
|
248
211
|
var handleSelectOptionClick = function handleSelectOptionClick(selectedOption, option) {
|
|
249
212
|
if (selectedOption.id !== selectValue.id) {
|
|
250
213
|
setSelectValue(selectedOption);
|
|
@@ -256,42 +219,34 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
256
219
|
inputRef.current.focus();
|
|
257
220
|
}
|
|
258
221
|
};
|
|
259
|
-
|
|
260
222
|
var handleSuggestionListOptionClick = function handleSuggestionListOptionClick(option) {
|
|
261
223
|
var inputValueItems = inputValue.split('/');
|
|
262
224
|
var valueIndex = inputValueItems.length - 1;
|
|
263
225
|
var formattedValue = option.customDelimiter ? inputValueItems[valueIndex].replace(new RegExp("".concat(option.customDelimiter, ".*")), '') + option.id : option.id;
|
|
264
226
|
if (inputValueItems.length <= maxSuggestedMatches - 1) formattedValue += '/';
|
|
265
227
|
inputValueItems[valueIndex] = formattedValue;
|
|
266
|
-
|
|
267
228
|
if (searchIsFocused) {
|
|
268
229
|
setSearchIsFocused(false);
|
|
269
230
|
}
|
|
270
|
-
|
|
271
231
|
if (inputValueItems.join('/') !== inputValue) {
|
|
272
232
|
setInputValue(inputValueItems.join('/'));
|
|
273
233
|
input.onChange("".concat(selectValue.id).concat(inputValueItems.join('/')));
|
|
274
234
|
onChange && onChange(selectValue.id, inputValueItems.join('/'));
|
|
275
235
|
}
|
|
276
|
-
|
|
277
236
|
setShowSuggestionList(false);
|
|
278
237
|
inputRef.current.focus();
|
|
279
238
|
setDropdownStyle({
|
|
280
239
|
left: "".concat(inputRef.current.selectionStart < 30 ? inputRef.current.selectionStart : 30, "ch")
|
|
281
240
|
});
|
|
282
241
|
};
|
|
283
|
-
|
|
284
242
|
var inputOnFocus = function inputOnFocus() {
|
|
285
243
|
onFocus && onFocus();
|
|
286
244
|
input.onFocus(new Event('focus'));
|
|
287
|
-
|
|
288
245
|
if (showSelectDropdown) {
|
|
289
246
|
setShowSelectDropdown(false);
|
|
290
247
|
}
|
|
291
|
-
|
|
292
248
|
setShowSuggestionList(true);
|
|
293
249
|
};
|
|
294
|
-
|
|
295
250
|
var suggestionListSearchChange = function suggestionListSearchChange(event) {
|
|
296
251
|
event.persist();
|
|
297
252
|
setDropdownList(function () {
|
|
@@ -300,7 +255,6 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
300
255
|
});
|
|
301
256
|
});
|
|
302
257
|
};
|
|
303
|
-
|
|
304
258
|
var toggleSelect = (0, _react.useCallback)(function () {
|
|
305
259
|
if (showSelectDropdown) {
|
|
306
260
|
setShowSelectDropdown(false);
|
|
@@ -317,23 +271,18 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
317
271
|
onFocus && onFocus(input.value);
|
|
318
272
|
}
|
|
319
273
|
}, [input, onBlur, onFocus, showSelectDropdown]);
|
|
320
|
-
|
|
321
274
|
var validateField = function validateField(value, allValues) {
|
|
322
275
|
var _value$split$;
|
|
323
|
-
|
|
324
276
|
var valueToValidate = (_value$split$ = value.split(selectValue.id)[1]) !== null && _value$split$ !== void 0 ? _value$split$ : '';
|
|
325
277
|
var validationError = null;
|
|
326
|
-
|
|
327
278
|
if (!(0, _lodash.isEmpty)(validationRules)) {
|
|
328
279
|
var _checkPatternsValidit = (0, _validation.checkPatternsValidity)(rules, valueToValidate),
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
280
|
+
_checkPatternsValidit2 = _slicedToArray(_checkPatternsValidit, 2),
|
|
281
|
+
newRules = _checkPatternsValidit2[0],
|
|
282
|
+
isValidField = _checkPatternsValidit2[1];
|
|
333
283
|
var invalidRules = newRules.filter(function (rule) {
|
|
334
284
|
return !rule.isValid;
|
|
335
285
|
});
|
|
336
|
-
|
|
337
286
|
if (!isValidField) {
|
|
338
287
|
validationError = invalidRules.map(function (rule) {
|
|
339
288
|
return {
|
|
@@ -343,7 +292,6 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
343
292
|
});
|
|
344
293
|
}
|
|
345
294
|
}
|
|
346
|
-
|
|
347
295
|
if ((0, _lodash.isEmpty)(validationError)) {
|
|
348
296
|
if (valueToValidate.startsWith(' ')) {
|
|
349
297
|
validationError = {
|
|
@@ -357,21 +305,17 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
357
305
|
};
|
|
358
306
|
}
|
|
359
307
|
}
|
|
360
|
-
|
|
361
308
|
if (!validationError && validator) {
|
|
362
309
|
validationError = validator(value, allValues);
|
|
363
310
|
}
|
|
364
|
-
|
|
365
311
|
return validationError;
|
|
366
312
|
};
|
|
367
|
-
|
|
368
313
|
var warningIconClick = function warningIconClick() {
|
|
369
314
|
setShowValidationRules(function (state) {
|
|
370
315
|
return !state;
|
|
371
316
|
});
|
|
372
317
|
setShowSelectDropdown(false);
|
|
373
318
|
};
|
|
374
|
-
|
|
375
319
|
var comboboxClassNames = (0, _classnames.default)(comboboxClassName, 'form-field-combobox', 'form-field', isInvalid && 'form-field-combobox_invalid');
|
|
376
320
|
var iconClassNames = (0, _classnames.default)(showSelectDropdown && 'form-field-combobox__icon_open', 'form-field-combobox__icon');
|
|
377
321
|
var selectValueClassNames = (0, _classnames.default)(selectValue.className);
|
|
@@ -381,9 +325,8 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
381
325
|
validate: validateField,
|
|
382
326
|
children: function children(_ref3) {
|
|
383
327
|
var _meta$error$label, _meta$error;
|
|
384
|
-
|
|
385
328
|
var input = _ref3.input,
|
|
386
|
-
|
|
329
|
+
meta = _ref3.meta;
|
|
387
330
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
388
331
|
className: comboboxClassNames,
|
|
389
332
|
ref: comboboxRef,
|
|
@@ -516,7 +459,6 @@ var FormCombobox = function FormCombobox(_ref) {
|
|
|
516
459
|
}
|
|
517
460
|
});
|
|
518
461
|
};
|
|
519
|
-
|
|
520
462
|
FormCombobox.defaultProps = {
|
|
521
463
|
comboboxClassName: '',
|
|
522
464
|
density: 'normal',
|