@nova-design-system/nova-vue 3.24.0 → 3.26.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,6 @@
1
- /* eslint-disable jsdoc/require-jsdoc */
2
1
  import { defineComponent, computed, h, ref, watch, watchEffect, onUnmounted, } from 'vue';
3
2
  import { useVueTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, } from '@tanstack/vue-table';
4
- import { NvTable, NvTableheader } from '../generated/components';
3
+ import { NvTable, NvTableheader, NvPaginationtable, } from '../generated/components';
5
4
  /**
6
5
  * Creates a typed NvDatatable component for a specific row type. This is the
7
6
  * standard approach for generic components in Vue.
@@ -33,6 +32,10 @@ export function createNvDatatable() {
33
32
  type: String,
34
33
  default: 'client',
35
34
  },
35
+ /**
36
+ * Pagination config. When provided, pagination is enabled.
37
+ * In client mode, if you omit renderPagination and the #pagination slot, the default nv-paginationtable is used.
38
+ */
36
39
  pagination: {
37
40
  type: Object,
38
41
  default: undefined,
@@ -41,6 +44,10 @@ export function createNvDatatable() {
41
44
  type: Object,
42
45
  default: undefined,
43
46
  },
47
+ /**
48
+ * Optional custom pagination UI. When omitted in client mode (with pagination set), the default nv-paginationtable is rendered.
49
+ * Pass a function that returns null to hide the UI while keeping pagination logic (e.g. infinite scroll).
50
+ */
44
51
  renderPagination: {
45
52
  type: Function,
46
53
  default: undefined,
@@ -330,6 +337,27 @@ export function createNvDatatable() {
330
337
  hasMore: isInfiniteScroll ? props.pagination.hasMore : undefined,
331
338
  };
332
339
  });
340
+ // Helper function for default pagination rendering with nv-paginationtable
341
+ const renderDefaultPagination = (api) => {
342
+ // Only pass label props if defined (let web component use its defaults otherwise)
343
+ const labelProps = {};
344
+ if (props.pagination?.labels?.page)
345
+ labelProps.labelPage = props.pagination.labels.page;
346
+ if (props.pagination?.labels?.total)
347
+ labelProps.labelTotal = props.pagination.labels.total;
348
+ if (props.pagination?.labels?.pageSizeOption)
349
+ labelProps.labelPageSizeOption =
350
+ props.pagination.labels.pageSizeOption;
351
+ return h(NvPaginationtable, {
352
+ pageIndex: api.pageIndex,
353
+ pageSize: api.pageSize,
354
+ pageCount: api.pageCount,
355
+ rowCount: api.rowCount,
356
+ ...labelProps,
357
+ onPageIndexChanged: (e) => api.setPageIndex(e.detail),
358
+ onPageSizeChanged: (e) => api.setPageSize(e.detail),
359
+ });
360
+ };
333
361
  return () => {
334
362
  const tableRows = table.value.getRowModel().rows;
335
363
  const isInfiniteScroll = props.pagination?.infinite === true;
@@ -400,7 +428,7 @@ export function createNvDatatable() {
400
428
  ],
401
429
  });
402
430
  // Return table with optional pagination
403
- // Priority: slots.pagination > props.renderPagination > no pagination
431
+ // Priority: slots.pagination > props.renderPagination > default pagination > no pagination
404
432
  if (paginationAPI.value) {
405
433
  if (slots.pagination) {
406
434
  // Use scoped slot (preferred)
@@ -416,6 +444,15 @@ export function createNvDatatable() {
416
444
  props.renderPagination(paginationAPI.value),
417
445
  ]);
418
446
  }
447
+ else if (props.mode === 'client' &&
448
+ props.pagination &&
449
+ !props.pagination.infinite) {
450
+ // Default pagination with nv-paginationtable (client mode only)
451
+ return h('div', {}, [
452
+ tableElement,
453
+ renderDefaultPagination(paginationAPI.value),
454
+ ]);
455
+ }
419
456
  }
420
457
  return tableElement;
421
458
  };
@@ -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',
@@ -588,6 +587,7 @@ export const NvFieldtextarea = /*@__PURE__*/ defineContainer('nv-fieldtextarea',
588
587
  'rows',
589
588
  'resize',
590
589
  'autosize',
590
+ 'maxAutoHeight',
591
591
  'autofocus',
592
592
  'fluid',
593
593
  'valueChanged'
@@ -687,6 +687,23 @@ export const NvNotificationBullet = /*@__PURE__*/ defineContainer('nv-notificati
687
687
  export const NvNotificationcontainer = /*@__PURE__*/ defineContainer('nv-notificationcontainer', undefined, [
688
688
  'position'
689
689
  ]);
690
+ export const NvPaginationtable = /*@__PURE__*/ defineContainer('nv-paginationtable', undefined, [
691
+ 'pageIndex',
692
+ 'pageSize',
693
+ 'pageCount',
694
+ 'rowCount',
695
+ 'hideControls',
696
+ 'hidePrevNext',
697
+ 'hideFirstLast',
698
+ 'labelPage',
699
+ 'labelTotal',
700
+ 'labelPageSizeOption',
701
+ 'pageIndexChanged',
702
+ 'pageSizeChanged'
703
+ ], [
704
+ 'pageIndexChanged',
705
+ 'pageSizeChanged'
706
+ ], 'pageIndex', 'pageIndexChanged', undefined);
690
707
  export const NvPopover = /*@__PURE__*/ defineContainer('nv-popover', undefined, [
691
708
  'triggerElement',
692
709
  'open',
package/dist/plugin.js CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { defineCustomElements } from '@nova-design-system/nova-webcomponents/loader';
8
8
  import { NvNotificationService, } from './providers/NotificationService';
9
+ import * as components from './generated/components';
9
10
  /**
10
11
  * This is the Vue plugin that is used to define the custom elements, event
11
12
  * handlers, and includes the notification service.
@@ -14,6 +15,11 @@ export const NovaComponents = {
14
15
  async install(app, options = {}) {
15
16
  // Define custom elements with event handling
16
17
  defineCustomElements();
18
+ // Register all Vue component wrappers globally so that
19
+ // props are passed as JS properties (not HTML attributes)
20
+ Object.entries(components).forEach(([name, component]) => {
21
+ app.component(name, component);
22
+ });
17
23
  // Install notification service
18
24
  NvNotificationService.install(app, options.notifications);
19
25
  },
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.26.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 && shx rm -rf lib/stories/components/*-migration.mdx lib/stories/components/*-guide.mdx",
40
40
  "typecheck": "tsc --emitDeclarationOnly false --noEmit"
41
41
  },
42
42
  "dependencies": {