@zohodesk/components 1.4.9 → 1.4.10-exp-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.
@@ -1926,6 +1926,287 @@ exports[`Select - Should render the only options matching search value 1`] = `
1926
1926
  </DocumentFragment>
1927
1927
  `;
1928
1928
 
1929
+ exports[`Select - Should render the only options matching search value even with additional spaces before and after 1`] = `
1930
+ <DocumentFragment>
1931
+ <div
1932
+ class="container box_medium "
1933
+ data-selector-id="select"
1934
+ >
1935
+ <div
1936
+ class=""
1937
+ data-id="selectComponent"
1938
+ data-test-id="selectComponent"
1939
+ >
1940
+ <div
1941
+ class="container effect effectFocused input flex rowdir"
1942
+ data-id="containerComponent"
1943
+ data-selector-id="textBoxIcon"
1944
+ data-test-id="containerComponent"
1945
+ >
1946
+ <div
1947
+ class="grow basis shrinkOff"
1948
+ data-id="boxComponent"
1949
+ data-selector-id="box"
1950
+ data-test-id="boxComponent"
1951
+ >
1952
+ <input
1953
+ aria-activedescendant="1"
1954
+ aria-controls="1"
1955
+ aria-expanded="true"
1956
+ aria-haspopup="true"
1957
+ aria-label="click to select options"
1958
+ aria-owns="1"
1959
+ aria-readonly="true"
1960
+ autocomplete="off"
1961
+ class=" pointer container medium default effect focus borderColor_default inputDotted "
1962
+ data-id="selectComponent_textBox"
1963
+ data-selector-id="textBoxIcon"
1964
+ data-test-id="selectComponent_textBox"
1965
+ data-title="Option 1"
1966
+ maxlength="250"
1967
+ placeholder=""
1968
+ readonly=""
1969
+ role="Menuitem"
1970
+ type="text"
1971
+ value="Option 1"
1972
+ />
1973
+ </div>
1974
+ <div
1975
+ class="iconContainer shrinkOff"
1976
+ data-id="boxComponent"
1977
+ data-selector-id="box"
1978
+ data-test-id="boxComponent"
1979
+ >
1980
+ <div
1981
+ class="flex cover rowdir"
1982
+ data-id="containerComponent"
1983
+ data-selector-id="container"
1984
+ data-test-id="containerComponent"
1985
+ >
1986
+ <div
1987
+ class="icon rotated shrinkOff"
1988
+ data-id="boxComponent"
1989
+ data-selector-id="box"
1990
+ data-test-id="boxComponent"
1991
+ >
1992
+ <div
1993
+ class="rightPlaceholder inflex rowdir both"
1994
+ data-id="containerComponent"
1995
+ data-selector-id="container"
1996
+ data-test-id="containerComponent"
1997
+ >
1998
+ <div
1999
+ aria-hidden="true"
2000
+ class="arrowIcon flex cover coldir both"
2001
+ data-id="selectComponent_downIcon"
2002
+ data-selector-id="container"
2003
+ data-test-id="selectComponent_downIcon"
2004
+ >
2005
+ <i
2006
+ aria-hidden="true"
2007
+ class="zd_font_icons basic icon-down "
2008
+ data-id="fontIcon"
2009
+ data-selector-id="fontIcon"
2010
+ data-test-id="fontIcon"
2011
+ style="--zd-iconfont-size: var(--zd_font_size7);"
2012
+ />
2013
+ </div>
2014
+ </div>
2015
+ </div>
2016
+ </div>
2017
+ </div>
2018
+ <div
2019
+ class="line borderColor_default "
2020
+ />
2021
+ </div>
2022
+ </div>
2023
+ <div
2024
+ class="main container bottomMid default"
2025
+ data-a11y-focus-main-area="true"
2026
+ data-arrow-position="mid"
2027
+ data-box-direction="bottom"
2028
+ data-id="selectComponent_suggestions"
2029
+ data-position="bottomMid"
2030
+ data-selector-id="dropBox"
2031
+ data-test-id="selectComponent_suggestions"
2032
+ dot-ui-element="dropbox"
2033
+ style="z-index: 4;"
2034
+ >
2035
+ <div
2036
+ class="subContainer shadow radius bounce defaultPalette"
2037
+ data-id="selectComponent_suggestions_subcontainer"
2038
+ data-selector-id="dropBox_subcontainer"
2039
+ data-test-id="selectComponent_suggestions_subcontainer"
2040
+ tabindex="-1"
2041
+ >
2042
+ <div
2043
+ class="flex rowdir"
2044
+ data-id="containerComponent"
2045
+ data-selector-id="container"
2046
+ data-test-id="containerComponent"
2047
+ >
2048
+ <div
2049
+ class="grow basis shrinkOff"
2050
+ data-id="boxComponent"
2051
+ data-selector-id="box"
2052
+ data-test-id="boxComponent"
2053
+ >
2054
+ <div
2055
+ class="flex cover coldir"
2056
+ data-id="containerComponent"
2057
+ data-selector-id="container"
2058
+ data-test-id="containerComponent"
2059
+ >
2060
+ <div
2061
+ class="notScroll shrinkOff"
2062
+ data-id="CardHeader"
2063
+ data-selector-id="cardHeader"
2064
+ data-test-id="CardHeader"
2065
+ >
2066
+ <div
2067
+ class="search medium"
2068
+ >
2069
+ <div
2070
+ class="container effect effectFocused flex rowdir"
2071
+ data-id="containerComponent"
2072
+ data-selector-id="textBoxIcon"
2073
+ data-test-id="containerComponent"
2074
+ >
2075
+ <div
2076
+ class="grow basis shrinkOff"
2077
+ data-id="boxComponent"
2078
+ data-selector-id="box"
2079
+ data-test-id="boxComponent"
2080
+ >
2081
+ <input
2082
+ aria-autocomplete="list"
2083
+ aria-controls="1"
2084
+ aria-describedby="2"
2085
+ autocomplete="off"
2086
+ class=" container small default effect borderColor_default "
2087
+ data-id="selectComponent_search"
2088
+ data-selector-id="textBoxIcon"
2089
+ data-test-id="selectComponent_search"
2090
+ maxlength="250"
2091
+ placeholder="Search"
2092
+ type="text"
2093
+ value=" 2 "
2094
+ />
2095
+ </div>
2096
+ <div
2097
+ class="iconContainer shrinkOff"
2098
+ data-id="boxComponent"
2099
+ data-selector-id="box"
2100
+ data-test-id="boxComponent"
2101
+ >
2102
+ <div
2103
+ class="flex cover rowdir"
2104
+ data-id="containerComponent"
2105
+ data-selector-id="container"
2106
+ data-test-id="containerComponent"
2107
+ >
2108
+ <button
2109
+ class="buttonReset icon shrinkOff"
2110
+ data-id="selectComponent_search_ClearIcon"
2111
+ data-selector-id="box"
2112
+ data-test-id="selectComponent_search_ClearIcon"
2113
+ data-title="Clear"
2114
+ >
2115
+ <div
2116
+ aria-hidden="true"
2117
+ class="flex cover coldir both"
2118
+ data-id="containerComponent"
2119
+ data-selector-id="container"
2120
+ data-test-id="containerComponent"
2121
+ >
2122
+ <i
2123
+ aria-hidden="true"
2124
+ class="zd_font_icons basic icon-delete rtl "
2125
+ data-id="fontIcon"
2126
+ data-selector-id="fontIcon"
2127
+ data-test-id="fontIcon"
2128
+ style="--zd-iconfont-size: var(--zd_font_size14);"
2129
+ />
2130
+ </div>
2131
+ </button>
2132
+ </div>
2133
+ </div>
2134
+ <div
2135
+ class="line borderColor_default "
2136
+ />
2137
+ </div>
2138
+ </div>
2139
+ </div>
2140
+ <div
2141
+ class="small grow basis shrinkOn scrolly"
2142
+ data-id="CardContent"
2143
+ data-selector-id="cardContent"
2144
+ data-test-id="CardContent"
2145
+ >
2146
+ <div
2147
+ class="flex coldir"
2148
+ data-id="containerComponent"
2149
+ data-selector-id="container"
2150
+ data-test-id="containerComponent"
2151
+ id="1"
2152
+ role="listbox"
2153
+ tabindex="0"
2154
+ >
2155
+ <div
2156
+ class="listItemContainer shrinkOff"
2157
+ data-id="selectComponent_Options"
2158
+ data-selector-id="box"
2159
+ data-test-id="selectComponent_Options"
2160
+ >
2161
+ <li
2162
+ aria-label="Option 2"
2163
+ aria-selected="false"
2164
+ ariaparentrole="listbox"
2165
+ class="list medium default defaultHover mediumwithTick flex rowdir vCenter"
2166
+ data-a11y-inset-focus="true"
2167
+ data-a11y-list-active="true"
2168
+ data-id="Option 2"
2169
+ data-selector-id="listItem"
2170
+ data-test-id="Option 2"
2171
+ data-title="Option 2"
2172
+ role="option"
2173
+ tabindex="0"
2174
+ >
2175
+ <div
2176
+ class="leftBox grow basis shrinkOff"
2177
+ data-id="boxComponent"
2178
+ data-selector-id="box"
2179
+ data-test-id="boxComponent"
2180
+ >
2181
+ <div
2182
+ class="titleBox shrinkOff"
2183
+ data-id="boxComponent"
2184
+ data-selector-id="box"
2185
+ data-test-id="boxComponent"
2186
+ >
2187
+ <div
2188
+ class="value basisAuto shrinkOn"
2189
+ data-id="boxComponent"
2190
+ data-selector-id="box"
2191
+ data-test-id="boxComponent"
2192
+ >
2193
+ Option 2
2194
+ </div>
2195
+ </div>
2196
+ </div>
2197
+ </li>
2198
+ </div>
2199
+ </div>
2200
+ </div>
2201
+ </div>
2202
+ </div>
2203
+ </div>
2204
+ </div>
2205
+ </div>
2206
+ </div>
2207
+ </DocumentFragment>
2208
+ `;
2209
+
1929
2210
  exports[`Select - Should render the placeholder when there is no default value 1`] = `
1930
2211
  <DocumentFragment>
1931
2212
  <div
@@ -6,6 +6,7 @@ export const Select_defaultProps = {
6
6
  dataId: 'selectComponent',
7
7
  dataSelectorId: 'select',
8
8
  dropBoxSize: 'small',
9
+ isVirtualizerEnabled: false,
9
10
  isDefaultSelectValue: true,
10
11
  isDisabled: false,
11
12
  isPopupOpenOnEnter: false,
@@ -12,6 +12,7 @@ export const Select_propTypes = {
12
12
  defaultDropBoxPosition: PropTypes.string,
13
13
  dropBoxSize: PropTypes.oneOf(['small', 'medium', 'large']),
14
14
  emptyMessage: PropTypes.string,
15
+ isVirtualizerEnabled: PropTypes.bool,
15
16
  excludeOptions: PropTypes.array,
16
17
  getChildren: PropTypes.func,
17
18
  getContainerRef: PropTypes.func,
@@ -376,7 +376,7 @@ export function getElementSpace(elementRef) {
376
376
  }
377
377
  export function getSearchString() {
378
378
  let charachers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
379
- return (charachers || '').toString().toLowerCase(); //.replace(/\s+/g, '');
379
+ return (charachers || '').toString().toLowerCase().trim(); //.replace(/\s+/g, '');
380
380
  }
381
381
  export function findScrollEnd(element) {
382
382
  let {
@@ -413,4 +413,5 @@ export function isTextSelected() {
413
413
 
414
414
  return false;
415
415
  }
416
- export const DUMMY_OBJECT = {};
416
+ export const DUMMY_OBJECT = {};
417
+ export const DUMMY_ARRAY = [];
@@ -43,8 +43,10 @@ const getDisabledOptions = props => props.disabledOptions || dummyArray;
43
43
 
44
44
  const getListItemProps = props => props.listItemProps || '';
45
45
 
46
+ const defaultSearchFields = ['value'];
47
+
46
48
  const getSearchFields = props => {
47
- return props.searchFields || ['value'];
49
+ return props.searchFields || defaultSearchFields;
48
50
  }; // const isObjectContainsSearchString = (searchFields = [], searchStr = '', obj) => {
49
51
  // const matchedFields = searchFields.filter(element => {
50
52
  // return getSearchString(obj[element]).indexOf(searchStr) !== -1
@@ -162,6 +162,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
162
162
  _this.handleSearchOptions = (0, _Common.debounce)(_this.handleSearchOptions.bind(_assertThisInitialized(_this)), searchDebounceTime);
163
163
  _this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
164
164
  _this.handleScrollFuncCall = (0, _Common.debounce)(_this.handleScrollFuncCall.bind(_assertThisInitialized(_this)), 500);
165
+ _this.setSuggestionsVirtualizerContainerRefFunction = _this.setSuggestionsVirtualizerContainerRefFunction.bind(_assertThisInitialized(_this));
165
166
  return _this;
166
167
  }
167
168
 
@@ -880,6 +881,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
880
881
  key: "suggestionContainerRef",
881
882
  value: function suggestionContainerRef(el) {
882
883
  this.suggestionContainer = el;
884
+ typeof this.setSuggestionsVirtualizerRef === 'function' && this.setSuggestionsVirtualizerRef(el);
883
885
  }
884
886
  }, {
885
887
  key: "suggestionItemRef",
@@ -942,6 +944,12 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
942
944
  openPopupOnly: openPopupOnly
943
945
  });
944
946
  }
947
+ }, {
948
+ key: "setSuggestionsVirtualizerContainerRefFunction",
949
+ value: function setSuggestionsVirtualizerContainerRefFunction(refFunc) {
950
+ this.setSuggestionsVirtualizerRef = refFunc;
951
+ this.suggestionContainer && refFunc(this.suggestionContainer);
952
+ }
945
953
  }, {
946
954
  key: "getSelectionUI",
947
955
  value: function getSelectionUI() {
@@ -1119,6 +1127,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1119
1127
  isLoading = _this$props15.isLoading,
1120
1128
  selectAllText = _this$props15.selectAllText,
1121
1129
  needSelectAll = _this$props15.needSelectAll,
1130
+ isVirtualizerEnabled = _this$props15.isVirtualizerEnabled,
1122
1131
  limit = _this$props15.limit;
1123
1132
  var _this$state9 = this.state,
1124
1133
  selectedOptions = _this$state9.selectedOptions,
@@ -1200,6 +1209,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1200
1209
  className: _MultiSelectModule["default"][palette]
1201
1210
  }, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
1202
1211
  suggestions: suggestions,
1212
+ isVirtualizerEnabled: isVirtualizerEnabled,
1213
+ setVirtualizerContainerRefFunction: this.setSuggestionsVirtualizerContainerRefFunction,
1203
1214
  getRef: this.suggestionItemRef,
1204
1215
  hoverOption: hoverOption,
1205
1216
  onClick: this.handleSelectOption,