sprintify-ui 0.9.0 → 0.9.2

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.
@@ -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: number;
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: number;
222
+ default: undefined;
223
223
  type: NumberConstructor;
224
224
  };
225
225
  /**
@@ -13,6 +13,7 @@ declare function __VLS_template(): {
13
13
  index: number;
14
14
  }): any;
15
15
  checkedHeader?(_: any): any;
16
+ empty?(_: {}): any;
16
17
  filters?(_: {
17
18
  query: {
18
19
  [x: string]: any;
@@ -59,13 +60,13 @@ declare function __VLS_template(): {
59
60
  readonly layout: "default" | "compact";
60
61
  readonly scrollTopOnFetch: boolean;
61
62
  readonly filtersPosition: "section" | "top";
62
- readonly perPage: number;
63
63
  readonly search?: ((items: Collection, search: string | null) => Collection) | undefined;
64
64
  readonly url?: string | undefined;
65
65
  readonly actions?: ActionItem[] | undefined;
66
66
  readonly items?: Collection | undefined;
67
67
  readonly urlQuery?: Record<string, any> | undefined;
68
68
  readonly sections?: DataIteratorSection[] | undefined;
69
+ readonly perPage?: number | undefined;
69
70
  readonly onClick?: ((...args: any[]) => any) | undefined;
70
71
  readonly onDelete?: ((...args: any[]) => any) | undefined;
71
72
  readonly onCheckAll?: ((...args: any[]) => any) | undefined;
@@ -139,7 +140,7 @@ declare function __VLS_template(): {
139
140
  type: PropType<"section" | "top">;
140
141
  };
141
142
  perPage: {
142
- default: number;
143
+ default: undefined;
143
144
  type: NumberConstructor;
144
145
  };
145
146
  search: {
@@ -277,7 +278,7 @@ declare function __VLS_template(): {
277
278
  type: PropType<"section" | "top">;
278
279
  };
279
280
  perPage: {
280
- default: number;
281
+ default: undefined;
281
282
  type: NumberConstructor;
282
283
  };
283
284
  search: {
@@ -737,7 +738,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
737
738
  * Per page (only when using local data)
738
739
  */
739
740
  perPage: {
740
- default: number;
741
+ default: undefined;
741
742
  type: NumberConstructor;
742
743
  };
743
744
  /**
@@ -993,7 +994,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
993
994
  * Per page (only when using local data)
994
995
  */
995
996
  perPage: {
996
- default: number;
997
+ default: undefined;
997
998
  type: NumberConstructor;
998
999
  };
999
1000
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
@@ -326,7 +326,7 @@ const props = defineProps({
326
326
  * Per page (only when using local data)
327
327
  */
328
328
  perPage: {
329
- default: 16,
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 = 4;
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;
@@ -160,15 +160,19 @@
160
160
  </div>
161
161
  <div
162
162
  v-else-if="dataIteratorProps.firstLoad"
163
- class="flex items-center justify-center py-16"
164
163
  >
165
- <div class="flex flex-col items-center">
166
- <BaseEmptyState class="w-24" />
167
-
168
- <p class="mt-3 text-center text-sm text-slate-600">
169
- {{ t('sui.nothing_found') }}
170
- </p>
171
- </div>
164
+ <slot name="empty">
165
+ <div class="flex items-center justify-center py-16">
166
+
167
+ <div class="flex flex-col items-center">
168
+ <BaseEmptyState class="w-24" />
169
+
170
+ <p class="mt-3 text-center text-sm text-slate-600">
171
+ {{ t('sui.nothing_found') }}
172
+ </p>
173
+ </div>
174
+ </div>
175
+ </slot>
172
176
  </div>
173
177
  </template>
174
178
  </BaseDataTableTemplate>
@@ -278,7 +282,7 @@ const props = defineProps({
278
282
  * Per page (only when using local data)
279
283
  */
280
284
  perPage: {
281
- default: 16,
285
+ default: undefined,
282
286
  type: Number,
283
287
  },
284
288
 
@@ -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;