@appbaseio/reactivesearch-vue 1.28.0 → 1.29.0-preview.1

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