intelicoreact 1.3.83 → 1.3.85
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/ActionAlert/ActionAlert.js +9 -1
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +10 -1
- package/dist/Atomic/FormElements/Calendar/Calendar.js +24 -4
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +10 -1
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +14 -2
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +54 -5
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +21 -3
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +144 -51
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +7 -1
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +52 -11
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +15 -3
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +29 -15
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +15 -5
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +26 -6
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +35 -19
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +38 -9
- package/dist/Atomic/FormElements/Input/Input.js +57 -24
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +31 -4
- package/dist/Atomic/FormElements/InputColor/InputColor.js +14 -4
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +29 -6
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +43 -8
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +21 -3
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -58
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +41 -6
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +8 -1
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +46 -16
- package/dist/Atomic/FormElements/InputLink/InputLink.js +23 -6
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +4 -0
- package/dist/Atomic/FormElements/InputMask/InputMask.js +208 -77
- package/dist/Atomic/FormElements/InputMask/functions.js +28 -2
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +119 -43
- package/dist/Atomic/FormElements/InputMask2/functions.js +28 -2
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +137 -44
- package/dist/Atomic/FormElements/InputMask3/functions.js +28 -2
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +17 -3
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +24 -5
- package/dist/Atomic/FormElements/Label/Label.js +9 -1
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +73 -35
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +15 -3
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +44 -23
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +17 -7
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +14 -3
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +10 -1
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +14 -3
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +23 -3
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +34 -17
- package/dist/Atomic/FormElements/RangeList/RangeList.js +25 -6
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +11 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +72 -14
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +180 -53
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +10 -1
- package/dist/Atomic/FormElements/Switcher/Switcher.js +10 -1
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +13 -1
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +10 -1
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +17 -2
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +17 -3
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +11 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +29 -6
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +12 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +151 -55
- package/dist/Atomic/FormElements/Text/Text.js +16 -10
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +9 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.js +16 -3
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +35 -6
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +13 -4
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +21 -7
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +35 -8
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +18 -5
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +10 -3
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +11 -3
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +12 -5
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +15 -3
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +20 -3
- package/dist/Atomic/Layout/Spinner/Spinner.js +8 -1
- package/dist/Atomic/UI/Accordion/Accordion.js +19 -3
- package/dist/Atomic/UI/Accordion/AccordionItem.js +23 -9
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +32 -7
- package/dist/Atomic/UI/AccordionText/AccordionText.js +15 -3
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +21 -4
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +15 -3
- package/dist/Atomic/UI/Alert/Alert.js +19 -3
- package/dist/Atomic/UI/Arrow/Arrow.js +16 -3
- package/dist/Atomic/UI/Box/Box.js +9 -3
- package/dist/Atomic/UI/Button/Button.js +11 -2
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +10 -1
- package/dist/Atomic/UI/Chart/Chart.js +29 -4
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +19 -11
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +12 -1
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +34 -11
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +56 -82
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +19 -15
- package/dist/Atomic/UI/Chart/partial/utils.js +20 -6
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +13 -3
- package/dist/Atomic/UI/DateTime/DateTime.js +14 -3
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +16 -4
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +11 -3
- package/dist/Atomic/UI/DoubleString/DoubleString.js +17 -5
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +10 -3
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +52 -17
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +29 -1
- package/dist/Atomic/UI/Hint/Hint.js +31 -5
- package/dist/Atomic/UI/Hint/Hint.scss +1 -3
- package/dist/Atomic/UI/Modal/Modal.js +28 -6
- package/dist/Atomic/UI/Modal/ModalHOC.js +9 -1
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -1
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +8 -1
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +49 -32
- package/dist/Atomic/UI/ModalBackup/Modal.js +174 -0
- package/dist/Atomic/UI/ModalBackup/Modal.scss +333 -0
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +51 -0
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +24 -0
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +41 -0
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +21 -6
- package/dist/Atomic/UI/NavLine/NavLine.js +55 -26
- package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
- package/dist/Atomic/UI/PageTitle/PageTitle.js +10 -2
- package/dist/Atomic/UI/PieChart/PieChart.js +10 -1
- package/dist/Atomic/UI/Price/Price.js +8 -3
- package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -1
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +16 -1
- package/dist/Atomic/UI/Status/Status.js +8 -1
- package/dist/Atomic/UI/Table/Partials/TdCell.js +29 -5
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +11 -1
- package/dist/Atomic/UI/Table/Partials/TdRow.js +17 -5
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +14 -3
- package/dist/Atomic/UI/Table/Table.js +12 -1
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -2
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -1
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +4 -1
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +13 -1
- package/dist/Atomic/UI/Tag/Tag.js +14 -3
- package/dist/Atomic/UI/TagList/TagList.js +35 -19
- package/dist/Atomic/UI/UserBox/UserBox.js +13 -1
- package/dist/Classes/AbortableFetch.js +93 -36
- package/dist/Classes/AnimatedHandler.js +7 -3
- package/dist/Classes/RESTAPI/index.js +44 -39
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +93 -35
- package/dist/Classes/RESTAPI/partials/ApiBase.js +9 -1
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +32 -24
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +38 -29
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +44 -21
- package/dist/Classes/RESTAPI/partials/Utils.js +19 -6
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
- package/dist/Classes/RESTAPI/partials/_utils.js +36 -13
- package/dist/Constants/index.constants.js +15 -8
- package/dist/Functions/Portal.js +16 -5
- package/dist/Functions/customEventListener.js +17 -4
- package/dist/Functions/fieldValueFormatters.js +83 -43
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +26 -23
- package/dist/Functions/locale/createTranslator.js +9 -4
- package/dist/Functions/operations.js +22 -12
- package/dist/Functions/presets/inputMaskPresets.js +11 -9
- package/dist/Functions/presets/inputPresets.js +11 -8
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
- package/dist/Functions/schemas.js +13 -6
- package/dist/Functions/useBodyScrollLock.js +6 -1
- package/dist/Functions/useClickOutside.js +4 -0
- package/dist/Functions/useDebounce.js +7 -2
- package/dist/Functions/useFieldFocus.js +18 -6
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +9 -0
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +23 -12
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +15 -6
- package/dist/Functions/useFormTools/functions/General.js +28 -18
- package/dist/Functions/useFormTools/functions/RenderFields.js +11 -2
- package/dist/Functions/useFormTools/functions/usePrevious.js +5 -1
- package/dist/Functions/useFormTools/index.js +144 -85
- package/dist/Functions/useInputHighlightError.js +12 -3
- package/dist/Functions/useIsMobile.js +13 -7
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +7 -1
- package/dist/Functions/useKeyPress/useKeyPress.js +9 -1
- package/dist/Functions/useLocalStorage.js +9 -1
- package/dist/Functions/useLocationParams.js +5 -4
- package/dist/Functions/useMediaQuery.js +9 -3
- package/dist/Functions/useMetaInfo.js +10 -3
- package/dist/Functions/useMouseUpOutside.js +3 -0
- package/dist/Functions/useOnlineStatus.js +9 -1
- package/dist/Functions/usePasswordChecker.js +20 -4
- package/dist/Functions/usePrevious.js +5 -1
- package/dist/Functions/useResize.js +10 -2
- package/dist/Functions/useScrollTo.js +7 -2
- package/dist/Functions/useToggle.js +5 -1
- package/dist/Functions/utils.js +131 -56
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +9 -2
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +9 -2
- package/dist/Molecular/CustomIcons/components/AppStore.js +9 -2
- package/dist/Molecular/CustomIcons/components/Arrow.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +9 -2
- package/dist/Molecular/CustomIcons/components/Bell.js +9 -2
- package/dist/Molecular/CustomIcons/components/Button.js +9 -2
- package/dist/Molecular/CustomIcons/components/Campaigns.js +9 -2
- package/dist/Molecular/CustomIcons/components/Check.js +9 -2
- package/dist/Molecular/CustomIcons/components/Check2.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/Close.js +9 -2
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +9 -2
- package/dist/Molecular/CustomIcons/components/Delete.js +9 -2
- package/dist/Molecular/CustomIcons/components/Edit.js +9 -2
- package/dist/Molecular/CustomIcons/components/Email.js +9 -2
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +9 -2
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +9 -2
- package/dist/Molecular/CustomIcons/components/Flows.js +9 -2
- package/dist/Molecular/CustomIcons/components/Gift.js +9 -2
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +9 -2
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +9 -2
- package/dist/Molecular/CustomIcons/components/Home.js +9 -2
- package/dist/Molecular/CustomIcons/components/Home2.js +9 -2
- package/dist/Molecular/CustomIcons/components/Key.js +9 -2
- package/dist/Molecular/CustomIcons/components/Landers.js +9 -2
- package/dist/Molecular/CustomIcons/components/Lock.js +9 -2
- package/dist/Molecular/CustomIcons/components/Mail.js +9 -2
- package/dist/Molecular/CustomIcons/components/Mastercard.js +9 -2
- package/dist/Molecular/CustomIcons/components/Minus.js +9 -2
- package/dist/Molecular/CustomIcons/components/Offers.js +9 -2
- package/dist/Molecular/CustomIcons/components/Pause.js +9 -2
- package/dist/Molecular/CustomIcons/components/PayPal.js +9 -2
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +9 -2
- package/dist/Molecular/CustomIcons/components/Phone.js +9 -2
- package/dist/Molecular/CustomIcons/components/Play.js +9 -2
- package/dist/Molecular/CustomIcons/components/Plus.js +9 -2
- package/dist/Molecular/CustomIcons/components/Profile.js +9 -2
- package/dist/Molecular/CustomIcons/components/QRCode.js +9 -2
- package/dist/Molecular/CustomIcons/components/Rectangle.js +9 -2
- package/dist/Molecular/CustomIcons/components/Revert.js +9 -2
- package/dist/Molecular/CustomIcons/components/Star.js +9 -2
- package/dist/Molecular/CustomIcons/components/Star2.js +9 -2
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +9 -2
- package/dist/Molecular/CustomIcons/components/Trash.js +9 -2
- package/dist/Molecular/CustomIcons/components/TrashRed.js +9 -2
- package/dist/Molecular/CustomIcons/components/Triggers.js +9 -2
- package/dist/Molecular/CustomIcons/components/User.js +9 -2
- package/dist/Molecular/CustomIcons/components/Visa.js +9 -2
- package/dist/Molecular/CustomIcons/components/X.js +9 -2
- package/dist/Molecular/CustomIcons/index.js +122 -0
- package/dist/Molecular/FormElement/FormElement.js +12 -1
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +31 -30
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +12 -9
- package/dist/Molecular/InputAddress/InputAddress.js +114 -65
- package/dist/Molecular/InputPassword/InputPassword.js +19 -5
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -4,30 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createTranslator;
|
|
7
|
+
|
|
7
8
|
var _fieldValueFormatters = require("./../fieldValueFormatters");
|
|
9
|
+
|
|
8
10
|
const DEFAULT_CODE = "en";
|
|
11
|
+
|
|
9
12
|
function createTranslator(_ref) {
|
|
10
|
-
let {
|
|
11
|
-
...langCatalogs
|
|
13
|
+
let { ...langCatalogs
|
|
12
14
|
} = _ref;
|
|
13
|
-
const loc = {
|
|
14
|
-
...langCatalogs
|
|
15
|
+
const loc = { ...langCatalogs
|
|
15
16
|
};
|
|
16
17
|
let code = window.localStorage.getItem("lng");
|
|
17
18
|
if (!code) code = window.navigator ? window.navigator.language.split("-")[0] : DEFAULT_CODE;
|
|
18
19
|
if (!loc[code]) code = DEFAULT_CODE;
|
|
19
20
|
return function (text, values) {
|
|
20
21
|
var _Object$keys;
|
|
22
|
+
|
|
21
23
|
const safelyValues = values !== null && values !== void 0 ? values : {};
|
|
22
24
|
const safelyText = (0, _fieldValueFormatters.getSafelyValue)(text);
|
|
23
25
|
let translatedText = loc[code] && loc[code][safelyText] ? loc[code][safelyText] : safelyText;
|
|
26
|
+
|
|
24
27
|
if (Object !== null && Object !== void 0 && (_Object$keys = Object.keys(safelyValues)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
|
|
25
28
|
for (const key in values) {
|
|
26
29
|
var _translatedText;
|
|
30
|
+
|
|
27
31
|
const regex = new RegExp("%".concat(key, "%"), "g");
|
|
28
32
|
translatedText = (_translatedText = translatedText) === null || _translatedText === void 0 ? void 0 : _translatedText.replace(regex, values[key]);
|
|
29
33
|
}
|
|
30
34
|
}
|
|
35
|
+
|
|
31
36
|
return translatedText;
|
|
32
37
|
};
|
|
33
38
|
}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.addRangeDefault = void 0;
|
|
7
|
+
|
|
7
8
|
// Взято из https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Math/round
|
|
8
9
|
// При импорте любой ф-и из этого файла отработает самовызывающаяся ф-я и расширит
|
|
9
10
|
// объект Math 3-мя ф-ми: round10, floor10, ceil10
|
|
@@ -21,39 +22,44 @@ exports.addRangeDefault = void 0;
|
|
|
21
22
|
if (typeof exp === "undefined" || Number(exp) === 0) {
|
|
22
23
|
return Math[type](value);
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
value = Number(value);
|
|
25
|
-
exp = Number(exp);
|
|
26
|
-
|
|
27
|
+
exp = Number(exp); // Если значение не является числом, либо степень не является целым числом...
|
|
28
|
+
|
|
27
29
|
if (isNaN(value) || !(typeof exp === "number" && exp % 1 === 0)) {
|
|
28
30
|
return NaN;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
+
} // Сдвиг разрядов
|
|
32
|
+
|
|
33
|
+
|
|
31
34
|
value = value.toString().split("e");
|
|
32
|
-
value = Math[type](Number(value[0] + "e" + (value[1] ? Number(value[1]) - exp : -exp)));
|
|
33
|
-
|
|
35
|
+
value = Math[type](Number(value[0] + "e" + (value[1] ? Number(value[1]) - exp : -exp))); // Обратный сдвиг
|
|
36
|
+
|
|
34
37
|
value = value.toString().split("e");
|
|
35
38
|
return Number(value[0] + "e" + (value[1] ? Number(value[1]) + exp : exp));
|
|
36
|
-
}
|
|
39
|
+
} // Десятичное округление к ближайшему
|
|
40
|
+
|
|
37
41
|
|
|
38
|
-
// Десятичное округление к ближайшему
|
|
39
42
|
if (!Math.round10) {
|
|
40
43
|
Math.round10 = function (value, exp) {
|
|
41
44
|
return decimalAdjust("round", value, exp);
|
|
42
45
|
};
|
|
43
|
-
}
|
|
44
|
-
|
|
46
|
+
} // Десятичное округление вниз
|
|
47
|
+
|
|
48
|
+
|
|
45
49
|
if (!Math.floor10) {
|
|
46
50
|
Math.floor10 = function (value, exp) {
|
|
47
51
|
return decimalAdjust("floor", value, exp);
|
|
48
52
|
};
|
|
49
|
-
}
|
|
50
|
-
|
|
53
|
+
} // Десятичное округление вверх
|
|
54
|
+
|
|
55
|
+
|
|
51
56
|
if (!Math.ceil10) {
|
|
52
57
|
Math.ceil10 = function (value, exp) {
|
|
53
58
|
return decimalAdjust("ceil", value, exp);
|
|
54
59
|
};
|
|
55
60
|
}
|
|
56
61
|
})();
|
|
62
|
+
|
|
57
63
|
const addRangeDefault = (from, to, currentValues, decimalPlaces) => {
|
|
58
64
|
if (!(currentValues !== null && currentValues !== void 0 && currentValues.length)) return [{
|
|
59
65
|
from,
|
|
@@ -64,8 +70,10 @@ const addRangeDefault = (from, to, currentValues, decimalPlaces) => {
|
|
|
64
70
|
const isIncludesFrom = Boolean(acc.from) && range.from < acc.from && range.to >= acc.from;
|
|
65
71
|
const isIncludesTo = Boolean(acc.to) && range.from <= acc.to && range.to > acc.to;
|
|
66
72
|
const isRangeMustBeIncludet = Boolean(acc.from) && Boolean(acc.to) && acc.from <= range.from && acc.to >= range.to;
|
|
73
|
+
|
|
67
74
|
const processTo = () => {
|
|
68
75
|
const lastAccRange = acc.result[acc.result.length - 1];
|
|
76
|
+
|
|
69
77
|
if (acc.to < range.from) {
|
|
70
78
|
lastAccRange.to = acc.to;
|
|
71
79
|
acc.to = null;
|
|
@@ -82,6 +90,7 @@ const addRangeDefault = (from, to, currentValues, decimalPlaces) => {
|
|
|
82
90
|
acc.to = null;
|
|
83
91
|
}
|
|
84
92
|
};
|
|
93
|
+
|
|
85
94
|
if (!acc.from && !acc.to) acc.result = [...acc.result, range];else if (!acc.from && acc.to) processTo();else if (acc.from && acc.to) {
|
|
86
95
|
if (acc.from <= range.from) {
|
|
87
96
|
acc.result = [...acc.result, {
|
|
@@ -115,4 +124,5 @@ const addRangeDefault = (from, to, currentValues, decimalPlaces) => {
|
|
|
115
124
|
if (!result[result.length - 1].to) result[result.length - 1].to = to;
|
|
116
125
|
return result;
|
|
117
126
|
};
|
|
127
|
+
|
|
118
128
|
exports.addRangeDefault = addRangeDefault;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MASK_PRESETS = void 0;
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* @param type: 'inputMask',
|
|
9
10
|
* @param maskPattern: 'DD.DD.DDDD',
|
|
@@ -26,7 +27,6 @@ const DATE_PRESET = {
|
|
|
26
27
|
autocomplete: "bday",
|
|
27
28
|
focusSelector: "input"
|
|
28
29
|
};
|
|
29
|
-
|
|
30
30
|
/**
|
|
31
31
|
* @param type: 'inputMask',
|
|
32
32
|
* @param maskPattern: 'DDDDD',
|
|
@@ -38,6 +38,7 @@ const DATE_PRESET = {
|
|
|
38
38
|
* @param autocomplete: 'postal-code',
|
|
39
39
|
* @param rules: 'fieldZip'
|
|
40
40
|
*/
|
|
41
|
+
|
|
41
42
|
const ZIP_PRESET = {
|
|
42
43
|
type: "inputMask",
|
|
43
44
|
focusSelector: "input",
|
|
@@ -49,7 +50,6 @@ const ZIP_PRESET = {
|
|
|
49
50
|
autocomplete: "postal-code",
|
|
50
51
|
rules: "fieldZip"
|
|
51
52
|
};
|
|
52
|
-
|
|
53
53
|
/**
|
|
54
54
|
* @param type: 'inputMask',
|
|
55
55
|
* @param maskPattern: 'DDDDDDDDD',
|
|
@@ -59,6 +59,7 @@ const ZIP_PRESET = {
|
|
|
59
59
|
* @param showErrors: false,
|
|
60
60
|
* @param focusSelector: 'input',
|
|
61
61
|
*/
|
|
62
|
+
|
|
62
63
|
const SSN_PRESET = {
|
|
63
64
|
type: "inputMask",
|
|
64
65
|
maskPattern: "DDDDDDDDD",
|
|
@@ -68,7 +69,6 @@ const SSN_PRESET = {
|
|
|
68
69
|
blinkErrors: true,
|
|
69
70
|
showErrors: false
|
|
70
71
|
};
|
|
71
|
-
|
|
72
72
|
/**
|
|
73
73
|
* @param type: 'inputMask',
|
|
74
74
|
* @param maskPattern: 'DDD-DDD-DDDD',
|
|
@@ -79,6 +79,7 @@ const SSN_PRESET = {
|
|
|
79
79
|
* @param focusSelector: 'input',
|
|
80
80
|
* @param autocomplete: 'tel-national',
|
|
81
81
|
*/
|
|
82
|
+
|
|
82
83
|
const MOBILE_PHONE_PRESET = {
|
|
83
84
|
type: "inputMask",
|
|
84
85
|
// maskPattern: 'DDD-DDD-DDDD',
|
|
@@ -90,7 +91,6 @@ const MOBILE_PHONE_PRESET = {
|
|
|
90
91
|
showErrors: false,
|
|
91
92
|
autocomplete: "tel-national"
|
|
92
93
|
};
|
|
93
|
-
|
|
94
94
|
/**
|
|
95
95
|
* @param type: 'inputMask3',
|
|
96
96
|
* @param maskPattern: 'DDDD',
|
|
@@ -99,6 +99,7 @@ const MOBILE_PHONE_PRESET = {
|
|
|
99
99
|
* @param blinkErrors: true,
|
|
100
100
|
* @param showErrors: false,
|
|
101
101
|
*/
|
|
102
|
+
|
|
102
103
|
const SHORT_SSN_PRESET = {
|
|
103
104
|
type: "inputMask3",
|
|
104
105
|
maskPattern: "DDDD",
|
|
@@ -108,7 +109,6 @@ const SHORT_SSN_PRESET = {
|
|
|
108
109
|
blinkErrors: true,
|
|
109
110
|
showErrors: false
|
|
110
111
|
};
|
|
111
|
-
|
|
112
112
|
/**
|
|
113
113
|
* @param type: 'inputMask',
|
|
114
114
|
* @param maskPattern: 'DDDDDDDDD',
|
|
@@ -117,6 +117,7 @@ const SHORT_SSN_PRESET = {
|
|
|
117
117
|
* @param blinkErrors: true,
|
|
118
118
|
* @param showErrors: false,
|
|
119
119
|
*/
|
|
120
|
+
|
|
120
121
|
const ABA_PRESET = {
|
|
121
122
|
type: "inputMask",
|
|
122
123
|
maskPattern: "DDDDDDDDD",
|
|
@@ -125,7 +126,6 @@ const ABA_PRESET = {
|
|
|
125
126
|
blinkErrors: true,
|
|
126
127
|
showErrors: false
|
|
127
128
|
};
|
|
128
|
-
|
|
129
129
|
/**
|
|
130
130
|
* @param type: 'inputMask',
|
|
131
131
|
* @param maskPattern: 'MM/YY',
|
|
@@ -136,6 +136,7 @@ const ABA_PRESET = {
|
|
|
136
136
|
* @param showErrors: false,
|
|
137
137
|
* @param focusSelector: 'input',
|
|
138
138
|
*/
|
|
139
|
+
|
|
139
140
|
const CC_EXPIRATION_DATE = {
|
|
140
141
|
type: "inputMask",
|
|
141
142
|
maskPattern: "MM/YY",
|
|
@@ -146,7 +147,6 @@ const CC_EXPIRATION_DATE = {
|
|
|
146
147
|
showErrors: false,
|
|
147
148
|
focusSelector: "input"
|
|
148
149
|
};
|
|
149
|
-
|
|
150
150
|
/**
|
|
151
151
|
* @param type: 'inputMask',
|
|
152
152
|
* @param maskPattern: 'DDDDDDDDDD',
|
|
@@ -155,6 +155,7 @@ const CC_EXPIRATION_DATE = {
|
|
|
155
155
|
* @param blinkErrors: true,
|
|
156
156
|
* @param showErrors: false,
|
|
157
157
|
*/
|
|
158
|
+
|
|
158
159
|
const BANK_ACCOUNT = {
|
|
159
160
|
type: "inputMask",
|
|
160
161
|
maskPattern: "DDDDDDDDDD",
|
|
@@ -163,7 +164,7 @@ const BANK_ACCOUNT = {
|
|
|
163
164
|
blinkErrors: true,
|
|
164
165
|
showErrors: false
|
|
165
166
|
};
|
|
166
|
-
const MASK_PRESETS =
|
|
167
|
+
const MASK_PRESETS = {
|
|
167
168
|
BANK_ACCOUNT,
|
|
168
169
|
CC_EXPIRATION_DATE,
|
|
169
170
|
DATE_PRESET,
|
|
@@ -172,4 +173,5 @@ const MASK_PRESETS = exports.MASK_PRESETS = {
|
|
|
172
173
|
MOBILE_PHONE_PRESET,
|
|
173
174
|
SHORT_SSN_PRESET,
|
|
174
175
|
ABA_PRESET
|
|
175
|
-
};
|
|
176
|
+
};
|
|
177
|
+
exports.MASK_PRESETS = MASK_PRESETS;
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.INPUT_PRESETS = void 0;
|
|
7
|
+
|
|
7
8
|
var _fieldValueFormatters = require("../fieldValueFormatters");
|
|
9
|
+
|
|
8
10
|
const NAME_SYMBOLS_EXCLUDER = {
|
|
9
11
|
/**
|
|
10
12
|
* @name fieldChangesMiddleware
|
|
@@ -17,12 +19,12 @@ const NAME_SYMBOLS_EXCLUDER = {
|
|
|
17
19
|
*/
|
|
18
20
|
fieldChangesMiddleware: value => {
|
|
19
21
|
// remove invalid characters
|
|
20
|
-
const invalidCharacters = new RegExp(/[^a-zA-Z-\s']/g);
|
|
21
|
-
|
|
22
|
-
const sideBySideHyphenOrApostrophe = new RegExp(/['-]{2,}/g);
|
|
23
|
-
|
|
24
|
-
const multipleSpaces = new RegExp(/\s{2,}/g);
|
|
25
|
-
|
|
22
|
+
const invalidCharacters = new RegExp(/[^a-zA-Z-\s']/g); // handle any two '-' or ''' should not be side by side
|
|
23
|
+
|
|
24
|
+
const sideBySideHyphenOrApostrophe = new RegExp(/['-]{2,}/g); // replace sequence of spaces with single space
|
|
25
|
+
|
|
26
|
+
const multipleSpaces = new RegExp(/\s{2,}/g); // remove '-' or ''' if they are followed by a space
|
|
27
|
+
|
|
26
28
|
const beforeSpace = new RegExp(/['-](?=\s)/g);
|
|
27
29
|
const sanitizedValue = (0, _fieldValueFormatters.getSafelyValue)(value).replace(invalidCharacters, "").replace(sideBySideHyphenOrApostrophe, "").replace(multipleSpaces, " ").replace(beforeSpace, "");
|
|
28
30
|
return sanitizedValue;
|
|
@@ -48,7 +50,8 @@ const ONLY_STRING_AND_DASH = {
|
|
|
48
50
|
return sanitizedInput.replace(nonAlphabeticAndNotSingleDash, "").replace(consecutiveDashes, "-");
|
|
49
51
|
}
|
|
50
52
|
};
|
|
51
|
-
const INPUT_PRESETS =
|
|
53
|
+
const INPUT_PRESETS = {
|
|
52
54
|
NAME_SYMBOLS_EXCLUDER,
|
|
53
55
|
ONLY_STRING_AND_DASH
|
|
54
|
-
};
|
|
56
|
+
};
|
|
57
|
+
exports.INPUT_PRESETS = INPUT_PRESETS;
|
|
@@ -5,16 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.NUMERIC_KEYBOARD = exports.EMAIL_KEYBOARD = exports.ALL_KEYBOARD_TYPES = void 0;
|
|
7
7
|
//? Удобно использовать для расширения объекта атрибутов
|
|
8
|
-
const ALL_KEYBOARD_TYPES =
|
|
8
|
+
const ALL_KEYBOARD_TYPES = {
|
|
9
9
|
numeric: {
|
|
10
10
|
inputMode: "numeric"
|
|
11
11
|
},
|
|
12
12
|
email: {
|
|
13
13
|
inputMode: "email"
|
|
14
14
|
}
|
|
15
|
-
};
|
|
15
|
+
}; //? Например:
|
|
16
16
|
|
|
17
|
-
//? Например:
|
|
18
17
|
/*
|
|
19
18
|
const constructor = [
|
|
20
19
|
...
|
|
@@ -30,10 +29,10 @@ const ALL_KEYBOARD_TYPES = exports.ALL_KEYBOARD_TYPES = {
|
|
|
30
29
|
];
|
|
31
30
|
|
|
32
31
|
*/
|
|
33
|
-
|
|
34
32
|
// *****************************
|
|
35
33
|
//? Удобно использовать для расширения объекта филда, если в филде более не добавляются другие атрибуты
|
|
36
34
|
//? Например:
|
|
35
|
+
|
|
37
36
|
/*
|
|
38
37
|
const constructor = [
|
|
39
38
|
...
|
|
@@ -47,9 +46,12 @@ const ALL_KEYBOARD_TYPES = exports.ALL_KEYBOARD_TYPES = {
|
|
|
47
46
|
|
|
48
47
|
*/
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
exports.ALL_KEYBOARD_TYPES = ALL_KEYBOARD_TYPES;
|
|
50
|
+
const NUMERIC_KEYBOARD = {
|
|
51
51
|
attributesOfNativeInput: ALL_KEYBOARD_TYPES.numeric
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
exports.NUMERIC_KEYBOARD = NUMERIC_KEYBOARD;
|
|
54
|
+
const EMAIL_KEYBOARD = {
|
|
54
55
|
attributesOfNativeInput: ALL_KEYBOARD_TYPES.email
|
|
55
|
-
};
|
|
56
|
+
};
|
|
57
|
+
exports.EMAIL_KEYBOARD = EMAIL_KEYBOARD;
|
|
@@ -4,22 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.registerSchema = exports.loginSchema = exports.forgotSchema = void 0;
|
|
7
|
+
|
|
7
8
|
var yup = _interopRequireWildcard(require("yup"));
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
const forgotSchema = yup.object().shape({
|
|
11
15
|
email: yup.string().email("Invalid email").required("E-mail is required")
|
|
12
16
|
});
|
|
13
|
-
|
|
17
|
+
exports.forgotSchema = forgotSchema;
|
|
18
|
+
const loginSchema = yup.object().shape({
|
|
14
19
|
email: yup.string().email("Invalid email").required("E-mail is required"),
|
|
15
20
|
password: yup.string().required("No password provided").min(8, "Password is too short - should be 8 chars minimum").matches(/[a-zA-Z]/, "Password can only contain Latin letters"),
|
|
16
21
|
remember: yup.bool()
|
|
17
22
|
});
|
|
18
|
-
|
|
23
|
+
exports.loginSchema = loginSchema;
|
|
24
|
+
const registerSchema = yup.object().shape({
|
|
19
25
|
name: yup.string().required("Name is required"),
|
|
20
26
|
email: yup.string().email("Invalid email").required("E-mail is required"),
|
|
21
27
|
password: yup.string().required("No password provided").min(8, "Password is too short - should be 8 chars minimum").matches(/[a-zA-Z]/, "Password can only contain Latin letters"),
|
|
22
28
|
confirmPassword: yup.string().required("Confirm password").oneOf([yup.ref("password")], "Passwords must match"),
|
|
23
29
|
promo: yup.string(),
|
|
24
30
|
recaptcha: yup.bool().oneOf([true], "Field must be checked")
|
|
25
|
-
});
|
|
31
|
+
});
|
|
32
|
+
exports.registerSchema = registerSchema;
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = require("react");
|
|
9
|
+
|
|
8
10
|
const useBodyScrollLock = isScrollBodyLocked => {
|
|
9
11
|
(0, _react.useEffect)(() => {
|
|
10
12
|
if (isScrollBodyLocked) {
|
|
@@ -12,9 +14,12 @@ const useBodyScrollLock = isScrollBodyLocked => {
|
|
|
12
14
|
} else {
|
|
13
15
|
document.body.style.overflow = "auto";
|
|
14
16
|
}
|
|
17
|
+
|
|
15
18
|
return () => {
|
|
16
19
|
document.body.style.overflow = "auto";
|
|
17
20
|
};
|
|
18
21
|
}, [isScrollBodyLocked]);
|
|
19
22
|
};
|
|
20
|
-
|
|
23
|
+
|
|
24
|
+
var _default = useBodyScrollLock;
|
|
25
|
+
exports.default = _default;
|
|
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useClickOutside = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = require("react");
|
|
9
|
+
|
|
8
10
|
const useClickOutside = (ref, setOut, open) => {
|
|
9
11
|
function handleClickOutside(event) {
|
|
10
12
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
11
13
|
setOut(open);
|
|
12
14
|
}
|
|
13
15
|
}
|
|
16
|
+
|
|
14
17
|
(0, _react.useEffect)(() => {
|
|
15
18
|
document.addEventListener("mousedown", handleClickOutside);
|
|
16
19
|
return () => {
|
|
@@ -18,4 +21,5 @@ const useClickOutside = (ref, setOut, open) => {
|
|
|
18
21
|
};
|
|
19
22
|
}, [ref]);
|
|
20
23
|
};
|
|
24
|
+
|
|
21
25
|
exports.useClickOutside = useClickOutside;
|
|
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useDebounce = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
|
|
9
|
-
function
|
|
9
|
+
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
10
14
|
const useDebounce = _ref => {
|
|
11
15
|
let {
|
|
12
16
|
searchValue,
|
|
@@ -23,4 +27,5 @@ const useDebounce = _ref => {
|
|
|
23
27
|
}, [searchValue, delay]);
|
|
24
28
|
return debouncedValue;
|
|
25
29
|
};
|
|
30
|
+
|
|
26
31
|
exports.useDebounce = useDebounce;
|
|
@@ -4,39 +4,45 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useFieldsFocus;
|
|
7
|
+
|
|
7
8
|
var _react = require("react");
|
|
9
|
+
|
|
8
10
|
function useFieldsFocus(_ref) {
|
|
9
11
|
let {
|
|
10
12
|
form,
|
|
11
13
|
setForm
|
|
12
14
|
} = _ref;
|
|
13
15
|
const isFormAsObject = Boolean(typeof form === "object" && !Array.isArray(form));
|
|
16
|
+
|
|
14
17
|
const getField = key => {
|
|
15
18
|
if (isFormAsObject) {
|
|
16
19
|
var _form$key, _Object$values;
|
|
20
|
+
|
|
17
21
|
return (_form$key = form === null || form === void 0 ? void 0 : form[key]) !== null && _form$key !== void 0 ? _form$key : (_Object$values = Object.values(form)) === null || _Object$values === void 0 ? void 0 : _Object$values.find(field => field.key === key);
|
|
18
22
|
} else {
|
|
19
23
|
return form === null || form === void 0 ? void 0 : form.find(field => field.key === key);
|
|
20
24
|
}
|
|
21
25
|
};
|
|
26
|
+
|
|
22
27
|
const getErroredFields = () => {
|
|
23
28
|
if (isFormAsObject) {
|
|
24
29
|
var _Object$values2;
|
|
30
|
+
|
|
25
31
|
return (_Object$values2 = Object.values(form)) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.filter(field => field.error);
|
|
26
32
|
} else {
|
|
27
33
|
return form === null || form === void 0 ? void 0 : form.filter(f => f === null || f === void 0 ? void 0 : f.error);
|
|
28
34
|
}
|
|
29
35
|
};
|
|
36
|
+
|
|
30
37
|
const addRefsToFields = () => {
|
|
31
38
|
if (isFormAsObject) {
|
|
32
39
|
setForm(form => {
|
|
33
40
|
var _Object$keys;
|
|
41
|
+
|
|
34
42
|
return (_Object$keys = Object.keys(form)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.reduce((result, key) => {
|
|
35
43
|
const field = form[key];
|
|
36
|
-
return {
|
|
37
|
-
...
|
|
38
|
-
[key]: {
|
|
39
|
-
...field,
|
|
44
|
+
return { ...result,
|
|
45
|
+
[key]: { ...field,
|
|
40
46
|
ref: /*#__PURE__*/(0, _react.createRef)(),
|
|
41
47
|
wrapperRef: /*#__PURE__*/(0, _react.createRef)()
|
|
42
48
|
}
|
|
@@ -53,6 +59,7 @@ function useFieldsFocus(_ref) {
|
|
|
53
59
|
});
|
|
54
60
|
}
|
|
55
61
|
};
|
|
62
|
+
|
|
56
63
|
const toggleFieldFocus = _ref2 => {
|
|
57
64
|
let {
|
|
58
65
|
field,
|
|
@@ -60,10 +67,12 @@ function useFieldsFocus(_ref) {
|
|
|
60
67
|
} = _ref2;
|
|
61
68
|
if (!field || !(field !== null && field !== void 0 && field.ref)) return null;
|
|
62
69
|
setTimeout(() => {
|
|
63
|
-
var _field$ref$current;
|
|
64
|
-
|
|
70
|
+
var _field$ref$current, _field$ref$current$qu;
|
|
71
|
+
|
|
72
|
+
(_field$ref$current = field.ref.current) === null || _field$ref$current === void 0 ? void 0 : (_field$ref$current$qu = _field$ref$current.querySelector((field === null || field === void 0 ? void 0 : field.focusSelector) || "input")) === null || _field$ref$current$qu === void 0 ? void 0 : _field$ref$current$qu[action]();
|
|
65
73
|
}, 50);
|
|
66
74
|
};
|
|
75
|
+
|
|
67
76
|
const setFocusTo = key => {
|
|
68
77
|
const field = getField(key);
|
|
69
78
|
if (!field) return false;
|
|
@@ -71,14 +80,17 @@ function useFieldsFocus(_ref) {
|
|
|
71
80
|
field
|
|
72
81
|
});
|
|
73
82
|
};
|
|
83
|
+
|
|
74
84
|
const setFocusToErroredField = () => {
|
|
75
85
|
var _getErroredFields;
|
|
86
|
+
|
|
76
87
|
const field = (_getErroredFields = getErroredFields()) === null || _getErroredFields === void 0 ? void 0 : _getErroredFields[0];
|
|
77
88
|
if (!field) return false;
|
|
78
89
|
toggleFieldFocus({
|
|
79
90
|
field
|
|
80
91
|
});
|
|
81
92
|
};
|
|
93
|
+
|
|
82
94
|
(0, _react.useEffect)(() => {
|
|
83
95
|
addRefsToFields();
|
|
84
96
|
}, [form === null || form === void 0 ? void 0 : form.length]);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = ArrayWithObjects;
|
|
9
|
+
|
|
8
10
|
var _General = _interopRequireDefault(require("../functions/General"));
|
|
11
|
+
|
|
9
12
|
function ArrayWithObjects(_ref) {
|
|
10
13
|
let {
|
|
11
14
|
form,
|
|
@@ -22,20 +25,26 @@ function ArrayWithObjects(_ref) {
|
|
|
22
25
|
} = (0, _General.default)({
|
|
23
26
|
FormFields
|
|
24
27
|
});
|
|
28
|
+
|
|
25
29
|
const getFormField = function (key) {
|
|
26
30
|
var _getFormFields;
|
|
31
|
+
|
|
27
32
|
let argForm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : form;
|
|
28
33
|
return (_getFormFields = getFormFields(argForm)) === null || _getFormFields === void 0 ? void 0 : _getFormFields.find(f => f.key === key);
|
|
29
34
|
};
|
|
35
|
+
|
|
30
36
|
const setFormFields = data => {
|
|
31
37
|
const isFunction = typeof data === "function";
|
|
32
38
|
setForm(state => isFunction ? data(state) : data);
|
|
33
39
|
};
|
|
40
|
+
|
|
34
41
|
const setFormField = function (data) {
|
|
35
42
|
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
36
43
|
return setFormFields(fields => updateFormField(fields, data, key));
|
|
37
44
|
};
|
|
45
|
+
|
|
38
46
|
const removeAllFormFields = () => setFormFields([]);
|
|
47
|
+
|
|
39
48
|
return {
|
|
40
49
|
joinData,
|
|
41
50
|
getFieldData,
|