@appbaseio/reactivesearch-vue 1.16.0-alpha.5 → 1.16.0-alpha.50
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 +11245 -9254
- 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/Button-10e5cf51.js +68 -0
- package/dist/cjs/{DownShift-b09da079.js → CancelSvg-82021d23.js} +60 -16
- package/dist/cjs/Card-4b915733.js +30 -0
- package/dist/cjs/{ComponentWrapper-5a0a8849.js → ComponentWrapper-7302fe1a.js} +40 -21
- package/dist/cjs/{Container-f84e72fc.js → Container-8a08d663.js} +3 -11
- package/dist/cjs/DataSearch-deda2e96.js +2171 -0
- package/dist/cjs/DataSearch.js +18 -2151
- package/dist/cjs/{DropDown-c66be1a8.js → DropDown-16a2a728.js} +80 -95
- package/dist/cjs/DynamicRangeSlider.js +107 -43
- package/dist/cjs/Flex-699639d2.js +52 -0
- package/dist/cjs/FormControlList-73497794.js +47 -0
- package/dist/cjs/Input-64087a69.js +79 -0
- package/dist/cjs/ListItem-933c27e4.js +46 -0
- package/dist/cjs/MultiDropdownList.js +102 -68
- package/dist/cjs/MultiList.js +80 -50
- package/dist/cjs/MultiRange.js +21 -16
- package/dist/cjs/{Pagination-91df3b77.js → Pagination-e0654529.js} +4 -3
- package/dist/cjs/RangeInput.js +29 -45
- package/dist/cjs/RangeSlider.js +32 -30
- package/dist/cjs/ReactiveBase.js +55 -34
- package/dist/cjs/ReactiveComponent.js +75 -62
- package/dist/cjs/ReactiveGoogleMap.js +326 -235
- package/dist/cjs/ReactiveList.js +188 -241
- package/dist/cjs/ResultCard.js +8 -6
- package/dist/cjs/ResultList.js +8 -6
- package/dist/cjs/SelectedFilters.js +27 -12
- package/dist/cjs/SingleDropdownList.js +88 -60
- package/dist/cjs/SingleList.js +53 -35
- package/dist/cjs/SingleRange.js +18 -13
- package/dist/cjs/StateProvider.js +11 -7
- package/dist/cjs/{Title-e9beb554.js → Title-39765ee6.js} +3 -11
- package/dist/cjs/ToggleButton.js +35 -16
- package/dist/cjs/{_rollupPluginBabelHelpers-280a574c.js → _rollupPluginBabelHelpers-4abdbfff.js} +11 -1
- package/dist/cjs/{index-e0583d76.js → index-d44a0a21.js} +87 -13
- package/dist/cjs/index.js +30 -25
- package/dist/cjs/initReactivesearch.js +177 -103
- package/dist/cjs/install-d0645b5f.js +1244 -0
- package/dist/cjs/install.js +41 -44
- package/dist/cjs/ssr-c333c82c.js +39 -0
- package/dist/cjs/{utils-d1ea9f95.js → utils-23afb20b.js} +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
- package/dist/es/Button-8b211174.js +59 -0
- package/dist/es/{DownShift-d8f2500f.js → CancelSvg-4d9e0857.js} +56 -17
- package/dist/es/Card-04b3c33e.js +23 -0
- package/dist/es/{ComponentWrapper-d0b21b95.js → ComponentWrapper-bbb717bc.js} +40 -21
- package/dist/es/Container-4383c6f0.js +10 -0
- package/dist/es/DataSearch-7a8a9368.js +2158 -0
- package/dist/es/DataSearch.js +17 -2150
- package/dist/es/{DropDown-5dbd69c2.js → DropDown-7639f223.js} +79 -94
- package/dist/es/DynamicRangeSlider.js +107 -43
- package/dist/es/Flex-aac91505.js +47 -0
- package/dist/es/FormControlList-fe389a2e.js +40 -0
- package/dist/es/Input-d1bb4868.js +71 -0
- package/dist/es/ListItem-bdb6d53d.js +39 -0
- package/dist/es/MultiDropdownList.js +102 -68
- package/dist/es/MultiList.js +80 -50
- package/dist/es/MultiRange.js +21 -16
- package/dist/es/{Pagination-800af44f.js → Pagination-3c50d4ba.js} +4 -3
- package/dist/es/RangeInput.js +29 -45
- package/dist/es/RangeSlider.js +32 -30
- package/dist/es/ReactiveBase.js +55 -34
- package/dist/es/ReactiveComponent.js +75 -62
- package/dist/es/ReactiveGoogleMap.js +326 -235
- package/dist/es/ReactiveList.js +188 -241
- package/dist/es/ResultCard.js +8 -6
- package/dist/es/ResultList.js +8 -6
- package/dist/es/SelectedFilters.js +27 -12
- package/dist/es/SingleDropdownList.js +88 -60
- package/dist/es/SingleList.js +53 -35
- package/dist/es/SingleRange.js +18 -13
- package/dist/es/StateProvider.js +11 -7
- package/dist/es/Title-579f8d6c.js +10 -0
- package/dist/es/ToggleButton.js +35 -16
- package/dist/es/{_rollupPluginBabelHelpers-c9fbe19f.js → _rollupPluginBabelHelpers-ecf6c03c.js} +11 -1
- package/dist/es/{index-1fe91a0a.js → index-5daa8276.js} +84 -14
- package/dist/es/index.js +26 -22
- package/dist/es/initReactivesearch.js +178 -104
- package/dist/es/install-183f5d19.js +1237 -0
- package/dist/es/install.js +39 -46
- package/dist/es/ssr-e3196de1.js +33 -0
- package/dist/es/{utils-ce3d86fd.js → utils-3a32e13f.js} +2 -2
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
- package/package.json +6 -4
- package/dist/cjs/Button-78d8bc26.js +0 -146
- package/dist/cjs/Card-b4af314f.js +0 -58
- package/dist/cjs/Flex-737c55be.js +0 -160
- package/dist/cjs/FormControlList-08dfb28e.js +0 -105
- package/dist/cjs/Input-643d02a7.js +0 -178
- package/dist/cjs/ListItem-0c58c5d2.js +0 -84
- package/dist/cjs/ssr-b7a729f9.js +0 -47
- package/dist/es/Button-6c71c66e.js +0 -137
- package/dist/es/Card-ecf70ba1.js +0 -51
- package/dist/es/Container-f5efec9e.js +0 -18
- package/dist/es/Flex-40a74d8a.js +0 -155
- package/dist/es/FormControlList-b96aebef.js +0 -98
- package/dist/es/Input-dfd9dd40.js +0 -170
- package/dist/es/ListItem-da73bc7d.js +0 -77
- package/dist/es/Title-22c2f3bf.js +0 -18
- package/dist/es/ssr-2f57791d.js +0 -41
package/dist/es/RangeSlider.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { a as _extends } from './_rollupPluginBabelHelpers-
|
|
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 '@appbaseio/vue-emotion';
|
|
6
|
-
import { t as types } from './vueTypes-
|
|
6
|
+
import { t as types } from './vueTypes-9326e0be.js';
|
|
7
7
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
8
8
|
import 'redux';
|
|
9
|
-
import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-
|
|
10
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
11
|
-
import { T as Title } from './Title-
|
|
12
|
-
import { C as Container } from './Container-
|
|
9
|
+
import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-5daa8276.js';
|
|
10
|
+
import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
|
|
11
|
+
import { T as Title } from './Title-579f8d6c.js';
|
|
12
|
+
import { C as Container } from './Container-4383c6f0.js';
|
|
13
13
|
import NoSSR from 'vue-no-ssr';
|
|
14
|
-
import { g as getComponents, S as Slider } from './ssr-
|
|
14
|
+
import { g as getComponents, S as Slider } from './ssr-e3196de1.js';
|
|
15
15
|
|
|
16
16
|
var updateQuery = Actions.updateQuery,
|
|
17
17
|
setQueryOptions = Actions.setQueryOptions,
|
|
@@ -57,7 +57,8 @@ var RangeSlider = {
|
|
|
57
57
|
title: types.title,
|
|
58
58
|
URLParams: VueTypes.bool.def(false),
|
|
59
59
|
sliderOptions: VueTypes.object.def({}),
|
|
60
|
-
nestedField: types.string
|
|
60
|
+
nestedField: types.string,
|
|
61
|
+
index: VueTypes.string
|
|
61
62
|
},
|
|
62
63
|
methods: {
|
|
63
64
|
handleSliderChange: function handleSliderChange(values) {
|
|
@@ -72,32 +73,28 @@ var RangeSlider = {
|
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
|
-
handleSlider: function handleSlider(
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
clearTimeout(this.handleSliderChange._tId);
|
|
79
|
-
this.handleSliderChange._tId = setTimeout(function () {
|
|
80
|
-
_this.handleSliderChange(values);
|
|
81
|
-
}, 100);
|
|
76
|
+
handleSlider: function handleSlider() {
|
|
77
|
+
var sliderValues = this.$refs.slider.getValue();
|
|
78
|
+
this.handleSliderChange(sliderValues);
|
|
82
79
|
},
|
|
83
80
|
handleChange: function handleChange(currentValue, props) {
|
|
84
|
-
var
|
|
81
|
+
var _this = this;
|
|
85
82
|
|
|
86
83
|
if (props === void 0) {
|
|
87
84
|
props = this.$props;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
var performUpdate = function performUpdate() {
|
|
91
|
-
|
|
88
|
+
_this.currentValue = currentValue;
|
|
92
89
|
|
|
93
|
-
|
|
90
|
+
_this.updateQueryHandler([currentValue[0], currentValue[1]], props);
|
|
94
91
|
|
|
95
|
-
|
|
92
|
+
_this.$emit('valueChange', {
|
|
96
93
|
start: currentValue[0],
|
|
97
94
|
end: currentValue[1]
|
|
98
95
|
});
|
|
99
96
|
|
|
100
|
-
|
|
97
|
+
_this.$emit('value-change', {
|
|
101
98
|
start: currentValue[0],
|
|
102
99
|
end: currentValue[1]
|
|
103
100
|
});
|
|
@@ -111,14 +108,14 @@ var RangeSlider = {
|
|
|
111
108
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
112
109
|
var customQuery = props.customQuery;
|
|
113
110
|
var query = RangeSlider.defaultQuery(value, props);
|
|
114
|
-
var customQueryOptions;
|
|
115
111
|
|
|
116
112
|
if (customQuery) {
|
|
117
113
|
var _ref = customQuery(value, props) || {};
|
|
118
114
|
|
|
119
115
|
query = _ref.query;
|
|
120
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
116
|
+
var customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
121
117
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
118
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
122
119
|
}
|
|
123
120
|
|
|
124
121
|
var showFilter = props.showFilter,
|
|
@@ -129,7 +126,6 @@ var RangeSlider = {
|
|
|
129
126
|
currentEnd = value[1]; // check if the slider is at its initial position
|
|
130
127
|
|
|
131
128
|
var isInitialValue = currentStart === start && currentEnd === end;
|
|
132
|
-
this.setQueryOptions(props.componentId, customQueryOptions);
|
|
133
129
|
this.updateQuery({
|
|
134
130
|
componentId: props.componentId,
|
|
135
131
|
query: query,
|
|
@@ -165,6 +161,10 @@ var RangeSlider = {
|
|
|
165
161
|
created: function created() {
|
|
166
162
|
if (!this.$props.range) {
|
|
167
163
|
console.error('%crange is not defined. Read more about this at https://opensource.appbase.io/reactive-manual/vue/range-components/rangeslider.html#props', 'font-size: 12.5px;');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (!this.enableAppbase && this.$props.index) {
|
|
167
|
+
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
168
168
|
} // Set custom query in store
|
|
169
169
|
|
|
170
170
|
|
|
@@ -204,12 +204,13 @@ var RangeSlider = {
|
|
|
204
204
|
"max": this.$props.range.end,
|
|
205
205
|
"dotSize": 20,
|
|
206
206
|
"height": 4,
|
|
207
|
-
"enable-cross": false
|
|
207
|
+
"enable-cross": false,
|
|
208
|
+
"tooltip": "always"
|
|
209
|
+
},
|
|
210
|
+
"on": {
|
|
211
|
+
"drag-end": this.handleSlider
|
|
208
212
|
},
|
|
209
|
-
"props": _extends({}, this.$props.sliderOptions)
|
|
210
|
-
"on": _extends({}, {
|
|
211
|
-
input: this.handleSlider
|
|
212
|
-
})
|
|
213
|
+
"props": _extends({}, this.$props.sliderOptions)
|
|
213
214
|
}), this.$props.rangeLabels && h("div", {
|
|
214
215
|
"class": "label-container"
|
|
215
216
|
}, [h("label", {
|
|
@@ -251,7 +252,7 @@ RangeSlider.defaultQuery = function (values, props) {
|
|
|
251
252
|
|
|
252
253
|
RangeSlider.parseValue = function (value, props) {
|
|
253
254
|
if (value) {
|
|
254
|
-
return [value.start, value.end];
|
|
255
|
+
return Array.isArray(value) ? value : [value.start, value.end];
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
if (props.range) {
|
|
@@ -266,7 +267,8 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
266
267
|
options: state.aggregations[props.componentId] ? state.aggregations[props.componentId][props.dataField] && state.aggregations[props.componentId][props.dataField].buckets // eslint-disable-line
|
|
267
268
|
: [],
|
|
268
269
|
selectedValue: state.selectedValues[props.componentId] ? state.selectedValues[props.componentId].value : null,
|
|
269
|
-
componentProps: state.props[props.componentId]
|
|
270
|
+
componentProps: state.props[props.componentId],
|
|
271
|
+
enableAppbase: state.config.enableAppbase
|
|
270
272
|
};
|
|
271
273
|
};
|
|
272
274
|
|
package/dist/es/ReactiveBase.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import configureStore, { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-
|
|
2
|
+
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
|
|
3
3
|
import VueTypes from 'vue-types';
|
|
4
4
|
import '@appbaseio/reactivecore/lib/utils/constants';
|
|
5
|
+
import { isEqual as isEqual$1 } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
5
6
|
import styled from '@appbaseio/vue-emotion';
|
|
6
|
-
import { t as types } from './vueTypes-
|
|
7
|
+
import { t as types } from './vueTypes-9326e0be.js';
|
|
7
8
|
import 'redux';
|
|
8
|
-
import { c as connect, e as composeThemeObject } from './index-
|
|
9
|
+
import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-5daa8276.js';
|
|
9
10
|
import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
|
|
10
|
-
import { isEqual as isEqual$1 } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
11
11
|
import { updateAnalyticsConfig } from '@appbaseio/reactivecore/lib/actions/analytics';
|
|
12
12
|
import Appbase from 'appbase-js';
|
|
13
13
|
import 'url-search-params-polyfill';
|
|
@@ -41,15 +41,7 @@ var Provider = {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
var data = _taggedTemplateLiteralLoose(["\n\tfont-family: ", ";\n\tfont-size: ", ";\n\tcolor: ", ";\n\twidth: 100%;\n\n\tinput,\n\tbutton,\n\ttextarea,\n\tselect {\n\t\tfont-family: ", ";\n\t}\n\n\t*,\n\t*:before,\n\t*:after {\n\t\tbox-sizing: border-box;\n\t}\n"]);
|
|
46
|
-
|
|
47
|
-
_templateObject = function _templateObject() {
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
44
|
+
var _templateObject;
|
|
53
45
|
var Base = {
|
|
54
46
|
functional: true,
|
|
55
47
|
render: function render(h, _ref) {
|
|
@@ -61,7 +53,7 @@ var Base = {
|
|
|
61
53
|
return h(T, _mergeJSXProps([{}, props]), [children]);
|
|
62
54
|
}
|
|
63
55
|
};
|
|
64
|
-
var Base$1 = styled(Base)(_templateObject(), function (_ref2) {
|
|
56
|
+
var Base$1 = styled(Base)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tfont-family: ", ";\n\tfont-size: ", ";\n\tcolor: ", ";\n\twidth: 100%;\n\n\tinput,\n\tbutton,\n\ttextarea,\n\tselect {\n\t\tfont-family: ", ";\n\t}\n\n\t*,\n\t*:before,\n\t*:after {\n\t\tbox-sizing: border-box;\n\t}\n"])), function (_ref2) {
|
|
65
57
|
var theme = _ref2.theme;
|
|
66
58
|
return theme.typography.fontFamily;
|
|
67
59
|
}, function (_ref3) {
|
|
@@ -85,7 +77,7 @@ var URLParamsProvider = {
|
|
|
85
77
|
headers: types.headers,
|
|
86
78
|
getSearchParams: types.func,
|
|
87
79
|
setSearchParams: types.func,
|
|
88
|
-
as:
|
|
80
|
+
as: VueTypes.string.def('div')
|
|
89
81
|
},
|
|
90
82
|
mounted: function mounted() {
|
|
91
83
|
var _this = this;
|
|
@@ -233,7 +225,9 @@ var URLParamsProvider = {
|
|
|
233
225
|
return value.map(function (item) {
|
|
234
226
|
return _this3.getValue(item);
|
|
235
227
|
});
|
|
236
|
-
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (value && typeof value === 'object') {
|
|
237
231
|
// TODO: support for NestedList
|
|
238
232
|
if (value.location) return value;
|
|
239
233
|
if (value.category) return value;
|
|
@@ -358,11 +352,11 @@ var ReactiveBase = {
|
|
|
358
352
|
}
|
|
359
353
|
},
|
|
360
354
|
props: {
|
|
361
|
-
app: types.
|
|
355
|
+
app: types.string,
|
|
362
356
|
analytics: VueTypes.bool,
|
|
363
357
|
analyticsConfig: types.analyticsConfig,
|
|
364
358
|
appbaseConfig: types.appbaseConfig,
|
|
365
|
-
enableAppbase:
|
|
359
|
+
enableAppbase: VueTypes.bool.def(false),
|
|
366
360
|
credentials: types.string,
|
|
367
361
|
headers: types.headers,
|
|
368
362
|
queryParams: types.string,
|
|
@@ -371,13 +365,15 @@ var ReactiveBase = {
|
|
|
371
365
|
type: types.string,
|
|
372
366
|
url: types.string,
|
|
373
367
|
mapKey: types.string,
|
|
368
|
+
initialQueriesSyncTime: types.number,
|
|
374
369
|
className: types.string,
|
|
375
370
|
initialState: VueTypes.object.def({}),
|
|
376
371
|
transformRequest: types.func,
|
|
377
372
|
transformResponse: types.func,
|
|
378
373
|
as: VueTypes.string.def('div'),
|
|
379
374
|
getSearchParams: types.func,
|
|
380
|
-
setSearchParams: types.func
|
|
375
|
+
setSearchParams: types.func,
|
|
376
|
+
mongodb: types.mongodb
|
|
381
377
|
},
|
|
382
378
|
provide: function provide() {
|
|
383
379
|
return {
|
|
@@ -417,6 +413,27 @@ var ReactiveBase = {
|
|
|
417
413
|
this.store.dispatch(updateAnalyticsConfig(newVal));
|
|
418
414
|
}
|
|
419
415
|
}
|
|
416
|
+
},
|
|
417
|
+
mongodb: function mongodb() {
|
|
418
|
+
this.updateState(this.$props);
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
computed: {
|
|
422
|
+
getHeaders: function getHeaders() {
|
|
423
|
+
var _this$$props = this.$props,
|
|
424
|
+
enableAppbase = _this$$props.enableAppbase,
|
|
425
|
+
headers = _this$$props.headers,
|
|
426
|
+
appbaseConfig = _this$$props.appbaseConfig,
|
|
427
|
+
mongodb = _this$$props.mongodb;
|
|
428
|
+
|
|
429
|
+
var _ref = appbaseConfig || {},
|
|
430
|
+
enableTelemetry = _ref.enableTelemetry;
|
|
431
|
+
|
|
432
|
+
return _extends({}, enableAppbase && !mongodb && _extends({
|
|
433
|
+
'X-Search-Client': X_SEARCH_CLIENT
|
|
434
|
+
}, enableTelemetry === false && {
|
|
435
|
+
'X-Enable-Telemetry': false
|
|
436
|
+
}), headers);
|
|
420
437
|
}
|
|
421
438
|
},
|
|
422
439
|
methods: {
|
|
@@ -427,10 +444,10 @@ var ReactiveBase = {
|
|
|
427
444
|
setStore: function setStore(props) {
|
|
428
445
|
var credentials = props.url && props.url.trim() !== '' && !props.credentials ? null : props.credentials;
|
|
429
446
|
|
|
430
|
-
var appbaseConfig = _extends(
|
|
447
|
+
var appbaseConfig = _extends({}, props.analyticsConfig, props.appbaseConfig);
|
|
431
448
|
|
|
432
449
|
var config = {
|
|
433
|
-
url: props.url && props.url.trim() !== '' ? props.url : '
|
|
450
|
+
url: props.url && props.url.trim() !== '' ? props.url : '',
|
|
434
451
|
app: props.app,
|
|
435
452
|
credentials: credentials,
|
|
436
453
|
type: props.type ? props.type : '*',
|
|
@@ -438,7 +455,8 @@ var ReactiveBase = {
|
|
|
438
455
|
transformResponse: props.transformResponse,
|
|
439
456
|
enableAppbase: props.enableAppbase,
|
|
440
457
|
analytics: props.appbaseConfig ? props.appbaseConfig.recordAnalytics : props.analytics,
|
|
441
|
-
analyticsConfig: appbaseConfig
|
|
458
|
+
analyticsConfig: appbaseConfig,
|
|
459
|
+
mongodb: props.mongodb
|
|
442
460
|
};
|
|
443
461
|
var queryParams = '';
|
|
444
462
|
|
|
@@ -450,9 +468,10 @@ var ReactiveBase = {
|
|
|
450
468
|
|
|
451
469
|
var params = new URLSearchParams(queryParams);
|
|
452
470
|
var selectedValues = {};
|
|
471
|
+
var urlValues = {};
|
|
453
472
|
Array.from(params.keys()).forEach(function (key) {
|
|
454
473
|
try {
|
|
455
|
-
var _extends2;
|
|
474
|
+
var _extends2, _extends3;
|
|
456
475
|
|
|
457
476
|
var parsedParams = JSON.parse(params.get(key));
|
|
458
477
|
var selectedValue = {};
|
|
@@ -464,13 +483,13 @@ var ReactiveBase = {
|
|
|
464
483
|
}
|
|
465
484
|
|
|
466
485
|
if (parsedParams.category) selectedValue.category = parsedParams.category;
|
|
467
|
-
|
|
486
|
+
selectedValue.reference = 'URL';
|
|
487
|
+
selectedValues = _extends({}, selectedValues, (_extends2 = {}, _extends2[key] = selectedValue, _extends2));
|
|
488
|
+
urlValues = _extends({}, urlValues, (_extends3 = {}, _extends3[key] = selectedValue.value, _extends3));
|
|
468
489
|
} catch (e) {// Do not add to selectedValues if JSON parsing fails.
|
|
469
490
|
}
|
|
470
491
|
});
|
|
471
|
-
var
|
|
472
|
-
headers = _props$headers === void 0 ? {} : _props$headers,
|
|
473
|
-
themePreset = props.themePreset;
|
|
492
|
+
var themePreset = props.themePreset;
|
|
474
493
|
var appbaseRef = Appbase(config);
|
|
475
494
|
|
|
476
495
|
if (this.$props.transformRequest) {
|
|
@@ -482,13 +501,16 @@ var ReactiveBase = {
|
|
|
482
501
|
}
|
|
483
502
|
|
|
484
503
|
var initialState = _extends({
|
|
485
|
-
config: _extends(
|
|
504
|
+
config: _extends({}, config, {
|
|
505
|
+
initialQueriesSyncTime: props.initialQueriesSyncTime,
|
|
506
|
+
initialTimestamp: new Date().getTime(),
|
|
486
507
|
mapKey: props.mapKey,
|
|
487
508
|
themePreset: themePreset
|
|
488
509
|
}),
|
|
489
510
|
appbaseRef: appbaseRef,
|
|
490
511
|
selectedValues: selectedValues,
|
|
491
|
-
|
|
512
|
+
urlValues: urlValues,
|
|
513
|
+
headers: this.getHeaders
|
|
492
514
|
}, this.$props.initialState);
|
|
493
515
|
|
|
494
516
|
this.store = configureStore(initialState);
|
|
@@ -497,10 +519,9 @@ var ReactiveBase = {
|
|
|
497
519
|
render: function render() {
|
|
498
520
|
var h = arguments[0];
|
|
499
521
|
var children = this.$slots["default"];
|
|
500
|
-
var _this$$
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
className = _this$$props.className;
|
|
522
|
+
var _this$$props2 = this.$props,
|
|
523
|
+
style = _this$$props2.style,
|
|
524
|
+
className = _this$$props2.className;
|
|
504
525
|
return h(Provider, {
|
|
505
526
|
"attrs": {
|
|
506
527
|
"store": this.store
|
|
@@ -508,7 +529,7 @@ var ReactiveBase = {
|
|
|
508
529
|
}, [h(URLParamsProvider$1, {
|
|
509
530
|
"attrs": {
|
|
510
531
|
"as": this.$props.as,
|
|
511
|
-
"headers":
|
|
532
|
+
"headers": this.getHeaders,
|
|
512
533
|
"className": className,
|
|
513
534
|
"getSearchParams": this.getSearchParams,
|
|
514
535
|
"setSearchParams": this.setSearchParams
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-
|
|
2
|
+
import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ecf6c03c.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-
|
|
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-
|
|
9
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
8
|
+
import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, c as connect } from './index-5daa8276.js';
|
|
9
|
+
import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.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
|
-
|
|
19
|
-
|
|
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
|
|
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,
|
|
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.
|
|
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.
|
|
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 (
|
|
61
|
-
|
|
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
|
-
|
|
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(
|
|
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 (
|
|
83
|
-
var options =
|
|
84
|
-
obj = _objectWithoutPropertiesLoose(
|
|
87
|
+
this.setQuery = function (_ref) {
|
|
88
|
+
var options = _ref.options,
|
|
89
|
+
obj = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
85
90
|
|
|
86
|
-
|
|
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
|
-
|
|
92
|
-
|
|
97
|
+
var customQueryCalc = _extends({}, options, {
|
|
98
|
+
query: queryToBeSet
|
|
99
|
+
});
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
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(
|
|
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,
|
|
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
|
|
119
|
-
|
|
120
|
-
|
|
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(
|
|
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:
|
|
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,
|
|
175
|
-
this.$defaultQuery = newVal();
|
|
176
|
-
|
|
177
|
-
var
|
|
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(
|
|
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,
|
|
197
|
+
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
|
|
187
198
|
this.updateQuery({
|
|
188
199
|
componentId: this.internalComponent,
|
|
189
|
-
query: query
|
|
200
|
+
query: query
|
|
190
201
|
});
|
|
191
202
|
}
|
|
192
203
|
},
|
|
193
204
|
customQuery: function customQuery(newVal, oldVal) {
|
|
194
|
-
if (newVal && !isQueryIdentical(newVal, oldVal,
|
|
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
|
|
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(
|
|
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,
|
|
216
|
+
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
|
|
208
217
|
this.updateQuery({
|
|
209
218
|
componentId: componentId,
|
|
210
|
-
query: query
|
|
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(
|
|
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
|
-
|
|
317
|
+
enableAppbase: state.config.enableAppbase
|
|
305
318
|
};
|
|
306
319
|
};
|
|
307
320
|
|