-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from ssi-dk/feat/types
feat: added support for multiple tree methods, added type annotations
- Loading branch information
Showing
60 changed files
with
4,288 additions
and
7,585 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Checkbox, CheckboxGroup, Stack } from "@chakra-ui/react"; | ||
import React, { useCallback, useMemo } from "react"; | ||
import { TreeMethod } from "sap-client"; | ||
import { StringOrNumber } from "utils"; | ||
|
||
type Props = { | ||
onChange: (id: Array<string>) => void; | ||
value: Array<string>; | ||
}; | ||
|
||
export const TreeMethodCheckboxGroup = (props: Props) => { | ||
const { onChange, value } = props; | ||
|
||
const treeMethods = useMemo(() => { | ||
const methods = new Array<string>(); | ||
for (const tm in TreeMethod) { | ||
methods.push(tm); | ||
} | ||
return methods; | ||
}, []); | ||
|
||
const onChangeCallback = useCallback( | ||
(checkboxValue: StringOrNumber[]) => { | ||
onChange(checkboxValue.map((v) => String(v))); | ||
}, | ||
[onChange] | ||
); | ||
|
||
return ( | ||
<CheckboxGroup defaultValue={value} onChange={onChangeCallback}> | ||
<Stack spacing={2}> | ||
{treeMethods?.map((treeMethod) => { | ||
return <Checkbox value={treeMethod}>{treeMethod}</Checkbox>; | ||
})} | ||
</Stack> | ||
</CheckboxGroup> | ||
); | ||
}; |
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
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
Oops, something went wrong.