@sumaris-net/ngx-components 18.16.6 → 18.16.8
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 +9 -0
- package/esm2022/public_api.mjs +2 -1
- package/esm2022/src/app/core/graphql/graphql.service.mjs +16 -30
- package/esm2022/src/app/core/home/home.mjs +3 -3
- package/esm2022/src/app/core/services/account.service.mjs +3 -3
- package/esm2022/src/app/core/services/local-settings.service.mjs +3 -3
- package/esm2022/src/app/core/services/network.service.mjs +102 -34
- package/esm2022/src/app/social/feed/feed.component.mjs +82 -22
- package/esm2022/src/app/social/feed/feed.module.mjs +5 -4
- package/esm2022/src/app/social/feed/feed.page.mjs +67 -0
- package/esm2022/src/app/social/feed/feed.service.mjs +3 -3
- package/esm2022/src/app/social/feed/testing/feed.testing.mjs +1 -1
- package/esm2022/src/app/social/social.testing.module.mjs +7 -1
- package/esm2022/src/environments/environment.mjs +4 -3
- package/fesm2022/sumaris-net.ngx-components.mjs +257 -86
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
- package/src/app/core/graphql/graphql.service.d.ts +5 -9
- package/src/app/core/services/network.service.d.ts +28 -10
- package/src/app/shared/inputs.d.ts +1 -1
- package/src/app/social/feed/feed.component.d.ts +18 -4
- package/src/app/social/feed/feed.module.d.ts +7 -6
- package/src/app/social/feed/feed.page.d.ts +24 -0
- package/src/app/social/feed/feed.service.d.ts +2 -0
- package/src/assets/manifest.json +1 -1
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -285,6 +285,7 @@ export * from './src/app/social/message/message.service';
|
|
|
285
285
|
export * from './src/app/social/message/message.form';
|
|
286
286
|
export * from './src/app/social/message/message.modal';
|
|
287
287
|
export * from './src/app/social/feed/feed.component';
|
|
288
|
+
export * from './src/app/social/feed/feed.page';
|
|
288
289
|
export * from './src/app/social/feed/feed.service';
|
|
289
290
|
export * from './src/app/social/feed/feed.model';
|
|
290
291
|
export * from './src/app/social/feed/feed.directive';
|
|
@@ -16,6 +16,7 @@ import { PropertyMap } from '../../shared/types';
|
|
|
16
16
|
import { StartableService } from '../../shared/services/startable-service.class';
|
|
17
17
|
import { StorageService } from '../../shared/storage/storage.service';
|
|
18
18
|
import { DocumentNode } from 'graphql';
|
|
19
|
+
import { LocalSettingsService } from '../services/local-settings.service';
|
|
19
20
|
import * as i0 from "@angular/core";
|
|
20
21
|
export interface WatchQueryOptions<V> {
|
|
21
22
|
query: any;
|
|
@@ -35,23 +36,19 @@ export interface MutateQueryOptions<TData, TVariables = OperationVariables, TCon
|
|
|
35
36
|
}
|
|
36
37
|
export declare const APP_GRAPHQL_TYPE_POLICIES: InjectionToken<TypePolicies>;
|
|
37
38
|
export declare const APP_GRAPHQL_FRAGMENTS: InjectionToken<DocumentNode[]>;
|
|
38
|
-
export interface ConnectionParams extends Record<string, string> {
|
|
39
|
-
authToken?: string;
|
|
40
|
-
authBasic?: string;
|
|
41
|
-
}
|
|
42
39
|
export declare class GraphqlService extends StartableService<ApolloClient<any>> {
|
|
43
40
|
private platform;
|
|
44
41
|
private apollo;
|
|
45
42
|
private httpLink;
|
|
46
43
|
private network;
|
|
47
44
|
private storage;
|
|
45
|
+
private settings;
|
|
48
46
|
protected environment: Environment;
|
|
49
47
|
private typePolicies;
|
|
50
48
|
private fragments;
|
|
51
49
|
private readonly _networkStatusChanged$;
|
|
52
50
|
private httpParams;
|
|
53
51
|
private wsParams;
|
|
54
|
-
private connectionParams;
|
|
55
52
|
private readonly _defaultFetchPolicy;
|
|
56
53
|
private onNetworkError;
|
|
57
54
|
private customErrors;
|
|
@@ -59,9 +56,8 @@ export declare class GraphqlService extends StartableService<ApolloClient<any>>
|
|
|
59
56
|
get client(): ApolloClient<any>;
|
|
60
57
|
get cache(): ApolloCache<any>;
|
|
61
58
|
get defaultFetchPolicy(): WatchQueryFetchPolicy;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setAuthBasic(basic: string): Promise<void>;
|
|
59
|
+
private get connectionParams();
|
|
60
|
+
constructor(platform: Platform, apollo: Apollo, httpLink: HttpLink, network: NetworkService, storage: StorageService, settings: LocalSettingsService, environment: Environment, typePolicies: TypePolicies, fragments: DocumentNode[]);
|
|
65
61
|
/**
|
|
66
62
|
* Allow to add a field resolver
|
|
67
63
|
* (see doc: https://www.apollographql.com/docs/react/data/local-state/#handling-client-fields-with-resolvers)
|
|
@@ -137,6 +133,6 @@ export declare class GraphqlService extends StartableService<ApolloClient<any>>
|
|
|
137
133
|
private createAppErrorByCode;
|
|
138
134
|
private getI18nErrorMessageByCode;
|
|
139
135
|
private toAppError;
|
|
140
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<GraphqlService, [null, null, null, null, null, null, { optional: true; }, { optional: true; }]>;
|
|
136
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GraphqlService, [null, null, null, null, null, null, null, { optional: true; }, { optional: true; }]>;
|
|
141
137
|
static ɵprov: i0.ɵɵInjectableDeclaration<GraphqlService>;
|
|
142
138
|
}
|
|
@@ -17,6 +17,10 @@ import { StartableObservableService } from '../../shared/services/startable-obse
|
|
|
17
17
|
import { NetworkEventType } from './network.types';
|
|
18
18
|
import { ILoggingService } from '../../shared/logging/logger.model';
|
|
19
19
|
import * as i0 from "@angular/core";
|
|
20
|
+
export interface ConnectionParams extends Record<string, string> {
|
|
21
|
+
authToken?: string;
|
|
22
|
+
authBasic?: string;
|
|
23
|
+
}
|
|
20
24
|
export declare const PEER_URL_REGEXP: RegExp;
|
|
21
25
|
export declare const NETWORK_DEFAULT_CONNECTION_TIMEOUT = 10000;
|
|
22
26
|
export declare class NetworkService extends StartableObservableService<Peer, Peer> {
|
|
@@ -41,6 +45,7 @@ export declare class NetworkService extends StartableObservableService<Peer, Pee
|
|
|
41
45
|
private _deviceConnectionType;
|
|
42
46
|
private _forceOffline;
|
|
43
47
|
private readonly _connectionTimeout;
|
|
48
|
+
private readonly _connectionParams;
|
|
44
49
|
private _listeners;
|
|
45
50
|
get online(): boolean;
|
|
46
51
|
get offline(): boolean;
|
|
@@ -49,6 +54,7 @@ export declare class NetworkService extends StartableObservableService<Peer, Pee
|
|
|
49
54
|
get peer(): Peer;
|
|
50
55
|
set peer(peer: Peer);
|
|
51
56
|
get connectionTimeout(): number;
|
|
57
|
+
get connectionParams(): ConnectionParams;
|
|
52
58
|
constructor(_document: any, platform: Platform, modalCtrl: ModalController, storage: Storage, settings: LocalSettingsService, cache: CacheService, http: HttpClient, environment: Environment, loggingService: ILoggingService, translate: TranslateService, toastController: ToastController);
|
|
53
59
|
/**
|
|
54
60
|
* Register to network event
|
|
@@ -111,7 +117,27 @@ export declare class NetworkService extends StartableObservableService<Peer, Pee
|
|
|
111
117
|
clearCache(opts?: {
|
|
112
118
|
emitEvent?: boolean;
|
|
113
119
|
}): Promise<void>;
|
|
114
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Sends a GET request to the specified path and returns a promise of the response.
|
|
122
|
+
*
|
|
123
|
+
* @param {string} path The endpoint path to send the GET request to.
|
|
124
|
+
* @param {Object} [opts] Optional parameters for the GET request.
|
|
125
|
+
* @param {HttpHeaders | Object} [opts.headers] Headers to include in the request. Can be an instance of HttpHeaders or an object with header key-value pairs.
|
|
126
|
+
* @param {'json'} [opts.responseType] The type of response expected. Defaults to 'json'.
|
|
127
|
+
* @param {boolean} [opts.nocache] If true, indicates that the response should not be cached.
|
|
128
|
+
* @param {number} [opts.timeout] The timeout for the request in milliseconds.
|
|
129
|
+
* @return {Promise<T>} A promise that resolves with the response of type T.
|
|
130
|
+
*/
|
|
131
|
+
get<T>(path: string, opts?: {
|
|
132
|
+
headers?: HttpHeaders | {
|
|
133
|
+
[header: string]: string | string[];
|
|
134
|
+
};
|
|
135
|
+
responseType?: 'json';
|
|
136
|
+
nocache?: boolean;
|
|
137
|
+
timeout?: number;
|
|
138
|
+
}): Promise<T>;
|
|
139
|
+
setAuthToken(token: string): Promise<void>;
|
|
140
|
+
setAuthBasic(basic: string): Promise<void>;
|
|
115
141
|
protected ngOnStart(peer?: Peer): Promise<Peer>;
|
|
116
142
|
protected ngOnAfterStart(peer: Peer): Promise<void>;
|
|
117
143
|
protected ngOnStop(): void;
|
|
@@ -138,15 +164,7 @@ export declare class NetworkService extends StartableObservableService<Peer, Pee
|
|
|
138
164
|
responseType?: 'text';
|
|
139
165
|
nocache?: boolean;
|
|
140
166
|
}): Promise<string>;
|
|
141
|
-
protected
|
|
142
|
-
headers?: HttpHeaders | {
|
|
143
|
-
[header: string]: string | string[];
|
|
144
|
-
};
|
|
145
|
-
responseType?: 'json';
|
|
146
|
-
nocache?: boolean;
|
|
147
|
-
timeout?: number;
|
|
148
|
-
}): Promise<T>;
|
|
149
|
-
protected addVersionHeader<T extends {
|
|
167
|
+
protected addAppHeaders<T extends {
|
|
150
168
|
headers?: HttpHeaders | {
|
|
151
169
|
[header: string]: string | string[];
|
|
152
170
|
};
|
|
@@ -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;
|
|
@@ -2,11 +2,14 @@ import { OnDestroy, OnInit } from '@angular/core';
|
|
|
2
2
|
import { RxState } from '@rx-angular/state';
|
|
3
3
|
import { TranslateService } from '@ngx-translate/core';
|
|
4
4
|
import { Router } from '@angular/router';
|
|
5
|
-
import { JsonFeed } from './feed.model';
|
|
5
|
+
import { JsonFeed, JsonFeedItem } from './feed.model';
|
|
6
6
|
import { PlatformService } from '../../core/services/platform.service';
|
|
7
7
|
import { Environment } from '../../../environments/environment.class';
|
|
8
8
|
import { AppColors } from '../../shared/types';
|
|
9
9
|
import { IFeedService } from './feed.service';
|
|
10
|
+
import { NetworkService } from '../../core/services/network.service';
|
|
11
|
+
import { IonModal } from '@ionic/angular';
|
|
12
|
+
import { LocalSettingsService } from '../../core/services/local-settings.service';
|
|
10
13
|
import * as i0 from "@angular/core";
|
|
11
14
|
export interface FeedState<T> {
|
|
12
15
|
maxAgeInMonths: number;
|
|
@@ -15,23 +18,31 @@ export interface FeedState<T> {
|
|
|
15
18
|
feeds: T[];
|
|
16
19
|
hasFeeds: boolean;
|
|
17
20
|
}
|
|
21
|
+
export type FilterItemFunction = (item: JsonFeedItem) => boolean;
|
|
22
|
+
export declare const NOOP_ITEM_FILTER: FilterItemFunction;
|
|
18
23
|
export declare class FeedsComponent<T extends JsonFeed = JsonFeed> implements OnInit, OnDestroy {
|
|
19
24
|
protected environment: Environment;
|
|
20
25
|
feedService: IFeedService<T>;
|
|
21
26
|
protected _state: RxState<FeedState<T>>;
|
|
22
27
|
protected translate: TranslateService;
|
|
23
28
|
protected platform: PlatformService;
|
|
29
|
+
protected networkService: NetworkService;
|
|
24
30
|
protected router: Router;
|
|
25
31
|
protected version: string;
|
|
32
|
+
protected modalItemId: string;
|
|
26
33
|
feeds$: import("rxjs").Observable<T[]>;
|
|
27
34
|
feedUrls$: import("rxjs").Observable<string[]>;
|
|
28
35
|
hasFeeds$: import("rxjs").Observable<boolean>;
|
|
29
36
|
debug: boolean;
|
|
37
|
+
mobile: boolean;
|
|
30
38
|
showHeader: boolean;
|
|
39
|
+
showReadMoreButton: boolean;
|
|
31
40
|
headerColor: AppColors;
|
|
32
41
|
cardColor: AppColors | 'light-transparent';
|
|
33
42
|
shape: 'round' | 'legacy';
|
|
34
43
|
class: string;
|
|
44
|
+
itemId: string;
|
|
45
|
+
filterItem: FilterItemFunction;
|
|
35
46
|
set feeds(value: T[]);
|
|
36
47
|
get feeds(): T[];
|
|
37
48
|
set feedUrls(value: string[]);
|
|
@@ -42,13 +53,16 @@ export declare class FeedsComponent<T extends JsonFeed = JsonFeed> implements On
|
|
|
42
53
|
set maxContentLength(value: number);
|
|
43
54
|
get maxContentLength(): number;
|
|
44
55
|
get hostClass(): string;
|
|
45
|
-
|
|
56
|
+
modal: IonModal;
|
|
57
|
+
constructor(settings: LocalSettingsService, environment: Environment, feedService: IFeedService<T>);
|
|
46
58
|
ngOnInit(): void;
|
|
47
59
|
ngOnDestroy(): void;
|
|
48
60
|
openFeedHome(feed?: T): Promise<void>;
|
|
61
|
+
openFeedItem(feedItem: JsonFeedItem, feed?: T): Promise<void>;
|
|
49
62
|
openUrl(url: string): Promise<void>;
|
|
50
63
|
openTag(feed: T, tag: string): Promise<void>;
|
|
51
64
|
getTags(feedOrItem?: T | T['items'][0]): string[];
|
|
52
|
-
|
|
53
|
-
static
|
|
65
|
+
protected getFeedHomeUrl(feed: T): string;
|
|
66
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FeedsComponent<any>, [null, null, { optional: true; }]>;
|
|
67
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FeedsComponent<any>, "app-feed", never, { "debug": { "alias": "debug"; "required": false; }; "mobile": { "alias": "mobile"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "showReadMoreButton": { "alias": "showReadMoreButton"; "required": false; }; "headerColor": { "alias": "headerColor"; "required": false; }; "cardColor": { "alias": "cardColor"; "required": false; }; "shape": { "alias": "shape"; "required": false; }; "class": { "alias": "class"; "required": false; }; "itemId": { "alias": "itemId"; "required": false; }; "filterItem": { "alias": "filterItem"; "required": false; }; "feeds": { "alias": "feeds"; "required": false; }; "feedUrls": { "alias": "feedUrls"; "required": false; }; "maxAgeInMonths": { "alias": "maxAgeInMonths"; "required": false; }; "maxContentLength": { "alias": "maxContentLength"; "required": false; }; }, {}, never, never, false, never>;
|
|
54
68
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import * as i1 from "./feed.component";
|
|
3
|
-
import * as i2 from "./feed.
|
|
4
|
-
import * as i3 from "
|
|
5
|
-
import * as i4 from "
|
|
6
|
-
import * as i5 from "
|
|
7
|
-
import * as i6 from "../../shared/
|
|
3
|
+
import * as i2 from "./feed.page";
|
|
4
|
+
import * as i3 from "./feed.directive";
|
|
5
|
+
import * as i4 from "../../shared/shared.module";
|
|
6
|
+
import * as i5 from "@ngx-translate/core";
|
|
7
|
+
import * as i6 from "../../shared/debug/debug.module";
|
|
8
|
+
import * as i7 from "../../shared/markdown/markdown.module";
|
|
8
9
|
export declare class FeedModule {
|
|
9
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<FeedModule, never>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<FeedModule, [typeof i1.FeedsComponent, typeof i2.FeedDirective], [typeof
|
|
11
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<FeedModule, [typeof i1.FeedsComponent, typeof i2.FeedPage, typeof i3.FeedDirective], [typeof i4.SharedModule, typeof i5.TranslateModule, typeof i6.SharedDebugModule, typeof i7.SharedMarkdownModule], [typeof i5.TranslateModule, typeof i1.FeedsComponent, typeof i2.FeedPage, typeof i3.FeedDirective]>;
|
|
11
12
|
static ɵinj: i0.ɵɵInjectorDeclaration<FeedModule>;
|
|
12
13
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { Environment } from '../../../environments/environment.class';
|
|
3
|
+
import { LocalSettingsService } from '../../core/services/local-settings.service';
|
|
4
|
+
import { IFeedService } from './feed.service';
|
|
5
|
+
import { JsonFeed } from './feed.model';
|
|
6
|
+
import { BehaviorSubject, Subject } from 'rxjs';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class FeedPage<T extends JsonFeed = JsonFeed> implements OnInit, OnDestroy {
|
|
9
|
+
protected settings: LocalSettingsService;
|
|
10
|
+
protected cd: ChangeDetectorRef;
|
|
11
|
+
feedService: IFeedService<T>;
|
|
12
|
+
private environment;
|
|
13
|
+
protected destroySubject: Subject<void>;
|
|
14
|
+
protected loadingSubject: BehaviorSubject<boolean>;
|
|
15
|
+
debug: boolean;
|
|
16
|
+
title: string;
|
|
17
|
+
feedUrls: string[];
|
|
18
|
+
feedItemId: string;
|
|
19
|
+
constructor(settings: LocalSettingsService, cd: ChangeDetectorRef, feedService: IFeedService<T>, environment: Environment);
|
|
20
|
+
ngOnInit(): Promise<void>;
|
|
21
|
+
ngOnDestroy(): void;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FeedPage<any>, [null, null, { optional: true; }, { optional: true; }]>;
|
|
23
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FeedPage<any>, "app-feed-page", never, { "debug": { "alias": "debug"; "required": false; }; "title": { "alias": "title"; "required": false; }; "feedUrls": { "alias": "feedUrls"; "required": false; }; "feedItemId": { "alias": "feedItemId"; "required": false; }; }, {}, never, never, false, never>;
|
|
24
|
+
}
|
|
@@ -10,6 +10,7 @@ import { Environment } from '../../../environments/environment.class';
|
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
11
|
export declare const APP_FEED_SERVICE: InjectionToken<IFeedService<any>>;
|
|
12
12
|
export interface IFeedService<T extends JsonFeed = JsonFeed> {
|
|
13
|
+
ready(): Promise<FeedServiceState>;
|
|
13
14
|
watchAll(opts?: {
|
|
14
15
|
urls?: string[];
|
|
15
16
|
maxAgeInMonths?: number;
|
|
@@ -17,6 +18,7 @@ export interface IFeedService<T extends JsonFeed = JsonFeed> {
|
|
|
17
18
|
}): Observable<LoadResult<T>>;
|
|
18
19
|
getHomeUrl(feed?: T): string;
|
|
19
20
|
getTagUrl(feed: T, tag: string): string;
|
|
21
|
+
feedUrls$: Observable<string[]>;
|
|
20
22
|
}
|
|
21
23
|
export interface FeedServiceState {
|
|
22
24
|
locale: string;
|
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.16.
|
|
5
|
+
"version": "18.16.8",
|
|
6
6
|
"default_locale": "fr",
|
|
7
7
|
"description": "Angular components for building beautiful and responsive Apps",
|
|
8
8
|
"icons": [{
|