@appbaseio/reactivesearch-vue 1.16.0-alpha.4 → 1.16.0-alpha.42

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 (101) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +8110 -7499
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/Button-d2f1aeda.js +68 -0
  6. package/dist/cjs/{DownShift-b09da079.js → CancelSvg-82021d23.js} +60 -16
  7. package/dist/cjs/Card-4b915733.js +30 -0
  8. package/dist/cjs/{ComponentWrapper-5a0a8849.js → ComponentWrapper-7302fe1a.js} +40 -21
  9. package/dist/cjs/{Container-f84e72fc.js → Container-8a08d663.js} +3 -11
  10. package/dist/cjs/DataSearch.js +354 -398
  11. package/dist/cjs/{DropDown-c66be1a8.js → DropDown-c46d8b0c.js} +80 -95
  12. package/dist/cjs/DynamicRangeSlider.js +107 -42
  13. package/dist/cjs/Flex-699639d2.js +52 -0
  14. package/dist/cjs/FormControlList-73497794.js +47 -0
  15. package/dist/cjs/Input-c6f181d5.js +79 -0
  16. package/dist/cjs/ListItem-933c27e4.js +46 -0
  17. package/dist/cjs/MultiDropdownList.js +101 -65
  18. package/dist/cjs/MultiList.js +79 -47
  19. package/dist/cjs/MultiRange.js +20 -14
  20. package/dist/cjs/{Pagination-91df3b77.js → Pagination-1b2320a7.js} +4 -3
  21. package/dist/cjs/RangeInput.js +29 -45
  22. package/dist/cjs/RangeSlider.js +31 -28
  23. package/dist/cjs/ReactiveBase.js +55 -34
  24. package/dist/cjs/ReactiveComponent.js +69 -62
  25. package/dist/cjs/ReactiveGoogleMap.js +326 -235
  26. package/dist/cjs/ReactiveList.js +188 -241
  27. package/dist/cjs/ResultCard.js +8 -6
  28. package/dist/cjs/ResultList.js +8 -6
  29. package/dist/cjs/SelectedFilters.js +25 -12
  30. package/dist/cjs/SingleDropdownList.js +87 -57
  31. package/dist/cjs/SingleList.js +60 -37
  32. package/dist/cjs/SingleRange.js +17 -11
  33. package/dist/cjs/StateProvider.js +11 -7
  34. package/dist/cjs/{Title-e9beb554.js → Title-39765ee6.js} +3 -11
  35. package/dist/cjs/ToggleButton.js +35 -16
  36. package/dist/cjs/{_rollupPluginBabelHelpers-280a574c.js → _rollupPluginBabelHelpers-4abdbfff.js} +11 -1
  37. package/dist/cjs/{index-e0583d76.js → index-d44a0a21.js} +87 -13
  38. package/dist/cjs/index.js +23 -19
  39. package/dist/cjs/initReactivesearch.js +190 -103
  40. package/dist/cjs/install.js +20 -18
  41. package/dist/cjs/ssr-c333c82c.js +39 -0
  42. package/dist/cjs/{utils-d1ea9f95.js → utils-23afb20b.js} +2 -2
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
  45. package/dist/es/Button-799185e2.js +59 -0
  46. package/dist/es/{DownShift-d8f2500f.js → CancelSvg-4d9e0857.js} +56 -17
  47. package/dist/es/Card-04b3c33e.js +23 -0
  48. package/dist/es/{ComponentWrapper-d0b21b95.js → ComponentWrapper-bbb717bc.js} +40 -21
  49. package/dist/es/Container-4383c6f0.js +10 -0
  50. package/dist/es/DataSearch.js +352 -396
  51. package/dist/es/{DropDown-5dbd69c2.js → DropDown-4edaa621.js} +79 -94
  52. package/dist/es/DynamicRangeSlider.js +107 -42
  53. package/dist/es/Flex-aac91505.js +47 -0
  54. package/dist/es/FormControlList-fe389a2e.js +40 -0
  55. package/dist/es/Input-d8519224.js +71 -0
  56. package/dist/es/ListItem-bdb6d53d.js +39 -0
  57. package/dist/es/MultiDropdownList.js +101 -65
  58. package/dist/es/MultiList.js +79 -47
  59. package/dist/es/MultiRange.js +20 -14
  60. package/dist/es/{Pagination-800af44f.js → Pagination-b3e4054a.js} +4 -3
  61. package/dist/es/RangeInput.js +29 -45
  62. package/dist/es/RangeSlider.js +31 -28
  63. package/dist/es/ReactiveBase.js +55 -34
  64. package/dist/es/ReactiveComponent.js +69 -62
  65. package/dist/es/ReactiveGoogleMap.js +326 -235
  66. package/dist/es/ReactiveList.js +188 -241
  67. package/dist/es/ResultCard.js +8 -6
  68. package/dist/es/ResultList.js +8 -6
  69. package/dist/es/SelectedFilters.js +25 -12
  70. package/dist/es/SingleDropdownList.js +87 -57
  71. package/dist/es/SingleList.js +60 -37
  72. package/dist/es/SingleRange.js +17 -11
  73. package/dist/es/StateProvider.js +11 -7
  74. package/dist/es/Title-579f8d6c.js +10 -0
  75. package/dist/es/ToggleButton.js +35 -16
  76. package/dist/es/{_rollupPluginBabelHelpers-c9fbe19f.js → _rollupPluginBabelHelpers-ecf6c03c.js} +11 -1
  77. package/dist/es/{index-1fe91a0a.js → index-5daa8276.js} +84 -14
  78. package/dist/es/index.js +23 -19
  79. package/dist/es/initReactivesearch.js +191 -104
  80. package/dist/es/install.js +20 -18
  81. package/dist/es/ssr-e3196de1.js +33 -0
  82. package/dist/es/{utils-ce3d86fd.js → utils-3a32e13f.js} +2 -2
  83. package/dist/es/version.js +1 -1
  84. package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
  85. package/package.json +7 -5
  86. package/dist/cjs/Button-78d8bc26.js +0 -146
  87. package/dist/cjs/Card-b4af314f.js +0 -58
  88. package/dist/cjs/Flex-737c55be.js +0 -160
  89. package/dist/cjs/FormControlList-08dfb28e.js +0 -105
  90. package/dist/cjs/Input-643d02a7.js +0 -178
  91. package/dist/cjs/ListItem-0c58c5d2.js +0 -84
  92. package/dist/cjs/ssr-b7a729f9.js +0 -47
  93. package/dist/es/Button-6c71c66e.js +0 -137
  94. package/dist/es/Card-ecf70ba1.js +0 -51
  95. package/dist/es/Container-f5efec9e.js +0 -18
  96. package/dist/es/Flex-40a74d8a.js +0 -155
  97. package/dist/es/FormControlList-b96aebef.js +0 -98
  98. package/dist/es/Input-dfd9dd40.js +0 -170
  99. package/dist/es/ListItem-da73bc7d.js +0 -77
  100. package/dist/es/Title-22c2f3bf.js +0 -18
  101. package/dist/es/ssr-2f57791d.js +0 -41
@@ -1,20 +1,21 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import { a as _extends } from './_rollupPluginBabelHelpers-c9fbe19f.js';
2
+ import { a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import 'emotion';
6
6
  import '@appbaseio/vue-emotion';
7
7
  import 'polished';
8
- import { t as types } from './vueTypes-98d938a9.js';
8
+ import { t as types } from './vueTypes-9326e0be.js';
9
9
  import '@appbaseio/reactivecore/lib/utils/transform';
10
10
  import 'redux';
11
- import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, g as getComponent, l as isEvent, h as hasCustomRenderer, c as connect } from './index-1fe91a0a.js';
12
- import { C as ComponentWrapper } from './ComponentWrapper-d0b21b95.js';
13
- import { T as Title } from './Title-22c2f3bf.js';
14
- import { I as Input } from './Input-dfd9dd40.js';
15
- import { C as Container } from './Container-f5efec9e.js';
16
- import { U as UL, R as Radio } from './FormControlList-b96aebef.js';
17
- import { g as getAggsQuery } from './utils-ce3d86fd.js';
11
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, g as getComponent, n as isEvent, h as hasCustomRenderer, c as connect } from './index-5daa8276.js';
12
+ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
13
+ import { T as Title } from './Title-579f8d6c.js';
14
+ import { I as Input } from './Input-d8519224.js';
15
+ import { C as Container } from './Container-4383c6f0.js';
16
+ import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
17
+ import { U as UL, R as Radio } from './FormControlList-fe389a2e.js';
18
+ import { g as getAggsQuery } from './utils-3a32e13f.js';
18
19
 
19
20
  var updateQuery = Actions.updateQuery,
20
21
  setQueryOptions = Actions.setQueryOptions,
@@ -23,13 +24,14 @@ var updateQuery = Actions.updateQuery,
23
24
  var getQueryOptions = helper.getQueryOptions,
24
25
  checkValueChange = helper.checkValueChange,
25
26
  getClassName = helper.getClassName,
26
- getOptionsFromQuery = helper.getOptionsFromQuery,
27
- isEqual = helper.isEqual;
27
+ isEqual = helper.isEqual,
28
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
29
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
28
30
  var SingleList = {
29
31
  name: 'SingleList',
30
32
  props: {
31
33
  beforeValueChange: types.func,
32
- className: types.string.def(''),
34
+ className: VueTypes.string.def(''),
33
35
  componentId: types.stringRequired,
34
36
  customQuery: types.func,
35
37
  dataField: types.stringRequired,
@@ -49,27 +51,34 @@ var SingleList = {
49
51
  showFilter: VueTypes.bool.def(true),
50
52
  showRadio: VueTypes.bool.def(true),
51
53
  showSearch: VueTypes.bool.def(true),
52
- size: VueTypes.number.def(100),
54
+ size: VueTypes.number,
53
55
  sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
54
56
  title: types.title,
55
57
  URLParams: VueTypes.bool.def(false),
56
58
  showMissing: VueTypes.bool.def(false),
57
59
  missingLabel: VueTypes.string.def('N/A'),
58
60
  nestedField: types.string,
61
+ index: VueTypes.string,
59
62
  enableStrictSelection: VueTypes.bool.def(false)
60
63
  },
61
64
  data: function data() {
62
65
  var props = this.$props;
63
66
  this.__state = {
64
67
  currentValue: '',
65
- modifiedOptions: props.options && props.options[props.dataField] ? props.options[props.dataField].buckets : [],
68
+ modifiedOptions: [],
66
69
  searchTerm: ''
67
70
  };
68
71
  this.internalComponent = props.componentId + "__internal";
69
72
  return this.__state;
70
73
  },
71
74
  created: function created() {
72
- // Set custom and default queries in store
75
+ if (!this.enableAppbase && this.$props.index) {
76
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
77
+ }
78
+
79
+ var props = this.$props;
80
+ this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : []; // Set custom and default queries in store
81
+
73
82
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
74
83
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
75
84
  },
@@ -86,7 +95,9 @@ var SingleList = {
86
95
  },
87
96
  watch: {
88
97
  options: function options(newVal) {
89
- this.modifiedOptions = newVal[this.$props.dataField] ? newVal[this.$props.dataField].buckets : [];
98
+ if (newVal) {
99
+ this.modifiedOptions = newVal[this.$props.dataField] ? newVal[this.$props.dataField].buckets : [];
100
+ }
90
101
  },
91
102
  size: function size() {
92
103
  this.updateQueryHandlerOptions(this.$props);
@@ -129,8 +140,7 @@ var SingleList = {
129
140
  var _this$$props = this.$props,
130
141
  selectAllLabel = _this$$props.selectAllLabel,
131
142
  renderItem = _this$$props.renderItem,
132
- renderError = _this$$props.renderError,
133
- enableStrictSelection = _this$$props.enableStrictSelection;
143
+ renderError = _this$$props.renderError;
134
144
  var renderItemCalc = this.$scopedSlots.renderItem || renderItem;
135
145
  var renderErrorCalc = this.$scopedSlots.renderError || renderError;
136
146
 
@@ -138,8 +148,12 @@ var SingleList = {
138
148
  return isFunction(renderErrorCalc) ? renderErrorCalc(this.error) : renderErrorCalc;
139
149
  }
140
150
 
141
- if (!this.hasCustomRenderer && this.modifiedOptions.length === 0) {
142
- return null;
151
+ if (!this.hasCustomRenderer && this.modifiedOptions.length === 0 && !this.isLoading) {
152
+ if (this.renderNoResult) {
153
+ this.renderNoResult();
154
+ } else {
155
+ return null;
156
+ }
143
157
  }
144
158
 
145
159
  var itemsToRender = this.$data.modifiedOptions;
@@ -151,7 +165,7 @@ var SingleList = {
151
165
  var filteredItemsToRender = itemsToRender.filter(function (item) {
152
166
  if (String(item.key).length) {
153
167
  if (_this.$props.showSearch && _this.$data.searchTerm) {
154
- return String(item.key).toLowerCase().includes(_this.$data.searchTerm.toLowerCase());
168
+ return replaceDiacritics(String(item.key)).toLowerCase().includes(replaceDiacritics(_this.$data.searchTerm.toLowerCase()));
155
169
  }
156
170
 
157
171
  return true;
@@ -203,9 +217,7 @@ var SingleList = {
203
217
  "show": _this.$props.showRadio
204
218
  },
205
219
  "on": {
206
- "click": _this.$data.currentValue === String(item.key) && enableStrictSelection ? function () {
207
- return false;
208
- } : _this.handleClick
220
+ "click": _this.handleClick
209
221
  },
210
222
  "domProps": _extends({}, {
211
223
  checked: _this.currentValue === String(item.key)
@@ -256,17 +268,18 @@ var SingleList = {
256
268
 
257
269
  if (this.defaultQuery) {
258
270
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
271
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
259
272
 
260
- if (defaultQueryToBeSet.query) {
261
- query = defaultQueryToBeSet.query;
273
+ if (defaultQueryObj) {
274
+ query = defaultQueryObj;
262
275
  }
263
276
 
264
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
277
+ defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
265
278
 
266
279
  updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
267
280
  }
268
281
 
269
- this.setQueryOptions(this.internalComponent, defaultQueryOptions);
282
+ this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
270
283
  this.updateQuery({
271
284
  componentId: this.internalComponent,
272
285
  query: query,
@@ -280,14 +293,13 @@ var SingleList = {
280
293
  var customQueryOptions;
281
294
 
282
295
  if (customQuery) {
283
- var _ref = customQuery(value, props) || {};
284
-
285
- query = _ref.query;
286
- customQueryOptions = getOptionsFromQuery(customQuery(value, props));
296
+ var customQueryCalc = customQuery(value, props);
297
+ query = extractQueryFromCustomQuery(customQueryCalc);
298
+ customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
287
299
  updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
288
300
  }
289
301
 
290
- this.setQueryOptions(props.componentId, customQueryOptions);
302
+ this.setQueryOptions(props.componentId, customQueryOptions, false);
291
303
  this.updateQuery({
292
304
  componentId: props.componentId,
293
305
  query: query,
@@ -307,8 +319,8 @@ var SingleList = {
307
319
 
308
320
  if (props.defaultQuery) {
309
321
  var value = this.$data.currentValue;
310
- var defaultQueryOptions = getOptionsFromQuery(props.defaultQuery(value, props));
311
- this.setQueryOptions(this.internalComponent, _extends(_extends({}, queryOptions), defaultQueryOptions));
322
+ var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
323
+ this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
312
324
  } else {
313
325
  this.setQueryOptions(this.internalComponent, queryOptions);
314
326
  }
@@ -367,6 +379,10 @@ var SingleList = {
367
379
  currentValue = e.target.value;
368
380
  }
369
381
 
382
+ if (this.enableStrictSelection && currentValue === this.currentValue) {
383
+ return false;
384
+ }
385
+
370
386
  var value = this.$props.value;
371
387
 
372
388
  if (value === undefined) {
@@ -374,6 +390,8 @@ var SingleList = {
374
390
  } else {
375
391
  this.$emit('change', currentValue);
376
392
  }
393
+
394
+ return true;
377
395
  },
378
396
  renderNoResult: function renderNoResult() {
379
397
  var h = this.$createElement;
@@ -446,6 +464,10 @@ SingleList.defaultQuery = function (value, props) {
446
464
  return query;
447
465
  };
448
466
 
467
+ SingleList.hasInternalComponent = function () {
468
+ return true;
469
+ };
470
+
449
471
  var mapStateToProps = function mapStateToProps(state, props) {
450
472
  return {
451
473
  options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
@@ -454,7 +476,8 @@ var mapStateToProps = function mapStateToProps(state, props) {
454
476
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || '',
455
477
  themePreset: state.config.themePreset,
456
478
  error: state.error[props.componentId],
457
- componentProps: state.props[props.componentId]
479
+ componentProps: state.props[props.componentId],
480
+ enableAppbase: state.config.enableAppbase
458
481
  };
459
482
  };
460
483
 
@@ -466,7 +489,7 @@ var mapDispatchtoProps = {
466
489
  };
467
490
  var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(SingleList), {
468
491
  componentType: componentTypes.singleList,
469
- internalComponent: true
492
+ internalComponent: SingleList.hasInternalComponent()
470
493
  });
471
494
 
472
495
  SingleList.install = function (Vue) {
@@ -1,18 +1,18 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-c9fbe19f.js';
2
+ import './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import 'emotion';
6
6
  import '@appbaseio/vue-emotion';
7
7
  import 'polished';
8
- import { t as types } from './vueTypes-98d938a9.js';
8
+ import { t as types } from './vueTypes-9326e0be.js';
9
9
  import '@appbaseio/reactivecore/lib/utils/transform';
10
10
  import 'redux';
11
- import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-1fe91a0a.js';
12
- import { C as ComponentWrapper } from './ComponentWrapper-d0b21b95.js';
13
- import { T as Title } from './Title-22c2f3bf.js';
14
- import { C as Container } from './Container-f5efec9e.js';
15
- import { U as UL, R as Radio } from './FormControlList-b96aebef.js';
11
+ import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-5daa8276.js';
12
+ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
13
+ import { T as Title } from './Title-579f8d6c.js';
14
+ import { C as Container } from './Container-4383c6f0.js';
15
+ import { U as UL, R as Radio } from './FormControlList-fe389a2e.js';
16
16
 
17
17
  var updateQuery = Actions.updateQuery,
18
18
  setQueryOptions = Actions.setQueryOptions,
@@ -46,10 +46,15 @@ var SingleRange = {
46
46
  showRadio: VueTypes.bool.def(true),
47
47
  title: types.title,
48
48
  URLParams: VueTypes.bool.def(false),
49
- nestedField: types.string
49
+ nestedField: types.string,
50
+ index: VueTypes.string
50
51
  },
51
52
  created: function created() {
52
- // Set custom query in store
53
+ if (!this.enableAppbase && this.$props.index) {
54
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
55
+ } // Set custom query in store
56
+
57
+
53
58
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
54
59
  },
55
60
  beforeMount: function beforeMount() {
@@ -155,7 +160,7 @@ var SingleRange = {
155
160
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
156
161
  }
157
162
 
158
- this.setQueryOptions(props.componentId, customQueryOptions);
163
+ this.setQueryOptions(props.componentId, customQueryOptions, false);
159
164
  this.updateQuery({
160
165
  componentId: props.componentId,
161
166
  query: query,
@@ -216,7 +221,8 @@ SingleRange.defaultQuery = function (value, props) {
216
221
  var mapStateToProps = function mapStateToProps(state, props) {
217
222
  return {
218
223
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
219
- componentProps: state.props[props.componentId]
224
+ componentProps: state.props[props.componentId],
225
+ enableAppbase: state.config.enableAppbase
220
226
  };
221
227
  };
222
228
 
@@ -1,15 +1,19 @@
1
1
  import { helper } from '@appbaseio/reactivecore';
2
- import { a as _extends } from './_rollupPluginBabelHelpers-c9fbe19f.js';
2
+ import { a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import 'redux';
6
- import { c as connect } from './index-1fe91a0a.js';
6
+ import { c as connect } from './index-5daa8276.js';
7
7
 
8
8
  var getSearchState = helper.getSearchState;
9
9
  var defaultKeys = ['hits', 'value', 'aggregations', 'error'];
10
10
 
11
11
  var filterProps = function filterProps(props) {
12
- return _extends(_extends({}, props), {}, {
12
+ if (props === void 0) {
13
+ props = {};
14
+ }
15
+
16
+ return _extends({}, props, {
13
17
  props: props.componentProps
14
18
  });
15
19
  };
@@ -28,7 +32,7 @@ var filterByComponentIds = function filterByComponentIds(state, props) {
28
32
  return _ref = {}, _ref[componentIds] = state[componentIds], _ref;
29
33
  }
30
34
 
31
- if (componentIds instanceof Array) {
35
+ if (Array.isArray(componentIds)) {
32
36
  var filteredState = {};
33
37
  componentIds.forEach(function (componentId) {
34
38
  filteredState[componentId] = state[componentId];
@@ -43,7 +47,7 @@ var filterByKeys = function filterByKeys(state, allowedKeys) {
43
47
  return Object.keys(state).reduce(function (components, componentId) {
44
48
  var _extends2;
45
49
 
46
- return _extends(_extends({}, components), {}, (_extends2 = {}, _extends2[componentId] = Object.keys(state[componentId]).filter(function (key) {
50
+ return _extends({}, components, (_extends2 = {}, _extends2[componentId] = Object.keys(state[componentId]).filter(function (key) {
47
51
  return allowedKeys.includes(key);
48
52
  }).reduce(function (obj, key) {
49
53
  // eslint-disable-next-line
@@ -67,7 +71,7 @@ var StateProvider = {
67
71
  };
68
72
  return this.__state;
69
73
  },
70
- mounted: function mounted() {
74
+ created: function created() {
71
75
  this.searchState = filterByKeys(getSearchState(filterProps(this.searchStateProps)), this.includeKeys);
72
76
  },
73
77
  computed: {
@@ -89,7 +93,7 @@ var StateProvider = {
89
93
  watch: {
90
94
  searchState: function searchState(newVal, oldVal) {
91
95
  if (this.isStateChanged(newVal, oldVal)) {
92
- this.$emit('change', newVal, oldVal);
96
+ this.$emit('change', oldVal, newVal);
93
97
  }
94
98
  },
95
99
  selectedValues: function selectedValues(newVal, oldVal) {
@@ -0,0 +1,10 @@
1
+ import { _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
+ import styled from '@appbaseio/vue-emotion';
3
+
4
+ var _templateObject;
5
+ var Title = styled('h2')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tmargin: 0 0 8px;\n\tfont-size: 1rem;\n\tcolor: ", ";\n"])), function (_ref) {
6
+ var theme = _ref.theme;
7
+ return theme.colors.titleColor;
8
+ });
9
+
10
+ export { Title as T };
@@ -1,18 +1,18 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-c9fbe19f.js';
3
- import 'vue-types';
2
+ import './_rollupPluginBabelHelpers-ecf6c03c.js';
3
+ import VueTypes from 'vue-types';
4
4
  import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import 'emotion';
6
6
  import '@appbaseio/vue-emotion';
7
7
  import 'polished';
8
- import { B as Button, t as toggleButtons } from './Button-6c71c66e.js';
9
- import { t as types } from './vueTypes-98d938a9.js';
8
+ import { B as Button, t as toggleButtons } from './Button-799185e2.js';
9
+ import { t as types } from './vueTypes-9326e0be.js';
10
10
  import '@appbaseio/reactivecore/lib/utils/transform';
11
11
  import 'redux';
12
- import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-1fe91a0a.js';
13
- import { C as ComponentWrapper } from './ComponentWrapper-d0b21b95.js';
14
- import { T as Title } from './Title-22c2f3bf.js';
15
- import { C as Container } from './Container-f5efec9e.js';
12
+ import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-5daa8276.js';
13
+ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
14
+ import { T as Title } from './Title-579f8d6c.js';
15
+ import { C as Container } from './Container-4383c6f0.js';
16
16
 
17
17
  var updateQuery = Actions.updateQuery,
18
18
  setQueryOptions = Actions.setQueryOptions,
@@ -28,17 +28,19 @@ var ToggleButton = {
28
28
  componentId: types.stringRequired,
29
29
  data: types.data,
30
30
  dataField: types.stringRequired,
31
- defaultValue: types.stringOrArray,
31
+ defaultValue: types.any,
32
32
  value: types.stringOrArray,
33
33
  filterLabel: types.string,
34
34
  nestedField: types.string,
35
35
  innerClass: types.style,
36
- multiSelect: types.bool,
36
+ multiSelect: VueTypes.bool,
37
37
  react: types.react,
38
- showFilter: types.bool,
38
+ showFilter: VueTypes.bool,
39
39
  title: types.title,
40
- URLParams: types.bool,
41
- renderItem: types.func
40
+ URLParams: VueTypes.bool,
41
+ renderItem: types.func,
42
+ index: VueTypes.string,
43
+ enableStrictSelection: VueTypes.bool
42
44
  },
43
45
  data: function data() {
44
46
  this.__state = {
@@ -58,7 +60,11 @@ var ToggleButton = {
58
60
  }
59
61
  },
60
62
  created: function created() {
61
- // Set custom query in store
63
+ if (!this.enableAppbase && this.$props.index) {
64
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
65
+ } // Set custom query in store
66
+
67
+
62
68
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
63
69
  },
64
70
  watch: {
@@ -180,7 +186,7 @@ var ToggleButton = {
180
186
  var _ref = customQuery(value, props) || {};
181
187
 
182
188
  query = _ref.query;
183
- this.setQueryOptions(props.componentId, getOptionsFromQuery(customQuery(value, props)));
189
+ this.setQueryOptions(props.componentId, getOptionsFromQuery(customQuery(value, props)), false);
184
190
  updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
185
191
  }
186
192
 
@@ -196,6 +202,16 @@ var ToggleButton = {
196
202
  });
197
203
  },
198
204
  handleClick: function handleClick(item) {
205
+ var _this$$props = this.$props,
206
+ enableStrictSelection = _this$$props.enableStrictSelection,
207
+ multiSelect = _this$$props.multiSelect;
208
+
209
+ if (enableStrictSelection && !multiSelect && this.$data.currentValue.find(function (stateItem) {
210
+ return isEqual(item, stateItem);
211
+ })) {
212
+ return false;
213
+ }
214
+
199
215
  var value = this.$props.value;
200
216
 
201
217
  if (value === undefined) {
@@ -203,6 +219,8 @@ var ToggleButton = {
203
219
  } else {
204
220
  this.$emit('change', item.value);
205
221
  }
222
+
223
+ return true;
206
224
  },
207
225
  renderButton: function renderButton(item) {
208
226
  var _this2 = this;
@@ -305,7 +323,8 @@ ToggleButton.defaultQuery = function (value, props) {
305
323
  var mapStateToProps = function mapStateToProps(state, props) {
306
324
  return {
307
325
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
308
- componentProps: state.props[props.componentId]
326
+ componentProps: state.props[props.componentId],
327
+ enableAppbase: state.config.enableAppbase
309
328
  };
310
329
  };
311
330
 
@@ -19,7 +19,17 @@ function _extends() {
19
19
  function _inheritsLoose(subClass, superClass) {
20
20
  subClass.prototype = Object.create(superClass.prototype);
21
21
  subClass.prototype.constructor = subClass;
22
- subClass.__proto__ = superClass;
22
+
23
+ _setPrototypeOf(subClass, superClass);
24
+ }
25
+
26
+ function _setPrototypeOf(o, p) {
27
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
28
+ o.__proto__ = p;
29
+ return o;
30
+ };
31
+
32
+ return _setPrototypeOf(o, p);
23
33
  }
24
34
 
25
35
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -1,5 +1,5 @@
1
1
  import { helper } from '@appbaseio/reactivecore';
2
- import { a as _extends } from './_rollupPluginBabelHelpers-c9fbe19f.js';
2
+ import { a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import { validProps } from '@appbaseio/reactivecore/lib/utils/constants';
4
4
  import { bindActionCreators } from 'redux';
5
5
 
@@ -52,7 +52,7 @@ var normalizeMapState = function normalizeMapState(mapState) {
52
52
  }).reduce(function (map, key) {
53
53
  var _extends2;
54
54
 
55
- return _extends(_extends({}, map), {}, (_extends2 = {}, _extends2[key] = mapState[key](state, ownProps), _extends2));
55
+ return _extends({}, map, (_extends2 = {}, _extends2[key] = mapState[key](state, ownProps), _extends2));
56
56
  }, {});
57
57
  };
58
58
  }
@@ -77,12 +77,12 @@ var connector = function connector(_mapState, mapDispatch) {
77
77
  mixins: [component],
78
78
  inject: ['$$store'],
79
79
  data: function data() {
80
- var merged = _extends(_extends({}, mapState(this.$$store.getState(), this.$props || {})), bindActionCreators(mapDispatch, this.$$store.dispatch));
80
+ var merged = _extends({}, mapState(this.$$store.getState(), this.$props || {}), bindActionCreators(mapDispatch, this.$$store.dispatch));
81
81
 
82
82
  return Object.keys(merged).reduce(function (data, key) {
83
83
  var _extends3;
84
84
 
85
- return _extends(_extends({}, data), {}, (_extends3 = {}, _extends3[key] = merged[key], _extends3));
85
+ return _extends({}, data, (_extends3 = {}, _extends3[key] = merged[key], _extends3));
86
86
  }, {});
87
87
  },
88
88
  created: function created() {
@@ -129,6 +129,7 @@ var connect = function connect() {
129
129
  // storeKey,
130
130
  // });
131
131
 
132
+ var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
132
133
  var composeThemeObject = function composeThemeObject(ownTheme, userTheme) {
133
134
  if (ownTheme === void 0) {
134
135
  ownTheme = {};
@@ -139,9 +140,9 @@ var composeThemeObject = function composeThemeObject(ownTheme, userTheme) {
139
140
  }
140
141
 
141
142
  return {
142
- typography: _extends(_extends({}, ownTheme.typography), userTheme.typography),
143
- colors: _extends(_extends({}, ownTheme.colors), userTheme.colors),
144
- component: _extends(_extends({}, ownTheme.component), userTheme.component)
143
+ typography: _extends({}, ownTheme.typography, userTheme.typography),
144
+ colors: _extends({}, ownTheme.colors, userTheme.colors),
145
+ component: _extends({}, ownTheme.component, userTheme.component)
145
146
  };
146
147
  };
147
148
  /**
@@ -154,10 +155,16 @@ var isFunction = function isFunction(element) {
154
155
  }; // parses current array (i.e. this.$props.value) for `onChange` callback for multi-* components
155
156
 
156
157
  function parseValueArray(objectValues, currentValue) {
157
- var keys = Object.keys(objectValues);
158
- var selectedValues = keys.map(function (key) {
159
- return objectValues[key] ? key : null;
160
- });
158
+ var selectedValues;
159
+
160
+ if (Array.isArray(objectValues)) {
161
+ selectedValues = [].concat(objectValues);
162
+ } else {
163
+ var keys = Object.keys(objectValues);
164
+ selectedValues = keys.map(function (key) {
165
+ return objectValues[key] ? key : null;
166
+ });
167
+ }
161
168
 
162
169
  if (selectedValues.includes(currentValue)) {
163
170
  return selectedValues.filter(function (item) {
@@ -216,12 +223,12 @@ var isEvent = function isEvent(candidate) {
216
223
  return !!(candidate && candidate.stopPropagation && candidate.preventDefault);
217
224
  };
218
225
  var updateDefaultQuery = function updateDefaultQuery(componentId, setDefaultQuery, props, value) {
219
- defaultQueryUtil(componentId, _extends(_extends({}, props), {}, {
226
+ defaultQueryUtil(componentId, _extends({}, props, {
220
227
  setDefaultQuery: setDefaultQuery
221
228
  }), value);
222
229
  };
223
230
  var updateCustomQuery = function updateCustomQuery(componentId, setCustomQuery, props, value) {
224
- customQueryUtil(componentId, _extends(_extends({}, props), {}, {
231
+ customQueryUtil(componentId, _extends({}, props, {
225
232
  setCustomQuery: setCustomQuery
226
233
  }), value);
227
234
  };
@@ -294,5 +301,68 @@ var getCamelCase = function getCamelCase(str) {
294
301
  var capitalString = capital.join('');
295
302
  return capitalString || '';
296
303
  };
304
+ var isEmpty = function isEmpty(val) {
305
+ return !(val && val.length && Object.keys(val).length);
306
+ };
307
+ function isNumeric(value) {
308
+ return /^-?\d+$/.test(value);
309
+ } // check if passed shortcut a key combination
310
+
311
+ function isHotkeyCombination(hotkey) {
312
+ return typeof hotkey === 'string' && hotkey.indexOf('+') !== -1;
313
+ } // used for getting correct string char from keycode passed
314
+ // the below algebraic expression is used to get the correct ascii code out of the e.which || e.keycode returned value
315
+ // since the keyboards doesn't understand ascii but scan codes and they differ for certain keys such as '/'
316
+ // stackoverflow ref: https://stackoverflow.com/a/29811987/10822996
317
+
318
+ function getCharFromCharCode(passedCharCode) {
319
+ var which = passedCharCode;
320
+ var chrCode = which - 48 * Math.floor(which / 48);
321
+ return String.fromCharCode(which >= 96 ? chrCode : which);
322
+ } // used for parsing focusshortcuts for keycodes passed as string, eg: 'ctrl+/' is same as 'ctrl+47'
323
+ // returns focusShortcuts containing appropriate key charsas depicted on keyboards
324
+
325
+ function parseFocusShortcuts(focusShortcutsArray) {
326
+ if (isEmpty(focusShortcutsArray)) return [];
327
+ var parsedFocusShortcutsArray = [];
328
+ focusShortcutsArray.forEach(function (element) {
329
+ if (typeof element === 'string') {
330
+ if (isHotkeyCombination(element)) {
331
+ // splitting the combination into pieces
332
+ var splitCombination = element.split('+');
333
+ var parsedSplitCombination = []; // parsedCombination would have all the keycodes converted into chars
334
+
335
+ var parsedCombination = '';
336
+
337
+ for (var i = 0; i < splitCombination.length; i += 1) {
338
+ if (isNumeric(splitCombination[i])) {
339
+ parsedSplitCombination.push(getCharFromCharCode(+splitCombination[i]));
340
+ } else {
341
+ parsedSplitCombination.push(splitCombination[i]);
342
+ }
343
+ }
344
+
345
+ parsedCombination = parsedSplitCombination.join('+');
346
+ parsedFocusShortcutsArray.push(parsedCombination);
347
+ } else if (isNumeric(element)) {
348
+ parsedFocusShortcutsArray.push(getCharFromCharCode(+element));
349
+ } else {
350
+ // single char shortcut, eg: '/'
351
+ parsedFocusShortcutsArray.push(element);
352
+ }
353
+ } else {
354
+ // if not a string the the shortcut is assumed to be a keycode
355
+ parsedFocusShortcutsArray.push(getCharFromCharCode(element));
356
+ }
357
+ });
358
+ return parsedFocusShortcutsArray;
359
+ }
360
+ var MODIFIER_KEYS = ['shift', 'ctrl', 'alt', 'control', 'option', 'cmd', 'command']; // filter out modifierkeys such as ctrl, alt, command, shift from focusShortcuts prop
361
+
362
+ function extractModifierKeysFromFocusShortcuts(focusShortcutsArray) {
363
+ return focusShortcutsArray.filter(function (shortcutKey) {
364
+ return MODIFIER_KEYS.includes(shortcutKey);
365
+ });
366
+ }
297
367
 
298
- export { isFunction as a, getCamelCase as b, connect as c, getValidPropsKeys as d, composeThemeObject as e, updateCustomQuery as f, getComponent as g, hasCustomRenderer as h, isQueryIdentical as i, getQuerySuggestionsComponent as j, hasQuerySuggestionsRenderer as k, isEvent as l, parseValueArray as p, updateDefaultQuery as u };
368
+ export { X_SEARCH_CLIENT as X, isFunction as a, getCamelCase as b, connect as c, getValidPropsKeys as d, composeThemeObject as e, updateCustomQuery as f, getComponent as g, hasCustomRenderer as h, isQueryIdentical as i, getQuerySuggestionsComponent as j, isEmpty as k, extractModifierKeysFromFocusShortcuts as l, hasQuerySuggestionsRenderer as m, isEvent as n, parseValueArray as o, parseFocusShortcuts as p, updateDefaultQuery as u };