@wzyjs/uis 0.3.28 → 0.3.30
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/advanced/Com2Canvas/index.d.ts +8 -0
- package/dist/advanced/Com2Canvas/index.js +39 -0
- package/dist/advanced/Crud/components/CardList/index.d.ts +2 -0
- package/dist/advanced/Crud/components/CardList/index.js +90 -0
- package/dist/advanced/Crud/components/CreateUpdate/index.d.ts +2 -0
- package/dist/advanced/Crud/components/CreateUpdate/index.js +78 -0
- package/dist/advanced/Crud/components/ListTabs/index.d.ts +8 -0
- package/dist/advanced/Crud/components/ListTabs/index.js +7 -0
- package/dist/advanced/Crud/components/Provider/index.d.ts +7 -0
- package/dist/advanced/Crud/components/Provider/index.js +42 -0
- package/dist/advanced/Crud/components/QuickFilters/index.d.ts +8 -0
- package/dist/advanced/Crud/components/QuickFilters/index.js +20 -0
- package/dist/advanced/Crud/components/Remove/index.d.ts +2 -0
- package/dist/advanced/Crud/components/Remove/index.js +18 -0
- package/dist/advanced/Crud/components/index.d.ts +6 -0
- package/dist/advanced/Crud/components/index.js +6 -0
- package/dist/advanced/Crud/hooks/index.d.ts +5 -0
- package/dist/advanced/Crud/hooks/index.js +5 -0
- package/dist/advanced/Crud/hooks/useColumns.d.ts +11 -0
- package/dist/advanced/Crud/hooks/useColumns.js +111 -0
- package/dist/advanced/Crud/hooks/useList.d.ts +12 -0
- package/dist/advanced/Crud/hooks/useList.js +53 -0
- package/dist/advanced/Crud/hooks/useListFilters.d.ts +11 -0
- package/dist/advanced/Crud/hooks/useListFilters.js +159 -0
- package/dist/advanced/Crud/hooks/useOrderable.d.ts +15 -0
- package/dist/advanced/Crud/hooks/useOrderable.js +75 -0
- package/dist/advanced/Crud/hooks/useRequest.d.ts +13 -0
- package/dist/advanced/Crud/hooks/useRequest.js +27 -0
- package/dist/advanced/Crud/index.d.ts +3 -0
- package/dist/advanced/Crud/index.js +46 -0
- package/dist/advanced/Crud/types/index.d.ts +176 -0
- package/dist/advanced/Crud/types/index.js +1 -0
- package/dist/advanced/Crud/utils/index.d.ts +7 -0
- package/dist/advanced/Crud/utils/index.js +80 -0
- package/dist/advanced/Crud/utils/query.d.ts +3 -0
- package/dist/advanced/Crud/utils/query.js +34 -0
- package/dist/advanced/MindMap/context.d.ts +12 -0
- package/dist/advanced/MindMap/context.js +12 -0
- package/dist/advanced/MindMap/hooks/useAlignmentSnap.d.ts +15 -0
- package/dist/advanced/MindMap/hooks/useAlignmentSnap.js +164 -0
- package/dist/advanced/MindMap/hooks/useCopyPaste.d.ts +11 -0
- package/dist/advanced/MindMap/hooks/useCopyPaste.js +209 -0
- package/dist/advanced/MindMap/hooks/useDropToReparent.d.ts +21 -0
- package/dist/advanced/MindMap/hooks/useDropToReparent.js +216 -0
- package/dist/advanced/MindMap/hooks/useExpandCollapse.d.ts +18 -0
- package/dist/advanced/MindMap/hooks/useExpandCollapse.js +108 -0
- package/dist/advanced/MindMap/hooks/useMoveDescendants.d.ts +12 -0
- package/dist/advanced/MindMap/hooks/useMoveDescendants.js +98 -0
- package/dist/advanced/MindMap/hooks/useUndoRedo.d.ts +14 -0
- package/dist/advanced/MindMap/hooks/useUndoRedo.js +181 -0
- package/dist/advanced/MindMap/index.d.ts +29 -0
- package/dist/advanced/MindMap/index.js +52 -0
- package/dist/advanced/index.d.ts +5 -0
- package/dist/advanced/index.js +5 -0
- package/dist/antd/index.d.ts +6 -0
- package/dist/antd/index.js +5 -0
- package/dist/buttons/ButtonGroup/index.d.ts +8 -0
- package/dist/buttons/ButtonGroup/index.js +13 -0
- package/dist/buttons/ConfirmButton/index.d.ts +5 -0
- package/dist/buttons/ConfirmButton/index.js +9 -0
- package/dist/buttons/CopyButton/index.d.ts +6 -0
- package/dist/buttons/CopyButton/index.js +26 -0
- package/dist/buttons/DrawerButton/index.d.ts +6 -0
- package/dist/buttons/DrawerButton/index.js +13 -0
- package/dist/buttons/ProgressButton/index.css +63 -0
- package/dist/buttons/ProgressButton/index.d.ts +17 -0
- package/dist/buttons/ProgressButton/index.js +31 -0
- package/dist/buttons/SectorButton/index.d.ts +20 -0
- package/dist/buttons/SectorButton/index.js +130 -0
- package/dist/buttons/index.d.ts +6 -0
- package/dist/buttons/index.js +6 -0
- package/dist/display/CodeView/index.d.ts +26 -0
- package/dist/display/CodeView/index.js +60 -0
- package/dist/display/EnumTag/index.d.ts +12 -0
- package/dist/display/EnumTag/index.js +10 -0
- package/dist/display/HtmlDataRenderer/index.d.ts +6 -0
- package/dist/display/HtmlDataRenderer/index.js +15 -0
- package/dist/display/HtmlView/index.d.ts +6 -0
- package/dist/display/HtmlView/index.js +6 -0
- package/dist/display/IframePro/index.d.ts +8 -0
- package/dist/display/IframePro/index.js +24 -0
- package/dist/display/JsonSchemaRenderer/index.d.ts +11 -0
- package/dist/display/JsonSchemaRenderer/index.js +62 -0
- package/dist/display/JsonView/index.d.ts +3 -0
- package/dist/display/JsonView/index.js +7 -0
- package/dist/display/MarkdownView/index.d.ts +7 -0
- package/dist/display/MarkdownView/index.js +80 -0
- package/dist/display/MarkdownView/style.d.ts +1 -0
- package/{src/components/Markdown/style.ts → dist/display/MarkdownView/style.js} +1 -1
- package/dist/display/VideoPro/index.d.ts +9 -0
- package/dist/display/VideoPro/index.js +15 -0
- package/dist/display/index.d.ts +9 -0
- package/dist/display/index.js +9 -0
- package/dist/inputs/CheckboxButton/index.css +22 -0
- package/dist/inputs/CheckboxButton/index.d.ts +12 -0
- package/dist/inputs/CheckboxButton/index.js +9 -0
- package/dist/inputs/DateSwitcher/index.css +10 -0
- package/dist/inputs/DateSwitcher/index.d.ts +8 -0
- package/dist/inputs/DateSwitcher/index.js +29 -0
- package/dist/inputs/FetchSelect/index.d.ts +3 -0
- package/dist/inputs/FetchSelect/index.js +121 -0
- package/dist/inputs/FetchSelect/types.d.ts +33 -0
- package/dist/inputs/FetchSelect/types.js +1 -0
- package/dist/inputs/FetchSelect/utils.d.ts +21 -0
- package/dist/inputs/FetchSelect/utils.js +67 -0
- package/dist/inputs/FileUploader/index.d.ts +22 -0
- package/dist/inputs/FileUploader/index.js +79 -0
- package/dist/inputs/IconSelect/index.d.ts +89 -0
- package/dist/inputs/IconSelect/index.js +54 -0
- package/dist/inputs/ImageUploader/index.d.ts +12 -0
- package/dist/inputs/ImageUploader/index.js +192 -0
- package/dist/inputs/RadioButton/index.d.ts +15 -0
- package/dist/inputs/RadioButton/index.js +11 -0
- package/dist/inputs/RangeInput/index.d.ts +8 -0
- package/dist/inputs/RangeInput/index.js +17 -0
- package/dist/inputs/TextInput/index.d.ts +6 -0
- package/dist/inputs/TextInput/index.js +30 -0
- package/dist/inputs/index.d.ts +9 -0
- package/dist/inputs/index.js +9 -0
- package/dist/layout/DragSort/index.d.ts +16 -0
- package/dist/layout/DragSort/index.js +12 -0
- package/dist/layout/FoldCard/index.d.ts +9 -0
- package/dist/layout/FoldCard/index.js +69 -0
- package/dist/layout/PageBase/index.d.ts +6 -0
- package/dist/layout/PageBase/index.js +6 -0
- package/dist/layout/ResizableGridLayout/index.d.ts +11 -0
- package/dist/layout/ResizableGridLayout/index.js +13 -0
- package/dist/layout/SideMenu/index.d.ts +27 -0
- package/dist/layout/SideMenu/index.js +40 -0
- package/dist/layout/TabsPro/index.d.ts +9 -0
- package/dist/layout/TabsPro/index.js +87 -0
- package/dist/layout/index.d.ts +6 -0
- package/dist/layout/index.js +6 -0
- package/dist/web.d.ts +6 -0
- package/dist/web.js +6 -0
- package/package.json +28 -12
- package/src/antd/form/CheckboxButton/index.module.scss +0 -24
- package/src/antd/form/CheckboxButton/index.tsx +0 -31
- package/src/antd/form/FileUploader/index.tsx +0 -163
- package/src/antd/form/RadioButton/index.tsx +0 -32
- package/src/antd/form/Upload/index.tsx +0 -65
- package/src/antd/form/UploadImage/index.tsx +0 -338
- package/src/antd/form/index.ts +0 -6
- package/src/antd/index.ts +0 -46
- package/src/antd/pro/Alert/index.tsx +0 -24
- package/src/antd/pro/Button/components/Confirm.tsx +0 -24
- package/src/antd/pro/Button/components/Copy.tsx +0 -47
- package/src/antd/pro/Button/components/Drawer.tsx +0 -37
- package/src/antd/pro/Button/components/Group.tsx +0 -26
- package/src/antd/pro/Button/index.tsx +0 -11
- package/src/antd/pro/Card/index.tsx +0 -92
- package/src/antd/pro/Collapse/components/Item.tsx +0 -30
- package/src/antd/pro/Collapse/index.tsx +0 -27
- package/src/antd/pro/Image/index.tsx +0 -17
- package/src/antd/pro/Input/components/Range.tsx +0 -46
- package/src/antd/pro/Input/index.tsx +0 -61
- package/src/antd/pro/Popconfirm/index.tsx +0 -16
- package/src/antd/pro/Radio/components/Cancel.tsx +0 -30
- package/src/antd/pro/Radio/index.tsx +0 -7
- package/src/antd/pro/Space/index.tsx +0 -15
- package/src/antd/pro/Tabs/index.tsx +0 -135
- package/src/antd/pro/Typography/components/String.tsx +0 -72
- package/src/antd/pro/Typography/index.tsx +0 -9
- package/src/antd/pro/index.ts +0 -11
- package/src/components/BottomBar/index.tsx +0 -28
- package/src/components/CodeView/index.tsx +0 -85
- package/src/components/Collapse/index.tsx +0 -26
- package/src/components/Com2Canvas/index.tsx +0 -60
- package/src/components/CompileHtml/index.tsx +0 -26
- package/src/components/Crud/components/CardList/index.tsx +0 -174
- package/src/components/Crud/components/CreateUpdate/index.tsx +0 -179
- package/src/components/Crud/components/Provider/index.tsx +0 -83
- package/src/components/Crud/components/Remove/index.tsx +0 -56
- package/src/components/Crud/components/index.ts +0 -4
- package/src/components/Crud/hooks/index.ts +0 -4
- package/src/components/Crud/hooks/useColumns.tsx +0 -169
- package/src/components/Crud/hooks/useList.ts +0 -65
- package/src/components/Crud/hooks/useOrderable.tsx +0 -107
- package/src/components/Crud/hooks/useRequest.ts +0 -41
- package/src/components/Crud/index.tsx +0 -91
- package/src/components/Crud/types/index.ts +0 -188
- package/src/components/Crud/utils/index.ts +0 -87
- package/src/components/DateSwitcher/index.module.scss +0 -10
- package/src/components/DateSwitcher/index.tsx +0 -75
- package/src/components/DownloadLink/index.tsx +0 -36
- package/src/components/DragSort/index.tsx +0 -77
- package/src/components/DynamicSelect/index.tsx +0 -74
- package/src/components/DynamicSelect/utils.ts +0 -45
- package/src/components/EnumTag/index.tsx +0 -24
- package/src/components/FetchSelect/index.tsx +0 -57
- package/src/components/Fold/index.tsx +0 -52
- package/src/components/FormPro/index.tsx +0 -28
- package/src/components/GroupLayout/index.tsx +0 -45
- package/src/components/HtmlPro/index.tsx +0 -18
- package/src/components/IframePro/index.tsx +0 -52
- package/src/components/JsonRenderer/index.tsx +0 -114
- package/src/components/JsonView/index.tsx +0 -21
- package/src/components/Markdown/index.tsx +0 -152
- package/src/components/MindMap/context.tsx +0 -29
- package/src/components/MindMap/hooks/useAlignmentSnap.ts +0 -220
- package/src/components/MindMap/hooks/useCopyPaste.ts +0 -272
- package/src/components/MindMap/hooks/useDropToReparent.ts +0 -288
- package/src/components/MindMap/hooks/useExpandCollapse.ts +0 -146
- package/src/components/MindMap/hooks/useMoveDescendants.ts +0 -136
- package/src/components/MindMap/hooks/useUndoRedo.ts +0 -232
- package/src/components/MindMap/index.tsx +0 -117
- package/src/components/MultiImageDisplay/index.tsx +0 -63
- package/src/components/ProgressButton/index.module.scss +0 -65
- package/src/components/ProgressButton/index.tsx +0 -96
- package/src/components/SectorButton/index.tsx +0 -247
- package/src/components/TextInput/index.tsx +0 -61
- package/src/components/TimelineBar/components/CurrentWeekHighlight/index.tsx +0 -64
- package/src/components/TimelineBar/components/Guides/index.tsx +0 -61
- package/src/components/TimelineBar/components/Ticks/index.tsx +0 -56
- package/src/components/TimelineBar/components/TodayIndicator/index.tsx +0 -54
- package/src/components/TimelineBar/components/index.ts +0 -4
- package/src/components/TimelineBar/const.ts +0 -3
- package/src/components/TimelineBar/hooks/index.ts +0 -5
- package/src/components/TimelineBar/hooks/useHighlightRange.ts +0 -21
- package/src/components/TimelineBar/hooks/useMonthGuides.ts +0 -40
- package/src/components/TimelineBar/hooks/useTickValues.ts +0 -18
- package/src/components/TimelineBar/hooks/useVisibleRange.ts +0 -43
- package/src/components/TimelineBar/hooks/useWeekGuides.ts +0 -39
- package/src/components/TimelineBar/index.tsx +0 -63
- package/src/components/TimelineBar/utils.ts +0 -27
- package/src/components/Video/index.tsx +0 -37
- package/src/components/index.ts +0 -27
- package/src/rn.ts +0 -1
- package/src/rns/index.ts +0 -0
- package/src/web.ts +0 -2
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import { Space } from 'antd'
|
|
6
|
-
import {
|
|
7
|
-
DragDropContext,
|
|
8
|
-
Draggable,
|
|
9
|
-
Droppable,
|
|
10
|
-
type OnDragEndResponder,
|
|
11
|
-
type DraggableProvided,
|
|
12
|
-
} from 'react-beautiful-dnd'
|
|
13
|
-
|
|
14
|
-
interface DragSortProps<T> {
|
|
15
|
-
direction?: 'vertical' | 'horizontal'
|
|
16
|
-
droppableId?: string
|
|
17
|
-
list?: T[]
|
|
18
|
-
children: (item: T, provided: DraggableProvided) => React.ReactNode
|
|
19
|
-
lastChildren?: React.ReactNode
|
|
20
|
-
onDragEnd?: OnDragEndResponder
|
|
21
|
-
hasContext?: boolean
|
|
22
|
-
dropType?: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { type DropResult, type DraggableProvided } from 'react-beautiful-dnd'
|
|
26
|
-
|
|
27
|
-
export const DragSort = <T extends { id: string }>(props: DragSortProps<T>) => {
|
|
28
|
-
const {
|
|
29
|
-
dropType,
|
|
30
|
-
direction = 'vertical',
|
|
31
|
-
droppableId = 'list',
|
|
32
|
-
list,
|
|
33
|
-
children,
|
|
34
|
-
hasContext = true,
|
|
35
|
-
lastChildren,
|
|
36
|
-
onDragEnd = () => undefined,
|
|
37
|
-
} = props
|
|
38
|
-
|
|
39
|
-
const content = (
|
|
40
|
-
<Droppable
|
|
41
|
-
type={dropType}
|
|
42
|
-
droppableId={droppableId}
|
|
43
|
-
direction={direction}
|
|
44
|
-
isDropDisabled={false}
|
|
45
|
-
isCombineEnabled={false}
|
|
46
|
-
ignoreContainerClipping
|
|
47
|
-
>
|
|
48
|
-
{provided => (
|
|
49
|
-
<div ref={provided.innerRef} {...provided.droppableProps}>
|
|
50
|
-
<Space orientation={direction} wrap style={{ width: '100%' }}>
|
|
51
|
-
{list?.map((item, index) => (
|
|
52
|
-
<Draggable key={item.id} disableInteractiveElementBlocking draggableId={item.id.toString()} index={index}>
|
|
53
|
-
{provided => (
|
|
54
|
-
<div ref={provided.innerRef} {...provided.draggableProps} >
|
|
55
|
-
{children(item, provided)}
|
|
56
|
-
</div>
|
|
57
|
-
)}
|
|
58
|
-
</Draggable>
|
|
59
|
-
))}
|
|
60
|
-
{provided.placeholder}
|
|
61
|
-
{lastChildren}
|
|
62
|
-
</Space>
|
|
63
|
-
</div>
|
|
64
|
-
)}
|
|
65
|
-
</Droppable>
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
if (!hasContext) {
|
|
69
|
-
return content
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<DragDropContext onDragEnd={onDragEnd}>
|
|
74
|
-
{content}
|
|
75
|
-
</DragDropContext>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { AutoComplete, Button, Space } from 'antd'
|
|
3
|
-
|
|
4
|
-
interface DynamicSelectProps {
|
|
5
|
-
value?: string[]
|
|
6
|
-
onChange?: (value: string[]) => void
|
|
7
|
-
options?: Option[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const DynamicSelect = (props: DynamicSelectProps) => {
|
|
11
|
-
const { value = [''], onChange, options = [] } = props
|
|
12
|
-
|
|
13
|
-
const removeOption = (index: number) => {
|
|
14
|
-
const newOptions = [...value]
|
|
15
|
-
newOptions.splice(index, 1)
|
|
16
|
-
onChange?.(newOptions)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const handleChange = (index: number, val: string) => {
|
|
20
|
-
const newValue = [...[...value].slice(0, index), val]
|
|
21
|
-
onChange?.(newValue)
|
|
22
|
-
|
|
23
|
-
if (newValue.every(item => item)) {
|
|
24
|
-
onChange?.([...newValue, ''])
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const getOptions = (options: Option[], index: number): Option[] => {
|
|
29
|
-
if (index === 0) {
|
|
30
|
-
return options
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const currentValue = value[value.length - 1 - index]
|
|
34
|
-
if (!currentValue) return []
|
|
35
|
-
|
|
36
|
-
return getOptions(
|
|
37
|
-
options.find(item => item.value === currentValue)?.children || [],
|
|
38
|
-
index - 1,
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<Space size={8} align='center'>
|
|
44
|
-
{value.map((val, index) => (
|
|
45
|
-
<Space key={index} size={4} align='center'>
|
|
46
|
-
<AutoComplete
|
|
47
|
-
style={{
|
|
48
|
-
minWidth: '120px',
|
|
49
|
-
maxWidth: '300px',
|
|
50
|
-
width: 'auto',
|
|
51
|
-
}}
|
|
52
|
-
value={val}
|
|
53
|
-
onChange={val => handleChange(index, val)}
|
|
54
|
-
options={getOptions(options, index)}
|
|
55
|
-
placeholder={`请选择第 ${index + 1} 级`}
|
|
56
|
-
/>
|
|
57
|
-
{index !== 0 && (
|
|
58
|
-
<Button
|
|
59
|
-
type='text'
|
|
60
|
-
danger
|
|
61
|
-
size='small'
|
|
62
|
-
onClick={() => removeOption(index)}
|
|
63
|
-
>
|
|
64
|
-
删除
|
|
65
|
-
</Button>
|
|
66
|
-
)}
|
|
67
|
-
{index < value.length - 1 && (
|
|
68
|
-
<span style={{ color: '#999' }}>/</span>
|
|
69
|
-
)}
|
|
70
|
-
</Space>
|
|
71
|
-
))}
|
|
72
|
-
</Space>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export const transformOptions = (data: string[][]): Option[] => {
|
|
2
|
-
const result: Option[] = []
|
|
3
|
-
|
|
4
|
-
data.forEach((item = []) => {
|
|
5
|
-
let currentNode: Option | undefined
|
|
6
|
-
let parentNode: Option | undefined
|
|
7
|
-
|
|
8
|
-
for (let i = 0; i < item.length; i++) {
|
|
9
|
-
const currentValue = item[i]
|
|
10
|
-
if (!currentValue) continue
|
|
11
|
-
|
|
12
|
-
if (i === 0) {
|
|
13
|
-
currentNode = result.find(r => r.value === currentValue)
|
|
14
|
-
|
|
15
|
-
if (!currentNode) {
|
|
16
|
-
currentNode = {
|
|
17
|
-
label: currentValue,
|
|
18
|
-
value: currentValue,
|
|
19
|
-
}
|
|
20
|
-
result.push(currentNode)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
parentNode = currentNode
|
|
24
|
-
} else {
|
|
25
|
-
currentNode = parentNode?.children?.find((c: Option) => c.value === currentValue)
|
|
26
|
-
|
|
27
|
-
if (!currentNode) {
|
|
28
|
-
currentNode = {
|
|
29
|
-
label: currentValue,
|
|
30
|
-
value: currentValue,
|
|
31
|
-
}
|
|
32
|
-
if (!parentNode) {
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
parentNode.children = parentNode.children || []
|
|
36
|
-
parentNode.children.push(currentNode)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
parentNode = currentNode
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
return result
|
|
45
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import { Tag } from 'antd'
|
|
4
|
-
|
|
5
|
-
type EnumTagProps = {
|
|
6
|
-
value: string
|
|
7
|
-
map: Map<string, { label: string; value: string; extra?: { color?: string } }>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const EnumTag = (props: EnumTagProps) => {
|
|
11
|
-
const { value, map } = props
|
|
12
|
-
|
|
13
|
-
const enumItem = map.get(value)
|
|
14
|
-
|
|
15
|
-
if (!enumItem) {
|
|
16
|
-
return <Tag>{value}</Tag>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Tag color={enumItem.extra?.color}>
|
|
21
|
-
{enumItem.label}
|
|
22
|
-
</Tag>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useImperativeHandle } from 'react'
|
|
4
|
-
import { Select, SelectProps, Spin } from 'antd'
|
|
5
|
-
import { useRequest } from '@wzyjs/hooks/web'
|
|
6
|
-
|
|
7
|
-
export interface FetchSelectProps<I> extends SelectProps {
|
|
8
|
-
selectRef?: any,
|
|
9
|
-
isDetail?: boolean, // 只返回id 还是返回整个信息
|
|
10
|
-
searchApi: (params: { search: string }) => Promise<any>,
|
|
11
|
-
convertData?: (data: I[]) => any[],
|
|
12
|
-
onChange?: (value: any) => void
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface FetchSelectRef {
|
|
16
|
-
refresh: () => void
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const FetchSelect = <I extends { id: string | number }, >(props: FetchSelectProps<I>) => {
|
|
20
|
-
const { searchApi, convertData, onChange, isDetail = false, selectRef, ...other } = props
|
|
21
|
-
|
|
22
|
-
const { data, run, loading, refresh } = useRequest(searchApi, {
|
|
23
|
-
debounceWait: 100,
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
const onSearch = (value: string) => {
|
|
27
|
-
run({ search: value })
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
useImperativeHandle(selectRef, () => ({
|
|
31
|
-
refresh,
|
|
32
|
-
}))
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Select
|
|
36
|
-
showSearch
|
|
37
|
-
defaultActiveFirstOption={false}
|
|
38
|
-
popupMatchSelectWidth={false}
|
|
39
|
-
suffixIcon={null}
|
|
40
|
-
filterOption={false}
|
|
41
|
-
notFoundContent={loading ? <Spin size='small' /> : null}
|
|
42
|
-
loading={loading}
|
|
43
|
-
{...other}
|
|
44
|
-
|
|
45
|
-
options={convertData ? convertData(data?.data || []) : data?.data}
|
|
46
|
-
onSearch={onSearch}
|
|
47
|
-
onChange={value => {
|
|
48
|
-
if (isDetail) {
|
|
49
|
-
const detail = data?.data?.find(item => item.id === value)
|
|
50
|
-
onChange?.(detail)
|
|
51
|
-
} else {
|
|
52
|
-
onChange?.(value)
|
|
53
|
-
}
|
|
54
|
-
}}
|
|
55
|
-
/>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React, { useState } from 'react'
|
|
4
|
-
import { Button } from 'antd'
|
|
5
|
-
import { DownOutlined, UpOutlined } from '@ant-design/icons'
|
|
6
|
-
|
|
7
|
-
interface FoldProps {
|
|
8
|
-
max: number
|
|
9
|
-
children?: React.ReactNode
|
|
10
|
-
btnStyle?: React.CSSProperties
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Fold = (props: FoldProps) => {
|
|
14
|
-
const { max, children, btnStyle = {} } = props
|
|
15
|
-
|
|
16
|
-
const [collapsed, setCollapsed] = useState<boolean | undefined>(undefined)
|
|
17
|
-
|
|
18
|
-
const divRef = React.useRef<HTMLDivElement>(null)
|
|
19
|
-
|
|
20
|
-
React.useEffect(() => {
|
|
21
|
-
if (divRef.current) {
|
|
22
|
-
const { clientHeight } = divRef.current
|
|
23
|
-
if (clientHeight > max) {
|
|
24
|
-
setCollapsed(true)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}, [divRef.current])
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div ref={divRef} style={{ overflow: 'hidden' }}>
|
|
31
|
-
<div style={{ maxHeight: collapsed ? max : undefined }}>
|
|
32
|
-
{children}
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<div style={{ textAlign: 'center', ...btnStyle }}>
|
|
36
|
-
{collapsed === undefined ? null : collapsed ? (
|
|
37
|
-
<Button
|
|
38
|
-
size='small'
|
|
39
|
-
icon={<DownOutlined />}
|
|
40
|
-
onClick={() => setCollapsed(false)}
|
|
41
|
-
/>
|
|
42
|
-
) : (
|
|
43
|
-
<Button
|
|
44
|
-
size='small'
|
|
45
|
-
icon={<UpOutlined />}
|
|
46
|
-
onClick={() => setCollapsed(true)}
|
|
47
|
-
/>
|
|
48
|
-
)}
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React, { useImperativeHandle, useRef } from 'react'
|
|
4
|
-
import { BetaSchemaForm, ProFormInstance } from '@ant-design/pro-components'
|
|
5
|
-
import { FormSchema } from '@ant-design/pro-form/es/components/SchemaForm'
|
|
6
|
-
|
|
7
|
-
export type { ProFormColumnsType, ProFormInstance } from '@ant-design/pro-components'
|
|
8
|
-
|
|
9
|
-
export type FormProProps<T, ValueType> = FormSchema<T, ValueType>
|
|
10
|
-
|
|
11
|
-
export const FormPro = <T, ValueType>(props: FormProProps<T, ValueType>) => {
|
|
12
|
-
|
|
13
|
-
const formRef = useRef<ProFormInstance>(null)
|
|
14
|
-
useImperativeHandle(props.formRef, () => formRef?.current, [formRef])
|
|
15
|
-
|
|
16
|
-
// useEffect(() => {
|
|
17
|
-
// if (props.value) {
|
|
18
|
-
// formRef.current?.setFieldsValue(props.value)
|
|
19
|
-
// }
|
|
20
|
-
// }, [JSON.stringify(props.value)])
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<BetaSchemaForm
|
|
24
|
-
{...props}
|
|
25
|
-
formRef={formRef}
|
|
26
|
-
/>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react'
|
|
2
|
-
|
|
3
|
-
import GridLayout, { Layout } from 'react-grid-layout'
|
|
4
|
-
import 'react-grid-layout/css/styles.css'
|
|
5
|
-
|
|
6
|
-
export type { Layout as GridLayoutItem } from 'react-grid-layout'
|
|
7
|
-
|
|
8
|
-
interface GridLayoutProps<I> {
|
|
9
|
-
layout: I[]
|
|
10
|
-
style?: CSSProperties
|
|
11
|
-
onChange?: (layout: I[]) => void
|
|
12
|
-
renderItem?: (item: I) => ReactNode
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const GroupLayout = <I extends Layout>(props: GridLayoutProps<I>) => {
|
|
16
|
-
const { style, layout, onChange, renderItem = item => item.i } = props
|
|
17
|
-
|
|
18
|
-
const onLayoutChange = (items: Layout[]) => {
|
|
19
|
-
onChange?.(items.map(item => ({
|
|
20
|
-
...layout.find(i => i.i === item.i),
|
|
21
|
-
...item,
|
|
22
|
-
}) as I))
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<GridLayout
|
|
27
|
-
layout={layout}
|
|
28
|
-
cols={24}
|
|
29
|
-
rowHeight={50}
|
|
30
|
-
width={1200}
|
|
31
|
-
useCSSTransforms={false}
|
|
32
|
-
containerPadding={[0, 0]}
|
|
33
|
-
style={{ width: '100%', height: '100%', userSelect: 'none', ...style }}
|
|
34
|
-
draggableHandle='.drag-handle'
|
|
35
|
-
resizeHandles={['se']}
|
|
36
|
-
onLayoutChange={onLayoutChange}
|
|
37
|
-
>
|
|
38
|
-
{layout.map(item => (
|
|
39
|
-
<div key={item.i}>
|
|
40
|
-
{renderItem(item)}
|
|
41
|
-
</div>
|
|
42
|
-
))}
|
|
43
|
-
</GridLayout>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React, { CSSProperties } from 'react'
|
|
4
|
-
|
|
5
|
-
export interface HtmlProProps {
|
|
6
|
-
html: string;
|
|
7
|
-
style?: CSSProperties
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const HtmlPro = (props: HtmlProProps) => {
|
|
11
|
-
const { html, style = {} } = props
|
|
12
|
-
return (
|
|
13
|
-
<div
|
|
14
|
-
style={{ minWidth: '100%', ...style }}
|
|
15
|
-
dangerouslySetInnerHTML={{ __html: html }}
|
|
16
|
-
/>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React, { useEffect, CSSProperties } from 'react'
|
|
4
|
-
import { Spin } from 'antd'
|
|
5
|
-
import { useBoolean } from '@wzyjs/hooks/web'
|
|
6
|
-
|
|
7
|
-
export interface IframeProProps {
|
|
8
|
-
url: string;
|
|
9
|
-
errMessage?: string;
|
|
10
|
-
style?: CSSProperties;
|
|
11
|
-
isShowLoading?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const IframePro = (props: IframeProProps) => {
|
|
15
|
-
const { url, style, errMessage = '', isShowLoading = false } = props
|
|
16
|
-
|
|
17
|
-
const [loading, { setTrue, setFalse }] = useBoolean(true)
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
setTrue()
|
|
21
|
-
}, [url])
|
|
22
|
-
|
|
23
|
-
if (!url) {
|
|
24
|
-
return (
|
|
25
|
-
<span
|
|
26
|
-
style={{
|
|
27
|
-
...style,
|
|
28
|
-
color: '#ccc',
|
|
29
|
-
fontSize: 14,
|
|
30
|
-
display: 'flex',
|
|
31
|
-
flexDirection: 'column',
|
|
32
|
-
justifyContent: 'center',
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
{errMessage || '没有url'}
|
|
37
|
-
</span>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Spin spinning={loading && isShowLoading}>
|
|
43
|
-
<iframe
|
|
44
|
-
src={url}
|
|
45
|
-
width='100%'
|
|
46
|
-
height='100%'
|
|
47
|
-
style={style}
|
|
48
|
-
onLoad={setFalse}
|
|
49
|
-
/>
|
|
50
|
-
</Spin>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
Divider,
|
|
4
|
-
Flex,
|
|
5
|
-
Space,
|
|
6
|
-
Typography,
|
|
7
|
-
Steps,
|
|
8
|
-
Tabs,
|
|
9
|
-
Collapse,
|
|
10
|
-
Descriptions,
|
|
11
|
-
Image,
|
|
12
|
-
List,
|
|
13
|
-
Popover,
|
|
14
|
-
Tooltip,
|
|
15
|
-
Card,
|
|
16
|
-
QRCode,
|
|
17
|
-
Segmented,
|
|
18
|
-
Table,
|
|
19
|
-
Tag,
|
|
20
|
-
Timeline,
|
|
21
|
-
Tree,
|
|
22
|
-
Alert,
|
|
23
|
-
Progress,
|
|
24
|
-
} from 'antd'
|
|
25
|
-
|
|
26
|
-
const ComponentMap = {
|
|
27
|
-
// 布局结构类
|
|
28
|
-
Divider,
|
|
29
|
-
Flex,
|
|
30
|
-
Space,
|
|
31
|
-
|
|
32
|
-
// 信息展示类
|
|
33
|
-
Typography,
|
|
34
|
-
'Typography.Title': Typography.Title,
|
|
35
|
-
'Typography.Text': Typography.Text,
|
|
36
|
-
'Typography.Paragraph': Typography.Paragraph,
|
|
37
|
-
'Typography.Link': Typography.Link,
|
|
38
|
-
Steps,
|
|
39
|
-
Tabs,
|
|
40
|
-
Collapse,
|
|
41
|
-
'Collapse.Panel': Collapse.Panel,
|
|
42
|
-
Description: Descriptions,
|
|
43
|
-
Image,
|
|
44
|
-
List,
|
|
45
|
-
Popover,
|
|
46
|
-
Tooltip,
|
|
47
|
-
Card,
|
|
48
|
-
QRCode,
|
|
49
|
-
Segmented,
|
|
50
|
-
Table,
|
|
51
|
-
Tag,
|
|
52
|
-
Timeline,
|
|
53
|
-
Tree,
|
|
54
|
-
Alert,
|
|
55
|
-
Progress,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface Content {
|
|
59
|
-
component: keyof typeof ComponentMap // 对应 Ant Design 组件的枚举值
|
|
60
|
-
props?: Record<string, any> // 对应组件的 props 配置
|
|
61
|
-
children?: Content[] | string // 子节点,可递归嵌套,或直接是字符串
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
interface JsonRendererProps {
|
|
65
|
-
content: Content[]
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const JsonRenderer = (props: JsonRendererProps) => {
|
|
69
|
-
const { content } = props
|
|
70
|
-
|
|
71
|
-
// 递归渲染组件的函数
|
|
72
|
-
const renderContent = (item: Content | string) => {
|
|
73
|
-
// 如果是字符串,直接返回
|
|
74
|
-
if (typeof item === 'string') {
|
|
75
|
-
return item
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const { component, props = {}, children } = item
|
|
79
|
-
|
|
80
|
-
// 获取对应的组件
|
|
81
|
-
const Component = ComponentMap[component] as React.ComponentType<any>
|
|
82
|
-
|
|
83
|
-
if (!Component) {
|
|
84
|
-
return <Alert type='error' message={`未找到组件: ${component}`} />
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// 处理子节点
|
|
88
|
-
let childrenContent
|
|
89
|
-
if (children) {
|
|
90
|
-
if (Array.isArray(children)) {
|
|
91
|
-
childrenContent = children.map((child, index) => (
|
|
92
|
-
<React.Fragment key={index}>
|
|
93
|
-
{renderContent(child)}
|
|
94
|
-
</React.Fragment>
|
|
95
|
-
))
|
|
96
|
-
} else {
|
|
97
|
-
childrenContent = renderContent(children)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// 渲染组件,传递 props 和 children
|
|
102
|
-
return <Component {...props}>{childrenContent}</Component>
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<>
|
|
107
|
-
{content.map((item, index) => (
|
|
108
|
-
<React.Fragment key={index}>
|
|
109
|
-
{renderContent(item)}
|
|
110
|
-
</React.Fragment>
|
|
111
|
-
))}
|
|
112
|
-
</>
|
|
113
|
-
)
|
|
114
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import ReactJson, { ReactJsonViewProps } from 'react-json-view'
|
|
5
|
-
|
|
6
|
-
export type JsonViewProps = ReactJsonViewProps
|
|
7
|
-
|
|
8
|
-
export const JsonView = (props: JsonViewProps) => {
|
|
9
|
-
const { style } = props
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<ReactJson
|
|
13
|
-
enableClipboard={false}
|
|
14
|
-
collapsed={true}
|
|
15
|
-
displayObjectSize={false}
|
|
16
|
-
displayDataTypes={false}
|
|
17
|
-
{...props}
|
|
18
|
-
style={{ overflow: 'auto', ...style }}
|
|
19
|
-
/>
|
|
20
|
-
)
|
|
21
|
-
}
|