react-instantsearch-core 6.22.0 → 6.23.2
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/cjs/connectors/connectBreadcrumb.js +3 -3
- package/dist/cjs/connectors/connectHierarchicalMenu.js +5 -5
- package/dist/cjs/connectors/connectMenu.js +4 -4
- package/dist/cjs/connectors/connectRefinementList.js +6 -6
- package/dist/cjs/core/version.js +1 -1
- package/dist/es/connectors/connectBreadcrumb.js +3 -3
- package/dist/es/connectors/connectHierarchicalMenu.js +5 -5
- package/dist/es/connectors/connectMenu.js +4 -4
- package/dist/es/connectors/connectRefinementList.js +6 -6
- package/dist/es/core/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +75 -28
- package/dist/umd/ReactInstantSearchCore.js.map +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js +2 -2
- package/dist/umd/ReactInstantSearchCore.min.js.map +1 -1
- package/package.json +3 -3
|
@@ -34,9 +34,9 @@ function transformValue(values) {
|
|
|
34
34
|
if (item.isRefined) {
|
|
35
35
|
acc.push({
|
|
36
36
|
label: item.name,
|
|
37
|
-
// If dealing with a nested "items", "value" is equal to the previous value concatenated with the current
|
|
38
|
-
// If dealing with the first level, "value" is equal to the current
|
|
39
|
-
value: item.
|
|
37
|
+
// If dealing with a nested "items", "value" is equal to the previous value concatenated with the current value
|
|
38
|
+
// If dealing with the first level, "value" is equal to the current value
|
|
39
|
+
value: item.escapedValue
|
|
40
40
|
}); // Create a variable in order to keep the same acc for the recursion, otherwise "reduce" returns a new one
|
|
41
41
|
|
|
42
42
|
if (item.data) {
|
|
@@ -38,7 +38,7 @@ function getCurrentRefinement(props, searchState, context) {
|
|
|
38
38
|
return currentRefinement;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function getValue(
|
|
41
|
+
function getValue(value, props, searchState, context) {
|
|
42
42
|
var id = props.id,
|
|
43
43
|
attributes = props.attributes,
|
|
44
44
|
separator = props.separator,
|
|
@@ -48,7 +48,7 @@ function getValue(path, props, searchState, context) {
|
|
|
48
48
|
var nextRefinement;
|
|
49
49
|
|
|
50
50
|
if (currentRefinement === null) {
|
|
51
|
-
nextRefinement =
|
|
51
|
+
nextRefinement = value;
|
|
52
52
|
} else {
|
|
53
53
|
var tmpSearchParameters = new _algoliasearchHelper.default.SearchParameters({
|
|
54
54
|
hierarchicalFacets: [{
|
|
@@ -59,7 +59,7 @@ function getValue(path, props, searchState, context) {
|
|
|
59
59
|
showParentLevel: showParentLevel
|
|
60
60
|
}]
|
|
61
61
|
});
|
|
62
|
-
nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id,
|
|
62
|
+
nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id, value).getHierarchicalRefinement(id)[0];
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return nextRefinement;
|
|
@@ -69,7 +69,7 @@ function transformValue(value, props, searchState, context) {
|
|
|
69
69
|
return value.map(function (v) {
|
|
70
70
|
return {
|
|
71
71
|
label: v.name,
|
|
72
|
-
value: getValue(v.
|
|
72
|
+
value: getValue(v.escapedValue, props, searchState, context),
|
|
73
73
|
count: v.count,
|
|
74
74
|
isRefined: v.isRefined,
|
|
75
75
|
items: v.data && transformValue(v.data, props, searchState, context)
|
|
@@ -107,7 +107,7 @@ var sortBy = ['name:asc'];
|
|
|
107
107
|
* websites. From a UX point of view, we suggest not displaying more than two levels deep.
|
|
108
108
|
* @name connectHierarchicalMenu
|
|
109
109
|
* @requirements To use this widget, your attributes must be formatted in a specific way.
|
|
110
|
-
* If you want for example to have a
|
|
110
|
+
* If you want for example to have a hierarchical menu of categories, objects in your index
|
|
111
111
|
* should be formatted this way:
|
|
112
112
|
*
|
|
113
113
|
* ```json
|
|
@@ -31,9 +31,9 @@ function getCurrentRefinement(props, searchState, context) {
|
|
|
31
31
|
return currentRefinement;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function getValue(
|
|
34
|
+
function getValue(value, props, searchState, context) {
|
|
35
35
|
var currentRefinement = getCurrentRefinement(props, searchState, context);
|
|
36
|
-
return
|
|
36
|
+
return value === currentRefinement ? '' : value;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function getLimit(_ref) {
|
|
@@ -129,7 +129,7 @@ var _default = (0, _createConnector.default)({
|
|
|
129
129
|
items = searchForFacetValuesResults[attribute].map(function (v) {
|
|
130
130
|
return {
|
|
131
131
|
label: v.value,
|
|
132
|
-
value: getValue(v.
|
|
132
|
+
value: getValue(v.escapedValue, props, searchState, {
|
|
133
133
|
ais: props.contextValue,
|
|
134
134
|
multiIndexContext: props.indexContextValue
|
|
135
135
|
}),
|
|
@@ -149,7 +149,7 @@ var _default = (0, _createConnector.default)({
|
|
|
149
149
|
}).map(function (v) {
|
|
150
150
|
return {
|
|
151
151
|
label: v.name,
|
|
152
|
-
value: getValue(v.
|
|
152
|
+
value: getValue(v.escapedValue, props, searchState, {
|
|
153
153
|
ais: props.contextValue,
|
|
154
154
|
multiIndexContext: props.indexContextValue
|
|
155
155
|
}),
|
|
@@ -35,12 +35,12 @@ function getCurrentRefinement(props, searchState, context) {
|
|
|
35
35
|
return [];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function getValue(
|
|
38
|
+
function getValue(value, props, searchState, context) {
|
|
39
39
|
var currentRefinement = getCurrentRefinement(props, searchState, context);
|
|
40
|
-
var isAnewValue = currentRefinement.indexOf(
|
|
41
|
-
var nextRefinement = isAnewValue ? currentRefinement.concat([
|
|
40
|
+
var isAnewValue = currentRefinement.indexOf(value) === -1;
|
|
41
|
+
var nextRefinement = isAnewValue ? currentRefinement.concat([value]) // cannot use .push(), it mutates
|
|
42
42
|
: currentRefinement.filter(function (selectedValue) {
|
|
43
|
-
return selectedValue !==
|
|
43
|
+
return selectedValue !== value;
|
|
44
44
|
}); // cannot use .splice(), it mutates
|
|
45
45
|
|
|
46
46
|
return nextRefinement;
|
|
@@ -150,7 +150,7 @@ var _default = (0, _createConnector.default)({
|
|
|
150
150
|
var items = isFromSearch ? searchForFacetValuesResults[attribute].map(function (v) {
|
|
151
151
|
return {
|
|
152
152
|
label: v.value,
|
|
153
|
-
value: getValue(v.
|
|
153
|
+
value: getValue(v.escapedValue, props, searchState, {
|
|
154
154
|
ais: props.contextValue,
|
|
155
155
|
multiIndexContext: props.indexContextValue
|
|
156
156
|
}),
|
|
@@ -168,7 +168,7 @@ var _default = (0, _createConnector.default)({
|
|
|
168
168
|
}).map(function (v) {
|
|
169
169
|
return {
|
|
170
170
|
label: v.name,
|
|
171
|
-
value: getValue(v.
|
|
171
|
+
value: getValue(v.escapedValue, props, searchState, {
|
|
172
172
|
ais: props.contextValue,
|
|
173
173
|
multiIndexContext: props.indexContextValue
|
|
174
174
|
}),
|
package/dist/cjs/core/version.js
CHANGED
|
@@ -21,9 +21,9 @@ function transformValue(values) {
|
|
|
21
21
|
if (item.isRefined) {
|
|
22
22
|
acc.push({
|
|
23
23
|
label: item.name,
|
|
24
|
-
// If dealing with a nested "items", "value" is equal to the previous value concatenated with the current
|
|
25
|
-
// If dealing with the first level, "value" is equal to the current
|
|
26
|
-
value: item.
|
|
24
|
+
// If dealing with a nested "items", "value" is equal to the previous value concatenated with the current value
|
|
25
|
+
// If dealing with the first level, "value" is equal to the current value
|
|
26
|
+
value: item.escapedValue
|
|
27
27
|
}); // Create a variable in order to keep the same acc for the recursion, otherwise "reduce" returns a new one
|
|
28
28
|
|
|
29
29
|
if (item.data) {
|
|
@@ -23,7 +23,7 @@ function getCurrentRefinement(props, searchState, context) {
|
|
|
23
23
|
return currentRefinement;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function getValue(
|
|
26
|
+
function getValue(value, props, searchState, context) {
|
|
27
27
|
var id = props.id,
|
|
28
28
|
attributes = props.attributes,
|
|
29
29
|
separator = props.separator,
|
|
@@ -33,7 +33,7 @@ function getValue(path, props, searchState, context) {
|
|
|
33
33
|
var nextRefinement;
|
|
34
34
|
|
|
35
35
|
if (currentRefinement === null) {
|
|
36
|
-
nextRefinement =
|
|
36
|
+
nextRefinement = value;
|
|
37
37
|
} else {
|
|
38
38
|
var tmpSearchParameters = new algoliasearchHelper.SearchParameters({
|
|
39
39
|
hierarchicalFacets: [{
|
|
@@ -44,7 +44,7 @@ function getValue(path, props, searchState, context) {
|
|
|
44
44
|
showParentLevel: showParentLevel
|
|
45
45
|
}]
|
|
46
46
|
});
|
|
47
|
-
nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id,
|
|
47
|
+
nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id, value).getHierarchicalRefinement(id)[0];
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
return nextRefinement;
|
|
@@ -54,7 +54,7 @@ function transformValue(value, props, searchState, context) {
|
|
|
54
54
|
return value.map(function (v) {
|
|
55
55
|
return {
|
|
56
56
|
label: v.name,
|
|
57
|
-
value: getValue(v.
|
|
57
|
+
value: getValue(v.escapedValue, props, searchState, context),
|
|
58
58
|
count: v.count,
|
|
59
59
|
isRefined: v.isRefined,
|
|
60
60
|
items: v.data && transformValue(v.data, props, searchState, context)
|
|
@@ -94,7 +94,7 @@ var sortBy = ['name:asc'];
|
|
|
94
94
|
* websites. From a UX point of view, we suggest not displaying more than two levels deep.
|
|
95
95
|
* @name connectHierarchicalMenu
|
|
96
96
|
* @requirements To use this widget, your attributes must be formatted in a specific way.
|
|
97
|
-
* If you want for example to have a
|
|
97
|
+
* If you want for example to have a hierarchical menu of categories, objects in your index
|
|
98
98
|
* should be formatted this way:
|
|
99
99
|
*
|
|
100
100
|
* ```json
|
|
@@ -18,9 +18,9 @@ function getCurrentRefinement(props, searchState, context) {
|
|
|
18
18
|
return currentRefinement;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
function getValue(
|
|
21
|
+
function getValue(value, props, searchState, context) {
|
|
22
22
|
var currentRefinement = getCurrentRefinement(props, searchState, context);
|
|
23
|
-
return
|
|
23
|
+
return value === currentRefinement ? '' : value;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function getLimit(_ref) {
|
|
@@ -118,7 +118,7 @@ export default createConnector({
|
|
|
118
118
|
items = searchForFacetValuesResults[attribute].map(function (v) {
|
|
119
119
|
return {
|
|
120
120
|
label: v.value,
|
|
121
|
-
value: getValue(v.
|
|
121
|
+
value: getValue(v.escapedValue, props, searchState, {
|
|
122
122
|
ais: props.contextValue,
|
|
123
123
|
multiIndexContext: props.indexContextValue
|
|
124
124
|
}),
|
|
@@ -138,7 +138,7 @@ export default createConnector({
|
|
|
138
138
|
}).map(function (v) {
|
|
139
139
|
return {
|
|
140
140
|
label: v.name,
|
|
141
|
-
value: getValue(v.
|
|
141
|
+
value: getValue(v.escapedValue, props, searchState, {
|
|
142
142
|
ais: props.contextValue,
|
|
143
143
|
multiIndexContext: props.indexContextValue
|
|
144
144
|
}),
|
|
@@ -22,12 +22,12 @@ function getCurrentRefinement(props, searchState, context) {
|
|
|
22
22
|
return [];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function getValue(
|
|
25
|
+
function getValue(value, props, searchState, context) {
|
|
26
26
|
var currentRefinement = getCurrentRefinement(props, searchState, context);
|
|
27
|
-
var isAnewValue = currentRefinement.indexOf(
|
|
28
|
-
var nextRefinement = isAnewValue ? currentRefinement.concat([
|
|
27
|
+
var isAnewValue = currentRefinement.indexOf(value) === -1;
|
|
28
|
+
var nextRefinement = isAnewValue ? currentRefinement.concat([value]) // cannot use .push(), it mutates
|
|
29
29
|
: currentRefinement.filter(function (selectedValue) {
|
|
30
|
-
return selectedValue !==
|
|
30
|
+
return selectedValue !== value;
|
|
31
31
|
}); // cannot use .splice(), it mutates
|
|
32
32
|
|
|
33
33
|
return nextRefinement;
|
|
@@ -137,7 +137,7 @@ export default createConnector({
|
|
|
137
137
|
var items = isFromSearch ? searchForFacetValuesResults[attribute].map(function (v) {
|
|
138
138
|
return {
|
|
139
139
|
label: v.value,
|
|
140
|
-
value: getValue(v.
|
|
140
|
+
value: getValue(v.escapedValue, props, searchState, {
|
|
141
141
|
ais: props.contextValue,
|
|
142
142
|
multiIndexContext: props.indexContextValue
|
|
143
143
|
}),
|
|
@@ -155,7 +155,7 @@ export default createConnector({
|
|
|
155
155
|
}).map(function (v) {
|
|
156
156
|
return {
|
|
157
157
|
label: v.name,
|
|
158
|
-
value: getValue(v.
|
|
158
|
+
value: getValue(v.escapedValue, props, searchState, {
|
|
159
159
|
ais: props.contextValue,
|
|
160
160
|
multiIndexContext: props.indexContextValue
|
|
161
161
|
}),
|
package/dist/es/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '6.
|
|
1
|
+
export default '6.23.2';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearchCore 6.
|
|
1
|
+
/*! React InstantSearchCore 6.23.2 | © Algolia, inc. | https://github.com/algolia/react-instantsearch */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
@@ -839,7 +839,7 @@
|
|
|
839
839
|
});
|
|
840
840
|
}
|
|
841
841
|
|
|
842
|
-
var version = '6.
|
|
842
|
+
var version = '6.23.2';
|
|
843
843
|
|
|
844
844
|
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
845
845
|
|
|
@@ -3227,12 +3227,40 @@
|
|
|
3227
3227
|
);
|
|
3228
3228
|
};
|
|
3229
3229
|
|
|
3230
|
+
/**
|
|
3231
|
+
* Replaces a leading - with \-
|
|
3232
|
+
* @private
|
|
3233
|
+
* @param {string} value the facet value to replace
|
|
3234
|
+
* @returns string
|
|
3235
|
+
*/
|
|
3236
|
+
function escapeFacetValue(value) {
|
|
3237
|
+
return value.replace(/^-/, '\\-');
|
|
3238
|
+
}
|
|
3239
|
+
|
|
3240
|
+
/**
|
|
3241
|
+
* Replaces a leading \- with -
|
|
3242
|
+
* @private
|
|
3243
|
+
* @param {string} value the escaped facet value
|
|
3244
|
+
* @returns string
|
|
3245
|
+
*/
|
|
3246
|
+
function unescapeFacetValue(value) {
|
|
3247
|
+
return value.replace(/^\\-/, '-');
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
var escapeFacetValue_1 = {
|
|
3251
|
+
escapeFacetValue: escapeFacetValue,
|
|
3252
|
+
unescapeFacetValue: unescapeFacetValue
|
|
3253
|
+
};
|
|
3254
|
+
|
|
3230
3255
|
var generateHierarchicalTree_1 = generateTrees;
|
|
3231
3256
|
|
|
3232
3257
|
|
|
3233
3258
|
|
|
3234
3259
|
|
|
3235
3260
|
|
|
3261
|
+
var escapeFacetValue$1 = escapeFacetValue_1.escapeFacetValue;
|
|
3262
|
+
var unescapeFacetValue$1 = escapeFacetValue_1.unescapeFacetValue;
|
|
3263
|
+
|
|
3236
3264
|
function generateTrees(state) {
|
|
3237
3265
|
return function generate(hierarchicalFacetResult, hierarchicalFacetIndex) {
|
|
3238
3266
|
var hierarchicalFacet = state.hierarchicalFacets[hierarchicalFacetIndex];
|
|
@@ -3278,6 +3306,7 @@
|
|
|
3278
3306
|
count: null, // root level, no count
|
|
3279
3307
|
isRefined: true, // root level, always refined
|
|
3280
3308
|
path: null, // root level, no path
|
|
3309
|
+
escapedValue: null,
|
|
3281
3310
|
exhaustive: rootExhaustive,
|
|
3282
3311
|
data: null
|
|
3283
3312
|
});
|
|
@@ -3353,7 +3382,7 @@
|
|
|
3353
3382
|
facetCount,
|
|
3354
3383
|
facetValue,
|
|
3355
3384
|
hierarchicalSeparator,
|
|
3356
|
-
currentRefinement,
|
|
3385
|
+
unescapeFacetValue$1(currentRefinement),
|
|
3357
3386
|
hierarchicalFacetResult.exhaustive
|
|
3358
3387
|
);
|
|
3359
3388
|
}),
|
|
@@ -3416,6 +3445,7 @@
|
|
|
3416
3445
|
return {
|
|
3417
3446
|
name: parts[parts.length - 1].trim(),
|
|
3418
3447
|
path: facetValue,
|
|
3448
|
+
escapedValue: escapeFacetValue$1(facetValue),
|
|
3419
3449
|
count: facetCount,
|
|
3420
3450
|
isRefined:
|
|
3421
3451
|
currentRefinement === facetValue ||
|
|
@@ -3425,6 +3455,11 @@
|
|
|
3425
3455
|
};
|
|
3426
3456
|
}
|
|
3427
3457
|
|
|
3458
|
+
var escapeFacetValue$2 = escapeFacetValue_1.escapeFacetValue;
|
|
3459
|
+
var unescapeFacetValue$2 = escapeFacetValue_1.unescapeFacetValue;
|
|
3460
|
+
|
|
3461
|
+
|
|
3462
|
+
|
|
3428
3463
|
/**
|
|
3429
3464
|
* @typedef SearchResults.Facet
|
|
3430
3465
|
* @type {object}
|
|
@@ -3639,7 +3674,7 @@
|
|
|
3639
3674
|
}
|
|
3640
3675
|
**/
|
|
3641
3676
|
/*eslint-enable */
|
|
3642
|
-
function SearchResults(state, results) {
|
|
3677
|
+
function SearchResults(state, results, options) {
|
|
3643
3678
|
var mainSubResponse = results[0];
|
|
3644
3679
|
|
|
3645
3680
|
this._rawResults = results;
|
|
@@ -3651,6 +3686,11 @@
|
|
|
3651
3686
|
self[key] = mainSubResponse[key];
|
|
3652
3687
|
});
|
|
3653
3688
|
|
|
3689
|
+
// Make every key of the result options reachable from the instance
|
|
3690
|
+
Object.keys(options || {}).forEach(function(key) {
|
|
3691
|
+
self[key] = options[key];
|
|
3692
|
+
});
|
|
3693
|
+
|
|
3654
3694
|
/**
|
|
3655
3695
|
* query used to generate the results
|
|
3656
3696
|
* @name query
|
|
@@ -3918,7 +3958,7 @@
|
|
|
3918
3958
|
state.disjunctiveFacetsRefinements[dfacet].forEach(function(refinementValue) {
|
|
3919
3959
|
// add the disjunctive refinements if it is no more retrieved
|
|
3920
3960
|
if (!self.disjunctiveFacets[position].data[refinementValue] &&
|
|
3921
|
-
state.disjunctiveFacetsRefinements[dfacet].indexOf(refinementValue) > -1) {
|
|
3961
|
+
state.disjunctiveFacetsRefinements[dfacet].indexOf(unescapeFacetValue$2(refinementValue)) > -1) {
|
|
3922
3962
|
self.disjunctiveFacets[position].data[refinementValue] = 0;
|
|
3923
3963
|
}
|
|
3924
3964
|
});
|
|
@@ -4050,10 +4090,12 @@
|
|
|
4050
4090
|
if (!facet) return [];
|
|
4051
4091
|
|
|
4052
4092
|
return Object.keys(facet.data).map(function(name) {
|
|
4093
|
+
var value = escapeFacetValue$2(name);
|
|
4053
4094
|
return {
|
|
4054
4095
|
name: name,
|
|
4096
|
+
escapedValue: value,
|
|
4055
4097
|
count: facet.data[name],
|
|
4056
|
-
isRefined: results._state.isFacetRefined(attribute,
|
|
4098
|
+
isRefined: results._state.isFacetRefined(attribute, value),
|
|
4057
4099
|
isExcluded: results._state.isExcludeRefined(attribute, name)
|
|
4058
4100
|
};
|
|
4059
4101
|
});
|
|
@@ -4062,10 +4104,12 @@
|
|
|
4062
4104
|
if (!disjunctiveFacet) return [];
|
|
4063
4105
|
|
|
4064
4106
|
return Object.keys(disjunctiveFacet.data).map(function(name) {
|
|
4107
|
+
var value = escapeFacetValue$2(name);
|
|
4065
4108
|
return {
|
|
4066
4109
|
name: name,
|
|
4110
|
+
escapedValue: value,
|
|
4067
4111
|
count: disjunctiveFacet.data[name],
|
|
4068
|
-
isRefined: results._state.isDisjunctiveFacetRefined(attribute,
|
|
4112
|
+
isRefined: results._state.isDisjunctiveFacetRefined(attribute, value)
|
|
4069
4113
|
};
|
|
4070
4114
|
});
|
|
4071
4115
|
} else if (results._state.isHierarchicalFacet(attribute)) {
|
|
@@ -5098,7 +5142,9 @@
|
|
|
5098
5142
|
|
|
5099
5143
|
var requestBuilder_1 = requestBuilder;
|
|
5100
5144
|
|
|
5101
|
-
var version$1 = '3.
|
|
5145
|
+
var version$1 = '3.8.0';
|
|
5146
|
+
|
|
5147
|
+
var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
|
|
5102
5148
|
|
|
5103
5149
|
/**
|
|
5104
5150
|
* Event triggered when a parameter is set or updated
|
|
@@ -5448,9 +5494,10 @@
|
|
|
5448
5494
|
content = Array.isArray(content) ? content[0] : content;
|
|
5449
5495
|
|
|
5450
5496
|
content.facetHits.forEach(function(f) {
|
|
5497
|
+
f.escapedValue = escapeFacetValue$3(f.value);
|
|
5451
5498
|
f.isRefined = isDisjunctive
|
|
5452
|
-
? state.isDisjunctiveFacetRefined(facet, f.
|
|
5453
|
-
: state.isFacetRefined(facet, f.
|
|
5499
|
+
? state.isDisjunctiveFacetRefined(facet, f.escapedValue)
|
|
5500
|
+
: state.isFacetRefined(facet, f.escapedValue);
|
|
5454
5501
|
});
|
|
5455
5502
|
|
|
5456
5503
|
return content;
|
|
@@ -8292,9 +8339,9 @@
|
|
|
8292
8339
|
if (item.isRefined) {
|
|
8293
8340
|
acc.push({
|
|
8294
8341
|
label: item.name,
|
|
8295
|
-
// If dealing with a nested "items", "value" is equal to the previous value concatenated with the current
|
|
8296
|
-
// If dealing with the first level, "value" is equal to the current
|
|
8297
|
-
value: item.
|
|
8342
|
+
// If dealing with a nested "items", "value" is equal to the previous value concatenated with the current value
|
|
8343
|
+
// If dealing with the first level, "value" is equal to the current value
|
|
8344
|
+
value: item.escapedValue
|
|
8298
8345
|
}); // Create a variable in order to keep the same acc for the recursion, otherwise "reduce" returns a new one
|
|
8299
8346
|
|
|
8300
8347
|
if (item.data) {
|
|
@@ -8657,7 +8704,7 @@
|
|
|
8657
8704
|
return currentRefinement;
|
|
8658
8705
|
}
|
|
8659
8706
|
|
|
8660
|
-
function getValue(
|
|
8707
|
+
function getValue(value, props, searchState, context) {
|
|
8661
8708
|
var id = props.id,
|
|
8662
8709
|
attributes = props.attributes,
|
|
8663
8710
|
separator = props.separator,
|
|
@@ -8667,7 +8714,7 @@
|
|
|
8667
8714
|
var nextRefinement;
|
|
8668
8715
|
|
|
8669
8716
|
if (currentRefinement === null) {
|
|
8670
|
-
nextRefinement =
|
|
8717
|
+
nextRefinement = value;
|
|
8671
8718
|
} else {
|
|
8672
8719
|
var tmpSearchParameters = new algoliasearchHelper_1.SearchParameters({
|
|
8673
8720
|
hierarchicalFacets: [{
|
|
@@ -8678,7 +8725,7 @@
|
|
|
8678
8725
|
showParentLevel: showParentLevel
|
|
8679
8726
|
}]
|
|
8680
8727
|
});
|
|
8681
|
-
nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id,
|
|
8728
|
+
nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id, value).getHierarchicalRefinement(id)[0];
|
|
8682
8729
|
}
|
|
8683
8730
|
|
|
8684
8731
|
return nextRefinement;
|
|
@@ -8688,7 +8735,7 @@
|
|
|
8688
8735
|
return value.map(function (v) {
|
|
8689
8736
|
return {
|
|
8690
8737
|
label: v.name,
|
|
8691
|
-
value: getValue(v.
|
|
8738
|
+
value: getValue(v.escapedValue, props, searchState, context),
|
|
8692
8739
|
count: v.count,
|
|
8693
8740
|
isRefined: v.isRefined,
|
|
8694
8741
|
items: v.data && transformValue$1(v.data, props, searchState, context)
|
|
@@ -8728,7 +8775,7 @@
|
|
|
8728
8775
|
* websites. From a UX point of view, we suggest not displaying more than two levels deep.
|
|
8729
8776
|
* @name connectHierarchicalMenu
|
|
8730
8777
|
* @requirements To use this widget, your attributes must be formatted in a specific way.
|
|
8731
|
-
* If you want for example to have a
|
|
8778
|
+
* If you want for example to have a hierarchical menu of categories, objects in your index
|
|
8732
8779
|
* should be formatted this way:
|
|
8733
8780
|
*
|
|
8734
8781
|
* ```json
|
|
@@ -9328,9 +9375,9 @@
|
|
|
9328
9375
|
return currentRefinement;
|
|
9329
9376
|
}
|
|
9330
9377
|
|
|
9331
|
-
function getValue$1(
|
|
9378
|
+
function getValue$1(value, props, searchState, context) {
|
|
9332
9379
|
var currentRefinement = getCurrentRefinement$5(props, searchState, context);
|
|
9333
|
-
return
|
|
9380
|
+
return value === currentRefinement ? '' : value;
|
|
9334
9381
|
}
|
|
9335
9382
|
|
|
9336
9383
|
function getLimit(_ref) {
|
|
@@ -9428,7 +9475,7 @@
|
|
|
9428
9475
|
items = searchForFacetValuesResults[attribute].map(function (v) {
|
|
9429
9476
|
return {
|
|
9430
9477
|
label: v.value,
|
|
9431
|
-
value: getValue$1(v.
|
|
9478
|
+
value: getValue$1(v.escapedValue, props, searchState, {
|
|
9432
9479
|
ais: props.contextValue,
|
|
9433
9480
|
multiIndexContext: props.indexContextValue
|
|
9434
9481
|
}),
|
|
@@ -9448,7 +9495,7 @@
|
|
|
9448
9495
|
}).map(function (v) {
|
|
9449
9496
|
return {
|
|
9450
9497
|
label: v.name,
|
|
9451
|
-
value: getValue$1(v.
|
|
9498
|
+
value: getValue$1(v.escapedValue, props, searchState, {
|
|
9452
9499
|
ais: props.contextValue,
|
|
9453
9500
|
multiIndexContext: props.indexContextValue
|
|
9454
9501
|
}),
|
|
@@ -10228,12 +10275,12 @@
|
|
|
10228
10275
|
return [];
|
|
10229
10276
|
}
|
|
10230
10277
|
|
|
10231
|
-
function getValue$2(
|
|
10278
|
+
function getValue$2(value, props, searchState, context) {
|
|
10232
10279
|
var currentRefinement = getCurrentRefinement$9(props, searchState, context);
|
|
10233
|
-
var isAnewValue = currentRefinement.indexOf(
|
|
10234
|
-
var nextRefinement = isAnewValue ? currentRefinement.concat([
|
|
10280
|
+
var isAnewValue = currentRefinement.indexOf(value) === -1;
|
|
10281
|
+
var nextRefinement = isAnewValue ? currentRefinement.concat([value]) // cannot use .push(), it mutates
|
|
10235
10282
|
: currentRefinement.filter(function (selectedValue) {
|
|
10236
|
-
return selectedValue !==
|
|
10283
|
+
return selectedValue !== value;
|
|
10237
10284
|
}); // cannot use .splice(), it mutates
|
|
10238
10285
|
|
|
10239
10286
|
return nextRefinement;
|
|
@@ -10343,7 +10390,7 @@
|
|
|
10343
10390
|
var items = isFromSearch ? searchForFacetValuesResults[attribute].map(function (v) {
|
|
10344
10391
|
return {
|
|
10345
10392
|
label: v.value,
|
|
10346
|
-
value: getValue$2(v.
|
|
10393
|
+
value: getValue$2(v.escapedValue, props, searchState, {
|
|
10347
10394
|
ais: props.contextValue,
|
|
10348
10395
|
multiIndexContext: props.indexContextValue
|
|
10349
10396
|
}),
|
|
@@ -10361,7 +10408,7 @@
|
|
|
10361
10408
|
}).map(function (v) {
|
|
10362
10409
|
return {
|
|
10363
10410
|
label: v.name,
|
|
10364
|
-
value: getValue$2(v.
|
|
10411
|
+
value: getValue$2(v.escapedValue, props, searchState, {
|
|
10365
10412
|
ais: props.contextValue,
|
|
10366
10413
|
multiIndexContext: props.indexContextValue
|
|
10367
10414
|
}),
|