@appbaseio/reactivesearch-vue 1.34.0-alpha.1 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1175 -1297
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +6 -11
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{ComponentWrapper-9318cece.js → ComponentWrapper-94c50228.js} +16 -7
  6. package/dist/cjs/DataSearch.js +1310 -17
  7. package/dist/cjs/{DropDown-8984b544.js → DropDown-7a52c661.js} +2 -2
  8. package/dist/cjs/DynamicRangeSlider.js +12 -8
  9. package/dist/cjs/MultiDropdownList.js +11 -8
  10. package/dist/cjs/MultiList.js +10 -8
  11. package/dist/cjs/MultiRange.js +7 -4
  12. package/dist/cjs/{Pagination-07f4dbad.js → Pagination-e56a5b79.js} +1 -1
  13. package/dist/cjs/{PreferencesConsumer-5d67b486.js → PreferencesConsumer-5e6e84a2.js} +1 -1
  14. package/dist/cjs/RangeInput.js +4 -4
  15. package/dist/cjs/RangeSlider.js +7 -4
  16. package/dist/cjs/ReactiveBase.js +10 -6
  17. package/dist/cjs/ReactiveComponent.js +316 -45
  18. package/dist/cjs/{ReactiveComponent-0a354ed7.js → ReactiveComponentPrivate-244c6055.js} +32 -318
  19. package/dist/cjs/ReactiveComponentPrivate.js +55 -0
  20. package/dist/cjs/ReactiveGoogleMap.js +139 -108
  21. package/dist/cjs/ReactiveList.js +17 -6
  22. package/dist/cjs/ResultCard.js +1 -1
  23. package/dist/cjs/ResultList.js +1 -1
  24. package/dist/cjs/SelectedFilters.js +2 -2
  25. package/dist/cjs/SingleDropdownList.js +10 -8
  26. package/dist/cjs/SingleList.js +10 -8
  27. package/dist/cjs/SingleRange.js +7 -4
  28. package/dist/cjs/StateProvider.js +1 -1
  29. package/dist/cjs/Tags-4ec43831.js +883 -0
  30. package/dist/cjs/ToggleButton.js +6 -4
  31. package/dist/cjs/{index-30126fd0.js → index-de136c17.js} +2 -0
  32. package/dist/cjs/index.js +14 -11
  33. package/dist/cjs/initReactivesearch.js +0 -3
  34. package/dist/cjs/install.js +11 -9
  35. package/dist/cjs/version.js +1 -1
  36. package/dist/cjs/{vueTypes-7cfc2f98.js → vueTypes-b7007f5f.js} +2 -1
  37. package/dist/es/{ComponentWrapper-240450cc.js → ComponentWrapper-edaeaceb.js} +16 -7
  38. package/dist/es/DataSearch.js +1310 -15
  39. package/dist/es/{DropDown-28ddce07.js → DropDown-2c0dd714.js} +2 -2
  40. package/dist/es/DynamicRangeSlider.js +12 -8
  41. package/dist/es/MultiDropdownList.js +11 -8
  42. package/dist/es/MultiList.js +10 -8
  43. package/dist/es/MultiRange.js +7 -4
  44. package/dist/es/{Pagination-28e56c5c.js → Pagination-edeb7dbe.js} +1 -1
  45. package/dist/es/{PreferencesConsumer-bc097ebb.js → PreferencesConsumer-86a676c8.js} +1 -1
  46. package/dist/es/RangeInput.js +4 -4
  47. package/dist/es/RangeSlider.js +7 -4
  48. package/dist/es/ReactiveBase.js +10 -6
  49. package/dist/es/ReactiveComponent.js +316 -44
  50. package/dist/es/{ReactiveComponent-9352370c.js → ReactiveComponentPrivate-6f16e1b7.js} +19 -305
  51. package/dist/es/ReactiveComponentPrivate.js +47 -0
  52. package/dist/es/ReactiveGoogleMap.js +139 -108
  53. package/dist/es/ReactiveList.js +17 -6
  54. package/dist/es/ResultCard.js +1 -1
  55. package/dist/es/ResultList.js +1 -1
  56. package/dist/es/SelectedFilters.js +2 -2
  57. package/dist/es/SingleDropdownList.js +10 -8
  58. package/dist/es/SingleList.js +10 -8
  59. package/dist/es/SingleRange.js +7 -4
  60. package/dist/es/StateProvider.js +1 -1
  61. package/dist/es/Tags-1c2d6c4d.js +869 -0
  62. package/dist/es/ToggleButton.js +6 -4
  63. package/dist/es/{index-0444a498.js → index-5509c0bc.js} +2 -0
  64. package/dist/es/index.js +10 -8
  65. package/dist/es/initReactivesearch.js +0 -3
  66. package/dist/es/install.js +11 -9
  67. package/dist/es/version.js +1 -1
  68. package/dist/es/{vueTypes-8986b709.js → vueTypes-66ebc93e.js} +2 -1
  69. package/package.json +87 -87
  70. package/dist/cjs/DataSearch-8ea2651a.js +0 -2175
  71. package/dist/es/DataSearch-dcaa106b.js +0 -2159
@@ -1,2159 +0,0 @@
1
- import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
- import { SEARCH_COMPONENTS_MODES, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
3
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
4
- import VueTypes from 'vue-types';
5
- import { getQueryOptions } from '@appbaseio/reactivecore/lib/utils/helper';
6
- import styled, { css, cx, injectGlobal } from '@appbaseio/vue-emotion';
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
- import hotkeys from 'hotkeys-js';
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
- import Highlight from 'vue-highlight-words';
18
-
19
- var _templateObject;
20
- var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
21
- InputGroup.defaultProps = {
22
- className: 'input-group'
23
- };
24
-
25
- var _templateObject$1;
26
- var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid #ccc;\n border-radius: 2px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 400;\n padding: 0 11px;\n position: relative;\n transition: all 0.3s;\n box-sizing: border-box;\n overflow: hidden;\n\n &:first-of-type {\n border-right: none;\n }\n &:last-of-type {\n border-left: none;\n }\n"])));
27
- InputAddon.defaultProps = {
28
- className: 'input-addon'
29
- };
30
-
31
- var getClassName = helper.getClassName;
32
- var SuggestionWrapper = {
33
- name: 'SuggestionWrapper',
34
- props: {
35
- innerClassName: types.string,
36
- themePreset: types.themePreset,
37
- innerClass: types.style
38
- },
39
- render: function render() {
40
- var h = arguments[0];
41
- var _this$$props = this.$props,
42
- themePreset = _this$$props.themePreset,
43
- innerClass = _this$$props.innerClass,
44
- innerClassName = _this$$props.innerClassName;
45
- return h("div", {
46
- "class": noSuggestions(themePreset) + " " + getClassName(innerClass, innerClassName || '')
47
- }, [h("li", [this.$scopedSlots["default"]()])]);
48
- }
49
- };
50
-
51
- var _templateObject$2;
52
- var highlightStyle = {
53
- fontWeight: 600,
54
- padding: 0,
55
- backgroundColor: 'transparent',
56
- color: 'inherit'
57
- };
58
- var PredictiveSuggestion = styled('span')(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n\t.highlight {\n\t\tbackground: transparent;\n\t\tcolor: inherit;\n\t\tfont-weight: 600;\n\t\tpadding: 0;\n\t}\n"])));
59
- var SuggestionItem = {
60
- name: 'SuggestionItem',
61
- props: {
62
- currentValue: types.string,
63
- suggestion: types.any
64
- },
65
- render: function render() {
66
- var h = arguments[0];
67
- var _this$suggestion = this.suggestion,
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;
76
- if (label) {
77
- // label has highest precedence
78
- return typeof label === 'string' ? h("div", {
79
- "class": "trim"
80
- }, [(_category ? false : isPredictiveSuggestion
81
- // eslint-disable-next-line
82
- || !!_suggestion_type) ? h(PredictiveSuggestion, {
83
- "domProps": {
84
- "innerHTML": label
85
- }
86
- }) : h(Highlight, {
87
- "attrs": {
88
- "searchWords": _category ? [_category] : this.currentValue.split(' '),
89
- "textToHighlight": label,
90
- "autoEscape": true,
91
- "highlightStyle": highlightStyle
92
- }
93
- })]) : label;
94
- }
95
- if (title || image || description) {
96
- return h(Flex, {
97
- "attrs": {
98
- "alignItems": "center",
99
- "css": {
100
- width: '100%'
101
- }
102
- }
103
- }, [image && h("div", {
104
- "attrs": {
105
- "css": {
106
- margin: 'auto',
107
- marginRight: 10
108
- }
109
- }
110
- }, [h("img", {
111
- "attrs": {
112
- "src": image,
113
- "alt": " ",
114
- "height": "50px",
115
- "width": "50px",
116
- "css": {
117
- objectFit: 'contain'
118
- }
119
- }
120
- })]), h(Flex, {
121
- "attrs": {
122
- "direction": "column",
123
- "css": {
124
- width: image ? 'calc(100% - 60px)' : '100%'
125
- }
126
- }
127
- }, [title && h("div", {
128
- "class": "trim"
129
- }, [h(Highlight, {
130
- "attrs": {
131
- "searchWords": this.currentValue.split(' '),
132
- "textToHighlight": title,
133
- "highlightStyle": highlightStyle
134
- },
135
- "class": css({
136
- fontSize: '1rem'
137
- })
138
- })]), description && h("div", {
139
- "class": cx('trim', css({
140
- marginTop: 3
141
- }))
142
- }, [h(Highlight, {
143
- "attrs": {
144
- "searchWords": this.currentValue.split(' '),
145
- "textToHighlight": description,
146
- "highlightStyle": highlightStyle
147
- }
148
- })])])]);
149
- }
150
- return value;
151
- }
152
- };
153
-
154
- var SearchSvg = {
155
- name: 'SearchSvg',
156
- props: ['styles'],
157
- render: function render() {
158
- var h = arguments[0];
159
- return h("svg", {
160
- "attrs": {
161
- "alt": "Search",
162
- "height": "12",
163
- "xmlns": "http://www.w3.org/2000/svg",
164
- "viewBox": "0 0 15 15"
165
- },
166
- "class": "search-icon",
167
- "style": _extends({
168
- transform: 'scale(1.35)',
169
- position: 'relative'
170
- }, this.$props.styles ? this.$props.styles : {})
171
- }, [h("title", ["Search"]), h("path", {
172
- "attrs": {
173
- "d": 'M6.02945,10.20327a4.17382,4.17382,0,1,1,4.17382-4.17382A4.15609,4.15609,0,0,1,6.02945,10.20327Zm9.69195,4.2199L10.8989,9.59979A5.88021,5.88021,0,0,0,12.058,6.02856,6.00467,6.00467,0,1,0,9.59979,10.8989l4.82338,4.82338a.89729.89729,0,0,0,1.29912,0,.89749.89749,0,0,0-.00087-1.29909Z'
174
- }
175
- })]);
176
- }
177
- };
178
-
179
- var _templateObject$3;
180
-
181
- // eslint-disable-next-line
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"])));
183
- var MicSvg = {
184
- name: 'MicSvg',
185
- props: ['className'],
186
- render: function render() {
187
- var h = arguments[0];
188
- return h("svg", {
189
- "attrs": {
190
- "viewBox": "0 0 480 480",
191
- "xmlns": "http://www.w3.org/2000/svg",
192
- "id": "el_xS0FRzQjJ",
193
- "width": 28,
194
- "height": 28,
195
- "className": this.$props.className
196
- },
197
- "style": {
198
- transform: 'scale(1.5)'
199
- }
200
- }, [h("g", {
201
- "attrs": {
202
- "id": "el_TvxDfTAtKp",
203
- "fillRule": "evenodd"
204
- }
205
- }, [h("g", {
206
- "attrs": {
207
- "id": "el_D93PK3GbmJ",
208
- "fillRule": "nonzero"
209
- },
210
- "style": {
211
- fill: '#595959'
212
- }
213
- }, [h("path", {
214
- "attrs": {
215
- "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
216
- "id": "el_uly3EwA2O3"
217
- }
218
- }), h("path", {
219
- "attrs": {
220
- "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,-2.84217094e-14 76.9864699,-2.84217094e-14 C55.8825877,-2.84217094e-14 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
221
- "id": "el_tnDbR4ytu4"
222
- }
223
- })])])]);
224
- }
225
- };
226
-
227
- var _templateObject$4;
228
-
229
- // eslint-disable-next-line
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
- var MuteSvg = {
232
- name: 'MuteSvg',
233
- props: ['className'],
234
- render: function render() {
235
- var h = arguments[0];
236
- return h("svg", {
237
- "style": {
238
- transform: 'scale(1.5)'
239
- },
240
- "attrs": {
241
- "viewBox": "0 0 480 480",
242
- "xmlns": "http://www.w3.org/2000/svg",
243
- "id": "el_D1rEpH2zj",
244
- "width": 28,
245
- "height": 28,
246
- "className": this.$props.className
247
- }
248
- }, [h("g", {
249
- "attrs": {
250
- "id": "el_X81iT9kZYo",
251
- "fillRule": "evenodd"
252
- }
253
- }, [h("g", {
254
- "attrs": {
255
- "id": "el_gMpyalCphp"
256
- }
257
- }, [h("path", {
258
- "attrs": {
259
- "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
260
- "id": "el_c7H-3u-D4l",
261
- "fillRule": "nonzero"
262
- },
263
- "style": {
264
- fill: '#595959'
265
- }
266
- }), h("path", {
267
- "attrs": {
268
- "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,-2.84217094e-14 76.9864699,-2.84217094e-14 C55.8825877,-2.84217094e-14 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
269
- "id": "el_qhFcdAAFwo",
270
- "fillRule": "nonzero"
271
- },
272
- "style": {
273
- fill: '#595959'
274
- }
275
- }), h("path", {
276
- "attrs": {
277
- "d": "M11.5,206.5 L142.5,12.5",
278
- "id": "el_M8X8g37WOI",
279
- "strokeLinecap": "round",
280
- "strokeLinejoin": "round"
281
- }
282
- })])])]);
283
- }
284
- };
285
-
286
- var _templateObject$5;
287
-
288
- // eslint-disable-next-line
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"])));
290
- var ListenSvg = {
291
- name: 'ListenSvg',
292
- props: ['className'],
293
- render: function render() {
294
- var h = arguments[0];
295
- return h("svg", {
296
- "attrs": {
297
- "viewBox": "0 0 480 480",
298
- "xmlns": "http://www.w3.org/2000/svg",
299
- "xmlnsXlink": "http://www.w3.org/1999/xlink",
300
- "id": "el_hiibMG0x-",
301
- "width": 28,
302
- "height": 29,
303
- "className": this.$props.className
304
- },
305
- "style": {
306
- transform: 'scale(1.5)'
307
- }
308
- }, [h("defs", [h("path", {
309
- "attrs": {
310
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
311
- "id": "path-1"
312
- }
313
- }), h("path", {
314
- "attrs": {
315
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
316
- "id": "path-3"
317
- }
318
- }), h("path", {
319
- "attrs": {
320
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
321
- "id": "path-5"
322
- }
323
- }), h("path", {
324
- "attrs": {
325
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
326
- "id": "path-7"
327
- }
328
- }), h("path", {
329
- "attrs": {
330
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
331
- "id": "path-9"
332
- }
333
- }), h("path", {
334
- "attrs": {
335
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
336
- "id": "path-11"
337
- }
338
- }), h("path", {
339
- "attrs": {
340
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
341
- "id": "path-13"
342
- }
343
- }), h("path", {
344
- "attrs": {
345
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
346
- "id": "path-15"
347
- }
348
- })]), h("g", {
349
- "attrs": {
350
- "id": "el_QJeJ_2CDw5",
351
- "fillRule": "evenodd"
352
- }
353
- }, [h("g", {
354
- "attrs": {
355
- "id": "el_UYYCfubTRf"
356
- }
357
- }, [h("path", {
358
- "attrs": {
359
- "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
360
- "id": "el_uzZNtK32Zi",
361
- "fillRule": "nonzero"
362
- },
363
- "style": {
364
- fill: '#0B6AFF'
365
- }
366
- }), h("path", {
367
- "attrs": {
368
- "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,0 76.9864699,0 C55.8825877,0 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
369
- "id": "el_EYKQ2N9Kgy",
370
- "fillRule": "nonzero"
371
- }
372
- }), h("g", {
373
- "attrs": {
374
- "id": "el_6SDP2LAgKC"
375
- }
376
- }, [h("mask", {
377
- "attrs": {
378
- "id": "mask-2",
379
- "fill": "#fff"
380
- }
381
- }, [h("use", {
382
- "attrs": {
383
- "xlink:href": "#path-1"
384
- }
385
- })]), h("path", {
386
- "attrs": {
387
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
388
- "id": "el_-Vm65Ltfy7",
389
- "fillRule": "nonzero",
390
- "mask": "url(#mask-2)"
391
- }
392
- }), h("rect", {
393
- "attrs": {
394
- "id": "el_q04iZcSim4",
395
- "mask": "url(#mask-2)",
396
- "x": "0.279",
397
- "width": "77",
398
- "height": "130"
399
- }
400
- })]), h("g", {
401
- "attrs": {
402
- "id": "el_6WKby7wXqV"
403
- }
404
- }, [h("mask", {
405
- "attrs": {
406
- "id": "mask-4",
407
- "fill": "#fff"
408
- }
409
- }, [h("use", {
410
- "attrs": {
411
- "xlink:href": "#path-3"
412
- }
413
- })]), h("path", {
414
- "attrs": {
415
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
416
- "id": "el_9bggsfQOtU",
417
- "fillRule": "nonzero",
418
- "mask": "url(#mask-4)"
419
- }
420
- }), h("rect", {
421
- "attrs": {
422
- "id": "el_NKxqi9eIym",
423
- "mask": "url(#mask-4)",
424
- "x": "0.279",
425
- "width": "77",
426
- "height": "115"
427
- }
428
- })]), h("g", {
429
- "attrs": {
430
- "id": "el_Wi-my975tM"
431
- }
432
- }, [h("mask", {
433
- "attrs": {
434
- "id": "mask-6",
435
- "fill": "#fff"
436
- }
437
- }, [h("use", {
438
- "attrs": {
439
- "xlink:href": "#path-5"
440
- }
441
- })]), h("path", {
442
- "attrs": {
443
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
444
- "id": "el_zclQ34fvf7",
445
- "fillRule": "nonzero",
446
- "mask": "url(#mask-6)"
447
- }
448
- }), h("rect", {
449
- "attrs": {
450
- "id": "el_1OsvRT8HkeZ",
451
- "mask": "url(#mask-6)",
452
- "x": "0.279",
453
- "width": "77",
454
- "height": "100"
455
- }
456
- })]), h("g", {
457
- "attrs": {
458
- "id": "el_DkfFFTaFxy8"
459
- }
460
- }, [h("mask", {
461
- "attrs": {
462
- "id": "mask-8",
463
- "fill": "#fff"
464
- }
465
- }, [h("use", {
466
- "attrs": {
467
- "xlink:href": "#path-7"
468
- }
469
- })]), h("path", {
470
- "attrs": {
471
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
472
- "id": "el_aa9sjx4H0vA",
473
- "fillRule": "nonzero",
474
- "mask": "url(#mask-8)"
475
- }
476
- }), h("rect", {
477
- "attrs": {
478
- "id": "el_tea114vWg0J",
479
- "mask": "url(#mask-8)",
480
- "x": "0.279",
481
- "width": "77",
482
- "height": "85"
483
- }
484
- })]), h("g", {
485
- "attrs": {
486
- "id": "el_34IgwiMB5rf"
487
- }
488
- }, [h("mask", {
489
- "attrs": {
490
- "id": "mask-10",
491
- "fill": "#fff"
492
- }
493
- }, [h("use", {
494
- "attrs": {
495
- "xlink:href": "#path-9"
496
- }
497
- })]), h("path", {
498
- "attrs": {
499
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
500
- "id": "el_z5u6RAFhx7d",
501
- "fillRule": "nonzero",
502
- "mask": "url(#mask-10)"
503
- }
504
- }), h("rect", {
505
- "attrs": {
506
- "id": "el_7nfuWmA5Uhy",
507
- "mask": "url(#mask-10)",
508
- "x": "0.279",
509
- "width": "77",
510
- "height": "70"
511
- }
512
- })]), h("g", {
513
- "attrs": {
514
- "id": "el_DeebuCsPTGA"
515
- }
516
- }, [h("mask", {
517
- "attrs": {
518
- "id": "mask-12",
519
- "fill": "#fff"
520
- }
521
- }, [h("use", {
522
- "attrs": {
523
- "xlink:href": "#path-11"
524
- }
525
- })]), h("path", {
526
- "attrs": {
527
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
528
- "id": "el__ZcqlS20zcw",
529
- "fillRule": "nonzero",
530
- "mask": "url(#mask-12)"
531
- }
532
- }), h("rect", {
533
- "attrs": {
534
- "id": "el_8DnEQnD7VWV",
535
- "mask": "url(#mask-12)",
536
- "x": "0.279",
537
- "width": "77",
538
- "height": "55"
539
- }
540
- })]), h("g", {
541
- "attrs": {
542
- "id": "el_ZOjjrPTvyrv"
543
- }
544
- }, [h("mask", {
545
- "attrs": {
546
- "id": "mask-14",
547
- "fill": "#fff"
548
- }
549
- }, [h("use", {
550
- "attrs": {
551
- "xlink:href": "#path-13"
552
- }
553
- })]), h("path", {
554
- "attrs": {
555
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
556
- "id": "el_FYYKCI_u24e",
557
- "fillRule": "nonzero",
558
- "mask": "url(#mask-14)"
559
- }
560
- }), h("rect", {
561
- "attrs": {
562
- "id": "el_XZty4MnTp5Y",
563
- "mask": "url(#mask-14)",
564
- "x": "0.279",
565
- "width": "77",
566
- "height": "40"
567
- }
568
- })]), h("g", {
569
- "attrs": {
570
- "id": "el_2FATegVmf0K"
571
- }
572
- }, [h("mask", {
573
- "attrs": {
574
- "id": "mask-16",
575
- "fill": "#fff"
576
- }
577
- }, [h("use", {
578
- "attrs": {
579
- "xlink:href": "#path-15"
580
- }
581
- })]), h("path", {
582
- "attrs": {
583
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
584
- "id": "el_RMT1KUfbdF8",
585
- "fillRule": "nonzero",
586
- "mask": "url(#mask-16)"
587
- }
588
- }), h("rect", {
589
- "attrs": {
590
- "id": "el_RgLcovvFiO1",
591
- "mask": "url(#mask-16)",
592
- "x": "0.279",
593
- "width": "77",
594
- "height": "25"
595
- }
596
- })])])])]);
597
- }
598
- };
599
-
600
- var STATUS = {
601
- inactive: 'INACTIVE',
602
- stopped: 'STOPPED',
603
- active: 'ACTIVE',
604
- denied: 'DENIED'
605
- };
606
- var Mic = {
607
- name: 'Mic',
608
- props: {
609
- children: types.title,
610
- lang: VueTypes.string.def('en-US'),
611
- iconPosition: VueTypes.string.def('left'),
612
- handleResult: types.func,
613
- onNoMatch: types.func,
614
- onError: types.func,
615
- getInstance: types.func,
616
- render: types.func,
617
- className: types.string,
618
- applyClearStyle: VueTypes.bool,
619
- showIcon: VueTypes.bool
620
- },
621
- methods: {
622
- getComponent: function getComponent$1() {
623
- var status = this.$data.status;
624
- var data = {
625
- handleClick: this.handleClick,
626
- status: status
627
- };
628
- return getComponent(data, this);
629
- },
630
- stopMic: function stopMic() {
631
- if (this.instance) {
632
- this.status = STATUS.inactive;
633
- this.instance.stop();
634
- this.instance = null;
635
- }
636
- },
637
- handleClick: function handleClick() {
638
- var _this = this;
639
- this.results = [];
640
- if (window && window.SpeechRecognition) {
641
- var status = this.$data.status;
642
- if (status === STATUS.active) {
643
- this.status = STATUS.inactive;
644
- }
645
- var _this$$props = this.$props,
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;
651
- var _window = window,
652
- SpeechRecognition = _window.SpeechRecognition;
653
- if (this.instance && this.status !== STATUS.denied) {
654
- this.status = STATUS.inactive;
655
- this.instance.stop();
656
- this.instance = null;
657
- return;
658
- }
659
- this.instance = new SpeechRecognition();
660
- this.instance.continuous = true;
661
- this.instance.interimResults = true;
662
- this.instance.lang = lang;
663
- if (getInstance) {
664
- getInstance(this.instance);
665
- }
666
- this.instance.start();
667
- this.instance.onstart = function () {
668
- _this.status = STATUS.active;
669
- };
670
- this.instance.onresult = function (_ref) {
671
- var results = _ref.results,
672
- timeStamp = _ref.timeStamp;
673
- _this.stopMic();
674
- if (handleResult) {
675
- handleResult({
676
- results: results,
677
- timeStamp: timeStamp
678
- });
679
- }
680
- _this.results.push({
681
- results: results,
682
- timeStamp: timeStamp
683
- });
684
- };
685
- this.instance.onnomatch = function (e) {
686
- return onNoMatch ? onNoMatch(e) : console.warn(e);
687
- };
688
- this.instance.onerror = function (e) {
689
- if (e.error === 'no-speech' || e.error === 'audio-capture') {
690
- _this.status = STATUS.inactive;
691
- } else if (e.error === 'not-allowed') {
692
- _this.status = STATUS.denied;
693
- }
694
- console.error(e);
695
- if (onError) {
696
- onError(e);
697
- }
698
- };
699
-
700
- /* Below Two methods run when Continuous is False */
701
- this.instance.onspeechend = function () {
702
- _this.status = STATUS.inactive;
703
- };
704
- this.instance.onaudioend = function () {
705
- _this.status = STATUS.inactive;
706
- };
707
- }
708
- }
709
- },
710
- computed: {
711
- hasCustomRenderer: function hasCustomRenderer$1() {
712
- return hasCustomRenderer(this);
713
- },
714
- Icon: function Icon() {
715
- var h = this.$createElement;
716
- var status = this.$data.status;
717
- var className = this.$props.className;
718
- switch (status) {
719
- case STATUS.active:
720
- return h(ListenSvg, {
721
- "attrs": {
722
- "className": className
723
- },
724
- "nativeOn": {
725
- "click": this.handleClick
726
- }
727
- });
728
- case STATUS.stopped:
729
- case STATUS.denied:
730
- return h(MuteSvg, {
731
- "attrs": {
732
- "className": className
733
- },
734
- "nativeOn": {
735
- "click": this.handleClick
736
- }
737
- });
738
- default:
739
- return h(MicSvg, {
740
- "attrs": {
741
- "className": className
742
- },
743
- "nativeOn": {
744
- "click": this.handleClick
745
- }
746
- });
747
- }
748
- }
749
- },
750
- data: function data() {
751
- return {
752
- status: STATUS.inactive
753
- };
754
- },
755
- created: function created() {
756
- this.results = [];
757
- if (typeof window !== 'undefined') {
758
- window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition || null;
759
- if (!window.SpeechRecognition) {
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.');
761
- }
762
- }
763
- },
764
- render: function render() {
765
- var h = arguments[0];
766
- if (this.hasCustomRenderer) {
767
- return this.getComponent();
768
- }
769
- return h(IconWrapper, [this.Icon]);
770
- }
771
- };
772
-
773
- var CustomSvg = {
774
- name: 'CustomSvg',
775
- props: {
776
- className: String,
777
- icon: Function,
778
- type: String
779
- },
780
- data: function data() {
781
- return {
782
- customIcon: this.$props.icon && typeof this.$props.icon === 'function' ? this.$props.icon() : null
783
- };
784
- },
785
- render: function render() {
786
- var h = arguments[0];
787
- if (this.customIcon) {
788
- return h("div", {
789
- "class": this.$props.className
790
- }, [this.customIcon]);
791
- }
792
- if (this.$props.type === 'recent-search-icon') {
793
- return h("svg", {
794
- "attrs": {
795
- "xmlns": "http://www.w3.org/2000/svg",
796
- "alt": "Recent Search",
797
- "height": "20",
798
- "width": "20",
799
- "viewBox": "0 0 24 24"
800
- },
801
- "style": {
802
- fill: '#707070'
803
- },
804
- "class": this.$props.className
805
- }, [h("path", {
806
- "attrs": {
807
- "d": "M0 0h24v24H0z",
808
- "fill": "none"
809
- }
810
- }), h("path", {
811
- "attrs": {
812
- "d": "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"
813
- }
814
- })]);
815
- }
816
- if (this.$props.type === 'promoted-search-icon') {
817
- return h("svg", {
818
- "attrs": {
819
- "xmlns": "http://www.w3.org/2000/svg",
820
- "width": "20",
821
- "alt": "promoted search",
822
- "height": "20",
823
- "viewBox": "0 0 24 24"
824
- },
825
- "class": this.$props.className,
826
- "style": {
827
- fill: '#707070'
828
- }
829
- }, [h("path", {
830
- "attrs": {
831
- "d": "M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"
832
- }
833
- })]);
834
- }
835
- if (this.$props.type === 'popular-search-icon') {
836
- return h("svg", {
837
- "attrs": {
838
- "xmlns": "http://www.w3.org/2000/svg",
839
- "alt": "Popular Search",
840
- "height": "20",
841
- "width": "20",
842
- "viewBox": "0 0 24 24"
843
- },
844
- "style": {
845
- fill: '#707070'
846
- },
847
- "class": this.$props.className
848
- }, [h("path", {
849
- "attrs": {
850
- "d": "M0 0h24v24H0z",
851
- "fill": "none"
852
- }
853
- }), h("path", {
854
- "attrs": {
855
- "d": "M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"
856
- }
857
- })]);
858
- }
859
- return h(SearchSvg, {
860
- "attrs": {
861
- "styles": {
862
- position: 'relative',
863
- fill: '#707070',
864
- left: '3px',
865
- marginRight: '8px'
866
- }
867
- }
868
- });
869
- }
870
- };
871
-
872
- var _templateObject$6, _templateObject2;
873
- var TagsContainer = styled('div')(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
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"])));
875
-
876
- var updateQuery = Actions.updateQuery,
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;
885
- var debounce = helper.debounce,
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;
897
- var DataSearch = {
898
- name: 'DataSearch',
899
- isTagsMode: false,
900
- data: function data() {
901
- var props = this.$props;
902
- this.__state = {
903
- currentValue: '',
904
- selectedTags: [],
905
- isOpen: false,
906
- normalizedSuggestions: [],
907
- isPending: false
908
- };
909
- this.internalComponent = props.componentId + "__internal";
910
- return this.__state;
911
- },
912
- inject: {
913
- theme: {
914
- from: 'theme_reactivesearch'
915
- }
916
- },
917
- created: function created() {
918
- var _this$$props = this.$props,
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;
924
- if (mode === SEARCH_COMPONENTS_MODES.TAG) {
925
- this.$options.isTagsMode = true;
926
- }
927
- if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
928
- console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
929
- }
930
- if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
931
- console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
932
- }
933
- if (!this.enableAppbase && index) {
934
- console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
935
- }
936
- this.currentValue = '';
937
- if (this.$options.isTagsMode) {
938
- this.currentValue = '';
939
- }
940
- var shouldFetchInitialSuggestions = this.$props.enableDefaultSuggestions || this.currentValue;
941
- if (shouldFetchInitialSuggestions) {
942
- this.loadPopularSuggestions(this.$props.componentId);
943
- if (enableRecentSearches) {
944
- this.getRecentSearches();
945
- }
946
- }
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
950
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
951
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
952
- this.updateDefaultQueryHandlerDebounced(this.currentValue, this.$props, false);
953
- },
954
- computed: {
955
- suggestionsList: function suggestionsList() {
956
- var suggestionsList = [];
957
- if (!this.$data.currentValue && this.$props.defaultSuggestions && this.$props.defaultSuggestions.length) {
958
- suggestionsList = this.$props.defaultSuggestions;
959
- } else if (this.$data.currentValue) {
960
- suggestionsList = this.normalizedSuggestions;
961
- }
962
- return withClickIds(suggestionsList);
963
- },
964
- topSuggestions: function topSuggestions() {
965
- if (!this.currentValue) {
966
- return [];
967
- }
968
- return this.enablePopularSuggestions ? this.normalizedPopularSuggestions : [];
969
- },
970
- normalizedRecentSearches: function normalizedRecentSearches() {
971
- return this.recentSearches || [];
972
- },
973
- normalizedPopularSuggestions: function normalizedPopularSuggestions() {
974
- return getTopSuggestions(
975
- // use default popular suggestions if value is empty
976
- this.currentValue ? this.popularSuggestions : this.defaultPopularSuggestions || [], this.currentValue, this.showDistinctSuggestions);
977
- },
978
- defaultSearchSuggestions: function defaultSearchSuggestions() {
979
- var isPopularSuggestionsEnabled = this.enablePopularSuggestions;
980
- if (this.currentValue || !this.enableDefaultSuggestions) {
981
- return [];
982
- }
983
- var customDefaultPopularSuggestions = (this.defaultPopularSuggestions || []).map(function (suggestion) {
984
- return _extends({}, suggestion, {
985
- _popular_suggestion: true
986
- });
987
- });
988
- var customNormalizedRecentSearches = (this.normalizedRecentSearches || []).map(function (search) {
989
- return _extends({}, search, {
990
- _recent_search: true
991
- });
992
- });
993
- var defaultSuggestions = isPopularSuggestionsEnabled ? [].concat(customNormalizedRecentSearches, customDefaultPopularSuggestions || []) : customNormalizedRecentSearches;
994
- return getTopSuggestions(
995
- // use default popular suggestions if value is empty
996
- defaultSuggestions, this.currentValue, this.showDistinctSuggestions);
997
- },
998
- hasCustomRenderer: function hasCustomRenderer$1() {
999
- return hasCustomRenderer(this);
1000
- },
1001
- stats: function stats() {
1002
- return getResultStats(this);
1003
- }
1004
- },
1005
- props: {
1006
- options: types.options,
1007
- autoFocus: VueTypes.bool,
1008
- autosuggest: VueTypes.bool.def(true),
1009
- beforeValueChange: types.func,
1010
- className: VueTypes.string.def(''),
1011
- clearIcon: types.children,
1012
- componentId: types.stringRequired,
1013
- customHighlight: types.func,
1014
- customQuery: types.func,
1015
- defaultQuery: types.func,
1016
- dataField: VueTypes.oneOfType([VueTypes.string, VueTypes.shape({
1017
- field: VueTypes.string,
1018
- weight: VueTypes.number
1019
- }), VueTypes.arrayOf(VueTypes.string), VueTypes.arrayOf({
1020
- field: VueTypes.string,
1021
- weight: VueTypes.number
1022
- })]),
1023
- aggregationField: types.string,
1024
- aggregationSize: VueTypes.number,
1025
- size: VueTypes.number,
1026
- debounce: VueTypes.number.def(0),
1027
- defaultValue: types.string,
1028
- excludeFields: types.excludeFields,
1029
- value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), types.value]),
1030
- defaultSuggestions: types.suggestions,
1031
- enableSynonyms: VueTypes.bool.def(true),
1032
- enablePopularSuggestions: VueTypes.bool.def(false),
1033
- enableRecentSearches: VueTypes.bool.def(false),
1034
- fieldWeights: types.fieldWeights,
1035
- filterLabel: types.string,
1036
- fuzziness: types.fuzziness,
1037
- highlight: VueTypes.bool,
1038
- highlightField: types.stringOrArray,
1039
- icon: types.children,
1040
- iconPosition: VueTypes.oneOf(['left', 'right']).def('left'),
1041
- includeFields: types.includeFields,
1042
- innerClass: types.style,
1043
- innerRef: VueTypes.string.def('searchInputField'),
1044
- render: types.func,
1045
- renderPopularSuggestions: types.func,
1046
- parseSuggestion: types.func,
1047
- renderNoSuggestion: types.title,
1048
- renderError: types.title,
1049
- placeholder: VueTypes.string.def('Search'),
1050
- queryFormat: VueTypes.oneOf(['and', 'or']).def('or'),
1051
- react: types.react,
1052
- showClear: VueTypes.bool.def(true),
1053
- showDistinctSuggestions: VueTypes.bool.def(true),
1054
- showFilter: VueTypes.bool.def(true),
1055
- showIcon: VueTypes.bool.def(true),
1056
- title: types.title,
1057
- theme: types.style,
1058
- URLParams: VueTypes.bool.def(false),
1059
- strictSelection: VueTypes.bool.def(false),
1060
- nestedField: types.string,
1061
- enablePredictiveSuggestions: VueTypes.bool.def(false),
1062
- recentSearchesIcon: VueTypes.any,
1063
- popularSearchesIcon: VueTypes.any,
1064
- // mic props
1065
- showVoiceSearch: VueTypes.bool.def(false),
1066
- getMicInstance: types.func,
1067
- renderMic: types.func,
1068
- distinctField: types.string,
1069
- distinctFieldConfig: types.props,
1070
- //
1071
- focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1072
- addonBefore: VueTypes.any,
1073
- addonAfter: VueTypes.any,
1074
- expandSuggestionsContainer: VueTypes.bool.def(true),
1075
- index: VueTypes.string,
1076
- enableDefaultSuggestions: VueTypes.bool.def(true),
1077
- mode: VueTypes.oneOf(['select', 'tag']).def('select'),
1078
- renderSelectedTags: VueTypes.any,
1079
- endpoint: types.endpointConfig
1080
- },
1081
- beforeMount: function beforeMount() {
1082
- if (this.$props.highlight) {
1083
- if (this.customHighlight && typeof this.customHighlight === 'function') {
1084
- this.setCustomHighlightOptions(this.componentId, this.customHighlight(this.$props));
1085
- }
1086
- var queryOptions = DataSearch.highlightQuery(this.$props) || {};
1087
- this.queryOptions = _extends({}, queryOptions, this.getBasicQueryOptions());
1088
- this.setQueryOptions(this.$props.componentId, this.queryOptions);
1089
- } else {
1090
- this.queryOptions = this.getBasicQueryOptions();
1091
- this.setQueryOptions(this.$props.componentId, this.queryOptions);
1092
- }
1093
- if (this.selectedValue) {
1094
- this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1095
- } else if (this.$props.value) {
1096
- this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1097
- } else if (this.$props.defaultValue) {
1098
- this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1099
- }
1100
- },
1101
- mounted: function mounted() {
1102
- this.listenForFocusShortcuts();
1103
- },
1104
- watch: {
1105
- highlight: function highlight() {
1106
- this.updateQueryOptions();
1107
- },
1108
- dataField: function dataField() {
1109
- this.updateQueryOptions();
1110
- this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1111
- },
1112
- highlightField: function highlightField() {
1113
- this.updateQueryOptions();
1114
- },
1115
- fieldWeights: function fieldWeights() {
1116
- this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1117
- },
1118
- fuzziness: function fuzziness() {
1119
- this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1120
- },
1121
- queryFormat: function queryFormat() {
1122
- this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
1123
- },
1124
- defaultValue: function defaultValue(newVal) {
1125
- this.setValue(newVal, true, this.$props);
1126
- },
1127
- value: function value(newVal, oldVal) {
1128
- if (!isEqual(newVal, oldVal) || this.$options.isTagsMode && !isEqual(newVal, this.selectedTags)) {
1129
- if (this.isPending && this.$options.isTagsMode && Array.isArray(newVal)) {
1130
- this.isPending = false;
1131
- }
1132
- this.setValue(newVal, true, this.$props, undefined, false, typeof newVal !== 'string' && this.$options.isTagsMode);
1133
- }
1134
- },
1135
- defaultQuery: function defaultQuery(newVal, oldVal) {
1136
- if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1137
- this.updateDefaultQueryHandlerDebounced(this.$data.currentValue, this.$props);
1138
- }
1139
- },
1140
- customQuery: function customQuery(newVal, oldVal) {
1141
- if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1142
- this.updateQueryHandler(this.componentId, this.$data.currentValue, this.$props);
1143
- }
1144
- },
1145
- suggestions: function suggestions(newVal) {
1146
- if (Array.isArray(newVal) && this.$data.currentValue.trim().length) {
1147
- // shallow check allows us to set suggestions even if the next set
1148
- // of suggestions are same as the current one
1149
- this.$emit('suggestions', newVal);
1150
- this.normalizedSuggestions = this.onSuggestions(newVal);
1151
- }
1152
- },
1153
- selectedValue: function selectedValue(newVal, oldVal) {
1154
- if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
1155
- if (!newVal && this.$data.currentValue) {
1156
- // selected value is cleared, call onValueSelected
1157
- this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1158
- }
1159
- if (this.$options.isTagsMode) {
1160
- // handling reset of tags through SelectedFilters or URL
1161
- this.selectedTags = [];
1162
- }
1163
- this.setValue(newVal || '', true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1164
- }
1165
- },
1166
- focusShortcuts: function focusShortcuts() {
1167
- this.listenForFocusShortcuts();
1168
- }
1169
- },
1170
- methods: {
1171
- handleText: function handleText(value) {
1172
- if (this.$props.autosuggest) {
1173
- this.updateDefaultQueryHandlerDebounced(value, this.$props);
1174
- } else {
1175
- this.updateDefaultQueryHandlerDebounced(this.$props.componentId, value, this.$props);
1176
- }
1177
- },
1178
- validateDataField: function validateDataField() {
1179
- var propName = 'dataField';
1180
- var componentName = DataSearch.name;
1181
- var props = this.$props;
1182
- var requiredError = propName + " supplied to " + componentName + " is required. Validation failed.";
1183
- var propValue = props[propName];
1184
- if (!this.enableAppbase) {
1185
- if (!propValue) {
1186
- console.error(requiredError);
1187
- return;
1188
- }
1189
- if (typeof propValue !== 'string' && typeof propValue !== 'object' && !Array.isArray(propValue)) {
1190
- console.error("Invalid " + propName + " supplied to " + componentName + ". Validation failed.");
1191
- return;
1192
- }
1193
- if (Array.isArray(propValue) && propValue.length === 0) {
1194
- console.error(requiredError);
1195
- }
1196
- }
1197
- },
1198
- updateQueryOptions: function updateQueryOptions() {
1199
- if (this.customHighlight && typeof this.customHighlight === 'function') {
1200
- this.setCustomHighlightOptions(this.componentId, this.customHighlight(this.$props));
1201
- }
1202
- var queryOptions = DataSearch.highlightQuery(this.$props) || {};
1203
- this.queryOptions = _extends({}, queryOptions, this.getBasicQueryOptions());
1204
- this.setQueryOptions(this.$props.componentId, this.queryOptions);
1205
- },
1206
- getComponent: function getComponent$1(downshiftProps, isQuerySuggestionsRender) {
1207
- if (downshiftProps === void 0) {
1208
- downshiftProps = {};
1209
- }
1210
- if (isQuerySuggestionsRender === void 0) {
1211
- isQuerySuggestionsRender = false;
1212
- }
1213
- var currentValue = this.$data.currentValue;
1214
- var data = {
1215
- error: this.error,
1216
- loading: this.isLoading,
1217
- downshiftProps: downshiftProps,
1218
- data: this.suggestionsList,
1219
- promotedData: this.promotedResults,
1220
- aggregationData: this.aggregationData,
1221
- rawData: this.rawData,
1222
- customData: this.customData,
1223
- value: currentValue,
1224
- triggerClickAnalytics: this.triggerClickAnalytics,
1225
- resultStats: this.stats,
1226
- querySuggestions: this.normalizedPopularSuggestions,
1227
- popularSuggestions: this.normalizedPopularSuggestions
1228
- };
1229
- if (isQuerySuggestionsRender) {
1230
- return getQuerySuggestionsComponent({
1231
- downshiftProps: downshiftProps,
1232
- data: this.normalizedPopularSuggestions,
1233
- value: currentValue,
1234
- loading: this.isLoading,
1235
- error: this.error
1236
- }, this);
1237
- }
1238
- return getComponent(data, this);
1239
- },
1240
- // returns size and aggs property
1241
- getBasicQueryOptions: function getBasicQueryOptions() {
1242
- var aggregationField = this.$props.aggregationField;
1243
- var queryOptions = getQueryOptions(this.$props);
1244
- if (aggregationField) {
1245
- queryOptions.aggs = getCompositeAggsQuery({
1246
- props: this.$props,
1247
- showTopHits: true
1248
- }).aggs;
1249
- }
1250
- return queryOptions;
1251
- },
1252
- onSuggestions: function onSuggestions(results) {
1253
- return handleOnSuggestions(results, this.$data.currentValue, this);
1254
- },
1255
- handleSearchIconClick: function handleSearchIconClick() {
1256
- var currentValue = this.currentValue;
1257
- if (currentValue.trim()) {
1258
- this.isPending = false;
1259
- this.setValue(currentValue, true);
1260
- this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
1261
- }
1262
- },
1263
- setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, isTagsMode) {
1264
- var _this = this;
1265
- if (isDefaultValue === void 0) {
1266
- isDefaultValue = false;
1267
- }
1268
- if (props === void 0) {
1269
- props = this.$props;
1270
- }
1271
- if (toggleIsOpen === void 0) {
1272
- toggleIsOpen = true;
1273
- }
1274
- if (isTagsMode === void 0) {
1275
- isTagsMode = this.$options.isTagsMode;
1276
- }
1277
- var performUpdate = function performUpdate() {
1278
- if (isTagsMode && isEqual(value, _this.selectedTags)) {
1279
- return;
1280
- }
1281
- // Refresh recent searches when value becomes empty
1282
- if (!value && props.enableDefaultSuggestions === false) {
1283
- _this.resetStoreForComponent(props.componentId);
1284
- } else if (!value && _this.currentValue && _this.enableRecentSearches) {
1285
- _this.getRecentSearches();
1286
- }
1287
- if (isTagsMode) {
1288
- if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1289
- // check if value already present in selectedTags
1290
- if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1291
- _this.isOpen = false;
1292
- return;
1293
- }
1294
- _this.selectedTags = [].concat(_this.selectedTags);
1295
- if (typeof value === 'string' && !!value) {
1296
- _this.selectedTags.push(value);
1297
- } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1298
- _this.selectedTags = value;
1299
- }
1300
- } else if (value) {
1301
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1302
- }
1303
- _this.currentValue = '';
1304
- } else {
1305
- _this.currentValue = value;
1306
- }
1307
- var queryHandlerValue = value;
1308
- if (isTagsMode) {
1309
- queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1310
- }
1311
- if (isDefaultValue) {
1312
- if (_this.$props.autosuggest) {
1313
- if (toggleIsOpen) {
1314
- _this.isOpen = false;
1315
- }
1316
- if (typeof value === 'string') _this.updateDefaultQueryHandlerDebounced(value, _this.$props);
1317
- } // in case of strict selection only SUGGESTION_SELECT should be able
1318
- // to set the query otherwise the value should reset
1319
-
1320
- if (props.strictSelection) {
1321
- if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1322
- _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
1323
- } else {
1324
- _this.setValue('', true);
1325
- }
1326
- } else {
1327
- _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
1328
- }
1329
- } else {
1330
- // debounce for handling text while typing
1331
- _this.handleTextChange(value);
1332
- }
1333
- _this.$emit('valueChange', value);
1334
- _this.$emit('value-change', value);
1335
- // Set the already fetched suggestions if query is same as used last to fetch the hits
1336
- if (value === _this.lastUsedQuery) {
1337
- _this.suggestions = _this.onSuggestions(_this.suggestions);
1338
- // invoke on suggestions
1339
- _this.$emit('suggestions', _this.suggestions);
1340
- } else if (!value) {
1341
- // reset suggestions
1342
- _this.suggestions = [];
1343
- // invoke on suggestions
1344
- _this.$emit('suggestions', _this.suggestions);
1345
- }
1346
- };
1347
- checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1348
- },
1349
- updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props, execute) {
1350
- if (props === void 0) {
1351
- props = this.$props;
1352
- }
1353
- if (!value && props.enableDefaultSuggestions === false) {
1354
- // clear Component data from store
1355
- this.resetStoreForComponent(props.componentId);
1356
- return;
1357
- }
1358
- var defaultQueryOptions;
1359
- var query = DataSearch.defaultQuery(value, props);
1360
- if (this.defaultQuery) {
1361
- var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
1362
- var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
1363
- if (defaultQueryObj) {
1364
- query = defaultQueryObj;
1365
- }
1366
- defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
1367
- // Update calculated default query in store
1368
- updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
1369
- }
1370
- this.setQueryOptions(this.internalComponent, _extends({}, this.queryOptions, defaultQueryOptions), execute);
1371
- this.updateQuery({
1372
- componentId: this.internalComponent,
1373
- query: query,
1374
- value: value,
1375
- componentType: componentTypes.dataSearch
1376
- }, execute);
1377
- },
1378
- updateQueryHandler: function updateQueryHandler(componentId, value, props) {
1379
- var customQuery = props.customQuery,
1380
- filterLabel = props.filterLabel,
1381
- showFilter = props.showFilter,
1382
- URLParams = props.URLParams;
1383
- var customQueryOptions;
1384
- var defaultQueryTobeSet = DataSearch.defaultQuery(value, props);
1385
- var query = defaultQueryTobeSet;
1386
- if (customQuery) {
1387
- var customQueryTobeSet = customQuery(value, props);
1388
- var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
1389
- if (queryTobeSet) {
1390
- query = queryTobeSet;
1391
- }
1392
- customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
1393
- updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
1394
- this.setQueryOptions(componentId, _extends({}, this.queryOptions, customQueryOptions), false);
1395
- }
1396
- if (!this.isPending) {
1397
- this.updateQuery({
1398
- componentId: componentId,
1399
- query: query,
1400
- value: value,
1401
- label: filterLabel,
1402
- showFilter: showFilter,
1403
- URLParams: URLParams,
1404
- componentType: 'DATASEARCH'
1405
- });
1406
- }
1407
- },
1408
- // need to review
1409
- handleFocus: function handleFocus(event) {
1410
- this.isOpen = true;
1411
- this.$emit('focus', event);
1412
- },
1413
- handleVoiceResults: function handleVoiceResults(_ref) {
1414
- var results = _ref.results;
1415
- if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1416
- this.isPending = false;
1417
- this.setValue(results[0][0].transcript.trim(), true);
1418
- }
1419
- },
1420
- triggerQuery: function triggerQuery(_temp) {
1421
- var _ref2 = _temp === void 0 ? false : _temp,
1422
- _ref2$isOpen = _ref2.isOpen,
1423
- isOpen = _ref2$isOpen === void 0 ? false : _ref2$isOpen;
1424
- var value = this.$props.value;
1425
- if (value !== undefined) {
1426
- this.isPending = false;
1427
- this.setValue(this.$props.value, !isOpen);
1428
- }
1429
- },
1430
- triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
1431
- // click analytics would only work client side and after javascript loads
1432
- var docId = documentId;
1433
- if (!docId) {
1434
- var hitData = this.suggestionsList.find(function (hit) {
1435
- return hit._click_id === searchPosition;
1436
- });
1437
- if (hitData && hitData.source && hitData.source._id) {
1438
- docId = hitData.source._id;
1439
- }
1440
- }
1441
- this.recordSuggestionClick(searchPosition, docId);
1442
- },
1443
- clearValue: function clearValue() {
1444
- this.isPending = false;
1445
- this.setValue('', true);
1446
- this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1447
- },
1448
- handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1449
- var value = this.$props.value;
1450
- if (value !== undefined) {
1451
- this.isPending = true;
1452
- }
1453
-
1454
- // if a suggestion was selected, delegate the handling to suggestion handler
1455
- if (event.key === 'Enter' && highlightedIndex === null) {
1456
- this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
1457
- );
1458
-
1459
- this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1460
- }
1461
- // Need to review
1462
- this.$emit('keyDown', event, this.triggerQuery);
1463
- this.$emit('key-down', event, this.triggerQuery);
1464
- },
1465
- onInputChange: function onInputChange(e) {
1466
- var _this2 = this;
1467
- var inputValue = e.target.value;
1468
- if (!this.$data.isOpen) {
1469
- this.isOpen = true;
1470
- }
1471
- var _this$$props2 = this.$props,
1472
- value = _this$$props2.value,
1473
- autosuggest = _this$$props2.autosuggest;
1474
- if (value === undefined) {
1475
- this.setValue(inputValue, false, this.$props, undefined, true, false);
1476
- } else {
1477
- this.isPending = true;
1478
- this.$emit('change', inputValue, function (_temp2) {
1479
- var _ref3 = _temp2 === void 0 ? {} : _temp2,
1480
- _ref3$isOpen = _ref3.isOpen,
1481
- isOpen = _ref3$isOpen === void 0 ? false : _ref3$isOpen;
1482
- if (_this2.$options.isTagsMode && autosuggest) {
1483
- _this2.currentValue = value;
1484
- _this2.isOpen = isOpen;
1485
- _this2.updateDefaultQueryHandlerDebounced(_this2.currentValue, _this2.$props);
1486
- return;
1487
- }
1488
- _this2.triggerQuery({
1489
- isOpen: isOpen
1490
- });
1491
- }, e);
1492
- }
1493
- },
1494
- onSuggestionSelected: function onSuggestionSelected(suggestion) {
1495
- var value = this.$props.value;
1496
- // Record analytics for selected suggestions
1497
- this.triggerClickAnalytics(suggestion._click_id);
1498
- if (value === undefined) {
1499
- this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT);
1500
- } else if (this.$options.isTagsMode) {
1501
- var emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
1502
- if (this.selectedTags.includes(suggestion.value)) {
1503
- // avoid duplicates in tags array
1504
- this.isOpen = false;
1505
- return;
1506
- }
1507
- emitValue.push(suggestion.value);
1508
- this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, true);
1509
- this.$emit('change', emitValue, this.triggerQuery);
1510
- } else {
1511
- this.$emit('change', suggestion.value, this.triggerQuery);
1512
- }
1513
- this.isPending = false;
1514
- this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1515
- },
1516
- onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1517
- if (currentValue === void 0) {
1518
- currentValue = this.$data.currentValue;
1519
- }
1520
- for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1521
- cause[_key - 1] = arguments[_key];
1522
- }
1523
- this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
1524
- this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
1525
- },
1526
- handleStateChange: function handleStateChange(changes) {
1527
- var isOpen = changes.isOpen;
1528
- this.isOpen = isOpen;
1529
- },
1530
- getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
1531
- var isDark = this.themePreset === 'dark';
1532
- if (isDark) {
1533
- return highlightedIndex === index ? '#555' : '#424242';
1534
- }
1535
- return highlightedIndex === index ? '#eee' : '#fff';
1536
- },
1537
- renderIcon: function renderIcon() {
1538
- var h = this.$createElement;
1539
- if (this.$props.showIcon) {
1540
- return this.$props.icon || h(SearchSvg);
1541
- }
1542
- return null;
1543
- },
1544
- renderErrorComponent: function renderErrorComponent() {
1545
- var h = this.$createElement;
1546
- var renderError = this.$scopedSlots.renderError || this.$props.renderError;
1547
- if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1548
- return h(SuggestionWrapper, {
1549
- "attrs": {
1550
- "innerClass": this.$props.innerClass,
1551
- "innerClassName": "error",
1552
- "theme": this.theme,
1553
- "themePreset": this.themePreset
1554
- }
1555
- }, [isFunction(renderError) ? renderError(this.error) : renderError]);
1556
- }
1557
- return null;
1558
- },
1559
- renderCancelIcon: function renderCancelIcon() {
1560
- var h = this.$createElement;
1561
- if (this.$props.showClear) {
1562
- return this.$props.clearIcon || h(CancelSvg);
1563
- }
1564
- return null;
1565
- },
1566
- renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
1567
- if (finalSuggestionsList === void 0) {
1568
- finalSuggestionsList = [];
1569
- }
1570
- var h = this.$createElement;
1571
- var _this$$props3 = this.$props,
1572
- theme = _this$$props3.theme,
1573
- innerClass = _this$$props3.innerClass;
1574
- var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
1575
- var renderError = this.$scopedSlots.renderError || this.$props.renderError;
1576
- var _this$$data = this.$data,
1577
- isOpen = _this$$data.isOpen,
1578
- currentValue = _this$$data.currentValue;
1579
- if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
1580
- return h(SuggestionWrapper, {
1581
- "attrs": {
1582
- "innerClass": innerClass,
1583
- "themePreset": this.themePreset,
1584
- "theme": theme,
1585
- "innerClassName": "noSuggestion"
1586
- },
1587
- "scopedSlots": {
1588
- "default": function _default() {
1589
- return typeof renderNoSuggestion === 'function' ? renderNoSuggestion(currentValue) : renderNoSuggestion;
1590
- }
1591
- }
1592
- });
1593
- }
1594
- return null;
1595
- },
1596
- renderInputAddonBefore: function renderInputAddonBefore() {
1597
- var h = this.$createElement;
1598
- var addonBefore = this.$scopedSlots.addonBefore;
1599
- if (addonBefore) {
1600
- return h(InputAddon, [addonBefore()]);
1601
- }
1602
- return null;
1603
- },
1604
- renderTag: function renderTag(item) {
1605
- var _this3 = this;
1606
- var h = this.$createElement;
1607
- var innerClass = this.$props.innerClass;
1608
- return h(TagItem, {
1609
- "class": getClassName$1(innerClass, 'selected-tag') || ''
1610
- }, [h("span", [item]), h("span", {
1611
- "attrs": {
1612
- "role": "img",
1613
- "aria-label": "delete-tag"
1614
- },
1615
- "class": "close-icon",
1616
- "on": {
1617
- "click": function click() {
1618
- return _this3.clearTag(item);
1619
- }
1620
- }
1621
- }, [h(CancelSvg)])]);
1622
- },
1623
- clearAllTags: function clearAllTags() {
1624
- this.selectedTags = [];
1625
- this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1626
- if (this.$props.value !== undefined) {
1627
- this.$emit('change', this.selectedTags, this.triggerQuery);
1628
- }
1629
- },
1630
- clearTag: function clearTag(tagValue) {
1631
- this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1632
- return tag !== tagValue;
1633
- }));
1634
- this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1635
- if (this.$props.value !== undefined) {
1636
- this.$emit('change', this.selectedTags, this.triggerQuery);
1637
- }
1638
- },
1639
- renderTags: function renderTags() {
1640
- var _this4 = this;
1641
- var h = this.$createElement;
1642
- if (!Array.isArray(this.selectedTags)) {
1643
- return null;
1644
- }
1645
- var tagsList = [].concat(this.selectedTags);
1646
- var shouldRenderClearAllTag = tagsList.length > 1;
1647
- var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
1648
- return renderSelectedTags ? renderSelectedTags({
1649
- values: this.selectedTags,
1650
- handleClear: this.clearTag,
1651
- handleClearAll: this.clearAllTags
1652
- }) : h(TagsContainer, [tagsList.map(function (item) {
1653
- return _this4.renderTag(item);
1654
- }), shouldRenderClearAllTag && h(TagItem, {
1655
- "class": getClassName$1(this.$props.innerClass, 'selected-tag') || ''
1656
- }, [h("span", ["Clear All"]), h("span", {
1657
- "attrs": {
1658
- "role": "img",
1659
- "aria-label": "delete-tag"
1660
- },
1661
- "class": "close-icon",
1662
- "on": {
1663
- "click": this.clearAllTags
1664
- }
1665
- }, [h(CancelSvg)])])]);
1666
- },
1667
- renderInputAddonAfter: function renderInputAddonAfter() {
1668
- var h = this.$createElement;
1669
- var addonAfter = this.$scopedSlots.addonAfter;
1670
- if (addonAfter) {
1671
- return h(InputAddon, [addonAfter()]);
1672
- }
1673
- return null;
1674
- },
1675
- renderIcons: function renderIcons() {
1676
- var h = this.$createElement;
1677
- var _this$$props4 = this.$props,
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;
1684
- var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
1685
- var currentValue = this.$data.currentValue;
1686
- return h("div", [h(IconGroup, {
1687
- "attrs": {
1688
- "groupPosition": "right",
1689
- "positionType": "absolute"
1690
- }
1691
- }, [currentValue && showClear && h(IconWrapper, {
1692
- "on": {
1693
- "click": this.clearValue
1694
- },
1695
- "attrs": {
1696
- "showIcon": showIcon,
1697
- "isClearIcon": true
1698
- }
1699
- }, [this.renderCancelIcon()]), showVoiceSearch && h(Mic, {
1700
- "attrs": {
1701
- "getInstance": getMicInstance,
1702
- "render": renderMic,
1703
- "handleResult": this.handleVoiceResults,
1704
- "className": getClassName$1(innerClass, 'mic') || null
1705
- }
1706
- }), iconPosition === 'right' && showIcon && h(IconWrapper, {
1707
- "on": {
1708
- "click": this.handleSearchIconClick
1709
- }
1710
- }, [this.renderIcon()])]), h(IconGroup, {
1711
- "attrs": {
1712
- "groupPosition": "left",
1713
- "positionType": "absolute"
1714
- }
1715
- }, [iconPosition === 'left' && showIcon && h(IconWrapper, {
1716
- "on": {
1717
- "click": this.handleSearchIconClick
1718
- }
1719
- }, [this.renderIcon()])])]);
1720
- },
1721
- focusSearchBox: function focusSearchBox(event) {
1722
- var _this$$refs, _this$$refs$this$$pro;
1723
- var elt = event.target || event.srcElement;
1724
- var tagName = elt.tagName;
1725
- if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1726
- // already in an input
1727
- return;
1728
- }
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
1730
- },
1731
- listenForFocusShortcuts: function listenForFocusShortcuts() {
1732
- var _this5 = this;
1733
- var _this$$props$focusSho = this.$props.focusShortcuts,
1734
- focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1735
- if (isEmpty(focusShortcuts)) {
1736
- return;
1737
- }
1738
- var shortcutsString = parseFocusShortcuts(focusShortcuts).join(',');
1739
-
1740
- // handler for alphabets and other key combinations
1741
- hotkeys(shortcutsString,
1742
- // eslint-disable-next-line no-unused-vars
1743
- /* eslint-disable no-shadow */
1744
- function (event, handler) {
1745
- // Prevent the default refresh event under WINDOWS system
1746
- event.preventDefault();
1747
- _this5.focusSearchBox(event);
1748
- });
1749
-
1750
- // if one of modifier keys are used, they are handled below
1751
- hotkeys('*', function (event) {
1752
- var modifierKeys = extractModifierKeysFromFocusShortcuts(focusShortcuts);
1753
- if (modifierKeys.length === 0) return;
1754
- for (var index = 0; index < modifierKeys.length; index += 1) {
1755
- var element = modifierKeys[index];
1756
- if (hotkeys[element]) {
1757
- _this5.focusSearchBox(event);
1758
- break;
1759
- }
1760
- }
1761
- });
1762
- }
1763
- },
1764
- render: function render() {
1765
- var _this6 = this;
1766
- var h = arguments[0];
1767
- var _this$$props5 = this.$props,
1768
- theme = _this$$props5.theme,
1769
- size = _this$$props5.size,
1770
- expandSuggestionsContainer = _this$$props5.expandSuggestionsContainer,
1771
- enableDefaultSuggestions = _this$$props5.enableDefaultSuggestions;
1772
- var _this$$scopedSlots = this.$scopedSlots,
1773
- recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
1774
- popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
1775
- var hasSuggestions = this.currentValue ? this.suggestionsList.length || this.topSuggestions.length : this.defaultSearchSuggestions.length;
1776
- if (enableDefaultSuggestions === false && !this.currentValue) {
1777
- hasSuggestions = false;
1778
- }
1779
- return h(Container, {
1780
- "class": this.$props.className
1781
- }, [this.$props.title && h(Title, {
1782
- "class": getClassName$1(this.$props.innerClass, 'title') || ''
1783
- }, [this.$props.title]), this.$props.defaultSuggestions || this.$props.autosuggest ? h(Downshift, {
1784
- "attrs": {
1785
- "id": this.$props.componentId + "-downshift",
1786
- "handleChange": this.onSuggestionSelected,
1787
- "handleMouseup": this.handleStateChange,
1788
- "isOpen": this.$data.isOpen
1789
- },
1790
- "scopedSlots": {
1791
- "default": function _default(_ref4) {
1792
- var getInputEvents = _ref4.getInputEvents,
1793
- getInputProps = _ref4.getInputProps,
1794
- getItemProps = _ref4.getItemProps,
1795
- getItemEvents = _ref4.getItemEvents,
1796
- isOpen = _ref4.isOpen,
1797
- highlightedIndex = _ref4.highlightedIndex,
1798
- setHighlightedIndex = _ref4.setHighlightedIndex;
1799
- var renderSuggestionsContainer = function renderSuggestionsContainer() {
1800
- return h("div", [_this6.hasCustomRenderer && _this6.getComponent({
1801
- isOpen: isOpen,
1802
- getItemProps: getItemProps,
1803
- getItemEvents: getItemEvents,
1804
- highlightedIndex: highlightedIndex
1805
- }), _this6.renderErrorComponent(), !_this6.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1806
- "class": suggestions(_this6.themePreset, theme) + " " + getClassName$1(_this6.$props.innerClass, 'list')
1807
- }, [_this6.suggestionsList.slice(0, size || 10).map(function (item, index) {
1808
- return h("li", {
1809
- "domProps": _extends({}, getItemProps({
1810
- item: item
1811
- })),
1812
- "on": _extends({}, getItemEvents({
1813
- item: item
1814
- })),
1815
- "key": index + 1 + "-" + item.value,
1816
- "style": {
1817
- backgroundColor: _this6.getBackgroundColor(highlightedIndex, index)
1818
- }
1819
- }, [h(SuggestionItem, {
1820
- "attrs": {
1821
- "currentValue": _this6.currentValue,
1822
- "suggestion": item
1823
- }
1824
- })]);
1825
- }), _this6.defaultSearchSuggestions.map(function (sugg, index) {
1826
- return h("li", {
1827
- "domProps": _extends({}, getItemProps({
1828
- item: sugg
1829
- })),
1830
- "on": _extends({}, getItemEvents({
1831
- item: sugg
1832
- })),
1833
- "key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
1834
- "style": {
1835
- backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
1836
- justifyContent: 'flex-start'
1837
- }
1838
- }, [h("div", {
1839
- "style": {
1840
- padding: '0 10px 0 0'
1841
- }
1842
- }, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
1843
- "attrs": {
1844
- "className": getClassName$1(_this6.$props.innerClass, 'recent-search-icon') || null,
1845
- "icon": recentSearchesIcon,
1846
- "type": "recent-search-icon"
1847
- }
1848
- }), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
1849
- "attrs": {
1850
- "className": getClassName$1(_this6.$props.innerClass, 'popular-search-icon') || null,
1851
- "icon": popularSearchesIcon,
1852
- "type": "popular-search-icon"
1853
- }
1854
- })]), h(SuggestionItem, {
1855
- "attrs": {
1856
- "currentValue": _this6.currentValue,
1857
- "suggestion": sugg
1858
- }
1859
- })]);
1860
- }), hasQuerySuggestionsRenderer(_this6) ? _this6.getComponent({
1861
- isOpen: isOpen,
1862
- getItemProps: getItemProps,
1863
- getItemEvents: getItemEvents,
1864
- highlightedIndex: highlightedIndex
1865
- }, true) : _this6.topSuggestions.map(function (sugg, index) {
1866
- return h("li", {
1867
- "domProps": _extends({}, getItemProps({
1868
- item: sugg
1869
- })),
1870
- "on": _extends({}, getItemEvents({
1871
- item: sugg
1872
- })),
1873
- "key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
1874
- "style": {
1875
- backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
1876
- justifyContent: 'flex-start'
1877
- }
1878
- }, [h("div", {
1879
- "style": {
1880
- padding: '0 10px 0 0'
1881
- }
1882
- }, [h(CustomSvg, {
1883
- "attrs": {
1884
- "className": getClassName$1(_this6.$props.innerClass, 'popular-search-icon') || null,
1885
- "icon": popularSearchesIcon,
1886
- "type": "popular-search-icon"
1887
- }
1888
- })]), h(SuggestionItem, {
1889
- "attrs": {
1890
- "currentValue": _this6.currentValue,
1891
- "suggestion": sugg
1892
- }
1893
- })]);
1894
- })]) : _this6.renderNoSuggestions(_this6.suggestionsList)]);
1895
- };
1896
- return h("div", {
1897
- "class": suggestionsContainer
1898
- }, [h(InputGroup, [_this6.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1899
- "attrs": {
1900
- "id": _this6.$props.componentId + "-input",
1901
- "showIcon": _this6.$props.showIcon,
1902
- "showClear": _this6.$props.showClear,
1903
- "iconPosition": _this6.$props.iconPosition,
1904
- "placeholder": _this6.$props.placeholder,
1905
- "autoFocus": _this6.$props.autoFocus,
1906
- "themePreset": _this6.themePreset,
1907
- "autocomplete": "off"
1908
- },
1909
- "ref": _this6.$props.innerRef,
1910
- "class": getClassName$1(_this6.$props.innerClass, 'input'),
1911
- "on": _extends({}, getInputEvents({
1912
- onInput: _this6.onInputChange,
1913
- onBlur: function onBlur(e) {
1914
- _this6.$emit('blur', e, _this6.triggerQuery);
1915
- },
1916
- onFocus: _this6.handleFocus,
1917
- onKeyPress: function onKeyPress(e) {
1918
- _this6.$emit('keyPress', e, _this6.triggerQuery);
1919
- _this6.$emit('key-press', e, _this6.triggerQuery);
1920
- },
1921
- onKeyDown: function onKeyDown(e) {
1922
- return _this6.handleKeyDown(e, highlightedIndex);
1923
- },
1924
- onKeyUp: function onKeyUp(e) {
1925
- _this6.$emit('keyUp', e, _this6.triggerQuery);
1926
- _this6.$emit('key-up', e, _this6.triggerQuery);
1927
- },
1928
- onClick: function onClick() {
1929
- setHighlightedIndex(null);
1930
- }
1931
- })),
1932
- "domProps": _extends({}, getInputProps({
1933
- value: _this6.$data.currentValue === null ? '' : _this6.$data.currentValue
1934
- }))
1935
- }), _this6.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this6.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this6.renderTags()]);
1936
- }
1937
- }
1938
- }) : h("div", {
1939
- "class": suggestionsContainer
1940
- }, [h(InputGroup, [this.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1941
- "class": getClassName$1(this.$props.innerClass, 'input') || '',
1942
- "attrs": {
1943
- "placeholder": this.$props.placeholder,
1944
- "iconPosition": this.$props.iconPosition,
1945
- "showIcon": this.$props.showIcon,
1946
- "showClear": this.$props.showClear,
1947
- "themePreset": this.themePreset
1948
- },
1949
- "on": _extends({}, {
1950
- blur: function blur(e) {
1951
- _this6.$emit('blur', e, _this6.triggerQuery);
1952
- },
1953
- keypress: function keypress(e) {
1954
- _this6.$emit('keyPress', e, _this6.triggerQuery);
1955
- _this6.$emit('key-press', e, _this6.triggerQuery);
1956
- },
1957
- input: this.onInputChange,
1958
- focus: function focus(e) {
1959
- _this6.$emit('focus', e, _this6.triggerQuery);
1960
- },
1961
- keydown: function keydown(e) {
1962
- _this6.$emit('keyDown', e, _this6.triggerQuery);
1963
- _this6.$emit('key-down', e, _this6.triggerQuery);
1964
- },
1965
- keyup: function keyup(e) {
1966
- _this6.$emit('keyUp', e, _this6.triggerQuery);
1967
- _this6.$emit('key-up', e, _this6.triggerQuery);
1968
- }
1969
- }),
1970
- "domProps": _extends({}, {
1971
- autofocus: this.$props.autoFocus,
1972
- value: this.$data.currentValue ? this.$data.currentValue : ''
1973
- }),
1974
- "ref": this.$props.innerRef
1975
- }), this.renderIcons()]), this.renderInputAddonAfter()])])]);
1976
- },
1977
- destroyed: function destroyed() {
1978
- document.removeEventListener('keydown', this.onKeyDown);
1979
- }
1980
- };
1981
- DataSearch.defaultQuery = function (value, props) {
1982
- var finalQuery = null;
1983
- if (value) {
1984
- var fields = normalizeDataField(props.dataField, props.fieldWeights);
1985
- finalQuery = {
1986
- bool: {
1987
- should: DataSearch.shouldQuery(value, fields, props),
1988
- minimum_should_match: '1'
1989
- }
1990
- };
1991
- }
1992
- if (value === '') {
1993
- finalQuery = null;
1994
- }
1995
- if (finalQuery && props.nestedField) {
1996
- return {
1997
- query: {
1998
- nested: {
1999
- path: props.nestedField,
2000
- query: finalQuery
2001
- }
2002
- }
2003
- };
2004
- }
2005
- return finalQuery;
2006
- };
2007
- DataSearch.shouldQuery = function (value, dataFields, props) {
2008
- var finalQuery = [];
2009
- var phrasePrefixFields = [];
2010
- var fields = dataFields.map(function (dataField) {
2011
- var queryField = "" + dataField.field + (dataField.weight ? "^" + dataField.weight : '');
2012
- if (!(dataField.field.endsWith('.keyword') || dataField.field.endsWith('.autosuggest') || dataField.field.endsWith('.search'))) {
2013
- phrasePrefixFields.push(queryField);
2014
- }
2015
- return queryField;
2016
- });
2017
- if (props.searchOperators || props.queryString) {
2018
- return {
2019
- query: value,
2020
- fields: fields,
2021
- default_operator: props.queryFormat
2022
- };
2023
- }
2024
- if (props.queryFormat === 'and') {
2025
- finalQuery.push({
2026
- multi_match: {
2027
- query: value,
2028
- fields: fields,
2029
- type: 'cross_fields',
2030
- operator: 'and'
2031
- }
2032
- });
2033
- finalQuery.push({
2034
- multi_match: {
2035
- query: value,
2036
- fields: fields,
2037
- type: 'phrase',
2038
- operator: 'and'
2039
- }
2040
- });
2041
- if (phrasePrefixFields.length > 0) {
2042
- finalQuery.push({
2043
- multi_match: {
2044
- query: value,
2045
- fields: phrasePrefixFields,
2046
- type: 'phrase_prefix',
2047
- operator: 'and'
2048
- }
2049
- });
2050
- }
2051
- return finalQuery;
2052
- }
2053
- finalQuery.push({
2054
- multi_match: {
2055
- query: value,
2056
- fields: fields,
2057
- type: 'best_fields',
2058
- operator: 'or',
2059
- fuzziness: props.fuzziness ? props.fuzziness : 0
2060
- }
2061
- });
2062
- finalQuery.push({
2063
- multi_match: {
2064
- query: value,
2065
- fields: fields,
2066
- type: 'phrase',
2067
- operator: 'or'
2068
- }
2069
- });
2070
- if (phrasePrefixFields.length > 0) {
2071
- finalQuery.push({
2072
- multi_match: {
2073
- query: value,
2074
- fields: phrasePrefixFields,
2075
- type: 'phrase_prefix',
2076
- operator: 'or'
2077
- }
2078
- });
2079
- }
2080
- return finalQuery;
2081
- };
2082
- DataSearch.highlightQuery = function (props) {
2083
- if (props.customHighlight) {
2084
- return props.customHighlight(props);
2085
- }
2086
- if (!props.highlight) {
2087
- return null;
2088
- }
2089
- var fields = {};
2090
- var highlightField = props.highlightField ? props.highlightField : props.dataField;
2091
- if (typeof highlightField === 'string') {
2092
- fields[highlightField] = {};
2093
- } else if (Array.isArray(highlightField)) {
2094
- highlightField.forEach(function (item) {
2095
- fields[item] = {};
2096
- });
2097
- }
2098
- return {
2099
- highlight: _extends({
2100
- pre_tags: ['<mark>'],
2101
- post_tags: ['</mark>'],
2102
- fields: fields
2103
- }, props.highlightField && {
2104
- require_field_match: false
2105
- })
2106
- };
2107
- };
2108
- DataSearch.hasInternalComponent = function () {
2109
- return true;
2110
- };
2111
- var mapStateToProps = function mapStateToProps(state, props) {
2112
- return {
2113
- selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
2114
- suggestions: state.hits[props.componentId] && state.hits[props.componentId].hits,
2115
- rawData: state.rawData[props.componentId],
2116
- aggregationData: state.compositeAggregations[props.componentId] || [],
2117
- isLoading: !!state.isLoading[props.componentId + "_active"],
2118
- themePreset: state.config.themePreset,
2119
- error: state.error[props.componentId],
2120
- analytics: state.analytics,
2121
- enableAppbase: state.config.enableAppbase,
2122
- headers: state.appbaseRef.headers,
2123
- promotedResults: state.promotedResults[props.componentId] || [],
2124
- customData: state.customData[props.componentId],
2125
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
2126
- total: state.hits[props.componentId] && state.hits[props.componentId].total,
2127
- hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
2128
- popularSuggestions: state.querySuggestions[props.componentId],
2129
- defaultPopularSuggestions: state.defaultPopularSuggestions[props.componentId],
2130
- componentProps: state.props[props.componentId],
2131
- lastUsedQuery: state.queryToHits[props.componentId],
2132
- recentSearches: state.recentSearches.data
2133
- };
2134
- };
2135
- var mapDispatchToProps = {
2136
- setQueryOptions: setQueryOptions,
2137
- updateQuery: updateQuery,
2138
- setCustomQuery: setCustomQuery,
2139
- setDefaultQuery: setDefaultQuery,
2140
- setCustomHighlightOptions: setCustomHighlightOptions,
2141
- recordSuggestionClick: recordSuggestionClick,
2142
- loadPopularSuggestions: loadPopularSuggestions,
2143
- getRecentSearches: getRecentSearches,
2144
- resetStoreForComponent: resetStoreForComponent
2145
- };
2146
- var DSConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
2147
- componentType: componentTypes.dataSearch,
2148
- internalComponent: DataSearch.hasInternalComponent()
2149
- }));
2150
- DSConnected.name = DataSearch.name;
2151
-
2152
- // plugins usage
2153
- DSConnected.install = function (Vue) {
2154
- Vue.component(DSConnected.name, DSConnected);
2155
- };
2156
- // Add componentType for SSR
2157
- DSConnected.componentType = componentTypes.dataSearch;
2158
-
2159
- export { CustomSvg as C, DSConnected as D, InputAddon as I, Mic as M, SearchSvg as S, TagItem as T, DSConnected as a, SuggestionWrapper as b, TagsContainer as c, InputGroup as d, SuggestionItem as e };