@antscorp/antsomi-ui 1.3.5-resize-thumbnail.2 → 1.3.5-resize-thumbnail.4

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.
@@ -469,7 +469,7 @@ export const ImageEditor = React.forwardRef((props, ref) => {
469
469
  React.createElement(StageWrapperStyled, { "$width": width, "$height": height, className: className || '' },
470
470
  React.createElement(Stage, { id: "image-editor", width: width, height: height, ref: stageRef, onMouseUp: onStageMouseUp, onMouseDown: onStageMouseDown, onMouseMove: onStageMouseMove },
471
471
  React.createElement(Layer, null,
472
- React.createElement(KonvaRect, { x: 0, y: 0, height: width, width: height, fill: "white", id: "bg", onClick: onBgClick }),
472
+ React.createElement(KonvaRect, { x: 0, y: 0, height: width, width: height, fill: "transparent", id: "bg", onClick: onBgClick }),
473
473
  image && (React.createElement(KonvaImage, Object.assign({ image: image }, imageCoordinate, { name: "shape", onClick: e => onShapeClick(e, imageCoordinate.id, ShapeObject.Image), onTap: e => onShapeClick(e, imageCoordinate.id, ShapeObject.Image), draggable: isDraggable, onDragEnd: ({ target: { attrs } }) => {
474
474
  if (isDraggable)
475
475
  dispatch({
@@ -41,6 +41,12 @@ export const ImageSliderStyled = styled(Flex) `
41
41
  margin-bottom: 40px;
42
42
  }
43
43
 
44
+ .image-resize-wrapper {
45
+ background: ${props => props.$skeleton ? `url(${SkeletonBg}) no-repeat center center` : 'unset'};
46
+
47
+ background-size: contain;
48
+ }
49
+
44
50
  .image-resize-wrapper,
45
51
  .image-upload-zone {
46
52
  border: 1px solid ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.blue1_1};
@@ -10,7 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  // Libraries
13
- import React, { memo, useState } from 'react';
13
+ import React, { memo, useEffect, useState } from 'react';
14
+ import { isNil } from 'lodash';
14
15
  // Components
15
16
  import { Flex, Spin } from '../../atoms';
16
17
  import { Banner, Information, SimilarTemplate, ThumbnailSlider } from './components';
@@ -22,6 +23,11 @@ export const PreviewTemplateModal = memo(props => {
22
23
  const { bannerProps, thumbnailProps = THUMBNAIL_DEFAULT, similarTemplateProps = SIMILAR_TEMPLATE_DEFAULT, informationProps, loading = false } = props, restOfProps = __rest(props, ["bannerProps", "thumbnailProps", "similarTemplateProps", "informationProps", "loading"]);
23
24
  // States
24
25
  const [deviceType, setDeviceType] = useState(DEVICE_TYPE.DESKTOP.value);
26
+ useEffect(() => {
27
+ if (!isNil(bannerProps === null || bannerProps === void 0 ? void 0 : bannerProps.deviceType)) {
28
+ setDeviceType(bannerProps.deviceType);
29
+ }
30
+ }, [bannerProps === null || bannerProps === void 0 ? void 0 : bannerProps.deviceType]);
25
31
  return (React.createElement(ModalContainer, Object.assign({ footer: null, centered: true, modalRender: node => React.createElement(ModalWrapper, null, node) }, restOfProps),
26
32
  React.createElement(Spin, { spinning: loading },
27
33
  React.createElement(Flex, { gap: 20 },
@@ -7,13 +7,13 @@ export type TThumbnail = {
7
7
  url: string;
8
8
  };
9
9
  export interface PreviewTemplateModalProps extends ModalProps {
10
- bannerProps?: Omit<BannerProps, 'deviceType'>;
10
+ bannerProps?: BannerProps;
11
11
  thumbnailProps?: ThumbnailProps;
12
12
  similarTemplateProps?: SimilarTemplateProps;
13
13
  informationProps?: Omit<InformationProps, 'deviceType' | 'onDeviceTypeChange'>;
14
14
  }
15
15
  export interface BannerProps extends React.HTMLAttributes<HTMLDivElement> {
16
- deviceType: InformationProps['deviceType'];
16
+ deviceType?: InformationProps['deviceType'];
17
17
  showSkeleton?: boolean;
18
18
  height?: number;
19
19
  children?: React.ReactNode;
@@ -54,6 +54,7 @@ export declare class ObjectTemplate extends Model<TObjectTemplate> {
54
54
  get goal(): number[] | undefined;
55
55
  get channel(): number | undefined;
56
56
  get shareAccess(): TShareAccess | undefined;
57
+ get deviceType(): number | undefined;
57
58
  toJson(): {
58
59
  id: string | number;
59
60
  name: string;
@@ -79,5 +80,6 @@ export declare class ObjectTemplate extends Model<TObjectTemplate> {
79
80
  goal: number[] | undefined;
80
81
  channel: number | undefined;
81
82
  shareAccess: TShareAccess | undefined;
83
+ deviceType: number | undefined;
82
84
  };
83
85
  }
@@ -76,6 +76,9 @@ export class ObjectTemplate extends Model {
76
76
  get shareAccess() {
77
77
  return this.model.share_access;
78
78
  }
79
+ get deviceType() {
80
+ return this.model.device_type;
81
+ }
79
82
  toJson() {
80
83
  return {
81
84
  id: this.id,
@@ -102,6 +105,7 @@ export class ObjectTemplate extends Model {
102
105
  goal: this.goal,
103
106
  channel: this.channel,
104
107
  shareAccess: this.shareAccess,
108
+ deviceType: this.deviceType,
105
109
  };
106
110
  }
107
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-resize-thumbnail.2",
3
+ "version": "1.3.5-resize-thumbnail.4",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",