@appbaseio/reactivesearch-vue 1.29.0 → 2.0.0-alpha

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 (89) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +11162 -762
  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-e0b7c1f6.js → Button-446f819e.js} +1 -1
  6. package/dist/cjs/{CancelSvg-4aa35935.js → CancelSvg-9f258f4f.js} +1 -1
  7. package/dist/cjs/{Card-fd94ef07.js → Card-642547a8.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-10bad289.js → ComponentWrapper-ad3dad02.js} +2 -2
  9. package/dist/cjs/{Container-526efa6a.js → Container-daf30918.js} +1 -1
  10. package/dist/cjs/{DataSearch-eec21890.js → DataSearch-6cf29cf0.js} +236 -84
  11. package/dist/cjs/DataSearch.js +10 -10
  12. package/dist/cjs/{DropDown-e4381fcc.js → DropDown-c479bbb0.js} +5 -5
  13. package/dist/cjs/DynamicRangeSlider.js +8 -7
  14. package/dist/cjs/{Flex-f146cdad.js → Flex-aa517a13.js} +1 -1
  15. package/dist/cjs/{FormControlList-808dbcef.js → FormControlList-c195a592.js} +1 -1
  16. package/dist/cjs/{Input-0d7b25ad.js → Input-e6603a7e.js} +1 -1
  17. package/dist/cjs/{ListItem-b40adb04.js → ListItem-8c9e0d68.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/Pagination-71e85fa9.js +182 -0
  22. package/dist/cjs/RangeInput.js +11 -10
  23. package/dist/cjs/RangeSlider.js +9 -8
  24. package/dist/cjs/ReactiveBase.js +69 -35
  25. package/dist/cjs/ReactiveComponent.js +6 -5
  26. package/dist/cjs/ReactiveGoogleMap.js +2336 -0
  27. package/dist/cjs/ReactiveList.js +22 -185
  28. package/dist/cjs/ResultCard.js +4 -4
  29. package/dist/cjs/ResultList.js +4 -4
  30. package/dist/cjs/SelectedFilters.js +45 -28
  31. package/dist/cjs/SingleDropdownList.js +13 -12
  32. package/dist/cjs/SingleList.js +11 -10
  33. package/dist/cjs/SingleRange.js +10 -9
  34. package/dist/cjs/StateProvider.js +30 -5
  35. package/dist/cjs/{Title-584a8cc8.js → Title-1de7d0f4.js} +1 -1
  36. package/dist/cjs/ToggleButton.js +10 -8
  37. package/dist/cjs/{_rollupPluginBabelHelpers-f127c8b7.js → _rollupPluginBabelHelpers-c705cbe6.js} +17 -2
  38. package/dist/cjs/{index-4509aa45.js → index-6a167fe0.js} +13 -1
  39. package/dist/cjs/index.js +24 -18
  40. package/dist/cjs/initReactivesearch.js +40 -8
  41. package/dist/cjs/{install-4886582d.js → install-99716d95.js} +252 -87
  42. package/dist/cjs/install.js +20 -18
  43. package/dist/cjs/{ssr-0ee35a09.js → ssr-3027b848.js} +1 -1
  44. package/dist/cjs/{utils-1219e1fe.js → utils-d6a52588.js} +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/cjs/{vueTypes-57d01f18.js → vueTypes-727b7c63.js} +30 -13
  47. package/dist/es/{Button-33de88e6.js → Button-d8bc15ea.js} +1 -1
  48. package/dist/es/{CancelSvg-c2c03a35.js → CancelSvg-4cfae5fd.js} +1 -1
  49. package/dist/es/{Card-6446f1b7.js → Card-450683f1.js} +2 -2
  50. package/dist/es/{ComponentWrapper-0f3431d1.js → ComponentWrapper-424e86fd.js} +2 -2
  51. package/dist/es/{Container-18b03fde.js → Container-ba826e96.js} +1 -1
  52. package/dist/es/{DataSearch-42f547cd.js → DataSearch-4888aa43.js} +236 -86
  53. package/dist/es/DataSearch.js +10 -10
  54. package/dist/es/{DropDown-ff6ad982.js → DropDown-05a644a5.js} +5 -5
  55. package/dist/es/DynamicRangeSlider.js +8 -7
  56. package/dist/es/{Flex-8770345d.js → Flex-1f0795c3.js} +1 -1
  57. package/dist/es/{FormControlList-704f8dee.js → FormControlList-c22d64f6.js} +1 -1
  58. package/dist/es/{Input-e339e63a.js → Input-7a2a9fac.js} +1 -1
  59. package/dist/es/{ListItem-8e8fb535.js → ListItem-cad14c5e.js} +2 -2
  60. package/dist/es/MultiDropdownList.js +13 -12
  61. package/dist/es/MultiList.js +11 -10
  62. package/dist/es/MultiRange.js +9 -8
  63. package/dist/es/Pagination-784bf143.js +177 -0
  64. package/dist/es/RangeInput.js +11 -10
  65. package/dist/es/RangeSlider.js +9 -8
  66. package/dist/es/ReactiveBase.js +70 -36
  67. package/dist/es/ReactiveComponent.js +6 -5
  68. package/dist/es/ReactiveGoogleMap.js +2327 -0
  69. package/dist/es/ReactiveList.js +21 -184
  70. package/dist/es/ResultCard.js +4 -4
  71. package/dist/es/ResultList.js +4 -4
  72. package/dist/es/SelectedFilters.js +45 -28
  73. package/dist/es/SingleDropdownList.js +13 -12
  74. package/dist/es/SingleList.js +11 -10
  75. package/dist/es/SingleRange.js +10 -9
  76. package/dist/es/StateProvider.js +30 -5
  77. package/dist/es/{Title-3522ff56.js → Title-3342664a.js} +1 -1
  78. package/dist/es/ToggleButton.js +10 -8
  79. package/dist/es/{_rollupPluginBabelHelpers-0f24d612.js → _rollupPluginBabelHelpers-76660dab.js} +17 -3
  80. package/dist/es/{index-78920565.js → index-7788a843.js} +13 -2
  81. package/dist/es/index.js +24 -19
  82. package/dist/es/initReactivesearch.js +41 -9
  83. package/dist/es/{install-54ebd72e.js → install-87984085.js} +252 -87
  84. package/dist/es/install.js +20 -18
  85. package/dist/es/{ssr-a41dfea9.js → ssr-b2c0b401.js} +1 -1
  86. package/dist/es/{utils-64a2e5f0.js → utils-9e68acee.js} +1 -1
  87. package/dist/es/version.js +1 -1
  88. package/dist/es/{vueTypes-687b2304.js → vueTypes-b8146772.js} +30 -13
  89. package/package.json +11 -5
@@ -1,18 +1,18 @@
1
1
  import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-76660dab.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 } from '@appbaseio/reactivecore/lib/utils/helper';
6
6
  import styled, { css, cx, injectGlobal } from '@appbaseio/vue-emotion';
7
- import { t as types } from './vueTypes-687b2304.js';
8
- import { g as getComponent, h as hasCustomRenderer, f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, j as getQuerySuggestionsComponent, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, m as hasQuerySuggestionsRenderer, c as connect } from './index-78920565.js';
9
- import { C as ComponentWrapper } from './ComponentWrapper-0f3431d1.js';
10
- import { T as Title } from './Title-3522ff56.js';
11
- import { F as Flex } from './Flex-8770345d.js';
7
+ import { t as types } from './vueTypes-b8146772.js';
8
+ import { g as getComponent, h as hasCustomRenderer, f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, j as getQuerySuggestionsComponent, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, m as hasQuerySuggestionsRenderer, c as connect } from './index-7788a843.js';
9
+ import { C as ComponentWrapper } from './ComponentWrapper-424e86fd.js';
10
+ import { T as Title } from './Title-3342664a.js';
11
+ import { F as Flex } from './Flex-1f0795c3.js';
12
12
  import hotkeys from 'hotkeys-js';
13
- import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './CancelSvg-c2c03a35.js';
14
- import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-e339e63a.js';
15
- import { C as Container } from './Container-18b03fde.js';
13
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './CancelSvg-4cfae5fd.js';
14
+ import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-7a2a9fac.js';
15
+ import { C as Container } from './Container-ba826e96.js';
16
16
  import Highlight from 'vue-highlight-words';
17
17
 
18
18
  var _templateObject;
@@ -898,6 +898,10 @@ var CustomSvg = {
898
898
  }
899
899
  };
900
900
 
901
+ var _templateObject$6, _templateObject2;
902
+ var TagsContainer = styled('div')(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
903
+ var TagItem = styled('span')(_templateObject2 || (_templateObject2 = _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"])));
904
+
901
905
  var updateQuery = Actions.updateQuery,
902
906
  setQueryOptions = Actions.setQueryOptions,
903
907
  setCustomQuery = Actions.setCustomQuery,
@@ -905,7 +909,8 @@ var updateQuery = Actions.updateQuery,
905
909
  setCustomHighlightOptions = Actions.setCustomHighlightOptions,
906
910
  recordSuggestionClick = Actions.recordSuggestionClick,
907
911
  loadPopularSuggestions = Actions.loadPopularSuggestions,
908
- getRecentSearches = Actions.getRecentSearches;
912
+ getRecentSearches = Actions.getRecentSearches,
913
+ resetStoreForComponent = Actions.resetStoreForComponent;
909
914
  var debounce = helper.debounce,
910
915
  checkValueChange = helper.checkValueChange,
911
916
  getClassName$1 = helper.getClassName,
@@ -920,10 +925,12 @@ var debounce = helper.debounce,
920
925
  normalizeDataField = helper.normalizeDataField;
921
926
  var DataSearch = {
922
927
  name: 'DataSearch',
928
+ isTagsMode: false,
923
929
  data: function data() {
924
930
  var props = this.$props;
925
931
  this.__state = {
926
932
  currentValue: '',
933
+ selectedTags: [],
927
934
  isOpen: false,
928
935
  normalizedSuggestions: [],
929
936
  isPending: false
@@ -943,7 +950,13 @@ var DataSearch = {
943
950
  enableRecentSearches = _this$$props.enableRecentSearches,
944
951
  distinctField = _this$$props.distinctField,
945
952
  distinctFieldConfig = _this$$props.distinctFieldConfig,
946
- index = _this$$props.index; // TODO: Remove in 2.0
953
+ index = _this$$props.index,
954
+ mode = _this$$props.mode;
955
+
956
+ if (mode === SEARCH_COMPONENTS_MODES.TAG) {
957
+ this.$options.isTagsMode = true;
958
+ } // TODO: Remove in 2.0
959
+
947
960
 
948
961
  if (enableQuerySuggestions) {
949
962
  console.warn('Warning(ReactiveSearch): The `enableQuerySuggestions` prop has been marked as deprecated, please use the `enablePopularSuggestions` prop instead.');
@@ -966,7 +979,12 @@ var DataSearch = {
966
979
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
967
980
  }
968
981
 
969
- this.currentValue = this.selectedValue || '';
982
+ this.currentValue = '';
983
+
984
+ if (this.$options.isTagsMode) {
985
+ this.currentValue = '';
986
+ }
987
+
970
988
  var shouldFetchInitialSuggestions = this.$props.enableDefaultSuggestions || this.currentValue;
971
989
 
972
990
  if (shouldFetchInitialSuggestions) {
@@ -1060,7 +1078,7 @@ var DataSearch = {
1060
1078
  debounce: VueTypes.number.def(0),
1061
1079
  defaultValue: types.string,
1062
1080
  excludeFields: types.excludeFields,
1063
- value: types.value,
1081
+ value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), types.value]),
1064
1082
  defaultSuggestions: types.suggestions,
1065
1083
  enableSynonyms: VueTypes.bool.def(true),
1066
1084
  enableQuerySuggestions: VueTypes.bool.def(false),
@@ -1109,7 +1127,10 @@ var DataSearch = {
1109
1127
  addonAfter: VueTypes.any,
1110
1128
  expandSuggestionsContainer: VueTypes.bool.def(true),
1111
1129
  index: VueTypes.string,
1112
- enableDefaultSuggestions: VueTypes.bool.def(true)
1130
+ enableDefaultSuggestions: VueTypes.bool.def(true),
1131
+ mode: VueTypes.oneOf(['select', 'tag']).def('select'),
1132
+ renderSelectedTags: VueTypes.any,
1133
+ endpoint: types.endpointConfig
1113
1134
  },
1114
1135
  beforeMount: function beforeMount() {
1115
1136
  if (this.$props.highlight) {
@@ -1126,11 +1147,11 @@ var DataSearch = {
1126
1147
  }
1127
1148
 
1128
1149
  if (this.selectedValue) {
1129
- this.setValue(this.selectedValue, true);
1150
+ this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1130
1151
  } else if (this.$props.value) {
1131
- this.setValue(this.$props.value, true);
1152
+ this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1132
1153
  } else if (this.$props.defaultValue) {
1133
- this.setValue(this.$props.defaultValue, true);
1154
+ this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1134
1155
  }
1135
1156
  },
1136
1157
  mounted: function mounted() {
@@ -1142,19 +1163,19 @@ var DataSearch = {
1142
1163
  },
1143
1164
  dataField: function dataField() {
1144
1165
  this.updateQueryOptions();
1145
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1166
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1146
1167
  },
1147
1168
  highlightField: function highlightField() {
1148
1169
  this.updateQueryOptions();
1149
1170
  },
1150
1171
  fieldWeights: function fieldWeights() {
1151
- 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);
1152
1173
  },
1153
1174
  fuzziness: function fuzziness() {
1154
- this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1175
+ this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1155
1176
  },
1156
1177
  queryFormat: function queryFormat() {
1157
- 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);
1158
1179
  },
1159
1180
  defaultValue: function defaultValue(newVal) {
1160
1181
  this.setValue(newVal, true, this.$props);
@@ -1183,13 +1204,18 @@ var DataSearch = {
1183
1204
  }
1184
1205
  },
1185
1206
  selectedValue: function selectedValue(newVal, oldVal) {
1186
- if (oldVal !== newVal && this.$data.currentValue !== newVal) {
1207
+ if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
1187
1208
  if (!newVal && this.$data.currentValue) {
1188
1209
  // selected value is cleared, call onValueSelected
1189
1210
  this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1190
1211
  }
1191
1212
 
1192
- this.setValue(newVal || '', true, this.$props);
1213
+ if (this.$options.isTagsMode) {
1214
+ // handling reset of tags through SelectedFilters or URL
1215
+ this.selectedTags = [];
1216
+ }
1217
+
1218
+ this.setValue(newVal || '', true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1193
1219
  }
1194
1220
  },
1195
1221
  focusShortcuts: function focusShortcuts() {
@@ -1316,12 +1342,47 @@ var DataSearch = {
1316
1342
  }
1317
1343
 
1318
1344
  var performUpdate = function performUpdate() {
1319
- // Refresh recent searches when value becomes empty
1320
- if (!value && _this.currentValue && _this.enableRecentSearches) {
1345
+ if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
1346
+ return;
1347
+ } // Refresh recent searches when value becomes empty
1348
+
1349
+
1350
+ if (!value && props.enableDefaultSuggestions === false) {
1351
+ _this.resetStoreForComponent(props.componentId);
1352
+ } else if (!value && _this.currentValue && _this.enableRecentSearches) {
1321
1353
  _this.getRecentSearches();
1322
1354
  }
1323
1355
 
1324
- _this.currentValue = value;
1356
+ if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1357
+ if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1358
+ // check if value already present in selectedTags
1359
+ if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1360
+ _this.isOpen = false;
1361
+ return;
1362
+ }
1363
+
1364
+ _this.selectedTags = [].concat(_this.selectedTags);
1365
+
1366
+ if (typeof value === 'string' && !!value) {
1367
+ _this.selectedTags.push(value);
1368
+ } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1369
+ var mergedArray = Array.from(new Set([].concat(_this.selectedTags, value)));
1370
+ _this.selectedTags = mergedArray;
1371
+ }
1372
+ } else if (value) {
1373
+ _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1374
+ }
1375
+
1376
+ _this.currentValue = '';
1377
+ } else {
1378
+ _this.currentValue = value;
1379
+ }
1380
+
1381
+ var queryHandlerValue = value;
1382
+
1383
+ if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1384
+ queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1385
+ }
1325
1386
 
1326
1387
  if (isDefaultValue) {
1327
1388
  if (_this.$props.autosuggest) {
@@ -1329,19 +1390,19 @@ var DataSearch = {
1329
1390
  _this.isOpen = false;
1330
1391
  }
1331
1392
 
1332
- _this.updateDefaultQueryHandler(value, _this.$props);
1393
+ if (typeof value === 'string') _this.updateDefaultQueryHandler(value, _this.$props);
1333
1394
  } // in case of strict selection only SUGGESTION_SELECT should be able
1334
1395
  // to set the query otherwise the value should reset
1335
1396
 
1336
1397
 
1337
1398
  if (props.strictSelection) {
1338
- if (cause === causes.SUGGESTION_SELECT || value === '') {
1339
- _this.updateQueryHandler(props.componentId, value, props);
1399
+ if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1400
+ _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
1340
1401
  } else {
1341
1402
  _this.setValue('', true);
1342
1403
  }
1343
1404
  } else {
1344
- _this.updateQueryHandler(props.componentId, value, props);
1405
+ _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
1345
1406
  }
1346
1407
  } else {
1347
1408
  // debounce for handling text while typing
@@ -1368,6 +1429,12 @@ var DataSearch = {
1368
1429
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1369
1430
  },
1370
1431
  updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
1432
+ if (!value && props.enableDefaultSuggestions === false) {
1433
+ // clear Component data from store
1434
+ this.resetStoreForComponent(props.componentId);
1435
+ return;
1436
+ }
1437
+
1371
1438
  var defaultQueryOptions;
1372
1439
  var query = DataSearch.defaultQuery(value, props);
1373
1440
 
@@ -1481,7 +1548,8 @@ var DataSearch = {
1481
1548
 
1482
1549
 
1483
1550
  if (event.key === 'Enter' && highlightedIndex === null) {
1484
- this.setValue(event.target.value, true);
1551
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
1552
+ );
1485
1553
  this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1486
1554
  } // Need to review
1487
1555
 
@@ -1512,11 +1580,23 @@ var DataSearch = {
1512
1580
 
1513
1581
  if (value === undefined) {
1514
1582
  this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT);
1583
+ } else if (this.$options.isTagsMode) {
1584
+ var emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
1585
+
1586
+ if (this.selectedTags.includes(suggestion.value)) {
1587
+ // avoid duplicates in tags array
1588
+ this.isOpen = false;
1589
+ return;
1590
+ }
1591
+
1592
+ emitValue.push(suggestion.value);
1593
+ this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, true);
1594
+ this.$emit('change', emitValue, this.triggerQuery);
1515
1595
  } else {
1516
- this.isPending = false;
1517
1596
  this.$emit('change', suggestion.value, this.triggerQuery);
1518
1597
  }
1519
1598
 
1599
+ this.isPending = false;
1520
1600
  this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1521
1601
  },
1522
1602
  onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
@@ -1622,6 +1702,75 @@ var DataSearch = {
1622
1702
 
1623
1703
  return null;
1624
1704
  },
1705
+ renderTag: function renderTag(item) {
1706
+ var _this2 = this;
1707
+
1708
+ var h = this.$createElement;
1709
+ var innerClass = this.$props.innerClass;
1710
+ return h(TagItem, {
1711
+ "class": getClassName$1(innerClass, 'selected-tag') || ''
1712
+ }, [h("span", [item]), h("span", {
1713
+ "attrs": {
1714
+ "role": "img",
1715
+ "aria-label": "delete-tag"
1716
+ },
1717
+ "class": "close-icon",
1718
+ "on": {
1719
+ "click": function click() {
1720
+ return _this2.clearTag(item);
1721
+ }
1722
+ }
1723
+ }, [h(CancelSvg)])]);
1724
+ },
1725
+ clearAllTags: function clearAllTags() {
1726
+ this.selectedTags = [];
1727
+ this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1728
+
1729
+ if (this.$props.value !== undefined) {
1730
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1731
+ }
1732
+ },
1733
+ clearTag: function clearTag(tagValue) {
1734
+ this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1735
+ return tag !== tagValue;
1736
+ }));
1737
+ this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1738
+
1739
+ if (this.$props.value !== undefined) {
1740
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1741
+ }
1742
+ },
1743
+ renderTags: function renderTags() {
1744
+ var _this3 = this;
1745
+
1746
+ var h = this.$createElement;
1747
+
1748
+ if (!Array.isArray(this.selectedTags)) {
1749
+ return null;
1750
+ }
1751
+
1752
+ var tagsList = [].concat(this.selectedTags);
1753
+ var shouldRenderClearAllTag = tagsList.length > 1;
1754
+ var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
1755
+ return renderSelectedTags ? renderSelectedTags({
1756
+ values: this.selectedTags,
1757
+ handleClear: this.clearTag,
1758
+ handleClearAll: this.clearAllTags
1759
+ }) : h(TagsContainer, [tagsList.map(function (item) {
1760
+ return _this3.renderTag(item);
1761
+ }), shouldRenderClearAllTag && h(TagItem, {
1762
+ "class": getClassName$1(this.$props.innerClass, 'selected-tag') || ''
1763
+ }, [h("span", ["Clear All"]), h("span", {
1764
+ "attrs": {
1765
+ "role": "img",
1766
+ "aria-label": "delete-tag"
1767
+ },
1768
+ "class": "close-icon",
1769
+ "on": {
1770
+ "click": this.clearAllTags
1771
+ }
1772
+ }, [h(CancelSvg)])])]);
1773
+ },
1625
1774
  renderInputAddonAfter: function renderInputAddonAfter() {
1626
1775
  var h = this.$createElement;
1627
1776
  var addonAfter = this.$scopedSlots.addonAfter;
@@ -1692,7 +1841,7 @@ var DataSearch = {
1692
1841
  (_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
1693
1842
  },
1694
1843
  listenForFocusShortcuts: function listenForFocusShortcuts() {
1695
- var _this2 = this;
1844
+ var _this4 = this;
1696
1845
 
1697
1846
  var _this$$props$focusSho = this.$props.focusShortcuts,
1698
1847
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
@@ -1710,7 +1859,7 @@ var DataSearch = {
1710
1859
  // Prevent the default refresh event under WINDOWS system
1711
1860
  event.preventDefault();
1712
1861
 
1713
- _this2.focusSearchBox(event);
1862
+ _this4.focusSearchBox(event);
1714
1863
  }); // if one of modifier keys are used, they are handled below
1715
1864
 
1716
1865
  hotkeys('*', function (event) {
@@ -1721,7 +1870,7 @@ var DataSearch = {
1721
1870
  var element = modifierKeys[index];
1722
1871
 
1723
1872
  if (hotkeys[element]) {
1724
- _this2.focusSearchBox(event);
1873
+ _this4.focusSearchBox(event);
1725
1874
 
1726
1875
  break;
1727
1876
  }
@@ -1730,7 +1879,7 @@ var DataSearch = {
1730
1879
  }
1731
1880
  },
1732
1881
  render: function render() {
1733
- var _this3 = this;
1882
+ var _this5 = this;
1734
1883
 
1735
1884
  var h = arguments[0];
1736
1885
  var _this$$props4 = this.$props,
@@ -1769,14 +1918,14 @@ var DataSearch = {
1769
1918
  setHighlightedIndex = _ref3.setHighlightedIndex;
1770
1919
 
1771
1920
  var renderSuggestionsContainer = function renderSuggestionsContainer() {
1772
- return h("div", [_this3.hasCustomRenderer && _this3.getComponent({
1921
+ return h("div", [_this5.hasCustomRenderer && _this5.getComponent({
1773
1922
  isOpen: isOpen,
1774
1923
  getItemProps: getItemProps,
1775
1924
  getItemEvents: getItemEvents,
1776
1925
  highlightedIndex: highlightedIndex
1777
- }), _this3.renderErrorComponent(), !_this3.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1778
- "class": suggestions(_this3.themePreset, theme) + " " + getClassName$1(_this3.$props.innerClass, 'list')
1779
- }, [_this3.suggestionsList.slice(0, size || 10).map(function (item, index) {
1926
+ }), _this5.renderErrorComponent(), !_this5.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1927
+ "class": suggestions(_this5.themePreset, theme) + " " + getClassName$1(_this5.$props.innerClass, 'list')
1928
+ }, [_this5.suggestionsList.slice(0, size || 10).map(function (item, index) {
1780
1929
  return h("li", {
1781
1930
  "domProps": _extends({}, getItemProps({
1782
1931
  item: item
@@ -1786,15 +1935,15 @@ var DataSearch = {
1786
1935
  })),
1787
1936
  "key": index + 1 + "-" + item.value,
1788
1937
  "style": {
1789
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, index)
1938
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, index)
1790
1939
  }
1791
1940
  }, [h(SuggestionItem, {
1792
1941
  "attrs": {
1793
- "currentValue": _this3.currentValue,
1942
+ "currentValue": _this5.currentValue,
1794
1943
  "suggestion": item
1795
1944
  }
1796
1945
  })]);
1797
- }), _this3.defaultSearchSuggestions.map(function (sugg, index) {
1946
+ }), _this5.defaultSearchSuggestions.map(function (sugg, index) {
1798
1947
  return h("li", {
1799
1948
  "domProps": _extends({}, getItemProps({
1800
1949
  item: sugg
@@ -1802,9 +1951,9 @@ var DataSearch = {
1802
1951
  "on": _extends({}, getItemEvents({
1803
1952
  item: sugg
1804
1953
  })),
1805
- "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1954
+ "key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
1806
1955
  "style": {
1807
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
1956
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
1808
1957
  justifyContent: 'flex-start'
1809
1958
  }
1810
1959
  }, [h("div", {
@@ -1813,28 +1962,28 @@ var DataSearch = {
1813
1962
  }
1814
1963
  }, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
1815
1964
  "attrs": {
1816
- "className": getClassName$1(_this3.$props.innerClass, 'recent-search-icon') || null,
1965
+ "className": getClassName$1(_this5.$props.innerClass, 'recent-search-icon') || null,
1817
1966
  "icon": recentSearchesIcon,
1818
1967
  "type": "recent-search-icon"
1819
1968
  }
1820
1969
  }), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
1821
1970
  "attrs": {
1822
- "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
1971
+ "className": getClassName$1(_this5.$props.innerClass, 'popular-search-icon') || null,
1823
1972
  "icon": popularSearchesIcon,
1824
1973
  "type": "popular-search-icon"
1825
1974
  }
1826
1975
  })]), h(SuggestionItem, {
1827
1976
  "attrs": {
1828
- "currentValue": _this3.currentValue,
1977
+ "currentValue": _this5.currentValue,
1829
1978
  "suggestion": sugg
1830
1979
  }
1831
1980
  })]);
1832
- }), hasQuerySuggestionsRenderer(_this3) ? _this3.getComponent({
1981
+ }), hasQuerySuggestionsRenderer(_this5) ? _this5.getComponent({
1833
1982
  isOpen: isOpen,
1834
1983
  getItemProps: getItemProps,
1835
1984
  getItemEvents: getItemEvents,
1836
1985
  highlightedIndex: highlightedIndex
1837
- }, true) : _this3.topSuggestions.map(function (sugg, index) {
1986
+ }, true) : _this5.topSuggestions.map(function (sugg, index) {
1838
1987
  return h("li", {
1839
1988
  "domProps": _extends({}, getItemProps({
1840
1989
  item: sugg
@@ -1842,9 +1991,9 @@ var DataSearch = {
1842
1991
  "on": _extends({}, getItemEvents({
1843
1992
  item: sugg
1844
1993
  })),
1845
- "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1994
+ "key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
1846
1995
  "style": {
1847
- backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
1996
+ backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
1848
1997
  justifyContent: 'flex-start'
1849
1998
  }
1850
1999
  }, [h("div", {
@@ -1853,61 +2002,61 @@ var DataSearch = {
1853
2002
  }
1854
2003
  }, [h(CustomSvg, {
1855
2004
  "attrs": {
1856
- "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
2005
+ "className": getClassName$1(_this5.$props.innerClass, 'popular-search-icon') || null,
1857
2006
  "icon": popularSearchesIcon,
1858
2007
  "type": "popular-search-icon"
1859
2008
  }
1860
2009
  })]), h(SuggestionItem, {
1861
2010
  "attrs": {
1862
- "currentValue": _this3.currentValue,
2011
+ "currentValue": _this5.currentValue,
1863
2012
  "suggestion": sugg
1864
2013
  }
1865
2014
  })]);
1866
- })]) : _this3.renderNoSuggestions(_this3.suggestionsList)]);
2015
+ })]) : _this5.renderNoSuggestions(_this5.suggestionsList)]);
1867
2016
  };
1868
2017
 
1869
2018
  return h("div", {
1870
2019
  "class": suggestionsContainer
1871
- }, [h(InputGroup, [_this3.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
2020
+ }, [h(InputGroup, [_this5.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1872
2021
  "attrs": {
1873
- "id": _this3.$props.componentId + "-input",
1874
- "showIcon": _this3.$props.showIcon,
1875
- "showClear": _this3.$props.showClear,
1876
- "iconPosition": _this3.$props.iconPosition,
1877
- "placeholder": _this3.$props.placeholder,
1878
- "autoFocus": _this3.$props.autoFocus,
1879
- "themePreset": _this3.themePreset,
2022
+ "id": _this5.$props.componentId + "-input",
2023
+ "showIcon": _this5.$props.showIcon,
2024
+ "showClear": _this5.$props.showClear,
2025
+ "iconPosition": _this5.$props.iconPosition,
2026
+ "placeholder": _this5.$props.placeholder,
2027
+ "autoFocus": _this5.$props.autoFocus,
2028
+ "themePreset": _this5.themePreset,
1880
2029
  "autocomplete": "off"
1881
2030
  },
1882
- "ref": _this3.$props.innerRef,
1883
- "class": getClassName$1(_this3.$props.innerClass, 'input'),
2031
+ "ref": _this5.$props.innerRef,
2032
+ "class": getClassName$1(_this5.$props.innerClass, 'input'),
1884
2033
  "on": _extends({}, getInputEvents({
1885
- onInput: _this3.onInputChange,
2034
+ onInput: _this5.onInputChange,
1886
2035
  onBlur: function onBlur(e) {
1887
- _this3.$emit('blur', e, _this3.triggerQuery);
2036
+ _this5.$emit('blur', e, _this5.triggerQuery);
1888
2037
  },
1889
- onFocus: _this3.handleFocus,
2038
+ onFocus: _this5.handleFocus,
1890
2039
  onKeyPress: function onKeyPress(e) {
1891
- _this3.$emit('keyPress', e, _this3.triggerQuery);
2040
+ _this5.$emit('keyPress', e, _this5.triggerQuery);
1892
2041
 
1893
- _this3.$emit('key-press', e, _this3.triggerQuery);
2042
+ _this5.$emit('key-press', e, _this5.triggerQuery);
1894
2043
  },
1895
2044
  onKeyDown: function onKeyDown(e) {
1896
- return _this3.handleKeyDown(e, highlightedIndex);
2045
+ return _this5.handleKeyDown(e, highlightedIndex);
1897
2046
  },
1898
2047
  onKeyUp: function onKeyUp(e) {
1899
- _this3.$emit('keyUp', e, _this3.triggerQuery);
2048
+ _this5.$emit('keyUp', e, _this5.triggerQuery);
1900
2049
 
1901
- _this3.$emit('key-up', e, _this3.triggerQuery);
2050
+ _this5.$emit('key-up', e, _this5.triggerQuery);
1902
2051
  },
1903
2052
  onClick: function onClick() {
1904
2053
  setHighlightedIndex(null);
1905
2054
  }
1906
2055
  })),
1907
2056
  "domProps": _extends({}, getInputProps({
1908
- value: _this3.$data.currentValue === null ? '' : _this3.$data.currentValue
2057
+ value: _this5.$data.currentValue === null ? '' : _this5.$data.currentValue
1909
2058
  }))
1910
- }), _this3.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this3.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer()]);
2059
+ }), _this5.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this5.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this5.renderTags()]);
1911
2060
  }
1912
2061
  }
1913
2062
  }) : h("div", {
@@ -1923,26 +2072,26 @@ var DataSearch = {
1923
2072
  },
1924
2073
  "on": _extends({}, {
1925
2074
  blur: function blur(e) {
1926
- _this3.$emit('blur', e, _this3.triggerQuery);
2075
+ _this5.$emit('blur', e, _this5.triggerQuery);
1927
2076
  },
1928
2077
  keypress: function keypress(e) {
1929
- _this3.$emit('keyPress', e, _this3.triggerQuery);
2078
+ _this5.$emit('keyPress', e, _this5.triggerQuery);
1930
2079
 
1931
- _this3.$emit('key-press', e, _this3.triggerQuery);
2080
+ _this5.$emit('key-press', e, _this5.triggerQuery);
1932
2081
  },
1933
2082
  input: this.onInputChange,
1934
2083
  focus: function focus(e) {
1935
- _this3.$emit('focus', e, _this3.triggerQuery);
2084
+ _this5.$emit('focus', e, _this5.triggerQuery);
1936
2085
  },
1937
2086
  keydown: function keydown(e) {
1938
- _this3.$emit('keyDown', e, _this3.triggerQuery);
2087
+ _this5.$emit('keyDown', e, _this5.triggerQuery);
1939
2088
 
1940
- _this3.$emit('key-down', e, _this3.triggerQuery);
2089
+ _this5.$emit('key-down', e, _this5.triggerQuery);
1941
2090
  },
1942
2091
  keyup: function keyup(e) {
1943
- _this3.$emit('keyUp', e, _this3.triggerQuery);
2092
+ _this5.$emit('keyUp', e, _this5.triggerQuery);
1944
2093
 
1945
- _this3.$emit('key-up', e, _this3.triggerQuery);
2094
+ _this5.$emit('key-up', e, _this5.triggerQuery);
1946
2095
  }
1947
2096
  }),
1948
2097
  "domProps": _extends({}, {
@@ -2141,7 +2290,8 @@ var mapDispatchToProps = {
2141
2290
  setCustomHighlightOptions: setCustomHighlightOptions,
2142
2291
  recordSuggestionClick: recordSuggestionClick,
2143
2292
  loadPopularSuggestions: loadPopularSuggestions,
2144
- getRecentSearches: getRecentSearches
2293
+ getRecentSearches: getRecentSearches,
2294
+ resetStoreForComponent: resetStoreForComponent
2145
2295
  };
2146
2296
  var DSConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
2147
2297
  componentType: componentTypes.dataSearch,
@@ -2155,4 +2305,4 @@ DataSearch.install = function (Vue) {
2155
2305
 
2156
2306
  DataSearch.componentType = componentTypes.dataSearch;
2157
2307
 
2158
- export { CustomSvg as C, DataSearch as D, InputAddon as I, Mic as M, SearchSvg as S, SuggestionWrapper as a, InputGroup as b, SuggestionItem as c };
2308
+ export { CustomSvg as C, DataSearch as D, InputAddon as I, Mic as M, SearchSvg as S, TagItem as T, SuggestionWrapper as a, TagsContainer as b, InputGroup as c, SuggestionItem as d };
@@ -1,22 +1,22 @@
1
1
  import '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import './_rollupPluginBabelHelpers-76660dab.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 './vueTypes-687b2304.js';
9
+ import './vueTypes-b8146772.js';
10
10
  import '@appbaseio/reactivecore/lib/utils/transform';
11
11
  import 'redux';
12
- import './index-78920565.js';
13
- import './ComponentWrapper-0f3431d1.js';
14
- import './Title-3522ff56.js';
15
- import './Flex-8770345d.js';
12
+ import './index-7788a843.js';
13
+ import './ComponentWrapper-424e86fd.js';
14
+ import './Title-3342664a.js';
15
+ import './Flex-1f0795c3.js';
16
16
  import 'hotkeys-js';
17
- export { D as default } from './DataSearch-42f547cd.js';
18
- import './CancelSvg-c2c03a35.js';
19
- import './Input-e339e63a.js';
17
+ export { D as default } from './DataSearch-4888aa43.js';
18
+ import './CancelSvg-4cfae5fd.js';
19
+ import './Input-7a2a9fac.js';
20
20
  import 'compute-scroll-into-view';
21
- import './Container-18b03fde.js';
21
+ import './Container-ba826e96.js';
22
22
  import 'vue-highlight-words';