@sumaris-net/ngx-components 1.13.0 → 1.14.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/bundles/sumaris-net.ngx-components.umd.js +257 -82
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +5 -0
- package/esm2015/src/app/core/auth/form/form-auth.js +2 -2
- package/esm2015/src/app/core/install/install-upgrade-card.component.js +3 -3
- package/esm2015/src/app/core/services/account.service.js +1 -3
- package/esm2015/src/app/core/services/base-entity-service.class.js +6 -3
- package/esm2015/src/app/core/services/config/core.config.js +7 -1
- package/esm2015/src/app/core/services/network.service.js +53 -4
- package/esm2015/src/app/core/services/network.utils.js +1 -1
- package/esm2015/src/app/core/services/platform.service.js +95 -8
- package/esm2015/src/app/shared/http/http.utils.js +14 -2
- package/esm2015/src/app/shared/observables.js +2 -12
- package/esm2015/src/app/shared/upload-file/upload-file.component.js +12 -7
- package/esm2015/src/app/shared/upload-file/upload-file.model.js +8 -1
- package/esm2015/src/app/shared/validator/validators.js +12 -21
- package/esm2015/src/app/shared/version/versions.js +5 -1
- package/esm2015/src/environments/environment.class.js +1 -1
- package/fesm2015/sumaris-net.ngx-components.js +199 -48
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/config/core.config.d.ts +1 -0
- package/src/app/core/services/network.service.d.ts +10 -1
- package/src/app/core/services/network.utils.d.ts +15 -0
- package/src/app/core/services/platform.service.d.ts +6 -0
- package/src/app/shared/http/http.utils.d.ts +1 -0
- package/src/app/shared/observables.d.ts +0 -1
- package/src/app/shared/upload-file/upload-file.model.d.ts +5 -3
- package/src/app/shared/validator/validators.d.ts +0 -5
- package/src/app/shared/version/versions.d.ts +2 -0
- package/src/assets/i18n/en-US.json +2 -5
- package/src/assets/i18n/en.json +2 -5
- package/src/assets/i18n/fr.json +2 -1
- package/src/assets/manifest.json +5 -5
- package/src/environments/environment.class.d.ts +1 -0
- package/src/theme/_responsive.scss +7 -3
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/src/assets/manifest.sumaris.json +0 -17
|
@@ -36,7 +36,7 @@ import { MatAutocomplete, MatAutocompleteTrigger, MatAutocompleteModule, MAT_AUT
|
|
|
36
36
|
import { __awaiter, __decorate } from 'tslib';
|
|
37
37
|
import * as i1$6 from '@angular/forms';
|
|
38
38
|
import { NG_VALUE_ACCESSOR, FormGroupDirective, AbstractControl, FormGroup, FormArray, FormControl, ReactiveFormsModule, Validators, FormBuilder } from '@angular/forms';
|
|
39
|
-
import { timer, merge,
|
|
39
|
+
import { timer, merge, fromEvent, BehaviorSubject, Subscription, Subject, isObservable, from, of, noop as noop$9, Observable, defer, forkJoin, combineLatest, EMPTY } from 'rxjs';
|
|
40
40
|
import { filter, first, map, takeUntil, switchMap, startWith, debounceTime, takeWhile, tap, distinctUntilChanged, mergeMap, catchError, throttleTime, skip } from 'rxjs/operators';
|
|
41
41
|
import * as i1$1 from '@ngx-translate/core';
|
|
42
42
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
@@ -902,16 +902,6 @@ function waitForTrue(observable, opts) {
|
|
|
902
902
|
return firstTrueObservable.toPromise();
|
|
903
903
|
});
|
|
904
904
|
}
|
|
905
|
-
function fromPromise(promise) {
|
|
906
|
-
const $observable = new Subject();
|
|
907
|
-
promise
|
|
908
|
-
.then((errors) => {
|
|
909
|
-
$observable.next(errors);
|
|
910
|
-
$observable.complete();
|
|
911
|
-
})
|
|
912
|
-
.catch(err => $observable.error(err));
|
|
913
|
-
return $observable;
|
|
914
|
-
}
|
|
915
905
|
|
|
916
906
|
function createPromiseEventEmitter() {
|
|
917
907
|
return new EventEmitter(true);
|
|
@@ -3112,21 +3102,6 @@ class SharedFormArrayValidators {
|
|
|
3112
3102
|
}
|
|
3113
3103
|
// @dynamic
|
|
3114
3104
|
class SharedAsyncValidators {
|
|
3115
|
-
/**
|
|
3116
|
-
* Create an observable validator function. Will execute the validator, then cnvert the result into an observable
|
|
3117
|
-
* @param validatorFn any validator
|
|
3118
|
-
*/
|
|
3119
|
-
static of(validatorFn) {
|
|
3120
|
-
return (control) => {
|
|
3121
|
-
const res = validatorFn(control);
|
|
3122
|
-
if (isObservable(res)) {
|
|
3123
|
-
return res;
|
|
3124
|
-
} // Already an observable
|
|
3125
|
-
if (res instanceof Promise)
|
|
3126
|
-
return fromPromise(res);
|
|
3127
|
-
return of(res);
|
|
3128
|
-
};
|
|
3129
|
-
}
|
|
3130
3105
|
/**
|
|
3131
3106
|
* Add a debounce time to a validator.
|
|
3132
3107
|
* @param form
|
|
@@ -3144,8 +3119,6 @@ class SharedAsyncValidators {
|
|
|
3144
3119
|
const $disposeSubject = new Subject();
|
|
3145
3120
|
const disposeEvent$ = (opts === null || opts === void 0 ? void 0 : opts.dispose) ? merge($disposeSubject, opts === null || opts === void 0 ? void 0 : opts.dispose)
|
|
3146
3121
|
: $disposeSubject;
|
|
3147
|
-
// Make sure validator will return an Observable - This is need by the switchMap()
|
|
3148
|
-
const asyncValidatorFn = SharedAsyncValidators.of(validatorFn);
|
|
3149
3122
|
// DEBUG
|
|
3150
3123
|
if (debug && (opts === null || opts === void 0 ? void 0 : opts.dispose)) {
|
|
3151
3124
|
opts === null || opts === void 0 ? void 0 : opts.dispose.pipe(first()).subscribe(() => {
|
|
@@ -3167,7 +3140,16 @@ class SharedAsyncValidators {
|
|
|
3167
3140
|
console.debug(logPrefix + 'Executing...');
|
|
3168
3141
|
now = Date.now();
|
|
3169
3142
|
}
|
|
3170
|
-
}), switchMap((_) =>
|
|
3143
|
+
}), switchMap((_) => {
|
|
3144
|
+
// Call the validator
|
|
3145
|
+
const res = validatorFn(control);
|
|
3146
|
+
// Make sure to return an Observable
|
|
3147
|
+
if (isObservable(res))
|
|
3148
|
+
return res;
|
|
3149
|
+
if (res instanceof Promise)
|
|
3150
|
+
return from(res);
|
|
3151
|
+
return of(res);
|
|
3152
|
+
}),
|
|
3171
3153
|
// DEBUG
|
|
3172
3154
|
tap(res => debug && console.debug(logPrefix + `Finished in ${Date.now() - now}ms (${res ? 'with errors' : 'no error'})`, res)), catchError(error => {
|
|
3173
3155
|
console.error('[debounceTime-validator] Error while executing validator. Stopping job', error);
|
|
@@ -9997,7 +9979,18 @@ class HttpUtils {
|
|
|
9997
9979
|
static getResource(http, uri, opts) {
|
|
9998
9980
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9999
9981
|
// Add headers
|
|
10000
|
-
opts = Object.assign({}, opts
|
|
9982
|
+
opts = Object.assign({}, opts
|
|
9983
|
+
//headers: new HttpHeaders(),
|
|
9984
|
+
//.append('X-App-Name', environment.name)
|
|
9985
|
+
//.append('X-App-Version', environment.version),
|
|
9986
|
+
);
|
|
9987
|
+
// Force no cache
|
|
9988
|
+
if (opts.nocache === true) {
|
|
9989
|
+
opts.headers = (opts.headers instanceof HttpHeaders ? opts.headers : new HttpHeaders(opts.headers));
|
|
9990
|
+
opts.headers
|
|
9991
|
+
.append('Cache-Control', 'no-cache')
|
|
9992
|
+
.append('Pragma', 'no-cache');
|
|
9993
|
+
}
|
|
10001
9994
|
try {
|
|
10002
9995
|
// Using web http client
|
|
10003
9996
|
return (yield http.get(uri, opts).toPromise());
|
|
@@ -10039,6 +10032,7 @@ class VersionUtils {
|
|
|
10039
10032
|
}
|
|
10040
10033
|
VersionUtils.compare = compareVersionNumbers;
|
|
10041
10034
|
VersionUtils.isCompatible = isVersionCompatible;
|
|
10035
|
+
VersionUtils.isSame = isSameVersion;
|
|
10042
10036
|
/**
|
|
10043
10037
|
* Compare two software version numbers (e.g. 1.7.1)
|
|
10044
10038
|
* Returns:
|
|
@@ -10107,6 +10101,9 @@ function isVersionCompatible(minVersion, actualVersion) {
|
|
|
10107
10101
|
//console.debug(`[http] Checking actual version {${actualVersion}} is compatible with min expected version {${minVersion}}`);
|
|
10108
10102
|
return compareVersionNumbers(minVersion, actualVersion) <= 0;
|
|
10109
10103
|
}
|
|
10104
|
+
function isSameVersion(v1, v2) {
|
|
10105
|
+
return compareVersionNumbers(v1, v2) === 0;
|
|
10106
|
+
}
|
|
10110
10107
|
|
|
10111
10108
|
class SelectPeerModal {
|
|
10112
10109
|
constructor(viewCtrl, cd, http, environment) {
|
|
@@ -11038,15 +11035,65 @@ class NetworkService extends StartableService {
|
|
|
11038
11035
|
});
|
|
11039
11036
|
}
|
|
11040
11037
|
getNodeInfo(peer) {
|
|
11038
|
+
const path = this.computePeerPath(peer, '/api/node/info');
|
|
11039
|
+
return this.get(path);
|
|
11040
|
+
}
|
|
11041
|
+
getAppManifest(peer, opts) {
|
|
11042
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11043
|
+
try {
|
|
11044
|
+
let path = this.computePeerPath(peer, 'manifest.json');
|
|
11045
|
+
if (opts === null || opts === void 0 ? void 0 : opts.nocache) {
|
|
11046
|
+
path += '?t=' + Date.now();
|
|
11047
|
+
}
|
|
11048
|
+
return yield this.get(path, opts);
|
|
11049
|
+
}
|
|
11050
|
+
catch (err) {
|
|
11051
|
+
if (this.environment.production)
|
|
11052
|
+
console.error('[network] Cannot load file \'manifest.json\'. Please make sure webserver config allow CORS access', err);
|
|
11053
|
+
else
|
|
11054
|
+
console.error('[network] Cannot load file \'manifest.json\'.', err);
|
|
11055
|
+
// Continue
|
|
11056
|
+
}
|
|
11057
|
+
});
|
|
11058
|
+
}
|
|
11059
|
+
getAppVersion(peer, opts) {
|
|
11060
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11061
|
+
try {
|
|
11062
|
+
let path = this.computePeerPath(peer, 'version.appup');
|
|
11063
|
+
if (opts === null || opts === void 0 ? void 0 : opts.nocache) {
|
|
11064
|
+
path += '?t=' + Date.now();
|
|
11065
|
+
}
|
|
11066
|
+
const appVersion = yield this.get(path, opts);
|
|
11067
|
+
if (isNotNilOrBlank(appVersion))
|
|
11068
|
+
return appVersion;
|
|
11069
|
+
}
|
|
11070
|
+
catch (err) {
|
|
11071
|
+
if (this.environment.production)
|
|
11072
|
+
console.error('[network] Cannot load file \'version.appup\'. Please make sure webserver config allow CORS access');
|
|
11073
|
+
else
|
|
11074
|
+
console.error('[network] Cannot load file \'version.appup\'.', err);
|
|
11075
|
+
// Continue
|
|
11076
|
+
}
|
|
11077
|
+
// Try loading manifest.json
|
|
11078
|
+
const manifest = yield this.getAppManifest(peer, opts);
|
|
11079
|
+
return manifest === null || manifest === void 0 ? void 0 : manifest.version;
|
|
11080
|
+
});
|
|
11081
|
+
}
|
|
11082
|
+
computePeerPath(peer, path) {
|
|
11041
11083
|
peer = peer || this.peer;
|
|
11042
11084
|
if (!peer)
|
|
11043
11085
|
return undefined;
|
|
11044
|
-
let peerUrl =
|
|
11086
|
+
let peerUrl = (peer instanceof Peer) ? peer.url : peer;
|
|
11045
11087
|
// Remove trailing slash
|
|
11046
11088
|
if (peerUrl.endsWith('/')) {
|
|
11047
11089
|
peerUrl = peerUrl.substr(0, peerUrl.length - 1);
|
|
11048
11090
|
}
|
|
11049
|
-
|
|
11091
|
+
// Add first path
|
|
11092
|
+
if (!path.startsWith('/')) {
|
|
11093
|
+
path = '/' + path;
|
|
11094
|
+
}
|
|
11095
|
+
// Concat peer URL and path
|
|
11096
|
+
return peerUrl + path;
|
|
11050
11097
|
}
|
|
11051
11098
|
/**
|
|
11052
11099
|
* Allow to force offline mode
|
|
@@ -13969,8 +14016,6 @@ class AccountService extends BaseGraphqlService {
|
|
|
13969
14016
|
}
|
|
13970
14017
|
canUserWriteDataForDepartment(recorderDepartment) {
|
|
13971
14018
|
if (ReferentialUtils.isEmpty(recorderDepartment)) {
|
|
13972
|
-
if (!this.isAdmin())
|
|
13973
|
-
console.warn('Unable to check if user has right: invalid recorderDepartment', recorderDepartment);
|
|
13974
14019
|
return this.isAdmin();
|
|
13975
14020
|
}
|
|
13976
14021
|
// Should be login, and status ENABLE
|
|
@@ -15055,6 +15100,12 @@ const CORE_CONFIG_OPTIONS = Object.freeze({
|
|
|
15055
15100
|
key: 'sumaris.android.install.url',
|
|
15056
15101
|
label: 'CONFIGURATION.OPTIONS.ANDROID_INSTALL_URL',
|
|
15057
15102
|
type: 'string'
|
|
15103
|
+
},
|
|
15104
|
+
DB_TIMEZONE: {
|
|
15105
|
+
key: 'sumaris.persistence.db.timezone',
|
|
15106
|
+
label: 'DB Timezone (readonly)',
|
|
15107
|
+
type: 'string',
|
|
15108
|
+
isTransient: true // ONly on server, cannot be set
|
|
15058
15109
|
}
|
|
15059
15110
|
});
|
|
15060
15111
|
|
|
@@ -15473,6 +15524,9 @@ class PlatformService extends StartableService {
|
|
|
15473
15524
|
isApp() {
|
|
15474
15525
|
return this._cordova && (this._android || this._ios);
|
|
15475
15526
|
}
|
|
15527
|
+
isMobileWeb() {
|
|
15528
|
+
return isMobile(window) && this.isWeb();
|
|
15529
|
+
}
|
|
15476
15530
|
get canDownload() {
|
|
15477
15531
|
return !!this.downloader && this.isAndroidCordova();
|
|
15478
15532
|
}
|
|
@@ -15486,6 +15540,7 @@ class PlatformService extends StartableService {
|
|
|
15486
15540
|
return this.platform.height();
|
|
15487
15541
|
}
|
|
15488
15542
|
ngOnStart() {
|
|
15543
|
+
var _a, _b;
|
|
15489
15544
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15490
15545
|
const now = Date.now();
|
|
15491
15546
|
this.accountService.tokenType = undefined;
|
|
@@ -15506,16 +15561,22 @@ class PlatformService extends StartableService {
|
|
|
15506
15561
|
// Start root services
|
|
15507
15562
|
yield Promise.all([
|
|
15508
15563
|
this.entitiesStorage.ready(),
|
|
15509
|
-
this.cache.ready()
|
|
15564
|
+
this.cache.ready(),
|
|
15510
15565
|
this.settings.ready(),
|
|
15511
15566
|
this.networkService.ready(),
|
|
15512
15567
|
this.audioProvider.ready()
|
|
15513
15568
|
]);
|
|
15514
|
-
|
|
15569
|
+
yield Promise.all([
|
|
15570
|
+
this.configureCache(),
|
|
15571
|
+
this.checkAppVersion({ canReload: true })
|
|
15572
|
+
]);
|
|
15515
15573
|
// Update cache configuration when network changed
|
|
15516
15574
|
this.networkService.onNetworkStatusChanges
|
|
15517
|
-
.pipe(skip(1)
|
|
15518
|
-
|
|
15575
|
+
.pipe(skip(1), map(type => type !== 'none'), debounceTime(1000), distinctUntilChanged(),
|
|
15576
|
+
// Configure the cache
|
|
15577
|
+
tap(online => this.configureCache(online)))
|
|
15578
|
+
.subscribe();
|
|
15579
|
+
console.info(`[platform] Starting platform [OK] {mobile: ${this._mobile}, web: ${this.isWeb()}, downloader: ${this.canDownload}, fileOpener: ${this.canOpenFile}} in ${Date.now() - now}ms`);
|
|
15519
15580
|
// Update authentication type
|
|
15520
15581
|
this.configService.config
|
|
15521
15582
|
.pipe(map(config => config === null || config === void 0 ? void 0 : config.getProperty(CORE_CONFIG_OPTIONS.AUTH_TOKEN_TYPE)), filter(isNotNilOrBlank), distinctUntilChanged())
|
|
@@ -15532,6 +15593,15 @@ class PlatformService extends StartableService {
|
|
|
15532
15593
|
this.audioProvider.playStartupSound();
|
|
15533
15594
|
}, 1000);
|
|
15534
15595
|
}
|
|
15596
|
+
// Check if new version, every 1 min
|
|
15597
|
+
if (this.isWeb()) {
|
|
15598
|
+
const intervalMs = (((_a = this.environment) === null || _a === void 0 ? void 0 : _a.checkAppVersionIntervalInSeconds) || 0) * 1000;
|
|
15599
|
+
if (intervalMs > 0) {
|
|
15600
|
+
(_b = this.checkAppVersionTimer) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
15601
|
+
this.checkAppVersionTimer = timer(intervalMs, intervalMs)
|
|
15602
|
+
.subscribe(_ => this.checkAppVersion({ silent: true, canReload: false /*do NOT auto reload, when app is started*/ }));
|
|
15603
|
+
}
|
|
15604
|
+
}
|
|
15535
15605
|
}
|
|
15536
15606
|
catch (err) {
|
|
15537
15607
|
// Manage startup error
|
|
@@ -15653,6 +15723,73 @@ class PlatformService extends StartableService {
|
|
|
15653
15723
|
this.cache.setDefaultTTL(cacheTTL);
|
|
15654
15724
|
this.cache.setOfflineInvalidate(false); // Do not invalidate cache when offline
|
|
15655
15725
|
}
|
|
15726
|
+
checkAppVersion(opts) {
|
|
15727
|
+
var _a, _b, _c;
|
|
15728
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15729
|
+
if (this.networkService.offline || !this.isWeb())
|
|
15730
|
+
return; // Skip
|
|
15731
|
+
const silent = (opts === null || opts === void 0 ? void 0 : opts.silent) === true;
|
|
15732
|
+
const production = this.environment.production;
|
|
15733
|
+
if (!silent)
|
|
15734
|
+
console.info('[platform] Checking remote app version...');
|
|
15735
|
+
const actualVersion = this.environment.version;
|
|
15736
|
+
if (isNilOrBlank(actualVersion)) {
|
|
15737
|
+
console.warn('[platform] Missing required value for \'environment.version\'. Cannot check remote app version.');
|
|
15738
|
+
(_a = this.checkAppVersionTimer) === null || _a === void 0 ? void 0 : _a.unsubscribe(); // Stop timer if exists
|
|
15739
|
+
return; // Skip
|
|
15740
|
+
}
|
|
15741
|
+
const peer = undefined; // location.origin + this.environment.baseUrl;
|
|
15742
|
+
const remoteVersion = yield this.networkService.getAppVersion(peer);
|
|
15743
|
+
if (isNilOrBlank(remoteVersion)) {
|
|
15744
|
+
if (production && !silent)
|
|
15745
|
+
console.error('[platform] Cannot load remote app version. Skipping version check');
|
|
15746
|
+
(_b = this.checkAppVersionTimer) === null || _b === void 0 ? void 0 : _b.unsubscribe(); // Stop timer if exists
|
|
15747
|
+
return;
|
|
15748
|
+
}
|
|
15749
|
+
if (VersionUtils.isCompatible(remoteVersion, actualVersion)) {
|
|
15750
|
+
if (!silent)
|
|
15751
|
+
console.info('[platform] Checking remote app version [OK]');
|
|
15752
|
+
return;
|
|
15753
|
+
}
|
|
15754
|
+
// If newer version exists
|
|
15755
|
+
const canAutoReload = !opts || opts.canReload !== false;
|
|
15756
|
+
// Avoid infinite loop, if already reloaded
|
|
15757
|
+
if (location.href.indexOf('?version=' + remoteVersion) !== -1) {
|
|
15758
|
+
if (canAutoReload)
|
|
15759
|
+
console.error(`[platform] Reloaded page failed, because version still mismatch! Please check version.appup file (expected app version: ${actualVersion})`);
|
|
15760
|
+
(_c = this.checkAppVersionTimer) === null || _c === void 0 ? void 0 : _c.unsubscribe();
|
|
15761
|
+
return;
|
|
15762
|
+
}
|
|
15763
|
+
console.warn(`[platform] More recent version detected (remote: ${remoteVersion}, actual: ${actualVersion}`);
|
|
15764
|
+
let reloadPath = location.href.replace(/[&?]{1}[a-z_-]=[0-9.]+/gi, ''); // Remove query params
|
|
15765
|
+
reloadPath += (reloadPath.indexOf('?') === -1) ? '?' : '&'; // Add query param separator
|
|
15766
|
+
reloadPath += 'version=' + remoteVersion; // Add version (to avoid a reload infinite loop)
|
|
15767
|
+
console.info('[platform] Will reloading at ' + reloadPath);
|
|
15768
|
+
// Auto reload
|
|
15769
|
+
if (canAutoReload) {
|
|
15770
|
+
location.href = reloadPath;
|
|
15771
|
+
// App stop
|
|
15772
|
+
}
|
|
15773
|
+
// Ask user to reload
|
|
15774
|
+
else {
|
|
15775
|
+
yield this.showToast({
|
|
15776
|
+
message: 'CONFIRM.RELOAD_APP',
|
|
15777
|
+
messageParams: { version: remoteVersion, name: this.environment.name },
|
|
15778
|
+
type: 'info', duration: -1,
|
|
15779
|
+
buttons: [
|
|
15780
|
+
// Reload button
|
|
15781
|
+
{ text: this.translate.instant('COMMON.BTN_RELOAD'),
|
|
15782
|
+
side: 'end',
|
|
15783
|
+
handler: () => {
|
|
15784
|
+
location.href = reloadPath;
|
|
15785
|
+
return true;
|
|
15786
|
+
}
|
|
15787
|
+
}
|
|
15788
|
+
]
|
|
15789
|
+
});
|
|
15790
|
+
}
|
|
15791
|
+
});
|
|
15792
|
+
}
|
|
15656
15793
|
storageReady() {
|
|
15657
15794
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15658
15795
|
console.info(`[platform] Starting storage...`);
|
|
@@ -15868,6 +16005,13 @@ class FileResponse {
|
|
|
15868
16005
|
this.statusText = (init === null || init === void 0 ? void 0 : init.statusText) || 'OK';
|
|
15869
16006
|
}
|
|
15870
16007
|
}
|
|
16008
|
+
function isProgressEvent(event) {
|
|
16009
|
+
return event.type === HttpEventType.UploadProgress
|
|
16010
|
+
|| event.type === HttpEventType.DownloadProgress;
|
|
16011
|
+
}
|
|
16012
|
+
function isResponseEvent(event) {
|
|
16013
|
+
return event.type === HttpEventType.Response;
|
|
16014
|
+
}
|
|
15871
16015
|
|
|
15872
16016
|
class UploadFileComponent {
|
|
15873
16017
|
constructor(cd, translate) {
|
|
@@ -16003,7 +16147,7 @@ class UploadFileComponent {
|
|
|
16003
16147
|
switchMap(file => this.uploadFn(file)
|
|
16004
16148
|
.pipe(map((event) => {
|
|
16005
16149
|
// Progress event
|
|
16006
|
-
if ((event
|
|
16150
|
+
if (isProgressEvent(event)) {
|
|
16007
16151
|
if (isNotNil(event.loaded) && event.loaded >= 0) {
|
|
16008
16152
|
file.progress = Math.min(1, event.loaded / (event.total || 1));
|
|
16009
16153
|
}
|
|
@@ -16011,15 +16155,20 @@ class UploadFileComponent {
|
|
|
16011
16155
|
file.progress = -1; // Indeterminate progression
|
|
16012
16156
|
}
|
|
16013
16157
|
}
|
|
16158
|
+
// User event
|
|
16159
|
+
else if (event.type === HttpEventType.User) {
|
|
16160
|
+
file.progress = -1; // Indeterminate progression
|
|
16161
|
+
}
|
|
16014
16162
|
// Response event
|
|
16015
|
-
else if (event
|
|
16163
|
+
else if (isResponseEvent(event)) {
|
|
16016
16164
|
file.progress = 1;
|
|
16017
16165
|
file.response = event;
|
|
16018
16166
|
console.debug(`[upload-file] ${file.name}: ${event.statusText || 'OK'}`, file.response);
|
|
16019
16167
|
}
|
|
16020
|
-
// Other events
|
|
16168
|
+
// Other events: ignore
|
|
16021
16169
|
else {
|
|
16022
|
-
|
|
16170
|
+
// DEBUG
|
|
16171
|
+
console.debug('[upload-file] Ignoring a file event: ', event);
|
|
16023
16172
|
}
|
|
16024
16173
|
return file;
|
|
16025
16174
|
}), catchError((err) => {
|
|
@@ -17828,7 +17977,7 @@ class AuthForm extends AppForm {
|
|
|
17828
17977
|
this.showPwd = false;
|
|
17829
17978
|
this.onCancel = new EventEmitter();
|
|
17830
17979
|
this.onSubmit = new EventEmitter();
|
|
17831
|
-
this.mobile =
|
|
17980
|
+
this.mobile = settings.mobile;
|
|
17832
17981
|
this.canWorkOffline = this.settings.hasOfflineFeature();
|
|
17833
17982
|
this._enable = true;
|
|
17834
17983
|
}
|
|
@@ -19890,10 +20039,10 @@ class AppInstallUpgradeCard {
|
|
|
19890
20039
|
}
|
|
19891
20040
|
getCompatibleInstallLinks(installLinks) {
|
|
19892
20041
|
// Cordova already running: not need to install
|
|
19893
|
-
if (this.platform.
|
|
20042
|
+
if (this.platform.isCordova())
|
|
19894
20043
|
return undefined;
|
|
19895
20044
|
// If mobile web: return all
|
|
19896
|
-
if (this.platform.
|
|
20045
|
+
if (this.platform.isMobileWeb()) {
|
|
19897
20046
|
return installLinks;
|
|
19898
20047
|
}
|
|
19899
20048
|
return undefined;
|
|
@@ -21056,8 +21205,10 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
21056
21205
|
listenChanges(id, opts) {
|
|
21057
21206
|
if (isNil(id))
|
|
21058
21207
|
throw Error('Missing argument \'id\' ');
|
|
21059
|
-
if (!this.subscriptions.listenChanges)
|
|
21060
|
-
|
|
21208
|
+
if (!this.subscriptions.listenChanges) {
|
|
21209
|
+
console.warn(`${this.constructor.name}.listenChanges() not implemented yet. Will empty observable`);
|
|
21210
|
+
return of();
|
|
21211
|
+
}
|
|
21061
21212
|
const variables = opts && opts.variables || {
|
|
21062
21213
|
id,
|
|
21063
21214
|
interval: toNumber(opts && opts.interval, 0) // no timer by default
|
|
@@ -26643,5 +26794,5 @@ CoreTestingModule.decorators = [
|
|
|
26643
26794
|
* Generated bundle index. Do not edit.
|
|
26644
26795
|
*/
|
|
26645
26796
|
|
|
26646
|
-
export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableDataSourceOptions, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DragAndDropDirective, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, ErrorCodes, EvenPipe, FileResponse, FileService, FileSizePipe, FilesUtils, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, FormGetArrayPipe, FormGetControlPipe, FormGetPipe, Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, JobUtils, KEYBOARD_HIDE_DELAY_MS, LAT_LONG_DEFAULT_MAX_DECIMALS, LAT_LONG_PATTERNS, LatLongFormatPipe, LatLongTestPage, LatitudeFormatPipe, LocalSettingsService, LongitudeFormatPipe, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBadgeIconDirective, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialTestingModule, MathAbsPipe, MenuComponent, MenuItems, MenuService, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialFilter, ReferentialRef, ReferentialUtils, ReferentialValidatorService, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SHARED_MATERIAL_TESTING_PAGES, SHARED_TESTING_PAGES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedAsyncValidators, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBadgeIconModule, SharedMatBooleanModule, SharedMatChipsModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedTestsPage, SharedValidators, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrIncludesPipe, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, TableTestPage, TableTestingModule, TextForm, TextPopover, TextPopoverTestingModule, TextPopoverTestingPage, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UploadFile, UploadFileComponent, UploadFilePopover, UploadFileTestingModule, UploadFileTestingPage, UserEvent, UserEventFilter, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalse, firstFalsePromise, firstNotNil, firstNotNilPromise, firstTrue, firstTruePromise, focusInput, focusNextInput, focusPreviousInput, formatLatitude, formatLongitude, fromDateISOString,
|
|
26797
|
+
export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableDataSourceOptions, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DragAndDropDirective, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, ErrorCodes, EvenPipe, FileResponse, FileService, FileSizePipe, FilesUtils, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, FormGetArrayPipe, FormGetControlPipe, FormGetPipe, Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, JobUtils, KEYBOARD_HIDE_DELAY_MS, LAT_LONG_DEFAULT_MAX_DECIMALS, LAT_LONG_PATTERNS, LatLongFormatPipe, LatLongTestPage, LatitudeFormatPipe, LocalSettingsService, LongitudeFormatPipe, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBadgeIconDirective, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialTestingModule, MathAbsPipe, MenuComponent, MenuItems, MenuService, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialFilter, ReferentialRef, ReferentialUtils, ReferentialValidatorService, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SHARED_MATERIAL_TESTING_PAGES, SHARED_TESTING_PAGES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedAsyncValidators, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBadgeIconModule, SharedMatBooleanModule, SharedMatChipsModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedTestsPage, SharedValidators, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrIncludesPipe, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, TableTestPage, TableTestingModule, TextForm, TextPopover, TextPopoverTestingModule, TextPopoverTestingPage, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UploadFile, UploadFileComponent, UploadFilePopover, UploadFileTestingModule, UploadFileTestingPage, UserEvent, UserEventFilter, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalse, firstFalsePromise, firstNotNil, firstNotNilPromise, firstTrue, firstTruePromise, focusInput, focusNextInput, focusPreviousInput, formatLatitude, formatLongitude, fromDateISOString, fromScrollEndEvent, fromUnixMsTimestamp, fromUnixTimestamp, getCaretPosition, getColorContrast, getColorShade, getColorTint, getConnectionType, getControlFromPath, getFocusableInputElements, getFormErrors, getFormValueFromEntity, getProperty, getPropertyByPath, getPropertyByPathAsString, getRandomImage, hexToRgb, hexToRgbArray, isAndroid, isControlHasInput, isCordova, isDesktop, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isProgressEvent, isResponseEvent, isTouchUi, isWindow, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, moveInputCaretToSeparator, noTrailingSlash, notNilOrDefault, nullIfUndefined, parseLatitudeOrLongitude, propertiesPathComparator, propertyComparator, propertyPathComparator, referentialToString, referentialsToString, remove, removeAll, removeDiacritics, removeDuplicatesFromArray, removeEnd, removeValueInArray, replaceAll, resetCalculatedValue, resizeArray, rgbArrayToHex, rgbToHex, round, scrollFactory, selectInputContent, selectInputRange, setCalculatedValue, setTabIndex, sleep, slideInOutAnimation, slideUpDownAnimation, sort, splitById, splitByProperty, startsWithUpperCase, suggestFromArray, suggestFromStringArray, tabindexComparator, testUserAgent, toBoolean, toDateISOString, toDuration, toFloat, toInt, toNotNil, toNumber, trimEmptyToNull, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForTrue, waitIdle, waitWhilePending, ɵ0$b as ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, isFocusableElement as ɵc, RegisterForm as ɵd, AccountValidatorService as ɵe, RegisterModal as ɵf, UserSettingsValidatorService as ɵg, LocalSettingsValidatorService as ɵh, AppIconComponent as ɵi, NumpadTestPage as ɵj, MatBadgeIconTestPage as ɵk, ToastTestingModule as ɵl, ToastTestingPage as ɵm };
|
|
26647
26798
|
//# sourceMappingURL=sumaris-net.ngx-components.js.map
|