mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-02 17:53:30 +00:00
[ACS-10246] Add logic to make dates semantically conveyed
This commit is contained in:
@@ -26,7 +26,9 @@ import { toSignal } from '@angular/core/rxjs-interop';
|
|||||||
selector: 'adf-date-cell',
|
selector: 'adf-date-cell',
|
||||||
template: `
|
template: `
|
||||||
@if (formattedDate()) {
|
@if (formattedDate()) {
|
||||||
<span [title]="title()" class="adf-datatable-cell-value">{{ formattedDate() }}</span>
|
<time tabindex="0" [attr.datetime]="isoDate()" [attr.aria-label]="title()" [title]="title()" class="adf-datatable-cell-value"
|
||||||
|
>{{ formattedDate() }}
|
||||||
|
</time>
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
@@ -55,6 +57,12 @@ export class DateCellComponent extends DataTableCellComponent implements OnInit
|
|||||||
// Convert value$ observable to signal for reactive computation
|
// Convert value$ observable to signal for reactive computation
|
||||||
private readonly dateValue = toSignal(this.value$);
|
private readonly dateValue = toSignal(this.value$);
|
||||||
|
|
||||||
|
// Computed signal that automatically formats the date to ISO string for datetime attribute
|
||||||
|
protected readonly isoDate = computed(() => {
|
||||||
|
const date = this.dateValue();
|
||||||
|
return date ? new Date(date).toISOString() : '';
|
||||||
|
});
|
||||||
|
|
||||||
// Computed signal that automatically formats the date based on value and config
|
// Computed signal that automatically formats the date based on value and config
|
||||||
protected readonly formattedDate = computed(() => {
|
protected readonly formattedDate = computed(() => {
|
||||||
const date = this.dateValue();
|
const date = this.dateValue();
|
||||||
|
|||||||
Reference in New Issue
Block a user