@appbaseio/reactivesearch-vue 1.27.0-gamma.3 → 1.29.0-preview.1
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 +923 -1096
- 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-11307285.js → Button-e0b7c1f6.js} +1 -1
- package/dist/cjs/{DataSearch-0ef14926.js → DataSearch-eec21890.js} +30 -13
- package/dist/cjs/DataSearch.js +1 -1
- package/dist/cjs/DynamicRangeSlider.js +24 -16
- package/dist/cjs/MultiDropdownList.js +34 -25
- package/dist/cjs/MultiList.js +33 -23
- package/dist/cjs/MultiRange.js +2 -3
- package/dist/cjs/RangeSlider.js +2 -3
- package/dist/cjs/ReactiveComponent.js +41 -72
- package/dist/cjs/ReactiveList.js +38 -48
- package/dist/cjs/SelectedFilters.js +6 -4
- package/dist/cjs/SingleDropdownList.js +21 -18
- package/dist/cjs/SingleList.js +19 -16
- package/dist/cjs/SingleRange.js +2 -3
- package/dist/cjs/ToggleButton.js +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/initReactivesearch.js +109 -77
- package/dist/cjs/{install-311df9cc.js → install-b05fef06.js} +111 -64
- package/dist/cjs/install.js +3 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/{Button-91561391.js → Button-33de88e6.js} +1 -1
- package/dist/es/{DataSearch-be45e960.js → DataSearch-42f547cd.js} +30 -13
- package/dist/es/DataSearch.js +1 -1
- package/dist/es/DynamicRangeSlider.js +24 -16
- package/dist/es/MultiDropdownList.js +34 -25
- package/dist/es/MultiList.js +33 -23
- package/dist/es/MultiRange.js +2 -3
- package/dist/es/RangeSlider.js +2 -3
- package/dist/es/ReactiveComponent.js +41 -72
- package/dist/es/ReactiveList.js +38 -48
- package/dist/es/SelectedFilters.js +6 -4
- package/dist/es/SingleDropdownList.js +21 -18
- package/dist/es/SingleList.js +19 -16
- package/dist/es/SingleRange.js +2 -3
- package/dist/es/ToggleButton.js +1 -1
- package/dist/es/index.js +4 -4
- package/dist/es/initReactivesearch.js +111 -79
- package/dist/es/{install-af797de0.js → install-bd448c02.js} +111 -64
- package/dist/es/install.js +3 -3
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
package/dist/cjs/install.js
CHANGED
|
@@ -10,7 +10,7 @@ require('@appbaseio/reactivecore/lib/utils/helper');
|
|
|
10
10
|
require('emotion');
|
|
11
11
|
require('@appbaseio/vue-emotion');
|
|
12
12
|
require('polished');
|
|
13
|
-
require('./Button-
|
|
13
|
+
require('./Button-e0b7c1f6.js');
|
|
14
14
|
require('./vueTypes-57d01f18.js');
|
|
15
15
|
require('./ReactiveList.js');
|
|
16
16
|
require('@appbaseio/reactivecore/lib/utils/transform');
|
|
@@ -27,13 +27,13 @@ require('appbase-js');
|
|
|
27
27
|
require('url-search-params-polyfill');
|
|
28
28
|
require('./ReactiveBase.js');
|
|
29
29
|
require('hotkeys-js');
|
|
30
|
-
require('./DataSearch-
|
|
30
|
+
require('./DataSearch-eec21890.js');
|
|
31
31
|
require('./CancelSvg-4aa35935.js');
|
|
32
32
|
require('./Input-0d7b25ad.js');
|
|
33
33
|
require('compute-scroll-into-view');
|
|
34
34
|
require('./Container-526efa6a.js');
|
|
35
35
|
require('vue-highlight-words');
|
|
36
|
-
var install = require('./install-
|
|
36
|
+
var install = require('./install-b05fef06.js');
|
|
37
37
|
require('@appbaseio/reactivecore/lib/utils/suggestions');
|
|
38
38
|
require('./FormControlList-808dbcef.js');
|
|
39
39
|
require('./utils-1219e1fe.js');
|
package/dist/cjs/version.js
CHANGED
|
@@ -28,7 +28,7 @@ var disabled = function disabled(_ref3) {
|
|
|
28
28
|
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: #ccc;\n\tcursor: not-allowed;\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: ", ";\n\t}\n"])), theme.colors.backgroundColor ? lighten(0.1, theme.colors.backgroundColor) : '#fafafa', theme.colors.backgroundColor ? lighten(0.2, theme.colors.backgroundColor) : '#fafafa');
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
var Button = styled('a')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\tjustify-content: center;\n\talign-items: center;\n\tborder-radius: 3px;\n\tborder: 1px solid transparent;\n\tmin-height: 30px;\n\tword-wrap: break-word;\n\tpadding: 5px 12px;\n\tline-height: 1.2rem;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tcursor: pointer;\n\tuser-select: none;\n\ttransition: all 0.3s ease;\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:focus {\n\t\toutline: 0;\n\t\tborder-color: ", ";\n\t\tbox-shadow: ", ";\n\t}\n\n\t", ";\n\t", ";\n\t", ";\n"])), function (_ref4) {
|
|
31
|
+
var Button = styled('a')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\tjustify-content: center;\n\talign-items: center;\n\tborder-radius: 3px;\n\tborder: 1px solid transparent;\n\tmin-height: 30px;\n\tword-wrap: break-word;\n\tpadding: 5px 12px;\n\tline-height: 1.2rem;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tcursor: pointer;\n\tuser-select: none;\n\ttransition: all 0.3s ease;\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:focus {\n\t\toutline: 0;\n\t\tborder-color: ", ";\n\t\tbox-shadow: ", ";\n\t}\n\n\t", ";\n\t", ";\n\t", ";\n\n\t&.enter-btn {\n\t\tborder-top-left-radius: 0px;\n\t\tborder-bottom-left-radius: 0px;\n\t\theight: 100%;\n\t}\n"])), function (_ref4) {
|
|
32
32
|
var theme = _ref4.theme;
|
|
33
33
|
return theme.colors.backgroundColor || '#eee';
|
|
34
34
|
}, function (_ref5) {
|
|
@@ -909,7 +909,8 @@ var updateQuery = Actions.updateQuery,
|
|
|
909
909
|
var debounce = helper.debounce,
|
|
910
910
|
checkValueChange = helper.checkValueChange,
|
|
911
911
|
getClassName$1 = helper.getClassName,
|
|
912
|
-
|
|
912
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
913
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery,
|
|
913
914
|
isEqual = helper.isEqual,
|
|
914
915
|
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
915
916
|
withClickIds = helper.withClickIds,
|
|
@@ -965,11 +966,15 @@ var DataSearch = {
|
|
|
965
966
|
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
966
967
|
}
|
|
967
968
|
|
|
968
|
-
this.loadPopularSuggestions(this.$props.componentId);
|
|
969
969
|
this.currentValue = this.selectedValue || '';
|
|
970
|
+
var shouldFetchInitialSuggestions = this.$props.enableDefaultSuggestions || this.currentValue;
|
|
970
971
|
|
|
971
|
-
if (
|
|
972
|
-
this.
|
|
972
|
+
if (shouldFetchInitialSuggestions) {
|
|
973
|
+
this.loadPopularSuggestions(this.$props.componentId);
|
|
974
|
+
|
|
975
|
+
if (enableRecentSearches) {
|
|
976
|
+
this.getRecentSearches();
|
|
977
|
+
}
|
|
973
978
|
}
|
|
974
979
|
|
|
975
980
|
this.handleTextChange = debounce(this.handleText, this.$props.debounce); // Set custom and default queries in store
|
|
@@ -1006,7 +1011,7 @@ var DataSearch = {
|
|
|
1006
1011
|
defaultSearchSuggestions: function defaultSearchSuggestions() {
|
|
1007
1012
|
var isPopularSuggestionsEnabled = this.enableQuerySuggestions || this.enablePopularSuggestions;
|
|
1008
1013
|
|
|
1009
|
-
if (this.currentValue) {
|
|
1014
|
+
if (this.currentValue || !this.enableDefaultSuggestions) {
|
|
1010
1015
|
return [];
|
|
1011
1016
|
}
|
|
1012
1017
|
|
|
@@ -1103,7 +1108,8 @@ var DataSearch = {
|
|
|
1103
1108
|
addonBefore: VueTypes.any,
|
|
1104
1109
|
addonAfter: VueTypes.any,
|
|
1105
1110
|
expandSuggestionsContainer: VueTypes.bool.def(true),
|
|
1106
|
-
index: VueTypes.string
|
|
1111
|
+
index: VueTypes.string,
|
|
1112
|
+
enableDefaultSuggestions: VueTypes.bool.def(true)
|
|
1107
1113
|
},
|
|
1108
1114
|
beforeMount: function beforeMount() {
|
|
1109
1115
|
if (this.$props.highlight) {
|
|
@@ -1367,12 +1373,13 @@ var DataSearch = {
|
|
|
1367
1373
|
|
|
1368
1374
|
if (this.defaultQuery) {
|
|
1369
1375
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
1376
|
+
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
1370
1377
|
|
|
1371
|
-
if (
|
|
1372
|
-
query =
|
|
1378
|
+
if (defaultQueryObj) {
|
|
1379
|
+
query = defaultQueryObj;
|
|
1373
1380
|
}
|
|
1374
1381
|
|
|
1375
|
-
defaultQueryOptions =
|
|
1382
|
+
defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
|
|
1376
1383
|
|
|
1377
1384
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
1378
1385
|
}
|
|
@@ -1396,13 +1403,13 @@ var DataSearch = {
|
|
|
1396
1403
|
|
|
1397
1404
|
if (customQuery) {
|
|
1398
1405
|
var customQueryTobeSet = customQuery(value, props);
|
|
1399
|
-
var queryTobeSet = customQueryTobeSet
|
|
1406
|
+
var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
|
|
1400
1407
|
|
|
1401
1408
|
if (queryTobeSet) {
|
|
1402
1409
|
query = queryTobeSet;
|
|
1403
1410
|
}
|
|
1404
1411
|
|
|
1405
|
-
customQueryOptions =
|
|
1412
|
+
customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
|
|
1406
1413
|
updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
|
|
1407
1414
|
this.setQueryOptions(componentId, _extends({}, this.queryOptions, customQueryOptions), false);
|
|
1408
1415
|
}
|
|
@@ -1729,11 +1736,17 @@ var DataSearch = {
|
|
|
1729
1736
|
var _this$$props4 = this.$props,
|
|
1730
1737
|
theme = _this$$props4.theme,
|
|
1731
1738
|
size = _this$$props4.size,
|
|
1732
|
-
expandSuggestionsContainer = _this$$props4.expandSuggestionsContainer
|
|
1739
|
+
expandSuggestionsContainer = _this$$props4.expandSuggestionsContainer,
|
|
1740
|
+
enableDefaultSuggestions = _this$$props4.enableDefaultSuggestions;
|
|
1733
1741
|
var _this$$scopedSlots = this.$scopedSlots,
|
|
1734
1742
|
recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
|
|
1735
1743
|
popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
|
|
1736
1744
|
var hasSuggestions = this.currentValue ? this.suggestionsList.length || this.topSuggestions.length : this.defaultSearchSuggestions.length;
|
|
1745
|
+
|
|
1746
|
+
if (enableDefaultSuggestions === false && !this.currentValue) {
|
|
1747
|
+
hasSuggestions = false;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1737
1750
|
return h(Container, {
|
|
1738
1751
|
"class": this.$props.className
|
|
1739
1752
|
}, [this.$props.title && h(Title, {
|
|
@@ -2091,6 +2104,10 @@ DataSearch.highlightQuery = function (props) {
|
|
|
2091
2104
|
};
|
|
2092
2105
|
};
|
|
2093
2106
|
|
|
2107
|
+
DataSearch.hasInternalComponent = function () {
|
|
2108
|
+
return true;
|
|
2109
|
+
};
|
|
2110
|
+
|
|
2094
2111
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
2095
2112
|
return {
|
|
2096
2113
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
@@ -2128,7 +2145,7 @@ var mapDispatchToProps = {
|
|
|
2128
2145
|
};
|
|
2129
2146
|
var DSConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
|
|
2130
2147
|
componentType: componentTypes.dataSearch,
|
|
2131
|
-
internalComponent:
|
|
2148
|
+
internalComponent: DataSearch.hasInternalComponent()
|
|
2132
2149
|
});
|
|
2133
2150
|
|
|
2134
2151
|
DataSearch.install = function (Vue) {
|
package/dist/es/DataSearch.js
CHANGED
|
@@ -14,7 +14,7 @@ import './ComponentWrapper-0f3431d1.js';
|
|
|
14
14
|
import './Title-3522ff56.js';
|
|
15
15
|
import './Flex-8770345d.js';
|
|
16
16
|
import 'hotkeys-js';
|
|
17
|
-
export { D as default } from './DataSearch-
|
|
17
|
+
export { D as default } from './DataSearch-42f547cd.js';
|
|
18
18
|
import './CancelSvg-c2c03a35.js';
|
|
19
19
|
import './Input-e339e63a.js';
|
|
20
20
|
import 'compute-scroll-into-view';
|
|
@@ -22,9 +22,10 @@ var addComponent = Actions.addComponent,
|
|
|
22
22
|
updateComponentProps = Actions.updateComponentProps;
|
|
23
23
|
var checkValueChange = helper.checkValueChange,
|
|
24
24
|
getClassName = helper.getClassName,
|
|
25
|
-
getOptionsFromQuery = helper.getOptionsFromQuery,
|
|
26
25
|
isEqual = helper.isEqual,
|
|
27
|
-
checkSomePropChange = helper.checkSomePropChange
|
|
26
|
+
checkSomePropChange = helper.checkSomePropChange,
|
|
27
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
28
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
28
29
|
var DynamicRangeSlider = {
|
|
29
30
|
name: 'DynamicRangeSlider',
|
|
30
31
|
components: getComponents(),
|
|
@@ -232,28 +233,31 @@ var DynamicRangeSlider = {
|
|
|
232
233
|
},
|
|
233
234
|
updateQueryHandler: function updateQueryHandler(value) {
|
|
234
235
|
var query = DynamicRangeSlider.defaultQuery(value, this.$props);
|
|
235
|
-
var customQueryOptions;
|
|
236
236
|
|
|
237
237
|
if (this.$props.customQuery) {
|
|
238
|
-
var
|
|
238
|
+
var customQueryTobeSet = this.$props.customQuery(value, this.$props);
|
|
239
|
+
var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
|
|
239
240
|
|
|
240
|
-
|
|
241
|
-
|
|
241
|
+
if (queryTobeSet) {
|
|
242
|
+
query = queryTobeSet;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
var customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
|
|
242
246
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, value);
|
|
247
|
+
this.setQueryOptions(this.$props.componentId, customQueryOptions, false);
|
|
243
248
|
}
|
|
244
249
|
|
|
245
|
-
var
|
|
250
|
+
var _ref2 = this.range || {
|
|
246
251
|
start: value[0],
|
|
247
252
|
end: value[1]
|
|
248
253
|
},
|
|
249
|
-
start =
|
|
250
|
-
end =
|
|
254
|
+
start = _ref2.start,
|
|
255
|
+
end = _ref2.end;
|
|
251
256
|
|
|
252
257
|
var currentStart = value[0],
|
|
253
258
|
currentEnd = value[1]; // check if the slider is at its initial position
|
|
254
259
|
|
|
255
260
|
var isInitialValue = currentStart === start && currentEnd === end;
|
|
256
|
-
this.setQueryOptions(this.$props.componentId, customQueryOptions, false);
|
|
257
261
|
this.updateQuery({
|
|
258
262
|
componentId: this.$props.componentId,
|
|
259
263
|
query: query,
|
|
@@ -300,13 +304,13 @@ var DynamicRangeSlider = {
|
|
|
300
304
|
range: function range(newValue, oldValue) {
|
|
301
305
|
if (isEqual(newValue, oldValue) || !this.currentValue) return;
|
|
302
306
|
|
|
303
|
-
var
|
|
304
|
-
currentStart =
|
|
305
|
-
currentEnd =
|
|
307
|
+
var _ref3 = this.currentValue || [],
|
|
308
|
+
currentStart = _ref3[0],
|
|
309
|
+
currentEnd = _ref3[1];
|
|
306
310
|
|
|
307
|
-
var
|
|
308
|
-
oldStart =
|
|
309
|
-
oldEnd =
|
|
311
|
+
var _ref4 = oldValue || {},
|
|
312
|
+
oldStart = _ref4.start,
|
|
313
|
+
oldEnd = _ref4.end;
|
|
310
314
|
|
|
311
315
|
var newStart = currentStart === oldStart ? newValue.start : currentStart;
|
|
312
316
|
var newEnd = currentEnd === oldEnd ? newValue.end : currentEnd;
|
|
@@ -401,6 +405,10 @@ DynamicRangeSlider.parseValue = function (value) {
|
|
|
401
405
|
return [];
|
|
402
406
|
};
|
|
403
407
|
|
|
408
|
+
DynamicRangeSlider.hasInternalComponent = function () {
|
|
409
|
+
return true;
|
|
410
|
+
};
|
|
411
|
+
|
|
404
412
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
405
413
|
var componentId = state.aggregations[props.componentId];
|
|
406
414
|
var internalRange = state.aggregations[props.componentId + "__range__internal"];
|
|
@@ -5,7 +5,7 @@ import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
|
5
5
|
import 'emotion';
|
|
6
6
|
import '@appbaseio/vue-emotion';
|
|
7
7
|
import 'polished';
|
|
8
|
-
import { l as loadMoreContainer, B as Button } from './Button-
|
|
8
|
+
import { l as loadMoreContainer, B as Button } from './Button-33de88e6.js';
|
|
9
9
|
import { t as types } from './vueTypes-687b2304.js';
|
|
10
10
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
11
11
|
import 'redux';
|
|
@@ -30,8 +30,9 @@ var isEqual = helper.isEqual,
|
|
|
30
30
|
checkValueChange = helper.checkValueChange,
|
|
31
31
|
checkPropChange = helper.checkPropChange,
|
|
32
32
|
getClassName = helper.getClassName,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
34
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
35
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
35
36
|
var MultiDropdownList = {
|
|
36
37
|
name: 'MultiDropdownList',
|
|
37
38
|
data: function data() {
|
|
@@ -69,7 +70,7 @@ var MultiDropdownList = {
|
|
|
69
70
|
selectAllLabel: types.string,
|
|
70
71
|
showCount: VueTypes.bool.def(true),
|
|
71
72
|
showFilter: VueTypes.bool.def(true),
|
|
72
|
-
size: VueTypes.number
|
|
73
|
+
size: VueTypes.number,
|
|
73
74
|
sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
|
|
74
75
|
title: types.title,
|
|
75
76
|
URLParams: VueTypes.bool.def(false),
|
|
@@ -355,22 +356,22 @@ var MultiDropdownList = {
|
|
|
355
356
|
checkValueChange(props.componentId, finalValues, props.beforeValueChange, performUpdate);
|
|
356
357
|
},
|
|
357
358
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
358
|
-
var defaultQueryOptions;
|
|
359
359
|
var query = MultiDropdownList.defaultQuery(value, props);
|
|
360
360
|
|
|
361
361
|
if (this.defaultQuery) {
|
|
362
362
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
363
|
+
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
363
364
|
|
|
364
|
-
if (
|
|
365
|
-
query =
|
|
366
|
-
}
|
|
365
|
+
if (defaultQueryObj) {
|
|
366
|
+
query = defaultQueryObj;
|
|
367
|
+
} // Update calculated default query in store
|
|
367
368
|
|
|
368
|
-
defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
|
|
369
369
|
|
|
370
370
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
371
|
+
var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
|
|
372
|
+
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
371
373
|
}
|
|
372
374
|
|
|
373
|
-
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
374
375
|
this.updateQuery({
|
|
375
376
|
componentId: this.internalComponent,
|
|
376
377
|
query: query,
|
|
@@ -381,17 +382,15 @@ var MultiDropdownList = {
|
|
|
381
382
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
382
383
|
var customQuery = props.customQuery;
|
|
383
384
|
var query = MultiDropdownList.defaultQuery(value, props);
|
|
384
|
-
var customQueryOptions;
|
|
385
385
|
|
|
386
386
|
if (customQuery) {
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
query = _ref.query;
|
|
390
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
387
|
+
var customQueryCalc = customQuery(value, props);
|
|
388
|
+
query = extractQueryFromCustomQuery(customQueryCalc);
|
|
391
389
|
updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
|
|
390
|
+
var customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
|
|
391
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
395
394
|
this.updateQuery({
|
|
396
395
|
componentId: props.componentId,
|
|
397
396
|
query: query,
|
|
@@ -425,7 +424,7 @@ var MultiDropdownList = {
|
|
|
425
424
|
|
|
426
425
|
if (props.defaultQuery) {
|
|
427
426
|
var value = Object.keys(this.$data.currentValue);
|
|
428
|
-
var defaultQueryOptions =
|
|
427
|
+
var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
|
|
429
428
|
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
|
|
430
429
|
} else {
|
|
431
430
|
this.setQueryOptions(this.internalComponent, queryOptions);
|
|
@@ -461,7 +460,13 @@ var MultiDropdownList = {
|
|
|
461
460
|
|
|
462
461
|
MultiDropdownList.defaultQuery = function (value, props) {
|
|
463
462
|
var query = null;
|
|
464
|
-
var
|
|
463
|
+
var queryFormat = props.queryFormat;
|
|
464
|
+
|
|
465
|
+
if (queryFormat === undefined) {
|
|
466
|
+
queryFormat = 'or';
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
var type = queryFormat === 'or' ? 'terms' : 'term';
|
|
465
470
|
|
|
466
471
|
if (!Array.isArray(value) || value.length === 0) {
|
|
467
472
|
return null;
|
|
@@ -482,14 +487,14 @@ MultiDropdownList.defaultQuery = function (value, props) {
|
|
|
482
487
|
} else if (value) {
|
|
483
488
|
var listQuery;
|
|
484
489
|
|
|
485
|
-
if (
|
|
490
|
+
if (queryFormat === 'or') {
|
|
486
491
|
if (props.showMissing) {
|
|
487
|
-
var _type,
|
|
492
|
+
var _type, _ref;
|
|
488
493
|
|
|
489
494
|
var hasMissingTerm = value.includes(props.missingLabel);
|
|
490
|
-
var should = [(
|
|
495
|
+
var should = [(_ref = {}, _ref[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
|
|
491
496
|
return item !== props.missingLabel;
|
|
492
|
-
}), _type),
|
|
497
|
+
}), _type), _ref)];
|
|
493
498
|
|
|
494
499
|
if (hasMissingTerm) {
|
|
495
500
|
should = should.concat({
|
|
@@ -516,9 +521,9 @@ MultiDropdownList.defaultQuery = function (value, props) {
|
|
|
516
521
|
} else {
|
|
517
522
|
// adds a sub-query with must as an array of objects for each term/value
|
|
518
523
|
var queryArray = value.map(function (item) {
|
|
519
|
-
var _type3,
|
|
524
|
+
var _type3, _ref2;
|
|
520
525
|
|
|
521
|
-
return
|
|
526
|
+
return _ref2 = {}, _ref2[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref2;
|
|
522
527
|
});
|
|
523
528
|
listQuery = {
|
|
524
529
|
bool: {
|
|
@@ -553,6 +558,10 @@ MultiDropdownList.generateQueryOptions = function (props, after) {
|
|
|
553
558
|
}) : getAggsQuery(queryOptions, props);
|
|
554
559
|
};
|
|
555
560
|
|
|
561
|
+
MultiDropdownList.hasInternalComponent = function () {
|
|
562
|
+
return true;
|
|
563
|
+
};
|
|
564
|
+
|
|
556
565
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
557
566
|
return {
|
|
558
567
|
options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
|
|
@@ -574,7 +583,7 @@ var mapDispatchtoProps = {
|
|
|
574
583
|
};
|
|
575
584
|
var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(MultiDropdownList), {
|
|
576
585
|
componentType: componentTypes.multiDropdownList,
|
|
577
|
-
internalComponent:
|
|
586
|
+
internalComponent: MultiDropdownList.hasInternalComponent()
|
|
578
587
|
});
|
|
579
588
|
|
|
580
589
|
MultiDropdownList.install = function (Vue) {
|
package/dist/es/MultiList.js
CHANGED
|
@@ -25,7 +25,8 @@ var isEqual = helper.isEqual,
|
|
|
25
25
|
getQueryOptions = helper.getQueryOptions,
|
|
26
26
|
checkValueChange = helper.checkValueChange,
|
|
27
27
|
getClassName = helper.getClassName,
|
|
28
|
-
|
|
28
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
29
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
29
30
|
var MultiList = {
|
|
30
31
|
name: 'MultiList',
|
|
31
32
|
props: {
|
|
@@ -52,7 +53,7 @@ var MultiList = {
|
|
|
52
53
|
showCount: VueTypes.bool.def(true),
|
|
53
54
|
showFilter: VueTypes.bool.def(true),
|
|
54
55
|
showSearch: VueTypes.bool.def(true),
|
|
55
|
-
size: VueTypes.number
|
|
56
|
+
size: VueTypes.number,
|
|
56
57
|
sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
|
|
57
58
|
title: types.title,
|
|
58
59
|
URLParams: VueTypes.bool.def(false),
|
|
@@ -339,22 +340,22 @@ var MultiList = {
|
|
|
339
340
|
checkValueChange(props.componentId, finalValues, props.beforeValueChange, performUpdate);
|
|
340
341
|
},
|
|
341
342
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
342
|
-
var defaultQueryOptions;
|
|
343
343
|
var query = MultiList.defaultQuery(value, props);
|
|
344
344
|
|
|
345
345
|
if (this.defaultQuery) {
|
|
346
346
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
347
|
+
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
347
348
|
|
|
348
|
-
if (
|
|
349
|
-
query =
|
|
350
|
-
}
|
|
349
|
+
if (defaultQueryObj) {
|
|
350
|
+
query = defaultQueryObj;
|
|
351
|
+
} // Update calculated default query in store
|
|
351
352
|
|
|
352
|
-
defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
|
|
353
353
|
|
|
354
354
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
355
|
+
var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
|
|
356
|
+
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
355
357
|
}
|
|
356
358
|
|
|
357
|
-
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
358
359
|
this.updateQuery({
|
|
359
360
|
componentId: this.internalComponent,
|
|
360
361
|
query: query,
|
|
@@ -365,17 +366,15 @@ var MultiList = {
|
|
|
365
366
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
366
367
|
var customQuery = props.customQuery;
|
|
367
368
|
var query = MultiList.defaultQuery(value, props);
|
|
368
|
-
var customQueryOptions;
|
|
369
369
|
|
|
370
370
|
if (customQuery) {
|
|
371
|
-
var
|
|
372
|
-
|
|
373
|
-
query = _ref.query;
|
|
374
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
371
|
+
var customQueryCalc = customQuery(value, props);
|
|
372
|
+
query = extractQueryFromCustomQuery(customQueryCalc);
|
|
375
373
|
updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
|
|
374
|
+
var customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
|
|
375
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
379
378
|
this.updateQuery({
|
|
380
379
|
componentId: props.componentId,
|
|
381
380
|
query: query,
|
|
@@ -395,7 +394,7 @@ var MultiList = {
|
|
|
395
394
|
|
|
396
395
|
if (props.defaultQuery) {
|
|
397
396
|
var value = Object.keys(this.$data.currentValue);
|
|
398
|
-
var defaultQueryOptions =
|
|
397
|
+
var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
|
|
399
398
|
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
|
|
400
399
|
} else {
|
|
401
400
|
this.setQueryOptions(this.internalComponent, queryOptions);
|
|
@@ -481,7 +480,13 @@ var MultiList = {
|
|
|
481
480
|
|
|
482
481
|
MultiList.defaultQuery = function (value, props) {
|
|
483
482
|
var query = null;
|
|
484
|
-
var
|
|
483
|
+
var queryFormat = props.queryFormat;
|
|
484
|
+
|
|
485
|
+
if (queryFormat === undefined) {
|
|
486
|
+
queryFormat = 'or';
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
var type = queryFormat === 'or' ? 'terms' : 'term';
|
|
485
490
|
|
|
486
491
|
if (!Array.isArray(value) || value.length === 0) {
|
|
487
492
|
return null;
|
|
@@ -502,14 +507,14 @@ MultiList.defaultQuery = function (value, props) {
|
|
|
502
507
|
} else if (value) {
|
|
503
508
|
var listQuery;
|
|
504
509
|
|
|
505
|
-
if (
|
|
510
|
+
if (queryFormat === 'or') {
|
|
506
511
|
if (props.showMissing) {
|
|
507
|
-
var _type,
|
|
512
|
+
var _type, _ref;
|
|
508
513
|
|
|
509
514
|
var hasMissingTerm = value.includes(props.missingLabel);
|
|
510
|
-
var should = [(
|
|
515
|
+
var should = [(_ref = {}, _ref[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
|
|
511
516
|
return item !== props.missingLabel;
|
|
512
|
-
}), _type),
|
|
517
|
+
}), _type), _ref)];
|
|
513
518
|
|
|
514
519
|
if (hasMissingTerm) {
|
|
515
520
|
should = should.concat({
|
|
@@ -536,9 +541,9 @@ MultiList.defaultQuery = function (value, props) {
|
|
|
536
541
|
} else {
|
|
537
542
|
// adds a sub-query with must as an array of objects for each term/value
|
|
538
543
|
var queryArray = value.map(function (item) {
|
|
539
|
-
var _type3,
|
|
544
|
+
var _type3, _ref2;
|
|
540
545
|
|
|
541
|
-
return
|
|
546
|
+
return _ref2 = {}, _ref2[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref2;
|
|
542
547
|
});
|
|
543
548
|
listQuery = {
|
|
544
549
|
bool: {
|
|
@@ -588,9 +593,14 @@ var mapDispatchtoProps = {
|
|
|
588
593
|
setCustomQuery: setCustomQuery,
|
|
589
594
|
setDefaultQuery: setDefaultQuery
|
|
590
595
|
};
|
|
596
|
+
|
|
597
|
+
MultiList.hasInternalComponent = function () {
|
|
598
|
+
return true;
|
|
599
|
+
};
|
|
600
|
+
|
|
591
601
|
var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(MultiList), {
|
|
592
602
|
componentType: componentTypes.multiList,
|
|
593
|
-
internalComponent:
|
|
603
|
+
internalComponent: MultiList.hasInternalComponent()
|
|
594
604
|
});
|
|
595
605
|
|
|
596
606
|
MultiList.install = function (Vue) {
|
package/dist/es/MultiRange.js
CHANGED
|
@@ -131,17 +131,16 @@ var MultiRange = {
|
|
|
131
131
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
132
132
|
var customQuery = props.customQuery;
|
|
133
133
|
var query = MultiRange.defaultQuery(value, props);
|
|
134
|
-
var customQueryOptions;
|
|
135
134
|
|
|
136
135
|
if (customQuery) {
|
|
137
136
|
var _ref = customQuery(value, props) || {};
|
|
138
137
|
|
|
139
138
|
query = _ref.query;
|
|
140
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
139
|
+
var customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
141
140
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
141
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
145
144
|
this.updateQuery({
|
|
146
145
|
componentId: props.componentId,
|
|
147
146
|
query: query,
|
package/dist/es/RangeSlider.js
CHANGED
|
@@ -108,14 +108,14 @@ var RangeSlider = {
|
|
|
108
108
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
109
109
|
var customQuery = props.customQuery;
|
|
110
110
|
var query = RangeSlider.defaultQuery(value, props);
|
|
111
|
-
var customQueryOptions;
|
|
112
111
|
|
|
113
112
|
if (customQuery) {
|
|
114
113
|
var _ref = customQuery(value, props) || {};
|
|
115
114
|
|
|
116
115
|
query = _ref.query;
|
|
117
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
116
|
+
var customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
118
117
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
118
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
var showFilter = props.showFilter,
|
|
@@ -126,7 +126,6 @@ var RangeSlider = {
|
|
|
126
126
|
currentEnd = value[1]; // check if the slider is at its initial position
|
|
127
127
|
|
|
128
128
|
var isInitialValue = currentStart === start && currentEnd === end;
|
|
129
|
-
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
130
129
|
this.updateQuery({
|
|
131
130
|
componentId: props.componentId,
|
|
132
131
|
query: query,
|