@appbaseio/reactivesearch-vue 1.33.1 → 1.33.3
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 +2888 -6530
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +7 -9
- 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-c42d8681.js → DataSearch-e4822dbf.js} +131 -299
- 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 +27 -53
- package/dist/cjs/{Pagination-3d73e1b3.js → Pagination-07f4dbad.js} +10 -30
- package/dist/cjs/{PreferencesConsumer-4707bd94.js → PreferencesConsumer-5d67b486.js} +8 -18
- package/dist/cjs/RangeInput.js +36 -52
- package/dist/cjs/RangeSlider.js +24 -48
- package/dist/cjs/ReactiveBase.js +66 -81
- package/dist/cjs/{ReactiveComponent-63ef70c2.js → ReactiveComponent-b8efb0cf.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 +28 -32
- 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 +21 -22
- package/dist/cjs/initReactivesearch.js +49 -120
- package/dist/cjs/install.js +21 -21
- 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-d56bf07a.js → DataSearch-5ddfba23.js} +131 -299
- 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 +27 -53
- package/dist/es/{Pagination-af9de08f.js → Pagination-28e56c5c.js} +10 -30
- package/dist/es/{PreferencesConsumer-4169deb1.js → PreferencesConsumer-bc097ebb.js} +8 -18
- package/dist/es/RangeInput.js +36 -52
- package/dist/es/RangeSlider.js +24 -48
- package/dist/es/ReactiveBase.js +66 -81
- package/dist/es/{ReactiveComponent-9e4721e1.js → ReactiveComponent-59107264.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 +29 -33
- 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 +21 -22
- package/dist/es/initReactivesearch.js +49 -120
- package/dist/es/install.js +21 -21
- 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 +3 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { helper, Actions, causes } from '@appbaseio/reactivecore';
|
|
2
2
|
import { SEARCH_COMPONENTS_MODES, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-
|
|
3
|
+
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
4
4
|
import VueTypes from 'vue-types';
|
|
5
5
|
import { getQueryOptions } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
6
6
|
import styled, { css, cx, injectGlobal } from '@appbaseio/vue-emotion';
|
|
7
|
-
import { t as types } from './vueTypes-
|
|
8
|
-
import { g as getComponent, h as hasCustomRenderer, f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, j as getQuerySuggestionsComponent, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, m as hasQuerySuggestionsRenderer, c as connect } from './index-
|
|
9
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
10
|
-
import { P as PreferencesConsumer } from './PreferencesConsumer-
|
|
11
|
-
import { T as Title } from './Title-
|
|
12
|
-
import { F as Flex } from './Flex-
|
|
7
|
+
import { t as types } from './vueTypes-8986b709.js';
|
|
8
|
+
import { g as getComponent, h as hasCustomRenderer, f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, j as getQuerySuggestionsComponent, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, m as hasQuerySuggestionsRenderer, c as connect } from './index-0444a498.js';
|
|
9
|
+
import { C as ComponentWrapper } from './ComponentWrapper-240450cc.js';
|
|
10
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
|
|
11
|
+
import { T as Title } from './Title-863dfa42.js';
|
|
12
|
+
import { F as Flex } from './Flex-7c177a10.js';
|
|
13
13
|
import hotkeys from 'hotkeys-js';
|
|
14
|
-
import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './CancelSvg-
|
|
15
|
-
import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-
|
|
16
|
-
import { C as Container } from './Container-
|
|
14
|
+
import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './CancelSvg-e40552a5.js';
|
|
15
|
+
import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-c09c0b56.js';
|
|
16
|
+
import { C as Container } from './Container-d00219f7.js';
|
|
17
17
|
import Highlight from 'vue-highlight-words';
|
|
18
18
|
|
|
19
19
|
var _templateObject;
|
|
@@ -39,9 +39,9 @@ var SuggestionWrapper = {
|
|
|
39
39
|
render: function render() {
|
|
40
40
|
var h = arguments[0];
|
|
41
41
|
var _this$$props = this.$props,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
themePreset = _this$$props.themePreset,
|
|
43
|
+
innerClass = _this$$props.innerClass,
|
|
44
|
+
innerClassName = _this$$props.innerClassName;
|
|
45
45
|
return h("div", {
|
|
46
46
|
"class": noSuggestions(themePreset) + " " + getClassName(innerClass, innerClassName || '')
|
|
47
47
|
}, [h("li", [this.$scopedSlots["default"]()])]);
|
|
@@ -65,20 +65,20 @@ var SuggestionItem = {
|
|
|
65
65
|
render: function render() {
|
|
66
66
|
var h = arguments[0];
|
|
67
67
|
var _this$suggestion = this.suggestion,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
label = _this$suggestion.label,
|
|
69
|
+
value = _this$suggestion.value,
|
|
70
|
+
title = _this$suggestion.title,
|
|
71
|
+
description = _this$suggestion.description,
|
|
72
|
+
image = _this$suggestion.image,
|
|
73
|
+
isPredictiveSuggestion = _this$suggestion.isPredictiveSuggestion,
|
|
74
|
+
_suggestion_type = _this$suggestion._suggestion_type,
|
|
75
|
+
_category = _this$suggestion._category;
|
|
77
76
|
if (label) {
|
|
78
77
|
// label has highest precedence
|
|
79
78
|
return typeof label === 'string' ? h("div", {
|
|
80
79
|
"class": "trim"
|
|
81
|
-
}, [(_category ? false : isPredictiveSuggestion
|
|
80
|
+
}, [(_category ? false : isPredictiveSuggestion
|
|
81
|
+
// eslint-disable-next-line
|
|
82
82
|
|| !!_suggestion_type) ? h(PredictiveSuggestion, {
|
|
83
83
|
"domProps": {
|
|
84
84
|
"innerHTML": label
|
|
@@ -92,7 +92,6 @@ var SuggestionItem = {
|
|
|
92
92
|
}
|
|
93
93
|
})]) : label;
|
|
94
94
|
}
|
|
95
|
-
|
|
96
95
|
if (title || image || description) {
|
|
97
96
|
return h(Flex, {
|
|
98
97
|
"attrs": {
|
|
@@ -148,7 +147,6 @@ var SuggestionItem = {
|
|
|
148
147
|
}
|
|
149
148
|
})])])]);
|
|
150
149
|
}
|
|
151
|
-
|
|
152
150
|
return value;
|
|
153
151
|
}
|
|
154
152
|
};
|
|
@@ -180,6 +178,7 @@ var SearchSvg = {
|
|
|
180
178
|
|
|
181
179
|
var _templateObject$3;
|
|
182
180
|
|
|
181
|
+
// eslint-disable-next-line
|
|
183
182
|
injectGlobal(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n\t#el_TvxDfTAtKp {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_D93PK3GbmJ {\n\t\t-webkit-transform: translate(163px, 131px);\n\t\ttransform: translate(163px, 131px);\n\t\tfill: #d8d8d8;\n\t}\n"])));
|
|
184
183
|
var MicSvg = {
|
|
185
184
|
name: 'MicSvg',
|
|
@@ -227,6 +226,7 @@ var MicSvg = {
|
|
|
227
226
|
|
|
228
227
|
var _templateObject$4;
|
|
229
228
|
|
|
229
|
+
// eslint-disable-next-line
|
|
230
230
|
injectGlobal(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n\t#el_X81iT9kZYo {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_gMpyalCphp {\n\t\t-webkit-transform: translate(163px, 131px);\n\t\ttransform: translate(163px, 131px);\n\t}\n\t#el_c7H-3u-D4l {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_qhFcdAAFwo {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_M8X8g37WOI {\n\t\tstroke: #e83137;\n\t\tstroke-width: 21;\n\t}\n"])));
|
|
231
231
|
var MuteSvg = {
|
|
232
232
|
name: 'MuteSvg',
|
|
@@ -285,6 +285,7 @@ var MuteSvg = {
|
|
|
285
285
|
|
|
286
286
|
var _templateObject$5;
|
|
287
287
|
|
|
288
|
+
// eslint-disable-next-line
|
|
288
289
|
injectGlobal(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n\t@-webkit-keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t13.89% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t13.89% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t27.78% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t27.78% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t41.67% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t41.67% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t55.56% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t55.56% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t69.44% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t69.44% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t83.33% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t83.33% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t97.22% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t97.22% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t#el_hiibMG0x- * {\n\t\t-webkit-animation-duration: 1.2s;\n\t\tanimation-duration: 1.2s;\n\t\t-webkit-animation-iteration-count: infinite;\n\t\tanimation-iteration-count: infinite;\n\t\t-webkit-animation-timing-function: cubic-bezier(0, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0, 0, 1, 1);\n\t}\n\t#el_QJeJ_2CDw5 {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_UYYCfubTRf {\n\t\t-webkit-transform: translate(163px, 123px);\n\t\ttransform: translate(163px, 123px);\n\t}\n\t#el_uzZNtK32Zi {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_EYKQ2N9Kgy {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_6SDP2LAgKC {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t}\n\t#el_-Vm65Ltfy7 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_q04iZcSim4 {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_6WKby7wXqV {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n\t\tanimation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_9bggsfQOtU {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_NKxqi9eIym {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_Wi-my975tM {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n\t\tanimation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_zclQ34fvf7 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_1OsvRT8HkeZ {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_DkfFFTaFxy8 {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n\t\tanimation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_aa9sjx4H0vA {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_tea114vWg0J {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_34IgwiMB5rf {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n\t\tanimation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_z5u6RAFhx7d {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_7nfuWmA5Uhy {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_DeebuCsPTGA {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n\t\tanimation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el__ZcqlS20zcw {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_8DnEQnD7VWV {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_ZOjjrPTvyrv {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n\t\tanimation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_FYYKCI_u24e {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_XZty4MnTp5Y {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_2FATegVmf0K {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n\t\tanimation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_RMT1KUfbdF8 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_RgLcovvFiO1 {\n\t\tfill: #d8d8d8;\n\t}\n"])));
|
|
289
290
|
var ListenSvg = {
|
|
290
291
|
name: 'ListenSvg',
|
|
@@ -635,90 +636,71 @@ var Mic = {
|
|
|
635
636
|
},
|
|
636
637
|
handleClick: function handleClick() {
|
|
637
638
|
var _this = this;
|
|
638
|
-
|
|
639
639
|
this.results = [];
|
|
640
|
-
|
|
641
640
|
if (window && window.SpeechRecognition) {
|
|
642
641
|
var status = this.$data.status;
|
|
643
|
-
|
|
644
642
|
if (status === STATUS.active) {
|
|
645
643
|
this.status = STATUS.inactive;
|
|
646
644
|
}
|
|
647
|
-
|
|
648
645
|
var _this$$props = this.$props,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
646
|
+
handleResult = _this$$props.handleResult,
|
|
647
|
+
onNoMatch = _this$$props.onNoMatch,
|
|
648
|
+
onError = _this$$props.onError,
|
|
649
|
+
lang = _this$$props.lang,
|
|
650
|
+
getInstance = _this$$props.getInstance;
|
|
654
651
|
var _window = window,
|
|
655
|
-
|
|
656
|
-
|
|
652
|
+
SpeechRecognition = _window.SpeechRecognition;
|
|
657
653
|
if (this.instance && this.status !== STATUS.denied) {
|
|
658
654
|
this.status = STATUS.inactive;
|
|
659
655
|
this.instance.stop();
|
|
660
656
|
this.instance = null;
|
|
661
657
|
return;
|
|
662
658
|
}
|
|
663
|
-
|
|
664
659
|
this.instance = new SpeechRecognition();
|
|
665
660
|
this.instance.continuous = true;
|
|
666
661
|
this.instance.interimResults = true;
|
|
667
662
|
this.instance.lang = lang;
|
|
668
|
-
|
|
669
663
|
if (getInstance) {
|
|
670
664
|
getInstance(this.instance);
|
|
671
665
|
}
|
|
672
|
-
|
|
673
666
|
this.instance.start();
|
|
674
|
-
|
|
675
667
|
this.instance.onstart = function () {
|
|
676
668
|
_this.status = STATUS.active;
|
|
677
669
|
};
|
|
678
|
-
|
|
679
670
|
this.instance.onresult = function (_ref) {
|
|
680
671
|
var results = _ref.results,
|
|
681
|
-
|
|
682
|
-
|
|
672
|
+
timeStamp = _ref.timeStamp;
|
|
683
673
|
_this.stopMic();
|
|
684
|
-
|
|
685
674
|
if (handleResult) {
|
|
686
675
|
handleResult({
|
|
687
676
|
results: results,
|
|
688
677
|
timeStamp: timeStamp
|
|
689
678
|
});
|
|
690
679
|
}
|
|
691
|
-
|
|
692
680
|
_this.results.push({
|
|
693
681
|
results: results,
|
|
694
682
|
timeStamp: timeStamp
|
|
695
683
|
});
|
|
696
684
|
};
|
|
697
|
-
|
|
698
685
|
this.instance.onnomatch = function (e) {
|
|
699
686
|
return onNoMatch ? onNoMatch(e) : console.warn(e);
|
|
700
687
|
};
|
|
701
|
-
|
|
702
688
|
this.instance.onerror = function (e) {
|
|
703
689
|
if (e.error === 'no-speech' || e.error === 'audio-capture') {
|
|
704
690
|
_this.status = STATUS.inactive;
|
|
705
691
|
} else if (e.error === 'not-allowed') {
|
|
706
692
|
_this.status = STATUS.denied;
|
|
707
693
|
}
|
|
708
|
-
|
|
709
694
|
console.error(e);
|
|
710
|
-
|
|
711
695
|
if (onError) {
|
|
712
696
|
onError(e);
|
|
713
697
|
}
|
|
714
698
|
};
|
|
715
|
-
/* Below Two methods run when Continuous is False */
|
|
716
|
-
|
|
717
699
|
|
|
700
|
+
/* Below Two methods run when Continuous is False */
|
|
718
701
|
this.instance.onspeechend = function () {
|
|
719
702
|
_this.status = STATUS.inactive;
|
|
720
703
|
};
|
|
721
|
-
|
|
722
704
|
this.instance.onaudioend = function () {
|
|
723
705
|
_this.status = STATUS.inactive;
|
|
724
706
|
};
|
|
@@ -733,7 +715,6 @@ var Mic = {
|
|
|
733
715
|
var h = this.$createElement;
|
|
734
716
|
var status = this.$data.status;
|
|
735
717
|
var className = this.$props.className;
|
|
736
|
-
|
|
737
718
|
switch (status) {
|
|
738
719
|
case STATUS.active:
|
|
739
720
|
return h(ListenSvg, {
|
|
@@ -744,7 +725,6 @@ var Mic = {
|
|
|
744
725
|
"click": this.handleClick
|
|
745
726
|
}
|
|
746
727
|
});
|
|
747
|
-
|
|
748
728
|
case STATUS.stopped:
|
|
749
729
|
case STATUS.denied:
|
|
750
730
|
return h(MuteSvg, {
|
|
@@ -755,7 +735,6 @@ var Mic = {
|
|
|
755
735
|
"click": this.handleClick
|
|
756
736
|
}
|
|
757
737
|
});
|
|
758
|
-
|
|
759
738
|
default:
|
|
760
739
|
return h(MicSvg, {
|
|
761
740
|
"attrs": {
|
|
@@ -775,10 +754,8 @@ var Mic = {
|
|
|
775
754
|
},
|
|
776
755
|
created: function created() {
|
|
777
756
|
this.results = [];
|
|
778
|
-
|
|
779
757
|
if (typeof window !== 'undefined') {
|
|
780
758
|
window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition || null;
|
|
781
|
-
|
|
782
759
|
if (!window.SpeechRecognition) {
|
|
783
760
|
console.error('SpeechRecognition is not supported in this browser. Please check the browser compatibility at https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition#Browser_compatibility.');
|
|
784
761
|
}
|
|
@@ -786,11 +763,9 @@ var Mic = {
|
|
|
786
763
|
},
|
|
787
764
|
render: function render() {
|
|
788
765
|
var h = arguments[0];
|
|
789
|
-
|
|
790
766
|
if (this.hasCustomRenderer) {
|
|
791
767
|
return this.getComponent();
|
|
792
768
|
}
|
|
793
|
-
|
|
794
769
|
return h(IconWrapper, [this.Icon]);
|
|
795
770
|
}
|
|
796
771
|
};
|
|
@@ -809,13 +784,11 @@ var CustomSvg = {
|
|
|
809
784
|
},
|
|
810
785
|
render: function render() {
|
|
811
786
|
var h = arguments[0];
|
|
812
|
-
|
|
813
787
|
if (this.customIcon) {
|
|
814
788
|
return h("div", {
|
|
815
789
|
"class": this.$props.className
|
|
816
790
|
}, [this.customIcon]);
|
|
817
791
|
}
|
|
818
|
-
|
|
819
792
|
if (this.$props.type === 'recent-search-icon') {
|
|
820
793
|
return h("svg", {
|
|
821
794
|
"attrs": {
|
|
@@ -840,7 +813,6 @@ var CustomSvg = {
|
|
|
840
813
|
}
|
|
841
814
|
})]);
|
|
842
815
|
}
|
|
843
|
-
|
|
844
816
|
if (this.$props.type === 'promoted-search-icon') {
|
|
845
817
|
return h("svg", {
|
|
846
818
|
"attrs": {
|
|
@@ -860,7 +832,6 @@ var CustomSvg = {
|
|
|
860
832
|
}
|
|
861
833
|
})]);
|
|
862
834
|
}
|
|
863
|
-
|
|
864
835
|
if (this.$props.type === 'popular-search-icon') {
|
|
865
836
|
return h("svg", {
|
|
866
837
|
"attrs": {
|
|
@@ -885,7 +856,6 @@ var CustomSvg = {
|
|
|
885
856
|
}
|
|
886
857
|
})]);
|
|
887
858
|
}
|
|
888
|
-
|
|
889
859
|
return h(SearchSvg, {
|
|
890
860
|
"attrs": {
|
|
891
861
|
"styles": {
|
|
@@ -904,26 +874,26 @@ var TagsContainer = styled('div')(_templateObject$6 || (_templateObject$6 = _tag
|
|
|
904
874
|
var TagItem = styled('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
|
|
905
875
|
|
|
906
876
|
var updateQuery = Actions.updateQuery,
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
877
|
+
setQueryOptions = Actions.setQueryOptions,
|
|
878
|
+
setCustomQuery = Actions.setCustomQuery,
|
|
879
|
+
setDefaultQuery = Actions.setDefaultQuery,
|
|
880
|
+
setCustomHighlightOptions = Actions.setCustomHighlightOptions,
|
|
881
|
+
recordSuggestionClick = Actions.recordSuggestionClick,
|
|
882
|
+
loadPopularSuggestions = Actions.loadPopularSuggestions,
|
|
883
|
+
getRecentSearches = Actions.getRecentSearches,
|
|
884
|
+
resetStoreForComponent = Actions.resetStoreForComponent;
|
|
915
885
|
var debounce = helper.debounce,
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
886
|
+
checkValueChange = helper.checkValueChange,
|
|
887
|
+
getClassName$1 = helper.getClassName,
|
|
888
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
889
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery,
|
|
890
|
+
isEqual = helper.isEqual,
|
|
891
|
+
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
892
|
+
withClickIds = helper.withClickIds,
|
|
893
|
+
getResultStats = helper.getResultStats,
|
|
894
|
+
handleOnSuggestions = helper.handleOnSuggestions,
|
|
895
|
+
getTopSuggestions = helper.getTopSuggestions,
|
|
896
|
+
normalizeDataField = helper.normalizeDataField;
|
|
927
897
|
var DataSearch = {
|
|
928
898
|
name: 'DataSearch',
|
|
929
899
|
isTagsMode: false,
|
|
@@ -946,83 +916,70 @@ var DataSearch = {
|
|
|
946
916
|
},
|
|
947
917
|
created: function created() {
|
|
948
918
|
var _this$$props = this.$props,
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
919
|
+
enableRecentSearches = _this$$props.enableRecentSearches,
|
|
920
|
+
distinctField = _this$$props.distinctField,
|
|
921
|
+
distinctFieldConfig = _this$$props.distinctFieldConfig,
|
|
922
|
+
index = _this$$props.index,
|
|
923
|
+
mode = _this$$props.mode;
|
|
955
924
|
if (mode === SEARCH_COMPONENTS_MODES.TAG) {
|
|
956
925
|
this.$options.isTagsMode = true;
|
|
957
926
|
}
|
|
958
|
-
|
|
959
927
|
if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
|
|
960
928
|
console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
|
|
961
929
|
}
|
|
962
|
-
|
|
963
930
|
if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
|
|
964
931
|
console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
965
932
|
}
|
|
966
|
-
|
|
967
933
|
if (!this.enableAppbase && index) {
|
|
968
934
|
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
969
935
|
}
|
|
970
|
-
|
|
971
936
|
this.currentValue = '';
|
|
972
|
-
|
|
973
937
|
if (this.$options.isTagsMode) {
|
|
974
938
|
this.currentValue = '';
|
|
975
939
|
}
|
|
976
|
-
|
|
977
940
|
var shouldFetchInitialSuggestions = this.$props.enableDefaultSuggestions || this.currentValue;
|
|
978
|
-
|
|
979
941
|
if (shouldFetchInitialSuggestions) {
|
|
980
942
|
this.loadPopularSuggestions(this.$props.componentId);
|
|
981
|
-
|
|
982
943
|
if (enableRecentSearches) {
|
|
983
944
|
this.getRecentSearches();
|
|
984
945
|
}
|
|
985
946
|
}
|
|
986
|
-
|
|
987
|
-
this.
|
|
988
|
-
|
|
947
|
+
this.handleTextChange = debounce(this.handleText, this.$props.debounce);
|
|
948
|
+
this.updateDefaultQueryHandlerDebounced = debounce(this.updateDefaultQueryHandler, this.$props.debounce);
|
|
949
|
+
// Set custom and default queries in store
|
|
989
950
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
990
951
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
|
|
991
|
-
this.
|
|
952
|
+
this.updateDefaultQueryHandlerDebounced(this.currentValue, this.$props, false);
|
|
992
953
|
},
|
|
993
954
|
computed: {
|
|
994
955
|
suggestionsList: function suggestionsList() {
|
|
995
956
|
var suggestionsList = [];
|
|
996
|
-
|
|
997
957
|
if (!this.$data.currentValue && this.$props.defaultSuggestions && this.$props.defaultSuggestions.length) {
|
|
998
958
|
suggestionsList = this.$props.defaultSuggestions;
|
|
999
959
|
} else if (this.$data.currentValue) {
|
|
1000
960
|
suggestionsList = this.normalizedSuggestions;
|
|
1001
961
|
}
|
|
1002
|
-
|
|
1003
962
|
return withClickIds(suggestionsList);
|
|
1004
963
|
},
|
|
1005
964
|
topSuggestions: function topSuggestions() {
|
|
1006
965
|
if (!this.currentValue) {
|
|
1007
966
|
return [];
|
|
1008
967
|
}
|
|
1009
|
-
|
|
1010
968
|
return this.enablePopularSuggestions ? this.normalizedPopularSuggestions : [];
|
|
1011
969
|
},
|
|
1012
970
|
normalizedRecentSearches: function normalizedRecentSearches() {
|
|
1013
971
|
return this.recentSearches || [];
|
|
1014
972
|
},
|
|
1015
973
|
normalizedPopularSuggestions: function normalizedPopularSuggestions() {
|
|
1016
|
-
return getTopSuggestions(
|
|
974
|
+
return getTopSuggestions(
|
|
975
|
+
// use default popular suggestions if value is empty
|
|
1017
976
|
this.currentValue ? this.popularSuggestions : this.defaultPopularSuggestions || [], this.currentValue, this.showDistinctSuggestions);
|
|
1018
977
|
},
|
|
1019
978
|
defaultSearchSuggestions: function defaultSearchSuggestions() {
|
|
1020
979
|
var isPopularSuggestionsEnabled = this.enablePopularSuggestions;
|
|
1021
|
-
|
|
1022
980
|
if (this.currentValue || !this.enableDefaultSuggestions) {
|
|
1023
981
|
return [];
|
|
1024
982
|
}
|
|
1025
|
-
|
|
1026
983
|
var customDefaultPopularSuggestions = (this.defaultPopularSuggestions || []).map(function (suggestion) {
|
|
1027
984
|
return _extends({}, suggestion, {
|
|
1028
985
|
_popular_suggestion: true
|
|
@@ -1034,7 +991,8 @@ var DataSearch = {
|
|
|
1034
991
|
});
|
|
1035
992
|
});
|
|
1036
993
|
var defaultSuggestions = isPopularSuggestionsEnabled ? [].concat(customNormalizedRecentSearches, customDefaultPopularSuggestions || []) : customNormalizedRecentSearches;
|
|
1037
|
-
return getTopSuggestions(
|
|
994
|
+
return getTopSuggestions(
|
|
995
|
+
// use default popular suggestions if value is empty
|
|
1038
996
|
defaultSuggestions, this.currentValue, this.showDistinctSuggestions);
|
|
1039
997
|
},
|
|
1040
998
|
hasCustomRenderer: function hasCustomRenderer$1() {
|
|
@@ -1125,7 +1083,6 @@ var DataSearch = {
|
|
|
1125
1083
|
if (this.customHighlight && typeof this.customHighlight === 'function') {
|
|
1126
1084
|
this.setCustomHighlightOptions(this.componentId, this.customHighlight(this.$props));
|
|
1127
1085
|
}
|
|
1128
|
-
|
|
1129
1086
|
var queryOptions = DataSearch.highlightQuery(this.$props) || {};
|
|
1130
1087
|
this.queryOptions = _extends({}, queryOptions, this.getBasicQueryOptions());
|
|
1131
1088
|
this.setQueryOptions(this.$props.componentId, this.queryOptions);
|
|
@@ -1133,7 +1090,6 @@ var DataSearch = {
|
|
|
1133
1090
|
this.queryOptions = this.getBasicQueryOptions();
|
|
1134
1091
|
this.setQueryOptions(this.$props.componentId, this.queryOptions);
|
|
1135
1092
|
}
|
|
1136
|
-
|
|
1137
1093
|
if (this.selectedValue) {
|
|
1138
1094
|
this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
|
|
1139
1095
|
} else if (this.$props.value) {
|
|
@@ -1173,13 +1129,12 @@ var DataSearch = {
|
|
|
1173
1129
|
if (this.isPending && this.$options.isTagsMode && Array.isArray(newVal)) {
|
|
1174
1130
|
this.isPending = false;
|
|
1175
1131
|
}
|
|
1176
|
-
|
|
1177
1132
|
this.setValue(newVal, true, this.$props, undefined, false, typeof newVal !== 'string' && this.$options.isTagsMode);
|
|
1178
1133
|
}
|
|
1179
1134
|
},
|
|
1180
1135
|
defaultQuery: function defaultQuery(newVal, oldVal) {
|
|
1181
1136
|
if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
|
|
1182
|
-
this.
|
|
1137
|
+
this.updateDefaultQueryHandlerDebounced(this.$data.currentValue, this.$props);
|
|
1183
1138
|
}
|
|
1184
1139
|
},
|
|
1185
1140
|
customQuery: function customQuery(newVal, oldVal) {
|
|
@@ -1201,12 +1156,10 @@ var DataSearch = {
|
|
|
1201
1156
|
// selected value is cleared, call onValueSelected
|
|
1202
1157
|
this.onValueSelectedHandler('', causes.CLEAR_VALUE);
|
|
1203
1158
|
}
|
|
1204
|
-
|
|
1205
1159
|
if (this.$options.isTagsMode) {
|
|
1206
1160
|
// handling reset of tags through SelectedFilters or URL
|
|
1207
1161
|
this.selectedTags = [];
|
|
1208
1162
|
}
|
|
1209
|
-
|
|
1210
1163
|
this.setValue(newVal || '', true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
|
|
1211
1164
|
}
|
|
1212
1165
|
},
|
|
@@ -1217,9 +1170,9 @@ var DataSearch = {
|
|
|
1217
1170
|
methods: {
|
|
1218
1171
|
handleText: function handleText(value) {
|
|
1219
1172
|
if (this.$props.autosuggest) {
|
|
1220
|
-
this.
|
|
1173
|
+
this.updateDefaultQueryHandlerDebounced(value, this.$props);
|
|
1221
1174
|
} else {
|
|
1222
|
-
this.
|
|
1175
|
+
this.updateDefaultQueryHandlerDebounced(this.$props.componentId, value, this.$props);
|
|
1223
1176
|
}
|
|
1224
1177
|
},
|
|
1225
1178
|
validateDataField: function validateDataField() {
|
|
@@ -1228,18 +1181,15 @@ var DataSearch = {
|
|
|
1228
1181
|
var props = this.$props;
|
|
1229
1182
|
var requiredError = propName + " supplied to " + componentName + " is required. Validation failed.";
|
|
1230
1183
|
var propValue = props[propName];
|
|
1231
|
-
|
|
1232
1184
|
if (!this.enableAppbase) {
|
|
1233
1185
|
if (!propValue) {
|
|
1234
1186
|
console.error(requiredError);
|
|
1235
1187
|
return;
|
|
1236
1188
|
}
|
|
1237
|
-
|
|
1238
1189
|
if (typeof propValue !== 'string' && typeof propValue !== 'object' && !Array.isArray(propValue)) {
|
|
1239
1190
|
console.error("Invalid " + propName + " supplied to " + componentName + ". Validation failed.");
|
|
1240
1191
|
return;
|
|
1241
1192
|
}
|
|
1242
|
-
|
|
1243
1193
|
if (Array.isArray(propValue) && propValue.length === 0) {
|
|
1244
1194
|
console.error(requiredError);
|
|
1245
1195
|
}
|
|
@@ -1249,7 +1199,6 @@ var DataSearch = {
|
|
|
1249
1199
|
if (this.customHighlight && typeof this.customHighlight === 'function') {
|
|
1250
1200
|
this.setCustomHighlightOptions(this.componentId, this.customHighlight(this.$props));
|
|
1251
1201
|
}
|
|
1252
|
-
|
|
1253
1202
|
var queryOptions = DataSearch.highlightQuery(this.$props) || {};
|
|
1254
1203
|
this.queryOptions = _extends({}, queryOptions, this.getBasicQueryOptions());
|
|
1255
1204
|
this.setQueryOptions(this.$props.componentId, this.queryOptions);
|
|
@@ -1258,11 +1207,9 @@ var DataSearch = {
|
|
|
1258
1207
|
if (downshiftProps === void 0) {
|
|
1259
1208
|
downshiftProps = {};
|
|
1260
1209
|
}
|
|
1261
|
-
|
|
1262
1210
|
if (isQuerySuggestionsRender === void 0) {
|
|
1263
1211
|
isQuerySuggestionsRender = false;
|
|
1264
1212
|
}
|
|
1265
|
-
|
|
1266
1213
|
var currentValue = this.$data.currentValue;
|
|
1267
1214
|
var data = {
|
|
1268
1215
|
error: this.error,
|
|
@@ -1279,7 +1226,6 @@ var DataSearch = {
|
|
|
1279
1226
|
querySuggestions: this.normalizedPopularSuggestions,
|
|
1280
1227
|
popularSuggestions: this.normalizedPopularSuggestions
|
|
1281
1228
|
};
|
|
1282
|
-
|
|
1283
1229
|
if (isQuerySuggestionsRender) {
|
|
1284
1230
|
return getQuerySuggestionsComponent({
|
|
1285
1231
|
downshiftProps: downshiftProps,
|
|
@@ -1289,21 +1235,18 @@ var DataSearch = {
|
|
|
1289
1235
|
error: this.error
|
|
1290
1236
|
}, this);
|
|
1291
1237
|
}
|
|
1292
|
-
|
|
1293
1238
|
return getComponent(data, this);
|
|
1294
1239
|
},
|
|
1295
1240
|
// returns size and aggs property
|
|
1296
1241
|
getBasicQueryOptions: function getBasicQueryOptions() {
|
|
1297
1242
|
var aggregationField = this.$props.aggregationField;
|
|
1298
1243
|
var queryOptions = getQueryOptions(this.$props);
|
|
1299
|
-
|
|
1300
1244
|
if (aggregationField) {
|
|
1301
1245
|
queryOptions.aggs = getCompositeAggsQuery({
|
|
1302
1246
|
props: this.$props,
|
|
1303
1247
|
showTopHits: true
|
|
1304
1248
|
}).aggs;
|
|
1305
1249
|
}
|
|
1306
|
-
|
|
1307
1250
|
return queryOptions;
|
|
1308
1251
|
},
|
|
1309
1252
|
onSuggestions: function onSuggestions(results) {
|
|
@@ -1311,7 +1254,6 @@ var DataSearch = {
|
|
|
1311
1254
|
},
|
|
1312
1255
|
handleSearchIconClick: function handleSearchIconClick() {
|
|
1313
1256
|
var currentValue = this.currentValue;
|
|
1314
|
-
|
|
1315
1257
|
if (currentValue.trim()) {
|
|
1316
1258
|
this.isPending = false;
|
|
1317
1259
|
this.setValue(currentValue, true);
|
|
@@ -1320,35 +1262,28 @@ var DataSearch = {
|
|
|
1320
1262
|
},
|
|
1321
1263
|
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, isTagsMode) {
|
|
1322
1264
|
var _this = this;
|
|
1323
|
-
|
|
1324
1265
|
if (isDefaultValue === void 0) {
|
|
1325
1266
|
isDefaultValue = false;
|
|
1326
1267
|
}
|
|
1327
|
-
|
|
1328
1268
|
if (props === void 0) {
|
|
1329
1269
|
props = this.$props;
|
|
1330
1270
|
}
|
|
1331
|
-
|
|
1332
1271
|
if (toggleIsOpen === void 0) {
|
|
1333
1272
|
toggleIsOpen = true;
|
|
1334
1273
|
}
|
|
1335
|
-
|
|
1336
1274
|
if (isTagsMode === void 0) {
|
|
1337
1275
|
isTagsMode = this.$options.isTagsMode;
|
|
1338
1276
|
}
|
|
1339
|
-
|
|
1340
1277
|
var performUpdate = function performUpdate() {
|
|
1341
1278
|
if (isTagsMode && isEqual(value, _this.selectedTags)) {
|
|
1342
1279
|
return;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1280
|
+
}
|
|
1281
|
+
// Refresh recent searches when value becomes empty
|
|
1346
1282
|
if (!value && props.enableDefaultSuggestions === false) {
|
|
1347
1283
|
_this.resetStoreForComponent(props.componentId);
|
|
1348
1284
|
} else if (!value && _this.currentValue && _this.enableRecentSearches) {
|
|
1349
1285
|
_this.getRecentSearches();
|
|
1350
1286
|
}
|
|
1351
|
-
|
|
1352
1287
|
if (isTagsMode) {
|
|
1353
1288
|
if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
|
|
1354
1289
|
// check if value already present in selectedTags
|
|
@@ -1356,9 +1291,7 @@ var DataSearch = {
|
|
|
1356
1291
|
_this.isOpen = false;
|
|
1357
1292
|
return;
|
|
1358
1293
|
}
|
|
1359
|
-
|
|
1360
1294
|
_this.selectedTags = [].concat(_this.selectedTags);
|
|
1361
|
-
|
|
1362
1295
|
if (typeof value === 'string' && !!value) {
|
|
1363
1296
|
_this.selectedTags.push(value);
|
|
1364
1297
|
} else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
|
|
@@ -1367,29 +1300,23 @@ var DataSearch = {
|
|
|
1367
1300
|
} else if (value) {
|
|
1368
1301
|
_this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
1369
1302
|
}
|
|
1370
|
-
|
|
1371
1303
|
_this.currentValue = '';
|
|
1372
1304
|
} else {
|
|
1373
1305
|
_this.currentValue = value;
|
|
1374
1306
|
}
|
|
1375
|
-
|
|
1376
1307
|
var queryHandlerValue = value;
|
|
1377
|
-
|
|
1378
1308
|
if (isTagsMode) {
|
|
1379
1309
|
queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
|
|
1380
1310
|
}
|
|
1381
|
-
|
|
1382
1311
|
if (isDefaultValue) {
|
|
1383
1312
|
if (_this.$props.autosuggest) {
|
|
1384
1313
|
if (toggleIsOpen) {
|
|
1385
1314
|
_this.isOpen = false;
|
|
1386
1315
|
}
|
|
1387
|
-
|
|
1388
|
-
if (typeof value === 'string') _this.updateDefaultQueryHandler(value, _this.$props);
|
|
1316
|
+
if (typeof value === 'string') _this.updateDefaultQueryHandlerDebounced(value, _this.$props);
|
|
1389
1317
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
1390
1318
|
// to set the query otherwise the value should reset
|
|
1391
1319
|
|
|
1392
|
-
|
|
1393
1320
|
if (props.strictSelection) {
|
|
1394
1321
|
if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
|
|
1395
1322
|
_this.updateQueryHandler(props.componentId, queryHandlerValue, props);
|
|
@@ -1403,49 +1330,43 @@ var DataSearch = {
|
|
|
1403
1330
|
// debounce for handling text while typing
|
|
1404
1331
|
_this.handleTextChange(value);
|
|
1405
1332
|
}
|
|
1406
|
-
|
|
1407
1333
|
_this.$emit('valueChange', value);
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1334
|
+
_this.$emit('value-change', value);
|
|
1335
|
+
// Set the already fetched suggestions if query is same as used last to fetch the hits
|
|
1412
1336
|
if (value === _this.lastUsedQuery) {
|
|
1413
|
-
_this.suggestions = _this.onSuggestions(_this.suggestions);
|
|
1414
|
-
|
|
1337
|
+
_this.suggestions = _this.onSuggestions(_this.suggestions);
|
|
1338
|
+
// invoke on suggestions
|
|
1415
1339
|
_this.$emit('suggestions', _this.suggestions);
|
|
1416
1340
|
} else if (!value) {
|
|
1417
1341
|
// reset suggestions
|
|
1418
|
-
_this.suggestions = [];
|
|
1419
|
-
|
|
1342
|
+
_this.suggestions = [];
|
|
1343
|
+
// invoke on suggestions
|
|
1420
1344
|
_this.$emit('suggestions', _this.suggestions);
|
|
1421
1345
|
}
|
|
1422
1346
|
};
|
|
1423
|
-
|
|
1424
1347
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1425
1348
|
},
|
|
1426
1349
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props, execute) {
|
|
1350
|
+
if (props === void 0) {
|
|
1351
|
+
props = this.$props;
|
|
1352
|
+
}
|
|
1427
1353
|
if (!value && props.enableDefaultSuggestions === false) {
|
|
1428
1354
|
// clear Component data from store
|
|
1429
1355
|
this.resetStoreForComponent(props.componentId);
|
|
1430
1356
|
return;
|
|
1431
1357
|
}
|
|
1432
|
-
|
|
1433
1358
|
var defaultQueryOptions;
|
|
1434
1359
|
var query = DataSearch.defaultQuery(value, props);
|
|
1435
|
-
|
|
1436
1360
|
if (this.defaultQuery) {
|
|
1437
1361
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
1438
1362
|
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
1439
|
-
|
|
1440
1363
|
if (defaultQueryObj) {
|
|
1441
1364
|
query = defaultQueryObj;
|
|
1442
1365
|
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1366
|
+
defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
|
|
1367
|
+
// Update calculated default query in store
|
|
1446
1368
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
1447
1369
|
}
|
|
1448
|
-
|
|
1449
1370
|
this.setQueryOptions(this.internalComponent, _extends({}, this.queryOptions, defaultQueryOptions), execute);
|
|
1450
1371
|
this.updateQuery({
|
|
1451
1372
|
componentId: this.internalComponent,
|
|
@@ -1456,26 +1377,22 @@ var DataSearch = {
|
|
|
1456
1377
|
},
|
|
1457
1378
|
updateQueryHandler: function updateQueryHandler(componentId, value, props) {
|
|
1458
1379
|
var customQuery = props.customQuery,
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1380
|
+
filterLabel = props.filterLabel,
|
|
1381
|
+
showFilter = props.showFilter,
|
|
1382
|
+
URLParams = props.URLParams;
|
|
1462
1383
|
var customQueryOptions;
|
|
1463
1384
|
var defaultQueryTobeSet = DataSearch.defaultQuery(value, props);
|
|
1464
1385
|
var query = defaultQueryTobeSet;
|
|
1465
|
-
|
|
1466
1386
|
if (customQuery) {
|
|
1467
1387
|
var customQueryTobeSet = customQuery(value, props);
|
|
1468
1388
|
var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
|
|
1469
|
-
|
|
1470
1389
|
if (queryTobeSet) {
|
|
1471
1390
|
query = queryTobeSet;
|
|
1472
1391
|
}
|
|
1473
|
-
|
|
1474
1392
|
customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
|
|
1475
1393
|
updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
|
|
1476
1394
|
this.setQueryOptions(componentId, _extends({}, this.queryOptions, customQueryOptions), false);
|
|
1477
1395
|
}
|
|
1478
|
-
|
|
1479
1396
|
if (!this.isPending) {
|
|
1480
1397
|
this.updateQuery({
|
|
1481
1398
|
componentId: componentId,
|
|
@@ -1495,7 +1412,6 @@ var DataSearch = {
|
|
|
1495
1412
|
},
|
|
1496
1413
|
handleVoiceResults: function handleVoiceResults(_ref) {
|
|
1497
1414
|
var results = _ref.results;
|
|
1498
|
-
|
|
1499
1415
|
if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
|
|
1500
1416
|
this.isPending = false;
|
|
1501
1417
|
this.setValue(results[0][0].transcript.trim(), true);
|
|
@@ -1503,11 +1419,9 @@ var DataSearch = {
|
|
|
1503
1419
|
},
|
|
1504
1420
|
triggerQuery: function triggerQuery(_temp) {
|
|
1505
1421
|
var _ref2 = _temp === void 0 ? false : _temp,
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1422
|
+
_ref2$isOpen = _ref2.isOpen,
|
|
1423
|
+
isOpen = _ref2$isOpen === void 0 ? false : _ref2$isOpen;
|
|
1509
1424
|
var value = this.$props.value;
|
|
1510
|
-
|
|
1511
1425
|
if (value !== undefined) {
|
|
1512
1426
|
this.isPending = false;
|
|
1513
1427
|
this.setValue(this.$props.value, !isOpen);
|
|
@@ -1516,17 +1430,14 @@ var DataSearch = {
|
|
|
1516
1430
|
triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
|
|
1517
1431
|
// click analytics would only work client side and after javascript loads
|
|
1518
1432
|
var docId = documentId;
|
|
1519
|
-
|
|
1520
1433
|
if (!docId) {
|
|
1521
1434
|
var hitData = this.suggestionsList.find(function (hit) {
|
|
1522
1435
|
return hit._click_id === searchPosition;
|
|
1523
1436
|
});
|
|
1524
|
-
|
|
1525
1437
|
if (hitData && hitData.source && hitData.source._id) {
|
|
1526
1438
|
docId = hitData.source._id;
|
|
1527
1439
|
}
|
|
1528
1440
|
}
|
|
1529
|
-
|
|
1530
1441
|
this.recordSuggestionClick(searchPosition, docId);
|
|
1531
1442
|
},
|
|
1532
1443
|
clearValue: function clearValue() {
|
|
@@ -1536,53 +1447,44 @@ var DataSearch = {
|
|
|
1536
1447
|
},
|
|
1537
1448
|
handleKeyDown: function handleKeyDown(event, highlightedIndex) {
|
|
1538
1449
|
var value = this.$props.value;
|
|
1539
|
-
|
|
1540
1450
|
if (value !== undefined) {
|
|
1541
1451
|
this.isPending = true;
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1452
|
+
}
|
|
1544
1453
|
|
|
1454
|
+
// if a suggestion was selected, delegate the handling to suggestion handler
|
|
1545
1455
|
if (event.key === 'Enter' && highlightedIndex === null) {
|
|
1546
1456
|
this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
|
|
1547
1457
|
);
|
|
1548
|
-
this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
|
|
1549
|
-
} // Need to review
|
|
1550
|
-
|
|
1551
1458
|
|
|
1459
|
+
this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
|
|
1460
|
+
}
|
|
1461
|
+
// Need to review
|
|
1552
1462
|
this.$emit('keyDown', event, this.triggerQuery);
|
|
1553
1463
|
this.$emit('key-down', event, this.triggerQuery);
|
|
1554
1464
|
},
|
|
1555
1465
|
onInputChange: function onInputChange(e) {
|
|
1556
1466
|
var _this2 = this;
|
|
1557
|
-
|
|
1558
1467
|
var inputValue = e.target.value;
|
|
1559
|
-
|
|
1560
1468
|
if (!this.$data.isOpen) {
|
|
1561
1469
|
this.isOpen = true;
|
|
1562
1470
|
}
|
|
1563
|
-
|
|
1564
1471
|
var _this$$props2 = this.$props,
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1472
|
+
value = _this$$props2.value,
|
|
1473
|
+
autosuggest = _this$$props2.autosuggest;
|
|
1568
1474
|
if (value === undefined) {
|
|
1569
1475
|
this.setValue(inputValue, false, this.$props, undefined, true, false);
|
|
1570
1476
|
} else {
|
|
1571
1477
|
this.isPending = true;
|
|
1572
1478
|
this.$emit('change', inputValue, function (_temp2) {
|
|
1573
1479
|
var _ref3 = _temp2 === void 0 ? {} : _temp2,
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1480
|
+
_ref3$isOpen = _ref3.isOpen,
|
|
1481
|
+
isOpen = _ref3$isOpen === void 0 ? false : _ref3$isOpen;
|
|
1577
1482
|
if (_this2.$options.isTagsMode && autosuggest) {
|
|
1578
1483
|
_this2.currentValue = value;
|
|
1579
1484
|
_this2.isOpen = isOpen;
|
|
1580
|
-
|
|
1581
|
-
_this2.updateDefaultQueryHandler(_this2.currentValue, _this2.$props);
|
|
1582
|
-
|
|
1485
|
+
_this2.updateDefaultQueryHandlerDebounced(_this2.currentValue, _this2.$props);
|
|
1583
1486
|
return;
|
|
1584
1487
|
}
|
|
1585
|
-
|
|
1586
1488
|
_this2.triggerQuery({
|
|
1587
1489
|
isOpen: isOpen
|
|
1588
1490
|
});
|
|
@@ -1590,28 +1492,24 @@ var DataSearch = {
|
|
|
1590
1492
|
}
|
|
1591
1493
|
},
|
|
1592
1494
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
1593
|
-
var value = this.$props.value;
|
|
1594
|
-
|
|
1495
|
+
var value = this.$props.value;
|
|
1496
|
+
// Record analytics for selected suggestions
|
|
1595
1497
|
this.triggerClickAnalytics(suggestion._click_id);
|
|
1596
|
-
|
|
1597
1498
|
if (value === undefined) {
|
|
1598
1499
|
this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT);
|
|
1599
1500
|
} else if (this.$options.isTagsMode) {
|
|
1600
1501
|
var emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
|
|
1601
|
-
|
|
1602
1502
|
if (this.selectedTags.includes(suggestion.value)) {
|
|
1603
1503
|
// avoid duplicates in tags array
|
|
1604
1504
|
this.isOpen = false;
|
|
1605
1505
|
return;
|
|
1606
1506
|
}
|
|
1607
|
-
|
|
1608
1507
|
emitValue.push(suggestion.value);
|
|
1609
1508
|
this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, true);
|
|
1610
1509
|
this.$emit('change', emitValue, this.triggerQuery);
|
|
1611
1510
|
} else {
|
|
1612
1511
|
this.$emit('change', suggestion.value, this.triggerQuery);
|
|
1613
1512
|
}
|
|
1614
|
-
|
|
1615
1513
|
this.isPending = false;
|
|
1616
1514
|
this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
|
|
1617
1515
|
},
|
|
@@ -1619,11 +1517,9 @@ var DataSearch = {
|
|
|
1619
1517
|
if (currentValue === void 0) {
|
|
1620
1518
|
currentValue = this.$data.currentValue;
|
|
1621
1519
|
}
|
|
1622
|
-
|
|
1623
1520
|
for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1624
1521
|
cause[_key - 1] = arguments[_key];
|
|
1625
1522
|
}
|
|
1626
|
-
|
|
1627
1523
|
this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
|
|
1628
1524
|
this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
|
|
1629
1525
|
},
|
|
@@ -1633,26 +1529,21 @@ var DataSearch = {
|
|
|
1633
1529
|
},
|
|
1634
1530
|
getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
|
|
1635
1531
|
var isDark = this.themePreset === 'dark';
|
|
1636
|
-
|
|
1637
1532
|
if (isDark) {
|
|
1638
1533
|
return highlightedIndex === index ? '#555' : '#424242';
|
|
1639
1534
|
}
|
|
1640
|
-
|
|
1641
1535
|
return highlightedIndex === index ? '#eee' : '#fff';
|
|
1642
1536
|
},
|
|
1643
1537
|
renderIcon: function renderIcon() {
|
|
1644
1538
|
var h = this.$createElement;
|
|
1645
|
-
|
|
1646
1539
|
if (this.$props.showIcon) {
|
|
1647
1540
|
return this.$props.icon || h(SearchSvg);
|
|
1648
1541
|
}
|
|
1649
|
-
|
|
1650
1542
|
return null;
|
|
1651
1543
|
},
|
|
1652
1544
|
renderErrorComponent: function renderErrorComponent() {
|
|
1653
1545
|
var h = this.$createElement;
|
|
1654
1546
|
var renderError = this.$scopedSlots.renderError || this.$props.renderError;
|
|
1655
|
-
|
|
1656
1547
|
if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
|
|
1657
1548
|
return h(SuggestionWrapper, {
|
|
1658
1549
|
"attrs": {
|
|
@@ -1663,33 +1554,28 @@ var DataSearch = {
|
|
|
1663
1554
|
}
|
|
1664
1555
|
}, [isFunction(renderError) ? renderError(this.error) : renderError]);
|
|
1665
1556
|
}
|
|
1666
|
-
|
|
1667
1557
|
return null;
|
|
1668
1558
|
},
|
|
1669
1559
|
renderCancelIcon: function renderCancelIcon() {
|
|
1670
1560
|
var h = this.$createElement;
|
|
1671
|
-
|
|
1672
1561
|
if (this.$props.showClear) {
|
|
1673
1562
|
return this.$props.clearIcon || h(CancelSvg);
|
|
1674
1563
|
}
|
|
1675
|
-
|
|
1676
1564
|
return null;
|
|
1677
1565
|
},
|
|
1678
1566
|
renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
|
|
1679
1567
|
if (finalSuggestionsList === void 0) {
|
|
1680
1568
|
finalSuggestionsList = [];
|
|
1681
1569
|
}
|
|
1682
|
-
|
|
1683
1570
|
var h = this.$createElement;
|
|
1684
1571
|
var _this$$props3 = this.$props,
|
|
1685
|
-
|
|
1686
|
-
|
|
1572
|
+
theme = _this$$props3.theme,
|
|
1573
|
+
innerClass = _this$$props3.innerClass;
|
|
1687
1574
|
var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
|
|
1688
1575
|
var renderError = this.$scopedSlots.renderError || this.$props.renderError;
|
|
1689
1576
|
var _this$$data = this.$data,
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1577
|
+
isOpen = _this$$data.isOpen,
|
|
1578
|
+
currentValue = _this$$data.currentValue;
|
|
1693
1579
|
if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
|
|
1694
1580
|
return h(SuggestionWrapper, {
|
|
1695
1581
|
"attrs": {
|
|
@@ -1705,22 +1591,18 @@ var DataSearch = {
|
|
|
1705
1591
|
}
|
|
1706
1592
|
});
|
|
1707
1593
|
}
|
|
1708
|
-
|
|
1709
1594
|
return null;
|
|
1710
1595
|
},
|
|
1711
1596
|
renderInputAddonBefore: function renderInputAddonBefore() {
|
|
1712
1597
|
var h = this.$createElement;
|
|
1713
1598
|
var addonBefore = this.$scopedSlots.addonBefore;
|
|
1714
|
-
|
|
1715
1599
|
if (addonBefore) {
|
|
1716
1600
|
return h(InputAddon, [addonBefore()]);
|
|
1717
1601
|
}
|
|
1718
|
-
|
|
1719
1602
|
return null;
|
|
1720
1603
|
},
|
|
1721
1604
|
renderTag: function renderTag(item) {
|
|
1722
1605
|
var _this3 = this;
|
|
1723
|
-
|
|
1724
1606
|
var h = this.$createElement;
|
|
1725
1607
|
var innerClass = this.$props.innerClass;
|
|
1726
1608
|
return h(TagItem, {
|
|
@@ -1741,7 +1623,6 @@ var DataSearch = {
|
|
|
1741
1623
|
clearAllTags: function clearAllTags() {
|
|
1742
1624
|
this.selectedTags = [];
|
|
1743
1625
|
this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
|
|
1744
|
-
|
|
1745
1626
|
if (this.$props.value !== undefined) {
|
|
1746
1627
|
this.$emit('change', this.selectedTags, this.triggerQuery);
|
|
1747
1628
|
}
|
|
@@ -1751,20 +1632,16 @@ var DataSearch = {
|
|
|
1751
1632
|
return tag !== tagValue;
|
|
1752
1633
|
}));
|
|
1753
1634
|
this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
|
|
1754
|
-
|
|
1755
1635
|
if (this.$props.value !== undefined) {
|
|
1756
1636
|
this.$emit('change', this.selectedTags, this.triggerQuery);
|
|
1757
1637
|
}
|
|
1758
1638
|
},
|
|
1759
1639
|
renderTags: function renderTags() {
|
|
1760
1640
|
var _this4 = this;
|
|
1761
|
-
|
|
1762
1641
|
var h = this.$createElement;
|
|
1763
|
-
|
|
1764
1642
|
if (!Array.isArray(this.selectedTags)) {
|
|
1765
1643
|
return null;
|
|
1766
1644
|
}
|
|
1767
|
-
|
|
1768
1645
|
var tagsList = [].concat(this.selectedTags);
|
|
1769
1646
|
var shouldRenderClearAllTag = tagsList.length > 1;
|
|
1770
1647
|
var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
|
|
@@ -1790,22 +1667,20 @@ var DataSearch = {
|
|
|
1790
1667
|
renderInputAddonAfter: function renderInputAddonAfter() {
|
|
1791
1668
|
var h = this.$createElement;
|
|
1792
1669
|
var addonAfter = this.$scopedSlots.addonAfter;
|
|
1793
|
-
|
|
1794
1670
|
if (addonAfter) {
|
|
1795
1671
|
return h(InputAddon, [addonAfter()]);
|
|
1796
1672
|
}
|
|
1797
|
-
|
|
1798
1673
|
return null;
|
|
1799
1674
|
},
|
|
1800
1675
|
renderIcons: function renderIcons() {
|
|
1801
1676
|
var h = this.$createElement;
|
|
1802
1677
|
var _this$$props4 = this.$props,
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1678
|
+
iconPosition = _this$$props4.iconPosition,
|
|
1679
|
+
showClear = _this$$props4.showClear,
|
|
1680
|
+
innerClass = _this$$props4.innerClass,
|
|
1681
|
+
getMicInstance = _this$$props4.getMicInstance,
|
|
1682
|
+
showVoiceSearch = _this$$props4.showVoiceSearch,
|
|
1683
|
+
showIcon = _this$$props4.showIcon;
|
|
1809
1684
|
var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
|
|
1810
1685
|
var currentValue = this.$data.currentValue;
|
|
1811
1686
|
return h("div", [h(IconGroup, {
|
|
@@ -1845,49 +1720,41 @@ var DataSearch = {
|
|
|
1845
1720
|
},
|
|
1846
1721
|
focusSearchBox: function focusSearchBox(event) {
|
|
1847
1722
|
var _this$$refs, _this$$refs$this$$pro;
|
|
1848
|
-
|
|
1849
1723
|
var elt = event.target || event.srcElement;
|
|
1850
1724
|
var tagName = elt.tagName;
|
|
1851
|
-
|
|
1852
1725
|
if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
|
|
1853
1726
|
// already in an input
|
|
1854
1727
|
return;
|
|
1855
1728
|
}
|
|
1856
|
-
|
|
1857
1729
|
(_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
|
|
1858
1730
|
},
|
|
1859
1731
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
1860
1732
|
var _this5 = this;
|
|
1861
|
-
|
|
1862
1733
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
1863
|
-
|
|
1864
|
-
|
|
1734
|
+
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
1865
1735
|
if (isEmpty(focusShortcuts)) {
|
|
1866
1736
|
return;
|
|
1867
1737
|
}
|
|
1738
|
+
var shortcutsString = parseFocusShortcuts(focusShortcuts).join(',');
|
|
1868
1739
|
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1740
|
+
// handler for alphabets and other key combinations
|
|
1741
|
+
hotkeys(shortcutsString,
|
|
1742
|
+
// eslint-disable-next-line no-unused-vars
|
|
1873
1743
|
/* eslint-disable no-shadow */
|
|
1874
1744
|
function (event, handler) {
|
|
1875
1745
|
// Prevent the default refresh event under WINDOWS system
|
|
1876
1746
|
event.preventDefault();
|
|
1877
|
-
|
|
1878
1747
|
_this5.focusSearchBox(event);
|
|
1879
|
-
});
|
|
1748
|
+
});
|
|
1880
1749
|
|
|
1750
|
+
// if one of modifier keys are used, they are handled below
|
|
1881
1751
|
hotkeys('*', function (event) {
|
|
1882
1752
|
var modifierKeys = extractModifierKeysFromFocusShortcuts(focusShortcuts);
|
|
1883
1753
|
if (modifierKeys.length === 0) return;
|
|
1884
|
-
|
|
1885
1754
|
for (var index = 0; index < modifierKeys.length; index += 1) {
|
|
1886
1755
|
var element = modifierKeys[index];
|
|
1887
|
-
|
|
1888
1756
|
if (hotkeys[element]) {
|
|
1889
1757
|
_this5.focusSearchBox(event);
|
|
1890
|
-
|
|
1891
1758
|
break;
|
|
1892
1759
|
}
|
|
1893
1760
|
}
|
|
@@ -1896,22 +1763,19 @@ var DataSearch = {
|
|
|
1896
1763
|
},
|
|
1897
1764
|
render: function render() {
|
|
1898
1765
|
var _this6 = this;
|
|
1899
|
-
|
|
1900
1766
|
var h = arguments[0];
|
|
1901
1767
|
var _this$$props5 = this.$props,
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1768
|
+
theme = _this$$props5.theme,
|
|
1769
|
+
size = _this$$props5.size,
|
|
1770
|
+
expandSuggestionsContainer = _this$$props5.expandSuggestionsContainer,
|
|
1771
|
+
enableDefaultSuggestions = _this$$props5.enableDefaultSuggestions;
|
|
1906
1772
|
var _this$$scopedSlots = this.$scopedSlots,
|
|
1907
|
-
|
|
1908
|
-
|
|
1773
|
+
recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
|
|
1774
|
+
popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
|
|
1909
1775
|
var hasSuggestions = this.currentValue ? this.suggestionsList.length || this.topSuggestions.length : this.defaultSearchSuggestions.length;
|
|
1910
|
-
|
|
1911
1776
|
if (enableDefaultSuggestions === false && !this.currentValue) {
|
|
1912
1777
|
hasSuggestions = false;
|
|
1913
1778
|
}
|
|
1914
|
-
|
|
1915
1779
|
return h(Container, {
|
|
1916
1780
|
"class": this.$props.className
|
|
1917
1781
|
}, [this.$props.title && h(Title, {
|
|
@@ -1926,13 +1790,12 @@ var DataSearch = {
|
|
|
1926
1790
|
"scopedSlots": {
|
|
1927
1791
|
"default": function _default(_ref4) {
|
|
1928
1792
|
var getInputEvents = _ref4.getInputEvents,
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1793
|
+
getInputProps = _ref4.getInputProps,
|
|
1794
|
+
getItemProps = _ref4.getItemProps,
|
|
1795
|
+
getItemEvents = _ref4.getItemEvents,
|
|
1796
|
+
isOpen = _ref4.isOpen,
|
|
1797
|
+
highlightedIndex = _ref4.highlightedIndex,
|
|
1798
|
+
setHighlightedIndex = _ref4.setHighlightedIndex;
|
|
1936
1799
|
var renderSuggestionsContainer = function renderSuggestionsContainer() {
|
|
1937
1800
|
return h("div", [_this6.hasCustomRenderer && _this6.getComponent({
|
|
1938
1801
|
isOpen: isOpen,
|
|
@@ -2030,7 +1893,6 @@ var DataSearch = {
|
|
|
2030
1893
|
})]);
|
|
2031
1894
|
})]) : _this6.renderNoSuggestions(_this6.suggestionsList)]);
|
|
2032
1895
|
};
|
|
2033
|
-
|
|
2034
1896
|
return h("div", {
|
|
2035
1897
|
"class": suggestionsContainer
|
|
2036
1898
|
}, [h(InputGroup, [_this6.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
|
|
@@ -2054,7 +1916,6 @@ var DataSearch = {
|
|
|
2054
1916
|
onFocus: _this6.handleFocus,
|
|
2055
1917
|
onKeyPress: function onKeyPress(e) {
|
|
2056
1918
|
_this6.$emit('keyPress', e, _this6.triggerQuery);
|
|
2057
|
-
|
|
2058
1919
|
_this6.$emit('key-press', e, _this6.triggerQuery);
|
|
2059
1920
|
},
|
|
2060
1921
|
onKeyDown: function onKeyDown(e) {
|
|
@@ -2062,7 +1923,6 @@ var DataSearch = {
|
|
|
2062
1923
|
},
|
|
2063
1924
|
onKeyUp: function onKeyUp(e) {
|
|
2064
1925
|
_this6.$emit('keyUp', e, _this6.triggerQuery);
|
|
2065
|
-
|
|
2066
1926
|
_this6.$emit('key-up', e, _this6.triggerQuery);
|
|
2067
1927
|
},
|
|
2068
1928
|
onClick: function onClick() {
|
|
@@ -2092,7 +1952,6 @@ var DataSearch = {
|
|
|
2092
1952
|
},
|
|
2093
1953
|
keypress: function keypress(e) {
|
|
2094
1954
|
_this6.$emit('keyPress', e, _this6.triggerQuery);
|
|
2095
|
-
|
|
2096
1955
|
_this6.$emit('key-press', e, _this6.triggerQuery);
|
|
2097
1956
|
},
|
|
2098
1957
|
input: this.onInputChange,
|
|
@@ -2101,12 +1960,10 @@ var DataSearch = {
|
|
|
2101
1960
|
},
|
|
2102
1961
|
keydown: function keydown(e) {
|
|
2103
1962
|
_this6.$emit('keyDown', e, _this6.triggerQuery);
|
|
2104
|
-
|
|
2105
1963
|
_this6.$emit('key-down', e, _this6.triggerQuery);
|
|
2106
1964
|
},
|
|
2107
1965
|
keyup: function keyup(e) {
|
|
2108
1966
|
_this6.$emit('keyUp', e, _this6.triggerQuery);
|
|
2109
|
-
|
|
2110
1967
|
_this6.$emit('key-up', e, _this6.triggerQuery);
|
|
2111
1968
|
}
|
|
2112
1969
|
}),
|
|
@@ -2121,10 +1978,8 @@ var DataSearch = {
|
|
|
2121
1978
|
document.removeEventListener('keydown', this.onKeyDown);
|
|
2122
1979
|
}
|
|
2123
1980
|
};
|
|
2124
|
-
|
|
2125
1981
|
DataSearch.defaultQuery = function (value, props) {
|
|
2126
1982
|
var finalQuery = null;
|
|
2127
|
-
|
|
2128
1983
|
if (value) {
|
|
2129
1984
|
var fields = normalizeDataField(props.dataField, props.fieldWeights);
|
|
2130
1985
|
finalQuery = {
|
|
@@ -2134,11 +1989,9 @@ DataSearch.defaultQuery = function (value, props) {
|
|
|
2134
1989
|
}
|
|
2135
1990
|
};
|
|
2136
1991
|
}
|
|
2137
|
-
|
|
2138
1992
|
if (value === '') {
|
|
2139
1993
|
finalQuery = null;
|
|
2140
1994
|
}
|
|
2141
|
-
|
|
2142
1995
|
if (finalQuery && props.nestedField) {
|
|
2143
1996
|
return {
|
|
2144
1997
|
query: {
|
|
@@ -2149,23 +2002,18 @@ DataSearch.defaultQuery = function (value, props) {
|
|
|
2149
2002
|
}
|
|
2150
2003
|
};
|
|
2151
2004
|
}
|
|
2152
|
-
|
|
2153
2005
|
return finalQuery;
|
|
2154
2006
|
};
|
|
2155
|
-
|
|
2156
2007
|
DataSearch.shouldQuery = function (value, dataFields, props) {
|
|
2157
2008
|
var finalQuery = [];
|
|
2158
2009
|
var phrasePrefixFields = [];
|
|
2159
2010
|
var fields = dataFields.map(function (dataField) {
|
|
2160
2011
|
var queryField = "" + dataField.field + (dataField.weight ? "^" + dataField.weight : '');
|
|
2161
|
-
|
|
2162
2012
|
if (!(dataField.field.endsWith('.keyword') || dataField.field.endsWith('.autosuggest') || dataField.field.endsWith('.search'))) {
|
|
2163
2013
|
phrasePrefixFields.push(queryField);
|
|
2164
2014
|
}
|
|
2165
|
-
|
|
2166
2015
|
return queryField;
|
|
2167
2016
|
});
|
|
2168
|
-
|
|
2169
2017
|
if (props.searchOperators || props.queryString) {
|
|
2170
2018
|
return {
|
|
2171
2019
|
query: value,
|
|
@@ -2173,7 +2021,6 @@ DataSearch.shouldQuery = function (value, dataFields, props) {
|
|
|
2173
2021
|
default_operator: props.queryFormat
|
|
2174
2022
|
};
|
|
2175
2023
|
}
|
|
2176
|
-
|
|
2177
2024
|
if (props.queryFormat === 'and') {
|
|
2178
2025
|
finalQuery.push({
|
|
2179
2026
|
multi_match: {
|
|
@@ -2191,7 +2038,6 @@ DataSearch.shouldQuery = function (value, dataFields, props) {
|
|
|
2191
2038
|
operator: 'and'
|
|
2192
2039
|
}
|
|
2193
2040
|
});
|
|
2194
|
-
|
|
2195
2041
|
if (phrasePrefixFields.length > 0) {
|
|
2196
2042
|
finalQuery.push({
|
|
2197
2043
|
multi_match: {
|
|
@@ -2202,10 +2048,8 @@ DataSearch.shouldQuery = function (value, dataFields, props) {
|
|
|
2202
2048
|
}
|
|
2203
2049
|
});
|
|
2204
2050
|
}
|
|
2205
|
-
|
|
2206
2051
|
return finalQuery;
|
|
2207
2052
|
}
|
|
2208
|
-
|
|
2209
2053
|
finalQuery.push({
|
|
2210
2054
|
multi_match: {
|
|
2211
2055
|
query: value,
|
|
@@ -2223,7 +2067,6 @@ DataSearch.shouldQuery = function (value, dataFields, props) {
|
|
|
2223
2067
|
operator: 'or'
|
|
2224
2068
|
}
|
|
2225
2069
|
});
|
|
2226
|
-
|
|
2227
2070
|
if (phrasePrefixFields.length > 0) {
|
|
2228
2071
|
finalQuery.push({
|
|
2229
2072
|
multi_match: {
|
|
@@ -2234,22 +2077,17 @@ DataSearch.shouldQuery = function (value, dataFields, props) {
|
|
|
2234
2077
|
}
|
|
2235
2078
|
});
|
|
2236
2079
|
}
|
|
2237
|
-
|
|
2238
2080
|
return finalQuery;
|
|
2239
2081
|
};
|
|
2240
|
-
|
|
2241
2082
|
DataSearch.highlightQuery = function (props) {
|
|
2242
2083
|
if (props.customHighlight) {
|
|
2243
2084
|
return props.customHighlight(props);
|
|
2244
2085
|
}
|
|
2245
|
-
|
|
2246
2086
|
if (!props.highlight) {
|
|
2247
2087
|
return null;
|
|
2248
2088
|
}
|
|
2249
|
-
|
|
2250
2089
|
var fields = {};
|
|
2251
2090
|
var highlightField = props.highlightField ? props.highlightField : props.dataField;
|
|
2252
|
-
|
|
2253
2091
|
if (typeof highlightField === 'string') {
|
|
2254
2092
|
fields[highlightField] = {};
|
|
2255
2093
|
} else if (Array.isArray(highlightField)) {
|
|
@@ -2257,7 +2095,6 @@ DataSearch.highlightQuery = function (props) {
|
|
|
2257
2095
|
fields[item] = {};
|
|
2258
2096
|
});
|
|
2259
2097
|
}
|
|
2260
|
-
|
|
2261
2098
|
return {
|
|
2262
2099
|
highlight: _extends({
|
|
2263
2100
|
pre_tags: ['<mark>'],
|
|
@@ -2268,11 +2105,9 @@ DataSearch.highlightQuery = function (props) {
|
|
|
2268
2105
|
})
|
|
2269
2106
|
};
|
|
2270
2107
|
};
|
|
2271
|
-
|
|
2272
2108
|
DataSearch.hasInternalComponent = function () {
|
|
2273
2109
|
return true;
|
|
2274
2110
|
};
|
|
2275
|
-
|
|
2276
2111
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
2277
2112
|
return {
|
|
2278
2113
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
@@ -2297,7 +2132,6 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
2297
2132
|
recentSearches: state.recentSearches.data
|
|
2298
2133
|
};
|
|
2299
2134
|
};
|
|
2300
|
-
|
|
2301
2135
|
var mapDispatchToProps = {
|
|
2302
2136
|
setQueryOptions: setQueryOptions,
|
|
2303
2137
|
updateQuery: updateQuery,
|
|
@@ -2313,12 +2147,10 @@ var DSConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps,
|
|
|
2313
2147
|
componentType: componentTypes.dataSearch,
|
|
2314
2148
|
internalComponent: DataSearch.hasInternalComponent()
|
|
2315
2149
|
}));
|
|
2316
|
-
|
|
2317
2150
|
DataSearch.install = function (Vue) {
|
|
2318
2151
|
Vue.component(DataSearch.name, DSConnected);
|
|
2319
|
-
};
|
|
2320
|
-
|
|
2321
|
-
|
|
2152
|
+
};
|
|
2153
|
+
// Add componentType for SSR
|
|
2322
2154
|
DataSearch.componentType = componentTypes.dataSearch;
|
|
2323
2155
|
|
|
2324
2156
|
export { CustomSvg as C, DSConnected as D, InputAddon as I, Mic as M, SearchSvg as S, TagItem as T, DataSearch as a, SuggestionWrapper as b, TagsContainer as c, InputGroup as d, SuggestionItem as e };
|