@wzyjs/antd 0.3.2 → 0.3.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzyjs/antd",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "description",
|
|
5
5
|
"author": "wzy",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@wzyjs/utils": "^0.2.37",
|
|
21
21
|
"antd": "^5.24.3"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "c0a83557cdfb520becc4d5924f1b101e0bd43d1e",
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
}
|
|
@@ -20,7 +20,7 @@ export const RadioButton = <V = string | number | boolean | null>(props: FilterB
|
|
|
20
20
|
buttonStyle={buttonStyle}
|
|
21
21
|
value={value}
|
|
22
22
|
style={style}
|
|
23
|
-
onChange={e => onChange(e.target.value as V)}
|
|
23
|
+
onChange={e => onChange?.(e.target.value as V)}
|
|
24
24
|
>
|
|
25
25
|
{options.filter(item => item.label).map(item => (
|
|
26
26
|
<Radio key={String(item.value)} value={item.value}>{item.label}</Radio>
|
|
@@ -8,6 +8,7 @@ interface UploadImageProps {
|
|
|
8
8
|
value?: string[];
|
|
9
9
|
onChange?: (value: string[]) => void;
|
|
10
10
|
maxImages?: number;
|
|
11
|
+
enablePreview?: boolean;
|
|
11
12
|
enableDragDrop?: boolean;
|
|
12
13
|
enableFileSelect?: boolean;
|
|
13
14
|
enablePaste?: boolean;
|
|
@@ -19,6 +20,7 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
19
20
|
value = [],
|
|
20
21
|
onChange,
|
|
21
22
|
maxImages = 10,
|
|
23
|
+
enablePreview = false,
|
|
22
24
|
enableDragDrop = false,
|
|
23
25
|
enableFileSelect = false,
|
|
24
26
|
enablePaste = true,
|
|
@@ -206,47 +208,62 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
206
208
|
return (
|
|
207
209
|
<div className='w-full space-y-4'>
|
|
208
210
|
<div className='flex flex-wrap gap-3'>
|
|
209
|
-
{value.map((image, index) =>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
>
|
|
215
|
-
<Popover
|
|
216
|
-
trigger='hover'
|
|
217
|
-
placement='top'
|
|
218
|
-
content={(
|
|
219
|
-
<img
|
|
220
|
-
src={image}
|
|
221
|
-
alt={`预览图片 ${index + 1}`}
|
|
222
|
-
style={{
|
|
223
|
-
maxWidth: '300px',
|
|
224
|
-
maxHeight: '300px',
|
|
225
|
-
}}
|
|
226
|
-
/>
|
|
227
|
-
)}
|
|
211
|
+
{value.map((image, index) => {
|
|
212
|
+
const imageNode = (
|
|
213
|
+
<div
|
|
214
|
+
className='rounded border overflow-hidden relative group bg-white'
|
|
215
|
+
style={{ maxWidth: 200, maxHeight: 200 }}
|
|
228
216
|
>
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
217
|
+
<img
|
|
218
|
+
src={image}
|
|
219
|
+
alt={`图片 ${index + 1}`}
|
|
220
|
+
className='object-contain'
|
|
221
|
+
style={{ maxWidth: '100%', maxHeight: '100%', display: 'block' }}
|
|
222
|
+
/>
|
|
223
|
+
<Button
|
|
224
|
+
type='text'
|
|
225
|
+
icon={<DeleteOutlined />}
|
|
226
|
+
onClick={(e) => {
|
|
227
|
+
e.stopPropagation()
|
|
228
|
+
handleRemoveImage(index)
|
|
229
|
+
}}
|
|
230
|
+
style={{ position: 'absolute', top: 0, right: 0 }}
|
|
231
|
+
className='absolute top-0 right-0 bg-black/40 text-white border-none hover:bg-black/60'
|
|
232
|
+
size='small'
|
|
233
|
+
/>
|
|
234
|
+
</div>
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
if (!enablePreview) {
|
|
238
|
+
return (
|
|
239
|
+
<div key={index} className='relative'>
|
|
240
|
+
{imageNode}
|
|
246
241
|
</div>
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<div key={index} className='relative'>
|
|
247
|
+
<Popover
|
|
248
|
+
trigger='hover'
|
|
249
|
+
placement='top'
|
|
250
|
+
content={(
|
|
251
|
+
<img
|
|
252
|
+
src={image}
|
|
253
|
+
alt={`预览图片 ${index + 1}`}
|
|
254
|
+
style={{
|
|
255
|
+
maxWidth: '200px',
|
|
256
|
+
maxHeight: '200px',
|
|
257
|
+
objectFit: 'contain',
|
|
258
|
+
}}
|
|
259
|
+
/>
|
|
260
|
+
)}
|
|
261
|
+
>
|
|
262
|
+
{imageNode}
|
|
263
|
+
</Popover>
|
|
264
|
+
</div>
|
|
265
|
+
)
|
|
266
|
+
})}
|
|
250
267
|
|
|
251
268
|
{value.length < maxImages && (
|
|
252
269
|
<Space style={{ width: '100%' }}>
|