@appbaseio/reactivesearch-vue 1.33.0 → 1.33.2
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 +1916 -6072
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +3 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-0673191e.js → Button-841fd06d.js} +1 -7
- package/dist/cjs/{CancelSvg-9f258f4f.js → CancelSvg-220a7cc3.js} +24 -58
- package/dist/cjs/{Card-642547a8.js → Card-240f283d.js} +2 -2
- package/dist/cjs/{ComponentWrapper-981ab977.js → ComponentWrapper-9318cece.js} +21 -41
- package/dist/cjs/{Container-daf30918.js → Container-e699ea95.js} +1 -1
- package/dist/cjs/{DataSearch-708b183d.js → DataSearch-99a6a2e8.js} +121 -293
- package/dist/cjs/DataSearch.js +11 -11
- package/dist/cjs/{DropDown-c479bbb0.js → DropDown-8984b544.js} +27 -48
- package/dist/cjs/DynamicRangeSlider.js +44 -93
- package/dist/cjs/{Flex-aa517a13.js → Flex-ddd7cb6b.js} +1 -3
- package/dist/cjs/{FormControlList-c195a592.js → FormControlList-bbb5cd24.js} +1 -3
- package/dist/cjs/{Input-e6603a7e.js → Input-ead4cd84.js} +14 -16
- package/dist/cjs/{ListItem-8c9e0d68.js → ListItem-5088bd6a.js} +2 -3
- package/dist/cjs/MultiDropdownList.js +41 -102
- package/dist/cjs/MultiList.js +35 -98
- package/dist/cjs/MultiRange.js +20 -52
- package/dist/cjs/{Pagination-3d73e1b3.js → Pagination-07f4dbad.js} +10 -30
- package/dist/cjs/{PreferencesConsumer-7be03476.js → PreferencesConsumer-5d67b486.js} +13 -16
- package/dist/cjs/RangeInput.js +36 -52
- package/dist/cjs/RangeSlider.js +24 -48
- package/dist/cjs/ReactiveBase.js +34 -79
- package/dist/cjs/{ReactiveComponent-5ff98cce.js → ReactiveComponent-805201c6.js} +118 -301
- package/dist/cjs/ReactiveComponent.js +20 -20
- package/dist/cjs/ReactiveGoogleMap.js +167 -353
- package/dist/cjs/ReactiveList.js +88 -176
- package/dist/cjs/ResultCard.js +10 -18
- package/dist/cjs/ResultList.js +13 -24
- package/dist/cjs/SelectedFilters.js +16 -34
- package/dist/cjs/SingleDropdownList.js +35 -75
- package/dist/cjs/SingleList.js +29 -75
- package/dist/cjs/SingleRange.js +17 -40
- package/dist/cjs/StateProvider.js +6 -26
- package/dist/cjs/{Title-1de7d0f4.js → Title-16042ea0.js} +1 -1
- package/dist/cjs/ToggleButton.js +20 -58
- package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
- package/dist/cjs/{index-08f8dfa3.js → index-30126fd0.js} +39 -75
- package/dist/cjs/index.js +20 -21
- package/dist/cjs/initReactivesearch.js +49 -120
- package/dist/cjs/install.js +20 -20
- package/dist/cjs/{ssr-3027b848.js → ssr-f2fc1bf6.js} +1 -4
- package/dist/cjs/{utils-d6a52588.js → utils-83fd01e9.js} +7 -16
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-727b7c63.js → vueTypes-7cfc2f98.js} +6 -11
- package/dist/es/{Button-35aa984e.js → Button-153cd885.js} +1 -7
- package/dist/es/{CancelSvg-4cfae5fd.js → CancelSvg-e40552a5.js} +24 -58
- package/dist/es/{Card-450683f1.js → Card-19ad6d90.js} +2 -2
- package/dist/es/{ComponentWrapper-d5e814a4.js → ComponentWrapper-240450cc.js} +21 -41
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +1 -1
- package/dist/es/{DataSearch-5376d39a.js → DataSearch-20f0d8f1.js} +121 -293
- package/dist/es/DataSearch.js +11 -11
- package/dist/es/{DropDown-05a644a5.js → DropDown-28ddce07.js} +27 -48
- package/dist/es/DynamicRangeSlider.js +44 -93
- package/dist/es/{Flex-1f0795c3.js → Flex-7c177a10.js} +1 -3
- package/dist/es/{FormControlList-c22d64f6.js → FormControlList-99797d0a.js} +1 -3
- package/dist/es/{Input-7a2a9fac.js → Input-c09c0b56.js} +14 -16
- package/dist/es/{ListItem-cad14c5e.js → ListItem-07888a65.js} +2 -3
- package/dist/es/MultiDropdownList.js +41 -102
- package/dist/es/MultiList.js +35 -98
- package/dist/es/MultiRange.js +20 -52
- package/dist/es/{Pagination-af9de08f.js → Pagination-28e56c5c.js} +10 -30
- package/dist/es/{PreferencesConsumer-c30605fe.js → PreferencesConsumer-bc097ebb.js} +13 -16
- package/dist/es/RangeInput.js +36 -52
- package/dist/es/RangeSlider.js +24 -48
- package/dist/es/ReactiveBase.js +34 -79
- package/dist/es/{ReactiveComponent-ee01562d.js → ReactiveComponent-dd85aa9c.js} +118 -301
- package/dist/es/ReactiveComponent.js +20 -20
- package/dist/es/ReactiveGoogleMap.js +167 -353
- package/dist/es/ReactiveList.js +88 -176
- package/dist/es/ResultCard.js +10 -18
- package/dist/es/ResultList.js +13 -24
- package/dist/es/SelectedFilters.js +16 -34
- package/dist/es/SingleDropdownList.js +35 -75
- package/dist/es/SingleList.js +29 -75
- package/dist/es/SingleRange.js +17 -40
- package/dist/es/StateProvider.js +6 -26
- package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +1 -1
- package/dist/es/ToggleButton.js +20 -58
- package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
- package/dist/es/{index-99c5f9c9.js → index-0444a498.js} +39 -75
- package/dist/es/index.js +20 -21
- package/dist/es/initReactivesearch.js +49 -120
- package/dist/es/install.js +20 -20
- package/dist/es/{ssr-b2c0b401.js → ssr-03607d84.js} +1 -4
- package/dist/es/{utils-9e68acee.js → utils-9e5a16a1.js} +7 -16
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-b8146772.js → vueTypes-8986b709.js} +6 -11
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Actions, helper, causes } from '@appbaseio/reactivecore';
|
|
2
2
|
import { SEARCH_COMPONENTS_MODES, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-
|
|
3
|
+
import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
4
4
|
import VueTypes from 'vue-types';
|
|
5
5
|
import { getQueryOptions, suggestionTypes } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
6
6
|
import styled from '@appbaseio/vue-emotion';
|
|
7
|
-
import { B as Button } from './Button-
|
|
8
|
-
import { t as types } from './vueTypes-
|
|
7
|
+
import { B as Button } from './Button-153cd885.js';
|
|
8
|
+
import { t as types } from './vueTypes-8986b709.js';
|
|
9
9
|
import { RLConnected } from './ReactiveList.js';
|
|
10
|
-
import { n as decodeHtml, h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, u as updateDefaultQuery, f as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-
|
|
11
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
12
|
-
import { P as PreferencesConsumer } from './PreferencesConsumer-
|
|
13
|
-
import { T as Title } from './Title-
|
|
10
|
+
import { n as decodeHtml, h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, u as updateDefaultQuery, f as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-0444a498.js';
|
|
11
|
+
import { C as ComponentWrapper } from './ComponentWrapper-240450cc.js';
|
|
12
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
|
|
13
|
+
import { T as Title } from './Title-863dfa42.js';
|
|
14
14
|
import hotkeys from 'hotkeys-js';
|
|
15
|
-
import { S as SearchSvg, b as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, c as TagsContainer, d as InputGroup, C as CustomSvg, e as SuggestionItem, D as DSConnected } from './DataSearch-
|
|
16
|
-
import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-
|
|
17
|
-
import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-
|
|
18
|
-
import { C as Container } from './Container-
|
|
15
|
+
import { S as SearchSvg, b as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, c as TagsContainer, d as InputGroup, C as CustomSvg, e as SuggestionItem, D as DSConnected } from './DataSearch-20f0d8f1.js';
|
|
16
|
+
import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-e40552a5.js';
|
|
17
|
+
import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-c09c0b56.js';
|
|
18
|
+
import { C as Container } from './Container-d00219f7.js';
|
|
19
19
|
import { ListConnected as ListConnected$4 } from './SingleList.js';
|
|
20
20
|
import { ListConnected as ListConnected$3 } from './MultiList.js';
|
|
21
21
|
import { ListConnected as ListConnected$2 } from './SingleDropdownList.js';
|
|
@@ -56,17 +56,17 @@ var AutoFillSvg = {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
var updateQuery = Actions.updateQuery,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
setCustomQuery = Actions.setCustomQuery,
|
|
60
|
+
setDefaultQuery = Actions.setDefaultQuery,
|
|
61
|
+
recordSuggestionClick = Actions.recordSuggestionClick;
|
|
62
62
|
var _debounce = helper.debounce,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
checkValueChange = helper.checkValueChange,
|
|
64
|
+
getClassName = helper.getClassName,
|
|
65
|
+
isEqual = helper.isEqual,
|
|
66
|
+
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
67
|
+
withClickIds = helper.withClickIds,
|
|
68
|
+
getResultStats = helper.getResultStats,
|
|
69
|
+
normalizeDataField = helper.normalizeDataField;
|
|
70
70
|
var SearchBox = {
|
|
71
71
|
name: 'SearchBox',
|
|
72
72
|
isTagsMode: false,
|
|
@@ -88,39 +88,32 @@ var SearchBox = {
|
|
|
88
88
|
},
|
|
89
89
|
created: function created() {
|
|
90
90
|
var _this$$props = this.$props,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
distinctField = _this$$props.distinctField,
|
|
92
|
+
distinctFieldConfig = _this$$props.distinctFieldConfig,
|
|
93
|
+
index = _this$$props.index,
|
|
94
|
+
mode = _this$$props.mode;
|
|
96
95
|
if (mode === SEARCH_COMPONENTS_MODES.TAG) {
|
|
97
96
|
this.$options.isTagsMode = true;
|
|
98
97
|
}
|
|
99
|
-
|
|
100
98
|
if (this.$options.isTagsMode) {
|
|
101
99
|
console.warn('Warning(ReactiveSearch): The `categoryField` prop is not supported when `mode` prop is set to `tag`');
|
|
102
100
|
}
|
|
103
|
-
|
|
104
101
|
if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
|
|
105
102
|
console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
|
|
106
103
|
}
|
|
107
|
-
|
|
108
104
|
if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
|
|
109
105
|
console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
110
106
|
}
|
|
111
|
-
|
|
112
107
|
if (!this.enableAppbase && index) {
|
|
113
108
|
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
114
109
|
}
|
|
115
|
-
|
|
116
110
|
this.currentValue = decodeHtml(this.selectedValue || this.value || this.defaultValue || '');
|
|
117
|
-
|
|
118
111
|
if (this.$options.isTagsMode) {
|
|
119
112
|
this.currentValue = '';
|
|
120
113
|
}
|
|
114
|
+
this.handleTextChange = _debounce(this.handleText, this.$props.debounce);
|
|
121
115
|
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
// Set custom and default queries in store
|
|
124
117
|
this.triggerCustomQuery(this.currentValue, this.selectedCategory);
|
|
125
118
|
this.triggerDefaultQuery(this.currentValue);
|
|
126
119
|
},
|
|
@@ -261,13 +254,11 @@ var SearchBox = {
|
|
|
261
254
|
},
|
|
262
255
|
suggestions: function suggestions(newVal) {
|
|
263
256
|
var suggestionsList = [];
|
|
264
|
-
|
|
265
257
|
if (Array.isArray(newVal) && newVal.length) {
|
|
266
258
|
suggestionsList = [].concat(withClickIds(newVal));
|
|
267
259
|
} else if (Array.isArray(this.$props.defaultSuggestions) && this.$props.defaultSuggestions.length) {
|
|
268
260
|
suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
|
|
269
261
|
}
|
|
270
|
-
|
|
271
262
|
this.normalizedSuggestions = suggestionsList;
|
|
272
263
|
},
|
|
273
264
|
selectedValue: function selectedValue(newVal, oldVal) {
|
|
@@ -275,21 +266,18 @@ var SearchBox = {
|
|
|
275
266
|
if (!newVal && this.$data.currentValue) {
|
|
276
267
|
// selected value is cleared, call onValueSelected
|
|
277
268
|
this.onValueSelectedHandler('', causes.CLEAR_VALUE);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
|
|
269
|
+
}
|
|
270
|
+
// if (this.$props.value === undefined) {
|
|
281
271
|
if (this.$options.isTagsMode) {
|
|
282
272
|
// handling reset of tags through SelectedFilters or URL
|
|
283
273
|
this.selectedTags = [];
|
|
284
274
|
}
|
|
285
|
-
|
|
286
275
|
var cause = !newVal ? causes.CLEAR_VALUE : undefined;
|
|
287
|
-
|
|
288
276
|
if (this.$options.isTagsMode) {
|
|
289
277
|
cause = causes.SUGGESTION_SELECT;
|
|
290
278
|
}
|
|
291
|
-
|
|
292
|
-
|
|
279
|
+
this.setValue(newVal || '', true, this.$props, cause);
|
|
280
|
+
// }
|
|
293
281
|
}
|
|
294
282
|
},
|
|
295
283
|
focusShortcuts: function focusShortcuts() {
|
|
@@ -354,18 +342,15 @@ var SearchBox = {
|
|
|
354
342
|
var props = this.$props;
|
|
355
343
|
var requiredError = propName + " supplied to " + componentName + " is required. Validation failed.";
|
|
356
344
|
var propValue = props[propName];
|
|
357
|
-
|
|
358
345
|
if (!this.enableAppbase) {
|
|
359
346
|
if (!propValue) {
|
|
360
347
|
console.error(requiredError);
|
|
361
348
|
return;
|
|
362
349
|
}
|
|
363
|
-
|
|
364
350
|
if (typeof propValue !== 'string' && typeof propValue !== 'object' && !Array.isArray(propValue)) {
|
|
365
351
|
console.error("Invalid " + propName + " supplied to " + componentName + ". Validation failed.");
|
|
366
352
|
return;
|
|
367
353
|
}
|
|
368
|
-
|
|
369
354
|
if (Array.isArray(propValue) && propValue.length === 0) {
|
|
370
355
|
console.error(requiredError);
|
|
371
356
|
}
|
|
@@ -375,7 +360,6 @@ var SearchBox = {
|
|
|
375
360
|
if (downshiftProps === void 0) {
|
|
376
361
|
downshiftProps = {};
|
|
377
362
|
}
|
|
378
|
-
|
|
379
363
|
var currentValue = this.$data.currentValue;
|
|
380
364
|
var data = {
|
|
381
365
|
error: this.error,
|
|
@@ -392,19 +376,16 @@ var SearchBox = {
|
|
|
392
376
|
getBasicQueryOptions: function getBasicQueryOptions() {
|
|
393
377
|
var aggregationField = this.$props.aggregationField;
|
|
394
378
|
var queryOptions = getQueryOptions(this.$props);
|
|
395
|
-
|
|
396
379
|
if (aggregationField) {
|
|
397
380
|
queryOptions.aggs = getCompositeAggsQuery({
|
|
398
381
|
props: this.$props,
|
|
399
382
|
showTopHits: true
|
|
400
383
|
}).aggs;
|
|
401
384
|
}
|
|
402
|
-
|
|
403
385
|
return queryOptions;
|
|
404
386
|
},
|
|
405
387
|
handleSearchIconClick: function handleSearchIconClick() {
|
|
406
388
|
var currentValue = this.currentValue;
|
|
407
|
-
|
|
408
389
|
if (currentValue.trim()) {
|
|
409
390
|
this.setValue(currentValue, true);
|
|
410
391
|
this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
|
|
@@ -412,28 +393,22 @@ var SearchBox = {
|
|
|
412
393
|
},
|
|
413
394
|
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
|
|
414
395
|
var _this = this;
|
|
415
|
-
|
|
416
396
|
if (isDefaultValue === void 0) {
|
|
417
397
|
isDefaultValue = false;
|
|
418
398
|
}
|
|
419
|
-
|
|
420
399
|
if (props === void 0) {
|
|
421
400
|
props = this.$props;
|
|
422
401
|
}
|
|
423
|
-
|
|
424
402
|
if (toggleIsOpen === void 0) {
|
|
425
403
|
toggleIsOpen = true;
|
|
426
404
|
}
|
|
427
|
-
|
|
428
405
|
if (categoryValue === void 0) {
|
|
429
406
|
categoryValue = undefined;
|
|
430
407
|
}
|
|
431
|
-
|
|
432
408
|
var performUpdate = function performUpdate() {
|
|
433
409
|
if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
|
|
434
410
|
return;
|
|
435
411
|
}
|
|
436
|
-
|
|
437
412
|
if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
|
|
438
413
|
if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
|
|
439
414
|
// check if value already present in selectedTags
|
|
@@ -441,9 +416,7 @@ var SearchBox = {
|
|
|
441
416
|
_this.isOpen = false;
|
|
442
417
|
return;
|
|
443
418
|
}
|
|
444
|
-
|
|
445
419
|
_this.selectedTags = [].concat(_this.selectedTags);
|
|
446
|
-
|
|
447
420
|
if (typeof value === 'string' && !!value) {
|
|
448
421
|
_this.selectedTags.push(value);
|
|
449
422
|
} else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
|
|
@@ -453,29 +426,22 @@ var SearchBox = {
|
|
|
453
426
|
} else if (value) {
|
|
454
427
|
_this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
455
428
|
}
|
|
456
|
-
|
|
457
429
|
_this.currentValue = '';
|
|
458
430
|
} else {
|
|
459
431
|
_this.currentValue = decodeHtml(value);
|
|
460
432
|
}
|
|
461
|
-
|
|
462
433
|
var queryHandlerValue = value;
|
|
463
|
-
|
|
464
434
|
if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
|
|
465
435
|
queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
|
|
466
436
|
}
|
|
467
|
-
|
|
468
437
|
if (isDefaultValue) {
|
|
469
438
|
if (_this.$props.autosuggest) {
|
|
470
439
|
if (toggleIsOpen) {
|
|
471
440
|
_this.isOpen = false;
|
|
472
441
|
}
|
|
473
|
-
|
|
474
442
|
if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
|
|
475
443
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
476
444
|
// to set the query otherwise the value should reset
|
|
477
|
-
|
|
478
|
-
|
|
479
445
|
if (props.strictSelection) {
|
|
480
446
|
if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
|
|
481
447
|
_this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
|
|
@@ -489,33 +455,26 @@ var SearchBox = {
|
|
|
489
455
|
// debounce for handling text while typing
|
|
490
456
|
_this.handleTextChange(value, cause);
|
|
491
457
|
}
|
|
492
|
-
|
|
493
458
|
_this.$emit('valueChange', value);
|
|
494
|
-
|
|
495
459
|
_this.$emit('value-change', value);
|
|
496
460
|
};
|
|
497
|
-
|
|
498
461
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
499
462
|
},
|
|
500
463
|
triggerDefaultQuery: function triggerDefaultQuery(paramValue) {
|
|
501
464
|
if (!this.$props.autosuggest) {
|
|
502
465
|
return;
|
|
503
466
|
}
|
|
504
|
-
|
|
505
467
|
var value = typeof paramValue !== 'string' ? this.currentValue : paramValue;
|
|
506
468
|
var query = SearchBox.defaultQuery(value, this.$props);
|
|
507
|
-
|
|
508
469
|
if (this.defaultQuery) {
|
|
509
470
|
var defaultQueryToBeSet = this.defaultQuery(value, this.$props) || {};
|
|
510
|
-
|
|
511
471
|
if (defaultQueryToBeSet.query) {
|
|
512
472
|
query = defaultQueryToBeSet.query;
|
|
513
|
-
}
|
|
514
|
-
|
|
473
|
+
}
|
|
515
474
|
|
|
475
|
+
// Update calculated default query in store
|
|
516
476
|
updateDefaultQuery(this.$props.componentId, this.setDefaultQuery, this.$props, value);
|
|
517
477
|
}
|
|
518
|
-
|
|
519
478
|
this.updateQuery({
|
|
520
479
|
componentId: this.internalComponent,
|
|
521
480
|
query: query,
|
|
@@ -527,32 +486,25 @@ var SearchBox = {
|
|
|
527
486
|
if (categoryValue === void 0) {
|
|
528
487
|
categoryValue = undefined;
|
|
529
488
|
}
|
|
530
|
-
|
|
531
489
|
var _this$$props2 = this.$props,
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
490
|
+
customQuery = _this$$props2.customQuery,
|
|
491
|
+
filterLabel = _this$$props2.filterLabel,
|
|
492
|
+
showFilter = _this$$props2.showFilter,
|
|
493
|
+
URLParams = _this$$props2.URLParams;
|
|
536
494
|
var value = typeof paramValue !== 'string' ? this.$data.currentValue : paramValue;
|
|
537
|
-
|
|
538
495
|
if (this.$options.isTagsMode) {
|
|
539
496
|
value = paramValue;
|
|
540
497
|
}
|
|
541
|
-
|
|
542
498
|
var defaultQueryTobeSet = SearchBox.defaultQuery("" + value + (categoryValue ? " in " + categoryValue : ''), this.$props);
|
|
543
499
|
var query = defaultQueryTobeSet;
|
|
544
|
-
|
|
545
500
|
if (customQuery) {
|
|
546
501
|
var customQueryTobeSet = customQuery(value, this.$props);
|
|
547
502
|
var queryTobeSet = customQueryTobeSet.query;
|
|
548
|
-
|
|
549
503
|
if (queryTobeSet) {
|
|
550
504
|
query = queryTobeSet;
|
|
551
505
|
}
|
|
552
|
-
|
|
553
506
|
updateCustomQuery(this.$props.componentId, this.setCustomQuery, this.$props, value);
|
|
554
507
|
}
|
|
555
|
-
|
|
556
508
|
this.updateQuery({
|
|
557
509
|
componentId: this.$props.componentId,
|
|
558
510
|
query: query,
|
|
@@ -568,36 +520,31 @@ var SearchBox = {
|
|
|
568
520
|
if (this.$props.autosuggest) {
|
|
569
521
|
this.isOpen = true;
|
|
570
522
|
}
|
|
571
|
-
|
|
572
523
|
this.$emit('focus', event);
|
|
573
524
|
},
|
|
574
525
|
handleVoiceResults: function handleVoiceResults(_ref) {
|
|
575
526
|
var results = _ref.results;
|
|
576
|
-
|
|
577
527
|
if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
|
|
578
528
|
this.setValue(results[0][0].transcript.trim(), true);
|
|
579
529
|
}
|
|
580
530
|
},
|
|
581
531
|
triggerQuery: function triggerQuery(_ref2) {
|
|
582
532
|
var _ref2$isOpen = _ref2.isOpen,
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
533
|
+
isOpen = _ref2$isOpen === void 0 ? undefined : _ref2$isOpen,
|
|
534
|
+
_ref2$customQuery = _ref2.customQuery,
|
|
535
|
+
customQuery = _ref2$customQuery === void 0 ? true : _ref2$customQuery,
|
|
536
|
+
_ref2$defaultQuery = _ref2.defaultQuery,
|
|
537
|
+
defaultQuery = _ref2$defaultQuery === void 0 ? true : _ref2$defaultQuery,
|
|
538
|
+
_ref2$value = _ref2.value,
|
|
539
|
+
value = _ref2$value === void 0 ? undefined : _ref2$value,
|
|
540
|
+
_ref2$categoryValue = _ref2.categoryValue,
|
|
541
|
+
categoryValue = _ref2$categoryValue === void 0 ? undefined : _ref2$categoryValue;
|
|
593
542
|
if (typeof isOpen === 'boolean') {
|
|
594
543
|
this.isOpen = isOpen;
|
|
595
544
|
}
|
|
596
|
-
|
|
597
545
|
if (customQuery) {
|
|
598
546
|
this.triggerCustomQuery(value, categoryValue);
|
|
599
547
|
}
|
|
600
|
-
|
|
601
548
|
if (defaultQuery) {
|
|
602
549
|
this.triggerDefaultQuery(value);
|
|
603
550
|
}
|
|
@@ -605,17 +552,14 @@ var SearchBox = {
|
|
|
605
552
|
triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
|
|
606
553
|
// click analytics would only work client side and after javascript loads
|
|
607
554
|
var docId = documentId;
|
|
608
|
-
|
|
609
555
|
if (!docId) {
|
|
610
556
|
var hitData = this.normalizedSuggestions.find(function (hit) {
|
|
611
557
|
return hit._click_id === searchPosition;
|
|
612
558
|
});
|
|
613
|
-
|
|
614
559
|
if (hitData && hitData.source && hitData.source._id) {
|
|
615
560
|
docId = hitData.source._id;
|
|
616
561
|
}
|
|
617
562
|
}
|
|
618
|
-
|
|
619
563
|
this.recordSuggestionClick(searchPosition, docId);
|
|
620
564
|
},
|
|
621
565
|
clearValue: function clearValue() {
|
|
@@ -626,7 +570,6 @@ var SearchBox = {
|
|
|
626
570
|
if (highlightedIndex === void 0) {
|
|
627
571
|
highlightedIndex = null;
|
|
628
572
|
}
|
|
629
|
-
|
|
630
573
|
// if a suggestion was selected, delegate the handling to suggestion handler
|
|
631
574
|
if (event.key === 'Enter') {
|
|
632
575
|
if (this.$props.autosuggest === false) {
|
|
@@ -634,25 +577,22 @@ var SearchBox = {
|
|
|
634
577
|
} else if (highlightedIndex === null) {
|
|
635
578
|
this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
|
|
636
579
|
);
|
|
580
|
+
|
|
637
581
|
this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
|
|
638
582
|
}
|
|
639
|
-
}
|
|
640
|
-
|
|
583
|
+
}
|
|
641
584
|
|
|
585
|
+
// Need to review
|
|
642
586
|
this.$emit('keyDown', event, this.triggerQuery);
|
|
643
587
|
this.$emit('key-down', event, this.triggerQuery);
|
|
644
588
|
},
|
|
645
589
|
onInputChange: function onInputChange(e) {
|
|
646
590
|
var _this2 = this;
|
|
647
|
-
|
|
648
591
|
var inputValue = e.target.value;
|
|
649
|
-
|
|
650
592
|
if (!this.$data.isOpen && this.$props.autosuggest) {
|
|
651
593
|
this.isOpen = true;
|
|
652
594
|
}
|
|
653
|
-
|
|
654
595
|
var value = this.$props.value;
|
|
655
|
-
|
|
656
596
|
if (value === undefined) {
|
|
657
597
|
this.setValue(inputValue, false, this.$props, inputValue === '' ? causes.CLEAR_VALUE : undefined);
|
|
658
598
|
} else {
|
|
@@ -669,29 +609,23 @@ var SearchBox = {
|
|
|
669
609
|
},
|
|
670
610
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
671
611
|
var _this3 = this;
|
|
672
|
-
|
|
673
612
|
this.isOpen = false;
|
|
674
|
-
var value = this.$props.value;
|
|
675
|
-
|
|
613
|
+
var value = this.$props.value;
|
|
614
|
+
// Record analytics for selected suggestions
|
|
676
615
|
this.triggerClickAnalytics(suggestion._click_id);
|
|
677
|
-
|
|
678
616
|
if (value === undefined) {
|
|
679
617
|
this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
|
|
680
618
|
} else {
|
|
681
619
|
var emitValue = suggestion.value;
|
|
682
|
-
|
|
683
620
|
if (this.$options.isTagsMode) {
|
|
684
621
|
emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
|
|
685
|
-
|
|
686
622
|
if (this.selectedTags.includes(suggestion.value)) {
|
|
687
623
|
// avoid duplicates in tags array
|
|
688
624
|
this.isOpen = false;
|
|
689
625
|
return;
|
|
690
626
|
}
|
|
691
|
-
|
|
692
627
|
emitValue.push(suggestion.value);
|
|
693
628
|
}
|
|
694
|
-
|
|
695
629
|
this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
|
|
696
630
|
this.$emit('change', emitValue, function (_ref4) {
|
|
697
631
|
var isOpen = _ref4.isOpen;
|
|
@@ -703,18 +637,15 @@ var SearchBox = {
|
|
|
703
637
|
}));
|
|
704
638
|
});
|
|
705
639
|
}
|
|
706
|
-
|
|
707
640
|
this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
|
|
708
641
|
},
|
|
709
642
|
onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
|
|
710
643
|
if (currentValue === void 0) {
|
|
711
644
|
currentValue = this.$data.currentValue;
|
|
712
645
|
}
|
|
713
|
-
|
|
714
646
|
for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
715
647
|
cause[_key - 1] = arguments[_key];
|
|
716
648
|
}
|
|
717
|
-
|
|
718
649
|
this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
|
|
719
650
|
this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
|
|
720
651
|
},
|
|
@@ -724,26 +655,21 @@ var SearchBox = {
|
|
|
724
655
|
},
|
|
725
656
|
getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
|
|
726
657
|
var isDark = this.themePreset === 'dark';
|
|
727
|
-
|
|
728
658
|
if (isDark) {
|
|
729
659
|
return highlightedIndex === index ? '#555' : '#424242';
|
|
730
660
|
}
|
|
731
|
-
|
|
732
661
|
return highlightedIndex === index ? '#eee' : '#fff';
|
|
733
662
|
},
|
|
734
663
|
renderIcon: function renderIcon() {
|
|
735
664
|
var h = this.$createElement;
|
|
736
|
-
|
|
737
665
|
if (this.$props.showIcon) {
|
|
738
666
|
return this.$props.icon || h(SearchSvg);
|
|
739
667
|
}
|
|
740
|
-
|
|
741
668
|
return null;
|
|
742
669
|
},
|
|
743
670
|
renderErrorComponent: function renderErrorComponent() {
|
|
744
671
|
var h = this.$createElement;
|
|
745
672
|
var renderError = this.$scopedSlots.renderError || this.$props.renderError;
|
|
746
|
-
|
|
747
673
|
if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
|
|
748
674
|
return h(SuggestionWrapper, {
|
|
749
675
|
"attrs": {
|
|
@@ -754,33 +680,28 @@ var SearchBox = {
|
|
|
754
680
|
}
|
|
755
681
|
}, [isFunction(renderError) ? renderError(this.error) : renderError]);
|
|
756
682
|
}
|
|
757
|
-
|
|
758
683
|
return null;
|
|
759
684
|
},
|
|
760
685
|
renderCancelIcon: function renderCancelIcon() {
|
|
761
686
|
var h = this.$createElement;
|
|
762
|
-
|
|
763
687
|
if (this.$props.showClear) {
|
|
764
688
|
return this.$props.clearIcon || h(CancelSvg);
|
|
765
689
|
}
|
|
766
|
-
|
|
767
690
|
return null;
|
|
768
691
|
},
|
|
769
692
|
renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
|
|
770
693
|
if (finalSuggestionsList === void 0) {
|
|
771
694
|
finalSuggestionsList = [];
|
|
772
695
|
}
|
|
773
|
-
|
|
774
696
|
var h = this.$createElement;
|
|
775
697
|
var _this$$props3 = this.$props,
|
|
776
|
-
|
|
777
|
-
|
|
698
|
+
theme = _this$$props3.theme,
|
|
699
|
+
innerClass = _this$$props3.innerClass;
|
|
778
700
|
var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
|
|
779
701
|
var renderError = this.$scopedSlots.renderError || this.$props.renderError;
|
|
780
702
|
var _this$$data = this.$data,
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
703
|
+
isOpen = _this$$data.isOpen,
|
|
704
|
+
currentValue = _this$$data.currentValue;
|
|
784
705
|
if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
|
|
785
706
|
return h(SuggestionWrapper, {
|
|
786
707
|
"attrs": {
|
|
@@ -796,31 +717,26 @@ var SearchBox = {
|
|
|
796
717
|
}
|
|
797
718
|
});
|
|
798
719
|
}
|
|
799
|
-
|
|
800
720
|
return null;
|
|
801
721
|
},
|
|
802
722
|
renderInputAddonBefore: function renderInputAddonBefore() {
|
|
803
723
|
var h = this.$createElement;
|
|
804
724
|
var addonBefore = this.$scopedSlots.addonBefore;
|
|
805
|
-
|
|
806
725
|
if (addonBefore) {
|
|
807
726
|
return h(InputAddon, {
|
|
808
727
|
"class": "addon-before"
|
|
809
728
|
}, [addonBefore()]);
|
|
810
729
|
}
|
|
811
|
-
|
|
812
730
|
return null;
|
|
813
731
|
},
|
|
814
732
|
renderInputAddonAfter: function renderInputAddonAfter() {
|
|
815
733
|
var h = this.$createElement;
|
|
816
734
|
var addonAfter = this.$scopedSlots.addonAfter;
|
|
817
|
-
|
|
818
735
|
if (addonAfter) {
|
|
819
736
|
return h(InputAddon, {
|
|
820
737
|
"class": "addon-after"
|
|
821
738
|
}, [addonAfter()]);
|
|
822
739
|
}
|
|
823
|
-
|
|
824
740
|
return null;
|
|
825
741
|
},
|
|
826
742
|
enterButtonOnClick: function enterButtonOnClick() {
|
|
@@ -832,19 +748,16 @@ var SearchBox = {
|
|
|
832
748
|
},
|
|
833
749
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
834
750
|
var _this4 = this;
|
|
835
|
-
|
|
836
751
|
var h = this.$createElement;
|
|
837
752
|
var _this$$props4 = this.$props,
|
|
838
|
-
|
|
839
|
-
|
|
753
|
+
enterButton = _this$$props4.enterButton,
|
|
754
|
+
innerClass = _this$$props4.innerClass;
|
|
840
755
|
var renderEnterButton = this.$scopedSlots.renderEnterButton;
|
|
841
|
-
|
|
842
756
|
if (enterButton) {
|
|
843
757
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
844
758
|
if (renderEnterButton) {
|
|
845
759
|
return renderEnterButton(_this4.enterButtonOnClick);
|
|
846
760
|
}
|
|
847
|
-
|
|
848
761
|
return h(Button, {
|
|
849
762
|
"class": "enter-btn " + getClassName(innerClass, 'enter-button'),
|
|
850
763
|
"attrs": {
|
|
@@ -855,23 +768,21 @@ var SearchBox = {
|
|
|
855
768
|
}
|
|
856
769
|
}, ["Search"]);
|
|
857
770
|
};
|
|
858
|
-
|
|
859
771
|
return h("div", {
|
|
860
772
|
"class": "enter-button-wrapper"
|
|
861
773
|
}, [getEnterButtonMarkup()]);
|
|
862
774
|
}
|
|
863
|
-
|
|
864
775
|
return null;
|
|
865
776
|
},
|
|
866
777
|
renderIcons: function renderIcons() {
|
|
867
778
|
var h = this.$createElement;
|
|
868
779
|
var _this$$props5 = this.$props,
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
780
|
+
iconPosition = _this$$props5.iconPosition,
|
|
781
|
+
showClear = _this$$props5.showClear,
|
|
782
|
+
innerClass = _this$$props5.innerClass,
|
|
783
|
+
getMicInstance = _this$$props5.getMicInstance,
|
|
784
|
+
showVoiceSearch = _this$$props5.showVoiceSearch,
|
|
785
|
+
showIcon = _this$$props5.showIcon;
|
|
875
786
|
var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
|
|
876
787
|
var currentValue = this.$data.currentValue;
|
|
877
788
|
return h("div", [h(IconGroup, {
|
|
@@ -911,49 +822,41 @@ var SearchBox = {
|
|
|
911
822
|
},
|
|
912
823
|
focusSearchBox: function focusSearchBox(event) {
|
|
913
824
|
var _this$$refs, _this$$refs$this$$pro;
|
|
914
|
-
|
|
915
825
|
var elt = event.target || event.srcElement;
|
|
916
826
|
var tagName = elt.tagName;
|
|
917
|
-
|
|
918
827
|
if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
|
|
919
828
|
// already in an input
|
|
920
829
|
return;
|
|
921
830
|
}
|
|
922
|
-
|
|
923
831
|
(_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
|
|
924
832
|
},
|
|
925
833
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
926
834
|
var _this5 = this;
|
|
927
|
-
|
|
928
835
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
929
|
-
|
|
930
|
-
|
|
836
|
+
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
931
837
|
if (isEmpty(focusShortcuts)) {
|
|
932
838
|
return;
|
|
933
839
|
}
|
|
840
|
+
var shortcutsString = parseFocusShortcuts(focusShortcuts).join(',');
|
|
934
841
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
842
|
+
// handler for alphabets and other key combinations
|
|
843
|
+
hotkeys(shortcutsString,
|
|
844
|
+
// eslint-disable-next-line no-unused-vars
|
|
939
845
|
/* eslint-disable no-shadow */
|
|
940
846
|
function (event, handler) {
|
|
941
847
|
// Prevent the default refresh event under WINDOWS system
|
|
942
848
|
event.preventDefault();
|
|
943
|
-
|
|
944
849
|
_this5.focusSearchBox(event);
|
|
945
|
-
});
|
|
850
|
+
});
|
|
946
851
|
|
|
852
|
+
// if one of modifier keys are used, they are handled below
|
|
947
853
|
hotkeys('*', function (event) {
|
|
948
854
|
var modifierKeys = extractModifierKeysFromFocusShortcuts(focusShortcuts);
|
|
949
855
|
if (modifierKeys.length === 0) return;
|
|
950
|
-
|
|
951
856
|
for (var index = 0; index < modifierKeys.length; index += 1) {
|
|
952
857
|
var element = modifierKeys[index];
|
|
953
|
-
|
|
954
858
|
if (hotkeys[element]) {
|
|
955
859
|
_this5.focusSearchBox(event);
|
|
956
|
-
|
|
957
860
|
break;
|
|
958
861
|
}
|
|
959
862
|
}
|
|
@@ -967,17 +870,12 @@ var SearchBox = {
|
|
|
967
870
|
},
|
|
968
871
|
renderAutoFill: function renderAutoFill(suggestion) {
|
|
969
872
|
var _this6 = this;
|
|
970
|
-
|
|
971
873
|
var h = this.$createElement;
|
|
972
|
-
|
|
973
874
|
var handleAutoFillClick = function handleAutoFillClick(e) {
|
|
974
875
|
e.stopPropagation();
|
|
975
|
-
|
|
976
876
|
_this6.onAutofillClick(suggestion);
|
|
977
877
|
};
|
|
978
878
|
/* 👇 avoid showing autofill for category suggestions👇 */
|
|
979
|
-
|
|
980
|
-
|
|
981
879
|
return suggestion._category ? null : h(AutoFillSvg, {
|
|
982
880
|
"on": {
|
|
983
881
|
"click": handleAutoFillClick
|
|
@@ -986,7 +884,6 @@ var SearchBox = {
|
|
|
986
884
|
},
|
|
987
885
|
renderTag: function renderTag(item) {
|
|
988
886
|
var _this7 = this;
|
|
989
|
-
|
|
990
887
|
var h = this.$createElement;
|
|
991
888
|
var innerClass = this.$props.innerClass;
|
|
992
889
|
return h(TagItem, {
|
|
@@ -1007,7 +904,6 @@ var SearchBox = {
|
|
|
1007
904
|
clearAllTags: function clearAllTags() {
|
|
1008
905
|
this.selectedTags = [];
|
|
1009
906
|
this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
|
|
1010
|
-
|
|
1011
907
|
if (this.$props.value !== undefined) {
|
|
1012
908
|
this.$emit('change', this.selectedTags, this.triggerQuery);
|
|
1013
909
|
}
|
|
@@ -1017,20 +913,16 @@ var SearchBox = {
|
|
|
1017
913
|
return tag !== tagValue;
|
|
1018
914
|
}));
|
|
1019
915
|
this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
|
|
1020
|
-
|
|
1021
916
|
if (this.$props.value !== undefined) {
|
|
1022
917
|
this.$emit('change', this.selectedTags, this.triggerQuery);
|
|
1023
918
|
}
|
|
1024
919
|
},
|
|
1025
920
|
renderTags: function renderTags() {
|
|
1026
921
|
var _this8 = this;
|
|
1027
|
-
|
|
1028
922
|
var h = this.$createElement;
|
|
1029
|
-
|
|
1030
923
|
if (!Array.isArray(this.selectedTags)) {
|
|
1031
924
|
return null;
|
|
1032
925
|
}
|
|
1033
|
-
|
|
1034
926
|
var tagsList = [].concat(this.selectedTags);
|
|
1035
927
|
var shouldRenderClearAllTag = tagsList.length > 1;
|
|
1036
928
|
var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
|
|
@@ -1056,14 +948,13 @@ var SearchBox = {
|
|
|
1056
948
|
},
|
|
1057
949
|
render: function render() {
|
|
1058
950
|
var _this9 = this;
|
|
1059
|
-
|
|
1060
951
|
var h = arguments[0];
|
|
1061
952
|
var _this$$props6 = this.$props,
|
|
1062
|
-
|
|
1063
|
-
|
|
953
|
+
theme = _this$$props6.theme,
|
|
954
|
+
expandSuggestionsContainer = _this$$props6.expandSuggestionsContainer;
|
|
1064
955
|
var _this$$scopedSlots = this.$scopedSlots,
|
|
1065
|
-
|
|
1066
|
-
|
|
956
|
+
recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
|
|
957
|
+
popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
|
|
1067
958
|
var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
|
|
1068
959
|
var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
|
|
1069
960
|
return h(Container, {
|
|
@@ -1080,27 +971,23 @@ var SearchBox = {
|
|
|
1080
971
|
"scopedSlots": {
|
|
1081
972
|
"default": function _default(_ref5) {
|
|
1082
973
|
var getInputEvents = _ref5.getInputEvents,
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
974
|
+
getInputProps = _ref5.getInputProps,
|
|
975
|
+
getItemProps = _ref5.getItemProps,
|
|
976
|
+
getItemEvents = _ref5.getItemEvents,
|
|
977
|
+
isOpen = _ref5.isOpen,
|
|
978
|
+
highlightedIndex = _ref5.highlightedIndex,
|
|
979
|
+
setHighlightedIndex = _ref5.setHighlightedIndex;
|
|
1090
980
|
var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
|
|
1091
981
|
var getIcon = function getIcon(iconType) {
|
|
1092
982
|
switch (iconType) {
|
|
1093
983
|
case suggestionTypes.Recent:
|
|
1094
984
|
return recentSearchesIcon;
|
|
1095
|
-
|
|
1096
985
|
case suggestionTypes.Popular:
|
|
1097
986
|
return popularSearchesIcon;
|
|
1098
|
-
|
|
1099
987
|
default:
|
|
1100
988
|
return null;
|
|
1101
989
|
}
|
|
1102
990
|
};
|
|
1103
|
-
|
|
1104
991
|
return h("div", [_this9.hasCustomRenderer && _this9.getComponent({
|
|
1105
992
|
isOpen: isOpen,
|
|
1106
993
|
getItemProps: getItemProps,
|
|
@@ -1154,7 +1041,6 @@ var SearchBox = {
|
|
|
1154
1041
|
}), _this9.renderAutoFill(item)]);
|
|
1155
1042
|
})]) : _this9.renderNoSuggestions(_this9.normalizedSuggestions)]);
|
|
1156
1043
|
};
|
|
1157
|
-
|
|
1158
1044
|
return h("div", {
|
|
1159
1045
|
"class": suggestionsContainer
|
|
1160
1046
|
}, [h(InputGroup, [_this9.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
|
|
@@ -1178,7 +1064,6 @@ var SearchBox = {
|
|
|
1178
1064
|
onFocus: _this9.handleFocus,
|
|
1179
1065
|
onKeyPress: function onKeyPress(e) {
|
|
1180
1066
|
_this9.$emit('keyPress', e, _this9.triggerQuery);
|
|
1181
|
-
|
|
1182
1067
|
_this9.$emit('key-press', e, _this9.triggerQuery);
|
|
1183
1068
|
},
|
|
1184
1069
|
onKeyDown: function onKeyDown(e) {
|
|
@@ -1186,7 +1071,6 @@ var SearchBox = {
|
|
|
1186
1071
|
},
|
|
1187
1072
|
onKeyUp: function onKeyUp(e) {
|
|
1188
1073
|
_this9.$emit('keyUp', e, _this9.triggerQuery);
|
|
1189
|
-
|
|
1190
1074
|
_this9.$emit('key-up', e, _this9.triggerQuery);
|
|
1191
1075
|
},
|
|
1192
1076
|
onClick: function onClick() {
|
|
@@ -1216,7 +1100,6 @@ var SearchBox = {
|
|
|
1216
1100
|
},
|
|
1217
1101
|
keypress: function keypress(e) {
|
|
1218
1102
|
_this9.$emit('keyPress', e, _this9.triggerQuery);
|
|
1219
|
-
|
|
1220
1103
|
_this9.$emit('key-press', e, _this9.triggerQuery);
|
|
1221
1104
|
},
|
|
1222
1105
|
input: this.onInputChange,
|
|
@@ -1226,7 +1109,6 @@ var SearchBox = {
|
|
|
1226
1109
|
keydown: this.handleKeyDown,
|
|
1227
1110
|
keyup: function keyup(e) {
|
|
1228
1111
|
_this9.$emit('keyUp', e, _this9.triggerQuery);
|
|
1229
|
-
|
|
1230
1112
|
_this9.$emit('key-up', e, _this9.triggerQuery);
|
|
1231
1113
|
}
|
|
1232
1114
|
}),
|
|
@@ -1241,7 +1123,6 @@ var SearchBox = {
|
|
|
1241
1123
|
document.removeEventListener('keydown', this.onKeyDown);
|
|
1242
1124
|
}
|
|
1243
1125
|
};
|
|
1244
|
-
|
|
1245
1126
|
SearchBox.defaultQuery = function (value, props) {
|
|
1246
1127
|
var finalQuery = null;
|
|
1247
1128
|
var fields = normalizeDataField(props.dataField, props.fieldWeights);
|
|
@@ -1251,7 +1132,6 @@ SearchBox.defaultQuery = function (value, props) {
|
|
|
1251
1132
|
minimum_should_match: '1'
|
|
1252
1133
|
}
|
|
1253
1134
|
};
|
|
1254
|
-
|
|
1255
1135
|
if (finalQuery && props.nestedField) {
|
|
1256
1136
|
return {
|
|
1257
1137
|
query: {
|
|
@@ -1262,23 +1142,18 @@ SearchBox.defaultQuery = function (value, props) {
|
|
|
1262
1142
|
}
|
|
1263
1143
|
};
|
|
1264
1144
|
}
|
|
1265
|
-
|
|
1266
1145
|
return finalQuery;
|
|
1267
1146
|
};
|
|
1268
|
-
|
|
1269
1147
|
SearchBox.shouldQuery = function (value, dataFields, props) {
|
|
1270
1148
|
var finalQuery = [];
|
|
1271
1149
|
var phrasePrefixFields = [];
|
|
1272
1150
|
var fields = dataFields.map(function (dataField) {
|
|
1273
1151
|
var queryField = "" + dataField.field + (dataField.weight ? "^" + dataField.weight : '');
|
|
1274
|
-
|
|
1275
1152
|
if (!(dataField.field.endsWith('.keyword') || dataField.field.endsWith('.autosuggest') || dataField.field.endsWith('.search'))) {
|
|
1276
1153
|
phrasePrefixFields.push(queryField);
|
|
1277
1154
|
}
|
|
1278
|
-
|
|
1279
1155
|
return queryField;
|
|
1280
1156
|
});
|
|
1281
|
-
|
|
1282
1157
|
if (props.searchOperators || props.queryString) {
|
|
1283
1158
|
return {
|
|
1284
1159
|
query: value,
|
|
@@ -1286,7 +1161,6 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
|
|
|
1286
1161
|
default_operator: props.queryFormat
|
|
1287
1162
|
};
|
|
1288
1163
|
}
|
|
1289
|
-
|
|
1290
1164
|
if (props.queryFormat === 'and') {
|
|
1291
1165
|
finalQuery.push({
|
|
1292
1166
|
multi_match: {
|
|
@@ -1304,7 +1178,6 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
|
|
|
1304
1178
|
operator: 'and'
|
|
1305
1179
|
}
|
|
1306
1180
|
});
|
|
1307
|
-
|
|
1308
1181
|
if (phrasePrefixFields.length > 0) {
|
|
1309
1182
|
finalQuery.push({
|
|
1310
1183
|
multi_match: {
|
|
@@ -1315,10 +1188,8 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
|
|
|
1315
1188
|
}
|
|
1316
1189
|
});
|
|
1317
1190
|
}
|
|
1318
|
-
|
|
1319
1191
|
return finalQuery;
|
|
1320
1192
|
}
|
|
1321
|
-
|
|
1322
1193
|
finalQuery.push({
|
|
1323
1194
|
multi_match: {
|
|
1324
1195
|
query: value,
|
|
@@ -1336,7 +1207,6 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
|
|
|
1336
1207
|
operator: 'or'
|
|
1337
1208
|
}
|
|
1338
1209
|
});
|
|
1339
|
-
|
|
1340
1210
|
if (phrasePrefixFields.length > 0) {
|
|
1341
1211
|
finalQuery.push({
|
|
1342
1212
|
multi_match: {
|
|
@@ -1347,10 +1217,8 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
|
|
|
1347
1217
|
}
|
|
1348
1218
|
});
|
|
1349
1219
|
}
|
|
1350
|
-
|
|
1351
1220
|
return finalQuery;
|
|
1352
1221
|
};
|
|
1353
|
-
|
|
1354
1222
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
1355
1223
|
return {
|
|
1356
1224
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
@@ -1367,7 +1235,6 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
1367
1235
|
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
|
|
1368
1236
|
};
|
|
1369
1237
|
};
|
|
1370
|
-
|
|
1371
1238
|
var mapDispatchToProps = {
|
|
1372
1239
|
updateQuery: updateQuery,
|
|
1373
1240
|
setCustomQuery: setCustomQuery,
|
|
@@ -1378,25 +1245,23 @@ var SBConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps,
|
|
|
1378
1245
|
componentType: componentTypes.searchBox,
|
|
1379
1246
|
internalComponent: true
|
|
1380
1247
|
}));
|
|
1381
|
-
|
|
1382
1248
|
SearchBox.install = function (Vue) {
|
|
1383
1249
|
Vue.component(SearchBox.name, SBConnected);
|
|
1384
|
-
};
|
|
1385
|
-
|
|
1386
|
-
|
|
1250
|
+
};
|
|
1251
|
+
// Add componentType for SSR
|
|
1387
1252
|
SearchBox.componentType = componentTypes.searchBox;
|
|
1388
1253
|
|
|
1389
1254
|
var _excluded = ["options"];
|
|
1390
1255
|
var updateQuery$1 = Actions.updateQuery,
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1256
|
+
setQueryOptions = Actions.setQueryOptions,
|
|
1257
|
+
setCustomQuery$1 = Actions.setCustomQuery,
|
|
1258
|
+
setDefaultQuery$1 = Actions.setDefaultQuery;
|
|
1394
1259
|
var parseHits = helper.parseHits,
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1260
|
+
isEqual$1 = helper.isEqual,
|
|
1261
|
+
getCompositeAggsQuery$1 = helper.getCompositeAggsQuery,
|
|
1262
|
+
getResultStats$1 = helper.getResultStats,
|
|
1263
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
1264
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
1400
1265
|
var ReactiveComponent = {
|
|
1401
1266
|
name: 'ReactiveComponent',
|
|
1402
1267
|
props: {
|
|
@@ -1417,42 +1282,35 @@ var ReactiveComponent = {
|
|
|
1417
1282
|
},
|
|
1418
1283
|
created: function created() {
|
|
1419
1284
|
var _this = this;
|
|
1420
|
-
|
|
1421
1285
|
var props = this.$props;
|
|
1422
1286
|
this.internalComponent = null;
|
|
1423
|
-
this.$defaultQuery = null;
|
|
1424
|
-
|
|
1287
|
+
this.$defaultQuery = null;
|
|
1288
|
+
// Set custom query in store
|
|
1425
1289
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
|
|
1426
1290
|
var customQuery = props.customQuery,
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1291
|
+
componentId = props.componentId,
|
|
1292
|
+
filterLabel = props.filterLabel,
|
|
1293
|
+
showFilter = props.showFilter,
|
|
1294
|
+
URLParams = props.URLParams,
|
|
1295
|
+
distinctField = props.distinctField,
|
|
1296
|
+
distinctFieldConfig = props.distinctFieldConfig,
|
|
1297
|
+
index = props.index;
|
|
1435
1298
|
if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
|
|
1436
1299
|
console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
|
|
1437
1300
|
}
|
|
1438
|
-
|
|
1439
1301
|
if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
|
|
1440
1302
|
console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
1441
1303
|
}
|
|
1442
|
-
|
|
1443
1304
|
if (!this.enableAppbase && index) {
|
|
1444
1305
|
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
1445
1306
|
}
|
|
1446
|
-
|
|
1447
1307
|
if (customQuery) {
|
|
1448
1308
|
var calcCustomQuery = customQuery(this.selectedValue, props);
|
|
1449
1309
|
var query = extractQueryFromCustomQuery(calcCustomQuery);
|
|
1450
1310
|
var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
|
|
1451
|
-
|
|
1452
1311
|
if (customQueryOptions) {
|
|
1453
1312
|
this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
|
|
1454
1313
|
} else this.setQueryOptions(componentId, this.getAggsQuery(), false);
|
|
1455
|
-
|
|
1456
1314
|
this.updateQuery({
|
|
1457
1315
|
componentId: componentId,
|
|
1458
1316
|
query: query,
|
|
@@ -1462,34 +1320,28 @@ var ReactiveComponent = {
|
|
|
1462
1320
|
URLParams: URLParams
|
|
1463
1321
|
});
|
|
1464
1322
|
}
|
|
1465
|
-
|
|
1466
1323
|
this.setQuery = function (_ref) {
|
|
1467
1324
|
var options = _ref.options,
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
|
|
1325
|
+
obj = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1326
|
+
var queryToBeSet = obj.query;
|
|
1471
1327
|
|
|
1328
|
+
// when enableAppbase is true, Backend throws error because of repeated query in request body
|
|
1472
1329
|
if (queryToBeSet && queryToBeSet.query) {
|
|
1473
1330
|
queryToBeSet = queryToBeSet.query;
|
|
1474
1331
|
}
|
|
1475
|
-
|
|
1476
1332
|
var customQueryCalc = _extends({}, options, {
|
|
1477
1333
|
query: queryToBeSet
|
|
1478
1334
|
});
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1335
|
+
var rsAPIQuery = customQueryCalc;
|
|
1336
|
+
// handle stored queries
|
|
1482
1337
|
if (queryToBeSet && queryToBeSet.id) {
|
|
1483
1338
|
rsAPIQuery = queryToBeSet;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1339
|
+
}
|
|
1340
|
+
// Update customQuery field for RS API
|
|
1487
1341
|
_this.setCustomQuery(props.componentId, rsAPIQuery);
|
|
1488
|
-
|
|
1489
1342
|
if (options) {
|
|
1490
1343
|
_this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
|
|
1491
1344
|
}
|
|
1492
|
-
|
|
1493
1345
|
_this.updateQuery(_extends({}, obj, {
|
|
1494
1346
|
query: customQueryCalc.query,
|
|
1495
1347
|
componentId: props.componentId,
|
|
@@ -1498,23 +1350,17 @@ var ReactiveComponent = {
|
|
|
1498
1350
|
URLParams: props.URLParams
|
|
1499
1351
|
}));
|
|
1500
1352
|
};
|
|
1501
|
-
|
|
1502
1353
|
if (props.defaultQuery) {
|
|
1503
1354
|
this.internalComponent = props.componentId + "__internal";
|
|
1504
1355
|
}
|
|
1505
|
-
|
|
1506
1356
|
if (this.internalComponent && this.$props.defaultQuery) {
|
|
1507
1357
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
|
|
1508
1358
|
this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
|
|
1509
|
-
|
|
1510
1359
|
var _query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
1511
|
-
|
|
1512
1360
|
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
1513
|
-
|
|
1514
1361
|
if (queryOptions) {
|
|
1515
1362
|
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
|
|
1516
1363
|
} else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
|
|
1517
|
-
|
|
1518
1364
|
this.updateQuery({
|
|
1519
1365
|
componentId: this.internalComponent,
|
|
1520
1366
|
query: _query
|
|
@@ -1567,12 +1413,10 @@ var ReactiveComponent = {
|
|
|
1567
1413
|
this.$defaultQuery = newVal(this.selectedValue, this.$props);
|
|
1568
1414
|
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
1569
1415
|
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
1570
|
-
|
|
1571
1416
|
if (queryOptions) {
|
|
1572
1417
|
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
|
|
1573
|
-
} else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
|
|
1574
|
-
|
|
1575
|
-
|
|
1418
|
+
} else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
|
|
1419
|
+
// Update default query for RS API
|
|
1576
1420
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
|
|
1577
1421
|
this.updateQuery({
|
|
1578
1422
|
componentId: this.internalComponent,
|
|
@@ -1586,12 +1430,11 @@ var ReactiveComponent = {
|
|
|
1586
1430
|
this.$customQuery = newVal(this.selectedValue, this.$props);
|
|
1587
1431
|
var query = extractQueryFromCustomQuery(this.$customQuery);
|
|
1588
1432
|
var queryOptions = getOptionsForCustomQuery(this.$customQuery);
|
|
1589
|
-
|
|
1590
1433
|
if (queryOptions) {
|
|
1591
1434
|
this.setQueryOptions(componentId, _extends({}, queryOptions, this.getAggsQuery()), false);
|
|
1592
|
-
} else this.setQueryOptions(componentId, this.getAggsQuery(), false);
|
|
1593
|
-
|
|
1435
|
+
} else this.setQueryOptions(componentId, this.getAggsQuery(), false);
|
|
1594
1436
|
|
|
1437
|
+
// Update custom query for RS API
|
|
1595
1438
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
|
|
1596
1439
|
this.updateQuery({
|
|
1597
1440
|
componentId: componentId,
|
|
@@ -1602,13 +1445,11 @@ var ReactiveComponent = {
|
|
|
1602
1445
|
},
|
|
1603
1446
|
render: function render() {
|
|
1604
1447
|
var h = arguments[0];
|
|
1605
|
-
|
|
1606
1448
|
try {
|
|
1607
1449
|
var dom = this.$scopedSlots["default"];
|
|
1608
1450
|
var error = this.error,
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1451
|
+
isLoading = this.isLoading,
|
|
1452
|
+
selectedValue = this.selectedValue;
|
|
1612
1453
|
var propsToBePassed = _extends({
|
|
1613
1454
|
error: error,
|
|
1614
1455
|
loading: isLoading
|
|
@@ -1616,7 +1457,6 @@ var ReactiveComponent = {
|
|
|
1616
1457
|
value: selectedValue,
|
|
1617
1458
|
setQuery: this.setQuery
|
|
1618
1459
|
});
|
|
1619
|
-
|
|
1620
1460
|
return h("div", [dom(propsToBePassed)]);
|
|
1621
1461
|
} catch (e) {
|
|
1622
1462
|
return null;
|
|
@@ -1633,31 +1473,26 @@ var ReactiveComponent = {
|
|
|
1633
1473
|
}).aggs
|
|
1634
1474
|
};
|
|
1635
1475
|
}
|
|
1636
|
-
|
|
1637
1476
|
return {};
|
|
1638
1477
|
},
|
|
1639
1478
|
getData: function getData() {
|
|
1640
1479
|
var hits = this.hits,
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1480
|
+
aggregations = this.aggregations,
|
|
1481
|
+
aggregationData = this.aggregationData,
|
|
1482
|
+
promotedResults = this.promotedResults,
|
|
1483
|
+
rawData = this.rawData;
|
|
1645
1484
|
var filteredResults = parseHits(hits);
|
|
1646
|
-
|
|
1647
1485
|
if (promotedResults.length) {
|
|
1648
1486
|
var ids = promotedResults.map(function (item) {
|
|
1649
1487
|
return item._id;
|
|
1650
1488
|
}).filter(Boolean);
|
|
1651
|
-
|
|
1652
1489
|
if (ids) {
|
|
1653
1490
|
filteredResults = filteredResults.filter(function (item) {
|
|
1654
1491
|
return !ids.includes(item._id);
|
|
1655
1492
|
});
|
|
1656
1493
|
}
|
|
1657
|
-
|
|
1658
1494
|
filteredResults = [].concat(promotedResults, filteredResults);
|
|
1659
1495
|
}
|
|
1660
|
-
|
|
1661
1496
|
return {
|
|
1662
1497
|
data: filteredResults,
|
|
1663
1498
|
aggregationData: aggregationData,
|
|
@@ -1674,11 +1509,9 @@ var ReactiveComponent = {
|
|
|
1674
1509
|
}
|
|
1675
1510
|
}
|
|
1676
1511
|
};
|
|
1677
|
-
|
|
1678
1512
|
ReactiveComponent.hasInternalComponent = function (props) {
|
|
1679
1513
|
return !!props.defaultQuery;
|
|
1680
1514
|
};
|
|
1681
|
-
|
|
1682
1515
|
var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
1683
1516
|
return {
|
|
1684
1517
|
aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
|
|
@@ -1696,7 +1529,6 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
|
1696
1529
|
enableAppbase: state.config.enableAppbase
|
|
1697
1530
|
};
|
|
1698
1531
|
};
|
|
1699
|
-
|
|
1700
1532
|
var mapDispatchtoProps = {
|
|
1701
1533
|
setQueryOptions: setQueryOptions,
|
|
1702
1534
|
updateQuery: updateQuery$1,
|
|
@@ -1710,64 +1542,50 @@ var RcConnected = PreferencesConsumer({
|
|
|
1710
1542
|
name: 'RcConnected',
|
|
1711
1543
|
render: function render(h) {
|
|
1712
1544
|
var component = ConnectedComponent;
|
|
1713
|
-
|
|
1714
1545
|
switch (this.$attrs.componentType) {
|
|
1715
1546
|
case componentTypes.reactiveList:
|
|
1716
1547
|
component = RLConnected;
|
|
1717
1548
|
break;
|
|
1718
|
-
|
|
1719
1549
|
case componentTypes.dataSearch:
|
|
1720
1550
|
component = DSConnected;
|
|
1721
1551
|
break;
|
|
1722
|
-
|
|
1723
1552
|
case componentTypes.searchBox:
|
|
1724
1553
|
component = SBConnected;
|
|
1725
1554
|
break;
|
|
1726
1555
|
// list components
|
|
1727
|
-
|
|
1728
1556
|
case componentTypes.singleList:
|
|
1729
1557
|
component = ListConnected$4;
|
|
1730
1558
|
break;
|
|
1731
|
-
|
|
1732
1559
|
case componentTypes.multiList:
|
|
1733
1560
|
component = ListConnected$3;
|
|
1734
1561
|
break;
|
|
1735
|
-
|
|
1736
1562
|
case componentTypes.singleDropdownList:
|
|
1737
1563
|
component = ListConnected$2;
|
|
1738
1564
|
break;
|
|
1739
|
-
|
|
1740
1565
|
case componentTypes.multiDropdownList:
|
|
1741
1566
|
component = ListConnected$1;
|
|
1742
1567
|
break;
|
|
1743
1568
|
// basic components
|
|
1744
|
-
|
|
1745
1569
|
case componentTypes.toggleButton:
|
|
1746
1570
|
component = ListConnected;
|
|
1747
1571
|
break;
|
|
1748
1572
|
// range components
|
|
1749
|
-
|
|
1750
1573
|
case componentTypes.dynamicRangeSlider:
|
|
1751
1574
|
component = RangeConnected$4;
|
|
1752
1575
|
break;
|
|
1753
|
-
|
|
1754
1576
|
case componentTypes.singleRange:
|
|
1755
1577
|
component = RangeConnected$3;
|
|
1756
1578
|
break;
|
|
1757
|
-
|
|
1758
1579
|
case componentTypes.multiRange:
|
|
1759
1580
|
component = RangeConnected$2;
|
|
1760
1581
|
break;
|
|
1761
|
-
|
|
1762
1582
|
case componentTypes.rangeSlider:
|
|
1763
1583
|
component = RangeConnected$1;
|
|
1764
1584
|
break;
|
|
1765
|
-
|
|
1766
1585
|
case componentTypes.rangeInput:
|
|
1767
1586
|
component = RangeConnected;
|
|
1768
1587
|
break;
|
|
1769
1588
|
}
|
|
1770
|
-
|
|
1771
1589
|
return h(component, {
|
|
1772
1590
|
attrs: this.$attrs,
|
|
1773
1591
|
on: this.$listeners,
|
|
@@ -1776,12 +1594,11 @@ var RcConnected = PreferencesConsumer({
|
|
|
1776
1594
|
});
|
|
1777
1595
|
}
|
|
1778
1596
|
});
|
|
1779
|
-
|
|
1780
1597
|
ReactiveComponent.install = function (Vue) {
|
|
1781
1598
|
Vue.component(ReactiveComponent.name, RcConnected);
|
|
1782
|
-
};
|
|
1783
|
-
|
|
1599
|
+
};
|
|
1784
1600
|
|
|
1601
|
+
// Add componentType for SSR
|
|
1785
1602
|
ReactiveComponent.componentType = componentTypes.reactiveComponent;
|
|
1786
1603
|
|
|
1787
1604
|
export { ReactiveComponent as R, SearchBox as S };
|