@coolon/angular-ui-powerups 16.1.0-alpha.244 → 16.1.0-alpha.246
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/loadable-component.mjs +80 -18
- package/esm2022/lib/components/tables/footer/footer-row-model.mjs +17 -2
- package/esm2022/lib/components/tables/renderer/table-body/table-body.component.mjs +9 -4
- package/fesm2022/coolon-angular-ui-powerups.mjs +103 -21
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/loadable-component.d.ts +37 -8
- package/lib/components/tables/footer/footer-row-model.d.ts +13 -0
- package/package.json +2 -2
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
import { InjectOptions, OnInit, ProviderToken } from '@angular/core';
|
|
2
|
-
import { Loadable, LoadingStateTracker } from '@coolon/pectin';
|
|
2
|
+
import { HasValue, Loadable, LoadingStateTracker, ValueModel } from '@coolon/pectin';
|
|
3
3
|
import { DisposableComponent } from './disposable-component';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class LoadableComponent extends DisposableComponent implements OnInit {
|
|
6
6
|
#private;
|
|
7
7
|
protected readonly loadTracker: LoadingStateTracker.Tracker | undefined;
|
|
8
8
|
constructor();
|
|
9
|
-
get loaded$():
|
|
9
|
+
get loaded$(): ValueModel<boolean>;
|
|
10
10
|
ngOnInit(): void;
|
|
11
11
|
private loadDependencies;
|
|
12
|
-
protected injectLoadable<T extends Loadable>(token: ProviderToken<T>, options?: InjectOptions &
|
|
13
|
-
|
|
14
|
-
}): T;
|
|
15
|
-
registerLoadable<T extends Loadable>(loadable: T, options?: {
|
|
16
|
-
wait: boolean;
|
|
17
|
-
}): T;
|
|
12
|
+
protected injectLoadable<T extends Loadable>(token: ProviderToken<T>, options?: InjectOptions & LoadableComponent.RegisterOptions): T;
|
|
13
|
+
registerLoadable<T extends Loadable>(loadable: T, options?: LoadableComponent.RegisterOptions): T;
|
|
18
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<LoadableComponent, never>;
|
|
19
15
|
static ɵdir: i0.ɵɵDirectiveDeclaration<LoadableComponent, never, never, {}, {}, never, never, false, never>;
|
|
20
16
|
}
|
|
17
|
+
export declare namespace LoadableComponent {
|
|
18
|
+
interface RegisterOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Block the component's `loaded$` until this loadable finishes loading. Defaults to `true`.
|
|
21
|
+
* Must be absent when a gate ({@link asLongAs}/{@link unless}) is supplied — a gated load is
|
|
22
|
+
* conditional and therefore always non-blocking.
|
|
23
|
+
*/
|
|
24
|
+
wait?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Load only while/once this condition holds. A reactive model (`ValueModel<boolean>`, e.g.
|
|
27
|
+
* `userPermissions.can$(role)`) is watched: the load fires when it becomes true, and immediately
|
|
28
|
+
* if it is already true. A bare `() => boolean` predicate is evaluated once, at load time.
|
|
29
|
+
* Mutually exclusive with {@link unless}.
|
|
30
|
+
*/
|
|
31
|
+
asLongAs?: HasValue<boolean> | (() => boolean);
|
|
32
|
+
/** The inverse of {@link asLongAs}: load unless this condition holds. */
|
|
33
|
+
unless?: HasValue<boolean> | (() => boolean);
|
|
34
|
+
}
|
|
35
|
+
type Gate = {
|
|
36
|
+
kind: 'model';
|
|
37
|
+
model$: ValueModel<boolean>;
|
|
38
|
+
negate: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'predicate';
|
|
41
|
+
predicate: () => boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Normalises `asLongAs`/`unless` into a {@link Gate} (or `undefined` when neither is given).
|
|
45
|
+
* Model conditions stay observable so they can be watched reactively; `unless` is represented by
|
|
46
|
+
* `negate: true` (for models) or a negated predicate. Throws if both options are supplied.
|
|
47
|
+
*/
|
|
48
|
+
function normalizeGate(options: RegisterOptions | undefined): Gate | undefined;
|
|
49
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentType } from "@angular/cdk/overlay";
|
|
2
2
|
import { ComponentPortal } from "@angular/cdk/portal";
|
|
3
|
+
import { ValueModel } from "@coolon/pectin";
|
|
3
4
|
declare class RowClass {
|
|
4
5
|
readonly className: string;
|
|
5
6
|
readonly matches: () => boolean;
|
|
@@ -46,11 +47,23 @@ export interface ResolvedFooterRow {
|
|
|
46
47
|
readonly defIds: string[];
|
|
47
48
|
readonly cells: ResolvedFooterCell[];
|
|
48
49
|
readonly rowClasses: string;
|
|
50
|
+
/** Live visibility gate set via {@link FooterRowModel.visibleWhile}; undefined ⇒ always visible. */
|
|
51
|
+
readonly visible$?: ValueModel<boolean | undefined>;
|
|
49
52
|
}
|
|
50
53
|
export declare abstract class FooterRowModel {
|
|
51
54
|
protected readonly _rowClasses: RowClass[];
|
|
55
|
+
protected _visible$?: ValueModel<boolean | undefined>;
|
|
56
|
+
/** The row's live visibility gate, if one was set via {@link visibleWhile}. */
|
|
57
|
+
get visible$(): ValueModel<boolean | undefined> | undefined;
|
|
52
58
|
noPadding(): this;
|
|
53
59
|
addClass(className: string, condition?: () => boolean): this;
|
|
60
|
+
/**
|
|
61
|
+
* Reactively hide the whole footer row while `model` is falsey (the `<tr>` is `display:none`'d).
|
|
62
|
+
* Unlike {@link addClass}'s `condition` — evaluated once when the row is resolved against the
|
|
63
|
+
* visible columns — this is live: the table re-renders when the model changes. Use it to gate a
|
|
64
|
+
* footer command row on a permission/state so a hidden command doesn't leave an empty row behind.
|
|
65
|
+
*/
|
|
66
|
+
visibleWhile(model: ValueModel<boolean | undefined>): this;
|
|
54
67
|
}
|
|
55
68
|
export declare namespace FooterRowModel {
|
|
56
69
|
class Impl extends FooterRowModel {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolon/angular-ui-powerups",
|
|
3
|
-
"version": "16.1.0-alpha.
|
|
3
|
+
"version": "16.1.0-alpha.246",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/animations": "^16.2.9",
|
|
6
6
|
"@angular/common": "^16.2.9",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@angular/platform-browser-dynamic": "^16.2.9",
|
|
13
13
|
"@angular/material-moment-adapter": "^16.2.10",
|
|
14
14
|
"@angular/router": "^16.2.9",
|
|
15
|
-
"@coolon/pectin": "^5.0.0-alpha.
|
|
15
|
+
"@coolon/pectin": "^5.0.0-alpha.127",
|
|
16
16
|
"fast-typescript-memoize": "^1.1.1",
|
|
17
17
|
"lodash-es": "^4.17.21",
|
|
18
18
|
"marked": "4.0.10",
|