@sumaris-net/ngx-components 1.19.16 → 1.19.19
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 +99 -65
- 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 +4 -0
- package/esm2015/src/app/core/account/account.js +16 -4
- package/esm2015/src/app/core/services/platform.service.js +15 -3
- package/esm2015/src/app/core/services/storage/entities-storage.service.js +28 -27
- package/esm2015/src/app/shared/platforms.js +2 -1
- package/esm2015/src/app/shared/validator/validators.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +57 -31
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/platform.service.d.ts +1 -0
- package/src/app/core/services/storage/entities-storage.service.d.ts +5 -5
- package/src/assets/i18n/en-US.json +1 -1
- package/src/assets/i18n/en.json +1 -1
- package/src/assets/i18n/fr.json +2 -2
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -1366,6 +1366,7 @@
|
|
|
1366
1366
|
if (_cache.mobile === null || _cache.mobile === undefined) {
|
|
1367
1367
|
_cache.mobile = isCordova(window)
|
|
1368
1368
|
|| isAndroid(win) || isIOS(window)
|
|
1369
|
+
// Workaround, for MS Windows touch screen (detected as mobile, but forced as desktop)
|
|
1369
1370
|
|| (isTouchUi(win) && !isWindows(win));
|
|
1370
1371
|
}
|
|
1371
1372
|
return _cache.mobile;
|
|
@@ -3453,7 +3454,7 @@
|
|
|
3453
3454
|
return null;
|
|
3454
3455
|
}
|
|
3455
3456
|
if (isNotNil(value) && value !== '' && !regexp.test(value)) {
|
|
3456
|
-
return isNotNil(opts === null || opts === void 0 ? void 0 : opts.maxDecimals) ? { maxDecimals: {
|
|
3457
|
+
return isNotNil(opts === null || opts === void 0 ? void 0 : opts.maxDecimals) ? { maxDecimals: { maxDecimals: opts.maxDecimals } } : { decimal: true };
|
|
3457
3458
|
}
|
|
3458
3459
|
return null;
|
|
3459
3460
|
};
|
|
@@ -13869,6 +13870,58 @@
|
|
|
13869
13870
|
enumerable: false,
|
|
13870
13871
|
configurable: true
|
|
13871
13872
|
});
|
|
13873
|
+
EntitiesStorage.prototype.ngOnStart = function () {
|
|
13874
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
13875
|
+
var now;
|
|
13876
|
+
var _this = this;
|
|
13877
|
+
return __generator(this, function (_a) {
|
|
13878
|
+
switch (_a.label) {
|
|
13879
|
+
case 0:
|
|
13880
|
+
now = Date.now();
|
|
13881
|
+
console.info("[entities-storage] Starting entity storage...");
|
|
13882
|
+
// Restore stores
|
|
13883
|
+
return [4 /*yield*/, this.restoreLocally()];
|
|
13884
|
+
case 1:
|
|
13885
|
+
// Restore stores
|
|
13886
|
+
_a.sent();
|
|
13887
|
+
// Start a save timer
|
|
13888
|
+
this.registerSubscription(rxjs.merge(this._$save, rxjs.timer(this._saveTimerPeriod, this._saveTimerPeriod))
|
|
13889
|
+
.pipe(
|
|
13890
|
+
// Avoid to many call (e.g. when $save AND timer are triggered
|
|
13891
|
+
operators.throttleTime(this._saveTimerPeriod))
|
|
13892
|
+
.subscribe(function () { return _this.storeLocally({ skipIfPristine: true }); }));
|
|
13893
|
+
// Save, when platform is in pause
|
|
13894
|
+
this.registerSubscription(this.platform.pause.subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
13895
|
+
return __generator(this, function (_a) {
|
|
13896
|
+
switch (_a.label) {
|
|
13897
|
+
case 0:
|
|
13898
|
+
console.warn("[entities-storage] Platform will pause: saving...");
|
|
13899
|
+
return [4 /*yield*/, this.storeLocally({ skipIfPristine: true })];
|
|
13900
|
+
case 1:
|
|
13901
|
+
_a.sent();
|
|
13902
|
+
console.warn("[entities-storage] Platform will pause: saving [OK]");
|
|
13903
|
+
return [2 /*return*/];
|
|
13904
|
+
}
|
|
13905
|
+
});
|
|
13906
|
+
}); }));
|
|
13907
|
+
console.info("[entities-storage] Starting [OK] in " + (Date.now() - now) + "ms");
|
|
13908
|
+
return [2 /*return*/, this._data];
|
|
13909
|
+
}
|
|
13910
|
+
});
|
|
13911
|
+
});
|
|
13912
|
+
};
|
|
13913
|
+
EntitiesStorage.prototype.ngOnStop = function () {
|
|
13914
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
13915
|
+
return __generator(this, function (_a) {
|
|
13916
|
+
switch (_a.label) {
|
|
13917
|
+
case 0: return [4 /*yield*/, this.storeLocally({ skipIfPristine: true })];
|
|
13918
|
+
case 1:
|
|
13919
|
+
_a.sent();
|
|
13920
|
+
return [2 /*return*/];
|
|
13921
|
+
}
|
|
13922
|
+
});
|
|
13923
|
+
});
|
|
13924
|
+
};
|
|
13872
13925
|
EntitiesStorage.prototype.watchAll = function (entityName, variables, opts) {
|
|
13873
13926
|
var _this = this;
|
|
13874
13927
|
// Make sure store is ready
|
|
@@ -14279,52 +14332,8 @@
|
|
|
14279
14332
|
};
|
|
14280
14333
|
EntitiesStorage.prototype.persist = function (opts) {
|
|
14281
14334
|
if (opts === void 0) { opts = { skipIfPristine: true }; }
|
|
14282
|
-
// Skip if pristine
|
|
14283
|
-
if (opts.skipIfPristine && !this._dirty)
|
|
14284
|
-
return Promise.resolve();
|
|
14285
14335
|
return this.storeLocally(opts);
|
|
14286
14336
|
};
|
|
14287
|
-
EntitiesStorage.prototype.ngOnStart = function () {
|
|
14288
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14289
|
-
var now;
|
|
14290
|
-
var _this = this;
|
|
14291
|
-
return __generator(this, function (_a) {
|
|
14292
|
-
switch (_a.label) {
|
|
14293
|
-
case 0:
|
|
14294
|
-
now = Date.now();
|
|
14295
|
-
console.info("[entities-storage] Starting entity storage...");
|
|
14296
|
-
// Restore sequences
|
|
14297
|
-
return [4 /*yield*/, this.restoreLocally()];
|
|
14298
|
-
case 1:
|
|
14299
|
-
// Restore sequences
|
|
14300
|
-
_a.sent();
|
|
14301
|
-
// Start a save timer
|
|
14302
|
-
this.registerSubscription(rxjs.merge(this._$save, rxjs.timer(this._saveTimerPeriod, this._saveTimerPeriod))
|
|
14303
|
-
.pipe(
|
|
14304
|
-
// Avoid to many call (e.g. when $save AND timer are triggered
|
|
14305
|
-
operators.throttleTime(this._saveTimerPeriod))
|
|
14306
|
-
.subscribe(function () { return _this.storeLocally(); }));
|
|
14307
|
-
console.info("[entities-storage] Starting [OK] in " + (Date.now() - now) + "ms");
|
|
14308
|
-
return [2 /*return*/, this._data];
|
|
14309
|
-
}
|
|
14310
|
-
});
|
|
14311
|
-
});
|
|
14312
|
-
};
|
|
14313
|
-
EntitiesStorage.prototype.ngOnStop = function () {
|
|
14314
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14315
|
-
return __generator(this, function (_a) {
|
|
14316
|
-
switch (_a.label) {
|
|
14317
|
-
case 0:
|
|
14318
|
-
if (!this.dirty) return [3 /*break*/, 2];
|
|
14319
|
-
return [4 /*yield*/, this.storeLocally()];
|
|
14320
|
-
case 1:
|
|
14321
|
-
_a.sent();
|
|
14322
|
-
_a.label = 2;
|
|
14323
|
-
case 2: return [2 /*return*/];
|
|
14324
|
-
}
|
|
14325
|
-
});
|
|
14326
|
-
});
|
|
14327
|
-
};
|
|
14328
14337
|
/* -- protected methods -- */
|
|
14329
14338
|
EntitiesStorage.prototype.getEntityStore = function (name, opts) {
|
|
14330
14339
|
var store = this._data[name];
|
|
@@ -18275,7 +18284,7 @@
|
|
|
18275
18284
|
switch (platformName) {
|
|
18276
18285
|
case 'mobile':
|
|
18277
18286
|
case 'mobileweb':
|
|
18278
|
-
// Exclude Windows touch screens - see
|
|
18287
|
+
// Exclude Windows touch screens - see sumaris-app issues #323 and #346
|
|
18279
18288
|
return this.platform.is(platformName) && !isWindows(window);
|
|
18280
18289
|
default:
|
|
18281
18290
|
return this.platform.is(platformName);
|
|
@@ -18348,6 +18357,7 @@
|
|
|
18348
18357
|
this._cordova = this.is('cordova');
|
|
18349
18358
|
this._android = this.is('android');
|
|
18350
18359
|
this._ios = this.is('ios');
|
|
18360
|
+
this.configureHtmlClassList(this._mobile);
|
|
18351
18361
|
this.configureCordovaPlugins();
|
|
18352
18362
|
// Force some settings
|
|
18353
18363
|
this.settings.mobile = this._mobile;
|
|
@@ -18393,7 +18403,7 @@
|
|
|
18393
18403
|
_this.accountService.tokenType = tokenType;
|
|
18394
18404
|
});
|
|
18395
18405
|
// Hide the splashscreen (if mobile) - after 1s - and play start sound
|
|
18396
|
-
if (this.
|
|
18406
|
+
if (this._mobile) {
|
|
18397
18407
|
setTimeout(function () {
|
|
18398
18408
|
var _a;
|
|
18399
18409
|
(_a = _this.splashScreen) === null || _a === void 0 ? void 0 : _a.hide();
|
|
@@ -18498,6 +18508,18 @@
|
|
|
18498
18508
|
//}
|
|
18499
18509
|
};
|
|
18500
18510
|
/* -- protected methods -- */
|
|
18511
|
+
PlatformService.prototype.configureHtmlClassList = function (mobile, win) {
|
|
18512
|
+
if (win === void 0) { win = window; }
|
|
18513
|
+
if (mobile)
|
|
18514
|
+
return; // Nothing to do
|
|
18515
|
+
// Workaround, for MS Windows touch screen (detected as mobile, but forced as desktop)
|
|
18516
|
+
if (!mobile && (win.document.documentElement.classList.contains('plt-mobile')
|
|
18517
|
+
|| win.document.documentElement.classList.contains('plt-mobileweb'))) {
|
|
18518
|
+
console.warn('[platform] Force class list to: <html class="plt-desktop">. Workaround for Windows touch screen.');
|
|
18519
|
+
win.document.documentElement.classList.remove('plt-mobile', 'plt-mobileweb');
|
|
18520
|
+
win.document.documentElement.classList.add('plt-desktop');
|
|
18521
|
+
}
|
|
18522
|
+
};
|
|
18501
18523
|
PlatformService.prototype.configureCordovaPlugins = function () {
|
|
18502
18524
|
console.info('[platform] Configuring Cordova plugins...');
|
|
18503
18525
|
if (this.statusBar) {
|
|
@@ -22013,7 +22035,7 @@
|
|
|
22013
22035
|
};
|
|
22014
22036
|
AccountPage.prototype.refresh = function (event) {
|
|
22015
22037
|
return __awaiter(this, void 0, void 0, function () {
|
|
22016
|
-
return __generator(this, function (
|
|
22038
|
+
return __generator(this, function (_c) {
|
|
22017
22039
|
this.disable();
|
|
22018
22040
|
this.markAsLoading();
|
|
22019
22041
|
return [2 /*return*/, this.accountService.reload()];
|
|
@@ -22034,8 +22056,8 @@
|
|
|
22034
22056
|
AccountPage.prototype.sendConfirmationEmail = function (event) {
|
|
22035
22057
|
return __awaiter(this, void 0, void 0, function () {
|
|
22036
22058
|
var json, err_1;
|
|
22037
|
-
return __generator(this, function (
|
|
22038
|
-
switch (
|
|
22059
|
+
return __generator(this, function (_c) {
|
|
22060
|
+
switch (_c.label) {
|
|
22039
22061
|
case 0:
|
|
22040
22062
|
json = this.form.value;
|
|
22041
22063
|
json.email = this.form.controls['email'].value;
|
|
@@ -22045,17 +22067,17 @@
|
|
|
22045
22067
|
}
|
|
22046
22068
|
this.email.sending = true;
|
|
22047
22069
|
console.debug('[account] Sending confirmation email...');
|
|
22048
|
-
|
|
22070
|
+
_c.label = 1;
|
|
22049
22071
|
case 1:
|
|
22050
|
-
|
|
22072
|
+
_c.trys.push([1, 3, , 4]);
|
|
22051
22073
|
return [4 /*yield*/, this.accountService.sendConfirmationEmail(json.email, json.settings && json.settings.locale || this.translate.currentLang)];
|
|
22052
22074
|
case 2:
|
|
22053
|
-
|
|
22075
|
+
_c.sent();
|
|
22054
22076
|
console.debug('[account] Confirmation email sent.');
|
|
22055
22077
|
this.email.sending = false;
|
|
22056
22078
|
return [3 /*break*/, 4];
|
|
22057
22079
|
case 3:
|
|
22058
|
-
err_1 =
|
|
22080
|
+
err_1 = _c.sent();
|
|
22059
22081
|
this.email.sending = false;
|
|
22060
22082
|
this.email.error = err_1 && err_1.message || err_1;
|
|
22061
22083
|
return [3 /*break*/, 4];
|
|
@@ -22067,38 +22089,38 @@
|
|
|
22067
22089
|
AccountPage.prototype.save = function (event) {
|
|
22068
22090
|
return __awaiter(this, void 0, void 0, function () {
|
|
22069
22091
|
var newAccount, err_2;
|
|
22070
|
-
return __generator(this, function (
|
|
22071
|
-
switch (
|
|
22092
|
+
return __generator(this, function (_c) {
|
|
22093
|
+
switch (_c.label) {
|
|
22072
22094
|
case 0:
|
|
22073
22095
|
if (this.saving)
|
|
22074
22096
|
return [2 /*return*/, false];
|
|
22075
22097
|
if (!!this.form.valid) return [3 /*break*/, 2];
|
|
22076
22098
|
return [4 /*yield*/, AppFormUtils.waitWhilePending(this.form)];
|
|
22077
22099
|
case 1:
|
|
22078
|
-
|
|
22100
|
+
_c.sent();
|
|
22079
22101
|
if (this.form.invalid) {
|
|
22080
22102
|
AppFormUtils.logFormErrors(this.form);
|
|
22081
22103
|
this.form.markAllAsTouched();
|
|
22082
22104
|
return [2 /*return*/, false];
|
|
22083
22105
|
}
|
|
22084
|
-
|
|
22106
|
+
_c.label = 2;
|
|
22085
22107
|
case 2:
|
|
22086
22108
|
this.submitted = true;
|
|
22087
22109
|
this.saving = true;
|
|
22088
22110
|
this.error = undefined;
|
|
22089
22111
|
newAccount = exports.Account.fromObject(Object.assign(Object.assign({}, (this.accountService.account.asObject())), (this.form.value)));
|
|
22090
22112
|
console.debug('[account] Saving account...', newAccount);
|
|
22091
|
-
|
|
22113
|
+
_c.label = 3;
|
|
22092
22114
|
case 3:
|
|
22093
|
-
|
|
22115
|
+
_c.trys.push([3, 5, 6, 7]);
|
|
22094
22116
|
this.disable();
|
|
22095
22117
|
return [4 /*yield*/, this.accountService.save(newAccount)];
|
|
22096
22118
|
case 4:
|
|
22097
|
-
|
|
22119
|
+
_c.sent();
|
|
22098
22120
|
this.markAsPristine();
|
|
22099
22121
|
return [2 /*return*/, true];
|
|
22100
22122
|
case 5:
|
|
22101
|
-
err_2 =
|
|
22123
|
+
err_2 = _c.sent();
|
|
22102
22124
|
console.error(err_2);
|
|
22103
22125
|
this.error = err_2 && err_2.message || err_2;
|
|
22104
22126
|
return [2 /*return*/, false];
|
|
@@ -22120,9 +22142,21 @@
|
|
|
22120
22142
|
this.form.controls.pubkey.disable();
|
|
22121
22143
|
// Always disable some additional fields
|
|
22122
22144
|
this.additionalFields
|
|
22123
|
-
.filter(function (field) { return field.extra && field.extra.account && field.extra.account.disabled || false; })
|
|
22124
22145
|
.forEach(function (field) {
|
|
22125
|
-
|
|
22146
|
+
var _a, _b;
|
|
22147
|
+
var control = _this.form.controls[field.key];
|
|
22148
|
+
if (!control)
|
|
22149
|
+
return; // Skip
|
|
22150
|
+
var disabled = ((_a = field.extra) === null || _a === void 0 ? void 0 : _a.account) && field.extra.account.disabled || false;
|
|
22151
|
+
if (disabled && control.enabled) {
|
|
22152
|
+
control.disable();
|
|
22153
|
+
}
|
|
22154
|
+
var required = ((_b = field.extra) === null || _b === void 0 ? void 0 : _b.account) && field.extra.account.required || false;
|
|
22155
|
+
if (!field.required && required) {
|
|
22156
|
+
control.setValidators(control.validator
|
|
22157
|
+
? i1.Validators.compose([control.validator, i1.Validators.required])
|
|
22158
|
+
: i1.Validators.required);
|
|
22159
|
+
}
|
|
22126
22160
|
});
|
|
22127
22161
|
this.markForCheck();
|
|
22128
22162
|
};
|
|
@@ -22131,7 +22165,7 @@
|
|
|
22131
22165
|
cancel: { get: function () { return _super_1.prototype.cancel; } }
|
|
22132
22166
|
});
|
|
22133
22167
|
return __awaiter(this, void 0, void 0, function () {
|
|
22134
|
-
return __generator(this, function (
|
|
22168
|
+
return __generator(this, function (_c) {
|
|
22135
22169
|
_super.cancel.call(this);
|
|
22136
22170
|
return [2 /*return*/];
|
|
22137
22171
|
});
|