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