@appbaseio/reactivesearch-vue 3.0.0-rc.5.alpha.2 → 3.0.0-rc.5.alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1 -1
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +1 -1
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{DropDown-b16418e9.js → CancelSvg-ab0f8b23.js} +0 -290
  6. package/dist/cjs/DropDown-e7125b72.js +299 -0
  7. package/dist/cjs/MultiDropdownList.js +2 -1
  8. package/dist/cjs/{install-7cdf6798.js → SearchBox.js} +21 -867
  9. package/dist/cjs/SingleDropdownList.js +2 -1
  10. package/dist/cjs/index.js +7 -5
  11. package/dist/cjs/install-3c4520bf.js +874 -0
  12. package/dist/cjs/install.js +4 -2
  13. package/dist/cjs/version.js +1 -1
  14. package/dist/es/{Button-a376dd9b.js → Button-fd869491.js} +1 -1
  15. package/dist/es/CancelSvg-e7ae49e9.js +401 -0
  16. package/dist/es/{Card-56bd984e.js → Card-54b9e7a0.js} +2 -2
  17. package/dist/es/{ComponentWrapper-b43a546e.js → ComponentWrapper-8a3c388d.js} +4 -3
  18. package/dist/es/{Container-6c21a1e6.js → Container-d00219f7.js} +1 -1
  19. package/dist/es/DropDown-13afb4d2.js +295 -0
  20. package/dist/es/DynamicRangeSlider.js +7 -6
  21. package/dist/es/{Flex-651f2422.js → Flex-25792bc3.js} +1 -1
  22. package/dist/es/{FormControlList-be0456b0.js → FormControlList-fe6eaee4.js} +1 -1
  23. package/dist/es/{Input-3126d7b6.js → Input-f7499ef8.js} +1 -1
  24. package/dist/es/{ListItem-a25ed63a.js → ListItem-e3c6acf4.js} +2 -2
  25. package/dist/es/MultiDropdownList.js +15 -12
  26. package/dist/es/MultiList.js +12 -10
  27. package/dist/es/MultiRange.js +10 -9
  28. package/dist/es/{Pagination-874e01df.js → Pagination-c2745bec.js} +2 -2
  29. package/dist/es/{PreferencesConsumer-9a3b0bac.js → PreferencesConsumer-b058d14e.js} +2 -2
  30. package/dist/es/RangeInput.js +12 -11
  31. package/dist/es/RangeSlider.js +9 -8
  32. package/dist/es/ReactiveBase.js +17 -5508
  33. package/dist/es/ReactiveComponent.js +6 -5
  34. package/dist/es/ReactiveGoogleMap.js +10 -9
  35. package/dist/es/ReactiveList.js +14 -13
  36. package/dist/es/ResultCard.js +3 -3
  37. package/dist/es/ResultList.js +3 -3
  38. package/dist/es/SearchBox.js +1847 -0
  39. package/dist/es/SelectedFilters.js +7 -6
  40. package/dist/es/SingleDropdownList.js +15 -12
  41. package/dist/es/SingleList.js +12 -10
  42. package/dist/es/SingleRange.js +10 -9
  43. package/dist/es/StateProvider.js +4 -3
  44. package/dist/es/{Title-4b7614be.js → Title-863dfa42.js} +1 -1
  45. package/dist/es/ToggleButton.js +9 -8
  46. package/dist/es/_rollupPluginBabelHelpers-ded08042.js +61 -0
  47. package/dist/es/{index-b2212b15.js → index-882489e1.js} +3 -67
  48. package/dist/es/index.js +31 -22
  49. package/dist/es/initReactivesearch.js +3 -2291
  50. package/dist/es/install-ff8b0750.js +868 -0
  51. package/dist/es/install.js +28 -21
  52. package/dist/es/{ssr-26e0b4af.js → ssr-c630ccb9.js} +1 -1
  53. package/dist/es/utils-d7dd4f4e.js +60 -0
  54. package/dist/es/version.js +1 -1
  55. package/package.json +2 -2
  56. package/dist/es/DropDown-59c3fbc7.js +0 -690
  57. package/dist/es/_rollupPluginBabelHelpers-dac426db.js +0 -423
  58. package/dist/es/helper-39773859.js +0 -558
  59. package/dist/es/index-b9203a60.js +0 -10
  60. package/dist/es/install-d7f59dee.js +0 -4008
  61. package/dist/es/transform-e41c9e5c.js +0 -412
  62. package/dist/es/utils-782d91c4.js +0 -1315
@@ -1,4008 +0,0 @@
1
- import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
- import { g as getComponent, h as hasCustomRenderer, S as SEARCH_COMPONENTS_MODES, j as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, a as componentTypes$1, k as updateCustomQuery, b as isFunction, l as isEmpty, p as parseFocusShortcuts, m as extractModifierKeysFromFocusShortcuts, c as connect, T as TREELIST_VALUES_PATH_SEPARATOR } from './index-b2212b15.js';
3
- import { _ as _transformOn } from './index-b9203a60.js';
4
- import { a as _taggedTemplateLiteralLoose, _ as _extends } from './_rollupPluginBabelHelpers-dac426db.js';
5
- import { createVNode, createTextVNode, defineComponent, isVNode, mergeProps, h } from 'vue';
6
- import VueTypes from 'vue-types';
7
- import { g as getQueryOptions, s as suggestionTypes, r as recLookup, a as getClassName$2, u as updateCustomQuery$1, b as updateDefaultQuery$1, c as transformTreeListLocalStateIntoQueryComptaibleFormat, i as isEqual$1, d as transformRawTreeListData, e as setDeep, f as getComponent$1, h as getOptionsFromQuery, j as checkValueChange$1, k as getAggsQuery, l as updateInternalQuery, m as isFunction$1 } from './helper-39773859.js';
8
- import { styled, createGlobalStyle } from '@appbaseio/vue-emotion';
9
- import { css } from '@emotion/css';
10
- import { B as Button } from './Button-a376dd9b.js';
11
- import { t as types$1 } from './vueTypes-f1923c72.js';
12
- import { RLConnected as ReactiveList } from './ReactiveList.js';
13
- import { g as getInternalComponentID } from './transform-e41c9e5c.js';
14
- import { C as ComponentWrapper } from './ComponentWrapper-b43a546e.js';
15
- import { P as PreferencesConsumer } from './PreferencesConsumer-9a3b0bac.js';
16
- import { T as Title } from './Title-4b7614be.js';
17
- import { L as ListItem } from './ListItem-a25ed63a.js';
18
- import { F as Flex } from './Flex-651f2422.js';
19
- import ReactiveBase from './ReactiveBase.js';
20
- import hotkeys from 'hotkeys-js';
21
- import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-59c3fbc7.js';
22
- import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-3126d7b6.js';
23
- import { C as Container } from './Container-6c21a1e6.js';
24
- import Highlight from 'vue-highlight-words';
25
- import { s as sanitizeObject, r as replaceDiacritics } from './utils-782d91c4.js';
26
- import { C as Checkbox, R as Radio } from './FormControlList-be0456b0.js';
27
- import { ListConnected as SingleList } from './SingleList.js';
28
- import { ListConnected as MultiList } from './MultiList.js';
29
- import { ListConnected as SingleDropdownList } from './SingleDropdownList.js';
30
- import { ListConnected as MultiDropdownList } from './MultiDropdownList.js';
31
- import { TBConnected as ToggleButton } from './ToggleButton.js';
32
- import ReactiveComponent from './ReactiveComponent.js';
33
- import { RangeConnected as DynamicRangeSlider } from './DynamicRangeSlider.js';
34
- import { RangeConnected as SingleRange } from './SingleRange.js';
35
- import { RangeConnected as MultiRange } from './MultiRange.js';
36
- import { RangeConnected as RangeSlider } from './RangeSlider.js';
37
- import { RangeConnected as RangeInput } from './RangeInput.js';
38
- import SelectedFilters from './SelectedFilters.js';
39
- import ResultCard from './ResultCard.js';
40
- import ResultList from './ResultList.js';
41
- import StateProvider from './StateProvider.js';
42
-
43
- var _templateObject;
44
- var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
45
- InputGroup.defaultProps = {
46
- className: 'input-group'
47
- };
48
-
49
- var _templateObject$1;
50
- 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"])));
51
- InputAddon.defaultProps = {
52
- className: 'input-addon'
53
- };
54
-
55
- var getClassName = helper.getClassName;
56
- var SuggestionWrapper = {
57
- name: 'SuggestionWrapper',
58
- props: {
59
- innerClassName: types$1.string,
60
- themePreset: types$1.themePreset,
61
- innerClass: types$1.style
62
- },
63
- render: function render() {
64
- var _this$$props = this.$props,
65
- themePreset = _this$$props.themePreset,
66
- innerClass = _this$$props.innerClass,
67
- innerClassName = _this$$props.innerClassName;
68
- return createVNode("div", {
69
- "class": noSuggestions(themePreset) + " " + getClassName(innerClass, innerClassName || '')
70
- }, [createVNode("li", null, [this.$slots["default"]()])]);
71
- }
72
- };
73
-
74
- var _templateObject$2;
75
- var highlightStyle = {
76
- fontWeight: 600,
77
- padding: 0,
78
- backgroundColor: 'transparent',
79
- color: 'inherit'
80
- };
81
- 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"])));
82
- var SuggestionItem = {
83
- name: 'SuggestionItem',
84
- props: {
85
- currentValue: types$1.string,
86
- suggestion: types$1.any
87
- },
88
- render: function render() {
89
- var _this = this;
90
- var _this$suggestion = this.suggestion,
91
- label = _this$suggestion.label,
92
- value = _this$suggestion.value,
93
- title = _this$suggestion.title,
94
- description = _this$suggestion.description,
95
- image = _this$suggestion.image,
96
- isPredictiveSuggestion = _this$suggestion.isPredictiveSuggestion,
97
- _suggestion_type = _this$suggestion._suggestion_type,
98
- _category = _this$suggestion._category;
99
- if (label) {
100
- // label has highest precedence
101
- return typeof label === 'string' ? createVNode("div", {
102
- "class": "trim"
103
- }, [(_category ? false : isPredictiveSuggestion
104
- // eslint-disable-next-line
105
- || !!_suggestion_type) ? createVNode(PredictiveSuggestion, {
106
- "innerHTML": label
107
- }, null) : createVNode(Highlight, {
108
- "searchWords": _category ? [_category] : this.currentValue.split(' '),
109
- "textToHighlight": label,
110
- "autoEscape": true,
111
- "highlightStyle": highlightStyle
112
- }, null)]) : label;
113
- }
114
- if (title || image || description) {
115
- return createVNode(Flex, {
116
- "alignItems": "center",
117
- "css": {
118
- width: '100%'
119
- }
120
- }, {
121
- "default": function _default() {
122
- return [image && createVNode("div", {
123
- "css": {
124
- margin: 'auto',
125
- marginRight: 10
126
- }
127
- }, [createVNode("img", {
128
- "src": image,
129
- "alt": " ",
130
- "height": "50px",
131
- "width": "50px",
132
- "css": {
133
- objectFit: 'contain'
134
- }
135
- }, null)]), createVNode(Flex, {
136
- "direction": "column",
137
- "css": {
138
- width: image ? 'calc(100% - 60px)' : '100%'
139
- }
140
- }, {
141
- "default": function _default() {
142
- return [title && createVNode("div", {
143
- "class": "trim"
144
- }, [createVNode(Highlight, {
145
- "searchWords": _this.currentValue.split(' '),
146
- "textToHighlight": title,
147
- "highlightStyle": highlightStyle,
148
- "class": css({
149
- fontSize: '1rem'
150
- })
151
- }, null)]), description && createVNode("div", {
152
- "class": ['trim', css({
153
- marginTop: 3
154
- })]
155
- }, [createVNode(Highlight, {
156
- "searchWords": _this.currentValue.split(' '),
157
- "textToHighlight": description,
158
- "highlightStyle": highlightStyle
159
- }, null)])];
160
- }
161
- })];
162
- }
163
- });
164
- }
165
- return value;
166
- }
167
- };
168
-
169
- var SearchSvg = {
170
- name: 'SearchSvg',
171
- props: ['styles'],
172
- render: function render() {
173
- return createVNode("svg", {
174
- "alt": "Search",
175
- "class": "search-icon",
176
- "height": "12",
177
- "xmlns": "http://www.w3.org/2000/svg",
178
- "viewBox": "0 0 15 15",
179
- "style": _extends({
180
- transform: 'scale(1.35)',
181
- position: 'relative'
182
- }, this.$props.styles ? this.$props.styles : {})
183
- }, [createVNode("title", null, [createTextVNode("Search")]), createVNode("path", {
184
- "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'
185
- }, null)]);
186
- }
187
- };
188
-
189
- var _templateObject$3;
190
-
191
- // eslint-disable-next-line
192
- createGlobalStyle(_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"])));
193
- var MicSvg = {
194
- name: 'MicSvg',
195
- props: ['className'],
196
- render: function render() {
197
- return createVNode("svg", {
198
- "viewBox": "0 0 480 480",
199
- "xmlns": "http://www.w3.org/2000/svg",
200
- "id": "el_xS0FRzQjJ",
201
- "width": 28,
202
- "height": 28,
203
- "className": this.$props.className,
204
- "style": {
205
- transform: 'scale(1.5)'
206
- }
207
- }, [createVNode("g", {
208
- "id": "el_TvxDfTAtKp",
209
- "fillRule": "evenodd"
210
- }, [createVNode("g", {
211
- "id": "el_D93PK3GbmJ",
212
- "fillRule": "nonzero",
213
- "style": {
214
- fill: '#595959'
215
- }
216
- }, [createVNode("path", {
217
- "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",
218
- "id": "el_uly3EwA2O3"
219
- }, null), createVNode("path", {
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
- }, null)])])]);
223
- }
224
- };
225
-
226
- var _templateObject$4;
227
-
228
- // eslint-disable-next-line
229
- createGlobalStyle(_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"])));
230
- var MuteSvg = {
231
- name: 'MuteSvg',
232
- props: ['className'],
233
- render: function render() {
234
- return createVNode("svg", {
235
- "style": {
236
- transform: 'scale(1.5)'
237
- },
238
- "viewBox": "0 0 480 480",
239
- "xmlns": "http://www.w3.org/2000/svg",
240
- "id": "el_D1rEpH2zj",
241
- "width": 28,
242
- "height": 28,
243
- "className": this.$props.className
244
- }, [createVNode("g", {
245
- "id": "el_X81iT9kZYo",
246
- "fillRule": "evenodd"
247
- }, [createVNode("g", {
248
- "id": "el_gMpyalCphp"
249
- }, [createVNode("path", {
250
- "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",
251
- "id": "el_c7H-3u-D4l",
252
- "fillRule": "nonzero",
253
- "style": {
254
- fill: '#595959'
255
- }
256
- }, null), createVNode("path", {
257
- "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",
258
- "id": "el_qhFcdAAFwo",
259
- "fillRule": "nonzero",
260
- "style": {
261
- fill: '#595959'
262
- }
263
- }, null), createVNode("path", {
264
- "d": "M11.5,206.5 L142.5,12.5",
265
- "id": "el_M8X8g37WOI",
266
- "strokeLinecap": "round",
267
- "strokeLinejoin": "round"
268
- }, null)])])]);
269
- }
270
- };
271
-
272
- var _templateObject$5;
273
-
274
- // eslint-disable-next-line
275
- createGlobalStyle(_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"])));
276
- var ListenSvg = {
277
- name: 'ListenSvg',
278
- props: ['className'],
279
- render: function render() {
280
- return createVNode("svg", {
281
- "viewBox": "0 0 480 480",
282
- "xmlns": "http://www.w3.org/2000/svg",
283
- "xmlnsXlink": "http://www.w3.org/1999/xlink",
284
- "id": "el_hiibMG0x-",
285
- "width": 28,
286
- "height": 29,
287
- "className": this.$props.className,
288
- "style": {
289
- transform: 'scale(1.5)'
290
- }
291
- }, [createVNode("defs", null, [createVNode("path", {
292
- "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",
293
- "id": "path-1"
294
- }, null), createVNode("path", {
295
- "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",
296
- "id": "path-3"
297
- }, null), createVNode("path", {
298
- "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",
299
- "id": "path-5"
300
- }, null), createVNode("path", {
301
- "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",
302
- "id": "path-7"
303
- }, null), createVNode("path", {
304
- "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",
305
- "id": "path-9"
306
- }, null), createVNode("path", {
307
- "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",
308
- "id": "path-11"
309
- }, null), createVNode("path", {
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-13"
312
- }, null), createVNode("path", {
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-15"
315
- }, null)]), createVNode("g", {
316
- "id": "el_QJeJ_2CDw5",
317
- "fillRule": "evenodd"
318
- }, [createVNode("g", {
319
- "id": "el_UYYCfubTRf"
320
- }, [createVNode("path", {
321
- "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",
322
- "id": "el_uzZNtK32Zi",
323
- "fillRule": "nonzero",
324
- "style": {
325
- fill: '#0B6AFF'
326
- }
327
- }, null), createVNode("path", {
328
- "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",
329
- "id": "el_EYKQ2N9Kgy",
330
- "fillRule": "nonzero"
331
- }, null), createVNode("g", {
332
- "id": "el_6SDP2LAgKC"
333
- }, [createVNode("mask", {
334
- "id": "mask-2",
335
- "fill": "#fff"
336
- }, [createVNode("use", {
337
- "xlink:href": "#path-1"
338
- }, null)]), createVNode("path", {
339
- "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",
340
- "id": "el_-Vm65Ltfy7",
341
- "fillRule": "nonzero",
342
- "mask": "url(#mask-2)"
343
- }, null), createVNode("rect", {
344
- "id": "el_q04iZcSim4",
345
- "mask": "url(#mask-2)",
346
- "x": "0.279",
347
- "width": "77",
348
- "height": "130"
349
- }, null)]), createVNode("g", {
350
- "id": "el_6WKby7wXqV"
351
- }, [createVNode("mask", {
352
- "id": "mask-4",
353
- "fill": "#fff"
354
- }, [createVNode("use", {
355
- "xlink:href": "#path-3"
356
- }, null)]), createVNode("path", {
357
- "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",
358
- "id": "el_9bggsfQOtU",
359
- "fillRule": "nonzero",
360
- "mask": "url(#mask-4)"
361
- }, null), createVNode("rect", {
362
- "id": "el_NKxqi9eIym",
363
- "mask": "url(#mask-4)",
364
- "x": "0.279",
365
- "width": "77",
366
- "height": "115"
367
- }, null)]), createVNode("g", {
368
- "id": "el_Wi-my975tM"
369
- }, [createVNode("mask", {
370
- "id": "mask-6",
371
- "fill": "#fff"
372
- }, [createVNode("use", {
373
- "xlink:href": "#path-5"
374
- }, null)]), createVNode("path", {
375
- "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",
376
- "id": "el_zclQ34fvf7",
377
- "fillRule": "nonzero",
378
- "mask": "url(#mask-6)"
379
- }, null), createVNode("rect", {
380
- "id": "el_1OsvRT8HkeZ",
381
- "mask": "url(#mask-6)",
382
- "x": "0.279",
383
- "width": "77",
384
- "height": "100"
385
- }, null)]), createVNode("g", {
386
- "id": "el_DkfFFTaFxy8"
387
- }, [createVNode("mask", {
388
- "id": "mask-8",
389
- "fill": "#fff"
390
- }, [createVNode("use", {
391
- "xlink:href": "#path-7"
392
- }, null)]), createVNode("path", {
393
- "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",
394
- "id": "el_aa9sjx4H0vA",
395
- "fillRule": "nonzero",
396
- "mask": "url(#mask-8)"
397
- }, null), createVNode("rect", {
398
- "id": "el_tea114vWg0J",
399
- "mask": "url(#mask-8)",
400
- "x": "0.279",
401
- "width": "77",
402
- "height": "85"
403
- }, null)]), createVNode("g", {
404
- "id": "el_34IgwiMB5rf"
405
- }, [createVNode("mask", {
406
- "id": "mask-10",
407
- "fill": "#fff"
408
- }, [createVNode("use", {
409
- "xlink:href": "#path-9"
410
- }, null)]), createVNode("path", {
411
- "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",
412
- "id": "el_z5u6RAFhx7d",
413
- "fillRule": "nonzero",
414
- "mask": "url(#mask-10)"
415
- }, null), createVNode("rect", {
416
- "id": "el_7nfuWmA5Uhy",
417
- "mask": "url(#mask-10)",
418
- "x": "0.279",
419
- "width": "77",
420
- "height": "70"
421
- }, null)]), createVNode("g", {
422
- "id": "el_DeebuCsPTGA"
423
- }, [createVNode("mask", {
424
- "id": "mask-12",
425
- "fill": "#fff"
426
- }, [createVNode("use", {
427
- "xlink:href": "#path-11"
428
- }, null)]), createVNode("path", {
429
- "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",
430
- "id": "el__ZcqlS20zcw",
431
- "fillRule": "nonzero",
432
- "mask": "url(#mask-12)"
433
- }, null), createVNode("rect", {
434
- "id": "el_8DnEQnD7VWV",
435
- "mask": "url(#mask-12)",
436
- "x": "0.279",
437
- "width": "77",
438
- "height": "55"
439
- }, null)]), createVNode("g", {
440
- "id": "el_ZOjjrPTvyrv"
441
- }, [createVNode("mask", {
442
- "id": "mask-14",
443
- "fill": "#fff"
444
- }, [createVNode("use", {
445
- "xlink:href": "#path-13"
446
- }, null)]), createVNode("path", {
447
- "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",
448
- "id": "el_FYYKCI_u24e",
449
- "fillRule": "nonzero",
450
- "mask": "url(#mask-14)"
451
- }, null), createVNode("rect", {
452
- "id": "el_XZty4MnTp5Y",
453
- "mask": "url(#mask-14)",
454
- "x": "0.279",
455
- "width": "77",
456
- "height": "40"
457
- }, null)]), createVNode("g", {
458
- "id": "el_2FATegVmf0K"
459
- }, [createVNode("mask", {
460
- "id": "mask-16",
461
- "fill": "#fff"
462
- }, [createVNode("use", {
463
- "xlink:href": "#path-15"
464
- }, null)]), createVNode("path", {
465
- "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",
466
- "id": "el_RMT1KUfbdF8",
467
- "fillRule": "nonzero",
468
- "mask": "url(#mask-16)"
469
- }, null), createVNode("rect", {
470
- "id": "el_RgLcovvFiO1",
471
- "mask": "url(#mask-16)",
472
- "x": "0.279",
473
- "width": "77",
474
- "height": "25"
475
- }, null)])])])]);
476
- }
477
- };
478
-
479
- var STATUS = {
480
- inactive: 'INACTIVE',
481
- stopped: 'STOPPED',
482
- active: 'ACTIVE',
483
- denied: 'DENIED'
484
- };
485
- var Mic = {
486
- name: 'Mic',
487
- props: {
488
- children: types$1.title,
489
- lang: VueTypes.string.def('en-US'),
490
- iconPosition: VueTypes.string.def('left'),
491
- handleResult: types$1.func,
492
- onNoMatch: types$1.func,
493
- onError: types$1.func,
494
- getInstance: types$1.func,
495
- render: types$1.func,
496
- className: types$1.string,
497
- applyClearStyle: VueTypes.bool,
498
- showIcon: VueTypes.bool
499
- },
500
- methods: {
501
- getComponent: function getComponent$1() {
502
- var status = this.$data.status;
503
- var data = {
504
- handleClick: this.handleClick,
505
- status: status
506
- };
507
- return getComponent(data, this);
508
- },
509
- stopMic: function stopMic() {
510
- if (this.instance) {
511
- this.status = STATUS.inactive;
512
- this.instance.stop();
513
- this.instance = null;
514
- }
515
- },
516
- handleClick: function handleClick() {
517
- var _this = this;
518
- this.results = [];
519
- if (window && window.SpeechRecognition) {
520
- var status = this.$data.status;
521
- if (status === STATUS.active) {
522
- this.status = STATUS.inactive;
523
- }
524
- var _this$$props = this.$props,
525
- handleResult = _this$$props.handleResult,
526
- onNoMatch = _this$$props.onNoMatch,
527
- onError = _this$$props.onError,
528
- lang = _this$$props.lang,
529
- getInstance = _this$$props.getInstance;
530
- var _window = window,
531
- SpeechRecognition = _window.SpeechRecognition;
532
- if (this.instance && this.status !== STATUS.denied) {
533
- this.status = STATUS.inactive;
534
- this.instance.stop();
535
- this.instance = null;
536
- return;
537
- }
538
- this.instance = new SpeechRecognition();
539
- this.instance.continuous = true;
540
- this.instance.interimResults = true;
541
- this.instance.lang = lang;
542
- if (getInstance) {
543
- getInstance(this.instance);
544
- }
545
- this.instance.start();
546
- this.instance.onstart = function () {
547
- _this.status = STATUS.active;
548
- };
549
- this.instance.onresult = function (_ref) {
550
- var results = _ref.results,
551
- timeStamp = _ref.timeStamp;
552
- _this.stopMic();
553
- if (handleResult) {
554
- handleResult({
555
- results: results,
556
- timeStamp: timeStamp
557
- });
558
- }
559
- _this.results.push({
560
- results: results,
561
- timeStamp: timeStamp
562
- });
563
- };
564
- this.instance.onnomatch = function (e) {
565
- return onNoMatch ? onNoMatch(e) : console.warn(e);
566
- };
567
- this.instance.onerror = function (e) {
568
- if (e.error === 'no-speech' || e.error === 'audio-capture') {
569
- _this.status = STATUS.inactive;
570
- } else if (e.error === 'not-allowed') {
571
- _this.status = STATUS.denied;
572
- }
573
- console.error(e);
574
- if (onError) {
575
- onError(e);
576
- }
577
- };
578
-
579
- /* Below Two methods run when Continuous is False */
580
- this.instance.onspeechend = function () {
581
- _this.status = STATUS.inactive;
582
- };
583
- this.instance.onaudioend = function () {
584
- _this.status = STATUS.inactive;
585
- };
586
- }
587
- }
588
- },
589
- computed: {
590
- hasCustomRenderer: function hasCustomRenderer$1() {
591
- return hasCustomRenderer(this);
592
- },
593
- Icon: function Icon() {
594
- var status = this.$data.status;
595
- var className = this.$props.className;
596
- switch (status) {
597
- case STATUS.active:
598
- return createVNode(ListenSvg, {
599
- "className": className,
600
- "nativeOnClick": this.handleClick
601
- }, null);
602
- case STATUS.stopped:
603
- case STATUS.denied:
604
- return createVNode(MuteSvg, {
605
- "className": className,
606
- "nativeOnClick": this.handleClick
607
- }, null);
608
- default:
609
- return createVNode(MicSvg, {
610
- "className": className,
611
- "nativeOnClick": this.handleClick
612
- }, null);
613
- }
614
- }
615
- },
616
- data: function data() {
617
- return {
618
- status: STATUS.inactive
619
- };
620
- },
621
- created: function created() {
622
- this.results = [];
623
- if (typeof window !== 'undefined') {
624
- window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition || null;
625
- if (!window.SpeechRecognition) {
626
- 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.');
627
- }
628
- }
629
- },
630
- render: function render() {
631
- var _this2 = this;
632
- if (this.hasCustomRenderer) {
633
- return this.getComponent();
634
- }
635
- return createVNode(IconWrapper, null, {
636
- "default": function _default() {
637
- return [_this2.Icon];
638
- }
639
- });
640
- }
641
- };
642
-
643
- var CustomSvg = {
644
- name: 'CustomSvg',
645
- props: {
646
- className: String,
647
- icon: Function,
648
- type: String
649
- },
650
- data: function data() {
651
- return {
652
- customIcon: this.$props.icon && typeof this.$props.icon === 'function' ? this.$props.icon() : null
653
- };
654
- },
655
- render: function render() {
656
- if (this.customIcon) {
657
- return createVNode("div", {
658
- "class": this.$props.className
659
- }, [this.customIcon]);
660
- }
661
- if (this.$props.type === 'recent-search-icon') {
662
- return createVNode("svg", {
663
- "xmlns": "http://www.w3.org/2000/svg",
664
- "alt": "Recent Search",
665
- "height": "20",
666
- "width": "20",
667
- "viewBox": "0 0 24 24",
668
- "style": {
669
- fill: '#707070'
670
- },
671
- "class": this.$props.className
672
- }, [createVNode("path", {
673
- "d": "M0 0h24v24H0z",
674
- "fill": "none"
675
- }, null), createVNode("path", {
676
- "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"
677
- }, null)]);
678
- }
679
- if (this.$props.type === 'promoted-search-icon') {
680
- return createVNode("svg", {
681
- "xmlns": "http://www.w3.org/2000/svg",
682
- "width": "20",
683
- "alt": "promoted search",
684
- "height": "20",
685
- "viewBox": "0 0 24 24",
686
- "class": this.$props.className,
687
- "style": {
688
- fill: '#707070'
689
- }
690
- }, [createVNode("path", {
691
- "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"
692
- }, null)]);
693
- }
694
- if (this.$props.type === 'popular-search-icon') {
695
- return createVNode("svg", {
696
- "xmlns": "http://www.w3.org/2000/svg",
697
- "alt": "Popular Search",
698
- "height": "20",
699
- "width": "20",
700
- "viewBox": "0 0 24 24",
701
- "style": {
702
- fill: '#707070'
703
- },
704
- "class": this.$props.className
705
- }, [createVNode("path", {
706
- "d": "M0 0h24v24H0z",
707
- "fill": "none"
708
- }, null), createVNode("path", {
709
- "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"
710
- }, null)]);
711
- }
712
- return createVNode(SearchSvg, {
713
- "styles": {
714
- position: 'relative',
715
- fill: '#707070',
716
- left: '3px',
717
- marginRight: '8px'
718
- }
719
- }, null);
720
- }
721
- };
722
-
723
- var _templateObject$6;
724
- var AutofillSvgIcon = styled('button')(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmargin-left: auto;\n\tposition: relative;\n\tright: -3px;\n\tborder: none;\n\toutline: none;\n\tbackground: transparent;\n\tpadding: 0;\n\tz-index: 111000;\n\n\tsvg {\n\t\tcursor: pointer;\n\t\tfill: #707070;\n\t\theight: 20px;\n\t}\n\n\t&:hover {\n\t\tsvg {\n\t\t\tfill: #1c1a1a;\n\t\t}\n\t}\n"])));
725
- var AutoFillSvg = {
726
- name: 'AutoFillSvg',
727
- render: function render() {
728
- return createVNode(AutofillSvgIcon, {
729
- "onClick": this.$attrs.click
730
- }, {
731
- "default": function _default() {
732
- return [createVNode("svg", {
733
- "viewBox": "0 0 24 24"
734
- }, [createVNode("path", {
735
- "d": "M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"
736
- }, null)])];
737
- }
738
- });
739
- },
740
- methods: {
741
- clicked: function clicked(e) {
742
- e.stopPropagation();
743
- window.console.log('hey', e);
744
- }
745
- }
746
- };
747
-
748
- var _templateObject$7, _templateObject2;
749
- var TagsContainer = styled('div')(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
750
- 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"])));
751
-
752
- function _isSlot(s) {
753
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
754
- }
755
- var updateQuery = Actions.updateQuery,
756
- setCustomQuery = Actions.setCustomQuery,
757
- setDefaultQuery = Actions.setDefaultQuery,
758
- recordSuggestionClick = Actions.recordSuggestionClick;
759
- var _debounce = helper.debounce,
760
- checkValueChange = helper.checkValueChange,
761
- getClassName$1 = helper.getClassName,
762
- isEqual = helper.isEqual,
763
- getCompositeAggsQuery = helper.getCompositeAggsQuery,
764
- withClickIds = helper.withClickIds,
765
- getResultStats = helper.getResultStats;
766
- var SearchBox = defineComponent({
767
- name: 'SearchBox',
768
- isTagsMode: false,
769
- data: function data() {
770
- var props = this.$props;
771
- this.__state = {
772
- currentValue: '',
773
- selectedTags: [],
774
- isOpen: false,
775
- normalizedSuggestions: []
776
- };
777
- this.internalComponent = props.componentId + "__internal";
778
- return this.__state;
779
- },
780
- inject: {
781
- theme: {
782
- from: 'theme_reactivesearch'
783
- }
784
- },
785
- created: function created() {
786
- var mode = this.$props.mode;
787
- if (mode === SEARCH_COMPONENTS_MODES.TAG) {
788
- this.$options.isTagsMode = true;
789
- }
790
- if (this.$options.isTagsMode) {
791
- console.warn('Warning(ReactiveSearch): The `categoryField` prop is not supported when `mode` prop is set to `tag`');
792
- }
793
- this.currentValue = decodeHtml(this.selectedValue || this.value || this.defaultValue || '');
794
- if (this.$options.isTagsMode) {
795
- this.currentValue = '';
796
- }
797
- this.handleTextChange = _debounce(this.handleText, this.$props.debounce);
798
-
799
- // Set custom and default queries in store
800
- this.triggerCustomQuery(this.currentValue, this.selectedCategory);
801
- this.triggerDefaultQuery(this.currentValue);
802
- if (this.selectedValue) {
803
- this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
804
- } else if (this.$props.value) {
805
- this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
806
- } else if (this.$props.defaultValue) {
807
- this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
808
- }
809
- },
810
- computed: {
811
- hasCustomRenderer: function hasCustomRenderer$1() {
812
- return hasCustomRenderer(this);
813
- },
814
- stats: function stats() {
815
- return getResultStats(this);
816
- }
817
- },
818
- props: {
819
- autoFocus: VueTypes.bool,
820
- autosuggest: VueTypes.bool.def(true),
821
- beforeValueChange: types$1.func,
822
- className: VueTypes.string.def(''),
823
- clearIcon: types$1.children,
824
- componentId: types$1.stringRequired,
825
- customHighlight: types$1.func,
826
- customQuery: types$1.func,
827
- defaultQuery: types$1.func,
828
- dataField: VueTypes.oneOfType([VueTypes.string, VueTypes.shape({
829
- field: VueTypes.string,
830
- weight: VueTypes.number
831
- }), VueTypes.arrayOf(VueTypes.string), VueTypes.arrayOf({
832
- field: VueTypes.string,
833
- weight: VueTypes.number
834
- })]),
835
- aggregationField: types$1.string,
836
- aggregationSize: VueTypes.number,
837
- size: VueTypes.number,
838
- debounce: VueTypes.number.def(0),
839
- defaultValue: types$1.string,
840
- excludeFields: types$1.excludeFields,
841
- value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), types$1.value]),
842
- defaultSuggestions: types$1.suggestions,
843
- enableSynonyms: VueTypes.bool.def(true),
844
- enableQuerySuggestions: VueTypes.bool.def(false),
845
- enablePopularSuggestions: VueTypes.bool.def(false),
846
- enableRecentSuggestions: VueTypes.bool.def(false),
847
- fieldWeights: types$1.fieldWeights,
848
- filterLabel: types$1.string,
849
- fuzziness: types$1.fuzziness,
850
- highlight: VueTypes.bool,
851
- highlightField: types$1.stringOrArray,
852
- icon: types$1.children,
853
- iconPosition: VueTypes.oneOf(['left', 'right']).def('left'),
854
- includeFields: types$1.includeFields,
855
- innerClass: types$1.style,
856
- innerRef: VueTypes.string.def('searchInputField'),
857
- render: types$1.func,
858
- renderNoSuggestion: types$1.title,
859
- renderError: types$1.title,
860
- placeholder: VueTypes.string.def('Search'),
861
- queryFormat: VueTypes.oneOf(['and', 'or']).def('or'),
862
- react: types$1.react,
863
- showClear: VueTypes.bool.def(true),
864
- showDistinctSuggestions: VueTypes.bool.def(true),
865
- showFilter: VueTypes.bool.def(true),
866
- showIcon: VueTypes.bool.def(true),
867
- title: types$1.title,
868
- URLParams: VueTypes.bool.def(false),
869
- strictSelection: VueTypes.bool.def(false),
870
- nestedField: types$1.string,
871
- enablePredictiveSuggestions: VueTypes.bool.def(false),
872
- recentSearchesIcon: VueTypes.any,
873
- popularSearchesIcon: VueTypes.any,
874
- // mic props
875
- showVoiceSearch: VueTypes.bool.def(false),
876
- getMicInstance: types$1.func,
877
- renderMic: types$1.func,
878
- distinctField: types$1.string,
879
- distinctFieldConfig: types$1.props,
880
- //
881
- focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
882
- addonBefore: VueTypes.any,
883
- addonAfter: VueTypes.any,
884
- expandSuggestionsContainer: VueTypes.bool.def(true),
885
- index: VueTypes.string,
886
- popularSuggestionsConfig: VueTypes.object,
887
- recentSuggestionsConfig: VueTypes.object,
888
- applyStopwords: VueTypes.bool,
889
- customStopwords: types$1.stringArray,
890
- onData: types$1.func,
891
- renderItem: types$1.func,
892
- enterButton: VueTypes.bool.def(false),
893
- renderEnterButton: VueTypes.any,
894
- mode: VueTypes.oneOf(['select', 'tag']).def('select'),
895
- renderSelectedTags: VueTypes.any,
896
- searchboxId: VueTypes.string,
897
- endpoint: types$1.endpointConfig
898
- },
899
- mounted: function mounted() {
900
- this.listenForFocusShortcuts();
901
- },
902
- watch: {
903
- dataField: function dataField(newVal, oldVal) {
904
- if (!isEqual(newVal, oldVal)) {
905
- this.triggerCustomQuery(this.$data.currentValue);
906
- }
907
- },
908
- fieldWeights: function fieldWeights() {
909
- this.triggerCustomQuery(this.$data.currentValue);
910
- },
911
- fuzziness: function fuzziness() {
912
- this.triggerCustomQuery(this.$data.currentValue);
913
- },
914
- queryFormat: function queryFormat() {
915
- this.triggerCustomQuery(this.$data.currentValue);
916
- },
917
- defaultValue: function defaultValue(newVal) {
918
- this.setValue(newVal, true, this.$props);
919
- },
920
- value: function value(newVal, oldVal) {
921
- if (!isEqual(newVal, oldVal)) {
922
- this.setValue(newVal, true, this.$props, newVal === '' ? causes.CLEAR_VALUE : undefined, false);
923
- }
924
- },
925
- defaultQuery: function defaultQuery(newVal, oldVal) {
926
- if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
927
- this.triggerDefaultQuery(this.$data.currentValue);
928
- }
929
- },
930
- customQuery: function customQuery(newVal, oldVal) {
931
- if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
932
- this.triggerCustomQuery(this.$data.currentValue);
933
- }
934
- },
935
- suggestions: function suggestions(newVal) {
936
- var suggestionsList = [];
937
- if (Array.isArray(newVal) && newVal.length) {
938
- suggestionsList = [].concat(withClickIds(newVal));
939
- } else if (Array.isArray(this.$props.defaultSuggestions) && this.$props.defaultSuggestions.length) {
940
- suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
941
- }
942
- this.normalizedSuggestions = suggestionsList;
943
- },
944
- selectedValue: function selectedValue(newVal, oldVal) {
945
- if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
946
- if (!newVal && this.$data.currentValue) {
947
- // selected value is cleared, call onValueSelected
948
- this.onValueSelectedHandler('', causes.CLEAR_VALUE);
949
- }
950
- if (this.$options.isTagsMode) {
951
- // handling reset of tags through SelectedFilters or URL
952
- this.selectedTags = [];
953
- }
954
- var cause = !newVal ? causes.CLEAR_VALUE : undefined;
955
- if (this.$options.isTagsMode) {
956
- cause = causes.SUGGESTION_SELECT;
957
- }
958
- this.setValue(newVal || '', true, this.$props, cause);
959
- }
960
- },
961
- focusShortcuts: function focusShortcuts() {
962
- this.listenForFocusShortcuts();
963
- },
964
- rawData: function rawData(newVal) {
965
- this.$emit('on-data', {
966
- data: this.normalizedSuggestions,
967
- rawData: newVal,
968
- aggregationData: this.aggregationData,
969
- loading: this.isLoading,
970
- error: this.isError
971
- });
972
- },
973
- aggregationData: function aggregationData(newVal) {
974
- this.$emit('on-data', {
975
- data: this.normalizedSuggestions,
976
- rawData: this.rawData,
977
- aggregationData: newVal,
978
- loading: this.isLoading,
979
- error: this.isError
980
- });
981
- },
982
- loading: function loading(newVal) {
983
- this.$emit('on-data', {
984
- data: this.normalizedSuggestions,
985
- rawData: this.rawData,
986
- aggregationData: this.aggregationData,
987
- loading: newVal,
988
- error: this.isError
989
- });
990
- },
991
- error: function error(newVal) {
992
- this.$emit('on-data', {
993
- data: this.normalizedSuggestions,
994
- rawData: this.rawData,
995
- aggregationData: this.aggregationData,
996
- loading: this.isLoading,
997
- error: newVal
998
- });
999
- },
1000
- debounce: function debounce(newVal, oldVal) {
1001
- if (!isEqual(newVal, oldVal)) {
1002
- this.handleTextChange = _debounce(this.handleText, newVal);
1003
- }
1004
- }
1005
- },
1006
- methods: {
1007
- handleText: function handleText(value, cause) {
1008
- if (cause === causes.CLEAR_VALUE) {
1009
- this.triggerCustomQuery(value);
1010
- this.triggerDefaultQuery(value);
1011
- } else if (this.$props.autosuggest) {
1012
- this.triggerDefaultQuery(value);
1013
- } else if (!this.$props.enterButton) {
1014
- this.triggerCustomQuery(value);
1015
- }
1016
- },
1017
- getComponent: function getComponent$1(downshiftProps) {
1018
- if (downshiftProps === void 0) {
1019
- downshiftProps = {};
1020
- }
1021
- var currentValue = this.$data.currentValue;
1022
- var data = {
1023
- error: this.error,
1024
- loading: this.isLoading,
1025
- downshiftProps: downshiftProps,
1026
- data: this.normalizedSuggestions,
1027
- rawData: this.rawData,
1028
- value: currentValue,
1029
- resultStats: this.stats
1030
- };
1031
- return getComponent(data, this);
1032
- },
1033
- // returns size and aggs property
1034
- getBasicQueryOptions: function getBasicQueryOptions() {
1035
- var aggregationField = this.$props.aggregationField;
1036
- var queryOptions = getQueryOptions(this.$props);
1037
- if (aggregationField) {
1038
- queryOptions.aggs = getCompositeAggsQuery({
1039
- props: this.$props,
1040
- showTopHits: true
1041
- }).aggs;
1042
- }
1043
- return queryOptions;
1044
- },
1045
- handleSearchIconClick: function handleSearchIconClick() {
1046
- var currentValue = this.currentValue;
1047
- if (currentValue.trim()) {
1048
- this.setValue(currentValue, true);
1049
- this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
1050
- }
1051
- },
1052
- setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1053
- var _this = this;
1054
- if (isDefaultValue === void 0) {
1055
- isDefaultValue = false;
1056
- }
1057
- if (props === void 0) {
1058
- props = this.$props;
1059
- }
1060
- if (toggleIsOpen === void 0) {
1061
- toggleIsOpen = true;
1062
- }
1063
- if (categoryValue === void 0) {
1064
- categoryValue = undefined;
1065
- }
1066
- var performUpdate = function performUpdate() {
1067
- if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
1068
- return;
1069
- }
1070
- if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1071
- if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1072
- // check if value already present in selectedTags
1073
- if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1074
- _this.isOpen = false;
1075
- return;
1076
- }
1077
- _this.selectedTags = [].concat(_this.selectedTags);
1078
- if (typeof value === 'string' && !!value) {
1079
- _this.selectedTags.push(value);
1080
- } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1081
- _this.selectedTags = value;
1082
- }
1083
- } else if (value) {
1084
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1085
- }
1086
- _this.currentValue = '';
1087
- } else {
1088
- _this.currentValue = decodeHtml(value);
1089
- }
1090
- var queryHandlerValue = value;
1091
- if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1092
- queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1093
- }
1094
- if (isDefaultValue) {
1095
- if (_this.$props.autosuggest) {
1096
- if (toggleIsOpen) {
1097
- _this.isOpen = false;
1098
- }
1099
- if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
1100
- } // in case of strict selection only SUGGESTION_SELECT should be able
1101
- // to set the query otherwise the value should reset
1102
- if (props.strictSelection) {
1103
- if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1104
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1105
- } else {
1106
- _this.setValue('', true);
1107
- }
1108
- } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
1109
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1110
- }
1111
- } else {
1112
- // debounce for handling text while typing
1113
- _this.handleTextChange(value, cause);
1114
- }
1115
- _this.$emit('valueChange', value);
1116
- _this.$emit('value-change', value);
1117
- };
1118
- checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1119
- },
1120
- triggerDefaultQuery: function triggerDefaultQuery(paramValue) {
1121
- if (!this.$props.autosuggest) {
1122
- return;
1123
- }
1124
- var value = typeof paramValue !== 'string' ? this.currentValue : paramValue;
1125
- var query = SearchBox.defaultQuery(value, this.$props);
1126
- if (this.defaultQuery) {
1127
- var defaultQueryToBeSet = this.defaultQuery(value, this.$props) || {};
1128
- if (defaultQueryToBeSet.query) {
1129
- query = defaultQueryToBeSet.query;
1130
- }
1131
-
1132
- // Update calculated default query in store
1133
- updateDefaultQuery(this.$props.componentId, this.setDefaultQuery, this.$props, value);
1134
- }
1135
- this.updateQuery({
1136
- componentId: this.internalComponent,
1137
- query: query,
1138
- value: value,
1139
- componentType: componentTypes$1.searchBox
1140
- });
1141
- },
1142
- triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
1143
- if (categoryValue === void 0) {
1144
- categoryValue = undefined;
1145
- }
1146
- var _this$$props = this.$props,
1147
- customQuery = _this$$props.customQuery,
1148
- filterLabel = _this$$props.filterLabel,
1149
- showFilter = _this$$props.showFilter,
1150
- URLParams = _this$$props.URLParams;
1151
- var value = typeof paramValue !== 'string' ? this.$data.currentValue : paramValue;
1152
- if (this.$options.isTagsMode) {
1153
- value = paramValue;
1154
- }
1155
- var defaultQueryTobeSet = SearchBox.defaultQuery("" + value + (categoryValue ? " in " + categoryValue : ''), this.$props);
1156
- var query = defaultQueryTobeSet;
1157
- if (customQuery) {
1158
- var customQueryTobeSet = customQuery(value, this.$props);
1159
- var queryTobeSet = customQueryTobeSet.query;
1160
- if (queryTobeSet) {
1161
- query = queryTobeSet;
1162
- }
1163
- updateCustomQuery(this.$props.componentId, this.setCustomQuery, this.$props, value);
1164
- }
1165
- this.updateQuery({
1166
- componentId: this.$props.componentId,
1167
- query: query,
1168
- value: value,
1169
- label: filterLabel,
1170
- showFilter: showFilter,
1171
- URLParams: URLParams,
1172
- componentType: componentTypes$1.searchBox,
1173
- category: categoryValue
1174
- });
1175
- },
1176
- handleFocus: function handleFocus(event) {
1177
- if (this.$props.autosuggest) {
1178
- this.isOpen = true;
1179
- }
1180
- this.$emit('focus', event);
1181
- },
1182
- handleVoiceResults: function handleVoiceResults(_ref) {
1183
- var results = _ref.results;
1184
- if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1185
- this.setValue(results[0][0].transcript.trim(), true);
1186
- }
1187
- },
1188
- triggerQuery: function triggerQuery(_ref2) {
1189
- var _ref2$isOpen = _ref2.isOpen,
1190
- isOpen = _ref2$isOpen === void 0 ? undefined : _ref2$isOpen,
1191
- _ref2$customQuery = _ref2.customQuery,
1192
- customQuery = _ref2$customQuery === void 0 ? true : _ref2$customQuery,
1193
- _ref2$defaultQuery = _ref2.defaultQuery,
1194
- defaultQuery = _ref2$defaultQuery === void 0 ? true : _ref2$defaultQuery,
1195
- _ref2$value = _ref2.value,
1196
- value = _ref2$value === void 0 ? undefined : _ref2$value,
1197
- _ref2$categoryValue = _ref2.categoryValue,
1198
- categoryValue = _ref2$categoryValue === void 0 ? undefined : _ref2$categoryValue;
1199
- if (typeof isOpen === 'boolean') {
1200
- this.isOpen = isOpen;
1201
- }
1202
- if (customQuery) {
1203
- this.triggerCustomQuery(value, categoryValue);
1204
- }
1205
- if (defaultQuery) {
1206
- this.triggerDefaultQuery(value);
1207
- }
1208
- },
1209
- triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
1210
- // click analytics would only work client side and after javascript loads
1211
- var docId = documentId;
1212
- if (!docId) {
1213
- var hitData = this.normalizedSuggestions.find(function (hit) {
1214
- return hit._click_id === searchPosition;
1215
- });
1216
- if (hitData && hitData.source && hitData.source._id) {
1217
- docId = hitData.source._id;
1218
- }
1219
- }
1220
- this.recordSuggestionClick(searchPosition, docId);
1221
- },
1222
- clearValue: function clearValue() {
1223
- this.setValue('', false, this.$props, causes.CLEAR_VALUE, false);
1224
- this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1225
- },
1226
- handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1227
- if (highlightedIndex === void 0) {
1228
- highlightedIndex = null;
1229
- }
1230
- // if a suggestion was selected, delegate the handling to suggestion handler
1231
- if (event.key === 'Enter') {
1232
- if (this.$props.autosuggest === false) {
1233
- this.enterButtonOnClick();
1234
- } else if (highlightedIndex === null) {
1235
- this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
1236
- );
1237
-
1238
- this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1239
- }
1240
- }
1241
-
1242
- // Need to review
1243
- this.$emit('keyDown', event, this.triggerQuery);
1244
- this.$emit('key-down', event, this.triggerQuery);
1245
- },
1246
- onInputChange: function onInputChange(e) {
1247
- var _this2 = this;
1248
- var inputValue = e.target.value;
1249
- if (!this.$data.isOpen && this.$props.autosuggest) {
1250
- this.isOpen = true;
1251
- }
1252
- var value = this.$props.value;
1253
- if (value === undefined) {
1254
- this.setValue(inputValue, false, this.$props, inputValue === '' ? causes.CLEAR_VALUE : undefined);
1255
- } else {
1256
- this.$emit('change', inputValue, function (_ref3) {
1257
- var isOpen = _ref3.isOpen;
1258
- return _this2.triggerQuery({
1259
- defaultQuery: true,
1260
- customQuery: true,
1261
- value: inputValue,
1262
- isOpen: isOpen
1263
- });
1264
- }, e);
1265
- }
1266
- },
1267
- onSuggestionSelected: function onSuggestionSelected(suggestion) {
1268
- var _this3 = this;
1269
- this.isOpen = false;
1270
- var value = this.$props.value;
1271
- // Record analytics for selected suggestions
1272
- this.triggerClickAnalytics(suggestion._click_id);
1273
- if (value === undefined) {
1274
- this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1275
- } else {
1276
- var emitValue = suggestion.value;
1277
- if (this.$options.isTagsMode) {
1278
- emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
1279
- if (this.selectedTags.includes(suggestion.value)) {
1280
- // avoid duplicates in tags array
1281
- this.isOpen = false;
1282
- return;
1283
- }
1284
- emitValue.push(suggestion.value);
1285
- }
1286
- this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1287
- this.$emit('change', emitValue, function (_ref4) {
1288
- var isOpen = _ref4.isOpen;
1289
- return _this3.triggerQuery(_extends({
1290
- isOpen: isOpen,
1291
- value: emitValue
1292
- }, !_this3.$options.isTagsMode && {
1293
- categoryValue: suggestion._category
1294
- }));
1295
- });
1296
- }
1297
- this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1298
- },
1299
- onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1300
- if (currentValue === void 0) {
1301
- currentValue = this.$data.currentValue;
1302
- }
1303
- for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1304
- cause[_key - 1] = arguments[_key];
1305
- }
1306
- this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
1307
- this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
1308
- },
1309
- handleStateChange: function handleStateChange(changes) {
1310
- var isOpen = changes.isOpen;
1311
- this.isOpen = isOpen;
1312
- },
1313
- getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
1314
- var isDark = this.themePreset === 'dark';
1315
- if (isDark) {
1316
- return highlightedIndex === index ? '#555' : '#424242';
1317
- }
1318
- return highlightedIndex === index ? '#eee' : '#fff';
1319
- },
1320
- renderIcon: function renderIcon() {
1321
- if (this.$props.showIcon) {
1322
- return this.$props.icon || createVNode(SearchSvg, null, null);
1323
- }
1324
- return null;
1325
- },
1326
- renderErrorComponent: function renderErrorComponent() {
1327
- var _this4 = this;
1328
- var renderError = this.$slots.renderError || this.$props.renderError;
1329
- if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1330
- return createVNode(SuggestionWrapper, {
1331
- "innerClass": this.$props.innerClass,
1332
- "innerClassName": "error",
1333
- "theme": this.theme,
1334
- "themePreset": this.themePreset
1335
- }, {
1336
- "default": function _default() {
1337
- return [isFunction(renderError) ? renderError(_this4.error) : renderError];
1338
- }
1339
- });
1340
- }
1341
- return null;
1342
- },
1343
- renderCancelIcon: function renderCancelIcon() {
1344
- if (this.$props.showClear) {
1345
- return this.$props.clearIcon || createVNode(CancelSvg, null, null);
1346
- }
1347
- return null;
1348
- },
1349
- renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
1350
- if (finalSuggestionsList === void 0) {
1351
- finalSuggestionsList = [];
1352
- }
1353
- var innerClass = this.$props.innerClass;
1354
- var renderNoSuggestion = this.$slots.renderNoSuggestion || this.$props.renderNoSuggestion;
1355
- var renderError = this.$slots.renderError || this.$props.renderError;
1356
- var _this$$data = this.$data,
1357
- isOpen = _this$$data.isOpen,
1358
- currentValue = _this$$data.currentValue;
1359
- if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
1360
- return createVNode(SuggestionWrapper, {
1361
- "innerClass": innerClass,
1362
- "themePreset": this.themePreset,
1363
- "theme": this.theme,
1364
- "innerClassName": "noSuggestion"
1365
- }, {
1366
- "default": function _default() {
1367
- return typeof renderNoSuggestion === 'function' ? renderNoSuggestion(currentValue) : renderNoSuggestion;
1368
- }
1369
- });
1370
- }
1371
- return null;
1372
- },
1373
- renderInputAddonBefore: function renderInputAddonBefore() {
1374
- var addonBefore = this.$slots.addonBefore;
1375
- if (addonBefore) {
1376
- var _slot;
1377
- return createVNode(InputAddon, {
1378
- "class": "addon-before"
1379
- }, _isSlot(_slot = addonBefore()) ? _slot : {
1380
- "default": function _default() {
1381
- return [_slot];
1382
- }
1383
- });
1384
- }
1385
- return null;
1386
- },
1387
- renderInputAddonAfter: function renderInputAddonAfter() {
1388
- var addonAfter = this.$slots.addonAfter;
1389
- if (addonAfter) {
1390
- var _slot2;
1391
- return createVNode(InputAddon, {
1392
- "class": "addon-after"
1393
- }, _isSlot(_slot2 = addonAfter()) ? _slot2 : {
1394
- "default": function _default() {
1395
- return [_slot2];
1396
- }
1397
- });
1398
- }
1399
- return null;
1400
- },
1401
- enterButtonOnClick: function enterButtonOnClick() {
1402
- this.triggerQuery({
1403
- isOpen: false,
1404
- value: this.currentValue,
1405
- customQuery: true
1406
- });
1407
- },
1408
- renderEnterButtonElement: function renderEnterButtonElement() {
1409
- var _this5 = this;
1410
- var _this$$props2 = this.$props,
1411
- enterButton = _this$$props2.enterButton,
1412
- innerClass = _this$$props2.innerClass;
1413
- var renderEnterButton = this.$slots.renderEnterButton;
1414
- if (enterButton) {
1415
- var getEnterButtonMarkup = function getEnterButtonMarkup() {
1416
- if (renderEnterButton) {
1417
- return renderEnterButton(_this5.enterButtonOnClick);
1418
- }
1419
- return createVNode(Button, {
1420
- "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
1421
- "primary": true,
1422
- "onClick": _this5.enterButtonOnClick
1423
- }, {
1424
- "default": function _default() {
1425
- return [createTextVNode("Search")];
1426
- }
1427
- });
1428
- };
1429
- return createVNode("div", {
1430
- "class": "enter-button-wrapper"
1431
- }, [getEnterButtonMarkup()]);
1432
- }
1433
- return null;
1434
- },
1435
- renderIcons: function renderIcons() {
1436
- var _this6 = this;
1437
- var _slot3, _slot4, _slot5;
1438
- var _this$$props3 = this.$props,
1439
- iconPosition = _this$$props3.iconPosition,
1440
- showClear = _this$$props3.showClear,
1441
- innerClass = _this$$props3.innerClass,
1442
- getMicInstance = _this$$props3.getMicInstance,
1443
- showVoiceSearch = _this$$props3.showVoiceSearch,
1444
- showIcon = _this$$props3.showIcon;
1445
- var renderMic = this.$slots.renderMic || this.$props.renderMic;
1446
- var currentValue = this.$data.currentValue;
1447
- return createVNode("div", null, [createVNode(IconGroup, {
1448
- "groupPosition": "right",
1449
- "positionType": "absolute"
1450
- }, {
1451
- "default": function _default() {
1452
- return [currentValue && showClear && createVNode(IconWrapper, {
1453
- "onClick": _this6.clearValue,
1454
- "showIcon": showIcon,
1455
- "isClearIcon": true
1456
- }, _isSlot(_slot3 = _this6.renderCancelIcon()) ? _slot3 : {
1457
- "default": function _default() {
1458
- return [_slot3];
1459
- }
1460
- }), showVoiceSearch && createVNode(Mic, {
1461
- "getInstance": getMicInstance,
1462
- "render": renderMic,
1463
- "handleResult": _this6.handleVoiceResults,
1464
- "className": getClassName$1(innerClass, 'mic') || null
1465
- }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
1466
- "onClick": _this6.handleSearchIconClick
1467
- }, _isSlot(_slot4 = _this6.renderIcon()) ? _slot4 : {
1468
- "default": function _default() {
1469
- return [_slot4];
1470
- }
1471
- })];
1472
- }
1473
- }), createVNode(IconGroup, {
1474
- "groupPosition": "left",
1475
- "positionType": "absolute"
1476
- }, {
1477
- "default": function _default() {
1478
- return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
1479
- "onClick": _this6.handleSearchIconClick
1480
- }, _isSlot(_slot5 = _this6.renderIcon()) ? _slot5 : {
1481
- "default": function _default() {
1482
- return [_slot5];
1483
- }
1484
- })];
1485
- }
1486
- })]);
1487
- },
1488
- focusSearchBox: function focusSearchBox(event) {
1489
- var _this$$refs, _this$$refs$this$$pro;
1490
- var elt = event.target || event.srcElement;
1491
- var tagName = elt.tagName;
1492
- if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1493
- // already in an input
1494
- return;
1495
- }
1496
- (_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
1497
- },
1498
- listenForFocusShortcuts: function listenForFocusShortcuts() {
1499
- var _this7 = this;
1500
- var _this$$props$focusSho = this.$props.focusShortcuts,
1501
- focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1502
- if (isEmpty(focusShortcuts)) {
1503
- return;
1504
- }
1505
- var shortcutsString = parseFocusShortcuts(focusShortcuts).join(',');
1506
-
1507
- // handler for alphabets and other key combinations
1508
- hotkeys(shortcutsString,
1509
- // eslint-disable-next-line no-unused-vars
1510
- /* eslint-disable no-shadow */
1511
- function (event, handler) {
1512
- // Prevent the default refresh event under WINDOWS system
1513
- event.preventDefault();
1514
- _this7.focusSearchBox(event);
1515
- });
1516
-
1517
- // if one of modifier keys are used, they are handled below
1518
- hotkeys('*', function (event) {
1519
- var modifierKeys = extractModifierKeysFromFocusShortcuts(focusShortcuts);
1520
- if (modifierKeys.length === 0) return;
1521
- for (var index = 0; index < modifierKeys.length; index += 1) {
1522
- var element = modifierKeys[index];
1523
- if (hotkeys[element]) {
1524
- _this7.focusSearchBox(event);
1525
- break;
1526
- }
1527
- }
1528
- });
1529
- },
1530
- onAutofillClick: function onAutofillClick(suggestion) {
1531
- var value = suggestion.value;
1532
- this.isOpen = true;
1533
- this.currentValue = decodeHtml(value);
1534
- this.triggerDefaultQuery(value);
1535
- },
1536
- renderAutoFill: function renderAutoFill(suggestion) {
1537
- var _this8 = this;
1538
- var handleAutoFillClick = function handleAutoFillClick(e) {
1539
- e.stopPropagation();
1540
- _this8.onAutofillClick(suggestion);
1541
- };
1542
- /* 👇 avoid showing autofill for category suggestions👇 */
1543
- return suggestion._category ? null : createVNode(AutoFillSvg, {
1544
- "onClick": handleAutoFillClick
1545
- }, null);
1546
- },
1547
- renderTag: function renderTag(item) {
1548
- var _this9 = this;
1549
- var innerClass = this.$props.innerClass;
1550
- return createVNode(TagItem, {
1551
- "class": getClassName$1(innerClass, 'selected-tag') || ''
1552
- }, {
1553
- "default": function _default() {
1554
- return [createVNode("span", null, [item]), createVNode("span", {
1555
- "role": "img",
1556
- "aria-label": "delete-tag",
1557
- "class": "close-icon",
1558
- "onClick": function onClick() {
1559
- return _this9.clearTag(item);
1560
- }
1561
- }, [createVNode(CancelSvg, null, null)])];
1562
- }
1563
- });
1564
- },
1565
- clearAllTags: function clearAllTags() {
1566
- this.selectedTags = [];
1567
- this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1568
- if (this.$props.value !== undefined) {
1569
- this.$emit('change', this.selectedTags, this.triggerQuery);
1570
- }
1571
- },
1572
- clearTag: function clearTag(tagValue) {
1573
- this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1574
- return tag !== tagValue;
1575
- }));
1576
- this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1577
- if (this.$props.value !== undefined) {
1578
- this.$emit('change', this.selectedTags, this.triggerQuery);
1579
- }
1580
- },
1581
- renderTags: function renderTags() {
1582
- var _this10 = this;
1583
- if (!Array.isArray(this.selectedTags)) {
1584
- return null;
1585
- }
1586
- var tagsList = [].concat(this.selectedTags);
1587
- var shouldRenderClearAllTag = tagsList.length > 1;
1588
- var renderSelectedTags = this.$slots.renderSelectedTags || this.$props.renderSelectedTags;
1589
- return renderSelectedTags ? renderSelectedTags({
1590
- values: this.selectedTags,
1591
- handleClear: this.clearTag,
1592
- handleClearAll: this.clearAllTags
1593
- }) : createVNode(TagsContainer, null, {
1594
- "default": function _default() {
1595
- return [tagsList.map(function (item) {
1596
- return _this10.renderTag(item);
1597
- }), shouldRenderClearAllTag && createVNode(TagItem, {
1598
- "class": getClassName$1(_this10.$props.innerClass, 'selected-tag') || ''
1599
- }, {
1600
- "default": function _default() {
1601
- return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
1602
- "role": "img",
1603
- "aria-label": "delete-tag",
1604
- "class": "close-icon",
1605
- "onClick": _this10.clearAllTags
1606
- }, [createVNode(CancelSvg, null, null)])];
1607
- }
1608
- })];
1609
- }
1610
- });
1611
- }
1612
- },
1613
- render: function render() {
1614
- var _this11 = this;
1615
- var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
1616
- var _this$$slots = this.$slots,
1617
- recentSearchesIcon = _this$$slots.recentSearchesIcon,
1618
- popularSearchesIcon = _this$$slots.popularSearchesIcon;
1619
- var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
1620
- var renderItem = this.$slots.renderItem || this.$props.renderItem;
1621
- return createVNode(Container, {
1622
- "class": this.$props.className
1623
- }, {
1624
- "default": function _default() {
1625
- return [_this11.$props.title && createVNode(Title, {
1626
- "class": getClassName$1(_this11.$props.innerClass, 'title') || ''
1627
- }, {
1628
- "default": function _default() {
1629
- return [_this11.$props.title];
1630
- }
1631
- }), _this11.$props.autosuggest ? createVNode(Downshift, {
1632
- "id": _this11.$props.componentId + "-downshift",
1633
- "handleChange": _this11.onSuggestionSelected,
1634
- "handleMouseup": _this11.handleStateChange,
1635
- "isOpen": _this11.$data.isOpen
1636
- }, {
1637
- "default": function _default(_ref5) {
1638
- var getInputEvents = _ref5.getInputEvents,
1639
- getInputProps = _ref5.getInputProps,
1640
- getItemProps = _ref5.getItemProps,
1641
- getItemEvents = _ref5.getItemEvents,
1642
- isOpen = _ref5.isOpen,
1643
- highlightedIndex = _ref5.highlightedIndex,
1644
- setHighlightedIndex = _ref5.setHighlightedIndex;
1645
- var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
1646
- var getIcon = function getIcon(iconType) {
1647
- switch (iconType) {
1648
- case suggestionTypes.Recent:
1649
- return recentSearchesIcon;
1650
- case suggestionTypes.Popular:
1651
- return popularSearchesIcon;
1652
- default:
1653
- return null;
1654
- }
1655
- };
1656
- return createVNode("div", null, [_this11.hasCustomRenderer && _this11.getComponent({
1657
- isOpen: isOpen,
1658
- getItemProps: getItemProps,
1659
- getItemEvents: getItemEvents,
1660
- highlightedIndex: highlightedIndex
1661
- }), _this11.renderErrorComponent(), !_this11.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
1662
- "class": suggestions(_this11.themePreset, _this11.theme) + " " + getClassName$1(_this11.$props.innerClass, 'list')
1663
- }, [_this11.normalizedSuggestions.map(function (item, index) {
1664
- return renderItem ? createVNode("li", mergeProps(getItemProps({
1665
- item: item
1666
- }), getItemEvents({
1667
- item: item
1668
- }), {
1669
- "key": index + 1 + "-" + item.value,
1670
- "style": {
1671
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
1672
- justifyContent: 'flex-start',
1673
- alignItems: 'center'
1674
- }
1675
- }), [renderItem(item)]) : createVNode("li", mergeProps(getItemProps({
1676
- item: item
1677
- }), _transformOn(getItemEvents({
1678
- item: item
1679
- })), {
1680
- "key": index + 1 + "-" + item.value,
1681
- "style": {
1682
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
1683
- justifyContent: 'flex-start',
1684
- alignItems: 'center'
1685
- }
1686
- }), [createVNode("div", {
1687
- "style": {
1688
- padding: '0 10px 0 0',
1689
- display: 'flex'
1690
- }
1691
- }, [createVNode(CustomSvg, {
1692
- "className": getClassName$1(_this11.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1693
- "icon": getIcon(item._suggestion_type),
1694
- "type": item._suggestion_type + "-search-icon"
1695
- }, null)]), createVNode(SuggestionItem, {
1696
- "currentValue": _this11.currentValue,
1697
- "suggestion": item
1698
- }, null), _this11.renderAutoFill(item)]);
1699
- })]) : _this11.renderNoSuggestions(_this11.normalizedSuggestions)]);
1700
- };
1701
- return createVNode("div", {
1702
- "class": suggestionsContainer
1703
- }, [createVNode(InputGroup, null, {
1704
- "default": function _default() {
1705
- return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
1706
- "default": function _default() {
1707
- return [createVNode(Input, mergeProps(_transformOn(getInputEvents({
1708
- onInput: _this11.onInputChange,
1709
- onBlur: function onBlur(e) {
1710
- _this11.$emit('blur', e, _this11.triggerQuery);
1711
- },
1712
- onFocus: _this11.handleFocus,
1713
- onKeyPress: function onKeyPress(e) {
1714
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1715
- _this11.$emit('key-press', e, _this11.triggerQuery);
1716
- },
1717
- onKeyDown: function onKeyDown(e) {
1718
- return _this11.handleKeyDown(e, highlightedIndex);
1719
- },
1720
- onKeyUp: function onKeyUp(e) {
1721
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1722
- _this11.$emit('key-up', e, _this11.triggerQuery);
1723
- },
1724
- onClick: function onClick() {
1725
- setHighlightedIndex(null);
1726
- }
1727
- })), {
1728
- "id": _this11.$props.componentId + "-input",
1729
- "showIcon": _this11.$props.showIcon,
1730
- "showClear": _this11.$props.showClear,
1731
- "iconPosition": _this11.$props.iconPosition,
1732
- "ref": _this11.$props.innerRef,
1733
- "class": getClassName$1(_this11.$props.innerClass, 'input'),
1734
- "placeholder": _this11.$props.placeholder,
1735
- "autoFocus": _this11.$props.autoFocus
1736
- }, getInputProps({
1737
- value: _this11.$data.currentValue === null ? '' : _this11.$data.currentValue
1738
- }), {
1739
- "themePreset": _this11.themePreset,
1740
- "autocomplete": "off"
1741
- }), null), _this11.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
1742
- }
1743
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
1744
- }
1745
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this11.renderTags()]);
1746
- }
1747
- }) : createVNode("div", {
1748
- "class": suggestionsContainer
1749
- }, [createVNode(InputGroup, null, {
1750
- "default": function _default() {
1751
- return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
1752
- "default": function _default() {
1753
- return [createVNode(Input, mergeProps(_transformOn({
1754
- blur: function blur(e) {
1755
- _this11.$emit('blur', e, _this11.triggerQuery);
1756
- },
1757
- keypress: function keypress(e) {
1758
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1759
- _this11.$emit('key-press', e, _this11.triggerQuery);
1760
- },
1761
- input: _this11.onInputChange,
1762
- focus: function focus(e) {
1763
- _this11.$emit('focus', e, _this11.triggerQuery);
1764
- },
1765
- keydown: _this11.handleKeyDown,
1766
- keyup: function keyup(e) {
1767
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1768
- _this11.$emit('key-up', e, _this11.triggerQuery);
1769
- }
1770
- }), {
1771
- "class": getClassName$1(_this11.$props.innerClass, 'input') || '',
1772
- "placeholder": _this11.$props.placeholder,
1773
- "autofocus": _this11.$props.autoFocus,
1774
- "value": _this11.$data.currentValue ? _this11.$data.currentValue : '',
1775
- "iconPosition": _this11.$props.iconPosition,
1776
- "showIcon": _this11.$props.showIcon,
1777
- "showClear": _this11.$props.showClear,
1778
- "ref": _this11.$props.innerRef,
1779
- "themePreset": _this11.themePreset
1780
- }), null), _this11.renderIcons()];
1781
- }
1782
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
1783
- }
1784
- })])];
1785
- }
1786
- });
1787
- },
1788
- destroyed: function destroyed() {
1789
- document.removeEventListener('keydown', this.onKeyDown);
1790
- }
1791
- });
1792
- SearchBox.hasInternalComponent = function () {
1793
- return true;
1794
- };
1795
- SearchBox.defaultQuery = function (value, props) {
1796
- var finalQuery = null;
1797
- finalQuery = {
1798
- bool: {
1799
- should: SearchBox.shouldQuery(value, props),
1800
- minimum_should_match: '1'
1801
- }
1802
- };
1803
- if (finalQuery && props.nestedField) {
1804
- return {
1805
- query: {
1806
- nested: {
1807
- path: props.nestedField,
1808
- query: finalQuery
1809
- }
1810
- }
1811
- };
1812
- }
1813
- return finalQuery;
1814
- };
1815
- SearchBox.shouldQuery = function (value, props) {
1816
- return {
1817
- query: {
1818
- queryFormat: props.queryFormat,
1819
- dataField: props.dataField,
1820
- value: value,
1821
- nestedField: props.nestedField,
1822
- queryString: props.queryString,
1823
- searchOperators: props.searchOperators
1824
- }
1825
- };
1826
- };
1827
- var mapStateToProps = function mapStateToProps(state, props) {
1828
- return {
1829
- selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
1830
- selectedCategory: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].category || null,
1831
- suggestions: state.hits[props.componentId] && state.hits[props.componentId].hits,
1832
- rawData: state.rawData[props.componentId],
1833
- aggregationData: state.compositeAggregations[props.componentId] || [],
1834
- themePreset: state.config.themePreset,
1835
- isLoading: !!state.isLoading[props.componentId + "_active"],
1836
- error: state.error[props.componentId],
1837
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
1838
- total: state.hits[props.componentId] && state.hits[props.componentId].total,
1839
- hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
1840
- };
1841
- };
1842
- var mapDispatchToProps = {
1843
- updateQuery: updateQuery,
1844
- setCustomQuery: setCustomQuery,
1845
- setDefaultQuery: setDefaultQuery,
1846
- recordSuggestionClick: recordSuggestionClick
1847
- };
1848
- var SBConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(SearchBox), {
1849
- componentType: componentTypes$1.searchBox,
1850
- internalComponent: true
1851
- }));
1852
- SBConnected.name = SearchBox.name;
1853
- SBConnected.defaultQuery = SearchBox.defaultQuery;
1854
- SBConnected.shouldQuery = SearchBox.shouldQuery;
1855
- SBConnected.hasInternalComponent = SearchBox.hasInternalComponent;
1856
- SBConnected.install = function (Vue) {
1857
- Vue.component(SBConnected.name, SBConnected);
1858
- };
1859
- // Add componentType for SSR
1860
- SBConnected.componentType = componentTypes$1.searchBox;
1861
-
1862
- function _typeof(obj) {
1863
- "@babel/helpers - typeof";
1864
-
1865
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1866
- return typeof obj;
1867
- } : function (obj) {
1868
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1869
- }, _typeof(obj);
1870
- }
1871
- var propTypes = {
1872
- exports: {}
1873
- };
1874
- var reactIs = {
1875
- exports: {}
1876
- };
1877
- var reactIs_production_min = {};
1878
- var hasRequiredReactIs_production_min;
1879
- function requireReactIs_production_min() {
1880
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
1881
- hasRequiredReactIs_production_min = 1;
1882
- var b = "function" === typeof Symbol && Symbol["for"],
1883
- c = b ? Symbol["for"]("react.element") : 60103,
1884
- d = b ? Symbol["for"]("react.portal") : 60106,
1885
- e = b ? Symbol["for"]("react.fragment") : 60107,
1886
- f = b ? Symbol["for"]("react.strict_mode") : 60108,
1887
- g = b ? Symbol["for"]("react.profiler") : 60114,
1888
- h = b ? Symbol["for"]("react.provider") : 60109,
1889
- k = b ? Symbol["for"]("react.context") : 60110,
1890
- l = b ? Symbol["for"]("react.async_mode") : 60111,
1891
- m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
1892
- n = b ? Symbol["for"]("react.forward_ref") : 60112,
1893
- p = b ? Symbol["for"]("react.suspense") : 60113,
1894
- q = b ? Symbol["for"]("react.suspense_list") : 60120,
1895
- r = b ? Symbol["for"]("react.memo") : 60115,
1896
- t = b ? Symbol["for"]("react.lazy") : 60116,
1897
- v = b ? Symbol["for"]("react.block") : 60121,
1898
- w = b ? Symbol["for"]("react.fundamental") : 60117,
1899
- x = b ? Symbol["for"]("react.responder") : 60118,
1900
- y = b ? Symbol["for"]("react.scope") : 60119;
1901
- function z(a) {
1902
- if ("object" === _typeof(a) && null !== a) {
1903
- var u = a.$$typeof;
1904
- switch (u) {
1905
- case c:
1906
- switch (a = a.type, a) {
1907
- case l:
1908
- case m:
1909
- case e:
1910
- case g:
1911
- case f:
1912
- case p:
1913
- return a;
1914
- default:
1915
- switch (a = a && a.$$typeof, a) {
1916
- case k:
1917
- case n:
1918
- case t:
1919
- case r:
1920
- case h:
1921
- return a;
1922
- default:
1923
- return u;
1924
- }
1925
- }
1926
- case d:
1927
- return u;
1928
- }
1929
- }
1930
- }
1931
- function A(a) {
1932
- return z(a) === m;
1933
- }
1934
- reactIs_production_min.AsyncMode = l;
1935
- reactIs_production_min.ConcurrentMode = m;
1936
- reactIs_production_min.ContextConsumer = k;
1937
- reactIs_production_min.ContextProvider = h;
1938
- reactIs_production_min.Element = c;
1939
- reactIs_production_min.ForwardRef = n;
1940
- reactIs_production_min.Fragment = e;
1941
- reactIs_production_min.Lazy = t;
1942
- reactIs_production_min.Memo = r;
1943
- reactIs_production_min.Portal = d;
1944
- reactIs_production_min.Profiler = g;
1945
- reactIs_production_min.StrictMode = f;
1946
- reactIs_production_min.Suspense = p;
1947
- reactIs_production_min.isAsyncMode = function (a) {
1948
- return A(a) || z(a) === l;
1949
- };
1950
- reactIs_production_min.isConcurrentMode = A;
1951
- reactIs_production_min.isContextConsumer = function (a) {
1952
- return z(a) === k;
1953
- };
1954
- reactIs_production_min.isContextProvider = function (a) {
1955
- return z(a) === h;
1956
- };
1957
- reactIs_production_min.isElement = function (a) {
1958
- return "object" === _typeof(a) && null !== a && a.$$typeof === c;
1959
- };
1960
- reactIs_production_min.isForwardRef = function (a) {
1961
- return z(a) === n;
1962
- };
1963
- reactIs_production_min.isFragment = function (a) {
1964
- return z(a) === e;
1965
- };
1966
- reactIs_production_min.isLazy = function (a) {
1967
- return z(a) === t;
1968
- };
1969
- reactIs_production_min.isMemo = function (a) {
1970
- return z(a) === r;
1971
- };
1972
- reactIs_production_min.isPortal = function (a) {
1973
- return z(a) === d;
1974
- };
1975
- reactIs_production_min.isProfiler = function (a) {
1976
- return z(a) === g;
1977
- };
1978
- reactIs_production_min.isStrictMode = function (a) {
1979
- return z(a) === f;
1980
- };
1981
- reactIs_production_min.isSuspense = function (a) {
1982
- return z(a) === p;
1983
- };
1984
- reactIs_production_min.isValidElementType = function (a) {
1985
- return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
1986
- };
1987
- reactIs_production_min.typeOf = z;
1988
- return reactIs_production_min;
1989
- }
1990
- var reactIs_development = {};
1991
- var hasRequiredReactIs_development;
1992
- function requireReactIs_development() {
1993
- if (hasRequiredReactIs_development) return reactIs_development;
1994
- hasRequiredReactIs_development = 1;
1995
- if (process.env.NODE_ENV !== "production") {
1996
- (function () {
1997
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1998
- // nor polyfill, then a plain number is used for performance.
1999
- var hasSymbol = typeof Symbol === 'function' && Symbol["for"];
2000
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]('react.element') : 0xeac7;
2001
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol["for"]('react.portal') : 0xeaca;
2002
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol["for"]('react.fragment') : 0xeacb;
2003
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.strict_mode') : 0xeacc;
2004
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol["for"]('react.profiler') : 0xead2;
2005
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]('react.provider') : 0xeacd;
2006
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
2007
- // (unstable) APIs that have been removed. Can we remove the symbols?
2008
-
2009
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol["for"]('react.async_mode') : 0xeacf;
2010
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.concurrent_mode') : 0xeacf;
2011
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol["for"]('react.forward_ref') : 0xead0;
2012
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol["for"]('react.suspense') : 0xead1;
2013
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol["for"]('react.suspense_list') : 0xead8;
2014
- var REACT_MEMO_TYPE = hasSymbol ? Symbol["for"]('react.memo') : 0xead3;
2015
- var REACT_LAZY_TYPE = hasSymbol ? Symbol["for"]('react.lazy') : 0xead4;
2016
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol["for"]('react.block') : 0xead9;
2017
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol["for"]('react.fundamental') : 0xead5;
2018
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol["for"]('react.responder') : 0xead6;
2019
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol["for"]('react.scope') : 0xead7;
2020
- function isValidElementType(type) {
2021
- return typeof type === 'string' || typeof type === 'function' ||
2022
- // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2023
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || _typeof(type) === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
2024
- }
2025
- function typeOf(object) {
2026
- if (_typeof(object) === 'object' && object !== null) {
2027
- var $$typeof = object.$$typeof;
2028
- switch ($$typeof) {
2029
- case REACT_ELEMENT_TYPE:
2030
- var type = object.type;
2031
- switch (type) {
2032
- case REACT_ASYNC_MODE_TYPE:
2033
- case REACT_CONCURRENT_MODE_TYPE:
2034
- case REACT_FRAGMENT_TYPE:
2035
- case REACT_PROFILER_TYPE:
2036
- case REACT_STRICT_MODE_TYPE:
2037
- case REACT_SUSPENSE_TYPE:
2038
- return type;
2039
- default:
2040
- var $$typeofType = type && type.$$typeof;
2041
- switch ($$typeofType) {
2042
- case REACT_CONTEXT_TYPE:
2043
- case REACT_FORWARD_REF_TYPE:
2044
- case REACT_LAZY_TYPE:
2045
- case REACT_MEMO_TYPE:
2046
- case REACT_PROVIDER_TYPE:
2047
- return $$typeofType;
2048
- default:
2049
- return $$typeof;
2050
- }
2051
- }
2052
- case REACT_PORTAL_TYPE:
2053
- return $$typeof;
2054
- }
2055
- }
2056
- return undefined;
2057
- } // AsyncMode is deprecated along with isAsyncMode
2058
-
2059
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
2060
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2061
- var ContextConsumer = REACT_CONTEXT_TYPE;
2062
- var ContextProvider = REACT_PROVIDER_TYPE;
2063
- var Element = REACT_ELEMENT_TYPE;
2064
- var ForwardRef = REACT_FORWARD_REF_TYPE;
2065
- var Fragment = REACT_FRAGMENT_TYPE;
2066
- var Lazy = REACT_LAZY_TYPE;
2067
- var Memo = REACT_MEMO_TYPE;
2068
- var Portal = REACT_PORTAL_TYPE;
2069
- var Profiler = REACT_PROFILER_TYPE;
2070
- var StrictMode = REACT_STRICT_MODE_TYPE;
2071
- var Suspense = REACT_SUSPENSE_TYPE;
2072
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
2073
-
2074
- function isAsyncMode(object) {
2075
- {
2076
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
2077
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
2078
-
2079
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
2080
- }
2081
- }
2082
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
2083
- }
2084
- function isConcurrentMode(object) {
2085
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
2086
- }
2087
- function isContextConsumer(object) {
2088
- return typeOf(object) === REACT_CONTEXT_TYPE;
2089
- }
2090
- function isContextProvider(object) {
2091
- return typeOf(object) === REACT_PROVIDER_TYPE;
2092
- }
2093
- function isElement(object) {
2094
- return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2095
- }
2096
- function isForwardRef(object) {
2097
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
2098
- }
2099
- function isFragment(object) {
2100
- return typeOf(object) === REACT_FRAGMENT_TYPE;
2101
- }
2102
- function isLazy(object) {
2103
- return typeOf(object) === REACT_LAZY_TYPE;
2104
- }
2105
- function isMemo(object) {
2106
- return typeOf(object) === REACT_MEMO_TYPE;
2107
- }
2108
- function isPortal(object) {
2109
- return typeOf(object) === REACT_PORTAL_TYPE;
2110
- }
2111
- function isProfiler(object) {
2112
- return typeOf(object) === REACT_PROFILER_TYPE;
2113
- }
2114
- function isStrictMode(object) {
2115
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
2116
- }
2117
- function isSuspense(object) {
2118
- return typeOf(object) === REACT_SUSPENSE_TYPE;
2119
- }
2120
- reactIs_development.AsyncMode = AsyncMode;
2121
- reactIs_development.ConcurrentMode = ConcurrentMode;
2122
- reactIs_development.ContextConsumer = ContextConsumer;
2123
- reactIs_development.ContextProvider = ContextProvider;
2124
- reactIs_development.Element = Element;
2125
- reactIs_development.ForwardRef = ForwardRef;
2126
- reactIs_development.Fragment = Fragment;
2127
- reactIs_development.Lazy = Lazy;
2128
- reactIs_development.Memo = Memo;
2129
- reactIs_development.Portal = Portal;
2130
- reactIs_development.Profiler = Profiler;
2131
- reactIs_development.StrictMode = StrictMode;
2132
- reactIs_development.Suspense = Suspense;
2133
- reactIs_development.isAsyncMode = isAsyncMode;
2134
- reactIs_development.isConcurrentMode = isConcurrentMode;
2135
- reactIs_development.isContextConsumer = isContextConsumer;
2136
- reactIs_development.isContextProvider = isContextProvider;
2137
- reactIs_development.isElement = isElement;
2138
- reactIs_development.isForwardRef = isForwardRef;
2139
- reactIs_development.isFragment = isFragment;
2140
- reactIs_development.isLazy = isLazy;
2141
- reactIs_development.isMemo = isMemo;
2142
- reactIs_development.isPortal = isPortal;
2143
- reactIs_development.isProfiler = isProfiler;
2144
- reactIs_development.isStrictMode = isStrictMode;
2145
- reactIs_development.isSuspense = isSuspense;
2146
- reactIs_development.isValidElementType = isValidElementType;
2147
- reactIs_development.typeOf = typeOf;
2148
- })();
2149
- }
2150
- return reactIs_development;
2151
- }
2152
- var hasRequiredReactIs;
2153
- function requireReactIs() {
2154
- if (hasRequiredReactIs) return reactIs.exports;
2155
- hasRequiredReactIs = 1;
2156
- if (process.env.NODE_ENV === 'production') {
2157
- reactIs.exports = requireReactIs_production_min();
2158
- } else {
2159
- reactIs.exports = requireReactIs_development();
2160
- }
2161
- return reactIs.exports;
2162
- }
2163
-
2164
- /*
2165
- object-assign
2166
- (c) Sindre Sorhus
2167
- @license MIT
2168
- */
2169
- var objectAssign;
2170
- var hasRequiredObjectAssign;
2171
- function requireObjectAssign() {
2172
- if (hasRequiredObjectAssign) return objectAssign;
2173
- hasRequiredObjectAssign = 1;
2174
- /* eslint-disable no-unused-vars */
2175
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
2176
- var hasOwnProperty = Object.prototype.hasOwnProperty;
2177
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
2178
- function toObject(val) {
2179
- if (val === null || val === undefined) {
2180
- throw new TypeError('Object.assign cannot be called with null or undefined');
2181
- }
2182
- return Object(val);
2183
- }
2184
- function shouldUseNative() {
2185
- try {
2186
- if (!Object.assign) {
2187
- return false;
2188
- }
2189
-
2190
- // Detect buggy property enumeration order in older V8 versions.
2191
-
2192
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
2193
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
2194
- test1[5] = 'de';
2195
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
2196
- return false;
2197
- }
2198
-
2199
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
2200
- var test2 = {};
2201
- for (var i = 0; i < 10; i++) {
2202
- test2['_' + String.fromCharCode(i)] = i;
2203
- }
2204
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
2205
- return test2[n];
2206
- });
2207
- if (order2.join('') !== '0123456789') {
2208
- return false;
2209
- }
2210
-
2211
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
2212
- var test3 = {};
2213
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
2214
- test3[letter] = letter;
2215
- });
2216
- if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
2217
- return false;
2218
- }
2219
- return true;
2220
- } catch (err) {
2221
- // We don't expect any of the above to throw, but better to be safe.
2222
- return false;
2223
- }
2224
- }
2225
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
2226
- var from;
2227
- var to = toObject(target);
2228
- var symbols;
2229
- for (var s = 1; s < arguments.length; s++) {
2230
- from = Object(arguments[s]);
2231
- for (var key in from) {
2232
- if (hasOwnProperty.call(from, key)) {
2233
- to[key] = from[key];
2234
- }
2235
- }
2236
- if (getOwnPropertySymbols) {
2237
- symbols = getOwnPropertySymbols(from);
2238
- for (var i = 0; i < symbols.length; i++) {
2239
- if (propIsEnumerable.call(from, symbols[i])) {
2240
- to[symbols[i]] = from[symbols[i]];
2241
- }
2242
- }
2243
- }
2244
- }
2245
- return to;
2246
- };
2247
- return objectAssign;
2248
- }
2249
-
2250
- /**
2251
- * Copyright (c) 2013-present, Facebook, Inc.
2252
- *
2253
- * This source code is licensed under the MIT license found in the
2254
- * LICENSE file in the root directory of this source tree.
2255
- */
2256
- var ReactPropTypesSecret_1;
2257
- var hasRequiredReactPropTypesSecret;
2258
- function requireReactPropTypesSecret() {
2259
- if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
2260
- hasRequiredReactPropTypesSecret = 1;
2261
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2262
- ReactPropTypesSecret_1 = ReactPropTypesSecret;
2263
- return ReactPropTypesSecret_1;
2264
- }
2265
- var has;
2266
- var hasRequiredHas;
2267
- function requireHas() {
2268
- if (hasRequiredHas) return has;
2269
- hasRequiredHas = 1;
2270
- has = Function.call.bind(Object.prototype.hasOwnProperty);
2271
- return has;
2272
- }
2273
- var checkPropTypes_1;
2274
- var hasRequiredCheckPropTypes;
2275
- function requireCheckPropTypes() {
2276
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
2277
- hasRequiredCheckPropTypes = 1;
2278
- var printWarning = function printWarning() {};
2279
- if (process.env.NODE_ENV !== 'production') {
2280
- var ReactPropTypesSecret = requireReactPropTypesSecret();
2281
- var loggedTypeFailures = {};
2282
- var has = requireHas();
2283
- printWarning = function printWarning(text) {
2284
- var message = 'Warning: ' + text;
2285
- if (typeof console !== 'undefined') {
2286
- console.error(message);
2287
- }
2288
- try {
2289
- // --- Welcome to debugging React ---
2290
- // This error was thrown as a convenience so that you can use this stack
2291
- // to find the callsite that caused this warning to fire.
2292
- throw new Error(message);
2293
- } catch (x) {/**/}
2294
- };
2295
- }
2296
-
2297
- /**
2298
- * Assert that the values match with the type specs.
2299
- * Error messages are memorized and will only be shown once.
2300
- *
2301
- * @param {object} typeSpecs Map of name to a ReactPropType
2302
- * @param {object} values Runtime values that need to be type-checked
2303
- * @param {string} location e.g. "prop", "context", "child context"
2304
- * @param {string} componentName Name of the component for error messages.
2305
- * @param {?Function} getStack Returns the component stack.
2306
- * @private
2307
- */
2308
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
2309
- if (process.env.NODE_ENV !== 'production') {
2310
- for (var typeSpecName in typeSpecs) {
2311
- if (has(typeSpecs, typeSpecName)) {
2312
- var error;
2313
- // Prop type validation may throw. In case they do, we don't want to
2314
- // fail the render phase where it didn't fail before. So we log it.
2315
- // After these have been cleaned up, we'll let them throw.
2316
- try {
2317
- // This is intentionally an invariant that gets caught. It's the same
2318
- // behavior as without this statement except with a better message.
2319
- if (typeof typeSpecs[typeSpecName] !== 'function') {
2320
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
2321
- err.name = 'Invariant Violation';
2322
- throw err;
2323
- }
2324
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
2325
- } catch (ex) {
2326
- error = ex;
2327
- }
2328
- if (error && !(error instanceof Error)) {
2329
- printWarning((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + _typeof(error) + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
2330
- }
2331
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
2332
- // Only monitor this failure once because there tends to be a lot of the
2333
- // same error.
2334
- loggedTypeFailures[error.message] = true;
2335
- var stack = getStack ? getStack() : '';
2336
- printWarning('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
2337
- }
2338
- }
2339
- }
2340
- }
2341
- }
2342
-
2343
- /**
2344
- * Resets warning cache when testing.
2345
- *
2346
- * @private
2347
- */
2348
- checkPropTypes.resetWarningCache = function () {
2349
- if (process.env.NODE_ENV !== 'production') {
2350
- loggedTypeFailures = {};
2351
- }
2352
- };
2353
- checkPropTypes_1 = checkPropTypes;
2354
- return checkPropTypes_1;
2355
- }
2356
- var factoryWithTypeCheckers;
2357
- var hasRequiredFactoryWithTypeCheckers;
2358
- function requireFactoryWithTypeCheckers() {
2359
- if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
2360
- hasRequiredFactoryWithTypeCheckers = 1;
2361
- var ReactIs = requireReactIs();
2362
- var assign = requireObjectAssign();
2363
- var ReactPropTypesSecret = requireReactPropTypesSecret();
2364
- var has = requireHas();
2365
- var checkPropTypes = requireCheckPropTypes();
2366
- var printWarning = function printWarning() {};
2367
- if (process.env.NODE_ENV !== 'production') {
2368
- printWarning = function printWarning(text) {
2369
- var message = 'Warning: ' + text;
2370
- if (typeof console !== 'undefined') {
2371
- console.error(message);
2372
- }
2373
- try {
2374
- // --- Welcome to debugging React ---
2375
- // This error was thrown as a convenience so that you can use this stack
2376
- // to find the callsite that caused this warning to fire.
2377
- throw new Error(message);
2378
- } catch (x) {}
2379
- };
2380
- }
2381
- function emptyFunctionThatReturnsNull() {
2382
- return null;
2383
- }
2384
- factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, throwOnDirectAccess) {
2385
- /* global Symbol */
2386
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
2387
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
2388
-
2389
- /**
2390
- * Returns the iterator method function contained on the iterable object.
2391
- *
2392
- * Be sure to invoke the function with the iterable as context:
2393
- *
2394
- * var iteratorFn = getIteratorFn(myIterable);
2395
- * if (iteratorFn) {
2396
- * var iterator = iteratorFn.call(myIterable);
2397
- * ...
2398
- * }
2399
- *
2400
- * @param {?object} maybeIterable
2401
- * @return {?function}
2402
- */
2403
- function getIteratorFn(maybeIterable) {
2404
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
2405
- if (typeof iteratorFn === 'function') {
2406
- return iteratorFn;
2407
- }
2408
- }
2409
-
2410
- /**
2411
- * Collection of methods that allow declaration and validation of props that are
2412
- * supplied to React components. Example usage:
2413
- *
2414
- * var Props = require('ReactPropTypes');
2415
- * var MyArticle = React.createClass({
2416
- * propTypes: {
2417
- * // An optional string prop named "description".
2418
- * description: Props.string,
2419
- *
2420
- * // A required enum prop named "category".
2421
- * category: Props.oneOf(['News','Photos']).isRequired,
2422
- *
2423
- * // A prop named "dialog" that requires an instance of Dialog.
2424
- * dialog: Props.instanceOf(Dialog).isRequired
2425
- * },
2426
- * render: function() { ... }
2427
- * });
2428
- *
2429
- * A more formal specification of how these methods are used:
2430
- *
2431
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
2432
- * decl := ReactPropTypes.{type}(.isRequired)?
2433
- *
2434
- * Each and every declaration produces a function with the same signature. This
2435
- * allows the creation of custom validation functions. For example:
2436
- *
2437
- * var MyLink = React.createClass({
2438
- * propTypes: {
2439
- * // An optional string or URI prop named "href".
2440
- * href: function(props, propName, componentName) {
2441
- * var propValue = props[propName];
2442
- * if (propValue != null && typeof propValue !== 'string' &&
2443
- * !(propValue instanceof URI)) {
2444
- * return new Error(
2445
- * 'Expected a string or an URI for ' + propName + ' in ' +
2446
- * componentName
2447
- * );
2448
- * }
2449
- * }
2450
- * },
2451
- * render: function() {...}
2452
- * });
2453
- *
2454
- * @internal
2455
- */
2456
-
2457
- var ANONYMOUS = '<<anonymous>>';
2458
-
2459
- // Important!
2460
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
2461
- var ReactPropTypes = {
2462
- array: createPrimitiveTypeChecker('array'),
2463
- bigint: createPrimitiveTypeChecker('bigint'),
2464
- bool: createPrimitiveTypeChecker('boolean'),
2465
- func: createPrimitiveTypeChecker('function'),
2466
- number: createPrimitiveTypeChecker('number'),
2467
- object: createPrimitiveTypeChecker('object'),
2468
- string: createPrimitiveTypeChecker('string'),
2469
- symbol: createPrimitiveTypeChecker('symbol'),
2470
- any: createAnyTypeChecker(),
2471
- arrayOf: createArrayOfTypeChecker,
2472
- element: createElementTypeChecker(),
2473
- elementType: createElementTypeTypeChecker(),
2474
- instanceOf: createInstanceTypeChecker,
2475
- node: createNodeChecker(),
2476
- objectOf: createObjectOfTypeChecker,
2477
- oneOf: createEnumTypeChecker,
2478
- oneOfType: createUnionTypeChecker,
2479
- shape: createShapeTypeChecker,
2480
- exact: createStrictShapeTypeChecker
2481
- };
2482
-
2483
- /**
2484
- * inlined Object.is polyfill to avoid requiring consumers ship their own
2485
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2486
- */
2487
- /*eslint-disable no-self-compare*/
2488
- function is(x, y) {
2489
- // SameValue algorithm
2490
- if (x === y) {
2491
- // Steps 1-5, 7-10
2492
- // Steps 6.b-6.e: +0 != -0
2493
- return x !== 0 || 1 / x === 1 / y;
2494
- } else {
2495
- // Step 6.a: NaN == NaN
2496
- return x !== x && y !== y;
2497
- }
2498
- }
2499
- /*eslint-enable no-self-compare*/
2500
-
2501
- /**
2502
- * We use an Error-like object for backward compatibility as people may call
2503
- * PropTypes directly and inspect their output. However, we don't use real
2504
- * Errors anymore. We don't inspect their stack anyway, and creating them
2505
- * is prohibitively expensive if they are created too often, such as what
2506
- * happens in oneOfType() for any type before the one that matched.
2507
- */
2508
- function PropTypeError(message, data) {
2509
- this.message = message;
2510
- this.data = data && _typeof(data) === 'object' ? data : {};
2511
- this.stack = '';
2512
- }
2513
- // Make `instanceof Error` still work for returned errors.
2514
- PropTypeError.prototype = Error.prototype;
2515
- function createChainableTypeChecker(validate) {
2516
- if (process.env.NODE_ENV !== 'production') {
2517
- var manualPropTypeCallCache = {};
2518
- var manualPropTypeWarningCount = 0;
2519
- }
2520
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
2521
- componentName = componentName || ANONYMOUS;
2522
- propFullName = propFullName || propName;
2523
- if (secret !== ReactPropTypesSecret) {
2524
- if (throwOnDirectAccess) {
2525
- // New behavior only for users of `prop-types` package
2526
- var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
2527
- err.name = 'Invariant Violation';
2528
- throw err;
2529
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
2530
- // Old behavior for people using React.PropTypes
2531
- var cacheKey = componentName + ':' + propName;
2532
- if (!manualPropTypeCallCache[cacheKey] &&
2533
- // Avoid spamming the console because they are often not actionable except for lib authors
2534
- manualPropTypeWarningCount < 3) {
2535
- printWarning('You are manually calling a React.PropTypes validation ' + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.');
2536
- manualPropTypeCallCache[cacheKey] = true;
2537
- manualPropTypeWarningCount++;
2538
- }
2539
- }
2540
- }
2541
- if (props[propName] == null) {
2542
- if (isRequired) {
2543
- if (props[propName] === null) {
2544
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
2545
- }
2546
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
2547
- }
2548
- return null;
2549
- } else {
2550
- return validate(props, propName, componentName, location, propFullName);
2551
- }
2552
- }
2553
- var chainedCheckType = checkType.bind(null, false);
2554
- chainedCheckType.isRequired = checkType.bind(null, true);
2555
- return chainedCheckType;
2556
- }
2557
- function createPrimitiveTypeChecker(expectedType) {
2558
- function validate(props, propName, componentName, location, propFullName, secret) {
2559
- var propValue = props[propName];
2560
- var propType = getPropType(propValue);
2561
- if (propType !== expectedType) {
2562
- // `propValue` being instance of, say, date/regexp, pass the 'object'
2563
- // check, but we can offer a more precise error message here rather than
2564
- // 'of type `object`'.
2565
- var preciseType = getPreciseType(propValue);
2566
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), {
2567
- expectedType: expectedType
2568
- });
2569
- }
2570
- return null;
2571
- }
2572
- return createChainableTypeChecker(validate);
2573
- }
2574
- function createAnyTypeChecker() {
2575
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
2576
- }
2577
- function createArrayOfTypeChecker(typeChecker) {
2578
- function validate(props, propName, componentName, location, propFullName) {
2579
- if (typeof typeChecker !== 'function') {
2580
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
2581
- }
2582
- var propValue = props[propName];
2583
- if (!Array.isArray(propValue)) {
2584
- var propType = getPropType(propValue);
2585
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
2586
- }
2587
- for (var i = 0; i < propValue.length; i++) {
2588
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
2589
- if (error instanceof Error) {
2590
- return error;
2591
- }
2592
- }
2593
- return null;
2594
- }
2595
- return createChainableTypeChecker(validate);
2596
- }
2597
- function createElementTypeChecker() {
2598
- function validate(props, propName, componentName, location, propFullName) {
2599
- var propValue = props[propName];
2600
- if (!isValidElement(propValue)) {
2601
- var propType = getPropType(propValue);
2602
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
2603
- }
2604
- return null;
2605
- }
2606
- return createChainableTypeChecker(validate);
2607
- }
2608
- function createElementTypeTypeChecker() {
2609
- function validate(props, propName, componentName, location, propFullName) {
2610
- var propValue = props[propName];
2611
- if (!ReactIs.isValidElementType(propValue)) {
2612
- var propType = getPropType(propValue);
2613
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
2614
- }
2615
- return null;
2616
- }
2617
- return createChainableTypeChecker(validate);
2618
- }
2619
- function createInstanceTypeChecker(expectedClass) {
2620
- function validate(props, propName, componentName, location, propFullName) {
2621
- if (!(props[propName] instanceof expectedClass)) {
2622
- var expectedClassName = expectedClass.name || ANONYMOUS;
2623
- var actualClassName = getClassName(props[propName]);
2624
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
2625
- }
2626
- return null;
2627
- }
2628
- return createChainableTypeChecker(validate);
2629
- }
2630
- function createEnumTypeChecker(expectedValues) {
2631
- if (!Array.isArray(expectedValues)) {
2632
- if (process.env.NODE_ENV !== 'production') {
2633
- if (arguments.length > 1) {
2634
- printWarning('Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).');
2635
- } else {
2636
- printWarning('Invalid argument supplied to oneOf, expected an array.');
2637
- }
2638
- }
2639
- return emptyFunctionThatReturnsNull;
2640
- }
2641
- function validate(props, propName, componentName, location, propFullName) {
2642
- var propValue = props[propName];
2643
- for (var i = 0; i < expectedValues.length; i++) {
2644
- if (is(propValue, expectedValues[i])) {
2645
- return null;
2646
- }
2647
- }
2648
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
2649
- var type = getPreciseType(value);
2650
- if (type === 'symbol') {
2651
- return String(value);
2652
- }
2653
- return value;
2654
- });
2655
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
2656
- }
2657
- return createChainableTypeChecker(validate);
2658
- }
2659
- function createObjectOfTypeChecker(typeChecker) {
2660
- function validate(props, propName, componentName, location, propFullName) {
2661
- if (typeof typeChecker !== 'function') {
2662
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
2663
- }
2664
- var propValue = props[propName];
2665
- var propType = getPropType(propValue);
2666
- if (propType !== 'object') {
2667
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
2668
- }
2669
- for (var key in propValue) {
2670
- if (has(propValue, key)) {
2671
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2672
- if (error instanceof Error) {
2673
- return error;
2674
- }
2675
- }
2676
- }
2677
- return null;
2678
- }
2679
- return createChainableTypeChecker(validate);
2680
- }
2681
- function createUnionTypeChecker(arrayOfTypeCheckers) {
2682
- if (!Array.isArray(arrayOfTypeCheckers)) {
2683
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
2684
- return emptyFunctionThatReturnsNull;
2685
- }
2686
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2687
- var checker = arrayOfTypeCheckers[i];
2688
- if (typeof checker !== 'function') {
2689
- printWarning('Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.');
2690
- return emptyFunctionThatReturnsNull;
2691
- }
2692
- }
2693
- function validate(props, propName, componentName, location, propFullName) {
2694
- var expectedTypes = [];
2695
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2696
- var checker = arrayOfTypeCheckers[i];
2697
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
2698
- if (checkerResult == null) {
2699
- return null;
2700
- }
2701
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
2702
- expectedTypes.push(checkerResult.data.expectedType);
2703
- }
2704
- }
2705
- var expectedTypesMessage = expectedTypes.length > 0 ? ', expected one of type [' + expectedTypes.join(', ') + ']' : '';
2706
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
2707
- }
2708
- return createChainableTypeChecker(validate);
2709
- }
2710
- function createNodeChecker() {
2711
- function validate(props, propName, componentName, location, propFullName) {
2712
- if (!isNode(props[propName])) {
2713
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
2714
- }
2715
- return null;
2716
- }
2717
- return createChainableTypeChecker(validate);
2718
- }
2719
- function invalidValidatorError(componentName, location, propFullName, key, type) {
2720
- return new PropTypeError((componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.');
2721
- }
2722
- function createShapeTypeChecker(shapeTypes) {
2723
- function validate(props, propName, componentName, location, propFullName) {
2724
- var propValue = props[propName];
2725
- var propType = getPropType(propValue);
2726
- if (propType !== 'object') {
2727
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2728
- }
2729
- for (var key in shapeTypes) {
2730
- var checker = shapeTypes[key];
2731
- if (typeof checker !== 'function') {
2732
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
2733
- }
2734
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2735
- if (error) {
2736
- return error;
2737
- }
2738
- }
2739
- return null;
2740
- }
2741
- return createChainableTypeChecker(validate);
2742
- }
2743
- function createStrictShapeTypeChecker(shapeTypes) {
2744
- function validate(props, propName, componentName, location, propFullName) {
2745
- var propValue = props[propName];
2746
- var propType = getPropType(propValue);
2747
- if (propType !== 'object') {
2748
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2749
- }
2750
- // We need to check all keys in case some are required but missing from props.
2751
- var allKeys = assign({}, props[propName], shapeTypes);
2752
- for (var key in allKeys) {
2753
- var checker = shapeTypes[key];
2754
- if (has(shapeTypes, key) && typeof checker !== 'function') {
2755
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
2756
- }
2757
- if (!checker) {
2758
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
2759
- }
2760
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2761
- if (error) {
2762
- return error;
2763
- }
2764
- }
2765
- return null;
2766
- }
2767
- return createChainableTypeChecker(validate);
2768
- }
2769
- function isNode(propValue) {
2770
- switch (_typeof(propValue)) {
2771
- case 'number':
2772
- case 'string':
2773
- case 'undefined':
2774
- return true;
2775
- case 'boolean':
2776
- return !propValue;
2777
- case 'object':
2778
- if (Array.isArray(propValue)) {
2779
- return propValue.every(isNode);
2780
- }
2781
- if (propValue === null || isValidElement(propValue)) {
2782
- return true;
2783
- }
2784
- var iteratorFn = getIteratorFn(propValue);
2785
- if (iteratorFn) {
2786
- var iterator = iteratorFn.call(propValue);
2787
- var step;
2788
- if (iteratorFn !== propValue.entries) {
2789
- while (!(step = iterator.next()).done) {
2790
- if (!isNode(step.value)) {
2791
- return false;
2792
- }
2793
- }
2794
- } else {
2795
- // Iterator will provide entry [k,v] tuples rather than values.
2796
- while (!(step = iterator.next()).done) {
2797
- var entry = step.value;
2798
- if (entry) {
2799
- if (!isNode(entry[1])) {
2800
- return false;
2801
- }
2802
- }
2803
- }
2804
- }
2805
- } else {
2806
- return false;
2807
- }
2808
- return true;
2809
- default:
2810
- return false;
2811
- }
2812
- }
2813
- function isSymbol(propType, propValue) {
2814
- // Native Symbol.
2815
- if (propType === 'symbol') {
2816
- return true;
2817
- }
2818
-
2819
- // falsy value can't be a Symbol
2820
- if (!propValue) {
2821
- return false;
2822
- }
2823
-
2824
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
2825
- if (propValue['@@toStringTag'] === 'Symbol') {
2826
- return true;
2827
- }
2828
-
2829
- // Fallback for non-spec compliant Symbols which are polyfilled.
2830
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
2831
- return true;
2832
- }
2833
- return false;
2834
- }
2835
-
2836
- // Equivalent of `typeof` but with special handling for array and regexp.
2837
- function getPropType(propValue) {
2838
- var propType = _typeof(propValue);
2839
- if (Array.isArray(propValue)) {
2840
- return 'array';
2841
- }
2842
- if (propValue instanceof RegExp) {
2843
- // Old webkits (at least until Android 4.0) return 'function' rather than
2844
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
2845
- // passes PropTypes.object.
2846
- return 'object';
2847
- }
2848
- if (isSymbol(propType, propValue)) {
2849
- return 'symbol';
2850
- }
2851
- return propType;
2852
- }
2853
-
2854
- // This handles more types than `getPropType`. Only used for error messages.
2855
- // See `createPrimitiveTypeChecker`.
2856
- function getPreciseType(propValue) {
2857
- if (typeof propValue === 'undefined' || propValue === null) {
2858
- return '' + propValue;
2859
- }
2860
- var propType = getPropType(propValue);
2861
- if (propType === 'object') {
2862
- if (propValue instanceof Date) {
2863
- return 'date';
2864
- } else if (propValue instanceof RegExp) {
2865
- return 'regexp';
2866
- }
2867
- }
2868
- return propType;
2869
- }
2870
-
2871
- // Returns a string that is postfixed to a warning about an invalid type.
2872
- // For example, "undefined" or "of type array"
2873
- function getPostfixForTypeWarning(value) {
2874
- var type = getPreciseType(value);
2875
- switch (type) {
2876
- case 'array':
2877
- case 'object':
2878
- return 'an ' + type;
2879
- case 'boolean':
2880
- case 'date':
2881
- case 'regexp':
2882
- return 'a ' + type;
2883
- default:
2884
- return type;
2885
- }
2886
- }
2887
-
2888
- // Returns class name of the object, if any.
2889
- function getClassName(propValue) {
2890
- if (!propValue.constructor || !propValue.constructor.name) {
2891
- return ANONYMOUS;
2892
- }
2893
- return propValue.constructor.name;
2894
- }
2895
- ReactPropTypes.checkPropTypes = checkPropTypes;
2896
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
2897
- ReactPropTypes.PropTypes = ReactPropTypes;
2898
- return ReactPropTypes;
2899
- };
2900
- return factoryWithTypeCheckers;
2901
- }
2902
-
2903
- /**
2904
- * Copyright (c) 2013-present, Facebook, Inc.
2905
- *
2906
- * This source code is licensed under the MIT license found in the
2907
- * LICENSE file in the root directory of this source tree.
2908
- */
2909
- var factoryWithThrowingShims;
2910
- var hasRequiredFactoryWithThrowingShims;
2911
- function requireFactoryWithThrowingShims() {
2912
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
2913
- hasRequiredFactoryWithThrowingShims = 1;
2914
- var ReactPropTypesSecret = requireReactPropTypesSecret();
2915
- function emptyFunction() {}
2916
- function emptyFunctionWithReset() {}
2917
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
2918
- factoryWithThrowingShims = function factoryWithThrowingShims() {
2919
- function shim(props, propName, componentName, location, propFullName, secret) {
2920
- if (secret === ReactPropTypesSecret) {
2921
- // It is still safe when called from React.
2922
- return;
2923
- }
2924
- var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
2925
- err.name = 'Invariant Violation';
2926
- throw err;
2927
- }
2928
- shim.isRequired = shim;
2929
- function getShim() {
2930
- return shim;
2931
- }
2932
- // Important!
2933
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
2934
- var ReactPropTypes = {
2935
- array: shim,
2936
- bigint: shim,
2937
- bool: shim,
2938
- func: shim,
2939
- number: shim,
2940
- object: shim,
2941
- string: shim,
2942
- symbol: shim,
2943
- any: shim,
2944
- arrayOf: getShim,
2945
- element: shim,
2946
- elementType: shim,
2947
- instanceOf: getShim,
2948
- node: shim,
2949
- objectOf: getShim,
2950
- oneOf: getShim,
2951
- oneOfType: getShim,
2952
- shape: getShim,
2953
- exact: getShim,
2954
- checkPropTypes: emptyFunctionWithReset,
2955
- resetWarningCache: emptyFunction
2956
- };
2957
- ReactPropTypes.PropTypes = ReactPropTypes;
2958
- return ReactPropTypes;
2959
- };
2960
- return factoryWithThrowingShims;
2961
- }
2962
-
2963
- /**
2964
- * Copyright (c) 2013-present, Facebook, Inc.
2965
- *
2966
- * This source code is licensed under the MIT license found in the
2967
- * LICENSE file in the root directory of this source tree.
2968
- */
2969
- if (process.env.NODE_ENV !== 'production') {
2970
- var ReactIs = requireReactIs();
2971
-
2972
- // By explicitly using `prop-types` you are opting into new development behavior.
2973
- // http://fb.me/prop-types-in-prod
2974
- var throwOnDirectAccess = true;
2975
- propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
2976
- } else {
2977
- // By explicitly using `prop-types` you are opting into new production behavior.
2978
- // http://fb.me/prop-types-in-prod
2979
- propTypes.exports = requireFactoryWithThrowingShims()();
2980
- }
2981
- var propTypesExports = propTypes.exports;
2982
- var dateFormats = {
2983
- date: 'YYYY-MM-DD',
2984
- basic_date: 'YYYYMMDD',
2985
- basic_date_time: 'YYYYMMDD[T]HHmmss.SSSZ',
2986
- basic_date_time_no_millis: 'YYYYMMDD[T]HHmmssZ',
2987
- date_time_no_millis: 'YYYY-MM-DD[T]HH:mm:ssZ',
2988
- basic_time: 'HHmmss.SSSZ',
2989
- basic_time_no_millis: 'HHmmssZ',
2990
- epoch_millis: 'epoch_millis',
2991
- epoch_second: 'epoch_second'
2992
- };
2993
- var componentTypes = {
2994
- reactiveList: 'REACTIVELIST',
2995
- // search components
2996
- dataSearch: 'DATASEARCH',
2997
- categorySearch: 'CATEGORYSEARCH',
2998
- searchBox: 'SEARCHBOX',
2999
- // list components
3000
- singleList: 'SINGLELIST',
3001
- multiList: 'MULTILIST',
3002
- singleDataList: 'SINGLEDATALIST',
3003
- tabDataList: 'TABDATALIST',
3004
- singleDropdownList: 'SINGLEDROPDOWNLIST',
3005
- multiDataList: 'MULTIDATALIST',
3006
- multiDropdownList: 'MULTIDROPDOWNLIST',
3007
- singleDropdownRange: 'SINGLEDROPDOWNRANGE',
3008
- treeList: 'TREELIST',
3009
- // basic components
3010
- numberBox: 'NUMBERBOX',
3011
- tagCloud: 'TAGCLOUD',
3012
- toggleButton: 'TOGGLEBUTTON',
3013
- reactiveComponent: 'REACTIVECOMPONENT',
3014
- // range components
3015
- datePicker: 'DATEPICKER',
3016
- dateRange: 'DATERANGE',
3017
- dynamicRangeSlider: 'DYNAMICRANGESLIDER',
3018
- multiDropdownRange: 'MULTIDROPDOWNRANGE',
3019
- singleRange: 'SINGLERANGE',
3020
- multiRange: 'MULTIRANGE',
3021
- rangeSlider: 'RANGESLIDER',
3022
- ratingsFilter: 'RATINGSFILTER',
3023
- rangeInput: 'RANGEINPUT',
3024
- // map components
3025
- geoDistanceDropdown: 'GEO_DISTANCE_DROPDOWN',
3026
- geoDistanceSlider: 'GEO_DISTANCE_SLIDER',
3027
- reactiveMap: 'REACTIVE_MAP',
3028
- // chart components
3029
- reactiveChart: 'REACTIVE_CHART'
3030
- };
3031
- var CLEAR_ALL = {
3032
- NEVER: 'never',
3033
- ALWAYS: 'always',
3034
- DEFAULT: 'default'
3035
- };
3036
- var reactKeyType = propTypesExports.oneOfType([propTypesExports.string, propTypesExports.arrayOf(propTypesExports.string), propTypesExports.object, propTypesExports.arrayOf(propTypesExports.object)]);
3037
- function validateLocation(props, propName) {
3038
- // eslint-disable-next-line
3039
- if (isNaN(props[propName])) {
3040
- return new Error("".concat(propName, " value must be a number"));
3041
- }
3042
- if (propName === 'lat' && (props[propName] < -90 || props[propName] > 90)) {
3043
- return new Error("".concat(propName, " value should be between -90 and 90."));
3044
- } else if (propName === 'lng' && (props[propName] < -180 || props[propName] > 180)) {
3045
- return new Error("".concat(propName, " value should be between -180 and 180."));
3046
- }
3047
- return null;
3048
- }
3049
-
3050
- // eslint-disable-next-line consistent-return
3051
- var dataFieldValidator = function dataFieldValidator(props, propName, componentName) {
3052
- var requiredError = new Error("".concat(propName, " supplied to ").concat(componentName, " is required. Validation failed."));
3053
- var propValue = props[propName];
3054
- if (!propValue) return requiredError;
3055
- if (typeof propValue !== 'string' && _typeof(propValue) !== 'object' && !Array.isArray(propValue)) {
3056
- return new Error("Invalid ".concat(propName, " supplied to ").concat(componentName, ". Validation failed."));
3057
- }
3058
- if (Array.isArray(propValue) && propValue.length === 0) return requiredError;
3059
- };
3060
- var types = {
3061
- any: propTypesExports.any,
3062
- analyticsConfig: propTypesExports.shape({
3063
- emptyQuery: propTypesExports.bool,
3064
- suggestionAnalytics: propTypesExports.bool,
3065
- userId: propTypesExports.string,
3066
- customEvents: propTypesExports.object // eslint-disable-line
3067
- }),
3068
-
3069
- appbaseConfig: propTypesExports.shape({
3070
- enableQueryRules: propTypesExports.bool,
3071
- enableSearchRelevancy: propTypesExports.bool,
3072
- recordAnalytics: propTypesExports.bool,
3073
- emptyQuery: propTypesExports.bool,
3074
- suggestionAnalytics: propTypesExports.bool,
3075
- userId: propTypesExports.string,
3076
- useCache: propTypesExports.bool,
3077
- customEvents: propTypesExports.object,
3078
- // eslint-disable-line
3079
- enableTelemetry: propTypesExports.bool,
3080
- queryString: propTypesExports.object // eslint-disable-line
3081
- }),
3082
-
3083
- bool: propTypesExports.bool,
3084
- boolRequired: propTypesExports.bool.isRequired,
3085
- components: propTypesExports.arrayOf(propTypesExports.string),
3086
- children: propTypesExports.any,
3087
- data: propTypesExports.arrayOf(propTypesExports.object),
3088
- dataFieldArray: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.arrayOf(propTypesExports.string)]).isRequired,
3089
- dataNumberBox: propTypesExports.shape({
3090
- label: propTypesExports.string,
3091
- start: propTypesExports.number.isRequired,
3092
- end: propTypesExports.number.isRequired
3093
- }).isRequired,
3094
- date: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.arrayOf(propTypesExports.string)]),
3095
- dateObject: propTypesExports.object,
3096
- excludeFields: propTypesExports.arrayOf(propTypesExports.string),
3097
- fieldWeights: propTypesExports.arrayOf(propTypesExports.number),
3098
- filterLabel: propTypesExports.string,
3099
- func: propTypesExports.func,
3100
- funcRequired: propTypesExports.func.isRequired,
3101
- fuzziness: propTypesExports.oneOf([0, 1, 2, 'AUTO']),
3102
- headers: propTypesExports.object,
3103
- hits: propTypesExports.arrayOf(propTypesExports.object),
3104
- rawData: propTypesExports.object,
3105
- iconPosition: propTypesExports.oneOf(['left', 'right']),
3106
- includeFields: propTypesExports.arrayOf(propTypesExports.string),
3107
- labelPosition: propTypesExports.oneOf(['left', 'right', 'top', 'bottom']),
3108
- number: propTypesExports.number,
3109
- options: propTypesExports.oneOfType([propTypesExports.arrayOf(propTypesExports.object), propTypesExports.object]),
3110
- paginationAt: propTypesExports.oneOf(['top', 'bottom', 'both']),
3111
- range: propTypesExports.shape({
3112
- start: propTypesExports.oneOfType([propTypesExports.number, propTypesExports.string, propTypesExports.object]).isRequired,
3113
- end: propTypesExports.oneOfType([propTypesExports.number, propTypesExports.string, propTypesExports.object]).isRequired
3114
- }),
3115
- rangeLabels: propTypesExports.shape({
3116
- start: propTypesExports.string.isRequired,
3117
- end: propTypesExports.string.isRequired
3118
- }),
3119
- react: propTypesExports.shape({
3120
- and: reactKeyType,
3121
- or: reactKeyType,
3122
- not: reactKeyType
3123
- }),
3124
- categorySearchValue: propTypesExports.shape({
3125
- term: propTypesExports.string,
3126
- category: propTypesExports.string
3127
- }),
3128
- selectedValues: propTypesExports.object,
3129
- selectedValue: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.arrayOf(propTypesExports.string), propTypesExports.arrayOf(propTypesExports.object), propTypesExports.object, propTypesExports.number, propTypesExports.arrayOf(propTypesExports.number)]),
3130
- suggestions: propTypesExports.arrayOf(propTypesExports.object),
3131
- supportedOrientations: propTypesExports.oneOf(['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right']),
3132
- tooltipTrigger: propTypesExports.oneOf(['hover', 'none', 'focus', 'always']),
3133
- sortBy: propTypesExports.oneOf(['asc', 'desc']),
3134
- sortOptions: propTypesExports.arrayOf(propTypesExports.shape({
3135
- label: propTypesExports.string,
3136
- dataField: propTypesExports.string,
3137
- sortBy: propTypesExports.string
3138
- })),
3139
- sortByWithCount: propTypesExports.oneOf(['asc', 'desc', 'count']),
3140
- stats: propTypesExports.arrayOf(propTypesExports.object),
3141
- string: propTypesExports.string,
3142
- stringArray: propTypesExports.arrayOf(propTypesExports.string),
3143
- stringOrArray: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.arrayOf(propTypesExports.string)]),
3144
- stringRequired: propTypesExports.string.isRequired,
3145
- style: propTypesExports.object,
3146
- themePreset: propTypesExports.oneOf(['light', 'dark']),
3147
- queryFormatDate: propTypesExports.oneOf(Object.keys(dateFormats)),
3148
- queryFormatSearch: propTypesExports.oneOf(['and', 'or']),
3149
- queryFormatNumberBox: propTypesExports.oneOf(['exact', 'lte', 'gte']),
3150
- params: propTypesExports.object.isRequired,
3151
- props: propTypesExports.object,
3152
- rangeLabelsAlign: propTypesExports.oneOf(['left', 'right']),
3153
- title: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.any]),
3154
- location: propTypesExports.shape({
3155
- lat: validateLocation,
3156
- lng: validateLocation
3157
- }),
3158
- unit: propTypesExports.oneOf(['mi', 'miles', 'yd', 'yards', 'ft', 'feet', 'in', 'inch', 'km', 'kilometers', 'm', 'meters', 'cm', 'centimeters', 'mm', 'millimeters', 'NM', 'nmi', 'nauticalmiles']),
3159
- aggregationData: propTypesExports.array,
3160
- showClearAll: propTypesExports.oneOf([CLEAR_ALL.NEVER, CLEAR_ALL.ALWAYS, CLEAR_ALL.DEFAULT, true, false]),
3161
- componentType: propTypesExports.oneOf(Object.values(componentTypes)),
3162
- componentObject: propTypesExports.object,
3163
- dataFieldValidator: dataFieldValidator,
3164
- focusShortcuts: propTypesExports.oneOfType([propTypesExports.arrayOf(propTypesExports.string), propTypesExports.arrayOf(propTypesExports.number)]),
3165
- mongodb: propTypesExports.shape({
3166
- db: propTypesExports.string,
3167
- collection: propTypesExports.string
3168
- }),
3169
- calendarInterval: propTypesExports.oneOf(['month', 'day', 'year', 'week', 'quarter', 'hour', 'minute']),
3170
- preferences: propTypesExports.object,
3171
- endpoint: propTypesExports.shape({
3172
- url: propTypesExports.string.isRequired,
3173
- method: propTypesExports.string,
3174
- /* eslint-disable react/forbid-prop-types */
3175
- headers: propTypesExports.object,
3176
- body: propTypesExports.object
3177
- /* eslint-enable react/forbid-prop-types */
3178
- })
3179
- };
3180
-
3181
- var _templateObject$8, _templateObject2$1;
3182
- var HierarchicalMenuList = styled('ul')(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
3183
- var HierarchicalMenuListItem = styled('li')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
3184
- return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
3185
- });
3186
-
3187
- var HierarchicalMenuListItemComponent = {
3188
- name: 'HierarchicalMenuListItemComponent',
3189
- data: function data() {
3190
- return {
3191
- isExpanded: false,
3192
- newParentPath: ''
3193
- };
3194
- },
3195
- created: function created() {
3196
- var listItemLabel = this.listItem.key;
3197
- var newParentPath = listItemLabel;
3198
- if (this.parentPath) {
3199
- newParentPath = "" + this.parentPath + TREELIST_VALUES_PATH_SEPARATOR + listItemLabel;
3200
- }
3201
- this.newParentPath = newParentPath;
3202
- this.isExpanded = !!recLookup(this.selectedValues, newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3203
- },
3204
- watch: {
3205
- listItem: function listItem(newVal) {
3206
- if (newVal.initiallyExpanded) {
3207
- this.isExpanded = newVal.initiallyExpanded;
3208
- }
3209
- },
3210
- selectedValues: function selectedValues(newVal) {
3211
- this.isExpanded = !!recLookup(newVal, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3212
- }
3213
- },
3214
- props: {
3215
- parentPath: types.string,
3216
- selectedValues: types.rawData,
3217
- mode: types.string,
3218
- searchTerm: types.string,
3219
- listItem: types.rawData,
3220
- showLine: types.bool,
3221
- renderItem: types.func,
3222
- handleListItemClick: types.func,
3223
- renderSwitcherIcon: types.func,
3224
- showCheckbox: VueTypes.bool,
3225
- innerClass: types.style,
3226
- showRadio: VueTypes.bool,
3227
- renderIcon: types.func,
3228
- showCount: VueTypes.bool,
3229
- showSwitcherIcon: types.bool,
3230
- switcherIcon: types.children
3231
- },
3232
- render: function render() {
3233
- var _this = this;
3234
- var _this$$props = this.$props,
3235
- selectedValues = _this$$props.selectedValues,
3236
- mode = _this$$props.mode,
3237
- searchTerm = _this$$props.searchTerm,
3238
- listItem = _this$$props.listItem,
3239
- parentPath = _this$$props.parentPath,
3240
- showLine = _this$$props.showLine,
3241
- renderItem = _this$$props.renderItem,
3242
- handleListItemClick = _this$$props.handleListItemClick,
3243
- showCheckbox = _this$$props.showCheckbox,
3244
- innerClass = _this$$props.innerClass,
3245
- showRadio = _this$$props.showRadio,
3246
- renderIcon = _this$$props.renderIcon,
3247
- showCount = _this$$props.showCount,
3248
- showSwitcherIcon = _this$$props.showSwitcherIcon;
3249
- if (!(listItem instanceof Object) || Object.keys(listItem).length === 0) {
3250
- return null;
3251
- }
3252
- var listItemLabel = listItem.key;
3253
- var listItemCount = listItem.count;
3254
- var isLeafNode = !(Array.isArray(listItem.list) && listItem.list.length > 0);
3255
- var renderSwitcherIcon = function renderSwitcherIcon(isExpandedProp) {
3256
- if (showSwitcherIcon === false) {
3257
- return null;
3258
- }
3259
- var switcherIcon = _this.$props.switcherIcon;
3260
- if (switcherIcon) return switcherIcon(isExpandedProp);
3261
- return (
3262
- /* eslint-disable jsx-a11y/click-events-have-key-events
3263
- , jsx-a11y/no-static-element-interactions,jsx-a11y/no-noninteractive-tabindex */
3264
- createVNode("span", {
3265
- "tabIndex": "0",
3266
- "onClick": function onClick(e) {
3267
- e.stopPropagation();
3268
- _this.isExpanded = !_this.isExpanded;
3269
- },
3270
- "class": "--switcher-icon"
3271
- }, [createTextVNode("\u27A4")])
3272
- );
3273
- };
3274
- var isSelected = false;
3275
- if (mode === 'single') {
3276
- if (recLookup(selectedValues, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR) === true) {
3277
- isSelected = true;
3278
- }
3279
- } else {
3280
- isSelected = !!recLookup(selectedValues, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3281
- }
3282
- return createVNode(HierarchicalMenuListItem, {
3283
- "class": (isSelected ? '-selected-item' : '') + " " + (this.isExpanded ? '-expanded-item' : ''),
3284
- "key": this.newParentPath,
3285
- "showLine": showLine
3286
- }, {
3287
- "default": function _default() {
3288
- return [createVNode(ListItem, {
3289
- "isTreeListItem": true,
3290
- "onClick": function onClick() {
3291
- handleListItemClick(listItemLabel, parentPath);
3292
- },
3293
- "style": {
3294
- textDecoration: 'none'
3295
- }
3296
- }, {
3297
- "default": function _default() {
3298
- return [renderItem ? renderItem(listItemLabel, listItemCount, isSelected) : createVNode(Flex, {
3299
- "alignItems": "center",
3300
- "gap": "5px"
3301
- }, {
3302
- "default": function _default() {
3303
- return [!isLeafNode && renderSwitcherIcon(isSelected), mode === 'multiple' && showCheckbox && createVNode(Flex, {
3304
- "alignItems": "center",
3305
- "gap": "5px"
3306
- }, {
3307
- "default": function _default() {
3308
- return [createVNode(Checkbox, {
3309
- "type": "checkbox",
3310
- "class": getClassName$2(innerClass, 'checkbox') || null,
3311
- "checked": isSelected,
3312
- "id": listItemLabel + "-checkbox-" + _this.newParentPath,
3313
- "name": listItemLabel + "-checkbox-" + _this.newParentPath,
3314
- "show": true,
3315
- "readOnly": true
3316
- }, null), createVNode("label", {
3317
- "style": {
3318
- width: '26px',
3319
- marginTop: 0,
3320
- marginBottom: 0,
3321
- marginRight: '-9px',
3322
- left: '-3px'
3323
- },
3324
- "htmlFor": listItemLabel + "-checkbox-" + _this.newParentPath,
3325
- "onClick": function onClick(e) {
3326
- e.stopPropagation();
3327
- }
3328
- }, null)];
3329
- }
3330
- }), mode === 'single' && showRadio && createVNode(Flex, {
3331
- "alignItems": "center",
3332
- "gap": "5px"
3333
- }, {
3334
- "default": function _default() {
3335
- return [createVNode(Radio, {
3336
- "checked": isSelected,
3337
- "class": getClassName$2(innerClass, 'radio') || null,
3338
- "id": listItemLabel + "-radio-" + _this.newParentPath,
3339
- "name": listItemLabel + "-radio-" + _this.newParentPath,
3340
- "show": true,
3341
- "readOnly": true,
3342
- "type": "radio"
3343
- }, null), createVNode("label", {
3344
- "style": {
3345
- width: '26px',
3346
- marginTop: 0,
3347
- marginBottom: 0,
3348
- marginRight: '-9px',
3349
- left: '-3px'
3350
- },
3351
- "htmlFor": listItemLabel + "-radio-" + _this.newParentPath,
3352
- "onClick": function onClick(e) {
3353
- e.stopPropagation();
3354
- }
3355
- }, null)];
3356
- }
3357
- }), ' ', renderIcon(isLeafNode), createVNode("div", {
3358
- "class": "--list-item-label-count-wrapper"
3359
- }, [createVNode("span", {
3360
- "class": "--list-item-label " + (getClassName$2(innerClass, 'label') || '')
3361
- }, [listItemLabel]), showCount && createVNode("span", {
3362
- "class": "--list-item-count " + (getClassName$2(innerClass, 'count') || '')
3363
- }, [listItemCount])])];
3364
- }
3365
- })];
3366
- }
3367
- }), isLeafNode === false && createVNode("div", {
3368
- "class": "--list-child " + (showSwitcherIcon ? ' --show-switcher-icon' : '')
3369
- }, [createVNode(HierarchicalMenuComponent, {
3370
- "key": _this.newParentPath + "-" + listItemLabel + "-" + listItemCount,
3371
- "listArray": listItem.list,
3372
- "parentPath": _this.newParentPath,
3373
- "isExpanded": _this.isExpanded,
3374
- "listItemProps": {
3375
- mode: mode,
3376
- selectedValues: selectedValues,
3377
- searchTerm: searchTerm,
3378
- showLine: showLine,
3379
- renderItem: renderItem,
3380
- handleListItemClick: handleListItemClick,
3381
- renderSwitcherIcon: renderSwitcherIcon,
3382
- showCheckbox: showCheckbox,
3383
- innerClass: innerClass,
3384
- showRadio: showRadio,
3385
- renderIcon: renderIcon,
3386
- showCount: showCount,
3387
- showSwitcherIcon: showSwitcherIcon,
3388
- switcherIcon: _this.$props.switcherIcon
3389
- }
3390
- }, null)])];
3391
- }
3392
- });
3393
- }
3394
- };
3395
-
3396
- function _isSlot$1(s) {
3397
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
3398
- }
3399
- var HierarchicalMenuComponent = {
3400
- name: 'HierarchicalMenuComponent',
3401
- props: {
3402
- listArray: VueTypes.arrayOf(VueTypes.object),
3403
- // array of objects
3404
- parentPath: VueTypes.string.def(''),
3405
- isExpanded: VueTypes.bool.def(false),
3406
- listItemProps: types.rawData
3407
- },
3408
- render: function render() {
3409
- var _slot;
3410
- var _this$$props = this.$props,
3411
- listArray = _this$$props.listArray,
3412
- isExpanded = _this$$props.isExpanded,
3413
- parentPath = _this$$props.parentPath,
3414
- listItemProps = _this$$props.listItemProps;
3415
- if (!Array.isArray(listArray) || listArray.length === 0) {
3416
- return null;
3417
- }
3418
- return createVNode(HierarchicalMenuList, {
3419
- "class": "" + (isExpanded ? '--open' : ''),
3420
- "isSelected": isExpanded
3421
- }, _isSlot$1(_slot = listArray.map(function (listItem) {
3422
- return createVNode(HierarchicalMenuListItemComponent, mergeProps({
3423
- "key": parentPath + "__" + JSON.stringify(listItem),
3424
- "parentPath": parentPath,
3425
- "listItem": listItem
3426
- }, listItemProps), null);
3427
- })) ? _slot : {
3428
- "default": function _default() {
3429
- return [_slot];
3430
- }
3431
- });
3432
- }
3433
- };
3434
-
3435
- function _isSlot$2(s) {
3436
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
3437
- }
3438
- var updateQueryAction = Actions.updateQuery,
3439
- setQueryOptions = Actions.setQueryOptions;
3440
- var transformValueIntoLocalState = function transformValueIntoLocalState(valueArray) {
3441
- var valueToSet = {};
3442
- if (valueArray.length) {
3443
- var newSelectedValues = {};
3444
- valueArray.forEach(function (valueItem) {
3445
- setDeep(newSelectedValues, valueItem.split(' > '), !recLookup(newSelectedValues, valueItem.split(' > '), TREELIST_VALUES_PATH_SEPARATOR), true);
3446
- });
3447
- valueToSet = newSelectedValues;
3448
- }
3449
- return valueToSet;
3450
- };
3451
- var TreeList = {
3452
- name: 'TreeList',
3453
- props: {
3454
- selectedValue: types$1.selectedValue,
3455
- error: types$1.title,
3456
- rawData: types$1.rawData,
3457
- aggregationData: types$1.rawData,
3458
- themePreset: types$1.themePreset,
3459
- updateQueryAction: types$1.funcRequired,
3460
- setQueryOptions: types$1.funcRequired,
3461
- // component props
3462
- componentId: types$1.string.isRequired,
3463
- className: types$1.string,
3464
- style: types$1.style,
3465
- showRadio: VueTypes.bool.def(false),
3466
- showCheckbox: types$1.bool.def(false),
3467
- mode: VueTypes.oneOf(['single', 'multiple']).def('multiple'),
3468
- showCount: VueTypes.bool.def(false),
3469
- showSearch: VueTypes.bool.def(false),
3470
- showIcon: VueTypes.bool.def(false),
3471
- icon: types$1.children,
3472
- showLeafIcon: VueTypes.bool.def(false),
3473
- leafIcon: types$1.children,
3474
- showLine: VueTypes.bool.def(false),
3475
- switcherIcon: types$1.func,
3476
- render: types$1.func,
3477
- renderItem: types$1.func,
3478
- innerClass: types$1.style,
3479
- placeholder: types$1.string,
3480
- title: types$1.title,
3481
- isLoading: types$1.bool,
3482
- dataField: types$1.stringArray.isRequired,
3483
- onQueryChange: types$1.func,
3484
- defaultValue: types$1.stringArray,
3485
- value: types$1.stringArray,
3486
- customQuery: types$1.func,
3487
- defaultQuery: types$1.func,
3488
- enableAppbase: types$1.bool,
3489
- index: types$1.string,
3490
- showFilter: types$1.bool,
3491
- URLParams: types$1.bool,
3492
- filterLabel: types$1.string,
3493
- onChange: types$1.func,
3494
- onValueChange: types$1.func,
3495
- beforeValueChange: types$1.func,
3496
- sortBy: types$1.sortByWithCount.def('count'),
3497
- onError: types$1.func,
3498
- showSwitcherIcon: types$1.bool.def(true),
3499
- renderError: types$1.title,
3500
- renderNoResults: types$1.func,
3501
- loader: types$1.title,
3502
- aggergationSize: types$1.number,
3503
- endpoint: types$1.endpoint,
3504
- queryFormat: types$1.queryFormatSearch.def('or'),
3505
- size: types$1.number.def(100),
3506
- nestedField: types$1.string,
3507
- react: types$1.react,
3508
- transformData: types$1.func,
3509
- selectAllLabel: types$1.string,
3510
- showMissing: VueTypes.bool.def(false),
3511
- missingLabel: VueTypes.string.def('N/A')
3512
- },
3513
- data: function data() {
3514
- var props = this.$props;
3515
- this.__state = {
3516
- selectedValues: {},
3517
- searchTerm: '',
3518
- aggregationData: []
3519
- };
3520
- this.internalComponent = props.componentId + "__internal";
3521
- return this.__state;
3522
- },
3523
- created: function created() {
3524
- var props = this.$props;
3525
- var componentId = props.componentId;
3526
- var defaultValue = this.defaultValue || this.value;
3527
- var currentValueArray = this.selectedValue || defaultValue || [];
3528
- // update local state for selected values
3529
- if (currentValueArray.length) {
3530
- var newSelectedValues = transformValueIntoLocalState(currentValueArray);
3531
- this.setValue(newSelectedValues, true);
3532
- }
3533
-
3534
- // Set custom and default queries in store
3535
- updateCustomQuery$1(componentId, props, currentValueArray);
3536
- updateDefaultQuery$1(componentId, props, currentValueArray);
3537
- this.updateQueryOptions();
3538
- },
3539
- mounted: function mounted() {
3540
- var _this$$props = this.$props,
3541
- enableAppbase = _this$$props.enableAppbase,
3542
- index = _this$$props.index;
3543
- if (!enableAppbase && index) {
3544
- console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
3545
- }
3546
- },
3547
- watch: {
3548
- defaultQuery: function defaultQuery() {
3549
- this.updateDefaultQuery();
3550
- this.updateQuery([]);
3551
- },
3552
- customQuery: function customQuery() {
3553
- var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues) || [];
3554
- this.updateQuery(valueArray);
3555
- },
3556
- sortBy: function sortBy() {
3557
- this.updateQueryOptions();
3558
- },
3559
- dataField: function dataField() {
3560
- var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues) || [];
3561
- this.updateQueryOptions();
3562
- this.updateQuery(valueArray);
3563
- },
3564
- value: function value(newVal, oldVal) {
3565
- if (!isEqual$1(newVal, oldVal)) {
3566
- this.setValue(newVal);
3567
- }
3568
- },
3569
- selectedValue: function selectedValue(newVal) {
3570
- if (!isEqual$1(transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues), newVal)) {
3571
- var _this$$props2 = this.$props,
3572
- value = _this$$props2.value,
3573
- onChange = _this$$props2.onChange;
3574
- var valueToSet = [];
3575
- if (Array.isArray(newVal) && newVal.length) {
3576
- valueToSet = newVal;
3577
- }
3578
- if (value === undefined) {
3579
- this.setValue(valueToSet);
3580
- } else if (onChange && !isEqual$1(value, valueToSet)) {
3581
- onChange(valueToSet);
3582
- }
3583
- }
3584
- },
3585
- aggregationData: function aggregationData(newVal, oldVal) {
3586
- if (newVal && !isEqual$1(newVal, oldVal)) {
3587
- this.$data.aggregationData = newVal;
3588
- }
3589
- }
3590
- },
3591
- computed: {
3592
- hasCustomRenderer: function hasCustomRenderer$1() {
3593
- return hasCustomRenderer(this);
3594
- }
3595
- },
3596
- methods: {
3597
- renderIcon: function renderIcon(isLeafNode) {
3598
- var _this$$props3 = this.$props,
3599
- showIcon = _this$$props3.showIcon,
3600
- showLeafIcon = _this$$props3.showLeafIcon,
3601
- icon = _this$$props3.icon;
3602
- if (isLeafNode) {
3603
- if (!showLeafIcon) return null;
3604
- var _ref = this.$slots || this.$props,
3605
- leafIcon = _ref.leafIcon;
3606
- if (leafIcon) return leafIcon();
3607
- return createVNode("span", {
3608
- "role": "img",
3609
- "aria-label": "file",
3610
- "class": "--leaf-icon"
3611
- }, [createVNode("svg", {
3612
- "viewBox": "64 64 896 896",
3613
- "focusable": "false",
3614
- "data-icon": "file",
3615
- "width": "1em",
3616
- "height": "1em",
3617
- "fill": "currentColor",
3618
- "aria-hidden": "true"
3619
- }, [createVNode("path", {
3620
- "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"
3621
- }, null)])]);
3622
- }
3623
- if (!showIcon) return null;
3624
- if (icon) {
3625
- return icon;
3626
- }
3627
- if (this.$slots.icon) {
3628
- return this.$slots.icon();
3629
- }
3630
- return createVNode("span", {
3631
- "role": "img",
3632
- "aria-label": "folder-open",
3633
- "class": "--folder-icon"
3634
- }, [createVNode("svg", {
3635
- "viewBox": "64 64 896 896",
3636
- "focusable": "false",
3637
- "data-icon": "folder-open",
3638
- "width": "1em",
3639
- "height": "1em",
3640
- "fill": "currentColor",
3641
- "aria-hidden": "true"
3642
- }, [createVNode("path", {
3643
- "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"
3644
- }, null)])]);
3645
- },
3646
- getTransformedData: function getTransformedData() {
3647
- var _this$$props4 = this.$props,
3648
- dataField = _this$$props4.dataField,
3649
- showSearch = _this$$props4.showSearch;
3650
- var transformedData = transformRawTreeListData(this.$data.aggregationData, dataField);
3651
- var filteredData = [];
3652
- if (showSearch && this.searchTerm) {
3653
- filteredData = this.filterDataBasedOnSearchTerm(transformedData, '');
3654
- }
3655
- return filteredData.length ? filteredData : transformedData;
3656
- },
3657
- handleInputChange: function handleInputChange(e) {
3658
- var value = e.target.value;
3659
- this.searchTerm = value;
3660
- },
3661
- renderSearch: function renderSearch() {
3662
- var _this$$props5 = this.$props,
3663
- showSearch = _this$$props5.showSearch,
3664
- innerClass = _this$$props5.innerClass,
3665
- placeholder = _this$$props5.placeholder,
3666
- componentId = _this$$props5.componentId,
3667
- themePreset = _this$$props5.themePreset;
3668
- if (showSearch) {
3669
- return createVNode(Input, {
3670
- "class": getClassName$2(innerClass, 'input') || null,
3671
- "onInput": this.handleInputChange,
3672
- "value": this.searchTerm,
3673
- "placeholder": placeholder || 'Search',
3674
- "style": {
3675
- margin: '0 0 8px'
3676
- },
3677
- "aria-label": componentId + "-search",
3678
- "themePreset": themePreset
3679
- }, null);
3680
- }
3681
- return null;
3682
- },
3683
- handleListItemClick: function handleListItemClick(key, parentPath) {
3684
- var path = key;
3685
- if (parentPath) {
3686
- path = "" + parentPath + TREELIST_VALUES_PATH_SEPARATOR + key;
3687
- }
3688
- var newSelectedValues = _extends({}, this.selectedValues);
3689
- if (this.$props.mode === 'single') {
3690
- newSelectedValues = {};
3691
- setDeep(newSelectedValues, path.split(TREELIST_VALUES_PATH_SEPARATOR), true, true);
3692
- } else {
3693
- var newValue = !recLookup(newSelectedValues, path, TREELIST_VALUES_PATH_SEPARATOR);
3694
- setDeep(newSelectedValues, path.split(TREELIST_VALUES_PATH_SEPARATOR), newValue, true);
3695
- }
3696
- newSelectedValues = sanitizeObject(_extends({}, newSelectedValues));
3697
- if (this.$props.value === undefined) {
3698
- this.setValue(newSelectedValues);
3699
- } else if (this.$props.onChange) {
3700
- var valueToSet = transformTreeListLocalStateIntoQueryComptaibleFormat(newSelectedValues);
3701
- this.$props.onChange(valueToSet);
3702
- }
3703
- },
3704
- filterDataBasedOnSearchTerm: function filterDataBasedOnSearchTerm(listArray, parentPath) {
3705
- var _this = this;
3706
- if (!(listArray && Array.isArray(listArray) && listArray.length)) {
3707
- return null;
3708
- }
3709
- var result = [];
3710
- listArray.forEach(function (ele) {
3711
- var isLeafItem = !ele.list;
3712
- var newParentPath = ele.key;
3713
- if (parentPath) {
3714
- newParentPath = parentPath + "." + ele.key;
3715
- }
3716
- var keyHasSearchTerm = replaceDiacritics(ele.key).toLowerCase().includes(replaceDiacritics(_this.$data.searchTerm).toLowerCase()) || recLookup(_this.$data.selectedValues, newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3717
- if (isLeafItem && keyHasSearchTerm) {
3718
- result.push(_extends({}, ele, {
3719
- initiallyExpanded: keyHasSearchTerm
3720
- }));
3721
- } else if (!isLeafItem) {
3722
- var filteredChildrenItems = _this.filterDataBasedOnSearchTerm(ele.list, newParentPath);
3723
- if (keyHasSearchTerm || !!filteredChildrenItems.length) {
3724
- result.push(_extends({}, ele, {
3725
- initiallyExpanded: keyHasSearchTerm || !!filteredChildrenItems.length,
3726
- list: filteredChildrenItems
3727
- }));
3728
- }
3729
- }
3730
- });
3731
- return result;
3732
- },
3733
- getComponent: function getComponent() {
3734
- var _this$$props6 = this.$props,
3735
- rawData = _this$$props6.rawData,
3736
- error = _this$$props6.error,
3737
- isLoading = _this$$props6.isLoading;
3738
- var data = {
3739
- data: this.getTransformedData(),
3740
- rawData: rawData,
3741
- error: error,
3742
- handleClick: this.handleListItemClick,
3743
- value: this.$data.selectedValues,
3744
- loading: isLoading,
3745
- PATH_SEPARATOR: TREELIST_VALUES_PATH_SEPARATOR
3746
- };
3747
- return this.$slots.render(data) || getComponent$1(data, this.$props);
3748
- },
3749
- getDefaultQuery: function getDefaultQuery(value) {
3750
- var _this2 = this;
3751
- var query = null;
3752
- var type = 'term';
3753
- var booleanAggregator = this.$props.queryFormat === 'or' ? 'should' : 'must';
3754
- if (!Array.isArray(value) || value.length === 0) {
3755
- return null;
3756
- }
3757
- if (value) {
3758
- var _bool;
3759
- // adds a sub-query with must as an array of objects for each term/value
3760
- var queryArray = value.map(function (item) {
3761
- return {
3762
- bool: {
3763
- must: item.split(' > ').map(function (subItem, i) {
3764
- var _type, _ref2;
3765
- return _ref2 = {}, _ref2[type] = (_type = {}, _type[_this2.$props.dataField[i]] = subItem, _type), _ref2;
3766
- })
3767
- }
3768
- };
3769
- });
3770
- var listQuery = {
3771
- bool: (_bool = {}, _bool[booleanAggregator] = queryArray, _bool)
3772
- };
3773
- query = value.length ? listQuery : null;
3774
- }
3775
- if (query && this.$props.nestedField) {
3776
- return {
3777
- nested: {
3778
- path: this.$props.nestedField,
3779
- query: query
3780
- }
3781
- };
3782
- }
3783
- return query;
3784
- },
3785
- updateQuery: function updateQuery(value) {
3786
- var customQuery = this.$props.customQuery;
3787
- var query = this.getDefaultQuery(value);
3788
- var customQueryOptions;
3789
- if (customQuery) {
3790
- var _ref3 = customQuery(value, this.$props) || {};
3791
- query = _ref3.query;
3792
- customQueryOptions = getOptionsFromQuery(customQuery(value, this.$props));
3793
- updateCustomQuery$1(this.$props.componentId, this.$props, value);
3794
- }
3795
- this.setQueryOptions(this.$props.componentId, _extends({}, this.generateQueryOptions(), customQueryOptions));
3796
- this.updateQueryAction({
3797
- componentId: this.$props.componentId,
3798
- query: query,
3799
- value: value,
3800
- label: this.$props.filterLabel,
3801
- showFilter: this.$props.showFilter,
3802
- URLParams: this.$props.URLParams,
3803
- componentType: componentTypes$1.treeList
3804
- });
3805
- },
3806
- setValue: function setValue(value, hasMountedParam) {
3807
- var _this3 = this;
3808
- if (hasMountedParam === void 0) {
3809
- hasMountedParam = true;
3810
- }
3811
- var finalValues = Array.isArray(value) === false ? transformTreeListLocalStateIntoQueryComptaibleFormat(value) : value;
3812
- var performUpdate = function performUpdate() {
3813
- var handleUpdates = function handleUpdates() {
3814
- _this3.updateQuery(finalValues);
3815
- if (_this3.$props.onValueChange) _this3.$props.onValueChange(finalValues);
3816
- };
3817
- if (hasMountedParam) {
3818
- _this3.selectedValues = Array.isArray(value) ? transformValueIntoLocalState(value) : value;
3819
- handleUpdates();
3820
- } else {
3821
- handleUpdates();
3822
- }
3823
- };
3824
- checkValueChange$1(this.$props.componentId, finalValues, this.$props.beforeValueChange, performUpdate);
3825
- },
3826
- generateQueryOptions: function generateQueryOptions() {
3827
- var queryOptions = getQueryOptions(this.$props);
3828
- var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.selectedValues);
3829
- return getAggsQuery(valueArray, queryOptions, this.$props);
3830
- },
3831
- updateDefaultQuery: function updateDefaultQuery(queryOptions) {
3832
- var value = transformTreeListLocalStateIntoQueryComptaibleFormat(this.selectedValues);
3833
- // Update default query for RS API
3834
- updateDefaultQuery$1(this.$props.componentId, this.$props, value);
3835
- updateInternalQuery(getInternalComponentID(this.$props.componentId), queryOptions, value, this.$props, this.generateQueryOptions(), null);
3836
- },
3837
- updateQueryOptions: function updateQueryOptions() {
3838
- // for a new query due to other changes don't append after to get fresh results
3839
- var queryOptions = this.generateQueryOptions(this.$props, {}, transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues));
3840
- if (this.$props.defaultQuery) {
3841
- // eslint-disable-next-line no-use-before-define
3842
- this.updateDefaultQuery(queryOptions);
3843
- } else {
3844
- this.setQueryOptions(getInternalComponentID(this.$props.componentId), queryOptions);
3845
- }
3846
- }
3847
- },
3848
- render: function render() {
3849
- var _this4 = this;
3850
- var props = this.$props;
3851
- var style = props.style,
3852
- className = props.className,
3853
- mode = props.mode,
3854
- showLine = props.showLine,
3855
- renderItem = props.renderItem,
3856
- showCheckbox = props.showCheckbox,
3857
- innerClass = props.innerClass,
3858
- showRadio = props.showRadio,
3859
- showCount = props.showCount,
3860
- showSwitcherIcon = props.showSwitcherIcon,
3861
- switcherIcon = props.switcherIcon,
3862
- title = props.title,
3863
- loader = props.loader,
3864
- renderError = props.renderError;
3865
- if (this.isLoading) {
3866
- return (this.$slots.loader ? this.$slots.loader() : loader) || null;
3867
- }
3868
- if (this.error) {
3869
- if (this.$slots.renderError) {
3870
- return this.$slots.renderError(this.error);
3871
- }
3872
- return isFunction$1(renderError) ? renderError(this.error) : renderError;
3873
- }
3874
- var transformedData = this.getTransformedData();
3875
- if (!transformedData || transformedData.length === 0) {
3876
- return this.$slots.renderNoResults ? this.$slots.renderNoResults() : null;
3877
- }
3878
- return createVNode(Container, {
3879
- "style": style,
3880
- "class": className
3881
- }, {
3882
- "default": function _default() {
3883
- return [props.title && createVNode(Title, {
3884
- "class": getClassName$2(innerClass, 'title') || null
3885
- }, _isSlot$2(title) ? title : {
3886
- "default": function _default() {
3887
- return [title];
3888
- }
3889
- }), _this4.renderSearch(), _this4.hasCustomRenderer ? _this4.getComponent() : createVNode(HierarchicalMenuComponent, {
3890
- "key": "initial-node",
3891
- "listArray": transformedData,
3892
- "parentPath": "",
3893
- "isExpanded": true,
3894
- "listItemProps": {
3895
- mode: mode,
3896
- selectedValues: _this4.selectedValues,
3897
- searchTerm: _this4.searchTerm,
3898
- showLine: showLine,
3899
- renderItem: renderItem != null ? renderItem : _this4.$slots.renderItem,
3900
- handleListItemClick: _this4.handleListItemClick,
3901
- showCheckbox: showCheckbox,
3902
- innerClass: innerClass,
3903
- showRadio: showRadio,
3904
- renderIcon: _this4.renderIcon,
3905
- showCount: showCount,
3906
- showSwitcherIcon: showSwitcherIcon,
3907
- switcherIcon: switcherIcon != null ? switcherIcon : _this4.$slots.switcherIcon
3908
- }
3909
- }, null)];
3910
- }
3911
- });
3912
- }
3913
- };
3914
- var mapStateToProps$1 = function mapStateToProps(state, props) {
3915
- return {
3916
- selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
3917
- rawData: state.rawData[props.componentId] || {},
3918
- aggregationData: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId] || {},
3919
- themePreset: state.config.themePreset,
3920
- error: state.error[props.componentId],
3921
- isLoading: state.isLoading[props.componentId],
3922
- enableAppbase: state.config.enableAppbase
3923
- };
3924
- };
3925
- var mapDispatchtoProps = {
3926
- setQueryOptions: setQueryOptions,
3927
- updateQueryAction: updateQueryAction
3928
- };
3929
- TreeList.hasInternalComponent = function () {
3930
- return true;
3931
- };
3932
- var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchtoProps)(TreeList), {
3933
- componentType: componentTypes$1.treeList,
3934
- internalComponent: TreeList.hasInternalComponent()
3935
- }));
3936
- TreeListConnected.name = TreeList.name;
3937
- TreeListConnected.install = function (Vue) {
3938
- Vue.component(TreeListConnected.name, TreeListConnected);
3939
- };
3940
-
3941
- // Add componentType for SSR
3942
- TreeListConnected.componentType = componentTypes$1.treeList;
3943
-
3944
- var RcConnected = PreferencesConsumer({
3945
- name: 'RcConnected',
3946
- render: function render() {
3947
- var component = ReactiveComponent;
3948
- switch (this.$attrs.componentType) {
3949
- case componentTypes$1.reactiveList:
3950
- component = ReactiveList;
3951
- break;
3952
- case componentTypes$1.searchBox:
3953
- component = SBConnected;
3954
- break;
3955
- // list components
3956
- case componentTypes$1.singleList:
3957
- component = SingleList;
3958
- break;
3959
- case componentTypes$1.multiList:
3960
- component = MultiList;
3961
- break;
3962
- case componentTypes$1.singleDropdownList:
3963
- component = SingleDropdownList;
3964
- break;
3965
- case componentTypes$1.multiDropdownList:
3966
- component = MultiDropdownList;
3967
- break;
3968
- // basic components
3969
- case componentTypes$1.toggleButton:
3970
- component = ToggleButton;
3971
- break;
3972
- // range components
3973
- case componentTypes$1.dynamicRangeSlider:
3974
- component = DynamicRangeSlider;
3975
- break;
3976
- case componentTypes$1.singleRange:
3977
- component = SingleRange;
3978
- break;
3979
- case componentTypes$1.multiRange:
3980
- component = MultiRange;
3981
- break;
3982
- case componentTypes$1.rangeSlider:
3983
- component = RangeSlider;
3984
- break;
3985
- case componentTypes$1.rangeInput:
3986
- component = RangeInput;
3987
- break;
3988
- }
3989
- return h(component, null, this.$slots);
3990
- }
3991
- });
3992
- RcConnected.name = ReactiveComponent.name;
3993
- RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
3994
- // Add componentType for SSR
3995
- RcConnected.componentType = componentTypes$1.reactiveComponent;
3996
- RcConnected.install = function (Vue) {
3997
- Vue.component(RcConnected.name, RcConnected);
3998
- };
3999
-
4000
- var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected];
4001
- function install (Vue) {
4002
- components.map(function (component) {
4003
- Vue.use(component);
4004
- return null;
4005
- });
4006
- }
4007
-
4008
- export { RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };