instantsearch.js 4.54.0 → 4.54.1
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/Pagination/Pagination.js +35 -17
- package/cjs/components/Template/Template.js +6 -3
- package/cjs/helpers/highlight.js +5 -0
- package/cjs/helpers/reverseHighlight.js +5 -0
- package/cjs/helpers/reverseSnippet.js +5 -0
- package/cjs/helpers/snippet.js +5 -0
- package/cjs/lib/server.js +60 -0
- package/cjs/lib/utils/index.js +11 -0
- package/cjs/lib/utils/walkIndex.js +18 -0
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/pagination/pagination.js +51 -39
- package/cjs/widgets/panel/panel.js +0 -2
- package/dist/instantsearch.development.d.ts +27 -4
- package/dist/instantsearch.development.js +112 -63
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +27 -4
- package/dist/instantsearch.production.min.d.ts +27 -4
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Pagination/Pagination.js +34 -17
- package/es/components/Panel/Panel.d.ts +1 -1
- package/es/components/Template/Template.js +6 -3
- package/es/helpers/highlight.d.ts +3 -0
- package/es/helpers/highlight.js +5 -0
- package/es/helpers/reverseHighlight.d.ts +3 -0
- package/es/helpers/reverseHighlight.js +5 -0
- package/es/helpers/reverseSnippet.d.ts +3 -0
- package/es/helpers/reverseSnippet.js +5 -0
- package/es/helpers/snippet.d.ts +3 -0
- package/es/helpers/snippet.js +5 -0
- package/es/lib/server.d.ts +10 -0
- package/es/lib/server.js +53 -0
- package/es/lib/utils/index.d.ts +1 -0
- package/es/lib/utils/index.js +1 -0
- package/es/lib/utils/walkIndex.d.ts +5 -0
- package/es/lib/utils/walkIndex.js +12 -0
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/widgets/pagination/pagination.d.ts +12 -5
- package/es/widgets/pagination/pagination.js +51 -39
- package/es/widgets/panel/panel.js +0 -2
- package/package.json +5 -5
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _uiComponentsShared = require("@algolia/ui-components-shared");
|
|
8
8
|
var _preact = require("preact");
|
|
9
9
|
var _utils = require("../../lib/utils");
|
|
10
|
+
var _Template = _interopRequireDefault(require("../Template/Template"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
12
|
function Pagination(props) {
|
|
11
13
|
function createClickHandler(pageNumber) {
|
|
12
14
|
return function (event) {
|
|
@@ -27,7 +29,8 @@ function Pagination(props) {
|
|
|
27
29
|
ariaLabel: "First",
|
|
28
30
|
className: props.cssClasses.firstPageItem,
|
|
29
31
|
isDisabled: props.isFirstPage,
|
|
30
|
-
|
|
32
|
+
templates: props.templates,
|
|
33
|
+
templateKey: "first",
|
|
31
34
|
pageNumber: 0,
|
|
32
35
|
createURL: props.createURL,
|
|
33
36
|
cssClasses: props.cssClasses,
|
|
@@ -36,7 +39,8 @@ function Pagination(props) {
|
|
|
36
39
|
ariaLabel: "Previous",
|
|
37
40
|
className: props.cssClasses.previousPageItem,
|
|
38
41
|
isDisabled: props.isFirstPage,
|
|
39
|
-
|
|
42
|
+
templates: props.templates,
|
|
43
|
+
templateKey: "previous",
|
|
40
44
|
pageNumber: props.currentPage - 1,
|
|
41
45
|
createURL: props.createURL,
|
|
42
46
|
cssClasses: props.cssClasses,
|
|
@@ -47,7 +51,8 @@ function Pagination(props) {
|
|
|
47
51
|
ariaLabel: "Page ".concat(pageNumber + 1),
|
|
48
52
|
className: props.cssClasses.pageItem,
|
|
49
53
|
isSelected: pageNumber === props.currentPage,
|
|
50
|
-
|
|
54
|
+
templates: props.templates,
|
|
55
|
+
templateKey: "page",
|
|
51
56
|
pageNumber: pageNumber,
|
|
52
57
|
createURL: props.createURL,
|
|
53
58
|
cssClasses: props.cssClasses,
|
|
@@ -57,7 +62,8 @@ function Pagination(props) {
|
|
|
57
62
|
ariaLabel: "Next",
|
|
58
63
|
className: props.cssClasses.nextPageItem,
|
|
59
64
|
isDisabled: props.isLastPage,
|
|
60
|
-
|
|
65
|
+
templates: props.templates,
|
|
66
|
+
templateKey: "next",
|
|
61
67
|
pageNumber: props.currentPage + 1,
|
|
62
68
|
createURL: props.createURL,
|
|
63
69
|
cssClasses: props.cssClasses,
|
|
@@ -66,7 +72,8 @@ function Pagination(props) {
|
|
|
66
72
|
ariaLabel: "Last",
|
|
67
73
|
className: props.cssClasses.lastPageItem,
|
|
68
74
|
isDisabled: props.isLastPage,
|
|
69
|
-
|
|
75
|
+
templates: props.templates,
|
|
76
|
+
templateKey: "last",
|
|
70
77
|
pageNumber: props.nbPages - 1,
|
|
71
78
|
createURL: props.createURL,
|
|
72
79
|
cssClasses: props.cssClasses,
|
|
@@ -74,7 +81,8 @@ function Pagination(props) {
|
|
|
74
81
|
})));
|
|
75
82
|
}
|
|
76
83
|
function PaginationLink(_ref) {
|
|
77
|
-
var
|
|
84
|
+
var templates = _ref.templates,
|
|
85
|
+
templateKey = _ref.templateKey,
|
|
78
86
|
ariaLabel = _ref.ariaLabel,
|
|
79
87
|
pageNumber = _ref.pageNumber,
|
|
80
88
|
className = _ref.className,
|
|
@@ -87,18 +95,28 @@ function PaginationLink(_ref) {
|
|
|
87
95
|
createClickHandler = _ref.createClickHandler;
|
|
88
96
|
return (0, _preact.h)("li", {
|
|
89
97
|
className: (0, _uiComponentsShared.cx)(cssClasses.item, className, isDisabled && cssClasses.disabledItem, isSelected && cssClasses.selectedItem)
|
|
90
|
-
}, isDisabled ? (0, _preact.h)(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
}, isDisabled ? (0, _preact.h)(_Template.default, {
|
|
99
|
+
rootTagName: "span",
|
|
100
|
+
rootProps: {
|
|
101
|
+
className: cssClasses.link
|
|
102
|
+
},
|
|
103
|
+
templateKey: templateKey,
|
|
104
|
+
templates: templates,
|
|
105
|
+
data: {
|
|
106
|
+
page: pageNumber + 1
|
|
94
107
|
}
|
|
95
|
-
}) : (0, _preact.h)(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
}) : (0, _preact.h)(_Template.default, {
|
|
109
|
+
rootTagName: "a",
|
|
110
|
+
rootProps: {
|
|
111
|
+
className: cssClasses.link,
|
|
112
|
+
'aria-label': ariaLabel,
|
|
113
|
+
href: createURL(pageNumber),
|
|
114
|
+
onClick: createClickHandler(pageNumber)
|
|
115
|
+
},
|
|
116
|
+
templateKey: templateKey,
|
|
117
|
+
templates: templates,
|
|
118
|
+
data: {
|
|
119
|
+
page: pageNumber + 1
|
|
102
120
|
}
|
|
103
121
|
}));
|
|
104
122
|
}
|
|
@@ -46,9 +46,12 @@ var Template = /*#__PURE__*/function (_Component) {
|
|
|
46
46
|
key: "render",
|
|
47
47
|
value: function render() {
|
|
48
48
|
var _this = this;
|
|
49
|
-
process.env.NODE_ENV === 'development'
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
if (process.env.NODE_ENV === 'development') {
|
|
50
|
+
var nonFunctionTemplates = Object.keys(this.props.templates).filter(function (key) {
|
|
51
|
+
return typeof _this.props.templates[key] !== 'function';
|
|
52
|
+
});
|
|
53
|
+
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(nonFunctionTemplates.length === 0, "Hogan.js and string-based templates are deprecated and will not be supported in InstantSearch.js 5.x.\n\nYou can replace them with function-form templates and use either the provided `html` function or JSX templates.\n\nString-based templates: ".concat(nonFunctionTemplates.join(', '), ".\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/#upgrade-templates")) : void 0;
|
|
54
|
+
}
|
|
52
55
|
var RootTagName = this.props.rootTagName;
|
|
53
56
|
var useCustomCompileOptions = this.props.useCustomCompileOptions[this.props.templateKey];
|
|
54
57
|
var compileOptions = useCustomCompileOptions ? this.props.templatesConfig.compileOptions : {};
|
package/cjs/helpers/highlight.js
CHANGED
|
@@ -7,6 +7,10 @@ exports.default = highlight;
|
|
|
7
7
|
var _suit = require("../lib/suit");
|
|
8
8
|
var _utils = require("../lib/utils");
|
|
9
9
|
var suit = (0, _suit.component)('Highlight');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use html tagged templates and the Highlight component instead
|
|
13
|
+
*/
|
|
10
14
|
function highlight(_ref) {
|
|
11
15
|
var attribute = _ref.attribute,
|
|
12
16
|
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
@@ -14,6 +18,7 @@ function highlight(_ref) {
|
|
|
14
18
|
hit = _ref.hit,
|
|
15
19
|
_ref$cssClasses = _ref.cssClasses,
|
|
16
20
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
21
|
+
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "`instantsearch.highlight` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `Highlight` component.\n\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates") : void 0;
|
|
17
22
|
var highlightAttributeResult = (0, _utils.getPropertyByPath)(hit._highlightResult, attribute);
|
|
18
23
|
|
|
19
24
|
// @MAJOR fallback to attribute value if highlight is not found
|
|
@@ -7,6 +7,10 @@ exports.default = reverseHighlight;
|
|
|
7
7
|
var _suit = require("../lib/suit");
|
|
8
8
|
var _utils = require("../lib/utils");
|
|
9
9
|
var suit = (0, _suit.component)('ReverseHighlight');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use html tagged templates and the ReverseHighlight component instead
|
|
13
|
+
*/
|
|
10
14
|
function reverseHighlight(_ref) {
|
|
11
15
|
var attribute = _ref.attribute,
|
|
12
16
|
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
@@ -14,6 +18,7 @@ function reverseHighlight(_ref) {
|
|
|
14
18
|
hit = _ref.hit,
|
|
15
19
|
_ref$cssClasses = _ref.cssClasses,
|
|
16
20
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
21
|
+
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "`instantsearch.reverseHighlight` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `ReverseHighlight` component.\n\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates") : void 0;
|
|
17
22
|
var highlightAttributeResult = (0, _utils.getPropertyByPath)(hit._highlightResult, attribute);
|
|
18
23
|
|
|
19
24
|
// @MAJOR fallback to attribute value if highlight is not found
|
|
@@ -7,6 +7,10 @@ exports.default = reverseSnippet;
|
|
|
7
7
|
var _suit = require("../lib/suit");
|
|
8
8
|
var _utils = require("../lib/utils");
|
|
9
9
|
var suit = (0, _suit.component)('ReverseSnippet');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use html tagged templates and the ReverseSnippet component instead
|
|
13
|
+
*/
|
|
10
14
|
function reverseSnippet(_ref) {
|
|
11
15
|
var attribute = _ref.attribute,
|
|
12
16
|
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
@@ -14,6 +18,7 @@ function reverseSnippet(_ref) {
|
|
|
14
18
|
hit = _ref.hit,
|
|
15
19
|
_ref$cssClasses = _ref.cssClasses,
|
|
16
20
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
21
|
+
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "`instantsearch.reverseSnippet` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `ReverseSnippet` component.\n\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates") : void 0;
|
|
17
22
|
var snippetAttributeResult = (0, _utils.getPropertyByPath)(hit._snippetResult, attribute);
|
|
18
23
|
|
|
19
24
|
// @MAJOR fallback to attribute value if snippet is not found
|
package/cjs/helpers/snippet.js
CHANGED
|
@@ -7,6 +7,10 @@ exports.default = snippet;
|
|
|
7
7
|
var _suit = require("../lib/suit");
|
|
8
8
|
var _utils = require("../lib/utils");
|
|
9
9
|
var suit = (0, _suit.component)('Snippet');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use html tagged templates and the Snippet component instead
|
|
13
|
+
*/
|
|
10
14
|
function snippet(_ref) {
|
|
11
15
|
var attribute = _ref.attribute,
|
|
12
16
|
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
@@ -14,6 +18,7 @@ function snippet(_ref) {
|
|
|
14
18
|
hit = _ref.hit,
|
|
15
19
|
_ref$cssClasses = _ref.cssClasses,
|
|
16
20
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
21
|
+
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "`instantsearch.snippet` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `Snippet` component.\n\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates") : void 0;
|
|
17
22
|
var snippetAttributeResult = (0, _utils.getPropertyByPath)(hit._snippetResult, attribute);
|
|
18
23
|
|
|
19
24
|
// @MAJOR fallback to attribute value if snippet is not found
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getInitialResults = getInitialResults;
|
|
7
|
+
exports.waitForResults = waitForResults;
|
|
8
|
+
var _utils = require("./utils");
|
|
9
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
+
/**
|
|
16
|
+
* Waits for the results from the search instance to coordinate the next steps
|
|
17
|
+
* in `getServerState()`.
|
|
18
|
+
*/
|
|
19
|
+
function waitForResults(search) {
|
|
20
|
+
var helper = search.mainHelper;
|
|
21
|
+
helper.searchOnlyWithDerivedHelpers();
|
|
22
|
+
return new Promise(function (resolve, reject) {
|
|
23
|
+
// All derived helpers resolve in the same tick so we're safe only relying
|
|
24
|
+
// on the first one.
|
|
25
|
+
helper.derivedHelpers[0].on('result', function () {
|
|
26
|
+
resolve();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// However, we listen to errors that can happen on any derived helper because
|
|
30
|
+
// any error is critical.
|
|
31
|
+
helper.on('error', function (error) {
|
|
32
|
+
reject(error);
|
|
33
|
+
});
|
|
34
|
+
search.on('error', function (error) {
|
|
35
|
+
reject(error);
|
|
36
|
+
});
|
|
37
|
+
helper.derivedHelpers.forEach(function (derivedHelper) {
|
|
38
|
+
return derivedHelper.on('error', function (error) {
|
|
39
|
+
reject(error);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Walks the InstantSearch root index to construct the initial results.
|
|
47
|
+
*/
|
|
48
|
+
function getInitialResults(rootIndex) {
|
|
49
|
+
var initialResults = {};
|
|
50
|
+
(0, _utils.walkIndex)(rootIndex, function (widget) {
|
|
51
|
+
var searchResults = widget.getResults();
|
|
52
|
+
initialResults[widget.getIndexId()] = {
|
|
53
|
+
// We convert the Helper state to a plain object to pass parsable data
|
|
54
|
+
// structures from server to client.
|
|
55
|
+
state: _objectSpread({}, searchResults._state),
|
|
56
|
+
results: searchResults._rawResults
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
return initialResults;
|
|
60
|
+
}
|
package/cjs/lib/utils/index.js
CHANGED
|
@@ -388,6 +388,17 @@ Object.keys(_isSpecialClick).forEach(function (key) {
|
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
390
|
});
|
|
391
|
+
var _walkIndex = require("./walkIndex");
|
|
392
|
+
Object.keys(_walkIndex).forEach(function (key) {
|
|
393
|
+
if (key === "default" || key === "__esModule") return;
|
|
394
|
+
if (key in exports && exports[key] === _walkIndex[key]) return;
|
|
395
|
+
Object.defineProperty(exports, key, {
|
|
396
|
+
enumerable: true,
|
|
397
|
+
get: function get() {
|
|
398
|
+
return _walkIndex[key];
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
});
|
|
391
402
|
var _logger = require("./logger");
|
|
392
403
|
Object.keys(_logger).forEach(function (key) {
|
|
393
404
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.walkIndex = walkIndex;
|
|
7
|
+
var _isIndexWidget = require("./isIndexWidget");
|
|
8
|
+
/**
|
|
9
|
+
* Recurse over all child indices
|
|
10
|
+
*/
|
|
11
|
+
function walkIndex(indexWidget, callback) {
|
|
12
|
+
callback(indexWidget);
|
|
13
|
+
indexWidget.getWidgets().forEach(function (widget) {
|
|
14
|
+
if ((0, _isIndexWidget.isIndexWidget)(widget)) {
|
|
15
|
+
walkIndex(widget, callback);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
package/cjs/lib/version.js
CHANGED
|
@@ -22,28 +22,40 @@ var withUsage = (0, _utils.createDocumentationMessageGenerator)({
|
|
|
22
22
|
name: 'pagination'
|
|
23
23
|
});
|
|
24
24
|
var defaultTemplates = {
|
|
25
|
-
previous:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
previous: function previous() {
|
|
26
|
+
return '‹';
|
|
27
|
+
},
|
|
28
|
+
next: function next() {
|
|
29
|
+
return '›';
|
|
30
|
+
},
|
|
31
|
+
page: function page(_ref) {
|
|
32
|
+
var _page = _ref.page;
|
|
33
|
+
return "".concat(_page);
|
|
34
|
+
},
|
|
35
|
+
first: function first() {
|
|
36
|
+
return '«';
|
|
37
|
+
},
|
|
38
|
+
last: function last() {
|
|
39
|
+
return '»';
|
|
40
|
+
}
|
|
29
41
|
};
|
|
30
|
-
var renderer = function renderer(
|
|
31
|
-
var containerNode =
|
|
32
|
-
cssClasses =
|
|
33
|
-
templates =
|
|
34
|
-
showFirst =
|
|
35
|
-
showLast =
|
|
36
|
-
showPrevious =
|
|
37
|
-
showNext =
|
|
38
|
-
scrollToNode =
|
|
39
|
-
return function (
|
|
40
|
-
var createURL =
|
|
41
|
-
currentRefinement =
|
|
42
|
-
nbPages =
|
|
43
|
-
pages =
|
|
44
|
-
isFirstPage =
|
|
45
|
-
isLastPage =
|
|
46
|
-
refine =
|
|
42
|
+
var renderer = function renderer(_ref2) {
|
|
43
|
+
var containerNode = _ref2.containerNode,
|
|
44
|
+
cssClasses = _ref2.cssClasses,
|
|
45
|
+
templates = _ref2.templates,
|
|
46
|
+
showFirst = _ref2.showFirst,
|
|
47
|
+
showLast = _ref2.showLast,
|
|
48
|
+
showPrevious = _ref2.showPrevious,
|
|
49
|
+
showNext = _ref2.showNext,
|
|
50
|
+
scrollToNode = _ref2.scrollToNode;
|
|
51
|
+
return function (_ref3, isFirstRendering) {
|
|
52
|
+
var createURL = _ref3.createURL,
|
|
53
|
+
currentRefinement = _ref3.currentRefinement,
|
|
54
|
+
nbPages = _ref3.nbPages,
|
|
55
|
+
pages = _ref3.pages,
|
|
56
|
+
isFirstPage = _ref3.isFirstPage,
|
|
57
|
+
isLastPage = _ref3.isLastPage,
|
|
58
|
+
refine = _ref3.refine;
|
|
47
59
|
if (isFirstRendering) return;
|
|
48
60
|
var setCurrentPage = function setCurrentPage(pageNumber) {
|
|
49
61
|
refine(pageNumber);
|
|
@@ -69,24 +81,24 @@ var renderer = function renderer(_ref) {
|
|
|
69
81
|
};
|
|
70
82
|
};
|
|
71
83
|
var pagination = function pagination(widgetParams) {
|
|
72
|
-
var
|
|
73
|
-
container =
|
|
74
|
-
|
|
75
|
-
userTemplates =
|
|
76
|
-
|
|
77
|
-
userCssClasses =
|
|
78
|
-
totalPages =
|
|
79
|
-
padding =
|
|
80
|
-
|
|
81
|
-
showFirst =
|
|
82
|
-
|
|
83
|
-
showLast =
|
|
84
|
-
|
|
85
|
-
showPrevious =
|
|
86
|
-
|
|
87
|
-
showNext =
|
|
88
|
-
|
|
89
|
-
userScrollTo =
|
|
84
|
+
var _ref4 = widgetParams || {},
|
|
85
|
+
container = _ref4.container,
|
|
86
|
+
_ref4$templates = _ref4.templates,
|
|
87
|
+
userTemplates = _ref4$templates === void 0 ? {} : _ref4$templates,
|
|
88
|
+
_ref4$cssClasses = _ref4.cssClasses,
|
|
89
|
+
userCssClasses = _ref4$cssClasses === void 0 ? {} : _ref4$cssClasses,
|
|
90
|
+
totalPages = _ref4.totalPages,
|
|
91
|
+
padding = _ref4.padding,
|
|
92
|
+
_ref4$showFirst = _ref4.showFirst,
|
|
93
|
+
showFirst = _ref4$showFirst === void 0 ? true : _ref4$showFirst,
|
|
94
|
+
_ref4$showLast = _ref4.showLast,
|
|
95
|
+
showLast = _ref4$showLast === void 0 ? true : _ref4$showLast,
|
|
96
|
+
_ref4$showPrevious = _ref4.showPrevious,
|
|
97
|
+
showPrevious = _ref4$showPrevious === void 0 ? true : _ref4$showPrevious,
|
|
98
|
+
_ref4$showNext = _ref4.showNext,
|
|
99
|
+
showNext = _ref4$showNext === void 0 ? true : _ref4$showNext,
|
|
100
|
+
_ref4$scrollTo = _ref4.scrollTo,
|
|
101
|
+
userScrollTo = _ref4$scrollTo === void 0 ? 'body' : _ref4$scrollTo;
|
|
90
102
|
if (!container) {
|
|
91
103
|
throw new Error(withUsage('The `container` option is required.'));
|
|
92
104
|
}
|
|
@@ -97,8 +97,6 @@ var panel = function panel(panelWidgetParams) {
|
|
|
97
97
|
}
|
|
98
98
|
var containerNode = (0, _utils.getContainerNode)(widgetParams.container);
|
|
99
99
|
var defaultTemplates = {
|
|
100
|
-
header: '',
|
|
101
|
-
footer: '',
|
|
102
100
|
collapseButtonText: function collapseButtonText(_ref4) {
|
|
103
101
|
var isCollapsed = _ref4.collapsed;
|
|
104
102
|
return "<svg\n class=\"".concat(cssClasses.collapseIcon, "\"\n style=\"width: 1em; height: 1em;\"\n viewBox=\"0 0 500 500\"\n >\n <path d=\"").concat(isCollapsed ? 'M100 250l300-150v300z' : 'M250 400l150-300H100z', "\" fill=\"currentColor\" />\n </svg>");
|
|
@@ -1774,6 +1774,9 @@ declare type HierarchicalMenuWidgetParams = {
|
|
|
1774
1774
|
|
|
1775
1775
|
declare function Highlight<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: HighlightProps<THit>): h.JSX.Element;
|
|
1776
1776
|
|
|
1777
|
+
/**
|
|
1778
|
+
* @deprecated use html tagged templates and the Highlight component instead
|
|
1779
|
+
*/
|
|
1777
1780
|
declare function highlight({ attribute, highlightedTagName, hit, cssClasses, }: HighlightOptions): string;
|
|
1778
1781
|
|
|
1779
1782
|
declare type HighlightClassNames = HighlightClassNames_2;
|
|
@@ -2475,9 +2478,13 @@ declare type InstantSearchModule = {
|
|
|
2475
2478
|
routers: typeof routers;
|
|
2476
2479
|
stateMappings: typeof stateMappings;
|
|
2477
2480
|
createInfiniteHitsSessionStorageCache: typeof createInfiniteHitsSessionStorageCache;
|
|
2481
|
+
/** @deprecated use html tagged templates and the Highlight component instead */
|
|
2478
2482
|
highlight: typeof helpers.highlight;
|
|
2483
|
+
/** @deprecated use html tagged templates and the ReverseHighlight component instead */
|
|
2479
2484
|
reverseHighlight: typeof helpers.reverseHighlight;
|
|
2485
|
+
/** @deprecated use html tagged templates and the Snippet component instead */
|
|
2480
2486
|
snippet: typeof helpers.snippet;
|
|
2487
|
+
/** @deprecated use html tagged templates and the ReverseSnippet component instead */
|
|
2481
2488
|
reverseSnippet: typeof helpers.reverseSnippet;
|
|
2482
2489
|
/**
|
|
2483
2490
|
* @deprecated use createInsightsMiddleware
|
|
@@ -3140,19 +3147,26 @@ declare type PaginationTemplates = Partial<{
|
|
|
3140
3147
|
/**
|
|
3141
3148
|
* Label for the Previous link.
|
|
3142
3149
|
*/
|
|
3143
|
-
previous:
|
|
3150
|
+
previous: Template;
|
|
3144
3151
|
/**
|
|
3145
3152
|
* Label for the Next link.
|
|
3146
3153
|
*/
|
|
3147
|
-
next:
|
|
3154
|
+
next: Template;
|
|
3155
|
+
/**
|
|
3156
|
+
* Label for the link of a certain page
|
|
3157
|
+
* Page is one-based, so `page` will be `1` for the first page.
|
|
3158
|
+
*/
|
|
3159
|
+
page: Template<{
|
|
3160
|
+
page: number;
|
|
3161
|
+
}>;
|
|
3148
3162
|
/**
|
|
3149
3163
|
* Label for the First link.
|
|
3150
3164
|
*/
|
|
3151
|
-
first:
|
|
3165
|
+
first: Template;
|
|
3152
3166
|
/**
|
|
3153
3167
|
* Label for the Last link.
|
|
3154
3168
|
*/
|
|
3155
|
-
last:
|
|
3169
|
+
last: Template;
|
|
3156
3170
|
}>;
|
|
3157
3171
|
|
|
3158
3172
|
declare type PaginationWidget = WidgetFactory<PaginationWidgetDescription & {
|
|
@@ -4459,6 +4473,9 @@ declare type RequiredWidgetType<TWidgetDescription extends WidgetDescription> =
|
|
|
4459
4473
|
|
|
4460
4474
|
declare function ReverseHighlight<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: ReverseHighlightProps<THit>): h.JSX.Element;
|
|
4461
4475
|
|
|
4476
|
+
/**
|
|
4477
|
+
* @deprecated use html tagged templates and the ReverseHighlight component instead
|
|
4478
|
+
*/
|
|
4462
4479
|
declare function reverseHighlight({ attribute, highlightedTagName, hit, cssClasses, }: ReverseHighlightOptions): string;
|
|
4463
4480
|
|
|
4464
4481
|
declare type ReverseHighlightClassNames = HighlightClassNames_2;
|
|
@@ -4484,6 +4501,9 @@ declare type ReverseHighlightProps_2 = Omit<HighlightProps_3, 'classNames'> & {
|
|
|
4484
4501
|
|
|
4485
4502
|
declare function ReverseSnippet<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: ReverseSnippetProps<THit>): h.JSX.Element;
|
|
4486
4503
|
|
|
4504
|
+
/**
|
|
4505
|
+
* @deprecated use html tagged templates and the ReverseSnippet component instead
|
|
4506
|
+
*/
|
|
4487
4507
|
declare function reverseSnippet({ attribute, highlightedTagName, hit, cssClasses, }: ReverseSnippetOptions): string;
|
|
4488
4508
|
|
|
4489
4509
|
declare type ReverseSnippetClassNames = HighlightClassNames_2;
|
|
@@ -4770,6 +4790,9 @@ declare function singleIndexStateMapping<TUiState extends UiState = UiState>(ind
|
|
|
4770
4790
|
|
|
4771
4791
|
declare function Snippet<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: SnippetProps<THit>): h.JSX.Element;
|
|
4772
4792
|
|
|
4793
|
+
/**
|
|
4794
|
+
* @deprecated use html tagged templates and the Snippet component instead
|
|
4795
|
+
*/
|
|
4773
4796
|
declare function snippet({ attribute, highlightedTagName, hit, cssClasses, }: SnippetOptions): string;
|
|
4774
4797
|
|
|
4775
4798
|
declare type SnippetClassNames = HighlightClassNames_2;
|