mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 16:43:59 +00:00
column list expand icons
This commit is contained in:
@@ -38,6 +38,7 @@ function AppObjectListItem({
|
|||||||
SubItems,
|
SubItems,
|
||||||
getCommonProps,
|
getCommonProps,
|
||||||
expandOnClick,
|
expandOnClick,
|
||||||
|
ExpandIconComponent,
|
||||||
}) {
|
}) {
|
||||||
const [isExpanded, setIsExpanded] = React.useState(false);
|
const [isExpanded, setIsExpanded] = React.useState(false);
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ function AppObjectListItem({
|
|||||||
prefix: SubItems ? (
|
prefix: SubItems ? (
|
||||||
<ExpandIconHolder2>
|
<ExpandIconHolder2>
|
||||||
{expandable ? (
|
{expandable ? (
|
||||||
<ExpandIcon
|
<ExpandIconComponent
|
||||||
isExpanded={isExpanded}
|
isExpanded={isExpanded}
|
||||||
onClick={e => {
|
onClick={e => {
|
||||||
setIsExpanded(v => !v);
|
setIsExpanded(v => !v);
|
||||||
@@ -61,7 +62,7 @@ function AppObjectListItem({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ExpandIcon isBlank />
|
<ExpandIconComponent isBlank />
|
||||||
)}
|
)}
|
||||||
</ExpandIconHolder2>
|
</ExpandIconHolder2>
|
||||||
) : null,
|
) : null,
|
||||||
@@ -119,6 +120,7 @@ export function AppObjectList({
|
|||||||
isExpandable = undefined,
|
isExpandable = undefined,
|
||||||
getCommonProps = undefined,
|
getCommonProps = undefined,
|
||||||
expandOnClick = false,
|
expandOnClick = false,
|
||||||
|
ExpandIconComponent = ExpandIcon,
|
||||||
}) {
|
}) {
|
||||||
const createComponent = data => (
|
const createComponent = data => (
|
||||||
<AppObjectListItem
|
<AppObjectListItem
|
||||||
@@ -131,6 +133,7 @@ export function AppObjectList({
|
|||||||
isExpandable={isExpandable}
|
isExpandable={isExpandable}
|
||||||
getCommonProps={getCommonProps}
|
getCommonProps={getCommonProps}
|
||||||
expandOnClick={expandOnClick}
|
expandOnClick={expandOnClick}
|
||||||
|
ExpandIconComponent={ExpandIconComponent}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ const iconNames = {
|
|||||||
|
|
||||||
'icon run': 'mdi mdi-play',
|
'icon run': 'mdi mdi-play',
|
||||||
'icon chevron-down': 'mdi mdi-chevron-down',
|
'icon chevron-down': 'mdi mdi-chevron-down',
|
||||||
|
'icon chevron-left': 'mdi mdi-chevron-left',
|
||||||
|
'icon chevron-right': 'mdi mdi-chevron-right',
|
||||||
|
'icon chevron-up': 'mdi mdi-chevron-up',
|
||||||
'icon plugin': 'mdi mdi-toy-brick',
|
'icon plugin': 'mdi mdi-toy-brick',
|
||||||
|
|
||||||
'img ok': 'mdi mdi-check-circle color-green-8',
|
'img ok': 'mdi mdi-check-circle color-green-8',
|
||||||
@@ -111,3 +114,10 @@ export function ExpandIcon({ isBlank = false, isExpanded = false, ...other }) {
|
|||||||
}
|
}
|
||||||
return <FontIcon icon={isExpanded ? 'icon minus-box' : 'icon plus-box'} {...other} />;
|
return <FontIcon icon={isExpanded ? 'icon minus-box' : 'icon plus-box'} {...other} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ChevronExpandIcon({ isBlank = false, isExpanded = false, ...other }) {
|
||||||
|
if (isBlank) {
|
||||||
|
return <FontIcon icon="icon invisible-box" {...other} />;
|
||||||
|
}
|
||||||
|
return <FontIcon icon={isExpanded ? 'icon chevron-down' : 'icon chevron-right'} {...other} />;
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import ToolbarButton from './ToolbarButton';
|
|||||||
import useShowModal from '../modals/showModal';
|
import useShowModal from '../modals/showModal';
|
||||||
import ConnectionModal from '../modals/ConnectionModal';
|
import ConnectionModal from '../modals/ConnectionModal';
|
||||||
import SubColumnParamList from '../appobj/SubColumnParamList';
|
import SubColumnParamList from '../appobj/SubColumnParamList';
|
||||||
|
import { ChevronExpandIcon } from '../icons';
|
||||||
|
|
||||||
function SubDatabaseList({ data }) {
|
function SubDatabaseList({ data }) {
|
||||||
const setDb = useSetCurrentDatabase();
|
const setDb = useSetCurrentDatabase();
|
||||||
@@ -153,6 +154,7 @@ function SqlObjectList({ conid, database }) {
|
|||||||
filter={filter}
|
filter={filter}
|
||||||
SubItems={SubColumnParamList}
|
SubItems={SubColumnParamList}
|
||||||
isExpandable={data => data.objectTypeField == 'tables' || data.objectTypeField == 'views'}
|
isExpandable={data => data.objectTypeField == 'tables' || data.objectTypeField == 'views'}
|
||||||
|
ExpandIconComponent={ChevronExpandIcon}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</WidgetsInnerContainer>
|
</WidgetsInnerContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user