@nova-design-system/nova-vue 3.24.0 → 3.25.0

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.
@@ -28,6 +28,10 @@ export declare function createNvDatatable<T>(): import("vue").DefineComponent<im
28
28
  type: PropType<"server" | "client">;
29
29
  default: string;
30
30
  };
31
+ /**
32
+ * Pagination config. When provided, pagination is enabled.
33
+ * In client mode, if you omit renderPagination and the #pagination slot, the default nv-paginationtable is used.
34
+ */
31
35
  pagination: {
32
36
  type: PropType<NvDatatablePaginationConfig>;
33
37
  default: any;
@@ -36,6 +40,10 @@ export declare function createNvDatatable<T>(): import("vue").DefineComponent<im
36
40
  type: PropType<NvDatatableSortingConfig>;
37
41
  default: any;
38
42
  };
43
+ /**
44
+ * Optional custom pagination UI. When omitted in client mode (with pagination set), the default nv-paginationtable is rendered.
45
+ * Pass a function that returns null to hide the UI while keeping pagination logic (e.g. infinite scroll).
46
+ */
39
47
  renderPagination: {
40
48
  type: PropType<(api: NvDatatableRenderPaginationAPI) => VNode>;
41
49
  default: any;
@@ -67,6 +75,10 @@ export declare function createNvDatatable<T>(): import("vue").DefineComponent<im
67
75
  type: PropType<"server" | "client">;
68
76
  default: string;
69
77
  };
78
+ /**
79
+ * Pagination config. When provided, pagination is enabled.
80
+ * In client mode, if you omit renderPagination and the #pagination slot, the default nv-paginationtable is used.
81
+ */
70
82
  pagination: {
71
83
  type: PropType<NvDatatablePaginationConfig>;
72
84
  default: any;
@@ -75,6 +87,10 @@ export declare function createNvDatatable<T>(): import("vue").DefineComponent<im
75
87
  type: PropType<NvDatatableSortingConfig>;
76
88
  default: any;
77
89
  };
90
+ /**
91
+ * Optional custom pagination UI. When omitted in client mode (with pagination set), the default nv-paginationtable is rendered.
92
+ * Pass a function that returns null to hide the UI while keeping pagination logic (e.g. infinite scroll).
93
+ */
78
94
  renderPagination: {
79
95
  type: PropType<(api: NvDatatableRenderPaginationAPI) => VNode>;
80
96
  default: any;
@@ -245,6 +261,15 @@ export interface NvDatatablePaginationConfig {
245
261
  initialPageSize?: number;
246
262
  /** Available page size options (default: [10, 20, 50, 100]) */
247
263
  pageSizeOptions?: number[];
264
+ /** Custom labels for pagination component (i18n support) */
265
+ labels?: {
266
+ /** Label template for the page indicator. Supports placeholders: {pageIndex}, {pageCount} */
267
+ page?: string;
268
+ /** Label template for the total row count display. Supports placeholder: {rowCount} */
269
+ total?: string;
270
+ /** Label template for the page size dropdown options. Supports placeholder: {pageSize} */
271
+ pageSizeOption?: string;
272
+ };
248
273
  /** Total number of rows (for server-side pagination) */
249
274
  totalRowCount?: number;
250
275
  /** Total number of pages (for server-side pagination) */
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable jsdoc/require-jsdoc */
2
2
  import { defineComponent, computed, h, ref, watch, watchEffect, onUnmounted, } from 'vue';
3
3
  import { useVueTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, } from '@tanstack/vue-table';
4
- import { NvTable, NvTableheader } from '../generated/components';
4
+ import { NvTable, NvTableheader, NvPaginationtable, } from '../generated/components';
5
5
  /**
6
6
  * Creates a typed NvDatatable component for a specific row type. This is the
7
7
  * standard approach for generic components in Vue.
@@ -33,6 +33,10 @@ export function createNvDatatable() {
33
33
  type: String,
34
34
  default: 'client',
35
35
  },
36
+ /**
37
+ * Pagination config. When provided, pagination is enabled.
38
+ * In client mode, if you omit renderPagination and the #pagination slot, the default nv-paginationtable is used.
39
+ */
36
40
  pagination: {
37
41
  type: Object,
38
42
  default: undefined,
@@ -41,6 +45,10 @@ export function createNvDatatable() {
41
45
  type: Object,
42
46
  default: undefined,
43
47
  },
48
+ /**
49
+ * Optional custom pagination UI. When omitted in client mode (with pagination set), the default nv-paginationtable is rendered.
50
+ * Pass a function that returns null to hide the UI while keeping pagination logic (e.g. infinite scroll).
51
+ */
44
52
  renderPagination: {
45
53
  type: Function,
46
54
  default: undefined,
@@ -330,6 +338,27 @@ export function createNvDatatable() {
330
338
  hasMore: isInfiniteScroll ? props.pagination.hasMore : undefined,
331
339
  };
332
340
  });
341
+ // Helper function for default pagination rendering with nv-paginationtable
342
+ const renderDefaultPagination = (api) => {
343
+ // Only pass label props if defined (let web component use its defaults otherwise)
344
+ const labelProps = {};
345
+ if (props.pagination?.labels?.page)
346
+ labelProps.labelPage = props.pagination.labels.page;
347
+ if (props.pagination?.labels?.total)
348
+ labelProps.labelTotal = props.pagination.labels.total;
349
+ if (props.pagination?.labels?.pageSizeOption)
350
+ labelProps.labelPageSizeOption =
351
+ props.pagination.labels.pageSizeOption;
352
+ return h(NvPaginationtable, {
353
+ pageIndex: api.pageIndex,
354
+ pageSize: api.pageSize,
355
+ pageCount: api.pageCount,
356
+ rowCount: api.rowCount,
357
+ ...labelProps,
358
+ onPageIndexChanged: (e) => api.setPageIndex(e.detail),
359
+ onPageSizeChanged: (e) => api.setPageSize(e.detail),
360
+ });
361
+ };
333
362
  return () => {
334
363
  const tableRows = table.value.getRowModel().rows;
335
364
  const isInfiniteScroll = props.pagination?.infinite === true;
@@ -400,7 +429,7 @@ export function createNvDatatable() {
400
429
  ],
401
430
  });
402
431
  // Return table with optional pagination
403
- // Priority: slots.pagination > props.renderPagination > no pagination
432
+ // Priority: slots.pagination > props.renderPagination > default pagination > no pagination
404
433
  if (paginationAPI.value) {
405
434
  if (slots.pagination) {
406
435
  // Use scoped slot (preferred)
@@ -416,6 +445,15 @@ export function createNvDatatable() {
416
445
  props.renderPagination(paginationAPI.value),
417
446
  ]);
418
447
  }
448
+ else if (props.mode === 'client' &&
449
+ props.pagination &&
450
+ !props.pagination.infinite) {
451
+ // Default pagination with nv-paginationtable (client mode only)
452
+ return h('div', {}, [
453
+ tableElement,
454
+ renderDefaultPagination(paginationAPI.value),
455
+ ]);
456
+ }
419
457
  }
420
458
  return tableElement;
421
459
  };
@@ -42,6 +42,7 @@ export declare const NvMenuitem: StencilVueComponent<JSX.NvMenuitem>;
42
42
  export declare const NvNotification: StencilVueComponent<JSX.NvNotification, JSX.NvNotification["hidden"]>;
43
43
  export declare const NvNotificationBullet: StencilVueComponent<JSX.NvNotificationBullet>;
44
44
  export declare const NvNotificationcontainer: StencilVueComponent<JSX.NvNotificationcontainer>;
45
+ export declare const NvPaginationtable: StencilVueComponent<JSX.NvPaginationtable, JSX.NvPaginationtable["pageIndex"]>;
45
46
  export declare const NvPopover: StencilVueComponent<JSX.NvPopover, JSX.NvPopover["open"]>;
46
47
  export declare const NvRow: StencilVueComponent<JSX.NvRow>;
47
48
  export declare const NvSidebar: StencilVueComponent<JSX.NvSidebar, JSX.NvSidebar["open"]>;
@@ -155,7 +155,6 @@ export const NvDatagridcolumn = /*@__PURE__*/ defineContainer('nv-datagridcolumn
155
155
  'group'
156
156
  ]);
157
157
  export const NvDialog = /*@__PURE__*/ defineContainer('nv-dialog', undefined, [
158
- 'triggerElement',
159
158
  'headerElement',
160
159
  'footerElement',
161
160
  'open',
@@ -687,6 +686,23 @@ export const NvNotificationBullet = /*@__PURE__*/ defineContainer('nv-notificati
687
686
  export const NvNotificationcontainer = /*@__PURE__*/ defineContainer('nv-notificationcontainer', undefined, [
688
687
  'position'
689
688
  ]);
689
+ export const NvPaginationtable = /*@__PURE__*/ defineContainer('nv-paginationtable', undefined, [
690
+ 'pageIndex',
691
+ 'pageSize',
692
+ 'pageCount',
693
+ 'rowCount',
694
+ 'hideControls',
695
+ 'hidePrevNext',
696
+ 'hideFirstLast',
697
+ 'labelPage',
698
+ 'labelTotal',
699
+ 'labelPageSizeOption',
700
+ 'pageIndexChanged',
701
+ 'pageSizeChanged'
702
+ ], [
703
+ 'pageIndexChanged',
704
+ 'pageSizeChanged'
705
+ ], 'pageIndex', 'pageIndexChanged', undefined);
690
706
  export const NvPopover = /*@__PURE__*/ defineContainer('nv-popover', undefined, [
691
707
  'triggerElement',
692
708
  'open',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nova-design-system/nova-vue",
3
- "version": "3.24.0",
3
+ "version": "3.25.0",
4
4
  "description": "Nova is a design system created by Elia Group to empower creators to efficiently build solutions that people love to use.",
5
5
  "author": "Elia Group",
6
6
  "homepage": "https://nova.eliagroup.io",
@@ -36,7 +36,7 @@
36
36
  "tsc:watch": "tsc -p . --outDir ./dist --watch",
37
37
  "storybook": "storybook dev -p 6008",
38
38
  "storybook.build": "storybook build -o ../../storybook-static/vue",
39
- "clean": "rimraf dist lib/generated lib/stories/generated",
39
+ "clean": "rimraf dist lib/generated lib/stories/generated lib/stories/components/*-migration.mdx lib/stories/components/*-guide.mdx",
40
40
  "typecheck": "tsc --emitDeclarationOnly false --noEmit"
41
41
  },
42
42
  "dependencies": {