@antscorp/antsomi-ui 1.3.5-beta.38 → 1.3.5-beta.39
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/molecules/TemplateSaveAs/TemplateSaveAs.d.ts +1 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.js +2 -2
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.d.ts +1 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.js +8 -13
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +22 -0
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ export const TemplateSaveAs = props => {
|
|
|
24
24
|
// onNamePopupScroll,
|
|
25
25
|
} = props;
|
|
26
26
|
const { show: isShowShareAccess } = shareAccess, shareAccessProps = __rest(shareAccess, ["show"]);
|
|
27
|
-
const { thumbnails, skeleton, previewNavigation, slidesPerView, hideThumbnailsList, hideDefaultButton, label: imageReviewLabel, } = imageReview;
|
|
27
|
+
const { thumbnails, isLoading: isLoadingThumbnail, skeleton, previewNavigation, slidesPerView, hideThumbnailsList, hideDefaultButton, label: imageReviewLabel, } = imageReview;
|
|
28
28
|
const { isLoading, searchValue, label: templateLabel, defaultNewTemplateName, onSearch, onNamePopupScroll, } = templateNamesOptions || {};
|
|
29
29
|
const { label: descriptionLabel, placeholder: descriptionPlaceholder } = descriptionOptions || {};
|
|
30
30
|
const { saveNewText = 'Save as a new media Template', saveExistText = 'Save as an existing media Template', saveNewValue = 'save-new', saveExistValue = 'save-exist', } = saveOptions || {};
|
|
@@ -118,7 +118,7 @@ export const TemplateSaveAs = props => {
|
|
|
118
118
|
imageReviewLabel || 'Thumbnail template',
|
|
119
119
|
" ",
|
|
120
120
|
React.createElement("span", null, "*")),
|
|
121
|
-
React.createElement(ImageSlider, { thumbnails: thumbnails, skeleton: skeleton, previewNavigation: previewNavigation, slidesPerView: slidesPerView, defaultThumbnail: defaultThumbnail, onSelectDefault: value => handleChangeValue({ defaultThumbnail: value }), hideThumbnailsList: hideThumbnailsList, hideDefaultButton: hideDefaultButton })), categories === null || categories === void 0 ? void 0 :
|
|
121
|
+
React.createElement(ImageSlider, { thumbnails: thumbnails, isLoading: isLoadingThumbnail, skeleton: skeleton, previewNavigation: previewNavigation, slidesPerView: slidesPerView, defaultThumbnail: defaultThumbnail, onSelectDefault: value => handleChangeValue({ defaultThumbnail: value }), hideThumbnailsList: hideThumbnailsList, hideDefaultButton: hideDefaultButton })), categories === null || categories === void 0 ? void 0 :
|
|
122
122
|
categories.map(parentCategory => {
|
|
123
123
|
var _a, _b, _c;
|
|
124
124
|
const selectedChildren = (_a = categoriesValue
|
|
@@ -3,13 +3,13 @@ import React, { useState, useRef } from 'react';
|
|
|
3
3
|
import { Image } from 'antd';
|
|
4
4
|
import Icon from '@antscorp/icons';
|
|
5
5
|
// Components
|
|
6
|
-
import { Button, Flex } from '@antscorp/antsomi-ui/es/components';
|
|
6
|
+
import { Button, Flex, Spin } from '@antscorp/antsomi-ui/es/components';
|
|
7
7
|
// Styles
|
|
8
8
|
import { ImageSliderStyled } from './styled';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
export const ImageSlider = props => {
|
|
11
11
|
var _a, _b;
|
|
12
|
-
const { thumbnails, className, skeleton, previewNavigation, slidesPerView = 3, hideThumbnailsList, hideDefaultButton, defaultThumbnail, onSelectDefault, } = props;
|
|
12
|
+
const { thumbnails, isLoading, className, skeleton, previewNavigation, slidesPerView = 3, hideThumbnailsList, hideDefaultButton, defaultThumbnail, onSelectDefault, } = props;
|
|
13
13
|
const sliderContainerRef = useRef(null);
|
|
14
14
|
const thumbnailSelectedRef = useRef(null);
|
|
15
15
|
const [selectedThumbnail, setSelectedThumbnail] = useState(0);
|
|
@@ -28,14 +28,9 @@ export const ImageSlider = props => {
|
|
|
28
28
|
const handlePrevThumbnail = () => {
|
|
29
29
|
setSelectedThumbnail(prev => (prev === 0 ? thumbnails.length - 1 : prev - 1));
|
|
30
30
|
};
|
|
31
|
-
// useEffect(() => {
|
|
32
|
-
// handleScrollToImage();
|
|
33
|
-
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
-
// }, [selectedThumbnail]);
|
|
35
31
|
return (React.createElement(ImageSliderStyled, { className: className || '', "$skeleton": skeleton, "$slidesPerView": slidesPerView, vertical: true, gap: 10 },
|
|
36
|
-
React.createElement(Flex, { className: "thumbnail-preview-container", ref: thumbnailSelectedRef }, thumbnails.map((url, index) => (React.createElement("div", { key: `image-big_${url}_${index * 2}`, className: clsx('image-container--big', {
|
|
32
|
+
React.createElement(Flex, { className: "thumbnail-preview-container", ref: thumbnailSelectedRef }, isLoading ? (React.createElement(Spin, { spinning: true })) : (thumbnails.map((url, index) => (React.createElement("div", { key: `image-big_${url}_${index * 2}`, className: clsx('image-container--big', {
|
|
37
33
|
'image-container--default': defaultThumbnailInternal === index,
|
|
38
|
-
// 'image-container--default': isSelectedDefault,
|
|
39
34
|
}) },
|
|
40
35
|
url ? (React.createElement(Image, { preview: false, width: "80%", height: "96%", src: thumbnails[index] })) : null,
|
|
41
36
|
hideDefaultButton ? null : (React.createElement(Button, { className: "set-default-button", onClick: () => {
|
|
@@ -45,16 +40,16 @@ export const ImageSlider = props => {
|
|
|
45
40
|
}
|
|
46
41
|
} },
|
|
47
42
|
defaultThumbnailInternal === index ? (React.createElement(Icon, { type: "icon-ants-check", style: { fontSize: '12px' } })) : null,
|
|
48
|
-
defaultThumbnailInternal === index ? 'Default thumbnail' : 'Set as default')))))),
|
|
49
|
-
hideThumbnailsList ? null : (React.createElement(Flex, { gap: 10, className: "thumbnail-slider-container", ref: sliderContainerRef }, thumbnails.map((url, index) => (React.createElement("div", { key: `${url}_${index * 2}`, className: clsx('image-container--small', {
|
|
43
|
+
defaultThumbnailInternal === index ? 'Default thumbnail' : 'Set as default'))))))),
|
|
44
|
+
hideThumbnailsList ? null : (React.createElement(Flex, { gap: 10, className: "thumbnail-slider-container", ref: sliderContainerRef }, isLoading ? (React.createElement(Spin, { spinning: true })) : (thumbnails.map((url, index) => (React.createElement("div", { key: `${url}_${index * 2}`, className: clsx('image-container--small', {
|
|
50
45
|
'image-container--selected': index === selectedThumbnail,
|
|
51
|
-
}), onClick: () => setSelectedThumbnail(index) }, url ? React.createElement(Image, { key: url, preview: false, width: "80%", height: "96%", src: url }) : null))))),
|
|
52
|
-
previewNavigation ? (React.createElement(React.Fragment, null,
|
|
46
|
+
}), onClick: () => setSelectedThumbnail(index) }, url ? (React.createElement(Image, { key: url, preview: false, width: "80%", height: "96%", src: url })) : null)))))),
|
|
47
|
+
previewNavigation && !isLoading ? (React.createElement(React.Fragment, null,
|
|
53
48
|
React.createElement("div", { className: "change-preview-button change-preview-button--left", onClick: handlePrevThumbnail },
|
|
54
49
|
React.createElement(Icon, { type: "icon-ants-angle-left" })),
|
|
55
50
|
React.createElement("div", { className: "change-preview-button change-preview-button--right", onClick: handleNextThumbnail },
|
|
56
51
|
React.createElement(Icon, { type: "icon-ants-angle-right" })))) : null,
|
|
57
|
-
hideThumbnailsList ? null : (React.createElement(React.Fragment, null,
|
|
52
|
+
hideThumbnailsList || isLoading ? null : (React.createElement(React.Fragment, null,
|
|
58
53
|
React.createElement("div", { className: "slider-button slider-button--left", onClick: handlePrevThumbnail },
|
|
59
54
|
React.createElement(Icon, { type: "icon-ants-angle-left" })),
|
|
60
55
|
React.createElement("div", { className: "slider-button slider-button--right", onClick: handleNextThumbnail },
|
|
@@ -68,6 +68,20 @@ export const ImageSliderStyled = styled(Flex) `
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
.thumbnail-preview-container:has(.antsomi-spin),
|
|
72
|
+
.thumbnail-slider-container:has(.antsomi-spin) {
|
|
73
|
+
box-shadow: rgba(159, 180, 180, 0.2) 0px 2px 8px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.thumbnail-preview-container .antsomi-spin,
|
|
77
|
+
.thumbnail-slider-container .antsomi-spin {
|
|
78
|
+
width: 100%;
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
align-items: center;
|
|
82
|
+
background-color: #fcfcfc;
|
|
83
|
+
}
|
|
84
|
+
|
|
71
85
|
.thumbnail-preview-container {
|
|
72
86
|
width: 330px;
|
|
73
87
|
overflow-x: scroll;
|
|
@@ -79,6 +93,10 @@ export const ImageSliderStyled = styled(Flex) `
|
|
|
79
93
|
& > div {
|
|
80
94
|
overflow: hidden;
|
|
81
95
|
}
|
|
96
|
+
|
|
97
|
+
.antsomi-spin {
|
|
98
|
+
height: 230px;
|
|
99
|
+
}
|
|
82
100
|
}
|
|
83
101
|
|
|
84
102
|
.thumbnail-slider-container {
|
|
@@ -86,6 +104,10 @@ export const ImageSliderStyled = styled(Flex) `
|
|
|
86
104
|
width: 330px;
|
|
87
105
|
overflow-x: scroll;
|
|
88
106
|
scrollbar-width: none;
|
|
107
|
+
|
|
108
|
+
.antsomi-spin {
|
|
109
|
+
height: 72px;
|
|
110
|
+
}
|
|
89
111
|
}
|
|
90
112
|
|
|
91
113
|
.image-container {
|