@wzyjs/antd 0.3.2 → 0.3.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.
- package/package.json +2 -2
- package/src/form/RadioButton/index.tsx +1 -1
- package/src/form/Upload/index.tsx +1 -1
- package/src/form/UploadImage/index.tsx +56 -39
- package/src/pro/Button/components/Confirm.tsx +1 -1
- package/src/pro/Button/components/Copy.tsx +2 -2
- package/src/pro/Button/components/Drawer.tsx +1 -1
- package/src/pro/Input/components/Range.tsx +1 -1
- package/src/pro/Input/index.tsx +1 -1
- package/src/pro/Typography/components/String.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzyjs/antd",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
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": "759abaadc6f778c5a1b4ddb5b16f7753d45f37f9",
|
|
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%' }}>
|
|
@@ -5,8 +5,8 @@ import React, { useState, ReactNode } from 'react'
|
|
|
5
5
|
import { Button, ButtonProps, message } from 'antd'
|
|
6
6
|
import { CheckOutlined } from '@ant-design/icons'
|
|
7
7
|
|
|
8
|
-
import { copy, readClipboard } from '@wzyjs/utils'
|
|
9
|
-
import { useControllableValue } from '@wzyjs/hooks'
|
|
8
|
+
import { copy, readClipboard } from '@wzyjs/utils/web'
|
|
9
|
+
import { useControllableValue } from '@wzyjs/hooks/web'
|
|
10
10
|
|
|
11
11
|
export interface CopyProps extends ButtonProps {
|
|
12
12
|
value?: string,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react'
|
|
4
|
-
import { _ } from '@wzyjs/utils'
|
|
4
|
+
import { _ } from '@wzyjs/utils/web'
|
|
5
5
|
import { Button, Drawer as AntdDrawer, DrawerProps as AntdDrawerProps, ButtonProps } from 'antd'
|
|
6
6
|
|
|
7
7
|
export interface DrawerProps extends AntdDrawerProps {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { InputNumber, InputNumberProps, Space } from 'antd'
|
|
5
|
-
import { _ } from '@wzyjs/utils'
|
|
5
|
+
import { _ } from '@wzyjs/utils/web'
|
|
6
6
|
|
|
7
7
|
export interface RangeProps extends Omit<InputNumberProps, 'value' | 'onChange'> {
|
|
8
8
|
value?: number[];
|
package/src/pro/Input/index.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState, useEffect, useMemo } from 'react'
|
|
4
4
|
import { Input, InputProps } from 'antd'
|
|
5
|
-
import { getStrLength } from '@wzyjs/utils'
|
|
5
|
+
import { getStrLength } from '@wzyjs/utils/web'
|
|
6
6
|
import { Range } from './components/Range'
|
|
7
7
|
|
|
8
8
|
export interface InputProProps extends Omit<InputProps, 'onChange'> {
|
|
@@ -5,7 +5,7 @@ import React, { useMemo } from 'react'
|
|
|
5
5
|
import { Typography } from 'antd'
|
|
6
6
|
import { TextProps } from 'antd/lib/typography/Text'
|
|
7
7
|
|
|
8
|
-
import { replaceByRules } from '@wzyjs/utils'
|
|
8
|
+
import { replaceByRules } from '@wzyjs/utils/web'
|
|
9
9
|
|
|
10
10
|
export interface StringProps extends TextProps {
|
|
11
11
|
isCopy?: boolean;
|