@sumaris-net/ngx-components 18.14.2 → 18.14.4
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/src/app/shared/rx-state/rx-state.decorators.mjs +64 -121
- package/esm2022/src/app/social/feed/feed.component.mjs +14 -21
- package/fesm2022/sumaris-net.ngx-components.mjs +76 -138
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/inputs.d.ts +1 -1
- package/src/app/shared/rx-state/rx-state.decorators.d.ts +1 -17
- package/src/app/social/feed/feed.component.d.ts +8 -8
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ export interface InputElement extends FocusableElement {
|
|
|
17
17
|
}
|
|
18
18
|
export declare function isInputElement(object: any): object is InputElement;
|
|
19
19
|
export declare function asInputElement<T = any>(object: ElementRef<T>): InputElement | undefined;
|
|
20
|
-
export declare function tabindexComparator(a: InputElement, b: InputElement):
|
|
20
|
+
export declare function tabindexComparator(a: InputElement, b: InputElement): 1 | -1 | 0;
|
|
21
21
|
export interface CanGainFocusOptions {
|
|
22
22
|
minTabindex?: number;
|
|
23
23
|
maxTabindex?: number;
|
|
@@ -5,36 +5,20 @@ type ObservablePropertyDecorator<T> = <K extends PropertyKey>(target: any, prope
|
|
|
5
5
|
type StatePropertyDecorator<T> = <K extends PropertyKey>(target: any, propertyKey: K) => void;
|
|
6
6
|
/**
|
|
7
7
|
* Decorator to register the RxState property in a component
|
|
8
|
-
* Must be used once per class hierarchy
|
|
9
8
|
*/
|
|
10
9
|
export declare function RxStateRegister(): PropertyDecorator;
|
|
11
10
|
/**
|
|
12
11
|
* Decorator for RxState properties with getter/setter access
|
|
13
|
-
* Creates reactive properties that sync with RxState
|
|
14
12
|
*/
|
|
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>;
|
|
13
|
+
export declare function RxStateProperty<T extends object = any, K extends keyof T = any, V extends T[K] = any>(statePropertyName?: string | K, projectValueReducer?: ProjectValueReducer<T, K, V>): StatePropertyDecorator<V>;
|
|
16
14
|
/**
|
|
17
15
|
* 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
16
|
*/
|
|
31
17
|
export declare function RxStateSelect<T = any, R = T[keyof T]>(statePropertyName?: string | keyof T | '$', opts?: {
|
|
32
18
|
stateName?: string;
|
|
33
19
|
}): ObservablePropertyDecorator<Observable<R>>;
|
|
34
20
|
/**
|
|
35
21
|
* 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
22
|
*/
|
|
39
23
|
export declare function RxStateComputed<T = any, K extends keyof T = any, R = any>(dependencies: K[], computeFn?: (slice: Pick<T, K>) => R, opts?: {
|
|
40
24
|
stateName?: string;
|
|
@@ -2,31 +2,31 @@ import { RxState } from '@rx-angular/state';
|
|
|
2
2
|
import { TranslateService } from '@ngx-translate/core';
|
|
3
3
|
import { Router } from '@angular/router';
|
|
4
4
|
import { JsonFeed } from './feed.model';
|
|
5
|
-
import { Observable } from 'rxjs';
|
|
6
5
|
import { PlatformService } from '../../core/services/platform.service';
|
|
7
6
|
import { Environment } from '../../../environments/environment.class';
|
|
8
7
|
import { AppColors } from '../../shared/types';
|
|
9
8
|
import { IFeedService } from './feed.service';
|
|
10
9
|
import * as i0 from "@angular/core";
|
|
11
|
-
export interface FeedState {
|
|
10
|
+
export interface FeedState<T> {
|
|
12
11
|
maxAgeInMonths: number;
|
|
13
12
|
maxContentLength: number;
|
|
14
|
-
feeds:
|
|
13
|
+
feeds: T[];
|
|
15
14
|
hasFeeds: boolean;
|
|
16
15
|
}
|
|
17
16
|
export declare class FeedsComponent<T extends JsonFeed = JsonFeed> {
|
|
18
17
|
protected environment: Environment;
|
|
19
18
|
feedService: IFeedService<T>;
|
|
20
19
|
protected _debug: boolean;
|
|
21
|
-
protected _state: RxState<FeedState
|
|
20
|
+
protected _state: RxState<FeedState<T>>;
|
|
22
21
|
protected translate: TranslateService;
|
|
23
22
|
protected platform: PlatformService;
|
|
24
23
|
protected router: Router;
|
|
25
24
|
protected version: string;
|
|
26
|
-
feeds$: Observable<T[]>;
|
|
27
|
-
hasFeeds$: Observable<boolean>;
|
|
28
|
-
feeds: T[];
|
|
29
|
-
|
|
25
|
+
feeds$: import("rxjs").Observable<T[]>;
|
|
26
|
+
hasFeeds$: import("rxjs").Observable<boolean>;
|
|
27
|
+
set feeds(value: T[]);
|
|
28
|
+
get feeds(): T[];
|
|
29
|
+
get hasFeeds(): boolean;
|
|
30
30
|
showHeader: boolean;
|
|
31
31
|
headerTextColor: AppColors;
|
|
32
32
|
constructor(environment: Environment, feedService: IFeedService<T>);
|