@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.
@@ -8,6 +8,7 @@ interface TemplateListingOptions {
8
8
  serviceAuth: TServiceAuth;
9
9
  config: TTemplateListingConfig;
10
10
  checkedCategoriesDefault?: TCheckedCategories;
11
+ templateListingSelector?: string;
11
12
  }
12
13
  /**
13
14
  * Represents the state of a system with generic data types.
@@ -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 })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.146",
3
+ "version": "1.3.5-beta.147",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",