Skip to content

Commit

Permalink
fix: table cannot scroll horizontally in mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Nov 16, 2024
1 parent 4ab34fd commit e8a48d2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
3 changes: 1 addition & 2 deletions app/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ declare global {
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}

// for vue template auto import
import { UnwrapRef } from 'vue'
declare module 'vue' {
Expand Down Expand Up @@ -174,4 +173,4 @@ declare module 'vue' {
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
}
}
}
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@xterm/addon-attach": "^0.11.0",
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"ant-design-vue": "^4.2.5",
"ant-design-vue": "^4.2.6",
"apexcharts": "^3.54.1",
"axios": "^1.7.7",
"dayjs": "^1.11.13",
Expand Down
10 changes: 5 additions & 5 deletions app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions app/src/components/StdDesign/StdDataDisplay/StdTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ const paginationSize = computed(() => {
:pagination="false"
:row-key="rowKey"
:row-selection="rowSelection"
:scroll="{ x: scrollX }"
:scroll="{ x: scrollX ?? true }"
:size="size as any"
:expanded-row-keys="expandKeysList"
@change="onTableChange"
Expand All @@ -483,7 +483,7 @@ const paginationSize = computed(() => {
<span class="ant-table-drag-icon"><HolderOutlined /></span>
{{ text }}
</template>
<template v-if="column.dataIndex === 'action'">
<div v-if="column.dataIndex === 'action'" class="action">
<template v-if="!props.disableView && !inTrash">
<AButton
type="link"
Expand Down Expand Up @@ -559,7 +559,7 @@ const paginationSize = computed(() => {
</AButton>
</APopconfirm>
</template>
</template>
</div>
</template>
</ATable>
<StdPagination
Expand Down Expand Up @@ -611,6 +611,14 @@ const paginationSize = computed(() => {
display: none;
}
}
.action {
@media (max-width: 768px) {
.ant-divider-vertical {
display: none;
}
}
}
</style>
<style lang="less">
Expand Down
5 changes: 5 additions & 0 deletions app/src/views/site/site_list/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const columns: Column[] = [{
type: input,
},
search: true,
minWidth: 400,
}, {
title: () => $gettext('Category'),
dataIndex: 'site_category_id',
Expand All @@ -34,6 +35,7 @@ const columns: Column[] = [{
sorter: true,
pithy: true,
batch: true,
minWidth: 200,
}, {
title: () => $gettext('Status'),
dataIndex: 'enabled',
Expand All @@ -60,15 +62,18 @@ const columns: Column[] = [{
},
sorter: true,
pithy: true,
minWidth: 100,
}, {
title: () => $gettext('Updated at'),
dataIndex: 'modified_at',
customRender: datetime,
sorter: true,
pithy: true,
minWidth: 200,
}, {
title: () => $gettext('Action'),
dataIndex: 'action',
minWidth: 300,
}]

export default columns

0 comments on commit e8a48d2

Please sign in to comment.