@coolon/angular-ui-powerups 16.1.0-alpha.240 → 16.1.0-alpha.242
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/esm2022/lib/components/commands/group/popup-menu/popup-menu-renderer/collapse-orphan-separators.mjs +36 -0
- package/esm2022/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.mjs +18 -23
- package/fesm2022/coolon-angular-ui-powerups.mjs +52 -22
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/commands/group/popup-menu/popup-menu-renderer/collapse-orphan-separators.d.ts +16 -0
- package/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.d.ts +7 -6
- package/package.json +1 -1
package/lib/components/commands/group/popup-menu/popup-menu-renderer/collapse-orphan-separators.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure algorithm behind PopupMenuRendererComponent.renderableChildren, extracted so it
|
|
3
|
+
* can be exercised in isolation. See collapse-orphan-separators.spec.ts.
|
|
4
|
+
*
|
|
5
|
+
* Given the raw popup children[] and predicates for "this is a separator" and "this will
|
|
6
|
+
* actually paint", returns the subset that should feed the *ngFor: separators are kept only
|
|
7
|
+
* where they divide two elements that actually render, and every non-rendering entry
|
|
8
|
+
* (hidden commands or bookkeeping children with no template branch) is dropped.
|
|
9
|
+
*
|
|
10
|
+
* Concretely, filters out:
|
|
11
|
+
* 1. entries where `willRender(child)` is false (hidden commands + framework entries)
|
|
12
|
+
* 2. leading separators (nothing to divide above)
|
|
13
|
+
* 3. consecutive separators (all but the first collapse into one)
|
|
14
|
+
* 4. trailing separators (nothing to divide below)
|
|
15
|
+
*/
|
|
16
|
+
export declare function collapseOrphanSeparators<T>(children: readonly T[], isSeparator: (child: T) => boolean, willRender: (child: T) => boolean): T[];
|
|
@@ -23,13 +23,14 @@ export declare class PopupMenuRendererComponent extends DisposableComponent {
|
|
|
23
23
|
TrackBy: typeof Track;
|
|
24
24
|
constructor();
|
|
25
25
|
get children(): readonly PopupAwareComponent[];
|
|
26
|
-
/**
|
|
27
|
-
* a
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* hidden commands as if they weren't there. Separators are kept only where they actually
|
|
31
|
-
* divide two visible items.
|
|
26
|
+
/** True when the child matches one of the template's four `*ngIf` branches and will
|
|
27
|
+
* actually produce a rendered element. Everything else — notably `ButtonRendererComponent`
|
|
28
|
+
* entries that appear in `children` for other purposes — renders as nothing, so must be
|
|
29
|
+
* ignored when deciding whether a neighbouring separator has content to divide.
|
|
32
30
|
*/
|
|
31
|
+
private willRender;
|
|
32
|
+
/** Children with orphan separators collapsed — see collapse-orphan-separators.ts for the
|
|
33
|
+
* algorithm and its unit tests. */
|
|
33
34
|
get renderableChildren(): readonly PopupAwareComponent[];
|
|
34
35
|
executeCommand(data: PopupAwareComponent): void;
|
|
35
36
|
isCommandEnabled(data: PopupAwareComponent): boolean;
|