@zohodesk/components 1.0.0-alpha-214 → 1.0.0-alpha-215

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 CHANGED
@@ -32,6 +32,9 @@ 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-215
36
+
37
+ - Select Search Regex Changed to Lowercase
35
38
  # 1.0.0-alpha-214
36
39
 
37
40
  - Avatar, Label, Tag, Dropdown, ListItem, Multiselect missing dark palette variables moved under Themes folder files
@@ -20,7 +20,7 @@ import { getUniqueId } from '../Provider/IdProvider';
20
20
  import style from './AdvancedMultiSelect.module.css';
21
21
  /**** Methods ****/
22
22
 
23
- import { getIsEmptyValue } from '../utils/Common.js';
23
+ import { getIsEmptyValue, getSearchString } from '../utils/Common.js';
24
24
  import { filterSelectedOptions } from '../utils/dropDownUtils';
25
25
  /* eslint-disable react/sort-prop-types */
26
26
 
@@ -67,7 +67,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
67
67
  } = this.getFilterSuggestions({
68
68
  options,
69
69
  selectedOptions: dummyArray,
70
- searchStr: searchStr.replace(/\s+/g, '').toLowerCase(),
70
+ searchStr: getSearchString(searchStr),
71
71
  needSearch: needLocalSearch
72
72
  });
73
73
  this.suggestionsOrder = suggestionIds;
@@ -260,7 +260,7 @@ export class MultiSelectComponent extends React.Component {
260
260
  } = this.getFilterSuggestions({
261
261
  options,
262
262
  selectedOptions,
263
- searchStr: searchStr.replace(/\s+/g, '').toLowerCase(),
263
+ searchStr: getSearchString(searchStr),
264
264
  needSearch: needLocalSearch
265
265
  });
266
266
  this.suggestionsOrder = suggestionIds;
@@ -18,7 +18,7 @@ import style from './Select.module.css';
18
18
  /**** Methods ****/
19
19
 
20
20
  import { makeGetGroupSelectOptions, optionIdGrouping, makeGetGroupSelectFilterSuggestions, extractOptionId } from '../utils/dropDownUtils';
21
- import { getIsEmptyValue, scrollTo, debounce } from '../utils/Common';
21
+ import { getIsEmptyValue, scrollTo, debounce, getSearchString } from '../utils/Common';
22
22
  /* eslint-disable react/no-unused-prop-types */
23
23
 
24
24
  /* eslint-disable react/sort-prop-types */
@@ -214,7 +214,7 @@ export class GroupSelectComponent extends PureComponent {
214
214
  } = this.state;
215
215
 
216
216
  if (needSearch && searchStr && searchStr.trim().length) {
217
- searchStr = searchStr.toLowerCase().replace(/\s+/g, '');
217
+ searchStr = getSearchString(searchStr);
218
218
  let {
219
219
  suggestionGroups,
220
220
  suggestionOptionIds
@@ -253,8 +253,8 @@ export class GroupSelectComponent extends PureComponent {
253
253
  let {
254
254
  onSearch
255
255
  } = this.props;
256
- let searchStrRegex = searchStr.toLowerCase().replace(/\s+/g, '');
257
- let valueStrRegex = value.toLowerCase().replace(/\s+/g, '');
256
+ let searchStrRegex = getSearchString(searchStr);
257
+ let valueStrRegex = getSearchString(value);
258
258
  let isSearch = searchStrRegex !== valueStrRegex ? true : false;
259
259
  this.setState({
260
260
  searchStr: value,
@@ -365,5 +365,5 @@ export function getElementSpace(elementRef) {
365
365
  }
366
366
  export function getSearchString() {
367
367
  let charachers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
368
- return charachers.toLowerCase(); //.replace(/\s+/g, '');
368
+ return (charachers || '').toString().toLowerCase(); //.replace(/\s+/g, '');
369
369
  }
@@ -1,6 +1,6 @@
1
1
  /***** Libraries *****/
2
2
  import { createSelector } from 'reselect';
3
- import { getIsEmptyValue } from './Common';
3
+ import { getIsEmptyValue, getSearchString } from './Common';
4
4
  export const dummyArray = [];
5
5
  export const dummyObj = {};
6
6
  export const getOptions = props => props.options || dummyArray;
@@ -44,8 +44,8 @@ export const makeGetMultiSelectFilterSuggestions = () => createSelector([getOpti
44
44
  id,
45
45
  value = ''
46
46
  } = option;
47
- const valueString = value.toLowerCase();
48
- const searchString = searchStr.toLowerCase();
47
+ const valueString = getSearchString(value);
48
+ const searchString = getSearchString(searchStr);
49
49
  const isMatch = needSearch ? isStartsWithSearch ? valueString.startsWith(searchString) : valueString.indexOf(searchString) !== -1 : true;
50
50
 
51
51
  if (selectedOptions.indexOf(id) === -1 && isMatch) {
@@ -131,7 +131,7 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
131
131
  var _this$getFilterSugges = this.getFilterSuggestions({
132
132
  options: options,
133
133
  selectedOptions: dummyArray,
134
- searchStr: searchStr.replace(/\s+/g, '').toLowerCase(),
134
+ searchStr: (0, _Common.getSearchString)(searchStr),
135
135
  needSearch: needLocalSearch
136
136
  }),
137
137
  suggestions = _this$getFilterSugges.suggestions,
@@ -335,7 +335,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
335
335
  var _this$getFilterSugges = this.getFilterSuggestions({
336
336
  options: options,
337
337
  selectedOptions: selectedOptions,
338
- searchStr: searchStr.replace(/\s+/g, '').toLowerCase(),
338
+ searchStr: (0, _Common.getSearchString)(searchStr),
339
339
  needSearch: needLocalSearch
340
340
  }),
341
341
  suggestions = _this$getFilterSugges.suggestions,
@@ -283,7 +283,7 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
283
283
  allOptionIds = _this$state2.allOptionIds;
284
284
 
285
285
  if (needSearch && searchStr && searchStr.trim().length) {
286
- searchStr = searchStr.toLowerCase().replace(/\s+/g, '');
286
+ searchStr = (0, _Common.getSearchString)(searchStr);
287
287
 
288
288
  var _this$getFilterSugges = this.getFilterSuggestions({
289
289
  revampedGroups: revampedGroups,
@@ -320,8 +320,8 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
320
320
  var _this$state$searchStr = this.state.searchStr,
321
321
  searchStr = _this$state$searchStr === void 0 ? '' : _this$state$searchStr;
322
322
  var onSearch = this.props.onSearch;
323
- var searchStrRegex = searchStr.toLowerCase().replace(/\s+/g, '');
324
- var valueStrRegex = value.toLowerCase().replace(/\s+/g, '');
323
+ var searchStrRegex = (0, _Common.getSearchString)(searchStr);
324
+ var valueStrRegex = (0, _Common.getSearchString)(value);
325
325
  var isSearch = searchStrRegex !== valueStrRegex ? true : false;
326
326
  this.setState({
327
327
  searchStr: value,
@@ -453,5 +453,5 @@ function getElementSpace(elementRef) {
453
453
 
454
454
  function getSearchString() {
455
455
  var charachers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
456
- return charachers.toLowerCase(); //.replace(/\s+/g, '');
456
+ return (charachers || '').toString().toLowerCase(); //.replace(/\s+/g, '');
457
457
  }
@@ -138,8 +138,8 @@ var makeGetMultiSelectFilterSuggestions = function makeGetMultiSelectFilterSugge
138
138
  var id = option.id,
139
139
  _option$value = option.value,
140
140
  value = _option$value === void 0 ? '' : _option$value;
141
- var valueString = value.toLowerCase();
142
- var searchString = searchStr.toLowerCase();
141
+ var valueString = (0, _Common.getSearchString)(value);
142
+ var searchString = (0, _Common.getSearchString)(searchStr);
143
143
  var isMatch = needSearch ? isStartsWithSearch ? valueString.startsWith(searchString) : valueString.indexOf(searchString) !== -1 : true;
144
144
 
145
145
  if (selectedOptions.indexOf(id) === -1 && isMatch) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-alpha-214",
3
+ "version": "1.0.0-alpha-215",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "jsnext:main": "es/index.js",