@antscorp/antsomi-ui 1.3.5-beta.245 → 1.3.5-beta.247
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/assets/images/background/skeleton-background.png +0 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +23 -6
- package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +2 -3
- package/es/components/molecules/ThumbnailCard/styled.js +6 -4
- package/es/components/molecules/ThumbnailCard/types.d.ts +1 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +5 -4
- package/es/components/organism/PreviewTemplateModal/components/Information/styled.js +4 -4
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.js +4 -2
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.js +3 -3
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/index.js +2 -1
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +4 -4
- package/es/components/organism/PreviewTemplateModal/index.js +9 -12
- package/es/components/template/TemplateListing/index.js +28 -29
- package/es/constants/theme.js +6 -1
- package/es/providers/index.d.ts +0 -1
- package/es/providers/index.js +0 -1
- package/es/utils/common.js +1 -1
- package/package.json +1 -1
- package/es/providers/AntdConfigProviderV2.d.ts +0 -7
- package/es/providers/AntdConfigProviderV2.js +0 -28
|
Binary file
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
var _a, _b;
|
|
1
2
|
// Libraries
|
|
2
3
|
import styled, { css } from 'styled-components';
|
|
3
4
|
import { Flex } from '@antscorp/antsomi-ui/es/components';
|
|
4
5
|
// Assets
|
|
5
|
-
import SkeletonBg from '@antscorp/antsomi-ui/es/assets/images/
|
|
6
|
+
import SkeletonBg from '@antscorp/antsomi-ui/es/assets/images/background/skeleton-background.png';
|
|
7
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
6
8
|
const backgroundImage = css `
|
|
7
9
|
${() => css `
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
&::after {
|
|
11
|
+
content: '';
|
|
12
|
+
position: absolute;
|
|
13
|
+
width: 90%;
|
|
14
|
+
height: 90%;
|
|
15
|
+
background: url(${SkeletonBg}) no-repeat center center;
|
|
16
|
+
background-size: contain;
|
|
17
|
+
z-index: 0;
|
|
18
|
+
}
|
|
10
19
|
`}
|
|
11
20
|
`;
|
|
12
21
|
const setWidthHeight = ({ w, h }) => `
|
|
@@ -125,7 +134,7 @@ export const ImageSliderStyled = styled(Flex) `
|
|
|
125
134
|
width: 100%;
|
|
126
135
|
height: 100%;
|
|
127
136
|
background-color: transparent;
|
|
128
|
-
z-index:
|
|
137
|
+
z-index: 2;
|
|
129
138
|
transition: background-color 150ms ease-in-out;
|
|
130
139
|
}
|
|
131
140
|
|
|
@@ -137,14 +146,21 @@ export const ImageSliderStyled = styled(Flex) `
|
|
|
137
146
|
.image-container {
|
|
138
147
|
&--big,
|
|
139
148
|
&--small {
|
|
140
|
-
|
|
149
|
+
position: relative;
|
|
150
|
+
box-sizing: border-box;
|
|
151
|
+
background: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorBgSkeleton};
|
|
152
|
+
border: 1px solid ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.blue1_1};
|
|
153
|
+
border-radius: 5px;
|
|
154
|
+
|
|
141
155
|
${centerBlock}
|
|
142
156
|
&:not(.hide-skeleton) {
|
|
143
157
|
${backgroundImage}
|
|
144
158
|
}
|
|
145
159
|
|
|
146
160
|
img {
|
|
161
|
+
position: relative;
|
|
147
162
|
object-fit: contain;
|
|
163
|
+
z-index: 1;
|
|
148
164
|
}
|
|
149
165
|
|
|
150
166
|
div:has(> img) {
|
|
@@ -169,7 +185,8 @@ export const ImageSliderStyled = styled(Flex) `
|
|
|
169
185
|
height: 72px;
|
|
170
186
|
flex-shrink: 0;
|
|
171
187
|
|
|
172
|
-
border: 2px solid #e5e5e5;
|
|
188
|
+
/* border: 2px solid #e5e5e5; */
|
|
189
|
+
border-width: 2px;
|
|
173
190
|
border-radius: 2px;
|
|
174
191
|
user-select: none;
|
|
175
192
|
cursor: pointer;
|
|
@@ -29,10 +29,9 @@ import { Button, Flex, Spin, Typography } from '../../atoms';
|
|
|
29
29
|
// Constants
|
|
30
30
|
import { THUMBNAIL_CARD_DEFAULT_HEIGHT, THUMBNAIL_CARD_DEFAULT_WIDTH } from './constants';
|
|
31
31
|
import { getUrlNoCache, checkShowSkeletonBaseUrl } from '@antscorp/antsomi-ui/es/utils';
|
|
32
|
-
const cacheValue = new Date().getTime();
|
|
33
32
|
export const ThumbnailCard = memo(props => {
|
|
34
33
|
const [modal, contextHolder] = Modal.useModal();
|
|
35
|
-
const { id, name, width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, thumbnail, thumbnailFit, removable = true, actionAvailable = true, showSkeleton, loading = false, removeModalProps, editBtnProps, previewBtnProps, onClickWrapper } = props, restOfProps = __rest(props, ["id", "name", "width", "height", "thumbnail", "thumbnailFit", "removable", "actionAvailable", "showSkeleton", "loading", "removeModalProps", "editBtnProps", "previewBtnProps", "onClickWrapper"]);
|
|
34
|
+
const { id, name, width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, thumbnail, thumbnailFit, removable = true, actionAvailable = true, showSkeleton, loading = false, removeModalProps, editBtnProps, previewBtnProps, thumbnailCacheValue, onClickWrapper } = props, restOfProps = __rest(props, ["id", "name", "width", "height", "thumbnail", "thumbnailFit", "removable", "actionAvailable", "showSkeleton", "loading", "removeModalProps", "editBtnProps", "previewBtnProps", "thumbnailCacheValue", "onClickWrapper"]);
|
|
36
35
|
const _a = removeModalProps || {}, { onOk } = _a, restOfRemoveTemplateModalProps = __rest(_a, ["onOk"]);
|
|
37
36
|
const _b = editBtnProps || {}, { text: editText = 'Use template', onClick: onClickEdit } = _b, restOfEditBtnProps = __rest(_b, ["text", "onClick"]);
|
|
38
37
|
const _c = previewBtnProps || {}, { text: previewText = 'Preview', onClick: onClickPreview } = _c, restOfPreviewBtnProps = __rest(_c, ["text", "onClick"]);
|
|
@@ -60,7 +59,7 @@ export const ThumbnailCard = memo(props => {
|
|
|
60
59
|
};
|
|
61
60
|
return (React.createElement(Flex, Object.assign({ gap: 10, vertical: true }, restOfProps, { style: Object.assign({ width }, restOfProps.style) }),
|
|
62
61
|
React.createElement(ThumbnailCardWrapper, { "$showSkeleton": showSkeletonMemo, style: { height, cursor: actionAvailable ? 'default' : 'pointer' }, onClick: handleWrapperClick },
|
|
63
|
-
React.createElement("div", { className: "screen" }, thumbnail && (React.createElement("img", { src: getUrlNoCache(thumbnail,
|
|
62
|
+
React.createElement("div", { className: "screen" }, thumbnail && (React.createElement("img", { src: getUrlNoCache(thumbnail, thumbnailCacheValue), alt: "", style: { objectFit: thumbnailFit }, onError: e => {
|
|
64
63
|
e.currentTarget.style.display = 'none';
|
|
65
64
|
} }))),
|
|
66
65
|
actionAvailable && !loading && (React.createElement(React.Fragment, null,
|
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
// Images
|
|
4
4
|
import skeletonBackground from '../../../assets/images/background/skeleton-background.png';
|
|
5
|
-
|
|
5
|
+
// Constants
|
|
6
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
6
7
|
export const ThumbnailCardWrapper = styled.div `
|
|
7
|
-
background-color:
|
|
8
|
+
background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorBgSkeleton};
|
|
8
9
|
padding: 10px;
|
|
9
|
-
border-radius: ${globalToken.borderRadius}px;
|
|
10
|
+
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadius}px;
|
|
10
11
|
position: relative;
|
|
11
12
|
box-sizing: border-box;
|
|
12
13
|
width: 100%;
|
|
13
14
|
display: flex;
|
|
14
15
|
align-items: center;
|
|
15
16
|
justify-content: center;
|
|
17
|
+
border: 1px solid ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.blue1_1};
|
|
16
18
|
|
|
17
19
|
:hover {
|
|
18
20
|
.center-action {
|
|
@@ -77,7 +79,7 @@ export const ThumbnailCardWrapper = styled.div `
|
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
.backdrop {
|
|
80
|
-
border-radius: ${globalToken.borderRadius}px;
|
|
82
|
+
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadius}px;
|
|
81
83
|
position: absolute;
|
|
82
84
|
width: 100%;
|
|
83
85
|
height: 100%;
|
|
@@ -22,5 +22,6 @@ export interface ThumbnailCardProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
22
22
|
actionAvailable?: boolean;
|
|
23
23
|
removeModalProps?: TRemoveModalProps;
|
|
24
24
|
thumbnailFit?: React.CSSProperties['objectFit'];
|
|
25
|
+
thumbnailCacheValue?: string | number;
|
|
25
26
|
onClickWrapper?: (id: TThumbnailCardId) => void;
|
|
26
27
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
// Images
|
|
3
3
|
import skeletonBackground from '../../../../../assets/images/background/skeleton-background.png';
|
|
4
|
-
//
|
|
5
|
-
import { globalToken } from '@antscorp/antsomi-ui/es/
|
|
4
|
+
// Constants
|
|
5
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
6
6
|
const THUMBNAIL_CARD_RADIUS = 5;
|
|
7
7
|
export const BannerWrapper = styled.div `
|
|
8
8
|
width: 100%;
|
|
@@ -10,8 +10,9 @@ export const BannerWrapper = styled.div `
|
|
|
10
10
|
display: flex;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
align-items: center;
|
|
13
|
-
background-color:
|
|
14
|
-
border-radius: ${globalToken.borderRadius}px;
|
|
13
|
+
background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorBgSkeleton};
|
|
14
|
+
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadius}px;
|
|
15
|
+
border: 1px solid ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.blue1_1};
|
|
15
16
|
|
|
16
17
|
${props => props.$height
|
|
17
18
|
? css `
|
|
@@ -3,7 +3,7 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
// Components
|
|
4
4
|
import { Button, Flex } from '../../../../atoms';
|
|
5
5
|
// Providers
|
|
6
|
-
import { globalToken } from '@antscorp/antsomi-ui/es/
|
|
6
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
7
7
|
export const InformationWrapper = styled(Flex) `
|
|
8
8
|
width: 300px;
|
|
9
9
|
flex-shrink: 0;
|
|
@@ -51,11 +51,11 @@ export const InformationWrapper = styled(Flex) `
|
|
|
51
51
|
}
|
|
52
52
|
`;
|
|
53
53
|
export const CheckboxButton = styled(Button) `
|
|
54
|
-
color: ${globalToken.colorText} !important;
|
|
54
|
+
color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorText} !important;
|
|
55
55
|
|
|
56
56
|
${p => p.$active &&
|
|
57
57
|
css `
|
|
58
|
-
color: ${globalToken.colorPrimary} !important;
|
|
59
|
-
background-color: ${globalToken.blue1_1} !important;
|
|
58
|
+
color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorPrimary} !important;
|
|
59
|
+
background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.blue1_1} !important;
|
|
60
60
|
`}
|
|
61
61
|
`;
|
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
// Libraries
|
|
13
|
-
import React, { memo } from 'react';
|
|
13
|
+
import React, { memo, useMemo } from 'react';
|
|
14
14
|
import { isEmpty } from 'lodash';
|
|
15
15
|
// Components
|
|
16
16
|
import { ThumbnailCard } from '../../../../molecules';
|
|
@@ -23,10 +23,12 @@ export const SimilarTemplate = memo(props => {
|
|
|
23
23
|
var _a;
|
|
24
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
|
+
// Memo
|
|
27
|
+
const thumbnailCacheValue = useMemo(() => new Date().getTime(), []);
|
|
26
28
|
return show && !isEmpty(similarTemplates) ? (React.createElement(SimilarTemplateWrapper, { gap: 15, vertical: true },
|
|
27
29
|
React.createElement("div", { className: "title" }, "Similar templates"),
|
|
28
30
|
React.createElement(TemplateListWrapper, { templateQuantity: MAX_QUANTITY_TEMPLATES }, (_a = similarTemplates.slice(0, MAX_QUANTITY_TEMPLATES)) === null || _a === void 0 ? void 0 : _a.map((item, idx) => {
|
|
29
31
|
const { id, name, thumbnail } = item || {};
|
|
30
|
-
return (React.createElement(ThumbnailCard, Object.assign({ key: id, id: id || idx, name: name, width: width, height: height, thumbnail: thumbnail, actionAvailable: false, className: "thumbnail-card" }, restOfSimilarCardProps)));
|
|
32
|
+
return (React.createElement(ThumbnailCard, Object.assign({ key: id, id: id || idx, name: name, width: width, height: height, thumbnail: thumbnail, actionAvailable: false, className: "thumbnail-card", thumbnailCacheValue: thumbnailCacheValue }, restOfSimilarCardProps)));
|
|
31
33
|
})))) : null;
|
|
32
34
|
});
|
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
// Components
|
|
4
4
|
import { Flex } from '../../../../atoms';
|
|
5
5
|
// Providers
|
|
6
|
-
import { globalToken } from '@antscorp/antsomi-ui/es/
|
|
6
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
7
7
|
export const SimilarTemplateWrapper = styled(Flex) `
|
|
8
8
|
margin-top: 15px;
|
|
9
9
|
|
|
@@ -17,10 +17,10 @@ export const TemplateListWrapper = styled.div `
|
|
|
17
17
|
gap: 30px;
|
|
18
18
|
|
|
19
19
|
.thumbnail-card {
|
|
20
|
-
border-radius: ${globalToken.borderRadius}px;
|
|
20
|
+
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadius}px;
|
|
21
21
|
|
|
22
22
|
> div {
|
|
23
|
-
border-radius: ${globalToken.borderRadius}px;
|
|
23
|
+
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadius}px;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
`;
|
|
@@ -44,6 +44,7 @@ export const ThumbnailSlider = memo(props => {
|
|
|
44
44
|
const calculate = ((thumbnails === null || thumbnails === void 0 ? void 0 : thumbnails.length) || 0) * thumbnailWrapperWidth;
|
|
45
45
|
return calculate > WRAPPER_WIDTH;
|
|
46
46
|
}, [thumbnails === null || thumbnails === void 0 ? void 0 : thumbnails.length, thumbnailWrapperWidth]);
|
|
47
|
+
const thumbnailCacheValue = useMemo(() => new Date().getTime(), []);
|
|
47
48
|
// Renders
|
|
48
49
|
const renderThumbnail = (args) => {
|
|
49
50
|
const { thumbnail, index } = args;
|
|
@@ -51,7 +52,7 @@ export const ThumbnailSlider = memo(props => {
|
|
|
51
52
|
return (React.createElement(Flex, { gap: GAP_X },
|
|
52
53
|
!!index && (React.createElement(Flex, { align: "center" },
|
|
53
54
|
React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: ICON_SIZE, transform: 'rotate(270deg)' } }))),
|
|
54
|
-
React.createElement(ThumbnailCard, Object.assign({ key: id, id: id, width: width, height: height, thumbnail: url, style: { flexShrink: 0 }, className: "thumbnail-animation", actionAvailable: false, onClickWrapper: () => onClickThumbnail === null || onClickThumbnail === void 0 ? void 0 : onClickThumbnail(thumbnail) }, restOfThumbnailProps))));
|
|
55
|
+
React.createElement(ThumbnailCard, Object.assign({ key: id, id: id, width: width, height: height, thumbnail: url, thumbnailCacheValue: thumbnailCacheValue, style: { flexShrink: 0 }, className: "thumbnail-animation", actionAvailable: false, onClickWrapper: () => onClickThumbnail === null || onClickThumbnail === void 0 ? void 0 : onClickThumbnail(thumbnail) }, restOfThumbnailProps))));
|
|
55
56
|
};
|
|
56
57
|
return thumbnails && !isEmpty(thumbnails) ? (React.createElement(ThumbnailSliderWrapper, null, isShowSwiper ? (React.createElement(React.Fragment, null,
|
|
57
58
|
React.createElement(Swiper, { slidesPerView: Math.floor(WRAPPER_WIDTH / thumbnailWrapperWidth), spaceBetween: GAP_X, modules: [Navigation, A11y, Thumbs], navigation: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
3
|
-
import { globalToken } from '@antscorp/antsomi-ui/es/providers';
|
|
4
2
|
import styled from 'styled-components';
|
|
5
3
|
import { SwiperSlide } from 'swiper/react';
|
|
4
|
+
// Constants
|
|
5
|
+
import { THEME, globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
6
6
|
export const ThumbnailSliderWrapper = styled.div `
|
|
7
7
|
width: 100%;
|
|
8
8
|
display: flex;
|
|
@@ -21,10 +21,10 @@ export const ThumbnailSliderWrapper = styled.div `
|
|
|
21
21
|
.thumbnail-animation {
|
|
22
22
|
box-shadow: none;
|
|
23
23
|
transition: box-shadow 0.1s ease-in-out;
|
|
24
|
-
border-radius: ${globalToken.borderRadius}px;
|
|
24
|
+
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadius}px;
|
|
25
25
|
|
|
26
26
|
> div {
|
|
27
|
-
border-radius: ${globalToken.borderRadius}px;
|
|
27
|
+
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadius}px;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
&:hover {
|
|
@@ -18,20 +18,17 @@ import { Banner, Information, SimilarTemplate, ThumbnailSlider } from './compone
|
|
|
18
18
|
import { ModalContainer, ModalWrapper } from './styled';
|
|
19
19
|
// Constants
|
|
20
20
|
import { DEVICE_TYPE, SIMILAR_TEMPLATE_DEFAULT, THUMBNAIL_DEFAULT } from './constants';
|
|
21
|
-
// Providers
|
|
22
|
-
import { AntdConfigProviderV2 } from '@antscorp/antsomi-ui/es/providers';
|
|
23
21
|
export const PreviewTemplateModal = memo(props => {
|
|
24
22
|
const { bannerProps, thumbnailProps = THUMBNAIL_DEFAULT, similarTemplateProps = SIMILAR_TEMPLATE_DEFAULT, informationProps, loading = false } = props, restOfProps = __rest(props, ["bannerProps", "thumbnailProps", "similarTemplateProps", "informationProps", "loading"]);
|
|
25
23
|
// States
|
|
26
24
|
const [deviceType, setDeviceType] = useState(DEVICE_TYPE.DESKTOP.value);
|
|
27
|
-
return (React.createElement(
|
|
28
|
-
React.createElement(
|
|
29
|
-
React.createElement(
|
|
30
|
-
React.createElement(
|
|
31
|
-
React.createElement(
|
|
32
|
-
React.createElement(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
React.createElement(SimilarTemplate, Object.assign({}, similarTemplateProps))))));
|
|
25
|
+
return (React.createElement(ModalContainer, Object.assign({ footer: null, centered: true, modalRender: node => React.createElement(ModalWrapper, null, node) }, restOfProps),
|
|
26
|
+
React.createElement(Spin, { spinning: loading },
|
|
27
|
+
React.createElement(Flex, { gap: 20 },
|
|
28
|
+
React.createElement("div", { className: "overview" },
|
|
29
|
+
React.createElement(Flex, { gap: 20, vertical: true, style: { width: '100%' } },
|
|
30
|
+
React.createElement(Banner, Object.assign({ deviceType: deviceType }, bannerProps)),
|
|
31
|
+
React.createElement(ThumbnailSlider, Object.assign({}, thumbnailProps)))),
|
|
32
|
+
React.createElement(Information, Object.assign({ deviceType: deviceType, onDeviceTypeChange: value => setDeviceType(value) }, informationProps))),
|
|
33
|
+
React.createElement(SimilarTemplate, Object.assign({}, similarTemplateProps)))));
|
|
37
34
|
});
|
|
@@ -11,9 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
/* eslint-disable react/function-component-definition */
|
|
13
13
|
// Libraries
|
|
14
|
-
import React, { memo, useState } from 'react';
|
|
15
|
-
// Config Providers
|
|
16
|
-
import { AntdConfigProviderV2 } from '../../..';
|
|
14
|
+
import React, { memo, useMemo, useState } from 'react';
|
|
17
15
|
// Components
|
|
18
16
|
import { CategoryListing, BlankTemplate, Empty } from './components';
|
|
19
17
|
import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
@@ -37,6 +35,8 @@ export const TemplateListing = memo(props => {
|
|
|
37
35
|
const _b = templateItemProps || {}, { width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, previewBtnProps } = _b, restOfTemplateItemProps = __rest(_b, ["width", "height", "previewBtnProps"]);
|
|
38
36
|
const { onClick: onClickPreview } = previewBtnProps || {};
|
|
39
37
|
const isHasData = items.length > 0;
|
|
38
|
+
// Memo
|
|
39
|
+
const thumbnailCacheValue = useMemo(() => new Date().getTime(), []);
|
|
40
40
|
// Hooks
|
|
41
41
|
const { ref: containerRef, itemPerRow, ratio, gap: listingGap, } = useListingItemResize({
|
|
42
42
|
gap,
|
|
@@ -66,32 +66,31 @@ export const TemplateListing = memo(props => {
|
|
|
66
66
|
};
|
|
67
67
|
return (
|
|
68
68
|
/** The className "template-listing-wrapper" is used to detect dom in useListingItemResize hook */
|
|
69
|
-
React.createElement(
|
|
70
|
-
React.createElement(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
React.createElement(
|
|
75
|
-
React.createElement("div", {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
React.createElement(PreviewTemplateModal, Object.assign({ open: openPreviewModal, onOk: handleOkPreviewModal, onCancel: handleCancelPreviewModal }, restOfPreviewModalProps)))));
|
|
69
|
+
React.createElement(TemplateListingWrapper, { className: "template-listing-wrapper" },
|
|
70
|
+
React.createElement(CategoryListing, Object.assign({}, categoryListingProps, { emptyProps: emptyProps })),
|
|
71
|
+
React.createElement(TemplateWrapper, { className: wrapperClassName, style: wrapperStyle },
|
|
72
|
+
header,
|
|
73
|
+
React.createElement(Spin, { spinning: loading || !itemPerRow, wrapperClassName: "template-listing__loading template-listing__loading--full" },
|
|
74
|
+
React.createElement("div", { className: "template-listing" },
|
|
75
|
+
React.createElement("div", { ref: containerRef, style: {
|
|
76
|
+
display: 'grid',
|
|
77
|
+
gap: listingGap,
|
|
78
|
+
gridTemplateColumns: `repeat(${itemPerRow}, minmax(0, 1fr))`,
|
|
79
|
+
} },
|
|
80
|
+
React.createElement(BlankTemplate, Object.assign({ width: width * ratio, height: height * ratio }, blankTemplateProps)),
|
|
81
|
+
!!itemPerRow &&
|
|
82
|
+
(items === null || items === void 0 ? void 0 : items.map((item, index) => {
|
|
83
|
+
const { id, name, thumbnail } = item || {};
|
|
84
|
+
const loading = typeof (item === null || item === void 0 ? void 0 : item.name) === 'undefined';
|
|
85
|
+
return (React.createElement("div", { key: id },
|
|
86
|
+
index === items.length - 2 && React.createElement(LoadMoreBlock, { ref: loadMoreRef }),
|
|
87
|
+
React.createElement(ThumbnailCard, Object.assign({ id: id || 0, name: name || 'Untitled', loading: loading, width: width * ratio, height: height * ratio, thumbnail: thumbnail, className: `${templateItemProps.className}`, thumbnailCacheValue: thumbnailCacheValue, previewBtnProps: {
|
|
88
|
+
onClick: handleClickThumbnailPreview,
|
|
89
|
+
} }, restOfTemplateItemProps))));
|
|
90
|
+
}))),
|
|
91
|
+
!loading && !blankTemplateProps.show && !isHasData && React.createElement(Empty, Object.assign({}, emptyProps)))),
|
|
92
|
+
footer),
|
|
93
|
+
React.createElement(PreviewTemplateModal, Object.assign({ open: openPreviewModal, onOk: handleOkPreviewModal, onCancel: handleCancelPreviewModal }, restOfPreviewModalProps))));
|
|
95
94
|
});
|
|
96
95
|
TemplateListing.displayName = 'TemplateListing';
|
|
97
96
|
TemplateListing.defaultProps = TEMPLATE_LISTING_DEFAULT;
|
package/es/constants/theme.js
CHANGED
|
@@ -22,7 +22,8 @@ export const THEME = {
|
|
|
22
22
|
colorTextActive: '#e0ebf7',
|
|
23
23
|
colorIcon: '#666666',
|
|
24
24
|
/* Border radius */
|
|
25
|
-
borderRadius:
|
|
25
|
+
borderRadius: 10,
|
|
26
|
+
borderRadiusLG: 10,
|
|
26
27
|
borderRadiusXL: 10,
|
|
27
28
|
/* Font */
|
|
28
29
|
fontFamily: 'Roboto',
|
|
@@ -76,6 +77,8 @@ export const THEME = {
|
|
|
76
77
|
gold1,
|
|
77
78
|
gold6,
|
|
78
79
|
scrollBarSize: '4px',
|
|
80
|
+
/** Skeleton */
|
|
81
|
+
colorBgSkeleton: '#FCFDFF',
|
|
79
82
|
},
|
|
80
83
|
};
|
|
81
84
|
THEME.components = {
|
|
@@ -88,6 +91,7 @@ THEME.components = {
|
|
|
88
91
|
colorBgTextHover: (_c = THEME.token) === null || _c === void 0 ? void 0 : _c.blue,
|
|
89
92
|
colorBgContainerDisabled: (_d = THEME.token) === null || _d === void 0 ? void 0 : _d.bw6,
|
|
90
93
|
colorTextDisabled: (_e = THEME.token) === null || _e === void 0 ? void 0 : _e.bw0,
|
|
94
|
+
textHoverBg: '#F2F9FF',
|
|
91
95
|
},
|
|
92
96
|
Input: {
|
|
93
97
|
controlHeight: 32,
|
|
@@ -150,6 +154,7 @@ THEME.components = {
|
|
|
150
154
|
controlInteractiveSize: 18,
|
|
151
155
|
colorBorder: (_t = THEME.token) === null || _t === void 0 ? void 0 : _t.colorPrimary,
|
|
152
156
|
lineWidth: 2,
|
|
157
|
+
borderRadiusSM: 5,
|
|
153
158
|
},
|
|
154
159
|
Modal: {
|
|
155
160
|
titleFontSize: 16,
|
package/es/providers/index.d.ts
CHANGED
package/es/providers/index.js
CHANGED
package/es/utils/common.js
CHANGED
|
@@ -477,7 +477,7 @@ export const isExistedImage = (imageUrl) => {
|
|
|
477
477
|
};
|
|
478
478
|
export const getUrlNoCache = (url = '', cacheValue = 0) => {
|
|
479
479
|
let urlNoCache = url;
|
|
480
|
-
if (urlNoCache.includes('nocache') || url.startsWith('data:image')) {
|
|
480
|
+
if (urlNoCache.includes('nocache') || url.startsWith('data:image') || !cacheValue) {
|
|
481
481
|
urlNoCache = url;
|
|
482
482
|
}
|
|
483
483
|
else {
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ConfigProviderProps } from 'antd';
|
|
3
|
-
interface AntdConfigProviderV2Props extends ConfigProviderProps {
|
|
4
|
-
}
|
|
5
|
-
export declare const AntdConfigProviderV2: React.FC<AntdConfigProviderV2Props>;
|
|
6
|
-
export declare const globalToken: import("antd/es/theme/internal").AliasToken;
|
|
7
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
var _a;
|
|
13
|
-
// Libraries
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import { ConfigProvider, theme } from 'antd';
|
|
16
|
-
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
17
|
-
const { getDesignToken } = theme;
|
|
18
|
-
const themeV2 = {
|
|
19
|
-
token: Object.assign(Object.assign({}, THEME.token), { colorText: '#000000', borderRadius: 10, borderRadiusLG: 10 }),
|
|
20
|
-
components: Object.assign(Object.assign({}, THEME.components), { Button: Object.assign(Object.assign({}, (_a = THEME.components) === null || _a === void 0 ? void 0 : _a.Button), { borderRadius: 10, textHoverBg: '#F2F9FF' }), Checkbox: {
|
|
21
|
-
borderRadiusSM: 5,
|
|
22
|
-
} }),
|
|
23
|
-
};
|
|
24
|
-
export const AntdConfigProviderV2 = props => {
|
|
25
|
-
const { children } = props, restProps = __rest(props, ["children"]);
|
|
26
|
-
return (React.createElement(ConfigProvider, Object.assign({ theme: themeV2 }, restProps), children));
|
|
27
|
-
};
|
|
28
|
-
export const globalToken = getDesignToken(themeV2);
|