@antscorp/antsomi-ui 1.3.5-beta.264 → 1.3.5-beta.265
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/ImageEditor/ImageEditor.d.ts +1 -0
- package/es/components/molecules/ImageEditor/ImageEditor.js +2 -2
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.js +10 -14
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +6 -1
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ interface ImageEditorProps {
|
|
|
13
13
|
imageUrl?: string;
|
|
14
14
|
defaultValue?: CanvasState;
|
|
15
15
|
showSelection?: boolean;
|
|
16
|
+
style?: Omit<React.CSSProperties, 'width'>;
|
|
16
17
|
}
|
|
17
18
|
export declare const ImageEditor: React.ForwardRefExoticComponent<ImageEditorProps & React.RefAttributes<ImageResizeHandle>>;
|
|
18
19
|
export {};
|
|
@@ -25,7 +25,7 @@ import { downloadURI, getTransformData } from './utils';
|
|
|
25
25
|
import { StageWrapperStyled } from './styled';
|
|
26
26
|
const SNAP_THRESHOLD = 5;
|
|
27
27
|
export const ImageEditor = React.forwardRef((props, ref) => {
|
|
28
|
-
const { defaultValue, className, width, height, hideAction, imageUrl = '', showSelection, } = props;
|
|
28
|
+
const { defaultValue, className, width, height, hideAction, imageUrl = '', showSelection, style, } = props;
|
|
29
29
|
const [color, setColor] = useState('#000');
|
|
30
30
|
const [drawAction, setDrawAction] = useState(DrawAction.Select);
|
|
31
31
|
const [cropZone, setCropZone] = useState();
|
|
@@ -618,7 +618,7 @@ export const ImageEditor = React.forwardRef((props, ref) => {
|
|
|
618
618
|
target.setAbsolutePosition(newPos);
|
|
619
619
|
// selectedNode.setAbsolutePosition(newPos);
|
|
620
620
|
}, []);
|
|
621
|
-
return (React.createElement("div", { style: { width: `${width}px` } },
|
|
621
|
+
return (React.createElement("div", { style: Object.assign({ width: `${width}px` }, (style || {})) },
|
|
622
622
|
React.createElement(Flex, { justify: "space-between", align: "center", style: { marginBottom: '6px', display: hideAction ? 'none' : 'flex' } },
|
|
623
623
|
React.createElement(Flex, { gap: 4 },
|
|
624
624
|
PAINT_OPTIONS.map(({ id, label, icon }) => (React.createElement(Button, { key: id, "aria-label": label, icon: React.createElement(Icon, { type: icon, style: { fontSize: '16px' } }), onClick: () => {
|
|
@@ -110,26 +110,22 @@ export const ImageSlider = props => {
|
|
|
110
110
|
const currentTime = useMemo(() => new Date(), []);
|
|
111
111
|
const timeGenerated = Math.floor(currentTime.getTime() / 1000 - (currentTime.getTime() % 3)) * 1000;
|
|
112
112
|
const currentEditing = useMemo(() => editingThumbnail !== null && editingThumbnail !== void 0 ? editingThumbnail : uploadThumbnail, [editingThumbnail, uploadThumbnail]);
|
|
113
|
-
const imageResizeProps = {
|
|
114
|
-
className: 'image-resize-wrapper',
|
|
115
|
-
width: imageWidth,
|
|
116
|
-
height: imageHeight,
|
|
117
|
-
ref: imageResizeRef,
|
|
118
|
-
hideAction: true,
|
|
119
|
-
imageUrl:
|
|
120
|
-
// latestCanvas && isEditPrevious
|
|
121
|
-
(latestCanvas === null || latestCanvas === void 0 ? void 0 : latestCanvas[currentEditing])
|
|
122
|
-
? undefined
|
|
123
|
-
: getUrlNoCache(thumbnails[currentEditing], timeGenerated),
|
|
124
|
-
defaultValue: latestCanvas === null || latestCanvas === void 0 ? void 0 : latestCanvas[currentEditing],
|
|
125
|
-
};
|
|
126
113
|
const ImageResizeComponent = useFabric ? ImageResizeTuiEditor : ImageResize;
|
|
127
114
|
const showSkeletonMemo = skeleton !== undefined
|
|
128
115
|
? skeleton
|
|
129
116
|
: checkShowSkeletonBaseUrl(getUrlNoCache(thumbnails[currentEditing], timeGenerated));
|
|
130
117
|
return (React.createElement(ImageSliderStyled, { className: className || '', "$skeleton": skeleton, "$imageWidth": imageWidth, "$smallImageWidth": smallImageWidth, "$imageHeight": imageHeight, vertical: true, gap: 10 },
|
|
131
118
|
React.createElement(Flex, { vertical: true, style: { zIndex: 25, display: !isNil(currentEditing) ? 'flex' : 'none' }, className: `edit-thumbnail-container ${!isNil(currentEditing) ? 'is-editing' : ''}` },
|
|
132
|
-
React.createElement(ImageResizeComponent,
|
|
119
|
+
React.createElement(ImageResizeComponent, { style: { visibility: typeof uploadThumbnail === 'number' ? 'hidden' : 'visible' }, className: "image-resize-wrapper", width: imageWidth, height: imageHeight, ref: imageResizeRef, hideAction: true, imageUrl:
|
|
120
|
+
// latestCanvas && isEditPrevious
|
|
121
|
+
(latestCanvas === null || latestCanvas === void 0 ? void 0 : latestCanvas[currentEditing])
|
|
122
|
+
? undefined
|
|
123
|
+
: getUrlNoCache(thumbnails[currentEditing], timeGenerated),
|
|
124
|
+
// imageUrl={getUrlNoCache(
|
|
125
|
+
// thumbnails[editingThumbnail ?? (uploadThumbnail as number)],
|
|
126
|
+
// timeGenerated,
|
|
127
|
+
// )}
|
|
128
|
+
defaultValue: latestCanvas === null || latestCanvas === void 0 ? void 0 : latestCanvas[currentEditing] }),
|
|
133
129
|
typeof uploadThumbnail !== 'number' ? null : (React.createElement(Flex, { className: `image-upload-zone ${!showSkeletonMemo ? 'hide-skeleton' : ''}` },
|
|
134
130
|
React.createElement(Icon, { type: "icon-ants-upload-fill", style: { fontSize: '40px' } }),
|
|
135
131
|
React.createElement(Flex, { vertical: true, align: "flex-start" },
|
|
@@ -80,7 +80,12 @@ export const ImageSliderStyled = styled(Flex) `
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
&:not(.hide-skeleton) {
|
|
83
|
-
background: ${props =>
|
|
83
|
+
background: ${props => {
|
|
84
|
+
var _a;
|
|
85
|
+
return props.$skeleton
|
|
86
|
+
? `url(${SkeletonBg}) no-repeat center center`
|
|
87
|
+
: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorBgSkeleton;
|
|
88
|
+
}};
|
|
84
89
|
|
|
85
90
|
background-size: 90% 90%;
|
|
86
91
|
}
|