Skip to content

Commit de8eb38

Browse files
refactor: convert usePivotUiState.js to TypeScript #126
1 parent 9942885 commit de8eb38

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/composables/usePivotUiState.js renamed to src/composables/usePivotUiState.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
import { reactive } from 'vue'
22

3+
type PivotUiState = {
4+
unusedOrder: string[]
5+
zIndices: Record<string, number>
6+
maxZIndex: number
7+
openStatus: Record<string, boolean>
8+
}
9+
310
export function usePivotUiState() {
4-
const pivotUiState = reactive({
11+
const pivotUiState = reactive<PivotUiState>({
512
unusedOrder: [],
613
zIndices: {},
714
maxZIndex: 1000,
815
openStatus: {}
916
})
1017

11-
const onMoveFilterBoxToTop = (attributeName) => {
18+
const onMoveFilterBoxToTop = (attributeName: string) => {
1219
pivotUiState.maxZIndex++
1320
pivotUiState.zIndices[attributeName] = pivotUiState.maxZIndex
1421
}
1522

16-
const onUpdateOpenStatus = ({ key, value }) => {
23+
const onUpdateOpenStatus = ({
24+
key,
25+
value
26+
}: {
27+
key: string
28+
value: boolean
29+
}) => {
1730
pivotUiState.openStatus[key] = value
1831
}
1932

20-
const onUpdateUnusedOrder = (newOrder) => {
33+
const onUpdateUnusedOrder = (newOrder: string[]) => {
2134
pivotUiState.unusedOrder = newOrder
2235
}
2336

0 commit comments

Comments
 (0)