intelicoreact 1.0.96 → 1.0.97
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.
|
@@ -204,7 +204,11 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
204
204
|
var inputValue = e.target.value;
|
|
205
205
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
206
206
|
setSearchValue(inputValue);
|
|
207
|
-
|
|
207
|
+
|
|
208
|
+
if (searchValue && !e.target.value) {
|
|
209
|
+
onChange('');
|
|
210
|
+
setIsValueDeleted(true);
|
|
211
|
+
} else setIsValueDeleted(false);
|
|
208
212
|
}
|
|
209
213
|
};
|
|
210
214
|
(0, _react.useEffect)(function () {
|
|
@@ -132,6 +132,11 @@ function InputMask2() {
|
|
|
132
132
|
isInitValue = _useState6[0],
|
|
133
133
|
setIsInitValue = _useState6[1];
|
|
134
134
|
|
|
135
|
+
var _useState7 = (0, _react.useState)(0),
|
|
136
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
137
|
+
selectedLength = _useState8[0],
|
|
138
|
+
setSelectedLength = _useState8[1];
|
|
139
|
+
|
|
135
140
|
var inputRef = (0, _react.useRef)(null);
|
|
136
141
|
var keyDownRef = (0, _react.useRef)(null);
|
|
137
142
|
|
|
@@ -152,20 +157,20 @@ function InputMask2() {
|
|
|
152
157
|
}; // ERRORS MANAGEMENT FUNCTIONS | START //
|
|
153
158
|
|
|
154
159
|
|
|
155
|
-
var _useState7 = (0, _react.useState)(false),
|
|
156
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
157
|
-
isError = _useState8[0],
|
|
158
|
-
setError = _useState8[1];
|
|
159
|
-
|
|
160
160
|
var _useState9 = (0, _react.useState)(false),
|
|
161
161
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
isError = _useState10[0],
|
|
163
|
+
setError = _useState10[1];
|
|
164
164
|
|
|
165
|
-
var _useState11 = (0, _react.useState)(
|
|
165
|
+
var _useState11 = (0, _react.useState)(false),
|
|
166
166
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
blinkError = _useState12[0],
|
|
168
|
+
setBlinkError = _useState12[1];
|
|
169
|
+
|
|
170
|
+
var _useState13 = (0, _react.useState)(errors.default),
|
|
171
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
172
|
+
errorMessage = _useState14[0],
|
|
173
|
+
setErrorMessage = _useState14[1];
|
|
169
174
|
|
|
170
175
|
var clearErrorMessage = function clearErrorMessage() {
|
|
171
176
|
return setErrorMessage(errors.default);
|
|
@@ -173,10 +178,10 @@ function InputMask2() {
|
|
|
173
178
|
// INNER VALUE MANAGEMENT FUNCTIONS | START //
|
|
174
179
|
|
|
175
180
|
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
innerValue =
|
|
179
|
-
setInnerValue =
|
|
181
|
+
var _useState15 = (0, _react.useState)([]),
|
|
182
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
183
|
+
innerValue = _useState16[0],
|
|
184
|
+
setInnerValue = _useState16[1];
|
|
180
185
|
|
|
181
186
|
var prevValueRef = (0, _react.useRef)([]);
|
|
182
187
|
|
|
@@ -473,6 +478,12 @@ function InputMask2() {
|
|
|
473
478
|
}
|
|
474
479
|
|
|
475
480
|
break;
|
|
481
|
+
|
|
482
|
+
default:
|
|
483
|
+
if (selectedLength > 0) {
|
|
484
|
+
setCaret(caretPos);
|
|
485
|
+
}
|
|
486
|
+
|
|
476
487
|
}
|
|
477
488
|
}
|
|
478
489
|
}
|
|
@@ -531,6 +542,17 @@ function InputMask2() {
|
|
|
531
542
|
var onClick = function onClick(e) {
|
|
532
543
|
var cursor = e.target.selectionStart;
|
|
533
544
|
if (cursor >= maxEditableIndex) setCaret(maxEditableIndex);
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
var onSelect = function onSelect(e) {
|
|
548
|
+
var _e$target2, _ref12;
|
|
549
|
+
|
|
550
|
+
var _ref11 = (_e$target2 = e.target) !== null && _e$target2 !== void 0 ? _e$target2 : {},
|
|
551
|
+
selectionStart = _ref11.selectionStart,
|
|
552
|
+
selectionEnd = _ref11.selectionEnd;
|
|
553
|
+
|
|
554
|
+
setSelectedLength((_ref12 = selectionEnd - selectionStart) !== null && _ref12 !== void 0 ? _ref12 : 0);
|
|
555
|
+
if (selectionStart >= maxEditableIndex) setCaret(maxEditableIndex);
|
|
534
556
|
}; // GENERAL EVENT HANDLERS | END //
|
|
535
557
|
/// --- OBSERVERS ---///
|
|
536
558
|
// Render Mask
|
|
@@ -662,7 +684,16 @@ function InputMask2() {
|
|
|
662
684
|
onFocus: function onFocus() {
|
|
663
685
|
if (isUseAutoSelect) inputRef.current.select();
|
|
664
686
|
if (_onFocus) _onFocus.apply(void 0, arguments);
|
|
665
|
-
}
|
|
687
|
+
},
|
|
688
|
+
onDragStart: function onDragStart(e) {
|
|
689
|
+
e.stopPropagation();
|
|
690
|
+
e.preventDefault();
|
|
691
|
+
},
|
|
692
|
+
onDragEnd: function onDragEnd(e) {
|
|
693
|
+
e.stopPropagation();
|
|
694
|
+
e.preventDefault();
|
|
695
|
+
},
|
|
696
|
+
onSelect: onSelect
|
|
666
697
|
});
|
|
667
698
|
};
|
|
668
699
|
|
|
@@ -44,7 +44,7 @@ function createTranslator(_ref) {
|
|
|
44
44
|
var safelyText = (0, _fieldValueFormatters.getSafelyValue)(text);
|
|
45
45
|
var translatedText = loc[code] && loc[code][safelyText] ? loc[code][safelyText] : safelyText;
|
|
46
46
|
|
|
47
|
-
if ((_Object$keys = Object.keys(safelyValues)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
|
|
47
|
+
if (Object !== null && Object !== void 0 && (_Object$keys = Object.keys(safelyValues)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
|
|
48
48
|
for (var key in values) {
|
|
49
49
|
var _translatedText;
|
|
50
50
|
|