@sumaris-net/ngx-components 1.9.8 → 1.10.1

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 (47) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +116 -34
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/doc/changelog.md +4 -0
  6. package/esm2015/public_api.js +2 -2
  7. package/esm2015/src/app/core/form/editor.class.js +2 -2
  8. package/esm2015/src/app/core/graphql/graphql.service.js +4 -4
  9. package/esm2015/src/app/core/home/home.js +2 -2
  10. package/esm2015/src/app/core/install/install-upgrade-card.component.js +2 -2
  11. package/esm2015/src/app/core/services/account.service.js +8 -4
  12. package/esm2015/src/app/core/services/config.service.js +2 -2
  13. package/esm2015/src/app/core/services/network.service.js +5 -5
  14. package/esm2015/src/app/core/services/platform.service.js +3 -4
  15. package/esm2015/src/app/core/services/testing/referential-filter.model.js +23 -0
  16. package/esm2015/src/app/core/services/testing/referential.validator.js +44 -0
  17. package/esm2015/src/app/core/table/table.class.js +32 -20
  18. package/esm2015/src/app/shared/shared.testing.module.js +9 -3
  19. package/esm2015/src/app/shared/toast/toast.testing.js +39 -0
  20. package/esm2015/src/app/shared/toast/toast.testing.module.js +33 -0
  21. package/esm2015/src/app/shared/toast/toasts.js +119 -0
  22. package/esm2015/src/app/social/services/user-event.service.js +2 -2
  23. package/esm2015/sumaris-net.ngx-components.js +9 -7
  24. package/fesm2015/sumaris-net.ngx-components.js +114 -32
  25. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  26. package/package.json +1 -1
  27. package/public_api.d.ts +1 -1
  28. package/src/app/core/form/editor.class.d.ts +1 -1
  29. package/src/app/core/home/home.d.ts +1 -1
  30. package/src/app/core/services/account.service.d.ts +4 -2
  31. package/src/app/core/services/config.service.d.ts +1 -1
  32. package/src/app/core/services/network.service.d.ts +1 -1
  33. package/src/app/core/services/platform.service.d.ts +1 -1
  34. package/src/app/core/services/testing/referential-filter.model.d.ts +9 -0
  35. package/src/app/core/services/testing/referential.validator.d.ts +19 -0
  36. package/src/app/core/table/table.class.d.ts +1 -1
  37. package/src/app/shared/shared.testing.module.d.ts +2 -0
  38. package/src/app/shared/toast/toast.testing.d.ts +14 -0
  39. package/src/app/shared/toast/toast.testing.module.d.ts +2 -0
  40. package/src/app/shared/{toasts.d.ts → toast/toasts.d.ts} +0 -0
  41. package/src/app/social/services/user-event.service.d.ts +1 -1
  42. package/src/assets/i18n/en-US.json +4 -1
  43. package/src/assets/i18n/en.json +4 -1
  44. package/src/assets/i18n/fr.json +4 -1
  45. package/sumaris-net.ngx-components.d.ts +8 -6
  46. package/sumaris-net.ngx-components.metadata.json +1 -1
  47. package/esm2015/src/app/shared/toasts.js +0 -119
@@ -12277,7 +12277,7 @@
12277
12277
  this.onNetworkStatusChanges.next(currentConnectionType);
12278
12278
  // Offline mode: alert the user
12279
12279
  if (currentConnectionType === 'none' && (!opts || opts.showToast !== false)) {
12280
- this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP' });
12280
+ this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP', type: 'warning' });
12281
12281
  }
12282
12282
  }
12283
12283
  }
@@ -12534,11 +12534,11 @@
12534
12534
  // Force offline mode
12535
12535
  this._forceOffline = true;
12536
12536
  // Alert the user
12537
- this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP' });
12537
+ this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP', type: 'warning' });
12538
12538
  }
12539
12539
  else {
12540
12540
  // Alert the user
12541
- this.showToast({ message: 'NETWORK.INFO.OFFLINE' });
12541
+ this.showToast({ message: 'NETWORK.INFO.OFFLINE', type: 'warning' });
12542
12542
  }
12543
12543
  // Stop the network service
12544
12544
  this.stop();
@@ -14861,7 +14861,7 @@
14861
14861
  case 0:
14862
14862
  client = (client || this.client);
14863
14863
  if (!client) return [3 /*break*/, 2];
14864
- console.info('[graphql] Clearing Apollo client\'s cache... ');
14864
+ console.info('[graphql] Cleaning cache... ');
14865
14865
  now = this._debug && Date.now();
14866
14866
  // Clearing the cache
14867
14867
  return [4 /*yield*/, client.cache.reset()];
@@ -14869,7 +14869,7 @@
14869
14869
  // Clearing the cache
14870
14870
  _a.sent();
14871
14871
  if (this._debug)
14872
- console.debug("[graphql] Apollo client's cache cleared, in " + (Date.now() - now) + "ms");
14872
+ console.debug("[graphql] Cleaning cache [OK] in " + (Date.now() - now) + "ms");
14873
14873
  _a.label = 2;
14874
14874
  case 2: return [2 /*return*/];
14875
14875
  }
@@ -15054,7 +15054,7 @@
15054
15054
  client = (client || this.apollo.client);
15055
15055
  if (!client)
15056
15056
  return [2 /*return*/];
15057
- console.info('[graphql] Resetting apollo client...');
15057
+ console.info('[graphql] Resetting Apollo client...');
15058
15058
  client.stop();
15059
15059
  return [4 /*yield*/, Promise.all([
15060
15060
  client.clearStore(),
@@ -15873,7 +15873,7 @@
15873
15873
  });
15874
15874
  });
15875
15875
  };
15876
- AccountService.prototype.reload = function () {
15876
+ AccountService.prototype.reload = function (opts) {
15877
15877
  return __awaiter(this, void 0, void 0, function () {
15878
15878
  var now, wasLogin, error_6;
15879
15879
  return __generator(this, function (_b) {
@@ -15899,6 +15899,10 @@
15899
15899
  // Emit login event to subscribers
15900
15900
  this.onLogin.next(this._data);
15901
15901
  this.onChange.next(this._data);
15902
+ // Display toast (without await, because not need to wait toast close event)
15903
+ if (!opts || opts.showToast !== false) {
15904
+ this.showToast({ message: 'ACCOUNT.INFO.RELOADED', type: 'info' });
15905
+ }
15902
15906
  return [2 /*return*/, this._data];
15903
15907
  case 4:
15904
15908
  error_6 = _b.sent();
@@ -16657,7 +16661,7 @@
16657
16661
  variables: variables,
16658
16662
  error: {
16659
16663
  code: ErrorCodes$2.SUBSCRIBE_ACCOUNT_ERROR,
16660
- message: 'ERROR.ACCOUNT.SUBSCRIBE_ACCOUNT_ERROR'
16664
+ message: 'ERROR.ACCOUNT.SUBSCRIBE_ERROR'
16661
16665
  }
16662
16666
  }).pipe(operators.map(function (_b) {
16663
16667
  var data = _b.data;
@@ -17674,8 +17678,7 @@
17674
17678
  case 3:
17675
17679
  now = Date.now();
17676
17680
  console.info("[platform] Starting storage migration...");
17677
- return [4 /*yield*/, this.showToast({ message: 'INFO.DATA_MIGRATION_STARTED',
17678
- duration: 30000 })];
17681
+ return [4 /*yield*/, this.showToast({ message: 'INFO.DATA_MIGRATION_STARTED', type: 'info', duration: 30000 })];
17679
17682
  case 4:
17680
17683
  toast_1 = _b.sent();
17681
17684
  _b.label = 5;
@@ -19803,7 +19806,7 @@
19803
19806
  },] }
19804
19807
  ];
19805
19808
 
19806
- var routes$1 = [
19809
+ var routes$2 = [
19807
19810
  {
19808
19811
  path: '',
19809
19812
  pathMatch: 'full',
@@ -19858,7 +19861,7 @@
19858
19861
  i1.ReactiveFormsModule,
19859
19862
  SharedMaterialModule,
19860
19863
  i1$2.TranslateModule.forChild(),
19861
- i3.RouterModule.forChild(routes$1)
19864
+ i3.RouterModule.forChild(routes$2)
19862
19865
  ],
19863
19866
  declarations: [
19864
19867
  MaterialTestingPage,
@@ -19884,6 +19887,75 @@
19884
19887
  },] }
19885
19888
  ];
19886
19889
 
19890
+ var ToastTestingPage = /** @class */ (function () {
19891
+ function ToastTestingPage(toastController, translate) {
19892
+ this.toastController = toastController;
19893
+ this.translate = translate;
19894
+ this.defaultOptions = {
19895
+ showCloseButton: false
19896
+ };
19897
+ }
19898
+ ToastTestingPage.prototype.showToast = function (opts) {
19899
+ return Toasts.show(this.toastController, this.translate, Object.assign(Object.assign(Object.assign({}, this.defaultOptions), { message: 'This is a message' }), opts));
19900
+ };
19901
+ ToastTestingPage.prototype.showInfo = function (opts) {
19902
+ return this.showToast(Object.assign({ type: 'info', message: 'This is a info text !' }, opts));
19903
+ };
19904
+ ToastTestingPage.prototype.showWarning = function (opts) {
19905
+ return this.showToast(Object.assign({ type: 'warning', message: 'This is a warning text !' }, opts));
19906
+ };
19907
+ ToastTestingPage.prototype.showError = function (opts) {
19908
+ return this.showToast(Object.assign({ type: 'error', message: 'This is a error text !' }, opts));
19909
+ };
19910
+ ToastTestingPage.prototype.toggleCloseButton = function () {
19911
+ this.defaultOptions.showCloseButton = !this.defaultOptions.showCloseButton;
19912
+ };
19913
+ return ToastTestingPage;
19914
+ }());
19915
+ ToastTestingPage.decorators = [
19916
+ { type: i0.Component, args: [{
19917
+ selector: 'toast-testing',
19918
+ template: "<ion-toolbar color=\"primary\">\n <ion-title>Toasts</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <p>Toast examples:</p>\n\n <ion-button (click)=\"showToast()\" color=\"dark\">\n default\n </ion-button>\n\n <ion-button (click)=\"showInfo({duration: 100000})\" color=\"secondary\">\n info\n </ion-button>\n\n <ion-button (click)=\"showWarning()\" color=\"accent\">\n warning\n </ion-button>\n\n <ion-button (click)=\"showError()\" color=\"danger\">\n error\n </ion-button>\n\n <br/>\n\n\n <ion-list>\n\n\n <ion-item>\n <ion-checkbox slot=\"start\" [value]=\"defaultOptions.showCloseButton\" (ionChange)=\"toggleCloseButton()\"></ion-checkbox>\n <ion-label>Close button ?</ion-label>\n </ion-item>\n </ion-list>\n\n\n</ion-content>\n"
19919
+ },] }
19920
+ ];
19921
+ ToastTestingPage.ctorParameters = function () { return [
19922
+ { type: i1$5.ToastController },
19923
+ { type: i1$2.TranslateService }
19924
+ ]; };
19925
+
19926
+ var routes$1 = [
19927
+ {
19928
+ path: 'toast',
19929
+ pathMatch: 'full',
19930
+ component: ToastTestingPage
19931
+ }
19932
+ ];
19933
+ var ToastTestingModule = /** @class */ (function () {
19934
+ function ToastTestingModule() {
19935
+ }
19936
+ return ToastTestingModule;
19937
+ }());
19938
+ ToastTestingModule.decorators = [
19939
+ { type: i0.NgModule, args: [{
19940
+ imports: [
19941
+ i1$4.CommonModule,
19942
+ i1$5.IonicModule,
19943
+ i1$2.TranslateModule.forChild(),
19944
+ i3.RouterModule.forChild(routes$1)
19945
+ ],
19946
+ declarations: [
19947
+ ToastTestingPage
19948
+ ],
19949
+ exports: [
19950
+ i3.RouterModule,
19951
+ ToastTestingPage
19952
+ ]
19953
+ },] }
19954
+ ];
19955
+
19956
+ var SHARED_TESTING_PAGES = [
19957
+ { label: 'Toast', page: '/testing/shared/toast' }
19958
+ ];
19887
19959
  var SharedTestingModule = /** @class */ (function () {
19888
19960
  function SharedTestingModule() {
19889
19961
  }
@@ -19894,10 +19966,12 @@
19894
19966
  imports: [
19895
19967
  i1$4.CommonModule,
19896
19968
  i1$2.TranslateModule.forChild(),
19897
- MaterialTestingModule
19969
+ MaterialTestingModule,
19970
+ ToastTestingModule
19898
19971
  ],
19899
19972
  exports: [
19900
- MaterialTestingModule
19973
+ MaterialTestingModule,
19974
+ ToastTestingModule
19901
19975
  ]
19902
19976
  },] }
19903
19977
  ];
@@ -25548,7 +25622,7 @@
25548
25622
  AppTable.prototype.deleteRows = function (event, rows, opts) {
25549
25623
  var _a;
25550
25624
  return __awaiter(this, void 0, void 0, function () {
25551
- var confirmed, canDelete, saved, rowsToDelete, deleteCount, err_2;
25625
+ var confirmed, canDelete, saved, deleteCount, err_2;
25552
25626
  var _this = this;
25553
25627
  return __generator(this, function (_e) {
25554
25628
  switch (_e.label) {
@@ -25584,13 +25658,16 @@
25584
25658
  if (deleted) {
25585
25659
  _this.visibleRowCount--;
25586
25660
  _this.totalRowCount--;
25661
+ // Forget is was the edited row
25662
+ if (row === _this.editedRow) {
25663
+ _this.editedRow = undefined;
25664
+ }
25587
25665
  return res;
25588
25666
  }
25589
25667
  }
25590
25668
  return res.concat(row);
25591
25669
  }, []);
25592
- if (isEmptyArray(rows))
25593
- return [2 /*return*/, 0];
25670
+ if (!isNotEmptyArray(rows)) return [3 /*break*/, 3];
25594
25671
  return [4 /*yield*/, this.saveBeforeAction('delete')];
25595
25672
  case 2:
25596
25673
  saved = _e.sent();
@@ -25600,20 +25677,21 @@
25600
25677
  }
25601
25678
  _e.label = 3;
25602
25679
  case 3:
25680
+ _e.trys.push([3, 6, , 7]);
25681
+ deleteCount = rows.length;
25682
+ if (!deleteCount) return [3 /*break*/, 5];
25603
25683
  if (this.debug)
25604
- console.debug('[table] Delete selection...');
25605
- rowsToDelete = rows.slice()
25606
- // Reverse row order
25607
- // This is a workaround, need because row.delete() has async execution
25608
- // and index cache is updated with a delay)
25684
+ console.debug('[table] Delete selected rows...');
25685
+ // Reverse row order (on a copy)
25686
+ // This is a workaround, need because row.delete() has async execution
25687
+ // and index cache is updated with a delay
25688
+ rows = rows.slice()
25609
25689
  .sort(function (a, b) { return a.id > b.id ? -1 : 1; });
25610
- _e.label = 4;
25690
+ return [4 /*yield*/, this._dataSource.deleteAll(rows)];
25611
25691
  case 4:
25612
- _e.trys.push([4, 6, , 7]);
25613
- deleteCount = rowsToDelete.length;
25614
- return [4 /*yield*/, this._dataSource.deleteAll(rowsToDelete)];
25615
- case 5:
25616
25692
  _e.sent();
25693
+ _e.label = 5;
25694
+ case 5:
25617
25695
  // DO not update manually, because watchALl().subscribe() will update this count
25618
25696
  //this.totalRowCount -= deleteCount;
25619
25697
  //this.visibleRowCount -= deleteCount;
@@ -25621,7 +25699,8 @@
25621
25699
  this.editedRow = undefined;
25622
25700
  this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
25623
25701
  this.markForCheck();
25624
- this.onAfterDeletedRows.next(rowsToDelete);
25702
+ if (deleteCount)
25703
+ this.onAfterDeletedRows.next(rows);
25625
25704
  return [2 /*return*/, deleteCount];
25626
25705
  case 6:
25627
25706
  err_2 = _e.sent();
@@ -29374,6 +29453,7 @@
29374
29453
  exports.SETTINGS_SORTED_COLUMN = SETTINGS_SORTED_COLUMN;
29375
29454
  exports.SETTINGS_STORAGE_KEY = SETTINGS_STORAGE_KEY;
29376
29455
  exports.SETTINGS_TRANSIENT_PROPERTIES = SETTINGS_TRANSIENT_PROPERTIES;
29456
+ exports.SHARED_TESTING_PAGES = SHARED_TESTING_PAGES;
29377
29457
  exports.SPACE_PLACEHOLDER_CHAR = SPACE_PLACEHOLDER_CHAR;
29378
29458
  exports.SelectPeerModal = SelectPeerModal;
29379
29459
  exports.SettingsPage = SettingsPage;
@@ -29564,12 +29644,14 @@
29564
29644
  exports["ɵd"] = MatBadgeIconDirective;
29565
29645
  exports["ɵe"] = isFocusableElement;
29566
29646
  exports["ɵf"] = MatBadgeIconTestPage;
29567
- exports["ɵg"] = RegisterForm;
29568
- exports["ɵh"] = AccountValidatorService;
29569
- exports["ɵi"] = RegisterModal;
29570
- exports["ɵj"] = UserSettingsValidatorService;
29571
- exports["ɵk"] = LocalSettingsValidatorService;
29572
- exports["ɵl"] = AppIconComponent;
29647
+ exports["ɵg"] = ToastTestingModule;
29648
+ exports["ɵh"] = ToastTestingPage;
29649
+ exports["ɵi"] = RegisterForm;
29650
+ exports["ɵj"] = AccountValidatorService;
29651
+ exports["ɵk"] = RegisterModal;
29652
+ exports["ɵl"] = UserSettingsValidatorService;
29653
+ exports["ɵm"] = LocalSettingsValidatorService;
29654
+ exports["ɵn"] = AppIconComponent;
29573
29655
 
29574
29656
  Object.defineProperty(exports, '__esModule', { value: true });
29575
29657