@antscorp/antsomi-ui 1.3.5-beta.231 → 1.3.5-beta.233
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/components/ImageSlider/BigImage.js +2 -6
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/SmallImage.js +2 -6
- package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +1 -1
- package/es/utils/common.d.ts +1 -1
- package/es/utils/common.js +8 -5
- package/es/utils/templateListing.js +17 -2
- package/package.json +1 -1
|
@@ -2,16 +2,12 @@ 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
|
-
import { checkShowSkeletonBaseUrl } from '@antscorp/antsomi-ui/es/utils';
|
|
5
|
+
import { checkShowSkeletonBaseUrl, getUrlNoCache } from '@antscorp/antsomi-ui/es/utils';
|
|
6
6
|
export const BigImage = React.memo(props => {
|
|
7
7
|
const { url, isDefaultThumbnail, isHideDefaultButton, index, showSkeleton, onClickDefaultButton, } = props;
|
|
8
8
|
const currentTime = useMemo(() => new Date(), []);
|
|
9
9
|
const timeGenerated = Math.floor(currentTime.getTime() / 1000 - (currentTime.getTime() % 3)) * 1000;
|
|
10
|
-
const urlNoCache = url
|
|
11
|
-
? url.includes('nocache') || url.startsWith('data:image')
|
|
12
|
-
? url
|
|
13
|
-
: `${url}?nocache=${timeGenerated}`
|
|
14
|
-
: undefined;
|
|
10
|
+
const urlNoCache = getUrlNoCache(url, timeGenerated);
|
|
15
11
|
const showSkeletonMemo = showSkeleton !== undefined ? showSkeleton : checkShowSkeletonBaseUrl(urlNoCache);
|
|
16
12
|
return (React.createElement("div", { className: `image-container--big ${!showSkeletonMemo ? 'hide-skeleton' : ''}` },
|
|
17
13
|
url ? (React.createElement(Image, { preview: false, width: "100%", height: "100%", src: urlNoCache })) : null,
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { Image } from 'antd';
|
|
3
|
-
import { checkShowSkeletonBaseUrl } from '@antscorp/antsomi-ui/es/utils';
|
|
3
|
+
import { checkShowSkeletonBaseUrl, getUrlNoCache } from '@antscorp/antsomi-ui/es/utils';
|
|
4
4
|
export const SmallImage = React.memo(props => {
|
|
5
5
|
const { url, isSelected, index, onClick, showSkeleton } = props;
|
|
6
6
|
const currentTime = useMemo(() => new Date(), []);
|
|
7
7
|
const timeGenerated = Math.floor(currentTime.getTime() / 1000 - (currentTime.getTime() % 3)) * 1000;
|
|
8
|
-
const urlNoCache = url
|
|
9
|
-
? url.includes('nocache') || url.startsWith('data:image')
|
|
10
|
-
? url
|
|
11
|
-
: `${url}?nocache=${timeGenerated}`
|
|
12
|
-
: undefined;
|
|
8
|
+
const urlNoCache = getUrlNoCache(url, timeGenerated);
|
|
13
9
|
const showSkeletonMemo = showSkeleton !== undefined ? showSkeleton : checkShowSkeletonBaseUrl(urlNoCache);
|
|
14
10
|
return (React.createElement("div", { className: `image-container--small ${isSelected ? 'image-container--selected' : ''} ${!showSkeletonMemo ? 'hide-skeleton' : ''}`, onClick: () => onClick && onClick(index) }, url ? (React.createElement(Image, { preview: false, width: "100%", height: "100%",
|
|
15
11
|
// src={imageUrl}
|
|
@@ -32,7 +32,7 @@ import { getUrlNoCache, checkShowSkeletonBaseUrl } from '@antscorp/antsomi-ui/es
|
|
|
32
32
|
const cacheValue = new Date().getTime();
|
|
33
33
|
export const ThumbnailCard = memo(props => {
|
|
34
34
|
const [modal, contextHolder] = Modal.useModal();
|
|
35
|
-
const { id, name, width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, thumbnail, removable = true, actionAvailable = true, showSkeleton
|
|
35
|
+
const { id, name, width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, thumbnail, removable = true, actionAvailable = true, showSkeleton, loading = false, removeModalProps, editBtnProps, previewBtnProps, onClickWrapper } = props, restOfProps = __rest(props, ["id", "name", "width", "height", "thumbnail", "removable", "actionAvailable", "showSkeleton", "loading", "removeModalProps", "editBtnProps", "previewBtnProps", "onClickWrapper"]);
|
|
36
36
|
const _a = removeModalProps || {}, { onOk } = _a, restOfRemoveTemplateModalProps = __rest(_a, ["onOk"]);
|
|
37
37
|
const _b = editBtnProps || {}, { text: editText = 'Use template', onClick: onClickEdit } = _b, restOfEditBtnProps = __rest(_b, ["text", "onClick"]);
|
|
38
38
|
const _c = previewBtnProps || {}, { text: previewText = 'Preview', onClick: onClickPreview } = _c, restOfPreviewBtnProps = __rest(_c, ["text", "onClick"]);
|
package/es/utils/common.d.ts
CHANGED
|
@@ -84,4 +84,4 @@ export declare const simplifyString: (str: string) => string;
|
|
|
84
84
|
*/
|
|
85
85
|
export declare const searchStringQuery: (str: string, queryStr: string) => boolean;
|
|
86
86
|
export declare const isExistedImage: (imageUrl: string) => boolean;
|
|
87
|
-
export declare const getUrlNoCache: (url?: string, cacheValue?: number | string) => string
|
|
87
|
+
export declare const getUrlNoCache: (url?: string, cacheValue?: number | string) => string;
|
package/es/utils/common.js
CHANGED
|
@@ -476,10 +476,13 @@ export const isExistedImage = (imageUrl) => {
|
|
|
476
476
|
}
|
|
477
477
|
};
|
|
478
478
|
export const getUrlNoCache = (url = '', cacheValue = 0) => {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
479
|
+
let urlNoCache = url;
|
|
480
|
+
if (urlNoCache.includes('nocache') || url.startsWith('data:image')) {
|
|
481
|
+
urlNoCache = url;
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
const newUrl = new URL(url);
|
|
485
|
+
newUrl.searchParams.append('nocache', `${cacheValue}`);
|
|
486
|
+
}
|
|
484
487
|
return urlNoCache;
|
|
485
488
|
};
|
|
@@ -10,5 +10,20 @@ export const getCategoriesFromObjectTemplate = (objectTemplate) => {
|
|
|
10
10
|
});
|
|
11
11
|
return categories;
|
|
12
12
|
};
|
|
13
|
-
export const checkShowSkeletonBaseUrl = (url = '') =>
|
|
14
|
-
|
|
13
|
+
export const checkShowSkeletonBaseUrl = (url = '') => {
|
|
14
|
+
if (url.includes('type')) {
|
|
15
|
+
switch (true) {
|
|
16
|
+
case url.includes('media'):
|
|
17
|
+
return true;
|
|
18
|
+
case url.includes('email'): {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
default:
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return (`${url || ''}`.includes('base64-img') &&
|
|
27
|
+
['jn_thumb_', 'v_thumb_'].every(prefix => !`${url || ''}`.includes(prefix)));
|
|
28
|
+
}
|
|
29
|
+
};
|