instantsearch.js 4.83.0 → 4.84.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/cjs/lib/version.js +1 -1
- package/cjs/widgets/autocomplete/autocomplete.js +133 -71
- package/cjs/widgets/index/index.js +10 -6
- package/dist/instantsearch.development.d.ts +27 -2
- package/dist/instantsearch.development.js +220 -102
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +27 -2
- package/dist/instantsearch.production.min.d.ts +27 -2
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/widgets/autocomplete/autocomplete.d.ts +22 -3
- package/es/widgets/autocomplete/autocomplete.js +133 -71
- package/es/widgets/index/index.d.ts +5 -0
- package/es/widgets/index/index.js +11 -7
- package/package.json +6 -6
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.
|
|
1
|
+
declare const _default: "4.84.0";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.
|
|
1
|
+
export default '4.84.0';
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
import type { AutocompleteConnectorParams, AutocompleteWidgetDescription } from '../../connectors/autocomplete/connectAutocomplete';
|
|
2
|
+
import type { AutocompleteConnectorParams, AutocompleteRenderState, AutocompleteWidgetDescription } from '../../connectors/autocomplete/connectAutocomplete';
|
|
3
3
|
import type { BaseHit, IndexUiState, IndexWidget, Template, WidgetFactory } from '../../types';
|
|
4
|
+
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
4
5
|
import type { AutocompleteClassNames, AutocompleteIndexClassNames, AutocompleteIndexConfig } from 'instantsearch-ui-components';
|
|
5
6
|
export type AutocompleteCSSClasses = Partial<AutocompleteClassNames>;
|
|
6
|
-
export type
|
|
7
|
+
export type AutocompleteSearchParameters = Omit<PlainSearchParameters, 'index'>;
|
|
8
|
+
export type AutocompleteTemplates = {
|
|
9
|
+
/**
|
|
10
|
+
* Template to use for the panel.
|
|
11
|
+
*/
|
|
12
|
+
panel?: Template<{
|
|
13
|
+
elements: PanelElements;
|
|
14
|
+
indices: AutocompleteRenderState['indices'];
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
7
17
|
type IndexConfig<TItem extends BaseHit> = AutocompleteIndexConfig<TItem> & {
|
|
8
18
|
templates?: Partial<{
|
|
9
19
|
/**
|
|
@@ -20,8 +30,13 @@ type IndexConfig<TItem extends BaseHit> = AutocompleteIndexConfig<TItem> & {
|
|
|
20
30
|
onSelect: () => void;
|
|
21
31
|
}>;
|
|
22
32
|
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Search parameters to apply to this index.
|
|
35
|
+
*/
|
|
36
|
+
searchParameters?: AutocompleteSearchParameters;
|
|
23
37
|
cssClasses?: Partial<AutocompleteIndexClassNames>;
|
|
24
38
|
};
|
|
39
|
+
type PanelElements = Partial<Record<'recent' | 'suggestions' | (string & {}), preact.JSX.Element>>;
|
|
25
40
|
type AutocompleteWidgetParams<TItem extends BaseHit> = {
|
|
26
41
|
/**
|
|
27
42
|
* CSS Selector or HTMLElement to insert the widget.
|
|
@@ -55,12 +70,16 @@ type AutocompleteWidgetParams<TItem extends BaseHit> = {
|
|
|
55
70
|
}>;
|
|
56
71
|
}>;
|
|
57
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Search parameters to apply to the autocomplete indices.
|
|
75
|
+
*/
|
|
76
|
+
searchParameters?: AutocompleteSearchParameters;
|
|
58
77
|
getSearchPageURL?: (nextUiState: IndexUiState) => string;
|
|
59
78
|
onSelect?: AutocompleteIndexConfig<TItem>['onSelect'];
|
|
60
79
|
/**
|
|
61
80
|
* Templates to use for the widget.
|
|
62
81
|
*/
|
|
63
|
-
templates?: AutocompleteTemplates
|
|
82
|
+
templates?: AutocompleteTemplates;
|
|
64
83
|
/**
|
|
65
84
|
* CSS classes to add.
|
|
66
85
|
*/
|
|
@@ -19,6 +19,7 @@ import { Fragment, h, render } from 'preact';
|
|
|
19
19
|
import { useEffect, useId, useMemo, useRef, useState } from 'preact/hooks';
|
|
20
20
|
import TemplateComponent from "../../components/Template/Template.js";
|
|
21
21
|
import { connectAutocomplete, connectSearchBox } from "../../connectors/index.umd.js";
|
|
22
|
+
import { ReverseHighlight } from "../../helpers/components/index.js";
|
|
22
23
|
import { component } from "../../lib/suit.js";
|
|
23
24
|
import { prepareTemplateProps } from "../../lib/templating/index.js";
|
|
24
25
|
import { createDocumentationMessageGenerator, getContainerNode, walkIndex } from "../../lib/utils/index.js";
|
|
@@ -83,7 +84,12 @@ var createRenderer = function createRenderer(params) {
|
|
|
83
84
|
rendererParams.renderState = {
|
|
84
85
|
indexTemplateProps: [],
|
|
85
86
|
isolatedIndex: isolatedIndex,
|
|
86
|
-
targetIndex: targetIndex
|
|
87
|
+
targetIndex: targetIndex,
|
|
88
|
+
templateProps: prepareTemplateProps({
|
|
89
|
+
defaultTemplates: {},
|
|
90
|
+
templatesConfig: connectorParams.instantSearchInstance.templatesConfig,
|
|
91
|
+
templates: rendererParams.templates
|
|
92
|
+
})
|
|
87
93
|
};
|
|
88
94
|
connectorParams.refine((_targetIndex$getHelpe = (_targetIndex$getHelpe2 = targetIndex.getHelper()) === null || _targetIndex$getHelpe2 === void 0 ? void 0 : _targetIndex$getHelpe2.state.query) !== null && _targetIndex$getHelpe !== void 0 ? _targetIndex$getHelpe : '');
|
|
89
95
|
return;
|
|
@@ -101,7 +107,9 @@ function AutocompleteWrapper(_ref) {
|
|
|
101
107
|
cssClasses = _ref.cssClasses,
|
|
102
108
|
renderState = _ref.renderState,
|
|
103
109
|
instantSearchInstance = _ref.instantSearchInstance,
|
|
104
|
-
showRecent = _ref.showRecent
|
|
110
|
+
showRecent = _ref.showRecent,
|
|
111
|
+
showSuggestions = _ref.showSuggestions,
|
|
112
|
+
templates = _ref.templates;
|
|
105
113
|
var isolatedIndex = renderState.isolatedIndex,
|
|
106
114
|
targetIndex = renderState.targetIndex;
|
|
107
115
|
var searchboxQuery = isolatedIndex === null || isolatedIndex === void 0 ? void 0 : (_isolatedIndex$getHel = isolatedIndex.getHelper()) === null || _isolatedIndex$getHel === void 0 ? void 0 : _isolatedIndex$getHel.state.query;
|
|
@@ -156,17 +164,28 @@ function AutocompleteWrapper(_ref) {
|
|
|
156
164
|
getItemProps = _usePropGetters.getItemProps,
|
|
157
165
|
getPanelProps = _usePropGetters.getPanelProps,
|
|
158
166
|
getRootProps = _usePropGetters.getRootProps;
|
|
159
|
-
var AutocompleteRecentSearchComponent =
|
|
167
|
+
var AutocompleteRecentSearchComponent = function AutocompleteRecentSearchComponent(_ref4) {
|
|
168
|
+
var item = _ref4.item,
|
|
169
|
+
onSelect = _ref4.onSelect,
|
|
170
|
+
onRemoveRecentSearch = _ref4.onRemoveRecentSearch;
|
|
171
|
+
return h(AutocompleteRecentSearch, {
|
|
172
|
+
item: item,
|
|
173
|
+
onSelect: onSelect,
|
|
174
|
+
onRemoveRecentSearch: onRemoveRecentSearch
|
|
175
|
+
}, h(ConditionalReverseHighlight, {
|
|
176
|
+
item: item
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
160
179
|
if (_typeof(showRecent) === 'object' && (_showRecent$templates = showRecent.templates) !== null && _showRecent$templates !== void 0 && _showRecent$templates.item) {
|
|
161
180
|
var props = prepareTemplateProps({
|
|
162
181
|
defaultTemplates: {},
|
|
163
182
|
templatesConfig: instantSearchInstance.templatesConfig,
|
|
164
183
|
templates: showRecent.templates
|
|
165
184
|
});
|
|
166
|
-
AutocompleteRecentSearchComponent = function AutocompleteRecentSearchComponent(
|
|
167
|
-
var item =
|
|
168
|
-
onSelect =
|
|
169
|
-
onRemoveRecentSearch =
|
|
185
|
+
AutocompleteRecentSearchComponent = function AutocompleteRecentSearchComponent(_ref5) {
|
|
186
|
+
var item = _ref5.item,
|
|
187
|
+
onSelect = _ref5.onSelect,
|
|
188
|
+
onRemoveRecentSearch = _ref5.onRemoveRecentSearch;
|
|
170
189
|
return h(TemplateComponent, _extends({}, props, {
|
|
171
190
|
templateKey: "item",
|
|
172
191
|
rootTagName: "fragment",
|
|
@@ -178,45 +197,36 @@ function AutocompleteWrapper(_ref) {
|
|
|
178
197
|
}));
|
|
179
198
|
};
|
|
180
199
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
classNames: {
|
|
210
|
-
root: 'ais-AutocompleteRecentSearches',
|
|
211
|
-
list: 'ais-AutocompleteRecentSearchesList',
|
|
212
|
-
item: 'ais-AutocompleteRecentSearchesItem'
|
|
213
|
-
},
|
|
214
|
-
items: storageHits,
|
|
215
|
-
getItemProps: getItemProps
|
|
216
|
-
}), indices.map(function (_ref6, i) {
|
|
200
|
+
var elements = {};
|
|
201
|
+
if (showRecent) {
|
|
202
|
+
elements.recent = h(AutocompleteIndex
|
|
203
|
+
// @ts-ignore - there seems to be problems with React.ComponentType and this, but it's actually correct
|
|
204
|
+
, {
|
|
205
|
+
ItemComponent: function ItemComponent(_ref6) {
|
|
206
|
+
var item = _ref6.item,
|
|
207
|
+
onSelect = _ref6.onSelect;
|
|
208
|
+
return h(AutocompleteRecentSearchComponent, {
|
|
209
|
+
item: item,
|
|
210
|
+
onSelect: onSelect,
|
|
211
|
+
onRemoveRecentSearch: function onRemoveRecentSearch() {
|
|
212
|
+
return storage.onRemove(item.query);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
classNames: {
|
|
217
|
+
root: 'ais-AutocompleteRecentSearches',
|
|
218
|
+
list: 'ais-AutocompleteRecentSearchesList',
|
|
219
|
+
item: 'ais-AutocompleteRecentSearchesItem'
|
|
220
|
+
},
|
|
221
|
+
items: storageHits,
|
|
222
|
+
getItemProps: getItemProps
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
indices.forEach(function (_ref7, i) {
|
|
217
226
|
var _indicesConfig$i$temp;
|
|
218
|
-
var indexId =
|
|
219
|
-
|
|
227
|
+
var indexId = _ref7.indexId,
|
|
228
|
+
indexName = _ref7.indexName,
|
|
229
|
+
hits = _ref7.hits;
|
|
220
230
|
if (!renderState.indexTemplateProps[i]) {
|
|
221
231
|
renderState.indexTemplateProps[i] = prepareTemplateProps({
|
|
222
232
|
defaultTemplates: {},
|
|
@@ -224,8 +234,8 @@ function AutocompleteWrapper(_ref) {
|
|
|
224
234
|
templates: indicesConfig[i].templates
|
|
225
235
|
});
|
|
226
236
|
}
|
|
227
|
-
var headerComponent = (_indicesConfig$i$temp = indicesConfig[i].templates) !== null && _indicesConfig$i$temp !== void 0 && _indicesConfig$i$temp.header ? function (
|
|
228
|
-
var items =
|
|
237
|
+
var headerComponent = (_indicesConfig$i$temp = indicesConfig[i].templates) !== null && _indicesConfig$i$temp !== void 0 && _indicesConfig$i$temp.header ? function (_ref8) {
|
|
238
|
+
var items = _ref8.items;
|
|
229
239
|
return h(TemplateComponent, _extends({}, renderState.indexTemplateProps[i], {
|
|
230
240
|
templateKey: "header",
|
|
231
241
|
rootTagName: "fragment",
|
|
@@ -234,9 +244,9 @@ function AutocompleteWrapper(_ref) {
|
|
|
234
244
|
}
|
|
235
245
|
}));
|
|
236
246
|
} : undefined;
|
|
237
|
-
var itemComponent = function itemComponent(
|
|
238
|
-
var item =
|
|
239
|
-
onSelect =
|
|
247
|
+
var itemComponent = function itemComponent(_ref9) {
|
|
248
|
+
var item = _ref9.item,
|
|
249
|
+
onSelect = _ref9.onSelect;
|
|
240
250
|
return h(TemplateComponent, _extends({}, renderState.indexTemplateProps[i], {
|
|
241
251
|
templateKey: "item",
|
|
242
252
|
rootTagName: "fragment",
|
|
@@ -246,7 +256,8 @@ function AutocompleteWrapper(_ref) {
|
|
|
246
256
|
}
|
|
247
257
|
}));
|
|
248
258
|
};
|
|
249
|
-
|
|
259
|
+
var elementId = indexName === (showSuggestions === null || showSuggestions === void 0 ? void 0 : showSuggestions.indexName) ? 'suggestions' : indexName;
|
|
260
|
+
elements[elementId] = h(AutocompleteIndex, {
|
|
250
261
|
key: indexId,
|
|
251
262
|
HeaderComponent: headerComponent,
|
|
252
263
|
ItemComponent: itemComponent,
|
|
@@ -258,26 +269,54 @@ function AutocompleteWrapper(_ref) {
|
|
|
258
269
|
getItemProps: getItemProps,
|
|
259
270
|
classNames: indicesConfig[i].cssClasses
|
|
260
271
|
});
|
|
272
|
+
});
|
|
273
|
+
return h(Autocomplete, _extends({}, getRootProps(), {
|
|
274
|
+
classNames: cssClasses
|
|
275
|
+
}), h(AutocompleteSearchBox, {
|
|
276
|
+
query: searchboxQuery || '',
|
|
277
|
+
inputProps: _objectSpread(_objectSpread({}, getInputProps()), {}, {
|
|
278
|
+
// @ts-ignore - This clashes with some ambient React JSX declarations.
|
|
279
|
+
onInput: function onInput(evt) {
|
|
280
|
+
return refine(evt.currentTarget.value);
|
|
281
|
+
}
|
|
282
|
+
}),
|
|
283
|
+
onClear: function onClear() {
|
|
284
|
+
return onRefine('');
|
|
285
|
+
},
|
|
286
|
+
isSearchStalled: instantSearchInstance.status === 'stalled'
|
|
287
|
+
}), h(AutocompletePanel, getPanelProps(), templates.panel ? h(TemplateComponent, _extends({}, renderState.templateProps, {
|
|
288
|
+
templateKey: "panel",
|
|
289
|
+
rootTagName: "fragment",
|
|
290
|
+
data: {
|
|
291
|
+
elements: elements,
|
|
292
|
+
indices: indices
|
|
293
|
+
}
|
|
294
|
+
})) : Object.keys(elements).map(function (elementId) {
|
|
295
|
+
return elements[elementId];
|
|
261
296
|
})));
|
|
262
297
|
}
|
|
263
298
|
export function EXPERIMENTAL_autocomplete(widgetParams) {
|
|
264
|
-
var
|
|
265
|
-
container =
|
|
266
|
-
escapeHTML =
|
|
267
|
-
|
|
268
|
-
indices =
|
|
269
|
-
showSuggestions =
|
|
270
|
-
showRecent =
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
templates =
|
|
275
|
-
|
|
276
|
-
|
|
299
|
+
var _ref0 = widgetParams || {},
|
|
300
|
+
container = _ref0.container,
|
|
301
|
+
escapeHTML = _ref0.escapeHTML,
|
|
302
|
+
_ref0$indices = _ref0.indices,
|
|
303
|
+
indices = _ref0$indices === void 0 ? [] : _ref0$indices,
|
|
304
|
+
showSuggestions = _ref0.showSuggestions,
|
|
305
|
+
showRecent = _ref0.showRecent,
|
|
306
|
+
userSearchParameters = _ref0.searchParameters,
|
|
307
|
+
getSearchPageURL = _ref0.getSearchPageURL,
|
|
308
|
+
onSelect = _ref0.onSelect,
|
|
309
|
+
_ref0$templates = _ref0.templates,
|
|
310
|
+
templates = _ref0$templates === void 0 ? {} : _ref0$templates,
|
|
311
|
+
_ref0$cssClasses = _ref0.cssClasses,
|
|
312
|
+
userCssClasses = _ref0$cssClasses === void 0 ? {} : _ref0$cssClasses;
|
|
277
313
|
if (!container) {
|
|
278
314
|
throw new Error(withUsage('The `container` option is required.'));
|
|
279
315
|
}
|
|
280
316
|
var containerNode = getContainerNode(container);
|
|
317
|
+
var searchParameters = _objectSpread({
|
|
318
|
+
hitsPerPage: 5
|
|
319
|
+
}, userSearchParameters);
|
|
281
320
|
var cssClasses = {
|
|
282
321
|
root: cx(suit(), userCssClasses.root)
|
|
283
322
|
};
|
|
@@ -288,7 +327,16 @@ export function EXPERIMENTAL_autocomplete(widgetParams) {
|
|
|
288
327
|
indexName: showSuggestions.indexName,
|
|
289
328
|
templates: _objectSpread({
|
|
290
329
|
// @ts-expect-error
|
|
291
|
-
item:
|
|
330
|
+
item: function item(_ref1) {
|
|
331
|
+
var _item = _ref1.item,
|
|
332
|
+
onSelectItem = _ref1.onSelect;
|
|
333
|
+
return h(AutocompleteSuggestion, {
|
|
334
|
+
item: _item,
|
|
335
|
+
onSelect: onSelectItem
|
|
336
|
+
}, h(ConditionalReverseHighlight, {
|
|
337
|
+
item: _item
|
|
338
|
+
}));
|
|
339
|
+
}
|
|
292
340
|
}, showSuggestions.templates),
|
|
293
341
|
cssClasses: {
|
|
294
342
|
root: cx('ais-AutocompleteSuggestions', (_showSuggestions$cssC = showSuggestions.cssClasses) === null || _showSuggestions$cssC === void 0 ? void 0 : _showSuggestions$cssC.root),
|
|
@@ -311,10 +359,12 @@ export function EXPERIMENTAL_autocomplete(widgetParams) {
|
|
|
311
359
|
onSelect: onSelect,
|
|
312
360
|
cssClasses: cssClasses,
|
|
313
361
|
showRecent: showRecent,
|
|
362
|
+
showSuggestions: showSuggestions,
|
|
314
363
|
renderState: {
|
|
315
364
|
indexTemplateProps: [],
|
|
316
365
|
isolatedIndex: undefined,
|
|
317
|
-
targetIndex: undefined
|
|
366
|
+
targetIndex: undefined,
|
|
367
|
+
templateProps: undefined
|
|
318
368
|
},
|
|
319
369
|
templates: templates
|
|
320
370
|
});
|
|
@@ -326,17 +376,29 @@ export function EXPERIMENTAL_autocomplete(widgetParams) {
|
|
|
326
376
|
})({}), index({
|
|
327
377
|
indexId: "ais-autocomplete-".concat(instanceId),
|
|
328
378
|
EXPERIMENTAL_isolated: true
|
|
329
|
-
}).addWidgets([].concat(_toConsumableArray(indicesConfig.map(function (
|
|
330
|
-
var indexName =
|
|
379
|
+
}).addWidgets([configure(searchParameters)].concat(_toConsumableArray(indicesConfig.map(function (_ref10) {
|
|
380
|
+
var indexName = _ref10.indexName,
|
|
381
|
+
indexSearchParameters = _ref10.searchParameters;
|
|
331
382
|
return index({
|
|
332
383
|
indexName: indexName,
|
|
333
384
|
indexId: indexName
|
|
334
|
-
}).addWidgets([configure({
|
|
335
|
-
hitsPerPage: 5
|
|
336
|
-
})]);
|
|
385
|
+
}).addWidgets([configure(indexSearchParameters || {})]);
|
|
337
386
|
})), [_objectSpread(_objectSpread({}, makeWidget({
|
|
338
387
|
escapeHTML: escapeHTML
|
|
339
388
|
})), {}, {
|
|
340
389
|
$$widgetType: 'ais.autocomplete'
|
|
341
390
|
})]))];
|
|
391
|
+
}
|
|
392
|
+
function ConditionalReverseHighlight(_ref11) {
|
|
393
|
+
var _item$_highlightResul;
|
|
394
|
+
var item = _ref11.item;
|
|
395
|
+
if (!((_item$_highlightResul = item._highlightResult) !== null && _item$_highlightResul !== void 0 && _item$_highlightResul.query) ||
|
|
396
|
+
// @ts-expect-error - we should not have matchLevel as arrays here
|
|
397
|
+
item._highlightResult.query.matchLevel === 'none') {
|
|
398
|
+
return item.query;
|
|
399
|
+
}
|
|
400
|
+
return h(ReverseHighlight, {
|
|
401
|
+
attribute: "query",
|
|
402
|
+
hit: item
|
|
403
|
+
});
|
|
342
404
|
}
|
|
@@ -97,6 +97,11 @@ export type IndexWidget<TUiState extends UiState = UiState> = Omit<Widget<IndexW
|
|
|
97
97
|
* @private
|
|
98
98
|
*/
|
|
99
99
|
_isolated: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Schedules a search for this index only.
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
scheduleLocalSearch: () => void;
|
|
100
105
|
};
|
|
101
106
|
declare const index: (widgetParams: IndexWidgetParams) => IndexWidget;
|
|
102
107
|
export default index;
|
|
@@ -15,7 +15,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
15
15
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
16
16
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
17
17
|
import algoliasearchHelper from 'algoliasearch-helper';
|
|
18
|
-
import { checkIndexUiState, createDocumentationMessageGenerator, resolveSearchParameters, mergeSearchParameters, warning, isIndexWidget, createInitArgs, createRenderArgs } from "../../lib/utils/index.js";
|
|
18
|
+
import { checkIndexUiState, createDocumentationMessageGenerator, resolveSearchParameters, mergeSearchParameters, warning, isIndexWidget, createInitArgs, createRenderArgs, defer } from "../../lib/utils/index.js";
|
|
19
19
|
import { addWidgetId } from "../../lib/utils/addWidgetId.js";
|
|
20
20
|
var withUsage = createDocumentationMessageGenerator({
|
|
21
21
|
name: 'index-widget'
|
|
@@ -197,6 +197,12 @@ var index = function index(widgetParams) {
|
|
|
197
197
|
helper: helper
|
|
198
198
|
})));
|
|
199
199
|
},
|
|
200
|
+
scheduleLocalSearch: defer(function () {
|
|
201
|
+
if (isolated) {
|
|
202
|
+
var _helper2;
|
|
203
|
+
(_helper2 = helper) === null || _helper2 === void 0 ? void 0 : _helper2.search();
|
|
204
|
+
}
|
|
205
|
+
}),
|
|
200
206
|
getWidgets: function getWidgets() {
|
|
201
207
|
return localWidgets;
|
|
202
208
|
},
|
|
@@ -262,8 +268,7 @@ var index = function index(widgetParams) {
|
|
|
262
268
|
}
|
|
263
269
|
});
|
|
264
270
|
if (isolated) {
|
|
265
|
-
|
|
266
|
-
(_helper2 = helper) === null || _helper2 === void 0 ? void 0 : _helper2.search();
|
|
271
|
+
this.scheduleLocalSearch();
|
|
267
272
|
} else {
|
|
268
273
|
localInstantSearchInstance.scheduleSearch();
|
|
269
274
|
}
|
|
@@ -342,8 +347,7 @@ var index = function index(widgetParams) {
|
|
|
342
347
|
helper.recommendState = cleanedRecommendState;
|
|
343
348
|
if (localWidgets.length) {
|
|
344
349
|
if (isolated) {
|
|
345
|
-
|
|
346
|
-
(_helper3 = helper) === null || _helper3 === void 0 ? void 0 : _helper3.search();
|
|
350
|
+
this.scheduleLocalSearch();
|
|
347
351
|
} else {
|
|
348
352
|
localInstantSearchInstance.scheduleSearch();
|
|
349
353
|
}
|
|
@@ -597,7 +601,7 @@ var index = function index(widgetParams) {
|
|
|
597
601
|
},
|
|
598
602
|
dispose: function dispose() {
|
|
599
603
|
var _this5 = this,
|
|
600
|
-
|
|
604
|
+
_helper3,
|
|
601
605
|
_derivedHelper3;
|
|
602
606
|
localWidgets.forEach(function (widget) {
|
|
603
607
|
if (widget.dispose && helper) {
|
|
@@ -617,7 +621,7 @@ var index = function index(widgetParams) {
|
|
|
617
621
|
});
|
|
618
622
|
localInstantSearchInstance = null;
|
|
619
623
|
localParent = null;
|
|
620
|
-
(
|
|
624
|
+
(_helper3 = helper) === null || _helper3 === void 0 ? void 0 : _helper3.removeAllListeners();
|
|
621
625
|
helper = null;
|
|
622
626
|
(_derivedHelper3 = derivedHelper) === null || _derivedHelper3 === void 0 ? void 0 : _derivedHelper3.detach();
|
|
623
627
|
derivedHelper = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.84.0",
|
|
4
4
|
"description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
|
|
5
5
|
"homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"algoliasearch-helper": "3.26.1",
|
|
36
36
|
"hogan.js": "^3.0.2",
|
|
37
37
|
"htm": "^3.0.0",
|
|
38
|
-
"instantsearch-ui-components": "0.
|
|
38
|
+
"instantsearch-ui-components": "0.15.0",
|
|
39
39
|
"preact": "^10.10.0",
|
|
40
40
|
"qs": "^6.5.1 < 6.10",
|
|
41
41
|
"react": ">= 0.14.0",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"watch:es": "yarn --silent build:es:base --watch"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@instantsearch/mocks": "1.
|
|
64
|
-
"@instantsearch/tests": "1.
|
|
65
|
-
"@instantsearch/testutils": "1.
|
|
63
|
+
"@instantsearch/mocks": "1.82.0",
|
|
64
|
+
"@instantsearch/tests": "1.82.0",
|
|
65
|
+
"@instantsearch/testutils": "1.71.0",
|
|
66
66
|
"@storybook/html": "5.3.9",
|
|
67
67
|
"@types/scriptjs": "0.0.2",
|
|
68
68
|
"algoliasearch": "5.1.1",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"scriptjs": "2.5.9",
|
|
71
71
|
"webpack": "4.47.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "b4cb69c8cfaa9dc22dfe8fe695568cf5200f3893"
|
|
74
74
|
}
|