@appbaseio/reactivesearch-vue 1.27.0-gamma.3 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +839 -1033
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-11307285.js → Button-e0b7c1f6.js} +1 -1
- package/dist/cjs/{DataSearch-0ef14926.js → DataSearch-eec21890.js} +30 -13
- package/dist/cjs/DataSearch.js +1 -1
- package/dist/cjs/DynamicRangeSlider.js +24 -16
- package/dist/cjs/MultiDropdownList.js +34 -25
- package/dist/cjs/MultiList.js +33 -23
- package/dist/cjs/MultiRange.js +2 -3
- package/dist/cjs/RangeSlider.js +2 -3
- package/dist/cjs/ReactiveComponent.js +41 -72
- package/dist/cjs/ReactiveList.js +38 -48
- package/dist/cjs/SelectedFilters.js +6 -4
- package/dist/cjs/SingleDropdownList.js +21 -18
- package/dist/cjs/SingleList.js +19 -16
- package/dist/cjs/SingleRange.js +2 -3
- package/dist/cjs/ToggleButton.js +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/initReactivesearch.js +109 -77
- package/dist/cjs/{install-311df9cc.js → install-4886582d.js} +102 -58
- package/dist/cjs/install.js +3 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/{Button-91561391.js → Button-33de88e6.js} +1 -1
- package/dist/es/{DataSearch-be45e960.js → DataSearch-42f547cd.js} +30 -13
- package/dist/es/DataSearch.js +1 -1
- package/dist/es/DynamicRangeSlider.js +24 -16
- package/dist/es/MultiDropdownList.js +34 -25
- package/dist/es/MultiList.js +33 -23
- package/dist/es/MultiRange.js +2 -3
- package/dist/es/RangeSlider.js +2 -3
- package/dist/es/ReactiveComponent.js +41 -72
- package/dist/es/ReactiveList.js +38 -48
- package/dist/es/SelectedFilters.js +6 -4
- package/dist/es/SingleDropdownList.js +21 -18
- package/dist/es/SingleList.js +19 -16
- package/dist/es/SingleRange.js +2 -3
- package/dist/es/ToggleButton.js +1 -1
- package/dist/es/index.js +4 -4
- package/dist/es/initReactivesearch.js +111 -79
- package/dist/es/{install-af797de0.js → install-54ebd72e.js} +102 -58
- package/dist/es/install.js +3 -3
- package/dist/es/version.js +1 -1
- package/package.json +3 -3
package/dist/es/ToggleButton.js
CHANGED
|
@@ -5,7 +5,7 @@ import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
|
5
5
|
import 'emotion';
|
|
6
6
|
import '@appbaseio/vue-emotion';
|
|
7
7
|
import 'polished';
|
|
8
|
-
import { B as Button, t as toggleButtons } from './Button-
|
|
8
|
+
import { B as Button, t as toggleButtons } from './Button-33de88e6.js';
|
|
9
9
|
import { t as types } from './vueTypes-687b2304.js';
|
|
10
10
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
11
11
|
import 'redux';
|
package/dist/es/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import '@appbaseio/reactivecore/lib/utils/helper';
|
|
|
6
6
|
import 'emotion';
|
|
7
7
|
import '@appbaseio/vue-emotion';
|
|
8
8
|
import 'polished';
|
|
9
|
-
import './Button-
|
|
9
|
+
import './Button-33de88e6.js';
|
|
10
10
|
import './vueTypes-687b2304.js';
|
|
11
11
|
export { default as ReactiveList } from './ReactiveList.js';
|
|
12
12
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
@@ -23,14 +23,14 @@ import 'appbase-js';
|
|
|
23
23
|
import 'url-search-params-polyfill';
|
|
24
24
|
export { default as ReactiveBase } from './ReactiveBase.js';
|
|
25
25
|
import 'hotkeys-js';
|
|
26
|
-
export { D as DataSearch } from './DataSearch-
|
|
26
|
+
export { D as DataSearch } from './DataSearch-42f547cd.js';
|
|
27
27
|
import './CancelSvg-c2c03a35.js';
|
|
28
28
|
import './Input-e339e63a.js';
|
|
29
29
|
import 'compute-scroll-into-view';
|
|
30
30
|
import './Container-18b03fde.js';
|
|
31
31
|
import 'vue-highlight-words';
|
|
32
|
-
import { i as install } from './install-
|
|
33
|
-
export { S as SearchBox, i as install } from './install-
|
|
32
|
+
import { i as install } from './install-54ebd72e.js';
|
|
33
|
+
export { S as SearchBox, i as install } from './install-54ebd72e.js';
|
|
34
34
|
import '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
35
35
|
import './FormControlList-704f8dee.js';
|
|
36
36
|
import './utils-64a2e5f0.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-0f24d612.js';
|
|
2
2
|
import { validProps, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import { pushToAndClause, buildQuery } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
4
|
-
import { getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
|
|
3
|
+
import { pushToAndClause, buildQuery, extractQueryFromCustomQuery, getOptionsForCustomQuery } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
4
|
+
import { isSearchComponent, getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
|
|
5
5
|
import Appbase from 'appbase-js';
|
|
6
6
|
import valueReducer from '@appbaseio/reactivecore/lib/reducers/valueReducer';
|
|
7
7
|
import queryReducer from '@appbaseio/reactivecore/lib/reducers/queryReducer';
|
|
@@ -12,10 +12,10 @@ import dependencyTreeReducer from '@appbaseio/reactivecore/lib/reducers/dependen
|
|
|
12
12
|
import fetchGraphQL from '@appbaseio/reactivecore/lib/utils/graphQL';
|
|
13
13
|
import { isPropertyDefined } from '@appbaseio/reactivecore/lib/actions/utils';
|
|
14
14
|
|
|
15
|
-
var _excluded = ["aggs", "size"]
|
|
15
|
+
var _excluded = ["aggs", "size"],
|
|
16
|
+
_excluded2 = ["query"],
|
|
17
|
+
_excluded3 = ["query"];
|
|
16
18
|
var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
|
|
17
|
-
var componentsWithHighlightQuery = [componentTypes.dataSearch, componentTypes.categorySearch];
|
|
18
|
-
var componentsWithOptions = [componentTypes.reactiveList, componentTypes.reactiveMap, componentTypes.singleList, componentTypes.multiList, componentTypes.tagCloud].concat(componentsWithHighlightQuery);
|
|
19
19
|
var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
|
|
20
20
|
var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
|
|
21
21
|
|
|
@@ -49,23 +49,40 @@ function parseValue(value, component) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return value;
|
|
52
|
-
}
|
|
52
|
+
} // Returns query DSL with query property and other options
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
function getDefaultQuery(component, value) {
|
|
56
|
+
// get custom or default query of sensor components
|
|
57
|
+
var currentValue = parseValue(value, component); // get default query of result components
|
|
58
|
+
|
|
59
|
+
if (component.defaultQuery) {
|
|
60
|
+
var defaultQuery = component.defaultQuery(currentValue, component);
|
|
61
|
+
return _extends({
|
|
62
|
+
query: extractQueryFromCustomQuery(defaultQuery)
|
|
63
|
+
}, getOptionsForCustomQuery(defaultQuery));
|
|
64
|
+
}
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} // get custom or default query of sensor components
|
|
66
|
+
return component.source.defaultQuery ? {
|
|
67
|
+
query: component.source.defaultQuery(currentValue, component)
|
|
68
|
+
} : {};
|
|
69
|
+
} // Only results the query part
|
|
59
70
|
|
|
60
71
|
|
|
72
|
+
function getCustomQuery(component, value) {
|
|
73
|
+
// get custom or default query of sensor components
|
|
61
74
|
var currentValue = parseValue(value, component);
|
|
62
75
|
|
|
63
76
|
if (component.customQuery) {
|
|
64
77
|
var customQuery = component.customQuery(currentValue, component);
|
|
65
|
-
return
|
|
78
|
+
return _extends({
|
|
79
|
+
query: extractQueryFromCustomQuery(customQuery)
|
|
80
|
+
}, getOptionsForCustomQuery(customQuery));
|
|
66
81
|
}
|
|
67
82
|
|
|
68
|
-
return component.source.defaultQuery ?
|
|
83
|
+
return component.source.defaultQuery ? {
|
|
84
|
+
query: component.source.defaultQuery(currentValue, component)
|
|
85
|
+
} : null;
|
|
69
86
|
}
|
|
70
87
|
|
|
71
88
|
function initReactivesearch(componentCollection, searchState, settings) {
|
|
@@ -120,6 +137,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
120
137
|
}
|
|
121
138
|
});
|
|
122
139
|
var isInternalComponentPresent = false;
|
|
140
|
+
|
|
141
|
+
if (component.source.hasInternalComponent) {
|
|
142
|
+
isInternalComponentPresent = component.source.hasInternalComponent(component);
|
|
143
|
+
}
|
|
144
|
+
|
|
123
145
|
var isResultComponent = resultComponents.includes(componentType);
|
|
124
146
|
var internalComponent = component.componentId + "__internal";
|
|
125
147
|
var label = component.filterLabel || component.componentId;
|
|
@@ -151,74 +173,66 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
151
173
|
|
|
152
174
|
if (component.defaultQuery && typeof component.defaultQuery === 'function') {
|
|
153
175
|
defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
|
|
154
|
-
}
|
|
155
|
-
|
|
176
|
+
}
|
|
156
177
|
|
|
157
|
-
|
|
158
|
-
var options = component.source.generateQueryOptions ? component.source.generateQueryOptions(component) : null;
|
|
159
|
-
var highlightQuery = {};
|
|
178
|
+
var componentQueryOptions = {}; // [2] set query options - main component query (valid for result components)
|
|
160
179
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
180
|
+
if (component && component.source.generateQueryOptions) {
|
|
181
|
+
componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
|
|
182
|
+
}
|
|
164
183
|
|
|
165
|
-
|
|
166
|
-
// eslint-disable-next-line
|
|
167
|
-
var _ref = options || {},
|
|
168
|
-
aggs = _ref.aggs,
|
|
169
|
-
size = _ref.size,
|
|
170
|
-
otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
171
|
-
|
|
172
|
-
if (aggs && Object.keys(aggs).length) {
|
|
173
|
-
isInternalComponentPresent = true; // query should be applied on the internal component
|
|
174
|
-
// to enable feeding the data to parent component
|
|
175
|
-
|
|
176
|
-
queryOptions = queryOptionsReducer(queryOptions, {
|
|
177
|
-
type: 'SET_QUERY_OPTIONS',
|
|
178
|
-
component: internalComponent,
|
|
179
|
-
options: {
|
|
180
|
-
aggs: aggs,
|
|
181
|
-
size: typeof size === 'undefined' ? 100 : size
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
} // sort, highlight, size, from - query should be applied on the main component
|
|
184
|
+
var highlightQuery = {};
|
|
185
185
|
|
|
186
|
+
if (component.source.highlightQuery) {
|
|
187
|
+
highlightQuery = component.source.highlightQuery(component);
|
|
188
|
+
}
|
|
186
189
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
|
|
191
|
+
// eslint-disable-next-line
|
|
192
|
+
var _ref = componentQueryOptions || {},
|
|
193
|
+
aggs = _ref.aggs,
|
|
194
|
+
size = _ref.size,
|
|
195
|
+
otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
196
|
+
|
|
197
|
+
if (aggs && Object.keys(aggs).length) {
|
|
198
|
+
isInternalComponentPresent = true;
|
|
199
|
+
componentQueryOptions = _extends({}, componentQueryOptions, {
|
|
200
|
+
aggs: aggs,
|
|
201
|
+
size: typeof size === 'undefined' ? 100 : size
|
|
202
|
+
});
|
|
203
|
+
} // sort, highlight, size, from - query should be applied on the main component
|
|
190
204
|
|
|
191
|
-
var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
|
|
192
|
-
size: size
|
|
193
|
-
});
|
|
194
205
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
|
|
207
|
+
if (!otherQueryOptions) otherQueryOptions = {};
|
|
208
|
+
if (!highlightQuery) highlightQuery = {};
|
|
198
209
|
|
|
199
|
-
|
|
200
|
-
|
|
210
|
+
var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
|
|
211
|
+
size: size
|
|
212
|
+
});
|
|
201
213
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
214
|
+
if (isInternalComponentPresent) {
|
|
215
|
+
mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
|
|
216
|
+
}
|
|
205
217
|
|
|
206
|
-
|
|
207
|
-
|
|
218
|
+
if (isResultComponent) {
|
|
219
|
+
var currentPage = component.currentPage ? component.currentPage - 1 : 0;
|
|
208
220
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
size: resultSize,
|
|
212
|
-
from: from
|
|
213
|
-
});
|
|
221
|
+
if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
|
|
222
|
+
currentPage = selectedValues[component.componentId].value - 1 || 0;
|
|
214
223
|
}
|
|
215
224
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
var resultSize = component.size || 10;
|
|
226
|
+
var from = currentPage * resultSize; // Update props for RS API
|
|
227
|
+
|
|
228
|
+
compProps.from = from;
|
|
229
|
+
mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
|
|
230
|
+
size: resultSize,
|
|
231
|
+
from: from
|
|
220
232
|
});
|
|
221
233
|
}
|
|
234
|
+
|
|
235
|
+
componentQueryOptions = _extends({}, componentQueryOptions, mainQueryOptions);
|
|
222
236
|
}
|
|
223
237
|
} // [3] set dependency tree
|
|
224
238
|
|
|
@@ -236,25 +250,42 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
236
250
|
react: react
|
|
237
251
|
});
|
|
238
252
|
} // [4] set query list
|
|
253
|
+
// Do not set default query for suggestions
|
|
239
254
|
|
|
240
255
|
|
|
241
|
-
if (
|
|
242
|
-
var
|
|
243
|
-
|
|
256
|
+
if (isInternalComponentPresent && !isSearchComponent(component.componentType)) {
|
|
257
|
+
var _ref2 = getDefaultQuery(component, value) || {},
|
|
258
|
+
defaultQuery = _ref2.query,
|
|
259
|
+
defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
244
260
|
|
|
245
261
|
queryList = queryReducer(queryList, {
|
|
246
262
|
type: 'SET_QUERY',
|
|
247
263
|
component: internalComponent,
|
|
248
|
-
query:
|
|
264
|
+
query: defaultQuery
|
|
249
265
|
});
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
query: getQuery(component, value, componentType)
|
|
266
|
+
queryOptions = queryOptionsReducer(queryOptions, {
|
|
267
|
+
type: 'SET_QUERY_OPTIONS',
|
|
268
|
+
component: internalComponent,
|
|
269
|
+
options: _extends({}, componentQueryOptions, defaultQueryOptions)
|
|
255
270
|
});
|
|
256
|
-
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
var _ref3 = getCustomQuery(component, value) || {},
|
|
274
|
+
query = _ref3.query,
|
|
275
|
+
options = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
257
276
|
|
|
277
|
+
var customQuery = query; // set custom query for main component
|
|
278
|
+
|
|
279
|
+
queryList = queryReducer(queryList, {
|
|
280
|
+
type: 'SET_QUERY',
|
|
281
|
+
component: component.componentId,
|
|
282
|
+
query: customQuery
|
|
283
|
+
});
|
|
284
|
+
queryOptions = queryOptionsReducer(queryOptions, {
|
|
285
|
+
type: 'SET_QUERY_OPTIONS',
|
|
286
|
+
component: component.componentId,
|
|
287
|
+
options: _extends({}, options)
|
|
288
|
+
}); // Set component type in component props
|
|
258
289
|
|
|
259
290
|
compProps.componentType = componentType;
|
|
260
291
|
componentProps[component.componentId] = compProps;
|
|
@@ -277,9 +308,10 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
277
308
|
queryObj = _buildQuery.queryObj,
|
|
278
309
|
options = _buildQuery.options;
|
|
279
310
|
|
|
280
|
-
var
|
|
311
|
+
var componentQueryOptions = options;
|
|
312
|
+
var validOptions = ['aggs', 'from', 'sort']; // check if query or componentQueryOptions are valid - non-empty
|
|
281
313
|
|
|
282
|
-
if (queryObj && !!Object.keys(queryObj).length ||
|
|
314
|
+
if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
|
|
283
315
|
return validOptions.includes(item);
|
|
284
316
|
})) {
|
|
285
317
|
var _extends2;
|
|
@@ -294,7 +326,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
294
326
|
|
|
295
327
|
var currentQuery = _extends({
|
|
296
328
|
query: _extends({}, queryObj)
|
|
297
|
-
},
|
|
329
|
+
}, componentQueryOptions, queryOptions[component.componentId]);
|
|
298
330
|
|
|
299
331
|
queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
|
|
300
332
|
|
|
@@ -4,6 +4,7 @@ import VueTypes from 'vue-types';
|
|
|
4
4
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
5
5
|
import { getQueryOptions, suggestionTypes } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
6
6
|
import styled from '@appbaseio/vue-emotion';
|
|
7
|
+
import { B as Button } from './Button-33de88e6.js';
|
|
7
8
|
import { t as types } from './vueTypes-687b2304.js';
|
|
8
9
|
import ReactiveList from './ReactiveList.js';
|
|
9
10
|
import { h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, u as updateDefaultQuery, f as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-78920565.js';
|
|
@@ -11,7 +12,7 @@ import { C as ComponentWrapper } from './ComponentWrapper-0f3431d1.js';
|
|
|
11
12
|
import { T as Title } from './Title-3522ff56.js';
|
|
12
13
|
import ReactiveBase from './ReactiveBase.js';
|
|
13
14
|
import hotkeys from 'hotkeys-js';
|
|
14
|
-
import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, b as InputGroup, C as CustomSvg, c as SuggestionItem, D as DataSearch } from './DataSearch-
|
|
15
|
+
import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, b as InputGroup, C as CustomSvg, c as SuggestionItem, D as DataSearch } from './DataSearch-42f547cd.js';
|
|
15
16
|
import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-c2c03a35.js';
|
|
16
17
|
import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-e339e63a.js';
|
|
17
18
|
import { C as Container } from './Container-18b03fde.js';
|
|
@@ -195,7 +196,9 @@ var SearchBox = {
|
|
|
195
196
|
applyStopwords: VueTypes.bool,
|
|
196
197
|
customStopwords: types.stringArray,
|
|
197
198
|
onData: types.func,
|
|
198
|
-
renderItem: types.func
|
|
199
|
+
renderItem: types.func,
|
|
200
|
+
enterButton: VueTypes.bool.def(false),
|
|
201
|
+
renderEnterButton: VueTypes.any
|
|
199
202
|
},
|
|
200
203
|
mounted: function mounted() {
|
|
201
204
|
this.listenForFocusShortcuts();
|
|
@@ -308,7 +311,7 @@ var SearchBox = {
|
|
|
308
311
|
this.triggerDefaultQuery(value);
|
|
309
312
|
} else if (this.$props.autosuggest) {
|
|
310
313
|
this.triggerDefaultQuery(value);
|
|
311
|
-
} else {
|
|
314
|
+
} else if (!this.$props.enterButton) {
|
|
312
315
|
this.triggerCustomQuery(value);
|
|
313
316
|
}
|
|
314
317
|
},
|
|
@@ -724,15 +727,56 @@ var SearchBox = {
|
|
|
724
727
|
|
|
725
728
|
return null;
|
|
726
729
|
},
|
|
727
|
-
|
|
730
|
+
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
731
|
+
var _this4 = this;
|
|
732
|
+
|
|
728
733
|
var h = this.$createElement;
|
|
729
734
|
var _this$$props4 = this.$props,
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
735
|
+
enterButton = _this$$props4.enterButton,
|
|
736
|
+
innerClass = _this$$props4.innerClass;
|
|
737
|
+
var renderEnterButton = this.$scopedSlots.renderEnterButton;
|
|
738
|
+
|
|
739
|
+
var enterButtonOnClick = function enterButtonOnClick() {
|
|
740
|
+
return _this4.triggerQuery({
|
|
741
|
+
isOpen: false,
|
|
742
|
+
value: _this4.currentValue,
|
|
743
|
+
customQuery: true
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
if (enterButton) {
|
|
748
|
+
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
749
|
+
if (renderEnterButton) {
|
|
750
|
+
return renderEnterButton(enterButtonOnClick);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
return h(Button, {
|
|
754
|
+
"class": "enter-btn " + getClassName(innerClass, 'enterButton'),
|
|
755
|
+
"attrs": {
|
|
756
|
+
"primary": true
|
|
757
|
+
},
|
|
758
|
+
"on": {
|
|
759
|
+
"click": enterButtonOnClick
|
|
760
|
+
}
|
|
761
|
+
}, ["Search"]);
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
return h("div", {
|
|
765
|
+
"class": "enter-button-wrapper"
|
|
766
|
+
}, [getEnterButtonMarkup()]);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return null;
|
|
770
|
+
},
|
|
771
|
+
renderIcons: function renderIcons() {
|
|
772
|
+
var h = this.$createElement;
|
|
773
|
+
var _this$$props5 = this.$props,
|
|
774
|
+
iconPosition = _this$$props5.iconPosition,
|
|
775
|
+
showClear = _this$$props5.showClear,
|
|
776
|
+
innerClass = _this$$props5.innerClass,
|
|
777
|
+
getMicInstance = _this$$props5.getMicInstance,
|
|
778
|
+
showVoiceSearch = _this$$props5.showVoiceSearch,
|
|
779
|
+
showIcon = _this$$props5.showIcon;
|
|
736
780
|
var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
|
|
737
781
|
var currentValue = this.$data.currentValue;
|
|
738
782
|
return h("div", [h(IconGroup, {
|
|
@@ -784,7 +828,7 @@ var SearchBox = {
|
|
|
784
828
|
(_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
|
|
785
829
|
},
|
|
786
830
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
787
|
-
var
|
|
831
|
+
var _this5 = this;
|
|
788
832
|
|
|
789
833
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
790
834
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
@@ -802,7 +846,7 @@ var SearchBox = {
|
|
|
802
846
|
// Prevent the default refresh event under WINDOWS system
|
|
803
847
|
event.preventDefault();
|
|
804
848
|
|
|
805
|
-
|
|
849
|
+
_this5.focusSearchBox(event);
|
|
806
850
|
}); // if one of modifier keys are used, they are handled below
|
|
807
851
|
|
|
808
852
|
hotkeys('*', function (event) {
|
|
@@ -813,7 +857,7 @@ var SearchBox = {
|
|
|
813
857
|
var element = modifierKeys[index];
|
|
814
858
|
|
|
815
859
|
if (hotkeys[element]) {
|
|
816
|
-
|
|
860
|
+
_this5.focusSearchBox(event);
|
|
817
861
|
|
|
818
862
|
break;
|
|
819
863
|
}
|
|
@@ -827,14 +871,14 @@ var SearchBox = {
|
|
|
827
871
|
this.triggerDefaultQuery(value);
|
|
828
872
|
},
|
|
829
873
|
renderAutoFill: function renderAutoFill(suggestion) {
|
|
830
|
-
var
|
|
874
|
+
var _this6 = this;
|
|
831
875
|
|
|
832
876
|
var h = this.$createElement;
|
|
833
877
|
|
|
834
878
|
var handleAutoFillClick = function handleAutoFillClick(e) {
|
|
835
879
|
e.stopPropagation();
|
|
836
880
|
|
|
837
|
-
|
|
881
|
+
_this6.onAutofillClick(suggestion);
|
|
838
882
|
};
|
|
839
883
|
/* 👇 avoid showing autofill for category suggestions👇 */
|
|
840
884
|
|
|
@@ -847,12 +891,12 @@ var SearchBox = {
|
|
|
847
891
|
}
|
|
848
892
|
},
|
|
849
893
|
render: function render() {
|
|
850
|
-
var
|
|
894
|
+
var _this7 = this;
|
|
851
895
|
|
|
852
896
|
var h = arguments[0];
|
|
853
|
-
var _this$$
|
|
854
|
-
theme = _this$$
|
|
855
|
-
expandSuggestionsContainer = _this$$
|
|
897
|
+
var _this$$props6 = this.$props,
|
|
898
|
+
theme = _this$$props6.theme,
|
|
899
|
+
expandSuggestionsContainer = _this$$props6.expandSuggestionsContainer;
|
|
856
900
|
var _this$$scopedSlots = this.$scopedSlots,
|
|
857
901
|
recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
|
|
858
902
|
popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
|
|
@@ -893,14 +937,14 @@ var SearchBox = {
|
|
|
893
937
|
}
|
|
894
938
|
};
|
|
895
939
|
|
|
896
|
-
return h("div", [
|
|
940
|
+
return h("div", [_this7.hasCustomRenderer && _this7.getComponent({
|
|
897
941
|
isOpen: isOpen,
|
|
898
942
|
getItemProps: getItemProps,
|
|
899
943
|
getItemEvents: getItemEvents,
|
|
900
944
|
highlightedIndex: highlightedIndex
|
|
901
|
-
}),
|
|
902
|
-
"class": suggestions(
|
|
903
|
-
}, [
|
|
945
|
+
}), _this7.renderErrorComponent(), !_this7.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
|
|
946
|
+
"class": suggestions(_this7.themePreset, theme) + " " + getClassName(_this7.$props.innerClass, 'list')
|
|
947
|
+
}, [_this7.normalizedSuggestions.map(function (item, index) {
|
|
904
948
|
return renderItem ? h("li", {
|
|
905
949
|
"domProps": _extends({}, getItemProps({
|
|
906
950
|
item: item
|
|
@@ -910,7 +954,7 @@ var SearchBox = {
|
|
|
910
954
|
})),
|
|
911
955
|
"key": index + 1 + "-" + item.value,
|
|
912
956
|
"style": {
|
|
913
|
-
backgroundColor:
|
|
957
|
+
backgroundColor: _this7.getBackgroundColor(highlightedIndex, index),
|
|
914
958
|
justifyContent: 'flex-start',
|
|
915
959
|
alignItems: 'center'
|
|
916
960
|
}
|
|
@@ -923,7 +967,7 @@ var SearchBox = {
|
|
|
923
967
|
})),
|
|
924
968
|
"key": index + 1 + "-" + item.value,
|
|
925
969
|
"style": {
|
|
926
|
-
backgroundColor:
|
|
970
|
+
backgroundColor: _this7.getBackgroundColor(highlightedIndex, index),
|
|
927
971
|
justifyContent: 'flex-start',
|
|
928
972
|
alignItems: 'center'
|
|
929
973
|
}
|
|
@@ -934,61 +978,61 @@ var SearchBox = {
|
|
|
934
978
|
}
|
|
935
979
|
}, [h(CustomSvg, {
|
|
936
980
|
"attrs": {
|
|
937
|
-
"className": getClassName(
|
|
981
|
+
"className": getClassName(_this7.$props.innerClass, item._suggestion_type + "-search-icon") || null,
|
|
938
982
|
"icon": getIcon(item._suggestion_type),
|
|
939
983
|
"type": item._suggestion_type + "-search-icon"
|
|
940
984
|
}
|
|
941
985
|
})]), h(SuggestionItem, {
|
|
942
986
|
"attrs": {
|
|
943
|
-
"currentValue":
|
|
987
|
+
"currentValue": _this7.currentValue,
|
|
944
988
|
"suggestion": item
|
|
945
989
|
}
|
|
946
|
-
}),
|
|
947
|
-
})]) :
|
|
990
|
+
}), _this7.renderAutoFill(item)]);
|
|
991
|
+
})]) : _this7.renderNoSuggestions(_this7.normalizedSuggestions)]);
|
|
948
992
|
};
|
|
949
993
|
|
|
950
994
|
return h("div", {
|
|
951
995
|
"class": suggestionsContainer
|
|
952
|
-
}, [h(InputGroup, [
|
|
996
|
+
}, [h(InputGroup, [_this7.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
|
|
953
997
|
"attrs": {
|
|
954
|
-
"id":
|
|
955
|
-
"showIcon":
|
|
956
|
-
"showClear":
|
|
957
|
-
"iconPosition":
|
|
958
|
-
"placeholder":
|
|
959
|
-
"autoFocus":
|
|
960
|
-
"themePreset":
|
|
998
|
+
"id": _this7.$props.componentId + "-input",
|
|
999
|
+
"showIcon": _this7.$props.showIcon,
|
|
1000
|
+
"showClear": _this7.$props.showClear,
|
|
1001
|
+
"iconPosition": _this7.$props.iconPosition,
|
|
1002
|
+
"placeholder": _this7.$props.placeholder,
|
|
1003
|
+
"autoFocus": _this7.$props.autoFocus,
|
|
1004
|
+
"themePreset": _this7.themePreset,
|
|
961
1005
|
"autocomplete": "off"
|
|
962
1006
|
},
|
|
963
|
-
"ref":
|
|
964
|
-
"class": getClassName(
|
|
1007
|
+
"ref": _this7.$props.innerRef,
|
|
1008
|
+
"class": getClassName(_this7.$props.innerClass, 'input'),
|
|
965
1009
|
"on": _extends({}, getInputEvents({
|
|
966
|
-
onInput:
|
|
1010
|
+
onInput: _this7.onInputChange,
|
|
967
1011
|
onBlur: function onBlur(e) {
|
|
968
|
-
|
|
1012
|
+
_this7.$emit('blur', e, _this7.triggerQuery);
|
|
969
1013
|
},
|
|
970
|
-
onFocus:
|
|
1014
|
+
onFocus: _this7.handleFocus,
|
|
971
1015
|
onKeyPress: function onKeyPress(e) {
|
|
972
|
-
|
|
1016
|
+
_this7.$emit('keyPress', e, _this7.triggerQuery);
|
|
973
1017
|
|
|
974
|
-
|
|
1018
|
+
_this7.$emit('key-press', e, _this7.triggerQuery);
|
|
975
1019
|
},
|
|
976
1020
|
onKeyDown: function onKeyDown(e) {
|
|
977
|
-
return
|
|
1021
|
+
return _this7.handleKeyDown(e, highlightedIndex);
|
|
978
1022
|
},
|
|
979
1023
|
onKeyUp: function onKeyUp(e) {
|
|
980
|
-
|
|
1024
|
+
_this7.$emit('keyUp', e, _this7.triggerQuery);
|
|
981
1025
|
|
|
982
|
-
|
|
1026
|
+
_this7.$emit('key-up', e, _this7.triggerQuery);
|
|
983
1027
|
},
|
|
984
1028
|
onClick: function onClick() {
|
|
985
1029
|
setHighlightedIndex(null);
|
|
986
1030
|
}
|
|
987
1031
|
})),
|
|
988
1032
|
"domProps": _extends({}, getInputProps({
|
|
989
|
-
value:
|
|
1033
|
+
value: _this7.$data.currentValue === null ? '' : _this7.$data.currentValue
|
|
990
1034
|
}))
|
|
991
|
-
}),
|
|
1035
|
+
}), _this7.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()]), _this7.renderInputAddonAfter(), _this7.renderEnterButtonElement()]), expandSuggestionsContainer && renderSuggestionsDropdown()]);
|
|
992
1036
|
}
|
|
993
1037
|
}
|
|
994
1038
|
}) : h("div", {
|
|
@@ -1004,26 +1048,26 @@ var SearchBox = {
|
|
|
1004
1048
|
},
|
|
1005
1049
|
"on": _extends({}, {
|
|
1006
1050
|
blur: function blur(e) {
|
|
1007
|
-
|
|
1051
|
+
_this7.$emit('blur', e, _this7.triggerQuery);
|
|
1008
1052
|
},
|
|
1009
1053
|
keypress: function keypress(e) {
|
|
1010
|
-
|
|
1054
|
+
_this7.$emit('keyPress', e, _this7.triggerQuery);
|
|
1011
1055
|
|
|
1012
|
-
|
|
1056
|
+
_this7.$emit('key-press', e, _this7.triggerQuery);
|
|
1013
1057
|
},
|
|
1014
1058
|
input: this.onInputChange,
|
|
1015
1059
|
focus: function focus(e) {
|
|
1016
|
-
|
|
1060
|
+
_this7.$emit('focus', e, _this7.triggerQuery);
|
|
1017
1061
|
},
|
|
1018
1062
|
keydown: function keydown(e) {
|
|
1019
|
-
|
|
1063
|
+
_this7.$emit('keyDown', e, _this7.triggerQuery);
|
|
1020
1064
|
|
|
1021
|
-
|
|
1065
|
+
_this7.$emit('key-down', e, _this7.triggerQuery);
|
|
1022
1066
|
},
|
|
1023
1067
|
keyup: function keyup(e) {
|
|
1024
|
-
|
|
1068
|
+
_this7.$emit('keyUp', e, _this7.triggerQuery);
|
|
1025
1069
|
|
|
1026
|
-
|
|
1070
|
+
_this7.$emit('key-up', e, _this7.triggerQuery);
|
|
1027
1071
|
}
|
|
1028
1072
|
}),
|
|
1029
1073
|
"domProps": _extends({}, {
|
|
@@ -1031,7 +1075,7 @@ var SearchBox = {
|
|
|
1031
1075
|
value: this.$data.currentValue ? this.$data.currentValue : ''
|
|
1032
1076
|
}),
|
|
1033
1077
|
"ref": this.$props.innerRef
|
|
1034
|
-
}), this.renderIcons()]), this.renderInputAddonAfter()])])]);
|
|
1078
|
+
}), this.renderIcons()]), this.renderInputAddonAfter(), this.renderEnterButtonElement()])])]);
|
|
1035
1079
|
},
|
|
1036
1080
|
destroyed: function destroyed() {
|
|
1037
1081
|
document.removeEventListener('keydown', this.onKeyDown);
|