intelicoreact 0.2.97 → 0.3.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.
|
@@ -180,10 +180,10 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
180
180
|
var depend = getDepends(modalBtnTrigger);
|
|
181
181
|
|
|
182
182
|
var getMarkupForElement = function getMarkupForElement(item, index, optTestId) {
|
|
183
|
-
var _item$label2, _item$label2$toLowerC, _item$label2$toLowerC2, _item$label2$toLowerC3, _searchValue$toLowerC, _item$value;
|
|
183
|
+
var _item$label2, _item$label2$toLowerC, _item$label2$toLowerC2, _item$label2$toLowerC3, _searchValue$toLowerC, _item$value, _item$value$toString;
|
|
184
184
|
|
|
185
185
|
return item !== null && item !== void 0 && (_item$label2 = item.label) !== null && _item$label2 !== void 0 && (_item$label2$toLowerC = _item$label2.toLowerCase) !== null && _item$label2$toLowerC !== void 0 && (_item$label2$toLowerC2 = _item$label2$toLowerC.call(_item$label2)) !== null && _item$label2$toLowerC2 !== void 0 && (_item$label2$toLowerC3 = _item$label2$toLowerC2.includes) !== null && _item$label2$toLowerC3 !== void 0 && _item$label2$toLowerC3.call(_item$label2$toLowerC2, (searchValue === null || searchValue === void 0 ? void 0 : (_searchValue$toLowerC = searchValue.toLowerCase) === null || _searchValue$toLowerC === void 0 ? void 0 : _searchValue$toLowerC.call(searchValue)) || '') ? /*#__PURE__*/_react.default.createElement("button", {
|
|
186
|
-
"data-testid": "dropdown--button--key-".concat(optTestId || (item === null || item === void 0 ? void 0 : (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.replace(/\s/, '-')) || (item === null || item === void 0 ? void 0 : item.key) || 'item', "--option"),
|
|
186
|
+
"data-testid": "dropdown--button--key-".concat(optTestId || (item === null || item === void 0 ? void 0 : (_item$value = item.value) === null || _item$value === void 0 ? void 0 : (_item$value$toString = _item$value.toString()) === null || _item$value$toString === void 0 ? void 0 : _item$value$toString.replace(/\s/, '-')) || (item === null || item === void 0 ? void 0 : item.key) || 'item', "--option"),
|
|
187
187
|
key: item.value,
|
|
188
188
|
onClick: function onClick() {
|
|
189
189
|
return depend.onChange(item);
|
|
@@ -56,7 +56,9 @@ var RangeInputs = function RangeInputs(_ref) {
|
|
|
56
56
|
label = _ref$label === void 0 ? '' : _ref$label,
|
|
57
57
|
_ref$isPrice = _ref.isPrice,
|
|
58
58
|
isPrice = _ref$isPrice === void 0 ? false : _ref$isPrice,
|
|
59
|
-
testId = _ref.testId
|
|
59
|
+
testId = _ref.testId,
|
|
60
|
+
_ref$withZero = _ref.withZero,
|
|
61
|
+
withZero = _ref$withZero === void 0 ? false : _ref$withZero;
|
|
60
62
|
|
|
61
63
|
var _useState = (0, _react.useState)({
|
|
62
64
|
from: '',
|
|
@@ -70,11 +72,20 @@ var RangeInputs = function RangeInputs(_ref) {
|
|
|
70
72
|
var inputToRef = (0, _react.useRef)(null);
|
|
71
73
|
|
|
72
74
|
var isValidRange = function isValidRange(from, to) {
|
|
73
|
-
var replaceNotDigitFrom = from === null || from === void 0 ? void 0 : from.toString().replace(/[^\d]/g, '')
|
|
74
|
-
|
|
75
|
-
var correctFrom
|
|
76
|
-
var
|
|
77
|
-
|
|
75
|
+
var replaceNotDigitFrom = from === null || from === void 0 ? void 0 : from.toString().replace(/[^\d]/g, '');
|
|
76
|
+
var replaceNotDigitFromTo = to === null || to === void 0 ? void 0 : to.toString().replace(/[^\d]/g, '');
|
|
77
|
+
var correctFrom;
|
|
78
|
+
var correctTo;
|
|
79
|
+
|
|
80
|
+
if (!withZero) {
|
|
81
|
+
correctFrom = parseInt(replaceNotDigitFrom);
|
|
82
|
+
correctTo = parseInt(replaceNotDigitFromTo);
|
|
83
|
+
} else {
|
|
84
|
+
correctFrom = replaceNotDigitFrom;
|
|
85
|
+
correctTo = replaceNotDigitFromTo;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return !!(correctFrom && correctTo && correctFrom <= correctTo);
|
|
78
89
|
};
|
|
79
90
|
|
|
80
91
|
var valueFormatter = function valueFormatter(value) {
|
|
@@ -88,14 +99,14 @@ var RangeInputs = function RangeInputs(_ref) {
|
|
|
88
99
|
var rangeValidation = function rangeValidation(e, key) {
|
|
89
100
|
var oppositeKey = key === 'from' ? 'to' : 'from';
|
|
90
101
|
|
|
91
|
-
if (!(valueObj !== null && valueObj !== void 0 && valueObj.from) && !(valueObj !== null && valueObj !== void 0 && valueObj.to)) {
|
|
102
|
+
if (!withZero && !(valueObj !== null && valueObj !== void 0 && valueObj.from) && !(valueObj !== null && valueObj !== void 0 && valueObj.to)) {
|
|
92
103
|
setError({
|
|
93
104
|
from: '',
|
|
94
105
|
to: ''
|
|
95
106
|
});
|
|
96
107
|
setInnerError === null || setInnerError === void 0 ? void 0 : setInnerError('');
|
|
97
108
|
return e;
|
|
98
|
-
} else if (!valueObj[oppositeKey]) {
|
|
109
|
+
} else if (!withZero && !valueObj[oppositeKey]) {
|
|
99
110
|
var mustToFocus = key === 'from' ? inputToRef.current : inputFromRef.current;
|
|
100
111
|
mustToFocus.focus();
|
|
101
112
|
} else if (!isValidRange(valueObj === null || valueObj === void 0 ? void 0 : valueObj.from, valueObj === null || valueObj === void 0 ? void 0 : valueObj.to)) {
|