@molecule/app-data-table-ui-angular 1.1.0 → 1.1.2
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/README.md +36 -43
- package/dist/data-table-card.component.d.ts +10 -10
- package/dist/data-table-card.component.d.ts.map +1 -1
- package/dist/data-table-card.component.js +23 -25
- package/dist/data-table-card.component.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/row-with-actions.component.d.ts +10 -10
- package/dist/row-with-actions.component.d.ts.map +1 -1
- package/dist/row-with-actions.component.js +19 -18
- package/dist/row-with-actions.component.js.map +1 -1
- package/dist/slot-dom.d.ts +3 -39
- package/dist/slot-dom.d.ts.map +1 -1
- package/dist/slot-dom.js +2 -64
- package/dist/slot-dom.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-23T14:53:23.879Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-data-table-ui-angular
|
|
@@ -39,7 +39,7 @@ are projected content (`[slot=<name>]`), a `TemplateRef`, or text.
|
|
|
39
39
|
|
|
40
40
|
```ts
|
|
41
41
|
import { Component } from '@angular/core'
|
|
42
|
-
import { DataTableCard } from '@molecule/app-data-table-ui-angular'
|
|
42
|
+
import { DataTableCard, type DataTableColumn } from '@molecule/app-data-table-ui-angular'
|
|
43
43
|
|
|
44
44
|
interface Row {
|
|
45
45
|
id: string
|
|
@@ -71,6 +71,7 @@ interface Row {
|
|
|
71
71
|
`,
|
|
72
72
|
})
|
|
73
73
|
export class MembersTable {
|
|
74
|
+
columns: DataTableColumn<Row>[] = []
|
|
74
75
|
members: Row[] = []
|
|
75
76
|
rowKey = (row: Row): string => row.id
|
|
76
77
|
open = (row: Row): void => {
|
|
@@ -236,6 +237,7 @@ Column `cell` templates receive the row as `$implicit` and `a0`; a column
|
|
|
236
237
|
@Component({
|
|
237
238
|
selector: 'section[mol-data-table-card]',
|
|
238
239
|
standalone: true,
|
|
240
|
+
hostDirectives: [MolPlacement],
|
|
239
241
|
imports: [NgTemplateOutlet],
|
|
240
242
|
inputs: [
|
|
241
243
|
'title',
|
|
@@ -320,7 +322,7 @@ Column `cell` templates receive the row as `$implicit` and `a0`; a column
|
|
|
320
322
|
</table>
|
|
321
323
|
</div>`,
|
|
322
324
|
})
|
|
323
|
-
export class DataTableCard<T = unknown>
|
|
325
|
+
export class DataTableCard<T = unknown> {
|
|
324
326
|
title?: unknown
|
|
325
327
|
titleAction?: unknown
|
|
326
328
|
/** Column definitions. */
|
|
@@ -334,15 +336,18 @@ export class DataTableCard<T = unknown> implements AfterViewInit, DoCheck {
|
|
|
334
336
|
emptyMessage?: unknown
|
|
335
337
|
/** Extra classes on the outer card. */
|
|
336
338
|
className?: string
|
|
339
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
337
340
|
dataMolId?: string
|
|
338
341
|
|
|
342
|
+
/** The index list of the five skeleton rows. */
|
|
339
343
|
readonly skeletonIndexes = [0, 1, 2, 3, 4]
|
|
340
344
|
|
|
341
345
|
@ViewChild('headerRow') private headerRow?: ElementRef<HTMLElement>
|
|
342
346
|
@ViewChild('titleHeading') private titleHeading?: ElementRef<HTMLElement>
|
|
343
347
|
|
|
344
|
-
|
|
345
|
-
|
|
348
|
+
constructor() {
|
|
349
|
+
usePlacement((hasContent) => this.syncVisibility(hasContent))
|
|
350
|
+
}
|
|
346
351
|
|
|
347
352
|
/** The current class map. */
|
|
348
353
|
cm(): UIClassMap {
|
|
@@ -369,6 +374,7 @@ export class DataTableCard<T = unknown> implements AfterViewInit, DoCheck {
|
|
|
369
374
|
)
|
|
370
375
|
}
|
|
371
376
|
|
|
377
|
+
/** The scroller's class list (`overflow-x-auto`). */
|
|
372
378
|
scrollerClasses(): string {
|
|
373
379
|
return this.cm().cn(this.cm().dataTableCardScroller)
|
|
374
380
|
}
|
|
@@ -377,6 +383,7 @@ export class DataTableCard<T = unknown> implements AfterViewInit, DoCheck {
|
|
|
377
383
|
return this.cm().cn(this.cm().w('full'), this.cm().dataTableCardTable)
|
|
378
384
|
}
|
|
379
385
|
|
|
386
|
+
/** The header row's class list (the card head token). */
|
|
380
387
|
headClasses(): string {
|
|
381
388
|
return this.cm().cn(this.cm().dataTableCardHead)
|
|
382
389
|
}
|
|
@@ -390,10 +397,12 @@ export class DataTableCard<T = unknown> implements AfterViewInit, DoCheck {
|
|
|
390
397
|
)
|
|
391
398
|
}
|
|
392
399
|
|
|
400
|
+
/** The body's class list (the card body token). */
|
|
393
401
|
bodyClasses(): string {
|
|
394
402
|
return this.cm().cn(this.cm().dataTableCardBody)
|
|
395
403
|
}
|
|
396
404
|
|
|
405
|
+
/** A skeleton cell's class list (`px-8` + `py-5`). */
|
|
397
406
|
skeletonCellClasses(): string {
|
|
398
407
|
return this.cm().cn(this.cm().sp('px', 8), this.cm().sp('py', 5))
|
|
399
408
|
}
|
|
@@ -483,37 +492,24 @@ export class DataTableCard<T = unknown> implements AfterViewInit, DoCheck {
|
|
|
483
492
|
this.onRowClick?.(row)
|
|
484
493
|
}
|
|
485
494
|
|
|
486
|
-
|
|
487
|
-
this.syncVisibility()
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
ngDoCheck(): void {
|
|
491
|
-
this.syncVisibility()
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
private syncVisibility(): void {
|
|
495
|
+
private syncVisibility(hasContent: SlotReader): void {
|
|
495
496
|
const heading = this.titleHeading?.nativeElement
|
|
496
|
-
const
|
|
497
|
-
this.
|
|
498
|
-
this.
|
|
497
|
+
const headingHas = hasContent(heading, 1)
|
|
498
|
+
const titleShown = this.title !== undefined || headingHas
|
|
499
|
+
setElementPresent(this.headerRow?.nativeElement, titleShown || this.hasTitleAction(hasContent))
|
|
500
|
+
setElementPresent(heading, titleShown)
|
|
499
501
|
}
|
|
500
502
|
|
|
501
|
-
private hasTitleAction(): boolean {
|
|
503
|
+
private hasTitleAction(hasContent: SlotReader): boolean {
|
|
502
504
|
if (this.titleAction !== undefined) return true
|
|
503
505
|
const row = this.headerRow?.nativeElement
|
|
504
506
|
if (!row) return false
|
|
505
|
-
|
|
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
|
-
)
|
|
507
|
+
return hasContent(row, 1)
|
|
512
508
|
}
|
|
513
509
|
}
|
|
514
510
|
```
|
|
515
511
|
|
|
516
|
-
_(Member comments are shortened to their first sentence, and the
|
|
512
|
+
_(Member comments are shortened to their first sentence, and the 29 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
513
|
|
|
518
514
|
#### `RowWithActions`
|
|
519
515
|
|
|
@@ -533,6 +529,7 @@ cell does not reach the row's handler (React's `stopPropagation`).
|
|
|
533
529
|
@Component({
|
|
534
530
|
selector: 'tr[mol-row-with-actions]',
|
|
535
531
|
standalone: true,
|
|
532
|
+
hostDirectives: [MolPlacement],
|
|
536
533
|
imports: [NgTemplateOutlet],
|
|
537
534
|
inputs: ['actions', 'onClick', 'selected', 'className'],
|
|
538
535
|
host: {
|
|
@@ -549,7 +546,7 @@ cell does not reach the row's handler (React's `stopPropagation`).
|
|
|
549
546
|
{{ actionsText() }}
|
|
550
547
|
</td>`,
|
|
551
548
|
})
|
|
552
|
-
export class RowWithActions
|
|
549
|
+
export class RowWithActions {
|
|
553
550
|
/** Action buttons/menu for the trailing cell (a `TemplateRef` or `[slot=actions]` content). */
|
|
554
551
|
actions?: unknown
|
|
555
552
|
/** Called when the row body is clicked, with the click event. */
|
|
@@ -562,8 +559,9 @@ export class RowWithActions implements AfterViewInit, DoCheck {
|
|
|
562
559
|
/** The trailing actions cell, detached while React renders none. */
|
|
563
560
|
@ViewChild('actionsCell') private actionsCell?: ElementRef<HTMLElement>
|
|
564
561
|
|
|
565
|
-
|
|
566
|
-
|
|
562
|
+
constructor() {
|
|
563
|
+
usePlacement((hasContent) => this.syncActions(hasContent))
|
|
564
|
+
}
|
|
567
565
|
|
|
568
566
|
/**
|
|
569
567
|
* The current class map.
|
|
@@ -625,20 +623,15 @@ export class RowWithActions implements AfterViewInit, DoCheck {
|
|
|
625
623
|
event.stopPropagation()
|
|
626
624
|
}
|
|
627
625
|
|
|
628
|
-
/**
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
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 {
|
|
626
|
+
/**
|
|
627
|
+
* Keeps the actions cell in the DOM exactly while React renders it.
|
|
628
|
+
*
|
|
629
|
+
* @param hasContent - Reads whether a slot has content.
|
|
630
|
+
*/
|
|
631
|
+
private syncActions(hasContent: SlotReader): void {
|
|
640
632
|
const cell = this.actionsCell?.nativeElement
|
|
641
|
-
|
|
633
|
+
const projected = hasContent(cell)
|
|
634
|
+
setElementPresent(cell, this.actions !== undefined || projected)
|
|
642
635
|
}
|
|
643
636
|
}
|
|
644
637
|
```
|
|
@@ -956,7 +949,7 @@ Peer dependencies:
|
|
|
956
949
|
- `@angular/common` ^22.0.0
|
|
957
950
|
- `@angular/core` ^22.0.0
|
|
958
951
|
- `@angular/platform-browser` ^22.0.0
|
|
959
|
-
- `@molecule/app-angular` ^3.
|
|
952
|
+
- `@molecule/app-angular` ^3.13.0
|
|
960
953
|
- `@molecule/app-ui` ^1.3.11
|
|
961
954
|
- `@molecule/app-ui-angular` ^1.1.0
|
|
962
955
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type TemplateRef } from '@angular/core';
|
|
2
2
|
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
3
|
import type { DataTableColumn } from './types.js';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@molecule/app-angular";
|
|
5
6
|
/**
|
|
6
7
|
* DataTableCard component.
|
|
7
8
|
*
|
|
@@ -20,7 +21,7 @@ import * as i0 from "@angular/core";
|
|
|
20
21
|
* `header` may be text or a `TemplateRef`. Node props (`title`, `titleAction`,
|
|
21
22
|
* `emptyMessage`) may be `[slot=…]` content, a `TemplateRef`, or text.
|
|
22
23
|
*/
|
|
23
|
-
export declare class DataTableCard<T = unknown>
|
|
24
|
+
export declare class DataTableCard<T = unknown> {
|
|
24
25
|
/** Optional title above the table chrome (text, a `TemplateRef`, or `[slot=title]` content). */
|
|
25
26
|
title?: unknown;
|
|
26
27
|
/** Right-aligned action in the title row (a `TemplateRef` or `[slot=titleAction]` content). */
|
|
@@ -47,8 +48,7 @@ export declare class DataTableCard<T = unknown> implements AfterViewInit, DoChec
|
|
|
47
48
|
private headerRow?;
|
|
48
49
|
/** The `<h3>`, detached while React renders no title. */
|
|
49
50
|
private titleHeading?;
|
|
50
|
-
|
|
51
|
-
private readonly conditional;
|
|
51
|
+
constructor();
|
|
52
52
|
/**
|
|
53
53
|
* The current class map.
|
|
54
54
|
* @returns The UIClassMap.
|
|
@@ -192,23 +192,23 @@ export declare class DataTableCard<T = unknown> implements AfterViewInit, DoChec
|
|
|
192
192
|
* @param row - The clicked row.
|
|
193
193
|
*/
|
|
194
194
|
clickRow(row: T): void;
|
|
195
|
-
/** Reconciles the title row once the view (and its projected content) exists. */
|
|
196
|
-
ngAfterViewInit(): void;
|
|
197
|
-
/** Re-reconciles the title row after input writes. */
|
|
198
|
-
ngDoCheck(): void;
|
|
199
195
|
/**
|
|
200
196
|
* Keeps the title row and the `<h3>` in the DOM exactly while React renders
|
|
201
197
|
* them: the row when a title or a title action exists, the heading when a
|
|
202
198
|
* title exists.
|
|
199
|
+
*
|
|
200
|
+
* @param hasContent - Reads whether a slot has content.
|
|
203
201
|
*/
|
|
204
202
|
private syncVisibility;
|
|
205
203
|
/**
|
|
206
204
|
* Whether React renders a title action: the prop, or `[slot=titleAction]`
|
|
207
|
-
* content beside the heading.
|
|
205
|
+
* content beside the heading (the heading is the row's own first child).
|
|
206
|
+
*
|
|
207
|
+
* @param hasContent - Reads whether a slot has content.
|
|
208
208
|
* @returns True when an action renders.
|
|
209
209
|
*/
|
|
210
210
|
private hasTitleAction;
|
|
211
211
|
static ɵfac: i0.ɵɵFactoryDeclaration<DataTableCard<any>, never>;
|
|
212
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DataTableCard<any>, "section[mol-data-table-card]", never, { "title": { "alias": "title"; "required": false; }; "titleAction": { "alias": "titleAction"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "rowKey": { "alias": "rowKey"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "onRowClick": { "alias": "onRowClick"; "required": false; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; }; "className": { "alias": "className"; "required": false; }; "dataMolId": { "alias": "dataMolId"; "required": false; }; }, {}, never, ["[slot=title]", "[slot=titleAction]", "[slot=emptyMessage]"], true,
|
|
212
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DataTableCard<any>, "section[mol-data-table-card]", never, { "title": { "alias": "title"; "required": false; }; "titleAction": { "alias": "titleAction"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "rowKey": { "alias": "rowKey"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "onRowClick": { "alias": "onRowClick"; "required": false; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; }; "className": { "alias": "className"; "required": false; }; "dataMolId": { "alias": "dataMolId"; "required": false; }; }, {}, never, ["[slot=title]", "[slot=titleAction]", "[slot=emptyMessage]"], true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
213
213
|
}
|
|
214
214
|
//# sourceMappingURL=data-table-card.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-card.component.d.ts","sourceRoot":"","sources":["../src/data-table-card.component.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"data-table-card.component.d.ts","sourceRoot":"","sources":["../src/data-table-card.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAA8B,KAAK,WAAW,EAAa,MAAM,eAAe,CAAA;AAQvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;;;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAwFa,aAAa,CAAC,CAAC,GAAG,OAAO;IACpC,gGAAgG;IAChG,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,+FAA+F;IAC/F,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,0BAA0B;IAC1B,OAAO,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAK;IAC/C,sBAAsB;IACtB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAK;IAC3B,kEAAkE;IAClE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAA;IAC3B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sCAAsC;IACtC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAA;IAC7B,qFAAqF;IACrF,Y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IAMnB;;;OAGG;IACH,aAAa,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;IAI5C;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;IAIvE;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,MAAM;IAM9C;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;IAIrE;;;;;OAKG;IACH,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAI3C;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM;IAIxB;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI;IAItB;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAQtB;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;yCAtTX,aAAa;2CAAb,aAAa;CA4TzB"}
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
-
import { Component,
|
|
7
|
+
import { Component, ViewChild } from '@angular/core';
|
|
8
|
+
import { MolPlacement, setElementPresent, usePlacement, } from '@molecule/app-angular';
|
|
8
9
|
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
-
import {
|
|
10
|
+
import { templateOf, textOf } from './slot-dom.js';
|
|
10
11
|
import * as i0 from "@angular/core";
|
|
12
|
+
import * as i1 from "@molecule/app-angular";
|
|
11
13
|
const _c0 = ["headerRow"];
|
|
12
14
|
const _c1 = ["titleHeading"];
|
|
13
15
|
const _c2 = [[["", "slot", "title"]], [["", "slot", "titleaction"]], [["", "slot", "emptymessage"]]];
|
|
@@ -173,8 +175,9 @@ export class DataTableCard {
|
|
|
173
175
|
headerRow;
|
|
174
176
|
/** The `<h3>`, detached while React renders no title. */
|
|
175
177
|
titleHeading;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
constructor() {
|
|
179
|
+
usePlacement((hasContent) => this.syncVisibility(hasContent));
|
|
180
|
+
}
|
|
178
181
|
/**
|
|
179
182
|
* The current class map.
|
|
180
183
|
* @returns The UIClassMap.
|
|
@@ -378,40 +381,34 @@ export class DataTableCard {
|
|
|
378
381
|
clickRow(row) {
|
|
379
382
|
this.onRowClick?.(row);
|
|
380
383
|
}
|
|
381
|
-
/** Reconciles the title row once the view (and its projected content) exists. */
|
|
382
|
-
ngAfterViewInit() {
|
|
383
|
-
this.syncVisibility();
|
|
384
|
-
}
|
|
385
|
-
/** Re-reconciles the title row after input writes. */
|
|
386
|
-
ngDoCheck() {
|
|
387
|
-
this.syncVisibility();
|
|
388
|
-
}
|
|
389
384
|
/**
|
|
390
385
|
* Keeps the title row and the `<h3>` in the DOM exactly while React renders
|
|
391
386
|
* them: the row when a title or a title action exists, the heading when a
|
|
392
387
|
* title exists.
|
|
388
|
+
*
|
|
389
|
+
* @param hasContent - Reads whether a slot has content.
|
|
393
390
|
*/
|
|
394
|
-
syncVisibility() {
|
|
391
|
+
syncVisibility(hasContent) {
|
|
395
392
|
const heading = this.titleHeading?.nativeElement;
|
|
396
|
-
const
|
|
397
|
-
this.
|
|
398
|
-
this.
|
|
393
|
+
const headingHas = hasContent(heading, 1);
|
|
394
|
+
const titleShown = this.title !== undefined || headingHas;
|
|
395
|
+
setElementPresent(this.headerRow?.nativeElement, titleShown || this.hasTitleAction(hasContent));
|
|
396
|
+
setElementPresent(heading, titleShown);
|
|
399
397
|
}
|
|
400
398
|
/**
|
|
401
399
|
* Whether React renders a title action: the prop, or `[slot=titleAction]`
|
|
402
|
-
* content beside the heading.
|
|
400
|
+
* content beside the heading (the heading is the row's own first child).
|
|
401
|
+
*
|
|
402
|
+
* @param hasContent - Reads whether a slot has content.
|
|
403
403
|
* @returns True when an action renders.
|
|
404
404
|
*/
|
|
405
|
-
hasTitleAction() {
|
|
405
|
+
hasTitleAction(hasContent) {
|
|
406
406
|
if (this.titleAction !== undefined)
|
|
407
407
|
return true;
|
|
408
408
|
const row = this.headerRow?.nativeElement;
|
|
409
409
|
if (!row)
|
|
410
410
|
return false;
|
|
411
|
-
|
|
412
|
-
return Array.from(row.childNodes).some((node) => node !== heading &&
|
|
413
|
-
(node.nodeType === Node.ELEMENT_NODE ||
|
|
414
|
-
(node.nodeType === Node.TEXT_NODE && (node.textContent ?? '').trim() !== '')));
|
|
411
|
+
return hasContent(row, 1);
|
|
415
412
|
}
|
|
416
413
|
static ɵfac = function DataTableCard_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DataTableCard)(); };
|
|
417
414
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DataTableCard, selectors: [["section", "mol-data-table-card", ""]], viewQuery: function DataTableCard_Query(rf, ctx) { if (rf & 1) {
|
|
@@ -423,7 +420,7 @@ export class DataTableCard {
|
|
|
423
420
|
} }, hostVars: 3, hostBindings: function DataTableCard_HostBindings(rf, ctx) { if (rf & 2) {
|
|
424
421
|
i0.ɵɵattribute("data-mol-id", ctx.dataMolId ?? null);
|
|
425
422
|
i0.ɵɵclassMap(ctx.classes());
|
|
426
|
-
} }, inputs: { title: "title", titleAction: "titleAction", columns: "columns", rows: "rows", rowKey: "rowKey", loading: "loading", onRowClick: "onRowClick", emptyMessage: "emptyMessage", className: "className", dataMolId: "dataMolId" }, ngContentSelectors: _c3, decls: 20, vars: 17, consts: [["headerRow", ""], ["titleHeading", ""], [3, "ngTemplateOutlet"], [3, "class"], ["aria-hidden", "true"], [3, "click"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"]], template: function DataTableCard_Template(rf, ctx) { if (rf & 1) {
|
|
423
|
+
} }, inputs: { title: "title", titleAction: "titleAction", columns: "columns", rows: "rows", rowKey: "rowKey", loading: "loading", onRowClick: "onRowClick", emptyMessage: "emptyMessage", className: "className", dataMolId: "dataMolId" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement])], ngContentSelectors: _c3, decls: 20, vars: 17, consts: [["headerRow", ""], ["titleHeading", ""], [3, "ngTemplateOutlet"], [3, "class"], ["aria-hidden", "true"], [3, "click"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"]], template: function DataTableCard_Template(rf, ctx) { if (rf & 1) {
|
|
427
424
|
i0.ɵɵprojectionDef(_c2);
|
|
428
425
|
i0.ɵɵelementStart(0, "div", null, 0)(2, "h3", null, 1);
|
|
429
426
|
i0.ɵɵtext(4);
|
|
@@ -473,6 +470,7 @@ export class DataTableCard {
|
|
|
473
470
|
args: [{
|
|
474
471
|
selector: 'section[mol-data-table-card]',
|
|
475
472
|
standalone: true,
|
|
473
|
+
hostDirectives: [MolPlacement],
|
|
476
474
|
imports: [NgTemplateOutlet],
|
|
477
475
|
inputs: [
|
|
478
476
|
'title',
|
|
@@ -557,12 +555,12 @@ export class DataTableCard {
|
|
|
557
555
|
</table>
|
|
558
556
|
</div>`,
|
|
559
557
|
}]
|
|
560
|
-
}],
|
|
558
|
+
}], () => [], { headerRow: [{
|
|
561
559
|
type: ViewChild,
|
|
562
560
|
args: ['headerRow']
|
|
563
561
|
}], titleHeading: [{
|
|
564
562
|
type: ViewChild,
|
|
565
563
|
args: ['titleHeading']
|
|
566
564
|
}] }); })();
|
|
567
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DataTableCard, { className: "DataTableCard", filePath: "data-table-card.component.ts", lineNumber:
|
|
565
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DataTableCard, { className: "DataTableCard", filePath: "data-table-card.component.ts", lineNumber: 128 }); })();
|
|
568
566
|
//# sourceMappingURL=data-table-card.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-card.component.js","sourceRoot":"","sources":["../src/data-table-card.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"data-table-card.component.js","sourceRoot":"","sources":["../src/data-table-card.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAqC,SAAS,EAAE,MAAM,eAAe,CAAA;AAEvF,OAAO,EACL,YAAY,EACZ,iBAAiB,EAEjB,YAAY,GACb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;;;;;;;;;OA0FtC,oBAAa;;IA5Cf,2BAAyC;;IAA3B,sCAAwB;;;IAKxC,2BAAyC;;IAA3B,sCAAwB;;;IAW5B,2BAAyC;;IAA3B,sCAAwB;;;IAEtC,YACF;;;;IADE,6DACF;;;IALF,0BAA+C;IAG3C,AAFF,+FAAsC,sDAE7B;IAGX,iBAAK;;;;;;IAND,iEAA0C;IAC5C,cAIC;IAJD,iFAIC;;;IASD,AADF,6BAAuB,SAC+C;IAClE,sBAA0C;IAE9C,AADE,iBAAK,EACF;;;IAHiC,cAA+B;IAA/B,2CAA+B;;IAC5D,cAA8B;IAA9B,0CAA8B;;;IAHzC,gHAMC;;;IAND,qCAMC;;;IAMK,2BAAyC;;IAA3B,sCAAwB;;;IAH1C,AADF,0BAAI,SAC+D;IAC/D,qBAAsD;IACtD,uGAA+B;IAG/B,YACF;IACF,AADE,iBAAK,EACF;;;;IAPiC,cAA4B;IAA5B,wCAA4B;;IAE9D,eAEC;IAFD,sEAEC;IACD,cACF;IADE,mDACF;;;IAQQ,2BAGE;;;;IADA,AADA,sCAAwB,sDACmB;;;IAJjD,0BAAyC;IACv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,eAAuB;YAAvB,gCAAuB;YACzB,cAQC;YARD,0BAQC;YAGE,eAAuB;YAAvB,gCAAuB;YAC5B,cAiCC;YAjCD,oEAiCC;4BA/EC,gBAAgB;;iFAoFf,aAAa;cAxFzB,SAAS;eAAC;gBACT,QAAQ,EAAE,8BAA8B;gBACxC,UAAU,EAAE,IAAI;gBAChB,cAAc,EAAE,CAAC,YAAY,CAAC;gBAC9B,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE;oBACN,OAAO;oBACP,aAAa;oBACb,SAAS;oBACT,MAAM;oBACN,QAAQ;oBACR,SAAS;oBACT,YAAY;oBACZ,cAAc;oBACd,WAAW;oBACX,WAAW;iBACZ;gBACD,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;oBACtB,oBAAoB,EAAE,mBAAmB;iBAC1C;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiED;aACV;;kBA2BE,SAAS;mBAAC,WAAW;;kBAErB,SAAS;mBAAC,cAAc;;kFA5Bd,aAAa"}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
26
|
* import { Component } from '@angular/core'
|
|
27
|
-
* import { DataTableCard } from '@molecule/app-data-table-ui-angular'
|
|
27
|
+
* import { DataTableCard, type DataTableColumn } from '@molecule/app-data-table-ui-angular'
|
|
28
28
|
*
|
|
29
29
|
* interface Row {
|
|
30
30
|
* id: string
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
* `,
|
|
56
56
|
* })
|
|
57
57
|
* export class MembersTable {
|
|
58
|
+
* columns: DataTableColumn<Row>[] = []
|
|
58
59
|
* members: Row[] = []
|
|
59
60
|
* rowKey = (row: Row): string => row.id
|
|
60
61
|
* open = (row: Row): void => {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
26
|
* import { Component } from '@angular/core'
|
|
27
|
-
* import { DataTableCard } from '@molecule/app-data-table-ui-angular'
|
|
27
|
+
* import { DataTableCard, type DataTableColumn } from '@molecule/app-data-table-ui-angular'
|
|
28
28
|
*
|
|
29
29
|
* interface Row {
|
|
30
30
|
* id: string
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
* `,
|
|
56
56
|
* })
|
|
57
57
|
* export class MembersTable {
|
|
58
|
+
* columns: DataTableColumn<Row>[] = []
|
|
58
59
|
* members: Row[] = []
|
|
59
60
|
* rowKey = (row: Row): string => row.id
|
|
60
61
|
* open = (row: Row): void => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type TemplateRef } from '@angular/core';
|
|
2
2
|
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "@molecule/app-angular";
|
|
4
5
|
/**
|
|
5
6
|
* RowWithActions component.
|
|
6
7
|
*
|
|
@@ -14,7 +15,7 @@ import * as i0 from "@angular/core";
|
|
|
14
15
|
* `[slot=actions]` content, a `TemplateRef`, or text. A click inside the actions
|
|
15
16
|
* cell does not reach the row's handler (React's `stopPropagation`).
|
|
16
17
|
*/
|
|
17
|
-
export declare class RowWithActions
|
|
18
|
+
export declare class RowWithActions {
|
|
18
19
|
/** Action buttons/menu for the trailing cell (a `TemplateRef` or `[slot=actions]` content). */
|
|
19
20
|
actions?: unknown;
|
|
20
21
|
/** Called when the row body is clicked, with the click event. */
|
|
@@ -25,8 +26,7 @@ export declare class RowWithActions implements AfterViewInit, DoCheck {
|
|
|
25
26
|
className?: string;
|
|
26
27
|
/** The trailing actions cell, detached while React renders none. */
|
|
27
28
|
private actionsCell?;
|
|
28
|
-
|
|
29
|
-
private readonly conditional;
|
|
29
|
+
constructor();
|
|
30
30
|
/**
|
|
31
31
|
* The current class map.
|
|
32
32
|
* @returns The UIClassMap.
|
|
@@ -64,13 +64,13 @@ export declare class RowWithActions implements AfterViewInit, DoCheck {
|
|
|
64
64
|
* @param event - The native click event.
|
|
65
65
|
*/
|
|
66
66
|
stopClick(event: MouseEvent): void;
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Keeps the actions cell in the DOM exactly while React renders it.
|
|
69
|
+
*
|
|
70
|
+
* @param hasContent - Reads whether a slot has content.
|
|
71
|
+
*/
|
|
72
72
|
private syncActions;
|
|
73
73
|
static ɵfac: i0.ɵɵFactoryDeclaration<RowWithActions, never>;
|
|
74
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<RowWithActions, "tr[mol-row-with-actions]", never, { "actions": { "alias": "actions"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["*", "[slot=actions]"], true,
|
|
74
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RowWithActions, "tr[mol-row-with-actions]", never, { "actions": { "alias": "actions"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["*", "[slot=actions]"], true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
75
75
|
}
|
|
76
76
|
//# sourceMappingURL=row-with-actions.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-with-actions.component.d.ts","sourceRoot":"","sources":["../src/row-with-actions.component.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"row-with-actions.component.d.ts","sourceRoot":"","sources":["../src/row-with-actions.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAA8B,KAAK,WAAW,EAAa,MAAM,eAAe,CAAA;AAQvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;;AAKlD;;;;;;;;;;;;GAYG;AACH,qBAoBa,cAAc;IACzB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iEAAiE;IACjE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,oEAAoE;IAC1C,OAAO,CAAC,WAAW,CAAC,CAAyB;;IAMvE;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;;OAIG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,kBAAkB,IAAI,MAAM;IAI5B;;;OAGG;IACH,WAAW,IAAI,MAAM;IAMrB;;;OAGG;IACH,eAAe,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;IAI9C;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAIjC;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAIlC;;;;OAIG;IACH,OAAO,CAAC,WAAW;yCAlFR,cAAc;2CAAd,cAAc;CAuF1B"}
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
-
import { Component,
|
|
7
|
+
import { Component, ViewChild } from '@angular/core';
|
|
8
|
+
import { MolPlacement, setElementPresent, usePlacement, } from '@molecule/app-angular';
|
|
8
9
|
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
-
import {
|
|
10
|
+
import { templateOf, textOf } from './slot-dom.js';
|
|
10
11
|
import * as i0 from "@angular/core";
|
|
12
|
+
import * as i1 from "@molecule/app-angular";
|
|
11
13
|
const _c0 = ["actionsCell"];
|
|
12
14
|
const _c1 = ["*", [["", "slot", "actions"]]];
|
|
13
15
|
const _c2 = ["*", "[slot=actions]"];
|
|
@@ -40,8 +42,9 @@ export class RowWithActions {
|
|
|
40
42
|
className;
|
|
41
43
|
/** The trailing actions cell, detached while React renders none. */
|
|
42
44
|
actionsCell;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
constructor() {
|
|
46
|
+
usePlacement((hasContent) => this.syncActions(hasContent));
|
|
47
|
+
}
|
|
45
48
|
/**
|
|
46
49
|
* The current class map.
|
|
47
50
|
* @returns The UIClassMap.
|
|
@@ -95,18 +98,15 @@ export class RowWithActions {
|
|
|
95
98
|
stopClick(event) {
|
|
96
99
|
event.stopPropagation();
|
|
97
100
|
}
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.syncActions();
|
|
105
|
-
}
|
|
106
|
-
/** Keeps the actions cell in the DOM exactly while React renders it. */
|
|
107
|
-
syncActions() {
|
|
101
|
+
/**
|
|
102
|
+
* Keeps the actions cell in the DOM exactly while React renders it.
|
|
103
|
+
*
|
|
104
|
+
* @param hasContent - Reads whether a slot has content.
|
|
105
|
+
*/
|
|
106
|
+
syncActions(hasContent) {
|
|
108
107
|
const cell = this.actionsCell?.nativeElement;
|
|
109
|
-
|
|
108
|
+
const projected = hasContent(cell);
|
|
109
|
+
setElementPresent(cell, this.actions !== undefined || projected);
|
|
110
110
|
}
|
|
111
111
|
static ɵfac = function RowWithActions_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RowWithActions)(); };
|
|
112
112
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RowWithActions, selectors: [["tr", "mol-row-with-actions", ""]], viewQuery: function RowWithActions_Query(rf, ctx) { if (rf & 1) {
|
|
@@ -119,7 +119,7 @@ export class RowWithActions {
|
|
|
119
119
|
} if (rf & 2) {
|
|
120
120
|
i0.ɵɵattribute("aria-selected", ctx.selected ?? null);
|
|
121
121
|
i0.ɵɵclassMap(ctx.classes());
|
|
122
|
-
} }, inputs: { actions: "actions", onClick: "onClick", selected: "selected", className: "className" }, ngContentSelectors: _c2, decls: 6, vars: 4, consts: [["actionsCell", ""], [3, "click"], [3, "ngTemplateOutlet"]], template: function RowWithActions_Template(rf, ctx) { if (rf & 1) {
|
|
122
|
+
} }, inputs: { actions: "actions", onClick: "onClick", selected: "selected", className: "className" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement])], ngContentSelectors: _c2, decls: 6, vars: 4, consts: [["actionsCell", ""], [3, "click"], [3, "ngTemplateOutlet"]], template: function RowWithActions_Template(rf, ctx) { if (rf & 1) {
|
|
123
123
|
i0.ɵɵprojectionDef(_c1);
|
|
124
124
|
i0.ɵɵprojection(0);
|
|
125
125
|
i0.ɵɵelementStart(1, "td", 1, 0);
|
|
@@ -143,6 +143,7 @@ export class RowWithActions {
|
|
|
143
143
|
args: [{
|
|
144
144
|
selector: 'tr[mol-row-with-actions]',
|
|
145
145
|
standalone: true,
|
|
146
|
+
hostDirectives: [MolPlacement],
|
|
146
147
|
imports: [NgTemplateOutlet],
|
|
147
148
|
inputs: ['actions', 'onClick', 'selected', 'className'],
|
|
148
149
|
host: {
|
|
@@ -159,9 +160,9 @@ export class RowWithActions {
|
|
|
159
160
|
{{ actionsText() }}
|
|
160
161
|
</td>`,
|
|
161
162
|
}]
|
|
162
|
-
}],
|
|
163
|
+
}], () => [], { actionsCell: [{
|
|
163
164
|
type: ViewChild,
|
|
164
165
|
args: ['actionsCell']
|
|
165
166
|
}] }); })();
|
|
166
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RowWithActions, { className: "RowWithActions", filePath: "row-with-actions.component.ts", lineNumber:
|
|
167
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RowWithActions, { className: "RowWithActions", filePath: "row-with-actions.component.ts", lineNumber: 54 }); })();
|
|
167
168
|
//# sourceMappingURL=row-with-actions.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-with-actions.component.js","sourceRoot":"","sources":["../src/row-with-actions.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"row-with-actions.component.js","sourceRoot":"","sources":["../src/row-with-actions.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EA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,EAAE,kBAAkB;iBAC9B;gBACD,QAAQ,EAAE;;;;;;;UAOF;aACT;;kBAYE,SAAS;mBAAC,aAAa;;kFAXb,cAAc"}
|
package/dist/slot-dom.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* detection
|
|
4
|
-
* template element in the DOM exactly while React renders it.
|
|
2
|
+
* Node-prop helpers shared by the Angular data-table components: node-prop
|
|
3
|
+
* detection and text rendering.
|
|
5
4
|
*
|
|
6
5
|
* @module
|
|
7
6
|
*/
|
|
8
|
-
import type {
|
|
7
|
+
import type { TemplateRef } from '@angular/core';
|
|
9
8
|
/**
|
|
10
9
|
* Whether a node-valued prop is an Angular template (a projected node) rather
|
|
11
10
|
* than plain text. Checked structurally — `TemplateRef` is a type-only import
|
|
@@ -29,39 +28,4 @@ export declare const templateOf: (value: unknown) => TemplateRef<unknown> | null
|
|
|
29
28
|
* @returns The text to render, or `''` when there is nothing.
|
|
30
29
|
*/
|
|
31
30
|
export declare const textOf: (value: unknown) => string;
|
|
32
|
-
/**
|
|
33
|
-
* Whether an element holds anything that renders (projected content or text),
|
|
34
|
-
* ignoring the template's own whitespace and Angular's anchor comments.
|
|
35
|
-
*
|
|
36
|
-
* @param el - The element, or undefined before the view resolves.
|
|
37
|
-
* @returns True when the element renders content.
|
|
38
|
-
*/
|
|
39
|
-
export declare const hasContent: (el: Element | undefined | null) => boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Keeps one template element in the DOM exactly while React renders it.
|
|
42
|
-
*
|
|
43
|
-
* React renders a wrapper element only when its content exists (the title row
|
|
44
|
-
* when there is a title or an action, the actions cell when there are actions).
|
|
45
|
-
* Angular has no way to select projected content, so each wrapper stays in the
|
|
46
|
-
* template and this helper detaches it — projected content travels with it —
|
|
47
|
-
* while React renders nothing, restoring it at the same position when content
|
|
48
|
-
* appears.
|
|
49
|
-
*/
|
|
50
|
-
export declare class ConditionalElement {
|
|
51
|
-
private readonly renderer;
|
|
52
|
-
private readonly detached;
|
|
53
|
-
/**
|
|
54
|
-
* Creates the helper.
|
|
55
|
-
*
|
|
56
|
-
* @param renderer - The DOM renderer.
|
|
57
|
-
*/
|
|
58
|
-
constructor(renderer: Renderer2);
|
|
59
|
-
/**
|
|
60
|
-
* Shows or withholds one element.
|
|
61
|
-
*
|
|
62
|
-
* @param el - The element (undefined before the view resolves).
|
|
63
|
-
* @param shouldShow - Whether React renders it.
|
|
64
|
-
*/
|
|
65
|
-
sync(el: Element | undefined | null, shouldShow: boolean): void;
|
|
66
|
-
}
|
|
67
31
|
//# sourceMappingURL=slot-dom.d.ts.map
|
package/dist/slot-dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-dom.d.ts","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"slot-dom.d.ts","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAGE,CAAA;AAE1E;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,WAAW,CAAC,OAAO,CAAC,GAAG,IACjC,CAAA;AAElC;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,KAAG,MACoB,CAAA"}
|
package/dist/slot-dom.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* detection
|
|
4
|
-
* template element in the DOM exactly while React renders it.
|
|
2
|
+
* Node-prop helpers shared by the Angular data-table components: node-prop
|
|
3
|
+
* detection and text rendering.
|
|
5
4
|
*
|
|
6
5
|
* @module
|
|
7
6
|
*/
|
|
@@ -30,65 +29,4 @@ export const templateOf = (value) => isTemplate(value) ? value : null;
|
|
|
30
29
|
* @returns The text to render, or `''` when there is nothing.
|
|
31
30
|
*/
|
|
32
31
|
export const textOf = (value) => value === null || value === undefined ? '' : String(value);
|
|
33
|
-
/**
|
|
34
|
-
* Whether an element holds anything that renders (projected content or text),
|
|
35
|
-
* ignoring the template's own whitespace and Angular's anchor comments.
|
|
36
|
-
*
|
|
37
|
-
* @param el - The element, or undefined before the view resolves.
|
|
38
|
-
* @returns True when the element renders content.
|
|
39
|
-
*/
|
|
40
|
-
export const hasContent = (el) => {
|
|
41
|
-
if (!el)
|
|
42
|
-
return false;
|
|
43
|
-
return Array.from(el.childNodes).some((node) => node.nodeType === Node.ELEMENT_NODE ||
|
|
44
|
-
((node.nodeType === Node.TEXT_NODE || node.nodeType === Node.CDATA_SECTION_NODE) &&
|
|
45
|
-
(node.textContent ?? '').trim() !== ''));
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Keeps one template element in the DOM exactly while React renders it.
|
|
49
|
-
*
|
|
50
|
-
* React renders a wrapper element only when its content exists (the title row
|
|
51
|
-
* when there is a title or an action, the actions cell when there are actions).
|
|
52
|
-
* Angular has no way to select projected content, so each wrapper stays in the
|
|
53
|
-
* template and this helper detaches it — projected content travels with it —
|
|
54
|
-
* while React renders nothing, restoring it at the same position when content
|
|
55
|
-
* appears.
|
|
56
|
-
*/
|
|
57
|
-
export class ConditionalElement {
|
|
58
|
-
renderer;
|
|
59
|
-
detached = new Map();
|
|
60
|
-
/**
|
|
61
|
-
* Creates the helper.
|
|
62
|
-
*
|
|
63
|
-
* @param renderer - The DOM renderer.
|
|
64
|
-
*/
|
|
65
|
-
constructor(renderer) {
|
|
66
|
-
this.renderer = renderer;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Shows or withholds one element.
|
|
70
|
-
*
|
|
71
|
-
* @param el - The element (undefined before the view resolves).
|
|
72
|
-
* @param shouldShow - Whether React renders it.
|
|
73
|
-
*/
|
|
74
|
-
sync(el, shouldShow) {
|
|
75
|
-
if (!el)
|
|
76
|
-
return;
|
|
77
|
-
if (shouldShow) {
|
|
78
|
-
const at = this.detached.get(el);
|
|
79
|
-
if (!at)
|
|
80
|
-
return;
|
|
81
|
-
at.parent.insertBefore(el, at.anchor);
|
|
82
|
-
this.detached.delete(el);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (!el.isConnected)
|
|
86
|
-
return;
|
|
87
|
-
const parent = el.parentNode;
|
|
88
|
-
if (!parent)
|
|
89
|
-
return;
|
|
90
|
-
this.detached.set(el, { parent, anchor: el.nextSibling });
|
|
91
|
-
this.renderer.removeChild(parent, el);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
32
|
//# sourceMappingURL=slot-dom.js.map
|
package/dist/slot-dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-dom.js","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"slot-dom.js","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAiC,EAAE,CAC1E,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,OAAQ,KAA8B,CAAC,kBAAkB,KAAK,UAAU,CAAA;AAE1E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAA+B,EAAE,CACxE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;AAElC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAc,EAAU,EAAE,CAC/C,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-data-table-ui-angular",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Card data table + table chrome primitives (toolbar, footer, row-with-actions, empty row) — standalone, renders its own table elements",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-data-table-ui-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@angular/common": "^22.0.0",
|
|
46
46
|
"@angular/core": "^22.0.0",
|
|
47
47
|
"@angular/platform-browser": "^22.0.0",
|
|
48
|
-
"@molecule/app-angular": "^3.
|
|
48
|
+
"@molecule/app-angular": "^3.13.0",
|
|
49
49
|
"@molecule/app-ui": "^1.3.11",
|
|
50
50
|
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
51
|
},
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"@angular/compiler-cli": "22.2.3",
|
|
56
56
|
"@angular/core": "22.2.3",
|
|
57
57
|
"@angular/platform-browser": "22.2.3",
|
|
58
|
-
"@molecule/app-angular": "3.
|
|
58
|
+
"@molecule/app-angular": "3.13.0",
|
|
59
59
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
60
|
"@molecule/app-i18n": "1.2.2",
|
|
61
61
|
"@molecule/app-icons": "1.0.4",
|
|
62
|
-
"@molecule/app-ui": "1.
|
|
63
|
-
"@molecule/app-ui-angular": "1.
|
|
62
|
+
"@molecule/app-ui": "1.5.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.5.1",
|
|
64
64
|
"@types/node": "26.6.5",
|
|
65
|
-
"jsdom": "
|
|
65
|
+
"jsdom": "31.0.1",
|
|
66
66
|
"rxjs": "7.8.2",
|
|
67
67
|
"typescript": "6.0.3",
|
|
68
68
|
"vitest": "4.1.12",
|