@sumaris-net/ngx-components 1.19.15 → 1.19.18

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.
@@ -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;
@@ -3444,7 +3445,7 @@
3444
3445
  }
3445
3446
  return null;
3446
3447
  };
3447
- SharedValidators.double = function (opts) {
3448
+ SharedValidators.decimal = function (opts) {
3448
3449
  var regexp = this.getDoubleRegexp(opts === null || opts === void 0 ? void 0 : opts.maxDecimals);
3449
3450
  return function (control) {
3450
3451
  var value = control.value;
@@ -3453,7 +3454,7 @@
3453
3454
  return null;
3454
3455
  }
3455
3456
  if (isNotNil(value) && value !== '' && !regexp.test(value)) {
3456
- return { maxDecimals: { maxDecimals: opts === null || opts === void 0 ? void 0 : opts.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
  };
@@ -3586,6 +3587,7 @@
3586
3587
  dateMinDuration: 'ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION',
3587
3588
  dateMaxDuration: 'ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION',
3588
3589
  maxDecimals: 'ERROR.FIELD_MAXIMUM_DECIMALS',
3590
+ double: 'ERROR.FIELD_NOT_VALID_DOUBLE',
3589
3591
  integer: 'ERROR.FIELD_NOT_VALID_INTEGER',
3590
3592
  email: 'ERROR.FIELD_NOT_VALID_EMAIL',
3591
3593
  latitude: 'ERROR.FIELD_NOT_VALID_LATITUDE',
@@ -3594,6 +3596,10 @@
3594
3596
  unique: 'ERROR.FIELD_NOT_UNIQUE',
3595
3597
  entity: 'ERROR.FIELD_INVALID'
3596
3598
  };
3599
+ /**
3600
+ * @deprecated use decimal
3601
+ */
3602
+ SharedValidators.double = SharedValidators.decimal;
3597
3603
  // @dynamic
3598
3604
  var SharedFormGroupValidators = /** @class */ (function () {
3599
3605
  function SharedFormGroupValidators() {
@@ -7915,8 +7921,8 @@
7915
7921
  this.required = false;
7916
7922
  this.clearable = false;
7917
7923
  this.onClick = new i0.EventEmitter();
7918
- this.onBlur = new i0.EventEmitter();
7919
- this.onFocus = new i0.EventEmitter();
7924
+ this.blurred = new i0.EventEmitter();
7925
+ this.focused = new i0.EventEmitter();
7920
7926
  this.selectInputContent = selectInputContent;
7921
7927
  }
7922
7928
  Object.defineProperty(MatSwipeField.prototype, "tabindex", {
@@ -8241,8 +8247,8 @@
8241
8247
  tabindex: [{ type: i0.Input }],
8242
8248
  items: [{ type: i0.Input }],
8243
8249
  onClick: [{ type: i0.Output, args: ['click',] }],
8244
- onBlur: [{ type: i0.Output, args: ['blur',] }],
8245
- onFocus: [{ type: i0.Output, args: ['focus',] }],
8250
+ blurred: [{ type: i0.Output, args: ['blur',] }],
8251
+ focused: [{ type: i0.Output, args: ['focus',] }],
8246
8252
  fakeInput: [{ type: i0.ViewChild, args: ['fakeInput',] }],
8247
8253
  slides: [{ type: i0.ViewChild, args: ['slides', { static: true },] }],
8248
8254
  prevButton: [{ type: i0.ViewChild, args: ['prevButton',] }],
@@ -9850,7 +9856,7 @@
9850
9856
  AppFormField.decorators = [
9851
9857
  { type: i0.Component, args: [{
9852
9858
  selector: 'app-form-field',
9853
- template: "<ng-container [ngSwitch]=\"type\">\n\n <!-- integer -->\n <mat-form-field *ngSwitchCase=\"'integer'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n <input matInput #matInput\n type=\"number\"\n autocomplete=\"off\"\n [readonly]=\"readonly\"\n [min]=\"definition.minValue\"\n [max]=\"definition.maxValue\"\n pattern=\"-?[0-9]*\"\n step=\"1\"\n [appAutofocus]=\"autofocus\"\n [placeholder]=\"placeholder\"\n (keyup.enter)=\"onKeyupEnter.emit($event)\"\n (keypress)=\"filterNumberInput($event, false)\"\n [formControl]=\"formControl\"\n [required]=\"required\"\n [tabIndex]=\"tabindex\"\n (click)=\"selectInputContent($event)\">\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf=\"formControl.hasError('min')\">\n {{(compact ? 'ERROR.FIELD_MIN_COMPACT' : 'ERROR.FIELD_MIN') | translate:formControl.errors['min'] }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('max')\">\n {{(compact ? 'ERROR.FIELD_MAX_COMPACT' : 'ERROR.FIELD_MAX') | translate:formControl.errors['max'] }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('pattern')\">\n {{'ERROR.FIELD_NOT_VALID_INTEGER'| translate }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('integer')\">\n {{'ERROR.FIELD_NOT_VALID_INTEGER'| translate }}</mat-error>\n\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-form-field>\n\n <!-- double -->\n <mat-form-field *ngSwitchCase=\"'double'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n\n <input matInput #matInput\n type=\"number\"\n decimal=\"true\"\n autocomplete=\"off\"\n [min]=\"definition.minValue\"\n [max]=\"definition.maxValue\"\n [appAutofocus]=\"autofocus\"\n [readonly]=\"readonly\"\n [placeholder]=\"placeholder\"\n [step]=\"numberInputStep\"\n (keypress)=\"filterNumberInput($event, true)\"\n [formControl]=\"formControl\"\n [required]=\"required\"\n [tabIndex]=\"tabindex\"\n (click)=\"selectInputContent($event)\">\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf=\"formControl.hasError('min')\">\n {{ (compact ? 'ERROR.FIELD_MIN_COMPACT' : 'ERROR.FIELD_MIN')| translate:formControl.errors['min'] }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('max')\">\n {{(compact ? 'ERROR.FIELD_MAX_COMPACT' : 'ERROR.FIELD_MAX') | translate:formControl.errors['max'] }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('maxDecimals')\">\n {{ (compact ? 'ERROR.FIELD_MAXIMUM_DECIMALS_COMPACT' : 'ERROR.FIELD_MAXIMUM_DECIMALS')| translate:{max:\n definition.maximumNumberDecimals} }}</mat-error>\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-form-field>\n\n <!-- boolean -->\n <mat-boolean-field *ngSwitchCase=\"'boolean'\" #matInput\n [class]=\"classList\"\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [floatLabel]=\"floatLabel\"\n [required]=\"required\"\n [compact]=\"compact\"\n [tabindex]=\"tabindex\"\n [readonly]=\"readonly\">\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-boolean-field>\n\n <!-- date -->\n <mat-date-field *ngSwitchCase=\"'date'\" #matInput\n [class]=\"classList\"\n [formControl]=\"formControl\"\n [placeholder]=\"compact ? ('COMMON.DATE_PLACEHOLDER'|translate): placeholder\"\n [floatLabel]=\"floatLabel\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [compact]=\"compact\"\n [tabindex]=\"tabindex\"\n [autofocus]=\"autofocus\">\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-date-field>\n\n <!-- date time -->\n <mat-date-time-field *ngSwitchCase=\"'dateTime'\" #matInput\n [class]=\"classList\"\n [formControl]=\"formControl\"\n [placeholder]=\"compact ? ('COMMON.DATE_TIME_PLACEHOLDER'|translate): placeholder\"\n [floatLabel]=\"floatLabel\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [compact]=\"compact\"\n [tabindex]=\"tabindex\"\n [autofocus]=\"autofocus\">\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-date-time-field>\n\n <!-- enum -->\n <mat-form-field *ngSwitchCase=\"'enum'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n <mat-select [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n (keyup.enter)=\"onKeyupEnter.emit($event)\">\n <mat-option *ngFor=\"let item of definition.values\" [value]=\"item.key || item\">{{ (item.value || item) | translate }}</mat-option>\n </mat-select>\n\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-form-field>\n\n <!-- color -->\n <mat-form-field *ngSwitchCase=\"'color'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n\n <ion-icon margin-right name=\"color-fill\" matPrefix></ion-icon>\n\n <input matInput autocomplete=\"off\"\n [appAutofocus]=\"autofocus\"\n [formControl]=\"formControl\"\n [style.color]=\"getColorContrast(formControl.value)\"\n [style.background]=\"formControl.value\"\n [colorPicker]=\"formControl.value\"\n (colorPickerChange)=\"writeValue($event)\"\n [cpSaveClickOutside]=\"true\"\n cpPosition=\"top\"\n cpOutputFormat=\"hex\"\n [cpOKButton]=\"false\"\n [required]=\"required\"/>\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n <!-- string -->\n <mat-form-field *ngSwitchCase=\"'string'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n <input matInput #matInput\n autocomplete=\"off\"\n [appAutofocus]=\"autofocus\"\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [tabIndex]=\"tabindex\"\n (click)=\"selectInputContent($event)\"\n (keypress)=\"filterAlphanumericalInput($event)\"\n (keyup.enter)=\"onKeyupEnter.emit($event)\">\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-form-field>\n\n <!-- auto-complete -->\n <mat-autocomplete-field *ngSwitchCase=\"'entity'\"\n [class]=\"classList\"\n [autofocus]=\"autofocus\"\n [placeholder]=\"placeholder\"\n [floatLabel]=\"floatLabel\"\n [formControl]=\"formControl\"\n [config]=\"definition.autocomplete\"\n [required]=\"required\"\n [displayWith]=\"getDisplayValueFn(definition)\">\n <ng-content select=\"[matPrefix]\"></ng-content>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </mat-autocomplete-field>\n\n <!-- multi auto-complete -->\n <mat-chips-field *ngSwitchCase=\"'entities'\"\n [class]=\"classList\"\n [placeholder]=\"placeholder\"\n [floatLabel]=\"floatLabel\"\n [formControl]=\"formControl\"\n [config]=\"definition.autocomplete\"\n [required]=\"required\"\n [displayWith]=\"getDisplayValueFn(definition)\">\n <ng-content select=\"[matPrefix]\"></ng-content>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </mat-chips-field>\n\n <!-- other -->\n <div *ngSwitchDefault>\n <mat-error *ngIf=\"type\">Unknown type {{type}} for option {{definition.key}}. Please report this error.</mat-error>\n <mat-error *ngIf=\"!type\">Error on option field. Please check console log for details.</mat-error>\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </div>\n\n</ng-container>\n",
9859
+ template: "<ng-container [ngSwitch]=\"type\">\n\n <!-- integer -->\n <mat-form-field *ngSwitchCase=\"'integer'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n <input matInput #matInput\n type=\"number\"\n autocomplete=\"off\"\n [readonly]=\"readonly\"\n [min]=\"definition.minValue\"\n [max]=\"definition.maxValue\"\n pattern=\"-?[0-9]*\"\n step=\"1\"\n [appAutofocus]=\"autofocus\"\n [placeholder]=\"placeholder\"\n (keyup.enter)=\"onKeyupEnter.emit($event)\"\n (keypress)=\"filterNumberInput($event, false)\"\n [formControl]=\"formControl\"\n [required]=\"required\"\n [tabIndex]=\"tabindex\"\n (click)=\"selectInputContent($event)\">\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf=\"formControl.hasError('min')\">\n {{(compact ? 'ERROR.FIELD_MIN_COMPACT' : 'ERROR.FIELD_MIN') | translate:formControl.errors['min'] }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('max')\">\n {{(compact ? 'ERROR.FIELD_MAX_COMPACT' : 'ERROR.FIELD_MAX') | translate:formControl.errors['max'] }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('pattern')\">\n {{'ERROR.FIELD_NOT_VALID_INTEGER'| translate }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('integer')\">\n {{'ERROR.FIELD_NOT_VALID_INTEGER'| translate }}</mat-error>\n\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-form-field>\n\n <!-- double -->\n <mat-form-field *ngSwitchCase=\"'double'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n\n <input matInput #matInput\n type=\"number\"\n decimal=\"true\"\n autocomplete=\"off\"\n [min]=\"definition.minValue\"\n [max]=\"definition.maxValue\"\n [appAutofocus]=\"autofocus\"\n [readonly]=\"readonly\"\n [placeholder]=\"placeholder\"\n [step]=\"numberInputStep\"\n (keypress)=\"filterNumberInput($event, true)\"\n [formControl]=\"formControl\"\n [required]=\"required\"\n [tabIndex]=\"tabindex\"\n (click)=\"selectInputContent($event)\">\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf=\"formControl.hasError('decimal')\" translate>ERROR.FIELD_NOT_VALID_DECIMAL</mat-error>\n <mat-error *ngIf=\"formControl.hasError('min')\">\n {{ (compact ? 'ERROR.FIELD_MIN_COMPACT' : 'ERROR.FIELD_MIN')| translate:formControl.errors['min'] }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('max')\">\n {{(compact ? 'ERROR.FIELD_MAX_COMPACT' : 'ERROR.FIELD_MAX') | translate:formControl.errors['max'] }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('maxDecimals')\">\n {{ (compact ? 'ERROR.FIELD_MAXIMUM_DECIMALS_COMPACT' : 'ERROR.FIELD_MAXIMUM_DECIMALS')| translate:{max:\n definition.maximumNumberDecimals} }}</mat-error>\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-form-field>\n\n <!-- boolean -->\n <mat-boolean-field *ngSwitchCase=\"'boolean'\" #matInput\n [class]=\"classList\"\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [floatLabel]=\"floatLabel\"\n [required]=\"required\"\n [compact]=\"compact\"\n [tabindex]=\"tabindex\"\n [readonly]=\"readonly\">\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-boolean-field>\n\n <!-- date -->\n <mat-date-field *ngSwitchCase=\"'date'\" #matInput\n [class]=\"classList\"\n [formControl]=\"formControl\"\n [placeholder]=\"compact ? ('COMMON.DATE_PLACEHOLDER'|translate): placeholder\"\n [floatLabel]=\"floatLabel\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [compact]=\"compact\"\n [tabindex]=\"tabindex\"\n [autofocus]=\"autofocus\">\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-date-field>\n\n <!-- date time -->\n <mat-date-time-field *ngSwitchCase=\"'dateTime'\" #matInput\n [class]=\"classList\"\n [formControl]=\"formControl\"\n [placeholder]=\"compact ? ('COMMON.DATE_TIME_PLACEHOLDER'|translate): placeholder\"\n [floatLabel]=\"floatLabel\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [compact]=\"compact\"\n [tabindex]=\"tabindex\"\n [autofocus]=\"autofocus\">\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-date-time-field>\n\n <!-- enum -->\n <mat-form-field *ngSwitchCase=\"'enum'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n <mat-select [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n (keyup.enter)=\"onKeyupEnter.emit($event)\">\n <mat-option *ngFor=\"let item of definition.values\" [value]=\"item.key || item\">{{ (item.value || item) | translate }}</mat-option>\n </mat-select>\n\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-form-field>\n\n <!-- color -->\n <mat-form-field *ngSwitchCase=\"'color'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n\n <ion-icon margin-right name=\"color-fill\" matPrefix></ion-icon>\n\n <input matInput autocomplete=\"off\"\n [appAutofocus]=\"autofocus\"\n [formControl]=\"formControl\"\n [style.color]=\"getColorContrast(formControl.value)\"\n [style.background]=\"formControl.value\"\n [colorPicker]=\"formControl.value\"\n (colorPickerChange)=\"writeValue($event)\"\n [cpSaveClickOutside]=\"true\"\n cpPosition=\"top\"\n cpOutputFormat=\"hex\"\n [cpOKButton]=\"false\"\n [required]=\"required\"/>\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n <!-- string -->\n <mat-form-field *ngSwitchCase=\"'string'\" [floatLabel]=\"floatLabel\" [class]=\"classList\">\n <input matInput #matInput\n autocomplete=\"off\"\n [appAutofocus]=\"autofocus\"\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [tabIndex]=\"tabindex\"\n (click)=\"selectInputContent($event)\"\n (keypress)=\"filterAlphanumericalInput($event)\"\n (keyup.enter)=\"onKeyupEnter.emit($event)\">\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </mat-form-field>\n\n <!-- auto-complete -->\n <mat-autocomplete-field *ngSwitchCase=\"'entity'\"\n [class]=\"classList\"\n [autofocus]=\"autofocus\"\n [placeholder]=\"placeholder\"\n [floatLabel]=\"floatLabel\"\n [formControl]=\"formControl\"\n [config]=\"definition.autocomplete\"\n [required]=\"required\"\n [displayWith]=\"getDisplayValueFn(definition)\">\n <ng-content select=\"[matPrefix]\"></ng-content>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </mat-autocomplete-field>\n\n <!-- multi auto-complete -->\n <mat-chips-field *ngSwitchCase=\"'entities'\"\n [class]=\"classList\"\n [placeholder]=\"placeholder\"\n [floatLabel]=\"floatLabel\"\n [formControl]=\"formControl\"\n [config]=\"definition.autocomplete\"\n [required]=\"required\"\n [displayWith]=\"getDisplayValueFn(definition)\">\n <ng-content select=\"[matPrefix]\"></ng-content>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </mat-chips-field>\n\n <!-- other -->\n <div *ngSwitchDefault>\n <mat-error *ngIf=\"type\">Unknown type {{type}} for option {{definition.key}}. Please report this error.</mat-error>\n <mat-error *ngIf=\"!type\">Error on option field. Please check console log for details.</mat-error>\n <div matSuffix>\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </div>\n\n</ng-container>\n",
9854
9860
  providers: [
9855
9861
  {
9856
9862
  provide: i1.NG_VALUE_ACCESSOR,
@@ -13864,6 +13870,58 @@
13864
13870
  enumerable: false,
13865
13871
  configurable: true
13866
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
+ };
13867
13925
  EntitiesStorage.prototype.watchAll = function (entityName, variables, opts) {
13868
13926
  var _this = this;
13869
13927
  // Make sure store is ready
@@ -14274,52 +14332,8 @@
14274
14332
  };
14275
14333
  EntitiesStorage.prototype.persist = function (opts) {
14276
14334
  if (opts === void 0) { opts = { skipIfPristine: true }; }
14277
- // Skip if pristine
14278
- if (opts.skipIfPristine && !this._dirty)
14279
- return Promise.resolve();
14280
14335
  return this.storeLocally(opts);
14281
14336
  };
14282
- EntitiesStorage.prototype.ngOnStart = function () {
14283
- return __awaiter(this, void 0, void 0, function () {
14284
- var now;
14285
- var _this = this;
14286
- return __generator(this, function (_a) {
14287
- switch (_a.label) {
14288
- case 0:
14289
- now = Date.now();
14290
- console.info("[entities-storage] Starting entity storage...");
14291
- // Restore sequences
14292
- return [4 /*yield*/, this.restoreLocally()];
14293
- case 1:
14294
- // Restore sequences
14295
- _a.sent();
14296
- // Start a save timer
14297
- this.registerSubscription(rxjs.merge(this._$save, rxjs.timer(this._saveTimerPeriod, this._saveTimerPeriod))
14298
- .pipe(
14299
- // Avoid to many call (e.g. when $save AND timer are triggered
14300
- operators.throttleTime(this._saveTimerPeriod))
14301
- .subscribe(function () { return _this.storeLocally(); }));
14302
- console.info("[entities-storage] Starting [OK] in " + (Date.now() - now) + "ms");
14303
- return [2 /*return*/, this._data];
14304
- }
14305
- });
14306
- });
14307
- };
14308
- EntitiesStorage.prototype.ngOnStop = function () {
14309
- return __awaiter(this, void 0, void 0, function () {
14310
- return __generator(this, function (_a) {
14311
- switch (_a.label) {
14312
- case 0:
14313
- if (!this.dirty) return [3 /*break*/, 2];
14314
- return [4 /*yield*/, this.storeLocally()];
14315
- case 1:
14316
- _a.sent();
14317
- _a.label = 2;
14318
- case 2: return [2 /*return*/];
14319
- }
14320
- });
14321
- });
14322
- };
14323
14337
  /* -- protected methods -- */
14324
14338
  EntitiesStorage.prototype.getEntityStore = function (name, opts) {
14325
14339
  var store = this._data[name];
@@ -16811,7 +16825,7 @@
16811
16825
  });
16812
16826
  Object.defineProperty(AccountService.prototype, "$additionalFields", {
16813
16827
  get: function () {
16814
- return this._$additionalFields;
16828
+ return this._$additionalFields.asObservable();
16815
16829
  },
16816
16830
  enumerable: false,
16817
16831
  configurable: true
@@ -18270,7 +18284,7 @@
18270
18284
  switch (platformName) {
18271
18285
  case 'mobile':
18272
18286
  case 'mobileweb':
18273
- // Exclude Windows touch screens - see SUMARIS issue #323
18287
+ // Exclude Windows touch screens - see sumaris-app issues #323 and #346
18274
18288
  return this.platform.is(platformName) && !isWindows(window);
18275
18289
  default:
18276
18290
  return this.platform.is(platformName);
@@ -18343,6 +18357,7 @@
18343
18357
  this._cordova = this.is('cordova');
18344
18358
  this._android = this.is('android');
18345
18359
  this._ios = this.is('ios');
18360
+ this.configureHtmlClassList(this._mobile);
18346
18361
  this.configureCordovaPlugins();
18347
18362
  // Force some settings
18348
18363
  this.settings.mobile = this._mobile;
@@ -18388,7 +18403,7 @@
18388
18403
  _this.accountService.tokenType = tokenType;
18389
18404
  });
18390
18405
  // Hide the splashscreen (if mobile) - after 1s - and play start sound
18391
- if (this.mobile) {
18406
+ if (this._mobile) {
18392
18407
  setTimeout(function () {
18393
18408
  var _a;
18394
18409
  (_a = _this.splashScreen) === null || _a === void 0 ? void 0 : _a.hide();
@@ -18493,6 +18508,16 @@
18493
18508
  //}
18494
18509
  };
18495
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
+ console.warn('[platform] Force class list to: <html class="plt-desktop">. Workaround for Windows touch screen.');
18518
+ win.document.documentElement.classList.replace('plt-mobile', 'plt-desktop');
18519
+ }
18520
+ };
18496
18521
  PlatformService.prototype.configureCordovaPlugins = function () {
18497
18522
  console.info('[platform] Configuring Cordova plugins...');
18498
18523
  if (this.statusBar) {
@@ -21949,8 +21974,9 @@
21949
21974
  _this.setValue(_this.accountService.account);
21950
21975
  _this.markAsPristine();
21951
21976
  }));
21952
- _this.registerSubscription(_this.accountService.$additionalFields.subscribe(function (additionalFields) {
21953
- _this.additionalFields = additionalFields.slice();
21977
+ _this.registerSubscription(_this.accountService.$additionalFields
21978
+ .subscribe(function (additionalFields) {
21979
+ _this.additionalFields = additionalFields.slice(); // Copy
21954
21980
  if (accountService.isLogin()) {
21955
21981
  _this.onLogin(_this.accountService.account);
21956
21982
  }
@@ -22007,7 +22033,7 @@
22007
22033
  };
22008
22034
  AccountPage.prototype.refresh = function (event) {
22009
22035
  return __awaiter(this, void 0, void 0, function () {
22010
- return __generator(this, function (_b) {
22036
+ return __generator(this, function (_c) {
22011
22037
  this.disable();
22012
22038
  this.markAsLoading();
22013
22039
  return [2 /*return*/, this.accountService.reload()];
@@ -22028,8 +22054,8 @@
22028
22054
  AccountPage.prototype.sendConfirmationEmail = function (event) {
22029
22055
  return __awaiter(this, void 0, void 0, function () {
22030
22056
  var json, err_1;
22031
- return __generator(this, function (_b) {
22032
- switch (_b.label) {
22057
+ return __generator(this, function (_c) {
22058
+ switch (_c.label) {
22033
22059
  case 0:
22034
22060
  json = this.form.value;
22035
22061
  json.email = this.form.controls['email'].value;
@@ -22039,17 +22065,17 @@
22039
22065
  }
22040
22066
  this.email.sending = true;
22041
22067
  console.debug('[account] Sending confirmation email...');
22042
- _b.label = 1;
22068
+ _c.label = 1;
22043
22069
  case 1:
22044
- _b.trys.push([1, 3, , 4]);
22070
+ _c.trys.push([1, 3, , 4]);
22045
22071
  return [4 /*yield*/, this.accountService.sendConfirmationEmail(json.email, json.settings && json.settings.locale || this.translate.currentLang)];
22046
22072
  case 2:
22047
- _b.sent();
22073
+ _c.sent();
22048
22074
  console.debug('[account] Confirmation email sent.');
22049
22075
  this.email.sending = false;
22050
22076
  return [3 /*break*/, 4];
22051
22077
  case 3:
22052
- err_1 = _b.sent();
22078
+ err_1 = _c.sent();
22053
22079
  this.email.sending = false;
22054
22080
  this.email.error = err_1 && err_1.message || err_1;
22055
22081
  return [3 /*break*/, 4];
@@ -22061,38 +22087,38 @@
22061
22087
  AccountPage.prototype.save = function (event) {
22062
22088
  return __awaiter(this, void 0, void 0, function () {
22063
22089
  var newAccount, err_2;
22064
- return __generator(this, function (_b) {
22065
- switch (_b.label) {
22090
+ return __generator(this, function (_c) {
22091
+ switch (_c.label) {
22066
22092
  case 0:
22067
22093
  if (this.saving)
22068
22094
  return [2 /*return*/, false];
22069
22095
  if (!!this.form.valid) return [3 /*break*/, 2];
22070
22096
  return [4 /*yield*/, AppFormUtils.waitWhilePending(this.form)];
22071
22097
  case 1:
22072
- _b.sent();
22098
+ _c.sent();
22073
22099
  if (this.form.invalid) {
22074
22100
  AppFormUtils.logFormErrors(this.form);
22075
22101
  this.form.markAllAsTouched();
22076
22102
  return [2 /*return*/, false];
22077
22103
  }
22078
- _b.label = 2;
22104
+ _c.label = 2;
22079
22105
  case 2:
22080
22106
  this.submitted = true;
22081
22107
  this.saving = true;
22082
22108
  this.error = undefined;
22083
22109
  newAccount = exports.Account.fromObject(Object.assign(Object.assign({}, (this.accountService.account.asObject())), (this.form.value)));
22084
22110
  console.debug('[account] Saving account...', newAccount);
22085
- _b.label = 3;
22111
+ _c.label = 3;
22086
22112
  case 3:
22087
- _b.trys.push([3, 5, 6, 7]);
22113
+ _c.trys.push([3, 5, 6, 7]);
22088
22114
  this.disable();
22089
22115
  return [4 /*yield*/, this.accountService.save(newAccount)];
22090
22116
  case 4:
22091
- _b.sent();
22117
+ _c.sent();
22092
22118
  this.markAsPristine();
22093
22119
  return [2 /*return*/, true];
22094
22120
  case 5:
22095
- err_2 = _b.sent();
22121
+ err_2 = _c.sent();
22096
22122
  console.error(err_2);
22097
22123
  this.error = err_2 && err_2.message || err_2;
22098
22124
  return [2 /*return*/, false];
@@ -22114,9 +22140,21 @@
22114
22140
  this.form.controls.pubkey.disable();
22115
22141
  // Always disable some additional fields
22116
22142
  this.additionalFields
22117
- .filter(function (field) { return field.extra && field.extra.account && field.extra.account.disabled || false; })
22118
22143
  .forEach(function (field) {
22119
- _this.form.controls[field.key].disable();
22144
+ var _a, _b;
22145
+ var control = _this.form.controls[field.key];
22146
+ if (!control)
22147
+ return; // Skip
22148
+ var disabled = ((_a = field.extra) === null || _a === void 0 ? void 0 : _a.account) && field.extra.account.disabled || false;
22149
+ if (disabled && control.enabled) {
22150
+ control.disable();
22151
+ }
22152
+ var required = ((_b = field.extra) === null || _b === void 0 ? void 0 : _b.account) && field.extra.account.required || false;
22153
+ if (!field.required && required) {
22154
+ control.setValidators(control.validator
22155
+ ? i1.Validators.compose([control.validator, i1.Validators.required])
22156
+ : i1.Validators.required);
22157
+ }
22120
22158
  });
22121
22159
  this.markForCheck();
22122
22160
  };
@@ -22125,7 +22163,7 @@
22125
22163
  cancel: { get: function () { return _super_1.prototype.cancel; } }
22126
22164
  });
22127
22165
  return __awaiter(this, void 0, void 0, function () {
22128
- return __generator(this, function (_b) {
22166
+ return __generator(this, function (_c) {
22129
22167
  _super.cancel.call(this);
22130
22168
  return [2 /*return*/];
22131
22169
  });