instantsearch.js 4.37.0 → 4.38.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/CHANGELOG.md +43 -0
- package/cjs/components/Hits/Hits.js +0 -6
- package/cjs/components/Pagination/Pagination.js +60 -41
- package/cjs/connectors/breadcrumb/connectBreadcrumb.js +10 -3
- package/cjs/connectors/clear-refinements/connectClearRefinements.js +11 -6
- package/cjs/connectors/current-refinements/connectCurrentRefinements.js +6 -2
- package/cjs/connectors/geo-search/connectGeoSearch.js +3 -1
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +3 -1
- package/cjs/connectors/hits/connectHits.js +3 -1
- package/cjs/connectors/hits-per-page/connectHitsPerPage.js +3 -1
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +3 -1
- package/cjs/connectors/menu/connectMenu.js +3 -1
- package/cjs/connectors/numeric-menu/connectNumericMenu.js +5 -3
- package/cjs/connectors/query-rules/connectQueryRules.js +3 -1
- package/cjs/connectors/refinement-list/connectRefinementList.js +8 -3
- package/cjs/connectors/search-box/connectSearchBox.js +15 -25
- package/cjs/connectors/sort-by/connectSortBy.js +3 -1
- package/cjs/helpers/highlight.js +4 -1
- package/cjs/helpers/reverseHighlight.js +4 -1
- package/cjs/helpers/reverseSnippet.js +4 -1
- package/cjs/helpers/snippet.js +4 -1
- package/cjs/lib/InstantSearch.js +9 -4
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.d.ts +45 -14
- package/dist/instantsearch.development.js +160 -147
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +45 -14
- package/dist/instantsearch.production.min.d.ts +45 -14
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Hits/Hits.d.ts +1 -9
- package/es/components/Hits/Hits.js +0 -6
- package/es/components/Pagination/Pagination.d.ts +3 -10
- package/es/components/Pagination/Pagination.js +55 -34
- package/es/connectors/breadcrumb/connectBreadcrumb.js +10 -3
- package/es/connectors/clear-refinements/connectClearRefinements.js +11 -6
- package/es/connectors/current-refinements/connectCurrentRefinements.js +6 -2
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.d.ts +4 -5
- package/es/connectors/geo-search/connectGeoSearch.js +3 -1
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +3 -1
- package/es/connectors/hits/connectHits.js +3 -1
- package/es/connectors/hits-per-page/connectHitsPerPage.js +3 -1
- package/es/connectors/infinite-hits/connectInfiniteHits.js +3 -1
- package/es/connectors/menu/connectMenu.js +3 -1
- package/es/connectors/numeric-menu/connectNumericMenu.js +5 -3
- package/es/connectors/query-rules/connectQueryRules.d.ts +1 -2
- package/es/connectors/query-rules/connectQueryRules.js +3 -1
- package/es/connectors/refinement-list/connectRefinementList.js +8 -3
- package/es/connectors/search-box/connectSearchBox.js +15 -25
- package/es/connectors/sort-by/connectSortBy.js +3 -1
- package/es/connectors/toggle-refinement/connectToggleRefinement.d.ts +36 -7
- package/es/helpers/highlight.js +5 -2
- package/es/helpers/reverseHighlight.js +5 -2
- package/es/helpers/reverseSnippet.js +5 -2
- package/es/helpers/snippet.js +5 -2
- package/es/lib/InstantSearch.js +9 -4
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/package.json +1 -1
- package/es/types/widget.d.ts +4 -1
- package/package.json +3 -3
- package/cjs/components/Pagination/PaginationLink.js +0 -60
- package/dist/instantsearch.development.min.d.ts +0 -5217
- package/es/components/Pagination/PaginationLink.d.ts +0 -16
- package/es/components/Pagination/PaginationLink.js +0 -49
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.
|
|
1
|
+
/*! InstantSearch.js 4.38.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -8483,7 +8483,7 @@
|
|
|
8483
8483
|
instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
|
|
8484
8484
|
}
|
|
8485
8485
|
|
|
8486
|
-
var version$1 = '4.
|
|
8486
|
+
var version$1 = '4.38.0';
|
|
8487
8487
|
|
|
8488
8488
|
var NAMESPACE = 'ais';
|
|
8489
8489
|
var component = function component(componentName) {
|
|
@@ -8506,8 +8506,11 @@
|
|
|
8506
8506
|
hit = _ref.hit,
|
|
8507
8507
|
_ref$cssClasses = _ref.cssClasses,
|
|
8508
8508
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
8509
|
+
var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute); // @MAJOR fallback to attribute value if highlight is not found
|
|
8509
8510
|
|
|
8510
|
-
|
|
8511
|
+
_warning(highlightAttributeResult, "Could not enable highlight for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) ;
|
|
8512
|
+
|
|
8513
|
+
var _ref2 = highlightAttributeResult || {},
|
|
8511
8514
|
_ref2$value = _ref2.value,
|
|
8512
8515
|
attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
|
|
8513
8516
|
|
|
@@ -8526,8 +8529,11 @@
|
|
|
8526
8529
|
hit = _ref.hit,
|
|
8527
8530
|
_ref$cssClasses = _ref.cssClasses,
|
|
8528
8531
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
8532
|
+
var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute); // @MAJOR fallback to attribute value if highlight is not found
|
|
8533
|
+
|
|
8534
|
+
_warning(highlightAttributeResult, "Could not enable reverse highlight for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) ;
|
|
8529
8535
|
|
|
8530
|
-
var _ref2 =
|
|
8536
|
+
var _ref2 = highlightAttributeResult || {},
|
|
8531
8537
|
_ref2$value = _ref2.value,
|
|
8532
8538
|
attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
|
|
8533
8539
|
|
|
@@ -8547,8 +8553,11 @@
|
|
|
8547
8553
|
hit = _ref.hit,
|
|
8548
8554
|
_ref$cssClasses = _ref.cssClasses,
|
|
8549
8555
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
8556
|
+
var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute); // @MAJOR fallback to attribute value if snippet is not found
|
|
8550
8557
|
|
|
8551
|
-
|
|
8558
|
+
_warning(snippetAttributeResult, "Could not enable snippet for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) ;
|
|
8559
|
+
|
|
8560
|
+
var _ref2 = snippetAttributeResult || {},
|
|
8552
8561
|
_ref2$value = _ref2.value,
|
|
8553
8562
|
attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
|
|
8554
8563
|
|
|
@@ -8567,8 +8576,11 @@
|
|
|
8567
8576
|
hit = _ref.hit,
|
|
8568
8577
|
_ref$cssClasses = _ref.cssClasses,
|
|
8569
8578
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
8579
|
+
var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute); // @MAJOR fallback to attribute value if snippet is not found
|
|
8580
|
+
|
|
8581
|
+
_warning(snippetAttributeResult, "Could not enable reverse snippet for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) ;
|
|
8570
8582
|
|
|
8571
|
-
var _ref2 =
|
|
8583
|
+
var _ref2 = snippetAttributeResult || {},
|
|
8572
8584
|
_ref2$value = _ref2.value,
|
|
8573
8585
|
attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
|
|
8574
8586
|
|
|
@@ -10314,10 +10326,15 @@
|
|
|
10314
10326
|
|
|
10315
10327
|
mainHelper.on('error', function (_ref4) {
|
|
10316
10328
|
var error = _ref4.error;
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10329
|
+
// If an error is emitted, it is re-thrown by events. In previous versions
|
|
10330
|
+
// we emitted {error}, which is thrown as:
|
|
10331
|
+
// "Uncaught, unspecified \"error\" event. ([object Object])"
|
|
10332
|
+
// To avoid breaking changes, we make the error available in both
|
|
10333
|
+
// `error` and `error.error`
|
|
10334
|
+
// @MAJOR emit only error
|
|
10335
|
+
error.error = error;
|
|
10336
|
+
|
|
10337
|
+
_this3.emit('error', error);
|
|
10321
10338
|
});
|
|
10322
10339
|
this.mainHelper = mainHelper;
|
|
10323
10340
|
this.middleware.forEach(function (_ref5) {
|
|
@@ -10528,13 +10545,15 @@
|
|
|
10528
10545
|
},
|
|
10529
10546
|
getWidgetRenderState: function getWidgetRenderState(_ref2) {
|
|
10530
10547
|
var createURL = _ref2.createURL,
|
|
10531
|
-
scopedResults = _ref2.scopedResults
|
|
10532
|
-
|
|
10533
|
-
|
|
10548
|
+
scopedResults = _ref2.scopedResults,
|
|
10549
|
+
results = _ref2.results;
|
|
10550
|
+
connectorState.attributesToClear = scopedResults.reduce(function (attributesToClear, scopedResult) {
|
|
10551
|
+
return attributesToClear.concat(getAttributesToClear({
|
|
10534
10552
|
scopedResult: scopedResult,
|
|
10535
10553
|
includedAttributes: includedAttributes,
|
|
10536
10554
|
excludedAttributes: excludedAttributes,
|
|
10537
|
-
transformItems: transformItems
|
|
10555
|
+
transformItems: transformItems,
|
|
10556
|
+
results: results
|
|
10538
10557
|
}));
|
|
10539
10558
|
}, []);
|
|
10540
10559
|
|
|
@@ -10579,7 +10598,8 @@
|
|
|
10579
10598
|
var scopedResult = _ref5.scopedResult,
|
|
10580
10599
|
includedAttributes = _ref5.includedAttributes,
|
|
10581
10600
|
excludedAttributes = _ref5.excludedAttributes,
|
|
10582
|
-
transformItems = _ref5.transformItems
|
|
10601
|
+
transformItems = _ref5.transformItems,
|
|
10602
|
+
results = _ref5.results;
|
|
10583
10603
|
var includesQuery = includedAttributes.indexOf('query') !== -1 || excludedAttributes.indexOf('query') === -1;
|
|
10584
10604
|
return {
|
|
10585
10605
|
helper: scopedResult.helper,
|
|
@@ -10595,7 +10615,9 @@
|
|
|
10595
10615
|
attribute === 'query' && includesQuery || // Otherwise, ignore the excluded attributes
|
|
10596
10616
|
excludedAttributes.indexOf(attribute) === -1
|
|
10597
10617
|
);
|
|
10598
|
-
}))
|
|
10618
|
+
})), {
|
|
10619
|
+
results: results
|
|
10620
|
+
})
|
|
10599
10621
|
};
|
|
10600
10622
|
}
|
|
10601
10623
|
|
|
@@ -10656,7 +10678,9 @@
|
|
|
10656
10678
|
helper: helper,
|
|
10657
10679
|
includedAttributes: includedAttributes,
|
|
10658
10680
|
excludedAttributes: excludedAttributes
|
|
10659
|
-
})
|
|
10681
|
+
}), {
|
|
10682
|
+
results: results
|
|
10683
|
+
});
|
|
10660
10684
|
}
|
|
10661
10685
|
|
|
10662
10686
|
return scopedResults.reduce(function (accResults, scopedResult) {
|
|
@@ -10665,7 +10689,9 @@
|
|
|
10665
10689
|
helper: scopedResult.helper,
|
|
10666
10690
|
includedAttributes: includedAttributes,
|
|
10667
10691
|
excludedAttributes: excludedAttributes
|
|
10668
|
-
})
|
|
10692
|
+
}), {
|
|
10693
|
+
results: results
|
|
10694
|
+
}));
|
|
10669
10695
|
}, []);
|
|
10670
10696
|
}
|
|
10671
10697
|
|
|
@@ -10960,7 +10986,9 @@
|
|
|
10960
10986
|
|
|
10961
10987
|
var hasExhaustiveItems = (state.maxValuesPerFacet || 0) > getLimit() ? facetItems.length <= getLimit() : facetItems.length < getLimit();
|
|
10962
10988
|
canToggleShowMore = showMore && (isShowingMore || !hasExhaustiveItems);
|
|
10963
|
-
items = transformItems(_prepareFacetValues(facetItems)
|
|
10989
|
+
items = transformItems(_prepareFacetValues(facetItems), {
|
|
10990
|
+
results: results
|
|
10991
|
+
});
|
|
10964
10992
|
}
|
|
10965
10993
|
|
|
10966
10994
|
return {
|
|
@@ -11093,7 +11121,9 @@
|
|
|
11093
11121
|
|
|
11094
11122
|
var hitsWithAbsolutePosition = addAbsolutePosition(results.hits, results.page, results.hitsPerPage);
|
|
11095
11123
|
var hitsWithAbsolutePositionAndQueryID = addQueryID(hitsWithAbsolutePosition, results.queryID);
|
|
11096
|
-
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID
|
|
11124
|
+
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID, {
|
|
11125
|
+
results: results
|
|
11126
|
+
});
|
|
11097
11127
|
return {
|
|
11098
11128
|
hits: transformedHits,
|
|
11099
11129
|
results: results,
|
|
@@ -11426,7 +11456,9 @@
|
|
|
11426
11456
|
createURL = _ref5.createURL,
|
|
11427
11457
|
helper = _ref5.helper;
|
|
11428
11458
|
return {
|
|
11429
|
-
items: transformItems(normalizeItems(state)
|
|
11459
|
+
items: transformItems(normalizeItems(state), {
|
|
11460
|
+
results: results
|
|
11461
|
+
}),
|
|
11430
11462
|
refine: connectorState.getRefine(helper),
|
|
11431
11463
|
createURL: connectorState.createURLFactory({
|
|
11432
11464
|
state: state,
|
|
@@ -11613,7 +11645,9 @@
|
|
|
11613
11645
|
|
|
11614
11646
|
var hitsWithAbsolutePosition = addAbsolutePosition(results.hits, results.page, results.hitsPerPage);
|
|
11615
11647
|
var hitsWithAbsolutePositionAndQueryID = addQueryID(hitsWithAbsolutePosition, results.queryID);
|
|
11616
|
-
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID
|
|
11648
|
+
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID, {
|
|
11649
|
+
results: results
|
|
11650
|
+
});
|
|
11617
11651
|
|
|
11618
11652
|
if (cachedHits[_page] === undefined) {
|
|
11619
11653
|
cachedHits[_page] = transformedHits;
|
|
@@ -11837,7 +11871,9 @@
|
|
|
11837
11871
|
label: label,
|
|
11838
11872
|
value: value
|
|
11839
11873
|
});
|
|
11840
|
-
})
|
|
11874
|
+
}), {
|
|
11875
|
+
results: results
|
|
11876
|
+
});
|
|
11841
11877
|
}
|
|
11842
11878
|
|
|
11843
11879
|
return {
|
|
@@ -11951,8 +11987,8 @@
|
|
|
11951
11987
|
_ref2$items = _ref2.items,
|
|
11952
11988
|
items = _ref2$items === void 0 ? [] : _ref2$items,
|
|
11953
11989
|
_ref2$transformItems = _ref2.transformItems,
|
|
11954
|
-
transformItems = _ref2$transformItems === void 0 ? function (
|
|
11955
|
-
return
|
|
11990
|
+
transformItems = _ref2$transformItems === void 0 ? function (item) {
|
|
11991
|
+
return item;
|
|
11956
11992
|
} : _ref2$transformItems;
|
|
11957
11993
|
|
|
11958
11994
|
if (attribute === '') {
|
|
@@ -12089,7 +12125,9 @@
|
|
|
12089
12125
|
|
|
12090
12126
|
return {
|
|
12091
12127
|
createURL: connectorState.createURL(state),
|
|
12092
|
-
items: transformItems(prepareItems(state)
|
|
12128
|
+
items: transformItems(prepareItems(state), {
|
|
12129
|
+
results: results
|
|
12130
|
+
}),
|
|
12093
12131
|
hasNoResults: results ? results.nbHits === 0 : true,
|
|
12094
12132
|
refine: connectorState.refine,
|
|
12095
12133
|
sendEvent: connectorState.sendEvent,
|
|
@@ -12831,7 +12869,8 @@
|
|
|
12831
12869
|
var createSearchForFacetValues = function createSearchForFacetValues(helper, widget) {
|
|
12832
12870
|
return function (renderOptions) {
|
|
12833
12871
|
return function (query) {
|
|
12834
|
-
var instantSearchInstance = renderOptions.instantSearchInstance
|
|
12872
|
+
var instantSearchInstance = renderOptions.instantSearchInstance,
|
|
12873
|
+
searchResults = renderOptions.results;
|
|
12835
12874
|
|
|
12836
12875
|
if (query === '' && lastItemsFromMainSearch) {
|
|
12837
12876
|
// render with previous data from the helper.
|
|
@@ -12858,7 +12897,9 @@
|
|
|
12858
12897
|
value: value,
|
|
12859
12898
|
label: value
|
|
12860
12899
|
});
|
|
12861
|
-
})
|
|
12900
|
+
}), {
|
|
12901
|
+
results: searchResults
|
|
12902
|
+
});
|
|
12862
12903
|
renderFn(_objectSpread2(_objectSpread2({}, widget.getWidgetRenderState(_objectSpread2(_objectSpread2({}, renderOptions), {}, {
|
|
12863
12904
|
results: lastResultsFromMainSearch
|
|
12864
12905
|
}))), {}, {
|
|
@@ -12922,7 +12963,9 @@
|
|
|
12922
12963
|
facetOrdering: sortBy === DEFAULT_SORT$2
|
|
12923
12964
|
});
|
|
12924
12965
|
facetValues = values && Array.isArray(values) ? values : [];
|
|
12925
|
-
items = transformItems(facetValues.slice(0, getLimit()).map(formatItems)
|
|
12966
|
+
items = transformItems(facetValues.slice(0, getLimit()).map(formatItems), {
|
|
12967
|
+
results: results
|
|
12968
|
+
});
|
|
12926
12969
|
var maxValuesPerFacetConfig = state.maxValuesPerFacet;
|
|
12927
12970
|
var currentLimit = getLimit(); // If the limit is the max number of facet retrieved it is impossible to know
|
|
12928
12971
|
// if the facets are exhaustive. The only moment we are sure it is exhaustive
|
|
@@ -13014,32 +13057,28 @@
|
|
|
13014
13057
|
connector: true
|
|
13015
13058
|
});
|
|
13016
13059
|
|
|
13060
|
+
var defaultQueryHook = function defaultQueryHook(query, hook) {
|
|
13061
|
+
return hook(query);
|
|
13062
|
+
};
|
|
13017
13063
|
/**
|
|
13018
13064
|
* **SearchBox** connector provides the logic to build a widget that will let the user search for a query.
|
|
13019
13065
|
*
|
|
13020
13066
|
* The connector provides to the rendering: `refine()` to set the query. The behaviour of this function
|
|
13021
13067
|
* may be impacted by the `queryHook` widget parameter.
|
|
13022
13068
|
*/
|
|
13069
|
+
|
|
13070
|
+
|
|
13023
13071
|
var connectSearchBox = function connectSearchBox(renderFn) {
|
|
13024
13072
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
13025
13073
|
checkRendering(renderFn, withUsage$d());
|
|
13026
13074
|
return function (widgetParams) {
|
|
13027
13075
|
var _ref = widgetParams || {},
|
|
13028
|
-
queryHook = _ref.queryHook
|
|
13029
|
-
|
|
13030
|
-
function clear(helper) {
|
|
13031
|
-
return function () {
|
|
13032
|
-
helper.setQuery('').search();
|
|
13033
|
-
};
|
|
13034
|
-
}
|
|
13076
|
+
_ref$queryHook = _ref.queryHook,
|
|
13077
|
+
queryHook = _ref$queryHook === void 0 ? defaultQueryHook : _ref$queryHook;
|
|
13035
13078
|
|
|
13036
13079
|
var _refine;
|
|
13037
13080
|
|
|
13038
|
-
var _clear
|
|
13039
|
-
|
|
13040
|
-
function _cachedClear() {
|
|
13041
|
-
_clear();
|
|
13042
|
-
}
|
|
13081
|
+
var _clear;
|
|
13043
13082
|
|
|
13044
13083
|
return {
|
|
13045
13084
|
$$type: 'ais.searchBox',
|
|
@@ -13071,27 +13110,21 @@
|
|
|
13071
13110
|
state = _ref3.state;
|
|
13072
13111
|
|
|
13073
13112
|
if (!_refine) {
|
|
13074
|
-
var setQueryAndSearch = function setQueryAndSearch(query) {
|
|
13075
|
-
if (query !== state.query) {
|
|
13076
|
-
helper.setQuery(query).search();
|
|
13077
|
-
}
|
|
13078
|
-
};
|
|
13079
|
-
|
|
13080
13113
|
_refine = function _refine(query) {
|
|
13081
|
-
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13114
|
+
queryHook(query, function (q) {
|
|
13115
|
+
return helper.setQuery(q).search();
|
|
13116
|
+
});
|
|
13117
|
+
};
|
|
13085
13118
|
|
|
13086
|
-
|
|
13119
|
+
_clear = function _clear() {
|
|
13120
|
+
helper.setQuery('').search();
|
|
13087
13121
|
};
|
|
13088
13122
|
}
|
|
13089
13123
|
|
|
13090
|
-
_clear = clear(helper);
|
|
13091
13124
|
return {
|
|
13092
13125
|
query: state.query || '',
|
|
13093
13126
|
refine: _refine,
|
|
13094
|
-
clear:
|
|
13127
|
+
clear: _clear,
|
|
13095
13128
|
widgetParams: widgetParams,
|
|
13096
13129
|
isSearchStalled: searchMetadata.isSearchStalled
|
|
13097
13130
|
};
|
|
@@ -13190,7 +13223,9 @@
|
|
|
13190
13223
|
|
|
13191
13224
|
return {
|
|
13192
13225
|
currentRefinement: state.index,
|
|
13193
|
-
options: transformItems(items
|
|
13226
|
+
options: transformItems(items, {
|
|
13227
|
+
results: results
|
|
13228
|
+
}),
|
|
13194
13229
|
refine: connectorState.setIndex,
|
|
13195
13230
|
hasNoResults: results ? results.nbHits === 0 : true,
|
|
13196
13231
|
widgetParams: widgetParams
|
|
@@ -13899,7 +13934,9 @@
|
|
|
13899
13934
|
if (!facetValue) {
|
|
13900
13935
|
var breadcrumb = state.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
13901
13936
|
|
|
13902
|
-
if (breadcrumb.length
|
|
13937
|
+
if (breadcrumb.length === 0) {
|
|
13938
|
+
return state;
|
|
13939
|
+
} else {
|
|
13903
13940
|
return state.resetPage().toggleFacetRefinement(hierarchicalFacetName, breadcrumb[0]);
|
|
13904
13941
|
}
|
|
13905
13942
|
}
|
|
@@ -13934,7 +13971,10 @@
|
|
|
13934
13971
|
state = _ref2.state;
|
|
13935
13972
|
|
|
13936
13973
|
function getItems() {
|
|
13937
|
-
|
|
13974
|
+
// The hierarchicalFacets condition is required for flavors
|
|
13975
|
+
// that render immediately with empty results, without relying
|
|
13976
|
+
// on init() (like React InstantSearch Hooks).
|
|
13977
|
+
if (!results || state.hierarchicalFacets.length === 0) {
|
|
13938
13978
|
return [];
|
|
13939
13979
|
}
|
|
13940
13980
|
|
|
@@ -13943,7 +13983,9 @@
|
|
|
13943
13983
|
|
|
13944
13984
|
var facetValues = results.getFacetValues(facetName, {});
|
|
13945
13985
|
var data = Array.isArray(facetValues.data) ? facetValues.data : [];
|
|
13946
|
-
var items = transformItems(shiftItemsValues(prepareItems(data))
|
|
13986
|
+
var items = transformItems(shiftItemsValues(prepareItems(data)), {
|
|
13987
|
+
results: results
|
|
13988
|
+
});
|
|
13947
13989
|
return items;
|
|
13948
13990
|
}
|
|
13949
13991
|
|
|
@@ -14169,7 +14211,9 @@
|
|
|
14169
14211
|
var state = helper.state;
|
|
14170
14212
|
var items = results ? transformItems(results.hits.filter(function (hit) {
|
|
14171
14213
|
return hit._geoloc;
|
|
14172
|
-
})
|
|
14214
|
+
}), {
|
|
14215
|
+
results: results
|
|
14216
|
+
}) : [];
|
|
14173
14217
|
|
|
14174
14218
|
if (!sendEvent) {
|
|
14175
14219
|
sendEvent = createSendEventForHits({
|
|
@@ -14715,7 +14759,9 @@
|
|
|
14715
14759
|
_ref4$userData = _ref4.userData,
|
|
14716
14760
|
userData = _ref4$userData === void 0 ? [] : _ref4$userData;
|
|
14717
14761
|
|
|
14718
|
-
var items = transformItems(userData
|
|
14762
|
+
var items = transformItems(userData, {
|
|
14763
|
+
results: results
|
|
14764
|
+
});
|
|
14719
14765
|
return {
|
|
14720
14766
|
items: items,
|
|
14721
14767
|
widgetParams: widgetParams
|
|
@@ -17569,13 +17615,6 @@
|
|
|
17569
17615
|
})));
|
|
17570
17616
|
};
|
|
17571
17617
|
|
|
17572
|
-
Hits.defaultProps = {
|
|
17573
|
-
results: {
|
|
17574
|
-
hits: []
|
|
17575
|
-
},
|
|
17576
|
-
hits: []
|
|
17577
|
-
};
|
|
17578
|
-
|
|
17579
17618
|
var defaultTemplates$5 = {
|
|
17580
17619
|
empty: 'No results',
|
|
17581
17620
|
item: function item(data) {
|
|
@@ -18295,130 +18334,104 @@
|
|
|
18295
18334
|
});
|
|
18296
18335
|
};
|
|
18297
18336
|
|
|
18298
|
-
/** @jsx h */
|
|
18299
|
-
|
|
18300
|
-
function PaginationLink(_ref) {
|
|
18301
|
-
var label = _ref.label,
|
|
18302
|
-
ariaLabel = _ref.ariaLabel,
|
|
18303
|
-
pageNumber = _ref.pageNumber,
|
|
18304
|
-
_ref$additionalClassN = _ref.additionalClassName,
|
|
18305
|
-
additionalClassName = _ref$additionalClassN === void 0 ? null : _ref$additionalClassN,
|
|
18306
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
18307
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
18308
|
-
_ref$isSelected = _ref.isSelected,
|
|
18309
|
-
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
18310
|
-
cssClasses = _ref.cssClasses,
|
|
18311
|
-
createURL = _ref.createURL,
|
|
18312
|
-
handleClick = _ref.handleClick;
|
|
18313
|
-
var classes = {
|
|
18314
|
-
item: classnames(cssClasses.item, additionalClassName, isDisabled && cssClasses.disabledItem, isSelected && cssClasses.selectedItem),
|
|
18315
|
-
link: cssClasses.link
|
|
18316
|
-
};
|
|
18317
|
-
|
|
18318
|
-
if (isDisabled) {
|
|
18319
|
-
return v("li", {
|
|
18320
|
-
className: classes.item
|
|
18321
|
-
}, v("span", {
|
|
18322
|
-
className: classes.link,
|
|
18323
|
-
dangerouslySetInnerHTML: {
|
|
18324
|
-
__html: label
|
|
18325
|
-
}
|
|
18326
|
-
}));
|
|
18327
|
-
}
|
|
18328
|
-
|
|
18329
|
-
return v("li", {
|
|
18330
|
-
className: classes.item
|
|
18331
|
-
}, v("a", {
|
|
18332
|
-
className: classes.link,
|
|
18333
|
-
"aria-label": ariaLabel,
|
|
18334
|
-
href: createURL(pageNumber),
|
|
18335
|
-
onClick: function onClick(event) {
|
|
18336
|
-
return handleClick(pageNumber, event);
|
|
18337
|
-
},
|
|
18338
|
-
dangerouslySetInnerHTML: {
|
|
18339
|
-
__html: label
|
|
18340
|
-
}
|
|
18341
|
-
}));
|
|
18342
|
-
}
|
|
18343
|
-
|
|
18344
|
-
var defaultProps$3 = {
|
|
18345
|
-
currentPage: 0,
|
|
18346
|
-
nbPages: 0,
|
|
18347
|
-
pages: []
|
|
18348
|
-
};
|
|
18349
|
-
|
|
18350
18337
|
function Pagination(props) {
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18338
|
+
function createClickHandler(pageNumber) {
|
|
18339
|
+
return function (event) {
|
|
18340
|
+
if (isSpecialClick(event)) {
|
|
18341
|
+
// do not alter the default browser behavior
|
|
18342
|
+
// if one special key is down
|
|
18343
|
+
return;
|
|
18344
|
+
}
|
|
18357
18345
|
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18346
|
+
event.preventDefault();
|
|
18347
|
+
props.setCurrentPage(pageNumber);
|
|
18348
|
+
};
|
|
18349
|
+
}
|
|
18361
18350
|
|
|
18362
18351
|
return v("div", {
|
|
18363
18352
|
className: classnames(props.cssClasses.root, _defineProperty({}, props.cssClasses.noRefinementRoot, props.nbPages <= 1))
|
|
18364
18353
|
}, v("ul", {
|
|
18365
18354
|
className: props.cssClasses.list
|
|
18366
18355
|
}, props.showFirst && v(PaginationLink, {
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
additionalClassName: props.cssClasses.firstPageItem,
|
|
18356
|
+
ariaLabel: "First",
|
|
18357
|
+
className: props.cssClasses.firstPageItem,
|
|
18370
18358
|
isDisabled: props.isFirstPage,
|
|
18371
18359
|
label: props.templates.first,
|
|
18372
18360
|
pageNumber: 0,
|
|
18373
18361
|
createURL: props.createURL,
|
|
18374
18362
|
cssClasses: props.cssClasses,
|
|
18375
|
-
|
|
18363
|
+
createClickHandler: createClickHandler
|
|
18376
18364
|
}), props.showPrevious && v(PaginationLink, {
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
additionalClassName: props.cssClasses.previousPageItem,
|
|
18365
|
+
ariaLabel: "Previous",
|
|
18366
|
+
className: props.cssClasses.previousPageItem,
|
|
18380
18367
|
isDisabled: props.isFirstPage,
|
|
18381
18368
|
label: props.templates.previous,
|
|
18382
18369
|
pageNumber: props.currentPage - 1,
|
|
18383
18370
|
createURL: props.createURL,
|
|
18384
18371
|
cssClasses: props.cssClasses,
|
|
18385
|
-
|
|
18372
|
+
createClickHandler: createClickHandler
|
|
18386
18373
|
}), props.pages.map(function (pageNumber) {
|
|
18387
18374
|
return v(PaginationLink, {
|
|
18388
18375
|
key: pageNumber,
|
|
18389
18376
|
ariaLabel: "".concat(pageNumber + 1),
|
|
18390
|
-
|
|
18377
|
+
className: props.cssClasses.pageItem,
|
|
18391
18378
|
isSelected: pageNumber === props.currentPage,
|
|
18392
18379
|
label: "".concat(pageNumber + 1),
|
|
18393
18380
|
pageNumber: pageNumber,
|
|
18394
18381
|
createURL: props.createURL,
|
|
18395
18382
|
cssClasses: props.cssClasses,
|
|
18396
|
-
|
|
18383
|
+
createClickHandler: createClickHandler
|
|
18397
18384
|
});
|
|
18398
18385
|
}), props.showNext && v(PaginationLink, {
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
additionalClassName: props.cssClasses.nextPageItem,
|
|
18386
|
+
ariaLabel: "Next",
|
|
18387
|
+
className: props.cssClasses.nextPageItem,
|
|
18402
18388
|
isDisabled: props.isLastPage,
|
|
18403
18389
|
label: props.templates.next,
|
|
18404
18390
|
pageNumber: props.currentPage + 1,
|
|
18405
18391
|
createURL: props.createURL,
|
|
18406
18392
|
cssClasses: props.cssClasses,
|
|
18407
|
-
|
|
18393
|
+
createClickHandler: createClickHandler
|
|
18408
18394
|
}), props.showLast && v(PaginationLink, {
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
additionalClassName: props.cssClasses.lastPageItem,
|
|
18395
|
+
ariaLabel: "Last",
|
|
18396
|
+
className: props.cssClasses.lastPageItem,
|
|
18412
18397
|
isDisabled: props.isLastPage,
|
|
18413
18398
|
label: props.templates.last,
|
|
18414
18399
|
pageNumber: props.nbPages - 1,
|
|
18415
18400
|
createURL: props.createURL,
|
|
18416
18401
|
cssClasses: props.cssClasses,
|
|
18417
|
-
|
|
18402
|
+
createClickHandler: createClickHandler
|
|
18418
18403
|
})));
|
|
18419
18404
|
}
|
|
18420
18405
|
|
|
18421
|
-
|
|
18406
|
+
function PaginationLink(_ref) {
|
|
18407
|
+
var label = _ref.label,
|
|
18408
|
+
ariaLabel = _ref.ariaLabel,
|
|
18409
|
+
pageNumber = _ref.pageNumber,
|
|
18410
|
+
className = _ref.className,
|
|
18411
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
18412
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
18413
|
+
_ref$isSelected = _ref.isSelected,
|
|
18414
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
18415
|
+
cssClasses = _ref.cssClasses,
|
|
18416
|
+
createURL = _ref.createURL,
|
|
18417
|
+
createClickHandler = _ref.createClickHandler;
|
|
18418
|
+
return v("li", {
|
|
18419
|
+
className: classnames(cssClasses.item, className, isDisabled && cssClasses.disabledItem, isSelected && cssClasses.selectedItem)
|
|
18420
|
+
}, isDisabled ? v("span", {
|
|
18421
|
+
className: cssClasses.link,
|
|
18422
|
+
dangerouslySetInnerHTML: {
|
|
18423
|
+
__html: label
|
|
18424
|
+
}
|
|
18425
|
+
}) : v("a", {
|
|
18426
|
+
className: cssClasses.link,
|
|
18427
|
+
"aria-label": ariaLabel,
|
|
18428
|
+
href: createURL(pageNumber),
|
|
18429
|
+
onClick: createClickHandler(pageNumber),
|
|
18430
|
+
dangerouslySetInnerHTML: {
|
|
18431
|
+
__html: label
|
|
18432
|
+
}
|
|
18433
|
+
}));
|
|
18434
|
+
}
|
|
18422
18435
|
|
|
18423
18436
|
var suit$h = component('Pagination');
|
|
18424
18437
|
var withUsage$G = createDocumentationMessageGenerator({
|