@appbaseio/reactivesearch-vue 1.16.0-alpha.54 → 1.16.0-alpha.57

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 +7668 -5301
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +21 -5
  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-1333a6de.js} +222 -80
  11. package/dist/cjs/DataSearch.js +10 -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 +24 -24
  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 +6 -6
  34. package/dist/cjs/StateProvider.js +2 -2
  35. package/dist/cjs/{Title-39765ee6.js → Title-1de7d0f4.js} +1 -1
  36. package/dist/cjs/ToggleButton.js +6 -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 -23
  40. package/dist/cjs/initReactivesearch.js +2 -2
  41. package/dist/cjs/{install-856cc730.js → install-c771d81a.js} +227 -66
  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-1259f2fd.js} +221 -81
  52. package/dist/es/DataSearch.js +10 -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 +23 -24
  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 +6 -6
  75. package/dist/es/StateProvider.js +2 -2
  76. package/dist/es/{Title-579f8d6c.js → Title-3342664a.js} +1 -1
  77. package/dist/es/ToggleButton.js +6 -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 -24
  81. package/dist/es/initReactivesearch.js +2 -2
  82. package/dist/es/{install-d1a27419.js → install-4391877a.js} +227 -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 +4 -4
@@ -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,22 @@ 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 constants$1 = require('@appbaseio/reactivecore/src/utils/constants');
20
+ var CancelSvg = require('./CancelSvg-9f258f4f.js');
21
+ var Input = require('./Input-e6603a7e.js');
22
+ var Container = require('./Container-daf30918.js');
22
23
  var Highlight = _interopDefault(require('vue-highlight-words'));
23
24
 
24
25
  var _templateObject;
@@ -904,6 +905,10 @@ var CustomSvg = {
904
905
  }
905
906
  };
906
907
 
908
+ var _templateObject$6, _templateObject2;
909
+ 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"])));
910
+ 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"])));
911
+
907
912
  var updateQuery = configureStore.Actions.updateQuery,
908
913
  setQueryOptions = configureStore.Actions.setQueryOptions,
909
914
  setCustomQuery = configureStore.Actions.setCustomQuery,
@@ -927,10 +932,12 @@ var debounce = configureStore.helper.debounce,
927
932
  normalizeDataField = configureStore.helper.normalizeDataField;
928
933
  var DataSearch = {
929
934
  name: 'DataSearch',
935
+ isTagsMode: false,
930
936
  data: function data() {
931
937
  var props = this.$props;
932
938
  this.__state = {
933
939
  currentValue: '',
940
+ selectedTags: [],
934
941
  isOpen: false,
935
942
  normalizedSuggestions: [],
936
943
  isPending: false
@@ -950,7 +957,13 @@ var DataSearch = {
950
957
  enableRecentSearches = _this$$props.enableRecentSearches,
951
958
  distinctField = _this$$props.distinctField,
952
959
  distinctFieldConfig = _this$$props.distinctFieldConfig,
953
- index$1 = _this$$props.index; // TODO: Remove in 2.0
960
+ index$1 = _this$$props.index,
961
+ mode = _this$$props.mode;
962
+
963
+ if (mode === constants$1.SEARCH_COMPONENTS_MODES.TAG) {
964
+ this.$options.isTagsMode = true;
965
+ } // TODO: Remove in 2.0
966
+
954
967
 
955
968
  if (enableQuerySuggestions) {
956
969
  console.warn('Warning(ReactiveSearch): The `enableQuerySuggestions` prop has been marked as deprecated, please use the `enablePopularSuggestions` prop instead.');
@@ -973,7 +986,12 @@ var DataSearch = {
973
986
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
974
987
  }
975
988
 
976
- this.currentValue = this.selectedValue || '';
989
+ this.currentValue = '';
990
+
991
+ if (this.$options.isTagsMode) {
992
+ this.currentValue = '';
993
+ }
994
+
977
995
  var shouldFetchInitialSuggestions = this.$props.enableDefaultSuggestions || this.currentValue;
978
996
 
979
997
  if (shouldFetchInitialSuggestions) {
@@ -1067,7 +1085,7 @@ var DataSearch = {
1067
1085
  debounce: VueTypes.number.def(0),
1068
1086
  defaultValue: vueTypes.types.string,
1069
1087
  excludeFields: vueTypes.types.excludeFields,
1070
- value: vueTypes.types.value,
1088
+ value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), vueTypes.types.value]),
1071
1089
  defaultSuggestions: vueTypes.types.suggestions,
1072
1090
  enableSynonyms: VueTypes.bool.def(true),
1073
1091
  enableQuerySuggestions: VueTypes.bool.def(false),
@@ -1116,7 +1134,9 @@ var DataSearch = {
1116
1134
  addonAfter: VueTypes.any,
1117
1135
  expandSuggestionsContainer: VueTypes.bool.def(true),
1118
1136
  index: VueTypes.string,
1119
- enableDefaultSuggestions: VueTypes.bool.def(true)
1137
+ enableDefaultSuggestions: VueTypes.bool.def(true),
1138
+ mode: VueTypes.oneOf(['select', 'tag']).def('select'),
1139
+ renderSelectedTags: VueTypes.any
1120
1140
  },
1121
1141
  beforeMount: function beforeMount() {
1122
1142
  if (this.$props.highlight) {
@@ -1133,11 +1153,11 @@ var DataSearch = {
1133
1153
  }
1134
1154
 
1135
1155
  if (this.selectedValue) {
1136
- this.setValue(this.selectedValue, true);
1156
+ this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
1137
1157
  } else if (this.$props.value) {
1138
- this.setValue(this.$props.value, true);
1158
+ this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
1139
1159
  } else if (this.$props.defaultValue) {
1140
- this.setValue(this.$props.defaultValue, true);
1160
+ this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
1141
1161
  }
1142
1162
  },
1143
1163
  mounted: function mounted() {
@@ -1149,19 +1169,19 @@ var DataSearch = {
1149
1169
  },
1150
1170
  dataField: function dataField() {
1151
1171
  this.updateQueryOptions();
1152
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1172
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1153
1173
  },
1154
1174
  highlightField: function highlightField() {
1155
1175
  this.updateQueryOptions();
1156
1176
  },
1157
1177
  fieldWeights: function fieldWeights() {
1158
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1178
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1159
1179
  },
1160
1180
  fuzziness: function fuzziness() {
1161
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1181
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1162
1182
  },
1163
1183
  queryFormat: function queryFormat() {
1164
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1184
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1165
1185
  },
1166
1186
  defaultValue: function defaultValue(newVal) {
1167
1187
  this.setValue(newVal, true, this.$props);
@@ -1190,13 +1210,18 @@ var DataSearch = {
1190
1210
  }
1191
1211
  },
1192
1212
  selectedValue: function selectedValue(newVal, oldVal) {
1193
- if (oldVal !== newVal && this.$data.currentValue !== newVal) {
1213
+ if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
1194
1214
  if (!newVal && this.$data.currentValue) {
1195
1215
  // selected value is cleared, call onValueSelected
1196
1216
  this.onValueSelectedHandler('', configureStore.causes.CLEAR_VALUE);
1197
1217
  }
1198
1218
 
1199
- this.setValue(newVal || '', true, this.$props);
1219
+ if (this.$options.isTagsMode) {
1220
+ // handling reset of tags through SelectedFilters or URL
1221
+ this.selectedTags = [];
1222
+ }
1223
+
1224
+ this.setValue(newVal || '', true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
1200
1225
  }
1201
1226
  },
1202
1227
  focusShortcuts: function focusShortcuts() {
@@ -1323,14 +1348,47 @@ var DataSearch = {
1323
1348
  }
1324
1349
 
1325
1350
  var performUpdate = function performUpdate() {
1326
- // Refresh recent searches when value becomes empty
1351
+ if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
1352
+ return;
1353
+ } // Refresh recent searches when value becomes empty
1354
+
1355
+
1327
1356
  if (!value && props.enableDefaultSuggestions === false) {
1328
1357
  _this.resetStoreForComponent(props.componentId);
1329
1358
  } else if (!value && _this.currentValue && _this.enableRecentSearches) {
1330
1359
  _this.getRecentSearches();
1331
1360
  }
1332
1361
 
1333
- _this.currentValue = value;
1362
+ if (_this.$options.isTagsMode && cause === configureStore.causes.SUGGESTION_SELECT) {
1363
+ if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1364
+ // check if value already present in selectedTags
1365
+ if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1366
+ _this.isOpen = false;
1367
+ return;
1368
+ }
1369
+
1370
+ _this.selectedTags = [].concat(_this.selectedTags);
1371
+
1372
+ if (typeof value === 'string' && !!value) {
1373
+ _this.selectedTags.push(value);
1374
+ } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1375
+ var mergedArray = Array.from(new Set([].concat(_this.selectedTags, value)));
1376
+ _this.selectedTags = mergedArray;
1377
+ }
1378
+ } else if (value) {
1379
+ _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1380
+ }
1381
+
1382
+ _this.currentValue = '';
1383
+ } else {
1384
+ _this.currentValue = value;
1385
+ }
1386
+
1387
+ var queryHandlerValue = value;
1388
+
1389
+ if (_this.$options.isTagsMode && cause === configureStore.causes.SUGGESTION_SELECT) {
1390
+ queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1391
+ }
1334
1392
 
1335
1393
  if (isDefaultValue) {
1336
1394
  if (_this.$props.autosuggest) {
@@ -1338,19 +1396,19 @@ var DataSearch = {
1338
1396
  _this.isOpen = false;
1339
1397
  }
1340
1398
 
1341
- _this.updateDefaultQueryHandler(value, _this.$props);
1399
+ if (typeof value === 'string') _this.updateDefaultQueryHandler(value, _this.$props);
1342
1400
  } // in case of strict selection only SUGGESTION_SELECT should be able
1343
1401
  // to set the query otherwise the value should reset
1344
1402
 
1345
1403
 
1346
1404
  if (props.strictSelection) {
1347
- if (cause === configureStore.causes.SUGGESTION_SELECT || value === '') {
1348
- _this.updateQueryHandler(props.componentId, value, props);
1405
+ if (cause === configureStore.causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1406
+ _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
1349
1407
  } else {
1350
1408
  _this.setValue('', true);
1351
1409
  }
1352
1410
  } else {
1353
- _this.updateQueryHandler(props.componentId, value, props);
1411
+ _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
1354
1412
  }
1355
1413
  } else {
1356
1414
  // debounce for handling text while typing
@@ -1496,7 +1554,8 @@ var DataSearch = {
1496
1554
 
1497
1555
 
1498
1556
  if (event.key === 'Enter' && highlightedIndex === null) {
1499
- this.setValue(event.target.value, true);
1557
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined // to handle tags
1558
+ );
1500
1559
  this.onValueSelectedHandler(event.target.value, configureStore.causes.ENTER_PRESS);
1501
1560
  } // Need to review
1502
1561
 
@@ -1527,11 +1586,23 @@ var DataSearch = {
1527
1586
 
1528
1587
  if (value === undefined) {
1529
1588
  this.setValue(suggestion.value, true, this.$props, configureStore.causes.SUGGESTION_SELECT);
1589
+ } else if (this.$options.isTagsMode) {
1590
+ var emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
1591
+
1592
+ if (this.selectedTags.includes(suggestion.value)) {
1593
+ // avoid duplicates in tags array
1594
+ this.isOpen = false;
1595
+ return;
1596
+ }
1597
+
1598
+ emitValue.push(suggestion.value);
1599
+ this.setValue(emitValue, true, this.$props, configureStore.causes.SUGGESTION_SELECT, true);
1600
+ this.$emit('change', emitValue, this.triggerQuery);
1530
1601
  } else {
1531
- this.isPending = false;
1532
1602
  this.$emit('change', suggestion.value, this.triggerQuery);
1533
1603
  }
1534
1604
 
1605
+ this.isPending = false;
1535
1606
  this.onValueSelectedHandler(suggestion.value, configureStore.causes.SUGGESTION_SELECT, suggestion.source);
1536
1607
  },
1537
1608
  onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
@@ -1637,6 +1708,75 @@ var DataSearch = {
1637
1708
 
1638
1709
  return null;
1639
1710
  },
1711
+ renderTag: function renderTag(item) {
1712
+ var _this2 = this;
1713
+
1714
+ var h = this.$createElement;
1715
+ var innerClass = this.$props.innerClass;
1716
+ return h(TagItem, {
1717
+ "class": getClassName$1(innerClass, 'selected-tag') || ''
1718
+ }, [h("span", [item]), h("span", {
1719
+ "attrs": {
1720
+ "role": "img",
1721
+ "aria-label": "delete-tag"
1722
+ },
1723
+ "class": "close-icon",
1724
+ "on": {
1725
+ "click": function click() {
1726
+ return _this2.clearTag(item);
1727
+ }
1728
+ }
1729
+ }, [h(CancelSvg.CancelSvg)])]);
1730
+ },
1731
+ clearAllTags: function clearAllTags() {
1732
+ this.selectedTags = [];
1733
+ this.setValue('', true, this.$props, configureStore.causes.SUGGESTION_SELECT);
1734
+
1735
+ if (this.$props.value !== undefined) {
1736
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1737
+ }
1738
+ },
1739
+ clearTag: function clearTag(tagValue) {
1740
+ this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1741
+ return tag !== tagValue;
1742
+ }));
1743
+ this.setValue('', true, this.$props, configureStore.causes.SUGGESTION_SELECT);
1744
+
1745
+ if (this.$props.value !== undefined) {
1746
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1747
+ }
1748
+ },
1749
+ renderTags: function renderTags() {
1750
+ var _this3 = this;
1751
+
1752
+ var h = this.$createElement;
1753
+
1754
+ if (!Array.isArray(this.selectedTags)) {
1755
+ return null;
1756
+ }
1757
+
1758
+ var tagsList = [].concat(this.selectedTags);
1759
+ var shouldRenderClearAllTag = tagsList.length > 1;
1760
+ var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
1761
+ return renderSelectedTags ? renderSelectedTags({
1762
+ values: this.selectedTags,
1763
+ handleClear: this.clearTag,
1764
+ handleClearAll: this.clearAllTags
1765
+ }) : h(TagsContainer, [tagsList.map(function (item) {
1766
+ return _this3.renderTag(item);
1767
+ }), shouldRenderClearAllTag && h(TagItem, {
1768
+ "class": getClassName$1(this.$props.innerClass, 'selected-tag') || ''
1769
+ }, [h("span", ["Clear All"]), h("span", {
1770
+ "attrs": {
1771
+ "role": "img",
1772
+ "aria-label": "delete-tag"
1773
+ },
1774
+ "class": "close-icon",
1775
+ "on": {
1776
+ "click": this.clearAllTags
1777
+ }
1778
+ }, [h(CancelSvg.CancelSvg)])])]);
1779
+ },
1640
1780
  renderInputAddonAfter: function renderInputAddonAfter() {
1641
1781
  var h = this.$createElement;
1642
1782
  var addonAfter = this.$scopedSlots.addonAfter;
@@ -1707,7 +1847,7 @@ var DataSearch = {
1707
1847
  (_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
1848
  },
1709
1849
  listenForFocusShortcuts: function listenForFocusShortcuts() {
1710
- var _this2 = this;
1850
+ var _this4 = this;
1711
1851
 
1712
1852
  var _this$$props$focusSho = this.$props.focusShortcuts,
1713
1853
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
@@ -1725,7 +1865,7 @@ var DataSearch = {
1725
1865
  // Prevent the default refresh event under WINDOWS system
1726
1866
  event.preventDefault();
1727
1867
 
1728
- _this2.focusSearchBox(event);
1868
+ _this4.focusSearchBox(event);
1729
1869
  }); // if one of modifier keys are used, they are handled below
1730
1870
 
1731
1871
  hotkeys('*', function (event) {
@@ -1736,7 +1876,7 @@ var DataSearch = {
1736
1876
  var element = modifierKeys[index$1];
1737
1877
 
1738
1878
  if (hotkeys[element]) {
1739
- _this2.focusSearchBox(event);
1879
+ _this4.focusSearchBox(event);
1740
1880
 
1741
1881
  break;
1742
1882
  }
@@ -1745,7 +1885,7 @@ var DataSearch = {
1745
1885
  }
1746
1886
  },
1747
1887
  render: function render() {
1748
- var _this3 = this;
1888
+ var _this5 = this;
1749
1889
 
1750
1890
  var h = arguments[0];
1751
1891
  var _this$$props4 = this.$props,
@@ -1784,14 +1924,14 @@ var DataSearch = {
1784
1924
  setHighlightedIndex = _ref3.setHighlightedIndex;
1785
1925
 
1786
1926
  var renderSuggestionsContainer = function renderSuggestionsContainer() {
1787
- return h("div", [_this3.hasCustomRenderer && _this3.getComponent({
1927
+ return h("div", [_this5.hasCustomRenderer && _this5.getComponent({
1788
1928
  isOpen: isOpen,
1789
1929
  getItemProps: getItemProps,
1790
1930
  getItemEvents: getItemEvents,
1791
1931
  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) {
1932
+ }), _this5.renderErrorComponent(), !_this5.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1933
+ "class": Input.suggestions(_this5.themePreset, theme) + " " + getClassName$1(_this5.$props.innerClass, 'list')
1934
+ }, [_this5.suggestionsList.slice(0, size || 10).map(function (item, index) {
1795
1935
  return h("li", {
1796
1936
  "domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
1797
1937
  item: item
@@ -1801,15 +1941,15 @@ var DataSearch = {
1801
1941
  })),
1802
1942
  "key": index + 1 + "-" + item.value,
1803
1943
  "style": {
1804
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, index)
1944
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, index)
1805
1945
  }
1806
1946
  }, [h(SuggestionItem, {
1807
1947
  "attrs": {
1808
- "currentValue": _this3.currentValue,
1948
+ "currentValue": _this5.currentValue,
1809
1949
  "suggestion": item
1810
1950
  }
1811
1951
  })]);
1812
- }), _this3.defaultSearchSuggestions.map(function (sugg, index) {
1952
+ }), _this5.defaultSearchSuggestions.map(function (sugg, index) {
1813
1953
  return h("li", {
1814
1954
  "domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
1815
1955
  item: sugg
@@ -1817,9 +1957,9 @@ var DataSearch = {
1817
1957
  "on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
1818
1958
  item: sugg
1819
1959
  })),
1820
- "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1960
+ "key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
1821
1961
  "style": {
1822
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
1962
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
1823
1963
  justifyContent: 'flex-start'
1824
1964
  }
1825
1965
  }, [h("div", {
@@ -1828,28 +1968,28 @@ var DataSearch = {
1828
1968
  }
1829
1969
  }, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
1830
1970
  "attrs": {
1831
- "className": getClassName$1(_this3.$props.innerClass, 'recent-search-icon') || null,
1971
+ "className": getClassName$1(_this5.$props.innerClass, 'recent-search-icon') || null,
1832
1972
  "icon": recentSearchesIcon,
1833
1973
  "type": "recent-search-icon"
1834
1974
  }
1835
1975
  }), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
1836
1976
  "attrs": {
1837
- "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
1977
+ "className": getClassName$1(_this5.$props.innerClass, 'popular-search-icon') || null,
1838
1978
  "icon": popularSearchesIcon,
1839
1979
  "type": "popular-search-icon"
1840
1980
  }
1841
1981
  })]), h(SuggestionItem, {
1842
1982
  "attrs": {
1843
- "currentValue": _this3.currentValue,
1983
+ "currentValue": _this5.currentValue,
1844
1984
  "suggestion": sugg
1845
1985
  }
1846
1986
  })]);
1847
- }), index.hasQuerySuggestionsRenderer(_this3) ? _this3.getComponent({
1987
+ }), index.hasQuerySuggestionsRenderer(_this5) ? _this5.getComponent({
1848
1988
  isOpen: isOpen,
1849
1989
  getItemProps: getItemProps,
1850
1990
  getItemEvents: getItemEvents,
1851
1991
  highlightedIndex: highlightedIndex
1852
- }, true) : _this3.topSuggestions.map(function (sugg, index) {
1992
+ }, true) : _this5.topSuggestions.map(function (sugg, index) {
1853
1993
  return h("li", {
1854
1994
  "domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
1855
1995
  item: sugg
@@ -1857,9 +1997,9 @@ var DataSearch = {
1857
1997
  "on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
1858
1998
  item: sugg
1859
1999
  })),
1860
- "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
2000
+ "key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
1861
2001
  "style": {
1862
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
2002
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
1863
2003
  justifyContent: 'flex-start'
1864
2004
  }
1865
2005
  }, [h("div", {
@@ -1868,61 +2008,61 @@ var DataSearch = {
1868
2008
  }
1869
2009
  }, [h(CustomSvg, {
1870
2010
  "attrs": {
1871
- "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
2011
+ "className": getClassName$1(_this5.$props.innerClass, 'popular-search-icon') || null,
1872
2012
  "icon": popularSearchesIcon,
1873
2013
  "type": "popular-search-icon"
1874
2014
  }
1875
2015
  })]), h(SuggestionItem, {
1876
2016
  "attrs": {
1877
- "currentValue": _this3.currentValue,
2017
+ "currentValue": _this5.currentValue,
1878
2018
  "suggestion": sugg
1879
2019
  }
1880
2020
  })]);
1881
- })]) : _this3.renderNoSuggestions(_this3.suggestionsList)]);
2021
+ })]) : _this5.renderNoSuggestions(_this5.suggestionsList)]);
1882
2022
  };
1883
2023
 
1884
2024
  return h("div", {
1885
2025
  "class": Input.suggestionsContainer
1886
- }, [h(InputGroup, [_this3.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
2026
+ }, [h(InputGroup, [_this5.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
1887
2027
  "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,
2028
+ "id": _this5.$props.componentId + "-input",
2029
+ "showIcon": _this5.$props.showIcon,
2030
+ "showClear": _this5.$props.showClear,
2031
+ "iconPosition": _this5.$props.iconPosition,
2032
+ "placeholder": _this5.$props.placeholder,
2033
+ "autoFocus": _this5.$props.autoFocus,
2034
+ "themePreset": _this5.themePreset,
1895
2035
  "autocomplete": "off"
1896
2036
  },
1897
- "ref": _this3.$props.innerRef,
1898
- "class": getClassName$1(_this3.$props.innerClass, 'input'),
2037
+ "ref": _this5.$props.innerRef,
2038
+ "class": getClassName$1(_this5.$props.innerClass, 'input'),
1899
2039
  "on": _rollupPluginBabelHelpers._extends({}, getInputEvents({
1900
- onInput: _this3.onInputChange,
2040
+ onInput: _this5.onInputChange,
1901
2041
  onBlur: function onBlur(e) {
1902
- _this3.$emit('blur', e, _this3.triggerQuery);
2042
+ _this5.$emit('blur', e, _this5.triggerQuery);
1903
2043
  },
1904
- onFocus: _this3.handleFocus,
2044
+ onFocus: _this5.handleFocus,
1905
2045
  onKeyPress: function onKeyPress(e) {
1906
- _this3.$emit('keyPress', e, _this3.triggerQuery);
2046
+ _this5.$emit('keyPress', e, _this5.triggerQuery);
1907
2047
 
1908
- _this3.$emit('key-press', e, _this3.triggerQuery);
2048
+ _this5.$emit('key-press', e, _this5.triggerQuery);
1909
2049
  },
1910
2050
  onKeyDown: function onKeyDown(e) {
1911
- return _this3.handleKeyDown(e, highlightedIndex);
2051
+ return _this5.handleKeyDown(e, highlightedIndex);
1912
2052
  },
1913
2053
  onKeyUp: function onKeyUp(e) {
1914
- _this3.$emit('keyUp', e, _this3.triggerQuery);
2054
+ _this5.$emit('keyUp', e, _this5.triggerQuery);
1915
2055
 
1916
- _this3.$emit('key-up', e, _this3.triggerQuery);
2056
+ _this5.$emit('key-up', e, _this5.triggerQuery);
1917
2057
  },
1918
2058
  onClick: function onClick() {
1919
2059
  setHighlightedIndex(null);
1920
2060
  }
1921
2061
  })),
1922
2062
  "domProps": _rollupPluginBabelHelpers._extends({}, getInputProps({
1923
- value: _this3.$data.currentValue === null ? '' : _this3.$data.currentValue
2063
+ value: _this5.$data.currentValue === null ? '' : _this5.$data.currentValue
1924
2064
  }))
1925
- }), _this3.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this3.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer()]);
2065
+ }), _this5.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this5.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this5.renderTags()]);
1926
2066
  }
1927
2067
  }
1928
2068
  }) : h("div", {
@@ -1938,26 +2078,26 @@ var DataSearch = {
1938
2078
  },
1939
2079
  "on": _rollupPluginBabelHelpers._extends({}, {
1940
2080
  blur: function blur(e) {
1941
- _this3.$emit('blur', e, _this3.triggerQuery);
2081
+ _this5.$emit('blur', e, _this5.triggerQuery);
1942
2082
  },
1943
2083
  keypress: function keypress(e) {
1944
- _this3.$emit('keyPress', e, _this3.triggerQuery);
2084
+ _this5.$emit('keyPress', e, _this5.triggerQuery);
1945
2085
 
1946
- _this3.$emit('key-press', e, _this3.triggerQuery);
2086
+ _this5.$emit('key-press', e, _this5.triggerQuery);
1947
2087
  },
1948
2088
  input: this.onInputChange,
1949
2089
  focus: function focus(e) {
1950
- _this3.$emit('focus', e, _this3.triggerQuery);
2090
+ _this5.$emit('focus', e, _this5.triggerQuery);
1951
2091
  },
1952
2092
  keydown: function keydown(e) {
1953
- _this3.$emit('keyDown', e, _this3.triggerQuery);
2093
+ _this5.$emit('keyDown', e, _this5.triggerQuery);
1954
2094
 
1955
- _this3.$emit('key-down', e, _this3.triggerQuery);
2095
+ _this5.$emit('key-down', e, _this5.triggerQuery);
1956
2096
  },
1957
2097
  keyup: function keyup(e) {
1958
- _this3.$emit('keyUp', e, _this3.triggerQuery);
2098
+ _this5.$emit('keyUp', e, _this5.triggerQuery);
1959
2099
 
1960
- _this3.$emit('key-up', e, _this3.triggerQuery);
2100
+ _this5.$emit('key-up', e, _this5.triggerQuery);
1961
2101
  }
1962
2102
  }),
1963
2103
  "domProps": _rollupPluginBabelHelpers._extends({}, {
@@ -2179,3 +2319,5 @@ exports.Mic = Mic;
2179
2319
  exports.SearchSvg = SearchSvg;
2180
2320
  exports.SuggestionItem = SuggestionItem;
2181
2321
  exports.SuggestionWrapper = SuggestionWrapper;
2322
+ exports.TagItem = TagItem;
2323
+ exports.TagsContainer = TagsContainer;