intelicoreact 1.0.78 → 1.0.80
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/Dropdown/Dropdown.js +19 -13
- package/dist/Atomic/FormElements/FileLoader/FileLoader.scss +0 -1
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +8 -7
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +36 -11
- package/dist/Functions/utils.js +19 -2
- package/package.json +1 -1
|
@@ -86,6 +86,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
86
86
|
|
|
87
87
|
var dropdownRef = (0, _react.useRef)(null);
|
|
88
88
|
var dropdownListRef = (0, _react.useRef)(null);
|
|
89
|
+
var searchInputRef = (0, _react.useRef)(null);
|
|
89
90
|
|
|
90
91
|
var _useState7 = (0, _react.useState)(null),
|
|
91
92
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
@@ -149,7 +150,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
149
150
|
|
|
150
151
|
var onChangeHandler = function onChangeHandler(item) {
|
|
151
152
|
setIsOpen(false);
|
|
152
|
-
setSearchValue(null);
|
|
153
153
|
onChange(item.value);
|
|
154
154
|
}; // decorator
|
|
155
155
|
|
|
@@ -375,7 +375,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
375
375
|
setListContainerStyles();
|
|
376
376
|
}, [isOpen, searchValue]);
|
|
377
377
|
(0, _react.useEffect)(function () {
|
|
378
|
-
if (!value) setSearchValue(null);
|
|
379
378
|
document.addEventListener('click', handleClickOutside, true);
|
|
380
379
|
return function () {
|
|
381
380
|
return document.removeEventListener('click', handleClickOutside, true);
|
|
@@ -404,7 +403,12 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
404
403
|
};
|
|
405
404
|
|
|
406
405
|
(0, _react.useEffect)(function () {
|
|
407
|
-
if (isOpen && isSearching)
|
|
406
|
+
if (isOpen && isSearching) {
|
|
407
|
+
setSearchValue(selectedLabel);
|
|
408
|
+
setTimeout(function () {
|
|
409
|
+
return searchInputRef.current.select();
|
|
410
|
+
}, 1);
|
|
411
|
+
}
|
|
408
412
|
}, [isSearching]);
|
|
409
413
|
var postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(function (option) {
|
|
410
414
|
return option.value === value;
|
|
@@ -431,26 +435,28 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
431
435
|
return !isFocusedByClick ? setIsOpen(true) : null;
|
|
432
436
|
}
|
|
433
437
|
}, isSearchable ? /*#__PURE__*/_react.default.createElement("input", {
|
|
438
|
+
ref: searchInputRef,
|
|
434
439
|
className: "".concat(RC, "__input"),
|
|
435
440
|
value: isSearching ? searchValue !== null && searchValue !== void 0 ? searchValue : '' : selectedLabel || '',
|
|
436
441
|
onChange: function onChange(e) {
|
|
437
|
-
|
|
438
|
-
searchValue: searchValue,
|
|
439
|
-
selectedLabel: selectedLabel
|
|
440
|
-
});
|
|
441
|
-
setIsSearching(true);
|
|
442
|
-
onSearchHandler(e.target.value);
|
|
442
|
+
return onSearchHandler(e.target.value);
|
|
443
443
|
},
|
|
444
444
|
placeholder: placeholder,
|
|
445
445
|
onFocus: function onFocus(e) {
|
|
446
|
-
|
|
446
|
+
if (!isOpen) {
|
|
447
|
+
e.preventDefault();
|
|
448
|
+
e.stopPropagation();
|
|
449
|
+
e.target.blur();
|
|
450
|
+
return;
|
|
451
|
+
} else {
|
|
452
|
+
setIsSearching(true);
|
|
453
|
+
}
|
|
447
454
|
},
|
|
448
455
|
onBlur: function onBlur() {
|
|
449
|
-
|
|
450
|
-
setIsSearching(false);
|
|
456
|
+
return setIsSearching(false);
|
|
451
457
|
},
|
|
452
458
|
onClick: function onClick() {
|
|
453
|
-
|
|
459
|
+
if (!isOpen) setIsOpen(true);
|
|
454
460
|
}
|
|
455
461
|
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
456
462
|
className: "text"
|
|
@@ -21,17 +21,14 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
21
21
|
error = _ref.error,
|
|
22
22
|
isRequired = _ref.isRequired,
|
|
23
23
|
accept = _ref.accept,
|
|
24
|
-
|
|
24
|
+
_onChange = _ref.onChange,
|
|
25
25
|
className = _ref.className,
|
|
26
26
|
value = _ref.value,
|
|
27
27
|
isNoTrashIcon = _ref.isNoTrashIcon;
|
|
28
28
|
|
|
29
29
|
var getFileName = function getFileName(value) {
|
|
30
30
|
var result = value.match(/[^\\]+$/);
|
|
31
|
-
return
|
|
32
|
-
value: result[0],
|
|
33
|
-
id: id
|
|
34
|
-
});
|
|
31
|
+
return result[0];
|
|
35
32
|
};
|
|
36
33
|
|
|
37
34
|
var renderRequiredLabel = function renderRequiredLabel() {
|
|
@@ -48,7 +45,11 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
48
45
|
className: (0, _classnames.default)('file-loader-local', className)
|
|
49
46
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
50
47
|
onChange: function onChange(e) {
|
|
51
|
-
return
|
|
48
|
+
return _onChange({
|
|
49
|
+
name: getFileName(e.target.value),
|
|
50
|
+
e: e,
|
|
51
|
+
id: id
|
|
52
|
+
});
|
|
52
53
|
},
|
|
53
54
|
className: "file-loader-local__file-input",
|
|
54
55
|
id: "file-input-".concat(id),
|
|
@@ -76,7 +77,7 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
76
77
|
}, error))), value && !isNoTrashIcon && /*#__PURE__*/_react.default.createElement(_reactFeather.Trash2, {
|
|
77
78
|
className: "file-loader-local__trash-icon",
|
|
78
79
|
onClick: function onClick() {
|
|
79
|
-
return
|
|
80
|
+
return _onChange({
|
|
80
81
|
id: id
|
|
81
82
|
});
|
|
82
83
|
}
|
|
@@ -422,10 +422,11 @@ function InputMask2() {
|
|
|
422
422
|
};
|
|
423
423
|
|
|
424
424
|
var onKeyDown = function onKeyDown(e) {
|
|
425
|
-
var _getCharByIndex2
|
|
425
|
+
var _getCharByIndex2;
|
|
426
426
|
|
|
427
427
|
onKeyDownProp === null || onKeyDownProp === void 0 ? void 0 : onKeyDownProp(e);
|
|
428
|
-
var keyCode = e.keyCode
|
|
428
|
+
var keyCode = e.keyCode,
|
|
429
|
+
key = e.key;
|
|
429
430
|
var cursor = e.target.selectionStart;
|
|
430
431
|
|
|
431
432
|
if (keyCode === 36) {
|
|
@@ -449,26 +450,50 @@ function InputMask2() {
|
|
|
449
450
|
return;
|
|
450
451
|
}
|
|
451
452
|
|
|
452
|
-
if (keyCode === 8
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
if (keyCode === 8) {
|
|
454
|
+
var _getCharByIndex4;
|
|
455
|
+
|
|
456
|
+
if ((_getCharByIndex4 = getCharByIndex(cursor - 1)) !== null && _getCharByIndex4 !== void 0 && _getCharByIndex4.isSpecialSymbol) {
|
|
457
|
+
e.preventDefault();
|
|
458
|
+
e.stopPropagation();
|
|
455
459
|
|
|
456
|
-
|
|
457
|
-
|
|
460
|
+
while ((_getCharByIndex5 = getCharByIndex(cursor - 1)) !== null && _getCharByIndex5 !== void 0 && _getCharByIndex5.isSpecialSymbol && cursor > 0) {
|
|
461
|
+
var _getCharByIndex5;
|
|
458
462
|
|
|
459
|
-
|
|
463
|
+
--cursor;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
setCursor(cursor);
|
|
467
|
+
return;
|
|
468
|
+
} else {
|
|
469
|
+
if (cursor >= 1) setCursor(cursor - 1);
|
|
470
|
+
return;
|
|
460
471
|
}
|
|
472
|
+
}
|
|
461
473
|
|
|
474
|
+
if (keyCode === 46) {
|
|
462
475
|
setCursor(cursor);
|
|
463
476
|
return;
|
|
464
477
|
}
|
|
465
478
|
|
|
466
|
-
if (
|
|
467
|
-
setCursor(
|
|
479
|
+
if (cursor > maxEditableIndex) {
|
|
480
|
+
setCursor(maxEditableIndex);
|
|
468
481
|
return;
|
|
469
482
|
}
|
|
470
483
|
|
|
471
|
-
if (
|
|
484
|
+
if (isValidChar({
|
|
485
|
+
char: key,
|
|
486
|
+
i: cursor,
|
|
487
|
+
disableErrors: true
|
|
488
|
+
})) {
|
|
489
|
+
while ((_getCharByIndex6 = getCharByIndex(cursor + 1)) !== null && _getCharByIndex6 !== void 0 && _getCharByIndex6.isSpecialSymbol && cursor < maxEditableIndex) {
|
|
490
|
+
var _getCharByIndex6;
|
|
491
|
+
|
|
492
|
+
++cursor;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
setCursor(cursor + 1);
|
|
496
|
+
}
|
|
472
497
|
};
|
|
473
498
|
|
|
474
499
|
var onKeyUp = function onKeyUp(e) {
|
package/dist/Functions/utils.js
CHANGED
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
exports.transformUTCTimeToLocal = transformUTCTimeToLocal;
|
|
11
11
|
exports.transformUTCHoursToLocal = transformUTCHoursToLocal;
|
|
12
12
|
exports.downloadEmulation = downloadEmulation;
|
|
13
|
-
exports.compareAlphabetical = exports.setCarretToEnd = exports.compare = exports.downloadFile = exports.checkedRef = exports.capitalized = exports.firstLetterCapital = exports.changeMeta = exports.addBitDepthPoints = exports.throttle = exports.debounce = exports.getColorById = exports.getStyles = exports.logout = exports.omitKeys = exports.clone = exports.useOutsideToggle = exports.handleObjectChange = void 0;
|
|
13
|
+
exports.getBase64 = exports.compareAlphabetical = exports.setCarretToEnd = exports.compare = exports.downloadFile = exports.checkedRef = exports.capitalized = exports.firstLetterCapital = exports.changeMeta = exports.addBitDepthPoints = exports.throttle = exports.debounce = exports.getColorById = exports.getStyles = exports.logout = exports.omitKeys = exports.clone = exports.useOutsideToggle = exports.handleObjectChange = void 0;
|
|
14
14
|
|
|
15
15
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
16
16
|
|
|
@@ -389,4 +389,21 @@ var compareAlphabetical = function compareAlphabetical(a, b) {
|
|
|
389
389
|
return 0;
|
|
390
390
|
};
|
|
391
391
|
|
|
392
|
-
exports.compareAlphabetical = compareAlphabetical;
|
|
392
|
+
exports.compareAlphabetical = compareAlphabetical;
|
|
393
|
+
|
|
394
|
+
var getBase64 = function getBase64(file) {
|
|
395
|
+
return new Promise(function (resolve, reject) {
|
|
396
|
+
var reader = new FileReader();
|
|
397
|
+
reader.readAsDataURL(file);
|
|
398
|
+
|
|
399
|
+
reader.onload = function () {
|
|
400
|
+
return resolve(reader.result);
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
reader.onerror = function (error) {
|
|
404
|
+
return reject('Error: ', error);
|
|
405
|
+
};
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
exports.getBase64 = getBase64;
|