intelicoreact 1.5.8 → 1.5.10
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.
|
@@ -14,7 +14,7 @@ require("./FormattedRawSSN.scss");
|
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
const DEFAULT_SSN_MASK = "DDD-DD-DDDD";
|
|
17
|
-
const SIGNIFICANT_CHARACTERS = [
|
|
17
|
+
const SIGNIFICANT_CHARACTERS = ["D"];
|
|
18
18
|
const FormattedRawSSN = _ref => {
|
|
19
19
|
let {
|
|
20
20
|
value = "",
|
|
@@ -47,7 +47,7 @@ const FormattedRawSSN = _ref => {
|
|
|
47
47
|
const [isHidden, setIsHidden] = (0, _react.useState)(isHiddenDefault);
|
|
48
48
|
const wrapperRef = (0, _react.useRef)(null);
|
|
49
49
|
const onChange = value => {
|
|
50
|
-
const newValue = !value && value !== "" ?
|
|
50
|
+
const newValue = !value && value !== "" ? "" : value === null || value === void 0 ? void 0 : value.toString();
|
|
51
51
|
onChangeProp(newValue);
|
|
52
52
|
};
|
|
53
53
|
|
|
@@ -66,7 +66,7 @@ const FormattedRawSSN = _ref => {
|
|
|
66
66
|
// ? исходя из countOfFirstDigitsToHide
|
|
67
67
|
const maxHiddenIndex = (() => {
|
|
68
68
|
// если не приводится к числу или ноль (передавать ноль лишено смысла)
|
|
69
|
-
if (isNaN(
|
|
69
|
+
if (isNaN(Number(countOfFirstDigitsToHide)) || !Number(countOfFirstDigitsToHide)) return -1;
|
|
70
70
|
// если больше чем значимых символов
|
|
71
71
|
if (countOfFirstDigitsToHide > infoAboutMask.countOfSignificantChars) return infoAboutMask.mask.length;
|
|
72
72
|
|
|
@@ -93,7 +93,8 @@ function InputMask3() {
|
|
|
93
93
|
const [isInitValue, setIsInitValue] = (0, _react.useState)(false);
|
|
94
94
|
const [selectedLength, setSelectedLength] = (0, _react.useState)(0);
|
|
95
95
|
//? Если управляется сверху, то инициируемся текущим внешним значением
|
|
96
|
-
const [isValueHidden, setIsValueHidden] = (0, _react.useState)(typeof isHide ===
|
|
96
|
+
const [isValueHidden, setIsValueHidden] = (0, _react.useState)(typeof isHide === "boolean" ? isHide : isValueHiddenDefault);
|
|
97
|
+
const [isHiddenLogicInit, setIsHiddenLogicInit] = (0, _react.useState)(false);
|
|
97
98
|
const inputRef = (0, _react.useRef)(null);
|
|
98
99
|
const keyDownRef = (0, _react.useRef)(null);
|
|
99
100
|
const setKeyDown = keyCode => keyDownRef.current = keyCode;
|
|
@@ -482,9 +483,9 @@ function InputMask3() {
|
|
|
482
483
|
const onHiddenToggle = value => {
|
|
483
484
|
var _inputRef$current2;
|
|
484
485
|
// ? Добавлена возможность принудительной установки велью (опционально)
|
|
485
|
-
const newValue = typeof value ===
|
|
486
|
+
const newValue = typeof value === "boolean" ? value : !isValueHidden;
|
|
486
487
|
setIsValueHidden(newValue);
|
|
487
|
-
inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
|
488
|
+
if (isHiddenLogicInit) inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
|
488
489
|
};
|
|
489
490
|
const onFocus = () => {
|
|
490
491
|
setFocused(true);
|
|
@@ -567,8 +568,9 @@ function InputMask3() {
|
|
|
567
568
|
setErrorMessage(customError === "" ? errors.default : customError);
|
|
568
569
|
}, [customError, isError]);
|
|
569
570
|
(0, _react.useEffect)(() => {
|
|
570
|
-
if (typeof isHide ===
|
|
571
|
+
if (typeof isHide === "boolean") {
|
|
571
572
|
onHiddenToggle(isHide);
|
|
573
|
+
if (!isHiddenLogicInit) setIsHiddenLogicInit(true);
|
|
572
574
|
}
|
|
573
575
|
}, [isHide]);
|
|
574
576
|
|
|
@@ -698,7 +700,7 @@ function InputMask3() {
|
|
|
698
700
|
tabIndex: -1
|
|
699
701
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
700
702
|
className: "\n input-mask\n ".concat(isError ? "input-mask_error" : "", "\n ").concat(isFocused ? "input-mask_focus" : "", "\n ").concat(blinkError ? "input-mask_blink-error" : "", "\n ")
|
|
701
|
-
}, showHint && isHintLeft && renderHint(), isIconLeft && showIcon && renderIcon("left"), renderMask(), renderInput(), withHiddenMode && typeof isHide !==
|
|
703
|
+
}, showHint && isHintLeft && renderHint(), isIconLeft && showIcon && renderIcon("left"), renderMask(), renderInput(), withHiddenMode && typeof isHide !== "boolean" && renderHideToggler(), isClearable && renderClearButton(), isIconRight && showIcon && renderIcon("right"), showHint && isHintRight && renderHint()), showErrors && errorMessage && /*#__PURE__*/_react.default.createElement("div", {
|
|
702
704
|
className: "input-mask_error-text"
|
|
703
705
|
}, errorMessage), isLoading && /*#__PURE__*/_react.default.createElement(_Spinner.default, {
|
|
704
706
|
size: "small"
|
|
@@ -49,7 +49,10 @@ const getDependOnStarter = props => {
|
|
|
49
49
|
...(!isNotResetErrors ? {
|
|
50
50
|
error: ""
|
|
51
51
|
} : {})
|
|
52
|
-
}, dependField, form,
|
|
52
|
+
}, dependField, form, {
|
|
53
|
+
...additional,
|
|
54
|
+
propKey
|
|
55
|
+
}));
|
|
53
56
|
}).then(changes => {
|
|
54
57
|
if ((0, _utils.getIsOnlyAnObject)(changes)) assign(changes, dependField.key);
|
|
55
58
|
return changes;
|