-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: powerbi improvements * refactor: refactor powerbi filters * chore: 🔖 release
- Loading branch information
1 parent
045d433
commit d6c1bfc
Showing
8 changed files
with
134 additions
and
21 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
30 changes: 30 additions & 0 deletions
30
packages/power-bi/src/lib/components/skeleton/Skeleton.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,30 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Skeleton = styled.div<{ height: number; width: number }>` | ||
width: ${({ width }) => `${width}px`}; | ||
height: ${({ height }) => `${height}px`}; | ||
cursor: progress; | ||
background: linear-gradient(0.25turn, transparent, #fff, transparent), linear-gradient(#eee, #eee); | ||
background-repeat: no-repeat; | ||
background-size: | ||
315px 250px, | ||
315px 180px, | ||
100px 100px, | ||
225px 30px; | ||
background-position: | ||
-315px 0, | ||
0 0, | ||
0px 190px, | ||
50px 195px; | ||
border-radius: 5px; | ||
animation: loading 1.5s infinite; | ||
@keyframes loading { | ||
to { | ||
background-position: | ||
315px 0, | ||
0 0, | ||
0 190px, | ||
50px 195px; | ||
} | ||
} | ||
`; |
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,30 @@ | ||
import { useState } from 'react'; | ||
import { PowerBIFilterOptions } from '../components/Filter/Filter'; | ||
import { Report } from 'powerbi-client'; | ||
|
||
export const getVisibleFiltersFromLocalStorage = (reportId: string) => { | ||
const value = localStorage.getItem(`${reportId}-filters`); | ||
if (!value) return null; | ||
const parsedValue = JSON.parse(value); | ||
if (Array.isArray(parsedValue) && parsedValue.every((s) => typeof s === 'string')) { | ||
return parsedValue as string[]; | ||
} | ||
return null; | ||
}; | ||
|
||
export const useVisibleFilters = (report: Report, options?: PowerBIFilterOptions) => { | ||
const [filterGroupVisible, setFilterGroupVisible] = useState<string[]>( | ||
getVisibleFiltersFromLocalStorage(report.getId()) ?? options?.defaultFilterGroupVisible ?? [] | ||
); | ||
|
||
return [ | ||
filterGroupVisible, | ||
(e: Parameters<typeof setFilterGroupVisible>[0]) => { | ||
const reportId = report.getId(); | ||
if (reportId) { | ||
localStorage.setItem(`${reportId}-filters`, JSON.stringify(e)); | ||
} | ||
setFilterGroupVisible(e); | ||
}, | ||
] as const; | ||
}; |
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