@nova-design-system/nova-angular 3.17.0 → 3.18.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.
@@ -1 +1,2 @@
1
1
  export * from './nv-datatable.component';
2
+ export { NvDatatableCellDirective, type NvDatatableCellContext, } from './nv-datatable-cell.directive';
@@ -0,0 +1,37 @@
1
+ import { TemplateRef } from '@angular/core';
2
+ import type { CellContext } from './datatable.utils';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Context type for cell templates - uses TanStack Table's CellContext directly
6
+ */
7
+ export type NvDatatableCellContext<T> = {
8
+ /** The cell's actual value */
9
+ $implicit: CellContext<T, unknown>;
10
+ };
11
+ /**
12
+ * Directive to mark ng-templates as cell templates for specific fields.
13
+ *
14
+ * @example
15
+ * ```html
16
+ * <nv-datatable [columns]="columns" [rows]="data">
17
+ * <ng-template nvDatatableCell="name" let-context>
18
+ * <div class="font-semibold">{{ context.value }}</div>
19
+ * </ng-template>
20
+ *
21
+ * <ng-template nvDatatableCell="price" let-context>
22
+ * <span class="font-mono">${{ context.value }}</span>
23
+ * </ng-template>
24
+ * </nv-datatable>
25
+ * ```
26
+ */
27
+ export declare class NvDatatableCellDirective<T = any> {
28
+ template: TemplateRef<NvDatatableCellContext<T>>;
29
+ /**
30
+ * The field name this template should render.
31
+ * Should match a field in your column definitions.
32
+ */
33
+ nvDatatableCell: string;
34
+ constructor(template: TemplateRef<NvDatatableCellContext<T>>);
35
+ static ɵfac: i0.ɵɵFactoryDeclaration<NvDatatableCellDirective<any>, never>;
36
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NvDatatableCellDirective<any>, "ng-template[nvDatatableCell]", never, { "nvDatatableCell": { "alias": "nvDatatableCell"; "required": true; }; }, {}, never, never, true, never>;
37
+ }
@@ -1,4 +1,5 @@
1
- import { TemplateRef } from '@angular/core';
1
+ import { TemplateRef, QueryList, AfterViewInit, OnDestroy } from '@angular/core';
2
+ import { NvDatatableCellDirective } from './nv-datatable-cell.directive';
2
3
  import { type FlexRenderComponent, type ColumnDef, type CellContext } from './datatable.utils';
3
4
  import * as i0 from "@angular/core";
4
5
  export type { CellContext as NvDatatableCellContext };
@@ -27,20 +28,111 @@ export interface NvDatatableColumn<T extends NvDatatableRow> {
27
28
  $implicit: CellContext<T, unknown>;
28
29
  }>;
29
30
  }
31
+ /**
32
+ * Pagination configuration for NvDatatable.
33
+ * Supports three modes: client-side, server-side with buttons, and infinite scroll.
34
+ */
35
+ export interface NvDatatablePaginationConfig {
36
+ /** Pagination mode */
37
+ mode: 'client' | 'server' | 'infinite';
38
+ /** Initial page size (default: 10) */
39
+ initialPageSize?: number;
40
+ /** Available page size options (default: [10, 20, 50, 100]) */
41
+ pageSizeOptions?: number[];
42
+ /** Total number of rows (for server-side pagination) */
43
+ totalRowCount?: number;
44
+ /** Total number of pages (for server-side pagination) */
45
+ totalPageCount?: number;
46
+ /** Callback when pagination state changes (for server-side pagination) */
47
+ onPaginationChange?: (state: {
48
+ /** Current page index */
49
+ pageIndex: number;
50
+ /** Current page size */
51
+ pageSize: number;
52
+ }) => void;
53
+ /** Whether there are more items to load (for infinite scroll) */
54
+ hasMore?: boolean;
55
+ /** Whether data is currently loading (for infinite scroll) */
56
+ isLoading?: boolean;
57
+ /** Distance from bottom in pixels to trigger load (default: 500) */
58
+ loadMoreThreshold?: number;
59
+ /** Callback to load more data (for infinite scroll) */
60
+ onLoadMore?: () => void;
61
+ }
62
+ /**
63
+ * API exposed to pagination template for building custom pagination UI.
64
+ */
65
+ export interface NvDatatableRenderPaginationAPI {
66
+ /** Current page index (zero-based) */
67
+ pageIndex: number;
68
+ /** Current page size */
69
+ pageSize: number;
70
+ /** Total number of pages */
71
+ pageCount: number;
72
+ /** Total number of rows */
73
+ rowCount: number;
74
+ /** Navigate to first page */
75
+ firstPage: () => void;
76
+ /** Navigate to previous page */
77
+ previousPage: () => void;
78
+ /** Navigate to next page */
79
+ nextPage: () => void;
80
+ /** Navigate to last page */
81
+ lastPage: () => void;
82
+ /** Navigate to specific page by index */
83
+ setPageIndex: (index: number) => void;
84
+ /** Change page size */
85
+ setPageSize: (size: number) => void;
86
+ /** Whether previous page is available */
87
+ canPreviousPage: boolean;
88
+ /** Whether next page is available */
89
+ canNextPage: boolean;
90
+ /** Loading state (only for infinite scroll) */
91
+ isLoading?: boolean;
92
+ /** Whether more items are available (only for infinite scroll) */
93
+ hasMore?: boolean;
94
+ }
30
95
  /**
31
96
  * Nova Datatable built on TanStack Table (Angular).
32
97
  */
33
- export declare class NvDatatable<T extends NvDatatableRow = NvDatatableRow> {
98
+ export declare class NvDatatable<T extends NvDatatableRow = NvDatatableRow> implements AfterViewInit, OnDestroy {
34
99
  /** Column definitions */
35
100
  columns: import("@angular/core").InputSignal<NvDatatableColumn<T>[]>;
36
101
  /** Row data */
37
102
  rows: import("@angular/core").InputSignal<T[]>;
103
+ /** Optional pagination configuration */
104
+ pagination: import("@angular/core").InputSignal<NvDatatablePaginationConfig | undefined>;
105
+ /** Should the header stick to the top of the table when scrolling? */
106
+ stickyHeader: import("@angular/core").InputSignal<boolean>;
107
+ /** Template for custom pagination UI */
108
+ paginationTemplate?: TemplateRef<{
109
+ $implicit: NvDatatableRenderPaginationAPI;
110
+ }>;
111
+ /** Cell templates provided via nvDatatableCell directive */
112
+ cellTemplates?: QueryList<NvDatatableCellDirective<T>>;
113
+ /** Signal to track cell templates array */
114
+ private cellTemplatesSignal;
115
+ /** Map of field names to cell templates */
116
+ private cellTemplateMap;
117
+ /** Pagination state for server mode */
118
+ private paginationState;
119
+ /** Reference to table rows for infinite scroll observer */
120
+ private tableRows;
121
+ /** Intersection observer for infinite scroll */
122
+ private observer;
123
+ /** Helper to check if using infinite scroll */
124
+ isInfiniteScroll: import("@angular/core").Signal<boolean>;
38
125
  /** Computed table columns with proper typing and filtering. */
39
126
  tableColumns: import("@angular/core").Signal<ColumnDef<T>[]>;
40
127
  /** TanStack table instance with Signals */
41
128
  private tableInstance;
42
129
  /** Public getter for table instance. */
43
130
  table(): import("./datatable.utils").Table<T>;
131
+ /** Build pagination API for template */
132
+ paginationAPI: import("@angular/core").Signal<NvDatatableRenderPaginationAPI | null>;
133
+ constructor();
134
+ ngAfterViewInit(): void;
135
+ ngOnDestroy(): void;
44
136
  static ɵfac: i0.ɵɵFactoryDeclaration<NvDatatable<any>, never>;
45
- static ɵcmp: i0.ɵɵComponentDeclaration<NvDatatable<any>, "nv-datatable", never, { "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
137
+ static ɵcmp: i0.ɵɵComponentDeclaration<NvDatatable<any>, "nv-datatable", never, { "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "pagination": { "alias": "pagination"; "required": false; "isSignal": true; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; "isSignal": true; }; }, {}, ["paginationTemplate", "cellTemplates"], never, true, never>;
46
138
  }
@@ -17,7 +17,7 @@ export declare class NovaComponentsModule {
17
17
  }
18
18
  export declare class NovaComponentsValueAccessorModule {
19
19
  static ɵfac: i0.ɵɵFactoryDeclaration<NovaComponentsValueAccessorModule, never>;
20
- static ɵmod: i0.ɵɵNgModuleDeclaration<NovaComponentsValueAccessorModule, [typeof i3.NvAccordionValueAccessor, typeof i3.NvAlertValueAccessor, typeof i3.NvCalendarValueAccessor, typeof i3.NvDatagridValueAccessor, typeof i3.NvDialogValueAccessor, typeof i3.NvFieldcheckboxValueAccessor, typeof i3.NvFielddateValueAccessor, typeof i3.NvFielddaterangeValueAccessor, typeof i3.NvFielddropdownValueAccessor, typeof i3.NvFieldmultiselectValueAccessor, typeof i3.NvFieldnumberValueAccessor, typeof i3.NvFieldpasswordValueAccessor, typeof i3.NvFieldradioValueAccessor, typeof i3.NvFieldselectValueAccessor, typeof i3.NvFieldsliderValueAccessor, typeof i3.NvFieldtextValueAccessor, typeof i3.NvFieldtextareaValueAccessor, typeof i3.NvNotificationValueAccessor, typeof i3.NvPopoverValueAccessor, typeof i3.NvSplitValueAccessor, typeof i3.NvToggleValueAccessor, typeof i3.NvTogglebuttongroupValueAccessor], never, [typeof i3.NvAccordionValueAccessor, typeof i3.NvAlertValueAccessor, typeof i3.NvCalendarValueAccessor, typeof i3.NvDatagridValueAccessor, typeof i3.NvDialogValueAccessor, typeof i3.NvFieldcheckboxValueAccessor, typeof i3.NvFielddateValueAccessor, typeof i3.NvFielddaterangeValueAccessor, typeof i3.NvFielddropdownValueAccessor, typeof i3.NvFieldmultiselectValueAccessor, typeof i3.NvFieldnumberValueAccessor, typeof i3.NvFieldpasswordValueAccessor, typeof i3.NvFieldradioValueAccessor, typeof i3.NvFieldselectValueAccessor, typeof i3.NvFieldsliderValueAccessor, typeof i3.NvFieldtextValueAccessor, typeof i3.NvFieldtextareaValueAccessor, typeof i3.NvNotificationValueAccessor, typeof i3.NvPopoverValueAccessor, typeof i3.NvSplitValueAccessor, typeof i3.NvToggleValueAccessor, typeof i3.NvTogglebuttongroupValueAccessor]>;
20
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NovaComponentsValueAccessorModule, [typeof i3.NvAccordionValueAccessor, typeof i3.NvAlertValueAccessor, typeof i3.NvCalendarValueAccessor, typeof i3.NvDatagridValueAccessor, typeof i3.NvDialogValueAccessor, typeof i3.NvFieldcheckboxValueAccessor, typeof i3.NvFielddateValueAccessor, typeof i3.NvFielddaterangeValueAccessor, typeof i3.NvFielddropdownValueAccessor, typeof i3.NvFieldmultiselectValueAccessor, typeof i3.NvFieldnumberValueAccessor, typeof i3.NvFieldpasswordValueAccessor, typeof i3.NvFieldradioValueAccessor, typeof i3.NvFieldselectValueAccessor, typeof i3.NvFieldsliderValueAccessor, typeof i3.NvFieldtextValueAccessor, typeof i3.NvFieldtextareaValueAccessor, typeof i3.NvFieldtimeValueAccessor, typeof i3.NvNotificationValueAccessor, typeof i3.NvPopoverValueAccessor, typeof i3.NvSplitValueAccessor, typeof i3.NvToggleValueAccessor, typeof i3.NvTogglebuttongroupValueAccessor], never, [typeof i3.NvAccordionValueAccessor, typeof i3.NvAlertValueAccessor, typeof i3.NvCalendarValueAccessor, typeof i3.NvDatagridValueAccessor, typeof i3.NvDialogValueAccessor, typeof i3.NvFieldcheckboxValueAccessor, typeof i3.NvFielddateValueAccessor, typeof i3.NvFielddaterangeValueAccessor, typeof i3.NvFielddropdownValueAccessor, typeof i3.NvFieldmultiselectValueAccessor, typeof i3.NvFieldnumberValueAccessor, typeof i3.NvFieldpasswordValueAccessor, typeof i3.NvFieldradioValueAccessor, typeof i3.NvFieldselectValueAccessor, typeof i3.NvFieldsliderValueAccessor, typeof i3.NvFieldtextValueAccessor, typeof i3.NvFieldtextareaValueAccessor, typeof i3.NvFieldtimeValueAccessor, typeof i3.NvNotificationValueAccessor, typeof i3.NvPopoverValueAccessor, typeof i3.NvSplitValueAccessor, typeof i3.NvToggleValueAccessor, typeof i3.NvTogglebuttongroupValueAccessor]>;
21
21
  static ɵinj: i0.ɵɵInjectorDeclaration<NovaComponentsValueAccessorModule>;
22
22
  }
23
23
  export declare class NovaComponentsProvidersModule {
@@ -120,6 +120,13 @@ export declare class NvFieldtextareaValueAccessor extends ValueAccessor {
120
120
  static ɵfac: i0.ɵɵFactoryDeclaration<NvFieldtextareaValueAccessor, never>;
121
121
  static ɵdir: i0.ɵɵDirectiveDeclaration<NvFieldtextareaValueAccessor, "nv-fieldtextarea", never, {}, {}, never, never, false, never>;
122
122
  }
123
+ export declare class NvFieldtimeValueAccessor extends ValueAccessor {
124
+ constructor(el: ElementRef);
125
+ handleValueChanged(event: any): void;
126
+ writeValue(value: any): void;
127
+ static ɵfac: i0.ɵɵFactoryDeclaration<NvFieldtimeValueAccessor, never>;
128
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NvFieldtimeValueAccessor, "nv-fieldtime", never, {}, {}, never, never, false, never>;
129
+ }
123
130
  export declare class NvNotificationValueAccessor extends ValueAccessor {
124
131
  constructor(el: ElementRef);
125
132
  handleHiddenChanged(event: any): void;
@@ -441,7 +441,7 @@ export declare class NvFieldtime {
441
441
  export declare interface NvFieldtime extends Components.NvFieldtime {
442
442
  /**
443
443
  * Emit an event when the time value changes.
444
- The event detail contains the new time value (HH, HH:mm or HH:mm:ss).
444
+ The event detail contains the new time value in the format specified by the format property. @bind value
445
445
  */
446
446
  valueChanged: EventEmitter<CustomEvent<string>>;
447
447
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nova-design-system/nova-angular",
3
- "version": "3.17.0",
3
+ "version": "3.18.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",