@nova-design-system/nova-angular-19 3.15.0 → 3.17.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.
Files changed (19) hide show
  1. package/dist/nova-components/fesm2022/nova-components.mjs +990 -39
  2. package/dist/nova-components/fesm2022/nova-components.mjs.map +1 -1
  3. package/dist/nova-components/lib/components/datatable.utils/flex-render/context.d.ts +3 -0
  4. package/dist/nova-components/lib/components/datatable.utils/flex-render/flags.d.ts +40 -0
  5. package/dist/nova-components/lib/components/datatable.utils/flex-render/flex-render-component-ref.d.ts +39 -0
  6. package/dist/nova-components/lib/components/datatable.utils/flex-render/flex-render-component.d.ts +60 -0
  7. package/dist/nova-components/lib/components/datatable.utils/flex-render/view.d.ts +49 -0
  8. package/dist/nova-components/lib/components/datatable.utils/flex-render.d.ts +26 -0
  9. package/dist/nova-components/lib/components/datatable.utils/index.d.ts +6 -0
  10. package/dist/nova-components/lib/components/datatable.utils/lazy-signal-initializer.d.ts +5 -0
  11. package/dist/nova-components/lib/components/datatable.utils/proxy.d.ts +3 -0
  12. package/dist/nova-components/lib/components/index.d.ts +1 -0
  13. package/dist/nova-components/lib/components/nv-datatable.component.d.ts +46 -0
  14. package/dist/nova-components/lib/nova-components.module.d.ts +4 -3
  15. package/dist/nova-components/lib/stencil-generated/component-value-accessors.d.ts +15 -1
  16. package/dist/nova-components/lib/stencil-generated/components.d.ts +16 -21
  17. package/dist/nova-components/lib/stencil-generated/index.d.ts +1 -1
  18. package/dist/nova-components/public-api.d.ts +1 -0
  19. package/package.json +5 -3
@@ -1,10 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Directive, HostListener, NgModule, Injectable, ElementRef, CUSTOM_ELEMENTS_SCHEMA, Input, ViewChildren } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, untracked, computed, InjectionToken, inject, reflectComponentType, ViewContainerRef, Injectable, KeyValueDiffers, ChangeDetectorRef, OutputEmitterRef, TemplateRef, Type, Injector, runInInjectionContext, effect, Directive, Inject, Input, signal, input, CUSTOM_ELEMENTS_SCHEMA, HostListener, NgModule, ElementRef, ViewChildren } from '@angular/core';
3
3
  import { __decorate } from 'tslib';
4
4
  import { fromEvent, BehaviorSubject } from 'rxjs';
5
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
6
5
  import * as i2 from '@angular/common';
7
6
  import { CommonModule } from '@angular/common';
7
+ import { memo, createTable, getCoreRowModel } from '@tanstack/table-core';
8
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
9
  export * from '@nova-design-system/nova-webcomponents/constants';
9
10
 
10
11
  /* eslint-disable */
@@ -70,7 +71,7 @@ let NvAccordion = class NvAccordion {
70
71
  this.z = z;
71
72
  c.detach();
72
73
  this.el = r.nativeElement;
73
- proxyOutputs(this, this.el, ['openChanged']);
74
+ proxyOutputs(this, this.el, ['openIndexesChanged']);
74
75
  }
75
76
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvAccordion, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
76
77
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: NvAccordion, isStandalone: false, selector: "nv-accordion", inputs: { data: "data", mode: "mode", openIndexes: "openIndexes" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
@@ -1099,79 +1100,78 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1099
1100
  standalone: false
1100
1101
  }]
1101
1102
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }] });
1102
- let NvStack = class NvStack {
1103
+ let NvSplit = class NvSplit {
1103
1104
  constructor(c, r, z) {
1104
1105
  this.z = z;
1105
1106
  c.detach();
1106
1107
  this.el = r.nativeElement;
1108
+ proxyOutputs(this, this.el, ['sizesChanged']);
1107
1109
  }
1108
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvStack, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
1109
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: NvStack, isStandalone: false, selector: "nv-stack", inputs: { fill: "fill", flex: "flex", full: "full", gutter: "gutter", vertical: "vertical" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1110
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvSplit, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
1111
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: NvSplit, isStandalone: false, selector: "nv-split", inputs: { direction: "direction", gutterSize: "gutterSize", minSizes: "minSizes", sizes: "sizes" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1110
1112
  };
1111
- NvStack = __decorate([
1113
+ NvSplit = __decorate([
1112
1114
  ProxyCmp({
1113
- inputs: ['fill', 'flex', 'full', 'gutter', 'vertical']
1115
+ inputs: ['direction', 'gutterSize', 'minSizes', 'sizes'],
1116
+ methods: ['setSizes', 'getSizes', 'collapse', 'destroy']
1114
1117
  })
1115
- ], NvStack);
1116
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvStack, decorators: [{
1118
+ ], NvSplit);
1119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvSplit, decorators: [{
1117
1120
  type: Component,
1118
1121
  args: [{
1119
- selector: 'nv-stack',
1122
+ selector: 'nv-split',
1120
1123
  changeDetection: ChangeDetectionStrategy.OnPush,
1121
1124
  template: '<ng-content></ng-content>',
1122
1125
  // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1123
- inputs: ['fill', 'flex', 'full', 'gutter', 'vertical'],
1126
+ inputs: ['direction', 'gutterSize', 'minSizes', 'sizes'],
1124
1127
  standalone: false
1125
1128
  }]
1126
1129
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }] });
1127
- let NvTable = class NvTable {
1130
+ let NvStack = class NvStack {
1128
1131
  constructor(c, r, z) {
1129
1132
  this.z = z;
1130
1133
  c.detach();
1131
1134
  this.el = r.nativeElement;
1132
- proxyOutputs(this, this.el, ['action']);
1133
1135
  }
1134
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvTable, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
1135
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: NvTable, isStandalone: false, selector: "nv-table", inputs: { columnsConfig: "columnsConfig", columnsConfigJson: "columnsConfigJson", data: "data", dataJson: "dataJson", fallbackValue: "fallbackValue", noColumnsNoDataMessage: "noColumnsNoDataMessage", noDataMessage: "noDataMessage" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1136
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvStack, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
1137
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: NvStack, isStandalone: false, selector: "nv-stack", inputs: { fill: "fill", flex: "flex", full: "full", gutter: "gutter", vertical: "vertical" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1136
1138
  };
1137
- NvTable = __decorate([
1139
+ NvStack = __decorate([
1138
1140
  ProxyCmp({
1139
- inputs: ['columnsConfig', 'columnsConfigJson', 'data', 'dataJson', 'fallbackValue', 'noColumnsNoDataMessage', 'noDataMessage']
1141
+ inputs: ['fill', 'flex', 'full', 'gutter', 'vertical']
1140
1142
  })
1141
- ], NvTable);
1142
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvTable, decorators: [{
1143
+ ], NvStack);
1144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvStack, decorators: [{
1143
1145
  type: Component,
1144
1146
  args: [{
1145
- selector: 'nv-table',
1147
+ selector: 'nv-stack',
1146
1148
  changeDetection: ChangeDetectionStrategy.OnPush,
1147
1149
  template: '<ng-content></ng-content>',
1148
1150
  // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1149
- inputs: ['columnsConfig', 'columnsConfigJson', 'data', 'dataJson', 'fallbackValue', 'noColumnsNoDataMessage', 'noDataMessage'],
1151
+ inputs: ['fill', 'flex', 'full', 'gutter', 'vertical'],
1150
1152
  standalone: false
1151
1153
  }]
1152
1154
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }] });
1153
- let NvTablecolumn = class NvTablecolumn {
1155
+ let NvTable = class NvTable {
1154
1156
  constructor(c, r, z) {
1155
1157
  this.z = z;
1156
1158
  c.detach();
1157
1159
  this.el = r.nativeElement;
1158
1160
  }
1159
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvTablecolumn, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
1160
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: NvTablecolumn, isStandalone: false, selector: "nv-tablecolumn", inputs: { header: "header", name: "name" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvTable, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
1162
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: NvTable, isStandalone: false, selector: "nv-table", ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1161
1163
  };
1162
- NvTablecolumn = __decorate([
1163
- ProxyCmp({
1164
- inputs: ['header', 'name']
1165
- })
1166
- ], NvTablecolumn);
1167
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvTablecolumn, decorators: [{
1164
+ NvTable = __decorate([
1165
+ ProxyCmp({})
1166
+ ], NvTable);
1167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvTable, decorators: [{
1168
1168
  type: Component,
1169
1169
  args: [{
1170
- selector: 'nv-tablecolumn',
1170
+ selector: 'nv-table',
1171
1171
  changeDetection: ChangeDetectionStrategy.OnPush,
1172
1172
  template: '<ng-content></ng-content>',
1173
1173
  // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1174
- inputs: ['header', { name: 'name', required: true }],
1174
+ inputs: [],
1175
1175
  standalone: false
1176
1176
  }]
1177
1177
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }] });
@@ -1321,15 +1321,893 @@ const DIRECTIVES = [
1321
1321
  NvNotificationcontainer,
1322
1322
  NvPopover,
1323
1323
  NvRow,
1324
+ NvSplit,
1324
1325
  NvStack,
1325
1326
  NvTable,
1326
- NvTablecolumn,
1327
1327
  NvToggle,
1328
1328
  NvTogglebutton,
1329
1329
  NvTogglebuttongroup,
1330
1330
  NvTooltip
1331
1331
  ];
1332
1332
 
1333
+ /**
1334
+ * Implementation from @tanstack/angular-query
1335
+ * {@link https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/util/lazy-init/lazy-init.ts}
1336
+ */
1337
+ function lazyInit(initializer) {
1338
+ let object = null;
1339
+ const initializeObject = () => {
1340
+ if (!object) {
1341
+ object = untracked(() => initializer());
1342
+ }
1343
+ };
1344
+ queueMicrotask(() => initializeObject());
1345
+ const table = () => { };
1346
+ return new Proxy(table, {
1347
+ apply(target, thisArg, argArray) {
1348
+ initializeObject();
1349
+ if (typeof object === 'function') {
1350
+ return Reflect.apply(object, thisArg, argArray);
1351
+ }
1352
+ return Reflect.apply(target, thisArg, argArray);
1353
+ },
1354
+ get(_, prop, receiver) {
1355
+ initializeObject();
1356
+ return Reflect.get(object, prop, receiver);
1357
+ },
1358
+ has(_, prop) {
1359
+ initializeObject();
1360
+ return Reflect.has(object, prop);
1361
+ },
1362
+ ownKeys() {
1363
+ initializeObject();
1364
+ return Reflect.ownKeys(object);
1365
+ },
1366
+ getOwnPropertyDescriptor() {
1367
+ return {
1368
+ enumerable: true,
1369
+ configurable: true,
1370
+ };
1371
+ },
1372
+ });
1373
+ }
1374
+
1375
+ function proxifyTable(tableSignal) {
1376
+ const internalState = tableSignal;
1377
+ return new Proxy(internalState, {
1378
+ apply() {
1379
+ return tableSignal();
1380
+ },
1381
+ get(target, property) {
1382
+ if (target[property]) {
1383
+ return target[property];
1384
+ }
1385
+ const table = untracked(tableSignal);
1386
+ /**
1387
+ * Attempt to convert all accessors into computed ones,
1388
+ * excluding handlers as they do not retain any reactive value
1389
+ */
1390
+ if (property.startsWith('get') &&
1391
+ !property.endsWith('Handler')
1392
+ // e.g. getCoreRowModel, getSelectedRowModel etc.
1393
+ // We need that after a signal change even `rowModel` may mark the view as dirty.
1394
+ // This allows to always get the latest `getContext` value while using flexRender
1395
+ // && !property.endsWith('Model')
1396
+ ) {
1397
+ const maybeFn = table[property];
1398
+ if (typeof maybeFn === 'function') {
1399
+ Object.defineProperty(target, property, {
1400
+ value: toComputed(tableSignal, maybeFn),
1401
+ configurable: true,
1402
+ enumerable: true,
1403
+ });
1404
+ return target[property];
1405
+ }
1406
+ }
1407
+ // @ts-expect-error
1408
+ return (target[property] = table[property]);
1409
+ },
1410
+ has(_, prop) {
1411
+ return !!untracked(tableSignal)[prop];
1412
+ },
1413
+ ownKeys() {
1414
+ return Reflect.ownKeys(untracked(tableSignal));
1415
+ },
1416
+ getOwnPropertyDescriptor() {
1417
+ return {
1418
+ enumerable: true,
1419
+ configurable: true,
1420
+ };
1421
+ },
1422
+ });
1423
+ }
1424
+ /**
1425
+ * Here we'll handle all type of accessors:
1426
+ * - 0 argument -> e.g. table.getCanNextPage())
1427
+ * - 0~1 arguments -> e.g. table.getIsSomeRowsPinned(position?)
1428
+ * - 1 required argument -> e.g. table.getColumn(columnId)
1429
+ * - 1+ argument -> e.g. table.getRow(id, searchAll?)
1430
+ *
1431
+ * Since we are not able to detect automatically the accessors parameters,
1432
+ * we'll wrap all accessors into a cached function wrapping a computed
1433
+ * that return it's value based on the given parameters
1434
+ */
1435
+ function toComputed(signal, fn) {
1436
+ const hasArgs = fn.length > 0;
1437
+ if (!hasArgs) {
1438
+ return computed(() => {
1439
+ void signal();
1440
+ return fn();
1441
+ });
1442
+ }
1443
+ const computedCache = {};
1444
+ return (...argsArray) => {
1445
+ const serializedArgs = serializeArgs(...argsArray);
1446
+ if (computedCache.hasOwnProperty(serializedArgs)) {
1447
+ return computedCache[serializedArgs]?.();
1448
+ }
1449
+ const computedSignal = computed(() => {
1450
+ void signal();
1451
+ return fn(...argsArray);
1452
+ });
1453
+ computedCache[serializedArgs] = computedSignal;
1454
+ return computedSignal();
1455
+ };
1456
+ }
1457
+ function serializeArgs(...args) {
1458
+ return JSON.stringify(args);
1459
+ }
1460
+
1461
+ const FlexRenderComponentProps = new InjectionToken('[@tanstack/angular-table] Flex render component context props');
1462
+ function injectFlexRenderContext() {
1463
+ return inject(FlexRenderComponentProps);
1464
+ }
1465
+
1466
+ /**
1467
+ * Flags used to manage and optimize the rendering lifecycle of content of the cell,
1468
+ * while using FlexRenderDirective.
1469
+ */
1470
+ var FlexRenderFlags;
1471
+ (function (FlexRenderFlags) {
1472
+ /**
1473
+ * Indicates that the view is being created for the first time or will be cleared during the next update phase.
1474
+ * This is the initial state and will transition after the first ngDoCheck.
1475
+ */
1476
+ FlexRenderFlags[FlexRenderFlags["ViewFirstRender"] = 1] = "ViewFirstRender";
1477
+ /**
1478
+ * Represents a state where the view is not dirty, meaning no changes require rendering updates.
1479
+ */
1480
+ FlexRenderFlags[FlexRenderFlags["Pristine"] = 2] = "Pristine";
1481
+ /**
1482
+ * Indicates the `content` property has been modified or the view requires a complete re-render.
1483
+ * When this flag is enabled, the view will be cleared and recreated from scratch.
1484
+ */
1485
+ FlexRenderFlags[FlexRenderFlags["ContentChanged"] = 4] = "ContentChanged";
1486
+ /**
1487
+ * Indicates that the `props` property reference has changed.
1488
+ * When this flag is enabled, the view context is updated based on the type of the content.
1489
+ *
1490
+ * For Component view, inputs will be updated and view will be marked as dirty.
1491
+ * For TemplateRef and primitive values, view will be marked as dirty
1492
+ */
1493
+ FlexRenderFlags[FlexRenderFlags["PropsReferenceChanged"] = 8] = "PropsReferenceChanged";
1494
+ /**
1495
+ * Indicates that the current rendered view needs to be checked for changes.
1496
+ */
1497
+ FlexRenderFlags[FlexRenderFlags["DirtyCheck"] = 16] = "DirtyCheck";
1498
+ /**
1499
+ * Indicates that a signal within the `content(props)` result has changed
1500
+ */
1501
+ FlexRenderFlags[FlexRenderFlags["DirtySignal"] = 32] = "DirtySignal";
1502
+ /**
1503
+ * Indicates that the first render effect has been checked at least one time.
1504
+ */
1505
+ FlexRenderFlags[FlexRenderFlags["RenderEffectChecked"] = 64] = "RenderEffectChecked";
1506
+ })(FlexRenderFlags || (FlexRenderFlags = {}));
1507
+
1508
+ /**
1509
+ * Helper function to create a [@link FlexRenderComponent] instance, with better type-safety.
1510
+ *
1511
+ * - options object must be passed when the given component instance contains at least one required signal input.
1512
+ * - options/inputs is typed with the given component inputs
1513
+ * - options/outputs is typed with the given component outputs
1514
+ */
1515
+ function flexRenderComponent(component, ...options) {
1516
+ const { inputs, injector, outputs } = options?.[0] ?? {};
1517
+ return new FlexRenderComponent(component, inputs, injector, outputs);
1518
+ }
1519
+ /**
1520
+ * Wrapper class for a component that will be used as content for {@link FlexRenderDirective}
1521
+ *
1522
+ * Prefer {@link flexRenderComponent} helper for better type-safety
1523
+ */
1524
+ class FlexRenderComponent {
1525
+ constructor(component, inputs, injector, outputs) {
1526
+ this.component = component;
1527
+ this.inputs = inputs;
1528
+ this.injector = injector;
1529
+ this.outputs = outputs;
1530
+ this.allowedInputNames = [];
1531
+ this.allowedOutputNames = [];
1532
+ const mirror = reflectComponentType(component);
1533
+ if (!mirror) {
1534
+ throw new Error(`[@tanstack-table/angular] The provided symbol is not a component`);
1535
+ }
1536
+ this.mirror = mirror;
1537
+ for (const input of this.mirror.inputs) {
1538
+ this.allowedInputNames.push(input.propName);
1539
+ }
1540
+ for (const output of this.mirror.outputs) {
1541
+ this.allowedOutputNames.push(output.propName);
1542
+ }
1543
+ }
1544
+ }
1545
+
1546
+ class FlexRenderComponentFactory {
1547
+ #viewContainerRef = inject(ViewContainerRef);
1548
+ createComponent(flexRenderComponent, componentInjector) {
1549
+ const componentRef = this.#viewContainerRef.createComponent(flexRenderComponent.component, {
1550
+ injector: componentInjector,
1551
+ });
1552
+ const view = new FlexRenderComponentRef(componentRef, flexRenderComponent, componentInjector);
1553
+ const { inputs, outputs } = flexRenderComponent;
1554
+ if (inputs)
1555
+ view.setInputs(inputs);
1556
+ if (outputs)
1557
+ view.setOutputs(outputs);
1558
+ return view;
1559
+ }
1560
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: FlexRenderComponentFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1561
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: FlexRenderComponentFactory }); }
1562
+ }
1563
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: FlexRenderComponentFactory, decorators: [{
1564
+ type: Injectable
1565
+ }] });
1566
+ class FlexRenderComponentRef {
1567
+ #keyValueDiffersFactory;
1568
+ #componentData;
1569
+ #inputValueDiffer;
1570
+ #outputRegistry;
1571
+ constructor(componentRef, componentData, componentInjector) {
1572
+ this.componentRef = componentRef;
1573
+ this.componentInjector = componentInjector;
1574
+ this.#componentData = componentData;
1575
+ this.#keyValueDiffersFactory = componentInjector.get(KeyValueDiffers);
1576
+ this.#outputRegistry = new FlexRenderComponentOutputManager(this.#keyValueDiffersFactory, this.outputs);
1577
+ this.#inputValueDiffer = this.#keyValueDiffersFactory
1578
+ .find(this.inputs)
1579
+ .create();
1580
+ this.#inputValueDiffer.diff(this.inputs);
1581
+ this.componentRef.onDestroy(() => this.#outputRegistry.unsubscribeAll());
1582
+ }
1583
+ get component() {
1584
+ return this.#componentData.component;
1585
+ }
1586
+ get inputs() {
1587
+ return this.#componentData.inputs ?? {};
1588
+ }
1589
+ get outputs() {
1590
+ return this.#componentData.outputs ?? {};
1591
+ }
1592
+ /**
1593
+ * Get component input and output diff by the given item
1594
+ */
1595
+ diff(item) {
1596
+ return {
1597
+ inputDiff: this.#inputValueDiffer.diff(item.inputs ?? {}),
1598
+ outputDiff: this.#outputRegistry.diff(item.outputs ?? {}),
1599
+ };
1600
+ }
1601
+ /**
1602
+ *
1603
+ * @param compare Whether the current ref component instance is the same as the given one
1604
+ */
1605
+ eqType(compare) {
1606
+ return compare.component === this.component;
1607
+ }
1608
+ /**
1609
+ * Tries to update current component refs input by the new given content component.
1610
+ */
1611
+ update(content) {
1612
+ const eq = this.eqType(content);
1613
+ if (!eq)
1614
+ return;
1615
+ const { inputDiff, outputDiff } = this.diff(content);
1616
+ if (inputDiff) {
1617
+ inputDiff.forEachAddedItem(item => this.setInput(item.key, item.currentValue));
1618
+ inputDiff.forEachChangedItem(item => this.setInput(item.key, item.currentValue));
1619
+ inputDiff.forEachRemovedItem(item => this.setInput(item.key, undefined));
1620
+ }
1621
+ if (outputDiff) {
1622
+ outputDiff.forEachAddedItem(item => {
1623
+ this.setOutput(item.key, item.currentValue);
1624
+ });
1625
+ outputDiff.forEachChangedItem(item => {
1626
+ if (item.currentValue) {
1627
+ this.#outputRegistry.setListener(item.key, item.currentValue);
1628
+ }
1629
+ else {
1630
+ this.#outputRegistry.unsubscribe(item.key);
1631
+ }
1632
+ });
1633
+ outputDiff.forEachRemovedItem(item => {
1634
+ this.#outputRegistry.unsubscribe(item.key);
1635
+ });
1636
+ }
1637
+ this.#componentData = content;
1638
+ }
1639
+ markAsDirty() {
1640
+ this.componentRef.injector.get(ChangeDetectorRef).markForCheck();
1641
+ }
1642
+ setInputs(inputs) {
1643
+ for (const prop in inputs) {
1644
+ this.setInput(prop, inputs[prop]);
1645
+ }
1646
+ }
1647
+ setInput(key, value) {
1648
+ if (this.#componentData.allowedInputNames.includes(key)) {
1649
+ this.componentRef.setInput(key, value);
1650
+ }
1651
+ }
1652
+ setOutputs(outputs) {
1653
+ this.#outputRegistry.unsubscribeAll();
1654
+ for (const prop in outputs) {
1655
+ this.setOutput(prop, outputs[prop]);
1656
+ }
1657
+ }
1658
+ setOutput(outputName, emit) {
1659
+ if (!this.#componentData.allowedOutputNames.includes(outputName))
1660
+ return;
1661
+ if (!emit) {
1662
+ this.#outputRegistry.unsubscribe(outputName);
1663
+ return;
1664
+ }
1665
+ const hasListener = this.#outputRegistry.hasListener(outputName);
1666
+ this.#outputRegistry.setListener(outputName, emit);
1667
+ if (hasListener) {
1668
+ return;
1669
+ }
1670
+ const instance = this.componentRef.instance;
1671
+ const output = instance[outputName];
1672
+ if (output && output instanceof OutputEmitterRef) {
1673
+ output.subscribe(value => {
1674
+ this.#outputRegistry.getListener(outputName)?.(value);
1675
+ });
1676
+ }
1677
+ }
1678
+ }
1679
+ class FlexRenderComponentOutputManager {
1680
+ #outputSubscribers = {};
1681
+ #outputListeners = {};
1682
+ #valueDiffer;
1683
+ constructor(keyValueDiffers, initialOutputs) {
1684
+ this.#valueDiffer = keyValueDiffers.find(initialOutputs).create();
1685
+ if (initialOutputs) {
1686
+ this.#valueDiffer.diff(initialOutputs);
1687
+ }
1688
+ }
1689
+ hasListener(outputName) {
1690
+ return outputName in this.#outputListeners;
1691
+ }
1692
+ setListener(outputName, callback) {
1693
+ this.#outputListeners[outputName] = callback;
1694
+ }
1695
+ getListener(outputName) {
1696
+ return this.#outputListeners[outputName];
1697
+ }
1698
+ unsubscribeAll() {
1699
+ for (const prop in this.#outputSubscribers) {
1700
+ this.unsubscribe(prop);
1701
+ }
1702
+ }
1703
+ unsubscribe(outputName) {
1704
+ if (outputName in this.#outputSubscribers) {
1705
+ this.#outputSubscribers[outputName]?.unsubscribe();
1706
+ delete this.#outputSubscribers[outputName];
1707
+ delete this.#outputListeners[outputName];
1708
+ }
1709
+ }
1710
+ diff(outputs) {
1711
+ return this.#valueDiffer.diff(outputs ?? {});
1712
+ }
1713
+ }
1714
+
1715
+ function mapToFlexRenderTypedContent(content) {
1716
+ if (content === null || content === undefined) {
1717
+ return { kind: 'null' };
1718
+ }
1719
+ if (typeof content === 'string' || typeof content === 'number') {
1720
+ return { kind: 'primitive', content };
1721
+ }
1722
+ if (content instanceof FlexRenderComponent) {
1723
+ return { kind: 'flexRenderComponent', content };
1724
+ }
1725
+ else if (content instanceof TemplateRef) {
1726
+ return { kind: 'templateRef', content };
1727
+ }
1728
+ else if (content instanceof Type) {
1729
+ return { kind: 'component', content };
1730
+ }
1731
+ else {
1732
+ return { kind: 'primitive', content };
1733
+ }
1734
+ }
1735
+ class FlexRenderView {
1736
+ #previousContent;
1737
+ #content;
1738
+ constructor(initialContent, view) {
1739
+ this.#content = initialContent;
1740
+ this.view = view;
1741
+ }
1742
+ get previousContent() {
1743
+ return this.#previousContent ?? { kind: 'null' };
1744
+ }
1745
+ get content() {
1746
+ return this.#content;
1747
+ }
1748
+ set content(content) {
1749
+ this.#previousContent = this.#content;
1750
+ this.#content = content;
1751
+ }
1752
+ }
1753
+ class FlexRenderTemplateView extends FlexRenderView {
1754
+ constructor(initialContent, view) {
1755
+ super(initialContent, view);
1756
+ }
1757
+ updateProps(props) {
1758
+ this.view.markForCheck();
1759
+ }
1760
+ dirtyCheck() {
1761
+ // Basically a no-op. When the view is created via EmbeddedViewRef, we don't need to do any manual update
1762
+ // since this type of content has a proxy as a context, then every time the root component is checked for changes,
1763
+ // the property getter will be re-evaluated.
1764
+ //
1765
+ // If in a future we need to manually mark the view as dirty, just uncomment next line
1766
+ // this.view.markForCheck()
1767
+ }
1768
+ onDestroy(callback) {
1769
+ this.view.onDestroy(callback);
1770
+ }
1771
+ }
1772
+ class FlexRenderComponentView extends FlexRenderView {
1773
+ constructor(initialContent, view) {
1774
+ super(initialContent, view);
1775
+ }
1776
+ updateProps(props) {
1777
+ switch (this.content.kind) {
1778
+ case 'component': {
1779
+ this.view.setInputs(props);
1780
+ break;
1781
+ }
1782
+ case 'flexRenderComponent': {
1783
+ // No-op. When FlexRenderFlags.PropsReferenceChanged is set,
1784
+ // FlexRenderComponent will be updated into `dirtyCheck`.
1785
+ break;
1786
+ }
1787
+ }
1788
+ }
1789
+ dirtyCheck() {
1790
+ switch (this.content.kind) {
1791
+ case 'component': {
1792
+ // Component context is currently valuated with the cell context. Since it's reference
1793
+ // shouldn't change, we force mark the component as dirty in order to re-evaluate function invocation in view.
1794
+ // NOTE: this should behave like having a component with ChangeDetectionStrategy.Default
1795
+ this.view.markAsDirty();
1796
+ break;
1797
+ }
1798
+ case 'flexRenderComponent': {
1799
+ // Given context instance will always have a different reference than the previous one,
1800
+ // so instead of recreating the entire view, we will only update the current view
1801
+ if (this.view.eqType(this.content.content)) {
1802
+ this.view.update(this.content.content);
1803
+ }
1804
+ this.view.markAsDirty();
1805
+ break;
1806
+ }
1807
+ }
1808
+ }
1809
+ onDestroy(callback) {
1810
+ this.view.componentRef.onDestroy(callback);
1811
+ }
1812
+ }
1813
+
1814
+ class FlexRenderDirective {
1815
+ #flexRenderComponentFactory;
1816
+ #changeDetectorRef;
1817
+ #latestContent;
1818
+ #getContentValue;
1819
+ constructor(viewContainerRef, templateRef) {
1820
+ this.viewContainerRef = viewContainerRef;
1821
+ this.templateRef = templateRef;
1822
+ this.#flexRenderComponentFactory = inject(FlexRenderComponentFactory);
1823
+ this.#changeDetectorRef = inject(ChangeDetectorRef);
1824
+ this.content = undefined;
1825
+ this.props = {};
1826
+ this.injector = inject(Injector);
1827
+ this.renderFlags = FlexRenderFlags.ViewFirstRender;
1828
+ this.renderView = null;
1829
+ this.#latestContent = () => {
1830
+ const { content, props } = this;
1831
+ return typeof content !== 'function'
1832
+ ? content
1833
+ : runInInjectionContext(this.injector, () => content(props));
1834
+ };
1835
+ this.#getContentValue = memo(() => [this.#latestContent(), this.props, this.content], latestContent => {
1836
+ return mapToFlexRenderTypedContent(latestContent);
1837
+ }, { key: 'flexRenderContentValue', debug: () => false });
1838
+ this.#currentEffectRef = null;
1839
+ }
1840
+ ngOnChanges(changes) {
1841
+ if (changes['props']) {
1842
+ this.renderFlags |= FlexRenderFlags.PropsReferenceChanged;
1843
+ }
1844
+ if (changes['content']) {
1845
+ this.renderFlags |=
1846
+ FlexRenderFlags.ContentChanged | FlexRenderFlags.ViewFirstRender;
1847
+ this.update();
1848
+ }
1849
+ }
1850
+ ngDoCheck() {
1851
+ if (this.renderFlags & FlexRenderFlags.ViewFirstRender) {
1852
+ // On the initial render, the view is created during the `ngOnChanges` hook.
1853
+ // Since `ngDoCheck` is called immediately afterward, there's no need to check for changes in this phase.
1854
+ this.renderFlags &= ~FlexRenderFlags.ViewFirstRender;
1855
+ return;
1856
+ }
1857
+ this.renderFlags |= FlexRenderFlags.DirtyCheck;
1858
+ const latestContent = this.#getContentValue();
1859
+ if (latestContent.kind === 'null' || !this.renderView) {
1860
+ this.renderFlags |= FlexRenderFlags.ContentChanged;
1861
+ }
1862
+ else {
1863
+ this.renderView.content = latestContent;
1864
+ const { kind: previousKind } = this.renderView.previousContent;
1865
+ if (latestContent.kind !== previousKind) {
1866
+ this.renderFlags |= FlexRenderFlags.ContentChanged;
1867
+ }
1868
+ }
1869
+ this.update();
1870
+ }
1871
+ update() {
1872
+ if (this.renderFlags &
1873
+ (FlexRenderFlags.ContentChanged | FlexRenderFlags.ViewFirstRender)) {
1874
+ this.render();
1875
+ return;
1876
+ }
1877
+ if (this.renderFlags & FlexRenderFlags.PropsReferenceChanged) {
1878
+ if (this.renderView)
1879
+ this.renderView.updateProps(this.props);
1880
+ this.renderFlags &= ~FlexRenderFlags.PropsReferenceChanged;
1881
+ }
1882
+ if (this.renderFlags &
1883
+ (FlexRenderFlags.DirtyCheck | FlexRenderFlags.DirtySignal)) {
1884
+ if (this.renderView)
1885
+ this.renderView.dirtyCheck();
1886
+ this.renderFlags &= ~(FlexRenderFlags.DirtyCheck | FlexRenderFlags.DirtySignal);
1887
+ }
1888
+ }
1889
+ #currentEffectRef;
1890
+ render() {
1891
+ if (this.#shouldRecreateEntireView() && this.#currentEffectRef) {
1892
+ this.#currentEffectRef.destroy();
1893
+ this.#currentEffectRef = null;
1894
+ this.renderFlags &= ~FlexRenderFlags.RenderEffectChecked;
1895
+ }
1896
+ this.viewContainerRef.clear();
1897
+ this.renderFlags =
1898
+ FlexRenderFlags.Pristine |
1899
+ (this.renderFlags & FlexRenderFlags.ViewFirstRender) |
1900
+ (this.renderFlags & FlexRenderFlags.RenderEffectChecked);
1901
+ const resolvedContent = this.#getContentValue();
1902
+ if (resolvedContent.kind === 'null') {
1903
+ this.renderView = null;
1904
+ }
1905
+ else {
1906
+ this.renderView = this.#renderViewByContent(resolvedContent);
1907
+ }
1908
+ // If the content is a function `content(props)`, we initialize an effect
1909
+ // in order to react to changes if the given definition use signals.
1910
+ if (!this.#currentEffectRef && typeof this.content === 'function') {
1911
+ this.#currentEffectRef = effect(() => {
1912
+ this.#latestContent();
1913
+ if (!(this.renderFlags & FlexRenderFlags.RenderEffectChecked)) {
1914
+ this.renderFlags |= FlexRenderFlags.RenderEffectChecked;
1915
+ return;
1916
+ }
1917
+ this.renderFlags |= FlexRenderFlags.DirtySignal;
1918
+ // This will mark the view as changed,
1919
+ // so we'll try to check for updates into ngDoCheck
1920
+ this.#changeDetectorRef.markForCheck();
1921
+ }, { injector: this.viewContainerRef.injector });
1922
+ }
1923
+ }
1924
+ #shouldRecreateEntireView() {
1925
+ return (this.renderFlags &
1926
+ FlexRenderFlags.ContentChanged &
1927
+ FlexRenderFlags.ViewFirstRender);
1928
+ }
1929
+ #renderViewByContent(content) {
1930
+ if (content.kind === 'primitive') {
1931
+ return this.#renderStringContent(content);
1932
+ }
1933
+ else if (content.kind === 'templateRef') {
1934
+ return this.#renderTemplateRefContent(content);
1935
+ }
1936
+ else if (content.kind === 'flexRenderComponent') {
1937
+ return this.#renderComponent(content);
1938
+ }
1939
+ else if (content.kind === 'component') {
1940
+ return this.#renderCustomComponent(content);
1941
+ }
1942
+ else {
1943
+ return null;
1944
+ }
1945
+ }
1946
+ #renderStringContent(template) {
1947
+ const context = () => {
1948
+ return typeof this.content === 'string' ||
1949
+ typeof this.content === 'number'
1950
+ ? this.content
1951
+ : this.content?.(this.props);
1952
+ };
1953
+ const ref = this.viewContainerRef.createEmbeddedView(this.templateRef, {
1954
+ get $implicit() {
1955
+ return context();
1956
+ },
1957
+ });
1958
+ return new FlexRenderTemplateView(template, ref);
1959
+ }
1960
+ #renderTemplateRefContent(template) {
1961
+ const latestContext = () => this.props;
1962
+ const view = this.viewContainerRef.createEmbeddedView(template.content, {
1963
+ get $implicit() {
1964
+ return latestContext();
1965
+ },
1966
+ });
1967
+ return new FlexRenderTemplateView(template, view);
1968
+ }
1969
+ #renderComponent(flexRenderComponent) {
1970
+ const { inputs, outputs, injector } = flexRenderComponent.content;
1971
+ const getContext = () => this.props;
1972
+ const proxy = new Proxy(this.props, {
1973
+ get: (_, key) => getContext()[key],
1974
+ });
1975
+ const componentInjector = Injector.create({
1976
+ parent: injector ?? this.injector,
1977
+ providers: [{ provide: FlexRenderComponentProps, useValue: proxy }],
1978
+ });
1979
+ const view = this.#flexRenderComponentFactory.createComponent(flexRenderComponent.content, componentInjector);
1980
+ return new FlexRenderComponentView(flexRenderComponent, view);
1981
+ }
1982
+ #renderCustomComponent(component) {
1983
+ const view = this.#flexRenderComponentFactory.createComponent(flexRenderComponent(component.content, {
1984
+ inputs: this.props,
1985
+ injector: this.injector,
1986
+ }), this.injector);
1987
+ return new FlexRenderComponentView(component, view);
1988
+ }
1989
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: FlexRenderDirective, deps: [{ token: ViewContainerRef }, { token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1990
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: FlexRenderDirective, isStandalone: true, selector: "[flexRender]", inputs: { content: ["flexRender", "content"], props: ["flexRenderProps", "props"], injector: ["flexRenderInjector", "injector"] }, providers: [FlexRenderComponentFactory], usesOnChanges: true, ngImport: i0 }); }
1991
+ }
1992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: FlexRenderDirective, decorators: [{
1993
+ type: Directive,
1994
+ args: [{
1995
+ selector: '[flexRender]',
1996
+ standalone: true,
1997
+ providers: [FlexRenderComponentFactory],
1998
+ }]
1999
+ }], ctorParameters: () => [{ type: i0.ViewContainerRef, decorators: [{
2000
+ type: Inject,
2001
+ args: [ViewContainerRef]
2002
+ }] }, { type: i0.TemplateRef, decorators: [{
2003
+ type: Inject,
2004
+ args: [TemplateRef]
2005
+ }] }], propDecorators: { content: [{
2006
+ type: Input,
2007
+ args: [{ required: true, alias: 'flexRender' }]
2008
+ }], props: [{
2009
+ type: Input,
2010
+ args: [{ required: true, alias: 'flexRenderProps' }]
2011
+ }], injector: [{
2012
+ type: Input,
2013
+ args: [{ required: false, alias: 'flexRenderInjector' }]
2014
+ }] } });
2015
+
2016
+ function createAngularTable(options) {
2017
+ return lazyInit(() => {
2018
+ const resolvedOptions = {
2019
+ state: {},
2020
+ onStateChange: () => { },
2021
+ renderFallbackValue: null,
2022
+ ...options(),
2023
+ };
2024
+ const table = createTable(resolvedOptions);
2025
+ // By default, manage table state here using the table's initial state
2026
+ const state = signal(table.initialState);
2027
+ // Compose table options using computed.
2028
+ // This is to allow `tableSignal` to listen and set table option
2029
+ const updatedOptions = computed(() => {
2030
+ // listen to table state changed
2031
+ const tableState = state();
2032
+ // listen to input options changed
2033
+ const tableOptions = options();
2034
+ return {
2035
+ ...table.options,
2036
+ ...resolvedOptions,
2037
+ ...tableOptions,
2038
+ state: { ...tableState, ...tableOptions.state },
2039
+ onStateChange: updater => {
2040
+ const value = updater instanceof Function ? updater(tableState) : updater;
2041
+ state.set(value);
2042
+ resolvedOptions.onStateChange?.(updater);
2043
+ },
2044
+ };
2045
+ });
2046
+ // convert table instance to signal for proxify to listen to any table state and options changes
2047
+ const tableSignal = computed(() => {
2048
+ table.setOptions(updatedOptions());
2049
+ return table;
2050
+ }, {
2051
+ equal: () => false,
2052
+ });
2053
+ // proxify Table instance to provide ability for consumer to listen to any table state changes
2054
+ return proxifyTable(tableSignal);
2055
+ });
2056
+ }
2057
+
2058
+ /* eslint-disable jsdoc/require-jsdoc */
2059
+ /* eslint-disable jsdoc/require-returns */
2060
+ /**
2061
+ * Nova Datatable built on TanStack Table (Angular).
2062
+ */
2063
+ class NvDatatable {
2064
+ constructor() {
2065
+ /** Column definitions */
2066
+ this.columns = input([]);
2067
+ /** Row data */
2068
+ this.rows = input([]);
2069
+ /** Computed table columns with proper typing and filtering. */
2070
+ this.tableColumns = computed(() => this.columns()
2071
+ .filter((col) => !col.hidden)
2072
+ .map((col) => ({
2073
+ accessorKey: col.field,
2074
+ header: col.headerName || String(col.field),
2075
+ size: col.width,
2076
+ enableResizing: col.resizable ?? true,
2077
+ cell: col.renderCell ??
2078
+ ((context) => context.getValue()),
2079
+ })));
2080
+ /** TanStack table instance with Signals */
2081
+ this.tableInstance = createAngularTable(() => ({
2082
+ data: this.rows(),
2083
+ columns: this.tableColumns(),
2084
+ getCoreRowModel: getCoreRowModel(),
2085
+ }));
2086
+ }
2087
+ /** Public getter for table instance. */
2088
+ table() {
2089
+ return this.tableInstance();
2090
+ }
2091
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvDatatable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2092
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: NvDatatable, isStandalone: true, selector: "nv-datatable", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
2093
+ <nv-table>
2094
+ <table>
2095
+ <thead>
2096
+ @for (headerGroup of table().getHeaderGroups(); track headerGroup.id)
2097
+ {
2098
+ <tr>
2099
+ @for (header of headerGroup.headers; track header.id) {
2100
+ <th
2101
+ [attr.data-testid]="'datatable-header-' + header.id"
2102
+ [style.width]="
2103
+ header.column.columnDef.size
2104
+ ? header.column.columnDef.size + 'px'
2105
+ : null
2106
+ "
2107
+ [attr.data-no-resize]="
2108
+ !header.column.columnDef.enableResizing ? 'true' : null
2109
+ "
2110
+ >
2111
+ @if (!header.isPlaceholder) {
2112
+ {{ header.column.columnDef.header }}
2113
+ }
2114
+ </th>
2115
+ }
2116
+ </tr>
2117
+ }
2118
+ </thead>
2119
+
2120
+ <tbody>
2121
+ @for (row of table().getRowModel().rows; track row.id) {
2122
+ <tr [attr.data-testid]="'datatable-row-' + row.id">
2123
+ @for (cell of row.getVisibleCells(); track cell.id) {
2124
+ <td
2125
+ [attr.data-testid]="'datatable-cell-' + cell.id"
2126
+ style="padding: 8px; border-bottom: 1px solid #eee;"
2127
+ >
2128
+ <!-- Let FlexRender handle strings vs TemplateRef -->
2129
+ <ng-container
2130
+ *flexRender="
2131
+ cell.column.columnDef.cell;
2132
+ props: cell.getContext();
2133
+ let cellContent
2134
+ "
2135
+ >
2136
+ {{ cellContent }}
2137
+ </ng-container>
2138
+ </td>
2139
+ }
2140
+ </tr>
2141
+ }
2142
+ </tbody>
2143
+ </table>
2144
+ </nv-table>
2145
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: FlexRenderDirective, selector: "[flexRender]", inputs: ["flexRender", "flexRenderProps", "flexRenderInjector"] }] }); }
2146
+ }
2147
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvDatatable, decorators: [{
2148
+ type: Component,
2149
+ args: [{
2150
+ selector: 'nv-datatable',
2151
+ standalone: true,
2152
+ imports: [CommonModule, FlexRenderDirective],
2153
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
2154
+ template: `
2155
+ <nv-table>
2156
+ <table>
2157
+ <thead>
2158
+ @for (headerGroup of table().getHeaderGroups(); track headerGroup.id)
2159
+ {
2160
+ <tr>
2161
+ @for (header of headerGroup.headers; track header.id) {
2162
+ <th
2163
+ [attr.data-testid]="'datatable-header-' + header.id"
2164
+ [style.width]="
2165
+ header.column.columnDef.size
2166
+ ? header.column.columnDef.size + 'px'
2167
+ : null
2168
+ "
2169
+ [attr.data-no-resize]="
2170
+ !header.column.columnDef.enableResizing ? 'true' : null
2171
+ "
2172
+ >
2173
+ @if (!header.isPlaceholder) {
2174
+ {{ header.column.columnDef.header }}
2175
+ }
2176
+ </th>
2177
+ }
2178
+ </tr>
2179
+ }
2180
+ </thead>
2181
+
2182
+ <tbody>
2183
+ @for (row of table().getRowModel().rows; track row.id) {
2184
+ <tr [attr.data-testid]="'datatable-row-' + row.id">
2185
+ @for (cell of row.getVisibleCells(); track cell.id) {
2186
+ <td
2187
+ [attr.data-testid]="'datatable-cell-' + cell.id"
2188
+ style="padding: 8px; border-bottom: 1px solid #eee;"
2189
+ >
2190
+ <!-- Let FlexRender handle strings vs TemplateRef -->
2191
+ <ng-container
2192
+ *flexRender="
2193
+ cell.column.columnDef.cell;
2194
+ props: cell.getContext();
2195
+ let cellContent
2196
+ "
2197
+ >
2198
+ {{ cellContent }}
2199
+ </ng-container>
2200
+ </td>
2201
+ }
2202
+ </tr>
2203
+ }
2204
+ </tbody>
2205
+ </table>
2206
+ </nv-table>
2207
+ `,
2208
+ }]
2209
+ }] });
2210
+
1333
2211
  class ValueAccessor {
1334
2212
  constructor(el) {
1335
2213
  this.el = el;
@@ -1369,6 +2247,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1369
2247
  args: ['focusout']
1370
2248
  }] } });
1371
2249
 
2250
+ class NvAccordionValueAccessor extends ValueAccessor {
2251
+ constructor(el) {
2252
+ super(el);
2253
+ }
2254
+ handleOpenIndexesChanged(event) {
2255
+ this.handleChangeEvent(event.target.openIndexes);
2256
+ }
2257
+ writeValue(value) {
2258
+ this.el.nativeElement.openIndexes = this.lastValue = value;
2259
+ }
2260
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvAccordionValueAccessor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
2261
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: NvAccordionValueAccessor, isStandalone: true, selector: "nv-accordion", host: { listeners: { "openIndexesChanged": "handleOpenIndexesChanged($event)" } }, providers: [
2262
+ {
2263
+ provide: NG_VALUE_ACCESSOR,
2264
+ useExisting: NvAccordionValueAccessor,
2265
+ multi: true,
2266
+ },
2267
+ ], usesInheritance: true, ngImport: i0 }); }
2268
+ }
2269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvAccordionValueAccessor, decorators: [{
2270
+ type: Directive,
2271
+ args: [{
2272
+ selector: 'nv-accordion',
2273
+ providers: [
2274
+ {
2275
+ provide: NG_VALUE_ACCESSOR,
2276
+ useExisting: NvAccordionValueAccessor,
2277
+ multi: true,
2278
+ },
2279
+ ],
2280
+ }]
2281
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { handleOpenIndexesChanged: [{
2282
+ type: HostListener,
2283
+ args: ['openIndexesChanged', ['$event']]
2284
+ }] } });
1372
2285
  class NvAlertValueAccessor extends ValueAccessor {
1373
2286
  constructor(el) {
1374
2287
  super(el);
@@ -1999,6 +2912,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1999
2912
  type: HostListener,
2000
2913
  args: ['openChanged', ['$event']]
2001
2914
  }] } });
2915
+ class NvSplitValueAccessor extends ValueAccessor {
2916
+ constructor(el) {
2917
+ super(el);
2918
+ }
2919
+ handleSizesChanged(event) {
2920
+ this.handleChangeEvent(event.target.sizes);
2921
+ }
2922
+ writeValue(value) {
2923
+ this.el.nativeElement.sizes = this.lastValue = value;
2924
+ }
2925
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvSplitValueAccessor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
2926
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: NvSplitValueAccessor, isStandalone: true, selector: "nv-split", host: { listeners: { "sizesChanged": "handleSizesChanged($event)" } }, providers: [
2927
+ {
2928
+ provide: NG_VALUE_ACCESSOR,
2929
+ useExisting: NvSplitValueAccessor,
2930
+ multi: true,
2931
+ },
2932
+ ], usesInheritance: true, ngImport: i0 }); }
2933
+ }
2934
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NvSplitValueAccessor, decorators: [{
2935
+ type: Directive,
2936
+ args: [{
2937
+ selector: 'nv-split',
2938
+ providers: [
2939
+ {
2940
+ provide: NG_VALUE_ACCESSOR,
2941
+ useExisting: NvSplitValueAccessor,
2942
+ multi: true,
2943
+ },
2944
+ ],
2945
+ }]
2946
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { handleSizesChanged: [{
2947
+ type: HostListener,
2948
+ args: ['sizesChanged', ['$event']]
2949
+ }] } });
2002
2950
  class NvToggleValueAccessor extends ValueAccessor {
2003
2951
  constructor(el) {
2004
2952
  super(el);
@@ -2070,6 +3018,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
2070
3018
  args: ['valueChanged', ['$event']]
2071
3019
  }] } });
2072
3020
  const VALUE_ACCESSORS = [
3021
+ NvAccordionValueAccessor,
2073
3022
  NvAlertValueAccessor,
2074
3023
  NvCalendarValueAccessor,
2075
3024
  NvDatagridValueAccessor,
@@ -2088,25 +3037,27 @@ const VALUE_ACCESSORS = [
2088
3037
  NvFieldtextareaValueAccessor,
2089
3038
  NvNotificationValueAccessor,
2090
3039
  NvPopoverValueAccessor,
3040
+ NvSplitValueAccessor,
2091
3041
  NvToggleValueAccessor,
2092
3042
  NvTogglebuttongroupValueAccessor,
2093
3043
  ];
2094
3044
 
2095
3045
  class NovaComponentsModule {
2096
3046
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2097
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsModule, declarations: [NvAccordion, NvAccordionItem, NvAlert, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCol, NvDatagrid, NvDatagridcolumn, NvDialog, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFielddate, NvFielddaterange, NvFielddropdown, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldnumber, NvFieldpassword, NvFieldradio, NvFieldselect, NvFieldslider, NvFieldtext, NvFieldtextarea, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationcontainer, NvPopover, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvTogglebutton, NvTogglebuttongroup, NvTooltip], exports: [NvAccordion, NvAccordionItem, NvAlert, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCol, NvDatagrid, NvDatagridcolumn, NvDialog, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFielddate, NvFielddaterange, NvFielddropdown, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldnumber, NvFieldpassword, NvFieldradio, NvFieldselect, NvFieldslider, NvFieldtext, NvFieldtextarea, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationcontainer, NvPopover, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvTogglebutton, NvTogglebuttongroup, NvTooltip] }); }
2098
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsModule }); }
3047
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsModule, declarations: [NvAccordion, NvAccordionItem, NvAlert, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCol, NvDatagrid, NvDatagridcolumn, NvDialog, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFielddate, NvFielddaterange, NvFielddropdown, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldnumber, NvFieldpassword, NvFieldradio, NvFieldselect, NvFieldslider, NvFieldtext, NvFieldtextarea, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationcontainer, NvPopover, NvRow, NvSplit, NvStack, NvTable, NvToggle, NvTogglebutton, NvTogglebuttongroup, NvTooltip], imports: [NvDatatable], exports: [NvAccordion, NvAccordionItem, NvAlert, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCol, NvDatagrid, NvDatagridcolumn, NvDialog, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFielddate, NvFielddaterange, NvFielddropdown, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldnumber, NvFieldpassword, NvFieldradio, NvFieldselect, NvFieldslider, NvFieldtext, NvFieldtextarea, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationcontainer, NvPopover, NvRow, NvSplit, NvStack, NvTable, NvToggle, NvTogglebutton, NvTogglebuttongroup, NvTooltip, NvDatatable] }); }
3048
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsModule, imports: [NvDatatable] }); }
2099
3049
  }
2100
3050
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsModule, decorators: [{
2101
3051
  type: NgModule,
2102
3052
  args: [{
3053
+ imports: [NvDatatable],
2103
3054
  declarations: [...DIRECTIVES],
2104
- exports: [...DIRECTIVES],
3055
+ exports: [...DIRECTIVES, NvDatatable],
2105
3056
  }]
2106
3057
  }] });
2107
3058
  class NovaComponentsValueAccessorModule {
2108
3059
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsValueAccessorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2109
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsValueAccessorModule, imports: [NvAlertValueAccessor, NvCalendarValueAccessor, NvDatagridValueAccessor, NvDialogValueAccessor, NvFieldcheckboxValueAccessor, NvFielddateValueAccessor, NvFielddaterangeValueAccessor, NvFielddropdownValueAccessor, NvFieldmultiselectValueAccessor, NvFieldnumberValueAccessor, NvFieldpasswordValueAccessor, NvFieldradioValueAccessor, NvFieldselectValueAccessor, NvFieldsliderValueAccessor, NvFieldtextValueAccessor, NvFieldtextareaValueAccessor, NvNotificationValueAccessor, NvPopoverValueAccessor, NvToggleValueAccessor, NvTogglebuttongroupValueAccessor], exports: [NvAlertValueAccessor, NvCalendarValueAccessor, NvDatagridValueAccessor, NvDialogValueAccessor, NvFieldcheckboxValueAccessor, NvFielddateValueAccessor, NvFielddaterangeValueAccessor, NvFielddropdownValueAccessor, NvFieldmultiselectValueAccessor, NvFieldnumberValueAccessor, NvFieldpasswordValueAccessor, NvFieldradioValueAccessor, NvFieldselectValueAccessor, NvFieldsliderValueAccessor, NvFieldtextValueAccessor, NvFieldtextareaValueAccessor, NvNotificationValueAccessor, NvPopoverValueAccessor, NvToggleValueAccessor, NvTogglebuttongroupValueAccessor] }); }
3060
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsValueAccessorModule, imports: [NvAccordionValueAccessor, NvAlertValueAccessor, NvCalendarValueAccessor, NvDatagridValueAccessor, NvDialogValueAccessor, NvFieldcheckboxValueAccessor, NvFielddateValueAccessor, NvFielddaterangeValueAccessor, NvFielddropdownValueAccessor, NvFieldmultiselectValueAccessor, NvFieldnumberValueAccessor, NvFieldpasswordValueAccessor, NvFieldradioValueAccessor, NvFieldselectValueAccessor, NvFieldsliderValueAccessor, NvFieldtextValueAccessor, NvFieldtextareaValueAccessor, NvNotificationValueAccessor, NvPopoverValueAccessor, NvSplitValueAccessor, NvToggleValueAccessor, NvTogglebuttongroupValueAccessor], exports: [NvAccordionValueAccessor, NvAlertValueAccessor, NvCalendarValueAccessor, NvDatagridValueAccessor, NvDialogValueAccessor, NvFieldcheckboxValueAccessor, NvFielddateValueAccessor, NvFielddaterangeValueAccessor, NvFielddropdownValueAccessor, NvFieldmultiselectValueAccessor, NvFieldnumberValueAccessor, NvFieldpasswordValueAccessor, NvFieldradioValueAccessor, NvFieldselectValueAccessor, NvFieldsliderValueAccessor, NvFieldtextValueAccessor, NvFieldtextareaValueAccessor, NvNotificationValueAccessor, NvPopoverValueAccessor, NvSplitValueAccessor, NvToggleValueAccessor, NvTogglebuttongroupValueAccessor] }); }
2110
3061
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsValueAccessorModule }); }
2111
3062
  }
2112
3063
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NovaComponentsValueAccessorModule, decorators: [{
@@ -2434,5 +3385,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
2434
3385
  * Generated bundle index. Do not edit.
2435
3386
  */
2436
3387
 
2437
- export { NotificationService, NotificationServiceComponent, NovaComponentsModule, NovaComponentsValueAccessorModule, NvAccordion, NvAccordionItem, NvAlert, NvAlertValueAccessor, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCalendarValueAccessor, NvCol, NvDatagrid, NvDatagridValueAccessor, NvDatagridcolumn, 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, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationValueAccessor, NvNotificationcontainer, NvPopover, NvPopoverValueAccessor, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvToggleValueAccessor, NvTogglebutton, NvTogglebuttongroup, NvTogglebuttongroupValueAccessor, NvTooltip, VALUE_ACCESSORS };
3388
+ export { NotificationService, NotificationServiceComponent, NovaComponentsModule, NovaComponentsValueAccessorModule, NvAccordion, NvAccordionItem, NvAccordionValueAccessor, NvAlert, NvAlertValueAccessor, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCalendarValueAccessor, NvCol, NvDatagrid, NvDatagridValueAccessor, NvDatagridcolumn, NvDatatable, 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, 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 };
2438
3389
  //# sourceMappingURL=nova-components.mjs.map