intelicoreact 1.4.21 → 1.4.23
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 +1 -9
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +1 -10
- package/dist/Atomic/FormElements/Calendar/Calendar.js +4 -24
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +1 -10
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +2 -14
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +5 -54
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +3 -21
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +51 -144
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +1 -7
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +25 -91
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +3 -15
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +15 -29
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +5 -15
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +6 -26
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +19 -35
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +9 -38
- package/dist/Atomic/FormElements/Input/Input.js +25 -60
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +4 -31
- package/dist/Atomic/FormElements/InputColor/InputColor.js +4 -14
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +6 -29
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +8 -43
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +3 -21
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +58 -81
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +6 -41
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +1 -8
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +16 -46
- package/dist/Atomic/FormElements/InputLink/InputLink.js +6 -23
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +0 -4
- package/dist/Atomic/FormElements/InputMask/InputMask.js +77 -208
- package/dist/Atomic/FormElements/InputMask/functions.js +2 -28
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +43 -119
- package/dist/Atomic/FormElements/InputMask2/functions.js +2 -28
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +44 -137
- package/dist/Atomic/FormElements/InputMask3/functions.js +2 -28
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +3 -17
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +5 -24
- package/dist/Atomic/FormElements/Label/Label.js +1 -9
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +35 -73
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +3 -15
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +23 -44
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +7 -17
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +3 -14
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +1 -10
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +3 -14
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +3 -23
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +17 -34
- package/dist/Atomic/FormElements/RangeList/RangeList.js +6 -25
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +1 -11
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +14 -85
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +43 -132
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +1 -10
- package/dist/Atomic/FormElements/Switcher/Switcher.js +1 -10
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +1 -13
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +1 -10
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +2 -17
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +3 -17
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +1 -11
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +6 -29
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +2 -3
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +1 -12
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +9 -31
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +125 -213
- package/dist/Atomic/FormElements/Text/Text.js +10 -16
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +1 -9
- package/dist/Atomic/FormElements/Textarea/Textarea.js +4 -20
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +6 -35
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +4 -13
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +7 -21
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +8 -35
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +5 -18
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +3 -10
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +3 -11
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +1 -2
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +5 -12
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +3 -15
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +3 -20
- package/dist/Atomic/Layout/Spinner/Spinner.js +1 -8
- package/dist/Atomic/UI/Accordion/Accordion.js +3 -19
- package/dist/Atomic/UI/Accordion/AccordionItem.js +9 -23
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +7 -32
- package/dist/Atomic/UI/AccordionText/AccordionText.js +3 -15
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +4 -21
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +3 -15
- package/dist/Atomic/UI/Alert/Alert.js +3 -19
- package/dist/Atomic/UI/Arrow/Arrow.js +3 -16
- package/dist/Atomic/UI/Box/Box.js +3 -9
- package/dist/Atomic/UI/Button/Button.js +2 -11
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +1 -10
- package/dist/Atomic/UI/Chart/Chart.js +4 -29
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +11 -19
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +1 -12
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +11 -34
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +82 -56
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +15 -19
- package/dist/Atomic/UI/Chart/partial/utils.js +6 -20
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +3 -13
- package/dist/Atomic/UI/DateTime/DateTime.js +3 -14
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +4 -16
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +3 -11
- package/dist/Atomic/UI/DoubleString/DoubleString.js +5 -17
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +3 -10
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +17 -52
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +1 -29
- package/dist/Atomic/UI/Hint/Hint.js +5 -31
- package/dist/Atomic/UI/Modal/Modal.js +6 -28
- package/dist/Atomic/UI/Modal/ModalHOC.js +1 -9
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +1 -7
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +1 -8
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +32 -49
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +6 -21
- package/dist/Atomic/UI/NavLine/NavLine.js +26 -55
- package/dist/Atomic/UI/NavLine/Tabs.js +2 -3
- package/dist/Atomic/UI/PageTitle/PageTitle.js +2 -10
- package/dist/Atomic/UI/PieChart/PieChart.js +1 -10
- package/dist/Atomic/UI/Price/Price.js +3 -8
- package/dist/Atomic/UI/PriceRange/PriceRange.js +1 -7
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +1 -16
- package/dist/Atomic/UI/Status/Status.js +1 -8
- package/dist/Atomic/UI/Table/Partials/TdCell.js +5 -29
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +1 -11
- package/dist/Atomic/UI/Table/Partials/TdRow.js +5 -17
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +3 -14
- package/dist/Atomic/UI/Table/Table.js +1 -12
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +2 -18
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +1 -9
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +1 -4
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +1 -13
- package/dist/Atomic/UI/Tag/Tag.js +7 -19
- package/dist/Atomic/UI/TagList/TagList.js +20 -38
- package/dist/Atomic/UI/UserBox/UserBox.js +1 -13
- package/dist/Classes/AbortableFetch.js +36 -93
- package/dist/Classes/AnimatedHandler.js +3 -7
- package/dist/Classes/RESTAPI/index.js +39 -42
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +35 -93
- package/dist/Classes/RESTAPI/partials/ApiBase.js +1 -9
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +24 -32
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +34 -41
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +21 -44
- package/dist/Classes/RESTAPI/partials/Utils.js +6 -19
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +2 -6
- package/dist/Classes/RESTAPI/partials/_utils.js +13 -36
- package/dist/Constants/index.constants.js +8 -15
- package/dist/Functions/Portal.js +5 -16
- package/dist/Functions/customEventListener.js +4 -17
- package/dist/Functions/fieldValueFormatters.js +43 -83
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +23 -26
- package/dist/Functions/locale/createTranslator.js +4 -9
- package/dist/Functions/operations.js +12 -22
- package/dist/Functions/presets/inputMaskPresets.js +9 -11
- package/dist/Functions/presets/inputPresets.js +8 -11
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +7 -9
- package/dist/Functions/schemas.js +6 -13
- package/dist/Functions/useBodyScrollLock.js +1 -6
- package/dist/Functions/useClickOutside.js +0 -4
- package/dist/Functions/useDebounce.js +2 -7
- package/dist/Functions/useFieldFocus.js +6 -18
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +0 -9
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +12 -23
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +6 -15
- package/dist/Functions/useFormTools/functions/General.js +18 -28
- package/dist/Functions/useFormTools/functions/RenderFields.js +2 -11
- package/dist/Functions/useFormTools/functions/usePrevious.js +1 -5
- package/dist/Functions/useFormTools/index.js +85 -144
- package/dist/Functions/useInputHighlightError.js +3 -12
- package/dist/Functions/useIsMobile.js +7 -13
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +1 -7
- package/dist/Functions/useKeyPress/useKeyPress.js +1 -9
- package/dist/Functions/useLocalStorage.js +1 -9
- package/dist/Functions/useLocationParams.js +4 -5
- package/dist/Functions/useMediaQuery.js +3 -9
- package/dist/Functions/useMetaInfo.js +3 -10
- package/dist/Functions/useMouseUpOutside.js +0 -3
- package/dist/Functions/useOnlineStatus.js +1 -9
- package/dist/Functions/usePasswordChecker.js +4 -20
- package/dist/Functions/usePrevious.js +1 -5
- package/dist/Functions/useResize.js +2 -10
- package/dist/Functions/useScrollTo.js +2 -7
- package/dist/Functions/useToggle.js +1 -5
- package/dist/Functions/utils.js +56 -131
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +2 -9
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +2 -9
- package/dist/Molecular/CustomIcons/components/AppStore.js +2 -9
- package/dist/Molecular/CustomIcons/components/Arrow.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +2 -9
- package/dist/Molecular/CustomIcons/components/Bell.js +2 -9
- package/dist/Molecular/CustomIcons/components/Button.js +2 -9
- package/dist/Molecular/CustomIcons/components/Campaigns.js +2 -9
- package/dist/Molecular/CustomIcons/components/Check.js +2 -9
- package/dist/Molecular/CustomIcons/components/Check2.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/Close.js +2 -9
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +2 -9
- package/dist/Molecular/CustomIcons/components/Delete.js +2 -9
- package/dist/Molecular/CustomIcons/components/Edit.js +2 -9
- package/dist/Molecular/CustomIcons/components/Email.js +2 -9
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +2 -9
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +2 -9
- package/dist/Molecular/CustomIcons/components/Flows.js +2 -9
- package/dist/Molecular/CustomIcons/components/Gift.js +2 -9
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +2 -9
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +2 -9
- package/dist/Molecular/CustomIcons/components/Home.js +2 -9
- package/dist/Molecular/CustomIcons/components/Home2.js +2 -9
- package/dist/Molecular/CustomIcons/components/Key.js +2 -9
- package/dist/Molecular/CustomIcons/components/Landers.js +2 -9
- package/dist/Molecular/CustomIcons/components/Lock.js +2 -9
- package/dist/Molecular/CustomIcons/components/Mail.js +2 -9
- package/dist/Molecular/CustomIcons/components/Mastercard.js +2 -9
- package/dist/Molecular/CustomIcons/components/Minus.js +2 -9
- package/dist/Molecular/CustomIcons/components/Offers.js +2 -9
- package/dist/Molecular/CustomIcons/components/Pause.js +2 -9
- package/dist/Molecular/CustomIcons/components/PayPal.js +2 -9
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +2 -9
- package/dist/Molecular/CustomIcons/components/Phone.js +2 -9
- package/dist/Molecular/CustomIcons/components/Play.js +2 -9
- package/dist/Molecular/CustomIcons/components/Plus.js +2 -9
- package/dist/Molecular/CustomIcons/components/Profile.js +2 -9
- package/dist/Molecular/CustomIcons/components/QRCode.js +2 -9
- package/dist/Molecular/CustomIcons/components/Rectangle.js +2 -9
- package/dist/Molecular/CustomIcons/components/Revert.js +2 -9
- package/dist/Molecular/CustomIcons/components/Star.js +2 -9
- package/dist/Molecular/CustomIcons/components/Star2.js +2 -9
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +2 -9
- package/dist/Molecular/CustomIcons/components/Trash.js +2 -9
- package/dist/Molecular/CustomIcons/components/TrashRed.js +2 -9
- package/dist/Molecular/CustomIcons/components/Triggers.js +2 -9
- package/dist/Molecular/CustomIcons/components/User.js +2 -9
- package/dist/Molecular/CustomIcons/components/Visa.js +2 -9
- package/dist/Molecular/CustomIcons/components/X.js +2 -9
- package/dist/Molecular/CustomIcons/index.js +0 -122
- package/dist/Molecular/FormElement/FormElement.js +1 -12
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +30 -31
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +9 -12
- package/dist/Molecular/InputAddress/InputAddress.js +65 -114
- package/dist/Molecular/InputPassword/InputPassword.js +5 -19
- package/dist/index.js +0 -2
- package/package.json +1 -1
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +0 -91
- package/dist/Atomic/UI/ModalBackup/Modal.js +0 -174
- package/dist/Atomic/UI/ModalBackup/Modal.scss +0 -333
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +0 -51
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +0 -24
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +0 -41
|
@@ -6,27 +6,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.formatToRemoveComa = exports.formatToPriceWithUSD = exports.formatToPriceWithCurrency = exports.formatToOnlyASCIICodeText = exports.formatToLimitLength = exports.formatToHideValuePartially = exports.formatToHex = exports.formatToAddBitDepthPoints = exports.formatOnlyNumbers = exports.formatNumberValueToMask = exports.formatAsPercentage = exports.filterNumeric = exports.filterFloat = void 0;
|
|
7
7
|
exports.formatToReplaceAllWhiteSpace = formatToReplaceAllWhiteSpace;
|
|
8
8
|
exports.intlNumbersFormatter = exports.getSafelyValue = void 0;
|
|
9
|
-
|
|
10
9
|
var _utils = require("./utils");
|
|
11
|
-
|
|
12
10
|
//? The first word "format" in the function name means a logic
|
|
13
11
|
//? in which the function transforms the incoming value in any case.
|
|
12
|
+
|
|
14
13
|
//? The first word "transform" in the function name means a logic
|
|
15
14
|
//? in which the function converts the whole value, but this is not suitable for sequential input
|
|
15
|
+
|
|
16
16
|
//? The first word "filter" in the function name means a logic
|
|
17
17
|
//? in which the function works as a changer for sequential input
|
|
18
|
+
|
|
18
19
|
// ****************************
|
|
19
20
|
// Base utils
|
|
20
21
|
// ****************************
|
|
22
|
+
|
|
21
23
|
const getSafelyValue = value => {
|
|
22
24
|
var _value$toString;
|
|
25
|
+
return value !== undefined && value !== null ? (value === null || value === void 0 || (_value$toString = value.toString) === null || _value$toString === void 0 ? void 0 : _value$toString.call(value)) || "" : "";
|
|
26
|
+
};
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
}; // базовая реализация
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
// базовая реализация
|
|
28
29
|
exports.getSafelyValue = getSafelyValue;
|
|
29
|
-
|
|
30
30
|
const intlNumbersFormatter = function (inputValue) {
|
|
31
31
|
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
32
32
|
const safelyInputValue = getSafelyValue(inputValue);
|
|
@@ -52,40 +52,31 @@ const intlNumbersFormatter = function (inputValue) {
|
|
|
52
52
|
currencyDisplay: inputCurrencyDisplay
|
|
53
53
|
} = currency;
|
|
54
54
|
let currencyDisplay;
|
|
55
|
-
|
|
56
55
|
switch (inputCurrencyDisplay) {
|
|
57
56
|
case "name":
|
|
58
57
|
currencyDisplay = "name";
|
|
59
58
|
break;
|
|
60
|
-
|
|
61
59
|
case "code":
|
|
62
60
|
currencyDisplay = "code";
|
|
63
61
|
break;
|
|
64
|
-
|
|
65
62
|
case "narrowSymbol":
|
|
66
63
|
currencyDisplay = "narrowSymbol";
|
|
67
64
|
break;
|
|
68
|
-
|
|
69
65
|
default:
|
|
70
66
|
currencyDisplay = "symbol";
|
|
71
67
|
}
|
|
72
|
-
|
|
73
68
|
let numberStyle;
|
|
74
|
-
|
|
75
69
|
switch (withSymbol) {
|
|
76
70
|
case "percent":
|
|
77
71
|
numberStyle = "percent";
|
|
78
72
|
break;
|
|
79
|
-
|
|
80
73
|
case "currency":
|
|
81
74
|
numberStyle = "currency";
|
|
82
75
|
break;
|
|
83
|
-
|
|
84
76
|
default:
|
|
85
77
|
numberStyle = "decimal";
|
|
86
78
|
break;
|
|
87
79
|
}
|
|
88
|
-
|
|
89
80
|
const {
|
|
90
81
|
quantity,
|
|
91
82
|
isRenderAlways = false,
|
|
@@ -95,20 +86,17 @@ const intlNumbersFormatter = function (inputValue) {
|
|
|
95
86
|
} = fractionDigits;
|
|
96
87
|
const dotIndex = safelyInputValue === null || safelyInputValue === void 0 ? void 0 : safelyInputValue.indexOf(".");
|
|
97
88
|
const afterDot = dotIndex !== -1 ? safelyInputValue.slice(dotIndex + 1) : "";
|
|
98
|
-
|
|
99
89
|
const minimumFractionDigits = (() => {
|
|
100
90
|
//? Безусловное минимальное количество. Всегда отрендерит дробную часть, в количестве символов сколько указано
|
|
101
|
-
if (typeof inputMinimumFractionDigits === "number") return inputMinimumFractionDigits;
|
|
102
|
-
|
|
91
|
+
if (typeof inputMinimumFractionDigits === "number") return inputMinimumFractionDigits;
|
|
92
|
+
//? Условное минимальное количество. Если есть дробная часть, то отрендерит дробных символов сколько указано
|
|
103
93
|
if (typeof conditionallyMinimumFractionDigits === "number") {
|
|
104
94
|
return afterDot && lastSym !== "." ? conditionallyMinimumFractionDigits : 0;
|
|
105
|
-
}
|
|
95
|
+
}
|
|
96
|
+
//? Дефолтное минимальное количество. Если есть дробная часть, то отрендерит дробных символов столько, сколько есть
|
|
106
97
|
//? Флаг isRenderAlways превращает дефолтный кейс в безусловное минимальное количество
|
|
107
|
-
|
|
108
|
-
|
|
109
98
|
return afterDot && lastSym !== "." ? safelyInputValue.slice(dotIndex).length - 1 : isRenderAlways ? quantity : 0;
|
|
110
99
|
})();
|
|
111
|
-
|
|
112
100
|
const priceSettings = {
|
|
113
101
|
useGrouping,
|
|
114
102
|
//группировка разрядов
|
|
@@ -126,41 +114,33 @@ const intlNumbersFormatter = function (inputValue) {
|
|
|
126
114
|
maximumFractionDigits: inputMaximumFractionDigits !== null && inputMaximumFractionDigits !== void 0 ? inputMaximumFractionDigits : quantity
|
|
127
115
|
};
|
|
128
116
|
let output;
|
|
129
|
-
|
|
130
117
|
try {
|
|
131
118
|
output = new Intl.NumberFormat(locale, priceSettings).format(value);
|
|
132
119
|
} catch (e) {
|
|
133
|
-
output = value;
|
|
134
|
-
|
|
120
|
+
output = value;
|
|
121
|
+
// eslint-disable-next-line no-console
|
|
135
122
|
console.warn("Intl.NumberFormat error", e);
|
|
136
123
|
}
|
|
137
|
-
|
|
138
124
|
return lastSym === "." ? output + lastSym : output;
|
|
139
|
-
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// ****************************
|
|
140
128
|
// format
|
|
141
129
|
// ****************************
|
|
142
|
-
|
|
143
|
-
|
|
144
130
|
exports.intlNumbersFormatter = intlNumbersFormatter;
|
|
145
|
-
|
|
146
131
|
const formatOnlyNumbers = value => getSafelyValue(value).replace(/\D/g, "");
|
|
147
|
-
|
|
148
132
|
exports.formatOnlyNumbers = formatOnlyNumbers;
|
|
149
|
-
|
|
150
133
|
const formatToRemoveComa = value => getSafelyValue(value).replace(/,/g, "");
|
|
151
|
-
|
|
152
134
|
exports.formatToRemoveComa = formatToRemoveComa;
|
|
153
|
-
|
|
154
135
|
const formatToAddBitDepthPoints = (value, settings) => intlNumbersFormatter(getSafelyValue(value), {
|
|
155
136
|
fractionDigits: {
|
|
156
137
|
quantity: (settings === null || settings === void 0 ? void 0 : settings.type) === "int" ? 0 : settings === null || settings === void 0 ? void 0 : settings.decimalPlaces
|
|
157
138
|
}
|
|
158
|
-
});
|
|
159
|
-
//! чем указано в quantity - округлит по правилам округления
|
|
160
|
-
|
|
139
|
+
});
|
|
161
140
|
|
|
141
|
+
//! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
142
|
+
//! чем указано в quantity - округлит по правилам округления
|
|
162
143
|
exports.formatToAddBitDepthPoints = formatToAddBitDepthPoints;
|
|
163
|
-
|
|
164
144
|
const formatToPriceWithUSD = value => {
|
|
165
145
|
if (isNaN(Number(value))) return value;
|
|
166
146
|
return intlNumbersFormatter(getSafelyValue(value), {
|
|
@@ -173,13 +153,13 @@ const formatToPriceWithUSD = value => {
|
|
|
173
153
|
conditionallyMinimumFractionDigits: 2
|
|
174
154
|
}
|
|
175
155
|
});
|
|
176
|
-
};
|
|
177
|
-
//! чем указано в quantity - округлит по правилам округления
|
|
178
|
-
// ToDo - symbolPosition временно не реализовано
|
|
156
|
+
};
|
|
179
157
|
|
|
158
|
+
//! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
159
|
+
//! чем указано в quantity - округлит по правилам округления
|
|
180
160
|
|
|
161
|
+
// ToDo - symbolPosition временно не реализовано
|
|
181
162
|
exports.formatToPriceWithUSD = formatToPriceWithUSD;
|
|
182
|
-
|
|
183
163
|
const formatToPriceWithCurrency = function (value, currencyCode) {
|
|
184
164
|
let symbolPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "before";
|
|
185
165
|
if (isNaN(Number(value))) return value;
|
|
@@ -193,23 +173,27 @@ const formatToPriceWithCurrency = function (value, currencyCode) {
|
|
|
193
173
|
conditionallyMinimumFractionDigits: 2
|
|
194
174
|
}
|
|
195
175
|
});
|
|
196
|
-
};
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
//? Добавляет в конец знак %. Работает как с одиночными значениями, так и с диапазонами.
|
|
179
|
+
|
|
197
180
|
//? value может быть любое, но ожидается что будет
|
|
198
181
|
//? - числом
|
|
199
182
|
//? - строкой в формате "значение"
|
|
200
183
|
//? - строкой в формате "значение - значение" (значение_пробел_тире_пробел_значение)
|
|
201
184
|
//? - объект в формате { from: значение, to: значение }
|
|
185
|
+
|
|
202
186
|
//? Предполагается, что "значение" может быть приведено к числу операторм + (пример: +значение приводится к числу).
|
|
203
187
|
//? Если не может быть приведено, то "значение" вернется как есть, к результату добавится %
|
|
188
|
+
|
|
204
189
|
//? Если "значение" пустое (getSafelyValue(значение) вернет пустую строку),
|
|
205
190
|
//? то это воспринимается как 0, приводится к 0.00%
|
|
191
|
+
|
|
206
192
|
//? Одиноково работает как для ".", так и "," в качестве разделителя дробных разрядов
|
|
193
|
+
|
|
207
194
|
//! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
208
195
|
//! чем указано в decimalPlaces - округлит по правилам округления
|
|
209
|
-
|
|
210
|
-
|
|
211
196
|
exports.formatToPriceWithCurrency = formatToPriceWithCurrency;
|
|
212
|
-
|
|
213
197
|
const formatAsPercentage = (value, settings) => {
|
|
214
198
|
const {
|
|
215
199
|
isCommonPercentageSymbol = true,
|
|
@@ -218,9 +202,7 @@ const formatAsPercentage = (value, settings) => {
|
|
|
218
202
|
afterValueSymbol = ""
|
|
219
203
|
} = (0, _utils.getIsOnlyAnObject)(settings) ? settings : {};
|
|
220
204
|
let safelyInputValue;
|
|
221
|
-
|
|
222
205
|
const checkValue = value => getSafelyValue(value) || "0";
|
|
223
|
-
|
|
224
206
|
const transform = valueAsSting => {
|
|
225
207
|
const processedValue = valueAsSting.replace(/,/g, ".");
|
|
226
208
|
if (Number.isNaN(Number(processedValue))) return processedValue;
|
|
@@ -231,7 +213,6 @@ const formatAsPercentage = (value, settings) => {
|
|
|
231
213
|
}
|
|
232
214
|
}));
|
|
233
215
|
};
|
|
234
|
-
|
|
235
216
|
if ((0, _utils.getIsOnlyAnObject)(value)) {
|
|
236
217
|
safelyInputValue = {
|
|
237
218
|
from: checkValue(value.from),
|
|
@@ -239,7 +220,6 @@ const formatAsPercentage = (value, settings) => {
|
|
|
239
220
|
};
|
|
240
221
|
} else {
|
|
241
222
|
safelyInputValue = checkValue(value);
|
|
242
|
-
|
|
243
223
|
if (safelyInputValue.includes(" - ")) {
|
|
244
224
|
const valuesArr = safelyInputValue.split(" - ").map(partOfValue => partOfValue.trim());
|
|
245
225
|
safelyInputValue = {
|
|
@@ -250,21 +230,19 @@ const formatAsPercentage = (value, settings) => {
|
|
|
250
230
|
return "".concat(beforeValueSymbol).concat(transform(safelyInputValue)).concat(afterValueSymbol, "%");
|
|
251
231
|
}
|
|
252
232
|
}
|
|
253
|
-
|
|
254
233
|
if (isCommonPercentageSymbol) return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from), " - ").concat(transform(safelyInputValue.to)).concat(afterValueSymbol, "%");else return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from), "% - ").concat(transform(safelyInputValue.to), "%").concat(afterValueSymbol);
|
|
255
|
-
};
|
|
256
|
-
|
|
234
|
+
};
|
|
257
235
|
|
|
236
|
+
// eslint-disable-next-line no-control-regex
|
|
258
237
|
exports.formatAsPercentage = formatAsPercentage;
|
|
238
|
+
const formatToOnlyASCIICodeText = text => getSafelyValue(text).replace(/[^\x00-\x7F]+/g, "");
|
|
259
239
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
240
|
+
// eslint-disable-next-line default-param-last
|
|
263
241
|
exports.formatToOnlyASCIICodeText = formatToOnlyASCIICodeText;
|
|
264
|
-
|
|
265
242
|
const formatNumberValueToMask = (inputValue, settings) => {
|
|
266
|
-
const safelyInputValue = getSafelyValue(inputValue);
|
|
243
|
+
const safelyInputValue = getSafelyValue(inputValue);
|
|
267
244
|
|
|
245
|
+
// default valueSymbol === 'n', default mask === 'nnn-nnn-nnnn'
|
|
268
246
|
const {
|
|
269
247
|
mask = "XXX-XXX-XXXX",
|
|
270
248
|
valueSymbol = "X",
|
|
@@ -284,16 +262,12 @@ const formatNumberValueToMask = (inputValue, settings) => {
|
|
|
284
262
|
cursorPosition: processing.cursorPosition
|
|
285
263
|
} : processing.newValue.join("");
|
|
286
264
|
};
|
|
287
|
-
|
|
288
265
|
exports.formatNumberValueToMask = formatNumberValueToMask;
|
|
289
|
-
|
|
290
266
|
const formatToLimitLength = (inputValue, limit) => {
|
|
291
267
|
const value = getSafelyValue(inputValue);
|
|
292
268
|
return limit && typeof limit === "number" && !Number.isNaN(limit) && (value === null || value === void 0 ? void 0 : value.length) > limit ? value.substr(0, limit) : value;
|
|
293
269
|
};
|
|
294
|
-
|
|
295
270
|
exports.formatToLimitLength = formatToLimitLength;
|
|
296
|
-
|
|
297
271
|
const formatToHex = _ref => {
|
|
298
272
|
let {
|
|
299
273
|
inputValue,
|
|
@@ -303,19 +277,22 @@ const formatToHex = _ref => {
|
|
|
303
277
|
if (withSharp) return "#".concat(value.replace(/[^a-f0-9]/gi, ""));
|
|
304
278
|
return "".concat(value.replace(/[^#a-f0-9]/gi, ""));
|
|
305
279
|
};
|
|
306
|
-
|
|
307
280
|
exports.formatToHex = formatToHex;
|
|
308
|
-
|
|
309
281
|
function formatToReplaceAllWhiteSpace(str) {
|
|
310
282
|
const value = getSafelyValue(str);
|
|
311
283
|
return value.replace(/\s+/g, "");
|
|
312
|
-
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// ****************************
|
|
313
287
|
// transform
|
|
314
288
|
// ****************************
|
|
289
|
+
|
|
315
290
|
// ...
|
|
291
|
+
|
|
316
292
|
// ****************************
|
|
317
293
|
// filter
|
|
318
294
|
// ****************************
|
|
295
|
+
|
|
319
296
|
// export const filterFloat = (inputValue, decimalPlaces = null) => {
|
|
320
297
|
// const value = getSafelyValue(inputValue);
|
|
321
298
|
// const replaser = input => ('' + input).replace(/[^\.\d]/g, '');
|
|
@@ -337,42 +314,30 @@ function formatToReplaceAllWhiteSpace(str) {
|
|
|
337
314
|
// return replaser(lastSym === '.' && previousValue.includes('.') ? previousValue : output);
|
|
338
315
|
// };
|
|
339
316
|
|
|
340
|
-
|
|
341
317
|
const filterFloat = function (inputValue) {
|
|
342
318
|
var _output, _output2, _output3, _output4;
|
|
343
|
-
|
|
344
319
|
let decimalPlaces = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
345
320
|
const value = getSafelyValue(inputValue);
|
|
346
|
-
|
|
347
321
|
const replacer = input => {
|
|
348
322
|
var _String;
|
|
349
|
-
|
|
350
323
|
return (_String = String(input)) === null || _String === void 0 ? void 0 : _String.replace(/[^\.\d,]/g, "");
|
|
351
324
|
};
|
|
352
|
-
|
|
353
325
|
if (value.length === 1 && (value[0] === "." || value[0] === ",")) return "0.";
|
|
354
326
|
let output = value;
|
|
355
327
|
const previousValue = String((_output = output) === null || _output === void 0 ? void 0 : _output.slice(0, -1));
|
|
356
328
|
const lastSym = String((_output2 = output) === null || _output2 === void 0 ? void 0 : _output2.slice(-1));
|
|
357
|
-
|
|
358
329
|
if (decimalPlaces && typeof decimalPlaces === "number" && previousValue !== null && previousValue !== void 0 && previousValue.includes(".") && (previousValue === null || previousValue === void 0 ? void 0 : previousValue.indexOf(".")) + 1 + decimalPlaces === (previousValue === null || previousValue === void 0 ? void 0 : previousValue.length)) {
|
|
359
330
|
return replacer(previousValue);
|
|
360
331
|
}
|
|
361
|
-
|
|
362
332
|
if ((_output3 = output) !== null && _output3 !== void 0 && _output3.includes(".") && output[((_output4 = output) === null || _output4 === void 0 ? void 0 : _output4.indexOf(".")) + 3] !== undefined && Number(output)) {
|
|
363
333
|
var _Number;
|
|
364
|
-
|
|
365
334
|
output = (_Number = Number(output)) === null || _Number === void 0 ? void 0 : _Number.toFixed(decimalPlaces);
|
|
366
335
|
}
|
|
367
|
-
|
|
368
336
|
return replacer(lastSym === "." && previousValue !== null && previousValue !== void 0 && previousValue.includes(".") ? previousValue : output);
|
|
369
337
|
};
|
|
370
|
-
|
|
371
338
|
exports.filterFloat = filterFloat;
|
|
372
|
-
|
|
373
339
|
const filterNumeric = (value, settings) => {
|
|
374
340
|
var _getSafelyValue;
|
|
375
|
-
|
|
376
341
|
value = (_getSafelyValue = getSafelyValue(value)) === null || _getSafelyValue === void 0 ? void 0 : _getSafelyValue.replace(/,/g, "");
|
|
377
342
|
const {
|
|
378
343
|
type = "float",
|
|
@@ -381,9 +346,7 @@ const filterNumeric = (value, settings) => {
|
|
|
381
346
|
const executor = type === "float" ? filterFloat : formatOnlyNumbers;
|
|
382
347
|
return executor(getSafelyValue(value), decimalPlaces);
|
|
383
348
|
};
|
|
384
|
-
|
|
385
349
|
exports.filterNumeric = filterNumeric;
|
|
386
|
-
|
|
387
350
|
const formatToHideValuePartially = (value, settings) => {
|
|
388
351
|
const {
|
|
389
352
|
showSymbolsCount = 4,
|
|
@@ -393,12 +356,9 @@ const formatToHideValuePartially = (value, settings) => {
|
|
|
393
356
|
const safelyValue = getSafelyValue(value);
|
|
394
357
|
const newValue = isCutOutWhiteSpaces ? safelyValue.replace(/\s/g, "") : safelyValue;
|
|
395
358
|
if (newValue.length <= showSymbolsCount) return newValue;
|
|
396
|
-
|
|
397
359
|
const hide = val => val.split("").map(() => "*").join("");
|
|
398
|
-
|
|
399
360
|
const visiblePart = isVisibleFromFront ? newValue.slice(0, showSymbolsCount) : newValue.slice(-1 * showSymbolsCount);
|
|
400
361
|
const hiddenPart = isVisibleFromFront ? newValue.slice(showSymbolsCount) : newValue.slice(0, -1 * showSymbolsCount);
|
|
401
362
|
return isVisibleFromFront ? "".concat(visiblePart).concat(hide(hiddenPart)) : "".concat(hide(hiddenPart)).concat(visiblePart);
|
|
402
363
|
};
|
|
403
|
-
|
|
404
364
|
exports.formatToHideValuePartially = formatToHideValuePartially;
|
|
@@ -4,18 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
function
|
|
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
|
-
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
14
10
|
const timeouts = {
|
|
15
11
|
timeoutId: null
|
|
16
12
|
};
|
|
17
|
-
const formChanges = [];
|
|
13
|
+
const formChanges = [];
|
|
18
14
|
|
|
15
|
+
// ? validateField - должен возвращать структуру { field, isValid }
|
|
19
16
|
const useFormFieldsChangesManager = _ref => {
|
|
20
17
|
let {
|
|
21
18
|
form,
|
|
@@ -27,23 +24,26 @@ const useFormFieldsChangesManager = _ref => {
|
|
|
27
24
|
const {
|
|
28
25
|
isNotSetForm,
|
|
29
26
|
isUseValidation = false
|
|
30
|
-
} = settings || {};
|
|
27
|
+
} = settings || {};
|
|
28
|
+
|
|
29
|
+
//? Пробовал ставить просто useEffect по formChangesRef.current,
|
|
31
30
|
//? но по какой-то причине после изменении рефки не заходило в useEffect.
|
|
32
31
|
//? Однако если срабатывал useEffect по какой-нибудь другой переменной,
|
|
33
32
|
//? то и в useEffect по formChangesRef.current тоже заходило.
|
|
34
33
|
//? Поэтому тут нужен этот стейт,
|
|
35
34
|
//? хотя по итогу в конечной реализации с ним даже неплохо получилось (но вообще очень странная ерунда...)
|
|
35
|
+
const [isFormMustBeChanget, setIsFormMustBeChanget] = (0, _react.useState)(false);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
//? Ф-я является ф-ей - постановщиком изменений формы в очередь.
|
|
38
38
|
//? Ф-я получается самовызывающимся геттером.
|
|
39
39
|
//? Cуть ф-ии:
|
|
40
40
|
//? Для того чтоб не спамить изменениями, если их назначается много в рамках одной итерации,
|
|
41
41
|
//? ипользую прием с переназначением setTimeout
|
|
42
|
+
|
|
42
43
|
//? Чтобы преждевременно не спровацировать сработку useEffect
|
|
43
44
|
//? по стейту фиксирующему "отмашку" к началу изменений (isFormMustBeChanget)
|
|
44
45
|
//? откладываю переназначение этого стейта до приостановки непрерывных вызовов assignChangesToField,
|
|
45
46
|
//? но при этом при каждом ее вызове продолжаю добавлять изменения в массив
|
|
46
|
-
|
|
47
47
|
const assignChangesToField = (() => {
|
|
48
48
|
return (data, key) => {
|
|
49
49
|
clearTimeout(timeouts.timeoutId);
|
|
@@ -55,12 +55,11 @@ const useFormFieldsChangesManager = _ref => {
|
|
|
55
55
|
timeouts.timeoutId = setTimeout(() => setIsFormMustBeChanget(true), 1);
|
|
56
56
|
return formChanges;
|
|
57
57
|
};
|
|
58
|
-
})();
|
|
59
|
-
|
|
58
|
+
})();
|
|
60
59
|
|
|
60
|
+
//? Ф-я применяет "накопленные" изменения
|
|
61
61
|
const changeForm = async () => {
|
|
62
62
|
var _modifiedFormFromOuts;
|
|
63
|
-
|
|
64
63
|
let modifiedFormFromOutside;
|
|
65
64
|
const errorsFromChanges = {};
|
|
66
65
|
const newForm = formChanges.reduce((acc, change) => {
|
|
@@ -72,23 +71,24 @@ const useFormFieldsChangesManager = _ref => {
|
|
|
72
71
|
error
|
|
73
72
|
} = data || {};
|
|
74
73
|
const field = acc.find(field => field.key === key);
|
|
75
|
-
|
|
76
74
|
if (field) {
|
|
77
|
-
acc = acc.map(field => field.key === key ? {
|
|
75
|
+
acc = acc.map(field => field.key === key ? {
|
|
76
|
+
...field,
|
|
78
77
|
...data
|
|
79
78
|
} : field);
|
|
80
79
|
if (error || error !== undefined) errorsFromChanges[key] = error;
|
|
81
80
|
}
|
|
82
|
-
|
|
83
81
|
return acc;
|
|
84
|
-
}, form);
|
|
82
|
+
}, form);
|
|
85
83
|
|
|
84
|
+
// ToDo - порефакторить, не прогонять валидацию всех полей, а только измененных
|
|
86
85
|
const validatedForm = isUseValidation && typeof validateField === "function" ? newForm.map(field => {
|
|
87
|
-
var _validateField
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
error: ((_validateField = validateField({
|
|
91
|
-
|
|
86
|
+
var _validateField;
|
|
87
|
+
return {
|
|
88
|
+
...field,
|
|
89
|
+
error: ((_validateField = validateField({
|
|
90
|
+
...field
|
|
91
|
+
}, newForm)) === null || _validateField === void 0 || (_validateField = _validateField.field) === null || _validateField === void 0 ? void 0 : _validateField.error) || errorsFromChanges[field.key] || ""
|
|
92
92
|
};
|
|
93
93
|
}) : newForm;
|
|
94
94
|
if (callback && typeof callback === "function") modifiedFormFromOutside = await callback(validatedForm);
|
|
@@ -96,7 +96,6 @@ const useFormFieldsChangesManager = _ref => {
|
|
|
96
96
|
formChanges.length = 0;
|
|
97
97
|
setIsFormMustBeChanget(false);
|
|
98
98
|
};
|
|
99
|
-
|
|
100
99
|
(0, _react.useEffect)(() => {
|
|
101
100
|
if (isFormMustBeChanget) changeForm();
|
|
102
101
|
}, [isFormMustBeChanget]);
|
|
@@ -107,6 +106,4 @@ const useFormFieldsChangesManager = _ref => {
|
|
|
107
106
|
changesArray: [...formChanges]
|
|
108
107
|
};
|
|
109
108
|
};
|
|
110
|
-
|
|
111
|
-
var _default = useFormFieldsChangesManager;
|
|
112
|
-
exports.default = _default;
|
|
109
|
+
var _default = exports.default = useFormFieldsChangesManager;
|
|
@@ -4,35 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createTranslator;
|
|
7
|
-
|
|
8
7
|
var _fieldValueFormatters = require("./../fieldValueFormatters");
|
|
9
|
-
|
|
10
8
|
const DEFAULT_CODE = "en";
|
|
11
|
-
|
|
12
9
|
function createTranslator(_ref) {
|
|
13
|
-
let {
|
|
10
|
+
let {
|
|
11
|
+
...langCatalogs
|
|
14
12
|
} = _ref;
|
|
15
|
-
const loc = {
|
|
13
|
+
const loc = {
|
|
14
|
+
...langCatalogs
|
|
16
15
|
};
|
|
17
16
|
let code = window.localStorage.getItem("lng");
|
|
18
17
|
if (!code) code = window.navigator ? window.navigator.language.split("-")[0] : DEFAULT_CODE;
|
|
19
18
|
if (!loc[code]) code = DEFAULT_CODE;
|
|
20
19
|
return function (text, values) {
|
|
21
20
|
var _Object$keys;
|
|
22
|
-
|
|
23
21
|
const safelyValues = values !== null && values !== void 0 ? values : {};
|
|
24
22
|
const safelyText = (0, _fieldValueFormatters.getSafelyValue)(text);
|
|
25
23
|
let translatedText = loc[code] && loc[code][safelyText] ? loc[code][safelyText] : safelyText;
|
|
26
|
-
|
|
27
24
|
if (Object !== null && Object !== void 0 && (_Object$keys = Object.keys(safelyValues)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
|
|
28
25
|
for (const key in values) {
|
|
29
26
|
var _translatedText;
|
|
30
|
-
|
|
31
27
|
const regex = new RegExp("%".concat(key, "%"), "g");
|
|
32
28
|
translatedText = (_translatedText = translatedText) === null || _translatedText === void 0 ? void 0 : _translatedText.replace(regex, values[key]);
|
|
33
29
|
}
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
return translatedText;
|
|
37
32
|
};
|
|
38
33
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.addRangeDefault = void 0;
|
|
7
|
-
|
|
8
7
|
// Взято из https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Math/round
|
|
9
8
|
// При импорте любой ф-и из этого файла отработает самовызывающаяся ф-я и расширит
|
|
10
9
|
// объект Math 3-мя ф-ми: round10, floor10, ceil10
|
|
@@ -22,44 +21,39 @@ exports.addRangeDefault = void 0;
|
|
|
22
21
|
if (typeof exp === "undefined" || Number(exp) === 0) {
|
|
23
22
|
return Math[type](value);
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
value = Number(value);
|
|
27
|
-
exp = Number(exp);
|
|
28
|
-
|
|
25
|
+
exp = Number(exp);
|
|
26
|
+
// Если значение не является числом, либо степень не является целым числом...
|
|
29
27
|
if (isNaN(value) || !(typeof exp === "number" && exp % 1 === 0)) {
|
|
30
28
|
return NaN;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
}
|
|
30
|
+
// Сдвиг разрядов
|
|
34
31
|
value = value.toString().split("e");
|
|
35
|
-
value = Math[type](Number(value[0] + "e" + (value[1] ? Number(value[1]) - exp : -exp)));
|
|
36
|
-
|
|
32
|
+
value = Math[type](Number(value[0] + "e" + (value[1] ? Number(value[1]) - exp : -exp)));
|
|
33
|
+
// Обратный сдвиг
|
|
37
34
|
value = value.toString().split("e");
|
|
38
35
|
return Number(value[0] + "e" + (value[1] ? Number(value[1]) + exp : exp));
|
|
39
|
-
}
|
|
40
|
-
|
|
36
|
+
}
|
|
41
37
|
|
|
38
|
+
// Десятичное округление к ближайшему
|
|
42
39
|
if (!Math.round10) {
|
|
43
40
|
Math.round10 = function (value, exp) {
|
|
44
41
|
return decimalAdjust("round", value, exp);
|
|
45
42
|
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
}
|
|
44
|
+
// Десятичное округление вниз
|
|
49
45
|
if (!Math.floor10) {
|
|
50
46
|
Math.floor10 = function (value, exp) {
|
|
51
47
|
return decimalAdjust("floor", value, exp);
|
|
52
48
|
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
}
|
|
50
|
+
// Десятичное округление вверх
|
|
56
51
|
if (!Math.ceil10) {
|
|
57
52
|
Math.ceil10 = function (value, exp) {
|
|
58
53
|
return decimalAdjust("ceil", value, exp);
|
|
59
54
|
};
|
|
60
55
|
}
|
|
61
56
|
})();
|
|
62
|
-
|
|
63
57
|
const addRangeDefault = (from, to, currentValues, decimalPlaces) => {
|
|
64
58
|
if (!(currentValues !== null && currentValues !== void 0 && currentValues.length)) return [{
|
|
65
59
|
from,
|
|
@@ -70,10 +64,8 @@ const addRangeDefault = (from, to, currentValues, decimalPlaces) => {
|
|
|
70
64
|
const isIncludesFrom = Boolean(acc.from) && range.from < acc.from && range.to >= acc.from;
|
|
71
65
|
const isIncludesTo = Boolean(acc.to) && range.from <= acc.to && range.to > acc.to;
|
|
72
66
|
const isRangeMustBeIncludet = Boolean(acc.from) && Boolean(acc.to) && acc.from <= range.from && acc.to >= range.to;
|
|
73
|
-
|
|
74
67
|
const processTo = () => {
|
|
75
68
|
const lastAccRange = acc.result[acc.result.length - 1];
|
|
76
|
-
|
|
77
69
|
if (acc.to < range.from) {
|
|
78
70
|
lastAccRange.to = acc.to;
|
|
79
71
|
acc.to = null;
|
|
@@ -90,7 +82,6 @@ const addRangeDefault = (from, to, currentValues, decimalPlaces) => {
|
|
|
90
82
|
acc.to = null;
|
|
91
83
|
}
|
|
92
84
|
};
|
|
93
|
-
|
|
94
85
|
if (!acc.from && !acc.to) acc.result = [...acc.result, range];else if (!acc.from && acc.to) processTo();else if (acc.from && acc.to) {
|
|
95
86
|
if (acc.from <= range.from) {
|
|
96
87
|
acc.result = [...acc.result, {
|
|
@@ -124,5 +115,4 @@ const addRangeDefault = (from, to, currentValues, decimalPlaces) => {
|
|
|
124
115
|
if (!result[result.length - 1].to) result[result.length - 1].to = to;
|
|
125
116
|
return result;
|
|
126
117
|
};
|
|
127
|
-
|
|
128
118
|
exports.addRangeDefault = addRangeDefault;
|