feat(connections): reset the ordering of columns

This commit is contained in:
kunish 2023-09-02 13:19:54 +08:00
parent 281bf45789
commit 9d3706f390
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
3 changed files with 12 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import { useI18n } from '@solid-primitives/i18n'
import type { import type {
DragEventHandler, DragEventHandler,
Draggable, Draggable,
@ -24,6 +25,7 @@ export default (props: {
onOrderChange: (value: ColumnOrder) => void onOrderChange: (value: ColumnOrder) => void
onVisibleChange: (value: ColumnVisibility) => void onVisibleChange: (value: ColumnVisibility) => void
}) => { }) => {
const [t] = useI18n()
const [activeKey, setActiveKey] = createSignal<AccessorKey | null>(null) const [activeKey, setActiveKey] = createSignal<AccessorKey | null>(null)
const onDragStart = ({ draggable }: { draggable: Draggable }) => const onDragStart = ({ draggable }: { draggable: Draggable }) =>
setActiveKey(draggable.id as AccessorKey) setActiveKey(draggable.id as AccessorKey)
@ -100,7 +102,15 @@ export default (props: {
<div class="sortable">{activeKey()}</div> <div class="sortable">{activeKey()}</div>
</DragOverlay> </DragOverlay>
</DragDropProvider> </DragDropProvider>
<button
class="btn btn-neutral btn-sm ml-auto mt-4 block"
onClick={() => props.onOrderChange(Object.values(AccessorKey))}
>
{t('reset')}
</button>
</div> </div>
<label class="modal-backdrop" for="connection-modal" /> <label class="modal-backdrop" for="connection-modal" />
</div> </div>
</> </>

View File

View File

@ -36,6 +36,7 @@ const dict = {
source: 'Source', source: 'Source',
destination: 'Destination', destination: 'Destination',
close: 'Close', close: 'Close',
reset: 'Reset',
}, },
'zh-Hans': { 'zh-Hans': {
add: '添加', add: '添加',
@ -70,6 +71,7 @@ const dict = {
source: '源地址', source: '源地址',
destination: '目标地址', destination: '目标地址',
close: '关闭', close: '关闭',
reset: '重置',
}, },
} }