Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions api-goldens/element-ng/file-uploader/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import { HttpHeaders } from '@angular/common/http';
import { HttpRequest } from '@angular/common/http';
import { HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { OnChanges } from '@angular/core';
import * as _siemens_element_translate_ng_translate from '@siemens/element-translate-ng/translate';
import { SimpleChanges } from '@angular/core';
import { Subscription } from 'rxjs';
import { TranslatableString } from '@siemens/element-translate-ng/translate';

Expand Down Expand Up @@ -88,7 +86,8 @@ export class SiFileUploadDirective {
}

// @public (undocumented)
export class SiFileUploaderComponent implements OnChanges {
export class SiFileUploaderComponent {
constructor();
readonly accept: _angular_core.InputSignal<string | undefined>;
readonly acceptText: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>;
readonly autoUpload: _angular_core.InputSignalWithTransform<boolean, unknown>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NgxDatatableModule } from '@siemens/ngx-datatable';

Expand All @@ -17,29 +17,30 @@ import { SI_DATATABLE_CONFIG, SiDatatableModule } from '.';
columnMode="force"
siDatatableInteraction
[cssClasses]="tableConfig.cssClasses"
[rows]="rows"
[rows]="rows()"
[columns]="columns"
[headerHeight]="tableConfig.headerHeight"
[footerHeight]="0"
[rowHeight]="tableConfig.rowHeightSmall"
[externalPaging]="false"
[selectionType]="selectionType"
[count]="rows.length"
[virtualization]="virtualization"
[selectionType]="selectionType()"
[count]="rows().length"
[virtualization]="virtualization()"
[scrollbarV]="true"
[datatableInteractionAutoSelect]="datatableInteractionAutoSelect"
[datatableInteractionAutoSelect]="datatableInteractionAutoSelect()"
[(selected)]="selected"
/>
`
`,
changeDetection: ChangeDetectionStrategy.Default
})
class WrapperComponent {
selectionType: 'multi' | 'single' | 'cell' = 'multi';
virtualization = false;
datatableInteractionAutoSelect = false;
selected: any[] = [];
readonly selectionType = signal<'multi' | 'single' | 'cell'>('multi');
readonly virtualization = signal(false);
readonly datatableInteractionAutoSelect = signal(false);
readonly selected = signal<any[]>([]);

tableConfig = SI_DATATABLE_CONFIG;
rows: any[] = [];
readonly rows = signal<any[]>([]);
columns = [
{
prop: 'id',
Expand Down Expand Up @@ -72,14 +73,16 @@ class WrapperComponent {
];

constructor() {
const rows = [];
for (let i = 1; i <= 250; i++) {
this.rows.push({
rows.push({
id: i,
firstname: 'First ' + i,
lastname: 'Last ' + i,
age: 50
});
}
this.rows.set(rows);
}
}

Expand Down Expand Up @@ -158,7 +161,7 @@ describe('SiDatatableInteractionDirective', () => {
it.skipIf(!document.hasFocus())(
'should navigate into and inside arrow keys when using virtualization',
async () => {
wrapperComponent.virtualization = true;
wrapperComponent.virtualization.set(true);
await refresh();
getTableElement().focus();

Expand Down Expand Up @@ -205,8 +208,8 @@ describe('SiDatatableInteractionDirective', () => {
it.skipIf(!document.hasFocus())(
'should navigate into and inside table using arrow keys when using virtualization and cell selection',
async () => {
wrapperComponent.selectionType = 'cell';
wrapperComponent.virtualization = true;
wrapperComponent.selectionType.set('cell');
wrapperComponent.virtualization.set(true);
await refresh();
getTableElement().focus();

Expand Down Expand Up @@ -255,10 +258,10 @@ describe('SiDatatableInteractionDirective', () => {
);

it.skipIf(!document.hasFocus())('should auto select on focus when enabled', async () => {
wrapperComponent.selectionType = 'single';
wrapperComponent.datatableInteractionAutoSelect = true;
wrapperComponent.selectionType.set('single');
wrapperComponent.datatableInteractionAutoSelect.set(true);
await refresh();
expect(wrapperComponent.selected).toHaveLength(0);
expect(wrapperComponent.selected()).toHaveLength(0);

const row = getTableElement().querySelector(
'.datatable-row-wrapper > .datatable-body-row'
Expand All @@ -267,7 +270,7 @@ describe('SiDatatableInteractionDirective', () => {

await refresh();

expect(wrapperComponent.selected).toContain({
expect(wrapperComponent.selected()).toContain({
id: 1,
firstname: 'First 1',
lastname: 'Last 1',
Expand All @@ -278,10 +281,10 @@ describe('SiDatatableInteractionDirective', () => {
it.skipIf(!document.hasFocus())(
'should not auto select on mouse click when enabled',
async () => {
wrapperComponent.selectionType = 'single';
wrapperComponent.datatableInteractionAutoSelect = true;
wrapperComponent.selectionType.set('single');
wrapperComponent.datatableInteractionAutoSelect.set(true);
await refresh();
expect(wrapperComponent.selected).toHaveLength(0);
expect(wrapperComponent.selected()).toHaveLength(0);

const table = getTableElement();

Expand All @@ -296,7 +299,7 @@ describe('SiDatatableInteractionDirective', () => {

await refresh();

expect(wrapperComponent.selected).toHaveLength(0);
expect(wrapperComponent.selected()).toHaveLength(0);

table.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));

Expand All @@ -306,7 +309,7 @@ describe('SiDatatableInteractionDirective', () => {

await refresh();

expect(wrapperComponent.selected).toContain({
expect(wrapperComponent.selected()).toContain({
id: 1,
firstname: 'First 1',
lastname: 'Last 1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: MIT
*/
import { CdkMenuTrigger } from '@angular/cdk/menu';
import { booleanAttribute, Component, input, output } from '@angular/core';
import { booleanAttribute, ChangeDetectionStrategy, Component, input, output } from '@angular/core';
import { elementLeft4, elementOptionsVertical, elementRight4 } from '@siemens/element-icons';
import { MenuItem as MenuItemLegacy } from '@siemens/element-ng/common';
import { addIcons, SiIconComponent } from '@siemens/element-ng/icon';
Expand All @@ -14,7 +14,8 @@ import { SiTranslatePipe, t } from '@siemens/element-translate-ng/translate';
selector: 'si-electron-titlebar',
imports: [CdkMenuTrigger, SiMenuFactoryComponent, SiIconComponent, SiTranslatePipe],
templateUrl: './si-electron-titlebar.component.html',
styleUrl: './si-electron-titlebar.component.scss'
styleUrl: './si-electron-titlebar.component.scss',
changeDetection: ChangeDetectionStrategy.Default
})
export class SiElectrontitlebarComponent {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(filesAdded)="handleFiles($event)"
/>

@if (maxFilesReached) {
@if (maxFilesReached()) {
<si-inline-notification
class="mb-4"
severity="info"
Expand All @@ -24,7 +24,7 @@
}

<div class="file-list">
@for (file of files; track file) {
@for (file of files(); track file) {
<div class="file" [class.fade-out]="file.fadeOut">
<si-icon class="icon align-self-center ms-6 me-4" icon="element-document" />
<div class="flex-fill overflow-hidden mt-6">
Expand Down Expand Up @@ -63,7 +63,7 @@
<button
type="button"
class="btn btn-circle btn-tertiary me-4"
[disabled]="!uploadEnabled"
[disabled]="!uploadEnabled()"
[title]="uploadButtonText() | translate"
[attr.aria-label]="uploadButtonText() | translate"
(click)="retryUpload(file)"
Expand Down Expand Up @@ -106,14 +106,14 @@
<button
type="button"
class="btn btn-secondary me-4"
[disabled]="pending || !files.length"
[disabled]="pending || !files().length"
(click)="reset()"
>{{ clearButtonText() | translate }}</button
>
<button
type="button"
class="btn btn-primary"
[disabled]="!uploadEnabled"
[disabled]="!uploadEnabled()"
(click)="fileUpload()"
>{{ uploadButtonText() | translate }}</button
>
Expand Down
Loading
Loading