@expressms/smartapp-ui 3.0.0-alpha.19 → 3.0.0-alpha.190
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/build/main/assets/icons/accepted-invite-status.svg +4 -0
- package/build/main/assets/icons/chevron.svg +3 -0
- package/build/main/assets/icons/close-modal.svg +1 -1
- package/build/main/assets/icons/copy.svg +3 -0
- package/build/main/assets/icons/declined-invite-status.svg +4 -0
- package/build/main/assets/icons/department.svg +3 -0
- package/build/main/assets/icons/doc-small.svg +5 -5
- package/build/main/assets/icons/download.svg +3 -0
- package/build/main/assets/icons/file-small.svg +5 -5
- package/build/main/assets/icons/file.svg +1 -1
- package/build/main/assets/icons/image-no-preview-small.svg +11 -0
- package/build/main/assets/icons/image-no-preview.svg +11 -0
- package/build/main/assets/icons/job-position.svg +3 -0
- package/build/main/assets/icons/needs-action-invite-status.svg +4 -0
- package/build/main/assets/icons/notification-close.svg +1 -1
- package/build/main/assets/icons/notification-error.svg +5 -0
- package/build/main/assets/icons/notification-failure-filled.svg +3 -0
- package/build/main/assets/icons/notification-info-filled.svg +5 -0
- package/build/main/assets/icons/notification-success-filled.svg +4 -0
- package/build/main/assets/icons/office.svg +3 -0
- package/build/main/assets/icons/pdf-small.svg +5 -5
- package/build/main/assets/icons/ppt-small.svg +5 -5
- package/build/main/assets/icons/private.svg +4 -11
- package/build/main/assets/icons/search.svg +1 -1
- package/build/main/assets/icons/select-arrow-down.svg +3 -0
- package/build/main/assets/icons/select-arrow-up.svg +3 -0
- package/build/main/assets/icons/server.svg +3 -0
- package/build/main/assets/icons/txt-small.svg +5 -5
- package/build/main/assets/icons/video-no-preview-small.svg +11 -0
- package/build/main/assets/icons/video-no-preview.svg +11 -0
- package/build/main/assets/icons/xls-small.svg +5 -5
- package/build/main/assets/storybook/index.d.ts +3 -0
- package/build/main/assets/storybook/index.js +3 -0
- package/build/main/assets/storybook/index.js.map +1 -1
- package/build/main/constants/constants.d.ts +91 -46
- package/build/main/constants/constants.js +132 -49
- package/build/main/constants/constants.js.map +1 -1
- package/build/main/constants/types.d.ts +11 -1
- package/build/main/helpers/index.d.ts +3 -1
- package/build/main/helpers/index.js +21 -2
- package/build/main/helpers/index.js.map +1 -1
- package/build/main/hooks/useCharHintDisplay.d.ts +9 -0
- package/build/main/hooks/useCharHintDisplay.js +35 -0
- package/build/main/hooks/useCharHintDisplay.js.map +1 -0
- package/build/main/hooks/useMobileLongTap.d.ts +16 -0
- package/build/main/hooks/useMobileLongTap.js +65 -0
- package/build/main/hooks/useMobileLongTap.js.map +1 -0
- package/build/main/hooks/useModal.d.ts +18 -10
- package/build/main/hooks/useModal.js +199 -12
- package/build/main/hooks/useModal.js.map +1 -1
- package/build/main/index.d.ts +2 -0
- package/build/main/index.js +2 -0
- package/build/main/index.js.map +1 -1
- package/build/main/styles/styles.scss +2 -2
- package/build/main//321/201omponents/ActionModal/ActionModal.js +1 -1
- package/build/main//321/201omponents/ActionModal/ActionModal.js.map +1 -1
- package/build/main//321/201omponents/AttachedFile/AttachedFile.d.ts +1 -1
- package/build/main//321/201omponents/AttachedFile/AttachedFile.js +84 -26
- package/build/main//321/201omponents/AttachedFile/AttachedFile.js.map +1 -1
- package/build/main//321/201omponents/AttachedFile/types.d.ts +1 -0
- package/build/main//321/201omponents/Avatar/Avatar.d.ts +3 -2
- package/build/main//321/201omponents/Avatar/Avatar.js +56 -27
- package/build/main//321/201omponents/Avatar/Avatar.js.map +1 -1
- package/build/main//321/201omponents/Avatar/types.d.ts +9 -5
- package/build/main//321/201omponents/Avatar/types.js +5 -2
- package/build/main//321/201omponents/Avatar/types.js.map +1 -1
- package/build/main//321/201omponents/Button/Button.d.ts +1 -1
- package/build/main//321/201omponents/Button/Button.js +16 -10
- package/build/main//321/201omponents/Button/Button.js.map +1 -1
- package/build/main//321/201omponents/Button/types.d.ts +9 -2
- package/build/main//321/201omponents/Button/types.js +3 -0
- package/build/main//321/201omponents/Button/types.js.map +1 -1
- package/build/main//321/201omponents/Calendar/Calendar.d.ts +14 -2
- package/build/main//321/201omponents/Calendar/Calendar.js +203 -62
- package/build/main//321/201omponents/Calendar/Calendar.js.map +1 -1
- package/build/main//321/201omponents/Calendar/types.d.ts +18 -5
- package/build/main//321/201omponents/Charts/ChartBar/ChartBar.js +1 -1
- package/build/main//321/201omponents/Charts/ChartLine/ChartLine.js +1 -1
- package/build/main//321/201omponents/Charts/ChartPie/ChartPie.js +1 -1
- package/build/main//321/201omponents/Chip/Chip.d.ts +3 -2
- package/build/main//321/201omponents/Chip/Chip.js +210 -45
- package/build/main//321/201omponents/Chip/Chip.js.map +1 -1
- package/build/main//321/201omponents/Chip/types.d.ts +14 -4
- package/build/main//321/201omponents/ChipDndContext/ChipDndContext.d.ts +13 -0
- package/build/main//321/201omponents/ChipDndContext/ChipDndContext.js +76 -0
- package/build/main//321/201omponents/ChipDndContext/ChipDndContext.js.map +1 -0
- package/build/main//321/201omponents/ChipDndContext/index.d.ts +1 -0
- package/build/main//321/201omponents/ChipDndContext/index.js +2 -0
- package/build/main//321/201omponents/ChipDndContext/index.js.map +1 -0
- package/build/main//321/201omponents/ConfirmationModal/ConfirmationModal.d.ts +1 -1
- package/build/main//321/201omponents/ConfirmationModal/ConfirmationModal.js +3 -2
- package/build/main//321/201omponents/ConfirmationModal/ConfirmationModal.js.map +1 -1
- package/build/main//321/201omponents/ConfirmationModal/types.d.ts +5 -2
- package/build/main//321/201omponents/ContextMenu/ContextMenu.d.ts +1 -1
- package/build/main//321/201omponents/ContextMenu/ContextMenu.js +68 -27
- package/build/main//321/201omponents/ContextMenu/ContextMenu.js.map +1 -1
- package/build/main//321/201omponents/ContextMenu/types.d.ts +14 -7
- package/build/main//321/201omponents/ContextMenuItem/ContextMenuItem.d.ts +4 -0
- package/build/main//321/201omponents/ContextMenuItem/ContextMenuItem.js +49 -0
- package/build/main//321/201omponents/ContextMenuItem/ContextMenuItem.js.map +1 -0
- package/build/main//321/201omponents/ContextMenuItem/index.d.ts +1 -0
- package/build/main//321/201omponents/ContextMenuItem/index.js +2 -0
- package/build/main//321/201omponents/ContextMenuItem/index.js.map +1 -0
- package/build/main//321/201omponents/ContextMenuItem/types.d.ts +28 -0
- package/build/main//321/201omponents/ContextMenuItem/types.js +6 -0
- package/build/main//321/201omponents/ContextMenuItem/types.js.map +1 -0
- package/build/main//321/201omponents/CustomSelect/CustomSelect.d.ts +1 -1
- package/build/main//321/201omponents/CustomSelect/CustomSelect.js +55 -22
- package/build/main//321/201omponents/CustomSelect/CustomSelect.js.map +1 -1
- package/build/main//321/201omponents/CustomSelect/selectStyles.d.ts +1 -1
- package/build/main//321/201omponents/CustomSelect/selectStyles.js +33 -26
- package/build/main//321/201omponents/CustomSelect/selectStyles.js.map +1 -1
- package/build/main//321/201omponents/CustomSelect/types.d.ts +21 -4
- package/build/main//321/201omponents/CustomSelectProfiles/CustomSelectProfiles.d.ts +1 -1
- package/build/main//321/201omponents/CustomSelectProfiles/CustomSelectProfiles.js +33 -24
- package/build/main//321/201omponents/CustomSelectProfiles/CustomSelectProfiles.js.map +1 -1
- package/build/main//321/201omponents/CustomSelectProfiles/selectStyles.d.ts +11 -0
- package/build/main//321/201omponents/CustomSelectProfiles/selectStyles.js +39 -0
- package/build/main//321/201omponents/CustomSelectProfiles/selectStyles.js.map +1 -0
- package/build/main//321/201omponents/CustomSelectProfiles/types.d.ts +6 -5
- package/build/main//321/201omponents/DragAndDrop/DragAndDrop.js +2 -2
- package/build/main//321/201omponents/DragAndDrop/DragAndDrop.js.map +1 -1
- package/build/main//321/201omponents/DraggablePopup/DraggablePopup.d.ts +1 -1
- package/build/main//321/201omponents/DraggablePopup/DraggablePopup.js +24 -18
- package/build/main//321/201omponents/DraggablePopup/DraggablePopup.js.map +1 -1
- package/build/main//321/201omponents/DraggablePopup/types.d.ts +8 -8
- package/build/main//321/201omponents/Flex/Flex.d.ts +1 -1
- package/build/main//321/201omponents/Flex/Flex.js +2 -2
- package/build/main//321/201omponents/Flex/Flex.js.map +1 -1
- package/build/main//321/201omponents/Flex/types.d.ts +2 -0
- package/build/main//321/201omponents/Input/Input.d.ts +1 -1
- package/build/main//321/201omponents/Input/Input.js +89 -31
- package/build/main//321/201omponents/Input/Input.js.map +1 -1
- package/build/main//321/201omponents/Input/types.d.ts +10 -3
- package/build/main//321/201omponents/ListItem/ListItem.js +21 -10
- package/build/main//321/201omponents/ListItem/ListItem.js.map +1 -1
- package/build/main//321/201omponents/ListItem/types.d.ts +8 -2
- package/build/main//321/201omponents/Modal/Modal.d.ts +3 -2
- package/build/main//321/201omponents/Modal/Modal.js +169 -76
- package/build/main//321/201omponents/Modal/Modal.js.map +1 -1
- package/build/main//321/201omponents/Modal/types.d.ts +35 -2
- package/build/main//321/201omponents/Notification/Notification.d.ts +4 -6
- package/build/main//321/201omponents/Notification/Notification.js +88 -30
- package/build/main//321/201omponents/Notification/Notification.js.map +1 -1
- package/build/main//321/201omponents/Notification/types.d.ts +23 -5
- package/build/main//321/201omponents/Skeleton/Skeleton.js +1 -1
- package/build/main//321/201omponents/Skeleton/Skeleton.js.map +1 -1
- package/build/main//321/201omponents/Stories/Stories.js +72 -4
- package/build/main//321/201omponents/Stories/Stories.js.map +1 -1
- package/build/main//321/201omponents/Textarea/Textarea.d.ts +1 -1
- package/build/main//321/201omponents/Textarea/Textarea.js +2 -2
- package/build/main//321/201omponents/Textarea/Textarea.js.map +1 -1
- package/build/main//321/201omponents/Textarea/types.d.ts +2 -2
- package/build/main//321/201omponents/UserDropdown/ContactBottomSheet/ContactBottomSheet.d.ts +1 -1
- package/build/main//321/201omponents/UserDropdown/ContactBottomSheet/ContactBottomSheet.js +12 -2
- package/build/main//321/201omponents/UserDropdown/ContactBottomSheet/ContactBottomSheet.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/ContactInfo/ContactInfo.js +28 -12
- package/build/main//321/201omponents/UserDropdown/ContactInfo/ContactInfo.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/LoadingMessage/LoadingMessage.d.ts +2 -1
- package/build/main//321/201omponents/UserDropdown/LoadingMessage/LoadingMessage.js +4 -3
- package/build/main//321/201omponents/UserDropdown/LoadingMessage/LoadingMessage.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/MenuList/MenuList.js +35 -59
- package/build/main//321/201omponents/UserDropdown/MenuList/MenuList.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/MultiValueLabel/MultiValueLabel.d.ts +3 -2
- package/build/main//321/201omponents/UserDropdown/MultiValueLabel/MultiValueLabel.js +34 -37
- package/build/main//321/201omponents/UserDropdown/MultiValueLabel/MultiValueLabel.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/Option/Option.js +16 -11
- package/build/main//321/201omponents/UserDropdown/Option/Option.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/SearchInCatalogButton/SearchInCatalogButton.d.ts +1 -1
- package/build/main//321/201omponents/UserDropdown/SearchInCatalogButton/SearchInCatalogButton.js +7 -9
- package/build/main//321/201omponents/UserDropdown/SearchInCatalogButton/SearchInCatalogButton.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/UserDropdown.d.ts +3 -3
- package/build/main//321/201omponents/UserDropdown/UserDropdown.js +238 -263
- package/build/main//321/201omponents/UserDropdown/UserDropdown.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/components/Delimiter.d.ts +8 -0
- package/build/main//321/201omponents/UserDropdown/components/Delimiter.js +10 -0
- package/build/main//321/201omponents/UserDropdown/components/Delimiter.js.map +1 -0
- package/build/main//321/201omponents/UserDropdown/components/Hint.d.ts +6 -0
- package/build/main//321/201omponents/UserDropdown/components/Hint.js +21 -0
- package/build/main//321/201omponents/UserDropdown/components/Hint.js.map +1 -0
- package/build/main//321/201omponents/UserDropdown/components/Input.d.ts +2 -0
- package/build/main//321/201omponents/UserDropdown/components/Input.js +24 -0
- package/build/main//321/201omponents/UserDropdown/components/Input.js.map +1 -0
- package/build/main//321/201omponents/UserDropdown/components/Mask.d.ts +7 -0
- package/build/main//321/201omponents/UserDropdown/components/Mask.js +18 -0
- package/build/main//321/201omponents/UserDropdown/components/Mask.js.map +1 -0
- package/build/main//321/201omponents/UserDropdown/components/Title.d.ts +5 -0
- package/build/main//321/201omponents/UserDropdown/components/Title.js +18 -0
- package/build/main//321/201omponents/UserDropdown/components/Title.js.map +1 -0
- package/build/main//321/201omponents/UserDropdown/constants.d.ts +57 -0
- package/build/main//321/201omponents/UserDropdown/constants.js +73 -0
- package/build/main//321/201omponents/UserDropdown/constants.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/helpers.d.ts +84 -41
- package/build/main//321/201omponents/UserDropdown/helpers.js +184 -14
- package/build/main//321/201omponents/UserDropdown/helpers.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/selectStyles.d.ts +1 -1
- package/build/main//321/201omponents/UserDropdown/selectStyles.js +54 -27
- package/build/main//321/201omponents/UserDropdown/selectStyles.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/types.d.ts +144 -60
- package/build/main//321/201omponents/UserDropdown/types.js +1 -8
- package/build/main//321/201omponents/UserDropdown/types.js.map +1 -1
- package/package.json +11 -7
- package/build/main/assets/icons/avatar-arrow-down.svg +0 -3
- package/build/main/assets/icons/avatar-arrow-up.svg +0 -3
- package/build/main/hooks/useLongTap.d.ts +0 -12
- package/build/main/hooks/useLongTap.js +0 -29
- package/build/main/hooks/useLongTap.js.map +0 -1
|
@@ -20,12 +20,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
};
|
|
21
21
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
/* eslint-disable max-lines */
|
|
23
|
-
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23
|
+
import { memo, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24
24
|
import Select, { components } from 'react-select';
|
|
25
25
|
import classNames from 'classnames';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
26
|
+
import { debounce, includes, isArray, isEmpty, isNil, isNull, omit, pick, uniqBy } from 'lodash';
|
|
27
|
+
import { useDroppable } from '@dnd-kit/core';
|
|
28
|
+
import { useCharHintDisplay } from '../../hooks/useCharHintDisplay';
|
|
29
29
|
import Modal from '../Modal';
|
|
30
30
|
import ContactBottomSheet from './ContactBottomSheet/ContactBottomSheet';
|
|
31
31
|
import LoadingMessage from './LoadingMessage/LoadingMessage';
|
|
@@ -34,100 +34,80 @@ import MultiValueLabel from './MultiValueLabel/MultiValueLabel';
|
|
|
34
34
|
import Option from './Option/Option';
|
|
35
35
|
import SearchInCatalogButton from './SearchInCatalogButton/SearchInCatalogButton';
|
|
36
36
|
import selectStyles from './selectStyles';
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
37
|
+
import Delimiter from './components/Delimiter';
|
|
38
|
+
import Hint from './components/Hint';
|
|
39
|
+
import Input from './components/Input';
|
|
40
|
+
import Mask from './components/Mask';
|
|
41
|
+
import Title from './components/Title';
|
|
42
|
+
import { checkIfContactTypeIsGroup, generateFontFamilyStyle, generateId, isIosPlatform, isMobilePlatform } from '../../helpers';
|
|
43
|
+
import { DropdownIndicator, IndicatorSeparator, LoadingIndicator, MultiValueRemove, applyFilteringToOption, calculateHorizontalPadding, checkIsValueIsEmail, collapseChips, extractInputEmails, generateContactsOptionsToSelect, generateCorporateOptionsToSelect, generateEnteredByUserOption, retrieveChipsElements, retrieveFilteredContacts, setCaretInEmptyInput, setCaretPosition, transformSelectedEntity, transformSelectedUsers, unCollapseChips, } from './helpers';
|
|
44
|
+
import { BACKSPACE_KEY, EMAIL_FIELD, EMPTY_STRING, ENTER_KEY, EVENT_LISTENER_TYPES, LANGUAGES, LAYOUT_TYPE, MENU_POSITIONS, MIN_INPUT_SYMBOLS, PLATFORM, RENDER_DELAY, SEARCH_PLACEHOLDER, SPACE, SPACE_KEY, } from '../../constants';
|
|
45
|
+
import { CLEAR_USER_TYPING_TIMEOUT, COMMON_FIELDS_TO_OMIT, COMMON_FIELDS_TO_PICK, DEFAULT_MAX_ROWS_COUNT_TO_COLLAPSE_CHIPS, DEFAULT_MENU_LIST_MAX_HEIGHT, EMAIL_SEPARATORS, INPUT_ACTIONS, MENU_ACTIONS, PADDING_WITH_CLEAR_ICON, USER_TYPING_TIMEOUT, } from './constants';
|
|
40
46
|
import '../../styles/styles.scss';
|
|
41
|
-
var MIN_INPUT_SYMBOLS = 3;
|
|
42
|
-
var THREE_DIGIT_NUMBER_WIDTH = 48;
|
|
43
|
-
var TWO_DIGIT_NUMBER_WIDTH = 40;
|
|
44
|
-
var SINGLE_DIGIT_NUMBER_WIDTH = 32;
|
|
45
|
-
var INPUT_SPACE_WIDTH = 46;
|
|
46
|
-
var GAP = 8;
|
|
47
|
-
var USER_TYPING_TIMEOUT = 1000;
|
|
48
|
-
export var EMAIL_FIELD = 'email';
|
|
49
|
-
var MENU_ACTIONS;
|
|
50
|
-
(function (MENU_ACTIONS) {
|
|
51
|
-
MENU_ACTIONS["close"] = "menu-close";
|
|
52
|
-
})(MENU_ACTIONS || (MENU_ACTIONS = {}));
|
|
53
|
-
var INPUT_ACTIONS;
|
|
54
|
-
(function (INPUT_ACTIONS) {
|
|
55
|
-
INPUT_ACTIONS["change"] = "input-change";
|
|
56
|
-
INPUT_ACTIONS["blur"] = "input-blur";
|
|
57
|
-
})(INPUT_ACTIONS || (INPUT_ACTIONS = {}));
|
|
58
|
-
var EMAIL_SEPARATORS;
|
|
59
|
-
(function (EMAIL_SEPARATORS) {
|
|
60
|
-
EMAIL_SEPARATORS["semicolon"] = ";";
|
|
61
|
-
EMAIL_SEPARATORS["comma"] = ",";
|
|
62
|
-
})(EMAIL_SEPARATORS || (EMAIL_SEPARATORS = {}));
|
|
63
|
-
var EXCLUDED_FIELDS;
|
|
64
|
-
(function (EXCLUDED_FIELDS) {
|
|
65
|
-
EXCLUDED_FIELDS["value"] = "value";
|
|
66
|
-
EXCLUDED_FIELDS["label"] = "label";
|
|
67
|
-
EXCLUDED_FIELDS["layoutType"] = "layoutType";
|
|
68
|
-
EXCLUDED_FIELDS["platform"] = "platform";
|
|
69
|
-
EXCLUDED_FIELDS["language"] = "language";
|
|
70
|
-
EXCLUDED_FIELDS["isEnteredByUser"] = "isEnteredByUser";
|
|
71
|
-
EXCLUDED_FIELDS["isMyContacts"] = "isMyContacts";
|
|
72
|
-
EXCLUDED_FIELDS["isChipsCollapsable"] = "isChipsCollapsable";
|
|
73
|
-
EXCLUDED_FIELDS["isSelectedChipHasTooltip"] = "isSelectedChipHasTooltip";
|
|
74
|
-
EXCLUDED_FIELDS["isInputFocused"] = "isInputFocused";
|
|
75
|
-
EXCLUDED_FIELDS["setIsSearchable"] = "setIsSearchable";
|
|
76
|
-
EXCLUDED_FIELDS["selectRef"] = "selectRef";
|
|
77
|
-
EXCLUDED_FIELDS["setModalData"] = "setModalData";
|
|
78
|
-
EXCLUDED_FIELDS["collapsableChipsCount"] = "collapsableChipsCount";
|
|
79
|
-
EXCLUDED_FIELDS["lastVisibleChipIndex"] = "lastVisibleChipIndex";
|
|
80
|
-
EXCLUDED_FIELDS["fontFamily"] = "fontFamily";
|
|
81
|
-
})(EXCLUDED_FIELDS || (EXCLUDED_FIELDS = {}));
|
|
82
|
-
var COMMON_FIELDS_TO_OMIT = Object.keys(omit(EXCLUDED_FIELDS, [EXCLUDED_FIELDS.language, EXCLUDED_FIELDS.isMyContacts, EXCLUDED_FIELDS.isEnteredByUser]));
|
|
83
|
-
var Input = function (props) { return _jsx(components.Input, __assign({}, props, { enterKeyHint: "done" })); };
|
|
84
47
|
var UserDropdown = function (_a) {
|
|
85
|
-
var _b
|
|
86
|
-
var _y =
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
-
var
|
|
48
|
+
var _b;
|
|
49
|
+
var _c = _a.platform, platform = _c === void 0 ? PLATFORM.web : _c, fontFamily = _a.fontFamily, _d = _a.isDisabled, isDisabled = _d === void 0 ? false : _d, _e = _a.isLoading, isLoading = _e === void 0 ? false : _e, _f = _a.isChipsOutline, isChipsOutline = _f === void 0 ? false : _f, _g = _a.isError, isError = _g === void 0 ? false : _g, _h = _a.isChipsVisible, isChipsVisible = _h === void 0 ? true : _h, _j = _a.isChipsCollapsable, isChipsCollapsable = _j === void 0 ? false : _j, _k = _a.isSelectedChipHasTooltip, isSelectedChipHasTooltip = _k === void 0 ? false : _k, _l = _a.isMenuCloseOnSelect, isMenuCloseOnSelect = _l === void 0 ? true : _l, _m = _a.isFilteringDisabled, isFilteringDisabled = _m === void 0 ? false : _m, _o = _a.hasNextPage, hasNextPage = _o === void 0 ? false : _o, _p = _a.isNextPageLoading, isNextPageLoading = _p === void 0 ? false : _p, _q = _a.isInputHidden, isInputHidden = _q === void 0 ? false : _q, _r = _a.isBackspaceChipToInput, isBackspaceChipToInput = _r === void 0 ? false : _r, _s = _a.isShowCatalogSearchButton, isShowCatalogSearchButton = _s === void 0 ? false : _s, _t = _a.isDisabledMenuOffsetAtFullscreen, isDisabledMenuOffsetAtFullscreen = _t === void 0 ? false : _t, _u = _a.isDisabledCheckUniqueEmails, isDisabledCheckUniqueEmails = _u === void 0 ? false : _u, _v = _a.isMenuShadowless, isMenuShadowless = _v === void 0 ? false : _v, _w = _a.isStateless, isStateless = _w === void 0 ? false : _w, _x = _a.isSelectedOptionsHidden, isSelectedOptionsHidden = _x === void 0 ? true : _x, _y = _a.isInputValueClearedOnBlur, isInputValueClearedOnBlur = _y === void 0 ? false : _y, _z = _a.language, language = _z === void 0 ? LANGUAGES.ru : _z, _0 = _a.layoutType, layoutType = _0 === void 0 ? LAYOUT_TYPE.minimal : _0, externalInputValue = _a.externalInputValue, title = _a.title, contactInfoTitle = _a.contactInfoTitle, mask = _a.mask, suffix = _a.suffix, _1 = _a.placeholder, placeholder = _1 === void 0 ? EMPTY_STRING : _1, focusPlaceholder = _a.focusPlaceholder, hint = _a.hint, onShowCatalogSearchButtonClick = _a.onShowCatalogSearchButtonClick, noOptionsMessage = _a.noOptionsMessage, maxMembersCount = _a.maxMembersCount, skeletonRowsCount = _a.skeletonRowsCount, _2 = _a.maxRowsCountToCollapseChips, maxRowsCountToCollapseChips = _2 === void 0 ? DEFAULT_MAX_ROWS_COUNT_TO_COLLAPSE_CHIPS : _2, _3 = _a.menuListMaxHeight, menuListMaxHeight = _3 === void 0 ? DEFAULT_MENU_LIST_MAX_HEIGHT : _3, _4 = _a.menuPosition, menuPosition = _4 === void 0 ? MENU_POSITIONS.top : _4, menuLocation = _a.menuLocation, menuPortalTarget = _a.menuPortalTarget, _5 = _a.autoFocus, autoFocus = _5 === void 0 ? false : _5, containerClassName = _a.containerClassName, charHintClassName = _a.charHintClassName, containerPadding = _a.containerPadding, containerStyles = _a.containerStyles, selectedEntries = _a.selectedEntries, corporateEntries = _a.corporateEntries, myContactsEntries = _a.myContactsEntries, emailsToExclude = _a.emailsToExclude, _6 = _a.userDropdownId, initialUserDropdownId = _6 === void 0 ? EMPTY_STRING : _6, focusRef = _a.focusRef, onInputChange = _a.onInputChange, onImmediateInputChange = _a.onImmediateInputChange, onChange = _a.onChange, onMenuOpen = _a.onMenuOpen, onMenuClose = _a.onMenuClose, onLoadNextPage = _a.onLoadNextPage, onClickContactInfoCopyEmail = _a.onClickContactInfoCopyEmail, onFocus = _a.onFocus;
|
|
50
|
+
var _7 = useState(initialUserDropdownId), userDropdownId = _7[0], setUserDropdownId = _7[1];
|
|
51
|
+
var _8 = useState([]), selectedUsers = _8[0], setSelectedUsers = _8[1];
|
|
52
|
+
var _9 = useState(EMPTY_STRING), paddingLeft = _9[0], setPaddingLeft = _9[1];
|
|
53
|
+
var _10 = useState(EMPTY_STRING), paddingRight = _10[0], setPaddingRight = _10[1];
|
|
54
|
+
var _11 = useState(0), maskWidth = _11[0], setMaskWidth = _11[1];
|
|
55
|
+
var _12 = useState(0), suffixWidth = _12[0], setSuffixWidth = _12[1];
|
|
56
|
+
var _13 = useState(true), isSearchable = _13[0], setIsSearchable = _13[1];
|
|
57
|
+
var _14 = useState(false), isUserTyping = _14[0], setIsUserTyping = _14[1];
|
|
58
|
+
var _15 = useState(null), modalData = _15[0], setModalData = _15[1];
|
|
59
|
+
var _16 = useState(EMPTY_STRING), chipLabelWithMaxWidth = _16[0], setChipLabelWithMaxWidth = _16[1];
|
|
60
|
+
var _17 = useState(EMPTY_STRING), inputValue = _17[0], setInputValue = _17[1];
|
|
61
|
+
var _18 = useState(placeholder), placeholderValue = _18[0], setPlaceholderValue = _18[1];
|
|
62
|
+
var _19 = useState(false), isDelimiterVisible = _19[0], setIsDelimiterVisible = _19[1];
|
|
63
|
+
var _20 = useState(0), delimiterOffset = _20[0], setDelimiterOffset = _20[1];
|
|
96
64
|
var isInputFocused = useRef(false);
|
|
97
65
|
var selectRef = useRef(null);
|
|
98
66
|
var maskRef = useRef(null);
|
|
67
|
+
var suffixRef = useRef(null);
|
|
99
68
|
var menuScrollFromTop = useRef(0);
|
|
100
69
|
var collapsableChipsCount = useRef(0);
|
|
70
|
+
var visibleChipsCount = useRef(0);
|
|
71
|
+
var isNeedCheckChipCollapsableCount = useRef(false);
|
|
101
72
|
var lastVisibleChipIndex = useRef(-1);
|
|
102
73
|
var skipAddUserToChipsOnNextBlurRef = useRef(false);
|
|
74
|
+
var userTypingTimeoutRef = useRef(null);
|
|
75
|
+
var prevIsLoadingRef = useRef(isLoading);
|
|
103
76
|
var selectedUsersLength = selectedUsers.length;
|
|
77
|
+
var _21 = useDroppable({ id: userDropdownId }), setNodeRef = _21.setNodeRef, over = _21.over;
|
|
78
|
+
var overId = (over || {}).id;
|
|
79
|
+
var isDraggable = overId === userDropdownId;
|
|
80
|
+
var isInputPlaceholderVisible = selectedUsersLength === 1 && isEmpty(inputValue) ? ((_b = selectedUsers[0].isNotRemovable) !== null && _b !== void 0 ? _b : false) : false;
|
|
81
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
+
useImperativeHandle(focusRef, function () { return ({ focus: handleFocus, blur: function () { return handleDragBlur(true); } }); }, []);
|
|
104
83
|
var fontFamilyStyle = generateFontFamilyStyle(fontFamily);
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
return regex.test(inputValue);
|
|
108
|
-
};
|
|
109
|
-
var checkIsEmailToExclude = function (email) { return includes(emailsToExclude, email); };
|
|
110
|
-
var calculatePaddingLeft = function () {
|
|
111
|
-
var _a, _b;
|
|
112
|
-
var maskWidth = ((_b = (_a = maskRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) || null;
|
|
113
|
-
maskWidth && setMaskWidth(maskWidth + GAP);
|
|
114
|
-
return "".concat(maskWidth ? maskWidth + MASK_INPUT_PL : DEFAULT_INPUT_PADDING, "px");
|
|
115
|
-
};
|
|
84
|
+
var isCharHintVisible = useCharHintDisplay({ inputValue: inputValue }).isCharHintVisible;
|
|
85
|
+
var checkIsEmailToExclude = useCallback(function (email) { return includes(emailsToExclude, email); }, [emailsToExclude]);
|
|
116
86
|
var generateStyles = function () {
|
|
117
87
|
return selectStyles({
|
|
118
88
|
isChipsVisible: isChipsVisible,
|
|
119
89
|
isMaxMembersAdded: maxMembersCount && isChipsVisible ? selectedUsersLength === maxMembersCount : false,
|
|
120
90
|
isDisabled: isDisabled,
|
|
121
|
-
|
|
91
|
+
isInputPlaceholderVisible: isInputPlaceholderVisible,
|
|
122
92
|
lastRowNumber: isChipsVisible ? Math.ceil(selectedUsersLength / 2) + 1 : 1,
|
|
123
93
|
paddingLeft: paddingLeft,
|
|
94
|
+
paddingRight: !isChipsVisible && !isEmpty(inputValue) ? PADDING_WITH_CLEAR_ICON : paddingRight,
|
|
124
95
|
platform: platform,
|
|
125
96
|
layoutType: layoutType,
|
|
126
97
|
isInputHidden: isInputHidden,
|
|
127
98
|
isDisabledMenuOffsetAtFullscreen: isDisabledMenuOffsetAtFullscreen,
|
|
99
|
+
isInputFocused: isInputFocused.current,
|
|
128
100
|
isMaskRepresented: !isEmpty(mask),
|
|
101
|
+
isSuffixRepresented: !isNil(suffix),
|
|
102
|
+
isMenuShadowless: isMenuShadowless,
|
|
103
|
+
isShowCatalogSearchButton: isShowCatalogSearchButton,
|
|
129
104
|
fontFamilyStyle: fontFamilyStyle,
|
|
130
105
|
containerPadding: containerPadding,
|
|
106
|
+
isDraggable: isDraggable,
|
|
107
|
+
isChipsCollapsed: isChipsCollapsable && !isInputFocused.current,
|
|
108
|
+
menuListMaxHeight: menuListMaxHeight,
|
|
109
|
+
maxRowsCountToCollapseChips: maxRowsCountToCollapseChips,
|
|
110
|
+
isError: isError,
|
|
131
111
|
});
|
|
132
112
|
};
|
|
133
113
|
var generateNoOptionsMessage = function (_a) {
|
|
@@ -152,71 +132,74 @@ var UserDropdown = function (_a) {
|
|
|
152
132
|
collapsableChipsCount: collapsableChipsCount,
|
|
153
133
|
lastVisibleChipIndex: lastVisibleChipIndex,
|
|
154
134
|
};
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
162
|
-
var query = ((_b = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.inputValue) || '';
|
|
163
|
-
var sortedCorporateContacts = sortContacts(corporateContacts, query);
|
|
164
|
-
var sortedMyContacts = sortContacts(myContactsEntries || [], query);
|
|
165
|
-
var filteredCorporateContacts = sortedCorporateContacts.filter(function (_a) {
|
|
166
|
-
var email = _a.email, contacts = _a.contacts;
|
|
167
|
-
return [email, contacts[0].contact].every(function (email) { return !checkIsEmailToExclude(email); });
|
|
168
|
-
});
|
|
169
|
-
var filteredMyContacts = sortedMyContacts.filter(function (_a) {
|
|
170
|
-
var email = _a.email;
|
|
171
|
-
return !checkIsEmailToExclude(email);
|
|
172
|
-
});
|
|
173
|
-
return __spreadArray(__spreadArray([], generateCorporateOptionsToSelect(__assign({ options: filteredCorporateContacts }, commonFields)), true), generateContactsOptionsToSelect(__assign({ options: filteredMyContacts }, commonFields)), true);
|
|
135
|
+
var _c = retrieveFilteredContacts({
|
|
136
|
+
query: ((_b = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.inputValue) || EMPTY_STRING,
|
|
137
|
+
corporateEntries: corporateEntries,
|
|
138
|
+
myContactsEntries: myContactsEntries,
|
|
139
|
+
checkIsEmailToExclude: checkIsEmailToExclude,
|
|
140
|
+
}), filteredCorporateContacts = _c.filteredCorporateContacts, filteredLocalContacts = _c.filteredLocalContacts, filteredMyContacts = _c.filteredMyContacts;
|
|
141
|
+
return __spreadArray(__spreadArray(__spreadArray([], generateCorporateOptionsToSelect(__assign({ options: filteredCorporateContacts }, commonFields)), true), generateContactsOptionsToSelect(__assign({ options: filteredLocalContacts, isLocalContact: true }, commonFields)), true), generateContactsOptionsToSelect(__assign({ options: filteredMyContacts, isMyContacts: true }, commonFields)), true);
|
|
174
142
|
};
|
|
143
|
+
var clearUserTypingTimeout = useCallback(function () {
|
|
144
|
+
var userTypingTimeoutRefCurrent = userTypingTimeoutRef.current;
|
|
145
|
+
if (userTypingTimeoutRefCurrent) {
|
|
146
|
+
clearTimeout(userTypingTimeoutRefCurrent);
|
|
147
|
+
userTypingTimeoutRef.current = null;
|
|
148
|
+
}
|
|
149
|
+
}, []);
|
|
150
|
+
useEffect(function () {
|
|
151
|
+
if (prevIsLoadingRef.current && !isLoading) {
|
|
152
|
+
setIsUserTyping(false);
|
|
153
|
+
clearUserTypingTimeout();
|
|
154
|
+
}
|
|
155
|
+
prevIsLoadingRef.current = isLoading;
|
|
156
|
+
}, [isLoading, clearUserTypingTimeout]);
|
|
175
157
|
var requestInputChangeDebounce = useMemo(function () {
|
|
176
158
|
return debounce(function (inputValue) {
|
|
177
159
|
onInputChange(inputValue);
|
|
178
|
-
|
|
160
|
+
clearUserTypingTimeout();
|
|
161
|
+
userTypingTimeoutRef.current = setTimeout(function () { return setIsUserTyping(false); }, CLEAR_USER_TYPING_TIMEOUT);
|
|
179
162
|
}, USER_TYPING_TIMEOUT);
|
|
180
|
-
}, [onInputChange]);
|
|
181
|
-
var resetIsUserTypingDebounce = useMemo(function () { return debounce(function () { return setIsUserTyping(false); }, USER_TYPING_TIMEOUT); }, []);
|
|
182
|
-
var handleResetError = function () { return isError && setIsError(false); };
|
|
163
|
+
}, [clearUserTypingTimeout, onInputChange]);
|
|
183
164
|
var handleMenuClose = function () {
|
|
184
165
|
menuScrollFromTop.current = 0;
|
|
185
|
-
|
|
186
|
-
onMenuClose
|
|
166
|
+
setIsDelimiterVisible(false);
|
|
167
|
+
onMenuClose === null || onMenuClose === void 0 ? void 0 : onMenuClose();
|
|
187
168
|
};
|
|
188
|
-
var handleInputChange = function (inputValue, additionalInfo) {
|
|
169
|
+
var handleInputChange = useCallback(function (inputValue, additionalInfo) {
|
|
189
170
|
if (additionalInfo) {
|
|
190
|
-
var action = additionalInfo.action,
|
|
171
|
+
var action = additionalInfo.action, _a = additionalInfo.prevInputValue, prevInputValue = _a === void 0 ? EMPTY_STRING : _a;
|
|
191
172
|
var trimPrevInputValue_1 = prevInputValue.trim();
|
|
192
173
|
var isInputBlurAction = action === INPUT_ACTIONS.blur;
|
|
193
174
|
var isMenuCloseAction = action === MENU_ACTIONS.close;
|
|
194
|
-
if (!isInputBlurAction && !isMenuCloseAction)
|
|
175
|
+
if (!isInputBlurAction && !isMenuCloseAction) {
|
|
195
176
|
setInputValue(inputValue);
|
|
177
|
+
onImmediateInputChange === null || onImmediateInputChange === void 0 ? void 0 : onImmediateInputChange(inputValue);
|
|
178
|
+
}
|
|
196
179
|
if ((isInputBlurAction || isMenuCloseAction) && checkIsValueIsEmail(trimPrevInputValue_1)) {
|
|
197
180
|
var isUserAlreadySelected = selectedUsers.some(function (_a) {
|
|
198
181
|
var email = _a.email;
|
|
199
182
|
return email === trimPrevInputValue_1;
|
|
200
183
|
});
|
|
201
|
-
|
|
184
|
+
var nextInputValue = isUserAlreadySelected || checkIsEmailToExclude(trimPrevInputValue_1) ? trimPrevInputValue_1 : inputValue;
|
|
185
|
+
setInputValue(nextInputValue);
|
|
186
|
+
onImmediateInputChange === null || onImmediateInputChange === void 0 ? void 0 : onImmediateInputChange(nextInputValue);
|
|
202
187
|
}
|
|
203
188
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
};
|
|
214
|
-
var handleAddUser = function (needToShowError) {
|
|
215
|
-
if (needToShowError === void 0) { needToShowError = true; }
|
|
216
|
-
var props = selectRef.current.props;
|
|
217
|
-
var options = props.options, inputValue = props.inputValue, onChange = props.onChange;
|
|
218
|
-
if (isEmpty(inputValue))
|
|
189
|
+
if (!isEmpty(inputValue)) {
|
|
190
|
+
clearUserTypingTimeout();
|
|
191
|
+
setIsUserTyping(true);
|
|
192
|
+
}
|
|
193
|
+
inputValue.length >= MIN_INPUT_SYMBOLS && requestInputChangeDebounce(inputValue);
|
|
194
|
+
}, [onImmediateInputChange, requestInputChangeDebounce, selectedUsers, checkIsEmailToExclude, clearUserTypingTimeout]);
|
|
195
|
+
var handleAddUser = function () {
|
|
196
|
+
var selectRefCurrent = selectRef.current;
|
|
197
|
+
if (isNil(selectRefCurrent))
|
|
219
198
|
return;
|
|
199
|
+
var props = selectRefCurrent.props;
|
|
200
|
+
var options = props.options, onChange = props.onChange;
|
|
201
|
+
if (isEmpty(inputValue))
|
|
202
|
+
return Promise.resolve();
|
|
220
203
|
var trimInputValue = inputValue.trim();
|
|
221
204
|
var optionProps = {
|
|
222
205
|
platform: platform,
|
|
@@ -248,10 +231,10 @@ var UserDropdown = function (_a) {
|
|
|
248
231
|
return email === inputEmail;
|
|
249
232
|
});
|
|
250
233
|
enteredUsers.push(existingUser || generateEnteredByUserOption(__assign(__assign({}, optionProps), { email: inputEmail })));
|
|
251
|
-
if (isUserAlreadySelected &&
|
|
252
|
-
|
|
234
|
+
if (isUserAlreadySelected && isSingleEmailEntered)
|
|
235
|
+
return;
|
|
253
236
|
else
|
|
254
|
-
handleInputChange(
|
|
237
|
+
handleInputChange(EMPTY_STRING, { action: INPUT_ACTIONS.change, prevInputValue: trimInputValue });
|
|
255
238
|
}
|
|
256
239
|
!isValueIsEmail && incorrectEmails.push(inputEmail);
|
|
257
240
|
});
|
|
@@ -265,7 +248,7 @@ var UserDropdown = function (_a) {
|
|
|
265
248
|
var isEnterPressed = code === ENTER_KEY || key === ENTER_KEY;
|
|
266
249
|
var isBackspacePressed = code === BACKSPACE_KEY || key === BACKSPACE_KEY;
|
|
267
250
|
var isSpacePressed = code === SPACE_KEY;
|
|
268
|
-
var isTransformChipToInputValue = isBackspacePressed && isBackspaceChipToInput && inputValue ===
|
|
251
|
+
var isTransformChipToInputValue = isBackspacePressed && isBackspaceChipToInput && inputValue === EMPTY_STRING && !isEmpty(selectedUsers);
|
|
269
252
|
if (isEnterPressed) {
|
|
270
253
|
event.preventDefault();
|
|
271
254
|
(_a = handleAddUser()) === null || _a === void 0 ? void 0 : _a.then(function () { });
|
|
@@ -291,26 +274,29 @@ var UserDropdown = function (_a) {
|
|
|
291
274
|
(_c = (_b = selectRef.current) === null || _b === void 0 ? void 0 : _b.onMenuOpen) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
292
275
|
}
|
|
293
276
|
};
|
|
294
|
-
var transformCurrentChipToInputValue = function (label,
|
|
277
|
+
var transformCurrentChipToInputValue = useCallback(function (label, value) {
|
|
295
278
|
var _a, _b;
|
|
296
279
|
skipAddUserToChipsOnNextBlurRef.current = true;
|
|
297
280
|
setSelectedUsers(function (prevSelectedUsers) {
|
|
298
281
|
var nextSelectedUsers = prevSelectedUsers.filter(function (_a) {
|
|
299
|
-
var userEmail = _a.email;
|
|
300
|
-
return userEmail !==
|
|
282
|
+
var userEmail = _a.email, userType = _a.userType, userUid = _a.uid;
|
|
283
|
+
return checkIfContactTypeIsGroup(userType) ? userUid !== value : userEmail !== value;
|
|
301
284
|
});
|
|
302
285
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextSelectedUsers.map(function (userData) { return omit(userData, COMMON_FIELDS_TO_OMIT); }));
|
|
303
286
|
return nextSelectedUsers;
|
|
304
287
|
});
|
|
288
|
+
handleFocus();
|
|
305
289
|
setInputValue(label);
|
|
306
290
|
onInputChange(label);
|
|
307
291
|
handleInputChange(label);
|
|
308
292
|
onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen();
|
|
309
293
|
(_b = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.onMenuOpen) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
310
|
-
|
|
294
|
+
setIsUserTyping(false);
|
|
295
|
+
},
|
|
296
|
+
// eslint-disable-next-line
|
|
297
|
+
[onInputChange, handleInputChange, onMenuOpen, onChange]);
|
|
311
298
|
var handleChange = function (newSelectedUsers) {
|
|
312
|
-
var uniqNewSelectedUsers = uniqBy(newSelectedUsers, EMAIL_FIELD);
|
|
313
|
-
var users = [];
|
|
299
|
+
var uniqNewSelectedUsers = isDisabledCheckUniqueEmails ? newSelectedUsers : uniqBy(newSelectedUsers, EMAIL_FIELD);
|
|
314
300
|
var deletedUser = selectedUsers.find(function (_a) {
|
|
315
301
|
var value = _a.value;
|
|
316
302
|
return !uniqNewSelectedUsers.some(function (_a) {
|
|
@@ -320,108 +306,59 @@ var UserDropdown = function (_a) {
|
|
|
320
306
|
});
|
|
321
307
|
if (deletedUser === null || deletedUser === void 0 ? void 0 : deletedUser.isNotRemovable)
|
|
322
308
|
return;
|
|
323
|
-
|
|
324
|
-
var isEnteredByUser = user.isEnteredByUser, isMyContacts = user.isMyContacts;
|
|
325
|
-
var userToAdd = omit(user, COMMON_FIELDS_TO_OMIT);
|
|
326
|
-
var entryFieldsToExclude = isMyContacts ? [EXCLUDED_FIELDS.isMyContacts] : [EXCLUDED_FIELDS.language];
|
|
327
|
-
var fieldsToExclude = isEnteredByUser ? [EXCLUDED_FIELDS.isEnteredByUser] : entryFieldsToExclude;
|
|
328
|
-
users.push(omit(userToAdd, fieldsToExclude));
|
|
329
|
-
});
|
|
309
|
+
var users = transformSelectedUsers(uniqNewSelectedUsers);
|
|
330
310
|
onChange(users);
|
|
331
|
-
if (!isInputHidden)
|
|
311
|
+
if (!isInputHidden && !isStateless)
|
|
332
312
|
setSelectedUsers(uniqNewSelectedUsers);
|
|
333
313
|
if (!isInputFocused.current && isChipsCollapsable)
|
|
334
314
|
handleFocus();
|
|
335
315
|
};
|
|
336
|
-
var isContainsValue = function (_a) {
|
|
337
|
-
var label = _a.label, email = _a.email, value = _a.value;
|
|
338
|
-
return label.toLowerCase().includes(value) || email.toLowerCase().includes(value);
|
|
339
|
-
};
|
|
340
316
|
var handleFilterOption = function (_a, inputValue) {
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
var transliteratedInputValue = tr(originInputValue);
|
|
344
|
-
var toEngInputValue = ru.toEn(originInputValue);
|
|
345
|
-
var fromEngInputValue = ru.fromEn(originInputValue);
|
|
346
|
-
var isUserAlreadySelected = selectedUsers.find(function (_a) {
|
|
347
|
-
var email = _a.email;
|
|
348
|
-
return email === optionEmail;
|
|
349
|
-
});
|
|
350
|
-
var isContainsInputValue = [originInputValue, transliteratedInputValue, toEngInputValue, fromEngInputValue].some(function (value) {
|
|
351
|
-
return isContainsValue({ label: label, email: optionEmail, value: value });
|
|
352
|
-
});
|
|
353
|
-
if (isFilteringDisabled)
|
|
354
|
-
return !isEmpty(selectedUsers) ? !isUserAlreadySelected : true;
|
|
355
|
-
return !isEmpty(selectedUsers) ? !isUserAlreadySelected && isContainsInputValue : isContainsInputValue;
|
|
356
|
-
};
|
|
357
|
-
var generateTruncatedElementY = function (element) { return Math.trunc(element.getBoundingClientRect().y); };
|
|
358
|
-
var calculateCounterWidth = function (counterNumber) {
|
|
359
|
-
if (counterNumber >= 100)
|
|
360
|
-
return THREE_DIGIT_NUMBER_WIDTH;
|
|
361
|
-
if (counterNumber >= 10)
|
|
362
|
-
return TWO_DIGIT_NUMBER_WIDTH;
|
|
363
|
-
return SINGLE_DIGIT_NUMBER_WIDTH;
|
|
317
|
+
var data = _a.data;
|
|
318
|
+
return applyFilteringToOption({ isFilteringDisabled: isFilteringDisabled, isSelectedOptionsHidden: isSelectedOptionsHidden, inputValue: inputValue, data: data, selectedUsers: selectedUsers });
|
|
364
319
|
};
|
|
365
320
|
var handleCollapseChips = function () {
|
|
366
|
-
var
|
|
367
|
-
var collapsableChips = 0;
|
|
368
|
-
var chipLabelWithMaxWidth = '';
|
|
369
|
-
var chipsNodes = ((_a = document.querySelector("#".concat(userDropdownId))) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.smartapp-chip')) || [];
|
|
370
|
-
var chips = Array.from(chipsNodes);
|
|
321
|
+
var chips = retrieveChipsElements(userDropdownId);
|
|
371
322
|
if (isEmpty(chips))
|
|
372
323
|
return;
|
|
373
|
-
var
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
else {
|
|
383
|
-
y === ySecondRow && secondRow.push(chip);
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
var counterWidth = calculateCounterWidth(collapsableChips);
|
|
387
|
-
var rowWidth = counterWidth + INPUT_SPACE_WIDTH;
|
|
388
|
-
var dropdownWidth = ((_b = document.querySelector("#".concat(userDropdownId))) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width) - maskWidth;
|
|
389
|
-
secondRow.forEach(function (chip) {
|
|
390
|
-
var _a;
|
|
391
|
-
rowWidth += chip.getBoundingClientRect().width + GAP;
|
|
392
|
-
if (rowWidth > dropdownWidth) {
|
|
393
|
-
if (secondRow.length > 1) {
|
|
394
|
-
collapsableChips += 1;
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
var emptySpaceWidth = collapsableChips > 0 ? counterWidth + INPUT_SPACE_WIDTH + GAP : INPUT_SPACE_WIDTH;
|
|
398
|
-
chip.style.maxWidth = "".concat(dropdownWidth - emptySpaceWidth, "px");
|
|
399
|
-
chipLabelWithMaxWidth = ((_a = chip.querySelector('.smartapp-chip__info--name')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '';
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
});
|
|
324
|
+
var _a = collapseChips({
|
|
325
|
+
userDropdownId: userDropdownId,
|
|
326
|
+
maxRowsCountToCollapseChips: maxRowsCountToCollapseChips,
|
|
327
|
+
maskWidth: maskWidth,
|
|
328
|
+
suffixWidth: suffixWidth,
|
|
329
|
+
chips: chips,
|
|
330
|
+
}), collapsableChips = _a.collapsableChips, numberOfVisibleChips = _a.numberOfVisibleChips, chipLabelWithMaxWidth = _a.chipLabelWithMaxWidth;
|
|
331
|
+
isNeedCheckChipCollapsableCount.current = true;
|
|
332
|
+
visibleChipsCount.current = numberOfVisibleChips;
|
|
403
333
|
collapsableChipsCount.current = collapsableChips;
|
|
404
|
-
lastVisibleChipIndex.current =
|
|
334
|
+
lastVisibleChipIndex.current = numberOfVisibleChips;
|
|
405
335
|
setChipLabelWithMaxWidth(chipLabelWithMaxWidth || generateId());
|
|
406
336
|
};
|
|
407
|
-
var handleUnCollapseChips = function () {
|
|
408
|
-
var _a;
|
|
337
|
+
var handleUnCollapseChips = useCallback(function () {
|
|
409
338
|
if (!userDropdownId)
|
|
410
339
|
return;
|
|
411
|
-
var
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
var chipLabel = ((_a = chip.querySelector('.smartapp-chip__info--name')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '';
|
|
416
|
-
chipLabel === chipLabelWithMaxWidth && (chip.style.maxWidth = '100%');
|
|
417
|
-
});
|
|
340
|
+
var chips = retrieveChipsElements(userDropdownId);
|
|
341
|
+
unCollapseChips(chipLabelWithMaxWidth, chips);
|
|
342
|
+
isNeedCheckChipCollapsableCount.current = false;
|
|
343
|
+
visibleChipsCount.current = chips.length;
|
|
418
344
|
collapsableChipsCount.current = 0;
|
|
419
345
|
lastVisibleChipIndex.current = -1;
|
|
420
|
-
setChipLabelWithMaxWidth(
|
|
346
|
+
setChipLabelWithMaxWidth(EMPTY_STRING);
|
|
347
|
+
}, [chipLabelWithMaxWidth, userDropdownId]);
|
|
348
|
+
var handleDragBlur = function (isDisableCheckFocused) {
|
|
349
|
+
var _a;
|
|
350
|
+
if (!isInputFocused.current && !isDisableCheckFocused)
|
|
351
|
+
return;
|
|
352
|
+
if (selectRef.current)
|
|
353
|
+
selectRef.current._preventBlur = false;
|
|
354
|
+
(_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
421
355
|
};
|
|
422
356
|
var handleBlur = function () {
|
|
423
357
|
var _a;
|
|
424
358
|
var shouldSkipAddUserToChipsOnNextBlur = skipAddUserToChipsOnNextBlurRef.current;
|
|
359
|
+
var _b = selectRef.current || {}, _preventBlur = _b._preventBlur, _contextMenuOpen = _b._contextMenuOpen, _isDragging = _b._isDragging;
|
|
360
|
+
if (_preventBlur || _contextMenuOpen || _isDragging || skipAddUserToChipsOnNextBlurRef.current)
|
|
361
|
+
return;
|
|
425
362
|
var onBlurComplete = function () {
|
|
426
363
|
isChipsCollapsable && handleCollapseChips();
|
|
427
364
|
isInputFocused.current = false;
|
|
@@ -431,19 +368,42 @@ var UserDropdown = function (_a) {
|
|
|
431
368
|
return;
|
|
432
369
|
}
|
|
433
370
|
else
|
|
434
|
-
(_a = handleAddUser(
|
|
371
|
+
(_a = handleAddUser()) === null || _a === void 0 ? void 0 : _a.then(function () { return requestAnimationFrame(function () { return requestAnimationFrame(function () { return onBlurComplete(); }); }); });
|
|
435
372
|
skipAddUserToChipsOnNextBlurRef.current = false;
|
|
436
373
|
};
|
|
437
|
-
var
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
setTimeout(function () { var _a; return (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 100);
|
|
374
|
+
var handleSelectBlur = function () {
|
|
375
|
+
setPlaceholderValue(placeholder);
|
|
376
|
+
if (isInputValueClearedOnBlur) {
|
|
377
|
+
setInputValue(EMPTY_STRING);
|
|
378
|
+
onImmediateInputChange === null || onImmediateInputChange === void 0 ? void 0 : onImmediateInputChange(EMPTY_STRING);
|
|
443
379
|
}
|
|
380
|
+
setTimeout(handleBlur, RENDER_DELAY);
|
|
381
|
+
};
|
|
382
|
+
var focusInputIOS = useCallback(function (input) {
|
|
383
|
+
var length = input.value.length;
|
|
384
|
+
requestAnimationFrame(function () {
|
|
385
|
+
input.focus();
|
|
386
|
+
input.value === EMPTY_STRING ? setCaretInEmptyInput(input) : setCaretPosition(input, length);
|
|
387
|
+
});
|
|
388
|
+
}, []);
|
|
389
|
+
var handleFocus = useCallback(function (isDisableCheckFocused) {
|
|
390
|
+
setPlaceholderValue(focusPlaceholder || SEARCH_PLACEHOLDER[language]);
|
|
391
|
+
if (isInputFocused.current && !isDisableCheckFocused)
|
|
392
|
+
return;
|
|
444
393
|
isInputFocused.current = true;
|
|
394
|
+
var selectRefCurrent = selectRef.current;
|
|
395
|
+
var _a = selectRefCurrent || {}, _preventBlur = _a._preventBlur, inputRef = _a.inputRef;
|
|
396
|
+
setTimeout(function () {
|
|
397
|
+
if (selectRefCurrent && !_preventBlur)
|
|
398
|
+
isIosPlatform(platform) && inputRef ? focusInputIOS(inputRef) : selectRefCurrent.focus();
|
|
399
|
+
}, RENDER_DELAY);
|
|
445
400
|
isChipsCollapsable && handleUnCollapseChips();
|
|
446
|
-
};
|
|
401
|
+
}, [focusPlaceholder, language, isChipsCollapsable, handleUnCollapseChips, platform, focusInputIOS]);
|
|
402
|
+
var handleForceFocus = useCallback(function () { return setTimeout(function () { return handleFocus(true); }, RENDER_DELAY); }, [handleFocus]);
|
|
403
|
+
var handleSelectFocus = useCallback(function () {
|
|
404
|
+
handleFocus();
|
|
405
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
406
|
+
}, [handleFocus, onFocus]);
|
|
447
407
|
var handleCloseModal = function () {
|
|
448
408
|
setModalData(null);
|
|
449
409
|
setIsSearchable(true);
|
|
@@ -451,16 +411,7 @@ var UserDropdown = function (_a) {
|
|
|
451
411
|
new Promise(function (resolve) { return resolve(); }).then(function () { var _a; return (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
452
412
|
}
|
|
453
413
|
};
|
|
454
|
-
var
|
|
455
|
-
var renderMask = function () {
|
|
456
|
-
return mask && (_jsx("div", __assign({ ref: maskRef, className: "smartapp-user-dropdown__container--mask" }, { children: mask })));
|
|
457
|
-
};
|
|
458
|
-
var renderHint = function () {
|
|
459
|
-
if (isNil(hint))
|
|
460
|
-
return;
|
|
461
|
-
return isString(hint) ? _jsx("div", __assign({ className: "smartapp-user-dropdown__hint" }, { children: hint })) : hint;
|
|
462
|
-
};
|
|
463
|
-
var modalContent = modalData ? (_jsx(ContactBottomSheet, { fontFamily: fontFamily, language: language, avatar: modalData.avatar, name: modalData.name, email: modalData.email, serverName: modalData.serverName, company: modalData.company, department: modalData.department, companyPosition: modalData.companyPosition })) : (_jsx(_Fragment, {}));
|
|
414
|
+
var modalContent = modalData ? (_jsx(ContactBottomSheet, { fontFamily: fontFamily, language: language, contactInfoTitle: contactInfoTitle, avatar: modalData.avatar, name: modalData.name, email: modalData.email, serverName: modalData.serverName, company: modalData.company, department: modalData.department, companyPosition: modalData.companyPosition, handleCloseModal: handleCloseModal, onClickContactInfoCopyEmail: onClickContactInfoCopyEmail })) : (_jsx(_Fragment, {}));
|
|
464
415
|
useEffect(function () {
|
|
465
416
|
if (externalInputValue && isInputHidden) {
|
|
466
417
|
setInputValue(externalInputValue);
|
|
@@ -472,48 +423,45 @@ var UserDropdown = function (_a) {
|
|
|
472
423
|
!userDropdownId && setUserDropdownId("user_dropdown_".concat(generateId().replace(/-/g, '_')));
|
|
473
424
|
}, [userDropdownId]);
|
|
474
425
|
useLayoutEffect(function () {
|
|
475
|
-
if (
|
|
476
|
-
|
|
426
|
+
if (isChipsCollapsable && !isEmpty(chipLabelWithMaxWidth) && !isInputFocused.current) {
|
|
427
|
+
handleUnCollapseChips();
|
|
428
|
+
handleCollapseChips();
|
|
477
429
|
}
|
|
478
430
|
// eslint-disable-next-line
|
|
431
|
+
}, [hint]);
|
|
432
|
+
useLayoutEffect(function () {
|
|
433
|
+
if (userDropdownId)
|
|
434
|
+
setTimeout(function () { return (isChipsCollapsable ? handleCollapseChips() : handleUnCollapseChips()); }, RENDER_DELAY);
|
|
435
|
+
// eslint-disable-next-line
|
|
479
436
|
}, [isChipsCollapsable, userDropdownId]);
|
|
480
437
|
useEffect(function () {
|
|
481
|
-
setPaddingLeft(
|
|
438
|
+
setPaddingLeft(calculateHorizontalPadding(maskRef, setMaskWidth));
|
|
482
439
|
}, [mask]);
|
|
440
|
+
useEffect(function () {
|
|
441
|
+
setPaddingRight(calculateHorizontalPadding(suffixRef, setSuffixWidth));
|
|
442
|
+
}, [suffix]);
|
|
483
443
|
useEffect(function () {
|
|
484
444
|
setSelectedUsers(function (prevSelectedUsers) {
|
|
485
445
|
return prevSelectedUsers.map(function (selectedUser) { return (__assign(__assign({}, selectedUser), { layoutType: layoutType, fontFamily: fontFamily, language: language, isChipsCollapsable: isChipsCollapsable })); });
|
|
486
446
|
});
|
|
487
447
|
}, [layoutType, fontFamily, language, isChipsCollapsable]);
|
|
488
448
|
useEffect(function () {
|
|
489
|
-
if (!isEmpty(selectedEntries)) {
|
|
449
|
+
if (isArray(selectedEntries) && !isEmpty(selectedEntries)) {
|
|
490
450
|
setSelectedUsers(selectedEntries.map(function (entity) {
|
|
491
|
-
var
|
|
492
|
-
var
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
isResetChipsToInputValue: isResetChipsToInputValue,
|
|
499
|
-
contextMenuItems: contextMenuItems,
|
|
500
|
-
isSelectedChipHasTooltip: isSelectedChipHasTooltip,
|
|
501
|
-
isLoading: isLoading,
|
|
502
|
-
isWarning: isWarning,
|
|
503
|
-
isOrganizer: isOrganizer,
|
|
504
|
-
userType: userType,
|
|
505
|
-
uid: uid,
|
|
506
|
-
isInputFocused: isInputFocused,
|
|
507
|
-
selectRef: selectRef,
|
|
508
|
-
collapsableChipsCount: collapsableChipsCount,
|
|
509
|
-
lastVisibleChipIndex: lastVisibleChipIndex,
|
|
451
|
+
var contextMenuItems = entity.contextMenuItems;
|
|
452
|
+
var generateContextMenuItems = function () {
|
|
453
|
+
return contextMenuItems === null || contextMenuItems === void 0 ? void 0 : contextMenuItems.map(function (item) { return (__assign(__assign({}, item), { action: function (data) {
|
|
454
|
+
var _a;
|
|
455
|
+
(_a = item.action) === null || _a === void 0 ? void 0 : _a.call(item, data);
|
|
456
|
+
isMobilePlatform(platform) && handleFocus(true);
|
|
457
|
+
} })); });
|
|
510
458
|
};
|
|
511
|
-
var
|
|
512
|
-
|
|
513
|
-
: generateContactsOption(__assign({ option: entity }, commonFields));
|
|
514
|
-
return 'contacts' in entity ? generateCorporateOption(__assign({ option: entity }, commonFields)) : generatedNotCorporateEntity;
|
|
459
|
+
var commonFields = __assign(__assign({}, pick(entity, COMMON_FIELDS_TO_PICK)), { platform: platform, layoutType: layoutType, fontFamily: fontFamily, language: language, isChipsCollapsable: isChipsCollapsable, isSelectedChipHasTooltip: isSelectedChipHasTooltip, isInputFocused: isInputFocused, selectRef: selectRef, collapsableChipsCount: collapsableChipsCount, lastVisibleChipIndex: lastVisibleChipIndex, contextMenuItems: generateContextMenuItems() });
|
|
460
|
+
return transformSelectedEntity(entity, commonFields);
|
|
515
461
|
}));
|
|
516
462
|
}
|
|
463
|
+
else
|
|
464
|
+
setSelectedUsers([]);
|
|
517
465
|
// eslint-disable-next-line
|
|
518
466
|
}, [selectedEntries]);
|
|
519
467
|
useEffect(function () {
|
|
@@ -526,15 +474,42 @@ var UserDropdown = function (_a) {
|
|
|
526
474
|
useEffect(function () {
|
|
527
475
|
return function () {
|
|
528
476
|
requestInputChangeDebounce.cancel();
|
|
529
|
-
|
|
477
|
+
clearUserTypingTimeout();
|
|
530
478
|
};
|
|
531
|
-
}, [
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
479
|
+
}, [clearUserTypingTimeout, requestInputChangeDebounce]);
|
|
480
|
+
useEffect(function () {
|
|
481
|
+
if (isChipsCollapsable && !isInputFocused.current && isNeedCheckChipCollapsableCount.current)
|
|
482
|
+
collapsableChipsCount.current = (selectedEntries || []).length - visibleChipsCount.current;
|
|
483
|
+
}, [isChipsCollapsable, selectedEntries]);
|
|
484
|
+
var OptionComponent = useCallback(function (props) { return _jsx(Option, __assign({}, props, { isMenuShadowless: isMenuShadowless, children: props.children })); }, [isMenuShadowless]);
|
|
485
|
+
var MenuListComponent = useCallback(function (props) { return (_jsx(MenuList, __assign({}, props, { children: props.children, selectRef: selectRef, scrollFromTop: menuScrollFromTop, language: language, platform: platform, menuListMaxHeight: menuListMaxHeight, charHintClassName: charHintClassName, hasNextPage: hasNextPage, isLoading: isLoading, isShowCatalogSearchButton: isShowCatalogSearchButton, onShowCatalogSearchButtonClick: onShowCatalogSearchButtonClick, isUserTyping: isUserTyping, isCharHintVisible: isCharHintVisible, isMenuShadowless: isMenuShadowless, isNextPageLoading: isNextPageLoading, onLoadNextPage: function (inputValue) { return onLoadNextPage === null || onLoadNextPage === void 0 ? void 0 : onLoadNextPage(inputValue); }, setIsDelimiterVisible: setIsDelimiterVisible }))); }, [
|
|
486
|
+
charHintClassName,
|
|
487
|
+
hasNextPage,
|
|
488
|
+
isCharHintVisible,
|
|
489
|
+
isLoading,
|
|
490
|
+
isMenuShadowless,
|
|
491
|
+
isNextPageLoading,
|
|
492
|
+
isShowCatalogSearchButton,
|
|
493
|
+
isUserTyping,
|
|
494
|
+
language,
|
|
495
|
+
menuListMaxHeight,
|
|
496
|
+
onLoadNextPage,
|
|
497
|
+
onShowCatalogSearchButtonClick,
|
|
498
|
+
platform,
|
|
499
|
+
]);
|
|
500
|
+
var NoOptionsButton = function (props) { return (_jsx(components.NoOptionsMessage, __assign({}, props, { children: _jsx(SearchInCatalogButton, { language: language, isOnlyButtonInList: true, isMenuShadowless: isMenuShadowless, noOptionText: isShowCatalogSearchButton ? undefined : generateNoOptionsMessage({ inputValue: inputValue }), onShowCatalogSearchButtonClick: onShowCatalogSearchButtonClick }) }))); };
|
|
501
|
+
var InputComponent = useCallback(function (props) { return (_jsx(Input, __assign({}, props, { "data-is-clearable": !isChipsVisible, "data-placeholder": placeholderValue, suffixref: suffixRef, suffix: suffix }))); }, [isChipsVisible, placeholderValue, suffix]);
|
|
502
|
+
var MultiValueLabelComponent = useCallback(function (props) { return (_jsx(MultiValueLabel, __assign({}, props, { platform: platform, isChipsOutline: isChipsOutline, transformCurrentChipToInputValue: transformCurrentChipToInputValue, handleBlurDropdown: function () { return handleDragBlur(true); }, handleRequestFocus: handleForceFocus }))); }, [platform, isChipsOutline, transformCurrentChipToInputValue, handleForceFocus]);
|
|
503
|
+
var setContainerNodeRef = function (ref) {
|
|
504
|
+
var _a = ((ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect()) || {}).left, left = _a === void 0 ? 0 : _a;
|
|
505
|
+
setNodeRef(ref);
|
|
506
|
+
setDelimiterOffset(isShowCatalogSearchButton ? 0 : left);
|
|
507
|
+
};
|
|
508
|
+
return (_jsxs("div", __assign({ id: userDropdownId, className: classNames('smartapp-user-dropdown', containerClassName), style: __assign(__assign({}, fontFamilyStyle), containerStyles) }, { children: [_jsx(Title, { text: title }), _jsxs("div", __assign({ className: "smartapp-user-dropdown__container", ref: setContainerNodeRef }, { children: [_jsx(Mask, { mask: mask, elementRef: maskRef }), _jsx(Select, { ref: selectRef, menuIsOpen: isInputHidden ? !!externalInputValue : undefined, menuPortalTarget: menuPortalTarget === null || menuPortalTarget === void 0 ? void 0 : menuPortalTarget.current, isMulti: true, openMenuOnFocus: true, hideSelectedOptions: isSelectedOptionsHidden, blurInputOnSelect: false, captureMenuScroll: false, isSearchable: isSearchable, menuPlacement: menuPosition, menuPosition: menuLocation, controlShouldRenderValue: isChipsVisible, backspaceRemovesValue: isChipsVisible, isDisabled: isDisabled, closeMenuOnSelect: isMenuCloseOnSelect, isLoading: isLoading || isUserTyping, isClearable: false, isOptionDisabled: function (_a) {
|
|
509
|
+
var _b = _a.isAlreadyAdded, isAlreadyAdded = _b === void 0 ? false : _b;
|
|
510
|
+
return isAlreadyAdded;
|
|
511
|
+
}, styles: generateStyles(), placeholder: placeholderValue, noOptionsMessage: generateNoOptionsMessage, loadingMessage: function () { return _jsx(LoadingMessage, { isMenuShadowless: isMenuShadowless, skeletonRowsCount: skeletonRowsCount }); }, value: selectedUsers, inputValue: inputValue, options: !isNull(corporateEntries) || !isNull(myContactsEntries) ? generateOptions() : undefined, filterOption: handleFilterOption, onInputChange: handleInputChange, onChange: handleChange, onMenuClose: handleMenuClose, onMenuOpen: onMenuOpen, onKeyDown: handleKeyDown, onBlur: handleSelectBlur, autoFocus: autoFocus, onFocus: handleSelectFocus, instanceId: userDropdownId, components: {
|
|
512
|
+
Input: InputComponent,
|
|
538
513
|
MultiValueLabel: MultiValueLabelComponent,
|
|
539
514
|
MultiValueRemove: MultiValueRemove,
|
|
540
515
|
Option: OptionComponent,
|
|
@@ -543,7 +518,7 @@ var UserDropdown = function (_a) {
|
|
|
543
518
|
LoadingIndicator: LoadingIndicator,
|
|
544
519
|
MenuList: MenuListComponent,
|
|
545
520
|
NoOptionsMessage: NoOptionsButton,
|
|
546
|
-
} })] })),
|
|
521
|
+
} }), _jsx(Delimiter, { isDelimiterVisible: isDelimiterVisible, isMenuShadowless: isMenuShadowless, isShowCatalogSearchButton: isShowCatalogSearchButton, delimiterOffset: delimiterOffset })] })), _jsx(Hint, { text: hint }), _jsx(Modal, { isModalOpen: !isNull(modalData), platform: platform, fontFamily: fontFamily, content: modalContent, isBottomSheet: isMobilePlatform(platform), backgroundColor: "var(--color-bg-blackout-transparent)", handleCloseModal: handleCloseModal })] })));
|
|
547
522
|
};
|
|
548
|
-
export default UserDropdown;
|
|
523
|
+
export default memo(UserDropdown);
|
|
549
524
|
//# sourceMappingURL=UserDropdown.js.map
|