@sumaris-net/ngx-components 1.18.0-rc1 → 1.18.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.
Files changed (32) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +54 -49
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/doc/changelog.md +4 -0
  6. package/esm2015/src/app/core/graphql/graphql.service.js +3 -2
  7. package/esm2015/src/app/core/services/config.service.js +3 -2
  8. package/esm2015/src/app/core/services/local-settings.service.js +2 -2
  9. package/esm2015/src/app/core/services/platform.service.js +12 -11
  10. package/esm2015/src/app/shared/directives/autofocus.directive.js +4 -2
  11. package/esm2015/src/app/shared/hotkeys/hotkeys.service.js +11 -7
  12. package/esm2015/src/app/shared/material/datetime/material.date.js +8 -9
  13. package/esm2015/src/app/shared/material/datetime/material.dateshort.js +8 -8
  14. package/esm2015/src/app/shared/material/datetime/material.datetime.js +7 -8
  15. package/esm2015/src/app/shared/material/datetime/testing/mat-date-time.test.js +3 -3
  16. package/esm2015/src/app/shared/material/datetime/testing/mat-date.test.js +4 -7
  17. package/esm2015/src/app/shared/material/latlong/material.latlong.js +4 -6
  18. package/esm2015/src/app/shared/platforms.js +2 -2
  19. package/esm2015/src/app/shared/services/entity-service.class.js +1 -1
  20. package/fesm2015/sumaris-net.ngx-components.js +45 -47
  21. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/app/core/services/platform.service.d.ts +1 -1
  24. package/src/app/shared/directives/autofocus.directive.d.ts +2 -1
  25. package/src/app/shared/hotkeys/hotkeys.service.d.ts +3 -2
  26. package/src/app/shared/material/datetime/material.date.d.ts +2 -4
  27. package/src/app/shared/material/datetime/material.dateshort.d.ts +2 -3
  28. package/src/app/shared/material/datetime/material.datetime.d.ts +1 -3
  29. package/src/app/shared/material/datetime/testing/mat-date.test.d.ts +1 -3
  30. package/src/app/shared/material/latlong/material.latlong.d.ts +1 -3
  31. package/src/app/shared/services/entity-service.class.d.ts +4 -1
  32. package/sumaris-net.ngx-components.metadata.json +1 -1
@@ -4856,7 +4856,7 @@
4856
4856
  };
4857
4857
  var isWindows = function (win) { return testUserAgent(win, /windows/i); };
4858
4858
  var isTouchUi = function (win) { return matchMedia(win, '(any-pointer:coarse)'); };
4859
- var isMobile = function (win) { return isTouchUi(win) && !isWindows(win); };
4859
+ var isMobile = function (win) { return isCordova(window) || isAndroid(win) || isIOS(window) || (isTouchUi(win) && !isWindows(win)); };
4860
4860
  var isIpad = function (win) {
4861
4861
  // iOS 12 and below
4862
4862
  if (testUserAgent(win, /iPad/i)) {
@@ -4879,7 +4879,7 @@
4879
4879
  var BASE_TIMER_DELAY = 100;
4880
4880
  var AutofocusDirective = /** @class */ (function () {
4881
4881
  // I initialize the autofocus directive.
4882
- function AutofocusDirective(elementRef, keyboard) {
4882
+ function AutofocusDirective(platform, elementRef, keyboard) {
4883
4883
  this.keyboard = keyboard;
4884
4884
  this._timer = null;
4885
4885
  this._elementRef = elementRef;
@@ -4956,6 +4956,7 @@
4956
4956
  },] }
4957
4957
  ];
4958
4958
  AutofocusDirective.ctorParameters = function () { return [
4959
+ { type: i1$5.Platform },
4959
4960
  { type: i0.ElementRef },
4960
4961
  { type: ngx.Keyboard, decorators: [{ type: i0.Optional }] }
4961
4962
  ]; };
@@ -5147,8 +5148,7 @@
5147
5148
  };
5148
5149
  var ɵ0$a = noop$7;
5149
5150
  var MatLatLongField = /** @class */ (function () {
5150
- function MatLatLongField(platform, translate, formBuilder, cd, formGroupDir) {
5151
- this.platform = platform;
5151
+ function MatLatLongField(translate, formBuilder, cd, formGroupDir) {
5152
5152
  this.translate = translate;
5153
5153
  this.formBuilder = formBuilder;
5154
5154
  this.cd = cd;
@@ -5165,7 +5165,6 @@
5165
5165
  this.required = false;
5166
5166
  this.onBlur = new i0.EventEmitter();
5167
5167
  this.onFocus = new i0.EventEmitter();
5168
- this.mobile = this.platform.is('mobile');
5169
5168
  }
5170
5169
  Object.defineProperty(MatLatLongField.prototype, "disabled", {
5171
5170
  get: function () {
@@ -5187,6 +5186,7 @@
5187
5186
  });
5188
5187
  MatLatLongField.prototype.ngOnInit = function () {
5189
5188
  var _this = this;
5189
+ this.mobile = isNotNil(this.mobile) ? this.mobile : isMobile(window);
5190
5190
  this.type = this.type || 'latitude';
5191
5191
  this.pattern = this.pattern || 'DDMM';
5192
5192
  this.mask = MASKS[this.type] && MASKS[this.type][this.pattern];
@@ -5451,7 +5451,6 @@
5451
5451
  },] }
5452
5452
  ];
5453
5453
  MatLatLongField.ctorParameters = function () { return [
5454
- { type: i1$5.Platform },
5455
5454
  { type: i1$2.TranslateService },
5456
5455
  { type: i1.FormBuilder },
5457
5456
  { type: i0.ChangeDetectorRef },
@@ -5515,8 +5514,7 @@
5515
5514
  var noop$6 = function () { };
5516
5515
  var ɵ0$9 = noop$6;
5517
5516
  var MatDate = /** @class */ (function () {
5518
- function MatDate(platform, dateAdapter, translate, formBuilder, cd, keyboard, formGroupDir) {
5519
- this.platform = platform;
5517
+ function MatDate(dateAdapter, translate, formBuilder, cd, keyboard, formGroupDir) {
5520
5518
  this.dateAdapter = dateAdapter;
5521
5519
  this.translate = translate;
5522
5520
  this.formBuilder = formBuilder;
@@ -5573,11 +5571,12 @@
5573
5571
  });
5574
5572
  MatDate.prototype.ngOnInit = function () {
5575
5573
  var _this = this;
5576
- this.mobile = isNil(this.mobile) ? this.platform.is('mobile') : this.mobile;
5577
- this._keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
5578
5574
  this.formControl = this.formControl || this.formControlName && this.formGroupDir && this.formGroupDir.form.get(this.formControlName);
5579
5575
  if (!this.formControl)
5580
5576
  throw new Error('Missing mandatory attribute \'formControl\' or \'formControlName\' in <mat-date-field>.');
5577
+ this.mobile = isNotNil(this.mobile) ? this.mobile : isMobile(window);
5578
+ // Workaround because ion-datetime has issue (do not returned a ISO date)
5579
+ this._keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
5581
5580
  this.required = toBoolean(this.required, this.formControl.validator === i1.Validators.required);
5582
5581
  // Add 'validDate' validator (when existing validator are null or required, to be sure to keep it)
5583
5582
  if (!this.formControl.validator || this.formControl.validator === i1.Validators.required) {
@@ -5859,7 +5858,6 @@
5859
5858
  },] }
5860
5859
  ];
5861
5860
  MatDate.ctorParameters = function () { return [
5862
- { type: i1$5.Platform },
5863
5861
  { type: i1$3.DateAdapter },
5864
5862
  { type: i1$2.TranslateService },
5865
5863
  { type: i1.FormBuilder },
@@ -5868,12 +5866,12 @@
5868
5866
  { type: i1.FormGroupDirective, decorators: [{ type: i0.Optional }] }
5869
5867
  ]; };
5870
5868
  MatDate.propDecorators = {
5869
+ mobile: [{ type: i0.Input }],
5871
5870
  formControl: [{ type: i0.Input }],
5872
5871
  formControlName: [{ type: i0.Input }],
5873
5872
  placeholder: [{ type: i0.Input }],
5874
5873
  floatLabel: [{ type: i0.Input }],
5875
5874
  required: [{ type: i0.Input }],
5876
- mobile: [{ type: i0.Input }],
5877
5875
  compact: [{ type: i0.Input }],
5878
5876
  placeholderChar: [{ type: i0.Input }],
5879
5877
  autofocus: [{ type: i0.Input }],
@@ -5898,8 +5896,7 @@
5898
5896
  var noop$5 = function () { };
5899
5897
  var ɵ0$8 = noop$5;
5900
5898
  var MatDateTime = /** @class */ (function () {
5901
- function MatDateTime(platform, dateAdapter, translate, formBuilder, cd, keyboard, formGroupDir) {
5902
- this.platform = platform;
5899
+ function MatDateTime(dateAdapter, translate, formBuilder, cd, keyboard, formGroupDir) {
5903
5900
  this.dateAdapter = dateAdapter;
5904
5901
  this.translate = translate;
5905
5902
  this.formBuilder = formBuilder;
@@ -5956,11 +5953,12 @@
5956
5953
  });
5957
5954
  MatDateTime.prototype.ngOnInit = function () {
5958
5955
  var _this = this;
5959
- this.mobile = isNil(this.mobile) ? this.platform.is('mobile') : this.mobile;
5960
- this._keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
5961
5956
  this.formControl = this.formControl || this.formControlName && this.formGroupDir && this.formGroupDir.form.get(this.formControlName);
5962
5957
  if (!this.formControl)
5963
5958
  throw new Error('Missing mandatory attribute \'formControl\' or \'formControlName\' in <mat-date-time-field>.');
5959
+ this.mobile = isNotNil(this.mobile) ? this.mobile : isMobile(window);
5960
+ // Workaround because ion-datetime has issue (do not returned a ISO date)
5961
+ this._keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
5964
5962
  this.required = toBoolean(this.required, this.formControl.validator === i1.Validators.required);
5965
5963
  // Add 'validDate' validator (when existing validator are null or required, to be sure to keep it)
5966
5964
  if (!this.formControl.validator || this.formControl.validator === i1.Validators.required) {
@@ -6278,7 +6276,6 @@
6278
6276
  },] }
6279
6277
  ];
6280
6278
  MatDateTime.ctorParameters = function () { return [
6281
- { type: i1$5.Platform },
6282
6279
  { type: i1$3.DateAdapter },
6283
6280
  { type: i1$2.TranslateService },
6284
6281
  { type: i1.FormBuilder },
@@ -6316,7 +6313,7 @@
6316
6313
  };
6317
6314
  var ɵ0$7 = noop$4;
6318
6315
  var MatDateShort = /** @class */ (function () {
6319
- function MatDateShort(platform, dateAdapter, translate, formBuilder, cd, keyboard, formGroupDir) {
6316
+ function MatDateShort(dateAdapter, translate, formBuilder, cd, keyboard, formGroupDir) {
6320
6317
  this.dateAdapter = dateAdapter;
6321
6318
  this.translate = translate;
6322
6319
  this.formBuilder = formBuilder;
@@ -6334,9 +6331,6 @@
6334
6331
  this.compact = false;
6335
6332
  this.placeholderChar = DEFAULT_PLACEHOLDER_CHAR;
6336
6333
  this.clearable = false;
6337
- // Workaround because ion-datetime has issue (do not returned a ISO date)
6338
- this.mobile = platform.is('mobile');
6339
- this.keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
6340
6334
  this.locale = (translate.currentLang || translate.defaultLang).substr(0, 2);
6341
6335
  }
6342
6336
  Object.defineProperty(MatDateShort.prototype, "tabindex", {
@@ -6365,6 +6359,9 @@
6365
6359
  this.formControl = this.formControl || this.formControlName && this.formGroupDir && this.formGroupDir.form.get(this.formControlName);
6366
6360
  if (!this.formControl)
6367
6361
  throw new Error('Missing mandatory attribute \'formControl\' or \'formControlName\' in <mat-date-short-field>.');
6362
+ this.mobile = isNotNil(this.mobile) ? this.mobile : isMobile(window);
6363
+ // Workaround because ion-datetime has issue (do not returned a ISO date)
6364
+ this.keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
6368
6365
  // Redirect errors from main control, into day sub control
6369
6366
  var $error = new rxjs.BehaviorSubject(null);
6370
6367
  this.required = toBoolean(this.required, this.formControl.validator === i1.Validators.required);
@@ -6611,7 +6608,6 @@
6611
6608
  },] }
6612
6609
  ];
6613
6610
  MatDateShort.ctorParameters = function () { return [
6614
- { type: i1$5.Platform },
6615
6611
  { type: i1$3.DateAdapter },
6616
6612
  { type: i1$2.TranslateService },
6617
6613
  { type: i1.FormBuilder },
@@ -6620,6 +6616,7 @@
6620
6616
  { type: i1.FormGroupDirective, decorators: [{ type: i0.Optional }] }
6621
6617
  ]; };
6622
6618
  MatDateShort.propDecorators = {
6619
+ mobile: [{ type: i0.Input }],
6623
6620
  disabled: [{ type: i0.Input }],
6624
6621
  formControl: [{ type: i0.Input }],
6625
6622
  formControlName: [{ type: i0.Input }],
@@ -10165,12 +10162,13 @@
10165
10162
  ]; };
10166
10163
 
10167
10164
  var Hotkeys = /** @class */ (function () {
10168
- function Hotkeys(eventManager, dialog, document, modalController) {
10165
+ function Hotkeys(eventManager, dialog, document, modalController, popoverController) {
10169
10166
  var _this = this;
10170
10167
  this.eventManager = eventManager;
10171
10168
  this.dialog = dialog;
10172
10169
  this.document = document;
10173
10170
  this.modalController = modalController;
10171
+ this.popoverController = popoverController;
10174
10172
  this._debug = false;
10175
10173
  this._hotkeys = new Map();
10176
10174
  this._defaults = {
@@ -10199,15 +10197,24 @@
10199
10197
  }
10200
10198
  return new rxjs.Observable(function (observer) {
10201
10199
  var handler = function (e) { return __awaiter(_this, void 0, void 0, function () {
10202
- var top;
10203
- return __generator(this, function (_a) {
10204
- switch (_a.label) {
10200
+ var top, _a;
10201
+ return __generator(this, function (_b) {
10202
+ switch (_b.label) {
10205
10203
  case 0: return [4 /*yield*/, this.modalController.getTop()];
10206
10204
  case 1:
10207
- top = _a.sent();
10205
+ _a = (_b.sent());
10206
+ if (_a) return [3 /*break*/, 3];
10207
+ return [4 /*yield*/, this.popoverController.getTop()];
10208
+ case 2:
10209
+ _a = (_b.sent());
10210
+ _b.label = 3;
10211
+ case 3:
10212
+ top = _a;
10208
10213
  // If modal present, check its component name against hotkey element name (fix #181)
10209
- if (top && top.component['name'] !== merged.elementName)
10214
+ if (top && top.component['name'] !== merged.elementName) {
10215
+ e.preventDefault();
10210
10216
  return [2 /*return*/];
10217
+ }
10211
10218
  if (e instanceof KeyboardEvent && e.repeat)
10212
10219
  return [2 /*return*/]; // skip when repeated
10213
10220
  if (merged.preventDefault)
@@ -10234,7 +10241,7 @@
10234
10241
  };
10235
10242
  return Hotkeys;
10236
10243
  }());
10237
- Hotkeys.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function Hotkeys_Factory() { return new Hotkeys(i0__namespace.ɵɵinject(i1__namespace$5.EventManager), i0__namespace.ɵɵinject(i2__namespace$1.MatDialog), i0__namespace.ɵɵinject(i1__namespace$3.DOCUMENT), i0__namespace.ɵɵinject(i1__namespace$4.ModalController)); }, token: Hotkeys, providedIn: "root" });
10244
+ Hotkeys.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function Hotkeys_Factory() { return new Hotkeys(i0__namespace.ɵɵinject(i1__namespace$5.EventManager), i0__namespace.ɵɵinject(i2__namespace$1.MatDialog), i0__namespace.ɵɵinject(i1__namespace$3.DOCUMENT), i0__namespace.ɵɵinject(i1__namespace$4.ModalController), i0__namespace.ɵɵinject(i1__namespace$4.PopoverController)); }, token: Hotkeys, providedIn: "root" });
10238
10245
  Hotkeys.decorators = [
10239
10246
  { type: i0.Injectable, args: [{
10240
10247
  providedIn: 'root'
@@ -10244,7 +10251,8 @@
10244
10251
  { type: i1$6.EventManager },
10245
10252
  { type: i2.MatDialog },
10246
10253
  { type: undefined, decorators: [{ type: i0.Inject, args: [i1$4.DOCUMENT,] }] },
10247
- { type: i1$5.ModalController }
10254
+ { type: i1$5.ModalController },
10255
+ { type: i1$5.PopoverController }
10248
10256
  ]; };
10249
10257
 
10250
10258
  var SharedHotkeysModule = /** @class */ (function () {
@@ -11792,7 +11800,7 @@
11792
11800
  LocalSettingsService.prototype.ngOnStart = function () {
11793
11801
  console.info('[settings] Starting service...');
11794
11802
  // Restoring local settings
11795
- this._data.mobile = isNotNil(this._data.mobile) ? this._data.mobile : isMobile(window);
11803
+ this._data.mobile = isNotNil(this._data.mobile) ? this._data.mobile : (isCordova(window) || isMobile(window));
11796
11804
  this._data.usageMode = (isAndroid(window) || isIOS(window)) ? 'FIELD' : 'DESK'; // FIELD by default if Android or iOS
11797
11805
  // Restoring local settings
11798
11806
  return this.restoreLocally();
@@ -15396,7 +15404,7 @@
15396
15404
  case 1:
15397
15405
  _a.sent();
15398
15406
  console.info('[graphql] Starting graphql...');
15399
- mobile = this.platform.is('mobile') || this.platform.is('mobileweb');
15407
+ mobile = isMobile(window);
15400
15408
  enableTrackMutationQueries = !mobile;
15401
15409
  peer = this.network.peer;
15402
15410
  if (!peer)
@@ -17759,7 +17767,7 @@
17759
17767
  return [3 /*break*/, 8];
17760
17768
  case 2:
17761
17769
  now = this._debug && Date.now();
17762
- if (!(this.network.online && this.platform.is('mobile'))) return [3 /*break*/, 6];
17770
+ if (!(this.network.online && isMobile(window))) return [3 /*break*/, 6];
17763
17771
  jobs_1 = [];
17764
17772
  // Download logos
17765
17773
  if (data.largeLogo && data.largeLogo.startsWith('http')) {
@@ -17901,15 +17909,16 @@
17901
17909
  PlatformService.prototype.is = function (platformName) {
17902
17910
  switch (platformName) {
17903
17911
  case 'mobile':
17904
- // Use custom mobile detection - see SUMARIS issue #323
17905
- return isMobile(window);
17912
+ case 'mobileweb':
17913
+ // Exclude Windows touch screens - see SUMARIS issue #323
17914
+ return this.platform.is(platformName) && !isWindows(window);
17906
17915
  default:
17907
17916
  return this.platform.is(platformName);
17908
17917
  }
17909
17918
  };
17910
17919
  Object.defineProperty(PlatformService.prototype, "mobile", {
17911
17920
  get: function () {
17912
- return isNotNil(this._mobile) ? this._mobile : isMobile(window);
17921
+ return isNotNil(this._mobile) ? this._mobile : this.is('mobile');
17913
17922
  },
17914
17923
  enumerable: false,
17915
17924
  configurable: true
@@ -17927,18 +17936,18 @@
17927
17936
  PlatformService.prototype.isIOSCordova = function () {
17928
17937
  return this._ios && this._cordova || false;
17929
17938
  };
17930
- PlatformService.prototype.isWeb = function () {
17931
- return !this._cordova || (!this._android && !this._ios);
17932
- };
17933
17939
  PlatformService.prototype.isApp = function () {
17934
- return this._cordova && (this._android || this._ios);
17940
+ return this.isAndroidCordova() || this.isIOSCordova();
17941
+ };
17942
+ PlatformService.prototype.isWeb = function () {
17943
+ return !this.isApp();
17935
17944
  };
17936
17945
  PlatformService.prototype.isMobileWeb = function () {
17937
- return isMobile(window) && this.isWeb();
17946
+ return this.mobile && this.isWeb();
17938
17947
  };
17939
17948
  Object.defineProperty(PlatformService.prototype, "canDownload", {
17940
17949
  get: function () {
17941
- return !!this.downloader && this.isAndroidCordova();
17950
+ return this.downloader && this.isAndroidCordova();
17942
17951
  },
17943
17952
  enumerable: false,
17944
17953
  configurable: true
@@ -30209,8 +30218,7 @@
30209
30218
  disableControl.disable();
30210
30219
  // Copy the 'enable' value, into the disable control
30211
30220
  this.form.get('enable').valueChanges.subscribe(function (value) { return disableControl.setValue(value); });
30212
- var mobile = platform.is('mobile');
30213
- this.showLogPanel = this.showLogPanel || mobile;
30221
+ this.showLogPanel = this.showLogPanel || isMobile(window);
30214
30222
  }
30215
30223
  DateTimeTestPage.prototype.ngOnInit = function () {
30216
30224
  var _this = this;
@@ -30500,8 +30508,7 @@
30500
30508
 
30501
30509
  var moment = momentImported__namespace;
30502
30510
  var DateTestPage = /** @class */ (function () {
30503
- function DateTestPage(platform, formBuilder, cd) {
30504
- this.platform = platform;
30511
+ function DateTestPage(formBuilder, cd) {
30505
30512
  this.formBuilder = formBuilder;
30506
30513
  this.cd = cd;
30507
30514
  this.showLogPanel = true;
@@ -30523,8 +30530,7 @@
30523
30530
  disableControl.disable();
30524
30531
  // Copy the 'enable' value, into the disable control
30525
30532
  this.form.get('enable').valueChanges.subscribe(function (value) { return disableControl.setValue(value); });
30526
- var mobile = platform.is('mobile');
30527
- this.showLogPanel = this.showLogPanel || mobile;
30533
+ this.showLogPanel = this.showLogPanel || isMobile(window);
30528
30534
  }
30529
30535
  DateTestPage.prototype.ngOnInit = function () {
30530
30536
  var _this = this;
@@ -30601,7 +30607,6 @@
30601
30607
  },] }
30602
30608
  ];
30603
30609
  DateTestPage.ctorParameters = function () { return [
30604
- { type: i1$5.Platform },
30605
30610
  { type: i1.FormBuilder },
30606
30611
  { type: i0.ChangeDetectorRef }
30607
30612
  ]; };