instantsearch.js 4.55.0 → 4.56.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/components/Breadcrumb/Breadcrumb.js +2 -2
- package/cjs/components/RangeInput/RangeInput.js +22 -11
- package/cjs/components/RefinementList/RefinementList.js +34 -52
- package/cjs/components/Slider/Rheostat.js +163 -249
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +22 -7
- package/cjs/lib/InstantSearch.js +2 -4
- package/cjs/lib/routers/history.js +54 -1
- package/cjs/lib/utils/render-args.js +3 -2
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/hits-per-page/hits-per-page.js +3 -1
- package/cjs/widgets/index/index.js +8 -8
- package/dist/instantsearch.development.d.ts +76 -76
- package/dist/instantsearch.development.js +345 -341
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +76 -76
- package/dist/instantsearch.production.min.d.ts +76 -76
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/es/components/Breadcrumb/Breadcrumb.js +2 -2
- package/es/components/GeoSearchControls/GeoSearchButton.d.ts +1 -1
- package/es/components/GeoSearchControls/GeoSearchControls.d.ts +3 -3
- package/es/components/GeoSearchControls/GeoSearchToggle.d.ts +1 -1
- package/es/components/Pagination/Pagination.d.ts +2 -2
- package/es/components/RangeInput/RangeInput.d.ts +7 -4
- package/es/components/RangeInput/RangeInput.js +22 -11
- package/es/components/RefinementList/RefinementList.d.ts +0 -1
- package/es/components/RefinementList/RefinementList.js +34 -52
- package/es/components/RelevantSort/RelevantSort.d.ts +1 -1
- package/es/components/Selector/Selector.d.ts +2 -2
- package/es/components/Slider/Rheostat.d.ts +23 -17
- package/es/components/Slider/Rheostat.js +163 -249
- package/es/components/Slider/Slider.d.ts +1 -1
- package/es/connectors/current-refinements/connectCurrentRefinements.d.ts +2 -2
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.d.ts +2 -2
- package/es/connectors/geo-search/connectGeoSearch.d.ts +7 -7
- package/es/connectors/infinite-hits/connectInfiniteHits.js +23 -8
- package/es/connectors/menu/connectMenu.d.ts +2 -2
- package/es/connectors/pagination/connectPagination.d.ts +1 -1
- package/es/connectors/range/connectRange.d.ts +3 -3
- package/es/connectors/refinement-list/connectRefinementList.d.ts +3 -3
- package/es/connectors/relevant-sort/connectRelevantSort.d.ts +1 -1
- package/es/lib/InstantSearch.d.ts +13 -13
- package/es/lib/InstantSearch.js +3 -5
- package/es/lib/routers/history.d.ts +2 -2
- package/es/lib/routers/history.js +55 -2
- package/es/lib/utils/defer.d.ts +2 -2
- package/es/lib/utils/render-args.js +3 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/types/middleware.d.ts +6 -6
- package/es/types/router.d.ts +7 -7
- package/es/types/widget.d.ts +1 -1
- package/es/widgets/dynamic-widgets/dynamic-widgets.d.ts +2 -2
- package/es/widgets/geo-search/createHTMLMarker.d.ts +1 -1
- package/es/widgets/geo-search/geo-search.d.ts +1 -1
- package/es/widgets/hits-per-page/hits-per-page.js +3 -1
- package/es/widgets/index/index.d.ts +20 -20
- package/es/widgets/index/index.js +8 -8
- package/es/widgets/panel/panel.d.ts +2 -2
- package/es/widgets/range-slider/range-slider.d.ts +1 -1
- package/package.json +6 -6
|
@@ -19,39 +19,39 @@ export type IndexWidgetDescription = {
|
|
|
19
19
|
export type IndexWidget<TUiState extends UiState = UiState> = Omit<Widget<IndexWidgetDescription & {
|
|
20
20
|
widgetParams: IndexWidgetParams;
|
|
21
21
|
}>, 'getWidgetUiState' | 'getWidgetState'> & {
|
|
22
|
-
getIndexName()
|
|
23
|
-
getIndexId()
|
|
24
|
-
getHelper()
|
|
25
|
-
getResults()
|
|
26
|
-
getPreviousState()
|
|
27
|
-
getScopedResults()
|
|
28
|
-
getParent()
|
|
29
|
-
getWidgets()
|
|
30
|
-
createURL(state: SearchParameters)
|
|
31
|
-
addWidgets(widgets: Array<Widget | IndexWidget>)
|
|
32
|
-
removeWidgets(widgets: Array<Widget | IndexWidget>)
|
|
33
|
-
init(options: IndexInitOptions)
|
|
34
|
-
render(options: IndexRenderOptions)
|
|
35
|
-
dispose()
|
|
22
|
+
getIndexName: () => string;
|
|
23
|
+
getIndexId: () => string;
|
|
24
|
+
getHelper: () => Helper | null;
|
|
25
|
+
getResults: () => SearchResults | null;
|
|
26
|
+
getPreviousState: () => SearchParameters | null;
|
|
27
|
+
getScopedResults: () => ScopedResult[];
|
|
28
|
+
getParent: () => IndexWidget | null;
|
|
29
|
+
getWidgets: () => Array<Widget | IndexWidget>;
|
|
30
|
+
createURL: (state: SearchParameters) => string;
|
|
31
|
+
addWidgets: (widgets: Array<Widget | IndexWidget>) => IndexWidget;
|
|
32
|
+
removeWidgets: (widgets: Array<Widget | IndexWidget>) => IndexWidget;
|
|
33
|
+
init: (options: IndexInitOptions) => void;
|
|
34
|
+
render: (options: IndexRenderOptions) => void;
|
|
35
|
+
dispose: () => void;
|
|
36
36
|
/**
|
|
37
37
|
* @deprecated
|
|
38
38
|
*/
|
|
39
|
-
getWidgetState(uiState: UiState)
|
|
40
|
-
getWidgetUiState<TSpecificUiState extends UiState = TUiState>(uiState: TSpecificUiState)
|
|
41
|
-
getWidgetSearchParameters(searchParameters: SearchParameters, searchParametersOptions: {
|
|
39
|
+
getWidgetState: (uiState: UiState) => UiState;
|
|
40
|
+
getWidgetUiState: <TSpecificUiState extends UiState = TUiState>(uiState: TSpecificUiState) => TSpecificUiState;
|
|
41
|
+
getWidgetSearchParameters: (searchParameters: SearchParameters, searchParametersOptions: {
|
|
42
42
|
uiState: IndexUiState;
|
|
43
|
-
})
|
|
43
|
+
}) => SearchParameters;
|
|
44
44
|
/**
|
|
45
45
|
* Set this index' UI state back to the state defined by the widgets.
|
|
46
46
|
* Can only be called after `init`.
|
|
47
47
|
*/
|
|
48
|
-
refreshUiState()
|
|
48
|
+
refreshUiState: () => void;
|
|
49
49
|
/**
|
|
50
50
|
* Set this index' UI state and search. This is the equivalent of calling
|
|
51
51
|
* a spread `setUiState` on the InstantSearch instance.
|
|
52
52
|
* Can only be called after `init`.
|
|
53
53
|
*/
|
|
54
|
-
setIndexUiState(indexUiState: TUiState[string] | ((previousIndexUiState: TUiState[string]) => TUiState[string]))
|
|
54
|
+
setIndexUiState: (indexUiState: TUiState[string] | ((previousIndexUiState: TUiState[string]) => TUiState[string])) => void;
|
|
55
55
|
};
|
|
56
56
|
declare const index: (widgetParams: IndexWidgetParams) => IndexWidget;
|
|
57
57
|
export default index;
|
|
@@ -332,7 +332,7 @@ var index = function index(widgetParams) {
|
|
|
332
332
|
// does not have access to lastResults, which it used to in pre-federated
|
|
333
333
|
// search behavior.
|
|
334
334
|
helper.lastResults = results;
|
|
335
|
-
lastValidSearchParameters = results._state;
|
|
335
|
+
lastValidSearchParameters = results === null || results === void 0 ? void 0 : results._state;
|
|
336
336
|
});
|
|
337
337
|
|
|
338
338
|
// We compute the render state before calling `init` in a separate loop
|
|
@@ -388,16 +388,16 @@ var index = function index(widgetParams) {
|
|
|
388
388
|
render: function render(_ref5) {
|
|
389
389
|
var _this4 = this;
|
|
390
390
|
var instantSearchInstance = _ref5.instantSearchInstance;
|
|
391
|
-
if (!this.getResults()) {
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
391
|
// we can't attach a listener to the error event of search, as the error
|
|
396
392
|
// then would no longer be thrown for global handlers.
|
|
397
|
-
if (instantSearchInstance.status === 'error' && !instantSearchInstance.mainHelper.hasPendingRequests()) {
|
|
393
|
+
if (instantSearchInstance.status === 'error' && !instantSearchInstance.mainHelper.hasPendingRequests() && lastValidSearchParameters) {
|
|
398
394
|
helper.setState(lastValidSearchParameters);
|
|
399
395
|
}
|
|
400
|
-
|
|
396
|
+
|
|
397
|
+
// We only render index widgets if there are no results.
|
|
398
|
+
// This makes sure `render` is never called with `results` being `null`.
|
|
399
|
+
var widgetsToRender = this.getResults() ? localWidgets : localWidgets.filter(isIndexWidget);
|
|
400
|
+
widgetsToRender.forEach(function (widget) {
|
|
401
401
|
if (widget.getRenderState) {
|
|
402
402
|
var renderState = widget.getRenderState(instantSearchInstance.renderState[_this4.getIndexId()] || {}, createRenderArgs(instantSearchInstance, _this4));
|
|
403
403
|
storeRenderState({
|
|
@@ -407,7 +407,7 @@ var index = function index(widgetParams) {
|
|
|
407
407
|
});
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
|
-
|
|
410
|
+
widgetsToRender.forEach(function (widget) {
|
|
411
411
|
// At this point, all the variables used below are set. Both `helper`
|
|
412
412
|
// and `derivedHelper` have been created at the `init` step. The attribute
|
|
413
413
|
// `lastResults` might be `null` though. It's possible that a stalled render
|
|
@@ -65,12 +65,12 @@ export type PanelWidgetParams<TWidgetFactory extends AnyWidgetFactory> = {
|
|
|
65
65
|
* A function that is called on each render to determine if the
|
|
66
66
|
* panel should be hidden based on the render options.
|
|
67
67
|
*/
|
|
68
|
-
hidden
|
|
68
|
+
hidden?: (options: PanelRenderOptions<TWidgetFactory>) => boolean;
|
|
69
69
|
/**
|
|
70
70
|
* A function that is called on each render to determine if the
|
|
71
71
|
* panel should be collapsed based on the render options.
|
|
72
72
|
*/
|
|
73
|
-
collapsed
|
|
73
|
+
collapsed?: (options: PanelRenderOptions<TWidgetFactory>) => boolean;
|
|
74
74
|
/**
|
|
75
75
|
* The templates to use for the widget.
|
|
76
76
|
*/
|
|
@@ -18,7 +18,7 @@ type RangeSliderTooltipOptions = {
|
|
|
18
18
|
* @example
|
|
19
19
|
* { format(rawValue) {return '$' + Math.round(rawValue).toLocaleString() } }
|
|
20
20
|
*/
|
|
21
|
-
format(value: number)
|
|
21
|
+
format: (value: number) => string;
|
|
22
22
|
};
|
|
23
23
|
export type RangeSliderWidgetParams = {
|
|
24
24
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.56.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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/google.maps": "^3.45.3",
|
|
34
34
|
"@types/hogan.js": "^3.0.0",
|
|
35
35
|
"@types/qs": "^6.5.3",
|
|
36
|
-
"algoliasearch-helper": "^3.
|
|
36
|
+
"algoliasearch-helper": "^3.13.0",
|
|
37
37
|
"hogan.js": "^3.0.2",
|
|
38
38
|
"htm": "^3.0.0",
|
|
39
39
|
"preact": "^10.10.0",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"version": "./scripts/version/update-version.js"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@instantsearch/mocks": "1.
|
|
59
|
-
"@instantsearch/tests": "1.
|
|
60
|
-
"@instantsearch/testutils": "1.
|
|
58
|
+
"@instantsearch/mocks": "1.13.0",
|
|
59
|
+
"@instantsearch/tests": "1.13.0",
|
|
60
|
+
"@instantsearch/testutils": "1.2.0",
|
|
61
61
|
"@storybook/html": "5.3.9",
|
|
62
62
|
"@types/scriptjs": "0.0.2",
|
|
63
63
|
"algoliasearch": "4.14.3",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"scriptjs": "2.5.9",
|
|
66
66
|
"webpack": "4.41.5"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "ea054eab1484a3d167db83bc768f6ea134add5f9"
|
|
69
69
|
}
|