@antscorp/antsomi-ui 1.3.5-beta.73 → 1.3.5-beta.74
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.
|
@@ -147,7 +147,7 @@ export const TemplateSaveAs = props => {
|
|
|
147
147
|
React.createElement("span", null, "*")),
|
|
148
148
|
React.createElement(ImageSlider, { thumbnails: thumbnails, isLoading: isLoadingThumbnail, skeleton: skeleton, previewNavigation: previewNavigation, slidesPerView: slidesPerView, defaultThumbnail: defaultThumbnail, onSelectDefault: value => handleChangeValue({ defaultThumbnail: value }), hideThumbnailsList: hideThumbnailsList, hideDefaultButton: hideDefaultButton, imageHeight: imageHeight, imageWidth: imageWidth })), categories === null || categories === void 0 ? void 0 :
|
|
149
149
|
categories.map(parentCategory => {
|
|
150
|
-
var _a
|
|
150
|
+
var _a;
|
|
151
151
|
const selectedChildren = categoriesValue[parentCategory.key];
|
|
152
152
|
const remainChildren = parentCategory.children.filter(item => !(selectedChildren === null || selectedChildren === void 0 ? void 0 : selectedChildren.includes(item.key)));
|
|
153
153
|
// NOTE: filter to remove device and template categories
|
|
@@ -157,16 +157,19 @@ export const TemplateSaveAs = props => {
|
|
|
157
157
|
React.createElement(Text, { className: "field-title" }, parentCategory.label),
|
|
158
158
|
React.createElement(Flex, { wrap: "wrap", gap: 10, className: "category-container" },
|
|
159
159
|
/* selectedCategory */
|
|
160
|
-
|
|
161
|
-
.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
160
|
+
selectedChildren === null || selectedChildren === void 0 ? void 0 :
|
|
161
|
+
selectedChildren.map(selectedKey => {
|
|
162
|
+
var _a;
|
|
163
|
+
const selectedLabel = (_a = parentCategory.children.find(item => item.key === selectedKey)) === null || _a === void 0 ? void 0 : _a.label;
|
|
164
|
+
return (React.createElement(Flex, { key: selectedKey, className: "selected-category", justify: "space-between", align: "center" },
|
|
165
|
+
React.createElement(Tooltip, { title: selectedLabel },
|
|
166
|
+
React.createElement(Text, { ellipsis: true, style: { textOverflow: 'ellipsis' } }, selectedLabel)),
|
|
167
|
+
' ',
|
|
168
|
+
React.createElement("span", { className: "remove-btn", onClick: () => handleRemoveCategory({
|
|
169
|
+
parent: parentCategory.key,
|
|
170
|
+
item: selectedKey,
|
|
171
|
+
}) }, "\u00D7")));
|
|
172
|
+
}),
|
|
170
173
|
React.createElement(Dropdown, { menu: {
|
|
171
174
|
items: remainChildren,
|
|
172
175
|
onClick: ({ key }) => {
|
|
@@ -176,8 +179,8 @@ export const TemplateSaveAs = props => {
|
|
|
176
179
|
});
|
|
177
180
|
},
|
|
178
181
|
}, getPopupContainer: triggerNode => triggerNode.parentElement, trigger: ['click'] }, typeof parentCategory.label === 'string' ? (React.createElement(Button, null,
|
|
179
|
-
"+ Add ", (
|
|
180
|
-
|
|
182
|
+
"+ Add ", (_a = parentCategory.label) === null || _a === void 0 ? void 0 :
|
|
183
|
+
_a.toLowerCase())) : (parentCategory.label)))));
|
|
181
184
|
})),
|
|
182
185
|
isShowShareAccess ? (React.createElement("div", { className: "share-access-container" },
|
|
183
186
|
React.createElement(ShareAccess, Object.assign({ accessInfo: accessInfo, onChange: value => handleChangeValue({ accessInfo: value }) }, shareAccessProps)))) : null))));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { App } from 'antd';
|
|
4
4
|
import { isEmpty } from 'lodash';
|
|
5
|
-
import { useGetTemplateCategoryList, useGetObjectTemplateList, useBulkUpdateTemplate,
|
|
5
|
+
import { useGetTemplateCategoryList, useGetObjectTemplateList, useBulkUpdateTemplate, } from '@antscorp/antsomi-ui/es/queries/TemplateListing';
|
|
6
6
|
// Locales
|
|
7
7
|
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
8
8
|
// Hooks
|
|
@@ -96,22 +96,32 @@ export const useTemplateListing = (options) => {
|
|
|
96
96
|
},
|
|
97
97
|
},
|
|
98
98
|
});
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
99
|
+
// const {
|
|
100
|
+
// data: templateDetail,
|
|
101
|
+
// isLoading: isLoadingTemplateDetail = false,
|
|
102
|
+
// refetch: refetchTemplateDetail,
|
|
103
|
+
// } = useGetObjectTemplateDetail({
|
|
104
|
+
// args: {
|
|
105
|
+
// params: {
|
|
106
|
+
// template_id: selectedTemplateId || '',
|
|
107
|
+
// object_type: objectType,
|
|
108
|
+
// public_level: publicLevel,
|
|
109
|
+
// },
|
|
110
|
+
// auth: serviceAuth,
|
|
111
|
+
// },
|
|
112
|
+
// options: {
|
|
113
|
+
// enabled: !!selectedTemplateId,
|
|
114
|
+
// },
|
|
115
|
+
// });
|
|
112
116
|
// Variables
|
|
113
117
|
const isLoadingTemplateList = isFetching || isFetchingNextPage;
|
|
114
118
|
// Memo
|
|
119
|
+
const templateDetail = useDeepCompareMemo(() => {
|
|
120
|
+
if (infiniteObjectTemplate && selectedTemplateId) {
|
|
121
|
+
return infiniteObjectTemplate.pages[0].entities.find(template => template.id === selectedTemplateId);
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}, [infiniteObjectTemplate, selectedTemplateId]);
|
|
115
125
|
const categoryItems = useDeepCompareMemo(() => {
|
|
116
126
|
const recursiveCategory = (categories = [], parentCategoryCode = '') => categories.map(category => {
|
|
117
127
|
const { categoryCode, categoryId, categoryName, children, total } = category;
|
|
@@ -216,7 +226,7 @@ export const useTemplateListing = (options) => {
|
|
|
216
226
|
previewTemplateCategories,
|
|
217
227
|
isLoadingCategoryList,
|
|
218
228
|
isLoadingTemplateList,
|
|
219
|
-
isLoadingTemplateDetail:
|
|
229
|
+
isLoadingTemplateDetail: false,
|
|
220
230
|
// Functions
|
|
221
231
|
refetchCategoryList,
|
|
222
232
|
refetchTemplateList,
|