@sledge-app/react-instant-search 1.0.62 → 1.0.64
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/components/ProductFilterWidget/ProductFilterWidget.d.ts +1 -0
- package/dist/components/ProductFilterWidget/ProductFilterWidget.d.ts.map +1 -1
- package/dist/components/ProductFilterWidget/ProductFilterWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/SearchResultWidget.d.ts +1 -0
- package/dist/components/SearchResultWidget/SearchResultWidget.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/SearchResultWidgetInitSelector.d.ts.map +1 -1
- package/dist/sledge-react-instant-search.cjs +1 -1
- package/dist/sledge-react-instant-search.cjs.map +1 -1
- package/dist/sledge-react-instant-search.js +13 -6
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/package.json +1 -1
|
@@ -67,6 +67,7 @@ const DATASET_ATTRIBUTE_KEY = {
|
|
|
67
67
|
QUERY_KEYWORD: "data-query-keyword",
|
|
68
68
|
QUERY_SORT_BY: "data-query-sort-by",
|
|
69
69
|
QUERY_PAGE: "data-query-page",
|
|
70
|
+
QUERY_LIMIT: "data-query-limit",
|
|
70
71
|
URL_SEARCH_RESULT: "data-url-search-result",
|
|
71
72
|
RENDER_SUGGESTION_KEYWORD_LIST: "data-render-suggestion-keyword-list",
|
|
72
73
|
RENDER_OTHER_INDEX_LIST: "data-render-other-index-list",
|
|
@@ -154,7 +155,8 @@ const DEFAULT_QUERY_PARAM = {
|
|
|
154
155
|
KEYWORD: "q",
|
|
155
156
|
SHARE_ID: "share",
|
|
156
157
|
SORT_BY: "sort_by",
|
|
157
|
-
PAGE: "page"
|
|
158
|
+
PAGE: "page",
|
|
159
|
+
LIMIT: "limit"
|
|
158
160
|
};
|
|
159
161
|
const DEFAULT_QUERY_PRODUCT_MEILISEARCH = [`'status' = 'active'`, `published_at IS NOT NULL`];
|
|
160
162
|
const DEFAULT_FACET_LIMIT = 50;
|
|
@@ -3555,7 +3557,7 @@ const FlyoutSidebar = ({ title, content, open, setOpen }) => {
|
|
|
3555
3557
|
}
|
|
3556
3558
|
);
|
|
3557
3559
|
};
|
|
3558
|
-
const VirtualizedList = ({ scrollElement,
|
|
3560
|
+
const VirtualizedList = ({ scrollElement, rowCount, rowHeight, rowRenderer: rowRenderer2, minHeight = 72 }) => {
|
|
3559
3561
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3560
3562
|
WindowScroller,
|
|
3561
3563
|
{
|
|
@@ -3571,9 +3573,6 @@ const VirtualizedList = ({ scrollElement, noRowsRenderer, rowCount, rowHeight, r
|
|
|
3571
3573
|
onScroll: onChildScroll,
|
|
3572
3574
|
scrollTop,
|
|
3573
3575
|
width,
|
|
3574
|
-
...noRowsRenderer && {
|
|
3575
|
-
noRowsRenderer
|
|
3576
|
-
},
|
|
3577
3576
|
rowCount,
|
|
3578
3577
|
rowHeight,
|
|
3579
3578
|
rowRenderer: rowRenderer2
|
|
@@ -5271,12 +5270,13 @@ const ResultProduct = (props) => {
|
|
|
5271
5270
|
} = props || {};
|
|
5272
5271
|
const querySortBy = (query == null ? void 0 : query.sortBy) ? query.sortBy : DEFAULT_QUERY_PARAM.SORT_BY;
|
|
5273
5272
|
const queryPage = (query == null ? void 0 : query.page) ? query.page : DEFAULT_QUERY_PARAM.PAGE;
|
|
5273
|
+
const queryLimit = (query == null ? void 0 : query.limit) ? query.limit : DEFAULT_QUERY_PARAM.LIMIT;
|
|
5274
5274
|
const { collectionId, collectionName } = params || {};
|
|
5275
5275
|
const isLoadMore = ["load_more", "infinite_scroll"].includes((_a = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _a.pagination_type);
|
|
5276
5276
|
const [isLoadingProduct, setIsLoadingProduct] = React__default.useState(!propsData);
|
|
5277
5277
|
const [isLoading, setIsLoading] = React__default.useState(!propsData);
|
|
5278
5278
|
const [clickedSortId, setClickedSortId] = React__default.useState(defaultSort || "");
|
|
5279
|
-
const [clickedLimitId, setClickedLimitId] = React__default.useState(Number(defaultLimit || DEFAULT_LIMIT_VALUE[0]));
|
|
5279
|
+
const [clickedLimitId, setClickedLimitId] = React__default.useState(Number((searchParams == null ? void 0 : searchParams.get(queryLimit)) || defaultLimit || DEFAULT_LIMIT_VALUE[0]));
|
|
5280
5280
|
const [clickedOpenFilters, setClickedOpenFilters] = React__default.useState((allowedFilter == null ? void 0 : allowedFilter.length) ? allowedFilter.map(({ value }) => value) : []);
|
|
5281
5281
|
const [triggerClickedFacets, setTriggerClickedFacets] = React__default.useState(false);
|
|
5282
5282
|
const [searchResult, setSearchResult] = React__default.useState(((_d = (_c = (_b = propsData == null ? void 0 : propsData.result) == null ? void 0 : _b.results) == null ? void 0 : _c[0]) == null ? void 0 : _d.hits) || []);
|
|
@@ -5403,8 +5403,11 @@ const ResultProduct = (props) => {
|
|
|
5403
5403
|
window.history.pushState(null, "", `${document.location.pathname}?${searchParams2.toString()}`);
|
|
5404
5404
|
};
|
|
5405
5405
|
const handleChangeLimit = (value) => {
|
|
5406
|
+
const searchParams2 = new URLSearchParams(document.location.search);
|
|
5407
|
+
searchParams2.set(queryLimit, String(value));
|
|
5406
5408
|
setClickedLimitId(Number(value));
|
|
5407
5409
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_KEY.LIMIT_PRODUCT, value);
|
|
5410
|
+
window.history.pushState(null, "", `${document.location.pathname}?${searchParams2.toString()}`);
|
|
5408
5411
|
};
|
|
5409
5412
|
const handleOpenFilterVertical = (id) => {
|
|
5410
5413
|
setClickedOpenFilterId == null ? void 0 : setClickedOpenFilterId(id === clickedOpenFilterId ? "" : id);
|
|
@@ -5500,6 +5503,9 @@ const ResultProduct = (props) => {
|
|
|
5500
5503
|
if (isReplaceData) {
|
|
5501
5504
|
setCurrentPage(1);
|
|
5502
5505
|
setSearchResult([]);
|
|
5506
|
+
const searchParams2 = new URLSearchParams(document.location.search);
|
|
5507
|
+
searchParams2.set(queryPage, String(1));
|
|
5508
|
+
window.history.pushState(null, "", `${document.location.pathname}?${searchParams2.toString()}`);
|
|
5503
5509
|
}
|
|
5504
5510
|
setIsLoading(isReplaceData ? true : !isLoadMore2);
|
|
5505
5511
|
let response;
|
|
@@ -5535,6 +5541,7 @@ const ResultProduct = (props) => {
|
|
|
5535
5541
|
const handlePageChange = (page) => {
|
|
5536
5542
|
const searchParams2 = new URLSearchParams(document.location.search);
|
|
5537
5543
|
searchParams2.set(queryPage, String(page));
|
|
5544
|
+
searchParams2.set(queryLimit, String(clickedLimitId));
|
|
5538
5545
|
setCurrentPage(page);
|
|
5539
5546
|
setIsReplaceWidgetList == null ? void 0 : setIsReplaceWidgetList(true);
|
|
5540
5547
|
setTimeout(() => {
|