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,29 +1,48 @@
|
|
|
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 _CheckboxInput = _interopRequireDefault(require("../../FormElements/CheckboxInput/CheckboxInput"));
|
|
27
|
+
|
|
17
28
|
var _Input = _interopRequireDefault(require("../../FormElements/Input/Input"));
|
|
29
|
+
|
|
18
30
|
var _Tag = _interopRequireDefault(require("../../UI/Tag/Tag"));
|
|
31
|
+
|
|
19
32
|
var _TagList = _interopRequireDefault(require("../../UI/TagList/TagList"));
|
|
33
|
+
|
|
20
34
|
require("./TagsDropdown.scss");
|
|
21
|
-
|
|
22
|
-
function
|
|
35
|
+
|
|
36
|
+
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); }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
23
40
|
const RC = "tags-dropdown";
|
|
24
41
|
const MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
|
|
42
|
+
|
|
25
43
|
const TagsDropdown = _ref => {
|
|
26
|
-
var _Object$keys, _dropdownListWrapperR, _dropdownListRef$curr5, _dropdownListRef$curr6;
|
|
44
|
+
var _Object$keys, _dropdownListWrapperR, _dropdownListWrapperR2, _dropdownListRef$curr5, _dropdownListRef$curr6;
|
|
45
|
+
|
|
27
46
|
let {
|
|
28
47
|
options,
|
|
29
48
|
chosenOptions = [],
|
|
@@ -65,7 +84,7 @@ const TagsDropdown = _ref => {
|
|
|
65
84
|
isMobile: isMobileProp
|
|
66
85
|
} = (0, _useIsMobile.default)();
|
|
67
86
|
const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
|
|
68
|
-
const [dropdownId
|
|
87
|
+
const [dropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
|
|
69
88
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
70
89
|
const [searchValue, setSearchValue] = (0, _react.useState)("");
|
|
71
90
|
const dropdownRef = (0, _react.useRef)(null);
|
|
@@ -93,28 +112,34 @@ const TagsDropdown = _ref => {
|
|
|
93
112
|
} = _ref2;
|
|
94
113
|
return value === (item === null || item === void 0 ? void 0 : item.value);
|
|
95
114
|
});
|
|
115
|
+
|
|
96
116
|
if (isExist !== -1) {
|
|
97
117
|
acc[isExist] = item;
|
|
98
118
|
} else {
|
|
99
119
|
acc.push(item);
|
|
100
120
|
}
|
|
101
121
|
};
|
|
122
|
+
|
|
102
123
|
if (item.groupName) {
|
|
103
124
|
var _item$list;
|
|
104
|
-
|
|
125
|
+
|
|
126
|
+
(_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.map(item => checkUniqAndPush(acc, item));
|
|
105
127
|
} else {
|
|
106
128
|
checkUniqAndPush(acc, item);
|
|
107
129
|
}
|
|
130
|
+
|
|
108
131
|
return acc;
|
|
109
132
|
}, (_Object$keys = Object.keys(localOptionsStore)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(value => ({
|
|
110
133
|
value,
|
|
111
134
|
label: localOptionsStore === null || localOptionsStore === void 0 ? void 0 : localOptionsStore[value]
|
|
112
135
|
})));
|
|
136
|
+
|
|
113
137
|
const setSearchValueInterceptor = value => {
|
|
114
138
|
setSearchValue(value);
|
|
115
|
-
setIsValueDeleted(value === "");
|
|
139
|
+
setIsValueDeleted(searchValue !== value && value === "");
|
|
116
140
|
searchValueRef.current = value;
|
|
117
141
|
};
|
|
142
|
+
|
|
118
143
|
const doScrollCallback = (0, _react.useCallback)(e => {
|
|
119
144
|
if (doLiveSearchRequest && typeof doLiveSearchRequest === "function") {
|
|
120
145
|
if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
|
|
@@ -122,48 +147,57 @@ const TagsDropdown = _ref => {
|
|
|
122
147
|
}
|
|
123
148
|
}
|
|
124
149
|
}, [options]);
|
|
150
|
+
|
|
125
151
|
const handleClickOutside = _ref3 => {
|
|
126
152
|
var _getListContainer;
|
|
153
|
+
|
|
127
154
|
let {
|
|
128
155
|
target
|
|
129
156
|
} = _ref3;
|
|
130
|
-
|
|
131
|
-
// eslint-disable-next-line no-use-before-define
|
|
132
|
-
!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target))
|
|
157
|
+
|
|
158
|
+
if ( // eslint-disable-next-line no-use-before-define
|
|
159
|
+
!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target))
|
|
160
|
+
/* && !isTargetInParent(target) */
|
|
161
|
+
) {
|
|
133
162
|
setIsOpen(false);
|
|
134
|
-
setSearchValueInterceptor("");
|
|
135
163
|
}
|
|
136
164
|
};
|
|
165
|
+
|
|
137
166
|
const deleteChosen = value => {
|
|
138
167
|
if (isMobile ? closeOnRemoveMobile : closeOnRemove) setIsOpen(false);
|
|
139
|
-
setLocalOptionsStore(options => ({
|
|
140
|
-
...options,
|
|
168
|
+
setLocalOptionsStore(options => ({ ...options,
|
|
141
169
|
[value]: undefined
|
|
142
170
|
}));
|
|
143
171
|
onChange(chosenOptions.filter(item => item !== value), "chosenOptions");
|
|
144
172
|
};
|
|
173
|
+
|
|
145
174
|
const onChangeHandler = item => {
|
|
146
175
|
if (item !== null && item !== void 0 && item.isFreezed) return false;
|
|
176
|
+
|
|
147
177
|
if ((item === null || item === void 0 ? void 0 : item.closeOnOptionSelect) !== undefined) {
|
|
148
178
|
if (item.closeOnOptionSelect) setIsOpen(false);
|
|
149
179
|
} else if (isMobile ? closeOnSelectMobile : closeOnSelect) setIsOpen(false);
|
|
180
|
+
|
|
150
181
|
setSearchValueInterceptor("");
|
|
182
|
+
|
|
151
183
|
if (chosenOptions.some(el => el === item.value)) {
|
|
152
184
|
deleteChosen(item.value);
|
|
153
185
|
return null;
|
|
154
186
|
}
|
|
155
|
-
|
|
156
|
-
|
|
187
|
+
|
|
188
|
+
setLocalOptionsStore(options => ({ ...options,
|
|
157
189
|
[item === null || item === void 0 ? void 0 : item.value]: item === null || item === void 0 ? void 0 : item.label
|
|
158
190
|
}));
|
|
159
191
|
onChange([...chosenOptions, item.value], "chosenOptions");
|
|
160
192
|
return null;
|
|
161
193
|
};
|
|
194
|
+
|
|
162
195
|
const onSearchHandler = name => {
|
|
163
196
|
let inputValue = name;
|
|
164
197
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
165
198
|
setSearchValueInterceptor(inputValue);
|
|
166
199
|
};
|
|
200
|
+
|
|
167
201
|
const onWrapperClick = e => {
|
|
168
202
|
if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
|
|
169
203
|
e.stopPropagation();
|
|
@@ -171,14 +205,18 @@ const TagsDropdown = _ref => {
|
|
|
171
205
|
setIsOpen(false);
|
|
172
206
|
}
|
|
173
207
|
};
|
|
208
|
+
|
|
174
209
|
const getMarkupForElement = item => {
|
|
175
210
|
var _title$toString, _item$customMobileIco;
|
|
211
|
+
|
|
176
212
|
const {
|
|
177
213
|
description
|
|
178
214
|
} = item;
|
|
179
215
|
const title = item.title || item.label;
|
|
216
|
+
|
|
180
217
|
const hightlightSearchValue = title => {
|
|
181
218
|
var _title$toLowerCase;
|
|
219
|
+
|
|
182
220
|
const index = (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue.toLowerCase());
|
|
183
221
|
if (index === -1) return title;
|
|
184
222
|
return /*#__PURE__*/_react.default.createElement("pre", {
|
|
@@ -187,8 +225,9 @@ const TagsDropdown = _ref => {
|
|
|
187
225
|
className: "search-match bg--yellow"
|
|
188
226
|
}, title.substring(index, index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))), /*#__PURE__*/_react.default.createElement("span", null, title.substring(index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))));
|
|
189
227
|
};
|
|
228
|
+
|
|
190
229
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
191
|
-
key: title === null || title === void 0
|
|
230
|
+
key: title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.replace(/ /g, "_"),
|
|
192
231
|
onClick: e => {
|
|
193
232
|
e.preventDefault();
|
|
194
233
|
e.stopPropagation();
|
|
@@ -222,11 +261,14 @@ const TagsDropdown = _ref => {
|
|
|
222
261
|
}
|
|
223
262
|
}) : "");
|
|
224
263
|
};
|
|
264
|
+
|
|
225
265
|
const prepareOptions = options => {
|
|
226
266
|
return options === null || options === void 0 ? void 0 : options.map(option => option !== null && option !== void 0 && option.groupName ? option === null || option === void 0 ? void 0 : option.list : option).flat();
|
|
227
267
|
};
|
|
268
|
+
|
|
228
269
|
const selectAllItems = () => {
|
|
229
270
|
var _prepareOptions;
|
|
271
|
+
|
|
230
272
|
const preparedOptions = (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.filter(_ref4 => {
|
|
231
273
|
let {
|
|
232
274
|
isFreezed,
|
|
@@ -250,57 +292,71 @@ const TagsDropdown = _ref => {
|
|
|
250
292
|
})) || [])], "chosenOptions");
|
|
251
293
|
if (isMobile ? closeOnSelectAllMobile : closeOnSelectAll) setIsOpen(false);
|
|
252
294
|
};
|
|
295
|
+
|
|
253
296
|
const unselectAllItems = () => {
|
|
254
297
|
setLocalOptionsStore({});
|
|
255
298
|
onChange(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.filter(item => {
|
|
256
|
-
var _prepareOptions2;
|
|
257
|
-
|
|
299
|
+
var _prepareOptions2, _prepareOptions2$find;
|
|
300
|
+
|
|
301
|
+
return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 ? void 0 : (_prepareOptions2$find = _prepareOptions2.find(_ref7 => {
|
|
258
302
|
let {
|
|
259
303
|
value
|
|
260
304
|
} = _ref7;
|
|
261
305
|
return value === item;
|
|
262
|
-
})) === null || _prepareOptions2 === void 0 ? void 0 : _prepareOptions2.isFreezed;
|
|
306
|
+
})) === null || _prepareOptions2$find === void 0 ? void 0 : _prepareOptions2$find.isFreezed;
|
|
263
307
|
}), "chosenOptions");
|
|
264
308
|
if (isMobile ? closeOnRemoveAllMobile : closeOnRemoveAll) setIsOpen(false);
|
|
265
309
|
};
|
|
310
|
+
|
|
266
311
|
const getParentNode = () => {
|
|
267
312
|
var _ref8, _document$querySelect;
|
|
313
|
+
|
|
268
314
|
return (_ref8 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref8 !== void 0 ? _ref8 : document.querySelector("div#storybook-root");
|
|
269
315
|
};
|
|
316
|
+
|
|
270
317
|
const initListContainer = () => {
|
|
271
318
|
const dropdownList = document.createElement("div");
|
|
272
319
|
dropdownList.setAttribute("id", dropdownId);
|
|
273
320
|
dropdownList.classList.add("tags-dropdown__container");
|
|
321
|
+
|
|
274
322
|
if (isMobile) {
|
|
275
323
|
dropdownList.addEventListener("click", e => {
|
|
276
324
|
if (e.target.id === dropdownId) setIsOpen(false);
|
|
277
325
|
});
|
|
278
326
|
}
|
|
327
|
+
|
|
279
328
|
if (isMobile) {
|
|
280
329
|
var _getParentNode;
|
|
330
|
+
|
|
281
331
|
try {
|
|
282
332
|
var _document$getElementB;
|
|
283
|
-
|
|
284
|
-
// eslint-disable-next-line no-empty
|
|
333
|
+
|
|
334
|
+
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove(); // eslint-disable-next-line no-empty
|
|
285
335
|
} catch (e) {}
|
|
336
|
+
|
|
286
337
|
const dropdownMobileListWrapper = document.createElement("div");
|
|
287
338
|
dropdownMobileListWrapper.classList.add("tags-dropdown-mobile");
|
|
288
339
|
dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
|
|
289
|
-
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0
|
|
290
|
-
(_getParentNode = getParentNode()) === null || _getParentNode === void 0
|
|
340
|
+
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 ? void 0 : dropdownMobileListWrapper.append(dropdownList);
|
|
341
|
+
(_getParentNode = getParentNode()) === null || _getParentNode === void 0 ? void 0 : _getParentNode.append(dropdownMobileListWrapper);
|
|
291
342
|
} else {
|
|
292
343
|
var _getParentNode2;
|
|
293
|
-
|
|
344
|
+
|
|
345
|
+
(_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
|
|
294
346
|
}
|
|
295
347
|
};
|
|
348
|
+
|
|
296
349
|
const getListContainer = () => {
|
|
297
350
|
return document.getElementById(dropdownId);
|
|
298
351
|
};
|
|
352
|
+
|
|
299
353
|
const getListContainerWrapper = () => {
|
|
300
354
|
return document.getElementById("mlw-".concat(dropdownId));
|
|
301
355
|
};
|
|
356
|
+
|
|
302
357
|
const setListContainerStyles = () => {
|
|
303
|
-
var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$max, _getComputedStyle2, _dl$getBoundingClient, _sw$getBoundingClient, _sw$getBoundingClient2, _lh$getBoundingClient, _lf$getBoundingClient;
|
|
358
|
+
var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _dl$getBoundingClient, _sw$getBoundingClient, _sw$getBoundingClient2, _lh$getBoundingClient, _lf$getBoundingClient;
|
|
359
|
+
|
|
304
360
|
const lc = getListContainer();
|
|
305
361
|
if (!lc || !isOpen) return false;
|
|
306
362
|
const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
@@ -309,75 +365,87 @@ const TagsDropdown = _ref => {
|
|
|
309
365
|
height,
|
|
310
366
|
left,
|
|
311
367
|
top
|
|
312
|
-
} = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0
|
|
368
|
+
} = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
|
|
313
369
|
const sw = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current;
|
|
314
370
|
const dl = lc.getElementsByClassName("tags-dropdown__list")[0];
|
|
315
371
|
const lh = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName("tags-dropdown__header")[0];
|
|
316
372
|
const lf = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName("tags-dropdown__footer")[0];
|
|
317
|
-
const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0
|
|
318
|
-
const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(dl)) === null || _getComputedStyle2 === void 0
|
|
373
|
+
const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0 ? void 0 : (_getComputedStyle$mar2 = _getComputedStyle.marginTop) === null || _getComputedStyle$mar2 === void 0 ? void 0 : _getComputedStyle$mar2.replace("px", "")) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0, 10);
|
|
374
|
+
const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(dl)) === null || _getComputedStyle2 === void 0 ? void 0 : (_getComputedStyle2$ma = _getComputedStyle2.maxHeight) === null || _getComputedStyle2$ma === void 0 ? void 0 : _getComputedStyle2$ma.replace("px", "")) !== null && _getComputedStyle$max !== void 0 ? _getComputedStyle$max : 0, 10);
|
|
319
375
|
if (initListHeight === null) setInitListHeight(maxHeight);
|
|
320
376
|
const toTop = top - margin;
|
|
321
377
|
const toBottom = windowHeight - top - height - margin * 2;
|
|
322
|
-
const dlHeight = dl === null || dl === void 0
|
|
323
|
-
let swHeight = sw === null || sw === void 0
|
|
378
|
+
const dlHeight = dl === null || dl === void 0 ? void 0 : (_dl$getBoundingClient = dl.getBoundingClientRect()) === null || _dl$getBoundingClient === void 0 ? void 0 : _dl$getBoundingClient.height;
|
|
379
|
+
let swHeight = sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
|
|
324
380
|
const controlsHeight = swHeight - dlHeight;
|
|
325
381
|
if (swHeight > maxHeight) swHeight = maxHeight - 2 * margin;
|
|
326
|
-
const maxSwHeight = (sw === null || sw === void 0
|
|
382
|
+
const maxSwHeight = (sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient2 = sw.getBoundingClientRect()) === null || _sw$getBoundingClient2 === void 0 ? void 0 : _sw$getBoundingClient2.height) - (lh === null || lh === void 0 ? void 0 : (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) - (lf === null || lf === void 0 ? void 0 : (_lf$getBoundingClient = lf.getBoundingClientRect()) === null || _lf$getBoundingClient === void 0 ? void 0 : _lf$getBoundingClient.height);
|
|
327
383
|
const listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
|
|
328
384
|
if (swHeight > (listPos === "top" ? toTop : toBottom)) swHeight = (listPos === "top" ? toTop : toBottom) - 3 * margin;
|
|
329
385
|
lc.style.minWidth = "".concat(width, "px");
|
|
330
386
|
lc.style.left = "".concat(left, "px");
|
|
331
387
|
lc.style.top = "".concat(listPos === "bottom" ? top + height : top - swHeight - 2 * margin, "px");
|
|
388
|
+
|
|
332
389
|
if (isMobile) {
|
|
333
390
|
dl.style.maxHeight = "".concat(maxSwHeight, "px");
|
|
334
391
|
}
|
|
335
392
|
};
|
|
393
|
+
|
|
336
394
|
const renderListContainer = () => {
|
|
337
395
|
const lc = getListContainer();
|
|
338
|
-
if (!lc) return null;
|
|
396
|
+
if (!lc) return null; // eslint-disable-next-line no-use-before-define
|
|
339
397
|
|
|
340
|
-
// eslint-disable-next-line no-use-before-define
|
|
341
398
|
return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
|
|
342
399
|
};
|
|
400
|
+
|
|
343
401
|
const isTargetInParent = target => {
|
|
344
402
|
var _target$className, _target$className$ind, _target$className2, _target$className2$in;
|
|
403
|
+
|
|
345
404
|
if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) === "tag__button" || (target === null || target === void 0 ? void 0 : target.tagName) === "line") return false;
|
|
346
|
-
if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) !== "tag__button" || (target === null || target === void 0
|
|
405
|
+
if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) !== "tag__button" || (target === null || target === void 0 ? void 0 : (_target$className = target.className) === null || _target$className === void 0 ? void 0 : (_target$className$ind = _target$className.indexOf) === null || _target$className$ind === void 0 ? void 0 : _target$className$ind.call(_target$className, "tag__label")) !== -1 || (target === null || target === void 0 ? void 0 : (_target$className2 = target.className) === null || _target$className2 === void 0 ? void 0 : (_target$className2$in = _target$className2.indexOf) === null || _target$className2$in === void 0 ? void 0 : _target$className2$in.call(_target$className2, "tag-list_wrapper")) !== -1 || (target === null || target === void 0 ? void 0 : target.className) === "".concat(RC, "__trigger") || (target === null || target === void 0 ? void 0 : target.className) === "tags-dropdown__arrow") return true;
|
|
347
406
|
return false;
|
|
348
407
|
};
|
|
408
|
+
|
|
349
409
|
const isItemMatchesSearch = item => {
|
|
350
410
|
const title = item.title || item.label;
|
|
351
411
|
return searchValue.length ? title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") : true;
|
|
352
412
|
};
|
|
413
|
+
|
|
353
414
|
const getFilteredOptions = options => options === null || options === void 0 ? void 0 : options.reduce((result, option) => {
|
|
354
415
|
if (option.groupName) {
|
|
355
416
|
var _option$list;
|
|
356
|
-
|
|
417
|
+
|
|
418
|
+
const filteredGroupItems = option === null || option === void 0 ? void 0 : (_option$list = option.list) === null || _option$list === void 0 ? void 0 : _option$list.filter(item => isItemMatchesSearch(item));
|
|
419
|
+
|
|
357
420
|
if (filteredGroupItems !== null && filteredGroupItems !== void 0 && filteredGroupItems.length) {
|
|
358
|
-
result.push({
|
|
359
|
-
...option,
|
|
421
|
+
result.push({ ...option,
|
|
360
422
|
list: filteredGroupItems
|
|
361
423
|
});
|
|
362
424
|
}
|
|
363
425
|
} else if (isItemMatchesSearch(option)) {
|
|
364
426
|
result.push(option);
|
|
365
427
|
}
|
|
428
|
+
|
|
366
429
|
return result;
|
|
367
430
|
}, []);
|
|
431
|
+
|
|
368
432
|
const getTotalOptions = (0, _react.useCallback)(() => {
|
|
369
433
|
return options === null || options === void 0 ? void 0 : options.reduce((result, item) => {
|
|
370
434
|
if (item !== null && item !== void 0 && item.list) {
|
|
371
435
|
var _item$list2;
|
|
372
|
-
|
|
436
|
+
|
|
437
|
+
result += (item === null || item === void 0 ? void 0 : (_item$list2 = item.list) === null || _item$list2 === void 0 ? void 0 : _item$list2.length) || 0;
|
|
373
438
|
} else {
|
|
374
439
|
++result;
|
|
375
440
|
}
|
|
441
|
+
|
|
376
442
|
return result;
|
|
377
443
|
}, 0);
|
|
378
444
|
}, [options]);
|
|
445
|
+
|
|
379
446
|
const getListMarkUp = () => {
|
|
380
447
|
var _filteredOptions$filt, _filteredOptions$filt2;
|
|
448
|
+
|
|
381
449
|
const filteredOptions = getFilteredOptions(options);
|
|
382
450
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
383
451
|
className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
|
|
@@ -427,9 +495,10 @@ const TagsDropdown = _ref => {
|
|
|
427
495
|
ref: dropdownListRef,
|
|
428
496
|
className: "".concat(RC, "__list ").concat(headerContent || isMobile ? "".concat(RC, "__list--with-header") : "", " ").concat(footerContent ? "".concat(RC, "__list--with-footer") : "")
|
|
429
497
|
}, filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map(option => {
|
|
430
|
-
var _option$groupName, _option$list2;
|
|
498
|
+
var _option$groupName, _option$groupName$toS, _option$list2;
|
|
499
|
+
|
|
431
500
|
return option.groupName ? /*#__PURE__*/_react.default.createElement("div", {
|
|
432
|
-
key: (_option$groupName = option.groupName) === null || _option$groupName === void 0
|
|
501
|
+
key: (_option$groupName = option.groupName) === null || _option$groupName === void 0 ? void 0 : (_option$groupName$toS = _option$groupName.toString()) === null || _option$groupName$toS === void 0 ? void 0 : _option$groupName$toS.replace(/ /g, "_").concat(Date.now()),
|
|
433
502
|
className: (0, _classnames.default)("".concat(RC, "-group"), option.className)
|
|
434
503
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
435
504
|
className: "".concat(RC, "-group__name")
|
|
@@ -455,11 +524,14 @@ const TagsDropdown = _ref => {
|
|
|
455
524
|
onClick: () => setIsOpen(false)
|
|
456
525
|
}, "Apply", chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.length ? "(".concat(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.length, ")") : "")) : null));
|
|
457
526
|
};
|
|
527
|
+
|
|
458
528
|
const closeList = e => {
|
|
459
529
|
var _inputRef$current;
|
|
530
|
+
|
|
460
531
|
handleClickOutside(e);
|
|
461
|
-
inputRef === null || inputRef === void 0
|
|
532
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.blur();
|
|
462
533
|
};
|
|
534
|
+
|
|
463
535
|
(0, _react.useLayoutEffect)(() => {
|
|
464
536
|
initListContainer();
|
|
465
537
|
}, []);
|
|
@@ -473,6 +545,7 @@ const TagsDropdown = _ref => {
|
|
|
473
545
|
window.removeEventListener("mousewheel", closeList);
|
|
474
546
|
window.removeEventListener("mouseup", handleClickOutside);
|
|
475
547
|
}
|
|
548
|
+
|
|
476
549
|
return () => {
|
|
477
550
|
window.removeEventListener("resize", setListContainerStyles);
|
|
478
551
|
window.removeEventListener("mousewheel", closeList);
|
|
@@ -481,77 +554,105 @@ const TagsDropdown = _ref => {
|
|
|
481
554
|
}, [getListContainer]);
|
|
482
555
|
(0, _react.useLayoutEffect)(() => {
|
|
483
556
|
setListContainerStyles();
|
|
484
|
-
}, [isOpen, chosenOptions, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0
|
|
557
|
+
}, [isOpen, chosenOptions, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : (_dropdownListWrapperR2 = _dropdownListWrapperR.getBoundingClientRect()) === null || _dropdownListWrapperR2 === void 0 ? void 0 : _dropdownListWrapperR2.height]);
|
|
558
|
+
(0, _react.useEffect)(() => {
|
|
559
|
+
if (chosenOptions.length !== Object.keys(localOptionsStore).length) {
|
|
560
|
+
options.map(option => {
|
|
561
|
+
if (!(localOptionsStore !== null && localOptionsStore !== void 0 && localOptionsStore[option === null || option === void 0 ? void 0 : option.value])) {
|
|
562
|
+
setLocalOptionsStore(options => ({ ...options,
|
|
563
|
+
[option === null || option === void 0 ? void 0 : option.value]: option === null || option === void 0 ? void 0 : option.label
|
|
564
|
+
}));
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}, [chosenOptions]);
|
|
485
569
|
(0, _react.useEffect)(() => {
|
|
486
570
|
if (!isMobile) {
|
|
487
571
|
document.addEventListener("click", handleClickOutside, true);
|
|
488
572
|
} else {
|
|
489
573
|
document.removeEventListener("click", handleClickOutside, true);
|
|
490
574
|
}
|
|
575
|
+
|
|
491
576
|
return () => document.removeEventListener("click", handleClickOutside, true);
|
|
492
577
|
}, [isMobile]);
|
|
493
578
|
(0, _react.useEffect)(() => {
|
|
494
579
|
var _selectAllButtonRef$c, _unselectAllButtonRef;
|
|
580
|
+
|
|
495
581
|
const fn = isOpen ? "addEventListener" : "removeEventListener";
|
|
496
|
-
selectAllButtonRef === null || selectAllButtonRef === void 0
|
|
497
|
-
unselectAllButtonRef === null || unselectAllButtonRef === void 0
|
|
582
|
+
selectAllButtonRef === null || selectAllButtonRef === void 0 ? void 0 : (_selectAllButtonRef$c = selectAllButtonRef.current) === null || _selectAllButtonRef$c === void 0 ? void 0 : _selectAllButtonRef$c[fn]("click", selectAllItems, true);
|
|
583
|
+
unselectAllButtonRef === null || unselectAllButtonRef === void 0 ? void 0 : (_unselectAllButtonRef = unselectAllButtonRef.current) === null || _unselectAllButtonRef === void 0 ? void 0 : _unselectAllButtonRef[fn]("click", unselectAllItems, true);
|
|
584
|
+
|
|
498
585
|
if (isOpen) {
|
|
499
586
|
var _getListContainer2;
|
|
500
|
-
|
|
587
|
+
|
|
588
|
+
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.classList.add("tags-dropdown__container--opened");
|
|
501
589
|
} else {
|
|
502
590
|
var _getListContainer3;
|
|
503
|
-
|
|
591
|
+
|
|
592
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.classList.remove("tags-dropdown__container--opened");
|
|
504
593
|
}
|
|
505
594
|
}, [isOpen]);
|
|
506
595
|
(0, _react.useEffect)(() => {
|
|
507
596
|
if (isOpen && isMobile, dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
508
597
|
var _dropdownListRef$curr, _dropdownListRef$curr2;
|
|
509
|
-
|
|
598
|
+
|
|
599
|
+
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));
|
|
600
|
+
|
|
510
601
|
if (isScrollableList === null) {
|
|
511
602
|
var _dropdownListRef$curr3, _dropdownListRef$curr4;
|
|
512
|
-
|
|
603
|
+
|
|
604
|
+
setIsFixedMaxHeight((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));
|
|
513
605
|
}
|
|
514
606
|
}
|
|
607
|
+
|
|
515
608
|
if (isOpen && dropdownListRef && dropdownListRef.current) {
|
|
516
609
|
dropdownListRef.current.addEventListener("scroll", doScrollCallback);
|
|
517
610
|
}
|
|
611
|
+
|
|
518
612
|
return () => {
|
|
519
613
|
removeEventListener("scroll", doScrollCallback);
|
|
520
614
|
};
|
|
521
|
-
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0
|
|
615
|
+
}, [isOpen, isMobile, 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]);
|
|
522
616
|
(0, _react.useEffect)(() => {
|
|
523
617
|
const setScrollTopValue = e => {
|
|
524
618
|
setScrollTop(parseInt(e.target.scrollTop, 10));
|
|
525
619
|
};
|
|
620
|
+
|
|
526
621
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
527
622
|
var _dropdownListRef$curr7;
|
|
528
|
-
|
|
623
|
+
|
|
624
|
+
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
529
625
|
}
|
|
626
|
+
|
|
530
627
|
return () => {
|
|
531
628
|
var _dropdownListRef$curr8;
|
|
532
|
-
|
|
629
|
+
|
|
630
|
+
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
533
631
|
};
|
|
534
632
|
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
535
633
|
(0, _react.useEffect)(() => {
|
|
536
634
|
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
537
635
|
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
538
|
-
|
|
636
|
+
|
|
637
|
+
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));
|
|
539
638
|
}
|
|
540
639
|
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
541
640
|
(0, _react.useEffect)(() => {
|
|
542
641
|
return () => {
|
|
543
642
|
var _getListContainer4, _getListContainerWrap;
|
|
544
|
-
|
|
545
|
-
(
|
|
643
|
+
|
|
644
|
+
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.remove();
|
|
645
|
+
(_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 ? void 0 : _getListContainerWrap.remove();
|
|
546
646
|
};
|
|
547
647
|
}, []);
|
|
548
648
|
(0, _react.useEffect)(() => {
|
|
549
|
-
if (isSearchable && useLiveSearch && debouncedSearchTerm || isValueDeleted) {
|
|
550
|
-
doLiveSearchRequest === null || doLiveSearchRequest === void 0
|
|
649
|
+
if (isSearchable && useLiveSearch && (debouncedSearchTerm || isValueDeleted || isOpen)) {
|
|
650
|
+
doLiveSearchRequest === null || doLiveSearchRequest === void 0 ? void 0 : doLiveSearchRequest(debouncedSearchTerm);
|
|
551
651
|
}
|
|
552
|
-
}, [debouncedSearchTerm, isValueDeleted]);
|
|
652
|
+
}, [isOpen, debouncedSearchTerm, isValueDeleted]);
|
|
553
653
|
(0, _react.useLayoutEffect)(() => {
|
|
554
654
|
var _getListContainer5;
|
|
655
|
+
|
|
555
656
|
if (!isMobile) {
|
|
556
657
|
window.addEventListener("resize", setListContainerStyles);
|
|
557
658
|
window.addEventListener("mousewheel", closeList);
|
|
@@ -563,14 +664,16 @@ const TagsDropdown = _ref => {
|
|
|
563
664
|
window.removeEventListener("scroll", closeList);
|
|
564
665
|
window.removeEventListener("touchmove", closeList);
|
|
565
666
|
}
|
|
566
|
-
|
|
667
|
+
|
|
668
|
+
(_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 ? void 0 : _getListContainer5.addEventListener("click", closeList);
|
|
567
669
|
return () => {
|
|
568
670
|
var _getListContainer6;
|
|
671
|
+
|
|
569
672
|
window.removeEventListener("resize", setListContainerStyles);
|
|
570
673
|
window.removeEventListener("mousewheel", closeList);
|
|
571
674
|
window.removeEventListener("scroll", closeList);
|
|
572
675
|
window.removeEventListener("touchmove", closeList);
|
|
573
|
-
(_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0
|
|
676
|
+
(_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 ? void 0 : _getListContainer6.removeEventListener("click", closeList);
|
|
574
677
|
};
|
|
575
678
|
}, [getListContainer]);
|
|
576
679
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -624,7 +727,8 @@ const TagsDropdown = _ref => {
|
|
|
624
727
|
onKeyDown: e => onKeyPress(e, searchValue),
|
|
625
728
|
onFocus: e => {
|
|
626
729
|
var _e$target;
|
|
627
|
-
|
|
730
|
+
|
|
731
|
+
if (isMobile) e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.blur();
|
|
628
732
|
}
|
|
629
733
|
}, attributesOfNativeInput)) : "", isOpen && renderListContainer(), /*#__PURE__*/_react.default.createElement("span", {
|
|
630
734
|
className: (0, _classnames.default)("".concat(RC, "__arrow"), {
|
|
@@ -638,4 +742,6 @@ const TagsDropdown = _ref => {
|
|
|
638
742
|
className: "color--text"
|
|
639
743
|
}))));
|
|
640
744
|
};
|
|
641
|
-
|
|
745
|
+
|
|
746
|
+
var _default = TagsDropdown;
|
|
747
|
+
exports.default = _default;
|