@appbaseio/reactivesearch-vue 1.27.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +564 -1038
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/DataSearch.js +13 -7
- package/dist/cjs/DynamicRangeSlider.js +24 -16
- package/dist/cjs/MultiDropdownList.js +33 -24
- 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 +37 -47
- package/dist/cjs/SelectedFilters.js +5 -3
- package/dist/cjs/SingleDropdownList.js +20 -17
- package/dist/cjs/SingleList.js +19 -16
- package/dist/cjs/SingleRange.js +2 -3
- package/dist/cjs/initReactivesearch.js +109 -77
- package/dist/cjs/version.js +1 -1
- package/dist/es/DataSearch.js +13 -7
- package/dist/es/DynamicRangeSlider.js +24 -16
- package/dist/es/MultiDropdownList.js +33 -24
- 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 +37 -47
- package/dist/es/SelectedFilters.js +5 -3
- package/dist/es/SingleDropdownList.js +20 -17
- package/dist/es/SingleList.js +19 -16
- package/dist/es/SingleRange.js +2 -3
- package/dist/es/initReactivesearch.js +111 -79
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
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,
|
|
@@ -8,10 +8,7 @@ import 'redux';
|
|
|
8
8
|
import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, c as connect } from './index-78920565.js';
|
|
9
9
|
import { C as ComponentWrapper } from './ComponentWrapper-0f3431d1.js';
|
|
10
10
|
|
|
11
|
-
var _excluded = ["options"]
|
|
12
|
-
_excluded2 = ["query"],
|
|
13
|
-
_excluded3 = ["query"],
|
|
14
|
-
_excluded4 = ["query"];
|
|
11
|
+
var _excluded = ["options"];
|
|
15
12
|
var updateQuery = Actions.updateQuery,
|
|
16
13
|
setQueryOptions = Actions.setQueryOptions,
|
|
17
14
|
setCustomQuery = Actions.setCustomQuery,
|
|
@@ -19,15 +16,16 @@ var updateQuery = Actions.updateQuery,
|
|
|
19
16
|
var parseHits = helper.parseHits,
|
|
20
17
|
isEqual = helper.isEqual,
|
|
21
18
|
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
getResultStats = helper.getResultStats,
|
|
20
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
21
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
24
22
|
var ReactiveComponent = {
|
|
25
23
|
name: 'ReactiveComponent',
|
|
26
24
|
props: {
|
|
27
25
|
componentId: types.stringRequired,
|
|
28
26
|
aggregationField: types.string,
|
|
29
27
|
aggregationSize: VueTypes.number,
|
|
30
|
-
size: VueTypes.number
|
|
28
|
+
size: VueTypes.number,
|
|
31
29
|
defaultQuery: types.func,
|
|
32
30
|
customQuery: types.func,
|
|
33
31
|
filterLabel: types.string,
|
|
@@ -69,25 +67,16 @@ var ReactiveComponent = {
|
|
|
69
67
|
|
|
70
68
|
if (customQuery) {
|
|
71
69
|
var calcCustomQuery = customQuery(this.selectedValue, props);
|
|
72
|
-
|
|
73
|
-
var
|
|
74
|
-
query = _ref.query;
|
|
75
|
-
|
|
76
|
-
var customQueryOptions = calcCustomQuery ? getOptionsFromQuery(calcCustomQuery) : null;
|
|
70
|
+
var query = extractQueryFromCustomQuery(calcCustomQuery);
|
|
71
|
+
var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
|
|
77
72
|
|
|
78
73
|
if (customQueryOptions) {
|
|
79
74
|
this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
|
|
80
75
|
} else this.setQueryOptions(componentId, this.getAggsQuery(), false);
|
|
81
76
|
|
|
82
|
-
var queryToSet = query || null;
|
|
83
|
-
|
|
84
|
-
if (calcCustomQuery && calcCustomQuery.id) {
|
|
85
|
-
queryToSet = calcCustomQuery;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
77
|
this.updateQuery({
|
|
89
78
|
componentId: componentId,
|
|
90
|
-
query:
|
|
79
|
+
query: query,
|
|
91
80
|
value: this.selectedValue || null,
|
|
92
81
|
label: filterLabel,
|
|
93
82
|
showFilter: showFilter,
|
|
@@ -95,36 +84,35 @@ var ReactiveComponent = {
|
|
|
95
84
|
});
|
|
96
85
|
}
|
|
97
86
|
|
|
98
|
-
this.setQuery = function (
|
|
99
|
-
var options =
|
|
100
|
-
obj = _objectWithoutPropertiesLoose(
|
|
87
|
+
this.setQuery = function (_ref) {
|
|
88
|
+
var options = _ref.options,
|
|
89
|
+
obj = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
101
90
|
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
|
|
92
|
+
|
|
93
|
+
if (queryToBeSet && queryToBeSet.query) {
|
|
94
|
+
queryToBeSet = queryToBeSet.query;
|
|
104
95
|
}
|
|
105
96
|
|
|
106
|
-
var
|
|
97
|
+
var customQueryCalc = _extends({}, options, {
|
|
98
|
+
query: queryToBeSet
|
|
99
|
+
});
|
|
107
100
|
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
var rsAPIQuery = customQueryCalc; // handle stored queries
|
|
102
|
+
|
|
103
|
+
if (queryToBeSet && queryToBeSet.id) {
|
|
104
|
+
rsAPIQuery = queryToBeSet;
|
|
110
105
|
} // Update customQuery field for RS API
|
|
111
106
|
|
|
112
107
|
|
|
113
|
-
|
|
114
|
-
var customQueryCalc = _extends({}, options);
|
|
108
|
+
_this.setCustomQuery(props.componentId, rsAPIQuery);
|
|
115
109
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
customQueryCalc = queryToBeSet;
|
|
119
|
-
} else {
|
|
120
|
-
customQueryCalc.query = obj.query;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
_this.setCustomQuery(props.componentId, customQueryCalc);
|
|
110
|
+
if (options) {
|
|
111
|
+
_this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
|
|
125
112
|
}
|
|
126
113
|
|
|
127
114
|
_this.updateQuery(_extends({}, obj, {
|
|
115
|
+
query: customQueryCalc.query,
|
|
128
116
|
componentId: props.componentId,
|
|
129
117
|
label: props.filterLabel,
|
|
130
118
|
showFilter: props.showFilter,
|
|
@@ -135,29 +123,22 @@ var ReactiveComponent = {
|
|
|
135
123
|
if (props.defaultQuery) {
|
|
136
124
|
this.internalComponent = props.componentId + "__internal";
|
|
137
125
|
}
|
|
138
|
-
|
|
139
|
-
beforeMount: function beforeMount() {
|
|
126
|
+
|
|
140
127
|
if (this.internalComponent && this.$props.defaultQuery) {
|
|
141
128
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
|
|
142
129
|
this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
|
|
143
130
|
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
131
|
+
var _query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
132
|
+
|
|
133
|
+
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
147
134
|
|
|
148
135
|
if (queryOptions) {
|
|
149
136
|
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
|
|
150
137
|
} else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
|
|
151
138
|
|
|
152
|
-
var queryToSet = query || null;
|
|
153
|
-
|
|
154
|
-
if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
|
|
155
|
-
queryToSet = this.$defaultQuery;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
139
|
this.updateQuery({
|
|
159
140
|
componentId: this.internalComponent,
|
|
160
|
-
query:
|
|
141
|
+
query: _query
|
|
161
142
|
});
|
|
162
143
|
}
|
|
163
144
|
},
|
|
@@ -205,10 +186,8 @@ var ReactiveComponent = {
|
|
|
205
186
|
defaultQuery: function defaultQuery(newVal, oldVal) {
|
|
206
187
|
if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
|
|
207
188
|
this.$defaultQuery = newVal(this.selectedValue, this.$props);
|
|
208
|
-
|
|
209
|
-
var
|
|
210
|
-
query = _ref4.query,
|
|
211
|
-
queryOptions = _objectWithoutPropertiesLoose(_ref4, _excluded3);
|
|
189
|
+
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
190
|
+
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
212
191
|
|
|
213
192
|
if (queryOptions) {
|
|
214
193
|
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
|
|
@@ -216,15 +195,9 @@ var ReactiveComponent = {
|
|
|
216
195
|
|
|
217
196
|
|
|
218
197
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
|
|
219
|
-
var queryToSet = query || null;
|
|
220
|
-
|
|
221
|
-
if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
|
|
222
|
-
queryToSet = this.$defaultQuery;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
198
|
this.updateQuery({
|
|
226
199
|
componentId: this.internalComponent,
|
|
227
|
-
query:
|
|
200
|
+
query: query
|
|
228
201
|
});
|
|
229
202
|
}
|
|
230
203
|
},
|
|
@@ -232,10 +205,8 @@ var ReactiveComponent = {
|
|
|
232
205
|
if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
|
|
233
206
|
var componentId = this.$props.componentId;
|
|
234
207
|
this.$customQuery = newVal(this.selectedValue, this.$props);
|
|
235
|
-
|
|
236
|
-
var
|
|
237
|
-
query = _ref5.query,
|
|
238
|
-
queryOptions = _objectWithoutPropertiesLoose(_ref5, _excluded4);
|
|
208
|
+
var query = extractQueryFromCustomQuery(this.$customQuery);
|
|
209
|
+
var queryOptions = getOptionsForCustomQuery(this.$customQuery);
|
|
239
210
|
|
|
240
211
|
if (queryOptions) {
|
|
241
212
|
this.setQueryOptions(componentId, _extends({}, queryOptions, this.getAggsQuery()), false);
|
|
@@ -243,15 +214,9 @@ var ReactiveComponent = {
|
|
|
243
214
|
|
|
244
215
|
|
|
245
216
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
|
|
246
|
-
var queryToSet = query || null;
|
|
247
|
-
|
|
248
|
-
if (this.$customQuery && this.$customQuery.id) {
|
|
249
|
-
queryToSet = this.$customQuery;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
217
|
this.updateQuery({
|
|
253
218
|
componentId: componentId,
|
|
254
|
-
query:
|
|
219
|
+
query: query
|
|
255
220
|
});
|
|
256
221
|
}
|
|
257
222
|
}
|
|
@@ -331,6 +296,10 @@ var ReactiveComponent = {
|
|
|
331
296
|
}
|
|
332
297
|
};
|
|
333
298
|
|
|
299
|
+
ReactiveComponent.hasInternalComponent = function (props) {
|
|
300
|
+
return !!props.defaultQuery;
|
|
301
|
+
};
|
|
302
|
+
|
|
334
303
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
335
304
|
return {
|
|
336
305
|
aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
|
package/dist/es/ReactiveList.js
CHANGED
|
@@ -429,9 +429,10 @@ var isEqual$1 = helper.isEqual,
|
|
|
429
429
|
getQueryOptions = helper.getQueryOptions,
|
|
430
430
|
getClassName$1 = helper.getClassName,
|
|
431
431
|
parseHits = helper.parseHits,
|
|
432
|
-
getOptionsFromQuery = helper.getOptionsFromQuery,
|
|
433
432
|
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
434
|
-
getResultStats = helper.getResultStats
|
|
433
|
+
getResultStats = helper.getResultStats,
|
|
434
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
435
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
435
436
|
var ReactiveList = {
|
|
436
437
|
name: 'ReactiveList',
|
|
437
438
|
components: {
|
|
@@ -629,19 +630,11 @@ var ReactiveList = {
|
|
|
629
630
|
var options = getQueryOptions(this.$props);
|
|
630
631
|
options.from = 0;
|
|
631
632
|
this.$defaultQuery = newVal(null, this.$props);
|
|
632
|
-
|
|
633
|
-
var
|
|
634
|
-
sort = _ref.sort,
|
|
635
|
-
query = _ref.query;
|
|
636
|
-
|
|
637
|
-
if (sort) {
|
|
638
|
-
options.sort = this.$defaultQuery.sort;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
var queryOptions = getOptionsFromQuery(this.$defaultQuery);
|
|
633
|
+
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
634
|
+
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
642
635
|
|
|
643
636
|
if (queryOptions) {
|
|
644
|
-
options = _extends({}, options,
|
|
637
|
+
options = _extends({}, options, queryOptions);
|
|
645
638
|
} // Update calculated default query in store
|
|
646
639
|
|
|
647
640
|
|
|
@@ -732,24 +725,24 @@ var ReactiveList = {
|
|
|
732
725
|
options.from = this.$data.from;
|
|
733
726
|
|
|
734
727
|
if (this.sortOptions && this.sortOptions[this.sortOptionIndex]) {
|
|
735
|
-
var
|
|
728
|
+
var _ref;
|
|
736
729
|
|
|
737
730
|
var sortField = this.sortOptions[this.sortOptionIndex].dataField;
|
|
738
731
|
var sortBy = this.sortOptions[this.sortOptionIndex].sortBy;
|
|
739
|
-
options.sort = [(
|
|
732
|
+
options.sort = [(_ref = {}, _ref[sortField] = {
|
|
740
733
|
order: sortBy
|
|
741
|
-
},
|
|
734
|
+
}, _ref)]; // To handle sort options for RS API
|
|
742
735
|
|
|
743
736
|
this.updateComponentProps(this.componentId, {
|
|
744
737
|
dataField: sortField,
|
|
745
738
|
sortBy: sortBy
|
|
746
739
|
}, componentTypes.reactiveList);
|
|
747
740
|
} else if (this.$props.sortBy) {
|
|
748
|
-
var
|
|
741
|
+
var _ref2;
|
|
749
742
|
|
|
750
|
-
options.sort = [(
|
|
743
|
+
options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
|
|
751
744
|
order: this.$props.sortBy
|
|
752
|
-
},
|
|
745
|
+
}, _ref2)];
|
|
753
746
|
} // Override sort query with defaultQuery's sort if defined
|
|
754
747
|
|
|
755
748
|
|
|
@@ -757,20 +750,13 @@ var ReactiveList = {
|
|
|
757
750
|
|
|
758
751
|
if (this.$props.defaultQuery) {
|
|
759
752
|
this.$defaultQuery = this.$props.defaultQuery();
|
|
760
|
-
options = _extends({}, options,
|
|
761
|
-
|
|
762
|
-
if (this.$defaultQuery.sort) {
|
|
763
|
-
options.sort = this.$defaultQuery.sort;
|
|
764
|
-
} // Update calculated default query in store
|
|
765
|
-
|
|
753
|
+
options = _extends({}, options, getOptionsForCustomQuery(this.$defaultQuery)); // Update calculated default query in store
|
|
766
754
|
|
|
767
755
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props);
|
|
768
756
|
} // execute is set to false at the time of mount
|
|
769
757
|
|
|
770
758
|
|
|
771
|
-
var
|
|
772
|
-
query = _ref4.query;
|
|
773
|
-
|
|
759
|
+
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
774
760
|
var execute = false;
|
|
775
761
|
this.setQueryOptions(this.$props.componentId, _extends({}, options, this.getAggsQuery()), execute);
|
|
776
762
|
|
|
@@ -885,18 +871,18 @@ var ReactiveList = {
|
|
|
885
871
|
}) : 0;
|
|
886
872
|
|
|
887
873
|
if (props.sortOptions[sortOptionIndex]) {
|
|
888
|
-
var
|
|
874
|
+
var _ref3;
|
|
889
875
|
|
|
890
|
-
options.sort = [(
|
|
876
|
+
options.sort = [(_ref3 = {}, _ref3[props.sortOptions[sortOptionIndex].dataField] = {
|
|
891
877
|
order: props.sortOptions[sortOptionIndex].sortBy
|
|
892
|
-
},
|
|
878
|
+
}, _ref3)];
|
|
893
879
|
}
|
|
894
880
|
} else if (props.sortBy) {
|
|
895
|
-
var
|
|
881
|
+
var _ref4;
|
|
896
882
|
|
|
897
|
-
options.sort = [(
|
|
883
|
+
options.sort = [(_ref4 = {}, _ref4[props.dataField] = {
|
|
898
884
|
order: props.sortBy
|
|
899
|
-
},
|
|
885
|
+
}, _ref4)];
|
|
900
886
|
}
|
|
901
887
|
|
|
902
888
|
this.setQueryOptions(this.$props.componentId, _extends({}, options, this.getAggsQuery()), true);
|
|
@@ -999,16 +985,16 @@ var ReactiveList = {
|
|
|
999
985
|
var index = e.target.value;
|
|
1000
986
|
|
|
1001
987
|
if (this.sortOptions && this.sortOptions[index]) {
|
|
1002
|
-
var
|
|
988
|
+
var _ref5;
|
|
1003
989
|
|
|
1004
990
|
// This fixes issue #371 (where sorting a multi-result page with infinite loader breaks)
|
|
1005
991
|
var options = getQueryOptions(this.$props);
|
|
1006
992
|
options.from = 0;
|
|
1007
993
|
var sortField = this.sortOptions[index].dataField;
|
|
1008
994
|
var sortBy = this.sortOptions[index].sortBy;
|
|
1009
|
-
options.sort = [(
|
|
995
|
+
options.sort = [(_ref5 = {}, _ref5[sortField] = {
|
|
1010
996
|
order: sortBy
|
|
1011
|
-
},
|
|
997
|
+
}, _ref5)];
|
|
1012
998
|
this.sortOptionIndex = index; // To handle sort options for RS API
|
|
1013
999
|
|
|
1014
1000
|
this.updateComponentProps(this.componentId, {
|
|
@@ -1173,7 +1159,7 @@ ReactiveList.generateQueryOptions = function (props) {
|
|
|
1173
1159
|
options.size = size || 10;
|
|
1174
1160
|
|
|
1175
1161
|
var getSortOption = function getSortOption() {
|
|
1176
|
-
var
|
|
1162
|
+
var _ref7;
|
|
1177
1163
|
|
|
1178
1164
|
if (defaultSortOption) {
|
|
1179
1165
|
var sortOption = sortOptionsNew.find(function (option) {
|
|
@@ -1181,35 +1167,39 @@ ReactiveList.generateQueryOptions = function (props) {
|
|
|
1181
1167
|
});
|
|
1182
1168
|
|
|
1183
1169
|
if (sortOption) {
|
|
1184
|
-
var
|
|
1170
|
+
var _ref6;
|
|
1185
1171
|
|
|
1186
|
-
return
|
|
1172
|
+
return _ref6 = {}, _ref6[sortOption.dataField] = {
|
|
1187
1173
|
order: sortOption.sortBy
|
|
1188
|
-
},
|
|
1174
|
+
}, _ref6;
|
|
1189
1175
|
}
|
|
1190
1176
|
}
|
|
1191
1177
|
|
|
1192
|
-
return
|
|
1178
|
+
return _ref7 = {}, _ref7[sortOptionsNew[0].dataField] = {
|
|
1193
1179
|
order: sortOptionsNew[0].sortBy
|
|
1194
|
-
},
|
|
1180
|
+
}, _ref7;
|
|
1195
1181
|
};
|
|
1196
1182
|
|
|
1197
1183
|
if (sortOptionsNew) {
|
|
1198
1184
|
options.sort = [getSortOption()];
|
|
1199
1185
|
} else if (sortBy) {
|
|
1200
|
-
var
|
|
1186
|
+
var _ref8;
|
|
1201
1187
|
|
|
1202
|
-
options.sort = [(
|
|
1188
|
+
options.sort = [(_ref8 = {}, _ref8[dataField] = {
|
|
1203
1189
|
order: sortBy
|
|
1204
|
-
},
|
|
1190
|
+
}, _ref8)];
|
|
1205
1191
|
}
|
|
1206
1192
|
|
|
1207
1193
|
return options;
|
|
1208
1194
|
};
|
|
1209
1195
|
|
|
1196
|
+
ReactiveList.hasInternalComponent = function () {
|
|
1197
|
+
return true;
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1210
1200
|
var RLConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(ReactiveList), {
|
|
1211
1201
|
componentType: componentTypes.reactiveList,
|
|
1212
|
-
internalComponent:
|
|
1202
|
+
internalComponent: ReactiveList.hasInternalComponent()
|
|
1213
1203
|
});
|
|
1214
1204
|
|
|
1215
1205
|
ReactiveList.install = function (Vue) {
|
|
@@ -26,6 +26,7 @@ var SelectedFilters = {
|
|
|
26
26
|
showClearAll: VueTypes.bool.def(true),
|
|
27
27
|
title: types.title,
|
|
28
28
|
resetToDefault: VueTypes.bool.def(false),
|
|
29
|
+
clearAllBlacklistComponents: VueTypes.array,
|
|
29
30
|
resetToValues: VueTypes.object
|
|
30
31
|
},
|
|
31
32
|
inject: {
|
|
@@ -80,12 +81,13 @@ var SelectedFilters = {
|
|
|
80
81
|
},
|
|
81
82
|
clearValues: function clearValues() {
|
|
82
83
|
var resetToDefault = this.resetToDefault,
|
|
83
|
-
resetToValues = this.resetToValues
|
|
84
|
+
resetToValues = this.resetToValues,
|
|
85
|
+
clearAllBlacklistComponents = this.clearAllBlacklistComponents;
|
|
84
86
|
|
|
85
87
|
if (resetToDefault) {
|
|
86
|
-
this.resetValuesToDefault();
|
|
88
|
+
this.resetValuesToDefault(clearAllBlacklistComponents);
|
|
87
89
|
} else {
|
|
88
|
-
this.clearValuesAction(resetToValues);
|
|
90
|
+
this.clearValuesAction(resetToValues, clearAllBlacklistComponents);
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
this.$emit('clear', resetToValues);
|