-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtable-editor.html
More file actions
50 lines (48 loc) · 1.57 KB
/
table-editor.html
File metadata and controls
50 lines (48 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<div class="table-editor">
<div class="table-scroll">
<table>
<thead>
<tr>
@for (header of table().headers; track $index) {
<th>{{ header }}</th>
}
<th class="actions-col"></th>
</tr>
</thead>
<tbody>
@for (row of table().rows; track $index; let rowIdx = $index) {
<tr>
@for (cell of row; track $index; let colIdx = $index) {
<td>
<input
type="text"
class="cell-input"
[ngModel]="cell"
(ngModelChange)="onCellChange(rowIdx, colIdx, $event)"
[placeholder]="table().headers[colIdx]"
/>
</td>
}
<td class="actions-cell">
<div class="row-actions">
@if (rowIdx > 0) {
<button class="btn-icon" (click)="moveRowUp(rowIdx)" title="Move up">↑</button>
}
@if (rowIdx < table().rows.length - 1) {
<button class="btn-icon" (click)="moveRowDown(rowIdx)" title="Move down">↓</button>
}
<button class="btn-icon btn-danger" (click)="removeRow(rowIdx)" title="Remove row">×</button>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
@if (isEmpty()) {
<div class="empty-state">No rows yet. Add one below.</div>
}
<div class="table-footer">
<button class="btn btn-sm" (click)="addRow()">+ Add Row</button>
</div>
</div>