intelicoreact 1.4.21 → 1.4.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +1 -9
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +1 -10
- package/dist/Atomic/FormElements/Calendar/Calendar.js +4 -24
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +1 -10
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +2 -14
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +5 -54
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +3 -21
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +51 -144
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +1 -7
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +25 -91
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +3 -15
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +15 -29
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +5 -15
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +6 -26
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +19 -35
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +9 -38
- package/dist/Atomic/FormElements/Input/Input.js +25 -60
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +4 -31
- package/dist/Atomic/FormElements/InputColor/InputColor.js +4 -14
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +6 -29
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +8 -43
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +3 -21
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +58 -81
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +6 -41
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +1 -8
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +16 -46
- package/dist/Atomic/FormElements/InputLink/InputLink.js +6 -23
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +0 -4
- package/dist/Atomic/FormElements/InputMask/InputMask.js +77 -208
- package/dist/Atomic/FormElements/InputMask/functions.js +2 -28
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +43 -119
- package/dist/Atomic/FormElements/InputMask2/functions.js +2 -28
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +44 -137
- package/dist/Atomic/FormElements/InputMask3/functions.js +2 -28
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +3 -17
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +5 -24
- package/dist/Atomic/FormElements/Label/Label.js +1 -9
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +35 -73
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +3 -15
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +23 -44
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +7 -17
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +3 -14
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +1 -10
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +3 -14
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +3 -23
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +17 -34
- package/dist/Atomic/FormElements/RangeList/RangeList.js +6 -25
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +1 -11
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +14 -85
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +43 -132
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +1 -10
- package/dist/Atomic/FormElements/Switcher/Switcher.js +1 -10
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +1 -13
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +1 -10
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +2 -17
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +3 -17
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +1 -11
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +6 -29
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +2 -3
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +1 -12
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +9 -31
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +125 -213
- package/dist/Atomic/FormElements/Text/Text.js +10 -16
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +1 -9
- package/dist/Atomic/FormElements/Textarea/Textarea.js +4 -20
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +6 -35
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +4 -13
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +7 -21
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +8 -35
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +5 -18
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +3 -10
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +3 -11
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +1 -2
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +5 -12
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +3 -15
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +3 -20
- package/dist/Atomic/Layout/Spinner/Spinner.js +1 -8
- package/dist/Atomic/UI/Accordion/Accordion.js +3 -19
- package/dist/Atomic/UI/Accordion/AccordionItem.js +9 -23
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +7 -32
- package/dist/Atomic/UI/AccordionText/AccordionText.js +3 -15
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +4 -21
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +3 -15
- package/dist/Atomic/UI/Alert/Alert.js +3 -19
- package/dist/Atomic/UI/Arrow/Arrow.js +3 -16
- package/dist/Atomic/UI/Box/Box.js +3 -9
- package/dist/Atomic/UI/Button/Button.js +2 -11
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +1 -10
- package/dist/Atomic/UI/Chart/Chart.js +4 -29
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +11 -19
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +1 -12
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +11 -34
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +82 -56
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +15 -19
- package/dist/Atomic/UI/Chart/partial/utils.js +6 -20
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +3 -13
- package/dist/Atomic/UI/DateTime/DateTime.js +3 -14
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +4 -16
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +3 -11
- package/dist/Atomic/UI/DoubleString/DoubleString.js +5 -17
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +3 -10
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +17 -52
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +1 -29
- package/dist/Atomic/UI/Hint/Hint.js +5 -31
- package/dist/Atomic/UI/Modal/Modal.js +6 -28
- package/dist/Atomic/UI/Modal/ModalHOC.js +1 -9
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +1 -7
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +1 -8
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +32 -49
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +6 -21
- package/dist/Atomic/UI/NavLine/NavLine.js +26 -55
- package/dist/Atomic/UI/NavLine/Tabs.js +2 -3
- package/dist/Atomic/UI/PageTitle/PageTitle.js +2 -10
- package/dist/Atomic/UI/PieChart/PieChart.js +1 -10
- package/dist/Atomic/UI/Price/Price.js +3 -8
- package/dist/Atomic/UI/PriceRange/PriceRange.js +1 -7
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +1 -16
- package/dist/Atomic/UI/Status/Status.js +1 -8
- package/dist/Atomic/UI/Table/Partials/TdCell.js +5 -29
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +1 -11
- package/dist/Atomic/UI/Table/Partials/TdRow.js +5 -17
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +3 -14
- package/dist/Atomic/UI/Table/Table.js +1 -12
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +2 -18
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +1 -9
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +1 -4
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +1 -13
- package/dist/Atomic/UI/Tag/Tag.js +7 -19
- package/dist/Atomic/UI/TagList/TagList.js +20 -38
- package/dist/Atomic/UI/UserBox/UserBox.js +1 -13
- package/dist/Classes/AbortableFetch.js +36 -93
- package/dist/Classes/AnimatedHandler.js +3 -7
- package/dist/Classes/RESTAPI/index.js +39 -42
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +35 -93
- package/dist/Classes/RESTAPI/partials/ApiBase.js +1 -9
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +24 -32
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +34 -41
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +21 -44
- package/dist/Classes/RESTAPI/partials/Utils.js +6 -19
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +2 -6
- package/dist/Classes/RESTAPI/partials/_utils.js +13 -36
- package/dist/Constants/index.constants.js +8 -15
- package/dist/Functions/Portal.js +5 -16
- package/dist/Functions/customEventListener.js +4 -17
- package/dist/Functions/fieldValueFormatters.js +43 -83
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +23 -26
- package/dist/Functions/locale/createTranslator.js +4 -9
- package/dist/Functions/operations.js +12 -22
- package/dist/Functions/presets/inputMaskPresets.js +9 -11
- package/dist/Functions/presets/inputPresets.js +8 -11
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +7 -9
- package/dist/Functions/schemas.js +6 -13
- package/dist/Functions/useBodyScrollLock.js +1 -6
- package/dist/Functions/useClickOutside.js +0 -4
- package/dist/Functions/useDebounce.js +2 -7
- package/dist/Functions/useFieldFocus.js +6 -18
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +0 -9
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +12 -23
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +6 -15
- package/dist/Functions/useFormTools/functions/General.js +18 -28
- package/dist/Functions/useFormTools/functions/RenderFields.js +2 -11
- package/dist/Functions/useFormTools/functions/usePrevious.js +1 -5
- package/dist/Functions/useFormTools/index.js +85 -144
- package/dist/Functions/useInputHighlightError.js +3 -12
- package/dist/Functions/useIsMobile.js +7 -13
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +1 -7
- package/dist/Functions/useKeyPress/useKeyPress.js +1 -9
- package/dist/Functions/useLocalStorage.js +1 -9
- package/dist/Functions/useLocationParams.js +4 -5
- package/dist/Functions/useMediaQuery.js +3 -9
- package/dist/Functions/useMetaInfo.js +3 -10
- package/dist/Functions/useMouseUpOutside.js +0 -3
- package/dist/Functions/useOnlineStatus.js +1 -9
- package/dist/Functions/usePasswordChecker.js +4 -20
- package/dist/Functions/usePrevious.js +1 -5
- package/dist/Functions/useResize.js +2 -10
- package/dist/Functions/useScrollTo.js +2 -7
- package/dist/Functions/useToggle.js +1 -5
- package/dist/Functions/utils.js +56 -131
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +2 -9
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +2 -9
- package/dist/Molecular/CustomIcons/components/AppStore.js +2 -9
- package/dist/Molecular/CustomIcons/components/Arrow.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +2 -9
- package/dist/Molecular/CustomIcons/components/Bell.js +2 -9
- package/dist/Molecular/CustomIcons/components/Button.js +2 -9
- package/dist/Molecular/CustomIcons/components/Campaigns.js +2 -9
- package/dist/Molecular/CustomIcons/components/Check.js +2 -9
- package/dist/Molecular/CustomIcons/components/Check2.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/Close.js +2 -9
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +2 -9
- package/dist/Molecular/CustomIcons/components/Delete.js +2 -9
- package/dist/Molecular/CustomIcons/components/Edit.js +2 -9
- package/dist/Molecular/CustomIcons/components/Email.js +2 -9
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +2 -9
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +2 -9
- package/dist/Molecular/CustomIcons/components/Flows.js +2 -9
- package/dist/Molecular/CustomIcons/components/Gift.js +2 -9
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +2 -9
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +2 -9
- package/dist/Molecular/CustomIcons/components/Home.js +2 -9
- package/dist/Molecular/CustomIcons/components/Home2.js +2 -9
- package/dist/Molecular/CustomIcons/components/Key.js +2 -9
- package/dist/Molecular/CustomIcons/components/Landers.js +2 -9
- package/dist/Molecular/CustomIcons/components/Lock.js +2 -9
- package/dist/Molecular/CustomIcons/components/Mail.js +2 -9
- package/dist/Molecular/CustomIcons/components/Mastercard.js +2 -9
- package/dist/Molecular/CustomIcons/components/Minus.js +2 -9
- package/dist/Molecular/CustomIcons/components/Offers.js +2 -9
- package/dist/Molecular/CustomIcons/components/Pause.js +2 -9
- package/dist/Molecular/CustomIcons/components/PayPal.js +2 -9
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +2 -9
- package/dist/Molecular/CustomIcons/components/Phone.js +2 -9
- package/dist/Molecular/CustomIcons/components/Play.js +2 -9
- package/dist/Molecular/CustomIcons/components/Plus.js +2 -9
- package/dist/Molecular/CustomIcons/components/Profile.js +2 -9
- package/dist/Molecular/CustomIcons/components/QRCode.js +2 -9
- package/dist/Molecular/CustomIcons/components/Rectangle.js +2 -9
- package/dist/Molecular/CustomIcons/components/Revert.js +2 -9
- package/dist/Molecular/CustomIcons/components/Star.js +2 -9
- package/dist/Molecular/CustomIcons/components/Star2.js +2 -9
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +2 -9
- package/dist/Molecular/CustomIcons/components/Trash.js +2 -9
- package/dist/Molecular/CustomIcons/components/TrashRed.js +2 -9
- package/dist/Molecular/CustomIcons/components/Triggers.js +2 -9
- package/dist/Molecular/CustomIcons/components/User.js +2 -9
- package/dist/Molecular/CustomIcons/components/Visa.js +2 -9
- package/dist/Molecular/CustomIcons/components/X.js +2 -9
- package/dist/Molecular/CustomIcons/index.js +0 -122
- package/dist/Molecular/FormElement/FormElement.js +1 -12
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +30 -31
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +9 -12
- package/dist/Molecular/InputAddress/InputAddress.js +65 -114
- package/dist/Molecular/InputPassword/InputPassword.js +5 -19
- package/dist/index.js +0 -2
- package/package.json +1 -1
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +0 -91
- package/dist/Atomic/UI/ModalBackup/Modal.js +0 -174
- package/dist/Atomic/UI/ModalBackup/Modal.scss +0 -333
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +0 -51
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +0 -24
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +0 -41
|
@@ -1,43 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _reactDom = require("react-dom");
|
|
17
|
-
|
|
18
12
|
var _reactFeather = require("react-feather");
|
|
19
|
-
|
|
20
13
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
21
|
-
|
|
22
14
|
var _useDebounce = require("../../../Functions/useDebounce");
|
|
23
|
-
|
|
24
15
|
var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
25
|
-
|
|
26
16
|
var _Spinner = _interopRequireDefault(require("../../Layout/Spinner/Spinner"));
|
|
27
|
-
|
|
28
17
|
var _RadioInput = _interopRequireDefault(require("../RadioInput/RadioInput"));
|
|
29
|
-
|
|
30
18
|
require("./DropdownLiveSearch.scss");
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
36
21
|
const RC = "dropdown-live-search";
|
|
37
|
-
|
|
38
22
|
const DropdownLiveSearch = _ref => {
|
|
39
23
|
var _dropdownListRef$curr5, _dropdownListRef$curr6, _tabIndex$toString;
|
|
40
|
-
|
|
41
24
|
let {
|
|
42
25
|
label,
|
|
43
26
|
value,
|
|
@@ -69,8 +52,7 @@ const DropdownLiveSearch = _ref => {
|
|
|
69
52
|
const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
|
|
70
53
|
const labelByValue = (0, _react.useMemo)(() => {
|
|
71
54
|
var _options$find$label, _options$find;
|
|
72
|
-
|
|
73
|
-
return (_options$find$label = options === null || options === void 0 ? void 0 : (_options$find = options.find(item => item.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : "";
|
|
55
|
+
return (_options$find$label = options === null || options === void 0 || (_options$find = options.find(item => item.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : "";
|
|
74
56
|
}, [value]);
|
|
75
57
|
const [searchValue, setSV] = (0, _react.useState)("");
|
|
76
58
|
const [isSearchValueChangedAfterOpen, setIsSearchValueChangedAfterOpen] = (0, _react.useState)(false);
|
|
@@ -98,30 +80,24 @@ const DropdownLiveSearch = _ref => {
|
|
|
98
80
|
}
|
|
99
81
|
}
|
|
100
82
|
}, [options]);
|
|
101
|
-
|
|
102
83
|
const setSearchValue = function (val) {
|
|
103
84
|
let isChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
104
85
|
if (isChanged) setIsSearchValueChangedAfterOpen(true);
|
|
105
86
|
setSV(val);
|
|
106
87
|
searchValueRef.current = val;
|
|
107
88
|
};
|
|
108
|
-
|
|
109
89
|
const setIsOpen = v => {
|
|
110
90
|
setIsOpenState(v);
|
|
111
91
|
setSearchValue("", false);
|
|
112
92
|
if (!v) setIsSearchValueChangedAfterOpen(false);
|
|
113
93
|
};
|
|
114
|
-
|
|
115
94
|
const getParentNode = () => {
|
|
116
95
|
var _ref2, _document$querySelect;
|
|
117
|
-
|
|
118
96
|
return (_ref2 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref2 !== void 0 ? _ref2 : document.querySelector("div#storybook-root");
|
|
119
97
|
};
|
|
120
|
-
|
|
121
98
|
const getListContainer = () => {
|
|
122
99
|
return document.getElementById(dropdownId);
|
|
123
100
|
};
|
|
124
|
-
|
|
125
101
|
const onWrapperClick = e => {
|
|
126
102
|
if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
|
|
127
103
|
e.stopPropagation();
|
|
@@ -129,29 +105,23 @@ const DropdownLiveSearch = _ref => {
|
|
|
129
105
|
setIsOpen(false);
|
|
130
106
|
}
|
|
131
107
|
};
|
|
132
|
-
|
|
133
108
|
const onSearchableInputFocus = e => {
|
|
134
109
|
if (!isOpen) {
|
|
135
110
|
e.preventDefault();
|
|
136
111
|
e.stopPropagation();
|
|
137
112
|
}
|
|
138
113
|
};
|
|
139
|
-
|
|
140
114
|
const handleClickOutside = event => {
|
|
141
115
|
var _getListContainer;
|
|
142
|
-
|
|
143
116
|
if (!dropdownLiveSearchRef.current.contains(event.target) && (!getListContainer() || !((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(event.target)))) setIsOpen(false);
|
|
144
117
|
};
|
|
145
|
-
|
|
146
118
|
const closeListViaEsc = e => {
|
|
147
119
|
if ([27].includes(e.keyCode)) setIsOpen(false);
|
|
148
120
|
};
|
|
149
|
-
|
|
150
121
|
const closeList = isOpen ? handleClickOutside : () => {};
|
|
151
122
|
const handle = {
|
|
152
123
|
onInputClick: e => {
|
|
153
124
|
if (!isOpen) setIsOpen(true);
|
|
154
|
-
|
|
155
125
|
if (isMobile && withMobileLogic) {
|
|
156
126
|
e.preventDefault();
|
|
157
127
|
e.stopPropagation();
|
|
@@ -164,7 +134,6 @@ const DropdownLiveSearch = _ref => {
|
|
|
164
134
|
let inputValue = e.target.value;
|
|
165
135
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
166
136
|
setSearchValue(inputValue);
|
|
167
|
-
|
|
168
137
|
if ((searchValue || !isSearchValueChangedAfterOpen) && !e.target.value) {
|
|
169
138
|
onChange("");
|
|
170
139
|
setSearchValue("");
|
|
@@ -172,15 +141,11 @@ const DropdownLiveSearch = _ref => {
|
|
|
172
141
|
} else setIsValueDeleted(false);
|
|
173
142
|
}
|
|
174
143
|
};
|
|
175
|
-
|
|
176
144
|
const highlightedText = (text, postfix) => {
|
|
177
145
|
if (!isSearchable) return text;else {
|
|
178
146
|
var _text;
|
|
179
|
-
|
|
180
147
|
const preparedSearchValue = isSearchValueChangedAfterOpen || isMobile && withMobileLogic ? searchValue : labelByValue;
|
|
181
|
-
|
|
182
148
|
const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
183
|
-
|
|
184
149
|
text = text.replace(/["&<>]/g, a => {
|
|
185
150
|
return {
|
|
186
151
|
'"': """,
|
|
@@ -194,15 +159,13 @@ const DropdownLiveSearch = _ref => {
|
|
|
194
159
|
return main + postfixPart;
|
|
195
160
|
}
|
|
196
161
|
};
|
|
197
|
-
|
|
198
162
|
const getMarkupForElement = (item, index, optTestId) => {
|
|
199
|
-
var _item$value, _item$
|
|
200
|
-
|
|
163
|
+
var _item$value, _item$value2, _item$customMobileIco;
|
|
201
164
|
const lowerLabel = item.label.toLowerCase();
|
|
202
165
|
const lowerSearchValue = searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase();
|
|
203
166
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
204
|
-
"data-testid": "dropdown-live-search--button--key-".concat(optTestId || (item === null || item === void 0
|
|
205
|
-
key: (_item$value2 = item.value) === null || _item$value2 === void 0
|
|
167
|
+
"data-testid": "dropdown-live-search--button--key-".concat(optTestId || (item === null || item === void 0 || (_item$value = item.value) === null || _item$value === void 0 || (_item$value = _item$value.toString()) === null || _item$value === void 0 ? void 0 : _item$value.replace(/\s/, "-")) || (item === null || item === void 0 ? void 0 : item.key) || "item", "--option"),
|
|
168
|
+
key: (_item$value2 = item.value) === null || _item$value2 === void 0 || (_item$value2 = _item$value2.toString()) === null || _item$value2 === void 0 ? void 0 : _item$value2.replace(/ /g, "_"),
|
|
206
169
|
onClick: () => {
|
|
207
170
|
onChange(item.value);
|
|
208
171
|
setIsOpen(false);
|
|
@@ -226,7 +189,6 @@ const DropdownLiveSearch = _ref => {
|
|
|
226
189
|
checked: value
|
|
227
190
|
}) : "");
|
|
228
191
|
};
|
|
229
|
-
|
|
230
192
|
const getListMarkUp = () => {
|
|
231
193
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
232
194
|
className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
|
|
@@ -278,51 +240,41 @@ const DropdownLiveSearch = _ref => {
|
|
|
278
240
|
size: options.length <= 3 ? "small" : null
|
|
279
241
|
}))));
|
|
280
242
|
};
|
|
281
|
-
|
|
282
243
|
const initListContainer = () => {
|
|
283
244
|
const dropdownList = document.createElement("div");
|
|
284
245
|
dropdownList.setAttribute("id", dropdownId);
|
|
285
246
|
dropdownList.classList.add("dropdown__container");
|
|
286
|
-
|
|
287
247
|
if (isMobile) {
|
|
288
248
|
dropdownList.addEventListener("click", e => {
|
|
289
249
|
if (e.target.id === dropdownId) setIsOpen(false);
|
|
290
250
|
});
|
|
291
251
|
}
|
|
292
|
-
|
|
293
252
|
try {
|
|
294
253
|
var _getListContainer2;
|
|
295
|
-
|
|
296
|
-
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.remove();
|
|
254
|
+
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.remove();
|
|
297
255
|
} finally {
|
|
298
256
|
if (isMobile) {
|
|
299
257
|
var _getParentNode;
|
|
300
|
-
|
|
301
258
|
try {
|
|
302
259
|
var _document$getElementB;
|
|
303
|
-
|
|
304
|
-
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
|
|
260
|
+
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
|
305
261
|
} catch (e) {}
|
|
306
|
-
|
|
307
262
|
const dropdownMobileListWrapper = document.createElement("div");
|
|
308
263
|
dropdownMobileListWrapper.classList.add("dropdown-live-search-mobile");
|
|
309
264
|
dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
|
|
310
|
-
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0
|
|
311
|
-
(_getParentNode = getParentNode()) === null || _getParentNode === void 0
|
|
265
|
+
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 || dropdownMobileListWrapper.append(dropdownList);
|
|
266
|
+
(_getParentNode = getParentNode()) === null || _getParentNode === void 0 || _getParentNode.append(dropdownMobileListWrapper);
|
|
312
267
|
} else {
|
|
313
268
|
var _getParentNode2;
|
|
314
|
-
|
|
315
|
-
(_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
|
|
269
|
+
(_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 || _getParentNode2.append(dropdownList);
|
|
316
270
|
}
|
|
317
271
|
}
|
|
318
272
|
};
|
|
319
|
-
|
|
320
273
|
const renderListContainer = () => {
|
|
321
274
|
const lc = getListContainer();
|
|
322
275
|
if (!lc) return null;
|
|
323
276
|
return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
|
|
324
277
|
};
|
|
325
|
-
|
|
326
278
|
(0, _react.useEffect)(() => {
|
|
327
279
|
document.addEventListener("click", handleClickOutside, true);
|
|
328
280
|
return () => document.removeEventListener("click", handleClickOutside, true);
|
|
@@ -347,18 +299,15 @@ const DropdownLiveSearch = _ref => {
|
|
|
347
299
|
(0, _react.useEffect)(() => {
|
|
348
300
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
|
|
349
301
|
var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
setIsFixedMaxHeight(isScrollableList || (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
|
|
302
|
+
setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.clientHeight));
|
|
303
|
+
setIsFixedMaxHeight(isScrollableList || (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
|
|
353
304
|
}
|
|
354
|
-
}, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0
|
|
305
|
+
}, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.clientHeight]);
|
|
355
306
|
(0, _react.useLayoutEffect)(() => {
|
|
356
307
|
const list = document.getElementById("dropdown-live-search-list");
|
|
357
|
-
|
|
358
308
|
if ((list || isOpen) && (!withMobileLogic || !isMobile)) {
|
|
359
309
|
var _dropdownLiveSearchRe;
|
|
360
|
-
|
|
361
|
-
const dropdownWidth = dropdownLiveSearchRef === null || dropdownLiveSearchRef === void 0 ? void 0 : (_dropdownLiveSearchRe = dropdownLiveSearchRef.current) === null || _dropdownLiveSearchRe === void 0 ? void 0 : _dropdownLiveSearchRe.clientWidth;
|
|
310
|
+
const dropdownWidth = dropdownLiveSearchRef === null || dropdownLiveSearchRef === void 0 || (_dropdownLiveSearchRe = dropdownLiveSearchRef.current) === null || _dropdownLiveSearchRe === void 0 ? void 0 : _dropdownLiveSearchRe.clientWidth;
|
|
362
311
|
list.style.minWidth = "".concat(dropdownWidth, "px");
|
|
363
312
|
}
|
|
364
313
|
}, [dropdownLiveSearchRef, isOpen, withMobileLogic]);
|
|
@@ -367,31 +316,25 @@ const DropdownLiveSearch = _ref => {
|
|
|
367
316
|
setIsFocusedByClick(false);
|
|
368
317
|
if (withMobileLogic && isMobile) setSearchValue("");
|
|
369
318
|
}
|
|
370
|
-
|
|
371
319
|
if (isOpen && dropdownListRef && dropdownListRef.current) {
|
|
372
320
|
if (isMobile && withMobileLogic) {
|
|
373
321
|
var _searchInputModalRef$;
|
|
374
|
-
|
|
375
322
|
doRequest("").then(() => {
|
|
376
323
|
setTimeout(() => {
|
|
377
|
-
var _dropdownListBoxRef$c,
|
|
378
|
-
|
|
379
|
-
dropdownListRef.current.style.maxHeight = "".concat((dropdownListBoxRef === null || dropdownListBoxRef === void 0 ? void 0 : (_dropdownListBoxRef$c = dropdownListBoxRef.current) === null || _dropdownListBoxRef$c === void 0 ? void 0 : (_dropdownListBoxRef$c2 = _dropdownListBoxRef$c.getBoundingClientRect()) === null || _dropdownListBoxRef$c2 === void 0 ? void 0 : _dropdownListBoxRef$c2.height) - (dropdownListHeaderRef === null || dropdownListHeaderRef === void 0 ? void 0 : (_dropdownListHeaderRe = dropdownListHeaderRef.current) === null || _dropdownListHeaderRe === void 0 ? void 0 : (_dropdownListHeaderRe2 = _dropdownListHeaderRe.getBoundingClientRect()) === null || _dropdownListHeaderRe2 === void 0 ? void 0 : _dropdownListHeaderRe2.height), "px");
|
|
324
|
+
var _dropdownListBoxRef$c, _dropdownListHeaderRe;
|
|
325
|
+
dropdownListRef.current.style.maxHeight = "".concat((dropdownListBoxRef === null || dropdownListBoxRef === void 0 || (_dropdownListBoxRef$c = dropdownListBoxRef.current) === null || _dropdownListBoxRef$c === void 0 || (_dropdownListBoxRef$c = _dropdownListBoxRef$c.getBoundingClientRect()) === null || _dropdownListBoxRef$c === void 0 ? void 0 : _dropdownListBoxRef$c.height) - (dropdownListHeaderRef === null || dropdownListHeaderRef === void 0 || (_dropdownListHeaderRe = dropdownListHeaderRef.current) === null || _dropdownListHeaderRe === void 0 || (_dropdownListHeaderRe = _dropdownListHeaderRe.getBoundingClientRect()) === null || _dropdownListHeaderRe === void 0 ? void 0 : _dropdownListHeaderRe.height), "px");
|
|
380
326
|
}, 1);
|
|
381
327
|
});
|
|
382
|
-
searchInputModalRef === null || searchInputModalRef === void 0
|
|
328
|
+
searchInputModalRef === null || searchInputModalRef === void 0 || (_searchInputModalRef$ = searchInputModalRef.current) === null || _searchInputModalRef$ === void 0 || _searchInputModalRef$.focus();
|
|
383
329
|
}
|
|
384
|
-
|
|
385
330
|
dropdownListRef.current.addEventListener("scroll", doScrollCallback);
|
|
386
331
|
}
|
|
387
|
-
|
|
388
332
|
return () => {
|
|
389
333
|
removeEventListener("scroll", doScrollCallback);
|
|
390
334
|
};
|
|
391
335
|
}, [isOpen, dropdownListRef]);
|
|
392
336
|
(0, _react.useLayoutEffect)(() => {
|
|
393
337
|
var _getListContainer3;
|
|
394
|
-
|
|
395
338
|
if (!isMobile) {
|
|
396
339
|
window.addEventListener("mousewheel", closeList);
|
|
397
340
|
window.addEventListener("scroll", closeList);
|
|
@@ -401,41 +344,34 @@ const DropdownLiveSearch = _ref => {
|
|
|
401
344
|
window.removeEventListener("scroll", closeList);
|
|
402
345
|
window.removeEventListener("touchmove", closeList);
|
|
403
346
|
}
|
|
404
|
-
|
|
405
|
-
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.addEventListener("click", closeList);
|
|
347
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener("click", closeList);
|
|
406
348
|
window.addEventListener("keyup", closeListViaEsc);
|
|
407
349
|
return () => {
|
|
408
350
|
var _getListContainer4;
|
|
409
|
-
|
|
410
351
|
window.removeEventListener("mousewheel", closeList);
|
|
411
352
|
window.removeEventListener("scroll", closeList);
|
|
412
353
|
window.removeEventListener("touchmove", closeList);
|
|
413
354
|
window.removeEventListener("keyup", closeListViaEsc);
|
|
414
|
-
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0
|
|
355
|
+
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener("click", closeList);
|
|
415
356
|
};
|
|
416
357
|
}, [getListContainer]);
|
|
417
358
|
(0, _react.useEffect)(() => {
|
|
418
359
|
const setScrollTopValue = e => {
|
|
419
360
|
setScrollTop(parseInt(e.target.scrollTop, 10));
|
|
420
361
|
};
|
|
421
|
-
|
|
422
362
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
423
363
|
var _dropdownListRef$curr7;
|
|
424
|
-
|
|
425
|
-
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
364
|
+
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 || _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
426
365
|
}
|
|
427
|
-
|
|
428
366
|
return () => {
|
|
429
367
|
var _dropdownListRef$curr8;
|
|
430
|
-
|
|
431
|
-
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
368
|
+
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 || _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
432
369
|
};
|
|
433
370
|
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
434
371
|
(0, _react.useEffect)(() => {
|
|
435
372
|
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
436
373
|
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
437
|
-
|
|
438
|
-
setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.clientHeight), 10));
|
|
374
|
+
setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.clientHeight), 10));
|
|
439
375
|
}
|
|
440
376
|
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
441
377
|
if (!options) return null;
|
|
@@ -452,7 +388,7 @@ const DropdownLiveSearch = _ref => {
|
|
|
452
388
|
onClick: () => !isSearchable ? setIsOpen(!isOpen) : null,
|
|
453
389
|
onMouseDown: () => setIsFocusedByClick(true),
|
|
454
390
|
onFocus: () => !isFocusedByClick ? setIsOpen(true) : null,
|
|
455
|
-
tabIndex: tabIndex === null || tabIndex === void 0
|
|
391
|
+
tabIndex: tabIndex === null || tabIndex === void 0 || (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
|
|
456
392
|
}, isSearchable ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
457
393
|
ref: searchInputRef,
|
|
458
394
|
className: "".concat(RC, "__input"),
|
|
@@ -473,6 +409,4 @@ const DropdownLiveSearch = _ref => {
|
|
|
473
409
|
className: "mobile-icon"
|
|
474
410
|
}) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && (isMobile && withMobileLogic ? renderListContainer() : getListMarkUp()));
|
|
475
411
|
};
|
|
476
|
-
|
|
477
|
-
var _default = DropdownLiveSearch;
|
|
478
|
-
exports.default = _default;
|
|
412
|
+
var _default = exports.default = DropdownLiveSearch;
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _LoadZone = _interopRequireDefault(require("./partial/LoadZone"));
|
|
15
|
-
|
|
16
11
|
var _LoadedContent = _interopRequireDefault(require("./partial/LoadedContent"));
|
|
17
|
-
|
|
18
12
|
require("./FileLoader.scss");
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
24
15
|
const RC = "file-loader";
|
|
25
|
-
|
|
26
16
|
const FileLoader = props => {
|
|
27
17
|
const {
|
|
28
18
|
// будет использован в качестве id инпута в LoadZone, обязателен для корректной работы
|
|
@@ -83,6 +73,4 @@ const FileLoader = props => {
|
|
|
83
73
|
attributesOfNativeInput: attributesOfNativeInput
|
|
84
74
|
}));
|
|
85
75
|
};
|
|
86
|
-
|
|
87
|
-
var _default = FileLoader;
|
|
88
|
-
exports.default = _default;
|
|
76
|
+
var _default = exports.default = FileLoader;
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
require("../FileLoader.scss");
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
22
14
|
const DEFAULT_MAX_FILE_SIZE = 1024 * 1024; //1Мб
|
|
23
|
-
|
|
24
15
|
const FILTER_FILES_DEFAULT = file => file.size <= DEFAULT_MAX_FILE_SIZE ? file : null;
|
|
25
|
-
|
|
26
16
|
const LoadZone = _ref => {
|
|
27
17
|
let {
|
|
28
18
|
RC,
|
|
@@ -41,16 +31,14 @@ const LoadZone = _ref => {
|
|
|
41
31
|
const dropZoneId = "dropZone-".concat(fieldKey);
|
|
42
32
|
const handle = {
|
|
43
33
|
change: async e => {
|
|
44
|
-
setIsLoadContent === null || setIsLoadContent === void 0
|
|
34
|
+
setIsLoadContent === null || setIsLoadContent === void 0 || setIsLoadContent(true);
|
|
45
35
|
const file = e.type === "change" ? e.target.files[0] : e.dataTransfer.files[0];
|
|
46
36
|
const validatedFile = filterFiles ? await filterFiles(file) : file;
|
|
47
37
|
if (processErrors && !validatedFile) await processErrors(file);
|
|
48
|
-
|
|
49
38
|
if (!isBlockNullValues || validatedFile) {
|
|
50
39
|
onChange(await doLoad(validatedFile).catch(() => null));
|
|
51
40
|
}
|
|
52
|
-
|
|
53
|
-
setIsLoadContent === null || setIsLoadContent === void 0 ? void 0 : setIsLoadContent(false);
|
|
41
|
+
setIsLoadContent === null || setIsLoadContent === void 0 || setIsLoadContent(false);
|
|
54
42
|
},
|
|
55
43
|
dragover: e => {
|
|
56
44
|
e.stopPropagation();
|
|
@@ -79,17 +67,17 @@ const LoadZone = _ref => {
|
|
|
79
67
|
};
|
|
80
68
|
(0, _react.useEffect)(() => {
|
|
81
69
|
const dropbox = document.getElementById(dropZoneId);
|
|
82
|
-
dropbox === null || dropbox === void 0
|
|
83
|
-
dropbox === null || dropbox === void 0
|
|
84
|
-
dropbox === null || dropbox === void 0
|
|
85
|
-
dropbox === null || dropbox === void 0
|
|
86
|
-
dropbox === null || dropbox === void 0
|
|
70
|
+
dropbox === null || dropbox === void 0 || dropbox.addEventListener("dragenter", handle.dragenter, false);
|
|
71
|
+
dropbox === null || dropbox === void 0 || dropbox.addEventListener("dragover", handle.dragover, false);
|
|
72
|
+
dropbox === null || dropbox === void 0 || dropbox.addEventListener("dragleave", handle.dragleave, false);
|
|
73
|
+
dropbox === null || dropbox === void 0 || dropbox.addEventListener("drop", handle.drop, false);
|
|
74
|
+
dropbox === null || dropbox === void 0 || dropbox.addEventListener("dragend", handle.dragleave, false);
|
|
87
75
|
return () => {
|
|
88
|
-
dropbox === null || dropbox === void 0
|
|
89
|
-
dropbox === null || dropbox === void 0
|
|
90
|
-
dropbox === null || dropbox === void 0
|
|
91
|
-
dropbox === null || dropbox === void 0
|
|
92
|
-
dropbox === null || dropbox === void 0
|
|
76
|
+
dropbox === null || dropbox === void 0 || dropbox.removeEventListener("dragenter", handle.dragenter, false);
|
|
77
|
+
dropbox === null || dropbox === void 0 || dropbox.removeEventListener("dragover", handle.dragover, false);
|
|
78
|
+
dropbox === null || dropbox === void 0 || dropbox.removeEventListener("dragleave", handle.dragleave, false);
|
|
79
|
+
dropbox === null || dropbox === void 0 || dropbox.removeEventListener("drop", handle.drop, false);
|
|
80
|
+
dropbox === null || dropbox === void 0 || dropbox.removeEventListener("dragend", handle.dragleave, false);
|
|
93
81
|
};
|
|
94
82
|
}, [fieldKey, doLoad]);
|
|
95
83
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -107,6 +95,4 @@ const LoadZone = _ref => {
|
|
|
107
95
|
onChange: handle.change
|
|
108
96
|
}, attributesOfNativeInput))));
|
|
109
97
|
};
|
|
110
|
-
|
|
111
|
-
var _default = LoadZone;
|
|
112
|
-
exports.default = _default;
|
|
98
|
+
var _default = exports.default = LoadZone;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _utils = require("../../../../Functions/utils");
|
|
17
|
-
|
|
18
12
|
require("../FileLoader.scss");
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
24
15
|
const LoadedContent = props => {
|
|
25
16
|
const {
|
|
26
17
|
RC,
|
|
@@ -43,7 +34,8 @@ const LoadedContent = props => {
|
|
|
43
34
|
});
|
|
44
35
|
}
|
|
45
36
|
};
|
|
46
|
-
const additionalProps = (0, _react.useMemo)(() => ({
|
|
37
|
+
const additionalProps = (0, _react.useMemo)(() => ({
|
|
38
|
+
...(isUseLinkTitle ? {
|
|
47
39
|
title: isLinkTypeDownload ? "Download ".concat(value.name) : value.path
|
|
48
40
|
} : {}),
|
|
49
41
|
...(isLinkTypeDownload ? {
|
|
@@ -66,6 +58,4 @@ const LoadedContent = props => {
|
|
|
66
58
|
onClick: onDelete
|
|
67
59
|
}, deleteIcon || "X"));
|
|
68
60
|
};
|
|
69
|
-
|
|
70
|
-
var _default = LoadedContent;
|
|
71
|
-
exports.default = _default;
|
|
61
|
+
var _default = exports.default = LoadedContent;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _reactFeather = require("react-feather");
|
|
17
|
-
|
|
18
12
|
var _utils = require("../../../Functions/utils");
|
|
19
|
-
|
|
20
13
|
require("./FileLoaderLocal.scss");
|
|
21
|
-
|
|
22
14
|
const MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
23
|
-
|
|
24
15
|
const FileLoaderLocal = _ref => {
|
|
25
16
|
let {
|
|
26
17
|
groupId,
|
|
@@ -37,12 +28,10 @@ const FileLoaderLocal = _ref => {
|
|
|
37
28
|
testId,
|
|
38
29
|
attributesOfNativeInput = {}
|
|
39
30
|
} = _ref;
|
|
40
|
-
|
|
41
31
|
const getFileName = value => {
|
|
42
32
|
const result = value.match(/[^\\]+$/);
|
|
43
33
|
return result === null || result === void 0 ? void 0 : result[0];
|
|
44
34
|
};
|
|
45
|
-
|
|
46
35
|
const renderRequiredLabel = () => {
|
|
47
36
|
if (!value) {
|
|
48
37
|
if (isRequired) return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -52,26 +41,20 @@ const FileLoaderLocal = _ref => {
|
|
|
52
41
|
}, "Optional");
|
|
53
42
|
}
|
|
54
43
|
};
|
|
55
|
-
|
|
56
44
|
const isFileSizeOutOfLimit = file => {
|
|
57
45
|
var _ref2;
|
|
58
|
-
|
|
59
46
|
return (_ref2 = file.size > maxItemSizeBytes) !== null && _ref2 !== void 0 ? _ref2 : MAX_FILE_SIZE;
|
|
60
47
|
};
|
|
61
|
-
|
|
62
48
|
const checkExtension = valueExtension => {
|
|
63
49
|
return accept.includes(valueExtension);
|
|
64
50
|
};
|
|
65
|
-
|
|
66
51
|
const handle = {
|
|
67
52
|
change: e => {
|
|
68
|
-
var _name$match, _e$target, _e$
|
|
69
|
-
|
|
53
|
+
var _name$match, _e$target, _e$target2;
|
|
70
54
|
const name = getFileName(e.target.value);
|
|
71
|
-
const valueExtension = name === null || name === void 0
|
|
72
|
-
const file = (_e$target = e.target) === null || _e$target === void 0
|
|
73
|
-
|
|
74
|
-
if (isFileSizeOutOfLimit((_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : (_e$target2$files = _e$target2.files) === null || _e$target2$files === void 0 ? void 0 : _e$target2$files[0])) {
|
|
55
|
+
const valueExtension = name === null || name === void 0 || (_name$match = name.match(/[^\.]+$/)) === null || _name$match === void 0 ? void 0 : _name$match[0];
|
|
56
|
+
const file = (_e$target = e.target) === null || _e$target === void 0 || (_e$target = _e$target.files) === null || _e$target === void 0 ? void 0 : _e$target[0];
|
|
57
|
+
if (isFileSizeOutOfLimit((_e$target2 = e.target) === null || _e$target2 === void 0 || (_e$target2 = _e$target2.files) === null || _e$target2 === void 0 ? void 0 : _e$target2[0])) {
|
|
75
58
|
onChange({
|
|
76
59
|
id,
|
|
77
60
|
name,
|
|
@@ -83,8 +66,7 @@ const FileLoaderLocal = _ref => {
|
|
|
83
66
|
});
|
|
84
67
|
} else if (!checkExtension(valueExtension)) {
|
|
85
68
|
var _accept$replace;
|
|
86
|
-
|
|
87
|
-
const allowedExtensions = (accept === null || accept === void 0 ? void 0 : (_accept$replace = accept.replace(/\./g, "")) === null || _accept$replace === void 0 ? void 0 : _accept$replace.toUpperCase()) || "JPG, PNG, PDF";
|
|
69
|
+
const allowedExtensions = (accept === null || accept === void 0 || (_accept$replace = accept.replace(/\./g, "")) === null || _accept$replace === void 0 ? void 0 : _accept$replace.toUpperCase()) || "JPG, PNG, PDF";
|
|
88
70
|
const uniqExts = (0, _utils.getUniqueFileExtensions)(allowedExtensions);
|
|
89
71
|
onChange({
|
|
90
72
|
id,
|
|
@@ -142,6 +124,4 @@ const FileLoaderLocal = _ref => {
|
|
|
142
124
|
})
|
|
143
125
|
}), renderRequiredLabel()));
|
|
144
126
|
};
|
|
145
|
-
|
|
146
|
-
var _default = FileLoaderLocal;
|
|
147
|
-
exports.default = _default;
|
|
127
|
+
var _default = exports.default = FileLoaderLocal;
|