@@ -19,7 +19,7 @@ import { BasicListParams, SortOrder } from "@/services/types";
1919import router from "@/router/router" ;
2020import type { RouteLocationAsRelative } from "vue-router" ;
2121
22- type ItemsLike = number | { length : number } | null | undefined ;
22+ // type ItemsLike = number | { length: number } | null | undefined;
2323type ItemsPerPageOption = { value : number ; title : string } ;
2424
2525type Clickable = { click : ( ) => void } ;
@@ -29,48 +29,50 @@ type HeaderRefs =
2929 | null
3030 | undefined ;
3131
32- export function calcDefaultItemsPerPage ( itemList : ItemsLike ) : number {
33- if (
34- itemList == null ||
35- ( typeof itemList !== "number" && itemList . length === 0 )
36- ) {
37- return 0 ;
38- }
32+ export function calcDefaultItemsPerPage ( ) : number {
33+ // NOTE: @anhefti : this makes no sense, default size should not depend on result size it is just 15
34+ // if (
35+ // itemList == null ||
36+ // (typeof itemList !== "number" && itemList.length === 0)
37+ // ) {
38+ // return 5;
39+ // }
3940
40- const maxLength = typeof itemList === "number" ? itemList : itemList . length ;
41+ // const maxLength = typeof itemList === "number" ? itemList : itemList.length;
4142
42- if ( maxLength < 5 ) return maxLength ;
43- if ( maxLength < 10 ) return 5 ;
44- if ( maxLength < 15 ) return 10 ;
43+ // if (maxLength < 5) return maxLength;
44+ // if (maxLength < 10) return 5;
45+ // if (maxLength < 15) return 10;
4546 return 15 ;
4647}
4748
48- export function calcItemsPerPage ( itemList : ItemsLike ) : ItemsPerPageOption [ ] {
49- if (
50- itemList == null ||
51- ( typeof itemList !== "number" && itemList . length === 0 )
52- ) {
53- return [ { value : 0 , title : "0" } ] ;
54- }
55-
56- const maxLength = typeof itemList === "number" ? itemList : itemList . length ;
57-
58- if ( maxLength <= 5 ) {
59- return [ { value : maxLength , title : String ( maxLength ) } ] ;
60- }
61- if ( maxLength <= 10 ) {
62- return [
63- { value : 5 , title : "5" } ,
64- { value : maxLength , title : String ( maxLength ) } ,
65- ] ;
66- }
67- if ( maxLength <= 15 ) {
68- return [
69- { value : 5 , title : "5" } ,
70- { value : 10 , title : "10" } ,
71- { value : maxLength , title : String ( maxLength ) } ,
72- ] ;
73- }
49+ export function calcItemsPerPage ( ) : ItemsPerPageOption [ ] {
50+ // NOTE: @anhefti : this makes no sense, we should have just a static chooice of options here, not ependend on result size
51+ // if (
52+ // itemList == null ||
53+ // (typeof itemList !== "number" && itemList.length === 0)
54+ // ) {
55+ // return [{ value: 5, title: "5" }];
56+ // }
57+
58+ // const maxLength = typeof itemList === "number" ? itemList : itemList.length;
59+
60+ // if (maxLength <= 5) {
61+ // return [{ value: maxLength, title: String(maxLength) }];
62+ // }
63+ // if (maxLength <= 10) {
64+ // return [
65+ // { value: 5, title: "5" },
66+ // { value: maxLength, title: String(maxLength) },
67+ // ];
68+ // }
69+ // if (maxLength <= 15) {
70+ // return [
71+ // { value: 5, title: "5" },
72+ // { value: 10, title: "10" },
73+ // { value: maxLength, title: String(maxLength) },
74+ // ];
75+ // }
7476 return [
7577 { value : 5 , title : "5" } ,
7678 { value : 10 , title : "10" } ,
0 commit comments