intelicoreact 1.0.95 → 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.
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +16 -4
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.scss +3 -2
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +46 -15
- package/dist/Functions/locale/createTranslator.js +1 -1
- package/package.json +1 -1
|
@@ -32,6 +32,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
32
32
|
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; }
|
|
33
33
|
|
|
34
34
|
var RC = 'dropdown-live-search';
|
|
35
|
+
var notReact = {
|
|
36
|
+
searchValue: ''
|
|
37
|
+
};
|
|
35
38
|
|
|
36
39
|
var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
37
40
|
var value = _ref.value,
|
|
@@ -75,7 +78,12 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
75
78
|
var _useState5 = (0, _react.useState)(labelByValue),
|
|
76
79
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
77
80
|
searchValue = _useState6[0],
|
|
78
|
-
|
|
81
|
+
setSV = _useState6[1];
|
|
82
|
+
|
|
83
|
+
var setSearchValue = function setSearchValue(val) {
|
|
84
|
+
setSV(val);
|
|
85
|
+
notReact.searchValue = val;
|
|
86
|
+
};
|
|
79
87
|
|
|
80
88
|
var dropdownLiveSearchRef = (0, _react.useRef)(null);
|
|
81
89
|
var dropdownListBoxRef = (0, _react.useRef)(null);
|
|
@@ -196,7 +204,11 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
196
204
|
var inputValue = e.target.value;
|
|
197
205
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
198
206
|
setSearchValue(inputValue);
|
|
199
|
-
|
|
207
|
+
|
|
208
|
+
if (searchValue && !e.target.value) {
|
|
209
|
+
onChange('');
|
|
210
|
+
setIsValueDeleted(true);
|
|
211
|
+
} else setIsValueDeleted(false);
|
|
200
212
|
}
|
|
201
213
|
};
|
|
202
214
|
(0, _react.useEffect)(function () {
|
|
@@ -228,7 +240,7 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
228
240
|
var doScrollCallback = (0, _react.useCallback)(function (e) {
|
|
229
241
|
if (doRequest && typeof doRequest === 'function') {
|
|
230
242
|
if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
|
|
231
|
-
doRequest(searchValue);
|
|
243
|
+
doRequest(notReact.searchValue, true);
|
|
232
244
|
}
|
|
233
245
|
}
|
|
234
246
|
}, [options]);
|
|
@@ -261,7 +273,7 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
261
273
|
}, isSearchable ? /*#__PURE__*/_react.default.createElement("input", {
|
|
262
274
|
ref: searchInputRef,
|
|
263
275
|
className: "".concat(RC, "__input"),
|
|
264
|
-
value: searchValue,
|
|
276
|
+
value: searchValue || labelByValue,
|
|
265
277
|
onChange: handle.onInputChange,
|
|
266
278
|
placeholder: placeholder,
|
|
267
279
|
onFocus: searchableInputFocus,
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
box-sizing: border-box;
|
|
59
59
|
min-width: 100%;
|
|
60
60
|
max-height: 320px;
|
|
61
|
-
margin-top: 4px;
|
|
62
61
|
padding: 5px 0;
|
|
63
62
|
border: 1px solid #E2E5EC;
|
|
64
63
|
background: #FFF;
|
|
@@ -121,6 +120,7 @@
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
&--no-options {
|
|
123
|
+
padding-left: 8px;
|
|
124
124
|
box-sizing: border-box;
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -190,7 +190,8 @@
|
|
|
190
190
|
z-index: 99999;
|
|
191
191
|
display: block;
|
|
192
192
|
box-sizing: border-box;
|
|
193
|
-
top:
|
|
193
|
+
top: 30px;
|
|
194
|
+
background-color: #ffffff;
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
&.disabled {
|
|
@@ -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
|
|