@zohodesk/components 1.2.62 → 1.3.0
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/config/variables/variableMapping.json +7 -0
- package/.cli/propValidation_report.html +1 -1
- package/README.md +13 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +1 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +1 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +1 -0
- package/es/ListItem/ListContainer.js +3 -2
- package/es/ListItem/ListItem.module.css +52 -6
- package/es/ListItem/ListItemWithAvatar.js +17 -6
- package/es/ListItem/ListItemWithCheckBox.js +18 -6
- package/es/ListItem/ListItemWithIcon.js +20 -7
- package/es/ListItem/ListItemWithRadio.js +19 -6
- package/es/ListItem/__tests__/ListContainer.spec.js +8 -0
- package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +35 -0
- package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +35 -0
- package/es/ListItem/__tests__/ListItemWithIcon.spec.js +35 -0
- package/es/ListItem/__tests__/ListItemWithRadio.spec.js +35 -0
- package/es/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +13 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +200 -2
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +451 -30
- package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +202 -4
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +447 -30
- package/es/ListItem/props/defaultProps.js +13 -5
- package/es/ListItem/props/propTypes.js +13 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +12 -4
- package/es/MultiSelect/AdvancedMultiSelect.js +20 -8
- package/es/MultiSelect/MultiSelect.js +16 -6
- package/es/MultiSelect/MultiSelect.module.css +9 -1
- package/es/MultiSelect/MultiSelectWithAvatar.js +8 -2
- package/es/MultiSelect/Suggestions.js +5 -2
- package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +28 -0
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +390 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +34 -13
- package/es/MultiSelect/props/defaultProps.js +8 -4
- package/es/MultiSelect/props/propTypes.js +7 -2
- package/es/Radio/props/propTypes.js +1 -1
- package/es/Select/GroupSelect.js +4 -2
- package/es/Select/Select.js +3 -1
- package/es/Select/SelectWithAvatar.js +4 -2
- package/es/Select/props/defaultProps.js +4 -2
- package/es/Select/props/propTypes.js +4 -2
- package/es/common/common.module.css +10 -0
- package/es/utils/dropDownUtils.js +42 -13
- package/es/v1/Radio/props/propTypes.js +1 -1
- package/lib/ListItem/ListContainer.js +3 -2
- package/lib/ListItem/ListItem.module.css +52 -6
- package/lib/ListItem/ListItemWithAvatar.js +16 -5
- package/lib/ListItem/ListItemWithCheckBox.js +17 -5
- package/lib/ListItem/ListItemWithIcon.js +19 -6
- package/lib/ListItem/ListItemWithRadio.js +18 -5
- package/lib/ListItem/__tests__/ListContainer.spec.js +8 -0
- package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +35 -0
- package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +35 -0
- package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +35 -0
- package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +35 -0
- package/lib/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +13 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +200 -2
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +451 -30
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +202 -4
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +447 -30
- package/lib/ListItem/props/defaultProps.js +13 -5
- package/lib/ListItem/props/propTypes.js +12 -2
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +11 -5
- package/lib/MultiSelect/AdvancedMultiSelect.js +86 -73
- package/lib/MultiSelect/MultiSelect.js +14 -6
- package/lib/MultiSelect/MultiSelect.module.css +9 -1
- package/lib/MultiSelect/MultiSelectWithAvatar.js +8 -2
- package/lib/MultiSelect/Suggestions.js +5 -2
- package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +28 -0
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +390 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +34 -13
- package/lib/MultiSelect/props/defaultProps.js +8 -4
- package/lib/MultiSelect/props/propTypes.js +7 -3
- package/lib/Radio/props/propTypes.js +1 -1
- package/lib/Select/GroupSelect.js +4 -2
- package/lib/Select/Select.js +3 -1
- package/lib/Select/SelectWithAvatar.js +4 -2
- package/lib/Select/props/defaultProps.js +4 -2
- package/lib/Select/props/propTypes.js +4 -2
- package/lib/common/common.module.css +10 -0
- package/lib/utils/dropDownUtils.js +52 -16
- package/lib/v1/Radio/props/propTypes.js +1 -1
- package/package.json +6 -6
- package/result.json +1 -1
|
@@ -37,7 +37,8 @@ export const AdvancedGroupMultiSelect_defaultProps = {
|
|
|
37
37
|
needEffect: true,
|
|
38
38
|
palette: 'default',
|
|
39
39
|
isLoading: false,
|
|
40
|
-
dataSelectorId: 'advancedGroupMultiSelect'
|
|
40
|
+
dataSelectorId: 'advancedGroupMultiSelect',
|
|
41
|
+
allowValueFallback: true
|
|
41
42
|
};
|
|
42
43
|
export const AdvancedMultiSelect_defaultProps = {
|
|
43
44
|
animationStyle: 'bounce',
|
|
@@ -71,7 +72,8 @@ export const AdvancedMultiSelect_defaultProps = {
|
|
|
71
72
|
dataSelectorId: 'advancedMultiSelect',
|
|
72
73
|
customClass: {},
|
|
73
74
|
isAbsolutePositioningNeeded: true,
|
|
74
|
-
isRestrictScroll: false
|
|
75
|
+
isRestrictScroll: false,
|
|
76
|
+
allowValueFallback: true
|
|
75
77
|
};
|
|
76
78
|
export const EmptyState_defaultProps = {
|
|
77
79
|
dataId: 'empty',
|
|
@@ -118,7 +120,8 @@ export const MultiSelect_defaultProps = {
|
|
|
118
120
|
selectedOptionsCount: 0,
|
|
119
121
|
cardHeaderName: '',
|
|
120
122
|
needResponsive: true,
|
|
121
|
-
customProps: {}
|
|
123
|
+
customProps: {},
|
|
124
|
+
allowValueFallback: true
|
|
122
125
|
};
|
|
123
126
|
export const MultiSelectHeader_defaultProps = {
|
|
124
127
|
dataId: 'MultiSelectHeader'
|
|
@@ -155,7 +158,8 @@ export const MultiSelectWithAvatar_defaultProps = {
|
|
|
155
158
|
dataSelectorId: 'multiSelectWithAvatar',
|
|
156
159
|
keepSelectedOptions: false,
|
|
157
160
|
customProps: {},
|
|
158
|
-
needResponsive: true
|
|
161
|
+
needResponsive: true,
|
|
162
|
+
allowValueFallback: true
|
|
159
163
|
};
|
|
160
164
|
export const SelectedOptions_defaultProps = {
|
|
161
165
|
size: 'medium',
|
|
@@ -46,6 +46,7 @@ export const MultiSelect_propTypes = {
|
|
|
46
46
|
a11y: PropTypes.shape({
|
|
47
47
|
clearLabel: PropTypes.string
|
|
48
48
|
}),
|
|
49
|
+
searchFields: PropTypes.arrayOf(PropTypes.string),
|
|
49
50
|
isAnimate: PropTypes.bool,
|
|
50
51
|
isBoxPaddingNeed: PropTypes.bool,
|
|
51
52
|
isDisabled: PropTypes.bool,
|
|
@@ -112,7 +113,8 @@ export const MultiSelect_propTypes = {
|
|
|
112
113
|
customProps: PropTypes.shape({
|
|
113
114
|
TextBoxIconProps: PropTypes.object
|
|
114
115
|
}),
|
|
115
|
-
isFocus: PropTypes.bool
|
|
116
|
+
isFocus: PropTypes.bool,
|
|
117
|
+
allowValueFallback: PropTypes.bool
|
|
116
118
|
};
|
|
117
119
|
export const MultiSelectHeader_propTypes = {
|
|
118
120
|
dataId: PropTypes.string,
|
|
@@ -131,6 +133,7 @@ export const MultiSelectWithAvatar_propTypes = {
|
|
|
131
133
|
SuggestionsProps: PropTypes.object,
|
|
132
134
|
DropBoxProps: PropTypes.object
|
|
133
135
|
}),
|
|
136
|
+
secondaryField: PropTypes.string,
|
|
134
137
|
...MultiSelect_propTypes
|
|
135
138
|
};
|
|
136
139
|
export const SelectedOptions_propTypes = {
|
|
@@ -248,7 +251,8 @@ export const AdvancedGroupMultiSelect_propTypes = {
|
|
|
248
251
|
searchStr: PropTypes.string,
|
|
249
252
|
children: PropTypes.node,
|
|
250
253
|
dataSelectorId: PropTypes.string,
|
|
251
|
-
isFocus: PropTypes.bool
|
|
254
|
+
isFocus: PropTypes.bool,
|
|
255
|
+
allowValueFallback: PropTypes.bool
|
|
252
256
|
};
|
|
253
257
|
export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
254
258
|
selectedOptionDetails: PropTypes.string,
|
|
@@ -279,6 +283,7 @@ export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
|
279
283
|
//For grouping multiSelect
|
|
280
284
|
optionType: PropTypes.oneOf(['default', 'avatar', 'icon']),
|
|
281
285
|
needEffect: PropTypes.bool,
|
|
286
|
+
secondaryField: PropTypes.string,
|
|
282
287
|
animationStyle: PropTypes.string,
|
|
283
288
|
defaultDropBoxPosition: PropTypes.oneOf(['bottom', 'top', 'left', 'right']),
|
|
284
289
|
dropBoxSize: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
@@ -29,7 +29,7 @@ export const propTypes = {
|
|
|
29
29
|
ariaChecked: PropTypes.bool,
|
|
30
30
|
ariaHidden: PropTypes.bool,
|
|
31
31
|
role: PropTypes.string,
|
|
32
|
-
tabIndex: PropTypes.oneOfType(PropTypes.string, PropTypes.number),
|
|
32
|
+
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
33
33
|
ariaLabelledby: PropTypes.string,
|
|
34
34
|
ariaLabel: PropTypes.string,
|
|
35
35
|
ariaReadonly: PropTypes.bool
|
package/es/Select/GroupSelect.js
CHANGED
|
@@ -170,10 +170,12 @@ export class GroupSelectComponent extends PureComponent {
|
|
|
170
170
|
|
|
171
171
|
handleGetGroupSelectOptions(props) {
|
|
172
172
|
let {
|
|
173
|
-
groupedOptions
|
|
173
|
+
groupedOptions,
|
|
174
|
+
allowValueFallback
|
|
174
175
|
} = props;
|
|
175
176
|
return this.getGroupSelectOptions({
|
|
176
|
-
groupedOptions
|
|
177
|
+
groupedOptions,
|
|
178
|
+
allowValueFallback
|
|
177
179
|
});
|
|
178
180
|
}
|
|
179
181
|
|
package/es/Select/Select.js
CHANGED
|
@@ -250,6 +250,7 @@ export class SelectComponent extends Component {
|
|
|
250
250
|
options,
|
|
251
251
|
valueField,
|
|
252
252
|
textField,
|
|
253
|
+
allowValueFallback,
|
|
253
254
|
customProps = {}
|
|
254
255
|
} = props;
|
|
255
256
|
let {
|
|
@@ -259,7 +260,8 @@ export class SelectComponent extends Component {
|
|
|
259
260
|
options,
|
|
260
261
|
valueField,
|
|
261
262
|
textField,
|
|
262
|
-
listItemProps
|
|
263
|
+
listItemProps,
|
|
264
|
+
allowValueFallback
|
|
263
265
|
});
|
|
264
266
|
}
|
|
265
267
|
|
|
@@ -40,14 +40,16 @@ class SelectWithAvatarComponent extends SelectComponent {
|
|
|
40
40
|
options,
|
|
41
41
|
valueField,
|
|
42
42
|
textField,
|
|
43
|
-
imageField
|
|
43
|
+
imageField,
|
|
44
|
+
allowValueFallback
|
|
44
45
|
} = props;
|
|
45
46
|
return this.formatOptions({
|
|
46
47
|
options,
|
|
47
48
|
valueField,
|
|
48
49
|
textField,
|
|
49
50
|
imageField,
|
|
50
|
-
optionType: 'avatar'
|
|
51
|
+
optionType: 'avatar',
|
|
52
|
+
allowValueFallback
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
|
|
@@ -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',
|
|
@@ -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({
|
|
@@ -178,7 +179,8 @@ export const GroupSelect_propTypes = {
|
|
|
178
179
|
customProps: PropTypes.shape({
|
|
179
180
|
TextBoxProps: PropTypes.object,
|
|
180
181
|
TextBoxIconProps: PropTypes.object
|
|
181
|
-
})
|
|
182
|
+
}),
|
|
183
|
+
allowValueFallback: PropTypes.bool
|
|
182
184
|
};
|
|
183
185
|
export const SelectWithAvatar_propTypes = { ...Select_propTypes,
|
|
184
186
|
textBoxClass: PropTypes.string,
|
|
@@ -260,6 +260,12 @@
|
|
|
260
260
|
justify-content: space-between;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
.justifyFstart {
|
|
264
|
+
-webkit-box-pack: flex-start;
|
|
265
|
+
-ms-flex-pack: flex-start;
|
|
266
|
+
justify-content: flex-start;
|
|
267
|
+
}
|
|
268
|
+
|
|
263
269
|
.justifyFend {
|
|
264
270
|
-webkit-box-pack: flex-end;
|
|
265
271
|
-ms-flex-pack: flex-end;
|
|
@@ -493,6 +499,10 @@
|
|
|
493
499
|
display: -webkit-box;
|
|
494
500
|
overflow: hidden;
|
|
495
501
|
}
|
|
502
|
+
.lineClamp {
|
|
503
|
+
composes: wbreak clamp;
|
|
504
|
+
-webkit-line-clamp: var(--line-clamp,2);
|
|
505
|
+
}
|
|
496
506
|
|
|
497
507
|
.offSelection {
|
|
498
508
|
-webkit-user-select: none;
|
|
@@ -12,6 +12,7 @@ const getSelectedOptionsSel = props => props.selectedOptions || dummyArray;
|
|
|
12
12
|
const getSearchStr = props => props.searchStr || '';
|
|
13
13
|
|
|
14
14
|
export const getValueField = props => props.valueField || '';
|
|
15
|
+
export const getSecondaryField = props => props.secondaryField || '';
|
|
15
16
|
export const getTextField = props => props.textField || '';
|
|
16
17
|
export const getImageField = props => props.imageField || '';
|
|
17
18
|
export const getIconName = props => props.iconName || '';
|
|
@@ -40,21 +41,36 @@ const getDisabledOptions = props => props.disabledOptions || dummyArray;
|
|
|
40
41
|
|
|
41
42
|
const getListItemProps = props => props.listItemProps || '';
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
const getSearchFields = props => {
|
|
45
|
+
return props.searchFields || ['value'];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const isObjectContainsSearchString = function () {
|
|
49
|
+
let searchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
50
|
+
let searchStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
51
|
+
let obj = arguments.length > 2 ? arguments[2] : undefined;
|
|
52
|
+
const matchedFields = searchFields.filter(element => {
|
|
53
|
+
return getSearchString(obj[element]).indexOf(searchStr) !== -1;
|
|
54
|
+
});
|
|
55
|
+
return matchedFields.length !== 0;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const getAllowValueFallback = props => props.allowValueFallback !== false;
|
|
59
|
+
|
|
60
|
+
export const makeGetMultiSelectFilterSuggestions = () => createSelector([getOptions, getSelectedOptionsSel, getSearchStr, getNeedSearch, getIsStartWithSearch, getKeepSelectedOptions, getSearchFields], (options, selectedOptions, searchStr, needSearch, isStartsWithSearch, keepSelectedOptions, searchFields) => {
|
|
44
61
|
const suggestions = [];
|
|
45
62
|
const suggestionIds = [];
|
|
46
63
|
options.forEach(option => {
|
|
64
|
+
const searchString = getSearchString(searchStr);
|
|
47
65
|
const {
|
|
48
|
-
id,
|
|
49
66
|
value = ''
|
|
50
67
|
} = option;
|
|
51
68
|
const valueString = getSearchString(value);
|
|
52
|
-
const
|
|
53
|
-
const isMatch = needSearch ? isStartsWithSearch ? valueString.startsWith(searchString) : valueString.indexOf(searchString) !== -1 : true;
|
|
69
|
+
const isMatch = needSearch ? isStartsWithSearch ? valueString.startsWith(searchString) : isObjectContainsSearchString(searchFields, searchString, option) : true;
|
|
54
70
|
|
|
55
|
-
if (selectedOptions.indexOf(id) === -1 && isMatch || keepSelectedOptions) {
|
|
71
|
+
if (selectedOptions.indexOf(option.id) === -1 && isMatch || keepSelectedOptions) {
|
|
56
72
|
suggestions.push(option);
|
|
57
|
-
suggestionIds.push(id);
|
|
73
|
+
suggestionIds.push(option.id);
|
|
58
74
|
}
|
|
59
75
|
});
|
|
60
76
|
return {
|
|
@@ -105,7 +121,7 @@ export const extractOptionId = id => {
|
|
|
105
121
|
}
|
|
106
122
|
};
|
|
107
123
|
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) => {
|
|
124
|
+
export const makeFormatOptions = () => createSelector([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps, getAllowValueFallback, getSearchFields, getSecondaryField], (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps, allowValueFallback, searchFields, secondaryField) => {
|
|
109
125
|
const revampOptions = [];
|
|
110
126
|
const remvampOptionIds = [];
|
|
111
127
|
const normalizedAllOptions = {};
|
|
@@ -117,22 +133,33 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
117
133
|
valueField: impValueField,
|
|
118
134
|
textField: impTextField,
|
|
119
135
|
imageField: impImageField,
|
|
136
|
+
secondaryField: impSecondaryField,
|
|
120
137
|
optionType: impOptionType,
|
|
121
138
|
iconName: impIconName,
|
|
122
139
|
iconSize: impIconSize,
|
|
123
140
|
listItemProps: listStyle
|
|
124
141
|
} = option;
|
|
125
142
|
let id = typeof option === 'object' ? option[impValueField || valueField] : option;
|
|
126
|
-
const value = typeof option === 'object' ? option[impTextField || textField] : option;
|
|
143
|
+
const value = typeof option === 'object' ? option[impTextField || textField] : allowValueFallback ? option : '';
|
|
144
|
+
const secondaryValue = typeof option === 'object' ? option[impSecondaryField || secondaryField] : '';
|
|
127
145
|
const photoURL = typeof option === 'object' ? option[impImageField || imageField] : ''; // grouping options (group select/MultiSelect)
|
|
128
146
|
|
|
129
147
|
id = !getIsEmptyValue(id) ? optionIdGrouping(id, prefixText) : '';
|
|
148
|
+
const additionalSearchFieldData = searchFields.reduce((value, item) => {
|
|
149
|
+
if (typeof option === 'object' && option.hasOwnProperty(item)) {
|
|
150
|
+
value[item] = option[item];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return value;
|
|
154
|
+
}, {});
|
|
130
155
|
|
|
131
156
|
if (remvampOptionIds.indexOf(id) === -1 && !getIsEmptyValue(id) && !getIsEmptyValue(value)) {
|
|
132
157
|
remvampOptionIds.push(id);
|
|
133
|
-
const optionDetails = {
|
|
158
|
+
const optionDetails = { // ...option,
|
|
159
|
+
...additionalSearchFieldData,
|
|
134
160
|
id,
|
|
135
161
|
value,
|
|
162
|
+
secondaryValue,
|
|
136
163
|
optionType: impOptionType || optionType
|
|
137
164
|
};
|
|
138
165
|
|
|
@@ -171,7 +198,7 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
171
198
|
optionsOrder: remvampOptionIds
|
|
172
199
|
};
|
|
173
200
|
});
|
|
174
|
-
export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelectedOptionsSel, getNormalizedFormatOptions, getSelectedOptionsLength], (selectedOptions, normalizedFormatOptions, selectedOptionsLength) => {
|
|
201
|
+
export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelectedOptionsSel, getNormalizedFormatOptions, getSelectedOptionsLength, getAllowValueFallback], (selectedOptions, normalizedFormatOptions, selectedOptionsLength, allowValueFallback) => {
|
|
175
202
|
const output = [];
|
|
176
203
|
const revampSelectedOptions = [];
|
|
177
204
|
const normalizedSelectedOptions = {};
|
|
@@ -187,7 +214,8 @@ export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelect
|
|
|
187
214
|
revampSelectedOptions.push(id);
|
|
188
215
|
output.push(normalizedFormatOptions[option]);
|
|
189
216
|
normalizedSelectedOptions[id] = normalizedFormatOptions[option];
|
|
190
|
-
} else if (getIsEmptyValue(id) && !getIsEmptyValue(option) && revampSelectedOptions.indexOf(option) === -1) {
|
|
217
|
+
} else if (allowValueFallback && getIsEmptyValue(id) && !getIsEmptyValue(option) && revampSelectedOptions.indexOf(option) === -1) {
|
|
218
|
+
//fallback case
|
|
191
219
|
const newObj = {
|
|
192
220
|
id: option,
|
|
193
221
|
value: option
|
|
@@ -261,7 +289,7 @@ export const makeObjectConcat = () => createSelector([getObj1, getObj2], (obj1,
|
|
|
261
289
|
const getGroupedOptions = props => props.groupedOptions || dummyArray;
|
|
262
290
|
|
|
263
291
|
const getFormatOptions = makeFormatOptions();
|
|
264
|
-
export const makeGetGroupSelectOptions = () => createSelector([getGroupedOptions], groupedOptions => {
|
|
292
|
+
export const makeGetGroupSelectOptions = () => createSelector([getGroupedOptions, getAllowValueFallback], (groupedOptions, allowValueFallback) => {
|
|
265
293
|
const revampedGroups = [];
|
|
266
294
|
let allOptionIds = [];
|
|
267
295
|
let allNormalizedOptions = {}; //all group normalized options
|
|
@@ -290,7 +318,8 @@ export const makeGetGroupSelectOptions = () => createSelector([getGroupedOptions
|
|
|
290
318
|
options,
|
|
291
319
|
valueField,
|
|
292
320
|
textField,
|
|
293
|
-
prefixText: groupId
|
|
321
|
+
prefixText: groupId,
|
|
322
|
+
allowValueFallback
|
|
294
323
|
});
|
|
295
324
|
|
|
296
325
|
if (optionsOrder.length) {
|
|
@@ -29,7 +29,7 @@ export const propTypes = {
|
|
|
29
29
|
ariaChecked: PropTypes.bool,
|
|
30
30
|
ariaHidden: PropTypes.bool,
|
|
31
31
|
role: PropTypes.string,
|
|
32
|
-
tabIndex: PropTypes.oneOfType(PropTypes.string, PropTypes.number),
|
|
32
|
+
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
33
33
|
ariaLabelledby: PropTypes.string,
|
|
34
34
|
ariaLabel: PropTypes.string,
|
|
35
35
|
ariaReadonly: PropTypes.bool
|
|
@@ -58,7 +58,8 @@ var ListContainer = function ListContainer(props) {
|
|
|
58
58
|
onClick = props.onClick,
|
|
59
59
|
onMouseEnter = props.onMouseEnter,
|
|
60
60
|
onMouseOver = props.onMouseOver,
|
|
61
|
-
eleRef = props.eleRef
|
|
61
|
+
eleRef = props.eleRef,
|
|
62
|
+
align = props.align;
|
|
62
63
|
var responsiveFunc = (0, _react.useCallback)(function (_ref) {
|
|
63
64
|
var mediaQueryOR = _ref.mediaQueryOR,
|
|
64
65
|
isTouchDevice = _ref.isTouchDevice;
|
|
@@ -102,7 +103,7 @@ var ListContainer = function ListContainer(props) {
|
|
|
102
103
|
"aria-selected": ariaSelected,
|
|
103
104
|
"aria-label": ariaLabel,
|
|
104
105
|
isCover: false,
|
|
105
|
-
align:
|
|
106
|
+
align: align,
|
|
106
107
|
alignBox: "row",
|
|
107
108
|
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),
|
|
108
109
|
dataId: dataId,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.varClass {
|
|
2
2
|
/* listitem default variables */
|
|
3
|
+
--listitem_font_size: var(--zd_font_size13);
|
|
3
4
|
--listitem_text_color: var(--zdt_listitem_default_text);
|
|
4
5
|
--listitem_padding: var(--zd_size9) var(--zd_size20);
|
|
5
6
|
--listitem_border_width: 0;
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
position: relative;
|
|
25
26
|
list-style: none;
|
|
26
27
|
color: var(--listitem_text_color);
|
|
27
|
-
font-size: var(--
|
|
28
|
+
font-size: var(--listitem_font_size);
|
|
28
29
|
height: var(--listitem_height);
|
|
29
30
|
min-height: var(--listitem_min_height);
|
|
30
31
|
text-decoration: none;
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
--listitem_min_height: var(--zd_size35);
|
|
58
59
|
}
|
|
59
60
|
.large {
|
|
60
|
-
--
|
|
61
|
+
--listitem_min_height: var(--zd_size48);
|
|
61
62
|
}
|
|
62
63
|
[dir=ltr] .large {
|
|
63
64
|
--listitem_padding: var(--zd_size10) var(--zd_size3) var(--zd_size10) var(--zd_size25);
|
|
@@ -72,9 +73,8 @@
|
|
|
72
73
|
.value, .multiLineValue {
|
|
73
74
|
line-height: 1.5385;
|
|
74
75
|
}
|
|
75
|
-
.multiLineValue{
|
|
76
|
-
|
|
77
|
-
composes: clamp from '../common/common.module.css'
|
|
76
|
+
.multiLineValue,.multiLine{
|
|
77
|
+
composes: lineClamp from '../common/common.module.css';
|
|
78
78
|
}
|
|
79
79
|
.iconBox {
|
|
80
80
|
width: var(--zd_size20) ;
|
|
@@ -94,6 +94,42 @@
|
|
|
94
94
|
margin: var(--listitem_avatar_margin);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
.lhsJustifyContent_start,
|
|
98
|
+
.lhsJustifyContent_center,
|
|
99
|
+
.lhsJustifyContent_end {
|
|
100
|
+
composes: dflex alignVertical from '../common/common.module.css';
|
|
101
|
+
}
|
|
102
|
+
.lhsJustifyContent_start {
|
|
103
|
+
composes: justifyFstart from '../common/common.module.css';
|
|
104
|
+
}
|
|
105
|
+
.lhsJustifyContent_center {
|
|
106
|
+
composes: alignHorizontal from '../common/common.module.css';
|
|
107
|
+
}
|
|
108
|
+
.lhsJustifyContent_end {
|
|
109
|
+
composes: justifyFend from '../common/common.module.css';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.lhsBox {
|
|
113
|
+
composes: dflex from '../common/common.module.css';
|
|
114
|
+
align-self: stretch;
|
|
115
|
+
}
|
|
116
|
+
.lhsBox_small,
|
|
117
|
+
.lhsBox_medium,
|
|
118
|
+
.lhsBox_large{
|
|
119
|
+
composes: varClass;
|
|
120
|
+
--listitem_doubleline_content_height: calc(var(--listitem_font_size) * 2 );
|
|
121
|
+
height: 100% ;
|
|
122
|
+
composes: dflex alignVertical from '../common/common.module.css';
|
|
123
|
+
}
|
|
124
|
+
.lhsBox_small {
|
|
125
|
+
max-height: calc(var(--listitem_doubleline_content_height) + var(--zd_size7)); /* 7px = listitem min-height - (top + bottom padding) - doubleLine content height */
|
|
126
|
+
}
|
|
127
|
+
.lhsBox_medium {
|
|
128
|
+
max-height: calc(var(--listitem_doubleline_content_height) + var(--zd_size8)); /* 8px = listitem min-height - (top + bottom padding) - doubleLine content height */
|
|
129
|
+
}
|
|
130
|
+
.lhsBox_large {
|
|
131
|
+
max-height: calc(var(--listitem_doubleline_content_height) + var(--zd_size15)); /* 15px = listitem min-height - (top + bottom padding) - doubleLine content height */
|
|
132
|
+
}
|
|
97
133
|
.defaultHover, .primaryHover, .secondaryHover, .darkHover {
|
|
98
134
|
background-color: var(--listitem_highlight_bg_color);
|
|
99
135
|
}
|
|
@@ -155,12 +191,22 @@
|
|
|
155
191
|
.activedark {
|
|
156
192
|
--listitem_active_bg_color: var(--zdt_listitem_dark_active_bg);
|
|
157
193
|
}
|
|
194
|
+
.secondaryField{
|
|
195
|
+
color:var(--zdt_listitem_secondaryfield_text);
|
|
196
|
+
font-size: var(--zd_font_size12) ;
|
|
197
|
+
line-height: 1.25;
|
|
198
|
+
}
|
|
158
199
|
|
|
159
200
|
.tickIcon,
|
|
160
201
|
.defaultTick,
|
|
161
202
|
.darkTick {
|
|
162
203
|
position: absolute;
|
|
163
204
|
color: var(--listitem_tickicon_color);
|
|
205
|
+
top:50% ;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.tickIcon, .defaultTick, .darkTick {
|
|
209
|
+
transform: translateY(-50%);
|
|
164
210
|
}
|
|
165
211
|
|
|
166
212
|
[dir=ltr] .tickIcon, [dir=ltr] .defaultTick, [dir=ltr] .darkTick {
|
|
@@ -199,7 +245,7 @@
|
|
|
199
245
|
}
|
|
200
246
|
.responsiveHeight {
|
|
201
247
|
--listitem_min_height: var(--zd_size45);
|
|
202
|
-
|
|
248
|
+
--listitem_font_size: var(--zd_font_size15);
|
|
203
249
|
padding-top: var(--zd_size10) ;
|
|
204
250
|
padding-bottom: var(--zd_size10) ;
|
|
205
251
|
}
|
|
@@ -128,7 +128,9 @@ var ListItemWithAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
128
128
|
a11y = _this$props4.a11y,
|
|
129
129
|
customClass = _this$props4.customClass,
|
|
130
130
|
customProps = _this$props4.customProps,
|
|
131
|
-
needMultiLineText = _this$props4.needMultiLineText
|
|
131
|
+
needMultiLineText = _this$props4.needMultiLineText,
|
|
132
|
+
secondaryValue = _this$props4.secondaryValue,
|
|
133
|
+
lhsAlignContent = _this$props4.lhsAlignContent;
|
|
132
134
|
var _customProps$ListItem = customProps.ListItemProps,
|
|
133
135
|
ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
134
136
|
_customProps$Containe = customProps.ContainerProps,
|
|
@@ -172,7 +174,10 @@ var ListItemWithAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
172
174
|
title: null,
|
|
173
175
|
customProps: ListItemProps
|
|
174
176
|
}, ContainerProps), name || imgSrc ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
175
|
-
className: _ListItemModule["default"].leftAvatar
|
|
177
|
+
className: "".concat(_ListItemModule["default"].leftAvatar, " ").concat(lhsAlignContent !== 'center' ? "".concat(_ListItemModule["default"].lhsBox) : '')
|
|
178
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
179
|
+
align: lhsAlignContent,
|
|
180
|
+
className: _ListItemModule["default"]["lhsBox_".concat(size)]
|
|
176
181
|
}, isTeam ? /*#__PURE__*/_react["default"].createElement(_AvatarTeam["default"], _extends({
|
|
177
182
|
name: name,
|
|
178
183
|
size: "small",
|
|
@@ -193,12 +198,18 @@ var ListItemWithAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
193
198
|
needTitle: needAvatarTitle,
|
|
194
199
|
palette: isDarkPalette ? 'info' : avatarPalette,
|
|
195
200
|
customClass: customAvatar
|
|
196
|
-
}, AvatarProps))) : null,
|
|
201
|
+
}, AvatarProps)))) : null, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
197
202
|
flexible: true,
|
|
198
|
-
shrink: true
|
|
203
|
+
shrink: true
|
|
204
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
205
|
+
alignBox: "column"
|
|
206
|
+
}, value ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
199
207
|
"data-title": isDisabled ? null : title,
|
|
200
208
|
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value
|
|
201
|
-
}, value) : null,
|
|
209
|
+
}, value) : null, secondaryValue ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
210
|
+
"data-title": isDisabled ? null : secondaryValue,
|
|
211
|
+
className: "".concat(_ListItemModule["default"].secondaryField, " ").concat(needMultiLineText ? _ListItemModule["default"].multiLine : '')
|
|
212
|
+
}, secondaryValue) : null)), needTick && active ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
202
213
|
className: _ListItemModule["default"].tickIcon,
|
|
203
214
|
"aria-hidden": ariaHidden,
|
|
204
215
|
dataId: "".concat(dataIdString, "_tickIcon"),
|
|
@@ -116,7 +116,10 @@ var ListItemWithCheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
116
116
|
a11y = _this$props4.a11y,
|
|
117
117
|
customClass = _this$props4.customClass,
|
|
118
118
|
customProps = _this$props4.customProps,
|
|
119
|
-
needMultiLineText = _this$props4.needMultiLineText
|
|
119
|
+
needMultiLineText = _this$props4.needMultiLineText,
|
|
120
|
+
secondaryValue = _this$props4.secondaryValue,
|
|
121
|
+
lhsAlignContent = _this$props4.lhsAlignContent,
|
|
122
|
+
lhsJustifyContent = _this$props4.lhsJustifyContent;
|
|
120
123
|
|
|
121
124
|
var listA11y = _objectSpread({
|
|
122
125
|
role: 'option'
|
|
@@ -150,8 +153,11 @@ var ListItemWithCheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
150
153
|
title: null,
|
|
151
154
|
customProps: ListItemProps
|
|
152
155
|
}, ContainerProps), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
153
|
-
className: _ListItemModule["default"].iconBox,
|
|
156
|
+
className: "".concat(_ListItemModule["default"].iconBox, " ").concat(_ListItemModule["default"].lhsBox, " ").concat(_ListItemModule["default"]["lhsJustifyContent_".concat(lhsJustifyContent)]),
|
|
154
157
|
dataId: "".concat(dataId ? dataId : value, "_checkBox")
|
|
158
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
159
|
+
align: lhsAlignContent,
|
|
160
|
+
className: lhsAlignContent !== 'center' ? _ListItemModule["default"]["lhsBox_".concat(size)] : ''
|
|
155
161
|
}, /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
156
162
|
checked: checked,
|
|
157
163
|
a11y: {
|
|
@@ -161,12 +167,18 @@ var ListItemWithCheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
161
167
|
customCheckBox: customCheckBox,
|
|
162
168
|
customLabel: customLabel
|
|
163
169
|
}
|
|
164
|
-
})), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
170
|
+
}))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
165
171
|
flexible: true,
|
|
166
|
-
shrink: true
|
|
172
|
+
shrink: true
|
|
173
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
174
|
+
alignBox: "column"
|
|
175
|
+
}, value ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
167
176
|
"data-title": isDisabled ? null : title,
|
|
168
177
|
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value
|
|
169
|
-
}, value)
|
|
178
|
+
}, value) : null, secondaryValue ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
179
|
+
"data-title": isDisabled ? null : secondaryValue,
|
|
180
|
+
className: "".concat(_ListItemModule["default"].secondaryField, " ").concat(needMultiLineText ? _ListItemModule["default"].multiLine : '')
|
|
181
|
+
}, secondaryValue) : null)));
|
|
170
182
|
}
|
|
171
183
|
}]);
|
|
172
184
|
|
|
@@ -124,7 +124,10 @@ var ListItemWithIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
124
124
|
a11y = _this$props4.a11y,
|
|
125
125
|
customClass = _this$props4.customClass,
|
|
126
126
|
customProps = _this$props4.customProps,
|
|
127
|
-
needMultiLineText = _this$props4.needMultiLineText
|
|
127
|
+
needMultiLineText = _this$props4.needMultiLineText,
|
|
128
|
+
secondaryValue = _this$props4.secondaryValue,
|
|
129
|
+
lhsAlignContent = _this$props4.lhsAlignContent,
|
|
130
|
+
lhsJustifyContent = _this$props4.lhsJustifyContent;
|
|
128
131
|
var _customProps$ListItem = customProps.ListItemProps,
|
|
129
132
|
ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
130
133
|
_customProps$Containe = customProps.ContainerProps,
|
|
@@ -161,21 +164,31 @@ var ListItemWithIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
161
164
|
customProps: ListItemProps
|
|
162
165
|
}, ContainerProps), iconName && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
163
166
|
"aria-hidden": true,
|
|
164
|
-
|
|
167
|
+
align: lhsAlignContent,
|
|
168
|
+
className: "".concat(_ListItemModule["default"].iconBox, " ").concat(_ListItemModule["default"].lhsBox, " ").concat(_ListItemModule["default"]["lhsJustifyContent_".concat(lhsJustifyContent)]),
|
|
165
169
|
dataId: dataId ? "".concat(dataId, "_Icon") : "".concat(value.toLowerCase().replace("'", '_'), "_Icon")
|
|
170
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
171
|
+
align: lhsAlignContent,
|
|
172
|
+
className: lhsAlignContent !== 'center' ? _ListItemModule["default"]["lhsBox_".concat(size)] : ''
|
|
166
173
|
}, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
167
174
|
iconClass: iconClass,
|
|
168
175
|
name: iconName,
|
|
169
176
|
size: iconSize
|
|
170
|
-
})), iconClass && !iconName ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
177
|
+
}))), iconClass && !iconName ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
171
178
|
className: iconClass
|
|
172
|
-
}) : null,
|
|
179
|
+
}) : null, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
173
180
|
flexible: true,
|
|
174
|
-
shrink: true
|
|
181
|
+
shrink: true
|
|
182
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
183
|
+
alignBox: "column"
|
|
184
|
+
}, value ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
175
185
|
className: needMultiLineText ? _ListItemModule["default"].multiLineValue : _ListItemModule["default"].value,
|
|
176
186
|
"data-title": isDisabled ? null : title,
|
|
177
187
|
dataId: "".concat(dataIdString, "_Text")
|
|
178
|
-
}, value)
|
|
188
|
+
}, value) : null, secondaryValue ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
189
|
+
"data-title": isDisabled ? null : secondaryValue,
|
|
190
|
+
className: "".concat(_ListItemModule["default"].secondaryField, " ").concat(needMultiLineText ? _ListItemModule["default"].multiLine : '')
|
|
191
|
+
}, secondaryValue) : null)), needTick && active ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
179
192
|
className: _ListItemModule["default"].tickIcon,
|
|
180
193
|
"aria-hidden": ariaHidden,
|
|
181
194
|
dataId: "".concat(dataIdString, "_tickIcon"),
|