@molecule/app-data-table-ui-angular 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +982 -2
- package/dist/data-table-card.component.d.ts +214 -0
- package/dist/data-table-card.component.d.ts.map +1 -0
- package/dist/data-table-card.component.js +568 -0
- package/dist/data-table-card.component.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/row-with-actions.component.d.ts +76 -0
- package/dist/row-with-actions.component.d.ts.map +1 -0
- package/dist/row-with-actions.component.js +167 -0
- package/dist/row-with-actions.component.js.map +1 -0
- package/dist/slot-dom.d.ts +67 -0
- package/dist/slot-dom.d.ts.map +1 -0
- package/dist/slot-dom.js +94 -0
- package/dist/slot-dom.js.map +1 -0
- package/dist/table-empty.component.d.ts +44 -0
- package/dist/table-empty.component.d.ts.map +1 -0
- package/dist/table-empty.component.js +99 -0
- package/dist/table-empty.component.js.map +1 -0
- package/dist/table-footer.component.d.ts +55 -0
- package/dist/table-footer.component.d.ts.map +1 -0
- package/dist/table-footer.component.js +138 -0
- package/dist/table-footer.component.js.map +1 -0
- package/dist/table-toolbar.component.d.ts +77 -0
- package/dist/table-toolbar.component.d.ts.map +1 -0
- package/dist/table-toolbar.component.js +195 -0
- package/dist/table-toolbar.component.js.map +1 -0
- package/dist/types.d.ts +100 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -4
package/README.md
CHANGED
|
@@ -1,3 +1,983 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-18T23:41:41.365Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-data-table-ui-angular
|
|
10
|
+
|
|
11
|
+
Angular data-table UI primitives (standalone — they render plain table
|
|
12
|
+
elements and do not require a table component from a UI package).
|
|
13
|
+
|
|
14
|
+
Exports:
|
|
15
|
+
|
|
16
|
+
- `<DataTableCard>` — full polished-pattern data table (card wrapper +
|
|
17
|
+
title + uppercase headers + divided rows + loading skeleton + empty
|
|
18
|
+
state). Drop-in for the most common dashboard CRUD use case.
|
|
19
|
+
- `<TableToolbar>` — top chrome with left/right slots + optional filter row.
|
|
20
|
+
- `<TableEmpty>` — single full-width "no rows" cell for hand-rolled tables.
|
|
21
|
+
- `<TableFooter>` — bottom bar (left summary + right pagination).
|
|
22
|
+
- `<RowWithActions>` — `<tr>` wrapper with trailing actions cell and click handler.
|
|
23
|
+
|
|
24
|
+
Use `DataTableCard` for new screens; use the row-level primitives to compose
|
|
25
|
+
richer custom tables (group-by, expandable rows, etc.).
|
|
26
|
+
|
|
27
|
+
This package is the Angular counterpart of `@molecule/app-data-table-ui-react`:
|
|
28
|
+
the same export names, the same props (React's prop names), and the same DOM
|
|
29
|
+
for the same input, so an app swaps framework by changing only the package
|
|
30
|
+
name in its imports. Each component's host element IS React's root element
|
|
31
|
+
(`section[mol-data-table-card]`, `tr[mol-row-with-actions]`, …). Node props
|
|
32
|
+
are projected content (`[slot=<name>]`), a `TemplateRef`, or text.
|
|
33
|
+
|
|
34
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
35
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
36
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { Component } from '@angular/core'
|
|
42
|
+
import { DataTableCard } from '@molecule/app-data-table-ui-angular'
|
|
43
|
+
|
|
44
|
+
interface Row {
|
|
45
|
+
id: string
|
|
46
|
+
name: string
|
|
47
|
+
email: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Component({
|
|
51
|
+
selector: 'app-members-table',
|
|
52
|
+
standalone: true,
|
|
53
|
+
imports: [DataTableCard],
|
|
54
|
+
template: `
|
|
55
|
+
<ng-template #nameCell let-row>
|
|
56
|
+
<span>{{ row.name }}</span>
|
|
57
|
+
</ng-template>
|
|
58
|
+
<ng-template #emailCell let-row>
|
|
59
|
+
<span>{{ row.email }}</span>
|
|
60
|
+
</ng-template>
|
|
61
|
+
|
|
62
|
+
<section
|
|
63
|
+
mol-data-table-card
|
|
64
|
+
[title]="'Team members'"
|
|
65
|
+
[columns]="columns"
|
|
66
|
+
[rows]="members"
|
|
67
|
+
[rowKey]="rowKey"
|
|
68
|
+
[onRowClick]="open"
|
|
69
|
+
[emptyMessage]="'No members yet.'"
|
|
70
|
+
></section>
|
|
71
|
+
`,
|
|
72
|
+
})
|
|
73
|
+
export class MembersTable {
|
|
74
|
+
members: Row[] = []
|
|
75
|
+
rowKey = (row: Row): string => row.id
|
|
76
|
+
open = (row: Row): void => {
|
|
77
|
+
// navigate to the member…
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Type
|
|
83
|
+
|
|
84
|
+
`feature`
|
|
85
|
+
|
|
86
|
+
## Installation
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install @molecule/app-data-table-ui-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## API
|
|
93
|
+
|
|
94
|
+
### Interfaces
|
|
95
|
+
|
|
96
|
+
#### `DataTableColumn`
|
|
97
|
+
|
|
98
|
+
Column definition for a {@link DataTableCard} — specifies key, header, and
|
|
99
|
+
cell renderer.
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
interface DataTableColumn<Row> {
|
|
103
|
+
/** Stable key for the column. */
|
|
104
|
+
key: string
|
|
105
|
+
/** Header label: text, or a `TemplateRef` (React's node header). */
|
|
106
|
+
header: unknown
|
|
107
|
+
/**
|
|
108
|
+
* Render the cell for this column from a row — a template whose context
|
|
109
|
+
* carries the row as `$implicit` and `a0`.
|
|
110
|
+
*/
|
|
111
|
+
cell: TemplateRef<{ $implicit: Row; a0: Row }>
|
|
112
|
+
/** Optional extra `<th>` / `<td>` classes (e.g. `cm.textCenter`). */
|
|
113
|
+
cellClassName?: string
|
|
114
|
+
/** Optional extra classes on this column's `<th>`. */
|
|
115
|
+
headerClassName?: string
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### `DataTableCardProps`
|
|
120
|
+
|
|
121
|
+
Props for {@link DataTableCard} — the same props the React package accepts.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
interface DataTableCardProps<Row> {
|
|
125
|
+
/** Optional title above the table chrome (text, a `TemplateRef`, or `[slot=title]` content). */
|
|
126
|
+
title?: unknown
|
|
127
|
+
/** Right-aligned action in the title row (a `TemplateRef` or `[slot=titleAction]` content). */
|
|
128
|
+
titleAction?: unknown
|
|
129
|
+
/** Column definitions. */
|
|
130
|
+
columns: ReadonlyArray<DataTableColumn<Row>>
|
|
131
|
+
/** Rows to render. Falls back to `emptyMessage` if empty and not loading. */
|
|
132
|
+
rows: ReadonlyArray<Row>
|
|
133
|
+
/** Pull a stable key from a row. */
|
|
134
|
+
rowKey: (row: Row) => string
|
|
135
|
+
/** When true, renders 5 skeleton rows instead of `rows`. */
|
|
136
|
+
loading?: boolean
|
|
137
|
+
/** Optional click handler per row. */
|
|
138
|
+
onRowClick?: (row: Row) => void
|
|
139
|
+
/** Empty-state content (text, a `TemplateRef`, or `[slot=emptyMessage]` content). */
|
|
140
|
+
emptyMessage?: unknown
|
|
141
|
+
/** Extra classes on the outer card. */
|
|
142
|
+
className?: string
|
|
143
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
144
|
+
dataMolId?: string
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### `RowWithActionsProps`
|
|
149
|
+
|
|
150
|
+
Props for {@link RowWithActions} — the same props the React package accepts.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
interface RowWithActionsProps {
|
|
154
|
+
/** Row cells, projected as the element's default content. */
|
|
155
|
+
children?: unknown
|
|
156
|
+
/** Action buttons/menu for the trailing cell (a `TemplateRef` or `[slot=actions]` content). */
|
|
157
|
+
actions?: unknown
|
|
158
|
+
/** Called when the row body is clicked (not the actions cell), with the click event. */
|
|
159
|
+
onClick?: (event: MouseEvent) => void
|
|
160
|
+
/** Whether the row should render in a "selected" visual state. */
|
|
161
|
+
selected?: boolean
|
|
162
|
+
/** Extra classes on the `<tr>`. */
|
|
163
|
+
className?: string
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### `TableEmptyProps`
|
|
168
|
+
|
|
169
|
+
Props for {@link TableEmpty} — the same props the React package accepts.
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
interface TableEmptyProps {
|
|
173
|
+
/** Number of columns to span (for colspan on the td). */
|
|
174
|
+
colSpan: number
|
|
175
|
+
/** Empty-state content, projected as the element's default content. */
|
|
176
|
+
children?: unknown
|
|
177
|
+
/** Extra classes on the cell. */
|
|
178
|
+
className?: string
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
#### `TableFooterProps`
|
|
183
|
+
|
|
184
|
+
Props for {@link TableFooter} — the same props the React package accepts.
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
interface TableFooterProps {
|
|
188
|
+
/** Left slot — typically a summary line (a `TemplateRef` or `[slot=left]` content). */
|
|
189
|
+
left?: unknown
|
|
190
|
+
/** Right slot — typically a pagination bar (a `TemplateRef` or `[slot=right]` content). */
|
|
191
|
+
right?: unknown
|
|
192
|
+
/** Extra classes. */
|
|
193
|
+
className?: string
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### `TableToolbarProps`
|
|
198
|
+
|
|
199
|
+
Props for {@link TableToolbar} — the same props the React package accepts.
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
interface TableToolbarProps {
|
|
203
|
+
/** Left-aligned content (a `TemplateRef` or `[slot=left]` content). */
|
|
204
|
+
left?: unknown
|
|
205
|
+
/** Right-aligned actions (a `TemplateRef` or `[slot=right]` content). */
|
|
206
|
+
right?: unknown
|
|
207
|
+
/** Optional filter sub-row (a `TemplateRef` or `[slot=below]` content). */
|
|
208
|
+
below?: unknown
|
|
209
|
+
/** Extra classes. */
|
|
210
|
+
className?: string
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Classes
|
|
215
|
+
|
|
216
|
+
#### `DataTableCard`
|
|
217
|
+
|
|
218
|
+
DataTableCard component.
|
|
219
|
+
|
|
220
|
+
Drop-in card-shaped data table matching the polished flagship pattern — the
|
|
221
|
+
Angular counterpart of `@molecule/app-data-table-ui-react`'s
|
|
222
|
+
`DataTableCard`: the same props (React names), the same ClassMap tokens, and
|
|
223
|
+
the same DOM for the same input. The host IS the outer `<section>`
|
|
224
|
+
(`section[mol-data-table-card]`), matching React's root exactly.
|
|
225
|
+
|
|
226
|
+
Renders an optional title row (title + action), then a card-wrapped table
|
|
227
|
+
with uppercase headers, divided rows, a 5-row loading skeleton and a single
|
|
228
|
+
spanning empty cell. Rows are keyed by `rowKey(row)` (React's
|
|
229
|
+
`key={rowKey(row)}`), so a row keeps its DOM node while its key is unchanged.
|
|
230
|
+
|
|
231
|
+
Column `cell` templates receive the row as `$implicit` and `a0`; a column
|
|
232
|
+
`header` may be text or a `TemplateRef`. Node props (`title`, `titleAction`,
|
|
233
|
+
`emptyMessage`) may be `[slot=…]` content, a `TemplateRef`, or text.
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
@Component({
|
|
237
|
+
selector: 'section[mol-data-table-card]',
|
|
238
|
+
standalone: true,
|
|
239
|
+
imports: [NgTemplateOutlet],
|
|
240
|
+
inputs: [
|
|
241
|
+
'title',
|
|
242
|
+
'titleAction',
|
|
243
|
+
'columns',
|
|
244
|
+
'rows',
|
|
245
|
+
'rowKey',
|
|
246
|
+
'loading',
|
|
247
|
+
'onRowClick',
|
|
248
|
+
'emptyMessage',
|
|
249
|
+
'className',
|
|
250
|
+
'dataMolId',
|
|
251
|
+
],
|
|
252
|
+
host: {
|
|
253
|
+
'[class]': 'classes()',
|
|
254
|
+
'[attr.data-mol-id]': 'dataMolId ?? null',
|
|
255
|
+
},
|
|
256
|
+
template: `<div #headerRow [class]="headerRowClasses()">
|
|
257
|
+
<h3 #titleHeading [class]="titleClasses()">
|
|
258
|
+
{{ titleText() }}<ng-content select="[slot=title]"></ng-content>
|
|
259
|
+
@if (titleTemplate(); as tpl) {
|
|
260
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
261
|
+
}
|
|
262
|
+
</h3>
|
|
263
|
+
<ng-content select="[slot=titleAction]"></ng-content>
|
|
264
|
+
@if (titleActionTemplate(); as tpl) {
|
|
265
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
266
|
+
}
|
|
267
|
+
{{ titleActionText() }}
|
|
268
|
+
</div>
|
|
269
|
+
<div [class]="scrollerClasses()">
|
|
270
|
+
<table [class]="tableClasses()">
|
|
271
|
+
<thead>
|
|
272
|
+
<tr [class]="headClasses()">
|
|
273
|
+
@for (column of columns; track column.key; let index = $index) {
|
|
274
|
+
<th [class]="headerCellClasses(column, index)">
|
|
275
|
+
@if (headerTemplate(column); as tpl) {
|
|
276
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
277
|
+
} @else {
|
|
278
|
+
{{ headerText(column) }}
|
|
279
|
+
}
|
|
280
|
+
</th>
|
|
281
|
+
}
|
|
282
|
+
</tr>
|
|
283
|
+
</thead>
|
|
284
|
+
<tbody [class]="bodyClasses()">
|
|
285
|
+
@if (loading) {
|
|
286
|
+
@for (index of skeletonIndexes; track index) {
|
|
287
|
+
<tr aria-hidden="true">
|
|
288
|
+
<td [attr.colspan]="columns.length" [class]="skeletonCellClasses()">
|
|
289
|
+
<div [class]="skeletonBarClasses()"></div>
|
|
290
|
+
</td>
|
|
291
|
+
</tr>
|
|
292
|
+
}
|
|
293
|
+
} @else if (rows.length === 0) {
|
|
294
|
+
<tr>
|
|
295
|
+
<td [attr.colspan]="columns.length" [class]="emptyCellClasses()">
|
|
296
|
+
<ng-content select="[slot=emptyMessage]"></ng-content>
|
|
297
|
+
@if (emptyTemplate(); as tpl) {
|
|
298
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
299
|
+
}
|
|
300
|
+
{{ emptyText() }}
|
|
301
|
+
</td>
|
|
302
|
+
</tr>
|
|
303
|
+
} @else {
|
|
304
|
+
@for (row of rows; track trackKey(row)) {
|
|
305
|
+
<tr (click)="clickRow(row)" [class]="rowClasses()">
|
|
306
|
+
@for (column of columns; track column.key; let index = $index) {
|
|
307
|
+
<td [class]="cellClasses(column, index)">
|
|
308
|
+
@if (cellTemplate(column); as tpl) {
|
|
309
|
+
<ng-container
|
|
310
|
+
[ngTemplateOutlet]="tpl"
|
|
311
|
+
[ngTemplateOutletContext]="rowContext(row)"
|
|
312
|
+
/>
|
|
313
|
+
}
|
|
314
|
+
</td>
|
|
315
|
+
}
|
|
316
|
+
</tr>
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
</tbody>
|
|
320
|
+
</table>
|
|
321
|
+
</div>`,
|
|
322
|
+
})
|
|
323
|
+
export class DataTableCard<T = unknown> implements AfterViewInit, DoCheck {
|
|
324
|
+
title?: unknown
|
|
325
|
+
titleAction?: unknown
|
|
326
|
+
/** Column definitions. */
|
|
327
|
+
columns: ReadonlyArray<DataTableColumn<T>> = []
|
|
328
|
+
/** Rows to render. */
|
|
329
|
+
rows: ReadonlyArray<T> = []
|
|
330
|
+
rowKey?: (row: T) => string
|
|
331
|
+
loading?: boolean
|
|
332
|
+
/** Optional click handler per row. */
|
|
333
|
+
onRowClick?: (row: T) => void
|
|
334
|
+
emptyMessage?: unknown
|
|
335
|
+
/** Extra classes on the outer card. */
|
|
336
|
+
className?: string
|
|
337
|
+
dataMolId?: string
|
|
338
|
+
|
|
339
|
+
readonly skeletonIndexes = [0, 1, 2, 3, 4]
|
|
340
|
+
|
|
341
|
+
@ViewChild('headerRow') private headerRow?: ElementRef<HTMLElement>
|
|
342
|
+
@ViewChild('titleHeading') private titleHeading?: ElementRef<HTMLElement>
|
|
343
|
+
|
|
344
|
+
private readonly renderer = inject(Renderer2)
|
|
345
|
+
private readonly conditional = new ConditionalElement(this.renderer)
|
|
346
|
+
|
|
347
|
+
/** The current class map. */
|
|
348
|
+
cm(): UIClassMap {
|
|
349
|
+
return getClassMap()
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
classes(): string {
|
|
353
|
+
return this.cm().cn(this.cm().stack(4), this.cm().dataTableCardShell, this.className)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
headerRowClasses(): string {
|
|
357
|
+
return this.cm().cn(
|
|
358
|
+
this.cm().flex({ justify: 'between', align: 'center' }),
|
|
359
|
+
this.cm().sp('px', 8),
|
|
360
|
+
this.cm().sp('pt', 8),
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
titleClasses(): string {
|
|
365
|
+
return this.cm().cn(
|
|
366
|
+
this.cm().textSize('xl'),
|
|
367
|
+
this.cm().fontWeight('bold'),
|
|
368
|
+
this.cm().dataTableCardTitle,
|
|
369
|
+
)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
scrollerClasses(): string {
|
|
373
|
+
return this.cm().cn(this.cm().dataTableCardScroller)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
tableClasses(): string {
|
|
377
|
+
return this.cm().cn(this.cm().w('full'), this.cm().dataTableCardTable)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
headClasses(): string {
|
|
381
|
+
return this.cm().cn(this.cm().dataTableCardHead)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
headerCellClasses(column: DataTableColumn<T>, index: number): string {
|
|
385
|
+
return this.cm().cn(
|
|
386
|
+
index === 0 ? this.cm().sp('px', 8) : this.cm().sp('px', 4),
|
|
387
|
+
this.cm().sp('py', 4),
|
|
388
|
+
this.cm().dataTableCardHeaderCell,
|
|
389
|
+
column.headerClassName,
|
|
390
|
+
)
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
bodyClasses(): string {
|
|
394
|
+
return this.cm().cn(this.cm().dataTableCardBody)
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
skeletonCellClasses(): string {
|
|
398
|
+
return this.cm().cn(this.cm().sp('px', 8), this.cm().sp('py', 5))
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
skeletonBarClasses(): string {
|
|
402
|
+
return this.cm().cn(this.cm().h(4), this.cm().dataTableCardSkeletonBar)
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
emptyCellClasses(): string {
|
|
406
|
+
return this.cm().cn(
|
|
407
|
+
this.cm().sp('px', 8),
|
|
408
|
+
this.cm().sp('py', 12),
|
|
409
|
+
this.cm().textCenter,
|
|
410
|
+
this.cm().dataTableCardEmptyCell,
|
|
411
|
+
)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
rowClasses(): string {
|
|
415
|
+
return this.cm().cn(
|
|
416
|
+
this.onRowClick ? this.cm().cursorPointer : '',
|
|
417
|
+
this.cm().dataTableCardRowHover,
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
cellClasses(column: DataTableColumn<T>, index: number): string {
|
|
422
|
+
return this.cm().cn(
|
|
423
|
+
index === 0 ? this.cm().sp('px', 8) : this.cm().sp('px', 4),
|
|
424
|
+
this.cm().sp('py', 5),
|
|
425
|
+
column.cellClassName,
|
|
426
|
+
)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
titleText(): string {
|
|
430
|
+
return typeof this.title === 'string' || typeof this.title === 'number'
|
|
431
|
+
? textOf(this.title)
|
|
432
|
+
: ''
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
titleTemplate(): TemplateRef<unknown> | null {
|
|
436
|
+
return templateOf(this.title)
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
titleActionText(): string {
|
|
440
|
+
return typeof this.titleAction === 'string' || typeof this.titleAction === 'number'
|
|
441
|
+
? textOf(this.titleAction)
|
|
442
|
+
: ''
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
titleActionTemplate(): TemplateRef<unknown> | null {
|
|
446
|
+
return templateOf(this.titleAction)
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
emptyText(): string {
|
|
450
|
+
return typeof this.emptyMessage === 'string' || typeof this.emptyMessage === 'number'
|
|
451
|
+
? textOf(this.emptyMessage)
|
|
452
|
+
: ''
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
emptyTemplate(): TemplateRef<unknown> | null {
|
|
456
|
+
return templateOf(this.emptyMessage)
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
headerTemplate(column: DataTableColumn<T>): TemplateRef<unknown> | null {
|
|
460
|
+
return templateOf(column.header)
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
headerText(column: DataTableColumn<T>): string {
|
|
464
|
+
return typeof column.header === 'string' || typeof column.header === 'number'
|
|
465
|
+
? textOf(column.header)
|
|
466
|
+
: ''
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/** One column's cell template. */
|
|
470
|
+
cellTemplate(column: DataTableColumn<T>): TemplateRef<unknown> | null {
|
|
471
|
+
return templateOf(column.cell)
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
rowContext(row: T): Record<string, unknown> {
|
|
475
|
+
return { $implicit: row, a0: row, a1: undefined }
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
trackKey(row: T): string {
|
|
479
|
+
return this.rowKey ? this.rowKey(row) : ''
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
clickRow(row: T): void {
|
|
483
|
+
this.onRowClick?.(row)
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
ngAfterViewInit(): void {
|
|
487
|
+
this.syncVisibility()
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
ngDoCheck(): void {
|
|
491
|
+
this.syncVisibility()
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
private syncVisibility(): void {
|
|
495
|
+
const heading = this.titleHeading?.nativeElement
|
|
496
|
+
const titleShown = this.title !== undefined || hasContent(heading)
|
|
497
|
+
this.conditional.sync(this.headerRow?.nativeElement, titleShown || this.hasTitleAction())
|
|
498
|
+
this.conditional.sync(heading, titleShown)
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
private hasTitleAction(): boolean {
|
|
502
|
+
if (this.titleAction !== undefined) return true
|
|
503
|
+
const row = this.headerRow?.nativeElement
|
|
504
|
+
if (!row) return false
|
|
505
|
+
const heading = this.titleHeading?.nativeElement
|
|
506
|
+
return Array.from(row.childNodes).some(
|
|
507
|
+
(node) =>
|
|
508
|
+
node !== heading &&
|
|
509
|
+
(node.nodeType === Node.ELEMENT_NODE ||
|
|
510
|
+
(node.nodeType === Node.TEXT_NODE && (node.textContent ?? '').trim() !== '')),
|
|
511
|
+
)
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
_(Member comments are shortened to their first sentence, and the 37 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-data-table-ui-angular/dist/data-table-card.component.d.ts`.)_
|
|
517
|
+
|
|
518
|
+
#### `RowWithActions`
|
|
519
|
+
|
|
520
|
+
RowWithActions component.
|
|
521
|
+
|
|
522
|
+
`<tr>` wrapper that adds a trailing actions cell plus a click handler on the
|
|
523
|
+
body — the Angular counterpart of `@molecule/app-data-table-ui-react`'s
|
|
524
|
+
`RowWithActions`: the same props (React names), the same ClassMap tokens, and
|
|
525
|
+
the same DOM for the same input. The host IS the `<tr>`
|
|
526
|
+
(`tr[mol-row-with-actions]`), matching React's root exactly.
|
|
527
|
+
|
|
528
|
+
The row cells are the element's default projected content; `actions` is
|
|
529
|
+
`[slot=actions]` content, a `TemplateRef`, or text. A click inside the actions
|
|
530
|
+
cell does not reach the row's handler (React's `stopPropagation`).
|
|
531
|
+
|
|
532
|
+
```typescript
|
|
533
|
+
@Component({
|
|
534
|
+
selector: 'tr[mol-row-with-actions]',
|
|
535
|
+
standalone: true,
|
|
536
|
+
imports: [NgTemplateOutlet],
|
|
537
|
+
inputs: ['actions', 'onClick', 'selected', 'className'],
|
|
538
|
+
host: {
|
|
539
|
+
'[class]': 'classes()',
|
|
540
|
+
'[attr.aria-selected]': 'selected ?? null',
|
|
541
|
+
'(click)': 'runClick($event)',
|
|
542
|
+
},
|
|
543
|
+
template: `<ng-content></ng-content>
|
|
544
|
+
<td #actionsCell [class]="actionsCellClasses()" (click)="stopClick($event)">
|
|
545
|
+
<ng-content select="[slot=actions]"></ng-content>
|
|
546
|
+
@if (actionsTemplate(); as tpl) {
|
|
547
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
548
|
+
}
|
|
549
|
+
{{ actionsText() }}
|
|
550
|
+
</td>`,
|
|
551
|
+
})
|
|
552
|
+
export class RowWithActions implements AfterViewInit, DoCheck {
|
|
553
|
+
/** Action buttons/menu for the trailing cell (a `TemplateRef` or `[slot=actions]` content). */
|
|
554
|
+
actions?: unknown
|
|
555
|
+
/** Called when the row body is clicked, with the click event. */
|
|
556
|
+
onClick?: (event: MouseEvent) => void
|
|
557
|
+
/** Whether the row renders in a "selected" visual state. */
|
|
558
|
+
selected?: boolean
|
|
559
|
+
/** Extra classes on the `<tr>`. */
|
|
560
|
+
className?: string
|
|
561
|
+
|
|
562
|
+
/** The trailing actions cell, detached while React renders none. */
|
|
563
|
+
@ViewChild('actionsCell') private actionsCell?: ElementRef<HTMLElement>
|
|
564
|
+
|
|
565
|
+
private readonly renderer = inject(Renderer2)
|
|
566
|
+
private readonly conditional = new ConditionalElement(this.renderer)
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* The current class map.
|
|
570
|
+
* @returns The UIClassMap.
|
|
571
|
+
*/
|
|
572
|
+
cm(): UIClassMap {
|
|
573
|
+
return getClassMap()
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* The row's class list: React adds `cursor-pointer` only when the row is
|
|
578
|
+
* clickable, then the caller's classes.
|
|
579
|
+
* @returns The class string.
|
|
580
|
+
*/
|
|
581
|
+
classes(): string {
|
|
582
|
+
return this.cm().cn(this.onClick ? this.cm().cursorPointer : undefined, this.className)
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* The actions cell's class list (`text-center`).
|
|
587
|
+
* @returns The class string.
|
|
588
|
+
*/
|
|
589
|
+
actionsCellClasses(): string {
|
|
590
|
+
return this.cm().cn(this.cm().textCenter)
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* The actions' text (React's `{actions}` for text).
|
|
595
|
+
* @returns The text, or `''` for a node actions slot.
|
|
596
|
+
*/
|
|
597
|
+
actionsText(): string {
|
|
598
|
+
return typeof this.actions === 'string' || typeof this.actions === 'number'
|
|
599
|
+
? textOf(this.actions)
|
|
600
|
+
: ''
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* The actions' template, when the caller passed a node.
|
|
605
|
+
* @returns The template, or null.
|
|
606
|
+
*/
|
|
607
|
+
actionsTemplate(): TemplateRef<unknown> | null {
|
|
608
|
+
return templateOf(this.actions)
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Runs the row's click handler the way React's `onClick` does.
|
|
613
|
+
* @param event - The native click event.
|
|
614
|
+
*/
|
|
615
|
+
runClick(event: MouseEvent): void {
|
|
616
|
+
this.onClick?.(event)
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Stops a click inside the actions cell from reaching the row (React's
|
|
621
|
+
* `onClick={(e) => e.stopPropagation()}`).
|
|
622
|
+
* @param event - The native click event.
|
|
623
|
+
*/
|
|
624
|
+
stopClick(event: MouseEvent): void {
|
|
625
|
+
event.stopPropagation()
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/** Reconciles the actions cell once the view (and its projected content) exists. */
|
|
629
|
+
ngAfterViewInit(): void {
|
|
630
|
+
this.syncActions()
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/** Re-reconciles the actions cell after input writes. */
|
|
634
|
+
ngDoCheck(): void {
|
|
635
|
+
this.syncActions()
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/** Keeps the actions cell in the DOM exactly while React renders it. */
|
|
639
|
+
private syncActions(): void {
|
|
640
|
+
const cell = this.actionsCell?.nativeElement
|
|
641
|
+
this.conditional.sync(cell, this.actions !== undefined || hasContent(cell))
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
#### `TableEmpty`
|
|
647
|
+
|
|
648
|
+
TableEmpty component.
|
|
649
|
+
|
|
650
|
+
Single full-width row shown when a table has no data — the Angular
|
|
651
|
+
counterpart of `@molecule/app-data-table-ui-react`'s `TableEmpty`: the same
|
|
652
|
+
props (React names), the same ClassMap tokens, and the same DOM for the same
|
|
653
|
+
input. The host IS the `<tr>` (`tr[mol-table-empty]`), matching React's root
|
|
654
|
+
exactly; the empty state is the element's default projected content, a
|
|
655
|
+
`TemplateRef`, or text.
|
|
656
|
+
|
|
657
|
+
```typescript
|
|
658
|
+
@Component({
|
|
659
|
+
selector: 'tr[mol-table-empty]',
|
|
660
|
+
standalone: true,
|
|
661
|
+
imports: [NgTemplateOutlet],
|
|
662
|
+
inputs: ['colSpan', 'children', 'className'],
|
|
663
|
+
template: `<td [attr.colspan]="colSpan ?? null" [class]="cellClasses()">
|
|
664
|
+
<ng-content></ng-content>
|
|
665
|
+
@if (childTemplate(); as tpl) {
|
|
666
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
667
|
+
}
|
|
668
|
+
{{ childText() }}
|
|
669
|
+
</td>`,
|
|
670
|
+
})
|
|
671
|
+
export class TableEmpty {
|
|
672
|
+
/** Number of columns to span. */
|
|
673
|
+
colSpan?: number
|
|
674
|
+
/** Empty-state content as text (nodes are projected as default content). */
|
|
675
|
+
children?: unknown
|
|
676
|
+
/** Extra classes on the cell. */
|
|
677
|
+
className?: string
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* The current class map.
|
|
681
|
+
* @returns The UIClassMap.
|
|
682
|
+
*/
|
|
683
|
+
cm(): UIClassMap {
|
|
684
|
+
return getClassMap()
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* The cell's class list (`py-10` + `text-center` + the caller's classes).
|
|
689
|
+
* @returns The class string.
|
|
690
|
+
*/
|
|
691
|
+
cellClasses(): string {
|
|
692
|
+
return this.cm().cn(this.cm().sp('py', 10), this.cm().textCenter, this.className)
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* The content's text (React's `{children}` for text).
|
|
697
|
+
* @returns The text, or `''` for a node child.
|
|
698
|
+
*/
|
|
699
|
+
childText(): string {
|
|
700
|
+
return typeof this.children === 'string' || typeof this.children === 'number'
|
|
701
|
+
? textOf(this.children)
|
|
702
|
+
: ''
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* The content's template, when the caller passed a node.
|
|
707
|
+
* @returns The template, or null.
|
|
708
|
+
*/
|
|
709
|
+
childTemplate(): TemplateRef<unknown> | null {
|
|
710
|
+
return templateOf(this.children)
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
#### `TableFooter`
|
|
716
|
+
|
|
717
|
+
TableFooter component.
|
|
718
|
+
|
|
719
|
+
Footer bar rendered below a table — the Angular counterpart of
|
|
720
|
+
`@molecule/app-data-table-ui-react`'s `TableFooter`: the same props (React
|
|
721
|
+
names), the same ClassMap tokens, and the same DOM for the same input. The
|
|
722
|
+
host IS the outer `<div>` (`div[mol-table-footer]`), matching React's root
|
|
723
|
+
exactly. Both slots always render as their own `<div>`; `left` and `right`
|
|
724
|
+
are `[slot=…]` content, `TemplateRef`s, or text.
|
|
725
|
+
|
|
726
|
+
```typescript
|
|
727
|
+
@Component({
|
|
728
|
+
selector: 'div[mol-table-footer]',
|
|
729
|
+
standalone: true,
|
|
730
|
+
imports: [NgTemplateOutlet],
|
|
731
|
+
inputs: ['left', 'right', 'className'],
|
|
732
|
+
host: { '[class]': 'classes()' },
|
|
733
|
+
template: `<div>
|
|
734
|
+
<ng-content select="[slot=left]"></ng-content>
|
|
735
|
+
@if (leftTemplate(); as tpl) {
|
|
736
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
737
|
+
}
|
|
738
|
+
{{ leftText() }}
|
|
739
|
+
</div>
|
|
740
|
+
<div>
|
|
741
|
+
<ng-content select="[slot=right]"></ng-content>
|
|
742
|
+
@if (rightTemplate(); as tpl) {
|
|
743
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
744
|
+
}
|
|
745
|
+
{{ rightText() }}
|
|
746
|
+
</div>`,
|
|
747
|
+
})
|
|
748
|
+
export class TableFooter {
|
|
749
|
+
/** Left slot — typically a summary line (a `TemplateRef` or `[slot=left]` content). */
|
|
750
|
+
left?: unknown
|
|
751
|
+
/** Right slot — typically a pagination bar (a `TemplateRef` or `[slot=right]` content). */
|
|
752
|
+
right?: unknown
|
|
753
|
+
/** Extra classes. */
|
|
754
|
+
className?: string
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* The current class map.
|
|
758
|
+
* @returns The UIClassMap.
|
|
759
|
+
*/
|
|
760
|
+
cm(): UIClassMap {
|
|
761
|
+
return getClassMap()
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* The bar's class list (`flex between/center, gap sm, wrap` + `pt-3` + the
|
|
766
|
+
* caller's classes).
|
|
767
|
+
* @returns The class string.
|
|
768
|
+
*/
|
|
769
|
+
classes(): string {
|
|
770
|
+
return this.cm().cn(
|
|
771
|
+
this.cm().flex({ justify: 'between', align: 'center', gap: 'sm', wrap: 'wrap' }),
|
|
772
|
+
this.cm().sp('pt', 3),
|
|
773
|
+
this.className,
|
|
774
|
+
)
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* The left slot's text (React's `{left}` for text).
|
|
779
|
+
* @returns The text, or `''` for a node slot.
|
|
780
|
+
*/
|
|
781
|
+
leftText(): string {
|
|
782
|
+
return typeof this.left === 'string' || typeof this.left === 'number' ? textOf(this.left) : ''
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* The left slot's template, when the caller passed a node.
|
|
787
|
+
* @returns The template, or null.
|
|
788
|
+
*/
|
|
789
|
+
leftTemplate(): TemplateRef<unknown> | null {
|
|
790
|
+
return templateOf(this.left)
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* The right slot's text (React's `{right}` for text).
|
|
795
|
+
* @returns The text, or `''` for a node slot.
|
|
796
|
+
*/
|
|
797
|
+
rightText(): string {
|
|
798
|
+
return typeof this.right === 'string' || typeof this.right === 'number'
|
|
799
|
+
? textOf(this.right)
|
|
800
|
+
: ''
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* The right slot's template, when the caller passed a node.
|
|
805
|
+
* @returns The template, or null.
|
|
806
|
+
*/
|
|
807
|
+
rightTemplate(): TemplateRef<unknown> | null {
|
|
808
|
+
return templateOf(this.right)
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
#### `TableToolbar`
|
|
814
|
+
|
|
815
|
+
TableToolbar component.
|
|
816
|
+
|
|
817
|
+
Table top-chrome row with left/right slots and an optional bottom sub-row for
|
|
818
|
+
active filter chips or tabs — the Angular counterpart of
|
|
819
|
+
`@molecule/app-data-table-ui-react`'s `TableToolbar`: the same props (React
|
|
820
|
+
names), the same ClassMap tokens, and the same DOM for the same input. The
|
|
821
|
+
host IS the outer stack `<div>` (`div[mol-table-toolbar]`), matching React's
|
|
822
|
+
root exactly. `left`, `right` and `below` are `[slot=…]` content,
|
|
823
|
+
`TemplateRef`s, or text.
|
|
824
|
+
|
|
825
|
+
```typescript
|
|
826
|
+
@Component({
|
|
827
|
+
selector: 'div[mol-table-toolbar]',
|
|
828
|
+
standalone: true,
|
|
829
|
+
imports: [NgTemplateOutlet],
|
|
830
|
+
inputs: ['left', 'right', 'below', 'className'],
|
|
831
|
+
host: { '[class]': 'classes()' },
|
|
832
|
+
template: `<div [class]="rowClasses()">
|
|
833
|
+
<div [class]="sectionClasses()">
|
|
834
|
+
<ng-content select="[slot=left]"></ng-content>
|
|
835
|
+
@if (leftTemplate(); as tpl) {
|
|
836
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
837
|
+
}
|
|
838
|
+
{{ leftText() }}
|
|
839
|
+
</div>
|
|
840
|
+
<div [class]="sectionClasses()">
|
|
841
|
+
<ng-content select="[slot=right]"></ng-content>
|
|
842
|
+
@if (rightTemplate(); as tpl) {
|
|
843
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
844
|
+
}
|
|
845
|
+
{{ rightText() }}
|
|
846
|
+
</div>
|
|
847
|
+
</div>
|
|
848
|
+
<ng-content select="[slot=below]"></ng-content>
|
|
849
|
+
@if (belowTemplate(); as tpl) {
|
|
850
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
851
|
+
}
|
|
852
|
+
{{ belowText() }}`,
|
|
853
|
+
})
|
|
854
|
+
export class TableToolbar {
|
|
855
|
+
/** Left-aligned content (a `TemplateRef` or `[slot=left]` content). */
|
|
856
|
+
left?: unknown
|
|
857
|
+
/** Right-aligned actions (a `TemplateRef` or `[slot=right]` content). */
|
|
858
|
+
right?: unknown
|
|
859
|
+
/** Optional filter sub-row (a `TemplateRef` or `[slot=below]` content). */
|
|
860
|
+
below?: unknown
|
|
861
|
+
/** Extra classes. */
|
|
862
|
+
className?: string
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* The current class map.
|
|
866
|
+
* @returns The UIClassMap.
|
|
867
|
+
*/
|
|
868
|
+
cm(): UIClassMap {
|
|
869
|
+
return getClassMap()
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* The toolbar's class list (`stack(2)` + the caller's classes).
|
|
874
|
+
* @returns The class string.
|
|
875
|
+
*/
|
|
876
|
+
classes(): string {
|
|
877
|
+
return this.cm().cn(this.cm().stack(2), this.className)
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* The left/right row's class list (`flex between/center, gap sm, wrap`).
|
|
882
|
+
* @returns The class string.
|
|
883
|
+
*/
|
|
884
|
+
rowClasses(): string {
|
|
885
|
+
return this.cm().flex({ justify: 'between', align: 'center', gap: 'sm', wrap: 'wrap' })
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* One left/right section's class list (`flex center, gap sm`).
|
|
890
|
+
* @returns The class string.
|
|
891
|
+
*/
|
|
892
|
+
sectionClasses(): string {
|
|
893
|
+
return this.cm().flex({ align: 'center', gap: 'sm' })
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* The left slot's text (React's `{left}` for text).
|
|
898
|
+
* @returns The text, or `''` for a node slot.
|
|
899
|
+
*/
|
|
900
|
+
leftText(): string {
|
|
901
|
+
return typeof this.left === 'string' || typeof this.left === 'number' ? textOf(this.left) : ''
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* The left slot's template, when the caller passed a node.
|
|
906
|
+
* @returns The template, or null.
|
|
907
|
+
*/
|
|
908
|
+
leftTemplate(): TemplateRef<unknown> | null {
|
|
909
|
+
return templateOf(this.left)
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* The right slot's text (React's `{right}` for text).
|
|
914
|
+
* @returns The text, or `''` for a node slot.
|
|
915
|
+
*/
|
|
916
|
+
rightText(): string {
|
|
917
|
+
return typeof this.right === 'string' || typeof this.right === 'number'
|
|
918
|
+
? textOf(this.right)
|
|
919
|
+
: ''
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* The right slot's template, when the caller passed a node.
|
|
924
|
+
* @returns The template, or null.
|
|
925
|
+
*/
|
|
926
|
+
rightTemplate(): TemplateRef<unknown> | null {
|
|
927
|
+
return templateOf(this.right)
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* The filter row's text (React's `{below}` for text).
|
|
932
|
+
* @returns The text, or `''` for a node row.
|
|
933
|
+
*/
|
|
934
|
+
belowText(): string {
|
|
935
|
+
return typeof this.below === 'string' || typeof this.below === 'number'
|
|
936
|
+
? textOf(this.below)
|
|
937
|
+
: ''
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* The filter row's template, when the caller passed a node.
|
|
942
|
+
* @returns The template, or null.
|
|
943
|
+
*/
|
|
944
|
+
belowTemplate(): TemplateRef<unknown> | null {
|
|
945
|
+
return templateOf(this.below)
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
## Injection Notes
|
|
951
|
+
|
|
952
|
+
### Requirements
|
|
953
|
+
|
|
954
|
+
Peer dependencies:
|
|
955
|
+
|
|
956
|
+
- `@angular/common` ^22.0.0
|
|
957
|
+
- `@angular/core` ^22.0.0
|
|
958
|
+
- `@angular/platform-browser` ^22.0.0
|
|
959
|
+
- `@molecule/app-angular` ^3.5.0
|
|
960
|
+
- `@molecule/app-ui` ^1.3.11
|
|
961
|
+
- `@molecule/app-ui-angular` ^1.1.0
|
|
962
|
+
|
|
963
|
+
### Runtime Dependencies
|
|
964
|
+
|
|
965
|
+
- `@angular/common`
|
|
966
|
+
- `@angular/core`
|
|
967
|
+
- `@angular/platform-browser`
|
|
968
|
+
- `@molecule/app-angular`
|
|
969
|
+
- `@molecule/app-ui`
|
|
970
|
+
- `@molecule/app-ui-angular`
|
|
971
|
+
|
|
972
|
+
All text (`title`, column `header`s, `emptyMessage`) is consumer-provided —
|
|
973
|
+
pass translated strings; there is no built-in copy and no locale bond.
|
|
974
|
+
`DataTableCard`'s chrome uses Tailwind classes with Material-3 theme tokens
|
|
975
|
+
(`bg-surface-container-lowest`, `divide-surface-container`,
|
|
976
|
+
`text-on-surface-variant`, …) — the app's Tailwind theme must define those
|
|
977
|
+
tokens (molecule's default Tailwind ClassMap bond does); with a non-Tailwind
|
|
978
|
+
ClassMap the card surface, dividers, and skeleton styling drop out.
|
|
979
|
+
`onRowClick` makes rows pointer-clickable only — add your own keyboard path
|
|
980
|
+
(e.g. a link/button in a cell) where accessibility matters.
|
|
981
|
+
|
|
982
|
+
Rows are keyed by `rowKey(row)` (React's `key={rowKey(row)}`), so a row keeps
|
|
983
|
+
its DOM node while its key is unchanged.
|