Added splitter to filter sidebar.
This commit is contained in:
parent
476a01eafb
commit
27f5989eb8
@ -136,7 +136,7 @@ const FilterSidebar = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card style={{ width: '25%', flexShrink: 0, height: '100%' }}>
|
<Card style={{ flexShrink: 0, height: '100%' }}>
|
||||||
<Flex vertical gap='middle'>
|
<Flex vertical gap='middle'>
|
||||||
<Flex justify='space-between'>
|
<Flex justify='space-between'>
|
||||||
<Dropdown menu={menuItems} trigger={['hover']} placement='bottomLeft'>
|
<Dropdown menu={menuItems} trigger={['hover']} placement='bottomLeft'>
|
||||||
@ -158,14 +158,14 @@ const FilterSidebar = ({
|
|||||||
value={row.field || undefined}
|
value={row.field || undefined}
|
||||||
onChange={(v) => changeField(row.field, v)}
|
onChange={(v) => changeField(row.field, v)}
|
||||||
options={availableOptions(row.field)}
|
options={availableOptions(row.field)}
|
||||||
style={{ minWidth: 80, flex: 1 }}
|
style={{ minWidth: 80 }}
|
||||||
allowClear={false}
|
allowClear={false}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
placeholder='Value'
|
placeholder='Value'
|
||||||
value={row.value}
|
value={row.value}
|
||||||
onChange={(e) => changeValue(row.field, e.target.value)}
|
onChange={(e) => changeValue(row.field, e.target.value)}
|
||||||
style={{ width: 160 }}
|
style={{ flex: 1 }}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
icon={<CloseOutlined />}
|
icon={<CloseOutlined />}
|
||||||
|
|||||||
@ -19,7 +19,8 @@ import {
|
|||||||
Input,
|
Input,
|
||||||
Space,
|
Space,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Form
|
Form,
|
||||||
|
Splitter
|
||||||
} from 'antd'
|
} from 'antd'
|
||||||
import { LoadingOutlined } from '@ant-design/icons'
|
import { LoadingOutlined } from '@ant-design/icons'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
@ -940,50 +941,49 @@ const ObjectTable = forwardRef(
|
|||||||
|
|
||||||
const tableContent = (
|
const tableContent = (
|
||||||
<Flex gap={'middle'} vertical style={{ flex: 1, minWidth: 0 }}>
|
<Flex gap={'middle'} vertical style={{ flex: 1, minWidth: 0 }}>
|
||||||
{cards ? (
|
<Splitter className={'farmcontrol-splitter'}>
|
||||||
<Spin indicator={<LoadingOutlined />} spinning={loading}>
|
<Splitter.Panel>
|
||||||
{renderCards()}
|
{cards ? (
|
||||||
</Spin>
|
<Spin indicator={<LoadingOutlined />} spinning={loading}>
|
||||||
) : (
|
{renderCards()}
|
||||||
<Table
|
</Spin>
|
||||||
ref={tableRef}
|
) : (
|
||||||
dataSource={tableData}
|
<Table
|
||||||
columns={columnsWithSkeleton}
|
ref={tableRef}
|
||||||
className='dashboard-table'
|
dataSource={tableData}
|
||||||
pagination={false}
|
columns={columnsWithSkeleton}
|
||||||
scroll={{ y: adjustedScrollHeight }}
|
className='dashboard-table'
|
||||||
rowKey='_id'
|
pagination={false}
|
||||||
loading={{ spinning: loading, indicator: <LoadingOutlined spin /> }}
|
scroll={{ y: adjustedScrollHeight }}
|
||||||
onScroll={handleScroll}
|
rowKey='_id'
|
||||||
onChange={handleTableChange}
|
loading={{
|
||||||
showSorterTooltip={false}
|
spinning: loading,
|
||||||
style={{ height: '100%' }}
|
indicator: <LoadingOutlined spin />
|
||||||
size={size}
|
}}
|
||||||
components={components}
|
onScroll={handleScroll}
|
||||||
onRow={onRow}
|
onChange={handleTableChange}
|
||||||
/>
|
showSorterTooltip={false}
|
||||||
)}
|
style={{ height: '100%' }}
|
||||||
|
size={size}
|
||||||
|
components={components}
|
||||||
|
onRow={onRow}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Splitter.Panel>
|
||||||
|
{showFilterSidebar && (
|
||||||
|
<Splitter.Panel>
|
||||||
|
<FilterSidebar
|
||||||
|
type={type}
|
||||||
|
filter={sidebarFilter}
|
||||||
|
onFilterChange={handleSidebarFilterChange}
|
||||||
|
masterFilter={masterFilter}
|
||||||
|
/>
|
||||||
|
</Splitter.Panel>
|
||||||
|
)}
|
||||||
|
</Splitter>
|
||||||
</Flex>
|
</Flex>
|
||||||
)
|
)
|
||||||
|
|
||||||
if (showFilterSidebar) {
|
|
||||||
return (
|
|
||||||
<Flex
|
|
||||||
gap='middle'
|
|
||||||
align='flex-start'
|
|
||||||
style={{ width: '100%', height: '100%' }}
|
|
||||||
>
|
|
||||||
{tableContent}
|
|
||||||
<FilterSidebar
|
|
||||||
type={type}
|
|
||||||
filter={sidebarFilter}
|
|
||||||
onFilterChange={handleSidebarFilterChange}
|
|
||||||
masterFilter={masterFilter}
|
|
||||||
/>
|
|
||||||
</Flex>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return tableContent
|
return tableContent
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user