@antscorp/antsomi-ui 1.3.5-beta.146 → 1.3.5-beta.147
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.
|
@@ -35,7 +35,7 @@ import { getShuffleArray } from '@antscorp/antsomi-ui/es/utils';
|
|
|
35
35
|
* @property {Function} onLoadMore - A function to load more template data when scrolling in the template listing.
|
|
36
36
|
*/
|
|
37
37
|
export const useTemplateListing = (options) => {
|
|
38
|
-
const { serviceAuth, config, checkedCategoriesDefault } = options;
|
|
38
|
+
const { serviceAuth, config, checkedCategoriesDefault, templateListingSelector = '.template-listing', } = options;
|
|
39
39
|
const { objectType, categoryCodes, publicLevel, getListType, channel, limitListPerPage = 10, } = config;
|
|
40
40
|
const { message } = App.useApp();
|
|
41
41
|
// Locales
|
|
@@ -211,6 +211,16 @@ export const useTemplateListing = (options) => {
|
|
|
211
211
|
}, {}) || {} })));
|
|
212
212
|
}
|
|
213
213
|
}, [checkedCategoriesDefault]);
|
|
214
|
+
/**
|
|
215
|
+
* When publicLevel or getListType change
|
|
216
|
+
* Scroll template listing to top
|
|
217
|
+
*/
|
|
218
|
+
useDeepCompareEffect(() => {
|
|
219
|
+
const templateListingEl = document.querySelector(templateListingSelector);
|
|
220
|
+
if (templateListingEl) {
|
|
221
|
+
templateListingEl.scrollTop = 0;
|
|
222
|
+
}
|
|
223
|
+
}, [getListType, publicLevel, objectType]);
|
|
214
224
|
// Handles
|
|
215
225
|
const onChangeCheckedCategories = (checkedCategories) => {
|
|
216
226
|
setState(prev => (Object.assign(Object.assign({}, prev), { checkedCategories })));
|