@zohodesk/components 1.0.0-alpha-261 → 1.0.0-alpha-263
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/README.md +16 -2
- package/es/DropBox/DropBox.module.css +0 -1
- package/es/ListItem/ListItem.js +3 -2
- package/es/ListItem/ListItem.module.css +17 -10
- package/es/ListItem/ListItemWithAvatar.js +3 -2
- package/es/ListItem/ListItemWithCheckBox.js +3 -2
- package/es/ListItem/ListItemWithIcon.js +3 -2
- package/es/ListItem/ListItemWithRadio.js +3 -2
- package/es/ListItem/props/defaultProps.js +12 -6
- package/es/ListItem/props/propTypes.js +7 -1
- package/es/MultiSelect/MultiSelect.js +18 -5
- package/es/MultiSelect/MultiSelectWithAvatar.js +18 -5
- package/es/MultiSelect/props/defaultProps.js +5 -2
- package/es/MultiSelect/props/propTypes.js +7 -1
- package/es/utils/Common.js +0 -1
- package/es/utils/dropDownUtils.js +3 -2
- package/lib/DropBox/DropBox.module.css +0 -1
- package/lib/ListItem/ListItem.js +3 -2
- package/lib/ListItem/ListItem.module.css +17 -10
- package/lib/ListItem/ListItemWithAvatar.js +3 -2
- package/lib/ListItem/ListItemWithCheckBox.js +3 -2
- package/lib/ListItem/ListItemWithIcon.js +3 -2
- package/lib/ListItem/ListItemWithRadio.js +3 -2
- package/lib/ListItem/props/defaultProps.js +12 -6
- package/lib/ListItem/props/propTypes.js +7 -2
- package/lib/MultiSelect/MultiSelect.js +18 -5
- package/lib/MultiSelect/MultiSelectWithAvatar.js +18 -5
- package/lib/MultiSelect/props/defaultProps.js +5 -2
- package/lib/MultiSelect/props/propTypes.js +7 -1
- package/lib/utils/Common.js +0 -1
- package/lib/utils/dropDownUtils.js +5 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -32,11 +32,25 @@ In this Package, we Provide Some Basic Components to Build Web App
|
|
|
32
32
|
- TextBoxIcon
|
|
33
33
|
- Tooltip
|
|
34
34
|
|
|
35
|
+
# 1.0.0-alpha-263
|
|
36
|
+
|
|
37
|
+
- **ListItem, ListItemWithAvatar, ListItemWithCheckbox, ListItemWithIcon, ListItemWithRadio** - Line height changed 20px and Padding also changed.
|
|
38
|
+
|
|
39
|
+
# 1.0.0-alpha-262
|
|
40
|
+
|
|
41
|
+
- **ListItem, ListItemWithAvatar, ListItemWithCheckbox, ListItemWithIcon, ListItemWithRadio** - Added New Prop `needMultiLineText`
|
|
42
|
+
|
|
43
|
+
- **MultiSelect, MultiSelectWithAvatar** - `keepSelectedOptions` prop added. When this prop is true, it won't remove selected items from the dropdown instead it highlights each selected item with tick mark.
|
|
44
|
+
|
|
45
|
+
- **MultiSelectWithAvatar** - `customProps` support.
|
|
46
|
+
|
|
35
47
|
# 1.0.0-alpha-261
|
|
36
48
|
|
|
37
49
|
- **Tab,Tabs** - Removed offsection property from css.
|
|
38
|
-
|
|
39
|
-
-
|
|
50
|
+
|
|
51
|
+
- compileClassNames , mergeStyle utils added.
|
|
52
|
+
|
|
53
|
+
- index export object fixed.
|
|
40
54
|
|
|
41
55
|
# 1.0.0-alpha-260
|
|
42
56
|
|
package/es/ListItem/ListItem.js
CHANGED
|
@@ -64,7 +64,8 @@ export default class ListItem extends React.Component {
|
|
|
64
64
|
dataSelectorId,
|
|
65
65
|
a11y,
|
|
66
66
|
customClass,
|
|
67
|
-
customProps
|
|
67
|
+
customProps,
|
|
68
|
+
needMultiLineText
|
|
68
69
|
} = this.props;
|
|
69
70
|
let {
|
|
70
71
|
ListItemProps = {},
|
|
@@ -104,7 +105,7 @@ export default class ListItem extends React.Component {
|
|
|
104
105
|
}, ContainerProps), value ? /*#__PURE__*/React.createElement(Box, {
|
|
105
106
|
shrink: true,
|
|
106
107
|
adjust: true,
|
|
107
|
-
className: style.value
|
|
108
|
+
className: needMultiLineText ? style.multiLineValue : style.value
|
|
108
109
|
}, value) : null, children ? /*#__PURE__*/React.createElement(Box, {
|
|
109
110
|
shrink: true,
|
|
110
111
|
adjust: true,
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
--listitem_border_color: var(--zdt_listitem_active_border);
|
|
49
49
|
}
|
|
50
50
|
[dir=ltr] .small {
|
|
51
|
-
--listitem_padding: var(--
|
|
51
|
+
--listitem_padding: var(--zd_size7) var(--zd_size3) var(--zd_size7)
|
|
52
52
|
var(--zd_size5)
|
|
53
|
-
/*rtl: var(--
|
|
53
|
+
/*rtl: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size3)*/;
|
|
54
54
|
}
|
|
55
55
|
[dir=rtl] .small {
|
|
56
|
-
--listitem_padding: var(--
|
|
56
|
+
--listitem_padding: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size3);
|
|
57
57
|
}
|
|
58
58
|
.medium {
|
|
59
|
-
--listitem_padding: var(--
|
|
59
|
+
--listitem_padding: var(--zd_size7) var(--zd_size20);
|
|
60
60
|
--listitem_min_height: var(--zd_size35);
|
|
61
61
|
}
|
|
62
62
|
.large {
|
|
@@ -74,6 +74,13 @@
|
|
|
74
74
|
.children {
|
|
75
75
|
composes: dotted from '../common/common.module.css';
|
|
76
76
|
}
|
|
77
|
+
.value, .multiLineValue {
|
|
78
|
+
line-height: var(--zd_size20);
|
|
79
|
+
}
|
|
80
|
+
.multiLineValue{
|
|
81
|
+
word-break: break-word;
|
|
82
|
+
composes: clamp from '../common/common.module.css'
|
|
83
|
+
}
|
|
77
84
|
.iconBox {
|
|
78
85
|
width: var(--zd_size20);
|
|
79
86
|
text-align: center;
|
|
@@ -178,20 +185,20 @@
|
|
|
178
185
|
display: block;
|
|
179
186
|
}
|
|
180
187
|
[dir=ltr] .smallwithTick {
|
|
181
|
-
--listitem_padding: var(--
|
|
188
|
+
--listitem_padding: var(--zd_size7) var(--zd_size39) var(--zd_size7)
|
|
182
189
|
var(--zd_size5)
|
|
183
|
-
/*rtl: var(--
|
|
190
|
+
/*rtl: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size39)*/;
|
|
184
191
|
}
|
|
185
192
|
[dir=rtl] .smallwithTick {
|
|
186
|
-
--listitem_padding: var(--
|
|
193
|
+
--listitem_padding: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size39);
|
|
187
194
|
}
|
|
188
195
|
[dir=ltr] .mediumwithTick {
|
|
189
|
-
--listitem_padding: var(--
|
|
196
|
+
--listitem_padding: var(--zd_size7) var(--zd_size39) var(--zd_size7)
|
|
190
197
|
var(--zd_size20)
|
|
191
|
-
/*rtl: var(--
|
|
198
|
+
/*rtl: var(--zd_size7) var(--zd_size20) var(--zd_size7) var(--zd_size39)*/;
|
|
192
199
|
}
|
|
193
200
|
[dir=rtl] .mediumwithTick {
|
|
194
|
-
--listitem_padding: var(--
|
|
201
|
+
--listitem_padding: var(--zd_size7) var(--zd_size20) var(--zd_size7) var(--zd_size39);
|
|
195
202
|
}
|
|
196
203
|
[dir=ltr] .largewithTick {
|
|
197
204
|
--listitem_padding: var(--zd_size10) var(--zd_size39) var(--zd_size10)
|
|
@@ -69,7 +69,8 @@ export default class ListItemWithAvatar extends React.PureComponent {
|
|
|
69
69
|
avatarPalette,
|
|
70
70
|
a11y,
|
|
71
71
|
customClass,
|
|
72
|
-
customProps
|
|
72
|
+
customProps,
|
|
73
|
+
needMultiLineText
|
|
73
74
|
} = this.props;
|
|
74
75
|
let {
|
|
75
76
|
ListItemProps = {},
|
|
@@ -130,7 +131,7 @@ export default class ListItemWithAvatar extends React.PureComponent {
|
|
|
130
131
|
flexible: true,
|
|
131
132
|
shrink: true,
|
|
132
133
|
"data-title": isDisabled ? null : title,
|
|
133
|
-
className: style.value
|
|
134
|
+
className: needMultiLineText ? style.multiLineValue : style.value
|
|
134
135
|
}, value) : null, needTick && active ? /*#__PURE__*/React.createElement(Box, {
|
|
135
136
|
className: style.tickIcon,
|
|
136
137
|
"aria-hidden": ariaHidden,
|
|
@@ -55,7 +55,8 @@ export default class ListItemWithCheckBox extends React.Component {
|
|
|
55
55
|
disableTitle,
|
|
56
56
|
a11y,
|
|
57
57
|
customClass,
|
|
58
|
-
customProps
|
|
58
|
+
customProps,
|
|
59
|
+
needMultiLineText
|
|
59
60
|
} = this.props;
|
|
60
61
|
let {
|
|
61
62
|
ListItemProps = {},
|
|
@@ -98,7 +99,7 @@ export default class ListItemWithCheckBox extends React.Component {
|
|
|
98
99
|
flexible: true,
|
|
99
100
|
shrink: true,
|
|
100
101
|
"data-title": isDisabled ? null : title,
|
|
101
|
-
className: style.value
|
|
102
|
+
className: needMultiLineText ? style.multiLineValue : style.value
|
|
102
103
|
}, value));
|
|
103
104
|
}
|
|
104
105
|
}
|
|
@@ -65,7 +65,8 @@ export default class ListItemWithIcon extends React.Component {
|
|
|
65
65
|
disableTitle,
|
|
66
66
|
a11y,
|
|
67
67
|
customClass,
|
|
68
|
-
customProps
|
|
68
|
+
customProps,
|
|
69
|
+
needMultiLineText
|
|
69
70
|
} = this.props;
|
|
70
71
|
let {
|
|
71
72
|
ListItemProps = {},
|
|
@@ -110,7 +111,7 @@ export default class ListItemWithIcon extends React.Component {
|
|
|
110
111
|
}) : null, value && /*#__PURE__*/React.createElement(Box, {
|
|
111
112
|
flexible: true,
|
|
112
113
|
shrink: true,
|
|
113
|
-
className: style.value,
|
|
114
|
+
className: needMultiLineText ? style.multiLineValue : style.value,
|
|
114
115
|
"data-title": isDisabled ? null : title,
|
|
115
116
|
dataId: `${dataIdString}_Text`
|
|
116
117
|
}, value), needTick && active ? /*#__PURE__*/React.createElement(Box, {
|
|
@@ -56,7 +56,8 @@ export default class ListItemWithRadio extends React.Component {
|
|
|
56
56
|
disableTitle,
|
|
57
57
|
a11y,
|
|
58
58
|
customClass,
|
|
59
|
-
customProps
|
|
59
|
+
customProps,
|
|
60
|
+
needMultiLineText
|
|
60
61
|
} = this.props;
|
|
61
62
|
let {
|
|
62
63
|
ListItemProps = {},
|
|
@@ -100,7 +101,7 @@ export default class ListItemWithRadio extends React.Component {
|
|
|
100
101
|
flexible: true,
|
|
101
102
|
shrink: true,
|
|
102
103
|
"data-title": disableTitle ? null : title,
|
|
103
|
-
className: style.value
|
|
104
|
+
className: needMultiLineText ? style.multiLineValue : style.value
|
|
104
105
|
}, value));
|
|
105
106
|
}
|
|
106
107
|
}
|
|
@@ -11,7 +11,8 @@ export const ListContainerDefaultProps = {
|
|
|
11
11
|
a11y: {},
|
|
12
12
|
customClass: '',
|
|
13
13
|
customProps: {},
|
|
14
|
-
dataSelectorId: 'listContainer'
|
|
14
|
+
dataSelectorId: 'listContainer',
|
|
15
|
+
needMultiLineText: false
|
|
15
16
|
};
|
|
16
17
|
export const ListItemDefaultProps = {
|
|
17
18
|
active: false,
|
|
@@ -27,7 +28,8 @@ export const ListItemDefaultProps = {
|
|
|
27
28
|
a11y: {},
|
|
28
29
|
customClass: {},
|
|
29
30
|
customProps: {},
|
|
30
|
-
dataSelectorId: 'listItem'
|
|
31
|
+
dataSelectorId: 'listItem',
|
|
32
|
+
needMultiLineText: false
|
|
31
33
|
};
|
|
32
34
|
export const ListItemWithAvatarDefaultProps = {
|
|
33
35
|
active: false,
|
|
@@ -44,7 +46,8 @@ export const ListItemWithAvatarDefaultProps = {
|
|
|
44
46
|
a11y: {},
|
|
45
47
|
customClass: {},
|
|
46
48
|
customProps: {},
|
|
47
|
-
dataSelectorId: 'listItemWithAvatar'
|
|
49
|
+
dataSelectorId: 'listItemWithAvatar',
|
|
50
|
+
needMultiLineText: false
|
|
48
51
|
};
|
|
49
52
|
export const ListItemWithCheckBoxDefaultProps = {
|
|
50
53
|
active: false,
|
|
@@ -57,7 +60,8 @@ export const ListItemWithCheckBoxDefaultProps = {
|
|
|
57
60
|
a11y: {},
|
|
58
61
|
customClass: {},
|
|
59
62
|
customProps: {},
|
|
60
|
-
dataSelectorId: 'listItemWithCheckBox'
|
|
63
|
+
dataSelectorId: 'listItemWithCheckBox',
|
|
64
|
+
needMultiLineText: false
|
|
61
65
|
};
|
|
62
66
|
export const ListItemWithIconDefaultProps = {
|
|
63
67
|
active: false,
|
|
@@ -73,7 +77,8 @@ export const ListItemWithIconDefaultProps = {
|
|
|
73
77
|
a11y: {},
|
|
74
78
|
customClass: '',
|
|
75
79
|
customProps: {},
|
|
76
|
-
dataSelectorId: 'listItemWithIcon'
|
|
80
|
+
dataSelectorId: 'listItemWithIcon',
|
|
81
|
+
needMultiLineText: false
|
|
77
82
|
};
|
|
78
83
|
export const ListItemWithRadioDefaultProps = {
|
|
79
84
|
active: false,
|
|
@@ -87,5 +92,6 @@ export const ListItemWithRadioDefaultProps = {
|
|
|
87
92
|
a11y: {},
|
|
88
93
|
customClass: {},
|
|
89
94
|
customProps: {},
|
|
90
|
-
dataSelectorId: 'listItemWithRadio'
|
|
95
|
+
dataSelectorId: 'listItemWithRadio',
|
|
96
|
+
needMultiLineText: false
|
|
91
97
|
};
|
|
@@ -24,7 +24,8 @@ export const ListContainer_Props = {
|
|
|
24
24
|
ariaSelected: PropTypes.bool
|
|
25
25
|
}),
|
|
26
26
|
customClass: PropTypes.string,
|
|
27
|
-
customProps: PropTypes.object
|
|
27
|
+
customProps: PropTypes.object,
|
|
28
|
+
needMultiLineText: PropTypes.bool
|
|
28
29
|
};
|
|
29
30
|
export const ListItem_Props = {
|
|
30
31
|
active: PropTypes.bool,
|
|
@@ -53,6 +54,7 @@ export const ListItem_Props = {
|
|
|
53
54
|
role: PropTypes.string,
|
|
54
55
|
ariaSelected: PropTypes.bool
|
|
55
56
|
}),
|
|
57
|
+
needMultiLineText: PropTypes.bool,
|
|
56
58
|
customClass: PropTypes.shape({
|
|
57
59
|
customListItem: PropTypes.string,
|
|
58
60
|
customTickIcon: PropTypes.string
|
|
@@ -97,6 +99,7 @@ export const ListItemWithAvatar_Props = {
|
|
|
97
99
|
customAvatar: PropTypes.string,
|
|
98
100
|
customAvatarTeam: PropTypes.string
|
|
99
101
|
}),
|
|
102
|
+
needMultiLineText: PropTypes.bool,
|
|
100
103
|
customProps: PropTypes.shape({
|
|
101
104
|
ListItemProps: PropTypes.object
|
|
102
105
|
})
|
|
@@ -123,6 +126,7 @@ export const ListItemWithCheckBox_Props = {
|
|
|
123
126
|
role: PropTypes.string,
|
|
124
127
|
ariaSelected: PropTypes.bool
|
|
125
128
|
}),
|
|
129
|
+
needMultiLineText: PropTypes.bool,
|
|
126
130
|
customClass: PropTypes.shape({
|
|
127
131
|
customListItem: PropTypes.string,
|
|
128
132
|
customCheckBox: PropTypes.string,
|
|
@@ -156,6 +160,7 @@ export const ListItemWithIcon_Props = {
|
|
|
156
160
|
ariaSelected: PropTypes.bool,
|
|
157
161
|
ariaHidden: PropTypes.bool
|
|
158
162
|
}),
|
|
163
|
+
needMultiLineText: PropTypes.bool,
|
|
159
164
|
customClass: PropTypes.string,
|
|
160
165
|
customProps: PropTypes.shape({
|
|
161
166
|
ListItemProps: PropTypes.object
|
|
@@ -183,6 +188,7 @@ export const ListItemWithRadio_Props = {
|
|
|
183
188
|
role: PropTypes.string,
|
|
184
189
|
ariaSelected: PropTypes.bool
|
|
185
190
|
}),
|
|
191
|
+
needMultiLineText: PropTypes.bool,
|
|
186
192
|
customClass: PropTypes.shape({
|
|
187
193
|
customListItem: PropTypes.string,
|
|
188
194
|
customRadio: PropTypes.string,
|
|
@@ -249,7 +249,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
249
249
|
} = this.state;
|
|
250
250
|
const {
|
|
251
251
|
selectedOptions,
|
|
252
|
-
needLocalSearch
|
|
252
|
+
needLocalSearch,
|
|
253
|
+
keepSelectedOptions
|
|
253
254
|
} = this.props;
|
|
254
255
|
const {
|
|
255
256
|
suggestions,
|
|
@@ -258,7 +259,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
258
259
|
options,
|
|
259
260
|
selectedOptions,
|
|
260
261
|
searchStr: getSearchString(searchStr),
|
|
261
|
-
needSearch: needLocalSearch
|
|
262
|
+
needSearch: needLocalSearch,
|
|
263
|
+
keepSelectedOptions
|
|
262
264
|
});
|
|
263
265
|
this.suggestionsOrder = suggestionIds;
|
|
264
266
|
return suggestions;
|
|
@@ -450,7 +452,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
450
452
|
handleSelectOption(option, value, index, e) {
|
|
451
453
|
const {
|
|
452
454
|
selectedOptions,
|
|
453
|
-
isSearchClearOnSelect
|
|
455
|
+
isSearchClearOnSelect,
|
|
456
|
+
keepSelectedOptions
|
|
454
457
|
} = this.props;
|
|
455
458
|
const {
|
|
456
459
|
searchStr
|
|
@@ -458,7 +461,15 @@ export class MultiSelectComponent extends React.Component {
|
|
|
458
461
|
if (searchStr.trim() != '' && isSearchClearOnSelect) {
|
|
459
462
|
this.handleSearch('');
|
|
460
463
|
}
|
|
461
|
-
|
|
464
|
+
if (keepSelectedOptions && selectedOptions.indexOf(option) != -1) {
|
|
465
|
+
let newSelectedOptions = selectedOptions.filter(id => {
|
|
466
|
+
return id != option;
|
|
467
|
+
});
|
|
468
|
+
this.handleChange(newSelectedOptions, e);
|
|
469
|
+
} else {
|
|
470
|
+
this.handleChange([...selectedOptions, option], e);
|
|
471
|
+
}
|
|
472
|
+
|
|
462
473
|
// e && e.stopPropagation && this.handlePopupClose(e);
|
|
463
474
|
}
|
|
464
475
|
|
|
@@ -841,7 +852,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
841
852
|
highLightedSelectOptions,
|
|
842
853
|
options,
|
|
843
854
|
isFetchingOptions,
|
|
844
|
-
isActive
|
|
855
|
+
isActive,
|
|
856
|
+
selectedOptionIds
|
|
845
857
|
} = this.state;
|
|
846
858
|
const suggestions = this.handleFilterSuggestions();
|
|
847
859
|
const setAriaId = this.getNextAriaId();
|
|
@@ -985,6 +997,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
985
997
|
needBorder: false,
|
|
986
998
|
dataId: `${dataId}_Options`,
|
|
987
999
|
palette: palette,
|
|
1000
|
+
selectedOptions: selectedOptionIds,
|
|
988
1001
|
a11y: {
|
|
989
1002
|
role: 'option'
|
|
990
1003
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
/**** Libraries ****/
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { MultiSelectWithAvatar_propTypes } from './props/propTypes';
|
|
@@ -99,8 +100,14 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
99
100
|
customChildrenClass,
|
|
100
101
|
isBoxPaddingNeed,
|
|
101
102
|
needEffect,
|
|
102
|
-
isLoading
|
|
103
|
+
isLoading,
|
|
104
|
+
keepSelectedOptions,
|
|
105
|
+
customProps
|
|
103
106
|
} = this.props;
|
|
107
|
+
let {
|
|
108
|
+
TextBoxProps = {},
|
|
109
|
+
SuggestionsProps = {}
|
|
110
|
+
} = customProps;
|
|
104
111
|
const {
|
|
105
112
|
clearText = 'Clear all'
|
|
106
113
|
} = i18nKeys;
|
|
@@ -119,7 +126,8 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
119
126
|
highLightedSelectOptions,
|
|
120
127
|
options,
|
|
121
128
|
isFetchingOptions,
|
|
122
|
-
isActive
|
|
129
|
+
isActive,
|
|
130
|
+
selectedOptionIds
|
|
123
131
|
} = this.state;
|
|
124
132
|
const suggestions = this.handleFilterSuggestions();
|
|
125
133
|
const setAriaId = this.getNextAriaId();
|
|
@@ -183,7 +191,10 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
183
191
|
customClass: {
|
|
184
192
|
customTBoxWrap: style.custmInputWrapper
|
|
185
193
|
},
|
|
186
|
-
autoComplete: false
|
|
194
|
+
autoComplete: false,
|
|
195
|
+
customProps: {
|
|
196
|
+
TextBoxProps: TextBoxProps
|
|
197
|
+
}
|
|
187
198
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
188
199
|
isCover: false,
|
|
189
200
|
alignBox: "row",
|
|
@@ -245,7 +256,8 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
245
256
|
shrink: true,
|
|
246
257
|
customClass: !tabletMode && dropBoxSize ? style[dropBoxSize] : '',
|
|
247
258
|
eleRef: this.suggestionContainerRef
|
|
248
|
-
}, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
|
|
259
|
+
}, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
|
|
260
|
+
needTick: keepSelectedOptions,
|
|
249
261
|
suggestions: suggestions,
|
|
250
262
|
getRef: this.suggestionItemRef,
|
|
251
263
|
hoverOption: hoverOption,
|
|
@@ -254,10 +266,11 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
254
266
|
needBorder: false,
|
|
255
267
|
dataId: `${dataId}_Options`,
|
|
256
268
|
palette: palette,
|
|
269
|
+
selectedOptions: selectedOptionIds,
|
|
257
270
|
a11y: {
|
|
258
271
|
role: 'option'
|
|
259
272
|
}
|
|
260
|
-
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
273
|
+
}, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
261
274
|
isLoading: isFetchingOptions,
|
|
262
275
|
options: options,
|
|
263
276
|
searchString: searchStr,
|
|
@@ -106,7 +106,8 @@ export const MultiSelect_defaultProps = {
|
|
|
106
106
|
needEffect: true,
|
|
107
107
|
boxSize: 'default',
|
|
108
108
|
isLoading: false,
|
|
109
|
-
dataSelectorId: 'multiSelect'
|
|
109
|
+
dataSelectorId: 'multiSelect',
|
|
110
|
+
keepSelectedOptions: false
|
|
110
111
|
};
|
|
111
112
|
export const MultiSelectHeader_defaultProps = {
|
|
112
113
|
dataId: 'MultiSelectHeader'
|
|
@@ -138,7 +139,9 @@ export const MultiSelectWithAvatar_defaultProps = {
|
|
|
138
139
|
isSearchClearOnSelect: true,
|
|
139
140
|
needEffect: true,
|
|
140
141
|
isLoading: false,
|
|
141
|
-
dataSelectorId: 'multiSelectWithAvatar'
|
|
142
|
+
dataSelectorId: 'multiSelectWithAvatar',
|
|
143
|
+
keepSelectedOptions: false,
|
|
144
|
+
customProps: {}
|
|
142
145
|
};
|
|
143
146
|
export const SelectedOptions_defaultProps = {
|
|
144
147
|
size: 'medium'
|
|
@@ -239,7 +239,8 @@ export const MultiSelect_propTypes = {
|
|
|
239
239
|
needEffect: PropTypes.bool,
|
|
240
240
|
boxSize: PropTypes.string,
|
|
241
241
|
isLoading: PropTypes.bool,
|
|
242
|
-
dataSelectorId: PropTypes.string
|
|
242
|
+
dataSelectorId: PropTypes.string,
|
|
243
|
+
keepSelectedOptions: PropTypes.bool
|
|
243
244
|
};
|
|
244
245
|
export const MultiSelectHeader_propTypes = {
|
|
245
246
|
dataId: PropTypes.string,
|
|
@@ -294,6 +295,11 @@ export const MultiSelectWithAvatar_propTypes = {
|
|
|
294
295
|
htmlId: PropTypes.string,
|
|
295
296
|
isBoxPaddingNeed: PropTypes.bool,
|
|
296
297
|
needEffect: PropTypes.bool,
|
|
298
|
+
keepSelectedOptions: PropTypes.bool,
|
|
299
|
+
customProps: PropTypes.shape({
|
|
300
|
+
SuggestionsProps: PropTypes.object,
|
|
301
|
+
DropBoxProps: PropTypes.object
|
|
302
|
+
}),
|
|
297
303
|
/**** Popup props ****/
|
|
298
304
|
isPopupOpen: PropTypes.bool,
|
|
299
305
|
isPopupReady: PropTypes.bool,
|
package/es/utils/Common.js
CHANGED
|
@@ -349,7 +349,6 @@ export function isTextSelected() {
|
|
|
349
349
|
let selectedText = '';
|
|
350
350
|
if (window.getSelection) {
|
|
351
351
|
selectedText = window.getSelection().toString();
|
|
352
|
-
console.log(selectedText, 'selectedText');
|
|
353
352
|
} else if (document.getSelection) {
|
|
354
353
|
selectedText = document.getSelection().toString();
|
|
355
354
|
}
|
|
@@ -21,9 +21,10 @@ const getSelectedValue = props => getIsEmptyValue(props.selectedValue) ? '' : pr
|
|
|
21
21
|
const getSelectedFormatOptions = props => props.selectedFormatOptions || dummyObj;
|
|
22
22
|
export const getPrefixText = props => props.prefixText || '';
|
|
23
23
|
const getIsStartWithSearch = props => props.isStartsWithSearch;
|
|
24
|
+
const getKeepSelectedOptions = props => props.keepSelectedOptions;
|
|
24
25
|
const getDisabledOptions = props => props.disabledOptions || dummyArray;
|
|
25
26
|
const getListItemProps = props => props.listItemProps || '';
|
|
26
|
-
export const makeGetMultiSelectFilterSuggestions = () => createSelector([getOptions, getSelectedOptionsSel, getSearchStr, getNeedSearch, getIsStartWithSearch], (options, selectedOptions, searchStr, needSearch, isStartsWithSearch) => {
|
|
27
|
+
export const makeGetMultiSelectFilterSuggestions = () => createSelector([getOptions, getSelectedOptionsSel, getSearchStr, getNeedSearch, getIsStartWithSearch, getKeepSelectedOptions], (options, selectedOptions, searchStr, needSearch, isStartsWithSearch, keepSelectedOptions) => {
|
|
27
28
|
const suggestions = [];
|
|
28
29
|
const suggestionIds = [];
|
|
29
30
|
options.forEach(option => {
|
|
@@ -34,7 +35,7 @@ export const makeGetMultiSelectFilterSuggestions = () => createSelector([getOpti
|
|
|
34
35
|
const valueString = getSearchString(value);
|
|
35
36
|
const searchString = getSearchString(searchStr);
|
|
36
37
|
const isMatch = needSearch ? isStartsWithSearch ? valueString.startsWith(searchString) : valueString.indexOf(searchString) !== -1 : true;
|
|
37
|
-
if (selectedOptions.indexOf(id) === -1 && isMatch) {
|
|
38
|
+
if (selectedOptions.indexOf(id) === -1 && isMatch || keepSelectedOptions) {
|
|
38
39
|
suggestions.push(option);
|
|
39
40
|
suggestionIds.push(id);
|
|
40
41
|
}
|
package/lib/ListItem/ListItem.js
CHANGED
|
@@ -91,7 +91,8 @@ var ListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
91
91
|
dataSelectorId = _this$props4.dataSelectorId,
|
|
92
92
|
a11y = _this$props4.a11y,
|
|
93
93
|
customClass = _this$props4.customClass,
|
|
94
|
-
customProps = _this$props4.customProps
|
|
94
|
+
customProps = _this$props4.customProps,
|
|
95
|
+
needMultiLineText = _this$props4.needMultiLineText;
|
|
95
96
|
var _customProps$ListItem = customProps.ListItemProps,
|
|
96
97
|
ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
97
98
|
_customProps$Containe = customProps.ContainerProps,
|
|
@@ -129,7 +130,7 @@ var ListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
129
130
|
}, ContainerProps), value ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
130
131
|
shrink: true,
|
|
131
132
|
adjust: true,
|
|
132
|
-
className: _ListItemModule["default"].value
|
|
133
|
+
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value
|
|
133
134
|
}, value) : null, children ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
134
135
|
shrink: true,
|
|
135
136
|
adjust: true,
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
--listitem_border_color: var(--zdt_listitem_active_border);
|
|
49
49
|
}
|
|
50
50
|
[dir=ltr] .small {
|
|
51
|
-
--listitem_padding: var(--
|
|
51
|
+
--listitem_padding: var(--zd_size7) var(--zd_size3) var(--zd_size7)
|
|
52
52
|
var(--zd_size5)
|
|
53
|
-
/*rtl: var(--
|
|
53
|
+
/*rtl: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size3)*/;
|
|
54
54
|
}
|
|
55
55
|
[dir=rtl] .small {
|
|
56
|
-
--listitem_padding: var(--
|
|
56
|
+
--listitem_padding: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size3);
|
|
57
57
|
}
|
|
58
58
|
.medium {
|
|
59
|
-
--listitem_padding: var(--
|
|
59
|
+
--listitem_padding: var(--zd_size7) var(--zd_size20);
|
|
60
60
|
--listitem_min_height: var(--zd_size35);
|
|
61
61
|
}
|
|
62
62
|
.large {
|
|
@@ -74,6 +74,13 @@
|
|
|
74
74
|
.children {
|
|
75
75
|
composes: dotted from '../common/common.module.css';
|
|
76
76
|
}
|
|
77
|
+
.value, .multiLineValue {
|
|
78
|
+
line-height: var(--zd_size20);
|
|
79
|
+
}
|
|
80
|
+
.multiLineValue{
|
|
81
|
+
word-break: break-word;
|
|
82
|
+
composes: clamp from '../common/common.module.css'
|
|
83
|
+
}
|
|
77
84
|
.iconBox {
|
|
78
85
|
width: var(--zd_size20);
|
|
79
86
|
text-align: center;
|
|
@@ -178,20 +185,20 @@
|
|
|
178
185
|
display: block;
|
|
179
186
|
}
|
|
180
187
|
[dir=ltr] .smallwithTick {
|
|
181
|
-
--listitem_padding: var(--
|
|
188
|
+
--listitem_padding: var(--zd_size7) var(--zd_size39) var(--zd_size7)
|
|
182
189
|
var(--zd_size5)
|
|
183
|
-
/*rtl: var(--
|
|
190
|
+
/*rtl: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size39)*/;
|
|
184
191
|
}
|
|
185
192
|
[dir=rtl] .smallwithTick {
|
|
186
|
-
--listitem_padding: var(--
|
|
193
|
+
--listitem_padding: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size39);
|
|
187
194
|
}
|
|
188
195
|
[dir=ltr] .mediumwithTick {
|
|
189
|
-
--listitem_padding: var(--
|
|
196
|
+
--listitem_padding: var(--zd_size7) var(--zd_size39) var(--zd_size7)
|
|
190
197
|
var(--zd_size20)
|
|
191
|
-
/*rtl: var(--
|
|
198
|
+
/*rtl: var(--zd_size7) var(--zd_size20) var(--zd_size7) var(--zd_size39)*/;
|
|
192
199
|
}
|
|
193
200
|
[dir=rtl] .mediumwithTick {
|
|
194
|
-
--listitem_padding: var(--
|
|
201
|
+
--listitem_padding: var(--zd_size7) var(--zd_size20) var(--zd_size7) var(--zd_size39);
|
|
195
202
|
}
|
|
196
203
|
[dir=ltr] .largewithTick {
|
|
197
204
|
--listitem_padding: var(--zd_size10) var(--zd_size39) var(--zd_size10)
|
|
@@ -95,7 +95,8 @@ var ListItemWithAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
95
95
|
avatarPalette = _this$props4.avatarPalette,
|
|
96
96
|
a11y = _this$props4.a11y,
|
|
97
97
|
customClass = _this$props4.customClass,
|
|
98
|
-
customProps = _this$props4.customProps
|
|
98
|
+
customProps = _this$props4.customProps,
|
|
99
|
+
needMultiLineText = _this$props4.needMultiLineText;
|
|
99
100
|
var _customProps$ListItem = customProps.ListItemProps,
|
|
100
101
|
ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
101
102
|
_customProps$Containe = customProps.ContainerProps,
|
|
@@ -155,7 +156,7 @@ var ListItemWithAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
155
156
|
flexible: true,
|
|
156
157
|
shrink: true,
|
|
157
158
|
"data-title": isDisabled ? null : title,
|
|
158
|
-
className: _ListItemModule["default"].value
|
|
159
|
+
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value
|
|
159
160
|
}, value) : null, needTick && active ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
160
161
|
className: _ListItemModule["default"].tickIcon,
|
|
161
162
|
"aria-hidden": ariaHidden,
|
|
@@ -85,7 +85,8 @@ var ListItemWithCheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
85
85
|
disableTitle = _this$props4.disableTitle,
|
|
86
86
|
a11y = _this$props4.a11y,
|
|
87
87
|
customClass = _this$props4.customClass,
|
|
88
|
-
customProps = _this$props4.customProps
|
|
88
|
+
customProps = _this$props4.customProps,
|
|
89
|
+
needMultiLineText = _this$props4.needMultiLineText;
|
|
89
90
|
var _customProps$ListItem = customProps.ListItemProps,
|
|
90
91
|
ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
91
92
|
_customProps$Containe = customProps.ContainerProps,
|
|
@@ -128,7 +129,7 @@ var ListItemWithCheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
128
129
|
flexible: true,
|
|
129
130
|
shrink: true,
|
|
130
131
|
"data-title": isDisabled ? null : title,
|
|
131
|
-
className: _ListItemModule["default"].value
|
|
132
|
+
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value
|
|
132
133
|
}, value));
|
|
133
134
|
}
|
|
134
135
|
}]);
|
|
@@ -93,7 +93,8 @@ var ListItemWithIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
93
93
|
disableTitle = _this$props4.disableTitle,
|
|
94
94
|
a11y = _this$props4.a11y,
|
|
95
95
|
customClass = _this$props4.customClass,
|
|
96
|
-
customProps = _this$props4.customProps
|
|
96
|
+
customProps = _this$props4.customProps,
|
|
97
|
+
needMultiLineText = _this$props4.needMultiLineText;
|
|
97
98
|
var _customProps$ListItem = customProps.ListItemProps,
|
|
98
99
|
ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
99
100
|
_customProps$Containe = customProps.ContainerProps,
|
|
@@ -136,7 +137,7 @@ var ListItemWithIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
136
137
|
}) : null, value && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
137
138
|
flexible: true,
|
|
138
139
|
shrink: true,
|
|
139
|
-
className: _ListItemModule["default"].value,
|
|
140
|
+
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value,
|
|
140
141
|
"data-title": isDisabled ? null : title,
|
|
141
142
|
dataId: "".concat(dataIdString, "_Text")
|
|
142
143
|
}, value), needTick && active ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
@@ -86,7 +86,8 @@ var ListItemWithRadio = /*#__PURE__*/function (_React$Component) {
|
|
|
86
86
|
disableTitle = _this$props4.disableTitle,
|
|
87
87
|
a11y = _this$props4.a11y,
|
|
88
88
|
customClass = _this$props4.customClass,
|
|
89
|
-
customProps = _this$props4.customProps
|
|
89
|
+
customProps = _this$props4.customProps,
|
|
90
|
+
needMultiLineText = _this$props4.needMultiLineText;
|
|
90
91
|
var _customProps$ListItem = customProps.ListItemProps,
|
|
91
92
|
ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
92
93
|
_customProps$Containe = customProps.ContainerProps,
|
|
@@ -130,7 +131,7 @@ var ListItemWithRadio = /*#__PURE__*/function (_React$Component) {
|
|
|
130
131
|
flexible: true,
|
|
131
132
|
shrink: true,
|
|
132
133
|
"data-title": disableTitle ? null : title,
|
|
133
|
-
className: _ListItemModule["default"].value
|
|
134
|
+
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value
|
|
134
135
|
}, value));
|
|
135
136
|
}
|
|
136
137
|
}]);
|
|
@@ -17,7 +17,8 @@ var ListContainerDefaultProps = {
|
|
|
17
17
|
a11y: {},
|
|
18
18
|
customClass: '',
|
|
19
19
|
customProps: {},
|
|
20
|
-
dataSelectorId: 'listContainer'
|
|
20
|
+
dataSelectorId: 'listContainer',
|
|
21
|
+
needMultiLineText: false
|
|
21
22
|
};
|
|
22
23
|
exports.ListContainerDefaultProps = ListContainerDefaultProps;
|
|
23
24
|
var ListItemDefaultProps = {
|
|
@@ -34,7 +35,8 @@ var ListItemDefaultProps = {
|
|
|
34
35
|
a11y: {},
|
|
35
36
|
customClass: {},
|
|
36
37
|
customProps: {},
|
|
37
|
-
dataSelectorId: 'listItem'
|
|
38
|
+
dataSelectorId: 'listItem',
|
|
39
|
+
needMultiLineText: false
|
|
38
40
|
};
|
|
39
41
|
exports.ListItemDefaultProps = ListItemDefaultProps;
|
|
40
42
|
var ListItemWithAvatarDefaultProps = {
|
|
@@ -52,7 +54,8 @@ var ListItemWithAvatarDefaultProps = {
|
|
|
52
54
|
a11y: {},
|
|
53
55
|
customClass: {},
|
|
54
56
|
customProps: {},
|
|
55
|
-
dataSelectorId: 'listItemWithAvatar'
|
|
57
|
+
dataSelectorId: 'listItemWithAvatar',
|
|
58
|
+
needMultiLineText: false
|
|
56
59
|
};
|
|
57
60
|
exports.ListItemWithAvatarDefaultProps = ListItemWithAvatarDefaultProps;
|
|
58
61
|
var ListItemWithCheckBoxDefaultProps = {
|
|
@@ -66,7 +69,8 @@ var ListItemWithCheckBoxDefaultProps = {
|
|
|
66
69
|
a11y: {},
|
|
67
70
|
customClass: {},
|
|
68
71
|
customProps: {},
|
|
69
|
-
dataSelectorId: 'listItemWithCheckBox'
|
|
72
|
+
dataSelectorId: 'listItemWithCheckBox',
|
|
73
|
+
needMultiLineText: false
|
|
70
74
|
};
|
|
71
75
|
exports.ListItemWithCheckBoxDefaultProps = ListItemWithCheckBoxDefaultProps;
|
|
72
76
|
var ListItemWithIconDefaultProps = {
|
|
@@ -83,7 +87,8 @@ var ListItemWithIconDefaultProps = {
|
|
|
83
87
|
a11y: {},
|
|
84
88
|
customClass: '',
|
|
85
89
|
customProps: {},
|
|
86
|
-
dataSelectorId: 'listItemWithIcon'
|
|
90
|
+
dataSelectorId: 'listItemWithIcon',
|
|
91
|
+
needMultiLineText: false
|
|
87
92
|
};
|
|
88
93
|
exports.ListItemWithIconDefaultProps = ListItemWithIconDefaultProps;
|
|
89
94
|
var ListItemWithRadioDefaultProps = {
|
|
@@ -98,6 +103,7 @@ var ListItemWithRadioDefaultProps = {
|
|
|
98
103
|
a11y: {},
|
|
99
104
|
customClass: {},
|
|
100
105
|
customProps: {},
|
|
101
|
-
dataSelectorId: 'listItemWithRadio'
|
|
106
|
+
dataSelectorId: 'listItemWithRadio',
|
|
107
|
+
needMultiLineText: false
|
|
102
108
|
};
|
|
103
109
|
exports.ListItemWithRadioDefaultProps = ListItemWithRadioDefaultProps;
|
|
@@ -36,7 +36,8 @@ var ListContainer_Props = {
|
|
|
36
36
|
ariaSelected: _propTypes["default"].bool
|
|
37
37
|
}),
|
|
38
38
|
customClass: _propTypes["default"].string,
|
|
39
|
-
customProps: _propTypes["default"].object
|
|
39
|
+
customProps: _propTypes["default"].object,
|
|
40
|
+
needMultiLineText: _propTypes["default"].bool
|
|
40
41
|
};
|
|
41
42
|
exports.ListContainer_Props = ListContainer_Props;
|
|
42
43
|
var ListItem_Props = {
|
|
@@ -66,6 +67,7 @@ var ListItem_Props = {
|
|
|
66
67
|
role: _propTypes["default"].string,
|
|
67
68
|
ariaSelected: _propTypes["default"].bool
|
|
68
69
|
}),
|
|
70
|
+
needMultiLineText: _propTypes["default"].bool,
|
|
69
71
|
customClass: _propTypes["default"].shape({
|
|
70
72
|
customListItem: _propTypes["default"].string,
|
|
71
73
|
customTickIcon: _propTypes["default"].string
|
|
@@ -87,7 +89,7 @@ var ListItemWithAvatar_Props = (_ListItemWithAvatar_P = {
|
|
|
87
89
|
customListItem: _propTypes["default"].string,
|
|
88
90
|
customAvatar: _propTypes["default"].string,
|
|
89
91
|
customAvatarTeam: _propTypes["default"].string
|
|
90
|
-
})), _defineProperty(_ListItemWithAvatar_P, "customProps", _propTypes["default"].shape({
|
|
92
|
+
})), _defineProperty(_ListItemWithAvatar_P, "needMultiLineText", _propTypes["default"].bool), _defineProperty(_ListItemWithAvatar_P, "customProps", _propTypes["default"].shape({
|
|
91
93
|
ListItemProps: _propTypes["default"].object
|
|
92
94
|
})), _ListItemWithAvatar_P);
|
|
93
95
|
exports.ListItemWithAvatar_Props = ListItemWithAvatar_Props;
|
|
@@ -113,6 +115,7 @@ var ListItemWithCheckBox_Props = {
|
|
|
113
115
|
role: _propTypes["default"].string,
|
|
114
116
|
ariaSelected: _propTypes["default"].bool
|
|
115
117
|
}),
|
|
118
|
+
needMultiLineText: _propTypes["default"].bool,
|
|
116
119
|
customClass: _propTypes["default"].shape({
|
|
117
120
|
customListItem: _propTypes["default"].string,
|
|
118
121
|
customCheckBox: _propTypes["default"].string,
|
|
@@ -147,6 +150,7 @@ var ListItemWithIcon_Props = {
|
|
|
147
150
|
ariaSelected: _propTypes["default"].bool,
|
|
148
151
|
ariaHidden: _propTypes["default"].bool
|
|
149
152
|
}),
|
|
153
|
+
needMultiLineText: _propTypes["default"].bool,
|
|
150
154
|
customClass: _propTypes["default"].string,
|
|
151
155
|
customProps: _propTypes["default"].shape({
|
|
152
156
|
ListItemProps: _propTypes["default"].object
|
|
@@ -175,6 +179,7 @@ var ListItemWithRadio_Props = {
|
|
|
175
179
|
role: _propTypes["default"].string,
|
|
176
180
|
ariaSelected: _propTypes["default"].bool
|
|
177
181
|
}),
|
|
182
|
+
needMultiLineText: _propTypes["default"].bool,
|
|
178
183
|
customClass: _propTypes["default"].shape({
|
|
179
184
|
customListItem: _propTypes["default"].string,
|
|
180
185
|
customRadio: _propTypes["default"].string,
|
|
@@ -276,12 +276,14 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
276
276
|
searchStr = _this$state3$searchSt === void 0 ? '' : _this$state3$searchSt;
|
|
277
277
|
var _this$props4 = this.props,
|
|
278
278
|
selectedOptions = _this$props4.selectedOptions,
|
|
279
|
-
needLocalSearch = _this$props4.needLocalSearch
|
|
279
|
+
needLocalSearch = _this$props4.needLocalSearch,
|
|
280
|
+
keepSelectedOptions = _this$props4.keepSelectedOptions;
|
|
280
281
|
var _this$getFilterSugges = this.getFilterSuggestions({
|
|
281
282
|
options: options,
|
|
282
283
|
selectedOptions: selectedOptions,
|
|
283
284
|
searchStr: (0, _Common.getSearchString)(searchStr),
|
|
284
|
-
needSearch: needLocalSearch
|
|
285
|
+
needSearch: needLocalSearch,
|
|
286
|
+
keepSelectedOptions: keepSelectedOptions
|
|
285
287
|
}),
|
|
286
288
|
suggestions = _this$getFilterSugges.suggestions,
|
|
287
289
|
suggestionIds = _this$getFilterSugges.suggestionIds;
|
|
@@ -476,12 +478,21 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
476
478
|
value: function handleSelectOption(option, value, index, e) {
|
|
477
479
|
var _this$props6 = this.props,
|
|
478
480
|
selectedOptions = _this$props6.selectedOptions,
|
|
479
|
-
isSearchClearOnSelect = _this$props6.isSearchClearOnSelect
|
|
481
|
+
isSearchClearOnSelect = _this$props6.isSearchClearOnSelect,
|
|
482
|
+
keepSelectedOptions = _this$props6.keepSelectedOptions;
|
|
480
483
|
var searchStr = this.state.searchStr;
|
|
481
484
|
if (searchStr.trim() != '' && isSearchClearOnSelect) {
|
|
482
485
|
this.handleSearch('');
|
|
483
486
|
}
|
|
484
|
-
|
|
487
|
+
if (keepSelectedOptions && selectedOptions.indexOf(option) != -1) {
|
|
488
|
+
var newSelectedOptions = selectedOptions.filter(function (id) {
|
|
489
|
+
return id != option;
|
|
490
|
+
});
|
|
491
|
+
this.handleChange(newSelectedOptions, e);
|
|
492
|
+
} else {
|
|
493
|
+
this.handleChange([].concat(_toConsumableArray(selectedOptions), [option]), e);
|
|
494
|
+
}
|
|
495
|
+
|
|
485
496
|
// e && e.stopPropagation && this.handlePopupClose(e);
|
|
486
497
|
}
|
|
487
498
|
}, {
|
|
@@ -873,7 +884,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
873
884
|
highLightedSelectOptions = _this$state8.highLightedSelectOptions,
|
|
874
885
|
options = _this$state8.options,
|
|
875
886
|
isFetchingOptions = _this$state8.isFetchingOptions,
|
|
876
|
-
isActive = _this$state8.isActive
|
|
887
|
+
isActive = _this$state8.isActive,
|
|
888
|
+
selectedOptionIds = _this$state8.selectedOptionIds;
|
|
877
889
|
var suggestions = this.handleFilterSuggestions();
|
|
878
890
|
var setAriaId = this.getNextAriaId();
|
|
879
891
|
var ariaErrorId = this.getNextAriaId();
|
|
@@ -1012,6 +1024,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1012
1024
|
needBorder: false,
|
|
1013
1025
|
dataId: "".concat(dataId, "_Options"),
|
|
1014
1026
|
palette: palette,
|
|
1027
|
+
selectedOptions: selectedOptionIds,
|
|
1015
1028
|
a11y: {
|
|
1016
1029
|
role: 'option'
|
|
1017
1030
|
}
|
|
@@ -27,6 +27,7 @@ var _MultiSelectModule = _interopRequireDefault(require("./MultiSelect.module.cs
|
|
|
27
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
30
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
30
31
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
32
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
32
33
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -121,7 +122,13 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
121
122
|
customChildrenClass = _this$props.customChildrenClass,
|
|
122
123
|
isBoxPaddingNeed = _this$props.isBoxPaddingNeed,
|
|
123
124
|
needEffect = _this$props.needEffect,
|
|
124
|
-
isLoading = _this$props.isLoading
|
|
125
|
+
isLoading = _this$props.isLoading,
|
|
126
|
+
keepSelectedOptions = _this$props.keepSelectedOptions,
|
|
127
|
+
customProps = _this$props.customProps;
|
|
128
|
+
var _customProps$TextBoxP = customProps.TextBoxProps,
|
|
129
|
+
TextBoxProps = _customProps$TextBoxP === void 0 ? {} : _customProps$TextBoxP,
|
|
130
|
+
_customProps$Suggesti = customProps.SuggestionsProps,
|
|
131
|
+
SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti;
|
|
125
132
|
var _i18nKeys = i18nKeys,
|
|
126
133
|
_i18nKeys$clearText = _i18nKeys.clearText,
|
|
127
134
|
clearText = _i18nKeys$clearText === void 0 ? 'Clear all' : _i18nKeys$clearText;
|
|
@@ -139,7 +146,8 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
139
146
|
highLightedSelectOptions = _this$state.highLightedSelectOptions,
|
|
140
147
|
options = _this$state.options,
|
|
141
148
|
isFetchingOptions = _this$state.isFetchingOptions,
|
|
142
|
-
isActive = _this$state.isActive
|
|
149
|
+
isActive = _this$state.isActive,
|
|
150
|
+
selectedOptionIds = _this$state.selectedOptionIds;
|
|
143
151
|
var suggestions = this.handleFilterSuggestions();
|
|
144
152
|
var setAriaId = this.getNextAriaId();
|
|
145
153
|
var ariaErrorId = this.getNextAriaId();
|
|
@@ -201,7 +209,10 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
201
209
|
customClass: {
|
|
202
210
|
customTBoxWrap: _MultiSelectModule["default"].custmInputWrapper
|
|
203
211
|
},
|
|
204
|
-
autoComplete: false
|
|
212
|
+
autoComplete: false,
|
|
213
|
+
customProps: {
|
|
214
|
+
TextBoxProps: TextBoxProps
|
|
215
|
+
}
|
|
205
216
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
206
217
|
isCover: false,
|
|
207
218
|
alignBox: "row",
|
|
@@ -261,7 +272,8 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
261
272
|
shrink: true,
|
|
262
273
|
customClass: !tabletMode && dropBoxSize ? _MultiSelectModule["default"][dropBoxSize] : '',
|
|
263
274
|
eleRef: _this2.suggestionContainerRef
|
|
264
|
-
}, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
275
|
+
}, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
|
|
276
|
+
needTick: keepSelectedOptions,
|
|
265
277
|
suggestions: suggestions,
|
|
266
278
|
getRef: _this2.suggestionItemRef,
|
|
267
279
|
hoverOption: hoverOption,
|
|
@@ -270,10 +282,11 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
270
282
|
needBorder: false,
|
|
271
283
|
dataId: "".concat(dataId, "_Options"),
|
|
272
284
|
palette: palette,
|
|
285
|
+
selectedOptions: selectedOptionIds,
|
|
273
286
|
a11y: {
|
|
274
287
|
role: 'option'
|
|
275
288
|
}
|
|
276
|
-
}) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
289
|
+
}, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
277
290
|
isLoading: isFetchingOptions,
|
|
278
291
|
options: options,
|
|
279
292
|
searchString: searchStr,
|
|
@@ -115,7 +115,8 @@ var MultiSelect_defaultProps = {
|
|
|
115
115
|
needEffect: true,
|
|
116
116
|
boxSize: 'default',
|
|
117
117
|
isLoading: false,
|
|
118
|
-
dataSelectorId: 'multiSelect'
|
|
118
|
+
dataSelectorId: 'multiSelect',
|
|
119
|
+
keepSelectedOptions: false
|
|
119
120
|
};
|
|
120
121
|
exports.MultiSelect_defaultProps = MultiSelect_defaultProps;
|
|
121
122
|
var MultiSelectHeader_defaultProps = {
|
|
@@ -149,7 +150,9 @@ var MultiSelectWithAvatar_defaultProps = {
|
|
|
149
150
|
isSearchClearOnSelect: true,
|
|
150
151
|
needEffect: true,
|
|
151
152
|
isLoading: false,
|
|
152
|
-
dataSelectorId: 'multiSelectWithAvatar'
|
|
153
|
+
dataSelectorId: 'multiSelectWithAvatar',
|
|
154
|
+
keepSelectedOptions: false,
|
|
155
|
+
customProps: {}
|
|
153
156
|
};
|
|
154
157
|
exports.MultiSelectWithAvatar_defaultProps = MultiSelectWithAvatar_defaultProps;
|
|
155
158
|
var SelectedOptions_defaultProps = {
|
|
@@ -249,7 +249,8 @@ var MultiSelect_propTypes = {
|
|
|
249
249
|
needEffect: _propTypes["default"].bool,
|
|
250
250
|
boxSize: _propTypes["default"].string,
|
|
251
251
|
isLoading: _propTypes["default"].bool,
|
|
252
|
-
dataSelectorId: _propTypes["default"].string
|
|
252
|
+
dataSelectorId: _propTypes["default"].string,
|
|
253
|
+
keepSelectedOptions: _propTypes["default"].bool
|
|
253
254
|
};
|
|
254
255
|
exports.MultiSelect_propTypes = MultiSelect_propTypes;
|
|
255
256
|
var MultiSelectHeader_propTypes = {
|
|
@@ -306,6 +307,11 @@ var MultiSelectWithAvatar_propTypes = {
|
|
|
306
307
|
htmlId: _propTypes["default"].string,
|
|
307
308
|
isBoxPaddingNeed: _propTypes["default"].bool,
|
|
308
309
|
needEffect: _propTypes["default"].bool,
|
|
310
|
+
keepSelectedOptions: _propTypes["default"].bool,
|
|
311
|
+
customProps: _propTypes["default"].shape({
|
|
312
|
+
SuggestionsProps: _propTypes["default"].object,
|
|
313
|
+
DropBoxProps: _propTypes["default"].object
|
|
314
|
+
}),
|
|
309
315
|
/**** Popup props ****/
|
|
310
316
|
isPopupOpen: _propTypes["default"].bool,
|
|
311
317
|
isPopupReady: _propTypes["default"].bool,
|
package/lib/utils/Common.js
CHANGED
|
@@ -396,7 +396,6 @@ function isTextSelected() {
|
|
|
396
396
|
var selectedText = '';
|
|
397
397
|
if (window.getSelection) {
|
|
398
398
|
selectedText = window.getSelection().toString();
|
|
399
|
-
console.log(selectedText, 'selectedText');
|
|
400
399
|
} else if (document.getSelection) {
|
|
401
400
|
selectedText = document.getSelection().toString();
|
|
402
401
|
}
|
|
@@ -86,6 +86,9 @@ exports.getPrefixText = getPrefixText;
|
|
|
86
86
|
var getIsStartWithSearch = function getIsStartWithSearch(props) {
|
|
87
87
|
return props.isStartsWithSearch;
|
|
88
88
|
};
|
|
89
|
+
var getKeepSelectedOptions = function getKeepSelectedOptions(props) {
|
|
90
|
+
return props.keepSelectedOptions;
|
|
91
|
+
};
|
|
89
92
|
var getDisabledOptions = function getDisabledOptions(props) {
|
|
90
93
|
return props.disabledOptions || dummyArray;
|
|
91
94
|
};
|
|
@@ -93,7 +96,7 @@ var getListItemProps = function getListItemProps(props) {
|
|
|
93
96
|
return props.listItemProps || '';
|
|
94
97
|
};
|
|
95
98
|
var makeGetMultiSelectFilterSuggestions = function makeGetMultiSelectFilterSuggestions() {
|
|
96
|
-
return (0, _reselect.createSelector)([getOptions, getSelectedOptionsSel, getSearchStr, getNeedSearch, getIsStartWithSearch], function (options, selectedOptions, searchStr, needSearch, isStartsWithSearch) {
|
|
99
|
+
return (0, _reselect.createSelector)([getOptions, getSelectedOptionsSel, getSearchStr, getNeedSearch, getIsStartWithSearch, getKeepSelectedOptions], function (options, selectedOptions, searchStr, needSearch, isStartsWithSearch, keepSelectedOptions) {
|
|
97
100
|
var suggestions = [];
|
|
98
101
|
var suggestionIds = [];
|
|
99
102
|
options.forEach(function (option) {
|
|
@@ -103,7 +106,7 @@ var makeGetMultiSelectFilterSuggestions = function makeGetMultiSelectFilterSugge
|
|
|
103
106
|
var valueString = (0, _Common.getSearchString)(value);
|
|
104
107
|
var searchString = (0, _Common.getSearchString)(searchStr);
|
|
105
108
|
var isMatch = needSearch ? isStartsWithSearch ? valueString.startsWith(searchString) : valueString.indexOf(searchString) !== -1 : true;
|
|
106
|
-
if (selectedOptions.indexOf(id) === -1 && isMatch) {
|
|
109
|
+
if (selectedOptions.indexOf(id) === -1 && isMatch || keepSelectedOptions) {
|
|
107
110
|
suggestions.push(option);
|
|
108
111
|
suggestionIds.push(id);
|
|
109
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-263",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@zohodesk/docstool": "1.0.0-alpha-2",
|
|
50
|
-
"@zohodesk/variables": "1.0.0-beta.
|
|
50
|
+
"@zohodesk/variables": "1.0.0-beta.30",
|
|
51
51
|
"@zohodesk/icons": "1.0.0-beta.119",
|
|
52
52
|
"@zohodesk/virtualizer": "1.0.3",
|
|
53
53
|
"velocity-react": "1.4.3",
|
|
54
54
|
"react-sortable-hoc": "^0.8.3",
|
|
55
|
-
"@zohodesk/svg": "1.0.0-beta.
|
|
55
|
+
"@zohodesk/svg": "1.0.0-beta.54",
|
|
56
56
|
"@zohodesk/a11y": "1.3.7"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@zohodesk/icons": "1.0.0-beta.119",
|
|
66
|
-
"@zohodesk/variables": "1.0.0-beta.
|
|
67
|
-
"@zohodesk/svg": "1.0.0-beta.
|
|
66
|
+
"@zohodesk/variables": "1.0.0-beta.30",
|
|
67
|
+
"@zohodesk/svg": "1.0.0-beta.54",
|
|
68
68
|
"@zohodesk/virtualizer": "1.0.3",
|
|
69
69
|
"velocity-react": "1.4.3",
|
|
70
70
|
"react-sortable-hoc": "^0.8.3",
|