@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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +16030 -13113
- 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-446f819e.js +68 -0
- package/dist/cjs/{DownShift-966a58cb.js → CancelSvg-9f258f4f.js} +60 -16
- package/dist/cjs/Card-642547a8.js +30 -0
- package/dist/cjs/{ComponentWrapper-603848ed.js → ComponentWrapper-ad3dad02.js} +40 -21
- package/dist/cjs/{Container-6cdd3864.js → Container-daf30918.js} +3 -11
- package/dist/cjs/DataSearch-86914b10.js +2322 -0
- package/dist/cjs/DataSearch.js +18 -2151
- package/dist/cjs/{DropDown-f6224ac8.js → DropDown-5513ea77.js} +80 -95
- package/dist/cjs/DynamicRangeSlider.js +107 -43
- package/dist/cjs/Flex-aa517a13.js +52 -0
- package/dist/cjs/FormControlList-c195a592.js +47 -0
- package/dist/cjs/Input-e6603a7e.js +79 -0
- package/dist/cjs/ListItem-8c9e0d68.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-af399262.js → Pagination-fe5452fc.js} +14 -8
- package/dist/cjs/RangeInput.js +29 -45
- package/dist/cjs/RangeSlider.js +32 -30
- package/dist/cjs/ReactiveBase.js +87 -56
- package/dist/cjs/ReactiveComponent.js +75 -62
- package/dist/cjs/ReactiveGoogleMap.js +262 -191
- package/dist/cjs/ReactiveList.js +189 -241
- package/dist/cjs/ResultCard.js +8 -6
- package/dist/cjs/ResultList.js +8 -6
- package/dist/cjs/SelectedFilters.js +66 -34
- package/dist/cjs/SingleDropdownList.js +88 -60
- package/dist/cjs/SingleList.js +53 -35
- package/dist/cjs/SingleRange.js +19 -14
- package/dist/cjs/StateProvider.js +39 -10
- package/dist/cjs/{Title-65d39104.js → Title-1de7d0f4.js} +3 -11
- package/dist/cjs/ToggleButton.js +36 -16
- package/dist/cjs/{_rollupPluginBabelHelpers-4abdbfff.js → _rollupPluginBabelHelpers-c705cbe6.js} +2 -4
- package/dist/cjs/{index-baca18c4.js → index-6a167fe0.js} +99 -13
- package/dist/cjs/index.js +31 -25
- package/dist/cjs/initReactivesearch.js +178 -104
- package/dist/cjs/install-004c6aa4.js +1408 -0
- package/dist/cjs/install.js +42 -44
- package/dist/cjs/ssr-3027b848.js +39 -0
- package/dist/cjs/{utils-ea846a20.js → utils-d6a52588.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-d8bc15ea.js +59 -0
- package/dist/es/{DownShift-92347b5e.js → CancelSvg-4cfae5fd.js} +56 -17
- package/dist/es/Card-450683f1.js +23 -0
- package/dist/es/{ComponentWrapper-c4c91949.js → ComponentWrapper-424e86fd.js} +40 -21
- package/dist/es/Container-ba826e96.js +10 -0
- package/dist/es/DataSearch-e71a1014.js +2307 -0
- package/dist/es/DataSearch.js +17 -2150
- package/dist/es/{DropDown-3d4291f1.js → DropDown-7d9a15c1.js} +79 -94
- package/dist/es/DynamicRangeSlider.js +107 -43
- package/dist/es/Flex-1f0795c3.js +47 -0
- package/dist/es/FormControlList-c22d64f6.js +40 -0
- package/dist/es/Input-7a2a9fac.js +71 -0
- package/dist/es/ListItem-cad14c5e.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-c2a00175.js → Pagination-3f350098.js} +14 -8
- package/dist/es/RangeInput.js +29 -45
- package/dist/es/RangeSlider.js +32 -30
- package/dist/es/ReactiveBase.js +87 -56
- package/dist/es/ReactiveComponent.js +75 -62
- package/dist/es/ReactiveGoogleMap.js +262 -191
- package/dist/es/ReactiveList.js +189 -241
- package/dist/es/ResultCard.js +8 -6
- package/dist/es/ResultList.js +8 -6
- package/dist/es/SelectedFilters.js +66 -34
- package/dist/es/SingleDropdownList.js +88 -60
- package/dist/es/SingleList.js +53 -35
- package/dist/es/SingleRange.js +19 -14
- package/dist/es/StateProvider.js +39 -10
- package/dist/es/Title-3342664a.js +10 -0
- package/dist/es/ToggleButton.js +36 -16
- package/dist/es/{_rollupPluginBabelHelpers-ecf6c03c.js → _rollupPluginBabelHelpers-76660dab.js} +2 -4
- package/dist/es/{index-185b6266.js → index-7788a843.js} +95 -14
- package/dist/es/index.js +27 -22
- package/dist/es/initReactivesearch.js +179 -105
- package/dist/es/install-b7b604cc.js +1401 -0
- package/dist/es/install.js +40 -46
- package/dist/es/ssr-b2c0b401.js +33 -0
- package/dist/es/{utils-57cc8789.js → utils-9e68acee.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-d48d4365.js +0 -146
- package/dist/cjs/Card-9748fbb2.js +0 -58
- package/dist/cjs/Flex-befd65fc.js +0 -160
- package/dist/cjs/FormControlList-f3857d4b.js +0 -105
- package/dist/cjs/Input-95cb19f8.js +0 -178
- package/dist/cjs/ListItem-84d185cf.js +0 -84
- package/dist/cjs/ssr-3ca8a14f.js +0 -47
- package/dist/es/Button-27cc8574.js +0 -137
- package/dist/es/Card-1f93780d.js +0 -51
- package/dist/es/Container-88c805ef.js +0 -18
- package/dist/es/Flex-16d1103a.js +0 -155
- package/dist/es/FormControlList-96d44e7b.js +0 -98
- package/dist/es/Input-1159c4b5.js +0 -170
- package/dist/es/ListItem-d22510c9.js +0 -77
- package/dist/es/Title-f0217338.js +0 -18
- package/dist/es/ssr-a710392b.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-76660dab.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-7788a843.js';
|
|
10
|
+
import { C as ComponentWrapper } from './ComponentWrapper-424e86fd.js';
|
|
11
|
+
import { T as Title } from './Title-3342664a.js';
|
|
12
|
+
import { C as Container } from './Container-ba826e96.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-b2c0b401.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-76660dab.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-7788a843.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;
|
|
@@ -100,7 +92,7 @@ var URLParamsProvider = {
|
|
|
100
92
|
Object.keys(_this.currentSelectedState).filter(function (item) {
|
|
101
93
|
return !activeComponents.includes(item);
|
|
102
94
|
}).forEach(function (component) {
|
|
103
|
-
_this.setValue(component, null);
|
|
95
|
+
_this.setValue(component, null, undefined, undefined, undefined, undefined, undefined, undefined, 'URL');
|
|
104
96
|
}); // update active components in selectedValues
|
|
105
97
|
|
|
106
98
|
Array.from(_this.params.entries()).forEach(function (item) {
|
|
@@ -115,7 +107,7 @@ var URLParamsProvider = {
|
|
|
115
107
|
showFilter = _ref.showFilter,
|
|
116
108
|
URLParams = _ref.URLParams;
|
|
117
109
|
|
|
118
|
-
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams);
|
|
110
|
+
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
|
|
119
111
|
} catch (e) {
|
|
120
112
|
// Do not set value if JSON parsing fails.
|
|
121
113
|
console.error(e);
|
|
@@ -133,39 +125,45 @@ var URLParamsProvider = {
|
|
|
133
125
|
selectedValues: function selectedValues(newVal, oldVal) {
|
|
134
126
|
var _this2 = this;
|
|
135
127
|
|
|
136
|
-
this.currentSelectedState = newVal;
|
|
137
|
-
|
|
138
128
|
if (!isEqual(newVal, oldVal)) {
|
|
139
129
|
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
140
130
|
this.params = new URLSearchParams(this.searchString);
|
|
141
131
|
var currentComponents = Object.keys(newVal);
|
|
142
132
|
var urlComponents = Array.from(this.params.keys());
|
|
133
|
+
var shouldPushHistory = false;
|
|
143
134
|
currentComponents.filter(function (component) {
|
|
144
135
|
return newVal[component].URLParams;
|
|
145
136
|
}).forEach(function (component) {
|
|
146
|
-
// prevents empty history pollution on initial load
|
|
147
|
-
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
148
|
-
var selectedValues = newVal[component];
|
|
137
|
+
var selectedValues = newVal[component]; // prevents empty history pollution on initial load
|
|
149
138
|
|
|
139
|
+
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
150
140
|
if (selectedValues.URLParams) {
|
|
151
141
|
if (selectedValues.category) {
|
|
152
|
-
_this2.setURL(component, _this2.getValue({
|
|
142
|
+
var shouldUpdateHistory = _this2.setURL(component, _this2.getValue({
|
|
153
143
|
category: selectedValues.category,
|
|
154
144
|
value: selectedValues.value
|
|
155
145
|
}));
|
|
146
|
+
|
|
147
|
+
if (shouldUpdateHistory) {
|
|
148
|
+
shouldPushHistory = true;
|
|
149
|
+
}
|
|
156
150
|
} else {
|
|
157
|
-
_this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
151
|
+
var _shouldUpdateHistory = _this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
152
|
+
|
|
153
|
+
if (_shouldUpdateHistory) {
|
|
154
|
+
shouldPushHistory = true;
|
|
155
|
+
}
|
|
158
156
|
}
|
|
159
157
|
} else {
|
|
160
158
|
_this2.params["delete"](component);
|
|
161
159
|
|
|
162
|
-
|
|
160
|
+
shouldPushHistory = true;
|
|
163
161
|
}
|
|
164
162
|
} else if (!_this2.hasValidValue(newVal[component]) && urlComponents.includes(component)) {
|
|
165
163
|
// doesn't have a valid value, but the url has a (stale) valid value set
|
|
166
164
|
_this2.params["delete"](component);
|
|
167
165
|
|
|
168
|
-
|
|
166
|
+
shouldPushHistory = true;
|
|
169
167
|
}
|
|
170
168
|
}); // remove unmounted components
|
|
171
169
|
|
|
@@ -174,15 +172,20 @@ var URLParamsProvider = {
|
|
|
174
172
|
}).forEach(function (component) {
|
|
175
173
|
_this2.params["delete"](component);
|
|
176
174
|
|
|
177
|
-
|
|
175
|
+
shouldPushHistory = true;
|
|
178
176
|
});
|
|
179
177
|
|
|
180
178
|
if (!currentComponents.length) {
|
|
181
179
|
Array.from(this.params.keys()).forEach(function (item) {
|
|
182
180
|
if (_this2.searchComponents && _this2.searchComponents.includes(item)) {
|
|
183
181
|
_this2.params["delete"](item);
|
|
182
|
+
|
|
183
|
+
shouldPushHistory = true;
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (shouldPushHistory) {
|
|
186
189
|
this.pushToHistory();
|
|
187
190
|
}
|
|
188
191
|
}
|
|
@@ -233,7 +236,9 @@ var URLParamsProvider = {
|
|
|
233
236
|
return value.map(function (item) {
|
|
234
237
|
return _this3.getValue(item);
|
|
235
238
|
});
|
|
236
|
-
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (value && typeof value === 'object') {
|
|
237
242
|
// TODO: support for NestedList
|
|
238
243
|
if (value.location) return value;
|
|
239
244
|
if (value.category) return value;
|
|
@@ -243,20 +248,19 @@ var URLParamsProvider = {
|
|
|
243
248
|
return value;
|
|
244
249
|
},
|
|
245
250
|
setURL: function setURL(component, value) {
|
|
246
|
-
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
247
|
-
this.params = new URLSearchParams(this.searchString);
|
|
248
|
-
|
|
249
251
|
if (!value || typeof value === 'string' && value.trim() === '' || Array.isArray(value) && value.length === 0) {
|
|
250
252
|
this.params["delete"](component);
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
var data = JSON.stringify(this.getValue(value));
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
254
255
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
var data = JSON.stringify(value);
|
|
257
|
+
|
|
258
|
+
if (data !== this.params.get(component)) {
|
|
259
|
+
this.params.set(component, data);
|
|
260
|
+
return true;
|
|
259
261
|
}
|
|
262
|
+
|
|
263
|
+
return false;
|
|
260
264
|
},
|
|
261
265
|
pushToHistory: function pushToHistory() {
|
|
262
266
|
var paramsSting = this.params.toString() ? "?" + this.params.toString() : '';
|
|
@@ -358,11 +362,11 @@ var ReactiveBase = {
|
|
|
358
362
|
}
|
|
359
363
|
},
|
|
360
364
|
props: {
|
|
361
|
-
app: types.
|
|
365
|
+
app: types.string,
|
|
362
366
|
analytics: VueTypes.bool,
|
|
363
367
|
analyticsConfig: types.analyticsConfig,
|
|
364
368
|
appbaseConfig: types.appbaseConfig,
|
|
365
|
-
enableAppbase:
|
|
369
|
+
enableAppbase: VueTypes.bool.def(false),
|
|
366
370
|
credentials: types.string,
|
|
367
371
|
headers: types.headers,
|
|
368
372
|
queryParams: types.string,
|
|
@@ -371,13 +375,15 @@ var ReactiveBase = {
|
|
|
371
375
|
type: types.string,
|
|
372
376
|
url: types.string,
|
|
373
377
|
mapKey: types.string,
|
|
378
|
+
initialQueriesSyncTime: types.number,
|
|
374
379
|
className: types.string,
|
|
375
380
|
initialState: VueTypes.object.def({}),
|
|
376
381
|
transformRequest: types.func,
|
|
377
382
|
transformResponse: types.func,
|
|
378
383
|
as: VueTypes.string.def('div'),
|
|
379
384
|
getSearchParams: types.func,
|
|
380
|
-
setSearchParams: types.func
|
|
385
|
+
setSearchParams: types.func,
|
|
386
|
+
mongodb: types.mongodb
|
|
381
387
|
},
|
|
382
388
|
provide: function provide() {
|
|
383
389
|
return {
|
|
@@ -417,6 +423,27 @@ var ReactiveBase = {
|
|
|
417
423
|
this.store.dispatch(updateAnalyticsConfig(newVal));
|
|
418
424
|
}
|
|
419
425
|
}
|
|
426
|
+
},
|
|
427
|
+
mongodb: function mongodb() {
|
|
428
|
+
this.updateState(this.$props);
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
computed: {
|
|
432
|
+
getHeaders: function getHeaders() {
|
|
433
|
+
var _this$$props = this.$props,
|
|
434
|
+
enableAppbase = _this$$props.enableAppbase,
|
|
435
|
+
headers = _this$$props.headers,
|
|
436
|
+
appbaseConfig = _this$$props.appbaseConfig,
|
|
437
|
+
mongodb = _this$$props.mongodb;
|
|
438
|
+
|
|
439
|
+
var _ref = appbaseConfig || {},
|
|
440
|
+
enableTelemetry = _ref.enableTelemetry;
|
|
441
|
+
|
|
442
|
+
return _extends({}, enableAppbase && !mongodb && _extends({
|
|
443
|
+
'X-Search-Client': X_SEARCH_CLIENT
|
|
444
|
+
}, enableTelemetry === false && {
|
|
445
|
+
'X-Enable-Telemetry': false
|
|
446
|
+
}), headers);
|
|
420
447
|
}
|
|
421
448
|
},
|
|
422
449
|
methods: {
|
|
@@ -427,10 +454,10 @@ var ReactiveBase = {
|
|
|
427
454
|
setStore: function setStore(props) {
|
|
428
455
|
var credentials = props.url && props.url.trim() !== '' && !props.credentials ? null : props.credentials;
|
|
429
456
|
|
|
430
|
-
var appbaseConfig = _extends(
|
|
457
|
+
var appbaseConfig = _extends({}, props.analyticsConfig, props.appbaseConfig);
|
|
431
458
|
|
|
432
459
|
var config = {
|
|
433
|
-
url: props.url && props.url.trim() !== '' ? props.url : '
|
|
460
|
+
url: props.url && props.url.trim() !== '' ? props.url : '',
|
|
434
461
|
app: props.app,
|
|
435
462
|
credentials: credentials,
|
|
436
463
|
type: props.type ? props.type : '*',
|
|
@@ -438,7 +465,8 @@ var ReactiveBase = {
|
|
|
438
465
|
transformResponse: props.transformResponse,
|
|
439
466
|
enableAppbase: props.enableAppbase,
|
|
440
467
|
analytics: props.appbaseConfig ? props.appbaseConfig.recordAnalytics : props.analytics,
|
|
441
|
-
analyticsConfig: appbaseConfig
|
|
468
|
+
analyticsConfig: appbaseConfig,
|
|
469
|
+
mongodb: props.mongodb
|
|
442
470
|
};
|
|
443
471
|
var queryParams = '';
|
|
444
472
|
|
|
@@ -450,9 +478,10 @@ var ReactiveBase = {
|
|
|
450
478
|
|
|
451
479
|
var params = new URLSearchParams(queryParams);
|
|
452
480
|
var selectedValues = {};
|
|
481
|
+
var urlValues = {};
|
|
453
482
|
Array.from(params.keys()).forEach(function (key) {
|
|
454
483
|
try {
|
|
455
|
-
var _extends2;
|
|
484
|
+
var _extends2, _extends3;
|
|
456
485
|
|
|
457
486
|
var parsedParams = JSON.parse(params.get(key));
|
|
458
487
|
var selectedValue = {};
|
|
@@ -464,13 +493,13 @@ var ReactiveBase = {
|
|
|
464
493
|
}
|
|
465
494
|
|
|
466
495
|
if (parsedParams.category) selectedValue.category = parsedParams.category;
|
|
467
|
-
|
|
496
|
+
selectedValue.reference = 'URL';
|
|
497
|
+
selectedValues = _extends({}, selectedValues, (_extends2 = {}, _extends2[key] = selectedValue, _extends2));
|
|
498
|
+
urlValues = _extends({}, urlValues, (_extends3 = {}, _extends3[key] = selectedValue.value, _extends3));
|
|
468
499
|
} catch (e) {// Do not add to selectedValues if JSON parsing fails.
|
|
469
500
|
}
|
|
470
501
|
});
|
|
471
|
-
var
|
|
472
|
-
headers = _props$headers === void 0 ? {} : _props$headers,
|
|
473
|
-
themePreset = props.themePreset;
|
|
502
|
+
var themePreset = props.themePreset;
|
|
474
503
|
var appbaseRef = Appbase(config);
|
|
475
504
|
|
|
476
505
|
if (this.$props.transformRequest) {
|
|
@@ -482,13 +511,16 @@ var ReactiveBase = {
|
|
|
482
511
|
}
|
|
483
512
|
|
|
484
513
|
var initialState = _extends({
|
|
485
|
-
config: _extends(
|
|
514
|
+
config: _extends({}, config, {
|
|
515
|
+
initialQueriesSyncTime: props.initialQueriesSyncTime,
|
|
516
|
+
initialTimestamp: new Date().getTime(),
|
|
486
517
|
mapKey: props.mapKey,
|
|
487
518
|
themePreset: themePreset
|
|
488
519
|
}),
|
|
489
520
|
appbaseRef: appbaseRef,
|
|
490
521
|
selectedValues: selectedValues,
|
|
491
|
-
|
|
522
|
+
urlValues: urlValues,
|
|
523
|
+
headers: this.getHeaders
|
|
492
524
|
}, this.$props.initialState);
|
|
493
525
|
|
|
494
526
|
this.store = configureStore(initialState);
|
|
@@ -497,10 +529,9 @@ var ReactiveBase = {
|
|
|
497
529
|
render: function render() {
|
|
498
530
|
var h = arguments[0];
|
|
499
531
|
var children = this.$slots["default"];
|
|
500
|
-
var _this$$
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
className = _this$$props.className;
|
|
532
|
+
var _this$$props2 = this.$props,
|
|
533
|
+
style = _this$$props2.style,
|
|
534
|
+
className = _this$$props2.className;
|
|
504
535
|
return h(Provider, {
|
|
505
536
|
"attrs": {
|
|
506
537
|
"store": this.store
|
|
@@ -508,7 +539,7 @@ var ReactiveBase = {
|
|
|
508
539
|
}, [h(URLParamsProvider$1, {
|
|
509
540
|
"attrs": {
|
|
510
541
|
"as": this.$props.as,
|
|
511
|
-
"headers":
|
|
542
|
+
"headers": this.getHeaders,
|
|
512
543
|
"className": className,
|
|
513
544
|
"getSearchParams": this.getSearchParams,
|
|
514
545
|
"setSearchParams": this.setSearchParams
|