intelicoreact 1.6.20 → 1.6.21
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 -102
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +1 -89
- package/dist/Atomic/FormElements/Calendar/Calendar.js +1 -232
- package/dist/Atomic/FormElements/Calendar/Calendar.props.js +1 -3
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +1 -101
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +1 -70
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +1 -350
- package/dist/Atomic/FormElements/Datepicker/Datepicker.props.js +1 -3
- package/dist/Atomic/FormElements/Datepicker/components/DatepickerCalendar.js +1 -177
- package/dist/Atomic/FormElements/Datepicker/components/DatepickerCalendar.props.js +1 -3
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +1 -561
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +1 -20
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +1 -405
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +1 -94
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +1 -105
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +1 -67
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +1 -247
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +1 -160
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +1 -193
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +1 -135
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +1 -116
- package/dist/Atomic/FormElements/Input/Input.js +1 -467
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +1 -161
- package/dist/Atomic/FormElements/InputColor/InputColor.js +1 -64
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +1 -166
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +1 -354
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +1 -71
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +1 -693
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +1 -254
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +1 -32
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +1 -200
- package/dist/Atomic/FormElements/InputLink/InputLink.js +1 -99
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +1 -37
- package/dist/Atomic/FormElements/InputMask/InputMask.js +1 -1214
- package/dist/Atomic/FormElements/InputMask/config.js +1 -15
- package/dist/Atomic/FormElements/InputMask/functions.js +1 -58
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +1 -674
- package/dist/Atomic/FormElements/InputMask2/config.js +1 -15
- package/dist/Atomic/FormElements/InputMask2/functions.js +1 -58
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +1 -766
- package/dist/Atomic/FormElements/InputMask3/config.js +1 -15
- package/dist/Atomic/FormElements/InputMask3/functions.js +1 -58
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +1 -114
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +1 -140
- package/dist/Atomic/FormElements/Label/Label.js +1 -82
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +1 -506
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +1 -45
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +1 -331
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +1 -66
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +1 -80
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +1 -64
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +1 -54
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +1 -183
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +1 -209
- package/dist/Atomic/FormElements/RangeList/RangeList.js +1 -175
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +1 -43
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +1 -443
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +1 -858
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +1 -39
- package/dist/Atomic/FormElements/Switcher/Switcher.js +1 -59
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +1 -50
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +1 -47
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +1 -96
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +1 -40
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +1 -64
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +1 -170
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +1 -202
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +1 -67
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +1 -115
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1 -826
- package/dist/Atomic/FormElements/Text/Text.js +1 -125
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +1 -45
- package/dist/Atomic/FormElements/Textarea/Textarea.js +1 -80
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +1 -176
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +1 -62
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +1 -127
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +1 -220
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +1 -83
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +1 -82
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +1 -101
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +1 -29
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +1 -113
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +1 -30
- package/dist/Atomic/Layout/Header/Header.js +1 -85
- package/dist/Atomic/Layout/Spinner/Spinner.js +1 -39
- package/dist/Atomic/UI/Accordion/Accordion.js +1 -118
- package/dist/Atomic/UI/Accordion/AccordionItem.js +1 -181
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +1 -238
- package/dist/Atomic/UI/AccordionText/AccordionText.js +1 -69
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +1 -207
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +1 -56
- package/dist/Atomic/UI/Alert/Alert.js +1 -72
- package/dist/Atomic/UI/Arrow/Arrow.js +1 -132
- package/dist/Atomic/UI/Box/Box.js +1 -52
- package/dist/Atomic/UI/Button/Button.js +1 -89
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +1 -72
- package/dist/Atomic/UI/Chart/Chart.js +1 -172
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +1 -95
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +1 -80
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +1 -188
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +1 -335
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +1 -43
- package/dist/Atomic/UI/Chart/partial/utils.js +1 -60
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +1 -109
- package/dist/Atomic/UI/DateTime/DateTime.js +1 -57
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +1 -44
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +1 -15
- package/dist/Atomic/UI/DoubleString/DoubleString.js +1 -102
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +1 -226
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +1 -221
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +1 -106
- package/dist/Atomic/UI/Hint/Hint.js +1 -193
- package/dist/Atomic/UI/Hint/partials/_utils.js +1 -51
- package/dist/Atomic/UI/Modal/Modal.js +1 -188
- package/dist/Atomic/UI/Modal/ModalHOC.js +1 -72
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +1 -46
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +1 -83
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +1 -200
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.js +1 -75
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +1 -80
- package/dist/Atomic/UI/NavLine/NavLine.js +1 -293
- package/dist/Atomic/UI/PageTitle/PageTitle.js +1 -75
- package/dist/Atomic/UI/PieChart/PieChart.js +1 -42
- package/dist/Atomic/UI/Price/Price.js +1 -22
- package/dist/Atomic/UI/PriceRange/PriceRange.js +1 -36
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +1 -71
- package/dist/Atomic/UI/Status/Status.js +1 -59
- package/dist/Atomic/UI/Table/Partials/TdCell.js +1 -87
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +1 -38
- package/dist/Atomic/UI/Table/Partials/TdRow.js +1 -99
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +1 -52
- package/dist/Atomic/UI/Table/Table.js +1 -63
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +1 -80
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +1 -28
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +1 -13
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +1 -53
- package/dist/Atomic/UI/Tag/Tag.js +1 -160
- package/dist/Atomic/UI/TagList/TagList.js +1 -251
- package/dist/Atomic/UI/UserBox/UserBox.js +1 -73
- package/dist/Atomic/UI/WizardStepper/constructor.js +1 -84
- package/dist/Atomic/UI/WizardStepper/index.js +1 -3
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +1 -37
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +1 -3
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +1 -61
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +1 -3
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +1 -39
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +1 -3
- package/dist/Atomic/UI/WizardStepper/ui/icons.js +1 -49
- package/dist/Atomic/UI/WizardStepper/ui/index.js +1 -3
- package/dist/Classes/AbortableFetch.js +1 -454
- package/dist/Classes/AnimatedHandler.js +1 -47
- package/dist/Classes/RESTAPI/index.js +1 -228
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +1 -457
- package/dist/Classes/RESTAPI/partials/ApiBase.js +1 -48
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +1 -112
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +1 -189
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +1 -252
- package/dist/Classes/RESTAPI/partials/Utils.js +1 -92
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +1 -3
- package/dist/Classes/RESTAPI/partials/_utils.js +1 -197
- package/dist/Constants/index.constants.js +1 -78
- package/dist/Functions/Portal.js +1 -22
- package/dist/Functions/customEventListener.js +1 -96
- package/dist/Functions/dateTime.js +1 -149
- package/dist/Functions/fieldValueFormatters.js +1 -405
- package/dist/Functions/guards/assertions.js +1 -66
- package/dist/Functions/guards/safeValue.js +1 -30
- package/dist/Functions/guards/typeGuards.js +1 -116
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +1 -95
- package/dist/Functions/locale/createTranslator.js +1 -32
- package/dist/Functions/operations.js +1 -130
- package/dist/Functions/presets/inputMaskPresets.js +1 -170
- package/dist/Functions/presets/inputPresets.js +1 -60
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +1 -45
- package/dist/Functions/schemas.js +1 -31
- package/dist/Functions/useBodyScrollLock.js +1 -17
- package/dist/Functions/useClickOutside.js +1 -15
- package/dist/Functions/useDebounce.js +1 -17
- package/dist/Functions/useFieldFocus.js +1 -84
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +1 -39
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +1 -159
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +1 -78
- package/dist/Functions/useFormTools/functions/General.js +1 -134
- package/dist/Functions/useFormTools/functions/RenderFields.js +1 -111
- package/dist/Functions/useFormTools/functions/usePrevious.js +1 -12
- package/dist/Functions/useFormTools/index.js +1 -778
- package/dist/Functions/useInputHighlightError.js +1 -67
- package/dist/Functions/useIsMobile/useIsMobile.js +1 -53
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +1 -21
- package/dist/Functions/useKeyPress/useKeyPress.js +1 -75
- package/dist/Functions/useLocalStorage.js +1 -34
- package/dist/Functions/useLocationParams.js +1 -27
- package/dist/Functions/useMediaQuery.js +1 -17
- package/dist/Functions/useMetaInfo.js +1 -43
- package/dist/Functions/useMouseUpOutside.js +1 -16
- package/dist/Functions/useOnlineStatus.js +1 -29
- package/dist/Functions/usePasswordChecker.js +1 -110
- package/dist/Functions/usePrevious.js +1 -12
- package/dist/Functions/useResize.js +1 -31
- package/dist/Functions/useScrollTo.js +1 -17
- package/dist/Functions/useToggle.js +1 -17
- package/dist/Functions/utils.js +1 -522
- package/dist/Langs.js +1 -168
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +1 -21
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +1 -23
- package/dist/Molecular/CustomIcons/components/AppStore.js +1 -29
- package/dist/Molecular/CustomIcons/components/Arrow.js +1 -32
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +1 -17
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +1 -22
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +1 -22
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +1 -17
- package/dist/Molecular/CustomIcons/components/Bell.js +1 -15
- package/dist/Molecular/CustomIcons/components/Button.js +1 -12
- package/dist/Molecular/CustomIcons/components/Campaigns.js +1 -16
- package/dist/Molecular/CustomIcons/components/Check.js +1 -14
- package/dist/Molecular/CustomIcons/components/Check2.js +1 -12
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +1 -12
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +1 -11
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +1 -11
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +1 -11
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +1 -11
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +1 -27
- package/dist/Molecular/CustomIcons/components/Close.js +1 -14
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +1 -17
- package/dist/Molecular/CustomIcons/components/Delete.js +1 -16
- package/dist/Molecular/CustomIcons/components/Edit.js +1 -15
- package/dist/Molecular/CustomIcons/components/Email.js +1 -31
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +1 -18
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +1 -35
- package/dist/Molecular/CustomIcons/components/Flows.js +1 -15
- package/dist/Molecular/CustomIcons/components/Gift.js +1 -25
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +1 -29
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +1 -29
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +1 -19
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +1 -20
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +1 -19
- package/dist/Molecular/CustomIcons/components/Home.js +1 -16
- package/dist/Molecular/CustomIcons/components/Home2.js +1 -22
- package/dist/Molecular/CustomIcons/components/Key.js +1 -23
- package/dist/Molecular/CustomIcons/components/Landers.js +1 -20
- package/dist/Molecular/CustomIcons/components/Lock.js +1 -15
- package/dist/Molecular/CustomIcons/components/Mail.js +1 -26
- package/dist/Molecular/CustomIcons/components/Mastercard.js +1 -73
- package/dist/Molecular/CustomIcons/components/Minus.js +1 -25
- package/dist/Molecular/CustomIcons/components/Offers.js +1 -16
- package/dist/Molecular/CustomIcons/components/Pause.js +1 -28
- package/dist/Molecular/CustomIcons/components/PayPal.js +1 -41
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +1 -28
- package/dist/Molecular/CustomIcons/components/Phone.js +1 -30
- package/dist/Molecular/CustomIcons/components/Play.js +1 -25
- package/dist/Molecular/CustomIcons/components/Plus.js +1 -25
- package/dist/Molecular/CustomIcons/components/Profile.js +1 -16
- package/dist/Molecular/CustomIcons/components/QRCode.js +1 -29
- package/dist/Molecular/CustomIcons/components/Rectangle.js +1 -12
- package/dist/Molecular/CustomIcons/components/Revert.js +1 -13
- package/dist/Molecular/CustomIcons/components/Star.js +1 -14
- package/dist/Molecular/CustomIcons/components/Star2.js +1 -16
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +1 -14
- package/dist/Molecular/CustomIcons/components/Trash.js +1 -15
- package/dist/Molecular/CustomIcons/components/TrashRed.js +1 -15
- package/dist/Molecular/CustomIcons/components/Triggers.js +1 -15
- package/dist/Molecular/CustomIcons/components/User.js +1 -25
- package/dist/Molecular/CustomIcons/components/Visa.js +1 -31
- package/dist/Molecular/CustomIcons/components/X.js +1 -12
- package/dist/Molecular/CustomIcons/index.js +1 -61
- package/dist/Molecular/FormElement/FormElement.js +1 -54
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +1 -184
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +1 -53
- package/dist/Molecular/InputAddress/InputAddress.js +1 -620
- package/dist/Molecular/InputPassword/InputPassword.js +1 -48
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,454 +1 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
|
-
|
|
3
|
-
const RESPONSE_AS_OBJECT_ALWAYS_VALUE = "always";
|
|
4
|
-
class AbortableFetch {
|
|
5
|
-
#pathPrefix = null;
|
|
6
|
-
|
|
7
|
-
#method = null;
|
|
8
|
-
|
|
9
|
-
#queryParameters = null;
|
|
10
|
-
|
|
11
|
-
#headers = null;
|
|
12
|
-
|
|
13
|
-
#body = null;
|
|
14
|
-
|
|
15
|
-
#options = null;
|
|
16
|
-
|
|
17
|
-
#callback = null;
|
|
18
|
-
|
|
19
|
-
#catchCallback = null;
|
|
20
|
-
|
|
21
|
-
#everyPromiseCallback = null;
|
|
22
|
-
|
|
23
|
-
#isResponseAsObject = false;
|
|
24
|
-
|
|
25
|
-
constructor(input) {
|
|
26
|
-
if (input && (typeof input !== "object" || Array.isArray(input)))
|
|
27
|
-
throw new Error("Not valid input value!");
|
|
28
|
-
this.getPathPrefix = this.getPathPrefix.bind(this);
|
|
29
|
-
this.setPathPrefix = this.setPathPrefix.bind(this);
|
|
30
|
-
this.getMethod = this.getMethod.bind(this);
|
|
31
|
-
this.setMethod = this.setMethod.bind(this);
|
|
32
|
-
this.getQueryParameters = this.getQueryParameters.bind(this);
|
|
33
|
-
this.getQueryString = this.getQueryString.bind(this);
|
|
34
|
-
this.setQueryParameters = this.setQueryParameters.bind(this);
|
|
35
|
-
this.getHeaders = this.getHeaders.bind(this);
|
|
36
|
-
this.getHeadersObj = this.getHeadersObj.bind(this);
|
|
37
|
-
this.setHeaders = this.setHeaders.bind(this);
|
|
38
|
-
this.getBody = this.getBody.bind(this);
|
|
39
|
-
this.setBody = this.setBody.bind(this);
|
|
40
|
-
this.getOptions = this.getOptions.bind(this);
|
|
41
|
-
this.setOptions = this.setOptions.bind(this);
|
|
42
|
-
this.getCallback = this.getCallback.bind(this);
|
|
43
|
-
this.setCallback = this.setCallback.bind(this);
|
|
44
|
-
this.getCatchCallback = this.getCatchCallback.bind(this);
|
|
45
|
-
this.setCatchCallback = this.setCatchCallback.bind(this);
|
|
46
|
-
this.getEveryPromiseCallback = this.getEveryPromiseCallback.bind(this);
|
|
47
|
-
this.setEveryPromiseCallback = this.setEveryPromiseCallback.bind(this);
|
|
48
|
-
this.getIsResponseAsObject = this.getIsResponseAsObject.bind(this);
|
|
49
|
-
this.setIsResponseAsObject = this.setIsResponseAsObject.bind(this);
|
|
50
|
-
this.getProps = this.getProps.bind(this);
|
|
51
|
-
this.setProps = this.setProps.bind(this);
|
|
52
|
-
|
|
53
|
-
this.request = this.request.bind(this);
|
|
54
|
-
this.repeatRequest = this.repeatRequest.bind(this);
|
|
55
|
-
this.setProps(input || {});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
request(props) {
|
|
59
|
-
if (!props || (typeof props !== "object" && typeof props !== "string"))
|
|
60
|
-
throw new Error("Not valid props value!");
|
|
61
|
-
|
|
62
|
-
const stringifyBody = (b) =>
|
|
63
|
-
b?.constructor === FormData ? b : JSON.stringify(b);
|
|
64
|
-
|
|
65
|
-
this.requestInput = props;
|
|
66
|
-
// eslint-disable-next-line no-use-before-define
|
|
67
|
-
const requests = getRequestsArray.call(this, props);
|
|
68
|
-
if (!requests.length)
|
|
69
|
-
return Promise.reject(new Error("There are no any valid props"));
|
|
70
|
-
|
|
71
|
-
const abortController = new AbortController();
|
|
72
|
-
let externalRequest = Promise.all(
|
|
73
|
-
requests.map(async (item) => {
|
|
74
|
-
const safelyQuery = item.path.includes("?")
|
|
75
|
-
? `&${item.queryParameters.replace(/\?/g, "")}`
|
|
76
|
-
: item.queryParameters;
|
|
77
|
-
let request = fetch(`${item.pathPrefix}${item.path}${safelyQuery}`, {
|
|
78
|
-
...item.options,
|
|
79
|
-
method: item.method,
|
|
80
|
-
headers: item.headers,
|
|
81
|
-
...(item.body ? { body: stringifyBody(item.body) } : {}),
|
|
82
|
-
signal: abortController.signal,
|
|
83
|
-
})
|
|
84
|
-
.then((response) => {
|
|
85
|
-
response.request = item;
|
|
86
|
-
return response;
|
|
87
|
-
})
|
|
88
|
-
.catch((response) =>
|
|
89
|
-
Promise.resolve({
|
|
90
|
-
ok: false,
|
|
91
|
-
status: 0,
|
|
92
|
-
statusText: response,
|
|
93
|
-
request: item,
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
if (this.#everyPromiseCallback && !item.isSkipEveryPromiseCallback)
|
|
98
|
-
request = request.then((response) =>
|
|
99
|
-
this.#everyPromiseCallback(response),
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
if (item.callback)
|
|
103
|
-
request = request.then((response) => item.callback(response));
|
|
104
|
-
|
|
105
|
-
if (this.#isResponseAsObject)
|
|
106
|
-
request = request.then((response) => ({ name: item.name, response }));
|
|
107
|
-
|
|
108
|
-
return request;
|
|
109
|
-
}),
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
externalRequest = externalRequest.then((response) =>
|
|
113
|
-
response.length < 2 ? response[0] : response,
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
if (this.#isResponseAsObject) {
|
|
117
|
-
externalRequest = externalRequest.then((response) => {
|
|
118
|
-
if (Array.isArray(props) && props.length > 1)
|
|
119
|
-
return response.reduce(
|
|
120
|
-
(ac, item) => ({ ...ac, [item.name]: item.response }),
|
|
121
|
-
{},
|
|
122
|
-
);
|
|
123
|
-
else
|
|
124
|
-
return this.#isResponseAsObject === RESPONSE_AS_OBJECT_ALWAYS_VALUE
|
|
125
|
-
? { [response.name]: response.response }
|
|
126
|
-
: response.response;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
externalRequest = externalRequest.then((response) =>
|
|
131
|
-
this.#callback ? this.#callback(response) : response,
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
externalRequest = externalRequest.catch((error) =>
|
|
135
|
-
this.#catchCallback ? this.#catchCallback(error) : error,
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
// eslint-disable-next-line no-proto
|
|
139
|
-
externalRequest.__proto__.abort = () => abortController.abort();
|
|
140
|
-
return externalRequest;
|
|
141
|
-
|
|
142
|
-
function getRequestsArray(input) {
|
|
143
|
-
const requestsArray = (() => {
|
|
144
|
-
if (typeof input === "string") return [{ path: input }];
|
|
145
|
-
return Array.isArray(input) ? [...input] : [input];
|
|
146
|
-
})();
|
|
147
|
-
|
|
148
|
-
return requestsArray.reduce((ac, item, index) => {
|
|
149
|
-
const itemObj =
|
|
150
|
-
typeof item === "object" && item !== null && !Array.isArray(item)
|
|
151
|
-
? item
|
|
152
|
-
: {};
|
|
153
|
-
const {
|
|
154
|
-
name,
|
|
155
|
-
path,
|
|
156
|
-
method,
|
|
157
|
-
queryParameters,
|
|
158
|
-
headers,
|
|
159
|
-
body,
|
|
160
|
-
options,
|
|
161
|
-
callback,
|
|
162
|
-
mergeProps,
|
|
163
|
-
isNoPathPrefix,
|
|
164
|
-
isSkipEveryPromiseCallback,
|
|
165
|
-
} = itemObj;
|
|
166
|
-
|
|
167
|
-
const safelyMergeProps =
|
|
168
|
-
mergeProps instanceof Object && !Array.isArray(mergeProps)
|
|
169
|
-
? mergeProps
|
|
170
|
-
: {};
|
|
171
|
-
const getMergeProps = (key) =>
|
|
172
|
-
safelyMergeProps.all ?? safelyMergeProps[key];
|
|
173
|
-
|
|
174
|
-
if (!path || typeof path !== "string") return ac;
|
|
175
|
-
|
|
176
|
-
const {
|
|
177
|
-
name: omitName,
|
|
178
|
-
path: omitPath,
|
|
179
|
-
pathPrefix: omitPathPrefix,
|
|
180
|
-
method: omitMethod,
|
|
181
|
-
queryParameters: omitQueryParameters,
|
|
182
|
-
headers: omitHeaders,
|
|
183
|
-
body: omitBody,
|
|
184
|
-
options: omitOptions,
|
|
185
|
-
callback: omitCallback,
|
|
186
|
-
mergeProps: omitMergeProps,
|
|
187
|
-
...optionsRest
|
|
188
|
-
} = options || {};
|
|
189
|
-
|
|
190
|
-
return [
|
|
191
|
-
...ac,
|
|
192
|
-
{
|
|
193
|
-
path,
|
|
194
|
-
pathPrefix:
|
|
195
|
-
getMergeProps("pathPrefix") === "onlyLocal" || isNoPathPrefix
|
|
196
|
-
? ""
|
|
197
|
-
: this.#pathPrefix || "",
|
|
198
|
-
method: (() => {
|
|
199
|
-
if (getMergeProps("method") === "onlyLocal")
|
|
200
|
-
return method || "GET";
|
|
201
|
-
return getMergeProps("method") === "onlyGlobal"
|
|
202
|
-
? this.#method || "GET"
|
|
203
|
-
: method || this.#method || "GET";
|
|
204
|
-
})(),
|
|
205
|
-
queryParameters: (() => {
|
|
206
|
-
if (
|
|
207
|
-
(getMergeProps("queryParameters") ?? getMergeProps("query")) ===
|
|
208
|
-
"onlyLocal"
|
|
209
|
-
) {
|
|
210
|
-
return this.getQueryString(this.getQueryArray(queryParameters));
|
|
211
|
-
}
|
|
212
|
-
return (getMergeProps("queryParameters") ??
|
|
213
|
-
getMergeProps("query")) === "onlyGlobal"
|
|
214
|
-
? this.getQueryString(this.getQueryArray(this.#queryParameters))
|
|
215
|
-
: this.getQueryString([
|
|
216
|
-
...this.getQueryArray(this.#queryParameters),
|
|
217
|
-
...this.getQueryArray(queryParameters),
|
|
218
|
-
]);
|
|
219
|
-
})(),
|
|
220
|
-
headers: (() => {
|
|
221
|
-
if (getMergeProps("headers") === "onlyLocal")
|
|
222
|
-
return this.getHeadersObj(headers || {});
|
|
223
|
-
return getMergeProps("headers") === "onlyGlobal"
|
|
224
|
-
? this.getHeadersObj({ ...(this.#headers || {}) })
|
|
225
|
-
: this.getHeadersObj({
|
|
226
|
-
...(this.#headers || {}),
|
|
227
|
-
...(headers || {}),
|
|
228
|
-
});
|
|
229
|
-
})(),
|
|
230
|
-
body: (() => {
|
|
231
|
-
if (getMergeProps("body") === "onlyLocal") return body || null;
|
|
232
|
-
if (getMergeProps("body") === "onlyGlobal")
|
|
233
|
-
return this.#body || null;
|
|
234
|
-
if (
|
|
235
|
-
body &&
|
|
236
|
-
this.#body &&
|
|
237
|
-
typeof body === typeof this.#body &&
|
|
238
|
-
typeof body === "object"
|
|
239
|
-
) {
|
|
240
|
-
return Array.isArray(body)
|
|
241
|
-
? [...this.#body, ...body]
|
|
242
|
-
: { ...this.#body, ...body };
|
|
243
|
-
} else return body || this.#body || null;
|
|
244
|
-
})(),
|
|
245
|
-
options: (() => {
|
|
246
|
-
if (getMergeProps("options") === "onlyLocal")
|
|
247
|
-
return { ...(optionsRest || {}) };
|
|
248
|
-
return getMergeProps("options") === "onlyGlobal"
|
|
249
|
-
? { ...(this.#options || {}) }
|
|
250
|
-
: { ...(this.#options || {}), ...(optionsRest || {}) };
|
|
251
|
-
})(),
|
|
252
|
-
callback,
|
|
253
|
-
isSkipEveryPromiseCallback,
|
|
254
|
-
...(this.getIsResponseAsObject()
|
|
255
|
-
? { name: name && typeof name === "string" ? name : index }
|
|
256
|
-
: {}),
|
|
257
|
-
},
|
|
258
|
-
];
|
|
259
|
-
}, []);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
repeatRequest() {
|
|
264
|
-
return this.request(this.requestInput);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// ***** getters and setters *****
|
|
268
|
-
getPathPrefix() {
|
|
269
|
-
return this.#pathPrefix;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
setPathPrefix(value) {
|
|
273
|
-
if (value && typeof value !== "string")
|
|
274
|
-
throw new Error("Not valid pathPrefix value!");
|
|
275
|
-
this.#pathPrefix = value || null;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
getMethod() {
|
|
279
|
-
return this.#method;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
setMethod(value) {
|
|
283
|
-
const methods = [
|
|
284
|
-
"GET",
|
|
285
|
-
"HEAD",
|
|
286
|
-
"POST",
|
|
287
|
-
"PUT",
|
|
288
|
-
"DELETE",
|
|
289
|
-
"CONNECT",
|
|
290
|
-
"OPTIONS",
|
|
291
|
-
"TRACE",
|
|
292
|
-
"PATCH",
|
|
293
|
-
];
|
|
294
|
-
if (value && !methods.includes(value))
|
|
295
|
-
throw new Error("Not valid method value!");
|
|
296
|
-
this.#method = value || null;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
getQueryParameters() {
|
|
300
|
-
return this.#queryParameters;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// eslint-disable-next-line class-methods-use-this
|
|
304
|
-
getQueryArray(value) {
|
|
305
|
-
if (typeof value === "string") return value?.replace(/\?/g, "")?.split("&");
|
|
306
|
-
else if (Array.isArray(value))
|
|
307
|
-
return value.map((item) => item.replace(/\?/g, ""));
|
|
308
|
-
else if (typeof value === "object" && value !== null)
|
|
309
|
-
return Object.keys(value)
|
|
310
|
-
.filter((key) => key && value[key])
|
|
311
|
-
.map((key) => `${key}=${value[key]}`);
|
|
312
|
-
else return [];
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// eslint-disable-next-line class-methods-use-this
|
|
316
|
-
getQueryString(value) {
|
|
317
|
-
if (!Array.isArray(value))
|
|
318
|
-
throw new Error("Not valid query parameters value!");
|
|
319
|
-
return value.length ? `?${value.join("&")}` : "";
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
setQueryParameters(value) {
|
|
323
|
-
if (value && !Array.isArray(value))
|
|
324
|
-
throw new Error("Not valid query parameters value!");
|
|
325
|
-
this.#queryParameters = value || null;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
getHeaders() {
|
|
329
|
-
return this.#headers;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// eslint-disable-next-line class-methods-use-this
|
|
333
|
-
getHeadersObj(value) {
|
|
334
|
-
const headers = new Headers();
|
|
335
|
-
if (!value) return headers;
|
|
336
|
-
|
|
337
|
-
if (typeof value !== "object" || Array.isArray(value))
|
|
338
|
-
throw new Error("Not valid headers value!");
|
|
339
|
-
Object.keys(value).forEach((item) => {
|
|
340
|
-
headers.append(item, value[item]);
|
|
341
|
-
});
|
|
342
|
-
return headers;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
setHeaders(value) {
|
|
346
|
-
if (value && (typeof value !== "object" || Array.isArray(value)))
|
|
347
|
-
throw new Error("Not valid headers value!");
|
|
348
|
-
this.#headers = value || null;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
getBody() {
|
|
352
|
-
return this.#body;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
setBody(value) {
|
|
356
|
-
this.#body = value;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
getOptions() {
|
|
360
|
-
return this.#options;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
setOptions(value) {
|
|
364
|
-
if (value && (typeof value !== "object" || Array.isArray(value)))
|
|
365
|
-
throw new Error("Not valid options value!");
|
|
366
|
-
this.#options = { ...value };
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
getCallback() {
|
|
370
|
-
return this.#callback;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
setCallback(value) {
|
|
374
|
-
if (value && typeof value !== "function")
|
|
375
|
-
throw new Error("Not valid callback value!");
|
|
376
|
-
this.#callback = value || null;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
getCatchCallback() {
|
|
380
|
-
return this.#catchCallback;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
setCatchCallback(value) {
|
|
384
|
-
if (value && typeof value !== "function")
|
|
385
|
-
throw new Error("Not valid callback value!");
|
|
386
|
-
this.#catchCallback = value || null;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
getEveryPromiseCallback() {
|
|
390
|
-
return this.#everyPromiseCallback;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
setEveryPromiseCallback(value) {
|
|
394
|
-
if (value && typeof value !== "function")
|
|
395
|
-
throw new Error("Not valid callback value!");
|
|
396
|
-
this.#everyPromiseCallback = value || null;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
getIsResponseAsObject() {
|
|
400
|
-
return this.#isResponseAsObject;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
setIsResponseAsObject(value) {
|
|
404
|
-
this.#isResponseAsObject =
|
|
405
|
-
typeof value !== "boolean" && value !== "always" ? Boolean(value) : value;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
getProps() {
|
|
409
|
-
return {
|
|
410
|
-
pathPrefix: this.getPathPrefix() || null,
|
|
411
|
-
method: this.getMethod() || null,
|
|
412
|
-
queryParameters: this.getQueryParameters() || null,
|
|
413
|
-
headers: this.getHeaders() || null,
|
|
414
|
-
body: this.getBody() || null,
|
|
415
|
-
options: this.getOptions() || null,
|
|
416
|
-
callback: this.getCallback() || null,
|
|
417
|
-
everyPromiseCallback: this.getEveryPromiseCallback(),
|
|
418
|
-
// isAnywayRunCallback: this.getIsAnywayRunCallback(),
|
|
419
|
-
isResponseAsObject: this.getIsResponseAsObject(),
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
setProps(input) {
|
|
424
|
-
const {
|
|
425
|
-
pathPrefix,
|
|
426
|
-
method,
|
|
427
|
-
queryParameters,
|
|
428
|
-
headers,
|
|
429
|
-
body,
|
|
430
|
-
options,
|
|
431
|
-
callback,
|
|
432
|
-
catchCallback,
|
|
433
|
-
everyPromiseCallback,
|
|
434
|
-
// isAnywayRunCallback,
|
|
435
|
-
isResponseAsObject,
|
|
436
|
-
} = input;
|
|
437
|
-
if (pathPrefix) this.setPathPrefix(pathPrefix);
|
|
438
|
-
if (method) this.setMethod(method);
|
|
439
|
-
if (queryParameters)
|
|
440
|
-
this.setQueryParameters(this.getQueryArray(queryParameters));
|
|
441
|
-
if (headers) this.setHeaders(headers);
|
|
442
|
-
if (body) this.setBody(body);
|
|
443
|
-
if (options) this.setOptions(options);
|
|
444
|
-
if (callback) this.setCallback(callback);
|
|
445
|
-
if (catchCallback) this.setCatchCallback(catchCallback);
|
|
446
|
-
if (everyPromiseCallback)
|
|
447
|
-
this.setEveryPromiseCallback(everyPromiseCallback);
|
|
448
|
-
// if (isAnywayRunCallback) this.setIsAnywayRunCallback(isAnywayRunCallback);
|
|
449
|
-
if (isResponseAsObject !== undefined)
|
|
450
|
-
this.setIsResponseAsObject(isResponseAsObject);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
export default AbortableFetch;
|
|
1
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function t(e,t,r,n,a,i,o){try{var s=e[i](o),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,a)}function r(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function n(e,t){var n=r(e,t,"get");return n.get?n.get.call(e):n.value}function a(e,t,r){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,r)}function i(e,t,n){var a=r(e,t,"set");if(a.set)a.set.call(e,n);else{if(!a.writable)throw TypeError("attempted to set read only private field");a.value=n}return n}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){o(e,t,r[t])})}return e}function l(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function u(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,r){if(t){if("string"==typeof t)return e(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var h=/*#__PURE__*/new WeakMap,y=/*#__PURE__*/new WeakMap,f=/*#__PURE__*/new WeakMap,b=/*#__PURE__*/new WeakMap,p=/*#__PURE__*/new WeakMap,d=/*#__PURE__*/new WeakMap,v=/*#__PURE__*/new WeakMap,g=/*#__PURE__*/new WeakMap,P=/*#__PURE__*/new WeakMap,m=/*#__PURE__*/new WeakMap,k=/*#__PURE__*/function(){var e;function r(e){if(!(this instanceof r))throw TypeError("Cannot call a class as a function");if(a(this,h,{writable:!0,value:null}),a(this,y,{writable:!0,value:null}),a(this,f,{writable:!0,value:null}),a(this,b,{writable:!0,value:null}),a(this,p,{writable:!0,value:null}),a(this,d,{writable:!0,value:null}),a(this,v,{writable:!0,value:null}),a(this,g,{writable:!0,value:null}),a(this,P,{writable:!0,value:null}),a(this,m,{writable:!0,value:!1}),e&&((void 0===e?"undefined":c(e))!=="object"||Array.isArray(e)))throw Error("Not valid input value!");this.getPathPrefix=this.getPathPrefix.bind(this),this.setPathPrefix=this.setPathPrefix.bind(this),this.getMethod=this.getMethod.bind(this),this.setMethod=this.setMethod.bind(this),this.getQueryParameters=this.getQueryParameters.bind(this),this.getQueryString=this.getQueryString.bind(this),this.setQueryParameters=this.setQueryParameters.bind(this),this.getHeaders=this.getHeaders.bind(this),this.getHeadersObj=this.getHeadersObj.bind(this),this.setHeaders=this.setHeaders.bind(this),this.getBody=this.getBody.bind(this),this.setBody=this.setBody.bind(this),this.getOptions=this.getOptions.bind(this),this.setOptions=this.setOptions.bind(this),this.getCallback=this.getCallback.bind(this),this.setCallback=this.setCallback.bind(this),this.getCatchCallback=this.getCatchCallback.bind(this),this.setCatchCallback=this.setCatchCallback.bind(this),this.getEveryPromiseCallback=this.getEveryPromiseCallback.bind(this),this.setEveryPromiseCallback=this.setEveryPromiseCallback.bind(this),this.getIsResponseAsObject=this.getIsResponseAsObject.bind(this),this.setIsResponseAsObject=this.setIsResponseAsObject.bind(this),this.getProps=this.getProps.bind(this),this.setProps=this.setProps.bind(this),this.request=this.request.bind(this),this.repeatRequest=this.repeatRequest.bind(this),this.setProps(e||{})}return e=[{key:"request",value:function(e){var r,a,i=this;if(!e||(void 0===e?"undefined":c(e))!=="object"&&"string"!=typeof e)throw Error("Not valid props value!");this.requestInput=e;var k=(function(e){var t=this;return("string"==typeof e?[{path:e}]:Array.isArray(e)?u(e):[e]).reduce(function(e,r,a){var i,o,l,v=(void 0===r?"undefined":c(r))!=="object"||null===r||Array.isArray(r)?{}:r,g=v.name,P=v.path,m=v.method,k=v.queryParameters,O=v.headers,w=v.body,j=v.options,E=v.callback,A=v.mergeProps,_=v.isNoPathPrefix,C=v.isSkipEveryPromiseCallback,S=(null!=(i=Object)&&"undefined"!=typeof Symbol&&i[Symbol.hasInstance]?!!i[Symbol.hasInstance](A):A instanceof i)&&!Array.isArray(A)?A:{},R=function(e){var t;return null!=(t=S.all)?t:S[e]};if(!P||"string"!=typeof P)return e;var q=j||{},x=(q.name,q.path,q.pathPrefix,q.method,q.queryParameters,q.headers,q.body,q.options,q.callback,q.mergeProps,function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(q,["name","path","pathPrefix","method","queryParameters","headers","body","options","callback","mergeProps"]));return u(e).concat([s({path:P,pathPrefix:"onlyLocal"===R("pathPrefix")||_?"":n(t,h)||"",method:"onlyLocal"===R("method")?m||"GET":"onlyGlobal"===R("method")?n(t,y)||"GET":m||n(t,y)||"GET",queryParameters:(null!=(o=R("queryParameters"))?o:R("query"))==="onlyLocal"?t.getQueryString(t.getQueryArray(k)):(null!=(l=R("queryParameters"))?l:R("query"))==="onlyGlobal"?t.getQueryString(t.getQueryArray(n(t,f))):t.getQueryString(u(t.getQueryArray(n(t,f))).concat(u(t.getQueryArray(k)))),headers:"onlyLocal"===R("headers")?t.getHeadersObj(O||{}):"onlyGlobal"===R("headers")?t.getHeadersObj(s({},n(t,b)||{})):t.getHeadersObj(s({},n(t,b)||{},O||{})),body:"onlyLocal"===R("body")?w||null:"onlyGlobal"===R("body")?n(t,p)||null:w&&n(t,p)&&(void 0===w?"undefined":c(w))===c(n(t,p))&&(void 0===w?"undefined":c(w))==="object"?Array.isArray(w)?u(n(t,p)).concat(u(w)):s({},n(t,p),w):w||n(t,p)||null,options:"onlyLocal"===R("options")?s({},x||{}):"onlyGlobal"===R("options")?s({},n(t,d)||{}):s({},n(t,d)||{},x||{}),callback:E,isSkipEveryPromiseCallback:C},t.getIsResponseAsObject()?{name:g&&"string"==typeof g?g:a}:{})])},[])}).call(this,e);if(!k.length)return Promise.reject(Error("There are no any valid props"));var O=new AbortController,w=this,j=Promise.all(k.map((r=function(e){var t,r;return function(e,t){var r,n,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&u[0]?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){i.label=u[1];break}if(6===u[0]&&i.label<a[1]){i.label=a[1],a=u;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(u);break}a[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(a){var i;return t=e.path.includes("?")?"&".concat(e.queryParameters.replace(/\?/g,"")):e.queryParameters,r=fetch("".concat(e.pathPrefix).concat(e.path).concat(t),l(s(l(s({},e.options),{method:e.method,headers:e.headers}),e.body?{body:(null==(i=e.body)?void 0:i.constructor)===FormData?i:JSON.stringify(i)}:{}),{signal:O.signal})).then(function(t){return t.request=e,t}).catch(function(t){return Promise.resolve({ok:!1,status:0,statusText:t,request:e})}),n(w,P)&&!e.isSkipEveryPromiseCallback&&(r=r.then(function(e){return n(w,P).call(w,e)})),e.callback&&(r=r.then(function(t){return e.callback(t)})),n(w,m)&&(r=r.then(function(t){return{name:e.name,response:t}})),[2,r]})},a=function(){var e=this,n=arguments;return new Promise(function(a,i){var o=r.apply(e,n);function s(e){t(o,a,i,s,l,"next",e)}function l(e){t(o,a,i,s,l,"throw",e)}s(void 0)})},function(e){return a.apply(this,arguments)})));return j=j.then(function(e){return e.length<2?e[0]:e}),n(this,m)&&(j=j.then(function(t){return Array.isArray(e)&&e.length>1?t.reduce(function(e,t){return l(s({},e),o({},t.name,t.response))},{}):"always"===n(i,m)?o({},t.name,t.response):t.response})),(j=(j=j.then(function(e){return n(i,v)?n(i,v).call(i,e):e})).catch(function(e){return n(i,g)?n(i,g).call(i,e):e})).__proto__.abort=function(){return O.abort()},j}},{key:"repeatRequest",value:function(){return this.request(this.requestInput)}},{key:"getPathPrefix",value:function(){return n(this,h)}},{key:"setPathPrefix",value:function(e){if(e&&"string"!=typeof e)throw Error("Not valid pathPrefix value!");i(this,h,e||null)}},{key:"getMethod",value:function(){return n(this,y)}},{key:"setMethod",value:function(e){if(e&&!["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"].includes(e))throw Error("Not valid method value!");i(this,y,e||null)}},{key:"getQueryParameters",value:function(){return n(this,f)}},{key:"getQueryArray",value:function(e){var t;return"string"==typeof e?null==e||null==(t=e.replace(/\?/g,""))?void 0:t.split("&"):Array.isArray(e)?e.map(function(e){return e.replace(/\?/g,"")}):(void 0===e?"undefined":c(e))==="object"&&null!==e?Object.keys(e).filter(function(t){return t&&e[t]}).map(function(t){return"".concat(t,"=").concat(e[t])}):[]}},{key:"getQueryString",value:function(e){if(!Array.isArray(e))throw Error("Not valid query parameters value!");return e.length?"?".concat(e.join("&")):""}},{key:"setQueryParameters",value:function(e){if(e&&!Array.isArray(e))throw Error("Not valid query parameters value!");i(this,f,e||null)}},{key:"getHeaders",value:function(){return n(this,b)}},{key:"getHeadersObj",value:function(e){var t=new Headers;if(!e)return t;if((void 0===e?"undefined":c(e))!=="object"||Array.isArray(e))throw Error("Not valid headers value!");return Object.keys(e).forEach(function(r){t.append(r,e[r])}),t}},{key:"setHeaders",value:function(e){if(e&&((void 0===e?"undefined":c(e))!=="object"||Array.isArray(e)))throw Error("Not valid headers value!");i(this,b,e||null)}},{key:"getBody",value:function(){return n(this,p)}},{key:"setBody",value:function(e){i(this,p,e)}},{key:"getOptions",value:function(){return n(this,d)}},{key:"setOptions",value:function(e){if(e&&((void 0===e?"undefined":c(e))!=="object"||Array.isArray(e)))throw Error("Not valid options value!");i(this,d,s({},e))}},{key:"getCallback",value:function(){return n(this,v)}},{key:"setCallback",value:function(e){if(e&&"function"!=typeof e)throw Error("Not valid callback value!");i(this,v,e||null)}},{key:"getCatchCallback",value:function(){return n(this,g)}},{key:"setCatchCallback",value:function(e){if(e&&"function"!=typeof e)throw Error("Not valid callback value!");i(this,g,e||null)}},{key:"getEveryPromiseCallback",value:function(){return n(this,P)}},{key:"setEveryPromiseCallback",value:function(e){if(e&&"function"!=typeof e)throw Error("Not valid callback value!");i(this,P,e||null)}},{key:"getIsResponseAsObject",value:function(){return n(this,m)}},{key:"setIsResponseAsObject",value:function(e){i(this,m,"boolean"!=typeof e&&"always"!==e?!!e:e)}},{key:"getProps",value:function(){return{pathPrefix:this.getPathPrefix()||null,method:this.getMethod()||null,queryParameters:this.getQueryParameters()||null,headers:this.getHeaders()||null,body:this.getBody()||null,options:this.getOptions()||null,callback:this.getCallback()||null,everyPromiseCallback:this.getEveryPromiseCallback(),isResponseAsObject:this.getIsResponseAsObject()}}},{key:"setProps",value:function(e){var t=e.pathPrefix,r=e.method,n=e.queryParameters,a=e.headers,i=e.body,o=e.options,s=e.callback,l=e.catchCallback,u=e.everyPromiseCallback,c=e.isResponseAsObject;t&&this.setPathPrefix(t),r&&this.setMethod(r),n&&this.setQueryParameters(this.getQueryArray(n)),a&&this.setHeaders(a),i&&this.setBody(i),o&&this.setOptions(o),s&&this.setCallback(s),l&&this.setCatchCallback(l),u&&this.setEveryPromiseCallback(u),void 0!==c&&this.setIsResponseAsObject(c)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,e),r}();export default k;
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class AnimatedHandler {
|
|
4
|
-
constructor(params) {
|
|
5
|
-
const {
|
|
6
|
-
type = "",
|
|
7
|
-
animationTarget,
|
|
8
|
-
animation,
|
|
9
|
-
settings,
|
|
10
|
-
hendler,
|
|
11
|
-
} = params || {};
|
|
12
|
-
if (!animationTarget || !hendler) throw new Error("Bad input!");
|
|
13
|
-
const {
|
|
14
|
-
keyframes,
|
|
15
|
-
delay,
|
|
16
|
-
direction,
|
|
17
|
-
duration,
|
|
18
|
-
easing,
|
|
19
|
-
endDelay,
|
|
20
|
-
fill,
|
|
21
|
-
iterationStart,
|
|
22
|
-
iterations,
|
|
23
|
-
} = animation || {};
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line no-constructor-return
|
|
26
|
-
return function (...args) {
|
|
27
|
-
const keyframesToUse = Array.isArray(keyframes)
|
|
28
|
-
? keyframes
|
|
29
|
-
: [
|
|
30
|
-
{ height: `${animationTarget.clientHeight}px`, opacity: 1 },
|
|
31
|
-
{ height: "0", opacity: 0 },
|
|
32
|
-
];
|
|
33
|
-
const durationToUse = duration || DEFAULT_ANIMATION_DURATION;
|
|
34
|
-
|
|
35
|
-
animationTarget.animate(keyframesToUse, animation);
|
|
36
|
-
|
|
37
|
-
return new Promise((res) => {
|
|
38
|
-
setTimeout(
|
|
39
|
-
() => res(hendler ? hendler(...args) : undefined),
|
|
40
|
-
durationToUse,
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default AnimatedHandler;
|
|
1
|
+
function t(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=Array(r);n<r;n++)e[n]=t[n];return e}export default function r(n){if(!(this instanceof r))throw TypeError("Cannot call a class as a function");var e=n||{},i=(e.type,e.animationTarget),a=e.animation,o=(e.settings,e.hendler);if(!i||!o)throw Error("Bad input!");var u=a||{},l=u.keyframes,c=(u.delay,u.direction,u.duration);return u.easing,u.endDelay,u.fill,u.iterationStart,u.iterations,function(){for(var r=arguments.length,n=Array(r),e=0;e<r;e++)n[e]=arguments[e];var u=Array.isArray(l)?l:[{height:"".concat(i.clientHeight,"px"),opacity:1},{height:"0",opacity:0}],f=c||200;return i.animate(u,a),new Promise(function(r){setTimeout(function(){return r(o?o.apply(void 0,function(r){if(Array.isArray(r))return t(r)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(r,n){if(r){if("string"==typeof r)return t(r,void 0);var e=Object.prototype.toString.call(r).slice(8,-1);if("Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return t(r,n)}}(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):void 0)},f)})}}
|