Skip to content

Commit

Permalink
fix(QTable/QVirtualScroll): JSON > "virtualScrollSliceSize" default v…
Browse files Browse the repository at this point in the history
…alue; QVirtualScroll "items-size" default value
  • Loading branch information
rstoenescu committed May 3, 2024
1 parent 82d4344 commit 8fd4aa2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
14 changes: 6 additions & 8 deletions ui/src/components/table/QTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import QBtn from '../btn/QBtn.js'
import getTableMiddle from './get-table-middle.js'

import useDark, { useDarkProps } from '../../composables/private.use-dark/use-dark.js'
import { commonVirtPropsList } from '../virtual-scroll/use-virtual-scroll.js'
import { commonVirtScrollPropsList } from '../virtual-scroll/use-virtual-scroll.js'
import useFullscreen, { useFullscreenProps, useFullscreenEmits } from '../../composables/private.use-fullscreen/use-fullscreen.js'

import { useTableSort, useTableSortProps } from './table-sort.js'
Expand All @@ -28,8 +28,8 @@ import { createComponent } from '../../utils/private.create/create.js'

const bottomClass = 'q-table__bottom row items-center'

const commonVirtPropsObj = {}
commonVirtPropsList.forEach(p => { commonVirtPropsObj[ p ] = {} })
const virtScrollPassthroughProps = {}
commonVirtScrollPropsList.forEach(p => { virtScrollPassthroughProps[ p ] = {} })

export default createComponent({
name: 'QTable',
Expand Down Expand Up @@ -71,10 +71,8 @@ export default createComponent({
wrapCells: Boolean,

virtualScroll: Boolean,
virtualScrollTarget: {
default: void 0
},
...commonVirtPropsObj,
virtualScrollTarget: {},
...virtScrollPassthroughProps,

noDataLabel: String,
noResultsLabel: String,
Expand Down Expand Up @@ -266,7 +264,7 @@ export default createComponent({
const virtProps = computed(() => {
const acc = {}

commonVirtPropsList
commonVirtScrollPropsList
.forEach(p => { acc[ p ] = props[ p ] })

if (acc.virtualScrollItemSize === void 0) {
Expand Down
4 changes: 1 addition & 3 deletions ui/src/components/uploader/xhr-uploader-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ const props = {
},
fieldName: {
type: [ Function, String ],
default: () => {
return file => file.name
}
default: () => file => file.name
},
headers: [ Function, Array ],
formFields: [ Function, Array ],
Expand Down
1 change: 0 additions & 1 deletion ui/src/components/virtual-scroll/QVirtualScroll.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"items-size": {
"type": "Number",
"desc": "Number of available items in the list; Required and used only if 'itemsFn' is provided",
"default": "# void 0",
"examples": [ "100000" ],
"category": "content"
},
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/virtual-scroll/use-virtual-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function sumSize (sizeAgg, size, from, to) {
const commonVirtScrollProps = {
virtualScrollSliceSize: {
type: [ Number, String ],
default: null
default: 10
},

virtualScrollSliceRatioBefore: {
Expand Down Expand Up @@ -224,7 +224,7 @@ const commonVirtScrollProps = {
tableColspan: [ Number, String ]
}

export const commonVirtPropsList = Object.keys(commonVirtScrollProps)
export const commonVirtScrollPropsList = Object.keys(commonVirtScrollProps)

export const useVirtualScrollProps = {
virtualScrollHorizontal: Boolean,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/virtual-scroll/use-virtual-scroll.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"virtual-scroll-slice-size": {
"type": [ "Number", "String", "null" ],
"desc": "Minimum number of items to render in the virtual list",
"default": "30",
"default": "10",
"examples": [ "60", "'60'" ],
"category": "virtual-scroll"
},
Expand Down

0 comments on commit 8fd4aa2

Please sign in to comment.