@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/dist/index.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular data-table UI primitives (standalone — they render plain table
|
|
3
|
+
* elements and do not require a table component from a UI package).
|
|
4
|
+
*
|
|
5
|
+
* Exports:
|
|
6
|
+
* - `<DataTableCard>` — full polished-pattern data table (card wrapper +
|
|
7
|
+
* title + uppercase headers + divided rows + loading skeleton + empty
|
|
8
|
+
* state). Drop-in for the most common dashboard CRUD use case.
|
|
9
|
+
* - `<TableToolbar>` — top chrome with left/right slots + optional filter row.
|
|
10
|
+
* - `<TableEmpty>` — single full-width "no rows" cell for hand-rolled tables.
|
|
11
|
+
* - `<TableFooter>` — bottom bar (left summary + right pagination).
|
|
12
|
+
* - `<RowWithActions>` — `<tr>` wrapper with trailing actions cell and click handler.
|
|
13
|
+
*
|
|
14
|
+
* Use `DataTableCard` for new screens; use the row-level primitives to compose
|
|
15
|
+
* richer custom tables (group-by, expandable rows, etc.).
|
|
16
|
+
*
|
|
17
|
+
* This package is the Angular counterpart of `@molecule/app-data-table-ui-react`:
|
|
18
|
+
* the same export names, the same props (React's prop names), and the same DOM
|
|
19
|
+
* for the same input, so an app swaps framework by changing only the package
|
|
20
|
+
* name in its imports. Each component's host element IS React's root element
|
|
21
|
+
* (`section[mol-data-table-card]`, `tr[mol-row-with-actions]`, …). Node props
|
|
22
|
+
* are projected content (`[slot=<name>]`), a `TemplateRef`, or text.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { Component } from '@angular/core'
|
|
27
|
+
* import { DataTableCard } from '@molecule/app-data-table-ui-angular'
|
|
28
|
+
*
|
|
29
|
+
* interface Row {
|
|
30
|
+
* id: string
|
|
31
|
+
* name: string
|
|
32
|
+
* email: string
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* @Component({
|
|
36
|
+
* selector: 'app-members-table',
|
|
37
|
+
* standalone: true,
|
|
38
|
+
* imports: [DataTableCard],
|
|
39
|
+
* template: `
|
|
40
|
+
* <ng-template #nameCell let-row>
|
|
41
|
+
* <span>{{ row.name }}</span>
|
|
42
|
+
* </ng-template>
|
|
43
|
+
* <ng-template #emailCell let-row>
|
|
44
|
+
* <span>{{ row.email }}</span>
|
|
45
|
+
* </ng-template>
|
|
46
|
+
*
|
|
47
|
+
* <section mol-data-table-card
|
|
48
|
+
* [title]="'Team members'"
|
|
49
|
+
* [columns]="columns"
|
|
50
|
+
* [rows]="members"
|
|
51
|
+
* [rowKey]="rowKey"
|
|
52
|
+
* [onRowClick]="open"
|
|
53
|
+
* [emptyMessage]="'No members yet.'">
|
|
54
|
+
* </section>
|
|
55
|
+
* `,
|
|
56
|
+
* })
|
|
57
|
+
* export class MembersTable {
|
|
58
|
+
* members: Row[] = []
|
|
59
|
+
* rowKey = (row: Row): string => row.id
|
|
60
|
+
* open = (row: Row): void => {
|
|
61
|
+
* // navigate to the member…
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* All text (`title`, column `header`s, `emptyMessage`) is consumer-provided —
|
|
68
|
+
* pass translated strings; there is no built-in copy and no locale bond.
|
|
69
|
+
* `DataTableCard`'s chrome uses Tailwind classes with Material-3 theme tokens
|
|
70
|
+
* (`bg-surface-container-lowest`, `divide-surface-container`,
|
|
71
|
+
* `text-on-surface-variant`, …) — the app's Tailwind theme must define those
|
|
72
|
+
* tokens (molecule's default Tailwind ClassMap bond does); with a non-Tailwind
|
|
73
|
+
* ClassMap the card surface, dividers, and skeleton styling drop out.
|
|
74
|
+
* `onRowClick` makes rows pointer-clickable only — add your own keyboard path
|
|
75
|
+
* (e.g. a link/button in a cell) where accessibility matters.
|
|
76
|
+
*
|
|
77
|
+
* Rows are keyed by `rowKey(row)` (React's `key={rowKey(row)}`), so a row keeps
|
|
78
|
+
* its DOM node while its key is unchanged.
|
|
79
|
+
*
|
|
80
|
+
* @module
|
|
81
|
+
*/
|
|
82
|
+
export * from './data-table-card.component.js';
|
|
83
|
+
export * from './row-with-actions.component.js';
|
|
84
|
+
export * from './table-empty.component.js';
|
|
85
|
+
export * from './table-footer.component.js';
|
|
86
|
+
export * from './table-toolbar.component.js';
|
|
87
|
+
export * from './types.js';
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;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"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type AfterViewInit, type DoCheck, type TemplateRef } from '@angular/core';
|
|
2
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* RowWithActions component.
|
|
6
|
+
*
|
|
7
|
+
* `<tr>` wrapper that adds a trailing actions cell plus a click handler on the
|
|
8
|
+
* body — the Angular counterpart of `@molecule/app-data-table-ui-react`'s
|
|
9
|
+
* `RowWithActions`: the same props (React names), the same ClassMap tokens, and
|
|
10
|
+
* the same DOM for the same input. The host IS the `<tr>`
|
|
11
|
+
* (`tr[mol-row-with-actions]`), matching React's root exactly.
|
|
12
|
+
*
|
|
13
|
+
* The row cells are the element's default projected content; `actions` is
|
|
14
|
+
* `[slot=actions]` content, a `TemplateRef`, or text. A click inside the actions
|
|
15
|
+
* cell does not reach the row's handler (React's `stopPropagation`).
|
|
16
|
+
*/
|
|
17
|
+
export declare class RowWithActions implements AfterViewInit, DoCheck {
|
|
18
|
+
/** Action buttons/menu for the trailing cell (a `TemplateRef` or `[slot=actions]` content). */
|
|
19
|
+
actions?: unknown;
|
|
20
|
+
/** Called when the row body is clicked, with the click event. */
|
|
21
|
+
onClick?: (event: MouseEvent) => void;
|
|
22
|
+
/** Whether the row renders in a "selected" visual state. */
|
|
23
|
+
selected?: boolean;
|
|
24
|
+
/** Extra classes on the `<tr>`. */
|
|
25
|
+
className?: string;
|
|
26
|
+
/** The trailing actions cell, detached while React renders none. */
|
|
27
|
+
private actionsCell?;
|
|
28
|
+
private readonly renderer;
|
|
29
|
+
private readonly conditional;
|
|
30
|
+
/**
|
|
31
|
+
* The current class map.
|
|
32
|
+
* @returns The UIClassMap.
|
|
33
|
+
*/
|
|
34
|
+
cm(): UIClassMap;
|
|
35
|
+
/**
|
|
36
|
+
* The row's class list: React adds `cursor-pointer` only when the row is
|
|
37
|
+
* clickable, then the caller's classes.
|
|
38
|
+
* @returns The class string.
|
|
39
|
+
*/
|
|
40
|
+
classes(): string;
|
|
41
|
+
/**
|
|
42
|
+
* The actions cell's class list (`text-center`).
|
|
43
|
+
* @returns The class string.
|
|
44
|
+
*/
|
|
45
|
+
actionsCellClasses(): string;
|
|
46
|
+
/**
|
|
47
|
+
* The actions' text (React's `{actions}` for text).
|
|
48
|
+
* @returns The text, or `''` for a node actions slot.
|
|
49
|
+
*/
|
|
50
|
+
actionsText(): string;
|
|
51
|
+
/**
|
|
52
|
+
* The actions' template, when the caller passed a node.
|
|
53
|
+
* @returns The template, or null.
|
|
54
|
+
*/
|
|
55
|
+
actionsTemplate(): TemplateRef<unknown> | null;
|
|
56
|
+
/**
|
|
57
|
+
* Runs the row's click handler the way React's `onClick` does.
|
|
58
|
+
* @param event - The native click event.
|
|
59
|
+
*/
|
|
60
|
+
runClick(event: MouseEvent): void;
|
|
61
|
+
/**
|
|
62
|
+
* Stops a click inside the actions cell from reaching the row (React's
|
|
63
|
+
* `onClick={(e) => e.stopPropagation()}`).
|
|
64
|
+
* @param event - The native click event.
|
|
65
|
+
*/
|
|
66
|
+
stopClick(event: MouseEvent): void;
|
|
67
|
+
/** Reconciles the actions cell once the view (and its projected content) exists. */
|
|
68
|
+
ngAfterViewInit(): void;
|
|
69
|
+
/** Re-reconciles the actions cell after input writes. */
|
|
70
|
+
ngDoCheck(): void;
|
|
71
|
+
/** Keeps the actions cell in the DOM exactly while React renders it. */
|
|
72
|
+
private syncActions;
|
|
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, never>;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=row-with-actions.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-with-actions.component.d.ts","sourceRoot":"","sources":["../src/row-with-actions.component.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EAIZ,KAAK,WAAW,EAEjB,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAKlD;;;;;;;;;;;;GAYG;AACH,qBAmBa,cAAe,YAAW,aAAa,EAAE,OAAO;IAC3D,+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;IAEvE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwC;IAEpE;;;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,oFAAoF;IACpF,eAAe,IAAI,IAAI;IAIvB,yDAAyD;IACzD,SAAS,IAAI,IAAI;IAIjB,wEAAwE;IACxE,OAAO,CAAC,WAAW;yCAvFR,cAAc;2CAAd,cAAc;CA2F1B"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RowWithActions component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, inject, Renderer2, ViewChild, } from '@angular/core';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
import { ConditionalElement, hasContent, templateOf, textOf } from './slot-dom.js';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
const _c0 = ["actionsCell"];
|
|
12
|
+
const _c1 = ["*", [["", "slot", "actions"]]];
|
|
13
|
+
const _c2 = ["*", "[slot=actions]"];
|
|
14
|
+
function RowWithActions_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
15
|
+
i0.ɵɵelementContainer(0, 2);
|
|
16
|
+
} if (rf & 2) {
|
|
17
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
18
|
+
} }
|
|
19
|
+
/**
|
|
20
|
+
* RowWithActions component.
|
|
21
|
+
*
|
|
22
|
+
* `<tr>` wrapper that adds a trailing actions cell plus a click handler on the
|
|
23
|
+
* body — the Angular counterpart of `@molecule/app-data-table-ui-react`'s
|
|
24
|
+
* `RowWithActions`: the same props (React names), the same ClassMap tokens, and
|
|
25
|
+
* the same DOM for the same input. The host IS the `<tr>`
|
|
26
|
+
* (`tr[mol-row-with-actions]`), matching React's root exactly.
|
|
27
|
+
*
|
|
28
|
+
* The row cells are the element's default projected content; `actions` is
|
|
29
|
+
* `[slot=actions]` content, a `TemplateRef`, or text. A click inside the actions
|
|
30
|
+
* cell does not reach the row's handler (React's `stopPropagation`).
|
|
31
|
+
*/
|
|
32
|
+
export class RowWithActions {
|
|
33
|
+
/** Action buttons/menu for the trailing cell (a `TemplateRef` or `[slot=actions]` content). */
|
|
34
|
+
actions;
|
|
35
|
+
/** Called when the row body is clicked, with the click event. */
|
|
36
|
+
onClick;
|
|
37
|
+
/** Whether the row renders in a "selected" visual state. */
|
|
38
|
+
selected;
|
|
39
|
+
/** Extra classes on the `<tr>`. */
|
|
40
|
+
className;
|
|
41
|
+
/** The trailing actions cell, detached while React renders none. */
|
|
42
|
+
actionsCell;
|
|
43
|
+
renderer = inject(Renderer2);
|
|
44
|
+
conditional = new ConditionalElement(this.renderer);
|
|
45
|
+
/**
|
|
46
|
+
* The current class map.
|
|
47
|
+
* @returns The UIClassMap.
|
|
48
|
+
*/
|
|
49
|
+
cm() {
|
|
50
|
+
return getClassMap();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The row's class list: React adds `cursor-pointer` only when the row is
|
|
54
|
+
* clickable, then the caller's classes.
|
|
55
|
+
* @returns The class string.
|
|
56
|
+
*/
|
|
57
|
+
classes() {
|
|
58
|
+
return this.cm().cn(this.onClick ? this.cm().cursorPointer : undefined, this.className);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The actions cell's class list (`text-center`).
|
|
62
|
+
* @returns The class string.
|
|
63
|
+
*/
|
|
64
|
+
actionsCellClasses() {
|
|
65
|
+
return this.cm().cn(this.cm().textCenter);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The actions' text (React's `{actions}` for text).
|
|
69
|
+
* @returns The text, or `''` for a node actions slot.
|
|
70
|
+
*/
|
|
71
|
+
actionsText() {
|
|
72
|
+
return typeof this.actions === 'string' || typeof this.actions === 'number'
|
|
73
|
+
? textOf(this.actions)
|
|
74
|
+
: '';
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The actions' template, when the caller passed a node.
|
|
78
|
+
* @returns The template, or null.
|
|
79
|
+
*/
|
|
80
|
+
actionsTemplate() {
|
|
81
|
+
return templateOf(this.actions);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Runs the row's click handler the way React's `onClick` does.
|
|
85
|
+
* @param event - The native click event.
|
|
86
|
+
*/
|
|
87
|
+
runClick(event) {
|
|
88
|
+
this.onClick?.(event);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Stops a click inside the actions cell from reaching the row (React's
|
|
92
|
+
* `onClick={(e) => e.stopPropagation()}`).
|
|
93
|
+
* @param event - The native click event.
|
|
94
|
+
*/
|
|
95
|
+
stopClick(event) {
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
}
|
|
98
|
+
/** Reconciles the actions cell once the view (and its projected content) exists. */
|
|
99
|
+
ngAfterViewInit() {
|
|
100
|
+
this.syncActions();
|
|
101
|
+
}
|
|
102
|
+
/** Re-reconciles the actions cell after input writes. */
|
|
103
|
+
ngDoCheck() {
|
|
104
|
+
this.syncActions();
|
|
105
|
+
}
|
|
106
|
+
/** Keeps the actions cell in the DOM exactly while React renders it. */
|
|
107
|
+
syncActions() {
|
|
108
|
+
const cell = this.actionsCell?.nativeElement;
|
|
109
|
+
this.conditional.sync(cell, this.actions !== undefined || hasContent(cell));
|
|
110
|
+
}
|
|
111
|
+
static ɵfac = function RowWithActions_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RowWithActions)(); };
|
|
112
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RowWithActions, selectors: [["tr", "mol-row-with-actions", ""]], viewQuery: function RowWithActions_Query(rf, ctx) { if (rf & 1) {
|
|
113
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
114
|
+
} if (rf & 2) {
|
|
115
|
+
let _t;
|
|
116
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.actionsCell = _t.first);
|
|
117
|
+
} }, hostVars: 3, hostBindings: function RowWithActions_HostBindings(rf, ctx) { if (rf & 1) {
|
|
118
|
+
i0.ɵɵlistener("click", function RowWithActions_click_HostBindingHandler($event) { return ctx.runClick($event); });
|
|
119
|
+
} if (rf & 2) {
|
|
120
|
+
i0.ɵɵattribute("aria-selected", ctx.selected ?? null);
|
|
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) {
|
|
123
|
+
i0.ɵɵprojectionDef(_c1);
|
|
124
|
+
i0.ɵɵprojection(0);
|
|
125
|
+
i0.ɵɵelementStart(1, "td", 1, 0);
|
|
126
|
+
i0.ɵɵlistener("click", function RowWithActions_Template_td_click_1_listener($event) { return ctx.stopClick($event); });
|
|
127
|
+
i0.ɵɵprojection(3, 1);
|
|
128
|
+
i0.ɵɵconditionalCreate(4, RowWithActions_Conditional_4_Template, 1, 1, "ng-container", 2);
|
|
129
|
+
i0.ɵɵtext(5);
|
|
130
|
+
i0.ɵɵelementEnd();
|
|
131
|
+
} if (rf & 2) {
|
|
132
|
+
let tmp_2_0;
|
|
133
|
+
i0.ɵɵadvance();
|
|
134
|
+
i0.ɵɵclassMap(ctx.actionsCellClasses());
|
|
135
|
+
i0.ɵɵadvance(3);
|
|
136
|
+
i0.ɵɵconditional((tmp_2_0 = ctx.actionsTemplate()) ? 4 : -1, tmp_2_0);
|
|
137
|
+
i0.ɵɵadvance();
|
|
138
|
+
i0.ɵɵtextInterpolate1(" ", ctx.actionsText(), " ");
|
|
139
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
140
|
+
}
|
|
141
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RowWithActions, [{
|
|
142
|
+
type: Component,
|
|
143
|
+
args: [{
|
|
144
|
+
selector: 'tr[mol-row-with-actions]',
|
|
145
|
+
standalone: true,
|
|
146
|
+
imports: [NgTemplateOutlet],
|
|
147
|
+
inputs: ['actions', 'onClick', 'selected', 'className'],
|
|
148
|
+
host: {
|
|
149
|
+
'[class]': 'classes()',
|
|
150
|
+
'[attr.aria-selected]': 'selected ?? null',
|
|
151
|
+
'(click)': 'runClick($event)',
|
|
152
|
+
},
|
|
153
|
+
template: `<ng-content></ng-content>
|
|
154
|
+
<td #actionsCell [class]="actionsCellClasses()" (click)="stopClick($event)">
|
|
155
|
+
<ng-content select="[slot=actions]"></ng-content>
|
|
156
|
+
@if (actionsTemplate(); as tpl) {
|
|
157
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
158
|
+
}
|
|
159
|
+
{{ actionsText() }}
|
|
160
|
+
</td>`,
|
|
161
|
+
}]
|
|
162
|
+
}], null, { actionsCell: [{
|
|
163
|
+
type: ViewChild,
|
|
164
|
+
args: ['actionsCell']
|
|
165
|
+
}] }); })();
|
|
166
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RowWithActions, { className: "RowWithActions", filePath: "row-with-actions.component.ts", lineNumber: 56 }); })();
|
|
167
|
+
//# sourceMappingURL=row-with-actions.component.js.map
|
|
@@ -0,0 +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,EAEL,SAAS,EAGT,MAAM,EACN,SAAS,EAET,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,kBAAkB,EAAE,UAAU,E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
+
/**
|
|
2
|
+
* DOM helpers shared by the Angular data-table components: node-prop
|
|
3
|
+
* detection, text rendering, projected-content presence, and keeping a
|
|
4
|
+
* template element in the DOM exactly while React renders it.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { Renderer2, TemplateRef } from '@angular/core';
|
|
9
|
+
/**
|
|
10
|
+
* Whether a node-valued prop is an Angular template (a projected node) rather
|
|
11
|
+
* than plain text. Checked structurally — `TemplateRef` is a type-only import
|
|
12
|
+
* in the emitted metadata, so `instanceof` is not dependable across bundles.
|
|
13
|
+
*
|
|
14
|
+
* @param value - The prop value.
|
|
15
|
+
* @returns True when it can be rendered with `ngTemplateOutlet`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isTemplate: (value: unknown) => value is TemplateRef<unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* The prop value as a template, when the caller passed a node.
|
|
20
|
+
*
|
|
21
|
+
* @param value - The prop value.
|
|
22
|
+
* @returns The template, or null for text or nothing.
|
|
23
|
+
*/
|
|
24
|
+
export declare const templateOf: (value: unknown) => TemplateRef<unknown> | null;
|
|
25
|
+
/**
|
|
26
|
+
* Renders a value the way React renders a node string.
|
|
27
|
+
*
|
|
28
|
+
* @param value - The prop value.
|
|
29
|
+
* @returns The text to render, or `''` when there is nothing.
|
|
30
|
+
*/
|
|
31
|
+
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
|
+
//# sourceMappingURL=slot-dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-dom.d.ts","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3D;;;;;;;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;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,IAAI,OAAO,GAAG,SAAS,GAAG,IAAI,KAAG,OAQ3D,CAAA;AAUD;;;;;;;;;GASG;AACH,qBAAa,kBAAkB;IAQjB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAPrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAE1D;;;;OAIG;gBAC0B,QAAQ,EAAE,SAAS;IAEhD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI;CAehE"}
|
package/dist/slot-dom.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM helpers shared by the Angular data-table components: node-prop
|
|
3
|
+
* detection, text rendering, projected-content presence, and keeping a
|
|
4
|
+
* template element in the DOM exactly while React renders it.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Whether a node-valued prop is an Angular template (a projected node) rather
|
|
10
|
+
* than plain text. Checked structurally — `TemplateRef` is a type-only import
|
|
11
|
+
* in the emitted metadata, so `instanceof` is not dependable across bundles.
|
|
12
|
+
*
|
|
13
|
+
* @param value - The prop value.
|
|
14
|
+
* @returns True when it can be rendered with `ngTemplateOutlet`.
|
|
15
|
+
*/
|
|
16
|
+
export const isTemplate = (value) => typeof value === 'object' &&
|
|
17
|
+
value !== null &&
|
|
18
|
+
typeof value.createEmbeddedView === 'function';
|
|
19
|
+
/**
|
|
20
|
+
* The prop value as a template, when the caller passed a node.
|
|
21
|
+
*
|
|
22
|
+
* @param value - The prop value.
|
|
23
|
+
* @returns The template, or null for text or nothing.
|
|
24
|
+
*/
|
|
25
|
+
export const templateOf = (value) => isTemplate(value) ? value : null;
|
|
26
|
+
/**
|
|
27
|
+
* Renders a value the way React renders a node string.
|
|
28
|
+
*
|
|
29
|
+
* @param value - The prop value.
|
|
30
|
+
* @returns The text to render, or `''` when there is nothing.
|
|
31
|
+
*/
|
|
32
|
+
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
|
+
//# sourceMappingURL=slot-dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-dom.js","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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;AAE5D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAA8B,EAAW,EAAE;IACpE,IAAI,CAAC,EAAE;QAAE,OAAO,KAAK,CAAA;IACrB,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,IAAI,CACnC,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,QA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import { type TemplateRef } from '@angular/core';
|
|
2
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* TableEmpty component.
|
|
6
|
+
*
|
|
7
|
+
* Single full-width row shown when a table has no data — the Angular
|
|
8
|
+
* counterpart of `@molecule/app-data-table-ui-react`'s `TableEmpty`: the same
|
|
9
|
+
* props (React names), the same ClassMap tokens, and the same DOM for the same
|
|
10
|
+
* input. The host IS the `<tr>` (`tr[mol-table-empty]`), matching React's root
|
|
11
|
+
* exactly; the empty state is the element's default projected content, a
|
|
12
|
+
* `TemplateRef`, or text.
|
|
13
|
+
*/
|
|
14
|
+
export declare class TableEmpty {
|
|
15
|
+
/** Number of columns to span. */
|
|
16
|
+
colSpan?: number;
|
|
17
|
+
/** Empty-state content as text (nodes are projected as default content). */
|
|
18
|
+
children?: unknown;
|
|
19
|
+
/** Extra classes on the cell. */
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The current class map.
|
|
23
|
+
* @returns The UIClassMap.
|
|
24
|
+
*/
|
|
25
|
+
cm(): UIClassMap;
|
|
26
|
+
/**
|
|
27
|
+
* The cell's class list (`py-10` + `text-center` + the caller's classes).
|
|
28
|
+
* @returns The class string.
|
|
29
|
+
*/
|
|
30
|
+
cellClasses(): string;
|
|
31
|
+
/**
|
|
32
|
+
* The content's text (React's `{children}` for text).
|
|
33
|
+
* @returns The text, or `''` for a node child.
|
|
34
|
+
*/
|
|
35
|
+
childText(): string;
|
|
36
|
+
/**
|
|
37
|
+
* The content's template, when the caller passed a node.
|
|
38
|
+
* @returns The template, or null.
|
|
39
|
+
*/
|
|
40
|
+
childTemplate(): TemplateRef<unknown> | null;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TableEmpty, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TableEmpty, "tr[mol-table-empty]", never, { "colSpan": { "alias": "colSpan"; "required": false; }; "children": { "alias": "children"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=table-empty.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-empty.component.d.ts","sourceRoot":"","sources":["../src/table-empty.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAKlD;;;;;;;;;GASG;AACH,qBAaa,UAAU;IACrB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,WAAW,IAAI,MAAM;IAIrB;;;OAGG;IACH,SAAS,IAAI,MAAM;IAMnB;;;OAGG;IACH,aAAa,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;yCAtCjC,UAAU;2CAAV,UAAU;CAyCtB"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TableEmpty component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component } from '@angular/core';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
import { templateOf, textOf } from './slot-dom.js';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
const _c0 = ["*"];
|
|
12
|
+
function TableEmpty_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
13
|
+
i0.ɵɵelementContainer(0, 0);
|
|
14
|
+
} if (rf & 2) {
|
|
15
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
16
|
+
} }
|
|
17
|
+
/**
|
|
18
|
+
* TableEmpty component.
|
|
19
|
+
*
|
|
20
|
+
* Single full-width row shown when a table has no data — the Angular
|
|
21
|
+
* counterpart of `@molecule/app-data-table-ui-react`'s `TableEmpty`: the same
|
|
22
|
+
* props (React names), the same ClassMap tokens, and the same DOM for the same
|
|
23
|
+
* input. The host IS the `<tr>` (`tr[mol-table-empty]`), matching React's root
|
|
24
|
+
* exactly; the empty state is the element's default projected content, a
|
|
25
|
+
* `TemplateRef`, or text.
|
|
26
|
+
*/
|
|
27
|
+
export class TableEmpty {
|
|
28
|
+
/** Number of columns to span. */
|
|
29
|
+
colSpan;
|
|
30
|
+
/** Empty-state content as text (nodes are projected as default content). */
|
|
31
|
+
children;
|
|
32
|
+
/** Extra classes on the cell. */
|
|
33
|
+
className;
|
|
34
|
+
/**
|
|
35
|
+
* The current class map.
|
|
36
|
+
* @returns The UIClassMap.
|
|
37
|
+
*/
|
|
38
|
+
cm() {
|
|
39
|
+
return getClassMap();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The cell's class list (`py-10` + `text-center` + the caller's classes).
|
|
43
|
+
* @returns The class string.
|
|
44
|
+
*/
|
|
45
|
+
cellClasses() {
|
|
46
|
+
return this.cm().cn(this.cm().sp('py', 10), this.cm().textCenter, this.className);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The content's text (React's `{children}` for text).
|
|
50
|
+
* @returns The text, or `''` for a node child.
|
|
51
|
+
*/
|
|
52
|
+
childText() {
|
|
53
|
+
return typeof this.children === 'string' || typeof this.children === 'number'
|
|
54
|
+
? textOf(this.children)
|
|
55
|
+
: '';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The content's template, when the caller passed a node.
|
|
59
|
+
* @returns The template, or null.
|
|
60
|
+
*/
|
|
61
|
+
childTemplate() {
|
|
62
|
+
return templateOf(this.children);
|
|
63
|
+
}
|
|
64
|
+
static ɵfac = function TableEmpty_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TableEmpty)(); };
|
|
65
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TableEmpty, selectors: [["tr", "mol-table-empty", ""]], inputs: { colSpan: "colSpan", children: "children", className: "className" }, ngContentSelectors: _c0, decls: 4, vars: 5, consts: [[3, "ngTemplateOutlet"]], template: function TableEmpty_Template(rf, ctx) { if (rf & 1) {
|
|
66
|
+
i0.ɵɵprojectionDef();
|
|
67
|
+
i0.ɵɵelementStart(0, "td");
|
|
68
|
+
i0.ɵɵprojection(1);
|
|
69
|
+
i0.ɵɵconditionalCreate(2, TableEmpty_Conditional_2_Template, 1, 1, "ng-container", 0);
|
|
70
|
+
i0.ɵɵtext(3);
|
|
71
|
+
i0.ɵɵelementEnd();
|
|
72
|
+
} if (rf & 2) {
|
|
73
|
+
let tmp_2_0;
|
|
74
|
+
i0.ɵɵclassMap(ctx.cellClasses());
|
|
75
|
+
i0.ɵɵattribute("colspan", ctx.colSpan ?? null);
|
|
76
|
+
i0.ɵɵadvance(2);
|
|
77
|
+
i0.ɵɵconditional((tmp_2_0 = ctx.childTemplate()) ? 2 : -1, tmp_2_0);
|
|
78
|
+
i0.ɵɵadvance();
|
|
79
|
+
i0.ɵɵtextInterpolate1(" ", ctx.childText(), " ");
|
|
80
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
81
|
+
}
|
|
82
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableEmpty, [{
|
|
83
|
+
type: Component,
|
|
84
|
+
args: [{
|
|
85
|
+
selector: 'tr[mol-table-empty]',
|
|
86
|
+
standalone: true,
|
|
87
|
+
imports: [NgTemplateOutlet],
|
|
88
|
+
inputs: ['colSpan', 'children', 'className'],
|
|
89
|
+
template: `<td [attr.colspan]="colSpan ?? null" [class]="cellClasses()">
|
|
90
|
+
<ng-content></ng-content>
|
|
91
|
+
@if (childTemplate(); as tpl) {
|
|
92
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
93
|
+
}
|
|
94
|
+
{{ childText() }}
|
|
95
|
+
</td>`,
|
|
96
|
+
}]
|
|
97
|
+
}], null, null); })();
|
|
98
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TableEmpty, { className: "TableEmpty", filePath: "table-empty.component.ts", lineNumber: 38 }); })();
|
|
99
|
+
//# sourceMappingURL=table-empty.component.js.map
|