@wzyjs/antd 0.2.57 → 0.2.59
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.2.
|
|
3
|
+
"version": "0.2.59",
|
|
4
4
|
"description": "description",
|
|
5
5
|
"author": "wzy",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@wzyjs/utils": "^0.2.37",
|
|
19
19
|
"antd": "^5.24.3"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "0a6dc9df2da5a0b573de1eb5fd24f09b262228a2",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { Col, Row } from 'antd'
|
|
4
4
|
import { CheckCard } from '@ant-design/pro-components'
|
|
5
|
-
import { CheckCardValueType } from '@ant-design/pro-card/es/components/CheckCard/Group'
|
|
5
|
+
import { CheckCardValueType, CheckGroupValueType } from '@ant-design/pro-card/es/components/CheckCard/Group'
|
|
6
6
|
|
|
7
7
|
import styles from './index.module.scss'
|
|
8
8
|
|
|
9
9
|
interface CheckboxButtonProps {
|
|
10
10
|
options: { label: string; value: CheckCardValueType }[]
|
|
11
|
-
value?:
|
|
12
|
-
onChange?: (value
|
|
11
|
+
value?: CheckGroupValueType
|
|
12
|
+
onChange?: (value: CheckGroupValueType) => void
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const CheckboxButton = (props: CheckboxButtonProps) => {
|
|
@@ -35,8 +35,9 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
35
35
|
if (event.clipboardData && event.clipboardData.items) {
|
|
36
36
|
const items = event.clipboardData.items
|
|
37
37
|
for (let i = 0; i < items.length; i++) {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const item = items[i]
|
|
39
|
+
if (item && item.type.indexOf('image') !== -1) {
|
|
40
|
+
const file = item.getAsFile()
|
|
40
41
|
if (file) {
|
|
41
42
|
convertToBase64(file)
|
|
42
43
|
}
|
|
@@ -127,7 +128,7 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
127
128
|
reader.onloadend = () => {
|
|
128
129
|
const base64String = reader.result as string
|
|
129
130
|
if (!value.includes(base64String)) {
|
|
130
|
-
onChange([...value, base64String])
|
|
131
|
+
onChange?.([...value, base64String])
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
reader.readAsDataURL(compressedFile)
|
|
@@ -162,11 +163,19 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
162
163
|
canvas.height = height
|
|
163
164
|
|
|
164
165
|
const ctx = canvas.getContext('2d')
|
|
166
|
+
if (!ctx) {
|
|
167
|
+
resolve(file as Blob)
|
|
168
|
+
return
|
|
169
|
+
}
|
|
165
170
|
ctx.drawImage(img, 0, 0, width, height)
|
|
166
171
|
|
|
167
172
|
// 转换为blob,压缩质量为0.8
|
|
168
173
|
canvas.toBlob(
|
|
169
174
|
(blob) => {
|
|
175
|
+
if (!blob) {
|
|
176
|
+
resolve(file as Blob)
|
|
177
|
+
return
|
|
178
|
+
}
|
|
170
179
|
// 获取压缩后的图片大小
|
|
171
180
|
const compressedSize = blob.size / 1024
|
|
172
181
|
console.log(`原始图片: ${originalSize.toFixed(2)} KB => ${compressedSize.toFixed(2)} KB`)
|
|
@@ -189,7 +198,7 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
189
198
|
onOk: () => {
|
|
190
199
|
const newImages = [...value]
|
|
191
200
|
newImages.splice(index, 1)
|
|
192
|
-
onChange(newImages)
|
|
201
|
+
onChange?.(newImages)
|
|
193
202
|
},
|
|
194
203
|
})
|
|
195
204
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ export {
|
|
|
29
29
|
EditableProTable,
|
|
30
30
|
} from '@ant-design/pro-components'
|
|
31
31
|
|
|
32
|
-
export { ProLayoutProps, ProFormInstance } from '@ant-design/pro-components'
|
|
32
|
+
export type { ProLayoutProps, ProFormInstance } from '@ant-design/pro-components'
|
|
33
33
|
|
|
34
34
|
export * from './pro'
|
|
35
35
|
export * from './form'
|