@appbaseio/reactivesearch-vue 1.33.9 → 1.33.11
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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +8315 -8046
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/DataSearch.js +1310 -17
- package/dist/cjs/ReactiveComponent.js +316 -45
- package/dist/cjs/{ReactiveComponent-f51e4519.js → ReactiveComponentPrivate-e84b6f9e.js} +19 -308
- package/dist/cjs/ReactiveComponentPrivate.js +55 -0
- package/dist/cjs/ReactiveGoogleMap.js +132 -102
- package/dist/cjs/Tags-0559dec7.js +883 -0
- package/dist/cjs/index.js +8 -5
- package/dist/cjs/install.js +5 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/DataSearch.js +1310 -15
- package/dist/es/ReactiveComponent.js +316 -44
- package/dist/es/{ReactiveComponent-9ae8b96c.js → ReactiveComponentPrivate-4473d9d7.js} +5 -294
- package/dist/es/ReactiveComponentPrivate.js +47 -0
- package/dist/es/ReactiveGoogleMap.js +132 -102
- package/dist/es/Tags-cdeb05d9.js +869 -0
- package/dist/es/index.js +4 -2
- package/dist/es/install.js +5 -3
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/DataSearch-57d44eca.js +0 -2184
- package/dist/es/DataSearch-8a195d63.js +0 -2168
|
@@ -2,53 +2,324 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require('
|
|
8
|
-
|
|
9
|
-
require('@appbaseio/reactivecore/lib/utils/
|
|
10
|
-
require('
|
|
11
|
-
require('
|
|
12
|
-
require('
|
|
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-7cfc2f98.js');
|
|
17
13
|
require('@appbaseio/reactivecore/lib/utils/transform');
|
|
18
14
|
require('redux');
|
|
19
|
-
require('./index-30126fd0.js');
|
|
20
|
-
require('./ComponentWrapper-f89a5972.js');
|
|
21
|
-
require('./PreferencesConsumer-5d67b486.js');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var ReactiveComponent =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
15
|
+
var index = require('./index-30126fd0.js');
|
|
16
|
+
var ComponentWrapper = require('./ComponentWrapper-f89a5972.js');
|
|
17
|
+
var PreferencesConsumer = require('./PreferencesConsumer-5d67b486.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 =
|
|
325
|
+
exports.default = RcConnected;
|