@dereekb/dbx-core 12.4.5 → 12.5.0
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/action/action.mjs +25 -1
- package/esm2022/lib/action/action.store.mjs +36 -5
- package/esm2022/lib/action/action.store.source.mjs +10 -1
- package/esm2022/lib/button/action/action.button.directive.mjs +2 -2
- package/esm2022/lib/button/button.directive.mjs +7 -2
- package/esm2022/lib/button/button.mjs +1 -1
- package/esm2022/lib/filter/filter.map.directive.mjs +2 -2
- package/esm2022/lib/injection/index.mjs +2 -1
- package/esm2022/lib/injection/injection.instance.mjs +7 -8
- package/esm2022/lib/injection/injection.util.mjs +11 -0
- package/fesm2022/dereekb-dbx-core.mjs +91 -14
- package/fesm2022/dereekb-dbx-core.mjs.map +1 -1
- package/lib/action/action.d.ts +21 -1
- package/lib/action/action.store.d.ts +19 -1
- package/lib/action/action.store.source.d.ts +5 -2
- package/lib/button/button.d.ts +18 -4
- package/lib/button/button.directive.d.ts +6 -5
- package/lib/filter/filter.map.directive.d.ts +1 -1
- package/lib/injection/index.d.ts +1 -0
- package/lib/injection/injection.util.d.ts +9 -0
- package/package.json +1 -1
package/lib/action/action.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { LoadingStateType } from '@dereekb/rxjs';
|
|
2
|
-
import { type Maybe } from '@dereekb/util';
|
|
2
|
+
import { type PercentNumber, type Maybe } from '@dereekb/util';
|
|
3
|
+
/**
|
|
4
|
+
* Used to denote the percent progress of a working action.
|
|
5
|
+
*
|
|
6
|
+
* This is a PercentNumber, a number between 0 and 100.
|
|
7
|
+
*/
|
|
8
|
+
export type DbxActionWorkProgress = PercentNumber;
|
|
9
|
+
/**
|
|
10
|
+
* Used for denoting working state or progress.
|
|
11
|
+
*
|
|
12
|
+
* True is working, but no progress level.
|
|
13
|
+
*/
|
|
14
|
+
export type DbxActionWorkOrWorkProgress = boolean | DbxActionWorkProgress;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a working progress value from an array of working progress values.
|
|
17
|
+
*
|
|
18
|
+
* @param workOrWorkProgress The array of working progress values to use.
|
|
19
|
+
* @param progressPercent An optional progress percent value to use if the working progress is a boolean.
|
|
20
|
+
* @returns The working progress value.
|
|
21
|
+
*/
|
|
22
|
+
export declare function dbxActionWorkProgress(workOrWorkProgress: Maybe<DbxActionWorkOrWorkProgress>[], progressPercent?: Maybe<DbxActionWorkProgress>): number | boolean;
|
|
3
23
|
/**
|
|
4
24
|
* Used by ActionContextState to denote what state the action is in.
|
|
5
25
|
*/
|
|
@@ -3,7 +3,7 @@ import { ComponentStore } from '@ngrx/component-store';
|
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { BooleanStringKeyArray, Maybe, ReadableError } from '@dereekb/util';
|
|
5
5
|
import { LoadingStateType, LoadingState, LockSet } from '@dereekb/rxjs';
|
|
6
|
-
import { DbxActionRejectedPair, DbxActionState, DbxActionSuccessPair } from './action';
|
|
6
|
+
import { DbxActionRejectedPair, DbxActionState, DbxActionSuccessPair, DbxActionWorkOrWorkProgress, DbxActionWorkProgress } from './action';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
export declare function isActionContextEnabled(state: ActionContextState): boolean;
|
|
9
9
|
export declare function isActionContextDisabled(state: ActionContextState): boolean;
|
|
@@ -22,6 +22,12 @@ export interface ActionContextState<T = unknown, O = unknown> {
|
|
|
22
22
|
* Whether or not this action is flagged as having been modified.
|
|
23
23
|
*/
|
|
24
24
|
readonly isModified: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The working progress of the action.
|
|
27
|
+
*
|
|
28
|
+
* Is reset to null when triggered/ready value is set.
|
|
29
|
+
*/
|
|
30
|
+
readonly workProgress?: Maybe<DbxActionWorkProgress>;
|
|
25
31
|
/**
|
|
26
32
|
* Value that is set after a triggered action. Not to be confused with result.
|
|
27
33
|
*/
|
|
@@ -75,6 +81,10 @@ export declare class ActionContextStore<T = unknown, O = unknown> extends Compon
|
|
|
75
81
|
* Pipes the readied value on ValueReady.
|
|
76
82
|
*/
|
|
77
83
|
readonly valueReady$: Observable<T>;
|
|
84
|
+
/**
|
|
85
|
+
* Pipes the working progress on the working state.
|
|
86
|
+
*/
|
|
87
|
+
readonly workProgress$: Observable<Maybe<number>>;
|
|
78
88
|
/**
|
|
79
89
|
* Pipes the error on the rejection state.
|
|
80
90
|
*/
|
|
@@ -91,6 +101,10 @@ export declare class ActionContextStore<T = unknown, O = unknown> extends Compon
|
|
|
91
101
|
* Whether or not it is currently in a working state.
|
|
92
102
|
*/
|
|
93
103
|
readonly isWorking$: Observable<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* Pipes the current work or work progress.
|
|
106
|
+
*/
|
|
107
|
+
readonly isWorkingOrWorkProgress$: Observable<DbxActionWorkOrWorkProgress>;
|
|
94
108
|
/**
|
|
95
109
|
* Pipes the current error.
|
|
96
110
|
*/
|
|
@@ -166,6 +180,10 @@ export declare class ActionContextStore<T = unknown, O = unknown> extends Compon
|
|
|
166
180
|
* Notifys the context that the action is in progress.
|
|
167
181
|
*/
|
|
168
182
|
readonly startWorking: () => void;
|
|
183
|
+
/**
|
|
184
|
+
* Updates the working progress.
|
|
185
|
+
*/
|
|
186
|
+
readonly setWorkProgress: (() => void) | ((observableOrValue: Maybe<number> | Observable<Maybe<number>>) => import("rxjs").Subscription);
|
|
169
187
|
/**
|
|
170
188
|
* Triggers rejection of the action. The value is cleared.
|
|
171
189
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Observable, Subscription } from 'rxjs';
|
|
2
|
-
import { LockSet, LoadingState, LoadingStateType } from '@dereekb/rxjs';
|
|
2
|
+
import { LockSet, LoadingState, LoadingStateType, MaybeObservableOrValue } from '@dereekb/rxjs';
|
|
3
3
|
import { Destroyable, Maybe, ReadableError } from '@dereekb/util';
|
|
4
4
|
import { ActionContextState, ActionContextStore } from './action.store';
|
|
5
|
-
import { DbxActionDisabledKey, DbxActionRejectedPair, DbxActionState, DbxActionSuccessPair } from './action';
|
|
5
|
+
import { DbxActionDisabledKey, DbxActionRejectedPair, DbxActionState, DbxActionSuccessPair, DbxActionWorkOrWorkProgress, DbxActionWorkProgress } from './action';
|
|
6
6
|
/**
|
|
7
7
|
* Source that provides a ActionContextStore observable.
|
|
8
8
|
*/
|
|
@@ -45,6 +45,7 @@ export declare class DbxActionContextStoreSourceInstance<T = unknown, O = unknow
|
|
|
45
45
|
get valueReady$(): Observable<T>;
|
|
46
46
|
get success$(): Observable<Maybe<O>>;
|
|
47
47
|
get successPair$(): Observable<DbxActionSuccessPair<T, O>>;
|
|
48
|
+
get workProgress$(): Observable<Maybe<DbxActionWorkProgress>>;
|
|
48
49
|
get error$(): Observable<Maybe<ReadableError>>;
|
|
49
50
|
get rejected$(): Observable<Maybe<ReadableError>>;
|
|
50
51
|
get rejectedPair$(): Observable<DbxActionRejectedPair<T>>;
|
|
@@ -56,6 +57,7 @@ export declare class DbxActionContextStoreSourceInstance<T = unknown, O = unknow
|
|
|
56
57
|
get loadingState$(): Observable<LoadingState<O>>;
|
|
57
58
|
get loadingStateType$(): Observable<LoadingStateType>;
|
|
58
59
|
get isWorking$(): Observable<boolean>;
|
|
60
|
+
get isWorkingOrWorkProgress$(): Observable<DbxActionWorkOrWorkProgress>;
|
|
59
61
|
get isSuccess$(): Observable<boolean>;
|
|
60
62
|
get disabledKeys$(): Observable<string[]>;
|
|
61
63
|
get isDisabled$(): Observable<boolean>;
|
|
@@ -64,6 +66,7 @@ export declare class DbxActionContextStoreSourceInstance<T = unknown, O = unknow
|
|
|
64
66
|
disable(key?: DbxActionDisabledKey, disable?: boolean): void;
|
|
65
67
|
setIsSame(isSame?: boolean | Observable<boolean> | Observable<void>): void;
|
|
66
68
|
setIsModified(isModified?: boolean | Observable<boolean> | Observable<void>): void;
|
|
69
|
+
setWorkProgress(workProgress: MaybeObservableOrValue<DbxActionWorkProgress>): void;
|
|
67
70
|
trigger(): void;
|
|
68
71
|
triggerWithValue(value: T | Observable<T>): void;
|
|
69
72
|
readyValue(value: T | Observable<T>): void;
|
package/lib/button/button.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { Type, Provider } from '@angular/core';
|
|
2
2
|
import { type Maybe } from '@dereekb/util';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
+
import { type DbxActionWorkProgress, type DbxActionWorkOrWorkProgress } from '../action/action';
|
|
5
|
+
export type DbxButtonWorkingProgress = DbxActionWorkProgress;
|
|
6
|
+
/**
|
|
7
|
+
* Working state for a button.
|
|
8
|
+
*
|
|
9
|
+
* Can be a boolean or a number.
|
|
10
|
+
*
|
|
11
|
+
* True is treated as an indeterminate progress.
|
|
12
|
+
*/
|
|
13
|
+
export type DbxButtonWorking = DbxActionWorkOrWorkProgress;
|
|
4
14
|
/**
|
|
5
15
|
* Used for intercepting button click events.
|
|
6
16
|
*
|
|
@@ -33,7 +43,7 @@ export declare abstract class DbxButton {
|
|
|
33
43
|
/**
|
|
34
44
|
* Observable of the working state of the button.
|
|
35
45
|
*/
|
|
36
|
-
abstract readonly working$: Observable<
|
|
46
|
+
abstract readonly working$: Observable<DbxButtonWorking>;
|
|
37
47
|
/**
|
|
38
48
|
* Observable of the clicked event of the button.
|
|
39
49
|
*/
|
|
@@ -49,11 +59,15 @@ export declare abstract class DbxButton {
|
|
|
49
59
|
*/
|
|
50
60
|
abstract setDisabled(disabled?: Maybe<boolean>): void;
|
|
51
61
|
/**
|
|
52
|
-
* Sets the working state of the button.
|
|
62
|
+
* Sets the working state of the button.
|
|
63
|
+
*
|
|
64
|
+
* If a number is passed, then it is treated as a progress percentage.
|
|
65
|
+
*
|
|
66
|
+
* If true is passed, then it is treated as an indeterminate progress.
|
|
53
67
|
*
|
|
54
|
-
*
|
|
68
|
+
* If null/undefined is passed, then the button will not be working.
|
|
55
69
|
*/
|
|
56
|
-
abstract setWorking(working?: Maybe<
|
|
70
|
+
abstract setWorking(working?: Maybe<DbxButtonWorking>): void;
|
|
57
71
|
/**
|
|
58
72
|
* Sets the display content of the button.
|
|
59
73
|
*
|
|
@@ -2,7 +2,7 @@ import { OnDestroy, OnInit, Signal } from '@angular/core';
|
|
|
2
2
|
import { type Maybe } from '@dereekb/util';
|
|
3
3
|
import { Subject, BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { AbstractSubscriptionDirective } from '../subscription';
|
|
5
|
-
import { DbxButton, DbxButtonDisplay, DbxButtonDisplayType, DbxButtonInterceptor } from './button';
|
|
5
|
+
import { DbxButton, DbxButtonDisplay, DbxButtonDisplayType, DbxButtonInterceptor, DbxButtonWorking } from './button';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* Abstract button component.
|
|
@@ -15,13 +15,14 @@ export declare abstract class AbstractDbxButtonDirective extends AbstractSubscri
|
|
|
15
15
|
protected readonly _buttonInterceptor: BehaviorSubject<Maybe<DbxButtonInterceptor>>;
|
|
16
16
|
readonly buttonClick: import("@angular/core").OutputEmitterRef<void>;
|
|
17
17
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, Maybe<boolean>>;
|
|
18
|
-
readonly working: import("@angular/core").InputSignalWithTransform<
|
|
18
|
+
readonly working: import("@angular/core").InputSignalWithTransform<import("@dereekb/dbx-core").DbxActionWorkOrWorkProgress, Maybe<import("@dereekb/dbx-core").DbxActionWorkOrWorkProgress>>;
|
|
19
19
|
readonly buttonDisplay: import("@angular/core").InputSignal<Maybe<DbxButtonDisplay>>;
|
|
20
20
|
private readonly _disabledSignal;
|
|
21
21
|
private readonly _workingSignal;
|
|
22
22
|
private readonly _buttonDisplayContentSignal;
|
|
23
23
|
readonly disabledSignal: Signal<boolean>;
|
|
24
|
-
readonly workingSignal: Signal<
|
|
24
|
+
readonly workingSignal: Signal<import("@dereekb/dbx-core").DbxActionWorkOrWorkProgress>;
|
|
25
|
+
readonly isWorkingSignal: Signal<boolean>;
|
|
25
26
|
readonly icon: import("@angular/core").InputSignal<Maybe<string>>;
|
|
26
27
|
readonly text: import("@angular/core").InputSignal<Maybe<string>>;
|
|
27
28
|
readonly buttonDisplayContentSignal: Signal<DbxButtonDisplay>;
|
|
@@ -29,13 +30,13 @@ export declare abstract class AbstractDbxButtonDirective extends AbstractSubscri
|
|
|
29
30
|
readonly iconSignal: Signal<Maybe<string>>;
|
|
30
31
|
readonly textSignal: Signal<Maybe<string>>;
|
|
31
32
|
readonly disabled$: import("rxjs").Observable<boolean>;
|
|
32
|
-
readonly working$: import("rxjs").Observable<
|
|
33
|
+
readonly working$: import("rxjs").Observable<import("@dereekb/dbx-core").DbxActionWorkOrWorkProgress>;
|
|
33
34
|
readonly display$: import("rxjs").Observable<DbxButtonDisplay>;
|
|
34
35
|
readonly clicked$: import("rxjs").Observable<void>;
|
|
35
36
|
ngOnInit(): void;
|
|
36
37
|
ngOnDestroy(): void;
|
|
37
38
|
setDisabled(disabled?: Maybe<boolean>): void;
|
|
38
|
-
setWorking(working?: Maybe<
|
|
39
|
+
setWorking(working?: Maybe<DbxButtonWorking>): void;
|
|
39
40
|
setDisplayContent(content: DbxButtonDisplay): void;
|
|
40
41
|
/**
|
|
41
42
|
* Sets the button interceptor. If any interceptor is already set, it is replaced.
|
|
@@ -2,7 +2,7 @@ import { OnDestroy } from '@angular/core';
|
|
|
2
2
|
import { FilterMap } from '@dereekb/rxjs';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
5
|
-
* Direction that provides
|
|
5
|
+
* Direction that provides a FilterMap.
|
|
6
6
|
*/
|
|
7
7
|
export declare class DbxFilterMapDirective<F> implements OnDestroy {
|
|
8
8
|
readonly filterMap: FilterMap<any>;
|
package/lib/injection/index.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StaticProvider } from '@angular/core';
|
|
2
|
+
import { ArrayOrValue, Maybe } from '@dereekb/util';
|
|
3
|
+
/**
|
|
4
|
+
* Merges the input providers into a single array.
|
|
5
|
+
*
|
|
6
|
+
* @param providers
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function mergeStaticProviders(...providers: Maybe<ArrayOrValue<StaticProvider>>[]): StaticProvider[];
|