@coolon/angular-ui-powerups 16.1.0-alpha.241 → 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 +5 -25
- package/fesm2022/coolon-angular-ui-powerups.mjs +39 -24
- 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 +2 -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[];
|
|
@@ -29,12 +29,8 @@ export declare class PopupMenuRendererComponent extends DisposableComponent {
|
|
|
29
29
|
* ignored when deciding whether a neighbouring separator has content to divide.
|
|
30
30
|
*/
|
|
31
31
|
private willRender;
|
|
32
|
-
/** Children with orphan separators collapsed
|
|
33
|
-
*
|
|
34
|
-
* menu — would render as an empty visual gap. This filters out (1) non-rendering
|
|
35
|
-
* entries, (2) leading separators, (3) consecutive separators, and (4) trailing
|
|
36
|
-
* separators, so separators appear only between two elements that actually paint.
|
|
37
|
-
*/
|
|
32
|
+
/** Children with orphan separators collapsed — see collapse-orphan-separators.ts for the
|
|
33
|
+
* algorithm and its unit tests. */
|
|
38
34
|
get renderableChildren(): readonly PopupAwareComponent[];
|
|
39
35
|
executeCommand(data: PopupAwareComponent): void;
|
|
40
36
|
isCommandEnabled(data: PopupAwareComponent): boolean;
|