@appbaseio/reactivesearch-vue 1.16.0-alpha.6 → 1.16.0-alpha.62

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 (105) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +16030 -13113
  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-446f819e.js +68 -0
  6. package/dist/cjs/{DownShift-966a58cb.js → CancelSvg-9f258f4f.js} +60 -16
  7. package/dist/cjs/Card-642547a8.js +30 -0
  8. package/dist/cjs/{ComponentWrapper-603848ed.js → ComponentWrapper-ad3dad02.js} +40 -21
  9. package/dist/cjs/{Container-6cdd3864.js → Container-daf30918.js} +3 -11
  10. package/dist/cjs/DataSearch-86914b10.js +2322 -0
  11. package/dist/cjs/DataSearch.js +18 -2151
  12. package/dist/cjs/{DropDown-f6224ac8.js → DropDown-5513ea77.js} +80 -95
  13. package/dist/cjs/DynamicRangeSlider.js +107 -43
  14. package/dist/cjs/Flex-aa517a13.js +52 -0
  15. package/dist/cjs/FormControlList-c195a592.js +47 -0
  16. package/dist/cjs/Input-e6603a7e.js +79 -0
  17. package/dist/cjs/ListItem-8c9e0d68.js +46 -0
  18. package/dist/cjs/MultiDropdownList.js +102 -68
  19. package/dist/cjs/MultiList.js +80 -50
  20. package/dist/cjs/MultiRange.js +21 -16
  21. package/dist/cjs/{Pagination-af399262.js → Pagination-fe5452fc.js} +14 -8
  22. package/dist/cjs/RangeInput.js +29 -45
  23. package/dist/cjs/RangeSlider.js +32 -30
  24. package/dist/cjs/ReactiveBase.js +87 -56
  25. package/dist/cjs/ReactiveComponent.js +75 -62
  26. package/dist/cjs/ReactiveGoogleMap.js +262 -191
  27. package/dist/cjs/ReactiveList.js +189 -241
  28. package/dist/cjs/ResultCard.js +8 -6
  29. package/dist/cjs/ResultList.js +8 -6
  30. package/dist/cjs/SelectedFilters.js +66 -34
  31. package/dist/cjs/SingleDropdownList.js +88 -60
  32. package/dist/cjs/SingleList.js +53 -35
  33. package/dist/cjs/SingleRange.js +19 -14
  34. package/dist/cjs/StateProvider.js +39 -10
  35. package/dist/cjs/{Title-65d39104.js → Title-1de7d0f4.js} +3 -11
  36. package/dist/cjs/ToggleButton.js +36 -16
  37. package/dist/cjs/{_rollupPluginBabelHelpers-4abdbfff.js → _rollupPluginBabelHelpers-c705cbe6.js} +2 -4
  38. package/dist/cjs/{index-baca18c4.js → index-6a167fe0.js} +99 -13
  39. package/dist/cjs/index.js +31 -25
  40. package/dist/cjs/initReactivesearch.js +178 -104
  41. package/dist/cjs/install-004c6aa4.js +1408 -0
  42. package/dist/cjs/install.js +42 -44
  43. package/dist/cjs/ssr-3027b848.js +39 -0
  44. package/dist/cjs/{utils-ea846a20.js → utils-d6a52588.js} +2 -2
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
  47. package/dist/es/Button-d8bc15ea.js +59 -0
  48. package/dist/es/{DownShift-92347b5e.js → CancelSvg-4cfae5fd.js} +56 -17
  49. package/dist/es/Card-450683f1.js +23 -0
  50. package/dist/es/{ComponentWrapper-c4c91949.js → ComponentWrapper-424e86fd.js} +40 -21
  51. package/dist/es/Container-ba826e96.js +10 -0
  52. package/dist/es/DataSearch-e71a1014.js +2307 -0
  53. package/dist/es/DataSearch.js +17 -2150
  54. package/dist/es/{DropDown-3d4291f1.js → DropDown-7d9a15c1.js} +79 -94
  55. package/dist/es/DynamicRangeSlider.js +107 -43
  56. package/dist/es/Flex-1f0795c3.js +47 -0
  57. package/dist/es/FormControlList-c22d64f6.js +40 -0
  58. package/dist/es/Input-7a2a9fac.js +71 -0
  59. package/dist/es/ListItem-cad14c5e.js +39 -0
  60. package/dist/es/MultiDropdownList.js +102 -68
  61. package/dist/es/MultiList.js +80 -50
  62. package/dist/es/MultiRange.js +21 -16
  63. package/dist/es/{Pagination-c2a00175.js → Pagination-3f350098.js} +14 -8
  64. package/dist/es/RangeInput.js +29 -45
  65. package/dist/es/RangeSlider.js +32 -30
  66. package/dist/es/ReactiveBase.js +87 -56
  67. package/dist/es/ReactiveComponent.js +75 -62
  68. package/dist/es/ReactiveGoogleMap.js +262 -191
  69. package/dist/es/ReactiveList.js +189 -241
  70. package/dist/es/ResultCard.js +8 -6
  71. package/dist/es/ResultList.js +8 -6
  72. package/dist/es/SelectedFilters.js +66 -34
  73. package/dist/es/SingleDropdownList.js +88 -60
  74. package/dist/es/SingleList.js +53 -35
  75. package/dist/es/SingleRange.js +19 -14
  76. package/dist/es/StateProvider.js +39 -10
  77. package/dist/es/Title-3342664a.js +10 -0
  78. package/dist/es/ToggleButton.js +36 -16
  79. package/dist/es/{_rollupPluginBabelHelpers-ecf6c03c.js → _rollupPluginBabelHelpers-76660dab.js} +2 -4
  80. package/dist/es/{index-185b6266.js → index-7788a843.js} +95 -14
  81. package/dist/es/index.js +27 -22
  82. package/dist/es/initReactivesearch.js +179 -105
  83. package/dist/es/install-b7b604cc.js +1401 -0
  84. package/dist/es/install.js +40 -46
  85. package/dist/es/ssr-b2c0b401.js +33 -0
  86. package/dist/es/{utils-57cc8789.js → utils-9e68acee.js} +2 -2
  87. package/dist/es/version.js +1 -1
  88. package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
  89. package/package.json +6 -4
  90. package/dist/cjs/Button-d48d4365.js +0 -146
  91. package/dist/cjs/Card-9748fbb2.js +0 -58
  92. package/dist/cjs/Flex-befd65fc.js +0 -160
  93. package/dist/cjs/FormControlList-f3857d4b.js +0 -105
  94. package/dist/cjs/Input-95cb19f8.js +0 -178
  95. package/dist/cjs/ListItem-84d185cf.js +0 -84
  96. package/dist/cjs/ssr-3ca8a14f.js +0 -47
  97. package/dist/es/Button-27cc8574.js +0 -137
  98. package/dist/es/Card-1f93780d.js +0 -51
  99. package/dist/es/Container-88c805ef.js +0 -18
  100. package/dist/es/Flex-16d1103a.js +0 -155
  101. package/dist/es/FormControlList-96d44e7b.js +0 -98
  102. package/dist/es/Input-1159c4b5.js +0 -170
  103. package/dist/es/ListItem-d22510c9.js +0 -77
  104. package/dist/es/Title-f0217338.js +0 -18
  105. package/dist/es/ssr-a710392b.js +0 -41
@@ -1,12 +1,12 @@
1
- import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
1
+ import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-76660dab.js';
2
2
  import VueTypes from 'vue-types';
3
3
  import 'emotion';
4
4
  import '@appbaseio/vue-emotion';
5
5
  import 'polished';
6
- import { t as types } from './vueTypes-98d938a9.js';
6
+ import { t as types } from './vueTypes-9326e0be.js';
7
7
  import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
8
- import { T as Title } from './Title-f0217338.js';
9
- import { I as Image, C as Card } from './Card-1f93780d.js';
8
+ import { T as Title } from './Title-3342664a.js';
9
+ import { I as Image, C as Card } from './Card-450683f1.js';
10
10
 
11
11
  var ResultCardTitle = {
12
12
  name: 'ResultCardTitle',
@@ -21,6 +21,7 @@ ResultCardTitle.install = function (Vue) {
21
21
  Vue.component(ResultCardTitle.name, ResultCardTitle);
22
22
  };
23
23
 
24
+ var _excluded = ["src"];
24
25
  var ResultCardImage = {
25
26
  name: 'ResultCardImage',
26
27
  props: {
@@ -31,7 +32,7 @@ var ResultCardImage = {
31
32
 
32
33
  var _this$$props = this.$props,
33
34
  src = _this$$props.src,
34
- props = _objectWithoutPropertiesLoose(_this$$props, ["src"]);
35
+ props = _objectWithoutPropertiesLoose(_this$$props, _excluded);
35
36
 
36
37
  return h(Image, _mergeJSXProps([{
37
38
  "style": {
@@ -60,6 +61,7 @@ ResultCardDescription.install = function (Vue) {
60
61
  Vue.component(ResultCardDescription.name, ResultCardDescription);
61
62
  };
62
63
 
64
+ var _excluded$1 = ["href", "target"];
63
65
  var ResultCard = {
64
66
  name: 'ResultCard',
65
67
  components: {
@@ -78,7 +80,7 @@ var ResultCard = {
78
80
  var _this$$props = this.$props,
79
81
  href = _this$$props.href,
80
82
  target = _this$$props.target,
81
- rest = _objectWithoutPropertiesLoose(_this$$props, ["href", "target"]);
83
+ rest = _objectWithoutPropertiesLoose(_this$$props, _excluded$1);
82
84
 
83
85
  return h(Card, _mergeJSXProps([{
84
86
  "attrs": {
@@ -1,12 +1,12 @@
1
- import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
1
+ import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-76660dab.js';
2
2
  import VueTypes from 'vue-types';
3
3
  import 'emotion';
4
4
  import '@appbaseio/vue-emotion';
5
5
  import 'polished';
6
- import { t as types } from './vueTypes-98d938a9.js';
6
+ import { t as types } from './vueTypes-9326e0be.js';
7
7
  import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
8
- import { T as Title } from './Title-f0217338.js';
9
- import { I as Image, L as ListItem } from './ListItem-d22510c9.js';
8
+ import { T as Title } from './Title-3342664a.js';
9
+ import { I as Image, L as ListItem } from './ListItem-cad14c5e.js';
10
10
 
11
11
  var ResultListContent = {
12
12
  name: 'ResultListContent',
@@ -38,6 +38,7 @@ ResultListDescription.install = function (Vue) {
38
38
  Vue.component(ResultListDescription.name, ResultListDescription);
39
39
  };
40
40
 
41
+ var _excluded = ["src", "small"];
41
42
  var ResultListImage = {
42
43
  name: 'ResultListImage',
43
44
  props: {
@@ -50,7 +51,7 @@ var ResultListImage = {
50
51
  var _this$$props = this.$props,
51
52
  src = _this$$props.src,
52
53
  small = _this$$props.small,
53
- props = _objectWithoutPropertiesLoose(_this$$props, ["src", "small"]);
54
+ props = _objectWithoutPropertiesLoose(_this$$props, _excluded);
54
55
 
55
56
  return h(Image, _mergeJSXProps([{
56
57
  "attrs": {
@@ -78,6 +79,7 @@ ResultListTitle.install = function (Vue) {
78
79
  Vue.component(ResultListTitle.name, ResultListTitle);
79
80
  };
80
81
 
82
+ var _excluded$1 = ["href", "target"];
81
83
  var ResultList = {
82
84
  name: 'ResultList',
83
85
  props: {
@@ -117,7 +119,7 @@ var ResultList = {
117
119
  var _this$$props = this.$props,
118
120
  href = _this$$props.href,
119
121
  target = _this$$props.target,
120
- props = _objectWithoutPropertiesLoose(_this$$props, ["href", "target"]);
122
+ props = _objectWithoutPropertiesLoose(_this$$props, _excluded$1);
121
123
 
122
124
  var hasImage = this.hasImage,
123
125
  isSmall = this.isSmall;
@@ -1,19 +1,20 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import { a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
+ import { a as _extends } from './_rollupPluginBabelHelpers-76660dab.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import 'emotion';
6
6
  import '@appbaseio/vue-emotion';
7
7
  import 'polished';
8
- import { f as filters, B as Button } from './Button-27cc8574.js';
9
- import { t as types } from './vueTypes-98d938a9.js';
8
+ import { f as filters, B as Button } from './Button-d8bc15ea.js';
9
+ import { t as types } from './vueTypes-9326e0be.js';
10
10
  import 'redux';
11
- import { c as connect } from './index-185b6266.js';
12
- import { T as Title } from './Title-f0217338.js';
13
- import { C as Container } from './Container-88c805ef.js';
11
+ import { n as decodeHtml, c as connect } from './index-7788a843.js';
12
+ import { T as Title } from './Title-3342664a.js';
13
+ import { C as Container } from './Container-ba826e96.js';
14
14
 
15
15
  var setValue = Actions.setValue,
16
- clearValues = Actions.clearValues;
16
+ clearValues = Actions.clearValues,
17
+ resetValuesToDefault = Actions.resetValuesToDefault;
17
18
  var getClassName = helper.getClassName,
18
19
  handleA11yAction = helper.handleA11yAction;
19
20
  var SelectedFilters = {
@@ -23,7 +24,10 @@ var SelectedFilters = {
23
24
  clearAllLabel: VueTypes.string.def('Clear All'),
24
25
  innerClass: types.style,
25
26
  showClearAll: VueTypes.bool.def(true),
26
- title: types.title
27
+ title: types.title,
28
+ resetToDefault: VueTypes.bool.def(false),
29
+ clearAllBlacklistComponents: VueTypes.array,
30
+ resetToValues: VueTypes.object
27
31
  },
28
32
  inject: {
29
33
  theme: {
@@ -40,7 +44,9 @@ var SelectedFilters = {
40
44
  components: this.components,
41
45
  selectedValues: this.selectedValues,
42
46
  clearValues: this.clearValues,
43
- setValue: this.setValue
47
+ clearValue: this.clearValue,
48
+ setValue: this.setValue,
49
+ resetValuesToDefault: this.resetValuesToDefault
44
50
  });
45
51
  }
46
52
 
@@ -50,7 +56,7 @@ var SelectedFilters = {
50
56
  "class": filters(this.theme) + " " + (this.$props.className || '')
51
57
  }, [this.$props.title && hasValues && h(Title, {
52
58
  "class": getClassName(this.$props.innerClass, 'title') || ''
53
- }, [this.$props.title]), filtersToRender, this.$props.showClearAll && hasValues ? h(Button, {
59
+ }, [this.$props.title]), filtersToRender, this.$props.showClearAll && hasValues && filtersToRender.length > 1 ? h(Button, {
54
60
  "class": getClassName(this.$props.innerClass, 'button') || '',
55
61
  "on": _extends({}, {
56
62
  click: this.clearValues,
@@ -75,8 +81,31 @@ var SelectedFilters = {
75
81
  this.$emit('clear', component, value);
76
82
  },
77
83
  clearValues: function clearValues() {
78
- this.clearValuesAction();
79
- this.$emit('clear', null);
84
+ var resetToDefault = this.resetToDefault,
85
+ resetToValues = this.resetToValues,
86
+ clearAllBlacklistComponents = this.clearAllBlacklistComponents;
87
+
88
+ if (resetToDefault) {
89
+ this.resetValuesToDefault(clearAllBlacklistComponents);
90
+ } else {
91
+ this.clearValuesAction(resetToValues, clearAllBlacklistComponents);
92
+ }
93
+
94
+ this.$emit('clear', resetToValues);
95
+ },
96
+ clearValue: function clearValue(componentId) {
97
+ var resetToDefault = this.resetToDefault,
98
+ resetToValues = this.resetToValues;
99
+
100
+ if (resetToDefault) {
101
+ this.resetValuesToDefault(this.components.filter(function (component) {
102
+ return component !== componentId;
103
+ }));
104
+ } else {
105
+ this.setValue(componentId, (resetToValues == null ? void 0 : resetToValues[componentId]) || null);
106
+ }
107
+
108
+ this.$emit('clear', resetToValues == null ? void 0 : resetToValues[componentId]);
80
109
  },
81
110
  renderValue: function renderValue(value, isArray) {
82
111
  var _this2 = this;
@@ -101,39 +130,41 @@ var SelectedFilters = {
101
130
 
102
131
  return value;
103
132
  },
133
+ renderFilterButton: function renderFilterButton(component, keyProp, handleRemove, label) {
134
+ var h = this.$createElement;
135
+ return h(Button, {
136
+ "class": getClassName(this.$props.innerClass, 'button') || '',
137
+ "key": keyProp,
138
+ "on": _extends({}, {
139
+ click: handleRemove,
140
+ keypress: function keypress(event) {
141
+ return handleA11yAction(event, handleRemove);
142
+ }
143
+ }),
144
+ "attrs": {
145
+ "tabIndex": "0"
146
+ }
147
+ }, [h("span", [label]), h("span", ["\u2715"])]);
148
+ },
104
149
  renderFilters: function renderFilters() {
105
150
  var _this3 = this;
106
151
 
107
- var h = this.$createElement;
108
152
  var selectedValues = this.selectedValues;
109
- return Object.keys(selectedValues).filter(function (id) {
153
+ var filterComponents = Object.keys(selectedValues).filter(function (id) {
110
154
  return _this3.components.includes(id) && selectedValues[id].showFilter;
111
- }).map(function (component, index) {
155
+ });
156
+ return filterComponents.map(function (component, index) {
112
157
  var _selectedValues$compo = selectedValues[component],
113
158
  label = _selectedValues$compo.label,
114
159
  value = _selectedValues$compo.value;
115
- var isArray = Array.isArray(value);
160
+ var isArray = Array.isArray(value); // default behaviour
116
161
 
117
162
  if (label && (isArray && value.length || !isArray && value)) {
118
163
  var valueToRender = _this3.renderValue(value, isArray);
119
164
 
120
- return h(Button, {
121
- "class": getClassName(_this3.$props.innerClass, 'button') || '',
122
- "key": component + "-" + (index + 1),
123
- "on": _extends({}, {
124
- click: function click() {
125
- return _this3.remove(component, value);
126
- },
127
- keypress: function keypress(event) {
128
- return handleA11yAction(event, function () {
129
- return _this3.remove(component, value);
130
- });
131
- }
132
- }),
133
- "attrs": {
134
- "tabIndex": "0"
135
- }
136
- }, [h("span", [selectedValues[component].label, ": ", valueToRender]), h("span", ["\u2715"])]);
165
+ return _this3.renderFilterButton(component, component + "-" + (index + 1), function () {
166
+ return _this3.remove(component, value);
167
+ }, selectedValues[component].label + ": " + decodeHtml(valueToRender));
137
168
  }
138
169
 
139
170
  return null;
@@ -156,7 +187,8 @@ var mapStateToProps = function mapStateToProps(state) {
156
187
 
157
188
  var mapDispatchtoProps = {
158
189
  clearValuesAction: clearValues,
159
- setValue: setValue
190
+ setValue: setValue,
191
+ resetValuesToDefault: resetValuesToDefault
160
192
  };
161
193
  var RcConnected = connect(mapStateToProps, mapDispatchtoProps)(SelectedFilters);
162
194
 
@@ -1,23 +1,25 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import { a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
+ import { a as _extends } from './_rollupPluginBabelHelpers-76660dab.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 { l as loadMoreContainer, B as Button } from './Button-27cc8574.js';
9
- import { t as types } from './vueTypes-98d938a9.js';
8
+ import { l as loadMoreContainer, B as Button } from './Button-d8bc15ea.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, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, g as getComponent, h as hasCustomRenderer, c as connect } from './index-185b6266.js';
13
- import { C as ComponentWrapper } from './ComponentWrapper-c4c91949.js';
14
- import { T as Title } from './Title-f0217338.js';
15
- import './Input-1159c4b5.js';
12
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, g as getComponent, h as hasCustomRenderer, c as connect } from './index-7788a843.js';
13
+ import { C as ComponentWrapper } from './ComponentWrapper-424e86fd.js';
14
+ import '@vue/babel-helper-vue-jsx-merge-props';
15
+ import { T as Title } from './Title-3342664a.js';
16
+ import './CancelSvg-4cfae5fd.js';
17
+ import './Input-7a2a9fac.js';
16
18
  import 'compute-scroll-into-view';
17
- import './DownShift-92347b5e.js';
18
- import { C as Container } from './Container-88c805ef.js';
19
- import { g as getAggsQuery } from './utils-57cc8789.js';
20
- import { D as Dropdown } from './DropDown-3d4291f1.js';
19
+ import { C as Container } from './Container-ba826e96.js';
20
+ import '@appbaseio/reactivecore/lib/utils/suggestions';
21
+ import { g as getAggsQuery } from './utils-9e68acee.js';
22
+ import { D as Dropdown } from './DropDown-7d9a15c1.js';
21
23
 
22
24
  var updateQuery = Actions.updateQuery,
23
25
  setQueryOptions = Actions.setQueryOptions,
@@ -27,9 +29,10 @@ var getQueryOptions = helper.getQueryOptions,
27
29
  checkValueChange = helper.checkValueChange,
28
30
  checkPropChange = helper.checkPropChange,
29
31
  getClassName = helper.getClassName,
30
- getOptionsFromQuery = helper.getOptionsFromQuery,
31
32
  isEqual = helper.isEqual,
32
- getCompositeAggsQuery = helper.getCompositeAggsQuery;
33
+ getCompositeAggsQuery = helper.getCompositeAggsQuery,
34
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
35
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
33
36
  var SingleDropdownList = {
34
37
  name: 'SingleDropdownList',
35
38
  data: function data() {
@@ -66,19 +69,28 @@ var SingleDropdownList = {
66
69
  selectAllLabel: types.string,
67
70
  showCount: VueTypes.bool.def(true),
68
71
  showFilter: VueTypes.bool.def(true),
69
- size: VueTypes.number.def(100),
72
+ size: VueTypes.number,
70
73
  sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
71
74
  title: types.title,
72
75
  URLParams: VueTypes.bool.def(false),
73
76
  showMissing: VueTypes.bool.def(false),
74
77
  missingLabel: VueTypes.string.def('N/A'),
75
78
  showSearch: VueTypes.bool.def(false),
79
+ showClear: VueTypes.bool.def(false),
76
80
  showLoadMore: VueTypes.bool.def(false),
77
81
  loadMoreLabel: VueTypes.oneOfType([VueTypes.string, VueTypes.any]).def('Load More'),
78
- nestedField: types.string
82
+ nestedField: types.string,
83
+ index: VueTypes.string,
84
+ searchPlaceholder: VueTypes.string.def('Type here to search...')
79
85
  },
80
86
  created: function created() {
81
- // Set custom and default queries in store
87
+ if (!this.enableAppbase && this.$props.index) {
88
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
89
+ }
90
+
91
+ var props = this.$props;
92
+ this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : []; // Set custom and default queries in store
93
+
82
94
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
83
95
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
84
96
  },
@@ -97,33 +109,35 @@ var SingleDropdownList = {
97
109
  options: function options(newVal, oldVal) {
98
110
  var _this = this;
99
111
 
100
- checkPropChange(oldVal, newVal, function () {
101
- var _this$$props = _this.$props,
102
- showLoadMore = _this$$props.showLoadMore,
103
- dataField = _this$$props.dataField;
104
- var modifiedOptions = _this.$data.modifiedOptions;
105
-
106
- if (showLoadMore) {
107
- // append options with showLoadMore
108
- var buckets = newVal[dataField].buckets;
109
- var nextOptions = [].concat(modifiedOptions, buckets.map(function (bucket) {
110
- return {
111
- key: bucket.key[dataField],
112
- doc_count: bucket.doc_count
112
+ if (newVal) {
113
+ checkPropChange(oldVal, newVal, function () {
114
+ var _this$$props = _this.$props,
115
+ showLoadMore = _this$$props.showLoadMore,
116
+ dataField = _this$$props.dataField;
117
+ var modifiedOptions = _this.$data.modifiedOptions;
118
+
119
+ if (showLoadMore) {
120
+ // append options with showLoadMore
121
+ var buckets = newVal[dataField].buckets;
122
+ var nextOptions = [].concat(modifiedOptions, buckets.map(function (bucket) {
123
+ return {
124
+ key: bucket.key[dataField],
125
+ doc_count: bucket.doc_count
126
+ };
127
+ }));
128
+ var after = newVal[dataField].after_key; // detect the last bucket by checking if the next set of buckets were empty
129
+
130
+ var isLastBucket = !buckets.length;
131
+ _this.after = {
132
+ after: after
113
133
  };
114
- }));
115
- var after = newVal[dataField].after_key; // detect the last bucket by checking if the next set of buckets were empty
116
-
117
- var isLastBucket = !buckets.length;
118
- _this.after = {
119
- after: after
120
- };
121
- _this.isLastBucket = isLastBucket;
122
- _this.modifiedOptions = nextOptions;
123
- } else {
124
- _this.modifiedOptions = newVal[_this.$props.dataField] ? newVal[_this.$props.dataField].buckets : [];
125
- }
126
- });
134
+ _this.isLastBucket = isLastBucket;
135
+ _this.modifiedOptions = nextOptions;
136
+ } else {
137
+ _this.modifiedOptions = newVal[_this.$props.dataField] ? newVal[_this.$props.dataField].buckets : [];
138
+ }
139
+ });
140
+ }
127
141
  },
128
142
  size: function size() {
129
143
  this.updateQueryOptions(this.$props);
@@ -172,12 +186,21 @@ var SingleDropdownList = {
172
186
  var renderItemCalc = this.$scopedSlots.renderItem || renderItem;
173
187
  var renderErrorCalc = this.$scopedSlots.renderError || renderError;
174
188
  var renderLabelCalc = this.$scopedSlots.renderLabel || renderLabel;
189
+ var renderNoResults = this.$scopedSlots.renderNoResults || this.$props.renderNoResults;
175
190
 
176
191
  if (renderErrorCalc && this.error) {
177
192
  return isFunction(renderErrorCalc) ? renderErrorCalc(this.error) : renderErrorCalc;
178
193
  }
179
194
 
180
- if (!this.hasCustomRenderer && this.$data.modifiedOptions.length === 0) {
195
+ if (!this.hasCustomRenderer && this.$data.modifiedOptions.length === 0 && !this.isLoading) {
196
+ if (renderNoResults && isFunction(renderNoResults)) {
197
+ return h("div", [renderNoResults()]);
198
+ }
199
+
200
+ if (renderNoResults && !isFunction(renderNoResults)) {
201
+ return renderNoResults;
202
+ }
203
+
181
204
  return null;
182
205
  }
183
206
 
@@ -197,7 +220,7 @@ var SingleDropdownList = {
197
220
  "items": [].concat(selectAll, this.$data.modifiedOptions.filter(function (item) {
198
221
  return String(item.key).trim().length;
199
222
  }).map(function (item) {
200
- return _extends(_extends({}, item), {}, {
223
+ return _extends({}, item, {
201
224
  key: String(item.key)
202
225
  });
203
226
  })),
@@ -212,6 +235,8 @@ var SingleDropdownList = {
212
235
  "renderNoResults": this.$scopedSlots.renderNoResults || this.$props.renderNoResults,
213
236
  "themePreset": this.themePreset,
214
237
  "showSearch": this.$props.showSearch,
238
+ "showClear": this.$props.showClear,
239
+ "searchPlaceholder": this.$props.searchPlaceholder,
215
240
  "transformData": this.$props.transformData,
216
241
  "footer": showLoadMore && !isLastBucket && h("div", {
217
242
  "attrs": {
@@ -256,22 +281,22 @@ var SingleDropdownList = {
256
281
  }
257
282
  },
258
283
  updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
259
- var defaultQueryOptions;
260
284
  var query = SingleDropdownList.defaultQuery(value, props);
261
285
 
262
286
  if (this.defaultQuery) {
263
287
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
288
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
264
289
 
265
- if (defaultQueryToBeSet.query) {
266
- query = defaultQueryToBeSet.query;
267
- }
290
+ if (defaultQueryObj) {
291
+ query = defaultQueryObj;
292
+ } // Update calculated default query in store
268
293
 
269
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
270
294
 
271
295
  updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
296
+ var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
297
+ this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
272
298
  }
273
299
 
274
- this.setQueryOptions(this.internalComponent, defaultQueryOptions);
275
300
  this.updateQuery({
276
301
  componentId: this.internalComponent,
277
302
  query: query,
@@ -282,17 +307,15 @@ var SingleDropdownList = {
282
307
  updateQueryHandler: function updateQueryHandler(value, props) {
283
308
  var customQuery = props.customQuery;
284
309
  var query = SingleDropdownList.defaultQuery(value, props);
285
- var customQueryOptions;
286
310
 
287
311
  if (customQuery) {
288
- var _ref = customQuery(value, props) || {};
289
-
290
- query = _ref.query;
291
- customQueryOptions = getOptionsFromQuery(customQuery(value, props));
312
+ var customQueryCalc = customQuery(value, props);
313
+ query = extractQueryFromCustomQuery(customQueryCalc);
292
314
  updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
315
+ var customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
316
+ this.setQueryOptions(props.componentId, customQueryOptions, false);
293
317
  }
294
318
 
295
- this.setQueryOptions(props.componentId, customQueryOptions);
296
319
  this.updateQuery({
297
320
  componentId: props.componentId,
298
321
  query: query,
@@ -326,8 +349,8 @@ var SingleDropdownList = {
326
349
 
327
350
  if (props.defaultQuery) {
328
351
  var value = this.$data.currentValue;
329
- var defaultQueryOptions = getOptionsFromQuery(props.defaultQuery(value, props));
330
- this.setQueryOptions(this.internalComponent, _extends(_extends({}, queryOptions), defaultQueryOptions));
352
+ var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
353
+ this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
331
354
  } else {
332
355
  this.setQueryOptions(this.internalComponent, queryOptions);
333
356
  }
@@ -418,6 +441,10 @@ SingleDropdownList.generateQueryOptions = function (props, after) {
418
441
  }) : getAggsQuery(queryOptions, props);
419
442
  };
420
443
 
444
+ SingleDropdownList.hasInternalComponent = function () {
445
+ return true;
446
+ };
447
+
421
448
  var mapStateToProps = function mapStateToProps(state, props) {
422
449
  return {
423
450
  options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
@@ -426,7 +453,8 @@ var mapStateToProps = function mapStateToProps(state, props) {
426
453
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || '',
427
454
  themePreset: state.config.themePreset,
428
455
  error: state.error[props.componentId],
429
- componentProps: state.props[props.componentId]
456
+ componentProps: state.props[props.componentId],
457
+ enableAppbase: state.config.enableAppbase
430
458
  };
431
459
  };
432
460
 
@@ -438,7 +466,7 @@ var mapDispatchtoProps = {
438
466
  };
439
467
  var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(SingleDropdownList), {
440
468
  componentType: componentTypes.singleDropdownList,
441
- internalComponent: true
469
+ internalComponent: SingleDropdownList.hasInternalComponent()
442
470
  });
443
471
 
444
472
  SingleDropdownList.install = function (Vue) {