instantsearch.js 4.40.2 → 4.40.5
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 +27 -0
- package/cjs/connectors/breadcrumb/connectBreadcrumb.js +1 -1
- package/cjs/connectors/current-refinements/connectCurrentRefinements.js +13 -1
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +4 -3
- package/cjs/connectors/menu/connectMenu.js +3 -2
- package/cjs/connectors/refinement-list/connectRefinementList.js +7 -5
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +6 -6
- package/cjs/lib/routers/history.js +46 -31
- package/cjs/lib/utils/escapeFacetValue.js +23 -0
- package/cjs/lib/utils/getRefinements.js +10 -14
- package/cjs/lib/utils/index.js +7 -9
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.d.ts +3 -3
- package/dist/instantsearch.development.js +158 -79
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +3 -3
- package/dist/instantsearch.production.min.d.ts +3 -3
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/breadcrumb/connectBreadcrumb.js +1 -1
- package/es/connectors/current-refinements/connectCurrentRefinements.js +13 -1
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +4 -3
- package/es/connectors/menu/connectMenu.js +3 -2
- package/es/connectors/refinement-list/connectRefinementList.js +7 -5
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +7 -7
- package/es/lib/routers/history.d.ts +3 -3
- package/es/lib/routers/history.js +46 -31
- package/es/lib/utils/escapeFacetValue.d.ts +4 -0
- package/es/lib/utils/escapeFacetValue.js +14 -0
- package/es/lib/utils/getRefinements.d.ts +22 -7
- package/es/lib/utils/getRefinements.js +10 -13
- package/es/lib/utils/index.d.ts +1 -2
- package/es/lib/utils/index.js +1 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/types/results.d.ts +2 -7
- package/package.json +3 -3
- package/cjs/lib/utils/escapeRefinement.js +0 -17
- package/cjs/lib/utils/unescapeRefinement.js +0 -13
- package/es/lib/utils/escapeRefinement.d.ts +0 -3
- package/es/lib/utils/escapeRefinement.js +0 -9
- package/es/lib/utils/unescapeRefinement.d.ts +0 -2
- package/es/lib/utils/unescapeRefinement.js +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.40.
|
|
1
|
+
/*! InstantSearch.js 4.40.5 | © 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) :
|
|
@@ -2244,12 +2244,44 @@
|
|
|
2244
2244
|
);
|
|
2245
2245
|
};
|
|
2246
2246
|
|
|
2247
|
+
/**
|
|
2248
|
+
* Replaces a leading - with \-
|
|
2249
|
+
* @private
|
|
2250
|
+
* @param {any} value the facet value to replace
|
|
2251
|
+
* @returns any
|
|
2252
|
+
*/
|
|
2253
|
+
function escapeFacetValue(value) {
|
|
2254
|
+
if (typeof value !== 'string') return value;
|
|
2255
|
+
|
|
2256
|
+
return String(value).replace(/^-/, '\\-');
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
/**
|
|
2260
|
+
* Replaces a leading \- with -
|
|
2261
|
+
* @private
|
|
2262
|
+
* @param {any} value the escaped facet value
|
|
2263
|
+
* @returns any
|
|
2264
|
+
*/
|
|
2265
|
+
function unescapeFacetValue(value) {
|
|
2266
|
+
if (typeof value !== 'string') return value;
|
|
2267
|
+
|
|
2268
|
+
return value.replace(/^\\-/, '-');
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
var escapeFacetValue_1 = {
|
|
2272
|
+
escapeFacetValue: escapeFacetValue,
|
|
2273
|
+
unescapeFacetValue: unescapeFacetValue
|
|
2274
|
+
};
|
|
2275
|
+
|
|
2247
2276
|
var generateHierarchicalTree_1 = generateTrees;
|
|
2248
2277
|
|
|
2249
2278
|
|
|
2250
2279
|
|
|
2251
2280
|
|
|
2252
2281
|
|
|
2282
|
+
var escapeFacetValue$1 = escapeFacetValue_1.escapeFacetValue;
|
|
2283
|
+
var unescapeFacetValue$1 = escapeFacetValue_1.unescapeFacetValue;
|
|
2284
|
+
|
|
2253
2285
|
function generateTrees(state) {
|
|
2254
2286
|
return function generate(hierarchicalFacetResult, hierarchicalFacetIndex) {
|
|
2255
2287
|
var hierarchicalFacet = state.hierarchicalFacets[hierarchicalFacetIndex];
|
|
@@ -2295,6 +2327,7 @@
|
|
|
2295
2327
|
count: null, // root level, no count
|
|
2296
2328
|
isRefined: true, // root level, always refined
|
|
2297
2329
|
path: null, // root level, no path
|
|
2330
|
+
escapedValue: null,
|
|
2298
2331
|
exhaustive: rootExhaustive,
|
|
2299
2332
|
data: null
|
|
2300
2333
|
});
|
|
@@ -2370,7 +2403,7 @@
|
|
|
2370
2403
|
facetCount,
|
|
2371
2404
|
facetValue,
|
|
2372
2405
|
hierarchicalSeparator,
|
|
2373
|
-
currentRefinement,
|
|
2406
|
+
unescapeFacetValue$1(currentRefinement),
|
|
2374
2407
|
hierarchicalFacetResult.exhaustive
|
|
2375
2408
|
);
|
|
2376
2409
|
}),
|
|
@@ -2433,6 +2466,7 @@
|
|
|
2433
2466
|
return {
|
|
2434
2467
|
name: parts[parts.length - 1].trim(),
|
|
2435
2468
|
path: facetValue,
|
|
2469
|
+
escapedValue: escapeFacetValue$1(facetValue),
|
|
2436
2470
|
count: facetCount,
|
|
2437
2471
|
isRefined:
|
|
2438
2472
|
currentRefinement === facetValue ||
|
|
@@ -2442,6 +2476,11 @@
|
|
|
2442
2476
|
};
|
|
2443
2477
|
}
|
|
2444
2478
|
|
|
2479
|
+
var escapeFacetValue$2 = escapeFacetValue_1.escapeFacetValue;
|
|
2480
|
+
var unescapeFacetValue$2 = escapeFacetValue_1.unescapeFacetValue;
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
|
|
2445
2484
|
/**
|
|
2446
2485
|
* @typedef SearchResults.Facet
|
|
2447
2486
|
* @type {object}
|
|
@@ -2940,7 +2979,7 @@
|
|
|
2940
2979
|
state.disjunctiveFacetsRefinements[dfacet].forEach(function(refinementValue) {
|
|
2941
2980
|
// add the disjunctive refinements if it is no more retrieved
|
|
2942
2981
|
if (!self.disjunctiveFacets[position].data[refinementValue] &&
|
|
2943
|
-
state.disjunctiveFacetsRefinements[dfacet].indexOf(refinementValue) > -1) {
|
|
2982
|
+
state.disjunctiveFacetsRefinements[dfacet].indexOf(unescapeFacetValue$2(refinementValue)) > -1) {
|
|
2944
2983
|
self.disjunctiveFacets[position].data[refinementValue] = 0;
|
|
2945
2984
|
}
|
|
2946
2985
|
});
|
|
@@ -3072,10 +3111,12 @@
|
|
|
3072
3111
|
if (!facet) return [];
|
|
3073
3112
|
|
|
3074
3113
|
return Object.keys(facet.data).map(function(name) {
|
|
3114
|
+
var value = escapeFacetValue$2(name);
|
|
3075
3115
|
return {
|
|
3076
3116
|
name: name,
|
|
3117
|
+
escapedValue: value,
|
|
3077
3118
|
count: facet.data[name],
|
|
3078
|
-
isRefined: results._state.isFacetRefined(attribute,
|
|
3119
|
+
isRefined: results._state.isFacetRefined(attribute, value),
|
|
3079
3120
|
isExcluded: results._state.isExcludeRefined(attribute, name)
|
|
3080
3121
|
};
|
|
3081
3122
|
});
|
|
@@ -3084,10 +3125,12 @@
|
|
|
3084
3125
|
if (!disjunctiveFacet) return [];
|
|
3085
3126
|
|
|
3086
3127
|
return Object.keys(disjunctiveFacet.data).map(function(name) {
|
|
3128
|
+
var value = escapeFacetValue$2(name);
|
|
3087
3129
|
return {
|
|
3088
3130
|
name: name,
|
|
3131
|
+
escapedValue: value,
|
|
3089
3132
|
count: disjunctiveFacet.data[name],
|
|
3090
|
-
isRefined: results._state.isDisjunctiveFacetRefined(attribute,
|
|
3133
|
+
isRefined: results._state.isDisjunctiveFacetRefined(attribute, value)
|
|
3091
3134
|
};
|
|
3092
3135
|
});
|
|
3093
3136
|
} else if (results._state.isHierarchicalFacet(attribute)) {
|
|
@@ -4120,7 +4163,9 @@
|
|
|
4120
4163
|
|
|
4121
4164
|
var requestBuilder_1 = requestBuilder;
|
|
4122
4165
|
|
|
4123
|
-
var version = '3.
|
|
4166
|
+
var version = '3.8.2';
|
|
4167
|
+
|
|
4168
|
+
var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
|
|
4124
4169
|
|
|
4125
4170
|
/**
|
|
4126
4171
|
* Event triggered when a parameter is set or updated
|
|
@@ -4470,9 +4515,10 @@
|
|
|
4470
4515
|
content = Array.isArray(content) ? content[0] : content;
|
|
4471
4516
|
|
|
4472
4517
|
content.facetHits.forEach(function(f) {
|
|
4518
|
+
f.escapedValue = escapeFacetValue$3(f.value);
|
|
4473
4519
|
f.isRefined = isDisjunctive
|
|
4474
|
-
? state.isDisjunctiveFacetRefined(facet, f.
|
|
4475
|
-
: state.isFacetRefined(facet, f.
|
|
4520
|
+
? state.isDisjunctiveFacetRefined(facet, f.escapedValue)
|
|
4521
|
+
: state.isFacetRefined(facet, f.escapedValue);
|
|
4476
4522
|
});
|
|
4477
4523
|
|
|
4478
4524
|
return content;
|
|
@@ -6612,8 +6658,19 @@
|
|
|
6612
6658
|
return undefined;
|
|
6613
6659
|
}
|
|
6614
6660
|
|
|
6615
|
-
function
|
|
6616
|
-
|
|
6661
|
+
function unescapeFacetValue$3(value) {
|
|
6662
|
+
if (typeof value === 'string') {
|
|
6663
|
+
return value.replace(/^\\-/, '-');
|
|
6664
|
+
}
|
|
6665
|
+
|
|
6666
|
+
return value;
|
|
6667
|
+
}
|
|
6668
|
+
function escapeFacetValue$4(value) {
|
|
6669
|
+
if (typeof value === 'number' && value < 0 || typeof value === 'string') {
|
|
6670
|
+
return String(value).replace(/^-/, '\\-');
|
|
6671
|
+
}
|
|
6672
|
+
|
|
6673
|
+
return value;
|
|
6617
6674
|
}
|
|
6618
6675
|
|
|
6619
6676
|
function getRefinement$1(state, type, attribute, name) {
|
|
@@ -6621,7 +6678,8 @@
|
|
|
6621
6678
|
var res = {
|
|
6622
6679
|
type: type,
|
|
6623
6680
|
attribute: attribute,
|
|
6624
|
-
name: name
|
|
6681
|
+
name: name,
|
|
6682
|
+
escapedValue: escapeFacetValue$4(name)
|
|
6625
6683
|
};
|
|
6626
6684
|
var facet = find$1(resultsFacets, function (resultsFacet) {
|
|
6627
6685
|
return resultsFacet.name === attribute;
|
|
@@ -6655,14 +6713,12 @@
|
|
|
6655
6713
|
count = facet && facet.data && facet.data[res.name];
|
|
6656
6714
|
}
|
|
6657
6715
|
|
|
6658
|
-
var exhaustive = facet && facet.exhaustive;
|
|
6659
|
-
|
|
6660
6716
|
if (count !== undefined) {
|
|
6661
6717
|
res.count = count;
|
|
6662
6718
|
}
|
|
6663
6719
|
|
|
6664
|
-
if (exhaustive !== undefined) {
|
|
6665
|
-
res.exhaustive = exhaustive;
|
|
6720
|
+
if (facet && facet.exhaustive !== undefined) {
|
|
6721
|
+
res.exhaustive = facet.exhaustive;
|
|
6666
6722
|
}
|
|
6667
6723
|
|
|
6668
6724
|
return res;
|
|
@@ -6703,9 +6759,9 @@
|
|
|
6703
6759
|
Object.keys(disjunctiveFacetsRefinements).forEach(function (attribute) {
|
|
6704
6760
|
var refinementNames = disjunctiveFacetsRefinements[attribute];
|
|
6705
6761
|
refinementNames.forEach(function (refinementName) {
|
|
6706
|
-
refinements.push(getRefinement$1(state, 'disjunctive', attribute, // We unescape any disjunctive refined values with `
|
|
6707
|
-
// they can be escaped on negative numeric values with `
|
|
6708
|
-
|
|
6762
|
+
refinements.push(getRefinement$1(state, 'disjunctive', attribute, // We unescape any disjunctive refined values with `unescapeFacetValue` because
|
|
6763
|
+
// they can be escaped on negative numeric values with `escapeFacetValue`.
|
|
6764
|
+
unescapeFacetValue$3(refinementName), results.disjunctiveFacets));
|
|
6709
6765
|
});
|
|
6710
6766
|
});
|
|
6711
6767
|
Object.keys(hierarchicalFacetsRefinements).forEach(function (attribute) {
|
|
@@ -6792,14 +6848,6 @@
|
|
|
6792
6848
|
return finalState;
|
|
6793
6849
|
}
|
|
6794
6850
|
|
|
6795
|
-
function escapeRefinement(value) {
|
|
6796
|
-
if (typeof value === 'number' && value < 0) {
|
|
6797
|
-
value = String(value).replace(/^-/, '\\-');
|
|
6798
|
-
}
|
|
6799
|
-
|
|
6800
|
-
return value;
|
|
6801
|
-
}
|
|
6802
|
-
|
|
6803
6851
|
function getObjectType(object) {
|
|
6804
6852
|
return Object.prototype.toString.call(object).slice(8, -1);
|
|
6805
6853
|
}
|
|
@@ -8488,7 +8536,7 @@
|
|
|
8488
8536
|
instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
|
|
8489
8537
|
}
|
|
8490
8538
|
|
|
8491
|
-
var version$1 = '4.40.
|
|
8539
|
+
var version$1 = '4.40.5';
|
|
8492
8540
|
|
|
8493
8541
|
var NAMESPACE = 'ais';
|
|
8494
8542
|
var component = function component(componentName) {
|
|
@@ -9603,7 +9651,7 @@
|
|
|
9603
9651
|
|
|
9604
9652
|
_defineProperty(this, "writeTimer", void 0);
|
|
9605
9653
|
|
|
9606
|
-
_defineProperty(this, "
|
|
9654
|
+
_defineProperty(this, "inPopState", false);
|
|
9607
9655
|
|
|
9608
9656
|
_defineProperty(this, "isDisposed", false);
|
|
9609
9657
|
|
|
@@ -9658,20 +9706,14 @@
|
|
|
9658
9706
|
}
|
|
9659
9707
|
|
|
9660
9708
|
_this2.writeTimer = setTimeout(function () {
|
|
9661
|
-
setWindowTitle(title);
|
|
9662
|
-
// - the router is not disposed, IS.js needs to update the URL
|
|
9663
|
-
// OR
|
|
9664
|
-
// - the last write was from InstantSearch.js
|
|
9665
|
-
// (unlike a SPA, where it would have last written)
|
|
9709
|
+
setWindowTitle(title);
|
|
9666
9710
|
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
if (_this2.shouldPushState && lastPushWasByISAfterDispose) {
|
|
9711
|
+
if (_this2.shouldWrite(url)) {
|
|
9670
9712
|
window.history.pushState(routeState, title || '', url);
|
|
9671
9713
|
_this2.latestAcknowledgedHistory = window.history.length;
|
|
9672
9714
|
}
|
|
9673
9715
|
|
|
9674
|
-
_this2.
|
|
9716
|
+
_this2.inPopState = false;
|
|
9675
9717
|
_this2.writeTimer = undefined;
|
|
9676
9718
|
}, _this2.writeDelay);
|
|
9677
9719
|
});
|
|
@@ -9692,7 +9734,7 @@
|
|
|
9692
9734
|
_this3.writeTimer = undefined;
|
|
9693
9735
|
}
|
|
9694
9736
|
|
|
9695
|
-
_this3.
|
|
9737
|
+
_this3.inPopState = true;
|
|
9696
9738
|
var routeState = event.state; // At initial load, the state is read from the URL without update.
|
|
9697
9739
|
// Therefore the state object is not available.
|
|
9698
9740
|
// In this case, we fallback and read the URL.
|
|
@@ -9750,18 +9792,39 @@
|
|
|
9750
9792
|
|
|
9751
9793
|
this.write({});
|
|
9752
9794
|
}
|
|
9795
|
+
}, {
|
|
9796
|
+
key: "shouldWrite",
|
|
9797
|
+
value: function shouldWrite(url) {
|
|
9798
|
+
var _this5 = this;
|
|
9799
|
+
|
|
9800
|
+
return safelyRunOnBrowser(function (_ref6) {
|
|
9801
|
+
var window = _ref6.window;
|
|
9802
|
+
// We do want to `pushState` if:
|
|
9803
|
+
// - the router is not disposed, IS.js needs to update the URL
|
|
9804
|
+
// OR
|
|
9805
|
+
// - the last write was from InstantSearch.js
|
|
9806
|
+
// (unlike a SPA, where it would have last written)
|
|
9807
|
+
var lastPushWasByISAfterDispose = !(_this5.isDisposed && _this5.latestAcknowledgedHistory !== window.history.length);
|
|
9808
|
+
return (// When the last state change was through popstate, the IS.js state changes,
|
|
9809
|
+
// but that should not write the URL.
|
|
9810
|
+
!_this5.inPopState && // When the previous pushState after dispose was by IS.js, we want to write the URL.
|
|
9811
|
+
lastPushWasByISAfterDispose && // When the URL is the same as the current one, we do not want to write it.
|
|
9812
|
+
url !== window.location.href
|
|
9813
|
+
);
|
|
9814
|
+
});
|
|
9815
|
+
}
|
|
9753
9816
|
}]);
|
|
9754
9817
|
|
|
9755
9818
|
return BrowserHistory;
|
|
9756
9819
|
}();
|
|
9757
9820
|
|
|
9758
9821
|
function historyRouter() {
|
|
9759
|
-
var
|
|
9760
|
-
|
|
9761
|
-
createURL =
|
|
9762
|
-
var qsModule =
|
|
9763
|
-
routeState =
|
|
9764
|
-
location =
|
|
9822
|
+
var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
9823
|
+
_ref7$createURL = _ref7.createURL,
|
|
9824
|
+
createURL = _ref7$createURL === void 0 ? function (_ref8) {
|
|
9825
|
+
var qsModule = _ref8.qsModule,
|
|
9826
|
+
routeState = _ref8.routeState,
|
|
9827
|
+
location = _ref8.location;
|
|
9765
9828
|
var protocol = location.protocol,
|
|
9766
9829
|
hostname = location.hostname,
|
|
9767
9830
|
_location$port = location.port,
|
|
@@ -9777,11 +9840,11 @@
|
|
|
9777
9840
|
}
|
|
9778
9841
|
|
|
9779
9842
|
return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname, "?").concat(queryString).concat(hash);
|
|
9780
|
-
} :
|
|
9781
|
-
|
|
9782
|
-
parseURL =
|
|
9783
|
-
var qsModule =
|
|
9784
|
-
location =
|
|
9843
|
+
} : _ref7$createURL,
|
|
9844
|
+
_ref7$parseURL = _ref7.parseURL,
|
|
9845
|
+
parseURL = _ref7$parseURL === void 0 ? function (_ref9) {
|
|
9846
|
+
var qsModule = _ref9.qsModule,
|
|
9847
|
+
location = _ref9.location;
|
|
9785
9848
|
// `qs` by default converts arrays with more than 20 items to an object.
|
|
9786
9849
|
// We want to avoid this because the data structure manipulated can therefore vary.
|
|
9787
9850
|
// Setting the limit to `100` seems a good number because the engine's default is 100
|
|
@@ -9795,21 +9858,21 @@
|
|
|
9795
9858
|
return qsModule.parse(location.search.slice(1), {
|
|
9796
9859
|
arrayLimit: 99
|
|
9797
9860
|
});
|
|
9798
|
-
} :
|
|
9799
|
-
|
|
9800
|
-
writeDelay =
|
|
9801
|
-
windowTitle =
|
|
9802
|
-
|
|
9803
|
-
getLocation =
|
|
9804
|
-
return safelyRunOnBrowser(function (
|
|
9805
|
-
var window =
|
|
9861
|
+
} : _ref7$parseURL,
|
|
9862
|
+
_ref7$writeDelay = _ref7.writeDelay,
|
|
9863
|
+
writeDelay = _ref7$writeDelay === void 0 ? 400 : _ref7$writeDelay,
|
|
9864
|
+
windowTitle = _ref7.windowTitle,
|
|
9865
|
+
_ref7$getLocation = _ref7.getLocation,
|
|
9866
|
+
getLocation = _ref7$getLocation === void 0 ? function () {
|
|
9867
|
+
return safelyRunOnBrowser(function (_ref10) {
|
|
9868
|
+
var window = _ref10.window;
|
|
9806
9869
|
return window.location;
|
|
9807
9870
|
}, {
|
|
9808
9871
|
fallback: function fallback() {
|
|
9809
9872
|
throw new Error('You need to provide `getLocation` to the `history` router in environments where `window` does not exist.');
|
|
9810
9873
|
}
|
|
9811
9874
|
});
|
|
9812
|
-
} :
|
|
9875
|
+
} : _ref7$getLocation;
|
|
9813
9876
|
|
|
9814
9877
|
return new BrowserHistory({
|
|
9815
9878
|
createURL: createURL,
|
|
@@ -10813,7 +10876,7 @@
|
|
|
10813
10876
|
}
|
|
10814
10877
|
|
|
10815
10878
|
function normalizeRefinement(refinement) {
|
|
10816
|
-
var value =
|
|
10879
|
+
var value = getValue(refinement);
|
|
10817
10880
|
var label = refinement.operator ? "".concat(getOperatorSymbol(refinement.operator), " ").concat(refinement.name) : refinement.name;
|
|
10818
10881
|
var normalizedRefinement = {
|
|
10819
10882
|
attribute: refinement.attribute,
|
|
@@ -10837,6 +10900,18 @@
|
|
|
10837
10900
|
return normalizedRefinement;
|
|
10838
10901
|
}
|
|
10839
10902
|
|
|
10903
|
+
function getValue(refinement) {
|
|
10904
|
+
if (refinement.type === 'numeric') {
|
|
10905
|
+
return Number(refinement.name);
|
|
10906
|
+
}
|
|
10907
|
+
|
|
10908
|
+
if ('escapedValue' in refinement) {
|
|
10909
|
+
return refinement.escapedValue;
|
|
10910
|
+
}
|
|
10911
|
+
|
|
10912
|
+
return refinement.name;
|
|
10913
|
+
}
|
|
10914
|
+
|
|
10840
10915
|
var withUsage$4 = createDocumentationMessageGenerator({
|
|
10841
10916
|
name: 'hierarchical-menu',
|
|
10842
10917
|
connector: true
|
|
@@ -10922,13 +10997,14 @@
|
|
|
10922
10997
|
function _prepareFacetValues(facetValues) {
|
|
10923
10998
|
return facetValues.slice(0, getLimit()).map(function (_ref2) {
|
|
10924
10999
|
var label = _ref2.name,
|
|
10925
|
-
value = _ref2.
|
|
11000
|
+
value = _ref2.escapedValue,
|
|
10926
11001
|
data = _ref2.data,
|
|
10927
|
-
|
|
11002
|
+
path = _ref2.path,
|
|
11003
|
+
subValue = _objectWithoutProperties(_ref2, ["name", "escapedValue", "data", "path"]);
|
|
10928
11004
|
|
|
10929
11005
|
var item = _objectSpread2(_objectSpread2({}, subValue), {}, {
|
|
10930
|
-
label: label,
|
|
10931
11006
|
value: value,
|
|
11007
|
+
label: label,
|
|
10932
11008
|
data: null
|
|
10933
11009
|
});
|
|
10934
11010
|
|
|
@@ -11887,8 +11963,9 @@
|
|
|
11887
11963
|
canToggleShowMore = showMore && (isShowingMore || facetItems.length > getLimit());
|
|
11888
11964
|
items = transformItems(facetItems.slice(0, getLimit()).map(function (_ref3) {
|
|
11889
11965
|
var label = _ref3.name,
|
|
11890
|
-
value = _ref3.
|
|
11891
|
-
|
|
11966
|
+
value = _ref3.escapedValue,
|
|
11967
|
+
path = _ref3.path,
|
|
11968
|
+
item = _objectWithoutProperties(_ref3, ["name", "escapedValue", "path"]);
|
|
11892
11969
|
|
|
11893
11970
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
11894
11971
|
label: label,
|
|
@@ -12851,11 +12928,12 @@
|
|
|
12851
12928
|
|
|
12852
12929
|
var formatItems = function formatItems(_ref2) {
|
|
12853
12930
|
var label = _ref2.name,
|
|
12854
|
-
|
|
12931
|
+
value = _ref2.escapedValue,
|
|
12932
|
+
item = _objectWithoutProperties(_ref2, ["name", "escapedValue"]);
|
|
12855
12933
|
|
|
12856
12934
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
12935
|
+
value: value,
|
|
12857
12936
|
label: label,
|
|
12858
|
-
value: label,
|
|
12859
12937
|
highlighted: label
|
|
12860
12938
|
});
|
|
12861
12939
|
};
|
|
@@ -12913,11 +12991,12 @@
|
|
|
12913
12991
|
Math.min(getLimit(), 100), tags).then(function (results) {
|
|
12914
12992
|
var facetValues = escapeFacetValues ? escapeFacets(results.facetHits) : results.facetHits;
|
|
12915
12993
|
var normalizedFacetValues = transformItems(facetValues.map(function (_ref3) {
|
|
12916
|
-
var
|
|
12917
|
-
|
|
12994
|
+
var escapedValue = _ref3.escapedValue,
|
|
12995
|
+
value = _ref3.value,
|
|
12996
|
+
item = _objectWithoutProperties(_ref3, ["escapedValue", "value"]);
|
|
12918
12997
|
|
|
12919
12998
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
12920
|
-
value:
|
|
12999
|
+
value: escapedValue,
|
|
12921
13000
|
label: value
|
|
12922
13001
|
});
|
|
12923
13002
|
}), {
|
|
@@ -13699,8 +13778,8 @@
|
|
|
13699
13778
|
}
|
|
13700
13779
|
|
|
13701
13780
|
var hasAnOffValue = userOff !== undefined;
|
|
13702
|
-
var on = toArray(userOn).map(
|
|
13703
|
-
var off = hasAnOffValue ? toArray(userOff).map(
|
|
13781
|
+
var on = toArray(userOn).map(escapeFacetValue$4);
|
|
13782
|
+
var off = hasAnOffValue ? toArray(userOff).map(escapeFacetValue$4) : undefined;
|
|
13704
13783
|
var sendEvent;
|
|
13705
13784
|
|
|
13706
13785
|
var toggleRefinementFactory = function toggleRefinementFactory(helper) {
|
|
@@ -13813,16 +13892,16 @@
|
|
|
13813
13892
|
var allFacetValues = results.getFacetValues(attribute, {}) || [];
|
|
13814
13893
|
var onData = on.map(function (v) {
|
|
13815
13894
|
return find$1(allFacetValues, function (_ref7) {
|
|
13816
|
-
var
|
|
13817
|
-
return
|
|
13895
|
+
var escapedValue = _ref7.escapedValue;
|
|
13896
|
+
return escapedValue === escapeFacetValue$4(String(v));
|
|
13818
13897
|
});
|
|
13819
13898
|
}).filter(function (v) {
|
|
13820
13899
|
return v !== undefined;
|
|
13821
13900
|
});
|
|
13822
13901
|
var offData = hasAnOffValue ? offValue.map(function (v) {
|
|
13823
13902
|
return find$1(allFacetValues, function (_ref8) {
|
|
13824
|
-
var
|
|
13825
|
-
return
|
|
13903
|
+
var escapedValue = _ref8.escapedValue;
|
|
13904
|
+
return escapedValue === escapeFacetValue$4(String(v));
|
|
13826
13905
|
});
|
|
13827
13906
|
}).filter(function (v) {
|
|
13828
13907
|
return v !== undefined;
|
|
@@ -14057,7 +14136,7 @@
|
|
|
14057
14136
|
if (currentItem.isRefined) {
|
|
14058
14137
|
result.push({
|
|
14059
14138
|
label: currentItem.name,
|
|
14060
|
-
value: currentItem.
|
|
14139
|
+
value: currentItem.escapedValue
|
|
14061
14140
|
});
|
|
14062
14141
|
|
|
14063
14142
|
if (Array.isArray(currentItem.data)) {
|
|
@@ -19406,7 +19485,7 @@
|
|
|
19406
19485
|
return (value - min) / (max - min) * 100;
|
|
19407
19486
|
}
|
|
19408
19487
|
|
|
19409
|
-
function getValue(pos, min, max) {
|
|
19488
|
+
function getValue$1(pos, min, max) {
|
|
19410
19489
|
var decimal = pos / 100;
|
|
19411
19490
|
|
|
19412
19491
|
if (pos === 0) {
|
|
@@ -19617,7 +19696,7 @@
|
|
|
19617
19696
|
var _ref = this.props,
|
|
19618
19697
|
max = _ref.max,
|
|
19619
19698
|
min = _ref.min;
|
|
19620
|
-
var value = getValue(positionPercent, min, max);
|
|
19699
|
+
var value = getValue$1(positionPercent, min, max);
|
|
19621
19700
|
var snapValue = this.getClosestSnapPoint(value);
|
|
19622
19701
|
return getPosition(snapValue, min, max);
|
|
19623
19702
|
}
|
|
@@ -19711,7 +19790,7 @@
|
|
|
19711
19790
|
return {
|
|
19712
19791
|
handlePos: nextHandlePos,
|
|
19713
19792
|
values: nextHandlePos.map(function (pos) {
|
|
19714
|
-
return getValue(pos, min, max);
|
|
19793
|
+
return getValue$1(pos, min, max);
|
|
19715
19794
|
})
|
|
19716
19795
|
};
|
|
19717
19796
|
}
|