Browse Source

fix(nc-gui): update NcPagination page size logic

pull/8836/head
Ramesh Mane 5 months ago
parent
commit
ab21279e79
  1. 34
      packages/nc-gui/components/nc/Pagination.vue

34
packages/nc-gui/components/nc/Pagination.vue

@ -1,22 +1,28 @@
<script setup lang="ts"> <script setup lang="ts">
import NcTooltip from '~/components/nc/Tooltip.vue' import NcTooltip from '~/components/nc/Tooltip.vue'
const props = defineProps<{ const props = withDefaults(
current: number defineProps<{
total: number current: number
pageSize: number total: number
entityName?: string pageSize: number
mode?: 'simple' | 'full' entityName?: string
prevPageTooltip?: string mode?: 'simple' | 'full'
nextPageTooltip?: string prevPageTooltip?: string
firstPageTooltip?: string nextPageTooltip?: string
lastPageTooltip?: string firstPageTooltip?: string
showSizeChanger?: boolean lastPageTooltip?: string
}>() showSizeChanger?: boolean
useStoredPageSize?: boolean
}>(),
{
useStoredPageSize: true,
},
)
const emits = defineEmits(['update:current', 'update:pageSize']) const emits = defineEmits(['update:current', 'update:pageSize'])
const { total, showSizeChanger } = toRefs(props) const { total, showSizeChanger, useStoredPageSize } = toRefs(props)
const current = useVModel(props, 'current', emits) const current = useVModel(props, 'current', emits)
@ -26,7 +32,7 @@ const { gridViewPageSize, setGridViewPageSize } = useGlobal()
const localPageSize = computed({ const localPageSize = computed({
get: () => { get: () => {
if (!showSizeChanger.value) return pageSize.value if (!showSizeChanger.value || (showSizeChanger.value && !useStoredPageSize.value)) return pageSize.value
const storedPageSize = gridViewPageSize.value || 25 const storedPageSize = gridViewPageSize.value || 25

Loading…
Cancel
Save