@appbaseio/reactivesearch-vue 1.29.0-preview.1 → 1.31.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.
Files changed (85) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1596 -566
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-e0b7c1f6.js → Button-0e2e2c02.js} +1 -1
  6. package/dist/cjs/{CancelSvg-4aa35935.js → CancelSvg-c48c1085.js} +1 -1
  7. package/dist/cjs/{Card-fd94ef07.js → Card-4fa0f769.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-10bad289.js → ComponentWrapper-6909bc2a.js} +2 -2
  9. package/dist/cjs/{Container-526efa6a.js → Container-cfd69a34.js} +1 -1
  10. package/dist/cjs/{DataSearch-eec21890.js → DataSearch-a8fabd77.js} +236 -84
  11. package/dist/cjs/DataSearch.js +10 -10
  12. package/dist/cjs/{DropDown-e4381fcc.js → DropDown-aa358fff.js} +5 -5
  13. package/dist/cjs/DynamicRangeSlider.js +8 -7
  14. package/dist/cjs/{Flex-f146cdad.js → Flex-63774e4d.js} +1 -1
  15. package/dist/cjs/{FormControlList-808dbcef.js → FormControlList-a9c64bb8.js} +1 -1
  16. package/dist/cjs/{Input-0d7b25ad.js → Input-43868594.js} +1 -1
  17. package/dist/cjs/{ListItem-b40adb04.js → ListItem-38962297.js} +2 -2
  18. package/dist/cjs/MultiDropdownList.js +13 -12
  19. package/dist/cjs/MultiList.js +11 -10
  20. package/dist/cjs/MultiRange.js +9 -8
  21. package/dist/cjs/RangeInput.js +11 -10
  22. package/dist/cjs/RangeSlider.js +9 -8
  23. package/dist/cjs/ReactiveBase.js +69 -35
  24. package/dist/cjs/ReactiveComponent.js +6 -5
  25. package/dist/cjs/ReactiveList.js +22 -15
  26. package/dist/cjs/ResultCard.js +4 -4
  27. package/dist/cjs/ResultList.js +4 -4
  28. package/dist/cjs/SelectedFilters.js +45 -28
  29. package/dist/cjs/SingleDropdownList.js +13 -12
  30. package/dist/cjs/SingleList.js +11 -10
  31. package/dist/cjs/SingleRange.js +10 -9
  32. package/dist/cjs/StateProvider.js +30 -5
  33. package/dist/cjs/{Title-584a8cc8.js → Title-26661936.js} +1 -1
  34. package/dist/cjs/ToggleButton.js +10 -8
  35. package/dist/cjs/{_rollupPluginBabelHelpers-f127c8b7.js → _rollupPluginBabelHelpers-91d4b5a6.js} +1 -2
  36. package/dist/cjs/{index-4509aa45.js → index-2e0ea8d8.js} +13 -1
  37. package/dist/cjs/index.js +19 -18
  38. package/dist/cjs/initReactivesearch.js +40 -8
  39. package/dist/cjs/{install-b05fef06.js → install-27314778.js} +232 -70
  40. package/dist/cjs/install.js +19 -18
  41. package/dist/cjs/{ssr-0ee35a09.js → ssr-949cafb5.js} +1 -1
  42. package/dist/cjs/{utils-1219e1fe.js → utils-0df3cb93.js} +1 -1
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/{vueTypes-57d01f18.js → vueTypes-3970ff42.js} +6 -0
  45. package/dist/es/{Button-33de88e6.js → Button-e18ad90f.js} +1 -1
  46. package/dist/es/{CancelSvg-c2c03a35.js → CancelSvg-e3b33cdd.js} +1 -1
  47. package/dist/es/{Card-6446f1b7.js → Card-ad6ba09f.js} +2 -2
  48. package/dist/es/{ComponentWrapper-0f3431d1.js → ComponentWrapper-ca0354ea.js} +2 -2
  49. package/dist/es/{Container-18b03fde.js → Container-421450dc.js} +1 -1
  50. package/dist/es/{DataSearch-42f547cd.js → DataSearch-da9347f7.js} +236 -86
  51. package/dist/es/DataSearch.js +10 -10
  52. package/dist/es/{DropDown-ff6ad982.js → DropDown-604374d2.js} +5 -5
  53. package/dist/es/DynamicRangeSlider.js +8 -7
  54. package/dist/es/{Flex-8770345d.js → Flex-09d40927.js} +1 -1
  55. package/dist/es/{FormControlList-704f8dee.js → FormControlList-38ffe3d3.js} +1 -1
  56. package/dist/es/{Input-e339e63a.js → Input-c9d757bc.js} +1 -1
  57. package/dist/es/{ListItem-8e8fb535.js → ListItem-41d6ddd7.js} +2 -2
  58. package/dist/es/MultiDropdownList.js +13 -12
  59. package/dist/es/MultiList.js +11 -10
  60. package/dist/es/MultiRange.js +9 -8
  61. package/dist/es/RangeInput.js +11 -10
  62. package/dist/es/RangeSlider.js +9 -8
  63. package/dist/es/ReactiveBase.js +70 -36
  64. package/dist/es/ReactiveComponent.js +6 -5
  65. package/dist/es/ReactiveList.js +22 -15
  66. package/dist/es/ResultCard.js +4 -4
  67. package/dist/es/ResultList.js +4 -4
  68. package/dist/es/SelectedFilters.js +45 -28
  69. package/dist/es/SingleDropdownList.js +13 -12
  70. package/dist/es/SingleList.js +11 -10
  71. package/dist/es/SingleRange.js +10 -9
  72. package/dist/es/StateProvider.js +30 -5
  73. package/dist/es/{Title-3522ff56.js → Title-35edd732.js} +1 -1
  74. package/dist/es/ToggleButton.js +10 -8
  75. package/dist/es/{_rollupPluginBabelHelpers-0f24d612.js → _rollupPluginBabelHelpers-51ce1182.js} +1 -2
  76. package/dist/es/{index-78920565.js → index-4715798c.js} +13 -2
  77. package/dist/es/index.js +20 -19
  78. package/dist/es/initReactivesearch.js +41 -9
  79. package/dist/es/{install-bd448c02.js → install-5d9cb7ed.js} +232 -70
  80. package/dist/es/install.js +19 -18
  81. package/dist/es/{ssr-a41dfea9.js → ssr-ad57b0ad.js} +1 -1
  82. package/dist/es/{utils-64a2e5f0.js → utils-9b45e0ab.js} +1 -1
  83. package/dist/es/version.js +1 -1
  84. package/dist/es/{vueTypes-687b2304.js → vueTypes-c0d8b875.js} +6 -0
  85. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
- import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-0f24d612.js';
1
+ import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-51ce1182.js';
2
2
  import { validProps, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
3
- import { pushToAndClause, buildQuery, extractQueryFromCustomQuery, getOptionsForCustomQuery } from '@appbaseio/reactivecore/lib/utils/helper';
3
+ import { transformRequestUsingEndpoint, pushToAndClause, buildQuery, extractQueryFromCustomQuery, getOptionsForCustomQuery } from '@appbaseio/reactivecore/lib/utils/helper';
4
4
  import { isSearchComponent, getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
5
5
  import Appbase from 'appbase-js';
6
6
  import valueReducer from '@appbaseio/reactivecore/lib/reducers/valueReducer';
@@ -94,20 +94,51 @@ function initReactivesearch(componentCollection, searchState, settings) {
94
94
  'X-Search-Client': X_SEARCH_CLIENT
95
95
  }, enableTelemetry === false && {
96
96
  'X-Enable-Telemetry': false
97
- }), settings.headers);
97
+ }), settings.headers, settings.enableAppbase && settings.endpoint && settings.endpoint.headers ? settings.endpoint.headers : {});
98
+
99
+ var url = settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io';
100
+ var transformRequest = settings.transformRequest || null;
101
+
102
+ if (settings.enableAppbase && settings.endpoint) {
103
+ if (settings.endpoint.url) {
104
+ // eslint-disable-next-line prefer-destructuring
105
+ url = settings.endpoint.url;
106
+ }
107
+
108
+ transformRequest = function transformRequest(request) {
109
+ var modifiedRequest = transformRequestUsingEndpoint(request, settings.endpoint);
110
+
111
+ if (settings.transformRequest) {
112
+ return settings.transformRequest(modifiedRequest);
113
+ }
114
+
115
+ return modifiedRequest;
116
+ };
117
+ }
98
118
 
99
119
  var config = {
100
- url: settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io',
120
+ url: url,
101
121
  app: settings.app,
102
122
  credentials: credentials,
103
- transformRequest: settings.transformRequest || null,
123
+ transformRequest: transformRequest,
104
124
  type: settings.type ? settings.type : '*',
105
125
  transformResponse: settings.transformResponse || null,
106
126
  graphQLUrl: settings.graphQLUrl || '',
107
127
  headers: headers,
108
- analyticsConfig: settings.appbaseConfig || null
128
+ analyticsConfig: settings.appbaseConfig || null,
129
+ enableAppbase: settings.enableAppbase,
130
+ endpoint: settings.endpoint
109
131
  };
110
132
  var appbaseRef = Appbase(config);
133
+
134
+ if (config.transformRequest) {
135
+ appbaseRef.transformRequest = config.transformRequest;
136
+ }
137
+
138
+ if (config.transformResponse) {
139
+ appbaseRef.transformResponse = config.transformResponse;
140
+ }
141
+
111
142
  var components = [];
112
143
  var selectedValues = {};
113
144
  var internalValues = {};
@@ -331,7 +362,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
331
362
  queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
332
363
 
333
364
  if (settings.enableAppbase) {
334
- var query = getRSQuery(component.componentId, extractPropsFromState(state, component.componentId, queryOptions && queryOptions[component.componentId] ? {
365
+ var query = getRSQuery(component.componentId, extractPropsFromState(state, component.componentId, queryOptions && Object.keys(queryOptions[component.componentId]).length ? {
335
366
  from: queryOptions[component.componentId].from
336
367
  } : null));
337
368
 
@@ -436,9 +467,10 @@ function initReactivesearch(componentCollection, searchState, settings) {
436
467
  }
437
468
 
438
469
  timestamp[component] = res._timestamp;
470
+ var hitsObj = response.hits ? response.hits : response[component].hits;
439
471
  hits = _extends({}, hits, (_extends7 = {}, _extends7[component] = {
440
- hits: response.hits.hits,
441
- total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
472
+ hits: hitsObj.hits,
473
+ total: typeof hitsObj.total === 'object' ? hitsObj.total.value : hitsObj.total,
442
474
  time: response.took
443
475
  }, _extends7));
444
476
  responseResolve();
@@ -1,21 +1,21 @@
1
1
  import { Actions, helper, causes } from '@appbaseio/reactivecore';
2
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-51ce1182.js';
3
3
  import VueTypes from 'vue-types';
4
- import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
4
+ import { SEARCH_COMPONENTS_MODES, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import { getQueryOptions, suggestionTypes } from '@appbaseio/reactivecore/lib/utils/helper';
6
6
  import styled from '@appbaseio/vue-emotion';
7
- import { B as Button } from './Button-33de88e6.js';
8
- import { t as types } from './vueTypes-687b2304.js';
7
+ import { B as Button } from './Button-e18ad90f.js';
8
+ import { t as types } from './vueTypes-c0d8b875.js';
9
9
  import ReactiveList from './ReactiveList.js';
10
- import { h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, u as updateDefaultQuery, f as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-78920565.js';
11
- import { C as ComponentWrapper } from './ComponentWrapper-0f3431d1.js';
12
- import { T as Title } from './Title-3522ff56.js';
10
+ import { n as decodeHtml, h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, u as updateDefaultQuery, f as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-4715798c.js';
11
+ import { C as ComponentWrapper } from './ComponentWrapper-ca0354ea.js';
12
+ import { T as Title } from './Title-35edd732.js';
13
13
  import ReactiveBase from './ReactiveBase.js';
14
14
  import hotkeys from 'hotkeys-js';
15
- import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, b as InputGroup, C as CustomSvg, c as SuggestionItem, D as DataSearch } from './DataSearch-42f547cd.js';
16
- import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-c2c03a35.js';
17
- import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-e339e63a.js';
18
- import { C as Container } from './Container-18b03fde.js';
15
+ import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, b as TagsContainer, c as InputGroup, C as CustomSvg, d as SuggestionItem, D as DataSearch } from './DataSearch-da9347f7.js';
16
+ import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-e3b33cdd.js';
17
+ import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-c9d757bc.js';
18
+ import { C as Container } from './Container-421450dc.js';
19
19
  import SingleList from './SingleList.js';
20
20
  import MultiList from './MultiList.js';
21
21
  import SingleDropdownList from './SingleDropdownList.js';
@@ -74,10 +74,12 @@ var _debounce = helper.debounce,
74
74
  normalizeDataField = helper.normalizeDataField;
75
75
  var SearchBox = {
76
76
  name: 'SearchBox',
77
+ isTagsMode: false,
77
78
  data: function data() {
78
79
  var props = this.$props;
79
80
  this.__state = {
80
81
  currentValue: '',
82
+ selectedTags: [],
81
83
  isOpen: false,
82
84
  normalizedSuggestions: []
83
85
  };
@@ -93,7 +95,16 @@ var SearchBox = {
93
95
  var _this$$props = this.$props,
94
96
  distinctField = _this$$props.distinctField,
95
97
  distinctFieldConfig = _this$$props.distinctFieldConfig,
96
- index = _this$$props.index;
98
+ index = _this$$props.index,
99
+ mode = _this$$props.mode;
100
+
101
+ if (mode === SEARCH_COMPONENTS_MODES.TAG) {
102
+ this.$options.isTagsMode = true;
103
+ }
104
+
105
+ if (this.$options.isTagsMode) {
106
+ console.warn('Warning(ReactiveSearch): The `categoryField` prop is not supported when `mode` prop is set to `tag`');
107
+ }
97
108
 
98
109
  if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
99
110
  console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
@@ -107,9 +118,13 @@ var SearchBox = {
107
118
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
108
119
  }
109
120
 
110
- this.currentValue = this.selectedValue || this.value || this.defaultValue || '';
111
- this.handleTextChange = _debounce(this.handleText, this.$props.debounce);
112
- this.setValue(this.currentValue, true, this.$props, undefined, false, this.selectedCategory); // Set custom and default queries in store
121
+ this.currentValue = decodeHtml(this.selectedValue || this.value || this.defaultValue || '');
122
+
123
+ if (this.$options.isTagsMode) {
124
+ this.currentValue = '';
125
+ }
126
+
127
+ this.handleTextChange = _debounce(this.handleText, this.$props.debounce); // Set custom and default queries in store
113
128
 
114
129
  this.triggerCustomQuery(this.currentValue, this.selectedCategory);
115
130
  this.triggerDefaultQuery(this.currentValue);
@@ -145,7 +160,7 @@ var SearchBox = {
145
160
  debounce: VueTypes.number.def(0),
146
161
  defaultValue: types.string,
147
162
  excludeFields: types.excludeFields,
148
- value: types.value,
163
+ value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), types.value]),
149
164
  defaultSuggestions: types.suggestions,
150
165
  enableSynonyms: VueTypes.bool.def(true),
151
166
  enableQuerySuggestions: VueTypes.bool.def(false),
@@ -198,7 +213,20 @@ var SearchBox = {
198
213
  onData: types.func,
199
214
  renderItem: types.func,
200
215
  enterButton: VueTypes.bool.def(false),
201
- renderEnterButton: VueTypes.any
216
+ renderEnterButton: VueTypes.any,
217
+ mode: VueTypes.oneOf(['select', 'tag']).def('select'),
218
+ renderSelectedTags: VueTypes.any,
219
+ searchboxId: VueTypes.string,
220
+ endpoint: types.endpointConfig
221
+ },
222
+ beforeMount: function beforeMount() {
223
+ if (this.selectedValue) {
224
+ this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
225
+ } else if (this.$props.value) {
226
+ this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
227
+ } else if (this.$props.defaultValue) {
228
+ this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
229
+ }
202
230
  },
203
231
  mounted: function mounted() {
204
232
  this.listenForFocusShortcuts();
@@ -248,15 +276,25 @@ var SearchBox = {
248
276
  this.normalizedSuggestions = suggestionsList;
249
277
  },
250
278
  selectedValue: function selectedValue(newVal, oldVal) {
251
- if (oldVal !== newVal && this.$data.currentValue !== newVal) {
279
+ if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
252
280
  if (!newVal && this.$data.currentValue) {
253
281
  // selected value is cleared, call onValueSelected
254
282
  this.onValueSelectedHandler('', causes.CLEAR_VALUE);
283
+ } // if (this.$props.value === undefined) {
284
+
285
+
286
+ if (this.$options.isTagsMode) {
287
+ // handling reset of tags through SelectedFilters or URL
288
+ this.selectedTags = [];
255
289
  }
256
290
 
257
- if (this.$props.value === undefined) {
258
- this.setValue(newVal || '', true, this.$props);
291
+ var cause = !newVal ? causes.CLEAR_VALUE : undefined;
292
+
293
+ if (this.$options.isTagsMode) {
294
+ cause = causes.SUGGESTION_SELECT;
259
295
  }
296
+
297
+ this.setValue(newVal || '', true, this.$props, cause); // }
260
298
  }
261
299
  },
262
300
  focusShortcuts: function focusShortcuts() {
@@ -397,7 +435,40 @@ var SearchBox = {
397
435
  }
398
436
 
399
437
  var performUpdate = function performUpdate() {
400
- _this.currentValue = value;
438
+ if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
439
+ return;
440
+ }
441
+
442
+ if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
443
+ if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
444
+ // check if value already present in selectedTags
445
+ if (typeof value === 'string' && _this.selectedTags.includes(value)) {
446
+ _this.isOpen = false;
447
+ return;
448
+ }
449
+
450
+ _this.selectedTags = [].concat(_this.selectedTags);
451
+
452
+ if (typeof value === 'string' && !!value) {
453
+ _this.selectedTags.push(value);
454
+ } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
455
+ var mergedArray = Array.from(new Set([].concat(_this.selectedTags, value)));
456
+ _this.selectedTags = mergedArray;
457
+ }
458
+ } else if (value) {
459
+ _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
460
+ }
461
+
462
+ _this.currentValue = '';
463
+ } else {
464
+ _this.currentValue = decodeHtml(value);
465
+ }
466
+
467
+ var queryHandlerValue = value;
468
+
469
+ if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
470
+ queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
471
+ }
401
472
 
402
473
  if (isDefaultValue) {
403
474
  if (_this.$props.autosuggest) {
@@ -405,19 +476,19 @@ var SearchBox = {
405
476
  _this.isOpen = false;
406
477
  }
407
478
 
408
- _this.triggerDefaultQuery(value);
479
+ if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
409
480
  } // in case of strict selection only SUGGESTION_SELECT should be able
410
481
  // to set the query otherwise the value should reset
411
482
 
412
483
 
413
484
  if (props.strictSelection) {
414
- if (cause === causes.SUGGESTION_SELECT || value === '') {
415
- _this.triggerCustomQuery(value, categoryValue);
485
+ if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
486
+ _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
416
487
  } else {
417
488
  _this.setValue('', true);
418
489
  }
419
- } else if (props.value === undefined) {
420
- _this.triggerCustomQuery(value, categoryValue);
490
+ } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
491
+ _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
421
492
  }
422
493
  } else {
423
494
  // debounce for handling text while typing
@@ -468,6 +539,11 @@ var SearchBox = {
468
539
  showFilter = _this$$props2.showFilter,
469
540
  URLParams = _this$$props2.URLParams;
470
541
  var value = typeof paramValue !== 'string' ? this.$data.currentValue : paramValue;
542
+
543
+ if (this.$options.isTagsMode) {
544
+ value = paramValue;
545
+ }
546
+
471
547
  var defaultQueryTobeSet = SearchBox.defaultQuery("" + value + (categoryValue ? " in " + categoryValue : ''), this.$props);
472
548
  var query = defaultQueryTobeSet;
473
549
 
@@ -561,7 +637,8 @@ var SearchBox = {
561
637
  if (this.$props.autosuggest === false) {
562
638
  this.enterButtonOnClick();
563
639
  } else if (highlightedIndex === null) {
564
- this.setValue(event.target.value, true);
640
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
641
+ );
565
642
  this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
566
643
  }
567
644
  } // Need to review
@@ -606,13 +683,29 @@ var SearchBox = {
606
683
  if (value === undefined) {
607
684
  this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
608
685
  } else {
609
- this.$emit('change', suggestion.value, function (_ref4) {
686
+ var emitValue = suggestion.value;
687
+
688
+ if (this.$options.isTagsMode) {
689
+ emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
690
+
691
+ if (this.selectedTags.includes(suggestion.value)) {
692
+ // avoid duplicates in tags array
693
+ this.isOpen = false;
694
+ return;
695
+ }
696
+
697
+ emitValue.push(suggestion.value);
698
+ }
699
+
700
+ this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
701
+ this.$emit('change', emitValue, function (_ref4) {
610
702
  var isOpen = _ref4.isOpen;
611
- return _this3.triggerQuery({
703
+ return _this3.triggerQuery(_extends({
612
704
  isOpen: isOpen,
613
- value: suggestion.value,
705
+ value: emitValue
706
+ }, !_this3.$options.isTagsMode && {
614
707
  categoryValue: suggestion._category
615
- });
708
+ }));
616
709
  });
617
710
  }
618
711
 
@@ -758,7 +851,7 @@ var SearchBox = {
758
851
  }
759
852
 
760
853
  return h(Button, {
761
- "class": "enter-btn " + getClassName(innerClass, 'enterButton'),
854
+ "class": "enter-btn " + getClassName(innerClass, 'enter-button'),
762
855
  "attrs": {
763
856
  "primary": true
764
857
  },
@@ -874,7 +967,7 @@ var SearchBox = {
874
967
  onAutofillClick: function onAutofillClick(suggestion) {
875
968
  var value = suggestion.value;
876
969
  this.isOpen = true;
877
- this.currentValue = value;
970
+ this.currentValue = decodeHtml(value);
878
971
  this.triggerDefaultQuery(value);
879
972
  },
880
973
  renderAutoFill: function renderAutoFill(suggestion) {
@@ -895,10 +988,79 @@ var SearchBox = {
895
988
  "click": handleAutoFillClick
896
989
  }
897
990
  });
991
+ },
992
+ renderTag: function renderTag(item) {
993
+ var _this7 = this;
994
+
995
+ var h = this.$createElement;
996
+ var innerClass = this.$props.innerClass;
997
+ return h(TagItem, {
998
+ "class": getClassName(innerClass, 'selected-tag') || ''
999
+ }, [h("span", [item]), h("span", {
1000
+ "attrs": {
1001
+ "role": "img",
1002
+ "aria-label": "delete-tag"
1003
+ },
1004
+ "class": "close-icon",
1005
+ "on": {
1006
+ "click": function click() {
1007
+ return _this7.clearTag(item);
1008
+ }
1009
+ }
1010
+ }, [h(CancelSvg)])]);
1011
+ },
1012
+ clearAllTags: function clearAllTags() {
1013
+ this.selectedTags = [];
1014
+ this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1015
+
1016
+ if (this.$props.value !== undefined) {
1017
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1018
+ }
1019
+ },
1020
+ clearTag: function clearTag(tagValue) {
1021
+ this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1022
+ return tag !== tagValue;
1023
+ }));
1024
+ this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1025
+
1026
+ if (this.$props.value !== undefined) {
1027
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1028
+ }
1029
+ },
1030
+ renderTags: function renderTags() {
1031
+ var _this8 = this;
1032
+
1033
+ var h = this.$createElement;
1034
+
1035
+ if (!Array.isArray(this.selectedTags)) {
1036
+ return null;
1037
+ }
1038
+
1039
+ var tagsList = [].concat(this.selectedTags);
1040
+ var shouldRenderClearAllTag = tagsList.length > 1;
1041
+ var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
1042
+ return renderSelectedTags ? renderSelectedTags({
1043
+ values: this.selectedTags,
1044
+ handleClear: this.clearTag,
1045
+ handleClearAll: this.clearAllTags
1046
+ }) : h(TagsContainer, [tagsList.map(function (item) {
1047
+ return _this8.renderTag(item);
1048
+ }), shouldRenderClearAllTag && h(TagItem, {
1049
+ "class": getClassName(this.$props.innerClass, 'selected-tag') || ''
1050
+ }, [h("span", ["Clear All"]), h("span", {
1051
+ "attrs": {
1052
+ "role": "img",
1053
+ "aria-label": "delete-tag"
1054
+ },
1055
+ "class": "close-icon",
1056
+ "on": {
1057
+ "click": this.clearAllTags
1058
+ }
1059
+ }, [h(CancelSvg)])])]);
898
1060
  }
899
1061
  },
900
1062
  render: function render() {
901
- var _this7 = this;
1063
+ var _this9 = this;
902
1064
 
903
1065
  var h = arguments[0];
904
1066
  var _this$$props6 = this.$props,
@@ -944,14 +1106,14 @@ var SearchBox = {
944
1106
  }
945
1107
  };
946
1108
 
947
- return h("div", [_this7.hasCustomRenderer && _this7.getComponent({
1109
+ return h("div", [_this9.hasCustomRenderer && _this9.getComponent({
948
1110
  isOpen: isOpen,
949
1111
  getItemProps: getItemProps,
950
1112
  getItemEvents: getItemEvents,
951
1113
  highlightedIndex: highlightedIndex
952
- }), _this7.renderErrorComponent(), !_this7.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
953
- "class": suggestions(_this7.themePreset, theme) + " " + getClassName(_this7.$props.innerClass, 'list')
954
- }, [_this7.normalizedSuggestions.map(function (item, index) {
1114
+ }), _this9.renderErrorComponent(), !_this9.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1115
+ "class": suggestions(_this9.themePreset, theme) + " " + getClassName(_this9.$props.innerClass, 'list')
1116
+ }, [_this9.normalizedSuggestions.map(function (item, index) {
955
1117
  return renderItem ? h("li", {
956
1118
  "domProps": _extends({}, getItemProps({
957
1119
  item: item
@@ -961,7 +1123,7 @@ var SearchBox = {
961
1123
  })),
962
1124
  "key": index + 1 + "-" + item.value,
963
1125
  "style": {
964
- backgroundColor: _this7.getBackgroundColor(highlightedIndex, index),
1126
+ backgroundColor: _this9.getBackgroundColor(highlightedIndex, index),
965
1127
  justifyContent: 'flex-start',
966
1128
  alignItems: 'center'
967
1129
  }
@@ -974,7 +1136,7 @@ var SearchBox = {
974
1136
  })),
975
1137
  "key": index + 1 + "-" + item.value,
976
1138
  "style": {
977
- backgroundColor: _this7.getBackgroundColor(highlightedIndex, index),
1139
+ backgroundColor: _this9.getBackgroundColor(highlightedIndex, index),
978
1140
  justifyContent: 'flex-start',
979
1141
  alignItems: 'center'
980
1142
  }
@@ -985,61 +1147,61 @@ var SearchBox = {
985
1147
  }
986
1148
  }, [h(CustomSvg, {
987
1149
  "attrs": {
988
- "className": getClassName(_this7.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1150
+ "className": getClassName(_this9.$props.innerClass, item._suggestion_type + "-search-icon") || null,
989
1151
  "icon": getIcon(item._suggestion_type),
990
1152
  "type": item._suggestion_type + "-search-icon"
991
1153
  }
992
1154
  })]), h(SuggestionItem, {
993
1155
  "attrs": {
994
- "currentValue": _this7.currentValue,
1156
+ "currentValue": _this9.currentValue,
995
1157
  "suggestion": item
996
1158
  }
997
- }), _this7.renderAutoFill(item)]);
998
- })]) : _this7.renderNoSuggestions(_this7.normalizedSuggestions)]);
1159
+ }), _this9.renderAutoFill(item)]);
1160
+ })]) : _this9.renderNoSuggestions(_this9.normalizedSuggestions)]);
999
1161
  };
1000
1162
 
1001
1163
  return h("div", {
1002
1164
  "class": suggestionsContainer
1003
- }, [h(InputGroup, [_this7.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1165
+ }, [h(InputGroup, [_this9.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1004
1166
  "attrs": {
1005
- "id": _this7.$props.componentId + "-input",
1006
- "showIcon": _this7.$props.showIcon,
1007
- "showClear": _this7.$props.showClear,
1008
- "iconPosition": _this7.$props.iconPosition,
1009
- "placeholder": _this7.$props.placeholder,
1010
- "autoFocus": _this7.$props.autoFocus,
1011
- "themePreset": _this7.themePreset,
1167
+ "id": _this9.$props.componentId + "-input",
1168
+ "showIcon": _this9.$props.showIcon,
1169
+ "showClear": _this9.$props.showClear,
1170
+ "iconPosition": _this9.$props.iconPosition,
1171
+ "placeholder": _this9.$props.placeholder,
1172
+ "autoFocus": _this9.$props.autoFocus,
1173
+ "themePreset": _this9.themePreset,
1012
1174
  "autocomplete": "off"
1013
1175
  },
1014
- "ref": _this7.$props.innerRef,
1015
- "class": getClassName(_this7.$props.innerClass, 'input'),
1176
+ "ref": _this9.$props.innerRef,
1177
+ "class": getClassName(_this9.$props.innerClass, 'input'),
1016
1178
  "on": _extends({}, getInputEvents({
1017
- onInput: _this7.onInputChange,
1179
+ onInput: _this9.onInputChange,
1018
1180
  onBlur: function onBlur(e) {
1019
- _this7.$emit('blur', e, _this7.triggerQuery);
1181
+ _this9.$emit('blur', e, _this9.triggerQuery);
1020
1182
  },
1021
- onFocus: _this7.handleFocus,
1183
+ onFocus: _this9.handleFocus,
1022
1184
  onKeyPress: function onKeyPress(e) {
1023
- _this7.$emit('keyPress', e, _this7.triggerQuery);
1185
+ _this9.$emit('keyPress', e, _this9.triggerQuery);
1024
1186
 
1025
- _this7.$emit('key-press', e, _this7.triggerQuery);
1187
+ _this9.$emit('key-press', e, _this9.triggerQuery);
1026
1188
  },
1027
1189
  onKeyDown: function onKeyDown(e) {
1028
- return _this7.handleKeyDown(e, highlightedIndex);
1190
+ return _this9.handleKeyDown(e, highlightedIndex);
1029
1191
  },
1030
1192
  onKeyUp: function onKeyUp(e) {
1031
- _this7.$emit('keyUp', e, _this7.triggerQuery);
1193
+ _this9.$emit('keyUp', e, _this9.triggerQuery);
1032
1194
 
1033
- _this7.$emit('key-up', e, _this7.triggerQuery);
1195
+ _this9.$emit('key-up', e, _this9.triggerQuery);
1034
1196
  },
1035
1197
  onClick: function onClick() {
1036
1198
  setHighlightedIndex(null);
1037
1199
  }
1038
1200
  })),
1039
1201
  "domProps": _extends({}, getInputProps({
1040
- value: _this7.$data.currentValue === null ? '' : _this7.$data.currentValue
1202
+ value: _this9.$data.currentValue === null ? '' : _this9.$data.currentValue
1041
1203
  }))
1042
- }), _this7.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()]), _this7.renderInputAddonAfter(), _this7.renderEnterButtonElement()]), expandSuggestionsContainer && renderSuggestionsDropdown()]);
1204
+ }), _this9.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()]), _this9.renderInputAddonAfter(), _this9.renderEnterButtonElement()]), expandSuggestionsContainer && renderSuggestionsDropdown(), _this9.renderTags()]);
1043
1205
  }
1044
1206
  }
1045
1207
  }) : h("div", {
@@ -1055,22 +1217,22 @@ var SearchBox = {
1055
1217
  },
1056
1218
  "on": _extends({}, {
1057
1219
  blur: function blur(e) {
1058
- _this7.$emit('blur', e, _this7.triggerQuery);
1220
+ _this9.$emit('blur', e, _this9.triggerQuery);
1059
1221
  },
1060
1222
  keypress: function keypress(e) {
1061
- _this7.$emit('keyPress', e, _this7.triggerQuery);
1223
+ _this9.$emit('keyPress', e, _this9.triggerQuery);
1062
1224
 
1063
- _this7.$emit('key-press', e, _this7.triggerQuery);
1225
+ _this9.$emit('key-press', e, _this9.triggerQuery);
1064
1226
  },
1065
1227
  input: this.onInputChange,
1066
1228
  focus: function focus(e) {
1067
- _this7.$emit('focus', e, _this7.triggerQuery);
1229
+ _this9.$emit('focus', e, _this9.triggerQuery);
1068
1230
  },
1069
1231
  keydown: this.handleKeyDown,
1070
1232
  keyup: function keyup(e) {
1071
- _this7.$emit('keyUp', e, _this7.triggerQuery);
1233
+ _this9.$emit('keyUp', e, _this9.triggerQuery);
1072
1234
 
1073
- _this7.$emit('key-up', e, _this7.triggerQuery);
1235
+ _this9.$emit('key-up', e, _this9.triggerQuery);
1074
1236
  }
1075
1237
  }),
1076
1238
  "domProps": _extends({}, {
@@ -1,41 +1,41 @@
1
1
  import '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import './_rollupPluginBabelHelpers-51ce1182.js';
3
3
  import 'vue-types';
4
4
  import '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import '@appbaseio/reactivecore/lib/utils/helper';
6
6
  import 'emotion';
7
7
  import '@appbaseio/vue-emotion';
8
8
  import 'polished';
9
- import './Button-33de88e6.js';
10
- import './vueTypes-687b2304.js';
9
+ import './Button-e18ad90f.js';
10
+ import './vueTypes-c0d8b875.js';
11
11
  import './ReactiveList.js';
12
12
  import '@appbaseio/reactivecore/lib/utils/transform';
13
13
  import 'redux';
14
- import './index-78920565.js';
15
- import './ComponentWrapper-0f3431d1.js';
14
+ import './index-4715798c.js';
15
+ import './ComponentWrapper-ca0354ea.js';
16
16
  import '@vue/babel-helper-vue-jsx-merge-props';
17
- import './Title-3522ff56.js';
18
- import './ListItem-8e8fb535.js';
19
- import './Card-6446f1b7.js';
20
- import './Flex-8770345d.js';
17
+ import './Title-35edd732.js';
18
+ import './ListItem-41d6ddd7.js';
19
+ import './Card-ad6ba09f.js';
20
+ import './Flex-09d40927.js';
21
21
  import '@appbaseio/reactivecore/lib/actions/analytics';
22
22
  import 'appbase-js';
23
23
  import 'url-search-params-polyfill';
24
24
  import './ReactiveBase.js';
25
25
  import 'hotkeys-js';
26
- import './DataSearch-42f547cd.js';
27
- import './CancelSvg-c2c03a35.js';
28
- import './Input-e339e63a.js';
26
+ import './DataSearch-da9347f7.js';
27
+ import './CancelSvg-e3b33cdd.js';
28
+ import './Input-c9d757bc.js';
29
29
  import 'compute-scroll-into-view';
30
- import './Container-18b03fde.js';
30
+ import './Container-421450dc.js';
31
31
  import 'vue-highlight-words';
32
- export { i as default } from './install-bd448c02.js';
32
+ export { i as default } from './install-5d9cb7ed.js';
33
33
  import '@appbaseio/reactivecore/lib/utils/suggestions';
34
- import './FormControlList-704f8dee.js';
35
- import './utils-64a2e5f0.js';
34
+ import './FormControlList-38ffe3d3.js';
35
+ import './utils-9b45e0ab.js';
36
36
  import './SingleList.js';
37
37
  import './MultiList.js';
38
- import './DropDown-ff6ad982.js';
38
+ import './DropDown-604374d2.js';
39
39
  import './SingleDropdownList.js';
40
40
  import './MultiDropdownList.js';
41
41
  import './ToggleButton.js';
@@ -46,8 +46,9 @@ import './MultiRange.js';
46
46
  import './ResultCard.js';
47
47
  import './ResultList.js';
48
48
  import 'vue-no-ssr';
49
- import './ssr-a41dfea9.js';
49
+ import './ssr-ad57b0ad.js';
50
50
  import './RangeSlider.js';
51
51
  import './DynamicRangeSlider.js';
52
+ import '@appbaseio/reactivecore/lib/actions/value';
52
53
  import './StateProvider.js';
53
54
  import './RangeInput.js';