refactor: move libs

This commit is contained in:
thomas
2024-05-11 21:27:33 +02:00
parent 4a3c7f23e0
commit 001d35731a
659 changed files with 775 additions and 1573 deletions

View File

@@ -0,0 +1 @@
export { TableComponent } from './lib/table.component';

View File

@@ -0,0 +1,29 @@
import { NgFor, NgTemplateOutlet } from '@angular/common';
import { Component, ContentChild, Input, TemplateRef } from '@angular/core';
@Component({
selector: 'table',
standalone: true,
imports: [NgTemplateOutlet, NgFor],
template: `
<thead>
<ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
</thead>
<tbody *ngFor="let item of items">
<ng-container
*ngTemplateOutlet="
bodyTemplate;
context: { $implicit: item }
"></ng-container>
</tbody>
`,
})
export class TableComponent<T> {
@Input() items!: T[];
@ContentChild('header', { read: TemplateRef })
headerTemplate!: TemplateRef<void>;
@ContentChild('body', { read: TemplateRef })
bodyTemplate!: TemplateRef<{ $implicit: T }>;
}