@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,13 +1,14 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
+ import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-76660dab.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
- import { t as types } from './vueTypes-98d938a9.js';
5
+ import { t as types } from './vueTypes-9326e0be.js';
6
6
  import '@appbaseio/reactivecore/lib/utils/transform';
7
7
  import 'redux';
8
- import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, c as connect } from './index-185b6266.js';
9
- import { C as ComponentWrapper } from './ComponentWrapper-c4c91949.js';
8
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, c as connect } from './index-7788a843.js';
9
+ import { C as ComponentWrapper } from './ComponentWrapper-424e86fd.js';
10
10
 
11
+ var _excluded = ["options"];
11
12
  var updateQuery = Actions.updateQuery,
12
13
  setQueryOptions = Actions.setQueryOptions,
13
14
  setCustomQuery = Actions.setCustomQuery,
@@ -15,15 +16,16 @@ var updateQuery = Actions.updateQuery,
15
16
  var parseHits = helper.parseHits,
16
17
  isEqual = helper.isEqual,
17
18
  getCompositeAggsQuery = helper.getCompositeAggsQuery,
18
- getOptionsFromQuery = helper.getOptionsFromQuery,
19
- getResultStats = helper.getResultStats;
19
+ getResultStats = helper.getResultStats,
20
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
21
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
20
22
  var ReactiveComponent = {
21
23
  name: 'ReactiveComponent',
22
24
  props: {
23
25
  componentId: types.stringRequired,
24
26
  aggregationField: types.string,
25
27
  aggregationSize: VueTypes.number,
26
- size: VueTypes.number.def(20),
28
+ size: VueTypes.number,
27
29
  defaultQuery: types.func,
28
30
  customQuery: types.func,
29
31
  filterLabel: types.string,
@@ -31,7 +33,8 @@ var ReactiveComponent = {
31
33
  showFilter: VueTypes.bool.def(true),
32
34
  URLParams: VueTypes.bool.def(false),
33
35
  distinctField: types.string,
34
- distinctFieldConfig: types.props
36
+ distinctFieldConfig: types.props,
37
+ index: VueTypes.string
35
38
  },
36
39
  created: function created() {
37
40
  var _this = this;
@@ -40,33 +43,35 @@ var ReactiveComponent = {
40
43
  this.internalComponent = null;
41
44
  this.$defaultQuery = null; // Set custom query in store
42
45
 
43
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
46
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
44
47
  var customQuery = props.customQuery,
45
48
  componentId = props.componentId,
46
49
  filterLabel = props.filterLabel,
47
50
  showFilter = props.showFilter,
48
51
  URLParams = props.URLParams,
49
52
  distinctField = props.distinctField,
50
- distinctFieldConfig = props.distinctFieldConfig;
53
+ distinctFieldConfig = props.distinctFieldConfig,
54
+ index = props.index;
51
55
 
52
- if (this.config.enableAppbase && this.aggregationField && this.aggregationField !== '') {
56
+ if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
53
57
  console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
54
58
  }
55
59
 
56
- if (!this.config.enableAppbase && (distinctField || distinctFieldConfig)) {
60
+ if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
57
61
  console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
58
62
  }
59
63
 
60
- if (customQuery) {
61
- var calcCustomQuery = customQuery(props);
62
-
63
- var _ref = calcCustomQuery || {},
64
- query = _ref.query;
64
+ if (!this.enableAppbase && index) {
65
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
66
+ }
65
67
 
66
- var customQueryOptions = calcCustomQuery ? getOptionsFromQuery(calcCustomQuery) : null;
68
+ if (customQuery) {
69
+ var calcCustomQuery = customQuery(this.selectedValue, props);
70
+ var query = extractQueryFromCustomQuery(calcCustomQuery);
71
+ var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
67
72
 
68
73
  if (customQueryOptions) {
69
- this.setQueryOptions(componentId, _extends(_extends({}, customQueryOptions), this.getAggsQuery()), false);
74
+ this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
70
75
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
71
76
 
72
77
  this.updateQuery({
@@ -79,26 +84,35 @@ var ReactiveComponent = {
79
84
  });
80
85
  }
81
86
 
82
- this.setQuery = function (_ref2) {
83
- var options = _ref2.options,
84
- obj = _objectWithoutPropertiesLoose(_ref2, ["options"]);
87
+ this.setQuery = function (_ref) {
88
+ var options = _ref.options,
89
+ obj = _objectWithoutPropertiesLoose(_ref, _excluded);
85
90
 
86
- if (options) {
87
- _this.setQueryOptions(props.componentId, _extends(_extends({}, options), _this.getAggsQuery()), false);
88
- } // Update customQuery field for RS API
91
+ var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
89
92
 
93
+ if (queryToBeSet && queryToBeSet.query) {
94
+ queryToBeSet = queryToBeSet.query;
95
+ }
90
96
 
91
- if (obj && obj.query || options) {
92
- var customQueryCalc = _extends({}, options);
97
+ var customQueryCalc = _extends({}, options, {
98
+ query: queryToBeSet
99
+ });
93
100
 
94
- if (obj && obj.query) {
95
- customQueryCalc.query = obj.query;
96
- }
101
+ var rsAPIQuery = customQueryCalc; // handle stored queries
102
+
103
+ if (queryToBeSet && queryToBeSet.id) {
104
+ rsAPIQuery = queryToBeSet;
105
+ } // Update customQuery field for RS API
97
106
 
98
- _this.setCustomQuery(props.componentId, customQueryCalc);
107
+
108
+ _this.setCustomQuery(props.componentId, rsAPIQuery);
109
+
110
+ if (options) {
111
+ _this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
99
112
  }
100
113
 
101
- _this.updateQuery(_extends(_extends({}, obj), {}, {
114
+ _this.updateQuery(_extends({}, obj, {
115
+ query: customQueryCalc.query,
102
116
  componentId: props.componentId,
103
117
  label: props.filterLabel,
104
118
  showFilter: props.showFilter,
@@ -109,23 +123,22 @@ var ReactiveComponent = {
109
123
  if (props.defaultQuery) {
110
124
  this.internalComponent = props.componentId + "__internal";
111
125
  }
112
- },
113
- beforeMount: function beforeMount() {
126
+
114
127
  if (this.internalComponent && this.$props.defaultQuery) {
115
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
116
- this.$defaultQuery = this.$props.defaultQuery();
128
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
129
+ this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
117
130
 
118
- var _ref3 = this.$defaultQuery || {},
119
- query = _ref3.query,
120
- queryOptions = _objectWithoutPropertiesLoose(_ref3, ["query"]);
131
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
132
+
133
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
121
134
 
122
135
  if (queryOptions) {
123
- this.setQueryOptions(this.internalComponent, _extends(_extends({}, queryOptions), this.getAggsQuery()), false);
136
+ this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
124
137
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
125
138
 
126
139
  this.updateQuery({
127
140
  componentId: this.internalComponent,
128
- query: query || null
141
+ query: _query
129
142
  });
130
143
  }
131
144
  },
@@ -171,43 +184,39 @@ var ReactiveComponent = {
171
184
  }
172
185
  },
173
186
  defaultQuery: function defaultQuery(newVal, oldVal) {
174
- if (newVal && !isQueryIdentical(newVal, oldVal, undefined, this.$props)) {
175
- this.$defaultQuery = newVal();
176
-
177
- var _ref4 = this.$defaultQuery || {},
178
- query = _ref4.query,
179
- queryOptions = _objectWithoutPropertiesLoose(_ref4, ["query"]);
187
+ if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
188
+ this.$defaultQuery = newVal(this.selectedValue, this.$props);
189
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
190
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
180
191
 
181
192
  if (queryOptions) {
182
- this.setQueryOptions(this.internalComponent, _extends(_extends({}, queryOptions), this.getAggsQuery()), false);
193
+ this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
183
194
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false); // Update default query for RS API
184
195
 
185
196
 
186
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
197
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
187
198
  this.updateQuery({
188
199
  componentId: this.internalComponent,
189
- query: query || null
200
+ query: query
190
201
  });
191
202
  }
192
203
  },
193
204
  customQuery: function customQuery(newVal, oldVal) {
194
- if (newVal && !isQueryIdentical(newVal, oldVal, undefined, this.$props)) {
205
+ if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
195
206
  var componentId = this.$props.componentId;
196
- this.$customQuery = newVal(this.$props);
197
-
198
- var _ref5 = this.$customQuery || {},
199
- query = _ref5.query,
200
- queryOptions = _objectWithoutPropertiesLoose(_ref5, ["query"]);
207
+ this.$customQuery = newVal(this.selectedValue, this.$props);
208
+ var query = extractQueryFromCustomQuery(this.$customQuery);
209
+ var queryOptions = getOptionsForCustomQuery(this.$customQuery);
201
210
 
202
211
  if (queryOptions) {
203
- this.setQueryOptions(componentId, _extends(_extends({}, queryOptions), this.getAggsQuery()), false);
212
+ this.setQueryOptions(componentId, _extends({}, queryOptions, this.getAggsQuery()), false);
204
213
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false); // Update custom query for RS API
205
214
 
206
215
 
207
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
216
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
208
217
  this.updateQuery({
209
218
  componentId: componentId,
210
- query: query || null
219
+ query: query
211
220
  });
212
221
  }
213
222
  }
@@ -221,10 +230,10 @@ var ReactiveComponent = {
221
230
  isLoading = this.isLoading,
222
231
  selectedValue = this.selectedValue;
223
232
 
224
- var propsToBePassed = _extends(_extends({
233
+ var propsToBePassed = _extends({
225
234
  error: error,
226
235
  loading: isLoading
227
- }, this.getData()), {}, {
236
+ }, this.getData(), {
228
237
  value: selectedValue,
229
238
  setQuery: this.setQuery
230
239
  });
@@ -287,6 +296,10 @@ var ReactiveComponent = {
287
296
  }
288
297
  };
289
298
 
299
+ ReactiveComponent.hasInternalComponent = function (props) {
300
+ return !!props.defaultQuery;
301
+ };
302
+
290
303
  var mapStateToProps = function mapStateToProps(state, props) {
291
304
  return {
292
305
  aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
@@ -301,7 +314,7 @@ var mapStateToProps = function mapStateToProps(state, props) {
301
314
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
302
315
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
303
316
  componentProps: state.props[props.componentId],
304
- config: state.config
317
+ enableAppbase: state.config.enableAppbase
305
318
  };
306
319
  };
307
320