@antscorp/antsomi-ui 1.3.5-beta.20 → 1.3.5-beta.22
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.
- package/es/components/common/ConfigProvider/ConfigProvider.js +3 -2
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.js +3 -3
- package/es/components/template/TemplateListing/components/CategoryListing/index.js +5 -4
- package/es/components/template/TemplateListing/components/CategoryListing/styled.js +8 -0
- package/es/components/template/TemplateListing/constants/defaultProps.js +1 -1
- package/es/components/template/TemplateListing/hooks/useTemplateListing.js +2 -2
- package/es/components/template/TemplateListing/index.js +2 -2
- package/es/components/template/TemplateListing/styled/index.js +1 -0
- package/es/components/template/TemplateListing/types/CategoryListing.d.ts +1 -1
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ import '@antscorp/antsomi-ui/es/assets/css/main.scss';
|
|
|
29
29
|
import i18next from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
30
30
|
import 'animate.css';
|
|
31
31
|
// Providers
|
|
32
|
-
import { QueryClientProviderAntsomiUI, queryClientAntsomiUI, } from '@antscorp/antsomi-ui/es/queries';
|
|
32
|
+
import { QueryClientProviderAntsomiUI, QueryDevtoolsAntsomiUI, queryClientAntsomiUI, } from '@antscorp/antsomi-ui/es/queries';
|
|
33
33
|
// NOTE: HOT fix DatePicker Advanced
|
|
34
34
|
dayjs.extend(weekday);
|
|
35
35
|
dayjs.extend(localeData);
|
|
@@ -48,7 +48,8 @@ const ConfigProvider = props => {
|
|
|
48
48
|
React.createElement(App, null,
|
|
49
49
|
React.createElement(QueryClientProviderAntsomiUI, { client: queryClientAntsomiUI },
|
|
50
50
|
React.createElement(GlobalStyle, null),
|
|
51
|
-
React.createElement(StyleProvider, { hashPriority: "high" }, children)
|
|
51
|
+
React.createElement(StyleProvider, { hashPriority: "high" }, children),
|
|
52
|
+
React.createElement(QueryDevtoolsAntsomiUI, null)))));
|
|
52
53
|
};
|
|
53
54
|
ConfigProvider.defaultProps = {
|
|
54
55
|
theme: THEME,
|
|
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
import React, { memo } from 'react';
|
|
14
14
|
// Components
|
|
15
15
|
import { ThumbnailCard } from '../../../../molecules';
|
|
16
|
-
import { Flex } from '../../../../atoms';
|
|
16
|
+
import { Empty, Flex } from '../../../../atoms';
|
|
17
17
|
// Styled
|
|
18
18
|
import { SimilarTemplateWrapper } from './styled';
|
|
19
19
|
// Constants
|
|
@@ -21,9 +21,9 @@ import { SIMILAR_CARD_HEIGHT_DEFAULT, SIMILAR_CARD_WIDTH_DEFAULT } from '../../c
|
|
|
21
21
|
const MAX_QUANTITY_TEMPLATES = 4;
|
|
22
22
|
export const SimilarTemplate = memo(props => {
|
|
23
23
|
var _a;
|
|
24
|
-
const { show = true, similarTemplates, similarCardProps } = props;
|
|
24
|
+
const { show = true, similarTemplates = [], similarCardProps } = props;
|
|
25
25
|
const _b = similarCardProps || {}, { width = SIMILAR_CARD_WIDTH_DEFAULT, height = SIMILAR_CARD_HEIGHT_DEFAULT } = _b, restOfSimilarCardProps = __rest(_b, ["width", "height"]);
|
|
26
26
|
return show ? (React.createElement(SimilarTemplateWrapper, { gap: 15, vertical: true },
|
|
27
27
|
React.createElement("div", { className: "title" }, "Similar templates"),
|
|
28
|
-
React.createElement(Flex, { gap: 30 }, (_a = similarTemplates === null || similarTemplates === void 0 ? void 0 : similarTemplates.slice(0, MAX_QUANTITY_TEMPLATES)) === null || _a === void 0 ? void 0 : _a.map(({ id, name, thumbnail }) => (React.createElement(ThumbnailCard, Object.assign({ key: id, id: id, name: name, width: width, height: height, thumbnail: thumbnail, actionAvailable: false }, restOfSimilarCardProps))))))) : null;
|
|
28
|
+
React.createElement(Flex, { gap: 30 }, ((_a = similarTemplates === null || similarTemplates === void 0 ? void 0 : similarTemplates.slice(0, MAX_QUANTITY_TEMPLATES)) === null || _a === void 0 ? void 0 : _a.map(({ id, name, thumbnail }) => (React.createElement(ThumbnailCard, Object.assign({ key: id, id: id, name: name, width: width, height: height, thumbnail: thumbnail, actionAvailable: false }, restOfSimilarCardProps))))) || React.createElement(Empty, null)))) : null;
|
|
29
29
|
});
|
|
@@ -19,6 +19,7 @@ import { CustomLabelStyled, CustomRootLabel, MenuWrapper, TextWrapper } from './
|
|
|
19
19
|
// Components
|
|
20
20
|
import { Checkbox, Spin } from '../../../../atoms';
|
|
21
21
|
import { Menu } from '../../../../organism';
|
|
22
|
+
import { Empty } from '../Empty';
|
|
22
23
|
// Utils
|
|
23
24
|
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
24
25
|
// Constants
|
|
@@ -26,7 +27,7 @@ import { CATEGORY_LISTING_WITH } from '../../constants';
|
|
|
26
27
|
const PATH = 'src/components/template/TemplateListing/components/CategoryListing/index.tsx';
|
|
27
28
|
export const CategoryListing = memo(props => {
|
|
28
29
|
var _a;
|
|
29
|
-
const { width = CATEGORY_LISTING_WITH, items = [], loading = false,
|
|
30
|
+
const { width = CATEGORY_LISTING_WITH, items = [], loading = false, show = true, checkedCategories = {}, onMenuChange } = props, restOfProps = __rest(props, ["width", "items", "loading", "show", "checkedCategories", "onMenuChange"]);
|
|
30
31
|
// Handlers
|
|
31
32
|
const handleClickMenu = e => {
|
|
32
33
|
var _a;
|
|
@@ -104,8 +105,8 @@ export const CategoryListing = memo(props => {
|
|
|
104
105
|
});
|
|
105
106
|
return menuItems;
|
|
106
107
|
}, [getItem, items]);
|
|
107
|
-
return
|
|
108
|
-
React.createElement(Spin, { spinning: loading, wrapperClassName: "template-listing__loading" },
|
|
109
|
-
React.createElement(Menu, Object.assign({ items: menuItems, inlineIndent: 0, mode: "inline", defaultOpenKeys: items === null || items === void 0 ? void 0 : items.map(item => String(item.key)), expandIcon: React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: 20, color: (_a = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _a === void 0 ? void 0 : _a.bw8 } }), onClick: handleClickMenu }, restOfProps))))) : null;
|
|
108
|
+
return show ? (React.createElement(MenuWrapper, { "$width": width },
|
|
109
|
+
React.createElement(Spin, { spinning: loading, wrapperClassName: "template-listing__loading" }, isEmpty(menuItems) ? (React.createElement("div", { className: "empty-wrapper" },
|
|
110
|
+
React.createElement(Empty, null))) : (React.createElement(Menu, Object.assign({ items: menuItems, inlineIndent: 0, mode: "inline", defaultOpenKeys: items === null || items === void 0 ? void 0 : items.map(item => String(item.key)), expandIcon: React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: 20, color: (_a = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _a === void 0 ? void 0 : _a.bw8 } }), onClick: handleClickMenu }, restOfProps)))))) : null;
|
|
110
111
|
});
|
|
111
112
|
CategoryListing.displayName = 'CategoryListing';
|
|
@@ -7,6 +7,7 @@ export const MenuWrapper = styled.div `
|
|
|
7
7
|
flex-shrink: 0;
|
|
8
8
|
width: ${({ $width }) => ($width !== undefined ? `${$width}px` : 'auto')};
|
|
9
9
|
overflow: auto;
|
|
10
|
+
overflow-x: hidden;
|
|
10
11
|
|
|
11
12
|
.antsomi-menu {
|
|
12
13
|
height: 100%;
|
|
@@ -28,6 +29,13 @@ export const MenuWrapper = styled.div `
|
|
|
28
29
|
.category-loading {
|
|
29
30
|
height: 100%;
|
|
30
31
|
}
|
|
32
|
+
|
|
33
|
+
.empty-wrapper {
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
border-right: 1px solid rgba(5, 5, 5, 0.06);
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
}
|
|
31
39
|
`;
|
|
32
40
|
export const CustomLabelStyled = styled.div `
|
|
33
41
|
display: flex;
|
|
@@ -9,7 +9,7 @@ export const TEMPLATE_ITEM_DEFAULT = {
|
|
|
9
9
|
export const BLANK_TEMPLATE_DEFAULT = { show: false };
|
|
10
10
|
export const CATEGORY_LISTING_DEFAULT = {
|
|
11
11
|
width: CATEGORY_LISTING_WITH,
|
|
12
|
-
|
|
12
|
+
show: true,
|
|
13
13
|
checkedCategories: {},
|
|
14
14
|
onMenuChange: () => { },
|
|
15
15
|
};
|
|
@@ -134,8 +134,8 @@ export const useTemplateListing = (options) => {
|
|
|
134
134
|
return [];
|
|
135
135
|
}, [infiniteObjectTemplate]);
|
|
136
136
|
const similarTemplates = useMemo(() => {
|
|
137
|
-
const
|
|
138
|
-
return (getShuffleArray(templateItems.filter(item => item.id !== selectedTemplateId)).slice(0,
|
|
137
|
+
const maxSimilarTemplateLength = 4;
|
|
138
|
+
return (getShuffleArray(templateItems.filter(item => item.id !== selectedTemplateId)).slice(0, maxSimilarTemplateLength) || []);
|
|
139
139
|
}, [templateItems, selectedTemplateId]);
|
|
140
140
|
// Effects
|
|
141
141
|
useDeepCompareEffect(() => {
|
|
@@ -78,8 +78,8 @@ export const TemplateListing = memo(props => {
|
|
|
78
78
|
React.createElement(BlankTemplate, Object.assign({ width: width * ratio, height: height * ratio }, blankTemplateProps)), items === null || items === void 0 ? void 0 :
|
|
79
79
|
items.map(({ id, name, thumbnail }, index) => (React.createElement("div", { key: id },
|
|
80
80
|
React.createElement(ThumbnailCard, Object.assign({ id: id, name: name, width: width * ratio, height: height * ratio, thumbnail: thumbnail, className: `animate__animated animate__fadeIn ${templateItemProps.className}`, onClickPreview: handleClickThumbnailPreview }, restOfTemplateItemProps)),
|
|
81
|
-
index === items.length - 1 && React.createElement(LoadMoreBlock, { ref: loadMoreRef })))))
|
|
82
|
-
|
|
81
|
+
index === items.length - 1 && React.createElement(LoadMoreBlock, { ref: loadMoreRef }))))),
|
|
82
|
+
!loading && !blankTemplateProps.show && !isHasData && React.createElement(Empty, Object.assign({}, emptyProps)))),
|
|
83
83
|
React.createElement(PreviewTemplateModal, Object.assign({ informationProps: Object.assign({ onButtonClick: handleClickPreviewModalInfoBtn }, restOfPreviewModalInfoProps), open: openPreviewModal, onOk: handleOkPreviewModal, onCancel: handleCancelPreviewModal }, restOfPreviewModalProps))));
|
|
84
84
|
});
|
|
85
85
|
TemplateListing.displayName = 'TemplateListing';
|
|
@@ -6,7 +6,7 @@ export interface CategoryListingProps extends MenuProps {
|
|
|
6
6
|
items?: TCategoryItem[];
|
|
7
7
|
width?: number;
|
|
8
8
|
loading?: boolean;
|
|
9
|
-
|
|
9
|
+
show?: boolean;
|
|
10
10
|
checkedCategories?: TCheckedCategories;
|
|
11
11
|
onMenuChange?: (value: TCheckedCategories) => void;
|
|
12
12
|
}
|