@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, _b;
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
- (_a = parentCategory.children
161
- .filter(item => selectedChildren === null || selectedChildren === void 0 ? void 0 : selectedChildren.includes(item.key))) === null || _a === void 0 ? void 0 :
162
- _a.map(selectedItem => (React.createElement(Flex, { key: selectedItem.key, className: "selected-category", justify: "space-between", align: "center" },
163
- React.createElement(Tooltip, { title: selectedItem.label },
164
- React.createElement(Text, { ellipsis: true, style: { textOverflow: 'ellipsis' } }, selectedItem.label)),
165
- ' ',
166
- React.createElement("span", { className: "remove-btn", onClick: () => handleRemoveCategory({
167
- parent: parentCategory.key,
168
- item: selectedItem.key,
169
- }) }, "\u00D7")))),
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 ", (_b = parentCategory.label) === null || _b === void 0 ? void 0 :
180
- _b.toLowerCase())) : (parentCategory.label)))));
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, useGetObjectTemplateDetail, } from '@antscorp/antsomi-ui/es/queries/TemplateListing';
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 { data: templateDetail, isLoading: isLoadingTemplateDetail = false } = useGetObjectTemplateDetail({
100
- args: {
101
- params: {
102
- template_id: selectedTemplateId || '',
103
- object_type: objectType,
104
- public_level: publicLevel,
105
- },
106
- auth: serviceAuth,
107
- },
108
- options: {
109
- enabled: !!selectedTemplateId,
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: isLoadingTemplateDetail && !!selectedTemplateId,
229
+ isLoadingTemplateDetail: false,
220
230
  // Functions
221
231
  refetchCategoryList,
222
232
  refetchTemplateList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.73",
3
+ "version": "1.3.5-beta.74",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",