@sumaris-net/ngx-components 1.23.16 → 1.23.17

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 (44) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +483 -232
  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/esm2015/public_api.js +3 -2
  6. package/esm2015/src/app/core/services/network.service.js +17 -25
  7. package/esm2015/src/app/core/table/entities-table-datasource.class.js +24 -10
  8. package/esm2015/src/app/core/table/table.class.js +2 -5
  9. package/esm2015/src/app/core/table/testing/table.testing.js +2 -2
  10. package/esm2015/src/app/shared/services/memory-entity-service.class.js +49 -29
  11. package/esm2015/src/app/shared/services/startable-observable-service.class.js +122 -0
  12. package/esm2015/src/app/shared/services/startable-service.class.js +23 -21
  13. package/esm2015/src/app/social/job/job.module.js +4 -4
  14. package/esm2015/src/app/social/job/job.service.js +24 -12
  15. package/esm2015/src/app/social/job/progression/job-progression.icon.js +208 -0
  16. package/esm2015/src/app/social/job/testing/job-progression.testing.js +27 -26
  17. package/esm2015/src/app/social/job/testing/job-progression.testing.service.js +24 -2
  18. package/esm2015/src/app/social/social.module.js +1 -1
  19. package/esm2015/src/app/social/user-event/notification/user-event-notification.icon.js +26 -15
  20. package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +3 -3
  21. package/esm2015/src/app/social/user-event/testing/user-event.testing.js +3 -3
  22. package/esm2015/src/app/social/user-event/user-event.module.js +4 -4
  23. package/esm2015/src/app/social/user-event/user-event.service.js +2 -2
  24. package/esm2015/sumaris-net.ngx-components.js +10 -10
  25. package/fesm2015/sumaris-net.ngx-components.js +367 -171
  26. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  27. package/package.json +1 -1
  28. package/public_api.d.ts +2 -1
  29. package/src/app/core/services/network.service.d.ts +5 -7
  30. package/src/app/core/table/entities-table-datasource.class.d.ts +9 -1
  31. package/src/app/shared/services/memory-entity-service.class.d.ts +4 -4
  32. package/src/app/shared/services/startable-observable-service.class.d.ts +33 -0
  33. package/src/app/shared/services/startable-service.class.d.ts +9 -8
  34. package/src/app/social/job/job.service.d.ts +10 -2
  35. package/src/app/social/job/progression/{job-progression.component.d.ts → job-progression.icon.d.ts} +3 -3
  36. package/src/app/social/job/testing/job-progression.testing.d.ts +7 -4
  37. package/src/app/social/job/testing/job-progression.testing.service.d.ts +4 -0
  38. package/src/app/social/social.module.d.ts +1 -1
  39. package/src/app/social/user-event/notification/user-event-notification.icon.d.ts +6 -3
  40. package/src/app/social/user-event/testing/user-event.testing.d.ts +2 -2
  41. package/src/app/social/user-event/user-event.service.d.ts +1 -1
  42. package/sumaris-net.ngx-components.d.ts +9 -9
  43. package/sumaris-net.ngx-components.metadata.json +1 -1
  44. package/esm2015/src/app/social/job/progression/job-progression.component.js +0 -200
@@ -9069,19 +9069,19 @@ class StartableService {
9069
9069
  ? () => prerequisiteService.ready()
9070
9070
  : () => Promise.resolve();
9071
9071
  }
9072
- start() {
9072
+ start(opts) {
9073
9073
  if (this._startPromise)
9074
9074
  return this._startPromise;
9075
9075
  if (this._started)
9076
9076
  return Promise.resolve(this._data);
9077
9077
  this._startPromise = this._startPrerequisite()
9078
- .then(() => this.ngOnStart())
9078
+ .then(() => this.ngOnStart(opts))
9079
9079
  .then(data => {
9080
9080
  this._data = data;
9081
9081
  this._started = true;
9082
9082
  this._startPromise = undefined;
9083
- this.startSubject.next(this._data);
9084
- return this._data;
9083
+ this.startSubject.next(data);
9084
+ return data;
9085
9085
  })
9086
9086
  .catch(err => {
9087
9087
  console.error('Failed to start a service: ' + (err && err.message || err), err);
@@ -9091,6 +9091,17 @@ class StartableService {
9091
9091
  });
9092
9092
  return this._startPromise;
9093
9093
  }
9094
+ ready() {
9095
+ if (this._started)
9096
+ return Promise.resolve(this._data);
9097
+ if (this._startPromise)
9098
+ return this._startPromise;
9099
+ if (this._startByReadyFunction)
9100
+ return this.start();
9101
+ return this.startSubject
9102
+ .pipe(takeUntil(this.stopSubject))
9103
+ .toPromise();
9104
+ }
9094
9105
  stop() {
9095
9106
  return __awaiter(this, void 0, void 0, function* () {
9096
9107
  try {
@@ -9108,13 +9119,13 @@ class StartableService {
9108
9119
  }
9109
9120
  });
9110
9121
  }
9111
- restart() {
9122
+ restart(opts) {
9112
9123
  return __awaiter(this, void 0, void 0, function* () {
9113
9124
  if (this._startPromise)
9114
9125
  yield this._startPromise; // Wait end of previous loading
9115
9126
  if (this._started)
9116
9127
  yield this.stop(); // Then stop if started
9117
- return this.start(); // Then start again
9128
+ return this.start(opts); // Then start again
9118
9129
  });
9119
9130
  }
9120
9131
  get started() {
@@ -9123,23 +9134,16 @@ class StartableService {
9123
9134
  get starting() {
9124
9135
  return !!this._startPromise;
9125
9136
  }
9126
- ready() {
9127
- if (this._started)
9128
- return Promise.resolve(this._data);
9129
- if (this._startPromise)
9130
- return this._startPromise;
9131
- if (this._startByReadyFunction)
9132
- return this.start();
9133
- return this.startSubject
9134
- .pipe(takeUntil(this.stopSubject))
9135
- .toPromise();
9137
+ get stopped() {
9138
+ return !this._started && !this._startPromise;
9136
9139
  }
9137
9140
  registerSubscription(sub) {
9138
9141
  this._subscription = this._subscription || new Subscription();
9139
9142
  return this._subscription.add(sub);
9140
9143
  }
9141
9144
  unregisterSubscription(sub) {
9142
- this._subscription.remove(sub);
9145
+ var _a;
9146
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.remove(sub);
9143
9147
  }
9144
9148
  unsubscribe() {
9145
9149
  var _a;
@@ -9147,9 +9151,7 @@ class StartableService {
9147
9151
  this._subscription = null;
9148
9152
  }
9149
9153
  ngOnStop() {
9150
- return __awaiter(this, void 0, void 0, function* () {
9151
- // Can be overwritten by subclasses
9152
- });
9154
+ // Can be overwritten by subclasses
9153
9155
  }
9154
9156
  }
9155
9157
  StartableService.ctorParameters = () => [
@@ -11310,6 +11312,124 @@ class Toasts {
11310
11312
  Toasts.counter = 0;
11311
11313
  Toasts.stackSize = 0;
11312
11314
 
11315
+ /**
11316
+ * Same as StartableService, bu with a dataSubject instead of a simple 'data' property
11317
+ */
11318
+ class StartableObservableService {
11319
+ constructor(prerequisiteService) {
11320
+ this.dataSubject = new BehaviorSubject(null);
11321
+ this.startSubject = new Subject();
11322
+ this.stopSubject = new Subject();
11323
+ this._debug = false;
11324
+ this._startByReadyFunction = true; // should start when calling ready() ?
11325
+ this._started = false;
11326
+ this._startPromise = null;
11327
+ this._startPrerequisite = null;
11328
+ this._subscription = null;
11329
+ this._startPrerequisite = prerequisiteService
11330
+ ? () => prerequisiteService.ready()
11331
+ : () => Promise.resolve();
11332
+ }
11333
+ start(opts) {
11334
+ if (this._startPromise)
11335
+ return this._startPromise;
11336
+ if (this._started)
11337
+ return Promise.resolve(this.dataSubject.value);
11338
+ this._startPromise = this._startPrerequisite()
11339
+ .then(() => this.ngOnStart(opts))
11340
+ .then(data => {
11341
+ this._started = true;
11342
+ this._startPromise = undefined;
11343
+ // Should be done AFTER 'this._started = true', because of the 'filter' operator, inside ready() function
11344
+ this.dataSubject.next(data);
11345
+ this.startSubject.next(data);
11346
+ return data;
11347
+ })
11348
+ .catch(err => {
11349
+ console.error('Failed to start a service: ' + (err && err.message || err), err);
11350
+ this._started = false;
11351
+ this._startPromise = null;
11352
+ return null;
11353
+ });
11354
+ return this._startPromise;
11355
+ }
11356
+ ready() {
11357
+ if (this._started)
11358
+ return Promise.resolve(this.dataSubject.value);
11359
+ if (this._startPromise)
11360
+ return this._startPromise;
11361
+ if (this._startByReadyFunction)
11362
+ return this.start();
11363
+ return this.dataSubject
11364
+ .pipe(takeUntil(this.stopSubject),
11365
+ // Wait start() to be called, to exclude the initial 'null' value
11366
+ filter(_ => this._started))
11367
+ .toPromise();
11368
+ }
11369
+ stop() {
11370
+ return __awaiter(this, void 0, void 0, function* () {
11371
+ try {
11372
+ this.unsubscribe();
11373
+ yield this.ngOnStop();
11374
+ }
11375
+ catch (err) {
11376
+ console.error('Failed to stop a service: ' + (err && err.message || err), err);
11377
+ }
11378
+ finally {
11379
+ this._started = false;
11380
+ this._startPromise = undefined;
11381
+ this.stopSubject.next(); // Stop all running observables
11382
+ this.dataSubject.next(null); // Reset data
11383
+ }
11384
+ });
11385
+ }
11386
+ restart(opts) {
11387
+ return __awaiter(this, void 0, void 0, function* () {
11388
+ if (this._startPromise)
11389
+ yield this._startPromise; // Wait end of previous loading
11390
+ if (this._started)
11391
+ yield this.stop(); // Then stop if started
11392
+ return this.start(opts); // Then start again
11393
+ });
11394
+ }
11395
+ get started() {
11396
+ return this._started;
11397
+ }
11398
+ get starting() {
11399
+ return !!this._startPromise;
11400
+ }
11401
+ get stopped() {
11402
+ return !this._started && !this._startPromise;
11403
+ }
11404
+ get data() {
11405
+ return this.dataSubject.value;
11406
+ }
11407
+ set data(value) {
11408
+ if (this.dataSubject.value !== value) {
11409
+ this.dataSubject.next(value);
11410
+ }
11411
+ }
11412
+ registerSubscription(sub) {
11413
+ this._subscription = this._subscription || new Subscription();
11414
+ return this._subscription.add(sub);
11415
+ }
11416
+ unregisterSubscription(sub) {
11417
+ var _a;
11418
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.remove(sub);
11419
+ }
11420
+ unsubscribe() {
11421
+ var _a;
11422
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
11423
+ this._subscription = null;
11424
+ }
11425
+ ngOnStop() {
11426
+ // Can be overwritten by subclasses
11427
+ }
11428
+ }
11429
+ StartableObservableService.ctorParameters = () => [
11430
+ { type: undefined, decorators: [{ type: Optional }] }
11431
+ ];
11432
+
11313
11433
  function getConnectionType(type) {
11314
11434
  switch (type) {
11315
11435
  case Connection.NONE:
@@ -11338,7 +11458,7 @@ const NetworkRefreshTimerPeriod = {
11338
11458
  MOBILE: 1000,
11339
11459
  DESKTOP: 1000
11340
11460
  }*/
11341
- class NetworkService extends StartableService {
11461
+ class NetworkService extends StartableObservableService {
11342
11462
  constructor(_document, platform, modalCtrl, cryptoService, storage, settings, cache, http, environment, network, splashScreen, translate, toastController) {
11343
11463
  super(platform);
11344
11464
  this._document = _document;
@@ -11354,7 +11474,7 @@ class NetworkService extends StartableService {
11354
11474
  this.splashScreen = splashScreen;
11355
11475
  this.translate = translate;
11356
11476
  this.toastController = toastController;
11357
- this.onPeerChanges = this.startSubject.pipe(map(peer => peer && peer.url), filter(isNotNilOrBlank), distinctUntilChanged());
11477
+ this.onPeerChanges = this.startSubject.pipe(map(peer => peer === null || peer === void 0 ? void 0 : peer.url), filter(isNotNilOrBlank), distinctUntilChanged());
11358
11478
  this.onNetworkStatusChanges = new BehaviorSubject(null);
11359
11479
  this.onResetNetworkCache = new EventEmitter(true);
11360
11480
  this._listeners = {};
@@ -11367,8 +11487,7 @@ class NetworkService extends StartableService {
11367
11487
  this._timerRefreshPeriod = NetworkRefreshTimerPeriod.DESKTOP;
11368
11488
  this._timerRefreshCondition = () => true; // Always check
11369
11489
  }
11370
- this.resetData();
11371
- this.startSubject.subscribe(() => this.ngOnAfterStart());
11490
+ this.startSubject.subscribe(peer => this.ngOnAfterStart(peer));
11372
11491
  // For DEV only
11373
11492
  this._debug = !environment.production;
11374
11493
  }
@@ -11385,11 +11504,11 @@ class NetworkService extends StartableService {
11385
11504
  || (this.started && this._deviceConnectionType || 'unknown');
11386
11505
  }
11387
11506
  get peer() {
11388
- return this._data && this._data.clone();
11507
+ var _a;
11508
+ return (_a = this.dataSubject.value) === null || _a === void 0 ? void 0 : _a.clone();
11389
11509
  }
11390
11510
  set peer(peer) {
11391
- this._startingPeer = peer;
11392
- this.restart();
11511
+ this.restart(peer);
11393
11512
  }
11394
11513
  /**
11395
11514
  * Register to network event
@@ -11437,8 +11556,7 @@ class NetworkService extends StartableService {
11437
11556
  // Disable the offline mode
11438
11557
  this.setForceOffline(false);
11439
11558
  // Restart
11440
- this._startingPeer = peer;
11441
- yield this.restart();
11559
+ yield this.restart(peer);
11442
11560
  // Wait a promise, before recheck
11443
11561
  yield this.emit('beforeTryOnlineFinish', this.online);
11444
11562
  }
@@ -11681,11 +11799,11 @@ class NetworkService extends StartableService {
11681
11799
  });
11682
11800
  }
11683
11801
  /* -- protected functions -- */
11684
- ngOnStart() {
11802
+ ngOnStart(peer) {
11685
11803
  return __awaiter(this, void 0, void 0, function* () {
11686
11804
  console.info('[network] Starting network...');
11687
11805
  // Restoring local settings
11688
- let peer = this._startingPeer || (yield this.restoreLocally());
11806
+ peer = peer || (yield this.restoreLocally());
11689
11807
  // Make sure to hide the splashscreen, before open the modal
11690
11808
  if (!peer && this.splashScreen)
11691
11809
  this.splashScreen.hide();
@@ -11698,11 +11816,11 @@ class NetworkService extends StartableService {
11698
11816
  return peer;
11699
11817
  });
11700
11818
  }
11701
- ngOnAfterStart() {
11819
+ ngOnAfterStart(peer) {
11702
11820
  var _a;
11703
11821
  return __awaiter(this, void 0, void 0, function* () {
11704
11822
  // Wait settings starts, then save peer in settings
11705
- yield this.settings.apply({ peerUrl: this._data.url });
11823
+ yield this.settings.apply({ peerUrl: peer.url });
11706
11824
  this.onDeviceConnectionChanged(((_a = this.network) === null || _a === void 0 ? void 0 : _a.type) || 'unknown');
11707
11825
  // Start the refresh timer
11708
11826
  this.startRefreshTimer();
@@ -11714,13 +11832,10 @@ class NetworkService extends StartableService {
11714
11832
  });
11715
11833
  }
11716
11834
  ngOnStop() {
11717
- return __awaiter(this, void 0, void 0, function* () {
11718
- this.resetData();
11719
- // Stop timer if cannot refresh anymore
11720
- if (this._timerRefreshCondition() === false) {
11721
- this.stopRefreshTimer();
11722
- }
11723
- });
11835
+ // Stop timer, if cannot refresh anymore
11836
+ if (this._timerRefreshCondition() === false) {
11837
+ this.stopRefreshTimer();
11838
+ }
11724
11839
  }
11725
11840
  /**
11726
11841
  * Try to restore peer from the local storage
@@ -11854,9 +11969,6 @@ class NetworkService extends StartableService {
11854
11969
  }
11855
11970
  }
11856
11971
  }
11857
- resetData() {
11858
- this._data = null;
11859
- }
11860
11972
  /**
11861
11973
  * Get default peers, from environment
11862
11974
  */
@@ -18140,13 +18252,13 @@ class EntityFilterUtils {
18140
18252
 
18141
18253
  // @dynamic
18142
18254
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
18143
- class InMemoryEntitiesService extends StartableService {
18255
+ class InMemoryEntitiesService extends StartableObservableService {
18144
18256
  constructor(dataType, filterType, options) {
18145
18257
  super(null);
18146
18258
  this.dataType = dataType;
18147
18259
  this.filterType = filterType;
18148
18260
  this.debug = false;
18149
- this.dataSubject = new BehaviorSubject(null);
18261
+ this._hiddenData = null;
18150
18262
  this.dirtySubject = new BehaviorSubject(false);
18151
18263
  this.savingSubject = new BehaviorSubject(false);
18152
18264
  options = Object.assign({ onSort: this.sort }, options);
@@ -18161,6 +18273,7 @@ class InMemoryEntitiesService extends StartableService {
18161
18273
  }
18162
18274
  return undefined;
18163
18275
  });
18276
+ this._startByReadyFunction = false; // Need setValue() to be called, to start the service
18164
18277
  this._sortByReplacement = Object.assign({
18165
18278
  // Detect rankOrder on the entity class
18166
18279
  id: (Object.getOwnPropertyNames(new dataType()).findIndex(key => key === 'rankOrder') !== -1) ? 'rankOrder' : undefined }, options.sortByReplacement);
@@ -18177,12 +18290,16 @@ class InMemoryEntitiesService extends StartableService {
18177
18290
  get dirty() {
18178
18291
  return this.dirtySubject.value;
18179
18292
  }
18180
- ngOnStart() {
18293
+ ngOnStart(data) {
18181
18294
  return __awaiter(this, void 0, void 0, function* () {
18295
+ if (!data)
18296
+ throw new Error('Missing required data, to start this service');
18182
18297
  if (this.debug)
18183
18298
  console.debug('[memory-data-service] Starting...');
18184
- return firstNotNil(this.dataSubject, { stop: this.stopSubject })
18185
- .toPromise();
18299
+ this._hiddenData = [];
18300
+ this.markAsSaved();
18301
+ this.markAsPristine();
18302
+ return data;
18186
18303
  });
18187
18304
  }
18188
18305
  ngOnStop() {
@@ -18191,9 +18308,9 @@ class InMemoryEntitiesService extends StartableService {
18191
18308
  console.debug('[memory-data-service] Stopping...');
18192
18309
  this.dataSubject.complete();
18193
18310
  this.dataSubject.unsubscribe();
18194
- this.dataSubject = new BehaviorSubject(null);
18195
- this.savingSubject.next(false);
18196
- this.dirtySubject.next(false);
18311
+ this._hiddenData = null;
18312
+ this.markAsSaved();
18313
+ this.markAsPristine();
18197
18314
  });
18198
18315
  }
18199
18316
  ngOnDestroy() {
@@ -18201,12 +18318,17 @@ class InMemoryEntitiesService extends StartableService {
18201
18318
  }
18202
18319
  setValue(data) {
18203
18320
  if (this.dataSubject.value !== data) {
18204
- if (!this.started)
18205
- this.start();
18206
- this._hiddenData = [];
18207
- this.dataSubject.next(data);
18321
+ // If service already started, then update data
18322
+ if (this.started) {
18323
+ this._hiddenData = [];
18324
+ this.dataSubject.next(data);
18325
+ this.markAsPristine();
18326
+ }
18327
+ // if service not started yet, then start it, using given data
18328
+ else {
18329
+ this.start(data);
18330
+ }
18208
18331
  }
18209
- this.markAsPristine();
18210
18332
  }
18211
18333
  loadAll(offset, size, sortBy, sortDirection, filter, opts) {
18212
18334
  return __awaiter(this, void 0, void 0, function* () {
@@ -18216,17 +18338,20 @@ class InMemoryEntitiesService extends StartableService {
18216
18338
  if (isNil(originalData)) {
18217
18339
  console.warn('[memory-data-service] Cannot load all: no value set. Will return empty result');
18218
18340
  }
18219
- // Wait ready
18220
18341
  try {
18221
- if (!this.started)
18222
- yield this.ready();
18223
- if (this.saving)
18224
- yield this.waitWhileSaving();
18342
+ // Wait service is ready
18343
+ yield this.ready();
18344
+ // Wait while busy (e.g. when saving, or deleting)
18345
+ yield this.waitIdle({ stopError: false /*avoid error when stopped*/ });
18225
18346
  }
18226
- finally {
18227
- if (!this.started)
18228
- return undefined; // Stopped (e.g. after saved)
18347
+ catch (err) {
18348
+ // Should be a stop error: log and continue
18349
+ if (!this.stopped)
18350
+ console.error('Unexpected error, while waiting :', err);
18229
18351
  }
18352
+ // Make sure service is not stopped
18353
+ if (this.stopped)
18354
+ return undefined;
18230
18355
  const excludedDataByFilter = [];
18231
18356
  let excludedDataByPagination;
18232
18357
  try {
@@ -18286,10 +18411,10 @@ class InMemoryEntitiesService extends StartableService {
18286
18411
  if (nextOffset < total) {
18287
18412
  res.fetchMore = () => this.loadAll(nextOffset, size, sortBy, sortDirection, filter, opts)
18288
18413
  .then(res => {
18289
- var _a;
18414
+ var _a, _b;
18290
18415
  // Update hidden data (remove new fetched item)
18291
18416
  if ((_a = res.data) === null || _a === void 0 ? void 0 : _a.length) {
18292
- this._hiddenData = this._hiddenData.filter(item => !res.data.includes(item));
18417
+ this._hiddenData = (_b = this._hiddenData) === null || _b === void 0 ? void 0 : _b.filter(item => !res.data.includes(item));
18293
18418
  }
18294
18419
  return res;
18295
18420
  });
@@ -18388,6 +18513,11 @@ class InMemoryEntitiesService extends StartableService {
18388
18513
  var _a;
18389
18514
  return ((_a = this._hiddenData) === null || _a === void 0 ? void 0 : _a.length) || 0;
18390
18515
  }
18516
+ waitIdle(opts) {
18517
+ return __awaiter(this, void 0, void 0, function* () {
18518
+ yield this.waitWhileSaving(opts);
18519
+ });
18520
+ }
18391
18521
  /* -- protected methods -- */
18392
18522
  filter(data, _filter, hiddenData) {
18393
18523
  // if filter is DataFilter instance, use its test function
@@ -18413,9 +18543,11 @@ class InMemoryEntitiesService extends StartableService {
18413
18543
  }));
18414
18544
  }
18415
18545
  waitWhileSaving(opts) {
18416
- if (!this.saving)
18417
- return;
18418
- return firstFalsePromise(this.savingSubject, Object.assign({ stop: (opts === null || opts === void 0 ? void 0 : opts.stop) || merge(this.stopSubject, this.dataSubject) }, opts));
18546
+ return __awaiter(this, void 0, void 0, function* () {
18547
+ if (this.saving) {
18548
+ return firstFalsePromise(this.savingSubject, Object.assign({ stop: (opts === null || opts === void 0 ? void 0 : opts.stop) || merge(this.stopSubject, this.dataSubject), stopError: false }, opts));
18549
+ }
18550
+ });
18419
18551
  }
18420
18552
  markAsSaving() {
18421
18553
  if (!this.savingSubject.value) {
@@ -22392,8 +22524,8 @@ class EntitiesTableDataSource extends TableDataSource {
22392
22524
  this._debug = false;
22393
22525
  this._creating = false;
22394
22526
  this._saving = false;
22395
- this._stopWatching$ = new Subject();
22396
22527
  this._fetchMoreFn = null;
22528
+ this._stopWatchSubject = new Subject();
22397
22529
  this.loadingSubject = new BehaviorSubject(undefined);
22398
22530
  this._entityName = removeEnd((new dataType()).__typename || 'UnknownVO', 'VO');
22399
22531
  this._debug = (options === null || options === void 0 ? void 0 : options.suppressErrors) === false && !environment.production;
@@ -22430,15 +22562,27 @@ class EntitiesTableDataSource extends TableDataSource {
22430
22562
  get loading() {
22431
22563
  return this.loadingSubject.value !== false; // Should be true when undefined (initial state)
22432
22564
  }
22565
+ /**
22566
+ * @deprecated use disconnect
22567
+ */
22433
22568
  ngOnDestroy() {
22434
- this._stopWatching$.next();
22435
- this._stopWatching$.complete();
22436
- this._stopWatching$.unsubscribe();
22437
- this.loadingSubject.complete();
22438
- this.loadingSubject.unsubscribe();
22569
+ this.close();
22570
+ }
22571
+ /**
22572
+ * @deprecated use disconnect
22573
+ */
22574
+ close() {
22575
+ if (!this._stopWatchSubject.closed) {
22576
+ console.debug('[table-datasource] Closing...');
22577
+ this._stopWatchSubject.next();
22578
+ this._stopWatchSubject.complete();
22579
+ this._stopWatchSubject.unsubscribe();
22580
+ this.loadingSubject.complete();
22581
+ this.loadingSubject.unsubscribe();
22582
+ }
22439
22583
  }
22440
22584
  watchAll(offset, size, sortBy, sortDirection, filter) {
22441
- this._stopWatching$.next();
22585
+ this._stopWatchSubject.next();
22442
22586
  this._fetchMoreFn = null;
22443
22587
  this.markAsLoading();
22444
22588
  return this.dataService.watchAll(offset, size, sortBy, sortDirection, filter, this.serviceOptions)
@@ -22456,7 +22600,7 @@ class EntitiesTableDataSource extends TableDataSource {
22456
22600
  return res;
22457
22601
  }),
22458
22602
  // Stop this pipe next time we call watchAll()
22459
- takeUntil(this._stopWatching$)
22603
+ takeUntil(this._stopWatchSubject)
22460
22604
  // ⚠ Notice: Don't put any operator after takeUntil to avoid potential subscription leaks
22461
22605
  );
22462
22606
  }
@@ -22558,11 +22702,13 @@ class EntitiesTableDataSource extends TableDataSource {
22558
22702
  }
22559
22703
  connect(collectionViewer) {
22560
22704
  // DEBUG console.debug("[entities-datasource] connect");
22705
+ this.viewer = collectionViewer;
22561
22706
  return super.connect(collectionViewer);
22562
22707
  }
22563
22708
  disconnect(collectionViewer) {
22709
+ console.debug('[table-datasource] Disconnecting...');
22564
22710
  super.disconnect(collectionViewer);
22565
- this._stopWatching$.next();
22711
+ this.close();
22566
22712
  }
22567
22713
  waitIdle(debounceTimeMs) {
22568
22714
  return firstFalsePromise(this.loadingSubject
@@ -23114,7 +23260,6 @@ class AppTable {
23114
23260
  this.listenSortAndPaginationEvents();
23115
23261
  }
23116
23262
  ngOnDestroy() {
23117
- var _a;
23118
23263
  this._subscription.unsubscribe();
23119
23264
  // Unsubscribe column value changes
23120
23265
  Object.keys(this._cellValueChangesDefs).forEach(col => this.stopCellValueChanges(col, true));
@@ -23139,7 +23284,6 @@ class AppTable {
23139
23284
  this.onError.unsubscribe();
23140
23285
  this.destroySubject.next();
23141
23286
  this.destroySubject.unsubscribe();
23142
- (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
23143
23287
  }
23144
23288
  updateView(res, opts) {
23145
23289
  return __awaiter(this, void 0, void 0, function* () {
@@ -23174,12 +23318,11 @@ class AppTable {
23174
23318
  }
23175
23319
  }
23176
23320
  resetDataSource() {
23177
- var _a;
23178
23321
  if (this._dataSourceLoadingSubscription) {
23179
23322
  this._dataSourceLoadingSubscription.unsubscribe();
23180
23323
  this._subscription.remove(this._dataSourceLoadingSubscription);
23181
23324
  }
23182
- (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
23325
+ //this._dataSource?.close();
23183
23326
  this._dataSource = null;
23184
23327
  }
23185
23328
  addColumnDef(column) {
@@ -26153,7 +26296,7 @@ const SocialErrorCodes = {
26153
26296
  };
26154
26297
 
26155
26298
  const moment$6 = momentImported;
26156
- const USER_EVENT_SERVICE = new InjectionToken('UserEventService');
26299
+ const APP_USER_EVENT_SERVICE = new InjectionToken('UserEventService');
26157
26300
  class AbstractUserEventService extends BaseGraphqlService {
26158
26301
  constructor(graphql, accountService, network, translate, options) {
26159
26302
  super(graphql, options);
@@ -26823,7 +26966,7 @@ UserEventNotificationList.ctorParameters = () => [
26823
26966
  { type: ChangeDetectorRef },
26824
26967
  { type: PopoverController },
26825
26968
  { type: LocalSettingsService, decorators: [{ type: Optional }] },
26826
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [USER_EVENT_SERVICE,] }] }
26969
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [APP_USER_EVENT_SERVICE,] }] }
26827
26970
  ];
26828
26971
  UserEventNotificationList.propDecorators = {
26829
26972
  debug: [{ type: Input }],
@@ -26840,11 +26983,12 @@ UserEventNotificationList.propDecorators = {
26840
26983
  ionItems: [{ type: ViewChildren, args: [IonItem,] }]
26841
26984
  };
26842
26985
 
26843
- class AppUserEventNotificationIcon {
26844
- constructor(userEventService, accountService, popoverController) {
26986
+ class UserEventNotificationIcon {
26987
+ constructor(userEventService, accountService, popoverController, cd) {
26845
26988
  this.userEventService = userEventService;
26846
26989
  this.accountService = accountService;
26847
26990
  this.popoverController = popoverController;
26991
+ this.cd = cd;
26848
26992
  this.debug = false;
26849
26993
  this.titleI18n = 'SOCIAL.USER_EVENT.NOTIFICATION.TITLE';
26850
26994
  this.disabled = false;
@@ -26858,15 +27002,23 @@ class AppUserEventNotificationIcon {
26858
27002
  return of();
26859
27003
  return this.userEventService
26860
27004
  .countSubject
26861
- .pipe(map(value => value === 0 ? undefined : value));
27005
+ .pipe(tap(value => {
27006
+ const visible = !this.autoHide || value > 0;
27007
+ if (this.visible !== visible) {
27008
+ this.visible = visible;
27009
+ this.cd.markForCheck();
27010
+ }
27011
+ }), map(value => value === 0 ? undefined : value));
26862
27012
  }
26863
27013
  ngOnInit() {
26864
27014
  return __awaiter(this, void 0, void 0, function* () {
26865
27015
  if (isNil(this.userEventService)) {
26866
27016
  console.warn(`${this._logPrefix}No service injected`);
26867
27017
  this.disabled = true;
27018
+ this.visible = false;
26868
27019
  return;
26869
27020
  }
27021
+ this.visible = toBoolean(this.visible, !this.autoHide);
26870
27022
  // Wait service
26871
27023
  yield this.userEventService.ready();
26872
27024
  // Subscribe to read event
@@ -26907,23 +27059,25 @@ class AppUserEventNotificationIcon {
26907
27059
  }
26908
27060
  }
26909
27061
  }
26910
- AppUserEventNotificationIcon.decorators = [
27062
+ UserEventNotificationIcon.decorators = [
26911
27063
  { type: Component, args: [{
26912
27064
  selector: 'app-user-event-notification-icon',
26913
- template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"countChanges | async\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >notifications\n </mat-icon>\n</button>\n\n",
27065
+ template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n *ngIf=\"visible\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"countChanges | async\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >notifications\n </mat-icon>\n</button>\n\n",
26914
27066
  changeDetection: ChangeDetectionStrategy.OnPush
26915
27067
  },] }
26916
27068
  ];
26917
- AppUserEventNotificationIcon.ctorParameters = () => [
26918
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [USER_EVENT_SERVICE,] }] },
27069
+ UserEventNotificationIcon.ctorParameters = () => [
27070
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [APP_USER_EVENT_SERVICE,] }] },
26919
27071
  { type: AccountService },
26920
- { type: PopoverController }
27072
+ { type: PopoverController },
27073
+ { type: ChangeDetectorRef }
26921
27074
  ];
26922
- AppUserEventNotificationIcon.propDecorators = {
27075
+ UserEventNotificationIcon.propDecorators = {
26923
27076
  debug: [{ type: Input }],
26924
27077
  titleI18n: [{ type: Input }],
26925
27078
  disabled: [{ type: Input }],
26926
- filter: [{ type: Input }]
27079
+ filter: [{ type: Input }],
27080
+ autoHide: [{ type: Input }]
26927
27081
  };
26928
27082
 
26929
27083
  class UserEventModule {
@@ -26937,11 +27091,11 @@ UserEventModule.decorators = [
26937
27091
  NgxJdenticonModule
26938
27092
  ],
26939
27093
  declarations: [
26940
- AppUserEventNotificationIcon,
27094
+ UserEventNotificationIcon,
26941
27095
  UserEventNotificationList
26942
27096
  ],
26943
27097
  exports: [
26944
- AppUserEventNotificationIcon
27098
+ UserEventNotificationIcon
26945
27099
  ]
26946
27100
  },] }
26947
27101
  ];
@@ -27198,16 +27352,18 @@ JobProgression = JobProgression_1 = __decorate([
27198
27352
  EntityClass({ typename: 'JobProgressionVO' })
27199
27353
  ], JobProgression);
27200
27354
 
27201
- const JobProgressionServiceToken = new InjectionToken('JobProgressionService');
27202
- const jobProgressionSubscription = gql `subscription UpdateJobProgression($id: Int!, $interval: Int){
27203
- data: updateJobProgression(id: $id, interval: $interval) {
27204
- id
27205
- name
27206
- message
27207
- current
27208
- total
27209
- }
27210
- }`;
27355
+ const APP_JOB_PROGRESSION_SERVICE = new InjectionToken('JobProgressionService');
27356
+ const QUERIES = {
27357
+ listenChanges: gql `subscription UpdateJobProgression($id: Int!, $interval: Int){
27358
+ data: updateJobProgression(id: $id, interval: $interval) {
27359
+ id
27360
+ name
27361
+ message
27362
+ current
27363
+ total
27364
+ }
27365
+ }`
27366
+ };
27211
27367
  class JobProgressionService extends BaseGraphqlService {
27212
27368
  constructor(graphql, environment) {
27213
27369
  super(graphql, environment);
@@ -27217,13 +27373,22 @@ class JobProgressionService extends BaseGraphqlService {
27217
27373
  // For DEV only
27218
27374
  this._debug = !(environment === null || environment === void 0 ? void 0 : environment.production);
27219
27375
  }
27376
+ watchAll(options) {
27377
+ return of([]); // TODO
27378
+ }
27379
+ addJob(id, job) {
27380
+ throw new Error('no implemented');
27381
+ }
27382
+ removeJob(id) {
27383
+ throw new Error('no implemented');
27384
+ }
27220
27385
  listenChanges(id, options) {
27221
27386
  if (isNil(id))
27222
27387
  throw new Error(`${this._logPrefix}Missing argument 'id'`);
27223
27388
  if (this._debug)
27224
27389
  console.debug(`${this._logPrefix}[WS] Listening changes for job progression {${id}}...`);
27225
27390
  return this.graphql.subscribe({
27226
- query: jobProgressionSubscription,
27391
+ query: QUERIES.listenChanges,
27227
27392
  fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
27228
27393
  variables: { id, interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
27229
27394
  error: { code: SocialErrorCodes.SUBSCRIBE_JOB_PROGRESSION_ERROR, message: 'SOCIAL.ERROR.SUBSCRIBE_JOB_PROGRESSION_ERROR' }
@@ -27262,7 +27427,7 @@ JobProgressionList.propDecorators = {
27262
27427
  jobProgressions: [{ type: Input }]
27263
27428
  };
27264
27429
 
27265
- class JobProgressionComponent {
27430
+ class JobProgressionIcon {
27266
27431
  constructor(jobProgressionService, popoverController, cd) {
27267
27432
  this.jobProgressionService = jobProgressionService;
27268
27433
  this.popoverController = popoverController;
@@ -27285,13 +27450,17 @@ class JobProgressionComponent {
27285
27450
  console.warn(`${this._logPrefix}No service injected`);
27286
27451
  }
27287
27452
  // parse options
27288
- this.autoHide = toBoolean((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoHide, false);
27453
+ this.autoHide = toBoolean(this.autoHide, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoHide) || false);
27289
27454
  this.visible = !this.autoHide;
27290
27455
  this.autoHideDelay = toNumber((_b = this.options) === null || _b === void 0 ? void 0 : _b.autoHideDelay, 1000);
27291
27456
  this.autoRemove = toBoolean((_c = this.options) === null || _c === void 0 ? void 0 : _c.autoRemove, true);
27292
27457
  this.autoRemoveDelay = toNumber((_d = this.options) === null || _d === void 0 ? void 0 : _d.autoRemoveDelay, 1000);
27458
+ this._subscriptions.add(this.jobProgressionService.watchAll()
27459
+ .subscribe(items => {
27460
+ (items || []).forEach(item => this.addJob(item.id, item));
27461
+ }));
27293
27462
  }
27294
- addJob(id) {
27463
+ addJob(id, job) {
27295
27464
  if (isNil(this.jobProgressionService)) {
27296
27465
  console.warn(`${this._logPrefix}No service injected. Can't add a job`);
27297
27466
  return;
@@ -27304,8 +27473,11 @@ class JobProgressionComponent {
27304
27473
  console.debug(`${this._logPrefix}Add job id=${id}`);
27305
27474
  }
27306
27475
  // Adding empty job progression
27307
- const progression = new JobProgression(id);
27308
- this.jobProgressions.push(progression);
27476
+ let progression = this.getProgression(id);
27477
+ if (!progression) {
27478
+ progression = job || new JobProgression(id);
27479
+ this.jobProgressions.push(progression);
27480
+ }
27309
27481
  this.disabled = false;
27310
27482
  const sub = this.jobProgressionService.listenChanges(id)
27311
27483
  .pipe(filter(progression => {
@@ -27433,23 +27605,24 @@ class JobProgressionComponent {
27433
27605
  this._subscriptions.unsubscribe();
27434
27606
  }
27435
27607
  }
27436
- JobProgressionComponent.decorators = [
27608
+ JobProgressionIcon.decorators = [
27437
27609
  { type: Component, args: [{
27438
- selector: 'app-job-progression',
27610
+ selector: 'app-job-progression-icon',
27439
27611
  template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n *ngIf=\"visible\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"jobProgressions?.length\"\n [matBadgeHidden]=\"!jobProgressions?.length\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >{{ disabled || jobProgressions?.length ? 'schedule' : 'task_alt' }}\n </mat-icon>\n <mat-spinner\n #spinner\n *ngIf=\"jobProgressions?.length\"\n class=\"floating-spinner\"\n [color]=\"color\"\n [mode]=\"mode\"\n [value]=\"value\"\n diameter=\"30\"\n strokeWidth=\"3\"\n ></mat-spinner>\n</button>\n\n",
27440
27612
  changeDetection: ChangeDetectionStrategy.OnPush,
27441
27613
  styles: [".floating-spinner{position:absolute;top:6px;left:5px}"]
27442
27614
  },] }
27443
27615
  ];
27444
- JobProgressionComponent.ctorParameters = () => [
27445
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [JobProgressionServiceToken,] }] },
27616
+ JobProgressionIcon.ctorParameters = () => [
27617
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [APP_JOB_PROGRESSION_SERVICE,] }] },
27446
27618
  { type: PopoverController },
27447
27619
  { type: ChangeDetectorRef }
27448
27620
  ];
27449
- JobProgressionComponent.propDecorators = {
27621
+ JobProgressionIcon.propDecorators = {
27450
27622
  debug: [{ type: Input }],
27451
27623
  titleI18n: [{ type: Input }],
27452
27624
  options: [{ type: Input }],
27625
+ autoHide: [{ type: Input }],
27453
27626
  jobFinished: [{ type: Output }]
27454
27627
  };
27455
27628
 
@@ -27463,11 +27636,11 @@ JobModule.decorators = [
27463
27636
  TranslateModule.forChild(),
27464
27637
  ],
27465
27638
  declarations: [
27466
- JobProgressionComponent,
27639
+ JobProgressionIcon,
27467
27640
  JobProgressionList
27468
27641
  ],
27469
27642
  exports: [
27470
- JobProgressionComponent
27643
+ JobProgressionIcon
27471
27644
  ]
27472
27645
  },] }
27473
27646
  ];
@@ -29158,7 +29331,7 @@ class TableTestPage extends AppTable {
29158
29331
  console.debug('[test-table] Destroying table...');
29159
29332
  super.ngOnDestroy();
29160
29333
  this.stopTimer();
29161
- this.dataService.stop();
29334
+ //this.dataService.stop();
29162
29335
  }
29163
29336
  restoreFilter() {
29164
29337
  const json = this.settings.getPageSettings(this.settingsId, 'filter');
@@ -29419,75 +29592,50 @@ CoreTestingModule.decorators = [
29419
29592
  },] }
29420
29593
  ];
29421
29594
 
29422
- class JobProgressionTestService {
29423
- listenChanges(id, options) {
29424
- return interval(100).pipe(take(111), map(value => {
29425
- if (value <= 10) {
29426
- return {
29427
- id: id,
29428
- name: `Job #${id}`,
29429
- current: 0,
29430
- total: 0,
29431
- message: `Progression pending`
29432
- };
29433
- }
29434
- value = value - 10;
29435
- return {
29436
- id: id,
29437
- name: `Job #${id}`,
29438
- current: value,
29439
- total: 100,
29440
- message: `Progression ${value}/100`
29441
- };
29442
- }));
29443
- }
29444
- }
29445
- JobProgressionTestService.decorators = [
29446
- { type: Injectable }
29447
- ];
29448
-
29449
29595
  class JobProgressionTestingPage {
29450
- constructor() {
29451
- this.nJob = 0;
29596
+ constructor(jobProgressionService) {
29597
+ this.jobProgressionService = jobProgressionService;
29598
+ this.jobId = 0;
29599
+ this.job = null;
29452
29600
  this.options = {
29453
29601
  autoHide: true
29454
29602
  };
29455
- this.job = new JobProgression();
29456
- this.job.id = 0;
29457
- this.job.name = 'test';
29458
- this.job.current = 0;
29459
- this.job.total = 100;
29460
29603
  }
29461
29604
  incrementJob(value) {
29462
- this.job.current = Math.max(0, this.job.current + value);
29605
+ this.job = this.job || this.createJob();
29606
+ this.job.current += value || 0;
29463
29607
  this.job.message = `Fake progression (very long message very long message very long message very long message) ${this.job.current}/100`;
29464
29608
  if (this.job.current > this.job.total) {
29465
- this.jobProgression.removeJob(0);
29609
+ this.jobProgressionService.removeJob(this.job.id);
29466
29610
  this.job.current = 0;
29611
+ this.job = null; // Forget the job
29467
29612
  }
29468
- else if (!this.jobProgression.getProgression(0)) {
29469
- this.jobProgression.jobProgressions.push(this.job);
29470
- }
29471
- this.jobProgression.updateValue();
29613
+ this.jobProgressionIcon.updateValue();
29472
29614
  }
29473
29615
  addJob() {
29474
- // Add fake job
29475
- this.nJob++;
29476
- this.jobProgression.addJob(this.nJob);
29616
+ this.job = this.createJob();
29617
+ }
29618
+ createJob() {
29619
+ const job = new JobProgression();
29620
+ job.id = ++this.jobId;
29621
+ job.name = 'test';
29622
+ job.current = 0;
29623
+ job.total = 100;
29624
+ this.jobProgressionService.addJob(job.id, job);
29625
+ return job;
29477
29626
  }
29478
29627
  }
29479
29628
  JobProgressionTestingPage.decorators = [
29480
29629
  { type: Component, args: [{
29481
29630
  selector: 'job-progression-testing',
29482
- template: "<ion-toolbar color=\"primary\">\n <ion-title>Job progression</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-job-progression #jobProgression [debug]=\"true\" [options]=\"options\" ></app-job-progression>\n\n <p>\n <ion-button (click)=\"incrementJob(10)\">\n +10\n </ion-button>\n <ion-button (click)=\"incrementJob(-10)\">\n -10\n </ion-button>\n </p>\n <p>\n <ion-button (click)=\"addJob()\">Add Job</ion-button>\n </p>\n</ion-content>\n",
29483
- providers: [
29484
- { provide: JobProgressionServiceToken, useClass: JobProgressionTestService }
29485
- ]
29631
+ template: "<ion-toolbar color=\"primary\">\n <ion-title>Job progression</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-job-progression-icon #icon [debug]=\"true\" [options]=\"options\" ></app-job-progression-icon>\n\n <p>\n <ion-button (click)=\"incrementJob(10)\">\n +10\n </ion-button>\n <ion-button (click)=\"incrementJob(-10)\">\n -10\n </ion-button>\n </p>\n <p>\n <ion-button (click)=\"addJob()\">Add Job</ion-button>\n </p>\n</ion-content>\n"
29486
29632
  },] }
29487
29633
  ];
29488
- JobProgressionTestingPage.ctorParameters = () => [];
29634
+ JobProgressionTestingPage.ctorParameters = () => [
29635
+ { type: JobProgressionService, decorators: [{ type: Inject, args: [APP_JOB_PROGRESSION_SERVICE,] }] }
29636
+ ];
29489
29637
  JobProgressionTestingPage.propDecorators = {
29490
- jobProgression: [{ type: ViewChild, args: ['jobProgression',] }]
29638
+ jobProgressionIcon: [{ type: ViewChild, args: ['icon',] }]
29491
29639
  };
29492
29640
 
29493
29641
  class JobTestingModule {
@@ -29919,7 +30067,7 @@ UserEventTestingPage.decorators = [
29919
30067
  },] }
29920
30068
  ];
29921
30069
  UserEventTestingPage.ctorParameters = () => [
29922
- { type: UserEventTestService, decorators: [{ type: Inject, args: [USER_EVENT_SERVICE,] }] },
30070
+ { type: UserEventTestService, decorators: [{ type: Inject, args: [APP_USER_EVENT_SERVICE,] }] },
29923
30071
  { type: Router },
29924
30072
  { type: AlertController },
29925
30073
  { type: TranslateService }
@@ -29978,11 +30126,59 @@ SocialTestingModule.decorators = [
29978
30126
  },] }
29979
30127
  ];
29980
30128
 
30129
+ class JobProgressionTestService {
30130
+ constructor() {
30131
+ this.jobsSubject = new BehaviorSubject([]);
30132
+ }
30133
+ addJob(id, job) {
30134
+ const exists = this.jobsSubject.value.some(j => j.id === id);
30135
+ if (!exists) {
30136
+ job = job || new JobProgression(id);
30137
+ this.jobsSubject.next([...this.jobsSubject.value, job]);
30138
+ }
30139
+ }
30140
+ removeJob(id) {
30141
+ const jobs = this.jobsSubject.value;
30142
+ const index = jobs.findIndex(j => j.id === id);
30143
+ if (index !== -1) {
30144
+ jobs.splice(index, 1);
30145
+ this.jobsSubject.next(jobs);
30146
+ }
30147
+ }
30148
+ watchAll() {
30149
+ return this.jobsSubject.asObservable();
30150
+ }
30151
+ listenChanges(id, options) {
30152
+ return interval(100).pipe(take(111), map(value => {
30153
+ if (value <= 10) {
30154
+ return {
30155
+ id: id,
30156
+ name: `Job #${id}`,
30157
+ current: 0,
30158
+ total: 0,
30159
+ message: `Progression pending`
30160
+ };
30161
+ }
30162
+ value = value - 10;
30163
+ return {
30164
+ id: id,
30165
+ name: `Job #${id}`,
30166
+ current: value,
30167
+ total: 100,
30168
+ message: `Progression ${value}/100`
30169
+ };
30170
+ }));
30171
+ }
30172
+ }
30173
+ JobProgressionTestService.decorators = [
30174
+ { type: Injectable }
30175
+ ];
30176
+
29981
30177
  // Environment
29982
30178
 
29983
30179
  /**
29984
30180
  * Generated bundle index. Do not edit.
29985
30181
  */
29986
30182
 
29987
- 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_MENU_OPTIONS, APP_TESTING_PAGES, AboutModal, AbstractUserEventService, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AndroidOsEnvironment, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppEntityEditorModal, AppEntityEditorModalOptions, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppIconComponent, AppIconModule, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableUtils, AppUserEventNotificationIcon, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutoTitleDirective, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, CsvUtils, DATE_ISO_PATTERN, DATE_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_MENU_SHOW_WHEN, 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, 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, FormGetGroupPipe, FormGetPipe, FormGetValuePipe, Fragments$1 as Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, IMAGE_DEFAULTS, ImagesUtils, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, Job, JobModule, JobProgression, JobProgressionComponent, JobProgressionService, JobProgressionServiceToken, JobProgressionTestService, JobProgressionTestingPage, JobTestingModule, 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, MOMENT_NO_TIME_PROPERTY, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBadgeIconDirective, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialTestingModule, MathAbsPipe, MenuComponent, MenuItems, MenuOptions, MenuService, Message, MessageFilter, MessageForm, MessageModal, MessageModule, MessageService, MessageTypeList, MessageTypes, MimeTypes, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyFormatPipe, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialFilter, ReferentialRef, ReferentialUtils, ReferentialValidatorService, RegisterConfirmPage, ResizableComponent, ResizableDirective, ResizableModule, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SHARED_MATERIAL_TESTING_PAGES, SHARED_TESTING_PAGES, SOCIAL_TESTING_PAGES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, ServerErrorCodes, SettingsPage, SharedAsyncValidators, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBadgeIconModule, SharedMatBooleanModule, SharedMatChipsModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedTestsPage, SharedValidators, SocialErrorCodes, SocialModule, SocialModuleOptionsToken, SocialTestingModule, Software, StartableService, StatusById, StatusIds, StatusList, StrIncludesPipe, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, TableTestPage, TableTestingModule, TextForm, TextPopover, TextPopoverTestingModule, TextPopoverTestingPage, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, USER_EVENT_SERVICE, UploadFile, UploadFileComponent, UploadFilePopover, UploadFileTestingModule, UploadFileTestingPage, UriUtils, UserEventModule, UserEventTestService, UserEventTestingModule, UserEventTestingPage, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, escapeRegExp, 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, isBlankString, isControlHasInput, isCordova, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilBoolean, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isProgressEvent, isResponseEvent, isTouchUi, isWindows, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, moment$5 as moment, 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, tz, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForFalse, waitForTrue, waitIdle, waitWhilePending, ɵ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, AppUpdateOfflineModeCard as ɵi, UserEventNotificationList as ɵj, JobProgressionList as ɵk, DateTestPage as ɵl, NumpadTestPage as ɵm, MatBadgeIconTestPage as ɵn, ToastTestingModule as ɵo, ToastTestingPage as ɵp };
30183
+ export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_JOB_PROGRESSION_SERVICE, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_MENU_OPTIONS, APP_TESTING_PAGES, APP_USER_EVENT_SERVICE, AboutModal, AbstractUserEventService, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AndroidOsEnvironment, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppEntityEditorModal, AppEntityEditorModalOptions, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppIconComponent, AppIconModule, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutoTitleDirective, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, CsvUtils, DATE_ISO_PATTERN, DATE_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_MENU_SHOW_WHEN, 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, 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, FormGetGroupPipe, FormGetPipe, FormGetValuePipe, Fragments$1 as Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, IMAGE_DEFAULTS, ImagesUtils, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, Job, JobModule, JobProgression, JobProgressionIcon, JobProgressionList, JobProgressionService, JobProgressionTestService, JobProgressionTestingPage, JobTestingModule, 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, MOMENT_NO_TIME_PROPERTY, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBadgeIconDirective, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialTestingModule, MathAbsPipe, MenuComponent, MenuItems, MenuOptions, MenuService, Message, MessageFilter, MessageForm, MessageModal, MessageModule, MessageService, MessageTypeList, MessageTypes, MimeTypes, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyFormatPipe, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialFilter, ReferentialRef, ReferentialUtils, ReferentialValidatorService, RegisterConfirmPage, ResizableComponent, ResizableDirective, ResizableModule, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SHARED_MATERIAL_TESTING_PAGES, SHARED_TESTING_PAGES, SOCIAL_TESTING_PAGES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, ServerErrorCodes, SettingsPage, SharedAsyncValidators, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBadgeIconModule, SharedMatBooleanModule, SharedMatChipsModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedTestsPage, SharedValidators, SocialErrorCodes, SocialModule, SocialModuleOptionsToken, SocialTestingModule, 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, UriUtils, UserEventModule, UserEventNotificationIcon, UserEventTestService, UserEventTestingModule, UserEventTestingPage, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, escapeRegExp, 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, isBlankString, isControlHasInput, isCordova, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilBoolean, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isProgressEvent, isResponseEvent, isTouchUi, isWindows, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, moment$5 as moment, 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, tz, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForFalse, waitForTrue, waitIdle, waitWhilePending, ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, StartableObservableService as ɵc, isFocusableElement as ɵd, RegisterForm as ɵe, AccountValidatorService as ɵf, RegisterModal as ɵg, UserSettingsValidatorService as ɵh, LocalSettingsValidatorService as ɵi, AppUpdateOfflineModeCard as ɵj, UserEventNotificationList as ɵk, DateTestPage as ɵl, NumpadTestPage as ɵm, MatBadgeIconTestPage as ɵn, ToastTestingModule as ɵo, ToastTestingPage as ɵp };
29988
30184
  //# sourceMappingURL=sumaris-net.ngx-components.js.map