@redhat-cloud-services/frontend-components-utilities 3.2.17 → 3.2.20
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.
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Dispatch, AnyAction } from 'redux';
|
|
2
|
-
export declare type Listener = {
|
|
3
|
-
callback: (
|
|
2
|
+
export declare type Listener<T = any> = {
|
|
3
|
+
callback: (data: {
|
|
4
|
+
data: T;
|
|
5
|
+
preventBubble: () => boolean;
|
|
6
|
+
}) => void;
|
|
4
7
|
on: string;
|
|
5
8
|
};
|
|
6
9
|
export declare class MiddlewareListener {
|
|
7
10
|
listeners: Set<Listener>;
|
|
8
11
|
constructor();
|
|
9
|
-
getListeners(): Set<Listener
|
|
12
|
+
getListeners(): Set<Listener<any>>;
|
|
10
13
|
getMiddleware(): () => (next: Dispatch<AnyAction>) => (action: AnyAction) => void;
|
|
11
14
|
addNew(listener: Listener): () => boolean;
|
|
12
15
|
callOnAction(action: string, data: unknown): boolean;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { compose, ActionCreator } from 'redux';
|
|
1
|
+
import { compose, ActionCreator, Store, Reducer, Middleware } from 'redux';
|
|
2
2
|
export declare function applyReducerHash(reducerHash: any, initialState?: Record<string, unknown>): (state: Record<string, unknown> | undefined, action: {
|
|
3
3
|
type: PropertyKey;
|
|
4
4
|
}) => any;
|
|
5
|
-
export declare function dispatchActionsToStore(actions: Record<string, ActionCreator<any>>, store:
|
|
5
|
+
export declare function dispatchActionsToStore<T extends Record<string, ActionCreator<any>>>(actions: Record<string, ActionCreator<any>>, store: Store): T;
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
8
8
|
REDUX_DEVTOOLS_EXTENSION_COMPOSE?: typeof compose;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export declare class ReducerRegistry {
|
|
12
|
-
store:
|
|
13
|
-
reducers: Record<string,
|
|
14
|
-
constructor(initState?:
|
|
15
|
-
getStore():
|
|
16
|
-
register(newReducers: Record<string,
|
|
11
|
+
export declare class ReducerRegistry<T extends Record<string, unknown>> {
|
|
12
|
+
store: Store;
|
|
13
|
+
reducers: Record<string, Reducer>;
|
|
14
|
+
constructor(initState?: T, middlewares?: Middleware[], composeEnhancersDefault?: typeof compose);
|
|
15
|
+
getStore(): Store<T>;
|
|
16
|
+
register(newReducers: Record<string, Reducer>): () => void;
|
|
17
17
|
}
|
|
18
|
-
export declare const reduxRegistry: ReducerRegistry
|
|
18
|
+
export declare const reduxRegistry: ReducerRegistry<Record<string, unknown>>;
|
|
19
19
|
export default ReducerRegistry;
|
|
@@ -58,7 +58,10 @@ var ReducerRegistry = (function () {
|
|
|
58
58
|
this.store.replaceReducer((0, redux_1.combineReducers)(__assign({}, this.reducers)));
|
|
59
59
|
return function () {
|
|
60
60
|
_this.reducers = Object.entries(_this.reducers)
|
|
61
|
-
.filter(function (
|
|
61
|
+
.filter(function (_a) {
|
|
62
|
+
var reducer = _a[0];
|
|
63
|
+
return !Object.keys(newReducers).includes(reducer);
|
|
64
|
+
})
|
|
62
65
|
.reduce(function (acc, _a) {
|
|
63
66
|
var _b;
|
|
64
67
|
var key = _a[0], val = _a[1];
|
package/Registry/Registry.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export let registry: any
|
|
1
|
+
import { Middleware, compose } from 'redux';
|
|
2
|
+
import ReducerRegistry from '../ReducerRegistry';
|
|
3
|
+
export declare let registry: ReducerRegistry<any>;
|
|
4
|
+
export declare function registryDecorator(): (target: React.ComponentClass) => void;
|
|
5
|
+
export declare function getRegistry<T extends Record<string, unknown>>(initialState?: T, middleware?: Middleware[], composeEnhancersDefault?: typeof compose): ReducerRegistry<any>;
|
|
4
6
|
export default registryDecorator;
|
|
@@ -53,7 +53,10 @@ var ReducerRegistry = (function () {
|
|
|
53
53
|
this.store.replaceReducer(combineReducers(__assign({}, this.reducers)));
|
|
54
54
|
return function () {
|
|
55
55
|
_this.reducers = Object.entries(_this.reducers)
|
|
56
|
-
.filter(function (
|
|
56
|
+
.filter(function (_a) {
|
|
57
|
+
var reducer = _a[0];
|
|
58
|
+
return !Object.keys(newReducers).includes(reducer);
|
|
59
|
+
})
|
|
57
60
|
.reduce(function (acc, _a) {
|
|
58
61
|
var _b;
|
|
59
62
|
var key = _a[0], val = _a[1];
|