@appbaseio/reactivesearch-vue 1.34.0-alpha.1 → 1.34.0

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 (71) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1175 -1297
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +6 -11
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{ComponentWrapper-9318cece.js → ComponentWrapper-94c50228.js} +16 -7
  6. package/dist/cjs/DataSearch.js +1310 -17
  7. package/dist/cjs/{DropDown-8984b544.js → DropDown-7a52c661.js} +2 -2
  8. package/dist/cjs/DynamicRangeSlider.js +12 -8
  9. package/dist/cjs/MultiDropdownList.js +11 -8
  10. package/dist/cjs/MultiList.js +10 -8
  11. package/dist/cjs/MultiRange.js +7 -4
  12. package/dist/cjs/{Pagination-07f4dbad.js → Pagination-e56a5b79.js} +1 -1
  13. package/dist/cjs/{PreferencesConsumer-5d67b486.js → PreferencesConsumer-5e6e84a2.js} +1 -1
  14. package/dist/cjs/RangeInput.js +4 -4
  15. package/dist/cjs/RangeSlider.js +7 -4
  16. package/dist/cjs/ReactiveBase.js +10 -6
  17. package/dist/cjs/ReactiveComponent.js +316 -45
  18. package/dist/cjs/{ReactiveComponent-0a354ed7.js → ReactiveComponentPrivate-244c6055.js} +32 -318
  19. package/dist/cjs/ReactiveComponentPrivate.js +55 -0
  20. package/dist/cjs/ReactiveGoogleMap.js +139 -108
  21. package/dist/cjs/ReactiveList.js +17 -6
  22. package/dist/cjs/ResultCard.js +1 -1
  23. package/dist/cjs/ResultList.js +1 -1
  24. package/dist/cjs/SelectedFilters.js +2 -2
  25. package/dist/cjs/SingleDropdownList.js +10 -8
  26. package/dist/cjs/SingleList.js +10 -8
  27. package/dist/cjs/SingleRange.js +7 -4
  28. package/dist/cjs/StateProvider.js +1 -1
  29. package/dist/cjs/Tags-4ec43831.js +883 -0
  30. package/dist/cjs/ToggleButton.js +6 -4
  31. package/dist/cjs/{index-30126fd0.js → index-de136c17.js} +2 -0
  32. package/dist/cjs/index.js +14 -11
  33. package/dist/cjs/initReactivesearch.js +0 -3
  34. package/dist/cjs/install.js +11 -9
  35. package/dist/cjs/version.js +1 -1
  36. package/dist/cjs/{vueTypes-7cfc2f98.js → vueTypes-b7007f5f.js} +2 -1
  37. package/dist/es/{ComponentWrapper-240450cc.js → ComponentWrapper-edaeaceb.js} +16 -7
  38. package/dist/es/DataSearch.js +1310 -15
  39. package/dist/es/{DropDown-28ddce07.js → DropDown-2c0dd714.js} +2 -2
  40. package/dist/es/DynamicRangeSlider.js +12 -8
  41. package/dist/es/MultiDropdownList.js +11 -8
  42. package/dist/es/MultiList.js +10 -8
  43. package/dist/es/MultiRange.js +7 -4
  44. package/dist/es/{Pagination-28e56c5c.js → Pagination-edeb7dbe.js} +1 -1
  45. package/dist/es/{PreferencesConsumer-bc097ebb.js → PreferencesConsumer-86a676c8.js} +1 -1
  46. package/dist/es/RangeInput.js +4 -4
  47. package/dist/es/RangeSlider.js +7 -4
  48. package/dist/es/ReactiveBase.js +10 -6
  49. package/dist/es/ReactiveComponent.js +316 -44
  50. package/dist/es/{ReactiveComponent-9352370c.js → ReactiveComponentPrivate-6f16e1b7.js} +19 -305
  51. package/dist/es/ReactiveComponentPrivate.js +47 -0
  52. package/dist/es/ReactiveGoogleMap.js +139 -108
  53. package/dist/es/ReactiveList.js +17 -6
  54. package/dist/es/ResultCard.js +1 -1
  55. package/dist/es/ResultList.js +1 -1
  56. package/dist/es/SelectedFilters.js +2 -2
  57. package/dist/es/SingleDropdownList.js +10 -8
  58. package/dist/es/SingleList.js +10 -8
  59. package/dist/es/SingleRange.js +7 -4
  60. package/dist/es/StateProvider.js +1 -1
  61. package/dist/es/Tags-1c2d6c4d.js +869 -0
  62. package/dist/es/ToggleButton.js +6 -4
  63. package/dist/es/{index-0444a498.js → index-5509c0bc.js} +2 -0
  64. package/dist/es/index.js +10 -8
  65. package/dist/es/initReactivesearch.js +0 -3
  66. package/dist/es/install.js +11 -9
  67. package/dist/es/version.js +1 -1
  68. package/dist/es/{vueTypes-8986b709.js → vueTypes-66ebc93e.js} +2 -1
  69. package/package.json +87 -87
  70. package/dist/cjs/DataSearch-8ea2651a.js +0 -2175
  71. package/dist/es/DataSearch-dcaa106b.js +0 -2159
@@ -2,53 +2,324 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('@appbaseio/reactivecore');
6
- require('@appbaseio/reactivecore/lib/utils/constants');
7
- require('./_rollupPluginBabelHelpers-f8b843f8.js');
8
- require('vue-types');
9
- require('@appbaseio/reactivecore/lib/utils/helper');
10
- require('emotion');
11
- require('@appbaseio/vue-emotion');
12
- require('polished');
13
- require('./Button-841fd06d.js');
14
- require('./vueTypes-7cfc2f98.js');
15
- require('./Pagination-07f4dbad.js');
16
- require('./ReactiveList.js');
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var configureStore = require('@appbaseio/reactivecore');
8
+ var configureStore__default = _interopDefault(configureStore);
9
+ var constants = require('@appbaseio/reactivecore/lib/utils/constants');
10
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-f8b843f8.js');
11
+ var VueTypes = _interopDefault(require('vue-types'));
12
+ var vueTypes = require('./vueTypes-b7007f5f.js');
17
13
  require('@appbaseio/reactivecore/lib/utils/transform');
18
14
  require('redux');
19
- require('./index-30126fd0.js');
20
- require('./ComponentWrapper-9318cece.js');
21
- require('./PreferencesConsumer-5d67b486.js');
22
- require('@vue/babel-helper-vue-jsx-merge-props');
23
- require('./Title-16042ea0.js');
24
- require('./ListItem-5088bd6a.js');
25
- require('./Card-240f283d.js');
26
- require('./Flex-ddd7cb6b.js');
27
- require('hotkeys-js');
28
- require('./DataSearch-8ea2651a.js');
29
- require('./CancelSvg-220a7cc3.js');
30
- require('./Input-ead4cd84.js');
31
- require('compute-scroll-into-view');
32
- require('./Container-e699ea95.js');
33
- require('vue-highlight-words');
34
- var ReactiveComponent = require('./ReactiveComponent-0a354ed7.js');
35
- require('@appbaseio/reactivecore/lib/utils/suggestions');
36
- require('./FormControlList-bbb5cd24.js');
37
- require('./utils-83fd01e9.js');
38
- require('./SingleList.js');
39
- require('./MultiList.js');
40
- require('./DropDown-8984b544.js');
41
- require('./SingleDropdownList.js');
42
- require('./MultiDropdownList.js');
43
- require('./ToggleButton.js');
44
- require('vue-no-ssr');
45
- require('./ssr-f2fc1bf6.js');
46
- require('./DynamicRangeSlider.js');
47
- require('./SingleRange.js');
48
- require('./MultiRange.js');
49
- require('./RangeSlider.js');
50
- require('./RangeInput.js');
15
+ var index = require('./index-de136c17.js');
16
+ var ComponentWrapper = require('./ComponentWrapper-94c50228.js');
17
+ var PreferencesConsumer = require('./PreferencesConsumer-5e6e84a2.js');
18
+
19
+ var _excluded = ["options"];
20
+ var updateQuery = configureStore.Actions.updateQuery,
21
+ setQueryOptions = configureStore.Actions.setQueryOptions,
22
+ setCustomQuery = configureStore.Actions.setCustomQuery,
23
+ setDefaultQuery = configureStore.Actions.setDefaultQuery;
24
+ var parseHits = configureStore.helper.parseHits,
25
+ isEqual = configureStore.helper.isEqual,
26
+ getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
27
+ getResultStats = configureStore.helper.getResultStats,
28
+ extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
29
+ getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
30
+ var ReactiveComponent = {
31
+ name: 'ReactiveComponent',
32
+ props: {
33
+ componentId: vueTypes.types.stringRequired,
34
+ aggregationField: vueTypes.types.string,
35
+ aggregationSize: VueTypes.number,
36
+ size: VueTypes.number,
37
+ defaultQuery: vueTypes.types.func,
38
+ customQuery: vueTypes.types.func,
39
+ filterLabel: vueTypes.types.string,
40
+ react: vueTypes.types.react,
41
+ showFilter: VueTypes.bool.def(true),
42
+ URLParams: VueTypes.bool.def(false),
43
+ distinctField: vueTypes.types.string,
44
+ distinctFieldConfig: vueTypes.types.props,
45
+ index: VueTypes.string,
46
+ endpoint: vueTypes.types.endpointConfig
47
+ },
48
+ created: function created() {
49
+ var _this = this;
50
+ var props = this.$props;
51
+ this.internalComponent = null;
52
+ this.$defaultQuery = null;
53
+ // Set custom query in store
54
+ index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
55
+ var customQuery = props.customQuery,
56
+ componentId = props.componentId,
57
+ filterLabel = props.filterLabel,
58
+ showFilter = props.showFilter,
59
+ URLParams = props.URLParams,
60
+ distinctField = props.distinctField,
61
+ distinctFieldConfig = props.distinctFieldConfig,
62
+ index$1 = props.index;
63
+ if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
64
+ console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
65
+ }
66
+ if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
67
+ console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
68
+ }
69
+ if (!this.enableAppbase && index$1) {
70
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
71
+ }
72
+ if (customQuery) {
73
+ var calcCustomQuery = customQuery(this.selectedValue, props);
74
+ var query = extractQueryFromCustomQuery(calcCustomQuery);
75
+ var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
76
+ if (customQueryOptions) {
77
+ this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, customQueryOptions, this.getAggsQuery()), false);
78
+ } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
79
+ this.updateQuery({
80
+ componentId: componentId,
81
+ query: query,
82
+ value: this.selectedValue || null,
83
+ label: filterLabel,
84
+ showFilter: showFilter,
85
+ URLParams: URLParams
86
+ });
87
+ }
88
+ this.setQuery = function (_ref) {
89
+ var options = _ref.options,
90
+ obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
91
+ var queryToBeSet = obj.query;
51
92
 
93
+ // when enableAppbase is true, Backend throws error because of repeated query in request body
94
+ if (queryToBeSet && queryToBeSet.query) {
95
+ queryToBeSet = queryToBeSet.query;
96
+ }
97
+ var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options, {
98
+ query: queryToBeSet
99
+ });
100
+ var rsAPIQuery = customQueryCalc;
101
+ // handle stored queries
102
+ if (queryToBeSet && queryToBeSet.id) {
103
+ rsAPIQuery = queryToBeSet;
104
+ }
105
+ // Update customQuery field for RS API
106
+ _this.setCustomQuery(props.componentId, rsAPIQuery);
107
+ if (options) {
108
+ _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, _this.getAggsQuery(), options), false);
109
+ }
110
+ _this.updateQuery(_rollupPluginBabelHelpers._extends({}, obj, {
111
+ query: customQueryCalc.query,
112
+ componentId: props.componentId,
113
+ label: props.filterLabel,
114
+ showFilter: props.showFilter,
115
+ URLParams: props.URLParams
116
+ }));
117
+ };
118
+ if (props.defaultQuery) {
119
+ this.internalComponent = props.componentId + "__internal";
120
+ }
121
+ if (this.internalComponent && this.$props.defaultQuery) {
122
+ index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
123
+ this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
124
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
125
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
126
+ if (queryOptions) {
127
+ this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
128
+ } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
129
+ this.updateQuery({
130
+ componentId: this.internalComponent,
131
+ query: _query
132
+ });
133
+ }
134
+ },
135
+ watch: {
136
+ hits: function hits(newVal, oldVal) {
137
+ if (!isEqual(newVal, oldVal)) {
138
+ this.$emit('data', this.getData());
139
+ }
140
+ },
141
+ rawData: function rawData(newVal, oldVal) {
142
+ if (!isEqual(newVal, oldVal)) {
143
+ this.$emit('data', this.getData());
144
+ }
145
+ },
146
+ aggregations: function aggregations(newVal, oldVal) {
147
+ if (!isEqual(newVal, oldVal)) {
148
+ this.$emit('data', this.getData());
149
+ }
150
+ },
151
+ aggregationData: function aggregationData(newVal, oldVal) {
152
+ if (!isEqual(newVal, oldVal)) {
153
+ this.$emit('data', this.getData());
154
+ }
155
+ },
156
+ promotedResults: function promotedResults(newVal, oldVal) {
157
+ if (!isEqual(newVal, oldVal)) {
158
+ this.$emit('data', this.getData());
159
+ }
160
+ },
161
+ hidden: function hidden(newVal, oldVal) {
162
+ if (!isEqual(newVal, oldVal)) {
163
+ this.$emit('data', this.getData());
164
+ }
165
+ },
166
+ total: function total(newVal, oldVal) {
167
+ if (!isEqual(newVal, oldVal)) {
168
+ this.$emit('data', this.getData());
169
+ }
170
+ },
171
+ time: function time(newVal, oldVal) {
172
+ if (!isEqual(newVal, oldVal)) {
173
+ this.$emit('data', this.getData());
174
+ }
175
+ },
176
+ defaultQuery: function defaultQuery(newVal, oldVal) {
177
+ if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
178
+ this.$defaultQuery = newVal(this.selectedValue, this.$props);
179
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
180
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
181
+ if (queryOptions) {
182
+ this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
183
+ } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
184
+ // Update default query for RS API
185
+ index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
186
+ this.updateQuery({
187
+ componentId: this.internalComponent,
188
+ query: query
189
+ });
190
+ }
191
+ },
192
+ customQuery: function customQuery(newVal, oldVal) {
193
+ if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
194
+ var componentId = this.$props.componentId;
195
+ this.$customQuery = newVal(this.selectedValue, this.$props);
196
+ var query = extractQueryFromCustomQuery(this.$customQuery);
197
+ var queryOptions = getOptionsForCustomQuery(this.$customQuery);
198
+ if (queryOptions) {
199
+ this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
200
+ } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
52
201
 
202
+ // Update custom query for RS API
203
+ index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
204
+ this.updateQuery({
205
+ componentId: componentId,
206
+ query: query
207
+ });
208
+ }
209
+ }
210
+ },
211
+ render: function render() {
212
+ var h = arguments[0];
213
+ try {
214
+ var dom = this.$scopedSlots["default"];
215
+ var error = this.error,
216
+ isLoading = this.isLoading,
217
+ selectedValue = this.selectedValue;
218
+ var propsToBePassed = _rollupPluginBabelHelpers._extends({
219
+ error: error,
220
+ loading: isLoading
221
+ }, this.getData(), {
222
+ value: selectedValue,
223
+ setQuery: this.setQuery
224
+ });
225
+ return h("div", [dom(propsToBePassed)]);
226
+ } catch (e) {
227
+ return null;
228
+ }
229
+ },
230
+ methods: {
231
+ getAggsQuery: function getAggsQuery() {
232
+ if (this.aggregationField) {
233
+ return {
234
+ aggs: getCompositeAggsQuery({
235
+ props: this.$props,
236
+ showTopHits: true,
237
+ value: this.selectedValue
238
+ }).aggs
239
+ };
240
+ }
241
+ return {};
242
+ },
243
+ getData: function getData() {
244
+ var hits = this.hits,
245
+ aggregations = this.aggregations,
246
+ aggregationData = this.aggregationData,
247
+ promotedResults = this.promotedResults,
248
+ rawData = this.rawData;
249
+ var filteredResults = parseHits(hits);
250
+ if (promotedResults.length) {
251
+ var ids = promotedResults.map(function (item) {
252
+ return item._id;
253
+ }).filter(Boolean);
254
+ if (ids) {
255
+ filteredResults = filteredResults.filter(function (item) {
256
+ return !ids.includes(item._id);
257
+ });
258
+ }
259
+ filteredResults = [].concat(promotedResults, filteredResults);
260
+ }
261
+ return {
262
+ data: filteredResults,
263
+ aggregationData: aggregationData,
264
+ rawData: rawData,
265
+ aggregations: aggregations,
266
+ promotedData: promotedResults,
267
+ resultStats: this.stats
268
+ };
269
+ }
270
+ },
271
+ computed: {
272
+ stats: function stats() {
273
+ return getResultStats(this);
274
+ }
275
+ }
276
+ };
277
+ ReactiveComponent.hasInternalComponent = function (props) {
278
+ return !!props.defaultQuery;
279
+ };
280
+ var mapStateToProps = function mapStateToProps(state, props) {
281
+ return {
282
+ aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
283
+ aggregationData: state.compositeAggregations[props.componentId] || [],
284
+ hits: state.hits[props.componentId] && state.hits[props.componentId].hits || [],
285
+ rawData: state.rawData[props.componentId],
286
+ error: state.error[props.componentId],
287
+ isLoading: state.isLoading[props.componentId],
288
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
289
+ promotedResults: state.promotedResults[props.componentId] || [],
290
+ time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
291
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
292
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
293
+ componentProps: state.props[props.componentId],
294
+ enableAppbase: state.config.enableAppbase
295
+ };
296
+ };
297
+ var mapDispatchtoProps = {
298
+ setQueryOptions: setQueryOptions,
299
+ updateQuery: updateQuery,
300
+ setCustomQuery: setCustomQuery,
301
+ setDefaultQuery: setDefaultQuery
302
+ };
303
+ var ConnectedComponent = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchtoProps)(ReactiveComponent), {
304
+ componentType: constants.componentTypes.reactiveComponent
305
+ });
306
+ var RcConnected = PreferencesConsumer.PreferencesConsumer({
307
+ name: 'RcConnected',
308
+ render: function render(h) {
309
+ return h(ConnectedComponent, {
310
+ attrs: this.$attrs,
311
+ on: this.$listeners,
312
+ scopedSlots: this.$scopedSlots,
313
+ slots: this.$slots
314
+ });
315
+ }
316
+ });
317
+ RcConnected.name = ReactiveComponent.name;
318
+ RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
319
+ // Add componentType for SSR
320
+ RcConnected.componentType = constants.componentTypes.reactiveComponent;
321
+ RcConnected.install = function (Vue) {
322
+ Vue.component(RcConnected.name, RcConnected);
323
+ };
53
324
 
54
- exports.default = ReactiveComponent.ReactiveComponent;
325
+ exports.default = RcConnected;