|
@@ -7,7 +7,7 @@ import { SortableContainer, SortableElement, SortableHandle } from "react-sortab
|
|
|
import arrayMove from "array-move";
|
|
|
|
|
|
const DragHandle = SortableHandle(() => <DrawStem className='draw' />);
|
|
|
-const SortableItem = SortableElement(({ item, del, setConfig }: any) => {
|
|
|
+const SortableItem: any = SortableElement(({ item, del, setConfig }: any) => {
|
|
|
const [visible, setVisible] = useState<boolean>(false)
|
|
|
const [width, setWidth] = useState<number>(item?.width || 0)
|
|
|
return <li className='liDraw'>
|
|
@@ -19,7 +19,7 @@ const SortableItem = SortableElement(({ item, del, setConfig }: any) => {
|
|
|
<Popover
|
|
|
content={
|
|
|
<div>
|
|
|
- <InputNumber min={0} max={500} onChange={(value: number) => {
|
|
|
+ <InputNumber min={0} max={500} onChange={(value) => {
|
|
|
if (value) {
|
|
|
setWidth(value)
|
|
|
}
|
|
@@ -31,10 +31,10 @@ const SortableItem = SortableElement(({ item, del, setConfig }: any) => {
|
|
|
</div>
|
|
|
}
|
|
|
trigger="click"
|
|
|
- visible={visible}
|
|
|
+ open={visible}
|
|
|
placement='left'
|
|
|
|
|
|
- onVisibleChange={(visible) => { setVisible(visible) }}
|
|
|
+ onOpenChange={(visible) => { setVisible(visible) }}
|
|
|
>
|
|
|
<Tooltip title='宽度设置'><a><ColumnWidthOutlined /></a></Tooltip>
|
|
|
</Popover>
|
|
@@ -43,7 +43,7 @@ const SortableItem = SortableElement(({ item, del, setConfig }: any) => {
|
|
|
</li>
|
|
|
});
|
|
|
/** 外层 */
|
|
|
-const SortableList = SortableContainer(({ children }: { children: any }) => (<ul className='selectedList'>{children}</ul>));
|
|
|
+const SortableList: any = SortableContainer(({ children }: { children: any }) => (<ul className='selectedList'>{children}</ul>));
|
|
|
|
|
|
interface dataProps {
|
|
|
title: string,
|
|
@@ -142,10 +142,10 @@ function CustomListModel(props: customProps) {
|
|
|
}
|
|
|
console.log('selectData===>',)
|
|
|
// 首次赋值默认宽
|
|
|
- const setListWidth = useCallback((selectData) => {
|
|
|
+ const setListWidth = useCallback((selectData: any) => {
|
|
|
if (selectData?.length === columns?.length && !selectData?.every((item: any) => item.width)) {
|
|
|
let newSelectData: any[] = []
|
|
|
- newSelectData = selectData?.map((item: { [x: string]: any }, index: string | number) => {
|
|
|
+ newSelectData = selectData?.map((item: { [x: string]: any }, index: number) => {
|
|
|
item['width'] = columns[index]['width']
|
|
|
return item
|
|
|
})
|
|
@@ -260,7 +260,7 @@ function CustomListModel(props: customProps) {
|
|
|
onClose && onClose()
|
|
|
}, [])
|
|
|
// 设置悬浮
|
|
|
- const changeFixed = useCallback((name: string, value: number) => {
|
|
|
+ const changeFixed = useCallback((name: string, value: number | null) => {
|
|
|
let v = Number(value)
|
|
|
if (!isNaN(v)) {
|
|
|
setFixed({ ...fixed, [name]: value })
|
|
@@ -272,7 +272,7 @@ function CustomListModel(props: customProps) {
|
|
|
onClose && onClose()
|
|
|
}
|
|
|
// 设置配置参数
|
|
|
- const setConfig = useCallback((data) => {
|
|
|
+ const setConfig = useCallback((data: any) => {
|
|
|
let newServerData = selectData?.map((item) => {
|
|
|
if (item.dataIndex === data.dataIndex) {
|
|
|
item = data
|
|
@@ -300,7 +300,7 @@ function CustomListModel(props: customProps) {
|
|
|
return <Modal
|
|
|
title={null}
|
|
|
footer={null}
|
|
|
- visible={visible}
|
|
|
+ open={visible}
|
|
|
width={1100}
|
|
|
className='customListModel'
|
|
|
onCancel={cancel}
|
|
@@ -345,11 +345,11 @@ function CustomListModel(props: customProps) {
|
|
|
<a onClick={defaultConfig} style={{ marginRight: 30 }}>恢复默认</a>
|
|
|
</div>
|
|
|
<div style={{ display: 'flex', flexFlow: 'row nowarp', padding: '0 28px', justifyContent: 'space-between' }}>
|
|
|
- <div>左侧固定列数:<InputNumber size='small' style={{ width: 50 }} onChange={(value: number) => { changeFixed('left', value) }} value={fixed.left} max={100} min={0} /></div>
|
|
|
- <div>右侧固定列数:<InputNumber size='small' style={{ width: 50 }} onChange={(value: number) => { changeFixed('right', value) }} value={fixed.right} max={100} min={0} /></div>
|
|
|
+ <div>左侧固定列数:<InputNumber size='small' style={{ width: 50 }} onChange={(value) => { changeFixed('left', value) }} value={fixed.left} max={100} min={0} /></div>
|
|
|
+ <div>右侧固定列数:<InputNumber size='small' style={{ width: 50 }} onChange={(value) => { changeFixed('right', value) }} value={fixed.right} max={100} min={0} /></div>
|
|
|
</div>
|
|
|
<SortableList axis='y' onSortEnd={onSortEnd} useDragHandle>
|
|
|
- {selectData.map((item: dataProps, index: number) => <SortableItem key={'li' + index} index={index} item={item} del={() => { selectHandle(false, item) }} setConfig={setConfig} />)}
|
|
|
+ {selectData.map((item: dataProps, index: number) => <SortableItem key={'li' + index} index={index} item={item as any} del={() => { selectHandle(false, item) }} setConfig={setConfig} />)}
|
|
|
</SortableList>
|
|
|
<div className='rightOperate'>
|
|
|
<div style={{ margin: '0 auto' }}>
|