@antscorp/antsomi-ui 1.3.5-beta.145 → 1.3.5-beta.147
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.js +1 -1
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/BigImage.js +9 -2
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/SmallImage.js +12 -2
- package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +1 -0
- package/es/components/template/TemplateListing/hooks/useTemplateListing.js +11 -1
- package/es/test.js +1 -1
- package/package.json +1 -1
|
@@ -152,7 +152,7 @@ export const TemplateSaveAs = props => {
|
|
|
152
152
|
} }))),
|
|
153
153
|
React.createElement(Flex, { className: "field-container", style: { marginTop: '-20px' } },
|
|
154
154
|
React.createElement(Text, { className: "field-title field-title--middle" }, descriptionLabel || 'Description'),
|
|
155
|
-
React.createElement(Input, { placeholder: descriptionPlaceholder || 'Describe your media template', className: "field-input",
|
|
155
|
+
React.createElement(Input, { placeholder: descriptionPlaceholder || 'Describe your media template', className: "field-input", maxLength: 400, onBlur: e => handleChangeValue({ description: e.target.value }) })),
|
|
156
156
|
React.createElement(Flex, { className: "field-container" },
|
|
157
157
|
React.createElement(Text, { className: "field-title" },
|
|
158
158
|
imageReviewLabel || 'Thumbnail template',
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { Image } from 'antd';
|
|
3
3
|
import { Button } from '@antscorp/antsomi-ui/es/components';
|
|
4
4
|
import Icon from '@antscorp/icons';
|
|
5
5
|
export const BigImage = React.memo(props => {
|
|
6
6
|
const { url, isDefaultThumbnail, isHideDefaultButton, index, onClickDefaultButton } = props;
|
|
7
|
+
const currentTime = useMemo(() => new Date(), []);
|
|
8
|
+
const timeGenerated = Math.floor(currentTime.getTime() / 1000 - (currentTime.getTime() % 3)) * 1000;
|
|
9
|
+
const urlNoCache = url
|
|
10
|
+
? url.includes('nocache')
|
|
11
|
+
? url
|
|
12
|
+
: `${url}?nocache=${timeGenerated}`
|
|
13
|
+
: undefined;
|
|
7
14
|
return (React.createElement("div", { className: "image-container--big" },
|
|
8
|
-
url ? (React.createElement(Image, { preview: false, width: "80%", height: "96%", src:
|
|
15
|
+
url ? (React.createElement(Image, { preview: false, width: "80%", height: "96%", src: urlNoCache })) : null,
|
|
9
16
|
isHideDefaultButton ? null : (React.createElement(Button, { className: "set-default-button", onClick: () => onClickDefaultButton && onClickDefaultButton(index) },
|
|
10
17
|
isDefaultThumbnail ? React.createElement(Icon, { type: "icon-ants-check", style: { fontSize: '12px' } }) : null,
|
|
11
18
|
isDefaultThumbnail ? 'Default thumbnail' : 'Set as default'))));
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { Image } from 'antd';
|
|
3
3
|
export const SmallImage = React.memo(props => {
|
|
4
4
|
const { url, isSelected, index, onClick } = props;
|
|
5
|
-
|
|
5
|
+
const currentTime = useMemo(() => new Date(), []);
|
|
6
|
+
const timeGenerated = Math.floor(currentTime.getTime() / 1000 - (currentTime.getTime() % 3)) * 1000;
|
|
7
|
+
const urlNoCache = url
|
|
8
|
+
? url.includes('nocache')
|
|
9
|
+
? url
|
|
10
|
+
: `${url}?nocache=${timeGenerated}`
|
|
11
|
+
: undefined;
|
|
12
|
+
return (React.createElement("div", { className: `image-container--small ${isSelected ? 'image-container--selected' : ''}`, onClick: () => onClick && onClick(index) }, url ? (React.createElement(Image, { preview: false, width: "80%", height: "96%",
|
|
13
|
+
// src={imageUrl}
|
|
14
|
+
// src={url}
|
|
15
|
+
src: urlNoCache })) : null));
|
|
6
16
|
});
|
|
@@ -35,7 +35,7 @@ import { getShuffleArray } from '@antscorp/antsomi-ui/es/utils';
|
|
|
35
35
|
* @property {Function} onLoadMore - A function to load more template data when scrolling in the template listing.
|
|
36
36
|
*/
|
|
37
37
|
export const useTemplateListing = (options) => {
|
|
38
|
-
const { serviceAuth, config, checkedCategoriesDefault } = options;
|
|
38
|
+
const { serviceAuth, config, checkedCategoriesDefault, templateListingSelector = '.template-listing', } = options;
|
|
39
39
|
const { objectType, categoryCodes, publicLevel, getListType, channel, limitListPerPage = 10, } = config;
|
|
40
40
|
const { message } = App.useApp();
|
|
41
41
|
// Locales
|
|
@@ -211,6 +211,16 @@ export const useTemplateListing = (options) => {
|
|
|
211
211
|
}, {}) || {} })));
|
|
212
212
|
}
|
|
213
213
|
}, [checkedCategoriesDefault]);
|
|
214
|
+
/**
|
|
215
|
+
* When publicLevel or getListType change
|
|
216
|
+
* Scroll template listing to top
|
|
217
|
+
*/
|
|
218
|
+
useDeepCompareEffect(() => {
|
|
219
|
+
const templateListingEl = document.querySelector(templateListingSelector);
|
|
220
|
+
if (templateListingEl) {
|
|
221
|
+
templateListingEl.scrollTop = 0;
|
|
222
|
+
}
|
|
223
|
+
}, [getListType, publicLevel, objectType]);
|
|
214
224
|
// Handles
|
|
215
225
|
const onChangeCheckedCategories = (checkedCategories) => {
|
|
216
226
|
setState(prev => (Object.assign(Object.assign({}, prev), { checkedCategories })));
|
package/es/test.js
CHANGED
|
@@ -48,7 +48,7 @@ const SHARE_ACCESS_DEFAULT_VALUE = {
|
|
|
48
48
|
publicRole: null,
|
|
49
49
|
};
|
|
50
50
|
const thumbnailPortrait = [
|
|
51
|
-
'https://
|
|
51
|
+
'https://upload.wikimedia.org/wikipedia/commons/3/3d/LARGE_elevation.jpg',
|
|
52
52
|
'https://images.unsplash.com/photo-1571423483570-eb27018d1ec0?q=80&w=1887&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
53
53
|
'https://images.creativefabrica.com/products/previews/2023/11/03/jG9YjMvHg/2XfoTnjLlEvPMgjGeu0VIDk96mr-desktop.jpg',
|
|
54
54
|
];
|