@wzyjs/uis 0.3.17 → 0.3.20
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/antd/form/UploadImage/index.tsx +6 -6
- package/src/antd/index.ts +2 -1
- package/src/antd/pro/Button/components/Copy.tsx +2 -1
- package/src/antd/pro/Button/components/Drawer.tsx +1 -1
- package/src/components/Crud/components/CreateUpdate/index.tsx +9 -9
- package/src/components/Crud/hooks/useList.ts +12 -1
- package/src/components/DynamicSelect/index.tsx +0 -3
- package/src/components/DynamicSelect/utils.ts +1 -3
- package/src/components/JsonRenderer/index.tsx +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzyjs/uis",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"description": "description",
|
|
5
5
|
"author": "wzy",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@wzyjs/utils": "^0.2.37",
|
|
43
43
|
"antd": "^6.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "75ecd6752ea11d3e5d51ef76cd4393dca75c358b",
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
}
|
|
@@ -212,13 +212,13 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
212
212
|
const imageNode = (
|
|
213
213
|
<div
|
|
214
214
|
className='rounded border overflow-hidden relative group bg-white'
|
|
215
|
-
style={{ maxWidth: 200
|
|
215
|
+
style={{ maxWidth: 200 }}
|
|
216
216
|
>
|
|
217
217
|
<img
|
|
218
218
|
src={image}
|
|
219
219
|
alt={`图片 ${index + 1}`}
|
|
220
220
|
className='object-contain'
|
|
221
|
-
style={{ maxWidth: '100%',
|
|
221
|
+
style={{ maxWidth: '100%', height: 'auto', display: 'block' }}
|
|
222
222
|
/>
|
|
223
223
|
<Button
|
|
224
224
|
type='text'
|
|
@@ -252,8 +252,8 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
252
252
|
src={image}
|
|
253
253
|
alt={`预览图片 ${index + 1}`}
|
|
254
254
|
style={{
|
|
255
|
-
maxWidth: '
|
|
256
|
-
|
|
255
|
+
maxWidth: '400px',
|
|
256
|
+
height: 'auto',
|
|
257
257
|
objectFit: 'contain',
|
|
258
258
|
}}
|
|
259
259
|
/>
|
|
@@ -279,7 +279,7 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
279
279
|
style={{ width: '50px', height: '50px' }}
|
|
280
280
|
>
|
|
281
281
|
<PlusOutlined style={{ fontSize: '24px', color: '#8c8c8c' }} />
|
|
282
|
-
<Typography.Text type='secondary' className='
|
|
282
|
+
<Typography.Text type='secondary' className='m-2'>上传</Typography.Text>
|
|
283
283
|
</div>
|
|
284
284
|
)}
|
|
285
285
|
|
|
@@ -292,7 +292,7 @@ export const UploadImage = (props: UploadImageProps) => {
|
|
|
292
292
|
onClick={handlePasteButton}
|
|
293
293
|
>
|
|
294
294
|
<PlusOutlined style={{ fontSize: '24px', color: '#8c8c8c' }} />
|
|
295
|
-
<Typography.Text type='secondary' className='
|
|
295
|
+
<Typography.Text type='secondary' className='m-2'>粘贴</Typography.Text>
|
|
296
296
|
</div>
|
|
297
297
|
)}
|
|
298
298
|
</Space>
|
package/src/antd/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState, ReactNode } from 'react'
|
|
4
4
|
|
|
5
|
-
import { Button, ButtonProps
|
|
5
|
+
import { App, Button, ButtonProps } from 'antd'
|
|
6
6
|
import { CheckOutlined } from '@ant-design/icons'
|
|
7
7
|
|
|
8
8
|
import { copy, readClipboard } from '@wzyjs/utils/web'
|
|
@@ -15,6 +15,7 @@ export interface CopyProps extends ButtonProps {
|
|
|
15
15
|
|
|
16
16
|
export const Copy = (props: CopyProps) => {
|
|
17
17
|
const [icon, setIcon] = useState<ReactNode>(null)
|
|
18
|
+
const { message } = App.useApp()
|
|
18
19
|
|
|
19
20
|
const [value, setValue] = useControllableValue<string>(props, {
|
|
20
21
|
defaultValue: props.value,
|
|
@@ -23,13 +23,13 @@ export const CreateUpdate = (props: CreateUpdateProps) => {
|
|
|
23
23
|
|
|
24
24
|
const layoutType = mode === 'modal' ? 'ModalForm' : 'DrawerForm'
|
|
25
25
|
|
|
26
|
-
const finalDrawerProps: DrawerProps | undefined = layoutType === 'DrawerForm'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const finalModalProps: ModalProps | undefined = layoutType === 'ModalForm'
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
// const finalDrawerProps: DrawerProps | undefined = layoutType === 'DrawerForm'
|
|
27
|
+
// ? { forceRender: false, ...drawerProps }
|
|
28
|
+
// : undefined
|
|
29
|
+
//
|
|
30
|
+
// const finalModalProps: ModalProps | undefined = layoutType === 'ModalForm'
|
|
31
|
+
// ? { forceRender: false, ...modalProps }
|
|
32
|
+
// : undefined
|
|
33
33
|
|
|
34
34
|
const onFinish = async (values: Record<string, unknown>) => {
|
|
35
35
|
const finalValues = transformData ? transformData(values, record) : values
|
|
@@ -77,8 +77,8 @@ export const CreateUpdate = (props: CreateUpdateProps) => {
|
|
|
77
77
|
...(record ?? {}),
|
|
78
78
|
...(coverData ? coverData(record) : {}),
|
|
79
79
|
}}
|
|
80
|
-
{...(
|
|
81
|
-
{...(
|
|
80
|
+
{...(drawerProps ? { drawerProps } : {})}
|
|
81
|
+
{...(modalProps ? { modalProps } : {})}
|
|
82
82
|
trigger={
|
|
83
83
|
isEdit ? (
|
|
84
84
|
<Button
|
|
@@ -15,6 +15,14 @@ export const useList = ({ list }: UseTabsStateParams) => {
|
|
|
15
15
|
return tabs.activeKey ?? tabs.items?.[0]?.key
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
+
// 同步外部传入的 activeKey
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const tabs = list?.toolbar?.tabs as any
|
|
21
|
+
if (tabs && tabs.activeKey !== undefined && tabs.activeKey !== activeTabKey) {
|
|
22
|
+
setTabActiveKey(tabs.activeKey)
|
|
23
|
+
}
|
|
24
|
+
}, [list?.toolbar?.tabs])
|
|
25
|
+
|
|
18
26
|
// 当 Tab 变化时,将最新的类型通过 onChangeQuery 回传给父组件
|
|
19
27
|
useEffect(() => {
|
|
20
28
|
if (activeTabKey !== undefined) {
|
|
@@ -33,7 +41,10 @@ export const useList = ({ list }: UseTabsStateParams) => {
|
|
|
33
41
|
const enhancedTabs = {
|
|
34
42
|
...originalTabs,
|
|
35
43
|
activeKey: activeTabKey,
|
|
36
|
-
onChange:
|
|
44
|
+
onChange: (key: string) => {
|
|
45
|
+
setTabActiveKey(key)
|
|
46
|
+
originalTabs.onChange?.(key)
|
|
47
|
+
},
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
return {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Option } from '@wzyjs/types'
|
|
2
|
-
|
|
3
1
|
export const transformOptions = (data: string[][]): Option[] => {
|
|
4
2
|
const result: Option[] = []
|
|
5
3
|
|
|
@@ -24,7 +22,7 @@ export const transformOptions = (data: string[][]): Option[] => {
|
|
|
24
22
|
|
|
25
23
|
parentNode = currentNode
|
|
26
24
|
} else {
|
|
27
|
-
currentNode = parentNode?.children?.find(c => c.value === currentValue)
|
|
25
|
+
currentNode = parentNode?.children?.find((c: Option) => c.value === currentValue)
|
|
28
26
|
|
|
29
27
|
if (!currentNode) {
|
|
30
28
|
currentNode = {
|