@gx-design-vue/image 0.2.0-alpha.0 → 0.2.0-alpha.2
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/dist/Image.d.ts +6 -0
- package/dist/Image.js +322 -0
- package/dist/ImagePreview.d.ts +6 -0
- package/dist/ImagePreview.js +593 -0
- package/dist/g-image.esm.js +1577 -0
- package/dist/g-image.js +1 -0
- package/dist/hooks/useImageBoundary.d.ts +15 -0
- package/dist/hooks/useImageBoundary.js +24 -0
- package/dist/hooks/useImagePreview.d.ts +23 -0
- package/dist/hooks/useImagePreview.js +54 -0
- package/dist/hooks/useImageTransform.d.ts +23 -0
- package/dist/hooks/useImageTransform.js +92 -0
- package/dist/hooks/useMouseEvent.d.ts +22 -0
- package/dist/hooks/useMouseEvent.js +71 -0
- package/dist/hooks/useTouchEvent.d.ts +23 -0
- package/dist/{ImagePreview/hooks → hooks}/useTouchEvent.js +31 -32
- package/dist/index.d.ts +4 -5
- package/dist/index.js +3 -6
- package/dist/interface.d.ts +169 -0
- package/dist/interface.js +1 -0
- package/dist/style/index.d.ts +7 -0
- package/dist/{style.js → style/index.js} +19 -26
- package/dist/style/preview.d.ts +14 -0
- package/dist/style/preview.js +182 -0
- package/dist/theme/augment.d.ts +10 -0
- package/dist/theme/augment.js +1 -0
- package/dist/theme/interface/components.d.ts +10 -0
- package/dist/theme/interface/components.js +1 -0
- package/package.json +9 -8
- package/dist/GImage.d.ts +0 -162
- package/dist/GImage.js +0 -221
- package/dist/ImagePreview/Operations.d.ts +0 -83
- package/dist/ImagePreview/Operations.js +0 -71
- package/dist/ImagePreview/hooks/getFixScaleEleTransPosition.d.ts +0 -19
- package/dist/ImagePreview/hooks/getFixScaleEleTransPosition.js +0 -40
- package/dist/ImagePreview/hooks/useImageTransform.d.ts +0 -39
- package/dist/ImagePreview/hooks/useImageTransform.js +0 -105
- package/dist/ImagePreview/hooks/useMouseEvent.d.ts +0 -14
- package/dist/ImagePreview/hooks/useMouseEvent.js +0 -100
- package/dist/ImagePreview/hooks/useTouchEvent.d.ts +0 -12
- package/dist/ImagePreview/index.d.ts +0 -162
- package/dist/ImagePreview/index.js +0 -303
- package/dist/ImagePreview/props.d.ts +0 -88
- package/dist/ImagePreview/props.js +0 -53
- package/dist/ImagePreview/style.d.ts +0 -30
- package/dist/ImagePreview/style.js +0 -286
- package/dist/ImagePreview/typings.d.ts +0 -19
- package/dist/ImagePreview/typings.js +0 -1
- package/dist/ImagePreview/utils/KeyCode.d.ts +0 -438
- package/dist/ImagePreview/utils/KeyCode.js +0 -173
- package/dist/ImagePreview/utils/addEventListener.d.ts +0 -6
- package/dist/ImagePreview/utils/addEventListener.js +0 -22
- package/dist/ImagePreview/utils/util.d.ts +0 -7
- package/dist/ImagePreview/utils/util.js +0 -8
- package/dist/hooks/useFrameSetState.d.ts +0 -5
- package/dist/hooks/useFrameSetState.js +0 -33
- package/dist/image.esm.js +0 -2374
- package/dist/image.js +0 -1
- package/dist/props.d.ts +0 -84
- package/dist/props.js +0 -66
- package/dist/slots.d.ts +0 -6
- package/dist/slots.js +0 -21
- package/dist/style.d.ts +0 -9
- package/dist/typings.d.ts +0 -6
- package/dist/typings.js +0 -1
- package/dist/utils/aria.d.ts +0 -15
- package/dist/utils/aria.js +0 -16
- package/dist/utils/util.d.ts +0 -4
- package/dist/utils/util.js +0 -8
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { CSSProperties, VNode } from "vue";
|
|
2
|
+
import { CustomRender, WithFalse } from "@gx-design-vue/pro-utils";
|
|
3
|
+
|
|
4
|
+
//#region src/interface.d.ts
|
|
5
|
+
interface TransformType {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
rotate: number;
|
|
9
|
+
scale: number;
|
|
10
|
+
flipX: boolean;
|
|
11
|
+
flipY: boolean;
|
|
12
|
+
}
|
|
13
|
+
type TransformAction = 'flipY' | 'flipX' | 'rotateLeft' | 'rotateRight' | 'zoomIn' | 'zoomOut' | 'close' | 'prev' | 'next' | 'wheel' | 'doubleClick' | 'move' | 'dragRebound' | 'touchZoom' | 'reset';
|
|
14
|
+
type ImageFitType = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
15
|
+
type ImageLoadingType = 'eager' | 'lazy';
|
|
16
|
+
interface PreviewPropsIcons {
|
|
17
|
+
close?: WithFalse<CustomRender>;
|
|
18
|
+
rotateLeft?: WithFalse<CustomRender>;
|
|
19
|
+
rotateRight?: WithFalse<CustomRender>;
|
|
20
|
+
zoomIn?: WithFalse<CustomRender>;
|
|
21
|
+
zoomOut?: WithFalse<CustomRender>;
|
|
22
|
+
copy?: WithFalse<CustomRender>;
|
|
23
|
+
download?: WithFalse<CustomRender>;
|
|
24
|
+
left?: WithFalse<CustomRender>;
|
|
25
|
+
right?: WithFalse<CustomRender>;
|
|
26
|
+
flipX?: WithFalse<CustomRender>;
|
|
27
|
+
flipY?: WithFalse<CustomRender>;
|
|
28
|
+
}
|
|
29
|
+
interface ImagePreviewConfig {
|
|
30
|
+
urls?: string[];
|
|
31
|
+
mask?: VNode | boolean | {
|
|
32
|
+
blur?: boolean;
|
|
33
|
+
};
|
|
34
|
+
maskClass?: string;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
zIndex?: number;
|
|
37
|
+
current?: number;
|
|
38
|
+
infinite?: boolean;
|
|
39
|
+
getContainer?: string;
|
|
40
|
+
onHideOnClickModal?: boolean;
|
|
41
|
+
countRender?: WithFalse<(current: number, total: number) => CustomRender>;
|
|
42
|
+
icons?: PreviewPropsIcons;
|
|
43
|
+
}
|
|
44
|
+
interface GImageProps {
|
|
45
|
+
rootClass?: string;
|
|
46
|
+
prefixCls?: string;
|
|
47
|
+
src?: string;
|
|
48
|
+
alt?: string;
|
|
49
|
+
width?: number;
|
|
50
|
+
height?: number;
|
|
51
|
+
size?: number;
|
|
52
|
+
fit?: ImageFitType;
|
|
53
|
+
loading?: ImageLoadingType;
|
|
54
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | '';
|
|
55
|
+
imageStyle?: CSSProperties;
|
|
56
|
+
imageClass?: string;
|
|
57
|
+
preview?: boolean | ImagePreviewConfig;
|
|
58
|
+
zIndex?: number;
|
|
59
|
+
lazy?: boolean;
|
|
60
|
+
scrollContainer?: string | HTMLElement;
|
|
61
|
+
placeholder?: WithFalse<CustomRender>;
|
|
62
|
+
fallback?: WithFalse<CustomRender>;
|
|
63
|
+
onLoad?: (event: Event) => void;
|
|
64
|
+
onError?: (event: Event) => void;
|
|
65
|
+
onClick?: (info: 'loaded' | 'error' | 'success') => void;
|
|
66
|
+
'onUpdate:open'?: (open: boolean) => void;
|
|
67
|
+
}
|
|
68
|
+
interface GImageEmits {
|
|
69
|
+
click: GImageProps['onClick'];
|
|
70
|
+
load: GImageProps['onLoad'];
|
|
71
|
+
error: GImageProps['onError'];
|
|
72
|
+
}
|
|
73
|
+
interface GImageSlots {
|
|
74
|
+
default?: () => any;
|
|
75
|
+
placeholder?: () => any;
|
|
76
|
+
fallback?: () => any;
|
|
77
|
+
mask?: () => any;
|
|
78
|
+
close?: () => any;
|
|
79
|
+
left?: () => any;
|
|
80
|
+
right?: () => any;
|
|
81
|
+
countRender?: () => any;
|
|
82
|
+
rotateLeft?: () => any;
|
|
83
|
+
rotateRight?: () => any;
|
|
84
|
+
zoomIn?: () => any;
|
|
85
|
+
zoomOut?: () => any;
|
|
86
|
+
copy?: () => any;
|
|
87
|
+
download?: () => any;
|
|
88
|
+
flipX?: () => any;
|
|
89
|
+
flipY?: () => any;
|
|
90
|
+
}
|
|
91
|
+
interface GImageExpose {
|
|
92
|
+
setOpen: (open: boolean) => void;
|
|
93
|
+
}
|
|
94
|
+
interface ImagePreviewProps {
|
|
95
|
+
class?: string;
|
|
96
|
+
style?: CSSProperties;
|
|
97
|
+
rootClass?: string;
|
|
98
|
+
prefixCls?: string;
|
|
99
|
+
urls: string[];
|
|
100
|
+
open?: boolean;
|
|
101
|
+
scaleStep?: number;
|
|
102
|
+
minScale?: number;
|
|
103
|
+
maxScale?: number;
|
|
104
|
+
movable?: boolean;
|
|
105
|
+
disabled?: boolean;
|
|
106
|
+
zIndex?: number;
|
|
107
|
+
current?: number;
|
|
108
|
+
infinite?: boolean;
|
|
109
|
+
getContainer?: string;
|
|
110
|
+
onHideOnClickModal?: boolean;
|
|
111
|
+
mask?: VNode | boolean | {
|
|
112
|
+
blur?: boolean;
|
|
113
|
+
};
|
|
114
|
+
maskClass?: string;
|
|
115
|
+
mousePosition?: {
|
|
116
|
+
x: number;
|
|
117
|
+
y: number;
|
|
118
|
+
} | null;
|
|
119
|
+
countRender?: WithFalse<(current: number, total: number) => CustomRender>;
|
|
120
|
+
icons?: PreviewPropsIcons;
|
|
121
|
+
onClose?: () => void;
|
|
122
|
+
onTransform?: (info: {
|
|
123
|
+
transform: TransformType;
|
|
124
|
+
action: TransformAction;
|
|
125
|
+
}) => void;
|
|
126
|
+
onOpenChange?: (value: boolean) => void;
|
|
127
|
+
'onUpdate:open'?: (value: boolean) => void;
|
|
128
|
+
}
|
|
129
|
+
interface ImagePreviewEmits {
|
|
130
|
+
close: ImagePreviewProps['onClose'];
|
|
131
|
+
transform: ImagePreviewProps['onTransform'];
|
|
132
|
+
'update:open': ImagePreviewProps['onUpdate:open'];
|
|
133
|
+
}
|
|
134
|
+
interface ImagePreviewSlots {
|
|
135
|
+
default?: () => any;
|
|
136
|
+
close?: () => any;
|
|
137
|
+
left?: () => any;
|
|
138
|
+
right?: () => any;
|
|
139
|
+
countRender?: () => any;
|
|
140
|
+
rotateLeft?: () => any;
|
|
141
|
+
rotateRight?: () => any;
|
|
142
|
+
zoomIn?: () => any;
|
|
143
|
+
zoomOut?: () => any;
|
|
144
|
+
copy?: () => any;
|
|
145
|
+
download?: () => any;
|
|
146
|
+
flipX?: () => any;
|
|
147
|
+
flipY?: () => any;
|
|
148
|
+
}
|
|
149
|
+
interface ImagePreviewExpose {
|
|
150
|
+
setOpen: (open: boolean) => void;
|
|
151
|
+
}
|
|
152
|
+
interface ForwardGImageType {
|
|
153
|
+
new (props: GImageProps): {
|
|
154
|
+
$props: GImageProps;
|
|
155
|
+
$slots: GImageSlots;
|
|
156
|
+
} & GImageExpose;
|
|
157
|
+
}
|
|
158
|
+
interface ForwardImagePreviewType {
|
|
159
|
+
new (props: ImagePreviewProps): {
|
|
160
|
+
$props: ImagePreviewProps;
|
|
161
|
+
$slots: ImagePreviewSlots;
|
|
162
|
+
} & ImagePreviewExpose;
|
|
163
|
+
}
|
|
164
|
+
type GImageSlotNames = keyof GImageSlots;
|
|
165
|
+
type PreviewSlotNames = keyof ImagePreviewSlots;
|
|
166
|
+
type UpdateTransformFunc = (newTransform: Partial<TransformType>, action: TransformAction) => void;
|
|
167
|
+
type DispatchZoomChangeFunc = (ratio: number, action: TransformAction, centerX?: number, centerY?: number, isTouch?: boolean) => void;
|
|
168
|
+
//#endregion
|
|
169
|
+
export { DispatchZoomChangeFunc, ForwardGImageType, ForwardImagePreviewType, GImageEmits, GImageExpose, GImageProps, GImageSlotNames, GImageSlots, ImageFitType, ImageLoadingType, ImagePreviewConfig, ImagePreviewEmits, ImagePreviewExpose, ImagePreviewProps, ImagePreviewSlots, PreviewPropsIcons, PreviewSlotNames, TransformAction, TransformType, UpdateTransformFunc };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/style/index.d.ts
|
|
4
|
+
type ComponentToken = Record<string, any>;
|
|
5
|
+
declare const _default: (prefixCls: _$vue.Ref<string>, rootCls?: _$vue.Ref<string | undefined>) => readonly [_$vue.Ref<string, string>, _$vue.ComputedRef<string | undefined>];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { ComponentToken, _default as default };
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const fullSize = {
|
|
5
|
-
width: "100%",
|
|
6
|
-
height: "100%"
|
|
7
|
-
};
|
|
8
|
-
const textEllipsis = {
|
|
9
|
-
overflow: "hidden",
|
|
10
|
-
whiteSpace: "nowrap",
|
|
11
|
-
textOverflow: "ellipsis"
|
|
12
|
-
};
|
|
13
|
-
function genImageMaskStyle(token) {
|
|
1
|
+
import { proGenStyleHooks, unit } from "@gx-design-vue/pro-provider";
|
|
2
|
+
//#region src/style/index.ts
|
|
3
|
+
const genImageMaskStyle = (token) => {
|
|
14
4
|
const { motionDurationSlow, paddingXXS, marginXXS, colorTextLightSolid } = token;
|
|
15
|
-
const iconCls =
|
|
5
|
+
const iconCls = ".anticon";
|
|
16
6
|
return {
|
|
17
7
|
position: "absolute",
|
|
18
8
|
inset: 0,
|
|
@@ -20,12 +10,14 @@ function genImageMaskStyle(token) {
|
|
|
20
10
|
alignItems: "center",
|
|
21
11
|
justifyContent: "center",
|
|
22
12
|
color: colorTextLightSolid,
|
|
23
|
-
background:
|
|
13
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
24
14
|
cursor: "pointer",
|
|
25
15
|
opacity: 0,
|
|
26
16
|
transition: `opacity ${motionDurationSlow}`,
|
|
27
17
|
[`.${token.componentCls}-mask-info`]: {
|
|
28
|
-
|
|
18
|
+
overflow: "hidden",
|
|
19
|
+
whiteSpace: "nowrap",
|
|
20
|
+
textOverflow: "ellipsis",
|
|
29
21
|
padding: `0 ${unit(paddingXXS)}`,
|
|
30
22
|
[iconCls]: {
|
|
31
23
|
marginInlineEnd: marginXXS,
|
|
@@ -33,14 +25,12 @@ function genImageMaskStyle(token) {
|
|
|
33
25
|
}
|
|
34
26
|
}
|
|
35
27
|
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
};
|
|
29
|
+
const genImageBaseStyle = (token) => {
|
|
30
|
+
const fullSize = {
|
|
31
|
+
width: "100%",
|
|
32
|
+
height: "100%"
|
|
41
33
|
};
|
|
42
|
-
}
|
|
43
|
-
const genImageStyle = (token) => {
|
|
44
34
|
return { [token.componentCls]: {
|
|
45
35
|
display: "inline-block",
|
|
46
36
|
position: "relative",
|
|
@@ -68,11 +58,14 @@ const genImageStyle = (token) => {
|
|
|
68
58
|
alignItems: "center",
|
|
69
59
|
justifyContent: "center"
|
|
70
60
|
},
|
|
71
|
-
[`${token.componentCls}-placeholder`]: {
|
|
61
|
+
[`${token.componentCls}-placeholder`]: {
|
|
62
|
+
position: "absolute",
|
|
63
|
+
inset: 0
|
|
64
|
+
},
|
|
72
65
|
[`${token.componentCls}-mask`]: { ...genImageMaskStyle(token) },
|
|
73
66
|
[`${token.componentCls}-mask:hover`]: { opacity: 1 }
|
|
74
67
|
} };
|
|
75
68
|
};
|
|
76
|
-
|
|
69
|
+
var style_default = proGenStyleHooks("GImage", (token) => [genImageBaseStyle(token)]);
|
|
77
70
|
//#endregion
|
|
78
|
-
export {
|
|
71
|
+
export { style_default as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/style/preview.d.ts
|
|
4
|
+
interface ComponentToken {
|
|
5
|
+
zIndexPopup: string | number;
|
|
6
|
+
previewOperationSize: string | number;
|
|
7
|
+
previewOperationColor: string;
|
|
8
|
+
previewOperationHoverColor: string;
|
|
9
|
+
previewOperationColorDisabled: string;
|
|
10
|
+
imagePreviewSwitchSize: string | number;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: (prefixCls: _$vue.Ref<string>, rootCls?: _$vue.Ref<string | undefined>) => readonly [_$vue.Ref<string, string>, _$vue.ComputedRef<string | undefined>];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ComponentToken, _default as default };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { proGenStyleHooks, unit } from "@gx-design-vue/pro-provider";
|
|
2
|
+
//#region src/style/preview.ts
|
|
3
|
+
function createPreviewToken(token) {
|
|
4
|
+
return {
|
|
5
|
+
zIndexPopup: `calc(${token.zIndexPopupBase} + 80)`,
|
|
6
|
+
previewOperationColor: token.colorTextDescription,
|
|
7
|
+
previewOperationHoverColor: token.colorText,
|
|
8
|
+
previewOperationColorDisabled: token.colorTextDisabled,
|
|
9
|
+
imagePreviewSwitchSize: token.controlHeightLG,
|
|
10
|
+
previewOperationSize: token.fontSizeLG
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const genPreviewBaseStyle = (token) => {
|
|
14
|
+
const previewCls = token.componentCls;
|
|
15
|
+
const { motionEaseOut, motionDurationSlow, previewOperationSize, zIndexPopup } = token;
|
|
16
|
+
const singleButtonStyle = {
|
|
17
|
+
position: "absolute",
|
|
18
|
+
color: token.previewOperationColor,
|
|
19
|
+
backgroundColor: token.colorBgContainer,
|
|
20
|
+
borderRadius: "50%",
|
|
21
|
+
width: token.controlHeightLG,
|
|
22
|
+
height: token.controlHeightLG,
|
|
23
|
+
padding: 0,
|
|
24
|
+
outline: 0,
|
|
25
|
+
border: 0,
|
|
26
|
+
boxShadow: token.boxShadowTertiary,
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
transition: `all ${motionDurationSlow}`,
|
|
29
|
+
display: "flex",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
fontSize: previewOperationSize,
|
|
33
|
+
"&:hover": {
|
|
34
|
+
color: token.previewOperationHoverColor,
|
|
35
|
+
backgroundColor: token.colorBgContainer
|
|
36
|
+
},
|
|
37
|
+
"&:active": { backgroundColor: token.colorBgContainer },
|
|
38
|
+
svg: { stroke: "currentColor" }
|
|
39
|
+
};
|
|
40
|
+
return { [previewCls]: {
|
|
41
|
+
textAlign: "center",
|
|
42
|
+
inset: 0,
|
|
43
|
+
position: "fixed",
|
|
44
|
+
userSelect: "none",
|
|
45
|
+
zIndex: zIndexPopup,
|
|
46
|
+
[`${previewCls}-mask`]: {
|
|
47
|
+
position: "absolute",
|
|
48
|
+
inset: 0,
|
|
49
|
+
background: `color-mix(in srgb, ${token.colorBgLayout} 90%, transparent)`,
|
|
50
|
+
backdropFilter: "blur(0px)",
|
|
51
|
+
transition: `background-color ${motionDurationSlow}, backdrop-filter ${motionDurationSlow}`,
|
|
52
|
+
[`&${previewCls}-mask-blur`]: { backdropFilter: "blur(4px)" },
|
|
53
|
+
[`&${previewCls}-mask-hidden`]: { display: "none" }
|
|
54
|
+
},
|
|
55
|
+
[`${previewCls}-body`]: {
|
|
56
|
+
position: "absolute",
|
|
57
|
+
inset: 0,
|
|
58
|
+
overflow: "hidden",
|
|
59
|
+
display: "flex",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
pointerEvents: "none",
|
|
63
|
+
"> *": { pointerEvents: "auto" }
|
|
64
|
+
},
|
|
65
|
+
[`${previewCls}-img`]: {
|
|
66
|
+
maxWidth: "100%",
|
|
67
|
+
maxHeight: "70%",
|
|
68
|
+
verticalAlign: "middle",
|
|
69
|
+
transform: "scale3d(1, 1, 1)",
|
|
70
|
+
transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,
|
|
71
|
+
userSelect: "none"
|
|
72
|
+
},
|
|
73
|
+
[`&-movable ${previewCls}-img`]: { cursor: "grab" },
|
|
74
|
+
[`&-moving ${previewCls}-img`]: { cursor: "grabbing" },
|
|
75
|
+
[`${previewCls}-close`]: {
|
|
76
|
+
...singleButtonStyle,
|
|
77
|
+
top: token.marginSM,
|
|
78
|
+
insetInlineEnd: token.marginSM
|
|
79
|
+
},
|
|
80
|
+
[`${previewCls}-switch`]: {
|
|
81
|
+
...singleButtonStyle,
|
|
82
|
+
top: "50%",
|
|
83
|
+
transform: "translateY(-50%)",
|
|
84
|
+
"&-disabled": { "&, &:hover, &:active": {
|
|
85
|
+
color: token.previewOperationColorDisabled,
|
|
86
|
+
backgroundColor: token.colorBgContainer,
|
|
87
|
+
cursor: "not-allowed"
|
|
88
|
+
} },
|
|
89
|
+
"&-prev": { insetInlineStart: token.marginSM },
|
|
90
|
+
"&-next": { insetInlineEnd: token.marginSM }
|
|
91
|
+
},
|
|
92
|
+
[`${previewCls}-footer`]: {
|
|
93
|
+
position: "absolute",
|
|
94
|
+
bottom: token.marginXL,
|
|
95
|
+
left: {
|
|
96
|
+
_skip_check_: true,
|
|
97
|
+
value: "50%"
|
|
98
|
+
},
|
|
99
|
+
display: "flex",
|
|
100
|
+
flexDirection: "column",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
color: token.previewOperationColor,
|
|
103
|
+
transform: "translateX(-50%)",
|
|
104
|
+
gap: token.marginXS
|
|
105
|
+
},
|
|
106
|
+
[`${previewCls}-progress`]: { color: token.previewOperationColor },
|
|
107
|
+
[`${previewCls}-actions`]: {
|
|
108
|
+
display: "flex",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
gap: token.marginXXS,
|
|
111
|
+
padding: token.paddingXXS,
|
|
112
|
+
color: token.previewOperationColor,
|
|
113
|
+
backgroundColor: token.colorBgContainer,
|
|
114
|
+
border: `${unit(token.lineWidth)} ${token.lineType} ${token.colorFillTertiary}`,
|
|
115
|
+
borderRadius: token.borderRadiusLG,
|
|
116
|
+
fontSize: previewOperationSize,
|
|
117
|
+
"&-action": {
|
|
118
|
+
color: "inherit",
|
|
119
|
+
background: "transparent",
|
|
120
|
+
border: 0,
|
|
121
|
+
font: "inherit",
|
|
122
|
+
lineHeight: 1,
|
|
123
|
+
width: token.controlHeight,
|
|
124
|
+
height: token.controlHeight,
|
|
125
|
+
padding: 0,
|
|
126
|
+
cursor: "pointer",
|
|
127
|
+
transition: `all ${motionDurationSlow}`,
|
|
128
|
+
display: "flex",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
borderRadius: token.borderRadius,
|
|
132
|
+
userSelect: "none",
|
|
133
|
+
[`&:not(${previewCls}-actions-action-disabled):hover`]: {
|
|
134
|
+
color: token.colorTextSecondary,
|
|
135
|
+
backgroundColor: token.colorFillTertiary
|
|
136
|
+
},
|
|
137
|
+
[`&:not(${previewCls}-actions-action-disabled):active`]: {
|
|
138
|
+
color: token.colorText,
|
|
139
|
+
backgroundColor: token.colorFillSecondary
|
|
140
|
+
},
|
|
141
|
+
"&-disabled": {
|
|
142
|
+
cursor: "not-allowed",
|
|
143
|
+
opacity: .5
|
|
144
|
+
},
|
|
145
|
+
svg: { stroke: "currentColor" }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} };
|
|
149
|
+
};
|
|
150
|
+
const genPreviewMotionStyle = (token) => {
|
|
151
|
+
const previewCls = token.componentCls;
|
|
152
|
+
const { motionDurationSlow, motionEaseOut } = token;
|
|
153
|
+
return { [`${previewCls}`]: {
|
|
154
|
+
"&-fade-enter-active, &-fade-leave-active": {
|
|
155
|
+
transition: `visibility ${motionDurationSlow}`,
|
|
156
|
+
[`${previewCls}-mask`]: { transition: `background-color ${motionDurationSlow}, backdrop-filter ${motionDurationSlow}` },
|
|
157
|
+
[`${previewCls}-body`]: { transition: `transform ${motionDurationSlow} ${motionEaseOut}` },
|
|
158
|
+
[`${previewCls}-close, ${previewCls}-switch, ${previewCls}-footer`]: { transition: `opacity ${motionDurationSlow}, all ${motionDurationSlow}` }
|
|
159
|
+
},
|
|
160
|
+
"&-fade-enter-from, &-fade-leave-to": {
|
|
161
|
+
visibility: "visible",
|
|
162
|
+
[`${previewCls}-mask`]: {
|
|
163
|
+
backgroundColor: "transparent",
|
|
164
|
+
backdropFilter: "blur(0px)"
|
|
165
|
+
},
|
|
166
|
+
[`${previewCls}-body`]: { transform: "scale(0)" },
|
|
167
|
+
[`${previewCls}-close, ${previewCls}-switch, ${previewCls}-footer`]: { opacity: 0 }
|
|
168
|
+
},
|
|
169
|
+
"&-fade-enter-to, &-fade-leave-from": {
|
|
170
|
+
[`${previewCls}-mask`]: {
|
|
171
|
+
backgroundColor: `color-mix(in srgb, ${token.colorBgLayout} 90%, transparent)`,
|
|
172
|
+
[`&${previewCls}-mask-blur`]: { backdropFilter: "blur(4px)" }
|
|
173
|
+
},
|
|
174
|
+
[`${previewCls}-close, ${previewCls}-switch, ${previewCls}-footer`]: { opacity: 1 }
|
|
175
|
+
}
|
|
176
|
+
} };
|
|
177
|
+
};
|
|
178
|
+
var preview_default = proGenStyleHooks("GImagePreview", (token) => {
|
|
179
|
+
return [genPreviewBaseStyle(token), genPreviewMotionStyle(token)];
|
|
180
|
+
}, createPreviewToken);
|
|
181
|
+
//#endregion
|
|
182
|
+
export { preview_default as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentToken } from "../style/index.js";
|
|
2
|
+
import { ComponentToken as ComponentToken$1 } from "../style/preview.js";
|
|
3
|
+
|
|
4
|
+
//#region src/theme/augment.d.ts
|
|
5
|
+
declare module 'antdv-next/dist/theme/interface/components' {
|
|
6
|
+
interface ComponentTokenMap {
|
|
7
|
+
GImage?: ComponentToken;
|
|
8
|
+
GImagePreview?: ComponentToken$1;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentToken } from "../../style/index.js";
|
|
2
|
+
import { ComponentToken as ComponentToken$1 } from "../../style/preview.js";
|
|
3
|
+
|
|
4
|
+
//#region src/theme/interface/components.d.ts
|
|
5
|
+
interface ComponentTokenMap {
|
|
6
|
+
GImage: ComponentToken;
|
|
7
|
+
GImagePreview: ComponentToken$1;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ComponentTokenMap };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gx-design-vue/image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.0-alpha.
|
|
4
|
+
"version": "0.2.0-alpha.2",
|
|
5
5
|
"description": "Gx Design Image",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "gx12358",
|
|
@@ -40,14 +40,15 @@
|
|
|
40
40
|
"vue": ">=3.2.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@
|
|
43
|
+
"@antdv-next/cssinjs": "^1.0.6",
|
|
44
|
+
"@antdv-next/icons": "^1.0.6",
|
|
44
45
|
"@ctrl/tinycolor": "^3.5.0",
|
|
45
|
-
"@vueuse/core": "^14.
|
|
46
|
-
"
|
|
47
|
-
"es-toolkit": "1.43.0",
|
|
48
|
-
"@gx-design-vue/pro-hooks": "0.2.0-alpha.
|
|
49
|
-
"@gx-design-vue/pro-provider": "0.1.0-alpha.
|
|
50
|
-
"@gx-design-vue/pro-utils": "0.2.0-alpha.
|
|
46
|
+
"@vueuse/core": "^14.3.0",
|
|
47
|
+
"antdv-next": "^1.3.3",
|
|
48
|
+
"es-toolkit": "^1.43.0",
|
|
49
|
+
"@gx-design-vue/pro-hooks": "^0.2.0-alpha.3",
|
|
50
|
+
"@gx-design-vue/pro-provider": "^0.1.0-alpha.5",
|
|
51
|
+
"@gx-design-vue/pro-utils": "^0.2.0-alpha.3"
|
|
51
52
|
},
|
|
52
53
|
"browserslist": [
|
|
53
54
|
"> 1%",
|
package/dist/GImage.d.ts
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { BaseImagePreviewProps } from "./ImagePreview/props.js";
|
|
2
|
-
import { imageProps } from "./props.js";
|
|
3
|
-
import * as vue0 from "vue";
|
|
4
|
-
import { CSSProperties, ExtractPropTypes, SlotsType } from "vue";
|
|
5
|
-
import * as _gx_design_vue_pro_utils0 from "@gx-design-vue/pro-utils";
|
|
6
|
-
import * as ant_design_vue_es__util_type1 from "ant-design-vue/es/_util/type";
|
|
7
|
-
|
|
8
|
-
//#region src/GImage.d.ts
|
|
9
|
-
type GImageProps = Partial<ExtractPropTypes<typeof imageProps>>;
|
|
10
|
-
declare const GImage: vue0.DefineComponent<ExtractPropTypes<{
|
|
11
|
-
preview: {
|
|
12
|
-
type: vue0.PropType<BaseImagePreviewProps | boolean>;
|
|
13
|
-
default: boolean;
|
|
14
|
-
};
|
|
15
|
-
src: {
|
|
16
|
-
type: vue0.PropType<string>;
|
|
17
|
-
default: string;
|
|
18
|
-
};
|
|
19
|
-
alt: {
|
|
20
|
-
type: vue0.PropType<string>;
|
|
21
|
-
default: string;
|
|
22
|
-
};
|
|
23
|
-
loading: {
|
|
24
|
-
type: vue0.PropType<"eager" | "lazy">;
|
|
25
|
-
};
|
|
26
|
-
fit: {
|
|
27
|
-
type: vue0.PropType<"fill" | "contain" | "cover" | "none" | "scale-down">;
|
|
28
|
-
default: string;
|
|
29
|
-
};
|
|
30
|
-
crossOrigin: {
|
|
31
|
-
type: vue0.PropType<"anonymous" | "use-credentials" | "">;
|
|
32
|
-
};
|
|
33
|
-
lazy: vue0.PropType<boolean>;
|
|
34
|
-
scrollContainer: {
|
|
35
|
-
type: vue0.PropType<string | HTMLElement | undefined>;
|
|
36
|
-
};
|
|
37
|
-
placeholder: {
|
|
38
|
-
type: vue0.PropType<_gx_design_vue_pro_utils0.WithFalse<_gx_design_vue_pro_utils0.CustomRender>>;
|
|
39
|
-
default: () => any;
|
|
40
|
-
};
|
|
41
|
-
fallback: {
|
|
42
|
-
type: vue0.PropType<_gx_design_vue_pro_utils0.WithFalse<_gx_design_vue_pro_utils0.CustomRender>>;
|
|
43
|
-
default: () => any;
|
|
44
|
-
};
|
|
45
|
-
onLoad: {
|
|
46
|
-
type: vue0.PropType<(e: Error) => void>;
|
|
47
|
-
};
|
|
48
|
-
onError: {
|
|
49
|
-
type: vue0.PropType<(e: Error) => void>;
|
|
50
|
-
};
|
|
51
|
-
onClick: {
|
|
52
|
-
type: vue0.PropType<(info: any) => void>;
|
|
53
|
-
};
|
|
54
|
-
imageStyle: {
|
|
55
|
-
type: vue0.PropType<CSSProperties>;
|
|
56
|
-
default: () => {};
|
|
57
|
-
};
|
|
58
|
-
imageClass: vue0.PropType<string>;
|
|
59
|
-
size: vue0.PropType<number>;
|
|
60
|
-
width: vue0.PropType<number>;
|
|
61
|
-
height: vue0.PropType<number>;
|
|
62
|
-
zIndex: {
|
|
63
|
-
type: vue0.PropType<number>;
|
|
64
|
-
default: number;
|
|
65
|
-
};
|
|
66
|
-
getContainer: {
|
|
67
|
-
type: vue0.PropType<string>;
|
|
68
|
-
};
|
|
69
|
-
}>, () => ant_design_vue_es__util_type1.VueNode, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {
|
|
70
|
-
click: (_type: "loaded" | "error" | "success") => true;
|
|
71
|
-
load: (_event: Event) => true;
|
|
72
|
-
error: (_event: Event) => true;
|
|
73
|
-
}, string, vue0.PublicProps, Readonly<ExtractPropTypes<{
|
|
74
|
-
preview: {
|
|
75
|
-
type: vue0.PropType<BaseImagePreviewProps | boolean>;
|
|
76
|
-
default: boolean;
|
|
77
|
-
};
|
|
78
|
-
src: {
|
|
79
|
-
type: vue0.PropType<string>;
|
|
80
|
-
default: string;
|
|
81
|
-
};
|
|
82
|
-
alt: {
|
|
83
|
-
type: vue0.PropType<string>;
|
|
84
|
-
default: string;
|
|
85
|
-
};
|
|
86
|
-
loading: {
|
|
87
|
-
type: vue0.PropType<"eager" | "lazy">;
|
|
88
|
-
};
|
|
89
|
-
fit: {
|
|
90
|
-
type: vue0.PropType<"fill" | "contain" | "cover" | "none" | "scale-down">;
|
|
91
|
-
default: string;
|
|
92
|
-
};
|
|
93
|
-
crossOrigin: {
|
|
94
|
-
type: vue0.PropType<"anonymous" | "use-credentials" | "">;
|
|
95
|
-
};
|
|
96
|
-
lazy: vue0.PropType<boolean>;
|
|
97
|
-
scrollContainer: {
|
|
98
|
-
type: vue0.PropType<string | HTMLElement | undefined>;
|
|
99
|
-
};
|
|
100
|
-
placeholder: {
|
|
101
|
-
type: vue0.PropType<_gx_design_vue_pro_utils0.WithFalse<_gx_design_vue_pro_utils0.CustomRender>>;
|
|
102
|
-
default: () => any;
|
|
103
|
-
};
|
|
104
|
-
fallback: {
|
|
105
|
-
type: vue0.PropType<_gx_design_vue_pro_utils0.WithFalse<_gx_design_vue_pro_utils0.CustomRender>>;
|
|
106
|
-
default: () => any;
|
|
107
|
-
};
|
|
108
|
-
onLoad: {
|
|
109
|
-
type: vue0.PropType<(e: Error) => void>;
|
|
110
|
-
};
|
|
111
|
-
onError: {
|
|
112
|
-
type: vue0.PropType<(e: Error) => void>;
|
|
113
|
-
};
|
|
114
|
-
onClick: {
|
|
115
|
-
type: vue0.PropType<(info: any) => void>;
|
|
116
|
-
};
|
|
117
|
-
imageStyle: {
|
|
118
|
-
type: vue0.PropType<CSSProperties>;
|
|
119
|
-
default: () => {};
|
|
120
|
-
};
|
|
121
|
-
imageClass: vue0.PropType<string>;
|
|
122
|
-
size: vue0.PropType<number>;
|
|
123
|
-
width: vue0.PropType<number>;
|
|
124
|
-
height: vue0.PropType<number>;
|
|
125
|
-
zIndex: {
|
|
126
|
-
type: vue0.PropType<number>;
|
|
127
|
-
default: number;
|
|
128
|
-
};
|
|
129
|
-
getContainer: {
|
|
130
|
-
type: vue0.PropType<string>;
|
|
131
|
-
};
|
|
132
|
-
}>> & Readonly<{
|
|
133
|
-
onError?: (_event: Event) => any;
|
|
134
|
-
onClick?: (_type: "loaded" | "error" | "success") => any;
|
|
135
|
-
onLoad?: (_event: Event) => any;
|
|
136
|
-
}>, {
|
|
137
|
-
fallback: _gx_design_vue_pro_utils0.CustomRender;
|
|
138
|
-
placeholder: _gx_design_vue_pro_utils0.CustomRender;
|
|
139
|
-
zIndex: number;
|
|
140
|
-
preview: boolean;
|
|
141
|
-
src: string;
|
|
142
|
-
alt: string;
|
|
143
|
-
fit: "fill" | "contain" | "cover" | "none" | "scale-down";
|
|
144
|
-
imageStyle: CSSProperties;
|
|
145
|
-
}, SlotsType<{
|
|
146
|
-
default: () => void;
|
|
147
|
-
mask: () => void;
|
|
148
|
-
close: () => void;
|
|
149
|
-
left: () => void;
|
|
150
|
-
right: () => void;
|
|
151
|
-
countRender: () => void;
|
|
152
|
-
rotateRight: () => void;
|
|
153
|
-
zoomIn: () => void;
|
|
154
|
-
zoomOut: () => void;
|
|
155
|
-
flipX: () => void;
|
|
156
|
-
flipY: () => void;
|
|
157
|
-
rotateLeft: () => void;
|
|
158
|
-
fallback: () => void;
|
|
159
|
-
placeholder: () => void;
|
|
160
|
-
}>, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
161
|
-
//#endregion
|
|
162
|
-
export { GImageProps, GImage as default };
|