intelicoreact 1.3.22 → 1.3.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 +5 -8
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.scss +9 -9
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +6 -9
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.scss +8 -10
- package/dist/Atomic/FormElements/Calendar/Calendar.js +31 -33
- package/dist/Atomic/FormElements/Calendar/Calendar.scss +23 -27
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +4 -4
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +16 -19
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +1 -1
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.scss +2 -2
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +53 -53
- package/dist/Atomic/FormElements/Datepicker/Datepicker.scss +0 -8
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +20 -20
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +81 -83
- package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +141 -95
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +1 -1
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.scss +3 -3
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +30 -28
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.scss +54 -18
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +4 -4
- package/dist/Atomic/FormElements/FileLoader/FileLoader.scss +31 -30
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +12 -12
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +3 -3
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +8 -8
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.scss +44 -29
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +17 -15
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +15 -15
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.scss +24 -21
- package/dist/Atomic/FormElements/Input/Input.js +43 -45
- package/dist/Atomic/FormElements/Input/Input.scss +18 -18
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +19 -19
- package/dist/Atomic/FormElements/InputColor/InputColor.js +7 -9
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +12 -12
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.scss +9 -6
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +42 -42
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.scss +95 -95
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +10 -10
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -81
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +14 -14
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +4 -4
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +54 -54
- package/dist/Atomic/FormElements/InputLink/InputLink.js +11 -13
- package/dist/Atomic/FormElements/InputLink/InputLink.scss +5 -5
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +2 -2
- package/dist/Atomic/FormElements/InputMask/InputMask.js +66 -67
- package/dist/Atomic/FormElements/InputMask/InputMask.scss +10 -10
- package/dist/Atomic/FormElements/InputMask/config.js +9 -9
- package/dist/Atomic/FormElements/InputMask/functions.js +8 -7
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +42 -42
- package/dist/Atomic/FormElements/InputMask2/InputMask2.scss +13 -12
- package/dist/Atomic/FormElements/InputMask2/config.js +9 -9
- package/dist/Atomic/FormElements/InputMask2/functions.js +8 -7
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +50 -50
- package/dist/Atomic/FormElements/InputMask3/InputMask3.scss +13 -12
- package/dist/Atomic/FormElements/InputMask3/config.js +9 -9
- package/dist/Atomic/FormElements/InputMask3/functions.js +8 -7
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +7 -9
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.scss +34 -31
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +23 -23
- package/dist/Atomic/FormElements/InputsRow/InputsRow.scss +4 -5
- package/dist/Atomic/FormElements/Label/Label.js +2 -2
- package/dist/Atomic/FormElements/Label/Label.scss +2 -2
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +69 -69
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.scss +8 -9
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +2 -2
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.scss +2 -2
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +27 -27
- package/dist/Atomic/FormElements/NumericInput/NumericInput.scss +18 -18
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +3 -3
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.scss +1 -0
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +6 -6
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.scss +1 -0
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +2 -2
- package/dist/Atomic/FormElements/RadioInput/RadioInput.scss +4 -8
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +7 -7
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.scss +26 -25
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +24 -24
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.scss +17 -19
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +30 -30
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.scss +5 -5
- package/dist/Atomic/FormElements/RangeList/RangeList.js +27 -27
- package/dist/Atomic/FormElements/RangeList/RangeList.scss +23 -23
- package/dist/Atomic/FormElements/RangeList/partial/AnyOuterClass.scss +5 -4
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +1 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +31 -31
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.scss +19 -24
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.stories.scss +7 -7
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider.stories.scss +8 -8
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +22 -22
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.scss +165 -91
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +1 -1
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.scss +2 -2
- package/dist/Atomic/FormElements/Switcher/Switcher.js +1 -1
- package/dist/Atomic/FormElements/Switcher/Switcher.scss +10 -12
- package/dist/Atomic/FormElements/Switcher/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +4 -6
- package/dist/Atomic/FormElements/SwitcherCheckbox/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +2 -2
- package/dist/Atomic/FormElements/SwitcherHide/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +4 -4
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.scss +1 -1
- package/dist/Atomic/FormElements/SwitcherRadio/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +5 -5
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +2 -2
- package/dist/Atomic/FormElements/SwitcherRangeList/partial/AnyOuterClass.scss +6 -6
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +9 -9
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.scss +2 -3
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +100 -100
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +5 -5
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.scss +2 -3
- package/dist/Atomic/FormElements/SwitcherTextarea/partial/AnyOuterClass.scss +4 -4
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +67 -68
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.scss +103 -64
- package/dist/Atomic/FormElements/Text/Text.js +13 -13
- package/dist/Atomic/FormElements/Text/Text.scss +0 -1
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +4 -4
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.scss +15 -15
- package/dist/Atomic/FormElements/Textarea/Textarea.js +2 -2
- package/dist/Atomic/FormElements/Textarea/Textarea.scss +7 -8
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +3 -3
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.scss +5 -6
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +9 -9
- package/dist/Atomic/FormElements/TimeRange/TimeRange.scss +1 -1
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +36 -37
- package/dist/Atomic/FormElements/UserContacts/partial/AnyOuterClass.scss +5 -6
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +3 -3
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.scss +77 -59
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +3 -3
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.scss +9 -10
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/AnyOuterClass.scss +16 -14
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +18 -18
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +6 -6
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.scss +9 -10
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/AnyOuterClass.scss +16 -14
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +14 -14
- package/dist/Atomic/Layout/Header/Header.js +11 -11
- package/dist/Atomic/Layout/Header/Header.scss +9 -10
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +17 -18
- package/dist/Atomic/Layout/MainMenu/MainMenu.scss +14 -17
- package/dist/Atomic/Layout/Spinner/Spinner.js +4 -4
- package/dist/Atomic/Layout/Spinner/Spinner.scss +3 -3
- package/dist/Atomic/UI/Accordion/Accordion.js +7 -7
- package/dist/Atomic/UI/Accordion/Accordion.scss +11 -11
- package/dist/Atomic/UI/Accordion/AccordionItem.js +12 -12
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +22 -23
- package/dist/Atomic/UI/AccordionTable/AccordionTable.scss +33 -38
- package/dist/Atomic/UI/AccordionText/AccordionText.js +3 -3
- package/dist/Atomic/UI/AccordionText/AccordionText.scss +18 -10
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +31 -32
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +5 -5
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.scss +19 -18
- package/dist/Atomic/UI/Alert/Alert.js +5 -5
- package/dist/Atomic/UI/Alert/Alert.scss +21 -21
- package/dist/Atomic/UI/Arrow/Arrow.js +5 -5
- package/dist/Atomic/UI/Box/Box.js +10 -10
- package/dist/Atomic/UI/Box/Box.scss +2 -4
- package/dist/Atomic/UI/Button/Button.js +9 -9
- package/dist/Atomic/UI/Button/Button.scss +34 -34
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +4 -4
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.scss +1 -1
- package/dist/Atomic/UI/Chart/Chart.js +16 -16
- package/dist/Atomic/UI/Chart/Chart.scss +4 -4
- package/dist/Atomic/UI/Chart/partial/AnyOuterClass.scss +10 -14
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +30 -30
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +3 -3
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.scss +1 -1
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +15 -15
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +28 -28
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +2 -2
- package/dist/Atomic/UI/Chart/partial/utils.js +4 -4
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +9 -9
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.scss +7 -9
- package/dist/Atomic/UI/DateTime/DateTime.js +6 -6
- package/dist/Atomic/UI/DateTime/DateTime.scss +1 -1
- package/dist/Atomic/UI/DateTime/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +4 -4
- package/dist/Atomic/UI/DebugContainer/DebugContainer.scss +15 -9
- package/dist/Atomic/UI/DoubleString/DoubleString.js +6 -6
- package/dist/Atomic/UI/DoubleString/DoubleString.scss +11 -5
- package/dist/Atomic/UI/DoubleString/partial/AnyOuterClass.scss +4 -4
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +1 -1
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +48 -48
- package/dist/Atomic/UI/ExampleChartIntegration/partial/AnyOuterClass.scss +10 -15
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +18 -18
- package/dist/Atomic/UI/Hint/Hint.js +40 -41
- package/dist/Atomic/UI/Hint/Hint.scss +12 -11
- package/dist/Atomic/UI/Modal/Modal.js +28 -36
- package/dist/Atomic/UI/Modal/Modal.scss +42 -43
- package/dist/Atomic/UI/Modal/ModalHOC.js +2 -5
- package/dist/Atomic/UI/Modal/ModalMobile.scss +18 -11
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +2 -2
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +6 -6
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +8 -8
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +1 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.scss +5 -5
- package/dist/Atomic/UI/MonoAccordion/partial/AnyOuterClass.scss +4 -5
- package/dist/Atomic/UI/NavLine/NavLine.js +26 -26
- package/dist/Atomic/UI/NavLine/NavLine.scss +34 -36
- package/dist/Atomic/UI/NavLine/Tabs.js +38 -38
- package/dist/Atomic/UI/PageTitle/PageTitle.js +1 -1
- package/dist/Atomic/UI/PageTitle/PageTitle.scss +7 -7
- package/dist/Atomic/UI/PieChart/PieChart.js +4 -4
- package/dist/Atomic/UI/PieChart/PieChart.scss +21 -10
- package/dist/Atomic/UI/Price/Price.js +2 -2
- package/dist/Atomic/UI/PriceRange/PriceRange.js +2 -2
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +10 -10
- package/dist/Atomic/UI/ProgressLine/ProgressLine.scss +36 -40
- package/dist/Atomic/UI/Status/Status.js +6 -6
- package/dist/Atomic/UI/Status/Status.scss +19 -19
- package/dist/Atomic/UI/Table/Partials/TdCell.js +11 -11
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +3 -3
- package/dist/Atomic/UI/Table/Partials/TdRow.js +6 -6
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +1 -1
- package/dist/Atomic/UI/Table/Table.js +3 -3
- package/dist/Atomic/UI/Table/Table.scss +11 -13
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +8 -8
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +2 -2
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +1 -3
- package/dist/Atomic/UI/Table/TdTypes/TdTypes.scss +9 -8
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +10 -13
- package/dist/Atomic/UI/Tag/Tag.js +6 -6
- package/dist/Atomic/UI/Tag/Tag.scss +12 -11
- package/dist/Atomic/UI/TagList/TagList.js +8 -8
- package/dist/Atomic/UI/TagList/TagList.scss +1 -1
- package/dist/Atomic/UI/UserBox/UserBox.js +5 -5
- package/dist/Atomic/UI/UserBox/UserBox.scss +9 -9
- package/dist/Classes/AbortableFetch.js +35 -35
- package/dist/Classes/AnimatedHandler.js +3 -3
- package/dist/Classes/RESTAPI/index.js +9 -9
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +37 -37
- package/dist/Classes/RESTAPI/partials/ApiBase.js +7 -7
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +4 -4
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +4 -4
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +31 -31
- package/dist/Classes/RESTAPI/partials/Utils.js +15 -15
- package/dist/Classes/RESTAPI/partials/_utils.js +14 -14
- package/dist/Constants/index.constants.js +10 -10
- package/dist/Functions/Portal.js +1 -1
- package/dist/Functions/customEventListener.js +5 -5
- package/dist/Functions/fieldValueFormatters.js +66 -82
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +4 -4
- package/dist/Functions/locale/createTranslator.js +4 -15
- package/dist/Functions/operations.js +14 -14
- package/dist/Functions/presets/inputMaskPresets.js +34 -34
- package/dist/Functions/presets/inputPresets.js +3 -3
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +2 -2
- package/dist/Functions/schemas.js +8 -8
- package/dist/Functions/useBodyScrollLock.js +20 -0
- package/dist/Functions/useClickOutside.js +2 -2
- package/dist/Functions/useFieldFocus.js +3 -7
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +1 -1
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +11 -11
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +1 -1
- package/dist/Functions/useFormTools/functions/General.js +9 -9
- package/dist/Functions/useFormTools/functions/RenderFields.js +6 -6
- package/dist/Functions/useFormTools/index.js +18 -20
- package/dist/Functions/useInputHighlightError.js +5 -5
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +44 -0
- package/dist/Functions/useKeyPress/useKeyPress.js +38 -0
- package/dist/Functions/useLocalStorage.js +2 -13
- package/dist/Functions/useLocationParams.js +2 -2
- package/dist/Functions/useMetaInfo.js +7 -7
- package/dist/Functions/useMouseUpOutside.js +2 -2
- package/dist/Functions/useOnlineStatus.js +5 -14
- package/dist/Functions/usePasswordChecker.js +26 -26
- package/dist/Functions/usePrevious.js +0 -12
- package/dist/Functions/useResize.js +6 -24
- package/dist/Functions/useScrollTo.js +1 -1
- package/dist/Functions/useToggle.js +1 -1
- package/dist/Functions/utils.js +64 -143
- package/dist/Molecular/FormElement/FormElement.js +1 -1
- package/dist/Molecular/FormElement/FormElement.scss +4 -3
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +14 -14
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +2 -2
- package/dist/Molecular/InputAddress/InputAddress.js +47 -46
- package/dist/Molecular/InputAddress/InputAddress.scss +176 -112
- package/dist/Molecular/InputPassword/InputPassword.js +11 -15
- package/dist/Molecular/InputPassword/InputPassword.scss +8 -7
- package/dist/scss/_fonts.scss +60 -36
- package/dist/scss/_vars.scss +18 -18
- package/dist/scss/main.scss +4 -4
- package/package.json +1 -1
package/dist/Functions/utils.js
CHANGED
|
@@ -12,22 +12,22 @@ exports.transformDateOrTimeOrTogetherToFormattedLocal = transformDateOrTimeOrTog
|
|
|
12
12
|
exports.transformUTCHoursToLocal = transformUTCHoursToLocal;
|
|
13
13
|
exports.transformUTCTimeToLocal = transformUTCTimeToLocal;
|
|
14
14
|
exports.useOutsideToggle = void 0;
|
|
15
|
-
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
16
15
|
var _react = require("react");
|
|
16
|
+
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
17
17
|
var _index = require("../Constants/index.constants");
|
|
18
|
-
const getIsOnlyAnObject = input => typeof input ===
|
|
18
|
+
const getIsOnlyAnObject = input => typeof input === "object" && input instanceof Object && !Array.isArray(input);
|
|
19
19
|
|
|
20
20
|
/* eslint-disable guard-for-in, no-unused-vars */
|
|
21
21
|
exports.getIsOnlyAnObject = getIsOnlyAnObject;
|
|
22
22
|
const handleObjectChange = (updateObject, updateFunction) => function (data) {
|
|
23
|
-
let prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
23
|
+
let prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
24
24
|
let isNumber = arguments.length > 2 ? arguments[2] : undefined;
|
|
25
25
|
let value;
|
|
26
26
|
if (data !== null && data !== void 0 && data.target) {
|
|
27
|
-
value = data.target.type ===
|
|
27
|
+
value = data.target.type === "checkbox" ? data.target.checked : data.target.value;
|
|
28
28
|
} else value = data;
|
|
29
|
-
value = isNumber ?
|
|
30
|
-
const props = prop.split(
|
|
29
|
+
value = isNumber ? Number(value) : value;
|
|
30
|
+
const props = prop.split(".");
|
|
31
31
|
const currentObject = props.reduce((res, chapter, index) => {
|
|
32
32
|
if (props.length !== index + 1) res = res[chapter];
|
|
33
33
|
return res;
|
|
@@ -43,10 +43,10 @@ const useOutsideToggle = (ref, setOut, open) => {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
(0, _react.useEffect)(() => {
|
|
46
|
-
document.addEventListener(
|
|
46
|
+
document.addEventListener("mouseup", handleClickOutside);
|
|
47
47
|
return () => {
|
|
48
48
|
// Unbind the event listener on clean up
|
|
49
|
-
document.removeEventListener(
|
|
49
|
+
document.removeEventListener("mouseup", handleClickOutside);
|
|
50
50
|
};
|
|
51
51
|
}, [ref]);
|
|
52
52
|
};
|
|
@@ -59,29 +59,29 @@ const useOutsideToggle = (ref, setOut, open) => {
|
|
|
59
59
|
// ! Этот правильнее
|
|
60
60
|
exports.useOutsideToggle = useOutsideToggle;
|
|
61
61
|
const clone = input => {
|
|
62
|
-
if (input === null || typeof input !==
|
|
62
|
+
if (input === null || typeof input !== "object") return input;
|
|
63
63
|
const data = input instanceof Array ? [] : {};
|
|
64
64
|
for (const i in input) data[i] = clone(input[i]);
|
|
65
65
|
return data;
|
|
66
66
|
};
|
|
67
67
|
exports.clone = clone;
|
|
68
|
-
const getResponseClone = async res => await (typeof (res === null || res === void 0 ? void 0 : res.clone) ===
|
|
68
|
+
const getResponseClone = async res => await (typeof (res === null || res === void 0 ? void 0 : res.clone) === "function" ? res.clone() : clone(res));
|
|
69
69
|
|
|
70
70
|
//TimeUtils
|
|
71
71
|
exports.getResponseClone = getResponseClone;
|
|
72
72
|
function transformUTCTimeToLocal(date) {
|
|
73
|
-
let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
73
|
+
let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "YYYY-MM-DD HH:mm:ss";
|
|
74
74
|
if (!date) return;
|
|
75
75
|
const utcDate = _momentTimezone.default.utc(date).toDate();
|
|
76
76
|
return (0, _momentTimezone.default)(utcDate, format).local().format(format);
|
|
77
77
|
}
|
|
78
78
|
function transformUTCHoursToLocal(time) {
|
|
79
|
-
let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
79
|
+
let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "HH:mm:ss";
|
|
80
80
|
if (!time) return;
|
|
81
|
-
const splitedTime = time.split(
|
|
81
|
+
const splitedTime = time.split(":");
|
|
82
82
|
const offset = (0, _momentTimezone.default)().utcOffset();
|
|
83
|
-
let HH =
|
|
84
|
-
let mm =
|
|
83
|
+
let HH = Number(splitedTime[0]);
|
|
84
|
+
let mm = Number(splitedTime[1]);
|
|
85
85
|
const ss = splitedTime[2];
|
|
86
86
|
mm = mm + offset;
|
|
87
87
|
while (mm > 59) {
|
|
@@ -99,20 +99,20 @@ function transformUTCHoursToLocal(time) {
|
|
|
99
99
|
|
|
100
100
|
//? Намерянно значением по умолчанию назначаю самый информационно-маленький паттерн
|
|
101
101
|
function transformDateOrTimeOrTogetherToFormat(data) {
|
|
102
|
-
let outputFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
102
|
+
let outputFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "HH:mm";
|
|
103
103
|
let additional = arguments.length > 2 ? arguments[2] : undefined;
|
|
104
|
-
const ERROR_VALUE =
|
|
104
|
+
const ERROR_VALUE = "Invalid date";
|
|
105
105
|
const ERROR_MESSGE = "Invalid input data for ".concat(outputFormat, " format");
|
|
106
106
|
const {
|
|
107
107
|
parseFormat,
|
|
108
108
|
isReturnAsMomentInstance
|
|
109
109
|
} = getIsOnlyAnObject(additional) ? additional : {};
|
|
110
|
-
if (typeof data !==
|
|
111
|
-
return isReturnAsMomentInstance ? (0, _momentTimezone.default)(
|
|
110
|
+
if (typeof data !== "string" && typeof data !== "number") {
|
|
111
|
+
return isReturnAsMomentInstance ? (0, _momentTimezone.default)("error") : ERROR_MESSGE;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
//? Игнорируем parseFormat, если data пришла как timestamp или если parseFormat не строка
|
|
115
|
-
const momentArgs = [data, ...(!Number.isNaN(
|
|
115
|
+
const momentArgs = [data, ...(!Number.isNaN(Number(data)) || typeof parseFormat === "string" ? [] : [parseFormat])];
|
|
116
116
|
|
|
117
117
|
//? Задача получить moment-экземпляр, валидный либо невалидный
|
|
118
118
|
const momentInstance = (() => {
|
|
@@ -129,27 +129,27 @@ function transformDateOrTimeOrTogetherToFormat(data) {
|
|
|
129
129
|
//? Корректно обработаются паттерны: 'HH*mm', 'HH*mm*ss', 'HH*mm*ss*любое_количество_ms', где * - любой разделитель
|
|
130
130
|
else if (/^\d\d.\d\d/.test(data)) {
|
|
131
131
|
instance = (0, _momentTimezone.default)();
|
|
132
|
-
const symbols = data.split(
|
|
132
|
+
const symbols = data.split("");
|
|
133
133
|
const timeArr = symbols.reduce((acc, symbol, idx) => {
|
|
134
|
-
if (Number.isNaN(
|
|
134
|
+
if (Number.isNaN(Number(symbol))) {
|
|
135
135
|
if (acc.group) acc.result.push(acc.group);
|
|
136
|
-
acc.group =
|
|
136
|
+
acc.group = "";
|
|
137
137
|
} else acc.group = "".concat(acc.group).concat(symbol);
|
|
138
138
|
if (idx === symbols.length - 1 && acc.group) acc.result.push(acc.group);
|
|
139
139
|
return acc;
|
|
140
140
|
}, {
|
|
141
141
|
result: [],
|
|
142
|
-
group:
|
|
142
|
+
group: ""
|
|
143
143
|
})
|
|
144
144
|
//? reverse используется исключительно для того, чтобы после можно было использовать метод pop, а не shift,
|
|
145
145
|
//? т.к. методы добавления/извлечения относительно конца массива работают быстрее,
|
|
146
146
|
//? чем аналогичные относительно начала массива
|
|
147
147
|
.result.reverse();
|
|
148
|
-
instance.hours(
|
|
149
|
-
instance.minutes(
|
|
150
|
-
instance.seconds(timeArr.length ?
|
|
151
|
-
instance.milliseconds(timeArr.length ?
|
|
152
|
-
} else instance = (0, _momentTimezone.default)(
|
|
148
|
+
instance.hours(Number(timeArr.pop()));
|
|
149
|
+
instance.minutes(Number(timeArr.pop()));
|
|
150
|
+
instance.seconds(timeArr.length ? Number(timeArr.pop()) : 0);
|
|
151
|
+
instance.milliseconds(timeArr.length ? Number(timeArr.pop()) : 0);
|
|
152
|
+
} else instance = (0, _momentTimezone.default)("error"); //? Иначе создаем заведомо невалидный moment-экземпляр
|
|
153
153
|
|
|
154
154
|
return instance;
|
|
155
155
|
})();
|
|
@@ -160,19 +160,19 @@ function transformDateOrTimeOrTogetherToFormat(data) {
|
|
|
160
160
|
|
|
161
161
|
//? Намерянно значением по умолчанию назначаю самый информационно-маленький паттерн
|
|
162
162
|
function transformDateOrTimeOrTogetherToFormattedLocal(data) {
|
|
163
|
-
let outputFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
163
|
+
let outputFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "HH:mm";
|
|
164
164
|
let additional = arguments.length > 2 ? arguments[2] : undefined;
|
|
165
|
-
const ERROR_VALUE =
|
|
165
|
+
const ERROR_VALUE = "Invalid date";
|
|
166
166
|
const ERROR_MESSGE = "Invalid input data for ".concat(outputFormat, " format");
|
|
167
167
|
if (additional && !getIsOnlyAnObject(additional)) {
|
|
168
|
-
throw new Error(
|
|
168
|
+
throw new Error("Bad additional [transformDateOrTimeOrTogetherToFormattedLocal]");
|
|
169
169
|
}
|
|
170
170
|
const compositeAdditional = {
|
|
171
171
|
...(additional || {}),
|
|
172
172
|
isReturnAsMomentInstance: true
|
|
173
173
|
};
|
|
174
174
|
const date = transformDateOrTimeOrTogetherToFormat(data, outputFormat, compositeAdditional);
|
|
175
|
-
const dateWithLocale = date.add((0, _momentTimezone.default)().utcOffset(),
|
|
175
|
+
const dateWithLocale = date.add((0, _momentTimezone.default)().utcOffset(), "minutes");
|
|
176
176
|
const output = dateWithLocale.format(outputFormat);
|
|
177
177
|
return output === ERROR_VALUE ? ERROR_MESSGE : output;
|
|
178
178
|
}
|
|
@@ -192,8 +192,8 @@ const omitKeys = function () {
|
|
|
192
192
|
};
|
|
193
193
|
exports.omitKeys = omitKeys;
|
|
194
194
|
const logout = () => {
|
|
195
|
-
window.localStorage.removeItem(
|
|
196
|
-
window.localStorage.removeItem(
|
|
195
|
+
window.localStorage.removeItem("accessToken");
|
|
196
|
+
window.localStorage.removeItem("tokenExpires");
|
|
197
197
|
window.location.reload();
|
|
198
198
|
};
|
|
199
199
|
exports.logout = logout;
|
|
@@ -204,12 +204,12 @@ const getStyles = (el, prop) => {
|
|
|
204
204
|
};
|
|
205
205
|
exports.getStyles = getStyles;
|
|
206
206
|
const getColorById = (id, colors) => {
|
|
207
|
-
if (!id) return
|
|
207
|
+
if (!id) return "#FF7D00";
|
|
208
208
|
const idToArr = Array.from(id);
|
|
209
209
|
const colorsArr = colors && colors.length > 0 ? colors : _index.DEFAULT_COLORS;
|
|
210
210
|
let number = idToArr.reduce((acc, item) => {
|
|
211
211
|
if (Number(item)) {
|
|
212
|
-
return acc +
|
|
212
|
+
return acc + Number(item);
|
|
213
213
|
}
|
|
214
214
|
return acc;
|
|
215
215
|
}, 0);
|
|
@@ -248,34 +248,34 @@ exports.throttle = throttle;
|
|
|
248
248
|
const addBitDepthPoints = function (value) {
|
|
249
249
|
let step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
|
|
250
250
|
//содержит ли value точку
|
|
251
|
-
const isFraction = value === null || value === void 0 ? void 0 : value.includes(
|
|
251
|
+
const isFraction = value === null || value === void 0 ? void 0 : value.includes(".");
|
|
252
252
|
|
|
253
253
|
//взять строку до точки
|
|
254
|
-
const valueBeforeDot = isFraction ? value === null || value === void 0 ? void 0 : value.slice(0, value === null || value === void 0 ? void 0 : value.indexOf(
|
|
254
|
+
const valueBeforeDot = isFraction ? value === null || value === void 0 ? void 0 : value.slice(0, value === null || value === void 0 ? void 0 : value.indexOf(".")) : value;
|
|
255
255
|
|
|
256
256
|
//расстановка запятых после каждой 3й цифры с конца
|
|
257
|
-
const intPart = valueBeforeDot.split(
|
|
258
|
-
return isFraction ? intPart + (value === null || value === void 0 ? void 0 : value.slice(value === null || value === void 0 ? void 0 : value.indexOf(
|
|
257
|
+
const intPart = valueBeforeDot.split("").reverse().reduce((acc, item, idx) => idx % step === 0 && idx !== 0 ? [...acc, ",", item] : [...acc, item], []).reverse().join("");
|
|
258
|
+
return isFraction ? intPart + (value === null || value === void 0 ? void 0 : value.slice(value === null || value === void 0 ? void 0 : value.indexOf("."))) : intPart;
|
|
259
259
|
};
|
|
260
260
|
exports.addBitDepthPoints = addBitDepthPoints;
|
|
261
261
|
const changeMeta = function (key) {
|
|
262
262
|
let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
263
|
-
const defaultMeta = items.find(i => i.key ===
|
|
263
|
+
const defaultMeta = items.find(i => i.key === "default");
|
|
264
264
|
if (key) {
|
|
265
265
|
var _item$title, _item$description;
|
|
266
266
|
const item = items.find(i => i.key === key);
|
|
267
267
|
document.title = (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : defaultMeta === null || defaultMeta === void 0 ? void 0 : defaultMeta.title;
|
|
268
|
-
document.querySelector('meta[name="description"]').setAttribute(
|
|
268
|
+
document.querySelector('meta[name="description"]').setAttribute("content", (_item$description = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description !== void 0 ? _item$description : defaultMeta === null || defaultMeta === void 0 ? void 0 : defaultMeta.description);
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
exports.changeMeta = changeMeta;
|
|
272
|
-
const firstLetterCapital = str => typeof str ===
|
|
272
|
+
const firstLetterCapital = str => typeof str === "string" ? "".concat(str.charAt(0).toUpperCase()).concat(str.slice(1)) : str;
|
|
273
273
|
exports.firstLetterCapital = firstLetterCapital;
|
|
274
274
|
const capitalized = exports.capitalized = firstLetterCapital;
|
|
275
|
-
const checkedRef = ref => ref ? typeof ref ===
|
|
275
|
+
const checkedRef = ref => ref ? typeof ref === "function" ? node => ref(node) : ref : null;
|
|
276
276
|
exports.checkedRef = checkedRef;
|
|
277
277
|
function downloadEmulation(data, filename) {
|
|
278
|
-
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
278
|
+
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "image/*";
|
|
279
279
|
const file = new Blob([data], {
|
|
280
280
|
type
|
|
281
281
|
});
|
|
@@ -283,7 +283,7 @@ function downloadEmulation(data, filename) {
|
|
|
283
283
|
// IE10+
|
|
284
284
|
window.navigator.msSaveOrOpenBlob(file, filename);else {
|
|
285
285
|
// Others
|
|
286
|
-
const a = document.createElement(
|
|
286
|
+
const a = document.createElement("a"),
|
|
287
287
|
url = URL.createObjectURL(file);
|
|
288
288
|
a.href = url;
|
|
289
289
|
a.download = filename;
|
|
@@ -303,7 +303,7 @@ const downloadFile = async _ref => {
|
|
|
303
303
|
} = _ref;
|
|
304
304
|
const response = await fetch(url).then(async res => ({
|
|
305
305
|
data: await res.blob(),
|
|
306
|
-
type: type !== null && type !== void 0 ? type : res.headers.get(
|
|
306
|
+
type: type !== null && type !== void 0 ? type : res.headers.get("content-type")
|
|
307
307
|
}));
|
|
308
308
|
downloadEmulation(response.data, name, response.type);
|
|
309
309
|
};
|
|
@@ -311,7 +311,7 @@ exports.downloadFile = downloadFile;
|
|
|
311
311
|
const compare = function (a, b) {
|
|
312
312
|
var _a$sort, _b$sort, _Object$entries$sort, _Object$entries, _Object$entries$sort2, _Object$entries2;
|
|
313
313
|
let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
314
|
-
if (Array.isArray(a), Array.isArray(b)) return JSON.stringify(a === null || a === void 0 || (_a$sort = a.sort) === null || _a$sort === void 0 ? void 0 : _a$sort.call(a)) === JSON.stringify(b === null || b === void 0 || (_b$sort = b.sort) === null || _b$sort === void 0 ? void 0 : _b$sort.call(b));else if (Array.isArray(a) || Array.isArray(b)) throw new Error(
|
|
314
|
+
if (Array.isArray(a), Array.isArray(b)) return JSON.stringify(a === null || a === void 0 || (_a$sort = a.sort) === null || _a$sort === void 0 ? void 0 : _a$sort.call(a)) === JSON.stringify(b === null || b === void 0 || (_b$sort = b.sort) === null || _b$sort === void 0 ? void 0 : _b$sort.call(b));else if (Array.isArray(a) || Array.isArray(b)) throw new Error("Different types detected!");
|
|
315
315
|
return JSON.stringify((_Object$entries$sort = (_Object$entries = Object.entries(omitKeys(a, keys))).sort) === null || _Object$entries$sort === void 0 ? void 0 : _Object$entries$sort.call(_Object$entries)) === JSON.stringify((_Object$entries$sort2 = (_Object$entries2 = Object.entries(omitKeys(b, keys))).sort) === null || _Object$entries$sort2 === void 0 ? void 0 : _Object$entries$sort2.call(_Object$entries2));
|
|
316
316
|
};
|
|
317
317
|
|
|
@@ -320,31 +320,17 @@ exports.compare = compare;
|
|
|
320
320
|
const setCarretToEnd = input => {
|
|
321
321
|
setTimeout(() => {
|
|
322
322
|
const tmp = input.value;
|
|
323
|
-
input.value =
|
|
323
|
+
input.value = "";
|
|
324
324
|
input.value = tmp;
|
|
325
325
|
}, 10);
|
|
326
326
|
};
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* "Sort an array of objects by a given key, alphabetically."
|
|
330
|
-
*
|
|
331
|
-
* The function takes three parameters:
|
|
332
|
-
*
|
|
333
|
-
* - `a`: The first item to compare.
|
|
334
|
-
* - `b`: The second item to compare.
|
|
335
|
-
* - `key`: The key to compare by
|
|
336
|
-
* @param a - The first item to compare
|
|
337
|
-
* @param b - The second item to compare
|
|
338
|
-
* @param [key=label] - The key to sort by.
|
|
339
|
-
* @returns A function that takes in 3 parameters, a, b, and key.
|
|
340
|
-
*/
|
|
341
327
|
exports.setCarretToEnd = setCarretToEnd;
|
|
342
328
|
const compareAlphabetical = function (a, b) {
|
|
343
329
|
var _item, _item2;
|
|
344
|
-
let key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
330
|
+
let key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "label";
|
|
345
331
|
let item1 = a === null || a === void 0 ? void 0 : a[key];
|
|
346
332
|
let item2 = b === null || b === void 0 ? void 0 : b[key];
|
|
347
|
-
if (typeof item1 !==
|
|
333
|
+
if (typeof item1 !== "string" || typeof item2 !== "string") return 0;
|
|
348
334
|
item1 = (_item = item1) === null || _item === void 0 ? void 0 : _item.toLowerCase();
|
|
349
335
|
item2 = (_item2 = item2) === null || _item2 === void 0 ? void 0 : _item2.toLowerCase();
|
|
350
336
|
if (item1 < item2) {
|
|
@@ -359,49 +345,42 @@ exports.compareAlphabetical = compareAlphabetical;
|
|
|
359
345
|
const getBase64 = file => {
|
|
360
346
|
if (file) {
|
|
361
347
|
return new Promise(function (resolve, reject) {
|
|
362
|
-
|
|
348
|
+
const reader = new FileReader();
|
|
363
349
|
reader.readAsDataURL(file);
|
|
364
350
|
reader.onload = () => resolve(reader.result);
|
|
365
|
-
reader.onerror = error => reject(
|
|
351
|
+
reader.onerror = error => reject("Error: ", error);
|
|
366
352
|
});
|
|
367
353
|
}
|
|
368
354
|
};
|
|
369
355
|
exports.getBase64 = getBase64;
|
|
370
356
|
const renderFileSize = function (bytes) {
|
|
371
357
|
let decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
372
|
-
if (
|
|
358
|
+
if (!Number(bytes)) return "0 Bytes";
|
|
373
359
|
const k = 1024;
|
|
374
360
|
const dm = decimals < 0 ? 0 : decimals;
|
|
375
|
-
const sizes = [
|
|
361
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
376
362
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
377
363
|
return "".concat(parseFloat((bytes / Math.pow(k, i)).toFixed(dm)), " ").concat(sizes[i]);
|
|
378
364
|
};
|
|
379
365
|
exports.renderFileSize = renderFileSize;
|
|
380
366
|
const getUniqueFileExtensions = extListString => {
|
|
381
367
|
// Split the extensions list into an array
|
|
382
|
-
const extArray = extListString === null || extListString === void 0 ? void 0 : extListString.split(
|
|
368
|
+
const extArray = extListString === null || extListString === void 0 ? void 0 : extListString.split(",").map(ext => ext.trim().toUpperCase());
|
|
383
369
|
|
|
384
370
|
// Remove duplicates using a Set
|
|
385
371
|
const uniqueExts = [...new Set(extArray)];
|
|
386
372
|
|
|
387
373
|
// Join the unique extensions into a string
|
|
388
|
-
return uniqueExts.join(
|
|
374
|
+
return uniqueExts.join(", ");
|
|
389
375
|
};
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* If the platform is one of the macOS platforms, return macOS. If the platform is one of the iOS
|
|
393
|
-
* platforms, return iOS. If the platform is one of the Windows platforms, return Windows. If the user
|
|
394
|
-
* agent contains Android, return Android. If the platform contains Linux, return Linux. Otherwise,
|
|
395
|
-
* return Unknown
|
|
396
|
-
*/
|
|
397
376
|
exports.getUniqueFileExtensions = getUniqueFileExtensions;
|
|
398
377
|
const getOS = () => {
|
|
399
378
|
var _window$navigator;
|
|
400
|
-
|
|
379
|
+
let userAgent = window.navigator.userAgent,
|
|
401
380
|
platform = ((_window$navigator = window.navigator) === null || _window$navigator === void 0 || (_window$navigator = _window$navigator.userAgentData) === null || _window$navigator === void 0 ? void 0 : _window$navigator.platform) || window.navigator.platform,
|
|
402
|
-
macosPlatforms = [
|
|
403
|
-
windowsPlatforms = [
|
|
404
|
-
iosPlatforms = [
|
|
381
|
+
macosPlatforms = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"],
|
|
382
|
+
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"],
|
|
383
|
+
iosPlatforms = ["iPhone", "iPad", "iPod"],
|
|
405
384
|
os = _index.OS.Unknown;
|
|
406
385
|
if (macosPlatforms.indexOf(platform) !== -1) {
|
|
407
386
|
os = _index.OS.MacOS;
|
|
@@ -416,11 +395,6 @@ const getOS = () => {
|
|
|
416
395
|
}
|
|
417
396
|
return os;
|
|
418
397
|
};
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* It prevents the default behavior of an event and stops the event from bubbling up the DOM tree.
|
|
422
|
-
* @param e - The event object
|
|
423
|
-
*/
|
|
424
398
|
exports.getOS = getOS;
|
|
425
399
|
const disableDefaultBehavior = e => {
|
|
426
400
|
e === null || e === void 0 || e.preventDefault();
|
|
@@ -433,64 +407,11 @@ String.prototype.longerThan = function (compareWith) {
|
|
|
433
407
|
String.prototype.lastIndexEqualsTo = function (index) {
|
|
434
408
|
return (this === null || this === void 0 ? void 0 : this.length) - 1 === index;
|
|
435
409
|
};
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* It checks if the dependencies are satisfied, and if they are, it returns the dependend function.
|
|
439
|
-
* Otherwise, it returns an empty function
|
|
440
|
-
* @param dependendFunction - The function that will be called if the dependencies are satisfied.
|
|
441
|
-
* @param [dependencies] - It is an array of dependencies.
|
|
442
|
-
* @returns A function that will return the result of `dependendFunction` if `isDependenciesSatisfied`
|
|
443
|
-
* is true. Otherwise, it will return a function that will return nothing.
|
|
444
|
-
*/
|
|
445
|
-
|
|
446
|
-
// -- FEATURE -- //
|
|
447
|
-
// export const getDependendFunction = (dependendFunction, dependencies = []) => {
|
|
448
|
-
// /* It checks if `Dependencies` is an array. If it is not, it throws an exception and returns false. */
|
|
449
|
-
// if (!Array.isArray(dependencies)) {
|
|
450
|
-
// throw new Error('Dependencies must be an Array');
|
|
451
|
-
// return false;
|
|
452
|
-
// }
|
|
453
|
-
|
|
454
|
-
// const compareItem = (item) => {
|
|
455
|
-
// let [valueToCompare, compareWith] = item;
|
|
456
|
-
|
|
457
|
-
// /* If `valueToCompare` is a function, it will call it and assign the result to `valueToCompare`.
|
|
458
|
-
// Otherwise, it will just assign `valueToCompare` to `valueToCompare`. */
|
|
459
|
-
// valueToCompare = typeof valueToCompare === 'function' ? valueToCompare() : valueToCompare;
|
|
460
|
-
|
|
461
|
-
// if (Array.isArray(compareWith)) {
|
|
462
|
-
// return compareWith.reduce((isDependenciesItemSatisfied, compareWithItem) => {
|
|
463
|
-
// if (!isDependenciesItemSatisfied) return false;
|
|
464
|
-
|
|
465
|
-
// return (typeof compareWithItem === 'function' ? compareWithItem() === valueToCompare : compareWithItem === valueToCompare);
|
|
466
|
-
// }, true);
|
|
467
|
-
// } else {
|
|
468
|
-
// compareWith = typeof compareWith === 'function' ? compareWith() : compareWith;
|
|
469
|
-
// return (valueToCompare === compareWith);
|
|
470
|
-
// }
|
|
471
|
-
// }
|
|
472
|
-
|
|
473
|
-
// // Check Dependencies
|
|
474
|
-
// const isDependenciesSatisfied = dependencies.length === 2 && !Array.isArray(dependencies[0]) ? compareItem(dependencies) : dependencies?.reduce((isDependenciesSatisfied, item, i, dependenciesArr) => {
|
|
475
|
-
// if (!isDependenciesSatisfied) return false;
|
|
476
|
-
|
|
477
|
-
// /* It checks if `Dependencies Item` is an array. If it is not, it throws an exception and returns false. */
|
|
478
|
-
// if (!Array.isArray(item)) {
|
|
479
|
-
// throw new Error('Dependencies Item must be an Array');
|
|
480
|
-
// return false;
|
|
481
|
-
// }
|
|
482
|
-
|
|
483
|
-
// return compareItem(item);
|
|
484
|
-
// }, true);
|
|
485
|
-
|
|
486
|
-
// return isDependenciesSatisfied ? dependendFunction : () => {};
|
|
487
|
-
// };
|
|
488
|
-
|
|
489
410
|
const getCorrectTestId = _ref2 => {
|
|
490
411
|
let {
|
|
491
|
-
testId =
|
|
412
|
+
testId = "",
|
|
492
413
|
withTier = true
|
|
493
414
|
} = _ref2;
|
|
494
|
-
return testId && testId !== undefined ? "".concat(withTier ?
|
|
415
|
+
return testId && testId !== undefined ? "".concat(withTier ? "-" : "").concat(testId) : "";
|
|
495
416
|
};
|
|
496
417
|
exports.getCorrectTestId = getCorrectTestId;
|
|
@@ -11,7 +11,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
var _Label = _interopRequireDefault(require("../../Atomic/FormElements/Label/Label"));
|
|
12
12
|
var _Alert = _interopRequireDefault(require("./../../Atomic/UI/Alert/Alert"));
|
|
13
13
|
require("./FormElement.scss");
|
|
14
|
-
const RC =
|
|
14
|
+
const RC = "form-element";
|
|
15
15
|
const FormElement = _ref => {
|
|
16
16
|
let {
|
|
17
17
|
label,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
&__alert {
|
|
5
5
|
margin-top: 5px;
|
|
6
|
+
|
|
6
7
|
border-left: none;
|
|
7
8
|
border-radius: 5px;
|
|
8
9
|
}
|
|
@@ -14,12 +15,12 @@
|
|
|
14
15
|
display: block;
|
|
15
16
|
|
|
16
17
|
margin-top: 2px;
|
|
18
|
+
margin-bottom: -15px;
|
|
17
19
|
margin-left: 1px;
|
|
18
20
|
|
|
19
|
-
color: #F06D8D;
|
|
20
|
-
|
|
21
21
|
font-size: 10px;
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
color: #f06d8d;
|
|
23
24
|
|
|
24
25
|
&--with-alert {
|
|
25
26
|
margin-bottom: 0;
|
|
@@ -8,8 +8,8 @@ exports.default = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _utils = require("../../Functions/utils");
|
|
12
11
|
var _useFormFieldsChangesManager = _interopRequireDefault(require("../../Functions/hooks/useFormFieldsChangesManager"));
|
|
12
|
+
var _utils = require("../../Functions/utils");
|
|
13
13
|
var _utils2 = require("./partials/_utils");
|
|
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; }
|
|
@@ -17,7 +17,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
17
17
|
|
|
18
18
|
// local functions
|
|
19
19
|
|
|
20
|
-
const RC =
|
|
20
|
+
const RC = "form-with-depend-on";
|
|
21
21
|
const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
22
22
|
let {
|
|
23
23
|
form,
|
|
@@ -29,12 +29,12 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
29
29
|
className,
|
|
30
30
|
isInitializeByDependOn,
|
|
31
31
|
isFormDisabled,
|
|
32
|
-
typeOfUse =
|
|
32
|
+
typeOfUse = "default"
|
|
33
33
|
} = _ref;
|
|
34
34
|
// ? Прихраниваем состояние формы на момент входа
|
|
35
35
|
const [initialForm] = (0, _react.useState)((0, _utils.clone)(form));
|
|
36
|
-
const safelySetForm = typeof setForm ===
|
|
37
|
-
const safelyOnChange = typeof onChange ===
|
|
36
|
+
const safelySetForm = typeof setForm === "function" ? setForm : () => {};
|
|
37
|
+
const safelyOnChange = typeof onChange === "function" ? onChange : () => {};
|
|
38
38
|
const {
|
|
39
39
|
assignChangesToField
|
|
40
40
|
} = (0, _useFormFieldsChangesManager.default)({
|
|
@@ -45,7 +45,7 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
45
45
|
|
|
46
46
|
// ***** handlers *****
|
|
47
47
|
|
|
48
|
-
const anotherActions = typeof getAnotherActions ===
|
|
48
|
+
const anotherActions = typeof getAnotherActions === "function" ? getAnotherActions({
|
|
49
49
|
setForm,
|
|
50
50
|
assign
|
|
51
51
|
}) : {};
|
|
@@ -75,11 +75,11 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
75
75
|
|
|
76
76
|
// ? Защита от дублирующих вызовов onChange снизу
|
|
77
77
|
// ? "Если newValue такое же как уже есть и нет флага "применять изменения всегда""
|
|
78
|
-
// ! (*) - Важно !
|
|
78
|
+
// ! (*) - Важно !
|
|
79
79
|
// ! Отключайте прямую мутацию на уровне проектного FormItem (в каждом филде указать isNotUseInnerHandler: true)
|
|
80
80
|
// ! т.к. тот хендлер запускатся раньше и сюда филд доходит с измененным значением,
|
|
81
81
|
// ! а значит не пройдет эту if-ку
|
|
82
|
-
if (currField[propKey ||
|
|
82
|
+
if (currField[propKey || "value"] === newValue && !isMakeChangesAnyway) return;
|
|
83
83
|
|
|
84
84
|
// ? Сразу же мутируем
|
|
85
85
|
safelyOnChange(newValue, fieldKey, propKey, additionalOfOnChange);
|
|
@@ -97,7 +97,7 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
// ? Если в объекте методов возвращаемом getAnotherActions есть метод all, то он запускается отдельно
|
|
100
|
-
if (typeof anotherActions.all ===
|
|
100
|
+
if (typeof anotherActions.all === "function") {
|
|
101
101
|
anotherActions.all({
|
|
102
102
|
newValue,
|
|
103
103
|
fieldKey,
|
|
@@ -107,8 +107,8 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
107
107
|
additional: getMainOfAdditional(handleChange, additionalOfOnChange)
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
if (fieldKey in anotherActions && typeof anotherActions[fieldKey] ===
|
|
111
|
-
|
|
110
|
+
if (fieldKey in anotherActions && typeof anotherActions[fieldKey] === "function") {
|
|
111
|
+
const postChanges = anotherActions[fieldKey]({
|
|
112
112
|
newValue,
|
|
113
113
|
fieldKey,
|
|
114
114
|
propKey,
|
|
@@ -123,7 +123,7 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
123
123
|
// ***** useEffects *****
|
|
124
124
|
|
|
125
125
|
(0, _react.useEffect)(() => {
|
|
126
|
-
if (isInitializeByDependOn && typeof setForm ===
|
|
126
|
+
if (isInitializeByDependOn && typeof setForm === "function" && typeof onChange === "function") form.forEach(field => {
|
|
127
127
|
startDependOn({
|
|
128
128
|
newValue: field.value,
|
|
129
129
|
fieldKey: field.key,
|
|
@@ -145,11 +145,11 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
145
145
|
id: formId
|
|
146
146
|
} : {}, {
|
|
147
147
|
className: (0, _classnames.default)(RC, className)
|
|
148
|
-
}), typeof renderField ===
|
|
148
|
+
}), typeof renderField === "function" ? form.map(field => renderField({
|
|
149
149
|
...getMainOfAdditional(handleChange),
|
|
150
150
|
field: {
|
|
151
151
|
...field,
|
|
152
|
-
disabled:
|
|
152
|
+
disabled: Boolean(isFormDisabled || field.disabled)
|
|
153
153
|
}
|
|
154
154
|
})) : null);
|
|
155
155
|
});
|
|
@@ -45,9 +45,9 @@ const getDependOnStarter = props => {
|
|
|
45
45
|
new Promise(resolve => {
|
|
46
46
|
resolve(execute === null || execute === void 0 ? void 0 : execute({
|
|
47
47
|
...field,
|
|
48
|
-
[propKey ||
|
|
48
|
+
[propKey || "value"]: newValue,
|
|
49
49
|
...(!isNotResetErrors ? {
|
|
50
|
-
error:
|
|
50
|
+
error: ""
|
|
51
51
|
} : {})
|
|
52
52
|
}, dependField, form, additional));
|
|
53
53
|
}).then(changes => {
|