sprintify-ui 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sprintify-ui.es.js +204 -201
- package/dist/types/components/BaseDataIterator.vue.d.ts +2 -2
- package/dist/types/components/BaseDataTable.vue.d.ts +5 -5
- package/package.json +1 -1
- package/src/components/BaseDataIterator.vue +5 -1
- package/src/components/BaseDataTable.stories.js +1 -2
- package/src/components/BaseDataTable.vue +1 -1
- package/src/composables/paginatedData.ts +4 -0
|
@@ -95,7 +95,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
95
95
|
* Per page (only when using local data)
|
|
96
96
|
*/
|
|
97
97
|
perPage: {
|
|
98
|
-
default:
|
|
98
|
+
default: undefined;
|
|
99
99
|
type: NumberConstructor;
|
|
100
100
|
};
|
|
101
101
|
/**
|
|
@@ -219,7 +219,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
219
219
|
* Per page (only when using local data)
|
|
220
220
|
*/
|
|
221
221
|
perPage: {
|
|
222
|
-
default:
|
|
222
|
+
default: undefined;
|
|
223
223
|
type: NumberConstructor;
|
|
224
224
|
};
|
|
225
225
|
/**
|
|
@@ -59,13 +59,13 @@ declare function __VLS_template(): {
|
|
|
59
59
|
readonly layout: "default" | "compact";
|
|
60
60
|
readonly scrollTopOnFetch: boolean;
|
|
61
61
|
readonly filtersPosition: "section" | "top";
|
|
62
|
-
readonly perPage: number;
|
|
63
62
|
readonly search?: ((items: Collection, search: string | null) => Collection) | undefined;
|
|
64
63
|
readonly url?: string | undefined;
|
|
65
64
|
readonly actions?: ActionItem[] | undefined;
|
|
66
65
|
readonly items?: Collection | undefined;
|
|
67
66
|
readonly urlQuery?: Record<string, any> | undefined;
|
|
68
67
|
readonly sections?: DataIteratorSection[] | undefined;
|
|
68
|
+
readonly perPage?: number | undefined;
|
|
69
69
|
readonly onClick?: ((...args: any[]) => any) | undefined;
|
|
70
70
|
readonly onDelete?: ((...args: any[]) => any) | undefined;
|
|
71
71
|
readonly onCheckAll?: ((...args: any[]) => any) | undefined;
|
|
@@ -139,7 +139,7 @@ declare function __VLS_template(): {
|
|
|
139
139
|
type: PropType<"section" | "top">;
|
|
140
140
|
};
|
|
141
141
|
perPage: {
|
|
142
|
-
default:
|
|
142
|
+
default: undefined;
|
|
143
143
|
type: NumberConstructor;
|
|
144
144
|
};
|
|
145
145
|
search: {
|
|
@@ -277,7 +277,7 @@ declare function __VLS_template(): {
|
|
|
277
277
|
type: PropType<"section" | "top">;
|
|
278
278
|
};
|
|
279
279
|
perPage: {
|
|
280
|
-
default:
|
|
280
|
+
default: undefined;
|
|
281
281
|
type: NumberConstructor;
|
|
282
282
|
};
|
|
283
283
|
search: {
|
|
@@ -737,7 +737,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
737
737
|
* Per page (only when using local data)
|
|
738
738
|
*/
|
|
739
739
|
perPage: {
|
|
740
|
-
default:
|
|
740
|
+
default: undefined;
|
|
741
741
|
type: NumberConstructor;
|
|
742
742
|
};
|
|
743
743
|
/**
|
|
@@ -993,7 +993,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
993
993
|
* Per page (only when using local data)
|
|
994
994
|
*/
|
|
995
995
|
perPage: {
|
|
996
|
-
default:
|
|
996
|
+
default: undefined;
|
|
997
997
|
type: NumberConstructor;
|
|
998
998
|
};
|
|
999
999
|
/**
|
package/package.json
CHANGED
|
@@ -326,7 +326,7 @@ const props = defineProps({
|
|
|
326
326
|
* Per page (only when using local data)
|
|
327
327
|
*/
|
|
328
328
|
perPage: {
|
|
329
|
-
default:
|
|
329
|
+
default: undefined,
|
|
330
330
|
type: Number,
|
|
331
331
|
},
|
|
332
332
|
|
|
@@ -805,6 +805,10 @@ function paginateItems(items: Collection | undefined) {
|
|
|
805
805
|
return [];
|
|
806
806
|
}
|
|
807
807
|
|
|
808
|
+
if (!props.perPage) {
|
|
809
|
+
return items;
|
|
810
|
+
}
|
|
811
|
+
|
|
808
812
|
return items.slice(
|
|
809
813
|
(page.value - 1) * props.perPage,
|
|
810
814
|
page.value * props.perPage
|
|
@@ -341,7 +341,7 @@ const LocalTemplate = (args) => ({
|
|
|
341
341
|
export const Local = LocalTemplate.bind({});
|
|
342
342
|
const localProps = cloneDeep(componentProps);
|
|
343
343
|
localProps.url = null;
|
|
344
|
-
localProps.perPage =
|
|
344
|
+
localProps.perPage = 10;
|
|
345
345
|
localProps.rowTo = undefined;
|
|
346
346
|
localProps.maxHeight = undefined;
|
|
347
347
|
localProps.rowKey = (row) => row.value;
|
|
@@ -350,7 +350,6 @@ Local.args = localProps;
|
|
|
350
350
|
export const VirtualScrolling = LocalTemplate.bind({});
|
|
351
351
|
const localProps2 = cloneDeep(componentProps);
|
|
352
352
|
localProps2.url = null;
|
|
353
|
-
localProps2.perPage = 500;
|
|
354
353
|
localProps2.rowTo = undefined;
|
|
355
354
|
localProps2.maxHeight = undefined;
|
|
356
355
|
localProps2.rowKey = (row) => row.value;
|
|
@@ -28,6 +28,10 @@ export function useHasPaginatedData(
|
|
|
28
28
|
const perPageUnref = unref(perPage);
|
|
29
29
|
const pageUnref = unref(page);
|
|
30
30
|
|
|
31
|
+
if (perPageUnref === undefined || perPageUnref === null) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
const total = data.value.length;
|
|
32
36
|
const perPageArr = perPageUnref ? perPageUnref : total;
|
|
33
37
|
const pageArr = pageUnref ? pageUnref : 1;
|