@zohodesk/components 1.0.0-temp-199.12 → 1.0.0-temp-220
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/.cli/propValidation_report.html +1 -1
- package/README.md +5 -0
- package/es/ListItem/ListContainer.js +2 -3
- package/es/ListItem/ListItem.js +2 -3
- package/es/ListItem/ListItem.module.css +2 -11
- package/es/ListItem/ListItemWithAvatar.js +3 -3
- package/es/ListItem/ListItemWithIcon.js +2 -3
- package/es/ListItem/props/defaultProps.js +1 -2
- package/es/ListItem/props/propTypes.js +1 -2
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +14 -11
- package/es/MultiSelect/AdvancedMultiSelect.js +12 -6
- package/es/MultiSelect/MultiSelect.js +12 -11
- package/es/MultiSelect/MultiSelectWithAvatar.js +4 -2
- package/es/MultiSelect/Suggestions.js +2 -9
- package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +28 -0
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +390 -0
- package/es/MultiSelect/props/defaultProps.js +8 -7
- package/es/MultiSelect/props/propTypes.js +5 -11
- package/es/Popup/Popup.js +19 -22
- package/es/Select/GroupSelect.js +5 -7
- package/es/Select/Select.js +3 -1
- package/es/Select/SelectWithAvatar.js +6 -9
- package/es/Select/SelectWithIcon.js +2 -4
- package/es/Select/props/defaultProps.js +5 -4
- package/es/Select/props/propTypes.js +7 -10
- package/es/common/common.module.css +0 -5
- package/es/utils/dropDownUtils.js +10 -6
- package/lib/ListItem/ListContainer.js +2 -3
- package/lib/ListItem/ListItem.js +2 -3
- package/lib/ListItem/ListItem.module.css +2 -11
- package/lib/ListItem/ListItemWithAvatar.js +3 -3
- package/lib/ListItem/ListItemWithIcon.js +2 -3
- package/lib/ListItem/props/defaultProps.js +1 -2
- package/lib/ListItem/props/propTypes.js +1 -2
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +14 -13
- package/lib/MultiSelect/AdvancedMultiSelect.js +12 -6
- package/lib/MultiSelect/MultiSelect.js +11 -10
- package/lib/MultiSelect/MultiSelectWithAvatar.js +4 -2
- package/lib/MultiSelect/Suggestions.js +3 -9
- package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +28 -0
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +390 -0
- package/lib/MultiSelect/props/defaultProps.js +8 -7
- package/lib/MultiSelect/props/propTypes.js +5 -11
- package/lib/Popup/Popup.js +20 -24
- package/lib/Select/GroupSelect.js +6 -6
- package/lib/Select/Select.js +3 -1
- package/lib/Select/SelectWithAvatar.js +7 -10
- package/lib/Select/SelectWithIcon.js +3 -5
- package/lib/Select/props/defaultProps.js +5 -4
- package/lib/Select/props/propTypes.js +7 -10
- package/lib/common/common.module.css +0 -5
- package/lib/utils/dropDownUtils.js +12 -6
- package/package.json +2 -2
|
@@ -33,7 +33,8 @@ export const Select_defaultProps = {
|
|
|
33
33
|
iconOnHover: false,
|
|
34
34
|
customProps: {},
|
|
35
35
|
isLoading: false,
|
|
36
|
-
isAbsolutePositioningNeeded: true
|
|
36
|
+
isAbsolutePositioningNeeded: true,
|
|
37
|
+
allowValueFallback: true
|
|
37
38
|
};
|
|
38
39
|
export const GroupSelect_defaultProps = {
|
|
39
40
|
animationStyle: 'bounce',
|
|
@@ -70,7 +71,8 @@ export const GroupSelect_defaultProps = {
|
|
|
70
71
|
i18nKeys: {},
|
|
71
72
|
iconOnHover: false,
|
|
72
73
|
isLoading: false,
|
|
73
|
-
customProps: {}
|
|
74
|
+
customProps: {},
|
|
75
|
+
allowValueFallback: true
|
|
74
76
|
};
|
|
75
77
|
export const SelectWithAvatar_defaultProps = {
|
|
76
78
|
animationStyle: 'bounce',
|
|
@@ -96,8 +98,7 @@ export const SelectWithAvatar_defaultProps = {
|
|
|
96
98
|
isRestrictScroll: false,
|
|
97
99
|
i18nKeys: {},
|
|
98
100
|
needEffect: true,
|
|
99
|
-
isLoading: false
|
|
100
|
-
customProps: {}
|
|
101
|
+
isLoading: false
|
|
101
102
|
};
|
|
102
103
|
export const SelectWithIcon_defaultProps = {
|
|
103
104
|
isReadOnly: false,
|
|
@@ -93,7 +93,8 @@ export const Select_propTypes = {
|
|
|
93
93
|
positionsOffset: PropTypes.object,
|
|
94
94
|
targetOffset: PropTypes.object,
|
|
95
95
|
isRestrictScroll: PropTypes.bool,
|
|
96
|
-
dropBoxPortalId: PropTypes.string
|
|
96
|
+
dropBoxPortalId: PropTypes.string,
|
|
97
|
+
allowValueFallback: PropTypes.bool
|
|
97
98
|
};
|
|
98
99
|
export const GroupSelect_propTypes = {
|
|
99
100
|
groupedOptions: PropTypes.arrayOf(PropTypes.shape({
|
|
@@ -177,9 +178,9 @@ export const GroupSelect_propTypes = {
|
|
|
177
178
|
isDefaultSelectValue: PropTypes.bool,
|
|
178
179
|
customProps: PropTypes.shape({
|
|
179
180
|
TextBoxProps: PropTypes.object,
|
|
180
|
-
TextBoxIconProps: PropTypes.object
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
TextBoxIconProps: PropTypes.object
|
|
182
|
+
}),
|
|
183
|
+
allowValueFallback: PropTypes.bool
|
|
183
184
|
};
|
|
184
185
|
export const SelectWithAvatar_propTypes = { ...Select_propTypes,
|
|
185
186
|
textBoxClass: PropTypes.string,
|
|
@@ -240,10 +241,7 @@ export const SelectWithAvatar_propTypes = { ...Select_propTypes,
|
|
|
240
241
|
htmlId: PropTypes.string,
|
|
241
242
|
needEffect: PropTypes.bool,
|
|
242
243
|
isLoading: PropTypes.bool,
|
|
243
|
-
dataSelectorId: PropTypes.string
|
|
244
|
-
customProps: PropTypes.shape({
|
|
245
|
-
SuggestionsProps: PropTypes.object
|
|
246
|
-
})
|
|
244
|
+
dataSelectorId: PropTypes.string
|
|
247
245
|
};
|
|
248
246
|
export const SelectWithIcon_propTypes = {
|
|
249
247
|
animationStyle: PropTypes.oneOf(['default', 'bounce']),
|
|
@@ -305,7 +303,6 @@ export const SelectWithIcon_propTypes = {
|
|
|
305
303
|
customProps: PropTypes.shape({
|
|
306
304
|
TextBoxProps: PropTypes.object,
|
|
307
305
|
DropdownSearchTextBoxProps: PropTypes.object,
|
|
308
|
-
TextBoxIconProps: PropTypes.object
|
|
309
|
-
ListItemProps: PropTypes.object
|
|
306
|
+
TextBoxIconProps: PropTypes.object
|
|
310
307
|
})
|
|
311
308
|
};
|
|
@@ -40,6 +40,8 @@ const getDisabledOptions = props => props.disabledOptions || dummyArray;
|
|
|
40
40
|
|
|
41
41
|
const getListItemProps = props => props.listItemProps || '';
|
|
42
42
|
|
|
43
|
+
const getAllowValueFallback = props => props.allowValueFallback !== false;
|
|
44
|
+
|
|
43
45
|
export const makeGetMultiSelectFilterSuggestions = () => createSelector([getOptions, getSelectedOptionsSel, getSearchStr, getNeedSearch, getIsStartWithSearch, getKeepSelectedOptions], (options, selectedOptions, searchStr, needSearch, isStartsWithSearch, keepSelectedOptions) => {
|
|
44
46
|
const suggestions = [];
|
|
45
47
|
const suggestionIds = [];
|
|
@@ -105,7 +107,7 @@ export const extractOptionId = id => {
|
|
|
105
107
|
}
|
|
106
108
|
};
|
|
107
109
|
export const extractOptionIdFromJson = (id, localData) => localData[id] || {};
|
|
108
|
-
export const makeFormatOptions = () => createSelector([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps], (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps) => {
|
|
110
|
+
export const makeFormatOptions = () => createSelector([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps, getAllowValueFallback], (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps, allowValueFallback) => {
|
|
109
111
|
const revampOptions = [];
|
|
110
112
|
const remvampOptionIds = [];
|
|
111
113
|
const normalizedAllOptions = {};
|
|
@@ -123,7 +125,7 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
123
125
|
listItemProps: listStyle
|
|
124
126
|
} = option;
|
|
125
127
|
let id = typeof option === 'object' ? option[impValueField || valueField] : option;
|
|
126
|
-
const value = typeof option === 'object' ? option[impTextField || textField] : option;
|
|
128
|
+
const value = typeof option === 'object' ? option[impTextField || textField] : allowValueFallback ? option : '';
|
|
127
129
|
const photoURL = typeof option === 'object' ? option[impImageField || imageField] : ''; // grouping options (group select/MultiSelect)
|
|
128
130
|
|
|
129
131
|
id = !getIsEmptyValue(id) ? optionIdGrouping(id, prefixText) : '';
|
|
@@ -171,7 +173,7 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
171
173
|
optionsOrder: remvampOptionIds
|
|
172
174
|
};
|
|
173
175
|
});
|
|
174
|
-
export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelectedOptionsSel, getNormalizedFormatOptions, getSelectedOptionsLength], (selectedOptions, normalizedFormatOptions, selectedOptionsLength) => {
|
|
176
|
+
export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelectedOptionsSel, getNormalizedFormatOptions, getSelectedOptionsLength, getAllowValueFallback], (selectedOptions, normalizedFormatOptions, selectedOptionsLength, allowValueFallback) => {
|
|
175
177
|
const output = [];
|
|
176
178
|
const revampSelectedOptions = [];
|
|
177
179
|
const normalizedSelectedOptions = {};
|
|
@@ -187,7 +189,8 @@ export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelect
|
|
|
187
189
|
revampSelectedOptions.push(id);
|
|
188
190
|
output.push(normalizedFormatOptions[option]);
|
|
189
191
|
normalizedSelectedOptions[id] = normalizedFormatOptions[option];
|
|
190
|
-
} else if (getIsEmptyValue(id) && !getIsEmptyValue(option) && revampSelectedOptions.indexOf(option) === -1) {
|
|
192
|
+
} else if (allowValueFallback && getIsEmptyValue(id) && !getIsEmptyValue(option) && revampSelectedOptions.indexOf(option) === -1) {
|
|
193
|
+
//fallback case
|
|
191
194
|
const newObj = {
|
|
192
195
|
id: option,
|
|
193
196
|
value: option
|
|
@@ -261,7 +264,7 @@ export const makeObjectConcat = () => createSelector([getObj1, getObj2], (obj1,
|
|
|
261
264
|
const getGroupedOptions = props => props.groupedOptions || dummyArray;
|
|
262
265
|
|
|
263
266
|
const getFormatOptions = makeFormatOptions();
|
|
264
|
-
export const makeGetGroupSelectOptions = () => createSelector([getGroupedOptions], groupedOptions => {
|
|
267
|
+
export const makeGetGroupSelectOptions = () => createSelector([getGroupedOptions, getAllowValueFallback], (groupedOptions, allowValueFallback) => {
|
|
265
268
|
const revampedGroups = [];
|
|
266
269
|
let allOptionIds = [];
|
|
267
270
|
let allNormalizedOptions = {}; //all group normalized options
|
|
@@ -290,7 +293,8 @@ export const makeGetGroupSelectOptions = () => createSelector([getGroupedOptions
|
|
|
290
293
|
options,
|
|
291
294
|
valueField,
|
|
292
295
|
textField,
|
|
293
|
-
prefixText: groupId
|
|
296
|
+
prefixText: groupId,
|
|
297
|
+
allowValueFallback
|
|
294
298
|
});
|
|
295
299
|
|
|
296
300
|
if (optionsOrder.length) {
|
|
@@ -58,8 +58,7 @@ var ListContainer = function ListContainer(props) {
|
|
|
58
58
|
onClick = props.onClick,
|
|
59
59
|
onMouseEnter = props.onMouseEnter,
|
|
60
60
|
onMouseOver = props.onMouseOver,
|
|
61
|
-
eleRef = props.eleRef
|
|
62
|
-
align = props.align;
|
|
61
|
+
eleRef = props.eleRef;
|
|
63
62
|
var responsiveFunc = (0, _react.useCallback)(function (_ref) {
|
|
64
63
|
var mediaQueryOR = _ref.mediaQueryOR,
|
|
65
64
|
isTouchDevice = _ref.isTouchDevice;
|
|
@@ -103,7 +102,7 @@ var ListContainer = function ListContainer(props) {
|
|
|
103
102
|
"aria-selected": ariaSelected,
|
|
104
103
|
"aria-label": ariaLabel,
|
|
105
104
|
isCover: false,
|
|
106
|
-
align:
|
|
105
|
+
align: "vertical",
|
|
107
106
|
alignBox: "row",
|
|
108
107
|
className: "".concat(_ListItemModule["default"].list, " ").concat(_ListItemModule["default"][size], " ").concat(mobileToTab && isTouchDevice ? _ListItemModule["default"].responsiveHeight : '', " ").concat(_ListItemModule["default"][palette], " ").concat(active ? _ListItemModule["default"]["active".concat(palette)] : highlight && !isDisabled ? _ListItemModule["default"]["".concat(palette, "Hover")] : '', " ").concat(autoHover && !isDisabled ? _ListItemModule["default"]["".concat(palette, "Effect")] : '', " ").concat(needTick ? _ListItemModule["default"]["".concat(size, "withTick")] : '', " ").concat(isDisabled ? (0, _CssProvider["default"])('isDisable') : '', " ").concat(needBorder ? active ? _ListItemModule["default"].activewithBorder : _ListItemModule["default"].withBorder : '', " ").concat(customClass),
|
|
109
108
|
dataId: dataId,
|
package/lib/ListItem/ListItem.js
CHANGED
|
@@ -150,8 +150,7 @@ var ListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
150
150
|
autoHover: autoHover,
|
|
151
151
|
needTick: needTick,
|
|
152
152
|
needBorder: needBorder,
|
|
153
|
-
customClass:
|
|
154
|
-
align: needMultiLineText ? 'baseline' : 'vertical',
|
|
153
|
+
customClass: customListItem,
|
|
155
154
|
dataId: dataIdString,
|
|
156
155
|
dataSelectorId: "".concat(dataSelectorId),
|
|
157
156
|
isLink: isLink,
|
|
@@ -172,7 +171,7 @@ var ListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
172
171
|
adjust: true,
|
|
173
172
|
className: _ListItemModule["default"].children
|
|
174
173
|
}, children) : null, needTick && active ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
175
|
-
className: "".concat(_ListItemModule["default"].tickIcon, " ").concat(tickIconPalette, " ").concat(
|
|
174
|
+
className: "".concat(_ListItemModule["default"].tickIcon, " ").concat(tickIconPalette, " ").concat(customTickIcon),
|
|
176
175
|
"aria-hidden": ariaHidden,
|
|
177
176
|
dataId: "".concat(dataIdString, "_tickIcon"),
|
|
178
177
|
dataSelectorId: "".concat(dataSelectorId, "_tickIcon")
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
line-height: 1.5385;
|
|
74
74
|
}
|
|
75
75
|
.multiLineValue{
|
|
76
|
-
|
|
76
|
+
word-break: break-word;
|
|
77
|
+
composes: clamp from '../common/common.module.css'
|
|
77
78
|
}
|
|
78
79
|
.iconBox {
|
|
79
80
|
width: var(--zd_size20) ;
|
|
@@ -202,13 +203,3 @@
|
|
|
202
203
|
padding-top: var(--zd_size10) ;
|
|
203
204
|
padding-bottom: var(--zd_size10) ;
|
|
204
205
|
}
|
|
205
|
-
.autoHeight {
|
|
206
|
-
--listitem_height: auto;
|
|
207
|
-
}
|
|
208
|
-
.tickIconCenter {
|
|
209
|
-
top: 50% ;
|
|
210
|
-
transform: translateY(-50%);
|
|
211
|
-
}
|
|
212
|
-
.alignItemBaseline {
|
|
213
|
-
align-self: baseline;
|
|
214
|
-
}
|
|
@@ -162,7 +162,7 @@ var ListItemWithAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
162
162
|
autoHover: autoHover,
|
|
163
163
|
needTick: needTick,
|
|
164
164
|
needBorder: needBorder,
|
|
165
|
-
customClass:
|
|
165
|
+
customClass: customListItem,
|
|
166
166
|
dataId: "".concat(dataIdString, "_ListItemWithAvatar"),
|
|
167
167
|
dataSelectorId: "".concat(dataSelectorId),
|
|
168
168
|
onClick: this.handleClick,
|
|
@@ -172,7 +172,7 @@ var ListItemWithAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
172
172
|
title: null,
|
|
173
173
|
customProps: ListItemProps
|
|
174
174
|
}, ContainerProps), name || imgSrc ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
175
|
-
className:
|
|
175
|
+
className: _ListItemModule["default"].leftAvatar
|
|
176
176
|
}, isTeam ? /*#__PURE__*/_react["default"].createElement(_AvatarTeam["default"], _extends({
|
|
177
177
|
name: name,
|
|
178
178
|
size: "small",
|
|
@@ -199,7 +199,7 @@ var ListItemWithAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
199
199
|
"data-title": isDisabled ? null : title,
|
|
200
200
|
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value
|
|
201
201
|
}, value) : null, needTick && active ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
202
|
-
className:
|
|
202
|
+
className: _ListItemModule["default"].tickIcon,
|
|
203
203
|
"aria-hidden": ariaHidden,
|
|
204
204
|
dataId: "".concat(dataIdString, "_tickIcon"),
|
|
205
205
|
dataSelectorId: "".concat(dataSelectorId, "_tickIcon")
|
|
@@ -147,8 +147,7 @@ var ListItemWithIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
147
147
|
autoHover: autoHover,
|
|
148
148
|
needTick: needTick,
|
|
149
149
|
needBorder: needBorder,
|
|
150
|
-
customClass:
|
|
151
|
-
align: needMultiLineText && iconClass && !iconName ? 'baseline' : 'vertical',
|
|
150
|
+
customClass: customClass,
|
|
152
151
|
dataId: dataIdString,
|
|
153
152
|
dataSelectorId: dataSelectorId,
|
|
154
153
|
isLink: isLink,
|
|
@@ -177,7 +176,7 @@ var ListItemWithIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
177
176
|
"data-title": isDisabled ? null : title,
|
|
178
177
|
dataId: "".concat(dataIdString, "_Text")
|
|
179
178
|
}, value), needTick && active ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
180
|
-
className:
|
|
179
|
+
className: _ListItemModule["default"].tickIcon,
|
|
181
180
|
"aria-hidden": ariaHidden,
|
|
182
181
|
dataId: "".concat(dataIdString, "_tickIcon"),
|
|
183
182
|
dataSelectorId: "".concat(dataSelectorId, "_tickIcon")
|
|
@@ -18,8 +18,7 @@ var ListContainerDefaultProps = {
|
|
|
18
18
|
customClass: '',
|
|
19
19
|
customProps: {},
|
|
20
20
|
dataSelectorId: 'listContainer',
|
|
21
|
-
needMultiLineText: false
|
|
22
|
-
align: 'vertical'
|
|
21
|
+
needMultiLineText: false
|
|
23
22
|
};
|
|
24
23
|
exports.ListContainerDefaultProps = ListContainerDefaultProps;
|
|
25
24
|
var ListItemDefaultProps = {
|
|
@@ -43,8 +43,7 @@ var ListContainer_Props = {
|
|
|
43
43
|
}),
|
|
44
44
|
customClass: _propTypes["default"].string,
|
|
45
45
|
customProps: _propTypes["default"].object,
|
|
46
|
-
eleRef: _propTypes["default"].func
|
|
47
|
-
align: _propTypes["default"].string
|
|
46
|
+
eleRef: _propTypes["default"].func
|
|
48
47
|
};
|
|
49
48
|
exports.ListContainer_Props = ListContainer_Props;
|
|
50
49
|
var ListItem_Props = {
|
|
@@ -53,8 +53,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
53
53
|
|
|
54
54
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
55
55
|
|
|
56
|
-
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); }
|
|
57
|
-
|
|
58
56
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
59
57
|
|
|
60
58
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -201,11 +199,13 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
201
199
|
key: "handleFormatSelectedOptions",
|
|
202
200
|
value: function handleFormatSelectedOptions(selectedOptionDetails, props) {
|
|
203
201
|
var valueField = props.valueField,
|
|
204
|
-
textField = props.textField
|
|
202
|
+
textField = props.textField,
|
|
203
|
+
allowValueFallback = props.allowValueFallback;
|
|
205
204
|
return this.formatSelectedOptions({
|
|
206
205
|
options: selectedOptionDetails,
|
|
207
206
|
valueField: valueField,
|
|
208
|
-
textField: textField
|
|
207
|
+
textField: textField,
|
|
208
|
+
allowValueFallback: allowValueFallback
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
}, {
|
|
@@ -266,6 +266,7 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
266
266
|
}, {
|
|
267
267
|
key: "handleSelectedOptionIdChange",
|
|
268
268
|
value: function handleSelectedOptionIdChange(selectedGroupOptions, normalizedFormatOptions, normalizedSelectedOptions) {
|
|
269
|
+
var allowValueFallback = this.props.allowValueFallback;
|
|
269
270
|
var newSelectedOptions = selectedGroupOptions.map(function (option) {
|
|
270
271
|
return (0, _dropDownUtils.optionIdGrouping)(option.id, option.groupId);
|
|
271
272
|
});
|
|
@@ -277,7 +278,8 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
277
278
|
return this.getSelectedOptions({
|
|
278
279
|
selectedOptions: newSelectedOptions,
|
|
279
280
|
normalizedFormatOptions: formatOptions,
|
|
280
|
-
selectedOptionsLength: selectedOptionsLength
|
|
281
|
+
selectedOptionsLength: selectedOptionsLength,
|
|
282
|
+
allowValueFallback: allowValueFallback
|
|
281
283
|
});
|
|
282
284
|
}
|
|
283
285
|
}, {
|
|
@@ -324,10 +326,12 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
324
326
|
}, {
|
|
325
327
|
key: "handleGetGroupSelectOptions",
|
|
326
328
|
value: function handleGetGroupSelectOptions(props) {
|
|
327
|
-
var
|
|
329
|
+
var allowValueFallback = props.allowValueFallback,
|
|
330
|
+
_props$groupedOptions = props.groupedOptions,
|
|
328
331
|
groupedOptions = _props$groupedOptions === void 0 ? [] : _props$groupedOptions;
|
|
329
332
|
return this.getGroupSelectOptions({
|
|
330
|
-
groupedOptions: groupedOptions
|
|
333
|
+
groupedOptions: groupedOptions,
|
|
334
|
+
allowValueFallback: allowValueFallback
|
|
331
335
|
});
|
|
332
336
|
}
|
|
333
337
|
}, {
|
|
@@ -968,10 +972,7 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
968
972
|
needEffect = _this$props8.needEffect,
|
|
969
973
|
autoComplete = _this$props8.autoComplete,
|
|
970
974
|
getTargetRef = _this$props8.getTargetRef,
|
|
971
|
-
isFocus = _this$props8.isFocus
|
|
972
|
-
customProps = _this$props8.customProps;
|
|
973
|
-
var _customProps$Suggesti = customProps.SuggestionsProps,
|
|
974
|
-
SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti;
|
|
975
|
+
isFocus = _this$props8.isFocus;
|
|
975
976
|
var _i18nKeys = i18nKeys,
|
|
976
977
|
_i18nKeys$clearText = _i18nKeys.clearText,
|
|
977
978
|
clearText = _i18nKeys$clearText === void 0 ? 'Clear all' : _i18nKeys$clearText;
|
|
@@ -1135,7 +1136,7 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
1135
1136
|
a11y: {
|
|
1136
1137
|
role: 'heading'
|
|
1137
1138
|
}
|
|
1138
|
-
})), /*#__PURE__*/_react["default"].createElement(_Suggestions["default"],
|
|
1139
|
+
})), /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
1139
1140
|
suggestions: suggestions,
|
|
1140
1141
|
selectedOptions: selectedOptionIds,
|
|
1141
1142
|
getRef: _this5.suggestionItemRef,
|
|
@@ -1148,7 +1149,7 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
1148
1149
|
role: 'option'
|
|
1149
1150
|
},
|
|
1150
1151
|
dataId: "".concat(dataId, "_Options")
|
|
1151
|
-
}
|
|
1152
|
+
}));
|
|
1152
1153
|
}) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
1153
1154
|
options: revampedGroups,
|
|
1154
1155
|
searchString: searchStr,
|
|
@@ -218,7 +218,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
218
218
|
iconSize = props.iconSize,
|
|
219
219
|
prefixText = props.prefixText,
|
|
220
220
|
optionType = props.optionType,
|
|
221
|
-
disabledOptions = props.disabledOptions
|
|
221
|
+
disabledOptions = props.disabledOptions,
|
|
222
|
+
allowValueFallback = props.allowValueFallback;
|
|
222
223
|
return this.formatOptions({
|
|
223
224
|
options: options,
|
|
224
225
|
valueField: valueField,
|
|
@@ -228,7 +229,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
228
229
|
prefixText: prefixText,
|
|
229
230
|
optionType: optionType,
|
|
230
231
|
iconSize: iconSize,
|
|
231
|
-
disabledOptions: disabledOptions
|
|
232
|
+
disabledOptions: disabledOptions,
|
|
233
|
+
allowValueFallback: allowValueFallback
|
|
232
234
|
});
|
|
233
235
|
}
|
|
234
236
|
}, {
|
|
@@ -239,7 +241,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
239
241
|
showedSelectedOptionsCount = _ref.showedSelectedOptionsCount;
|
|
240
242
|
|
|
241
243
|
var selectedOptionsLimit = props.selectedOptionsLimit,
|
|
242
|
-
selectedOptionDetails = props.selectedOptionDetails
|
|
244
|
+
selectedOptionDetails = props.selectedOptionDetails,
|
|
245
|
+
allowValueFallback = props.allowValueFallback;
|
|
243
246
|
showedSelectedOptionsCount = (0, _Common.getIsEmptyValue)(showedSelectedOptionsCount) ? selectedOptionsLimit : showedSelectedOptionsCount;
|
|
244
247
|
|
|
245
248
|
var _this$handleFormatSel = this.handleFormatSelectedOptions(selectedOptionDetails, props),
|
|
@@ -252,7 +255,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
252
255
|
return this.getSelectedOptions({
|
|
253
256
|
selectedOptions: selectedOptions,
|
|
254
257
|
normalizedFormatOptions: formatOptions,
|
|
255
|
-
selectedOptionsLength: showedSelectedOptionsCount
|
|
258
|
+
selectedOptionsLength: showedSelectedOptionsCount,
|
|
259
|
+
allowValueFallback: allowValueFallback
|
|
256
260
|
});
|
|
257
261
|
}
|
|
258
262
|
}, {
|
|
@@ -264,7 +268,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
264
268
|
optionType = props.optionType,
|
|
265
269
|
iconName = props.iconName,
|
|
266
270
|
iconSize = props.iconSize,
|
|
267
|
-
disabledOptions = props.disabledOptions
|
|
271
|
+
disabledOptions = props.disabledOptions,
|
|
272
|
+
allowValueFallback = props.allowValueFallback;
|
|
268
273
|
return this.formatSelectedOptions({
|
|
269
274
|
options: selectedOptionDetails,
|
|
270
275
|
valueField: valueField,
|
|
@@ -273,7 +278,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
273
278
|
optionType: optionType,
|
|
274
279
|
iconName: iconName,
|
|
275
280
|
iconSize: iconSize,
|
|
276
|
-
disabledOptions: disabledOptions
|
|
281
|
+
disabledOptions: disabledOptions,
|
|
282
|
+
allowValueFallback: allowValueFallback
|
|
277
283
|
});
|
|
278
284
|
}
|
|
279
285
|
}, {
|
|
@@ -299,22 +299,26 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
299
299
|
valueField = props.valueField,
|
|
300
300
|
textField = props.textField,
|
|
301
301
|
prefixText = props.prefixText,
|
|
302
|
-
disabledOptions = props.disabledOptions
|
|
302
|
+
disabledOptions = props.disabledOptions,
|
|
303
|
+
allowValueFallback = props.allowValueFallback;
|
|
303
304
|
return this.formatOptions({
|
|
304
305
|
options: options,
|
|
305
306
|
valueField: valueField,
|
|
306
307
|
textField: textField,
|
|
307
308
|
prefixText: prefixText,
|
|
308
309
|
optionType: 'default',
|
|
309
|
-
disabledOptions: disabledOptions
|
|
310
|
+
disabledOptions: disabledOptions,
|
|
311
|
+
allowValueFallback: allowValueFallback
|
|
310
312
|
});
|
|
311
313
|
}
|
|
312
314
|
}, {
|
|
313
315
|
key: "handleGetSelectedOptions",
|
|
314
|
-
value: function handleGetSelectedOptions(selectedOptions, normalizedFormatOptions) {
|
|
316
|
+
value: function handleGetSelectedOptions(selectedOptions, normalizedFormatOptions, props) {
|
|
317
|
+
var allowValueFallback = props.allowValueFallback;
|
|
315
318
|
return this.getSelectedOptions({
|
|
316
319
|
selectedOptions: selectedOptions,
|
|
317
|
-
normalizedFormatOptions: normalizedFormatOptions
|
|
320
|
+
normalizedFormatOptions: normalizedFormatOptions,
|
|
321
|
+
allowValueFallback: allowValueFallback
|
|
318
322
|
});
|
|
319
323
|
}
|
|
320
324
|
}, {
|
|
@@ -1089,10 +1093,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1089
1093
|
boxSize = _this$props15.boxSize,
|
|
1090
1094
|
isLoading = _this$props15.isLoading,
|
|
1091
1095
|
selectAllText = _this$props15.selectAllText,
|
|
1092
|
-
needSelectAll = _this$props15.needSelectAll
|
|
1093
|
-
customProps = _this$props15.customProps;
|
|
1094
|
-
var _customProps$Suggesti = customProps.SuggestionsProps,
|
|
1095
|
-
SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti;
|
|
1096
|
+
needSelectAll = _this$props15.needSelectAll;
|
|
1096
1097
|
var _this$state9 = this.state,
|
|
1097
1098
|
selectedOptions = _this$state9.selectedOptions,
|
|
1098
1099
|
searchStr = _this$state9.searchStr,
|
|
@@ -1169,7 +1170,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1169
1170
|
eleRef: this.suggestionContainerRef
|
|
1170
1171
|
}, isSearching ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1171
1172
|
className: _MultiSelectModule["default"][palette]
|
|
1172
|
-
}, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"],
|
|
1173
|
+
}, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
1173
1174
|
suggestions: suggestions,
|
|
1174
1175
|
getRef: this.suggestionItemRef,
|
|
1175
1176
|
hoverOption: hoverOption,
|
|
@@ -1182,7 +1183,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1182
1183
|
a11y: {
|
|
1183
1184
|
role: 'option'
|
|
1184
1185
|
}
|
|
1185
|
-
}
|
|
1186
|
+
}) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
1186
1187
|
isLoading: isFetchingOptions,
|
|
1187
1188
|
options: options,
|
|
1188
1189
|
searchString: searchStr,
|
|
@@ -99,14 +99,16 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
99
99
|
valueField = props.valueField,
|
|
100
100
|
textField = props.textField,
|
|
101
101
|
imageField = props.imageField,
|
|
102
|
-
disabledOptions = props.disabledOptions
|
|
102
|
+
disabledOptions = props.disabledOptions,
|
|
103
|
+
allowValueFallback = props.allowValueFallback;
|
|
103
104
|
return this.formatOptions({
|
|
104
105
|
options: options,
|
|
105
106
|
valueField: valueField,
|
|
106
107
|
textField: textField,
|
|
107
108
|
imageField: imageField,
|
|
108
109
|
optionType: 'avatar',
|
|
109
|
-
disabledOptions: disabledOptions
|
|
110
|
+
disabledOptions: disabledOptions,
|
|
111
|
+
allowValueFallback: allowValueFallback
|
|
110
112
|
});
|
|
111
113
|
}
|
|
112
114
|
}, {
|
|
@@ -83,20 +83,15 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
83
83
|
avatarPalette = _this$props.avatarPalette,
|
|
84
84
|
palette = _this$props.palette,
|
|
85
85
|
htmlId = _this$props.htmlId,
|
|
86
|
-
a11y = _this$props.a11y
|
|
87
|
-
customClass = _this$props.customClass,
|
|
88
|
-
needMultiLineText = _this$props.needMultiLineText;
|
|
86
|
+
a11y = _this$props.a11y;
|
|
89
87
|
var ariaParentRole = a11y.ariaParentRole,
|
|
90
88
|
ariaMultiselectable = a11y.ariaMultiselectable;
|
|
91
|
-
var _customClass$containe = customClass.containerClass,
|
|
92
|
-
containerClass = _customClass$containe === void 0 ? '' : _customClass$containe;
|
|
93
89
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
94
90
|
isCover: false,
|
|
95
91
|
role: ariaParentRole,
|
|
96
92
|
id: htmlId,
|
|
97
93
|
tabindex: "0",
|
|
98
|
-
"aria-multiselectable": ariaMultiselectable
|
|
99
|
-
className: containerClass
|
|
94
|
+
"aria-multiselectable": ariaMultiselectable
|
|
100
95
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
101
96
|
dataId: "".concat(dataId),
|
|
102
97
|
className: className ? className : ''
|
|
@@ -120,8 +115,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
120
115
|
});
|
|
121
116
|
|
|
122
117
|
var commonProps = _objectSpread({
|
|
123
|
-
isDisabled: isDisabled
|
|
124
|
-
needMultiLineText: needMultiLineText
|
|
118
|
+
isDisabled: isDisabled
|
|
125
119
|
}, listItemCustomProps);
|
|
126
120
|
|
|
127
121
|
if (listItemProps) {
|
|
@@ -17,4 +17,32 @@ describe('AdvancedMultiSelect', function () {
|
|
|
17
17
|
|
|
18
18
|
expect(asFragment()).toMatchSnapshot();
|
|
19
19
|
});
|
|
20
|
+
var options = [{
|
|
21
|
+
id: 1,
|
|
22
|
+
text: 'Apple'
|
|
23
|
+
}, {
|
|
24
|
+
id: 2,
|
|
25
|
+
text: 'Orange'
|
|
26
|
+
}, 'string test'];
|
|
27
|
+
test('rendering the options array with objects and string', function () {
|
|
28
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AdvancedMultiSelect["default"], {
|
|
29
|
+
isPopupOpen: true,
|
|
30
|
+
isPopupReady: true,
|
|
31
|
+
options: options
|
|
32
|
+
})),
|
|
33
|
+
asFragment = _render2.asFragment;
|
|
34
|
+
|
|
35
|
+
expect(asFragment()).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
test('rendering the options array with only objects using allowValueFallback', function () {
|
|
38
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AdvancedMultiSelect["default"], {
|
|
39
|
+
isPopupOpen: true,
|
|
40
|
+
isPopupReady: true,
|
|
41
|
+
options: options,
|
|
42
|
+
allowValueFallback: false
|
|
43
|
+
})),
|
|
44
|
+
asFragment = _render3.asFragment;
|
|
45
|
+
|
|
46
|
+
expect(asFragment()).toMatchSnapshot();
|
|
47
|
+
});
|
|
20
48
|
});
|