column list in database widget

This commit is contained in:
Jan Prochazka
2021-01-23 08:17:46 +01:00
parent a1f9b1c53e
commit 8a19d7c4bc
7 changed files with 66 additions and 6 deletions

View File

@@ -37,6 +37,7 @@ function AppObjectListItem({
isExpandable,
SubItems,
getCommonProps,
expandOnClick,
}) {
const [isExpanded, setIsExpanded] = React.useState(false);
@@ -51,12 +52,22 @@ function AppObjectListItem({
let commonProps = {
prefix: SubItems ? (
<ExpandIconHolder2>
{expandable ? <ExpandIcon isExpanded={isExpanded} /> : <ExpandIcon isBlank />}
{expandable ? (
<ExpandIcon
isExpanded={isExpanded}
onClick={e => {
setIsExpanded(v => !v);
e.stopPropagation();
}}
/>
) : (
<ExpandIcon isBlank />
)}
</ExpandIconHolder2>
) : null,
};
if (SubItems) {
if (SubItems && expandOnClick) {
commonProps.onClick2 = () => setIsExpanded(v => !v);
}
if (onObjectClick) {
@@ -107,6 +118,7 @@ export function AppObjectList({
groupOrdered = undefined,
isExpandable = undefined,
getCommonProps = undefined,
expandOnClick = false,
}) {
const createComponent = data => (
<AppObjectListItem
@@ -118,6 +130,7 @@ export function AppObjectList({
SubItems={SubItems}
isExpandable={isExpandable}
getCommonProps={getCommonProps}
expandOnClick={expandOnClick}
/>
);