@appbaseio/reactivesearch-vue 1.16.0-alpha.56 → 1.16.0-alpha.59

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 (87) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1763 -16121
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +8 -6
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-10e5cf51.js → Button-446f819e.js} +1 -1
  6. package/dist/cjs/{CancelSvg-82021d23.js → CancelSvg-9f258f4f.js} +1 -1
  7. package/dist/cjs/{Card-4b915733.js → Card-642547a8.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-7302fe1a.js → ComponentWrapper-ca5f0cbd.js} +2 -2
  9. package/dist/cjs/{Container-8a08d663.js → Container-daf30918.js} +1 -1
  10. package/dist/cjs/{DataSearch-7fd1b95d.js → DataSearch-f63fcf44.js} +221 -80
  11. package/dist/cjs/DataSearch.js +9 -9
  12. package/dist/cjs/{DropDown-16a2a728.js → DropDown-c3f83a46.js} +4 -4
  13. package/dist/cjs/DynamicRangeSlider.js +5 -5
  14. package/dist/cjs/{Flex-699639d2.js → Flex-aa517a13.js} +1 -1
  15. package/dist/cjs/{FormControlList-73497794.js → FormControlList-c195a592.js} +1 -1
  16. package/dist/cjs/{Input-64087a69.js → Input-e6603a7e.js} +1 -1
  17. package/dist/cjs/{ListItem-933c27e4.js → ListItem-8c9e0d68.js} +2 -2
  18. package/dist/cjs/MultiDropdownList.js +10 -10
  19. package/dist/cjs/MultiList.js +8 -8
  20. package/dist/cjs/MultiRange.js +6 -6
  21. package/dist/cjs/{Pagination-e0654529.js → Pagination-c01d1547.js} +1 -1
  22. package/dist/cjs/RangeInput.js +8 -8
  23. package/dist/cjs/RangeSlider.js +6 -6
  24. package/dist/cjs/ReactiveBase.js +2 -2
  25. package/dist/cjs/ReactiveComponent.js +3 -3
  26. package/dist/cjs/ReactiveGoogleMap.js +10 -16
  27. package/dist/cjs/ReactiveList.js +9 -9
  28. package/dist/cjs/ResultCard.js +3 -3
  29. package/dist/cjs/ResultList.js +3 -3
  30. package/dist/cjs/SelectedFilters.js +44 -27
  31. package/dist/cjs/SingleDropdownList.js +10 -10
  32. package/dist/cjs/SingleList.js +8 -8
  33. package/dist/cjs/SingleRange.js +7 -7
  34. package/dist/cjs/StateProvider.js +30 -5
  35. package/dist/cjs/{Title-39765ee6.js → Title-1de7d0f4.js} +1 -1
  36. package/dist/cjs/ToggleButton.js +7 -6
  37. package/dist/cjs/{_rollupPluginBabelHelpers-4abdbfff.js → _rollupPluginBabelHelpers-c705cbe6.js} +2 -4
  38. package/dist/cjs/{index-d44a0a21.js → index-c288153a.js} +1 -1
  39. package/dist/cjs/index.js +19 -18
  40. package/dist/cjs/initReactivesearch.js +1 -1
  41. package/dist/cjs/{install-ac3374ec.js → install-a9aae115.js} +225 -65
  42. package/dist/cjs/install.js +19 -18
  43. package/dist/cjs/{ssr-c333c82c.js → ssr-3027b848.js} +1 -1
  44. package/dist/cjs/{utils-23afb20b.js → utils-d6a52588.js} +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/es/{Button-8b211174.js → Button-d8bc15ea.js} +1 -1
  47. package/dist/es/{CancelSvg-4d9e0857.js → CancelSvg-4cfae5fd.js} +1 -1
  48. package/dist/es/{Card-04b3c33e.js → Card-450683f1.js} +2 -2
  49. package/dist/es/{ComponentWrapper-bbb717bc.js → ComponentWrapper-6ad0997b.js} +2 -2
  50. package/dist/es/{Container-4383c6f0.js → Container-ba826e96.js} +1 -1
  51. package/dist/es/{DataSearch-a5aaa29e.js → DataSearch-1dba393f.js} +221 -82
  52. package/dist/es/DataSearch.js +9 -9
  53. package/dist/es/{DropDown-7639f223.js → DropDown-2ddad7ae.js} +4 -4
  54. package/dist/es/DynamicRangeSlider.js +5 -5
  55. package/dist/es/{Flex-aac91505.js → Flex-1f0795c3.js} +1 -1
  56. package/dist/es/{FormControlList-fe389a2e.js → FormControlList-c22d64f6.js} +1 -1
  57. package/dist/es/{Input-d1bb4868.js → Input-7a2a9fac.js} +1 -1
  58. package/dist/es/{ListItem-bdb6d53d.js → ListItem-cad14c5e.js} +2 -2
  59. package/dist/es/MultiDropdownList.js +10 -10
  60. package/dist/es/MultiList.js +8 -8
  61. package/dist/es/MultiRange.js +6 -6
  62. package/dist/es/{Pagination-3c50d4ba.js → Pagination-491c44ee.js} +1 -1
  63. package/dist/es/RangeInput.js +8 -8
  64. package/dist/es/RangeSlider.js +6 -6
  65. package/dist/es/ReactiveBase.js +2 -2
  66. package/dist/es/ReactiveComponent.js +3 -3
  67. package/dist/es/ReactiveGoogleMap.js +10 -16
  68. package/dist/es/ReactiveList.js +9 -9
  69. package/dist/es/ResultCard.js +3 -3
  70. package/dist/es/ResultList.js +3 -3
  71. package/dist/es/SelectedFilters.js +44 -27
  72. package/dist/es/SingleDropdownList.js +10 -10
  73. package/dist/es/SingleList.js +8 -8
  74. package/dist/es/SingleRange.js +7 -7
  75. package/dist/es/StateProvider.js +30 -5
  76. package/dist/es/{Title-579f8d6c.js → Title-3342664a.js} +1 -1
  77. package/dist/es/ToggleButton.js +7 -6
  78. package/dist/es/{_rollupPluginBabelHelpers-ecf6c03c.js → _rollupPluginBabelHelpers-76660dab.js} +2 -4
  79. package/dist/es/{index-5daa8276.js → index-3d98f51b.js} +1 -1
  80. package/dist/es/index.js +20 -19
  81. package/dist/es/initReactivesearch.js +1 -1
  82. package/dist/es/{install-cdccc63e.js → install-686dd71d.js} +226 -66
  83. package/dist/es/install.js +19 -18
  84. package/dist/es/{ssr-e3196de1.js → ssr-b2c0b401.js} +1 -1
  85. package/dist/es/{utils-3a32e13f.js → utils-9e68acee.js} +1 -1
  86. package/dist/es/version.js +1 -1
  87. package/package.json +2 -2
@@ -2,7 +2,7 @@
2
2
 
3
3
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
4
 
5
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
5
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
6
6
  var emotion = require('emotion');
7
7
  var styled = require('@appbaseio/vue-emotion');
8
8
  var styled__default = _interopDefault(styled);
@@ -2,7 +2,7 @@
2
2
 
3
3
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
4
 
5
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
5
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
6
6
  var styled = require('@appbaseio/vue-emotion');
7
7
  var styled__default = _interopDefault(styled);
8
8
  var computeScrollIntoView = _interopDefault(require('compute-scroll-into-view'));
@@ -2,12 +2,12 @@
2
2
 
3
3
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
4
 
5
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
5
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
6
6
  var emotion = require('emotion');
7
7
  var styled = require('@appbaseio/vue-emotion');
8
8
  var styled__default = _interopDefault(styled);
9
9
  var polished = require('polished');
10
- require('./Title-39765ee6.js');
10
+ require('./Title-1de7d0f4.js');
11
11
 
12
12
  var _templateObject, _templateObject2, _templateObject3;
13
13
  var container = emotion.css(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: row;\n\tjustify-content: center;\n\tflex-wrap: wrap;\n\tmargin: 0 -8px;\n\n\t@media (max-width: 420px) {\n\t\tmargin: 0;\n\t}\n"])));
@@ -4,11 +4,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
4
4
 
5
5
  var configureStore = require('@appbaseio/reactivecore');
6
6
  var configureStore__default = _interopDefault(configureStore);
7
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
7
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
8
8
  var VueTypes = _interopDefault(require('vue-types'));
9
9
  var constants = require('@appbaseio/reactivecore/lib/utils/constants');
10
10
  var transform = require('@appbaseio/reactivecore/lib/utils/transform');
11
- var index = require('./index-d44a0a21.js');
11
+ var index = require('./index-c288153a.js');
12
12
 
13
13
  var addComponent = configureStore.Actions.addComponent,
14
14
  removeComponent = configureStore.Actions.removeComponent,
@@ -2,7 +2,7 @@
2
2
 
3
3
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
4
 
5
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
5
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
6
6
  var styled = require('@appbaseio/vue-emotion');
7
7
  var styled__default = _interopDefault(styled);
8
8
 
@@ -4,21 +4,21 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
4
4
 
5
5
  var configureStore = require('@appbaseio/reactivecore');
6
6
  var configureStore__default = _interopDefault(configureStore);
7
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
7
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
8
8
  var VueTypes = _interopDefault(require('vue-types'));
9
9
  var constants = require('@appbaseio/reactivecore/lib/utils/constants');
10
10
  var helper = require('@appbaseio/reactivecore/lib/utils/helper');
11
11
  var styled = require('@appbaseio/vue-emotion');
12
12
  var styled__default = _interopDefault(styled);
13
13
  var vueTypes = require('./vueTypes-6de9d2a9.js');
14
- var index = require('./index-d44a0a21.js');
15
- var ComponentWrapper = require('./ComponentWrapper-7302fe1a.js');
16
- var Title = require('./Title-39765ee6.js');
17
- var Flex = require('./Flex-699639d2.js');
14
+ var index = require('./index-c288153a.js');
15
+ var ComponentWrapper = require('./ComponentWrapper-ca5f0cbd.js');
16
+ var Title = require('./Title-1de7d0f4.js');
17
+ var Flex = require('./Flex-aa517a13.js');
18
18
  var hotkeys = _interopDefault(require('hotkeys-js'));
19
- var CancelSvg = require('./CancelSvg-82021d23.js');
20
- var Input = require('./Input-64087a69.js');
21
- var Container = require('./Container-8a08d663.js');
19
+ var CancelSvg = require('./CancelSvg-9f258f4f.js');
20
+ var Input = require('./Input-e6603a7e.js');
21
+ var Container = require('./Container-daf30918.js');
22
22
  var Highlight = _interopDefault(require('vue-highlight-words'));
23
23
 
24
24
  var _templateObject;
@@ -904,6 +904,10 @@ var CustomSvg = {
904
904
  }
905
905
  };
906
906
 
907
+ var _templateObject$6, _templateObject2;
908
+ var TagsContainer = styled__default('div')(_templateObject$6 || (_templateObject$6 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
909
+ var TagItem = styled__default('span')(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
910
+
907
911
  var updateQuery = configureStore.Actions.updateQuery,
908
912
  setQueryOptions = configureStore.Actions.setQueryOptions,
909
913
  setCustomQuery = configureStore.Actions.setCustomQuery,
@@ -927,10 +931,12 @@ var debounce = configureStore.helper.debounce,
927
931
  normalizeDataField = configureStore.helper.normalizeDataField;
928
932
  var DataSearch = {
929
933
  name: 'DataSearch',
934
+ isTagsMode: false,
930
935
  data: function data() {
931
936
  var props = this.$props;
932
937
  this.__state = {
933
938
  currentValue: '',
939
+ selectedTags: [],
934
940
  isOpen: false,
935
941
  normalizedSuggestions: [],
936
942
  isPending: false
@@ -950,7 +956,13 @@ var DataSearch = {
950
956
  enableRecentSearches = _this$$props.enableRecentSearches,
951
957
  distinctField = _this$$props.distinctField,
952
958
  distinctFieldConfig = _this$$props.distinctFieldConfig,
953
- index$1 = _this$$props.index; // TODO: Remove in 2.0
959
+ index$1 = _this$$props.index,
960
+ mode = _this$$props.mode;
961
+
962
+ if (mode === constants.SEARCH_COMPONENTS_MODES.TAG) {
963
+ this.$options.isTagsMode = true;
964
+ } // TODO: Remove in 2.0
965
+
954
966
 
955
967
  if (enableQuerySuggestions) {
956
968
  console.warn('Warning(ReactiveSearch): The `enableQuerySuggestions` prop has been marked as deprecated, please use the `enablePopularSuggestions` prop instead.');
@@ -973,7 +985,12 @@ var DataSearch = {
973
985
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
974
986
  }
975
987
 
976
- this.currentValue = this.selectedValue || '';
988
+ this.currentValue = '';
989
+
990
+ if (this.$options.isTagsMode) {
991
+ this.currentValue = '';
992
+ }
993
+
977
994
  var shouldFetchInitialSuggestions = this.$props.enableDefaultSuggestions || this.currentValue;
978
995
 
979
996
  if (shouldFetchInitialSuggestions) {
@@ -1067,7 +1084,7 @@ var DataSearch = {
1067
1084
  debounce: VueTypes.number.def(0),
1068
1085
  defaultValue: vueTypes.types.string,
1069
1086
  excludeFields: vueTypes.types.excludeFields,
1070
- value: vueTypes.types.value,
1087
+ value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), vueTypes.types.value]),
1071
1088
  defaultSuggestions: vueTypes.types.suggestions,
1072
1089
  enableSynonyms: VueTypes.bool.def(true),
1073
1090
  enableQuerySuggestions: VueTypes.bool.def(false),
@@ -1116,7 +1133,9 @@ var DataSearch = {
1116
1133
  addonAfter: VueTypes.any,
1117
1134
  expandSuggestionsContainer: VueTypes.bool.def(true),
1118
1135
  index: VueTypes.string,
1119
- enableDefaultSuggestions: VueTypes.bool.def(true)
1136
+ enableDefaultSuggestions: VueTypes.bool.def(true),
1137
+ mode: VueTypes.oneOf(['select', 'tag']).def('select'),
1138
+ renderSelectedTags: VueTypes.any
1120
1139
  },
1121
1140
  beforeMount: function beforeMount() {
1122
1141
  if (this.$props.highlight) {
@@ -1133,11 +1152,11 @@ var DataSearch = {
1133
1152
  }
1134
1153
 
1135
1154
  if (this.selectedValue) {
1136
- this.setValue(this.selectedValue, true);
1155
+ this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
1137
1156
  } else if (this.$props.value) {
1138
- this.setValue(this.$props.value, true);
1157
+ this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
1139
1158
  } else if (this.$props.defaultValue) {
1140
- this.setValue(this.$props.defaultValue, true);
1159
+ this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
1141
1160
  }
1142
1161
  },
1143
1162
  mounted: function mounted() {
@@ -1149,19 +1168,19 @@ var DataSearch = {
1149
1168
  },
1150
1169
  dataField: function dataField() {
1151
1170
  this.updateQueryOptions();
1152
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1171
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1153
1172
  },
1154
1173
  highlightField: function highlightField() {
1155
1174
  this.updateQueryOptions();
1156
1175
  },
1157
1176
  fieldWeights: function fieldWeights() {
1158
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1177
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1159
1178
  },
1160
1179
  fuzziness: function fuzziness() {
1161
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1180
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1162
1181
  },
1163
1182
  queryFormat: function queryFormat() {
1164
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1183
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1165
1184
  },
1166
1185
  defaultValue: function defaultValue(newVal) {
1167
1186
  this.setValue(newVal, true, this.$props);
@@ -1190,13 +1209,18 @@ var DataSearch = {
1190
1209
  }
1191
1210
  },
1192
1211
  selectedValue: function selectedValue(newVal, oldVal) {
1193
- if (oldVal !== newVal && this.$data.currentValue !== newVal) {
1212
+ if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
1194
1213
  if (!newVal && this.$data.currentValue) {
1195
1214
  // selected value is cleared, call onValueSelected
1196
1215
  this.onValueSelectedHandler('', configureStore.causes.CLEAR_VALUE);
1197
1216
  }
1198
1217
 
1199
- this.setValue(newVal || '', true, this.$props);
1218
+ if (this.$options.isTagsMode) {
1219
+ // handling reset of tags through SelectedFilters or URL
1220
+ this.selectedTags = [];
1221
+ }
1222
+
1223
+ this.setValue(newVal || '', true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
1200
1224
  }
1201
1225
  },
1202
1226
  focusShortcuts: function focusShortcuts() {
@@ -1323,14 +1347,47 @@ var DataSearch = {
1323
1347
  }
1324
1348
 
1325
1349
  var performUpdate = function performUpdate() {
1326
- // Refresh recent searches when value becomes empty
1350
+ if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
1351
+ return;
1352
+ } // Refresh recent searches when value becomes empty
1353
+
1354
+
1327
1355
  if (!value && props.enableDefaultSuggestions === false) {
1328
1356
  _this.resetStoreForComponent(props.componentId);
1329
1357
  } else if (!value && _this.currentValue && _this.enableRecentSearches) {
1330
1358
  _this.getRecentSearches();
1331
1359
  }
1332
1360
 
1333
- _this.currentValue = value;
1361
+ if (_this.$options.isTagsMode && cause === configureStore.causes.SUGGESTION_SELECT) {
1362
+ if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1363
+ // check if value already present in selectedTags
1364
+ if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1365
+ _this.isOpen = false;
1366
+ return;
1367
+ }
1368
+
1369
+ _this.selectedTags = [].concat(_this.selectedTags);
1370
+
1371
+ if (typeof value === 'string' && !!value) {
1372
+ _this.selectedTags.push(value);
1373
+ } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1374
+ var mergedArray = Array.from(new Set([].concat(_this.selectedTags, value)));
1375
+ _this.selectedTags = mergedArray;
1376
+ }
1377
+ } else if (value) {
1378
+ _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1379
+ }
1380
+
1381
+ _this.currentValue = '';
1382
+ } else {
1383
+ _this.currentValue = value;
1384
+ }
1385
+
1386
+ var queryHandlerValue = value;
1387
+
1388
+ if (_this.$options.isTagsMode && cause === configureStore.causes.SUGGESTION_SELECT) {
1389
+ queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1390
+ }
1334
1391
 
1335
1392
  if (isDefaultValue) {
1336
1393
  if (_this.$props.autosuggest) {
@@ -1338,19 +1395,19 @@ var DataSearch = {
1338
1395
  _this.isOpen = false;
1339
1396
  }
1340
1397
 
1341
- _this.updateDefaultQueryHandler(value, _this.$props);
1398
+ if (typeof value === 'string') _this.updateDefaultQueryHandler(value, _this.$props);
1342
1399
  } // in case of strict selection only SUGGESTION_SELECT should be able
1343
1400
  // to set the query otherwise the value should reset
1344
1401
 
1345
1402
 
1346
1403
  if (props.strictSelection) {
1347
- if (cause === configureStore.causes.SUGGESTION_SELECT || value === '') {
1348
- _this.updateQueryHandler(props.componentId, value, props);
1404
+ if (cause === configureStore.causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1405
+ _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
1349
1406
  } else {
1350
1407
  _this.setValue('', true);
1351
1408
  }
1352
1409
  } else {
1353
- _this.updateQueryHandler(props.componentId, value, props);
1410
+ _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
1354
1411
  }
1355
1412
  } else {
1356
1413
  // debounce for handling text while typing
@@ -1496,7 +1553,8 @@ var DataSearch = {
1496
1553
 
1497
1554
 
1498
1555
  if (event.key === 'Enter' && highlightedIndex === null) {
1499
- this.setValue(event.target.value, true);
1556
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined // to handle tags
1557
+ );
1500
1558
  this.onValueSelectedHandler(event.target.value, configureStore.causes.ENTER_PRESS);
1501
1559
  } // Need to review
1502
1560
 
@@ -1527,11 +1585,23 @@ var DataSearch = {
1527
1585
 
1528
1586
  if (value === undefined) {
1529
1587
  this.setValue(suggestion.value, true, this.$props, configureStore.causes.SUGGESTION_SELECT);
1588
+ } else if (this.$options.isTagsMode) {
1589
+ var emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
1590
+
1591
+ if (this.selectedTags.includes(suggestion.value)) {
1592
+ // avoid duplicates in tags array
1593
+ this.isOpen = false;
1594
+ return;
1595
+ }
1596
+
1597
+ emitValue.push(suggestion.value);
1598
+ this.setValue(emitValue, true, this.$props, configureStore.causes.SUGGESTION_SELECT, true);
1599
+ this.$emit('change', emitValue, this.triggerQuery);
1530
1600
  } else {
1531
- this.isPending = false;
1532
1601
  this.$emit('change', suggestion.value, this.triggerQuery);
1533
1602
  }
1534
1603
 
1604
+ this.isPending = false;
1535
1605
  this.onValueSelectedHandler(suggestion.value, configureStore.causes.SUGGESTION_SELECT, suggestion.source);
1536
1606
  },
1537
1607
  onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
@@ -1637,6 +1707,75 @@ var DataSearch = {
1637
1707
 
1638
1708
  return null;
1639
1709
  },
1710
+ renderTag: function renderTag(item) {
1711
+ var _this2 = this;
1712
+
1713
+ var h = this.$createElement;
1714
+ var innerClass = this.$props.innerClass;
1715
+ return h(TagItem, {
1716
+ "class": getClassName$1(innerClass, 'selected-tag') || ''
1717
+ }, [h("span", [item]), h("span", {
1718
+ "attrs": {
1719
+ "role": "img",
1720
+ "aria-label": "delete-tag"
1721
+ },
1722
+ "class": "close-icon",
1723
+ "on": {
1724
+ "click": function click() {
1725
+ return _this2.clearTag(item);
1726
+ }
1727
+ }
1728
+ }, [h(CancelSvg.CancelSvg)])]);
1729
+ },
1730
+ clearAllTags: function clearAllTags() {
1731
+ this.selectedTags = [];
1732
+ this.setValue('', true, this.$props, configureStore.causes.SUGGESTION_SELECT);
1733
+
1734
+ if (this.$props.value !== undefined) {
1735
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1736
+ }
1737
+ },
1738
+ clearTag: function clearTag(tagValue) {
1739
+ this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1740
+ return tag !== tagValue;
1741
+ }));
1742
+ this.setValue('', true, this.$props, configureStore.causes.SUGGESTION_SELECT);
1743
+
1744
+ if (this.$props.value !== undefined) {
1745
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1746
+ }
1747
+ },
1748
+ renderTags: function renderTags() {
1749
+ var _this3 = this;
1750
+
1751
+ var h = this.$createElement;
1752
+
1753
+ if (!Array.isArray(this.selectedTags)) {
1754
+ return null;
1755
+ }
1756
+
1757
+ var tagsList = [].concat(this.selectedTags);
1758
+ var shouldRenderClearAllTag = tagsList.length > 1;
1759
+ var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
1760
+ return renderSelectedTags ? renderSelectedTags({
1761
+ values: this.selectedTags,
1762
+ handleClear: this.clearTag,
1763
+ handleClearAll: this.clearAllTags
1764
+ }) : h(TagsContainer, [tagsList.map(function (item) {
1765
+ return _this3.renderTag(item);
1766
+ }), shouldRenderClearAllTag && h(TagItem, {
1767
+ "class": getClassName$1(this.$props.innerClass, 'selected-tag') || ''
1768
+ }, [h("span", ["Clear All"]), h("span", {
1769
+ "attrs": {
1770
+ "role": "img",
1771
+ "aria-label": "delete-tag"
1772
+ },
1773
+ "class": "close-icon",
1774
+ "on": {
1775
+ "click": this.clearAllTags
1776
+ }
1777
+ }, [h(CancelSvg.CancelSvg)])])]);
1778
+ },
1640
1779
  renderInputAddonAfter: function renderInputAddonAfter() {
1641
1780
  var h = this.$createElement;
1642
1781
  var addonAfter = this.$scopedSlots.addonAfter;
@@ -1707,7 +1846,7 @@ var DataSearch = {
1707
1846
  (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
1708
1847
  },
1709
1848
  listenForFocusShortcuts: function listenForFocusShortcuts() {
1710
- var _this2 = this;
1849
+ var _this4 = this;
1711
1850
 
1712
1851
  var _this$$props$focusSho = this.$props.focusShortcuts,
1713
1852
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
@@ -1725,7 +1864,7 @@ var DataSearch = {
1725
1864
  // Prevent the default refresh event under WINDOWS system
1726
1865
  event.preventDefault();
1727
1866
 
1728
- _this2.focusSearchBox(event);
1867
+ _this4.focusSearchBox(event);
1729
1868
  }); // if one of modifier keys are used, they are handled below
1730
1869
 
1731
1870
  hotkeys('*', function (event) {
@@ -1736,7 +1875,7 @@ var DataSearch = {
1736
1875
  var element = modifierKeys[index$1];
1737
1876
 
1738
1877
  if (hotkeys[element]) {
1739
- _this2.focusSearchBox(event);
1878
+ _this4.focusSearchBox(event);
1740
1879
 
1741
1880
  break;
1742
1881
  }
@@ -1745,7 +1884,7 @@ var DataSearch = {
1745
1884
  }
1746
1885
  },
1747
1886
  render: function render() {
1748
- var _this3 = this;
1887
+ var _this5 = this;
1749
1888
 
1750
1889
  var h = arguments[0];
1751
1890
  var _this$$props4 = this.$props,
@@ -1784,14 +1923,14 @@ var DataSearch = {
1784
1923
  setHighlightedIndex = _ref3.setHighlightedIndex;
1785
1924
 
1786
1925
  var renderSuggestionsContainer = function renderSuggestionsContainer() {
1787
- return h("div", [_this3.hasCustomRenderer && _this3.getComponent({
1926
+ return h("div", [_this5.hasCustomRenderer && _this5.getComponent({
1788
1927
  isOpen: isOpen,
1789
1928
  getItemProps: getItemProps,
1790
1929
  getItemEvents: getItemEvents,
1791
1930
  highlightedIndex: highlightedIndex
1792
- }), _this3.renderErrorComponent(), !_this3.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1793
- "class": Input.suggestions(_this3.themePreset, theme) + " " + getClassName$1(_this3.$props.innerClass, 'list')
1794
- }, [_this3.suggestionsList.slice(0, size || 10).map(function (item, index) {
1931
+ }), _this5.renderErrorComponent(), !_this5.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1932
+ "class": Input.suggestions(_this5.themePreset, theme) + " " + getClassName$1(_this5.$props.innerClass, 'list')
1933
+ }, [_this5.suggestionsList.slice(0, size || 10).map(function (item, index) {
1795
1934
  return h("li", {
1796
1935
  "domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
1797
1936
  item: item
@@ -1801,15 +1940,15 @@ var DataSearch = {
1801
1940
  })),
1802
1941
  "key": index + 1 + "-" + item.value,
1803
1942
  "style": {
1804
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, index)
1943
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, index)
1805
1944
  }
1806
1945
  }, [h(SuggestionItem, {
1807
1946
  "attrs": {
1808
- "currentValue": _this3.currentValue,
1947
+ "currentValue": _this5.currentValue,
1809
1948
  "suggestion": item
1810
1949
  }
1811
1950
  })]);
1812
- }), _this3.defaultSearchSuggestions.map(function (sugg, index) {
1951
+ }), _this5.defaultSearchSuggestions.map(function (sugg, index) {
1813
1952
  return h("li", {
1814
1953
  "domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
1815
1954
  item: sugg
@@ -1817,9 +1956,9 @@ var DataSearch = {
1817
1956
  "on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
1818
1957
  item: sugg
1819
1958
  })),
1820
- "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1959
+ "key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
1821
1960
  "style": {
1822
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
1961
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
1823
1962
  justifyContent: 'flex-start'
1824
1963
  }
1825
1964
  }, [h("div", {
@@ -1828,28 +1967,28 @@ var DataSearch = {
1828
1967
  }
1829
1968
  }, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
1830
1969
  "attrs": {
1831
- "className": getClassName$1(_this3.$props.innerClass, 'recent-search-icon') || null,
1970
+ "className": getClassName$1(_this5.$props.innerClass, 'recent-search-icon') || null,
1832
1971
  "icon": recentSearchesIcon,
1833
1972
  "type": "recent-search-icon"
1834
1973
  }
1835
1974
  }), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
1836
1975
  "attrs": {
1837
- "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
1976
+ "className": getClassName$1(_this5.$props.innerClass, 'popular-search-icon') || null,
1838
1977
  "icon": popularSearchesIcon,
1839
1978
  "type": "popular-search-icon"
1840
1979
  }
1841
1980
  })]), h(SuggestionItem, {
1842
1981
  "attrs": {
1843
- "currentValue": _this3.currentValue,
1982
+ "currentValue": _this5.currentValue,
1844
1983
  "suggestion": sugg
1845
1984
  }
1846
1985
  })]);
1847
- }), index.hasQuerySuggestionsRenderer(_this3) ? _this3.getComponent({
1986
+ }), index.hasQuerySuggestionsRenderer(_this5) ? _this5.getComponent({
1848
1987
  isOpen: isOpen,
1849
1988
  getItemProps: getItemProps,
1850
1989
  getItemEvents: getItemEvents,
1851
1990
  highlightedIndex: highlightedIndex
1852
- }, true) : _this3.topSuggestions.map(function (sugg, index) {
1991
+ }, true) : _this5.topSuggestions.map(function (sugg, index) {
1853
1992
  return h("li", {
1854
1993
  "domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
1855
1994
  item: sugg
@@ -1857,9 +1996,9 @@ var DataSearch = {
1857
1996
  "on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
1858
1997
  item: sugg
1859
1998
  })),
1860
- "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1999
+ "key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
1861
2000
  "style": {
1862
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
2001
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
1863
2002
  justifyContent: 'flex-start'
1864
2003
  }
1865
2004
  }, [h("div", {
@@ -1868,61 +2007,61 @@ var DataSearch = {
1868
2007
  }
1869
2008
  }, [h(CustomSvg, {
1870
2009
  "attrs": {
1871
- "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
2010
+ "className": getClassName$1(_this5.$props.innerClass, 'popular-search-icon') || null,
1872
2011
  "icon": popularSearchesIcon,
1873
2012
  "type": "popular-search-icon"
1874
2013
  }
1875
2014
  })]), h(SuggestionItem, {
1876
2015
  "attrs": {
1877
- "currentValue": _this3.currentValue,
2016
+ "currentValue": _this5.currentValue,
1878
2017
  "suggestion": sugg
1879
2018
  }
1880
2019
  })]);
1881
- })]) : _this3.renderNoSuggestions(_this3.suggestionsList)]);
2020
+ })]) : _this5.renderNoSuggestions(_this5.suggestionsList)]);
1882
2021
  };
1883
2022
 
1884
2023
  return h("div", {
1885
2024
  "class": Input.suggestionsContainer
1886
- }, [h(InputGroup, [_this3.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
2025
+ }, [h(InputGroup, [_this5.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
1887
2026
  "attrs": {
1888
- "id": _this3.$props.componentId + "-input",
1889
- "showIcon": _this3.$props.showIcon,
1890
- "showClear": _this3.$props.showClear,
1891
- "iconPosition": _this3.$props.iconPosition,
1892
- "placeholder": _this3.$props.placeholder,
1893
- "autoFocus": _this3.$props.autoFocus,
1894
- "themePreset": _this3.themePreset,
2027
+ "id": _this5.$props.componentId + "-input",
2028
+ "showIcon": _this5.$props.showIcon,
2029
+ "showClear": _this5.$props.showClear,
2030
+ "iconPosition": _this5.$props.iconPosition,
2031
+ "placeholder": _this5.$props.placeholder,
2032
+ "autoFocus": _this5.$props.autoFocus,
2033
+ "themePreset": _this5.themePreset,
1895
2034
  "autocomplete": "off"
1896
2035
  },
1897
- "ref": _this3.$props.innerRef,
1898
- "class": getClassName$1(_this3.$props.innerClass, 'input'),
2036
+ "ref": _this5.$props.innerRef,
2037
+ "class": getClassName$1(_this5.$props.innerClass, 'input'),
1899
2038
  "on": _rollupPluginBabelHelpers._extends({}, getInputEvents({
1900
- onInput: _this3.onInputChange,
2039
+ onInput: _this5.onInputChange,
1901
2040
  onBlur: function onBlur(e) {
1902
- _this3.$emit('blur', e, _this3.triggerQuery);
2041
+ _this5.$emit('blur', e, _this5.triggerQuery);
1903
2042
  },
1904
- onFocus: _this3.handleFocus,
2043
+ onFocus: _this5.handleFocus,
1905
2044
  onKeyPress: function onKeyPress(e) {
1906
- _this3.$emit('keyPress', e, _this3.triggerQuery);
2045
+ _this5.$emit('keyPress', e, _this5.triggerQuery);
1907
2046
 
1908
- _this3.$emit('key-press', e, _this3.triggerQuery);
2047
+ _this5.$emit('key-press', e, _this5.triggerQuery);
1909
2048
  },
1910
2049
  onKeyDown: function onKeyDown(e) {
1911
- return _this3.handleKeyDown(e, highlightedIndex);
2050
+ return _this5.handleKeyDown(e, highlightedIndex);
1912
2051
  },
1913
2052
  onKeyUp: function onKeyUp(e) {
1914
- _this3.$emit('keyUp', e, _this3.triggerQuery);
2053
+ _this5.$emit('keyUp', e, _this5.triggerQuery);
1915
2054
 
1916
- _this3.$emit('key-up', e, _this3.triggerQuery);
2055
+ _this5.$emit('key-up', e, _this5.triggerQuery);
1917
2056
  },
1918
2057
  onClick: function onClick() {
1919
2058
  setHighlightedIndex(null);
1920
2059
  }
1921
2060
  })),
1922
2061
  "domProps": _rollupPluginBabelHelpers._extends({}, getInputProps({
1923
- value: _this3.$data.currentValue === null ? '' : _this3.$data.currentValue
2062
+ value: _this5.$data.currentValue === null ? '' : _this5.$data.currentValue
1924
2063
  }))
1925
- }), _this3.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this3.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer()]);
2064
+ }), _this5.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this5.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this5.renderTags()]);
1926
2065
  }
1927
2066
  }
1928
2067
  }) : h("div", {
@@ -1938,26 +2077,26 @@ var DataSearch = {
1938
2077
  },
1939
2078
  "on": _rollupPluginBabelHelpers._extends({}, {
1940
2079
  blur: function blur(e) {
1941
- _this3.$emit('blur', e, _this3.triggerQuery);
2080
+ _this5.$emit('blur', e, _this5.triggerQuery);
1942
2081
  },
1943
2082
  keypress: function keypress(e) {
1944
- _this3.$emit('keyPress', e, _this3.triggerQuery);
2083
+ _this5.$emit('keyPress', e, _this5.triggerQuery);
1945
2084
 
1946
- _this3.$emit('key-press', e, _this3.triggerQuery);
2085
+ _this5.$emit('key-press', e, _this5.triggerQuery);
1947
2086
  },
1948
2087
  input: this.onInputChange,
1949
2088
  focus: function focus(e) {
1950
- _this3.$emit('focus', e, _this3.triggerQuery);
2089
+ _this5.$emit('focus', e, _this5.triggerQuery);
1951
2090
  },
1952
2091
  keydown: function keydown(e) {
1953
- _this3.$emit('keyDown', e, _this3.triggerQuery);
2092
+ _this5.$emit('keyDown', e, _this5.triggerQuery);
1954
2093
 
1955
- _this3.$emit('key-down', e, _this3.triggerQuery);
2094
+ _this5.$emit('key-down', e, _this5.triggerQuery);
1956
2095
  },
1957
2096
  keyup: function keyup(e) {
1958
- _this3.$emit('keyUp', e, _this3.triggerQuery);
2097
+ _this5.$emit('keyUp', e, _this5.triggerQuery);
1959
2098
 
1960
- _this3.$emit('key-up', e, _this3.triggerQuery);
2099
+ _this5.$emit('key-up', e, _this5.triggerQuery);
1961
2100
  }
1962
2101
  }),
1963
2102
  "domProps": _rollupPluginBabelHelpers._extends({}, {
@@ -2179,3 +2318,5 @@ exports.Mic = Mic;
2179
2318
  exports.SearchSvg = SearchSvg;
2180
2319
  exports.SuggestionItem = SuggestionItem;
2181
2320
  exports.SuggestionWrapper = SuggestionWrapper;
2321
+ exports.TagItem = TagItem;
2322
+ exports.TagsContainer = TagsContainer;