Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud-zino committed Jul 23, 2023
1 parent 9fa8dcf commit 286fa1d
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions packages/skeleton/src/lib/components/TreeView/TreeView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
*/
export function expandAll(): void {
const detailsElements = [...tree.querySelectorAll('details.tree-item')] as HTMLDetailsElement[];
detailsElements.forEach(details => {
if(!details.open) {
const summary : HTMLElement | null = details.querySelector('summary.tree-item-summary');
if(summary) summary.click();
detailsElements.forEach((details) => {
if (!details.open) {
const summary: HTMLElement | null = details.querySelector('summary.tree-item-summary');
if (summary) summary.click();
}
});
}
Expand All @@ -66,10 +66,10 @@
*/
export function collapseAll() {
const detailsElements = [...tree.querySelectorAll('details.tree-item')] as HTMLDetailsElement[];
detailsElements.forEach(details => {
if(details.open) {
const summary : HTMLElement | null = details.querySelector('summary.tree-item-summary');
if(summary) summary.click();
detailsElements.forEach((details) => {
if (details.open) {
const summary: HTMLElement | null = details.querySelector('summary.tree-item-summary');
if (summary) summary.click();
}
});
}
Expand All @@ -79,10 +79,10 @@
*/
export function selectAll() {
const detailsElements = [...tree.querySelectorAll('details.tree-item')] as HTMLDetailsElement[];
detailsElements.forEach(details => {
const input : HTMLInputElement | null = details.querySelector('input[type="checkbox"].tree-item-checkbox');
if(!input) return;
if(!input.checked) {
detailsElements.forEach((details) => {
const input: HTMLInputElement | null = details.querySelector('input[type="checkbox"].tree-item-checkbox');
if (!input) return;
if (!input.checked) {
// needs delay
setTimeout(() => {
input.click();
Expand All @@ -96,10 +96,10 @@
*/
export function deselectAll() {
const detailsElements = [...tree.querySelectorAll('details.tree-item')] as HTMLDetailsElement[];
detailsElements.forEach(details => {
const input : HTMLInputElement | null = details.querySelector('input[type="checkbox"].tree-item-checkbox');
if(!input) return;
if(input.checked){
detailsElements.forEach((details) => {
const input: HTMLInputElement | null = details.querySelector('input[type="checkbox"].tree-item-checkbox');
if (!input) return;
if (input.checked) {
// needs delay
setTimeout(() => {
input.click();
Expand Down Expand Up @@ -130,6 +130,14 @@
let tree: HTMLDivElement;
</script>

<div bind:this={tree} class="tree {classesBase}" data-testid="tree" role="tree" aria-multiselectable="true" aria-label={labelledby} aria-disabled={disabled}>
<div
bind:this={tree}
class="tree {classesBase}"
data-testid="tree"
role="tree"
aria-multiselectable="true"
aria-label={labelledby}
aria-disabled={disabled}
>
<slot />
</div>

0 comments on commit 286fa1d

Please sign in to comment.