mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-12-26 19:24:12 +08:00
feat: reset visible
This commit is contained in:
parent
65346ca743
commit
350fd56bc9
@ -14,7 +14,11 @@ import {
|
||||
useDragDropContext,
|
||||
} from '@thisbeyond/solid-dnd'
|
||||
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 ColumnOrder = AccessorKey[]
|
||||
@ -107,7 +111,10 @@ export default (props: {
|
||||
|
||||
<button
|
||||
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')}
|
||||
</button>
|
||||
|
@ -40,3 +40,9 @@ export enum LANG {
|
||||
EN = 'en-US',
|
||||
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 { twMerge } from 'tailwind-merge'
|
||||
import ConnectionsModal from '~/components/ConnectionsModal'
|
||||
import { AccessorKey } from '~/config/enum'
|
||||
import {
|
||||
AccessorKey,
|
||||
initColumnOrder,
|
||||
initColumnVisibility,
|
||||
} from '~/config/enum'
|
||||
import { secret, useRequest, wsEndpointURL } from '~/signals'
|
||||
import type { Connection } from '~/types'
|
||||
|
||||
@ -33,12 +37,6 @@ type ConnectionWithSpeed = Connection & {
|
||||
type ColumnVisibility = Partial<Record<AccessorKey, boolean>>
|
||||
type ColumnOrder = AccessorKey[]
|
||||
|
||||
const initColumnOrder = Object.values(AccessorKey)
|
||||
const initColumnVisibility = {
|
||||
...Object.fromEntries(initColumnOrder.map((i) => [i, true])),
|
||||
[AccessorKey.ID]: false,
|
||||
}
|
||||
|
||||
export default () => {
|
||||
const [t] = useI18n()
|
||||
const [columnVisibility, setColumnVisibility] = makePersisted(
|
||||
|
Loading…
x
Reference in New Issue
Block a user