feat(project): delete dependancy to primeng

This commit is contained in:
thomas
2023-11-10 15:27:04 +01:00
parent e57a2aaecb
commit 986b3e1bb6
20 changed files with 266 additions and 61 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 }>;
}

View File

@@ -0,0 +1,8 @@
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';