@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
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataTableCard 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 = ["headerRow"];
|
|
12
|
+
const _c1 = ["titleHeading"];
|
|
13
|
+
const _c2 = [[["", "slot", "title"]], [["", "slot", "titleaction"]], [["", "slot", "emptymessage"]]];
|
|
14
|
+
const _c3 = ["[slot=title]", "[slot=titleAction]", "[slot=emptyMessage]"];
|
|
15
|
+
const _forTrack0 = ($index, $item) => $item.key;
|
|
16
|
+
function _forTrack1($index, $item) { /* @ts-ignore */
|
|
17
|
+
return this.trackKey($item); }
|
|
18
|
+
function DataTableCard_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
19
|
+
i0.ɵɵelementContainer(0, 2);
|
|
20
|
+
} if (rf & 2) {
|
|
21
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
22
|
+
} }
|
|
23
|
+
function DataTableCard_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
24
|
+
i0.ɵɵelementContainer(0, 2);
|
|
25
|
+
} if (rf & 2) {
|
|
26
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
27
|
+
} }
|
|
28
|
+
function DataTableCard_For_15_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
29
|
+
i0.ɵɵelementContainer(0, 2);
|
|
30
|
+
} if (rf & 2) {
|
|
31
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
32
|
+
} }
|
|
33
|
+
function DataTableCard_For_15_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
34
|
+
i0.ɵɵtext(0);
|
|
35
|
+
} if (rf & 2) {
|
|
36
|
+
const column_r1 = i0.ɵɵnextContext().$implicit;
|
|
37
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
38
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r1.headerText(column_r1), " ");
|
|
39
|
+
} }
|
|
40
|
+
function DataTableCard_For_15_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
i0.ɵɵelementStart(0, "th");
|
|
42
|
+
i0.ɵɵconditionalCreate(1, DataTableCard_For_15_Conditional_1_Template, 1, 1, "ng-container", 2)(2, DataTableCard_For_15_Conditional_2_Template, 1, 1);
|
|
43
|
+
i0.ɵɵelementEnd();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
let tmp_14_0;
|
|
46
|
+
const column_r1 = ctx.$implicit;
|
|
47
|
+
const ɵ$index_23_r3 = ctx.$index;
|
|
48
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
49
|
+
i0.ɵɵclassMap(ctx_r1.headerCellClasses(column_r1, ɵ$index_23_r3));
|
|
50
|
+
i0.ɵɵadvance();
|
|
51
|
+
i0.ɵɵconditional((tmp_14_0 = ctx_r1.headerTemplate(column_r1)) ? 1 : 2, tmp_14_0);
|
|
52
|
+
} }
|
|
53
|
+
function DataTableCard_Conditional_17_For_1_Template(rf, ctx) { if (rf & 1) {
|
|
54
|
+
i0.ɵɵelementStart(0, "tr", 4)(1, "td");
|
|
55
|
+
i0.ɵɵelement(2, "div");
|
|
56
|
+
i0.ɵɵelementEnd()();
|
|
57
|
+
} if (rf & 2) {
|
|
58
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
59
|
+
i0.ɵɵadvance();
|
|
60
|
+
i0.ɵɵclassMap(ctx_r1.skeletonCellClasses());
|
|
61
|
+
i0.ɵɵattribute("colspan", ctx_r1.columns.length);
|
|
62
|
+
i0.ɵɵadvance();
|
|
63
|
+
i0.ɵɵclassMap(ctx_r1.skeletonBarClasses());
|
|
64
|
+
} }
|
|
65
|
+
function DataTableCard_Conditional_17_Template(rf, ctx) { if (rf & 1) {
|
|
66
|
+
i0.ɵɵrepeaterCreate(0, DataTableCard_Conditional_17_For_1_Template, 3, 5, "tr", 4, i0.ɵɵrepeaterTrackByIdentity);
|
|
67
|
+
} if (rf & 2) {
|
|
68
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
69
|
+
i0.ɵɵrepeater(ctx_r1.skeletonIndexes);
|
|
70
|
+
} }
|
|
71
|
+
function DataTableCard_Conditional_18_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
72
|
+
i0.ɵɵelementContainer(0, 2);
|
|
73
|
+
} if (rf & 2) {
|
|
74
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
75
|
+
} }
|
|
76
|
+
function DataTableCard_Conditional_18_Template(rf, ctx) { if (rf & 1) {
|
|
77
|
+
i0.ɵɵelementStart(0, "tr")(1, "td");
|
|
78
|
+
i0.ɵɵprojection(2, 2);
|
|
79
|
+
i0.ɵɵconditionalCreate(3, DataTableCard_Conditional_18_Conditional_3_Template, 1, 1, "ng-container", 2);
|
|
80
|
+
i0.ɵɵtext(4);
|
|
81
|
+
i0.ɵɵelementEnd()();
|
|
82
|
+
} if (rf & 2) {
|
|
83
|
+
let tmp_5_0;
|
|
84
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
85
|
+
i0.ɵɵadvance();
|
|
86
|
+
i0.ɵɵclassMap(ctx_r1.emptyCellClasses());
|
|
87
|
+
i0.ɵɵattribute("colspan", ctx_r1.columns.length);
|
|
88
|
+
i0.ɵɵadvance(2);
|
|
89
|
+
i0.ɵɵconditional((tmp_5_0 = ctx_r1.emptyTemplate()) ? 3 : -1, tmp_5_0);
|
|
90
|
+
i0.ɵɵadvance();
|
|
91
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r1.emptyText(), " ");
|
|
92
|
+
} }
|
|
93
|
+
function DataTableCard_Conditional_19_For_1_For_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
94
|
+
i0.ɵɵelementContainer(0, 6);
|
|
95
|
+
} if (rf & 2) {
|
|
96
|
+
const row_r5 = i0.ɵɵnextContext(2).$implicit;
|
|
97
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
98
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx)("ngTemplateOutletContext", ctx_r1.rowContext(row_r5));
|
|
99
|
+
} }
|
|
100
|
+
function DataTableCard_Conditional_19_For_1_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
101
|
+
i0.ɵɵelementStart(0, "td");
|
|
102
|
+
i0.ɵɵconditionalCreate(1, DataTableCard_Conditional_19_For_1_For_2_Conditional_1_Template, 1, 2, "ng-container", 6);
|
|
103
|
+
i0.ɵɵelementEnd();
|
|
104
|
+
} if (rf & 2) {
|
|
105
|
+
let tmp_25_0;
|
|
106
|
+
const column_r6 = ctx.$implicit;
|
|
107
|
+
const ɵ$index_55_r7 = ctx.$index;
|
|
108
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
109
|
+
i0.ɵɵclassMap(ctx_r1.cellClasses(column_r6, ɵ$index_55_r7));
|
|
110
|
+
i0.ɵɵadvance();
|
|
111
|
+
i0.ɵɵconditional((tmp_25_0 = ctx_r1.cellTemplate(column_r6)) ? 1 : -1, tmp_25_0);
|
|
112
|
+
} }
|
|
113
|
+
function DataTableCard_Conditional_19_For_1_Template(rf, ctx) { if (rf & 1) {
|
|
114
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
115
|
+
i0.ɵɵelementStart(0, "tr", 5);
|
|
116
|
+
i0.ɵɵlistener("click", function DataTableCard_Conditional_19_For_1_Template_tr_click_0_listener() { const row_r5 = i0.ɵɵrestoreView(_r4).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.clickRow(row_r5)); });
|
|
117
|
+
i0.ɵɵrepeaterCreate(1, DataTableCard_Conditional_19_For_1_For_2_Template, 2, 3, "td", 3, _forTrack0);
|
|
118
|
+
i0.ɵɵelementEnd();
|
|
119
|
+
} if (rf & 2) {
|
|
120
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
121
|
+
i0.ɵɵclassMap(ctx_r1.rowClasses());
|
|
122
|
+
i0.ɵɵadvance();
|
|
123
|
+
i0.ɵɵrepeater(ctx_r1.columns);
|
|
124
|
+
} }
|
|
125
|
+
function DataTableCard_Conditional_19_Template(rf, ctx) { if (rf & 1) {
|
|
126
|
+
i0.ɵɵrepeaterCreate(0, DataTableCard_Conditional_19_For_1_Template, 3, 2, "tr", 3, _forTrack1, true);
|
|
127
|
+
} if (rf & 2) {
|
|
128
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
129
|
+
i0.ɵɵrepeater(ctx_r1.rows);
|
|
130
|
+
} }
|
|
131
|
+
/**
|
|
132
|
+
* DataTableCard component.
|
|
133
|
+
*
|
|
134
|
+
* Drop-in card-shaped data table matching the polished flagship pattern — the
|
|
135
|
+
* Angular counterpart of `@molecule/app-data-table-ui-react`'s
|
|
136
|
+
* `DataTableCard`: the same props (React names), the same ClassMap tokens, and
|
|
137
|
+
* the same DOM for the same input. The host IS the outer `<section>`
|
|
138
|
+
* (`section[mol-data-table-card]`), matching React's root exactly.
|
|
139
|
+
*
|
|
140
|
+
* Renders an optional title row (title + action), then a card-wrapped table
|
|
141
|
+
* with uppercase headers, divided rows, a 5-row loading skeleton and a single
|
|
142
|
+
* spanning empty cell. Rows are keyed by `rowKey(row)` (React's
|
|
143
|
+
* `key={rowKey(row)}`), so a row keeps its DOM node while its key is unchanged.
|
|
144
|
+
*
|
|
145
|
+
* Column `cell` templates receive the row as `$implicit` and `a0`; a column
|
|
146
|
+
* `header` may be text or a `TemplateRef`. Node props (`title`, `titleAction`,
|
|
147
|
+
* `emptyMessage`) may be `[slot=…]` content, a `TemplateRef`, or text.
|
|
148
|
+
*/
|
|
149
|
+
export class DataTableCard {
|
|
150
|
+
/** Optional title above the table chrome (text, a `TemplateRef`, or `[slot=title]` content). */
|
|
151
|
+
title;
|
|
152
|
+
/** Right-aligned action in the title row (a `TemplateRef` or `[slot=titleAction]` content). */
|
|
153
|
+
titleAction;
|
|
154
|
+
/** Column definitions. */
|
|
155
|
+
columns = [];
|
|
156
|
+
/** Rows to render. */
|
|
157
|
+
rows = [];
|
|
158
|
+
/** Pull a stable key from a row (React's `key={rowKey(row)}`). */
|
|
159
|
+
rowKey;
|
|
160
|
+
/** When true, renders 5 skeleton rows instead of `rows`. */
|
|
161
|
+
loading;
|
|
162
|
+
/** Optional click handler per row. */
|
|
163
|
+
onRowClick;
|
|
164
|
+
/** Empty-state content (text, a `TemplateRef`, or `[slot=emptyMessage]` content). */
|
|
165
|
+
emptyMessage;
|
|
166
|
+
/** Extra classes on the outer card. */
|
|
167
|
+
className;
|
|
168
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
169
|
+
dataMolId;
|
|
170
|
+
/** The index list of the five skeleton rows. */
|
|
171
|
+
skeletonIndexes = [0, 1, 2, 3, 4];
|
|
172
|
+
/** The title row wrapper, detached while React renders no title row. */
|
|
173
|
+
headerRow;
|
|
174
|
+
/** The `<h3>`, detached while React renders no title. */
|
|
175
|
+
titleHeading;
|
|
176
|
+
renderer = inject(Renderer2);
|
|
177
|
+
conditional = new ConditionalElement(this.renderer);
|
|
178
|
+
/**
|
|
179
|
+
* The current class map.
|
|
180
|
+
* @returns The UIClassMap.
|
|
181
|
+
*/
|
|
182
|
+
cm() {
|
|
183
|
+
return getClassMap();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The card's class list (React's `cm.cn(cm.stack(4), cm.dataTableCardShell, className)`).
|
|
187
|
+
* @returns The class string.
|
|
188
|
+
*/
|
|
189
|
+
classes() {
|
|
190
|
+
return this.cm().cn(this.cm().stack(4), this.cm().dataTableCardShell, this.className);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The title row's class list (`flex between/center` + `px-8` + `pt-8`).
|
|
194
|
+
* @returns The class string.
|
|
195
|
+
*/
|
|
196
|
+
headerRowClasses() {
|
|
197
|
+
return this.cm().cn(this.cm().flex({ justify: 'between', align: 'center' }), this.cm().sp('px', 8), this.cm().sp('pt', 8));
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The title's class list (`text-xl` + `bold` + the card title token).
|
|
201
|
+
* @returns The class string.
|
|
202
|
+
*/
|
|
203
|
+
titleClasses() {
|
|
204
|
+
return this.cm().cn(this.cm().textSize('xl'), this.cm().fontWeight('bold'), this.cm().dataTableCardTitle);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The scroller's class list (`overflow-x-auto`).
|
|
208
|
+
* @returns The class string.
|
|
209
|
+
*/
|
|
210
|
+
scrollerClasses() {
|
|
211
|
+
return this.cm().cn(this.cm().dataTableCardScroller);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The table's class list (`w-full` + the card table token).
|
|
215
|
+
* @returns The class string.
|
|
216
|
+
*/
|
|
217
|
+
tableClasses() {
|
|
218
|
+
return this.cm().cn(this.cm().w('full'), this.cm().dataTableCardTable);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The header row's class list (the card head token).
|
|
222
|
+
* @returns The class string.
|
|
223
|
+
*/
|
|
224
|
+
headClasses() {
|
|
225
|
+
return this.cm().cn(this.cm().dataTableCardHead);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* One header cell's class list (first column `px-8`, the rest `px-4`, plus
|
|
229
|
+
* the column's own classes).
|
|
230
|
+
* @param column - The column.
|
|
231
|
+
* @param index - The column's index.
|
|
232
|
+
* @returns The class string.
|
|
233
|
+
*/
|
|
234
|
+
headerCellClasses(column, index) {
|
|
235
|
+
return this.cm().cn(index === 0 ? this.cm().sp('px', 8) : this.cm().sp('px', 4), this.cm().sp('py', 4), this.cm().dataTableCardHeaderCell, column.headerClassName);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The body's class list (the card body token).
|
|
239
|
+
* @returns The class string.
|
|
240
|
+
*/
|
|
241
|
+
bodyClasses() {
|
|
242
|
+
return this.cm().cn(this.cm().dataTableCardBody);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* A skeleton cell's class list (`px-8` + `py-5`).
|
|
246
|
+
* @returns The class string.
|
|
247
|
+
*/
|
|
248
|
+
skeletonCellClasses() {
|
|
249
|
+
return this.cm().cn(this.cm().sp('px', 8), this.cm().sp('py', 5));
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* A skeleton bar's class list (`h-4` + the skeleton token).
|
|
253
|
+
* @returns The class string.
|
|
254
|
+
*/
|
|
255
|
+
skeletonBarClasses() {
|
|
256
|
+
return this.cm().cn(this.cm().h(4), this.cm().dataTableCardSkeletonBar);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The empty cell's class list (`px-8 py-12 text-center` + the empty token).
|
|
260
|
+
* @returns The class string.
|
|
261
|
+
*/
|
|
262
|
+
emptyCellClasses() {
|
|
263
|
+
return this.cm().cn(this.cm().sp('px', 8), this.cm().sp('py', 12), this.cm().textCenter, this.cm().dataTableCardEmptyCell);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* A body row's class list: React adds `cursor-pointer` only when the row is
|
|
267
|
+
* clickable, then the hover token.
|
|
268
|
+
* @returns The class string.
|
|
269
|
+
*/
|
|
270
|
+
rowClasses() {
|
|
271
|
+
return this.cm().cn(this.onRowClick ? this.cm().cursorPointer : '', this.cm().dataTableCardRowHover);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* One body cell's class list (first column `px-8`, the rest `px-4`, plus the
|
|
275
|
+
* column's own classes).
|
|
276
|
+
* @param column - The column.
|
|
277
|
+
* @param index - The column's index.
|
|
278
|
+
* @returns The class string.
|
|
279
|
+
*/
|
|
280
|
+
cellClasses(column, index) {
|
|
281
|
+
return this.cm().cn(index === 0 ? this.cm().sp('px', 8) : this.cm().sp('px', 4), this.cm().sp('py', 5), column.cellClassName);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The title's text (React's `{title}` for a text title).
|
|
285
|
+
* @returns The text, or `''` for a node title.
|
|
286
|
+
*/
|
|
287
|
+
titleText() {
|
|
288
|
+
return typeof this.title === 'string' || typeof this.title === 'number'
|
|
289
|
+
? textOf(this.title)
|
|
290
|
+
: '';
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* The title's template, when the caller passed a node.
|
|
294
|
+
* @returns The template, or null.
|
|
295
|
+
*/
|
|
296
|
+
titleTemplate() {
|
|
297
|
+
return templateOf(this.title);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The title action's text (React's `{titleAction}` for text).
|
|
301
|
+
* @returns The text, or `''` for a node action.
|
|
302
|
+
*/
|
|
303
|
+
titleActionText() {
|
|
304
|
+
return typeof this.titleAction === 'string' || typeof this.titleAction === 'number'
|
|
305
|
+
? textOf(this.titleAction)
|
|
306
|
+
: '';
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* The title action's template, when the caller passed a node.
|
|
310
|
+
* @returns The template, or null.
|
|
311
|
+
*/
|
|
312
|
+
titleActionTemplate() {
|
|
313
|
+
return templateOf(this.titleAction);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* The empty state's text (React's `{emptyMessage}` for text).
|
|
317
|
+
* @returns The text, or `''` for a node empty state.
|
|
318
|
+
*/
|
|
319
|
+
emptyText() {
|
|
320
|
+
return typeof this.emptyMessage === 'string' || typeof this.emptyMessage === 'number'
|
|
321
|
+
? textOf(this.emptyMessage)
|
|
322
|
+
: '';
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* The empty state's template, when the caller passed a node.
|
|
326
|
+
* @returns The template, or null.
|
|
327
|
+
*/
|
|
328
|
+
emptyTemplate() {
|
|
329
|
+
return templateOf(this.emptyMessage);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* One column's header template, when the caller passed a node.
|
|
333
|
+
* @param column - The column.
|
|
334
|
+
* @returns The template, or null for a text header.
|
|
335
|
+
*/
|
|
336
|
+
headerTemplate(column) {
|
|
337
|
+
return templateOf(column.header);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* One column's header text (React's `{col.header}` for a text header).
|
|
341
|
+
* @param column - The column.
|
|
342
|
+
* @returns The text, or `''` for a node header.
|
|
343
|
+
*/
|
|
344
|
+
headerText(column) {
|
|
345
|
+
return typeof column.header === 'string' || typeof column.header === 'number'
|
|
346
|
+
? textOf(column.header)
|
|
347
|
+
: '';
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* One column's cell template.
|
|
351
|
+
* @param column - The column.
|
|
352
|
+
* @returns The template, or null.
|
|
353
|
+
*/
|
|
354
|
+
cellTemplate(column) {
|
|
355
|
+
return templateOf(column.cell);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* The template context for one row: the row as `$implicit` and `a0`
|
|
359
|
+
* (React calls `cell(row)`).
|
|
360
|
+
* @param row - The row.
|
|
361
|
+
* @returns The template context.
|
|
362
|
+
*/
|
|
363
|
+
rowContext(row) {
|
|
364
|
+
return { $implicit: row, a0: row, a1: undefined };
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The key a row is tracked by (React's `key={rowKey(row)}`).
|
|
368
|
+
* @param row - The row.
|
|
369
|
+
* @returns The row's key.
|
|
370
|
+
*/
|
|
371
|
+
trackKey(row) {
|
|
372
|
+
return this.rowKey ? this.rowKey(row) : '';
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Runs the row's click handler the way React's `onClick` does.
|
|
376
|
+
* @param row - The clicked row.
|
|
377
|
+
*/
|
|
378
|
+
clickRow(row) {
|
|
379
|
+
this.onRowClick?.(row);
|
|
380
|
+
}
|
|
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
|
+
/**
|
|
390
|
+
* Keeps the title row and the `<h3>` in the DOM exactly while React renders
|
|
391
|
+
* them: the row when a title or a title action exists, the heading when a
|
|
392
|
+
* title exists.
|
|
393
|
+
*/
|
|
394
|
+
syncVisibility() {
|
|
395
|
+
const heading = this.titleHeading?.nativeElement;
|
|
396
|
+
const titleShown = this.title !== undefined || hasContent(heading);
|
|
397
|
+
this.conditional.sync(this.headerRow?.nativeElement, titleShown || this.hasTitleAction());
|
|
398
|
+
this.conditional.sync(heading, titleShown);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Whether React renders a title action: the prop, or `[slot=titleAction]`
|
|
402
|
+
* content beside the heading.
|
|
403
|
+
* @returns True when an action renders.
|
|
404
|
+
*/
|
|
405
|
+
hasTitleAction() {
|
|
406
|
+
if (this.titleAction !== undefined)
|
|
407
|
+
return true;
|
|
408
|
+
const row = this.headerRow?.nativeElement;
|
|
409
|
+
if (!row)
|
|
410
|
+
return false;
|
|
411
|
+
const heading = this.titleHeading?.nativeElement;
|
|
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() !== '')));
|
|
415
|
+
}
|
|
416
|
+
static ɵfac = function DataTableCard_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DataTableCard)(); };
|
|
417
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DataTableCard, selectors: [["section", "mol-data-table-card", ""]], viewQuery: function DataTableCard_Query(rf, ctx) { if (rf & 1) {
|
|
418
|
+
i0.ɵɵviewQuery(_c0, 5)(_c1, 5);
|
|
419
|
+
} if (rf & 2) {
|
|
420
|
+
let _t;
|
|
421
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.headerRow = _t.first);
|
|
422
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.titleHeading = _t.first);
|
|
423
|
+
} }, hostVars: 3, hostBindings: function DataTableCard_HostBindings(rf, ctx) { if (rf & 2) {
|
|
424
|
+
i0.ɵɵattribute("data-mol-id", ctx.dataMolId ?? null);
|
|
425
|
+
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) {
|
|
427
|
+
i0.ɵɵprojectionDef(_c2);
|
|
428
|
+
i0.ɵɵelementStart(0, "div", null, 0)(2, "h3", null, 1);
|
|
429
|
+
i0.ɵɵtext(4);
|
|
430
|
+
i0.ɵɵprojection(5);
|
|
431
|
+
i0.ɵɵconditionalCreate(6, DataTableCard_Conditional_6_Template, 1, 1, "ng-container", 2);
|
|
432
|
+
i0.ɵɵelementEnd();
|
|
433
|
+
i0.ɵɵprojection(7, 1);
|
|
434
|
+
i0.ɵɵconditionalCreate(8, DataTableCard_Conditional_8_Template, 1, 1, "ng-container", 2);
|
|
435
|
+
i0.ɵɵtext(9);
|
|
436
|
+
i0.ɵɵelementEnd();
|
|
437
|
+
i0.ɵɵelementStart(10, "div")(11, "table")(12, "thead")(13, "tr");
|
|
438
|
+
i0.ɵɵrepeaterCreate(14, DataTableCard_For_15_Template, 3, 3, "th", 3, _forTrack0);
|
|
439
|
+
i0.ɵɵelementEnd()();
|
|
440
|
+
i0.ɵɵelementStart(16, "tbody");
|
|
441
|
+
i0.ɵɵconditionalCreate(17, DataTableCard_Conditional_17_Template, 2, 0)(18, DataTableCard_Conditional_18_Template, 5, 5, "tr")(19, DataTableCard_Conditional_19_Template, 2, 0);
|
|
442
|
+
i0.ɵɵelementEnd()()();
|
|
443
|
+
} if (rf & 2) {
|
|
444
|
+
let tmp_5_0;
|
|
445
|
+
let tmp_6_0;
|
|
446
|
+
i0.ɵɵclassMap(ctx.headerRowClasses());
|
|
447
|
+
i0.ɵɵadvance(2);
|
|
448
|
+
i0.ɵɵclassMap(ctx.titleClasses());
|
|
449
|
+
i0.ɵɵadvance(2);
|
|
450
|
+
i0.ɵɵtextInterpolate1(" ", ctx.titleText());
|
|
451
|
+
i0.ɵɵadvance(2);
|
|
452
|
+
i0.ɵɵconditional((tmp_5_0 = ctx.titleTemplate()) ? 6 : -1, tmp_5_0);
|
|
453
|
+
i0.ɵɵadvance(2);
|
|
454
|
+
i0.ɵɵconditional((tmp_6_0 = ctx.titleActionTemplate()) ? 8 : -1, tmp_6_0);
|
|
455
|
+
i0.ɵɵadvance();
|
|
456
|
+
i0.ɵɵtextInterpolate1(" ", ctx.titleActionText(), " ");
|
|
457
|
+
i0.ɵɵadvance();
|
|
458
|
+
i0.ɵɵclassMap(ctx.scrollerClasses());
|
|
459
|
+
i0.ɵɵadvance();
|
|
460
|
+
i0.ɵɵclassMap(ctx.tableClasses());
|
|
461
|
+
i0.ɵɵadvance(2);
|
|
462
|
+
i0.ɵɵclassMap(ctx.headClasses());
|
|
463
|
+
i0.ɵɵadvance();
|
|
464
|
+
i0.ɵɵrepeater(ctx.columns);
|
|
465
|
+
i0.ɵɵadvance(2);
|
|
466
|
+
i0.ɵɵclassMap(ctx.bodyClasses());
|
|
467
|
+
i0.ɵɵadvance();
|
|
468
|
+
i0.ɵɵconditional(ctx.loading ? 17 : ctx.rows.length === 0 ? 18 : 19);
|
|
469
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
470
|
+
}
|
|
471
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DataTableCard, [{
|
|
472
|
+
type: Component,
|
|
473
|
+
args: [{
|
|
474
|
+
selector: 'section[mol-data-table-card]',
|
|
475
|
+
standalone: true,
|
|
476
|
+
imports: [NgTemplateOutlet],
|
|
477
|
+
inputs: [
|
|
478
|
+
'title',
|
|
479
|
+
'titleAction',
|
|
480
|
+
'columns',
|
|
481
|
+
'rows',
|
|
482
|
+
'rowKey',
|
|
483
|
+
'loading',
|
|
484
|
+
'onRowClick',
|
|
485
|
+
'emptyMessage',
|
|
486
|
+
'className',
|
|
487
|
+
'dataMolId',
|
|
488
|
+
],
|
|
489
|
+
host: {
|
|
490
|
+
'[class]': 'classes()',
|
|
491
|
+
'[attr.data-mol-id]': 'dataMolId ?? null',
|
|
492
|
+
},
|
|
493
|
+
template: `<div #headerRow [class]="headerRowClasses()">
|
|
494
|
+
<h3 #titleHeading [class]="titleClasses()">
|
|
495
|
+
{{ titleText() }}<ng-content select="[slot=title]"></ng-content>
|
|
496
|
+
@if (titleTemplate(); as tpl) {
|
|
497
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
498
|
+
}
|
|
499
|
+
</h3>
|
|
500
|
+
<ng-content select="[slot=titleAction]"></ng-content>
|
|
501
|
+
@if (titleActionTemplate(); as tpl) {
|
|
502
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
503
|
+
}
|
|
504
|
+
{{ titleActionText() }}
|
|
505
|
+
</div>
|
|
506
|
+
<div [class]="scrollerClasses()">
|
|
507
|
+
<table [class]="tableClasses()">
|
|
508
|
+
<thead>
|
|
509
|
+
<tr [class]="headClasses()">
|
|
510
|
+
@for (column of columns; track column.key; let index = $index) {
|
|
511
|
+
<th [class]="headerCellClasses(column, index)">
|
|
512
|
+
@if (headerTemplate(column); as tpl) {
|
|
513
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
514
|
+
} @else {
|
|
515
|
+
{{ headerText(column) }}
|
|
516
|
+
}
|
|
517
|
+
</th>
|
|
518
|
+
}
|
|
519
|
+
</tr>
|
|
520
|
+
</thead>
|
|
521
|
+
<tbody [class]="bodyClasses()">
|
|
522
|
+
@if (loading) {
|
|
523
|
+
@for (index of skeletonIndexes; track index) {
|
|
524
|
+
<tr aria-hidden="true">
|
|
525
|
+
<td [attr.colspan]="columns.length" [class]="skeletonCellClasses()">
|
|
526
|
+
<div [class]="skeletonBarClasses()"></div>
|
|
527
|
+
</td>
|
|
528
|
+
</tr>
|
|
529
|
+
}
|
|
530
|
+
} @else if (rows.length === 0) {
|
|
531
|
+
<tr>
|
|
532
|
+
<td [attr.colspan]="columns.length" [class]="emptyCellClasses()">
|
|
533
|
+
<ng-content select="[slot=emptyMessage]"></ng-content>
|
|
534
|
+
@if (emptyTemplate(); as tpl) {
|
|
535
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
536
|
+
}
|
|
537
|
+
{{ emptyText() }}
|
|
538
|
+
</td>
|
|
539
|
+
</tr>
|
|
540
|
+
} @else {
|
|
541
|
+
@for (row of rows; track trackKey(row)) {
|
|
542
|
+
<tr (click)="clickRow(row)" [class]="rowClasses()">
|
|
543
|
+
@for (column of columns; track column.key; let index = $index) {
|
|
544
|
+
<td [class]="cellClasses(column, index)">
|
|
545
|
+
@if (cellTemplate(column); as tpl) {
|
|
546
|
+
<ng-container
|
|
547
|
+
[ngTemplateOutlet]="tpl"
|
|
548
|
+
[ngTemplateOutletContext]="rowContext(row)"
|
|
549
|
+
/>
|
|
550
|
+
}
|
|
551
|
+
</td>
|
|
552
|
+
}
|
|
553
|
+
</tr>
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
</tbody>
|
|
557
|
+
</table>
|
|
558
|
+
</div>`,
|
|
559
|
+
}]
|
|
560
|
+
}], null, { headerRow: [{
|
|
561
|
+
type: ViewChild,
|
|
562
|
+
args: ['headerRow']
|
|
563
|
+
}], titleHeading: [{
|
|
564
|
+
type: ViewChild,
|
|
565
|
+
args: ['titleHeading']
|
|
566
|
+
}] }); })();
|
|
567
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DataTableCard, { className: "DataTableCard", filePath: "data-table-card.component.ts", lineNumber: 130 }); })();
|
|
568
|
+
//# sourceMappingURL=data-table-card.component.js.map
|
|
@@ -0,0 +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,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,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;;;;;;;;OAyFtE,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;IACvC,mHAAoC;IAMtC,iBAAK;;;;;;IAPD,2DAAoC;IACtC,cAKC;IALD,gFAKC;;;;IARP,6BAAmD;IAA/C,8MAAS,uBAAa,KAAC;IACzB,oGASC;IACH,iBAAK;;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YACR,8BAA+B;YAmB3B,AAVA,AARF,uEAAe,uDAQiB,iDAUvB;YAkBf,AADE,AADE,iBAAQ,EACF,EACJ;;;;YAjEmB,qCAA4B;YACjC,eAAwB;YAAxB,iCAAwB;YACxC,eAAiB;YAAjB,2CAAiB;YACjB,eAEC;YAFD,mEAEC;YAGH,eAEC;YAFD,yEAEC;YACD,cACF;YADE,sDACF;YACK,cAA2B;YAA3B,oCAA2B;YACvB,cAAwB;YAAxB,iCAAwB;YAEvB,eAAuB;YAAvB,gCAAuB;YACzB,cAQC;YARD,0BAQC;YAGE,eAAuB;YAAvB,gCAAuB;YAC5B,cAiCC;YAjCD,oEAiCC;4BA/EC,gBAAgB;;iFAoFf,aAAa;cAvFzB,SAAS;eAAC;gBACT,QAAQ,EAAE,8BAA8B;gBACxC,UAAU,EAAE,IAAI;gBAChB,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
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.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","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"}
|