-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/devel' into CB-5178-redesign-adm…
…inistration-menu
- Loading branch information
Showing
164 changed files
with
1,530 additions
and
1,251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
import { observer } from 'mobx-react-lite'; | ||
import { useState } from 'react'; | ||
|
||
import { TableItemGroupContext } from './TableItemGroupContext'; | ||
|
||
export interface TableItemGroupProps extends React.PropsWithChildren { | ||
expanded?: boolean; | ||
} | ||
|
||
export const TableItemGroup = observer<TableItemGroupProps>(function TableItemGroup({ expanded = true, children }) { | ||
const [internalExpanded, setExpanded] = useState(expanded); | ||
|
||
return <TableItemGroupContext.Provider value={{ expanded: internalExpanded, setExpanded }}>{children}</TableItemGroupContext.Provider>; | ||
}); |
29 changes: 29 additions & 0 deletions
29
webapp/packages/core-blocks/src/Table/TableItemGroupContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
import { observer } from 'mobx-react-lite'; | ||
import { useContext } from 'react'; | ||
|
||
import { TableItemGroupContext } from './TableItemGroupContext'; | ||
|
||
export interface TableItemGroupContentProps { | ||
children?: React.ReactNode | (() => React.ReactNode); | ||
} | ||
|
||
export const TableItemGroupContent = observer<TableItemGroupContentProps>(function TableItemGroupContent({ children }) { | ||
const context = useContext(TableItemGroupContext); | ||
|
||
if (!context) { | ||
throw new Error('TableItemGroupContent can be used only inside TableItemGroup'); | ||
} | ||
|
||
if (!context.expanded) { | ||
return null; | ||
} | ||
|
||
return <>{typeof children === 'function' ? children() : children}</>; | ||
}); |
14 changes: 14 additions & 0 deletions
14
webapp/packages/core-blocks/src/Table/TableItemGroupContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
import { createContext } from 'react'; | ||
|
||
export interface ITableItemGroupContext { | ||
expanded: boolean; | ||
setExpanded: (expanded: boolean) => void; | ||
} | ||
export const TableItemGroupContext = createContext<ITableItemGroupContext | undefined>(undefined); |
28 changes: 28 additions & 0 deletions
28
webapp/packages/core-blocks/src/Table/TableItemGroupExpand.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
|
||
.box { | ||
display: inline-block; | ||
width: 16px; | ||
height: 16px; | ||
align-self: center; | ||
} | ||
|
||
.icon { | ||
composes: theme-text-on-surface from global; | ||
width: 100%; | ||
height: 100%; | ||
cursor: pointer; | ||
opacity: 0.5; | ||
transform: rotate(-90deg); | ||
transition: transform 0.15s ease-in-out; | ||
|
||
&.expanded { | ||
transform: rotate(0deg); | ||
} | ||
} |
Oops, something went wrong.