mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 09:45:35 +08:00
feat: reset visible
This commit is contained in:
parent
65346ca743
commit
350fd56bc9
@ -14,7 +14,11 @@ import {
|
|||||||
useDragDropContext,
|
useDragDropContext,
|
||||||
} from '@thisbeyond/solid-dnd'
|
} from '@thisbeyond/solid-dnd'
|
||||||
import { For, Show, createSignal } from 'solid-js'
|
import { For, Show, createSignal } from 'solid-js'
|
||||||
import { AccessorKey } from '~/config/enum'
|
import {
|
||||||
|
AccessorKey,
|
||||||
|
initColumnOrder,
|
||||||
|
initColumnVisibility,
|
||||||
|
} from '~/config/enum'
|
||||||
|
|
||||||
type ColumnVisibility = Partial<Record<AccessorKey, boolean>>
|
type ColumnVisibility = Partial<Record<AccessorKey, boolean>>
|
||||||
type ColumnOrder = AccessorKey[]
|
type ColumnOrder = AccessorKey[]
|
||||||
@ -107,7 +111,10 @@ export default (props: {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
class="btn btn-neutral btn-sm ml-auto mt-4 block"
|
class="btn btn-neutral btn-sm ml-auto mt-4 block"
|
||||||
onClick={() => props.onOrderChange(Object.values(AccessorKey))}
|
onClick={() => {
|
||||||
|
props.onOrderChange(initColumnOrder)
|
||||||
|
props.onVisibleChange(initColumnVisibility)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{t('reset')}
|
{t('reset')}
|
||||||
</button>
|
</button>
|
||||||
|
@ -40,3 +40,9 @@ export enum LANG {
|
|||||||
EN = 'en-US',
|
EN = 'en-US',
|
||||||
ZH = 'zh-CN',
|
ZH = 'zh-CN',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const initColumnOrder = Object.values(AccessorKey)
|
||||||
|
export const initColumnVisibility = {
|
||||||
|
...Object.fromEntries(initColumnOrder.map((i) => [i, true])),
|
||||||
|
[AccessorKey.ID]: false,
|
||||||
|
}
|
||||||
|
@ -21,7 +21,11 @@ import { isIPv6 } from 'is-ip'
|
|||||||
import { For, createEffect, createSignal } from 'solid-js'
|
import { For, createEffect, createSignal } from 'solid-js'
|
||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
import ConnectionsModal from '~/components/ConnectionsModal'
|
import ConnectionsModal from '~/components/ConnectionsModal'
|
||||||
import { AccessorKey } from '~/config/enum'
|
import {
|
||||||
|
AccessorKey,
|
||||||
|
initColumnOrder,
|
||||||
|
initColumnVisibility,
|
||||||
|
} from '~/config/enum'
|
||||||
import { secret, useRequest, wsEndpointURL } from '~/signals'
|
import { secret, useRequest, wsEndpointURL } from '~/signals'
|
||||||
import type { Connection } from '~/types'
|
import type { Connection } from '~/types'
|
||||||
|
|
||||||
@ -33,12 +37,6 @@ type ConnectionWithSpeed = Connection & {
|
|||||||
type ColumnVisibility = Partial<Record<AccessorKey, boolean>>
|
type ColumnVisibility = Partial<Record<AccessorKey, boolean>>
|
||||||
type ColumnOrder = AccessorKey[]
|
type ColumnOrder = AccessorKey[]
|
||||||
|
|
||||||
const initColumnOrder = Object.values(AccessorKey)
|
|
||||||
const initColumnVisibility = {
|
|
||||||
...Object.fromEntries(initColumnOrder.map((i) => [i, true])),
|
|
||||||
[AccessorKey.ID]: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [t] = useI18n()
|
const [t] = useI18n()
|
||||||
const [columnVisibility, setColumnVisibility] = makePersisted(
|
const [columnVisibility, setColumnVisibility] = makePersisted(
|
||||||
|
Loading…
Reference in New Issue
Block a user