@antscorp/antsomi-ui 1.3.5-beta.36 → 1.3.5-beta.38
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
|
|
2
2
|
import { TCategoryItem, TCheckedCategories, TTemplateItem } from '../../../template';
|
|
3
|
+
import { TGetTemplateCategoryList, TGetObjectTEmplateList } from '@antscorp/antsomi-ui/es/queries/TemplateListing';
|
|
3
4
|
import { TTemplateListingConfig } from '@antscorp/antsomi-ui/es/types/templateListing';
|
|
4
5
|
import { TemplateCategory } from '@antscorp/antsomi-ui/es/models/TemplateCategory';
|
|
5
6
|
interface TemplateListingOptions {
|
|
@@ -8,6 +9,10 @@ interface TemplateListingOptions {
|
|
|
8
9
|
filter?: any;
|
|
9
10
|
};
|
|
10
11
|
checkedCategoriesDefault?: TCheckedCategories;
|
|
12
|
+
queriesOptions?: {
|
|
13
|
+
categoryList?: TGetTemplateCategoryList['options'];
|
|
14
|
+
templateList?: TGetObjectTEmplateList['options'];
|
|
15
|
+
};
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* Custom React Hook for managing state and data fetching logic related to a template listing.
|
|
@@ -29,8 +29,9 @@ import { CATEGORY_SPLIT_KEY } from '@antscorp/antsomi-ui/es/constants';
|
|
|
29
29
|
* @property {Function} onLoadMore - A function to load more template data when scrolling in the template listing.
|
|
30
30
|
*/
|
|
31
31
|
export const useTemplateSave = (options) => {
|
|
32
|
-
const { service, config } = options;
|
|
32
|
+
const { service, config, queriesOptions } = options;
|
|
33
33
|
const { objectType, categoryCodes, publicLevel, limitListPerPage = 10, getListType, filter, } = config;
|
|
34
|
+
const { categoryList: categoryListOptions, templateList: templateListOptions } = queriesOptions || {};
|
|
34
35
|
// const { message } = App.useApp();
|
|
35
36
|
// State
|
|
36
37
|
const [state, setState] = useState({
|
|
@@ -47,6 +48,7 @@ export const useTemplateSave = (options) => {
|
|
|
47
48
|
publicLevel,
|
|
48
49
|
},
|
|
49
50
|
},
|
|
51
|
+
options: categoryListOptions,
|
|
50
52
|
});
|
|
51
53
|
// Queries
|
|
52
54
|
const { data: infiniteObjectTemplate, isFetchingNextPage, isFetching, hasNextPage, fetchNextPage, refetch: refetchTemplateList, } = useGetObjectTemplateList({
|
|
@@ -54,6 +56,7 @@ export const useTemplateSave = (options) => {
|
|
|
54
56
|
auth: service,
|
|
55
57
|
params: Object.assign({ get_list_type: getListType, object_type: objectType, public_level: publicLevel, limit: limitListPerPage }, (filter ? { filter } : {})),
|
|
56
58
|
},
|
|
59
|
+
options: templateListOptions,
|
|
57
60
|
});
|
|
58
61
|
// Variables
|
|
59
62
|
const isLoadingTemplateList = isFetching || isFetchingNextPage;
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED