@nova-design-system/nova-angular-19 3.19.0 → 3.20.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.
- package/dist/nova-components/fesm2022/nova-components.mjs +52 -12
- package/dist/nova-components/fesm2022/nova-components.mjs.map +1 -1
- package/dist/nova-components/lib/components/nv-datatable-cell.directive.d.ts +7 -7
- package/dist/nova-components/lib/components/nv-datatable.component.d.ts +107 -59
- package/dist/nova-components/lib/stencil-generated/components.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2093,7 +2093,8 @@ function createAngularTable(options) {
|
|
|
2093
2093
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
2094
2094
|
/* eslint-disable jsdoc/require-returns */
|
|
2095
2095
|
/**
|
|
2096
|
-
*
|
|
2096
|
+
* A powerful, flexible datatable component built on TanStack Table.
|
|
2097
|
+
* Supports custom cell rendering, column configuration, pagination, and full TypeScript typing.
|
|
2097
2098
|
*/
|
|
2098
2099
|
class NvDatatable {
|
|
2099
2100
|
/** Public getter for table instance. */
|
|
@@ -2135,27 +2136,41 @@ class NvDatatable {
|
|
|
2135
2136
|
const templateMap = this.cellTemplateMap();
|
|
2136
2137
|
return this.columns()
|
|
2137
2138
|
.filter((col) => !col.hidden)
|
|
2138
|
-
.map((col) =>
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
size: col.width,
|
|
2142
|
-
enableResizing: col.resizable ?? true,
|
|
2143
|
-
cell: (context) => {
|
|
2139
|
+
.map((col) => {
|
|
2140
|
+
// Shared cell renderer
|
|
2141
|
+
const cellRenderer = (context) => {
|
|
2144
2142
|
const fieldName = String(col.field);
|
|
2145
2143
|
const cellTemplate = templateMap.get(fieldName);
|
|
2146
2144
|
// Priority: template > renderCell > default
|
|
2147
2145
|
if (cellTemplate) {
|
|
2148
|
-
// Return TemplateRef directly -
|
|
2146
|
+
// Return TemplateRef directly - getValue() returns formatted value
|
|
2149
2147
|
return cellTemplate;
|
|
2150
2148
|
}
|
|
2151
2149
|
// Fall back to renderCell if provided
|
|
2152
2150
|
if (col.renderCell) {
|
|
2153
2151
|
return col.renderCell(context);
|
|
2154
2152
|
}
|
|
2155
|
-
// Default: just return the value
|
|
2153
|
+
// Default: just return the value (formatted if valueFormatter was used)
|
|
2156
2154
|
return context.getValue();
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2155
|
+
};
|
|
2156
|
+
return {
|
|
2157
|
+
accessorKey: col.field,
|
|
2158
|
+
accessorFn: col.valueFormatter
|
|
2159
|
+
? (row) => {
|
|
2160
|
+
const rawValue = row[col.field];
|
|
2161
|
+
return col.valueFormatter({
|
|
2162
|
+
value: rawValue,
|
|
2163
|
+
row,
|
|
2164
|
+
field: col.field,
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
: undefined,
|
|
2168
|
+
header: col.headerName || String(col.field),
|
|
2169
|
+
size: col.width,
|
|
2170
|
+
enableResizing: col.resizable ?? true,
|
|
2171
|
+
cell: cellRenderer,
|
|
2172
|
+
};
|
|
2173
|
+
});
|
|
2159
2174
|
});
|
|
2160
2175
|
/** TanStack table instance with Signals */
|
|
2161
2176
|
this.tableInstance = createAngularTable(() => {
|
|
@@ -2467,6 +2482,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
2467
2482
|
type: ContentChildren,
|
|
2468
2483
|
args: [NvDatatableCellDirective]
|
|
2469
2484
|
}] } });
|
|
2485
|
+
/********************************* UTILS **************************************/
|
|
2486
|
+
/**
|
|
2487
|
+
* Creates a strongly-typed column factory for a given row type.
|
|
2488
|
+
*
|
|
2489
|
+
* @template Row The row data type (e.g., `Product`)
|
|
2490
|
+
*
|
|
2491
|
+
* @returns {function} A function that accepts a column definition and infers:
|
|
2492
|
+
* - `K` as the field key (`keyof Row`)
|
|
2493
|
+
* - `F` as the return type of `valueFormatter` (defaults to `Row[K]`)
|
|
2494
|
+
*
|
|
2495
|
+
* @example
|
|
2496
|
+
* ```ts
|
|
2497
|
+
* // Define your row type
|
|
2498
|
+
* interface Product {
|
|
2499
|
+
* name: string;
|
|
2500
|
+
* price: number;
|
|
2501
|
+
* }
|
|
2502
|
+
*
|
|
2503
|
+
* const col = makeColumn<Product>();
|
|
2504
|
+
*/
|
|
2505
|
+
function makeColumn() {
|
|
2506
|
+
return function define(col) {
|
|
2507
|
+
return col;
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2470
2510
|
|
|
2471
2511
|
class ValueAccessor {
|
|
2472
2512
|
constructor(el) {
|
|
@@ -3681,5 +3721,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
3681
3721
|
* Generated bundle index. Do not edit.
|
|
3682
3722
|
*/
|
|
3683
3723
|
|
|
3684
|
-
export { NotificationService, NotificationServiceComponent, NovaComponentsModule, NovaComponentsValueAccessorModule, NvAccordion, NvAccordionItem, NvAccordionValueAccessor, NvAlert, NvAlertValueAccessor, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCalendarValueAccessor, NvCol, NvDatagrid, NvDatagridValueAccessor, NvDatagridcolumn, NvDatatable, NvDatatableCellDirective, NvDialog, NvDialogValueAccessor, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFieldcheckboxValueAccessor, NvFielddate, NvFielddateValueAccessor, NvFielddaterange, NvFielddaterangeValueAccessor, NvFielddropdown, NvFielddropdownValueAccessor, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldmultiselectValueAccessor, NvFieldnumber, NvFieldnumberValueAccessor, NvFieldpassword, NvFieldpasswordValueAccessor, NvFieldradio, NvFieldradioValueAccessor, NvFieldselect, NvFieldselectValueAccessor, NvFieldslider, NvFieldsliderValueAccessor, NvFieldtext, NvFieldtextValueAccessor, NvFieldtextarea, NvFieldtextareaValueAccessor, NvFieldtime, NvFieldtimeValueAccessor, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationValueAccessor, NvNotificationcontainer, NvPopover, NvPopoverValueAccessor, NvRow, NvSplit, NvSplitValueAccessor, NvStack, NvTable, NvToggle, NvToggleValueAccessor, NvTogglebutton, NvTogglebuttongroup, NvTogglebuttongroupValueAccessor, NvTooltip, VALUE_ACCESSORS, flexRenderComponent as nvDatatableRenderComponent };
|
|
3724
|
+
export { NotificationService, NotificationServiceComponent, NovaComponentsModule, NovaComponentsValueAccessorModule, NvAccordion, NvAccordionItem, NvAccordionValueAccessor, NvAlert, NvAlertValueAccessor, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCalendarValueAccessor, NvCol, NvDatagrid, NvDatagridValueAccessor, NvDatagridcolumn, NvDatatable, NvDatatableCellDirective, NvDialog, NvDialogValueAccessor, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFieldcheckboxValueAccessor, NvFielddate, NvFielddateValueAccessor, NvFielddaterange, NvFielddaterangeValueAccessor, NvFielddropdown, NvFielddropdownValueAccessor, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldmultiselectValueAccessor, NvFieldnumber, NvFieldnumberValueAccessor, NvFieldpassword, NvFieldpasswordValueAccessor, NvFieldradio, NvFieldradioValueAccessor, NvFieldselect, NvFieldselectValueAccessor, NvFieldslider, NvFieldsliderValueAccessor, NvFieldtext, NvFieldtextValueAccessor, NvFieldtextarea, NvFieldtextareaValueAccessor, NvFieldtime, NvFieldtimeValueAccessor, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationValueAccessor, NvNotificationcontainer, NvPopover, NvPopoverValueAccessor, NvRow, NvSplit, NvSplitValueAccessor, NvStack, NvTable, NvToggle, NvToggleValueAccessor, NvTogglebutton, NvTogglebuttongroup, NvTogglebuttongroupValueAccessor, NvTooltip, VALUE_ACCESSORS, makeColumn, flexRenderComponent as nvDatatableRenderComponent };
|
|
3685
3725
|
//# sourceMappingURL=nova-components.mjs.map
|