@expressms/smartapp-ui 3.0.0-alpha.21 → 3.0.0-alpha.210
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 +92 -47
- package/build/main/constants/constants.js +132 -49
- package/build/main/constants/constants.js.map +1 -1
- package/build/main/constants/types.d.ts +13 -2
- package/build/main/helpers/index.d.ts +7 -5
- package/build/main/helpers/index.js +28 -7
- 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 +226 -13
- 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/main.js +0 -6
- 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 +81 -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 +55 -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 +201 -52
- package/build/main//321/201omponents/Calendar/Calendar.js.map +1 -1
- package/build/main//321/201omponents/Calendar/types.d.ts +16 -3
- 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 +211 -47
- package/build/main//321/201omponents/Chip/Chip.js.map +1 -1
- package/build/main//321/201omponents/Chip/types.d.ts +15 -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 +12 -0
- package/build/main//321/201omponents/CustomSelectProfiles/selectStyles.js +41 -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 +92 -31
- package/build/main//321/201omponents/Input/Input.js.map +1 -1
- package/build/main//321/201omponents/Input/types.d.ts +13 -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 +219 -81
- package/build/main//321/201omponents/Modal/Modal.js.map +1 -1
- package/build/main//321/201omponents/Modal/types.d.ts +38 -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/ScrollBar/ScrollBar.js +2 -2
- package/build/main//321/201omponents/ScrollBar/ScrollBar.js.map +1 -1
- 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 +76 -8
- 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 -3
- package/build/main//321/201omponents/UserDropdown/ContactBottomSheet/ContactBottomSheet.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/ContactInfo/ContactInfo.js +23 -13
- 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 +37 -60
- 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 -38
- package/build/main//321/201omponents/UserDropdown/MultiValueLabel/MultiValueLabel.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/Option/Option.js +18 -13
- 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 +6 -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 +245 -266
- 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 +8 -0
- package/build/main//321/201omponents/UserDropdown/components/Mask.js +19 -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 +58 -27
- package/build/main//321/201omponents/UserDropdown/selectStyles.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/types.d.ts +146 -62
- package/build/main//321/201omponents/UserDropdown/types.js +1 -8
- package/build/main//321/201omponents/UserDropdown/types.js.map +1 -1
- package/package.json +13 -8
- 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,82 @@ 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, checkIsIosPlatform, checkIsMobilePlatform, generateFontFamilyStyle, generateId } 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, DEFAULT_INPUT_PADDING, 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.isMaskHiddenOnFocus, isMaskHiddenOnFocus = _y === void 0 ? false : _y, _z = _a.isInputValueClearedOnBlur, isInputValueClearedOnBlur = _z === void 0 ? false : _z, _0 = _a.language, language = _0 === void 0 ? LANGUAGES.ru : _0, _1 = _a.layoutType, layoutType = _1 === void 0 ? LAYOUT_TYPE.minimal : _1, externalInputValue = _a.externalInputValue, title = _a.title, contactInfoTitle = _a.contactInfoTitle, mask = _a.mask, suffix = _a.suffix, _2 = _a.placeholder, placeholder = _2 === void 0 ? EMPTY_STRING : _2, focusPlaceholder = _a.focusPlaceholder, hint = _a.hint, onShowCatalogSearchButtonClick = _a.onShowCatalogSearchButtonClick, noOptionsMessage = _a.noOptionsMessage, maxMembersCount = _a.maxMembersCount, skeletonRowsCount = _a.skeletonRowsCount, _3 = _a.maxRowsCountToCollapseChips, maxRowsCountToCollapseChips = _3 === void 0 ? DEFAULT_MAX_ROWS_COUNT_TO_COLLAPSE_CHIPS : _3, _4 = _a.menuListMaxHeight, menuListMaxHeight = _4 === void 0 ? DEFAULT_MENU_LIST_MAX_HEIGHT : _4, _5 = _a.menuPosition, menuPosition = _5 === void 0 ? MENU_POSITIONS.top : _5, menuLocation = _a.menuLocation, menuPortalTarget = _a.menuPortalTarget, _6 = _a.autoFocus, autoFocus = _6 === void 0 ? false : _6, containerClassName = _a.containerClassName, charHintClassName = _a.charHintClassName, containerPadding = _a.containerPadding, containerStyles = _a.containerStyles, selectedEntries = _a.selectedEntries, corporateEntries = _a.corporateEntries, myContactsEntries = _a.myContactsEntries, emailsToExclude = _a.emailsToExclude, _7 = _a.userDropdownId, initialUserDropdownId = _7 === void 0 ? EMPTY_STRING : _7, 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 _8 = useState(initialUserDropdownId), userDropdownId = _8[0], setUserDropdownId = _8[1];
|
|
51
|
+
var _9 = useState([]), selectedUsers = _9[0], setSelectedUsers = _9[1];
|
|
52
|
+
var _10 = useState(EMPTY_STRING), paddingLeft = _10[0], setPaddingLeft = _10[1];
|
|
53
|
+
var _11 = useState(EMPTY_STRING), paddingRight = _11[0], setPaddingRight = _11[1];
|
|
54
|
+
var _12 = useState(0), maskWidth = _12[0], setMaskWidth = _12[1];
|
|
55
|
+
var _13 = useState(0), suffixWidth = _13[0], setSuffixWidth = _13[1];
|
|
56
|
+
var _14 = useState(true), isSearchable = _14[0], setIsSearchable = _14[1];
|
|
57
|
+
var _15 = useState(false), isUserTyping = _15[0], setIsUserTyping = _15[1];
|
|
58
|
+
var _16 = useState(null), modalData = _16[0], setModalData = _16[1];
|
|
59
|
+
var _17 = useState(EMPTY_STRING), chipLabelWithMaxWidth = _17[0], setChipLabelWithMaxWidth = _17[1];
|
|
60
|
+
var _18 = useState(EMPTY_STRING), inputValue = _18[0], setInputValue = _18[1];
|
|
61
|
+
var _19 = useState(placeholder), placeholderValue = _19[0], setPlaceholderValue = _19[1];
|
|
62
|
+
var _20 = useState(false), isDelimiterVisible = _20[0], setIsDelimiterVisible = _20[1];
|
|
63
|
+
var _21 = useState(0), delimiterOffset = _21[0], setDelimiterOffset = _21[1];
|
|
64
|
+
var _22 = useState(false), isFocused = _22[0], setIsFocused = _22[1];
|
|
96
65
|
var isInputFocused = useRef(false);
|
|
97
66
|
var selectRef = useRef(null);
|
|
98
67
|
var maskRef = useRef(null);
|
|
68
|
+
var suffixRef = useRef(null);
|
|
99
69
|
var menuScrollFromTop = useRef(0);
|
|
100
70
|
var collapsableChipsCount = useRef(0);
|
|
71
|
+
var visibleChipsCount = useRef(0);
|
|
72
|
+
var isNeedCheckChipCollapsableCount = useRef(false);
|
|
101
73
|
var lastVisibleChipIndex = useRef(-1);
|
|
102
74
|
var skipAddUserToChipsOnNextBlurRef = useRef(false);
|
|
75
|
+
var userTypingTimeoutRef = useRef(null);
|
|
76
|
+
var prevIsLoadingRef = useRef(isLoading);
|
|
103
77
|
var selectedUsersLength = selectedUsers.length;
|
|
78
|
+
var _23 = useDroppable({ id: userDropdownId }), setNodeRef = _23.setNodeRef, over = _23.over;
|
|
79
|
+
var overId = (over || {}).id;
|
|
80
|
+
var isDraggable = overId === userDropdownId;
|
|
81
|
+
var isInputPlaceholderVisible = selectedUsersLength === 1 && isEmpty(inputValue) ? ((_b = selectedUsers[0].isNotRemovable) !== null && _b !== void 0 ? _b : false) : false;
|
|
82
|
+
var isMaskVisible = !isEmpty(mask) && (!isMaskHiddenOnFocus || (isEmpty(inputValue) && !isFocused));
|
|
83
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
+
useImperativeHandle(focusRef, function () { return ({ focus: handleFocus, blur: function () { return handleDragBlur(true); } }); }, []);
|
|
104
85
|
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
|
-
};
|
|
86
|
+
var isCharHintVisible = useCharHintDisplay({ inputValue: inputValue }).isCharHintVisible;
|
|
87
|
+
var checkIsEmailToExclude = useCallback(function (email) { return includes(emailsToExclude, email); }, [emailsToExclude]);
|
|
116
88
|
var generateStyles = function () {
|
|
117
89
|
return selectStyles({
|
|
118
90
|
isChipsVisible: isChipsVisible,
|
|
119
91
|
isMaxMembersAdded: maxMembersCount && isChipsVisible ? selectedUsersLength === maxMembersCount : false,
|
|
120
92
|
isDisabled: isDisabled,
|
|
121
|
-
|
|
93
|
+
isInputPlaceholderVisible: isInputPlaceholderVisible,
|
|
122
94
|
lastRowNumber: isChipsVisible ? Math.ceil(selectedUsersLength / 2) + 1 : 1,
|
|
123
|
-
paddingLeft: paddingLeft,
|
|
95
|
+
paddingLeft: isMaskVisible || isEmpty(mask) ? paddingLeft : "".concat(DEFAULT_INPUT_PADDING, "px"),
|
|
96
|
+
paddingRight: !isChipsVisible && !isEmpty(inputValue) ? PADDING_WITH_CLEAR_ICON : paddingRight,
|
|
124
97
|
platform: platform,
|
|
125
98
|
layoutType: layoutType,
|
|
126
99
|
isInputHidden: isInputHidden,
|
|
127
100
|
isDisabledMenuOffsetAtFullscreen: isDisabledMenuOffsetAtFullscreen,
|
|
128
|
-
|
|
101
|
+
isInputFocused: isInputFocused.current,
|
|
102
|
+
isMaskRepresented: isMaskVisible,
|
|
103
|
+
isSuffixRepresented: !isNil(suffix),
|
|
104
|
+
isMenuShadowless: isMenuShadowless,
|
|
105
|
+
isShowCatalogSearchButton: isShowCatalogSearchButton,
|
|
129
106
|
fontFamilyStyle: fontFamilyStyle,
|
|
130
107
|
containerPadding: containerPadding,
|
|
108
|
+
isDraggable: isDraggable,
|
|
109
|
+
isChipsCollapsed: isChipsCollapsable && !isInputFocused.current,
|
|
110
|
+
menuListMaxHeight: menuListMaxHeight,
|
|
111
|
+
maxRowsCountToCollapseChips: maxRowsCountToCollapseChips,
|
|
112
|
+
isError: isError,
|
|
131
113
|
});
|
|
132
114
|
};
|
|
133
115
|
var generateNoOptionsMessage = function (_a) {
|
|
@@ -152,71 +134,74 @@ var UserDropdown = function (_a) {
|
|
|
152
134
|
collapsableChipsCount: collapsableChipsCount,
|
|
153
135
|
lastVisibleChipIndex: lastVisibleChipIndex,
|
|
154
136
|
};
|
|
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);
|
|
137
|
+
var _c = retrieveFilteredContacts({
|
|
138
|
+
query: ((_b = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.inputValue) || EMPTY_STRING,
|
|
139
|
+
corporateEntries: corporateEntries,
|
|
140
|
+
myContactsEntries: myContactsEntries,
|
|
141
|
+
checkIsEmailToExclude: checkIsEmailToExclude,
|
|
142
|
+
}), filteredCorporateContacts = _c.filteredCorporateContacts, filteredLocalContacts = _c.filteredLocalContacts, filteredMyContacts = _c.filteredMyContacts;
|
|
143
|
+
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
144
|
};
|
|
145
|
+
var clearUserTypingTimeout = useCallback(function () {
|
|
146
|
+
var userTypingTimeoutRefCurrent = userTypingTimeoutRef.current;
|
|
147
|
+
if (userTypingTimeoutRefCurrent) {
|
|
148
|
+
clearTimeout(userTypingTimeoutRefCurrent);
|
|
149
|
+
userTypingTimeoutRef.current = null;
|
|
150
|
+
}
|
|
151
|
+
}, []);
|
|
152
|
+
useEffect(function () {
|
|
153
|
+
if (prevIsLoadingRef.current && !isLoading) {
|
|
154
|
+
setIsUserTyping(false);
|
|
155
|
+
clearUserTypingTimeout();
|
|
156
|
+
}
|
|
157
|
+
prevIsLoadingRef.current = isLoading;
|
|
158
|
+
}, [isLoading, clearUserTypingTimeout]);
|
|
175
159
|
var requestInputChangeDebounce = useMemo(function () {
|
|
176
160
|
return debounce(function (inputValue) {
|
|
177
161
|
onInputChange(inputValue);
|
|
178
|
-
|
|
162
|
+
clearUserTypingTimeout();
|
|
163
|
+
userTypingTimeoutRef.current = setTimeout(function () { return setIsUserTyping(false); }, CLEAR_USER_TYPING_TIMEOUT);
|
|
179
164
|
}, 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); };
|
|
165
|
+
}, [clearUserTypingTimeout, onInputChange]);
|
|
183
166
|
var handleMenuClose = function () {
|
|
184
167
|
menuScrollFromTop.current = 0;
|
|
185
|
-
|
|
186
|
-
onMenuClose
|
|
168
|
+
setIsDelimiterVisible(false);
|
|
169
|
+
onMenuClose === null || onMenuClose === void 0 ? void 0 : onMenuClose();
|
|
187
170
|
};
|
|
188
|
-
var handleInputChange = function (inputValue, additionalInfo) {
|
|
171
|
+
var handleInputChange = useCallback(function (inputValue, additionalInfo) {
|
|
189
172
|
if (additionalInfo) {
|
|
190
|
-
var action = additionalInfo.action,
|
|
173
|
+
var action = additionalInfo.action, _a = additionalInfo.prevInputValue, prevInputValue = _a === void 0 ? EMPTY_STRING : _a;
|
|
191
174
|
var trimPrevInputValue_1 = prevInputValue.trim();
|
|
192
175
|
var isInputBlurAction = action === INPUT_ACTIONS.blur;
|
|
193
176
|
var isMenuCloseAction = action === MENU_ACTIONS.close;
|
|
194
|
-
if (!isInputBlurAction && !isMenuCloseAction)
|
|
177
|
+
if (!isInputBlurAction && !isMenuCloseAction) {
|
|
195
178
|
setInputValue(inputValue);
|
|
179
|
+
onImmediateInputChange === null || onImmediateInputChange === void 0 ? void 0 : onImmediateInputChange(inputValue);
|
|
180
|
+
}
|
|
196
181
|
if ((isInputBlurAction || isMenuCloseAction) && checkIsValueIsEmail(trimPrevInputValue_1)) {
|
|
197
182
|
var isUserAlreadySelected = selectedUsers.some(function (_a) {
|
|
198
183
|
var email = _a.email;
|
|
199
184
|
return email === trimPrevInputValue_1;
|
|
200
185
|
});
|
|
201
|
-
|
|
186
|
+
var nextInputValue = isUserAlreadySelected || checkIsEmailToExclude(trimPrevInputValue_1) ? trimPrevInputValue_1 : inputValue;
|
|
187
|
+
setInputValue(nextInputValue);
|
|
188
|
+
onImmediateInputChange === null || onImmediateInputChange === void 0 ? void 0 : onImmediateInputChange(nextInputValue);
|
|
202
189
|
}
|
|
203
190
|
}
|
|
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))
|
|
191
|
+
if (!isEmpty(inputValue)) {
|
|
192
|
+
clearUserTypingTimeout();
|
|
193
|
+
setIsUserTyping(true);
|
|
194
|
+
}
|
|
195
|
+
inputValue.length >= MIN_INPUT_SYMBOLS && requestInputChangeDebounce(inputValue);
|
|
196
|
+
}, [onImmediateInputChange, requestInputChangeDebounce, selectedUsers, checkIsEmailToExclude, clearUserTypingTimeout]);
|
|
197
|
+
var handleAddUser = function () {
|
|
198
|
+
var selectRefCurrent = selectRef.current;
|
|
199
|
+
if (isNil(selectRefCurrent))
|
|
219
200
|
return;
|
|
201
|
+
var props = selectRefCurrent.props;
|
|
202
|
+
var options = props.options, onChange = props.onChange;
|
|
203
|
+
if (isEmpty(inputValue))
|
|
204
|
+
return Promise.resolve();
|
|
220
205
|
var trimInputValue = inputValue.trim();
|
|
221
206
|
var optionProps = {
|
|
222
207
|
platform: platform,
|
|
@@ -248,10 +233,10 @@ var UserDropdown = function (_a) {
|
|
|
248
233
|
return email === inputEmail;
|
|
249
234
|
});
|
|
250
235
|
enteredUsers.push(existingUser || generateEnteredByUserOption(__assign(__assign({}, optionProps), { email: inputEmail })));
|
|
251
|
-
if (isUserAlreadySelected &&
|
|
252
|
-
|
|
236
|
+
if (isUserAlreadySelected && isSingleEmailEntered)
|
|
237
|
+
return;
|
|
253
238
|
else
|
|
254
|
-
handleInputChange(
|
|
239
|
+
handleInputChange(EMPTY_STRING, { action: INPUT_ACTIONS.change, prevInputValue: trimInputValue });
|
|
255
240
|
}
|
|
256
241
|
!isValueIsEmail && incorrectEmails.push(inputEmail);
|
|
257
242
|
});
|
|
@@ -265,7 +250,7 @@ var UserDropdown = function (_a) {
|
|
|
265
250
|
var isEnterPressed = code === ENTER_KEY || key === ENTER_KEY;
|
|
266
251
|
var isBackspacePressed = code === BACKSPACE_KEY || key === BACKSPACE_KEY;
|
|
267
252
|
var isSpacePressed = code === SPACE_KEY;
|
|
268
|
-
var isTransformChipToInputValue = isBackspacePressed && isBackspaceChipToInput && inputValue ===
|
|
253
|
+
var isTransformChipToInputValue = isBackspacePressed && isBackspaceChipToInput && inputValue === EMPTY_STRING && !isEmpty(selectedUsers);
|
|
269
254
|
if (isEnterPressed) {
|
|
270
255
|
event.preventDefault();
|
|
271
256
|
(_a = handleAddUser()) === null || _a === void 0 ? void 0 : _a.then(function () { });
|
|
@@ -291,26 +276,29 @@ var UserDropdown = function (_a) {
|
|
|
291
276
|
(_c = (_b = selectRef.current) === null || _b === void 0 ? void 0 : _b.onMenuOpen) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
292
277
|
}
|
|
293
278
|
};
|
|
294
|
-
var transformCurrentChipToInputValue = function (label,
|
|
279
|
+
var transformCurrentChipToInputValue = useCallback(function (label, value) {
|
|
295
280
|
var _a, _b;
|
|
296
281
|
skipAddUserToChipsOnNextBlurRef.current = true;
|
|
297
282
|
setSelectedUsers(function (prevSelectedUsers) {
|
|
298
283
|
var nextSelectedUsers = prevSelectedUsers.filter(function (_a) {
|
|
299
|
-
var userEmail = _a.email;
|
|
300
|
-
return userEmail !==
|
|
284
|
+
var userEmail = _a.email, userType = _a.userType, userUid = _a.uid;
|
|
285
|
+
return checkIfContactTypeIsGroup(userType) ? userUid !== value : userEmail !== value;
|
|
301
286
|
});
|
|
302
287
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextSelectedUsers.map(function (userData) { return omit(userData, COMMON_FIELDS_TO_OMIT); }));
|
|
303
288
|
return nextSelectedUsers;
|
|
304
289
|
});
|
|
290
|
+
handleFocus();
|
|
305
291
|
setInputValue(label);
|
|
306
292
|
onInputChange(label);
|
|
307
293
|
handleInputChange(label);
|
|
308
294
|
onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen();
|
|
309
295
|
(_b = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.onMenuOpen) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
310
|
-
|
|
296
|
+
setIsUserTyping(false);
|
|
297
|
+
},
|
|
298
|
+
// eslint-disable-next-line
|
|
299
|
+
[onInputChange, handleInputChange, onMenuOpen, onChange]);
|
|
311
300
|
var handleChange = function (newSelectedUsers) {
|
|
312
|
-
var uniqNewSelectedUsers = uniqBy(newSelectedUsers, EMAIL_FIELD);
|
|
313
|
-
var users = [];
|
|
301
|
+
var uniqNewSelectedUsers = isDisabledCheckUniqueEmails ? newSelectedUsers : uniqBy(newSelectedUsers, EMAIL_FIELD);
|
|
314
302
|
var deletedUser = selectedUsers.find(function (_a) {
|
|
315
303
|
var value = _a.value;
|
|
316
304
|
return !uniqNewSelectedUsers.some(function (_a) {
|
|
@@ -320,147 +308,114 @@ var UserDropdown = function (_a) {
|
|
|
320
308
|
});
|
|
321
309
|
if (deletedUser === null || deletedUser === void 0 ? void 0 : deletedUser.isNotRemovable)
|
|
322
310
|
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
|
-
});
|
|
311
|
+
var users = transformSelectedUsers(uniqNewSelectedUsers);
|
|
330
312
|
onChange(users);
|
|
331
|
-
if (!isInputHidden)
|
|
313
|
+
if (!isInputHidden && !isStateless)
|
|
332
314
|
setSelectedUsers(uniqNewSelectedUsers);
|
|
333
315
|
if (!isInputFocused.current && isChipsCollapsable)
|
|
334
316
|
handleFocus();
|
|
335
317
|
};
|
|
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
318
|
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;
|
|
319
|
+
var data = _a.data;
|
|
320
|
+
return applyFilteringToOption({ isFilteringDisabled: isFilteringDisabled, isSelectedOptionsHidden: isSelectedOptionsHidden, inputValue: inputValue, data: data, selectedUsers: selectedUsers });
|
|
364
321
|
};
|
|
365
322
|
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);
|
|
323
|
+
var chips = retrieveChipsElements(userDropdownId);
|
|
371
324
|
if (isEmpty(chips))
|
|
372
325
|
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
|
-
});
|
|
326
|
+
var _a = collapseChips({
|
|
327
|
+
userDropdownId: userDropdownId,
|
|
328
|
+
maxRowsCountToCollapseChips: maxRowsCountToCollapseChips,
|
|
329
|
+
maskWidth: maskWidth,
|
|
330
|
+
suffixWidth: suffixWidth,
|
|
331
|
+
chips: chips,
|
|
332
|
+
}), collapsableChips = _a.collapsableChips, numberOfVisibleChips = _a.numberOfVisibleChips, chipLabelWithMaxWidth = _a.chipLabelWithMaxWidth;
|
|
333
|
+
isNeedCheckChipCollapsableCount.current = true;
|
|
334
|
+
visibleChipsCount.current = numberOfVisibleChips;
|
|
403
335
|
collapsableChipsCount.current = collapsableChips;
|
|
404
|
-
lastVisibleChipIndex.current =
|
|
336
|
+
lastVisibleChipIndex.current = numberOfVisibleChips;
|
|
405
337
|
setChipLabelWithMaxWidth(chipLabelWithMaxWidth || generateId());
|
|
406
338
|
};
|
|
407
|
-
var handleUnCollapseChips = function () {
|
|
408
|
-
var _a;
|
|
339
|
+
var handleUnCollapseChips = useCallback(function () {
|
|
409
340
|
if (!userDropdownId)
|
|
410
341
|
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
|
-
});
|
|
342
|
+
var chips = retrieveChipsElements(userDropdownId);
|
|
343
|
+
unCollapseChips(chipLabelWithMaxWidth, chips);
|
|
344
|
+
isNeedCheckChipCollapsableCount.current = false;
|
|
345
|
+
visibleChipsCount.current = chips.length;
|
|
418
346
|
collapsableChipsCount.current = 0;
|
|
419
347
|
lastVisibleChipIndex.current = -1;
|
|
420
|
-
setChipLabelWithMaxWidth(
|
|
348
|
+
setChipLabelWithMaxWidth(EMPTY_STRING);
|
|
349
|
+
}, [chipLabelWithMaxWidth, userDropdownId]);
|
|
350
|
+
var handleDragBlur = function (isDisableCheckFocused) {
|
|
351
|
+
var _a;
|
|
352
|
+
if (!isInputFocused.current && !isDisableCheckFocused)
|
|
353
|
+
return;
|
|
354
|
+
if (selectRef.current)
|
|
355
|
+
selectRef.current._preventBlur = false;
|
|
356
|
+
(_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
421
357
|
};
|
|
422
358
|
var handleBlur = function () {
|
|
423
359
|
var _a;
|
|
424
360
|
var shouldSkipAddUserToChipsOnNextBlur = skipAddUserToChipsOnNextBlurRef.current;
|
|
361
|
+
var _b = selectRef.current || {}, _preventBlur = _b._preventBlur, _contextMenuOpen = _b._contextMenuOpen, _isDragging = _b._isDragging;
|
|
362
|
+
if (_preventBlur || _contextMenuOpen || _isDragging || skipAddUserToChipsOnNextBlurRef.current)
|
|
363
|
+
return;
|
|
425
364
|
var onBlurComplete = function () {
|
|
426
365
|
isChipsCollapsable && handleCollapseChips();
|
|
427
366
|
isInputFocused.current = false;
|
|
367
|
+
setIsFocused(false);
|
|
428
368
|
};
|
|
429
369
|
if (shouldSkipAddUserToChipsOnNextBlur) {
|
|
430
370
|
onBlurComplete();
|
|
431
371
|
return;
|
|
432
372
|
}
|
|
433
373
|
else
|
|
434
|
-
(_a = handleAddUser(
|
|
374
|
+
(_a = handleAddUser()) === null || _a === void 0 ? void 0 : _a.then(function () { return requestAnimationFrame(function () { return requestAnimationFrame(function () { return onBlurComplete(); }); }); });
|
|
435
375
|
skipAddUserToChipsOnNextBlurRef.current = false;
|
|
436
376
|
};
|
|
437
|
-
var
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
setTimeout(function () { var _a; return (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 100);
|
|
377
|
+
var handleSelectBlur = function () {
|
|
378
|
+
setPlaceholderValue(placeholder);
|
|
379
|
+
if (isInputValueClearedOnBlur) {
|
|
380
|
+
setInputValue(EMPTY_STRING);
|
|
381
|
+
onImmediateInputChange === null || onImmediateInputChange === void 0 ? void 0 : onImmediateInputChange(EMPTY_STRING);
|
|
443
382
|
}
|
|
383
|
+
setTimeout(handleBlur, RENDER_DELAY);
|
|
384
|
+
};
|
|
385
|
+
var focusInputIOS = useCallback(function (input) {
|
|
386
|
+
var length = input.value.length;
|
|
387
|
+
requestAnimationFrame(function () {
|
|
388
|
+
input.focus();
|
|
389
|
+
input.value === EMPTY_STRING ? setCaretInEmptyInput(input) : setCaretPosition(input, length);
|
|
390
|
+
});
|
|
391
|
+
}, []);
|
|
392
|
+
var handleFocus = useCallback(function (isDisableCheckFocused) {
|
|
393
|
+
setPlaceholderValue(focusPlaceholder || SEARCH_PLACEHOLDER[language]);
|
|
394
|
+
if (isInputFocused.current && !isDisableCheckFocused)
|
|
395
|
+
return;
|
|
444
396
|
isInputFocused.current = true;
|
|
397
|
+
setIsFocused(true);
|
|
398
|
+
var selectRefCurrent = selectRef.current;
|
|
399
|
+
var _a = selectRefCurrent || {}, _preventBlur = _a._preventBlur, inputRef = _a.inputRef;
|
|
400
|
+
setTimeout(function () {
|
|
401
|
+
if (selectRefCurrent && !_preventBlur)
|
|
402
|
+
checkIsIosPlatform(platform) && inputRef ? focusInputIOS(inputRef) : selectRefCurrent.focus();
|
|
403
|
+
}, RENDER_DELAY);
|
|
445
404
|
isChipsCollapsable && handleUnCollapseChips();
|
|
446
|
-
};
|
|
405
|
+
}, [focusPlaceholder, language, isChipsCollapsable, handleUnCollapseChips, platform, focusInputIOS]);
|
|
406
|
+
var handleForceFocus = useCallback(function () { return setTimeout(function () { return handleFocus(true); }, RENDER_DELAY); }, [handleFocus]);
|
|
407
|
+
var handleSelectFocus = useCallback(function () {
|
|
408
|
+
handleFocus();
|
|
409
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
410
|
+
}, [handleFocus, onFocus]);
|
|
447
411
|
var handleCloseModal = function () {
|
|
448
412
|
setModalData(null);
|
|
449
413
|
setIsSearchable(true);
|
|
450
|
-
if (
|
|
414
|
+
if (checkIsMobilePlatform(platform)) {
|
|
451
415
|
new Promise(function (resolve) { return resolve(); }).then(function () { var _a; return (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
452
416
|
}
|
|
453
417
|
};
|
|
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, {}));
|
|
418
|
+
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
419
|
useEffect(function () {
|
|
465
420
|
if (externalInputValue && isInputHidden) {
|
|
466
421
|
setInputValue(externalInputValue);
|
|
@@ -472,48 +427,45 @@ var UserDropdown = function (_a) {
|
|
|
472
427
|
!userDropdownId && setUserDropdownId("user_dropdown_".concat(generateId().replace(/-/g, '_')));
|
|
473
428
|
}, [userDropdownId]);
|
|
474
429
|
useLayoutEffect(function () {
|
|
475
|
-
if (
|
|
476
|
-
|
|
430
|
+
if (isChipsCollapsable && !isEmpty(chipLabelWithMaxWidth) && !isInputFocused.current) {
|
|
431
|
+
handleUnCollapseChips();
|
|
432
|
+
handleCollapseChips();
|
|
477
433
|
}
|
|
478
434
|
// eslint-disable-next-line
|
|
435
|
+
}, [hint]);
|
|
436
|
+
useLayoutEffect(function () {
|
|
437
|
+
if (userDropdownId)
|
|
438
|
+
setTimeout(function () { return (isChipsCollapsable ? handleCollapseChips() : handleUnCollapseChips()); }, RENDER_DELAY);
|
|
439
|
+
// eslint-disable-next-line
|
|
479
440
|
}, [isChipsCollapsable, userDropdownId]);
|
|
480
441
|
useEffect(function () {
|
|
481
|
-
setPaddingLeft(
|
|
442
|
+
setPaddingLeft(calculateHorizontalPadding(maskRef, setMaskWidth));
|
|
482
443
|
}, [mask]);
|
|
444
|
+
useEffect(function () {
|
|
445
|
+
setPaddingRight(calculateHorizontalPadding(suffixRef, setSuffixWidth));
|
|
446
|
+
}, [suffix]);
|
|
483
447
|
useEffect(function () {
|
|
484
448
|
setSelectedUsers(function (prevSelectedUsers) {
|
|
485
449
|
return prevSelectedUsers.map(function (selectedUser) { return (__assign(__assign({}, selectedUser), { layoutType: layoutType, fontFamily: fontFamily, language: language, isChipsCollapsable: isChipsCollapsable })); });
|
|
486
450
|
});
|
|
487
451
|
}, [layoutType, fontFamily, language, isChipsCollapsable]);
|
|
488
452
|
useEffect(function () {
|
|
489
|
-
if (!isEmpty(selectedEntries)) {
|
|
453
|
+
if (isArray(selectedEntries) && !isEmpty(selectedEntries)) {
|
|
490
454
|
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,
|
|
455
|
+
var contextMenuItems = entity.contextMenuItems;
|
|
456
|
+
var generateContextMenuItems = function () {
|
|
457
|
+
return contextMenuItems === null || contextMenuItems === void 0 ? void 0 : contextMenuItems.map(function (item) { return (__assign(__assign({}, item), { action: function (data) {
|
|
458
|
+
var _a;
|
|
459
|
+
(_a = item.action) === null || _a === void 0 ? void 0 : _a.call(item, data);
|
|
460
|
+
checkIsMobilePlatform(platform) && handleFocus(true);
|
|
461
|
+
} })); });
|
|
510
462
|
};
|
|
511
|
-
var
|
|
512
|
-
|
|
513
|
-
: generateContactsOption(__assign({ option: entity }, commonFields));
|
|
514
|
-
return 'contacts' in entity ? generateCorporateOption(__assign({ option: entity }, commonFields)) : generatedNotCorporateEntity;
|
|
463
|
+
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() });
|
|
464
|
+
return transformSelectedEntity(entity, commonFields);
|
|
515
465
|
}));
|
|
516
466
|
}
|
|
467
|
+
else
|
|
468
|
+
setSelectedUsers([]);
|
|
517
469
|
// eslint-disable-next-line
|
|
518
470
|
}, [selectedEntries]);
|
|
519
471
|
useEffect(function () {
|
|
@@ -526,15 +478,42 @@ var UserDropdown = function (_a) {
|
|
|
526
478
|
useEffect(function () {
|
|
527
479
|
return function () {
|
|
528
480
|
requestInputChangeDebounce.cancel();
|
|
529
|
-
|
|
481
|
+
clearUserTypingTimeout();
|
|
530
482
|
};
|
|
531
|
-
}, [
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
483
|
+
}, [clearUserTypingTimeout, requestInputChangeDebounce]);
|
|
484
|
+
useEffect(function () {
|
|
485
|
+
if (isChipsCollapsable && !isInputFocused.current && isNeedCheckChipCollapsableCount.current)
|
|
486
|
+
collapsableChipsCount.current = (selectedEntries || []).length - visibleChipsCount.current;
|
|
487
|
+
}, [isChipsCollapsable, selectedEntries]);
|
|
488
|
+
var OptionComponent = useCallback(function (props) { return _jsx(Option, __assign({}, props, { isMenuShadowless: isMenuShadowless, children: props.children })); }, [isMenuShadowless]);
|
|
489
|
+
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 }))); }, [
|
|
490
|
+
charHintClassName,
|
|
491
|
+
hasNextPage,
|
|
492
|
+
isCharHintVisible,
|
|
493
|
+
isLoading,
|
|
494
|
+
isMenuShadowless,
|
|
495
|
+
isNextPageLoading,
|
|
496
|
+
isShowCatalogSearchButton,
|
|
497
|
+
isUserTyping,
|
|
498
|
+
language,
|
|
499
|
+
menuListMaxHeight,
|
|
500
|
+
onLoadNextPage,
|
|
501
|
+
onShowCatalogSearchButtonClick,
|
|
502
|
+
platform,
|
|
503
|
+
]);
|
|
504
|
+
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 }) }))); };
|
|
505
|
+
var InputComponent = useCallback(function (props) { return (_jsx(Input, __assign({}, props, { "data-is-clearable": !isChipsVisible, "data-placeholder": placeholderValue, suffixref: suffixRef, suffix: suffix }))); }, [isChipsVisible, placeholderValue, suffix]);
|
|
506
|
+
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]);
|
|
507
|
+
var setContainerNodeRef = function (ref) {
|
|
508
|
+
var _a = ((ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect()) || {}).left, left = _a === void 0 ? 0 : _a;
|
|
509
|
+
setNodeRef(ref);
|
|
510
|
+
setDelimiterOffset(isShowCatalogSearchButton ? 0 : left);
|
|
511
|
+
};
|
|
512
|
+
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, isVisible: isMaskVisible }), _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) {
|
|
513
|
+
var _b = _a.isAlreadyAdded, isAlreadyAdded = _b === void 0 ? false : _b;
|
|
514
|
+
return isAlreadyAdded;
|
|
515
|
+
}, 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: {
|
|
516
|
+
Input: InputComponent,
|
|
538
517
|
MultiValueLabel: MultiValueLabelComponent,
|
|
539
518
|
MultiValueRemove: MultiValueRemove,
|
|
540
519
|
Option: OptionComponent,
|
|
@@ -543,7 +522,7 @@ var UserDropdown = function (_a) {
|
|
|
543
522
|
LoadingIndicator: LoadingIndicator,
|
|
544
523
|
MenuList: MenuListComponent,
|
|
545
524
|
NoOptionsMessage: NoOptionsButton,
|
|
546
|
-
} })] })),
|
|
525
|
+
} }), _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: checkIsMobilePlatform(platform), backgroundColor: "var(--color-bg-blackout-transparent)", handleCloseModal: handleCloseModal })] })));
|
|
547
526
|
};
|
|
548
|
-
export default UserDropdown;
|
|
527
|
+
export default memo(UserDropdown);
|
|
549
528
|
//# sourceMappingURL=UserDropdown.js.map
|