@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.
@@ -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", value: defaultTemplateDesc, debounce: 100, maxLength: 400, onAfterChange: value => handleChangeValue({ description: value }) })),
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: url.includes('nocache') ? url : `${url}?nocache=${new Date().getTime()}` })) : null,
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
- 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%", src: url.includes('nocache') ? url : `${url}?nocache=${new Date().getTime()}` })) : null));
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
  });
@@ -8,6 +8,7 @@ interface TemplateListingOptions {
8
8
  serviceAuth: TServiceAuth;
9
9
  config: TTemplateListingConfig;
10
10
  checkedCategoriesDefault?: TCheckedCategories;
11
+ templateListingSelector?: string;
11
12
  }
12
13
  /**
13
14
  * Represents the state of a system with generic data types.
@@ -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://images.unsplash.com/photo-1515734674582-29010bb37906?q=80&w=1887&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
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
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.145",
3
+ "version": "1.3.5-beta.147",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",