@antscorp/antsomi-ui 1.3.5-beta.195 → 1.3.5-beta.196

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.
@@ -29,6 +29,7 @@ import { Button, Flex, Typography, Spin } from '../../atoms';
29
29
  // Constants
30
30
  import { THUMBNAIL_CARD_DEFAULT_HEIGHT, THUMBNAIL_CARD_DEFAULT_WIDTH } from './constants';
31
31
  import { getUrlNoCache } from '@antscorp/antsomi-ui/es/utils';
32
+ const cacheValue = new Date().getTime();
32
33
  export const ThumbnailCard = memo(props => {
33
34
  const [modal, contextHolder] = Modal.useModal();
34
35
  const { id, name, width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, thumbnail, removable = true, actionAvailable = true, showSkeleton = true, loading = false, removeModalProps, editBtnProps, previewBtnProps, onClickWrapper } = props, restOfProps = __rest(props, ["id", "name", "width", "height", "thumbnail", "removable", "actionAvailable", "showSkeleton", "loading", "removeModalProps", "editBtnProps", "previewBtnProps", "onClickWrapper"]);
@@ -53,7 +54,7 @@ export const ThumbnailCard = memo(props => {
53
54
  };
54
55
  return (React.createElement(Flex, Object.assign({ gap: 10, vertical: true }, restOfProps, { style: Object.assign({ width }, restOfProps.style) }),
55
56
  React.createElement(ThumbnailCardWrapper, { "$showSkeleton": showSkeletonMemo, style: { height, cursor: actionAvailable ? 'default' : 'pointer' }, onClick: handleWrapperClick },
56
- React.createElement("div", { className: "screen" }, thumbnail && React.createElement("img", { src: getUrlNoCache(thumbnail), alt: "" })),
57
+ React.createElement("div", { className: "screen" }, thumbnail && React.createElement("img", { src: getUrlNoCache(thumbnail, cacheValue), alt: "" })),
57
58
  actionAvailable && !loading && (React.createElement(React.Fragment, null,
58
59
  React.createElement(Flex, { className: "center-action", align: "center", gap: 10, vertical: true },
59
60
  React.createElement(Button, Object.assign({ type: "primary", className: "animate__animated animate__fadeIn" }, restOfEditBtnProps, { onClick: e => {
@@ -77,9 +77,9 @@ export const TemplateListing = memo(props => {
77
77
  items.map((item, index) => {
78
78
  const { id, name, thumbnail } = item || {};
79
79
  const loading = typeof (item === null || item === void 0 ? void 0 : item.name) === 'undefined';
80
- return (React.createElement("div", { key: id || index },
80
+ return (React.createElement("div", { key: id },
81
81
  index === items.length - 2 && React.createElement(LoadMoreBlock, { ref: loadMoreRef }),
82
- React.createElement(ThumbnailCard, Object.assign({ id: id || index, name: name || 'Untitled', loading: loading, width: width * ratio, height: height * ratio, thumbnail: thumbnail, className: `${templateItemProps.className}`, previewBtnProps: {
82
+ React.createElement(ThumbnailCard, Object.assign({ id: id || 0, name: name || 'Untitled', loading: loading, width: width * ratio, height: height * ratio, thumbnail: thumbnail, className: `${templateItemProps.className}`, previewBtnProps: {
83
83
  onClick: handleClickThumbnailPreview,
84
84
  } }, restOfTemplateItemProps))));
85
85
  })),
@@ -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) => string | undefined;
87
+ export declare const getUrlNoCache: (url?: string, cacheValue?: number | string) => string | undefined;
@@ -475,13 +475,11 @@ export const isExistedImage = (imageUrl) => {
475
475
  return false;
476
476
  }
477
477
  };
478
- export const getUrlNoCache = (url = '') => {
479
- const currentTime = new Date();
480
- const timeGenerated = Math.floor(currentTime.getTime() / 1000 - (currentTime.getTime() % 3)) * 1000;
478
+ export const getUrlNoCache = (url = '', cacheValue = 0) => {
481
479
  const urlNoCache = url
482
480
  ? url.includes('nocache') || url.startsWith('data:image')
483
481
  ? url
484
- : `${url}?nocache=${timeGenerated}`
482
+ : `${url}?nocache=${cacheValue}`
485
483
  : undefined;
486
484
  return urlNoCache;
487
485
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.195",
3
+ "version": "1.3.5-beta.196",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",