@molecule/app-audit-log-row-angular 0.0.0-stage → 0.0.1-stage
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 +342 -2
- package/dist/audit-log-row.component.d.ts +122 -0
- package/dist/audit-log-row.component.d.ts.map +1 -0
- package/dist/audit-log-row.component.js +436 -0
- package/dist/audit-log-row.component.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +70 -4
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AuditLogRow component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, Input, TemplateRef } from '@angular/core';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
function AuditLogRow_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
11
|
+
i0.ɵɵelementContainer(0, 0);
|
|
12
|
+
} if (rf & 2) {
|
|
13
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
14
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.entry.actor);
|
|
15
|
+
} }
|
|
16
|
+
function AuditLogRow_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
17
|
+
i0.ɵɵelementContainerStart(0);
|
|
18
|
+
i0.ɵɵtext(1);
|
|
19
|
+
i0.ɵɵelementContainerEnd();
|
|
20
|
+
} if (rf & 2) {
|
|
21
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
22
|
+
i0.ɵɵadvance();
|
|
23
|
+
i0.ɵɵtextInterpolate(ctx_r0.textOf(ctx_r0.entry.actor));
|
|
24
|
+
} }
|
|
25
|
+
function AuditLogRow_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
26
|
+
i0.ɵɵelementContainer(0, 0);
|
|
27
|
+
} if (rf & 2) {
|
|
28
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
29
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.entry.action);
|
|
30
|
+
} }
|
|
31
|
+
function AuditLogRow_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
32
|
+
i0.ɵɵelementContainerStart(0);
|
|
33
|
+
i0.ɵɵtext(1);
|
|
34
|
+
i0.ɵɵelementContainerEnd();
|
|
35
|
+
} if (rf & 2) {
|
|
36
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
37
|
+
i0.ɵɵadvance();
|
|
38
|
+
i0.ɵɵtextInterpolate(ctx_r0.textOf(ctx_r0.entry.action));
|
|
39
|
+
} }
|
|
40
|
+
function AuditLogRow_Conditional_10_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
i0.ɵɵelementContainer(0, 0);
|
|
42
|
+
} if (rf & 2) {
|
|
43
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
44
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.entry.target);
|
|
45
|
+
} }
|
|
46
|
+
function AuditLogRow_Conditional_10_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
47
|
+
i0.ɵɵelementContainerStart(0);
|
|
48
|
+
i0.ɵɵtext(1);
|
|
49
|
+
i0.ɵɵelementContainerEnd();
|
|
50
|
+
} if (rf & 2) {
|
|
51
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
52
|
+
i0.ɵɵadvance();
|
|
53
|
+
i0.ɵɵtextInterpolate(ctx_r0.textOf(ctx_r0.entry.target));
|
|
54
|
+
} }
|
|
55
|
+
function AuditLogRow_Conditional_10_Template(rf, ctx) { if (rf & 1) {
|
|
56
|
+
i0.ɵɵelementStart(0, "span");
|
|
57
|
+
i0.ɵɵconditionalCreate(1, AuditLogRow_Conditional_10_Conditional_1_Template, 1, 1, "ng-container", 0)(2, AuditLogRow_Conditional_10_Conditional_2_Template, 2, 1, "ng-container");
|
|
58
|
+
i0.ɵɵelementEnd();
|
|
59
|
+
} if (rf & 2) {
|
|
60
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
61
|
+
i0.ɵɵclassMap(ctx_r0.targetClasses());
|
|
62
|
+
i0.ɵɵadvance();
|
|
63
|
+
i0.ɵɵconditional(ctx_r0.isNode(ctx_r0.entry.target) ? 1 : 2);
|
|
64
|
+
} }
|
|
65
|
+
function AuditLogRow_Conditional_12_Template(rf, ctx) { if (rf & 1) {
|
|
66
|
+
i0.ɵɵtext(0, "\u00B7 ");
|
|
67
|
+
i0.ɵɵelementContainer(1, 0);
|
|
68
|
+
} if (rf & 2) {
|
|
69
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
70
|
+
i0.ɵɵadvance();
|
|
71
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.entry.timestamp);
|
|
72
|
+
} }
|
|
73
|
+
function AuditLogRow_Conditional_13_Template(rf, ctx) { if (rf & 1) {
|
|
74
|
+
i0.ɵɵtext(0);
|
|
75
|
+
} if (rf & 2) {
|
|
76
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
77
|
+
i0.ɵɵtextInterpolate("\u00B7 " + ctx_r0.textOf(ctx_r0.entry.timestamp));
|
|
78
|
+
} }
|
|
79
|
+
function AuditLogRow_Conditional_14_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
80
|
+
i0.ɵɵtext(0, "[");
|
|
81
|
+
i0.ɵɵelementContainer(1, 0);
|
|
82
|
+
i0.ɵɵtext(2, "]");
|
|
83
|
+
} if (rf & 2) {
|
|
84
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
85
|
+
i0.ɵɵadvance();
|
|
86
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.entry.environment);
|
|
87
|
+
} }
|
|
88
|
+
function AuditLogRow_Conditional_14_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
89
|
+
i0.ɵɵtext(0);
|
|
90
|
+
} if (rf & 2) {
|
|
91
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
92
|
+
i0.ɵɵtextInterpolate("[" + ctx_r0.textOf(ctx_r0.entry.environment) + "]");
|
|
93
|
+
} }
|
|
94
|
+
function AuditLogRow_Conditional_14_Template(rf, ctx) { if (rf & 1) {
|
|
95
|
+
i0.ɵɵelementStart(0, "span");
|
|
96
|
+
i0.ɵɵconditionalCreate(1, AuditLogRow_Conditional_14_Conditional_1_Template, 3, 1)(2, AuditLogRow_Conditional_14_Conditional_2_Template, 1, 1);
|
|
97
|
+
i0.ɵɵelementEnd();
|
|
98
|
+
} if (rf & 2) {
|
|
99
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
100
|
+
i0.ɵɵclassMap(ctx_r0.environmentClasses());
|
|
101
|
+
i0.ɵɵadvance();
|
|
102
|
+
i0.ɵɵconditional(ctx_r0.isNode(ctx_r0.entry.environment) ? 1 : 2);
|
|
103
|
+
} }
|
|
104
|
+
function AuditLogRow_Conditional_15_Conditional_1_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
105
|
+
i0.ɵɵelementContainer(0, 0);
|
|
106
|
+
} if (rf & 2) {
|
|
107
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
108
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.entry.oldValue);
|
|
109
|
+
} }
|
|
110
|
+
function AuditLogRow_Conditional_15_Conditional_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
111
|
+
i0.ɵɵelementContainerStart(0);
|
|
112
|
+
i0.ɵɵtext(1);
|
|
113
|
+
i0.ɵɵelementContainerEnd();
|
|
114
|
+
} if (rf & 2) {
|
|
115
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
116
|
+
i0.ɵɵadvance();
|
|
117
|
+
i0.ɵɵtextInterpolate(ctx_r0.textOf(ctx_r0.entry.oldValue));
|
|
118
|
+
} }
|
|
119
|
+
function AuditLogRow_Conditional_15_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
120
|
+
i0.ɵɵelementStart(0, "span");
|
|
121
|
+
i0.ɵɵconditionalCreate(1, AuditLogRow_Conditional_15_Conditional_1_Conditional_1_Template, 1, 1, "ng-container", 0)(2, AuditLogRow_Conditional_15_Conditional_1_Conditional_2_Template, 2, 1, "ng-container");
|
|
122
|
+
i0.ɵɵelementEnd();
|
|
123
|
+
} if (rf & 2) {
|
|
124
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
125
|
+
i0.ɵɵstyleProp("text-decoration", "line-through")("opacity", 0.7);
|
|
126
|
+
i0.ɵɵadvance();
|
|
127
|
+
i0.ɵɵconditional(ctx_r0.isNode(ctx_r0.entry.oldValue) ? 1 : 2);
|
|
128
|
+
} }
|
|
129
|
+
function AuditLogRow_Conditional_15_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
130
|
+
i0.ɵɵelementStart(0, "span", 3);
|
|
131
|
+
i0.ɵɵtext(1, "\u2192");
|
|
132
|
+
i0.ɵɵelementEnd();
|
|
133
|
+
} }
|
|
134
|
+
function AuditLogRow_Conditional_15_Conditional_3_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
135
|
+
i0.ɵɵelementContainer(0, 0);
|
|
136
|
+
} if (rf & 2) {
|
|
137
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
138
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.entry.newValue);
|
|
139
|
+
} }
|
|
140
|
+
function AuditLogRow_Conditional_15_Conditional_3_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
141
|
+
i0.ɵɵelementContainerStart(0);
|
|
142
|
+
i0.ɵɵtext(1);
|
|
143
|
+
i0.ɵɵelementContainerEnd();
|
|
144
|
+
} if (rf & 2) {
|
|
145
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
146
|
+
i0.ɵɵadvance();
|
|
147
|
+
i0.ɵɵtextInterpolate(ctx_r0.textOf(ctx_r0.entry.newValue));
|
|
148
|
+
} }
|
|
149
|
+
function AuditLogRow_Conditional_15_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
150
|
+
i0.ɵɵelementStart(0, "span");
|
|
151
|
+
i0.ɵɵconditionalCreate(1, AuditLogRow_Conditional_15_Conditional_3_Conditional_1_Template, 1, 1, "ng-container", 0)(2, AuditLogRow_Conditional_15_Conditional_3_Conditional_2_Template, 2, 1, "ng-container");
|
|
152
|
+
i0.ɵɵelementEnd();
|
|
153
|
+
} if (rf & 2) {
|
|
154
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
155
|
+
i0.ɵɵadvance();
|
|
156
|
+
i0.ɵɵconditional(ctx_r0.isNode(ctx_r0.entry.newValue) ? 1 : 2);
|
|
157
|
+
} }
|
|
158
|
+
function AuditLogRow_Conditional_15_Template(rf, ctx) { if (rf & 1) {
|
|
159
|
+
i0.ɵɵelementStart(0, "div");
|
|
160
|
+
i0.ɵɵconditionalCreate(1, AuditLogRow_Conditional_15_Conditional_1_Template, 3, 5, "span", 2);
|
|
161
|
+
i0.ɵɵconditionalCreate(2, AuditLogRow_Conditional_15_Conditional_2_Template, 2, 0, "span", 3);
|
|
162
|
+
i0.ɵɵconditionalCreate(3, AuditLogRow_Conditional_15_Conditional_3_Template, 3, 1, "span");
|
|
163
|
+
i0.ɵɵelementEnd();
|
|
164
|
+
} if (rf & 2) {
|
|
165
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
166
|
+
i0.ɵɵclassMap(ctx_r0.deltaClasses());
|
|
167
|
+
i0.ɵɵadvance();
|
|
168
|
+
i0.ɵɵconditional(ctx_r0.entry.oldValue !== undefined ? 1 : -1);
|
|
169
|
+
i0.ɵɵadvance();
|
|
170
|
+
i0.ɵɵconditional(ctx_r0.entry.oldValue !== undefined && ctx_r0.entry.newValue !== undefined ? 2 : -1);
|
|
171
|
+
i0.ɵɵadvance();
|
|
172
|
+
i0.ɵɵconditional(ctx_r0.entry.newValue !== undefined ? 3 : -1);
|
|
173
|
+
} }
|
|
174
|
+
function AuditLogRow_Conditional_16_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
175
|
+
i0.ɵɵelementContainer(0, 0);
|
|
176
|
+
} if (rf & 2) {
|
|
177
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
178
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.entry.traceId);
|
|
179
|
+
} }
|
|
180
|
+
function AuditLogRow_Conditional_16_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
181
|
+
i0.ɵɵelementContainerStart(0);
|
|
182
|
+
i0.ɵɵtext(1);
|
|
183
|
+
i0.ɵɵelementContainerEnd();
|
|
184
|
+
} if (rf & 2) {
|
|
185
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
186
|
+
i0.ɵɵadvance();
|
|
187
|
+
i0.ɵɵtextInterpolate(ctx_r0.textOf(ctx_r0.entry.traceId));
|
|
188
|
+
} }
|
|
189
|
+
function AuditLogRow_Conditional_16_Template(rf, ctx) { if (rf & 1) {
|
|
190
|
+
i0.ɵɵelementStart(0, "span");
|
|
191
|
+
i0.ɵɵconditionalCreate(1, AuditLogRow_Conditional_16_Conditional_1_Template, 1, 1, "ng-container", 0)(2, AuditLogRow_Conditional_16_Conditional_2_Template, 2, 1, "ng-container");
|
|
192
|
+
i0.ɵɵelementEnd();
|
|
193
|
+
} if (rf & 2) {
|
|
194
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
195
|
+
i0.ɵɵclassMap(ctx_r0.traceClasses());
|
|
196
|
+
i0.ɵɵadvance();
|
|
197
|
+
i0.ɵɵconditional(ctx_r0.isNode(ctx_r0.entry.traceId) ? 1 : 2);
|
|
198
|
+
} }
|
|
199
|
+
/**
|
|
200
|
+
* AuditLogRow component.
|
|
201
|
+
*
|
|
202
|
+
* One audit / activity / event-log row. Shape: `[actor] [action] [target] ·
|
|
203
|
+
* [timestamp]` with an optional `[old → new]` diff line and environment/trace
|
|
204
|
+
* metadata. The host IS the root `<div>` (`div[mol-audit-log-row]`), matching
|
|
205
|
+
* React's root exactly. With `onClick` the row is promoted to a real button in
|
|
206
|
+
* the a11y tree — `role="button"`, `tabindex="0"`, the pointer cursor — and
|
|
207
|
+
* Enter / Space activate it, matching native button keyboard semantics.
|
|
208
|
+
* Node-valued `entry` fields are `ng-template` references rendered through
|
|
209
|
+
* `NgTemplateOutlet`; string / number fields render as text.
|
|
210
|
+
*/
|
|
211
|
+
export class AuditLogRow {
|
|
212
|
+
/** The entry to display (required, as in React's props). */
|
|
213
|
+
entry;
|
|
214
|
+
/** Click handler; React's `onClick` (also fired on Enter / Space). */
|
|
215
|
+
onClick;
|
|
216
|
+
/** Extra classes. */
|
|
217
|
+
className;
|
|
218
|
+
/**
|
|
219
|
+
* The current class map.
|
|
220
|
+
* @returns The UIClassMap.
|
|
221
|
+
*/
|
|
222
|
+
cm() {
|
|
223
|
+
return getClassMap();
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Whether the row is interactive (`onClick` supplied): React renders the
|
|
227
|
+
* button role, tab stop and pointer cursor only then.
|
|
228
|
+
* @returns True when clickable.
|
|
229
|
+
*/
|
|
230
|
+
interactive() {
|
|
231
|
+
return typeof this.onClick === 'function';
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Computes the root class list (`cm.flex({ align: 'start', gap: 'sm' })` +
|
|
235
|
+
* `cm.sp('py', 2)` + the pointer cursor when clickable + `className`).
|
|
236
|
+
* @returns The class string.
|
|
237
|
+
*/
|
|
238
|
+
classes() {
|
|
239
|
+
return this.cm().cn(this.cm().flex({ align: 'start', gap: 'sm' }), this.cm().sp('py', 2), this.onClick ? this.cm().cursorPointer : undefined, this.className);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The host element's `role` (a button only when clickable).
|
|
243
|
+
* @returns `'button'` or null for no attribute.
|
|
244
|
+
*/
|
|
245
|
+
role() {
|
|
246
|
+
return this.interactive() ? 'button' : null;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The host element's tab stop (only when clickable).
|
|
250
|
+
* @returns 0 or null for no attribute.
|
|
251
|
+
*/
|
|
252
|
+
tabindex() {
|
|
253
|
+
return this.interactive() ? 0 : null;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* The inner stack's class (`cm.flex1` + `cm.stack(1)`).
|
|
257
|
+
* @returns The class string.
|
|
258
|
+
*/
|
|
259
|
+
stackClasses() {
|
|
260
|
+
return this.cm().cn(this.cm().flex1, this.cm().stack(1));
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The first line's class (`cm.textSize('sm')`).
|
|
264
|
+
* @returns The class string.
|
|
265
|
+
*/
|
|
266
|
+
lineClasses() {
|
|
267
|
+
return this.cm().cn(this.cm().textSize('sm'));
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The actor span's class (`cm.fontWeight('semibold')`).
|
|
271
|
+
* @returns The class string.
|
|
272
|
+
*/
|
|
273
|
+
actorClasses() {
|
|
274
|
+
return this.cm().fontWeight('semibold');
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The target span's class (`cm.fontWeight('medium')`).
|
|
278
|
+
* @returns The class string.
|
|
279
|
+
*/
|
|
280
|
+
targetClasses() {
|
|
281
|
+
return this.cm().fontWeight('medium');
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The timestamp span's class (`cm.sp('ml', 2)` + `cm.textSize('xs')`).
|
|
285
|
+
* @returns The class string.
|
|
286
|
+
*/
|
|
287
|
+
timeClasses() {
|
|
288
|
+
return this.cm().cn(this.cm().sp('ml', 2), this.cm().textSize('xs'));
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The environment span's class (`cm.sp('ml', 2)` + `cm.textSize('xs')` +
|
|
292
|
+
* `cm.fontWeight('semibold')`).
|
|
293
|
+
* @returns The class string.
|
|
294
|
+
*/
|
|
295
|
+
environmentClasses() {
|
|
296
|
+
return this.cm().cn(this.cm().sp('ml', 2), this.cm().textSize('xs'), this.cm().fontWeight('semibold'));
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The delta line's class (`cm.flex({ align: 'center', gap: 'sm' })` +
|
|
300
|
+
* `cm.textSize('xs')`).
|
|
301
|
+
* @returns The class string.
|
|
302
|
+
*/
|
|
303
|
+
deltaClasses() {
|
|
304
|
+
return this.cm().cn(this.cm().flex({ align: 'center', gap: 'sm' }), this.cm().textSize('xs'));
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* The trace span's class (`cm.textSize('xs')`).
|
|
308
|
+
* @returns The class string.
|
|
309
|
+
*/
|
|
310
|
+
traceClasses() {
|
|
311
|
+
return this.cm().textSize('xs');
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Whether the old → new delta line renders (React's
|
|
315
|
+
* `oldValue !== undefined || newValue !== undefined`).
|
|
316
|
+
* @returns True when either value is set.
|
|
317
|
+
*/
|
|
318
|
+
showDelta() {
|
|
319
|
+
return this.entry?.oldValue !== undefined || this.entry?.newValue !== undefined;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Whether a field holds a node (an `ng-template` reference) rather than text.
|
|
323
|
+
* @param value - The entry field.
|
|
324
|
+
* @returns True when it renders through a template outlet.
|
|
325
|
+
*/
|
|
326
|
+
isNode(value) {
|
|
327
|
+
return value instanceof TemplateRef;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The text a field renders (React renders strings and numbers as text).
|
|
331
|
+
* @param value - The entry field.
|
|
332
|
+
* @returns The text, or `''` for a node field.
|
|
333
|
+
*/
|
|
334
|
+
textOf(value) {
|
|
335
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value) : '';
|
|
336
|
+
}
|
|
337
|
+
/** Runs the click handler the way React forwards the DOM event. */
|
|
338
|
+
handleClick(event) {
|
|
339
|
+
this.onClick?.(event);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Activates the row on Enter / Space (React's `handleKeyDown`):
|
|
343
|
+
* preventDefault, then the click handler with no event.
|
|
344
|
+
* @param event - The keydown.
|
|
345
|
+
*/
|
|
346
|
+
handleKeyDown(event) {
|
|
347
|
+
const onClick = this.onClick;
|
|
348
|
+
if (!onClick)
|
|
349
|
+
return;
|
|
350
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
351
|
+
event.preventDefault();
|
|
352
|
+
onClick();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
static ɵfac = function AuditLogRow_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AuditLogRow)(); };
|
|
356
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuditLogRow, selectors: [["div", "mol-audit-log-row", ""]], hostVars: 5, hostBindings: function AuditLogRow_HostBindings(rf, ctx) { if (rf & 1) {
|
|
357
|
+
i0.ɵɵlistener("click", function AuditLogRow_click_HostBindingHandler($event) { return ctx.handleClick($event); })("keydown", function AuditLogRow_keydown_HostBindingHandler($event) { return ctx.handleKeyDown($event); });
|
|
358
|
+
} if (rf & 2) {
|
|
359
|
+
i0.ɵɵattribute("role", ctx.role())("tabindex", ctx.tabindex())("data-mol-id", "audit-log-row");
|
|
360
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
361
|
+
} }, inputs: { onClick: "onClick", className: "className", entry: "entry" }, decls: 17, vars: 17, consts: [[3, "ngTemplateOutlet"], [3, "class"], [3, "text-decoration", "opacity"], ["aria-hidden", "true"]], template: function AuditLogRow_Template(rf, ctx) { if (rf & 1) {
|
|
362
|
+
i0.ɵɵelementStart(0, "div")(1, "div")(2, "span");
|
|
363
|
+
i0.ɵɵconditionalCreate(3, AuditLogRow_Conditional_3_Template, 1, 1, "ng-container", 0)(4, AuditLogRow_Conditional_4_Template, 2, 1, "ng-container");
|
|
364
|
+
i0.ɵɵelementEnd();
|
|
365
|
+
i0.ɵɵtext(5);
|
|
366
|
+
i0.ɵɵelementStart(6, "span");
|
|
367
|
+
i0.ɵɵconditionalCreate(7, AuditLogRow_Conditional_7_Template, 1, 1, "ng-container", 0)(8, AuditLogRow_Conditional_8_Template, 2, 1, "ng-container");
|
|
368
|
+
i0.ɵɵelementEnd();
|
|
369
|
+
i0.ɵɵtext(9);
|
|
370
|
+
i0.ɵɵconditionalCreate(10, AuditLogRow_Conditional_10_Template, 3, 3, "span", 1);
|
|
371
|
+
i0.ɵɵelementStart(11, "span");
|
|
372
|
+
i0.ɵɵconditionalCreate(12, AuditLogRow_Conditional_12_Template, 2, 1)(13, AuditLogRow_Conditional_13_Template, 1, 1);
|
|
373
|
+
i0.ɵɵelementEnd();
|
|
374
|
+
i0.ɵɵconditionalCreate(14, AuditLogRow_Conditional_14_Template, 3, 3, "span", 1);
|
|
375
|
+
i0.ɵɵelementEnd();
|
|
376
|
+
i0.ɵɵconditionalCreate(15, AuditLogRow_Conditional_15_Template, 4, 5, "div", 1);
|
|
377
|
+
i0.ɵɵconditionalCreate(16, AuditLogRow_Conditional_16_Template, 3, 3, "span", 1);
|
|
378
|
+
i0.ɵɵelementEnd();
|
|
379
|
+
} if (rf & 2) {
|
|
380
|
+
i0.ɵɵclassMap(ctx.stackClasses());
|
|
381
|
+
i0.ɵɵadvance();
|
|
382
|
+
i0.ɵɵclassMap(ctx.lineClasses());
|
|
383
|
+
i0.ɵɵadvance();
|
|
384
|
+
i0.ɵɵclassMap(ctx.actorClasses());
|
|
385
|
+
i0.ɵɵadvance();
|
|
386
|
+
i0.ɵɵconditional(ctx.isNode(ctx.entry.actor) ? 3 : 4);
|
|
387
|
+
i0.ɵɵadvance(2);
|
|
388
|
+
i0.ɵɵtextInterpolate(" ");
|
|
389
|
+
i0.ɵɵadvance(2);
|
|
390
|
+
i0.ɵɵconditional(ctx.isNode(ctx.entry.action) ? 7 : 8);
|
|
391
|
+
i0.ɵɵadvance(2);
|
|
392
|
+
i0.ɵɵtextInterpolate(" ");
|
|
393
|
+
i0.ɵɵadvance();
|
|
394
|
+
i0.ɵɵconditional(ctx.entry.target ? 10 : -1);
|
|
395
|
+
i0.ɵɵadvance();
|
|
396
|
+
i0.ɵɵclassMap(ctx.timeClasses());
|
|
397
|
+
i0.ɵɵadvance();
|
|
398
|
+
i0.ɵɵconditional(ctx.isNode(ctx.entry.timestamp) ? 12 : 13);
|
|
399
|
+
i0.ɵɵadvance(2);
|
|
400
|
+
i0.ɵɵconditional(ctx.entry.environment ? 14 : -1);
|
|
401
|
+
i0.ɵɵadvance();
|
|
402
|
+
i0.ɵɵconditional(ctx.showDelta() ? 15 : -1);
|
|
403
|
+
i0.ɵɵadvance();
|
|
404
|
+
i0.ɵɵconditional(ctx.entry.traceId ? 16 : -1);
|
|
405
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
406
|
+
}
|
|
407
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuditLogRow, [{
|
|
408
|
+
type: Component,
|
|
409
|
+
args: [{
|
|
410
|
+
selector: 'div[mol-audit-log-row]',
|
|
411
|
+
standalone: true,
|
|
412
|
+
imports: [NgTemplateOutlet],
|
|
413
|
+
inputs: ['onClick', 'className'],
|
|
414
|
+
host: {
|
|
415
|
+
'[class]': 'classes()',
|
|
416
|
+
'[attr.role]': 'role()',
|
|
417
|
+
'[attr.tabindex]': 'tabindex()',
|
|
418
|
+
'[attr.data-mol-id]': '"audit-log-row"',
|
|
419
|
+
'(click)': 'handleClick($event)',
|
|
420
|
+
'(keydown)': 'handleKeyDown($event)',
|
|
421
|
+
},
|
|
422
|
+
// The template's whitespace is semantic: Angular keeps whitespace-only text
|
|
423
|
+
// nodes between inline elements, so the row's content is glued and the
|
|
424
|
+
// single spaces React renders between the spans are the explicit
|
|
425
|
+
// interpolations (line breaks only at block-level boundaries).
|
|
426
|
+
// prettier-ignore
|
|
427
|
+
template: `<div [class]="stackClasses()">
|
|
428
|
+
<div [class]="lineClasses()"><span [class]="actorClasses()">@if (isNode(entry.actor)) {<ng-container [ngTemplateOutlet]="entry.actor" />}@else {<ng-container>{{ textOf(entry.actor) }}</ng-container>}</span>{{ ' ' }}<span>@if (isNode(entry.action)) {<ng-container [ngTemplateOutlet]="entry.action" />}@else {<ng-container>{{ textOf(entry.action) }}</ng-container>}</span>{{ ' ' }}@if (entry.target) {<span [class]="targetClasses()">@if (isNode(entry.target)) {<ng-container [ngTemplateOutlet]="entry.target" />}@else {<ng-container>{{ textOf(entry.target) }}</ng-container>}</span>}<span [class]="timeClasses()">@if (isNode(entry.timestamp)) {· <ng-container [ngTemplateOutlet]="entry.timestamp" />}@else {{{ '· ' + textOf(entry.timestamp) }}}</span>@if (entry.environment) {<span [class]="environmentClasses()">@if (isNode(entry.environment)) {[<ng-container [ngTemplateOutlet]="entry.environment" />]}@else {{{ '[' + textOf(entry.environment) + ']' }}}</span>}</div>@if (showDelta()) {<div [class]="deltaClasses()">@if (entry.oldValue !== undefined) {<span [style.text-decoration]="'line-through'" [style.opacity]="0.7">@if (isNode(entry.oldValue)) {<ng-container [ngTemplateOutlet]="entry.oldValue" />}@else {<ng-container>{{ textOf(entry.oldValue) }}</ng-container>}</span>}@if (entry.oldValue !== undefined && entry.newValue !== undefined) {<span aria-hidden="true">→</span>}@if (entry.newValue !== undefined) {<span>@if (isNode(entry.newValue)) {<ng-container [ngTemplateOutlet]="entry.newValue" />}@else {<ng-container>{{ textOf(entry.newValue) }}</ng-container>}</span>}</div>}@if (entry.traceId) {<span [class]="traceClasses()">@if (isNode(entry.traceId)) {<ng-container [ngTemplateOutlet]="entry.traceId" />}@else {<ng-container>{{ textOf(entry.traceId) }}</ng-container>}</span>}
|
|
429
|
+
</div>`,
|
|
430
|
+
}]
|
|
431
|
+
}], null, { entry: [{
|
|
432
|
+
type: Input,
|
|
433
|
+
args: [{ required: true }]
|
|
434
|
+
}] }); })();
|
|
435
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AuditLogRow, { className: "AuditLogRow", filePath: "audit-log-row.component.ts", lineNumber: 49 }); })();
|
|
436
|
+
//# sourceMappingURL=audit-log-row.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log-row.component.js","sourceRoot":"","sources":["../src/audit-log-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;IAmC2C,2BAAiD;;;IAAnC,qDAAgC;;;IAAW,6BAAc;IAAA,YAAyB;;;;IAAzB,cAAyB;IAAzB,uDAAyB;;;IAAkE,2BAAkD;;;IAApC,sDAAiC;;;IAAW,6BAAc;IAAA,YAA0B;;;;IAA1B,cAA0B;IAA1B,wDAA0B;;;IAAgH,2BAAkD;;;IAApC,sDAAiC;;;IAAW,6BAAc;IAAA,YAA0B;;;;IAA1B,cAA0B;IAA1B,wDAA0B;;;IAA9J,4BAAgC;IAA+E,AAA/E,qGAA4B,4EAA0D;IAAwD,iBAAO;;;IAA/K,qCAAyB;IAAC,cAA8I;IAA9I,4DAA8I;;;IAAqE,uBAAE;IAAA,2BAAqD;;;IAAvC,cAAoC;IAApC,yDAAoC;;;IAAW,YAAoC;;;IAApC,uEAAoC;;;IAAuG,iBAAC;IAAA,2BAAuD;IAAA,iBAAC;;;IAA1C,cAAsC;IAAtC,2DAAsC;;;IAAY,YAA2C;;;IAA3C,yEAA2C;;;IAAlL,4BAAqC;IAA2F,AAA3F,kFAAiC,4DAAiE;IAA4C,iBAAO;;;IAApL,0CAA8B;IAAC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B;YAAA,cAA6M;YAA7M,6CAA6M;4BAhBnvD,gBAAgB;;iFAmBf,WAAW;cAtBvB,SAAS;eAAC;gBACT,QAAQ,EAAE,wBAAwB;gBAClC,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;gBAChC,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;oBACtB,aAAa,EAAE,QAAQ;oBACvB,iBAAiB,EAAE,YAAY;oBAC/B,oBAAoB,EAAE,iBAAiB;oBACvC,SAAS,EAAE,qBAAqB;oBAChC,WAAW,EAAE,uBAAuB;iBACrC;gBACD,4EAA4E;gBAC5E,uEAAuE;gBACvE,iEAAiE;gBACjE,+DAA+D;gBAC/D,kBAAkB;gBAClB,QAAQ,EAAE;;SAEH;aACR;;kBAGE,KAAK;mBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;kFAFd,WAAW"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular audit / activity / event-log row.
|
|
3
|
+
*
|
|
4
|
+
* Exports `<AuditLogRow>` (the `AuditLogRow` component class) and the
|
|
5
|
+
* `AuditLogEntry` type — the Angular counterpart of
|
|
6
|
+
* `@molecule/app-audit-log-row-react`: the same props (React names) and the
|
|
7
|
+
* same DOM for the same input.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { Component } from '@angular/core'
|
|
12
|
+
* import { AuditLogRow } from '@molecule/app-audit-log-row-angular'
|
|
13
|
+
*
|
|
14
|
+
* @Component({
|
|
15
|
+
* selector: 'app-audit-log',
|
|
16
|
+
* standalone: true,
|
|
17
|
+
* imports: [AuditLogRow],
|
|
18
|
+
* template: `
|
|
19
|
+
* <div
|
|
20
|
+
* mol-audit-log-row
|
|
21
|
+
* [entry]="{
|
|
22
|
+
* id: 'evt-001',
|
|
23
|
+
* actor: 'alice@example.com',
|
|
24
|
+
* action: 'updated',
|
|
25
|
+
* target: 'Invoice #1042',
|
|
26
|
+
* timestamp: '2 min ago',
|
|
27
|
+
* oldValue: 'Draft',
|
|
28
|
+
* newValue: 'Sent',
|
|
29
|
+
* }"
|
|
30
|
+
* [onClick]="openDetail"
|
|
31
|
+
* />
|
|
32
|
+
* `,
|
|
33
|
+
* })
|
|
34
|
+
* export class AuditLog {}
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* - Requires a bonded ClassMap — rendering throws otherwise.
|
|
39
|
+
* - `entry` fields are display nodes: pass pre-formatted, translated values as
|
|
40
|
+
* text (string / number), or an `ng-template` reference where a node would
|
|
41
|
+
* render (projected through `NgTemplateOutlet`).
|
|
42
|
+
* - With `onClick` the row carries `role="button"` + `tabindex="0"` and Enter
|
|
43
|
+
* / Space activate it, like a native button; without it the row is static.
|
|
44
|
+
*
|
|
45
|
+
* @module
|
|
46
|
+
*/
|
|
47
|
+
export * from './audit-log-row.component.js';
|
|
48
|
+
export * from './types.js';
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular audit / activity / event-log row.
|
|
3
|
+
*
|
|
4
|
+
* Exports `<AuditLogRow>` (the `AuditLogRow` component class) and the
|
|
5
|
+
* `AuditLogEntry` type — the Angular counterpart of
|
|
6
|
+
* `@molecule/app-audit-log-row-react`: the same props (React names) and the
|
|
7
|
+
* same DOM for the same input.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { Component } from '@angular/core'
|
|
12
|
+
* import { AuditLogRow } from '@molecule/app-audit-log-row-angular'
|
|
13
|
+
*
|
|
14
|
+
* @Component({
|
|
15
|
+
* selector: 'app-audit-log',
|
|
16
|
+
* standalone: true,
|
|
17
|
+
* imports: [AuditLogRow],
|
|
18
|
+
* template: `
|
|
19
|
+
* <div
|
|
20
|
+
* mol-audit-log-row
|
|
21
|
+
* [entry]="{
|
|
22
|
+
* id: 'evt-001',
|
|
23
|
+
* actor: 'alice@example.com',
|
|
24
|
+
* action: 'updated',
|
|
25
|
+
* target: 'Invoice #1042',
|
|
26
|
+
* timestamp: '2 min ago',
|
|
27
|
+
* oldValue: 'Draft',
|
|
28
|
+
* newValue: 'Sent',
|
|
29
|
+
* }"
|
|
30
|
+
* [onClick]="openDetail"
|
|
31
|
+
* />
|
|
32
|
+
* `,
|
|
33
|
+
* })
|
|
34
|
+
* export class AuditLog {}
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* - Requires a bonded ClassMap — rendering throws otherwise.
|
|
39
|
+
* - `entry` fields are display nodes: pass pre-formatted, translated values as
|
|
40
|
+
* text (string / number), or an `ng-template` reference where a node would
|
|
41
|
+
* render (projected through `NgTemplateOutlet`).
|
|
42
|
+
* - With `onClick` the row carries `role="button"` + `tabindex="0"` and Enter
|
|
43
|
+
* / Space activate it, like a native button; without it the row is static.
|
|
44
|
+
*
|
|
45
|
+
* @module
|
|
46
|
+
*/
|
|
47
|
+
export * from './audit-log-row.component.js';
|
|
48
|
+
export * from './types.js';
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Angular audit / activity log row.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { TemplateRef } from '@angular/core';
|
|
7
|
+
/**
|
|
8
|
+
* A node-valued entry field (React's `ReactNode`): in Angular a field is text
|
|
9
|
+
* (a string or number) or an `ng-template` reference rendered through
|
|
10
|
+
* `NgTemplateOutlet` where the node would render.
|
|
11
|
+
*/
|
|
12
|
+
type AuditLogEntryNode = TemplateRef<unknown> | string | number;
|
|
13
|
+
/** Shape of a single audit / activity log entry displayed by AuditLogRow. */
|
|
14
|
+
export interface AuditLogEntry {
|
|
15
|
+
id: string;
|
|
16
|
+
/** Actor name or id. */
|
|
17
|
+
actor: AuditLogEntryNode;
|
|
18
|
+
/** Verb describing what happened ("updated", "deleted", "assigned"). */
|
|
19
|
+
action: AuditLogEntryNode;
|
|
20
|
+
/** Target object / record. */
|
|
21
|
+
target?: AuditLogEntryNode;
|
|
22
|
+
/** Pre-formatted display timestamp (rendered verbatim — format before passing, e.g. "2 min ago"). */
|
|
23
|
+
timestamp: AuditLogEntryNode;
|
|
24
|
+
/** Optional summary field for delta display — old + new values. */
|
|
25
|
+
oldValue?: AuditLogEntryNode;
|
|
26
|
+
newValue?: AuditLogEntryNode;
|
|
27
|
+
/** Environment / source badge. */
|
|
28
|
+
environment?: AuditLogEntryNode;
|
|
29
|
+
/** Optional trace or correlation id. */
|
|
30
|
+
traceId?: AuditLogEntryNode;
|
|
31
|
+
}
|
|
32
|
+
/** Props accepted by the {@link AuditLogRow} component. */
|
|
33
|
+
export interface AuditLogRowProps {
|
|
34
|
+
/** The entry to display. */
|
|
35
|
+
entry: AuditLogEntry;
|
|
36
|
+
/** Called when the row is clicked (and on Enter / Space when interactive). */
|
|
37
|
+
onClick?: (event?: Event) => void;
|
|
38
|
+
/** Extra classes. */
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,KAAK,iBAAiB,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;AAE/D,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,wBAAwB;IACxB,KAAK,EAAE,iBAAiB,CAAA;IACxB,wEAAwE;IACxE,MAAM,EAAE,iBAAiB,CAAA;IACzB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,qGAAqG;IACrG,SAAS,EAAE,iBAAiB,CAAA;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,kCAAkC;IAClC,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,wCAAwC;IACxC,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B;AAED,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,KAAK,EAAE,aAAa,CAAA;IACpB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;IACjC,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|