@sumaris-net/ngx-components 18.11.0 → 18.12.1
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/doc/changelog.md +4 -0
- package/esm2022/src/app/core/services/model/entity.decorators.mjs +1 -1
- package/esm2022/src/app/core/services/model/filter.model.mjs +1 -1
- package/esm2022/src/app/shared/rx-state/rx-state.decorators.mjs +179 -33
- package/fesm2022/sumaris-net.ngx-components.mjs +179 -33
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/model/entity.decorators.d.ts +3 -3
- package/src/app/core/services/model/filter.model.d.ts +1 -1
- package/src/app/shared/rx-state/rx-state.decorators.d.ts +39 -3
- package/src/assets/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Entity } from './entity.model';
|
|
2
|
-
declare type Constructor = new (...args: any[]) =>
|
|
2
|
+
declare type Constructor<T = any> = new (...args: any[]) => T;
|
|
3
3
|
export declare class EntityClasses {
|
|
4
|
-
static CLASSES_BY_NAME: Map<string, Constructor
|
|
4
|
+
static CLASSES_BY_NAME: Map<string, Constructor<any>>;
|
|
5
5
|
static register(typename: string, entityClass: Constructor): void;
|
|
6
6
|
static get<T extends Entity<T>>(entityName: string): Constructor;
|
|
7
7
|
static fromObject<T extends Entity<T>>(value: any, opts?: {
|
|
@@ -13,5 +13,5 @@ export declare class EntityClasses {
|
|
|
13
13
|
export declare function EntityClass(opts: {
|
|
14
14
|
typename: string;
|
|
15
15
|
fromObjectReuseStrategy?: 'default' | 'clone';
|
|
16
|
-
}): <T extends Constructor
|
|
16
|
+
}): <T extends Constructor<any>>(constructor: T) => T;
|
|
17
17
|
export {};
|
|
@@ -6,7 +6,7 @@ export interface IEntityFilter<F extends IEntityFilter<F, T, ID, AO, FO>, T exte
|
|
|
6
6
|
isEmpty(): boolean;
|
|
7
7
|
countNotEmptyCriteria(): number;
|
|
8
8
|
}
|
|
9
|
-
export declare abstract class EntityFilter<F extends
|
|
9
|
+
export declare abstract class EntityFilter<F extends IEntityFilter<F, T, ID, AO, FO>, T extends IEntity<T, any>, ID = number, AO extends EntityAsObjectOptions = EntityAsObjectOptions, FO = any> extends Entity<F, ID, AO, FO> implements IEntityFilter<F, T, ID, AO, FO> {
|
|
10
10
|
/**
|
|
11
11
|
* Compose some filter functions: all should return true
|
|
12
12
|
*
|
|
@@ -1,7 +1,43 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
1
2
|
import { ProjectValueReducer } from '@rx-angular/state';
|
|
2
3
|
export declare function enableRxStateProdMode(): void;
|
|
4
|
+
type ObservablePropertyDecorator<T> = <K extends PropertyKey>(target: any, propertyKey: K) => void;
|
|
5
|
+
type StatePropertyDecorator<T> = <K extends PropertyKey>(target: any, propertyKey: K) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Decorator to register the RxState property in a component
|
|
8
|
+
* Must be used once per class hierarchy
|
|
9
|
+
*/
|
|
3
10
|
export declare function RxStateRegister(): PropertyDecorator;
|
|
4
|
-
|
|
5
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Decorator for RxState properties with getter/setter access
|
|
13
|
+
* Creates reactive properties that sync with RxState
|
|
14
|
+
*/
|
|
15
|
+
export declare function RxStateProperty<T = any, K extends keyof T = any, V extends T[K] = any>(statePropertyName?: string | K, projectValueReducer?: ProjectValueReducer<T, K, V>): StatePropertyDecorator<V>;
|
|
16
|
+
/**
|
|
17
|
+
* Decorator for RxState observable selectors
|
|
18
|
+
* Creates observable properties that select from RxState
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ IMPORTANT: La propriété décorée DOIT être typée comme Observable<T>
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* @RxStateSelect()
|
|
25
|
+
* protected pmfms$: Observable<IPmfm[]>; // ✅ Correct
|
|
26
|
+
*
|
|
27
|
+
* @RxStateSelect()
|
|
28
|
+
* protected badProperty: boolean; // ❌ TypeScript Error
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function RxStateSelect<T = any, R = T[keyof T]>(statePropertyName?: string | keyof T | '$', opts?: {
|
|
6
32
|
stateName?: string;
|
|
7
|
-
}):
|
|
33
|
+
}): ObservablePropertyDecorator<Observable<R>>;
|
|
34
|
+
/**
|
|
35
|
+
* Utility decorator to create computed observables from state
|
|
36
|
+
*
|
|
37
|
+
* ⚠️ IMPORTANT: La propriété décorée DOIT être typée comme Observable<T>
|
|
38
|
+
*/
|
|
39
|
+
export declare function RxStateComputed<T = any, K extends keyof T = any, R = any>(dependencies: K[], computeFn?: (slice: Pick<T, K>) => R, opts?: {
|
|
40
|
+
stateName?: string;
|
|
41
|
+
keyCompareMap?: any;
|
|
42
|
+
}): ObservablePropertyDecorator<Observable<R>>;
|
|
43
|
+
export {};
|
package/src/assets/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ngx-sumaris-components",
|
|
3
3
|
"short_name": "ngx-sumaris-components",
|
|
4
4
|
"manifest_version": 1,
|
|
5
|
-
"version": "18.
|
|
5
|
+
"version": "18.12.1",
|
|
6
6
|
"default_locale": "fr",
|
|
7
7
|
"description": "Angular components for building beautiful and responsive Apps",
|
|
8
8
|
"icons": [{
|