@zohodesk/components 1.0.0-temp-158 → 1.0.0-temp-160
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/es/Accordion/Accordion.js +3 -7
- package/es/Accordion/AccordionItem.js +2 -4
- package/es/Animation/Animation.js +3 -3
- package/es/AppContainer/AppContainer.js +5 -13
- package/es/Avatar/Avatar.js +11 -23
- package/es/AvatarTeam/AvatarTeam.js +3 -3
- package/es/Button/Button.js +3 -4
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Card/Card.js +10 -21
- package/es/CheckBox/CheckBox.js +3 -5
- package/es/DateTime/CalendarView.js +20 -32
- package/es/DateTime/DateTime.js +6 -67
- package/es/DateTime/DateTimePopupFooter.js +2 -4
- package/es/DateTime/DateTimePopupHeader.js +2 -8
- package/es/DateTime/DateWidget.js +35 -98
- package/es/DateTime/DaysRow.js +2 -4
- package/es/DateTime/Time.js +2 -10
- package/es/DateTime/YearView.js +4 -28
- package/es/DateTime/__tests__/CalendarView.spec.js +0 -1
- package/es/DateTime/__tests__/DateTime.spec.js +0 -1
- package/es/DateTime/__tests__/DateWidget.spec.js +3 -2
- package/es/DateTime/common.js +0 -3
- package/es/DateTime/constants.js +0 -1
- package/es/DateTime/dateFormatUtils/dateFormat.js +30 -63
- package/es/DateTime/dateFormatUtils/dateFormats.js +1 -0
- package/es/DateTime/dateFormatUtils/dayChange.js +4 -13
- package/es/DateTime/dateFormatUtils/index.js +2 -32
- package/es/DateTime/dateFormatUtils/monthChange.js +0 -8
- package/es/DateTime/dateFormatUtils/timeChange.js +6 -22
- package/es/DateTime/dateFormatUtils/yearChange.js +2 -11
- package/es/DateTime/objectUtils.js +20 -14
- package/es/DateTime/typeChecker.js +0 -3
- package/es/DateTime/validator.js +6 -58
- package/es/DropBox/DropBox.js +2 -6
- package/es/DropBox/DropBoxElement/DropBoxElement.js +0 -7
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +3 -5
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +0 -3
- package/es/DropBox/props/defaultProps.js +2 -1
- package/es/DropBox/props/propTypes.js +2 -1
- package/es/DropDown/DropDown.js +4 -8
- package/es/DropDown/DropDownHeading.js +5 -4
- package/es/DropDown/DropDownItem.js +0 -6
- package/es/DropDown/DropDownSearch.js +0 -4
- package/es/DropDown/DropDownSeparator.js +0 -1
- package/es/DropDown/__tests__/DropDown.spec.js +2 -1
- package/es/Heading/Heading.js +3 -2
- package/es/Label/Label.js +3 -2
- package/es/Layout/Box.js +0 -13
- package/es/Layout/Container.js +1 -12
- package/es/Layout/index.js +2 -1
- package/es/ListItem/ListContainer.js +3 -8
- package/es/ListItem/ListItem.js +3 -9
- package/es/ListItem/ListItemWithAvatar.js +3 -9
- package/es/ListItem/ListItemWithCheckBox.js +2 -7
- package/es/ListItem/ListItemWithIcon.js +3 -8
- package/es/ListItem/ListItemWithRadio.js +3 -7
- package/es/Modal/Modal.js +11 -28
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +13 -89
- package/es/MultiSelect/AdvancedMultiSelect.js +9 -32
- package/es/MultiSelect/EmptyState.js +0 -2
- package/es/MultiSelect/MultiSelect.js +32 -99
- package/es/MultiSelect/MultiSelectHeader.js +0 -3
- package/es/MultiSelect/MultiSelectWithAvatar.js +6 -12
- package/es/MultiSelect/SelectedOptions.js +3 -6
- package/es/MultiSelect/Suggestions.js +3 -7
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +6 -4
- package/es/MultiSelect/props/propTypes.js +0 -2
- package/es/PopOver/PopOver.js +2 -18
- package/es/PopOver/__tests__/PopOver.spec.js +1 -2
- package/es/Popup/Popup.js +24 -77
- package/es/Popup/__tests__/Popup.spec.js +5 -17
- package/es/Popup/viewPort.js +4 -16
- package/es/Provider/IdProvider.js +5 -10
- package/es/Provider/LibraryContext.js +4 -6
- package/es/Provider/NumberGenerator/NumberGenerator.js +7 -21
- package/es/Provider/ZindexProvider.js +2 -9
- package/es/Radio/Radio.js +2 -4
- package/es/Responsive/CustomResponsive.js +18 -30
- package/es/Responsive/RefWrapper.js +7 -6
- package/es/Responsive/ResizeComponent.js +25 -35
- package/es/Responsive/ResizeObserver.js +6 -26
- package/es/Responsive/Responsive.js +20 -34
- package/es/Responsive/index.js +3 -1
- package/es/Responsive/sizeObservers.js +7 -28
- package/es/Responsive/utils/index.js +5 -7
- package/es/Responsive/utils/shallowCompare.js +2 -7
- package/es/Responsive/windowResizeObserver.js +0 -7
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +0 -4
- package/es/Ribbon/Ribbon.js +2 -3
- package/es/RippleEffect/RippleEffect.js +3 -1
- package/es/Select/GroupSelect.js +14 -58
- package/es/Select/Select.js +33 -79
- package/es/Select/SelectWithAvatar.js +4 -17
- package/es/Select/SelectWithIcon.js +5 -46
- package/es/Select/__tests__/Select.spec.js +8 -6
- package/es/Select/props/propTypes.js +0 -1
- package/es/Stencils/Stencils.js +3 -3
- package/es/Switch/Switch.js +3 -5
- package/es/Tab/Tab.js +4 -4
- package/es/Tab/TabContent.js +0 -1
- package/es/Tab/TabContentWrapper.js +0 -2
- package/es/Tab/TabWrapper.js +2 -5
- package/es/Tab/Tabs.js +7 -54
- package/es/Tab/__tests__/Tab.spec.js +3 -1
- package/es/Tab/__tests__/TabWrapper.spec.js +0 -1
- package/es/Tag/Tag.js +3 -6
- package/es/TextBox/TextBox.js +3 -15
- package/es/TextBox/__tests__/TextBox.spec.js +4 -1
- package/es/TextBoxIcon/TextBoxIcon.js +2 -9
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +7 -2
- package/es/Textarea/Textarea.js +3 -12
- package/es/Textarea/__tests__/Textarea.spec.js +2 -2
- package/es/Tooltip/Tooltip.js +14 -58
- package/es/Tooltip/__tests__/Tooltip.spec.js +0 -5
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +2 -3
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +5 -7
- package/es/deprecated/PortalLayer/PortalLayer.js +20 -25
- package/es/semantic/Button/Button.js +2 -3
- package/es/utils/Common.js +9 -54
- package/es/utils/ContextOptimizer.js +5 -4
- package/es/utils/__tests__/debounce.spec.js +2 -2
- package/es/utils/constructFullName.js +0 -2
- package/es/utils/css/compileClassNames.js +0 -5
- package/es/utils/css/mergeStyle.js +6 -7
- package/es/utils/css/utils.js +0 -1
- package/es/utils/datetime/common.js +5 -16
- package/es/utils/debounce.js +1 -5
- package/es/utils/dropDownUtils.js +11 -68
- package/es/utils/getInitial.js +0 -4
- package/es/utils/shallowEqual.js +0 -6
- package/lib/Accordion/Accordion.js +18 -42
- package/lib/Accordion/AccordionItem.js +18 -40
- package/lib/Accordion/__tests__/Accordion.spec.js +0 -3
- package/lib/Accordion/index.js +0 -3
- package/lib/Accordion/props/propTypes.js +0 -3
- package/lib/Animation/Animation.js +18 -38
- package/lib/Animation/__tests__/Animation.spec.js +7 -11
- package/lib/Animation/props/propTypes.js +0 -3
- package/lib/AppContainer/AppContainer.js +21 -56
- package/lib/AppContainer/props/propTypes.js +0 -3
- package/lib/Avatar/Avatar.js +38 -78
- package/lib/Avatar/__tests__/Avatar.spec.js +0 -44
- package/lib/Avatar/props/propTypes.js +0 -3
- package/lib/AvatarTeam/AvatarTeam.js +30 -52
- package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +0 -13
- package/lib/AvatarTeam/props/propTypes.js +0 -3
- package/lib/Button/Button.js +20 -31
- package/lib/Button/css/cssJSLogic.js +17 -18
- package/lib/Button/index.js +0 -3
- package/lib/Button/props/defaultProps.js +0 -2
- package/lib/Button/props/propTypes.js +0 -3
- package/lib/Buttongroup/Buttongroup.js +12 -32
- package/lib/Buttongroup/__test__/Buttongroup.spec.js +0 -10
- package/lib/Buttongroup/props/propTypes.js +0 -3
- package/lib/Card/Card.js +46 -102
- package/lib/Card/__tests__/Card.spec.js +1 -10
- package/lib/Card/index.js +0 -4
- package/lib/Card/props/propTypes.js +0 -3
- package/lib/CheckBox/CheckBox.js +47 -71
- package/lib/CheckBox/__tests__/CheckBox.spec.js +0 -3
- package/lib/CheckBox/props/propTypes.js +0 -3
- package/lib/DateTime/CalendarView.js +42 -82
- package/lib/DateTime/DateTime.js +156 -240
- package/lib/DateTime/DateTimePopupFooter.js +8 -31
- package/lib/DateTime/DateTimePopupHeader.js +17 -48
- package/lib/DateTime/DateWidget.js +250 -352
- package/lib/DateTime/DaysRow.js +5 -27
- package/lib/DateTime/Time.js +32 -73
- package/lib/DateTime/YearView.js +28 -77
- package/lib/DateTime/__tests__/CalendarView.spec.js +5 -13
- package/lib/DateTime/__tests__/DateTime.spec.js +37 -51
- package/lib/DateTime/__tests__/DateWidget.spec.js +8 -10
- package/lib/DateTime/common.js +0 -6
- package/lib/DateTime/constants.js +0 -1
- package/lib/DateTime/dateFormatUtils/dateFormat.js +122 -184
- package/lib/DateTime/dateFormatUtils/dateFormats.js +1 -0
- package/lib/DateTime/dateFormatUtils/dayChange.js +7 -14
- package/lib/DateTime/dateFormatUtils/index.js +16 -74
- package/lib/DateTime/dateFormatUtils/monthChange.js +9 -19
- package/lib/DateTime/dateFormatUtils/timeChange.js +22 -54
- package/lib/DateTime/dateFormatUtils/yearChange.js +11 -22
- package/lib/DateTime/index.js +0 -2
- package/lib/DateTime/objectUtils.js +20 -24
- package/lib/DateTime/props/propTypes.js +1 -11
- package/lib/DateTime/typeChecker.js +0 -4
- package/lib/DateTime/validator.js +10 -73
- package/lib/DropBox/DropBox.js +10 -34
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +37 -58
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +33 -41
- package/lib/DropBox/DropBoxElement/props/propTypes.js +0 -3
- package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +9 -14
- package/lib/DropBox/__tests__/DropBox.spec.js +2 -6
- package/lib/DropBox/css/cssJSLogic.js +1 -3
- package/lib/DropBox/props/defaultProps.js +4 -8
- package/lib/DropBox/props/propTypes.js +4 -10
- package/lib/DropDown/DropDown.js +8 -52
- package/lib/DropDown/DropDownHeading.js +20 -39
- package/lib/DropDown/DropDownItem.js +20 -42
- package/lib/DropDown/DropDownSearch.js +17 -40
- package/lib/DropDown/DropDownSeparator.js +4 -24
- package/lib/DropDown/__tests__/DropDown.spec.js +9 -15
- package/lib/DropDown/__tests__/DropDownItem.spec.js +4 -9
- package/lib/DropDown/__tests__/DropDownSearch.spec.js +0 -3
- package/lib/DropDown/index.js +0 -9
- package/lib/DropDown/props/propTypes.js +4 -6
- package/lib/Heading/Heading.js +15 -37
- package/lib/Heading/props/propTypes.js +0 -3
- package/lib/Label/Label.js +19 -39
- package/lib/Label/__tests__/Label.spec.js +1 -14
- package/lib/Label/props/propTypes.js +0 -3
- package/lib/Layout/Box.js +11 -31
- package/lib/Layout/Container.js +10 -29
- package/lib/Layout/__tests__/Box.spec.js +49 -65
- package/lib/Layout/__tests__/Container.spec.js +50 -67
- package/lib/Layout/index.js +0 -3
- package/lib/Layout/props/propTypes.js +0 -3
- package/lib/Layout/utils.js +0 -10
- package/lib/ListItem/ListContainer.js +27 -48
- package/lib/ListItem/ListItem.js +45 -69
- package/lib/ListItem/ListItemWithAvatar.js +48 -75
- package/lib/ListItem/ListItemWithCheckBox.js +39 -64
- package/lib/ListItem/ListItemWithIcon.js +44 -68
- package/lib/ListItem/ListItemWithRadio.js +41 -65
- package/lib/ListItem/index.js +0 -7
- package/lib/ListItem/props/propTypes.js +4 -6
- package/lib/Modal/Modal.js +10 -45
- package/lib/Modal/props/propTypes.js +0 -3
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +166 -294
- package/lib/MultiSelect/AdvancedMultiSelect.js +125 -202
- package/lib/MultiSelect/EmptyState.js +24 -45
- package/lib/MultiSelect/MultiSelect.js +206 -323
- package/lib/MultiSelect/MultiSelectHeader.js +8 -30
- package/lib/MultiSelect/MultiSelectWithAvatar.js +63 -105
- package/lib/MultiSelect/SelectedOptions.js +17 -43
- package/lib/MultiSelect/Suggestions.js +32 -64
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +75 -86
- package/lib/MultiSelect/index.js +0 -5
- package/lib/MultiSelect/props/defaultProps.js +0 -2
- package/lib/MultiSelect/props/propTypes.js +0 -5
- package/lib/PopOver/PopOver.js +49 -95
- package/lib/PopOver/__tests__/PopOver.spec.js +1 -4
- package/lib/PopOver/index.js +0 -4
- package/lib/PopOver/props/propTypes.js +0 -3
- package/lib/Popup/Popup.js +81 -158
- package/lib/Popup/__tests__/Popup.spec.js +8 -43
- package/lib/Popup/viewPort.js +14 -28
- package/lib/Provider/AvatarSize.js +0 -4
- package/lib/Provider/Config.js +0 -2
- package/lib/Provider/CssProvider.js +0 -4
- package/lib/Provider/IdProvider.js +6 -17
- package/lib/Provider/LibraryContext.js +15 -35
- package/lib/Provider/LibraryContextInit.js +0 -4
- package/lib/Provider/NumberGenerator/NumberGenerator.js +15 -44
- package/lib/Provider/ZindexProvider.js +3 -15
- package/lib/Provider/index.js +0 -5
- package/lib/Radio/Radio.js +38 -61
- package/lib/Radio/__tests__/Radiospec.js +5 -9
- package/lib/Radio/props/propTypes.js +0 -3
- package/lib/Responsive/CustomResponsive.js +29 -73
- package/lib/Responsive/RefWrapper.js +11 -17
- package/lib/Responsive/ResizeComponent.js +36 -62
- package/lib/Responsive/ResizeObserver.js +10 -24
- package/lib/Responsive/Responsive.js +30 -80
- package/lib/Responsive/index.js +0 -4
- package/lib/Responsive/props/propTypes.js +0 -3
- package/lib/Responsive/sizeObservers.js +17 -53
- package/lib/Responsive/utils/index.js +3 -11
- package/lib/Responsive/utils/shallowCompare.js +2 -11
- package/lib/Responsive/windowResizeObserver.js +0 -8
- package/lib/ResponsiveDropBox/ResponsiveDropBox.js +17 -45
- package/lib/ResponsiveDropBox/props/propTypes.js +0 -3
- package/lib/Ribbon/Ribbon.js +13 -33
- package/lib/Ribbon/__tests__/Ribbon.spec.js +0 -22
- package/lib/Ribbon/props/propTypes.js +0 -3
- package/lib/RippleEffect/RippleEffect.js +10 -18
- package/lib/RippleEffect/props/propTypes.js +0 -3
- package/lib/Select/GroupSelect.js +130 -229
- package/lib/Select/Select.js +209 -290
- package/lib/Select/SelectWithAvatar.js +56 -102
- package/lib/Select/SelectWithIcon.js +76 -132
- package/lib/Select/__tests__/Select.spec.js +91 -133
- package/lib/Select/index.js +0 -5
- package/lib/Select/props/defaultProps.js +4 -5
- package/lib/Select/props/propTypes.js +0 -4
- package/lib/Stencils/Stencils.js +10 -29
- package/lib/Stencils/__tests__/Stencils.spec.js +0 -12
- package/lib/Stencils/props/propTypes.js +0 -3
- package/lib/Switch/Switch.js +34 -57
- package/lib/Switch/props/propTypes.js +0 -3
- package/lib/Tab/Tab.js +27 -40
- package/lib/Tab/TabContent.js +5 -12
- package/lib/Tab/TabContentWrapper.js +6 -13
- package/lib/Tab/TabWrapper.js +19 -37
- package/lib/Tab/Tabs.js +91 -171
- package/lib/Tab/__tests__/Tab.spec.js +58 -67
- package/lib/Tab/__tests__/TabContent.spec.js +6 -10
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +20 -28
- package/lib/Tab/__tests__/TabWrapper.spec.js +0 -12
- package/lib/Tab/__tests__/Tabs.spec.js +39 -53
- package/lib/Tab/index.js +0 -6
- package/lib/Tab/props/propTypes.js +0 -3
- package/lib/Tag/Tag.js +43 -72
- package/lib/Tag/__tests__/Tag.spec.js +8 -14
- package/lib/Tag/props/propTypes.js +0 -3
- package/lib/TextBox/TextBox.js +59 -85
- package/lib/TextBox/__tests__/TextBox.spec.js +4 -14
- package/lib/TextBox/props/propTypes.js +4 -6
- package/lib/TextBoxIcon/TextBoxIcon.js +52 -79
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +5 -14
- package/lib/TextBoxIcon/props/propTypes.js +0 -3
- package/lib/Textarea/Textarea.js +29 -54
- package/lib/Textarea/__tests__/Textarea.spec.js +2 -14
- package/lib/Textarea/props/propTypes.js +0 -3
- package/lib/Tooltip/Tooltip.js +31 -94
- package/lib/Tooltip/__tests__/Tooltip.spec.js +3 -24
- package/lib/Tooltip/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +16 -40
- package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +25 -53
- package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/index.js +0 -3
- package/lib/css.js +0 -40
- package/lib/deprecated/PortalLayer/PortalLayer.js +23 -46
- package/lib/deprecated/PortalLayer/props/propTypes.js +0 -3
- package/lib/index.js +0 -57
- package/lib/semantic/Button/Button.js +22 -42
- package/lib/semantic/Button/props/propTypes.js +0 -3
- package/lib/semantic/index.js +0 -2
- package/lib/utils/Common.js +18 -108
- package/lib/utils/ContextOptimizer.js +10 -16
- package/lib/utils/__tests__/constructFullName.spec.js +0 -1
- package/lib/utils/__tests__/debounce.spec.js +2 -3
- package/lib/utils/__tests__/getInitial.spec.js +0 -1
- package/lib/utils/constructFullName.js +4 -13
- package/lib/utils/css/compileClassNames.js +0 -6
- package/lib/utils/css/mergeStyle.js +7 -10
- package/lib/utils/css/utils.js +0 -8
- package/lib/utils/datetime/common.js +5 -34
- package/lib/utils/debounce.js +1 -6
- package/lib/utils/dropDownUtils.js +59 -175
- package/lib/utils/dummyFunction.js +0 -2
- package/lib/utils/getHTMLFontSize.js +0 -1
- package/lib/utils/getInitial.js +0 -6
- package/lib/utils/index.js +0 -4
- package/lib/utils/scrollTo.js +0 -2
- package/lib/utils/shallowEqual.js +0 -8
- package/package.json +2 -2
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MultiSelect_propTypes } from './props/propTypes';
|
|
4
4
|
import { MultiSelect_defaultProps } from './props/defaultProps';
|
|
5
|
-
/**** Components ****/
|
|
6
5
|
|
|
6
|
+
/**** Components ****/
|
|
7
7
|
import Popup from '../Popup/Popup';
|
|
8
8
|
import TextBoxIcon from '../TextBoxIcon/TextBoxIcon';
|
|
9
9
|
import { Container, Box } from '../Layout';
|
|
@@ -18,18 +18,16 @@ import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
|
|
|
18
18
|
import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
|
|
19
19
|
import Loader from '@zohodesk/svg/lib/Loader/Loader';
|
|
20
20
|
/**** Icons ****/
|
|
21
|
-
|
|
22
21
|
import { Icon } from '@zohodesk/icons';
|
|
23
22
|
/**** CSS ****/
|
|
24
|
-
|
|
25
23
|
import style from './MultiSelect.module.css';
|
|
26
|
-
/**** Methods ****/
|
|
27
24
|
|
|
25
|
+
/**** Methods ****/
|
|
28
26
|
import { debounce, scrollTo, bind, getIsEmptyValue, getSearchString, findScrollEnd } from '../utils/Common.js';
|
|
29
27
|
import { makeFormatOptions, makeGetMultiSelectFilterSuggestions as makeGetFilterSuggestions, makeGetMultiSelectSelectedOptions as makeGetSelectedOptions, makeObjectConcat, filterSelectedOptions, makeGetIsShowClearIcon } from '../utils/dropDownUtils';
|
|
30
28
|
import { getLibraryConfig } from '../Provider/Config';
|
|
31
|
-
/* eslint-disable react/forbid-component-props */
|
|
32
29
|
|
|
30
|
+
/* eslint-disable react/forbid-component-props */
|
|
33
31
|
/* eslint-disable react/no-unused-prop-types */
|
|
34
32
|
|
|
35
33
|
const dummyArray = [];
|
|
@@ -40,8 +38,9 @@ export class MultiSelectComponent extends React.Component {
|
|
|
40
38
|
this.getFilterSuggestions = makeGetFilterSuggestions();
|
|
41
39
|
this.formatOptions = makeFormatOptions();
|
|
42
40
|
this.getSelectedOptions = makeGetSelectedOptions();
|
|
43
|
-
this.getIsShowClearIcon = makeGetIsShowClearIcon();
|
|
41
|
+
this.getIsShowClearIcon = makeGetIsShowClearIcon();
|
|
44
42
|
|
|
43
|
+
//Use in AdvancedMultiSelect component
|
|
45
44
|
this.objectConcat = makeObjectConcat();
|
|
46
45
|
this.formatSelectedOptions = makeFormatOptions();
|
|
47
46
|
const {
|
|
@@ -79,11 +78,11 @@ export class MultiSelectComponent extends React.Component {
|
|
|
79
78
|
this.handleScroll = this.handleScroll.bind(this);
|
|
80
79
|
this.handleScrollFuncCall = debounce(this.handleScrollFuncCall.bind(this), 500);
|
|
81
80
|
}
|
|
82
|
-
|
|
83
81
|
componentDidMount() {
|
|
84
82
|
// let { suggestionContainer } = this;
|
|
85
83
|
this._isMounted = true;
|
|
86
|
-
this.handleExposedPublicMethods();
|
|
84
|
+
this.handleExposedPublicMethods();
|
|
85
|
+
// suggestionContainer &&
|
|
87
86
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
88
87
|
}
|
|
89
88
|
|
|
@@ -96,7 +95,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
96
95
|
prefixText
|
|
97
96
|
} = nextProps;
|
|
98
97
|
const oldProps = this.props;
|
|
99
|
-
|
|
100
98
|
if (selectedOptions !== oldProps.selectedOptions || options !== oldProps.options || valueField !== oldProps.valueField || textField !== oldProps.textField || prefixText !== oldProps.prefixText //For GroupMultiSelect component
|
|
101
99
|
) {
|
|
102
100
|
const {
|
|
@@ -135,7 +133,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
135
133
|
});
|
|
136
134
|
}
|
|
137
135
|
}
|
|
138
|
-
|
|
139
136
|
componentDidUpdate(prevProps, prevState) {
|
|
140
137
|
const {
|
|
141
138
|
suggestionContainer,
|
|
@@ -154,11 +151,11 @@ export class MultiSelectComponent extends React.Component {
|
|
|
154
151
|
onDropBoxClose,
|
|
155
152
|
onDropBoxOpen,
|
|
156
153
|
isSearchClearOnClose
|
|
157
|
-
} = this.props;
|
|
154
|
+
} = this.props;
|
|
158
155
|
|
|
156
|
+
//handle dropbox open & close
|
|
159
157
|
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
160
158
|
isPopupOpen && onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
|
|
161
|
-
|
|
162
159
|
if (!isPopupOpen) {
|
|
163
160
|
this.setState({
|
|
164
161
|
hoverOption: 0
|
|
@@ -166,42 +163,41 @@ export class MultiSelectComponent extends React.Component {
|
|
|
166
163
|
isSearchClearOnClose && searchStr && this.handleSearch('');
|
|
167
164
|
onDropBoxClose && onDropBoxClose();
|
|
168
165
|
}
|
|
169
|
-
}
|
|
170
|
-
|
|
166
|
+
}
|
|
171
167
|
|
|
168
|
+
//scrollTo handling
|
|
172
169
|
const hoverId = suggestionsOrder[hoverOption] || '';
|
|
173
170
|
const selectedSuggestion = this[`suggestion_${hoverId}`];
|
|
174
171
|
const lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
|
|
175
172
|
const selectedOption = this[`selectedOption_${lastHighLightedSelectOption}`];
|
|
176
173
|
isPopupOpen && scrollTo(suggestionContainer, selectedSuggestion);
|
|
177
|
-
selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption);
|
|
174
|
+
selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption);
|
|
178
175
|
|
|
176
|
+
//When suggestions length less than 5, getNextOptions function call
|
|
179
177
|
const {
|
|
180
178
|
isNextOptions,
|
|
181
179
|
getNextOptions
|
|
182
|
-
} = this.props;
|
|
183
|
-
|
|
180
|
+
} = this.props;
|
|
181
|
+
// let { searchStr } = this.state;
|
|
184
182
|
const suggestions = this.handleFilterSuggestions();
|
|
185
183
|
const suggestionsLen = suggestions.length;
|
|
186
|
-
|
|
187
184
|
if (isPopupOpen && suggestionsLen <= 5 && isNextOptions && getNextOptions && !needLocalSearch) {
|
|
188
185
|
this.handleFetchOptions(getNextOptions, searchStr);
|
|
189
|
-
}
|
|
190
|
-
|
|
186
|
+
}
|
|
191
187
|
|
|
188
|
+
//Need To MultiselectNew Component
|
|
192
189
|
this.handleComponentDidUpdate(prevProps, prevState);
|
|
193
190
|
}
|
|
194
|
-
|
|
195
191
|
componentWillUnmount() {
|
|
196
192
|
// let { suggestionContainer } = this;
|
|
197
|
-
this._isMounted = false;
|
|
193
|
+
this._isMounted = false;
|
|
194
|
+
// suggestionContainer &&
|
|
198
195
|
// suggestionContainer.removeEventListener('scroll', this.handleScroll);
|
|
199
196
|
}
|
|
200
197
|
|
|
201
198
|
handleComponentDidUpdate() {
|
|
202
199
|
return;
|
|
203
200
|
}
|
|
204
|
-
|
|
205
201
|
handleFormatOptions(props) {
|
|
206
202
|
const {
|
|
207
203
|
options,
|
|
@@ -219,14 +215,12 @@ export class MultiSelectComponent extends React.Component {
|
|
|
219
215
|
disabledOptions
|
|
220
216
|
});
|
|
221
217
|
}
|
|
222
|
-
|
|
223
218
|
handleGetSelectedOptions(selectedOptions, normalizedFormatOptions) {
|
|
224
219
|
return this.getSelectedOptions({
|
|
225
220
|
selectedOptions,
|
|
226
221
|
normalizedFormatOptions
|
|
227
222
|
});
|
|
228
223
|
}
|
|
229
|
-
|
|
230
224
|
handleInputCick(e) {
|
|
231
225
|
const {
|
|
232
226
|
removeClose
|
|
@@ -235,7 +229,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
235
229
|
highLightedSelectOptions,
|
|
236
230
|
searchStr = ''
|
|
237
231
|
} = this.state;
|
|
238
|
-
|
|
239
232
|
if (highLightedSelectOptions.length) {
|
|
240
233
|
this.setState({
|
|
241
234
|
highLightedSelectOptions: [],
|
|
@@ -249,7 +242,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
249
242
|
this.togglePopup(e);
|
|
250
243
|
}
|
|
251
244
|
}
|
|
252
|
-
|
|
253
245
|
handleFilterSuggestions() {
|
|
254
246
|
const {
|
|
255
247
|
options = dummyArray,
|
|
@@ -273,7 +265,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
273
265
|
this.suggestionsOrder = suggestionIds;
|
|
274
266
|
return suggestions;
|
|
275
267
|
}
|
|
276
|
-
|
|
277
268
|
handleKeyDown(e) {
|
|
278
269
|
const {
|
|
279
270
|
keyCode,
|
|
@@ -298,27 +289,20 @@ export class MultiSelectComponent extends React.Component {
|
|
|
298
289
|
onKeyDown
|
|
299
290
|
} = this.props;
|
|
300
291
|
const highLightedSelectOptionsLen = highLightedSelectOptions.length;
|
|
301
|
-
|
|
302
292
|
if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27 || keyCode === 9)) {
|
|
303
293
|
suggestions = this.handleFilterSuggestions();
|
|
304
294
|
}
|
|
305
|
-
|
|
306
295
|
if (!isPopupOpen && !isPopupOpenOnEnter) {
|
|
307
296
|
onKeyDown && onKeyDown(e);
|
|
308
297
|
}
|
|
309
|
-
|
|
310
298
|
if (!isPopupOpen && keyCode === 40) {
|
|
311
299
|
//down arrow press popup open
|
|
312
300
|
e.preventDefault(); //prevent body scroll
|
|
313
|
-
|
|
314
301
|
this.togglePopup(e);
|
|
315
302
|
}
|
|
316
|
-
|
|
317
303
|
const suggestionsLen = suggestions.length;
|
|
318
|
-
|
|
319
304
|
if (suggestionsLen && isPopupOpen && keyCode === 38) {
|
|
320
305
|
//up arrow
|
|
321
|
-
|
|
322
306
|
/*if (hoverOption === 0) { //disable first to last option higlight
|
|
323
307
|
!isNextOptions && this.setState({ hoverOption: suggestionsLen - 1 });
|
|
324
308
|
}*/
|
|
@@ -329,7 +313,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
329
313
|
}
|
|
330
314
|
} else if (suggestionsLen && isPopupOpen && keyCode === 40) {
|
|
331
315
|
//down arrow
|
|
332
|
-
|
|
333
316
|
/*else if (hoverOption === suggestionsLen - 1 || hoverOption === null) {
|
|
334
317
|
//disable last to first option higlight
|
|
335
318
|
!isNextOptions && this.setState({ hoverOption: 0 });
|
|
@@ -357,7 +340,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
357
340
|
if (highLightedSelectOptionsLen) {
|
|
358
341
|
this.handleRemoveOption(highLightedSelectOptions);
|
|
359
342
|
} else {
|
|
360
|
-
this.handleRemoveOption(selectedOptions.slice(-1));
|
|
343
|
+
this.handleRemoveOption(selectedOptions.slice(-1));
|
|
344
|
+
// this.setState({
|
|
361
345
|
// highLightedSelectOptions: selectedOptions.slice(-1)
|
|
362
346
|
// });
|
|
363
347
|
}
|
|
@@ -372,7 +356,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
372
356
|
const lastHighLightedSelectOptionIndex = lastHighLightedSelectOption && selectedOptions.indexOf(lastHighLightedSelectOption) >= 0 ? selectedOptions.indexOf(lastHighLightedSelectOption) : 0;
|
|
373
357
|
const newShiftKeyPressHighLighted = shiftKeyPressHighLighted ? shiftKeyPressHighLighted : shiftKeyPressHighLighted + 1;
|
|
374
358
|
const newHighLightedSelectOption = lastHighLightedSelectOptionIndex !== null ? selectedOptions[lastHighLightedSelectOptionIndex + newShiftKeyPressHighLighted] : selectedOptions[0];
|
|
375
|
-
|
|
376
359
|
if (!getIsEmptyValue(newHighLightedSelectOption)) {
|
|
377
360
|
const newLastHighLightedSelectOption = lastHighLightedSelectOption ? lastHighLightedSelectOption : selectedOptions[0];
|
|
378
361
|
highLightedSelectOptions = !shiftKeyPressHighLighted ? [newLastHighLightedSelectOption] : highLightedSelectOptions;
|
|
@@ -389,7 +372,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
389
372
|
const lastHighLightedSelectOptionIndex = lastHighLightedSelectOption ? selectedOptions.indexOf(lastHighLightedSelectOption) : selectedOptions.length - 1;
|
|
390
373
|
const newShiftKeyPressHighLighted = shiftKeyPressHighLighted !== 1 ? shiftKeyPressHighLighted : shiftKeyPressHighLighted - 1;
|
|
391
374
|
const newHighLightedSelectOption = selectedOptions[lastHighLightedSelectOptionIndex + newShiftKeyPressHighLighted - 1];
|
|
392
|
-
|
|
393
375
|
if (!getIsEmptyValue(newHighLightedSelectOption)) {
|
|
394
376
|
const newLastHighLightedSelectOption = lastHighLightedSelectOption ? lastHighLightedSelectOption : selectedOptions.slice(-1)[0];
|
|
395
377
|
highLightedSelectOptions = !shiftKeyPressHighLighted ? [newLastHighLightedSelectOption] : highLightedSelectOptions;
|
|
@@ -402,15 +384,14 @@ export class MultiSelectComponent extends React.Component {
|
|
|
402
384
|
});
|
|
403
385
|
}
|
|
404
386
|
} else if ((keyCode === 39 || keyCode === 37) && selectedOptions.length && !searchStr.length) {
|
|
405
|
-
const isRightArrow = keyCode === 39 ? true : false;
|
|
406
|
-
|
|
387
|
+
const isRightArrow = keyCode === 39 ? true : false;
|
|
388
|
+
// let isLefttArrow = keyCode === 37 ? true : false;
|
|
407
389
|
if (highLightedSelectOptions.length) {
|
|
408
390
|
const [lastHighLightedSelectOption] = highLightedSelectOptions.slice(-1);
|
|
409
391
|
const lastHighLightedSelectOptionIndex = selectedOptions.indexOf(lastHighLightedSelectOption);
|
|
410
392
|
const newLastHighLightedSelectOptionIndex = isRightArrow ? lastHighLightedSelectOptionIndex === selectedOptions.length - 1 ? lastHighLightedSelectOptionIndex : lastHighLightedSelectOptionIndex + 1 : lastHighLightedSelectOptionIndex - 1;
|
|
411
393
|
const newLastHighLightedSelectOption = selectedOptions[newLastHighLightedSelectOptionIndex];
|
|
412
394
|
const isEmptyHighlighted = isRightArrow && highLightedSelectOptions.length === 1 && selectedOptions.slice(-1)[0] === lastHighLightedSelectOption ? true : false;
|
|
413
|
-
|
|
414
395
|
if (!getIsEmptyValue(newLastHighLightedSelectOption)) {
|
|
415
396
|
this.setState({
|
|
416
397
|
lastHighLightedSelectOption: isEmptyHighlighted ? '' : newLastHighLightedSelectOption,
|
|
@@ -426,12 +407,12 @@ export class MultiSelectComponent extends React.Component {
|
|
|
426
407
|
shiftKeyPressHighLighted: 0
|
|
427
408
|
});
|
|
428
409
|
}
|
|
429
|
-
} else if (keyCode === 27) {
|
|
410
|
+
} else if (keyCode === 27) {
|
|
411
|
+
// this.handlePopupClose(e);
|
|
430
412
|
} else if (keyCode === 9) {
|
|
431
413
|
this.handlePopupClose(e);
|
|
432
414
|
}
|
|
433
415
|
}
|
|
434
|
-
|
|
435
416
|
handleSelectAll(e) {
|
|
436
417
|
e && e.preventDefault();
|
|
437
418
|
const suggestions = this.handleFilterSuggestions();
|
|
@@ -443,12 +424,12 @@ export class MultiSelectComponent extends React.Component {
|
|
|
443
424
|
const {
|
|
444
425
|
id
|
|
445
426
|
} = option;
|
|
446
|
-
|
|
447
427
|
if (selectedOptions.indexOf(id) === -1) {
|
|
448
428
|
newSelectedOptions.push(id);
|
|
449
429
|
}
|
|
450
430
|
});
|
|
451
|
-
this.handleChange([...selectedOptions, ...newSelectedOptions]);
|
|
431
|
+
this.handleChange([...selectedOptions, ...newSelectedOptions]);
|
|
432
|
+
// this.handlePopupClose(e);
|
|
452
433
|
}
|
|
453
434
|
|
|
454
435
|
handleDeselectAll(e) {
|
|
@@ -459,18 +440,15 @@ export class MultiSelectComponent extends React.Component {
|
|
|
459
440
|
const {
|
|
460
441
|
highLightedSelectOptions
|
|
461
442
|
} = this.state;
|
|
462
|
-
|
|
463
443
|
if (highLightedSelectOptions.length) {
|
|
464
444
|
this.setState({
|
|
465
445
|
highLightedSelectOptions: [],
|
|
466
446
|
lastHighLightedSelectOption: ''
|
|
467
447
|
});
|
|
468
448
|
}
|
|
469
|
-
|
|
470
449
|
removeClose(e);
|
|
471
450
|
this.handleChange([]);
|
|
472
451
|
}
|
|
473
|
-
|
|
474
452
|
handleSelectOption(option, value, index, e) {
|
|
475
453
|
const {
|
|
476
454
|
selectedOptions,
|
|
@@ -480,11 +458,9 @@ export class MultiSelectComponent extends React.Component {
|
|
|
480
458
|
const {
|
|
481
459
|
searchStr
|
|
482
460
|
} = this.state;
|
|
483
|
-
|
|
484
461
|
if (searchStr.trim() != '' && isSearchClearOnSelect) {
|
|
485
462
|
this.handleSearch('');
|
|
486
463
|
}
|
|
487
|
-
|
|
488
464
|
if (keepSelectedOptions && selectedOptions.indexOf(option) != -1) {
|
|
489
465
|
let newSelectedOptions = selectedOptions.filter(id => {
|
|
490
466
|
return id != option;
|
|
@@ -494,7 +470,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
494
470
|
this.handleChange([...selectedOptions, option], e);
|
|
495
471
|
}
|
|
496
472
|
}
|
|
497
|
-
|
|
498
473
|
handleRemoveOption(options) {
|
|
499
474
|
const newOptions = !getIsEmptyValue(options) && !Array.isArray(options) ? [options] : options;
|
|
500
475
|
const {
|
|
@@ -506,22 +481,18 @@ export class MultiSelectComponent extends React.Component {
|
|
|
506
481
|
lastHighLightedSelectOption,
|
|
507
482
|
shiftKeyPressHighLighted
|
|
508
483
|
} = this.state;
|
|
509
|
-
|
|
510
484
|
if (newOptions.length && !isReadOnly) {
|
|
511
485
|
const newSelectedOptions = selectedOptions.filter(option => newOptions.indexOf(option) === -1);
|
|
512
486
|
const newHighLightedSelectOptions = highLightedSelectOptions.filter(option => newSelectedOptions.indexOf(option) >= 0);
|
|
513
487
|
let isHighlightedRemoved = false;
|
|
514
488
|
const newOptionsLen = newOptions.length;
|
|
515
|
-
|
|
516
489
|
for (let i = 0; i < newOptionsLen; i++) {
|
|
517
490
|
const removedOption = newOptions[i];
|
|
518
|
-
|
|
519
491
|
if (highLightedSelectOptions.indexOf(removedOption) >= 0) {
|
|
520
492
|
isHighlightedRemoved = true;
|
|
521
493
|
break;
|
|
522
494
|
}
|
|
523
495
|
}
|
|
524
|
-
|
|
525
496
|
this.setState({
|
|
526
497
|
lastHighLightedSelectOption: newSelectedOptions.indexOf(lastHighLightedSelectOption) >= 0 && !isHighlightedRemoved ? lastHighLightedSelectOption : '',
|
|
527
498
|
highLightedSelectOptions: isHighlightedRemoved ? [] : newHighLightedSelectOptions,
|
|
@@ -529,12 +500,10 @@ export class MultiSelectComponent extends React.Component {
|
|
|
529
500
|
});
|
|
530
501
|
this.handleChange(newSelectedOptions);
|
|
531
502
|
}
|
|
532
|
-
|
|
533
503
|
this.searchInput && this.searchInput.focus({
|
|
534
504
|
preventScroll: true
|
|
535
505
|
});
|
|
536
506
|
}
|
|
537
|
-
|
|
538
507
|
handleMouseEnter(id, val, hoverOptionIndex, e) {
|
|
539
508
|
e && e.preventDefault();
|
|
540
509
|
const {
|
|
@@ -544,19 +513,16 @@ export class MultiSelectComponent extends React.Component {
|
|
|
544
513
|
suggestionsOrder
|
|
545
514
|
} = this;
|
|
546
515
|
const newHoverIndex = suggestionsOrder.indexOf(id);
|
|
547
|
-
|
|
548
516
|
if (newHoverIndex !== hoverOption) {
|
|
549
517
|
this.setState({
|
|
550
518
|
hoverOption: newHoverIndex
|
|
551
519
|
});
|
|
552
520
|
}
|
|
553
521
|
}
|
|
554
|
-
|
|
555
522
|
handleFetchOptions() {
|
|
556
523
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
557
524
|
args[_key] = arguments[_key];
|
|
558
525
|
}
|
|
559
|
-
|
|
560
526
|
const [APICall, searchStr] = args;
|
|
561
527
|
const {
|
|
562
528
|
isFetchingOptions
|
|
@@ -565,12 +531,10 @@ export class MultiSelectComponent extends React.Component {
|
|
|
565
531
|
_isMounted
|
|
566
532
|
} = this;
|
|
567
533
|
const isForce = isFetchingOptions && searchStr ? true : false;
|
|
568
|
-
|
|
569
534
|
if (!isFetchingOptions && APICall || isForce) {
|
|
570
535
|
this.setState({
|
|
571
536
|
isFetchingOptions: true
|
|
572
537
|
});
|
|
573
|
-
|
|
574
538
|
try {
|
|
575
539
|
return APICall(searchStr).then(() => {
|
|
576
540
|
_isMounted && this.setState({
|
|
@@ -588,7 +552,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
588
552
|
}
|
|
589
553
|
}
|
|
590
554
|
}
|
|
591
|
-
|
|
592
555
|
handleSearchOptions() {
|
|
593
556
|
const {
|
|
594
557
|
onSearch
|
|
@@ -598,7 +561,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
598
561
|
} = this.state;
|
|
599
562
|
searchStr && this.handleFetchOptions(onSearch, searchStr);
|
|
600
563
|
}
|
|
601
|
-
|
|
602
564
|
handleSearch(value, e) {
|
|
603
565
|
const {
|
|
604
566
|
onSearch,
|
|
@@ -621,7 +583,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
621
583
|
}
|
|
622
584
|
});
|
|
623
585
|
}
|
|
624
|
-
|
|
625
586
|
handleClickSelectedOption() {
|
|
626
587
|
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
627
588
|
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -637,16 +598,13 @@ export class MultiSelectComponent extends React.Component {
|
|
|
637
598
|
ctrlKey,
|
|
638
599
|
shiftKey
|
|
639
600
|
} = e;
|
|
640
|
-
|
|
641
601
|
if (e && shiftKey) {
|
|
642
602
|
//shift+click
|
|
643
603
|
let from = selectedOptions.indexOf(lastHighLightedSelectOption) >= 0 ? selectedOptions.indexOf(lastHighLightedSelectOption) : 0;
|
|
644
604
|
let to = id && selectedOptions.indexOf(id) >= 0 ? selectedOptions.indexOf(id) : null;
|
|
645
|
-
|
|
646
605
|
if (to >= 0 && to < from) {
|
|
647
606
|
[to] = [from, from = to];
|
|
648
607
|
}
|
|
649
|
-
|
|
650
608
|
to += 1;
|
|
651
609
|
const newSelectedHighlights = to ? selectedOptions.slice(from, to) : [];
|
|
652
610
|
to && this.setState({
|
|
@@ -657,7 +615,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
657
615
|
//ctrl+click
|
|
658
616
|
const isRemove = highLightedSelectOptions.indexOf(id) >= 0;
|
|
659
617
|
let newSelectedHighlights = [];
|
|
660
|
-
|
|
661
618
|
if (isRemove) {
|
|
662
619
|
lastHighLightedSelectOption = id === lastHighLightedSelectOption ? '' : lastHighLightedSelectOption;
|
|
663
620
|
newSelectedHighlights = highLightedSelectOptions.filter(option => option !== id);
|
|
@@ -665,7 +622,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
665
622
|
lastHighLightedSelectOption = id;
|
|
666
623
|
newSelectedHighlights = [...highLightedSelectOptions, id];
|
|
667
624
|
}
|
|
668
|
-
|
|
669
625
|
this.setState({
|
|
670
626
|
highLightedSelectOptions: newSelectedHighlights,
|
|
671
627
|
lastHighLightedSelectOption
|
|
@@ -676,7 +632,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
676
632
|
lastHighLightedSelectOption: id
|
|
677
633
|
});
|
|
678
634
|
}
|
|
679
|
-
|
|
680
635
|
this.setState({
|
|
681
636
|
shiftKeyPressHighLighted: 0
|
|
682
637
|
});
|
|
@@ -684,13 +639,11 @@ export class MultiSelectComponent extends React.Component {
|
|
|
684
639
|
preventScroll: true
|
|
685
640
|
});
|
|
686
641
|
}
|
|
687
|
-
|
|
688
642
|
handleScroll(e) {
|
|
689
643
|
let ele = e.target;
|
|
690
644
|
let isScrollReachedBottom = findScrollEnd(ele);
|
|
691
645
|
isScrollReachedBottom && this.handleScrollFuncCall();
|
|
692
646
|
}
|
|
693
|
-
|
|
694
647
|
handleScrollFuncCall() {
|
|
695
648
|
const {
|
|
696
649
|
getNextOptions,
|
|
@@ -701,7 +654,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
701
654
|
} = this.state;
|
|
702
655
|
isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchStr);
|
|
703
656
|
}
|
|
704
|
-
|
|
705
657
|
handleChange() {
|
|
706
658
|
let selectedOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
707
659
|
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -724,23 +676,19 @@ export class MultiSelectComponent extends React.Component {
|
|
|
724
676
|
});
|
|
725
677
|
const selectedOptionsLen = newSelectedOptions.length;
|
|
726
678
|
const allSelectedOptionsDetails = [];
|
|
727
|
-
|
|
728
679
|
for (let i = 0; i < selectedOptionsLen; i++) {
|
|
729
680
|
const id = newSelectedOptions[i];
|
|
730
681
|
allSelectedOptionsDetails.push(optionsNormalize[id]);
|
|
731
682
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
683
|
+
onChange && onChange(newSelectedOptions, allSelectedOptionsDetails);
|
|
684
|
+
// this.setState({ searchStr: '' });
|
|
735
685
|
this.searchInput && this.searchInput.focus({
|
|
736
686
|
preventScroll: true
|
|
737
687
|
});
|
|
738
|
-
|
|
739
688
|
if (needToCloseOnSelect) {
|
|
740
689
|
togglePopup(e);
|
|
741
690
|
}
|
|
742
691
|
}
|
|
743
|
-
|
|
744
692
|
togglePopup(e) {
|
|
745
693
|
const {
|
|
746
694
|
togglePopup,
|
|
@@ -749,14 +697,12 @@ export class MultiSelectComponent extends React.Component {
|
|
|
749
697
|
} = this.props;
|
|
750
698
|
!isReadOnly && togglePopup(e, defaultDropBoxPosition ? `${defaultDropBoxPosition}` : null);
|
|
751
699
|
}
|
|
752
|
-
|
|
753
700
|
handlePopupClose(e) {
|
|
754
701
|
const {
|
|
755
702
|
closePopupOnly
|
|
756
703
|
} = this.props;
|
|
757
704
|
closePopupOnly(e);
|
|
758
705
|
}
|
|
759
|
-
|
|
760
706
|
searchInputRef(el) {
|
|
761
707
|
const {
|
|
762
708
|
getRef
|
|
@@ -764,7 +710,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
764
710
|
this.searchInput = el;
|
|
765
711
|
getRef && getRef(el);
|
|
766
712
|
}
|
|
767
|
-
|
|
768
713
|
selectedOptionContainerRef(el) {
|
|
769
714
|
const {
|
|
770
715
|
getTargetRef
|
|
@@ -772,31 +717,25 @@ export class MultiSelectComponent extends React.Component {
|
|
|
772
717
|
this.selectedOptionContainer = el;
|
|
773
718
|
getTargetRef(el);
|
|
774
719
|
}
|
|
775
|
-
|
|
776
720
|
selectedOptionRef(el, id) {
|
|
777
721
|
this[`selectedOption_${id}`] = el;
|
|
778
722
|
}
|
|
779
|
-
|
|
780
723
|
suggestionContainerRef(el) {
|
|
781
724
|
this.suggestionContainer = el;
|
|
782
725
|
}
|
|
783
|
-
|
|
784
726
|
suggestionItemRef(el, index, id) {
|
|
785
727
|
this[`suggestion_${id}`] = el;
|
|
786
728
|
}
|
|
787
|
-
|
|
788
729
|
handleActive(e) {
|
|
789
730
|
const {
|
|
790
731
|
searchStr,
|
|
791
732
|
isActive
|
|
792
733
|
} = this.state;
|
|
793
|
-
|
|
794
734
|
if (!isActive) {
|
|
795
735
|
this.setState({
|
|
796
736
|
isActive: true
|
|
797
737
|
});
|
|
798
738
|
}
|
|
799
|
-
|
|
800
739
|
const {
|
|
801
740
|
target
|
|
802
741
|
} = e || {};
|
|
@@ -806,19 +745,16 @@ export class MultiSelectComponent extends React.Component {
|
|
|
806
745
|
} = this.props;
|
|
807
746
|
onFocus && onFocus(searchStr);
|
|
808
747
|
}
|
|
809
|
-
|
|
810
748
|
handleInactive() {
|
|
811
749
|
const {
|
|
812
750
|
isActive
|
|
813
751
|
} = this.state;
|
|
814
|
-
|
|
815
752
|
if (isActive) {
|
|
816
753
|
this.setState({
|
|
817
754
|
isActive: false
|
|
818
755
|
});
|
|
819
756
|
}
|
|
820
757
|
}
|
|
821
|
-
|
|
822
758
|
handleInputFocus() {
|
|
823
759
|
const {
|
|
824
760
|
isDisabled,
|
|
@@ -828,7 +764,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
828
764
|
preventScroll: true
|
|
829
765
|
});
|
|
830
766
|
}
|
|
831
|
-
|
|
832
767
|
handleExposedPublicMethods() {
|
|
833
768
|
const {
|
|
834
769
|
getPublicMethods,
|
|
@@ -838,7 +773,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
838
773
|
openPopupOnly
|
|
839
774
|
});
|
|
840
775
|
}
|
|
841
|
-
|
|
842
776
|
responsiveFunc(_ref) {
|
|
843
777
|
let {
|
|
844
778
|
mediaQueryOR
|
|
@@ -849,7 +783,6 @@ export class MultiSelectComponent extends React.Component {
|
|
|
849
783
|
}])
|
|
850
784
|
};
|
|
851
785
|
}
|
|
852
|
-
|
|
853
786
|
render() {
|
|
854
787
|
let {
|
|
855
788
|
isReadOnly,
|
|
@@ -1080,16 +1013,16 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1080
1013
|
}, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(CardFooter, null, getFooter()) : null)));
|
|
1081
1014
|
}) : null);
|
|
1082
1015
|
}
|
|
1083
|
-
|
|
1084
1016
|
}
|
|
1085
1017
|
MultiSelectComponent.propTypes = MultiSelect_propTypes;
|
|
1086
|
-
MultiSelectComponent.defaultProps = MultiSelect_defaultProps;
|
|
1018
|
+
MultiSelectComponent.defaultProps = MultiSelect_defaultProps;
|
|
1019
|
+
|
|
1020
|
+
// if (__DOCS__) {
|
|
1087
1021
|
// MultiSelectComponent.docs = {
|
|
1088
1022
|
// componentGroup: 'Form Elements',
|
|
1089
1023
|
// folderName: 'Style Guide'
|
|
1090
1024
|
// };
|
|
1091
1025
|
// }
|
|
1092
|
-
|
|
1093
1026
|
MultiSelectComponent.displayName = 'MultiSelect';
|
|
1094
1027
|
const MultiSelect = Popup(MultiSelectComponent);
|
|
1095
1028
|
MultiSelect.propTypes = MultiSelectComponent.propTypes;
|
|
@@ -3,10 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import { MultiSelectHeader_propTypes } from './props/propTypes';
|
|
4
4
|
import { MultiSelectHeader_defaultProps } from './props/defaultProps';
|
|
5
5
|
/**** Icons ****/
|
|
6
|
-
|
|
7
6
|
import ListItemWithIcon from '../ListItem/ListItemWithIcon';
|
|
8
7
|
/**** CSS ****/
|
|
9
|
-
|
|
10
8
|
import style from './MultiSelect.module.css';
|
|
11
9
|
export default class MultiSelectHeader extends React.PureComponent {
|
|
12
10
|
render() {
|
|
@@ -27,7 +25,6 @@ export default class MultiSelectHeader extends React.PureComponent {
|
|
|
27
25
|
customClass: style.selectAll
|
|
28
26
|
}) : null);
|
|
29
27
|
}
|
|
30
|
-
|
|
31
28
|
}
|
|
32
29
|
MultiSelectHeader.propTypes = MultiSelectHeader_propTypes;
|
|
33
30
|
MultiSelectHeader.defaultProps = MultiSelectHeader_defaultProps;
|