@molecule/app-list-item-row-angular 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -36
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/list-item-row.component.d.ts +18 -30
- package/dist/list-item-row.component.d.ts.map +1 -1
- package/dist/list-item-row.component.js +83 -65
- package/dist/list-item-row.component.js.map +1 -1
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/slot-dom.d.ts +0 -60
- package/dist/slot-dom.d.ts.map +0 -1
- package/dist/slot-dom.js +0 -108
- package/dist/slot-dom.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-23T14:53:34.442Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-list-item-row-angular
|
|
@@ -12,8 +12,9 @@ Angular generic list-item row.
|
|
|
12
12
|
|
|
13
13
|
Exports `<ListItemRow>` — leading slot (icon/avatar/thumbnail) + up to three
|
|
14
14
|
text lines (title / subtitle / metadata) + right-side actions. Inputs: `title`,
|
|
15
|
-
`subtitle?`, `metadata?`, `leading?`, `actions?`, `
|
|
16
|
-
`disabled?`, `density?` (`'comfortable'` default | `'compact'`),
|
|
15
|
+
`subtitle?`, `metadata?`, `leading?`, `actions?`, `toggle?`, `onClick?`,
|
|
16
|
+
`selected?`, `disabled?`, `density?` (`'comfortable'` default | `'compact'`),
|
|
17
|
+
`className?`.
|
|
17
18
|
Use for nav lists, mobile menus, search results, picker dialogs, inbox threads.
|
|
18
19
|
For table rows use `<RowWithActions>` from `@molecule/app-data-table-ui-angular`
|
|
19
20
|
instead — this component is not a `<tr>`. It is the Angular counterpart of
|
|
@@ -84,6 +85,33 @@ interface ListItemRowProps {
|
|
|
84
85
|
leading?: string | number
|
|
85
86
|
/** Optional right-side actions (buttons, action menu; `[slot=actions]` content, or text). */
|
|
86
87
|
actions?: string | number
|
|
88
|
+
/** Loaded boolean action rendered as its own native button, independently of read-only metadata. */
|
|
89
|
+
toggle?: {
|
|
90
|
+
/** The loaded server value. */
|
|
91
|
+
value: boolean
|
|
92
|
+
/** Saves the desired boolean and resolves with the server-confirmed boolean. */
|
|
93
|
+
commit: (desired: boolean) => Promise<boolean>
|
|
94
|
+
/** Label when the displayed value is true. */
|
|
95
|
+
activeLabel?: string | number
|
|
96
|
+
/** Label when the displayed value is false. */
|
|
97
|
+
inactiveLabel?: string | number
|
|
98
|
+
/** Receives a failed save after the toggle restored the last confirmed value. */
|
|
99
|
+
onError?: (error: unknown) => void
|
|
100
|
+
/** Button variant. */
|
|
101
|
+
variant?: ButtonVariant
|
|
102
|
+
/** Button color. */
|
|
103
|
+
color?: ColorVariant
|
|
104
|
+
/** Button size. */
|
|
105
|
+
size?: Size
|
|
106
|
+
/** Whether the button stretches to fill its container. */
|
|
107
|
+
fullWidth?: boolean
|
|
108
|
+
/** Disables the toggle (permissions, never a pending save). */
|
|
109
|
+
disabled?: boolean
|
|
110
|
+
/** Extra classes. */
|
|
111
|
+
className?: string
|
|
112
|
+
/** `data-testid`. */
|
|
113
|
+
testId?: string
|
|
114
|
+
}
|
|
87
115
|
/**
|
|
88
116
|
* Called when the row is activated (called bare, the way React forwards the
|
|
89
117
|
* open button's click). The whole row is clickable through a transparent
|
|
@@ -127,19 +155,23 @@ The node props are projected slots: `title` renders inside the title line,
|
|
|
127
155
|
`subtitle` inside its line, `metadata` inside its line, `leading` inside the
|
|
128
156
|
leading `<div>` and `actions` inside the right-side `<div>`. String inputs
|
|
129
157
|
render as text instead — React's truthiness branch applies: an empty string
|
|
130
|
-
renders nothing. The conditionally-rendered wrappers
|
|
131
|
-
|
|
158
|
+
renders nothing. The conditionally-rendered wrappers are taken out of the DOM
|
|
159
|
+
when React renders nothing ({@link setElementPresent}) in
|
|
160
|
+
{@link ListItemRow.reconcile}.
|
|
132
161
|
|
|
133
162
|
```typescript
|
|
134
163
|
@Component({
|
|
135
164
|
selector: 'div[mol-list-item-row]',
|
|
136
165
|
standalone: true,
|
|
166
|
+
hostDirectives: [MolPlacement],
|
|
167
|
+
imports: [OptimisticToggleButton],
|
|
137
168
|
inputs: [
|
|
138
169
|
'title',
|
|
139
170
|
'subtitle',
|
|
140
171
|
'metadata',
|
|
141
172
|
'leading',
|
|
142
173
|
'actions',
|
|
174
|
+
'toggle',
|
|
143
175
|
'onClick',
|
|
144
176
|
'selected',
|
|
145
177
|
'disabled',
|
|
@@ -190,41 +222,73 @@ in {@link ListItemRow.ngAfterViewInit}.
|
|
|
190
222
|
</div>
|
|
191
223
|
</div>
|
|
192
224
|
<div #actionsWrap [class]="actionsClass()">
|
|
225
|
+
@if (toggle) {
|
|
226
|
+
<button
|
|
227
|
+
mol-optimistic-toggle-button
|
|
228
|
+
[value]="toggle.value"
|
|
229
|
+
[commit]="toggle.commit"
|
|
230
|
+
[onError]="toggle.onError"
|
|
231
|
+
[variant]="toggle.variant"
|
|
232
|
+
[color]="toggle.color"
|
|
233
|
+
[size]="toggle.size"
|
|
234
|
+
[fullWidth]="toggle.fullWidth ?? false"
|
|
235
|
+
[disabled]="toggle.disabled ?? false"
|
|
236
|
+
[className]="toggle.className"
|
|
237
|
+
[testId]="toggle.testId"
|
|
238
|
+
>
|
|
239
|
+
<span slot="activeLabel">{{ toggle.activeLabel }}</span>
|
|
240
|
+
<span slot="inactiveLabel">{{ toggle.inactiveLabel }}</span>
|
|
241
|
+
</button>
|
|
242
|
+
}
|
|
193
243
|
@if (actionsText()) {
|
|
194
244
|
{{ actionsText() }}
|
|
195
245
|
}
|
|
196
246
|
<ng-content select="[slot=actions]"></ng-content>
|
|
197
247
|
</div>`,
|
|
198
248
|
})
|
|
199
|
-
export class ListItemRow
|
|
249
|
+
export class ListItemRow {
|
|
250
|
+
/** Title — first line (string/number renders as text; nodes are `[slot=title]` content). */
|
|
200
251
|
title?: unknown
|
|
252
|
+
/** Optional second line (string/number as text; nodes are `[slot=subtitle]` content). */
|
|
201
253
|
subtitle?: unknown
|
|
254
|
+
/** Optional third line (string/number as text; nodes are `[slot=metadata]` content). */
|
|
202
255
|
metadata?: unknown
|
|
256
|
+
/** Optional leading slot — icon, avatar, thumbnail (`[slot=leading]` content, or text). */
|
|
203
257
|
leading?: unknown
|
|
258
|
+
/** Optional right-side actions (`[slot=actions]` content, or text). */
|
|
204
259
|
actions?: unknown
|
|
260
|
+
toggle?: ListItemRowProps['toggle']
|
|
261
|
+
/** Called when the row is activated (React's `onClick`, called bare). */
|
|
205
262
|
onClick?: () => void
|
|
263
|
+
/** When true, sets `aria-current="true"` on the row — no built-in visual highlight. */
|
|
206
264
|
selected?: boolean
|
|
265
|
+
/** When true, renders in a disabled visual state and disables the open button. */
|
|
207
266
|
disabled?: boolean
|
|
267
|
+
/** Dense vs comfortable spacing. */
|
|
208
268
|
density?: 'comfortable' | 'compact'
|
|
269
|
+
/** Extra classes. */
|
|
209
270
|
className?: string
|
|
210
271
|
|
|
272
|
+
/** Next value of the module-wide instance counter (React `useId()`'s counterpart). */
|
|
211
273
|
private static nextNameId = 0
|
|
212
274
|
|
|
275
|
+
/** The title line's id — the open button's `aria-labelledby` (React's `useId`). */
|
|
213
276
|
readonly nameId = `list-item-row-title-${ListItemRow.nextNameId++}`
|
|
214
277
|
|
|
278
|
+
/** The leading wrapper (absent when no leading value and the slot is empty). */
|
|
215
279
|
@ViewChild('leadingWrap') leadingWrap?: ElementRef<HTMLElement>
|
|
280
|
+
/** The subtitle line (absent when no subtitle value and the slot is empty). */
|
|
216
281
|
@ViewChild('subtitleWrap') subtitleWrap?: ElementRef<HTMLElement>
|
|
282
|
+
/** The metadata line (absent when no metadata value and the slot is empty). */
|
|
217
283
|
@ViewChild('metadataWrap') metadataWrap?: ElementRef<HTMLElement>
|
|
284
|
+
/** The actions wrapper (absent when no actions value and the slot is empty). */
|
|
218
285
|
@ViewChild('actionsWrap') actionsWrap?: ElementRef<HTMLElement>
|
|
219
286
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
private hasMetadataSlot = false
|
|
224
|
-
private hasActionsSlot = false
|
|
225
|
-
|
|
226
|
-
private readonly guard = new SlotGuard(inject(ElementRef), inject(Renderer2))
|
|
287
|
+
constructor() {
|
|
288
|
+
usePlacement((hasContent) => this.reconcile(hasContent))
|
|
289
|
+
}
|
|
227
290
|
|
|
291
|
+
/** The current class map. */
|
|
228
292
|
cm(): UIClassMap {
|
|
229
293
|
return getClassMap()
|
|
230
294
|
}
|
|
@@ -247,18 +311,22 @@ export class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
247
311
|
)
|
|
248
312
|
}
|
|
249
313
|
|
|
314
|
+
/** Computes the middle stack's class (`cm.flex1` + `cm.stack(0)`). */
|
|
250
315
|
stackClass(): string {
|
|
251
316
|
return this.cm().cn(this.cm().flex1, this.cm().stack(0))
|
|
252
317
|
}
|
|
253
318
|
|
|
319
|
+
/** The leading wrapper's class (`cm.shrink0`). */
|
|
254
320
|
leadingClass(): string {
|
|
255
321
|
return this.cm().cn(this.cm().shrink0)
|
|
256
322
|
}
|
|
257
323
|
|
|
324
|
+
/** The subtitle line's class (`cm.textSize('sm')`). */
|
|
258
325
|
subtitleClass(): string {
|
|
259
326
|
return this.cm().cn(this.cm().textSize('sm'))
|
|
260
327
|
}
|
|
261
328
|
|
|
329
|
+
/** The metadata line's class (`cm.textSize('xs')`). */
|
|
262
330
|
metadataClass(): string {
|
|
263
331
|
return this.cm().cn(this.cm().textSize('xs'))
|
|
264
332
|
}
|
|
@@ -267,6 +335,7 @@ export class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
267
335
|
return this.cm().cn(this.cm().shrink0, this.cm().position('relative'))
|
|
268
336
|
}
|
|
269
337
|
|
|
338
|
+
/** Computes the title line's class (`cm.textSize('sm')` + `cm.fontWeight('semibold')`). */
|
|
270
339
|
titleClass(): string {
|
|
271
340
|
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('semibold'))
|
|
272
341
|
}
|
|
@@ -285,65 +354,57 @@ export class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
285
354
|
: ''
|
|
286
355
|
}
|
|
287
356
|
|
|
357
|
+
/** The subtitle input's text (React's `{subtitle}` for a text child). */
|
|
288
358
|
subtitleText(): string {
|
|
289
359
|
return typeof this.subtitle === 'string' || typeof this.subtitle === 'number'
|
|
290
360
|
? String(this.subtitle)
|
|
291
361
|
: ''
|
|
292
362
|
}
|
|
293
363
|
|
|
364
|
+
/** The metadata input's text (React's `{metadata}` for a text child). */
|
|
294
365
|
metadataText(): string {
|
|
295
366
|
return typeof this.metadata === 'string' || typeof this.metadata === 'number'
|
|
296
367
|
? String(this.metadata)
|
|
297
368
|
: ''
|
|
298
369
|
}
|
|
299
370
|
|
|
371
|
+
/** The leading input's text (React's `{leading}` for a text child). */
|
|
300
372
|
leadingText(): string {
|
|
301
373
|
return typeof this.leading === 'string' || typeof this.leading === 'number'
|
|
302
374
|
? String(this.leading)
|
|
303
375
|
: ''
|
|
304
376
|
}
|
|
305
377
|
|
|
378
|
+
/** The actions input's text (React's `{actions}` for a text child). */
|
|
306
379
|
actionsText(): string {
|
|
307
380
|
return typeof this.actions === 'string' || typeof this.actions === 'number'
|
|
308
381
|
? String(this.actions)
|
|
309
382
|
: ''
|
|
310
383
|
}
|
|
311
384
|
|
|
385
|
+
/** Runs the row's open action, the way React forwards the open button's click (bare, no event). */
|
|
312
386
|
handleClick(): void {
|
|
313
387
|
if (this.disabled) return
|
|
314
388
|
this.onClick?.()
|
|
315
389
|
}
|
|
316
390
|
|
|
317
|
-
|
|
318
|
-
this.reconcile()
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
ngAfterViewChecked(): void {
|
|
322
|
-
this.reconcile()
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
private reconcile(): void {
|
|
391
|
+
private reconcile(hasContent: SlotReader): void {
|
|
326
392
|
const leading = this.leadingWrap?.nativeElement
|
|
327
393
|
const subtitle = this.subtitleWrap?.nativeElement
|
|
328
394
|
const metadata = this.metadataWrap?.nativeElement
|
|
329
395
|
const actions = this.actionsWrap?.nativeElement
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
this.
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
this.guard.toggle(leading, this.leadingText() !== '' || this.hasLeadingSlot)
|
|
339
|
-
this.guard.toggle(subtitle, this.subtitleText() !== '' || this.hasSubtitleSlot)
|
|
340
|
-
this.guard.toggle(metadata, this.metadataText() !== '' || this.hasMetadataSlot)
|
|
341
|
-
this.guard.toggle(actions, this.actionsText() !== '' || this.hasActionsSlot)
|
|
396
|
+
setElementPresent(leading, this.leadingText() !== '' || hasContent(leading))
|
|
397
|
+
setElementPresent(subtitle, this.subtitleText() !== '' || hasContent(subtitle))
|
|
398
|
+
setElementPresent(metadata, this.metadataText() !== '' || hasContent(metadata))
|
|
399
|
+
setElementPresent(
|
|
400
|
+
actions,
|
|
401
|
+
this.actionsText() !== '' || hasContent(actions) || Boolean(this.toggle),
|
|
402
|
+
)
|
|
342
403
|
}
|
|
343
404
|
}
|
|
344
405
|
```
|
|
345
406
|
|
|
346
|
-
_(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-list-item-row-angular/dist/list-item-row.component.d.ts`.)_
|
|
407
|
+
_(Member comments are shortened to their first sentence, and the 8 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-list-item-row-angular/dist/list-item-row.component.d.ts`.)_
|
|
347
408
|
|
|
348
409
|
## Injection Notes
|
|
349
410
|
|
|
@@ -354,7 +415,7 @@ Peer dependencies:
|
|
|
354
415
|
- `@angular/common` ^22.0.0
|
|
355
416
|
- `@angular/core` ^22.0.0
|
|
356
417
|
- `@angular/platform-browser` ^22.0.0
|
|
357
|
-
- `@molecule/app-angular` ^3.
|
|
418
|
+
- `@molecule/app-angular` ^3.13.0
|
|
358
419
|
- `@molecule/app-ui` ^1.0.1
|
|
359
420
|
- `@molecule/app-ui-angular` ^1.1.0
|
|
360
421
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Exports `<ListItemRow>` — leading slot (icon/avatar/thumbnail) + up to three
|
|
5
5
|
* text lines (title / subtitle / metadata) + right-side actions. Inputs: `title`,
|
|
6
|
-
* `subtitle?`, `metadata?`, `leading?`, `actions?`, `
|
|
7
|
-
* `disabled?`, `density?` (`'comfortable'` default | `'compact'`),
|
|
6
|
+
* `subtitle?`, `metadata?`, `leading?`, `actions?`, `toggle?`, `onClick?`,
|
|
7
|
+
* `selected?`, `disabled?`, `density?` (`'comfortable'` default | `'compact'`),
|
|
8
|
+
* `className?`.
|
|
8
9
|
* Use for nav lists, mobile menus, search results, picker dialogs, inbox threads.
|
|
9
10
|
* For table rows use `<RowWithActions>` from `@molecule/app-data-table-ui-angular`
|
|
10
11
|
* instead — this component is not a `<tr>`. It is the Angular counterpart of
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Exports `<ListItemRow>` — leading slot (icon/avatar/thumbnail) + up to three
|
|
5
5
|
* text lines (title / subtitle / metadata) + right-side actions. Inputs: `title`,
|
|
6
|
-
* `subtitle?`, `metadata?`, `leading?`, `actions?`, `
|
|
7
|
-
* `disabled?`, `density?` (`'comfortable'` default | `'compact'`),
|
|
6
|
+
* `subtitle?`, `metadata?`, `leading?`, `actions?`, `toggle?`, `onClick?`,
|
|
7
|
+
* `selected?`, `disabled?`, `density?` (`'comfortable'` default | `'compact'`),
|
|
8
|
+
* `className?`.
|
|
8
9
|
* Use for nav lists, mobile menus, search results, picker dialogs, inbox threads.
|
|
9
10
|
* For table rows use `<RowWithActions>` from `@molecule/app-data-table-ui-angular`
|
|
10
11
|
* instead — this component is not a `<tr>`. It is the Angular counterpart of
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { type
|
|
6
|
+
import { type ElementRef } from '@angular/core';
|
|
7
7
|
import type { UIClassMap } from '@molecule/app-ui';
|
|
8
|
+
import type { ListItemRowProps } from './types.js';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
10
|
+
import * as i1 from "@molecule/app-angular";
|
|
9
11
|
/**
|
|
10
12
|
* ListItemRow component.
|
|
11
13
|
*
|
|
@@ -28,10 +30,11 @@ import * as i0 from "@angular/core";
|
|
|
28
30
|
* `subtitle` inside its line, `metadata` inside its line, `leading` inside the
|
|
29
31
|
* leading `<div>` and `actions` inside the right-side `<div>`. String inputs
|
|
30
32
|
* render as text instead — React's truthiness branch applies: an empty string
|
|
31
|
-
* renders nothing. The conditionally-rendered wrappers
|
|
32
|
-
*
|
|
33
|
+
* renders nothing. The conditionally-rendered wrappers are taken out of the DOM
|
|
34
|
+
* when React renders nothing ({@link setElementPresent}) in
|
|
35
|
+
* {@link ListItemRow.reconcile}.
|
|
33
36
|
*/
|
|
34
|
-
export declare class ListItemRow
|
|
37
|
+
export declare class ListItemRow {
|
|
35
38
|
/** Title — first line (string/number renders as text; nodes are `[slot=title]` content). */
|
|
36
39
|
title?: unknown;
|
|
37
40
|
/** Optional second line (string/number as text; nodes are `[slot=subtitle]` content). */
|
|
@@ -42,6 +45,8 @@ export declare class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
42
45
|
leading?: unknown;
|
|
43
46
|
/** Optional right-side actions (`[slot=actions]` content, or text). */
|
|
44
47
|
actions?: unknown;
|
|
48
|
+
/** Loaded boolean action rendered as its own native button, independently of read-only metadata. */
|
|
49
|
+
toggle?: ListItemRowProps['toggle'];
|
|
45
50
|
/**
|
|
46
51
|
* Called when the row is activated (React's `onClick`, called bare). The
|
|
47
52
|
* whole row is clickable through a transparent native button over it, named
|
|
@@ -60,25 +65,15 @@ export declare class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
60
65
|
private static nextNameId;
|
|
61
66
|
/** The title line's id — the open button's `aria-labelledby` (React's `useId`). */
|
|
62
67
|
readonly nameId: string;
|
|
63
|
-
/** The leading wrapper (
|
|
68
|
+
/** The leading wrapper (absent when no leading value and the slot is empty). */
|
|
64
69
|
leadingWrap?: ElementRef<HTMLElement>;
|
|
65
|
-
/** The subtitle line (
|
|
70
|
+
/** The subtitle line (absent when no subtitle value and the slot is empty). */
|
|
66
71
|
subtitleWrap?: ElementRef<HTMLElement>;
|
|
67
|
-
/** The metadata line (
|
|
72
|
+
/** The metadata line (absent when no metadata value and the slot is empty). */
|
|
68
73
|
metadataWrap?: ElementRef<HTMLElement>;
|
|
69
|
-
/** The actions wrapper (
|
|
74
|
+
/** The actions wrapper (absent when no actions value and the slot is empty). */
|
|
70
75
|
actionsWrap?: ElementRef<HTMLElement>;
|
|
71
|
-
|
|
72
|
-
private slotsRead;
|
|
73
|
-
/** Whether the leading slot holds content (read once with the slots). */
|
|
74
|
-
private hasLeadingSlot;
|
|
75
|
-
/** Whether the subtitle slot holds content (read once with the slots). */
|
|
76
|
-
private hasSubtitleSlot;
|
|
77
|
-
/** Whether the metadata slot holds content (read once with the slots). */
|
|
78
|
-
private hasMetadataSlot;
|
|
79
|
-
/** Whether the actions slot holds content (read once with the slots). */
|
|
80
|
-
private hasActionsSlot;
|
|
81
|
-
private readonly guard;
|
|
76
|
+
constructor();
|
|
82
77
|
/**
|
|
83
78
|
* The current class map.
|
|
84
79
|
* @returns The UIClassMap.
|
|
@@ -176,22 +171,15 @@ export declare class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
176
171
|
* synthetic one.
|
|
177
172
|
*/
|
|
178
173
|
handleClick(): void;
|
|
179
|
-
/** Reads slot presence (view queries resolve only at view init) and reconciles the wrappers. */
|
|
180
|
-
ngAfterViewInit(): void;
|
|
181
|
-
/**
|
|
182
|
-
* Re-reconciles after every view refresh (a props step may add or remove a
|
|
183
|
-
* value): the wrappers are toggled on the values the template just
|
|
184
|
-
* rendered, so a later props step lands in one pass.
|
|
185
|
-
*/
|
|
186
|
-
ngAfterViewChecked(): void;
|
|
187
174
|
/**
|
|
188
175
|
* Applies React's conditions: the leading, subtitle, metadata and actions
|
|
189
176
|
* wrappers render only when their input holds text or their slot holds
|
|
190
|
-
* projected content.
|
|
191
|
-
*
|
|
177
|
+
* projected content.
|
|
178
|
+
*
|
|
179
|
+
* @param hasContent - Reads whether a slot has content.
|
|
192
180
|
*/
|
|
193
181
|
private reconcile;
|
|
194
182
|
static ɵfac: i0.ɵɵFactoryDeclaration<ListItemRow, never>;
|
|
195
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ListItemRow, "div[mol-list-item-row]", never, { "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "metadata": { "alias": "metadata"; "required": false; }; "leading": { "alias": "leading"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "density": { "alias": "density"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=leading]", "[slot=title]", "[slot=subtitle]", "[slot=metadata]", "[slot=actions]"], true,
|
|
183
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ListItemRow, "div[mol-list-item-row]", never, { "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "metadata": { "alias": "metadata"; "required": false; }; "leading": { "alias": "leading"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "toggle": { "alias": "toggle"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "density": { "alias": "density"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=leading]", "[slot=title]", "[slot=subtitle]", "[slot=metadata]", "[slot=actions]"], true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
196
184
|
}
|
|
197
185
|
//# sourceMappingURL=list-item-row.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item-row.component.d.ts","sourceRoot":"","sources":["../src/list-item-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"list-item-row.component.d.ts","sourceRoot":"","sources":["../src/list-item-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAa,KAAK,UAAU,EAAa,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;;OAMG;IACH,OAAO,IAAI,MAAM;IAUjB;;;;;OAKG;IACH,iBAAiB,IAAI,MAAM;IAQ3B;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB;;;;OAIG;IACH,YAAY,IAAI,MAAM;IAItB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;OAKG;IACH,aAAa,IAAI,OAAO;IAIxB;;;;OAIG;IACH,IAAI,IAAI,CAAC,GAAG,CAAC;IAIb;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAMnB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAMtB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAMtB;;;OAGG;IACH,WAAW,IAAI,MAAM;IAMrB;;;OAGG;IACH,WAAW,IAAI,MAAM;IAMrB;;;;;OAKG;IACH,WAAW,IAAI,IAAI;IAKnB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;yCA/NN,WAAW;2CAAX,WAAW;CA4OvB"}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { Component,
|
|
6
|
+
import { Component, ViewChild } from '@angular/core';
|
|
7
|
+
import { MolPlacement, setElementPresent, usePlacement, } from '@molecule/app-angular';
|
|
7
8
|
import { getClassMap } from '@molecule/app-ui';
|
|
8
|
-
import {
|
|
9
|
+
import { OptimisticToggleButton } from '@molecule/app-ui-angular';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
11
|
+
import * as i1 from "@molecule/app-angular";
|
|
10
12
|
const _c0 = ["leadingWrap"];
|
|
11
13
|
const _c1 = ["subtitleWrap"];
|
|
12
14
|
const _c2 = ["metadataWrap"];
|
|
@@ -15,9 +17,9 @@ const _c4 = [[["", "slot", "leading"]], [["", "slot", "title"]], [["", "slot", "
|
|
|
15
17
|
const _c5 = ["[slot=leading]", "[slot=title]", "[slot=subtitle]", "[slot=metadata]", "[slot=actions]"];
|
|
16
18
|
function ListItemRow_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
17
19
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
18
|
-
i0.ɵɵ
|
|
19
|
-
i0.ɵɵ
|
|
20
|
-
i0.ɵɵ
|
|
20
|
+
i0.ɵɵelementStart(0, "button", 6);
|
|
21
|
+
i0.ɵɵlistener("click", function ListItemRow_Conditional_0_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.handleClick()); });
|
|
22
|
+
i0.ɵɵelementEnd();
|
|
21
23
|
} if (rf & 2) {
|
|
22
24
|
const ctx_r1 = i0.ɵɵnextContext();
|
|
23
25
|
i0.ɵɵclassMap(ctx_r1.openButtonClasses());
|
|
@@ -48,6 +50,21 @@ function ListItemRow_Conditional_15_Template(rf, ctx) { if (rf & 1) {
|
|
|
48
50
|
i0.ɵɵtextInterpolate1(" ", ctx_r1.metadataText(), " ");
|
|
49
51
|
} }
|
|
50
52
|
function ListItemRow_Conditional_19_Template(rf, ctx) { if (rf & 1) {
|
|
53
|
+
i0.ɵɵelementStart(0, "button", 5)(1, "span", 7);
|
|
54
|
+
i0.ɵɵtext(2);
|
|
55
|
+
i0.ɵɵelementEnd();
|
|
56
|
+
i0.ɵɵelementStart(3, "span", 8);
|
|
57
|
+
i0.ɵɵtext(4);
|
|
58
|
+
i0.ɵɵelementEnd()();
|
|
59
|
+
} if (rf & 2) {
|
|
60
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
61
|
+
i0.ɵɵproperty("value", ctx_r1.toggle.value)("commit", ctx_r1.toggle.commit)("onError", ctx_r1.toggle.onError)("variant", ctx_r1.toggle.variant)("color", ctx_r1.toggle.color)("size", ctx_r1.toggle.size)("fullWidth", ctx_r1.toggle.fullWidth ?? false)("disabled", ctx_r1.toggle.disabled ?? false)("className", ctx_r1.toggle.className)("testId", ctx_r1.toggle.testId);
|
|
62
|
+
i0.ɵɵadvance(2);
|
|
63
|
+
i0.ɵɵtextInterpolate(ctx_r1.toggle.activeLabel);
|
|
64
|
+
i0.ɵɵadvance(2);
|
|
65
|
+
i0.ɵɵtextInterpolate(ctx_r1.toggle.inactiveLabel);
|
|
66
|
+
} }
|
|
67
|
+
function ListItemRow_Conditional_20_Template(rf, ctx) { if (rf & 1) {
|
|
51
68
|
i0.ɵɵtext(0);
|
|
52
69
|
} if (rf & 2) {
|
|
53
70
|
const ctx_r1 = i0.ɵɵnextContext();
|
|
@@ -75,8 +92,9 @@ function ListItemRow_Conditional_19_Template(rf, ctx) { if (rf & 1) {
|
|
|
75
92
|
* `subtitle` inside its line, `metadata` inside its line, `leading` inside the
|
|
76
93
|
* leading `<div>` and `actions` inside the right-side `<div>`. String inputs
|
|
77
94
|
* render as text instead — React's truthiness branch applies: an empty string
|
|
78
|
-
* renders nothing. The conditionally-rendered wrappers
|
|
79
|
-
*
|
|
95
|
+
* renders nothing. The conditionally-rendered wrappers are taken out of the DOM
|
|
96
|
+
* when React renders nothing ({@link setElementPresent}) in
|
|
97
|
+
* {@link ListItemRow.reconcile}.
|
|
80
98
|
*/
|
|
81
99
|
export class ListItemRow {
|
|
82
100
|
/** Title — first line (string/number renders as text; nodes are `[slot=title]` content). */
|
|
@@ -89,6 +107,8 @@ export class ListItemRow {
|
|
|
89
107
|
leading;
|
|
90
108
|
/** Optional right-side actions (`[slot=actions]` content, or text). */
|
|
91
109
|
actions;
|
|
110
|
+
/** Loaded boolean action rendered as its own native button, independently of read-only metadata. */
|
|
111
|
+
toggle;
|
|
92
112
|
/**
|
|
93
113
|
* Called when the row is activated (React's `onClick`, called bare). The
|
|
94
114
|
* whole row is clickable through a transparent native button over it, named
|
|
@@ -107,25 +127,17 @@ export class ListItemRow {
|
|
|
107
127
|
static nextNameId = 0;
|
|
108
128
|
/** The title line's id — the open button's `aria-labelledby` (React's `useId`). */
|
|
109
129
|
nameId = `list-item-row-title-${ListItemRow.nextNameId++}`;
|
|
110
|
-
/** The leading wrapper (
|
|
130
|
+
/** The leading wrapper (absent when no leading value and the slot is empty). */
|
|
111
131
|
leadingWrap;
|
|
112
|
-
/** The subtitle line (
|
|
132
|
+
/** The subtitle line (absent when no subtitle value and the slot is empty). */
|
|
113
133
|
subtitleWrap;
|
|
114
|
-
/** The metadata line (
|
|
134
|
+
/** The metadata line (absent when no metadata value and the slot is empty). */
|
|
115
135
|
metadataWrap;
|
|
116
|
-
/** The actions wrapper (
|
|
136
|
+
/** The actions wrapper (absent when no actions value and the slot is empty). */
|
|
117
137
|
actionsWrap;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
hasLeadingSlot = false;
|
|
122
|
-
/** Whether the subtitle slot holds content (read once with the slots). */
|
|
123
|
-
hasSubtitleSlot = false;
|
|
124
|
-
/** Whether the metadata slot holds content (read once with the slots). */
|
|
125
|
-
hasMetadataSlot = false;
|
|
126
|
-
/** Whether the actions slot holds content (read once with the slots). */
|
|
127
|
-
hasActionsSlot = false;
|
|
128
|
-
guard = new SlotGuard(inject(ElementRef), inject(Renderer2));
|
|
138
|
+
constructor() {
|
|
139
|
+
usePlacement((hasContent) => this.reconcile(hasContent));
|
|
140
|
+
}
|
|
129
141
|
/**
|
|
130
142
|
* The current class map.
|
|
131
143
|
* @returns The UIClassMap.
|
|
@@ -269,40 +281,22 @@ export class ListItemRow {
|
|
|
269
281
|
return;
|
|
270
282
|
this.onClick?.();
|
|
271
283
|
}
|
|
272
|
-
/** Reads slot presence (view queries resolve only at view init) and reconciles the wrappers. */
|
|
273
|
-
ngAfterViewInit() {
|
|
274
|
-
this.reconcile();
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Re-reconciles after every view refresh (a props step may add or remove a
|
|
278
|
-
* value): the wrappers are toggled on the values the template just
|
|
279
|
-
* rendered, so a later props step lands in one pass.
|
|
280
|
-
*/
|
|
281
|
-
ngAfterViewChecked() {
|
|
282
|
-
this.reconcile();
|
|
283
|
-
}
|
|
284
284
|
/**
|
|
285
285
|
* Applies React's conditions: the leading, subtitle, metadata and actions
|
|
286
286
|
* wrappers render only when their input holds text or their slot holds
|
|
287
|
-
* projected content.
|
|
288
|
-
*
|
|
287
|
+
* projected content.
|
|
288
|
+
*
|
|
289
|
+
* @param hasContent - Reads whether a slot has content.
|
|
289
290
|
*/
|
|
290
|
-
reconcile() {
|
|
291
|
+
reconcile(hasContent) {
|
|
291
292
|
const leading = this.leadingWrap?.nativeElement;
|
|
292
293
|
const subtitle = this.subtitleWrap?.nativeElement;
|
|
293
294
|
const metadata = this.metadataWrap?.nativeElement;
|
|
294
295
|
const actions = this.actionsWrap?.nativeElement;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
this.hasActionsSlot = hasNodes(actions);
|
|
300
|
-
this.slotsRead = true;
|
|
301
|
-
}
|
|
302
|
-
this.guard.toggle(leading, this.leadingText() !== '' || this.hasLeadingSlot);
|
|
303
|
-
this.guard.toggle(subtitle, this.subtitleText() !== '' || this.hasSubtitleSlot);
|
|
304
|
-
this.guard.toggle(metadata, this.metadataText() !== '' || this.hasMetadataSlot);
|
|
305
|
-
this.guard.toggle(actions, this.actionsText() !== '' || this.hasActionsSlot);
|
|
296
|
+
setElementPresent(leading, this.leadingText() !== '' || hasContent(leading));
|
|
297
|
+
setElementPresent(subtitle, this.subtitleText() !== '' || hasContent(subtitle));
|
|
298
|
+
setElementPresent(metadata, this.metadataText() !== '' || hasContent(metadata));
|
|
299
|
+
setElementPresent(actions, this.actionsText() !== '' || hasContent(actions) || Boolean(this.toggle));
|
|
306
300
|
}
|
|
307
301
|
static ɵfac = function ListItemRow_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ListItemRow)(); };
|
|
308
302
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ListItemRow, selectors: [["div", "mol-list-item-row", ""]], viewQuery: function ListItemRow_Query(rf, ctx) { if (rf & 1) {
|
|
@@ -317,29 +311,30 @@ export class ListItemRow {
|
|
|
317
311
|
i0.ɵɵattribute("aria-current", ctx.selected ? "true" : null)("aria-disabled", ctx.disabled ?? null);
|
|
318
312
|
i0.ɵɵclassMap(ctx.classes());
|
|
319
313
|
i0.ɵɵstyleProp("opacity", ctx.disabled ? 0.5 : null);
|
|
320
|
-
} }, inputs: { title: "title", subtitle: "subtitle", metadata: "metadata", leading: "leading", actions: "actions", onClick: "onClick", selected: "selected", disabled: "disabled", density: "density", className: "className" }, ngContentSelectors: _c5, decls:
|
|
314
|
+
} }, inputs: { title: "title", subtitle: "subtitle", metadata: "metadata", leading: "leading", actions: "actions", toggle: "toggle", onClick: "onClick", selected: "selected", disabled: "disabled", density: "density", className: "className" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement])], ngContentSelectors: _c5, decls: 22, vars: 20, consts: [["leadingWrap", ""], ["subtitleWrap", ""], ["metadataWrap", ""], ["actionsWrap", ""], ["type", "button", "data-mol-id", "list-item-row-open", 2, "background", "transparent", "border", "medium", "padding", "0px", 3, "class"], ["mol-optimistic-toggle-button", "", 3, "value", "commit", "onError", "variant", "color", "size", "fullWidth", "disabled", "className", "testId"], ["type", "button", "data-mol-id", "list-item-row-open", 2, "background", "transparent", "border", "medium", "padding", "0px", 3, "click"], ["slot", "activeLabel"], ["slot", "inactiveLabel"]], template: function ListItemRow_Template(rf, ctx) { if (rf & 1) {
|
|
321
315
|
i0.ɵɵprojectionDef(_c4);
|
|
322
316
|
i0.ɵɵconditionalCreate(0, ListItemRow_Conditional_0_Template, 1, 4, "button", 4);
|
|
323
|
-
i0.ɵɵ
|
|
317
|
+
i0.ɵɵelementStart(1, "div", null, 0);
|
|
324
318
|
i0.ɵɵconditionalCreate(3, ListItemRow_Conditional_3_Template, 1, 1);
|
|
325
319
|
i0.ɵɵprojection(4);
|
|
326
|
-
i0.ɵɵ
|
|
327
|
-
i0.ɵɵ
|
|
320
|
+
i0.ɵɵelementEnd();
|
|
321
|
+
i0.ɵɵelementStart(5, "div")(6, "div");
|
|
328
322
|
i0.ɵɵconditionalCreate(7, ListItemRow_Conditional_7_Template, 1, 1);
|
|
329
323
|
i0.ɵɵprojection(8, 1);
|
|
330
|
-
i0.ɵɵ
|
|
331
|
-
i0.ɵɵ
|
|
324
|
+
i0.ɵɵelementEnd();
|
|
325
|
+
i0.ɵɵelementStart(9, "div", null, 1);
|
|
332
326
|
i0.ɵɵconditionalCreate(11, ListItemRow_Conditional_11_Template, 1, 1);
|
|
333
327
|
i0.ɵɵprojection(12, 2);
|
|
334
|
-
i0.ɵɵ
|
|
335
|
-
i0.ɵɵ
|
|
328
|
+
i0.ɵɵelementEnd();
|
|
329
|
+
i0.ɵɵelementStart(13, "div", null, 2);
|
|
336
330
|
i0.ɵɵconditionalCreate(15, ListItemRow_Conditional_15_Template, 1, 1);
|
|
337
331
|
i0.ɵɵprojection(16, 3);
|
|
338
|
-
i0.ɵɵ
|
|
339
|
-
i0.ɵɵ
|
|
340
|
-
i0.ɵɵconditionalCreate(19, ListItemRow_Conditional_19_Template,
|
|
341
|
-
i0.ɵɵ
|
|
342
|
-
i0.ɵɵ
|
|
332
|
+
i0.ɵɵelementEnd()();
|
|
333
|
+
i0.ɵɵelementStart(17, "div", null, 3);
|
|
334
|
+
i0.ɵɵconditionalCreate(19, ListItemRow_Conditional_19_Template, 5, 12, "button", 5);
|
|
335
|
+
i0.ɵɵconditionalCreate(20, ListItemRow_Conditional_20_Template, 1, 1);
|
|
336
|
+
i0.ɵɵprojection(21, 4);
|
|
337
|
+
i0.ɵɵelementEnd();
|
|
343
338
|
} if (rf & 2) {
|
|
344
339
|
i0.ɵɵconditional(ctx.onClick ? 0 : -1);
|
|
345
340
|
i0.ɵɵadvance();
|
|
@@ -364,20 +359,25 @@ export class ListItemRow {
|
|
|
364
359
|
i0.ɵɵadvance(2);
|
|
365
360
|
i0.ɵɵclassMap(ctx.actionsClass());
|
|
366
361
|
i0.ɵɵadvance(2);
|
|
367
|
-
i0.ɵɵconditional(ctx.
|
|
368
|
-
|
|
362
|
+
i0.ɵɵconditional(ctx.toggle ? 19 : -1);
|
|
363
|
+
i0.ɵɵadvance();
|
|
364
|
+
i0.ɵɵconditional(ctx.actionsText() ? 20 : -1);
|
|
365
|
+
} }, dependencies: [OptimisticToggleButton], encapsulation: 2 });
|
|
369
366
|
}
|
|
370
367
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ListItemRow, [{
|
|
371
368
|
type: Component,
|
|
372
369
|
args: [{
|
|
373
370
|
selector: 'div[mol-list-item-row]',
|
|
374
371
|
standalone: true,
|
|
372
|
+
hostDirectives: [MolPlacement],
|
|
373
|
+
imports: [OptimisticToggleButton],
|
|
375
374
|
inputs: [
|
|
376
375
|
'title',
|
|
377
376
|
'subtitle',
|
|
378
377
|
'metadata',
|
|
379
378
|
'leading',
|
|
380
379
|
'actions',
|
|
380
|
+
'toggle',
|
|
381
381
|
'onClick',
|
|
382
382
|
'selected',
|
|
383
383
|
'disabled',
|
|
@@ -428,13 +428,31 @@ export class ListItemRow {
|
|
|
428
428
|
</div>
|
|
429
429
|
</div>
|
|
430
430
|
<div #actionsWrap [class]="actionsClass()">
|
|
431
|
+
@if (toggle) {
|
|
432
|
+
<button
|
|
433
|
+
mol-optimistic-toggle-button
|
|
434
|
+
[value]="toggle.value"
|
|
435
|
+
[commit]="toggle.commit"
|
|
436
|
+
[onError]="toggle.onError"
|
|
437
|
+
[variant]="toggle.variant"
|
|
438
|
+
[color]="toggle.color"
|
|
439
|
+
[size]="toggle.size"
|
|
440
|
+
[fullWidth]="toggle.fullWidth ?? false"
|
|
441
|
+
[disabled]="toggle.disabled ?? false"
|
|
442
|
+
[className]="toggle.className"
|
|
443
|
+
[testId]="toggle.testId"
|
|
444
|
+
>
|
|
445
|
+
<span slot="activeLabel">{{ toggle.activeLabel }}</span>
|
|
446
|
+
<span slot="inactiveLabel">{{ toggle.inactiveLabel }}</span>
|
|
447
|
+
</button>
|
|
448
|
+
}
|
|
431
449
|
@if (actionsText()) {
|
|
432
450
|
{{ actionsText() }}
|
|
433
451
|
}
|
|
434
452
|
<ng-content select="[slot=actions]"></ng-content>
|
|
435
453
|
</div>`,
|
|
436
454
|
}]
|
|
437
|
-
}],
|
|
455
|
+
}], () => [], { leadingWrap: [{
|
|
438
456
|
type: ViewChild,
|
|
439
457
|
args: ['leadingWrap']
|
|
440
458
|
}], subtitleWrap: [{
|
|
@@ -447,5 +465,5 @@ export class ListItemRow {
|
|
|
447
465
|
type: ViewChild,
|
|
448
466
|
args: ['actionsWrap']
|
|
449
467
|
}] }); })();
|
|
450
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ListItemRow, { className: "ListItemRow", filePath: "list-item-row.component.ts", lineNumber:
|
|
468
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ListItemRow, { className: "ListItemRow", filePath: "list-item-row.component.ts", lineNumber: 133 }); })();
|
|
451
469
|
//# sourceMappingURL=list-item-row.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item-row.component.js","sourceRoot":"","sources":["../src/list-item-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"list-item-row.component.js","sourceRoot":"","sources":["../src/list-item-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAmB,SAAS,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,EACL,YAAY,EACZ,iBAAiB,EAEjB,YAAY,GACb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;;;;;;;;;;;IAuD3D,iCAQC;IA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,eAAyB;YAAzB,kCAAyB;YAC1C,eAEC;YAFD,8CAEC;YAIa,eAAwB;YAAxB,iCAAwB;YACxC,eAiBC;YAjBD,sCAiBC;YACD,cAEC;YAFD,6CAEC;4BA9EK,sBAAsB;;iFAkFrB,WAAW;cAtFvB,SAAS;eAAC;gBACT,QAAQ,EAAE,wBAAwB;gBAClC,UAAU,EAAE,IAAI;gBAChB,cAAc,EAAE,CAAC,YAAY,CAAC;gBAC9B,OAAO,EAAE,CAAC,sBAAsB,CAAC;gBACjC,MAAM,EAAE;oBACN,OAAO;oBACP,UAAU;oBACV,UAAU;oBACV,SAAS;oBACT,SAAS;oBACT,QAAQ;oBACR,SAAS;oBACT,UAAU;oBACV,UAAU;oBACV,SAAS;oBACT,WAAW;iBACZ;gBACD,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;oBACtB,qBAAqB,EAAE,+BAA+B;oBACtD,sBAAsB,EAAE,uBAAuB;oBAC/C,iBAAiB,EAAE,4BAA4B;iBAChD;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA4DD;aACV;;kBAoCE,SAAS;mBAAC,aAAa;;kBAEvB,SAAS;mBAAC,cAAc;;kBAExB,SAAS;mBAAC,cAAc;;kBAExB,SAAS;mBAAC,aAAa;;kFAzCb,WAAW"}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
+
import type { ButtonVariant, ColorVariant, Size } from '@molecule/app-ui';
|
|
6
7
|
/** Props accepted by the {@link ListItemRow} component (its inputs). */
|
|
7
8
|
export interface ListItemRowProps {
|
|
8
9
|
/** Title — first line. A string/number renders as text; nodes are `[slot=title]` projected content. */
|
|
@@ -15,6 +16,33 @@ export interface ListItemRowProps {
|
|
|
15
16
|
leading?: string | number;
|
|
16
17
|
/** Optional right-side actions (buttons, action menu; `[slot=actions]` content, or text). */
|
|
17
18
|
actions?: string | number;
|
|
19
|
+
/** Loaded boolean action rendered as its own native button, independently of read-only metadata. */
|
|
20
|
+
toggle?: {
|
|
21
|
+
/** The loaded server value. */
|
|
22
|
+
value: boolean;
|
|
23
|
+
/** Saves the desired boolean and resolves with the server-confirmed boolean. */
|
|
24
|
+
commit: (desired: boolean) => Promise<boolean>;
|
|
25
|
+
/** Label when the displayed value is true. */
|
|
26
|
+
activeLabel?: string | number;
|
|
27
|
+
/** Label when the displayed value is false. */
|
|
28
|
+
inactiveLabel?: string | number;
|
|
29
|
+
/** Receives a failed save after the toggle restored the last confirmed value. */
|
|
30
|
+
onError?: (error: unknown) => void;
|
|
31
|
+
/** Button variant. */
|
|
32
|
+
variant?: ButtonVariant;
|
|
33
|
+
/** Button color. */
|
|
34
|
+
color?: ColorVariant;
|
|
35
|
+
/** Button size. */
|
|
36
|
+
size?: Size;
|
|
37
|
+
/** Whether the button stretches to fill its container. */
|
|
38
|
+
fullWidth?: boolean;
|
|
39
|
+
/** Disables the toggle (permissions, never a pending save). */
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/** Extra classes. */
|
|
42
|
+
className?: string;
|
|
43
|
+
/** `data-testid`. */
|
|
44
|
+
testId?: string;
|
|
45
|
+
};
|
|
18
46
|
/**
|
|
19
47
|
* Called when the row is activated (called bare, the way React forwards the
|
|
20
48
|
* open button's click). The whole row is clickable through a transparent
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAC/B,uGAAuG;IACvG,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,yHAAyH;IACzH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,uIAAuI;IACvI,QAAQ,CAAC,EAAE,MAAM,GAAG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AM,GAAG,MAAM,CAAA;QAC/B,iFAAiF;QACjF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;QAClC,sBAAsB;QACtB,OAAO,CAAC,EAAE,aAAa,CAAA;QACvB,oBAAoB;QACpB,KAAK,CAAC,EAAE,YAAY,CAAA;QACpB,mBAAmB;QACnB,IAAI,CAAC,EAAE,IAAI,CAAA;QACX,0DAA0D;QAC1D,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB,+DAA+D;QAC/D,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,qBAAqB;QACrB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,qBAAqB;QACrB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;IACD;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,6HAA6H;IAC7H,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACnC,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-list-item-row-angular",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Thumbnail + title + subtitle + metadata + actions row (nav lists, mobile menus)",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-list-item-row-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@angular/common": "^22.0.0",
|
|
46
46
|
"@angular/core": "^22.0.0",
|
|
47
47
|
"@angular/platform-browser": "^22.0.0",
|
|
48
|
-
"@molecule/app-angular": "^3.
|
|
48
|
+
"@molecule/app-angular": "^3.13.0",
|
|
49
49
|
"@molecule/app-ui": "^1.0.1",
|
|
50
50
|
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
51
|
},
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"@angular/compiler-cli": "22.2.3",
|
|
56
56
|
"@angular/core": "22.2.3",
|
|
57
57
|
"@angular/platform-browser": "22.2.3",
|
|
58
|
-
"@molecule/app-angular": "3.
|
|
58
|
+
"@molecule/app-angular": "3.13.0",
|
|
59
59
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
60
|
"@molecule/app-i18n": "1.2.2",
|
|
61
61
|
"@molecule/app-icons": "1.0.4",
|
|
62
|
-
"@molecule/app-ui": "1.
|
|
63
|
-
"@molecule/app-ui-angular": "1.
|
|
62
|
+
"@molecule/app-ui": "1.5.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.5.1",
|
|
64
64
|
"@types/node": "26.6.5",
|
|
65
|
-
"jsdom": "
|
|
65
|
+
"jsdom": "31.0.1",
|
|
66
66
|
"rxjs": "7.8.2",
|
|
67
67
|
"typescript": "6.0.3",
|
|
68
68
|
"vitest": "4.1.12",
|
package/dist/slot-dom.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOM helpers for the projected-slot wrappers of {@link ListItemRow}.
|
|
3
|
-
*
|
|
4
|
-
* React renders the `leading`, `subtitle`, `metadata` and `actions` wrappers
|
|
5
|
-
* conditionally (`{expr && <div>…}`). Angular projection needs always-mounted
|
|
6
|
-
* `<ng-content>` capture points, so the wrappers live in the template
|
|
7
|
-
* unconditionally and {@link SlotGuard.toggle} reconciles them against React's
|
|
8
|
-
* DOM: a wrapper with nothing to show is detached (an anchor comment keeps its
|
|
9
|
-
* position stable for a later re-attach when a later props step fills it).
|
|
10
|
-
*
|
|
11
|
-
* @module
|
|
12
|
-
*/
|
|
13
|
-
import type { ElementRef, Renderer2 } from '@angular/core';
|
|
14
|
-
/**
|
|
15
|
-
* Whether a wrapper holds any element or non-whitespace text node — the input
|
|
16
|
-
* text the template's `@if` rendered, or the projected slot content.
|
|
17
|
-
*
|
|
18
|
-
* @param el - The wrapper element.
|
|
19
|
-
* @returns True when at least one rendered node exists.
|
|
20
|
-
*/
|
|
21
|
-
export declare const hasNodes: (el: Element | undefined | null) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Attaches or detaches one projected-slot wrapper against what React renders.
|
|
24
|
-
* Idempotent, anchored in the wrapper's current parent (default: the component
|
|
25
|
-
* host); the contents move with the wrapper.
|
|
26
|
-
*/
|
|
27
|
-
export declare class SlotGuard {
|
|
28
|
-
private readonly host;
|
|
29
|
-
private readonly renderer;
|
|
30
|
-
private readonly anchors;
|
|
31
|
-
/** Where each detached wrapper belongs: its parent when it was last attached. */
|
|
32
|
-
private readonly homes;
|
|
33
|
-
/**
|
|
34
|
-
* Creates the guard.
|
|
35
|
-
*
|
|
36
|
-
* @param host - The component host element (default anchor parent).
|
|
37
|
-
* @param renderer - The DOM renderer.
|
|
38
|
-
*/
|
|
39
|
-
constructor(host: ElementRef<HTMLElement>, renderer: Renderer2);
|
|
40
|
-
/**
|
|
41
|
-
* Attaches or detaches the element (contents move with it). A detached
|
|
42
|
-
* element re-attaches to the parent it had when it was last attached — not
|
|
43
|
-
* to the host: a detached wrapper has no `parentElement`, and React's DOM
|
|
44
|
-
* keeps its position inside the component tree.
|
|
45
|
-
*
|
|
46
|
-
* @param el - The wrapper element.
|
|
47
|
-
* @param shouldAttach - Whether it should be in the DOM.
|
|
48
|
-
*/
|
|
49
|
-
toggle(el: Element | undefined | null, shouldAttach: boolean): void;
|
|
50
|
-
/**
|
|
51
|
-
* Returns the wrapper's anchor comment in `parent`, creating (or replacing
|
|
52
|
-
* a stale one) where the wrapper sits.
|
|
53
|
-
*
|
|
54
|
-
* @param parent - The anchor's parent.
|
|
55
|
-
* @param el - The wrapper the anchor stands for.
|
|
56
|
-
* @returns The connected anchor comment.
|
|
57
|
-
*/
|
|
58
|
-
private anchorIn;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=slot-dom.d.ts.map
|
package/dist/slot-dom.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-dom.d.ts","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,OAAO,GAAG,SAAS,GAAG,IAAI,KAAG,OAOzD,CAAA;AAED;;;;GAIG;AACH,qBAAa,SAAS;IAYlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAZ3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2B;IAEjD;;;;;OAKG;gBAEgB,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,EAC7B,QAAQ,EAAE,SAAS;IAGtC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI;IAuBnE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;CASjB"}
|
package/dist/slot-dom.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOM helpers for the projected-slot wrappers of {@link ListItemRow}.
|
|
3
|
-
*
|
|
4
|
-
* React renders the `leading`, `subtitle`, `metadata` and `actions` wrappers
|
|
5
|
-
* conditionally (`{expr && <div>…}`). Angular projection needs always-mounted
|
|
6
|
-
* `<ng-content>` capture points, so the wrappers live in the template
|
|
7
|
-
* unconditionally and {@link SlotGuard.toggle} reconciles them against React's
|
|
8
|
-
* DOM: a wrapper with nothing to show is detached (an anchor comment keeps its
|
|
9
|
-
* position stable for a later re-attach when a later props step fills it).
|
|
10
|
-
*
|
|
11
|
-
* @module
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Whether a wrapper holds any element or non-whitespace text node — the input
|
|
15
|
-
* text the template's `@if` rendered, or the projected slot content.
|
|
16
|
-
*
|
|
17
|
-
* @param el - The wrapper element.
|
|
18
|
-
* @returns True when at least one rendered node exists.
|
|
19
|
-
*/
|
|
20
|
-
export const hasNodes = (el) => {
|
|
21
|
-
if (!el)
|
|
22
|
-
return false;
|
|
23
|
-
for (const node of Array.from(el.childNodes)) {
|
|
24
|
-
if (node.nodeType === 1)
|
|
25
|
-
return true;
|
|
26
|
-
if (node.nodeType === 3 && (node.textContent ?? '').trim())
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Attaches or detaches one projected-slot wrapper against what React renders.
|
|
33
|
-
* Idempotent, anchored in the wrapper's current parent (default: the component
|
|
34
|
-
* host); the contents move with the wrapper.
|
|
35
|
-
*/
|
|
36
|
-
export class SlotGuard {
|
|
37
|
-
host;
|
|
38
|
-
renderer;
|
|
39
|
-
anchors = new Map();
|
|
40
|
-
/** Where each detached wrapper belongs: its parent when it was last attached. */
|
|
41
|
-
homes = new Map();
|
|
42
|
-
/**
|
|
43
|
-
* Creates the guard.
|
|
44
|
-
*
|
|
45
|
-
* @param host - The component host element (default anchor parent).
|
|
46
|
-
* @param renderer - The DOM renderer.
|
|
47
|
-
*/
|
|
48
|
-
constructor(host, renderer) {
|
|
49
|
-
this.host = host;
|
|
50
|
-
this.renderer = renderer;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Attaches or detaches the element (contents move with it). A detached
|
|
54
|
-
* element re-attaches to the parent it had when it was last attached — not
|
|
55
|
-
* to the host: a detached wrapper has no `parentElement`, and React's DOM
|
|
56
|
-
* keeps its position inside the component tree.
|
|
57
|
-
*
|
|
58
|
-
* @param el - The wrapper element.
|
|
59
|
-
* @param shouldAttach - Whether it should be in the DOM.
|
|
60
|
-
*/
|
|
61
|
-
toggle(el, shouldAttach) {
|
|
62
|
-
if (!el)
|
|
63
|
-
return;
|
|
64
|
-
if (el.parentElement)
|
|
65
|
-
this.homes.set(el, el.parentElement);
|
|
66
|
-
const parent = this.homes.get(el) ?? el.parentElement ?? this.host.nativeElement;
|
|
67
|
-
if (shouldAttach && !el.isConnected) {
|
|
68
|
-
const anchor = this.anchors.get(el);
|
|
69
|
-
if (anchor?.isConnected && anchor.parentNode === parent) {
|
|
70
|
-
parent.insertBefore(el, anchor);
|
|
71
|
-
this.renderer.removeChild(parent, anchor);
|
|
72
|
-
this.anchors.delete(el);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (anchor?.isConnected)
|
|
76
|
-
this.renderer.removeChild(anchor.parentNode, anchor);
|
|
77
|
-
this.anchors.delete(el);
|
|
78
|
-
parent.appendChild(el);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else if (!shouldAttach && el.isConnected) {
|
|
82
|
-
// A placeholder comment keeps the re-insertion position stable; the
|
|
83
|
-
// conformance normalizer strips comment nodes, so it never shows.
|
|
84
|
-
this.anchorIn(parent, el);
|
|
85
|
-
this.renderer.removeChild(parent, el);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Returns the wrapper's anchor comment in `parent`, creating (or replacing
|
|
90
|
-
* a stale one) where the wrapper sits.
|
|
91
|
-
*
|
|
92
|
-
* @param parent - The anchor's parent.
|
|
93
|
-
* @param el - The wrapper the anchor stands for.
|
|
94
|
-
* @returns The connected anchor comment.
|
|
95
|
-
*/
|
|
96
|
-
anchorIn(parent, el) {
|
|
97
|
-
const existing = this.anchors.get(el);
|
|
98
|
-
if (existing?.isConnected && existing.parentNode === parent)
|
|
99
|
-
return existing;
|
|
100
|
-
if (existing)
|
|
101
|
-
this.anchors.delete(el);
|
|
102
|
-
const created = this.renderer.createComment('slot');
|
|
103
|
-
parent.insertBefore(created, el.isConnected ? el : null);
|
|
104
|
-
this.anchors.set(el, created);
|
|
105
|
-
return created;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=slot-dom.js.map
|
package/dist/slot-dom.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-dom.js","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAA8B,EAAW,EAAE;IAClE,IAAI,CAAC,EAAE;QAAE,OAAO,KAAK,CAAA;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACpC,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAA;IACzE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAYD;IACA;IAZF,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAA;IACtD,iFAAiF;IAChE,KAAK,GAAG,IAAI,GAAG,EAAiB,CAAA;IAEjD;;;;;OAKG;IACH,YACmB,IAA6B,EAC7B,QAAmB;QADnB,SAAI,GAAJ,IAAI,CAAyB;QAC7B,aAAQ,GAAR,QAAQ,CAAW;IACnC,CAAC;IAEJ;;;;;;;;OAQG;IACH,MAAM,CAAC,EAA8B,EAAE,YAAqB;QAC1D,IAAI,CAAC,EAAE;YAAE,OAAM;QACf,IAAI,EAAE,CAAC,aAAa;YAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,C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